@mastra/server 1.0.4 → 1.1.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 (333) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/a2a/store.d.ts +1 -0
  3. package/auth.d.ts +1 -0
  4. package/dist/{chunk-3REGEJEN.js → chunk-24SISJRB.js} +6 -6
  5. package/dist/chunk-24SISJRB.js.map +1 -0
  6. package/dist/{chunk-UK4FZWNW.cjs → chunk-2HAVULC2.cjs} +52 -53
  7. package/dist/chunk-2HAVULC2.cjs.map +1 -0
  8. package/dist/{chunk-MPUVSOEU.cjs → chunk-2HOMKKY4.cjs} +21 -15
  9. package/dist/chunk-2HOMKKY4.cjs.map +1 -0
  10. package/dist/{chunk-HCVDHEDD.cjs → chunk-37DO73XV.cjs} +217 -167
  11. package/dist/chunk-37DO73XV.cjs.map +1 -0
  12. package/dist/chunk-3AZY5AWI.js +689 -0
  13. package/dist/chunk-3AZY5AWI.js.map +1 -0
  14. package/dist/{chunk-KKY4MSZO.js → chunk-3OIJLD3O.js} +30 -11
  15. package/dist/chunk-3OIJLD3O.js.map +1 -0
  16. package/dist/{chunk-2CLS2PYJ.js → chunk-3QUACCLU.js} +398 -56
  17. package/dist/chunk-3QUACCLU.js.map +1 -0
  18. package/dist/{chunk-T4SPG2GP.cjs → chunk-4HFYR562.cjs} +4 -4
  19. package/dist/chunk-4HFYR562.cjs.map +1 -0
  20. package/dist/{chunk-2CYGIE3E.js → chunk-4JAEBN6N.js} +212 -86
  21. package/dist/chunk-4JAEBN6N.js.map +1 -0
  22. package/dist/{chunk-AVRO3FIN.cjs → chunk-4LVJBXI2.cjs} +97 -4
  23. package/dist/chunk-4LVJBXI2.cjs.map +1 -0
  24. package/dist/{chunk-PNZQCQY4.cjs → chunk-6G2RQWKA.cjs} +15 -15
  25. package/dist/chunk-6G2RQWKA.cjs.map +1 -0
  26. package/dist/chunk-6KC345IN.cjs +708 -0
  27. package/dist/chunk-6KC345IN.cjs.map +1 -0
  28. package/dist/{chunk-4EYONQIW.cjs → chunk-7D3UAMQM.cjs} +4 -4
  29. package/dist/chunk-7D3UAMQM.cjs.map +1 -0
  30. package/dist/{chunk-I27H7BEB.js → chunk-7XIMPDJV.js} +9 -6
  31. package/dist/chunk-7XIMPDJV.js.map +1 -0
  32. package/dist/{chunk-33CKPQS4.cjs → chunk-A2K5ZL47.cjs} +36 -16
  33. package/dist/chunk-A2K5ZL47.cjs.map +1 -0
  34. package/dist/chunk-AAHPYUEC.cjs +211 -0
  35. package/dist/chunk-AAHPYUEC.cjs.map +1 -0
  36. package/dist/{chunk-NUO7HPOV.cjs → chunk-AN42MFD5.cjs} +235 -109
  37. package/dist/chunk-AN42MFD5.cjs.map +1 -0
  38. package/dist/{chunk-4DJ7EJRB.cjs → chunk-AV3VZ6S3.cjs} +25 -21
  39. package/dist/chunk-AV3VZ6S3.cjs.map +1 -0
  40. package/dist/{chunk-GHQZIEPS.js → chunk-C4NZAUUW.js} +104 -54
  41. package/dist/chunk-C4NZAUUW.js.map +1 -0
  42. package/dist/{chunk-7S7ALPCY.js → chunk-D5VCL56B.js} +97 -5
  43. package/dist/chunk-D5VCL56B.js.map +1 -0
  44. package/dist/chunk-DD7LYNHB.js +596 -0
  45. package/dist/chunk-DD7LYNHB.js.map +1 -0
  46. package/dist/{chunk-XB27LCKO.js → chunk-DHDVJ5II.js} +15 -9
  47. package/dist/chunk-DHDVJ5II.js.map +1 -0
  48. package/dist/{chunk-GNCALVLC.js → chunk-ED6NQBHF.js} +23 -4
  49. package/dist/chunk-ED6NQBHF.js.map +1 -0
  50. package/dist/{chunk-YK63KHHB.cjs → chunk-EKFYZUPC.cjs} +513 -168
  51. package/dist/chunk-EKFYZUPC.cjs.map +1 -0
  52. package/dist/{chunk-5VDI75UV.js → chunk-EV5H2JQU.js} +5 -4
  53. package/dist/chunk-EV5H2JQU.js.map +1 -0
  54. package/dist/{chunk-4R2Z655M.js → chunk-F2WTCJ5C.js} +145 -67
  55. package/dist/chunk-F2WTCJ5C.js.map +1 -0
  56. package/dist/{chunk-H34VRYSF.js → chunk-FCPLBTHB.js} +26 -27
  57. package/dist/chunk-FCPLBTHB.js.map +1 -0
  58. package/dist/{chunk-IVGQTL3T.js → chunk-FQX5SQO7.js} +36 -28
  59. package/dist/chunk-FQX5SQO7.js.map +1 -0
  60. package/dist/{chunk-FWSKVWS7.cjs → chunk-FRRHYZR6.cjs} +4 -4
  61. package/dist/chunk-FRRHYZR6.cjs.map +1 -0
  62. package/dist/{chunk-YN3FWKVQ.js → chunk-GUG6KRAJ.js} +10 -13
  63. package/dist/chunk-GUG6KRAJ.js.map +1 -0
  64. package/dist/{chunk-N4EIZSG2.js → chunk-GXUBQJ74.js} +15 -11
  65. package/dist/chunk-GXUBQJ74.js.map +1 -0
  66. package/dist/chunk-H66LLFDL.js +1 -1
  67. package/dist/chunk-H66LLFDL.js.map +1 -1
  68. package/dist/{chunk-QPFYN6B5.cjs → chunk-HDGF45K7.cjs} +17 -14
  69. package/dist/chunk-HDGF45K7.cjs.map +1 -0
  70. package/dist/{chunk-P3H4AZKI.cjs → chunk-HZINLMHL.cjs} +15 -15
  71. package/dist/chunk-HZINLMHL.cjs.map +1 -0
  72. package/dist/{chunk-DVSCJECS.js → chunk-IS3HHGL4.js} +6 -6
  73. package/dist/chunk-IS3HHGL4.js.map +1 -0
  74. package/dist/{chunk-XCEQ4GQW.cjs → chunk-JLFFAYTC.cjs} +53 -90
  75. package/dist/chunk-JLFFAYTC.cjs.map +1 -0
  76. package/dist/{chunk-WJ6DNHLW.cjs → chunk-JRM3DWRM.cjs} +34 -24
  77. package/dist/chunk-JRM3DWRM.cjs.map +1 -0
  78. package/dist/{chunk-LF2ZLOFP.js → chunk-K2SXZLA3.cjs} +285 -3
  79. package/dist/chunk-K2SXZLA3.cjs.map +1 -0
  80. package/dist/{chunk-XOUK3IYU.js → chunk-K4HSW5ZF.js} +4 -4
  81. package/dist/chunk-K4HSW5ZF.js.map +1 -0
  82. package/dist/{chunk-GU4EWMZB.cjs → chunk-LFNP3ACE.js} +244 -4
  83. package/dist/chunk-LFNP3ACE.js.map +1 -0
  84. package/dist/chunk-LFTVDHOD.js +200 -0
  85. package/dist/chunk-LFTVDHOD.js.map +1 -0
  86. package/dist/{chunk-ZQ2G6QKS.cjs → chunk-MZRJNOYJ.cjs} +175 -97
  87. package/dist/chunk-MZRJNOYJ.cjs.map +1 -0
  88. package/dist/{chunk-G2AMUTU4.js → chunk-OS7SAIRA.js} +6 -6
  89. package/dist/chunk-OS7SAIRA.js.map +1 -0
  90. package/dist/{chunk-L2E5RUVT.cjs → chunk-PWXUI3OG.cjs} +15 -15
  91. package/dist/chunk-PWXUI3OG.cjs.map +1 -0
  92. package/dist/{chunk-CLAEGIP5.cjs → chunk-QOVLJFLX.cjs} +14 -17
  93. package/dist/chunk-QOVLJFLX.cjs.map +1 -0
  94. package/dist/chunk-QXDNFBJQ.js +220 -0
  95. package/dist/chunk-QXDNFBJQ.js.map +1 -0
  96. package/dist/{chunk-EUBTCHQC.js → chunk-RIX6WEJ2.js} +4 -4
  97. package/dist/chunk-RIX6WEJ2.js.map +1 -0
  98. package/dist/{chunk-CGIGPJRU.js → chunk-RW66MHXI.js} +37 -70
  99. package/dist/chunk-RW66MHXI.js.map +1 -0
  100. package/dist/chunk-S4SLHUJ7.cjs +253 -0
  101. package/dist/chunk-S4SLHUJ7.cjs.map +1 -0
  102. package/dist/{chunk-7XPMKW4Y.cjs → chunk-SONAXR2M.cjs} +12 -9
  103. package/dist/chunk-SONAXR2M.cjs.map +1 -0
  104. package/dist/{chunk-FLLJIPD4.cjs → chunk-T5KH32UA.cjs} +6 -5
  105. package/dist/chunk-T5KH32UA.cjs.map +1 -0
  106. package/dist/{chunk-3FEYUHHJ.js → chunk-TCWPL26W.js} +10 -7
  107. package/dist/chunk-TCWPL26W.js.map +1 -0
  108. package/dist/chunk-TGDBGIDA.cjs +623 -0
  109. package/dist/chunk-TGDBGIDA.cjs.map +1 -0
  110. package/dist/chunk-USR6JK77.js +62 -0
  111. package/dist/chunk-USR6JK77.js.map +1 -0
  112. package/dist/{chunk-6MP2S6VI.cjs → chunk-VNHOYZ56.cjs} +56 -48
  113. package/dist/chunk-VNHOYZ56.cjs.map +1 -0
  114. package/dist/chunk-VX3VN7FN.cjs +1 -1
  115. package/dist/chunk-VX3VN7FN.cjs.map +1 -1
  116. package/dist/{chunk-AV3CN5ZR.cjs → chunk-WHC6S3VY.cjs} +36 -17
  117. package/dist/chunk-WHC6S3VY.cjs.map +1 -0
  118. package/dist/{chunk-5NFRDYFN.js → chunk-XKLJYRAA.js} +4 -4
  119. package/dist/chunk-XKLJYRAA.js.map +1 -0
  120. package/dist/{chunk-TMS4LS2J.js → chunk-XUSAKRLX.js} +26 -16
  121. package/dist/chunk-XUSAKRLX.js.map +1 -0
  122. package/dist/chunk-ZKMVCV4G.cjs +71 -0
  123. package/dist/chunk-ZKMVCV4G.cjs.map +1 -0
  124. package/dist/docs/README.md +1 -1
  125. package/dist/docs/SKILL.md +1 -1
  126. package/dist/docs/SOURCE_MAP.json +1 -1
  127. package/dist/docs/server/01-custom-adapters.md +10 -10
  128. package/dist/docs/server/02-reference.md +22 -8
  129. package/dist/server/auth/helpers.d.ts +8 -1
  130. package/dist/server/auth/helpers.d.ts.map +1 -1
  131. package/dist/server/auth/index.cjs +42 -131
  132. package/dist/server/auth/index.cjs.map +1 -1
  133. package/dist/server/auth/index.js +1 -125
  134. package/dist/server/auth/index.js.map +1 -1
  135. package/dist/server/auth/path-pattern.d.ts +43 -0
  136. package/dist/server/auth/path-pattern.d.ts.map +1 -0
  137. package/dist/server/constants.d.ts +51 -0
  138. package/dist/server/constants.d.ts.map +1 -0
  139. package/dist/server/handlers/a2a.cjs +9 -9
  140. package/dist/server/handlers/a2a.d.ts.map +1 -1
  141. package/dist/server/handlers/a2a.js +1 -1
  142. package/dist/server/handlers/agent-builder.cjs +16 -16
  143. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  144. package/dist/server/handlers/agent-builder.js +1 -1
  145. package/dist/server/handlers/agent-versions.cjs +60 -0
  146. package/dist/server/handlers/agent-versions.cjs.map +1 -0
  147. package/dist/server/handlers/agent-versions.d.ts +479 -0
  148. package/dist/server/handlers/agent-versions.d.ts.map +1 -0
  149. package/dist/server/handlers/agent-versions.js +3 -0
  150. package/dist/server/handlers/agent-versions.js.map +1 -0
  151. package/dist/server/handlers/agents.cjs +40 -28
  152. package/dist/server/handlers/agents.d.ts +58 -5
  153. package/dist/server/handlers/agents.d.ts.map +1 -1
  154. package/dist/server/handlers/agents.js +1 -1
  155. package/dist/server/handlers/logs.cjs +4 -4
  156. package/dist/server/handlers/logs.d.ts.map +1 -1
  157. package/dist/server/handlers/logs.js +1 -1
  158. package/dist/server/handlers/mcp.cjs +9 -9
  159. package/dist/server/handlers/mcp.d.ts +22 -0
  160. package/dist/server/handlers/mcp.d.ts.map +1 -1
  161. package/dist/server/handlers/mcp.js +1 -1
  162. package/dist/server/handlers/memory.cjs +25 -25
  163. package/dist/server/handlers/memory.d.ts +25 -1
  164. package/dist/server/handlers/memory.d.ts.map +1 -1
  165. package/dist/server/handlers/memory.js +1 -1
  166. package/dist/server/handlers/observability.cjs +5 -5
  167. package/dist/server/handlers/observability.d.ts +1 -0
  168. package/dist/server/handlers/observability.d.ts.map +1 -1
  169. package/dist/server/handlers/observability.js +1 -1
  170. package/dist/server/handlers/processors.cjs +4 -4
  171. package/dist/server/handlers/processors.d.ts.map +1 -1
  172. package/dist/server/handlers/processors.js +1 -1
  173. package/dist/server/handlers/scores.cjs +7 -7
  174. package/dist/server/handlers/scores.d.ts.map +1 -1
  175. package/dist/server/handlers/scores.js +1 -1
  176. package/dist/server/handlers/stored-agents.cjs +6 -6
  177. package/dist/server/handlers/stored-agents.d.ts +33 -5
  178. package/dist/server/handlers/stored-agents.d.ts.map +1 -1
  179. package/dist/server/handlers/stored-agents.js +1 -1
  180. package/dist/server/handlers/system.cjs +2 -2
  181. package/dist/server/handlers/system.d.ts.map +1 -1
  182. package/dist/server/handlers/system.js +1 -1
  183. package/dist/server/handlers/tools.cjs +6 -6
  184. package/dist/server/handlers/tools.d.ts +3 -3
  185. package/dist/server/handlers/tools.d.ts.map +1 -1
  186. package/dist/server/handlers/tools.js +1 -1
  187. package/dist/server/handlers/utils.cjs +21 -5
  188. package/dist/server/handlers/utils.d.ts +26 -0
  189. package/dist/server/handlers/utils.d.ts.map +1 -1
  190. package/dist/server/handlers/utils.js +1 -1
  191. package/dist/server/handlers/vector.cjs +13 -13
  192. package/dist/server/handlers/vector.d.ts.map +1 -1
  193. package/dist/server/handlers/vector.js +1 -1
  194. package/dist/server/handlers/voice.cjs +8 -8
  195. package/dist/server/handlers/voice.d.ts.map +1 -1
  196. package/dist/server/handlers/voice.js +1 -1
  197. package/dist/server/handlers/workflows.cjs +24 -24
  198. package/dist/server/handlers/workflows.d.ts +2 -0
  199. package/dist/server/handlers/workflows.d.ts.map +1 -1
  200. package/dist/server/handlers/workflows.js +1 -1
  201. package/dist/server/handlers/workspace.cjs +80 -0
  202. package/dist/server/handlers/workspace.cjs.map +1 -0
  203. package/dist/server/handlers/workspace.d.ts +591 -0
  204. package/dist/server/handlers/workspace.d.ts.map +1 -0
  205. package/dist/server/handlers/workspace.js +3 -0
  206. package/dist/server/handlers/workspace.js.map +1 -0
  207. package/dist/server/handlers.cjs +24 -24
  208. package/dist/server/handlers.js +12 -12
  209. package/dist/server/schemas/agent-versions.d.ts +1646 -0
  210. package/dist/server/schemas/agent-versions.d.ts.map +1 -0
  211. package/dist/server/schemas/agents.d.ts +30 -19
  212. package/dist/server/schemas/agents.d.ts.map +1 -1
  213. package/dist/server/schemas/memory.d.ts +83 -31
  214. package/dist/server/schemas/memory.d.ts.map +1 -1
  215. package/dist/server/schemas/stored-agents.d.ts +66 -8
  216. package/dist/server/schemas/stored-agents.d.ts.map +1 -1
  217. package/dist/server/schemas/workspace.d.ts +1107 -0
  218. package/dist/server/schemas/workspace.d.ts.map +1 -0
  219. package/dist/server/server-adapter/index.cjs +298 -160
  220. package/dist/server/server-adapter/index.cjs.map +1 -1
  221. package/dist/server/server-adapter/index.d.ts +56 -2
  222. package/dist/server/server-adapter/index.d.ts.map +1 -1
  223. package/dist/server/server-adapter/index.js +158 -23
  224. package/dist/server/server-adapter/index.js.map +1 -1
  225. package/dist/server/server-adapter/openapi-utils.d.ts +10 -0
  226. package/dist/server/server-adapter/openapi-utils.d.ts.map +1 -1
  227. package/dist/server/server-adapter/routes/agents.d.ts.map +1 -1
  228. package/dist/server/server-adapter/routes/index.d.ts +3 -1
  229. package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
  230. package/dist/server/server-adapter/routes/route-builder.d.ts +2 -1
  231. package/dist/server/server-adapter/routes/route-builder.d.ts.map +1 -1
  232. package/dist/server/server-adapter/routes/stored-agents.d.ts +1 -1
  233. package/dist/server/server-adapter/routes/stored-agents.d.ts.map +1 -1
  234. package/dist/server/server-adapter/routes/workspace.d.ts +8 -0
  235. package/dist/server/server-adapter/routes/workspace.d.ts.map +1 -0
  236. package/dist/server/utils.d.ts +13 -0
  237. package/dist/server/utils.d.ts.map +1 -1
  238. package/dist/{token-6GSAFR2W-K2BTU23I-5WBYUIGY.cjs → token-6GSAFR2W-ABXTQD64-MC4IMVOB.cjs} +9 -9
  239. package/dist/token-6GSAFR2W-ABXTQD64-MC4IMVOB.cjs.map +1 -0
  240. package/dist/{token-6GSAFR2W-VLY2XUPA-NCSASMWN.js → token-6GSAFR2W-ABXTQD64-Z6U2TA2C.js} +6 -6
  241. package/dist/token-6GSAFR2W-ABXTQD64-Z6U2TA2C.js.map +1 -0
  242. package/dist/{token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs → token-6GSAFR2W-F2L44NEJ-B3QIV63M.cjs} +9 -9
  243. package/dist/token-6GSAFR2W-F2L44NEJ-B3QIV63M.cjs.map +1 -0
  244. package/dist/{token-6GSAFR2W-KVDFAJ2M-VW443KIA.js → token-6GSAFR2W-F2L44NEJ-GFZ37A2V.js} +6 -6
  245. package/dist/token-6GSAFR2W-F2L44NEJ-GFZ37A2V.js.map +1 -0
  246. package/dist/{token-6GSAFR2W-VLY2XUPA-RKITWXKR.cjs → token-6GSAFR2W-WGTMOPEU-6HSZQUFZ.cjs} +9 -9
  247. package/dist/token-6GSAFR2W-WGTMOPEU-6HSZQUFZ.cjs.map +1 -0
  248. package/dist/{token-6GSAFR2W-K2BTU23I-NW33N3NU.js → token-6GSAFR2W-WGTMOPEU-JKP67ZX4.js} +6 -6
  249. package/dist/token-6GSAFR2W-WGTMOPEU-JKP67ZX4.js.map +1 -0
  250. package/dist/token-util-NEHG7TUY-4YJ4EPCL-MBTAVIJ3.js +8 -0
  251. package/dist/{token-util-NEHG7TUY-TIJ3LMSH-SGVKOKXF.js.map → token-util-NEHG7TUY-4YJ4EPCL-MBTAVIJ3.js.map} +1 -1
  252. package/dist/token-util-NEHG7TUY-4YJ4EPCL-SQ4NADRW.cjs +10 -0
  253. package/dist/{token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs.map → token-util-NEHG7TUY-4YJ4EPCL-SQ4NADRW.cjs.map} +1 -1
  254. package/dist/token-util-NEHG7TUY-TV2H7N56-GGCGMPDG.js +8 -0
  255. package/dist/{token-util-NEHG7TUY-KSXDO2NO-WH6I3PH3.js.map → token-util-NEHG7TUY-TV2H7N56-GGCGMPDG.js.map} +1 -1
  256. package/dist/token-util-NEHG7TUY-TV2H7N56-R7OENTCJ.cjs +10 -0
  257. package/dist/{token-util-NEHG7TUY-KSXDO2NO-J6DEINGO.cjs.map → token-util-NEHG7TUY-TV2H7N56-R7OENTCJ.cjs.map} +1 -1
  258. package/dist/token-util-NEHG7TUY-XQP3QSPX-BL5O5N7R.cjs +10 -0
  259. package/dist/{token-util-NEHG7TUY-TIJ3LMSH-ANFISSXX.cjs.map → token-util-NEHG7TUY-XQP3QSPX-BL5O5N7R.cjs.map} +1 -1
  260. package/dist/token-util-NEHG7TUY-XQP3QSPX-YCJRRNXO.js +8 -0
  261. package/dist/{token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js.map → token-util-NEHG7TUY-XQP3QSPX-YCJRRNXO.js.map} +1 -1
  262. package/handlers/server/handlers.d.ts +1 -0
  263. package/handlers.d.ts +1 -0
  264. package/package.json +9 -7
  265. package/server-adapter.d.ts +1 -0
  266. package/dist/chunk-2CLS2PYJ.js.map +0 -1
  267. package/dist/chunk-2CYGIE3E.js.map +0 -1
  268. package/dist/chunk-33CKPQS4.cjs.map +0 -1
  269. package/dist/chunk-3FEYUHHJ.js.map +0 -1
  270. package/dist/chunk-3REGEJEN.js.map +0 -1
  271. package/dist/chunk-4DJ7EJRB.cjs.map +0 -1
  272. package/dist/chunk-4EYONQIW.cjs.map +0 -1
  273. package/dist/chunk-4R2Z655M.js.map +0 -1
  274. package/dist/chunk-5NFRDYFN.js.map +0 -1
  275. package/dist/chunk-5VDI75UV.js.map +0 -1
  276. package/dist/chunk-5W4RPVTK.cjs +0 -49
  277. package/dist/chunk-5W4RPVTK.cjs.map +0 -1
  278. package/dist/chunk-6MP2S6VI.cjs.map +0 -1
  279. package/dist/chunk-7S7ALPCY.js.map +0 -1
  280. package/dist/chunk-7XPMKW4Y.cjs.map +0 -1
  281. package/dist/chunk-AV3CN5ZR.cjs.map +0 -1
  282. package/dist/chunk-AVRO3FIN.cjs.map +0 -1
  283. package/dist/chunk-BRI4GUZ2.cjs +0 -280
  284. package/dist/chunk-BRI4GUZ2.cjs.map +0 -1
  285. package/dist/chunk-CGIGPJRU.js.map +0 -1
  286. package/dist/chunk-CLAEGIP5.cjs.map +0 -1
  287. package/dist/chunk-DVSCJECS.js.map +0 -1
  288. package/dist/chunk-EUBTCHQC.js.map +0 -1
  289. package/dist/chunk-FLLJIPD4.cjs.map +0 -1
  290. package/dist/chunk-FWSKVWS7.cjs.map +0 -1
  291. package/dist/chunk-G2AMUTU4.js.map +0 -1
  292. package/dist/chunk-GHQZIEPS.js.map +0 -1
  293. package/dist/chunk-GNCALVLC.js.map +0 -1
  294. package/dist/chunk-GU4EWMZB.cjs.map +0 -1
  295. package/dist/chunk-H34VRYSF.js.map +0 -1
  296. package/dist/chunk-HCVDHEDD.cjs.map +0 -1
  297. package/dist/chunk-I27H7BEB.js.map +0 -1
  298. package/dist/chunk-IVGQTL3T.js.map +0 -1
  299. package/dist/chunk-KKY4MSZO.js.map +0 -1
  300. package/dist/chunk-L2E5RUVT.cjs.map +0 -1
  301. package/dist/chunk-LF2ZLOFP.js.map +0 -1
  302. package/dist/chunk-MPUVSOEU.cjs.map +0 -1
  303. package/dist/chunk-N4EIZSG2.js.map +0 -1
  304. package/dist/chunk-NUO7HPOV.cjs.map +0 -1
  305. package/dist/chunk-P3H4AZKI.cjs.map +0 -1
  306. package/dist/chunk-PNZQCQY4.cjs.map +0 -1
  307. package/dist/chunk-QPFYN6B5.cjs.map +0 -1
  308. package/dist/chunk-T4SPG2GP.cjs.map +0 -1
  309. package/dist/chunk-TMS4LS2J.js.map +0 -1
  310. package/dist/chunk-UK4FZWNW.cjs.map +0 -1
  311. package/dist/chunk-WJ6DNHLW.cjs.map +0 -1
  312. package/dist/chunk-WLGJVDH4.js +0 -242
  313. package/dist/chunk-WLGJVDH4.js.map +0 -1
  314. package/dist/chunk-XB27LCKO.js.map +0 -1
  315. package/dist/chunk-XCEQ4GQW.cjs.map +0 -1
  316. package/dist/chunk-XOUK3IYU.js.map +0 -1
  317. package/dist/chunk-XWGAT2DA.js +0 -44
  318. package/dist/chunk-XWGAT2DA.js.map +0 -1
  319. package/dist/chunk-YK63KHHB.cjs.map +0 -1
  320. package/dist/chunk-YN3FWKVQ.js.map +0 -1
  321. package/dist/chunk-ZQ2G6QKS.cjs.map +0 -1
  322. package/dist/token-6GSAFR2W-K2BTU23I-5WBYUIGY.cjs.map +0 -1
  323. package/dist/token-6GSAFR2W-K2BTU23I-NW33N3NU.js.map +0 -1
  324. package/dist/token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs.map +0 -1
  325. package/dist/token-6GSAFR2W-KVDFAJ2M-VW443KIA.js.map +0 -1
  326. package/dist/token-6GSAFR2W-VLY2XUPA-NCSASMWN.js.map +0 -1
  327. package/dist/token-6GSAFR2W-VLY2XUPA-RKITWXKR.cjs.map +0 -1
  328. package/dist/token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs +0 -10
  329. package/dist/token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js +0 -8
  330. package/dist/token-util-NEHG7TUY-KSXDO2NO-J6DEINGO.cjs +0 -10
  331. package/dist/token-util-NEHG7TUY-KSXDO2NO-WH6I3PH3.js +0 -8
  332. package/dist/token-util-NEHG7TUY-TIJ3LMSH-ANFISSXX.cjs +0 -10
  333. package/dist/token-util-NEHG7TUY-TIJ3LMSH-SGVKOKXF.js +0 -8
