@mastra/server 0.0.0-inject-middleware-20250528222017 → 0.0.0-interpolate-reporter-url-20250910180021

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 (329) hide show
  1. package/CHANGELOG.md +3569 -0
  2. package/LICENSE.md +11 -42
  3. package/dist/{chunk-5SN4U5AC.cjs → chunk-3THIIWWW.cjs} +113 -137
  4. package/dist/chunk-3THIIWWW.cjs.map +1 -0
  5. package/dist/{chunk-H5PTF3Y4.js → chunk-4QCXUEAT.js} +11 -2
  6. package/dist/chunk-4QCXUEAT.js.map +1 -0
  7. package/dist/chunk-4RRMWXQ2.js +3522 -0
  8. package/dist/chunk-4RRMWXQ2.js.map +1 -0
  9. package/dist/chunk-5DP5XZH6.cjs +928 -0
  10. package/dist/chunk-5DP5XZH6.cjs.map +1 -0
  11. package/dist/{chunk-P6SCPDYW.js → chunk-5QUKZCEF.js} +112 -136
  12. package/dist/chunk-5QUKZCEF.js.map +1 -0
  13. package/dist/chunk-66YYHFGF.js +761 -0
  14. package/dist/chunk-66YYHFGF.js.map +1 -0
  15. package/dist/chunk-6GMFZ5LK.js +2774 -0
  16. package/dist/chunk-6GMFZ5LK.js.map +1 -0
  17. package/dist/chunk-6LUKYSWE.cjs +610 -0
  18. package/dist/chunk-6LUKYSWE.cjs.map +1 -0
  19. package/dist/chunk-743UIDHI.cjs +2013 -0
  20. package/dist/chunk-743UIDHI.cjs.map +1 -0
  21. package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
  22. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  23. package/dist/chunk-7QEJ5QG5.js +151 -0
  24. package/dist/chunk-7QEJ5QG5.js.map +1 -0
  25. package/dist/chunk-A3AL7EWJ.js +83 -0
  26. package/dist/chunk-A3AL7EWJ.js.map +1 -0
  27. package/dist/{chunk-HFWCEP5S.js → chunk-A75S4TDD.js} +36 -11
  28. package/dist/chunk-A75S4TDD.js.map +1 -0
  29. package/dist/chunk-AK2FXLLB.cjs +849 -0
  30. package/dist/chunk-AK2FXLLB.cjs.map +1 -0
  31. package/dist/chunk-B2V3PUB7.js +591 -0
  32. package/dist/chunk-B2V3PUB7.js.map +1 -0
  33. package/dist/chunk-CY4TP3FK.js +16 -0
  34. package/dist/chunk-CY4TP3FK.js.map +1 -0
  35. package/dist/chunk-EMMSS5I5.cjs +37 -0
  36. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  37. package/dist/chunk-EMNGA4R4.js +845 -0
  38. package/dist/chunk-EMNGA4R4.js.map +1 -0
  39. package/dist/chunk-FALVL2VV.cjs +3525 -0
  40. package/dist/chunk-FALVL2VV.cjs.map +1 -0
  41. package/dist/chunk-FQNT7PI4.js +937 -0
  42. package/dist/chunk-FQNT7PI4.js.map +1 -0
  43. package/dist/chunk-G3PMV62Z.js +33 -0
  44. package/dist/chunk-G3PMV62Z.js.map +1 -0
  45. package/dist/chunk-G4PUALCE.cjs +28 -0
  46. package/dist/chunk-G4PUALCE.cjs.map +1 -0
  47. package/dist/chunk-GU4EWMZB.cjs +769 -0
  48. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  49. package/dist/chunk-GUI3CROV.cjs +159 -0
  50. package/dist/chunk-GUI3CROV.cjs.map +1 -0
  51. package/dist/chunk-HJQKWRKQ.cjs +764 -0
  52. package/dist/chunk-HJQKWRKQ.cjs.map +1 -0
  53. package/dist/{chunk-YWLUOY3D.cjs → chunk-HVBBFCDH.cjs} +1110 -793
  54. package/dist/chunk-HVBBFCDH.cjs.map +1 -0
  55. package/dist/chunk-HZJRQ5L3.cjs +1411 -0
  56. package/dist/chunk-HZJRQ5L3.cjs.map +1 -0
  57. package/dist/chunk-IGFMAZZ5.cjs +1150 -0
  58. package/dist/chunk-IGFMAZZ5.cjs.map +1 -0
  59. package/dist/chunk-IOQGI4ML.js +931 -0
  60. package/dist/chunk-IOQGI4ML.js.map +1 -0
  61. package/dist/{chunk-VPNDC2DI.cjs → chunk-IY34NOLA.cjs} +16 -14
  62. package/dist/chunk-IY34NOLA.cjs.map +1 -0
  63. package/dist/chunk-J7BPKKOG.cjs +163 -0
  64. package/dist/chunk-J7BPKKOG.cjs.map +1 -0
  65. package/dist/{chunk-YIOVBYZH.cjs → chunk-KNGXRN26.cjs} +48 -45
  66. package/dist/chunk-KNGXRN26.cjs.map +1 -0
  67. package/dist/{chunk-OR3CIE2H.js → chunk-KV6VHX4V.js} +29 -7
  68. package/dist/chunk-KV6VHX4V.js.map +1 -0
  69. package/dist/chunk-L265APUD.cjs +69 -0
  70. package/dist/chunk-L265APUD.cjs.map +1 -0
  71. package/dist/chunk-LF2ZLOFP.js +767 -0
  72. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  73. package/dist/chunk-LYPU75T6.js +1147 -0
  74. package/dist/chunk-LYPU75T6.js.map +1 -0
  75. package/dist/chunk-M2YFWHSB.js +455 -0
  76. package/dist/chunk-M2YFWHSB.js.map +1 -0
  77. package/dist/chunk-MLGHQDZZ.js +15671 -0
  78. package/dist/chunk-MLGHQDZZ.js.map +1 -0
  79. package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
  80. package/dist/chunk-MMROOK5J.js.map +1 -0
  81. package/dist/{chunk-LIVAK2DM.js → chunk-N7F33WAD.js} +1083 -794
  82. package/dist/chunk-N7F33WAD.js.map +1 -0
  83. package/dist/chunk-NG5IVLEZ.js +1012 -0
  84. package/dist/chunk-NG5IVLEZ.js.map +1 -0
  85. package/dist/chunk-OGW6HHVI.js +1408 -0
  86. package/dist/chunk-OGW6HHVI.js.map +1 -0
  87. package/dist/chunk-OZLRIVC4.cjs +588 -0
  88. package/dist/chunk-OZLRIVC4.cjs.map +1 -0
  89. package/dist/chunk-P7CIEIJ3.js +925 -0
  90. package/dist/chunk-P7CIEIJ3.js.map +1 -0
  91. package/dist/chunk-P7RBMCBE.cjs +934 -0
  92. package/dist/chunk-P7RBMCBE.cjs.map +1 -0
  93. package/dist/chunk-PPYGWINI.cjs +2777 -0
  94. package/dist/chunk-PPYGWINI.cjs.map +1 -0
  95. package/dist/{chunk-MHKNLNAN.cjs → chunk-PWTXZZTR.cjs} +33 -10
  96. package/dist/chunk-PWTXZZTR.cjs.map +1 -0
  97. package/dist/chunk-R7NOGUZG.js +65 -0
  98. package/dist/chunk-R7NOGUZG.js.map +1 -0
  99. package/dist/chunk-RCHEPTZZ.js +2006 -0
  100. package/dist/chunk-RCHEPTZZ.js.map +1 -0
  101. package/dist/chunk-RE4RPXT2.cjs +18 -0
  102. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  103. package/dist/chunk-RW2D3G4K.cjs +470 -0
  104. package/dist/chunk-RW2D3G4K.cjs.map +1 -0
  105. package/dist/chunk-SIGXR3JT.cjs +1043 -0
  106. package/dist/chunk-SIGXR3JT.cjs.map +1 -0
  107. package/dist/chunk-SPLSYTYW.cjs +88 -0
  108. package/dist/chunk-SPLSYTYW.cjs.map +1 -0
  109. package/dist/chunk-SQY4T6EJ.js +571 -0
  110. package/dist/chunk-SQY4T6EJ.js.map +1 -0
  111. package/dist/{chunk-TJKLBTFB.js → chunk-SYRRSBGL.js} +51 -27
  112. package/dist/chunk-SYRRSBGL.js.map +1 -0
  113. package/dist/{chunk-BNEY4P4P.cjs → chunk-T3TIA3O6.cjs} +20 -18
  114. package/dist/chunk-T3TIA3O6.cjs.map +1 -0
  115. package/dist/{chunk-W7VCKPAD.js → chunk-TTHEEIZ3.js} +19 -16
  116. package/dist/chunk-TTHEEIZ3.js.map +1 -0
  117. package/dist/chunk-TVSIG4JE.cjs +940 -0
  118. package/dist/chunk-TVSIG4JE.cjs.map +1 -0
  119. package/dist/{chunk-C7564HUT.js → chunk-U46VIX2V.js} +6 -4
  120. package/dist/chunk-U46VIX2V.js.map +1 -0
  121. package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
  122. package/dist/chunk-WHN4VX55.js.map +1 -0
  123. package/dist/chunk-WZC6CIVD.cjs +120 -0
  124. package/dist/chunk-WZC6CIVD.cjs.map +1 -0
  125. package/dist/chunk-YITREQVN.cjs +15707 -0
  126. package/dist/chunk-YITREQVN.cjs.map +1 -0
  127. package/dist/dist-26HWEQY6.js +3 -0
  128. package/dist/dist-26HWEQY6.js.map +1 -0
  129. package/dist/dist-3A5DXB37.cjs +20 -0
  130. package/dist/dist-3A5DXB37.cjs.map +1 -0
  131. package/dist/dist-3SJKQJGY.cjs +16 -0
  132. package/dist/dist-3SJKQJGY.cjs.map +1 -0
  133. package/dist/dist-4ZQSPE5K.js +3 -0
  134. package/dist/dist-4ZQSPE5K.js.map +1 -0
  135. package/dist/dist-5W5QNRTD.js +3 -0
  136. package/dist/dist-5W5QNRTD.js.map +1 -0
  137. package/dist/dist-653SRMPL.js +3 -0
  138. package/dist/dist-653SRMPL.js.map +1 -0
  139. package/dist/dist-6U6EFC5C.cjs +16 -0
  140. package/dist/dist-6U6EFC5C.cjs.map +1 -0
  141. package/dist/dist-7IHNNYMF.cjs +16 -0
  142. package/dist/dist-7IHNNYMF.cjs.map +1 -0
  143. package/dist/dist-B5IPRF6W.js +3 -0
  144. package/dist/dist-B5IPRF6W.js.map +1 -0
  145. package/dist/dist-EOMYFT4Y.cjs +16 -0
  146. package/dist/dist-EOMYFT4Y.cjs.map +1 -0
  147. package/dist/dist-EZZMMMNT.cjs +16 -0
  148. package/dist/dist-EZZMMMNT.cjs.map +1 -0
  149. package/dist/dist-F2ET4MNO.cjs +16 -0
  150. package/dist/dist-F2ET4MNO.cjs.map +1 -0
  151. package/dist/dist-H64VX6DE.js +3 -0
  152. package/dist/dist-H64VX6DE.js.map +1 -0
  153. package/dist/dist-HY7RMLJQ.cjs +16 -0
  154. package/dist/dist-HY7RMLJQ.cjs.map +1 -0
  155. package/dist/dist-M6S4P3FJ.js +3 -0
  156. package/dist/dist-M6S4P3FJ.js.map +1 -0
  157. package/dist/dist-NR7QSCQT.js +3 -0
  158. package/dist/dist-NR7QSCQT.js.map +1 -0
  159. package/dist/dist-QLFMCMCX.js +3 -0
  160. package/dist/dist-QLFMCMCX.js.map +1 -0
  161. package/dist/dist-UY46BFRP.js +3 -0
  162. package/dist/dist-UY46BFRP.js.map +1 -0
  163. package/dist/dist-WCQDRTIV.cjs +16 -0
  164. package/dist/dist-WCQDRTIV.cjs.map +1 -0
  165. package/dist/dist-WKYB3LTJ.cjs +16 -0
  166. package/dist/dist-WKYB3LTJ.cjs.map +1 -0
  167. package/dist/index.cjs +2 -0
  168. package/dist/index.cjs.map +1 -0
  169. package/dist/index.d.ts +1 -0
  170. package/dist/index.d.ts.map +1 -0
  171. package/dist/index.js +2 -0
  172. package/dist/index.js.map +1 -0
  173. package/dist/server/a2a/protocol.d.ts +8 -0
  174. package/dist/server/a2a/protocol.d.ts.map +1 -0
  175. package/dist/server/a2a/store.cjs +25 -0
  176. package/dist/server/a2a/store.cjs.map +1 -0
  177. package/dist/server/a2a/store.d.ts +14 -0
  178. package/dist/server/a2a/store.d.ts.map +1 -0
  179. package/dist/server/a2a/store.js +23 -0
  180. package/dist/server/a2a/store.js.map +1 -0
  181. package/dist/server/a2a/tasks.d.ts +20 -0
  182. package/dist/server/a2a/tasks.d.ts.map +1 -0
  183. package/dist/server/handlers/a2a.cjs +13 -11
  184. package/dist/server/handlers/a2a.cjs.map +1 -0
  185. package/dist/server/handlers/a2a.d.ts +68 -6
  186. package/dist/server/handlers/a2a.d.ts.map +1 -0
  187. package/dist/server/handlers/a2a.js +3 -1
  188. package/dist/server/handlers/a2a.js.map +1 -0
  189. package/dist/server/handlers/agent-builder.cjs +68 -0
  190. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  191. package/dist/server/handlers/agent-builder.d.ts +87 -0
  192. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  193. package/dist/server/handlers/agent-builder.js +3 -0
  194. package/dist/server/handlers/agent-builder.js.map +1 -0
  195. package/dist/server/handlers/agents.cjs +37 -7
  196. package/dist/server/handlers/agents.cjs.map +1 -0
  197. package/dist/server/handlers/agents.d.ts +129 -6
  198. package/dist/server/handlers/agents.d.ts.map +1 -0
  199. package/dist/server/handlers/agents.js +3 -1
  200. package/dist/server/handlers/agents.js.map +1 -0
  201. package/dist/server/handlers/error.cjs +4 -2
  202. package/dist/server/handlers/error.cjs.map +1 -0
  203. package/dist/server/handlers/error.d.ts +2 -1
  204. package/dist/server/handlers/error.d.ts.map +1 -0
  205. package/dist/server/handlers/error.js +3 -1
  206. package/dist/server/handlers/error.js.map +1 -0
  207. package/dist/server/handlers/legacyWorkflows.cjs +13 -11
  208. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  209. package/dist/server/handlers/legacyWorkflows.d.ts +59 -10
  210. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  211. package/dist/server/handlers/legacyWorkflows.js +3 -1
  212. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  213. package/dist/server/handlers/logs.cjs +6 -4
  214. package/dist/server/handlers/logs.cjs.map +1 -0
  215. package/dist/server/handlers/logs.d.ts +34 -3
  216. package/dist/server/handlers/logs.d.ts.map +1 -0
  217. package/dist/server/handlers/logs.js +3 -1
  218. package/dist/server/handlers/logs.js.map +1 -0
  219. package/dist/server/handlers/memory.cjs +39 -9
  220. package/dist/server/handlers/memory.cjs.map +1 -0
  221. package/dist/server/handlers/memory.d.ts +118 -8
  222. package/dist/server/handlers/memory.d.ts.map +1 -0
  223. package/dist/server/handlers/memory.js +3 -1
  224. package/dist/server/handlers/memory.js.map +1 -0
  225. package/dist/server/handlers/network.cjs +7 -5
  226. package/dist/server/handlers/network.cjs.map +1 -0
  227. package/dist/server/handlers/network.d.ts +50 -4
  228. package/dist/server/handlers/network.d.ts.map +1 -0
  229. package/dist/server/handlers/network.js +3 -1
  230. package/dist/server/handlers/network.js.map +1 -0
  231. package/dist/server/handlers/observability.cjs +16 -0
  232. package/dist/server/handlers/observability.cjs.map +1 -0
  233. package/dist/server/handlers/observability.d.ts +23 -0
  234. package/dist/server/handlers/observability.d.ts.map +1 -0
  235. package/dist/server/handlers/observability.js +3 -0
  236. package/dist/server/handlers/observability.js.map +1 -0
  237. package/dist/server/handlers/scores.cjs +32 -0
  238. package/dist/server/handlers/scores.cjs.map +1 -0
  239. package/dist/server/handlers/scores.d.ts +49 -0
  240. package/dist/server/handlers/scores.d.ts.map +1 -0
  241. package/dist/server/handlers/scores.js +3 -0
  242. package/dist/server/handlers/scores.js.map +1 -0
  243. package/dist/server/handlers/telemetry.cjs +9 -3
  244. package/dist/server/handlers/telemetry.cjs.map +1 -0
  245. package/dist/server/handlers/telemetry.d.ts +33 -2
  246. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  247. package/dist/server/handlers/telemetry.js +3 -1
  248. package/dist/server/handlers/telemetry.js.map +1 -0
  249. package/dist/server/handlers/tools.cjs +11 -5
  250. package/dist/server/handlers/tools.cjs.map +1 -0
  251. package/dist/server/handlers/tools.d.ts +25 -4
  252. package/dist/server/handlers/tools.d.ts.map +1 -0
  253. package/dist/server/handlers/tools.js +3 -1
  254. package/dist/server/handlers/tools.js.map +1 -0
  255. package/dist/server/handlers/utils.cjs +8 -2
  256. package/dist/server/handlers/utils.cjs.map +1 -0
  257. package/dist/server/handlers/utils.d.ts +8 -1
  258. package/dist/server/handlers/utils.d.ts.map +1 -0
  259. package/dist/server/handlers/utils.js +3 -1
  260. package/dist/server/handlers/utils.js.map +1 -0
  261. package/dist/server/handlers/vNextNetwork.cjs +220 -0
  262. package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
  263. package/dist/server/handlers/vNextNetwork.d.ts +179 -0
  264. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
  265. package/dist/server/handlers/vNextNetwork.js +213 -0
  266. package/dist/server/handlers/vNextNetwork.js.map +1 -0
  267. package/dist/server/handlers/vector.cjs +9 -7
  268. package/dist/server/handlers/vector.cjs.map +1 -0
  269. package/dist/server/handlers/vector.d.ts +51 -6
  270. package/dist/server/handlers/vector.d.ts.map +1 -0
  271. package/dist/server/handlers/vector.js +3 -1
  272. package/dist/server/handlers/vector.js.map +1 -0
  273. package/dist/server/handlers/voice.cjs +10 -4
  274. package/dist/server/handlers/voice.cjs.map +1 -0
  275. package/dist/server/handlers/voice.d.ts +39 -3
  276. package/dist/server/handlers/voice.d.ts.map +1 -0
  277. package/dist/server/handlers/voice.js +3 -1
  278. package/dist/server/handlers/voice.js.map +1 -0
  279. package/dist/server/handlers/workflows.cjs +30 -12
  280. package/dist/server/handlers/workflows.cjs.map +1 -0
  281. package/dist/server/handlers/workflows.d.ts +73 -11
  282. package/dist/server/handlers/workflows.d.ts.map +1 -0
  283. package/dist/server/handlers/workflows.js +3 -1
  284. package/dist/server/handlers/workflows.js.map +1 -0
  285. package/dist/server/handlers.cjs +49 -32
  286. package/dist/server/handlers.cjs.map +1 -0
  287. package/dist/server/handlers.d.ts +15 -11
  288. package/dist/server/handlers.d.ts.map +1 -0
  289. package/dist/server/handlers.js +16 -11
  290. package/dist/server/handlers.js.map +1 -0
  291. package/dist/server/http-exception.d.ts +87 -0
  292. package/dist/server/http-exception.d.ts.map +1 -0
  293. package/dist/server/types.d.ts +10 -0
  294. package/dist/server/types.d.ts.map +1 -0
  295. package/dist/server/utils.d.ts +42 -0
  296. package/dist/server/utils.d.ts.map +1 -0
  297. package/package.json +51 -21
  298. package/dist/_tsup-dts-rollup.d.cts +0 -830
  299. package/dist/_tsup-dts-rollup.d.ts +0 -830
  300. package/dist/chunk-57CJTIPW.cjs +0 -18
  301. package/dist/chunk-64U3UDTH.cjs +0 -13
  302. package/dist/chunk-75ZPJI57.cjs +0 -9
  303. package/dist/chunk-A3KDUGS7.cjs +0 -239
  304. package/dist/chunk-DJJIUEL2.js +0 -211
  305. package/dist/chunk-DQLE3DVM.js +0 -49
  306. package/dist/chunk-J3PKLB3A.js +0 -231
  307. package/dist/chunk-KUNQFY2W.js +0 -365
  308. package/dist/chunk-M5ABIP7D.js +0 -11
  309. package/dist/chunk-MLKGABMK.js +0 -7
  310. package/dist/chunk-MMO2HDM6.cjs +0 -378
  311. package/dist/chunk-NEOOQUKW.cjs +0 -54
  312. package/dist/chunk-Y7UWRW5X.cjs +0 -221
  313. package/dist/chunk-YBVOQN4M.cjs +0 -94
  314. package/dist/chunk-ZE5AAC4I.cjs +0 -138
  315. package/dist/index.d.cts +0 -1
  316. package/dist/server/handlers/a2a.d.cts +0 -6
  317. package/dist/server/handlers/agents.d.cts +0 -6
  318. package/dist/server/handlers/error.d.cts +0 -1
  319. package/dist/server/handlers/legacyWorkflows.d.cts +0 -10
  320. package/dist/server/handlers/logs.d.cts +0 -3
  321. package/dist/server/handlers/memory.d.cts +0 -8
  322. package/dist/server/handlers/network.d.cts +0 -4
  323. package/dist/server/handlers/telemetry.d.cts +0 -2
  324. package/dist/server/handlers/tools.d.cts +0 -4
  325. package/dist/server/handlers/utils.d.cts +0 -1
  326. package/dist/server/handlers/vector.d.cts +0 -6
  327. package/dist/server/handlers/voice.d.cts +0 -3
  328. package/dist/server/handlers/workflows.d.cts +0 -11
  329. package/dist/server/handlers.d.cts +0 -11
