@mastra/server 1.58.0-alpha.0 → 1.58.0-alpha.12

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 (374) hide show
  1. package/CHANGELOG.md +246 -0
  2. package/dist/_types/@mastra_schema-compat/dist/provider-compats/anthropic.d.ts +1 -1
  3. package/dist/{a2a-CnU9zaGR.js → a2a-8C4O2dVJ.js} +41 -5
  4. package/dist/a2a-8C4O2dVJ.js.map +1 -0
  5. package/dist/{a2a-uPi5sPwb.js → a2a-B9X-RdWt.js} +863 -230
  6. package/dist/a2a-B9X-RdWt.js.map +1 -0
  7. package/dist/{a2a-DKnwIgiw.cjs → a2a-D1t2fS2L.cjs} +874 -229
  8. package/dist/a2a-D1t2fS2L.cjs.map +1 -0
  9. package/dist/{a2a-oM7aqLz4.cjs → a2a-MPoM5lzS.cjs} +41 -5
  10. package/dist/a2a-MPoM5lzS.cjs.map +1 -0
  11. package/dist/{agent-builder-BDYN3r89.cjs → agent-builder-D8JyDQ5J.cjs} +2 -2
  12. package/dist/{agent-builder-BDYN3r89.cjs.map → agent-builder-D8JyDQ5J.cjs.map} +1 -1
  13. package/dist/{agent-builder-Dqy_qumV.js → agent-builder-DNTFty1u.js} +2 -2
  14. package/dist/{agent-builder-Dqy_qumV.js.map → agent-builder-DNTFty1u.js.map} +1 -1
  15. package/dist/{agent-versions-Bsrpa_zb.js → agent-versions-CWEnD62A.js} +4 -4
  16. package/dist/{agent-versions-Bsrpa_zb.js.map → agent-versions-CWEnD62A.js.map} +1 -1
  17. package/dist/{agent-versions-CdQGF-3e.cjs → agent-versions-xeysPGel.cjs} +4 -4
  18. package/dist/{agent-versions-CdQGF-3e.cjs.map → agent-versions-xeysPGel.cjs.map} +1 -1
  19. package/dist/{agents-Dk2qoJi_.cjs → agents-0Tw3kkD_.cjs} +9 -5
  20. package/dist/agents-0Tw3kkD_.cjs.map +1 -0
  21. package/dist/{agents-CYvun9iI.js → agents-uT8ZDE4k.js} +9 -5
  22. package/dist/agents-uT8ZDE4k.js.map +1 -0
  23. package/dist/{api-schema-manifest-C5hpdIE_.js → api-schema-manifest-BLv_Z-sd.js} +3 -3
  24. package/dist/{api-schema-manifest-C5hpdIE_.js.map → api-schema-manifest-BLv_Z-sd.js.map} +1 -1
  25. package/dist/{api-schema-manifest-7-NC9Dyc.cjs → api-schema-manifest-CFLB0MBA.cjs} +3 -3
  26. package/dist/{api-schema-manifest-7-NC9Dyc.cjs.map → api-schema-manifest-CFLB0MBA.cjs.map} +1 -1
  27. package/dist/{background-tasks-DnmhLalp.js → background-tasks-Bzl2tNJq.js} +2 -2
  28. package/dist/{background-tasks-DnmhLalp.js.map → background-tasks-Bzl2tNJq.js.map} +1 -1
  29. package/dist/{background-tasks-CYgzzUnb.cjs → background-tasks-DXns62Go.cjs} +2 -2
  30. package/dist/{background-tasks-CYgzzUnb.cjs.map → background-tasks-DXns62Go.cjs.map} +1 -1
  31. package/dist/{builder-registry-BoaXBdm_.cjs → builder-registry-CTQyg5l5.cjs} +3 -3
  32. package/dist/{builder-registry-BoaXBdm_.cjs.map → builder-registry-CTQyg5l5.cjs.map} +1 -1
  33. package/dist/{builder-registry-DE5w7bNk.js → builder-registry-QAeqpQKB.js} +3 -3
  34. package/dist/{builder-registry-DE5w7bNk.js.map → builder-registry-QAeqpQKB.js.map} +1 -1
  35. package/dist/{channels-BqkOxxEk.js → channels-CPTIswT2.js} +2 -2
  36. package/dist/{channels-BqkOxxEk.js.map → channels-CPTIswT2.js.map} +1 -1
  37. package/dist/{channels-BonQBJT0.cjs → channels-FoIf30Hv.cjs} +2 -2
  38. package/dist/{channels-BonQBJT0.cjs.map → channels-FoIf30Hv.cjs.map} +1 -1
  39. package/dist/{common-CPNOpqxA.js → common-5ZZuR6wj.js} +19 -8
  40. package/dist/common-5ZZuR6wj.js.map +1 -0
  41. package/dist/{common-spbwhiWS.cjs → common-DQn8jX5T.cjs} +19 -8
  42. package/dist/common-DQn8jX5T.cjs.map +1 -0
  43. package/dist/{conversations-CebKjBfB.cjs → conversations-CcFLCCeF.cjs} +2 -2
  44. package/dist/{conversations-CebKjBfB.cjs.map → conversations-CcFLCCeF.cjs.map} +1 -1
  45. package/dist/{conversations-BDD46VBM.js → conversations-DtnawNGm.js} +2 -2
  46. package/dist/{conversations-BDD46VBM.js.map → conversations-DtnawNGm.js.map} +1 -1
  47. package/dist/{datasets-Cvix7Rms.cjs → datasets-D2JdQI44.cjs} +44 -2
  48. package/dist/datasets-D2JdQI44.cjs.map +1 -0
  49. package/dist/{datasets-dhXnHLAL.js → datasets-Dr1pCC6P.js} +39 -3
  50. package/dist/datasets-Dr1pCC6P.js.map +1 -0
  51. package/dist/{default-options-BcPyp2Gx.cjs → default-options-C9HZGjYi.cjs} +6 -3
  52. package/dist/{default-options-BcPyp2Gx.cjs.map → default-options-C9HZGjYi.cjs.map} +1 -1
  53. package/dist/{default-options-DGCDKR3I.js → default-options-C9JVjlto.js} +6 -3
  54. package/dist/{default-options-DGCDKR3I.js.map → default-options-C9JVjlto.js.map} +1 -1
  55. package/dist/{dist-DGqlUp0b.js → dist-CzzxT_L5.js} +345 -1404
  56. package/dist/dist-CzzxT_L5.js.map +1 -0
  57. package/dist/{dist-COHIL6fR.cjs → dist-TkFPtpuy.cjs} +354 -1416
  58. package/dist/dist-TkFPtpuy.cjs.map +1 -0
  59. package/dist/docs/SKILL.md +1 -1
  60. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  61. package/dist/docs/references/docs-agents-a2a.md +75 -2
  62. package/dist/docs/references/docs-server-custom-adapters.md +1 -1
  63. package/dist/docs/references/reference-server-routes.md +38 -24
  64. package/dist/{stored-workflows-OanG0TmB.js → dynamic-workflows-CQs6_anZ.js} +62 -62
  65. package/dist/dynamic-workflows-CQs6_anZ.js.map +1 -0
  66. package/dist/{stored-workflows-pCiWK305.cjs → dynamic-workflows-CrvwGZj8.cjs} +71 -71
  67. package/dist/dynamic-workflows-CrvwGZj8.cjs.map +1 -0
  68. package/dist/{editor-builder-CWTGCtNu.cjs → editor-builder-C3ZvffGu.cjs} +2 -2
  69. package/dist/{editor-builder-CWTGCtNu.cjs.map → editor-builder-C3ZvffGu.cjs.map} +1 -1
  70. package/dist/{editor-builder-Ct2nIbum.js → editor-builder-D5lhXbvj.js} +3 -3
  71. package/dist/{editor-builder-Ct2nIbum.js.map → editor-builder-D5lhXbvj.js.map} +1 -1
  72. package/dist/{editor-builder-BW4nlDcX.cjs → editor-builder-DG5-7x6V.cjs} +3 -3
  73. package/dist/{editor-builder-BW4nlDcX.cjs.map → editor-builder-DG5-7x6V.cjs.map} +1 -1
  74. package/dist/{editor-builder-fKbRRlK_.js → editor-builder-DJUxdzC8.js} +2 -2
  75. package/dist/{editor-builder-fKbRRlK_.js.map → editor-builder-DJUxdzC8.js.map} +1 -1
  76. package/dist/{logs-wBYi7UWL.cjs → logs-BDuGFqxu.cjs} +2 -2
  77. package/dist/{logs-wBYi7UWL.cjs.map → logs-BDuGFqxu.cjs.map} +1 -1
  78. package/dist/{logs-BzwWWl57.js → logs-Cz5NiwGP.js} +2 -2
  79. package/dist/{logs-BzwWWl57.js.map → logs-Cz5NiwGP.js.map} +1 -1
  80. package/dist/{mcp-DusNUBdz.cjs → mcp-Buvksst5.cjs} +2 -2
  81. package/dist/{mcp-DusNUBdz.cjs.map → mcp-Buvksst5.cjs.map} +1 -1
  82. package/dist/{mcp-client-versions-Db71zP8j.cjs → mcp-client-versions-CG7po4hq.cjs} +2 -2
  83. package/dist/{mcp-client-versions-Db71zP8j.cjs.map → mcp-client-versions-CG7po4hq.cjs.map} +1 -1
  84. package/dist/{mcp-client-versions-Dwbiav9P.js → mcp-client-versions-Co8d39A6.js} +2 -2
  85. package/dist/{mcp-client-versions-Dwbiav9P.js.map → mcp-client-versions-Co8d39A6.js.map} +1 -1
  86. package/dist/{mcp-BpC_5RhI.js → mcp-oOFVSK8L.js} +2 -2
  87. package/dist/{mcp-BpC_5RhI.js.map → mcp-oOFVSK8L.js.map} +1 -1
  88. package/dist/{memory-BjemiyZJ.js → memory-CBLqn9xl.js} +2 -2
  89. package/dist/{memory-BjemiyZJ.js.map → memory-CBLqn9xl.js.map} +1 -1
  90. package/dist/{memory-CxM2p78x.cjs → memory-D0prxytx.cjs} +2 -2
  91. package/dist/{memory-CxM2p78x.cjs.map → memory-D0prxytx.cjs.map} +1 -1
  92. package/dist/{observability-new-endpoints-YK2DjZto.js → observability-new-endpoints-6HLxLS-H.js} +2 -2
  93. package/dist/{observability-new-endpoints-YK2DjZto.js.map → observability-new-endpoints-6HLxLS-H.js.map} +1 -1
  94. package/dist/{observability-new-endpoints-Dk3oatL8.cjs → observability-new-endpoints-D4AWoyDe.cjs} +2 -2
  95. package/dist/{observability-new-endpoints-Dk3oatL8.cjs.map → observability-new-endpoints-D4AWoyDe.cjs.map} +1 -1
  96. package/dist/{probe-image-size-DYJVSL0b.cjs → probe-image-size-C2F59z8Z.cjs} +56 -1707
  97. package/dist/probe-image-size-C2F59z8Z.cjs.map +1 -0
  98. package/dist/{probe-image-size-BQgIJeY_.js → probe-image-size-mXCWYNrz.js} +22 -1673
  99. package/dist/probe-image-size-mXCWYNrz.js.map +1 -0
  100. package/dist/{prompt-block-versions-CIDwXWiC.js → prompt-block-versions-CBjHhMVK.js} +2 -2
  101. package/dist/{prompt-block-versions-CIDwXWiC.js.map → prompt-block-versions-CBjHhMVK.js.map} +1 -1
  102. package/dist/{prompt-block-versions-Bl3RmkTE.cjs → prompt-block-versions-Cgt_Grk2.cjs} +2 -2
  103. package/dist/{prompt-block-versions-Bl3RmkTE.cjs.map → prompt-block-versions-Cgt_Grk2.cjs.map} +1 -1
  104. package/dist/{route-builder-CgLVYL1c.cjs → route-builder-BBovb2TE.cjs} +2 -2
  105. package/dist/route-builder-BBovb2TE.cjs.map +1 -0
  106. package/dist/{route-builder-CIk5k35M.js → route-builder-CQkb7tQY.js} +2 -2
  107. package/dist/route-builder-CQkb7tQY.js.map +1 -0
  108. package/dist/{routes-hSY4wTeS.cjs → routes-CzvDlbRt.cjs} +26 -25
  109. package/dist/routes-CzvDlbRt.cjs.map +1 -0
  110. package/dist/{routes-CRoTKPvQ.js → routes-D_-O6SS5.js} +27 -26
  111. package/dist/routes-D_-O6SS5.js.map +1 -0
  112. package/dist/{schedules-CK3-IE0h.cjs → schedules-CfNABln2.cjs} +2 -2
  113. package/dist/{schedules-CK3-IE0h.cjs.map → schedules-CfNABln2.cjs.map} +1 -1
  114. package/dist/{schedules-qxFoU-Tb.js → schedules-DSkYO_Nl.js} +2 -2
  115. package/dist/{schedules-qxFoU-Tb.js.map → schedules-DSkYO_Nl.js.map} +1 -1
  116. package/dist/{schema-Bv9OdW1f-BY6u3u8K.cjs → schema-Bv9OdW1f-CHHI-NTr.cjs} +2 -76
  117. package/dist/schema-Bv9OdW1f-CHHI-NTr.cjs.map +1 -0
  118. package/dist/{schema-Bv9OdW1f-CIOfv-3w.js → schema-Bv9OdW1f-DLSJSqQv.js} +2 -76
  119. package/dist/schema-Bv9OdW1f-DLSJSqQv.js.map +1 -0
  120. package/dist/schema-CGeYTFwm.js +2 -0
  121. package/dist/schema-DkBbires.cjs +1 -0
  122. package/dist/{scorer-versions-DpmAJKsY.cjs → scorer-versions-CYXtxMTU.cjs} +3 -3
  123. package/dist/{scorer-versions-DpmAJKsY.cjs.map → scorer-versions-CYXtxMTU.cjs.map} +1 -1
  124. package/dist/{scorer-versions-BA8N488c.js → scorer-versions-CdVjOtQO.js} +3 -3
  125. package/dist/{scorer-versions-BA8N488c.js.map → scorer-versions-CdVjOtQO.js.map} +1 -1
  126. package/dist/{scores-DU0o86rP.js → scores-B1IdMcDj.js} +2 -2
  127. package/dist/{scores-DU0o86rP.js.map → scores-B1IdMcDj.js.map} +1 -1
  128. package/dist/{scores-Bm_sUKY1.cjs → scores-C_Au9jSw.cjs} +2 -2
  129. package/dist/{scores-Bm_sUKY1.cjs.map → scores-C_Au9jSw.cjs.map} +1 -1
  130. package/dist/server/a2a/store.cjs +30 -2
  131. package/dist/server/a2a/store.cjs.map +1 -1
  132. package/dist/server/a2a/store.d.ts +21 -2
  133. package/dist/server/a2a/store.d.ts.map +1 -1
  134. package/dist/server/a2a/store.js +30 -3
  135. package/dist/server/a2a/store.js.map +1 -1
  136. package/dist/server/a2a/task-state.d.ts +4 -0
  137. package/dist/server/a2a/task-state.d.ts.map +1 -0
  138. package/dist/server/a2a/tasks.d.ts +1 -1
  139. package/dist/server/a2a/tasks.d.ts.map +1 -1
  140. package/dist/server/handlers/a2a.cjs +3 -1
  141. package/dist/server/handlers/a2a.d.ts +155 -12
  142. package/dist/server/handlers/a2a.d.ts.map +1 -1
  143. package/dist/server/handlers/a2a.js +2 -2
  144. package/dist/server/handlers/agent-builder.cjs +7 -7
  145. package/dist/server/handlers/agent-builder.d.ts +4 -4
  146. package/dist/server/handlers/agent-builder.js +7 -7
  147. package/dist/server/handlers/agent-controller.cjs +86 -17
  148. package/dist/server/handlers/agent-controller.cjs.map +1 -1
  149. package/dist/server/handlers/agent-controller.d.ts +4 -3
  150. package/dist/server/handlers/agent-controller.d.ts.map +1 -1
  151. package/dist/server/handlers/agent-controller.js +86 -17
  152. package/dist/server/handlers/agent-controller.js.map +1 -1
  153. package/dist/server/handlers/agent-versions.cjs +10 -4
  154. package/dist/server/handlers/agent-versions.cjs.map +1 -1
  155. package/dist/server/handlers/agent-versions.d.ts +88 -16
  156. package/dist/server/handlers/agent-versions.d.ts.map +1 -1
  157. package/dist/server/handlers/agent-versions.js +10 -4
  158. package/dist/server/handlers/agent-versions.js.map +1 -1
  159. package/dist/server/handlers/agents.cjs +6 -6
  160. package/dist/server/handlers/agents.d.ts +50 -8
  161. package/dist/server/handlers/agents.d.ts.map +1 -1
  162. package/dist/server/handlers/agents.js +6 -6
  163. package/dist/server/handlers/auth.cjs +1 -1
  164. package/dist/server/handlers/auth.js +1 -1
  165. package/dist/server/handlers/background-tasks.cjs +1 -1
  166. package/dist/server/handlers/background-tasks.js +1 -1
  167. package/dist/server/handlers/builder-registry.cjs +1 -1
  168. package/dist/server/handlers/builder-registry.js +1 -1
  169. package/dist/server/handlers/channels.cjs +1 -1
  170. package/dist/server/handlers/channels.js +1 -1
  171. package/dist/server/handlers/conversations.cjs +2 -2
  172. package/dist/server/handlers/conversations.js +2 -2
  173. package/dist/server/handlers/datasets.cjs +28 -13
  174. package/dist/server/handlers/datasets.cjs.map +1 -1
  175. package/dist/server/handlers/datasets.d.ts +136 -0
  176. package/dist/server/handlers/datasets.d.ts.map +1 -1
  177. package/dist/server/handlers/datasets.js +28 -13
  178. package/dist/server/handlers/datasets.js.map +1 -1
  179. package/dist/server/handlers/dynamic-workflows.cjs +6 -0
  180. package/dist/server/handlers/{stored-workflows.d.ts → dynamic-workflows.d.ts} +14 -14
  181. package/dist/server/handlers/{stored-workflows.d.ts.map → dynamic-workflows.d.ts.map} +1 -1
  182. package/dist/server/handlers/dynamic-workflows.js +2 -0
  183. package/dist/server/handlers/editor-builder.cjs +1 -1
  184. package/dist/server/handlers/editor-builder.js +1 -1
  185. package/dist/server/handlers/favorites-enrichment.cjs +1 -1
  186. package/dist/server/handlers/favorites-enrichment.js +1 -1
  187. package/dist/server/handlers/logs.cjs +3 -3
  188. package/dist/server/handlers/logs.js +3 -3
  189. package/dist/server/handlers/mcp-client-versions.cjs +3 -3
  190. package/dist/server/handlers/mcp-client-versions.js +3 -3
  191. package/dist/server/handlers/mcp.cjs +2 -2
  192. package/dist/server/handlers/mcp.js +2 -2
  193. package/dist/server/handlers/memory.cjs +2 -2
  194. package/dist/server/handlers/memory.js +2 -2
  195. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  196. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  197. package/dist/server/handlers/observability-shared.cjs +1 -1
  198. package/dist/server/handlers/observability-shared.js +1 -1
  199. package/dist/server/handlers/observability.cjs +22 -11
  200. package/dist/server/handlers/observability.cjs.map +1 -1
  201. package/dist/server/handlers/observability.d.ts.map +1 -1
  202. package/dist/server/handlers/observability.js +22 -11
  203. package/dist/server/handlers/observability.js.map +1 -1
  204. package/dist/server/handlers/processor-providers.cjs +1 -1
  205. package/dist/server/handlers/processor-providers.js +1 -1
  206. package/dist/server/handlers/processors.cjs +1 -1
  207. package/dist/server/handlers/processors.js +1 -1
  208. package/dist/server/handlers/prompt-block-versions.cjs +3 -3
  209. package/dist/server/handlers/prompt-block-versions.js +3 -3
  210. package/dist/server/handlers/responses.cjs +1 -1
  211. package/dist/server/handlers/responses.js +1 -1
  212. package/dist/server/handlers/schedules.cjs +1 -1
  213. package/dist/server/handlers/schedules.js +1 -1
  214. package/dist/server/handlers/scorer-versions.cjs +3 -3
  215. package/dist/server/handlers/scorer-versions.js +3 -3
  216. package/dist/server/handlers/scores.cjs +3 -3
  217. package/dist/server/handlers/scores.js +3 -3
  218. package/dist/server/handlers/stored-agent-favorites.cjs +4 -4
  219. package/dist/server/handlers/stored-agent-favorites.js +4 -4
  220. package/dist/server/handlers/stored-agents.cjs +21 -6
  221. package/dist/server/handlers/stored-agents.cjs.map +1 -1
  222. package/dist/server/handlers/stored-agents.d.ts +100 -16
  223. package/dist/server/handlers/stored-agents.d.ts.map +1 -1
  224. package/dist/server/handlers/stored-agents.js +21 -6
  225. package/dist/server/handlers/stored-agents.js.map +1 -1
  226. package/dist/server/handlers/stored-mcp-clients.cjs +4 -4
  227. package/dist/server/handlers/stored-mcp-clients.js +4 -4
  228. package/dist/server/handlers/stored-prompt-blocks.cjs +4 -4
  229. package/dist/server/handlers/stored-prompt-blocks.js +4 -4
  230. package/dist/server/handlers/stored-scorers.cjs +4 -4
  231. package/dist/server/handlers/stored-scorers.js +4 -4
  232. package/dist/server/handlers/stored-skill-favorites.cjs +4 -4
  233. package/dist/server/handlers/stored-skill-favorites.js +4 -4
  234. package/dist/server/handlers/stored-skills.cjs +4 -4
  235. package/dist/server/handlers/stored-skills.js +4 -4
  236. package/dist/server/handlers/stored-workspaces.cjs +3 -3
  237. package/dist/server/handlers/stored-workspaces.js +3 -3
  238. package/dist/server/handlers/system.cjs +2 -2
  239. package/dist/server/handlers/system.js +2 -2
  240. package/dist/server/handlers/tool-providers.cjs +1 -1
  241. package/dist/server/handlers/tool-providers.js +1 -1
  242. package/dist/server/handlers/tools.cjs +6 -6
  243. package/dist/server/handlers/tools.js +6 -6
  244. package/dist/server/handlers/validate-agent-instructions.cjs +52 -0
  245. package/dist/server/handlers/validate-agent-instructions.cjs.map +1 -0
  246. package/dist/server/handlers/validate-agent-instructions.d.ts +13 -0
  247. package/dist/server/handlers/validate-agent-instructions.d.ts.map +1 -0
  248. package/dist/server/handlers/validate-agent-instructions.js +51 -0
  249. package/dist/server/handlers/validate-agent-instructions.js.map +1 -0
  250. package/dist/server/handlers/vector.cjs +2 -2
  251. package/dist/server/handlers/vector.js +2 -2
  252. package/dist/server/handlers/workflows.cjs +161 -27
  253. package/dist/server/handlers/workflows.cjs.map +1 -1
  254. package/dist/server/handlers/workflows.d.ts +13 -4
  255. package/dist/server/handlers/workflows.d.ts.map +1 -1
  256. package/dist/server/handlers/workflows.js +161 -29
  257. package/dist/server/handlers/workflows.js.map +1 -1
  258. package/dist/server/handlers/workspace.cjs +1 -1
  259. package/dist/server/handlers/workspace.js +1 -1
  260. package/dist/server/handlers.cjs +8 -8
  261. package/dist/server/handlers.d.ts +1 -1
  262. package/dist/server/handlers.d.ts.map +1 -1
  263. package/dist/server/handlers.js +3 -3
  264. package/dist/server/schemas/a2a.d.ts +70 -6
  265. package/dist/server/schemas/a2a.d.ts.map +1 -1
  266. package/dist/server/schemas/agent-versions.d.ts +70 -10
  267. package/dist/server/schemas/agent-versions.d.ts.map +1 -1
  268. package/dist/server/schemas/agents.d.ts +23 -3
  269. package/dist/server/schemas/agents.d.ts.map +1 -1
  270. package/dist/server/schemas/common.d.ts.map +1 -1
  271. package/dist/server/schemas/datasets.d.ts +53 -0
  272. package/dist/server/schemas/datasets.d.ts.map +1 -1
  273. package/dist/server/schemas/default-options.d.ts +7 -1
  274. package/dist/server/schemas/default-options.d.ts.map +1 -1
  275. package/dist/server/schemas/{stored-workflows.d.ts → dynamic-workflows.d.ts} +13 -13
  276. package/dist/server/schemas/dynamic-workflows.d.ts.map +1 -0
  277. package/dist/server/schemas/index.cjs +26 -25
  278. package/dist/server/schemas/index.js +26 -26
  279. package/dist/server/schemas/stored-agents.d.ts +140 -20
  280. package/dist/server/schemas/stored-agents.d.ts.map +1 -1
  281. package/dist/server/schemas/workflows.d.ts +10 -2
  282. package/dist/server/schemas/workflows.d.ts.map +1 -1
  283. package/dist/server/server-adapter/index.cjs +44 -3
  284. package/dist/server/server-adapter/index.cjs.map +1 -1
  285. package/dist/server/server-adapter/index.d.ts +37 -0
  286. package/dist/server/server-adapter/index.d.ts.map +1 -1
  287. package/dist/server/server-adapter/index.js +45 -5
  288. package/dist/server/server-adapter/index.js.map +1 -1
  289. package/dist/server/server-adapter/routes/a2a.d.ts +116 -8
  290. package/dist/server/server-adapter/routes/a2a.d.ts.map +1 -1
  291. package/dist/server/server-adapter/routes/agent-builder.d.ts +4 -4
  292. package/dist/server/server-adapter/routes/datasets.d.ts +136 -0
  293. package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
  294. package/dist/server/server-adapter/routes/dynamic-workflows.d.ts +16 -0
  295. package/dist/server/server-adapter/routes/dynamic-workflows.d.ts.map +1 -0
  296. package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
  297. package/dist/server/server-adapter/routes/workflows.d.ts +11 -5
  298. package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -1
  299. package/dist/{stored-agents-D8ar1Pn7.js → stored-agents-BRBZM-Xl.js} +4 -4
  300. package/dist/{stored-agents-D8ar1Pn7.js.map → stored-agents-BRBZM-Xl.js.map} +1 -1
  301. package/dist/{stored-agents-DKd89v5z.cjs → stored-agents-CPxfYRH9.cjs} +4 -4
  302. package/dist/{stored-agents-DKd89v5z.cjs.map → stored-agents-CPxfYRH9.cjs.map} +1 -1
  303. package/dist/{stored-mcp-clients-CwA5_nZ9.cjs → stored-mcp-clients-CJJPe_09.cjs} +2 -2
  304. package/dist/{stored-mcp-clients-CwA5_nZ9.cjs.map → stored-mcp-clients-CJJPe_09.cjs.map} +1 -1
  305. package/dist/{stored-mcp-clients-DJ3E4g8-.js → stored-mcp-clients-CoCfZRhw.js} +2 -2
  306. package/dist/{stored-mcp-clients-DJ3E4g8-.js.map → stored-mcp-clients-CoCfZRhw.js.map} +1 -1
  307. package/dist/{stored-prompt-blocks-BlqcqnEX.js → stored-prompt-blocks-DcmkZaCm.js} +2 -2
  308. package/dist/{stored-prompt-blocks-BlqcqnEX.js.map → stored-prompt-blocks-DcmkZaCm.js.map} +1 -1
  309. package/dist/{stored-prompt-blocks-DR_Wts8r.cjs → stored-prompt-blocks-XI4frgZv.cjs} +2 -2
  310. package/dist/{stored-prompt-blocks-DR_Wts8r.cjs.map → stored-prompt-blocks-XI4frgZv.cjs.map} +1 -1
  311. package/dist/{stored-scorers-BIKumDRO.js → stored-scorers-B__LF0Cy.js} +3 -3
  312. package/dist/{stored-scorers-BIKumDRO.js.map → stored-scorers-B__LF0Cy.js.map} +1 -1
  313. package/dist/{stored-scorers-_dqFdh-G.cjs → stored-scorers-Cml7jPJv.cjs} +3 -3
  314. package/dist/{stored-scorers-_dqFdh-G.cjs.map → stored-scorers-Cml7jPJv.cjs.map} +1 -1
  315. package/dist/{stored-skills-CgwoCNNV.cjs → stored-skills-BqNK0ssS.cjs} +2 -2
  316. package/dist/{stored-skills-CgwoCNNV.cjs.map → stored-skills-BqNK0ssS.cjs.map} +1 -1
  317. package/dist/{stored-skills-B_aAMn5W.js → stored-skills-JTWbMybs.js} +2 -2
  318. package/dist/{stored-skills-B_aAMn5W.js.map → stored-skills-JTWbMybs.js.map} +1 -1
  319. package/dist/{stored-workspaces-Dib-ClOP.js → stored-workspaces-6PYE4Y3m.js} +2 -2
  320. package/dist/{stored-workspaces-Dib-ClOP.js.map → stored-workspaces-6PYE4Y3m.js.map} +1 -1
  321. package/dist/{stored-workspaces-CbJQaFuP.cjs → stored-workspaces-Dl8B20LD.cjs} +2 -2
  322. package/dist/{stored-workspaces-CbJQaFuP.cjs.map → stored-workspaces-Dl8B20LD.cjs.map} +1 -1
  323. package/dist/sync-BHatXKfg.cjs +1679 -0
  324. package/dist/sync-BHatXKfg.cjs.map +1 -0
  325. package/dist/sync-djJ8Lmds.js +1656 -0
  326. package/dist/sync-djJ8Lmds.js.map +1 -0
  327. package/dist/{utils-wESuBh27.cjs → utils-Bna_JCkb.cjs} +3 -3
  328. package/dist/{utils-wESuBh27.cjs.map → utils-Bna_JCkb.cjs.map} +1 -1
  329. package/dist/{utils-BUK03Frl.js → utils-QXKhjIm6.js} +3 -3
  330. package/dist/{utils-BUK03Frl.js.map → utils-QXKhjIm6.js.map} +1 -1
  331. package/dist/{vectors-CZY34X8R.js → vectors-Ck7Qu6yz.js} +2 -2
  332. package/dist/{vectors-CZY34X8R.js.map → vectors-Ck7Qu6yz.js.map} +1 -1
  333. package/dist/{vectors-Cj-SPxOy.cjs → vectors-D6uZn2f1.cjs} +2 -2
  334. package/dist/{vectors-Cj-SPxOy.cjs.map → vectors-D6uZn2f1.cjs.map} +1 -1
  335. package/dist/{version-common-CEBQY7M8.cjs → version-common-AtNRQ5xH.cjs} +2 -2
  336. package/dist/{version-common-CEBQY7M8.cjs.map → version-common-AtNRQ5xH.cjs.map} +1 -1
  337. package/dist/{version-common-Cmd1f9JX.js → version-common-CudZ_WuW.js} +2 -2
  338. package/dist/{version-common-Cmd1f9JX.js.map → version-common-CudZ_WuW.js.map} +1 -1
  339. package/dist/{workflows-XfiENvkF.cjs → workflows--79xhOOb.cjs} +14 -3
  340. package/dist/workflows--79xhOOb.cjs.map +1 -0
  341. package/dist/{workflows-DPW6FrY0.js → workflows-B2ooCiwN.js} +9 -4
  342. package/dist/workflows-B2ooCiwN.js.map +1 -0
  343. package/package.json +8 -8
  344. package/dist/a2a-CnU9zaGR.js.map +0 -1
  345. package/dist/a2a-DKnwIgiw.cjs.map +0 -1
  346. package/dist/a2a-oM7aqLz4.cjs.map +0 -1
  347. package/dist/a2a-uPi5sPwb.js.map +0 -1
  348. package/dist/agents-CYvun9iI.js.map +0 -1
  349. package/dist/agents-Dk2qoJi_.cjs.map +0 -1
  350. package/dist/common-CPNOpqxA.js.map +0 -1
  351. package/dist/common-spbwhiWS.cjs.map +0 -1
  352. package/dist/datasets-Cvix7Rms.cjs.map +0 -1
  353. package/dist/datasets-dhXnHLAL.js.map +0 -1
  354. package/dist/dist-COHIL6fR.cjs.map +0 -1
  355. package/dist/dist-DGqlUp0b.js.map +0 -1
  356. package/dist/probe-image-size-BQgIJeY_.js.map +0 -1
  357. package/dist/probe-image-size-DYJVSL0b.cjs.map +0 -1
  358. package/dist/route-builder-CIk5k35M.js.map +0 -1
  359. package/dist/route-builder-CgLVYL1c.cjs.map +0 -1
  360. package/dist/routes-CRoTKPvQ.js.map +0 -1
  361. package/dist/routes-hSY4wTeS.cjs.map +0 -1
  362. package/dist/schema-B8-5YCsA.js +0 -2
  363. package/dist/schema-BieM1qrc.cjs +0 -1
  364. package/dist/schema-Bv9OdW1f-BY6u3u8K.cjs.map +0 -1
  365. package/dist/schema-Bv9OdW1f-CIOfv-3w.js.map +0 -1
  366. package/dist/server/handlers/stored-workflows.cjs +0 -6
  367. package/dist/server/handlers/stored-workflows.js +0 -2
  368. package/dist/server/schemas/stored-workflows.d.ts.map +0 -1
  369. package/dist/server/server-adapter/routes/stored-workflows.d.ts +0 -16
  370. package/dist/server/server-adapter/routes/stored-workflows.d.ts.map +0 -1
  371. package/dist/stored-workflows-OanG0TmB.js.map +0 -1
  372. package/dist/stored-workflows-pCiWK305.cjs.map +0 -1
  373. package/dist/workflows-DPW6FrY0.js.map +0 -1
  374. package/dist/workflows-XfiENvkF.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"agent-versions.cjs","names":["createRoute","agentVersionPathParams","listVersionsQuerySchema","listVersionsResponseSchema","HTTPException","getStoredResourceScope","handleError","createVersionBodySchema","createVersionResponseSchema","extractConfigFromVersion","calculateChangedFields","createVersionWithRetry","enforceRetentionLimit","versionIdPathParams","getVersionResponseSchema","activateVersionResponseSchema","restoreVersionResponseSchema","deleteVersionResponseSchema","compareVersionsQuerySchema","compareVersionsResponseSchema","computeVersionDiffs"],"sources":["../../../src/server/handlers/agent-versions.ts"],"sourcesContent":["import type { z } from 'zod/v4';\n\nimport { HTTPException } from '../http-exception';\nimport {\n agentVersionPathParams,\n versionIdPathParams,\n listVersionsQuerySchema,\n createVersionBodySchema,\n compareVersionsQuerySchema,\n listVersionsResponseSchema,\n getVersionResponseSchema,\n createVersionResponseSchema,\n activateVersionResponseSchema,\n restoreVersionResponseSchema,\n deleteVersionResponseSchema,\n compareVersionsResponseSchema,\n} from '../schemas/agent-versions';\nimport type { ServerRoute, RouteSchemas, InferParams } from '../server-adapter/routes';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * The config field names that live on version rows (StorageAgentSnapshotType fields).\n * Used to extract config from a version record for comparison and restoration.\n */\nconst SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'instructions',\n 'model',\n 'tools',\n 'defaultOptions',\n 'workflows',\n 'agents',\n 'integrationTools',\n 'inputProcessors',\n 'outputProcessors',\n 'memory',\n 'scorers',\n 'requestContextSchema',\n 'mcpClients',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/agents/:agentId/versions - List all versions for an agent\n */\nexport const LIST_AGENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: listVersionsQuerySchema,\n responseSchema: listVersionsResponseSchema,\n summary: 'List agent versions',\n description: 'Returns a paginated list of all versions for a stored agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists in code or storage\n const storedAgent = await agentsStore.getById(agentId);\n let codeAgentExists = false;\n try {\n mastra.getAgentById(agentId);\n codeAgentExists = true;\n } catch {\n // Agent not registered in code\n }\n\n if (!storedAgent && !codeAgentExists) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(storedAgent, await getStoredResourceScope(mastra, requestContext));\n\n const result = await agentsStore.listVersions({\n agentId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing agent versions');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions - Create a new version snapshot\n */\nexport const CREATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n bodySchema: createVersionBodySchema,\n responseSchema: createVersionResponseSchema,\n summary: 'Create agent version',\n description: 'Creates a new version snapshot of the current agent configuration',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Get the current agent to find its active version\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the current active version to snapshot its config\n let currentConfig: Record<string, unknown> = {};\n if (agent.activeVersionId) {\n const activeVersion = await agentsStore.getVersion(agent.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n\n // If no activeVersionId, fall back to latest version config\n if (!agent.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n // Create the new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n // Get the created version to return\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/:versionId - Get a specific version\n */\nexport const GET_AGENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: getVersionResponseSchema,\n summary: 'Get agent version',\n description: 'Returns a specific version of an agent by its version ID',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n const version = await agentsStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n // Verify the version belongs to the specified agent\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: activateVersionResponseSchema,\n summary: 'Activate agent version',\n description: 'Sets a specific version as the active version for the agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Update the agent's activeVersionId AND status to 'published'\n await agentsStore.update({\n id: agentId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/restore - Restore agent to a version\n */\nexport const RESTORE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: restoreVersionResponseSchema,\n summary: 'Restore agent version',\n description: 'Restores the agent configuration from a version, creating a new version',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the version to restore\n const versionToRestore = await agentsStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Extract the config fields from the version to restore (top-level, no .snapshot)\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Update the agent with the config from the version to restore\n await agentsStore.update({\n id: agentId,\n ...restoredConfig,\n });\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n // Create a new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId: newVersionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n // Do NOT auto-activate the restored version - user must explicitly activate it\n\n // Get the created version to return\n const newVersion = await agentsStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n // Use the agent's existing activeVersionId\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the restored config\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring agent version');\n }\n },\n});\n\n/**\n * DELETE /stored/agents/:agentId/versions/:versionId - Delete a version\n */\nexport const DELETE_AGENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: deleteVersionResponseSchema,\n summary: 'Delete agent version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Check if this is the active version\n if (agent.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await agentsStore.deleteVersion(versionId);\n\n // Clear the editor cache in case the deleted version affected resolution\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/compare - Compare two versions\n */\nexport const COMPARE_AGENT_VERSIONS_ROUTE: ServerRoute<\n InferParams<typeof agentVersionPathParams, typeof compareVersionsQuerySchema, undefined>,\n z.infer<typeof compareVersionsResponseSchema>,\n 'json',\n RouteSchemas<\n typeof agentVersionPathParams,\n typeof compareVersionsQuerySchema,\n undefined,\n typeof compareVersionsResponseSchema\n >,\n 'GET',\n '/stored/agents/:agentId/versions/compare'\n> = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: compareVersionsQuerySchema,\n responseSchema: compareVersionsResponseSchema,\n summary: 'Compare agent versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get both versions\n const fromVersion = await agentsStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${from} not found for agent ${agentId}` });\n }\n\n const toVersion = await agentsStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${to} not found for agent ${agentId}` });\n }\n\n // Extract config fields from both versions (top-level, no .snapshot)\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Compute diffs on the config fields\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error, 'Error comparing agent versions');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;AAmCA,MAAM,yBAAyB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;AASA,MAAa,4BAA4BA,sBAAAA,YAAY;CACnD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,cAAc;CACd,iBAAiBC,uBAAAA;CACjB,kBAAkBC,uBAAAA;CAClB,gBAAgBC,uBAAAA;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,gBAAgB;CACvB,SAAS,OAAO,EAAE,QAAQ,SAAS,MAAM,SAAS,SAAS,qBAAqB;EAC9E,IAAI;GACF,MAAM,UAAU,OAAO,WAAW;GAElC,IAAI,CAAC,SACH,MAAM,IAAIC,uBAAAA,cAAc,KAAK,EAAE,SAAS,4BAA4B,CAAC;GAGvE,MAAM,cAAc,MAAM,QAAQ,SAAS,QAAQ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AM,IAAIf,uBAAAA,cAAc,KAAK,EAAE,SAAS,4BAA4B,CAAC;GAGvE,MAAM,cAAc,MAAM,QAAQ,SAAS,QAAQ;GACnD,IAAI,CAAC,aACH,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,yCAAyC,CAAC;GAGpF,cAAA,0BAA0B,MADN,YAAY,QAAQ,OAAO,GACd,MAAMC,cAAAA,uBAAuB,QAAQ,cAAc,CAAC;GAGrF,MAAM,cAAc,MAAM,YAAY,WAAW,IAAI;GACrD,IAAI,CAAC,aACH,MAAM,IAAID,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,KAAK,YAAY,CAAC;GAE/E,IAAI,YAAY,YAAY,SAC1B,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,KAAK,uBAAuB,UAAU,CAAC;GAGpG,MAAM,YAAY,MAAM,YAAY,WAAW,EAAE;GACjD,IAAI,CAAC,WACH,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,YAAY,CAAC;GAE7E,IAAI,UAAU,YAAY,SACxB,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,uBAAuB,UAAU,CAAC;GAgBlG,OAAO;IACL,OAHYgB,wCAAAA,oBAVKX,wCAAAA,yBACjB,aACA,sBAQyC,GAN1BA,wCAAAA,yBACf,WACA,sBAImD,CAG/C;IACJ;IACA;GACF;EACF,SAAS,OAAO;GACd,OAAOH,8BAAAA,YAAY,OAAO,gCAAgC;EAC5D;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"agent-versions.cjs","names":["createRoute","agentVersionPathParams","listVersionsQuerySchema","listVersionsResponseSchema","HTTPException","getStoredResourceScope","handleError","createVersionBodySchema","createVersionResponseSchema","extractConfigFromVersion","calculateChangedFields","createVersionWithRetry","enforceRetentionLimit","versionIdPathParams","getVersionResponseSchema","activateVersionResponseSchema","validateAgentInstructionReferences","restoreVersionResponseSchema","deleteVersionResponseSchema","compareVersionsQuerySchema","compareVersionsResponseSchema","computeVersionDiffs"],"sources":["../../../src/server/handlers/agent-versions.ts"],"sourcesContent":["import type { z } from 'zod/v4';\n\nimport { HTTPException } from '../http-exception';\nimport {\n agentVersionPathParams,\n versionIdPathParams,\n listVersionsQuerySchema,\n createVersionBodySchema,\n compareVersionsQuerySchema,\n listVersionsResponseSchema,\n getVersionResponseSchema,\n createVersionResponseSchema,\n activateVersionResponseSchema,\n restoreVersionResponseSchema,\n deleteVersionResponseSchema,\n compareVersionsResponseSchema,\n} from '../schemas/agent-versions';\nimport type { ServerRoute, RouteSchemas, InferParams } from '../server-adapter/routes';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport { validateAgentInstructionReferences } from './validate-agent-instructions';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * The config field names that live on version rows (StorageAgentSnapshotType fields).\n * Used to extract config from a version record for comparison and restoration.\n */\nconst SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'instructions',\n 'model',\n 'tools',\n 'defaultOptions',\n 'workflows',\n 'agents',\n 'integrationTools',\n 'inputProcessors',\n 'outputProcessors',\n 'memory',\n 'scorers',\n 'requestContextSchema',\n 'mcpClients',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/agents/:agentId/versions - List all versions for an agent\n */\nexport const LIST_AGENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: listVersionsQuerySchema,\n responseSchema: listVersionsResponseSchema,\n summary: 'List agent versions',\n description: 'Returns a paginated list of all versions for a stored agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists in code or storage\n const storedAgent = await agentsStore.getById(agentId);\n let codeAgentExists = false;\n try {\n mastra.getAgentById(agentId);\n codeAgentExists = true;\n } catch {\n // Agent not registered in code\n }\n\n if (!storedAgent && !codeAgentExists) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(storedAgent, await getStoredResourceScope(mastra, requestContext));\n\n const result = await agentsStore.listVersions({\n agentId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing agent versions');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions - Create a new version snapshot\n */\nexport const CREATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n bodySchema: createVersionBodySchema,\n responseSchema: createVersionResponseSchema,\n summary: 'Create agent version',\n description: 'Creates a new version snapshot of the current agent configuration',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Get the current agent to find its active version\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the current active version to snapshot its config\n let currentConfig: Record<string, unknown> = {};\n if (agent.activeVersionId) {\n const activeVersion = await agentsStore.getVersion(agent.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n\n // If no activeVersionId, fall back to latest version config\n if (!agent.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n // Create the new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n // Get the created version to return\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/:versionId - Get a specific version\n */\nexport const GET_AGENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: getVersionResponseSchema,\n summary: 'Get agent version',\n description: 'Returns a specific version of an agent by its version ID',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n const version = await agentsStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n // Verify the version belongs to the specified agent\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: activateVersionResponseSchema,\n summary: 'Activate agent version',\n description: 'Sets a specific version as the active version for the agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n await validateAgentInstructionReferences({\n instructions: version.instructions,\n mastra,\n requestContext,\n });\n\n // Update the agent's activeVersionId AND status to 'published'\n await agentsStore.update({\n id: agentId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/restore - Restore agent to a version\n */\nexport const RESTORE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: restoreVersionResponseSchema,\n summary: 'Restore agent version',\n description: 'Restores the agent configuration from a version, creating a new version',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the version to restore\n const versionToRestore = await agentsStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Extract the config fields from the version to restore (top-level, no .snapshot)\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Update the agent with the config from the version to restore\n await agentsStore.update({\n id: agentId,\n ...restoredConfig,\n });\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n // Create a new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId: newVersionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n // Do NOT auto-activate the restored version - user must explicitly activate it\n\n // Get the created version to return\n const newVersion = await agentsStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n // Use the agent's existing activeVersionId\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the restored config\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring agent version');\n }\n },\n});\n\n/**\n * DELETE /stored/agents/:agentId/versions/:versionId - Delete a version\n */\nexport const DELETE_AGENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: deleteVersionResponseSchema,\n summary: 'Delete agent version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Check if this is the active version\n if (agent.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await agentsStore.deleteVersion(versionId);\n\n // Clear the editor cache in case the deleted version affected resolution\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/compare - Compare two versions\n */\nexport const COMPARE_AGENT_VERSIONS_ROUTE: ServerRoute<\n InferParams<typeof agentVersionPathParams, typeof compareVersionsQuerySchema, undefined>,\n z.infer<typeof compareVersionsResponseSchema>,\n 'json',\n RouteSchemas<\n typeof agentVersionPathParams,\n typeof compareVersionsQuerySchema,\n undefined,\n typeof compareVersionsResponseSchema\n >,\n 'GET',\n '/stored/agents/:agentId/versions/compare'\n> = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: compareVersionsQuerySchema,\n responseSchema: compareVersionsResponseSchema,\n summary: 'Compare agent versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get both versions\n const fromVersion = await agentsStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${from} not found for agent ${agentId}` });\n }\n\n const toVersion = await agentsStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${to} not found for agent ${agentId}` });\n }\n\n // Extract config fields from both versions (top-level, no .snapshot)\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Compute diffs on the config fields\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error, 'Error comparing agent versions');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;AAoCA,MAAM,yBAAyB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;AASA,MAAa,4BAA4BA,sBAAAA,YAAY;CACnD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,cAAc;CACd,iBAAiBC,uBAAAA;CACjB,kBAAkBC,uBAAAA;CAClB,gBAAgBC,uBAAAA;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,gBAAgB;CACvB,SAAS,OAAO,EAAE,QAAQ,SAAS,MAAM,SAAS,SAAS,qBAAqB;EAC9E,IAAI;GACF,MAAM,UAAU,OAAO,WAAW;GAElC,IAAI,CAAC,SACH,MAAM,IAAIC,uBAAAA,cAAc,KAAK,EAAE,SAAS,4BAA4B,CAAC;GAGvE,MAAM,cAAc,MAAM,QAAQ,SAAS,QAAQ;GAC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ChE,IAAI;GACF,MAAM,UAAU,OAAO,WAAW;GAElC,IAAI,CAAC,SACH,MAAM,IAAIhB,uBAAAA,cAAc,KAAK,EAAE,SAAS,4BAA4B,CAAC;GAGvE,MAAM,cAAc,MAAM,QAAQ,SAAS,QAAQ;GACnD,IAAI,CAAC,aACH,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,yCAAyC,CAAC;GAGpF,cAAA,0BAA0B,MADN,YAAY,QAAQ,OAAO,GACd,MAAMC,cAAAA,uBAAuB,QAAQ,cAAc,CAAC;GAGrF,MAAM,cAAc,MAAM,YAAY,WAAW,IAAI;GACrD,IAAI,CAAC,aACH,MAAM,IAAID,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,KAAK,YAAY,CAAC;GAE/E,IAAI,YAAY,YAAY,SAC1B,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,KAAK,uBAAuB,UAAU,CAAC;GAGpG,MAAM,YAAY,MAAM,YAAY,WAAW,EAAE;GACjD,IAAI,CAAC,WACH,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,YAAY,CAAC;GAE7E,IAAI,UAAU,YAAY,SACxB,MAAM,IAAIA,uBAAAA,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,uBAAuB,UAAU,CAAC;GAgBlG,OAAO;IACL,OAHYiB,wCAAAA,oBAVKZ,wCAAAA,yBACjB,aACA,sBAQyC,GAN1BA,wCAAAA,yBACf,WACA,sBAImD,CAG/C;IACJ;IACA;GACF;EACF,SAAS,OAAO;GACd,OAAOH,8BAAAA,YAAY,OAAO,gCAAgC;EAC5D;CACF;AACF,CAAC"}
@@ -213,7 +213,10 @@ export declare const LIST_AGENT_VERSIONS_ROUTE: ServerRoute<InferParams<z.ZodObj
213
213
  } | undefined;
214
214
  requireToolApproval?: boolean | undefined;
215
215
  autoResumeSuspendedTools?: boolean | undefined;
216
- toolCallConcurrency?: number | undefined;
216
+ toolCallConcurrency?: number | {
217
+ limit?: number | undefined;
218
+ strategy?: "available" | "called" | undefined;
219
+ } | undefined;
217
220
  includeRawChunks?: boolean | undefined;
218
221
  } | {
219
222
  value: {
@@ -247,7 +250,10 @@ export declare const LIST_AGENT_VERSIONS_ROUTE: ServerRoute<InferParams<z.ZodObj
247
250
  } | undefined;
248
251
  requireToolApproval?: boolean | undefined;
249
252
  autoResumeSuspendedTools?: boolean | undefined;
250
- toolCallConcurrency?: number | undefined;
253
+ toolCallConcurrency?: number | {
254
+ limit?: number | undefined;
255
+ strategy?: "available" | "called" | undefined;
256
+ } | undefined;
251
257
  includeRawChunks?: boolean | undefined;
252
258
  };
