@mastra/server 1.83.0-alpha.12 → 1.83.0-alpha.13

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 (543) hide show
  1. package/dist/_types/@internal_voice@0.0.44/dist/_types/@internal_core@0.1.4/dist/request-context/index.d.ts +19 -0
  2. package/dist/{a2a-DIcMx6x-.cjs → a2a-Bz7vRGfF.cjs} +9 -6
  3. package/dist/a2a-Bz7vRGfF.cjs.map +1 -0
  4. package/dist/{a2a-DTTGA2Xg.js → a2a-CY85JalK.js} +9 -6
  5. package/dist/a2a-CY85JalK.js.map +1 -0
  6. package/dist/{agent-builder-BNfBksTT.js → agent-builder-Ce1pjSjg.js} +6 -6
  7. package/dist/{agent-builder-BNfBksTT.js.map → agent-builder-Ce1pjSjg.js.map} +1 -1
  8. package/dist/{agent-builder-CopkMfWF.cjs → agent-builder-DWtgp1cb.cjs} +6 -6
  9. package/dist/{agent-builder-CopkMfWF.cjs.map → agent-builder-DWtgp1cb.cjs.map} +1 -1
  10. package/dist/{agents-BCgiMlDq.js → agents-B0OpLdbp.js} +444 -3
  11. package/dist/agents-B0OpLdbp.js.map +1 -0
  12. package/dist/{agents-DjpBmwhv.cjs → agents-BgaBbcwb.cjs} +136 -53
  13. package/dist/agents-BgaBbcwb.cjs.map +1 -0
  14. package/dist/{agents-CTgjTASj.js → agents-BjlUjmb1.js} +136 -53
  15. package/dist/agents-BjlUjmb1.js.map +1 -0
  16. package/dist/{agents-CjcvdF2e.cjs → agents-CH_G37hG.cjs} +521 -2
  17. package/dist/agents-CH_G37hG.cjs.map +1 -0
  18. package/dist/{api-schema-manifest-CkB5OGjC.js → api-schema-manifest-CsTpd03O.js} +9 -9
  19. package/dist/api-schema-manifest-CsTpd03O.js.map +1 -0
  20. package/dist/{api-schema-manifest-CJz_hWjy.cjs → api-schema-manifest-DT9X0fAm.cjs} +9 -9
  21. package/dist/api-schema-manifest-DT9X0fAm.cjs.map +1 -0
  22. package/dist/{background-tasks-CYvlxFz3.js → background-tasks-BKnoXtUN.js} +3 -3
  23. package/dist/{background-tasks-CYvlxFz3.js.map → background-tasks-BKnoXtUN.js.map} +1 -1
  24. package/dist/{background-tasks-Dv9o8cR7.cjs → background-tasks-BqW1_VmH.cjs} +3 -3
  25. package/dist/{background-tasks-Dv9o8cR7.cjs.map → background-tasks-BqW1_VmH.cjs.map} +1 -1
  26. package/dist/{builder-registry-BmrttdGj.js → builder-registry-ByghMyfA.js} +3 -3
  27. package/dist/{builder-registry-BmrttdGj.js.map → builder-registry-ByghMyfA.js.map} +1 -1
  28. package/dist/{builder-registry-CmbtZzbE.cjs → builder-registry-DPsdmtZG.cjs} +3 -3
  29. package/dist/{builder-registry-CmbtZzbE.cjs.map → builder-registry-DPsdmtZG.cjs.map} +1 -1
  30. package/dist/catalogue-CGQdyojN.cjs +1378 -0
  31. package/dist/catalogue-CGQdyojN.cjs.map +1 -0
  32. package/dist/catalogue-CUJevxy3.js +1376 -0
  33. package/dist/catalogue-CUJevxy3.js.map +1 -0
  34. package/dist/{channels-KHhb7hAm.js → channels-DIE-lJkq.js} +3 -3
  35. package/dist/{channels-KHhb7hAm.js.map → channels-DIE-lJkq.js.map} +1 -1
  36. package/dist/{channels-CXwFVxi2.cjs → channels-k5dF1IBc.cjs} +3 -3
  37. package/dist/{channels-CXwFVxi2.cjs.map → channels-k5dF1IBc.cjs.map} +1 -1
  38. package/dist/{constants-CXAvBYcz.js → constants-0xZU_h4R.js} +10 -2
  39. package/dist/constants-0xZU_h4R.js.map +1 -0
  40. package/dist/{constants-DMg8hUOR.cjs → constants-1yTmKUZD.cjs} +15 -1
  41. package/dist/constants-1yTmKUZD.cjs.map +1 -0
  42. package/dist/{conversations-BFqmDglO.cjs → conversations-Bvk5VVVJ.cjs} +6 -5
  43. package/dist/conversations-Bvk5VVVJ.cjs.map +1 -0
  44. package/dist/{conversations-BkX00xDs.js → conversations-DYqwqCWH.js} +6 -5
  45. package/dist/conversations-DYqwqCWH.js.map +1 -0
  46. package/dist/dist-BVw6-hMs.js +1 -0
  47. package/dist/{dist-G8g-Cg67.js → dist-C-Hmkkat.js} +6 -6
  48. package/dist/{dist-G8g-Cg67.js.map → dist-C-Hmkkat.js.map} +1 -1
  49. package/dist/{dist-COfASzWw.cjs → dist-Clh3uSOV.cjs} +11 -11
  50. package/dist/{dist-COfASzWw.cjs.map → dist-Clh3uSOV.cjs.map} +1 -1
  51. package/dist/{dist-3WMLkPSs.cjs → dist-DPgpEz_7.cjs} +1 -1
  52. package/dist/docs/SKILL.md +3 -1
  53. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  54. package/dist/docs/references/docs-server-mcp.md +315 -0
  55. package/dist/docs/references/reference-server-dispatch-route.md +124 -0
  56. package/dist/docs/references/reference-server-invoke-route.md +10 -0
  57. package/dist/{dynamic-workflows-QgKLYkiC.cjs → dynamic-workflows-DPgV6qtS.cjs} +2 -2
  58. package/dist/{dynamic-workflows-QgKLYkiC.cjs.map → dynamic-workflows-DPgV6qtS.cjs.map} +1 -1
  59. package/dist/{dynamic-workflows-CYtakeIQ.js → dynamic-workflows-DmkCJ4Lp.js} +2 -2
  60. package/dist/{dynamic-workflows-CYtakeIQ.js.map → dynamic-workflows-DmkCJ4Lp.js.map} +1 -1
  61. package/dist/{editor-builder-C4H2l6tz.js → editor-builder-CGM0scw2.js} +10 -4
  62. package/dist/editor-builder-CGM0scw2.js.map +1 -0
  63. package/dist/{editor-builder-fe70YP8g.js → editor-builder-CXLdplIj.js} +2 -2
  64. package/dist/{editor-builder-fe70YP8g.js.map → editor-builder-CXLdplIj.js.map} +1 -1
  65. package/dist/{editor-builder-Cqw1npOK.cjs → editor-builder-SP_ledm3.cjs} +10 -4
  66. package/dist/editor-builder-SP_ledm3.cjs.map +1 -0
  67. package/dist/{editor-builder-xQmDgVgJ.cjs → editor-builder-eF2IetF2.cjs} +2 -2
  68. package/dist/{editor-builder-xQmDgVgJ.cjs.map → editor-builder-eF2IetF2.cjs.map} +1 -1
  69. package/dist/{helpers-C9QZKOhz.js → helpers-B56oH6qp.js} +27 -8
  70. package/dist/helpers-B56oH6qp.js.map +1 -0
  71. package/dist/{helpers-0LJI4DxR.cjs → helpers-Dpdta8ai.cjs} +31 -6
  72. package/dist/helpers-Dpdta8ai.cjs.map +1 -0
  73. package/dist/{knowledge-CRkWkTBC.cjs → knowledge-2fms70NN.cjs} +4 -4
  74. package/dist/{knowledge-CRkWkTBC.cjs.map → knowledge-2fms70NN.cjs.map} +1 -1
  75. package/dist/{knowledge-Dfe_CFtt.js → knowledge-BblTTH3z.js} +4 -4
  76. package/dist/{knowledge-Dfe_CFtt.js.map → knowledge-BblTTH3z.js.map} +1 -1
  77. package/dist/{logs-Dg2AWexF.js → logs-D_hKQuvQ.js} +3 -3
  78. package/dist/{logs-Dg2AWexF.js.map → logs-D_hKQuvQ.js.map} +1 -1
  79. package/dist/{logs-B2ov1yZQ.cjs → logs-Deoh0l4I.cjs} +3 -3
  80. package/dist/{logs-B2ov1yZQ.cjs.map → logs-Deoh0l4I.cjs.map} +1 -1
  81. package/dist/{mcp-bsPRIGFX.js → mcp-CSRuYaWN.js} +3 -3
  82. package/dist/{mcp-bsPRIGFX.js.map → mcp-CSRuYaWN.js.map} +1 -1
  83. package/dist/{mcp-Bon4eIV1.cjs → mcp-oWjcmsQb.cjs} +3 -3
  84. package/dist/{mcp-Bon4eIV1.cjs.map → mcp-oWjcmsQb.cjs.map} +1 -1
  85. package/dist/{memory-Dw7xG5nn.js → memory-CGlo-6_V.js} +105 -12
  86. package/dist/memory-CGlo-6_V.js.map +1 -0
  87. package/dist/{memory-BRE3ofvI.cjs → memory-CzSke9Em.cjs} +105 -12
  88. package/dist/memory-CzSke9Em.cjs.map +1 -0
  89. package/dist/{observability-C2HjrCpw.cjs → observability-BCJsmSH0.cjs} +27 -3
  90. package/dist/observability-BCJsmSH0.cjs.map +1 -0
  91. package/dist/{observability-Ca3TxxY7.js → observability-Z2tDxHS1.js} +27 -3
  92. package/dist/observability-Z2tDxHS1.js.map +1 -0
  93. package/dist/{observability-new-endpoints-DnzWjscD.cjs → observability-new-endpoints-C_HEkpZ1.cjs} +153 -3
  94. package/dist/observability-new-endpoints-C_HEkpZ1.cjs.map +1 -0
  95. package/dist/{observability-new-endpoints-B3X2L7cj.js → observability-new-endpoints-dr0XcNkP.js} +153 -3
  96. package/dist/observability-new-endpoints-dr0XcNkP.js.map +1 -0
  97. package/dist/{plans-D_GKFz2x.js → plans-BemJO4-7.js} +7 -6
  98. package/dist/plans-BemJO4-7.js.map +1 -0
  99. package/dist/{plans-_nR8lqgD.cjs → plans-CffjV2_6.cjs} +7 -6
  100. package/dist/plans-CffjV2_6.cjs.map +1 -0
  101. package/dist/{probe-image-size-C2b8QfA7.js → probe-image-size-jA5gozO6.js} +2 -2
  102. package/dist/{probe-image-size-C2b8QfA7.js.map → probe-image-size-jA5gozO6.js.map} +1 -1
  103. package/dist/{probe-image-size-DLuC8QsM.cjs → probe-image-size-qOT5Pn0l.cjs} +2 -2
  104. package/dist/{probe-image-size-DLuC8QsM.cjs.map → probe-image-size-qOT5Pn0l.cjs.map} +1 -1
  105. package/dist/{responses-C_OEJoxU.js → responses-BofWEQYg.js} +11 -8
  106. package/dist/responses-BofWEQYg.js.map +1 -0
  107. package/dist/{responses-CdWbS4jA.cjs → responses-D0mb5ubj.cjs} +11 -8
  108. package/dist/responses-D0mb5ubj.cjs.map +1 -0
  109. package/dist/{route-builder-B9C5vT54.cjs → route-builder-DjTBxSZN.cjs} +10 -10
  110. package/dist/{route-builder-B9C5vT54.cjs.map → route-builder-DjTBxSZN.cjs.map} +1 -1
  111. package/dist/{route-builder-DfDT1g4L.js → route-builder-Dz18c3qm.js} +9 -9
  112. package/dist/{route-builder-DfDT1g4L.js.map → route-builder-Dz18c3qm.js.map} +1 -1
  113. package/dist/{routes-CQZ0Z77B.cjs → routes-01JAJiMe.cjs} +646 -27
  114. package/dist/routes-01JAJiMe.cjs.map +1 -0
  115. package/dist/{routes-CqzWkepR.js → routes-CmkPohqd.js} +593 -28
  116. package/dist/routes-CmkPohqd.js.map +1 -0
  117. package/dist/{schedules-BQvnAe1j.cjs → schedules-BRwhbppl.cjs} +77 -22
  118. package/dist/schedules-BRwhbppl.cjs.map +1 -0
  119. package/dist/{schedules-BcAIELfB.js → schedules-Zct_0ZwE.js} +77 -22
  120. package/dist/schedules-Zct_0ZwE.js.map +1 -0
  121. package/dist/{schema-xsUy1mlm-CAPin6jE.js → schema-TQPB_dl2-CCzMcdDx.js} +9 -6
  122. package/dist/{schema-xsUy1mlm-CAPin6jE.js.map → schema-TQPB_dl2-CCzMcdDx.js.map} +1 -1
  123. package/dist/{schema-xsUy1mlm-pvZI8YC0.cjs → schema-TQPB_dl2-CJX1q58F.cjs} +9 -6
  124. package/dist/{schema-xsUy1mlm-pvZI8YC0.cjs.map → schema-TQPB_dl2-CJX1q58F.cjs.map} +1 -1
  125. package/dist/{scores-DEvPN0kz.cjs → scores-0MyV08tL.cjs} +26 -11
  126. package/dist/scores-0MyV08tL.cjs.map +1 -0
  127. package/dist/{scores-Dm0yu1Pt.js → scores-CVssMyoQ.js} +26 -11
  128. package/dist/scores-CVssMyoQ.js.map +1 -0
  129. package/dist/server/auth/helpers.d.ts +7 -1
  130. package/dist/server/auth/helpers.d.ts.map +1 -1
  131. package/dist/server/auth/index.cjs +4 -2
  132. package/dist/server/auth/index.js +3 -3
  133. package/dist/server/constants.d.ts +8 -1
  134. package/dist/server/constants.d.ts.map +1 -1
  135. package/dist/server/handlers/a2a.cjs +1 -1
  136. package/dist/server/handlers/a2a.d.ts +4 -0
  137. package/dist/server/handlers/a2a.d.ts.map +1 -1
  138. package/dist/server/handlers/a2a.js +1 -1
  139. package/dist/server/handlers/agent-access.cjs +42 -0
  140. package/dist/server/handlers/agent-access.cjs.map +1 -0
  141. package/dist/server/handlers/agent-access.d.ts +19 -0
  142. package/dist/server/handlers/agent-access.d.ts.map +1 -0
  143. package/dist/server/handlers/agent-access.js +39 -0
  144. package/dist/server/handlers/agent-access.js.map +1 -0
  145. package/dist/server/handlers/agent-builder.cjs +1 -1
  146. package/dist/server/handlers/agent-builder.d.ts +32 -0
  147. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  148. package/dist/server/handlers/agent-builder.js +1 -1
  149. package/dist/server/handlers/agent-controller.cjs +3 -3
  150. package/dist/server/handlers/agent-controller.d.ts +72 -0
  151. package/dist/server/handlers/agent-controller.d.ts.map +1 -1
  152. package/dist/server/handlers/agent-controller.js +3 -3
  153. package/dist/server/handlers/agent-versions.cjs +30 -2
  154. package/dist/server/handlers/agent-versions.cjs.map +1 -1
  155. package/dist/server/handlers/agent-versions.d.ts +12 -0
  156. package/dist/server/handlers/agent-versions.d.ts.map +1 -1
  157. package/dist/server/handlers/agent-versions.js +30 -2
  158. package/dist/server/handlers/agent-versions.js.map +1 -1
  159. package/dist/server/handlers/agents.cjs +1 -1
  160. package/dist/server/handlers/agents.d.ts +91 -2
  161. package/dist/server/handlers/agents.d.ts.map +1 -1
  162. package/dist/server/handlers/agents.js +1 -1
  163. package/dist/server/handlers/auth.cjs +3 -3
  164. package/dist/server/handlers/auth.d.ts +40 -0
  165. package/dist/server/handlers/auth.d.ts.map +1 -1
  166. package/dist/server/handlers/auth.js +3 -3
  167. package/dist/server/handlers/authorship.cjs +1 -1
  168. package/dist/server/handlers/authorship.js +1 -1
  169. package/dist/server/handlers/background-tasks.cjs +1 -1
  170. package/dist/server/handlers/background-tasks.d.ts +8 -0
  171. package/dist/server/handlers/background-tasks.d.ts.map +1 -1
  172. package/dist/server/handlers/background-tasks.js +1 -1
  173. package/dist/server/handlers/builder-registry.cjs +1 -1
  174. package/dist/server/handlers/builder-registry.d.ts +10 -0
  175. package/dist/server/handlers/builder-registry.d.ts.map +1 -1
  176. package/dist/server/handlers/builder-registry.js +1 -1
  177. package/dist/server/handlers/channels.cjs +1 -1
  178. package/dist/server/handlers/channels.d.ts +10 -0
  179. package/dist/server/handlers/channels.d.ts.map +1 -1
  180. package/dist/server/handlers/channels.js +1 -1
  181. package/dist/server/handlers/conversations.cjs +1 -1
  182. package/dist/server/handlers/conversations.d.ts +8 -0
  183. package/dist/server/handlers/conversations.d.ts.map +1 -1
  184. package/dist/server/handlers/conversations.js +1 -1
  185. package/dist/server/handlers/datasets.cjs +2 -2
  186. package/dist/server/handlers/datasets.d.ts +66 -0
  187. package/dist/server/handlers/datasets.d.ts.map +1 -1
  188. package/dist/server/handlers/datasets.js +2 -2
  189. package/dist/server/handlers/dynamic-workflows.cjs +1 -1
  190. package/dist/server/handlers/dynamic-workflows.d.ts +8 -0
  191. package/dist/server/handlers/dynamic-workflows.d.ts.map +1 -1
  192. package/dist/server/handlers/dynamic-workflows.js +1 -1
  193. package/dist/server/handlers/editor-builder.cjs +1 -1
  194. package/dist/server/handlers/editor-builder.d.ts +6 -0
  195. package/dist/server/handlers/editor-builder.d.ts.map +1 -1
  196. package/dist/server/handlers/editor-builder.js +1 -1
  197. package/dist/server/handlers/favorites-enrichment.cjs +1 -1
  198. package/dist/server/handlers/favorites-enrichment.js +1 -1
  199. package/dist/server/handlers/knowledge.cjs +1 -1
  200. package/dist/server/handlers/knowledge.d.ts +18 -0
  201. package/dist/server/handlers/knowledge.d.ts.map +1 -1
  202. package/dist/server/handlers/knowledge.js +1 -1
  203. package/dist/server/handlers/logs.cjs +1 -1
  204. package/dist/server/handlers/logs.d.ts +6 -0
  205. package/dist/server/handlers/logs.d.ts.map +1 -1
  206. package/dist/server/handlers/logs.js +1 -1
  207. package/dist/server/handlers/mcp-client-versions.cjs +2 -2
  208. package/dist/server/handlers/mcp-client-versions.d.ts +14 -0
  209. package/dist/server/handlers/mcp-client-versions.d.ts.map +1 -1
  210. package/dist/server/handlers/mcp-client-versions.js +2 -2
  211. package/dist/server/handlers/mcp.cjs +1 -1
  212. package/dist/server/handlers/mcp.d.ts +42 -0
  213. package/dist/server/handlers/mcp.d.ts.map +1 -1
  214. package/dist/server/handlers/mcp.js +1 -1
  215. package/dist/server/handlers/memory.cjs +1 -1
  216. package/dist/server/handlers/memory.d.ts +52 -0
  217. package/dist/server/handlers/memory.d.ts.map +1 -1
  218. package/dist/server/handlers/memory.js +1 -1
  219. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  220. package/dist/server/handlers/observability-new-endpoints.d.ts +153 -1
  221. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  222. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  223. package/dist/server/handlers/observability-shared.cjs +2 -1
  224. package/dist/server/handlers/observability-shared.cjs.map +1 -1
  225. package/dist/server/handlers/observability-shared.d.ts +9 -0
  226. package/dist/server/handlers/observability-shared.d.ts.map +1 -1
  227. package/dist/server/handlers/observability-shared.js +2 -2
  228. package/dist/server/handlers/observability-shared.js.map +1 -1
  229. package/dist/server/handlers/observability-signal-context.cjs +1 -1
  230. package/dist/server/handlers/observability-signal-context.js +1 -1
  231. package/dist/server/handlers/observability.cjs +2 -2
  232. package/dist/server/handlers/observability.d.ts +12 -0
  233. package/dist/server/handlers/observability.d.ts.map +1 -1
  234. package/dist/server/handlers/observability.js +2 -2
  235. package/dist/server/handlers/plans.cjs +1 -1
  236. package/dist/server/handlers/plans.d.ts +2 -0
  237. package/dist/server/handlers/plans.d.ts.map +1 -1
  238. package/dist/server/handlers/plans.js +1 -1
  239. package/dist/server/handlers/processor-providers.cjs +1 -1
  240. package/dist/server/handlers/processor-providers.d.ts +4 -0
  241. package/dist/server/handlers/processor-providers.d.ts.map +1 -1
  242. package/dist/server/handlers/processor-providers.js +1 -1
  243. package/dist/server/handlers/processors.cjs +57 -6
  244. package/dist/server/handlers/processors.cjs.map +1 -1
  245. package/dist/server/handlers/processors.d.ts +6 -0
  246. package/dist/server/handlers/processors.d.ts.map +1 -1
  247. package/dist/server/handlers/processors.js +57 -6
  248. package/dist/server/handlers/processors.js.map +1 -1
  249. package/dist/server/handlers/prompt-block-versions.cjs +2 -2
  250. package/dist/server/handlers/prompt-block-versions.d.ts +14 -0
  251. package/dist/server/handlers/prompt-block-versions.d.ts.map +1 -1
  252. package/dist/server/handlers/prompt-block-versions.js +2 -2
  253. package/dist/server/handlers/responses.cjs +1 -1
  254. package/dist/server/handlers/responses.d.ts +17 -11
  255. package/dist/server/handlers/responses.d.ts.map +1 -1
  256. package/dist/server/handlers/responses.js +1 -1
  257. package/dist/server/handlers/responses.storage.cjs +4 -3
  258. package/dist/server/handlers/responses.storage.cjs.map +1 -1
  259. package/dist/server/handlers/responses.storage.d.ts.map +1 -1
  260. package/dist/server/handlers/responses.storage.js +4 -3
  261. package/dist/server/handlers/responses.storage.js.map +1 -1
  262. package/dist/server/handlers/schedules.cjs +1 -1
  263. package/dist/server/handlers/schedules.d.ts +18 -0
  264. package/dist/server/handlers/schedules.d.ts.map +1 -1
  265. package/dist/server/handlers/schedules.js +1 -1
  266. package/dist/server/handlers/scorer-versions.cjs +2 -2
  267. package/dist/server/handlers/scorer-versions.d.ts +14 -0
  268. package/dist/server/handlers/scorer-versions.d.ts.map +1 -1
  269. package/dist/server/handlers/scorer-versions.js +2 -2
  270. package/dist/server/handlers/scores.cjs +1 -1
  271. package/dist/server/handlers/scores.d.ts +12 -0
  272. package/dist/server/handlers/scores.d.ts.map +1 -1
  273. package/dist/server/handlers/scores.js +1 -1
  274. package/dist/server/handlers/stored-agent-favorites.cjs +3 -3
  275. package/dist/server/handlers/stored-agent-favorites.d.ts +4 -0
  276. package/dist/server/handlers/stored-agent-favorites.d.ts.map +1 -1
  277. package/dist/server/handlers/stored-agent-favorites.js +3 -3
  278. package/dist/server/handlers/stored-agents.cjs +41 -3
  279. package/dist/server/handlers/stored-agents.cjs.map +1 -1
  280. package/dist/server/handlers/stored-agents.d.ts +14 -0
  281. package/dist/server/handlers/stored-agents.d.ts.map +1 -1
  282. package/dist/server/handlers/stored-agents.js +41 -3
  283. package/dist/server/handlers/stored-agents.js.map +1 -1
  284. package/dist/server/handlers/stored-mcp-clients.cjs +2 -2
  285. package/dist/server/handlers/stored-mcp-clients.d.ts +10 -0
  286. package/dist/server/handlers/stored-mcp-clients.d.ts.map +1 -1
  287. package/dist/server/handlers/stored-mcp-clients.js +2 -2
  288. package/dist/server/handlers/stored-prompt-blocks.cjs +2 -2
  289. package/dist/server/handlers/stored-prompt-blocks.d.ts +10 -0
  290. package/dist/server/handlers/stored-prompt-blocks.d.ts.map +1 -1
  291. package/dist/server/handlers/stored-prompt-blocks.js +2 -2
  292. package/dist/server/handlers/stored-scorers.cjs +2 -2
  293. package/dist/server/handlers/stored-scorers.d.ts +10 -0
  294. package/dist/server/handlers/stored-scorers.d.ts.map +1 -1
  295. package/dist/server/handlers/stored-scorers.js +2 -2
  296. package/dist/server/handlers/stored-skill-favorites.cjs +3 -3
  297. package/dist/server/handlers/stored-skill-favorites.d.ts +4 -0
  298. package/dist/server/handlers/stored-skill-favorites.d.ts.map +1 -1
  299. package/dist/server/handlers/stored-skill-favorites.js +3 -3
  300. package/dist/server/handlers/stored-skills.cjs +3 -3
  301. package/dist/server/handlers/stored-skills.d.ts +12 -0
  302. package/dist/server/handlers/stored-skills.d.ts.map +1 -1
  303. package/dist/server/handlers/stored-skills.js +3 -3
  304. package/dist/server/handlers/stored-workspaces.cjs +2 -2
  305. package/dist/server/handlers/stored-workspaces.d.ts +10 -0
  306. package/dist/server/handlers/stored-workspaces.d.ts.map +1 -1
  307. package/dist/server/handlers/stored-workspaces.js +2 -2
  308. package/dist/server/handlers/system.cjs +2 -2
  309. package/dist/server/handlers/system.d.ts +4 -0
  310. package/dist/server/handlers/system.d.ts.map +1 -1
  311. package/dist/server/handlers/system.js +2 -2
  312. package/dist/server/handlers/tool-providers.cjs +2 -2
  313. package/dist/server/handlers/tool-providers.d.ts +26 -0
  314. package/dist/server/handlers/tool-providers.d.ts.map +1 -1
  315. package/dist/server/handlers/tool-providers.js +2 -2
  316. package/dist/server/handlers/tools.cjs +2 -1
  317. package/dist/server/handlers/tools.d.ts +20 -0
  318. package/dist/server/handlers/tools.d.ts.map +1 -1
  319. package/dist/server/handlers/tools.js +1 -1
  320. package/dist/server/handlers/utils.cjs +1 -1
  321. package/dist/server/handlers/utils.js +1 -1
  322. package/dist/server/handlers/validate-agent-instructions.cjs +1 -1
  323. package/dist/server/handlers/validate-agent-instructions.js +1 -1
  324. package/dist/server/handlers/vector.cjs +1 -1
  325. package/dist/server/handlers/vector.d.ts +16 -0
  326. package/dist/server/handlers/vector.d.ts.map +1 -1
  327. package/dist/server/handlers/vector.js +1 -1
  328. package/dist/server/handlers/voice.cjs +1 -1
  329. package/dist/server/handlers/voice.d.ts.map +1 -1
  330. package/dist/server/handlers/voice.js +1 -1
  331. package/dist/server/handlers/workflow-builder.cjs +1 -1
  332. package/dist/server/handlers/workflow-builder.d.ts +4 -0
  333. package/dist/server/handlers/workflow-builder.d.ts.map +1 -1
  334. package/dist/server/handlers/workflow-builder.js +1 -1
  335. package/dist/server/handlers/workflows.cjs +2 -1
  336. package/dist/server/handlers/workflows.d.ts +57 -0
  337. package/dist/server/handlers/workflows.d.ts.map +1 -1
  338. package/dist/server/handlers/workflows.js +1 -1
  339. package/dist/server/handlers/workspace.cjs +1 -1
  340. package/dist/server/handlers/workspace.d.ts +103 -23
  341. package/dist/server/handlers/workspace.d.ts.map +1 -1
  342. package/dist/server/handlers/workspace.js +1 -1
  343. package/dist/server/handlers.cjs +17 -17
  344. package/dist/server/handlers.js +17 -17
  345. package/dist/server/mcp/capabilities.d.ts +25 -0
  346. package/dist/server/mcp/capabilities.d.ts.map +1 -0
  347. package/dist/server/mcp/catalogue.d.ts +76 -0
  348. package/dist/server/mcp/catalogue.d.ts.map +1 -0
  349. package/dist/server/mcp/config.d.ts +49 -0
  350. package/dist/server/mcp/config.d.ts.map +1 -0
  351. package/dist/server/mcp/descriptor.d.ts +40 -0
  352. package/dist/server/mcp/descriptor.d.ts.map +1 -0
  353. package/dist/server/mcp/oauth.d.ts +46 -0
  354. package/dist/server/mcp/oauth.d.ts.map +1 -0
  355. package/dist/server/mcp/result-size.d.ts +26 -0
  356. package/dist/server/mcp/result-size.d.ts.map +1 -0
  357. package/dist/server/mcp/route.d.ts +21 -0
  358. package/dist/server/mcp/route.d.ts.map +1 -0
  359. package/dist/server/mcp/schema.d.ts +13 -0
  360. package/dist/server/mcp/schema.d.ts.map +1 -0
  361. package/dist/server/mcp/toolsets/memory.d.ts +8 -0
  362. package/dist/server/mcp/toolsets/memory.d.ts.map +1 -0
  363. package/dist/server/mcp/toolsets/observability.d.ts +4 -0
  364. package/dist/server/mcp/toolsets/observability.d.ts.map +1 -0
  365. package/dist/server/mcp/toolsets/stored-agents.d.ts +8 -0
  366. package/dist/server/mcp/toolsets/stored-agents.d.ts.map +1 -0
  367. package/dist/server/schemas/index.cjs +8 -9
  368. package/dist/server/schemas/index.js +2 -3
  369. package/dist/server/server-adapter/api-schema-manifest.d.ts +1 -1
  370. package/dist/server/server-adapter/index.cjs +45 -1831
  371. package/dist/server/server-adapter/index.d.ts +126 -3
  372. package/dist/server/server-adapter/index.d.ts.map +1 -1
  373. package/dist/server/server-adapter/index.js +7 -1805
  374. package/dist/server/server-adapter/openapi-utils.d.ts +2 -2
  375. package/dist/server/server-adapter/openapi-utils.d.ts.map +1 -1
  376. package/dist/server/server-adapter/routes/a2a.d.ts +4 -0
  377. package/dist/server/server-adapter/routes/a2a.d.ts.map +1 -1
  378. package/dist/server/server-adapter/routes/agent-builder.d.ts +32 -0
  379. package/dist/server/server-adapter/routes/agent-builder.d.ts.map +1 -1
  380. package/dist/server/server-adapter/routes/channels.d.ts +10 -0
  381. package/dist/server/server-adapter/routes/channels.d.ts.map +1 -1
  382. package/dist/server/server-adapter/routes/conversations.d.ts +11 -3
  383. package/dist/server/server-adapter/routes/conversations.d.ts.map +1 -1
  384. package/dist/server/server-adapter/routes/datasets.d.ts +66 -0
  385. package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
  386. package/dist/server/server-adapter/routes/editor-builder.d.ts +20 -0
  387. package/dist/server/server-adapter/routes/editor-builder.d.ts.map +1 -1
  388. package/dist/server/server-adapter/routes/index.d.ts +26 -1
  389. package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
  390. package/dist/server/server-adapter/routes/knowledge.d.ts +18 -0
  391. package/dist/server/server-adapter/routes/knowledge.d.ts.map +1 -1
  392. package/dist/server/server-adapter/routes/legacy.d.ts +8 -0
  393. package/dist/server/server-adapter/routes/legacy.d.ts.map +1 -1
  394. package/dist/server/server-adapter/routes/logs.d.ts +6 -0
  395. package/dist/server/server-adapter/routes/logs.d.ts.map +1 -1
  396. package/dist/server/server-adapter/routes/mcp.d.ts +37 -1
  397. package/dist/server/server-adapter/routes/mcp.d.ts.map +1 -1
  398. package/dist/server/server-adapter/routes/memory.d.ts +52 -0
  399. package/dist/server/server-adapter/routes/memory.d.ts.map +1 -1
  400. package/dist/server/server-adapter/routes/observability.d.ts +92 -0
  401. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  402. package/dist/server/server-adapter/routes/processor-providers.d.ts +4 -0
  403. package/dist/server/server-adapter/routes/processor-providers.d.ts.map +1 -1
  404. package/dist/server/server-adapter/routes/processors.d.ts +6 -0
  405. package/dist/server/server-adapter/routes/processors.d.ts.map +1 -1
  406. package/dist/server/server-adapter/routes/responses.d.ts +6 -0
  407. package/dist/server/server-adapter/routes/responses.d.ts.map +1 -1
  408. package/dist/server/server-adapter/routes/route-builder.d.ts +5 -1
  409. package/dist/server/server-adapter/routes/route-builder.d.ts.map +1 -1
  410. package/dist/server/server-adapter/routes/scorers.d.ts +12 -0
  411. package/dist/server/server-adapter/routes/scorers.d.ts.map +1 -1
  412. package/dist/server/server-adapter/routes/stored-mcp-clients.d.ts +24 -0
  413. package/dist/server/server-adapter/routes/stored-mcp-clients.d.ts.map +1 -1
  414. package/dist/server/server-adapter/routes/stored-prompt-blocks.d.ts +24 -0
  415. package/dist/server/server-adapter/routes/stored-prompt-blocks.d.ts.map +1 -1
  416. package/dist/server/server-adapter/routes/stored-scorers.d.ts +24 -0
  417. package/dist/server/server-adapter/routes/stored-scorers.d.ts.map +1 -1
  418. package/dist/server/server-adapter/routes/stored-skills.d.ts +16 -0
  419. package/dist/server/server-adapter/routes/stored-skills.d.ts.map +1 -1
  420. package/dist/server/server-adapter/routes/stored-workspaces.d.ts +10 -0
  421. package/dist/server/server-adapter/routes/stored-workspaces.d.ts.map +1 -1
  422. package/dist/server/server-adapter/routes/system.d.ts +4 -0
  423. package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
  424. package/dist/server/server-adapter/routes/tool-providers.d.ts +26 -0
  425. package/dist/server/server-adapter/routes/tool-providers.d.ts.map +1 -1
  426. package/dist/server/server-adapter/routes/tools.d.ts +6 -0
  427. package/dist/server/server-adapter/routes/tools.d.ts.map +1 -1
  428. package/dist/server/server-adapter/routes/vectors.d.ts +16 -0
  429. package/dist/server/server-adapter/routes/vectors.d.ts.map +1 -1
  430. package/dist/server/server-adapter/routes/workflows.d.ts +50 -0
  431. package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -1
  432. package/dist/server/server-adapter/routes/workspace.d.ts +42 -0
  433. package/dist/server/server-adapter/routes/workspace.d.ts.map +1 -1
  434. package/dist/server-adapter-B7dLE5si.cjs +2386 -0
  435. package/dist/server-adapter-B7dLE5si.cjs.map +1 -0
  436. package/dist/server-adapter-BywLWVKp.js +2189 -0
  437. package/dist/server-adapter-BywLWVKp.js.map +1 -0
  438. package/dist/{tools-Daot5Zgz.cjs → tools-CawMeeZg.cjs} +71 -29
  439. package/dist/tools-CawMeeZg.cjs.map +1 -0
  440. package/dist/{tools-BJFq9JKF.js → tools-oHRh4msa.js} +65 -29
  441. package/dist/tools-oHRh4msa.js.map +1 -0
  442. package/dist/{utils-yedETkNk.js → utils-BfySxdfF.js} +3 -3
  443. package/dist/{utils-yedETkNk.js.map → utils-BfySxdfF.js.map} +1 -1
  444. package/dist/{utils-BXEJ6FZC.cjs → utils-DFhesFfA.cjs} +2 -2
  445. package/dist/{utils-BXEJ6FZC.cjs.map → utils-DFhesFfA.cjs.map} +1 -1
  446. package/dist/{utils-DptI_ERr.cjs → utils-Dn_OA_6N.cjs} +6 -6
  447. package/dist/{utils-DptI_ERr.cjs.map → utils-Dn_OA_6N.cjs.map} +1 -1
  448. package/dist/{utils-CTYtskHa.js → utils-Dv1D6ob-.js} +2 -2
  449. package/dist/{utils-CTYtskHa.js.map → utils-Dv1D6ob-.js.map} +1 -1
  450. package/dist/{vector-CZ26vo6u.js → vector-Bz-glead.js} +2 -2
  451. package/dist/{vector-CZ26vo6u.js.map → vector-Bz-glead.js.map} +1 -1
  452. package/dist/{vector-DBe45tnv.cjs → vector-DIFU_fwU.cjs} +2 -2
  453. package/dist/{vector-DBe45tnv.cjs.map → vector-DIFU_fwU.cjs.map} +1 -1
  454. package/dist/voice-C6bAqs79.js +42 -0
  455. package/dist/voice-C6bAqs79.js.map +1 -0
  456. package/dist/{voice-CBbxcsCM.cjs → voice-Dk0O5mVD.cjs} +29 -9
  457. package/dist/voice-Dk0O5mVD.cjs.map +1 -0
  458. package/dist/{workflow-builder-CkrdTcoM.cjs → workflow-builder-BPUjAdaC.cjs} +5 -5
  459. package/dist/{workflow-builder-CkrdTcoM.cjs.map → workflow-builder-BPUjAdaC.cjs.map} +1 -1
  460. package/dist/{workflow-builder-C5ufahUw.js → workflow-builder-D2fwGsLw.js} +5 -5
  461. package/dist/{workflow-builder-C5ufahUw.js.map → workflow-builder-D2fwGsLw.js.map} +1 -1
  462. package/dist/{workflows-C_Mqj_80.js → workflows-B-QJ0Tnv.js} +38 -7
  463. package/dist/workflows-B-QJ0Tnv.js.map +1 -0
  464. package/dist/{workflows-B5uWFrJ1.cjs → workflows-CwkEHIKW.cjs} +43 -6
  465. package/dist/workflows-CwkEHIKW.cjs.map +1 -0
  466. package/dist/{workspace-BwlPQO3M.js → workspace-CbTB2svI.js} +99 -41
  467. package/dist/workspace-CbTB2svI.js.map +1 -0
  468. package/dist/{workspace-CD9pQ61P.cjs → workspace-CsPtSXQd.cjs} +99 -41
  469. package/dist/workspace-CsPtSXQd.cjs.map +1 -0
  470. package/package.json +14 -7
  471. package/dist/a2a-DIcMx6x-.cjs.map +0 -1
  472. package/dist/a2a-DTTGA2Xg.js.map +0 -1
  473. package/dist/agents-BCgiMlDq.js.map +0 -1
  474. package/dist/agents-CTgjTASj.js.map +0 -1
  475. package/dist/agents-CjcvdF2e.cjs.map +0 -1
  476. package/dist/agents-DjpBmwhv.cjs.map +0 -1
  477. package/dist/api-schema-manifest-CJz_hWjy.cjs.map +0 -1
  478. package/dist/api-schema-manifest-CkB5OGjC.js.map +0 -1
  479. package/dist/constants-CXAvBYcz.js.map +0 -1
  480. package/dist/constants-DMg8hUOR.cjs.map +0 -1
  481. package/dist/conversations-BFqmDglO.cjs.map +0 -1
  482. package/dist/conversations-BkX00xDs.js.map +0 -1
  483. package/dist/dist-4NnakSte.js +0 -1
  484. package/dist/editor-builder-C4H2l6tz.js.map +0 -1
  485. package/dist/editor-builder-Cqw1npOK.cjs.map +0 -1
  486. package/dist/helpers-0LJI4DxR.cjs.map +0 -1
  487. package/dist/helpers-C9QZKOhz.js.map +0 -1
  488. package/dist/memory-BRE3ofvI.cjs.map +0 -1
  489. package/dist/memory-Dw7xG5nn.js.map +0 -1
  490. package/dist/observability-C2HjrCpw.cjs.map +0 -1
  491. package/dist/observability-Ca3TxxY7.js.map +0 -1
  492. package/dist/observability-new-endpoints-B3X2L7cj.js.map +0 -1
  493. package/dist/observability-new-endpoints-DnzWjscD.cjs.map +0 -1
  494. package/dist/plans-D_GKFz2x.js.map +0 -1
  495. package/dist/plans-_nR8lqgD.cjs.map +0 -1
  496. package/dist/responses-C_OEJoxU.js.map +0 -1
  497. package/dist/responses-CdWbS4jA.cjs.map +0 -1
  498. package/dist/routes-CQZ0Z77B.cjs.map +0 -1
  499. package/dist/routes-CqzWkepR.js.map +0 -1
  500. package/dist/routes-CtGp_lBn.cjs +0 -523
  501. package/dist/routes-CtGp_lBn.cjs.map +0 -1
  502. package/dist/routes-MRZFTKei.js +0 -446
  503. package/dist/routes-MRZFTKei.js.map +0 -1
  504. package/dist/schedules-BQvnAe1j.cjs.map +0 -1
  505. package/dist/schedules-BcAIELfB.js.map +0 -1
  506. package/dist/scores-DEvPN0kz.cjs.map +0 -1
  507. package/dist/scores-Dm0yu1Pt.js.map +0 -1
  508. package/dist/server/server-adapter/index.cjs.map +0 -1
  509. package/dist/server/server-adapter/index.js.map +0 -1
  510. package/dist/tools-BJFq9JKF.js.map +0 -1
  511. package/dist/tools-Daot5Zgz.cjs.map +0 -1
  512. package/dist/voice-CBbxcsCM.cjs.map +0 -1
  513. package/dist/voice-CzFWhWPJ.js +0 -22
  514. package/dist/voice-CzFWhWPJ.js.map +0 -1
  515. package/dist/workflows-B5uWFrJ1.cjs.map +0 -1
  516. package/dist/workflows-C_Mqj_80.js.map +0 -1
  517. package/dist/workspace-BwlPQO3M.js.map +0 -1
  518. package/dist/workspace-CD9pQ61P.cjs.map +0 -1
  519. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/_types/@internal_ai-sdk-v4@0.0.95/dist/index.d.ts +0 -0
  520. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/_types/@internal_ai-sdk-v5@0.0.95/dist/index.d.ts +0 -0
  521. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/_types/@internal_ai-v6@0.0.95/dist/index.d.ts +0 -0
  522. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/_types/@standard-schema_spec@1.1.0/dist/index.d.ts +0 -0
  523. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/_types/@types_json-schema@7.0.15/index.d.ts +0 -0
  524. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/index.d.ts +0 -0
  525. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/null-to-undefined.d.ts +0 -0
  526. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/provider-compats/anthropic.d.ts +0 -0
  527. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/provider-compats/deepseek.d.ts +0 -0
  528. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/provider-compats/google.d.ts +0 -0
  529. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/provider-compats/meta.d.ts +0 -0
  530. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/provider-compats/openai-reasoning.d.ts +0 -0
  531. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/provider-compats/openai.d.ts +0 -0
  532. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/schema-compatibility-v3.d.ts +0 -0
  533. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/schema-compatibility-v4.d.ts +0 -0
  534. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/schema-compatibility.d.ts +0 -0
  535. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/schema.d.ts +0 -0
  536. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/schema.types.d.ts +0 -0
  537. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/standard-schema/standard-schema.d.ts +0 -0
  538. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/standard-schema/standard-schema.types.d.ts +0 -0
  539. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/standard-schema-compat.d.ts +0 -0
  540. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/types.d.ts +0 -0
  541. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/utils.d.ts +0 -0
  542. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/dist/zod-to-json.d.ts +0 -0
  543. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0-alpha.2}/package.json +0 -0
