agentstudio 0.4.2 → 0.4.3
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/config/engineConfig.d.ts +15 -0
- package/config/engineConfig.d.ts.map +1 -1
- package/config/engineConfig.js +30 -0
- package/config/engineConfig.js.map +1 -1
- package/config/index.d.ts.map +1 -1
- package/config/index.js +14 -0
- package/config/index.js.map +1 -1
- package/config/paths.d.ts +5 -0
- package/config/paths.d.ts.map +1 -1
- package/config/paths.js +6 -1
- package/config/paths.js.map +1 -1
- package/engines/claude/__tests__/supportedModels.test.d.ts +6 -4
- package/engines/claude/__tests__/supportedModels.test.d.ts.map +1 -1
- package/engines/claude/__tests__/supportedModels.test.js +55 -13
- package/engines/claude/__tests__/supportedModels.test.js.map +1 -1
- package/engines/claude/aguiAdapter.d.ts.map +1 -1
- package/engines/claude/aguiAdapter.js +8 -0
- package/engines/claude/aguiAdapter.js.map +1 -1
- package/engines/claude/claudeEngine.d.ts +36 -3
- package/engines/claude/claudeEngine.d.ts.map +1 -1
- package/engines/claude/claudeEngine.js +132 -13
- package/engines/claude/claudeEngine.js.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +29 -2
- package/index.js.map +1 -1
- package/middleware/callChain.d.ts +10 -0
- package/middleware/callChain.d.ts.map +1 -0
- package/middleware/callChain.js +24 -0
- package/middleware/callChain.js.map +1 -0
- package/middleware/requestId.d.ts +8 -0
- package/middleware/requestId.d.ts.map +1 -0
- package/middleware/requestId.js +18 -0
- package/middleware/requestId.js.map +1 -0
- package/package.json +1 -1
- package/prompts/gameDevSystemPrompt.d.ts +15 -0
- package/prompts/gameDevSystemPrompt.d.ts.map +1 -0
- package/prompts/gameDevSystemPrompt.js +37 -0
- package/prompts/gameDevSystemPrompt.js.map +1 -0
- package/prompts/vibeGamingPrompt.d.ts +13 -0
- package/prompts/vibeGamingPrompt.d.ts.map +1 -0
- package/prompts/vibeGamingPrompt.js +125 -0
- package/prompts/vibeGamingPrompt.js.map +1 -0
- package/public/assets/{AgentsPage-BsZdkqzM.js → AgentsPage-CHee5mUh.js} +1 -1
- package/public/assets/{Button-CMTSYiKV.js → Button-D5qiS7CR.js} +1 -1
- package/public/assets/ChatPage-B7-rn9mH.js +478 -0
- package/public/assets/{CommandForm-DwGvE9A_.js → CommandForm-CMfgHNm5.js} +1 -1
- package/public/assets/{CommandsPage-qDWzq8xp.js → CommandsPage-B4rjtVWk.js} +1 -1
- package/public/assets/{CursorConfigPage-DpUdJzRi.js → CursorConfigPage-DQ-3b3ti.js} +1 -1
- package/public/assets/{DashboardPage-BhqKOzob.js → DashboardPage-BowdW2Xj.js} +1 -1
- package/public/assets/{EngineGate-BjHJu955.js → EngineGate-DYNvEEbW.js} +1 -1
- package/public/assets/{FileBrowser-DboOOM_v.js → FileBrowser-DHyCacM6.js} +1 -1
- package/public/assets/{FileExplorer-x5R0Tcmk.js → FileExplorer-BprfeAH_.js} +1 -1
- package/public/assets/GeneralSettingsPage-C6hJ_zTw.js +1 -0
- package/public/assets/{HooksPage-DDGc0GGV.js → HooksPage-BwE2Zm3X.js} +1 -1
- package/public/assets/{LandingPage-CvY4n9Rh.js → LandingPage-DKvwbGX1.js} +1 -1
- package/public/assets/{LoginPage-C-PZfjYC.js → LoginPage-BpZhqRAN.js} +1 -1
- package/public/assets/{McpAdminSettingsPage-CIILVzB8.js → McpAdminSettingsPage-DuvsM5TX.js} +1 -1
- package/public/assets/{McpPage-B4nQUJag.js → McpPage-Hu8vyMhX.js} +1 -1
- package/public/assets/{MemorySettingsPage-eu6tsuUh.js → MemorySettingsPage-gIWSsrES.js} +1 -1
- package/public/assets/{ModelsPage-Bb5vSsuc.js → ModelsPage-Cosb3hHI.js} +1 -1
- package/public/assets/PluginsPage-CuNui9NV.js +12 -0
- package/public/assets/{ProjectSelector-CybrDbBY.js → ProjectSelector-CyBlHb2H.js} +1 -1
- package/public/assets/{ProjectsPage-DRl-0B4G.js → ProjectsPage-DYhCvH07.js} +1 -1
- package/public/assets/{RulesPage-DUt33RkX.js → RulesPage-C32P_Aqz.js} +1 -1
- package/public/assets/{ScheduledTasksPage-CTDYYRIN.js → ScheduledTasksPage-ixn5qoiD.js} +1 -1
- package/public/assets/SettingsLayout-C_7jR0Te.js +1 -0
- package/public/assets/{SkillsPage-Lzw8I9vR.js → SkillsPage-C-WS4N1Y.js} +1 -1
- package/public/assets/{SubagentForm-BzzeWg0W.js → SubagentForm-BbxljQUp.js} +1 -1
- package/public/assets/{SubagentsPage-bX2XWdJ0.js → SubagentsPage-D66TBaeN.js} +1 -1
- package/public/assets/{SystemInfoPage-nEIQbtwG.js → SystemInfoPage-DXVUncTe.js} +1 -1
- package/public/assets/{TelemetrySettingsPage-q167I4G9.js → TelemetrySettingsPage-Cp3vOu7X.js} +1 -1
- package/public/assets/{ToastTestPage-j224d3QR.js → ToastTestPage-03up9yZR.js} +1 -1
- package/public/assets/{ToolsList-CTsQr53G.js → ToolsList-BZFBEuvQ.js} +1 -1
- package/public/assets/UnifiedToolSelector-DJN7ASu1.js +1 -0
- package/public/assets/{VersionSettingsPage-BwpwiLyl.js → VersionSettingsPage-DppWaX--.js} +1 -1
- package/public/assets/{VoiceSettingsPage-d3l9AWBn.js → VoiceSettingsPage-BWJLeedX.js} +1 -1
- package/public/assets/{WebSocketTunnelPage-BqEUE7mr.js → WebSocketTunnelPage-BPeSTgEZ.js} +1 -1
- package/public/assets/{_basePickBy-DHabY031.js → _basePickBy-0UeYrifO.js} +1 -1
- package/public/assets/{_baseUniq-B1lmu3qr.js → _baseUniq-Q0NUbuSr.js} +1 -1
- package/public/assets/{agents-KlPdWQ8K.js → agents-DR9EZMs5.js} +1 -1
- package/public/assets/{arc-6sRLTBcr.js → arc-BV8erW1-.js} +1 -1
- package/public/assets/{architectureDiagram-VXUJARFQ-kwdTmjuB.js → architectureDiagram-VXUJARFQ-BIodTu6s.js} +1 -1
- package/public/assets/{blockDiagram-VD42YOAC-CYO9EYkJ.js → blockDiagram-VD42YOAC-4H3KjsGf.js} +1 -1
- package/public/assets/{c4Diagram-YG6GDRKO-gAp3--Ee.js → c4Diagram-YG6GDRKO-J2ovCYEr.js} +1 -1
- package/public/assets/channel-gveiJv4S.js +1 -0
- package/public/assets/{chunk-4BX2VUAB-DQVsL-J6.js → chunk-4BX2VUAB-D7Mc44O6.js} +1 -1
- package/public/assets/{chunk-55IACEB6-DVsfnY5X.js → chunk-55IACEB6-CMASo37Z.js} +1 -1
- package/public/assets/{chunk-B4BG7PRW-BNmOvuIn.js → chunk-B4BG7PRW-2T3W2IB6.js} +1 -1
- package/public/assets/{chunk-DI55MBZ5-BkucWe8Y.js → chunk-DI55MBZ5-FR9qswmO.js} +1 -1
- package/public/assets/{chunk-FMBD7UC4-BsvfEdnB.js → chunk-FMBD7UC4-Bz2LO9q3.js} +1 -1
- package/public/assets/{chunk-QN33PNHL-DSecsNtM.js → chunk-QN33PNHL-D7mfK9Pm.js} +1 -1
- package/public/assets/{chunk-QZHKN3VN-DhvrZSqy.js → chunk-QZHKN3VN-AkuNbqQU.js} +1 -1
- package/public/assets/{chunk-TZMSLE5B-BqQ674GC.js → chunk-TZMSLE5B-DtY3rhWy.js} +1 -1
- package/public/assets/classDiagram-2ON5EDUG-f-lJUj27.js +1 -0
- package/public/assets/classDiagram-v2-WZHVMYZB-f-lJUj27.js +1 -0
- package/public/assets/clone-D5-Tsf9e.js +1 -0
- package/public/assets/{cose-bilkent-S5V4N54A-D9ZC6LmB.js → cose-bilkent-S5V4N54A-BuEw-qDX.js} +1 -1
- package/public/assets/{dagre-6UL2VRFP-s7YD2ZcY.js → dagre-6UL2VRFP-D-NrLBGh.js} +1 -1
- package/public/assets/{diagram-PSM6KHXK-C7jhP5tx.js → diagram-PSM6KHXK-BFjWOHNz.js} +1 -1
- package/public/assets/{diagram-QEK2KX5R-B348GmS1.js → diagram-QEK2KX5R-C0YlDb8t.js} +1 -1
- package/public/assets/{diagram-S2PKOQOG-Cu-zjwc9.js → diagram-S2PKOQOG-BLKbR12g.js} +1 -1
- package/public/assets/{erDiagram-Q2GNP2WA-tM4HKBpy.js → erDiagram-Q2GNP2WA-Cov6xnUk.js} +1 -1
- package/public/assets/{flowDiagram-NV44I4VS-DjCIshpi.js → flowDiagram-NV44I4VS-DTMKSJI1.js} +1 -1
- package/public/assets/{ganttDiagram-LVOFAZNH-Q6plkI5G.js → ganttDiagram-LVOFAZNH-DR0bcfHY.js} +1 -1
- package/public/assets/{gitGraphDiagram-NY62KEGX-B3Uw90Yt.js → gitGraphDiagram-NY62KEGX-CvxYSabY.js} +1 -1
- package/public/assets/{graph-Bp0jlxBT.js → graph-BYXvelIL.js} +1 -1
- package/public/assets/{index-f67nhEoX.js → index-BIGPvi1D.js} +44 -44
- package/public/assets/infoDiagram-F6ZHWCRC-CL9g-UgS.js +2 -0
- package/public/assets/{journeyDiagram-XKPGCS4Q-CgQogtHU.js → journeyDiagram-XKPGCS4Q-Df8G0pW8.js} +1 -1
- package/public/assets/{kanban-definition-3W4ZIXB7-Cv7kVxyy.js → kanban-definition-3W4ZIXB7-DhoP7TG_.js} +1 -1
- package/public/assets/{layout-6bkH32V1.js → layout-CgO4Vp_y.js} +1 -1
- package/public/assets/{linear-DWoZ6Tbm.js → linear-CaY74pOB.js} +1 -1
- package/public/assets/{mindmap-definition-VGOIOE7T-D5wd9HsH.js → mindmap-definition-VGOIOE7T-CVK2y0WQ.js} +1 -1
- package/public/assets/{pieDiagram-ADFJNKIX-8vPxErLm.js → pieDiagram-ADFJNKIX-BQt_waQk.js} +1 -1
- package/public/assets/{quadrantDiagram-AYHSOK5B-Pn0NZ9k7.js → quadrantDiagram-AYHSOK5B-DvLFoDeH.js} +1 -1
- package/public/assets/{requirementDiagram-UZGBJVZJ-C7u8MiN1.js → requirementDiagram-UZGBJVZJ-C4lqjEUP.js} +1 -1
- package/public/assets/{sankeyDiagram-TZEHDZUN-C660O4mw.js → sankeyDiagram-TZEHDZUN-BKIDyl6M.js} +1 -1
- package/public/assets/{sequenceDiagram-WL72ISMW-pXBA2_3B.js → sequenceDiagram-WL72ISMW-BeyhJ61U.js} +1 -1
- package/public/assets/{stateDiagram-FKZM4ZOC-CxZMM1Lf.js → stateDiagram-FKZM4ZOC-CKyn6eKl.js} +1 -1
- package/public/assets/stateDiagram-v2-4FDKWEC3-DogBVcJE.js +1 -0
- package/public/assets/{table-Clz57edU.js → table-BgVewkB5.js} +1 -1
- package/public/assets/{timeline-definition-IT6M3QCI-Crg44TaP.js → timeline-definition-IT6M3QCI-Cm5SIAmT.js} +1 -1
- package/public/assets/tools-crrPnehB.js +1 -0
- package/public/assets/{treemap-KMMF4GRG-bFxwBWXw.js → treemap-KMMF4GRG-CUMeoVWM.js} +1 -1
- package/public/assets/{ui-components-DjgDPiqV.js → ui-components-D1pZO0y-.js} +1 -1
- package/public/assets/{useAgents-8KXN6U61.js → useAgents-M4lcWvy0.js} +1 -1
- package/public/assets/{useClaudeVersions-DicHLV6A.js → useClaudeVersions-CKT_fq1t.js} +1 -1
- package/public/assets/{useCommands-DbSH48ba.js → useCommands-vaoVPEDI.js} +1 -1
- package/public/assets/{useProjects-Bbh6hJMM.js → useProjects-D1ElB-WS.js} +1 -1
- package/public/assets/{useSessions-DOa4-xiB.js → useSessions-Dp1kUl43.js} +1 -1
- package/public/assets/{xychartDiagram-PRI3JC2R-DG3KmjD-.js → xychartDiagram-PRI3JC2R-Cy-SHDyX.js} +1 -1
- package/public/index.html +4 -4
- package/routes/a2a.d.ts.map +1 -1
- package/routes/a2a.js +27 -7
- package/routes/a2a.js.map +1 -1
- package/routes/agents.d.ts.map +1 -1
- package/routes/agents.js +234 -38
- package/routes/agents.js.map +1 -1
- package/routes/agui.d.ts.map +1 -1
- package/routes/agui.js +44 -1
- package/routes/agui.js.map +1 -1
- package/routes/gitVersions.d.ts.map +1 -1
- package/routes/gitVersions.js +80 -1
- package/routes/gitVersions.js.map +1 -1
- package/routes/marketplaceSkills.d.ts +18 -0
- package/routes/marketplaceSkills.d.ts.map +1 -0
- package/routes/marketplaceSkills.js +190 -0
- package/routes/marketplaceSkills.js.map +1 -0
- package/routes/plugins.d.ts.map +1 -1
- package/routes/plugins.js +48 -7
- package/routes/plugins.js.map +1 -1
- package/routes/projects.d.ts.map +1 -1
- package/routes/projects.js +34 -0
- package/routes/projects.js.map +1 -1
- package/schemas/a2a.d.ts +35 -4
- package/schemas/a2a.d.ts.map +1 -1
- package/schemas/a2a.js +9 -1
- package/schemas/a2a.js.map +1 -1
- package/services/__tests__/agentImporter.test.js +197 -0
- package/services/__tests__/agentImporter.test.js.map +1 -1
- package/services/__tests__/pluginInstaller.test.js +2 -1
- package/services/__tests__/pluginInstaller.test.js.map +1 -1
- package/services/agentImporter.d.ts +7 -0
- package/services/agentImporter.d.ts.map +1 -1
- package/services/agentImporter.js +57 -4
- package/services/agentImporter.js.map +1 -1
- package/services/builtinMarketplaceService.d.ts +56 -0
- package/services/builtinMarketplaceService.d.ts.map +1 -0
- package/services/builtinMarketplaceService.js +328 -0
- package/services/builtinMarketplaceService.js.map +1 -0
- package/services/claudeSession.d.ts.map +1 -1
- package/services/claudeSession.js +15 -4
- package/services/claudeSession.js.map +1 -1
- package/services/claudeVersionStorage.js +6 -6
- package/services/claudeVersionStorage.js.map +1 -1
- package/services/gitVersionService.d.ts +22 -0
- package/services/gitVersionService.d.ts.map +1 -1
- package/services/gitVersionService.js +117 -19
- package/services/gitVersionService.js.map +1 -1
- package/services/marketplaceSkillService.d.ts +129 -0
- package/services/marketplaceSkillService.d.ts.map +1 -0
- package/services/marketplaceSkillService.js +358 -0
- package/services/marketplaceSkillService.js.map +1 -0
- package/services/marketplaceUpdateService.d.ts.map +1 -1
- package/services/marketplaceUpdateService.js +29 -2
- package/services/marketplaceUpdateService.js.map +1 -1
- package/services/pluginCopyInstall.d.ts +60 -0
- package/services/pluginCopyInstall.d.ts.map +1 -0
- package/services/pluginCopyInstall.js +290 -0
- package/services/pluginCopyInstall.js.map +1 -0
- package/services/pluginInstallStrategy.d.ts +39 -0
- package/services/pluginInstallStrategy.d.ts.map +1 -0
- package/services/pluginInstallStrategy.js +50 -0
- package/services/pluginInstallStrategy.js.map +1 -0
- package/services/pluginInstaller.d.ts +10 -0
- package/services/pluginInstaller.d.ts.map +1 -1
- package/services/pluginInstaller.js +70 -20
- package/services/pluginInstaller.js.map +1 -1
- package/services/pluginParser.d.ts +17 -1
- package/services/pluginParser.d.ts.map +1 -1
- package/services/pluginParser.js +161 -84
- package/services/pluginParser.js.map +1 -1
- package/services/pluginPaths.d.ts +3 -3
- package/services/pluginPaths.d.ts.map +1 -1
- package/services/pluginPaths.js +33 -14
- package/services/pluginPaths.js.map +1 -1
- package/services/pluginScanner.js +2 -2
- package/services/pluginScanner.js.map +1 -1
- package/services/pluginSymlink.d.ts +10 -0
- package/services/pluginSymlink.d.ts.map +1 -1
- package/services/pluginSymlink.js +117 -1
- package/services/pluginSymlink.js.map +1 -1
- package/services/preSendGuard/__tests__/preSendGuard.test.d.ts +2 -0
- package/services/preSendGuard/__tests__/preSendGuard.test.d.ts.map +1 -0
- package/services/preSendGuard/__tests__/preSendGuard.test.js +102 -0
- package/services/preSendGuard/__tests__/preSendGuard.test.js.map +1 -0
- package/services/preSendGuard/configResolver.d.ts +8 -0
- package/services/preSendGuard/configResolver.d.ts.map +1 -0
- package/services/preSendGuard/configResolver.js +181 -0
- package/services/preSendGuard/configResolver.js.map +1 -0
- package/services/preSendGuard/index.d.ts +9 -0
- package/services/preSendGuard/index.d.ts.map +1 -0
- package/services/preSendGuard/index.js +165 -0
- package/services/preSendGuard/index.js.map +1 -0
- package/services/preSendGuard/providers/httpAuditProvider.d.ts +3 -0
- package/services/preSendGuard/providers/httpAuditProvider.d.ts.map +1 -0
- package/services/preSendGuard/providers/httpAuditProvider.js +98 -0
- package/services/preSendGuard/providers/httpAuditProvider.js.map +1 -0
- package/services/preSendGuard/providers/noopProvider.d.ts +3 -0
- package/services/preSendGuard/providers/noopProvider.d.ts.map +1 -0
- package/services/preSendGuard/providers/noopProvider.js +13 -0
- package/services/preSendGuard/providers/noopProvider.js.map +1 -0
- package/services/runFinishedHooks.d.ts +29 -0
- package/services/runFinishedHooks.d.ts.map +1 -0
- package/services/runFinishedHooks.js +57 -0
- package/services/runFinishedHooks.js.map +1 -0
- package/testing/index.d.ts +18 -0
- package/testing/index.d.ts.map +1 -0
- package/testing/index.js +25 -0
- package/testing/index.js.map +1 -0
- package/testing/mockSdkQuery.d.ts +49 -0
- package/testing/mockSdkQuery.d.ts.map +1 -0
- package/testing/mockSdkQuery.js +209 -0
- package/testing/mockSdkQuery.js.map +1 -0
- package/testing/scenarioLoader.d.ts +71 -0
- package/testing/scenarioLoader.d.ts.map +1 -0
- package/testing/scenarioLoader.js +224 -0
- package/testing/scenarioLoader.js.map +1 -0
- package/types/a2a.d.ts +5 -0
- package/types/a2a.d.ts.map +1 -1
- package/types/agents.d.ts +32 -0
- package/types/agents.d.ts.map +1 -1
- package/types/agents.js +1 -0
- package/types/agents.js.map +1 -1
- package/types/engine.d.ts +6 -0
- package/types/engine.d.ts.map +1 -1
- package/types/plugins.d.ts +12 -2
- package/types/plugins.d.ts.map +1 -1
- package/types/preSendGuard.d.ts +51 -0
- package/types/preSendGuard.d.ts.map +1 -0
- package/types/preSendGuard.js +3 -0
- package/types/preSendGuard.js.map +1 -0
- package/utils/__tests__/claudeUtils.test.js +89 -1
- package/utils/__tests__/claudeUtils.test.js.map +1 -1
- package/utils/claudeUtils.d.ts +1 -1
- package/utils/claudeUtils.d.ts.map +1 -1
- package/utils/claudeUtils.js +92 -37
- package/utils/claudeUtils.js.map +1 -1
- package/public/assets/ChatPage-D8buVhfb.js +0 -478
- package/public/assets/GeneralSettingsPage-DYdwai51.js +0 -1
- package/public/assets/PluginsPage-DD92Xk6X.js +0 -12
- package/public/assets/SettingsLayout-LGC-0pQl.js +0 -1
- package/public/assets/UnifiedToolSelector-BP6fuyzG.js +0 -1
- package/public/assets/channel-D9wyZF1L.js +0 -1
- package/public/assets/classDiagram-2ON5EDUG-DwEqkkEb.js +0 -1
- package/public/assets/classDiagram-v2-WZHVMYZB-DwEqkkEb.js +0 -1
- package/public/assets/clone-3wFPaI2j.js +0 -1
- package/public/assets/infoDiagram-F6ZHWCRC-HUfwv_JT.js +0 -2
- package/public/assets/stateDiagram-v2-4FDKWEC3-CmurzrWf.js +0 -1
- package/public/assets/tools-BZTR2NP1.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as d}from"./monaco-editor-BWfQfpij.js";import{u}from"./tools-BZTR2NP1.js";import{ap as N,d as k,a0 as f,G as g,aq as w,Z as o,_ as t,I as h,N as v,a3 as i,ar as C,e as A,o as p,m as S,as as F,t as E,X as s}from"./ui-components-DjgDPiqV.js";import{L as y}from"./index-f67nhEoX.js";import"./syntax-highlighting-DGbNjS3S.js";import"./agents-KlPdWQ8K.js";const G=()=>{const{t:a,i18n:r}=u("pages"),[x,c]=d.useState(!1),[j,n]=d.useState(!1),b=()=>{const l=r.language==="zh-CN"?"en-US":"zh-CN";r.changeLanguage(l)},m=()=>{navigator.clipboard.writeText("npm install -g agentstudio && agentstudio start"),c(!0),setTimeout(()=>c(!1),2e3)};return d.useEffect(()=>{document.title=a("landing.pageTitle");const l=document.querySelector('meta[name="description"]');l&&l.setAttribute("content",a("landing.metaDescription"))},[a]),e.jsxs("div",{className:"min-h-screen bg-white dark:bg-gray-950",children:[e.jsx("nav",{className:"bg-white/90 dark:bg-gray-950/90 backdrop-blur-sm border-b border-gray-100 dark:border-gray-800 sticky top-0 z-50",children:e.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex justify-between items-center h-16",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"AgentStudio"})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("button",{onClick:()=>n(!0),className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 transition-colors",children:[e.jsx(N,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:a("landing.nav.wechat")||"微信群"})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(k,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:a("landing.nav.docs")})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(f,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"GitHub"})]}),e.jsxs("button",{onClick:b,className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",title:r.language==="zh-CN"?"Switch to English":"切换到中文",children:[e.jsx(g,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:r.language==="zh-CN"?"EN":"中文"})]}),e.jsxs(y,{to:"/dashboard",className:"inline-flex items-center px-4 py-2 bg-gray-900 dark:bg-white hover:bg-gray-800 dark:hover:bg-gray-100 text-white dark:text-gray-900 font-medium rounded-lg transition-colors duration-200",children:[a("landing.nav.enterWorkspace"),e.jsx(w,{className:"ml-2 w-4 h-4"})]})]})]})})}),e.jsx("section",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800 text-sm text-gray-600 dark:text-gray-400 mb-6",children:[e.jsx(o,{className:"w-4 h-4 mr-2 text-amber-500"}),a("landing.hero.badge")]}),e.jsx("h1",{className:"text-4xl sm:text-5xl lg:text-6xl font-bold text-gray-900 dark:text-white mb-6 leading-tight",children:a("landing.hero.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-4 max-w-2xl mx-auto",children:a("landing.hero.subtitle")}),e.jsx("p",{className:"text-lg text-gray-500 dark:text-gray-500 mb-8 max-w-2xl mx-auto",children:a("landing.hero.description")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:a("landing.hero.installHint")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:m,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:x?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:a("landing.preview.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a("landing.preview.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-chat.png",alt:a("landing.preview.chatAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.chatCaption")})]}),e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-mcp.png",alt:a("landing.preview.mcpAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.mcpCaption")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.features.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.features.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(v,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.localWorkspace.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(g,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.webExperience.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(o,{className:"w-5 h-5 mr-2 mt-0.5 text-amber-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(C,{className:"w-5 h-5 mr-2 mt-0.5 text-purple-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(A,{className:"w-5 h-5 mr-2 mt-0.5 text-blue-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(p,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.sdkFeatures.title")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:"MCP"}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.skills")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.commands")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.plugins")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.memory")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.subagent")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.multiModel")})]}),e.jsx("p",{className:"mt-4 text-sm text-gray-500 dark:text-gray-500",children:a("landing.features.sdkFeatures.anthropicCompat")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 text-sm mb-4",children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),a("landing.scheduler.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.scheduler.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 mb-8",children:a("landing.scheduler.description")})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-2xl p-6 border border-gray-100 dark:border-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.scheduler.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📊"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🔍"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📝"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario3.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📈"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario4.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario4.desc")})]})]})]})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1 bg-white dark:bg-gray-800 rounded-2xl p-6 border border-gray-100 dark:border-gray-700",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.a2a.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🤵"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"💻"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📱"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario3.desc")})]})]})]})]}),e.jsxs("div",{className:"order-1 lg:order-2",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 text-sm mb-4",children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),a("landing.a2a.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.a2a.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.a2a.description")})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 text-sm mb-4",children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),a("landing.customAgent.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.customAgent.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.customAgent.description")})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📊"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example1")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🤵"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example2")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📝"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example3")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🔍"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example4")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.comparison.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.comparison.subtitle")})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-100 dark:border-gray-700 overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-700",children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400",children:a("landing.comparison.dimension")}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-semibold text-gray-900 dark:text-white",children:"AgentStudio"}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-medium text-gray-500 dark:text-gray-400",children:"Claude Code"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:[e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.interface")}),e.jsxs("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:["Web ",a("landing.comparison.webInterface")]}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.cli")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.targetUsers")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.everyone")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.developers")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.toolDisplay")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.visual")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.textOnly")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.fileBrowser")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.agentCustom")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.scheduler")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.a2a")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.mobileAccess")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-amber-600 dark:text-amber-400",children:a("landing.comparison.beta")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]})]})]})})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-6",children:a("landing.cta.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-8",children:a("landing.cta.subtitle")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:m,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:x?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center px-8 py-4 bg-white dark:bg-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 font-semibold rounded-xl border border-gray-200 dark:border-gray-700 transition-all duration-200",children:[e.jsx(p,{className:"mr-2 w-5 h-5"}),"GitHub"]})]})}),e.jsx("footer",{className:"bg-gray-900 text-gray-300 py-12 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-8",children:[e.jsxs("div",{className:"col-span-1 md:col-span-2",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-white",children:"AgentStudio"})]}),e.jsx("p",{className:"text-gray-400 mb-4 max-w-md",children:a("landing.footer.description")}),e.jsx("div",{className:"text-sm text-gray-500",children:a("landing.footer.copyright")})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.product")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx(y,{to:"/dashboard",className:"hover:text-white transition-colors",children:a("landing.footer.workspace")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.sourceCode")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.releases")})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.support")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.documentation")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/issues",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.issues")})}),e.jsx("li",{children:e.jsx("button",{onClick:()=>n(!0),className:"hover:text-white transition-colors text-left w-full",children:a("landing.footer.wechat")||"微信群"})})]})]})]})})}),j&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 relative",children:[e.jsx("button",{onClick:()=>n(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors",children:e.jsx(s,{className:"w-5 h-5"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:a("landing.wechat.title")||"加入微信群"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/wechat-qr-code.png",alt:"WeChat QR Code",className:"w-64 h-64 object-contain border border-gray-200 dark:border-gray-700 rounded-lg"})}),e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:e.jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 text-center",children:[a("landing.wechat.fallback")||"二维码失效?请添加微信号:",e.jsx("span",{className:"font-mono font-semibold ml-1",children:a("landing.wechat.wechatId")||"your-wechat-id"})]})}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center",children:a("landing.wechat.tip")||"扫码或添加微信号,即可加入交流群"})]})]})})]})};export{G as default};
|
|
1
|
+
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as d}from"./monaco-editor-BWfQfpij.js";import{u}from"./tools-crrPnehB.js";import{ap as N,d as k,a0 as f,G as g,aq as w,Z as o,_ as t,I as h,M as v,a3 as i,ar as C,e as A,o as p,m as S,as as F,t as E,X as s}from"./ui-components-D1pZO0y-.js";import{L as y}from"./index-BIGPvi1D.js";import"./syntax-highlighting-DGbNjS3S.js";import"./agents-DR9EZMs5.js";const G=()=>{const{t:a,i18n:r}=u("pages"),[x,c]=d.useState(!1),[j,n]=d.useState(!1),b=()=>{const l=r.language==="zh-CN"?"en-US":"zh-CN";r.changeLanguage(l)},m=()=>{navigator.clipboard.writeText("npm install -g agentstudio && agentstudio start"),c(!0),setTimeout(()=>c(!1),2e3)};return d.useEffect(()=>{document.title=a("landing.pageTitle");const l=document.querySelector('meta[name="description"]');l&&l.setAttribute("content",a("landing.metaDescription"))},[a]),e.jsxs("div",{className:"min-h-screen bg-white dark:bg-gray-950",children:[e.jsx("nav",{className:"bg-white/90 dark:bg-gray-950/90 backdrop-blur-sm border-b border-gray-100 dark:border-gray-800 sticky top-0 z-50",children:e.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex justify-between items-center h-16",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"AgentStudio"})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("button",{onClick:()=>n(!0),className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 transition-colors",children:[e.jsx(N,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:a("landing.nav.wechat")||"微信群"})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(k,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:a("landing.nav.docs")})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(f,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"GitHub"})]}),e.jsxs("button",{onClick:b,className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",title:r.language==="zh-CN"?"Switch to English":"切换到中文",children:[e.jsx(g,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:r.language==="zh-CN"?"EN":"中文"})]}),e.jsxs(y,{to:"/dashboard",className:"inline-flex items-center px-4 py-2 bg-gray-900 dark:bg-white hover:bg-gray-800 dark:hover:bg-gray-100 text-white dark:text-gray-900 font-medium rounded-lg transition-colors duration-200",children:[a("landing.nav.enterWorkspace"),e.jsx(w,{className:"ml-2 w-4 h-4"})]})]})]})})}),e.jsx("section",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800 text-sm text-gray-600 dark:text-gray-400 mb-6",children:[e.jsx(o,{className:"w-4 h-4 mr-2 text-amber-500"}),a("landing.hero.badge")]}),e.jsx("h1",{className:"text-4xl sm:text-5xl lg:text-6xl font-bold text-gray-900 dark:text-white mb-6 leading-tight",children:a("landing.hero.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-4 max-w-2xl mx-auto",children:a("landing.hero.subtitle")}),e.jsx("p",{className:"text-lg text-gray-500 dark:text-gray-500 mb-8 max-w-2xl mx-auto",children:a("landing.hero.description")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:a("landing.hero.installHint")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:m,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:x?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:a("landing.preview.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a("landing.preview.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-chat.png",alt:a("landing.preview.chatAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.chatCaption")})]}),e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-mcp.png",alt:a("landing.preview.mcpAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.mcpCaption")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.features.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.features.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(v,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.localWorkspace.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(g,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.webExperience.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(o,{className:"w-5 h-5 mr-2 mt-0.5 text-amber-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(C,{className:"w-5 h-5 mr-2 mt-0.5 text-purple-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(A,{className:"w-5 h-5 mr-2 mt-0.5 text-blue-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(p,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.sdkFeatures.title")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:"MCP"}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.skills")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.commands")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.plugins")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.memory")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.subagent")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.multiModel")})]}),e.jsx("p",{className:"mt-4 text-sm text-gray-500 dark:text-gray-500",children:a("landing.features.sdkFeatures.anthropicCompat")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 text-sm mb-4",children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),a("landing.scheduler.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.scheduler.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 mb-8",children:a("landing.scheduler.description")})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-2xl p-6 border border-gray-100 dark:border-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.scheduler.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📊"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🔍"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📝"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario3.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📈"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario4.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario4.desc")})]})]})]})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1 bg-white dark:bg-gray-800 rounded-2xl p-6 border border-gray-100 dark:border-gray-700",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.a2a.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🤵"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"💻"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📱"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario3.desc")})]})]})]})]}),e.jsxs("div",{className:"order-1 lg:order-2",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 text-sm mb-4",children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),a("landing.a2a.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.a2a.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.a2a.description")})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 text-sm mb-4",children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),a("landing.customAgent.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.customAgent.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.customAgent.description")})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📊"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example1")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🤵"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example2")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📝"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example3")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🔍"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example4")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.comparison.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.comparison.subtitle")})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-100 dark:border-gray-700 overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-700",children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400",children:a("landing.comparison.dimension")}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-semibold text-gray-900 dark:text-white",children:"AgentStudio"}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-medium text-gray-500 dark:text-gray-400",children:"Claude Code"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:[e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.interface")}),e.jsxs("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:["Web ",a("landing.comparison.webInterface")]}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.cli")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.targetUsers")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.everyone")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.developers")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.toolDisplay")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.visual")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.textOnly")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.fileBrowser")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.agentCustom")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.scheduler")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.a2a")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.mobileAccess")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-amber-600 dark:text-amber-400",children:a("landing.comparison.beta")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]})]})]})})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-6",children:a("landing.cta.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-8",children:a("landing.cta.subtitle")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:m,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:x?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center px-8 py-4 bg-white dark:bg-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 font-semibold rounded-xl border border-gray-200 dark:border-gray-700 transition-all duration-200",children:[e.jsx(p,{className:"mr-2 w-5 h-5"}),"GitHub"]})]})}),e.jsx("footer",{className:"bg-gray-900 text-gray-300 py-12 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-8",children:[e.jsxs("div",{className:"col-span-1 md:col-span-2",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-white",children:"AgentStudio"})]}),e.jsx("p",{className:"text-gray-400 mb-4 max-w-md",children:a("landing.footer.description")}),e.jsx("div",{className:"text-sm text-gray-500",children:a("landing.footer.copyright")})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.product")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx(y,{to:"/dashboard",className:"hover:text-white transition-colors",children:a("landing.footer.workspace")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.sourceCode")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.releases")})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.support")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.documentation")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/issues",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.issues")})}),e.jsx("li",{children:e.jsx("button",{onClick:()=>n(!0),className:"hover:text-white transition-colors text-left w-full",children:a("landing.footer.wechat")||"微信群"})})]})]})]})})}),j&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 relative",children:[e.jsx("button",{onClick:()=>n(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors",children:e.jsx(s,{className:"w-5 h-5"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:a("landing.wechat.title")||"加入微信群"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/wechat-qr-code.png",alt:"WeChat QR Code",className:"w-64 h-64 object-contain border border-gray-200 dark:border-gray-700 rounded-lg"})}),e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:e.jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 text-center",children:[a("landing.wechat.fallback")||"二维码失效?请添加微信号:",e.jsx("span",{className:"font-mono font-semibold ml-1",children:a("landing.wechat.wechatId")||"your-wechat-id"})]})}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center",children:a("landing.wechat.tip")||"扫码或添加微信号,即可加入交流群"})]})]})})]})};export{G as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as d}from"./monaco-editor-BWfQfpij.js";import{l as ne,m as le,n as ie,u as de,r as oe}from"./index-
|
|
1
|
+
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as d}from"./monaco-editor-BWfQfpij.js";import{l as ne,m as le,n as ie,u as de,r as oe}from"./index-BIGPvi1D.js";import{j as $,H as I,k as J,C as H,I as ce,$ as U,aw as F,r as B,ax as ue,n as xe,y as ge,v as me}from"./ui-components-D1pZO0y-.js";import{u as he}from"./tools-crrPnehB.js";import"./syntax-highlighting-DGbNjS3S.js";import"./agents-DR9EZMs5.js";const M=({error:s,title:m="Error occurred",showDetails:f=!0})=>{const[h,p]=d.useState(!1),[x,g]=d.useState(!1),a=(()=>{if(s instanceof Error){const r=s,n={stack:s.stack||"",name:s.name};return r.requestUrl&&(n.requestUrl=r.requestUrl),r.requestMethod&&(n.requestMethod=r.requestMethod),r.requestBody&&(n.requestBody=r.requestBody),r.statusCode&&(n.statusCode=r.statusCode),r.statusText&&(n.statusText=r.statusText),r.url&&(n.apiBaseUrl=r.url),r.timestamp&&(n.timestamp=new Date(r.timestamp).toISOString()),r.isNetworkError&&(n.isNetworkError=!0),r.isTimeout&&(n.isTimeout=!0),r.isAbortError&&(n.isAbortError=!0),r.originalError&&(n.originalError=r.originalError),r.type&&(n.errorType=r.type),{message:s.message,details:JSON.stringify(n,null,2),raw:s}}else if(typeof s=="object"&&s!==null){const r=s,n={};return Object.keys(r).forEach(b=>{b!=="message"&&(n[b]=r[b])}),{message:r.message||JSON.stringify(s),details:Object.keys(n).length>0?JSON.stringify(n,null,2):r.stack||JSON.stringify(s,null,2),raw:s}}else return{message:String(s),details:"",raw:String(s)}})(),c=f&&(a.details||a.raw),w=async()=>{const r=a.details?`${m}: ${a.message}
|
|
2
2
|
|
|
3
3
|
Details:
|
|
4
4
|
${a.details}`:`${m}: ${a.message}`;try{await navigator.clipboard.writeText(r),g(!0),setTimeout(()=>g(!1),2e3)}catch(n){console.error("Failed to copy error details:",n)}};return e.jsx("div",{className:"p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx($,{className:"w-4 h-4 text-red-600 dark:text-red-400 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-medium",children:a.message}),typeof a.raw=="object"&&a.raw&&"requestUrl"in a.raw&&e.jsxs("div",{className:"mt-1 text-xs text-red-500 dark:text-red-400",children:["requestUrl"in a.raw&&a.raw.requestUrl&&e.jsxs("span",{children:["Request: ",("requestMethod"in a.raw?a.raw.requestMethod:"POST")||"POST"," ",a.raw.requestUrl]}),"statusCode"in a.raw&&a.raw.statusCode&&e.jsxs("span",{className:"ml-2",children:["Status: ",a.raw.statusCode]}),"isNetworkError"in a.raw&&a.raw.isNetworkError&&e.jsx("span",{className:"ml-2",children:"• Network Error"}),"isTimeout"in a.raw&&a.raw.isTimeout&&e.jsx("span",{className:"ml-2",children:"• Request Timeout"})]}),c&&e.jsx("button",{onClick:r=>{r.preventDefault(),r.stopPropagation(),p(!h)},className:"flex items-center space-x-1 mt-2 text-xs text-red-500 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors",type:"button",children:h?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-3 h-3"}),e.jsx("span",{children:"Hide Details"})]}):e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"w-3 h-3"}),e.jsx("span",{children:"Show Details"})]})}),e.jsx("div",{className:`overflow-hidden transition-all duration-200 ease-in-out ${h&&c?"max-h-96 opacity-100 mt-3":"max-h-0 opacity-0"}`,children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"p-2 bg-red-100 dark:bg-red-900/40 rounded border border-red-200 dark:border-red-700",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-red-700 dark:text-red-300",children:"Technical Details:"}),e.jsx("button",{onClick:r=>{r.preventDefault(),r.stopPropagation(),w()},className:"flex items-center space-x-1 px-2 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 transition-colors",title:"Copy error details",type:"button",children:x?e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-3 h-3"}),e.jsx("span",{children:"Copied!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-3 h-3"}),e.jsx("span",{children:"Copy"})]})})]}),e.jsx("pre",{className:"text-xs text-red-800 dark:text-red-200 whitespace-pre-wrap break-words overflow-x-auto font-mono max-h-40 overflow-y-auto",children:typeof a.details=="string"?a.details:JSON.stringify(a.details)})]}),e.jsxs("div",{className:"text-xs text-red-500 dark:text-red-400",children:["Time: ",new Date().toLocaleString()]}),e.jsxs("div",{className:"text-xs text-red-500 dark:text-red-400",children:["Browser: ",navigator.userAgent.split(" ")[0]," | URL: ",window.location.href]})]})})]})]})})};function ke(){const{t:s}=he("pages"),[m,f]=d.useState(""),{login:h,loginWithoutPassword:p,isLoading:x,error:g,checkPasswordRequired:E}=ne(),{services:a,currentService:c,switchService:w,addService:r,updateService:n,removeService:b}=le(),G=ie(),y=de(),[j,W]=d.useState(!1),[X,N]=d.useState(!1),[z,k]=d.useState(null),[o,u]=d.useState({name:"",url:""}),[T,A]=d.useState(null),[O,R]=d.useState({}),[K,v]=d.useState(!0),[D,S]=d.useState(!0),[Q,L]=d.useState(!1),C=G.state?.from?.pathname||"/";d.useEffect(()=>{let t=!0;return(async()=>{if(!c){v(!1);return}v(!0),L(!1);try{const i=await E();if(!t)return;i.success?(S(i.passwordRequired),!i.passwordRequired&&!Q&&(L(!0),await p()&&t&&(y(C,{replace:!0}),window.location.reload()))):S(!0)}catch(i){console.error("Failed to check password requirement:",i),t&&S(!0)}finally{t&&v(!1)}})(),()=>{t=!1}},[c?.id]);const V=async(t,l)=>{l&&A(l);try{const i=`${t}/api/health`,P=(await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(5e3)})).ok?"success":"error";return l&&R(ae=>({...ae,[l]:P})),P==="success"}catch{return l&&R(q=>({...q,[l]:"error"})),!1}finally{A(null)}},Y=t=>{w(t),window.location.reload()},Z=()=>{o.name.trim()&&o.url.trim()&&(r({name:o.name.trim(),url:o.url.trim()}),u({name:"",url:""}),N(!1))},_=t=>{o.name.trim()&&o.url.trim()&&(n(t,{name:o.name.trim(),url:o.url.trim()}),u({name:"",url:""}),k(null))},ee=t=>{b(t)},te=(t,l,i)=>{k(t),u({name:l,url:i})},se=async t=>{t.preventDefault(),await h(m)&&(y(C,{replace:!0}),window.location.reload())},re=()=>{oe(),window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800",children:e.jsx("div",{className:"max-w-md w-full mx-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-xl p-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-2",children:s("login.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("login.subtitle")}),c&&e.jsx("div",{className:"mt-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-center justify-center space-x-2 text-sm text-blue-700 dark:text-blue-300",children:[e.jsx(U,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium",children:c.name}),e.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"•"}),e.jsx("span",{className:"text-xs truncate max-w-40",children:c.url})]})})]}),K?e.jsx("div",{className:"space-y-6 text-center",children:e.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("login.checkingConnection","正在检查连接...")})]})}):!D&&x?e.jsx("div",{className:"space-y-6 text-center",children:e.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[e.jsx(F,{className:"w-6 h-6 text-green-500"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("login.autoLoggingIn","正在自动登录...")})]})}):D?e.jsxs("form",{onSubmit:se,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("login.passwordLabel")}),e.jsx("input",{id:"password",type:"password",value:m,onChange:t=>f(t.target.value),placeholder:s("login.passwordPlaceholder"),required:!0,autoFocus:!0,className:`w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as i}from"./monaco-editor-BWfQfpij.js";import{c as Te,s as N,a as d}from"./index-f67nhEoX.js";import{u as $e,b as _,c as A,A as c}from"./agents-KlPdWQ8K.js";import{u as Ee}from"./tools-BZTR2NP1.js";import{a7 as Pe,V as Fe,$ as ze,C as De,j as qe,a8 as ee,v as Le,a9 as Me,E as Ie,I as H,aa as Re,ab as Be,c as Oe,y as Qe,ac as Ue,a3 as te}from"./ui-components-DjgDPiqV.js";import"./syntax-highlighting-DGbNjS3S.js";async function _e(){const s=localStorage.getItem("authToken"),r=await fetch(`${c}/mcp-admin-management/status`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch status");return r.json()}async function He(){const s=localStorage.getItem("authToken"),r=await fetch(`${c}/mcp-admin-management/keys`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch keys");return r.json()}async function Ve(){const s=localStorage.getItem("authToken"),r=await fetch(`${c}/mcp-admin-management/tools`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch tools");return r.json()}async function Je(s){const r=localStorage.getItem("authToken"),l=await fetch(`${c}/mcp-admin-management/keys`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new Error("Failed to create key");return l.json()}async function Ge(s){const r=localStorage.getItem("authToken");if(!(await fetch(`${c}/mcp-admin-management/keys/${s}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}})).ok)throw new Error("Failed to revoke key")}async function We(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${c}/mcp-admin-management/keys/${s}`,{method:"PUT",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(r)})).ok)throw new Error("Failed to update key")}async function Xe(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${c}/mcp-admin-management/keys/${s}/toggle`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:r})})).ok)throw new Error("Failed to toggle key")}async function se(s){const r=localStorage.getItem("authToken"),l=await fetch(`${c}/mcp-admin-management/config-snippet?apiKey=${encodeURIComponent(s)}`,{headers:{Authorization:`Bearer ${r}`}});if(!l.ok)throw new Error("Failed to fetch config");return l.json()}const nt=()=>{const{t:s}=Ee("pages"),r=$e(),l=Te(),[S,C]=i.useState(!1),[ae,K]=i.useState(!1),[T,$]=i.useState(""),[u,V]=i.useState(null),[o,E]=i.useState(null),[y,J]=i.useState("cursor"),[P,re]=i.useState(new Set),[ne,F]=i.useState(!1),[z,G]=i.useState(null),[m,b]=i.useState(new Set),[h,D]=i.useState(!1),[ie,q]=i.useState(!1),[L,M]=i.useState(null),[W,X]=i.useState(""),[x,j]=i.useState(new Set),[p,I]=i.useState(!1),[le,Y]=i.useState(null),{data:w,isLoading:ce,refetch:de}=_({queryKey:["mcpAdminStatus"],queryFn:_e}),{data:oe,isLoading:me,refetch:xe}=_({queryKey:["mcpAdminKeys"],queryFn:He}),{data:ge,isLoading:he}=_({queryKey:["mcpAdminTools"],queryFn:Ve}),R=A({mutationFn:Je,onSuccess:async t=>{V(t.key),C(!1),$(""),b(new Set),D(!1),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]});try{const a=await se(t.key);E(a),K(!0)}catch{d(s("settings.mcpAdmin.errors.configFetch"))}},onError:t=>{d(s("settings.mcpAdmin.errors.createFailed"),t instanceof Error?t.message:void 0)}}),pe=A({mutationFn:Ge,onSuccess:()=>{N(s("settings.mcpAdmin.success.keyRevoked")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{d(s("settings.mcpAdmin.errors.revokeFailed"),t instanceof Error?t.message:void 0)}}),B=A({mutationFn:({keyId:t,data:a})=>We(t,a),onSuccess:()=>{N(s("settings.mcpAdmin.success.keyUpdated")),q(!1),M(null),r.invalidateQueries({queryKey:["mcpAdminKeys"]})},onError:t=>{d(s("settings.mcpAdmin.errors.updateFailed"),t instanceof Error?t.message:void 0)}}),ue=A({mutationFn:({keyId:t,enabled:a})=>Xe(t,a),onSuccess:(t,a)=>{N(a.enabled?s("settings.mcpAdmin.success.keyEnabled"):s("settings.mcpAdmin.success.keyDisabled")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{d(s("settings.mcpAdmin.errors.toggleFailed"),t instanceof Error?t.message:void 0)}}),ye=()=>{if(!T.trim()){d(s("settings.mcpAdmin.errors.descriptionRequired"));return}R.mutate({description:T.trim(),permissions:["admin:*"],allowedTools:h&&m.size>0?Array.from(m):void 0})},be=t=>{b(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},je=()=>{b(new Set(f.map(t=>t.name)))},fe=()=>{b(new Set)},ke=t=>{M(t),X(t.description),t.allowedTools&&t.allowedTools.length>0?(I(!0),j(new Set(t.allowedTools))):(I(!1),j(new Set)),q(!0)},ve=()=>{L&&B.mutate({keyId:L.id,data:{description:W.trim()||void 0,allowedTools:p&&x.size>0?Array.from(x):[]}})},we=t=>{j(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},Ne=t=>{ue.mutate({keyId:t.id,enabled:!t.enabled})},Ae=async t=>{await l({title:s("settings.mcpAdmin.confirmRevokeTitle","确认撤销"),message:s("settings.mcpAdmin.confirmRevoke"),confirmText:s("settings.mcpAdmin.revoke","撤销"),cancelText:s("settings.mcpAdmin.cancel"),variant:"danger"})&&pe.mutate(t)},O=async t=>{try{await navigator.clipboard.writeText(t),N(s("settings.mcpAdmin.success.copied"))}catch{d(s("settings.mcpAdmin.errors.copyFailed"))}},Se=t=>{re(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},Ce=async t=>{if(t.fullKey)try{const a=await se(t.fullKey);E(a),G(t.fullKey),K(!0)}catch{d(s("settings.mcpAdmin.errors.configFetch"))}},Z=oe?.keys||[],f=ge?.tools||[],Ke=(t,a="right")=>{const n=t.inputSchema?.properties||{},k=t.inputSchema?.required||[],g=Object.entries(n),v=a==="right"?"left-full ml-2":"right-full mr-2";return e.jsxs("div",{className:`absolute z-50 ${v} top-0 w-72 bg-gray-900 text-white rounded-lg shadow-xl p-3 text-sm`,children:[e.jsx("div",{className:"font-medium text-blue-300 mb-1",children:t.name}),e.jsx("p",{className:"text-gray-300 text-xs mb-2",children:t.description}),g.length>0&&e.jsxs("div",{className:"border-t border-gray-700 pt-2",children:[e.jsxs("div",{className:"text-xs text-gray-400 mb-1",children:[s("settings.mcpAdmin.toolParams"),":"]}),e.jsx("div",{className:"space-y-1",children:g.map(([Q,U])=>e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-mono text-green-400",children:Q}),k.includes(Q)&&e.jsx("span",{className:"text-red-400 ml-1",children:"*"}),e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",U.type,")"]}),U.description&&e.jsx("p",{className:"text-gray-400 ml-2 mt-0.5",children:U.description})]},Q))})]}),g.length===0&&e.jsx("div",{className:"text-xs text-gray-500 italic",children:s("settings.mcpAdmin.noParams")})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:s("settings.mcpAdmin.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.mcpAdmin.subtitle")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("button",{onClick:()=>F(!0),className:"flex items-center space-x-2 px-3 py-2 text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:[e.jsx(Pe,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.help.button")})]}),e.jsxs("button",{onClick:()=>{de(),xe()},className:"flex items-center space-x-2 px-3 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:[e.jsx(Fe,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.refresh")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(ze,{className:"w-6 h-6 text-blue-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.serverStatus")})]}),ce?e.jsxs("div",{className:"animate-pulse space-y-3",children:[e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/3"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/2"})]}):w?e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(De,{className:"w-5 h-5 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.status")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.status.active")})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.version")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:w.version})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.tools")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:w.toolCount})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.activeKeys")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:w.activeKeyCount})]})]}):e.jsxs("div",{className:"flex items-center space-x-2 text-red-500",children:[e.jsx(qe,{className:"w-5 h-5"}),e.jsx("span",{children:s("settings.mcpAdmin.status.unavailable")})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("settings.mcpAdmin.endpoint"),": ",e.jsxs("code",{className:"bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded text-sm",children:[c,"/mcp-admin"]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(ee,{className:"w-6 h-6 text-yellow-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.apiKeys")})]}),e.jsxs("button",{onClick:()=>C(!0),className:"flex items-center space-x-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[e.jsx(Le,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.createKey")})]})]}),me?e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(t=>e.jsx("div",{className:"h-16 bg-gray-200 dark:bg-gray-700 rounded"},t))}):Z.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(ee,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.noKeys")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:s("settings.mcpAdmin.noKeysHint")})]}):e.jsx("div",{className:"space-y-3",children:Z.map(t=>e.jsx("div",{className:`p-4 rounded-lg border ${t.isRevoked?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-60":t.enabled?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700":"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-70"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.description}),t.isRevoked&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300 rounded",children:s("settings.mcpAdmin.revoked")}),!t.isRevoked&&!t.enabled&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 rounded",children:s("settings.mcpAdmin.disabled")})]}),e.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[e.jsx("code",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:P.has(t.id)&&t.fullKey?t.fullKey:t.maskedKey}),!t.isRevoked&&t.fullKey&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Se(t.id),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:P.has(t.id)?s("settings.mcpAdmin.hideKey"):s("settings.mcpAdmin.showKey"),children:P.has(t.id)?e.jsx(Me,{className:"w-4 h-4"}):e.jsx(Ie,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>O(t.fullKey),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:s("settings.mcpAdmin.copyKey"),children:e.jsx(H,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{children:[s("settings.mcpAdmin.createdAt"),": ",new Date(t.createdAt).toLocaleDateString()]}),t.lastUsedAt&&e.jsxs("span",{children:[s("settings.mcpAdmin.lastUsed"),": ",new Date(t.lastUsedAt).toLocaleDateString()]}),t.allowedTools&&t.allowedTools.length>0?e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:["🔒 ",s("settings.mcpAdmin.limitedTools",{count:t.allowedTools.length})]}):e.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["✓ ",s("settings.mcpAdmin.allToolsAccess")]})]})]}),e.jsx("div",{className:"flex items-center space-x-2 ml-4",children:!t.isRevoked&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Ne(t),className:`p-2 rounded-lg transition-colors ${t.enabled?"text-green-600 hover:bg-green-50 dark:hover:bg-green-900/20":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:t.enabled?s("settings.mcpAdmin.disableKey"):s("settings.mcpAdmin.enableKey"),children:t.enabled?e.jsx(Re,{className:"w-4 h-4"}):e.jsx(Be,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>ke(t),className:"p-2 text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.editKey"),children:e.jsx(Oe,{className:"w-4 h-4"})}),t.fullKey&&e.jsx("button",{onClick:()=>Ce(t),className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.viewConfig"),children:s("settings.mcpAdmin.viewConfig")}),e.jsx("button",{onClick:()=>Ae(t.id),className:"p-2 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.revokeKey"),children:e.jsx(Qe,{className:"w-4 h-4"})})]})})]})},t.id))})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(Ue,{className:"w-6 h-6 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.availableTools")})]}),he?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4].map(t=>e.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded"},t))}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:f.map((t,a)=>{const n=a%2===1;return e.jsxs("div",{className:"relative flex items-start space-x-3 p-3 bg-gray-50 dark:bg-gray-900 rounded-lg cursor-help hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",onMouseEnter:()=>Y(t),onMouseLeave:()=>Y(null),children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-sm text-gray-900 dark:text-white",children:t.name}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t.description})]}),le?.name===t.name&&Ke(t,n?"left":"right")]},t.name)})})]}),S&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:s("settings.mcpAdmin.createKeyTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.keyDescription")}),e.jsx("input",{type:"text",value:T,onChange:t=>$(t.target.value),placeholder:s("settings.mcpAdmin.keyDescriptionPlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
|
|
1
|
+
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as i}from"./monaco-editor-BWfQfpij.js";import{c as Te,s as N,a as d}from"./index-BIGPvi1D.js";import{u as $e,b as _,c as A,A as c}from"./agents-DR9EZMs5.js";import{u as Ee}from"./tools-crrPnehB.js";import{a7 as Pe,V as Fe,$ as ze,C as De,j as qe,a8 as ee,v as Le,a9 as Me,E as Ie,I as H,aa as Re,ab as Be,c as Oe,y as Qe,ac as Ue,a3 as te}from"./ui-components-D1pZO0y-.js";import"./syntax-highlighting-DGbNjS3S.js";async function _e(){const s=localStorage.getItem("authToken"),r=await fetch(`${c}/mcp-admin-management/status`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch status");return r.json()}async function He(){const s=localStorage.getItem("authToken"),r=await fetch(`${c}/mcp-admin-management/keys`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch keys");return r.json()}async function Ve(){const s=localStorage.getItem("authToken"),r=await fetch(`${c}/mcp-admin-management/tools`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch tools");return r.json()}async function Je(s){const r=localStorage.getItem("authToken"),l=await fetch(`${c}/mcp-admin-management/keys`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new Error("Failed to create key");return l.json()}async function Ge(s){const r=localStorage.getItem("authToken");if(!(await fetch(`${c}/mcp-admin-management/keys/${s}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}})).ok)throw new Error("Failed to revoke key")}async function We(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${c}/mcp-admin-management/keys/${s}`,{method:"PUT",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(r)})).ok)throw new Error("Failed to update key")}async function Xe(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${c}/mcp-admin-management/keys/${s}/toggle`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:r})})).ok)throw new Error("Failed to toggle key")}async function se(s){const r=localStorage.getItem("authToken"),l=await fetch(`${c}/mcp-admin-management/config-snippet?apiKey=${encodeURIComponent(s)}`,{headers:{Authorization:`Bearer ${r}`}});if(!l.ok)throw new Error("Failed to fetch config");return l.json()}const nt=()=>{const{t:s}=Ee("pages"),r=$e(),l=Te(),[S,C]=i.useState(!1),[ae,K]=i.useState(!1),[T,$]=i.useState(""),[u,V]=i.useState(null),[o,E]=i.useState(null),[y,J]=i.useState("cursor"),[P,re]=i.useState(new Set),[ne,F]=i.useState(!1),[z,G]=i.useState(null),[m,b]=i.useState(new Set),[h,D]=i.useState(!1),[ie,q]=i.useState(!1),[L,M]=i.useState(null),[W,X]=i.useState(""),[x,j]=i.useState(new Set),[p,I]=i.useState(!1),[le,Y]=i.useState(null),{data:w,isLoading:ce,refetch:de}=_({queryKey:["mcpAdminStatus"],queryFn:_e}),{data:oe,isLoading:me,refetch:xe}=_({queryKey:["mcpAdminKeys"],queryFn:He}),{data:ge,isLoading:he}=_({queryKey:["mcpAdminTools"],queryFn:Ve}),R=A({mutationFn:Je,onSuccess:async t=>{V(t.key),C(!1),$(""),b(new Set),D(!1),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]});try{const a=await se(t.key);E(a),K(!0)}catch{d(s("settings.mcpAdmin.errors.configFetch"))}},onError:t=>{d(s("settings.mcpAdmin.errors.createFailed"),t instanceof Error?t.message:void 0)}}),pe=A({mutationFn:Ge,onSuccess:()=>{N(s("settings.mcpAdmin.success.keyRevoked")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{d(s("settings.mcpAdmin.errors.revokeFailed"),t instanceof Error?t.message:void 0)}}),B=A({mutationFn:({keyId:t,data:a})=>We(t,a),onSuccess:()=>{N(s("settings.mcpAdmin.success.keyUpdated")),q(!1),M(null),r.invalidateQueries({queryKey:["mcpAdminKeys"]})},onError:t=>{d(s("settings.mcpAdmin.errors.updateFailed"),t instanceof Error?t.message:void 0)}}),ue=A({mutationFn:({keyId:t,enabled:a})=>Xe(t,a),onSuccess:(t,a)=>{N(a.enabled?s("settings.mcpAdmin.success.keyEnabled"):s("settings.mcpAdmin.success.keyDisabled")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{d(s("settings.mcpAdmin.errors.toggleFailed"),t instanceof Error?t.message:void 0)}}),ye=()=>{if(!T.trim()){d(s("settings.mcpAdmin.errors.descriptionRequired"));return}R.mutate({description:T.trim(),permissions:["admin:*"],allowedTools:h&&m.size>0?Array.from(m):void 0})},be=t=>{b(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},je=()=>{b(new Set(f.map(t=>t.name)))},fe=()=>{b(new Set)},ke=t=>{M(t),X(t.description),t.allowedTools&&t.allowedTools.length>0?(I(!0),j(new Set(t.allowedTools))):(I(!1),j(new Set)),q(!0)},ve=()=>{L&&B.mutate({keyId:L.id,data:{description:W.trim()||void 0,allowedTools:p&&x.size>0?Array.from(x):[]}})},we=t=>{j(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},Ne=t=>{ue.mutate({keyId:t.id,enabled:!t.enabled})},Ae=async t=>{await l({title:s("settings.mcpAdmin.confirmRevokeTitle","确认撤销"),message:s("settings.mcpAdmin.confirmRevoke"),confirmText:s("settings.mcpAdmin.revoke","撤销"),cancelText:s("settings.mcpAdmin.cancel"),variant:"danger"})&&pe.mutate(t)},O=async t=>{try{await navigator.clipboard.writeText(t),N(s("settings.mcpAdmin.success.copied"))}catch{d(s("settings.mcpAdmin.errors.copyFailed"))}},Se=t=>{re(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},Ce=async t=>{if(t.fullKey)try{const a=await se(t.fullKey);E(a),G(t.fullKey),K(!0)}catch{d(s("settings.mcpAdmin.errors.configFetch"))}},Z=oe?.keys||[],f=ge?.tools||[],Ke=(t,a="right")=>{const n=t.inputSchema?.properties||{},k=t.inputSchema?.required||[],g=Object.entries(n),v=a==="right"?"left-full ml-2":"right-full mr-2";return e.jsxs("div",{className:`absolute z-50 ${v} top-0 w-72 bg-gray-900 text-white rounded-lg shadow-xl p-3 text-sm`,children:[e.jsx("div",{className:"font-medium text-blue-300 mb-1",children:t.name}),e.jsx("p",{className:"text-gray-300 text-xs mb-2",children:t.description}),g.length>0&&e.jsxs("div",{className:"border-t border-gray-700 pt-2",children:[e.jsxs("div",{className:"text-xs text-gray-400 mb-1",children:[s("settings.mcpAdmin.toolParams"),":"]}),e.jsx("div",{className:"space-y-1",children:g.map(([Q,U])=>e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-mono text-green-400",children:Q}),k.includes(Q)&&e.jsx("span",{className:"text-red-400 ml-1",children:"*"}),e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",U.type,")"]}),U.description&&e.jsx("p",{className:"text-gray-400 ml-2 mt-0.5",children:U.description})]},Q))})]}),g.length===0&&e.jsx("div",{className:"text-xs text-gray-500 italic",children:s("settings.mcpAdmin.noParams")})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:s("settings.mcpAdmin.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.mcpAdmin.subtitle")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("button",{onClick:()=>F(!0),className:"flex items-center space-x-2 px-3 py-2 text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:[e.jsx(Pe,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.help.button")})]}),e.jsxs("button",{onClick:()=>{de(),xe()},className:"flex items-center space-x-2 px-3 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:[e.jsx(Fe,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.refresh")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(ze,{className:"w-6 h-6 text-blue-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.serverStatus")})]}),ce?e.jsxs("div",{className:"animate-pulse space-y-3",children:[e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/3"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/2"})]}):w?e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(De,{className:"w-5 h-5 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.status")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.status.active")})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.version")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:w.version})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.tools")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:w.toolCount})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.activeKeys")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:w.activeKeyCount})]})]}):e.jsxs("div",{className:"flex items-center space-x-2 text-red-500",children:[e.jsx(qe,{className:"w-5 h-5"}),e.jsx("span",{children:s("settings.mcpAdmin.status.unavailable")})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("settings.mcpAdmin.endpoint"),": ",e.jsxs("code",{className:"bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded text-sm",children:[c,"/mcp-admin"]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(ee,{className:"w-6 h-6 text-yellow-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.apiKeys")})]}),e.jsxs("button",{onClick:()=>C(!0),className:"flex items-center space-x-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[e.jsx(Le,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.createKey")})]})]}),me?e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(t=>e.jsx("div",{className:"h-16 bg-gray-200 dark:bg-gray-700 rounded"},t))}):Z.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(ee,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.noKeys")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:s("settings.mcpAdmin.noKeysHint")})]}):e.jsx("div",{className:"space-y-3",children:Z.map(t=>e.jsx("div",{className:`p-4 rounded-lg border ${t.isRevoked?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-60":t.enabled?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700":"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-70"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.description}),t.isRevoked&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300 rounded",children:s("settings.mcpAdmin.revoked")}),!t.isRevoked&&!t.enabled&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 rounded",children:s("settings.mcpAdmin.disabled")})]}),e.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[e.jsx("code",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:P.has(t.id)&&t.fullKey?t.fullKey:t.maskedKey}),!t.isRevoked&&t.fullKey&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Se(t.id),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:P.has(t.id)?s("settings.mcpAdmin.hideKey"):s("settings.mcpAdmin.showKey"),children:P.has(t.id)?e.jsx(Me,{className:"w-4 h-4"}):e.jsx(Ie,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>O(t.fullKey),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:s("settings.mcpAdmin.copyKey"),children:e.jsx(H,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{children:[s("settings.mcpAdmin.createdAt"),": ",new Date(t.createdAt).toLocaleDateString()]}),t.lastUsedAt&&e.jsxs("span",{children:[s("settings.mcpAdmin.lastUsed"),": ",new Date(t.lastUsedAt).toLocaleDateString()]}),t.allowedTools&&t.allowedTools.length>0?e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:["🔒 ",s("settings.mcpAdmin.limitedTools",{count:t.allowedTools.length})]}):e.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["✓ ",s("settings.mcpAdmin.allToolsAccess")]})]})]}),e.jsx("div",{className:"flex items-center space-x-2 ml-4",children:!t.isRevoked&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Ne(t),className:`p-2 rounded-lg transition-colors ${t.enabled?"text-green-600 hover:bg-green-50 dark:hover:bg-green-900/20":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:t.enabled?s("settings.mcpAdmin.disableKey"):s("settings.mcpAdmin.enableKey"),children:t.enabled?e.jsx(Re,{className:"w-4 h-4"}):e.jsx(Be,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>ke(t),className:"p-2 text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.editKey"),children:e.jsx(Oe,{className:"w-4 h-4"})}),t.fullKey&&e.jsx("button",{onClick:()=>Ce(t),className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.viewConfig"),children:s("settings.mcpAdmin.viewConfig")}),e.jsx("button",{onClick:()=>Ae(t.id),className:"p-2 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.revokeKey"),children:e.jsx(Qe,{className:"w-4 h-4"})})]})})]})},t.id))})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(Ue,{className:"w-6 h-6 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.availableTools")})]}),he?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4].map(t=>e.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded"},t))}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:f.map((t,a)=>{const n=a%2===1;return e.jsxs("div",{className:"relative flex items-start space-x-3 p-3 bg-gray-50 dark:bg-gray-900 rounded-lg cursor-help hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",onMouseEnter:()=>Y(t),onMouseLeave:()=>Y(null),children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-sm text-gray-900 dark:text-white",children:t.name}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t.description})]}),le?.name===t.name&&Ke(t,n?"left":"right")]},t.name)})})]}),S&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:s("settings.mcpAdmin.createKeyTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.keyDescription")}),e.jsx("input",{type:"text",value:T,onChange:t=>$(t.target.value),placeholder:s("settings.mcpAdmin.keyDescriptionPlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
|
|
2
2
|
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
3
3
|
focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:t=>D(t.target.checked),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s("settings.mcpAdmin.limitTools")})]}),h&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("button",{onClick:je,className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.selectAll")}),e.jsx("span",{className:"text-gray-400",children:"|"}),e.jsx("button",{onClick:fe,className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.deselectAll")})]})]}),h&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-3 max-h-64 overflow-y-auto",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:f.map(t=>{const a=Object.entries(t.inputSchema?.properties||{}),n=a.length>0?`
|
|
4
4
|
${s("settings.mcpAdmin.toolParams")}: ${a.map(([g,v])=>`${g}(${v.type})`).join(", ")}`:"",k=`${t.description}${n}`;return e.jsxs("label",{title:k,className:`flex items-center space-x-2 p-2 rounded-lg cursor-pointer transition-colors ${m.has(t.name)?"bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800":"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750"}`,children:[e.jsx("input",{type:"checkbox",checked:m.has(t.name),onChange:()=>be(t.name),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"text-sm font-mono text-gray-900 dark:text-white truncate",children:t.name})})]},t.name)})}),m.size>0&&e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.selectedToolsCount",{count:m.size})})]}),!h&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(te,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.fullPermissions")})]})]})]}),e.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[e.jsx("button",{onClick:()=>{C(!1),$(""),b(new Set),D(!1)},className:"px-4 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:s("settings.mcpAdmin.cancel")}),e.jsx("button",{onClick:ye,disabled:R.isPending||h&&m.size===0,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50",children:R.isPending?s("settings.mcpAdmin.creating"):s("settings.mcpAdmin.create")})]})]})}),ae&&o&&(u||z)&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:s(u?"settings.mcpAdmin.keyCreated":"settings.mcpAdmin.configTitle")}),u&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:e.jsxs("p",{className:"text-sm text-yellow-700 dark:text-yellow-400",children:["⚠️ ",s("settings.mcpAdmin.saveKeyWarning")]})}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.yourApiKey")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("code",{className:"flex-1 p-3 bg-gray-100 dark:bg-gray-900 rounded-lg font-mono text-sm break-all",children:u||z}),e.jsx("button",{onClick:()=>O(u||z||""),className:"p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:e.jsx(H,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex space-x-2 mb-4",children:[e.jsx("button",{onClick:()=>J("cursor"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${y==="cursor"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:"Cursor"}),e.jsx("button",{onClick:()=>J("claude-desktop"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${y==="claude-desktop"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:"Claude Desktop"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[s("settings.mcpAdmin.configFile"),":",e.jsx("code",{className:"ml-2 text-xs text-gray-500",children:y==="cursor"?o.cursor.configPath:o.claudeDesktop.configPath})]}),e.jsxs("button",{onClick:()=>O(y==="cursor"?o.cursor.configString:o.claudeDesktop.configString),className:"flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700",children:[e.jsx(H,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.copyConfig")})]})]}),e.jsx("pre",{className:"p-4 bg-gray-900 text-gray-100 rounded-lg overflow-x-auto text-sm font-mono",children:y==="cursor"?o.cursor.configString:o.claudeDesktop.configString})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx("button",{onClick:()=>{K(!1),V(null),G(null),E(null)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg",children:s("settings.mcpAdmin.done")})})]})}),ie&&L&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:s("settings.mcpAdmin.editKeyTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.keyDescription")}),e.jsx("input",{type:"text",value:W,onChange:t=>X(t.target.value),placeholder:s("settings.mcpAdmin.keyDescriptionPlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as c,W as z}from"./monaco-editor-BWfQfpij.js";import{a as b,A as f}from"./agents-
|
|
1
|
+
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as c,W as z}from"./monaco-editor-BWfQfpij.js";import{a as b,A as f}from"./agents-DR9EZMs5.js";import{b as ue,c as be,d as W,s as X,a as w}from"./index-BIGPvi1D.js";import{T as fe,a as ye,b as G,c as F,d as je,e as E}from"./table-BgVewkB5.js";import{u as we}from"./tools-crrPnehB.js";import{S as Ne,L as v,v as ke,E as K,C as L,n as ve,z as Ce,D as Y,H as Z,k as ee,I as te,J as se,y as ae}from"./ui-components-D1pZO0y-.js";import"./syntax-highlighting-DGbNjS3S.js";const Oe=()=>{const{t:s}=we("pages"),{isMobile:l}=ue(),re=be(),[x,m]=c.useState([]),[le,I]=c.useState(!0),[y,ne]=c.useState(!1),[H,oe]=c.useState("claude-sdk"),[A,ie]=c.useState(""),[C,de]=c.useState(""),[ce,N]=c.useState(!1),[p,J]=c.useState(null),[o,k]=c.useState({name:"",type:"stdio",config:""}),[P,R]=c.useState(!1),[M,Q]=c.useState(!1),[j,U]=c.useState({}),me=async()=>{try{I(!0);const t=await b(`${f}/mcp`);if(t.ok){const r=await t.json();m(r.servers||[]),ne(r.readOnly||!1),oe(r.engine||"claude-sdk")}else console.error("Failed to load MCP configs:",t.status),m([])}catch(t){console.error("Failed to load MCP configs:",t),m([])}finally{I(!1)}};z.useEffect(()=>{me()},[]),z.useEffect(()=>{const t=setTimeout(()=>{de(A)},300);return()=>clearTimeout(t)},[A]);const $=async t=>{try{console.log("Validating MCP server:",t),m(a=>a.map(n=>n.name===t?{...n,status:"validating"}:n));const r=await b(`${f}/mcp/${t}/validate`,{method:"POST"});if(console.log("Validation response status:",r.status),r.ok){const a=await r.json();m(n=>n.map(i=>i.name===t?{...i,status:"active",tools:a.tools||[],error:void 0}:i))}else{const a=await r.json();let n=a.error||s("mcp.errors.validationFailed");a.details&&(n+=`
|
|
2
2
|
${a.details}`),m(i=>i.map(d=>d.name===t?{...d,status:"error",error:n,tools:void 0}:d))}}catch(r){console.error("MCP server validation failed:",r),m(a=>a.map(n=>n.name===t?{...n,status:"error",error:s("mcp.errors.networkError"),tools:void 0}:n))}},xe=async()=>{for(const t of x)await $(t.name)},O=x.filter(t=>{const r=C.toLowerCase(),a=t.name.toLowerCase().includes(r),n=t.command?.toLowerCase().includes(r)||!1,i=t.args?.join(" ").toLowerCase().includes(r)||!1,d=t.url?.toLowerCase().includes(r)||!1;return a||n||i||d}),D=t=>{J(t);const{name:r,status:a,error:n,tools:i,lastValidated:d,...h}=t;k({name:t.name,type:t.type,config:JSON.stringify(h,null,2)}),N(!0)},V=t=>{let r="";t.type==="stdio"?r=`${t.command} ${t.args?.join(" ")||""}`.trim():r=t.url||"",navigator.clipboard.writeText(r).then(()=>{X(s("mcp.commandCopied"))}).catch(()=>{w(s("mcp.errors.copyFailed"))})},_=async t=>{if(await re({title:s("mcp.deleteTitle","删除确认"),message:s("mcp.confirmDelete",{name:t}),confirmText:s("common.delete","删除"),cancelText:s("common.cancel","取消"),variant:"danger"}))try{const a=await b(`${f}/mcp/${t}`,{method:"DELETE"});if(a.ok)m(n=>n.filter(i=>i.name!==t));else{const n=await a.json();throw new Error(n.error||s("mcp.errors.deleteFailed"))}}catch(a){console.error("Delete config failed:",a),w(s("mcp.errors.deleteFailed"),a instanceof Error?a.message:s("errors:common.unknownError"))}},B=()=>{k({name:"",type:"stdio",config:""}),J(null)},pe=async()=>{try{Q(!0);const t=await b(`${f}/mcp/claude-code`);if(t.ok){const a=(await t.json()).servers||[];if(a.length===0){W(s("mcp.import.noConfigFound"));return}let n=0,i=0;for(const d of a){if(x.find(u=>u.name===d.name)){i++;continue}const g={...d},S=await b(`${f}/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(S.ok){const u=await S.json();m(T=>[u.server,...T]),n++}}n>0?X(s("mcp.import.success",{imported:n,skipped:i})):W(s("mcp.import.allExist"))}else{const r=await t.json();throw new Error(r.error||s("mcp.errors.importFailed"))}}catch(t){console.error("Failed to import from Claude Code:",t),w(s("mcp.errors.importFailed"),t instanceof Error?t.message:s("errors:common.unknownError"))}finally{Q(!1)}},q=(t,r)=>{if(!t.trim())return!1;try{const a=JSON.parse(t);if(r==="stdio"){if(!a.command||!Array.isArray(a.args))return!1}else if(r==="http"&&(!a.url||typeof a.url!="string"))return!1;return a.autoApprove&&!Array.isArray(a.autoApprove)?!1:(a.type&&console.warn("配置中不应该包含 type 字段,将被忽略"),a.source&&console.warn("配置中不应该包含 source 字段,将被忽略"),a.timeout&&console.warn("配置中不应该包含 timeout 字段,将被忽略(验证超时固定为60秒)"),!0)}catch{return!1}},ge=async t=>{if(t.preventDefault(),!o.name.trim()){w(s("mcp.form.nameRequired"));return}if(!q(o.config,o.type)){w(s("mcp.form.configInvalid",{fields:o.type==="stdio"?s("mcp.form.requiredFieldsStdio"):s("mcp.form.requiredFieldsHttp")}));return}R(!0);try{const r=JSON.parse(o.config),{type:a,source:n,...i}=r,d={type:o.type,source:"local",...i};let h;if(p)console.log("Updating existing MCP server:",p.name,"with config:",d),h=await b(`${f}/mcp/${p.name}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});else{const g={name:o.name,...d};h=await b(`${f}/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)})}if(h.ok){const g=await h.json();m(p?u=>u.map(T=>T.name===p.name?g.server:T):u=>[g.server,...u]),B(),N(!1);const S=g.server.name;await $(S)}else{const g=await h.json();throw new Error(g.error||s("mcp.errors.saveFailed"))}}catch(r){console.error("Failed to save MCP config:",r),w(s("mcp.errors.saveFailed"),r instanceof Error?r.message:s("errors:common.unknownError"))}finally{R(!1)}},he=()=>{N(!1),B()};return le?e.jsx("div",{className:`${l?"p-4":"p-8"} flex items-center justify-center min-h-[60vh]`,children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:s("mcp.loading")})]})}):e.jsxs("div",{className:`${l?"p-4":"p-8"}`,children:[e.jsxs("div",{className:`${l?"mb-6":"mb-8"}`,children:[e.jsx("div",{className:`flex items-center ${l?"mb-4":"justify-between mb-6"}`,children:e.jsxs("div",{children:[e.jsx("h1",{className:`${l?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:s("mcp.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${l?"mt-1":"mt-2"}`,children:s("mcp.subtitle")})]})}),e.jsx("div",{className:"mb-6 bg-white dark:bg-gray-800 rounded-lg shadow p-4 md:p-6 border border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-gray-900 dark:text-gray-100",children:x.length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.total")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-green-600 dark:text-green-400",children:x.filter(t=>t.status==="active").length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.active")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-red-600 dark:text-red-400",children:x.filter(t=>t.status==="error").length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.error")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-blue-600 dark:text-blue-400",children:x.filter(t=>t.status==="validating").length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.validating")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-purple-600 dark:text-purple-400",children:x.reduce((t,r)=>t+(r.tools?.length||0),0)}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.tools")})]})]})}),e.jsxs("div",{className:`${l?"space-y-3":"flex items-center space-x-4"}`,children:[e.jsxs("div",{className:`${l?"":"flex-1"} relative`,children:[e.jsx(Ne,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${l?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:s("mcp.searchPlaceholder"),value:A,onChange:t=>ie(t.target.value),className:`pl-10 pr-4 ${l?"py-2":"py-3"} w-full border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${l?"text-sm":""}`})]}),e.jsxs("div",{className:`${l?"flex space-x-2":"flex items-center space-x-3"}`,children:[e.jsxs("button",{onClick:xe,disabled:x.length===0,className:`${l?"flex-1 px-3 py-2 text-sm":"px-5 py-3"} bg-gray-600 text-white rounded-lg hover:bg-gray-700 hover:shadow-md active:scale-95 transition-all whitespace-nowrap font-medium flex items-center ${l?"justify-center":"space-x-2"} disabled:opacity-50 disabled:cursor-not-allowed`,title:s("mcp.validateAll"),children:[e.jsx(v,{className:`${l?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:s("mcp.validateAll")})]}),!y&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:pe,disabled:M,className:`${l?"flex-1 px-3 py-2 text-sm":"px-5 py-3"} bg-green-600 text-white rounded-lg hover:bg-green-700 hover:shadow-md active:scale-95 transition-all whitespace-nowrap font-medium flex items-center ${l?"justify-center":"space-x-2"} disabled:opacity-50 disabled:cursor-not-allowed`,children:[M&&e.jsx(v,{className:`${l?"w-4 h-4":"w-5 h-5"} animate-spin`}),e.jsx("span",{children:s(M?"mcp.import.importing":"mcp.import.button")})]}),e.jsxs("button",{onClick:()=>N(!0),className:`${l?"flex-1 px-3 py-2 text-sm":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 hover:shadow-md active:scale-95 transition-all whitespace-nowrap flex items-center ${l?"justify-center":"space-x-2"} font-medium`,children:[e.jsx(ke,{className:`${l?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:s("mcp.addServer")})]})]}),y&&e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg text-yellow-700 dark:text-yellow-400 text-sm",children:[e.jsx(K,{className:"w-4 h-4"}),e.jsxs("span",{children:["只读模式 (",H==="cursor-cli"?"Cursor":H,")"]})]})]})]})]}),O.length===0?e.jsxs("div",{className:`text-center ${l?"py-8":"py-16"} bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700`,children:[e.jsx("div",{className:`${l?"text-4xl":"text-6xl"} mb-4`,children:"🖥️"}),e.jsx("h3",{className:`${l?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:s(C?"mcp.noResults":"mcp.noServers")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${l?"mb-4":"mb-6"}`,children:s(C?"mcp.adjustSearch":"mcp.addFirstServer")}),!C&&!y&&e.jsx("button",{onClick:()=>N(!0),className:`${l?"px-4 py-2 text-sm":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:s("mcp.addServer")}),y&&e.jsx("p",{className:"text-sm text-yellow-600 dark:text-yellow-400",children:"配置来自 ~/.cursor/mcp.json(只读)"})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"md:hidden space-y-4",children:O.map((t,r)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow overflow-hidden",children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-start space-x-3 mb-3",children:[e.jsx("div",{className:"text-2xl",children:t.type==="http"?"🌐":"🖥️"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-base font-medium text-gray-900 dark:text-white truncate",children:t.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:t.type==="stdio"?`${t.command} ${t.args?.join(" ")||""}`.trim():t.url})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm mb-3",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 block mb-1",children:[s("mcp.table.type"),":"]}),e.jsx("span",{className:`inline-flex items-center px-2 py-1 text-xs font-medium rounded-full ${t.type==="http"?"bg-blue-100 text-blue-800":"bg-purple-100 text-purple-800"}`,children:t.type==="http"?"HTTP":"Stdio"})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 block mb-1",children:[s("mcp.table.status"),":"]}),t.status==="active"&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-green-100 text-green-800",children:[e.jsx(L,{className:"w-3 h-3 mr-1"}),s("mcp.status.active")]}),t.status==="error"&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-red-100 text-red-800",children:[e.jsx(ve,{className:"w-3 h-3 mr-1"}),s("mcp.status.error")]}),t.status==="validating"&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800",children:[e.jsx(v,{className:"w-3 h-3 mr-1 animate-spin"}),s("mcp.status.validating")]}),!t.status&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800",children:[e.jsx(Ce,{className:"w-3 h-3 mr-1"}),s("mcp.status.unvalidated")]})]})]}),t.status==="active"&&t.tools&&t.tools.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("button",{onClick:()=>U(a=>({...a,[t.name]:!a[t.name]})),className:"flex items-center space-x-2 text-sm text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors mb-2 w-full",children:[e.jsx(Y,{className:"w-4 h-4"}),e.jsxs("span",{className:"font-medium",children:[t.tools.length," ",s("mcp.table.tools")]}),j[t.name]?e.jsx(Z,{className:"w-4 h-4 ml-auto text-gray-400"}):e.jsx(ee,{className:"w-4 h-4 ml-auto text-gray-400"})]}),j[t.name]&&e.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-40 overflow-y-auto",children:t.tools.map((a,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-1 rounded text-xs font-mono border border-green-200 dark:border-green-800",title:a,children:a},n))}),!j[t.name]&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.tools.slice(0,3).map((a,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-0.5 rounded text-xs font-mono",title:a,children:a},n)),t.tools.length>3&&e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 text-xs text-gray-500 dark:text-gray-400",children:["+",t.tools.length-3]})]})]}),t.status==="error"&&t.error&&e.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 mb-3 p-2 bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words font-sans text-xs",children:t.error})})]}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:s("mcp.table.actions")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>$(t.name),disabled:t.status==="validating",className:"p-2 text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/50 rounded-md transition-colors disabled:opacity-50",title:s("mcp.actions.validate"),children:t.status==="validating"?e.jsx(v,{className:"w-4 h-4 animate-spin"}):e.jsx(L,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>V(t),className:"p-2 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-900/50 rounded-md transition-colors",title:s("mcp.actions.copyCommand"),children:e.jsx(te,{className:"w-4 h-4"})}),!y&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>D(t),className:"p-2 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/50 rounded-md transition-colors",title:s("mcp.actions.edit"),children:e.jsx(se,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>_(t.name),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-md transition-colors",title:s("mcp.actions.delete"),children:e.jsx(ae,{className:"w-4 h-4"})})]})]})]})})]},t.name+"-"+r))}),e.jsx("div",{className:"hidden md:block bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(fe,{children:[e.jsx(ye,{children:e.jsxs(G,{children:[e.jsx(F,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("mcp.table.server")}),e.jsx(F,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("mcp.table.type")}),e.jsx(F,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("mcp.table.tools")}),e.jsx(F,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("mcp.table.actions")})]})}),e.jsx(je,{children:O.map((t,r)=>e.jsxs(G,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(E,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:t.type==="http"?"🌐":"🖥️"}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:t.name})}),t.status==="error"&&t.error&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 mt-1 max-w-md",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words font-sans",children:t.error})})]})]})}),e.jsx(E,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`inline-flex items-center px-2 py-1 text-xs font-medium rounded-full ${t.type==="http"?"bg-blue-100 text-blue-800":"bg-purple-100 text-purple-800"}`,children:t.type==="http"?"HTTP":"Stdio"})}),e.jsx(E,{className:"px-6 py-4",children:t.status==="active"&&t.tools&&t.tools.length>0?e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>U(a=>({...a,[t.name]:!a[t.name]})),className:"flex items-center space-x-2 text-sm text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors mb-2 group",children:[e.jsx(Y,{className:"w-4 h-4"}),e.jsxs("span",{className:"font-medium",children:[t.tools.length," ",s("mcp.table.tools")]}),j[t.name]?e.jsx(Z,{className:"w-4 h-4 text-gray-400 group-hover:text-blue-600"}):e.jsx(ee,{className:"w-4 h-4 text-gray-400 group-hover:text-blue-600"})]}),j[t.name]&&e.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-48 overflow-y-auto pr-2",children:t.tools.map((a,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-1 rounded text-xs font-mono border border-green-200 dark:border-green-800 hover:bg-green-100 dark:hover:bg-green-900/50 transition-colors",title:a,children:a},n))}),!j[t.name]&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.tools.slice(0,5).map((a,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-0.5 rounded text-xs font-mono",title:a,children:a},n)),t.tools.length>5&&e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 text-xs text-gray-500 dark:text-gray-400",children:["+",t.tools.length-5]})]})]}):e.jsx("span",{className:"text-sm text-gray-400",children:t.status==="active"?s("mcp.table.noTools"):"-"})}),e.jsx(E,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx("button",{onClick:()=>$(t.name),disabled:t.status==="validating",className:"inline-flex items-center px-2 py-1 text-xs font-medium text-green-600 bg-green-50 dark:bg-green-900/50 rounded-md hover:bg-green-100 dark:hover:bg-green-900/70 transition-colors disabled:opacity-50",title:s("mcp.actions.validate"),children:t.status==="validating"?e.jsx(v,{className:"w-3 h-3 animate-spin"}):e.jsx(L,{className:"w-3 h-3"})}),e.jsx("button",{onClick:()=>V(t),className:"inline-flex items-center px-2 py-1 text-xs font-medium text-gray-600 bg-gray-50 dark:bg-gray-900/50 rounded-md hover:bg-gray-100 dark:hover:bg-gray-900/70 transition-colors",title:s("mcp.actions.copyCommand"),children:e.jsx(te,{className:"w-3 h-3"})}),t.source==="plugin"||y?e.jsxs("button",{onClick:()=>D(t),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:s("mcp.actions.view"),children:[e.jsx(K,{className:"w-3 h-3 mr-1"}),s("mcp.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>D(t),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:s("mcp.actions.edit"),children:[e.jsx(se,{className:"w-3 h-3 mr-1"}),s("mcp.actions.edit")]}),e.jsx("button",{onClick:()=>_(t.name),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:s("mcp.actions.delete"),children:e.jsx(ae,{className:"w-4 h-4"})})]})]})})]},t.name+"-"+r))})]})})]}),ce&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsx("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full ${l?"max-w-full":"max-w-2xl"} mx-4 max-h-[90vh] overflow-y-auto`,children:e.jsxs("div",{className:`${l?"p-4":"p-6"}`,children:[e.jsxs("div",{className:`flex items-center ${l?"flex-col space-y-3":"justify-between"} mb-4`,children:[e.jsx("h2",{className:`${l?"text-lg":"text-xl"} font-semibold text-gray-900 dark:text-white`,children:s(p?"mcp.modal.editTitle":"mcp.modal.addTitle")}),e.jsxs("div",{className:`flex ${l?"w-full space-x-2":"space-x-3"}`,children:[e.jsx("button",{type:"button",onClick:he,disabled:P,className:`${l?"flex-1 px-3 py-2 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50`,children:s("common:actions.cancel")}),e.jsx("button",{type:"submit",form:"mcp-config-form",disabled:P||!o.name.trim()||!q(o.config,o.type),className:`${l?"flex-1 px-3 py-2 text-sm":"px-4 py-2"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed`,children:s(P?"mcp.modal.saving":p?"mcp.modal.saveConfig":"mcp.modal.addConfig")})]})]}),e.jsx("form",{id:"mcp-config-form",onSubmit:ge,children:e.jsxs("div",{className:`${l?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("mcp.form.serverName")}),e.jsx("input",{type:"text",value:o.name,onChange:t=>k({...o,name:t.target.value}),placeholder:s("mcp.form.serverNamePlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${l?"text-sm":""}`,required:!0,disabled:!!p}),p&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:s("mcp.form.nameNotEditable")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("mcp.form.mcpType")}),e.jsxs("select",{value:o.type,onChange:t=>{const r=t.target.value;k({...o,type:r,config:r==="stdio"?`{
|
|
3
3
|
"command": "npx",
|
|
4
4
|
"args": [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as a}from"./monaco-editor-BWfQfpij.js";import{a as m,A as g}from"./agents-
|
|
1
|
+
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as a}from"./monaco-editor-BWfQfpij.js";import{a as m,A as g}from"./agents-DR9EZMs5.js";import{s as h,a as p}from"./index-BIGPvi1D.js";import{u as b}from"./tools-crrPnehB.js";import{J as f,d as j,a4 as u,a5 as k}from"./ui-components-D1pZO0y-.js";import"./syntax-highlighting-DGbNjS3S.js";const F=()=>{const{t:s}=b("pages"),[r,l]=a.useState(""),[o,i]=a.useState(!1),[n,d]=a.useState(!1);a.useEffect(()=>{c()},[]);const c=async()=>{d(!0);try{const t=await m(`${g}/settings/global-memory`);if(t.ok){const y=await t.text();l(y)}}catch(t){console.error("Failed to load global memory:",t)}finally{d(!1)}},x=async()=>{try{if((await m(`${g}/settings/global-memory`,{method:"POST",headers:{"Content-Type":"text/plain"},body:r})).ok)i(!1),h(s("settings.memorySettings.saveSuccess"));else throw new Error("Failed to save")}catch(t){console.error("Failed to save global memory:",t),p(s("settings.memorySettings.saveFailed"))}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:s("settings.memorySettings.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.memorySettings.description")})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("settings.memorySettings.fileSourceInfo")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"block font-medium text-gray-900 dark:text-white",children:s("settings.memorySettings.memoryContent")}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsxs("button",{onClick:()=>i(!o),className:"flex items-center space-x-1 px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[e.jsx(f,{className:"w-4 h-4"}),e.jsx("span",{children:s(o?"settings.memorySettings.cancelEdit":"settings.memorySettings.edit")})]}),e.jsxs("button",{onClick:c,disabled:n,className:"flex items-center space-x-1 px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700/50 disabled:opacity-50",children:[e.jsx(j,{className:"w-4 h-4"}),e.jsx("span",{children:s(n?"settings.memorySettings.refreshing":"settings.memorySettings.refresh")})]})]})]}),o?e.jsxs("div",{className:"space-y-3",children:[e.jsx("textarea",{value:r,onChange:t=>l(t.target.value),rows:20,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent font-mono text-sm",placeholder:s("settings.memorySettings.placeholder")}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx("button",{onClick:()=>i(!1),className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-300",children:s("settings.memorySettings.cancel")}),e.jsxs("button",{onClick:x,className:"flex items-center space-x-1 px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:[e.jsx(u,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.memorySettings.saveMemory")})]})]})]}):e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-gray-50 dark:bg-gray-700/50 min-h-[300px]",children:n?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:s("settings.memorySettings.loading")})}):r?e.jsx("pre",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap font-mono",children:r}):e.jsx("div",{className:"flex items-center justify-center h-64 text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"text-center",children:[e.jsx(k,{className:"w-12 h-12 mx-auto mb-3 text-gray-300 dark:text-gray-600"}),e.jsx("p",{children:s("settings.memorySettings.noMemory")}),e.jsx("p",{className:"text-xs mt-1",children:s("settings.memorySettings.clickEditToStart")})]})})}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 space-y-1",children:[e.jsxs("p",{children:["• ",s("settings.memorySettings.infoAutoLoad")]}),e.jsxs("p",{children:["• ",s("settings.memorySettings.infoSuggestions")]}),e.jsxs("p",{children:["• ",s("settings.memorySettings.infoFileLocation")]})]})]})]})})]})};export{F as MemorySettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-ChC1tqVg.js";import{b as d,a as x,A as n}from"./agents-
|
|
1
|
+
import{j as e}from"./data-structures-ChC1tqVg.js";import{b as d,a as x,A as n}from"./agents-DR9EZMs5.js";import{an as l,Z as c,A as m,ao as p,E as o,a5 as g}from"./ui-components-D1pZO0y-.js";import"./monaco-editor-BWfQfpij.js";import"./syntax-highlighting-DGbNjS3S.js";import"./tools-crrPnehB.js";const f=()=>{const{data:t,isLoading:i,error:r}=d({queryKey:["engines"],queryFn:async()=>{const s=await x(`${n}/agui/engines`);if(!s.ok)throw new Error("Failed to fetch engines");return s.json()},refetchInterval:1e4});return i?e.jsx("div",{className:"flex items-center justify-center h-screen",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Loading models..."})]})}):r?e.jsx("div",{className:"flex items-center justify-center h-screen",children:e.jsxs("div",{className:"text-center text-red-600 dark:text-red-400",children:[e.jsx("p",{className:"text-xl font-semibold mb-2",children:"Failed to load models"}),e.jsx("p",{className:"text-sm",children:r.message})]})}):t?e.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 p-6",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-2",children:"Available AI Models"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"All models supported by registered engines"})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"p-3 bg-blue-100 dark:bg-blue-900 rounded-lg",children:e.jsx(l,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Total Engines"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t.engines.length})]})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"p-3 bg-green-100 dark:bg-green-900 rounded-lg",children:e.jsx(c,{className:"w-6 h-6 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Default Engine"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white capitalize",children:t.defaultEngine})]})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"p-3 bg-purple-100 dark:bg-purple-900 rounded-lg",children:e.jsx(m,{className:"w-6 h-6 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Active Sessions"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t.totalActiveSessions})]})]})]})}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:t.engines.map(s=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(l,{className:"w-6 h-6 text-white"}),e.jsx("h2",{className:"text-xl font-bold text-white capitalize",children:s.type}),s.isDefault&&e.jsx("span",{className:"px-2 py-1 bg-white bg-opacity-20 rounded text-xs font-semibold text-white",children:"DEFAULT"})]}),e.jsxs("div",{className:"flex items-center space-x-2 text-white",children:[e.jsx(p,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:s.activeSessions})]})]})}),e.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:"Capabilities"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.capabilities.features.multiTurn&&e.jsx("span",{className:"px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 text-xs rounded-full",children:"Multi-turn"}),s.capabilities.features.thinking&&e.jsx("span",{className:"px-2 py-1 bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300 text-xs rounded-full",children:"Thinking"}),s.capabilities.features.vision&&e.jsx("span",{className:"px-2 py-1 bg-green-100 dark:bg-green-900 text-green-700 dark:text-green-300 text-xs rounded-full",children:"Vision"}),s.capabilities.features.streaming&&e.jsx("span",{className:"px-2 py-1 bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 text-xs rounded-full",children:"Streaming"}),s.capabilities.features.subagents&&e.jsx("span",{className:"px-2 py-1 bg-pink-100 dark:bg-pink-900 text-pink-700 dark:text-pink-300 text-xs rounded-full",children:"Subagents"}),s.capabilities.mcp.supported&&e.jsx("span",{className:"px-2 py-1 bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-300 text-xs rounded-full",children:"MCP"})]})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-3",children:["Models (",s.models.length,")"]}),e.jsx("div",{className:"space-y-2",children:s.models.map(a=>e.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[a.isVision&&e.jsx(o,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),a.isThinking&&e.jsx(g,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:a.name})]}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 font-mono",children:a.id}),a.description&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mt-1",children:a.description})]})})},a.id))})]})]},s.type))})]})}):null};export{f as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-ChC1tqVg.js";import{r as d,W as Q}from"./monaco-editor-BWfQfpij.js";import{u as X,b as I,c as $,a as C,A as S}from"./agents-DR9EZMs5.js";import{a as F,s as L,d as J,b as V,c as Y}from"./index-BIGPvi1D.js";import{u as T}from"./tools-crrPnehB.js";import{c as ge,B as v}from"./Button-D5qiS7CR.js";import{aW as pe,e as A,aP as _,a0 as O,V as ee,S as se,v as Z,y as ae,X as he,E as te,d as ye,$ as be,al as fe,Z as je,t as ke,o as ve,Y as we,C as Ne,az as Ce}from"./ui-components-D1pZO0y-.js";import{F as Se}from"./FileExplorer-BprfeAH_.js";import"./syntax-highlighting-DGbNjS3S.js";const re=d.createContext(void 0),le=()=>{const a=d.useContext(re);if(!a)throw new Error("Tabs compound components must be used within Tabs");return a},ne=d.forwardRef(({value:a,onValueChange:t,defaultValue:l,className:i,children:n},s)=>{const[g,x]=d.useState(a||l||"");d.useEffect(()=>{a!==void 0&&x(a)},[a]);const f=d.useCallback(r=>{x(r),t?.(r)},[t]);return e.jsx(re.Provider,{value:{value:g,onValueChange:f},children:e.jsx("div",{ref:s,className:i,children:n})})});ne.displayName="Tabs";const ie=d.forwardRef(({className:a,children:t,...l},i)=>e.jsx("div",{ref:i,className:`inline-flex h-10 items-center justify-center rounded-md bg-gray-100 dark:bg-gray-800 p-1 text-gray-500 dark:text-gray-400 ${a||""}`,...l,children:t}));ie.displayName="TabsList";const U=d.forwardRef(({className:a,value:t,children:l,...i},n)=>{const{value:s,onValueChange:g}=le(),x=s===t;return e.jsx("button",{ref:n,type:"button",role:"tab","aria-selected":x,onClick:()=>g?.(t),className:`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${x?"bg-white dark:bg-gray-950 text-gray-950 dark:text-gray-50 shadow-sm":"hover:bg-gray-200/50 dark:hover:bg-gray-700/50"} ${a||""}`,...i,children:l})});U.displayName="TabsTrigger";const K=d.forwardRef(({className:a,value:t,children:l,...i},n)=>{const{value:s}=le();return s!==t?null:e.jsx("div",{ref:n,role:"tabpanel",className:`mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 ${a||""}`,...i,children:l})});K.displayName="TabsContent";const Pe=()=>{const a=X(),{t}=T("pages"),{data:l=[],isLoading:i,error:n,refetch:s}=I({queryKey:["plugin-marketplaces"],queryFn:async()=>{const r=await C(`${S}/plugins/marketplaces`);if(!r.ok)throw new Error("Failed to fetch marketplaces");return(await r.json()).marketplaces}}),g=$({mutationFn:async r=>{const u=await C(`${S}/plugins/marketplaces`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!u.ok){const m=await u.json();throw new Error(m.error||"Failed to add marketplace")}return u.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["plugin-marketplaces"]}),a.invalidateQueries({queryKey:["plugins-available"]}),L(t("plugins.messages.marketplaceAddSuccess"))},onError:r=>{F(t("plugins.messages.marketplaceAddError"),r.message)}}),x=$({mutationFn:async r=>{const u=await C(`${S}/plugins/marketplaces/${r}/sync`,{method:"POST"});if(!u.ok){const m=await u.json();throw new Error(m.error||"Failed to sync marketplace")}return u.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["plugin-marketplaces"]}),a.invalidateQueries({queryKey:["plugins-available"]}),L(t("plugins.messages.marketplaceSyncSuccess"))},onError:r=>{F(t("plugins.messages.marketplaceSyncError"),r.message)}}),f=$({mutationFn:async r=>{const u=await C(`${S}/plugins/marketplaces/${r}`,{method:"DELETE"});if(!u.ok){const m=await u.json();throw new Error(m.error||"Failed to remove marketplace")}return u.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["plugin-marketplaces"]}),a.invalidateQueries({queryKey:["plugins-available"]}),a.invalidateQueries({queryKey:["plugins-installed"]}),L(t("plugins.messages.marketplaceRemoveSuccess"))},onError:r=>{F(t("plugins.messages.marketplaceRemoveError"),r.message)}});return{marketplaces:l,isLoading:i,error:n,refetch:s,addMarketplace:g.mutate,isAddingMarketplace:g.isPending,syncMarketplace:x.mutate,isSyncingMarketplace:x.isPending,removeMarketplace:f.mutate,isRemovingMarketplace:f.isPending}},Ee=()=>{const a=X(),{t}=T("pages"),{data:l=[],isLoading:i,error:n,refetch:s}=I({queryKey:["plugins-available"],queryFn:async()=>{const p=await C(`${S}/plugins/available`);if(!p.ok)throw new Error("Failed to fetch available plugins");return(await p.json()).plugins}}),{data:g=[],isLoading:x,error:f,refetch:r}=I({queryKey:["plugins-installed"],queryFn:async()=>{const p=await C(`${S}/plugins/installed`);if(!p.ok)throw new Error("Failed to fetch installed plugins");return(await p.json()).plugins}}),u=$({mutationFn:async p=>{const j=await C(`${S}/plugins/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!j.ok){const b=await j.json();throw new Error(b.error||"Failed to install plugin")}return j.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["plugins-available"]}),a.invalidateQueries({queryKey:["plugins-installed"]}),J(t("plugins.messages.installSuccess"))},onError:p=>{F(t("plugins.messages.installError"),p.message)}}),m=$({mutationFn:async({marketplaceName:p,pluginName:j})=>{const b=await C(`${S}/plugins/${p}/${j}/enable`,{method:"POST"});if(!b.ok){const N=await b.json();throw new Error(N.error||"Failed to enable plugin")}return b.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["plugins-available"]}),a.invalidateQueries({queryKey:["plugins-installed"]}),J(t("plugins.messages.enableSuccess"))},onError:p=>{F(t("plugins.messages.enableError"),p.message)}}),y=$({mutationFn:async({marketplaceName:p,pluginName:j})=>{const b=await C(`${S}/plugins/${p}/${j}/disable`,{method:"POST"});if(!b.ok){const N=await b.json();throw new Error(N.error||"Failed to disable plugin")}return b.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["plugins-available"]}),a.invalidateQueries({queryKey:["plugins-installed"]}),L(t("plugins.messages.disableSuccess"))},onError:p=>{F(t("plugins.messages.disableError"),p.message)}}),w=$({mutationFn:async({marketplaceName:p,pluginName:j})=>{const b=await C(`${S}/plugins/${p}/${j}`,{method:"DELETE"});if(!b.ok){const N=await b.json();throw new Error(N.error||"Failed to uninstall plugin")}return b.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["plugins-available"]}),a.invalidateQueries({queryKey:["plugins-installed"]}),L(t("plugins.messages.uninstallSuccess"))},onError:p=>{F(t("plugins.messages.uninstallError"),p.message)}});return{availablePlugins:l,isLoadingAvailable:i,availableError:n,refetchAvailable:s,installedPlugins:g,isLoadingInstalled:x,installedError:f,refetchInstalled:r,installPlugin:u.mutate,isInstallingPlugin:u.isPending,enablePlugin:m.mutate,isEnablingPlugin:m.isPending,disablePlugin:y.mutate,isDisablingPlugin:y.isPending,uninstallPlugin:w.mutate,isUninstallingPlugin:w.isPending}},Me=(a,t)=>I({queryKey:["plugin-detail",a,t],queryFn:async()=>{if(!a||!t)return null;const l=await C(`${S}/plugins/${a}/${t}`);if(!l.ok)throw new Error("Failed to fetch plugin details");return await l.json()},enabled:!!a&&!!t}),$e=(a,t,l)=>I({queryKey:["plugin-file-content",a,t,l],queryFn:async()=>{if(!a||!t||!l)return null;const i=await C(`${S}/plugins/${a}/${t}/files/${l}`);if(!i.ok)throw new Error("Failed to fetch file content");return await i.json()},enabled:!!a&&!!t&&!!l}),M=Q.forwardRef(({className:a,type:t,...l},i)=>e.jsx("input",{type:t,className:ge("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a),ref:i,...l}));M.displayName="Input";const E=d.forwardRef(({className:a,...t},l)=>e.jsx("label",{ref:l,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 ${a||""}`,...t}));E.displayName="Label";const ce=d.forwardRef(({className:a,checked:t,onCheckedChange:l,disabled:i,...n},s)=>{const g=x=>{l?.(x.target.checked)};return e.jsxs("label",{className:`relative inline-flex items-center cursor-pointer ${i?"cursor-not-allowed opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",ref:s,checked:t,onChange:g,disabled:i,className:"sr-only peer",...n}),e.jsx("div",{className:`
|
|
2
|
+
w-11 h-6 bg-gray-200 dark:bg-gray-700
|
|
3
|
+
peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-blue-500 peer-focus:ring-offset-2
|
|
4
|
+
dark:peer-focus:ring-offset-gray-800
|
|
5
|
+
rounded-full peer
|
|
6
|
+
peer-checked:after:translate-x-full peer-checked:after:border-white
|
|
7
|
+
after:content-[''] after:absolute after:top-[2px] after:left-[2px]
|
|
8
|
+
after:bg-white after:border-gray-300 after:border after:rounded-full
|
|
9
|
+
after:h-5 after:w-5 after:transition-all
|
|
10
|
+
peer-checked:bg-blue-600 dark:peer-checked:bg-blue-500
|
|
11
|
+
${a||""}
|
|
12
|
+
`})]})});ce.displayName="Switch";const oe=({open:a,onOpenChange:t,children:l})=>(d.useEffect(()=>{const i=n=>{n.key==="Escape"&&a&&t&&t(!1)};return a&&(document.addEventListener("keydown",i),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}},[a,t]),a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50",onClick:()=>t&&t(!1)}),e.jsx("div",{className:"relative z-50 w-full flex items-center justify-center",children:l})]}):null),z=d.forwardRef(({className:a,children:t,...l},i)=>e.jsx("div",{ref:i,className:`relative bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 ${a||""}`,...l,children:t}));z.displayName="DialogContent";const de=({className:a,children:t,...l})=>e.jsx("div",{className:`mb-4 ${a||""}`,...l,children:t}),B=d.forwardRef(({className:a,children:t,...l},i)=>e.jsx("h2",{ref:i,className:`text-lg font-semibold text-gray-900 dark:text-white ${a||""}`,...l,children:t}));B.displayName="DialogTitle";const Fe=({className:a,children:t,...l})=>e.jsx("div",{className:`flex justify-end space-x-2 ${a||""}`,...l,children:t}),G=d.forwardRef(({children:a,value:t,onValueChange:l,...i},n)=>{const[s,g]=d.useState(!1),[x,f]=d.useState(t||"");d.useEffect(()=>{t!==void 0&&f(t)},[t]);const r=u=>{f(u),l&&l(u),g(!1)};return e.jsx("div",{ref:n,className:"relative",...i,children:d.Children.map(a,u=>d.isValidElement(u)?d.cloneElement(u,{selectedValue:x,isOpen:s,setIsOpen:g,onSelect:r}):u)})});G.displayName="Select";const W=d.forwardRef(({children:a,selectedValue:t,isOpen:l,setIsOpen:i,className:n,...s},g)=>e.jsxs("button",{ref:g,type:"button",onClick:()=>i&&i(!l),className:`flex h-10 w-full items-center justify-between rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 ${n||""}`,...s,children:[e.jsx("div",{className:"flex-1 text-left flex items-center",children:a}),e.jsx("svg",{className:"h-4 w-4 opacity-50 ml-2 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}));W.displayName="SelectTrigger";const ue=d.forwardRef(({placeholder:a,selectedValue:t,children:l},i)=>l?e.jsx("span",{ref:i,children:l}):e.jsx("span",{ref:i,children:t||a}));ue.displayName="SelectValue";const H=d.forwardRef(({children:a,isOpen:t,onSelect:l,...i},n)=>t?e.jsx("div",{ref:n,className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 shadow-lg",...i,children:d.Children.map(a,s=>d.isValidElement(s)?d.cloneElement(s,{onSelect:l}):s)}):null);H.displayName="SelectContent";const R=d.forwardRef(({value:a,children:t,onSelect:l,...i},n)=>e.jsx("div",{ref:n,onClick:()=>l&&l(a),className:"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-900 dark:text-gray-100",...i,children:t}));R.displayName="SelectItem";const q={github:{icon:O,label:"GitHub"},git:{icon:_,label:"Git Repository"},local:{icon:A,label:"Local Directory"},cos:{icon:pe,label:"COS (Tencent Cloud)"}},Te=({isOpen:a,onClose:t,onAdd:l,isAdding:i})=>{const{t:n}=T("pages"),[s,g]=d.useState({name:"",type:"github",source:"",description:"",branch:"main",autoUpdate:{enabled:!1,checkInterval:60}}),x=m=>{m.preventDefault();const y={name:s.name,type:s.type,source:s.source,description:s.description};(s.type==="git"||s.type==="github")&&(y.branch=s.branch),s.autoUpdate?.enabled&&(y.autoUpdate=s.autoUpdate),l(y),f()},f=()=>{g({name:"",type:"github",source:"",description:"",branch:"main",autoUpdate:{enabled:!1,checkInterval:60}}),t()},r=()=>{switch(s.type){case"local":return n("plugins.marketplaces.addModal.sourcePlaceholderLocal","/path/to/marketplace");case"github":return n("plugins.marketplaces.addModal.sourcePlaceholderGithub","owner/repo");case"git":return n("plugins.marketplaces.addModal.sourcePlaceholderGit","https://git.example.com/repo.git");case"cos":return"https://bucket.cos.region.myqcloud.com/prefix";default:return""}},u=q[s.type]?.icon||O;return e.jsx(oe,{open:a,onOpenChange:f,children:e.jsxs(z,{className:"max-w-[600px] w-full max-h-[90vh] overflow-y-auto",children:[e.jsx(de,{children:e.jsx(B,{children:n("plugins.marketplaces.addModal.title")})}),e.jsxs("form",{onSubmit:x,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(E,{htmlFor:"name",children:n("plugins.marketplaces.addModal.name")}),e.jsx(M,{id:"name",value:s.name,onChange:m=>g({...s,name:m.target.value}),placeholder:n("plugins.marketplaces.addModal.namePlaceholder"),required:!0})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"type",children:n("plugins.marketplaces.addModal.type")}),e.jsxs(G,{value:s.type,onValueChange:m=>g({...s,type:m}),children:[e.jsx(W,{children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(u,{className:"w-4 h-4"}),e.jsx("span",{children:q[s.type]?.label})]})}),e.jsx(H,{children:Object.keys(q).map(m=>{const y=q[m],w=y.icon;return e.jsx(R,{value:m,children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(w,{className:"w-4 h-4"}),e.jsx("span",{children:y.label})]})},m)})})]})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"source",children:n("plugins.marketplaces.addModal.source")}),e.jsx(M,{id:"source",value:s.source,onChange:m=>g({...s,source:m.target.value}),placeholder:r(),required:!0}),s.type==="cos"&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"COS URL 支持公开访问的存储桶地址,或包含 marketplace.tar.gz 的目录"})]}),(s.type==="git"||s.type==="github")&&e.jsxs("div",{children:[e.jsx(E,{htmlFor:"branch",children:n("plugins.marketplaces.addModal.branch")}),e.jsx(M,{id:"branch",value:s.branch,onChange:m=>g({...s,branch:m.target.value}),placeholder:n("plugins.marketplaces.addModal.branchPlaceholder","main")})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"description",children:n("plugins.marketplaces.addModal.description")}),e.jsx(M,{id:"description",value:s.description,onChange:m=>g({...s,description:m.target.value}),placeholder:n("plugins.marketplaces.addModal.descriptionPlaceholder")})]}),s.type!=="local"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ee,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(E,{htmlFor:"autoUpdate",className:"font-normal",children:"自动检查更新"})]}),e.jsx(ce,{id:"autoUpdate",checked:s.autoUpdate?.enabled||!1,onCheckedChange:m=>g({...s,autoUpdate:{...s.autoUpdate,enabled:m,checkInterval:s.autoUpdate?.checkInterval||60}})})]}),s.autoUpdate?.enabled&&e.jsxs("div",{children:[e.jsx(E,{htmlFor:"checkInterval",children:"检查间隔(分钟)"}),e.jsx(M,{id:"checkInterval",type:"number",min:"5",value:s.autoUpdate?.checkInterval||60,onChange:m=>g({...s,autoUpdate:{...s.autoUpdate,enabled:!0,checkInterval:parseInt(m.target.value)||60}})})]})]})]}),e.jsxs(Fe,{className:"mt-6",children:[e.jsx(v,{type:"button",variant:"outline",onClick:f,disabled:i,children:n("plugins.marketplaces.addModal.cancel")}),e.jsx(v,{type:"submit",disabled:i,children:n(i?"plugins.marketplaces.addModal.adding":"plugins.marketplaces.addModal.add")})]})]})]})})},Le=({marketplaces:a,isLoading:t,onAddMarketplace:l,isAdding:i,onSyncMarketplace:n,isSyncing:s,onRemoveMarketplace:g,isRemoving:x,onMarketplaceClick:f})=>{const{t:r}=T("pages"),{isMobile:u}=V(),m=Y(),[y,w]=d.useState(""),[p,j]=d.useState(!1),b=a.filter(h=>h.displayName.toLowerCase().includes(y.toLowerCase())||h.source.toLowerCase().includes(y.toLowerCase())),N=async(h,k)=>{await m({title:r("plugins.marketplaces.confirmDeleteTitle","确认删除"),message:r("plugins.marketplaces.confirmDelete",{name:k}),confirmText:r("plugins.marketplaces.delete","删除"),cancelText:r("plugins.marketplaces.cancel","取消"),variant:"danger"})&&g(h)};return t?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:"Loading..."})]})}):e.jsxs("div",{children:[e.jsxs("div",{className:`${u?"space-y-3":"flex items-center justify-between"} mb-6`,children:[e.jsxs("div",{className:`${u?"":"flex-1 max-w-md"} relative`,children:[e.jsx(se,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5"}),e.jsx(M,{type:"text",placeholder:r("plugins.marketplaces.searchPlaceholder"),value:y,onChange:h=>w(h.target.value),className:"pl-10"})]}),e.jsxs(v,{onClick:()=>j(!0),className:u?"w-full":"",children:[e.jsx(Z,{className:"w-4 h-4 mr-2"}),r("plugins.marketplaces.addButton")]})]}),b.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-6xl mb-4",children:"📦"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:r(y?"plugins.marketplaces.noResults":"plugins.marketplaces.noMarketplaces")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:r("plugins.marketplaces.addFirst")}),!y&&e.jsxs(v,{onClick:()=>j(!0),children:[e.jsx(Z,{className:"w-4 h-4 mr-2"}),r("plugins.marketplaces.addButton")]})]}):e.jsx("div",{className:"space-y-4",children:b.map(h=>e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6 hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 cursor-pointer",onClick:()=>f?.(h.id),children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white hover:text-blue-600 dark:hover:text-blue-400",children:h.displayName}),e.jsxs("span",{className:"px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300 flex items-center space-x-1",children:[h.type==="github"&&e.jsx(O,{className:"w-3 h-3"}),h.type==="git"&&e.jsx(_,{className:"w-3 h-3"}),h.type==="local"&&e.jsx(A,{className:"w-3 h-3"}),e.jsx("span",{children:r(`plugins.marketplaces.types.${h.type}`)})]})]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:h.source}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{children:[h.pluginCount," plugins"]}),h.lastSync&&e.jsxs("span",{children:["Last sync: ",new Date(h.lastSync).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2 ml-4",children:[e.jsx(v,{variant:"outline",size:"sm",onClick:()=>n(h.id),disabled:s,className:"border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",title:r("plugins.marketplaces.actions.sync"),children:e.jsx(ee,{className:`w-4 h-4 text-green-600 dark:text-green-400 ${s?"animate-spin":""}`})}),e.jsx(v,{variant:"outline",size:"sm",onClick:()=>N(h.id,h.displayName),disabled:x,className:"border-red-300 dark:border-red-700 hover:bg-red-50 dark:hover:bg-red-900/30",title:r("plugins.marketplaces.actions.delete"),children:e.jsx(ae,{className:"w-4 h-4 text-red-600 dark:text-red-400"})})]})]})},h.id))}),e.jsx(Te,{isOpen:p,onClose:()=>j(!1),onAdd:l,isAdding:i})]})},Ie=({isOpen:a,onClose:t,marketplaceName:l,pluginName:i})=>{const{t:n}=T("pages"),{data:s,isLoading:g}=Me(a?l:null,a?i:null),[x,f]=d.useState("overview");Q.useEffect(()=>{s&&console.log("Plugin Detail Data:",s)},[s]);const[r,u]=d.useState(null),[m,y]=d.useState(null),{data:w}=$e(r?l:null,r?i:null,r),p=o=>{u(o.relativePath),f("file")},j=o=>{const P=o.relativePath.includes("/")?o.relativePath.substring(0,o.relativePath.lastIndexOf("/")):"";y(P),f("directory")},b=()=>{f("overview"),u(null),y(null)},N=o=>{switch(o){case"command":return e.jsx(ve,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"});case"agent":return e.jsx(ke,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"});case"skill":return e.jsx(je,{className:"w-4 h-4 text-green-600 dark:text-green-400"});case"hook":return e.jsx(fe,{className:"w-4 h-4 text-orange-600 dark:text-orange-400"});case"mcp":return e.jsx(be,{className:"w-4 h-4 text-red-600 dark:text-red-400"});default:return e.jsx(ye,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}},h=o=>{const P=`plugins.detail.componentTypes.${o}`;return n(P,{defaultValue:o})};if(!a)return null;const k=[];return s?.components&&(s.components.commands?.forEach(o=>k.push({...o,typeLabel:"command"})),s.components.agents?.forEach(o=>k.push({...o,typeLabel:"agent"})),s.components.skills?.forEach(o=>k.push({...o,typeLabel:"skill"})),s.components.hooks?.forEach(o=>k.push({...o,typeLabel:"hook"})),s.components.mcpServers?.forEach(o=>k.push({...o,typeLabel:"mcp"}))),e.jsx(oe,{open:a,onOpenChange:t,children:e.jsxs(z,{className:"max-w-[1200px] w-full h-[90vh] overflow-hidden flex flex-col",children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(B,{children:[x==="overview"&&(s?.manifest?.name||i),x==="file"&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(v,{variant:"ghost",size:"sm",onClick:b,children:["← ",n("plugins.detail.back")]}),e.jsx("span",{className:"text-base",children:r})]}),x==="directory"&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(v,{variant:"ghost",size:"sm",onClick:b,children:["← ",n("plugins.detail.back")]}),e.jsx("span",{className:"text-base",children:m||n("plugins.detail.root")})]})]}),e.jsx(v,{variant:"ghost",size:"sm",onClick:t,children:e.jsx(he,{className:"w-4 h-4"})})]})}),g?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})}):s?e.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[x==="overview"&&e.jsxs("div",{className:"h-full overflow-y-auto p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:s?.manifest?.name||i}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s?.manifest?.description||s?.plugin?.manifest?.description||n("plugins.detail.noDescription")})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("plugins.detail.version")}),e.jsx("p",{className:"text-gray-900 dark:text-white",children:s?.manifest?.version||s?.plugin?.manifest?.version||"-"})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("plugins.detail.author")}),e.jsx("p",{className:"text-gray-900 dark:text-white",children:(()=>{const o=s?.manifest?.author||s?.plugin?.manifest?.author;return o?typeof o=="string"?o:o.name:"-"})()})]}),(s?.manifest?.license||s?.plugin?.manifest?.license)&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("plugins.detail.license")}),e.jsx("p",{className:"text-gray-900 dark:text-white",children:s?.manifest?.license||s?.plugin?.manifest?.license})]})]})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:[n("plugins.detail.components")," (",k.length,")"]}),k.length>0?e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("plugins.detail.type")}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("plugins.detail.name")}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("plugins.detail.description")}),e.jsx("th",{className:"px-4 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("plugins.detail.actions")})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700",children:k.map((o,P)=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800",children:[e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[N(o.type),e.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:h(o.type)})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"text-sm font-mono text-gray-900 dark:text-white",children:o.name})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:o.description||"-"})}),e.jsxs("td",{className:"px-4 py-3 text-right space-x-2",children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>p(o),title:n("plugins.detail.viewEntryFile"),className:"text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30",children:e.jsx(te,{className:"w-4 h-4"})}),o.type==="skill"&&e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>j(o),title:n("plugins.detail.browseDirectory"),className:"text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/30",children:e.jsx(A,{className:"w-4 h-4"})})]})]},P))})]})}):e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:n("plugins.detail.noComponents")})]})]}),x==="file"&&e.jsx("div",{className:"h-full overflow-y-auto p-6",children:w?e.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100 p-4 rounded-lg font-mono",children:w.content}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})}),x==="directory"&&s?.plugin?.installPath&&e.jsx(Se,{projectPath:m?`${s.plugin.installPath}/${m}`:s.plugin.installPath,onFileSelect:o=>{console.log("Selected file:",o)},className:"h-full"})]}):e.jsx("div",{className:"text-center py-12 text-gray-500",children:n("plugins.detail.loadFailed")})]})})},De=({plugins:a,isLoading:t,marketplaces:l,onInstallPlugin:i,isInstalling:n,onUninstallPlugin:s,isUninstalling:g,selectedMarketplace:x,onMarketplaceChange:f})=>{const{t:r}=T("pages"),{isMobile:u}=V(),m=Y(),[y,w]=d.useState(""),[p,j]=d.useState(null),[b,N]=d.useState(!1),h=a.filter(c=>{const D=c.name.toLowerCase().includes(y.toLowerCase())||c.description.toLowerCase().includes(y.toLowerCase()),me=!x||c.marketplaceId===x,xe=!b||c.installed;return D&&me&&xe}),k=Q.useMemo(()=>x?l.find(D=>D.id===x)?.displayName||x:r("plugins.browse.filters.allMarketplaces"),[x,l,r]),o=c=>{i({pluginName:c.name,marketplaceName:c.marketplaceName,marketplaceId:c.marketplaceId})},P=async c=>{await m({title:r("plugins.browse.confirmUninstallTitle","确认卸载"),message:r("plugins.browse.confirmUninstall",{name:c.name}),confirmText:r("plugins.browse.uninstall","卸载"),cancelText:r("plugins.browse.cancel","取消"),variant:"danger"})&&s({marketplaceName:c.marketplaceName,pluginName:c.name})};return t?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:"Loading..."})]})}):l.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-6xl mb-4",children:"📦"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:r("plugins.browse.noMarketplaces")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:r("plugins.browse.goAddMarketplace")})]}):e.jsxs("div",{children:[e.jsxs("div",{className:`${u?"space-y-3":"flex items-center gap-4"} mb-6`,children:[e.jsxs("div",{className:`${u?"":"flex-1 max-w-md"} relative`,children:[e.jsx(se,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5"}),e.jsx(M,{type:"text",placeholder:r("plugins.browse.searchPlaceholder"),value:y,onChange:c=>w(c.target.value),className:"pl-10"})]}),e.jsx("div",{className:`${u?"":"w-64"}`,children:e.jsxs(G,{value:x??"all",onValueChange:c=>f(c==="all"?null:c),children:[e.jsx(W,{className:"text-gray-900 dark:text-gray-100",children:e.jsx(ue,{children:k})}),e.jsxs(H,{children:[e.jsx(R,{value:"all",children:r("plugins.browse.filters.allMarketplaces")}),l.map(c=>e.jsx(R,{value:c.id,children:c.displayName},c.id))]})]})}),e.jsxs("div",{className:" flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"showOnlyInstalled",checked:b,onChange:c=>N(c.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),e.jsx("label",{htmlFor:"showOnlyInstalled",className:"text-sm font-medium text-gray-900 dark:text-gray-300 cursor-pointer whitespace-nowrap",children:r("plugins.browse.filters.showOnlyInstalled")})]})]}),h.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-6xl mb-4",children:"🔍"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:r("plugins.browse.noResults")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:r("plugins.browse.adjustSearch")})]}):e.jsx("div",{className:"space-y-4",children:h.map(c=>e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx(we,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c.name}),c.installed&&e.jsxs("span",{className:"px-2 py-1 text-xs font-medium rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300 flex items-center space-x-1",children:[e.jsx(Ne,{className:"w-3 h-3"}),e.jsx("span",{children:r("plugins.browse.card.installed")})]})]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:c.description}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{children:[r("plugins.browse.card.from")," ",c.marketplace]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:r("plugins.browse.card.version",{version:c.version})}),c.components.commands>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:r("plugins.browse.components.commands",{count:c.components.commands})})]}),c.components.skills>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:r("plugins.browse.components.skills",{count:c.components.skills})})]}),c.components.agents>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:r("plugins.browse.components.agents",{count:c.components.agents})})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2 ml-4",children:[e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>j({marketplace:c.marketplaceName,name:c.name}),className:"border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",children:[e.jsx(te,{className:"w-4 h-4 mr-1 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:r("plugins.browse.actions.details")})]}),c.installed?e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>P(c),disabled:g,className:"border-red-300 dark:border-red-700 hover:bg-red-50 dark:hover:bg-red-900/30",children:[e.jsx(ae,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"ml-1 text-red-600 dark:text-red-400",children:r("plugins.browse.actions.uninstall")})]}):e.jsxs(v,{variant:"outline",size:"sm",disabled:n,onClick:()=>o(c),className:"border-blue-300 dark:border-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/30",children:[e.jsx(Ce,{className:"w-4 h-4 mr-1 text-blue-600 dark:text-blue-400"}),e.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:r("plugins.browse.actions.install")})]})]})]})},`${c.name}@${c.marketplace}`))}),p&&e.jsx(Ie,{isOpen:!!p,onClose:()=>j(null),marketplaceName:p.marketplace,pluginName:p.name})]})},Be=()=>{const{t:a}=T("pages"),{isMobile:t}=V(),[l,i]=d.useState("marketplaces"),[n,s]=d.useState(null),g=P=>{s(P),i("browse")},{marketplaces:x,isLoading:f,addMarketplace:r,isAddingMarketplace:u,syncMarketplace:m,isSyncingMarketplace:y,removeMarketplace:w,isRemovingMarketplace:p}=Pe(),{availablePlugins:j,isLoadingAvailable:b,installPlugin:N,isInstallingPlugin:h,uninstallPlugin:k,isUninstallingPlugin:o}=Ee();return e.jsxs("div",{className:`${t?"p-4":"p-8"}`,children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:`${t?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:a("plugins.title")}),e.jsx("p",{className:"mt-2 text-gray-600 dark:text-gray-400",children:a("plugins.subtitle")})]}),e.jsxs(ne,{value:l,onValueChange:i,className:"w-full",children:[e.jsxs(ie,{className:`grid w-full ${t?"grid-cols-2":"grid-cols-2 max-w-xl"}`,children:[e.jsx(U,{value:"marketplaces",children:a("plugins.tabs.marketplaces")}),e.jsx(U,{value:"browse",children:a("plugins.tabs.browse")})]}),e.jsx(K,{value:"marketplaces",className:"mt-6",children:e.jsx(Le,{marketplaces:x,isLoading:f,onAddMarketplace:r,isAdding:u,onSyncMarketplace:m,isSyncing:y,onRemoveMarketplace:w,isRemoving:p,onMarketplaceClick:g})}),e.jsx(K,{value:"browse",className:"mt-6",children:e.jsx(De,{plugins:j,isLoading:b,marketplaces:x,onInstallPlugin:N,isInstalling:h,onUninstallPlugin:k,isUninstalling:o,selectedMarketplace:n,onMarketplaceChange:s})})]})]})};export{Be as PluginsPage,Be as default};
|