@mastra/server 0.0.0-llamaindex-switch-core-20250424001624 → 0.0.0-main-test-20251105183450

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 (263) hide show
  1. package/CHANGELOG.md +4494 -0
  2. package/LICENSE.md +11 -42
  3. package/README.md +45 -137
  4. package/dist/chunk-2PLXW4ZX.cjs +2777 -0
  5. package/dist/chunk-2PLXW4ZX.cjs.map +1 -0
  6. package/dist/chunk-46Z2KDQL.js +124 -0
  7. package/dist/chunk-46Z2KDQL.js.map +1 -0
  8. package/dist/{chunk-FV45V6WC.cjs → chunk-64ITUOXI.cjs} +3 -7
  9. package/dist/chunk-64ITUOXI.cjs.map +1 -0
  10. package/dist/{chunk-TRDNDNGQ.js → chunk-6QWQZI4Q.js} +4 -7
  11. package/dist/chunk-6QWQZI4Q.js.map +1 -0
  12. package/dist/chunk-73PAWDM5.js +83 -0
  13. package/dist/chunk-73PAWDM5.js.map +1 -0
  14. package/dist/chunk-A5SOZY5R.js +502 -0
  15. package/dist/chunk-A5SOZY5R.js.map +1 -0
  16. package/dist/chunk-AEVI2HIU.cjs +651 -0
  17. package/dist/chunk-AEVI2HIU.cjs.map +1 -0
  18. package/dist/chunk-ALOLTNSO.js +477 -0
  19. package/dist/chunk-ALOLTNSO.js.map +1 -0
  20. package/dist/chunk-B6NK4KI5.cjs +128 -0
  21. package/dist/chunk-B6NK4KI5.cjs.map +1 -0
  22. package/dist/chunk-BANGX6SC.cjs +200 -0
  23. package/dist/chunk-BANGX6SC.cjs.map +1 -0
  24. package/dist/chunk-BHQH5QXD.cjs +172 -0
  25. package/dist/chunk-BHQH5QXD.cjs.map +1 -0
  26. package/dist/chunk-BTWIR2B7.cjs +28 -0
  27. package/dist/chunk-BTWIR2B7.cjs.map +1 -0
  28. package/dist/chunk-DNUO33HF.js +129 -0
  29. package/dist/chunk-DNUO33HF.js.map +1 -0
  30. package/dist/chunk-GTZOYEAU.cjs +130 -0
  31. package/dist/chunk-GTZOYEAU.cjs.map +1 -0
  32. package/dist/chunk-GU4EWMZB.cjs +769 -0
  33. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  34. package/dist/chunk-IGOWG5V5.js +192 -0
  35. package/dist/chunk-IGOWG5V5.js.map +1 -0
  36. package/dist/chunk-JO2AZFJN.js +165 -0
  37. package/dist/chunk-JO2AZFJN.js.map +1 -0
  38. package/dist/chunk-JZ65BJ6H.cjs +678 -0
  39. package/dist/chunk-JZ65BJ6H.cjs.map +1 -0
  40. package/dist/{chunk-4JINXASC.js → chunk-KWH5QBXP.js} +7 -4
  41. package/dist/chunk-KWH5QBXP.js.map +1 -0
  42. package/dist/chunk-LF2ZLOFP.js +767 -0
  43. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  44. package/dist/{chunk-Q6SHQECN.js → chunk-LPCK5MAF.js} +47 -13
  45. package/dist/chunk-LPCK5MAF.js.map +1 -0
  46. package/dist/chunk-LPM6BBAX.cjs +1043 -0
  47. package/dist/chunk-LPM6BBAX.cjs.map +1 -0
  48. package/dist/chunk-LWLSQ2W4.cjs +133 -0
  49. package/dist/chunk-LWLSQ2W4.cjs.map +1 -0
  50. package/dist/chunk-MMQIJZ2Q.cjs +23079 -0
  51. package/dist/chunk-MMQIJZ2Q.cjs.map +1 -0
  52. package/dist/chunk-O7I5CWRX.cjs +44 -0
  53. package/dist/chunk-O7I5CWRX.cjs.map +1 -0
  54. package/dist/chunk-PPMIB3FQ.cjs +88 -0
  55. package/dist/chunk-PPMIB3FQ.cjs.map +1 -0
  56. package/dist/chunk-PR4QN5HX.js +39 -0
  57. package/dist/chunk-PR4QN5HX.js.map +1 -0
  58. package/dist/chunk-QU6N55W6.cjs +256 -0
  59. package/dist/chunk-QU6N55W6.cjs.map +1 -0
  60. package/dist/chunk-R6OQFR47.js +630 -0
  61. package/dist/chunk-R6OQFR47.js.map +1 -0
  62. package/dist/chunk-RQK4FQUD.js +1012 -0
  63. package/dist/chunk-RQK4FQUD.js.map +1 -0
  64. package/dist/{chunk-M56ECCHK.cjs → chunk-S54HNARD.cjs} +22 -19
  65. package/dist/chunk-S54HNARD.cjs.map +1 -0
  66. package/dist/chunk-SHWNNZBL.js +254 -0
  67. package/dist/chunk-SHWNNZBL.js.map +1 -0
  68. package/dist/chunk-SIPNICB3.cjs +517 -0
  69. package/dist/chunk-SIPNICB3.cjs.map +1 -0
  70. package/dist/{chunk-L7XE5QTW.js → chunk-SZIFSF4T.js} +11 -2
  71. package/dist/chunk-SZIFSF4T.js.map +1 -0
  72. package/dist/chunk-TOCYBDP2.js +46 -0
  73. package/dist/chunk-TOCYBDP2.js.map +1 -0
  74. package/dist/chunk-UU7MMOP5.js +23039 -0
  75. package/dist/chunk-UU7MMOP5.js.map +1 -0
  76. package/dist/chunk-UXGQZUYZ.js +16 -0
  77. package/dist/chunk-UXGQZUYZ.js.map +1 -0
  78. package/dist/chunk-V5WWQN7P.cjs +18 -0
  79. package/dist/chunk-V5WWQN7P.cjs.map +1 -0
  80. package/dist/chunk-VYR3SAFM.js +658 -0
  81. package/dist/chunk-VYR3SAFM.js.map +1 -0
  82. package/dist/chunk-X6C7BUWN.cjs +48 -0
  83. package/dist/chunk-X6C7BUWN.cjs.map +1 -0
  84. package/dist/chunk-XXGID4PQ.cjs +485 -0
  85. package/dist/chunk-XXGID4PQ.cjs.map +1 -0
  86. package/dist/chunk-ZULZ2752.js +2774 -0
  87. package/dist/chunk-ZULZ2752.js.map +1 -0
  88. package/dist/dist-4MVGNSRL.cjs +1150 -0
  89. package/dist/dist-4MVGNSRL.cjs.map +1 -0
  90. package/dist/dist-FZYCV3VB.cjs +940 -0
  91. package/dist/dist-FZYCV3VB.cjs.map +1 -0
  92. package/dist/dist-G2BYZJOC.cjs +928 -0
  93. package/dist/dist-G2BYZJOC.cjs.map +1 -0
  94. package/dist/dist-P4MXBQ3U.cjs +16 -0
  95. package/dist/dist-P4MXBQ3U.cjs.map +1 -0
  96. package/dist/dist-PQZUVLPC.js +937 -0
  97. package/dist/dist-PQZUVLPC.js.map +1 -0
  98. package/dist/dist-R7WYX6LC.js +925 -0
  99. package/dist/dist-R7WYX6LC.js.map +1 -0
  100. package/dist/dist-RFMYFILX.cjs +764 -0
  101. package/dist/dist-RFMYFILX.cjs.map +1 -0
  102. package/dist/dist-X7XR3M3Z.js +1147 -0
  103. package/dist/dist-X7XR3M3Z.js.map +1 -0
  104. package/dist/dist-XVBSOGFK.js +761 -0
  105. package/dist/dist-XVBSOGFK.js.map +1 -0
  106. package/dist/dist-YREX2TJT.js +3 -0
  107. package/dist/dist-YREX2TJT.js.map +1 -0
  108. package/dist/index.cjs +6 -0
  109. package/dist/index.cjs.map +1 -0
  110. package/dist/index.d.ts +1 -0
  111. package/dist/index.d.ts.map +1 -0
  112. package/dist/index.js +5 -0
  113. package/dist/index.js.map +1 -0
  114. package/dist/server/a2a/protocol.d.ts +8 -0
  115. package/dist/server/a2a/protocol.d.ts.map +1 -0
  116. package/dist/server/a2a/store.cjs +25 -0
  117. package/dist/server/a2a/store.cjs.map +1 -0
  118. package/dist/server/a2a/store.d.ts +14 -0
  119. package/dist/server/a2a/store.d.ts.map +1 -0
  120. package/dist/server/a2a/store.js +23 -0
  121. package/dist/server/a2a/store.js.map +1 -0
  122. package/dist/server/a2a/tasks.d.ts +20 -0
  123. package/dist/server/a2a/tasks.d.ts.map +1 -0
  124. package/dist/server/handlers/a2a.cjs +32 -0
  125. package/dist/server/handlers/a2a.cjs.map +1 -0
  126. package/dist/server/handlers/a2a.d.ts +68 -0
  127. package/dist/server/handlers/a2a.d.ts.map +1 -0
  128. package/dist/server/handlers/a2a.js +3 -0
  129. package/dist/server/handlers/a2a.js.map +1 -0
  130. package/dist/server/handlers/agent-builder.cjs +84 -0
  131. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  132. package/dist/server/handlers/agent-builder.d.ts +91 -0
  133. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  134. package/dist/server/handlers/agent-builder.js +3 -0
  135. package/dist/server/handlers/agent-builder.js.map +1 -0
  136. package/dist/server/handlers/agents.cjs +60 -10
  137. package/dist/server/handlers/agents.cjs.map +1 -0
  138. package/dist/server/handlers/agents.d.ts +194 -6
  139. package/dist/server/handlers/agents.d.ts.map +1 -0
  140. package/dist/server/handlers/agents.js +3 -1
  141. package/dist/server/handlers/agents.js.map +1 -0
  142. package/dist/server/handlers/error.cjs +4 -2
  143. package/dist/server/handlers/error.cjs.map +1 -0
  144. package/dist/server/handlers/error.d.ts +2 -1
  145. package/dist/server/handlers/error.d.ts.map +1 -0
  146. package/dist/server/handlers/error.js +3 -1
  147. package/dist/server/handlers/error.js.map +1 -0
  148. package/dist/server/handlers/logs.cjs +9 -7
  149. package/dist/server/handlers/logs.cjs.map +1 -0
  150. package/dist/server/handlers/logs.d.ts +34 -3
  151. package/dist/server/handlers/logs.d.ts.map +1 -0
  152. package/dist/server/handlers/logs.js +3 -1
  153. package/dist/server/handlers/logs.js.map +1 -0
  154. package/dist/server/handlers/memory.cjs +34 -12
  155. package/dist/server/handlers/memory.cjs.map +1 -0
  156. package/dist/server/handlers/memory.d.ts +112 -8
  157. package/dist/server/handlers/memory.d.ts.map +1 -0
  158. package/dist/server/handlers/memory.js +3 -1
  159. package/dist/server/handlers/memory.js.map +1 -0
  160. package/dist/server/handlers/observability.cjs +24 -0
  161. package/dist/server/handlers/observability.cjs.map +1 -0
  162. package/dist/server/handlers/observability.d.ts +49 -0
  163. package/dist/server/handlers/observability.d.ts.map +1 -0
  164. package/dist/server/handlers/observability.js +3 -0
  165. package/dist/server/handlers/observability.js.map +1 -0
  166. package/dist/server/handlers/scores.cjs +32 -0
  167. package/dist/server/handlers/scores.cjs.map +1 -0
  168. package/dist/server/handlers/scores.d.ts +152 -0
  169. package/dist/server/handlers/scores.d.ts.map +1 -0
  170. package/dist/server/handlers/scores.js +3 -0
  171. package/dist/server/handlers/scores.js.map +1 -0
  172. package/dist/server/handlers/tools.cjs +12 -6
  173. package/dist/server/handlers/tools.cjs.map +1 -0
  174. package/dist/server/handlers/tools.d.ts +25 -4
  175. package/dist/server/handlers/tools.d.ts.map +1 -0
  176. package/dist/server/handlers/tools.js +3 -1
  177. package/dist/server/handlers/tools.js.map +1 -0
  178. package/dist/server/handlers/utils.cjs +8 -2
  179. package/dist/server/handlers/utils.cjs.map +1 -0
  180. package/dist/server/handlers/utils.d.ts +8 -1
  181. package/dist/server/handlers/utils.d.ts.map +1 -0
  182. package/dist/server/handlers/utils.js +3 -1
  183. package/dist/server/handlers/utils.js.map +1 -0
  184. package/dist/server/handlers/vector.cjs +9 -7
  185. package/dist/server/handlers/vector.cjs.map +1 -0
  186. package/dist/server/handlers/vector.d.ts +51 -6
  187. package/dist/server/handlers/vector.d.ts.map +1 -0
  188. package/dist/server/handlers/vector.js +3 -1
  189. package/dist/server/handlers/vector.js.map +1 -0
  190. package/dist/server/handlers/voice.cjs +10 -4
  191. package/dist/server/handlers/voice.cjs.map +1 -0
  192. package/dist/server/handlers/voice.d.ts +41 -3
  193. package/dist/server/handlers/voice.d.ts.map +1 -0
  194. package/dist/server/handlers/voice.js +3 -1
  195. package/dist/server/handlers/voice.js.map +1 -0
  196. package/dist/server/handlers/workflows.cjs +54 -16
  197. package/dist/server/handlers/workflows.cjs.map +1 -0
  198. package/dist/server/handlers/workflows.d.ts +94 -10
  199. package/dist/server/handlers/workflows.d.ts.map +1 -0
  200. package/dist/server/handlers/workflows.js +3 -1
  201. package/dist/server/handlers/workflows.js.map +1 -0
  202. package/dist/server/handlers.cjs +38 -26
  203. package/dist/server/handlers.cjs.map +1 -0
  204. package/dist/server/handlers.d.ts +12 -9
  205. package/dist/server/handlers.d.ts.map +1 -0
  206. package/dist/server/handlers.js +13 -9
  207. package/dist/server/handlers.js.map +1 -0
  208. package/dist/server/http-exception.d.ts +82 -0
  209. package/dist/server/http-exception.d.ts.map +1 -0
  210. package/dist/server/types.d.ts +10 -0
  211. package/dist/server/types.d.ts.map +1 -0
  212. package/dist/server/utils.d.ts +44 -0
  213. package/dist/server/utils.d.ts.map +1 -0
  214. package/dist/token-375W3LEI.cjs +64 -0
  215. package/dist/token-375W3LEI.cjs.map +1 -0
  216. package/dist/token-C3IMNCC4.js +62 -0
  217. package/dist/token-C3IMNCC4.js.map +1 -0
  218. package/dist/token-util-CV3RRG6K.cjs +9 -0
  219. package/dist/token-util-CV3RRG6K.cjs.map +1 -0
  220. package/dist/token-util-E5QO2RCL.js +7 -0
  221. package/dist/token-util-E5QO2RCL.js.map +1 -0
  222. package/package.json +46 -19
  223. package/dist/_tsup-dts-rollup.d.cts +0 -571
  224. package/dist/_tsup-dts-rollup.d.ts +0 -571
  225. package/dist/chunk-2FJURXCL.cjs +0 -213
  226. package/dist/chunk-3AHQ5RGN.js +0 -11
  227. package/dist/chunk-3EJZQ6TQ.js +0 -49
  228. package/dist/chunk-55HTWX4C.cjs +0 -93
  229. package/dist/chunk-5JNVY6DU.js +0 -120
  230. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  231. package/dist/chunk-7IWQE76Z.cjs +0 -139
  232. package/dist/chunk-D3G23FP3.cjs +0 -126
  233. package/dist/chunk-FPIWDH5Y.cjs +0 -126
  234. package/dist/chunk-HCOPJZ4A.cjs +0 -164
  235. package/dist/chunk-LFOBHRFO.js +0 -305
  236. package/dist/chunk-OMN3UI6X.js +0 -5576
  237. package/dist/chunk-QN4KF3BH.cjs +0 -18
  238. package/dist/chunk-R4J7XQYU.js +0 -156
  239. package/dist/chunk-RBQASTUP.js +0 -203
  240. package/dist/chunk-RE6YL32K.js +0 -120
  241. package/dist/chunk-SKBVVI24.cjs +0 -54
  242. package/dist/chunk-TZK63M5N.cjs +0 -317
  243. package/dist/chunk-WTHDCRMY.js +0 -135
  244. package/dist/chunk-ZLBRQFDD.cjs +0 -13
  245. package/dist/index.d.cts +0 -1
  246. package/dist/server/handlers/agents.d.cts +0 -6
  247. package/dist/server/handlers/error.d.cts +0 -1
  248. package/dist/server/handlers/logs.d.cts +0 -3
  249. package/dist/server/handlers/memory.d.cts +0 -8
  250. package/dist/server/handlers/network.cjs +0 -22
  251. package/dist/server/handlers/network.d.cts +0 -4
  252. package/dist/server/handlers/network.d.ts +0 -4
  253. package/dist/server/handlers/network.js +0 -1
  254. package/dist/server/handlers/telemetry.cjs +0 -14
  255. package/dist/server/handlers/telemetry.d.cts +0 -2
  256. package/dist/server/handlers/telemetry.d.ts +0 -2
  257. package/dist/server/handlers/telemetry.js +0 -1
  258. package/dist/server/handlers/tools.d.cts +0 -4
  259. package/dist/server/handlers/utils.d.cts +0 -1
  260. package/dist/server/handlers/vector.d.cts +0 -6
  261. package/dist/server/handlers/voice.d.cts +0 -3
  262. package/dist/server/handlers/workflows.d.cts +0 -10
  263. package/dist/server/handlers.d.cts +0 -9
