@mastra/server 0.0.0-redis-cloud-transporter-20250508194049 → 0.0.0-refactor-agent-information-for-recomposable-ui-20251112151814
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 +4878 -0
- package/LICENSE.md +11 -42
- package/README.md +1 -6
- package/dist/chunk-2IS5WICF.js +23036 -0
- package/dist/chunk-2IS5WICF.js.map +1 -0
- package/dist/chunk-2PLXW4ZX.cjs +2777 -0
- package/dist/chunk-2PLXW4ZX.cjs.map +1 -0
- package/dist/chunk-2YZH5PH6.cjs +200 -0
- package/dist/chunk-2YZH5PH6.cjs.map +1 -0
- package/dist/chunk-3AMNUUZF.js +124 -0
- package/dist/chunk-3AMNUUZF.js.map +1 -0
- package/dist/chunk-3F52QCI4.js +192 -0
- package/dist/chunk-3F52QCI4.js.map +1 -0
- package/dist/chunk-4JF5WXPL.js +502 -0
- package/dist/chunk-4JF5WXPL.js.map +1 -0
- package/dist/{chunk-FV45V6WC.cjs → chunk-64ITUOXI.cjs} +3 -7
- package/dist/chunk-64ITUOXI.cjs.map +1 -0
- package/dist/{chunk-TRDNDNGQ.js → chunk-6QWQZI4Q.js} +4 -7
- package/dist/chunk-6QWQZI4Q.js.map +1 -0
- package/dist/chunk-73PAWDM5.js +83 -0
- package/dist/chunk-73PAWDM5.js.map +1 -0
- package/dist/chunk-A24TSVEZ.cjs +130 -0
- package/dist/chunk-A24TSVEZ.cjs.map +1 -0
- package/dist/chunk-A2NPD5N6.cjs +517 -0
- package/dist/chunk-A2NPD5N6.cjs.map +1 -0
- package/dist/chunk-B3Z6J745.js +122 -0
- package/dist/chunk-B3Z6J745.js.map +1 -0
- package/dist/chunk-BTWIR2B7.cjs +28 -0
- package/dist/chunk-BTWIR2B7.cjs.map +1 -0
- package/dist/chunk-D7T74TVR.js +129 -0
- package/dist/chunk-D7T74TVR.js.map +1 -0
- package/dist/chunk-EHACNWDL.cjs +681 -0
- package/dist/chunk-EHACNWDL.cjs.map +1 -0
- package/dist/chunk-FPBYKMIS.js +477 -0
- package/dist/chunk-FPBYKMIS.js.map +1 -0
- package/dist/chunk-GLAZTMX3.cjs +128 -0
- package/dist/chunk-GLAZTMX3.cjs.map +1 -0
- package/dist/chunk-GU4EWMZB.cjs +769 -0
- package/dist/chunk-GU4EWMZB.cjs.map +1 -0
- package/dist/chunk-ID6JYDNL.cjs +23075 -0
- package/dist/chunk-ID6JYDNL.cjs.map +1 -0
- package/dist/chunk-KF3RI45U.cjs +172 -0
- package/dist/chunk-KF3RI45U.cjs.map +1 -0
- package/dist/chunk-KJIDZQRA.cjs +485 -0
- package/dist/chunk-KJIDZQRA.cjs.map +1 -0
- package/dist/{chunk-4JINXASC.js → chunk-KWH5QBXP.js} +7 -4
- package/dist/chunk-KWH5QBXP.js.map +1 -0
- package/dist/chunk-LF2ZLOFP.js +767 -0
- package/dist/chunk-LF2ZLOFP.js.map +1 -0
- package/dist/chunk-LPM6BBAX.cjs +1043 -0
- package/dist/chunk-LPM6BBAX.cjs.map +1 -0
- package/dist/chunk-ND5OKOMT.js +165 -0
- package/dist/chunk-ND5OKOMT.js.map +1 -0
- package/dist/chunk-O7I5CWRX.cjs +44 -0
- package/dist/chunk-O7I5CWRX.cjs.map +1 -0
- package/dist/chunk-PPMIB3FQ.cjs +88 -0
- package/dist/chunk-PPMIB3FQ.cjs.map +1 -0
- package/dist/chunk-PR4QN5HX.js +39 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/chunk-QU6N55W6.cjs +256 -0
- package/dist/chunk-QU6N55W6.cjs.map +1 -0
- package/dist/chunk-RQK4FQUD.js +1012 -0
- package/dist/chunk-RQK4FQUD.js.map +1 -0
- package/dist/{chunk-M56ECCHK.cjs → chunk-S54HNARD.cjs} +22 -19
- package/dist/chunk-S54HNARD.cjs.map +1 -0
- package/dist/chunk-SHWNNZBL.js +254 -0
- package/dist/chunk-SHWNNZBL.js.map +1 -0
- package/dist/{chunk-L7XE5QTW.js → chunk-SZIFSF4T.js} +11 -2
- package/dist/chunk-SZIFSF4T.js.map +1 -0
- package/dist/chunk-TOCYBDP2.js +46 -0
- package/dist/chunk-TOCYBDP2.js.map +1 -0
- package/dist/chunk-UXGQZUYZ.js +16 -0
- package/dist/chunk-UXGQZUYZ.js.map +1 -0
- package/dist/chunk-V5WWQN7P.cjs +18 -0
- package/dist/chunk-V5WWQN7P.cjs.map +1 -0
- package/dist/chunk-W2KMU354.cjs +133 -0
- package/dist/chunk-W2KMU354.cjs.map +1 -0
- package/dist/chunk-X3MICMI2.cjs +620 -0
- package/dist/chunk-X3MICMI2.cjs.map +1 -0
- package/dist/chunk-X6C7BUWN.cjs +48 -0
- package/dist/chunk-X6C7BUWN.cjs.map +1 -0
- package/dist/chunk-Z2O5YVHY.js +661 -0
- package/dist/chunk-Z2O5YVHY.js.map +1 -0
- package/dist/chunk-ZJ6KEY6H.js +600 -0
- package/dist/chunk-ZJ6KEY6H.js.map +1 -0
- package/dist/chunk-ZULZ2752.js +2774 -0
- package/dist/chunk-ZULZ2752.js.map +1 -0
- package/dist/dist-4MVGNSRL.cjs +1150 -0
- package/dist/dist-4MVGNSRL.cjs.map +1 -0
- package/dist/dist-FZYCV3VB.cjs +940 -0
- package/dist/dist-FZYCV3VB.cjs.map +1 -0
- package/dist/dist-G2BYZJOC.cjs +928 -0
- package/dist/dist-G2BYZJOC.cjs.map +1 -0
- package/dist/dist-P4MXBQ3U.cjs +16 -0
- package/dist/dist-P4MXBQ3U.cjs.map +1 -0
- package/dist/dist-PQZUVLPC.js +937 -0
- package/dist/dist-PQZUVLPC.js.map +1 -0
- package/dist/dist-R7WYX6LC.js +925 -0
- package/dist/dist-R7WYX6LC.js.map +1 -0
- package/dist/dist-RFMYFILX.cjs +764 -0
- package/dist/dist-RFMYFILX.cjs.map +1 -0
- package/dist/dist-X7XR3M3Z.js +1147 -0
- package/dist/dist-X7XR3M3Z.js.map +1 -0
- package/dist/dist-XVBSOGFK.js +761 -0
- package/dist/dist-XVBSOGFK.js.map +1 -0
- package/dist/dist-YREX2TJT.js +3 -0
- package/dist/dist-YREX2TJT.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/server/a2a/protocol.d.ts +8 -0
- package/dist/server/a2a/protocol.d.ts.map +1 -0
- package/dist/server/a2a/store.cjs +25 -0
- package/dist/server/a2a/store.cjs.map +1 -0
- package/dist/server/a2a/store.d.ts +14 -0
- package/dist/server/a2a/store.d.ts.map +1 -0
- package/dist/server/a2a/store.js +23 -0
- package/dist/server/a2a/store.js.map +1 -0
- package/dist/server/a2a/tasks.d.ts +20 -0
- package/dist/server/a2a/tasks.d.ts.map +1 -0
- package/dist/server/handlers/a2a.cjs +32 -0
- package/dist/server/handlers/a2a.cjs.map +1 -0
- package/dist/server/handlers/a2a.d.ts +68 -0
- package/dist/server/handlers/a2a.d.ts.map +1 -0
- package/dist/server/handlers/a2a.js +3 -0
- package/dist/server/handlers/a2a.js.map +1 -0
- package/dist/server/handlers/agent-builder.cjs +80 -0
- package/dist/server/handlers/agent-builder.cjs.map +1 -0
- package/dist/server/handlers/agent-builder.d.ts +85 -0
- package/dist/server/handlers/agent-builder.d.ts.map +1 -0
- package/dist/server/handlers/agent-builder.js +3 -0
- package/dist/server/handlers/agent-builder.js.map +1 -0
- package/dist/server/handlers/agents.cjs +60 -10
- package/dist/server/handlers/agents.cjs.map +1 -0
- package/dist/server/handlers/agents.d.ts +194 -6
- package/dist/server/handlers/agents.d.ts.map +1 -0
- package/dist/server/handlers/agents.js +3 -1
- package/dist/server/handlers/agents.js.map +1 -0
- package/dist/server/handlers/error.cjs +4 -2
- package/dist/server/handlers/error.cjs.map +1 -0
- package/dist/server/handlers/error.d.ts +2 -1
- package/dist/server/handlers/error.d.ts.map +1 -0
- package/dist/server/handlers/error.js +3 -1
- package/dist/server/handlers/error.js.map +1 -0
- package/dist/server/handlers/logs.cjs +9 -7
- package/dist/server/handlers/logs.cjs.map +1 -0
- package/dist/server/handlers/logs.d.ts +34 -3
- package/dist/server/handlers/logs.d.ts.map +1 -0
- package/dist/server/handlers/logs.js +3 -1
- package/dist/server/handlers/logs.js.map +1 -0
- package/dist/server/handlers/memory.cjs +34 -12
- package/dist/server/handlers/memory.cjs.map +1 -0
- package/dist/server/handlers/memory.d.ts +112 -8
- package/dist/server/handlers/memory.d.ts.map +1 -0
- package/dist/server/handlers/memory.js +3 -1
- package/dist/server/handlers/memory.js.map +1 -0
- package/dist/server/handlers/observability.cjs +24 -0
- package/dist/server/handlers/observability.cjs.map +1 -0
- package/dist/server/handlers/observability.d.ts +49 -0
- package/dist/server/handlers/observability.d.ts.map +1 -0
- package/dist/server/handlers/observability.js +3 -0
- package/dist/server/handlers/observability.js.map +1 -0
- package/dist/server/handlers/scores.cjs +32 -0
- package/dist/server/handlers/scores.cjs.map +1 -0
- package/dist/server/handlers/scores.d.ts +152 -0
- package/dist/server/handlers/scores.d.ts.map +1 -0
- package/dist/server/handlers/scores.js +3 -0
- package/dist/server/handlers/scores.js.map +1 -0
- package/dist/server/handlers/tools.cjs +12 -6
- package/dist/server/handlers/tools.cjs.map +1 -0
- package/dist/server/handlers/tools.d.ts +25 -4
- package/dist/server/handlers/tools.d.ts.map +1 -0
- package/dist/server/handlers/tools.js +3 -1
- package/dist/server/handlers/tools.js.map +1 -0
- package/dist/server/handlers/utils.cjs +8 -2
- package/dist/server/handlers/utils.cjs.map +1 -0
- package/dist/server/handlers/utils.d.ts +8 -1
- package/dist/server/handlers/utils.d.ts.map +1 -0
- package/dist/server/handlers/utils.js +3 -1
- package/dist/server/handlers/utils.js.map +1 -0
- package/dist/server/handlers/vector.cjs +9 -7
- package/dist/server/handlers/vector.cjs.map +1 -0
- package/dist/server/handlers/vector.d.ts +51 -6
- package/dist/server/handlers/vector.d.ts.map +1 -0
- package/dist/server/handlers/vector.js +3 -1
- package/dist/server/handlers/vector.js.map +1 -0
- package/dist/server/handlers/voice.cjs +10 -4
- package/dist/server/handlers/voice.cjs.map +1 -0
- package/dist/server/handlers/voice.d.ts +41 -3
- package/dist/server/handlers/voice.d.ts.map +1 -0
- package/dist/server/handlers/voice.js +3 -1
- package/dist/server/handlers/voice.js.map +1 -0
- package/dist/server/handlers/workflows.cjs +50 -16
- package/dist/server/handlers/workflows.cjs.map +1 -0
- package/dist/server/handlers/workflows.d.ts +88 -10
- package/dist/server/handlers/workflows.d.ts.map +1 -0
- package/dist/server/handlers/workflows.js +3 -1
- package/dist/server/handlers/workflows.js.map +1 -0
- package/dist/server/handlers.cjs +37 -30
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.ts +12 -10
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/handlers.js +13 -10
- package/dist/server/handlers.js.map +1 -0
- package/dist/server/http-exception.d.ts +82 -0
- package/dist/server/http-exception.d.ts.map +1 -0
- package/dist/server/types.d.ts +10 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/utils.d.ts +45 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/dist/token-375W3LEI.cjs +64 -0
- package/dist/token-375W3LEI.cjs.map +1 -0
- package/dist/token-C3IMNCC4.js +62 -0
- package/dist/token-C3IMNCC4.js.map +1 -0
- package/dist/token-util-CV3RRG6K.cjs +9 -0
- package/dist/token-util-CV3RRG6K.cjs.map +1 -0
- package/dist/token-util-E5QO2RCL.js +7 -0
- package/dist/token-util-E5QO2RCL.js.map +1 -0
- package/package.json +46 -19
- package/dist/_tsup-dts-rollup.d.cts +0 -670
- package/dist/_tsup-dts-rollup.d.ts +0 -670
- package/dist/chunk-2FJURXCL.cjs +0 -213
- package/dist/chunk-3AHQ5RGN.js +0 -11
- package/dist/chunk-3EJZQ6TQ.js +0 -49
- package/dist/chunk-3XTEV33Q.js +0 -317
- package/dist/chunk-55HTWX4C.cjs +0 -93
- package/dist/chunk-5JNVY6DU.js +0 -120
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-5YGDYMRB.cjs +0 -147
- package/dist/chunk-6Q7UXAYJ.cjs +0 -198
- package/dist/chunk-AMVOS7YB.cjs +0 -141
- package/dist/chunk-BPL2CBLV.js +0 -137
- package/dist/chunk-CHFORQ7J.cjs +0 -329
- package/dist/chunk-D3G23FP3.cjs +0 -126
- package/dist/chunk-GVBJ5I2S.js +0 -190
- package/dist/chunk-M2RXDCPV.cjs +0 -324
- package/dist/chunk-OMN3UI6X.js +0 -5576
- package/dist/chunk-OWNA6I2H.js +0 -312
- package/dist/chunk-Q6SHQECN.js +0 -88
- package/dist/chunk-QJ3AHN64.js +0 -141
- package/dist/chunk-QN4KF3BH.cjs +0 -18
- package/dist/chunk-RBQASTUP.js +0 -203
- package/dist/chunk-SKBVVI24.cjs +0 -54
- package/dist/chunk-ZLBRQFDD.cjs +0 -13
- package/dist/index.d.cts +0 -1
- package/dist/server/handlers/agents.d.cts +0 -6
- package/dist/server/handlers/error.d.cts +0 -1
- package/dist/server/handlers/logs.d.cts +0 -3
- package/dist/server/handlers/memory.d.cts +0 -8
- package/dist/server/handlers/network.cjs +0 -22
- package/dist/server/handlers/network.d.cts +0 -4
- package/dist/server/handlers/network.d.ts +0 -4
- package/dist/server/handlers/network.js +0 -1
- package/dist/server/handlers/telemetry.cjs +0 -14
- package/dist/server/handlers/telemetry.d.cts +0 -2
- package/dist/server/handlers/telemetry.d.ts +0 -2
- package/dist/server/handlers/telemetry.js +0 -1
- package/dist/server/handlers/tools.d.cts +0 -4
- package/dist/server/handlers/utils.d.cts +0 -1
- 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
- package/dist/server/handlers/vector.d.cts +0 -6
- package/dist/server/handlers/voice.d.cts +0 -3
- package/dist/server/handlers/workflows.d.cts +0 -10
- package/dist/server/handlers.d.cts +0 -10
package/dist/chunk-OWNA6I2H.js
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-OMN3UI6X.js';
|
|
2
|
-
import { handleError } from './chunk-3AHQ5RGN.js';
|
|
3
|
-
import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
|
|
4
|
-
import { ReadableStream } from 'node:stream/web';
|
|
5
|
-
|
|
6
|
-
// src/server/handlers/vNextWorkflows.ts
|
|
7
|
-
var vNextWorkflows_exports = {};
|
|
8
|
-
__export(vNextWorkflows_exports, {
|
|
9
|
-
createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
|
|
10
|
-
getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
|
|
11
|
-
getVNextWorkflowRunByIdHandler: () => getVNextWorkflowRunByIdHandler,
|
|
12
|
-
getVNextWorkflowRunsHandler: () => getVNextWorkflowRunsHandler,
|
|
13
|
-
getVNextWorkflowsHandler: () => getVNextWorkflowsHandler,
|
|
14
|
-
resumeAsyncVNextWorkflowHandler: () => resumeAsyncVNextWorkflowHandler,
|
|
15
|
-
resumeVNextWorkflowHandler: () => resumeVNextWorkflowHandler,
|
|
16
|
-
startAsyncVNextWorkflowHandler: () => startAsyncVNextWorkflowHandler,
|
|
17
|
-
startVNextWorkflowRunHandler: () => startVNextWorkflowRunHandler,
|
|
18
|
-
watchVNextWorkflowHandler: () => watchVNextWorkflowHandler
|
|
19
|
-
});
|
|
20
|
-
async function getVNextWorkflowsHandler({ mastra }) {
|
|
21
|
-
try {
|
|
22
|
-
const workflows = mastra.vnext_getWorkflows({ serialized: false });
|
|
23
|
-
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
24
|
-
acc[key] = {
|
|
25
|
-
name: workflow.name,
|
|
26
|
-
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
27
|
-
acc2[key2] = {
|
|
28
|
-
id: step.id,
|
|
29
|
-
description: step.description,
|
|
30
|
-
inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
|
|
31
|
-
outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
|
|
32
|
-
resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
|
|
33
|
-
suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
|
|
34
|
-
};
|
|
35
|
-
return acc2;
|
|
36
|
-
}, {}),
|
|
37
|
-
stepGraph: workflow.serializedStepGraph,
|
|
38
|
-
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
39
|
-
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
40
|
-
};
|
|
41
|
-
return acc;
|
|
42
|
-
}, {});
|
|
43
|
-
return _workflows;
|
|
44
|
-
} catch (error) {
|
|
45
|
-
throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
49
|
-
try {
|
|
50
|
-
if (!workflowId) {
|
|
51
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
52
|
-
}
|
|
53
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
54
|
-
if (!workflow) {
|
|
55
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
59
|
-
acc[key] = {
|
|
60
|
-
id: step.id,
|
|
61
|
-
description: step.description,
|
|
62
|
-
inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
|
|
63
|
-
outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
|
|
64
|
-
resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
|
|
65
|
-
suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
|
|
66
|
-
};
|
|
67
|
-
return acc;
|
|
68
|
-
}, {}),
|
|
69
|
-
name: workflow.name,
|
|
70
|
-
stepGraph: workflow.serializedStepGraph,
|
|
71
|
-
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
72
|
-
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
73
|
-
};
|
|
74
|
-
} catch (error) {
|
|
75
|
-
throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
async function getVNextWorkflowRunByIdHandler({
|
|
79
|
-
mastra,
|
|
80
|
-
workflowId,
|
|
81
|
-
runId
|
|
82
|
-
}) {
|
|
83
|
-
try {
|
|
84
|
-
if (!workflowId) {
|
|
85
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
86
|
-
}
|
|
87
|
-
if (!runId) {
|
|
88
|
-
throw new HTTPException(400, { message: "Run ID is required" });
|
|
89
|
-
}
|
|
90
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
91
|
-
if (!workflow) {
|
|
92
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
93
|
-
}
|
|
94
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
95
|
-
if (!run) {
|
|
96
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
97
|
-
}
|
|
98
|
-
return run;
|
|
99
|
-
} catch (error) {
|
|
100
|
-
throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
async function createVNextWorkflowRunHandler({
|
|
104
|
-
mastra,
|
|
105
|
-
workflowId,
|
|
106
|
-
runId: prevRunId
|
|
107
|
-
}) {
|
|
108
|
-
try {
|
|
109
|
-
if (!workflowId) {
|
|
110
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
111
|
-
}
|
|
112
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
113
|
-
if (!workflow) {
|
|
114
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
115
|
-
}
|
|
116
|
-
const run = workflow.createRun({ runId: prevRunId });
|
|
117
|
-
return { runId: run.runId };
|
|
118
|
-
} catch (error) {
|
|
119
|
-
throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
async function startAsyncVNextWorkflowHandler({
|
|
123
|
-
mastra,
|
|
124
|
-
runtimeContext,
|
|
125
|
-
workflowId,
|
|
126
|
-
runId,
|
|
127
|
-
inputData
|
|
128
|
-
}) {
|
|
129
|
-
try {
|
|
130
|
-
if (!workflowId) {
|
|
131
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
132
|
-
}
|
|
133
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
134
|
-
if (!workflow) {
|
|
135
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
136
|
-
}
|
|
137
|
-
const _run = workflow.createRun({ runId });
|
|
138
|
-
const result = await _run.start({
|
|
139
|
-
inputData,
|
|
140
|
-
runtimeContext
|
|
141
|
-
});
|
|
142
|
-
return result;
|
|
143
|
-
} catch (error) {
|
|
144
|
-
throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
async function startVNextWorkflowRunHandler({
|
|
148
|
-
mastra,
|
|
149
|
-
runtimeContext,
|
|
150
|
-
workflowId,
|
|
151
|
-
runId,
|
|
152
|
-
inputData
|
|
153
|
-
}) {
|
|
154
|
-
try {
|
|
155
|
-
if (!workflowId) {
|
|
156
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
157
|
-
}
|
|
158
|
-
if (!runId) {
|
|
159
|
-
throw new HTTPException(400, { message: "runId required to start run" });
|
|
160
|
-
}
|
|
161
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
162
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
163
|
-
if (!run) {
|
|
164
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
165
|
-
}
|
|
166
|
-
const _run = workflow.createRun({ runId });
|
|
167
|
-
await _run.start({
|
|
168
|
-
inputData,
|
|
169
|
-
runtimeContext
|
|
170
|
-
});
|
|
171
|
-
return { message: "Workflow run started" };
|
|
172
|
-
} catch (e) {
|
|
173
|
-
return handleError(e, "Error starting workflow run");
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
async function watchVNextWorkflowHandler({
|
|
177
|
-
mastra,
|
|
178
|
-
workflowId,
|
|
179
|
-
runId
|
|
180
|
-
}) {
|
|
181
|
-
try {
|
|
182
|
-
if (!workflowId) {
|
|
183
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
184
|
-
}
|
|
185
|
-
if (!runId) {
|
|
186
|
-
throw new HTTPException(400, { message: "runId required to watch workflow" });
|
|
187
|
-
}
|
|
188
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
189
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
190
|
-
if (!run) {
|
|
191
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
192
|
-
}
|
|
193
|
-
const _run = workflow.createRun({ runId });
|
|
194
|
-
let unwatch;
|
|
195
|
-
let asyncRef = null;
|
|
196
|
-
const stream = new ReadableStream({
|
|
197
|
-
start(controller) {
|
|
198
|
-
unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
|
|
199
|
-
controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
|
|
200
|
-
if (asyncRef) {
|
|
201
|
-
clearImmediate(asyncRef);
|
|
202
|
-
asyncRef = null;
|
|
203
|
-
}
|
|
204
|
-
asyncRef = setImmediate(async () => {
|
|
205
|
-
const runDone = payload.workflowState.status !== "running";
|
|
206
|
-
if (runDone) {
|
|
207
|
-
controller.close();
|
|
208
|
-
unwatch?.();
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
},
|
|
213
|
-
cancel() {
|
|
214
|
-
unwatch?.();
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
return stream;
|
|
218
|
-
} catch (error) {
|
|
219
|
-
return handleError(error, "Error watching workflow");
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
async function resumeAsyncVNextWorkflowHandler({
|
|
223
|
-
mastra,
|
|
224
|
-
workflowId,
|
|
225
|
-
runId,
|
|
226
|
-
body,
|
|
227
|
-
runtimeContext
|
|
228
|
-
}) {
|
|
229
|
-
try {
|
|
230
|
-
if (!workflowId) {
|
|
231
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
232
|
-
}
|
|
233
|
-
if (!runId) {
|
|
234
|
-
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
235
|
-
}
|
|
236
|
-
if (!body.step) {
|
|
237
|
-
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
238
|
-
}
|
|
239
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
240
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
241
|
-
if (!run) {
|
|
242
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
243
|
-
}
|
|
244
|
-
const _run = workflow.createRun({ runId });
|
|
245
|
-
const result = await _run.resume({
|
|
246
|
-
step: body.step,
|
|
247
|
-
resumeData: body.resumeData,
|
|
248
|
-
runtimeContext
|
|
249
|
-
});
|
|
250
|
-
return result;
|
|
251
|
-
} catch (error) {
|
|
252
|
-
return handleError(error, "Error resuming workflow step");
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
async function resumeVNextWorkflowHandler({
|
|
256
|
-
mastra,
|
|
257
|
-
workflowId,
|
|
258
|
-
runId,
|
|
259
|
-
body,
|
|
260
|
-
runtimeContext
|
|
261
|
-
}) {
|
|
262
|
-
try {
|
|
263
|
-
if (!workflowId) {
|
|
264
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
265
|
-
}
|
|
266
|
-
if (!runId) {
|
|
267
|
-
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
268
|
-
}
|
|
269
|
-
if (!body.step) {
|
|
270
|
-
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
271
|
-
}
|
|
272
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
273
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
274
|
-
if (!run) {
|
|
275
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
276
|
-
}
|
|
277
|
-
const _run = workflow.createRun({ runId });
|
|
278
|
-
await _run.resume({
|
|
279
|
-
step: body.step,
|
|
280
|
-
resumeData: body.resumeData,
|
|
281
|
-
runtimeContext
|
|
282
|
-
});
|
|
283
|
-
return { message: "Workflow run resumed" };
|
|
284
|
-
} catch (error) {
|
|
285
|
-
return handleError(error, "Error resuming workflow");
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
async function getVNextWorkflowRunsHandler({
|
|
289
|
-
mastra,
|
|
290
|
-
workflowId,
|
|
291
|
-
fromDate,
|
|
292
|
-
toDate,
|
|
293
|
-
limit,
|
|
294
|
-
offset,
|
|
295
|
-
resourceId
|
|
296
|
-
}) {
|
|
297
|
-
try {
|
|
298
|
-
if (!workflowId) {
|
|
299
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
300
|
-
}
|
|
301
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
302
|
-
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
303
|
-
runs: [],
|
|
304
|
-
total: 0
|
|
305
|
-
};
|
|
306
|
-
return workflowRuns;
|
|
307
|
-
} catch (error) {
|
|
308
|
-
return handleError(error, "Error getting workflow runs");
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
export { createVNextWorkflowRunHandler, getVNextWorkflowByIdHandler, getVNextWorkflowRunByIdHandler, getVNextWorkflowRunsHandler, getVNextWorkflowsHandler, resumeAsyncVNextWorkflowHandler, resumeVNextWorkflowHandler, startAsyncVNextWorkflowHandler, startVNextWorkflowRunHandler, vNextWorkflows_exports, watchVNextWorkflowHandler };
|
package/dist/chunk-Q6SHQECN.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { validateBody } from './chunk-L7XE5QTW.js';
|
|
2
|
-
import { handleError } from './chunk-3AHQ5RGN.js';
|
|
3
|
-
import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
|
|
4
|
-
import { Readable } from 'stream';
|
|
5
|
-
|
|
6
|
-
// src/server/handlers/voice.ts
|
|
7
|
-
var voice_exports = {};
|
|
8
|
-
__export(voice_exports, {
|
|
9
|
-
generateSpeechHandler: () => generateSpeechHandler,
|
|
10
|
-
getSpeakersHandler: () => getSpeakersHandler,
|
|
11
|
-
transcribeSpeechHandler: () => transcribeSpeechHandler
|
|
12
|
-
});
|
|
13
|
-
async function getSpeakersHandler({ mastra, agentId }) {
|
|
14
|
-
try {
|
|
15
|
-
if (!agentId) {
|
|
16
|
-
throw new HTTPException(400, { message: "Agent ID is required" });
|
|
17
|
-
}
|
|
18
|
-
const agent = mastra.getAgent(agentId);
|
|
19
|
-
if (!agent) {
|
|
20
|
-
throw new HTTPException(404, { message: "Agent not found" });
|
|
21
|
-
}
|
|
22
|
-
if (!agent.voice) {
|
|
23
|
-
throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
24
|
-
}
|
|
25
|
-
const speakers = await agent.voice.getSpeakers();
|
|
26
|
-
return speakers;
|
|
27
|
-
} catch (error) {
|
|
28
|
-
return handleError(error, "Error getting speakers");
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
async function generateSpeechHandler({
|
|
32
|
-
mastra,
|
|
33
|
-
agentId,
|
|
34
|
-
body
|
|
35
|
-
}) {
|
|
36
|
-
try {
|
|
37
|
-
if (!agentId) {
|
|
38
|
-
throw new HTTPException(400, { message: "Agent ID is required" });
|
|
39
|
-
}
|
|
40
|
-
validateBody({
|
|
41
|
-
text: body?.text
|
|
42
|
-
});
|
|
43
|
-
const agent = mastra.getAgent(agentId);
|
|
44
|
-
if (!agent) {
|
|
45
|
-
throw new HTTPException(404, { message: "Agent not found" });
|
|
46
|
-
}
|
|
47
|
-
if (!agent.voice) {
|
|
48
|
-
throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
49
|
-
}
|
|
50
|
-
const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
|
|
51
|
-
if (!audioStream) {
|
|
52
|
-
throw new HTTPException(500, { message: "Failed to generate speech" });
|
|
53
|
-
}
|
|
54
|
-
return audioStream;
|
|
55
|
-
} catch (error) {
|
|
56
|
-
return handleError(error, "Error generating speech");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async function transcribeSpeechHandler({
|
|
60
|
-
mastra,
|
|
61
|
-
agentId,
|
|
62
|
-
body
|
|
63
|
-
}) {
|
|
64
|
-
try {
|
|
65
|
-
if (!agentId) {
|
|
66
|
-
throw new HTTPException(400, { message: "Agent ID is required" });
|
|
67
|
-
}
|
|
68
|
-
if (!body?.audioData) {
|
|
69
|
-
throw new HTTPException(400, { message: "Audio data is required" });
|
|
70
|
-
}
|
|
71
|
-
const agent = mastra.getAgent(agentId);
|
|
72
|
-
if (!agent) {
|
|
73
|
-
throw new HTTPException(404, { message: "Agent not found" });
|
|
74
|
-
}
|
|
75
|
-
if (!agent.voice) {
|
|
76
|
-
throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
77
|
-
}
|
|
78
|
-
const audioStream = new Readable();
|
|
79
|
-
audioStream.push(body.audioData);
|
|
80
|
-
audioStream.push(null);
|
|
81
|
-
const text = await agent.voice.listen(audioStream, body.options);
|
|
82
|
-
return { text };
|
|
83
|
-
} catch (error) {
|
|
84
|
-
return handleError(error, "Error transcribing speech");
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { generateSpeechHandler, getSpeakersHandler, transcribeSpeechHandler, voice_exports };
|
package/dist/chunk-QJ3AHN64.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { validateBody } from './chunk-L7XE5QTW.js';
|
|
2
|
-
import { handleError } from './chunk-3AHQ5RGN.js';
|
|
3
|
-
import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
|
|
4
|
-
|
|
5
|
-
// src/server/handlers/network.ts
|
|
6
|
-
var network_exports = {};
|
|
7
|
-
__export(network_exports, {
|
|
8
|
-
generateHandler: () => generateHandler,
|
|
9
|
-
getNetworkByIdHandler: () => getNetworkByIdHandler,
|
|
10
|
-
getNetworksHandler: () => getNetworksHandler,
|
|
11
|
-
streamGenerateHandler: () => streamGenerateHandler
|
|
12
|
-
});
|
|
13
|
-
async function getNetworksHandler({
|
|
14
|
-
mastra,
|
|
15
|
-
runtimeContext
|
|
16
|
-
}) {
|
|
17
|
-
try {
|
|
18
|
-
const networks = mastra.getNetworks();
|
|
19
|
-
const serializedNetworks = await Promise.all(
|
|
20
|
-
networks.map(async (network) => {
|
|
21
|
-
const routingAgent = network.getRoutingAgent();
|
|
22
|
-
const routingLLM = await routingAgent.getLLM({ runtimeContext });
|
|
23
|
-
const agents = network.getAgents();
|
|
24
|
-
return {
|
|
25
|
-
id: network.formatAgentId(routingAgent.name),
|
|
26
|
-
name: routingAgent.name,
|
|
27
|
-
instructions: routingAgent.instructions,
|
|
28
|
-
agents: await Promise.all(
|
|
29
|
-
agents.map(async (agent) => {
|
|
30
|
-
const llm = await agent.getLLM({ runtimeContext });
|
|
31
|
-
return {
|
|
32
|
-
name: agent.name,
|
|
33
|
-
provider: llm?.getProvider(),
|
|
34
|
-
modelId: llm?.getModelId()
|
|
35
|
-
};
|
|
36
|
-
})
|
|
37
|
-
),
|
|
38
|
-
routingModel: {
|
|
39
|
-
provider: routingLLM?.getProvider(),
|
|
40
|
-
modelId: routingLLM?.getModelId()
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
|
-
return serializedNetworks;
|
|
46
|
-
} catch (error) {
|
|
47
|
-
return handleError(error, "Error getting networks");
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async function getNetworkByIdHandler({
|
|
51
|
-
mastra,
|
|
52
|
-
networkId,
|
|
53
|
-
runtimeContext
|
|
54
|
-
}) {
|
|
55
|
-
try {
|
|
56
|
-
const networks = mastra.getNetworks();
|
|
57
|
-
const network = networks.find((network2) => {
|
|
58
|
-
const routingAgent2 = network2.getRoutingAgent();
|
|
59
|
-
return network2.formatAgentId(routingAgent2.name) === networkId;
|
|
60
|
-
});
|
|
61
|
-
if (!network) {
|
|
62
|
-
throw new HTTPException(404, { message: "Network not found" });
|
|
63
|
-
}
|
|
64
|
-
const routingAgent = network.getRoutingAgent();
|
|
65
|
-
const routingLLM = await routingAgent.getLLM({ runtimeContext });
|
|
66
|
-
const agents = network.getAgents();
|
|
67
|
-
const serializedNetwork = {
|
|
68
|
-
id: network.formatAgentId(routingAgent.name),
|
|
69
|
-
name: routingAgent.name,
|
|
70
|
-
instructions: routingAgent.instructions,
|
|
71
|
-
agents: await Promise.all(
|
|
72
|
-
agents.map(async (agent) => {
|
|
73
|
-
const llm = await agent.getLLM({ runtimeContext });
|
|
74
|
-
return {
|
|
75
|
-
name: agent.name,
|
|
76
|
-
provider: llm?.getProvider(),
|
|
77
|
-
modelId: llm?.getModelId()
|
|
78
|
-
};
|
|
79
|
-
})
|
|
80
|
-
),
|
|
81
|
-
routingModel: {
|
|
82
|
-
provider: routingLLM?.getProvider(),
|
|
83
|
-
modelId: routingLLM?.getModelId()
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
return serializedNetwork;
|
|
87
|
-
} catch (error) {
|
|
88
|
-
return handleError(error, "Error getting network by ID");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
async function generateHandler({
|
|
92
|
-
mastra,
|
|
93
|
-
runtimeContext,
|
|
94
|
-
networkId,
|
|
95
|
-
body
|
|
96
|
-
}) {
|
|
97
|
-
try {
|
|
98
|
-
const network = mastra.getNetwork(networkId);
|
|
99
|
-
if (!network) {
|
|
100
|
-
throw new HTTPException(404, { message: "Network not found" });
|
|
101
|
-
}
|
|
102
|
-
validateBody({ messages: body.messages });
|
|
103
|
-
const { messages, ...rest } = body;
|
|
104
|
-
const result = await network.generate(messages, { ...rest, runtimeContext });
|
|
105
|
-
return result;
|
|
106
|
-
} catch (error) {
|
|
107
|
-
return handleError(error, "Error generating from network");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async function streamGenerateHandler({
|
|
111
|
-
mastra,
|
|
112
|
-
networkId,
|
|
113
|
-
body,
|
|
114
|
-
runtimeContext
|
|
115
|
-
}) {
|
|
116
|
-
try {
|
|
117
|
-
const network = mastra.getNetwork(networkId);
|
|
118
|
-
if (!network) {
|
|
119
|
-
throw new HTTPException(404, { message: "Network not found" });
|
|
120
|
-
}
|
|
121
|
-
validateBody({ messages: body.messages });
|
|
122
|
-
const { messages, output, ...rest } = body;
|
|
123
|
-
const streamResult = await network.stream(messages, {
|
|
124
|
-
output,
|
|
125
|
-
...rest,
|
|
126
|
-
runtimeContext
|
|
127
|
-
});
|
|
128
|
-
const streamResponse = output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
|
|
129
|
-
sendUsage: true,
|
|
130
|
-
sendReasoning: true,
|
|
131
|
-
getErrorMessage: (error) => {
|
|
132
|
-
return `An error occurred while processing your request. ${error instanceof Error ? error.message : JSON.stringify(error)}`;
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
return streamResponse;
|
|
136
|
-
} catch (error) {
|
|
137
|
-
return handleError(error, "Error streaming from network");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export { generateHandler, getNetworkByIdHandler, getNetworksHandler, network_exports, streamGenerateHandler };
|
package/dist/chunk-QN4KF3BH.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
|
|
4
|
-
|
|
5
|
-
// src/server/handlers/utils.ts
|
|
6
|
-
function validateBody(body) {
|
|
7
|
-
const errorResponse = Object.entries(body).reduce((acc, [key, value]) => {
|
|
8
|
-
if (!value) {
|
|
9
|
-
acc[key] = `Argument "${key}" is required`;
|
|
10
|
-
}
|
|
11
|
-
return acc;
|
|
12
|
-
}, {});
|
|
13
|
-
if (Object.keys(errorResponse).length > 0) {
|
|
14
|
-
throw new chunkFV45V6WC_cjs.HTTPException(400, { message: Object.values(errorResponse)[0] });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
exports.validateBody = validateBody;
|