@mastra/server 0.0.0-switch-to-core-20250424015131 → 0.0.0-vector-query-sources-20250516172905
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/README.md +48 -135
- package/dist/_tsup-dts-rollup.d.cts +258 -13
- package/dist/_tsup-dts-rollup.d.ts +258 -13
- package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
- package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
- package/dist/chunk-5SN4U5AC.cjs +508 -0
- package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
- package/dist/{chunk-RE6YL32K.js → chunk-C7564HUT.js} +52 -30
- package/dist/chunk-D4IRYCUI.cjs +235 -0
- package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
- package/dist/{chunk-LFOBHRFO.js → chunk-EJO45KYT.js} +35 -20
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/{chunk-Q6SHQECN.js → chunk-HFWCEP5S.js} +4 -3
- package/dist/{chunk-3EJZQ6TQ.js → chunk-HWZVAG3H.js} +3 -3
- package/dist/{chunk-TZK63M5N.cjs → chunk-I2B73Y4I.cjs} +76 -61
- package/dist/chunk-LIVAK2DM.js +2001 -0
- package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
- package/dist/{chunk-7IWQE76Z.cjs → chunk-MHKNLNAN.cjs} +13 -10
- package/dist/chunk-MIQYDLLM.js +329 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/{chunk-SKBVVI24.cjs → chunk-OGCNNUHF.cjs} +9 -9
- package/dist/{chunk-WTHDCRMY.js → chunk-OR3CIE2H.js} +7 -4
- package/dist/chunk-P6SCPDYW.js +500 -0
- package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
- package/dist/chunk-UCTEMO2Q.cjs +341 -0
- package/dist/{chunk-FPIWDH5Y.cjs → chunk-VPNDC2DI.cjs} +62 -40
- package/dist/chunk-WUC6LSTW.js +227 -0
- package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
- package/dist/{chunk-55HTWX4C.cjs → chunk-YBVOQN4M.cjs} +20 -19
- package/dist/chunk-YWLUOY3D.cjs +2004 -0
- package/dist/{chunk-D3G23FP3.cjs → chunk-ZE5AAC4I.cjs} +37 -25
- package/dist/server/handlers/a2a.cjs +30 -0
- package/dist/server/handlers/a2a.d.cts +6 -0
- package/dist/server/handlers/a2a.d.ts +6 -0
- package/dist/server/handlers/a2a.js +1 -0
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +9 -9
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vNextWorkflows.cjs +46 -0
- package/dist/server/handlers/vNextWorkflows.d.cts +10 -0
- package/dist/server/handlers/vNextWorkflows.d.ts +10 -0
- package/dist/server/handlers/vNextWorkflows.js +1 -0
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +4 -4
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +11 -11
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +31 -21
- package/dist/server/handlers.d.cts +2 -0
- package/dist/server/handlers.d.ts +2 -0
- package/dist/server/handlers.js +11 -9
- package/package.json +8 -6
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-HCOPJZ4A.cjs +0 -164
- package/dist/chunk-OMN3UI6X.js +0 -5576
- package/dist/chunk-R4J7XQYU.js +0 -156
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
4
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
5
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
5
6
|
|
|
6
7
|
// src/server/handlers/telemetry.ts
|
|
7
8
|
var telemetry_exports = {};
|
|
8
|
-
|
|
9
|
+
chunk75ZPJI57_cjs.__export(telemetry_exports, {
|
|
9
10
|
getTelemetryHandler: () => getTelemetryHandler,
|
|
10
11
|
storeTelemetryHandler: () => storeTelemetryHandler
|
|
11
12
|
});
|
|
@@ -14,15 +15,15 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
14
15
|
const telemetry = mastra.getTelemetry();
|
|
15
16
|
const storage = mastra.getStorage();
|
|
16
17
|
if (!telemetry) {
|
|
17
|
-
throw new
|
|
18
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Telemetry is not initialized" });
|
|
18
19
|
}
|
|
19
20
|
if (!storage) {
|
|
20
|
-
throw new
|
|
21
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Storage is not initialized" });
|
|
21
22
|
}
|
|
22
23
|
if (!body) {
|
|
23
|
-
throw new
|
|
24
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Body is required" });
|
|
24
25
|
}
|
|
25
|
-
const { name, scope, page, perPage, attribute } = body;
|
|
26
|
+
const { name, scope, page, perPage, attribute, fromDate, toDate } = body;
|
|
26
27
|
const attributes = attribute ? Object.fromEntries(
|
|
27
28
|
(Array.isArray(attribute) ? attribute : [attribute]).map((attr) => {
|
|
28
29
|
const [key, value] = attr.split(":");
|
|
@@ -34,11 +35,13 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
34
35
|
scope,
|
|
35
36
|
page: Number(page ?? 0),
|
|
36
37
|
perPage: Number(perPage ?? 100),
|
|
37
|
-
attributes
|
|
38
|
+
attributes,
|
|
39
|
+
fromDate: fromDate ? new Date(fromDate) : void 0,
|
|
40
|
+
toDate: toDate ? new Date(toDate) : void 0
|
|
38
41
|
});
|
|
39
42
|
return traces;
|
|
40
43
|
} catch (error2) {
|
|
41
|
-
return
|
|
44
|
+
return chunk64U3UDTH_cjs.handleError(error2, "Error getting telemetry");
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
async function storeTelemetryHandler({ mastra, body }) {
|
|
@@ -46,7 +49,7 @@ async function storeTelemetryHandler({ mastra, body }) {
|
|
|
46
49
|
const storage = mastra.getStorage();
|
|
47
50
|
const logger = mastra.getLogger();
|
|
48
51
|
if (!storage) {
|
|
49
|
-
throw new
|
|
52
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Storage is not initialized" });
|
|
50
53
|
}
|
|
51
54
|
const now = /* @__PURE__ */ new Date();
|
|
52
55
|
const items = body?.resourceSpans?.[0]?.scopeSpans;
|
|
@@ -0,0 +1,329 @@
|
|
|
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
|
+
import { RuntimeContext } from '@mastra/core/di';
|
|
7
|
+
|
|
8
|
+
// src/server/handlers/vNextWorkflows.ts
|
|
9
|
+
var vNextWorkflows_exports = {};
|
|
10
|
+
__export(vNextWorkflows_exports, {
|
|
11
|
+
createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
|
|
12
|
+
getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
|
|
13
|
+
getVNextWorkflowRunByIdHandler: () => getVNextWorkflowRunByIdHandler,
|
|
14
|
+
getVNextWorkflowRunsHandler: () => getVNextWorkflowRunsHandler,
|
|
15
|
+
getVNextWorkflowsHandler: () => getVNextWorkflowsHandler,
|
|
16
|
+
resumeAsyncVNextWorkflowHandler: () => resumeAsyncVNextWorkflowHandler,
|
|
17
|
+
resumeVNextWorkflowHandler: () => resumeVNextWorkflowHandler,
|
|
18
|
+
startAsyncVNextWorkflowHandler: () => startAsyncVNextWorkflowHandler,
|
|
19
|
+
startVNextWorkflowRunHandler: () => startVNextWorkflowRunHandler,
|
|
20
|
+
watchVNextWorkflowHandler: () => watchVNextWorkflowHandler
|
|
21
|
+
});
|
|
22
|
+
async function getVNextWorkflowsHandler({ mastra }) {
|
|
23
|
+
try {
|
|
24
|
+
const workflows = mastra.vnext_getWorkflows({ serialized: false });
|
|
25
|
+
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
26
|
+
acc[key] = {
|
|
27
|
+
name: workflow.name,
|
|
28
|
+
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
29
|
+
acc2[key2] = {
|
|
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
|
+
};
|
|
37
|
+
return acc2;
|
|
38
|
+
}, {}),
|
|
39
|
+
stepGraph: workflow.serializedStepGraph,
|
|
40
|
+
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
41
|
+
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
42
|
+
};
|
|
43
|
+
return acc;
|
|
44
|
+
}, {});
|
|
45
|
+
return _workflows;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
51
|
+
try {
|
|
52
|
+
if (!workflowId) {
|
|
53
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
54
|
+
}
|
|
55
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
56
|
+
if (!workflow) {
|
|
57
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
61
|
+
acc[key] = {
|
|
62
|
+
id: step.id,
|
|
63
|
+
description: step.description,
|
|
64
|
+
inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
|
|
65
|
+
outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
|
|
66
|
+
resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
|
|
67
|
+
suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
|
|
68
|
+
};
|
|
69
|
+
return acc;
|
|
70
|
+
}, {}),
|
|
71
|
+
name: workflow.name,
|
|
72
|
+
stepGraph: workflow.serializedStepGraph,
|
|
73
|
+
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
74
|
+
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
75
|
+
};
|
|
76
|
+
} catch (error) {
|
|
77
|
+
throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function getVNextWorkflowRunByIdHandler({
|
|
81
|
+
mastra,
|
|
82
|
+
workflowId,
|
|
83
|
+
runId
|
|
84
|
+
}) {
|
|
85
|
+
try {
|
|
86
|
+
if (!workflowId) {
|
|
87
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
88
|
+
}
|
|
89
|
+
if (!runId) {
|
|
90
|
+
throw new HTTPException(400, { message: "Run ID is required" });
|
|
91
|
+
}
|
|
92
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
93
|
+
if (!workflow) {
|
|
94
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
95
|
+
}
|
|
96
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
97
|
+
if (!run) {
|
|
98
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
99
|
+
}
|
|
100
|
+
return run;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function createVNextWorkflowRunHandler({
|
|
106
|
+
mastra,
|
|
107
|
+
workflowId,
|
|
108
|
+
runId: prevRunId
|
|
109
|
+
}) {
|
|
110
|
+
try {
|
|
111
|
+
if (!workflowId) {
|
|
112
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
113
|
+
}
|
|
114
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
115
|
+
if (!workflow) {
|
|
116
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
117
|
+
}
|
|
118
|
+
const run = workflow.createRun({ runId: prevRunId });
|
|
119
|
+
return { runId: run.runId };
|
|
120
|
+
} catch (error) {
|
|
121
|
+
throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function startAsyncVNextWorkflowHandler({
|
|
125
|
+
mastra,
|
|
126
|
+
runtimeContext,
|
|
127
|
+
workflowId,
|
|
128
|
+
runId,
|
|
129
|
+
inputData,
|
|
130
|
+
runtimeContextFromRequest
|
|
131
|
+
}) {
|
|
132
|
+
try {
|
|
133
|
+
if (!workflowId) {
|
|
134
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
135
|
+
}
|
|
136
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
137
|
+
if (!workflow) {
|
|
138
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
139
|
+
}
|
|
140
|
+
const finalRuntimeContext = new RuntimeContext([
|
|
141
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
142
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
143
|
+
]);
|
|
144
|
+
const _run = workflow.createRun({ runId });
|
|
145
|
+
const result = await _run.start({
|
|
146
|
+
inputData,
|
|
147
|
+
runtimeContext: finalRuntimeContext
|
|
148
|
+
});
|
|
149
|
+
return result;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async function startVNextWorkflowRunHandler({
|
|
155
|
+
mastra,
|
|
156
|
+
runtimeContext,
|
|
157
|
+
workflowId,
|
|
158
|
+
runId,
|
|
159
|
+
inputData,
|
|
160
|
+
runtimeContextFromRequest
|
|
161
|
+
}) {
|
|
162
|
+
try {
|
|
163
|
+
if (!workflowId) {
|
|
164
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
165
|
+
}
|
|
166
|
+
if (!runId) {
|
|
167
|
+
throw new HTTPException(400, { message: "runId required to start run" });
|
|
168
|
+
}
|
|
169
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
170
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
171
|
+
if (!run) {
|
|
172
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
173
|
+
}
|
|
174
|
+
const finalRuntimeContext = new RuntimeContext([
|
|
175
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
176
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
177
|
+
]);
|
|
178
|
+
const _run = workflow.createRun({ runId });
|
|
179
|
+
void _run.start({
|
|
180
|
+
inputData,
|
|
181
|
+
runtimeContext: finalRuntimeContext
|
|
182
|
+
});
|
|
183
|
+
return { message: "Workflow run started" };
|
|
184
|
+
} catch (e) {
|
|
185
|
+
return handleError(e, "Error starting workflow run");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async function watchVNextWorkflowHandler({
|
|
189
|
+
mastra,
|
|
190
|
+
workflowId,
|
|
191
|
+
runId
|
|
192
|
+
}) {
|
|
193
|
+
try {
|
|
194
|
+
if (!workflowId) {
|
|
195
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
196
|
+
}
|
|
197
|
+
if (!runId) {
|
|
198
|
+
throw new HTTPException(400, { message: "runId required to watch workflow" });
|
|
199
|
+
}
|
|
200
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
201
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
202
|
+
if (!run) {
|
|
203
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
204
|
+
}
|
|
205
|
+
const _run = workflow.createRun({ runId });
|
|
206
|
+
let unwatch;
|
|
207
|
+
let asyncRef = null;
|
|
208
|
+
const stream = new ReadableStream({
|
|
209
|
+
start(controller) {
|
|
210
|
+
unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
|
|
211
|
+
controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
|
|
212
|
+
if (asyncRef) {
|
|
213
|
+
clearImmediate(asyncRef);
|
|
214
|
+
asyncRef = null;
|
|
215
|
+
}
|
|
216
|
+
asyncRef = setImmediate(async () => {
|
|
217
|
+
const runDone = payload.workflowState.status !== "running";
|
|
218
|
+
if (runDone) {
|
|
219
|
+
controller.close();
|
|
220
|
+
unwatch?.();
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
},
|
|
225
|
+
cancel() {
|
|
226
|
+
unwatch?.();
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
return stream;
|
|
230
|
+
} catch (error) {
|
|
231
|
+
return handleError(error, "Error watching workflow");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async function resumeAsyncVNextWorkflowHandler({
|
|
235
|
+
mastra,
|
|
236
|
+
workflowId,
|
|
237
|
+
runId,
|
|
238
|
+
body,
|
|
239
|
+
runtimeContext,
|
|
240
|
+
runtimeContextFromRequest
|
|
241
|
+
}) {
|
|
242
|
+
try {
|
|
243
|
+
if (!workflowId) {
|
|
244
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
245
|
+
}
|
|
246
|
+
if (!runId) {
|
|
247
|
+
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
248
|
+
}
|
|
249
|
+
if (!body.step) {
|
|
250
|
+
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
251
|
+
}
|
|
252
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
253
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
254
|
+
if (!run) {
|
|
255
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
256
|
+
}
|
|
257
|
+
const finalRuntimeContext = new RuntimeContext([
|
|
258
|
+
...Array.from(runtimeContext?.entries() ?? []),
|
|
259
|
+
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
260
|
+
]);
|
|
261
|
+
const _run = workflow.createRun({ runId });
|
|
262
|
+
const result = await _run.resume({
|
|
263
|
+
step: body.step,
|
|
264
|
+
resumeData: body.resumeData,
|
|
265
|
+
runtimeContext: finalRuntimeContext
|
|
266
|
+
});
|
|
267
|
+
return result;
|
|
268
|
+
} catch (error) {
|
|
269
|
+
return handleError(error, "Error resuming workflow step");
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
async function resumeVNextWorkflowHandler({
|
|
273
|
+
mastra,
|
|
274
|
+
workflowId,
|
|
275
|
+
runId,
|
|
276
|
+
body,
|
|
277
|
+
runtimeContext
|
|
278
|
+
}) {
|
|
279
|
+
try {
|
|
280
|
+
if (!workflowId) {
|
|
281
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
282
|
+
}
|
|
283
|
+
if (!runId) {
|
|
284
|
+
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
285
|
+
}
|
|
286
|
+
if (!body.step) {
|
|
287
|
+
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
288
|
+
}
|
|
289
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
290
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
291
|
+
if (!run) {
|
|
292
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
293
|
+
}
|
|
294
|
+
const _run = workflow.createRun({ runId });
|
|
295
|
+
void _run.resume({
|
|
296
|
+
step: body.step,
|
|
297
|
+
resumeData: body.resumeData,
|
|
298
|
+
runtimeContext
|
|
299
|
+
});
|
|
300
|
+
return { message: "Workflow run resumed" };
|
|
301
|
+
} catch (error) {
|
|
302
|
+
return handleError(error, "Error resuming workflow");
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
async function getVNextWorkflowRunsHandler({
|
|
306
|
+
mastra,
|
|
307
|
+
workflowId,
|
|
308
|
+
fromDate,
|
|
309
|
+
toDate,
|
|
310
|
+
limit,
|
|
311
|
+
offset,
|
|
312
|
+
resourceId
|
|
313
|
+
}) {
|
|
314
|
+
try {
|
|
315
|
+
if (!workflowId) {
|
|
316
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
317
|
+
}
|
|
318
|
+
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
319
|
+
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
320
|
+
runs: [],
|
|
321
|
+
total: 0
|
|
322
|
+
};
|
|
323
|
+
return workflowRuns;
|
|
324
|
+
} catch (error) {
|
|
325
|
+
return handleError(error, "Error getting workflow runs");
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export { createVNextWorkflowRunHandler, getVNextWorkflowByIdHandler, getVNextWorkflowRunByIdHandler, getVNextWorkflowRunsHandler, getVNextWorkflowsHandler, resumeAsyncVNextWorkflowHandler, resumeVNextWorkflowHandler, startAsyncVNextWorkflowHandler, startVNextWorkflowRunHandler, vNextWorkflows_exports, watchVNextWorkflowHandler };
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
1
|
// src/server/http-exception.ts
|
|
8
2
|
var HTTPException = class extends Error {
|
|
9
3
|
res;
|
|
@@ -37,4 +31,4 @@ var HTTPException = class extends Error {
|
|
|
37
31
|
}
|
|
38
32
|
};
|
|
39
33
|
|
|
40
|
-
export { HTTPException
|
|
34
|
+
export { HTTPException };
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __export = (target, all) => {
|
|
5
|
-
for (var name in all)
|
|
6
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
|
-
};
|
|
8
|
-
|
|
9
3
|
// src/server/http-exception.ts
|
|
10
4
|
var HTTPException = class extends Error {
|
|
11
5
|
res;
|
|
@@ -40,4 +34,3 @@ var HTTPException = class extends Error {
|
|
|
40
34
|
};
|
|
41
35
|
|
|
42
36
|
exports.HTTPException = HTTPException;
|
|
43
|
-
exports.__export = __export;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
|
|
4
|
+
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
6
6
|
|
|
7
7
|
// src/server/handlers/logs.ts
|
|
8
8
|
var logs_exports = {};
|
|
9
|
-
|
|
9
|
+
chunk75ZPJI57_cjs.__export(logs_exports, {
|
|
10
10
|
getLogTransports: () => getLogTransports,
|
|
11
11
|
getLogsByRunIdHandler: () => getLogsByRunIdHandler,
|
|
12
12
|
getLogsHandler: () => getLogsHandler
|
|
@@ -16,11 +16,11 @@ async function getLogsHandler({
|
|
|
16
16
|
transportId
|
|
17
17
|
}) {
|
|
18
18
|
try {
|
|
19
|
-
|
|
19
|
+
chunk57CJTIPW_cjs.validateBody({ transportId });
|
|
20
20
|
const logs = await mastra.getLogs(transportId);
|
|
21
21
|
return logs;
|
|
22
22
|
} catch (error) {
|
|
23
|
-
return
|
|
23
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting logs");
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
async function getLogsByRunIdHandler({
|
|
@@ -29,11 +29,11 @@ async function getLogsByRunIdHandler({
|
|
|
29
29
|
transportId
|
|
30
30
|
}) {
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
chunk57CJTIPW_cjs.validateBody({ runId, transportId });
|
|
33
33
|
const logs = await mastra.getLogsByRunId({ runId, transportId });
|
|
34
34
|
return logs;
|
|
35
35
|
} catch (error) {
|
|
36
|
-
return
|
|
36
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting logs by run ID");
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
async function getLogTransports({ mastra }) {
|
|
@@ -44,7 +44,7 @@ async function getLogTransports({ mastra }) {
|
|
|
44
44
|
transports: transports ? Object.keys(transports) : []
|
|
45
45
|
};
|
|
46
46
|
} catch (error) {
|
|
47
|
-
return
|
|
47
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting log Transports");
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { handleError } from './chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { handleError } from './chunk-M5ABIP7D.js';
|
|
2
|
+
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
3
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
3
4
|
|
|
4
5
|
// src/server/handlers/telemetry.ts
|
|
5
6
|
var telemetry_exports = {};
|
|
@@ -20,7 +21,7 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
20
21
|
if (!body) {
|
|
21
22
|
throw new HTTPException(400, { message: "Body is required" });
|
|
22
23
|
}
|
|
23
|
-
const { name, scope, page, perPage, attribute } = body;
|
|
24
|
+
const { name, scope, page, perPage, attribute, fromDate, toDate } = body;
|
|
24
25
|
const attributes = attribute ? Object.fromEntries(
|
|
25
26
|
(Array.isArray(attribute) ? attribute : [attribute]).map((attr) => {
|
|
26
27
|
const [key, value] = attr.split(":");
|
|
@@ -32,7 +33,9 @@ async function getTelemetryHandler({ mastra, body }) {
|
|
|
32
33
|
scope,
|
|
33
34
|
page: Number(page ?? 0),
|
|
34
35
|
perPage: Number(perPage ?? 100),
|
|
35
|
-
attributes
|
|
36
|
+
attributes,
|
|
37
|
+
fromDate: fromDate ? new Date(fromDate) : void 0,
|
|
38
|
+
toDate: toDate ? new Date(toDate) : void 0
|
|
36
39
|
});
|
|
37
40
|
return traces;
|
|
38
41
|
} catch (error2) {
|