@mastra/server 1.83.0-alpha.9 → 1.84.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (667) hide show
  1. package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/@internal_core@0.1.4/dist/request-context/index.d.ts +19 -0
  2. package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/provider-compats/anthropic.d.ts +1 -1
  3. package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/provider-compats/deepseek.d.ts +1 -1
  4. package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/provider-compats/meta.d.ts +1 -1
  5. package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/schema.types.d.ts +3 -3
  6. package/dist/{a2a-DIcMx6x-.cjs → a2a-Bz7vRGfF.cjs} +9 -6
  7. package/dist/a2a-Bz7vRGfF.cjs.map +1 -0
  8. package/dist/{a2a-DTTGA2Xg.js → a2a-CY85JalK.js} +9 -6
  9. package/dist/a2a-CY85JalK.js.map +1 -0
  10. package/dist/{agent-builder-DtBRYFZ3.js → agent-builder-Ce1pjSjg.js} +6 -6
  11. package/dist/{agent-builder-DtBRYFZ3.js.map → agent-builder-Ce1pjSjg.js.map} +1 -1
  12. package/dist/{agent-builder-BXBfs0w4.cjs → agent-builder-DWtgp1cb.cjs} +6 -6
  13. package/dist/{agent-builder-BXBfs0w4.cjs.map → agent-builder-DWtgp1cb.cjs.map} +1 -1
  14. package/dist/{agents-BCgiMlDq.js → agents-B0OpLdbp.js} +444 -3
  15. package/dist/agents-B0OpLdbp.js.map +1 -0
  16. package/dist/{agents-DjpBmwhv.cjs → agents-BgaBbcwb.cjs} +136 -53
  17. package/dist/agents-BgaBbcwb.cjs.map +1 -0
  18. package/dist/{agents-CTgjTASj.js → agents-BjlUjmb1.js} +136 -53
  19. package/dist/agents-BjlUjmb1.js.map +1 -0
  20. package/dist/{agents-CjcvdF2e.cjs → agents-CH_G37hG.cjs} +521 -2
  21. package/dist/agents-CH_G37hG.cjs.map +1 -0
  22. package/dist/{api-schema-manifest-B8s3TuPU.js → api-schema-manifest-CsTpd03O.js} +9 -9
  23. package/dist/api-schema-manifest-CsTpd03O.js.map +1 -0
  24. package/dist/{api-schema-manifest-Czr4Bmrw.cjs → api-schema-manifest-DT9X0fAm.cjs} +9 -9
  25. package/dist/api-schema-manifest-DT9X0fAm.cjs.map +1 -0
  26. package/dist/{background-tasks-CYvlxFz3.js → background-tasks-BKnoXtUN.js} +3 -3
  27. package/dist/{background-tasks-CYvlxFz3.js.map → background-tasks-BKnoXtUN.js.map} +1 -1
  28. package/dist/{background-tasks-Dv9o8cR7.cjs → background-tasks-BqW1_VmH.cjs} +3 -3
  29. package/dist/{background-tasks-Dv9o8cR7.cjs.map → background-tasks-BqW1_VmH.cjs.map} +1 -1
  30. package/dist/{builder-registry-BmrttdGj.js → builder-registry-ByghMyfA.js} +3 -3
  31. package/dist/{builder-registry-BmrttdGj.js.map → builder-registry-ByghMyfA.js.map} +1 -1
  32. package/dist/{builder-registry-CmbtZzbE.cjs → builder-registry-DPsdmtZG.cjs} +3 -3
  33. package/dist/{builder-registry-CmbtZzbE.cjs.map → builder-registry-DPsdmtZG.cjs.map} +1 -1
  34. package/dist/catalogue-CGQdyojN.cjs +1378 -0
  35. package/dist/catalogue-CGQdyojN.cjs.map +1 -0
  36. package/dist/catalogue-CUJevxy3.js +1376 -0
  37. package/dist/catalogue-CUJevxy3.js.map +1 -0
  38. package/dist/{channels-KHhb7hAm.js → channels-DIE-lJkq.js} +3 -3
  39. package/dist/{channels-KHhb7hAm.js.map → channels-DIE-lJkq.js.map} +1 -1
  40. package/dist/{channels-CXwFVxi2.cjs → channels-k5dF1IBc.cjs} +3 -3
  41. package/dist/{channels-CXwFVxi2.cjs.map → channels-k5dF1IBc.cjs.map} +1 -1
  42. package/dist/{constants-CXAvBYcz.js → constants-0xZU_h4R.js} +10 -2
  43. package/dist/constants-0xZU_h4R.js.map +1 -0
  44. package/dist/{constants-DMg8hUOR.cjs → constants-1yTmKUZD.cjs} +15 -1
  45. package/dist/constants-1yTmKUZD.cjs.map +1 -0
  46. package/dist/{conversations-BFqmDglO.cjs → conversations-Bvk5VVVJ.cjs} +6 -5
  47. package/dist/conversations-Bvk5VVVJ.cjs.map +1 -0
  48. package/dist/{conversations-BkX00xDs.js → conversations-DYqwqCWH.js} +6 -5
  49. package/dist/conversations-DYqwqCWH.js.map +1 -0
  50. package/dist/{datasets--F0QkdGX.js → datasets-C1XJLHN8.js} +6 -1
  51. package/dist/datasets-C1XJLHN8.js.map +1 -0
  52. package/dist/{datasets-BiEAIm0s.cjs → datasets-hqDd4IUN.cjs} +6 -1
  53. package/dist/datasets-hqDd4IUN.cjs.map +1 -0
  54. package/dist/dist-BVw6-hMs.js +1 -0
  55. package/dist/{dist-DHiTIWvp.js → dist-C-Hmkkat.js} +7 -7
  56. package/dist/{dist-DHiTIWvp.js.map → dist-C-Hmkkat.js.map} +1 -1
  57. package/dist/{dist-DLzcAC-F.cjs → dist-Clh3uSOV.cjs} +12 -12
  58. package/dist/{dist-DLzcAC-F.cjs.map → dist-Clh3uSOV.cjs.map} +1 -1
  59. package/dist/{dist-BRBLnUAY.cjs → dist-DPgpEz_7.cjs} +1 -1
  60. package/dist/docs/SKILL.md +4 -1
  61. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  62. package/dist/docs/references/docs-server-mcp.md +347 -0
  63. package/dist/docs/references/docs-server-server-adapters.md +2 -0
  64. package/dist/docs/references/reference-observability-tracing-advanced-queries.md +2 -1
  65. package/dist/docs/references/reference-server-builtin-mcp-tools.md +135 -0
  66. package/dist/docs/references/reference-server-dispatch-route.md +124 -0
  67. package/dist/docs/references/reference-server-invoke-route.md +10 -0
  68. package/dist/{dynamic-workflows-QgKLYkiC.cjs → dynamic-workflows-DPgV6qtS.cjs} +2 -2
  69. package/dist/{dynamic-workflows-QgKLYkiC.cjs.map → dynamic-workflows-DPgV6qtS.cjs.map} +1 -1
  70. package/dist/{dynamic-workflows-CYtakeIQ.js → dynamic-workflows-DmkCJ4Lp.js} +2 -2
  71. package/dist/{dynamic-workflows-CYtakeIQ.js.map → dynamic-workflows-DmkCJ4Lp.js.map} +1 -1
  72. package/dist/{editor-builder-C4H2l6tz.js → editor-builder-CGM0scw2.js} +10 -4
  73. package/dist/editor-builder-CGM0scw2.js.map +1 -0
  74. package/dist/{editor-builder-fe70YP8g.js → editor-builder-CXLdplIj.js} +2 -2
  75. package/dist/{editor-builder-fe70YP8g.js.map → editor-builder-CXLdplIj.js.map} +1 -1
  76. package/dist/{editor-builder-Cqw1npOK.cjs → editor-builder-SP_ledm3.cjs} +10 -4
  77. package/dist/editor-builder-SP_ledm3.cjs.map +1 -0
  78. package/dist/{editor-builder-xQmDgVgJ.cjs → editor-builder-eF2IetF2.cjs} +2 -2
  79. package/dist/{editor-builder-xQmDgVgJ.cjs.map → editor-builder-eF2IetF2.cjs.map} +1 -1
  80. package/dist/{helpers-C9QZKOhz.js → helpers-B56oH6qp.js} +27 -8
  81. package/dist/helpers-B56oH6qp.js.map +1 -0
  82. package/dist/{helpers-0LJI4DxR.cjs → helpers-Dpdta8ai.cjs} +31 -6
  83. package/dist/helpers-Dpdta8ai.cjs.map +1 -0
  84. package/dist/{knowledge-CRkWkTBC.cjs → knowledge-2fms70NN.cjs} +4 -4
  85. package/dist/{knowledge-CRkWkTBC.cjs.map → knowledge-2fms70NN.cjs.map} +1 -1
  86. package/dist/{knowledge-Dfe_CFtt.js → knowledge-BblTTH3z.js} +4 -4
  87. package/dist/{knowledge-Dfe_CFtt.js.map → knowledge-BblTTH3z.js.map} +1 -1
  88. package/dist/{logs-Dg2AWexF.js → logs-D_hKQuvQ.js} +3 -3
  89. package/dist/{logs-Dg2AWexF.js.map → logs-D_hKQuvQ.js.map} +1 -1
  90. package/dist/{logs-B2ov1yZQ.cjs → logs-Deoh0l4I.cjs} +3 -3
  91. package/dist/{logs-B2ov1yZQ.cjs.map → logs-Deoh0l4I.cjs.map} +1 -1
  92. package/dist/{mcp-bsPRIGFX.js → mcp-CSRuYaWN.js} +3 -3
  93. package/dist/{mcp-bsPRIGFX.js.map → mcp-CSRuYaWN.js.map} +1 -1
  94. package/dist/{mcp-Bon4eIV1.cjs → mcp-oWjcmsQb.cjs} +3 -3
  95. package/dist/{mcp-Bon4eIV1.cjs.map → mcp-oWjcmsQb.cjs.map} +1 -1
  96. package/dist/{memory-Dw7xG5nn.js → memory-CGlo-6_V.js} +105 -12
  97. package/dist/memory-CGlo-6_V.js.map +1 -0
  98. package/dist/{memory-BRE3ofvI.cjs → memory-CzSke9Em.cjs} +105 -12
  99. package/dist/memory-CzSke9Em.cjs.map +1 -0
  100. package/dist/{observability-DHJ7mzoE.cjs → observability-BCJsmSH0.cjs} +27 -3
  101. package/dist/observability-BCJsmSH0.cjs.map +1 -0
  102. package/dist/{observability-BYIy4kPf.js → observability-Z2tDxHS1.js} +27 -3
  103. package/dist/observability-Z2tDxHS1.js.map +1 -0
  104. package/dist/{observability-new-endpoints-BOe3wej1.cjs → observability-new-endpoints-C_HEkpZ1.cjs} +157 -5
  105. package/dist/observability-new-endpoints-C_HEkpZ1.cjs.map +1 -0
  106. package/dist/{observability-new-endpoints-COy7lpeR.js → observability-new-endpoints-dr0XcNkP.js} +158 -6
  107. package/dist/observability-new-endpoints-dr0XcNkP.js.map +1 -0
  108. package/dist/{plans-D_GKFz2x.js → plans-BemJO4-7.js} +7 -6
  109. package/dist/plans-BemJO4-7.js.map +1 -0
  110. package/dist/{plans-_nR8lqgD.cjs → plans-CffjV2_6.cjs} +7 -6
  111. package/dist/plans-CffjV2_6.cjs.map +1 -0
  112. package/dist/{probe-image-size-DbJ3ZfUz.js → probe-image-size-jA5gozO6.js} +2 -2
  113. package/dist/{probe-image-size-DbJ3ZfUz.js.map → probe-image-size-jA5gozO6.js.map} +1 -1
  114. package/dist/{probe-image-size-CN-PYGus.cjs → probe-image-size-qOT5Pn0l.cjs} +2 -2
  115. package/dist/{probe-image-size-CN-PYGus.cjs.map → probe-image-size-qOT5Pn0l.cjs.map} +1 -1
  116. package/dist/{responses-C_OEJoxU.js → responses-BofWEQYg.js} +11 -8
  117. package/dist/responses-BofWEQYg.js.map +1 -0
  118. package/dist/{responses-CdWbS4jA.cjs → responses-D0mb5ubj.cjs} +11 -8
  119. package/dist/responses-D0mb5ubj.cjs.map +1 -0
  120. package/dist/{route-builder-B9C5vT54.cjs → route-builder-DjTBxSZN.cjs} +10 -10
  121. package/dist/{route-builder-B9C5vT54.cjs.map → route-builder-DjTBxSZN.cjs.map} +1 -1
  122. package/dist/{route-builder-DfDT1g4L.js → route-builder-Dz18c3qm.js} +9 -9
  123. package/dist/{route-builder-DfDT1g4L.js.map → route-builder-Dz18c3qm.js.map} +1 -1
  124. package/dist/{routes-D3T0BV1r.cjs → routes-01JAJiMe.cjs} +646 -27
  125. package/dist/routes-01JAJiMe.cjs.map +1 -0
  126. package/dist/{routes-Cu4-Al-k.js → routes-CmkPohqd.js} +593 -28
  127. package/dist/routes-CmkPohqd.js.map +1 -0
  128. package/dist/{schedules-BQvnAe1j.cjs → schedules-BRwhbppl.cjs} +77 -22
  129. package/dist/schedules-BRwhbppl.cjs.map +1 -0
  130. package/dist/{schedules-BcAIELfB.js → schedules-Zct_0ZwE.js} +77 -22
  131. package/dist/schedules-Zct_0ZwE.js.map +1 -0
  132. package/dist/{schema-xsUy1mlm-CAPin6jE.js → schema-TQPB_dl2-CCzMcdDx.js} +9 -6
  133. package/dist/{schema-xsUy1mlm-CAPin6jE.js.map → schema-TQPB_dl2-CCzMcdDx.js.map} +1 -1
  134. package/dist/{schema-xsUy1mlm-pvZI8YC0.cjs → schema-TQPB_dl2-CJX1q58F.cjs} +9 -6
  135. package/dist/{schema-xsUy1mlm-pvZI8YC0.cjs.map → schema-TQPB_dl2-CJX1q58F.cjs.map} +1 -1
  136. package/dist/{scores-DEvPN0kz.cjs → scores-0MyV08tL.cjs} +26 -11
  137. package/dist/scores-0MyV08tL.cjs.map +1 -0
  138. package/dist/{scores-Dm0yu1Pt.js → scores-CVssMyoQ.js} +26 -11
  139. package/dist/scores-CVssMyoQ.js.map +1 -0
  140. package/dist/server/auth/helpers.d.ts +7 -1
  141. package/dist/server/auth/helpers.d.ts.map +1 -1
  142. package/dist/server/auth/index.cjs +4 -2
  143. package/dist/server/auth/index.js +3 -3
  144. package/dist/server/constants.d.ts +8 -1
  145. package/dist/server/constants.d.ts.map +1 -1
  146. package/dist/server/handlers/a2a.cjs +1 -1
  147. package/dist/server/handlers/a2a.d.ts +4 -0
  148. package/dist/server/handlers/a2a.d.ts.map +1 -1
  149. package/dist/server/handlers/a2a.js +1 -1
  150. package/dist/server/handlers/agent-access.cjs +42 -0
  151. package/dist/server/handlers/agent-access.cjs.map +1 -0
  152. package/dist/server/handlers/agent-access.d.ts +19 -0
  153. package/dist/server/handlers/agent-access.d.ts.map +1 -0
  154. package/dist/server/handlers/agent-access.js +39 -0
  155. package/dist/server/handlers/agent-access.js.map +1 -0
  156. package/dist/server/handlers/agent-builder.cjs +1 -1
  157. package/dist/server/handlers/agent-builder.d.ts +32 -0
  158. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  159. package/dist/server/handlers/agent-builder.js +1 -1
  160. package/dist/server/handlers/agent-controller.cjs +4 -3
  161. package/dist/server/handlers/agent-controller.cjs.map +1 -1
  162. package/dist/server/handlers/agent-controller.d.ts +72 -0
  163. package/dist/server/handlers/agent-controller.d.ts.map +1 -1
  164. package/dist/server/handlers/agent-controller.js +4 -3
  165. package/dist/server/handlers/agent-controller.js.map +1 -1
  166. package/dist/server/handlers/agent-versions.cjs +30 -2
  167. package/dist/server/handlers/agent-versions.cjs.map +1 -1
  168. package/dist/server/handlers/agent-versions.d.ts +12 -0
  169. package/dist/server/handlers/agent-versions.d.ts.map +1 -1
  170. package/dist/server/handlers/agent-versions.js +30 -2
  171. package/dist/server/handlers/agent-versions.js.map +1 -1
  172. package/dist/server/handlers/agents.cjs +1 -1
  173. package/dist/server/handlers/agents.d.ts +91 -2
  174. package/dist/server/handlers/agents.d.ts.map +1 -1
  175. package/dist/server/handlers/agents.js +1 -1
  176. package/dist/server/handlers/auth.cjs +3 -3
  177. package/dist/server/handlers/auth.d.ts +40 -0
  178. package/dist/server/handlers/auth.d.ts.map +1 -1
  179. package/dist/server/handlers/auth.js +3 -3
  180. package/dist/server/handlers/authorship.cjs +1 -1
  181. package/dist/server/handlers/authorship.js +1 -1
  182. package/dist/server/handlers/background-tasks.cjs +1 -1
  183. package/dist/server/handlers/background-tasks.d.ts +8 -0
  184. package/dist/server/handlers/background-tasks.d.ts.map +1 -1
  185. package/dist/server/handlers/background-tasks.js +1 -1
  186. package/dist/server/handlers/builder-registry.cjs +1 -1
  187. package/dist/server/handlers/builder-registry.d.ts +10 -0
  188. package/dist/server/handlers/builder-registry.d.ts.map +1 -1
  189. package/dist/server/handlers/builder-registry.js +1 -1
  190. package/dist/server/handlers/channels.cjs +1 -1
  191. package/dist/server/handlers/channels.d.ts +10 -0
  192. package/dist/server/handlers/channels.d.ts.map +1 -1
  193. package/dist/server/handlers/channels.js +1 -1
  194. package/dist/server/handlers/conversations.cjs +1 -1
  195. package/dist/server/handlers/conversations.d.ts +8 -0
  196. package/dist/server/handlers/conversations.d.ts.map +1 -1
  197. package/dist/server/handlers/conversations.js +1 -1
  198. package/dist/server/handlers/datasets.cjs +5 -4
  199. package/dist/server/handlers/datasets.cjs.map +1 -1
  200. package/dist/server/handlers/datasets.d.ts +86 -0
  201. package/dist/server/handlers/datasets.d.ts.map +1 -1
  202. package/dist/server/handlers/datasets.js +5 -4
  203. package/dist/server/handlers/datasets.js.map +1 -1
  204. package/dist/server/handlers/dynamic-workflows.cjs +1 -1
  205. package/dist/server/handlers/dynamic-workflows.d.ts +8 -0
  206. package/dist/server/handlers/dynamic-workflows.d.ts.map +1 -1
  207. package/dist/server/handlers/dynamic-workflows.js +1 -1
  208. package/dist/server/handlers/editor-builder.cjs +1 -1
  209. package/dist/server/handlers/editor-builder.d.ts +6 -0
  210. package/dist/server/handlers/editor-builder.d.ts.map +1 -1
  211. package/dist/server/handlers/editor-builder.js +1 -1
  212. package/dist/server/handlers/favorites-enrichment.cjs +1 -1
  213. package/dist/server/handlers/favorites-enrichment.js +1 -1
  214. package/dist/server/handlers/knowledge.cjs +1 -1
  215. package/dist/server/handlers/knowledge.d.ts +18 -0
  216. package/dist/server/handlers/knowledge.d.ts.map +1 -1
  217. package/dist/server/handlers/knowledge.js +1 -1
  218. package/dist/server/handlers/logs.cjs +1 -1
  219. package/dist/server/handlers/logs.d.ts +6 -0
  220. package/dist/server/handlers/logs.d.ts.map +1 -1
  221. package/dist/server/handlers/logs.js +1 -1
  222. package/dist/server/handlers/mcp-client-versions.cjs +2 -2
  223. package/dist/server/handlers/mcp-client-versions.d.ts +14 -0
  224. package/dist/server/handlers/mcp-client-versions.d.ts.map +1 -1
  225. package/dist/server/handlers/mcp-client-versions.js +2 -2
  226. package/dist/server/handlers/mcp.cjs +1 -1
  227. package/dist/server/handlers/mcp.d.ts +42 -0
  228. package/dist/server/handlers/mcp.d.ts.map +1 -1
  229. package/dist/server/handlers/mcp.js +1 -1
  230. package/dist/server/handlers/memory.cjs +1 -1
  231. package/dist/server/handlers/memory.d.ts +52 -0
  232. package/dist/server/handlers/memory.d.ts.map +1 -1
  233. package/dist/server/handlers/memory.js +1 -1
  234. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  235. package/dist/server/handlers/observability-new-endpoints.d.ts +163 -3
  236. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  237. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  238. package/dist/server/handlers/observability-shared.cjs +8 -1
  239. package/dist/server/handlers/observability-shared.cjs.map +1 -1
  240. package/dist/server/handlers/observability-shared.d.ts +13 -0
  241. package/dist/server/handlers/observability-shared.d.ts.map +1 -1
  242. package/dist/server/handlers/observability-shared.js +7 -2
  243. package/dist/server/handlers/observability-shared.js.map +1 -1
  244. package/dist/server/handlers/observability-signal-context.cjs +1 -1
  245. package/dist/server/handlers/observability-signal-context.js +1 -1
  246. package/dist/server/handlers/observability.cjs +2 -2
  247. package/dist/server/handlers/observability.d.ts +12 -0
  248. package/dist/server/handlers/observability.d.ts.map +1 -1
  249. package/dist/server/handlers/observability.js +2 -2
  250. package/dist/server/handlers/plans.cjs +1 -1
  251. package/dist/server/handlers/plans.d.ts +2 -0
  252. package/dist/server/handlers/plans.d.ts.map +1 -1
  253. package/dist/server/handlers/plans.js +1 -1
  254. package/dist/server/handlers/processor-providers.cjs +1 -1
  255. package/dist/server/handlers/processor-providers.d.ts +4 -0
  256. package/dist/server/handlers/processor-providers.d.ts.map +1 -1
  257. package/dist/server/handlers/processor-providers.js +1 -1
  258. package/dist/server/handlers/processors.cjs +57 -6
  259. package/dist/server/handlers/processors.cjs.map +1 -1
  260. package/dist/server/handlers/processors.d.ts +6 -0
  261. package/dist/server/handlers/processors.d.ts.map +1 -1
  262. package/dist/server/handlers/processors.js +57 -6
  263. package/dist/server/handlers/processors.js.map +1 -1
  264. package/dist/server/handlers/prompt-block-versions.cjs +2 -2
  265. package/dist/server/handlers/prompt-block-versions.d.ts +14 -0
  266. package/dist/server/handlers/prompt-block-versions.d.ts.map +1 -1
  267. package/dist/server/handlers/prompt-block-versions.js +2 -2
  268. package/dist/server/handlers/responses.cjs +1 -1
  269. package/dist/server/handlers/responses.d.ts +17 -11
  270. package/dist/server/handlers/responses.d.ts.map +1 -1
  271. package/dist/server/handlers/responses.js +1 -1
  272. package/dist/server/handlers/responses.storage.cjs +4 -3
  273. package/dist/server/handlers/responses.storage.cjs.map +1 -1
  274. package/dist/server/handlers/responses.storage.d.ts.map +1 -1
  275. package/dist/server/handlers/responses.storage.js +4 -3
  276. package/dist/server/handlers/responses.storage.js.map +1 -1
  277. package/dist/server/handlers/schedules.cjs +1 -1
  278. package/dist/server/handlers/schedules.d.ts +18 -0
  279. package/dist/server/handlers/schedules.d.ts.map +1 -1
  280. package/dist/server/handlers/schedules.js +1 -1
  281. package/dist/server/handlers/scorer-versions.cjs +2 -2
  282. package/dist/server/handlers/scorer-versions.d.ts +14 -0
  283. package/dist/server/handlers/scorer-versions.d.ts.map +1 -1
  284. package/dist/server/handlers/scorer-versions.js +2 -2
  285. package/dist/server/handlers/scores.cjs +1 -1
  286. package/dist/server/handlers/scores.d.ts +12 -0
  287. package/dist/server/handlers/scores.d.ts.map +1 -1
  288. package/dist/server/handlers/scores.js +1 -1
  289. package/dist/server/handlers/stored-agent-favorites.cjs +3 -3
  290. package/dist/server/handlers/stored-agent-favorites.d.ts +4 -0
  291. package/dist/server/handlers/stored-agent-favorites.d.ts.map +1 -1
  292. package/dist/server/handlers/stored-agent-favorites.js +3 -3
  293. package/dist/server/handlers/stored-agents.cjs +41 -3
  294. package/dist/server/handlers/stored-agents.cjs.map +1 -1
  295. package/dist/server/handlers/stored-agents.d.ts +14 -0
  296. package/dist/server/handlers/stored-agents.d.ts.map +1 -1
  297. package/dist/server/handlers/stored-agents.js +41 -3
  298. package/dist/server/handlers/stored-agents.js.map +1 -1
  299. package/dist/server/handlers/stored-mcp-clients.cjs +2 -2
  300. package/dist/server/handlers/stored-mcp-clients.d.ts +10 -0
  301. package/dist/server/handlers/stored-mcp-clients.d.ts.map +1 -1
  302. package/dist/server/handlers/stored-mcp-clients.js +2 -2
  303. package/dist/server/handlers/stored-prompt-blocks.cjs +2 -2
  304. package/dist/server/handlers/stored-prompt-blocks.d.ts +10 -0
  305. package/dist/server/handlers/stored-prompt-blocks.d.ts.map +1 -1
  306. package/dist/server/handlers/stored-prompt-blocks.js +2 -2
  307. package/dist/server/handlers/stored-scorers.cjs +2 -2
  308. package/dist/server/handlers/stored-scorers.d.ts +10 -0
  309. package/dist/server/handlers/stored-scorers.d.ts.map +1 -1
  310. package/dist/server/handlers/stored-scorers.js +2 -2
  311. package/dist/server/handlers/stored-skill-favorites.cjs +3 -3
  312. package/dist/server/handlers/stored-skill-favorites.d.ts +4 -0
  313. package/dist/server/handlers/stored-skill-favorites.d.ts.map +1 -1
  314. package/dist/server/handlers/stored-skill-favorites.js +3 -3
  315. package/dist/server/handlers/stored-skills.cjs +3 -3
  316. package/dist/server/handlers/stored-skills.d.ts +12 -0
  317. package/dist/server/handlers/stored-skills.d.ts.map +1 -1
  318. package/dist/server/handlers/stored-skills.js +3 -3
  319. package/dist/server/handlers/stored-workspaces.cjs +2 -2
  320. package/dist/server/handlers/stored-workspaces.d.ts +10 -0
  321. package/dist/server/handlers/stored-workspaces.d.ts.map +1 -1
  322. package/dist/server/handlers/stored-workspaces.js +2 -2
  323. package/dist/server/handlers/system.cjs +3 -3
  324. package/dist/server/handlers/system.d.ts +6 -0
  325. package/dist/server/handlers/system.d.ts.map +1 -1
  326. package/dist/server/handlers/system.js +3 -3
  327. package/dist/server/handlers/tool-providers.cjs +2 -2
  328. package/dist/server/handlers/tool-providers.d.ts +26 -0
  329. package/dist/server/handlers/tool-providers.d.ts.map +1 -1
  330. package/dist/server/handlers/tool-providers.js +2 -2
  331. package/dist/server/handlers/tools.cjs +2 -1
  332. package/dist/server/handlers/tools.d.ts +20 -0
  333. package/dist/server/handlers/tools.d.ts.map +1 -1
  334. package/dist/server/handlers/tools.js +1 -1
  335. package/dist/server/handlers/utils.cjs +1 -1
  336. package/dist/server/handlers/utils.js +1 -1
  337. package/dist/server/handlers/validate-agent-instructions.cjs +1 -1
  338. package/dist/server/handlers/validate-agent-instructions.js +1 -1
  339. package/dist/server/handlers/vector.cjs +1 -1
  340. package/dist/server/handlers/vector.d.ts +16 -0
  341. package/dist/server/handlers/vector.d.ts.map +1 -1
  342. package/dist/server/handlers/vector.js +1 -1
  343. package/dist/server/handlers/voice.cjs +1 -1
  344. package/dist/server/handlers/voice.d.ts.map +1 -1
  345. package/dist/server/handlers/voice.js +1 -1
  346. package/dist/server/handlers/workflow-builder.cjs +1 -1
  347. package/dist/server/handlers/workflow-builder.d.ts +4 -0
  348. package/dist/server/handlers/workflow-builder.d.ts.map +1 -1
  349. package/dist/server/handlers/workflow-builder.js +1 -1
  350. package/dist/server/handlers/workflows.cjs +2 -1
  351. package/dist/server/handlers/workflows.d.ts +57 -0
  352. package/dist/server/handlers/workflows.d.ts.map +1 -1
  353. package/dist/server/handlers/workflows.js +1 -1
  354. package/dist/server/handlers/workspace.cjs +1 -1
  355. package/dist/server/handlers/workspace.d.ts +103 -23
  356. package/dist/server/handlers/workspace.d.ts.map +1 -1
  357. package/dist/server/handlers/workspace.js +1 -1
  358. package/dist/server/handlers.cjs +17 -17
  359. package/dist/server/handlers.js +17 -17
  360. package/dist/server/mcp/capabilities.d.ts +25 -0
  361. package/dist/server/mcp/capabilities.d.ts.map +1 -0
  362. package/dist/server/mcp/catalogue.d.ts +76 -0
  363. package/dist/server/mcp/catalogue.d.ts.map +1 -0
  364. package/dist/server/mcp/config.d.ts +49 -0
  365. package/dist/server/mcp/config.d.ts.map +1 -0
  366. package/dist/server/mcp/descriptor.d.ts +40 -0
  367. package/dist/server/mcp/descriptor.d.ts.map +1 -0
  368. package/dist/server/mcp/oauth.d.ts +46 -0
  369. package/dist/server/mcp/oauth.d.ts.map +1 -0
  370. package/dist/server/mcp/result-size.d.ts +26 -0
  371. package/dist/server/mcp/result-size.d.ts.map +1 -0
  372. package/dist/server/mcp/route.d.ts +21 -0
  373. package/dist/server/mcp/route.d.ts.map +1 -0
  374. package/dist/server/mcp/schema.d.ts +13 -0
  375. package/dist/server/mcp/schema.d.ts.map +1 -0
  376. package/dist/server/mcp/toolsets/memory.d.ts +8 -0
  377. package/dist/server/mcp/toolsets/memory.d.ts.map +1 -0
  378. package/dist/server/mcp/toolsets/observability.d.ts +4 -0
  379. package/dist/server/mcp/toolsets/observability.d.ts.map +1 -0
  380. package/dist/server/mcp/toolsets/stored-agents.d.ts +8 -0
  381. package/dist/server/mcp/toolsets/stored-agents.d.ts.map +1 -0
  382. package/dist/server/schemas/agents.d.ts +1 -1
  383. package/dist/server/schemas/datasets.d.ts +10 -0
  384. package/dist/server/schemas/datasets.d.ts.map +1 -1
  385. package/dist/server/schemas/index.cjs +10 -11
  386. package/dist/server/schemas/index.js +4 -5
  387. package/dist/server/schemas/system.d.ts +2 -0
  388. package/dist/server/schemas/system.d.ts.map +1 -1
  389. package/dist/server/server-adapter/api-schema-manifest.d.ts +1 -1
  390. package/dist/server/server-adapter/index.cjs +45 -1831
  391. package/dist/server/server-adapter/index.d.ts +126 -3
  392. package/dist/server/server-adapter/index.d.ts.map +1 -1
  393. package/dist/server/server-adapter/index.js +7 -1805
  394. package/dist/server/server-adapter/openapi-utils.d.ts +2 -2
  395. package/dist/server/server-adapter/openapi-utils.d.ts.map +1 -1
  396. package/dist/server/server-adapter/routes/a2a.d.ts +4 -0
  397. package/dist/server/server-adapter/routes/a2a.d.ts.map +1 -1
  398. package/dist/server/server-adapter/routes/agent-builder.d.ts +32 -0
  399. package/dist/server/server-adapter/routes/agent-builder.d.ts.map +1 -1
  400. package/dist/server/server-adapter/routes/channels.d.ts +10 -0
  401. package/dist/server/server-adapter/routes/channels.d.ts.map +1 -1
  402. package/dist/server/server-adapter/routes/conversations.d.ts +11 -3
  403. package/dist/server/server-adapter/routes/conversations.d.ts.map +1 -1
  404. package/dist/server/server-adapter/routes/datasets.d.ts +86 -0
  405. package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
  406. package/dist/server/server-adapter/routes/editor-builder.d.ts +20 -0
  407. package/dist/server/server-adapter/routes/editor-builder.d.ts.map +1 -1
  408. package/dist/server/server-adapter/routes/index.d.ts +26 -1
  409. package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
  410. package/dist/server/server-adapter/routes/knowledge.d.ts +18 -0
  411. package/dist/server/server-adapter/routes/knowledge.d.ts.map +1 -1
  412. package/dist/server/server-adapter/routes/legacy.d.ts +8 -0
  413. package/dist/server/server-adapter/routes/legacy.d.ts.map +1 -1
  414. package/dist/server/server-adapter/routes/logs.d.ts +6 -0
  415. package/dist/server/server-adapter/routes/logs.d.ts.map +1 -1
  416. package/dist/server/server-adapter/routes/mcp.d.ts +37 -1
  417. package/dist/server/server-adapter/routes/mcp.d.ts.map +1 -1
  418. package/dist/server/server-adapter/routes/memory.d.ts +52 -0
  419. package/dist/server/server-adapter/routes/memory.d.ts.map +1 -1
  420. package/dist/server/server-adapter/routes/observability.d.ts +97 -1
  421. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  422. package/dist/server/server-adapter/routes/processor-providers.d.ts +4 -0
  423. package/dist/server/server-adapter/routes/processor-providers.d.ts.map +1 -1
  424. package/dist/server/server-adapter/routes/processors.d.ts +6 -0
  425. package/dist/server/server-adapter/routes/processors.d.ts.map +1 -1
  426. package/dist/server/server-adapter/routes/responses.d.ts +6 -0
  427. package/dist/server/server-adapter/routes/responses.d.ts.map +1 -1
  428. package/dist/server/server-adapter/routes/route-builder.d.ts +5 -1
  429. package/dist/server/server-adapter/routes/route-builder.d.ts.map +1 -1
  430. package/dist/server/server-adapter/routes/scorers.d.ts +12 -0
  431. package/dist/server/server-adapter/routes/scorers.d.ts.map +1 -1
  432. package/dist/server/server-adapter/routes/stored-mcp-clients.d.ts +24 -0
  433. package/dist/server/server-adapter/routes/stored-mcp-clients.d.ts.map +1 -1
  434. package/dist/server/server-adapter/routes/stored-prompt-blocks.d.ts +24 -0
  435. package/dist/server/server-adapter/routes/stored-prompt-blocks.d.ts.map +1 -1
  436. package/dist/server/server-adapter/routes/stored-scorers.d.ts +24 -0
  437. package/dist/server/server-adapter/routes/stored-scorers.d.ts.map +1 -1
  438. package/dist/server/server-adapter/routes/stored-skills.d.ts +16 -0
  439. package/dist/server/server-adapter/routes/stored-skills.d.ts.map +1 -1
  440. package/dist/server/server-adapter/routes/stored-workspaces.d.ts +10 -0
  441. package/dist/server/server-adapter/routes/stored-workspaces.d.ts.map +1 -1
  442. package/dist/server/server-adapter/routes/system.d.ts +6 -0
  443. package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
  444. package/dist/server/server-adapter/routes/tool-providers.d.ts +26 -0
  445. package/dist/server/server-adapter/routes/tool-providers.d.ts.map +1 -1
  446. package/dist/server/server-adapter/routes/tools.d.ts +6 -0
  447. package/dist/server/server-adapter/routes/tools.d.ts.map +1 -1
  448. package/dist/server/server-adapter/routes/vectors.d.ts +16 -0
  449. package/dist/server/server-adapter/routes/vectors.d.ts.map +1 -1
  450. package/dist/server/server-adapter/routes/workflows.d.ts +50 -0
  451. package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -1
  452. package/dist/server/server-adapter/routes/workspace.d.ts +42 -0
  453. package/dist/server/server-adapter/routes/workspace.d.ts.map +1 -1
  454. package/dist/server-adapter-B7dLE5si.cjs +2386 -0
  455. package/dist/server-adapter-B7dLE5si.cjs.map +1 -0
  456. package/dist/server-adapter-BywLWVKp.js +2189 -0
  457. package/dist/server-adapter-BywLWVKp.js.map +1 -0
  458. package/dist/{system-zL047vEq.cjs → system-DdMSBAOY.cjs} +2 -1
  459. package/dist/system-DdMSBAOY.cjs.map +1 -0
  460. package/dist/{system-DlW760k2.js → system-FnU7vyxd.js} +2 -1
  461. package/dist/system-FnU7vyxd.js.map +1 -0
  462. package/dist/{tools-Daot5Zgz.cjs → tools-CawMeeZg.cjs} +71 -29
  463. package/dist/tools-CawMeeZg.cjs.map +1 -0
  464. package/dist/{tools-BJFq9JKF.js → tools-oHRh4msa.js} +65 -29
  465. package/dist/tools-oHRh4msa.js.map +1 -0
  466. package/dist/{utils-yedETkNk.js → utils-BfySxdfF.js} +3 -3
  467. package/dist/{utils-yedETkNk.js.map → utils-BfySxdfF.js.map} +1 -1
  468. package/dist/{utils-BXEJ6FZC.cjs → utils-DFhesFfA.cjs} +2 -2
  469. package/dist/{utils-BXEJ6FZC.cjs.map → utils-DFhesFfA.cjs.map} +1 -1
  470. package/dist/{utils-DptI_ERr.cjs → utils-Dn_OA_6N.cjs} +6 -6
  471. package/dist/{utils-DptI_ERr.cjs.map → utils-Dn_OA_6N.cjs.map} +1 -1
  472. package/dist/{utils-CTYtskHa.js → utils-Dv1D6ob-.js} +2 -2
  473. package/dist/{utils-CTYtskHa.js.map → utils-Dv1D6ob-.js.map} +1 -1
  474. package/dist/{vector-CZ26vo6u.js → vector-Bz-glead.js} +2 -2
  475. package/dist/{vector-CZ26vo6u.js.map → vector-Bz-glead.js.map} +1 -1
  476. package/dist/{vector-DBe45tnv.cjs → vector-DIFU_fwU.cjs} +2 -2
  477. package/dist/{vector-DBe45tnv.cjs.map → vector-DIFU_fwU.cjs.map} +1 -1
  478. package/dist/voice-C6bAqs79.js +42 -0
  479. package/dist/voice-C6bAqs79.js.map +1 -0
  480. package/dist/{voice-CBbxcsCM.cjs → voice-Dk0O5mVD.cjs} +29 -9
  481. package/dist/voice-Dk0O5mVD.cjs.map +1 -0
  482. package/dist/{workflow-builder-CkrdTcoM.cjs → workflow-builder-BPUjAdaC.cjs} +5 -5
  483. package/dist/{workflow-builder-CkrdTcoM.cjs.map → workflow-builder-BPUjAdaC.cjs.map} +1 -1
  484. package/dist/{workflow-builder-C5ufahUw.js → workflow-builder-D2fwGsLw.js} +5 -5
  485. package/dist/{workflow-builder-C5ufahUw.js.map → workflow-builder-D2fwGsLw.js.map} +1 -1
  486. package/dist/{workflows-C_Mqj_80.js → workflows-B-QJ0Tnv.js} +38 -7
  487. package/dist/workflows-B-QJ0Tnv.js.map +1 -0
  488. package/dist/{workflows-B5uWFrJ1.cjs → workflows-CwkEHIKW.cjs} +43 -6
  489. package/dist/workflows-CwkEHIKW.cjs.map +1 -0
  490. package/dist/{workspace-BwlPQO3M.js → workspace-CbTB2svI.js} +99 -41
  491. package/dist/workspace-CbTB2svI.js.map +1 -0
  492. package/dist/{workspace-CD9pQ61P.cjs → workspace-CsPtSXQd.cjs} +99 -41
  493. package/dist/workspace-CsPtSXQd.cjs.map +1 -0
  494. package/package.json +17 -10
  495. package/dist/a2a-DIcMx6x-.cjs.map +0 -1
  496. package/dist/a2a-DTTGA2Xg.js.map +0 -1
  497. package/dist/agents-BCgiMlDq.js.map +0 -1
  498. package/dist/agents-CTgjTASj.js.map +0 -1
  499. package/dist/agents-CjcvdF2e.cjs.map +0 -1
  500. package/dist/agents-DjpBmwhv.cjs.map +0 -1
  501. package/dist/api-schema-manifest-B8s3TuPU.js.map +0 -1
  502. package/dist/api-schema-manifest-Czr4Bmrw.cjs.map +0 -1
  503. package/dist/constants-CXAvBYcz.js.map +0 -1
  504. package/dist/constants-DMg8hUOR.cjs.map +0 -1
  505. package/dist/conversations-BFqmDglO.cjs.map +0 -1
  506. package/dist/conversations-BkX00xDs.js.map +0 -1
  507. package/dist/datasets--F0QkdGX.js.map +0 -1
  508. package/dist/datasets-BiEAIm0s.cjs.map +0 -1
  509. package/dist/dist-tbh2LUPc.js +0 -1
  510. package/dist/editor-builder-C4H2l6tz.js.map +0 -1
  511. package/dist/editor-builder-Cqw1npOK.cjs.map +0 -1
  512. package/dist/helpers-0LJI4DxR.cjs.map +0 -1
  513. package/dist/helpers-C9QZKOhz.js.map +0 -1
  514. package/dist/memory-BRE3ofvI.cjs.map +0 -1
  515. package/dist/memory-Dw7xG5nn.js.map +0 -1
  516. package/dist/observability-BYIy4kPf.js.map +0 -1
  517. package/dist/observability-DHJ7mzoE.cjs.map +0 -1
  518. package/dist/observability-new-endpoints-BOe3wej1.cjs.map +0 -1
  519. package/dist/observability-new-endpoints-COy7lpeR.js.map +0 -1
  520. package/dist/plans-D_GKFz2x.js.map +0 -1
  521. package/dist/plans-_nR8lqgD.cjs.map +0 -1
  522. package/dist/responses-C_OEJoxU.js.map +0 -1
  523. package/dist/responses-CdWbS4jA.cjs.map +0 -1
  524. package/dist/routes-CtGp_lBn.cjs +0 -523
  525. package/dist/routes-CtGp_lBn.cjs.map +0 -1
  526. package/dist/routes-Cu4-Al-k.js.map +0 -1
  527. package/dist/routes-D3T0BV1r.cjs.map +0 -1
  528. package/dist/routes-MRZFTKei.js +0 -446
  529. package/dist/routes-MRZFTKei.js.map +0 -1
  530. package/dist/schedules-BQvnAe1j.cjs.map +0 -1
  531. package/dist/schedules-BcAIELfB.js.map +0 -1
  532. package/dist/scores-DEvPN0kz.cjs.map +0 -1
  533. package/dist/scores-Dm0yu1Pt.js.map +0 -1
  534. package/dist/server/server-adapter/index.cjs.map +0 -1
  535. package/dist/server/server-adapter/index.js.map +0 -1
  536. package/dist/system-DlW760k2.js.map +0 -1
  537. package/dist/system-zL047vEq.cjs.map +0 -1
  538. package/dist/tools-BJFq9JKF.js.map +0 -1
  539. package/dist/tools-Daot5Zgz.cjs.map +0 -1
  540. package/dist/voice-CBbxcsCM.cjs.map +0 -1
  541. package/dist/voice-CzFWhWPJ.js +0 -22
  542. package/dist/voice-CzFWhWPJ.js.map +0 -1
  543. package/dist/workflows-B5uWFrJ1.cjs.map +0 -1
  544. package/dist/workflows-C_Mqj_80.js.map +0 -1
  545. package/dist/workspace-BwlPQO3M.js.map +0 -1
  546. package/dist/workspace-CD9pQ61P.cjs.map +0 -1
  547. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/@internal_core@0.1.4/dist/routes/index.d.ts +0 -0
  548. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/@internal_core@0.1.4/dist/types/index.d.ts +0 -0
  549. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/checks.d.ts +0 -0
  550. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/coerce.d.ts +0 -0
  551. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/compat.d.ts +0 -0
  552. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/deep-partial.d.ts +0 -0
  553. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/errors.d.ts +0 -0
  554. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/external.d.ts +0 -0
  555. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/from-json-schema.d.ts +0 -0
  556. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/in-out.d.ts +0 -0
  557. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/index.d.ts +0 -0
  558. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/iso.d.ts +0 -0
  559. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/parse.d.ts +0 -0
  560. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/classic/schemas.d.ts +0 -0
  561. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/api.d.ts +0 -0
  562. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/checks.d.ts +0 -0
  563. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/compile.d.ts +0 -0
  564. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/core.d.ts +0 -0
  565. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/doc.d.ts +0 -0
  566. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/errors.d.ts +0 -0
  567. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/index.d.ts +0 -0
  568. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/json-schema-generator.d.ts +0 -0
  569. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/json-schema-processors.d.ts +0 -0
  570. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/json-schema.d.ts +0 -0
  571. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/memoizer.d.ts +0 -0
  572. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/parse.d.ts +0 -0
  573. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/regexes.d.ts +0 -0
  574. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/registries.d.ts +0 -0
  575. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/schemas.d.ts +0 -0
  576. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/standard-schema.d.ts +0 -0
  577. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/to-json-schema.d.ts +0 -0
  578. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/util.d.ts +0 -0
  579. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/core/versions.d.ts +0 -0
  580. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/index.d.cts +0 -0
  581. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ar.d.ts +0 -0
  582. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/az.d.ts +0 -0
  583. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/be.d.ts +0 -0
  584. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/bg.d.ts +0 -0
  585. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/bn.d.ts +0 -0
  586. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ca.d.ts +0 -0
  587. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ckb.d.ts +0 -0
  588. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/cs.d.ts +0 -0
  589. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/da.d.ts +0 -0
  590. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/de.d.ts +0 -0
  591. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/el.d.ts +0 -0
  592. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/en.d.ts +0 -0
  593. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/eo.d.ts +0 -0
  594. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/es.d.ts +0 -0
  595. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/fa.d.ts +0 -0
  596. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/fi.d.ts +0 -0
  597. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/fr-CA.d.ts +0 -0
  598. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/fr.d.ts +0 -0
  599. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/gu.d.ts +0 -0
  600. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/he.d.ts +0 -0
  601. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/hi.d.ts +0 -0
  602. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/hr.d.ts +0 -0
  603. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/hu.d.ts +0 -0
  604. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/hy.d.ts +0 -0
  605. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/id.d.ts +0 -0
  606. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/index.d.ts +0 -0
  607. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/is.d.ts +0 -0
  608. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/it.d.ts +0 -0
  609. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ja.d.ts +0 -0
  610. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ka.d.ts +0 -0
  611. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/kh.d.ts +0 -0
  612. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/km.d.ts +0 -0
  613. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/kn.d.ts +0 -0
  614. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ko.d.ts +0 -0
  615. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/lt.d.ts +0 -0
  616. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/mk.d.ts +0 -0
  617. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ms.d.ts +0 -0
  618. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ne.d.ts +0 -0
  619. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/nl.d.ts +0 -0
  620. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/nn.d.ts +0 -0
  621. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/no.d.ts +0 -0
  622. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ota.d.ts +0 -0
  623. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/pl.d.ts +0 -0
  624. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ps.d.ts +0 -0
  625. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/pt-BR.d.ts +0 -0
  626. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/pt.d.ts +0 -0
  627. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ro.d.ts +0 -0
  628. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ru.d.ts +0 -0
  629. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/sk.d.ts +0 -0
  630. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/sl.d.ts +0 -0
  631. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/sv.d.ts +0 -0
  632. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ta.d.ts +0 -0
  633. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/tg.d.ts +0 -0
  634. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/th.d.ts +0 -0
  635. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/tk.d.ts +0 -0
  636. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/tr.d.ts +0 -0
  637. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ua.d.ts +0 -0
  638. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/uk.d.ts +0 -0
  639. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/ur.d.ts +0 -0
  640. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/uz.d.ts +0 -0
  641. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/vi.d.ts +0 -0
  642. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/yo.d.ts +0 -0
  643. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/zh-CN.d.ts +0 -0
  644. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/_types/zod@4.6.7/v4/locales/zh-TW.d.ts +0 -0
  645. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/dist/routes/index.d.ts +0 -0
  646. /package/dist/_types/{@internal_voice@0.0.44 → @internal_voice@0.0.45}/package.json +0 -0
  647. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1/dist/_types/@internal_ai-sdk-v4@0.0.95 → @mastra_schema-compat@1.4.0/dist/_types/@internal_ai-sdk-v4@0.0.96}/dist/index.d.ts +0 -0
  648. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1/dist/_types/@internal_ai-sdk-v5@0.0.95 → @mastra_schema-compat@1.4.0/dist/_types/@internal_ai-sdk-v5@0.0.96}/dist/index.d.ts +0 -0
  649. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1/dist/_types/@internal_ai-v6@0.0.95 → @mastra_schema-compat@1.4.0/dist/_types/@internal_ai-v6@0.0.96}/dist/index.d.ts +0 -0
  650. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/_types/@standard-schema_spec@1.1.0/dist/index.d.ts +0 -0
  651. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/_types/@types_json-schema@7.0.15/index.d.ts +0 -0
  652. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/index.d.ts +0 -0
  653. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/null-to-undefined.d.ts +0 -0
  654. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/provider-compats/google.d.ts +0 -0
  655. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/provider-compats/openai-reasoning.d.ts +0 -0
  656. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/provider-compats/openai.d.ts +0 -0
  657. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/schema-compatibility-v3.d.ts +0 -0
  658. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/schema-compatibility-v4.d.ts +0 -0
  659. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/schema-compatibility.d.ts +0 -0
  660. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/schema.d.ts +0 -0
  661. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/standard-schema/standard-schema.d.ts +0 -0
  662. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/standard-schema/standard-schema.types.d.ts +0 -0
  663. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/standard-schema-compat.d.ts +0 -0
  664. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/types.d.ts +0 -0
  665. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/utils.d.ts +0 -0
  666. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/dist/zod-to-json.d.ts +0 -0
  667. /package/dist/_types/{@mastra_schema-compat@1.4.0-alpha.1 → @mastra_schema-compat@1.4.0}/package.json +0 -0
