@mastra/server 1.0.4 → 1.1.0-alpha.1

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