@mastra/server 1.82.0 → 1.83.0-alpha.0

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 (287) hide show
  1. package/dist/_types/@internal_core@0.1.4/dist/storage/index.d.ts +24 -2
  2. package/dist/_types/@mastra_schema-compat@1.3.17/dist/_types/@internal_ai-v6@0.0.95/dist/index.d.ts +96 -15
  3. package/dist/{a2a-CoiG3TAj.js → a2a-DCpd3CTv.js} +4 -4
  4. package/dist/{a2a-CoiG3TAj.js.map → a2a-DCpd3CTv.js.map} +1 -1
  5. package/dist/{a2a-DvqRdny6.cjs → a2a-kz7NjjCg.cjs} +4 -4
  6. package/dist/{a2a-DvqRdny6.cjs.map → a2a-kz7NjjCg.cjs.map} +1 -1
  7. package/dist/{agent-builder-C_L1i2eE.js → agent-builder-CocfOSi8.js} +7 -7
  8. package/dist/{agent-builder-C_L1i2eE.js.map → agent-builder-CocfOSi8.js.map} +1 -1
  9. package/dist/{agent-builder-D0Up9Fw1.cjs → agent-builder-uDstZROq.cjs} +7 -7
  10. package/dist/{agent-builder-D0Up9Fw1.cjs.map → agent-builder-uDstZROq.cjs.map} +1 -1
  11. package/dist/{agents-CgcW6lHt.js → agents-BI8ez-FT.js} +7 -7
  12. package/dist/{agents-CgcW6lHt.js.map → agents-BI8ez-FT.js.map} +1 -1
  13. package/dist/{agents-DOHGWXDa.cjs → agents-DsfsDhIT.cjs} +7 -7
  14. package/dist/{agents-DOHGWXDa.cjs.map → agents-DsfsDhIT.cjs.map} +1 -1
  15. package/dist/{api-schema-manifest-Ci2qUYHc.js → api-schema-manifest-ChxbN16M.js} +3 -3
  16. package/dist/{api-schema-manifest-Ci2qUYHc.js.map → api-schema-manifest-ChxbN16M.js.map} +1 -1
  17. package/dist/{api-schema-manifest-DCHOlOuJ.cjs → api-schema-manifest-DtYTPvh9.cjs} +3 -3
  18. package/dist/{api-schema-manifest-DCHOlOuJ.cjs.map → api-schema-manifest-DtYTPvh9.cjs.map} +1 -1
  19. package/dist/{background-tasks-BHhn4YZA.js → background-tasks-BIuEr2of.js} +3 -3
  20. package/dist/{background-tasks-BHhn4YZA.js.map → background-tasks-BIuEr2of.js.map} +1 -1
  21. package/dist/{background-tasks-Ci2tlxJC.cjs → background-tasks-BXTIp0QV.cjs} +3 -3
  22. package/dist/{background-tasks-Ci2tlxJC.cjs.map → background-tasks-BXTIp0QV.cjs.map} +1 -1
  23. package/dist/{builder-registry-m_gHCe12.js → builder-registry-Dd7pbJ5A.js} +4 -4
  24. package/dist/{builder-registry-m_gHCe12.js.map → builder-registry-Dd7pbJ5A.js.map} +1 -1
  25. package/dist/{builder-registry-D1_hGKCJ.cjs → builder-registry-DrBUA6EZ.cjs} +4 -4
  26. package/dist/{builder-registry-D1_hGKCJ.cjs.map → builder-registry-DrBUA6EZ.cjs.map} +1 -1
  27. package/dist/{channels-hhQ3vD30.js → channels-B6hwVMbV.js} +4 -4
  28. package/dist/{channels-hhQ3vD30.js.map → channels-B6hwVMbV.js.map} +1 -1
  29. package/dist/{channels-Bfkp5vYI.cjs → channels-DbfSH5O2.cjs} +4 -4
  30. package/dist/{channels-Bfkp5vYI.cjs.map → channels-DbfSH5O2.cjs.map} +1 -1
  31. package/dist/{conversations-xS7yHuG1.js → conversations-BbZYXKIa.js} +5 -5
  32. package/dist/{conversations-xS7yHuG1.js.map → conversations-BbZYXKIa.js.map} +1 -1
  33. package/dist/{conversations-Ch_VuVwY.cjs → conversations-QuKJVEFe.cjs} +5 -5
  34. package/dist/{conversations-Ch_VuVwY.cjs.map → conversations-QuKJVEFe.cjs.map} +1 -1
  35. package/dist/{dist-BKNKucT9.cjs → dist-Ctfk9X6u.cjs} +208 -247
  36. package/dist/dist-Ctfk9X6u.cjs.map +1 -0
  37. package/dist/dist-DJjVMQiv.js +1 -0
  38. package/dist/{dist-CIYZuix4.js → dist-OKFDPspq.js} +208 -247
  39. package/dist/dist-OKFDPspq.js.map +1 -0
  40. package/dist/{dist-DgKeISkr.cjs → dist-ZYvqJK9p.cjs} +1 -1
  41. package/dist/docs/SKILL.md +3 -1
  42. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  43. package/dist/docs/references/docs-knowledge-overview.md +106 -0
  44. package/dist/docs/references/docs-server-custom-adapters.md +4 -0
  45. package/dist/docs/references/docs-studio-knowledge.md +45 -24
  46. package/dist/docs/references/reference-server-invoke-route.md +86 -0
  47. package/dist/docs/references/reference-server-routes.md +63 -0
  48. package/dist/{dynamic-workflows-DDauBnDt.js → dynamic-workflows-CyaZLmHX.js} +2 -2
  49. package/dist/{dynamic-workflows-DDauBnDt.js.map → dynamic-workflows-CyaZLmHX.js.map} +1 -1
  50. package/dist/{dynamic-workflows-CpCkqM1g.cjs → dynamic-workflows-ZmzWJXxG.cjs} +2 -2
  51. package/dist/{dynamic-workflows-CpCkqM1g.cjs.map → dynamic-workflows-ZmzWJXxG.cjs.map} +1 -1
  52. package/dist/{editor-builder-Ceen28s8.js → editor-builder-CbfX5bvL.js} +4 -4
  53. package/dist/{editor-builder-Ceen28s8.js.map → editor-builder-CbfX5bvL.js.map} +1 -1
  54. package/dist/{editor-builder-CKfy5eZY.cjs → editor-builder-CjJlqR9a.cjs} +4 -4
  55. package/dist/{editor-builder-CKfy5eZY.cjs.map → editor-builder-CjJlqR9a.cjs.map} +1 -1
  56. package/dist/{helpers-DNq3LtLq.js → helpers-B29a1nM3.js} +51 -48
  57. package/dist/helpers-B29a1nM3.js.map +1 -0
  58. package/dist/{helpers-BKtUXhz2.cjs → helpers-CylvUIZm.cjs} +56 -47
  59. package/dist/helpers-CylvUIZm.cjs.map +1 -0
  60. package/dist/{knowledge-Ba74qr0v.js → knowledge-Cd2cCq-Y.js} +4 -4
  61. package/dist/{knowledge-Ba74qr0v.js.map → knowledge-Cd2cCq-Y.js.map} +1 -1
  62. package/dist/{knowledge-urR7FFG8.cjs → knowledge-Q_SCnD9m.cjs} +4 -4
  63. package/dist/{knowledge-urR7FFG8.cjs.map → knowledge-Q_SCnD9m.cjs.map} +1 -1
  64. package/dist/{logs-B57_NKDn.js → logs-C5L6gRGr.js} +4 -4
  65. package/dist/{logs-B57_NKDn.js.map → logs-C5L6gRGr.js.map} +1 -1
  66. package/dist/{logs-BJN3M88A.cjs → logs-DWIbFIw6.cjs} +4 -4
  67. package/dist/{logs-BJN3M88A.cjs.map → logs-DWIbFIw6.cjs.map} +1 -1
  68. package/dist/{mcp-B9BILfJP.cjs → mcp-CKvOVfHn.cjs} +3 -3
  69. package/dist/{mcp-B9BILfJP.cjs.map → mcp-CKvOVfHn.cjs.map} +1 -1
  70. package/dist/{mcp-BkmWZD6M.js → mcp-CntC59iU.js} +3 -3
  71. package/dist/{mcp-BkmWZD6M.js.map → mcp-CntC59iU.js.map} +1 -1
  72. package/dist/{memory-Dqod_AK9.cjs → memory-DIos0BE-.cjs} +57 -15
  73. package/dist/{memory-Dqod_AK9.cjs.map → memory-DIos0BE-.cjs.map} +1 -1
  74. package/dist/{memory-ipOCmg0C.js → memory-JzgWJevA.js} +57 -15
  75. package/dist/{memory-ipOCmg0C.js.map → memory-JzgWJevA.js.map} +1 -1
  76. package/dist/{observability-DBtyAJnb.js → observability-BCTkIhJT.js} +3 -3
  77. package/dist/{observability-DBtyAJnb.js.map → observability-BCTkIhJT.js.map} +1 -1
  78. package/dist/{observability-BtdW6mjq.cjs → observability-mnHHbnoc.cjs} +3 -3
  79. package/dist/{observability-BtdW6mjq.cjs.map → observability-mnHHbnoc.cjs.map} +1 -1
  80. package/dist/{observability-new-endpoints-jjCgXuTF.cjs → observability-new-endpoints-B6fo20v5.cjs} +129 -955
  81. package/dist/observability-new-endpoints-B6fo20v5.cjs.map +1 -0
  82. package/dist/{observability-new-endpoints-Di7m_-xc.js → observability-new-endpoints-DHn8uKyr.js} +51 -877
  83. package/dist/observability-new-endpoints-DHn8uKyr.js.map +1 -0
  84. package/dist/observability-signal-context-BYOFtbM_.cjs +1317 -0
  85. package/dist/observability-signal-context-BYOFtbM_.cjs.map +1 -0
  86. package/dist/observability-signal-context-CL5-rCWM.js +952 -0
  87. package/dist/observability-signal-context-CL5-rCWM.js.map +1 -0
  88. package/dist/{plans-nHOnlGzr.js → plans-9hdkc-t8.js} +4 -4
  89. package/dist/{plans-nHOnlGzr.js.map → plans-9hdkc-t8.js.map} +1 -1
  90. package/dist/{plans-Djcp3C0d.cjs → plans-DMs8SVBG.cjs} +4 -4
  91. package/dist/{plans-Djcp3C0d.cjs.map → plans-DMs8SVBG.cjs.map} +1 -1
  92. package/dist/{probe-image-size-DGTRKrgq.js → probe-image-size-Cxm5QtwO.js} +2 -2
  93. package/dist/{probe-image-size-DGTRKrgq.js.map → probe-image-size-Cxm5QtwO.js.map} +1 -1
  94. package/dist/{probe-image-size-BAwk1h6w.cjs → probe-image-size-bDuzMW0E.cjs} +2 -2
  95. package/dist/{probe-image-size-BAwk1h6w.cjs.map → probe-image-size-bDuzMW0E.cjs.map} +1 -1
  96. package/dist/{responses-CEet9y8G.js → responses-B5_syoSo.js} +5 -5
  97. package/dist/{responses-CEet9y8G.js.map → responses-B5_syoSo.js.map} +1 -1
  98. package/dist/{responses-BdOStKtX.cjs → responses-CNKJoC5a.cjs} +5 -5
  99. package/dist/{responses-BdOStKtX.cjs.map → responses-CNKJoC5a.cjs.map} +1 -1
  100. package/dist/{route-builder-BxPrwNog.js → route-builder-BKEzjw_M.js} +2 -2
  101. package/dist/{route-builder-BxPrwNog.js.map → route-builder-BKEzjw_M.js.map} +1 -1
  102. package/dist/{route-builder-CvARmqnA.cjs → route-builder-DHqDrSSy.cjs} +2 -2
  103. package/dist/{route-builder-CvARmqnA.cjs.map → route-builder-DHqDrSSy.cjs.map} +1 -1
  104. package/dist/{routes-DU_FlwJP.cjs → routes-BYQ38dFx.cjs} +32 -32
  105. package/dist/{routes-DU_FlwJP.cjs.map → routes-BYQ38dFx.cjs.map} +1 -1
  106. package/dist/{routes-5FpkkzND.js → routes-C0pgNcG-.js} +32 -32
  107. package/dist/{routes-5FpkkzND.js.map → routes-C0pgNcG-.js.map} +1 -1
  108. package/dist/{schedules-D8ShgpY3.cjs → schedules-CvWX2yKR.cjs} +3 -3
  109. package/dist/{schedules-D8ShgpY3.cjs.map → schedules-CvWX2yKR.cjs.map} +1 -1
  110. package/dist/{schedules-CGViSLZC.js → schedules-D9CKB18-.js} +3 -3
  111. package/dist/{schedules-CGViSLZC.js.map → schedules-D9CKB18-.js.map} +1 -1
  112. package/dist/{schema-Bf12g7KC-DBc4NSds.js → schema-Bf12g7KC-5EUrrnSf.js} +96 -96
  113. package/dist/{schema-Bf12g7KC-DBc4NSds.js.map → schema-Bf12g7KC-5EUrrnSf.js.map} +1 -1
  114. package/dist/{schema-Bf12g7KC-plP4Ir6h.cjs → schema-Bf12g7KC-C5XzpQxe.cjs} +96 -96
  115. package/dist/{schema-Bf12g7KC-plP4Ir6h.cjs.map → schema-Bf12g7KC-C5XzpQxe.cjs.map} +1 -1
  116. package/dist/{scores-BaDFGpmr.js → scores-B3mS6vqB.js} +4 -4
  117. package/dist/{scores-BaDFGpmr.js.map → scores-B3mS6vqB.js.map} +1 -1
  118. package/dist/{scores-Bw6Tuga5.cjs → scores-Dxa8dDfV.cjs} +4 -4
  119. package/dist/{scores-Bw6Tuga5.cjs.map → scores-Dxa8dDfV.cjs.map} +1 -1
  120. package/dist/server/auth/helpers.d.ts +20 -0
  121. package/dist/server/auth/helpers.d.ts.map +1 -1
  122. package/dist/server/auth/index.cjs +2 -1
  123. package/dist/server/auth/index.js +2 -2
  124. package/dist/server/handlers/a2a.cjs +1 -1
  125. package/dist/server/handlers/a2a.js +1 -1
  126. package/dist/server/handlers/agent-builder.cjs +1 -1
  127. package/dist/server/handlers/agent-builder.js +1 -1
  128. package/dist/server/handlers/agent-controller.cjs +4 -4
  129. package/dist/server/handlers/agent-controller.js +4 -4
  130. package/dist/server/handlers/agent-versions.cjs +4 -4
  131. package/dist/server/handlers/agent-versions.js +4 -4
  132. package/dist/server/handlers/agents.cjs +1 -1
  133. package/dist/server/handlers/agents.js +1 -1
  134. package/dist/server/handlers/auth.cjs +4 -4
  135. package/dist/server/handlers/auth.js +4 -4
  136. package/dist/server/handlers/authorship.cjs +1 -1
  137. package/dist/server/handlers/authorship.js +1 -1
  138. package/dist/server/handlers/background-tasks.cjs +1 -1
  139. package/dist/server/handlers/background-tasks.js +1 -1
  140. package/dist/server/handlers/builder-registry.cjs +1 -1
  141. package/dist/server/handlers/builder-registry.js +1 -1
  142. package/dist/server/handlers/channels.cjs +1 -1
  143. package/dist/server/handlers/channels.js +1 -1
  144. package/dist/server/handlers/conversations.cjs +1 -1
  145. package/dist/server/handlers/conversations.js +1 -1
  146. package/dist/server/handlers/datasets.cjs +3 -3
  147. package/dist/server/handlers/datasets.js +3 -3
  148. package/dist/server/handlers/dynamic-workflows.cjs +1 -1
  149. package/dist/server/handlers/dynamic-workflows.js +1 -1
  150. package/dist/server/handlers/editor-builder.cjs +1 -1
  151. package/dist/server/handlers/editor-builder.js +1 -1
  152. package/dist/server/handlers/favorites-enrichment.cjs +1 -1
  153. package/dist/server/handlers/favorites-enrichment.js +1 -1
  154. package/dist/server/handlers/gateway-memory-client.cjs +4 -1
  155. package/dist/server/handlers/gateway-memory-client.cjs.map +1 -1
  156. package/dist/server/handlers/gateway-memory-client.d.ts.map +1 -1
  157. package/dist/server/handlers/gateway-memory-client.js +4 -1
  158. package/dist/server/handlers/gateway-memory-client.js.map +1 -1
  159. package/dist/server/handlers/knowledge.cjs +1 -1
  160. package/dist/server/handlers/knowledge.js +1 -1
  161. package/dist/server/handlers/logs.cjs +1 -1
  162. package/dist/server/handlers/logs.js +1 -1
  163. package/dist/server/handlers/mcp-client-versions.cjs +3 -3
  164. package/dist/server/handlers/mcp-client-versions.js +3 -3
  165. package/dist/server/handlers/mcp.cjs +1 -1
  166. package/dist/server/handlers/mcp.js +1 -1
  167. package/dist/server/handlers/memory.cjs +1 -1
  168. package/dist/server/handlers/memory.d.ts.map +1 -1
  169. package/dist/server/handlers/memory.js +1 -1
  170. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  171. package/dist/server/handlers/observability-new-endpoints.d.ts +84 -8
  172. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  173. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  174. package/dist/server/handlers/observability-shared.cjs +1 -1
  175. package/dist/server/handlers/observability-shared.js +1 -1
  176. package/dist/server/handlers/observability-signal-context.cjs +4 -0
  177. package/dist/server/handlers/observability-signal-context.d.ts +42 -0
  178. package/dist/server/handlers/observability-signal-context.d.ts.map +1 -0
  179. package/dist/server/handlers/observability-signal-context.js +1 -0
  180. package/dist/server/handlers/observability.cjs +2 -2
  181. package/dist/server/handlers/observability.js +2 -2
  182. package/dist/server/handlers/plans.cjs +1 -1
  183. package/dist/server/handlers/plans.js +1 -1
  184. package/dist/server/handlers/processor-providers.cjs +2 -2
  185. package/dist/server/handlers/processor-providers.js +2 -2
  186. package/dist/server/handlers/processors.cjs +2 -2
  187. package/dist/server/handlers/processors.js +2 -2
  188. package/dist/server/handlers/prompt-block-versions.cjs +3 -3
  189. package/dist/server/handlers/prompt-block-versions.js +3 -3
  190. package/dist/server/handlers/responses.cjs +1 -1
  191. package/dist/server/handlers/responses.js +1 -1
  192. package/dist/server/handlers/responses.storage.cjs +1 -1
  193. package/dist/server/handlers/responses.storage.js +1 -1
  194. package/dist/server/handlers/schedules.cjs +1 -1
  195. package/dist/server/handlers/schedules.js +1 -1
  196. package/dist/server/handlers/scorer-versions.cjs +3 -3
  197. package/dist/server/handlers/scorer-versions.js +3 -3
  198. package/dist/server/handlers/scores.cjs +1 -1
  199. package/dist/server/handlers/scores.js +1 -1
  200. package/dist/server/handlers/stored-agent-favorites.cjs +5 -5
  201. package/dist/server/handlers/stored-agent-favorites.js +5 -5
  202. package/dist/server/handlers/stored-agents.cjs +7 -7
  203. package/dist/server/handlers/stored-agents.js +7 -7
  204. package/dist/server/handlers/stored-mcp-clients.cjs +3 -3
  205. package/dist/server/handlers/stored-mcp-clients.js +3 -3
  206. package/dist/server/handlers/stored-prompt-blocks.cjs +3 -3
  207. package/dist/server/handlers/stored-prompt-blocks.js +3 -3
  208. package/dist/server/handlers/stored-scorers.cjs +3 -3
  209. package/dist/server/handlers/stored-scorers.js +3 -3
  210. package/dist/server/handlers/stored-skill-favorites.cjs +5 -5
  211. package/dist/server/handlers/stored-skill-favorites.js +5 -5
  212. package/dist/server/handlers/stored-skills.cjs +5 -5
  213. package/dist/server/handlers/stored-skills.js +5 -5
  214. package/dist/server/handlers/stored-workspaces.cjs +3 -3
  215. package/dist/server/handlers/stored-workspaces.js +3 -3
  216. package/dist/server/handlers/system.cjs +3 -3
  217. package/dist/server/handlers/system.js +3 -3
  218. package/dist/server/handlers/tool-providers.cjs +3 -3
  219. package/dist/server/handlers/tool-providers.js +3 -3
  220. package/dist/server/handlers/tools.cjs +1 -1
  221. package/dist/server/handlers/tools.js +1 -1
  222. package/dist/server/handlers/utils.cjs +1 -1
  223. package/dist/server/handlers/utils.js +1 -1
  224. package/dist/server/handlers/validate-agent-instructions.cjs +1 -1
  225. package/dist/server/handlers/validate-agent-instructions.js +1 -1
  226. package/dist/server/handlers/vector.cjs +1 -1
  227. package/dist/server/handlers/vector.js +1 -1
  228. package/dist/server/handlers/workflow-builder.cjs +1 -1
  229. package/dist/server/handlers/workflow-builder.js +1 -1
  230. package/dist/server/handlers/workflows.cjs +1 -1
  231. package/dist/server/handlers/workflows.d.ts.map +1 -1
  232. package/dist/server/handlers/workflows.js +1 -1
  233. package/dist/server/handlers/workspace.cjs +1 -1
  234. package/dist/server/handlers/workspace.d.ts +23 -23
  235. package/dist/server/handlers/workspace.js +1 -1
  236. package/dist/server/handlers.cjs +16 -16
  237. package/dist/server/handlers.js +16 -16
  238. package/dist/server/schemas/index.cjs +20 -20
  239. package/dist/server/schemas/index.js +20 -20
  240. package/dist/server/server-adapter/index.cjs +231 -61
  241. package/dist/server/server-adapter/index.cjs.map +1 -1
  242. package/dist/server/server-adapter/index.d.ts +67 -1
  243. package/dist/server/server-adapter/index.d.ts.map +1 -1
  244. package/dist/server/server-adapter/index.js +226 -63
  245. package/dist/server/server-adapter/index.js.map +1 -1
  246. package/dist/server/server-adapter/mcp-auth.d.ts +16 -1
  247. package/dist/server/server-adapter/mcp-auth.d.ts.map +1 -1
  248. package/dist/server/server-adapter/routes/observability.d.ts +42 -4
  249. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  250. package/dist/{tools-CI5oeJWT.cjs → tools-C9W7WvyI.cjs} +7 -7
  251. package/dist/{tools-CI5oeJWT.cjs.map → tools-C9W7WvyI.cjs.map} +1 -1
  252. package/dist/{tools-BAmCNGM5.js → tools-Ce7SFoT1.js} +7 -7
  253. package/dist/{tools-BAmCNGM5.js.map → tools-Ce7SFoT1.js.map} +1 -1
  254. package/dist/{utils-9PRHHTGC.cjs → utils-BXEJ6FZC.cjs} +2 -2
  255. package/dist/{utils-9PRHHTGC.cjs.map → utils-BXEJ6FZC.cjs.map} +1 -1
  256. package/dist/{utils-BhBJHsqX.cjs → utils-CL-m2SWZ.cjs} +3 -3
  257. package/dist/{utils-BhBJHsqX.cjs.map → utils-CL-m2SWZ.cjs.map} +1 -1
  258. package/dist/{utils-B15w-1hm.js → utils-CTYtskHa.js} +2 -2
  259. package/dist/{utils-B15w-1hm.js.map → utils-CTYtskHa.js.map} +1 -1
  260. package/dist/{utils-Dy_dQTlK.js → utils-y-cW3mQU.js} +3 -3
  261. package/dist/{utils-Dy_dQTlK.js.map → utils-y-cW3mQU.js.map} +1 -1
  262. package/dist/{vector-BZ1bKtwM.cjs → vector-6k7Ft7EX.cjs} +3 -3
  263. package/dist/{vector-BZ1bKtwM.cjs.map → vector-6k7Ft7EX.cjs.map} +1 -1
  264. package/dist/{vector-BAs5o6mH.js → vector-BWFSDXvg.js} +3 -3
  265. package/dist/{vector-BAs5o6mH.js.map → vector-BWFSDXvg.js.map} +1 -1
  266. package/dist/{workflow-builder-CaSfD6oL.js → workflow-builder-BNk301jl.js} +4 -4
  267. package/dist/{workflow-builder-CaSfD6oL.js.map → workflow-builder-BNk301jl.js.map} +1 -1
  268. package/dist/{workflow-builder-tr_D_ZDN.cjs → workflow-builder-CsOEskDo.cjs} +4 -4
  269. package/dist/{workflow-builder-tr_D_ZDN.cjs.map → workflow-builder-CsOEskDo.cjs.map} +1 -1
  270. package/dist/{workflows-BxXS5AfE.js → workflows-BAFGmHCW.js} +24 -13
  271. package/dist/workflows-BAFGmHCW.js.map +1 -0
  272. package/dist/{workflows-Cdi6w8JW.cjs → workflows-CJz5Eh0B.cjs} +76 -65
  273. package/dist/workflows-CJz5Eh0B.cjs.map +1 -0
  274. package/dist/{workspace-BU6sQpbV.cjs → workspace-C7PytFzz.cjs} +3 -3
  275. package/dist/{workspace-BU6sQpbV.cjs.map → workspace-C7PytFzz.cjs.map} +1 -1
  276. package/dist/{workspace-CS-GYTve.js → workspace-CYwDvH0G.js} +3 -3
  277. package/dist/{workspace-CS-GYTve.js.map → workspace-CYwDvH0G.js.map} +1 -1
  278. package/package.json +5 -5
  279. package/dist/dist-BKNKucT9.cjs.map +0 -1
  280. package/dist/dist-CIYZuix4.js.map +0 -1
  281. package/dist/dist-mNQb9_wX.js +0 -1
  282. package/dist/helpers-BKtUXhz2.cjs.map +0 -1
  283. package/dist/helpers-DNq3LtLq.js.map +0 -1
  284. package/dist/observability-new-endpoints-Di7m_-xc.js.map +0 -1
  285. package/dist/observability-new-endpoints-jjCgXuTF.cjs.map +0 -1
  286. package/dist/workflows-BxXS5AfE.js.map +0 -1
  287. package/dist/workflows-Cdi6w8JW.cjs.map +0 -1
