@mastra/server 0.0.0-message-ordering-20250415215612 → 0.0.0-remove-cloud-span-transform-20250425214156
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 +99 -24
- package/dist/_tsup-dts-rollup.d.ts +99 -24
- package/dist/{chunk-A7DF4ETD.cjs → chunk-55HTWX4C.cjs} +2 -9
- package/dist/{chunk-UV4WTEH4.js → chunk-5JNVY6DU.js} +5 -5
- package/dist/{chunk-QH6XWSXP.cjs → chunk-5SWCVTNL.cjs} +38 -38
- package/dist/{chunk-CWSDZEZG.cjs → chunk-7IWQE76Z.cjs} +2 -2
- package/dist/chunk-B66WVPGJ.js +297 -0
- package/dist/{chunk-PDC4ZBQW.cjs → chunk-D3G23FP3.cjs} +9 -9
- package/dist/{chunk-JLDXUWK7.cjs → chunk-FPIWDH5Y.cjs} +4 -4
- package/dist/{chunk-Z46X3YCB.cjs → chunk-HCOPJZ4A.cjs} +11 -11
- package/dist/{chunk-OPP7H5TW.js → chunk-LFOBHRFO.js} +10 -10
- package/dist/{chunk-VK6FX47H.js → chunk-OMN3UI6X.js} +38 -38
- package/dist/{chunk-3RVHWGWO.js → chunk-Q6SHQECN.js} +2 -9
- package/dist/{chunk-67WTHYAV.js → chunk-R4J7XQYU.js} +7 -7
- package/dist/{chunk-YANVFOYA.js → chunk-RE6YL32K.js} +4 -4
- package/dist/{chunk-B64YROKU.cjs → chunk-TZK63M5N.cjs} +16 -16
- package/dist/{chunk-DVPP5S6I.js → chunk-WTHDCRMY.js} +2 -2
- package/dist/chunk-ZHNKYTNS.cjs +309 -0
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.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/vNextWorkflows.cjs +46 -0
- package/dist/server/handlers/vNextWorkflows.d.cts +10 -0
- package/dist/server/handlers/vNextWorkflows.d.ts +10 -0
- package/dist/server/handlers/vNextWorkflows.js +1 -0
- 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 +17 -12
- package/dist/server/handlers.d.cts +1 -0
- package/dist/server/handlers.d.ts +1 -0
- package/dist/server/handlers.js +7 -6
- package/package.json +3 -3
|
@@ -69,7 +69,7 @@ async function getNetworkByIdHandler({ mastra, networkId }) {
|
|
|
69
69
|
}
|
|
70
70
|
async function generateHandler({
|
|
71
71
|
mastra,
|
|
72
|
-
|
|
72
|
+
runtimeContext,
|
|
73
73
|
networkId,
|
|
74
74
|
body
|
|
75
75
|
}) {
|
|
@@ -80,7 +80,7 @@ async function generateHandler({
|
|
|
80
80
|
}
|
|
81
81
|
validateBody({ messages: body.messages });
|
|
82
82
|
const { messages, ...rest } = body;
|
|
83
|
-
const result = await network.generate(messages, { ...rest,
|
|
83
|
+
const result = await network.generate(messages, { ...rest, runtimeContext });
|
|
84
84
|
return result;
|
|
85
85
|
} catch (error) {
|
|
86
86
|
return handleError(error, "Error generating from network");
|
|
@@ -90,7 +90,7 @@ async function streamGenerateHandler({
|
|
|
90
90
|
mastra,
|
|
91
91
|
networkId,
|
|
92
92
|
body,
|
|
93
|
-
|
|
93
|
+
runtimeContext
|
|
94
94
|
}) {
|
|
95
95
|
try {
|
|
96
96
|
const network = mastra.getNetwork(networkId);
|
|
@@ -102,7 +102,7 @@ async function streamGenerateHandler({
|
|
|
102
102
|
const streamResult = await network.stream(messages, {
|
|
103
103
|
output,
|
|
104
104
|
...rest,
|
|
105
|
-
|
|
105
|
+
runtimeContext
|
|
106
106
|
});
|
|
107
107
|
const streamResponse = output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
|
|
108
108
|
sendUsage: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5SWCVTNL_cjs = require('./chunk-5SWCVTNL.cjs');
|
|
4
4
|
var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
|
|
5
5
|
var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
|
|
6
6
|
var web = require('stream/web');
|
|
@@ -30,13 +30,13 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
30
30
|
serializedStepGraph: workflow.serializedStepGraph,
|
|
31
31
|
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
32
32
|
name: workflow.name,
|
|
33
|
-
triggerSchema: workflow.triggerSchema ?
|
|
33
|
+
triggerSchema: workflow.triggerSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
34
34
|
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
35
35
|
const _step = step;
|
|
36
36
|
acc2[key2] = {
|
|
37
37
|
..._step,
|
|
38
|
-
inputSchema: _step.inputSchema ?
|
|
39
|
-
outputSchema: _step.outputSchema ?
|
|
38
|
+
inputSchema: _step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
39
|
+
outputSchema: _step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.outputSchema)) : void 0
|
|
40
40
|
};
|
|
41
41
|
return acc2;
|
|
42
42
|
}, {})
|
|
@@ -63,13 +63,13 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
63
63
|
serializedStepGraph: workflow.serializedStepGraph,
|
|
64
64
|
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
65
65
|
name: workflow.name,
|
|
66
|
-
triggerSchema: workflow.triggerSchema ?
|
|
66
|
+
triggerSchema: workflow.triggerSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
67
67
|
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
68
68
|
const _step = step;
|
|
69
69
|
acc[key] = {
|
|
70
70
|
..._step,
|
|
71
|
-
inputSchema: _step.inputSchema ?
|
|
72
|
-
outputSchema: _step.outputSchema ?
|
|
71
|
+
inputSchema: _step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
72
|
+
outputSchema: _step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.outputSchema)) : void 0
|
|
73
73
|
};
|
|
74
74
|
return acc;
|
|
75
75
|
}, {})
|
|
@@ -80,7 +80,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
80
80
|
}
|
|
81
81
|
async function startAsyncWorkflowHandler({
|
|
82
82
|
mastra,
|
|
83
|
-
|
|
83
|
+
runtimeContext,
|
|
84
84
|
workflowId,
|
|
85
85
|
runId,
|
|
86
86
|
triggerData
|
|
@@ -97,7 +97,7 @@ async function startAsyncWorkflowHandler({
|
|
|
97
97
|
const { start } = workflow.createRun();
|
|
98
98
|
const result2 = await start({
|
|
99
99
|
triggerData,
|
|
100
|
-
|
|
100
|
+
runtimeContext
|
|
101
101
|
});
|
|
102
102
|
return result2;
|
|
103
103
|
}
|
|
@@ -107,7 +107,7 @@ async function startAsyncWorkflowHandler({
|
|
|
107
107
|
}
|
|
108
108
|
const result = await run.start({
|
|
109
109
|
triggerData,
|
|
110
|
-
|
|
110
|
+
runtimeContext
|
|
111
111
|
});
|
|
112
112
|
return result;
|
|
113
113
|
} catch (error) {
|
|
@@ -160,7 +160,7 @@ async function createRunHandler({
|
|
|
160
160
|
}
|
|
161
161
|
async function startWorkflowRunHandler({
|
|
162
162
|
mastra,
|
|
163
|
-
|
|
163
|
+
runtimeContext,
|
|
164
164
|
workflowId,
|
|
165
165
|
runId,
|
|
166
166
|
triggerData
|
|
@@ -179,7 +179,7 @@ async function startWorkflowRunHandler({
|
|
|
179
179
|
}
|
|
180
180
|
await run.start({
|
|
181
181
|
triggerData,
|
|
182
|
-
|
|
182
|
+
runtimeContext
|
|
183
183
|
});
|
|
184
184
|
return { message: "Workflow run started" };
|
|
185
185
|
} catch (e) {
|
|
@@ -235,7 +235,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
235
235
|
workflowId,
|
|
236
236
|
runId,
|
|
237
237
|
body,
|
|
238
|
-
|
|
238
|
+
runtimeContext
|
|
239
239
|
}) {
|
|
240
240
|
try {
|
|
241
241
|
if (!workflowId) {
|
|
@@ -252,7 +252,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
252
252
|
const result = await run.resume({
|
|
253
253
|
stepId: body.stepId,
|
|
254
254
|
context: body.context,
|
|
255
|
-
|
|
255
|
+
runtimeContext
|
|
256
256
|
});
|
|
257
257
|
return result;
|
|
258
258
|
} catch (error) {
|
|
@@ -264,7 +264,7 @@ async function resumeWorkflowHandler({
|
|
|
264
264
|
workflowId,
|
|
265
265
|
runId,
|
|
266
266
|
body,
|
|
267
|
-
|
|
267
|
+
runtimeContext
|
|
268
268
|
}) {
|
|
269
269
|
try {
|
|
270
270
|
if (!workflowId) {
|
|
@@ -281,7 +281,7 @@ async function resumeWorkflowHandler({
|
|
|
281
281
|
await run.resume({
|
|
282
282
|
stepId: body.stepId,
|
|
283
283
|
context: body.context,
|
|
284
|
-
|
|
284
|
+
runtimeContext
|
|
285
285
|
});
|
|
286
286
|
return { message: "Workflow run resumed" };
|
|
287
287
|
} catch (error) {
|
|
@@ -27,7 +27,7 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
27
27
|
return [key, value];
|
|
28
28
|
})
|
|
29
29
|
) : void 0;
|
|
30
|
-
const traces = await storage.
|
|
30
|
+
const traces = await storage.getTraces({
|
|
31
31
|
name,
|
|
32
32
|
scope,
|
|
33
33
|
page: Number(page ?? 0),
|
|
@@ -105,7 +105,7 @@ async function storeTelemetryHandler({ mastra, body }) {
|
|
|
105
105
|
}
|
|
106
106
|
return acc;
|
|
107
107
|
}, []);
|
|
108
|
-
return storage.
|
|
108
|
+
return storage.batchTraceInsert({
|
|
109
109
|
records: allSpans
|
|
110
110
|
}).then(() => {
|
|
111
111
|
return {
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk5SWCVTNL_cjs = require('./chunk-5SWCVTNL.cjs');
|
|
4
|
+
var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
|
|
5
|
+
var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
|
|
6
|
+
var web = require('stream/web');
|
|
7
|
+
|
|
8
|
+
// src/server/handlers/vNextWorkflows.ts
|
|
9
|
+
var vNextWorkflows_exports = {};
|
|
10
|
+
chunkFV45V6WC_cjs.__export(vNextWorkflows_exports, {
|
|
11
|
+
createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
|
|
12
|
+
getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
|
|
13
|
+
getVNextWorkflowRunHandler: () => getVNextWorkflowRunHandler,
|
|
14
|
+
getVNextWorkflowRunsHandler: () => getVNextWorkflowRunsHandler,
|
|
15
|
+
getVNextWorkflowsHandler: () => getVNextWorkflowsHandler,
|
|
16
|
+
resumeAsyncVNextWorkflowHandler: () => resumeAsyncVNextWorkflowHandler,
|
|
17
|
+
resumeVNextWorkflowHandler: () => resumeVNextWorkflowHandler,
|
|
18
|
+
startAsyncVNextWorkflowHandler: () => startAsyncVNextWorkflowHandler,
|
|
19
|
+
startVNextWorkflowRunHandler: () => startVNextWorkflowRunHandler,
|
|
20
|
+
watchVNextWorkflowHandler: () => watchVNextWorkflowHandler
|
|
21
|
+
});
|
|
22
|
+
async function getVNextWorkflowsHandler({ mastra }) {
|
|
23
|
+
try {
|
|
24
|
+
const workflows = mastra.vnext_getWorkflows({ serialized: false });
|
|
25
|
+
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
26
|
+
acc[key] = {
|
|
27
|
+
name: workflow.name,
|
|
28
|
+
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
29
|
+
acc2[key2] = {
|
|
30
|
+
...step,
|
|
31
|
+
inputSchema: step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.inputSchema)) : void 0,
|
|
32
|
+
outputSchema: step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.outputSchema)) : void 0
|
|
33
|
+
};
|
|
34
|
+
return acc2;
|
|
35
|
+
}, {}),
|
|
36
|
+
stepGraph: workflow.stepGraph,
|
|
37
|
+
inputSchema: workflow.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
38
|
+
outputSchema: workflow.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
39
|
+
};
|
|
40
|
+
return acc;
|
|
41
|
+
}, {});
|
|
42
|
+
return _workflows;
|
|
43
|
+
} catch (error) {
|
|
44
|
+
throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
48
|
+
try {
|
|
49
|
+
if (!workflowId) {
|
|
50
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
51
|
+
}
|
|
52
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
53
|
+
if (!workflow) {
|
|
54
|
+
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
58
|
+
acc[key] = {
|
|
59
|
+
...step,
|
|
60
|
+
inputSchema: step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.inputSchema)) : void 0,
|
|
61
|
+
outputSchema: step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(step.outputSchema)) : void 0
|
|
62
|
+
};
|
|
63
|
+
return acc;
|
|
64
|
+
}, {}),
|
|
65
|
+
name: workflow.name,
|
|
66
|
+
stepGraph: workflow.stepGraph,
|
|
67
|
+
inputSchema: workflow.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
68
|
+
outputSchema: workflow.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
69
|
+
};
|
|
70
|
+
} catch (error) {
|
|
71
|
+
throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function getVNextWorkflowRunHandler({
|
|
75
|
+
mastra,
|
|
76
|
+
workflowId,
|
|
77
|
+
runId
|
|
78
|
+
}) {
|
|
79
|
+
try {
|
|
80
|
+
if (!workflowId) {
|
|
81
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
82
|
+
}
|
|
83
|
+
if (!runId) {
|
|
84
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
85
|
+
}
|
|
86
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
87
|
+
if (!workflow) {
|
|
88
|
+
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
89
|
+
}
|
|
90
|
+
const run = await workflow.getWorkflowRun(runId);
|
|
91
|
+
if (!run) {
|
|
92
|
+
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
93
|
+
}
|
|
94
|
+
return run;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function createVNextWorkflowRunHandler({
|
|
100
|
+
mastra,
|
|
101
|
+
workflowId,
|
|
102
|
+
runId: prevRunId
|
|
103
|
+
}) {
|
|
104
|
+
try {
|
|
105
|
+
if (!workflowId) {
|
|
106
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
107
|
+
}
|
|
108
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
109
|
+
if (!workflow) {
|
|
110
|
+
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
111
|
+
}
|
|
112
|
+
const run = workflow.createRun({ runId: prevRunId });
|
|
113
|
+
return { runId: run.runId };
|
|
114
|
+
} catch (error) {
|
|
115
|
+
throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async function startAsyncVNextWorkflowHandler({
|
|
119
|
+
mastra,
|
|
120
|
+
runtimeContext,
|
|
121
|
+
workflowId,
|
|
122
|
+
runId,
|
|
123
|
+
inputData
|
|
124
|
+
}) {
|
|
125
|
+
try {
|
|
126
|
+
if (!workflowId) {
|
|
127
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
128
|
+
}
|
|
129
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
130
|
+
if (!workflow) {
|
|
131
|
+
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
132
|
+
}
|
|
133
|
+
const _run = workflow.createRun({ runId });
|
|
134
|
+
const result = await _run.start({
|
|
135
|
+
inputData,
|
|
136
|
+
runtimeContext
|
|
137
|
+
});
|
|
138
|
+
return result;
|
|
139
|
+
} catch (error) {
|
|
140
|
+
throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async function startVNextWorkflowRunHandler({
|
|
144
|
+
mastra,
|
|
145
|
+
runtimeContext,
|
|
146
|
+
workflowId,
|
|
147
|
+
runId,
|
|
148
|
+
inputData
|
|
149
|
+
}) {
|
|
150
|
+
try {
|
|
151
|
+
if (!workflowId) {
|
|
152
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
153
|
+
}
|
|
154
|
+
if (!runId) {
|
|
155
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
156
|
+
}
|
|
157
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
158
|
+
const run = await workflow.getWorkflowRun(runId);
|
|
159
|
+
if (!run) {
|
|
160
|
+
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
161
|
+
}
|
|
162
|
+
const _run = workflow.createRun({ runId });
|
|
163
|
+
await _run.start({
|
|
164
|
+
inputData,
|
|
165
|
+
runtimeContext
|
|
166
|
+
});
|
|
167
|
+
return { message: "Workflow run started" };
|
|
168
|
+
} catch (e) {
|
|
169
|
+
return chunkZLBRQFDD_cjs.handleError(e, "Error starting workflow run");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
async function watchVNextWorkflowHandler({
|
|
173
|
+
mastra,
|
|
174
|
+
workflowId,
|
|
175
|
+
runId
|
|
176
|
+
}) {
|
|
177
|
+
try {
|
|
178
|
+
if (!workflowId) {
|
|
179
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
180
|
+
}
|
|
181
|
+
if (!runId) {
|
|
182
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
183
|
+
}
|
|
184
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
185
|
+
const run = await workflow.getWorkflowRun(runId);
|
|
186
|
+
if (!run) {
|
|
187
|
+
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
188
|
+
}
|
|
189
|
+
const _run = workflow.createRun({ runId });
|
|
190
|
+
let unwatch;
|
|
191
|
+
let asyncRef = null;
|
|
192
|
+
const stream = new web.ReadableStream({
|
|
193
|
+
start(controller) {
|
|
194
|
+
unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
|
|
195
|
+
controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
|
|
196
|
+
if (asyncRef) {
|
|
197
|
+
clearImmediate(asyncRef);
|
|
198
|
+
asyncRef = null;
|
|
199
|
+
}
|
|
200
|
+
asyncRef = setImmediate(async () => {
|
|
201
|
+
const runDone = payload.workflowState.status !== "running";
|
|
202
|
+
if (runDone) {
|
|
203
|
+
controller.close();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
cancel() {
|
|
209
|
+
unwatch?.();
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
return stream;
|
|
213
|
+
} catch (error) {
|
|
214
|
+
return chunkZLBRQFDD_cjs.handleError(error, "Error watching workflow");
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
async function resumeAsyncVNextWorkflowHandler({
|
|
218
|
+
mastra,
|
|
219
|
+
workflowId,
|
|
220
|
+
runId,
|
|
221
|
+
body,
|
|
222
|
+
runtimeContext
|
|
223
|
+
}) {
|
|
224
|
+
try {
|
|
225
|
+
if (!workflowId) {
|
|
226
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
227
|
+
}
|
|
228
|
+
if (!runId) {
|
|
229
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
230
|
+
}
|
|
231
|
+
if (!body.step) {
|
|
232
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
233
|
+
}
|
|
234
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
235
|
+
const run = await workflow.getWorkflowRun(runId);
|
|
236
|
+
if (!run) {
|
|
237
|
+
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
238
|
+
}
|
|
239
|
+
const _run = workflow.createRun({ runId });
|
|
240
|
+
const result = await _run.resume({
|
|
241
|
+
step: body.step,
|
|
242
|
+
resumeData: body.resumeData,
|
|
243
|
+
runtimeContext
|
|
244
|
+
});
|
|
245
|
+
return result;
|
|
246
|
+
} catch (error) {
|
|
247
|
+
return chunkZLBRQFDD_cjs.handleError(error, "Error resuming workflow step");
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
async function resumeVNextWorkflowHandler({
|
|
251
|
+
mastra,
|
|
252
|
+
workflowId,
|
|
253
|
+
runId,
|
|
254
|
+
body,
|
|
255
|
+
runtimeContext
|
|
256
|
+
}) {
|
|
257
|
+
try {
|
|
258
|
+
if (!workflowId) {
|
|
259
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
260
|
+
}
|
|
261
|
+
if (!runId) {
|
|
262
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
263
|
+
}
|
|
264
|
+
if (!body.step) {
|
|
265
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
266
|
+
}
|
|
267
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
268
|
+
const run = await workflow.getWorkflowRun(runId);
|
|
269
|
+
if (!run) {
|
|
270
|
+
throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
271
|
+
}
|
|
272
|
+
const _run = workflow.createRun({ runId });
|
|
273
|
+
await _run.resume({
|
|
274
|
+
step: body.step,
|
|
275
|
+
resumeData: body.resumeData,
|
|
276
|
+
runtimeContext
|
|
277
|
+
});
|
|
278
|
+
return { message: "Workflow run resumed" };
|
|
279
|
+
} catch (error) {
|
|
280
|
+
return chunkZLBRQFDD_cjs.handleError(error, "Error resuming workflow");
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
async function getVNextWorkflowRunsHandler({ mastra, workflowId }) {
|
|
284
|
+
try {
|
|
285
|
+
if (!workflowId) {
|
|
286
|
+
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
287
|
+
}
|
|
288
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
289
|
+
const workflowRuns = await workflow.getWorkflowRuns() || {
|
|
290
|
+
runs: [],
|
|
291
|
+
total: 0
|
|
292
|
+
};
|
|
293
|
+
return workflowRuns;
|
|
294
|
+
} catch (error) {
|
|
295
|
+
return chunkZLBRQFDD_cjs.handleError(error, "Error getting workflow runs");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
exports.createVNextWorkflowRunHandler = createVNextWorkflowRunHandler;
|
|
300
|
+
exports.getVNextWorkflowByIdHandler = getVNextWorkflowByIdHandler;
|
|
301
|
+
exports.getVNextWorkflowRunHandler = getVNextWorkflowRunHandler;
|
|
302
|
+
exports.getVNextWorkflowRunsHandler = getVNextWorkflowRunsHandler;
|
|
303
|
+
exports.getVNextWorkflowsHandler = getVNextWorkflowsHandler;
|
|
304
|
+
exports.resumeAsyncVNextWorkflowHandler = resumeAsyncVNextWorkflowHandler;
|
|
305
|
+
exports.resumeVNextWorkflowHandler = resumeVNextWorkflowHandler;
|
|
306
|
+
exports.startAsyncVNextWorkflowHandler = startAsyncVNextWorkflowHandler;
|
|
307
|
+
exports.startVNextWorkflowRunHandler = startVNextWorkflowRunHandler;
|
|
308
|
+
exports.vNextWorkflows_exports = vNextWorkflows_exports;
|
|
309
|
+
exports.watchVNextWorkflowHandler = watchVNextWorkflowHandler;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHCOPJZ4A_cjs = require('../../chunk-HCOPJZ4A.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "generateHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkHCOPJZ4A_cjs.generateHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getAgentByIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkHCOPJZ4A_cjs.getAgentByIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getAgentsHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkHCOPJZ4A_cjs.getAgentsHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getEvalsByAgentIdHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkHCOPJZ4A_cjs.getEvalsByAgentIdHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getLiveEvalsByAgentIdHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkHCOPJZ4A_cjs.getLiveEvalsByAgentIdHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "streamGenerateHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkHCOPJZ4A_cjs.streamGenerateHandler; }
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-
|
|
1
|
+
export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-R4J7XQYU.js';
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFPIWDH5Y_cjs = require('../../chunk-FPIWDH5Y.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "generateHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkFPIWDH5Y_cjs.generateHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getNetworkByIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkFPIWDH5Y_cjs.getNetworkByIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getNetworksHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkFPIWDH5Y_cjs.getNetworksHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "streamGenerateHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkFPIWDH5Y_cjs.streamGenerateHandler; }
|
|
22
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { generateHandler, getNetworkByIdHandler, getNetworksHandler, streamGenerateHandler } from '../../chunk-
|
|
1
|
+
export { generateHandler, getNetworkByIdHandler, getNetworksHandler, streamGenerateHandler } from '../../chunk-RE6YL32K.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7IWQE76Z_cjs = require('../../chunk-7IWQE76Z.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "getTelemetryHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk7IWQE76Z_cjs.getTelemetryHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "storeTelemetryHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk7IWQE76Z_cjs.storeTelemetryHandler; }
|
|
14
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getTelemetryHandler, storeTelemetryHandler } from '../../chunk-
|
|
1
|
+
export { getTelemetryHandler, storeTelemetryHandler } from '../../chunk-WTHDCRMY.js';
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkD3G23FP3_cjs = require('../../chunk-D3G23FP3.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "executeAgentToolHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkD3G23FP3_cjs.executeAgentToolHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "executeToolHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkD3G23FP3_cjs.executeToolHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getToolByIdHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkD3G23FP3_cjs.getToolByIdHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getToolsHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkD3G23FP3_cjs.getToolsHandler; }
|
|
22
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { executeAgentToolHandler, executeToolHandler, getToolByIdHandler, getToolsHandler } from '../../chunk-
|
|
1
|
+
export { executeAgentToolHandler, executeToolHandler, getToolByIdHandler, getToolsHandler } from '../../chunk-5JNVY6DU.js';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkZHNKYTNS_cjs = require('../../chunk-ZHNKYTNS.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "createVNextWorkflowRunHandler", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkZHNKYTNS_cjs.createVNextWorkflowRunHandler; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "getVNextWorkflowByIdHandler", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkZHNKYTNS_cjs.getVNextWorkflowByIdHandler; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "getVNextWorkflowRunHandler", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkZHNKYTNS_cjs.getVNextWorkflowRunHandler; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "getVNextWorkflowRunsHandler", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkZHNKYTNS_cjs.getVNextWorkflowRunsHandler; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "getVNextWorkflowsHandler", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkZHNKYTNS_cjs.getVNextWorkflowsHandler; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "resumeAsyncVNextWorkflowHandler", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkZHNKYTNS_cjs.resumeAsyncVNextWorkflowHandler; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "resumeVNextWorkflowHandler", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkZHNKYTNS_cjs.resumeVNextWorkflowHandler; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "startAsyncVNextWorkflowHandler", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkZHNKYTNS_cjs.startAsyncVNextWorkflowHandler; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "startVNextWorkflowRunHandler", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkZHNKYTNS_cjs.startVNextWorkflowRunHandler; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "watchVNextWorkflowHandler", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkZHNKYTNS_cjs.watchVNextWorkflowHandler; }
|
|
46
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { getVNextWorkflowsHandler } from '../../_tsup-dts-rollup.cjs';
|
|
2
|
+
export { getVNextWorkflowByIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
3
|
+
export { getVNextWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
4
|
+
export { createVNextWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
5
|
+
export { startAsyncVNextWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
6
|
+
export { startVNextWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
7
|
+
export { watchVNextWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
8
|
+
export { resumeAsyncVNextWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
9
|
+
export { resumeVNextWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
10
|
+
export { getVNextWorkflowRunsHandler } from '../../_tsup-dts-rollup.cjs';
|