@mastra/server 1.0.4 → 1.1.0-alpha.1

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 (333) hide show
  1. package/CHANGELOG.md +194 -0
  2. package/a2a/store.d.ts +1 -0
  3. package/auth.d.ts +1 -0
  4. package/dist/{chunk-3REGEJEN.js → chunk-24SISJRB.js} +6 -6
  5. package/dist/chunk-24SISJRB.js.map +1 -0
  6. package/dist/{chunk-MPUVSOEU.cjs → chunk-2HOMKKY4.cjs} +21 -15
  7. package/dist/chunk-2HOMKKY4.cjs.map +1 -0
  8. package/dist/{chunk-HCVDHEDD.cjs → chunk-37DO73XV.cjs} +217 -167
  9. package/dist/chunk-37DO73XV.cjs.map +1 -0
  10. package/dist/{chunk-T4SPG2GP.cjs → chunk-4HFYR562.cjs} +4 -4
  11. package/dist/chunk-4HFYR562.cjs.map +1 -0
  12. package/dist/{chunk-2CYGIE3E.js → chunk-4JAEBN6N.js} +212 -86
  13. package/dist/chunk-4JAEBN6N.js.map +1 -0
  14. package/dist/{chunk-AVRO3FIN.cjs → chunk-4LVJBXI2.cjs} +97 -4
  15. package/dist/chunk-4LVJBXI2.cjs.map +1 -0
  16. package/dist/chunk-4UNYZYBB.cjs +253 -0
  17. package/dist/chunk-4UNYZYBB.cjs.map +1 -0
  18. package/dist/{chunk-CGIGPJRU.js → chunk-5P2VGES5.js} +72 -79
  19. package/dist/chunk-5P2VGES5.js.map +1 -0
  20. package/dist/{chunk-YK63KHHB.cjs → chunk-6DHJKQLP.cjs} +513 -168
  21. package/dist/chunk-6DHJKQLP.cjs.map +1 -0
  22. package/dist/{chunk-PNZQCQY4.cjs → chunk-6G2RQWKA.cjs} +15 -15
  23. package/dist/chunk-6G2RQWKA.cjs.map +1 -0
  24. package/dist/{chunk-4EYONQIW.cjs → chunk-7D3UAMQM.cjs} +4 -4
  25. package/dist/chunk-7D3UAMQM.cjs.map +1 -0
  26. package/dist/{chunk-I27H7BEB.js → chunk-7XIMPDJV.js} +9 -6
  27. package/dist/chunk-7XIMPDJV.js.map +1 -0
  28. package/dist/{chunk-2CLS2PYJ.js → chunk-7YCFHDWX.js} +398 -56
  29. package/dist/chunk-7YCFHDWX.js.map +1 -0
  30. package/dist/{chunk-33CKPQS4.cjs → chunk-A2K5ZL47.cjs} +36 -16
  31. package/dist/chunk-A2K5ZL47.cjs.map +1 -0
  32. package/dist/chunk-AAHPYUEC.cjs +211 -0
  33. package/dist/chunk-AAHPYUEC.cjs.map +1 -0
  34. package/dist/{chunk-NUO7HPOV.cjs → chunk-AN42MFD5.cjs} +235 -109
  35. package/dist/chunk-AN42MFD5.cjs.map +1 -0
  36. package/dist/{chunk-XCEQ4GQW.cjs → chunk-AO7LIZRK.cjs} +88 -99
  37. package/dist/chunk-AO7LIZRK.cjs.map +1 -0
  38. package/dist/{chunk-4DJ7EJRB.cjs → chunk-AV3VZ6S3.cjs} +25 -21
  39. package/dist/chunk-AV3VZ6S3.cjs.map +1 -0
  40. package/dist/{chunk-KKY4MSZO.js → chunk-BWINB344.js} +30 -11
  41. package/dist/chunk-BWINB344.js.map +1 -0
  42. package/dist/{chunk-GHQZIEPS.js → chunk-C4NZAUUW.js} +104 -54
  43. package/dist/chunk-C4NZAUUW.js.map +1 -0
  44. package/dist/{chunk-7S7ALPCY.js → chunk-D5VCL56B.js} +97 -5
  45. package/dist/chunk-D5VCL56B.js.map +1 -0
  46. package/dist/{chunk-XB27LCKO.js → chunk-DHDVJ5II.js} +15 -9
  47. package/dist/chunk-DHDVJ5II.js.map +1 -0
  48. package/dist/{chunk-GNCALVLC.js → chunk-ED6NQBHF.js} +23 -4
  49. package/dist/chunk-ED6NQBHF.js.map +1 -0
  50. package/dist/{chunk-5VDI75UV.js → chunk-EV5H2JQU.js} +5 -4
  51. package/dist/chunk-EV5H2JQU.js.map +1 -0
  52. package/dist/{chunk-4R2Z655M.js → chunk-F2WTCJ5C.js} +145 -67
  53. package/dist/chunk-F2WTCJ5C.js.map +1 -0
  54. package/dist/{chunk-FWSKVWS7.cjs → chunk-FRRHYZR6.cjs} +4 -4
  55. package/dist/chunk-FRRHYZR6.cjs.map +1 -0
  56. package/dist/chunk-GDWZ2R7I.js +220 -0
  57. package/dist/chunk-GDWZ2R7I.js.map +1 -0
  58. package/dist/{chunk-N4EIZSG2.js → chunk-GXUBQJ74.js} +15 -11
  59. package/dist/chunk-GXUBQJ74.js.map +1 -0
  60. package/dist/{chunk-UK4FZWNW.cjs → chunk-H4VFL22H.cjs} +52 -53
  61. package/dist/chunk-H4VFL22H.cjs.map +1 -0
  62. package/dist/chunk-H66LLFDL.js +1 -1
  63. package/dist/chunk-H66LLFDL.js.map +1 -1
  64. package/dist/{chunk-QPFYN6B5.cjs → chunk-HDGF45K7.cjs} +17 -14
  65. package/dist/chunk-HDGF45K7.cjs.map +1 -0
  66. package/dist/{chunk-P3H4AZKI.cjs → chunk-HZINLMHL.cjs} +15 -15
  67. package/dist/chunk-HZINLMHL.cjs.map +1 -0
  68. package/dist/{chunk-AV3CN5ZR.cjs → chunk-I3CJUT6J.cjs} +36 -17
  69. package/dist/chunk-I3CJUT6J.cjs.map +1 -0
  70. package/dist/{chunk-DVSCJECS.js → chunk-IS3HHGL4.js} +6 -6
  71. package/dist/chunk-IS3HHGL4.js.map +1 -0
  72. package/dist/{chunk-WJ6DNHLW.cjs → chunk-JRM3DWRM.cjs} +34 -24
  73. package/dist/chunk-JRM3DWRM.cjs.map +1 -0
  74. package/dist/{chunk-YN3FWKVQ.js → chunk-JUGGEWCR.js} +10 -13
  75. package/dist/chunk-JUGGEWCR.js.map +1 -0
  76. package/dist/{chunk-LF2ZLOFP.js → chunk-K2SXZLA3.cjs} +285 -3
  77. package/dist/chunk-K2SXZLA3.cjs.map +1 -0
  78. package/dist/{chunk-XOUK3IYU.js → chunk-K4HSW5ZF.js} +4 -4
  79. package/dist/chunk-K4HSW5ZF.js.map +1 -0
  80. package/dist/chunk-KPHPNRVH.js +651 -0
  81. package/dist/chunk-KPHPNRVH.js.map +1 -0
  82. package/dist/chunk-L6AKFVEX.cjs +678 -0
  83. package/dist/chunk-L6AKFVEX.cjs.map +1 -0
  84. package/dist/{chunk-GU4EWMZB.cjs → chunk-LFNP3ACE.js} +244 -4
  85. package/dist/chunk-LFNP3ACE.js.map +1 -0
  86. package/dist/chunk-LFTVDHOD.js +200 -0
  87. package/dist/chunk-LFTVDHOD.js.map +1 -0
  88. package/dist/{chunk-ZQ2G6QKS.cjs → chunk-MZRJNOYJ.cjs} +175 -97
  89. package/dist/chunk-MZRJNOYJ.cjs.map +1 -0
  90. package/dist/{chunk-G2AMUTU4.js → chunk-OS7SAIRA.js} +6 -6
  91. package/dist/chunk-OS7SAIRA.js.map +1 -0
  92. package/dist/{chunk-L2E5RUVT.cjs → chunk-PWXUI3OG.cjs} +15 -15
  93. package/dist/chunk-PWXUI3OG.cjs.map +1 -0
  94. package/dist/chunk-QRPQWZZU.cjs +708 -0
  95. package/dist/chunk-QRPQWZZU.cjs.map +1 -0
  96. package/dist/chunk-QWOQET2T.js +689 -0
  97. package/dist/chunk-QWOQET2T.js.map +1 -0
  98. package/dist/{chunk-EUBTCHQC.js → chunk-RIX6WEJ2.js} +4 -4
  99. package/dist/chunk-RIX6WEJ2.js.map +1 -0
  100. package/dist/{chunk-7XPMKW4Y.cjs → chunk-SONAXR2M.cjs} +12 -9
  101. package/dist/chunk-SONAXR2M.cjs.map +1 -0
  102. package/dist/{chunk-FLLJIPD4.cjs → chunk-T5KH32UA.cjs} +6 -5
  103. package/dist/chunk-T5KH32UA.cjs.map +1 -0
  104. package/dist/{chunk-3FEYUHHJ.js → chunk-TCWPL26W.js} +10 -7
  105. package/dist/chunk-TCWPL26W.js.map +1 -0
  106. package/dist/chunk-USR6JK77.js +62 -0
  107. package/dist/chunk-USR6JK77.js.map +1 -0
  108. package/dist/chunk-VX3VN7FN.cjs +1 -1
  109. package/dist/chunk-VX3VN7FN.cjs.map +1 -1
  110. package/dist/{chunk-6MP2S6VI.cjs → chunk-VXPVROQJ.cjs} +56 -48
  111. package/dist/chunk-VXPVROQJ.cjs.map +1 -0
  112. package/dist/{chunk-CLAEGIP5.cjs → chunk-WWVDNKEF.cjs} +14 -17
  113. package/dist/chunk-WWVDNKEF.cjs.map +1 -0
  114. package/dist/{chunk-5NFRDYFN.js → chunk-XKLJYRAA.js} +4 -4
  115. package/dist/chunk-XKLJYRAA.js.map +1 -0
  116. package/dist/{chunk-TMS4LS2J.js → chunk-XUSAKRLX.js} +26 -16
  117. package/dist/chunk-XUSAKRLX.js.map +1 -0
  118. package/dist/{chunk-IVGQTL3T.js → chunk-XXBURIYX.js} +36 -28
  119. package/dist/chunk-XXBURIYX.js.map +1 -0
  120. package/dist/{chunk-H34VRYSF.js → chunk-ZFHZRI6C.js} +26 -27
  121. package/dist/chunk-ZFHZRI6C.js.map +1 -0
  122. package/dist/chunk-ZKMVCV4G.cjs +71 -0
  123. package/dist/chunk-ZKMVCV4G.cjs.map +1 -0
  124. package/dist/docs/README.md +1 -1
  125. package/dist/docs/SKILL.md +1 -1
  126. package/dist/docs/SOURCE_MAP.json +1 -1
  127. package/dist/docs/server/01-custom-adapters.md +10 -10
  128. package/dist/docs/server/02-reference.md +22 -8
  129. package/dist/server/auth/helpers.d.ts +8 -1
  130. package/dist/server/auth/helpers.d.ts.map +1 -1
  131. package/dist/server/auth/index.cjs +42 -131
  132. package/dist/server/auth/index.cjs.map +1 -1
  133. package/dist/server/auth/index.js +1 -125
  134. package/dist/server/auth/index.js.map +1 -1
  135. package/dist/server/auth/path-pattern.d.ts +43 -0
  136. package/dist/server/auth/path-pattern.d.ts.map +1 -0
  137. package/dist/server/constants.d.ts +51 -0
  138. package/dist/server/constants.d.ts.map +1 -0
  139. package/dist/server/handlers/a2a.cjs +9 -9
  140. package/dist/server/handlers/a2a.d.ts.map +1 -1
  141. package/dist/server/handlers/a2a.js +1 -1
  142. package/dist/server/handlers/agent-builder.cjs +16 -16
  143. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  144. package/dist/server/handlers/agent-builder.js +1 -1
  145. package/dist/server/handlers/agent-versions.cjs +60 -0
  146. package/dist/server/handlers/agent-versions.cjs.map +1 -0
  147. package/dist/server/handlers/agent-versions.d.ts +457 -0
  148. package/dist/server/handlers/agent-versions.d.ts.map +1 -0
  149. package/dist/server/handlers/agent-versions.js +3 -0
  150. package/dist/server/handlers/agent-versions.js.map +1 -0
  151. package/dist/server/handlers/agents.cjs +40 -28
  152. package/dist/server/handlers/agents.d.ts +58 -5
  153. package/dist/server/handlers/agents.d.ts.map +1 -1
  154. package/dist/server/handlers/agents.js +1 -1
  155. package/dist/server/handlers/logs.cjs +4 -4
  156. package/dist/server/handlers/logs.d.ts.map +1 -1
  157. package/dist/server/handlers/logs.js +1 -1
  158. package/dist/server/handlers/mcp.cjs +9 -9
  159. package/dist/server/handlers/mcp.d.ts +22 -0
  160. package/dist/server/handlers/mcp.d.ts.map +1 -1
  161. package/dist/server/handlers/mcp.js +1 -1
  162. package/dist/server/handlers/memory.cjs +25 -25
  163. package/dist/server/handlers/memory.d.ts +25 -1
  164. package/dist/server/handlers/memory.d.ts.map +1 -1
  165. package/dist/server/handlers/memory.js +1 -1
  166. package/dist/server/handlers/observability.cjs +5 -5
  167. package/dist/server/handlers/observability.d.ts +1 -0
  168. package/dist/server/handlers/observability.d.ts.map +1 -1
  169. package/dist/server/handlers/observability.js +1 -1
  170. package/dist/server/handlers/processors.cjs +4 -4
  171. package/dist/server/handlers/processors.d.ts.map +1 -1
  172. package/dist/server/handlers/processors.js +1 -1
  173. package/dist/server/handlers/scores.cjs +7 -7
  174. package/dist/server/handlers/scores.d.ts.map +1 -1
  175. package/dist/server/handlers/scores.js +1 -1
  176. package/dist/server/handlers/stored-agents.cjs +6 -6
  177. package/dist/server/handlers/stored-agents.d.ts +51 -14
  178. package/dist/server/handlers/stored-agents.d.ts.map +1 -1
  179. package/dist/server/handlers/stored-agents.js +1 -1
  180. package/dist/server/handlers/system.cjs +2 -2
  181. package/dist/server/handlers/system.d.ts.map +1 -1
  182. package/dist/server/handlers/system.js +1 -1
  183. package/dist/server/handlers/tools.cjs +6 -6
  184. package/dist/server/handlers/tools.d.ts +3 -3
  185. package/dist/server/handlers/tools.d.ts.map +1 -1
  186. package/dist/server/handlers/tools.js +1 -1
  187. package/dist/server/handlers/utils.cjs +21 -5
  188. package/dist/server/handlers/utils.d.ts +26 -0
  189. package/dist/server/handlers/utils.d.ts.map +1 -1
  190. package/dist/server/handlers/utils.js +1 -1
  191. package/dist/server/handlers/vector.cjs +13 -13
  192. package/dist/server/handlers/vector.d.ts.map +1 -1
  193. package/dist/server/handlers/vector.js +1 -1
  194. package/dist/server/handlers/voice.cjs +8 -8
  195. package/dist/server/handlers/voice.d.ts.map +1 -1
  196. package/dist/server/handlers/voice.js +1 -1
  197. package/dist/server/handlers/workflows.cjs +24 -24
  198. package/dist/server/handlers/workflows.d.ts +2 -0
  199. package/dist/server/handlers/workflows.d.ts.map +1 -1
  200. package/dist/server/handlers/workflows.js +1 -1
  201. package/dist/server/handlers/workspace.cjs +80 -0
  202. package/dist/server/handlers/workspace.cjs.map +1 -0
  203. package/dist/server/handlers/workspace.d.ts +591 -0
  204. package/dist/server/handlers/workspace.d.ts.map +1 -0
  205. package/dist/server/handlers/workspace.js +3 -0
  206. package/dist/server/handlers/workspace.js.map +1 -0
  207. package/dist/server/handlers.cjs +24 -24
  208. package/dist/server/handlers.js +12 -12
  209. package/dist/server/schemas/agent-versions.d.ts +1073 -0
  210. package/dist/server/schemas/agent-versions.d.ts.map +1 -0
  211. package/dist/server/schemas/agents.d.ts +30 -19
  212. package/dist/server/schemas/agents.d.ts.map +1 -1
  213. package/dist/server/schemas/memory.d.ts +83 -31
  214. package/dist/server/schemas/memory.d.ts.map +1 -1
  215. package/dist/server/schemas/stored-agents.d.ts +270 -60
  216. package/dist/server/schemas/stored-agents.d.ts.map +1 -1
  217. package/dist/server/schemas/workspace.d.ts +1107 -0
  218. package/dist/server/schemas/workspace.d.ts.map +1 -0
  219. package/dist/server/server-adapter/index.cjs +298 -160
  220. package/dist/server/server-adapter/index.cjs.map +1 -1
  221. package/dist/server/server-adapter/index.d.ts +56 -2
  222. package/dist/server/server-adapter/index.d.ts.map +1 -1
  223. package/dist/server/server-adapter/index.js +158 -23
  224. package/dist/server/server-adapter/index.js.map +1 -1
  225. package/dist/server/server-adapter/openapi-utils.d.ts +10 -0
  226. package/dist/server/server-adapter/openapi-utils.d.ts.map +1 -1
  227. package/dist/server/server-adapter/routes/agents.d.ts.map +1 -1
  228. package/dist/server/server-adapter/routes/index.d.ts +3 -1
  229. package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
  230. package/dist/server/server-adapter/routes/route-builder.d.ts +2 -1
  231. package/dist/server/server-adapter/routes/route-builder.d.ts.map +1 -1
  232. package/dist/server/server-adapter/routes/stored-agents.d.ts +1 -1
  233. package/dist/server/server-adapter/routes/stored-agents.d.ts.map +1 -1
  234. package/dist/server/server-adapter/routes/workspace.d.ts +8 -0
  235. package/dist/server/server-adapter/routes/workspace.d.ts.map +1 -0
  236. package/dist/server/utils.d.ts +13 -0
  237. package/dist/server/utils.d.ts.map +1 -1
  238. package/dist/{token-6GSAFR2W-K2BTU23I-5WBYUIGY.cjs → token-6GSAFR2W-ABXTQD64-MC4IMVOB.cjs} +9 -9
  239. package/dist/token-6GSAFR2W-ABXTQD64-MC4IMVOB.cjs.map +1 -0
  240. package/dist/{token-6GSAFR2W-VLY2XUPA-NCSASMWN.js → token-6GSAFR2W-ABXTQD64-Z6U2TA2C.js} +6 -6
  241. package/dist/token-6GSAFR2W-ABXTQD64-Z6U2TA2C.js.map +1 -0
  242. package/dist/{token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs → token-6GSAFR2W-F2L44NEJ-B3QIV63M.cjs} +9 -9
  243. package/dist/token-6GSAFR2W-F2L44NEJ-B3QIV63M.cjs.map +1 -0
  244. package/dist/{token-6GSAFR2W-KVDFAJ2M-VW443KIA.js → token-6GSAFR2W-F2L44NEJ-GFZ37A2V.js} +6 -6
  245. package/dist/token-6GSAFR2W-F2L44NEJ-GFZ37A2V.js.map +1 -0
  246. package/dist/{token-6GSAFR2W-VLY2XUPA-RKITWXKR.cjs → token-6GSAFR2W-WGTMOPEU-6HSZQUFZ.cjs} +9 -9
  247. package/dist/token-6GSAFR2W-WGTMOPEU-6HSZQUFZ.cjs.map +1 -0
  248. package/dist/{token-6GSAFR2W-K2BTU23I-NW33N3NU.js → token-6GSAFR2W-WGTMOPEU-JKP67ZX4.js} +6 -6
  249. package/dist/token-6GSAFR2W-WGTMOPEU-JKP67ZX4.js.map +1 -0
  250. package/dist/token-util-NEHG7TUY-4YJ4EPCL-MBTAVIJ3.js +8 -0
  251. package/dist/{token-util-NEHG7TUY-TIJ3LMSH-SGVKOKXF.js.map → token-util-NEHG7TUY-4YJ4EPCL-MBTAVIJ3.js.map} +1 -1
  252. package/dist/token-util-NEHG7TUY-4YJ4EPCL-SQ4NADRW.cjs +10 -0
  253. package/dist/{token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs.map → token-util-NEHG7TUY-4YJ4EPCL-SQ4NADRW.cjs.map} +1 -1
  254. package/dist/token-util-NEHG7TUY-TV2H7N56-GGCGMPDG.js +8 -0
  255. package/dist/{token-util-NEHG7TUY-KSXDO2NO-WH6I3PH3.js.map → token-util-NEHG7TUY-TV2H7N56-GGCGMPDG.js.map} +1 -1
  256. package/dist/token-util-NEHG7TUY-TV2H7N56-R7OENTCJ.cjs +10 -0
  257. package/dist/{token-util-NEHG7TUY-KSXDO2NO-J6DEINGO.cjs.map → token-util-NEHG7TUY-TV2H7N56-R7OENTCJ.cjs.map} +1 -1
  258. package/dist/token-util-NEHG7TUY-XQP3QSPX-BL5O5N7R.cjs +10 -0
  259. package/dist/{token-util-NEHG7TUY-TIJ3LMSH-ANFISSXX.cjs.map → token-util-NEHG7TUY-XQP3QSPX-BL5O5N7R.cjs.map} +1 -1
  260. package/dist/token-util-NEHG7TUY-XQP3QSPX-YCJRRNXO.js +8 -0
  261. package/dist/{token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js.map → token-util-NEHG7TUY-XQP3QSPX-YCJRRNXO.js.map} +1 -1
  262. package/handlers/server/handlers.d.ts +1 -0
  263. package/handlers.d.ts +1 -0
  264. package/package.json +10 -8
  265. package/server-adapter.d.ts +1 -0
  266. package/dist/chunk-2CLS2PYJ.js.map +0 -1
  267. package/dist/chunk-2CYGIE3E.js.map +0 -1
  268. package/dist/chunk-33CKPQS4.cjs.map +0 -1
  269. package/dist/chunk-3FEYUHHJ.js.map +0 -1
  270. package/dist/chunk-3REGEJEN.js.map +0 -1
  271. package/dist/chunk-4DJ7EJRB.cjs.map +0 -1
  272. package/dist/chunk-4EYONQIW.cjs.map +0 -1
  273. package/dist/chunk-4R2Z655M.js.map +0 -1
  274. package/dist/chunk-5NFRDYFN.js.map +0 -1
  275. package/dist/chunk-5VDI75UV.js.map +0 -1
  276. package/dist/chunk-5W4RPVTK.cjs +0 -49
  277. package/dist/chunk-5W4RPVTK.cjs.map +0 -1
  278. package/dist/chunk-6MP2S6VI.cjs.map +0 -1
  279. package/dist/chunk-7S7ALPCY.js.map +0 -1
  280. package/dist/chunk-7XPMKW4Y.cjs.map +0 -1
  281. package/dist/chunk-AV3CN5ZR.cjs.map +0 -1
  282. package/dist/chunk-AVRO3FIN.cjs.map +0 -1
  283. package/dist/chunk-BRI4GUZ2.cjs +0 -280
  284. package/dist/chunk-BRI4GUZ2.cjs.map +0 -1
  285. package/dist/chunk-CGIGPJRU.js.map +0 -1
  286. package/dist/chunk-CLAEGIP5.cjs.map +0 -1
  287. package/dist/chunk-DVSCJECS.js.map +0 -1
  288. package/dist/chunk-EUBTCHQC.js.map +0 -1
  289. package/dist/chunk-FLLJIPD4.cjs.map +0 -1
  290. package/dist/chunk-FWSKVWS7.cjs.map +0 -1
  291. package/dist/chunk-G2AMUTU4.js.map +0 -1
  292. package/dist/chunk-GHQZIEPS.js.map +0 -1
  293. package/dist/chunk-GNCALVLC.js.map +0 -1
  294. package/dist/chunk-GU4EWMZB.cjs.map +0 -1
  295. package/dist/chunk-H34VRYSF.js.map +0 -1
  296. package/dist/chunk-HCVDHEDD.cjs.map +0 -1
  297. package/dist/chunk-I27H7BEB.js.map +0 -1
  298. package/dist/chunk-IVGQTL3T.js.map +0 -1
  299. package/dist/chunk-KKY4MSZO.js.map +0 -1
  300. package/dist/chunk-L2E5RUVT.cjs.map +0 -1
  301. package/dist/chunk-LF2ZLOFP.js.map +0 -1
  302. package/dist/chunk-MPUVSOEU.cjs.map +0 -1
  303. package/dist/chunk-N4EIZSG2.js.map +0 -1
  304. package/dist/chunk-NUO7HPOV.cjs.map +0 -1
  305. package/dist/chunk-P3H4AZKI.cjs.map +0 -1
  306. package/dist/chunk-PNZQCQY4.cjs.map +0 -1
  307. package/dist/chunk-QPFYN6B5.cjs.map +0 -1
  308. package/dist/chunk-T4SPG2GP.cjs.map +0 -1
  309. package/dist/chunk-TMS4LS2J.js.map +0 -1
  310. package/dist/chunk-UK4FZWNW.cjs.map +0 -1
  311. package/dist/chunk-WJ6DNHLW.cjs.map +0 -1
  312. package/dist/chunk-WLGJVDH4.js +0 -242
  313. package/dist/chunk-WLGJVDH4.js.map +0 -1
  314. package/dist/chunk-XB27LCKO.js.map +0 -1
  315. package/dist/chunk-XCEQ4GQW.cjs.map +0 -1
  316. package/dist/chunk-XOUK3IYU.js.map +0 -1
  317. package/dist/chunk-XWGAT2DA.js +0 -44
  318. package/dist/chunk-XWGAT2DA.js.map +0 -1
  319. package/dist/chunk-YK63KHHB.cjs.map +0 -1
  320. package/dist/chunk-YN3FWKVQ.js.map +0 -1
  321. package/dist/chunk-ZQ2G6QKS.cjs.map +0 -1
  322. package/dist/token-6GSAFR2W-K2BTU23I-5WBYUIGY.cjs.map +0 -1
  323. package/dist/token-6GSAFR2W-K2BTU23I-NW33N3NU.js.map +0 -1
  324. package/dist/token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs.map +0 -1
  325. package/dist/token-6GSAFR2W-KVDFAJ2M-VW443KIA.js.map +0 -1
  326. package/dist/token-6GSAFR2W-VLY2XUPA-NCSASMWN.js.map +0 -1
  327. package/dist/token-6GSAFR2W-VLY2XUPA-RKITWXKR.cjs.map +0 -1
  328. package/dist/token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs +0 -10
  329. package/dist/token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js +0 -8
  330. package/dist/token-util-NEHG7TUY-KSXDO2NO-J6DEINGO.cjs +0 -10
  331. package/dist/token-util-NEHG7TUY-KSXDO2NO-WH6I3PH3.js +0 -8
  332. package/dist/token-util-NEHG7TUY-TIJ3LMSH-ANFISSXX.cjs +0 -10
  333. package/dist/token-util-NEHG7TUY-TIJ3LMSH-SGVKOKXF.js +0 -8