253
259
  rules?: {
@@ -1856,7 +1862,13 @@ export declare const LIST_AGENT_VERSIONS_ROUTE: ServerRoute<InferParams<z.ZodObj
1856
1862
  }, z.core.$strip>>;
1857
1863
  requireToolApproval: z.ZodOptional<z.ZodBoolean>;
1858
1864
  autoResumeSuspendedTools: z.ZodOptional<z.ZodBoolean>;
1859
- toolCallConcurrency: z.ZodOptional<z.ZodNumber>;
1865
+ toolCallConcurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1866
+ limit: z.ZodOptional<z.ZodNumber>;
1867
+ strategy: z.ZodOptional<z.ZodEnum<{
1868
+ available: "available";
1869
+ called: "called";
1870
+ }>>;
1871
+ }, z.core.$strip>]>>;
1860
1872
  includeRawChunks: z.ZodOptional<z.ZodBoolean>;
1861
1873
  }, z.core.$loose>, z.ZodArray<z.ZodObject<{
1862
1874
  value: z.ZodObject<{
@@ -1889,7 +1901,13 @@ export declare const LIST_AGENT_VERSIONS_ROUTE: ServerRoute<InferParams<z.ZodObj
1889
1901
  }, z.core.$strip>>;
1890
1902
  requireToolApproval: z.ZodOptional<z.ZodBoolean>;
1891
1903
  autoResumeSuspendedTools: z.ZodOptional<z.ZodBoolean>;
1892
- toolCallConcurrency: z.ZodOptional<z.ZodNumber>;
1904
+ toolCallConcurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1905
+ limit: z.ZodOptional<z.ZodNumber>;
1906
+ strategy: z.ZodOptional<z.ZodEnum<{
1907
+ available: "available";
1908
+ called: "called";
1909
+ }>>;
1910
+ }, z.core.$strip>]>>;
1893
1911
  includeRawChunks: z.ZodOptional<z.ZodBoolean>;
