{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../src/astro/routes/api/admin/plugins/[id]/index.ts"],"sourcesContent":["/**\n * Plugin management single plugin endpoint\n *\n * GET /_emdash/api/admin/plugins/:id - Get plugin details\n */\n\nimport type { APIRoute } from \"astro\";\n\nimport { requirePerm } from \"#api/authorize.js\";\nimport { apiError, unwrapResult } from \"#api/error.js\";\nimport { handlePluginGet } from \"#api/index.js\";\n\nexport const prerender = false;\n\nexport const GET: APIRoute = async ({ params, locals }) => {\n\tconst { emdash, user } = locals;\n\tconst { id } = params;\n\n\tif (!emdash?.db) {\n\t\treturn apiError(\"NOT_CONFIGURED\", \"EmDash is not initialized\", 500);\n\t}\n\n\tconst denied = requirePerm(user, \"plugins:read\");\n\tif (denied) return denied;\n\n\tif (!id) {\n\t\treturn apiError(\"INVALID_REQUEST\", \"Plugin ID required\", 400);\n\t}\n\n\tconst result = await handlePluginGet(\n\t\temdash.db,\n\t\temdash.configuredPlugins,\n\t\temdash.sandboxedPluginEntries,\n\t\tid,\n\t\temdash.config.marketplace,\n\t);\n\tif (result.success) {\n\t\tconst tools = await emdash.getPluginMcpTools(id);\n\t\tresult.data.item.mcpTools = tools.map(\n\t\t\t({ inputSchema: _, outputSchema: __, pluginId: ___, ...tool }) => tool,\n\t\t);\n\t}\n\n\treturn unwrapResult(result);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAa,YAAY;AAEzB,MAAa,MAAgB,OAAO,EAAE,QAAQ,aAAa;CAC1D,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,OAAO;AAEf,KAAI,CAAC,QAAQ,GACZ,QAAO,SAAS,kBAAkB,6BAA6B,IAAI;CAGpE,MAAM,SAAS,YAAY,MAAM,eAAe;AAChD,KAAI,OAAQ,QAAO;AAEnB,KAAI,CAAC,GACJ,QAAO,SAAS,mBAAmB,sBAAsB,IAAI;CAG9D,MAAM,SAAS,MAAM,gBACpB,OAAO,IACP,OAAO,mBACP,OAAO,wBACP,IACA,OAAO,OAAO,YACd;AACD,KAAI,OAAO,SAAS;EACnB,MAAM,QAAQ,MAAM,OAAO,kBAAkB,GAAG;AAChD,SAAO,KAAK,KAAK,WAAW,MAAM,KAChC,EAAE,aAAa,GAAG,cAAc,IAAI,UAAU,KAAK,GAAG,WAAW,KAClE;;AAGF,QAAO,aAAa,OAAO"}