@@ -1,7 +1,9 @@
1
1
  import { r as __exportAll } from "./rolldown-runtime-CQI-hT2b.js";
2
2
  import { t as HTTPException } from "./http-exception-CzaWkxMl.js";
3
3
  import { B as skillsShPopularQuerySchema, C as searchQuerySchema, D as searchSkillsResponseSchema, E as searchSkillsQuerySchema, G as skillsShSearchQuerySchema, H as skillsShPreviewResponseSchema, K as skillsShSearchResponseSchema, L as skillsShInstallBodySchema, M as skillReferencePathParams, N as skillReferenceResponseSchema, O as skillDisambiguationQuerySchema, Q as workspaceInfoResponseSchema, R as skillsShInstallResponseSchema, U as skillsShRemoveBodySchema, V as skillsShPreviewQuerySchema, W as skillsShRemoveResponseSchema, X as skillsShUpdateResponseSchema, Y as skillsShUpdateBodySchema, Z as workspaceIdPathParams, _ as indexBodySchema, a as fsListResponseSchema, b as listSkillsResponseSchema, d as fsStatQuerySchema, f as fsStatResponseSchema, g as getSkillResponseSchema, i as fsListQuerySchema, j as skillNamePathParams, l as fsReadQuerySchema, m as fsWriteResponseSchema, n as fsDeleteQuerySchema, o as fsMkdirBodySchema, p as fsWriteBodySchema, r as fsDeleteResponseSchema, s as fsMkdirResponseSchema, u as fsReadResponseSchema, v as indexResponseSchema, w as searchResponseSchema, x as listWorkspacesResponseSchema, y as listReferencesResponseSchema, z as skillsShListResponseSchema } from "./workspace-DBDA3UQl.js";
