@mastra/server 0.0.0-vnext-inngest-20250508131921 → 0.0.0-vnextAgentNetwork-20250527091247
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 +251 -93
- package/dist/_tsup-dts-rollup.d.ts +251 -93
- package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
- 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-SKBVVI24.cjs → chunk-7DLZLWJV.cjs} +12 -11
- package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
- package/dist/{chunk-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
- package/dist/{chunk-6Q7UXAYJ.cjs → chunk-D4IRYCUI.cjs} +57 -20
- package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/{chunk-Q6SHQECN.js → chunk-HFWCEP5S.js} +4 -3
- package/dist/{chunk-OWNA6I2H.js → chunk-KUNQFY2W.js} +98 -45
- 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-MMO2HDM6.cjs +378 -0
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/{chunk-BPL2CBLV.js → chunk-OR3CIE2H.js} +3 -2
- package/dist/chunk-P6SCPDYW.js +500 -0
- package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
- package/dist/{chunk-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
- package/dist/{chunk-3XTEV33Q.js → chunk-W7VCKPAD.js} +53 -50
- package/dist/{chunk-3EJZQ6TQ.js → chunk-WFBJJNCK.js} +6 -5
- package/dist/{chunk-GVBJ5I2S.js → chunk-WUC6LSTW.js} +41 -4
- package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
- package/dist/{chunk-55HTWX4C.cjs → chunk-YBVOQN4M.cjs} +20 -19
- package/dist/chunk-YIOVBYZH.cjs +332 -0
- 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/legacyWorkflows.cjs +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- 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/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 +17 -13
- package/dist/server/handlers/workflows.d.cts +3 -2
- package/dist/server/handlers/workflows.d.ts +3 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +32 -27
- package/dist/server/handlers.d.cts +2 -1
- package/dist/server/handlers.d.ts +2 -1
- package/dist/server/handlers.js +11 -10
- package/package.json +6 -4
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-CHFORQ7J.cjs +0 -329
- package/dist/chunk-M2RXDCPV.cjs +0 -324
- package/dist/chunk-OMN3UI6X.js +0 -5576
- package/dist/server/handlers/vNextWorkflows.cjs +0 -46
- package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
- package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
- package/dist/server/handlers/vNextWorkflows.js +0 -1
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
2
|
-
import { handleError } from './chunk-
|
|
3
|
-
import {
|
|
1
|
+
import { stringify, esm_default } from './chunk-LIVAK2DM.js';
|
|
2
|
+
import { handleError } from './chunk-M5ABIP7D.js';
|
|
3
|
+
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
4
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
4
5
|
import { ReadableStream } from 'node:stream/web';
|
|
6
|
+
import { RuntimeContext } from '@mastra/core/di';
|
|
5
7
|
|
|
6
|
-
// src/server/handlers/
|
|
7
|
-
var
|
|
8
|
-
__export(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
// src/server/handlers/workflows.ts
|
|
9
|
+
var workflows_exports = {};
|
|
10
|
+
__export(workflows_exports, {
|
|
11
|
+
createWorkflowRunHandler: () => createWorkflowRunHandler,
|
|
12
|
+
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
13
|
+
getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
|
|
14
|
+
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
15
|
+
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
16
|
+
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
17
|
+
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
18
|
+
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
19
|
+
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
20
|
+
streamWorkflowHandler: () => streamWorkflowHandler,
|
|
21
|
+
watchWorkflowHandler: () => watchWorkflowHandler
|
|
19
22
|
});
|
|
20
|
-
async function
|
|
23
|
+
async function getWorkflowsHandler({ mastra }) {
|
|
21
24
|
try {
|
|
22
|
-
const workflows = mastra.
|
|
25
|
+
const workflows = mastra.getWorkflows({ serialized: false });
|
|
23
26
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
24
27
|
acc[key] = {
|
|
25
28
|
name: workflow.name,
|
|
29
|
+
description: workflow.description,
|
|
26
30
|
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
27
31
|
acc2[key2] = {
|
|
28
32
|
id: step.id,
|
|
@@ -45,12 +49,12 @@ async function getVNextWorkflowsHandler({ mastra }) {
|
|
|
45
49
|
throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
|
-
async function
|
|
52
|
+
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
49
53
|
try {
|
|
50
54
|
if (!workflowId) {
|
|
51
55
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
52
56
|
}
|
|
53
|
-
const workflow = mastra.
|
|
57
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
54
58
|
if (!workflow) {
|
|
55
59
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
56
60
|
}
|
|
@@ -67,6 +71,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
67
71
|
return acc;
|
|
68
72
|
}, {}),
|
|
69
73
|
name: workflow.name,
|
|
74
|
+
description: workflow.description,
|
|
70
75
|
stepGraph: workflow.serializedStepGraph,
|
|
71
76
|
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
72
77
|
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
@@ -75,7 +80,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
75
80
|
throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
76
81
|
}
|
|
77
82
|
}
|
|
78
|
-
async function
|
|
83
|
+
async function getWorkflowRunByIdHandler({
|
|
79
84
|
mastra,
|
|
80
85
|
workflowId,
|
|
81
86
|
runId
|
|
@@ -87,7 +92,7 @@ async function getVNextWorkflowRunByIdHandler({
|
|
|
87
92
|
if (!runId) {
|
|
88
93
|
throw new HTTPException(400, { message: "Run ID is required" });
|
|
89
94
|
}
|
|
90
|
-
const workflow = mastra.
|
|
95
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
91
96
|
if (!workflow) {
|
|
92
97
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
93
98
|
}
|
|
@@ -100,7 +105,7 @@ async function getVNextWorkflowRunByIdHandler({
|
|
|
100
105
|
throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
|
-
async function
|
|
108
|
+
async function createWorkflowRunHandler({
|
|
104
109
|
mastra,
|
|
105
110
|
workflowId,
|
|
106
111
|
runId: prevRunId
|
|
@@ -109,7 +114,7 @@ async function createVNextWorkflowRunHandler({
|
|
|
109
114
|
if (!workflowId) {
|
|
110
115
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
111
116
|
}
|
|
112
|
-
const workflow = mastra.
|
|
117
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
113
118
|
if (!workflow) {
|
|
114
119
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
115
120
|
}
|
|
@@ -119,37 +124,43 @@ async function createVNextWorkflowRunHandler({
|
|
|
119
124
|
throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
120
125
|
}
|
|
121
126
|
}
|
|
122
|
-
async function
|
|
127
|
+
async function startAsyncWorkflowHandler({
|
|
123
128
|
mastra,
|
|
124
129
|
runtimeContext,
|
|
125
130
|
workflowId,
|
|
126
131
|
runId,
|
|
127
|
-
inputData
|
|
132
|
+
inputData,
|
|
133
|
+
runtimeContextFromRequest
|
|
128
134
|
}) {
|
|
129
135
|
try {
|
|
130
136
|
if (!workflowId) {
|
|
131
137
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
132
138
|
}
|
|
133
|
-
const workflow = mastra.
|
|
139
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
134
140
|
if (!workflow) {
|
|
135
141
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
136
142
|
}
|
|
143
|
+
const finalRuntimeContext = new RuntimeContext([
|
|
144
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
145
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
146
|
+
]);
|
|
137
147
|
const _run = workflow.createRun({ runId });
|
|
138
148
|
const result = await _run.start({
|
|
139
149
|
inputData,
|
|
140
|
-
runtimeContext
|
|
150
|
+
runtimeContext: finalRuntimeContext
|
|
141
151
|
});
|
|
142
152
|
return result;
|
|
143
153
|
} catch (error) {
|
|
144
154
|
throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
145
155
|
}
|
|
146
156
|
}
|
|
147
|
-
async function
|
|
157
|
+
async function startWorkflowRunHandler({
|
|
148
158
|
mastra,
|
|
149
159
|
runtimeContext,
|
|
150
160
|
workflowId,
|
|
151
161
|
runId,
|
|
152
|
-
inputData
|
|
162
|
+
inputData,
|
|
163
|
+
runtimeContextFromRequest
|
|
153
164
|
}) {
|
|
154
165
|
try {
|
|
155
166
|
if (!workflowId) {
|
|
@@ -158,22 +169,26 @@ async function startVNextWorkflowRunHandler({
|
|
|
158
169
|
if (!runId) {
|
|
159
170
|
throw new HTTPException(400, { message: "runId required to start run" });
|
|
160
171
|
}
|
|
161
|
-
const workflow = mastra.
|
|
172
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
162
173
|
const run = await workflow.getWorkflowRunById(runId);
|
|
163
174
|
if (!run) {
|
|
164
175
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
165
176
|
}
|
|
177
|
+
const finalRuntimeContext = new RuntimeContext([
|
|
178
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
179
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
180
|
+
]);
|
|
166
181
|
const _run = workflow.createRun({ runId });
|
|
167
|
-
|
|
182
|
+
void _run.start({
|
|
168
183
|
inputData,
|
|
169
|
-
runtimeContext
|
|
184
|
+
runtimeContext: finalRuntimeContext
|
|
170
185
|
});
|
|
171
186
|
return { message: "Workflow run started" };
|
|
172
187
|
} catch (e) {
|
|
173
188
|
return handleError(e, "Error starting workflow run");
|
|
174
189
|
}
|
|
175
190
|
}
|
|
176
|
-
async function
|
|
191
|
+
async function watchWorkflowHandler({
|
|
177
192
|
mastra,
|
|
178
193
|
workflowId,
|
|
179
194
|
runId
|
|
@@ -185,7 +200,7 @@ async function watchVNextWorkflowHandler({
|
|
|
185
200
|
if (!runId) {
|
|
186
201
|
throw new HTTPException(400, { message: "runId required to watch workflow" });
|
|
187
202
|
}
|
|
188
|
-
const workflow = mastra.
|
|
203
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
189
204
|
const run = await workflow.getWorkflowRunById(runId);
|
|
190
205
|
if (!run) {
|
|
191
206
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -219,12 +234,46 @@ async function watchVNextWorkflowHandler({
|
|
|
219
234
|
return handleError(error, "Error watching workflow");
|
|
220
235
|
}
|
|
221
236
|
}
|
|
222
|
-
|
|
237
|
+
function streamWorkflowHandler({
|
|
238
|
+
mastra,
|
|
239
|
+
runtimeContext,
|
|
240
|
+
workflowId,
|
|
241
|
+
runId,
|
|
242
|
+
inputData,
|
|
243
|
+
runtimeContextFromRequest
|
|
244
|
+
}) {
|
|
245
|
+
try {
|
|
246
|
+
if (!workflowId) {
|
|
247
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
248
|
+
}
|
|
249
|
+
if (!runId) {
|
|
250
|
+
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
251
|
+
}
|
|
252
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
253
|
+
if (!workflow) {
|
|
254
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
255
|
+
}
|
|
256
|
+
const finalRuntimeContext = new RuntimeContext([
|
|
257
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
258
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
259
|
+
]);
|
|
260
|
+
const run = workflow.createRun({ runId });
|
|
261
|
+
const result = run.stream({
|
|
262
|
+
inputData,
|
|
263
|
+
runtimeContext: finalRuntimeContext
|
|
264
|
+
});
|
|
265
|
+
return result;
|
|
266
|
+
} catch (error) {
|
|
267
|
+
return handleError(error, "Error executing workflow");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
async function resumeAsyncWorkflowHandler({
|
|
223
271
|
mastra,
|
|
224
272
|
workflowId,
|
|
225
273
|
runId,
|
|
226
274
|
body,
|
|
227
|
-
runtimeContext
|
|
275
|
+
runtimeContext,
|
|
276
|
+
runtimeContextFromRequest
|
|
228
277
|
}) {
|
|
229
278
|
try {
|
|
230
279
|
if (!workflowId) {
|
|
@@ -236,23 +285,27 @@ async function resumeAsyncVNextWorkflowHandler({
|
|
|
236
285
|
if (!body.step) {
|
|
237
286
|
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
238
287
|
}
|
|
239
|
-
const workflow = mastra.
|
|
288
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
240
289
|
const run = await workflow.getWorkflowRunById(runId);
|
|
241
290
|
if (!run) {
|
|
242
291
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
243
292
|
}
|
|
293
|
+
const finalRuntimeContext = new RuntimeContext([
|
|
294
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
295
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
296
|
+
]);
|
|
244
297
|
const _run = workflow.createRun({ runId });
|
|
245
298
|
const result = await _run.resume({
|
|
246
299
|
step: body.step,
|
|
247
300
|
resumeData: body.resumeData,
|
|
248
|
-
runtimeContext
|
|
301
|
+
runtimeContext: finalRuntimeContext
|
|
249
302
|
});
|
|
250
303
|
return result;
|
|
251
304
|
} catch (error) {
|
|
252
305
|
return handleError(error, "Error resuming workflow step");
|
|
253
306
|
}
|
|
254
307
|
}
|
|
255
|
-
async function
|
|
308
|
+
async function resumeWorkflowHandler({
|
|
256
309
|
mastra,
|
|
257
310
|
workflowId,
|
|
258
311
|
runId,
|
|
@@ -269,13 +322,13 @@ async function resumeVNextWorkflowHandler({
|
|
|
269
322
|
if (!body.step) {
|
|
270
323
|
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
271
324
|
}
|
|
272
|
-
const workflow = mastra.
|
|
325
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
273
326
|
const run = await workflow.getWorkflowRunById(runId);
|
|
274
327
|
if (!run) {
|
|
275
328
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
276
329
|
}
|
|
277
330
|
const _run = workflow.createRun({ runId });
|
|
278
|
-
|
|
331
|
+
void _run.resume({
|
|
279
332
|
step: body.step,
|
|
280
333
|
resumeData: body.resumeData,
|
|
281
334
|
runtimeContext
|
|
@@ -285,7 +338,7 @@ async function resumeVNextWorkflowHandler({
|
|
|
285
338
|
return handleError(error, "Error resuming workflow");
|
|
286
339
|
}
|
|
287
340
|
}
|
|
288
|
-
async function
|
|
341
|
+
async function getWorkflowRunsHandler({
|
|
289
342
|
mastra,
|
|
290
343
|
workflowId,
|
|
291
344
|
fromDate,
|
|
@@ -298,7 +351,7 @@ async function getVNextWorkflowRunsHandler({
|
|
|
298
351
|
if (!workflowId) {
|
|
299
352
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
300
353
|
}
|
|
301
|
-
const workflow = mastra.
|
|
354
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
302
355
|
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
303
356
|
runs: [],
|
|
304
357
|
total: 0
|
|
@@ -309,4 +362,4 @@ async function getVNextWorkflowRunsHandler({
|
|
|
309
362
|
}
|
|
310
363
|
}
|
|
311
364
|
|
|
312
|
-
export {
|
|
365
|
+
export { createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
|