@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.
Files changed (234) hide show
  1. package/LICENSE.md +11 -42
  2. package/dist/{chunk-5SN4U5AC.cjs → chunk-3THIIWWW.cjs} +113 -137
  3. package/dist/chunk-3THIIWWW.cjs.map +1 -0
  4. package/dist/{chunk-57CJTIPW.cjs → chunk-4QSNRCOT.cjs} +4 -2
  5. package/dist/chunk-4QSNRCOT.cjs.map +1 -0
  6. package/dist/{chunk-P6SCPDYW.js → chunk-5QUKZCEF.js} +112 -136
  7. package/dist/chunk-5QUKZCEF.js.map +1 -0
  8. package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
  9. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  10. package/dist/chunk-7QEJ5QG5.js +151 -0
  11. package/dist/chunk-7QEJ5QG5.js.map +1 -0
  12. package/dist/{chunk-ZE5AAC4I.cjs → chunk-A3FNPSBB.cjs} +36 -39
  13. package/dist/chunk-A3FNPSBB.cjs.map +1 -0
  14. package/dist/{chunk-MHKNLNAN.cjs → chunk-B2L53BNJ.cjs} +14 -9
  15. package/dist/chunk-B2L53BNJ.cjs.map +1 -0
  16. package/dist/{chunk-C7564HUT.js → chunk-B43YAQJR.js} +6 -4
  17. package/dist/chunk-B43YAQJR.js.map +1 -0
  18. package/dist/{chunk-TJKLBTFB.js → chunk-BUMPRH7R.js} +23 -26
  19. package/dist/chunk-BUMPRH7R.js.map +1 -0
  20. package/dist/chunk-CY4TP3FK.js +16 -0
  21. package/dist/chunk-CY4TP3FK.js.map +1 -0
  22. package/dist/chunk-D32MNBNS.js +17597 -0
  23. package/dist/chunk-D32MNBNS.js.map +1 -0
  24. package/dist/chunk-EMMSS5I5.cjs +37 -0
  25. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  26. package/dist/chunk-G3PMV62Z.js +33 -0
  27. package/dist/chunk-G3PMV62Z.js.map +1 -0
  28. package/dist/chunk-GU4EWMZB.cjs +769 -0
  29. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  30. package/dist/chunk-GUI3CROV.cjs +159 -0
  31. package/dist/chunk-GUI3CROV.cjs.map +1 -0
  32. package/dist/chunk-ID37OH5Z.js +517 -0
  33. package/dist/chunk-ID37OH5Z.js.map +1 -0
  34. package/dist/{chunk-VPNDC2DI.cjs → chunk-JGD42NME.cjs} +16 -14
  35. package/dist/chunk-JGD42NME.cjs.map +1 -0
  36. package/dist/chunk-JPY7GWFC.cjs +17614 -0
  37. package/dist/chunk-JPY7GWFC.cjs.map +1 -0
  38. package/dist/chunk-KLCYAQBL.cjs +120 -0
  39. package/dist/chunk-KLCYAQBL.cjs.map +1 -0
  40. package/dist/chunk-KNGXRN26.cjs +335 -0
  41. package/dist/chunk-KNGXRN26.cjs.map +1 -0
  42. package/dist/chunk-L265APUD.cjs +69 -0
  43. package/dist/chunk-L265APUD.cjs.map +1 -0
  44. package/dist/chunk-LF2ZLOFP.js +767 -0
  45. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  46. package/dist/chunk-LUPY3MQY.js +571 -0
  47. package/dist/chunk-LUPY3MQY.js.map +1 -0
  48. package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
  49. package/dist/chunk-MMROOK5J.js.map +1 -0
  50. package/dist/chunk-NPE3X7FQ.cjs +88 -0
  51. package/dist/chunk-NPE3X7FQ.cjs.map +1 -0
  52. package/dist/{chunk-H5PTF3Y4.js → chunk-OW4FX5TS.js} +3 -1
  53. package/dist/chunk-OW4FX5TS.js.map +1 -0
  54. package/dist/{chunk-OR3CIE2H.js → chunk-PHZHWQZP.js} +10 -5
  55. package/dist/chunk-PHZHWQZP.js.map +1 -0
  56. package/dist/{chunk-HFWCEP5S.js → chunk-QBWF6U7Z.js} +36 -11
  57. package/dist/chunk-QBWF6U7Z.js.map +1 -0
  58. package/dist/chunk-R7NOGUZG.js +65 -0
  59. package/dist/chunk-R7NOGUZG.js.map +1 -0
  60. package/dist/chunk-RE4RPXT2.cjs +18 -0
  61. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  62. package/dist/chunk-ROA7BCHD.js +83 -0
  63. package/dist/chunk-ROA7BCHD.js.map +1 -0
  64. package/dist/{chunk-BNEY4P4P.cjs → chunk-T3TIA3O6.cjs} +20 -18
  65. package/dist/chunk-T3TIA3O6.cjs.map +1 -0
  66. package/dist/{chunk-EJO45KYT.js → chunk-TTHEEIZ3.js} +53 -50
  67. package/dist/chunk-TTHEEIZ3.js.map +1 -0
  68. package/dist/chunk-UVKXRPMV.cjs +588 -0
  69. package/dist/chunk-UVKXRPMV.cjs.map +1 -0
  70. package/dist/chunk-V5EWBGBF.cjs +534 -0
  71. package/dist/chunk-V5EWBGBF.cjs.map +1 -0
  72. package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
  73. package/dist/chunk-WHN4VX55.js.map +1 -0
  74. package/dist/index.cjs +2 -0
  75. package/dist/index.cjs.map +1 -0
  76. package/dist/index.d.ts +1 -0
  77. package/dist/index.d.ts.map +1 -0
  78. package/dist/index.js +2 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/server/a2a/protocol.d.ts +8 -0
  81. package/dist/server/a2a/protocol.d.ts.map +1 -0
  82. package/dist/server/a2a/store.cjs +25 -0
  83. package/dist/server/a2a/store.cjs.map +1 -0
  84. package/dist/server/a2a/store.d.ts +14 -0
  85. package/dist/server/a2a/store.d.ts.map +1 -0
  86. package/dist/server/a2a/store.js +23 -0
  87. package/dist/server/a2a/store.js.map +1 -0
  88. package/dist/server/a2a/tasks.d.ts +20 -0
  89. package/dist/server/a2a/tasks.d.ts.map +1 -0
  90. package/dist/server/handlers/a2a.cjs +13 -11
  91. package/dist/server/handlers/a2a.cjs.map +1 -0
  92. package/dist/server/handlers/a2a.d.ts +68 -6
  93. package/dist/server/handlers/a2a.d.ts.map +1 -0
  94. package/dist/server/handlers/a2a.js +3 -1
  95. package/dist/server/handlers/a2a.js.map +1 -0
  96. package/dist/server/handlers/agents.cjs +29 -7
  97. package/dist/server/handlers/agents.cjs.map +1 -0
  98. package/dist/server/handlers/agents.d.ts +111 -6
  99. package/dist/server/handlers/agents.d.ts.map +1 -0
  100. package/dist/server/handlers/agents.js +3 -1
  101. package/dist/server/handlers/agents.js.map +1 -0
  102. package/dist/server/handlers/error.cjs +4 -2
  103. package/dist/server/handlers/error.cjs.map +1 -0
  104. package/dist/server/handlers/error.d.ts +2 -1
  105. package/dist/server/handlers/error.d.ts.map +1 -0
  106. package/dist/server/handlers/error.js +3 -1
  107. package/dist/server/handlers/error.js.map +1 -0
  108. package/dist/server/handlers/legacyWorkflows.cjs +48 -0
  109. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  110. package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
  111. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  112. package/dist/server/handlers/legacyWorkflows.js +3 -0
  113. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  114. package/dist/server/handlers/logs.cjs +6 -4
  115. package/dist/server/handlers/logs.cjs.map +1 -0
  116. package/dist/server/handlers/logs.d.ts +34 -3
  117. package/dist/server/handlers/logs.d.ts.map +1 -0
  118. package/dist/server/handlers/logs.js +3 -1
  119. package/dist/server/handlers/logs.js.map +1 -0
  120. package/dist/server/handlers/memory.cjs +39 -9
  121. package/dist/server/handlers/memory.cjs.map +1 -0
  122. package/dist/server/handlers/memory.d.ts +118 -8
  123. package/dist/server/handlers/memory.d.ts.map +1 -0
  124. package/dist/server/handlers/memory.js +3 -1
  125. package/dist/server/handlers/memory.js.map +1 -0
  126. package/dist/server/handlers/network.cjs +7 -5
  127. package/dist/server/handlers/network.cjs.map +1 -0
  128. package/dist/server/handlers/network.d.ts +50 -4
  129. package/dist/server/handlers/network.d.ts.map +1 -0
  130. package/dist/server/handlers/network.js +3 -1
  131. package/dist/server/handlers/network.js.map +1 -0
  132. package/dist/server/handlers/observability.cjs +16 -0
  133. package/dist/server/handlers/observability.cjs.map +1 -0
  134. package/dist/server/handlers/observability.d.ts +23 -0
  135. package/dist/server/handlers/observability.d.ts.map +1 -0
  136. package/dist/server/handlers/observability.js +3 -0
  137. package/dist/server/handlers/observability.js.map +1 -0
  138. package/dist/server/handlers/scores.cjs +32 -0
  139. package/dist/server/handlers/scores.cjs.map +1 -0
  140. package/dist/server/handlers/scores.d.ts +49 -0
  141. package/dist/server/handlers/scores.d.ts.map +1 -0
  142. package/dist/server/handlers/scores.js +3 -0
  143. package/dist/server/handlers/scores.js.map +1 -0
  144. package/dist/server/handlers/telemetry.cjs +5 -3
  145. package/dist/server/handlers/telemetry.cjs.map +1 -0
  146. package/dist/server/handlers/telemetry.d.ts +32 -2
  147. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  148. package/dist/server/handlers/telemetry.js +3 -1
  149. package/dist/server/handlers/telemetry.js.map +1 -0
  150. package/dist/server/handlers/tools.cjs +7 -5
  151. package/dist/server/handlers/tools.cjs.map +1 -0
  152. package/dist/server/handlers/tools.d.ts +21 -4
  153. package/dist/server/handlers/tools.d.ts.map +1 -0
  154. package/dist/server/handlers/tools.js +3 -1
  155. package/dist/server/handlers/tools.js.map +1 -0
  156. package/dist/server/handlers/utils.cjs +4 -2
  157. package/dist/server/handlers/utils.cjs.map +1 -0
  158. package/dist/server/handlers/utils.d.ts +2 -1
  159. package/dist/server/handlers/utils.d.ts.map +1 -0
  160. package/dist/server/handlers/utils.js +3 -1
  161. package/dist/server/handlers/utils.js.map +1 -0
  162. package/dist/server/handlers/vNextNetwork.cjs +220 -0
  163. package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
  164. package/dist/server/handlers/vNextNetwork.d.ts +179 -0
  165. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
  166. package/dist/server/handlers/vNextNetwork.js +213 -0
  167. package/dist/server/handlers/vNextNetwork.js.map +1 -0
  168. package/dist/server/handlers/vector.cjs +9 -7
  169. package/dist/server/handlers/vector.cjs.map +1 -0
  170. package/dist/server/handlers/vector.d.ts +51 -6
  171. package/dist/server/handlers/vector.d.ts.map +1 -0
  172. package/dist/server/handlers/vector.js +3 -1
  173. package/dist/server/handlers/vector.js.map +1 -0
  174. package/dist/server/handlers/voice.cjs +10 -4
  175. package/dist/server/handlers/voice.cjs.map +1 -0
  176. package/dist/server/handlers/voice.d.ts +39 -3
  177. package/dist/server/handlers/voice.d.ts.map +1 -0
  178. package/dist/server/handlers/voice.js +3 -1
  179. package/dist/server/handlers/voice.js.map +1 -0
  180. package/dist/server/handlers/workflows.cjs +35 -13
  181. package/dist/server/handlers/workflows.cjs.map +1 -0
  182. package/dist/server/handlers/workflows.d.ts +72 -10
  183. package/dist/server/handlers/workflows.d.ts.map +1 -0
  184. package/dist/server/handlers/workflows.js +3 -1
  185. package/dist/server/handlers/workflows.js.map +1 -0
  186. package/dist/server/handlers.cjs +45 -33
  187. package/dist/server/handlers.cjs.map +1 -0
  188. package/dist/server/handlers.d.ts +14 -11
  189. package/dist/server/handlers.d.ts.map +1 -0
  190. package/dist/server/handlers.js +15 -11
  191. package/dist/server/handlers.js.map +1 -0
  192. package/dist/server/http-exception.d.ts +87 -0
  193. package/dist/server/http-exception.d.ts.map +1 -0
  194. package/dist/server/types.d.ts +10 -0
  195. package/dist/server/types.d.ts.map +1 -0
  196. package/dist/server/utils.d.ts +3 -0
  197. package/dist/server/utils.d.ts.map +1 -0
  198. package/package.json +39 -20
  199. package/dist/_tsup-dts-rollup.d.cts +0 -816
  200. package/dist/_tsup-dts-rollup.d.ts +0 -816
  201. package/dist/chunk-64U3UDTH.cjs +0 -13
  202. package/dist/chunk-75ZPJI57.cjs +0 -9
  203. package/dist/chunk-D4IRYCUI.cjs +0 -235
  204. package/dist/chunk-DJJIUEL2.js +0 -211
  205. package/dist/chunk-HWZVAG3H.js +0 -49
  206. package/dist/chunk-I2B73Y4I.cjs +0 -332
  207. package/dist/chunk-LIVAK2DM.js +0 -2001
  208. package/dist/chunk-M5ABIP7D.js +0 -11
  209. package/dist/chunk-MIQYDLLM.js +0 -329
  210. package/dist/chunk-MLKGABMK.js +0 -7
  211. package/dist/chunk-OGCNNUHF.cjs +0 -54
  212. package/dist/chunk-UCTEMO2Q.cjs +0 -341
  213. package/dist/chunk-WUC6LSTW.js +0 -227
  214. package/dist/chunk-Y7UWRW5X.cjs +0 -221
  215. package/dist/chunk-YBVOQN4M.cjs +0 -94
  216. package/dist/chunk-YWLUOY3D.cjs +0 -2004
  217. package/dist/index.d.cts +0 -1
  218. package/dist/server/handlers/a2a.d.cts +0 -6
  219. package/dist/server/handlers/agents.d.cts +0 -6
  220. package/dist/server/handlers/error.d.cts +0 -1
  221. package/dist/server/handlers/logs.d.cts +0 -3
  222. package/dist/server/handlers/memory.d.cts +0 -8
  223. package/dist/server/handlers/network.d.cts +0 -4
  224. package/dist/server/handlers/telemetry.d.cts +0 -2
  225. package/dist/server/handlers/tools.d.cts +0 -4
  226. package/dist/server/handlers/utils.d.cts +0 -1
  227. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  228. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  229. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  230. package/dist/server/handlers/vNextWorkflows.js +0 -1
  231. package/dist/server/handlers/vector.d.cts +0 -6
  232. package/dist/server/handlers/voice.d.cts +0 -3
  233. package/dist/server/handlers/workflows.d.cts +0 -10
  234. package/dist/server/handlers.d.cts +0 -11
