@mastra/server 0.0.0-vector-sources-20250516175436 → 0.0.0-vector-query-tool-provider-options-20250828222356
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/{chunk-5SN4U5AC.cjs → chunk-3THIIWWW.cjs} +113 -137
- package/dist/chunk-3THIIWWW.cjs.map +1 -0
- package/dist/{chunk-57CJTIPW.cjs → chunk-4QSNRCOT.cjs} +4 -2
- package/dist/chunk-4QSNRCOT.cjs.map +1 -0
- package/dist/{chunk-P6SCPDYW.js → chunk-5QUKZCEF.js} +112 -136
- package/dist/chunk-5QUKZCEF.js.map +1 -0
- package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
- package/dist/chunk-7NADHFD2.cjs.map +1 -0
- package/dist/chunk-7QEJ5QG5.js +151 -0
- package/dist/chunk-7QEJ5QG5.js.map +1 -0
- package/dist/{chunk-ZE5AAC4I.cjs → chunk-A3FNPSBB.cjs} +36 -39
- package/dist/chunk-A3FNPSBB.cjs.map +1 -0
- package/dist/{chunk-MHKNLNAN.cjs → chunk-B2L53BNJ.cjs} +14 -9
- package/dist/chunk-B2L53BNJ.cjs.map +1 -0
- package/dist/{chunk-C7564HUT.js → chunk-B43YAQJR.js} +6 -4
- package/dist/chunk-B43YAQJR.js.map +1 -0
- package/dist/{chunk-TJKLBTFB.js → chunk-BUMPRH7R.js} +23 -26
- package/dist/chunk-BUMPRH7R.js.map +1 -0
- package/dist/chunk-CY4TP3FK.js +16 -0
- package/dist/chunk-CY4TP3FK.js.map +1 -0
- package/dist/chunk-D32MNBNS.js +17597 -0
- package/dist/chunk-D32MNBNS.js.map +1 -0
- package/dist/chunk-EMMSS5I5.cjs +37 -0
- package/dist/chunk-EMMSS5I5.cjs.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-GU4EWMZB.cjs +769 -0
- package/dist/chunk-GU4EWMZB.cjs.map +1 -0
- package/dist/chunk-GUI3CROV.cjs +159 -0
- package/dist/chunk-GUI3CROV.cjs.map +1 -0
- package/dist/chunk-ID37OH5Z.js +517 -0
- package/dist/chunk-ID37OH5Z.js.map +1 -0
- package/dist/{chunk-VPNDC2DI.cjs → chunk-JGD42NME.cjs} +16 -14
- package/dist/chunk-JGD42NME.cjs.map +1 -0
- package/dist/chunk-JPY7GWFC.cjs +17614 -0
- package/dist/chunk-JPY7GWFC.cjs.map +1 -0
- package/dist/chunk-KLCYAQBL.cjs +120 -0
- package/dist/chunk-KLCYAQBL.cjs.map +1 -0
- package/dist/chunk-KNGXRN26.cjs +335 -0
- package/dist/chunk-KNGXRN26.cjs.map +1 -0
- package/dist/chunk-L265APUD.cjs +69 -0
- package/dist/chunk-L265APUD.cjs.map +1 -0
- package/dist/chunk-LF2ZLOFP.js +767 -0
- package/dist/chunk-LF2ZLOFP.js.map +1 -0
- package/dist/chunk-LUPY3MQY.js +571 -0
- package/dist/chunk-LUPY3MQY.js.map +1 -0
- package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
- package/dist/chunk-MMROOK5J.js.map +1 -0
- package/dist/chunk-NPE3X7FQ.cjs +88 -0
- package/dist/chunk-NPE3X7FQ.cjs.map +1 -0
- package/dist/{chunk-H5PTF3Y4.js → chunk-OW4FX5TS.js} +3 -1
- package/dist/chunk-OW4FX5TS.js.map +1 -0
- package/dist/{chunk-OR3CIE2H.js → chunk-PHZHWQZP.js} +10 -5
- package/dist/chunk-PHZHWQZP.js.map +1 -0
- package/dist/{chunk-HFWCEP5S.js → chunk-QBWF6U7Z.js} +36 -11
- package/dist/chunk-QBWF6U7Z.js.map +1 -0
- package/dist/chunk-R7NOGUZG.js +65 -0
- package/dist/chunk-R7NOGUZG.js.map +1 -0
- package/dist/chunk-RE4RPXT2.cjs +18 -0
- package/dist/chunk-RE4RPXT2.cjs.map +1 -0
- package/dist/chunk-ROA7BCHD.js +83 -0
- package/dist/chunk-ROA7BCHD.js.map +1 -0
- package/dist/{chunk-BNEY4P4P.cjs → chunk-T3TIA3O6.cjs} +20 -18
- package/dist/chunk-T3TIA3O6.cjs.map +1 -0
- package/dist/{chunk-EJO45KYT.js → chunk-TTHEEIZ3.js} +53 -50
- package/dist/chunk-TTHEEIZ3.js.map +1 -0
- package/dist/chunk-UVKXRPMV.cjs +588 -0
- package/dist/chunk-UVKXRPMV.cjs.map +1 -0
- package/dist/chunk-V5EWBGBF.cjs +534 -0
- package/dist/chunk-V5EWBGBF.cjs.map +1 -0
- package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
- package/dist/chunk-WHN4VX55.js.map +1 -0
- package/dist/index.cjs +2 -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 +2 -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/agents.cjs +29 -7
- package/dist/server/handlers/agents.cjs.map +1 -0
- package/dist/server/handlers/agents.d.ts +111 -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/legacyWorkflows.cjs +48 -0
- package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
- package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
- package/dist/server/handlers/legacyWorkflows.js +3 -0
- package/dist/server/handlers/legacyWorkflows.js.map +1 -0
- package/dist/server/handlers/logs.cjs +6 -4
- 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 +39 -9
- package/dist/server/handlers/memory.cjs.map +1 -0
- package/dist/server/handlers/memory.d.ts +118 -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/network.cjs +7 -5
- package/dist/server/handlers/network.cjs.map +1 -0
- package/dist/server/handlers/network.d.ts +50 -4
- package/dist/server/handlers/network.d.ts.map +1 -0
- package/dist/server/handlers/network.js +3 -1
- package/dist/server/handlers/network.js.map +1 -0
- package/dist/server/handlers/observability.cjs +16 -0
- package/dist/server/handlers/observability.cjs.map +1 -0
- package/dist/server/handlers/observability.d.ts +23 -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 +49 -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/telemetry.cjs +5 -3
- package/dist/server/handlers/telemetry.cjs.map +1 -0
- package/dist/server/handlers/telemetry.d.ts +32 -2
- package/dist/server/handlers/telemetry.d.ts.map +1 -0
- package/dist/server/handlers/telemetry.js +3 -1
- package/dist/server/handlers/telemetry.js.map +1 -0
- package/dist/server/handlers/tools.cjs +7 -5
- package/dist/server/handlers/tools.cjs.map +1 -0
- package/dist/server/handlers/tools.d.ts +21 -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 +4 -2
- package/dist/server/handlers/utils.cjs.map +1 -0
- package/dist/server/handlers/utils.d.ts +2 -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/vNextNetwork.cjs +220 -0
- package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
- package/dist/server/handlers/vNextNetwork.d.ts +179 -0
- package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
- package/dist/server/handlers/vNextNetwork.js +213 -0
- package/dist/server/handlers/vNextNetwork.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 +39 -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 +35 -13
- package/dist/server/handlers/workflows.cjs.map +1 -0
- package/dist/server/handlers/workflows.d.ts +72 -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 +45 -33
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.ts +14 -11
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/handlers.js +15 -11
- package/dist/server/handlers.js.map +1 -0
- package/dist/server/http-exception.d.ts +87 -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 +3 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/package.json +39 -20
- package/dist/_tsup-dts-rollup.d.cts +0 -816
- package/dist/_tsup-dts-rollup.d.ts +0 -816
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-D4IRYCUI.cjs +0 -235
- package/dist/chunk-DJJIUEL2.js +0 -211
- 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-MIQYDLLM.js +0 -329
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/chunk-OGCNNUHF.cjs +0 -54
- package/dist/chunk-UCTEMO2Q.cjs +0 -341
- 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/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.d.cts +0 -4
- package/dist/server/handlers/telemetry.d.cts +0 -2
- 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-I2B73Y4I.cjs
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkYWLUOY3D_cjs = require('./chunk-YWLUOY3D.cjs');
|
|
4
|
-
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
|
-
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
6
|
-
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
7
|
-
var web = require('stream/web');
|
|
8
|
-
|
|
9
|
-
// src/server/handlers/workflows.ts
|
|
10
|
-
var workflows_exports = {};
|
|
11
|
-
chunk75ZPJI57_cjs.__export(workflows_exports, {
|
|
12
|
-
createRunHandler: () => createRunHandler,
|
|
13
|
-
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
14
|
-
getWorkflowRunHandler: () => getWorkflowRunHandler,
|
|
15
|
-
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
16
|
-
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
17
|
-
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
18
|
-
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
19
|
-
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
20
|
-
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
21
|
-
watchWorkflowHandler: () => watchWorkflowHandler
|
|
22
|
-
});
|
|
23
|
-
async function getWorkflowsHandler({ mastra }) {
|
|
24
|
-
try {
|
|
25
|
-
const workflows = mastra.getWorkflows({ serialized: false });
|
|
26
|
-
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
27
|
-
if (workflow.isNested) return acc;
|
|
28
|
-
acc[key] = {
|
|
29
|
-
stepGraph: workflow.stepGraph,
|
|
30
|
-
stepSubscriberGraph: workflow.stepSubscriberGraph,
|
|
31
|
-
serializedStepGraph: workflow.serializedStepGraph,
|
|
32
|
-
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
33
|
-
name: workflow.name,
|
|
34
|
-
triggerSchema: workflow.triggerSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
35
|
-
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
36
|
-
const _step = step;
|
|
37
|
-
acc2[key2] = {
|
|
38
|
-
id: _step.id,
|
|
39
|
-
description: _step.description,
|
|
40
|
-
workflowId: _step.workflowId,
|
|
41
|
-
inputSchema: _step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
42
|
-
outputSchema: _step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(_step.outputSchema)) : void 0
|
|
43
|
-
};
|
|
44
|
-
return acc2;
|
|
45
|
-
}, {})
|
|
46
|
-
};
|
|
47
|
-
return acc;
|
|
48
|
-
}, {});
|
|
49
|
-
return _workflows;
|
|
50
|
-
} catch (error) {
|
|
51
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
55
|
-
try {
|
|
56
|
-
if (!workflowId) {
|
|
57
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
58
|
-
}
|
|
59
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
60
|
-
if (!workflow) {
|
|
61
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
stepGraph: workflow.stepGraph,
|
|
65
|
-
stepSubscriberGraph: workflow.stepSubscriberGraph,
|
|
66
|
-
serializedStepGraph: workflow.serializedStepGraph,
|
|
67
|
-
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
68
|
-
name: workflow.name,
|
|
69
|
-
triggerSchema: workflow.triggerSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
70
|
-
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
71
|
-
const _step = step;
|
|
72
|
-
acc[key] = {
|
|
73
|
-
id: _step.id,
|
|
74
|
-
description: _step.description,
|
|
75
|
-
workflowId: _step.workflowId,
|
|
76
|
-
inputSchema: _step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
77
|
-
outputSchema: _step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(_step.outputSchema)) : void 0
|
|
78
|
-
};
|
|
79
|
-
return acc;
|
|
80
|
-
}, {})
|
|
81
|
-
};
|
|
82
|
-
} catch (error) {
|
|
83
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async function startAsyncWorkflowHandler({
|
|
87
|
-
mastra,
|
|
88
|
-
runtimeContext,
|
|
89
|
-
workflowId,
|
|
90
|
-
runId,
|
|
91
|
-
triggerData
|
|
92
|
-
}) {
|
|
93
|
-
try {
|
|
94
|
-
if (!workflowId) {
|
|
95
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
96
|
-
}
|
|
97
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
98
|
-
if (!workflow) {
|
|
99
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
100
|
-
}
|
|
101
|
-
if (!runId) {
|
|
102
|
-
const newRun = workflow.createRun();
|
|
103
|
-
const result2 = await newRun.start({
|
|
104
|
-
triggerData,
|
|
105
|
-
runtimeContext
|
|
106
|
-
});
|
|
107
|
-
return result2;
|
|
108
|
-
}
|
|
109
|
-
const run = workflow.getMemoryRun(runId);
|
|
110
|
-
if (!run) {
|
|
111
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
112
|
-
}
|
|
113
|
-
const result = await run.start({
|
|
114
|
-
triggerData,
|
|
115
|
-
runtimeContext
|
|
116
|
-
});
|
|
117
|
-
return result;
|
|
118
|
-
} catch (error) {
|
|
119
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
async function getWorkflowRunHandler({
|
|
123
|
-
mastra,
|
|
124
|
-
workflowId,
|
|
125
|
-
runId
|
|
126
|
-
}) {
|
|
127
|
-
try {
|
|
128
|
-
if (!workflowId) {
|
|
129
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
130
|
-
}
|
|
131
|
-
if (!runId) {
|
|
132
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
133
|
-
}
|
|
134
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
135
|
-
if (!workflow) {
|
|
136
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
137
|
-
}
|
|
138
|
-
const run = await workflow.getRun(runId);
|
|
139
|
-
if (!run) {
|
|
140
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
141
|
-
}
|
|
142
|
-
return run;
|
|
143
|
-
} catch (error) {
|
|
144
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
async function createRunHandler({
|
|
148
|
-
mastra,
|
|
149
|
-
workflowId,
|
|
150
|
-
runId: prevRunId
|
|
151
|
-
}) {
|
|
152
|
-
try {
|
|
153
|
-
if (!workflowId) {
|
|
154
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
155
|
-
}
|
|
156
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
157
|
-
if (!workflow) {
|
|
158
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
159
|
-
}
|
|
160
|
-
const newRun = workflow.createRun({ runId: prevRunId });
|
|
161
|
-
return { runId: newRun.runId };
|
|
162
|
-
} catch (error) {
|
|
163
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
async function startWorkflowRunHandler({
|
|
167
|
-
mastra,
|
|
168
|
-
runtimeContext,
|
|
169
|
-
workflowId,
|
|
170
|
-
runId,
|
|
171
|
-
triggerData
|
|
172
|
-
}) {
|
|
173
|
-
try {
|
|
174
|
-
if (!workflowId) {
|
|
175
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
176
|
-
}
|
|
177
|
-
if (!runId) {
|
|
178
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
179
|
-
}
|
|
180
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
181
|
-
const run = workflow.getMemoryRun(runId);
|
|
182
|
-
if (!run) {
|
|
183
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
184
|
-
}
|
|
185
|
-
void run.start({
|
|
186
|
-
triggerData,
|
|
187
|
-
runtimeContext
|
|
188
|
-
});
|
|
189
|
-
return { message: "Workflow run started" };
|
|
190
|
-
} catch (e) {
|
|
191
|
-
return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
async function watchWorkflowHandler({
|
|
195
|
-
mastra,
|
|
196
|
-
workflowId,
|
|
197
|
-
runId
|
|
198
|
-
}) {
|
|
199
|
-
try {
|
|
200
|
-
if (!workflowId) {
|
|
201
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
202
|
-
}
|
|
203
|
-
if (!runId) {
|
|
204
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
205
|
-
}
|
|
206
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
207
|
-
const run = workflow.getMemoryRun(runId);
|
|
208
|
-
if (!run) {
|
|
209
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
210
|
-
}
|
|
211
|
-
let unwatch;
|
|
212
|
-
let asyncRef = null;
|
|
213
|
-
const stream = new web.ReadableStream({
|
|
214
|
-
start(controller) {
|
|
215
|
-
unwatch = run.watch(({ activePaths, runId: runId2, timestamp, results }) => {
|
|
216
|
-
const activePathsObj = Object.fromEntries(activePaths);
|
|
217
|
-
controller.enqueue(JSON.stringify({ activePaths: activePathsObj, runId: runId2, timestamp, results }));
|
|
218
|
-
if (asyncRef) {
|
|
219
|
-
clearImmediate(asyncRef);
|
|
220
|
-
asyncRef = null;
|
|
221
|
-
}
|
|
222
|
-
asyncRef = setImmediate(() => {
|
|
223
|
-
const runDone = Object.values(activePathsObj).every((value) => value.status !== "executing");
|
|
224
|
-
if (runDone) {
|
|
225
|
-
controller.close();
|
|
226
|
-
unwatch?.();
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
cancel() {
|
|
232
|
-
unwatch?.();
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
return stream;
|
|
236
|
-
} catch (error) {
|
|
237
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
async function resumeAsyncWorkflowHandler({
|
|
241
|
-
mastra,
|
|
242
|
-
workflowId,
|
|
243
|
-
runId,
|
|
244
|
-
body,
|
|
245
|
-
runtimeContext
|
|
246
|
-
}) {
|
|
247
|
-
try {
|
|
248
|
-
if (!workflowId) {
|
|
249
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
250
|
-
}
|
|
251
|
-
if (!runId) {
|
|
252
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
253
|
-
}
|
|
254
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
255
|
-
const run = workflow.getMemoryRun(runId);
|
|
256
|
-
if (!run) {
|
|
257
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
258
|
-
}
|
|
259
|
-
const result = await run.resume({
|
|
260
|
-
stepId: body.stepId,
|
|
261
|
-
context: body.context,
|
|
262
|
-
runtimeContext
|
|
263
|
-
});
|
|
264
|
-
return result;
|
|
265
|
-
} catch (error) {
|
|
266
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
async function resumeWorkflowHandler({
|
|
270
|
-
mastra,
|
|
271
|
-
workflowId,
|
|
272
|
-
runId,
|
|
273
|
-
body,
|
|
274
|
-
runtimeContext
|
|
275
|
-
}) {
|
|
276
|
-
try {
|
|
277
|
-
if (!workflowId) {
|
|
278
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
279
|
-
}
|
|
280
|
-
if (!runId) {
|
|
281
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
282
|
-
}
|
|
283
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
284
|
-
const run = workflow.getMemoryRun(runId);
|
|
285
|
-
if (!run) {
|
|
286
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
287
|
-
}
|
|
288
|
-
void run.resume({
|
|
289
|
-
stepId: body.stepId,
|
|
290
|
-
context: body.context,
|
|
291
|
-
runtimeContext
|
|
292
|
-
});
|
|
293
|
-
return { message: "Workflow run resumed" };
|
|
294
|
-
} catch (error) {
|
|
295
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
async function getWorkflowRunsHandler({
|
|
299
|
-
mastra,
|
|
300
|
-
workflowId,
|
|
301
|
-
fromDate,
|
|
302
|
-
toDate,
|
|
303
|
-
limit,
|
|
304
|
-
offset,
|
|
305
|
-
resourceId
|
|
306
|
-
}) {
|
|
307
|
-
try {
|
|
308
|
-
if (!workflowId) {
|
|
309
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
310
|
-
}
|
|
311
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
312
|
-
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
313
|
-
runs: [],
|
|
314
|
-
total: 0
|
|
315
|
-
};
|
|
316
|
-
return workflowRuns;
|
|
317
|
-
} catch (error) {
|
|
318
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
exports.createRunHandler = createRunHandler;
|
|
323
|
-
exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
|
|
324
|
-
exports.getWorkflowRunHandler = getWorkflowRunHandler;
|
|
325
|
-
exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
|
|
326
|
-
exports.getWorkflowsHandler = getWorkflowsHandler;
|
|
327
|
-
exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
|
|
328
|
-
exports.resumeWorkflowHandler = resumeWorkflowHandler;
|
|
329
|
-
exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
|
|
330
|
-
exports.startWorkflowRunHandler = startWorkflowRunHandler;
|
|
331
|
-
exports.watchWorkflowHandler = watchWorkflowHandler;
|
|
332
|
-
exports.workflows_exports = workflows_exports;
|