1894
1912
  }, z.core.$loose>;
1895
1913
  rules: z.ZodOptional<z.ZodObject<{
@@ -4942,7 +4960,10 @@ export declare const CREATE_AGENT_VERSION_ROUTE: ServerRoute<InferParams<z.ZodOb
4942
4960
  } | undefined;
4943
4961
  requireToolApproval?: boolean | undefined;
4944
4962
  autoResumeSuspendedTools?: boolean | undefined;
4945
- toolCallConcurrency?: number | undefined;
4963
+ toolCallConcurrency?: number | {
4964
+ limit?: number | undefined;
4965
+ strategy?: "available" | "called" | undefined;
4966
+ } | undefined;
4946
4967
  includeRawChunks?: boolean | undefined;
4947
4968
  } | {
4948
4969
  value: {
@@ -4976,7 +4997,10 @@ export declare const CREATE_AGENT_VERSION_ROUTE: ServerRoute<InferParams<z.ZodOb
4976
4997
  } | undefined;
4977
4998
  requireToolApproval?: boolean | undefined;
4978
4999
  autoResumeSuspendedTools?: boolean | undefined;
4979
- toolCallConcurrency?: number | undefined;
5000
+ toolCallConcurrency?: number | {
5001
+ limit?: number | undefined;
5002
+ strategy?: "available" | "called" | undefined;
5003
+ } | undefined;
4980
5004
  includeRawChunks?: boolean | undefined;
4981
5005
  };