@@ -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 };
@@ -1,329 +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
- 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,7 +0,0 @@
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
- export { __export };
@@ -1,54 +0,0 @@
1
- 'use strict';
2
-
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
-
7
- // src/server/handlers/logs.ts
8
- var logs_exports = {};
9
- chunk75ZPJI57_cjs.__export(logs_exports, {
10
- getLogTransports: () => getLogTransports,
11
- getLogsByRunIdHandler: () => getLogsByRunIdHandler,
12
- getLogsHandler: () => getLogsHandler
13
- });
14
- async function getLogsHandler({
15
- mastra,
16
- transportId
17
- }) {
18
- try {
19
- chunk57CJTIPW_cjs.validateBody({ transportId });
20
- const logs = await mastra.getLogs(transportId);
21
- return logs;
22
- } catch (error) {
23
- return chunk64U3UDTH_cjs.handleError(error, "Error getting logs");
24
- }
25
- }
26
- async function getLogsByRunIdHandler({
27
- mastra,
28
- runId,
29
- transportId
30
- }) {
31
- try {
32
- chunk57CJTIPW_cjs.validateBody({ runId, transportId });
33
- const logs = await mastra.getLogsByRunId({ runId, transportId });
34
- return logs;
35
- } catch (error) {
36
- return chunk64U3UDTH_cjs.handleError(error, "Error getting logs by run ID");
37
- }
38
- }
39
- async function getLogTransports({ mastra }) {
40
- try {
41
- const logger = mastra.getLogger();
42
- const transports = logger.transports;
43
- return {
44
- transports: transports ? Object.keys(transports) : []
45
- };
46
- } catch (error) {
47
- return chunk64U3UDTH_cjs.handleError(error, "Error getting log Transports");
48
- }
49
- }
50
-
51
- exports.getLogTransports = getLogTransports;
52
- exports.getLogsByRunIdHandler = getLogsByRunIdHandler;
53
- exports.getLogsHandler = getLogsHandler;
54
- exports.logs_exports = logs_exports;