4
- import { n as createRoute } from "./route-builder-DfDT1g4L.js";
4
+ import { n as createRoute } from "./route-builder-Dz18c3qm.js";
5
+ import { assertStoredAgentAccess, listAgentsVisibleTo } from "./server/handlers/agent-access.js";
6
+ import { assertReadAccess } from "./server/handlers/authorship.js";
5
7
  import { handleError } from "./server/handlers/error.js";
6
8
  import { coreFeatures } from "@mastra/core/features";
7
9
  // src/server/handlers/workspace.ts
@@ -100,16 +102,27 @@ function requireWorkspaceV1Support() {
100
102
  * Backwards compatible: Falls back to searching through agents if
101
103
  * mastra.getWorkspaceById() is not available (older @mastra/core versions).
102
104
  */
103
- async function getWorkspaceById(mastra, workspaceId) {
105
+ async function getWorkspaceById(mastra, workspaceId, requestContext) {
104
106
  requireWorkspaceV1Support();
105
107
  const globalWorkspace = mastra.getWorkspace?.();
106
108
  if (globalWorkspace?.id === workspaceId) return globalWorkspace;
107
- if (typeof mastra.getWorkspaceById === "function") try {
108
- return mastra.getWorkspaceById(workspaceId);
109
- } catch {
110
- return;
109
+ if (typeof mastra.getWorkspaceById === "function") {
110
+ let workspace;
111
+ try {
112
+ workspace = mastra.getWorkspaceById(workspaceId);
113
+ } catch {
114
+ return;
115
+ }
116
+ const entry = typeof mastra.listWorkspaces === "function" ? mastra.listWorkspaces()[workspaceId] : void 0;
117
+ if (entry?.source === "agent" && entry.agentId) {
118
+ if (!await isAgentWorkspaceVisible(mastra, {
119
+ agentId: entry.agentId,
120
+ agentSource: entry.agentSource
121
+ }, requestContext)) return void 0;
122
+ }
123
+ return workspace;
111
124
  }
112
- const agents = mastra.listAgents?.() ?? {};
125
+ const agents = listAgentsVisibleTo(mastra.listAgents?.(), requestContext);
113
126
  for (const agent of Object.values(agents)) if (agent.hasOwnWorkspace?.()) {
114
127
  const agentWorkspace = await agent.getWorkspace?.();
115
128
  if (agentWorkspace?.id === workspaceId) return agentWorkspace;
@@ -119,8 +132,48 @@ async function getWorkspaceById(mastra, workspaceId) {
119
132
  * Get skills from a specific workspace by ID.
120
133
  * Note: getWorkspaceById already checks for workspace v1 support.
121
134
  */
122
- async function getSkillsById(mastra, workspaceId) {
123
- return (await getWorkspaceById(mastra, workspaceId))?.skills;
135
+ async function getSkillsById(mastra, workspaceId, requestContext) {
136
+ return (await getWorkspaceById(mastra, workspaceId, requestContext))?.skills;
137
+ }
138
+ /**
139
+ * Agents register their workspace once used, so a registered workspace can belong to a stored agent the caller can't
140
+ * see. Editing a stored agent unregisters it from Mastra but leaves its workspace registered, so an agent that isn't
141
+ * registered is checked against its stored record. With no record, a workspace a stored agent registered is hidden:
142
+ * its agent was deleted, and an async workspace factory can still register it after the delete's cleanup. Lookup
143
+ * errors hide the workspace.
144
+ */
145
+ async function isAgentWorkspaceVisible(mastra, entry, requestContext) {
146
+ const { agentId } = entry;
147
+ try {
148
+ let agent;
149
+ try {
150
+ agent = mastra.getAgentById(agentId);
151
+ } catch {
152
+ agent = void 0;
153
+ }
154
+ if (agent) {
155
+ assertStoredAgentAccess({
156
+ agent,
157
+ agentId,
158
+ requestContext,
159
+ access: "read"
160
+ });
161
+ return true;
162
+ }
163
+ const record = await (await mastra.getStorage()?.getStore("agents"))?.getById(agentId);
164
+ if (record) {
165
+ assertReadAccess({
166
+ requestContext,
167
+ resource: "stored-agents",
168
+ resourceId: agentId,
169
+ record
170
+ });
171
+ return true;
172
+ }
173
+ return entry.agentSource !== "stored";
174
+ } catch {
175
+ return false;
176
+ }
124
177
  }
125
178
  /**
126
179
  * Build the install path for a skill from skills.sh.
@@ -154,7 +207,7 @@ const LIST_WORKSPACES_ROUTE = createRoute({
154
207
  summary: "List all workspaces",
155
208
  description: "Returns all workspaces from both Mastra instance and agents",
156
209
  tags: ["Workspace"],
157
- handler: async ({ mastra }) => {
210
+ handler: async ({ mastra, requestContext }) => {
158
211
  try {
159
212
  requireWorkspaceV1Support();
160
213
  const workspaces = [];
@@ -165,6 +218,11 @@ const LIST_WORKSPACES_ROUTE = createRoute({
165
218
  const source = entry.source ?? "mastra";
166
219
  const agentId = entry.agentId;
167
220
  const agentName = entry.agentName;
221
+ const agentSource = entry.agentSource;
222
+ if (source === "agent" && agentId && !await isAgentWorkspaceVisible(mastra, {
223
+ agentId,
224
+ agentSource
225
+ }, requestContext)) continue;
168
226
  workspaces.push({
169
227
  id: ws.id,
170
228
  name: ws.name,
@@ -208,7 +266,7 @@ const LIST_WORKSPACES_ROUTE = createRoute({
208
266
  safety: { readOnly: globalWorkspace.filesystem?.readOnly ?? false }
209
267
  });
210
268
  }
211
- const agents = mastra.listAgents?.() ?? {};
269
+ const agents = listAgentsVisibleTo(mastra.listAgents?.(), requestContext);
212
270
  for (const [agentId, agent] of Object.entries(agents)) if (agent.hasOwnWorkspace?.()) try {
213
271
  const agentWorkspace = await agent.getWorkspace?.();
214
272
  if (agentWorkspace && !seenIds.has(agentWorkspace.id)) {
@@ -251,9 +309,9 @@ const GET_WORKSPACE_ROUTE = createRoute({
251
309
  summary: "Get workspace info",
252
310
  description: "Returns information about a specific workspace and its capabilities",
253
311
  tags: ["Workspace"],
254
- handler: async ({ mastra, workspaceId }) => {
312
+ handler: async ({ mastra, requestContext, workspaceId }) => {
255
313
  try {
256
- const workspace = await getWorkspaceById(mastra, workspaceId);
314
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
257
315
  if (!workspace) return { isWorkspaceConfigured: false };
258
316
  const fsInfo = await workspace.filesystem?.getInfo?.();
259
317
  let mounts;
@@ -320,11 +378,11 @@ const WORKSPACE_FS_READ_ROUTE = createRoute({
320
378
  summary: "Read file content",
321
379
  description: "Returns the content of a file at the specified path",
322
380
  tags: ["Workspace"],
323
- handler: async ({ mastra, path, encoding, workspaceId }) => {
381
+ handler: async ({ mastra, requestContext, path, encoding, workspaceId }) => {
324
382
  try {
325
383
  requireWorkspaceV1Support();
326
384
  if (!path) throw new HTTPException(400, { message: "Path is required" });
327
- const workspace = await getWorkspaceById(mastra, workspaceId);
385
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
328
386
  if (!workspace?.filesystem) throw new HTTPException(404, { message: "No workspace filesystem configured" });
329
387
  const decodedPath = path;
330
388
  if (!await workspace.filesystem.exists(decodedPath)) throw new HTTPException(404, { message: `Path "${decodedPath}" not found` });
@@ -349,11 +407,11 @@ const WORKSPACE_FS_WRITE_ROUTE = createRoute({
349
407
  summary: "Write file content",
350
408
  description: "Writes content to a file at the specified path. Supports base64 encoding for binary files.",
351
409
  tags: ["Workspace"],
352
- handler: async ({ mastra, path, content, encoding, recursive, workspaceId }) => {
410
+ handler: async ({ mastra, requestContext, path, content, encoding, recursive, workspaceId }) => {
353
411
  try {
354
412
  requireWorkspaceV1Support();
355
413
  if (!path || content === void 0) throw new HTTPException(400, { message: "Path and content are required" });
356
- const workspace = await getWorkspaceById(mastra, workspaceId);
414
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
357
415
  if (!workspace?.filesystem) throw new HTTPException(404, { message: "No workspace filesystem configured" });
358
416
  if (workspace.filesystem?.readOnly) throw new HTTPException(403, { message: "Workspace is in read-only mode" });
359
417
  const decodedPath = path;
@@ -379,11 +437,11 @@ const WORKSPACE_FS_LIST_ROUTE = createRoute({
379
437
  summary: "List directory contents",
380
438
  description: "Returns a list of files and directories at the specified path",
381
439
  tags: ["Workspace"],
382
- handler: async ({ mastra, path, recursive, workspaceId }) => {
440
+ handler: async ({ mastra, requestContext, path, recursive, workspaceId }) => {
383
441
  try {
384
442
  requireWorkspaceV1Support();
385
443
  if (!path) throw new HTTPException(400, { message: "Path is required" });
386
- const workspace = await getWorkspaceById(mastra, workspaceId);
444
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
387
445
  if (!workspace?.filesystem) return {
388
446
  path,
389
447
  entries: [],
@@ -410,11 +468,11 @@ const WORKSPACE_FS_DELETE_ROUTE = createRoute({
410
468
  summary: "Delete file or directory",
411
469
  description: "Deletes a file or directory at the specified path",
412
470
  tags: ["Workspace"],
413
- handler: async ({ mastra, path, recursive, force, workspaceId }) => {
471
+ handler: async ({ mastra, requestContext, path, recursive, force, workspaceId }) => {
414
472
  try {
415
473
  requireWorkspaceV1Support();
416
474
  if (!path) throw new HTTPException(400, { message: "Path is required" });
417
- const workspace = await getWorkspaceById(mastra, workspaceId);
475
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
418
476
  if (!workspace?.filesystem) throw new HTTPException(404, { message: "No workspace filesystem configured" });
419
477
  if (workspace.filesystem?.readOnly) throw new HTTPException(403, { message: "Workspace is in read-only mode" });
420
478
  const decodedPath = path;
@@ -447,11 +505,11 @@ const WORKSPACE_FS_MKDIR_ROUTE = createRoute({
447
505
  summary: "Create directory",
448
506
  description: "Creates a directory at the specified path",
449
507
  tags: ["Workspace"],
450
- handler: async ({ mastra, path, recursive, workspaceId }) => {
508
+ handler: async ({ mastra, requestContext, path, recursive, workspaceId }) => {
451
509
  try {
452
510
  requireWorkspaceV1Support();
453
511
  if (!path) throw new HTTPException(400, { message: "Path is required" });
454
- const workspace = await getWorkspaceById(mastra, workspaceId);
512
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
455
513
  if (!workspace?.filesystem) throw new HTTPException(404, { message: "No workspace filesystem configured" });
456
514
  if (workspace.filesystem?.readOnly) throw new HTTPException(403, { message: "Workspace is in read-only mode" });
457
515
  const decodedPath = path;
@@ -475,11 +533,11 @@ const WORKSPACE_FS_STAT_ROUTE = createRoute({
475
533
  summary: "Get file/directory info",
476
534
  description: "Returns metadata about a file or directory",
477
535
  tags: ["Workspace"],
478
- handler: async ({ mastra, path, workspaceId }) => {
536
+ handler: async ({ mastra, requestContext, path, workspaceId }) => {
479
537
  try {
480
538
  requireWorkspaceV1Support();
481
539
  if (!path) throw new HTTPException(400, { message: "Path is required" });
482
- const workspace = await getWorkspaceById(mastra, workspaceId);
540
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
483
541
  if (!workspace?.filesystem) throw new HTTPException(404, { message: "No workspace filesystem configured" });
484
542
  const decodedPath = path;
485
543
  if (!await workspace.filesystem.exists(decodedPath)) throw new HTTPException(404, { message: `Path "${decodedPath}" not found` });
@@ -507,11 +565,11 @@ const WORKSPACE_SEARCH_ROUTE = createRoute({
507
565
  summary: "Search workspace content",
508
566
  description: "Searches across indexed workspace content using BM25, vector, or hybrid search",
509
567
  tags: ["Workspace"],
510
- handler: async ({ mastra, query, topK, mode, minScore, workspaceId }) => {
568
+ handler: async ({ mastra, requestContext, query, topK, mode, minScore, workspaceId }) => {
511
569
  try {
512
570
  requireWorkspaceV1Support();
513
571
  if (!query) throw new HTTPException(400, { message: "Search query is required" });
514
- const workspace = await getWorkspaceById(mastra, workspaceId);
572
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
515
573
  if (!workspace) return {
516
574
  results: [],
517
575
  query,
@@ -558,11 +616,11 @@ const WORKSPACE_INDEX_ROUTE = createRoute({
558
616
  summary: "Index content for search",
559
617
  description: "Indexes content for later search operations",
560
618
  tags: ["Workspace"],
561
- handler: async ({ mastra, path, content, metadata, workspaceId }) => {
619
+ handler: async ({ mastra, requestContext, path, content, metadata, workspaceId }) => {
562
620
  try {
563
621
  requireWorkspaceV1Support();
564
622
  if (!path || content === void 0) throw new HTTPException(400, { message: "Path and content are required" });
565
- const workspace = await getWorkspaceById(mastra, workspaceId);
623
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
566
624
  if (!workspace) throw new HTTPException(404, { message: "No workspace configured" });
567
625
  if (!(workspace.canBM25 || workspace.canVector)) throw new HTTPException(400, { message: "Workspace does not have search configured" });
568
626
  await workspace.index(path, content, { metadata });
@@ -589,7 +647,7 @@ const WORKSPACE_LIST_SKILLS_ROUTE = createRoute({
589
647
  handler: async ({ mastra, workspaceId, requestContext }) => {
590
648
  try {
591
649
  requireWorkspaceV1Support();
592
- const workspace = await getWorkspaceById(mastra, workspaceId);
650
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
593
651
  const skills = workspace?.skills;
594
652
  if (!skills) return {
595
653
  skills: [],
@@ -642,7 +700,7 @@ const WORKSPACE_GET_SKILL_ROUTE = createRoute({
642
700
  requireWorkspaceV1Support();
643
701
  if (!skillName) throw new HTTPException(400, { message: "Skill name is required" });
644
702
  const identifier = path ?? skillName;
645
- const skills = await getSkillsById(mastra, workspaceId);
703
+ const skills = await getSkillsById(mastra, workspaceId, requestContext);
646
704
  if (!skills) throw new HTTPException(404, { message: "No workspace with skills configured" });
647
705
  await skills.maybeRefresh({ requestContext });
648
706
  const skill = await skills.get(identifier);
@@ -680,7 +738,7 @@ const WORKSPACE_LIST_SKILL_REFERENCES_ROUTE = createRoute({
680
738
  requireWorkspaceV1Support();
681
739
  if (!skillName) throw new HTTPException(400, { message: "Skill name is required" });
682
740
  const identifier = path ?? skillName;
683
- const skills = await getSkillsById(mastra, workspaceId);
741
+ const skills = await getSkillsById(mastra, workspaceId, requestContext);
684
742
  if (!skills) throw new HTTPException(404, { message: "No workspace with skills configured" });
685
743
  await skills.maybeRefresh({ requestContext });
686
744
  const skill = await skills.get(identifier);
@@ -709,7 +767,7 @@ const WORKSPACE_GET_SKILL_REFERENCE_ROUTE = createRoute({
709
767
  try {
710
768
  requireWorkspaceV1Support();
711
769
  const identifier = skillPath ?? skillName;
712
- const skills = await getSkillsById(mastra, workspaceId);
770
+ const skills = await getSkillsById(mastra, workspaceId, requestContext);
713
771
  if (!skills) throw new HTTPException(404, { message: "No workspace with skills configured" });
714
772
  await skills.maybeRefresh({ requestContext });
715
773
  const skill = await skills.get(identifier);
@@ -742,7 +800,7 @@ const WORKSPACE_SEARCH_SKILLS_ROUTE = createRoute({
742
800
  try {
743
801
  requireWorkspaceV1Support();
744
802
  if (!query) throw new HTTPException(400, { message: "Search query is required" });
745
- const skills = await getSkillsById(mastra, workspaceId);
803
+ const skills = await getSkillsById(mastra, workspaceId, requestContext);
746
804
  if (!skills) return {
747
805
  results: [],
748
806
  query
@@ -918,10 +976,10 @@ const WORKSPACE_SKILLS_SH_INSTALL_ROUTE = createRoute({
918
976
  summary: "Install skill from Skills API",
919
977
  description: "Installs a skill by fetching files from the Skills API and writing to workspace filesystem.",
920
978
  tags: ["Workspace", "Skills"],
921
- handler: async ({ mastra, workspaceId, owner, repo, skillName, mount }) => {
979
+ handler: async ({ mastra, requestContext, workspaceId, owner, repo, skillName, mount }) => {
922
980
  try {
923
981
  requireWorkspaceV1Support();
924
- const workspace = await getWorkspaceById(mastra, workspaceId);
982
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
925
983
  if (!workspace) throw new HTTPException(404, { message: "Workspace not found" });
926
984
  if (!workspace.filesystem) throw new HTTPException(400, { message: "Workspace filesystem not available" });
927
985
  if (workspace.filesystem.readOnly) throw new HTTPException(403, { message: "Workspace is read-only" });
@@ -982,10 +1040,10 @@ const WORKSPACE_SKILLS_SH_REMOVE_ROUTE = createRoute({
982
1040
  summary: "Remove an installed skill",
983
1041
  description: "Removes an installed skill by deleting its directory. Does not require sandbox.",
984
1042
  tags: ["Workspace", "Skills"],
985
- handler: async ({ mastra, workspaceId, skillName }) => {
1043
+ handler: async ({ mastra, requestContext, workspaceId, skillName }) => {
986
1044
  try {
987
1045
  requireWorkspaceV1Support();
988
- const workspace = await getWorkspaceById(mastra, workspaceId);
1046
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
989
1047
  if (!workspace) throw new HTTPException(404, { message: "Workspace not found" });
990
1048
  if (!workspace.filesystem) throw new HTTPException(400, { message: "Workspace filesystem not available" });
991
1049
  if (workspace.filesystem.readOnly) throw new HTTPException(403, { message: "Workspace is read-only" });
@@ -1023,10 +1081,10 @@ const WORKSPACE_SKILLS_SH_UPDATE_ROUTE = createRoute({
1023
1081
  summary: "Update installed skills",
1024
1082
  description: "Updates installed skills by re-fetching from GitHub. Specify skillName to update one, or omit to update all.",
1025
1083
  tags: ["Workspace", "Skills"],
1026
- handler: async ({ mastra, workspaceId, skillName }) => {
1084
+ handler: async ({ mastra, requestContext, workspaceId, skillName }) => {
1027
1085
  try {
1028
1086
  requireWorkspaceV1Support();
1029
- const workspace = await getWorkspaceById(mastra, workspaceId);
1087
+ const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);
1030
1088
  if (!workspace) throw new HTTPException(404, { message: "Workspace not found" });
1031
1089
  if (!workspace.filesystem) throw new HTTPException(400, { message: "Workspace filesystem not available" });
1032
1090
  if (workspace.filesystem.readOnly) throw new HTTPException(403, { message: "Workspace is read-only" });
@@ -1154,4 +1212,4 @@ const WORKSPACE_SKILLS_ROUTES = [
1154
1212
  ];
1155
1213
  export { WORKSPACE_SKILLS_SH_ROUTES as C, workspace_exports as E, WORKSPACE_SKILLS_SH_REMOVE_ROUTE as S, WORKSPACE_SKILLS_SH_UPDATE_ROUTE as T, WORKSPACE_SEARCH_SKILLS_ROUTE as _, WORKSPACE_FS_MKDIR_ROUTE as a, WORKSPACE_SKILLS_SH_POPULAR_ROUTE as b, WORKSPACE_FS_STAT_ROUTE as c, WORKSPACE_GET_SKILL_ROUTE as d, WORKSPACE_INDEX_ROUTE as f, WORKSPACE_SEARCH_ROUTES as g, WORKSPACE_SEARCH_ROUTE as h, WORKSPACE_FS_LIST_ROUTE as i, WORKSPACE_FS_WRITE_ROUTE as l, WORKSPACE_LIST_SKILL_REFERENCES_ROUTE as m, LIST_WORKSPACES_ROUTE as n, WORKSPACE_FS_READ_ROUTE as o, WORKSPACE_LIST_SKILLS_ROUTE as p, WORKSPACE_FS_DELETE_ROUTE as r, WORKSPACE_FS_ROUTES as s, GET_WORKSPACE_ROUTE as t, WORKSPACE_GET_SKILL_REFERENCE_ROUTE as u, WORKSPACE_SKILLS_ROUTES as v, WORKSPACE_SKILLS_SH_SEARCH_ROUTE as w, WORKSPACE_SKILLS_SH_PREVIEW_ROUTE as x, WORKSPACE_SKILLS_SH_INSTALL_ROUTE as y };
1156
1214
 
1157
- //# sourceMappingURL=workspace-BwlPQO3M.js.map
1215
+ //# sourceMappingURL=workspace-CbTB2svI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-CbTB2svI.js","names":[],"sources":["../src/server/handlers/workspace.ts"],"sourcesContent":["/**\n * Workspace Handlers\n *\n * Unified handlers for workspace operations including:\n * - Filesystem operations (read, write, list, delete, mkdir, stat)\n * - Search operations (search, index)\n * - Skills operations (list, get, search, references)\n */\n\nimport { coreFeatures } from '@mastra/core/features';\nimport type { RequestContext } from '@mastra/core/request-context';\nimport type { Workspace, WorkspaceSkills, WorkspaceFilesystem, CompositeFilesystem } from '@mastra/core/workspace';\n\nimport { HTTPException } from '../http-exception';\nimport {\n // Workspace info\n workspaceInfoResponseSchema,\n listWorkspacesResponseSchema,\n workspaceIdPathParams,\n // Filesystem schemas\n fsReadQuerySchema,\n fsListQuerySchema,\n fsStatQuerySchema,\n fsDeleteQuerySchema,\n fsWriteBodySchema,\n fsMkdirBodySchema,\n fsReadResponseSchema,\n fsWriteResponseSchema,\n fsListResponseSchema,\n fsDeleteResponseSchema,\n fsMkdirResponseSchema,\n fsStatResponseSchema,\n // Search schemas\n searchQuerySchema,\n searchResponseSchema,\n indexBodySchema,\n indexResponseSchema,\n // Skills schemas\n skillNamePathParams,\n skillDisambiguationQuerySchema,\n skillReferencePathParams,\n searchSkillsQuerySchema,\n listSkillsResponseSchema,\n getSkillResponseSchema,\n skillReferenceResponseSchema,\n listReferencesResponseSchema,\n searchSkillsResponseSchema,\n // skills.sh proxy schemas\n skillsShSearchQuerySchema,\n skillsShPopularQuerySchema,\n skillsShSearchResponseSchema,\n skillsShListResponseSchema,\n skillsShPreviewQuerySchema,\n skillsShInstallBodySchema,\n skillsShInstallResponseSchema,\n skillsShPreviewResponseSchema,\n skillsShRemoveBodySchema,\n skillsShRemoveResponseSchema,\n skillsShUpdateBodySchema,\n skillsShUpdateResponseSchema,\n} from '../schemas/workspace';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredAgentAccess, listAgentsVisibleTo } from './agent-access';\nimport { assertReadAccess } from './authorship';\nimport { handleError } from './error';\n\n// =============================================================================\n// Constants\n// =============================================================================\n\n/** Directory path for skills installed via skills.sh */\nconst SKILLS_SH_DIR = '.agents/skills';\n\n// =============================================================================\n// Helper Functions\n// =============================================================================\n\n/**\n * Runtime check for CompositeFilesystem using duck typing.\n * Uses a type-only import so older @mastra/core versions (< 1.3.0) work fine.\n */\nfunction isCompositeFilesystem(fs: unknown): fs is CompositeFilesystem {\n return !!fs && typeof fs === 'object' && 'mounts' in fs && fs.mounts instanceof Map;\n}\n\n/**\n * Check if an error is a workspace filesystem not-found error.\n * Handles Node.js ENOENT and workspace FileNotFoundError/DirectoryNotFoundError.\n */\nfunction isFilesystemNotFoundError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n\n // Check for Node.js native ENOENT\n if ('code' in error && error.code === 'ENOENT') return true;\n\n // Check for workspace FileNotFoundError / DirectoryNotFoundError\n if ('name' in error) {\n const name = error.name;\n if (name === 'FileNotFoundError' || name === 'DirectoryNotFoundError') return true;\n }\n\n return false;\n}\n\n/**\n * Check if an error is a workspace filesystem permission error.\n * Handles Node.js EACCES and workspace PermissionError.\n */\nfunction isFilesystemPermissionError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n\n if ('code' in error && error.code === 'EACCES') return true;\n\n if ('name' in error && error.name === 'PermissionError') return true;\n\n return false;\n}\n\n/**\n * Workspace-specific error handler.\n * Converts filesystem errors to appropriate HTTP status codes,\n * then falls back to generic handler.\n */\nfunction handleWorkspaceError(error: unknown, defaultMessage: string): never {\n if (isFilesystemNotFoundError(error)) {\n const message = error instanceof Error ? error.message : 'Not found';\n throw new HTTPException(404, { message });\n }\n if (isFilesystemPermissionError(error)) {\n const message = error instanceof Error ? error.message : 'Permission denied';\n throw new HTTPException(403, { message });\n }\n return handleError(error, defaultMessage);\n}\n\n/**\n * Throws if workspace v1 is not supported by the current version of @mastra/core.\n */\nfunction requireWorkspaceV1Support(): void {\n if (!coreFeatures.has('workspaces-v1')) {\n throw new HTTPException(501, {\n message: 'Workspace v1 not supported by this version of @mastra/core. Please upgrade to a newer version.',\n });\n }\n}\n\n/**\n * Get a workspace by ID from Mastra's workspace registry.\n *\n * Backwards compatible: Falls back to searching through agents if\n * mastra.getWorkspaceById() is not available (older @mastra/core versions).\n */\nasync function getWorkspaceById(\n mastra: any,\n workspaceId: string,\n requestContext: RequestContext,\n): Promise<Workspace | undefined> {\n requireWorkspaceV1Support();\n\n // Check if the global workspace matches\n const globalWorkspace = mastra.getWorkspace?.();\n if (globalWorkspace?.id === workspaceId) {\n return globalWorkspace;\n }\n\n // Try direct registry lookup if available (newer @mastra/core versions)\n if (typeof mastra.getWorkspaceById === 'function') {\n let workspace: Workspace | undefined;\n try {\n workspace = mastra.getWorkspaceById(workspaceId);\n } catch {\n // Workspace not found in registry\n return undefined;\n }\n // A stored agent's workspace is as private as the agent: treat it as missing for callers who can't see the agent.\n const entry = typeof mastra.listWorkspaces === 'function' ? mastra.listWorkspaces()[workspaceId] : undefined;\n if (entry?.source === 'agent' && entry.agentId) {\n if (\n !(await isAgentWorkspaceVisible(\n mastra,\n { agentId: entry.agentId, agentSource: entry.agentSource },\n requestContext,\n ))\n )\n return undefined;\n }\n return workspace;\n }\n\n // Fallback: Search through agents for the workspace (older @mastra/core versions)\n const agents = listAgentsVisibleTo(mastra.listAgents?.(), requestContext);\n for (const agent of Object.values(agents)) {\n if ((agent as any).hasOwnWorkspace?.()) {\n const agentWorkspace = await (agent as any).getWorkspace?.();\n if (agentWorkspace?.id === workspaceId) {\n return agentWorkspace;\n }\n }\n }\n\n return undefined;\n}\n\n/**\n * Get skills from a specific workspace by ID.\n * Note: getWorkspaceById already checks for workspace v1 support.\n */\nasync function getSkillsById(\n mastra: any,\n workspaceId: string,\n requestContext: RequestContext,\n): Promise<WorkspaceSkills | undefined> {\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n return workspace?.skills;\n}\n\n/**\n * Agents register their workspace once used, so a registered workspace can belong to a stored agent the caller can't\n * see. Editing a stored agent unregisters it from Mastra but leaves its workspace registered, so an agent that isn't\n * registered is checked against its stored record. With no record, a workspace a stored agent registered is hidden:\n * its agent was deleted, and an async workspace factory can still register it after the delete's cleanup. Lookup\n * errors hide the workspace.\n */\nasync function isAgentWorkspaceVisible(\n mastra: any,\n entry: { agentId: string; agentSource?: string },\n requestContext: RequestContext,\n): Promise<boolean> {\n const { agentId } = entry;\n try {\n let agent;\n try {\n agent = mastra.getAgentById(agentId);\n } catch {\n agent = undefined;\n }\n if (agent) {\n assertStoredAgentAccess({ agent, agentId, requestContext, access: 'read' });\n return true;\n }\n const agentsStore = await mastra.getStorage()?.getStore('agents');\n const record = await agentsStore?.getById(agentId);\n if (record) {\n assertReadAccess({ requestContext, resource: 'stored-agents', resourceId: agentId, record });\n return true;\n }\n return entry.agentSource !== 'stored';\n } catch {\n return false;\n }\n}\n\n/**\n * Build the install path for a skill from skills.sh.\n *\n * For CompositeFilesystem: resolves the requested mount (or first writable),\n * validates it is writable, and returns `<mount>/.agents/skills/<skillId>`.\n * For non-composite: returns `.agents/skills/<skillId>` (unchanged behavior).\n */\n/** Strip a single trailing slash (leaves `/` alone). */\nfunction stripTrailingSlash(p: string): string {\n return p.length > 1 && p.endsWith('/') ? p.slice(0, -1) : p;\n}\n\nfunction buildSkillInstallPath(filesystem: WorkspaceFilesystem, safeSkillId: string, requestedMount?: string): string {\n if (isCompositeFilesystem(filesystem)) {\n if (requestedMount) {\n // Validate the requested mount exists\n const mountFs = filesystem.mounts.get(requestedMount);\n if (!mountFs) {\n throw new HTTPException(400, {\n message: `Mount \"${requestedMount}\" not found. Available mounts: ${filesystem.mountPaths.join(', ')}`,\n });\n }\n if (mountFs.readOnly) {\n throw new HTTPException(403, { message: `Mount \"${requestedMount}\" is read-only` });\n }\n return `${stripTrailingSlash(requestedMount)}/${SKILLS_SH_DIR}/${safeSkillId}`;\n }\n\n // Default: use first writable mount\n for (const [mountPath, mountFs] of filesystem.mounts) {\n if (!mountFs.readOnly) {\n return `${stripTrailingSlash(mountPath)}/${SKILLS_SH_DIR}/${safeSkillId}`;\n }\n }\n\n throw new HTTPException(403, { message: 'No writable mount available for skill installation' });\n }\n\n // Non-composite: standard path\n return `${SKILLS_SH_DIR}/${safeSkillId}`;\n}\n\n// =============================================================================\n// List All Workspaces Route\n// =============================================================================\n\nexport const LIST_WORKSPACES_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces',\n responseType: 'json',\n responseSchema: listWorkspacesResponseSchema,\n summary: 'List all workspaces',\n description: 'Returns all workspaces from both Mastra instance and agents',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext }) => {\n try {\n requireWorkspaceV1Support();\n\n const workspaces: Array<{\n id: string;\n name: string;\n status: string;\n source: 'mastra' | 'agent';\n agentId?: string;\n agentName?: string;\n capabilities: {\n hasFilesystem: boolean;\n hasDynamicFilesystem: boolean;\n hasSandbox: boolean;\n canBM25: boolean;\n canVector: boolean;\n canHybrid: boolean;\n hasSkills: boolean;\n };\n safety: {\n readOnly: boolean;\n };\n }> = [];\n\n // Prefer the workspace registry if available (duck-type check for newer @mastra/core).\n // This avoids calling dynamic workspace functions without proper request context.\n // Dynamic workspaces get lazily registered during agent execution (stream/generate).\n if (typeof mastra.listWorkspaces === 'function') {\n const registeredWorkspaces = mastra.listWorkspaces();\n\n for (const [, entry] of Object.entries(registeredWorkspaces)) {\n // Newer @mastra/core returns { workspace, source, agentId?, agentName? }.\n // Older versions return a bare Workspace object — detect via duck-typing.\n const ws: Workspace = (entry as any).workspace ?? entry;\n const source: 'mastra' | 'agent' = (entry as any).source ?? 'mastra';\n const agentId: string | undefined = (entry as any).agentId;\n const agentName: string | undefined = (entry as any).agentName;\n // Agents register their workspace here once used; skip those of stored agents the caller can't see.\n const agentSource: string | undefined = (entry as any).agentSource;\n if (\n source === 'agent' &&\n agentId &&\n !(await isAgentWorkspaceVisible(mastra, { agentId, agentSource }, requestContext))\n ) {\n continue;\n }\n\n workspaces.push({\n id: ws.id,\n name: ws.name,\n status: ws.status,\n source,\n ...(source === 'agent' && agentId ? { agentId, ...(agentName != null ? { agentName } : {}) } : {}),\n capabilities: {\n hasFilesystem: ws.hasFilesystemConfig(),\n hasDynamicFilesystem: !ws.filesystem && ws.hasFilesystemConfig(),\n hasSandbox: ws.hasSandboxConfig(),\n canBM25: ws.canBM25,\n canVector: ws.canVector,\n canHybrid: ws.canHybrid,\n hasSkills: !!ws.skills,\n },\n safety: {\n readOnly: ws.filesystem?.readOnly ?? false,\n },\n });\n }\n } else {\n // Fallback for older @mastra/core without workspace registry:\n // Check global workspace and loop through agents\n const seenIds = new Set<string>();\n const globalWorkspace = mastra.getWorkspace?.();\n if (globalWorkspace) {\n seenIds.add(globalWorkspace.id);\n workspaces.push({\n id: globalWorkspace.id,\n name: globalWorkspace.name,\n status: globalWorkspace.status,\n source: 'mastra',\n capabilities: {\n hasFilesystem: globalWorkspace.hasFilesystemConfig(),\n hasDynamicFilesystem: !globalWorkspace.filesystem && globalWorkspace.hasFilesystemConfig(),\n hasSandbox: globalWorkspace.hasSandboxConfig(),\n canBM25: globalWorkspace.canBM25,\n canVector: globalWorkspace.canVector,\n canHybrid: globalWorkspace.canHybrid,\n hasSkills: !!globalWorkspace.skills,\n },\n safety: {\n readOnly: globalWorkspace.filesystem?.readOnly ?? false,\n },\n });\n }\n\n const agents = listAgentsVisibleTo(mastra.listAgents?.(), requestContext);\n for (const [agentId, agent] of Object.entries(agents)) {\n if ((agent as any).hasOwnWorkspace?.()) {\n try {\n const agentWorkspace = await (agent as any).getWorkspace?.();\n if (agentWorkspace && !seenIds.has(agentWorkspace.id)) {\n seenIds.add(agentWorkspace.id);\n workspaces.push({\n id: agentWorkspace.id,\n name: agentWorkspace.name,\n status: agentWorkspace.status,\n source: 'agent',\n agentId,\n agentName: (agent as any).name,\n capabilities: {\n hasFilesystem: agentWorkspace.hasFilesystemConfig(),\n hasDynamicFilesystem: !agentWorkspace.filesystem && agentWorkspace.hasFilesystemConfig(),\n hasSandbox: agentWorkspace.hasSandboxConfig(),\n canBM25: agentWorkspace.canBM25,\n canVector: agentWorkspace.canVector,\n canHybrid: agentWorkspace.canHybrid,\n hasSkills: !!agentWorkspace.skills,\n },\n safety: {\n readOnly: agentWorkspace.filesystem?.readOnly ?? false,\n },\n });\n }\n } catch {\n continue;\n }\n }\n }\n }\n\n return { workspaces };\n } catch (error) {\n return handleWorkspaceError(error, 'Error listing workspaces');\n }\n },\n});\n\n// =============================================================================\n// Get Workspace Route\n// =============================================================================\n\nexport const GET_WORKSPACE_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n responseSchema: workspaceInfoResponseSchema,\n summary: 'Get workspace info',\n description: 'Returns information about a specific workspace and its capabilities',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext, workspaceId }) => {\n try {\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n\n if (!workspace) {\n return {\n isWorkspaceConfigured: false,\n };\n }\n\n const fsInfo = await workspace.filesystem?.getInfo?.();\n\n // Build mounts array for CompositeFilesystem\n let mounts:\n | Array<{\n path: string;\n provider: string;\n readOnly: boolean;\n displayName?: string;\n icon?: string;\n name?: string;\n }>\n | undefined;\n\n if (isCompositeFilesystem(workspace.filesystem)) {\n mounts = [];\n for (const [mountPath, mountFs] of workspace.filesystem.mounts) {\n try {\n const info = await mountFs.getInfo?.();\n mounts.push({\n path: mountPath,\n provider: info?.provider ?? mountFs.provider ?? 'unknown',\n readOnly: mountFs.readOnly ?? false,\n displayName: mountFs.displayName ?? info?.name ?? mountFs.name,\n icon: info?.icon,\n name: mountFs.name,\n });\n } catch {\n mounts.push({\n path: mountPath,\n provider: mountFs.provider ?? 'unknown',\n readOnly: mountFs.readOnly ?? true,\n name: mountFs.name,\n });\n }\n }\n }\n\n return {\n isWorkspaceConfigured: true,\n id: workspace.id,\n name: workspace.name,\n status: workspace.status,\n capabilities: {\n hasFilesystem: workspace.hasFilesystemConfig(),\n hasDynamicFilesystem: !workspace.filesystem && workspace.hasFilesystemConfig(),\n hasSandbox: workspace.hasSandboxConfig(),\n canBM25: workspace.canBM25,\n canVector: workspace.canVector,\n canHybrid: workspace.canHybrid,\n hasSkills: !!workspace.skills,\n },\n safety: {\n readOnly: workspace.filesystem?.readOnly ?? false,\n },\n filesystem: fsInfo\n ? {\n id: fsInfo.id,\n name: fsInfo.name,\n provider: fsInfo.provider,\n status: fsInfo.status,\n error: fsInfo.error,\n readOnly: fsInfo.readOnly,\n icon: fsInfo.icon,\n metadata: fsInfo.metadata,\n }\n : undefined,\n mounts,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error getting workspace info');\n }\n },\n});\n\n// =============================================================================\n// Filesystem Routes\n// =============================================================================\n\nexport const WORKSPACE_FS_READ_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/fs/read',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n queryParamSchema: fsReadQuerySchema,\n responseSchema: fsReadResponseSchema,\n summary: 'Read file content',\n description: 'Returns the content of a file at the specified path',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext, path, encoding, workspaceId }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!path) {\n throw new HTTPException(400, { message: 'Path is required' });\n }\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace?.filesystem) {\n throw new HTTPException(404, { message: 'No workspace filesystem configured' });\n }\n\n const decodedPath = path;\n\n // Check if path exists\n if (!(await workspace.filesystem.exists(decodedPath))) {\n throw new HTTPException(404, { message: `Path \"${decodedPath}\" not found` });\n }\n\n // Read file content\n const content = await workspace.filesystem.readFile(decodedPath, {\n encoding: (encoding as BufferEncoding) || 'utf-8',\n });\n\n return {\n path: decodedPath,\n content: typeof content === 'string' ? content : content.toString('utf-8'),\n type: 'file' as const,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error reading file');\n }\n },\n});\n\nexport const WORKSPACE_FS_WRITE_ROUTE = createRoute({\n method: 'POST',\n path: '/workspaces/:workspaceId/fs/write',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n bodySchema: fsWriteBodySchema,\n responseSchema: fsWriteResponseSchema,\n summary: 'Write file content',\n description: 'Writes content to a file at the specified path. Supports base64 encoding for binary files.',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext, path, content, encoding, recursive, workspaceId }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!path || content === undefined) {\n throw new HTTPException(400, { message: 'Path and content are required' });\n }\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace?.filesystem) {\n throw new HTTPException(404, { message: 'No workspace filesystem configured' });\n }\n\n if (workspace.filesystem?.readOnly) {\n throw new HTTPException(403, { message: 'Workspace is in read-only mode' });\n }\n\n const decodedPath = path;\n\n // Handle base64-encoded content for binary files\n let fileContent: string | Buffer = content;\n if (encoding === 'base64') {\n fileContent = Buffer.from(content, 'base64');\n }\n\n await workspace.filesystem.writeFile(decodedPath, fileContent, { recursive: recursive ?? true });\n\n return {\n success: true,\n path: decodedPath,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error writing file');\n }\n },\n});\n\nexport const WORKSPACE_FS_LIST_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/fs/list',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n queryParamSchema: fsListQuerySchema,\n responseSchema: fsListResponseSchema,\n summary: 'List directory contents',\n description: 'Returns a list of files and directories at the specified path',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext, path, recursive, workspaceId }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!path) {\n throw new HTTPException(400, { message: 'Path is required' });\n }\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace?.filesystem) {\n return {\n path,\n entries: [],\n error: 'No workspace filesystem configured',\n };\n }\n\n const decodedPath = path;\n\n // Check if path exists\n if (!(await workspace.filesystem.exists(decodedPath))) {\n throw new HTTPException(404, { message: `Path \"${decodedPath}\" not found` });\n }\n\n const entries = await workspace.filesystem.readdir(decodedPath, { recursive });\n\n return {\n path: decodedPath,\n entries,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error listing directory');\n }\n },\n});\n\nexport const WORKSPACE_FS_DELETE_ROUTE = createRoute({\n method: 'DELETE',\n path: '/workspaces/:workspaceId/fs/delete',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n queryParamSchema: fsDeleteQuerySchema,\n responseSchema: fsDeleteResponseSchema,\n summary: 'Delete file or directory',\n description: 'Deletes a file or directory at the specified path',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext, path, recursive, force, workspaceId }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!path) {\n throw new HTTPException(400, { message: 'Path is required' });\n }\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace?.filesystem) {\n throw new HTTPException(404, { message: 'No workspace filesystem configured' });\n }\n\n if (workspace.filesystem?.readOnly) {\n throw new HTTPException(403, { message: 'Workspace is in read-only mode' });\n }\n\n const decodedPath = path;\n\n // Check if path exists (unless force is true)\n const exists = await workspace.filesystem.exists(decodedPath);\n if (!exists && !force) {\n throw new HTTPException(404, { message: `Path \"${decodedPath}\" not found` });\n }\n\n if (exists) {\n // Try to delete as file first, then as directory\n try {\n await workspace.filesystem.deleteFile(decodedPath, { force });\n } catch {\n await workspace.filesystem.rmdir(decodedPath, { recursive, force });\n }\n }\n\n return {\n success: true,\n path: decodedPath,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error deleting path');\n }\n },\n});\n\nexport const WORKSPACE_FS_MKDIR_ROUTE = createRoute({\n method: 'POST',\n path: '/workspaces/:workspaceId/fs/mkdir',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n bodySchema: fsMkdirBodySchema,\n responseSchema: fsMkdirResponseSchema,\n summary: 'Create directory',\n description: 'Creates a directory at the specified path',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext, path, recursive, workspaceId }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!path) {\n throw new HTTPException(400, { message: 'Path is required' });\n }\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace?.filesystem) {\n throw new HTTPException(404, { message: 'No workspace filesystem configured' });\n }\n\n if (workspace.filesystem?.readOnly) {\n throw new HTTPException(403, { message: 'Workspace is in read-only mode' });\n }\n\n const decodedPath = path;\n\n await workspace.filesystem.mkdir(decodedPath, { recursive: recursive ?? true });\n\n return {\n success: true,\n path: decodedPath,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error creating directory');\n }\n },\n});\n\nexport const WORKSPACE_FS_STAT_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/fs/stat',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n queryParamSchema: fsStatQuerySchema,\n responseSchema: fsStatResponseSchema,\n summary: 'Get file/directory info',\n description: 'Returns metadata about a file or directory',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext, path, workspaceId }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!path) {\n throw new HTTPException(400, { message: 'Path is required' });\n }\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace?.filesystem) {\n throw new HTTPException(404, { message: 'No workspace filesystem configured' });\n }\n\n const decodedPath = path;\n\n // Check if path exists\n if (!(await workspace.filesystem.exists(decodedPath))) {\n throw new HTTPException(404, { message: `Path \"${decodedPath}\" not found` });\n }\n\n const stat = await workspace.filesystem.stat(decodedPath);\n\n return {\n path: stat.path,\n type: stat.type,\n size: stat.size,\n createdAt: stat.createdAt?.toISOString(),\n modifiedAt: stat.modifiedAt?.toISOString(),\n mimeType: stat.mimeType,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error getting file info');\n }\n },\n});\n\n// =============================================================================\n// Search Routes\n// =============================================================================\n\nexport const WORKSPACE_SEARCH_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/search',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n queryParamSchema: searchQuerySchema,\n responseSchema: searchResponseSchema,\n summary: 'Search workspace content',\n description: 'Searches across indexed workspace content using BM25, vector, or hybrid search',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext, query, topK, mode, minScore, workspaceId }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!query) {\n throw new HTTPException(400, { message: 'Search query is required' });\n }\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace) {\n return {\n results: [],\n query,\n mode: mode || 'bm25',\n };\n }\n\n // Check search capabilities\n const canSearch = workspace.canBM25 || workspace.canVector;\n if (!canSearch) {\n return {\n results: [],\n query,\n mode: mode || 'bm25',\n };\n }\n\n // Determine search mode based on capabilities\n let searchMode = mode;\n if (!searchMode) {\n if (workspace.canHybrid) {\n searchMode = 'hybrid';\n } else if (workspace.canVector) {\n searchMode = 'vector';\n } else {\n searchMode = 'bm25';\n }\n }\n\n const results = await workspace.search(query, {\n topK: topK || 5,\n mode: searchMode,\n minScore,\n });\n\n return {\n results: results.map(r => ({\n id: r.id,\n content: r.content,\n score: r.score,\n lineRange: r.lineRange,\n scoreDetails: r.scoreDetails,\n })),\n query,\n mode: searchMode,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error searching workspace');\n }\n },\n});\n\nexport const WORKSPACE_INDEX_ROUTE = createRoute({\n method: 'POST',\n path: '/workspaces/:workspaceId/index',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n bodySchema: indexBodySchema,\n responseSchema: indexResponseSchema,\n summary: 'Index content for search',\n description: 'Indexes content for later search operations',\n tags: ['Workspace'],\n handler: async ({ mastra, requestContext, path, content, metadata, workspaceId }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!path || content === undefined) {\n throw new HTTPException(400, { message: 'Path and content are required' });\n }\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace) {\n throw new HTTPException(404, { message: 'No workspace configured' });\n }\n\n const canSearch = workspace.canBM25 || workspace.canVector;\n if (!canSearch) {\n throw new HTTPException(400, { message: 'Workspace does not have search configured' });\n }\n\n await workspace.index(path, content, { metadata });\n\n return {\n success: true,\n path,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error indexing content');\n }\n },\n});\n\n// =============================================================================\n// Skills Routes (under /workspaces/:workspaceId/skills)\n// =============================================================================\n\n/** Path prefix for skills installed via skills.sh (with trailing slash for prefix matching) */\nconst SKILLS_SH_PATH_PREFIX = `${SKILLS_SH_DIR}/`;\n\nexport const WORKSPACE_LIST_SKILLS_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/skills',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n responseSchema: listSkillsResponseSchema,\n summary: 'List all skills',\n description: 'Returns a list of all discovered skills with their metadata',\n tags: ['Workspace', 'Skills'],\n handler: async ({ mastra, workspaceId, requestContext }) => {\n try {\n requireWorkspaceV1Support();\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n const skills = workspace?.skills;\n if (!skills) {\n return { skills: [], isSkillsConfigured: false };\n }\n\n // Refresh skills with request context (handles dynamic skill resolvers)\n await skills.maybeRefresh({ requestContext });\n\n const skillsList = await skills.list();\n\n // Enrich skills with skills.sh source info where applicable\n const enrichedSkills = await Promise.all(\n skillsList.map(async skillMeta => {\n let skillsShSource: { owner: string; repo: string } | undefined;\n\n // For skills installed via skills.sh, read source info from .meta.json.\n // Uses includes() because glob-discovered paths may have a leading slash\n // or be nested (e.g., '/.agents/skills/foo', '/src/.agents/skills/foo').\n if (skillMeta.path.includes(SKILLS_SH_PATH_PREFIX) && workspace.filesystem) {\n try {\n const metaPath = `${skillMeta.path}/.meta.json`;\n const metaContent = await workspace.filesystem.readFile(metaPath);\n const metaText = typeof metaContent === 'string' ? metaContent : metaContent.toString('utf-8');\n const meta = JSON.parse(metaText) as { owner?: string; repo?: string };\n if (meta.owner && meta.repo) {\n skillsShSource = { owner: meta.owner, repo: meta.repo };\n }\n } catch {\n // .meta.json might not exist or be invalid - that's ok\n }\n }\n\n return {\n name: skillMeta.name,\n description: skillMeta.description,\n license: skillMeta.license,\n compatibility: skillMeta.compatibility,\n metadata: skillMeta.metadata,\n path: skillMeta.path,\n skillsShSource,\n };\n }),\n );\n\n return {\n skills: enrichedSkills,\n isSkillsConfigured: true,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error listing skills');\n }\n },\n});\n\nexport const WORKSPACE_GET_SKILL_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/skills/:skillName',\n responseType: 'json',\n pathParamSchema: skillNamePathParams,\n queryParamSchema: skillDisambiguationQuerySchema,\n responseSchema: getSkillResponseSchema,\n summary: 'Get skill details',\n description: 'Returns the full details of a specific skill including instructions and file lists',\n tags: ['Workspace', 'Skills'],\n handler: async ({ mastra, skillName, path, workspaceId, requestContext }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!skillName) {\n throw new HTTPException(400, { message: 'Skill name is required' });\n }\n\n // Use the optional ?path= query param for disambiguation, otherwise fall back to name\n const identifier = path ?? skillName;\n\n const skills = await getSkillsById(mastra, workspaceId, requestContext);\n if (!skills) {\n throw new HTTPException(404, { message: 'No workspace with skills configured' });\n }\n\n // Refresh skills with request context (handles dynamic skill resolvers)\n await skills.maybeRefresh({ requestContext });\n\n const skill = await skills.get(identifier);\n if (!skill) {\n throw new HTTPException(404, { message: `Skill \"${identifier}\" not found` });\n }\n\n return {\n name: skill.name,\n description: skill.description,\n license: skill.license,\n compatibility: skill.compatibility,\n metadata: skill.metadata,\n path: skill.path,\n instructions: skill.instructions,\n source: skill.source,\n references: skill.references,\n scripts: skill.scripts,\n assets: skill.assets,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error getting skill');\n }\n },\n});\n\nexport const WORKSPACE_LIST_SKILL_REFERENCES_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/skills/:skillName/references',\n responseType: 'json',\n pathParamSchema: skillNamePathParams,\n queryParamSchema: skillDisambiguationQuerySchema,\n responseSchema: listReferencesResponseSchema,\n summary: 'List skill references',\n description: 'Returns a list of all reference file paths for a skill',\n tags: ['Workspace', 'Skills'],\n handler: async ({ mastra, skillName, path, workspaceId, requestContext }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!skillName) {\n throw new HTTPException(400, { message: 'Skill name is required' });\n }\n\n // Use the optional ?path= query param for disambiguation, otherwise fall back to name\n const identifier = path ?? skillName;\n\n const skills = await getSkillsById(mastra, workspaceId, requestContext);\n if (!skills) {\n throw new HTTPException(404, { message: 'No workspace with skills configured' });\n }\n\n // Refresh skills with request context (handles dynamic skill resolvers)\n await skills.maybeRefresh({ requestContext });\n\n const skill = await skills.get(identifier);\n if (!skill) {\n throw new HTTPException(404, { message: `Skill \"${identifier}\" not found` });\n }\n\n const references = await skills.listReferences(identifier);\n\n return {\n skillName: skill.name,\n references,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error listing skill references');\n }\n },\n});\n\nexport const WORKSPACE_GET_SKILL_REFERENCE_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/skills/:skillName/references/:referencePath',\n responseType: 'json',\n pathParamSchema: skillReferencePathParams,\n queryParamSchema: skillDisambiguationQuerySchema,\n responseSchema: skillReferenceResponseSchema,\n summary: 'Get skill reference content',\n description: 'Returns the content of a specific reference file from a skill',\n tags: ['Workspace', 'Skills'],\n handler: async ({ mastra, skillName, path: skillPath, referencePath, workspaceId, requestContext }) => {\n try {\n requireWorkspaceV1Support();\n\n // Use the optional ?path= query param for disambiguation, otherwise fall back to name\n const identifier = skillPath ?? skillName;\n\n const skills = await getSkillsById(mastra, workspaceId, requestContext);\n if (!skills) {\n throw new HTTPException(404, { message: 'No workspace with skills configured' });\n }\n\n // Refresh skills with request context (handles dynamic skill resolvers)\n await skills.maybeRefresh({ requestContext });\n\n // Resolve skill to get its name for the response\n const skill = await skills.get(identifier);\n if (!skill) {\n throw new HTTPException(404, { message: `Skill \"${identifier}\" not found` });\n }\n\n const decodedPath = referencePath;\n\n // Prevent path traversal via the reference path parameter\n assertSafeFilePath(decodedPath);\n\n // getReference expects a path relative to skill.path, so prepend 'references/'\n // since the URL path already contains the literal /references/ segment\n const content = await skills.getReference(identifier, `references/${decodedPath}`);\n if (content === null) {\n throw new HTTPException(404, {\n message: `Reference \"${decodedPath}\" not found in skill \"${identifier}\"`,\n });\n }\n\n return {\n skillName: skill.name,\n referencePath: decodedPath,\n content,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error getting skill reference');\n }\n },\n});\n\nexport const WORKSPACE_SEARCH_SKILLS_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/skills/search',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n queryParamSchema: searchSkillsQuerySchema,\n responseSchema: searchSkillsResponseSchema,\n summary: 'Search skills',\n description: 'Searches across all skills content using BM25 keyword search',\n tags: ['Workspace', 'Skills'],\n handler: async ({ mastra, query, topK, minScore, skillNames, includeReferences, workspaceId, requestContext }) => {\n try {\n requireWorkspaceV1Support();\n\n if (!query) {\n throw new HTTPException(400, { message: 'Search query is required' });\n }\n\n const skills = await getSkillsById(mastra, workspaceId, requestContext);\n if (!skills) {\n return {\n results: [],\n query,\n };\n }\n\n // Refresh skills with request context (handles dynamic skill resolvers)\n await skills.maybeRefresh({ requestContext });\n\n // Parse comma-separated skill names if provided\n const skillNamesList = skillNames ? skillNames.split(',').map((s: string) => s.trim()) : undefined;\n\n const results = await skills.search(query, {\n topK: topK || 5,\n minScore,\n skillNames: skillNamesList,\n includeReferences: includeReferences ?? true,\n });\n\n return {\n results: results.map(r => ({\n skillName: r.skillName,\n skillPath: r.skillPath,\n source: r.source,\n content: r.content,\n score: r.score,\n lineRange: r.lineRange,\n scoreDetails: r.scoreDetails,\n })),\n query,\n };\n } catch (error) {\n return handleWorkspaceError(error, 'Error searching skills');\n }\n },\n});\n\n// =============================================================================\n// skills.sh Proxy Routes\n// =============================================================================\n\nconst SKILLS_SH_API_URL = 'https://skills-api-production.up.railway.app';\n\nexport const WORKSPACE_SKILLS_SH_SEARCH_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/skills-sh/search',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n queryParamSchema: skillsShSearchQuerySchema,\n responseSchema: skillsShSearchResponseSchema,\n summary: 'Search skills on skills.sh',\n description: 'Proxies search requests to skills.sh API to avoid CORS issues',\n tags: ['Workspace', 'Skills'],\n handler: async ({ q, limit }) => {\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 10000);\n\n const url = `${SKILLS_SH_API_URL}/api/skills?query=${encodeURIComponent(q)}&pageSize=${limit}`;\n const response = await fetch(url, { signal: controller.signal });\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n throw new HTTPException(502, {\n message: `Skills API error: ${response.status} ${response.statusText}`,\n });\n }\n\n const data = (await response.json()) as {\n skills: Array<{\n skillId: string;\n name: string;\n installs: number;\n source: string;\n owner: string;\n repo: string;\n githubUrl: string;\n displayName: string;\n }>;\n total: number;\n page: number;\n pageSize: number;\n totalPages: number;\n };\n return {\n query: q,\n searchType: 'query',\n skills: data.skills.map(s => ({ id: s.skillId, name: s.name, installs: s.installs, topSource: s.source })),\n count: data.total,\n };\n } catch (error) {\n if (error instanceof HTTPException) {\n throw error;\n }\n return handleError(error, 'Error searching skills');\n }\n },\n});\n\nexport const WORKSPACE_SKILLS_SH_POPULAR_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/skills-sh/popular',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n queryParamSchema: skillsShPopularQuerySchema,\n responseSchema: skillsShListResponseSchema,\n summary: 'Get popular skills from skills.sh',\n description: 'Proxies popular skills requests to skills.sh API to avoid CORS issues',\n tags: ['Workspace', 'Skills'],\n handler: async ({ limit, offset }) => {\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 10000);\n\n const page = offset > 0 ? Math.floor(offset / limit) + 1 : 1;\n const url = `${SKILLS_SH_API_URL}/api/skills/top?pageSize=${limit}&page=${page}`;\n const response = await fetch(url, { signal: controller.signal });\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n throw new HTTPException(502, {\n message: `Skills API error: ${response.status} ${response.statusText}`,\n });\n }\n\n const data = (await response.json()) as {\n skills: Array<{\n skillId: string;\n name: string;\n installs: number;\n source: string;\n owner: string;\n repo: string;\n githubUrl: string;\n displayName: string;\n }>;\n total: number;\n };\n return {\n skills: data.skills.map(s => ({ id: s.skillId, name: s.name, installs: s.installs, topSource: s.source })),\n count: data.total,\n limit,\n offset,\n };\n } catch (error) {\n if (error instanceof HTTPException) {\n throw error;\n }\n return handleError(error, 'Error fetching popular skills');\n }\n },\n});\n\n// =============================================================================\n// Skills API helpers\n// =============================================================================\n\n/**\n * Validate skill name to prevent path traversal attacks.\n * Only allows alphanumeric characters, hyphens, and underscores.\n */\nconst SKILL_NAME_REGEX = /^[a-z0-9][a-z0-9-_]*$/i;\n\nfunction assertSafeSkillName(name: string): string {\n if (!SKILL_NAME_REGEX.test(name)) {\n throw new HTTPException(400, {\n message: `Invalid skill name \"${name}\". Names must start with alphanumeric and contain only letters, numbers, hyphens, and underscores.`,\n });\n }\n return name;\n}\n\n/**\n * Validate that a file path is safe (no traversal, no absolute paths).\n * Prevents malicious API responses from writing files outside the skill directory.\n */\nfunction assertSafeFilePath(filePath: string): string {\n // Reject absolute paths\n if (filePath.startsWith('/') || /^[a-zA-Z]:/.test(filePath)) {\n throw new HTTPException(400, {\n message: `Invalid file path \"${filePath}\". Absolute paths are not allowed.`,\n });\n }\n // Reject path traversal attempts\n const segments = filePath.split('/');\n for (const segment of segments) {\n if (segment === '..' || segment === '.') {\n throw new HTTPException(400, {\n message: `Invalid file path \"${filePath}\". Path traversal is not allowed.`,\n });\n }\n }\n return filePath;\n}\n\ninterface SkillFileEntry {\n path: string;\n content: string;\n encoding: 'utf-8' | 'base64';\n}\n\ninterface SkillFilesResponse {\n skillId: string;\n owner: string;\n repo: string;\n branch: string;\n files: SkillFileEntry[];\n}\n\n/**\n * Fetch skill files from the Skills API.\n * Returns all files for a skill with their content.\n */\nasync function fetchSkillFiles(owner: string, repo: string, skillName: string): Promise<SkillFilesResponse | null> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 30000); // 30s for file downloads\n\n const url = `${SKILLS_SH_API_URL}/api/skills/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/${encodeURIComponent(skillName)}/files`;\n const response = await fetch(url, { signal: controller.signal });\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n if (response.status === 404) {\n return null;\n }\n throw new Error(`Skills API error: ${response.status} ${response.statusText}`);\n }\n\n return (await response.json()) as SkillFilesResponse;\n}\n\n// =============================================================================\n// skills.sh Preview Route\n// =============================================================================\n\nexport const WORKSPACE_SKILLS_SH_PREVIEW_ROUTE = createRoute({\n method: 'GET',\n path: '/workspaces/:workspaceId/skills-sh/preview',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n queryParamSchema: skillsShPreviewQuerySchema,\n responseSchema: skillsShPreviewResponseSchema,\n summary: 'Preview skill content',\n description: 'Fetches the skill content from the Skills API.',\n tags: ['Workspace', 'Skills'],\n handler: async ({ owner, repo, path: skillName }) => {\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 10000);\n\n const url = `${SKILLS_SH_API_URL}/api/skills/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/${encodeURIComponent(skillName)}/content`;\n const response = await fetch(url, { signal: controller.signal });\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n throw new HTTPException(404, {\n message: `Could not find skill \"${skillName}\" for ${owner}/${repo}`,\n });\n }\n\n const data = (await response.json()) as { instructions: string; raw: string };\n const content = data.instructions || data.raw || '';\n\n if (!content) {\n throw new HTTPException(404, {\n message: `No content available for skill \"${skillName}\"`,\n });\n }\n\n return { content };\n } catch (error) {\n if (error instanceof HTTPException) {\n throw error;\n }\n return handleError(error, 'Error fetching skill preview');\n }\n },\n});\n\n// =============================================================================\n// skills.sh Install Route\n// =============================================================================\n\nexport const WORKSPACE_SKILLS_SH_INSTALL_ROUTE = createRoute({\n method: 'POST',\n path: '/workspaces/:workspaceId/skills-sh/install',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n bodySchema: skillsShInstallBodySchema,\n responseSchema: skillsShInstallResponseSchema,\n summary: 'Install skill from Skills API',\n description: 'Installs a skill by fetching files from the Skills API and writing to workspace filesystem.',\n tags: ['Workspace', 'Skills'],\n handler: async ({ mastra, requestContext, workspaceId, owner, repo, skillName, mount }) => {\n try {\n requireWorkspaceV1Support();\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace) {\n throw new HTTPException(404, { message: 'Workspace not found' });\n }\n\n if (!workspace.filesystem) {\n throw new HTTPException(400, { message: 'Workspace filesystem not available' });\n }\n\n if (workspace.filesystem.readOnly) {\n throw new HTTPException(403, { message: 'Workspace is read-only' });\n }\n\n // Fetch skill files from the Skills API\n const result = await fetchSkillFiles(owner, repo, skillName);\n if (!result || result.files.length === 0) {\n throw new HTTPException(404, {\n message: `Could not find skill \"${skillName}\" in ${owner}/${repo}.`,\n });\n }\n\n // Validate skill name to prevent path traversal\n const safeSkillId = assertSafeSkillName(result.skillId);\n const installPath = buildSkillInstallPath(workspace.filesystem, safeSkillId, mount);\n\n // Ensure the skills directory exists\n try {\n await workspace.filesystem.mkdir(installPath, { recursive: true });\n } catch {\n // Directory might already exist\n }\n\n // Write all files to the workspace\n let filesWritten = 0;\n for (const file of result.files) {\n // Validate file path to prevent path traversal from API response\n const safePath = assertSafeFilePath(file.path);\n const filePath = `${installPath}/${safePath}`;\n\n // Create subdirectory if needed\n if (safePath.includes('/')) {\n const dirPath = filePath.substring(0, filePath.lastIndexOf('/'));\n try {\n await workspace.filesystem.mkdir(dirPath, { recursive: true });\n } catch {\n // Directory might already exist\n }\n }\n\n const content = file.encoding === 'base64' ? Buffer.from(file.content, 'base64') : file.content;\n await workspace.filesystem.writeFile(filePath, content);\n filesWritten++;\n }\n\n // Write metadata file for update support\n const metadata = {\n skillName: result.skillId,\n owner: result.owner,\n repo: result.repo,\n branch: result.branch,\n installedAt: new Date().toISOString(),\n };\n await workspace.filesystem.writeFile(`${installPath}/.meta.json`, JSON.stringify(metadata, null, 2));\n filesWritten++;\n\n // Surgically update the skills cache for the newly installed skill\n if (workspace.skills?.addSkill) {\n try {\n await workspace.skills.addSkill(installPath);\n } catch (cacheError) {\n console.warn(\n `[skills-sh] Failed to update cache after install: ${cacheError instanceof Error ? cacheError.message : String(cacheError)}`,\n );\n }\n }\n\n return {\n success: true,\n skillName: result.skillId,\n installedPath: installPath,\n filesWritten,\n };\n } catch (error) {\n if (error instanceof HTTPException) {\n throw error;\n }\n return handleError(error, 'Error installing skill');\n }\n },\n});\n\n/**\n * Interface for skill metadata stored in .meta.json\n */\ninterface SkillMetaFile {\n skillName: string;\n owner: string;\n repo: string;\n branch: string;\n installedAt: string;\n}\n\nexport const WORKSPACE_SKILLS_SH_REMOVE_ROUTE = createRoute({\n method: 'POST',\n path: '/workspaces/:workspaceId/skills-sh/remove',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n bodySchema: skillsShRemoveBodySchema,\n responseSchema: skillsShRemoveResponseSchema,\n summary: 'Remove an installed skill',\n description: 'Removes an installed skill by deleting its directory. Does not require sandbox.',\n tags: ['Workspace', 'Skills'],\n handler: async ({ mastra, requestContext, workspaceId, skillName }) => {\n try {\n requireWorkspaceV1Support();\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace) {\n throw new HTTPException(404, { message: 'Workspace not found' });\n }\n\n if (!workspace.filesystem) {\n throw new HTTPException(400, { message: 'Workspace filesystem not available' });\n }\n\n if (workspace.filesystem.readOnly) {\n throw new HTTPException(403, { message: 'Workspace is read-only' });\n }\n\n // Validate skill name to prevent path traversal\n const safeSkillName = assertSafeSkillName(skillName);\n\n // Look up the skill's actual path from the cache (supports glob-discovered skills).\n // Only use the discovered path if it's under the skills.sh directory to avoid\n // accidentally deleting a locally-authored skill with the same name.\n const allSkills = await workspace.skills?.list();\n const matchingSkill = allSkills?.find(s => s.name === safeSkillName && s.path.includes(SKILLS_SH_PATH_PREFIX));\n const skillPath = matchingSkill?.path ?? buildSkillInstallPath(workspace.filesystem, safeSkillName);\n\n // Check if skill exists on filesystem\n try {\n await workspace.filesystem.stat(skillPath);\n } catch {\n throw new HTTPException(404, { message: `Skill \"${skillName}\" not found at ${skillPath}` });\n }\n\n // Delete the skill directory\n await workspace.filesystem.rmdir(skillPath, { recursive: true });\n\n // Surgically remove the skill from the cache\n if (workspace.skills?.removeSkill) {\n try {\n await workspace.skills.removeSkill(skillPath);\n } catch (cacheError) {\n console.warn(\n `[skills-sh] Failed to update cache after remove: ${cacheError instanceof Error ? cacheError.message : String(cacheError)}`,\n );\n }\n }\n\n return {\n success: true,\n skillName,\n removedPath: skillPath,\n };\n } catch (error) {\n if (error instanceof HTTPException) {\n throw error;\n }\n return handleError(error, 'Error removing skill');\n }\n },\n});\n\nexport const WORKSPACE_SKILLS_SH_UPDATE_ROUTE = createRoute({\n method: 'POST',\n path: '/workspaces/:workspaceId/skills-sh/update',\n responseType: 'json',\n pathParamSchema: workspaceIdPathParams,\n bodySchema: skillsShUpdateBodySchema,\n responseSchema: skillsShUpdateResponseSchema,\n summary: 'Update installed skills',\n description:\n 'Updates installed skills by re-fetching from GitHub. Specify skillName to update one, or omit to update all.',\n tags: ['Workspace', 'Skills'],\n handler: async ({ mastra, requestContext, workspaceId, skillName }) => {\n try {\n requireWorkspaceV1Support();\n\n const workspace = await getWorkspaceById(mastra, workspaceId, requestContext);\n if (!workspace) {\n throw new HTTPException(404, { message: 'Workspace not found' });\n }\n\n if (!workspace.filesystem) {\n throw new HTTPException(400, { message: 'Workspace filesystem not available' });\n }\n\n if (workspace.filesystem.readOnly) {\n throw new HTTPException(403, { message: 'Workspace is read-only' });\n }\n\n const results: Array<{\n skillName: string;\n success: boolean;\n filesWritten?: number;\n error?: string;\n }> = [];\n\n // Build list of { skillName, basePath } entries to update.\n // basePath is the parent of the skill directory (e.g., `.agents/skills`).\n let skillsToUpdate: Array<{ name: string; basePath: string }>;\n\n if (skillName) {\n const safeName = assertSafeSkillName(skillName);\n\n // Try to find the installed path via discovery first\n const allSkills = await workspace.skills?.list();\n const discoveredSkill = allSkills?.find(s => s.name === safeName && s.path.includes(SKILLS_SH_PATH_PREFIX));\n let basePath: string;\n if (discoveredSkill?.path) {\n // Derive basePath by removing the skill name suffix from the discovered path\n basePath = discoveredSkill.path.substring(0, discoveredSkill.path.lastIndexOf('/'));\n } else {\n basePath = SKILLS_SH_DIR;\n }\n skillsToUpdate = [{ name: safeName, basePath }];\n } else {\n // Update all: scan `.agents/skills` under each writable mount (or just SKILLS_SH_DIR)\n skillsToUpdate = [];\n const dirsToScan: string[] = [];\n\n if (isCompositeFilesystem(workspace.filesystem)) {\n for (const [mountPath, mountFs] of workspace.filesystem.mounts) {\n if (!mountFs.readOnly) {\n dirsToScan.push(`${stripTrailingSlash(mountPath)}/${SKILLS_SH_DIR}`);\n }\n }\n } else {\n dirsToScan.push(SKILLS_SH_DIR);\n }\n\n for (const dir of dirsToScan) {\n try {\n const entries = await workspace.filesystem.readdir(dir);\n for (const e of entries) {\n if (e.type === 'directory') {\n skillsToUpdate.push({ name: e.name, basePath: dir });\n }\n }\n } catch {\n // Directory doesn't exist or isn't readable - skip\n }\n }\n\n if (skillsToUpdate.length === 0) {\n return { updated: [] };\n }\n }\n\n for (const { name: skill, basePath } of skillsToUpdate) {\n // Validate each skill name for safety\n try {\n assertSafeSkillName(skill);\n } catch {\n results.push({\n skillName: skill,\n success: false,\n error: 'Invalid skill name',\n });\n continue;\n }\n const installPath = `${basePath}/${skill}`;\n const metaPath = `${installPath}/.meta.json`;\n try {\n const metaContent = await workspace.filesystem.readFile(metaPath, { encoding: 'utf-8' });\n const meta: SkillMetaFile = JSON.parse(metaContent as string);\n\n // Re-fetch skill files from the Skills API\n const fetchResult = await fetchSkillFiles(meta.owner, meta.repo, meta.skillName);\n\n if (!fetchResult || fetchResult.files.length === 0) {\n results.push({\n skillName: skill,\n success: false,\n error: 'No files found in skill directory',\n });\n continue;\n }\n\n let filesWritten = 0;\n\n for (const file of fetchResult.files) {\n // Validate file path to prevent path traversal from API response\n const safePath = assertSafeFilePath(file.path);\n const filePath = `${installPath}/${safePath}`;\n\n if (safePath.includes('/')) {\n const dirPath = filePath.substring(0, filePath.lastIndexOf('/'));\n try {\n await workspace.filesystem.mkdir(dirPath, { recursive: true });\n } catch {\n // Directory might already exist\n }\n }\n\n const content = file.encoding === 'base64' ? Buffer.from(file.content, 'base64') : file.content;\n await workspace.filesystem.writeFile(filePath, content);\n filesWritten++;\n }\n\n // Update metadata with new install time and branch\n const updatedMeta: SkillMetaFile = {\n ...meta,\n branch: fetchResult.branch,\n installedAt: new Date().toISOString(),\n };\n await workspace.filesystem.writeFile(metaPath, JSON.stringify(updatedMeta, null, 2));\n filesWritten++;\n\n // Surgically update the skills cache for the updated skill\n if (workspace.skills?.addSkill) {\n try {\n await workspace.skills.addSkill(installPath);\n } catch (cacheError) {\n console.warn(\n `[skills-sh] Failed to update cache after update: ${cacheError instanceof Error ? cacheError.message : String(cacheError)}`,\n );\n }\n }\n\n results.push({\n skillName: skill,\n success: true,\n filesWritten,\n });\n } catch (error) {\n results.push({\n skillName: skill,\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error',\n });\n }\n }\n\n return { updated: results };\n } catch (error) {\n if (error instanceof HTTPException) {\n throw error;\n }\n return handleError(error, 'Error updating skills');\n }\n },\n});\n\nexport const WORKSPACE_SKILLS_SH_ROUTES = [\n WORKSPACE_SKILLS_SH_SEARCH_ROUTE,\n WORKSPACE_SKILLS_SH_POPULAR_ROUTE,\n WORKSPACE_SKILLS_SH_PREVIEW_ROUTE,\n WORKSPACE_SKILLS_SH_INSTALL_ROUTE,\n WORKSPACE_SKILLS_SH_REMOVE_ROUTE,\n WORKSPACE_SKILLS_SH_UPDATE_ROUTE,\n];\n\n// =============================================================================\n// Route Collections\n// =============================================================================\n\nexport const WORKSPACE_FS_ROUTES = [\n WORKSPACE_FS_READ_ROUTE,\n WORKSPACE_FS_WRITE_ROUTE,\n WORKSPACE_FS_LIST_ROUTE,\n WORKSPACE_FS_DELETE_ROUTE,\n WORKSPACE_FS_MKDIR_ROUTE,\n WORKSPACE_FS_STAT_ROUTE,\n];\n\nexport const WORKSPACE_SEARCH_ROUTES = [WORKSPACE_SEARCH_ROUTE, WORKSPACE_INDEX_ROUTE];\n\n// IMPORTANT: Search route must come before the parameterized routes\n// to avoid /api/workspace/skills/search being matched as /api/workspace/skills/:skillName\nexport const WORKSPACE_SKILLS_ROUTES = [\n WORKSPACE_SEARCH_SKILLS_ROUTE,\n WORKSPACE_LIST_SKILLS_ROUTE,\n WORKSPACE_GET_SKILL_ROUTE,\n WORKSPACE_LIST_SKILL_REFERENCES_ROUTE,\n WORKSPACE_GET_SKILL_REFERENCE_ROUTE,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAM,gBAAgB;;;;;AAUtB,SAAS,sBAAsB,IAAwC;CACrE,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,YAAY,YAAY,MAAM,GAAG,kBAAkB;AAClF;;;;;AAMA,SAAS,0BAA0B,OAAyB;CAC1D,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAGhD,IAAI,UAAU,SAAS,MAAM,SAAS,UAAU,OAAO;CAGvD,IAAI,UAAU,OAAO;EACnB,MAAM,OAAO,MAAM;EACnB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