@mastra/server 0.0.0-course-20250527170450 → 0.0.0-createToolOptions-20250926094418

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 +3806 -0
  2. package/LICENSE.md +11 -42
  3. package/README.md +0 -5
  4. package/dist/chunk-2GDLSAVJ.cjs +197 -0
  5. package/dist/chunk-2GDLSAVJ.cjs.map +1 -0
  6. package/dist/{chunk-H5PTF3Y4.js → chunk-4QCXUEAT.js} +11 -2
  7. package/dist/chunk-4QCXUEAT.js.map +1 -0
  8. package/dist/chunk-4RRMWXQ2.js +3522 -0
  9. package/dist/chunk-4RRMWXQ2.js.map +1 -0
  10. package/dist/chunk-5DP5XZH6.cjs +928 -0
  11. package/dist/chunk-5DP5XZH6.cjs.map +1 -0
  12. package/dist/chunk-5KRXONRF.js +104 -0
  13. package/dist/chunk-5KRXONRF.js.map +1 -0
  14. package/dist/chunk-5N724Q2T.cjs +109 -0
  15. package/dist/chunk-5N724Q2T.cjs.map +1 -0
  16. package/dist/chunk-66YYHFGF.js +761 -0
  17. package/dist/chunk-66YYHFGF.js.map +1 -0
  18. package/dist/chunk-6GMFZ5LK.js +2774 -0
  19. package/dist/chunk-6GMFZ5LK.js.map +1 -0
  20. package/dist/{chunk-P6SCPDYW.js → chunk-6IJWRJZE.js} +114 -137
  21. package/dist/chunk-6IJWRJZE.js.map +1 -0
  22. package/dist/chunk-743UIDHI.cjs +2013 -0
  23. package/dist/chunk-743UIDHI.cjs.map +1 -0
  24. package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
  25. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  26. package/dist/chunk-A3AL7EWJ.js +83 -0
  27. package/dist/chunk-A3AL7EWJ.js.map +1 -0
  28. package/dist/chunk-AK2FXLLB.cjs +849 -0
  29. package/dist/chunk-AK2FXLLB.cjs.map +1 -0
  30. package/dist/chunk-BOVFMBXY.js +607 -0
  31. package/dist/chunk-BOVFMBXY.js.map +1 -0
  32. package/dist/chunk-CML3EOO5.cjs +587 -0
  33. package/dist/chunk-CML3EOO5.cjs.map +1 -0
  34. package/dist/chunk-CY4TP3FK.js +16 -0
  35. package/dist/chunk-CY4TP3FK.js.map +1 -0
  36. package/dist/chunk-EMMSS5I5.cjs +37 -0
  37. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  38. package/dist/chunk-EMNGA4R4.js +845 -0
  39. package/dist/chunk-EMNGA4R4.js.map +1 -0
  40. package/dist/chunk-FALVL2VV.cjs +3525 -0
  41. package/dist/chunk-FALVL2VV.cjs.map +1 -0
  42. package/dist/chunk-FQNT7PI4.js +937 -0
  43. package/dist/chunk-FQNT7PI4.js.map +1 -0
  44. package/dist/chunk-G3PMV62Z.js +33 -0
  45. package/dist/chunk-G3PMV62Z.js.map +1 -0
  46. package/dist/chunk-G4PUALCE.cjs +28 -0
  47. package/dist/chunk-G4PUALCE.cjs.map +1 -0
  48. package/dist/chunk-GU4EWMZB.cjs +769 -0
  49. package/dist/chunk-GU4EWMZB.cjs.map +1 -0
  50. package/dist/chunk-HJQKWRKQ.cjs +764 -0
  51. package/dist/chunk-HJQKWRKQ.cjs.map +1 -0
  52. package/dist/{chunk-YWLUOY3D.cjs → chunk-HVBBFCDH.cjs} +1110 -793
  53. package/dist/chunk-HVBBFCDH.cjs.map +1 -0
  54. package/dist/chunk-HZJRQ5L3.cjs +1411 -0
  55. package/dist/chunk-HZJRQ5L3.cjs.map +1 -0
  56. package/dist/chunk-IGFMAZZ5.cjs +1150 -0
  57. package/dist/chunk-IGFMAZZ5.cjs.map +1 -0
  58. package/dist/chunk-IOQGI4ML.js +931 -0
  59. package/dist/chunk-IOQGI4ML.js.map +1 -0
  60. package/dist/chunk-IYJW2OVQ.js +189 -0
  61. package/dist/chunk-IYJW2OVQ.js.map +1 -0
  62. package/dist/{chunk-HFWCEP5S.js → chunk-JRDEOHAJ.js} +47 -14
  63. package/dist/chunk-JRDEOHAJ.js.map +1 -0
  64. package/dist/{chunk-TJKLBTFB.js → chunk-KM7EJKXV.js} +55 -27
  65. package/dist/chunk-KM7EJKXV.js.map +1 -0
  66. package/dist/{chunk-YIOVBYZH.cjs → chunk-KNGXRN26.cjs} +48 -45
  67. package/dist/chunk-KNGXRN26.cjs.map +1 -0
  68. package/dist/{chunk-OR3CIE2H.js → chunk-KV6VHX4V.js} +29 -7
  69. package/dist/chunk-KV6VHX4V.js.map +1 -0
  70. package/dist/chunk-LF2ZLOFP.js +767 -0
  71. package/dist/chunk-LF2ZLOFP.js.map +1 -0
  72. package/dist/chunk-LJFAAEU7.cjs +167 -0
  73. package/dist/chunk-LJFAAEU7.cjs.map +1 -0
  74. package/dist/chunk-LYPU75T6.js +1147 -0
  75. package/dist/chunk-LYPU75T6.js.map +1 -0
  76. package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
  77. package/dist/chunk-MMROOK5J.js.map +1 -0
  78. package/dist/chunk-N5ID53SA.js +15712 -0
  79. package/dist/chunk-N5ID53SA.js.map +1 -0
  80. package/dist/{chunk-LIVAK2DM.js → chunk-N7F33WAD.js} +1083 -794
  81. package/dist/chunk-N7F33WAD.js.map +1 -0
  82. package/dist/chunk-NG5IVLEZ.js +1012 -0
  83. package/dist/chunk-NG5IVLEZ.js.map +1 -0
  84. package/dist/chunk-NH7XUTIO.js +568 -0
  85. package/dist/chunk-NH7XUTIO.js.map +1 -0
  86. package/dist/chunk-NLWACBE7.cjs +128 -0
  87. package/dist/chunk-NLWACBE7.cjs.map +1 -0
  88. package/dist/chunk-OGW6HHVI.js +1408 -0
  89. package/dist/chunk-OGW6HHVI.js.map +1 -0
  90. package/dist/{chunk-5SN4U5AC.cjs → chunk-OPI3FZYH.cjs} +115 -138
  91. package/dist/chunk-OPI3FZYH.cjs.map +1 -0
  92. package/dist/chunk-OZLRIVC4.cjs +588 -0
  93. package/dist/chunk-OZLRIVC4.cjs.map +1 -0
  94. package/dist/chunk-P7CIEIJ3.js +925 -0
  95. package/dist/chunk-P7CIEIJ3.js.map +1 -0
  96. package/dist/chunk-P7RBMCBE.cjs +934 -0
  97. package/dist/chunk-P7RBMCBE.cjs.map +1 -0
  98. package/dist/chunk-PPYGWINI.cjs +2777 -0
  99. package/dist/chunk-PPYGWINI.cjs.map +1 -0
  100. package/dist/{chunk-MHKNLNAN.cjs → chunk-PWTXZZTR.cjs} +33 -10
  101. package/dist/chunk-PWTXZZTR.cjs.map +1 -0
  102. package/dist/chunk-QNWXF57L.cjs +15748 -0
  103. package/dist/chunk-QNWXF57L.cjs.map +1 -0
  104. package/dist/chunk-RCHEPTZZ.js +2006 -0
  105. package/dist/chunk-RCHEPTZZ.js.map +1 -0
  106. package/dist/chunk-RE4RPXT2.cjs +18 -0
  107. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  108. package/dist/chunk-SIGXR3JT.cjs +1043 -0
  109. package/dist/chunk-SIGXR3JT.cjs.map +1 -0
  110. package/dist/chunk-SPLSYTYW.cjs +88 -0
  111. package/dist/chunk-SPLSYTYW.cjs.map +1 -0
  112. package/dist/chunk-SQY4T6EJ.js +571 -0
  113. package/dist/chunk-SQY4T6EJ.js.map +1 -0
  114. package/dist/chunk-SXENNNR7.cjs +625 -0
  115. package/dist/chunk-SXENNNR7.cjs.map +1 -0
  116. package/dist/{chunk-BNEY4P4P.cjs → chunk-T3TIA3O6.cjs} +20 -18
  117. package/dist/chunk-T3TIA3O6.cjs.map +1 -0
  118. package/dist/{chunk-W7VCKPAD.js → chunk-TTHEEIZ3.js} +19 -16
  119. package/dist/chunk-TTHEEIZ3.js.map +1 -0
  120. package/dist/chunk-TVSIG4JE.cjs +940 -0
  121. package/dist/chunk-TVSIG4JE.cjs.map +1 -0
  122. package/dist/chunk-VY4ENABS.cjs +135 -0
  123. package/dist/chunk-VY4ENABS.cjs.map +1 -0
  124. package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
  125. package/dist/chunk-WHN4VX55.js.map +1 -0
  126. package/dist/chunk-YWOK4F5A.js +131 -0
  127. package/dist/chunk-YWOK4F5A.js.map +1 -0
  128. package/dist/dist-26HWEQY6.js +3 -0
  129. package/dist/dist-26HWEQY6.js.map +1 -0
  130. package/dist/dist-3A5DXB37.cjs +20 -0
  131. package/dist/dist-3A5DXB37.cjs.map +1 -0
  132. package/dist/dist-3SJKQJGY.cjs +16 -0
  133. package/dist/dist-3SJKQJGY.cjs.map +1 -0
  134. package/dist/dist-4ZQSPE5K.js +3 -0
  135. package/dist/dist-4ZQSPE5K.js.map +1 -0
  136. package/dist/dist-5W5QNRTD.js +3 -0
  137. package/dist/dist-5W5QNRTD.js.map +1 -0
  138. package/dist/dist-653SRMPL.js +3 -0
  139. package/dist/dist-653SRMPL.js.map +1 -0
  140. package/dist/dist-6U6EFC5C.cjs +16 -0
  141. package/dist/dist-6U6EFC5C.cjs.map +1 -0
  142. package/dist/dist-7IHNNYMF.cjs +16 -0
  143. package/dist/dist-7IHNNYMF.cjs.map +1 -0
  144. package/dist/dist-B5IPRF6W.js +3 -0
  145. package/dist/dist-B5IPRF6W.js.map +1 -0
  146. package/dist/dist-EOMYFT4Y.cjs +16 -0
  147. package/dist/dist-EOMYFT4Y.cjs.map +1 -0
  148. package/dist/dist-EZZMMMNT.cjs +16 -0
  149. package/dist/dist-EZZMMMNT.cjs.map +1 -0
  150. package/dist/dist-F2ET4MNO.cjs +16 -0
  151. package/dist/dist-F2ET4MNO.cjs.map +1 -0
  152. package/dist/dist-H64VX6DE.js +3 -0
  153. package/dist/dist-H64VX6DE.js.map +1 -0
  154. package/dist/dist-HY7RMLJQ.cjs +16 -0
  155. package/dist/dist-HY7RMLJQ.cjs.map +1 -0
  156. package/dist/dist-M6S4P3FJ.js +3 -0
  157. package/dist/dist-M6S4P3FJ.js.map +1 -0
  158. package/dist/dist-NR7QSCQT.js +3 -0
  159. package/dist/dist-NR7QSCQT.js.map +1 -0
  160. package/dist/dist-QLFMCMCX.js +3 -0
  161. package/dist/dist-QLFMCMCX.js.map +1 -0
  162. package/dist/dist-UY46BFRP.js +3 -0
  163. package/dist/dist-UY46BFRP.js.map +1 -0
  164. package/dist/dist-WCQDRTIV.cjs +16 -0
  165. package/dist/dist-WCQDRTIV.cjs.map +1 -0
  166. package/dist/dist-WKYB3LTJ.cjs +16 -0
  167. package/dist/dist-WKYB3LTJ.cjs.map +1 -0
  168. package/dist/index.cjs +6 -0
  169. package/dist/index.cjs.map +1 -0
  170. package/dist/index.d.ts +1 -0
  171. package/dist/index.d.ts.map +1 -0
  172. package/dist/index.js +5 -0
  173. package/dist/index.js.map +1 -0
  174. package/dist/server/a2a/protocol.d.ts +8 -0
  175. package/dist/server/a2a/protocol.d.ts.map +1 -0
  176. package/dist/server/a2a/store.cjs +25 -0
  177. package/dist/server/a2a/store.cjs.map +1 -0
  178. package/dist/server/a2a/store.d.ts +14 -0
  179. package/dist/server/a2a/store.d.ts.map +1 -0
  180. package/dist/server/a2a/store.js +23 -0
  181. package/dist/server/a2a/store.js.map +1 -0
  182. package/dist/server/a2a/tasks.d.ts +20 -0
  183. package/dist/server/a2a/tasks.d.ts.map +1 -0
  184. package/dist/server/handlers/a2a.cjs +13 -11
  185. package/dist/server/handlers/a2a.cjs.map +1 -0
  186. package/dist/server/handlers/a2a.d.ts +68 -6
  187. package/dist/server/handlers/a2a.d.ts.map +1 -0
  188. package/dist/server/handlers/a2a.js +3 -1
  189. package/dist/server/handlers/a2a.js.map +1 -0
  190. package/dist/server/handlers/agent-builder.cjs +68 -0
  191. package/dist/server/handlers/agent-builder.cjs.map +1 -0
  192. package/dist/server/handlers/agent-builder.d.ts +88 -0
  193. package/dist/server/handlers/agent-builder.d.ts.map +1 -0
  194. package/dist/server/handlers/agent-builder.js +3 -0
  195. package/dist/server/handlers/agent-builder.js.map +1 -0
  196. package/dist/server/handlers/agents.cjs +49 -7
  197. package/dist/server/handlers/agents.cjs.map +1 -0
  198. package/dist/server/handlers/agents.d.ts +185 -6
  199. package/dist/server/handlers/agents.d.ts.map +1 -0
  200. package/dist/server/handlers/agents.js +3 -1
  201. package/dist/server/handlers/agents.js.map +1 -0
  202. package/dist/server/handlers/error.cjs +4 -2
  203. package/dist/server/handlers/error.cjs.map +1 -0
  204. package/dist/server/handlers/error.d.ts +2 -1
  205. package/dist/server/handlers/error.d.ts.map +1 -0
  206. package/dist/server/handlers/error.js +3 -1
  207. package/dist/server/handlers/error.js.map +1 -0
  208. package/dist/server/handlers/legacyWorkflows.cjs +13 -11
  209. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  210. package/dist/server/handlers/legacyWorkflows.d.ts +59 -10
  211. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  212. package/dist/server/handlers/legacyWorkflows.js +3 -1
  213. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  214. package/dist/server/handlers/logs.cjs +6 -4
  215. package/dist/server/handlers/logs.cjs.map +1 -0
  216. package/dist/server/handlers/logs.d.ts +34 -3
  217. package/dist/server/handlers/logs.d.ts.map +1 -0
  218. package/dist/server/handlers/logs.js +3 -1
  219. package/dist/server/handlers/logs.js.map +1 -0
  220. package/dist/server/handlers/memory.cjs +39 -9
  221. package/dist/server/handlers/memory.cjs.map +1 -0
  222. package/dist/server/handlers/memory.d.ts +118 -8
  223. package/dist/server/handlers/memory.d.ts.map +1 -0
  224. package/dist/server/handlers/memory.js +3 -1
  225. package/dist/server/handlers/memory.js.map +1 -0
  226. package/dist/server/handlers/observability.cjs +20 -0
  227. package/dist/server/handlers/observability.cjs.map +1 -0
  228. package/dist/server/handlers/observability.d.ts +41 -0
  229. package/dist/server/handlers/observability.d.ts.map +1 -0
  230. package/dist/server/handlers/observability.js +3 -0
  231. package/dist/server/handlers/observability.js.map +1 -0
  232. package/dist/server/handlers/scores.cjs +32 -0
  233. package/dist/server/handlers/scores.cjs.map +1 -0
  234. package/dist/server/handlers/scores.d.ts +251 -0
  235. package/dist/server/handlers/scores.d.ts.map +1 -0
  236. package/dist/server/handlers/scores.js +3 -0
  237. package/dist/server/handlers/scores.js.map +1 -0
  238. package/dist/server/handlers/telemetry.cjs +9 -3
  239. package/dist/server/handlers/telemetry.cjs.map +1 -0
  240. package/dist/server/handlers/telemetry.d.ts +33 -2
  241. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  242. package/dist/server/handlers/telemetry.js +3 -1
  243. package/dist/server/handlers/telemetry.js.map +1 -0
  244. package/dist/server/handlers/tools.cjs +11 -5
  245. package/dist/server/handlers/tools.cjs.map +1 -0
  246. package/dist/server/handlers/tools.d.ts +25 -4
  247. package/dist/server/handlers/tools.d.ts.map +1 -0
  248. package/dist/server/handlers/tools.js +3 -1
  249. package/dist/server/handlers/tools.js.map +1 -0
  250. package/dist/server/handlers/utils.cjs +8 -2
  251. package/dist/server/handlers/utils.cjs.map +1 -0
  252. package/dist/server/handlers/utils.d.ts +8 -1
  253. package/dist/server/handlers/utils.d.ts.map +1 -0
  254. package/dist/server/handlers/utils.js +3 -1
  255. package/dist/server/handlers/utils.js.map +1 -0
  256. package/dist/server/handlers/vNextNetwork.cjs +220 -0
  257. package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
  258. package/dist/server/handlers/vNextNetwork.d.ts +246 -0
  259. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
  260. package/dist/server/handlers/vNextNetwork.js +213 -0
  261. package/dist/server/handlers/vNextNetwork.js.map +1 -0
  262. package/dist/server/handlers/vector.cjs +9 -7
  263. package/dist/server/handlers/vector.cjs.map +1 -0
  264. package/dist/server/handlers/vector.d.ts +51 -6
  265. package/dist/server/handlers/vector.d.ts.map +1 -0
  266. package/dist/server/handlers/vector.js +3 -1
  267. package/dist/server/handlers/vector.js.map +1 -0
  268. package/dist/server/handlers/voice.cjs +10 -4
  269. package/dist/server/handlers/voice.cjs.map +1 -0
  270. package/dist/server/handlers/voice.d.ts +41 -3
  271. package/dist/server/handlers/voice.d.ts.map +1 -0
  272. package/dist/server/handlers/voice.js +3 -1
  273. package/dist/server/handlers/voice.js.map +1 -0
  274. package/dist/server/handlers/workflows.cjs +38 -12
  275. package/dist/server/handlers/workflows.cjs.map +1 -0
  276. package/dist/server/handlers/workflows.d.ts +82 -11
  277. package/dist/server/handlers/workflows.d.ts.map +1 -0
  278. package/dist/server/handlers/workflows.js +3 -1
  279. package/dist/server/handlers/workflows.js.map +1 -0
  280. package/dist/server/handlers.cjs +44 -32
  281. package/dist/server/handlers.cjs.map +1 -0
  282. package/dist/server/handlers.d.ts +14 -11
  283. package/dist/server/handlers.d.ts.map +1 -0
  284. package/dist/server/handlers.js +15 -11
  285. package/dist/server/handlers.js.map +1 -0
  286. package/dist/server/http-exception.d.ts +87 -0
  287. package/dist/server/http-exception.d.ts.map +1 -0
  288. package/dist/server/types.d.ts +10 -0
  289. package/dist/server/types.d.ts.map +1 -0
  290. package/dist/server/utils.d.ts +44 -0
  291. package/dist/server/utils.d.ts.map +1 -0
  292. package/package.json +51 -21
  293. package/dist/_tsup-dts-rollup.d.cts +0 -830
  294. package/dist/_tsup-dts-rollup.d.ts +0 -830
  295. package/dist/chunk-57CJTIPW.cjs +0 -18
  296. package/dist/chunk-64U3UDTH.cjs +0 -13
  297. package/dist/chunk-75ZPJI57.cjs +0 -9
  298. package/dist/chunk-7DLZLWJV.cjs +0 -55
  299. package/dist/chunk-A3KDUGS7.cjs +0 -239
  300. package/dist/chunk-C7564HUT.js +0 -142
  301. package/dist/chunk-DJJIUEL2.js +0 -211
  302. package/dist/chunk-J3PKLB3A.js +0 -231
  303. package/dist/chunk-KUNQFY2W.js +0 -365
  304. package/dist/chunk-M5ABIP7D.js +0 -11
  305. package/dist/chunk-MLKGABMK.js +0 -7
  306. package/dist/chunk-MMO2HDM6.cjs +0 -378
  307. package/dist/chunk-VPNDC2DI.cjs +0 -148
  308. package/dist/chunk-WFBJJNCK.js +0 -50
  309. package/dist/chunk-Y7UWRW5X.cjs +0 -221
  310. package/dist/chunk-YBVOQN4M.cjs +0 -94
  311. package/dist/chunk-ZE5AAC4I.cjs +0 -138
  312. package/dist/index.d.cts +0 -1
  313. package/dist/server/handlers/a2a.d.cts +0 -6
  314. package/dist/server/handlers/agents.d.cts +0 -6
  315. package/dist/server/handlers/error.d.cts +0 -1
  316. package/dist/server/handlers/legacyWorkflows.d.cts +0 -10
  317. package/dist/server/handlers/logs.d.cts +0 -3
  318. package/dist/server/handlers/memory.d.cts +0 -8
  319. package/dist/server/handlers/network.cjs +0 -22
  320. package/dist/server/handlers/network.d.cts +0 -4
  321. package/dist/server/handlers/network.d.ts +0 -4
  322. package/dist/server/handlers/network.js +0 -1
  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