@@ -1,14 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../rolldown-runtime-10nMEhjP.cjs");
3
- const require_http_exception = require("../../http-exception-Co3MbFUf.cjs");
4
- const require_route_builder = require("../../route-builder-CvARmqnA.cjs");
5
- const require_utils = require("../../utils-BhBJHsqX.cjs");
3
+ const require_helpers = require("../../helpers-CylvUIZm.cjs");
6
4
  const require_constants = require("../../constants-DMg8hUOR.cjs");
7
5
  const require_server_handlers_error = require("../handlers/error.cjs");
8
- const require_helpers = require("../../helpers-BKtUXhz2.cjs");
9
- const require_routes = require("../../routes-DU_FlwJP.cjs");
6
+ const require_http_exception = require("../../http-exception-Co3MbFUf.cjs");
7
+ const require_utils = require("../../utils-CL-m2SWZ.cjs");
8
+ const require_route_builder = require("../../route-builder-DHqDrSSy.cjs");
9
+ const require_routes = require("../../routes-BYQ38dFx.cjs");
10
10
  let zod_v4 = require("zod/v4");
11
11
  let stream = require("stream");
12
+ let _mastra_core_auth_ee = require("@mastra/core/auth/ee");
12
13
  let _mastra_core_request_context = require("@mastra/core/request-context");