@@ -0,0 +1,689 @@
1
+ import { listWorkspacesResponseSchema, workspaceInfoResponseSchema, workspaceIdPathParams, fsReadResponseSchema, fsReadQuerySchema, fsWriteResponseSchema, fsWriteBodySchema, fsListResponseSchema, fsListQuerySchema, fsDeleteResponseSchema, fsDeleteQuerySchema, fsMkdirResponseSchema, fsMkdirBodySchema, fsStatResponseSchema, fsStatQuerySchema, searchResponseSchema, searchQuerySchema, indexResponseSchema, indexBodySchema, listSkillsResponseSchema, getSkillResponseSchema, skillNamePathParams, listReferencesResponseSchema, skillReferenceResponseSchema, skillReferencePathParams, searchSkillsResponseSchema, searchSkillsQuerySchema } from './chunk-QXDNFBJQ.js';
2
+ import { handleError } from './chunk-ONN5EA7E.js';
3
+ import { createRoute } from './chunk-D5VCL56B.js';
4
+ import { HTTPException } from './chunk-6QWQZI4Q.js';
5
+ import { coreFeatures } from '@mastra/core/features';
6
+
7
+ function requireWorkspaceV1Support() {
8
+ if (!coreFeatures.has("workspaces-v1")) {
9
+ throw new HTTPException(501, {
10
+ message: "Workspace v1 not supported by this version of @mastra/core. Please upgrade to a newer version."
11
+ });
12
+ }
13
+ }
14
+ async function getWorkspaceById(mastra, workspaceId) {
15
+ requireWorkspaceV1Support();
16
+ const globalWorkspace = mastra.getWorkspace?.();
17
+ if (!workspaceId) {
18
+ return globalWorkspace;
19
+ }
20
+ if (globalWorkspace?.id === workspaceId) {
21
+ return globalWorkspace;
22
+ }
23
+ const agents = mastra.listAgents?.() ?? {};
24
+ for (const agent of Object.values(agents)) {
25
+ if (agent.hasOwnWorkspace?.()) {
26
+ const agentWorkspace = await agent.getWorkspace?.();
27
+ if (agentWorkspace?.id === workspaceId) {
28
+ return agentWorkspace;
29
+ }
30
+ }
31
+ }
32
+ return void 0;
33
+ }
34
+ async function getSkillsById(mastra, workspaceId) {
35
+ const workspace = await getWorkspaceById(mastra, workspaceId);
36
+ return workspace?.skills;
37
+ }
38
+ var LIST_WORKSPACES_ROUTE = createRoute({
39
+ method: "GET",
40
+ path: "/workspaces",
41
+ responseType: "json",
42
+ responseSchema: listWorkspacesResponseSchema,
43
+ summary: "List all workspaces",
44
+ description: "Returns all workspaces from both Mastra instance and agents",
45
+ tags: ["Workspace"],
46
+ handler: async ({ mastra }) => {
47
+ try {
48
+ requireWorkspaceV1Support();
49
+ const workspaces = [];
50
+ const seenIds = /* @__PURE__ */ new Set();
51
+ const globalWorkspace = mastra.getWorkspace?.();
52
+ if (globalWorkspace) {
53
+ seenIds.add(globalWorkspace.id);
54
+ workspaces.push({
55
+ id: globalWorkspace.id,
56
+ name: globalWorkspace.name,
57
+ status: globalWorkspace.status,
58
+ source: "mastra",
59
+ capabilities: {
60
+ hasFilesystem: !!globalWorkspace.fs,
61
+ hasSandbox: !!globalWorkspace.sandbox,
62
+ canBM25: globalWorkspace.canBM25,
63
+ canVector: globalWorkspace.canVector,
64
+ canHybrid: globalWorkspace.canHybrid,
65
+ hasSkills: !!globalWorkspace.skills
66
+ },
67
+ safety: {
68
+ readOnly: globalWorkspace.filesystem?.readOnly ?? false
69
+ }
70
+ });
71
+ }
72
+ const agents = mastra.listAgents?.() ?? {};
73
+ for (const [agentId, agent] of Object.entries(agents)) {
74
+ if (agent.hasOwnWorkspace?.()) {
75
+ try {
76
+ const agentWorkspace = await agent.getWorkspace?.();
77
+ if (agentWorkspace && !seenIds.has(agentWorkspace.id)) {
78
+ seenIds.add(agentWorkspace.id);
79
+ workspaces.push({
80
+ id: agentWorkspace.id,
81
+ name: agentWorkspace.name,
82
+ status: agentWorkspace.status,
83
+ source: "agent",
84
+ agentId,
85
+ agentName: agent.name,
86
+ capabilities: {
87
+ hasFilesystem: !!agentWorkspace.fs,
88
+ hasSandbox: !!agentWorkspace.sandbox,
89
+ canBM25: agentWorkspace.canBM25,
90
+ canVector: agentWorkspace.canVector,
91
+ canHybrid: agentWorkspace.canHybrid,
92
+ hasSkills: !!agentWorkspace.skills
93
+ },
94
+ safety: {
95
+ readOnly: agentWorkspace.filesystem?.readOnly ?? false
96
+ }
97
+ });
98
+ }
99
+ } catch {
100
+ continue;
101
+ }
102
+ }
103
+ }
104
+ return { workspaces };
105
+ } catch (error) {
106
+ return handleError(error, "Error listing workspaces");
107
+ }
108
+ }
109
+ });
110
+ var GET_WORKSPACE_ROUTE = createRoute({
111
+ method: "GET",
112
+ path: "/workspaces/:workspaceId",
113
+ responseType: "json",
114
+ pathParamSchema: workspaceIdPathParams,
115
+ responseSchema: workspaceInfoResponseSchema,
116
+ summary: "Get workspace info",
117
+ description: "Returns information about a specific workspace and its capabilities",
118
+ tags: ["Workspace"],
119
+ handler: async ({ mastra, workspaceId }) => {
120
+ try {
121
+ const workspace = await getWorkspaceById(mastra, workspaceId);
122
+ if (!workspace) {
123
+ return {
124
+ isWorkspaceConfigured: false
125
+ };
126
+ }
127
+ return {
128
+ isWorkspaceConfigured: true,
129
+ id: workspace.id,
130
+ name: workspace.name,
131
+ status: workspace.status,
132
+ capabilities: {
133
+ hasFilesystem: !!workspace.fs,
134
+ hasSandbox: !!workspace.sandbox,
135
+ canBM25: workspace.canBM25,
136
+ canVector: workspace.canVector,
137
+ canHybrid: workspace.canHybrid,
138
+ hasSkills: !!workspace.skills
139
+ },
140
+ safety: {
141
+ readOnly: workspace.filesystem?.readOnly ?? false
142
+ }
143
+ };
144
+ } catch (error) {
145
+ return handleError(error, "Error getting workspace info");
146
+ }
147
+ }
148
+ });
149
+ var WORKSPACE_FS_READ_ROUTE = createRoute({
150
+ method: "GET",
151
+ path: "/workspaces/:workspaceId/fs/read",
152
+ responseType: "json",
153
+ pathParamSchema: workspaceIdPathParams,
154
+ queryParamSchema: fsReadQuerySchema,
155
+ responseSchema: fsReadResponseSchema,
156
+ summary: "Read file content",
157
+ description: "Returns the content of a file at the specified path",
158
+ tags: ["Workspace"],
159
+ handler: async ({ mastra, path, encoding, workspaceId }) => {
160
+ try {
161
+ requireWorkspaceV1Support();
162
+ if (!path) {
163
+ throw new HTTPException(400, { message: "Path is required" });
164
+ }
165
+ const workspace = await getWorkspaceById(mastra, workspaceId);
166
+ if (!workspace?.fs) {
167
+ throw new HTTPException(404, { message: "No workspace filesystem configured" });
168
+ }
169
+ const decodedPath = decodeURIComponent(path);
170
+ if (!await workspace.fs.exists(decodedPath)) {
171
+ throw new HTTPException(404, { message: `Path "${decodedPath}" not found` });
172
+ }
173
+ const content = await workspace.fs.readFile(decodedPath, {
174
+ encoding: encoding || "utf-8"
175
+ });
176
+ return {
177
+ path: decodedPath,
178
+ content: typeof content === "string" ? content : content.toString("utf-8"),
179
+ type: "file"
180
+ };
181
+ } catch (error) {
182
+ return handleError(error, "Error reading file");
183
+ }
184
+ }
185
+ });
186
+ var WORKSPACE_FS_WRITE_ROUTE = createRoute({
187
+ method: "POST",
188
+ path: "/workspaces/:workspaceId/fs/write",
189
+ responseType: "json",
190
+ pathParamSchema: workspaceIdPathParams,
191
+ bodySchema: fsWriteBodySchema,
192
+ responseSchema: fsWriteResponseSchema,
193
+ summary: "Write file content",
194
+ description: "Writes content to a file at the specified path. Supports base64 encoding for binary files.",
195
+ tags: ["Workspace"],
196
+ handler: async ({ mastra, path, content, encoding, recursive, workspaceId }) => {
197
+ try {
198
+ requireWorkspaceV1Support();
199
+ if (!path || content === void 0) {
200
+ throw new HTTPException(400, { message: "Path and content are required" });
201
+ }
202
+ const workspace = await getWorkspaceById(mastra, workspaceId);
203
+ if (!workspace?.fs) {
204
+ throw new HTTPException(404, { message: "No workspace filesystem configured" });
205
+ }
206
+ if (workspace.filesystem?.readOnly) {
207
+ throw new HTTPException(403, { message: "Workspace is in read-only mode" });
208
+ }
209
+ const decodedPath = decodeURIComponent(path);
210
+ let fileContent = content;
211
+ if (encoding === "base64") {
212
+ fileContent = Buffer.from(content, "base64");
213
+ }
214
+ await workspace.fs.writeFile(decodedPath, fileContent, { recursive: recursive ?? true });
215
+ return {
216
+ success: true,
217
+ path: decodedPath
218
+ };
219
+ } catch (error) {
220
+ return handleError(error, "Error writing file");
221
+ }
222
+ }
223
+ });
224
+ var WORKSPACE_FS_LIST_ROUTE = createRoute({
225
+ method: "GET",
226
+ path: "/workspaces/:workspaceId/fs/list",
227
+ responseType: "json",
228
+ pathParamSchema: workspaceIdPathParams,
229
+ queryParamSchema: fsListQuerySchema,
230
+ responseSchema: fsListResponseSchema,
231
+ summary: "List directory contents",
232
+ description: "Returns a list of files and directories at the specified path",
233
+ tags: ["Workspace"],
234
+ handler: async ({ mastra, path, recursive, workspaceId }) => {
235
+ try {
236
+ requireWorkspaceV1Support();
237
+ if (!path) {
238
+ throw new HTTPException(400, { message: "Path is required" });
239
+ }
240
+ const workspace = await getWorkspaceById(mastra, workspaceId);
241
+ if (!workspace?.fs) {
242
+ return {
243
+ path: decodeURIComponent(path),
244
+ entries: [],
245
+ error: "No workspace filesystem configured"
246
+ };
247
+ }
248
+ const decodedPath = decodeURIComponent(path);
249
+ if (!await workspace.fs.exists(decodedPath)) {
250
+ throw new HTTPException(404, { message: `Path "${decodedPath}" not found` });
251
+ }
252
+ const entries = await workspace.fs.readdir(decodedPath, { recursive });
253
+ return {
254
+ path: decodedPath,
255
+ entries: entries.map((entry) => ({
256
+ name: entry.name,
257
+ type: entry.type,
258
+ size: entry.size
259
+ }))
260
+ };
261
+ } catch (error) {
262
+ return handleError(error, "Error listing directory");
263
+ }
264
+ }
265
+ });
266
+ var WORKSPACE_FS_DELETE_ROUTE = createRoute({
267
+ method: "DELETE",
268
+ path: "/workspaces/:workspaceId/fs/delete",
269
+ responseType: "json",
270
+ pathParamSchema: workspaceIdPathParams,
271
+ queryParamSchema: fsDeleteQuerySchema,
272
+ responseSchema: fsDeleteResponseSchema,
273
+ summary: "Delete file or directory",
274
+ description: "Deletes a file or directory at the specified path",
275
+ tags: ["Workspace"],
276
+ handler: async ({ mastra, path, recursive, force, workspaceId }) => {
277
+ try {
278
+ requireWorkspaceV1Support();
279
+ if (!path) {
280
+ throw new HTTPException(400, { message: "Path is required" });
281
+ }
282
+ const workspace = await getWorkspaceById(mastra, workspaceId);
283
+ if (!workspace?.fs) {
284
+ throw new HTTPException(404, { message: "No workspace filesystem configured" });
285
+ }
286
+ if (workspace.filesystem?.readOnly) {
287
+ throw new HTTPException(403, { message: "Workspace is in read-only mode" });
288
+ }
289
+ const decodedPath = decodeURIComponent(path);
290
+ const exists = await workspace.fs.exists(decodedPath);
291
+ if (!exists && !force) {
292
+ throw new HTTPException(404, { message: `Path "${decodedPath}" not found` });
293
+ }
294
+ if (exists) {
295
+ try {
296
+ await workspace.fs.deleteFile(decodedPath, { force });
297
+ } catch {
298
+ await workspace.fs.rmdir(decodedPath, { recursive, force });
299
+ }
300
+ }
301
+ return {
302
+ success: true,
303
+ path: decodedPath
304
+ };
305
+ } catch (error) {
306
+ return handleError(error, "Error deleting path");
307
+ }
308
+ }
309
+ });
310
+ var WORKSPACE_FS_MKDIR_ROUTE = createRoute({
311
+ method: "POST",
312
+ path: "/workspaces/:workspaceId/fs/mkdir",
313
+ responseType: "json",
314
+ pathParamSchema: workspaceIdPathParams,
315
+ bodySchema: fsMkdirBodySchema,
316
+ responseSchema: fsMkdirResponseSchema,
317
+ summary: "Create directory",
318
+ description: "Creates a directory at the specified path",
319
+ tags: ["Workspace"],
320
+ handler: async ({ mastra, path, recursive, workspaceId }) => {
321
+ try {
322
+ requireWorkspaceV1Support();
323
+ if (!path) {
324
+ throw new HTTPException(400, { message: "Path is required" });
325
+ }
326
+ const workspace = await getWorkspaceById(mastra, workspaceId);
327
+ if (!workspace?.fs) {
328
+ throw new HTTPException(404, { message: "No workspace filesystem configured" });
329
+ }
330
+ if (workspace.filesystem?.readOnly) {
331
+ throw new HTTPException(403, { message: "Workspace is in read-only mode" });
332
+ }
333
+ const decodedPath = decodeURIComponent(path);
334
+ await workspace.fs.mkdir(decodedPath, { recursive: recursive ?? true });
335
+ return {
336
+ success: true,
337
+ path: decodedPath
338
+ };
339
+ } catch (error) {
340
+ return handleError(error, "Error creating directory");
341
+ }
342
+ }
343
+ });
344
+ var WORKSPACE_FS_STAT_ROUTE = createRoute({
345
+ method: "GET",
346
+ path: "/workspaces/:workspaceId/fs/stat",
347
+ responseType: "json",
348
+ pathParamSchema: workspaceIdPathParams,
349
+ queryParamSchema: fsStatQuerySchema,
350
+ responseSchema: fsStatResponseSchema,
351
+ summary: "Get file/directory info",
352
+ description: "Returns metadata about a file or directory",
353
+ tags: ["Workspace"],
354
+ handler: async ({ mastra, path, workspaceId }) => {
355
+ try {
356
+ requireWorkspaceV1Support();
357
+ if (!path) {
358
+ throw new HTTPException(400, { message: "Path is required" });
359
+ }
360
+ const workspace = await getWorkspaceById(mastra, workspaceId);
361
+ if (!workspace?.fs) {
362
+ throw new HTTPException(404, { message: "No workspace filesystem configured" });
363
+ }
364
+ const decodedPath = decodeURIComponent(path);
365
+ if (!await workspace.fs.exists(decodedPath)) {
366
+ throw new HTTPException(404, { message: `Path "${decodedPath}" not found` });
367
+ }
368
+ const stat = await workspace.fs.stat(decodedPath);
369
+ return {
370
+ path: stat.path,
371
+ type: stat.type,
372
+ size: stat.size,
373
+ createdAt: stat.createdAt?.toISOString(),
374
+ modifiedAt: stat.modifiedAt?.toISOString(),
375
+ mimeType: stat.mimeType
376
+ };
377
+ } catch (error) {
378
+ return handleError(error, "Error getting file info");
379
+ }
380
+ }
381
+ });
382
+ var WORKSPACE_SEARCH_ROUTE = createRoute({
383
+ method: "GET",
384
+ path: "/workspaces/:workspaceId/search",
385
+ responseType: "json",
386
+ pathParamSchema: workspaceIdPathParams,
387
+ queryParamSchema: searchQuerySchema,
388
+ responseSchema: searchResponseSchema,
389
+ summary: "Search workspace content",
390
+ description: "Searches across indexed workspace content using BM25, vector, or hybrid search",
391
+ tags: ["Workspace"],
392
+ handler: async ({ mastra, query, topK, mode, minScore, workspaceId }) => {
393
+ try {
394
+ requireWorkspaceV1Support();
395
+ if (!query) {
396
+ throw new HTTPException(400, { message: "Search query is required" });
397
+ }
398
+ const workspace = await getWorkspaceById(mastra, workspaceId);
399
+ if (!workspace) {
400
+ return {
401
+ results: [],
402
+ query,
403
+ mode: mode || "bm25"
404
+ };
405
+ }
406
+ const canSearch = workspace.canBM25 || workspace.canVector;
407
+ if (!canSearch) {
408
+ return {
409
+ results: [],
410
+ query,
411
+ mode: mode || "bm25"
412
+ };
413
+ }
414
+ let searchMode = mode;
415
+ if (!searchMode) {
416
+ if (workspace.canHybrid) {
417
+ searchMode = "hybrid";
418
+ } else if (workspace.canVector) {
419
+ searchMode = "vector";
420
+ } else {
421
+ searchMode = "bm25";
422
+ }
423
+ }
424
+ const results = await workspace.search(query, {
425
+ topK: topK || 5,
426
+ mode: searchMode,
427
+ minScore
428
+ });
429
+ return {
430
+ results: results.map((r) => ({
431
+ id: r.id,
432
+ content: r.content,
433
+ score: r.score,
434
+ lineRange: r.lineRange,
435
+ scoreDetails: r.scoreDetails
436
+ })),
437
+ query,
438
+ mode: searchMode
439
+ };
440
+ } catch (error) {
441
+ return handleError(error, "Error searching workspace");
442
+ }
443
+ }
444
+ });
445
+ var WORKSPACE_INDEX_ROUTE = createRoute({
446
+ method: "POST",
447
+ path: "/workspaces/:workspaceId/index",
448
+ responseType: "json",
449
+ pathParamSchema: workspaceIdPathParams,
450
+ bodySchema: indexBodySchema,
451
+ responseSchema: indexResponseSchema,
452
+ summary: "Index content for search",
453
+ description: "Indexes content for later search operations",
454
+ tags: ["Workspace"],
455
+ handler: async ({ mastra, path, content, metadata, workspaceId }) => {
456
+ try {
457
+ requireWorkspaceV1Support();
458
+ if (!path || content === void 0) {
459
+ throw new HTTPException(400, { message: "Path and content are required" });
460
+ }
461
+ const workspace = await getWorkspaceById(mastra, workspaceId);
462
+ if (!workspace) {
463
+ throw new HTTPException(404, { message: "No workspace configured" });
464
+ }
465
+ const canSearch = workspace.canBM25 || workspace.canVector;
466
+ if (!canSearch) {
467
+ throw new HTTPException(400, { message: "Workspace does not have search configured" });
468
+ }
469
+ await workspace.index(path, content, { metadata });
470
+ return {
471
+ success: true,
472
+ path
473
+ };
474
+ } catch (error) {
475
+ return handleError(error, "Error indexing content");
476
+ }
477
+ }
478
+ });
479
+ var WORKSPACE_LIST_SKILLS_ROUTE = createRoute({
480
+ method: "GET",
481
+ path: "/workspaces/:workspaceId/skills",
482
+ responseType: "json",
483
+ pathParamSchema: workspaceIdPathParams,
484
+ responseSchema: listSkillsResponseSchema,
485
+ summary: "List all skills",
486
+ description: "Returns a list of all discovered skills with their metadata",
487
+ tags: ["Workspace", "Skills"],
488
+ handler: async ({ mastra, workspaceId, requestContext }) => {
489
+ try {
490
+ requireWorkspaceV1Support();
491
+ const skills = await getSkillsById(mastra, workspaceId);
492
+ if (!skills) {
493
+ return { skills: [], isSkillsConfigured: false };
494
+ }
495
+ await skills.maybeRefresh({ requestContext });
496
+ const skillsList = await skills.list();
497
+ return {
498
+ skills: skillsList.map((skill) => ({
499
+ name: skill.name,
500
+ description: skill.description,
501
+ license: skill.license,
502
+ compatibility: skill.compatibility,
503
+ metadata: skill.metadata
504
+ })),
505
+ isSkillsConfigured: true
506
+ };
507
+ } catch (error) {
508
+ return handleError(error, "Error listing skills");
509
+ }
510
+ }
511
+ });
512
+ var WORKSPACE_GET_SKILL_ROUTE = createRoute({
513
+ method: "GET",
514
+ path: "/workspaces/:workspaceId/skills/:skillName",
515
+ responseType: "json",
516
+ pathParamSchema: skillNamePathParams,
517
+ responseSchema: getSkillResponseSchema,
518
+ summary: "Get skill details",
519
+ description: "Returns the full details of a specific skill including instructions and file lists",
520
+ tags: ["Workspace", "Skills"],
521
+ handler: async ({ mastra, skillName, workspaceId, requestContext }) => {
522
+ try {
523
+ requireWorkspaceV1Support();
524
+ if (!skillName) {
525
+ throw new HTTPException(400, { message: "Skill name is required" });
526
+ }
527
+ const skills = await getSkillsById(mastra, workspaceId);
528
+ if (!skills) {
529
+ throw new HTTPException(404, { message: "No workspace with skills configured" });
530
+ }
531
+ await skills.maybeRefresh({ requestContext });
532
+ const skill = await skills.get(skillName);
533
+ if (!skill) {
534
+ throw new HTTPException(404, { message: `Skill "${skillName}" not found` });
535
+ }
536
+ return {
537
+ name: skill.name,
538
+ description: skill.description,
539
+ license: skill.license,
540
+ compatibility: skill.compatibility,
541
+ metadata: skill.metadata,
542
+ path: skill.path,
543
+ instructions: skill.instructions,
544
+ source: skill.source,
545
+ references: skill.references,
546
+ scripts: skill.scripts,
547
+ assets: skill.assets
548
+ };
549
+ } catch (error) {
550
+ return handleError(error, "Error getting skill");
551
+ }
552
+ }
553
+ });
554
+ var WORKSPACE_LIST_SKILL_REFERENCES_ROUTE = createRoute({
555
+ method: "GET",
556
+ path: "/workspaces/:workspaceId/skills/:skillName/references",
557
+ responseType: "json",
558
+ pathParamSchema: skillNamePathParams,
559
+ responseSchema: listReferencesResponseSchema,
560
+ summary: "List skill references",
561
+ description: "Returns a list of all reference file paths for a skill",
562
+ tags: ["Workspace", "Skills"],
563
+ handler: async ({ mastra, skillName, workspaceId, requestContext }) => {
564
+ try {
565
+ requireWorkspaceV1Support();
566
+ if (!skillName) {
567
+ throw new HTTPException(400, { message: "Skill name is required" });
568
+ }
569
+ const skills = await getSkillsById(mastra, workspaceId);
570
+ if (!skills) {
571
+ throw new HTTPException(404, { message: "No workspace with skills configured" });
572
+ }
573
+ await skills.maybeRefresh({ requestContext });
574
+ const hasSkill = await skills.has(skillName);
575
+ if (!hasSkill) {
576
+ throw new HTTPException(404, { message: `Skill "${skillName}" not found` });
577
+ }
578
+ const references = await skills.listReferences(skillName);
579
+ return {
580
+ skillName,
581
+ references
582
+ };
583
+ } catch (error) {
584
+ return handleError(error, "Error listing skill references");
585
+ }
586
+ }
587
+ });
588
+ var WORKSPACE_GET_SKILL_REFERENCE_ROUTE = createRoute({
589
+ method: "GET",
590
+ path: "/workspaces/:workspaceId/skills/:skillName/references/:referencePath",
591
+ responseType: "json",
592
+ pathParamSchema: skillReferencePathParams,
593
+ responseSchema: skillReferenceResponseSchema,
594
+ summary: "Get skill reference content",
595
+ description: "Returns the content of a specific reference file from a skill",
596
+ tags: ["Workspace", "Skills"],
597
+ handler: async ({ mastra, skillName, referencePath, workspaceId, requestContext }) => {
598
+ try {
599
+ requireWorkspaceV1Support();
600
+ if (!skillName || !referencePath) {
601
+ throw new HTTPException(400, { message: "Skill name and reference path are required" });
602
+ }
603
+ const skills = await getSkillsById(mastra, workspaceId);
604
+ if (!skills) {
605
+ throw new HTTPException(404, { message: "No workspace with skills configured" });
606
+ }
607
+ await skills.maybeRefresh({ requestContext });
608
+ const decodedPath = decodeURIComponent(referencePath);
609
+ const content = await skills.getReference(skillName, decodedPath);
610
+ if (content === null) {
611
+ throw new HTTPException(404, { message: `Reference "${decodedPath}" not found in skill "${skillName}"` });
612
+ }
613
+ return {
614
+ skillName,
615
+ referencePath: decodedPath,
616
+ content
617
+ };
618
+ } catch (error) {
619
+ return handleError(error, "Error getting skill reference");
620
+ }
621
+ }
622
+ });
623
+ var WORKSPACE_SEARCH_SKILLS_ROUTE = createRoute({
624
+ method: "GET",
625
+ path: "/workspaces/:workspaceId/skills/search",
626
+ responseType: "json",
627
+ pathParamSchema: workspaceIdPathParams,
628
+ queryParamSchema: searchSkillsQuerySchema,
629
+ responseSchema: searchSkillsResponseSchema,
630
+ summary: "Search skills",
631
+ description: "Searches across all skills content using BM25 keyword search",
632
+ tags: ["Workspace", "Skills"],
633
+ handler: async ({ mastra, query, topK, minScore, skillNames, includeReferences, workspaceId, requestContext }) => {
634
+ try {
635
+ requireWorkspaceV1Support();
636
+ if (!query) {
637
+ throw new HTTPException(400, { message: "Search query is required" });
638
+ }
639
+ const skills = await getSkillsById(mastra, workspaceId);
640
+ if (!skills) {
641
+ return {
642
+ results: [],
643
+ query
644
+ };
645
+ }
646
+ await skills.maybeRefresh({ requestContext });
647
+ const skillNamesList = skillNames ? skillNames.split(",").map((s) => s.trim()) : void 0;
648
+ const results = await skills.search(query, {
649
+ topK: topK || 5,
650
+ minScore,
651
+ skillNames: skillNamesList,
652
+ includeReferences: includeReferences ?? true
653
+ });
654
+ return {
655
+ results: results.map((r) => ({
656
+ skillName: r.skillName,
657
+ source: r.source,
658
+ content: r.content,
659
+ score: r.score,
660
+ lineRange: r.lineRange,
661
+ scoreDetails: r.scoreDetails
662
+ })),
663
+ query
664
+ };
665
+ } catch (error) {
666
+ return handleError(error, "Error searching skills");
667
+ }
668
+ }
669
+ });
670
+ var WORKSPACE_FS_ROUTES = [
671
+ WORKSPACE_FS_READ_ROUTE,
672
+ WORKSPACE_FS_WRITE_ROUTE,
673
+ WORKSPACE_FS_LIST_ROUTE,
674
+ WORKSPACE_FS_DELETE_ROUTE,
675
+ WORKSPACE_FS_MKDIR_ROUTE,
676
+ WORKSPACE_FS_STAT_ROUTE
677
+ ];
678
+ var WORKSPACE_SEARCH_ROUTES = [WORKSPACE_SEARCH_ROUTE, WORKSPACE_INDEX_ROUTE];
679
+ var WORKSPACE_SKILLS_ROUTES = [
680
+ WORKSPACE_SEARCH_SKILLS_ROUTE,
681
+ WORKSPACE_LIST_SKILLS_ROUTE,
682
+ WORKSPACE_GET_SKILL_ROUTE,
683
+ WORKSPACE_LIST_SKILL_REFERENCES_ROUTE,
684
+ WORKSPACE_GET_SKILL_REFERENCE_ROUTE
685
+ ];
686
+
687
+ export { GET_WORKSPACE_ROUTE, LIST_WORKSPACES_ROUTE, WORKSPACE_FS_DELETE_ROUTE, WORKSPACE_FS_LIST_ROUTE, WORKSPACE_FS_MKDIR_ROUTE, WORKSPACE_FS_READ_ROUTE, WORKSPACE_FS_ROUTES, WORKSPACE_FS_STAT_ROUTE, WORKSPACE_FS_WRITE_ROUTE, WORKSPACE_GET_SKILL_REFERENCE_ROUTE, WORKSPACE_GET_SKILL_ROUTE, WORKSPACE_INDEX_ROUTE, WORKSPACE_LIST_SKILLS_ROUTE, WORKSPACE_LIST_SKILL_REFERENCES_ROUTE, WORKSPACE_SEARCH_ROUTE, WORKSPACE_SEARCH_ROUTES, WORKSPACE_SEARCH_SKILLS_ROUTE, WORKSPACE_SKILLS_ROUTES };
688
+ //# sourceMappingURL=chunk-3AZY5AWI.js.map
689
+ //# sourceMappingURL=chunk-3AZY5AWI.js.map