@mastra/server 0.0.0-separate-trace-data-from-component-20250501042644 → 0.0.0-share-agent-metadata-with-cloud-20250718110128

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 (97) hide show
  1. package/LICENSE.md +11 -42
  2. package/README.md +48 -135
  3. package/dist/_tsup-dts-rollup.d.cts +556 -103
  4. package/dist/_tsup-dts-rollup.d.ts +556 -103
  5. package/dist/{chunk-FV45V6WC.cjs → chunk-2KZFMI6P.cjs} +1 -7
  6. package/dist/{chunk-5YGDYMRB.cjs → chunk-2SLFAFTR.cjs} +14 -13
  7. package/dist/chunk-3CNDE7QY.cjs +308 -0
  8. package/dist/chunk-4D66QEKC.js +81 -0
  9. package/dist/{chunk-M3YJLWTU.js → chunk-5PQQ42EZ.js} +68 -57
  10. package/dist/chunk-75ZPJI57.cjs +9 -0
  11. package/dist/{chunk-M56ECCHK.cjs → chunk-7TP2LX5L.cjs} +20 -19
  12. package/dist/chunk-B2PAS2IB.cjs +514 -0
  13. package/dist/{chunk-Y3SV5XK4.js → chunk-BK4XT6EG.js} +105 -16
  14. package/dist/{chunk-QN4KF3BH.cjs → chunk-CCGRCYWJ.cjs} +2 -2
  15. package/dist/{chunk-QJ3AHN64.js → chunk-CRCR3ZUK.js} +4 -3
  16. package/dist/{chunk-D3G23FP3.cjs → chunk-FRVBFMO2.cjs} +24 -22
  17. package/dist/{chunk-7IWQE76Z.cjs → chunk-G7KH752Y.cjs} +16 -10
  18. package/dist/chunk-GHC4YV6R.js +504 -0
  19. package/dist/chunk-H7DMHBKY.js +498 -0
  20. package/dist/chunk-JMLYCXMK.cjs +332 -0
  21. package/dist/{chunk-Q6SHQECN.js → chunk-KHZKYUNR.js} +34 -10
  22. package/dist/{chunk-RBQASTUP.js → chunk-KOHWJYJT.js} +120 -27
  23. package/dist/{chunk-TRDNDNGQ.js → chunk-LCM566I4.js} +2 -7
  24. package/dist/chunk-LF7P5PLR.js +14 -0
  25. package/dist/chunk-LI436ITD.cjs +2042 -0
  26. package/dist/{chunk-5JNVY6DU.js → chunk-LRCAAFUA.js} +7 -5
  27. package/dist/chunk-LZ3VJXSO.cjs +278 -0
  28. package/dist/chunk-MEGCYGBU.js +2039 -0
  29. package/dist/chunk-MLKGABMK.js +7 -0
  30. package/dist/chunk-PZQDCRPV.cjs +16 -0
  31. package/dist/chunk-QGX47B5D.cjs +86 -0
  32. package/dist/{chunk-WTHDCRMY.js → chunk-RG473F6Y.js} +12 -6
  33. package/dist/chunk-RHSWAXKB.cjs +118 -0
  34. package/dist/{chunk-L7XE5QTW.js → chunk-RSEO4XPX.js} +1 -1
  35. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  36. package/dist/{chunk-4JINXASC.js → chunk-WNVFNNWN.js} +5 -4
  37. package/dist/server/handlers/a2a.cjs +30 -0
  38. package/dist/server/handlers/a2a.d.cts +6 -0
  39. package/dist/server/handlers/a2a.d.ts +6 -0
  40. package/dist/server/handlers/a2a.js +1 -0
  41. package/dist/server/handlers/agents.cjs +7 -7
  42. package/dist/server/handlers/agents.js +1 -1
  43. package/dist/server/handlers/error.cjs +2 -2
  44. package/dist/server/handlers/error.js +1 -1
  45. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  46. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  47. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  48. package/dist/server/handlers/legacyWorkflows.js +1 -0
  49. package/dist/server/handlers/logs.cjs +4 -4
  50. package/dist/server/handlers/logs.js +1 -1
  51. package/dist/server/handlers/memory.cjs +17 -9
  52. package/dist/server/handlers/memory.d.cts +2 -0
  53. package/dist/server/handlers/memory.d.ts +2 -0
  54. package/dist/server/handlers/memory.js +1 -1
  55. package/dist/server/handlers/network.cjs +5 -5
  56. package/dist/server/handlers/network.js +1 -1
  57. package/dist/server/handlers/telemetry.cjs +3 -3
  58. package/dist/server/handlers/telemetry.js +1 -1
  59. package/dist/server/handlers/tools.cjs +5 -5
  60. package/dist/server/handlers/tools.js +1 -1
  61. package/dist/server/handlers/utils.cjs +2 -2
  62. package/dist/server/handlers/utils.js +1 -1
  63. package/dist/server/handlers/vNextNetwork.cjs +218 -0
  64. package/dist/server/handlers/vNextNetwork.d.cts +6 -0
  65. package/dist/server/handlers/vNextNetwork.d.ts +6 -0
  66. package/dist/server/handlers/vNextNetwork.js +211 -0
  67. package/dist/server/handlers/vector.cjs +7 -7
  68. package/dist/server/handlers/vector.js +1 -1
  69. package/dist/server/handlers/voice.cjs +8 -4
  70. package/dist/server/handlers/voice.d.cts +1 -0
  71. package/dist/server/handlers/voice.d.ts +1 -0
  72. package/dist/server/handlers/voice.js +1 -1
  73. package/dist/server/handlers/workflows.cjs +29 -13
  74. package/dist/server/handlers/workflows.d.cts +6 -2
  75. package/dist/server/handlers/workflows.d.ts +6 -2
  76. package/dist/server/handlers/workflows.js +1 -1
  77. package/dist/server/handlers.cjs +32 -27
  78. package/dist/server/handlers.d.cts +2 -1
  79. package/dist/server/handlers.d.ts +2 -1
  80. package/dist/server/handlers.js +11 -10
  81. package/package.json +15 -14
  82. package/dist/chunk-2FJURXCL.cjs +0 -213
  83. package/dist/chunk-3AHQ5RGN.js +0 -11
  84. package/dist/chunk-3EJZQ6TQ.js +0 -49
  85. package/dist/chunk-4BIX6GMY.cjs +0 -189
  86. package/dist/chunk-55HTWX4C.cjs +0 -93
  87. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  88. package/dist/chunk-AELYAUEE.cjs +0 -316
  89. package/dist/chunk-EVCC233P.cjs +0 -321
  90. package/dist/chunk-JPB6RPGB.js +0 -304
  91. package/dist/chunk-OMN3UI6X.js +0 -5576
  92. package/dist/chunk-SKBVVI24.cjs +0 -54
  93. package/dist/chunk-ZLBRQFDD.cjs +0 -13
  94. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  95. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  96. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  97. package/dist/server/handlers/vNextWorkflows.js +0 -1