@@ -2,7 +2,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../rolldown-runtime-10nMEhjP.cjs");
3
3
  const require_http_exception = require("../../http-exception-Co3MbFUf.cjs");
4
4
  const require_processors = require("../../processors-BEut-2a-.cjs");
5
- const require_route_builder = require("../../route-builder-B9C5vT54.cjs");
5
+ const require_route_builder = require("../../route-builder-DjTBxSZN.cjs");
6
+ const require_server_handlers_agent_access = require("./agent-access.cjs");
7
+ const require_server_handlers_authorship = require("./authorship.cjs");
6
8
  const require_server_handlers_error = require("./error.cjs");
7
9
  let _mastra_core_agent = require("@mastra/core/agent");
8
10
  let _mastra_core_processors = require("@mastra/core/processors");
@@ -42,6 +44,55 @@ function detectProcessorPhases(processor) {
42
44
  if (typeof processor.processLLMRequest === "function") phases.push("llmRequest");
43
45
  return phases;
44
46
  }
47
+ /**
48
+ * Returns a filter that drops processor configurations of stored agents the caller can't read. An agent adds its
49
+ * configurations when it is attached to Mastra, which also happens to sub-agents that aren't in the registry, so an
50
+ * agent that isn't registered is decided from its stored record. With no record, a configuration a stored agent added
51
+ * is hidden (the agent was deleted while an instance of it was still in use, e.g. as a sub-agent), and any other is a
52
+ * code sub-agent or another agent built in code, visible to everyone like registered code agents.
53
+ * `Mastra.removeAgent` drops the configurations of the agents it removes, registered or not.
54
+ */
55
+ function createProcessorConfigurationFilter(mastra, requestContext) {
56
+ const agents = mastra.listAgents() || {};
57
+ const decided = /* @__PURE__ */ new Map();
58
+ const isVisible = async (agentId, fromStoredAgent) => {
59
+ try {
60
+ const agent = agents[agentId];
61
+ if (agent) {
62
+ require_server_handlers_agent_access.assertStoredAgentAccess({
63
+ agent,
64
+ agentId,
65
+ requestContext,
66
+ access: "read"
67
+ });
68
+ return true;
69
+ }
70
+ const record = await (await mastra.getStorage()?.getStore("agents"))?.getById(agentId);
71
+ if (record) {
72
+ require_server_handlers_authorship.assertReadAccess({
73
+ requestContext,
74
+ resource: "stored-agents",
75
+ resourceId: agentId,
76
+ record
77
+ });
78
+ return true;
79
+ }
80
+ return !fromStoredAgent;
81
+ } catch (error) {
82
+ if (error instanceof require_http_exception.HTTPException) return false;
83
+ throw error;
84
+ }
85
+ };
86
+ return async (configs) => {
87
+ const visible = await Promise.all(configs.map((c) => {
88
+ const fromStoredAgent = c.source === "stored";
89
+ const key = `${fromStoredAgent}:${c.agentId}`;
90
+ if (!decided.has(key)) decided.set(key, isVisible(c.agentId, fromStoredAgent));
91
+ return decided.get(key);
92
+ }));
93
+ return configs.filter((_, i) => visible[i]);
94
+ };
95
+ }
45
96
  const LIST_PROCESSORS_ROUTE = require_route_builder.createRoute({
46
97
  method: "GET",
47
98
  path: "/processors",
@@ -51,17 +102,18 @@ const LIST_PROCESSORS_ROUTE = require_route_builder.createRoute({
51
102
  description: "Returns a list of all available individual processors",
52
103
  tags: ["Processors"],
53
104
  requiresAuth: true,
54
- handler: async ({ mastra }) => {
105
+ handler: async ({ mastra, requestContext }) => {
55
106
  try {
56
107
  const processors = mastra.listProcessors() || {};
57
108
  const processorConfigurations = mastra.listProcessorConfigurations();
109
+ const visibleConfigurations = createProcessorConfigurationFilter(mastra, requestContext);
58
110
  const result = {};
59
111
  for (const [processorKey, processorEntry] of Object.entries(processors)) {
60
112
  const processor = processorEntry;
61
113
  const processorId = processor.id || processorKey;
62
114
  const isWorkflow = (0, _mastra_core_processors.isProcessorWorkflow)(processor);
63
115
  const phases = detectProcessorPhases(processor);
64
- const configs = processorConfigurations.get(processorId) || [];
116
+ const configs = await visibleConfigurations(processorConfigurations.get(processorId) || []);
65
117
  const agentIds = [...new Set(configs.map((c) => c.agentId))];
66
118
  const configurations = configs.map((c) => ({
67
119
  agentId: c.agentId,
@@ -93,7 +145,7 @@ const GET_PROCESSOR_BY_ID_ROUTE = require_route_builder.createRoute({
93
145
  description: "Returns details for a specific processor including its phases and configurations",
94
146
  tags: ["Processors"],
95
147
  requiresAuth: true,
96
- handler: async ({ mastra, processorId }) => {
148
+ handler: async ({ mastra, requestContext, processorId }) => {
97
149
  try {
98
150
  let processorEntry;
99
151
  try {
@@ -104,9 +156,8 @@ const GET_PROCESSOR_BY_ID_ROUTE = require_route_builder.createRoute({
104
156
  if (!processorEntry) throw new require_http_exception.HTTPException(404, { message: "Processor not found" });
105
157
  const isWorkflow = (0, _mastra_core_processors.isProcessorWorkflow)(processorEntry);
106
158
  const phases = detectProcessorPhases(processorEntry);
107
- const configs = mastra.getProcessorConfigurations(processorId);
108
159
  const agents = mastra.listAgents() || {};
109
- const configurations = configs.map((c) => ({
160
+ const configurations = (await createProcessorConfigurationFilter(mastra, requestContext)(mastra.getProcessorConfigurations(processorId))).map((c) => ({
110
161
  agentId: c.agentId,
111
162
  agentName: agents[c.agentId]?.name || c.agentId,
112
163
  type: c.type
@@ -1 +1 @@
1
- {"version":3,"file":"processors.cjs","names":["isProcessorWorkflow","createRoute","listProcessorsResponseSchema","handleError","processorIdPathParams","serializedProcessorDetailSchema","HTTPException","executeProcessorBodySchema","executeProcessorResponseSchema","MessageList"],"sources":["../../../src/server/handlers/processors.ts"],"sourcesContent":["import { MessageList } from '@mastra/core/agent';\nimport type { MessageInput } from '@mastra/core/agent/message-list';\nimport { isProcessorWorkflow } from '@mastra/core/processors';\nimport type { Processor, ProcessorWorkflow } from '@mastra/core/processors';\n\nimport { HTTPException } from '../http-exception';\nimport {\n listProcessorsResponseSchema,\n serializedProcessorDetailSchema,\n processorIdPathParams,\n executeProcessorBodySchema,\n executeProcessorResponseSchema,\n} from '../schemas/processors';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { handleError } from './error';\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\ntype ProcessorPhase =\n | 'input'\n | 'inputStep'\n | 'outputStream'\n | 'outputResult'\n | 'outputStep'\n | 'toolResult'\n | 'llmRequest';\n\n/**\n * Helper to extract text from messages for outputStep testing.\n * In real usage, the `text` field contains the assistant's response text.\n */\nfunction extractTextFromMessages(messages: unknown[]): string {\n if (!messages || !Array.isArray(messages) || messages.length === 0) {\n return '';\n }\n const firstMessage = messages[0] as any;\n if (firstMessage?.content?.parts) {\n const textParts = firstMessage.content.parts\n .filter((part: any) => part?.type === 'text')\n .map((part: any) => part?.text || '');\n return textParts.join('');\n }\n return '';\n}\n\n/**\n * Helper to detect phases for a processor.\n * For individual processors, checks which methods are implemented.\n * For workflow processors, returns all phases since createStep handles each phase\n * and it's a no-op if the underlying processor doesn't implement it.\n */\nfunction detectProcessorPhases(processor: any): ProcessorPhase[] {\n // Check if it's a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Workflow processors can potentially handle all phases\n // The createStep in workflows handles each phase and it's a no-op if not implemented\n return ['input', 'inputStep', 'outputStream', 'outputResult', 'outputStep', 'toolResult'];\n }\n\n // For individual processors, detect by checking which methods exist\n const phases: ProcessorPhase[] = [];\n if (typeof processor.processInput === 'function') {\n phases.push('input');\n }\n if (typeof processor.processInputStep === 'function') {\n phases.push('inputStep');\n }\n if (typeof processor.processOutputStream === 'function') {\n phases.push('outputStream');\n }\n if (typeof processor.processOutputResult === 'function') {\n phases.push('outputResult');\n }\n if (typeof processor.processOutputStep === 'function') {\n phases.push('outputStep');\n }\n if (typeof processor.processToolResult === 'function') {\n phases.push('toolResult');\n }\n if (typeof processor.processLLMRequest === 'function') {\n phases.push('llmRequest');\n }\n return phases;\n}\n\nexport const LIST_PROCESSORS_ROUTE = createRoute({\n method: 'GET',\n path: '/processors',\n responseType: 'json',\n responseSchema: listProcessorsResponseSchema,\n summary: 'List all processors',\n description: 'Returns a list of all available individual processors',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra }) => {\n try {\n const processors = mastra.listProcessors() || {};\n const processorConfigurations = mastra.listProcessorConfigurations();\n const result: Record<\n string,\n {\n id: string;\n name?: string;\n description?: string;\n phases: ProcessorPhase[];\n agentIds: string[];\n configurations: Array<{ agentId: string; type: 'input' | 'output' }>;\n isWorkflow: boolean;\n }\n > = {};\n\n // Iterate through all individual processors registered with Mastra\n for (const [processorKey, processorEntry] of Object.entries(processors)) {\n const processor = processorEntry as Processor | ProcessorWorkflow;\n const processorId = processor.id || processorKey;\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processor);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processor);\n\n // Get agent configurations for this processor\n const configs = processorConfigurations.get(processorId) || [];\n const agentIds = [...new Set(configs.map(c => c.agentId))];\n const configurations = configs.map(c => ({ agentId: c.agentId, type: c.type }));\n\n result[processorId] = {\n id: processorId,\n name: processor.name || processorId,\n description: processor.description,\n phases,\n agentIds,\n configurations,\n isWorkflow,\n };\n }\n\n return result;\n } catch (error) {\n return handleError(error, 'Error getting processors');\n }\n },\n});\n\nexport const GET_PROCESSOR_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/processors/:processorId',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n responseSchema: serializedProcessorDetailSchema,\n summary: 'Get processor by ID',\n description: 'Returns details for a specific processor including its phases and configurations',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId }) => {\n try {\n // Get the processor from Mastra's registered processors\n let processorEntry: Processor | ProcessorWorkflow | undefined;\n try {\n processorEntry = mastra.getProcessorById(processorId) as Processor | ProcessorWorkflow;\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processorEntry = processors[processorId as keyof typeof processors] as Processor | ProcessorWorkflow;\n }\n\n if (!processorEntry) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processorEntry);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processorEntry);\n\n // Get agent configurations for this processor\n const configs = mastra.getProcessorConfigurations(processorId);\n const agents = mastra.listAgents() || {};\n const configurations = configs.map(c => ({\n agentId: c.agentId,\n agentName: agents[c.agentId]?.name || c.agentId,\n type: c.type,\n }));\n\n return {\n id: processorEntry.id,\n name: processorEntry.name || processorEntry.id,\n description: processorEntry.description,\n phases,\n configurations,\n isWorkflow,\n };\n } catch (error) {\n return handleError(error, 'Error getting processor');\n }\n },\n});\n\nexport const EXECUTE_PROCESSOR_ROUTE = createRoute({\n method: 'POST',\n path: '/processors/:processorId/execute',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n bodySchema: executeProcessorBodySchema,\n responseSchema: executeProcessorResponseSchema,\n summary: 'Execute processor',\n description: 'Executes a specific processor with the provided input data',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId, ...bodyParams }) => {\n try {\n const { phase, messages } = bodyParams;\n\n if (!processorId) {\n throw new HTTPException(400, { message: 'Processor ID is required' });\n }\n\n if (!phase) {\n throw new HTTPException(400, { message: 'Phase is required' });\n }\n\n if (phase === 'llmRequest') {\n // processLLMRequest operates on the provider prompt, not on messages\n throw new HTTPException(400, {\n message: 'llmRequest phase cannot be executed directly. It runs on the provider prompt during an agent call.',\n });\n }\n\n if (!messages || !Array.isArray(messages)) {\n throw new HTTPException(400, { message: 'Messages array is required' });\n }\n\n // Get the processor from Mastra's registered processors\n let processor;\n try {\n processor = mastra.getProcessorById(processorId);\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processor = processors[processorId as keyof typeof processors];\n }\n\n if (!processor) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n const messageList = new MessageList();\n messageList.add(messages as unknown as MessageInput[], 'input');\n\n // Check if this is a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Execute workflow processor\n try {\n // Build inputData based on phase - each phase has different required fields\n const baseInputData = {\n phase: phase as 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult',\n messages: messageList.get.all.db(),\n messageList,\n retryCount: 0,\n };\n let inputData: typeof baseInputData & Record<string, unknown> = baseInputData;\n\n // Add phase-specific fields\n switch (phase) {\n case 'input':\n inputData = {\n ...inputData,\n systemMessages: [],\n };\n break;\n case 'inputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n model: '',\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n };\n break;\n case 'outputResult':\n inputData = {\n ...inputData,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n };\n break;\n case 'outputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n };\n break;\n case 'outputStream':\n inputData = {\n ...inputData,\n part: null,\n streamParts: [],\n state: {},\n };\n break;\n case 'toolResult':\n inputData = {\n ...inputData,\n stepNumber: 0,\n toolName: '',\n toolCallId: '',\n args: undefined,\n toolResultValue: undefined,\n providerExecuted: false,\n systemMessages: [],\n steps: [],\n };\n break;\n }\n\n const run = await processor.createRun();\n const result = await run.start({\n inputData,\n });\n\n // Check for tripwire status\n if (result.status === 'tripwire') {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: result.tripwire.reason || `Tripwire triggered in workflow ${processor.id}`,\n metadata: result.tripwire.metadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n\n // Check for execution failure\n if (result.status !== 'success') {\n throw new HTTPException(500, {\n message: `Processor workflow ${processor.id} failed with status: ${result.status}`,\n });\n }\n\n // Extract output from workflow result\n const output = result.result;\n let outputMessages = messages;\n\n if (output && typeof output === 'object') {\n if ('messages' in output && Array.isArray(output.messages)) {\n outputMessages = output.messages;\n } else if ('messageList' in output && output.messageList instanceof MessageList) {\n outputMessages = output.messageList.get.all.db();\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Re-throw HTTP exceptions\n if (error instanceof HTTPException) {\n throw error;\n }\n throw new HTTPException(500, {\n message: `Error executing processor workflow: ${error.message}`,\n });\n }\n }\n\n // Handle individual processor execution\n // Create the abort function for tripwire support\n let tripwireTriggered = false;\n let tripwireReason: string | undefined;\n let tripwireMetadata: unknown;\n\n const abort = (reason?: string, options?: { retry?: boolean; metadata?: unknown }) => {\n tripwireTriggered = true;\n tripwireReason = reason;\n tripwireMetadata = options?.metadata;\n throw new Error(`TRIPWIRE:${reason || 'Processor aborted'}`);\n };\n\n // Build the context based on phase\n const baseContext = {\n abort,\n retryCount: 0,\n messages: messageList.get.all.db(),\n messageList,\n state: {},\n };\n\n try {\n let result: any;\n\n // Execute the specific phase method on the individual processor\n switch (phase) {\n case 'input':\n if (!processor.processInput) {\n throw new HTTPException(400, { message: 'Processor does not support input phase' });\n }\n result = await processor.processInput({\n ...baseContext,\n systemMessages: [],\n });\n break;\n\n case 'inputStep':\n if (!processor.processInputStep) {\n throw new HTTPException(400, { message: 'Processor does not support inputStep phase' });\n }\n result = await processor.processInputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n // Pass empty/default values for all inputStep fields\n model: '' as any,\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n });\n break;\n\n case 'outputResult':\n if (!processor.processOutputResult) {\n throw new HTTPException(400, { message: 'Processor does not support outputResult phase' });\n }\n result = await processor.processOutputResult({\n ...baseContext,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n });\n break;\n\n case 'outputStep':\n if (!processor.processOutputStep) {\n throw new HTTPException(400, { message: 'Processor does not support outputStep phase' });\n }\n result = await processor.processOutputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n usage: { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined },\n });\n break;\n\n case 'outputStream':\n // outputStream is for streaming chunks, not a simple execute\n throw new HTTPException(400, {\n message: 'outputStream phase cannot be executed directly. Use streaming instead.',\n });\n\n default:\n throw new HTTPException(400, { message: `Unknown phase: ${phase}` });\n }\n\n // Process the result\n let outputMessages = messages;\n if (result) {\n if (Array.isArray(result)) {\n outputMessages = result;\n } else if (result.get && result.get.all && typeof result.get.all.db === 'function') {\n // It's a MessageList\n outputMessages = result.get.all.db();\n } else if (result.messages) {\n outputMessages = result.messages;\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Check if it's a tripwire\n if (tripwireTriggered || error.message?.startsWith('TRIPWIRE:')) {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: tripwireReason || error.message?.replace('TRIPWIRE:', ''),\n metadata: tripwireMetadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n throw error;\n }\n } catch (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,OAAO,OAAO,OAAO,IAAI,IAAI,OAAO,YAEtE,iBAAiB,OAAO,IAAI,IAAI,GAAG;UAC9B,IAAI,OAAO,UAChB,iBAAiB,OAAO;IAE5B;IAEA,OAAO;KACL,SAAS;KACT;KACA,UAAU;KACV,aAAa,EACX,UAAU,eACZ;IACF;GACF,SAAS,OAAY;IAEnB,IAAI,qBAAqB,MAAM,SAAS,WAAW,WAAW,GAC5D,OAAO;KACL,SAAS;KACT;KACA,UAAU;MACR,WAAW;MACX,QAAQ,kBAAkB,MAAM,SAAS,QAAQ,aAAa,EAAE;MAChE,UAAU;KACZ;KACA;KACA,aAAa,EACX,SACF;IACF;IAEF,MAAM;GACR;EACF,SAAS,OAAO;GACd,OAAOH,8BAAAA,YAAY,OAAO,2BAA2B;EACvD;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"processors.cjs","names":["isProcessorWorkflow","HTTPException","createRoute","listProcessorsResponseSchema","handleError","processorIdPathParams","serializedProcessorDetailSchema","executeProcessorBodySchema","executeProcessorResponseSchema","MessageList"],"sources":["../../../src/server/handlers/processors.ts"],"sourcesContent":["import type { Mastra } from '@mastra/core';\nimport { MessageList } from '@mastra/core/agent';\nimport type { MessageInput } from '@mastra/core/agent/message-list';\nimport { isProcessorWorkflow } from '@mastra/core/processors';\nimport type { Processor, ProcessorWorkflow } from '@mastra/core/processors';\nimport type { RequestContext } from '@mastra/core/request-context';\n\nimport { HTTPException } from '../http-exception';\nimport {\n listProcessorsResponseSchema,\n serializedProcessorDetailSchema,\n processorIdPathParams,\n executeProcessorBodySchema,\n executeProcessorResponseSchema,\n} from '../schemas/processors';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredAgentAccess } from './agent-access';\nimport { assertReadAccess } from './authorship';\nimport type { OwnedRecord } from './authorship';\nimport { handleError } from './error';\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\ntype ProcessorPhase =\n | 'input'\n | 'inputStep'\n | 'outputStream'\n | 'outputResult'\n | 'outputStep'\n | 'toolResult'\n | 'llmRequest';\n\n/**\n * Helper to extract text from messages for outputStep testing.\n * In real usage, the `text` field contains the assistant's response text.\n */\nfunction extractTextFromMessages(messages: unknown[]): string {\n if (!messages || !Array.isArray(messages) || messages.length === 0) {\n return '';\n }\n const firstMessage = messages[0] as any;\n if (firstMessage?.content?.parts) {\n const textParts = firstMessage.content.parts\n .filter((part: any) => part?.type === 'text')\n .map((part: any) => part?.text || '');\n return textParts.join('');\n }\n return '';\n}\n\n/**\n * Helper to detect phases for a processor.\n * For individual processors, checks which methods are implemented.\n * For workflow processors, returns all phases since createStep handles each phase\n * and it's a no-op if the underlying processor doesn't implement it.\n */\nfunction detectProcessorPhases(processor: any): ProcessorPhase[] {\n // Check if it's a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Workflow processors can potentially handle all phases\n // The createStep in workflows handles each phase and it's a no-op if not implemented\n return ['input', 'inputStep', 'outputStream', 'outputResult', 'outputStep', 'toolResult'];\n }\n\n // For individual processors, detect by checking which methods exist\n const phases: ProcessorPhase[] = [];\n if (typeof processor.processInput === 'function') {\n phases.push('input');\n }\n if (typeof processor.processInputStep === 'function') {\n phases.push('inputStep');\n }\n if (typeof processor.processOutputStream === 'function') {\n phases.push('outputStream');\n }\n if (typeof processor.processOutputResult === 'function') {\n phases.push('outputResult');\n }\n if (typeof processor.processOutputStep === 'function') {\n phases.push('outputStep');\n }\n if (typeof processor.processToolResult === 'function') {\n phases.push('toolResult');\n }\n if (typeof processor.processLLMRequest === 'function') {\n phases.push('llmRequest');\n }\n return phases;\n}\n\n/**\n * Returns a filter that drops processor configurations of stored agents the caller can't read. An agent adds its\n * configurations when it is attached to Mastra, which also happens to sub-agents that aren't in the registry, so an\n * agent that isn't registered is decided from its stored record. With no record, a configuration a stored agent added\n * is hidden (the agent was deleted while an instance of it was still in use, e.g. as a sub-agent), and any other is a\n * code sub-agent or another agent built in code, visible to everyone like registered code agents.\n * `Mastra.removeAgent` drops the configurations of the agents it removes, registered or not.\n */\nfunction createProcessorConfigurationFilter(mastra: Mastra, requestContext: RequestContext) {\n const agents = mastra.listAgents() || {};\n const decided = new Map<string, Promise<boolean>>();\n\n const isVisible = async (agentId: string, fromStoredAgent: boolean): Promise<boolean> => {\n try {\n const agent = agents[agentId];\n if (agent) {\n assertStoredAgentAccess({ agent, agentId, requestContext, access: 'read' });\n return true;\n }\n const agentsStore = await mastra.getStorage()?.getStore('agents');\n const record = await agentsStore?.getById(agentId);\n if (record) {\n assertReadAccess({\n requestContext,\n resource: 'stored-agents',\n resourceId: agentId,\n record: record as OwnedRecord,\n });\n return true;\n }\n // No record: a code agent, or a stored agent that was deleted while an instance of it was still in use.\n return !fromStoredAgent;\n } catch (error) {\n if (error instanceof HTTPException) return false;\n throw error;\n }\n };\n\n return async <TConfig extends { agentId: string; source?: string }>(configs: TConfig[]): Promise<TConfig[]> => {\n const visible = await Promise.all(\n configs.map(c => {\n const fromStoredAgent = c.source === 'stored';\n const key = `${fromStoredAgent}:${c.agentId}`;\n if (!decided.has(key)) decided.set(key, isVisible(c.agentId, fromStoredAgent));\n return decided.get(key)!;\n }),\n );\n return configs.filter((_, i) => visible[i]);\n };\n}\n\nexport const LIST_PROCESSORS_ROUTE = createRoute({\n method: 'GET',\n path: '/processors',\n responseType: 'json',\n responseSchema: listProcessorsResponseSchema,\n summary: 'List all processors',\n description: 'Returns a list of all available individual processors',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, requestContext }) => {\n try {\n const processors = mastra.listProcessors() || {};\n const processorConfigurations = mastra.listProcessorConfigurations();\n const visibleConfigurations = createProcessorConfigurationFilter(mastra, requestContext);\n const result: Record<\n string,\n {\n id: string;\n name?: string;\n description?: string;\n phases: ProcessorPhase[];\n agentIds: string[];\n configurations: Array<{ agentId: string; type: 'input' | 'output' }>;\n isWorkflow: boolean;\n }\n > = {};\n\n // Iterate through all individual processors registered with Mastra\n for (const [processorKey, processorEntry] of Object.entries(processors)) {\n const processor = processorEntry as Processor | ProcessorWorkflow;\n const processorId = processor.id || processorKey;\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processor);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processor);\n\n // Get agent configurations for this processor\n const configs = await visibleConfigurations(processorConfigurations.get(processorId) || []);\n const agentIds = [...new Set(configs.map(c => c.agentId))];\n const configurations = configs.map(c => ({ agentId: c.agentId, type: c.type }));\n\n result[processorId] = {\n id: processorId,\n name: processor.name || processorId,\n description: processor.description,\n phases,\n agentIds,\n configurations,\n isWorkflow,\n };\n }\n\n return result;\n } catch (error) {\n return handleError(error, 'Error getting processors');\n }\n },\n});\n\nexport const GET_PROCESSOR_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/processors/:processorId',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n responseSchema: serializedProcessorDetailSchema,\n summary: 'Get processor by ID',\n description: 'Returns details for a specific processor including its phases and configurations',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, requestContext, processorId }) => {\n try {\n // Get the processor from Mastra's registered processors\n let processorEntry: Processor | ProcessorWorkflow | undefined;\n try {\n processorEntry = mastra.getProcessorById(processorId) as Processor | ProcessorWorkflow;\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processorEntry = processors[processorId as keyof typeof processors] as Processor | ProcessorWorkflow;\n }\n\n if (!processorEntry) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processorEntry);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processorEntry);\n\n // Get agent configurations for this processor\n const agents = mastra.listAgents() || {};\n const configs = await createProcessorConfigurationFilter(\n mastra,\n requestContext,\n )(mastra.getProcessorConfigurations(processorId));\n const configurations = configs.map(c => ({\n agentId: c.agentId,\n agentName: agents[c.agentId]?.name || c.agentId,\n type: c.type,\n }));\n\n return {\n id: processorEntry.id,\n name: processorEntry.name || processorEntry.id,\n description: processorEntry.description,\n phases,\n configurations,\n isWorkflow,\n };\n } catch (error) {\n return handleError(error, 'Error getting processor');\n }\n },\n});\n\nexport const EXECUTE_PROCESSOR_ROUTE = createRoute({\n method: 'POST',\n path: '/processors/:processorId/execute',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n bodySchema: executeProcessorBodySchema,\n responseSchema: executeProcessorResponseSchema,\n summary: 'Execute processor',\n description: 'Executes a specific processor with the provided input data',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId, ...bodyParams }) => {\n try {\n const { phase, messages } = bodyParams;\n\n if (!processorId) {\n throw new HTTPException(400, { message: 'Processor ID is required' });\n }\n\n if (!phase) {\n throw new HTTPException(400, { message: 'Phase is required' });\n }\n\n if (phase === 'llmRequest') {\n // processLLMRequest operates on the provider prompt, not on messages\n throw new HTTPException(400, {\n message: 'llmRequest phase cannot be executed directly. It runs on the provider prompt during an agent call.',\n });\n }\n\n if (!messages || !Array.isArray(messages)) {\n throw new HTTPException(400, { message: 'Messages array is required' });\n }\n\n // Get the processor from Mastra's registered processors\n let processor;\n try {\n processor = mastra.getProcessorById(processorId);\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processor = processors[processorId as keyof typeof processors];\n }\n\n if (!processor) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n const messageList = new MessageList();\n messageList.add(messages as unknown as MessageInput[], 'input');\n\n // Check if this is a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Execute workflow processor\n try {\n // Build inputData based on phase - each phase has different required fields\n const baseInputData = {\n phase: phase as 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult',\n messages: messageList.get.all.db(),\n messageList,\n retryCount: 0,\n };\n let inputData: typeof baseInputData & Record<string, unknown> = baseInputData;\n\n // Add phase-specific fields\n switch (phase) {\n case 'input':\n inputData = {\n ...inputData,\n systemMessages: [],\n };\n break;\n case 'inputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n model: '',\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n };\n break;\n case 'outputResult':\n inputData = {\n ...inputData,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n };\n break;\n case 'outputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n };\n break;\n case 'outputStream':\n inputData = {\n ...inputData,\n part: null,\n streamParts: [],\n state: {},\n };\n break;\n case 'toolResult':\n inputData = {\n ...inputData,\n stepNumber: 0,\n toolName: '',\n toolCallId: '',\n args: undefined,\n toolResultValue: undefined,\n providerExecuted: false,\n systemMessages: [],\n steps: [],\n };\n break;\n }\n\n const run = await processor.createRun();\n const result = await run.start({\n inputData,\n });\n\n // Check for tripwire status\n if (result.status === 'tripwire') {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: result.tripwire.reason || `Tripwire triggered in workflow ${processor.id}`,\n metadata: result.tripwire.metadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n\n // Check for execution failure\n if (result.status !== 'success') {\n throw new HTTPException(500, {\n message: `Processor workflow ${processor.id} failed with status: ${result.status}`,\n });\n }\n\n // Extract output from workflow result\n const output = result.result;\n let outputMessages = messages;\n\n if (output && typeof output === 'object') {\n if ('messages' in output && Array.isArray(output.messages)) {\n outputMessages = output.messages;\n } else if ('messageList' in output && output.messageList instanceof MessageList) {\n outputMessages = output.messageList.get.all.db();\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Re-throw HTTP exceptions\n if (error instanceof HTTPException) {\n throw error;\n }\n throw new HTTPException(500, {\n message: `Error executing processor workflow: ${error.message}`,\n });\n }\n }\n\n // Handle individual processor execution\n // Create the abort function for tripwire support\n let tripwireTriggered = false;\n let tripwireReason: string | undefined;\n let tripwireMetadata: unknown;\n\n const abort = (reason?: string, options?: { retry?: boolean; metadata?: unknown }) => {\n tripwireTriggered = true;\n tripwireReason = reason;\n tripwireMetadata = options?.metadata;\n throw new Error(`TRIPWIRE:${reason || 'Processor aborted'}`);\n };\n\n // Build the context based on phase\n const baseContext = {\n abort,\n retryCount: 0,\n messages: messageList.get.all.db(),\n messageList,\n state: {},\n };\n\n try {\n let result: any;\n\n // Execute the specific phase method on the individual processor\n switch (phase) {\n case 'input':\n if (!processor.processInput) {\n throw new HTTPException(400, { message: 'Processor does not support input phase' });\n }\n result = await processor.processInput({\n ...baseContext,\n systemMessages: [],\n });\n break;\n\n case 'inputStep':\n if (!processor.processInputStep) {\n throw new HTTPException(400, { message: 'Processor does not support inputStep phase' });\n }\n result = await processor.processInputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n // Pass empty/default values for all inputStep fields\n model: '' as any,\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n });\n break;\n\n case 'outputResult':\n if (!processor.processOutputResult) {\n throw new HTTPException(400, { message: 'Processor does not support outputResult phase' });\n }\n result = await processor.processOutputResult({\n ...baseContext,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n });\n break;\n\n case 'outputStep':\n if (!processor.processOutputStep) {\n throw new HTTPException(400, { message: 'Processor does not support outputStep phase' });\n }\n result = await processor.processOutputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n usage: { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined },\n });\n break;\n\n case 'outputStream':\n // outputStream is for streaming chunks, not a simple execute\n throw new HTTPException(400, {\n message: 'outputStream phase cannot be executed directly. Use streaming instead.',\n });\n\n default:\n throw new HTTPException(400, { message: `Unknown phase: ${phase}` });\n }\n\n // Process the result\n let outputMessages = messages;\n if (result) {\n if (Array.isArray(result)) {\n outputMessages = result;\n } else if (result.get && result.get.all && typeof result.get.all.db === 'function') {\n // It's a MessageList\n outputMessages = result.get.all.db();\n } else if (result.messages) {\n outputMessages = result.messages;\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Check if it's a tripwire\n if (tripwireTriggered || error.message?.startsWith('TRIPWIRE:')) {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: tripwireReason || error.message?.replace('TRIPWIRE:', ''),\n metadata: tripwireMetadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n throw error;\n }\n } catch (error) {\n return handleError(error, 'Error executing processor');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;AAsCA,SAAS,wBAAwB,UAA6B;CAC5D,IAAI,CAAC,YAAY,CAAC,MAAM,QAAQ,QAAQ,KAAK,SAAS,WAAW,GAC/D,OAAO;CAET,MAAM,eAAe,SAAS;CAC9B,IAAI,cAAc,SAAS,OAIzB,OAHkB,aAAa,QAAQ,MACpC,QAAQ,SAAc,MAAM,SAAS,MAAM,CAAC,CAC5C,KAAK,SAAc,MAAM,QAAQ,EACrB,CAAC,CAAC,KAAK,EAAE;CAE1B,OAAO;AACT;;;;;;;AAQA,SAAS,sBAAsB,WAAkC;CAE/D,KAAA,GAAIA,wBAAAA,oBAAAA,CAAoB,SAAS,GAG/B,OAAO;EAAC;EAAS;EAAa;EAAgB;EAAgB;EAAc;CAAY;CAI1F,MAAM,SAA2B,CAAC;CAClC,IAAI,OAAO,UAAU,iBAAiB,YACpC,OAAO,KAAK,OAAO;CAErB,IAAI,OAAO,UAAU,qBAAqB,YACxC,OAAO,KA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c;OACd,WAAW,CAAC;OACZ,MAAM,wBAAwB,QAAQ;OACtC,OAAO;QAAE,aAAa,KAAA;QAAW,cAAc,KAAA;QAAW,aAAa,KAAA;OAAU;MACnF,CAAC;MACD;KAEF,KAAK,gBAEH,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAC3B,SAAS,yEACX,CAAC;KAEH,SACE,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,kBAAkB,QAAQ,CAAC;IACvE;IAGA,IAAI,iBAAiB;IACrB,IAAI,QAAQ;KACV,IAAI,MAAM,QAAQ,MAAM,GACtB,iBAAiB;UACZ,IAAI,OAAO,OAAO,OAAO,IAAI,OAAO,OAAO,OAAO,IAAI,IAAI,OAAO,YAEtE,iBAAiB,OAAO,IAAI,IAAI,GAAG;UAC9B,IAAI,OAAO,UAChB,iBAAiB,OAAO;IAE5B;IAEA,OAAO;KACL,SAAS;KACT;KACA,UAAU;KACV,aAAa,EACX,UAAU,eACZ;IACF;GACF,SAAS,OAAY;IAEnB,IAAI,qBAAqB,MAAM,SAAS,WAAW,WAAW,GAC5D,OAAO;KACL,SAAS;KACT;KACA,UAAU;MACR,WAAW;MACX,QAAQ,kBAAkB,MAAM,SAAS,QAAQ,aAAa,EAAE;MAChE,UAAU;KACZ;KACA;KACA,aAAa,EACX,SACF;IACF;IAEF,MAAM;GACR;EACF,SAAS,OAAO;GACd,OAAOG,8BAAAA,YAAY,OAAO,2BAA2B;EACvD;CACF;AACF,CAAC"}
@@ -26,6 +26,8 @@ export declare const LIST_PROCESSORS_ROUTE: Omit<import("@mastra/core/server").A
26
26
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
27
27
  fga?: import("@mastra/core/auth").FGARouteConfig;
28
28
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
29
+ mcp?: import("../server-adapter").RouteMCPConfig;
30
+ authTransport?: 'bearer';
29
31
  readonly __schemas?: import("../server-adapter").RouteSchemas<undefined, undefined, undefined, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
30
32
  id: import("zod").ZodString;
31
33
  name: import("zod").ZodOptional<import("zod").ZodString>;
@@ -82,6 +84,8 @@ export declare const GET_PROCESSOR_BY_ID_ROUTE: Omit<import("@mastra/core/server
82
84
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
83
85
  fga?: import("@mastra/core/auth").FGARouteConfig;
84
86
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
87
+ mcp?: import("../server-adapter").RouteMCPConfig;
88
+ authTransport?: 'bearer';
85
89
  readonly __schemas?: import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
86
90
  processorId: import("zod").ZodString;
87
91
  }, import("zod/v4/core").$strip>, undefined, undefined, import("zod").ZodObject<{
@@ -180,6 +184,8 @@ export declare const EXECUTE_PROCESSOR_ROUTE: Omit<import("@mastra/core/server")
180
184
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
181
185
  fga?: import("@mastra/core/auth").FGARouteConfig;
182
186
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
187
+ mcp?: import("../server-adapter").RouteMCPConfig;
188
+ authTransport?: 'bearer';
183
189
  readonly __schemas?: import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
184
190
  processorId: import("zod").ZodString;
185
191
  }, import("zod/v4/core").$strip>, undefined, import("zod").ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"processors.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/processors.ts"],"names":[],"mappings":"AAuFA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DhC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDpC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgVlC,CAAC"}
1
+ {"version":3,"file":"processors.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/processors.ts"],"names":[],"mappings":"AA+IA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DhC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDpC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgVlC,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import { t as HTTPException } from "../../http-exception-CzaWkxMl.js";
2
2
  import { a as processorIdPathParams, n as executeProcessorResponseSchema, o as serializedProcessorDetailSchema, r as listProcessorsResponseSchema, t as executeProcessorBodySchema } from "../../processors-IhyRC0xH.js";
3
- import { n as createRoute } from "../../route-builder-DfDT1g4L.js";
3
+ import { n as createRoute } from "../../route-builder-Dz18c3qm.js";
4
+ import { assertStoredAgentAccess } from "./agent-access.js";
5
+ import { assertReadAccess } from "./authorship.js";
4
6
  import { handleError } from "./error.js";
5
7
  import { MessageList } from "@mastra/core/agent";
6
8
  import { isProcessorWorkflow } from "@mastra/core/processors";
@@ -40,6 +42,55 @@ function detectProcessorPhases(processor) {
40
42
  if (typeof processor.processLLMRequest === "function") phases.push("llmRequest");
41
43
  return phases;
42
44
  }
45
+ /**
46
+ * Returns a filter that drops processor configurations of stored agents the caller can't read. An agent adds its
47
+ * configurations when it is attached to Mastra, which also happens to sub-agents that aren't in the registry, so an
48
+ * agent that isn't registered is decided from its stored record. With no record, a configuration a stored agent added
49
+ * is hidden (the agent was deleted while an instance of it was still in use, e.g. as a sub-agent), and any other is a
50
+ * code sub-agent or another agent built in code, visible to everyone like registered code agents.
51
+ * `Mastra.removeAgent` drops the configurations of the agents it removes, registered or not.
52
+ */
53
+ function createProcessorConfigurationFilter(mastra, requestContext) {
54
+ const agents = mastra.listAgents() || {};
55
+ const decided = /* @__PURE__ */ new Map();
56
+ const isVisible = async (agentId, fromStoredAgent) => {
57
+ try {
58
+ const agent = agents[agentId];
59
+ if (agent) {
60
+ assertStoredAgentAccess({
61
+ agent,
62
+ agentId,
63
+ requestContext,
64
+ access: "read"
65
+ });
66
+ return true;
67
+ }
68
+ const record = await (await mastra.getStorage()?.getStore("agents"))?.getById(agentId);
69
+ if (record) {
70
+ assertReadAccess({
71
+ requestContext,
72
+ resource: "stored-agents",
73
+ resourceId: agentId,
74
+ record
75
+ });
76
+ return true;
77
+ }
78
+ return !fromStoredAgent;
79
+ } catch (error) {
80
+ if (error instanceof HTTPException) return false;
81
+ throw error;
82
+ }
83
+ };
84
+ return async (configs) => {
85
+ const visible = await Promise.all(configs.map((c) => {
86
+ const fromStoredAgent = c.source === "stored";
87
+ const key = `${fromStoredAgent}:${c.agentId}`;
88
+ if (!decided.has(key)) decided.set(key, isVisible(c.agentId, fromStoredAgent));
89
+ return decided.get(key);
90
+ }));
91
+ return configs.filter((_, i) => visible[i]);
92
+ };
93
+ }
43
94
  const LIST_PROCESSORS_ROUTE = createRoute({
44
95
  method: "GET",
45
96
  path: "/processors",
@@ -49,17 +100,18 @@ const LIST_PROCESSORS_ROUTE = createRoute({
49
100
  description: "Returns a list of all available individual processors",
50
101
  tags: ["Processors"],
51
102
  requiresAuth: true,
52
- handler: async ({ mastra }) => {
103
+ handler: async ({ mastra, requestContext }) => {
53
104
  try {
54
105
  const processors = mastra.listProcessors() || {};
55
106
  const processorConfigurations = mastra.listProcessorConfigurations();
107
+ const visibleConfigurations = createProcessorConfigurationFilter(mastra, requestContext);
56
108
  const result = {};
57
109
  for (const [processorKey, processorEntry] of Object.entries(processors)) {
58
110
  const processor = processorEntry;
59
111
  const processorId = processor.id || processorKey;
60
112
  const isWorkflow = isProcessorWorkflow(processor);
61
113
  const phases = detectProcessorPhases(processor);
62
- const configs = processorConfigurations.get(processorId) || [];
114
+ const configs = await visibleConfigurations(processorConfigurations.get(processorId) || []);
63
115
  const agentIds = [...new Set(configs.map((c) => c.agentId))];
64
116
  const configurations = configs.map((c) => ({
65
117
  agentId: c.agentId,
@@ -91,7 +143,7 @@ const GET_PROCESSOR_BY_ID_ROUTE = createRoute({
91
143
  description: "Returns details for a specific processor including its phases and configurations",
92
144
  tags: ["Processors"],
93
145
  requiresAuth: true,
94
- handler: async ({ mastra, processorId }) => {
146
+ handler: async ({ mastra, requestContext, processorId }) => {
95
147
  try {
96
148
  let processorEntry;
97
149
  try {
@@ -102,9 +154,8 @@ const GET_PROCESSOR_BY_ID_ROUTE = createRoute({
102
154
  if (!processorEntry) throw new HTTPException(404, { message: "Processor not found" });
103
155
  const isWorkflow = isProcessorWorkflow(processorEntry);
104
156
  const phases = detectProcessorPhases(processorEntry);
105
- const configs = mastra.getProcessorConfigurations(processorId);
106
157
  const agents = mastra.listAgents() || {};
107
- const configurations = configs.map((c) => ({
158
+ const configurations = (await createProcessorConfigurationFilter(mastra, requestContext)(mastra.getProcessorConfigurations(processorId))).map((c) => ({
108
159
  agentId: c.agentId,
109
160
  agentName: agents[c.agentId]?.name || c.agentId,
110
161
  type: c.type
@@ -1 +1 @@
1
- {"version":3,"file":"processors.js","names":[],"sources":["../../../src/server/handlers/processors.ts"],"sourcesContent":["import { MessageList } from '@mastra/core/agent';\nimport type { MessageInput } from '@mastra/core/agent/message-list';\nimport { isProcessorWorkflow } from '@mastra/core/processors';\nimport type { Processor, ProcessorWorkflow } from '@mastra/core/processors';\n\nimport { HTTPException } from '../http-exception';\nimport {\n listProcessorsResponseSchema,\n serializedProcessorDetailSchema,\n processorIdPathParams,\n executeProcessorBodySchema,\n executeProcessorResponseSchema,\n} from '../schemas/processors';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { handleError } from './error';\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\ntype ProcessorPhase =\n | 'input'\n | 'inputStep'\n | 'outputStream'\n | 'outputResult'\n | 'outputStep'\n | 'toolResult'\n | 'llmRequest';\n\n/**\n * Helper to extract text from messages for outputStep testing.\n * In real usage, the `text` field contains the assistant's response text.\n */\nfunction extractTextFromMessages(messages: unknown[]): string {\n if (!messages || !Array.isArray(messages) || messages.length === 0) {\n return '';\n }\n const firstMessage = messages[0] as any;\n if (firstMessage?.content?.parts) {\n const textParts = firstMessage.content.parts\n .filter((part: any) => part?.type === 'text')\n .map((part: any) => part?.text || '');\n return textParts.join('');\n }\n return '';\n}\n\n/**\n * Helper to detect phases for a processor.\n * For individual processors, checks which methods are implemented.\n * For workflow processors, returns all phases since createStep handles each phase\n * and it's a no-op if the underlying processor doesn't implement it.\n */\nfunction detectProcessorPhases(processor: any): ProcessorPhase[] {\n // Check if it's a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Workflow processors can potentially handle all phases\n // The createStep in workflows handles each phase and it's a no-op if not implemented\n return ['input', 'inputStep', 'outputStream', 'outputResult', 'outputStep', 'toolResult'];\n }\n\n // For individual processors, detect by checking which methods exist\n const phases: ProcessorPhase[] = [];\n if (typeof processor.processInput === 'function') {\n phases.push('input');\n }\n if (typeof processor.processInputStep === 'function') {\n phases.push('inputStep');\n }\n if (typeof processor.processOutputStream === 'function') {\n phases.push('outputStream');\n }\n if (typeof processor.processOutputResult === 'function') {\n phases.push('outputResult');\n }\n if (typeof processor.processOutputStep === 'function') {\n phases.push('outputStep');\n }\n if (typeof processor.processToolResult === 'function') {\n phases.push('toolResult');\n }\n if (typeof processor.processLLMRequest === 'function') {\n phases.push('llmRequest');\n }\n return phases;\n}\n\nexport const LIST_PROCESSORS_ROUTE = createRoute({\n method: 'GET',\n path: '/processors',\n responseType: 'json',\n responseSchema: listProcessorsResponseSchema,\n summary: 'List all processors',\n description: 'Returns a list of all available individual processors',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra }) => {\n try {\n const processors = mastra.listProcessors() || {};\n const processorConfigurations = mastra.listProcessorConfigurations();\n const result: Record<\n string,\n {\n id: string;\n name?: string;\n description?: string;\n phases: ProcessorPhase[];\n agentIds: string[];\n configurations: Array<{ agentId: string; type: 'input' | 'output' }>;\n isWorkflow: boolean;\n }\n > = {};\n\n // Iterate through all individual processors registered with Mastra\n for (const [processorKey, processorEntry] of Object.entries(processors)) {\n const processor = processorEntry as Processor | ProcessorWorkflow;\n const processorId = processor.id || processorKey;\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processor);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processor);\n\n // Get agent configurations for this processor\n const configs = processorConfigurations.get(processorId) || [];\n const agentIds = [...new Set(configs.map(c => c.agentId))];\n const configurations = configs.map(c => ({ agentId: c.agentId, type: c.type }));\n\n result[processorId] = {\n id: processorId,\n name: processor.name || processorId,\n description: processor.description,\n phases,\n agentIds,\n configurations,\n isWorkflow,\n };\n }\n\n return result;\n } catch (error) {\n return handleError(error, 'Error getting processors');\n }\n },\n});\n\nexport const GET_PROCESSOR_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/processors/:processorId',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n responseSchema: serializedProcessorDetailSchema,\n summary: 'Get processor by ID',\n description: 'Returns details for a specific processor including its phases and configurations',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId }) => {\n try {\n // Get the processor from Mastra's registered processors\n let processorEntry: Processor | ProcessorWorkflow | undefined;\n try {\n processorEntry = mastra.getProcessorById(processorId) as Processor | ProcessorWorkflow;\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processorEntry = processors[processorId as keyof typeof processors] as Processor | ProcessorWorkflow;\n }\n\n if (!processorEntry) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processorEntry);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processorEntry);\n\n // Get agent configurations for this processor\n const configs = mastra.getProcessorConfigurations(processorId);\n const agents = mastra.listAgents() || {};\n const configurations = configs.map(c => ({\n agentId: c.agentId,\n agentName: agents[c.agentId]?.name || c.agentId,\n type: c.type,\n }));\n\n return {\n id: processorEntry.id,\n name: processorEntry.name || processorEntry.id,\n description: processorEntry.description,\n phases,\n configurations,\n isWorkflow,\n };\n } catch (error) {\n return handleError(error, 'Error getting processor');\n }\n },\n});\n\nexport const EXECUTE_PROCESSOR_ROUTE = createRoute({\n method: 'POST',\n path: '/processors/:processorId/execute',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n bodySchema: executeProcessorBodySchema,\n responseSchema: executeProcessorResponseSchema,\n summary: 'Execute processor',\n description: 'Executes a specific processor with the provided input data',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId, ...bodyParams }) => {\n try {\n const { phase, messages } = bodyParams;\n\n if (!processorId) {\n throw new HTTPException(400, { message: 'Processor ID is required' });\n }\n\n if (!phase) {\n throw new HTTPException(400, { message: 'Phase is required' });\n }\n\n if (phase === 'llmRequest') {\n // processLLMRequest operates on the provider prompt, not on messages\n throw new HTTPException(400, {\n message: 'llmRequest phase cannot be executed directly. It runs on the provider prompt during an agent call.',\n });\n }\n\n if (!messages || !Array.isArray(messages)) {\n throw new HTTPException(400, { message: 'Messages array is required' });\n }\n\n // Get the processor from Mastra's registered processors\n let processor;\n try {\n processor = mastra.getProcessorById(processorId);\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processor = processors[processorId as keyof typeof processors];\n }\n\n if (!processor) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n const messageList = new MessageList();\n messageList.add(messages as unknown as MessageInput[], 'input');\n\n // Check if this is a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Execute workflow processor\n try {\n // Build inputData based on phase - each phase has different required fields\n const baseInputData = {\n phase: phase as 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult',\n messages: messageList.get.all.db(),\n messageList,\n retryCount: 0,\n };\n let inputData: typeof baseInputData & Record<string, unknown> = baseInputData;\n\n // Add phase-specific fields\n switch (phase) {\n case 'input':\n inputData = {\n ...inputData,\n systemMessages: [],\n };\n break;\n case 'inputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n model: '',\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n };\n break;\n case 'outputResult':\n inputData = {\n ...inputData,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n };\n break;\n case 'outputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n };\n break;\n case 'outputStream':\n inputData = {\n ...inputData,\n part: null,\n streamParts: [],\n state: {},\n };\n break;\n case 'toolResult':\n inputData = {\n ...inputData,\n stepNumber: 0,\n toolName: '',\n toolCallId: '',\n args: undefined,\n toolResultValue: undefined,\n providerExecuted: false,\n systemMessages: [],\n steps: [],\n };\n break;\n }\n\n const run = await processor.createRun();\n const result = await run.start({\n inputData,\n });\n\n // Check for tripwire status\n if (result.status === 'tripwire') {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: result.tripwire.reason || `Tripwire triggered in workflow ${processor.id}`,\n metadata: result.tripwire.metadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n\n // Check for execution failure\n if (result.status !== 'success') {\n throw new HTTPException(500, {\n message: `Processor workflow ${processor.id} failed with status: ${result.status}`,\n });\n }\n\n // Extract output from workflow result\n const output = result.result;\n let outputMessages = messages;\n\n if (output && typeof output === 'object') {\n if ('messages' in output && Array.isArray(output.messages)) {\n outputMessages = output.messages;\n } else if ('messageList' in output && output.messageList instanceof MessageList) {\n outputMessages = output.messageList.get.all.db();\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Re-throw HTTP exceptions\n if (error instanceof HTTPException) {\n throw error;\n }\n throw new HTTPException(500, {\n message: `Error executing processor workflow: ${error.message}`,\n });\n }\n }\n\n // Handle individual processor execution\n // Create the abort function for tripwire support\n let tripwireTriggered = false;\n let tripwireReason: string | undefined;\n let tripwireMetadata: unknown;\n\n const abort = (reason?: string, options?: { retry?: boolean; metadata?: unknown }) => {\n tripwireTriggered = true;\n tripwireReason = reason;\n tripwireMetadata = options?.metadata;\n throw new Error(`TRIPWIRE:${reason || 'Processor aborted'}`);\n };\n\n // Build the context based on phase\n const baseContext = {\n abort,\n retryCount: 0,\n messages: messageList.get.all.db(),\n messageList,\n state: {},\n };\n\n try {\n let result: any;\n\n // Execute the specific phase method on the individual processor\n switch (phase) {\n case 'input':\n if (!processor.processInput) {\n throw new HTTPException(400, { message: 'Processor does not support input phase' });\n }\n result = await processor.processInput({\n ...baseContext,\n systemMessages: [],\n });\n break;\n\n case 'inputStep':\n if (!processor.processInputStep) {\n throw new HTTPException(400, { message: 'Processor does not support inputStep phase' });\n }\n result = await processor.processInputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n // Pass empty/default values for all inputStep fields\n model: '' as any,\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n });\n break;\n\n case 'outputResult':\n if (!processor.processOutputResult) {\n throw new HTTPException(400, { message: 'Processor does not support outputResult phase' });\n }\n result = await processor.processOutputResult({\n ...baseContext,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n });\n break;\n\n case 'outputStep':\n if (!processor.processOutputStep) {\n throw new HTTPException(400, { message: 'Processor does not support outputStep phase' });\n }\n result = await processor.processOutputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n usage: { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined },\n });\n break;\n\n case 'outputStream':\n // outputStream is for streaming chunks, not a simple execute\n throw new HTTPException(400, {\n message: 'outputStream phase cannot be executed directly. Use streaming instead.',\n });\n\n default:\n throw new HTTPException(400, { message: `Unknown phase: ${phase}` });\n }\n\n // Process the result\n let outputMessages = messages;\n if (result) {\n if (Array.isArray(result)) {\n outputMessages = result;\n } else if (result.get && result.get.all && typeof result.get.all.db === 'function') {\n // It's a MessageList\n outputMessages = result.get.all.db();\n } else if (result.messages) {\n outputMessages = result.messages;\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Check if it's a tripwire\n if (tripwireTriggered || error.message?.startsWith('TRIPWIRE:')) {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: tripwireReason || error.message?.replace('TRIPWIRE:', ''),\n metadata: tripwireMetadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n throw error;\n }\n } catch (error) {\n return handleError(error, 'Error executing processor');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;AAiCA,SAAS,wBAAwB,UAA6B;CAC5D,IAAI,CAAC,YAAY,CAAC,MAAM,QAAQ,QAAQ,KAAK,SAAS,WAAW,GAC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sources":["../../../src/server/handlers/processors.ts"],"sourcesContent":["import type { Mastra } from '@mastra/core';\nimport { MessageList } from '@mastra/core/agent';\nimport type { MessageInput } from '@mastra/core/agent/message-list';\nimport { isProcessorWorkflow } from '@mastra/core/processors';\nimport type { Processor, ProcessorWorkflow } from '@mastra/core/processors';\nimport type { RequestContext } from '@mastra/core/request-context';\n\nimport { HTTPException } from '../http-exception';\nimport {\n listProcessorsResponseSchema,\n serializedProcessorDetailSchema,\n processorIdPathParams,\n executeProcessorBodySchema,\n executeProcessorResponseSchema,\n} from '../schemas/processors';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredAgentAccess } from './agent-access';\nimport { assertReadAccess } from './authorship';\nimport type { OwnedRecord } from './authorship';\nimport { handleError } from './error';\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\ntype ProcessorPhase =\n | 'input'\n | 'inputStep'\n | 'outputStream'\n | 'outputResult'\n | 'outputStep'\n | 'toolResult'\n | 'llmRequest';\n\n/**\n * Helper to extract text from messages for outputStep testing.\n * In real usage, the `text` field contains the assistant's response text.\n */\nfunction extractTextFromMessages(messages: unknown[]): string {\n if (!messages || !Array.isArray(messages) || messages.length === 0) {\n return '';\n }\n const firstMessage = messages[0] as any;\n if (firstMessage?.content?.parts) {\n const textParts = firstMessage.content.parts\n .filter((part: any) => part?.type === 'text')\n .map((part: any) => part?.text || '');\n return textParts.join('');\n }\n return '';\n}\n\n/**\n * Helper to detect phases for a processor.\n * For individual processors, checks which methods are implemented.\n * For workflow processors, returns all phases since createStep handles each phase\n * and it's a no-op if the underlying processor doesn't implement it.\n */\nfunction detectProcessorPhases(processor: any): ProcessorPhase[] {\n // Check if it's a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Workflow processors can potentially handle all phases\n // The createStep in workflows handles each phase and it's a no-op if not implemented\n return ['input', 'inputStep', 'outputStream', 'outputResult', 'outputStep', 'toolResult'];\n }\n\n // For individual processors, detect by checking which methods exist\n const phases: ProcessorPhase[] = [];\n if (typeof processor.processInput === 'function') {\n phases.push('input');\n }\n if (typeof processor.processInputStep === 'function') {\n phases.push('inputStep');\n }\n if (typeof processor.processOutputStream === 'function') {\n phases.push('outputStream');\n }\n if (typeof processor.processOutputResult === 'function') {\n phases.push('outputResult');\n }\n if (typeof processor.processOutputStep === 'function') {\n phases.push('outputStep');\n }\n if (typeof processor.processToolResult === 'function') {\n phases.push('toolResult');\n }\n if (typeof processor.processLLMRequest === 'function') {\n phases.push('llmRequest');\n }\n return phases;\n}\n\n/**\n * Returns a filter that drops processor configurations of stored agents the caller can't read. An agent adds its\n * configurations when it is attached to Mastra, which also happens to sub-agents that aren't in the registry, so an\n * agent that isn't registered is decided from its stored record. With no record, a configuration a stored agent added\n * is hidden (the agent was deleted while an instance of it was still in use, e.g. as a sub-agent), and any other is a\n * code sub-agent or another agent built in code, visible to everyone like registered code agents.\n * `Mastra.removeAgent` drops the configurations of the agents it removes, registered or not.\n */\nfunction createProcessorConfigurationFilter(mastra: Mastra, requestContext: RequestContext) {\n const agents = mastra.listAgents() || {};\n const decided = new Map<string, Promise<boolean>>();\n\n const isVisible = async (agentId: string, fromStoredAgent: boolean): Promise<boolean> => {\n try {\n const agent = agents[agentId];\n if (agent) {\n assertStoredAgentAccess({ agent, agentId, requestContext, access: 'read' });\n return true;\n }\n const agentsStore = await mastra.getStorage()?.getStore('agents');\n const record = await agentsStore?.getById(agentId);\n if (record) {\n assertReadAccess({\n requestContext,\n resource: 'stored-agents',\n resourceId: agentId,\n record: record as OwnedRecord,\n });\n return true;\n }\n // No record: a code agent, or a stored agent that was deleted while an instance of it was still in use.\n return !fromStoredAgent;\n } catch (error) {\n if (error instanceof HTTPException) return false;\n throw error;\n }\n };\n\n return async <TConfig extends { agentId: string; source?: string }>(configs: TConfig[]): Promise<TConfig[]> => {\n const visible = await Promise.all(\n configs.map(c => {\n const fromStoredAgent = c.source === 'stored';\n const key = `${fromStoredAgent}:${c.agentId}`;\n if (!decided.has(key)) decided.set(key, isVisible(c.agentId, fromStoredAgent));\n return decided.get(key)!;\n }),\n );\n return configs.filter((_, i) => visible[i]);\n };\n}\n\nexport const LIST_PROCESSORS_ROUTE = createRoute({\n method: 'GET',\n path: '/processors',\n responseType: 'json',\n responseSchema: listProcessorsResponseSchema,\n summary: 'List all processors',\n description: 'Returns a list of all available individual processors',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, requestContext }) => {\n try {\n const processors = mastra.listProcessors() || {};\n const processorConfigurations = mastra.listProcessorConfigurations();\n const visibleConfigurations = createProcessorConfigurationFilter(mastra, requestContext);\n const result: Record<\n string,\n {\n id: string;\n name?: string;\n description?: string;\n phases: ProcessorPhase[];\n agentIds: string[];\n configurations: Array<{ agentId: string; type: 'input' | 'output' }>;\n isWorkflow: boolean;\n }\n > = {};\n\n // Iterate through all individual processors registered with Mastra\n for (const [processorKey, processorEntry] of Object.entries(processors)) {\n const processor = processorEntry as Processor | ProcessorWorkflow;\n const processorId = processor.id || processorKey;\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processor);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processor);\n\n // Get agent configurations for this processor\n const configs = await visibleConfigurations(processorConfigurations.get(processorId) || []);\n const agentIds = [...new Set(configs.map(c => c.agentId))];\n const configurations = configs.map(c => ({ agentId: c.agentId, type: c.type }));\n\n result[processorId] = {\n id: processorId,\n name: processor.name || processorId,\n description: processor.description,\n phases,\n agentIds,\n configurations,\n isWorkflow,\n };\n }\n\n return result;\n } catch (error) {\n return handleError(error, 'Error getting processors');\n }\n },\n});\n\nexport const GET_PROCESSOR_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/processors/:processorId',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n responseSchema: serializedProcessorDetailSchema,\n summary: 'Get processor by ID',\n description: 'Returns details for a specific processor including its phases and configurations',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, requestContext, processorId }) => {\n try {\n // Get the processor from Mastra's registered processors\n let processorEntry: Processor | ProcessorWorkflow | undefined;\n try {\n processorEntry = mastra.getProcessorById(processorId) as Processor | ProcessorWorkflow;\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processorEntry = processors[processorId as keyof typeof processors] as Processor | ProcessorWorkflow;\n }\n\n if (!processorEntry) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processorEntry);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processorEntry);\n\n // Get agent configurations for this processor\n const agents = mastra.listAgents() || {};\n const configs = await createProcessorConfigurationFilter(\n mastra,\n requestContext,\n )(mastra.getProcessorConfigurations(processorId));\n const configurations = configs.map(c => ({\n agentId: c.agentId,\n agentName: agents[c.agentId]?.name || c.agentId,\n type: c.type,\n }));\n\n return {\n id: processorEntry.id,\n name: processorEntry.name || processorEntry.id,\n description: processorEntry.description,\n phases,\n configurations,\n isWorkflow,\n };\n } catch (error) {\n return handleError(error, 'Error getting processor');\n }\n },\n});\n\nexport const EXECUTE_PROCESSOR_ROUTE = createRoute({\n method: 'POST',\n path: '/processors/:processorId/execute',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n bodySchema: executeProcessorBodySchema,\n responseSchema: executeProcessorResponseSchema,\n summary: 'Execute processor',\n description: 'Executes a specific processor with the provided input data',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId, ...bodyParams }) => {\n try {\n const { phase, messages } = bodyParams;\n\n if (!processorId) {\n throw new HTTPException(400, { message: 'Processor ID is required' });\n }\n\n if (!phase) {\n throw new HTTPException(400, { message: 'Phase is required' });\n }\n\n if (phase === 'llmRequest') {\n // processLLMRequest operates on the provider prompt, not on messages\n throw new HTTPException(400, {\n message: 'llmRequest phase cannot be executed directly. It runs on the provider prompt during an agent call.',\n });\n }\n\n if (!messages || !Array.isArray(messages)) {\n throw new HTTPException(400, { message: 'Messages array is required' });\n }\n\n // Get the processor from Mastra's registered processors\n let processor;\n try {\n processor = mastra.getProcessorById(processorId);\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processor = processors[processorId as keyof typeof processors];\n }\n\n if (!processor) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n const messageList = new MessageList();\n messageList.add(messages as unknown as MessageInput[], 'input');\n\n // Check if this is a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Execute workflow processor\n try {\n // Build inputData based on phase - each phase has different required fields\n const baseInputData = {\n phase: phase as 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult',\n messages: messageList.get.all.db(),\n messageList,\n retryCount: 0,\n };\n let inputData: typeof baseInputData & Record<string, unknown> = baseInputData;\n\n // Add phase-specific fields\n switch (phase) {\n case 'input':\n inputData = {\n ...inputData,\n systemMessages: [],\n };\n break;\n case 'inputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n model: '',\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n };\n break;\n case 'outputResult':\n inputData = {\n ...inputData,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n };\n break;\n case 'outputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n };\n break;\n case 'outputStream':\n inputData = {\n ...inputData,\n part: null,\n streamParts: [],\n state: {},\n };\n break;\n case 'toolResult':\n inputData = {\n ...inputData,\n stepNumber: 0,\n toolName: '',\n toolCallId: '',\n args: undefined,\n toolResultValue: undefined,\n providerExecuted: false,\n systemMessages: [],\n steps: [],\n };\n break;\n }\n\n const run = await processor.createRun();\n const result = await run.start({\n inputData,\n });\n\n // Check for tripwire status\n if (result.status === 'tripwire') {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: result.tripwire.reason || `Tripwire triggered in workflow ${processor.id}`,\n metadata: result.tripwire.metadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n\n // Check for execution failure\n if (result.status !== 'success') {\n throw new HTTPException(500, {\n message: `Processor workflow ${processor.id} failed with status: ${result.status}`,\n });\n }\n\n // Extract output from workflow result\n const output = result.result;\n let outputMessages = messages;\n\n if (output && typeof output === 'object') {\n if ('messages' in output && Array.isArray(output.messages)) {\n outputMessages = output.messages;\n } else if ('messageList' in output && output.messageList instanceof MessageList) {\n outputMessages = output.messageList.get.all.db();\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Re-throw HTTP exceptions\n if (error instanceof HTTPException) {\n throw error;\n }\n throw new HTTPException(500, {\n message: `Error executing processor workflow: ${error.message}`,\n });\n }\n }\n\n // Handle individual processor execution\n // Create the abort function for tripwire support\n let tripwireTriggered = false;\n let tripwireReason: string | undefined;\n let tripwireMetadata: unknown;\n\n const abort = (reason?: string, options?: { retry?: boolean; metadata?: unknown }) => {\n tripwireTriggered = true;\n tripwireReason = reason;\n tripwireMetadata = options?.metadata;\n throw new Error(`TRIPWIRE:${reason || 'Processor aborted'}`);\n };\n\n // Build the context based on phase\n const baseContext = {\n abort,\n retryCount: 0,\n messages: messageList.get.all.db(),\n messageList,\n state: {},\n };\n\n try {\n let result: any;\n\n // Execute the specific phase method on the individual processor\n switch (phase) {\n case 'input':\n if (!processor.processInput) {\n throw new HTTPException(400, { message: 'Processor does not support input phase' });\n }\n result = await processor.processInput({\n ...baseContext,\n systemMessages: [],\n });\n break;\n\n case 'inputStep':\n if (!processor.processInputStep) {\n throw new HTTPException(400, { message: 'Processor does not support inputStep phase' });\n }\n result = await processor.processInputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n // Pass empty/default values for all inputStep fields\n model: '' as any,\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n });\n break;\n\n case 'outputResult':\n if (!processor.processOutputResult) {\n throw new HTTPException(400, { message: 'Processor does not support outputResult phase' });\n }\n result = await processor.processOutputResult({\n ...baseContext,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n });\n break;\n\n case 'outputStep':\n if (!processor.processOutputStep) {\n throw new HTTPException(400, { message: 'Processor does not support outputStep phase' });\n }\n result = await processor.processOutputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n usage: { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined },\n });\n break;\n\n case 'outputStream':\n // outputStream is for streaming chunks, not a simple execute\n throw new HTTPException(400, {\n message: 'outputStream phase cannot be executed directly. Use streaming instead.',\n });\n\n default:\n throw new HTTPException(400, { message: `Unknown phase: ${phase}` });\n }\n\n // Process the result\n let outputMessages = messages;\n if (result) {\n if (Array.isArray(result)) {\n outputMessages = result;\n } else if (result.get && result.get.all && typeof result.get.all.db === 'function') {\n // It's a MessageList\n outputMessages = result.get.all.db();\n } else if (result.messages) {\n outputMessages = result.messages;\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Check if it's a tripwire\n if (tripwireTriggered || error.message?.startsWith('TRIPWIRE:')) {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: tripwireReason || error.message?.replace('TRIPWIRE:', ''),\n metadata: tripwireMetadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n throw error;\n }\n } catch (error) {\n return handleError(error, 'Error executing processor');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;AAs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V;MACF,CAAC;MACD;KAEF,KAAK;MACH,IAAI,CAAC,UAAU,mBACb,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,8CAA8C,CAAC;MAEzF,SAAS,MAAM,UAAU,kBAAkB;OACzC,GAAG;OACH,gBAAgB,CAAC;OACjB,YAAY;OACZ,OAAO,CAAC;OACR,cAAc;OACd,WAAW,CAAC;OACZ,MAAM,wBAAwB,QAAQ;OACtC,OAAO;QAAE,aAAa,KAAA;QAAW,cAAc,KAAA;QAAW,aAAa,KAAA;OAAU;MACnF,CAAC;MACD;KAEF,KAAK,gBAEH,MAAM,IAAI,cAAc,KAAK,EAC3B,SAAS,yEACX,CAAC;KAEH,SACE,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,kBAAkB,QAAQ,CAAC;IACvE;IAGA,IAAI,iBAAiB;IACrB,IAAI,QAAQ;KACV,IAAI,MAAM,QAAQ,MAAM,GACtB,iBAAiB;UACZ,IAAI,OAAO,OAAO,OAAO,IAAI,OAAO,OAAO,OAAO,IAAI,IAAI,OAAO,YAEtE,iBAAiB,OAAO,IAAI,IAAI,GAAG;UAC9B,IAAI,OAAO,UAChB,iBAAiB,OAAO;IAE5B;IAEA,OAAO;KACL,SAAS;KACT;KACA,UAAU;KACV,aAAa,EACX,UAAU,eACZ;IACF;GACF,SAAS,OAAY;IAEnB,IAAI,qBAAqB,MAAM,SAAS,WAAW,WAAW,GAC5D,OAAO;KACL,SAAS;KACT;KACA,UAAU;MACR,WAAW;MACX,QAAQ,kBAAkB,MAAM,SAAS,QAAQ,aAAa,EAAE;MAChE,UAAU;KACZ;KACA;KACA,aAAa,EACX,SACF;IACF;IAEF,MAAM;GACR;EACF,SAAS,OAAO;GACd,OAAO,YAAY,OAAO,2BAA2B;EACvD;CACF;AACF,CAAC"}
@@ -2,8 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../rolldown-runtime-10nMEhjP.cjs");
3
3
  const require_http_exception = require("../../http-exception-Co3MbFUf.cjs");
4
4
  const require_prompt_block_versions = require("../../prompt-block-versions-BTdrcaLe.cjs");
5
- const require_route_builder = require("../../route-builder-B9C5vT54.cjs");
6
- const require_utils = require("../../utils-DptI_ERr.cjs");
5
+ const require_route_builder = require("../../route-builder-DjTBxSZN.cjs");
6
+ const require_utils = require("../../utils-Dn_OA_6N.cjs");
7
7
  const require_server_handlers_error = require("./error.cjs");
8
8
  const require_server_handlers_version_helpers = require("./version-helpers.cjs");
9
9
  // src/server/handlers/prompt-block-versions.ts
@@ -85,6 +85,8 @@ export declare const LIST_PROMPT_BLOCK_VERSIONS_ROUTE: Omit<import("@mastra/core
85
85
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
86
86
  fga?: import("@mastra/core/auth").FGARouteConfig;
87
87
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
88
+ mcp?: import("../server-adapter").RouteMCPConfig;
89
+ authTransport?: 'bearer';
88
90
  readonly __schemas?: import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
89
91
  promptBlockId: import("zod").ZodString;
90
92
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -261,6 +263,8 @@ export declare const CREATE_PROMPT_BLOCK_VERSION_ROUTE: Omit<import("@mastra/cor
261
263
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
262
264
  fga?: import("@mastra/core/auth").FGARouteConfig;
263
265
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
266
+ mcp?: import("../server-adapter").RouteMCPConfig;
267
+ authTransport?: 'bearer';
264
268
  readonly __schemas?: import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
265
269
  promptBlockId: import("zod").ZodString;
266
270
  }, import("zod/v4/core").$strip>, undefined, import("zod").ZodObject<{
@@ -406,6 +410,8 @@ export declare const GET_PROMPT_BLOCK_VERSION_ROUTE: Omit<import("@mastra/core/s
406
410
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
407
411
  fga?: import("@mastra/core/auth").FGARouteConfig;
408
412
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
413
+ mcp?: import("../server-adapter").RouteMCPConfig;
414
+ authTransport?: 'bearer';
409
415
  readonly __schemas?: import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
410
416
  promptBlockId: import("zod").ZodString;
411
417
  versionId: import("zod").ZodString;
@@ -521,6 +527,8 @@ export declare const ACTIVATE_PROMPT_BLOCK_VERSION_ROUTE: Omit<import("@mastra/c
521
527
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
522
528
  fga?: import("@mastra/core/auth").FGARouteConfig;
523
529
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
530
+ mcp?: import("../server-adapter").RouteMCPConfig;
531
+ authTransport?: 'bearer';
524
532
  readonly __schemas?: import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
525
533
  promptBlockId: import("zod").ZodString;
526
534
  versionId: import("zod").ZodString;
@@ -588,6 +596,8 @@ export declare const RESTORE_PROMPT_BLOCK_VERSION_ROUTE: Omit<import("@mastra/co
588
596
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
589
597
  fga?: import("@mastra/core/auth").FGARouteConfig;
590
598
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
599
+ mcp?: import("../server-adapter").RouteMCPConfig;
600
+ authTransport?: 'bearer';
591
601
  readonly __schemas?: import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
592
602
  promptBlockId: import("zod").ZodString;
593
603
  versionId: import("zod").ZodString;
@@ -702,6 +712,8 @@ export declare const DELETE_PROMPT_BLOCK_VERSION_ROUTE: Omit<import("@mastra/cor
702
712
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
703
713
  fga?: import("@mastra/core/auth").FGARouteConfig;
704
714
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
715
+ mcp?: import("../server-adapter").RouteMCPConfig;
716
+ authTransport?: 'bearer';
705
717
  readonly __schemas?: import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
706
718
  promptBlockId: import("zod").ZodString;
707
719
  versionId: import("zod").ZodString;
@@ -811,6 +823,8 @@ export declare const COMPARE_PROMPT_BLOCK_VERSIONS_ROUTE: Omit<import("@mastra/c
811
823
  requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
812
824
  fga?: import("@mastra/core/auth").FGARouteConfig;
813
825
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
826
+ mcp?: import("../server-adapter").RouteMCPConfig;
827
+ authTransport?: 'bearer';
814
828
  readonly __schemas?: import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
815
829
  promptBlockId: import("zod").ZodString;
816
830
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-block-versions.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/prompt-block-versions.ts"],"names":[],"mappings":"AA8BA;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0C3C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkE9C,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { t as HTTPException } from "../../http-exception-CzaWkxMl.js";
2
2
  import { a as createPromptBlockVersionResponseSchema, c as listPromptBlockVersionsQuerySchema, d as promptBlockVersionPathParams, i as createPromptBlockVersionBodySchema, l as listPromptBlockVersionsResponseSchema, n as comparePromptBlockVersionsQuerySchema, o as deletePromptBlockVersionResponseSchema, p as restorePromptBlockVersionResponseSchema, r as comparePromptBlockVersionsResponseSchema, s as getPromptBlockVersionResponseSchema, t as activatePromptBlockVersionResponseSchema, u as promptBlockVersionIdPathParams } from "../../prompt-block-versions-3T-L2loy.js";
3
- import { n as createRoute } from "../../route-builder-DfDT1g4L.js";
4
- import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-yedETkNk.js";
3
+ import { n as createRoute } from "../../route-builder-Dz18c3qm.js";
4
+ import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-BfySxdfF.js";
5
5
  import { handleError } from "./error.js";
6
6
  import { calculateChangedFields, computeVersionDiffs, createVersionWithRetry, enforceRetentionLimit, extractConfigFromVersion } from "./version-helpers.js";
7
7
  // src/server/handlers/prompt-block-versions.ts