@mastra/server 0.0.0-tool-call-parts-20250630193309 → 0.0.0-transpile-packages-20250730132657
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/LICENSE.md +11 -42
- package/dist/_tsup-dts-rollup.d.cts +212 -23
- package/dist/_tsup-dts-rollup.d.ts +212 -23
- package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
- package/dist/{chunk-VPNDC2DI.cjs → chunk-2SLFAFTR.cjs} +12 -12
- package/dist/{chunk-MEGCYGBU.js → chunk-36BLNJHS.js} +37 -37
- package/dist/chunk-424T5F2J.cjs +157 -0
- package/dist/{chunk-QLG2PFHE.js → chunk-4D66QEKC.js} +2 -2
- package/dist/{chunk-L3VURYKY.cjs → chunk-6KP2OBYA.cjs} +177 -68
- package/dist/chunk-6T5JUKOQ.js +149 -0
- package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
- package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
- package/dist/{chunk-C7564HUT.js → chunk-CRCR3ZUK.js} +3 -3
- package/dist/{chunk-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
- package/dist/{chunk-LI436ITD.cjs → chunk-HISYIDYH.cjs} +37 -37
- package/dist/{chunk-Z3PTO2AK.cjs → chunk-HRSAZUIK.cjs} +20 -20
- package/dist/{chunk-EP3XVEVC.cjs → chunk-I5JKUCGE.cjs} +50 -20
- package/dist/{chunk-R5VGYBV6.js → chunk-KHZKYUNR.js} +3 -3
- package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
- package/dist/chunk-LF7P5PLR.js +14 -0
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/{chunk-IMBY5XUG.cjs → chunk-QGX47B5D.cjs} +7 -7
- package/dist/chunk-R3I7AJVL.js +507 -0
- package/dist/{chunk-BFOA2QQY.js → chunk-RG473F6Y.js} +2 -2
- package/dist/{chunk-WJY57THV.cjs → chunk-RHSWAXKB.cjs} +22 -22
- package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
- package/dist/{chunk-72LOJGUV.js → chunk-T7HAZC2E.js} +118 -12
- package/dist/chunk-TTPJHP42.cjs +522 -0
- package/dist/{chunk-NGHSYB5B.cjs → chunk-UCV4247U.cjs} +43 -43
- package/dist/{chunk-2BCWG3EZ.js → chunk-VTTN2FW3.js} +36 -7
- package/dist/{chunk-EWLR2PNT.js → chunk-WBRFIHSF.js} +4 -4
- package/dist/{chunk-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
- package/dist/{chunk-E2LP4J6K.js → chunk-ZYAFP2AV.js} +8 -8
- package/dist/server/handlers/agents.cjs +11 -7
- package/dist/server/handlers/agents.d.cts +1 -0
- package/dist/server/handlers/agents.d.ts +1 -0
- 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 +11 -11
- package/dist/server/handlers/legacyWorkflows.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 +29 -9
- package/dist/server/handlers/memory.d.cts +5 -0
- package/dist/server/handlers/memory.d.ts +5 -0
- 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/scores.cjs +30 -0
- package/dist/server/handlers/scores.d.cts +6 -0
- package/dist/server/handlers/scores.d.ts +6 -0
- package/dist/server/handlers/scores.js +1 -0
- 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/vNextNetwork.cjs +23 -23
- package/dist/server/handlers/vNextNetwork.js +4 -4
- 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 +25 -13
- package/dist/server/handlers/workflows.d.cts +3 -0
- package/dist/server/handlers/workflows.d.ts +3 -0
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +28 -23
- package/dist/server/handlers.d.cts +3 -2
- package/dist/server/handlers.d.ts +3 -2
- package/dist/server/handlers.js +11 -10
- package/package.json +8 -7
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-RQ2Z56EC.cjs +0 -251
- package/dist/chunk-XUIJ7WRT.js +0 -241
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
2
|
-
import { handleError } from './chunk-
|
|
3
|
-
import { HTTPException } from './chunk-
|
|
1
|
+
import { stringify, esm_default } from './chunk-36BLNJHS.js';
|
|
2
|
+
import { handleError } from './chunk-LF7P5PLR.js';
|
|
3
|
+
import { HTTPException } from './chunk-LCM566I4.js';
|
|
4
4
|
import { __export } from './chunk-MLKGABMK.js';
|
|
5
5
|
import { ReadableStream } from 'stream/web';
|
|
6
6
|
|
|
7
7
|
// src/server/handlers/workflows.ts
|
|
8
8
|
var workflows_exports = {};
|
|
9
9
|
__export(workflows_exports, {
|
|
10
|
+
cancelWorkflowRunHandler: () => cancelWorkflowRunHandler,
|
|
10
11
|
createWorkflowRunHandler: () => createWorkflowRunHandler,
|
|
11
12
|
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
12
13
|
getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
|
|
@@ -15,11 +16,32 @@ __export(workflows_exports, {
|
|
|
15
16
|
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
16
17
|
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
17
18
|
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
19
|
+
sendWorkflowRunEventHandler: () => sendWorkflowRunEventHandler,
|
|
18
20
|
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
19
21
|
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
22
|
+
streamVNextWorkflowHandler: () => streamVNextWorkflowHandler,
|
|
20
23
|
streamWorkflowHandler: () => streamWorkflowHandler,
|
|
21
24
|
watchWorkflowHandler: () => watchWorkflowHandler
|
|
22
25
|
});
|
|
26
|
+
function getSteps(steps, path) {
|
|
27
|
+
return Object.entries(steps).reduce((acc, [key, step]) => {
|
|
28
|
+
const fullKey = path ? `${path}.${key}` : key;
|
|
29
|
+
acc[fullKey] = {
|
|
30
|
+
id: step.id,
|
|
31
|
+
description: step.description,
|
|
32
|
+
inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
|
|
33
|
+
outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
|
|
34
|
+
resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
|
|
35
|
+
suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0,
|
|
36
|
+
isWorkflow: step.component === "WORKFLOW"
|
|
37
|
+
};
|
|
38
|
+
if (step.component === "WORKFLOW" && step.steps) {
|
|
39
|
+
const nestedSteps = getSteps(step.steps, fullKey) || {};
|
|
40
|
+
acc = { ...acc, ...nestedSteps };
|
|
41
|
+
}
|
|
42
|
+
return acc;
|
|
43
|
+
}, {});
|
|
44
|
+
}
|
|
23
45
|
async function getWorkflowsHandler({ mastra }) {
|
|
24
46
|
try {
|
|
25
47
|
const workflows = mastra.getWorkflows({ serialized: false });
|
|
@@ -38,6 +60,7 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
38
60
|
};
|
|
39
61
|
return acc2;
|
|
40
62
|
}, {}),
|
|
63
|
+
allSteps: getSteps(workflow.steps) || {},
|
|
41
64
|
stepGraph: workflow.serializedStepGraph,
|
|
42
65
|
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
43
66
|
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
@@ -46,7 +69,7 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
46
69
|
}, {});
|
|
47
70
|
return _workflows;
|
|
48
71
|
} catch (error) {
|
|
49
|
-
|
|
72
|
+
return handleError(error, "Error getting workflows");
|
|
50
73
|
}
|
|
51
74
|
}
|
|
52
75
|
async function getWorkflowsFromSystem({ mastra, workflowId }) {
|
|
@@ -104,6 +127,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
104
127
|
};
|
|
105
128
|
return acc;
|
|
106
129
|
}, {}),
|
|
130
|
+
allSteps: getSteps(workflow.steps) || {},
|
|
107
131
|
name: workflow.name,
|
|
108
132
|
description: workflow.description,
|
|
109
133
|
stepGraph: workflow.serializedStepGraph,
|
|
@@ -111,7 +135,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
111
135
|
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
112
136
|
};
|
|
113
137
|
} catch (error) {
|
|
114
|
-
|
|
138
|
+
return handleError(error, "Error getting workflow");
|
|
115
139
|
}
|
|
116
140
|
}
|
|
117
141
|
async function getWorkflowRunByIdHandler({
|
|
@@ -136,7 +160,7 @@ async function getWorkflowRunByIdHandler({
|
|
|
136
160
|
}
|
|
137
161
|
return run;
|
|
138
162
|
} catch (error) {
|
|
139
|
-
|
|
163
|
+
return handleError(error, "Error getting workflow run");
|
|
140
164
|
}
|
|
141
165
|
}
|
|
142
166
|
async function getWorkflowRunExecutionResultHandler({
|
|
@@ -161,9 +185,7 @@ async function getWorkflowRunExecutionResultHandler({
|
|
|
161
185
|
}
|
|
162
186
|
return executionResult;
|
|
163
187
|
} catch (error) {
|
|
164
|
-
|
|
165
|
-
message: error?.message || "Error getting workflow run execution result"
|
|
166
|
-
});
|
|
188
|
+
return handleError(error, "Error getting workflow run execution result");
|
|
167
189
|
}
|
|
168
190
|
}
|
|
169
191
|
async function createWorkflowRunHandler({
|
|
@@ -182,7 +204,7 @@ async function createWorkflowRunHandler({
|
|
|
182
204
|
const run = await workflow.createRunAsync({ runId: prevRunId });
|
|
183
205
|
return { runId: run.runId };
|
|
184
206
|
} catch (error) {
|
|
185
|
-
|
|
207
|
+
return handleError(error, "Error creating workflow run");
|
|
186
208
|
}
|
|
187
209
|
}
|
|
188
210
|
async function startAsyncWorkflowHandler({
|
|
@@ -207,7 +229,7 @@ async function startAsyncWorkflowHandler({
|
|
|
207
229
|
});
|
|
208
230
|
return result;
|
|
209
231
|
} catch (error) {
|
|
210
|
-
|
|
232
|
+
return handleError(error, "Error starting async workflow");
|
|
211
233
|
}
|
|
212
234
|
}
|
|
213
235
|
async function startWorkflowRunHandler({
|
|
@@ -319,6 +341,34 @@ async function streamWorkflowHandler({
|
|
|
319
341
|
return handleError(error, "Error executing workflow");
|
|
320
342
|
}
|
|
321
343
|
}
|
|
344
|
+
async function streamVNextWorkflowHandler({
|
|
345
|
+
mastra,
|
|
346
|
+
runtimeContext,
|
|
347
|
+
workflowId,
|
|
348
|
+
runId,
|
|
349
|
+
inputData
|
|
350
|
+
}) {
|
|
351
|
+
try {
|
|
352
|
+
if (!workflowId) {
|
|
353
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
354
|
+
}
|
|
355
|
+
if (!runId) {
|
|
356
|
+
throw new HTTPException(400, { message: "runId required to stream workflow" });
|
|
357
|
+
}
|
|
358
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
359
|
+
if (!workflow) {
|
|
360
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
361
|
+
}
|
|
362
|
+
const run = await workflow.createRunAsync({ runId });
|
|
363
|
+
const result = run.streamVNext({
|
|
364
|
+
inputData,
|
|
365
|
+
runtimeContext
|
|
366
|
+
});
|
|
367
|
+
return result;
|
|
368
|
+
} catch (error) {
|
|
369
|
+
return handleError(error, "Error streaming workflow");
|
|
370
|
+
}
|
|
371
|
+
}
|
|
322
372
|
async function resumeAsyncWorkflowHandler({
|
|
323
373
|
mastra,
|
|
324
374
|
workflowId,
|
|
@@ -417,5 +467,61 @@ async function getWorkflowRunsHandler({
|
|
|
417
467
|
return handleError(error, "Error getting workflow runs");
|
|
418
468
|
}
|
|
419
469
|
}
|
|
470
|
+
async function cancelWorkflowRunHandler({
|
|
471
|
+
mastra,
|
|
472
|
+
workflowId,
|
|
473
|
+
runId
|
|
474
|
+
}) {
|
|
475
|
+
try {
|
|
476
|
+
if (!workflowId) {
|
|
477
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
478
|
+
}
|
|
479
|
+
if (!runId) {
|
|
480
|
+
throw new HTTPException(400, { message: "runId required to cancel workflow run" });
|
|
481
|
+
}
|
|
482
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
483
|
+
if (!workflow) {
|
|
484
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
485
|
+
}
|
|
486
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
487
|
+
if (!run) {
|
|
488
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
489
|
+
}
|
|
490
|
+
const _run = await workflow.createRunAsync({ runId });
|
|
491
|
+
await _run.cancel();
|
|
492
|
+
return { message: "Workflow run cancelled" };
|
|
493
|
+
} catch (error) {
|
|
494
|
+
return handleError(error, "Error canceling workflow run");
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
async function sendWorkflowRunEventHandler({
|
|
498
|
+
mastra,
|
|
499
|
+
workflowId,
|
|
500
|
+
runId,
|
|
501
|
+
event,
|
|
502
|
+
data
|
|
503
|
+
}) {
|
|
504
|
+
try {
|
|
505
|
+
if (!workflowId) {
|
|
506
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
507
|
+
}
|
|
508
|
+
if (!runId) {
|
|
509
|
+
throw new HTTPException(400, { message: "runId required to send workflow run event" });
|
|
510
|
+
}
|
|
511
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
512
|
+
if (!workflow) {
|
|
513
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
514
|
+
}
|
|
515
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
516
|
+
if (!run) {
|
|
517
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
518
|
+
}
|
|
519
|
+
const _run = await workflow.createRunAsync({ runId });
|
|
520
|
+
await _run.sendEvent(event, data);
|
|
521
|
+
return { message: "Workflow run event sent" };
|
|
522
|
+
} catch (error) {
|
|
523
|
+
return handleError(error, "Error sending workflow run event");
|
|
524
|
+
}
|
|
525
|
+
}
|
|
420
526
|
|
|
421
|
-
export { createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
|
|
527
|
+
export { cancelWorkflowRunHandler, createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, sendWorkflowRunEventHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamVNextWorkflowHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
|