4982
5006
  rules?: {
@@ -6560,7 +6584,13 @@ export declare const CREATE_AGENT_VERSION_ROUTE: ServerRoute<InferParams<z.ZodOb
6560
6584
  }, z.core.$strip>>;
6561
6585
  requireToolApproval: z.ZodOptional<z.ZodBoolean>;
6562
6586
  autoResumeSuspendedTools: z.ZodOptional<z.ZodBoolean>;
6563
- toolCallConcurrency: z.ZodOptional<z.ZodNumber>;
6587
+ toolCallConcurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
6588
+ limit: z.ZodOptional<z.ZodNumber>;
6589
+ strategy: z.ZodOptional<z.ZodEnum<{
6590
+ available: "available";
6591
+ called: "called";
6592
+ }>>;
6593
+ }, z.core.$strip>]>>;
6564
6594
  includeRawChunks: z.ZodOptional<z.ZodBoolean>;
6565
6595
  }, z.core.$loose>, z.ZodArray<z.ZodObject<{
6566
6596
  value: z.ZodObject<{
@@ -6593,7 +6623,13 @@ export declare const CREATE_AGENT_VERSION_ROUTE: ServerRoute<InferParams<z.ZodOb
6593
6623
  }, z.core.$strip>>;
6594
6624
  requireToolApproval: z.ZodOptional<z.ZodBoolean>;
6595
6625
  autoResumeSuspendedTools: z.ZodOptional<z.ZodBoolean>;
6596
- toolCallConcurrency: z.ZodOptional<z.ZodNumber>;
6626
+ toolCallConcurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
6627
+ limit: z.ZodOptional<z.ZodNumber>;
6628
+ strategy: z.ZodOptional<z.ZodEnum<{
6629
+ available: "available";
6630
+ called: "called";
6631
+ }>>;
6632
+ }, z.core.$strip>]>>;
6597
6633
  includeRawChunks: z.ZodOptional<z.ZodBoolean>;
