@mastra/server 0.0.0-cli-debug-2-20250611100354 → 0.0.0-cloudflare-deployer-dont-install-deps-20250714111754

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.
Files changed (70) hide show
  1. package/LICENSE.md +11 -42
  2. package/dist/_tsup-dts-rollup.d.cts +275 -28
  3. package/dist/_tsup-dts-rollup.d.ts +275 -28
  4. package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
  5. package/dist/{chunk-VPNDC2DI.cjs → chunk-2SLFAFTR.cjs} +12 -12
  6. package/dist/chunk-3CNDE7QY.cjs +308 -0
  7. package/dist/{chunk-QLG2PFHE.js → chunk-4D66QEKC.js} +2 -2
  8. package/dist/{chunk-TEZOEGR4.js → chunk-5PQQ42EZ.js} +8 -8
  9. package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
  10. package/dist/chunk-B2PAS2IB.cjs +514 -0
  11. package/dist/{chunk-6F2H7Y45.js → chunk-BK4XT6EG.js} +29 -14
  12. package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
  13. package/dist/{chunk-C7564HUT.js → chunk-CRCR3ZUK.js} +3 -3
  14. package/dist/{chunk-TJO277H7.cjs → chunk-FRVBFMO2.cjs} +20 -20
  15. package/dist/{chunk-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
  16. package/dist/{chunk-7IBZ4L35.js → chunk-H7DMHBKY.js} +181 -27
  17. package/dist/{chunk-UZ7FJ66C.cjs → chunk-JMLYCXMK.cjs} +43 -43
  18. package/dist/{chunk-CP55EVBK.js → chunk-KHZKYUNR.js} +15 -11
  19. package/dist/{chunk-I7KJZNX5.js → chunk-KOHWJYJT.js} +110 -25
  20. package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
  21. package/dist/chunk-LF7P5PLR.js +14 -0
  22. package/dist/{chunk-XUGQSVZ4.cjs → chunk-LI436ITD.cjs} +107 -69
  23. package/dist/{chunk-HYP7B2TL.js → chunk-LRCAAFUA.js} +4 -4
  24. package/dist/{chunk-JEWNMAYQ.cjs → chunk-LZ3VJXSO.cjs} +43 -28
  25. package/dist/{chunk-WKWHYFX4.js → chunk-MEGCYGBU.js} +108 -70
  26. package/dist/chunk-PZQDCRPV.cjs +16 -0
  27. package/dist/{chunk-IMBY5XUG.cjs → chunk-QGX47B5D.cjs} +7 -7
  28. package/dist/{chunk-BFOA2QQY.js → chunk-RG473F6Y.js} +2 -2
  29. package/dist/{chunk-CMMOIUFC.cjs → chunk-RHSWAXKB.cjs} +34 -30
  30. package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
  31. package/dist/{chunk-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
  32. package/dist/server/handlers/agents.cjs +7 -7
  33. package/dist/server/handlers/agents.js +1 -1
  34. package/dist/server/handlers/error.cjs +2 -2
  35. package/dist/server/handlers/error.js +1 -1
  36. package/dist/server/handlers/legacyWorkflows.cjs +11 -11
  37. package/dist/server/handlers/legacyWorkflows.js +1 -1
  38. package/dist/server/handlers/logs.cjs +4 -4
  39. package/dist/server/handlers/logs.js +1 -1
  40. package/dist/server/handlers/memory.cjs +17 -9
  41. package/dist/server/handlers/memory.d.cts +2 -0
  42. package/dist/server/handlers/memory.d.ts +2 -0
  43. package/dist/server/handlers/memory.js +1 -1
  44. package/dist/server/handlers/network.cjs +5 -5
  45. package/dist/server/handlers/network.js +1 -1
  46. package/dist/server/handlers/telemetry.cjs +3 -3
  47. package/dist/server/handlers/telemetry.js +1 -1
  48. package/dist/server/handlers/tools.cjs +5 -5
  49. package/dist/server/handlers/tools.js +1 -1
  50. package/dist/server/handlers/utils.cjs +2 -2
  51. package/dist/server/handlers/utils.js +1 -1
  52. package/dist/server/handlers/vNextNetwork.cjs +218 -0
  53. package/dist/server/handlers/vNextNetwork.d.cts +6 -0
  54. package/dist/server/handlers/vNextNetwork.d.ts +6 -0
  55. package/dist/server/handlers/vNextNetwork.js +211 -0
  56. package/dist/server/handlers/vector.cjs +7 -7
  57. package/dist/server/handlers/vector.js +1 -1
  58. package/dist/server/handlers/voice.cjs +5 -5
  59. package/dist/server/handlers/voice.js +1 -1
  60. package/dist/server/handlers/workflows.cjs +24 -12
  61. package/dist/server/handlers/workflows.d.cts +3 -0
  62. package/dist/server/handlers/workflows.d.ts +3 -0
  63. package/dist/server/handlers/workflows.js +1 -1
  64. package/dist/server/handlers.cjs +20 -20
  65. package/dist/server/handlers.js +10 -10
  66. package/package.json +11 -12
  67. package/dist/chunk-64U3UDTH.cjs +0 -13
  68. package/dist/chunk-6TJSHFCJ.cjs +0 -221
  69. package/dist/chunk-JKF6PRPU.cjs +0 -357
  70. package/dist/chunk-M5ABIP7D.js +0 -11
@@ -1,357 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkXUGQSVZ4_cjs = require('./chunk-XUGQSVZ4.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
- createWorkflowRunHandler: () => createWorkflowRunHandler,
13
- getWorkflowByIdHandler: () => getWorkflowByIdHandler,
14
- getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
15
- getWorkflowRunsHandler: () => getWorkflowRunsHandler,
16
- getWorkflowsHandler: () => getWorkflowsHandler,
17
- resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
18
- resumeWorkflowHandler: () => resumeWorkflowHandler,
19
- startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
20
- startWorkflowRunHandler: () => startWorkflowRunHandler,
21
- streamWorkflowHandler: () => streamWorkflowHandler,
22
- watchWorkflowHandler: () => watchWorkflowHandler
23
- });
24
- async function getWorkflowsHandler({ mastra }) {
25
- try {
26
- const workflows = mastra.getWorkflows({ serialized: false });
27
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
28
- acc[key] = {
29
- name: workflow.name,
30
- description: workflow.description,
31
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
32
- acc2[key2] = {
33
- id: step.id,
34
- description: step.description,
35
- inputSchema: step.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.inputSchema)) : void 0,
36
- outputSchema: step.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.outputSchema)) : void 0,
37
- resumeSchema: step.resumeSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.resumeSchema)) : void 0,
38
- suspendSchema: step.suspendSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.suspendSchema)) : void 0
39
- };
40
- return acc2;
41
- }, {}),
42
- stepGraph: workflow.serializedStepGraph,
43
- inputSchema: workflow.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.inputSchema)) : void 0,
44
- outputSchema: workflow.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.outputSchema)) : void 0
45
- };
46
- return acc;
47
- }, {});
48
- return _workflows;
49
- } catch (error) {
50
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
51
- }
52
- }
53
- async function getWorkflowByIdHandler({ mastra, workflowId }) {
54
- try {
55
- if (!workflowId) {
56
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
57
- }
58
- const workflow = mastra.getWorkflow(workflowId);
59
- if (!workflow) {
60
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
61
- }
62
- return {
63
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
64
- acc[key] = {
65
- id: step.id,
66
- description: step.description,
67
- inputSchema: step.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.inputSchema)) : void 0,
68
- outputSchema: step.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.outputSchema)) : void 0,
69
- resumeSchema: step.resumeSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.resumeSchema)) : void 0,
70
- suspendSchema: step.suspendSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.suspendSchema)) : void 0
71
- };
72
- return acc;
73
- }, {}),
74
- name: workflow.name,
75
- description: workflow.description,
76
- stepGraph: workflow.serializedStepGraph,
77
- inputSchema: workflow.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.inputSchema)) : void 0,
78
- outputSchema: workflow.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.outputSchema)) : void 0
79
- };
80
- } catch (error) {
81
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
82
- }
83
- }
84
- async function getWorkflowRunByIdHandler({
85
- mastra,
86
- workflowId,
87
- runId
88
- }) {
89
- try {
90
- if (!workflowId) {
91
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
92
- }
93
- if (!runId) {
94
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
95
- }
96
- const workflow = mastra.getWorkflow(workflowId);
97
- if (!workflow) {
98
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
99
- }
100
- const run = await workflow.getWorkflowRunById(runId);
101
- if (!run) {
102
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
103
- }
104
- return run;
105
- } catch (error) {
106
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
107
- }
108
- }
109
- async function createWorkflowRunHandler({
110
- mastra,
111
- workflowId,
112
- runId: prevRunId
113
- }) {
114
- try {
115
- if (!workflowId) {
116
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
117
- }
118
- const workflow = mastra.getWorkflow(workflowId);
119
- if (!workflow) {
120
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
121
- }
122
- const run = workflow.createRun({ runId: prevRunId });
123
- return { runId: run.runId };
124
- } catch (error) {
125
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
126
- }
127
- }
128
- async function startAsyncWorkflowHandler({
129
- mastra,
130
- runtimeContext,
131
- workflowId,
132
- runId,
133
- inputData
134
- }) {
135
- try {
136
- if (!workflowId) {
137
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
138
- }
139
- const workflow = mastra.getWorkflow(workflowId);
140
- if (!workflow) {
141
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
142
- }
143
- const _run = workflow.createRun({ runId });
144
- const result = await _run.start({
145
- inputData,
146
- runtimeContext
147
- });
148
- return result;
149
- } catch (error) {
150
- throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
151
- }
152
- }
153
- async function startWorkflowRunHandler({
154
- mastra,
155
- runtimeContext,
156
- workflowId,
157
- runId,
158
- inputData
159
- }) {
160
- try {
161
- if (!workflowId) {
162
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
163
- }
164
- if (!runId) {
165
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
166
- }
167
- const workflow = mastra.getWorkflow(workflowId);
168
- const run = await workflow.getWorkflowRunById(runId);
169
- if (!run) {
170
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
171
- }
172
- const _run = workflow.createRun({ runId });
173
- void _run.start({
174
- inputData,
175
- runtimeContext
176
- });
177
- return { message: "Workflow run started" };
178
- } catch (e) {
179
- return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
180
- }
181
- }
182
- async function watchWorkflowHandler({
183
- mastra,
184
- workflowId,
185
- runId
186
- }) {
187
- try {
188
- if (!workflowId) {
189
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
190
- }
191
- if (!runId) {
192
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
193
- }
194
- const workflow = mastra.getWorkflow(workflowId);
195
- const run = await workflow.getWorkflowRunById(runId);
196
- if (!run) {
197
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
198
- }
199
- const _run = workflow.createRun({ runId });
200
- let unwatch;
201
- let asyncRef = null;
202
- const stream = new web.ReadableStream({
203
- start(controller) {
204
- unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
205
- controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
206
- if (asyncRef) {
207
- clearImmediate(asyncRef);
208
- asyncRef = null;
209
- }
210
- asyncRef = setImmediate(async () => {
211
- const runDone = payload.workflowState.status !== "running";
212
- if (runDone) {
213
- controller.close();
214
- unwatch?.();
215
- }
216
- });
217
- });
218
- },
219
- cancel() {
220
- unwatch?.();
221
- }
222
- });
223
- return stream;
224
- } catch (error) {
225
- return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
226
- }
227
- }
228
- function streamWorkflowHandler({
229
- mastra,
230
- runtimeContext,
231
- workflowId,
232
- runId,
233
- inputData
234
- }) {
235
- try {
236
- if (!workflowId) {
237
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
238
- }
239
- if (!runId) {
240
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
241
- }
242
- const workflow = mastra.getWorkflow(workflowId);
243
- if (!workflow) {
244
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
245
- }
246
- const run = workflow.createRun({ runId });
247
- const result = run.stream({
248
- inputData,
249
- runtimeContext
250
- });
251
- return result;
252
- } catch (error) {
253
- return chunk64U3UDTH_cjs.handleError(error, "Error executing workflow");
254
- }
255
- }
256
- async function resumeAsyncWorkflowHandler({
257
- mastra,
258
- workflowId,
259
- runId,
260
- body,
261
- runtimeContext
262
- }) {
263
- try {
264
- if (!workflowId) {
265
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
266
- }
267
- if (!runId) {
268
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
269
- }
270
- if (!body.step) {
271
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
272
- }
273
- const workflow = mastra.getWorkflow(workflowId);
274
- const run = await workflow.getWorkflowRunById(runId);
275
- if (!run) {
276
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
277
- }
278
- const _run = workflow.createRun({ runId });
279
- const result = await _run.resume({
280
- step: body.step,
281
- resumeData: body.resumeData,
282
- runtimeContext
283
- });
284
- return result;
285
- } catch (error) {
286
- return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
287
- }
288
- }
289
- async function resumeWorkflowHandler({
290
- mastra,
291
- workflowId,
292
- runId,
293
- body,
294
- runtimeContext
295
- }) {
296
- try {
297
- if (!workflowId) {
298
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
299
- }
300
- if (!runId) {
301
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
302
- }
303
- if (!body.step) {
304
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
305
- }
306
- const workflow = mastra.getWorkflow(workflowId);
307
- const run = await workflow.getWorkflowRunById(runId);
308
- if (!run) {
309
- throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
310
- }
311
- const _run = workflow.createRun({ runId });
312
- void _run.resume({
313
- step: body.step,
314
- resumeData: body.resumeData,
315
- runtimeContext
316
- });
317
- return { message: "Workflow run resumed" };
318
- } catch (error) {
319
- return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
320
- }
321
- }
322
- async function getWorkflowRunsHandler({
323
- mastra,
324
- workflowId,
325
- fromDate,
326
- toDate,
327
- limit,
328
- offset,
329
- resourceId
330
- }) {
331
- try {
332
- if (!workflowId) {
333
- throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
334
- }
335
- const workflow = mastra.getWorkflow(workflowId);
336
- const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
337
- runs: [],
338
- total: 0
339
- };
340
- return workflowRuns;
341
- } catch (error) {
342
- return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
343
- }
344
- }
345
-
346
- exports.createWorkflowRunHandler = createWorkflowRunHandler;
347
- exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
348
- exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
349
- exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
350
- exports.getWorkflowsHandler = getWorkflowsHandler;
351
- exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
352
- exports.resumeWorkflowHandler = resumeWorkflowHandler;
353
- exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
354
- exports.startWorkflowRunHandler = startWorkflowRunHandler;
355
- exports.streamWorkflowHandler = streamWorkflowHandler;
356
- exports.watchWorkflowHandler = watchWorkflowHandler;
357
- exports.workflows_exports = workflows_exports;
@@ -1,11 +0,0 @@
1
- import { HTTPException } from './chunk-NYN7KFXL.js';
2
-
3
- // src/server/handlers/error.ts
4
- function handleError(error, defaultMessage) {
5
- const apiError = error;
6
- throw new HTTPException(apiError.status || 500, {
7
- message: apiError.message || defaultMessage
8
- });
9
- }
10
-
11
- export { handleError };