@@ -1,231 +0,0 @@
1
- import { stringify, esm_default } from './chunk-LIVAK2DM.js';
2
- import { validateBody } from './chunk-H5PTF3Y4.js';
3
- import { handleError } from './chunk-M5ABIP7D.js';
4
- import { HTTPException } from './chunk-NYN7KFXL.js';
5
- import { __export } from './chunk-MLKGABMK.js';
6
- import { RuntimeContext } from '@mastra/core/runtime-context';
7
-
8
- // src/server/handlers/agents.ts
9
- var agents_exports = {};
10
- __export(agents_exports, {
11
- generateHandler: () => generateHandler,
12
- getAgentByIdHandler: () => getAgentByIdHandler,
13
- getAgentsHandler: () => getAgentsHandler,
14
- getEvalsByAgentIdHandler: () => getEvalsByAgentIdHandler,
15
- getLiveEvalsByAgentIdHandler: () => getLiveEvalsByAgentIdHandler,
16
- streamGenerateHandler: () => streamGenerateHandler
17
- });
18
- async function getAgentsHandler({ mastra, runtimeContext }) {
19
- try {
20
- const agents = mastra.getAgents();
21
- const serializedAgentsMap = await Promise.all(
22
- Object.entries(agents).map(async ([id, agent]) => {
23
- const instructions = await agent.getInstructions({ runtimeContext });
24
- const tools = await agent.getTools({ runtimeContext });
25
- const llm = await agent.getLLM({ runtimeContext });
26
- const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
27
- const _tool = tool;
28
- acc[key] = {
29
- ..._tool,
30
- inputSchema: _tool.inputSchema ? stringify(esm_default(_tool.inputSchema)) : void 0,
31
- outputSchema: _tool.outputSchema ? stringify(esm_default(_tool.outputSchema)) : void 0
32
- };
33
- return acc;
34
- }, {});
35
- let serializedAgentWorkflows = {};
36
- if ("getWorkflows" in agent) {
37
- const logger = mastra.getLogger();
38
- try {
39
- const workflows = await agent.getWorkflows({ runtimeContext });
40
- serializedAgentWorkflows = Object.entries(workflows || {}).reduce((acc, [key, workflow]) => {
41
- return {
42
- ...acc,
43
- [key]: {
44
- name: workflow.name
45
- }
46
- };
47
- }, {});
48
- } catch (error) {
49
- logger.error("Error getting workflows for agent", { agentName: agent.name, error });
50
- }
51
- }
52
- return {
53
- id,
54
- name: agent.name,
55
- instructions,
56
- tools: serializedAgentTools,
57
- workflows: serializedAgentWorkflows,
58
- provider: llm?.getProvider(),
59
- modelId: llm?.getModelId(),
60
- defaultGenerateOptions: agent.getDefaultGenerateOptions(),
61
- defaultStreamOptions: agent.getDefaultStreamOptions()
62
- };
63
- })
64
- );
65
- const serializedAgents = serializedAgentsMap.reduce((acc, { id, ...rest }) => {
66
- acc[id] = rest;
67
- return acc;
68
- }, {});
69
- return serializedAgents;
70
- } catch (error) {
71
- return handleError(error, "Error getting agents");
72
- }
73
- }
74
- async function getAgentByIdHandler({
75
- mastra,
76
- runtimeContext,
77
- agentId
78
- }) {
79
- try {
80
- const agent = mastra.getAgent(agentId);
81
- if (!agent) {
82
- throw new HTTPException(404, { message: "Agent not found" });
83
- }
84
- const tools = await agent.getTools({ runtimeContext });
85
- const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
86
- const _tool = tool;
87
- acc[key] = {
88
- ..._tool,
89
- inputSchema: _tool.inputSchema ? stringify(esm_default(_tool.inputSchema)) : void 0,
90
- outputSchema: _tool.outputSchema ? stringify(esm_default(_tool.outputSchema)) : void 0
91
- };
92
- return acc;
93
- }, {});
94
- let serializedAgentWorkflows = {};
95
- if ("getWorkflows" in agent) {
96
- const logger = mastra.getLogger();
97
- try {
98
- const workflows = await agent.getWorkflows({ runtimeContext });
99
- serializedAgentWorkflows = Object.entries(workflows || {}).reduce((acc, [key, workflow]) => {
100
- return {
101
- ...acc,
102
- [key]: {
103
- name: workflow.name
104
- }
105
- };
106
- }, {});
107
- } catch (error) {
108
- logger.error("Error getting workflows for agent", { agentName: agent.name, error });
109
- }
110
- }
111
- const instructions = await agent.getInstructions({ runtimeContext });
112
- const llm = await agent.getLLM({ runtimeContext });
113
- return {
114
- name: agent.name,
115
- instructions,
116
- tools: serializedAgentTools,
117
- workflows: serializedAgentWorkflows,
118
- provider: llm?.getProvider(),
119
- modelId: llm?.getModelId(),
120
- defaultGenerateOptions: agent.getDefaultGenerateOptions(),
121
- defaultStreamOptions: agent.getDefaultStreamOptions()
122
- };
123
- } catch (error) {
124
- return handleError(error, "Error getting agent");
125
- }
126
- }
127
- async function getEvalsByAgentIdHandler({
128
- mastra,
129
- runtimeContext,
130
- agentId
131
- }) {
132
- try {
133
- const agent = mastra.getAgent(agentId);
134
- const evals = await mastra.getStorage()?.getEvalsByAgentName?.(agent.name, "test") || [];
135
- const instructions = await agent.getInstructions({ runtimeContext });
136
- return {
137
- id: agentId,
138
- name: agent.name,
139
- instructions,
140
- evals
141
- };
142
- } catch (error) {
143
- return handleError(error, "Error getting test evals");
144
- }
145
- }
146
- async function getLiveEvalsByAgentIdHandler({
147
- mastra,
148
- runtimeContext,
149
- agentId
150
- }) {
151
- try {
152
- const agent = mastra.getAgent(agentId);
153
- const evals = await mastra.getStorage()?.getEvalsByAgentName?.(agent.name, "live") || [];
154
- const instructions = await agent.getInstructions({ runtimeContext });
155
- return {
156
- id: agentId,
157
- name: agent.name,
158
- instructions,
159
- evals
160
- };
161
- } catch (error) {
162
- return handleError(error, "Error getting live evals");
163
- }
164
- }
165
- async function generateHandler({
166
- mastra,
167
- runtimeContext,
168
- agentId,
169
- body
170
- }) {
171
- try {
172
- const agent = mastra.getAgent(agentId);
173
- if (!agent) {
174
- throw new HTTPException(404, { message: "Agent not found" });
175
- }
176
- const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
177
- const finalResourceId = resourceId ?? resourceid;
178
- const finalRuntimeContext = new RuntimeContext([
179
- ...Array.from(runtimeContext.entries()),
180
- ...Array.from(Object.entries(agentRuntimeContext ?? {}))
181
- ]);
182
- validateBody({ messages });
183
- const result = await agent.generate(messages, {
184
- ...rest,
185
- // @ts-expect-error TODO fix types
186
- resourceId: finalResourceId,
187
- runtimeContext: finalRuntimeContext
188
- });
189
- return result;
190
- } catch (error) {
191
- return handleError(error, "Error generating from agent");
192
- }
193
- }
194
- async function streamGenerateHandler({
195
- mastra,
196
- runtimeContext,
197
- agentId,
198
- body
199
- }) {
200
- try {
201
- const agent = mastra.getAgent(agentId);
202
- if (!agent) {
203
- throw new HTTPException(404, { message: "Agent not found" });
204
- }
205
- const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
206
- const finalResourceId = resourceId ?? resourceid;
207
- const finalRuntimeContext = new RuntimeContext([
208
- ...Array.from(runtimeContext.entries()),
209
- ...Array.from(Object.entries(agentRuntimeContext ?? {}))
210
- ]);
211
- validateBody({ messages });
212
- const streamResult = await agent.stream(messages, {
213
- ...rest,
214
- // @ts-expect-error TODO fix types
215
- resourceId: finalResourceId,
216
- runtimeContext: finalRuntimeContext
217
- });
218
- const streamResponse = rest.output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
219
- sendUsage: true,
220
- sendReasoning: true,
221
- getErrorMessage: (error) => {
222
- return `An error occurred while processing your request. ${error instanceof Error ? error.message : JSON.stringify(error)}`;
223
- }
224
- });
225
- return streamResponse;
226
- } catch (error) {
227
- throw new HTTPException(error?.status ?? 500, { message: error?.message ?? "Error streaming from agent" });
228
- }
229
- }
230
-
231
- export { agents_exports, generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler };
@@ -1,365 +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/workflows.ts
9
- var workflows_exports = {};
10
- __export(workflows_exports, {
11
- createWorkflowRunHandler: () => createWorkflowRunHandler,
12
- getWorkflowByIdHandler: () => getWorkflowByIdHandler,
13
- getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
14
- getWorkflowRunsHandler: () => getWorkflowRunsHandler,
15
- getWorkflowsHandler: () => getWorkflowsHandler,
16
- resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
17
- resumeWorkflowHandler: () => resumeWorkflowHandler,
18
- startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
19
- startWorkflowRunHandler: () => startWorkflowRunHandler,
20
- streamWorkflowHandler: () => streamWorkflowHandler,
21
- watchWorkflowHandler: () => watchWorkflowHandler
22
- });
23
- async function getWorkflowsHandler({ mastra }) {
24
- try {
25
- const workflows = mastra.getWorkflows({ serialized: false });
26
- const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
27
- acc[key] = {
28
- name: workflow.name,
29
- description: workflow.description,
30
- steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
31
- acc2[key2] = {
32
- id: step.id,
33
- description: step.description,
34
- inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
35
- outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
36
- resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
37
- suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
38
- };
39
- return acc2;
40
- }, {}),
41
- stepGraph: workflow.serializedStepGraph,
42
- inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
43
- outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
44
- };
45
- return acc;
46
- }, {});
47
- return _workflows;
48
- } catch (error) {
49
- throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
50
- }
51
- }
52
- async function getWorkflowByIdHandler({ mastra, workflowId }) {
53
- try {
54
- if (!workflowId) {
55
- throw new HTTPException(400, { message: "Workflow ID is required" });
56
- }
57
- const workflow = mastra.getWorkflow(workflowId);
58
- if (!workflow) {
59
- throw new HTTPException(404, { message: "Workflow not found" });
60
- }
61
- return {
62
- steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
63
- acc[key] = {
64
- id: step.id,
65
- description: step.description,
66
- inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
67
- outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
68
- resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
69
- suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
70
- };
71
- return acc;
72
- }, {}),
73
- name: workflow.name,
74
- description: workflow.description,
75
- stepGraph: workflow.serializedStepGraph,
76
- inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
77
- outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
78
- };
79
- } catch (error) {
80
- throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
81
- }
82
- }
83
- async function getWorkflowRunByIdHandler({
84
- mastra,
85
- workflowId,
86
- runId
87
- }) {
88
- try {
89
- if (!workflowId) {
90
- throw new HTTPException(400, { message: "Workflow ID is required" });
91
- }
92
- if (!runId) {
93
- throw new HTTPException(400, { message: "Run ID is required" });
94
- }
95
- const workflow = mastra.getWorkflow(workflowId);
96
- if (!workflow) {
97
- throw new HTTPException(404, { message: "Workflow not found" });
98
- }
99
- const run = await workflow.getWorkflowRunById(runId);
100
- if (!run) {
101
- throw new HTTPException(404, { message: "Workflow run not found" });
102
- }
103
- return run;
104
- } catch (error) {
105
- throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
106
- }
107
- }
108
- async function createWorkflowRunHandler({
109
- mastra,
110
- workflowId,
111
- runId: prevRunId
112
- }) {
113
- try {
114
- if (!workflowId) {
115
- throw new HTTPException(400, { message: "Workflow ID is required" });
116
- }
117
- const workflow = mastra.getWorkflow(workflowId);
118
- if (!workflow) {
119
- throw new HTTPException(404, { message: "Workflow not found" });
120
- }
121
- const run = workflow.createRun({ runId: prevRunId });
122
- return { runId: run.runId };
123
- } catch (error) {
124
- throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
125
- }
126
- }
127
- async function startAsyncWorkflowHandler({
128
- mastra,
129
- runtimeContext,
130
- workflowId,
131
- runId,
132
- inputData,
133
- runtimeContextFromRequest
134
- }) {
135
- try {
136
- if (!workflowId) {
137
- throw new HTTPException(400, { message: "Workflow ID is required" });
138
- }
139
- const workflow = mastra.getWorkflow(workflowId);
140
- if (!workflow) {
141
- throw new HTTPException(404, { message: "Workflow not found" });
142
- }
143
- const finalRuntimeContext = new RuntimeContext([
144
- ...Array.from(runtimeContext?.entries() ?? []),
145
- ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
146
- ]);
147
- const _run = workflow.createRun({ runId });
148
- const result = await _run.start({
149
- inputData,
150
- runtimeContext: finalRuntimeContext
151
- });
152
- return result;
153
- } catch (error) {
154
- throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
155
- }
156
- }
157
- async function startWorkflowRunHandler({
158
- mastra,
159
- runtimeContext,
160
- workflowId,
161
- runId,
162
- inputData,
163
- runtimeContextFromRequest
164
- }) {
165
- try {
166
- if (!workflowId) {
167
- throw new HTTPException(400, { message: "Workflow ID is required" });
168
- }
169
- if (!runId) {
170
- throw new HTTPException(400, { message: "runId required to start run" });
171
- }
172
- const workflow = mastra.getWorkflow(workflowId);
173
- const run = await workflow.getWorkflowRunById(runId);
174
- if (!run) {
175
- throw new HTTPException(404, { message: "Workflow run not found" });
176
- }
177
- const finalRuntimeContext = new RuntimeContext([
178
- ...Array.from(runtimeContext?.entries() ?? []),
179
- ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
180
- ]);
181
- const _run = workflow.createRun({ runId });
182
- void _run.start({
183
- inputData,
184
- runtimeContext: finalRuntimeContext
185
- });
186
- return { message: "Workflow run started" };
187
- } catch (e) {
188
- return handleError(e, "Error starting workflow run");
189
- }
190
- }
191
- async function watchWorkflowHandler({
192
- mastra,
193
- workflowId,
194
- runId
195
- }) {
196
- try {
197
- if (!workflowId) {
198
- throw new HTTPException(400, { message: "Workflow ID is required" });
199
- }
200
- if (!runId) {
201
- throw new HTTPException(400, { message: "runId required to watch workflow" });
202
- }
203
- const workflow = mastra.getWorkflow(workflowId);
204
- const run = await workflow.getWorkflowRunById(runId);
205
- if (!run) {
206
- throw new HTTPException(404, { message: "Workflow run not found" });
207
- }
208
- const _run = workflow.createRun({ runId });
209
- let unwatch;
210
- let asyncRef = null;
211
- const stream = new ReadableStream({
212
- start(controller) {
213
- unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
214
- controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
215
- if (asyncRef) {
216
- clearImmediate(asyncRef);
217
- asyncRef = null;
218
- }
219
- asyncRef = setImmediate(async () => {
220
- const runDone = payload.workflowState.status !== "running";
221
- if (runDone) {
222
- controller.close();
223
- unwatch?.();
224
- }
225
- });
226
- });
227
- },
228
- cancel() {
229
- unwatch?.();
230
- }
231
- });
232
- return stream;
233
- } catch (error) {
234
- return handleError(error, "Error watching workflow");
235
- }
236
- }
237
- function streamWorkflowHandler({
238
- mastra,
239
- runtimeContext,
240
- workflowId,
241
- runId,
242
- inputData,
243
- runtimeContextFromRequest
244
- }) {
245
- try {
246
- if (!workflowId) {
247
- throw new HTTPException(400, { message: "Workflow ID is required" });
248
- }
249
- if (!runId) {
250
- throw new HTTPException(400, { message: "runId required to resume workflow" });
251
- }
252
- const workflow = mastra.getWorkflow(workflowId);
253
- if (!workflow) {
254
- throw new HTTPException(404, { message: "Workflow not found" });
255
- }
256
- const finalRuntimeContext = new RuntimeContext([
257
- ...Array.from(runtimeContext?.entries() ?? []),
258
- ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
259
- ]);
260
- const run = workflow.createRun({ runId });
261
- const result = run.stream({
262
- inputData,
263
- runtimeContext: finalRuntimeContext
264
- });
265
- return result;
266
- } catch (error) {
267
- return handleError(error, "Error executing workflow");
268
- }
269
- }
270
- async function resumeAsyncWorkflowHandler({
271
- mastra,
272
- workflowId,
273
- runId,
274
- body,
275
- runtimeContext,
276
- runtimeContextFromRequest
277
- }) {
278
- try {
279
- if (!workflowId) {
280
- throw new HTTPException(400, { message: "Workflow ID is required" });
281
- }
282
- if (!runId) {
283
- throw new HTTPException(400, { message: "runId required to resume workflow" });
284
- }
285
- if (!body.step) {
286
- throw new HTTPException(400, { message: "step required to resume workflow" });
287
- }
288
- const workflow = mastra.getWorkflow(workflowId);
289
- const run = await workflow.getWorkflowRunById(runId);
290
- if (!run) {
291
- throw new HTTPException(404, { message: "Workflow run not found" });
292
- }
293
- const finalRuntimeContext = new RuntimeContext([
294
- ...Array.from(runtimeContext?.entries() ?? []),
295
- ...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
296
- ]);
297
- const _run = workflow.createRun({ runId });
298
- const result = await _run.resume({
299
- step: body.step,
300
- resumeData: body.resumeData,
301
- runtimeContext: finalRuntimeContext
302
- });
303
- return result;
304
- } catch (error) {
305
- return handleError(error, "Error resuming workflow step");
306
- }
307
- }
308
- async function resumeWorkflowHandler({
309
- mastra,
310
- workflowId,
311
- runId,
312
- body,
313
- runtimeContext
314
- }) {
315
- try {
316
- if (!workflowId) {
317
- throw new HTTPException(400, { message: "Workflow ID is required" });
318
- }
319
- if (!runId) {
320
- throw new HTTPException(400, { message: "runId required to resume workflow" });
321
- }
322
- if (!body.step) {
323
- throw new HTTPException(400, { message: "step required to resume workflow" });
324
- }
325
- const workflow = mastra.getWorkflow(workflowId);
326
- const run = await workflow.getWorkflowRunById(runId);
327
- if (!run) {
328
- throw new HTTPException(404, { message: "Workflow run not found" });
329
- }
330
- const _run = workflow.createRun({ runId });
331
- void _run.resume({
332
- step: body.step,
333
- resumeData: body.resumeData,
334
- runtimeContext
335
- });
336
- return { message: "Workflow run resumed" };
337
- } catch (error) {
338
- return handleError(error, "Error resuming workflow");
339
- }
340
- }
341
- async function getWorkflowRunsHandler({
342
- mastra,
343
- workflowId,
344
- fromDate,
345
- toDate,
346
- limit,
347
- offset,
348
- resourceId
349
- }) {
350
- try {
351
- if (!workflowId) {
352
- throw new HTTPException(400, { message: "Workflow ID is required" });
353
- }
354
- const workflow = mastra.getWorkflow(workflowId);
355
- const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
356
- runs: [],
357
- total: 0
358
- };
359
- return workflowRuns;
360
- } catch (error) {
361
- return handleError(error, "Error getting workflow runs");
362
- }
363
- }
364
-
365
- export { createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler, 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 };
@@ -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 };