6598
6634
  }, z.core.$loose>;
6599
6635
  rules: z.ZodOptional<z.ZodObject<{
@@ -9647,7 +9683,10 @@ export declare const GET_AGENT_VERSION_ROUTE: ServerRoute<{
9647
9683
  } | undefined;
9648
9684
  requireToolApproval?: boolean | undefined;
9649
9685
  autoResumeSuspendedTools?: boolean | undefined;
9650
- toolCallConcurrency?: number | undefined;
9686
+ toolCallConcurrency?: number | {
9687
+ limit?: number | undefined;
9688
+ strategy?: "available" | "called" | undefined;
9689
+ } | undefined;
9651
9690
  includeRawChunks?: boolean | undefined;
9652
9691
  } | {
9653
9692
  value: {
@@ -9681,7 +9720,10 @@ export declare const GET_AGENT_VERSION_ROUTE: ServerRoute<{
9681
9720
  } | undefined;
9682
9721
  requireToolApproval?: boolean | undefined;
9683
9722
  autoResumeSuspendedTools?: boolean | undefined;
9684
- toolCallConcurrency?: number | undefined;
9723
+ toolCallConcurrency?: number | {
9724
+ limit?: number | undefined;
9725
+ strategy?: "available" | "called" | undefined;
9726
+ } | undefined;
9685
9727
  includeRawChunks?: boolean | undefined;
9686
9728
  };
9687
9729
  rules?: {
@@ -11267,7 +11309,13 @@ export declare const GET_AGENT_VERSION_ROUTE: ServerRoute<{
11267
11309
  }, z.core.$strip>>;
11268
11310
  requireToolApproval: z.ZodOptional<z.ZodBoolean>;
11269
11311
  autoResumeSuspendedTools: z.ZodOptional<z.ZodBoolean>;
11270
- toolCallConcurrency: z.ZodOptional<z.ZodNumber>;
11312
+ toolCallConcurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
11313
+ limit: z.ZodOptional<z.ZodNumber>;
11314
+ strategy: z.ZodOptional<z.ZodEnum<{
11315
+ available: "available";
11316
+ called: "called";
11317
+ }>>;
11318
+ }, z.core.$strip>]>>;
11271
11319
  includeRawChunks: z.ZodOptional<z.ZodBoolean>;
