@mastra/server 1.13.1 → 1.13.2
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 +14 -0
- package/dist/{chunk-LTW7QJJM.cjs → chunk-2X2QEOBC.cjs} +7 -7
- package/dist/{chunk-LTW7QJJM.cjs.map → chunk-2X2QEOBC.cjs.map} +1 -1
- package/dist/{chunk-SN5WY6KR.js → chunk-3O2XU4R5.js} +3 -3
- package/dist/{chunk-SN5WY6KR.js.map → chunk-3O2XU4R5.js.map} +1 -1
- package/dist/{chunk-SJDL4IBP.cjs → chunk-3VBBHP5G.cjs} +5 -5
- package/dist/{chunk-SJDL4IBP.cjs.map → chunk-3VBBHP5G.cjs.map} +1 -1
- package/dist/{chunk-U6EAQWH7.cjs → chunk-44S3O6VF.cjs} +28 -28
- package/dist/{chunk-U6EAQWH7.cjs.map → chunk-44S3O6VF.cjs.map} +1 -1
- package/dist/{chunk-65NDEEZ4.cjs → chunk-4XOJJK3B.cjs} +10 -10
- package/dist/{chunk-65NDEEZ4.cjs.map → chunk-4XOJJK3B.cjs.map} +1 -1
- package/dist/{chunk-M43DX6WL.js → chunk-6QUFDLBF.js} +5 -5
- package/dist/{chunk-M43DX6WL.js.map → chunk-6QUFDLBF.js.map} +1 -1
- package/dist/{chunk-E3IZXSS5.cjs → chunk-72KRYAZX.cjs} +30 -30
- package/dist/{chunk-E3IZXSS5.cjs.map → chunk-72KRYAZX.cjs.map} +1 -1
- package/dist/{chunk-EBNBLMPH.cjs → chunk-763JNSNR.cjs} +10 -10
- package/dist/{chunk-EBNBLMPH.cjs.map → chunk-763JNSNR.cjs.map} +1 -1
- package/dist/{chunk-B3GTJJUR.js → chunk-7P26KAVV.js} +3 -3
- package/dist/{chunk-B3GTJJUR.js.map → chunk-7P26KAVV.js.map} +1 -1
- package/dist/{chunk-AE7HSMHU.js → chunk-7XTR7SGG.js} +4 -4
- package/dist/{chunk-AE7HSMHU.js.map → chunk-7XTR7SGG.js.map} +1 -1
- package/dist/{chunk-M4VTLTPP.js → chunk-A4GP73T6.js} +3 -3
- package/dist/{chunk-M4VTLTPP.js.map → chunk-A4GP73T6.js.map} +1 -1
- package/dist/{chunk-OL7YD5ES.js → chunk-B2I3RSXI.js} +3 -3
- package/dist/{chunk-OL7YD5ES.js.map → chunk-B2I3RSXI.js.map} +1 -1
- package/dist/{chunk-NTVI27EW.js → chunk-B3JW6PKL.js} +4 -4
- package/dist/{chunk-NTVI27EW.js.map → chunk-B3JW6PKL.js.map} +1 -1
- package/dist/{chunk-WGQT66CP.js → chunk-BHU52WEM.js} +3 -3
- package/dist/{chunk-WGQT66CP.js.map → chunk-BHU52WEM.js.map} +1 -1
- package/dist/{chunk-66OMEUI3.js → chunk-BSI7ATYY.js} +3 -3
- package/dist/{chunk-66OMEUI3.js.map → chunk-BSI7ATYY.js.map} +1 -1
- package/dist/{chunk-NWDYTJCD.cjs → chunk-C6CO5YP4.cjs} +11 -11
- package/dist/{chunk-NWDYTJCD.cjs.map → chunk-C6CO5YP4.cjs.map} +1 -1
- package/dist/{chunk-DKXHFVP5.cjs → chunk-EJALJUGI.cjs} +11 -11
- package/dist/{chunk-DKXHFVP5.cjs.map → chunk-EJALJUGI.cjs.map} +1 -1
- package/dist/{chunk-6BG6HMRQ.js → chunk-EWYXWEIC.js} +4 -4
- package/dist/{chunk-6BG6HMRQ.js.map → chunk-EWYXWEIC.js.map} +1 -1
- package/dist/{chunk-4QX6ZNKX.cjs → chunk-EZCRZUSZ.cjs} +10 -4
- package/dist/chunk-EZCRZUSZ.cjs.map +1 -0
- package/dist/{chunk-IBEDJJH7.cjs → chunk-FK2EKCKD.cjs} +10 -10
- package/dist/{chunk-IBEDJJH7.cjs.map → chunk-FK2EKCKD.cjs.map} +1 -1
- package/dist/{chunk-KZTWMA6Y.js → chunk-G7COYXLW.js} +3 -3
- package/dist/{chunk-KZTWMA6Y.js.map → chunk-G7COYXLW.js.map} +1 -1
- package/dist/{chunk-CZAPCZJQ.js → chunk-G7SPHSNU.js} +3 -3
- package/dist/{chunk-CZAPCZJQ.js.map → chunk-G7SPHSNU.js.map} +1 -1
- package/dist/{chunk-LVUSXHFQ.cjs → chunk-JHZRTNIW.cjs} +17 -17
- package/dist/{chunk-LVUSXHFQ.cjs.map → chunk-JHZRTNIW.cjs.map} +1 -1
- package/dist/{chunk-K57KYKGV.cjs → chunk-K2HPB7GW.cjs} +12 -12
- package/dist/{chunk-K57KYKGV.cjs.map → chunk-K2HPB7GW.cjs.map} +1 -1
- package/dist/{chunk-BEMXYFXO.js → chunk-K3MAWEYM.js} +10 -4
- package/dist/chunk-K3MAWEYM.js.map +1 -0
- package/dist/{chunk-QNVZOAHV.cjs → chunk-K5LN7LC7.cjs} +6 -6
- package/dist/{chunk-QNVZOAHV.cjs.map → chunk-K5LN7LC7.cjs.map} +1 -1
- package/dist/{chunk-OBYIKFB5.js → chunk-LB37QWAP.js} +3 -3
- package/dist/{chunk-OBYIKFB5.js.map → chunk-LB37QWAP.js.map} +1 -1
- package/dist/{chunk-TXIKPJ36.cjs → chunk-LKF5W6CH.cjs} +10 -10
- package/dist/{chunk-TXIKPJ36.cjs.map → chunk-LKF5W6CH.cjs.map} +1 -1
- package/dist/{chunk-KY2T2LGF.js → chunk-LQ7HUDWG.js} +3 -3
- package/dist/{chunk-KY2T2LGF.js.map → chunk-LQ7HUDWG.js.map} +1 -1
- package/dist/{chunk-4LBQND5M.cjs → chunk-LUI5H2OG.cjs} +11 -11
- package/dist/{chunk-4LBQND5M.cjs.map → chunk-LUI5H2OG.cjs.map} +1 -1
- package/dist/{chunk-XQO6WDMB.js → chunk-LXUP2PQ7.js} +4 -4
- package/dist/{chunk-XQO6WDMB.js.map → chunk-LXUP2PQ7.js.map} +1 -1
- package/dist/{chunk-FXEFZ4I7.js → chunk-MT3JDOGB.js} +3 -3
- package/dist/{chunk-FXEFZ4I7.js.map → chunk-MT3JDOGB.js.map} +1 -1
- package/dist/{chunk-44647BIB.js → chunk-N4LZOZNQ.js} +3 -3
- package/dist/{chunk-44647BIB.js.map → chunk-N4LZOZNQ.js.map} +1 -1
- package/dist/{chunk-EOW62QFL.cjs → chunk-N5TSRVSJ.cjs} +10 -10
- package/dist/{chunk-EOW62QFL.cjs.map → chunk-N5TSRVSJ.cjs.map} +1 -1
- package/dist/{chunk-JQQXFGB6.cjs → chunk-NKDJ3NB7.cjs} +13 -13
- package/dist/{chunk-JQQXFGB6.cjs.map → chunk-NKDJ3NB7.cjs.map} +1 -1
- package/dist/{chunk-TBLUAAKQ.js → chunk-NPM6FP7U.js} +4 -4
- package/dist/{chunk-TBLUAAKQ.js.map → chunk-NPM6FP7U.js.map} +1 -1
- package/dist/{chunk-7AKW6TJ5.js → chunk-NVOAOFBL.js} +4 -4
- package/dist/{chunk-7AKW6TJ5.js.map → chunk-NVOAOFBL.js.map} +1 -1
- package/dist/{chunk-WGVBEWQN.js → chunk-ODFFO43L.js} +3 -3
- package/dist/{chunk-WGVBEWQN.js.map → chunk-ODFFO43L.js.map} +1 -1
- package/dist/{chunk-TSKCUSXO.cjs → chunk-OKKKF7JI.cjs} +10 -10
- package/dist/{chunk-TSKCUSXO.cjs.map → chunk-OKKKF7JI.cjs.map} +1 -1
- package/dist/{chunk-EAC2YVRT.js → chunk-OM7JB5WU.js} +5 -5
- package/dist/{chunk-EAC2YVRT.js.map → chunk-OM7JB5WU.js.map} +1 -1
- package/dist/{chunk-4EICDPHC.cjs → chunk-OWE6WTET.cjs} +42 -42
- package/dist/{chunk-4EICDPHC.cjs.map → chunk-OWE6WTET.cjs.map} +1 -1
- package/dist/{chunk-VNTOJ7A6.js → chunk-Q4ZCPUL5.js} +4 -4
- package/dist/{chunk-VNTOJ7A6.js.map → chunk-Q4ZCPUL5.js.map} +1 -1
- package/dist/{chunk-7IDWCHWJ.cjs → chunk-QMSOF7KE.cjs} +4 -4
- package/dist/{chunk-7IDWCHWJ.cjs.map → chunk-QMSOF7KE.cjs.map} +1 -1
- package/dist/{chunk-7UYCRF6V.cjs → chunk-R55KCZUE.cjs} +10 -10
- package/dist/{chunk-7UYCRF6V.cjs.map → chunk-R55KCZUE.cjs.map} +1 -1
- package/dist/{chunk-DRYSGNJH.js → chunk-RHEEYK4H.js} +3 -3
- package/dist/{chunk-DRYSGNJH.js.map → chunk-RHEEYK4H.js.map} +1 -1
- package/dist/{chunk-KH2EURUA.cjs → chunk-TEPMJUHR.cjs} +11 -11
- package/dist/{chunk-KH2EURUA.cjs.map → chunk-TEPMJUHR.cjs.map} +1 -1
- package/dist/{chunk-RL7CDVOD.cjs → chunk-TNAIJP7Y.cjs} +14 -14
- package/dist/{chunk-RL7CDVOD.cjs.map → chunk-TNAIJP7Y.cjs.map} +1 -1
- package/dist/{chunk-P7VWCVYX.cjs → chunk-TP2QIZM2.cjs} +23 -23
- package/dist/{chunk-P7VWCVYX.cjs.map → chunk-TP2QIZM2.cjs.map} +1 -1
- package/dist/{chunk-U4J62523.js → chunk-TWH4646Y.js} +5 -5
- package/dist/{chunk-U4J62523.js.map → chunk-TWH4646Y.js.map} +1 -1
- package/dist/{chunk-WCXD574R.cjs → chunk-U4VL3LBC.cjs} +83 -83
- package/dist/{chunk-WCXD574R.cjs.map → chunk-U4VL3LBC.cjs.map} +1 -1
- package/dist/{chunk-PEFF5WEO.cjs → chunk-UGEQCMTF.cjs} +6 -6
- package/dist/{chunk-PEFF5WEO.cjs.map → chunk-UGEQCMTF.cjs.map} +1 -1
- package/dist/{chunk-ELH5FOOF.cjs → chunk-UOUYGOAQ.cjs} +24 -24
- package/dist/{chunk-ELH5FOOF.cjs.map → chunk-UOUYGOAQ.cjs.map} +1 -1
- package/dist/{chunk-MMRTVCGM.cjs → chunk-V5UM53T3.cjs} +10 -10
- package/dist/{chunk-MMRTVCGM.cjs.map → chunk-V5UM53T3.cjs.map} +1 -1
- package/dist/{chunk-7NA4OHCN.js → chunk-VW7DYXR4.js} +4 -4
- package/dist/{chunk-7NA4OHCN.js.map → chunk-VW7DYXR4.js.map} +1 -1
- package/dist/{chunk-OW5EFEFM.cjs → chunk-WFZINVND.cjs} +10 -10
- package/dist/{chunk-OW5EFEFM.cjs.map → chunk-WFZINVND.cjs.map} +1 -1
- package/dist/{chunk-QD7IBNGB.js → chunk-WJVTQDVD.js} +3 -3
- package/dist/{chunk-QD7IBNGB.js.map → chunk-WJVTQDVD.js.map} +1 -1
- package/dist/{chunk-SNL4DVGD.js → chunk-XD5DGMZ7.js} +3 -3
- package/dist/{chunk-SNL4DVGD.js.map → chunk-XD5DGMZ7.js.map} +1 -1
- package/dist/{chunk-MZQDB2YR.cjs → chunk-XJNEUXLW.cjs} +11 -11
- package/dist/{chunk-MZQDB2YR.cjs.map → chunk-XJNEUXLW.cjs.map} +1 -1
- package/dist/{chunk-374OVGJA.js → chunk-Y6KP7L4G.js} +4 -4
- package/dist/{chunk-374OVGJA.js.map → chunk-Y6KP7L4G.js.map} +1 -1
- package/dist/{chunk-EPXN7SS7.js → chunk-YPINITSJ.js} +4 -4
- package/dist/{chunk-EPXN7SS7.js.map → chunk-YPINITSJ.js.map} +1 -1
- package/dist/{chunk-JT4NM27B.js → chunk-YQSTTYAA.js} +3 -3
- package/dist/{chunk-JT4NM27B.js.map → chunk-YQSTTYAA.js.map} +1 -1
- package/dist/{chunk-HDPHYYPQ.cjs → chunk-Z5G5VHKI.cjs} +6 -6
- package/dist/{chunk-HDPHYYPQ.cjs.map → chunk-Z5G5VHKI.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/server/handlers/a2a.cjs +9 -9
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-versions.cjs +8 -8
- package/dist/server/handlers/agent-versions.js +1 -1
- package/dist/server/handlers/agents.cjs +33 -33
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/auth.cjs +10 -10
- package/dist/server/handlers/auth.js +1 -1
- package/dist/server/handlers/datasets.cjs +21 -21
- package/dist/server/handlers/datasets.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/mcp-client-versions.cjs +8 -8
- package/dist/server/handlers/mcp-client-versions.js +1 -1
- package/dist/server/handlers/mcp.cjs +9 -9
- package/dist/server/handlers/mcp.js +1 -1
- package/dist/server/handlers/memory.cjs +27 -27
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability.cjs +5 -5
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/processor-providers.cjs +3 -3
- package/dist/server/handlers/processor-providers.js +1 -1
- package/dist/server/handlers/processors.cjs +4 -4
- package/dist/server/handlers/processors.js +1 -1
- package/dist/server/handlers/prompt-block-versions.cjs +8 -8
- package/dist/server/handlers/prompt-block-versions.js +1 -1
- package/dist/server/handlers/scorer-versions.cjs +8 -8
- package/dist/server/handlers/scorer-versions.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +7 -7
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/stored-mcp-clients.cjs +6 -6
- package/dist/server/handlers/stored-mcp-clients.js +1 -1
- package/dist/server/handlers/stored-prompt-blocks.cjs +6 -6
- package/dist/server/handlers/stored-prompt-blocks.js +1 -1
- package/dist/server/handlers/stored-scorers.cjs +6 -6
- package/dist/server/handlers/stored-scorers.js +1 -1
- package/dist/server/handlers/stored-skills.cjs +7 -7
- package/dist/server/handlers/stored-skills.js +1 -1
- package/dist/server/handlers/stored-workspaces.cjs +6 -6
- package/dist/server/handlers/stored-workspaces.js +1 -1
- package/dist/server/handlers/system.cjs +2 -2
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tool-providers.cjs +5 -5
- package/dist/server/handlers/tool-providers.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/vector.cjs +16 -16
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -8
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +24 -24
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers/workspace.cjs +26 -26
- package/dist/server/handlers/workspace.js +1 -1
- package/dist/server/handlers.cjs +26 -26
- package/dist/server/handlers.js +13 -13
- package/dist/server/server-adapter/index.cjs +263 -263
- package/dist/server/server-adapter/index.js +33 -33
- package/package.json +8 -8
- package/dist/chunk-4QX6ZNKX.cjs.map +0 -1
- package/dist/chunk-BEMXYFXO.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { listStoredScorersResponseSchema, listStoredScorersQuerySchema, getStoredScorerResponseSchema, storedScorerIdPathParams, createStoredScorerResponseSchema, createStoredScorerBodySchema, updateStoredScorerResponseSchema, updateStoredScorerBodySchema, deleteStoredScorerResponseSchema } from './chunk-BTRFBBRF.js';
|
|
2
2
|
import { handleAutoVersioning } from './chunk-33QPJPK4.js';
|
|
3
|
-
import { toSlug } from './chunk-
|
|
3
|
+
import { toSlug } from './chunk-YQSTTYAA.js';
|
|
4
4
|
import { statusQuerySchema } from './chunk-USZD5AX2.js';
|
|
5
5
|
import { handleError } from './chunk-NA7LKQPZ.js';
|
|
6
|
-
import { createRoute } from './chunk-
|
|
6
|
+
import { createRoute } from './chunk-K3MAWEYM.js';
|
|
7
7
|
import { HTTPException } from './chunk-6QWQZI4Q.js';
|
|
8
8
|
|
|
9
9
|
// src/server/handlers/stored-scorers.ts
|
|
@@ -271,5 +271,5 @@ var DELETE_STORED_SCORER_ROUTE = createRoute({
|
|
|
271
271
|
});
|
|
272
272
|
|
|
273
273
|
export { CREATE_STORED_SCORER_ROUTE, DELETE_STORED_SCORER_ROUTE, GET_STORED_SCORER_ROUTE, LIST_STORED_SCORERS_ROUTE, UPDATE_STORED_SCORER_ROUTE };
|
|
274
|
-
//# sourceMappingURL=chunk-
|
|
275
|
-
//# sourceMappingURL=chunk-
|
|
274
|
+
//# sourceMappingURL=chunk-Q4ZCPUL5.js.map
|
|
275
|
+
//# sourceMappingURL=chunk-Q4ZCPUL5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/handlers/stored-scorers.ts"],"names":[],"mappings":";;;;;;;;;AAoBA,IAAM,6BAAA,GAAgC;AAAA,EACpC,MAAA;AAAA,EACA,aAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,cAAA;AAAA,EACA,YAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA;AASO,IAAM,4BAA4B,WAAA,CAAY;AAAA,EACnD,MAAA,EAAQ,KAAA;AAAA,EACR,IAAA,EAAM,iBAAA;AAAA,EACN,YAAA,EAAc,MAAA;AAAA,EACd,gBAAA,EAAkB,4BAAA;AAAA,EAClB,cAAA,EAAgB,+BAAA;AAAA,EAChB,OAAA,EAAS,gCAAA;AAAA,EACT,WAAA,EAAa,2EAAA;AAAA,EACb,IAAA,EAAM,CAAC,gBAAgB,CAAA;AAAA,EACvB,YAAA,EAAc,IAAA;AAAA,EACd,OAAA,EAAS,OAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,SAAS,OAAA,EAAS,MAAA,EAAQ,QAAA,EAAU,QAAA,EAAS,KAAM;AACjF,IAAA,IAAI;AACF,MAAA,MAAM,OAAA,GAAU,OAAO,UAAA,EAAW;AAElC,MAAA,IAAI,CAAC,OAAA,EAAS;AACZ,QAAA,MAAM,IAAI,aAAA,CAAc,GAAA,EAAK,EAAE,OAAA,EAAS,6BAA6B,CAAA;AAAA,MACvE;AAEA,MAAA,MAAM,WAAA,GAAc,MAAM,OAAA,CAAQ,QAAA,CAAS,mBAAmB,CAAA;AAC9D,MAAA,IAAI,CAAC,WAAA,EAAa;AAChB,QAAA,MAAM,IAAI,aAAA,CAAc,GAAA,EAAK,EAAE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":"chunk-VNTOJ7A6.js","sourcesContent":["import { HTTPException } from '../http-exception';\nimport {\n storedScorerIdPathParams,\n statusQuerySchema,\n listStoredScorersQuerySchema,\n createStoredScorerBodySchema,\n updateStoredScorerBodySchema,\n listStoredScorersResponseSchema,\n getStoredScorerResponseSchema,\n createStoredScorerResponseSchema,\n updateStoredScorerResponseSchema,\n deleteStoredScorerResponseSchema,\n} from '../schemas/stored-scorers';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { toSlug } from '../utils';\n\nimport { handleError } from './error';\nimport { handleAutoVersioning } from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\nconst SCORER_SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'type',\n 'model',\n 'instructions',\n 'scoreRange',\n 'presetConfig',\n 'defaultSampling',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/scorers - List all stored scorer definitions\n */\nexport const LIST_STORED_SCORERS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/scorers',\n responseType: 'json',\n queryParamSchema: listStoredScorersQuerySchema,\n responseSchema: listStoredScorersResponseSchema,\n summary: 'List stored scorer definitions',\n description: 'Returns a paginated list of all scorer definitions stored in the database',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({ mastra, page, perPage, orderBy, status, authorId, metadata }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n const result = await scorerStore.listResolved({\n page,\n perPage,\n orderBy,\n status,\n authorId,\n metadata,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing stored scorer definitions');\n }\n },\n});\n\n/**\n * GET /stored/scorers/:storedScorerId - Get a stored scorer definition by ID\n */\nexport const GET_STORED_SCORER_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/scorers/:storedScorerId',\n responseType: 'json',\n pathParamSchema: storedScorerIdPathParams,\n queryParamSchema: statusQuerySchema,\n responseSchema: getStoredScorerResponseSchema,\n summary: 'Get stored scorer definition by ID',\n description:\n 'Returns a specific scorer definition from storage by its unique identifier. Use ?status=draft to resolve with the latest (draft) version, or ?status=published (default) for the active published version.',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({ mastra, storedScorerId, status }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n const scorer = await scorerStore.getByIdResolved(storedScorerId, { status });\n\n if (!scorer) {\n throw new HTTPException(404, { message: `Stored scorer definition with id ${storedScorerId} not found` });\n }\n\n return scorer;\n } catch (error) {\n return handleError(error, 'Error getting stored scorer definition');\n }\n },\n});\n\n/**\n * POST /stored/scorers - Create a new stored scorer definition\n */\nexport const CREATE_STORED_SCORER_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/scorers',\n responseType: 'json',\n bodySchema: createStoredScorerBodySchema,\n responseSchema: createStoredScorerResponseSchema,\n summary: 'Create stored scorer definition',\n description: 'Creates a new scorer definition in storage with the provided configuration',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({\n mastra,\n id: providedId,\n authorId,\n metadata,\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n // Derive ID from name if not explicitly provided\n const id = providedId || toSlug(name);\n\n if (!id) {\n throw new HTTPException(400, {\n message: 'Could not derive scorer definition ID from name. Please provide an explicit id.',\n });\n }\n\n // Check if scorer definition with this ID already exists\n const existing = await scorerStore.getById(id);\n if (existing) {\n throw new HTTPException(409, { message: `Scorer definition with id ${id} already exists` });\n }\n\n await scorerStore.create({\n scorerDefinition: {\n id,\n authorId,\n metadata,\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n },\n });\n\n // Return the resolved scorer definition (thin record + version config)\n // Use draft status since newly created entities start as drafts\n const resolved = await scorerStore.getByIdResolved(id, { status: 'draft' });\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve created scorer definition' });\n }\n\n return resolved;\n } catch (error) {\n return handleError(error, 'Error creating stored scorer definition');\n }\n },\n});\n\n/**\n * PATCH /stored/scorers/:storedScorerId - Update a stored scorer definition\n */\nexport const UPDATE_STORED_SCORER_ROUTE = createRoute({\n method: 'PATCH',\n path: '/stored/scorers/:storedScorerId',\n responseType: 'json',\n pathParamSchema: storedScorerIdPathParams,\n bodySchema: updateStoredScorerBodySchema,\n responseSchema: updateStoredScorerResponseSchema,\n summary: 'Update stored scorer definition',\n description: 'Updates an existing scorer definition in storage with the provided fields',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({\n mastra,\n storedScorerId,\n // Metadata-level fields\n authorId,\n metadata,\n // Config fields (snapshot-level)\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n // Check if scorer definition exists\n const existing = await scorerStore.getById(storedScorerId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored scorer definition with id ${storedScorerId} not found` });\n }\n\n // Update the scorer definition with both metadata-level and config-level fields\n const updatedScorer = await scorerStore.update({\n id: storedScorerId,\n authorId,\n metadata,\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n });\n\n // Build the snapshot config for auto-versioning comparison\n const configFields = {\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n };\n\n // Filter out undefined values to get only the config fields that were provided\n const providedConfigFields = Object.fromEntries(Object.entries(configFields).filter(([_, v]) => v !== undefined));\n\n // Handle auto-versioning with retry logic for race conditions\n // This creates a new version if there are meaningful config changes.\n // It does NOT update activeVersionId — the version stays as a draft until explicitly published.\n await handleAutoVersioning(\n scorerStore as unknown as VersionedStoreInterface,\n storedScorerId,\n 'scorerDefinitionId',\n SCORER_SNAPSHOT_CONFIG_FIELDS,\n existing,\n updatedScorer,\n providedConfigFields,\n );\n\n // Clear the cached scorer instance so the next request gets the updated config\n const editor = mastra.getEditor();\n if (editor) {\n editor.scorer.clearCache(storedScorerId);\n }\n\n // Return the resolved scorer definition with the latest (draft) version so the UI sees its edits\n const resolved = await scorerStore.getByIdResolved(storedScorerId, { status: 'draft' });\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve updated scorer definition' });\n }\n\n return resolved;\n } catch (error) {\n return handleError(error, 'Error updating stored scorer definition');\n }\n },\n});\n\n/**\n * DELETE /stored/scorers/:storedScorerId - Delete a stored scorer definition\n */\nexport const DELETE_STORED_SCORER_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/scorers/:storedScorerId',\n responseType: 'json',\n pathParamSchema: storedScorerIdPathParams,\n responseSchema: deleteStoredScorerResponseSchema,\n summary: 'Delete stored scorer definition',\n description: 'Deletes a scorer definition from storage by its unique identifier',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({ mastra, storedScorerId }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n // Check if scorer definition exists\n const existing = await scorerStore.getById(storedScorerId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored scorer definition with id ${storedScorerId} not found` });\n }\n\n await scorerStore.delete(storedScorerId);\n\n // Clear the cached scorer instance\n mastra.getEditor()?.scorer.clearCache(storedScorerId);\n\n return { success: true, message: `Scorer definition ${storedScorerId} deleted successfully` };\n } catch (error) {\n return handleError(error, 'Error deleting stored scorer definition');\n }\n },\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/server/handlers/stored-scorers.ts"],"names":[],"mappings":";;;;;;;;;AAoBA,IAAM,6BAAA,GAAgC;AAAA,EACpC,MAAA;AAAA,EACA,aAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,cAAA;AAAA,EACA,YAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA;AASO,IAAM,4BAA4B,WAAA,CAAY;AAAA,EACnD,MAAA,EAAQ,KAAA;AAAA,EACR,IAAA,EAAM,iBAAA;AAAA,EACN,YAAA,EAAc,MAAA;AAAA,EACd,gBAAA,EAAkB,4BAAA;AAAA,EAClB,cAAA,EAAgB,+BAAA;AAAA,EAChB,OAAA,EAAS,gCAAA;AAAA,EACT,WAAA,EAAa,2EAAA;AAAA,EACb,IAAA,EAAM,CAAC,gBAAgB,CAAA;AAAA,EACvB,YAAA,EAAc,IAAA;AAAA,EACd,OAAA,EAAS,OAAO,EAAE,MAAA,EAAQ,IAAA,EAAM,SAAS,OAAA,EAAS,MAAA,EAAQ,QAAA,EAAU,QAAA,EAAS,KAAM;AACjF,IAAA,IAAI;AACF,MAAA,MAAM,OAAA,GAAU,OAAO,UAAA,EAAW;AAElC,MAAA,IAAI,CAAC,OAAA,EAAS;AACZ,QAAA,MAAM,IAAI,aAAA,CAAc,GAAA,EAAK,EAAE,OAAA,EAAS,6BAA6B,CAAA;AAAA,MACvE;AAEA,MAAA,MAAM,WAAA,GAAc,MAAM,OAAA,CAAQ,QAAA,CA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AC9F,SAAS,KAAA,EAAO;AACd,MAAA,OAAO,WAAA,CAAY,OAAO,yCAAyC,CAAA;AAAA,IACrE;AAAA,EACF;AACF,CAAC","file":"chunk-Q4ZCPUL5.js","sourcesContent":["import { HTTPException } from '../http-exception';\nimport {\n storedScorerIdPathParams,\n statusQuerySchema,\n listStoredScorersQuerySchema,\n createStoredScorerBodySchema,\n updateStoredScorerBodySchema,\n listStoredScorersResponseSchema,\n getStoredScorerResponseSchema,\n createStoredScorerResponseSchema,\n updateStoredScorerResponseSchema,\n deleteStoredScorerResponseSchema,\n} from '../schemas/stored-scorers';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { toSlug } from '../utils';\n\nimport { handleError } from './error';\nimport { handleAutoVersioning } from './version-helpers';\nimport type { VersionedStoreInterface } from './version-helpers';\n\nconst SCORER_SNAPSHOT_CONFIG_FIELDS = [\n 'name',\n 'description',\n 'type',\n 'model',\n 'instructions',\n 'scoreRange',\n 'presetConfig',\n 'defaultSampling',\n] as const;\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/scorers - List all stored scorer definitions\n */\nexport const LIST_STORED_SCORERS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/scorers',\n responseType: 'json',\n queryParamSchema: listStoredScorersQuerySchema,\n responseSchema: listStoredScorersResponseSchema,\n summary: 'List stored scorer definitions',\n description: 'Returns a paginated list of all scorer definitions stored in the database',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({ mastra, page, perPage, orderBy, status, authorId, metadata }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n const result = await scorerStore.listResolved({\n page,\n perPage,\n orderBy,\n status,\n authorId,\n metadata,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing stored scorer definitions');\n }\n },\n});\n\n/**\n * GET /stored/scorers/:storedScorerId - Get a stored scorer definition by ID\n */\nexport const GET_STORED_SCORER_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/scorers/:storedScorerId',\n responseType: 'json',\n pathParamSchema: storedScorerIdPathParams,\n queryParamSchema: statusQuerySchema,\n responseSchema: getStoredScorerResponseSchema,\n summary: 'Get stored scorer definition by ID',\n description:\n 'Returns a specific scorer definition from storage by its unique identifier. Use ?status=draft to resolve with the latest (draft) version, or ?status=published (default) for the active published version.',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({ mastra, storedScorerId, status }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n const scorer = await scorerStore.getByIdResolved(storedScorerId, { status });\n\n if (!scorer) {\n throw new HTTPException(404, { message: `Stored scorer definition with id ${storedScorerId} not found` });\n }\n\n return scorer;\n } catch (error) {\n return handleError(error, 'Error getting stored scorer definition');\n }\n },\n});\n\n/**\n * POST /stored/scorers - Create a new stored scorer definition\n */\nexport const CREATE_STORED_SCORER_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/scorers',\n responseType: 'json',\n bodySchema: createStoredScorerBodySchema,\n responseSchema: createStoredScorerResponseSchema,\n summary: 'Create stored scorer definition',\n description: 'Creates a new scorer definition in storage with the provided configuration',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({\n mastra,\n id: providedId,\n authorId,\n metadata,\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n // Derive ID from name if not explicitly provided\n const id = providedId || toSlug(name);\n\n if (!id) {\n throw new HTTPException(400, {\n message: 'Could not derive scorer definition ID from name. Please provide an explicit id.',\n });\n }\n\n // Check if scorer definition with this ID already exists\n const existing = await scorerStore.getById(id);\n if (existing) {\n throw new HTTPException(409, { message: `Scorer definition with id ${id} already exists` });\n }\n\n await scorerStore.create({\n scorerDefinition: {\n id,\n authorId,\n metadata,\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n },\n });\n\n // Return the resolved scorer definition (thin record + version config)\n // Use draft status since newly created entities start as drafts\n const resolved = await scorerStore.getByIdResolved(id, { status: 'draft' });\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve created scorer definition' });\n }\n\n return resolved;\n } catch (error) {\n return handleError(error, 'Error creating stored scorer definition');\n }\n },\n});\n\n/**\n * PATCH /stored/scorers/:storedScorerId - Update a stored scorer definition\n */\nexport const UPDATE_STORED_SCORER_ROUTE = createRoute({\n method: 'PATCH',\n path: '/stored/scorers/:storedScorerId',\n responseType: 'json',\n pathParamSchema: storedScorerIdPathParams,\n bodySchema: updateStoredScorerBodySchema,\n responseSchema: updateStoredScorerResponseSchema,\n summary: 'Update stored scorer definition',\n description: 'Updates an existing scorer definition in storage with the provided fields',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({\n mastra,\n storedScorerId,\n // Metadata-level fields\n authorId,\n metadata,\n // Config fields (snapshot-level)\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n // Check if scorer definition exists\n const existing = await scorerStore.getById(storedScorerId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored scorer definition with id ${storedScorerId} not found` });\n }\n\n // Update the scorer definition with both metadata-level and config-level fields\n const updatedScorer = await scorerStore.update({\n id: storedScorerId,\n authorId,\n metadata,\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n });\n\n // Build the snapshot config for auto-versioning comparison\n const configFields = {\n name,\n description,\n type,\n model,\n instructions,\n scoreRange,\n presetConfig,\n defaultSampling,\n };\n\n // Filter out undefined values to get only the config fields that were provided\n const providedConfigFields = Object.fromEntries(Object.entries(configFields).filter(([_, v]) => v !== undefined));\n\n // Handle auto-versioning with retry logic for race conditions\n // This creates a new version if there are meaningful config changes.\n // It does NOT update activeVersionId — the version stays as a draft until explicitly published.\n await handleAutoVersioning(\n scorerStore as unknown as VersionedStoreInterface,\n storedScorerId,\n 'scorerDefinitionId',\n SCORER_SNAPSHOT_CONFIG_FIELDS,\n existing,\n updatedScorer,\n providedConfigFields,\n );\n\n // Clear the cached scorer instance so the next request gets the updated config\n const editor = mastra.getEditor();\n if (editor) {\n editor.scorer.clearCache(storedScorerId);\n }\n\n // Return the resolved scorer definition with the latest (draft) version so the UI sees its edits\n const resolved = await scorerStore.getByIdResolved(storedScorerId, { status: 'draft' });\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve updated scorer definition' });\n }\n\n return resolved;\n } catch (error) {\n return handleError(error, 'Error updating stored scorer definition');\n }\n },\n});\n\n/**\n * DELETE /stored/scorers/:storedScorerId - Delete a stored scorer definition\n */\nexport const DELETE_STORED_SCORER_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/scorers/:storedScorerId',\n responseType: 'json',\n pathParamSchema: storedScorerIdPathParams,\n responseSchema: deleteStoredScorerResponseSchema,\n summary: 'Delete stored scorer definition',\n description: 'Deletes a scorer definition from storage by its unique identifier',\n tags: ['Stored Scorers'],\n requiresAuth: true,\n handler: async ({ mastra, storedScorerId }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const scorerStore = await storage.getStore('scorerDefinitions');\n if (!scorerStore) {\n throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });\n }\n\n // Check if scorer definition exists\n const existing = await scorerStore.getById(storedScorerId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored scorer definition with id ${storedScorerId} not found` });\n }\n\n await scorerStore.delete(storedScorerId);\n\n // Clear the cached scorer instance\n mastra.getEditor()?.scorer.clearCache(storedScorerId);\n\n return { success: true, message: `Scorer definition ${storedScorerId} deleted successfully` };\n } catch (error) {\n return handleError(error, 'Error deleting stored scorer definition');\n }\n },\n});\n"]}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkP2ZMGGHF_cjs = require('./chunk-P2ZMGGHF.cjs');
|
|
4
4
|
var chunkY2BKW5ND_cjs = require('./chunk-Y2BKW5ND.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkEZCRZUSZ_cjs = require('./chunk-EZCRZUSZ.cjs');
|
|
6
6
|
var fs = require('fs');
|
|
7
7
|
|
|
8
|
-
var GET_SYSTEM_PACKAGES_ROUTE =
|
|
8
|
+
var GET_SYSTEM_PACKAGES_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
9
9
|
method: "GET",
|
|
10
10
|
path: "/system/packages",
|
|
11
11
|
responseType: "json",
|
|
@@ -34,5 +34,5 @@ var GET_SYSTEM_PACKAGES_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
exports.GET_SYSTEM_PACKAGES_ROUTE = GET_SYSTEM_PACKAGES_ROUTE;
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-QMSOF7KE.cjs.map
|
|
38
|
+
//# sourceMappingURL=chunk-QMSOF7KE.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/handlers/system.ts"],"names":["createRoute","systemPackagesResponseSchema","readFileSync","handleError"],"mappings":";;;;;;;AAOO,IAAM,4BAA4BA,6BAAA,CAAY;AAAA,EACnD,MAAA,EAAQ,KAAA;AAAA,EACR,IAAA,EAAM,kBAAA;AAAA,EACN,YAAA,EAAc,MAAA;AAAA,EACd,cAAA,EAAgBC,8CAAA;AAAA,EAChB,OAAA,EAAS,+BAAA;AAAA,EACT,WAAA,EAAa,qFAAA;AAAA,EACb,IAAA,EAAM,CAAC,QAAQ,CAAA;AAAA,EACf,YAAA,EAAc,IAAA;AAAA,EACd,OAAA,EAAS,OAAO,EAAE,MAAA,EAAO,KAAM;AAC7B,IAAA,IAAI;AACF,MAAA,MAAM,gBAAA,GAAmB,QAAQ,GAAA,CAAI,oBAAA;AAErC,MAAA,IAAI,WAA4B,EAAC;AAEjC,MAAA,IAAI,gBAAA,EAAkB;AACpB,QAAA,IAAI;AACF,UAAA,MAAM,WAAA,GAAcC,eAAA,CAAa,gBAAA,EAAkB,OAAO,CAAA;AAC1D,UAAA,QAAA,GAAW,IAAA,CAAK,MAAM,WAAW,CAAA;AAAA,QACnC,CAAA,CAAA,MAAQ;AACN,UAAA,QAAA,GAAW,EAAC;AAAA,QACd;AAAA,MACF;AAEA,MAAA,OAAO,EAAE,QAAA,EAAU,KAAA,EAAO,OAAA,CAAQ,GAAA,CAAI,UAAA,KAAe,MAAA,EAAQ,UAAA,EAAY,CAAC,CAAC,MAAA,CAAO,SAAA,EAAU,EAAE;AAAA,IAChG,SAAS,KAAA,EAAO;AACd,MAAA,OAAOC,6BAAA,CAAY,OAAO,+BAA+B,CAAA;AAAA,IAC3D;AAAA,EACF;AACF,CAAC","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/server/handlers/system.ts"],"names":["createRoute","systemPackagesResponseSchema","readFileSync","handleError"],"mappings":";;;;;;;AAOO,IAAM,4BAA4BA,6BAAA,CAAY;AAAA,EACnD,MAAA,EAAQ,KAAA;AAAA,EACR,IAAA,EAAM,kBAAA;AAAA,EACN,YAAA,EAAc,MAAA;AAAA,EACd,cAAA,EAAgBC,8CAAA;AAAA,EAChB,OAAA,EAAS,+BAAA;AAAA,EACT,WAAA,EAAa,qFAAA;AAAA,EACb,IAAA,EAAM,CAAC,QAAQ,CAAA;AAAA,EACf,YAAA,EAAc,IAAA;AAAA,EACd,OAAA,EAAS,OAAO,EAAE,MAAA,EAAO,KAAM;AAC7B,IAAA,IAAI;AACF,MAAA,MAAM,gBAAA,GAAmB,QAAQ,GAAA,CAAI,oBAAA;AAErC,MAAA,IAAI,WAA4B,EAAC;AAEjC,MAAA,IAAI,gBAAA,EAAkB;AACpB,QAAA,IAAI;AACF,UAAA,MAAM,WAAA,GAAcC,eAAA,CAAa,gBAAA,EAAkB,OAAO,CAAA;AAC1D,UAAA,QAAA,GAAW,IAAA,CAAK,MAAM,WAAW,CAAA;AAAA,QACnC,CAAA,CAAA,MAAQ;AACN,UAAA,QAAA,GAAW,EAAC;AAAA,QACd;AAAA,MACF;AAEA,MAAA,OAAO,EAAE,QAAA,EAAU,KAAA,EAAO,OAAA,CAAQ,GAAA,CAAI,UAAA,KAAe,MAAA,EAAQ,UAAA,EAAY,CAAC,CAAC,MAAA,CAAO,SAAA,EAAU,EAAE;AAAA,IAChG,SAAS,KAAA,EAAO;AACd,MAAA,OAAOC,6BAAA,CAAY,OAAO,+BAA+B,CAAA;AAAA,IAC3D;AAAA,EACF;AACF,CAAC","file":"chunk-QMSOF7KE.cjs","sourcesContent":["import { readFileSync } from 'node:fs';\n\nimport type { MastraPackage } from '../schemas/system';\nimport { systemPackagesResponseSchema } from '../schemas/system';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { handleError } from './error';\n\nexport const GET_SYSTEM_PACKAGES_ROUTE = createRoute({\n method: 'GET',\n path: '/system/packages',\n responseType: 'json',\n responseSchema: systemPackagesResponseSchema,\n summary: 'Get installed Mastra packages',\n description: 'Returns a list of all installed Mastra packages and their versions from the project',\n tags: ['System'],\n requiresAuth: true,\n handler: async ({ mastra }) => {\n try {\n const packagesFilePath = process.env.MASTRA_PACKAGES_FILE;\n\n let packages: MastraPackage[] = [];\n\n if (packagesFilePath) {\n try {\n const fileContent = readFileSync(packagesFilePath, 'utf-8');\n packages = JSON.parse(fileContent);\n } catch {\n packages = [];\n }\n }\n\n return { packages, isDev: process.env.MASTRA_DEV === 'true', cmsEnabled: !!mastra.getEditor() };\n } catch (error) {\n return handleError(error, 'Error getting system packages');\n }\n },\n});\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkK5LN7LC7_cjs = require('./chunk-K5LN7LC7.cjs');
|
|
4
4
|
var chunkU3PO2SCK_cjs = require('./chunk-U3PO2SCK.cjs');
|
|
5
5
|
var chunkY2BKW5ND_cjs = require('./chunk-Y2BKW5ND.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkEZCRZUSZ_cjs = require('./chunk-EZCRZUSZ.cjs');
|
|
7
7
|
var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs');
|
|
8
8
|
|
|
9
9
|
// src/server/handlers/stored-workspaces.ts
|
|
10
|
-
var LIST_STORED_WORKSPACES_ROUTE =
|
|
10
|
+
var LIST_STORED_WORKSPACES_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
11
11
|
method: "GET",
|
|
12
12
|
path: "/stored/workspaces",
|
|
13
13
|
responseType: "json",
|
|
@@ -40,7 +40,7 @@ var LIST_STORED_WORKSPACES_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
var GET_STORED_WORKSPACE_ROUTE =
|
|
43
|
+
var GET_STORED_WORKSPACE_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
44
44
|
method: "GET",
|
|
45
45
|
path: "/stored/workspaces/:storedWorkspaceId",
|
|
46
46
|
responseType: "json",
|
|
@@ -70,7 +70,7 @@ var GET_STORED_WORKSPACE_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
var CREATE_STORED_WORKSPACE_ROUTE =
|
|
73
|
+
var CREATE_STORED_WORKSPACE_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
74
74
|
method: "POST",
|
|
75
75
|
path: "/stored/workspaces",
|
|
76
76
|
responseType: "json",
|
|
@@ -105,7 +105,7 @@ var CREATE_STORED_WORKSPACE_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
105
105
|
if (!workspaceStore) {
|
|
106
106
|
throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Workspaces storage domain is not available" });
|
|
107
107
|
}
|
|
108
|
-
const id = providedId ||
|
|
108
|
+
const id = providedId || chunkK5LN7LC7_cjs.toSlug(name);
|
|
109
109
|
if (!id) {
|
|
110
110
|
throw new chunk64ITUOXI_cjs.HTTPException(400, {
|
|
111
111
|
message: "Could not derive workspace ID from name. Please provide an explicit id."
|
|
@@ -142,7 +142,7 @@ var CREATE_STORED_WORKSPACE_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
|
-
var UPDATE_STORED_WORKSPACE_ROUTE =
|
|
145
|
+
var UPDATE_STORED_WORKSPACE_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
146
146
|
method: "PATCH",
|
|
147
147
|
path: "/stored/workspaces/:storedWorkspaceId",
|
|
148
148
|
responseType: "json",
|
|
@@ -209,7 +209,7 @@ var UPDATE_STORED_WORKSPACE_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
|
-
var DELETE_STORED_WORKSPACE_ROUTE =
|
|
212
|
+
var DELETE_STORED_WORKSPACE_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
213
213
|
method: "DELETE",
|
|
214
214
|
path: "/stored/workspaces/:storedWorkspaceId",
|
|
215
215
|
responseType: "json",
|
|
@@ -249,5 +249,5 @@ exports.DELETE_STORED_WORKSPACE_ROUTE = DELETE_STORED_WORKSPACE_ROUTE;
|
|
|
249
249
|
exports.GET_STORED_WORKSPACE_ROUTE = GET_STORED_WORKSPACE_ROUTE;
|
|
250
250
|
exports.LIST_STORED_WORKSPACES_ROUTE = LIST_STORED_WORKSPACES_ROUTE;
|
|
251
251
|
exports.UPDATE_STORED_WORKSPACE_ROUTE = UPDATE_STORED_WORKSPACE_ROUTE;
|
|
252
|
-
//# sourceMappingURL=chunk-
|
|
253
|
-
//# sourceMappingURL=chunk-
|
|
252
|
+
//# sourceMappingURL=chunk-R55KCZUE.cjs.map
|
|
253
|
+
//# sourceMappingURL=chunk-R55KCZUE.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/handlers/stored-workspaces.ts"],"names":["createRoute","listStoredWorkspacesQuerySchema","listStoredWorkspacesResponseSchema","HTTPException","handleError","storedWorkspaceIdPathParams","getStoredWorkspaceResponseSchema","createStoredWorkspaceBodySchema","createStoredWorkspaceResponseSchema","toSlug","updateStoredWorkspaceBodySchema","updateStoredWorkspaceResponseSchema","deleteStoredWorkspaceResponseSchema"],"mappings":";;;;;;;;;AAwBO,IAAM,+BAA+BA,6BAAA,CAAY;AAAA,EACtD,MAAA,EAAQ,KAAA;AAAA,EACR,IAAA,EAAM,oBAAA;AAAA,EACN,YAAA,EAAc,MAAA;AAAA,EACd,gBAAA,EAAkBC,iDAAA;AAAA,EAClB,cAAA,EAAgBC,oDAAA;AAAA,EAChB,OAAA,EAAS,wBAAA;AAAA,EACT,WAAA,EAAa,iFAAA;AAAA,EACb,IAAA,EAAM,CAAC,mBAAmB,CAAA;AAAA,EAC1B,YAAA,EAAc,IAAA;AAAA,EACd,OAAA,EAAS,OAAO,EAAE,MAAA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,EAAM,CAAC,mBAAmB,CAAA;AAAA,EAC1B,YAAA,EAAc,IAAA;AAAA,EACd,OAAA,EAAS,OAAO,EAAE,MAAA,EAAQ,mBAAkB,KAAM;AAChD,IAAA,IAAI;AACF,MAAA,MAAM,OAAA,GAAU,OAAO,UAAA,EAAW;AAElC,MAAA,IAAI,CAAC,OAAA,EAAS;AACZ,QAAA,MAAM,IAAIT,+BAAA,CAAc,GAAA,EAAK,EAAE,OAAA,EAAS,6BAA6B,CAAA;AAAA,MACvE;AAEA,MAAA,MAAM,cAAA,GAAiB,MAAM,OAAA,CAAQ,QAAA,CAAS,YAAY,CAAA;AAC1D,MAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,QAAA,MAAM,IAAIA,+BAAA,CAAc,GAAA,EAAK,EAAE,OAAA,EAAS,8CAA8C,CAAA;AAAA,MACxF;AAGA,MAAA,MAAM,QAAA,GAAW,MAAM,cAAA,CAAe,OAAA,CAAQ,iBAAiB,CAAA;AAC/D,MAAA,IAAI,CAAC,QAAA,EAAU;AACb,QAAA,MAAM,IAAIA,gCAAc,GAAA,EAAK,EAAE,SAAS,CAAA,yBAAA,EAA4B,iBAAiB,cAAc,CAAA;AAAA,MACrG;AAEA,MAAA,MAAM,cAAA,CAAe,OAAO,iBAAiB,CAAA;AAE7C,MAAA,OAAO;AAAA,QACL,OAAA,EAAS,IAAA;AAAA,QACT,OAAA,EAAS,aAAa,iBAAiB,CAAA,qBAAA;AAAA,OACzC;AAAA,IACF,SAAS,KAAA,EAAO;AACd,MAAA,OAAOC,6BAAA,CAAY,OAAO,iCAAiC,CAAA;AAAA,IAC7D;AAAA,EACF;AACF,CAAC","file":"chunk-7UYCRF6V.cjs","sourcesContent":["import { HTTPException } from '../http-exception';\nimport {\n storedWorkspaceIdPathParams,\n listStoredWorkspacesQuerySchema,\n createStoredWorkspaceBodySchema,\n updateStoredWorkspaceBodySchema,\n listStoredWorkspacesResponseSchema,\n getStoredWorkspaceResponseSchema,\n createStoredWorkspaceResponseSchema,\n updateStoredWorkspaceResponseSchema,\n deleteStoredWorkspaceResponseSchema,\n} from '../schemas/stored-workspaces';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { toSlug } from '../utils';\n\nimport { handleError } from './error';\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/workspaces - List all stored workspaces\n */\nexport const LIST_STORED_WORKSPACES_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/workspaces',\n responseType: 'json',\n queryParamSchema: listStoredWorkspacesQuerySchema,\n responseSchema: listStoredWorkspacesResponseSchema,\n summary: 'List stored workspaces',\n description: 'Returns a paginated list of all workspace configurations stored in the database',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({ mastra, page, perPage, orderBy, authorId, metadata }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n const result = await workspaceStore.listResolved({\n page,\n perPage,\n orderBy,\n authorId,\n metadata,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing stored workspaces');\n }\n },\n});\n\n/**\n * GET /stored/workspaces/:storedWorkspaceId - Get a stored workspace by ID\n */\nexport const GET_STORED_WORKSPACE_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/workspaces/:storedWorkspaceId',\n responseType: 'json',\n pathParamSchema: storedWorkspaceIdPathParams,\n responseSchema: getStoredWorkspaceResponseSchema,\n summary: 'Get stored workspace by ID',\n description:\n 'Returns a specific workspace from storage by its unique identifier (resolved with active version config)',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({ mastra, storedWorkspaceId }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n const workspace = await workspaceStore.getByIdResolved(storedWorkspaceId);\n\n if (!workspace) {\n throw new HTTPException(404, { message: `Stored workspace with id ${storedWorkspaceId} not found` });\n }\n\n return workspace;\n } catch (error) {\n return handleError(error, 'Error getting stored workspace');\n }\n },\n});\n\n/**\n * POST /stored/workspaces - Create a new stored workspace\n */\nexport const CREATE_STORED_WORKSPACE_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/workspaces',\n responseType: 'json',\n bodySchema: createStoredWorkspaceBodySchema,\n responseSchema: createStoredWorkspaceResponseSchema,\n summary: 'Create stored workspace',\n description: 'Creates a new workspace configuration in storage with the provided settings',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({\n mastra,\n id: providedId,\n authorId,\n metadata,\n name,\n description,\n filesystem,\n sandbox,\n mounts,\n search,\n skills,\n tools,\n autoSync,\n operationTimeout,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n // Derive ID from name if not explicitly provided\n const id = providedId || toSlug(name);\n\n if (!id) {\n throw new HTTPException(400, {\n message: 'Could not derive workspace ID from name. Please provide an explicit id.',\n });\n }\n\n // Check if workspace with this ID already exists\n const existing = await workspaceStore.getById(id);\n if (existing) {\n throw new HTTPException(409, { message: `Workspace with id ${id} already exists` });\n }\n\n await workspaceStore.create({\n workspace: {\n id,\n authorId,\n metadata,\n name,\n description,\n filesystem,\n sandbox,\n mounts,\n search,\n skills,\n tools,\n autoSync,\n operationTimeout,\n },\n });\n\n // Return the resolved workspace (thin record + version config)\n const resolved = await workspaceStore.getByIdResolved(id);\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve created workspace' });\n }\n\n return resolved;\n } catch (error) {\n return handleError(error, 'Error creating stored workspace');\n }\n },\n});\n\n/**\n * PATCH /stored/workspaces/:storedWorkspaceId - Update a stored workspace\n */\nexport const UPDATE_STORED_WORKSPACE_ROUTE = createRoute({\n method: 'PATCH',\n path: '/stored/workspaces/:storedWorkspaceId',\n responseType: 'json',\n pathParamSchema: storedWorkspaceIdPathParams,\n bodySchema: updateStoredWorkspaceBodySchema,\n responseSchema: updateStoredWorkspaceResponseSchema,\n summary: 'Update stored workspace',\n description: 'Updates an existing workspace in storage with the provided fields',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({\n mastra,\n storedWorkspaceId,\n // Metadata-level fields\n authorId,\n metadata,\n // Config fields (snapshot-level)\n name,\n description,\n filesystem,\n sandbox,\n mounts,\n search,\n skills,\n tools,\n autoSync,\n operationTimeout,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n // Check if workspace exists\n const existing = await workspaceStore.getById(storedWorkspaceId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored workspace with id ${storedWorkspaceId} not found` });\n }\n\n // Update the workspace with both metadata-level and config-level fields\n // The storage layer handles separating these into record updates vs new-version creation\n await workspaceStore.update({\n id: storedWorkspaceId,\n authorId,\n metadata,\n name,\n description,\n filesystem,\n sandbox,\n mounts,\n search,\n skills,\n tools,\n autoSync,\n operationTimeout,\n });\n\n // Return the resolved workspace with the updated config\n const resolved = await workspaceStore.getByIdResolved(storedWorkspaceId);\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve updated workspace' });\n }\n\n return resolved;\n } catch (error) {\n return handleError(error, 'Error updating stored workspace');\n }\n },\n});\n\n/**\n * DELETE /stored/workspaces/:storedWorkspaceId - Delete a stored workspace\n */\nexport const DELETE_STORED_WORKSPACE_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/workspaces/:storedWorkspaceId',\n responseType: 'json',\n pathParamSchema: storedWorkspaceIdPathParams,\n responseSchema: deleteStoredWorkspaceResponseSchema,\n summary: 'Delete stored workspace',\n description: 'Deletes a workspace from storage by its unique identifier',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({ mastra, storedWorkspaceId }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n // Check if workspace exists\n const existing = await workspaceStore.getById(storedWorkspaceId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored workspace with id ${storedWorkspaceId} not found` });\n }\n\n await workspaceStore.delete(storedWorkspaceId);\n\n return {\n success: true,\n message: `Workspace ${storedWorkspaceId} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting stored workspace');\n }\n },\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/server/handlers/stored-workspaces.ts"],"names":["createRoute","listStoredWorkspacesQuerySchema","listStoredWorkspacesResponseSchema","HTTPException","handleError","storedWorkspaceIdPathParams","getStoredWorkspaceResponseSchema","createStoredWorkspaceBodySchema","createStoredWorkspaceResponseSchema","toSlug","updateStoredWorkspaceBodySchema","updateStoredWorkspaceResponseSchema","deleteStoredWorkspaceResponseSchema"],"mappings":";;;;;;;;;AAwBO,IAAM,+BAA+BA,6BAAA,CAAY;AAAA,EACtD,MAAA,EAAQ,KAAA;AAAA,EACR,IAAA,EAAM,oBAAA;AAAA,EACN,YAAA,EAAc,MAAA;AAAA,EACd,gBAAA,EAAkBC,iDAAA;AAAA,EAClB,cAAA,EAAgBC,oDAAA;AAAA,EAChB,OAAA,EAAS,wBAAA;AAAA,EACT,WAAA,EAAa,iFAAA;AAAA,EACb,IAAA,EAAM,CAAC,mBAAmB,CAAA;AAAA,EAC1B,YAAA,EAAc,IAAA;AAAA,EACd,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EAAa,2DAAA;AAAA,EACb,IAAA,EAAM,CAAC,mBAAmB,CAAA;AAAA,EAC1B,YAAA,EAAc,IAAA;AAAA,EACd,OAAA,EAAS,OAAO,EAAE,MAAA,EAAQ,mBAAkB,KAAM;AAChD,IAAA,IAAI;AACF,MAAA,MAAM,OAAA,GAAU,OAAO,UAAA,EAAW;AAElC,MAAA,IAAI,CAAC,OAAA,EAAS;AACZ,QAAA,MAAM,IAAIT,+BAAA,CAAc,GAAA,EAAK,EAAE,OAAA,EAAS,6BAA6B,CAAA;AAAA,MACvE;AAEA,MAAA,MAAM,cAAA,GAAiB,MAAM,OAAA,CAAQ,QAAA,CAAS,YAAY,CAAA;AAC1D,MAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,QAAA,MAAM,IAAIA,+BAAA,CAAc,GAAA,EAAK,EAAE,OAAA,EAAS,8CAA8C,CAAA;AAAA,MACxF;AAGA,MAAA,MAAM,QAAA,GAAW,MAAM,cAAA,CAAe,OAAA,CAAQ,iBAAiB,CAAA;AAC/D,MAAA,IAAI,CAAC,QAAA,EAAU;AACb,QAAA,MAAM,IAAIA,gCAAc,GAAA,EAAK,EAAE,SAAS,CAAA,yBAAA,EAA4B,iBAAiB,cAAc,CAAA;AAAA,MACrG;AAEA,MAAA,MAAM,cAAA,CAAe,OAAO,iBAAiB,CAAA;AAE7C,MAAA,OAAO;AAAA,QACL,OAAA,EAAS,IAAA;AAAA,QACT,OAAA,EAAS,aAAa,iBAAiB,CAAA,qBAAA;AAAA,OACzC;AAAA,IACF,SAAS,KAAA,EAAO;AACd,MAAA,OAAOC,6BAAA,CAAY,OAAO,iCAAiC,CAAA;AAAA,IAC7D;AAAA,EACF;AACF,CAAC","file":"chunk-R55KCZUE.cjs","sourcesContent":["import { HTTPException } from '../http-exception';\nimport {\n storedWorkspaceIdPathParams,\n listStoredWorkspacesQuerySchema,\n createStoredWorkspaceBodySchema,\n updateStoredWorkspaceBodySchema,\n listStoredWorkspacesResponseSchema,\n getStoredWorkspaceResponseSchema,\n createStoredWorkspaceResponseSchema,\n updateStoredWorkspaceResponseSchema,\n deleteStoredWorkspaceResponseSchema,\n} from '../schemas/stored-workspaces';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { toSlug } from '../utils';\n\nimport { handleError } from './error';\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /stored/workspaces - List all stored workspaces\n */\nexport const LIST_STORED_WORKSPACES_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/workspaces',\n responseType: 'json',\n queryParamSchema: listStoredWorkspacesQuerySchema,\n responseSchema: listStoredWorkspacesResponseSchema,\n summary: 'List stored workspaces',\n description: 'Returns a paginated list of all workspace configurations stored in the database',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({ mastra, page, perPage, orderBy, authorId, metadata }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n const result = await workspaceStore.listResolved({\n page,\n perPage,\n orderBy,\n authorId,\n metadata,\n });\n\n return result;\n } catch (error) {\n return handleError(error, 'Error listing stored workspaces');\n }\n },\n});\n\n/**\n * GET /stored/workspaces/:storedWorkspaceId - Get a stored workspace by ID\n */\nexport const GET_STORED_WORKSPACE_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/workspaces/:storedWorkspaceId',\n responseType: 'json',\n pathParamSchema: storedWorkspaceIdPathParams,\n responseSchema: getStoredWorkspaceResponseSchema,\n summary: 'Get stored workspace by ID',\n description:\n 'Returns a specific workspace from storage by its unique identifier (resolved with active version config)',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({ mastra, storedWorkspaceId }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n const workspace = await workspaceStore.getByIdResolved(storedWorkspaceId);\n\n if (!workspace) {\n throw new HTTPException(404, { message: `Stored workspace with id ${storedWorkspaceId} not found` });\n }\n\n return workspace;\n } catch (error) {\n return handleError(error, 'Error getting stored workspace');\n }\n },\n});\n\n/**\n * POST /stored/workspaces - Create a new stored workspace\n */\nexport const CREATE_STORED_WORKSPACE_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/workspaces',\n responseType: 'json',\n bodySchema: createStoredWorkspaceBodySchema,\n responseSchema: createStoredWorkspaceResponseSchema,\n summary: 'Create stored workspace',\n description: 'Creates a new workspace configuration in storage with the provided settings',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({\n mastra,\n id: providedId,\n authorId,\n metadata,\n name,\n description,\n filesystem,\n sandbox,\n mounts,\n search,\n skills,\n tools,\n autoSync,\n operationTimeout,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n // Derive ID from name if not explicitly provided\n const id = providedId || toSlug(name);\n\n if (!id) {\n throw new HTTPException(400, {\n message: 'Could not derive workspace ID from name. Please provide an explicit id.',\n });\n }\n\n // Check if workspace with this ID already exists\n const existing = await workspaceStore.getById(id);\n if (existing) {\n throw new HTTPException(409, { message: `Workspace with id ${id} already exists` });\n }\n\n await workspaceStore.create({\n workspace: {\n id,\n authorId,\n metadata,\n name,\n description,\n filesystem,\n sandbox,\n mounts,\n search,\n skills,\n tools,\n autoSync,\n operationTimeout,\n },\n });\n\n // Return the resolved workspace (thin record + version config)\n const resolved = await workspaceStore.getByIdResolved(id);\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve created workspace' });\n }\n\n return resolved;\n } catch (error) {\n return handleError(error, 'Error creating stored workspace');\n }\n },\n});\n\n/**\n * PATCH /stored/workspaces/:storedWorkspaceId - Update a stored workspace\n */\nexport const UPDATE_STORED_WORKSPACE_ROUTE = createRoute({\n method: 'PATCH',\n path: '/stored/workspaces/:storedWorkspaceId',\n responseType: 'json',\n pathParamSchema: storedWorkspaceIdPathParams,\n bodySchema: updateStoredWorkspaceBodySchema,\n responseSchema: updateStoredWorkspaceResponseSchema,\n summary: 'Update stored workspace',\n description: 'Updates an existing workspace in storage with the provided fields',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({\n mastra,\n storedWorkspaceId,\n // Metadata-level fields\n authorId,\n metadata,\n // Config fields (snapshot-level)\n name,\n description,\n filesystem,\n sandbox,\n mounts,\n search,\n skills,\n tools,\n autoSync,\n operationTimeout,\n }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n // Check if workspace exists\n const existing = await workspaceStore.getById(storedWorkspaceId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored workspace with id ${storedWorkspaceId} not found` });\n }\n\n // Update the workspace with both metadata-level and config-level fields\n // The storage layer handles separating these into record updates vs new-version creation\n await workspaceStore.update({\n id: storedWorkspaceId,\n authorId,\n metadata,\n name,\n description,\n filesystem,\n sandbox,\n mounts,\n search,\n skills,\n tools,\n autoSync,\n operationTimeout,\n });\n\n // Return the resolved workspace with the updated config\n const resolved = await workspaceStore.getByIdResolved(storedWorkspaceId);\n if (!resolved) {\n throw new HTTPException(500, { message: 'Failed to resolve updated workspace' });\n }\n\n return resolved;\n } catch (error) {\n return handleError(error, 'Error updating stored workspace');\n }\n },\n});\n\n/**\n * DELETE /stored/workspaces/:storedWorkspaceId - Delete a stored workspace\n */\nexport const DELETE_STORED_WORKSPACE_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/workspaces/:storedWorkspaceId',\n responseType: 'json',\n pathParamSchema: storedWorkspaceIdPathParams,\n responseSchema: deleteStoredWorkspaceResponseSchema,\n summary: 'Delete stored workspace',\n description: 'Deletes a workspace from storage by its unique identifier',\n tags: ['Stored Workspaces'],\n requiresAuth: true,\n handler: async ({ mastra, storedWorkspaceId }) => {\n try {\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not configured' });\n }\n\n const workspaceStore = await storage.getStore('workspaces');\n if (!workspaceStore) {\n throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n }\n\n // Check if workspace exists\n const existing = await workspaceStore.getById(storedWorkspaceId);\n if (!existing) {\n throw new HTTPException(404, { message: `Stored workspace with id ${storedWorkspaceId} not found` });\n }\n\n await workspaceStore.delete(storedWorkspaceId);\n\n return {\n success: true,\n message: `Workspace ${storedWorkspaceId} deleted successfully`,\n };\n } catch (error) {\n return handleError(error, 'Error deleting stored workspace');\n }\n },\n});\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getProcessorProvidersResponseSchema, getProcessorProviderResponseSchema, processorProviderIdPathParams } from './chunk-AUPN3AM6.js';
|
|
2
2
|
import { handleError } from './chunk-NA7LKQPZ.js';
|
|
3
|
-
import { createRoute } from './chunk-
|
|
3
|
+
import { createRoute } from './chunk-K3MAWEYM.js';
|
|
4
4
|
import { HTTPException } from './chunk-6QWQZI4Q.js';
|
|
5
5
|
import { zodToJsonSchema } from '@mastra/core/utils/zod-to-json';
|
|
6
6
|
|
|
@@ -63,5 +63,5 @@ var GET_PROCESSOR_PROVIDER_ROUTE = createRoute({
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
export { GET_PROCESSOR_PROVIDER_ROUTE, LIST_PROCESSOR_PROVIDERS_ROUTE };
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-R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AA,GAAW,MAAA,CAAO,oBAAA,CAAqB,UAAU,CAAA;AAEvD,MAAA,IAAI,CAAC,QAAA,EAAU;AACb,QAAA,MAAM,IAAI,cAAc,GAAA,EAAK,EAAE,SAAS,CAAA,2BAAA,EAA8B,UAAU,cAAc,CAAA;AAAA,MAChG;AAEA,MAAA,OAAO;AAAA,QACL,GAAG,QAAA,CAAS,IAAA;AAAA,QACZ,iBAAiB,QAAA,CAAS,eAAA;AAAA,QAC1B,YAAA,EAAc,eAAA,CAAgB,QAAA,CAAS,YAAY;AAAA,OACrD;AAAA,IACF,SAAS,KAAA,EAAO;AACd,MAAA,OAAO,WAAA,CAAY,OAAO,kCAAkC,CAAA;AAAA,IAC9D;AAAA,EACF;AACF,CAAC","file":"chunk-RHEEYK4H.js","sourcesContent":["import { zodToJsonSchema } from '@mastra/core/utils/zod-to-json';\n\nimport { HTTPException } from '../http-exception';\nimport {\n processorProviderIdPathParams,\n getProcessorProvidersResponseSchema,\n getProcessorProviderResponseSchema,\n} from '../schemas/processor-providers';\nimport { createRoute } from '../server-adapter/routes/route-builder';\n\nimport { handleError } from './error';\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\n/**\n * GET /processor-providers - List all registered processor providers\n */\nexport const LIST_PROCESSOR_PROVIDERS_ROUTE = createRoute({\n method: 'GET',\n path: '/processor-providers',\n responseType: 'json',\n responseSchema: getProcessorProvidersResponseSchema,\n summary: 'List processor providers',\n description: 'Returns a list of all registered processor providers with their info and available phases',\n tags: ['Processor Providers'],\n requiresAuth: true,\n handler: async ({ mastra }) => {\n try {\n const editor = mastra.getEditor();\n\n if (!editor) {\n throw new HTTPException(500, { message: 'Editor is not configured' });\n }\n\n const providers = editor.getProcessorProviders();\n\n return {\n providers: Object.values(providers).map(provider => ({\n ...provider.info,\n availablePhases: provider.availablePhases,\n })),\n };\n } catch (error) {\n return handleError(error, 'Error listing processor providers');\n }\n },\n});\n\n/**\n * GET /processor-providers/:providerId - Get a specific processor provider with config schema\n */\nexport const GET_PROCESSOR_PROVIDER_ROUTE = createRoute({\n method: 'GET',\n path: '/processor-providers/:providerId',\n responseType: 'json',\n pathParamSchema: processorProviderIdPathParams,\n responseSchema: getProcessorProviderResponseSchema,\n summary: 'Get processor provider details',\n description: 'Returns details about a specific processor provider, including its configuration schema',\n tags: ['Processor Providers'],\n requiresAuth: true,\n handler: async ({ mastra, providerId }) => {\n try {\n const editor = mastra.getEditor();\n\n if (!editor) {\n throw new HTTPException(500, { message: 'Editor is not configured' });\n }\n\n const provider = editor.getProcessorProvider(providerId);\n\n if (!provider) {\n throw new HTTPException(404, { message: `Processor provider with id ${providerId} not found` });\n }\n\n return {\n ...provider.info,\n availablePhases: provider.availablePhases,\n configSchema: zodToJsonSchema(provider.configSchema) as Record<string, unknown>,\n };\n } catch (error) {\n return handleError(error, 'Error getting processor provider');\n }\n },\n});\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkQTBCX6KF_cjs = require('./chunk-QTBCX6KF.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkEZCRZUSZ_cjs = require('./chunk-EZCRZUSZ.cjs');
|
|
5
5
|
var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs');
|
|
6
6
|
var chunkO7I5CWRX_cjs = require('./chunk-O7I5CWRX.cjs');
|
|
7
7
|
|
|
@@ -17,7 +17,7 @@ chunkO7I5CWRX_cjs.__export(mcp_exports, {
|
|
|
17
17
|
MCP_SSE_MESSAGES_ROUTE: () => MCP_SSE_MESSAGES_ROUTE,
|
|
18
18
|
MCP_SSE_TRANSPORT_ROUTE: () => MCP_SSE_TRANSPORT_ROUTE
|
|
19
19
|
});
|
|
20
|
-
var LIST_MCP_SERVERS_ROUTE =
|
|
20
|
+
var LIST_MCP_SERVERS_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
21
21
|
method: "GET",
|
|
22
22
|
path: "/mcp/v0/servers",
|
|
23
23
|
responseType: "json",
|
|
@@ -74,7 +74,7 @@ var LIST_MCP_SERVERS_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
var GET_MCP_SERVER_DETAIL_ROUTE =
|
|
77
|
+
var GET_MCP_SERVER_DETAIL_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
78
78
|
method: "GET",
|
|
79
79
|
path: "/mcp/v0/servers/:id",
|
|
80
80
|
responseType: "json",
|
|
@@ -102,7 +102,7 @@ var GET_MCP_SERVER_DETAIL_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
102
102
|
return serverDetail;
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
|
-
var LIST_MCP_SERVER_TOOLS_ROUTE =
|
|
105
|
+
var LIST_MCP_SERVER_TOOLS_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
106
106
|
method: "GET",
|
|
107
107
|
path: "/mcp/:serverId/tools",
|
|
108
108
|
responseType: "json",
|
|
@@ -126,7 +126,7 @@ var LIST_MCP_SERVER_TOOLS_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
126
126
|
return server.getToolListInfo();
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
|
-
var GET_MCP_SERVER_TOOL_DETAIL_ROUTE =
|
|
129
|
+
var GET_MCP_SERVER_TOOL_DETAIL_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
130
130
|
method: "GET",
|
|
131
131
|
path: "/mcp/:serverId/tools/:toolId",
|
|
132
132
|
responseType: "json",
|
|
@@ -154,7 +154,7 @@ var GET_MCP_SERVER_TOOL_DETAIL_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
154
154
|
return toolInfo;
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
var EXECUTE_MCP_SERVER_TOOL_ROUTE =
|
|
157
|
+
var EXECUTE_MCP_SERVER_TOOL_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
158
158
|
method: "POST",
|
|
159
159
|
path: "/mcp/:serverId/tools/:toolId/execute",
|
|
160
160
|
responseType: "json",
|
|
@@ -185,7 +185,7 @@ var EXECUTE_MCP_SERVER_TOOL_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
185
185
|
return { result };
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
|
-
var MCP_HTTP_TRANSPORT_ROUTE =
|
|
188
|
+
var MCP_HTTP_TRANSPORT_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
189
189
|
method: "ALL",
|
|
190
190
|
path: "/mcp/:serverId/mcp",
|
|
191
191
|
responseType: "mcp-http",
|
|
@@ -208,7 +208,7 @@ var MCP_HTTP_TRANSPORT_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
|
-
var MCP_SSE_TRANSPORT_ROUTE =
|
|
211
|
+
var MCP_SSE_TRANSPORT_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
212
212
|
method: "ALL",
|
|
213
213
|
path: "/mcp/:serverId/sse",
|
|
214
214
|
responseType: "mcp-sse",
|
|
@@ -232,7 +232,7 @@ var MCP_SSE_TRANSPORT_ROUTE = chunk4QX6ZNKX_cjs.createRoute({
|
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
234
|
});
|
|
235
|
-
var MCP_SSE_MESSAGES_ROUTE =
|
|
235
|
+
var MCP_SSE_MESSAGES_ROUTE = chunkEZCRZUSZ_cjs.createRoute({
|
|
236
236
|
method: "POST",
|
|
237
237
|
path: "/mcp/:serverId/messages",
|
|
238
238
|
responseType: "mcp-sse",
|
|
@@ -253,5 +253,5 @@ exports.MCP_HTTP_TRANSPORT_ROUTE = MCP_HTTP_TRANSPORT_ROUTE;
|
|
|
253
253
|
exports.MCP_SSE_MESSAGES_ROUTE = MCP_SSE_MESSAGES_ROUTE;
|
|
254
254
|
exports.MCP_SSE_TRANSPORT_ROUTE = MCP_SSE_TRANSPORT_ROUTE;
|
|
255
255
|
exports.mcp_exports = mcp_exports;
|
|
256
|
-
//# sourceMappingURL=chunk-
|
|
257
|
-
//# sourceMappingURL=chunk-
|
|
256
|
+
//# sourceMappingURL=chunk-TEPMJUHR.cjs.map
|
|
257
|
+
//# sourceMappingURL=chunk-TEPMJUHR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/handlers/mcp.ts"],"names":["__export","createRoute","listMcpServersQuerySchema","listMcpServersResponseSchema","HTTPException","mcpServerDetailPathParams","getMcpServerDetailQuerySchema","serverDetailSchema","mcpServerIdPathParams","listMcpServerToolsResponseSchema","mcpServerToolPathParams","mcpToolInfoSchema","executeToolBodySchema","executeToolResponseSchema"],"mappings":";;;;;;;;AAAA,IAAA,WAAA,GAAA;AAAAA,0BAAA,CAAA,WAAA,EAAA;AAAA,EAAA,6BAAA,EAAA,MAAA,6BAAA;AAAA,EAAA,2BAAA,EAAA,MAAA,2BAAA;AAAA,EAAA,gCAAA,EAAA,MAAA,gCAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,2BAAA,EAAA,MAAA,2BAAA;AAAA,EAAA,wBAAA,EAAA,MAAA,wBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA;AAAA,CAAA,CAAA;AAsBO,IAAM,yBAAyBC,6BAAA,CAAY;AAAA,EAChD,MAAA,EAAQ,KAAA;AAAA,EACR,IAAA,EAAM,iBAAA;AAAA,EACN,YAAA,EAAc,MAAA;AAAA,EACd,gBAAA,EAAkBC,2CAAA;AAAA,EAClB,cAAA,EAAgBC,8CAAA;AAAA,EAChB,OAAA,EAAS,kBAAA;AAAA,EACT,WAAA,EAAa,kEAAA;AAAA,EACb,IAAA,EAAM,CAAC,KAAK,CAAA;AAAA,EACZ,YAAA,EAAc,IAAA;AAAA,EACd,SAAS,OA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AwB;AACnC,CAAC","file":"chunk-KH2EURUA.cjs","sourcesContent":["import type { MCPServerBase as MastraMCPServerImplementation, ServerInfo } from '@mastra/core/mcp';\nimport { HTTPException } from '../http-exception';\nimport {\n mcpServerDetailPathParams,\n mcpServerToolPathParams,\n executeToolBodySchema,\n listMcpServersQuerySchema,\n getMcpServerDetailQuerySchema,\n listMcpServersResponseSchema,\n serverDetailSchema,\n mcpServerIdPathParams,\n listMcpServerToolsResponseSchema,\n mcpToolInfoSchema,\n executeToolResponseSchema,\n} from '../schemas/mcp';\nimport type { ServerContext } from '../server-adapter';\nimport { createRoute } from '../server-adapter/routes/route-builder';\n\n// ============================================================================\n// Route Definitions (createRoute pattern for server adapters)\n// ============================================================================\n\nexport const LIST_MCP_SERVERS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers',\n responseType: 'json',\n queryParamSchema: listMcpServersQuerySchema,\n responseSchema: listMcpServersResponseSchema,\n summary: 'List MCP servers',\n description: 'Returns a list of registered MCP servers with pagination support',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n routePrefix,\n page,\n perPage,\n limit,\n offset,\n }: ServerContext & { page?: number; perPage?: number; limit?: number; offset?: number }) => {\n if (!mastra || typeof mastra.listMCPServers !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or listMCPServers method not available' });\n }\n\n const servers = mastra.listMCPServers();\n\n if (!servers) {\n return { servers: [], total_count: 0, next: null };\n }\n\n const serverList = Object.values(servers) as MastraMCPServerImplementation[];\n const totalCount = serverList.length;\n\n // Support both page/perPage and limit/offset for backwards compatibility\n // Detect which format user is using - prefer page/perPage if both provided\n const useLegacyFormat =\n (limit !== undefined || offset !== undefined) && page === undefined && perPage === undefined;\n\n // If perPage provided, use it; otherwise fall back to limit\n const finalPerPage = perPage ?? limit;\n // If page provided, use it; otherwise convert from offset\n let finalPage = page;\n if (finalPage === undefined && offset !== undefined && finalPerPage !== undefined && finalPerPage > 0) {\n finalPage = Math.floor(offset / finalPerPage);\n }\n\n // Calculate offset from page/perPage\n const actualOffset = finalPage !== undefined && finalPerPage !== undefined ? finalPage * finalPerPage : 0;\n\n // Apply pagination\n let paginatedServers = serverList;\n let nextUrl: string | null = null;\n\n if (finalPerPage !== undefined) {\n paginatedServers = serverList.slice(actualOffset, actualOffset + finalPerPage);\n\n // Calculate next URL if there are more results\n if (actualOffset + finalPerPage < totalCount) {\n const nextPage = (finalPage ?? 0) + 1;\n // Return next URL in same format as request (legacy limit/offset or page/perPage)\n const prefix = routePrefix ?? '';\n if (useLegacyFormat) {\n const nextOffset = actualOffset + finalPerPage;\n nextUrl = `${prefix}/mcp/v0/servers?limit=${finalPerPage}&offset=${nextOffset}`;\n } else {\n nextUrl = `${prefix}/mcp/v0/servers?perPage=${finalPerPage}&page=${nextPage}`;\n }\n }\n }\n\n // Get server info for each server\n const serverInfoList: ServerInfo[] = paginatedServers.map(server => server.getServerInfo());\n\n return {\n servers: serverInfoList,\n total_count: totalCount,\n next: nextUrl,\n };\n },\n});\n\nexport const GET_MCP_SERVER_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers/:id',\n responseType: 'json',\n pathParamSchema: mcpServerDetailPathParams,\n queryParamSchema: getMcpServerDetailQuerySchema,\n responseSchema: serverDetailSchema,\n summary: 'Get MCP server details',\n description: 'Returns detailed information about a specific MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, id, version }: ServerContext & { id: string; version?: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(id);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${id}' not found` });\n }\n\n const serverDetail = server.getServerDetail();\n\n // If a specific version was requested, check if it matches\n if (version && serverDetail.version_detail.version !== version) {\n throw new HTTPException(404, {\n message: `MCP server with ID '${id}' found, but not version '${version}'. Available version: ${serverDetail.version_detail.version}`,\n });\n }\n\n return serverDetail;\n },\n});\n\nexport const LIST_MCP_SERVER_TOOLS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools',\n responseType: 'json',\n pathParamSchema: mcpServerIdPathParams,\n responseSchema: listMcpServerToolsResponseSchema,\n summary: 'List MCP server tools',\n description: 'Returns a list of tools available on the specified MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolListInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot list tools in this way.` });\n }\n\n return server.getToolListInfo();\n },\n});\n\nexport const GET_MCP_SERVER_TOOL_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools/:toolId',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n responseSchema: mcpToolInfoSchema,\n summary: 'Get MCP server tool details',\n description: 'Returns detailed information about a specific tool on the MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, toolId }: ServerContext & { serverId: string; toolId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot provide tool details in this way.` });\n }\n\n const toolInfo = server.getToolInfo(toolId);\n if (!toolInfo) {\n throw new HTTPException(404, { message: `Tool with ID '${toolId}' not found on MCP server '${serverId}'` });\n }\n\n return toolInfo;\n },\n});\n\nexport const EXECUTE_MCP_SERVER_TOOL_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/tools/:toolId/execute',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n bodySchema: executeToolBodySchema,\n responseSchema: executeToolResponseSchema,\n summary: 'Execute MCP server tool',\n description: 'Executes a tool on the specified MCP server with the provided arguments',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n serverId,\n toolId,\n data,\n }: ServerContext & { serverId: string; toolId: string; data?: unknown }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.executeTool !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot execute tools in this way.` });\n }\n\n const result = await server.executeTool(toolId, data);\n return { result };\n },\n});\n\n// ============================================================================\n// MCP Transport Routes (Streamable HTTP and SSE)\n// ============================================================================\n\n/**\n * MCP transport options that can be passed to startHTTP() or startSSE().\n * Includes serverless mode for running in stateless environments like Cloudflare Workers or Vercel Edge.\n */\nexport interface MCPTransportOptions {\n /**\n * When true, runs in stateless mode without session management.\n * Ideal for serverless environments where you can't maintain persistent connections.\n */\n serverless?: boolean;\n /**\n * Custom session ID generator function.\n */\n sessionIdGenerator?: () => string;\n}\n\n/**\n * MCP HTTP Transport response type.\n * Adapters use this to set up the HTTP transport via MCPServer.startHTTP()\n */\nexport interface MCPHttpTransportResult {\n server: MastraMCPServerImplementation;\n httpPath: string;\n /**\n * Optional MCP transport options for this specific route.\n * These override any class-level mcpOptions configured on the adapter.\n */\n mcpOptions?: MCPTransportOptions;\n}\n\n/**\n * MCP SSE Transport response type.\n * Adapters use this to set up the SSE transport via MCPServer.startSSE() or startHonoSSE()\n *\n * Note: SSE transport is inherently stateful and doesn't support serverless mode.\n */\nexport interface MCPSseTransportResult {\n server: MastraMCPServerImplementation;\n ssePath: string;\n messagePath: string;\n}\n\nexport const MCP_HTTP_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/mcp',\n responseType: 'mcp-http',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP HTTP Transport',\n description: 'Streamable HTTP transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPHttpTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n httpPath: `/mcp/${serverId}/mcp`,\n };\n },\n});\n\nexport const MCP_SSE_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/sse',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Transport',\n description: 'SSE transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPSseTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n ssePath: `/mcp/${serverId}/sse`,\n messagePath: `/mcp/${serverId}/messages`,\n };\n },\n});\n\nexport const MCP_SSE_MESSAGES_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/messages',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Messages',\n description: 'Message endpoint for SSE transport (posts messages to active SSE streams)',\n tags: ['MCP'],\n requiresAuth: true,\n handler: MCP_SSE_TRANSPORT_ROUTE.handler,\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/server/handlers/mcp.ts"],"names":["__export","createRoute","listMcpServersQuerySchema","listMcpServersResponseSchema","HTTPException","mcpServerDetailPathParams","getMcpServerDetailQuerySchema","serverDetailSchema","mcpServerIdPathParams","listMcpServerToolsResponseSchema","mcpServerToolPathParams","mcpToolInfoSchema","executeToolBodySchema","executeToolResponseSchema"],"mappings":";;;;;;;;AAAA,IAAA,WAAA,GAAA;AAAAA,0BAAA,CAAA,WAAA,EAAA;AAAA,EAAA,6BAAA,EAAA,MAAA,6BAAA;AAAA,EAAA,2BAAA,EAAA,MAAA,2BAAA;AAAA,EAAA,gCAAA,EAAA,MAAA,gCAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,2BAAA,EAAA,MAAA,2BAAA;AAAA,EAAA,wBAAA,EAAA,MAAA,wBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA;AAAA,CAAA,CAAA;AAsBO,IAAM,yBAAyBC,6BAAA,CAAY;AAAA,EAChD,MAAA,EAAQ,KAAA;AAAA,EACR,IAAA,EAAM,iBAAA;AAAA,EACN,YAAA,EAAc,MAAA;AAAA,EACd,gBAAA,EAAkBC,2CAAA;AAAA,EAClB,cAAA,EAAgBC,8CAAA;AAAA,EAChB,OAAA,EAAS,kBAAA;AAAA,EACT,WAAA,EAAa,kEAAA;AAAA,EACb,IAAA,EAAM,CAAC,KAAK,CAAA;AAAA,EACZ,YAAA,EAAc,IAAA;AAAA,EACd,SAAS,OAAO;AAAA,IACd,MAAA;AAAA,IACA,WAAA;AAAA,IACA,IAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA;AAAA,GACF,KAA4F;AAC1F,IAAA,IAAI,CAAC,MAAA,IAAU,OAAO,MAAA,CAAO,mBAAmB,UAAA,EAAY;AAC1D,MAAA,MAAM,IAAIC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AA;AAAA,EACb,IAAA,EAAM,CAAC,KAAK,CAAA;AAAA,EACZ,YAAA,EAAc,IAAA;AAAA,EACd,OAAA,EAAS,OAAO,EAAE,MAAA,EAAQ,UAAS,KAA4E;AAC7G,IAAA,IAAI,CAAC,MAAA,IAAU,OAAO,MAAA,CAAO,qBAAqB,UAAA,EAAY;AAC5D,MAAA,MAAM,IAAIJ,+BAAA,CAAc,GAAA,EAAK,EAAE,OAAA,EAAS,4DAA4D,CAAA;AAAA,IACtG;AAEA,IAAA,MAAM,MAAA,GAAS,MAAA,CAAO,gBAAA,CAAiB,QAAQ,CAAA;AAE/C,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,MAAM,IAAIA,gCAAc,GAAA,EAAK,EAAE,SAAS,CAAA,YAAA,EAAe,QAAQ,eAAe,CAAA;AAAA,IAChF;AAEA,IAAA,OAAO;AAAA,MACL,MAAA;AAAA,MACA,OAAA,EAAS,QAAQ,QAAQ,CAAA,IAAA,CAAA;AAAA,MACzB,WAAA,EAAa,QAAQ,QAAQ,CAAA,SAAA;AAAA,KAC/B;AAAA,EACF;AACF,CAAC;AAEM,IAAM,yBAAyBH,6BAAA,CAAY;AAAA,EAChD,MAAA,EAAQ,MAAA;AAAA,EACR,IAAA,EAAM,yBAAA;AAAA,EACN,YAAA,EAAc,SAAA;AAAA,EACd,eAAA,EAAiBO,uCAAA;AAAA,EACjB,OAAA,EAAS,kBAAA;AAAA,EACT,WAAA,EAAa,2EAAA;AAAA,EACb,IAAA,EAAM,CAAC,KAAK,CAAA;AAAA,EACZ,YAAA,EAAc,IAAA;AAAA,EACd,SAAS,uBAAA,CAAwB;AACnC,CAAC","file":"chunk-TEPMJUHR.cjs","sourcesContent":["import type { MCPServerBase as MastraMCPServerImplementation, ServerInfo } from '@mastra/core/mcp';\nimport { HTTPException } from '../http-exception';\nimport {\n mcpServerDetailPathParams,\n mcpServerToolPathParams,\n executeToolBodySchema,\n listMcpServersQuerySchema,\n getMcpServerDetailQuerySchema,\n listMcpServersResponseSchema,\n serverDetailSchema,\n mcpServerIdPathParams,\n listMcpServerToolsResponseSchema,\n mcpToolInfoSchema,\n executeToolResponseSchema,\n} from '../schemas/mcp';\nimport type { ServerContext } from '../server-adapter';\nimport { createRoute } from '../server-adapter/routes/route-builder';\n\n// ============================================================================\n// Route Definitions (createRoute pattern for server adapters)\n// ============================================================================\n\nexport const LIST_MCP_SERVERS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers',\n responseType: 'json',\n queryParamSchema: listMcpServersQuerySchema,\n responseSchema: listMcpServersResponseSchema,\n summary: 'List MCP servers',\n description: 'Returns a list of registered MCP servers with pagination support',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n routePrefix,\n page,\n perPage,\n limit,\n offset,\n }: ServerContext & { page?: number; perPage?: number; limit?: number; offset?: number }) => {\n if (!mastra || typeof mastra.listMCPServers !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or listMCPServers method not available' });\n }\n\n const servers = mastra.listMCPServers();\n\n if (!servers) {\n return { servers: [], total_count: 0, next: null };\n }\n\n const serverList = Object.values(servers) as MastraMCPServerImplementation[];\n const totalCount = serverList.length;\n\n // Support both page/perPage and limit/offset for backwards compatibility\n // Detect which format user is using - prefer page/perPage if both provided\n const useLegacyFormat =\n (limit !== undefined || offset !== undefined) && page === undefined && perPage === undefined;\n\n // If perPage provided, use it; otherwise fall back to limit\n const finalPerPage = perPage ?? limit;\n // If page provided, use it; otherwise convert from offset\n let finalPage = page;\n if (finalPage === undefined && offset !== undefined && finalPerPage !== undefined && finalPerPage > 0) {\n finalPage = Math.floor(offset / finalPerPage);\n }\n\n // Calculate offset from page/perPage\n const actualOffset = finalPage !== undefined && finalPerPage !== undefined ? finalPage * finalPerPage : 0;\n\n // Apply pagination\n let paginatedServers = serverList;\n let nextUrl: string | null = null;\n\n if (finalPerPage !== undefined) {\n paginatedServers = serverList.slice(actualOffset, actualOffset + finalPerPage);\n\n // Calculate next URL if there are more results\n if (actualOffset + finalPerPage < totalCount) {\n const nextPage = (finalPage ?? 0) + 1;\n // Return next URL in same format as request (legacy limit/offset or page/perPage)\n const prefix = routePrefix ?? '';\n if (useLegacyFormat) {\n const nextOffset = actualOffset + finalPerPage;\n nextUrl = `${prefix}/mcp/v0/servers?limit=${finalPerPage}&offset=${nextOffset}`;\n } else {\n nextUrl = `${prefix}/mcp/v0/servers?perPage=${finalPerPage}&page=${nextPage}`;\n }\n }\n }\n\n // Get server info for each server\n const serverInfoList: ServerInfo[] = paginatedServers.map(server => server.getServerInfo());\n\n return {\n servers: serverInfoList,\n total_count: totalCount,\n next: nextUrl,\n };\n },\n});\n\nexport const GET_MCP_SERVER_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/v0/servers/:id',\n responseType: 'json',\n pathParamSchema: mcpServerDetailPathParams,\n queryParamSchema: getMcpServerDetailQuerySchema,\n responseSchema: serverDetailSchema,\n summary: 'Get MCP server details',\n description: 'Returns detailed information about a specific MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, id, version }: ServerContext & { id: string; version?: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(id);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${id}' not found` });\n }\n\n const serverDetail = server.getServerDetail();\n\n // If a specific version was requested, check if it matches\n if (version && serverDetail.version_detail.version !== version) {\n throw new HTTPException(404, {\n message: `MCP server with ID '${id}' found, but not version '${version}'. Available version: ${serverDetail.version_detail.version}`,\n });\n }\n\n return serverDetail;\n },\n});\n\nexport const LIST_MCP_SERVER_TOOLS_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools',\n responseType: 'json',\n pathParamSchema: mcpServerIdPathParams,\n responseSchema: listMcpServerToolsResponseSchema,\n summary: 'List MCP server tools',\n description: 'Returns a list of tools available on the specified MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolListInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot list tools in this way.` });\n }\n\n return server.getToolListInfo();\n },\n});\n\nexport const GET_MCP_SERVER_TOOL_DETAIL_ROUTE = createRoute({\n method: 'GET',\n path: '/mcp/:serverId/tools/:toolId',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n responseSchema: mcpToolInfoSchema,\n summary: 'Get MCP server tool details',\n description: 'Returns detailed information about a specific tool on the MCP server',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId, toolId }: ServerContext & { serverId: string; toolId: string }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.getToolInfo !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot provide tool details in this way.` });\n }\n\n const toolInfo = server.getToolInfo(toolId);\n if (!toolInfo) {\n throw new HTTPException(404, { message: `Tool with ID '${toolId}' not found on MCP server '${serverId}'` });\n }\n\n return toolInfo;\n },\n});\n\nexport const EXECUTE_MCP_SERVER_TOOL_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/tools/:toolId/execute',\n responseType: 'json',\n pathParamSchema: mcpServerToolPathParams,\n bodySchema: executeToolBodySchema,\n responseSchema: executeToolResponseSchema,\n summary: 'Execute MCP server tool',\n description: 'Executes a tool on the specified MCP server with the provided arguments',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({\n mastra,\n serverId,\n toolId,\n data,\n }: ServerContext & { serverId: string; toolId: string; data?: unknown }) => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server with ID '${serverId}' not found` });\n }\n\n if (typeof server.executeTool !== 'function') {\n throw new HTTPException(501, { message: `Server '${serverId}' cannot execute tools in this way.` });\n }\n\n const result = await server.executeTool(toolId, data);\n return { result };\n },\n});\n\n// ============================================================================\n// MCP Transport Routes (Streamable HTTP and SSE)\n// ============================================================================\n\n/**\n * MCP transport options that can be passed to startHTTP() or startSSE().\n * Includes serverless mode for running in stateless environments like Cloudflare Workers or Vercel Edge.\n */\nexport interface MCPTransportOptions {\n /**\n * When true, runs in stateless mode without session management.\n * Ideal for serverless environments where you can't maintain persistent connections.\n */\n serverless?: boolean;\n /**\n * Custom session ID generator function.\n */\n sessionIdGenerator?: () => string;\n}\n\n/**\n * MCP HTTP Transport response type.\n * Adapters use this to set up the HTTP transport via MCPServer.startHTTP()\n */\nexport interface MCPHttpTransportResult {\n server: MastraMCPServerImplementation;\n httpPath: string;\n /**\n * Optional MCP transport options for this specific route.\n * These override any class-level mcpOptions configured on the adapter.\n */\n mcpOptions?: MCPTransportOptions;\n}\n\n/**\n * MCP SSE Transport response type.\n * Adapters use this to set up the SSE transport via MCPServer.startSSE() or startHonoSSE()\n *\n * Note: SSE transport is inherently stateful and doesn't support serverless mode.\n */\nexport interface MCPSseTransportResult {\n server: MastraMCPServerImplementation;\n ssePath: string;\n messagePath: string;\n}\n\nexport const MCP_HTTP_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/mcp',\n responseType: 'mcp-http',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP HTTP Transport',\n description: 'Streamable HTTP transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPHttpTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n httpPath: `/mcp/${serverId}/mcp`,\n };\n },\n});\n\nexport const MCP_SSE_TRANSPORT_ROUTE = createRoute({\n method: 'ALL',\n path: '/mcp/:serverId/sse',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Transport',\n description: 'SSE transport endpoint for MCP protocol communication',\n tags: ['MCP'],\n requiresAuth: true,\n handler: async ({ mastra, serverId }: ServerContext & { serverId: string }): Promise<MCPSseTransportResult> => {\n if (!mastra || typeof mastra.getMCPServerById !== 'function') {\n throw new HTTPException(500, { message: 'Mastra instance or getMCPServerById method not available' });\n }\n\n const server = mastra.getMCPServerById(serverId);\n\n if (!server) {\n throw new HTTPException(404, { message: `MCP server '${serverId}' not found` });\n }\n\n return {\n server,\n ssePath: `/mcp/${serverId}/sse`,\n messagePath: `/mcp/${serverId}/messages`,\n };\n },\n});\n\nexport const MCP_SSE_MESSAGES_ROUTE = createRoute({\n method: 'POST',\n path: '/mcp/:serverId/messages',\n responseType: 'mcp-sse',\n pathParamSchema: mcpServerIdPathParams,\n summary: 'MCP SSE Messages',\n description: 'Message endpoint for SSE transport (posts messages to active SSE streams)',\n tags: ['MCP'],\n requiresAuth: true,\n handler: MCP_SSE_TRANSPORT_ROUTE.handler,\n});\n"]}
|