@@ -1,8 +1,9 @@
1
- import { getWorkflowInfo, WorkflowRegistry } from './chunk-GNCALVLC.js';
2
- import { streamResponseSchema } from './chunk-WLGJVDH4.js';
1
+ import { getWorkflowInfo, WorkflowRegistry } from './chunk-ED6NQBHF.js';
2
+ import { streamResponseSchema } from './chunk-LFNP3ACE.js';
3
+ import { getEffectiveResourceId, validateRunOwnership } from './chunk-USR6JK77.js';
3
4
  import { createCombinedPaginationSchema, tracingOptionsSchema, messageResponseSchema, optionalRunIdSchema, runIdSchema } from './chunk-HT4LP3BO.js';
4
- import { createRoute } from './chunk-7S7ALPCY.js';
5
5
  import { handleError } from './chunk-ONN5EA7E.js';
6
+ import { createRoute } from './chunk-D5VCL56B.js';
6
7
  import { HTTPException } from './chunk-6QWQZI4Q.js';
7
8
  import { __export } from './chunk-PR4QN5HX.js';
8
9
  import { TransformStream, ReadableStream } from 'stream/web';
@@ -225,7 +226,6 @@ async function listWorkflowsFromSystem({ mastra, workflowId }) {
225
226
  workflow = workflows[workflowId];
226
227
  break;
227
228
  }