11272
11320
  }, z.core.$loose>, z.ZodArray<z.ZodObject<{
11273
11321
  value: z.ZodObject<{
@@ -11300,7 +11348,13 @@ export declare const GET_AGENT_VERSION_ROUTE: ServerRoute<{
11300
11348
  }, z.core.$strip>>;
11301
11349
  requireToolApproval: z.ZodOptional<z.ZodBoolean>;
11302
11350
  autoResumeSuspendedTools: z.ZodOptional<z.ZodBoolean>;
11303
- toolCallConcurrency: z.ZodOptional<z.ZodNumber>;
11351
+ toolCallConcurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
11352
+ limit: z.ZodOptional<z.ZodNumber>;
11353
+ strategy: z.ZodOptional<z.ZodEnum<{
11354
+ available: "available";
11355
+ called: "called";
11356
+ }>>;
11357
+ }, z.core.$strip>]>>;
11304
11358
  includeRawChunks: z.ZodOptional<z.ZodBoolean>;
11305
11359
  }, z.core.$loose>;
11306
11360
  rules: z.ZodOptional<z.ZodObject<{
@@ -14369,7 +14423,10 @@ export declare const RESTORE_AGENT_VERSION_ROUTE: ServerRoute<{
14369
14423
  } | undefined;
14370
14424
  requireToolApproval?: boolean | undefined;
14371
14425
  autoResumeSuspendedTools?: boolean | undefined;
14372
- toolCallConcurrency?: number | undefined;
14426
+ toolCallConcurrency?: number | {
14427
+ limit?: number | undefined;
14428
+ strategy?: "available" | "called" | undefined;
14429
+ } | undefined;
14373
14430
  includeRawChunks?: boolean | undefined;
14374
14431
  } | {
14375
14432
  value: {
@@ -14403,7 +14460,10 @@ export declare const RESTORE_AGENT_VERSION_ROUTE: ServerRoute<{
14403
14460
  } | undefined;
14404
14461
  requireToolApproval?: boolean | undefined;
14405
14462
  autoResumeSuspendedTools?: boolean | undefined;
14406
- toolCallConcurrency?: number | undefined;
14463
+ toolCallConcurrency?: number | {
14464
+ limit?: number | undefined;
14465
+ strategy?: "available" | "called" | undefined;
14466
+ } | undefined;
14407
14467
  includeRawChunks?: boolean | undefined;
14408
14468
  };
14409
14469
  rules?: {
@@ -15989,7 +16049,13 @@ export declare const RESTORE_AGENT_VERSION_ROUTE: ServerRoute<{
15989
16049
  }, z.core.$strip>>;
15990
16050
  requireToolApproval: z.ZodOptional<z.ZodBoolean>;
15991
16051
  autoResumeSuspendedTools: z.ZodOptional<z.ZodBoolean>;
15992
- toolCallConcurrency: z.ZodOptional<z.ZodNumber>;
16052
+ toolCallConcurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
16053
+ limit: z.ZodOptional<z.ZodNumber>;
16054
+ strategy: z.ZodOptional<z.ZodEnum<{
16055
+ available: "available";
16056
+ called: "called";
16057
+ }>>;
16058
+ }, z.core.$strip>]>>;
15993
16059
  includeRawChunks: z.ZodOptional<z.ZodBoolean>;
15994
16060
  }, z.core.$loose>, z.ZodArray<z.ZodObject<{
15995
16061
  value: z.ZodObject<{
@@ -16022,7 +16088,13 @@ export declare const RESTORE_AGENT_VERSION_ROUTE: ServerRoute<{
16022
16088
  }, z.core.$strip>>;
16023
16089
  requireToolApproval: z.ZodOptional<z.ZodBoolean>;
16024
16090
  autoResumeSuspendedTools: z.ZodOptional<z.ZodBoolean>;
16025
- toolCallConcurrency: z.ZodOptional<z.ZodNumber>;
16091
+ toolCallConcurrency: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
16092
+ limit: z.ZodOptional<z.ZodNumber>;
16093
+ strategy: z.ZodOptional<z.ZodEnum<{
16094
+ available: "available";
16095
+ called: "called";
16096
+ }>>;
16097
+ }, z.core.$strip>]>>;
16026
16098
  includeRawChunks: z.ZodOptional<z.ZodBoolean>;
16027
16099
  }, z.core.$loose>;
16028
16100
  rules: z.ZodOptional<z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"agent-versions.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/agent-versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EACL,sBAAsB,EAItB,0BAA0B,EAO1B,6BAA6B,EAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAwCvF;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFAiGtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;4EA2DrC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CACpD,WAAW,CAAC,OAAO,sBAAsB,EAAE,OAAO,0BAA0B,EAAE,SAAS,CAAC,EACxF,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,EAC7C,MAAM,EACN,YAAY,CACV,OAAO,sBAAsB,EAC7B,OAAO,0BAA0B,EACjC,SAAS,EACT,OAAO,6BAA6B,CACrC,EACD,KAAK,EACL,0CAA0C,CAkE1C,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { t as HTTPException } from "../../http-exception-CyfxZB6W.js";