package/LICENSE.md CHANGED
@@ -1,46 +1,15 @@
1
- # Elastic License 2.0 (ELv2)
1
+ # Apache License 2.0
2
2
 
3
- Copyright (c) 2025 Mastra AI, Inc.
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
4
 
5
- **Acceptance**
6
- By using the software, you agree to all of the terms and conditions below.
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
7
8
 
8
- **Copyright License**
9
- The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
10
 
11
- **Limitations**
12
- You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
13
-
14
- You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
15
-
16
- You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
17
-
18
- **Patents**
19
- The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
20
-
21
- **Notices**
22
- You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
23
-
24
- If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
25
-
26
- **No Other Rights**
27
- These terms do not imply any licenses other than those expressly granted in these terms.
28
-
29
- **Termination**
30
- If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
31
-
32
- **No Liability**
33
- As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
34
-
35
- **Definitions**
36
- The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
37
-
38
- _you_ refers to the individual or entity agreeing to these terms.
39
-
40
- _your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
41
-
42
- _your licenses_ are all the licenses granted to you for the software under these terms.
43
-
44
- _use_ means anything you do with the software requiring one of your licenses.
45
-
46
- _trademark_ means trademarks, service marks, and similar rights.
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
package/README.md CHANGED
@@ -65,8 +65,3 @@ pnpm run pull:openapispec
65
65
  ```
66
66
 
67
67
  within the `@mastra/server` directory.
68
-
69
- ## License
70
-
71
- Released under the Elastic License 2.0. The full license text is available in
72
- this repository.
@@ -0,0 +1,197 @@
1
+ 'use strict';
2
+
3
+ var chunkRE4RPXT2_cjs = require('./chunk-RE4RPXT2.cjs');
4
+ var chunkEMMSS5I5_cjs = require('./chunk-EMMSS5I5.cjs');
5
+
6
+ // src/server/handlers/scores.ts
7
+ var scores_exports = {};
8
+ chunkEMMSS5I5_cjs.__export(scores_exports, {
9
+ getScorerHandler: () => getScorerHandler,
10
+ getScorersHandler: () => getScorersHandler,
11
+ getScoresByEntityIdHandler: () => getScoresByEntityIdHandler,
12
+ getScoresByRunIdHandler: () => getScoresByRunIdHandler,
13
+ getScoresByScorerIdHandler: () => getScoresByScorerIdHandler,
14
+ saveScoreHandler: () => saveScoreHandler
15
+ });
16
+ async function getScorersFromSystem({
17
+ mastra,
18
+ runtimeContext
19
+ }) {
20
+ const agents = mastra.getAgents();
21
+ const workflows = mastra.getWorkflows();
22
+ const scorersMap = /* @__PURE__ */ new Map();
23
+ for (const [agentId, agent] of Object.entries(agents)) {
24
+ const scorers = await agent.getScorers({
25
+ runtimeContext
26
+ }) || {};
27
+ if (Object.keys(scorers).length > 0) {
28
+ for (const [_scorerId, scorer] of Object.entries(scorers)) {
29
+ const scorerName = scorer.scorer.name;
30
+ if (scorersMap.has(scorerName)) {
31
+ scorersMap.get(scorerName)?.agentIds.push(agentId);
32
+ scorersMap.get(scorerName)?.agentNames.push(agent.name);
33
+ } else {
34
+ scorersMap.set(scorerName, {
35
+ workflowIds: [],
36
+ ...scorer,
37
+ agentNames: [agent.name],
38
+ agentIds: [agentId],
39
+ isRegistered: false
40
+ });
41
+ }
42
+ }
43
+ }
44
+ }
45
+ for (const [workflowId, workflow] of Object.entries(workflows)) {
46
+ const scorers = await workflow.getScorers({
47
+ runtimeContext
48
+ }) || {};
49
+ if (Object.keys(scorers).length > 0) {
50
+ for (const [_scorerId, scorer] of Object.entries(scorers)) {
51
+ const scorerName = scorer.scorer.name;
52
+ if (scorersMap.has(scorerName)) {
53
+ scorersMap.get(scorerName)?.workflowIds.push(workflowId);
54
+ } else {
55
+ scorersMap.set(scorerName, {
56
+ agentIds: [],
57
+ agentNames: [],
58
+ ...scorer,
59
+ workflowIds: [workflowId],
60
+ isRegistered: false
61
+ });
62
+ }
63
+ }
64
+ }
65
+ }
66
+ const registeredScorers = await mastra.getScorers();
67
+ for (const [_scorerId, scorer] of Object.entries(registeredScorers || {})) {
68
+ const scorerName = scorer.name;
69
+ if (scorersMap.has(scorerName)) {
70
+ scorersMap.get(scorerName).isRegistered = true;
71
+ } else {
72
+ scorersMap.set(scorerName, {
73
+ scorer,
74
+ agentIds: [],
75
+ agentNames: [],
76
+ workflowIds: [],
77
+ isRegistered: true
78
+ });
79
+ }
80
+ }
81
+ return Object.fromEntries(scorersMap.entries());
82
+ }
83
+ async function getScorersHandler({ mastra, runtimeContext }) {
84
+ const scorers = await getScorersFromSystem({
85
+ mastra,
86
+ runtimeContext
87
+ });
88
+ return scorers;
89
+ }
90
+ async function getScorerHandler({
91
+ mastra,
92
+ scorerId,
93
+ runtimeContext
94
+ }) {
95
+ const scorers = await getScorersFromSystem({
96
+ mastra,
97
+ runtimeContext
98
+ });
99
+ const scorer = scorers[scorerId];
100
+ if (!scorer) {
101
+ return null;
102
+ }
103
+ return scorer;
104
+ }
105
+ async function getScoresByRunIdHandler({
106
+ mastra,
107
+ runId,
108
+ pagination
109
+ }) {
110
+ try {
111
+ const scoreResults = await mastra.getStorage()?.getScoresByRunId?.({
112
+ runId,
113
+ pagination
114
+ }) || { pagination: { total: 0, page: 0, perPage: 0, hasMore: false }, scores: [] };
115
+ return {
116
+ pagination: scoreResults.pagination,
117
+ scores: scoreResults.scores.map((score) => ({ ...score, ...getTraceDetails(score.traceId) }))
118
+ };
119
+ } catch (error) {
120
+ return chunkRE4RPXT2_cjs.handleError(error, "Error getting scores by run id");
121
+ }
122
+ }
123
+ async function getScoresByScorerIdHandler({
124
+ mastra,
125
+ scorerId,
126
+ pagination,
127
+ entityId,
128
+ entityType
129
+ }) {
130
+ try {
131
+ const scoreResults = await mastra.getStorage()?.getScoresByScorerId?.({
132
+ scorerId,
133
+ pagination,
134
+ entityId,
135
+ entityType
136
+ }) || { pagination: { total: 0, page: 0, perPage: 0, hasMore: false }, scores: [] };
137
+ return {
138
+ pagination: scoreResults.pagination,
139
+ scores: scoreResults.scores.map((score) => ({ ...score, ...getTraceDetails(score.traceId) }))
140
+ };
141
+ } catch (error) {
142
+ return chunkRE4RPXT2_cjs.handleError(error, "Error getting scores by scorer id");
143
+ }
144
+ }
145
+ async function getScoresByEntityIdHandler({
146
+ mastra,
147
+ entityId,
148
+ entityType,
149
+ pagination
150
+ }) {
151
+ try {
152
+ let entityIdToUse = entityId;
153
+ if (entityType === "AGENT") {
154
+ const agent = mastra.getAgentById(entityId);
155
+ entityIdToUse = agent.id;
156
+ } else if (entityType === "WORKFLOW") {
157
+ const workflow = mastra.getWorkflowById(entityId);
158
+ entityIdToUse = workflow.id;
159
+ }
160
+ const scoreResults = await mastra.getStorage()?.getScoresByEntityId?.({
161
+ entityId: entityIdToUse,
162
+ entityType,
163
+ pagination
164
+ }) || { pagination: { total: 0, page: 0, perPage: 0, hasMore: false }, scores: [] };
165
+ return {
166
+ pagination: scoreResults.pagination,
167
+ scores: scoreResults.scores.map((score) => ({ ...score, ...getTraceDetails(score.traceId) }))
168
+ };
169
+ } catch (error) {
170
+ return chunkRE4RPXT2_cjs.handleError(error, "Error getting scores by entity id");
171
+ }
172
+ }
173
+ function getTraceDetails(traceIdWithSpanId) {
174
+ if (!traceIdWithSpanId) {
175
+ return {};
176
+ }
177
+ const [traceId, spanId] = traceIdWithSpanId.split("-");
178
+ return { traceId, spanId };
179
+ }
180
+ async function saveScoreHandler({ mastra, score }) {
181
+ try {
182
+ const scores = await mastra.getStorage()?.saveScore?.(score) || [];
183
+ return scores;
184
+ } catch (error) {
185
+ return chunkRE4RPXT2_cjs.handleError(error, "Error saving score");
186
+ }
187
+ }
188
+
189
+ exports.getScorerHandler = getScorerHandler;
190
+ exports.getScorersHandler = getScorersHandler;
191
+ exports.getScoresByEntityIdHandler = getScoresByEntityIdHandler;
192
+ exports.getScoresByRunIdHandler = getScoresByRunIdHandler;
193
+ exports.getScoresByScorerIdHandler = getScoresByScorerIdHandler;
194
+ exports.saveScoreHandler = saveScoreHandler;
195
+ exports.scores_exports = scores_exports;
196
+ //# sourceMappingURL=chunk-2GDLSAVJ.cjs.map
197
+ //# sourceMappingURL=chunk-2GDLSAVJ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/handlers/scores.ts"],"names":["__export","handleError"],"mappings":";;;;;;AAAA,IAAA,cAAA,GAAA;AAAAA,0BAAA,CAAA,cAAA,EAAA;AAAA,EAAA,gBAAA,EAAA,MAAA,gBAAA;AAAA,EAAA,iBAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,0BAAA,EAAA,MAAA,0BAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,0BAAA,EAAA,MAAA,0BAAA;AAAA,EAAA,gBAAA,EAAA,MAAA;AAAA,CAAA,CAAA;AAMA,eAAe,oBAAA,CAAqB;AAAA,EAClC,MAAA;AAAA,EACA;AACF,CAAA,EAEG;AACD,EAAA,MAAM,MAAA,GAAS,OAAO,SAAA,EAAU;AAChC,EAAA,MAAM,SAAA,GAAY,OAAO,YAAA,EAAa;AAEtC,EAAA,MAAM,UAAA,uBAAiB,GAAA,EAGrB;AAEF,EAAA,KAAA,MAAW,CAAC,OAAA,EAAS,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,EAAG;AACrD,IAAA,MAAM,OAAA,GACH,MAAM,KAAA,CAAM,UAAA,CAAW;AAAA,MACtB;AAAA,KACD,KAAM,EAAC;AAEV,IAAA,IAAI,MAAA,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AA,EAAM,EAAG,MAAA,EAAQ,EAAC,EAAE;AAEnF,IAAA,OAAO;AAAA,MACL,YAAY,YAAA,CAAa,UAAA;AAAA,MACzB,MAAA,EAAQ,YAAA,CAAa,MAAA,CAAO,GAAA,CAAI,CAAA,KAAA,MAAU,EAAE,GAAG,KAAA,EAAO,GAAG,eAAA,CAAgB,KAAA,CAAM,OAAO,GAAE,CAAE;AAAA,KAC5F;AAAA,EACF,SAAS,KAAA,EAAO;AACd,IAAA,OAAOA,6BAAA,CAAY,OAAO,mCAAmC,CAAA;AAAA,EAC/D;AACF;AAEA,SAAS,gBAAgB,iBAAA,EAA4B;AACnD,EAAA,IAAI,CAAC,iBAAA,EAAmB;AACtB,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,MAAM,CAAC,OAAA,EAAS,MAAM,CAAA,GAAI,iBAAA,CAAkB,MAAM,GAAG,CAAA;AACrD,EAAA,OAAO,EAAE,SAAS,MAAA,EAAO;AAC3B;AAEA,eAAsB,gBAAA,CAAiB,EAAE,MAAA,EAAQ,KAAA,EAAM,EAAsC;AAC3F,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAU,MAAM,MAAA,CAAO,UAAA,IAAc,SAAA,GAAY,KAAK,KAAM,EAAC;AACnE,IAAA,OAAO,MAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,OAAOA,6BAAA,CAAY,OAAO,oBAAoB,CAAA;AAAA,EAChD;AACF","file":"chunk-2GDLSAVJ.cjs","sourcesContent":["import type { RuntimeContext } from '@mastra/core/runtime-context';\nimport type { MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';\nimport type { StoragePagination } from '@mastra/core/storage';\nimport type { Context } from '../types';\nimport { handleError } from './error';\n\nasync function getScorersFromSystem({\n mastra,\n runtimeContext,\n}: Context & {\n runtimeContext: RuntimeContext;\n}) {\n const agents = mastra.getAgents();\n const workflows = mastra.getWorkflows();\n\n const scorersMap = new Map<\n string,\n MastraScorerEntry & { agentIds: string[]; agentNames: string[]; workflowIds: string[]; isRegistered: boolean }\n >();\n\n for (const [agentId, agent] of Object.entries(agents)) {\n const scorers =\n (await agent.getScorers({\n runtimeContext,\n })) || {};\n\n if (Object.keys(scorers).length > 0) {\n for (const [_scorerId, scorer] of Object.entries(scorers)) {\n const scorerName = scorer.scorer.name;\n if (scorersMap.has(scorerName)) {\n scorersMap.get(scorerName)?.agentIds.push(agentId);\n scorersMap.get(scorerName)?.agentNames.push(agent.name);\n } else {\n scorersMap.set(scorerName, {\n workflowIds: [],\n ...scorer,\n agentNames: [agent.name],\n agentIds: [agentId],\n isRegistered: false,\n });\n }\n }\n }\n }\n\n for (const [workflowId, workflow] of Object.entries(workflows)) {\n const scorers =\n (await workflow.getScorers({\n runtimeContext,\n })) || {};\n\n if (Object.keys(scorers).length > 0) {\n for (const [_scorerId, scorer] of Object.entries(scorers)) {\n const scorerName = scorer.scorer.name;\n if (scorersMap.has(scorerName)) {\n scorersMap.get(scorerName)?.workflowIds.push(workflowId);\n } else {\n scorersMap.set(scorerName, {\n agentIds: [],\n agentNames: [],\n ...scorer,\n workflowIds: [workflowId],\n isRegistered: false,\n });\n }\n }\n }\n }\n\n const registeredScorers = await mastra.getScorers();\n for (const [_scorerId, scorer] of Object.entries(registeredScorers || {})) {\n const scorerName = scorer.name;\n if (scorersMap.has(scorerName)) {\n scorersMap.get(scorerName)!.isRegistered = true;\n } else {\n scorersMap.set(scorerName, {\n scorer: scorer,\n agentIds: [],\n agentNames: [],\n workflowIds: [],\n isRegistered: true,\n });\n }\n }\n\n return Object.fromEntries(scorersMap.entries());\n}\n\nexport async function getScorersHandler({ mastra, runtimeContext }: Context & { runtimeContext: RuntimeContext }) {\n const scorers = await getScorersFromSystem({\n mastra,\n runtimeContext,\n });\n\n return scorers;\n}\n\nexport async function getScorerHandler({\n mastra,\n scorerId,\n runtimeContext,\n}: Context & { scorerId: string; runtimeContext: RuntimeContext }) {\n const scorers = await getScorersFromSystem({\n mastra,\n runtimeContext,\n });\n\n const scorer = scorers[scorerId];\n\n if (!scorer) {\n return null;\n }\n\n return scorer;\n}\n\nexport async function getScoresByRunIdHandler({\n mastra,\n runId,\n pagination,\n}: Context & { runId: string; pagination: StoragePagination }) {\n try {\n const scoreResults = (await mastra.getStorage()?.getScoresByRunId?.({\n runId,\n pagination,\n })) || { pagination: { total: 0, page: 0, perPage: 0, hasMore: false }, scores: [] };\n return {\n pagination: scoreResults.pagination,\n scores: scoreResults.scores.map(score => ({ ...score, ...getTraceDetails(score.traceId) })),\n };\n } catch (error) {\n return handleError(error, 'Error getting scores by run id');\n }\n}\n\nexport async function getScoresByScorerIdHandler({\n mastra,\n scorerId,\n pagination,\n entityId,\n entityType,\n}: Context & { scorerId: string; pagination: StoragePagination; entityId?: string; entityType?: string }) {\n try {\n const scoreResults = (await mastra.getStorage()?.getScoresByScorerId?.({\n scorerId,\n pagination,\n entityId,\n entityType,\n })) || { pagination: { total: 0, page: 0, perPage: 0, hasMore: false }, scores: [] };\n return {\n pagination: scoreResults.pagination,\n scores: scoreResults.scores.map(score => ({ ...score, ...getTraceDetails(score.traceId) })),\n };\n } catch (error) {\n return handleError(error, 'Error getting scores by scorer id');\n }\n}\n\nexport async function getScoresByEntityIdHandler({\n mastra,\n entityId,\n entityType,\n pagination,\n}: Context & { entityId: string; entityType: string; pagination: StoragePagination }) {\n try {\n let entityIdToUse = entityId;\n\n if (entityType === 'AGENT') {\n const agent = mastra.getAgentById(entityId);\n entityIdToUse = agent.id;\n } else if (entityType === 'WORKFLOW') {\n const workflow = mastra.getWorkflowById(entityId);\n entityIdToUse = workflow.id;\n }\n\n const scoreResults = (await mastra.getStorage()?.getScoresByEntityId?.({\n entityId: entityIdToUse,\n entityType,\n pagination,\n })) || { pagination: { total: 0, page: 0, perPage: 0, hasMore: false }, scores: [] };\n\n return {\n pagination: scoreResults.pagination,\n scores: scoreResults.scores.map(score => ({ ...score, ...getTraceDetails(score.traceId) })),\n };\n } catch (error) {\n return handleError(error, 'Error getting scores by entity id');\n }\n}\n\nfunction getTraceDetails(traceIdWithSpanId?: string) {\n if (!traceIdWithSpanId) {\n return {};\n }\n\n const [traceId, spanId] = traceIdWithSpanId.split('-');\n return { traceId, spanId };\n}\n\nexport async function saveScoreHandler({ mastra, score }: Context & { score: ScoreRowData }) {\n try {\n const scores = (await mastra.getStorage()?.saveScore?.(score)) || [];\n return scores;\n } catch (error) {\n return handleError(error, 'Error saving score');\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { HTTPException } from './chunk-NYN7KFXL.js';
1
+ import { HTTPException } from './chunk-MMROOK5J.js';
2
2
 
3
3
  // src/server/handlers/utils.ts
4
4
  function validateBody(body) {
@@ -12,5 +12,14 @@ function validateBody(body) {
12
12
  throw new HTTPException(400, { message: Object.values(errorResponse)[0] });
13
13
  }
14
14
  }
15
+ function sanitizeBody(body, disallowedKeys) {
16
+ for (const key of disallowedKeys) {
17
+ if (key in body) {
18
+ delete body[key];
19
+ }
20
+ }
21
+ }
15
22
 
16
- export { validateBody };
23
+ export { sanitizeBody, validateBody };
24
+ //# sourceMappingURL=chunk-4QCXUEAT.js.map
25
+ //# sourceMappingURL=chunk-4QCXUEAT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/handlers/utils.ts"],"names":[],"mappings":";;;AAGO,SAAS,aAAa,IAAA,EAA+B;AAC1D,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,OAAA,CAAQ,IAAI,CAAA,CAAE,MAAA,CAA+B,CAAC,GAAA,EAAK,CAAC,GAAA,EAAK,KAAK,CAAA,KAAM;AAC/F,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,GAAA,CAAI,GAAG,CAAA,GAAI,CAAA,UAAA,EAAa,GAAG,CAAA,aAAA,CAAA;AAAA,IAC7B;AACA,IAAA,OAAO,GAAA;AAAA,EACT,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,IAAI,MAAA,CAAO,IAAA,CAAK,aAAa,CAAA,CAAE,SAAS,CAAA,EAAG;AACzC,IAAA,MAAM,IAAI,aAAA,CAAc,GAAA,EAAK,EAAE,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,aAAa,CAAA,CAAE,CAAC,CAAA,EAAG,CAAA;AAAA,EAC3E;AACF;AAOO,SAAS,YAAA,CAAa,MAA+B,cAAA,EAA0B;AACpF,EAAA,KAAA,MAAW,OAAO,cAAA,EAAgB;AAChC,IAAA,IAAI,OAAO,IAAA,EAAM;AACf,MAAA,OAAO,KAAK,GAAG,CAAA;AAAA,IACjB;AAAA,EACF;AACF","file":"chunk-4QCXUEAT.js","sourcesContent":["import { HTTPException } from '../http-exception';\n\n// Validation helper\nexport function validateBody(body: Record<string, unknown>) {\n const errorResponse = Object.entries(body).reduce<Record<string, string>>((acc, [key, value]) => {\n if (!value) {\n acc[key] = `Argument \"${key}\" is required`;\n }\n return acc;\n }, {});\n\n if (Object.keys(errorResponse).length > 0) {\n throw new HTTPException(400, { message: Object.values(errorResponse)[0] });\n }\n}\n\n/**\n * sanitizes the body by removing disallowed keys.\n * @param body body to sanitize\n * @param disallowedKeys keys to remove from the body\n */\nexport function sanitizeBody(body: Record<string, unknown>, disallowedKeys: string[]) {\n for (const key of disallowedKeys) {\n if (key in body) {\n delete body[key];\n }\n }\n}\n"]}