@@ -1,317 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk5SWCVTNL_cjs = require('./chunk-5SWCVTNL.cjs');
4
- var chunkZLBRQFDD_cjs = require('./chunk-ZLBRQFDD.cjs');
5
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
6
- var web = require('stream/web');
7
-
8
- // src/server/handlers/workflows.ts
9
- var workflows_exports = {};
10
- chunkFV45V6WC_cjs.__export(workflows_exports, {
11
- createRunHandler: () => createRunHandler,
12
- getWorkflowByIdHandler: () => getWorkflowByIdHandler,
13
- getWorkflowRunHandler: () => getWorkflowRunHandler,
14
- getWorkflowRunsHandler: () => getWorkflowRunsHandler,
15
- getWorkflowsHandler: () => getWorkflowsHandler,
16
- resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
17
- resumeWorkflowHandler: () => resumeWorkflowHandler,
18
- startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
19
- startWorkflowRunHandler: () => startWorkflowRunHandler,
20
- watchWorkflowHandler: () => watchWorkflowHandler
21
- });
22
- async function getWorkflowsHandler({ mastra }) {
23
- try {
24
- const workflows = mastra.getWorkflows({ serialized: false });
25
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
26
- if (workflow.isNested) return acc;
27
- acc[key] = {
28
- stepGraph: workflow.stepGraph,
29
- stepSubscriberGraph: workflow.stepSubscriberGraph,
30
- serializedStepGraph: workflow.serializedStepGraph,
31
- serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
32
- name: workflow.name,
33
- triggerSchema: workflow.triggerSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.triggerSchema)) : void 0,
34
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
35
- const _step = step;
36
- acc2[key2] = {
37
- ..._step,
38
- inputSchema: _step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.inputSchema)) : void 0,
39
- outputSchema: _step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.outputSchema)) : void 0
40
- };
41
- return acc2;
42
- }, {})
43
- };
44
- return acc;
45
- }, {});
46
- return _workflows;
47
- } catch (error) {
48
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
49
- }
50
- }
51
- async function getWorkflowByIdHandler({ mastra, workflowId }) {
52
- try {
53
- if (!workflowId) {
54
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
55
- }
56
- const workflow = mastra.getWorkflow(workflowId);
57
- if (!workflow) {
58
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
59
- }
60
- return {
61
- stepGraph: workflow.stepGraph,
62
- stepSubscriberGraph: workflow.stepSubscriberGraph,
63
- serializedStepGraph: workflow.serializedStepGraph,
64
- serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
65
- name: workflow.name,
66
- triggerSchema: workflow.triggerSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(workflow.triggerSchema)) : void 0,
67
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
68
- const _step = step;
69
- acc[key] = {
70
- ..._step,
71
- inputSchema: _step.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.inputSchema)) : void 0,
72
- outputSchema: _step.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_step.outputSchema)) : void 0
73
- };
74
- return acc;
75
- }, {})
76
- };
77
- } catch (error) {
78
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
79
- }
80
- }
81
- async function startAsyncWorkflowHandler({
82
- mastra,
83
- runtimeContext,
84
- workflowId,
85
- runId,
86
- triggerData
87
- }) {
88
- try {
89
- if (!workflowId) {
90
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
91
- }
92
- const workflow = mastra.getWorkflow(workflowId);
93
- if (!workflow) {
94
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
95
- }
96
- if (!runId) {
97
- const { start } = workflow.createRun();
98
- const result2 = await start({
99
- triggerData,
100
- runtimeContext
101
- });
102
- return result2;
103
- }
104
- const run = workflow.getRun(runId);
105
- if (!run) {
106
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
107
- }
108
- const result = await run.start({
109
- triggerData,
110
- runtimeContext
111
- });
112
- return result;
113
- } catch (error) {
114
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
115
- }
116
- }
117
- async function getWorkflowRunHandler({
118
- mastra,
119
- workflowId,
120
- runId
121
- }) {
122
- try {
123
- if (!workflowId) {
124
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
125
- }
126
- if (!runId) {
127
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Run ID is required" });
128
- }
129
- const workflow = mastra.getWorkflow(workflowId);
130
- if (!workflow) {
131
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
132
- }
133
- const run = workflow.getRun(runId);
134
- if (!run) {
135
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
136
- }
137
- return run;
138
- } catch (error) {
139
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
140
- }
141
- }
142
- async function createRunHandler({
143
- mastra,
144
- workflowId,
145
- runId: prevRunId
146
- }) {
147
- try {
148
- if (!workflowId) {
149
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
150
- }
151
- const workflow = mastra.getWorkflow(workflowId);
152
- if (!workflow) {
153
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow not found" });
154
- }
155
- const { runId } = workflow.createRun({ runId: prevRunId });
156
- return { runId };
157
- } catch (error) {
158
- throw new chunkFV45V6WC_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
159
- }
160
- }
161
- async function startWorkflowRunHandler({
162
- mastra,
163
- runtimeContext,
164
- workflowId,
165
- runId,
166
- triggerData
167
- }) {
168
- try {
169
- if (!workflowId) {
170
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
171
- }
172
- if (!runId) {
173
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to start run" });
174
- }
175
- const workflow = mastra.getWorkflow(workflowId);
176
- const run = workflow.getRun(runId);
177
- if (!run) {
178
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
179
- }
180
- await run.start({
181
- triggerData,
182
- runtimeContext
183
- });
184
- return { message: "Workflow run started" };
185
- } catch (e) {
186
- return chunkZLBRQFDD_cjs.handleError(e, "Error starting workflow run");
187
- }
188
- }
189
- async function watchWorkflowHandler({
190
- mastra,
191
- workflowId,
192
- runId
193
- }) {
194
- try {
195
- if (!workflowId) {
196
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
197
- }
198
- if (!runId) {
199
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to watch workflow" });
200
- }
201
- const workflow = mastra.getWorkflow(workflowId);
202
- const run = workflow.getRun(runId);
203
- if (!run) {
204
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
205
- }
206
- let unwatch;
207
- let asyncRef = null;
208
- const stream = new web.ReadableStream({
209
- start(controller) {
210
- unwatch = run.watch(({ activePaths, runId: runId2, timestamp, results }) => {
211
- const activePathsObj = Object.fromEntries(activePaths);
212
- controller.enqueue(JSON.stringify({ activePaths: activePathsObj, runId: runId2, timestamp, results }));
213
- if (asyncRef) {
214
- clearImmediate(asyncRef);
215
- asyncRef = null;
216
- }
217
- asyncRef = setImmediate(() => {
218
- if (!workflow.getRun(runId2)) {
219
- controller.close();
220
- }
221
- });
222
- });
223
- },
224
- cancel() {
225
- unwatch?.();
226
- }
227
- });
228
- return stream;
229
- } catch (error) {
230
- return chunkZLBRQFDD_cjs.handleError(error, "Error watching workflow");
231
- }
232
- }
233
- async function resumeAsyncWorkflowHandler({
234
- mastra,
235
- workflowId,
236
- runId,
237
- body,
238
- runtimeContext
239
- }) {
240
- try {
241
- if (!workflowId) {
242
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
243
- }
244
- if (!runId) {
245
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to resume workflow" });
246
- }
247
- const workflow = mastra.getWorkflow(workflowId);
248
- const run = workflow.getRun(runId);
249
- if (!run) {
250
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
251
- }
252
- const result = await run.resume({
253
- stepId: body.stepId,
254
- context: body.context,
255
- runtimeContext
256
- });
257
- return result;
258
- } catch (error) {
259
- return chunkZLBRQFDD_cjs.handleError(error, "Error resuming workflow step");
260
- }
261
- }
262
- async function resumeWorkflowHandler({
263
- mastra,
264
- workflowId,
265
- runId,
266
- body,
267
- runtimeContext
268
- }) {
269
- try {
270
- if (!workflowId) {
271
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
272
- }
273
- if (!runId) {
274
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "runId required to resume workflow" });
275
- }
276
- const workflow = mastra.getWorkflow(workflowId);
277
- const run = workflow.getRun(runId);
278
- if (!run) {
279
- throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Workflow run not found" });
280
- }
281
- await run.resume({
282
- stepId: body.stepId,
283
- context: body.context,
284
- runtimeContext
285
- });
286
- return { message: "Workflow run resumed" };
287
- } catch (error) {
288
- return chunkZLBRQFDD_cjs.handleError(error, "Error resuming workflow");
289
- }
290
- }
291
- async function getWorkflowRunsHandler({ mastra, workflowId }) {
292
- try {
293
- if (!workflowId) {
294
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Workflow ID is required" });
295
- }
296
- const workflow = mastra.getWorkflow(workflowId);
297
- const workflowRuns = await workflow.getWorkflowRuns() || {
298
- runs: [],
299
- total: 0
300
- };
301
- return workflowRuns;
302
- } catch (error) {
303
- return chunkZLBRQFDD_cjs.handleError(error, "Error getting workflow runs");
304
- }
305
- }
306
-
307
- exports.createRunHandler = createRunHandler;
308
- exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
309
- exports.getWorkflowRunHandler = getWorkflowRunHandler;
310
- exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
311
- exports.getWorkflowsHandler = getWorkflowsHandler;
312
- exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
313
- exports.resumeWorkflowHandler = resumeWorkflowHandler;
314
- exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
315
- exports.startWorkflowRunHandler = startWorkflowRunHandler;
316
- exports.watchWorkflowHandler = watchWorkflowHandler;
317
- exports.workflows_exports = workflows_exports;
@@ -1,135 +0,0 @@
1
- import { handleError } from './chunk-3AHQ5RGN.js';
2
- import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
3
-
4
- // src/server/handlers/telemetry.ts
5
- var telemetry_exports = {};
6
- __export(telemetry_exports, {
7
- getTelemetryHandler: () => getTelemetryHandler,
8
- storeTelemetryHandler: () => storeTelemetryHandler
9
- });
10
- async function getTelemetryHandler({ mastra, body }) {
11
- try {
12
- const telemetry = mastra.getTelemetry();
13
- const storage = mastra.getStorage();
14
- if (!telemetry) {
15
- throw new HTTPException(400, { message: "Telemetry is not initialized" });
16
- }
17
- if (!storage) {
18
- throw new HTTPException(400, { message: "Storage is not initialized" });
19
- }
20
- if (!body) {
21
- throw new HTTPException(400, { message: "Body is required" });
22
- }
23
- const { name, scope, page, perPage, attribute } = body;
24
- const attributes = attribute ? Object.fromEntries(
25
- (Array.isArray(attribute) ? attribute : [attribute]).map((attr) => {
26
- const [key, value] = attr.split(":");
27
- return [key, value];
28
- })
29
- ) : void 0;
30
- const traces = await storage.getTraces({
31
- name,
32
- scope,
33
- page: Number(page ?? 0),
34
- perPage: Number(perPage ?? 100),
35
- attributes
36
- });
37
- return traces;
38
- } catch (error2) {
39
- return handleError(error2, "Error getting telemetry");
40
- }
41
- }
42
- async function storeTelemetryHandler({ mastra, body }) {
43
- try {
44
- const storage = mastra.getStorage();
45
- const logger = mastra.getLogger();
46
- if (!storage) {
47
- throw new HTTPException(400, { message: "Storage is not initialized" });
48
- }
49
- const now = /* @__PURE__ */ new Date();
50
- const items = body?.resourceSpans?.[0]?.scopeSpans;
51
- logger.debug("[Telemetry Handler] Received spans:", {
52
- totalSpans: items?.reduce((acc, scope) => acc + scope.spans.length, 0) || 0,
53
- timestamp: now.toISOString()
54
- });
55
- if (!items?.length) {
56
- return {
57
- status: "success",
58
- message: "No spans to process",
59
- traceCount: 0
60
- };
61
- }
62
- const allSpans = items.reduce((acc, scopedSpans) => {
63
- const { scope, spans } = scopedSpans;
64
- for (const span of spans) {
65
- const {
66
- spanId,
67
- parentSpanId,
68
- traceId,
69
- name,
70
- kind,
71
- attributes,
72
- status,
73
- events,
74
- links,
75
- startTimeUnixNano,
76
- endTimeUnixNano,
77
- ...rest
78
- } = span;
79
- const startTime = Number(BigInt(startTimeUnixNano) / 1000n);
80
- const endTime = Number(BigInt(endTimeUnixNano) / 1000n);
81
- acc.push({
82
- id: spanId,
83
- parentSpanId,
84
- traceId,
85
- name,
86
- scope: scope.name,
87
- kind,
88
- status: JSON.stringify(status),
89
- events: JSON.stringify(events),
90
- links: JSON.stringify(links),
91
- attributes: JSON.stringify(
92
- attributes.reduce((acc2, attr) => {
93
- const valueKey = Object.keys(attr.value)[0];
94
- if (valueKey) {
95
- acc2[attr.key] = attr.value[valueKey];
96
- }
97
- return acc2;
98
- }, {})
99
- ),
100
- startTime,
101
- endTime,
102
- other: JSON.stringify(rest),
103
- createdAt: now
104
- });
105
- }
106
- return acc;
107
- }, []);
108
- return storage.batchTraceInsert({
109
- records: allSpans
110
- }).then(() => {
111
- return {
112
- status: "success",
113
- message: "Traces received and processed successfully",
114
- traceCount: body.resourceSpans?.length || 0
115
- };
116
- }).catch(() => {
117
- return {
118
- status: "error",
119
- message: "Failed to process traces",
120
- // @ts-ignore
121
- error: error.message
122
- };
123
- });
124
- } catch (error2) {
125
- console.error("Error processing traces:", error2);
126
- return {
127
- status: "error",
128
- message: "Failed to process traces",
129
- // @ts-ignore
130
- error: error2.message
131
- };
132
- }
133
- }
134
-
135
- export { getTelemetryHandler, storeTelemetryHandler, telemetry_exports };
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
4
-
5
- // src/server/handlers/error.ts
6
- function handleError(error, defaultMessage) {
7
- const apiError = error;
8
- throw new chunkFV45V6WC_cjs.HTTPException(apiError.status || 500, {
9
- message: apiError.message || defaultMessage
10
- });
11
- }
12
-
13
- exports.handleError = handleError;
package/dist/index.d.cts DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export { getAgentsHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getAgentByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { getEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { getLiveEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.cjs';
5
- export { generateHandler } from '../../_tsup-dts-rollup.cjs';
6
- export { streamGenerateHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1 +0,0 @@
1
- export { handleError } from '../../_tsup-dts-rollup.cjs';
@@ -1,3 +0,0 @@
1
- export { getLogsHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getLogsByRunIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { getLogTransports } from '../../_tsup-dts-rollup.cjs';
@@ -1,8 +0,0 @@
1
- export { getMemoryStatusHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getThreadsHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { getThreadByIdHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { saveMessagesHandler } from '../../_tsup-dts-rollup.cjs';
5
- export { createThreadHandler } from '../../_tsup-dts-rollup.cjs';
6
- export { updateThreadHandler } from '../../_tsup-dts-rollup.cjs';
7
- export { deleteThreadHandler } from '../../_tsup-dts-rollup.cjs';
8
- export { getMessagesHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkFPIWDH5Y_cjs = require('../../chunk-FPIWDH5Y.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "generateHandler", {
8
- enumerable: true,
9
- get: function () { return chunkFPIWDH5Y_cjs.generateHandler; }
10
- });
11
- Object.defineProperty(exports, "getNetworkByIdHandler", {
12
- enumerable: true,
13
- get: function () { return chunkFPIWDH5Y_cjs.getNetworkByIdHandler; }
14
- });
15
- Object.defineProperty(exports, "getNetworksHandler", {
16
- enumerable: true,
17
- get: function () { return chunkFPIWDH5Y_cjs.getNetworksHandler; }
18
- });
19
- Object.defineProperty(exports, "streamGenerateHandler", {
20
- enumerable: true,
21
- get: function () { return chunkFPIWDH5Y_cjs.streamGenerateHandler; }
22
- });
@@ -1,4 +0,0 @@
1
- export { getNetworksHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getNetworkByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { generateHandler_alias_1 as generateHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { streamGenerateHandler_alias_1 as streamGenerateHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,4 +0,0 @@
1
- export { getNetworksHandler } from '../../_tsup-dts-rollup.js';
2
- export { getNetworkByIdHandler } from '../../_tsup-dts-rollup.js';
3
- export { generateHandler_alias_1 as generateHandler } from '../../_tsup-dts-rollup.js';
4
- export { streamGenerateHandler_alias_1 as streamGenerateHandler } from '../../_tsup-dts-rollup.js';
@@ -1 +0,0 @@
1
- export { generateHandler, getNetworkByIdHandler, getNetworksHandler, streamGenerateHandler } from '../../chunk-RE6YL32K.js';
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk7IWQE76Z_cjs = require('../../chunk-7IWQE76Z.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "getTelemetryHandler", {
8
- enumerable: true,
9
- get: function () { return chunk7IWQE76Z_cjs.getTelemetryHandler; }
10
- });
11
- Object.defineProperty(exports, "storeTelemetryHandler", {
12
- enumerable: true,
13
- get: function () { return chunk7IWQE76Z_cjs.storeTelemetryHandler; }
14
- });
@@ -1,2 +0,0 @@
1
- export { getTelemetryHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { storeTelemetryHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,2 +0,0 @@
1
- export { getTelemetryHandler } from '../../_tsup-dts-rollup.js';
2
- export { storeTelemetryHandler } from '../../_tsup-dts-rollup.js';
@@ -1 +0,0 @@
1
- export { getTelemetryHandler, storeTelemetryHandler } from '../../chunk-WTHDCRMY.js';
@@ -1,4 +0,0 @@
1
- export { getToolsHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getToolByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { executeToolHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { executeAgentToolHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1 +0,0 @@
1
- export { validateBody } from '../../_tsup-dts-rollup.cjs';
@@ -1,6 +0,0 @@
1
- export { upsertVectors } from '../../_tsup-dts-rollup.cjs';
2
- export { createIndex } from '../../_tsup-dts-rollup.cjs';
3
- export { queryVectors } from '../../_tsup-dts-rollup.cjs';
4
- export { listIndexes } from '../../_tsup-dts-rollup.cjs';
5
- export { describeIndex } from '../../_tsup-dts-rollup.cjs';
6
- export { deleteIndex } from '../../_tsup-dts-rollup.cjs';
@@ -1,3 +0,0 @@
1
- export { getSpeakersHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { generateSpeechHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { transcribeSpeechHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,10 +0,0 @@
1
- export { getWorkflowsHandler } from '../../_tsup-dts-rollup.cjs';
2
- export { getWorkflowByIdHandler } from '../../_tsup-dts-rollup.cjs';
3
- export { startAsyncWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
4
- export { getWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
5
- export { createRunHandler } from '../../_tsup-dts-rollup.cjs';
6
- export { startWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
7
- export { watchWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
8
- export { resumeAsyncWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
9
- export { resumeWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
10
- export { getWorkflowRunsHandler } from '../../_tsup-dts-rollup.cjs';
@@ -1,9 +0,0 @@
1
- export { agents } from '../_tsup-dts-rollup.cjs';
2
- export { logs } from '../_tsup-dts-rollup.cjs';
3
- export { memory } from '../_tsup-dts-rollup.cjs';
4
- export { network } from '../_tsup-dts-rollup.cjs';
5
- export { telemetry } from '../_tsup-dts-rollup.cjs';
6
- export { tools } from '../_tsup-dts-rollup.cjs';
7
- export { workflows } from '../_tsup-dts-rollup.cjs';
8
- export { vector } from '../_tsup-dts-rollup.cjs';
9
- export { voice } from '../_tsup-dts-rollup.cjs';