2
- import { n as createRoute } from "../../route-builder-CIk5k35M.js";
3
- import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-BUK03Frl.js";
2
+ import { n as createRoute } from "../../route-builder-CQkb7tQY.js";
3
+ import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-QXKhjIm6.js";
4
4
  import { handleError } from "./error.js";
5
- import { a as createVersionBodySchema, n as compareVersionsQuerySchema, o as deleteVersionResponseSchema, s as listVersionsQuerySchema, t as activateVersionResponseSchema } from "../../version-common-Cmd1f9JX.js";
6
- import { a as getVersionResponseSchema, c as versionIdPathParams, i as createVersionResponseSchema, o as listVersionsResponseSchema, r as compareVersionsResponseSchema, s as restoreVersionResponseSchema, t as agentVersionPathParams } from "../../agent-versions-Bsrpa_zb.js";
5
+ import { a as createVersionBodySchema, n as compareVersionsQuerySchema, o as deleteVersionResponseSchema, s as listVersionsQuerySchema, t as activateVersionResponseSchema } from "../../version-common-CudZ_WuW.js";
6
+ import { a as getVersionResponseSchema, c as versionIdPathParams, i as createVersionResponseSchema, o as listVersionsResponseSchema, r as compareVersionsResponseSchema, s as restoreVersionResponseSchema, t as agentVersionPathParams } from "../../agent-versions-CWEnD62A.js";
7
+ import { validateAgentInstructionReferences } from "./validate-agent-instructions.js";
7
8
  import { calculateChangedFields, computeVersionDiffs, createVersionWithRetry, enforceRetentionLimit, extractConfigFromVersion } from "./version-helpers.js";
8
9
  //#region src/server/handlers/agent-versions.ts
