@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.
- package/CHANGELOG.md +194 -0
- package/a2a/store.d.ts +1 -0
- package/auth.d.ts +1 -0
- package/dist/{chunk-3REGEJEN.js → chunk-24SISJRB.js} +6 -6
- package/dist/chunk-24SISJRB.js.map +1 -0
- package/dist/{chunk-MPUVSOEU.cjs → chunk-2HOMKKY4.cjs} +21 -15
- package/dist/chunk-2HOMKKY4.cjs.map +1 -0
- package/dist/{chunk-HCVDHEDD.cjs → chunk-37DO73XV.cjs} +217 -167
- package/dist/chunk-37DO73XV.cjs.map +1 -0
- package/dist/{chunk-T4SPG2GP.cjs → chunk-4HFYR562.cjs} +4 -4
- package/dist/chunk-4HFYR562.cjs.map +1 -0
- package/dist/{chunk-2CYGIE3E.js → chunk-4JAEBN6N.js} +212 -86
- package/dist/chunk-4JAEBN6N.js.map +1 -0
- package/dist/{chunk-AVRO3FIN.cjs → chunk-4LVJBXI2.cjs} +97 -4
- package/dist/chunk-4LVJBXI2.cjs.map +1 -0
- package/dist/chunk-4UNYZYBB.cjs +253 -0
- package/dist/chunk-4UNYZYBB.cjs.map +1 -0
- package/dist/{chunk-CGIGPJRU.js → chunk-5P2VGES5.js} +72 -79
- package/dist/chunk-5P2VGES5.js.map +1 -0
- package/dist/{chunk-YK63KHHB.cjs → chunk-6DHJKQLP.cjs} +513 -168
- package/dist/chunk-6DHJKQLP.cjs.map +1 -0
- package/dist/{chunk-PNZQCQY4.cjs → chunk-6G2RQWKA.cjs} +15 -15
- package/dist/chunk-6G2RQWKA.cjs.map +1 -0
- package/dist/{chunk-4EYONQIW.cjs → chunk-7D3UAMQM.cjs} +4 -4
- package/dist/chunk-7D3UAMQM.cjs.map +1 -0
- package/dist/{chunk-I27H7BEB.js → chunk-7XIMPDJV.js} +9 -6
- package/dist/chunk-7XIMPDJV.js.map +1 -0
- package/dist/{chunk-2CLS2PYJ.js → chunk-7YCFHDWX.js} +398 -56
- package/dist/chunk-7YCFHDWX.js.map +1 -0
- package/dist/{chunk-33CKPQS4.cjs → chunk-A2K5ZL47.cjs} +36 -16
- package/dist/chunk-A2K5ZL47.cjs.map +1 -0
- package/dist/chunk-AAHPYUEC.cjs +211 -0
- package/dist/chunk-AAHPYUEC.cjs.map +1 -0
- package/dist/{chunk-NUO7HPOV.cjs → chunk-AN42MFD5.cjs} +235 -109
- package/dist/chunk-AN42MFD5.cjs.map +1 -0
- package/dist/{chunk-XCEQ4GQW.cjs → chunk-AO7LIZRK.cjs} +88 -99
- package/dist/chunk-AO7LIZRK.cjs.map +1 -0
- package/dist/{chunk-4DJ7EJRB.cjs → chunk-AV3VZ6S3.cjs} +25 -21
- package/dist/chunk-AV3VZ6S3.cjs.map +1 -0
- package/dist/{chunk-KKY4MSZO.js → chunk-BWINB344.js} +30 -11
- package/dist/chunk-BWINB344.js.map +1 -0
- package/dist/{chunk-GHQZIEPS.js → chunk-C4NZAUUW.js} +104 -54
- package/dist/chunk-C4NZAUUW.js.map +1 -0
- package/dist/{chunk-7S7ALPCY.js → chunk-D5VCL56B.js} +97 -5
- package/dist/chunk-D5VCL56B.js.map +1 -0
- package/dist/{chunk-XB27LCKO.js → chunk-DHDVJ5II.js} +15 -9
- package/dist/chunk-DHDVJ5II.js.map +1 -0
- package/dist/{chunk-GNCALVLC.js → chunk-ED6NQBHF.js} +23 -4
- package/dist/chunk-ED6NQBHF.js.map +1 -0
- package/dist/{chunk-5VDI75UV.js → chunk-EV5H2JQU.js} +5 -4
- package/dist/chunk-EV5H2JQU.js.map +1 -0
- package/dist/{chunk-4R2Z655M.js → chunk-F2WTCJ5C.js} +145 -67
- package/dist/chunk-F2WTCJ5C.js.map +1 -0
- package/dist/{chunk-FWSKVWS7.cjs → chunk-FRRHYZR6.cjs} +4 -4
- package/dist/chunk-FRRHYZR6.cjs.map +1 -0
- package/dist/chunk-GDWZ2R7I.js +220 -0
- package/dist/chunk-GDWZ2R7I.js.map +1 -0
- package/dist/{chunk-N4EIZSG2.js → chunk-GXUBQJ74.js} +15 -11
- package/dist/chunk-GXUBQJ74.js.map +1 -0
- package/dist/{chunk-UK4FZWNW.cjs → chunk-H4VFL22H.cjs} +52 -53
- package/dist/chunk-H4VFL22H.cjs.map +1 -0
- package/dist/chunk-H66LLFDL.js +1 -1
- package/dist/chunk-H66LLFDL.js.map +1 -1
- package/dist/{chunk-QPFYN6B5.cjs → chunk-HDGF45K7.cjs} +17 -14
- package/dist/chunk-HDGF45K7.cjs.map +1 -0
- package/dist/{chunk-P3H4AZKI.cjs → chunk-HZINLMHL.cjs} +15 -15
- package/dist/chunk-HZINLMHL.cjs.map +1 -0
- package/dist/{chunk-AV3CN5ZR.cjs → chunk-I3CJUT6J.cjs} +36 -17
- package/dist/chunk-I3CJUT6J.cjs.map +1 -0
- package/dist/{chunk-DVSCJECS.js → chunk-IS3HHGL4.js} +6 -6
- package/dist/chunk-IS3HHGL4.js.map +1 -0
- package/dist/{chunk-WJ6DNHLW.cjs → chunk-JRM3DWRM.cjs} +34 -24
- package/dist/chunk-JRM3DWRM.cjs.map +1 -0
- package/dist/{chunk-YN3FWKVQ.js → chunk-JUGGEWCR.js} +10 -13
- package/dist/chunk-JUGGEWCR.js.map +1 -0
- package/dist/{chunk-LF2ZLOFP.js → chunk-K2SXZLA3.cjs} +285 -3
- package/dist/chunk-K2SXZLA3.cjs.map +1 -0
- package/dist/{chunk-XOUK3IYU.js → chunk-K4HSW5ZF.js} +4 -4
- package/dist/chunk-K4HSW5ZF.js.map +1 -0
- package/dist/chunk-KPHPNRVH.js +651 -0
- package/dist/chunk-KPHPNRVH.js.map +1 -0
- package/dist/chunk-L6AKFVEX.cjs +678 -0
- package/dist/chunk-L6AKFVEX.cjs.map +1 -0
- package/dist/{chunk-GU4EWMZB.cjs → chunk-LFNP3ACE.js} +244 -4
- package/dist/chunk-LFNP3ACE.js.map +1 -0
- package/dist/chunk-LFTVDHOD.js +200 -0
- package/dist/chunk-LFTVDHOD.js.map +1 -0
- package/dist/{chunk-ZQ2G6QKS.cjs → chunk-MZRJNOYJ.cjs} +175 -97
- package/dist/chunk-MZRJNOYJ.cjs.map +1 -0
- package/dist/{chunk-G2AMUTU4.js → chunk-OS7SAIRA.js} +6 -6
- package/dist/chunk-OS7SAIRA.js.map +1 -0
- package/dist/{chunk-L2E5RUVT.cjs → chunk-PWXUI3OG.cjs} +15 -15
- package/dist/chunk-PWXUI3OG.cjs.map +1 -0
- package/dist/chunk-QRPQWZZU.cjs +708 -0
- package/dist/chunk-QRPQWZZU.cjs.map +1 -0
- package/dist/chunk-QWOQET2T.js +689 -0
- package/dist/chunk-QWOQET2T.js.map +1 -0
- package/dist/{chunk-EUBTCHQC.js → chunk-RIX6WEJ2.js} +4 -4
- package/dist/chunk-RIX6WEJ2.js.map +1 -0
- package/dist/{chunk-7XPMKW4Y.cjs → chunk-SONAXR2M.cjs} +12 -9
- package/dist/chunk-SONAXR2M.cjs.map +1 -0
- package/dist/{chunk-FLLJIPD4.cjs → chunk-T5KH32UA.cjs} +6 -5
- package/dist/chunk-T5KH32UA.cjs.map +1 -0
- package/dist/{chunk-3FEYUHHJ.js → chunk-TCWPL26W.js} +10 -7
- package/dist/chunk-TCWPL26W.js.map +1 -0
- package/dist/chunk-USR6JK77.js +62 -0
- package/dist/chunk-USR6JK77.js.map +1 -0
- package/dist/chunk-VX3VN7FN.cjs +1 -1
- package/dist/chunk-VX3VN7FN.cjs.map +1 -1
- package/dist/{chunk-6MP2S6VI.cjs → chunk-VXPVROQJ.cjs} +56 -48
- package/dist/chunk-VXPVROQJ.cjs.map +1 -0
- package/dist/{chunk-CLAEGIP5.cjs → chunk-WWVDNKEF.cjs} +14 -17
- package/dist/chunk-WWVDNKEF.cjs.map +1 -0
- package/dist/{chunk-5NFRDYFN.js → chunk-XKLJYRAA.js} +4 -4
- package/dist/chunk-XKLJYRAA.js.map +1 -0
- package/dist/{chunk-TMS4LS2J.js → chunk-XUSAKRLX.js} +26 -16
- package/dist/chunk-XUSAKRLX.js.map +1 -0
- package/dist/{chunk-IVGQTL3T.js → chunk-XXBURIYX.js} +36 -28
- package/dist/chunk-XXBURIYX.js.map +1 -0
- package/dist/{chunk-H34VRYSF.js → chunk-ZFHZRI6C.js} +26 -27
- package/dist/chunk-ZFHZRI6C.js.map +1 -0
- package/dist/chunk-ZKMVCV4G.cjs +71 -0
- package/dist/chunk-ZKMVCV4G.cjs.map +1 -0
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +1 -1
- package/dist/docs/server/01-custom-adapters.md +10 -10
- package/dist/docs/server/02-reference.md +22 -8
- package/dist/server/auth/helpers.d.ts +8 -1
- package/dist/server/auth/helpers.d.ts.map +1 -1
- package/dist/server/auth/index.cjs +42 -131
- package/dist/server/auth/index.cjs.map +1 -1
- package/dist/server/auth/index.js +1 -125
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/auth/path-pattern.d.ts +43 -0
- package/dist/server/auth/path-pattern.d.ts.map +1 -0
- package/dist/server/constants.d.ts +51 -0
- package/dist/server/constants.d.ts.map +1 -0
- package/dist/server/handlers/a2a.cjs +9 -9
- package/dist/server/handlers/a2a.d.ts.map +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-versions.cjs +60 -0
- package/dist/server/handlers/agent-versions.cjs.map +1 -0
- package/dist/server/handlers/agent-versions.d.ts +457 -0
- package/dist/server/handlers/agent-versions.d.ts.map +1 -0
- package/dist/server/handlers/agent-versions.js +3 -0
- package/dist/server/handlers/agent-versions.js.map +1 -0
- package/dist/server/handlers/agents.cjs +40 -28
- package/dist/server/handlers/agents.d.ts +58 -5
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.d.ts.map +1 -1
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/mcp.cjs +9 -9
- package/dist/server/handlers/mcp.d.ts +22 -0
- package/dist/server/handlers/mcp.d.ts.map +1 -1
- package/dist/server/handlers/mcp.js +1 -1
- package/dist/server/handlers/memory.cjs +25 -25
- package/dist/server/handlers/memory.d.ts +25 -1
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability.cjs +5 -5
- package/dist/server/handlers/observability.d.ts +1 -0
- package/dist/server/handlers/observability.d.ts.map +1 -1
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/processors.cjs +4 -4
- package/dist/server/handlers/processors.d.ts.map +1 -1
- package/dist/server/handlers/processors.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.d.ts.map +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +6 -6
- package/dist/server/handlers/stored-agents.d.ts +51 -14
- package/dist/server/handlers/stored-agents.d.ts.map +1 -1
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/system.cjs +2 -2
- package/dist/server/handlers/system.d.ts.map +1 -1
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.d.ts +3 -3
- package/dist/server/handlers/tools.d.ts.map +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +21 -5
- package/dist/server/handlers/utils.d.ts +26 -0
- package/dist/server/handlers/utils.d.ts.map +1 -1
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vector.cjs +13 -13
- package/dist/server/handlers/vector.d.ts.map +1 -1
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -8
- package/dist/server/handlers/voice.d.ts.map +1 -1
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +24 -24
- package/dist/server/handlers/workflows.d.ts +2 -0
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers/workspace.cjs +80 -0
- package/dist/server/handlers/workspace.cjs.map +1 -0
- package/dist/server/handlers/workspace.d.ts +591 -0
- package/dist/server/handlers/workspace.d.ts.map +1 -0
- package/dist/server/handlers/workspace.js +3 -0
- package/dist/server/handlers/workspace.js.map +1 -0
- package/dist/server/handlers.cjs +24 -24
- package/dist/server/handlers.js +12 -12
- package/dist/server/schemas/agent-versions.d.ts +1073 -0
- package/dist/server/schemas/agent-versions.d.ts.map +1 -0
- package/dist/server/schemas/agents.d.ts +30 -19
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/memory.d.ts +83 -31
- package/dist/server/schemas/memory.d.ts.map +1 -1
- package/dist/server/schemas/stored-agents.d.ts +270 -60
- package/dist/server/schemas/stored-agents.d.ts.map +1 -1
- package/dist/server/schemas/workspace.d.ts +1107 -0
- package/dist/server/schemas/workspace.d.ts.map +1 -0
- package/dist/server/server-adapter/index.cjs +298 -160
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.d.ts +56 -2
- package/dist/server/server-adapter/index.d.ts.map +1 -1
- package/dist/server/server-adapter/index.js +158 -23
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/openapi-utils.d.ts +10 -0
- package/dist/server/server-adapter/openapi-utils.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/agents.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/index.d.ts +3 -1
- package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/route-builder.d.ts +2 -1
- package/dist/server/server-adapter/routes/route-builder.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/stored-agents.d.ts +1 -1
- package/dist/server/server-adapter/routes/stored-agents.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/workspace.d.ts +8 -0
- package/dist/server/server-adapter/routes/workspace.d.ts.map +1 -0
- package/dist/server/utils.d.ts +13 -0
- package/dist/server/utils.d.ts.map +1 -1
- package/dist/{token-6GSAFR2W-K2BTU23I-5WBYUIGY.cjs → token-6GSAFR2W-ABXTQD64-MC4IMVOB.cjs} +9 -9
- package/dist/token-6GSAFR2W-ABXTQD64-MC4IMVOB.cjs.map +1 -0
- package/dist/{token-6GSAFR2W-VLY2XUPA-NCSASMWN.js → token-6GSAFR2W-ABXTQD64-Z6U2TA2C.js} +6 -6
- package/dist/token-6GSAFR2W-ABXTQD64-Z6U2TA2C.js.map +1 -0
- package/dist/{token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs → token-6GSAFR2W-F2L44NEJ-B3QIV63M.cjs} +9 -9
- package/dist/token-6GSAFR2W-F2L44NEJ-B3QIV63M.cjs.map +1 -0
- package/dist/{token-6GSAFR2W-KVDFAJ2M-VW443KIA.js → token-6GSAFR2W-F2L44NEJ-GFZ37A2V.js} +6 -6
- package/dist/token-6GSAFR2W-F2L44NEJ-GFZ37A2V.js.map +1 -0
- package/dist/{token-6GSAFR2W-VLY2XUPA-RKITWXKR.cjs → token-6GSAFR2W-WGTMOPEU-6HSZQUFZ.cjs} +9 -9
- package/dist/token-6GSAFR2W-WGTMOPEU-6HSZQUFZ.cjs.map +1 -0
- package/dist/{token-6GSAFR2W-K2BTU23I-NW33N3NU.js → token-6GSAFR2W-WGTMOPEU-JKP67ZX4.js} +6 -6
- package/dist/token-6GSAFR2W-WGTMOPEU-JKP67ZX4.js.map +1 -0
- package/dist/token-util-NEHG7TUY-4YJ4EPCL-MBTAVIJ3.js +8 -0
- package/dist/{token-util-NEHG7TUY-TIJ3LMSH-SGVKOKXF.js.map → token-util-NEHG7TUY-4YJ4EPCL-MBTAVIJ3.js.map} +1 -1
- package/dist/token-util-NEHG7TUY-4YJ4EPCL-SQ4NADRW.cjs +10 -0
- package/dist/{token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs.map → token-util-NEHG7TUY-4YJ4EPCL-SQ4NADRW.cjs.map} +1 -1
- package/dist/token-util-NEHG7TUY-TV2H7N56-GGCGMPDG.js +8 -0
- package/dist/{token-util-NEHG7TUY-KSXDO2NO-WH6I3PH3.js.map → token-util-NEHG7TUY-TV2H7N56-GGCGMPDG.js.map} +1 -1
- package/dist/token-util-NEHG7TUY-TV2H7N56-R7OENTCJ.cjs +10 -0
- package/dist/{token-util-NEHG7TUY-KSXDO2NO-J6DEINGO.cjs.map → token-util-NEHG7TUY-TV2H7N56-R7OENTCJ.cjs.map} +1 -1
- package/dist/token-util-NEHG7TUY-XQP3QSPX-BL5O5N7R.cjs +10 -0
- package/dist/{token-util-NEHG7TUY-TIJ3LMSH-ANFISSXX.cjs.map → token-util-NEHG7TUY-XQP3QSPX-BL5O5N7R.cjs.map} +1 -1
- package/dist/token-util-NEHG7TUY-XQP3QSPX-YCJRRNXO.js +8 -0
- package/dist/{token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js.map → token-util-NEHG7TUY-XQP3QSPX-YCJRRNXO.js.map} +1 -1
- package/handlers/server/handlers.d.ts +1 -0
- package/handlers.d.ts +1 -0
- package/package.json +10 -8
- package/server-adapter.d.ts +1 -0
- package/dist/chunk-2CLS2PYJ.js.map +0 -1
- package/dist/chunk-2CYGIE3E.js.map +0 -1
- package/dist/chunk-33CKPQS4.cjs.map +0 -1
- package/dist/chunk-3FEYUHHJ.js.map +0 -1
- package/dist/chunk-3REGEJEN.js.map +0 -1
- package/dist/chunk-4DJ7EJRB.cjs.map +0 -1
- package/dist/chunk-4EYONQIW.cjs.map +0 -1
- package/dist/chunk-4R2Z655M.js.map +0 -1
- package/dist/chunk-5NFRDYFN.js.map +0 -1
- package/dist/chunk-5VDI75UV.js.map +0 -1
- package/dist/chunk-5W4RPVTK.cjs +0 -49
- package/dist/chunk-5W4RPVTK.cjs.map +0 -1
- package/dist/chunk-6MP2S6VI.cjs.map +0 -1
- package/dist/chunk-7S7ALPCY.js.map +0 -1
- package/dist/chunk-7XPMKW4Y.cjs.map +0 -1
- package/dist/chunk-AV3CN5ZR.cjs.map +0 -1
- package/dist/chunk-AVRO3FIN.cjs.map +0 -1
- package/dist/chunk-BRI4GUZ2.cjs +0 -280
- package/dist/chunk-BRI4GUZ2.cjs.map +0 -1
- package/dist/chunk-CGIGPJRU.js.map +0 -1
- package/dist/chunk-CLAEGIP5.cjs.map +0 -1
- package/dist/chunk-DVSCJECS.js.map +0 -1
- package/dist/chunk-EUBTCHQC.js.map +0 -1
- package/dist/chunk-FLLJIPD4.cjs.map +0 -1
- package/dist/chunk-FWSKVWS7.cjs.map +0 -1
- package/dist/chunk-G2AMUTU4.js.map +0 -1
- package/dist/chunk-GHQZIEPS.js.map +0 -1
- package/dist/chunk-GNCALVLC.js.map +0 -1
- package/dist/chunk-GU4EWMZB.cjs.map +0 -1
- package/dist/chunk-H34VRYSF.js.map +0 -1
- package/dist/chunk-HCVDHEDD.cjs.map +0 -1
- package/dist/chunk-I27H7BEB.js.map +0 -1
- package/dist/chunk-IVGQTL3T.js.map +0 -1
- package/dist/chunk-KKY4MSZO.js.map +0 -1
- package/dist/chunk-L2E5RUVT.cjs.map +0 -1
- package/dist/chunk-LF2ZLOFP.js.map +0 -1
- package/dist/chunk-MPUVSOEU.cjs.map +0 -1
- package/dist/chunk-N4EIZSG2.js.map +0 -1
- package/dist/chunk-NUO7HPOV.cjs.map +0 -1
- package/dist/chunk-P3H4AZKI.cjs.map +0 -1
- package/dist/chunk-PNZQCQY4.cjs.map +0 -1
- package/dist/chunk-QPFYN6B5.cjs.map +0 -1
- package/dist/chunk-T4SPG2GP.cjs.map +0 -1
- package/dist/chunk-TMS4LS2J.js.map +0 -1
- package/dist/chunk-UK4FZWNW.cjs.map +0 -1
- package/dist/chunk-WJ6DNHLW.cjs.map +0 -1
- package/dist/chunk-WLGJVDH4.js +0 -242
- package/dist/chunk-WLGJVDH4.js.map +0 -1
- package/dist/chunk-XB27LCKO.js.map +0 -1
- package/dist/chunk-XCEQ4GQW.cjs.map +0 -1
- package/dist/chunk-XOUK3IYU.js.map +0 -1
- package/dist/chunk-XWGAT2DA.js +0 -44
- package/dist/chunk-XWGAT2DA.js.map +0 -1
- package/dist/chunk-YK63KHHB.cjs.map +0 -1
- package/dist/chunk-YN3FWKVQ.js.map +0 -1
- package/dist/chunk-ZQ2G6QKS.cjs.map +0 -1
- package/dist/token-6GSAFR2W-K2BTU23I-5WBYUIGY.cjs.map +0 -1
- package/dist/token-6GSAFR2W-K2BTU23I-NW33N3NU.js.map +0 -1
- package/dist/token-6GSAFR2W-KVDFAJ2M-EPLMGMHT.cjs.map +0 -1
- package/dist/token-6GSAFR2W-KVDFAJ2M-VW443KIA.js.map +0 -1
- package/dist/token-6GSAFR2W-VLY2XUPA-NCSASMWN.js.map +0 -1
- package/dist/token-6GSAFR2W-VLY2XUPA-RKITWXKR.cjs.map +0 -1
- package/dist/token-util-NEHG7TUY-DJYRKLRD-6TH3ODCN.cjs +0 -10
- package/dist/token-util-NEHG7TUY-DJYRKLRD-EACKYD4V.js +0 -8
- package/dist/token-util-NEHG7TUY-KSXDO2NO-J6DEINGO.cjs +0 -10
- package/dist/token-util-NEHG7TUY-KSXDO2NO-WH6I3PH3.js +0 -8
- package/dist/token-util-NEHG7TUY-TIJ3LMSH-ANFISSXX.cjs +0 -10
- 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-GDWZ2R7I.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-QWOQET2T.js.map
|
|
689
|
+
//# sourceMappingURL=chunk-QWOQET2T.js.map
|