@mastra/server 0.0.0-cloud-transporter-20250513033346 → 0.0.0-cloud-storage-adapter-20251106204059
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 +4864 -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-OCWPVYNI.cjs → chunk-64ITUOXI.cjs} +3 -0
- package/dist/chunk-64ITUOXI.cjs.map +1 -0
- package/dist/{chunk-NYN7KFXL.js → chunk-6QWQZI4Q.js} +3 -0
- 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-P6SCPDYW.js → chunk-FPBYKMIS.js} +124 -147
- 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-5SN4U5AC.cjs → chunk-KJIDZQRA.cjs} +125 -148
- package/dist/chunk-KJIDZQRA.cjs.map +1 -0
- package/dist/{chunk-IU5VO2I2.js → chunk-KWH5QBXP.js} +7 -5
- 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-4YZ3U35L.cjs → chunk-S54HNARD.cjs} +22 -20
- 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-H5PTF3Y4.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 +13 -11
- package/dist/server/handlers/a2a.cjs.map +1 -0
- package/dist/server/handlers/a2a.d.ts +68 -6
- package/dist/server/handlers/a2a.d.ts.map +1 -0
- package/dist/server/handlers/a2a.js +3 -1
- 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 +34 -32
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.ts +12 -11
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/handlers.js +13 -11
- 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 -21
- package/dist/_tsup-dts-rollup.d.cts +0 -815
- package/dist/_tsup-dts-rollup.d.ts +0 -815
- package/dist/chunk-57CJTIPW.cjs +0 -18
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-C7564HUT.js +0 -142
- package/dist/chunk-D4IRYCUI.cjs +0 -235
- package/dist/chunk-DJJIUEL2.js +0 -211
- package/dist/chunk-EJO45KYT.js +0 -320
- package/dist/chunk-HFWCEP5S.js +0 -89
- package/dist/chunk-HWZVAG3H.js +0 -49
- package/dist/chunk-I2B73Y4I.cjs +0 -332
- package/dist/chunk-LIVAK2DM.js +0 -2001
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-MHKNLNAN.cjs +0 -142
- package/dist/chunk-MIQYDLLM.js +0 -329
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/chunk-OGCNNUHF.cjs +0 -54
- package/dist/chunk-OR3CIE2H.js +0 -138
- package/dist/chunk-TJKLBTFB.js +0 -132
- package/dist/chunk-UCTEMO2Q.cjs +0 -341
- package/dist/chunk-VPNDC2DI.cjs +0 -148
- package/dist/chunk-WUC6LSTW.js +0 -227
- package/dist/chunk-Y7UWRW5X.cjs +0 -221
- package/dist/chunk-YBVOQN4M.cjs +0 -94
- package/dist/chunk-YWLUOY3D.cjs +0 -2004
- package/dist/chunk-ZE5AAC4I.cjs +0 -138
- package/dist/index.d.cts +0 -1
- package/dist/server/handlers/a2a.d.cts +0 -6
- 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 -11
package/dist/chunk-EJO45KYT.js
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
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';
|
|
5
|
-
import { ReadableStream } from 'node:stream/web';
|
|
6
|
-
|
|
7
|
-
// src/server/handlers/workflows.ts
|
|
8
|
-
var workflows_exports = {};
|
|
9
|
-
__export(workflows_exports, {
|
|
10
|
-
createRunHandler: () => createRunHandler,
|
|
11
|
-
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
12
|
-
getWorkflowRunHandler: () => getWorkflowRunHandler,
|
|
13
|
-
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
14
|
-
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
15
|
-
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
16
|
-
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
17
|
-
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
18
|
-
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
19
|
-
watchWorkflowHandler: () => watchWorkflowHandler
|
|
20
|
-
});
|
|
21
|
-
async function getWorkflowsHandler({ mastra }) {
|
|
22
|
-
try {
|
|
23
|
-
const workflows = mastra.getWorkflows({ serialized: false });
|
|
24
|
-
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
25
|
-
if (workflow.isNested) return acc;
|
|
26
|
-
acc[key] = {
|
|
27
|
-
stepGraph: workflow.stepGraph,
|
|
28
|
-
stepSubscriberGraph: workflow.stepSubscriberGraph,
|
|
29
|
-
serializedStepGraph: workflow.serializedStepGraph,
|
|
30
|
-
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
31
|
-
name: workflow.name,
|
|
32
|
-
triggerSchema: workflow.triggerSchema ? stringify(esm_default(workflow.triggerSchema)) : void 0,
|
|
33
|
-
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
34
|
-
const _step = step;
|
|
35
|
-
acc2[key2] = {
|
|
36
|
-
id: _step.id,
|
|
37
|
-
description: _step.description,
|
|
38
|
-
workflowId: _step.workflowId,
|
|
39
|
-
inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
|
|
40
|
-
outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
|
|
41
|
-
};
|
|
42
|
-
return acc2;
|
|
43
|
-
}, {})
|
|
44
|
-
};
|
|
45
|
-
return acc;
|
|
46
|
-
}, {});
|
|
47
|
-
return _workflows;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
53
|
-
try {
|
|
54
|
-
if (!workflowId) {
|
|
55
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
56
|
-
}
|
|
57
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
58
|
-
if (!workflow) {
|
|
59
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
stepGraph: workflow.stepGraph,
|
|
63
|
-
stepSubscriberGraph: workflow.stepSubscriberGraph,
|
|
64
|
-
serializedStepGraph: workflow.serializedStepGraph,
|
|
65
|
-
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
66
|
-
name: workflow.name,
|
|
67
|
-
triggerSchema: workflow.triggerSchema ? stringify(esm_default(workflow.triggerSchema)) : void 0,
|
|
68
|
-
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
69
|
-
const _step = step;
|
|
70
|
-
acc[key] = {
|
|
71
|
-
id: _step.id,
|
|
72
|
-
description: _step.description,
|
|
73
|
-
workflowId: _step.workflowId,
|
|
74
|
-
inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
|
|
75
|
-
outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
|
|
76
|
-
};
|
|
77
|
-
return acc;
|
|
78
|
-
}, {})
|
|
79
|
-
};
|
|
80
|
-
} catch (error) {
|
|
81
|
-
throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
async function startAsyncWorkflowHandler({
|
|
85
|
-
mastra,
|
|
86
|
-
runtimeContext,
|
|
87
|
-
workflowId,
|
|
88
|
-
runId,
|
|
89
|
-
triggerData
|
|
90
|
-
}) {
|
|
91
|
-
try {
|
|
92
|
-
if (!workflowId) {
|
|
93
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
94
|
-
}
|
|
95
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
96
|
-
if (!workflow) {
|
|
97
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
98
|
-
}
|
|
99
|
-
if (!runId) {
|
|
100
|
-
const newRun = workflow.createRun();
|
|
101
|
-
const result2 = await newRun.start({
|
|
102
|
-
triggerData,
|
|
103
|
-
runtimeContext
|
|
104
|
-
});
|
|
105
|
-
return result2;
|
|
106
|
-
}
|
|
107
|
-
const run = workflow.getMemoryRun(runId);
|
|
108
|
-
if (!run) {
|
|
109
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
110
|
-
}
|
|
111
|
-
const result = await run.start({
|
|
112
|
-
triggerData,
|
|
113
|
-
runtimeContext
|
|
114
|
-
});
|
|
115
|
-
return result;
|
|
116
|
-
} catch (error) {
|
|
117
|
-
throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
async function getWorkflowRunHandler({
|
|
121
|
-
mastra,
|
|
122
|
-
workflowId,
|
|
123
|
-
runId
|
|
124
|
-
}) {
|
|
125
|
-
try {
|
|
126
|
-
if (!workflowId) {
|
|
127
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
128
|
-
}
|
|
129
|
-
if (!runId) {
|
|
130
|
-
throw new HTTPException(400, { message: "Run ID is required" });
|
|
131
|
-
}
|
|
132
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
133
|
-
if (!workflow) {
|
|
134
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
135
|
-
}
|
|
136
|
-
const run = await workflow.getRun(runId);
|
|
137
|
-
if (!run) {
|
|
138
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
139
|
-
}
|
|
140
|
-
return run;
|
|
141
|
-
} catch (error) {
|
|
142
|
-
throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
async function createRunHandler({
|
|
146
|
-
mastra,
|
|
147
|
-
workflowId,
|
|
148
|
-
runId: prevRunId
|
|
149
|
-
}) {
|
|
150
|
-
try {
|
|
151
|
-
if (!workflowId) {
|
|
152
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
153
|
-
}
|
|
154
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
155
|
-
if (!workflow) {
|
|
156
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
157
|
-
}
|
|
158
|
-
const newRun = workflow.createRun({ runId: prevRunId });
|
|
159
|
-
return { runId: newRun.runId };
|
|
160
|
-
} catch (error) {
|
|
161
|
-
throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
async function startWorkflowRunHandler({
|
|
165
|
-
mastra,
|
|
166
|
-
runtimeContext,
|
|
167
|
-
workflowId,
|
|
168
|
-
runId,
|
|
169
|
-
triggerData
|
|
170
|
-
}) {
|
|
171
|
-
try {
|
|
172
|
-
if (!workflowId) {
|
|
173
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
174
|
-
}
|
|
175
|
-
if (!runId) {
|
|
176
|
-
throw new HTTPException(400, { message: "runId required to start run" });
|
|
177
|
-
}
|
|
178
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
179
|
-
const run = workflow.getMemoryRun(runId);
|
|
180
|
-
if (!run) {
|
|
181
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
182
|
-
}
|
|
183
|
-
void run.start({
|
|
184
|
-
triggerData,
|
|
185
|
-
runtimeContext
|
|
186
|
-
});
|
|
187
|
-
return { message: "Workflow run started" };
|
|
188
|
-
} catch (e) {
|
|
189
|
-
return handleError(e, "Error starting workflow run");
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
async function watchWorkflowHandler({
|
|
193
|
-
mastra,
|
|
194
|
-
workflowId,
|
|
195
|
-
runId
|
|
196
|
-
}) {
|
|
197
|
-
try {
|
|
198
|
-
if (!workflowId) {
|
|
199
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
200
|
-
}
|
|
201
|
-
if (!runId) {
|
|
202
|
-
throw new HTTPException(400, { message: "runId required to watch workflow" });
|
|
203
|
-
}
|
|
204
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
205
|
-
const run = workflow.getMemoryRun(runId);
|
|
206
|
-
if (!run) {
|
|
207
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
208
|
-
}
|
|
209
|
-
let unwatch;
|
|
210
|
-
let asyncRef = null;
|
|
211
|
-
const stream = new ReadableStream({
|
|
212
|
-
start(controller) {
|
|
213
|
-
unwatch = run.watch(({ activePaths, runId: runId2, timestamp, results }) => {
|
|
214
|
-
const activePathsObj = Object.fromEntries(activePaths);
|
|
215
|
-
controller.enqueue(JSON.stringify({ activePaths: activePathsObj, runId: runId2, timestamp, results }));
|
|
216
|
-
if (asyncRef) {
|
|
217
|
-
clearImmediate(asyncRef);
|
|
218
|
-
asyncRef = null;
|
|
219
|
-
}
|
|
220
|
-
asyncRef = setImmediate(() => {
|
|
221
|
-
const runDone = Object.values(activePathsObj).every((value) => value.status !== "executing");
|
|
222
|
-
if (runDone) {
|
|
223
|
-
controller.close();
|
|
224
|
-
unwatch?.();
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
},
|
|
229
|
-
cancel() {
|
|
230
|
-
unwatch?.();
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
return stream;
|
|
234
|
-
} catch (error) {
|
|
235
|
-
return handleError(error, "Error watching workflow");
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
async function resumeAsyncWorkflowHandler({
|
|
239
|
-
mastra,
|
|
240
|
-
workflowId,
|
|
241
|
-
runId,
|
|
242
|
-
body,
|
|
243
|
-
runtimeContext
|
|
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
|
-
const run = workflow.getMemoryRun(runId);
|
|
254
|
-
if (!run) {
|
|
255
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
256
|
-
}
|
|
257
|
-
const result = await run.resume({
|
|
258
|
-
stepId: body.stepId,
|
|
259
|
-
context: body.context,
|
|
260
|
-
runtimeContext
|
|
261
|
-
});
|
|
262
|
-
return result;
|
|
263
|
-
} catch (error) {
|
|
264
|
-
return handleError(error, "Error resuming workflow step");
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
async function resumeWorkflowHandler({
|
|
268
|
-
mastra,
|
|
269
|
-
workflowId,
|
|
270
|
-
runId,
|
|
271
|
-
body,
|
|
272
|
-
runtimeContext
|
|
273
|
-
}) {
|
|
274
|
-
try {
|
|
275
|
-
if (!workflowId) {
|
|
276
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
277
|
-
}
|
|
278
|
-
if (!runId) {
|
|
279
|
-
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
280
|
-
}
|
|
281
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
282
|
-
const run = workflow.getMemoryRun(runId);
|
|
283
|
-
if (!run) {
|
|
284
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
285
|
-
}
|
|
286
|
-
void run.resume({
|
|
287
|
-
stepId: body.stepId,
|
|
288
|
-
context: body.context,
|
|
289
|
-
runtimeContext
|
|
290
|
-
});
|
|
291
|
-
return { message: "Workflow run resumed" };
|
|
292
|
-
} catch (error) {
|
|
293
|
-
return handleError(error, "Error resuming workflow");
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
async function getWorkflowRunsHandler({
|
|
297
|
-
mastra,
|
|
298
|
-
workflowId,
|
|
299
|
-
fromDate,
|
|
300
|
-
toDate,
|
|
301
|
-
limit,
|
|
302
|
-
offset,
|
|
303
|
-
resourceId
|
|
304
|
-
}) {
|
|
305
|
-
try {
|
|
306
|
-
if (!workflowId) {
|
|
307
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
308
|
-
}
|
|
309
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
310
|
-
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
311
|
-
runs: [],
|
|
312
|
-
total: 0
|
|
313
|
-
};
|
|
314
|
-
return workflowRuns;
|
|
315
|
-
} catch (error) {
|
|
316
|
-
return handleError(error, "Error getting workflow runs");
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export { createRunHandler, getWorkflowByIdHandler, getWorkflowRunHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler, workflows_exports };
|
package/dist/chunk-HFWCEP5S.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { validateBody } from './chunk-H5PTF3Y4.js';
|
|
2
|
-
import { handleError } from './chunk-M5ABIP7D.js';
|
|
3
|
-
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
4
|
-
import { __export } from './chunk-MLKGABMK.js';
|
|
5
|
-
import { Readable } from 'stream';
|
|
6
|
-
|
|
7
|
-
// src/server/handlers/voice.ts
|
|
8
|
-
var voice_exports = {};
|
|
9
|
-
__export(voice_exports, {
|
|
10
|
-
generateSpeechHandler: () => generateSpeechHandler,
|
|
11
|
-
getSpeakersHandler: () => getSpeakersHandler,
|
|
12
|
-
transcribeSpeechHandler: () => transcribeSpeechHandler
|
|
13
|
-
});
|
|
14
|
-
async function getSpeakersHandler({ mastra, agentId }) {
|
|
15
|
-
try {
|
|
16
|
-
if (!agentId) {
|
|
17
|
-
throw new HTTPException(400, { message: "Agent ID is required" });
|
|
18
|
-
}
|
|
19
|
-
const agent = mastra.getAgent(agentId);
|
|
20
|
-
if (!agent) {
|
|
21
|
-
throw new HTTPException(404, { message: "Agent not found" });
|
|
22
|
-
}
|
|
23
|
-
if (!agent.voice) {
|
|
24
|
-
throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
25
|
-
}
|
|
26
|
-
const speakers = await agent.voice.getSpeakers();
|
|
27
|
-
return speakers;
|
|
28
|
-
} catch (error) {
|
|
29
|
-
return handleError(error, "Error getting speakers");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async function generateSpeechHandler({
|
|
33
|
-
mastra,
|
|
34
|
-
agentId,
|
|
35
|
-
body
|
|
36
|
-
}) {
|
|
37
|
-
try {
|
|
38
|
-
if (!agentId) {
|
|
39
|
-
throw new HTTPException(400, { message: "Agent ID is required" });
|
|
40
|
-
}
|
|
41
|
-
validateBody({
|
|
42
|
-
text: body?.text
|
|
43
|
-
});
|
|
44
|
-
const agent = mastra.getAgent(agentId);
|
|
45
|
-
if (!agent) {
|
|
46
|
-
throw new HTTPException(404, { message: "Agent not found" });
|
|
47
|
-
}
|
|
48
|
-
if (!agent.voice) {
|
|
49
|
-
throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
50
|
-
}
|
|
51
|
-
const audioStream = await agent.voice.speak(body.text, { speaker: body.speakerId });
|
|
52
|
-
if (!audioStream) {
|
|
53
|
-
throw new HTTPException(500, { message: "Failed to generate speech" });
|
|
54
|
-
}
|
|
55
|
-
return audioStream;
|
|
56
|
-
} catch (error) {
|
|
57
|
-
return handleError(error, "Error generating speech");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
async function transcribeSpeechHandler({
|
|
61
|
-
mastra,
|
|
62
|
-
agentId,
|
|
63
|
-
body
|
|
64
|
-
}) {
|
|
65
|
-
try {
|
|
66
|
-
if (!agentId) {
|
|
67
|
-
throw new HTTPException(400, { message: "Agent ID is required" });
|
|
68
|
-
}
|
|
69
|
-
if (!body?.audioData) {
|
|
70
|
-
throw new HTTPException(400, { message: "Audio data is required" });
|
|
71
|
-
}
|
|
72
|
-
const agent = mastra.getAgent(agentId);
|
|
73
|
-
if (!agent) {
|
|
74
|
-
throw new HTTPException(404, { message: "Agent not found" });
|
|
75
|
-
}
|
|
76
|
-
if (!agent.voice) {
|
|
77
|
-
throw new HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
78
|
-
}
|
|
79
|
-
const audioStream = new Readable();
|
|
80
|
-
audioStream.push(body.audioData);
|
|
81
|
-
audioStream.push(null);
|
|
82
|
-
const text = await agent.voice.listen(audioStream, body.options);
|
|
83
|
-
return { text };
|
|
84
|
-
} catch (error) {
|
|
85
|
-
return handleError(error, "Error transcribing speech");
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export { generateSpeechHandler, getSpeakersHandler, transcribeSpeechHandler, voice_exports };
|
package/dist/chunk-HWZVAG3H.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { validateBody } from './chunk-H5PTF3Y4.js';
|
|
2
|
-
import { handleError } from './chunk-M5ABIP7D.js';
|
|
3
|
-
import { __export } from './chunk-MLKGABMK.js';
|
|
4
|
-
|
|
5
|
-
// src/server/handlers/logs.ts
|
|
6
|
-
var logs_exports = {};
|
|
7
|
-
__export(logs_exports, {
|
|
8
|
-
getLogTransports: () => getLogTransports,
|
|
9
|
-
getLogsByRunIdHandler: () => getLogsByRunIdHandler,
|
|
10
|
-
getLogsHandler: () => getLogsHandler
|
|
11
|
-
});
|
|
12
|
-
async function getLogsHandler({
|
|
13
|
-
mastra,
|
|
14
|
-
transportId
|
|
15
|
-
}) {
|
|
16
|
-
try {
|
|
17
|
-
validateBody({ transportId });
|
|
18
|
-
const logs = await mastra.getLogs(transportId);
|
|
19
|
-
return logs;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
return handleError(error, "Error getting logs");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
async function getLogsByRunIdHandler({
|
|
25
|
-
mastra,
|
|
26
|
-
runId,
|
|
27
|
-
transportId
|
|
28
|
-
}) {
|
|
29
|
-
try {
|
|
30
|
-
validateBody({ runId, transportId });
|
|
31
|
-
const logs = await mastra.getLogsByRunId({ runId, transportId });
|
|
32
|
-
return logs;
|
|
33
|
-
} catch (error) {
|
|
34
|
-
return handleError(error, "Error getting logs by run ID");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
async function getLogTransports({ mastra }) {
|
|
38
|
-
try {
|
|
39
|
-
const logger = mastra.getLogger();
|
|
40
|
-
const transports = logger.transports;
|
|
41
|
-
return {
|
|
42
|
-
transports: transports ? Object.keys(transports) : []
|
|
43
|
-
};
|
|
44
|
-
} catch (error) {
|
|
45
|
-
return handleError(error, "Error getting log Transports");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { getLogTransports, getLogsByRunIdHandler, getLogsHandler, logs_exports };
|