9
10
  /**
@@ -161,6 +162,11 @@ const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({
161
162
  const version = await agentsStore.getVersion(versionId);
162
163
  if (!version) throw new HTTPException(404, { message: `Version with id ${versionId} not found` });
163
164
  if (version.agentId !== agentId) throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });
165
+ await validateAgentInstructionReferences({
166
+ instructions: version.instructions,
167
+ mastra,
168
+ requestContext
169
+ });
164
170
  await agentsStore.update({
165
171
  id: agentId,
166
172
  activeVersionId: versionId,
@@ -1 +1 @@
1
- {"version":3,"file":"agent-versions.js","names":[],"sources":["../../../src/server/handlers/agent-versions.ts"],"sourcesContent":["import type { z } from 'zod/v4';\n\nimport { HTTPException } from '../http-exception';\nimport {\n agentVersionPathParams,\n versionIdPathParams,\n listVersionsQuerySchema,\n createVersionBodySchema,\n compareVersionsQuerySchema,\n listVersionsResponseSchema,\n getVersionResponseSchema,\n createVersionResponseSchema,\n activateVersionResponseSchema,\n restoreVersionResponseSchema,\n deleteVersionResponseSchema,\n compareVersionsResponseSchema,\n} from '../schemas/agent-versions';\nimport type { ServerRoute, RouteSchemas, InferParams } from '../server-adapter/routes';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * The config field names that live on version rows (StorageAgentSnapshotType fields).\n * Used to extract config from a version record for comparison and restoration.\n */\nconst SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'instructions',\n 'model',\n 'tools',\n 'defaultOptions',\n 'workflows',\n 'agents',\n 'integrationTools',\n 'inputProcessors',\n 'outputProcessors',\n 'memory',\n 'scorers',\n 'requestContextSchema',\n 'mcpClients',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/agents/:agentId/versions - List all versions for an agent\n */\nexport const LIST_AGENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: listVersionsQuerySchema,\n responseSchema: listVersionsResponseSchema,\n summary: 'List agent versions',\n description: 'Returns a paginated list of all versions for a stored agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists in code or storage\n const storedAgent = await agentsStore.getById(agentId);\n let codeAgentExists = false;\n try {\n mastra.getAgentById(agentId);\n codeAgentExists = true;\n } catch {\n // Agent not registered in code\n }\n\n if (!storedAgent && !codeAgentExists) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(storedAgent, await getStoredResourceScope(mastra, requestContext));\n\n const result = await agentsStore.listVersions({\n agentId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing agent versions');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions - Create a new version snapshot\n */\nexport const CREATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n bodySchema: createVersionBodySchema,\n responseSchema: createVersionResponseSchema,\n summary: 'Create agent version',\n description: 'Creates a new version snapshot of the current agent configuration',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Get the current agent to find its active version\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the current active version to snapshot its config\n let currentConfig: Record<string, unknown> = {};\n if (agent.activeVersionId) {\n const activeVersion = await agentsStore.getVersion(agent.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n\n // If no activeVersionId, fall back to latest version config\n if (!agent.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n // Create the new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n // Get the created version to return\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/:versionId - Get a specific version\n */\nexport const GET_AGENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: getVersionResponseSchema,\n summary: 'Get agent version',\n description: 'Returns a specific version of an agent by its version ID',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n const version = await agentsStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n // Verify the version belongs to the specified agent\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: activateVersionResponseSchema,\n summary: 'Activate agent version',\n description: 'Sets a specific version as the active version for the agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Update the agent's activeVersionId AND status to 'published'\n await agentsStore.update({\n id: agentId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/restore - Restore agent to a version\n */\nexport const RESTORE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: restoreVersionResponseSchema,\n summary: 'Restore agent version',\n description: 'Restores the agent configuration from a version, creating a new version',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the version to restore\n const versionToRestore = await agentsStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Extract the config fields from the version to restore (top-level, no .snapshot)\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Update the agent with the config from the version to restore\n await agentsStore.update({\n id: agentId,\n ...restoredConfig,\n });\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n // Create a new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId: newVersionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n // Do NOT auto-activate the restored version - user must explicitly activate it\n\n // Get the created version to return\n const newVersion = await agentsStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n // Use the agent's existing activeVersionId\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the restored config\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring agent version');\n }\n },\n});\n\n/**\n * DELETE /stored/agents/:agentId/versions/:versionId - Delete a version\n */\nexport const DELETE_AGENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: deleteVersionResponseSchema,\n summary: 'Delete agent version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Check if this is the active version\n if (agent.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await agentsStore.deleteVersion(versionId);\n\n // Clear the editor cache in case the deleted version affected resolution\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/compare - Compare two versions\n */\nexport const COMPARE_AGENT_VERSIONS_ROUTE: ServerRoute<\n InferParams<typeof agentVersionPathParams, typeof compareVersionsQuerySchema, undefined>,\n z.infer<typeof compareVersionsResponseSchema>,\n 'json',\n RouteSchemas<\n typeof agentVersionPathParams,\n typeof compareVersionsQuerySchema,\n undefined,\n typeof compareVersionsResponseSchema\n >,\n 'GET',\n '/stored/agents/:agentId/versions/compare'\n> = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: compareVersionsQuerySchema,\n responseSchema: compareVersionsResponseSchema,\n summary: 'Compare agent versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get both versions\n const fromVersion = await agentsStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${from} not found for agent ${agentId}` });\n }\n\n const toVersion = await agentsStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${to} not found for agent ${agentId}` });\n }\n\n // Extract config fields from both versions (top-level, no .snapshot)\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Compute diffs on the config fields\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error, 'Error comparing agent versions');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;AAmCA,MAAM,yBAAyB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;AASA,MAAa,4BAA4B,YAAY;CACnD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,gBAAgB;CACvB,SAAS,OAAO,EAAE,QAAQ,SAAS,MAAM,SAAS,SAAS,qBAAqB;EAC9E,IAAI;GACF,MAAM,UAAU,OAAO,WAAW;GAElC,IAAI,CAAC,SACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,4BAA4B,CAAC;GAGvE,MAAM,cAAc,MAAM,QAAQ,SAAS,QAAQ;GACnD,IAAI,CAAC,aACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,yCAAyC,CAAC;GAIpF,MAAM,cAAc,MAAM,YAAY,QAAQ,OAAO;GACrD,IAAI,kBAAkB;GACtB,IAAI;IACF,OAAO,aAAa,OAAO;IAC3B,kBAAkB;GACpB,QAAQ,CAER;GAEA,IAAI,CAAC,eAAe,CAAC,iBACnB,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,iBAAiB,QAAQ,YAAY,CAAC;GA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AAc;CACd,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,gBAAgB;CACvB,SAAS,OAAO,EAAE,QAAQ,SAAS,MAAM,IAAI,qBAAqB;EAChE,IAAI;GACF,MAAM,UAAU,OAAO,WAAW;GAElC,IAAI,CAAC,SACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,4BAA4B,CAAC;GAGvE,MAAM,cAAc,MAAM,QAAQ,SAAS,QAAQ;GACnD,IAAI,CAAC,aACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,yCAAyC,CAAC;GAGpF,0BAA0B,MADN,YAAY,QAAQ,OAAO,GACd,MAAM,uBAAuB,QAAQ,cAAc,CAAC;GAGrF,MAAM,cAAc,MAAM,YAAY,WAAW,IAAI;GACrD,IAAI,CAAC,aACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,KAAK,YAAY,CAAC;GAE/E,IAAI,YAAY,YAAY,SAC1B,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,KAAK,uBAAuB,UAAU,CAAC;GAGpG,MAAM,YAAY,MAAM,YAAY,WAAW,EAAE;GACjD,IAAI,CAAC,WACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,YAAY,CAAC;GAE7E,IAAI,UAAU,YAAY,SACxB,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,mBAAmB,GAAG,uBAAuB,UAAU,CAAC;GAgBlG,OAAO;IACL,OAHY,oBAVK,yBACjB,aACA,sBAQyC,GAN1B,yBACf,WACA,sBAImD,CAG/C;IACJ;IACA;GACF;EACF,SAAS,OAAO;GACd,OAAO,YAAY,OAAO,gCAAgC;EAC5D;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"agent-versions.js","names":[],"sources":["../../../src/server/handlers/agent-versions.ts"],"sourcesContent":["import type { z } from 'zod/v4';\n\nimport { HTTPException } from '../http-exception';\nimport {\n agentVersionPathParams,\n versionIdPathParams,\n listVersionsQuerySchema,\n createVersionBodySchema,\n compareVersionsQuerySchema,\n listVersionsResponseSchema,\n getVersionResponseSchema,\n createVersionResponseSchema,\n activateVersionResponseSchema,\n restoreVersionResponseSchema,\n deleteVersionResponseSchema,\n compareVersionsResponseSchema,\n} from '../schemas/agent-versions';\nimport type { ServerRoute, RouteSchemas, InferParams } from '../server-adapter/routes';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { handleError } from './error';\nimport { validateAgentInstructionReferences } from './validate-agent-instructions';\nimport {\n extractConfigFromVersion,\n calculateChangedFields,\n computeVersionDiffs,\n createVersionWithRetry,\n enforceRetentionLimit,\n} from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\n/**\n * The config field names that live on version rows (StorageAgentSnapshotType fields).\n * Used to extract config from a version record for comparison and restoration.\n */\nconst SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'instructions',\n 'model',\n 'tools',\n 'defaultOptions',\n 'workflows',\n 'agents',\n 'integrationTools',\n 'inputProcessors',\n 'outputProcessors',\n 'memory',\n 'scorers',\n 'requestContextSchema',\n 'mcpClients',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/agents/:agentId/versions - List all versions for an agent\n */\nexport const LIST_AGENT_VERSIONS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: listVersionsQuerySchema,\n responseSchema: listVersionsResponseSchema,\n summary: 'List agent versions',\n description: 'Returns a paginated list of all versions for a stored agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, page, perPage, orderBy, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists in code or storage\n const storedAgent = await agentsStore.getById(agentId);\n let codeAgentExists = false;\n try {\n mastra.getAgentById(agentId);\n codeAgentExists = true;\n } catch {\n // Agent not registered in code\n }\n\n if (!storedAgent && !codeAgentExists) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(storedAgent, await getStoredResourceScope(mastra, requestContext));\n\n const result = await agentsStore.listVersions({\n agentId,\n page,\n perPage,\n orderBy,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing agent versions');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions - Create a new version snapshot\n */\nexport const CREATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n bodySchema: createVersionBodySchema,\n responseSchema: createVersionResponseSchema,\n summary: 'Create agent version',\n description: 'Creates a new version snapshot of the current agent configuration',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, changeMessage, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Get the current agent to find its active version\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the current active version to snapshot its config\n let currentConfig: Record<string, unknown> = {};\n if (agent.activeVersionId) {\n const activeVersion = await agentsStore.getVersion(agent.activeVersionId);\n if (activeVersion) {\n currentConfig = extractConfigFromVersion(\n activeVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n }\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n\n // If no activeVersionId, fall back to latest version config\n if (!agent.activeVersionId && latestVersion) {\n currentConfig = extractConfigFromVersion(\n latestVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n }\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, currentConfig);\n\n // Create the new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n currentConfig,\n changedFields,\n { changeMessage },\n );\n\n // Get the created version to return\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n return version;\n } catch (error) {\n return handleError(error, 'Error creating agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/:versionId - Get a specific version\n */\nexport const GET_AGENT_VERSION_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: getVersionResponseSchema,\n summary: 'Get agent version',\n description: 'Returns a specific version of an agent by its version ID',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n const version = await agentsStore.getVersion(versionId);\n\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n\n // Verify the version belongs to the specified agent\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n return version;\n } catch (error) {\n return handleError(error, 'Error getting agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/activate - Set a version as active\n */\nexport const ACTIVATE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/activate',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: activateVersionResponseSchema,\n summary: 'Activate agent version',\n description: 'Sets a specific version as the active version for the agent',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n await validateAgentInstructionReferences({\n instructions: version.instructions,\n mastra,\n requestContext,\n });\n\n // Update the agent's activeVersionId AND status to 'published'\n await agentsStore.update({\n id: agentId,\n activeVersionId: versionId,\n status: 'published',\n });\n\n // Clear the editor cache so subsequent requests see the new active version\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} is now active`,\n activeVersionId: versionId,\n };\n } catch (error) {\n return handleError(error, 'Error activating agent version');\n }\n },\n});\n\n/**\n * POST /stored/agents/:agentId/versions/:versionId/restore - Restore agent to a version\n */\nexport const RESTORE_AGENT_VERSION_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/agents/:agentId/versions/:versionId/restore',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: restoreVersionResponseSchema,\n summary: 'Restore agent version',\n description: 'Restores the agent configuration from a version, creating a new version',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get the version to restore\n const versionToRestore = await agentsStore.getVersion(versionId);\n if (!versionToRestore) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (versionToRestore.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Extract the config fields from the version to restore (top-level, no .snapshot)\n const restoredConfig = extractConfigFromVersion(\n versionToRestore as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Update the agent with the config from the version to restore\n await agentsStore.update({\n id: agentId,\n ...restoredConfig,\n });\n\n // Get the latest version to calculate changed fields\n const latestVersion = await agentsStore.getLatestVersion(agentId);\n const previousConfig = latestVersion\n ? extractConfigFromVersion(latestVersion as unknown as Record<string, unknown>, SNAPSHOT_CONFIG_FIELDS)\n : null;\n\n const changedFields = calculateChangedFields(previousConfig, restoredConfig);\n\n // Create a new version with retry logic to handle race conditions\n // Config fields are passed top-level\n const { versionId: newVersionId } = await createVersionWithRetry(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n restoredConfig,\n changedFields,\n {\n changeMessage: `Restored from version ${versionToRestore.versionNumber}`,\n },\n );\n\n // Do NOT auto-activate the restored version - user must explicitly activate it\n\n // Get the created version to return\n const newVersion = await agentsStore.getVersion(newVersionId);\n if (!newVersion) {\n throw new HTTPException(500, { message: 'Failed to retrieve created version' });\n }\n\n // Enforce retention limit - delete oldest versions if we exceed the max\n // Use the agent's existing activeVersionId\n await enforceRetentionLimit(\n agentsStore as unknown as VersionedStoreInterface,\n agentId,\n 'agentId',\n agent.activeVersionId,\n );\n\n // Clear the editor cache so subsequent requests see the restored config\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return newVersion;\n } catch (error) {\n return handleError(error, 'Error restoring agent version');\n }\n },\n});\n\n/**\n * DELETE /stored/agents/:agentId/versions/:versionId - Delete a version\n */\nexport const DELETE_AGENT_VERSION_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/agents/:agentId/versions/:versionId',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: versionIdPathParams,\n responseSchema: deleteVersionResponseSchema,\n summary: 'Delete agent version',\n description: 'Deletes a specific version (cannot delete the active version)',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, versionId, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n\n // Verify agent exists\n const agent = await agentsStore.getById(agentId);\n if (!agent) {\n throw new HTTPException(404, { message: `Agent with id ${agentId} not found` });\n }\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Verify version exists and belongs to this agent\n const version = await agentsStore.getVersion(versionId);\n if (!version) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n }\n if (version.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${versionId} not found for agent ${agentId}` });\n }\n\n // Check if this is the active version\n if (agent.activeVersionId === versionId) {\n throw new HTTPException(400, {\n message: 'Cannot delete the active version. Activate a different version first.',\n });\n }\n\n await agentsStore.deleteVersion(versionId);\n\n // Clear the editor cache in case the deleted version affected resolution\n mastra.getEditor()?.agent.clearCache(agentId);\n\n return {\n success: true,\n message: `Version ${version.versionNumber} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting agent version');\n }\n },\n});\n\n/**\n * GET /stored/agents/:agentId/versions/compare - Compare two versions\n */\nexport const COMPARE_AGENT_VERSIONS_ROUTE: ServerRoute<\n InferParams<typeof agentVersionPathParams, typeof compareVersionsQuerySchema, undefined>,\n z.infer<typeof compareVersionsResponseSchema>,\n 'json',\n RouteSchemas<\n typeof agentVersionPathParams,\n typeof compareVersionsQuerySchema,\n undefined,\n typeof compareVersionsResponseSchema\n >,\n 'GET',\n '/stored/agents/:agentId/versions/compare'\n> = createRoute({\n method: 'GET',\n path: '/stored/agents/:agentId/versions/compare',\n requiresAuth: true,\n responseType: 'json',\n pathParamSchema: agentVersionPathParams,\n queryParamSchema: compareVersionsQuerySchema,\n responseSchema: compareVersionsResponseSchema,\n summary: 'Compare agent versions',\n description: 'Compares two versions and returns the differences between them',\n tags: ['Agent Versions'],\n handler: async ({ mastra, agentId, from, to, requestContext }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const agentsStore = await storage.getStore('agents');\n if (!agentsStore) {\n throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n }\n const agent = await agentsStore.getById(agentId);\n assertStoredResourceScope(agent, await getStoredResourceScope(mastra, requestContext));\n\n // Get both versions\n const fromVersion = await agentsStore.getVersion(from);\n if (!fromVersion) {\n throw new HTTPException(404, { message: `Version with id ${from} not found` });\n }\n if (fromVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${from} not found for agent ${agentId}` });\n }\n\n const toVersion = await agentsStore.getVersion(to);\n if (!toVersion) {\n throw new HTTPException(404, { message: `Version with id ${to} not found` });\n }\n if (toVersion.agentId !== agentId) {\n throw new HTTPException(404, { message: `Version with id ${to} not found for agent ${agentId}` });\n }\n\n // Extract config fields from both versions (top-level, no .snapshot)\n const fromConfig = extractConfigFromVersion(\n fromVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n const toConfig = extractConfigFromVersion(\n toVersion as unknown as Record<string, unknown>,\n SNAPSHOT_CONFIG_FIELDS,\n );\n\n // Compute diffs on the config fields\n const diffs = computeVersionDiffs(fromConfig, toConfig);\n\n return {\n diffs,\n fromVersion,\n toVersion,\n };\n } catch (error) {\n return handleError(error, 'Error comparing agent versions');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;AAoCA,MAAM,yBAAyB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;AASA,MAAa,4BAA4B,YAAY;CACnD,QAAQ;CACR,MAAM;CACN,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,gBAAgB;CACvB,SAAS,OAAO,EAAE,QAAQ,SAAS,MAAM,SAAS,SAAS,qBAAqB;EAC9E,IAAI;GACF,MAAM,UAAU,OAAO,WAAW;GAElC,IAAI,CAAC,SACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,4BAA4B,CAAC;GAGvE,MAAM,cAAc,MAAM,QAAQ,SAAS,QAAQ;GACnD,IAAI,CAAC,aACH,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,yCAAyC,CAAC;GAIpF,MAAM,cAAc,MAAM,YAAY,QAAQ,OAAO;GACrD,IAAI,kBAAkB;GACtB,IAAI;IACF,OAAO,aAAa,OAAO;IAC3B,kBAAkB;GACpB,QAAQ,CAER;GAEA,IAAI,C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