@@ -1,304 +0,0 @@
1
- import { stringify, esm_default } from './chunk-OMN3UI6X.js';
2
- import { handleError } from './chunk-3AHQ5RGN.js';
3
- import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
4
- import { ReadableStream } from 'node:stream/web';
5
-
6
- // src/server/handlers/vNextWorkflows.ts
7
- var vNextWorkflows_exports = {};
8
- __export(vNextWorkflows_exports, {
9
- createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
10
- getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
11
- getVNextWorkflowRunHandler: () => getVNextWorkflowRunHandler,
12
- getVNextWorkflowRunsHandler: () => getVNextWorkflowRunsHandler,
13
- getVNextWorkflowsHandler: () => getVNextWorkflowsHandler,
14
- resumeAsyncVNextWorkflowHandler: () => resumeAsyncVNextWorkflowHandler,
15
- resumeVNextWorkflowHandler: () => resumeVNextWorkflowHandler,
16
- startAsyncVNextWorkflowHandler: () => startAsyncVNextWorkflowHandler,
17
- startVNextWorkflowRunHandler: () => startVNextWorkflowRunHandler,
18
- watchVNextWorkflowHandler: () => watchVNextWorkflowHandler
19
- });
20
- async function getVNextWorkflowsHandler({ mastra }) {
21
- try {
22
- const workflows = mastra.vnext_getWorkflows({ serialized: false });
23
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
24
- acc[key] = {
25
- name: workflow.name,
26
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
27
- acc2[key2] = {
28
- id: step.id,
29
- description: step.description,
30
- inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
31
- outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
32
- resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
33
- suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
34
- };
35
- return acc2;
36
- }, {}),
37
- stepGraph: workflow.serializedStepGraph,
38
- inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
39
- outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
40
- };
41
- return acc;
42
- }, {});
43
- return _workflows;
44
- } catch (error) {
45
- throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
46
- }
47
- }
48
- async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
49
- try {
50
- if (!workflowId) {
51
- throw new HTTPException(400, { message: "Workflow ID is required" });
52
- }
53
- const workflow = mastra.vnext_getWorkflow(workflowId);
54
- if (!workflow) {
55
- throw new HTTPException(404, { message: "Workflow not found" });
56
- }
57
- return {
58
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
59
- acc[key] = {
60
- id: step.id,
61
- description: step.description,
62
- inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
63
- outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
64
- resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
65
- suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
66
- };
67
- return acc;
68
- }, {}),
69
- name: workflow.name,
70
- stepGraph: workflow.serializedStepGraph,
71
- inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
72
- outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
73
- };
74
- } catch (error) {
75
- throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
76
- }
77
- }
78
- async function getVNextWorkflowRunHandler({
79
- mastra,
80
- workflowId,
81
- runId
82
- }) {
83
- try {
84
- if (!workflowId) {
85
- throw new HTTPException(400, { message: "Workflow ID is required" });
86
- }
87
- if (!runId) {
88
- throw new HTTPException(400, { message: "Run ID is required" });
89
- }
90
- const workflow = mastra.vnext_getWorkflow(workflowId);
91
- if (!workflow) {
92
- throw new HTTPException(404, { message: "Workflow not found" });
93
- }
94
- const run = await workflow.getWorkflowRun(runId);
95
- if (!run) {
96
- throw new HTTPException(404, { message: "Workflow run not found" });
97
- }
98
- return run;
99
- } catch (error) {
100
- throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
101
- }
102
- }
103
- async function createVNextWorkflowRunHandler({
104
- mastra,
105
- workflowId,
106
- runId: prevRunId
107
- }) {
108
- try {
109
- if (!workflowId) {
110
- throw new HTTPException(400, { message: "Workflow ID is required" });
111
- }
112
- const workflow = mastra.vnext_getWorkflow(workflowId);
113
- if (!workflow) {
114
- throw new HTTPException(404, { message: "Workflow not found" });
115
- }
116
- const run = workflow.createRun({ runId: prevRunId });
117
- return { runId: run.runId };
118
- } catch (error) {
119
- throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
120
- }
121
- }
122
- async function startAsyncVNextWorkflowHandler({
123
- mastra,
124
- runtimeContext,
125
- workflowId,
126
- runId,
127
- inputData
128
- }) {
129
- try {
130
- if (!workflowId) {
131
- throw new HTTPException(400, { message: "Workflow ID is required" });
132
- }
133
- const workflow = mastra.vnext_getWorkflow(workflowId);
134
- if (!workflow) {
135
- throw new HTTPException(404, { message: "Workflow not found" });
136
- }
137
- const _run = workflow.createRun({ runId });
138
- const result = await _run.start({
139
- inputData,
140
- runtimeContext
141
- });
142
- return result;
143
- } catch (error) {
144
- throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
145
- }
146
- }
147
- async function startVNextWorkflowRunHandler({
148
- mastra,
149
- runtimeContext,
150
- workflowId,
151
- runId,
152
- inputData
153
- }) {
154
- try {
155
- if (!workflowId) {
156
- throw new HTTPException(400, { message: "Workflow ID is required" });
157
- }
158
- if (!runId) {
159
- throw new HTTPException(400, { message: "runId required to start run" });
160
- }
161
- const workflow = mastra.vnext_getWorkflow(workflowId);
162
- const run = await workflow.getWorkflowRun(runId);
163
- if (!run) {
164
- throw new HTTPException(404, { message: "Workflow run not found" });
165
- }
166
- const _run = workflow.createRun({ runId });
167
- await _run.start({
168
- inputData,
169
- runtimeContext
170
- });
171
- return { message: "Workflow run started" };
172
- } catch (e) {
173
- return handleError(e, "Error starting workflow run");
174
- }
175
- }
176
- async function watchVNextWorkflowHandler({
177
- mastra,
178
- workflowId,
179
- runId
180
- }) {
181
- try {
182
- if (!workflowId) {
183
- throw new HTTPException(400, { message: "Workflow ID is required" });
184
- }
185
- if (!runId) {
186
- throw new HTTPException(400, { message: "runId required to watch workflow" });
187
- }
188
- const workflow = mastra.vnext_getWorkflow(workflowId);
189
- const run = await workflow.getWorkflowRun(runId);
190
- if (!run) {
191
- throw new HTTPException(404, { message: "Workflow run not found" });
192
- }
193
- const _run = workflow.createRun({ runId });
194
- let unwatch;
195
- let asyncRef = null;
196
- const stream = new ReadableStream({
197
- start(controller) {
198
- unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
199
- controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
200
- if (asyncRef) {
201
- clearImmediate(asyncRef);
202
- asyncRef = null;
203
- }
204
- asyncRef = setImmediate(async () => {
205
- const runDone = payload.workflowState.status !== "running";
206
- if (runDone) {
207
- controller.close();
208
- unwatch?.();
209
- }
210
- });
211
- });
212
- },
213
- cancel() {
214
- unwatch?.();
215
- }
216
- });
217
- return stream;
218
- } catch (error) {
219
- return handleError(error, "Error watching workflow");
220
- }
221
- }
222
- async function resumeAsyncVNextWorkflowHandler({
223
- mastra,
224
- workflowId,
225
- runId,
226
- body,
227
- runtimeContext
228
- }) {
229
- try {
230
- if (!workflowId) {
231
- throw new HTTPException(400, { message: "Workflow ID is required" });
232
- }
233
- if (!runId) {
234
- throw new HTTPException(400, { message: "runId required to resume workflow" });
235
- }
236
- if (!body.step) {
237
- throw new HTTPException(400, { message: "step required to resume workflow" });
238
- }
239
- const workflow = mastra.vnext_getWorkflow(workflowId);
240
- const run = await workflow.getWorkflowRun(runId);
241
- if (!run) {
242
- throw new HTTPException(404, { message: "Workflow run not found" });
243
- }
244
- const _run = workflow.createRun({ runId });
245
- const result = await _run.resume({
246
- step: body.step,
247
- resumeData: body.resumeData,
248
- runtimeContext
249
- });
250
- return result;
251
- } catch (error) {
252
- return handleError(error, "Error resuming workflow step");
253
- }
254
- }
255
- async function resumeVNextWorkflowHandler({
256
- mastra,
257
- workflowId,
258
- runId,
259
- body,
260
- runtimeContext
261
- }) {
262
- try {
263
- if (!workflowId) {
264
- throw new HTTPException(400, { message: "Workflow ID is required" });
265
- }
266
- if (!runId) {
267
- throw new HTTPException(400, { message: "runId required to resume workflow" });
268
- }
269
- if (!body.step) {
270
- throw new HTTPException(400, { message: "step required to resume workflow" });
271
- }
272
- const workflow = mastra.vnext_getWorkflow(workflowId);
273
- const run = await workflow.getWorkflowRun(runId);
274
- if (!run) {
275
- throw new HTTPException(404, { message: "Workflow run not found" });
276
- }
277
- const _run = workflow.createRun({ runId });
278
- await _run.resume({
279
- step: body.step,
280
- resumeData: body.resumeData,
281
- runtimeContext
282
- });
283
- return { message: "Workflow run resumed" };
284
- } catch (error) {
285
- return handleError(error, "Error resuming workflow");
286
- }
287
- }
288
- async function getVNextWorkflowRunsHandler({ mastra, workflowId }) {
289
- try {
290
- if (!workflowId) {
291
- throw new HTTPException(400, { message: "Workflow ID is required" });
292
- }
293
- const workflow = mastra.vnext_getWorkflow(workflowId);
294
- const workflowRuns = await workflow.getWorkflowRuns() || {
295
- runs: [],
296
- total: 0
297
- };
298
- return workflowRuns;
299
- } catch (error) {
300
- return handleError(error, "Error getting workflow runs");
301
- }
302
- }
303
-
304
- export { createVNextWorkflowRunHandler, getVNextWorkflowByIdHandler, getVNextWorkflowRunHandler, getVNextWorkflowRunsHandler, getVNextWorkflowsHandler, resumeAsyncVNextWorkflowHandler, resumeVNextWorkflowHandler, startAsyncVNextWorkflowHandler, startVNextWorkflowRunHandler, vNextWorkflows_exports, watchVNextWorkflowHandler };