228
- break;
229
229
  } catch (error) {
230
230
  logger.debug("Error getting workflow from agent", error);
231
231
  }
@@ -239,7 +239,7 @@ async function listWorkflowsFromSystem({ mastra, workflowId }) {
239
239
  }
240
240
  var LIST_WORKFLOWS_ROUTE = createRoute({
241
241
  method: "GET",
242
- path: "/api/workflows",
242
+ path: "/workflows",
243
243
  responseType: "json",
244
244
  queryParamSchema: z$1.object({
245
245
  partial: z$1.string().optional()
@@ -248,6 +248,7 @@ var LIST_WORKFLOWS_ROUTE = createRoute({
248
248
  summary: "List all workflows",
249
249
  description: "Returns a list of all available workflows in the system",
250
250
  tags: ["Workflows"],
251
+ requiresAuth: true,
251
252
  handler: async ({ mastra, partial }) => {
252
253
  try {
253
254
  const workflows = mastra.listWorkflows({ serialized: false });
@@ -264,13 +265,14 @@ var LIST_WORKFLOWS_ROUTE = createRoute({
264
265
  });
265
266
  var GET_WORKFLOW_BY_ID_ROUTE = createRoute({
266
267
  method: "GET",
267
- path: "/api/workflows/:workflowId",
268
+ path: "/workflows/:workflowId",
268
269
  responseType: "json",
269
270
  pathParamSchema: workflowIdPathParams,
270
271
  responseSchema: workflowInfoSchema,
271
272
  summary: "Get workflow by ID",
272
273
  description: "Returns details for a specific workflow",
273
274
  tags: ["Workflows"],
275
+ requiresAuth: true,
274
276
  handler: async ({ mastra, workflowId }) => {
275
277
  try {
276
278
  if (!workflowId) {
@@ -285,7 +287,7 @@ var GET_WORKFLOW_BY_ID_ROUTE = createRoute({
285
287
  });
286
288
  var LIST_WORKFLOW_RUNS_ROUTE = createRoute({
287
289
  method: "GET",
288
- path: "/api/workflows/:workflowId/runs",
290
+ path: "/workflows/:workflowId/runs",
289
291
  responseType: "json",
290
292
  pathParamSchema: workflowIdPathParams,
291
293
  queryParamSchema: listWorkflowRunsQuerySchema,
@@ -293,8 +295,22 @@ var LIST_WORKFLOW_RUNS_ROUTE = createRoute({
293
295
  summary: "List workflow runs",
294
296
  description: "Returns a paginated list of execution runs for the specified workflow",
295
297
  tags: ["Workflows"],
296
- handler: async ({ mastra, workflowId, fromDate, toDate, page, perPage, limit, offset, resourceId, status }) => {
298
+ requiresAuth: true,
299
+ handler: async ({
300
+ mastra,
301
+ workflowId,
302
+ fromDate,
303
+ toDate,
304
+ page,
305
+ perPage,
306
+ limit,
307
+ offset,
308
+ resourceId,
309
+ status,
310
+ requestContext
311
+ }) => {
297
312
  try {
313
+ const effectiveResourceId = getEffectiveResourceId(requestContext, resourceId);
298
314
  if (!workflowId) {
299
315
  throw new HTTPException(400, { message: "Workflow ID is required" });
300
316
  }
@@ -321,7 +337,7 @@ var LIST_WORKFLOW_RUNS_ROUTE = createRoute({
321
337
  toDate: toDate ? typeof toDate === "string" ? new Date(toDate) : toDate : void 0,
322
338
  perPage: finalPerPage,
323
339
  page: finalPage,
324
- resourceId,
340
+ resourceId: effectiveResourceId,
325
341
  status
326
342
  }) || {
327
343
  runs: [],
@@ -335,7 +351,7 @@ var LIST_WORKFLOW_RUNS_ROUTE = createRoute({
335
351
  });
336
352
  var GET_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
337
353
  method: "GET",
338
- path: "/api/workflows/:workflowId/runs/:runId",
354
+ path: "/workflows/:workflowId/runs/:runId",
339
355
  responseType: "json",
340
356
  pathParamSchema: workflowRunPathParams,
341
357
  queryParamSchema: workflowRunResultQuerySchema,
@@ -343,8 +359,10 @@ var GET_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
343
359
  summary: "Get workflow run by ID",
344
360
  description: "Returns a workflow run with metadata and processed execution state. Use the fields query parameter to reduce payload size by requesting only specific fields (e.g., ?fields=status,result,metadata)",
345
361
  tags: ["Workflows"],
346
- handler: async ({ mastra, workflowId, runId, fields, withNestedWorkflows }) => {
362
+ requiresAuth: true,
363
+ handler: async ({ mastra, workflowId, runId, fields, withNestedWorkflows, requestContext }) => {
347
364
  try {
365
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
348
366
  if (!workflowId) {
349
367
  throw new HTTPException(400, { message: "Workflow ID is required" });
350
368
  }
@@ -364,6 +382,7 @@ var GET_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
364
382
  if (!run) {
365
383
  throw new HTTPException(404, { message: "Workflow run not found" });
366
384
  }
385
+ await validateRunOwnership(run, effectiveResourceId);
367
386
  return run;
368
387
  } catch (error) {
369
388
  return handleError(error, "Error getting workflow run");
@@ -372,15 +391,17 @@ var GET_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
372
391
  });
373
392
  var DELETE_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
374
393
  method: "DELETE",
375
- path: "/api/workflows/:workflowId/runs/:runId",
394
+ path: "/workflows/:workflowId/runs/:runId",
376
395
  responseType: "json",
377
396
  pathParamSchema: workflowRunPathParams,
378
397
  responseSchema: workflowControlResponseSchema,
379
398
  summary: "Delete workflow run by ID",
380
399
  description: "Deletes a specific workflow run by ID",
381
400
  tags: ["Workflows"],
382
- handler: async ({ mastra, workflowId, runId }) => {
401
+ requiresAuth: true,
402
+ handler: async ({ mastra, workflowId, runId, requestContext }) => {
383
403
  try {
404
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
384
405
  if (!workflowId) {
385
406
  throw new HTTPException(400, { message: "Workflow ID is required" });
386
407
  }
@@ -391,6 +412,11 @@ var DELETE_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
391
412
  if (!workflow) {
392
413
  throw new HTTPException(404, { message: "Workflow not found" });
393
414
  }
415
+ const run = await workflow.getWorkflowRunById(runId);
416
+ if (!run) {
417
+ throw new HTTPException(404, { message: "Workflow run not found" });
418
+ }
419
+ await validateRunOwnership(run, effectiveResourceId);
394
420
  await workflow.deleteWorkflowRunById(runId);
395
421
  return { message: "Workflow run deleted" };
396
422
  } catch (error) {
@@ -400,7 +426,7 @@ var DELETE_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
400
426
  });
401
427
  var CREATE_WORKFLOW_RUN_ROUTE = createRoute({
402
428
  method: "POST",
403
- path: "/api/workflows/:workflowId/create-run",
429
+ path: "/workflows/:workflowId/create-run",
404
430
  responseType: "json",
405
431
  pathParamSchema: workflowIdPathParams,
406
432
  queryParamSchema: optionalRunIdSchema,
@@ -409,8 +435,10 @@ var CREATE_WORKFLOW_RUN_ROUTE = createRoute({
409
435
  summary: "Create workflow run",
410
436
  description: "Creates a new workflow execution instance with an optional custom run ID",
411
437
  tags: ["Workflows"],
412
- handler: async ({ mastra, workflowId, runId, resourceId, disableScorers }) => {
438
+ requiresAuth: true,
439
+ handler: async ({ mastra, workflowId, runId, resourceId, disableScorers, requestContext }) => {
413
440
  try {
441
+ const effectiveResourceId = getEffectiveResourceId(requestContext, resourceId);
414
442
  if (!workflowId) {
415
443
  throw new HTTPException(400, { message: "Workflow ID is required" });
416
444
  }
@@ -418,7 +446,7 @@ var CREATE_WORKFLOW_RUN_ROUTE = createRoute({
418
446
  if (!workflow) {
419
447
  throw new HTTPException(404, { message: "Workflow not found" });
420
448
  }
421
- const run = await workflow.createRun({ runId, resourceId, disableScorers });
449
+ const run = await workflow.createRun({ runId, resourceId: effectiveResourceId, disableScorers });
422
450
  return { runId: run.runId };
423
451
  } catch (error) {
424
452
  return handleError(error, "Error creating workflow run");
@@ -427,7 +455,7 @@ var CREATE_WORKFLOW_RUN_ROUTE = createRoute({
427
455
  });
428
456
  var STREAM_WORKFLOW_ROUTE = createRoute({
429
457
  method: "POST",
430
- path: "/api/workflows/:workflowId/stream",
458
+ path: "/workflows/:workflowId/stream",
431
459
  responseType: "stream",
432
460
  pathParamSchema: workflowIdPathParams,
433
461
  queryParamSchema: runIdSchema,
@@ -435,8 +463,10 @@ var STREAM_WORKFLOW_ROUTE = createRoute({
435
463
  summary: "Stream workflow execution",
436
464
  description: "Executes a workflow and streams the results in real-time",
437
465
  tags: ["Workflows"],
438
- handler: async ({ mastra, workflowId, runId, resourceId, ...params }) => {
466
+ requiresAuth: true,
467
+ handler: async ({ mastra, workflowId, runId, resourceId, requestContext, ...params }) => {
439
468
  try {
469
+ const effectiveResourceId = getEffectiveResourceId(requestContext, resourceId);
440
470
  if (!workflowId) {
441
471
  throw new HTTPException(400, { message: "Workflow ID is required" });
442
472
  }
@@ -448,8 +478,8 @@ var STREAM_WORKFLOW_ROUTE = createRoute({
448
478
  throw new HTTPException(404, { message: "Workflow not found" });
449
479
  }
450
480
  const serverCache = mastra.getServerCache();
451
- const run = await workflow.createRun({ runId, resourceId });
452
- const result = run.stream(params);
481
+ const run = await workflow.createRun({ runId, resourceId: effectiveResourceId });
482
+ const result = run.stream({ ...params, requestContext });
453
483
  return result.fullStream.pipeThrough(
454
484
  new TransformStream({
455
485
  transform(chunk, controller) {
@@ -469,7 +499,7 @@ var STREAM_WORKFLOW_ROUTE = createRoute({
469
499
  });
470
500
  var RESUME_STREAM_WORKFLOW_ROUTE = createRoute({
471
501
  method: "POST",
472
- path: "/api/workflows/:workflowId/resume-stream",
502
+ path: "/workflows/:workflowId/resume-stream",
473
503
  responseType: "stream",
474
504
  pathParamSchema: workflowIdPathParams,
475
505
  queryParamSchema: runIdSchema,
@@ -478,8 +508,10 @@ var RESUME_STREAM_WORKFLOW_ROUTE = createRoute({
478
508
  summary: "Resume workflow stream",
479
509
  description: "Resumes a suspended workflow execution and continues streaming results",
480
510
  tags: ["Workflows"],
481
- handler: async ({ mastra, workflowId, runId, ...params }) => {
511
+ requiresAuth: true,
512
+ handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {
482
513
  try {
514
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
483
515
  if (!workflowId) {
484
516
  throw new HTTPException(400, { message: "Workflow ID is required" });
485
517
  }
@@ -494,9 +526,10 @@ var RESUME_STREAM_WORKFLOW_ROUTE = createRoute({
494
526
  if (!run) {
495
527
  throw new HTTPException(404, { message: "Workflow run not found" });
496
528
  }
529
+ await validateRunOwnership(run, effectiveResourceId);
497
530
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
498
531
  const serverCache = mastra.getServerCache();
499
- const stream = _run.resumeStream(params).fullStream.pipeThrough(
532
+ const stream = _run.resumeStream({ ...params, requestContext }).fullStream.pipeThrough(
500
533
  new TransformStream({
501
534
  transform(chunk, controller) {
502
535
  if (serverCache) {
@@ -516,7 +549,7 @@ var RESUME_STREAM_WORKFLOW_ROUTE = createRoute({
516
549
  });
517
550
  var START_ASYNC_WORKFLOW_ROUTE = createRoute({
518
551
  method: "POST",
519
- path: "/api/workflows/:workflowId/start-async",
552
+ path: "/workflows/:workflowId/start-async",
520
553
  responseType: "json",
521
554
  pathParamSchema: workflowIdPathParams,
522
555
  queryParamSchema: optionalRunIdSchema,
@@ -525,8 +558,10 @@ var START_ASYNC_WORKFLOW_ROUTE = createRoute({
525
558
  summary: "Start workflow asynchronously",
526
559
  description: "Starts a workflow execution asynchronously without streaming results",
527
560
  tags: ["Workflows"],
528
- handler: async ({ mastra, workflowId, runId, ...params }) => {
561
+ requiresAuth: true,
562
+ handler: async ({ mastra, workflowId, runId, resourceId, requestContext, ...params }) => {
529
563
  try {
564
+ const effectiveResourceId = getEffectiveResourceId(requestContext, resourceId);
530
565
  if (!workflowId) {
531
566
  throw new HTTPException(400, { message: "Workflow ID is required" });
532
567
  }
@@ -534,8 +569,8 @@ var START_ASYNC_WORKFLOW_ROUTE = createRoute({
534
569
  if (!workflow) {
535
570
  throw new HTTPException(404, { message: "Workflow not found" });
536
571
  }
537
- const _run = await workflow.createRun({ runId });
538
- const result = await _run.start(params);
572
+ const _run = await workflow.createRun({ runId, resourceId: effectiveResourceId });
573
+ const result = await _run.start({ ...params, requestContext });
539
574
  return result;
540
575
  } catch (error) {
541
576
  return handleError(error, "Error starting async workflow");
@@ -544,7 +579,7 @@ var START_ASYNC_WORKFLOW_ROUTE = createRoute({
544
579
  });
545
580
  var START_WORKFLOW_RUN_ROUTE = createRoute({
546
581
  method: "POST",
547
- path: "/api/workflows/:workflowId/start",
582
+ path: "/workflows/:workflowId/start",
548
583
  responseType: "json",
549
584
  pathParamSchema: workflowIdPathParams,
550
585
  queryParamSchema: runIdSchema,
@@ -553,8 +588,10 @@ var START_WORKFLOW_RUN_ROUTE = createRoute({
553
588
  summary: "Start specific workflow run",
554
589
  description: "Starts execution of a specific workflow run by ID",
555
590
  tags: ["Workflows"],
556
- handler: async ({ mastra, workflowId, runId, ...params }) => {
591
+ requiresAuth: true,
592
+ handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {
557
593
  try {
594
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
558
595
  if (!workflowId) {
559
596
  throw new HTTPException(400, { message: "Workflow ID is required" });
560
597
  }
@@ -569,9 +606,11 @@ var START_WORKFLOW_RUN_ROUTE = createRoute({
569
606
  if (!run) {
570
607
  throw new HTTPException(404, { message: "Workflow run not found" });
571
608
  }
609
+ await validateRunOwnership(run, effectiveResourceId);
572
610
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
573
611
  void _run.start({
574
- ...params
612
+ ...params,
613
+ requestContext
575
614
  });
576
615
  return { message: "Workflow run started" };
577
616
  } catch (e) {
@@ -581,7 +620,7 @@ var START_WORKFLOW_RUN_ROUTE = createRoute({
581
620
  });
582
621
  var OBSERVE_STREAM_WORKFLOW_ROUTE = createRoute({
583
622
  method: "POST",
584
- path: "/api/workflows/:workflowId/observe",
623
+ path: "/workflows/:workflowId/observe",
585
624
  responseType: "stream",
586
625
  pathParamSchema: workflowIdPathParams,
587
626
  queryParamSchema: runIdSchema,
@@ -589,8 +628,10 @@ var OBSERVE_STREAM_WORKFLOW_ROUTE = createRoute({
589
628
  summary: "Observe workflow stream",
590
629
  description: "Observes and streams updates from an already running workflow execution",
591
630
  tags: ["Workflows"],
592
- handler: async ({ mastra, workflowId, runId }) => {
631
+ requiresAuth: true,
632
+ handler: async ({ mastra, workflowId, runId, requestContext }) => {
593
633
  try {
634
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
594
635
  if (!workflowId) {
595
636
  throw new HTTPException(400, { message: "Workflow ID is required" });
596
637
  }
@@ -605,6 +646,7 @@ var OBSERVE_STREAM_WORKFLOW_ROUTE = createRoute({
605
646
  if (!run) {
606
647
  throw new HTTPException(404, { message: "Workflow run not found" });
607
648
  }
649
+ await validateRunOwnership(run, effectiveResourceId);
608
650
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
609
651
  const serverCache = mastra.getServerCache();
610
652
  if (!serverCache) {
@@ -651,7 +693,7 @@ var OBSERVE_STREAM_WORKFLOW_ROUTE = createRoute({
651
693
  });
652
694
  var RESUME_ASYNC_WORKFLOW_ROUTE = createRoute({
653
695
  method: "POST",
654
- path: "/api/workflows/:workflowId/resume-async",
696
+ path: "/workflows/:workflowId/resume-async",
655
697
  responseType: "json",
656
698
  pathParamSchema: workflowIdPathParams,
657
699
  queryParamSchema: runIdSchema,
@@ -660,8 +702,10 @@ var RESUME_ASYNC_WORKFLOW_ROUTE = createRoute({
660
702
  summary: "Resume workflow asynchronously",
661
703
  description: "Resumes a suspended workflow execution asynchronously without streaming",
662
704
  tags: ["Workflows"],
663
- handler: async ({ mastra, workflowId, runId, ...params }) => {
705
+ requiresAuth: true,
706
+ handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {
664
707
  try {
708
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
665
709
  if (!workflowId) {
666
710
  throw new HTTPException(400, { message: "Workflow ID is required" });
667
711
  }
@@ -676,8 +720,9 @@ var RESUME_ASYNC_WORKFLOW_ROUTE = createRoute({
676
720
  if (!run) {
677
721
  throw new HTTPException(404, { message: "Workflow run not found" });
678
722
  }
723
+ await validateRunOwnership(run, effectiveResourceId);
679
724
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
680
- const result = await _run.resume(params);
725
+ const result = await _run.resume({ ...params, requestContext });
681
726
  return result;
682
727
  } catch (error) {
683
728
  return handleError(error, "Error resuming workflow step");
@@ -686,7 +731,7 @@ var RESUME_ASYNC_WORKFLOW_ROUTE = createRoute({
686
731
  });
687
732
  var RESUME_WORKFLOW_ROUTE = createRoute({
688
733
  method: "POST",
689
- path: "/api/workflows/:workflowId/resume",
734
+ path: "/workflows/:workflowId/resume",
690
735
  responseType: "json",
691
736
  pathParamSchema: workflowIdPathParams,
692
737
  queryParamSchema: runIdSchema,
@@ -695,8 +740,10 @@ var RESUME_WORKFLOW_ROUTE = createRoute({
695
740
  summary: "Resume workflow",
696
741
  description: "Resumes a suspended workflow execution from a specific step",
697
742
  tags: ["Workflows"],
698
- handler: async ({ mastra, workflowId, runId, ...params }) => {
743
+ requiresAuth: true,
744
+ handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {
699
745
  try {
746
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
700
747
  if (!workflowId) {
701
748
  throw new HTTPException(400, { message: "Workflow ID is required" });
702
749
  }
@@ -711,8 +758,9 @@ var RESUME_WORKFLOW_ROUTE = createRoute({
711
758
  if (!run) {
712
759
  throw new HTTPException(404, { message: "Workflow run not found" });
713
760
  }
761
+ await validateRunOwnership(run, effectiveResourceId);
714
762
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
715
- void _run.resume(params);
763
+ void _run.resume({ ...params, requestContext });
716
764
  return { message: "Workflow run resumed" };
717
765
  } catch (error) {
718
766
  return handleError(error, "Error resuming workflow");
@@ -721,7 +769,7 @@ var RESUME_WORKFLOW_ROUTE = createRoute({
721
769
  });
722
770
  var RESTART_ASYNC_WORKFLOW_ROUTE = createRoute({
723
771
  method: "POST",
724
- path: "/api/workflows/:workflowId/restart-async",
772
+ path: "/workflows/:workflowId/restart-async",
725
773
  responseType: "json",
726
774
  pathParamSchema: workflowIdPathParams,
727
775
  queryParamSchema: runIdSchema,
@@ -730,8 +778,10 @@ var RESTART_ASYNC_WORKFLOW_ROUTE = createRoute({
730
778
  summary: "Restart workflow asynchronously",
731
779
  description: "Restarts an active workflow execution asynchronously",
732
780
  tags: ["Workflows"],
733
- handler: async ({ mastra, workflowId, runId, ...params }) => {
781
+ requiresAuth: true,
782
+ handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {
734
783
  try {
784
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
735
785
  if (!workflowId) {
736
786
  throw new HTTPException(400, { message: "Workflow ID is required" });
737
787
  }
@@ -746,8 +796,9 @@ var RESTART_ASYNC_WORKFLOW_ROUTE = createRoute({
746
796
  if (!run) {
747
797
  throw new HTTPException(404, { message: "Workflow run not found" });
748
798
  }
799
+ await validateRunOwnership(run, effectiveResourceId);
749
800
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
750
- const result = await _run.restart(params);
801
+ const result = await _run.restart({ ...params, requestContext });
751
802
  return result;
752
803
  } catch (error) {
753
804
  return handleError(error, "Error restarting workflow");
@@ -756,7 +807,7 @@ var RESTART_ASYNC_WORKFLOW_ROUTE = createRoute({
756
807
  });
757
808
  var RESTART_WORKFLOW_ROUTE = createRoute({
758
809
  method: "POST",
759
- path: "/api/workflows/:workflowId/restart",
810
+ path: "/workflows/:workflowId/restart",
760
811
  responseType: "json",
761
812
  pathParamSchema: workflowIdPathParams,
762
813
  queryParamSchema: runIdSchema,
@@ -765,8 +816,10 @@ var RESTART_WORKFLOW_ROUTE = createRoute({
765
816
  summary: "Restart workflow",
766
817
  description: "Restarts an active workflow execution",
767
818
  tags: ["Workflows"],
768
- handler: async ({ mastra, workflowId, runId, ...params }) => {
819
+ requiresAuth: true,
820
+ handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {
769
821
  try {
822
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
770
823
  if (!workflowId) {
771
824
  throw new HTTPException(400, { message: "Workflow ID is required" });
772
825
  }
@@ -781,8 +834,9 @@ var RESTART_WORKFLOW_ROUTE = createRoute({
781
834
  if (!run) {
782
835
  throw new HTTPException(404, { message: "Workflow run not found" });
783
836
  }
837
+ await validateRunOwnership(run, effectiveResourceId);
784
838
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
785
- void _run.restart(params);
839
+ void _run.restart({ ...params, requestContext });
786
840
  return { message: "Workflow run restarted" };
787
841
  } catch (error) {
788
842
  return handleError(error, "Error restarting workflow");
@@ -791,13 +845,14 @@ var RESTART_WORKFLOW_ROUTE = createRoute({
791
845
  });
792
846
  var RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE = createRoute({
793
847
  method: "POST",
794
- path: "/api/workflows/:workflowId/restart-all-active-workflow-runs-async",
848
+ path: "/workflows/:workflowId/restart-all-active-workflow-runs-async",
795
849
  responseType: "json",
796
850
  pathParamSchema: workflowIdPathParams,
797
851
  responseSchema: workflowControlResponseSchema,
798
852
  summary: "Restart all active workflow runs asynchronously",
799
853
  description: "Restarts all active workflow runs asynchronously",
800
854
  tags: ["Workflows"],
855
+ requiresAuth: true,
801
856
  handler: async ({ mastra, workflowId }) => {
802
857
  try {
803
858
  if (!workflowId) {
@@ -816,13 +871,14 @@ var RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE = createRoute({
816
871
  });
817
872
  var RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE = createRoute({
818
873
  method: "POST",
819
- path: "/api/workflows/:workflowId/restart-all-active-workflow-runs",
874
+ path: "/workflows/:workflowId/restart-all-active-workflow-runs",
820
875
  responseType: "json",
821
876
  pathParamSchema: workflowIdPathParams,
822
877
  responseSchema: workflowControlResponseSchema,
823
878
  summary: "Restart all active workflow runs",
824
879
  description: "Restarts all active workflow runs",
825
880
  tags: ["Workflows"],
881
+ requiresAuth: true,
826
882
  handler: async ({ mastra, workflowId }) => {
827
883
  try {
828
884
  if (!workflowId) {
@@ -841,7 +897,7 @@ var RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE = createRoute({
841
897
  });
842
898
  var TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE = createRoute({
843
899
  method: "POST",
844
- path: "/api/workflows/:workflowId/time-travel-async",
900
+ path: "/workflows/:workflowId/time-travel-async",
845
901
  responseType: "json",
846
902
  pathParamSchema: workflowIdPathParams,
847
903
  queryParamSchema: runIdSchema,
@@ -850,8 +906,10 @@ var TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE = createRoute({
850
906
  summary: "Time travel workflow asynchronously",
851
907
  description: "Time travels a workflow run asynchronously without streaming",
852
908
  tags: ["Workflows"],
853
- handler: async ({ mastra, workflowId, runId, ...params }) => {
909
+ requiresAuth: true,
910
+ handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {
854
911
  try {
912
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
855
913
  if (!workflowId) {
856
914
  throw new HTTPException(400, { message: "Workflow ID is required" });
857
915
  }
@@ -866,8 +924,9 @@ var TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE = createRoute({
866
924
  if (!run) {
867
925
  throw new HTTPException(404, { message: "Workflow run not found" });
868
926
  }
927
+ await validateRunOwnership(run, effectiveResourceId);
869
928
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
870
- const result = await _run.timeTravel(params);
929
+ const result = await _run.timeTravel({ ...params, requestContext });
871
930
  return result;
872
931
  } catch (error) {
873
932
  return handleError(error, "Error time traveling workflow");
@@ -876,7 +935,7 @@ var TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE = createRoute({
876
935
  });
877
936
  var TIME_TRAVEL_WORKFLOW_ROUTE = createRoute({
878
937
  method: "POST",
879
- path: "/api/workflows/:workflowId/time-travel",
938
+ path: "/workflows/:workflowId/time-travel",
880
939
  responseType: "json",
881
940
  pathParamSchema: workflowIdPathParams,
882
941
  queryParamSchema: runIdSchema,
@@ -885,8 +944,10 @@ var TIME_TRAVEL_WORKFLOW_ROUTE = createRoute({
885
944
  summary: "Time travel workflow",
886
945
  description: "Time travels a workflow run, starting from a specific step",
887
946
  tags: ["Workflows"],
888
- handler: async ({ mastra, workflowId, runId, ...params }) => {
947
+ requiresAuth: true,
948
+ handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {
889
949
  try {
950
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
890
951
  if (!workflowId) {
891
952
  throw new HTTPException(400, { message: "Workflow ID is required" });
892
953
  }
@@ -901,8 +962,9 @@ var TIME_TRAVEL_WORKFLOW_ROUTE = createRoute({
901
962
  if (!run) {
902
963
  throw new HTTPException(404, { message: "Workflow run not found" });
903
964
  }
965
+ await validateRunOwnership(run, effectiveResourceId);
904
966
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
905
- void _run.timeTravel(params);
967
+ void _run.timeTravel({ ...params, requestContext });
906
968
  return { message: "Workflow run time travel started" };
907
969
  } catch (error) {
908
970
  return handleError(error, "Error time traveling workflow");
@@ -911,7 +973,7 @@ var TIME_TRAVEL_WORKFLOW_ROUTE = createRoute({
911
973
  });
912
974
  var TIME_TRAVEL_STREAM_WORKFLOW_ROUTE = createRoute({
913
975
  method: "POST",
914
- path: "/api/workflows/:workflowId/time-travel-stream",
976
+ path: "/workflows/:workflowId/time-travel-stream",
915
977
  responseType: "stream",
916
978
  pathParamSchema: workflowIdPathParams,
917
979
  queryParamSchema: runIdSchema,
@@ -919,8 +981,10 @@ var TIME_TRAVEL_STREAM_WORKFLOW_ROUTE = createRoute({
919
981
  summary: "Time travel workflow stream",
920
982
  description: "Time travels a workflow run, starting from a specific step, and streams the results in real-time",
921
983
  tags: ["Workflows"],
922
- handler: async ({ mastra, workflowId, runId, ...params }) => {
984
+ requiresAuth: true,
985
+ handler: async ({ mastra, workflowId, runId, requestContext, ...params }) => {
923
986
  try {
987
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
924
988
  if (!workflowId) {
925
989
  throw new HTTPException(400, { message: "Workflow ID is required" });
926
990
  }
@@ -931,9 +995,14 @@ var TIME_TRAVEL_STREAM_WORKFLOW_ROUTE = createRoute({
931
995
  if (!workflow) {
932
996
  throw new HTTPException(404, { message: "Workflow not found" });
933
997
  }
998
+ const existingRun = await workflow.getWorkflowRunById(runId);
999
+ if (!existingRun) {
1000
+ throw new HTTPException(404, { message: "Workflow run not found" });
1001
+ }
1002
+ await validateRunOwnership(existingRun, effectiveResourceId);
934
1003
  const serverCache = mastra.getServerCache();
935
- const run = await workflow.createRun({ runId });
936
- const result = run.timeTravelStream(params);
1004
+ const run = await workflow.createRun({ runId, resourceId: existingRun.resourceId });
1005
+ const result = run.timeTravelStream({ ...params, requestContext });
937
1006
  return result.fullStream.pipeThrough(
938
1007
  new TransformStream({
939
1008
  transform(chunk, controller) {
@@ -953,15 +1022,17 @@ var TIME_TRAVEL_STREAM_WORKFLOW_ROUTE = createRoute({
953
1022
  });
954
1023
  var CANCEL_WORKFLOW_RUN_ROUTE = createRoute({
955
1024
  method: "POST",
956
- path: "/api/workflows/:workflowId/runs/:runId/cancel",
1025
+ path: "/workflows/:workflowId/runs/:runId/cancel",
957
1026
  responseType: "json",
958
1027
  pathParamSchema: workflowRunPathParams,
959
1028
  responseSchema: workflowControlResponseSchema,
960
1029
  summary: "Cancel workflow run",
961
1030
  description: "Cancels an in-progress workflow execution",
962
1031
  tags: ["Workflows"],
963
- handler: async ({ mastra, workflowId, runId }) => {
1032
+ requiresAuth: true,
1033
+ handler: async ({ mastra, workflowId, runId, requestContext }) => {
964
1034
  try {
1035
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
965
1036
  if (!workflowId) {
966
1037
  throw new HTTPException(400, { message: "Workflow ID is required" });
967
1038
  }
@@ -976,6 +1047,7 @@ var CANCEL_WORKFLOW_RUN_ROUTE = createRoute({
976
1047
  if (!run) {
977
1048
  throw new HTTPException(404, { message: "Workflow run not found" });
978
1049
  }
1050
+ await validateRunOwnership(run, effectiveResourceId);
979
1051
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
980
1052
  await _run.cancel();
981
1053
  return { message: "Workflow run cancelled" };
@@ -986,17 +1058,19 @@ var CANCEL_WORKFLOW_RUN_ROUTE = createRoute({
986
1058
  });
987
1059
  var STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
988
1060
  method: "POST",
989
- path: "/api/workflows/:workflowId/stream-legacy",
1061
+ path: "/workflows/:workflowId/stream-legacy",
990
1062
  responseType: "stream",
991
1063
  pathParamSchema: workflowIdPathParams,
992
1064
  queryParamSchema: runIdSchema,
993
1065
  bodySchema: streamWorkflowBodySchema,
994
1066
  responseSchema: streamResponseSchema,
995
1067
  summary: "[DEPRECATED] Stream workflow with legacy format",
996
- description: "Legacy endpoint for streaming workflow execution. Use /api/workflows/:workflowId/stream instead.",
1068
+ description: "Legacy endpoint for streaming workflow execution. Use /workflows/:workflowId/stream instead.",
997
1069
  tags: ["Workflows", "Legacy"],
998
- handler: async ({ mastra, workflowId, runId, ...params }) => {
1070
+ requiresAuth: true,
1071
+ handler: async ({ mastra, workflowId, runId, resourceId, requestContext, ...params }) => {
999
1072
  try {
1073
+ const effectiveResourceId = getEffectiveResourceId(requestContext, resourceId);
1000
1074
  if (!workflowId) {
1001
1075
  throw new HTTPException(400, { message: "Workflow ID is required" });
1002
1076
  }
@@ -1008,9 +1082,10 @@ var STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
1008
1082
  throw new HTTPException(404, { message: "Workflow not found" });
1009
1083
  }
1010
1084
  const serverCache = mastra.getServerCache();
1011
- const run = await workflow.createRun({ runId });
1085
+ const run = await workflow.createRun({ runId, resourceId: effectiveResourceId });
1012
1086
  const result = run.streamLegacy({
1013
1087
  ...params,
1088
+ requestContext,
1014
1089
  onChunk: async (chunk) => {
1015
1090
  if (serverCache) {
1016
1091
  const cacheKey = runId;
@@ -1026,16 +1101,18 @@ var STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
1026
1101
  });
1027
1102
  var OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
1028
1103
  method: "POST",
1029
- path: "/api/workflows/:workflowId/observe-stream-legacy",
1104
+ path: "/workflows/:workflowId/observe-stream-legacy",
1030
1105
  responseType: "stream",
1031
1106
  pathParamSchema: workflowIdPathParams,
1032
1107
  queryParamSchema: runIdSchema,
1033
1108
  responseSchema: streamResponseSchema,
1034
1109
  summary: "[DEPRECATED] Observe workflow stream with legacy format",
1035
- description: "Legacy endpoint for observing workflow stream. Use /api/workflows/:workflowId/observe instead.",
1110
+ description: "Legacy endpoint for observing workflow stream. Use /workflows/:workflowId/observe instead.",
1036
1111
  tags: ["Workflows", "Legacy"],
1037
- handler: async ({ mastra, workflowId, runId }) => {
1112
+ requiresAuth: true,
1113
+ handler: async ({ mastra, workflowId, runId, requestContext }) => {
1038
1114
  try {
1115
+ const effectiveResourceId = getEffectiveResourceId(requestContext, void 0);
1039
1116
  if (!workflowId) {
1040
1117
  throw new HTTPException(400, { message: "Workflow ID is required" });
1041
1118
  }
@@ -1050,6 +1127,7 @@ var OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
1050
1127
  if (!run) {
1051
1128
  throw new HTTPException(404, { message: "Workflow run not found" });
1052
1129
  }
1130
+ await validateRunOwnership(run, effectiveResourceId);
1053
1131
  const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
1054
1132
  const serverCache = mastra.getServerCache();
1055
1133
  if (!serverCache) {
@@ -1071,5 +1149,5 @@ var OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
1071
1149
  });
1072
1150
 
1073
1151
  export { CANCEL_WORKFLOW_RUN_ROUTE, CREATE_WORKFLOW_RUN_ROUTE, DELETE_WORKFLOW_RUN_BY_ID_ROUTE, GET_WORKFLOW_BY_ID_ROUTE, GET_WORKFLOW_RUN_BY_ID_ROUTE, LIST_WORKFLOWS_ROUTE, LIST_WORKFLOW_RUNS_ROUTE, OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE, OBSERVE_STREAM_WORKFLOW_ROUTE, RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE, RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE, RESTART_ASYNC_WORKFLOW_ROUTE, RESTART_WORKFLOW_ROUTE, RESUME_ASYNC_WORKFLOW_ROUTE, RESUME_STREAM_WORKFLOW_ROUTE, RESUME_WORKFLOW_ROUTE, START_ASYNC_WORKFLOW_ROUTE, START_WORKFLOW_RUN_ROUTE, STREAM_LEGACY_WORKFLOW_ROUTE, STREAM_WORKFLOW_ROUTE, TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE, TIME_TRAVEL_STREAM_WORKFLOW_ROUTE, TIME_TRAVEL_WORKFLOW_ROUTE, createWorkflowRunResponseSchema, listWorkflowRunsQuerySchema, listWorkflowsResponseSchema, resumeBodySchema, startAsyncWorkflowBodySchema, streamLegacyWorkflowBodySchema, streamWorkflowBodySchema, workflowControlResponseSchema, workflowExecutionResultSchema, workflowInfoSchema, workflowRunResultQuerySchema, workflowRunResultSchema, workflowRunsResponseSchema, workflows_exports };
1074
- //# sourceMappingURL=chunk-4R2Z655M.js.map
1075
- //# sourceMappingURL=chunk-4R2Z655M.js.map
1152
+ //# sourceMappingURL=chunk-F2WTCJ5C.js.map
1153
+ //# sourceMappingURL=chunk-F2WTCJ5C.js.map