13
14
  let _mastra_core_server = require("@mastra/core/server");
14
15
  let _mastra_core_utils = require("@mastra/core/utils");
@@ -291,6 +292,13 @@ function getBuiltInRouteFGAConfig(route) {
291
292
  return null;
292
293
  }
293
294
  // src/server/server-adapter/mcp-auth.ts
295
+ /**
296
+ * Key under which `applyMcpRequestAuth` attaches the trusted request context to
297
+ * `req.auth`. `@mastra/mcp` reads the same registered symbol and copies the
298
+ * values into the request context its tools receive. A symbol cannot come out
299
+ * of a token or JSON payload, so only server code can supply it.
300
+ */
301
+ const MCP_TRUSTED_REQUEST_CONTEXT = Symbol.for("mastra.mcp.trustedRequestContext");
294
302
  function normalizeScopes(value) {
295
303
  if (Array.isArray(value)) return value.filter((s) => typeof s === "string");
296
304
  if (typeof value === "string") return value.split(/[\s,]+/).filter(Boolean);
@@ -333,21 +341,42 @@ function buildMcpAuthInfoFromRequestContext(requestContext) {
333
341
  * transport.
334
342
  *
335
343
  * Resolution order:
336
- * 1. An already-set `req.auth` is left untouched.
344
+ * 1. An already-set `req.auth` keeps its identity.
337
345
  * 2. A configured `setRequestAuth` hook runs and fully owns the result.
338
346
  * 3. Otherwise the principal resolved by Mastra server auth is bridged from the
339
347
  * request context using the default mapping.
348
+ *
349
+ * Whichever way `req.auth` is set, the trusted request context is attached to
350
+ * it so MCP tools see the same principal as Mastra routes.
340
351
  */
341
352
  async function applyMcpRequestAuth({ req, requestContext, setRequestAuth }) {
342
353
  const request = req;
343
- if (request.auth) return;
344
354
  if (!requestContext) return;
345
- if (setRequestAuth) {
346
- await setRequestAuth(req, requestContext);
347
- return;
355
+ if (!request.auth) {
356
+ if (setRequestAuth) await setRequestAuth(req, requestContext);
357
+ else {
358
+ const authInfo = buildMcpAuthInfoFromRequestContext(requestContext);
359
+ if (authInfo) request.auth = authInfo;
360
+ }
361
+ }
362
+ if (request.auth && typeof request.auth === "object") attachTrustedRequestContext(request.auth, requestContext);
363
+ }
364
+ /**
365
+ * Hands MCP tools the values Mastra server auth resolved for this request
366
+ * (user, permissions, roles, resource id, tenant, auth mode), so a tool called
367
+ * over MCP is authorized the same way as the matching HTTP route. The token is
368
+ * left out; it is already on `authInfo`.
369
+ */
370
+ function attachTrustedRequestContext(auth, requestContext) {
371
+ const trusted = {};
372
+ for (const key of require_constants.RESERVED_REQUEST_CONTEXT_KEYS) {
373
+ if (key === "mastra__authToken" || !requestContext.has(key)) continue;
374
+ trusted[key] = requestContext.get(key);
348
375
  }
349
- const authInfo = buildMcpAuthInfoFromRequestContext(requestContext);
350
- if (authInfo) request.auth = authInfo;
376
+ Object.defineProperty(auth, MCP_TRUSTED_REQUEST_CONTEXT, {
377
+ value: trusted,
378
+ configurable: true
379
+ });
351
380
  }
352
381
  // src/server/server-adapter/mcp-disconnect.ts
353
382
  /**
@@ -780,7 +809,7 @@ function normalizeQueryParams(rawQuery) {
780
809
  * @template TRequest - The type of the request object
781
810
  * @template TResponse - The type of the response object
782
811
  */
783
- var MastraServer = class MastraServer extends _mastra_core_server.MastraServerBase {
812
+ var MastraServer = class extends _mastra_core_server.MastraServerBase {
784
813
  /** Request bodies cannot set agent scopes: handlers strip `scopes`, and `mastra__scopes` is a reserved key. */
785
814
  reservesAgentScopes = true;
786
815
  mastra;
@@ -917,8 +946,7 @@ var MastraServer = class MastraServer extends _mastra_core_server.MastraServerBa
917
946
  * Gets the effective RBAC provider for the current request based on auth mode.
918
947
  */
919
948
  getEffectiveRBACProvider(requestContext) {
920
- if (requestContext.get("mastra__authMode") === "studio") return this.mastra.getStudio?.()?.rbac ?? this.mastra.getServer()?.rbac;
921
- return this.mastra.getServer()?.rbac;
949
+ return getEffectiveRBACProvider(this.mastra, requestContext);
922
950
  }
923
951
  /**
924
952
  * Gets the effective FGA provider for the current request based on auth mode.
@@ -1020,16 +1048,7 @@ var MastraServer = class MastraServer extends _mastra_core_server.MastraServerBa
1020
1048
  * @returns Error response if permission denied, null if allowed
1021
1049
  */
1022
1050
  checkRoutePermission(route, userPermissions, hasPermissionFn, requestContext) {
1023
- if (!this.getEffectiveRBACProvider(requestContext)) return null;
1024
- const requiredPermission = getEffectivePermission(route);
1025
- if (!requiredPermission) return null;
1026
- const permissions = Array.isArray(requiredPermission) ? requiredPermission : [requiredPermission];
1027
- if (!(userPermissions && permissions.some((perm) => hasPermissionFn(userPermissions, perm)))) return {
1028
- status: 403,
1029
- error: "Forbidden",
1030
- message: `Missing required permission: ${permissions.join(" or ")}`
1031
- };
1032
- return null;
1051
+ return getRoutePermissionError(this.mastra, route, userPermissions, hasPermissionFn, requestContext);
1033
1052
  }
1034
1053
  /**
1035
1054
  * Build a matcher that answers "is this (path, method) a framework-public
@@ -1370,53 +1389,197 @@ Learn more: https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE`);
1370
1389
  }, { prefix: this.prefix });
1371
1390
  }
1372
1391
  async parsePathParams(route, params) {
1373
- const pathParamSchema = route.pathParamSchema;
1374
- if (!pathParamSchema) return params;
1375
- return pathParamSchema.parseAsync(params);
1392
+ return parseRoutePathParams(route, params);
1376
1393
  }
1377
1394
  async parseQueryParams(route, params) {
1378
- const queryParamSchema = route.queryParamSchema;
1379
- if (!queryParamSchema) return params;
1380
- const normalizedParams = parseComplexQueryParams(queryParamSchema, params);
1381
- return queryParamSchema.parseAsync(normalizedParams);
1395
+ return parseRouteQueryParams(route, params);
1382
1396
  }
1383
1397
  async parseBody(route, body) {
1384
- const bodySchema = route.bodySchema;
1385
- if (!bodySchema) return body;
1386
- if (body === void 0) {
1387
- const omitted = await bodySchema.safeParseAsync(void 0);
1388
- if (omitted.success) return omitted.data;
1389
- const schemaType = getSchemaTypeName(unwrapOptionalNullable(bodySchema));
1390
- if (schemaType === "object" || schemaType === "ZodObject") {
1391
- const emptyObject = await bodySchema.safeParseAsync({});
1392
- if (emptyObject.success) return emptyObject.data;
1393
- }
1394
- throw omitted.error;
1398
+ return parseRouteBody(route, body);
1399
+ }
1400
+ resolveValidationError(route, error, context) {
1401
+ return resolveRouteValidationError(this.mastra, route, error, context);
1402
+ }
1403
+ };
1404
+ /**
1405
+ * The RBAC provider for the auth mode the request was authenticated with
1406
+ * (studio vs server).
1407
+ */
1408
+ function getEffectiveRBACProvider(mastra, requestContext) {
1409
+ if (requestContext.get("mastra__authMode") === "studio") return mastra.getStudio?.()?.rbac ?? mastra.getServer()?.rbac;
1410
+ return mastra.getServer()?.rbac;
1411
+ }
1412
+ /**
1413
+ * Check if the user has the required permission for a route.
1414
+ *
1415
+ * Uses convention-based permission derivation:
1416
+ * 1. If route has explicit `requiresPermission`, use that
1417
+ * 2. Otherwise, derive permission from path/method (e.g., GET /agents → agents:read)
1418
+ * 3. Routes with `requiresAuth: false` skip permission checks
1419
+ *
1420
+ * When the route specifies an array of permissions, the user needs ANY ONE
1421
+ * of them (logical OR). Without an RBAC provider, authenticated users get full access.
1422
+ *
1423
+ * @returns Error response if permission denied, null if allowed
1424
+ */
1425
+ function getRoutePermissionError(mastra, route, userPermissions, hasPermissionFn, requestContext) {
1426
+ if (!getEffectiveRBACProvider(mastra, requestContext)) return null;
1427
+ const requiredPermission = getEffectivePermission(route);
1428
+ if (!requiredPermission) return null;
1429
+ const permissions = Array.isArray(requiredPermission) ? requiredPermission : [requiredPermission];
1430
+ if (!(userPermissions && permissions.some((perm) => hasPermissionFn(userPermissions, perm)))) return {
1431
+ status: 403,
1432
+ error: "Forbidden",
1433
+ message: `Missing required permission: ${permissions.join(" or ")}`
1434
+ };
1435
+ return null;
1436
+ }
1437
+ async function parseRoutePathParams(route, params) {
1438
+ const pathParamSchema = route.pathParamSchema;
1439
+ if (!pathParamSchema) return params;
1440
+ return pathParamSchema.parseAsync(params);
1441
+ }
1442
+ async function parseRouteQueryParams(route, params) {
1443
+ const queryParamSchema = route.queryParamSchema;
1444
+ if (!queryParamSchema) return params;
1445
+ const normalizedParams = parseComplexQueryParams(queryParamSchema, params);
1446
+ return queryParamSchema.parseAsync(normalizedParams);
1447
+ }
1448
+ async function parseRouteBody(route, body) {
1449
+ const bodySchema = route.bodySchema;
1450
+ if (!bodySchema) return body;
1451
+ if (body === void 0) {
1452
+ const omitted = await bodySchema.safeParseAsync(void 0);
1453
+ if (omitted.success) return omitted.data;
1454
+ const schemaType = getSchemaTypeName(unwrapOptionalNullable(bodySchema));
1455
+ if (schemaType === "object" || schemaType === "ZodObject") {
1456
+ const emptyObject = await bodySchema.safeParseAsync({});
1457
+ if (emptyObject.success) return emptyObject.data;
1395
1458
  }
1396
- return bodySchema.parseAsync(body);
1459
+ throw omitted.error;
1460
+ }
1461
+ return bodySchema.parseAsync(body);
1462
+ }
1463
+ const VALIDATION_CONTEXT_LABELS = {
1464
+ query: "query parameters",
1465
+ body: "request body",
1466
+ path: "path parameters"
1467
+ };
1468
+ function resolveRouteValidationError(mastra, route, error, context) {
1469
+ const hook = route.onValidationError ?? mastra.getServer()?.onValidationError;
1470
+ if (hook) try {
1471
+ const result = hook(error, context);
1472
+ if (result) return result;
1473
+ } catch (hookError) {
1474
+ mastra.getLogger()?.error("Error in custom onValidationError hook", { error: hookError instanceof Error ? {
1475
+ message: hookError.message,
1476
+ stack: hookError.stack
1477
+ } : hookError });
1397
1478
  }
1398
- static CONTEXT_LABELS = {
1399
- query: "query parameters",
1400
- body: "request body",
1401
- path: "path parameters"
1479
+ return {
1480
+ status: 400,
1481
+ body: require_server_handlers_error.formatZodError(error, VALIDATION_CONTEXT_LABELS[context])
1402
1482
  };
1403
- resolveValidationError(route, error, context) {
1404
- const hook = route.onValidationError ?? this.mastra.getServer()?.onValidationError;
1405
- if (hook) try {
1406
- const result = hook(error, context);
1407
- if (result) return result;
1408
- } catch (hookError) {
1409
- this.mastra.getLogger()?.error("Error in custom onValidationError hook", { error: hookError instanceof Error ? {
1410
- message: hookError.message,
1411
- stack: hookError.stack
1412
- } : hookError });
1483
+ }
1484
+ /**
1485
+ * Runs a server route in-process as the caller, with the checks its HTTP
1486
+ * endpoint applies on every adapter: authentication, auth's `authorizeUser`,
1487
+ * `authorize` and `rules` (against the route's path under `apiPrefix`), input
1488
+ * validation, RBAC permission and FGA. Lets code outside an HTTP request (such
1489
+ * as an MCP tool) reuse a route without proxying through the HTTP server.
1490
+ *
1491
+ * Authentication is not re-run: when server or studio auth is configured, the
1492
+ * request context must already carry the user Mastra server auth resolved
1493
+ * (`MASTRA_USER_KEY`), otherwise the call is refused with 401.
1494
+ *
1495
+ * Only JSON routes are supported; other response types throw. The handler gets
1496
+ * the parsed params, `mastra`, `requestContext` and `abortSignal`, but not the
1497
+ * HTTP-only `request`, `registeredTools`, `taskStore` or `routePrefix`, so
1498
+ * routes that read those are not suitable.
1499
+ */
1500
+ async function invokeRoute(route, options) {
1501
+ if (route.responseType !== "json") throw new Error(`invokeRoute only runs JSON routes; ${route.method} ${route.path} answers with '${route.responseType}'`);
1502
+ const { mastra, requestContext } = options;
1503
+ const studioAuth = mastra.getStudio?.()?.auth;
1504
+ const serverAuth = mastra.getServer()?.auth;
1505
+ const authConfigured = Boolean(studioAuth || serverAuth);
1506
+ if (authConfigured && route.requiresAuth !== false) {
1507
+ const user = requestContext.get(require_constants.MASTRA_USER_KEY);
1508
+ if (!user) return {
1509
+ status: 401,
1510
+ body: { error: "Authentication required" }
1511
+ };
1512
+ const authConfig = requestContext.get("mastra__authMode") === "studio" && studioAuth ? studioAuth : serverAuth;
1513
+ if (authConfig) {
1514
+ const path = `${require_utils.normalizeRoutePath(mastra.getServer()?.apiPrefix ?? "/api")}${route.path.replace(/:(\w+)/g, (_, name) => encodeURIComponent(options.pathParams?.[name] ?? ""))}`;
1515
+ const token = requestContext.get(require_constants.MASTRA_AUTH_TOKEN_KEY);
1516
+ const authorizationError = await require_helpers.authorizeAuthenticatedUser({
1517
+ path,
1518
+ method: route.method,
1519
+ user,
1520
+ mastra,
1521
+ authConfig,
1522
+ requestContext,
1523
+ rawRequest: new Request(`http://localhost${path}`, {
1524
+ method: route.method,
1525
+ headers: typeof token === "string" && token ? { authorization: `Bearer ${token}` } : void 0
1526
+ }),
1527
+ buildAuthorizeContext: () => null
1528
+ });
1529
+ if (authorizationError) return authorizationError;
1530
+ }
1531
+ }
1532
+ const parse = async (context, run) => {
1533
+ try {
1534
+ return { value: await run() };
1535
+ } catch (error) {
1536
+ if (require_server_handlers_error.isZodError(error)) return { error: resolveRouteValidationError(mastra, route, error, context) };
1537
+ throw error;
1413
1538
  }
1539
+ };
1540
+ const pathParams = await parse("path", () => parseRoutePathParams(route, options.pathParams ?? {}));
1541
+ if (pathParams.error) return pathParams.error;
1542
+ const query = await parse("query", () => parseRouteQueryParams(route, options.query ?? {}));
1543
+ if (query.error) return query.error;
1544
+ const body = await parse("body", () => parseRouteBody(route, options.body));
1545
+ if (body.error) return body.error;
1546
+ const params = {
1547
+ ...pathParams.value,
1548
+ ...query.value,
1549
+ ...typeof body.value === "object" ? body.value : {}
1550
+ };
1551
+ if (authConfigured) {
1552
+ const permissionError = getRoutePermissionError(mastra, route, requestContext.get(require_constants.MASTRA_USER_PERMISSIONS_KEY), _mastra_core_auth_ee.hasPermission, requestContext);
1553
+ if (permissionError) return {
1554
+ status: permissionError.status,
1555
+ body: {
1556
+ error: permissionError.error,
1557
+ message: permissionError.message
1558
+ }
1559
+ };
1560
+ }
1561
+ const fgaError = await checkRouteFGA(mastra, route, requestContext, params);
1562
+ if (fgaError) return {
1563
+ status: fgaError.status,
1564
+ body: {
1565
+ error: fgaError.error,
1566
+ message: fgaError.message
1567
+ }
1568
+ };
1569
+ try {
1414
1570
  return {
1415
- status: 400,
1416
- body: require_server_handlers_error.formatZodError(error, MastraServer.CONTEXT_LABELS[context])
1571
+ status: 200,
1572
+ body: await route.handler({
1573
+ ...params,
1574
+ requestContext,
1575
+ mastra,
1576
+ abortSignal: options.abortSignal ?? new AbortController().signal
1577
+ })
1417
1578
  };
1579
+ } catch (error) {
1580
+ return getHTTPErrorResponse(error);
1418
1581
  }
1419
- };
1582
+ }
1420
1583
  /**
1421
1584
  * Check FGA authorization for an HTTP route.
1422
1585
  * Returns null if authorized or FGA not configured, or an error object if denied.
@@ -1509,8 +1672,11 @@ exports.generateOpenAPIDocument = require_route_builder.generateOpenAPIDocument;
1509
1672
  exports.getCustomHTTPExceptionResponse = getCustomHTTPExceptionResponse;
1510
1673
  exports.getCustomRouteHTTPExceptionResponse = getCustomRouteHTTPExceptionResponse;
1511
1674
  exports.getEffectivePermission = getEffectivePermission;
1675
+ exports.getEffectiveRBACProvider = getEffectiveRBACProvider;
1512
1676
  exports.getFGAProvider = getFGAProvider;
1513
1677
  exports.getHTTPErrorResponse = getHTTPErrorResponse;
1678
+ exports.getRoutePermissionError = getRoutePermissionError;
1679
+ exports.invokeRoute = invokeRoute;
1514
1680
  exports.isReservedRequestContextKey = require_constants.isReservedRequestContextKey;
1515
1681
  exports.isSafeObjectKey = isSafeObjectKey;
1516
1682
  exports.isStudioClientTypeHeader = require_constants.isStudioClientTypeHeader;
@@ -1518,9 +1684,13 @@ exports.isZodError = require_server_handlers_error.isZodError;
1518
1684
  exports.jsonQueryParam = require_route_builder.jsonQueryParam;
1519
1685
  exports.normalizeQueryParams = normalizeQueryParams;
1520
1686
  exports.normalizeRoutePath = require_utils.normalizeRoutePath;
1687
+ exports.parseRouteBody = parseRouteBody;
1688
+ exports.parseRoutePathParams = parseRoutePathParams;
1689
+ exports.parseRouteQueryParams = parseRouteQueryParams;
1521
1690
  exports.pickParams = require_route_builder.pickParams;
1522
1691
  exports.propagateRequestAbort = propagateRequestAbort;
1523
1692
  exports.redactStreamChunk = redactStreamChunk;
1693
+ exports.resolveRouteValidationError = resolveRouteValidationError;
1524
1694
  exports.serializeStreamChunk = serializeStreamChunk;
1525
1695
  exports.wrapSchemaForQueryParams = require_route_builder.wrapSchemaForQueryParams;
1526
1696