agentstudio 0.1.18 → 0.1.21
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/README.md +26 -505
- package/bin/agentstudio.js +305 -0
- package/bin/agentstudio.js.map +1 -0
- package/bin/serviceManager.d.ts +16 -0
- package/bin/serviceManager.d.ts.map +1 -0
- package/bin/serviceManager.js +434 -0
- package/bin/serviceManager.js.map +1 -0
- package/config/index.d.ts +74 -0
- package/config/index.d.ts.map +1 -0
- package/config/index.js +166 -0
- package/config/index.js.map +1 -0
- package/config/paths.d.ts +81 -0
- package/config/paths.d.ts.map +1 -0
- package/config/paths.js +98 -0
- package/config/paths.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -0
- package/index.js +369 -0
- package/index.js.map +1 -0
- package/jobs/taskTimeoutMonitor.d.ts +25 -0
- package/jobs/taskTimeoutMonitor.d.ts.map +1 -0
- package/jobs/taskTimeoutMonitor.js +94 -0
- package/jobs/taskTimeoutMonitor.js.map +1 -0
- package/middleware/a2aAuth.d.ts +38 -0
- package/middleware/a2aAuth.d.ts.map +1 -0
- package/middleware/a2aAuth.js +134 -0
- package/middleware/a2aAuth.js.map +1 -0
- package/{backend/dist/middleware → middleware}/auth.d.ts +3 -1
- package/middleware/auth.d.ts.map +1 -0
- package/middleware/auth.js +35 -0
- package/middleware/auth.js.map +1 -0
- package/middleware/httpsOnly.d.ts +38 -0
- package/middleware/httpsOnly.d.ts.map +1 -0
- package/middleware/httpsOnly.js +105 -0
- package/middleware/httpsOnly.js.map +1 -0
- package/middleware/rateLimiting.d.ts +37 -0
- package/middleware/rateLimiting.d.ts.map +1 -0
- package/middleware/rateLimiting.js +118 -0
- package/middleware/rateLimiting.js.map +1 -0
- package/package.json +43 -38
- package/public/assets/AgentsPage-Nvg2xu6K.js +10 -0
- package/public/assets/Button-Co56C389.js +1 -0
- package/public/assets/ChatPage-D6sol0ad.js +442 -0
- package/public/assets/CommandForm-Bk7F_HU8.js +7 -0
- package/public/assets/CommandsPage-DZHyOdKd.js +1 -0
- package/public/assets/DashboardPage-29qC7Ev1.js +15 -0
- package/public/assets/FileBrowser-BYweUPH4.js +6 -0
- package/public/assets/FileExplorer-DNYj6Tsx.js +1 -0
- package/public/assets/GeneralSettingsPage-D9Xa7Nd8.js +1 -0
- package/public/assets/LandingPage-CjnT-cvO.js +1 -0
- package/public/assets/LoginPage-DcaGNCXH.js +16 -0
- package/public/assets/McpAdminSettingsPage-DgR3E2Bd.js +7 -0
- package/public/assets/McpPage-CtWf1CoL.js +40 -0
- package/public/assets/MemorySettingsPage-JTry4Ccp.js +1 -0
- package/public/assets/PluginsPage-D-BHjQ3P.js +1 -0
- package/public/assets/ProjectSelector-DSXOjMQC.js +1 -0
- package/public/assets/ProjectsPage-lLUk4-Xa.js +21 -0
- package/public/assets/ScheduledTasksPage-5hPbd9Vs.js +1 -0
- package/public/assets/SettingsLayout-DGJspXLp.js +1 -0
- package/public/assets/SkillsPage-DBw0m7D2.js +18 -0
- package/{backend/dist/frontend/assets/SubagentForm-DXtTTIKg.js → public/assets/SubagentForm-BdUK1U4y.js} +2 -2
- package/public/assets/SubagentsPage-Dnq70IFd.js +1 -0
- package/{backend/dist/frontend/assets/ToastTestPage-DT4wuN5C.js → public/assets/ToastTestPage-BfJQRFIm.js} +1 -1
- package/public/assets/ToolsList-Dl5F2fWk.js +1 -0
- package/public/assets/UnifiedToolSelector-CNbPsiuq.js +1 -0
- package/public/assets/VersionSettingsPage-BfoCcham.js +5 -0
- package/public/assets/_basePickBy-7C_e0Xv1.js +1 -0
- package/public/assets/_baseUniq-eGJNLBzx.js +1 -0
- package/public/assets/agents-ChrA1R0y.js +1 -0
- package/public/assets/arc-CuA752eE.js +1 -0
- package/public/assets/architectureDiagram-VXUJARFQ-BnPYh1OW.js +36 -0
- package/public/assets/blockDiagram-VD42YOAC-72nsMt_i.js +122 -0
- package/public/assets/c4Diagram-YG6GDRKO-BNJSAXcg.js +10 -0
- package/public/assets/channel-CIunGC5m.js +1 -0
- package/public/assets/chunk-4BX2VUAB-RPxkCWhH.js +1 -0
- package/public/assets/chunk-55IACEB6-3ePDt0kp.js +1 -0
- package/public/assets/chunk-B4BG7PRW-CBg_BBfl.js +165 -0
- package/public/assets/chunk-DI55MBZ5-DIh69TUJ.js +220 -0
- package/public/assets/chunk-FMBD7UC4-BbjwhyTe.js +15 -0
- package/public/assets/chunk-QN33PNHL-BpH-o_YR.js +1 -0
- package/public/assets/chunk-QZHKN3VN-DYB7rh5Q.js +1 -0
- package/public/assets/chunk-TZMSLE5B-DPCYEVb3.js +1 -0
- package/public/assets/classDiagram-2ON5EDUG-aUQHFsTA.js +1 -0
- package/public/assets/classDiagram-v2-WZHVMYZB-aUQHFsTA.js +1 -0
- package/public/assets/clone-Ckf7tA1V.js +1 -0
- package/public/assets/cose-bilkent-S5V4N54A-CnpfmL-Y.js +1 -0
- package/public/assets/cytoscape.esm-DtBltrT8.js +331 -0
- package/public/assets/dagre-6UL2VRFP-DR9x77Xf.js +4 -0
- package/{backend/dist/frontend/assets/data-structures-DLJedtzx.js → public/assets/data-structures-C0h9Oap1.js} +1 -1
- package/public/assets/defaultLocale-C4B-KCzX.js +1 -0
- package/public/assets/diagram-PSM6KHXK-SONPsQNx.js +24 -0
- package/public/assets/diagram-QEK2KX5R-BKYFSfC1.js +43 -0
- package/public/assets/diagram-S2PKOQOG-CkM0APZj.js +24 -0
- package/public/assets/erDiagram-Q2GNP2WA-BX1DpOGx.js +60 -0
- package/public/assets/flowDiagram-NV44I4VS-HAAlzNbq.js +162 -0
- package/public/assets/ganttDiagram-LVOFAZNH-BqzWexqa.js +267 -0
- package/public/assets/gitGraphDiagram-NY62KEGX-CIPmSp43.js +65 -0
- package/public/assets/graph-m515btDj.js +1 -0
- package/public/assets/index-Bn3v3S9-.js +293 -0
- package/public/assets/index-DWieeYj4.css +1 -0
- package/public/assets/infoDiagram-F6ZHWCRC-Pn4yNWrF.js +2 -0
- package/public/assets/init-Gi6I4Gst.js +1 -0
- package/public/assets/journeyDiagram-XKPGCS4Q-BfzTomS0.js +139 -0
- package/public/assets/kanban-definition-3W4ZIXB7-Cgju7b-L.js +89 -0
- package/public/assets/katex-qrhCpa0F.js +261 -0
- package/public/assets/layout-BKQfQSxJ.js +1 -0
- package/public/assets/linear-DigtLz3B.js +1 -0
- package/public/assets/mindmap-definition-VGOIOE7T-qopraVFy.js +68 -0
- package/public/assets/monaco-editor-DHKm5-VF.js +19 -0
- package/public/assets/ordinal-Cboi1Yqb.js +1 -0
- package/public/assets/pieDiagram-ADFJNKIX-BcoaAI-L.js +30 -0
- package/public/assets/quadrantDiagram-AYHSOK5B-D-DwcoSd.js +7 -0
- package/public/assets/requirementDiagram-UZGBJVZJ-DbQCpx77.js +64 -0
- package/public/assets/sankeyDiagram-TZEHDZUN-BVk8387S.js +10 -0
- package/public/assets/sequenceDiagram-WL72ISMW-BdzICjxO.js +145 -0
- package/public/assets/stateDiagram-FKZM4ZOC-CYY-uUvJ.js +1 -0
- package/public/assets/stateDiagram-v2-4FDKWEC3-Dh2Kvomq.js +1 -0
- package/{backend/dist/frontend/assets/syntax-highlighting-YWvMU4Hm.js → public/assets/syntax-highlighting-CnREyncB.js} +5 -5
- package/public/assets/tabManager-B2LQO_Ll.js +30 -0
- package/{backend/dist/frontend/assets/table-D6q1rytw.js → public/assets/table-D0L2RL5i.js} +1 -1
- package/public/assets/timeline-definition-IT6M3QCI-BAvjPYvX.js +61 -0
- package/public/assets/tools-IcPNZlPj.js +1 -0
- package/public/assets/treemap-KMMF4GRG-DtkpVA56.js +128 -0
- package/{backend/dist/frontend/assets/ui-components-Cw21Epuw.js → public/assets/ui-components-D1St49qC.js} +231 -96
- package/public/assets/useAgents-BnDTkOG8.js +2 -0
- package/public/assets/useClaudeVersions-CD59tFWM.js +1 -0
- package/public/assets/useCommands-mvMu3mMD.js +1 -0
- package/public/assets/useProjects-YXOjaOwL.js +1 -0
- package/public/assets/xychartDiagram-PRI3JC2R-ByBTDWE2.js +7 -0
- package/{backend/dist/frontend → public}/index.html +8 -8
- package/routes/__tests__/a2a.integration.test.d.ts +11 -0
- package/routes/__tests__/a2a.integration.test.d.ts.map +1 -0
- package/routes/__tests__/a2a.integration.test.js +314 -0
- package/routes/__tests__/a2a.integration.test.js.map +1 -0
- package/routes/__tests__/a2a.test.d.ts +6 -0
- package/routes/__tests__/a2a.test.d.ts.map +1 -0
- package/routes/__tests__/a2a.test.js +622 -0
- package/routes/__tests__/a2a.test.js.map +1 -0
- package/routes/__tests__/agents.test.d.ts +6 -0
- package/routes/__tests__/agents.test.d.ts.map +1 -0
- package/routes/__tests__/agents.test.js +315 -0
- package/routes/__tests__/agents.test.js.map +1 -0
- package/routes/__tests__/sessions.test.d.ts +7 -0
- package/routes/__tests__/sessions.test.d.ts.map +1 -0
- package/routes/__tests__/sessions.test.js +330 -0
- package/routes/__tests__/sessions.test.js.map +1 -0
- package/routes/a2a.d.ts +18 -0
- package/routes/a2a.d.ts.map +1 -0
- package/routes/a2a.js +649 -0
- package/routes/a2a.js.map +1 -0
- package/routes/a2a.streaming.test.d.ts +2 -0
- package/routes/a2a.streaming.test.d.ts.map +1 -0
- package/routes/a2a.streaming.test.js +167 -0
- package/routes/a2a.streaming.test.js.map +1 -0
- package/routes/a2aManagement.d.ts +21 -0
- package/routes/a2aManagement.d.ts.map +1 -0
- package/routes/a2aManagement.js +466 -0
- package/routes/a2aManagement.js.map +1 -0
- package/{backend/dist/routes → routes}/agents.d.ts.map +1 -1
- package/routes/agents.js +997 -0
- package/routes/agents.js.map +1 -0
- package/{backend/dist/routes → routes}/auth.d.ts.map +1 -1
- package/routes/auth.js +135 -0
- package/routes/auth.js.map +1 -0
- package/{backend/dist/routes → routes}/commands.d.ts.map +1 -1
- package/{backend/dist/routes → routes}/commands.js +115 -31
- package/routes/commands.js.map +1 -0
- package/routes/config.d.ts +4 -0
- package/routes/config.d.ts.map +1 -0
- package/routes/config.js +211 -0
- package/routes/config.js.map +1 -0
- package/{backend/dist/routes → routes}/files.d.ts.map +1 -1
- package/{backend/dist/routes → routes}/files.js +103 -43
- package/routes/files.js.map +1 -0
- package/routes/mcp.d.ts +27 -0
- package/routes/mcp.d.ts.map +1 -0
- package/{backend/dist/routes → routes}/mcp.js +195 -105
- package/routes/mcp.js.map +1 -0
- package/routes/mcpAdmin.d.ts +16 -0
- package/routes/mcpAdmin.d.ts.map +1 -0
- package/routes/mcpAdmin.js +308 -0
- package/routes/mcpAdmin.js.map +1 -0
- package/routes/mcpAdminManagement.d.ts +17 -0
- package/routes/mcpAdminManagement.d.ts.map +1 -0
- package/routes/mcpAdminManagement.js +345 -0
- package/routes/mcpAdminManagement.js.map +1 -0
- package/routes/media.d.ts.map +1 -0
- package/{backend/dist/routes → routes}/media.js +52 -42
- package/routes/media.js.map +1 -0
- package/routes/mediaAuth.d.ts +8 -0
- package/routes/mediaAuth.d.ts.map +1 -0
- package/routes/mediaAuth.js +136 -0
- package/routes/mediaAuth.js.map +1 -0
- package/routes/plugins.d.ts +4 -0
- package/routes/plugins.d.ts.map +1 -0
- package/routes/plugins.js +339 -0
- package/routes/plugins.js.map +1 -0
- package/{backend/dist/routes → routes}/projects.d.ts.map +1 -1
- package/routes/projects.js +884 -0
- package/routes/projects.js.map +1 -0
- package/routes/scheduledTasks.d.ts +9 -0
- package/routes/scheduledTasks.d.ts.map +1 -0
- package/routes/scheduledTasks.js +320 -0
- package/routes/scheduledTasks.js.map +1 -0
- package/{backend/dist/routes → routes}/sessions.d.ts.map +1 -1
- package/{backend/dist/routes → routes}/sessions.js +258 -39
- package/routes/sessions.js.map +1 -0
- package/{backend/dist/routes → routes}/settings.d.ts.map +1 -1
- package/{backend/dist/routes → routes}/settings.js +82 -241
- package/routes/settings.js.map +1 -0
- package/{backend/dist/routes/mcp.d.ts → routes/skills.d.ts} +1 -1
- package/routes/skills.d.ts.map +1 -0
- package/routes/skills.js +272 -0
- package/routes/skills.js.map +1 -0
- package/routes/slack.d.ts +10 -0
- package/routes/slack.d.ts.map +1 -0
- package/routes/slack.js +189 -0
- package/routes/slack.js.map +1 -0
- package/{backend/dist/routes → routes}/slides.d.ts.map +1 -1
- package/{backend/dist/routes → routes}/slides.js +29 -27
- package/routes/slides.js.map +1 -0
- package/{backend/dist/routes → routes}/subagents.js +27 -22
- package/routes/subagents.js.map +1 -0
- package/schemas/a2a.d.ts +858 -0
- package/schemas/a2a.d.ts.map +1 -0
- package/schemas/a2a.js +300 -0
- package/schemas/a2a.js.map +1 -0
- package/scripts/postinstall.js +10 -0
- package/services/__tests__/pluginInstaller.test.d.ts +5 -0
- package/services/__tests__/pluginInstaller.test.d.ts.map +1 -0
- package/services/__tests__/pluginInstaller.test.js +290 -0
- package/services/__tests__/pluginInstaller.test.js.map +1 -0
- package/services/__tests__/pluginParser.test.d.ts +5 -0
- package/services/__tests__/pluginParser.test.d.ts.map +1 -0
- package/services/__tests__/pluginParser.test.js +272 -0
- package/services/__tests__/pluginParser.test.js.map +1 -0
- package/services/__tests__/pluginPaths.test.d.ts +5 -0
- package/services/__tests__/pluginPaths.test.d.ts.map +1 -0
- package/services/__tests__/pluginPaths.test.js +221 -0
- package/services/__tests__/pluginPaths.test.js.map +1 -0
- package/services/__tests__/pluginScanner.test.d.ts +5 -0
- package/services/__tests__/pluginScanner.test.d.ts.map +1 -0
- package/services/__tests__/pluginScanner.test.js +272 -0
- package/services/__tests__/pluginScanner.test.js.map +1 -0
- package/services/__tests__/pluginSymlink.test.d.ts +5 -0
- package/services/__tests__/pluginSymlink.test.d.ts.map +1 -0
- package/services/__tests__/pluginSymlink.test.js +318 -0
- package/services/__tests__/pluginSymlink.test.js.map +1 -0
- package/services/__tests__/slackAIService.test.d.ts +5 -0
- package/services/__tests__/slackAIService.test.d.ts.map +1 -0
- package/services/__tests__/slackAIService.test.js +477 -0
- package/services/__tests__/slackAIService.test.js.map +1 -0
- package/services/__tests__/slackThreadMapper.test.d.ts +5 -0
- package/services/__tests__/slackThreadMapper.test.d.ts.map +1 -0
- package/services/__tests__/slackThreadMapper.test.js +194 -0
- package/services/__tests__/slackThreadMapper.test.js.map +1 -0
- package/services/a2a/__tests__/a2aClientTool.integration.test.d.ts +6 -0
- package/services/a2a/__tests__/a2aClientTool.integration.test.d.ts.map +1 -0
- package/services/a2a/__tests__/a2aClientTool.integration.test.js +264 -0
- package/services/a2a/__tests__/a2aClientTool.integration.test.js.map +1 -0
- package/services/a2a/__tests__/a2aClientTool.test.d.ts +6 -0
- package/services/a2a/__tests__/a2aClientTool.test.d.ts.map +1 -0
- package/services/a2a/__tests__/a2aClientTool.test.js +418 -0
- package/services/a2a/__tests__/a2aClientTool.test.js.map +1 -0
- package/services/a2a/__tests__/a2aConfigService.test.d.ts +6 -0
- package/services/a2a/__tests__/a2aConfigService.test.d.ts.map +1 -0
- package/services/a2a/__tests__/a2aConfigService.test.js +431 -0
- package/services/a2a/__tests__/a2aConfigService.test.js.map +1 -0
- package/services/a2a/__tests__/a2aConfigServicePath.test.d.ts +2 -0
- package/services/a2a/__tests__/a2aConfigServicePath.test.d.ts.map +1 -0
- package/services/a2a/__tests__/a2aConfigServicePath.test.js +49 -0
- package/services/a2a/__tests__/a2aConfigServicePath.test.js.map +1 -0
- package/services/a2a/__tests__/a2aSdkMcp.test.d.ts +10 -0
- package/services/a2a/__tests__/a2aSdkMcp.test.d.ts.map +1 -0
- package/services/a2a/__tests__/a2aSdkMcp.test.js +239 -0
- package/services/a2a/__tests__/a2aSdkMcp.test.js.map +1 -0
- package/services/a2a/__tests__/agentCardService.test.d.ts +6 -0
- package/services/a2a/__tests__/agentCardService.test.d.ts.map +1 -0
- package/services/a2a/__tests__/agentCardService.test.js +292 -0
- package/services/a2a/__tests__/agentCardService.test.js.map +1 -0
- package/services/a2a/__tests__/apiKeyService.test.d.ts +6 -0
- package/services/a2a/__tests__/apiKeyService.test.d.ts.map +1 -0
- package/services/a2a/__tests__/apiKeyService.test.js +284 -0
- package/services/a2a/__tests__/apiKeyService.test.js.map +1 -0
- package/services/a2a/__tests__/buildQueryOptionsIntegration.test.d.ts +2 -0
- package/services/a2a/__tests__/buildQueryOptionsIntegration.test.d.ts.map +1 -0
- package/services/a2a/__tests__/buildQueryOptionsIntegration.test.js +70 -0
- package/services/a2a/__tests__/buildQueryOptionsIntegration.test.js.map +1 -0
- package/services/a2a/__tests__/dynamic_config_verification.test.d.ts +2 -0
- package/services/a2a/__tests__/dynamic_config_verification.test.d.ts.map +1 -0
- package/services/a2a/__tests__/dynamic_config_verification.test.js +67 -0
- package/services/a2a/__tests__/dynamic_config_verification.test.js.map +1 -0
- package/services/a2a/__tests__/integrateA2AMcpServer.test.d.ts +2 -0
- package/services/a2a/__tests__/integrateA2AMcpServer.test.d.ts.map +1 -0
- package/services/a2a/__tests__/integrateA2AMcpServer.test.js +112 -0
- package/services/a2a/__tests__/integrateA2AMcpServer.test.js.map +1 -0
- package/services/a2a/__tests__/taskManager.integration.test.d.ts +7 -0
- package/services/a2a/__tests__/taskManager.integration.test.d.ts.map +1 -0
- package/services/a2a/__tests__/taskManager.integration.test.js +346 -0
- package/services/a2a/__tests__/taskManager.integration.test.js.map +1 -0
- package/services/a2a/__tests__/taskManager.test.d.ts +7 -0
- package/services/a2a/__tests__/taskManager.test.d.ts.map +1 -0
- package/services/a2a/__tests__/taskManager.test.js +423 -0
- package/services/a2a/__tests__/taskManager.test.js.map +1 -0
- package/services/a2a/a2aClientTool.d.ts +73 -0
- package/services/a2a/a2aClientTool.d.ts.map +1 -0
- package/services/a2a/a2aClientTool.js +572 -0
- package/services/a2a/a2aClientTool.js.map +1 -0
- package/services/a2a/a2aConfigService.d.ts +50 -0
- package/services/a2a/a2aConfigService.d.ts.map +1 -0
- package/services/a2a/a2aConfigService.js +186 -0
- package/services/a2a/a2aConfigService.js.map +1 -0
- package/services/a2a/a2aHistoryService.d.ts +32 -0
- package/services/a2a/a2aHistoryService.d.ts.map +1 -0
- package/services/a2a/a2aHistoryService.js +108 -0
- package/services/a2a/a2aHistoryService.js.map +1 -0
- package/services/a2a/a2aIntegration.d.ts +9 -0
- package/services/a2a/a2aIntegration.d.ts.map +1 -0
- package/services/a2a/a2aIntegration.js +41 -0
- package/services/a2a/a2aIntegration.js.map +1 -0
- package/services/a2a/a2aQueryService.d.ts +71 -0
- package/services/a2a/a2aQueryService.d.ts.map +1 -0
- package/services/a2a/a2aQueryService.js +166 -0
- package/services/a2a/a2aQueryService.js.map +1 -0
- package/services/a2a/a2aSdkMcp.d.ts +51 -0
- package/services/a2a/a2aSdkMcp.d.ts.map +1 -0
- package/services/a2a/a2aSdkMcp.js +185 -0
- package/services/a2a/a2aSdkMcp.js.map +1 -0
- package/services/a2a/a2aStreamEvents.d.ts +94 -0
- package/services/a2a/a2aStreamEvents.d.ts.map +1 -0
- package/services/a2a/a2aStreamEvents.js +92 -0
- package/services/a2a/a2aStreamEvents.js.map +1 -0
- package/services/a2a/agentCardService.d.ts +34 -0
- package/services/a2a/agentCardService.d.ts.map +1 -0
- package/services/a2a/agentCardService.js +228 -0
- package/services/a2a/agentCardService.js.map +1 -0
- package/services/a2a/agentMappingService.d.ts +53 -0
- package/services/a2a/agentMappingService.d.ts.map +1 -0
- package/services/a2a/agentMappingService.js +185 -0
- package/services/a2a/agentMappingService.js.map +1 -0
- package/services/a2a/apiKeyService.d.ts +101 -0
- package/services/a2a/apiKeyService.d.ts.map +1 -0
- package/services/a2a/apiKeyService.js +314 -0
- package/services/a2a/apiKeyService.js.map +1 -0
- package/services/a2a/taskCleanup.d.ts +30 -0
- package/services/a2a/taskCleanup.d.ts.map +1 -0
- package/services/a2a/taskCleanup.js +184 -0
- package/services/a2a/taskCleanup.js.map +1 -0
- package/services/a2a/taskManager.d.ts +86 -0
- package/services/a2a/taskManager.d.ts.map +1 -0
- package/services/a2a/taskManager.js +263 -0
- package/services/a2a/taskManager.js.map +1 -0
- package/services/agentStorage.d.ts +27 -0
- package/services/agentStorage.d.ts.map +1 -0
- package/services/agentStorage.js +487 -0
- package/services/agentStorage.js.map +1 -0
- package/services/askUserQuestion/askUserQuestionIntegration.d.ts +24 -0
- package/services/askUserQuestion/askUserQuestionIntegration.d.ts.map +1 -0
- package/services/askUserQuestion/askUserQuestionIntegration.js +52 -0
- package/services/askUserQuestion/askUserQuestionIntegration.js.map +1 -0
- package/services/askUserQuestion/askUserQuestionMcp.d.ts +103 -0
- package/services/askUserQuestion/askUserQuestionMcp.d.ts.map +1 -0
- package/services/askUserQuestion/askUserQuestionMcp.js +129 -0
- package/services/askUserQuestion/askUserQuestionMcp.js.map +1 -0
- package/services/askUserQuestion/index.d.ts +13 -0
- package/services/askUserQuestion/index.d.ts.map +1 -0
- package/services/askUserQuestion/index.js +35 -0
- package/services/askUserQuestion/index.js.map +1 -0
- package/services/askUserQuestion/init.d.ts +17 -0
- package/services/askUserQuestion/init.d.ts.map +1 -0
- package/services/askUserQuestion/init.js +47 -0
- package/services/askUserQuestion/init.js.map +1 -0
- package/services/askUserQuestion/notificationChannel.d.ts +97 -0
- package/services/askUserQuestion/notificationChannel.d.ts.map +1 -0
- package/services/askUserQuestion/notificationChannel.js +147 -0
- package/services/askUserQuestion/notificationChannel.js.map +1 -0
- package/services/askUserQuestion/slackNotificationChannel.d.ts +35 -0
- package/services/askUserQuestion/slackNotificationChannel.d.ts.map +1 -0
- package/services/askUserQuestion/slackNotificationChannel.js +129 -0
- package/services/askUserQuestion/slackNotificationChannel.js.map +1 -0
- package/services/askUserQuestion/sseNotificationChannel.d.ts +36 -0
- package/services/askUserQuestion/sseNotificationChannel.d.ts.map +1 -0
- package/services/askUserQuestion/sseNotificationChannel.js +88 -0
- package/services/askUserQuestion/sseNotificationChannel.js.map +1 -0
- package/services/askUserQuestion/userInputRegistry.d.ts +107 -0
- package/services/askUserQuestion/userInputRegistry.d.ts.map +1 -0
- package/services/askUserQuestion/userInputRegistry.js +253 -0
- package/services/askUserQuestion/userInputRegistry.js.map +1 -0
- package/{backend/dist/services → services}/claudeSession.d.ts +20 -5
- package/services/claudeSession.d.ts.map +1 -0
- package/{backend/dist/services → services}/claudeSession.js +123 -41
- package/services/claudeSession.js.map +1 -0
- package/services/claudeVersionStorage.d.ts +20 -0
- package/services/claudeVersionStorage.d.ts.map +1 -0
- package/services/claudeVersionStorage.js +331 -0
- package/services/claudeVersionStorage.js.map +1 -0
- package/services/mcpAdmin/__tests__/adminApiKeyService.test.d.ts +5 -0
- package/services/mcpAdmin/__tests__/adminApiKeyService.test.d.ts.map +1 -0
- package/services/mcpAdmin/__tests__/adminApiKeyService.test.js +289 -0
- package/services/mcpAdmin/__tests__/adminApiKeyService.test.js.map +1 -0
- package/services/mcpAdmin/__tests__/mcpAdminRoutes.test.d.ts +5 -0
- package/services/mcpAdmin/__tests__/mcpAdminRoutes.test.d.ts.map +1 -0
- package/services/mcpAdmin/__tests__/mcpAdminRoutes.test.js +345 -0
- package/services/mcpAdmin/__tests__/mcpAdminRoutes.test.js.map +1 -0
- package/services/mcpAdmin/__tests__/mcpAdminServer.test.d.ts +5 -0
- package/services/mcpAdmin/__tests__/mcpAdminServer.test.d.ts.map +1 -0
- package/services/mcpAdmin/__tests__/mcpAdminServer.test.js +453 -0
- package/services/mcpAdmin/__tests__/mcpAdminServer.test.js.map +1 -0
- package/services/mcpAdmin/__tests__/tools.test.d.ts +5 -0
- package/services/mcpAdmin/__tests__/tools.test.d.ts.map +1 -0
- package/services/mcpAdmin/__tests__/tools.test.js +371 -0
- package/services/mcpAdmin/__tests__/tools.test.js.map +1 -0
- package/services/mcpAdmin/adminApiKeyService.d.ts +61 -0
- package/services/mcpAdmin/adminApiKeyService.d.ts.map +1 -0
- package/services/mcpAdmin/adminApiKeyService.js +270 -0
- package/services/mcpAdmin/adminApiKeyService.js.map +1 -0
- package/services/mcpAdmin/index.d.ts +10 -0
- package/services/mcpAdmin/index.d.ts.map +1 -0
- package/services/mcpAdmin/index.js +43 -0
- package/services/mcpAdmin/index.js.map +1 -0
- package/services/mcpAdmin/mcpAdminServer.d.ts +76 -0
- package/services/mcpAdmin/mcpAdminServer.d.ts.map +1 -0
- package/services/mcpAdmin/mcpAdminServer.js +243 -0
- package/services/mcpAdmin/mcpAdminServer.js.map +1 -0
- package/services/mcpAdmin/tools/agentTools.d.ts +27 -0
- package/services/mcpAdmin/tools/agentTools.d.ts.map +1 -0
- package/services/mcpAdmin/tools/agentTools.js +359 -0
- package/services/mcpAdmin/tools/agentTools.js.map +1 -0
- package/services/mcpAdmin/tools/index.d.ts +15 -0
- package/services/mcpAdmin/tools/index.d.ts.map +1 -0
- package/services/mcpAdmin/tools/index.js +30 -0
- package/services/mcpAdmin/tools/index.js.map +1 -0
- package/services/mcpAdmin/tools/mcpServerTools.d.ts +27 -0
- package/services/mcpAdmin/tools/mcpServerTools.d.ts.map +1 -0
- package/services/mcpAdmin/tools/mcpServerTools.js +334 -0
- package/services/mcpAdmin/tools/mcpServerTools.js.map +1 -0
- package/services/mcpAdmin/tools/projectTools.d.ts +27 -0
- package/services/mcpAdmin/tools/projectTools.d.ts.map +1 -0
- package/services/mcpAdmin/tools/projectTools.js +353 -0
- package/services/mcpAdmin/tools/projectTools.js.map +1 -0
- package/services/mcpAdmin/tools/systemTools.d.ts +23 -0
- package/services/mcpAdmin/tools/systemTools.d.ts.map +1 -0
- package/services/mcpAdmin/tools/systemTools.js +241 -0
- package/services/mcpAdmin/tools/systemTools.js.map +1 -0
- package/services/mcpAdmin/types.d.ts +124 -0
- package/services/mcpAdmin/types.d.ts.map +1 -0
- package/services/mcpAdmin/types.js +18 -0
- package/services/mcpAdmin/types.js.map +1 -0
- package/{backend/dist/services → services}/messageQueue.d.ts.map +1 -1
- package/{backend/dist/services → services}/messageQueue.js +16 -3
- package/services/messageQueue.js.map +1 -0
- package/services/pluginInstaller.d.ts +58 -0
- package/services/pluginInstaller.d.ts.map +1 -0
- package/services/pluginInstaller.js +321 -0
- package/services/pluginInstaller.js.map +1 -0
- package/services/pluginParser.d.ts +45 -0
- package/services/pluginParser.d.ts.map +1 -0
- package/services/pluginParser.js +437 -0
- package/services/pluginParser.js.map +1 -0
- package/services/pluginPaths.d.ts +80 -0
- package/services/pluginPaths.d.ts.map +1 -0
- package/services/pluginPaths.js +274 -0
- package/services/pluginPaths.js.map +1 -0
- package/services/pluginScanner.d.ts +36 -0
- package/services/pluginScanner.d.ts.map +1 -0
- package/services/pluginScanner.js +251 -0
- package/services/pluginScanner.js.map +1 -0
- package/services/pluginSymlink.d.ts +54 -0
- package/services/pluginSymlink.d.ts.map +1 -0
- package/services/pluginSymlink.js +223 -0
- package/services/pluginSymlink.js.map +1 -0
- package/services/projectMetadataStorage.d.ts +114 -0
- package/services/projectMetadataStorage.d.ts.map +1 -0
- package/services/projectMetadataStorage.js +711 -0
- package/services/projectMetadataStorage.js.map +1 -0
- package/services/scheduledTaskStorage.d.ts +52 -0
- package/services/scheduledTaskStorage.d.ts.map +1 -0
- package/services/scheduledTaskStorage.js +285 -0
- package/services/scheduledTaskStorage.js.map +1 -0
- package/services/schedulerService.d.ts +81 -0
- package/services/schedulerService.d.ts.map +1 -0
- package/services/schedulerService.js +743 -0
- package/services/schedulerService.js.map +1 -0
- package/{backend/dist/services → services}/sessionManager.d.ts +6 -4
- package/services/sessionManager.d.ts.map +1 -0
- package/{backend/dist/services → services}/sessionManager.js +77 -16
- package/services/sessionManager.js.map +1 -0
- package/services/skillStorage.d.ts +60 -0
- package/services/skillStorage.d.ts.map +1 -0
- package/services/skillStorage.js +398 -0
- package/services/skillStorage.js.map +1 -0
- package/services/slackAIService.d.ts +81 -0
- package/services/slackAIService.d.ts.map +1 -0
- package/services/slackAIService.js +1091 -0
- package/services/slackAIService.js.map +1 -0
- package/services/slackClient.d.ts +46 -0
- package/services/slackClient.d.ts.map +1 -0
- package/services/slackClient.js +85 -0
- package/services/slackClient.js.map +1 -0
- package/services/slackSessionLock.d.ts +79 -0
- package/services/slackSessionLock.d.ts.map +1 -0
- package/services/slackSessionLock.js +353 -0
- package/services/slackSessionLock.js.map +1 -0
- package/services/slackThreadMapper.d.ts +57 -0
- package/services/slackThreadMapper.d.ts.map +1 -0
- package/services/slackThreadMapper.js +140 -0
- package/services/slackThreadMapper.js.map +1 -0
- package/types/a2a.d.ts +275 -0
- package/types/a2a.d.ts.map +1 -0
- package/types/a2a.js +23 -0
- package/types/a2a.js.map +1 -0
- package/types/agents.d.ts +95 -0
- package/types/agents.d.ts.map +1 -0
- package/types/agents.js +46 -0
- package/types/agents.js.map +1 -0
- package/types/claude-history.d.ts +62 -0
- package/types/claude-history.d.ts.map +1 -0
- package/types/claude-history.js +4 -0
- package/types/claude-history.js.map +1 -0
- package/types/claude-versions.d.ts +36 -0
- package/types/claude-versions.d.ts.map +1 -0
- package/types/claude-versions.js +3 -0
- package/types/claude-versions.js.map +1 -0
- package/types/commands.d.ts +50 -0
- package/types/commands.d.ts.map +1 -0
- package/types/commands.js +23 -0
- package/types/commands.js.map +1 -0
- package/types/plugins.d.ts +144 -0
- package/types/plugins.d.ts.map +1 -0
- package/types/plugins.js +8 -0
- package/types/plugins.js.map +1 -0
- package/types/projects.d.ts +42 -0
- package/types/projects.d.ts.map +1 -0
- package/types/projects.js +4 -0
- package/types/projects.js.map +1 -0
- package/types/scheduledTasks.d.ts +164 -0
- package/types/scheduledTasks.d.ts.map +1 -0
- package/types/scheduledTasks.js +17 -0
- package/types/scheduledTasks.js.map +1 -0
- package/types/skills.d.ts +91 -0
- package/types/skills.d.ts.map +1 -0
- package/types/skills.js +6 -0
- package/types/skills.js.map +1 -0
- package/types/slack.d.ts +97 -0
- package/types/slack.d.ts.map +1 -0
- package/types/slack.js +8 -0
- package/types/slack.js.map +1 -0
- package/types/streaming.d.ts +12 -0
- package/types/streaming.d.ts.map +1 -0
- package/types/streaming.js +8 -0
- package/types/streaming.js.map +1 -0
- package/types/subagents.d.ts +26 -0
- package/types/subagents.d.ts.map +1 -0
- package/types/subagents.js +3 -0
- package/types/subagents.js.map +1 -0
- package/utils/__tests__/claudeUtils.test.d.ts +5 -0
- package/utils/__tests__/claudeUtils.test.d.ts.map +1 -0
- package/utils/__tests__/claudeUtils.test.js +282 -0
- package/utils/__tests__/claudeUtils.test.js.map +1 -0
- package/utils/__tests__/sessionUtils.test.d.ts +5 -0
- package/utils/__tests__/sessionUtils.test.d.ts.map +1 -0
- package/utils/__tests__/sessionUtils.test.js +295 -0
- package/utils/__tests__/sessionUtils.test.js.map +1 -0
- package/utils/agentCardCache.d.ts +93 -0
- package/utils/agentCardCache.d.ts.map +1 -0
- package/utils/agentCardCache.js +212 -0
- package/utils/agentCardCache.js.map +1 -0
- package/utils/claudeUtils.d.ts +54 -0
- package/utils/claudeUtils.d.ts.map +1 -0
- package/utils/claudeUtils.js +387 -0
- package/utils/claudeUtils.js.map +1 -0
- package/utils/fileUtils.d.ts +2 -0
- package/utils/fileUtils.d.ts.map +1 -0
- package/utils/fileUtils.js +11 -0
- package/utils/fileUtils.js.map +1 -0
- package/utils/jwt.d.ts +30 -0
- package/utils/jwt.d.ts.map +1 -0
- package/utils/jwt.js +95 -0
- package/utils/jwt.js.map +1 -0
- package/utils/sessionUtils.d.ts +64 -0
- package/utils/sessionUtils.d.ts.map +1 -0
- package/utils/sessionUtils.js +266 -0
- package/utils/sessionUtils.js.map +1 -0
- package/README.zh-CN.md +0 -525
- package/backend/dist/bin/agentstudio.js +0 -120
- package/backend/dist/bin/agentstudio.js.map +0 -1
- package/backend/dist/frontend/assets/AgentsPage-Dqb_aqAA.js +0 -1
- package/backend/dist/frontend/assets/ChatPage-L8Paywyc.js +0 -91
- package/backend/dist/frontend/assets/CommandForm-DLl7EIMS.js +0 -7
- package/backend/dist/frontend/assets/CommandsPage-Bzavq0Ec.js +0 -1
- package/backend/dist/frontend/assets/DashboardPage-B3o4AYFT.js +0 -15
- package/backend/dist/frontend/assets/FileBrowser-DL3ayaqb.js +0 -1
- package/backend/dist/frontend/assets/GeneralSettingsPage-CBN_de-V.js +0 -1
- package/backend/dist/frontend/assets/LandingPage-Dl4ioKos.js +0 -1
- package/backend/dist/frontend/assets/LoginPage-4QqRdiSi.js +0 -12
- package/backend/dist/frontend/assets/McpPage-CY3tYiqj.js +0 -39
- package/backend/dist/frontend/assets/MemorySettingsPage-DGxrok5K.js +0 -1
- package/backend/dist/frontend/assets/ProjectSelector-hgmGYVFh.js +0 -1
- package/backend/dist/frontend/assets/ProjectsPage-D399IM0c.js +0 -14
- package/backend/dist/frontend/assets/SettingsLayout-CL_K-lzJ.js +0 -1
- package/backend/dist/frontend/assets/SubagentsPage-Chbhj8p2.js +0 -1
- package/backend/dist/frontend/assets/UnifiedToolSelector-CsM9qBvs.js +0 -1
- package/backend/dist/frontend/assets/VersionSettingsPage-74Q-LVgA.js +0 -5
- package/backend/dist/frontend/assets/agents-ClAzIJTw.js +0 -1
- package/backend/dist/frontend/assets/authFetch-BATQyPG5.js +0 -1
- package/backend/dist/frontend/assets/index-B9YHa7XT.css +0 -1
- package/backend/dist/frontend/assets/index-B_CTNvca.js +0 -268
- package/backend/dist/frontend/assets/monaco-editor-C7Z4sOhS.js +0 -19
- package/backend/dist/frontend/assets/tabManager-DV8urRBM.js +0 -30
- package/backend/dist/frontend/assets/tools-C4EPanYi.js +0 -1
- package/backend/dist/frontend/assets/useAgents-DwnOE1_k.js +0 -2
- package/backend/dist/frontend/assets/useClaudeVersions-CQdGnCqv.js +0 -1
- package/backend/dist/frontend/assets/useCommands-CCVaurbt.js +0 -1
- package/backend/dist/index.d.ts +0 -3
- package/backend/dist/index.d.ts.map +0 -1
- package/backend/dist/index.js +0 -157
- package/backend/dist/index.js.map +0 -1
- package/backend/dist/middleware/auth.d.ts.map +0 -1
- package/backend/dist/middleware/auth.js +0 -21
- package/backend/dist/middleware/auth.js.map +0 -1
- package/backend/dist/routes/agents.js +0 -803
- package/backend/dist/routes/agents.js.map +0 -1
- package/backend/dist/routes/auth.js +0 -60
- package/backend/dist/routes/auth.js.map +0 -1
- package/backend/dist/routes/commands.js.map +0 -1
- package/backend/dist/routes/files.js.map +0 -1
- package/backend/dist/routes/mcp.d.ts.map +0 -1
- package/backend/dist/routes/mcp.js.map +0 -1
- package/backend/dist/routes/media.d.ts.map +0 -1
- package/backend/dist/routes/media.js.map +0 -1
- package/backend/dist/routes/projects.js +0 -528
- package/backend/dist/routes/projects.js.map +0 -1
- package/backend/dist/routes/sessions.js.map +0 -1
- package/backend/dist/routes/settings.js.map +0 -1
- package/backend/dist/routes/slides.js.map +0 -1
- package/backend/dist/routes/subagents.js.map +0 -1
- package/backend/dist/services/claudeSession.d.ts.map +0 -1
- package/backend/dist/services/claudeSession.js.map +0 -1
- package/backend/dist/services/messageQueue.js.map +0 -1
- package/backend/dist/services/sessionManager.d.ts.map +0 -1
- package/backend/dist/services/sessionManager.js.map +0 -1
- package/backend/dist/utils/jwt.d.ts +0 -15
- package/backend/dist/utils/jwt.d.ts.map +0 -1
- package/backend/dist/utils/jwt.js +0 -28
- package/backend/dist/utils/jwt.js.map +0 -1
- /package/{backend/dist/bin → bin}/agentstudio.d.ts +0 -0
- /package/{backend/dist/bin → bin}/agentstudio.d.ts.map +0 -0
- /package/{backend/dist/frontend → public}/assets/ChatPage-BvQmXfcP.css +0 -0
- /package/{backend/dist/frontend → public}/assets/agents-DwCY2K8p.css +0 -0
- /package/{backend/dist/frontend → public}/assets/dateFormat-CXa8VnEC.js +0 -0
- /package/{backend/dist/frontend → public}/cc-studio.png +0 -0
- /package/{backend/dist/frontend → public}/vite.svg +0 -0
- /package/{backend/dist/routes → routes}/agents.d.ts +0 -0
- /package/{backend/dist/routes → routes}/auth.d.ts +0 -0
- /package/{backend/dist/routes → routes}/commands.d.ts +0 -0
- /package/{backend/dist/routes → routes}/files.d.ts +0 -0
- /package/{backend/dist/routes → routes}/media.d.ts +0 -0
- /package/{backend/dist/routes → routes}/projects.d.ts +0 -0
- /package/{backend/dist/routes → routes}/sessions.d.ts +0 -0
- /package/{backend/dist/routes → routes}/settings.d.ts +0 -0
- /package/{backend/dist/routes → routes}/slides.d.ts +0 -0
- /package/{backend/dist/routes → routes}/subagents.d.ts +0 -0
- /package/{backend/dist/routes → routes}/subagents.d.ts.map +0 -0
- /package/{backend/dist/services → services}/messageQueue.d.ts +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as l}from"./monaco-editor-DHKm5-VF.js";import{b as I,c as Z,d as J,e as K}from"./useCommands-mvMu3mMD.js";import{U as Q}from"./UnifiedToolSelector-CNbPsiuq.js";import{u as U}from"./tools-IcPNZlPj.js";import{d as V,o as X,y as Y,j as ee}from"./ui-components-D1St49qC.js";const le=({command:o,projectId:x,onClose:_,onSuccess:z})=>{const{t:a}=U("components"),{t:C}=U("common"),[s,n]=l.useState({name:o?"":"optimize",description:o?"":a("commandForm.exampleDescription"),content:o?"":a("commandForm.exampleContent"),scope:x?"project":"user",namespace:o?"":"frontend",argumentHint:o?"":"[filename] [options]",allowedTools:[],model:""}),[c,T]=l.useState({}),[u,q]=l.useState(!1),[S,p]=l.useState(""),[H,f]=l.useState(!0),[M,$]=l.useState(!1),[m,E]=l.useState([]),[i,j]=l.useState([]),[R,P]=l.useState(!1),w=x?I(x):Z(),N=x?J(x):K(),h=!!o,k=r=>{const t=[];return r.description&&t.push(`description: ${r.description}`),r.argumentHint&&t.push(`argument-hint: ${r.argumentHint}`),r.namespace&&t.push(`namespace: ${r.namespace}`),r.allowedTools&&r.allowedTools.length>0&&t.push(`allowed-tools: ${r.allowedTools.join(", ")}`),r.model&&t.push(`model: ${r.model}`),t.length>0?`---
|
|
2
|
+
${t.join(`
|
|
3
|
+
`)}
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
${r.content}`:r.content},L=r=>{const t=r.match(/^---\n(.*?)\n---\n\n?(.*)/s);if(!t)return{content:r};const[,d,b]=t,g={content:b};return d.split(`
|
|
7
|
+
`).forEach(F=>{const v=F.indexOf(":");if(v===-1)return;const B=F.substring(0,v).trim(),y=F.substring(v+1).trim();switch(B){case"description":g.description=y;break;case"argument-hint":g.argumentHint=y;break;case"namespace":g.namespace=y;break;case"allowed-tools":g.allowedTools=y.split(",").map(G=>G.trim()).filter(Boolean);break;case"model":g.model=y;break}}),g};l.useEffect(()=>{if(o){const r={name:o.name,description:o.description,content:o.content,scope:o.scope,namespace:o.namespace||"",argumentHint:o.argumentHint||"",allowedTools:o.allowedTools||[],model:o.model||""};if(n(r),f(!r.model),p(k(r)),o.allowedTools){const t=o.allowedTools.filter(b=>!b.startsWith("mcp__")),d=o.allowedTools.filter(b=>b.startsWith("mcp__"));E(t),j(d),P(d.length>0)}}else p(k(s))},[o]),l.useEffect(()=>{u||p(k(s))},[s,u]);const A=r=>{if(r)p(k(s));else{const t=L(S);n({...s,...t}),f(!t.model)}q(r)},O=r=>{p(r);const t=L(r);n({...s,...t}),f(!t.model)},W=()=>{const r={};return s.name.trim()?/^[a-zA-Z0-9_-]+$/.test(s.name)||(r.name=a("commandForm.errors.nameFormat")):r.name=a("commandForm.errors.nameRequired"),s.content.trim()||(r.content=a("commandForm.errors.contentRequired")),s.scope||(r.scope=a("commandForm.errors.scopeRequired")),T(r),Object.keys(r).length===0},D=async r=>{if(r.preventDefault(),console.log("Form submit triggered"),!W()){console.log("Form validation failed");return}try{const t={...s,namespace:(s.namespace||"").trim()||void 0,argumentHint:(s.argumentHint||"").trim()||void 0,allowedTools:s.allowedTools&&s.allowedTools.length>0?s.allowedTools:void 0,model:(s.model||"").trim()||void 0};if(console.log("Submit data:",t),console.log("Is editing:",h),h){const d={description:t.description,content:t.content,argumentHint:t.argumentHint,allowedTools:t.allowedTools,model:t.model};console.log("Calling updateCommand with:",{id:o.id,updates:d}),await N.mutateAsync({id:o.id,updates:d})}else console.log("Calling createCommand with:",t),await w.mutateAsync(t);console.log("Command operation successful"),z()}catch(t){console.log("Command operation failed:",t),T({submit:t.message||a("commandForm.errors.saveFailed")})}};return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl w-full max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:a(h?"commandForm.editTitle":"commandForm.createTitle")}),e.jsxs("div",{className:"flex items-center bg-gray-100 dark:bg-gray-700 rounded-lg p-1",children:[e.jsxs("button",{type:"button",onClick:()=>A(!1),className:`flex items-center space-x-1 px-3 py-1.5 rounded-md text-sm transition-colors ${u?"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white":"bg-white dark:bg-gray-800 text-blue-600 shadow-sm"}`,children:[e.jsx(V,{className:"h-4 w-4"}),e.jsx("span",{children:a("commandForm.formMode")})]}),e.jsxs("button",{type:"button",onClick:()=>A(!0),className:`flex items-center space-x-1 px-3 py-1.5 rounded-md text-sm transition-colors ${u?"bg-white dark:bg-gray-800 text-blue-600 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx("span",{children:a("commandForm.codeMode")})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("button",{type:"button",onClick:_,className:"px-4 py-2 text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600 rounded-lg transition-colors",children:C("actions.cancel")}),e.jsxs("button",{type:"button",onClick:D,disabled:w.isPending||N.isPending,className:"flex items-center space-x-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded-lg transition-colors",children:[e.jsx(Y,{className:"h-4 w-4"}),e.jsx("span",{children:w.isPending||N.isPending?C("status.saving"):a(h?"commandForm.saveChanges":"commandForm.createCommand")})]})]})]}),e.jsx("form",{id:"command-form",onSubmit:D,className:"flex-1 overflow-y-auto",children:e.jsx("div",{className:"p-6 space-y-6",children:u?e.jsx(e.Fragment,{children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("commandForm.markdownSource")}),e.jsx("textarea",{value:S,onChange:r=>O(r.target.value),placeholder:a("commandForm.markdownPlaceholder"),rows:25,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 font-mono text-sm dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"}),e.jsxs("div",{className:"mt-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx("p",{children:e.jsx("strong",{children:a("commandForm.frontmatterSupported")})}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 mt-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"description"})," - ",a("commandForm.frontmatterFields.description")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"argument-hint"})," - ",a("commandForm.frontmatterFields.argumentHint")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"namespace"})," - ",a("commandForm.frontmatterFields.namespace")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"allowed-tools"})," - ",a("commandForm.frontmatterFields.allowedTools")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"model"})," - ",a("commandForm.frontmatterFields.model")]})]})]})]})}):e.jsxs(e.Fragment,{children:[c.submit&&e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg",children:[e.jsx(ee,{className:"h-5 w-5 text-red-500 dark:text-red-400"}),e.jsx("span",{className:"text-red-700 dark:text-red-400",children:c.submit})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[a("commandForm.nameLabel")," *"]}),e.jsx("input",{type:"text",value:s.name,onChange:r=>n({...s,name:r.target.value}),disabled:h,placeholder:"optimize",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 disabled:bg-gray-100 dark:disabled:bg-gray-700 disabled:cursor-not-allowed dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"}),c.name&&e.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:c.name}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:a("commandForm.nameHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("commandForm.modelLabel")}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{id:"inherit-model",type:"checkbox",checked:H,onChange:r=>{f(r.target.checked),r.target.checked&&n({...s,model:""})},className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 dark:border-gray-600 rounded"}),e.jsx("label",{htmlFor:"inherit-model",className:"ml-2 text-sm text-gray-700 dark:text-gray-300 whitespace-nowrap",children:a("commandForm.inheritModel")})]}),e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"text",value:s.model,onChange:r=>n({...s,model:r.target.value}),placeholder:"sonnet",disabled:H,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 disabled:bg-gray-100 dark:disabled:bg-gray-700 disabled:text-gray-500 dark:disabled:text-gray-400 disabled:cursor-not-allowed dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"})})]}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:a("commandForm.modelHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("commandForm.namespaceLabel")}),e.jsx("input",{type:"text",value:s.namespace,onChange:r=>n({...s,namespace:r.target.value}),placeholder:"frontend",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 dark:placeholder-gray-400"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:a("commandForm.namespaceHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("commandForm.argumentHintLabel")}),e.jsx("input",{type:"text",value:s.argumentHint,onChange:r=>n({...s,argumentHint:r.target.value}),placeholder:"[filename] [options]",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 dark:placeholder-gray-400"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:a("commandForm.argumentHintHint")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("commandForm.descriptionLabel")}),e.jsx("input",{type:"text",value:s.description,onChange:r=>n({...s,description:r.target.value}),placeholder:a("commandForm.descriptionPlaceholder"),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 dark:placeholder-gray-400"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:a("commandForm.descriptionHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("commandForm.allowedToolsLabel")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{type:"button",onClick:()=>$(!M),className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 rounded-lg transition-colors text-sm",children:a("commandForm.selectTools")}),(m.length>0||i.length>0)&&e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:[a("commandForm.regularToolsCount",{count:m.length}),i.length>0&&`, ${a("commandForm.mcpToolsCount",{count:i.length})}`]}),e.jsx(Q,{isOpen:M,onClose:()=>$(!1),selectedRegularTools:m,selectedMcpTools:i,mcpToolsEnabled:R,onRegularToolsChange:r=>{E(r);const t=R?[...r,...i]:r;n({...s,allowedTools:t})},onMcpToolsChange:r=>{j(r);const t=[...m,...r];n({...s,allowedTools:t})},onMcpEnabledChange:r=>{if(P(r),!r)j([]),n({...s,allowedTools:m});else{const t=[...m,...i];n({...s,allowedTools:t})}}})]}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:a("commandForm.allowedToolsHint")})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[a("commandForm.contentLabel")," *"]}),e.jsx("textarea",{value:s.content,onChange:r=>n({...s,content:r.target.value}),placeholder:a("commandForm.contentPlaceholder"),rows:12,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 font-mono text-sm dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"}),c.content&&e.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:c.content}),e.jsxs("div",{className:"mt-2 text-sm text-gray-500 dark:text-gray-400 space-y-1",children:[e.jsx("p",{children:e.jsx("strong",{children:a("commandForm.supportedFeatures")})}),e.jsxs("ul",{className:"list-disc list-inside space-y-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"$ARGUMENTS"})," - ",a("commandForm.features.arguments")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"$1, $2, ..."})," - ",a("commandForm.features.positionArgs")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"@filepath"})," - ",a("commandForm.features.fileRef")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 px-1 rounded",children:"!`command`"})," - ",a("commandForm.features.bashCommand")]})]})]})]})]})})})]})})};export{le as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{T as P,a as D,b as j,c as m,d as B,e as x}from"./table-D0L2RL5i.js";import{u as L,a as R}from"./useCommands-mvMu3mMD.js";import{C as q}from"./CommandForm-Bk7F_HU8.js";import{f as N}from"./dateFormat-CXa8VnEC.js";import{u as z}from"./index-Bn3v3S9-.js";import{T as f}from"./ToolsList-Dl5F2fWk.js";import{u as G}from"./tools-IcPNZlPj.js";import{j as v,g as I,p as J,o as k,m as w,u as C,v as $,E as K}from"./ui-components-D1St49qC.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-ChrA1R0y.js";import"./UnifiedToolSelector-CNbPsiuq.js";const re=()=>{const{t}=G("pages"),{isMobile:a}=z(),[d]=i.useState({scope:"user"}),[n,T]=i.useState(""),[S,r]=i.useState(!1),[F,l]=i.useState(null),[g,o]=i.useState(null),[u,b]=i.useState({}),{data:A=[],isLoading:M,error:E,refetch:y}=L({...d,search:n.trim()||void 0}),h=R(),H=async s=>{try{await h.mutateAsync(s.id),o(null)}catch(c){console.error("Failed to delete command:",c)}},p=A.filter(s=>!(d.scope&&d.scope!=="all"&&s.scope!==d.scope||d.namespace&&s.namespace!==d.namespace));return M?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-blue-500 mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:t("commands.loading")})]})}):E?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(v,{className:"h-16 w-16 text-red-500 mx-auto mb-4"}),e.jsx("p",{className:"text-red-600 text-lg mb-2",children:t("commands.error.loadFailed")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:t("commands.error.cannotLoadCommands")}),e.jsx("button",{onClick:()=>y(),className:"bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg transition-colors",children:t("commands.error.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:`${a?"mb-4":"flex items-center justify-between mb-6"}`,children:e.jsxs("div",{children:[e.jsx("h1",{className:`${a?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:t("commands.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mt-1":"mt-2"}`,children:t("commands.subtitle")})]})}),e.jsxs("div",{className:`${a?"space-y-3":"flex items-center space-x-4"}`,children:[e.jsxs("div",{className:`${a?"":"flex-1"} relative`,children:[e.jsx(I,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:t("commands.searchPlaceholder"),value:n,onChange:s=>T(s.target.value),className:`pl-10 pr-4 ${a?"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 ${a?"text-sm":""}`})]}),e.jsxs("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-2.5 px-4":"flex items-center space-x-2 px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors ${a?"text-sm":""}`,children:[e.jsx(J,{className:`${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:t("commands.createButton")})]})]})]}),p.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:`${a?"text-4xl":"text-6xl"} mb-4`,children:"⚡"}),e.jsx("h3",{className:`${a?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:t(n?"commands.empty.noMatchingCommands":"commands.empty.noCommands")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:t(n?"commands.empty.adjustSearch":"commands.empty.createFirst")}),!n&&e.jsx("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-3 px-4":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:t("commands.createButton")})]}):e.jsx(e.Fragment,{children:a?e.jsx("div",{className:"space-y-4",children:p.map((s,c)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`${a?"text-lg":"text-xl"} mr-3`,children:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:`${a?"text-sm":"text-base"} font-medium text-gray-900 dark:text-white`,children:[s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`,s.argumentHint&&e.jsx("code",{className:"ml-2 bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:s.description})]})]})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.model"),":"]}),s.model?e.jsxs("div",{className:"flex items-center text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-sm",children:s.model})]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})]}),e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-start text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2 mt-1",children:[t("commands.table.tools"),":"]}),e.jsx("div",{className:"flex-1",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!0,emptyMessage:t("commands.table.inheritSettings")})})]})}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.createdAt"),":"]}),e.jsxs("div",{className:"flex items-center text-gray-500 dark:text-gray-400",children:[e.jsx(w,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end space-x-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-2 text-sm 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",children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})]},s.id+"-"+c))}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(P,{children:[e.jsx(D,{children:e.jsxs(j,{children:[e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.command")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.model")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.tools")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.createdAt")}),e.jsx(m,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.actions")})]})}),e.jsx(B,{children:p.map((s,c)=>e.jsxs(j,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(x,{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:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${s.source==="plugin"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"}`,children:s.source==="plugin"?t("commands.source.plugin"):t("commands.source.local")}),s.argumentHint&&e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-xs mt-1",children:s.description})]})]})}),e.jsx(x,{className:"px-6 py-4",children:s.model?e.jsxs("div",{className:"text-sm text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 inline mr-1"}),s.model]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!1,emptyMessage:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(w,{className:"w-4 h-4"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.source==="plugin"?e.jsxs("button",{onClick:()=>{l(s),r(!0)},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:t("commands.actions.view"),children:[e.jsx(K,{className:"w-3 h-3 mr-1"}),t("commands.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},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:t("commands.actions.editCommand"),children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})})})]},s.id+"-"+c))})]})})}),S&&e.jsx(q,{command:F,onClose:()=>{r(!1),l(null)},onSuccess:()=>{r(!1),l(null),y()}}),g&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl ${a?"w-full max-w-sm":"max-w-md w-full mx-4"} p-6`,children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(v,{className:`${a?"h-5 w-5":"h-6 w-6"} text-red-600`})}),e.jsx("div",{className:"flex-1",children:e.jsx("h3",{className:`${a?"text-base":"text-lg"} font-medium text-gray-900 dark:text-white`,children:t("commands.delete.title")})})]}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mb-4 text-sm":"mb-6"}`,children:t("commands.delete.confirmMessage",{name:g.name})}),e.jsxs("div",{className:`${a?"grid grid-cols-2 gap-2":"flex justify-end space-x-3"}`,children:[e.jsx("button",{onClick:()=>o(null),className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg transition-colors`,children:t("commands.delete.cancel")}),e.jsx("button",{onClick:()=>H(g),disabled:h.isPending,className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors disabled:opacity-50`,children:h.isPending?t("commands.delete.deleting"):t("commands.delete.delete")})]})]})})]})};export{re as CommandsPage};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{c as $}from"./useAgents-BnDTkOG8.js";import{r as V}from"./monaco-editor-DHKm5-VF.js";import{t as T,u as D,c as _}from"./tabManager-B2LQO_Ll.js";import{u as B}from"./agents-ChrA1R0y.js";import{u as Q}from"./useClaudeVersions-CD59tFWM.js";import{b as X,L as p,u as Z}from"./index-Bn3v3S9-.js";import{u as A}from"./tools-IcPNZlPj.js";import{R as L,X as K,ai as v,$ as k,aj as G,q as J,T as Y,ak as M,v as ee,C as se,m as N,f as R,al as q,am as F,_ as f,Z as te,p as I,I as ae}from"./ui-components-D1St49qC.js";import{u as O}from"./useProjects-YXOjaOwL.js";import{u as z}from"./useCommands-mvMu3mMD.js";import"./syntax-highlighting-CnREyncB.js";function re(t){try{const s=new URL(t,window.location.origin),i=new URLSearchParams(s.search),o=new URLSearchParams;i.has("project")&&o.set("project",i.get("project")),i.has("session")&&o.set("session",i.get("session"));for(const[c,x]of i.entries())c!=="session"&&c!=="project"&&o.set(c,x);return`${s.pathname}?${o.toString()}`}catch(s){return console.warn("Failed to normalize URL:",s),t}}async function ne(t,s,i){console.log(`🧠 Smart navigation: ${s}/${i} -> ${t}`);try{const o=re(t);console.log(`🔄 Normalized URL: ${o}`);const c=oe(s,i);console.log(`🎯 Attempting window.open with name: ${c}`);const x=window.open(o,c);if(x)return x.location.href==="about:blank"||x.document.readyState==="loading"?(console.log(`🆕 Opened new window for session: ${i}`),{action:"opened_new",success:!0,message:"打开新的会话标签页",windowRef:x}):(console.log(`✅ Successfully focused existing window for session: ${i}`),{action:"awakened",success:!0,message:"成功切换到已存在的会话标签页",windowRef:x});const m=T.hasActiveTab(s,i);if(console.log(`🔍 TabManager reports active tab: ${m}`),m){if(console.log(`🔍 Found active tab in TabManager for session: ${i}`),await T.wakeupExistingTab(s,i,o))return console.log(`✅ Successfully awakened existing tab via BroadcastChannel for session: ${i}`),{action:"awakened",success:!0,message:"通过后台信号唤起会话标签页"};console.log("⚠️ Failed to wake up existing tab via BroadcastChannel")}return console.log("🔄 Falling back to current tab navigation"),window.location.href=o,{action:"opened_new",success:!0,message:"在当前标签页打开会话"}}catch(o){console.error("Smart navigation failed:",o);try{return window.open(t)||(window.location.href=t),{action:"failed",success:!1,message:"智能导航失败,使用降级方案"}}catch(c){return console.error("Fallback navigation also failed:",c),{action:"failed",success:!1,message:"导航失败"}}}}function oe(t,s){return`chat_${t}_${s}`}function P(t){console.log(`📢 ${t.message}`);const s=document.createElement("div");s.style.cssText=`
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 20px;
|
|
4
|
+
right: 20px;
|
|
5
|
+
background: ${t.success?"#10b981":"#ef4444"};
|
|
6
|
+
color: white;
|
|
7
|
+
padding: 12px 24px;
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
10
|
+
z-index: 10000;
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
13
|
+
max-width: 300px;
|
|
14
|
+
transition: all 0.3s ease;
|
|
15
|
+
`,s.textContent=t.message,document.body.appendChild(s),setTimeout(()=>{s.style.opacity="0",s.style.transform="translateX(100%)",setTimeout(()=>{document.body.contains(s)&&document.body.removeChild(s)},300)},3e3)}const ie=()=>{const{t}=A("components"),{data:s,isLoading:i,error:o,refetch:c}=D(),{data:x}=$(),{data:m}=Q(),g=B(),[u,r]=V.useState(null),n=async(a,l)=>{try{r(l),await _(a,l),g.invalidateQueries({queryKey:["sessions"]})}catch(d){console.error("Failed to cleanup session:",d),X(t("sessionsDashboard.errors.cleanupFailed"))}finally{r(null)}},b=async a=>{const l=`/chat/${a.agentId}?session=${a.sessionId}${a.projectPath?`&project=${encodeURIComponent(a.projectPath)}`:""}`;try{const d=await ne(l,a.agentId,a.sessionId);P(d),console.log("🎯 Navigation result:",d)}catch(d){console.error("Navigation failed:",d),window.open(l),P({success:!1,message:t("sessionsDashboard.errors.navigationFailed")})}},j=a=>new Date(a).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"}),y=a=>{const l=Math.floor(a/1e3),d=Math.floor(l/60),S=Math.floor(d/60);return S>0?t("sessionsDashboard.time.hoursMinutes",{hours:S,minutes:d%60}):d>0?t("sessionsDashboard.time.minutesSeconds",{minutes:d,seconds:l%60}):t("sessionsDashboard.time.seconds",{seconds:l})},h=a=>{if(!a)return t("sessionsDashboard.heartbeat.none");const d=Date.now()-a;return y(d)},w=a=>(x?.agents||[]).find(d=>d.id===a),U=a=>!a||!m?.versions?null:m.versions.find(l=>l.id===a),E=a=>a.status==="pending"?"text-yellow-600 bg-yellow-100":a.isActive?"text-green-600 bg-green-100":"text-gray-600 bg-gray-100",W=a=>a.status==="pending"?e.jsx(M,{className:"w-3 h-3 animate-spin"}):a.isActive?e.jsx(se,{className:"w-3 h-3"}):e.jsx(N,{className:"w-3 h-3"});if(i)return e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(L,{className:"w-6 h-6 animate-spin text-gray-400 mr-2"}),e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:t("sessionsDashboard.loadingMessage")})]})});if(o)return e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:e.jsxs("div",{className:"text-center py-8",children:[e.jsx(K,{className:"w-12 h-12 mx-auto mb-3 text-red-400"}),e.jsx("p",{className:"text-red-600 dark:text-red-400 mb-3",children:t("sessionsDashboard.errors.loadFailed")}),e.jsx("button",{onClick:()=>c(),className:"px-4 py-2 bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 rounded-lg hover:bg-red-200 dark:hover:bg-red-900/50 transition-colors",children:t("common:actions.refresh")})]})});const C=s?.sessions||[],H=s?.activeSessionCount||0;return e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(v,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:t("sessionsDashboard.title")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("sessionsDashboard.activeCount",{count:H})})]})]}),e.jsx("button",{onClick:()=>c(),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("common:actions.refresh"),children:e.jsx(L,{className:"w-4 h-4"})})]}),C.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[e.jsx(v,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{children:t("sessionsDashboard.empty.noSessions")}),e.jsx("p",{className:"text-sm mt-1",children:t("sessionsDashboard.empty.startChatHint")})]}):e.jsx("div",{className:"space-y-3 max-h-96 overflow-y-auto",children:C.map(a=>{const l=w(a.agentId);return e.jsxs("div",{className:"flex items-center space-x-4 p-4 rounded-lg border border-gray-100 dark:border-gray-700 hover:border-gray-200 dark:hover:border-gray-600 transition-colors",children:[e.jsxs("div",{className:"flex items-center space-x-3 flex-1 min-w-0",children:[e.jsx("div",{className:"text-xl",children:l?.ui?.icon||e.jsx(k,{className:"w-5 h-5 text-gray-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-white truncate",children:l?.name||a.agentId}),e.jsxs("span",{className:`inline-flex items-center px-2 py-1 text-xs rounded-full ${E(a)}`,children:[W(a),e.jsx("span",{className:"ml-1",children:a.status==="pending"?t("sessionsDashboard.status.pending"):a.isActive?t("sessionsDashboard.status.active"):t("sessionsDashboard.status.idle")})]})]}),e.jsxs("div",{className:"flex flex-col space-y-1 mt-1",children:[e.jsxs("div",{className:"flex items-center space-x-4 text-xs",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:[t("sessionsDashboard.labels.session"),":"]})," ",a.sessionId]}),e.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:[t("sessionsDashboard.labels.agent"),":"]})," ",a.agentId]})]}),a.projectPath&&e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:[t("sessionsDashboard.labels.project"),":"]}),e.jsx("span",{className:"ml-1 font-mono bg-gray-100 dark:bg-gray-700 px-1 py-0.5 rounded text-gray-600 dark:text-gray-400",children:a.projectPath})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-xs",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:[t("sessionsDashboard.labels.activity"),":"]})," ",j(a.lastActivity)]}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(G,{className:`w-3 h-3 ${a.lastHeartbeat?"text-red-500":"text-gray-400 dark:text-gray-500"}`}),e.jsx("span",{className:a.lastHeartbeat?"text-gray-600 dark:text-gray-400":"text-gray-400 dark:text-gray-500",children:h(a.lastHeartbeat)})]}),a.heartbeatTimedOut&&e.jsxs("div",{className:"flex items-center space-x-1 text-yellow-600 dark:text-yellow-400",children:[e.jsx(J,{className:"w-3 h-3"}),e.jsx("span",{children:t("sessionsDashboard.heartbeat.timeout")})]}),a.claudeVersionId&&(()=>{const d=U(a.claudeVersionId);return d?e.jsxs("div",{className:"flex items-center space-x-1 text-green-600 dark:text-green-400",children:[e.jsx(Y,{className:"w-3 h-3"}),e.jsx("span",{title:d.name,children:d.alias})]}):null})()]})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>b(a),className:"p-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded-lg transition-colors",title:t("sessionsDashboard.actions.openChat"),children:e.jsx(v,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>n(a.agentId,a.sessionId),disabled:u===a.sessionId,className:"p-2 text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/30 rounded-lg transition-colors disabled:opacity-50",title:t("sessionsDashboard.actions.cleanup"),children:u===a.sessionId?e.jsx(M,{className:"w-4 h-4 animate-spin"}):e.jsx(ee,{className:"w-4 h-4"})})]})]},a.sessionId)})})]})},ce=()=>{const{t}=A("components"),{data:s}=O(),{data:i}=z(),{data:o}=D(),c=s?.projects||[],x=i||[],m=o?.sessions||[],g=[...c.slice(0,3).map(r=>({id:`project-${r.id}`,type:"project",title:r.name,subtitle:r.description,timestamp:r.lastAccessed||r.createdAt||new Date().toISOString(),icon:e.jsx(R,{className:"w-4 h-4 text-green-600"}),href:"/projects"})),...x.slice(0,3).map(r=>({id:`command-${r.id}`,type:"command",title:`/${r.name}`,subtitle:r.description,timestamp:r.createdAt?new Date(r.createdAt).toISOString():new Date().toISOString(),icon:e.jsx(q,{className:"w-4 h-4 text-blue-600"}),href:"/settings/commands"})),...m.slice(0,3).map(r=>({id:`session-${r.sessionId}`,type:"session",title:r.agentId,subtitle:r.projectPath||void 0,timestamp:new Date(r.lastActivity).toISOString(),icon:e.jsx(F,{className:"w-4 h-4 text-purple-600"})}))].filter(r=>r.timestamp&&!isNaN(new Date(r.timestamp).getTime())).sort((r,n)=>new Date(n.timestamp).getTime()-new Date(r.timestamp).getTime()).slice(0,8),u=r=>{const n=Date.now(),b=new Date(r).getTime(),j=n-b,y=Math.floor(j/6e4),h=Math.floor(j/36e5),w=Math.floor(j/864e5);return y<1?t("recentActivity.time.justNow"):y<60?t("recentActivity.time.minutesAgo",{count:y}):h<24?t("recentActivity.time.hoursAgo",{count:h}):t("recentActivity.time.daysAgo",{count:w})};return g.length===0?e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-6",children:[e.jsx("div",{className:"p-2 bg-purple-100 dark:bg-purple-900/30 rounded-lg",children:e.jsx(N,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:t("recentActivity.title")})]}),e.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[e.jsx(N,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{children:t("recentActivity.empty")})]})]}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-6",children:[e.jsx("div",{className:"p-2 bg-purple-100 dark:bg-purple-900/30 rounded-lg",children:e.jsx(N,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:t("recentActivity.title")})]}),e.jsx("div",{className:"space-y-3",children:g.map(r=>{const n=e.jsxs("div",{className:"flex items-start space-x-3 p-3 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-700 rounded-lg",children:r.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-white truncate",children:r.title}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2",children:u(r.timestamp)})]}),r.subtitle&&e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:r.subtitle})]})]});return r.href?e.jsx(p,{to:r.href,children:n},r.id):e.jsx("div",{children:n},r.id)})})]})},de=()=>{const{data:t,isLoading:s}=$(),{data:i,isLoading:o}=O(),{data:c,isLoading:x}=z(),{data:m,isLoading:g}=D(),u=s||o||x||g,r=t?.agents||[],n=i?.projects||[],b=c||[],j=m?.sessions||[];return{stats:{agents:{total:r.length,enabled:r.filter(h=>h.enabled).length},projects:{total:n.length},commands:{total:b.length,project:b.filter(h=>h.scope==="project").length,user:b.filter(h=>h.scope==="user").length},sessions:{total:j.length,active:m?.activeSessionCount||0}},isLoading:u}},we=()=>{const{t}=A("pages"),{isMobile:s}=Z(),{data:i}=$(),{stats:o,isLoading:c}=de(),g=(i?.agents||[]).filter(n=>n.enabled),u=[{name:t("dashboard.stats.agentManagement"),value:o.agents.enabled,total:o.agents.total,icon:k,color:"bg-blue-500",href:"/agents"},{name:t("dashboard.stats.workProjects"),value:o.projects.total,icon:R,color:"bg-green-500",href:"/projects"},{name:t("dashboard.stats.slashCommands"),value:o.commands.total,icon:q,color:"bg-orange-500",href:"/settings/commands"},{name:t("dashboard.stats.activeSessions"),value:o.sessions.active,total:o.sessions.total,icon:F,color:"bg-purple-500",href:"#sessions"}],r=g.slice(0,3);return e.jsxs("div",{className:`${s?"p-4":"p-8"}`,children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:`${s?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:t("dashboard.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-2",children:t("dashboard.welcome")})]}),e.jsx("div",{className:`grid gap-4 mb-8 ${s?"grid-cols-2":"grid-cols-1 md:grid-cols-2 lg:grid-cols-4"}`,children:u.map(n=>e.jsx(p,{to:n.href,className:`${s?"p-4":"p-6"} bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow`,children:e.jsxs("div",{className:`${s?"flex flex-col items-center text-center":"flex items-center"}`,children:[e.jsx("div",{className:`p-3 rounded-lg ${n.color} ${s?"mb-3":""}`,children:e.jsx(n.icon,{className:`w-6 h-6 text-white ${s?"w-8 h-8":""}`})}),e.jsxs("div",{className:`${s?"flex-1":"ml-4 flex-1"}`,children:[e.jsx("p",{className:`${s?"text-xs":"text-sm"} font-medium text-gray-600 dark:text-gray-400 ${s?"mb-1":""}`,children:n.name}),e.jsx("div",{className:`${s?"":"flex items-center space-x-2"}`,children:e.jsxs("p",{className:`${s?"text-xl":"text-2xl"} font-bold text-gray-900 dark:text-white`,children:[c?"...":n.value,n.total!==void 0&&!c&&e.jsxs("span",{className:`${s?"text-xs font-normal":"text-sm font-normal"} text-gray-500 dark:text-gray-400 ${s?"block":""}`,children:["/",n.total]})]})})]})]})},n.name))}),e.jsxs("div",{className:`gap-8 ${s?"space-y-8":"grid grid-cols-1 lg:grid-cols-2"}`,children:[e.jsxs("div",{className:"space-y-8",children:[e.jsx("div",{id:"sessions",children:e.jsx(ie,{})}),e.jsx(ce,{})]}),e.jsx("div",{className:"space-y-8",children:e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 ${s?"p-4":"p-6"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:`${s?"text-lg":"text-xl"} font-semibold text-gray-900 dark:text-white`,children:t("dashboard.recentAgents.title")}),e.jsxs(p,{to:"/agents",className:"text-blue-600 hover:text-blue-700 flex items-center space-x-1 text-sm font-medium",children:[e.jsx("span",{children:t("dashboard.recentAgents.viewAll")}),e.jsx(f,{className:"w-4 h-4"})]})]}),e.jsxs("div",{className:"space-y-4",children:[r.map(n=>e.jsxs("div",{className:`${s?"flex items-center space-x-3 p-3":"flex items-center space-x-4 p-4"} rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors`,children:[e.jsx("div",{className:`${s?"text-xl":"text-2xl"}`,children:n.ui.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:`${s?"text-sm":""} font-medium text-gray-900 dark:text-white truncate`,children:n.name}),e.jsx("p",{className:`text-sm text-gray-500 dark:text-gray-400 truncate ${s?"hidden":""}`,children:n.description})]}),e.jsx("div",{className:`${s?"flex flex-col items-end space-y-1":"flex items-center space-x-2"}`,children:e.jsx(p,{to:`/chat/${n.id}`,className:"text-blue-600 hover:text-blue-700",children:e.jsx(te,{className:"w-4 h-4"})})})]},n.id)),r.length===0&&e.jsxs("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[e.jsx(k,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{children:t("dashboard.recentAgents.noAgents")}),e.jsx(p,{to:"/agents",className:"mt-2 text-blue-600 hover:text-blue-700 text-sm",children:t("dashboard.recentAgents.goEnable")})]})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("h2",{className:`${s?"text-lg":"text-xl"} font-semibold text-gray-900 dark:text-white mb-6`,children:t("dashboard.quickActions.title")}),e.jsxs("div",{className:`${s?"grid grid-cols-2 gap-3":"space-y-4"}`,children:[e.jsxs(p,{to:"/projects",className:`${s?"flex flex-col items-center p-4 text-center":"flex items-center space-x-4 p-4"} rounded-lg border border-gray-200 dark:border-gray-700 hover:border-green-300 dark:hover:border-green-600 hover:bg-green-50 dark:hover:bg-green-900/20 transition-colors`,children:[e.jsx("div",{className:`p-2 bg-green-100 dark:bg-green-900/30 rounded-lg ${s?"mb-2":""}`,children:e.jsx(I,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{className:s?"text-center":"",children:[e.jsx("h3",{className:`font-medium text-gray-900 dark:text-white ${s?"text-sm mb-1":""}`,children:t("dashboard.quickActions.createProject.title")}),e.jsx("p",{className:`text-gray-500 dark:text-gray-400 ${s?"text-xs hidden":"text-sm"}`,children:t("dashboard.quickActions.createProject.description")})]}),!s&&e.jsx(f,{className:"w-5 h-5 text-gray-400 dark:text-gray-500 ml-auto"})]}),e.jsxs(p,{to:"/agents",className:`${s?"flex flex-col items-center p-4 text-center":"flex items-center space-x-4 p-4"} rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-300 dark:hover:border-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors`,children:[e.jsx("div",{className:`p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg ${s?"mb-2":""}`,children:e.jsx(I,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:s?"text-center":"",children:[e.jsx("h3",{className:`font-medium text-gray-900 dark:text-white ${s?"text-sm mb-1":""}`,children:t("dashboard.quickActions.createAgent.title")}),e.jsx("p",{className:`text-gray-500 dark:text-gray-400 ${s?"text-xs hidden":"text-sm"}`,children:t("dashboard.quickActions.createAgent.description")})]}),!s&&e.jsx(f,{className:"w-5 h-5 text-gray-400 dark:text-gray-500 ml-auto"})]}),e.jsxs(p,{to:"/mcp",className:`${s?"flex flex-col items-center p-4 text-center":"flex items-center space-x-4 p-4"} rounded-lg border border-gray-200 dark:border-gray-700 hover:border-green-300 dark:hover:border-green-600 hover:bg-green-50 dark:hover:bg-green-900/20 transition-colors`,children:[e.jsx("div",{className:`p-2 bg-green-100 dark:bg-green-900/30 rounded-lg ${s?"mb-2":""}`,children:e.jsx(ae,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{className:s?"text-center":"",children:[e.jsx("h3",{className:`font-medium text-gray-900 dark:text-white ${s?"text-sm mb-1":""}`,children:t("dashboard.quickActions.addMcp.title")}),e.jsx("p",{className:`text-gray-500 dark:text-gray-400 ${s?"text-xs hidden":"text-sm"}`,children:t("dashboard.quickActions.addMcp.description")})]}),!s&&e.jsx(f,{className:"w-5 h-5 text-gray-400 dark:text-gray-500 ml-auto"})]})]})]})]})})]})]})};export{we as DashboardPage};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as o}from"./monaco-editor-DHKm5-VF.js";import{a as K,A as W}from"./agents-ChrA1R0y.js";import{b as de}from"./index-Bn3v3S9-.js";import{u as ee}from"./tools-IcPNZlPj.js";import{X as V,aa as te,ab as Y,g as _,ac as q,l as G,ad as ae,ae as Z,a4 as ce,t as xe,s as ge,k as he,af as ye,ag as me,V as be,J as ue,E as pe,Y as re,e as fe,ah as we}from"./ui-components-D1St49qC.js";const ve=({filePath:F,onClose:h})=>{const{t}=ee("components"),[p,A]=o.useState([]),[N,U]=o.useState(!0),[M,s]=o.useState(null),[d,T]=o.useState(""),[i,b]=o.useState(1),[P,$]=o.useState(!1),[v]=o.useState(50),[O,H]=o.useState(""),z=c=>{const n=c.split(`
|
|
2
|
+
`).filter(x=>x.trim()),g=[];for(const x of n){const u=[];let S="",D=!1;for(let L=0;L<x.length;L++){const R=x[L];R==='"'?D&&x[L+1]==='"'?(S+='"',L++):D=!D:R===","&&!D?(u.push(S.trim()),S=""):S+=R}u.push(S.trim()),g.push(u)}return g};o.useEffect(()=>{(async()=>{try{U(!0),s(null);const n=F.split(/[/\\]/).pop()||"unknown.csv";H(n);const g=await K(`${W}/files/read?path=${encodeURIComponent(F)}`);if(!g.ok)throw new Error(t("csvPreview.errors.loadFailed"));const x=await g.json(),u=z(x.content);A(u)}catch(n){console.error("Failed to load CSV:",n),s(n instanceof Error?n.message:t("csvPreview.errors.unknownError"))}finally{U(!1)}})()},[F,t]);const j=o.useMemo(()=>{if(!d)return p;const c=d.toLowerCase();return p.filter(n=>n.some(g=>g.toLowerCase().includes(c)))},[p,d]),y=Math.ceil(j.length/v),f=(i-1)*v,C=f+v,m=j.slice(f,C);o.useEffect(()=>{b(1)},[d]),o.useEffect(()=>{const c=n=>{n.key==="Escape"?h():n.key==="ArrowLeft"&&i>1?b(i-1):n.key==="ArrowRight"&&i<y?b(i+1):n.ctrlKey&&n.key==="f"&&(n.preventDefault(),document.getElementById("csv-search")?.focus())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[h,i,y]);const k=()=>{const c=p.map(x=>x.map(u=>u.includes(",")||u.includes('"')||u.includes(`
|
|
3
|
+
`)?`"${u.replace(/"/g,'""')}"`:u).join(",")).join(`
|
|
4
|
+
`),n=new Blob([c],{type:"text/csv;charset=utf-8;"}),g=document.createElement("a");g.href=URL.createObjectURL(n),g.download=O,g.click(),URL.revokeObjectURL(g.href)};if(N)return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 flex items-center space-x-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:t("csvPreview.loading")})]})});if(M)return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t("csvPreview.errors.title")}),e.jsx("button",{onClick:h,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(V,{className:"w-5 h-5"})})]}),e.jsx("p",{className:"text-red-600 dark:text-red-400",children:M}),e.jsx("button",{onClick:h,className:"mt-4 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",children:t("csvPreview.actions.close")})]})});const J=P?"fixed inset-4 bg-white dark:bg-gray-900 flex flex-col z-50":"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50";return e.jsx("div",{className:J,children:P?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:O}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t("csvPreview.info.rowCount",{count:j.length}),d&&` (${t("csvPreview.info.filtered")})`]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>$(!1),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("csvPreview.actions.minimize"),children:e.jsx(te,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:k,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("csvPreview.actions.download"),children:e.jsx(Y,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("csvPreview.actions.close"),children:e.jsx(V,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(_,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{id:"csv-search",type:"text",value:d,onChange:c=>T(c.target.value),placeholder:t("csvPreview.search.placeholder"),className:"w-full pl-10 pr-4 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-800 dark:text-white dark:placeholder-gray-400"})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:m.length>0?e.jsx("div",{className:"min-w-full",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800 sticky top-0",children:e.jsx("tr",{children:m[0]?.map((c,n)=>e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-200 dark:border-gray-700",children:c||t("csvPreview.table.untitled")},n))})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700",children:m.slice(1).map((c,n)=>e.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800",children:c.map((g,x)=>e.jsx("td",{className:"px-4 py-2 text-sm text-gray-900 dark:text-white whitespace-nowrap border-b border-gray-100 dark:border-gray-800",children:g||"-"},x))},n))})]})}):e.jsx("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:t("csvPreview.empty.noData")})})}),y>1&&e.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("csvPreview.pagination.showing",{start:f+1,end:Math.min(C,j.length),total:j.length})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>b(Math.max(1,i-1)),disabled:i===1,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.previous"),children:e.jsx(q,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 px-3",children:[i," / ",y]}),e.jsx("button",{onClick:()=>b(Math.min(y,i+1)),disabled:i===y,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.next"),children:e.jsx(G,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})]})]})]}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-6xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:O}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t("csvPreview.info.rowCount",{count:j.length}),d&&` (${t("csvPreview.info.filtered")})`]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>$(!0),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("csvPreview.actions.maximize"),children:e.jsx(ae,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:k,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("csvPreview.actions.download"),children:e.jsx(Y,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("csvPreview.actions.close"),children:e.jsx(V,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"p-4 border-b border-gray-100 dark:border-gray-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(_,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{id:"csv-search",type:"text",value:d,onChange:c=>T(c.target.value),placeholder:t("csvPreview.search.placeholder"),className:"w-full pl-10 pr-4 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 dark:placeholder-gray-400"})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:m.length>0?e.jsx("div",{className:"min-w-full",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800 sticky top-0",children:e.jsx("tr",{children:m[0]?.map((c,n)=>e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-200 dark:border-gray-700",children:c||t("csvPreview.table.untitled")},n))})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700",children:m.slice(1).map((c,n)=>e.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800",children:c.map((g,x)=>e.jsx("td",{className:"px-4 py-2 text-sm text-gray-900 dark:text-white whitespace-nowrap border-b border-gray-100 dark:border-gray-800",children:g||"-"},x))},n))})]})}):e.jsx("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:t("csvPreview.empty.noData")})})}),y>1&&e.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("csvPreview.pagination.showing",{start:f+1,end:Math.min(C,j.length),total:j.length})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>b(Math.max(1,i-1)),disabled:i===1,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.previous"),children:e.jsx(q,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 px-3",children:[i," / ",y]}),e.jsx("button",{onClick:()=>b(Math.min(y,i+1)),disabled:i===y,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.next"),children:e.jsx(G,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"px-4 py-2 text-xs text-gray-500 dark:text-gray-400 text-center border-t border-gray-100 dark:border-gray-700",children:t("csvPreview.instructions")})]})})},je=({filePath:F,onClose:h})=>{const{t}=ee("components"),[p,A]=o.useState([]),[N,U]=o.useState(!0),[M,s]=o.useState(null),[d,T]=o.useState(""),[i,b]=o.useState(1),[P,$]=o.useState(!1),[v]=o.useState(20),[O,H]=o.useState(""),[z,j]=o.useState(new Set),[y,f]=o.useState(null),C=a=>{const l=a.split(`
|
|
5
|
+
`),w=[];for(let B=0;B<l.length;B++){const I=l[B].trim();if(I)try{const Q=JSON.parse(I);w.push({lineNumber:B+1,data:Q,raw:I})}catch{w.push({lineNumber:B+1,data:null,error:t("jsonlPreview.errors.parseError"),raw:I})}}return w};o.useEffect(()=>{(async()=>{try{U(!0),s(null);const l=F.split(/[/\\]/).pop()||"unknown.jsonl";H(l);const w=await K(`${W}/files/read?path=${encodeURIComponent(F)}`);if(!w.ok)throw new Error(t("jsonlPreview.errors.loadFailed"));const B=await w.json(),I=C(B.content);A(I)}catch(l){console.error("Failed to load JSONL:",l),s(l instanceof Error?l.message:t("jsonlPreview.errors.unknownError"))}finally{U(!1)}})()},[F,t]);const m=o.useMemo(()=>{if(!d)return p;const a=d.toLowerCase();return p.filter(l=>l.raw.toLowerCase().includes(a))},[p,d]),k=Math.ceil(m.length/v),J=(i-1)*v,c=J+v,n=m.slice(J,c);o.useEffect(()=>{b(1)},[d]),o.useEffect(()=>{const a=l=>{l.key==="Escape"?h():l.key==="ArrowLeft"&&i>1?b(i-1):l.key==="ArrowRight"&&i<k?b(i+1):l.ctrlKey&&l.key==="f"&&(l.preventDefault(),document.getElementById("jsonl-search")?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[h,i,k]);const g=a=>{const l=new Set(z);l.has(a)?l.delete(a):l.add(a),j(l)},x=async(a,l)=>{try{await navigator.clipboard.writeText(a),f(l),setTimeout(()=>f(null),2e3)}catch(w){console.error("Failed to copy:",w)}},u=()=>{const a=new Blob([p.map(w=>w.raw).join(`
|
|
6
|
+
`)],{type:"application/jsonl;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(a),l.download=O,l.click(),URL.revokeObjectURL(l.href)},S=(a,l=50)=>a.length<=l?a:a.substring(0,l)+"...";if(N)return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 flex items-center space-x-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-amber-600"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:t("jsonlPreview.loading")})]})});if(M)return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t("jsonlPreview.errors.title")}),e.jsx("button",{onClick:h,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(V,{className:"w-5 h-5"})})]}),e.jsx("p",{className:"text-red-600 dark:text-red-400",children:M}),e.jsx("button",{onClick:h,className:"mt-4 px-4 py-2 bg-amber-600 text-white rounded hover:bg-amber-700 transition-colors",children:t("jsonlPreview.actions.close")})]})});const D=p.filter(a=>a.error).length,L=P?"fixed inset-4 bg-white dark:bg-gray-900 flex flex-col z-50 rounded-lg shadow-2xl":"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",R=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Z,{className:"w-5 h-5 text-amber-500"}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:O})]}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t("jsonlPreview.info.recordCount",{count:m.length}),D>0&&e.jsxs("span",{className:"ml-2 text-red-500",children:["(",t("jsonlPreview.info.errorCount",{count:D}),")"]}),d&&` (${t("jsonlPreview.info.filtered")})`]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[!P&&e.jsx("button",{onClick:()=>$(!0),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("jsonlPreview.actions.maximize"),children:e.jsx(ae,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),P&&e.jsx("button",{onClick:()=>$(!1),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("jsonlPreview.actions.minimize"),children:e.jsx(te,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:u,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("jsonlPreview.actions.download"),children:e.jsx(Y,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("jsonlPreview.actions.close"),children:e.jsx(V,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(_,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{id:"jsonl-search",type:"text",value:d,onChange:a=>T(a.target.value),placeholder:t("jsonlPreview.search.placeholder"),className:"w-full pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-transparent dark:bg-gray-800 dark:text-white dark:placeholder-gray-400"})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:n.length>0?e.jsx("div",{className:"space-y-2",children:n.map(a=>e.jsxs("div",{className:`border rounded-lg overflow-hidden ${a.error?"border-red-300 dark:border-red-700 bg-red-50 dark:bg-red-900/20":"border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50",onClick:()=>g(a.lineNumber),children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 w-12",children:["#",a.lineNumber]}),a.error?e.jsx("span",{className:"text-sm text-red-600 dark:text-red-400",children:a.error}):e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300 font-mono",children:S(a.raw,80)})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:l=>{l.stopPropagation(),x(a.raw,a.lineNumber)},className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-600 rounded transition-colors",title:t("jsonlPreview.actions.copy"),children:y===a.lineNumber?e.jsx(ce,{className:"w-4 h-4 text-green-500"}):e.jsx(xe,{className:"w-4 h-4 text-gray-400"})}),z.has(a.lineNumber)?e.jsx(ge,{className:"w-4 h-4 text-gray-400"}):e.jsx(he,{className:"w-4 h-4 text-gray-400"})]})]}),z.has(a.lineNumber)&&a.data&&e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4 bg-gray-50 dark:bg-gray-900/50",children:e.jsx("pre",{className:"text-sm text-gray-800 dark:text-gray-200 font-mono whitespace-pre-wrap overflow-x-auto",children:JSON.stringify(a.data,null,2)})}),z.has(a.lineNumber)&&a.error&&e.jsx("div",{className:"border-t border-red-200 dark:border-red-700 p-4 bg-red-50 dark:bg-red-900/30",children:e.jsx("pre",{className:"text-sm text-red-700 dark:text-red-300 font-mono whitespace-pre-wrap overflow-x-auto break-all",children:a.raw})})]},a.lineNumber))}):e.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:[e.jsx(Z,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:t("jsonlPreview.empty.noData")})]})}),k>1&&e.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("jsonlPreview.pagination.showing",{start:J+1,end:Math.min(c,m.length),total:m.length})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>b(Math.max(1,i-1)),disabled:i===1,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("jsonlPreview.pagination.previous"),children:e.jsx(q,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 px-3",children:[i," / ",k]}),e.jsx("button",{onClick:()=>b(Math.min(k,i+1)),disabled:i===k,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("jsonlPreview.pagination.next"),children:e.jsx(G,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"px-4 py-2 text-xs text-gray-500 dark:text-gray-400 text-center border-t border-gray-100 dark:border-gray-700",children:t("jsonlPreview.instructions")})]});return e.jsx("div",{className:L,children:P?R():e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-4xl max-h-[90vh] flex flex-col shadow-2xl",children:R()})})},Ee=({title:F,initialPath:h,allowFiles:t=!0,allowDirectories:p=!0,allowNewDirectory:A=!1,restrictToProject:N=!1,onSelect:U,onClose:M})=>{const{t:s}=ee("components"),[d,T]=o.useState(null),[i,b]=o.useState(!0),[P,$]=o.useState(null),[v,O]=o.useState(!1),[H,z]=o.useState(null),[j,y]=o.useState(!1),[f,C]=o.useState(""),[m,k]=o.useState(!1),[J,c]=o.useState(null),[n,g]=o.useState(null),x=async r=>{b(!0),$(null);try{const E=new URLSearchParams;r&&E.set("path",r);const le=`${W}/files/browse?${E.toString()}`,X=await K(le);if(!X.ok){const ie=await X.json();throw new Error(ie.error||s("fileBrowser.errors.browseFailed"))}const ne=await X.json();T(ne)}catch(E){console.error("Failed to fetch directory:",E),$(E instanceof Error?E.message:s("fileBrowser.errors.loadFailed"))}finally{b(!1)}};o.useEffect(()=>{x(h)},[h]);const u=r=>{r.isDirectory?x(r.path):z(r.path)},S=r=>{(r.isDirectory&&p||!r.isDirectory&&t)&&U(r.path,r.isDirectory)},D=()=>{d?.parentPath&&(!N||d.parentPath.startsWith(h||""))&&x(d.parentPath)},L=()=>{N?h&&x(h):x()},R=async()=>{if(!(!f.trim()||!d?.currentPath)){k(!0);try{const r=await K(`${W}/files/create-directory`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parentPath:d.currentPath,directoryName:f.trim()})});if(!r.ok){const E=await r.json();throw new Error(E.error||s("fileBrowser.errors.createFailed"))}await x(d.currentPath),y(!1),C("")}catch(r){console.error("Failed to create directory:",r),de(s("fileBrowser.errors.createFailed"),r instanceof Error?r.message:void 0)}finally{k(!1)}}},a=d?.items.filter(r=>v||!r.isHidden)||[],l=r=>r===null?"":r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:r<1024*1024*1024?`${(r/1024/1024).toFixed(1)} MB`:`${(r/1024/1024/1024).toFixed(1)} GB`,w=r=>r.toLowerCase().endsWith(".csv"),B=r=>r.toLowerCase().endsWith(".jsonl"),I=r=>{c(r)},Q=()=>{c(null)},se=r=>{g(r)},oe=()=>{g(null)};return e.jsxs("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg w-full max-w-4xl max-h-[80vh] mx-4 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:F||s("fileBrowser.title")}),e.jsx("button",{onClick:M,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(V,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex items-center space-x-2 p-4 border-b border-gray-100 dark:border-gray-700",children:[e.jsx("button",{onClick:L,className:`p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors ${N?"opacity-50 cursor-not-allowed":""}`,title:s(N?"fileBrowser.toolbar.restrictedToProject":"fileBrowser.toolbar.homeDirectory"),disabled:N,children:e.jsx(ye,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:D,disabled:!d?.parentPath||N&&d?.currentPath===h,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:s("fileBrowser.toolbar.parentDirectory"),children:e.jsx(me,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("div",{className:"flex-1 px-3 py-2 bg-gray-50 dark:bg-gray-900 rounded text-sm text-gray-600 dark:text-gray-400 font-mono",children:d?.currentPath||s("fileBrowser.toolbar.loadingPath")}),A&&e.jsx("button",{onClick:()=>y(!0),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:s("fileBrowser.toolbar.newDirectory"),children:e.jsx(be,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:()=>O(!v),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:s(v?"fileBrowser.toolbar.hideHidden":"fileBrowser.toolbar.showHidden"),children:v?e.jsx(ue,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"}):e.jsx(pe,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-h-0",children:i?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):P?e.jsx("div",{className:"flex items-center justify-center h-64 text-red-600",children:e.jsxs("p",{children:[s("fileBrowser.errors.error"),": ",P]})}):e.jsxs("div",{className:"flex-1 overflow-y-auto",onWheel:r=>{r.stopPropagation()},children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-100 dark:bg-gray-800 sticky top-0",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("fileBrowser.table.name")}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("fileBrowser.table.size")}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("fileBrowser.table.modified")}),e.jsx("th",{className:"px-4 py-2 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("fileBrowser.table.actions")})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:a.map((r,E)=>e.jsxs("tr",{className:`hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors ${H===r.path?"bg-blue-50 dark:bg-blue-900/30":""}`,children:[e.jsx("td",{className:"px-4 py-3 flex items-center space-x-2",children:e.jsxs("div",{className:"flex items-center space-x-2 flex-1 min-w-0",children:[r.isDirectory?e.jsx(re,{className:"w-4 h-4 text-blue-600 flex-shrink-0"}):w(r.name)?e.jsx(fe,{className:"w-4 h-4 text-green-600 flex-shrink-0"}):B(r.name)?e.jsx(Z,{className:"w-4 h-4 text-amber-500 flex-shrink-0"}):e.jsx(we,{className:"w-4 h-4 text-gray-600 dark:text-gray-400 flex-shrink-0"}),e.jsx("button",{onClick:()=>{!r.isDirectory&&t?S(r):u(r)},className:`text-left truncate hover:text-blue-600 dark:hover:text-blue-400 ${r.isHidden?"text-gray-400":"text-gray-900 dark:text-white"} ${!r.isDirectory&&t?"cursor-pointer font-medium":""}`,children:r.name}),r.isDirectory&&e.jsx(G,{className:"w-3 h-3 text-gray-400 dark:text-gray-500 flex-shrink-0"})]})}),e.jsx("td",{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400",children:l(r.size)}),e.jsx("td",{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400",children:new Date(r.modified).toLocaleDateString("zh-CN")}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[!r.isDirectory&&w(r.name)&&e.jsx("button",{onClick:()=>I(r.path),className:"px-3 py-1 text-sm bg-green-600 text-white rounded hover:bg-green-700 transition-colors",title:s("fileBrowser.actions.previewCSV"),children:s("fileBrowser.actions.preview")}),!r.isDirectory&&B(r.name)&&e.jsx("button",{onClick:()=>se(r.path),className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",title:s("fileBrowser.actions.previewJSONL"),children:s("fileBrowser.actions.preview")}),e.jsx("button",{onClick:()=>S(r),disabled:r.isDirectory&&!p||!r.isDirectory&&!t,className:"px-3 py-1 text-sm bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:s("fileBrowser.actions.select")})]})})]},E))})]}),a.length===0&&e.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:[e.jsx(re,{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-3"}),e.jsx("p",{children:s("fileBrowser.emptyDirectory")})]})]})}),e.jsxs("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:a.length>0&&e.jsx("span",{children:s("fileBrowser.footer.itemsCount",{count:a.length})})}),e.jsx("button",{onClick:M,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:s("fileBrowser.actions.cancel")})]})]}),j&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[60]",children:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg p-6 w-full max-w-md mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:s("fileBrowser.dialog.newFolder")}),e.jsx("button",{onClick:()=>{y(!1),C("")},className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(V,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:s("fileBrowser.dialog.createAt")}),e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-700 rounded text-sm font-mono text-gray-800 dark:text-gray-200 break-all",children:d?.currentPath})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"folderName",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("fileBrowser.dialog.folderName")}),e.jsx("input",{id:"folderName",type:"text",value:f,onChange:r=>C(r.target.value),placeholder:s("fileBrowser.dialog.folderNamePlaceholder"),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 dark:placeholder-gray-400",autoFocus:!0,onKeyPress:r=>{r.key==="Enter"&&f.trim()&&!m&&R()}})]}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:()=>{y(!1),C("")},disabled:m,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors disabled:opacity-50",children:s("fileBrowser.actions.cancel")}),e.jsx("button",{onClick:R,disabled:!f.trim()||m,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:s(m?"fileBrowser.actions.creating":"fileBrowser.actions.createFolder")})]})]})}),J&&e.jsx(ve,{filePath:J,onClose:Q}),n&&e.jsx(je,{filePath:n,onClose:oe})]})};export{Ee as F};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as Se}from"./syntax-highlighting-CnREyncB.js";import{j as e,T as He}from"./data-structures-C0h9Oap1.js";import{r as c,W as Fe}from"./monaco-editor-DHKm5-VF.js";import{as as u,E as Te,J as Me,R as De,at as Ae,L as T,au as Re,X as ne,av as Ie,k as Oe,l as Ve}from"./ui-components-D1St49qC.js";import{b as me,a as _,A as M}from"./agents-ChrA1R0y.js";import{u as ue}from"./tools-IcPNZlPj.js";function $e(r){return u({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 32l34.9 395.8L192 480l157.1-52.2L384 32H0zm313.1 80l-4.8 47.3L193 208.6l-.3.1h111.5l-12.8 146.6-98.2 28.7-98.8-29.2-6.4-73.9h48.9l3.2 38.3 52.6 13.3 54.7-15.4 3.7-61.6-166.3-.5v-.1l-.2.1-3.6-46.3L193.1 162l6.5-2.7H76.7L70.9 112h242.2z"},child:[]}]})(r)}function ie(r){return u({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 32l34.9 395.8L191.5 480l157.6-52.2L384 32H0zm308.2 127.9H124.4l4.1 49.4h175.6l-13.6 148.4-97.9 27v.3h-1.1l-98.7-27.3-6-75.8h47.7L138 320l53.5 14.5 53.7-14.5 6-62.2H84.3L71.5 112.2h241.1l-4.4 47.7z"},child:[]}]})(r)}function Be(r){return u({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M277.74 312.9c9.8-6.7 23.4-12.5 23.4-12.5s-38.7 7-77.2 10.2c-47.1 3.9-97.7 4.7-123.1 1.3-60.1-8 33-30.1 33-30.1s-36.1-2.4-80.6 19c-52.5 25.4 130 37 224.5 12.1zm-85.4-32.1c-19-42.7-83.1-80.2 0-145.8C296 53.2 242.84 0 242.84 0c21.5 84.5-75.6 110.1-110.7 162.6-23.9 35.9 11.7 74.4 60.2 118.2zm114.6-176.2c.1 0-175.2 43.8-91.5 140.2 24.7 28.4-6.5 54-6.5 54s62.7-32.4 33.9-72.9c-26.9-37.8-47.5-56.6 64.1-121.3zm-6.1 270.5a12.19 12.19 0 0 1-2 2.6c128.3-33.7 81.1-118.9 19.8-97.3a17.33 17.33 0 0 0-8.2 6.3 70.45 70.45 0 0 1 11-3c31-6.5 75.5 41.5-20.6 91.4zM348 437.4s14.5 11.9-15.9 21.2c-57.9 17.5-240.8 22.8-291.6.7-18.3-7.9 16-19 26.8-21.3 11.2-2.4 17.7-2 17.7-2-20.3-14.3-131.3 28.1-56.4 40.2C232.84 509.4 401 461.3 348 437.4zM124.44 396c-78.7 22 47.9 67.4 148.1 24.5a185.89 185.89 0 0 1-28.2-13.8c-44.7 8.5-65.4 9.1-106 4.5-33.5-3.8-13.9-15.2-13.9-15.2zm179.8 97.2c-78.7 14.8-175.8 13.1-233.3 3.6 0-.1 11.8 9.7 72.4 13.6 92.2 5.9 233.8-3.3 237.1-46.9 0 0-6.4 16.5-76.2 29.7zM260.64 353c-59.2 11.4-93.5 11.1-136.8 6.6-33.5-3.5-11.6-19.7-11.6-19.7-86.8 28.8 48.2 61.4 169.5 25.9a60.37 60.37 0 0 1-21.1-12.8z"},child:[]}]})(r)}function Pe(r){return u({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM243.8 381.4c0 43.6-25.6 63.5-62.9 63.5-33.7 0-53.2-17.4-63.2-38.5l34.3-20.7c6.6 11.7 12.6 21.6 27.1 21.6 13.8 0 22.6-5.4 22.6-26.5V237.7h42.1v143.7zm99.6 63.5c-39.1 0-64.4-18.6-76.7-43l34.3-19.8c9 14.7 20.8 25.6 41.5 25.6 17.4 0 28.6-8.7 28.6-20.8 0-14.4-11.4-19.5-30.7-28l-10.5-4.5c-30.4-12.9-50.5-29.2-50.5-63.5 0-31.6 24.1-55.6 61.6-55.6 26.8 0 46 9.3 59.8 33.7L368 290c-7.2-12.9-15-18-27.1-18-12.3 0-20.1 7.8-20.1 18 0 12.6 7.8 17.7 25.9 25.6l10.5 4.5c35.8 15.3 55.9 31 55.9 66.2 0 37.8-29.8 58.6-69.7 58.6z"},child:[]}]})(r)}function _e(r){return u({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1zM338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z"},child:[]}]})(r)}function qe(r){return u({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"},child:[]}]})(r)}function We(r){return u({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M418.2 177.2c-5.4-1.8-10.8-3.5-16.2-5.1.9-3.7 1.7-7.4 2.5-11.1 12.3-59.6 4.2-107.5-23.1-123.3-26.3-15.1-69.2.6-112.6 38.4-4.3 3.7-8.5 7.6-12.5 11.5-2.7-2.6-5.5-5.2-8.3-7.7-45.5-40.4-91.1-57.4-118.4-41.5-26.2 15.2-34 60.3-23 116.7 1.1 5.6 2.3 11.1 3.7 16.7-6.4 1.8-12.7 3.8-18.6 5.9C38.3 196.2 0 225.4 0 255.6c0 31.2 40.8 62.5 96.3 81.5 4.5 1.5 9 3 13.6 4.3-1.5 6-2.8 11.9-4 18-10.5 55.5-2.3 99.5 23.9 114.6 27 15.6 72.4-.4 116.6-39.1 3.5-3.1 7-6.3 10.5-9.7 4.4 4.3 9 8.4 13.6 12.4 42.8 36.8 85.1 51.7 111.2 36.6 27-15.6 35.8-62.9 24.4-120.5-.9-4.4-1.9-8.9-3-13.5 3.2-.9 6.3-1.9 9.4-2.9 57.7-19.1 99.5-50 99.5-81.7 0-30.3-39.4-59.7-93.8-78.4zM282.9 92.3c37.2-32.4 71.9-45.1 87.7-36 16.9 9.7 23.4 48.9 12.8 100.4-.7 3.4-1.4 6.7-2.3 10-22.2-5-44.7-8.6-67.3-10.6-13-18.6-27.2-36.4-42.6-53.1 3.9-3.7 7.7-7.2 11.7-10.7zM167.2 307.5c5.1 8.7 10.3 17.4 15.8 25.9-15.6-1.7-31.1-4.2-46.4-7.5 4.4-14.4 9.9-29.3 16.3-44.5 4.6 8.8 9.3 17.5 14.3 26.1zm-30.3-120.3c14.4-3.2 29.7-5.8 45.6-7.8-5.3 8.3-10.5 16.8-15.4 25.4-4.9 8.5-9.7 17.2-14.2 26-6.3-14.9-11.6-29.5-16-43.6zm27.4 68.9c6.6-13.8 13.8-27.3 21.4-40.6s15.8-26.2 24.4-38.9c15-1.1 30.3-1.7 45.9-1.7s31 .6 45.9 1.7c8.5 12.6 16.6 25.5 24.3 38.7s14.9 26.7 21.7 40.4c-6.7 13.8-13.9 27.4-21.6 40.8-7.6 13.3-15.7 26.2-24.2 39-14.9 1.1-30.4 1.6-46.1 1.6s-30.9-.5-45.6-1.4c-8.7-12.7-16.9-25.7-24.6-39s-14.8-26.8-21.5-40.6zm180.6 51.2c5.1-8.8 9.9-17.7 14.6-26.7 6.4 14.5 12 29.2 16.9 44.3-15.5 3.5-31.2 6.2-47 8 5.4-8.4 10.5-17 15.5-25.6zm14.4-76.5c-4.7-8.8-9.5-17.6-14.5-26.2-4.9-8.5-10-16.9-15.3-25.2 16.1 2 31.5 4.7 45.9 8-4.6 14.8-10 29.2-16.1 43.4zM256.2 118.3c10.5 11.4 20.4 23.4 29.6 35.8-19.8-.9-39.7-.9-59.5 0 9.8-12.9 19.9-24.9 29.9-35.8zM140.2 57c16.8-9.8 54.1 4.2 93.4 39 2.5 2.2 5 4.6 7.6 7-15.5 16.7-29.8 34.5-42.9 53.1-22.6 2-45 5.5-67.2 10.4-1.3-5.1-2.4-10.3-3.5-15.5-9.4-48.4-3.2-84.9 12.6-94zm-24.5 263.6c-4.2-1.2-8.3-2.5-12.4-3.9-21.3-6.7-45.5-17.3-63-31.2-10.1-7-16.9-17.8-18.8-29.9 0-18.3 31.6-41.7 77.2-57.6 5.7-2 11.5-3.8 17.3-5.5 6.8 21.7 15 43 24.5 63.6-9.6 20.9-17.9 42.5-24.8 64.5zm116.6 98c-16.5 15.1-35.6 27.1-56.4 35.3-11.1 5.3-23.9 5.8-35.3 1.3-15.9-9.2-22.5-44.5-13.5-92 1.1-5.6 2.3-11.2 3.7-16.7 22.4 4.8 45 8.1 67.9 9.8 13.2 18.7 27.7 36.6 43.2 53.4-3.2 3.1-6.4 6.1-9.6 8.9zm24.5-24.3c-10.2-11-20.4-23.2-30.3-36.3 9.6.4 19.5.6 29.5.6 10.3 0 20.4-.2 30.4-.7-9.2 12.7-19.1 24.8-29.6 36.4zm130.7 30c-.9 12.2-6.9 23.6-16.5 31.3-15.9 9.2-49.8-2.8-86.4-34.2-4.2-3.6-8.4-7.5-12.7-11.5 15.3-16.9 29.4-34.8 42.2-53.6 22.9-1.9 45.7-5.4 68.2-10.5 1 4.1 1.9 8.2 2.7 12.2 4.9 21.6 5.7 44.1 2.5 66.3zm18.2-107.5c-2.8.9-5.6 1.8-8.5 2.6-7-21.8-15.6-43.1-25.5-63.8 9.6-20.4 17.7-41.4 24.5-62.9 5.2 1.5 10.2 3.1 15 4.7 46.6 16 79.3 39.8 79.3 58 0 19.6-34.9 44.9-84.8 61.4zm-149.7-15c25.3 0 45.8-20.5 45.8-45.8s-20.5-45.8-45.8-45.8c-25.3 0-45.8 20.5-45.8 45.8s20.5 45.8 45.8 45.8z"},child:[]}]})(r)}function Ue(r){return u({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M181.9 256.1c-5-16-4.9-46.9-2-46.9 8.4 0 7.6 36.9 2 46.9zm-1.7 47.2c-7.7 20.2-17.3 43.3-28.4 62.7 18.3-7 39-17.2 62.9-21.9-12.7-9.6-24.9-23.4-34.5-40.8zM86.1 428.1c0 .8 13.2-5.4 34.9-40.2-6.7 6.3-29.1 24.5-34.9 40.2zM248 160h136v328c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V24C0 10.7 10.7 0 24 0h200v136c0 13.2 10.8 24 24 24zm-8 171.8c-20-12.2-33.3-29-42.7-53.8 4.5-18.5 11.6-46.6 6.2-64.2-4.7-29.4-42.4-26.5-47.8-6.8-5 18.3-.4 44.1 8.1 77-11.6 27.6-28.7 64.6-40.8 85.8-.1 0-.1.1-.2.1-27.1 13.9-73.6 44.5-54.5 68 5.6 6.9 16 10 21.5 10 17.9 0 35.7-18 61.1-61.8 25.8-8.5 54.1-19.1 79-23.2 21.7 11.8 47.1 19.5 64 19.5 29.2 0 31.2-32 19.7-43.4-13.9-13.6-54.3-9.7-73.6-7.2zM377 105L279 7c-4.5-4.5-10.6-7-17-7h-6v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zm-74.1 255.3c4.1-2.7-2.5-11.9-42.8-9 37.1 15.8 42.8 9 42.8 9z"},child:[]}]})(r)}function le(r){return u({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm57.1 120H305c7.7 0 13.4 7.1 11.7 14.7l-38 168c-1.2 5.5-6.1 9.3-11.7 9.3h-38c-5.5 0-10.3-3.8-11.6-9.1-25.8-103.5-20.8-81.2-25.6-110.5h-.5c-1.1 14.3-2.4 17.4-25.6 110.5-1.3 5.3-6.1 9.1-11.6 9.1H117c-5.6 0-10.5-3.9-11.7-9.4l-37.8-168c-1.7-7.5 4-14.6 11.7-14.6h24.5c5.7 0 10.7 4 11.8 9.7 15.6 78 20.1 109.5 21 122.2 1.6-10.2 7.3-32.7 29.4-122.7 1.3-5.4 6.1-9.1 11.7-9.1h29.1c5.6 0 10.4 3.8 11.7 9.2 24 100.4 28.8 124 29.6 129.4-.2-11.2-2.6-17.8 21.6-129.2 1-5.6 5.9-9.5 11.5-9.5zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"},child:[]}]})(r)}function q(r){return u({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"},child:[]}]})(r)}function Je(r){return u({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"},child:[]}]})(r)}function Ke(r){return u({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z"},child:[]}]})(r)}function j(r){return u({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"},child:[]}]})(r)}function Ge(r){return u({attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4.708 5.578L2.061 8.224l2.647 2.646-.708.708-3-3V7.87l3-3 .708.708zm7-.708L11 5.578l2.647 2.646L11 10.87l.708.708 3-3V7.87l-3-3zM4.908 13l.894.448 5-10L9.908 3l-5 10z"},child:[]}]})(r)}function oe(r){return u({attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.984V2h-.09c-.313 0-.616.062-.909.185a2.33 2.33 0 0 0-.775.53 2.23 2.23 0 0 0-.493.753v.001a3.542 3.542 0 0 0-.198.83v.002a6.08 6.08 0 0 0-.024.863c.012.29.018.58.018.869 0 .203-.04.393-.117.572v.001a1.504 1.504 0 0 1-.765.787 1.376 1.376 0 0 1-.558.115H2v.984h.09c.195 0 .38.04.556.121l.001.001c.178.078.329.184.455.318l.002.002c.13.13.233.285.307.465l.001.002c.078.18.117.368.117.566 0 .29-.006.58-.018.869-.012.296-.004.585.024.87v.001c.033.283.099.558.197.824v.001c.106.273.271.524.494.753.223.23.482.407.775.53.293.123.596.185.91.185H6v-.984h-.09c-.2 0-.387-.038-.563-.115a1.613 1.613 0 0 1-.457-.32 1.659 1.659 0 0 1-.309-.467c-.074-.18-.11-.37-.11-.573 0-.228.003-.453.011-.672.008-.228.008-.45 0-.665a4.639 4.639 0 0 0-.055-.64 2.682 2.682 0 0 0-.168-.609A2.284 2.284 0 0 0 3.522 8a2.284 2.284 0 0 0 .738-.955c.08-.192.135-.393.168-.602.033-.21.051-.423.055-.64.008-.22.008-.442 0-.666-.008-.224-.012-.45-.012-.678a1.47 1.47 0 0 1 .877-1.354 1.33 1.33 0 0 1 .563-.121H6zm4 10.032V14h.09c.313 0 .616-.062.909-.185.293-.123.552-.3.775-.53.223-.23.388-.48.493-.753v-.001c.1-.266.165-.543.198-.83v-.002c.028-.28.036-.567.024-.863-.012-.29-.018-.58-.018-.869 0-.203.04-.393.117-.572v-.001a1.502 1.502 0 0 1 .765-.787 1.38 1.38 0 0 1 .558-.115H14v-.984h-.09c-.196 0-.381-.04-.557-.121l-.001-.001a1.376 1.376 0 0 1-.455-.318l-.002-.002a1.415 1.415 0 0 1-.307-.465v-.002a1.405 1.405 0 0 1-.118-.566c0-.29.006-.58.018-.869a6.174 6.174 0 0 0-.024-.87v-.001a3.537 3.537 0 0 0-.197-.824v-.001a2.23 2.23 0 0 0-.494-.753 2.331 2.331 0 0 0-.775-.53 2.325 2.325 0 0 0-.91-.185H10v.984h.09c.2 0 .387.038.562.115.174.082.326.188.457.32.127.134.23.29.309.467.074.18.11.37.11.573 0 .228-.003.452-.011.672-.008.228-.008.45 0 .665.004.222.022.435.055.64.033.214.089.416.168.609a2.285 2.285 0 0 0 .738.955 2.285 2.285 0 0 0-.738.955 2.689 2.689 0 0 0-.168.602c-.033.21-.051.423-.055.64a9.15 9.15 0 0 0 0 .666c.008.224.012.45.012.678a1.471 1.471 0 0 1-.877 1.354 1.33 1.33 0 0 1-.563.121H10z"},child:[]}]})(r)}function de(r){return u({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M1.125 0C.502 0 0 .502 0 1.125v21.75C0 23.498.502 24 1.125 24h21.75c.623 0 1.125-.502 1.125-1.125V1.125C24 .502 23.498 0 22.875 0zm17.363 9.75c.612 0 1.154.037 1.627.111a6.38 6.38 0 0 1 1.306.34v2.458a3.95 3.95 0 0 0-.643-.361 5.093 5.093 0 0 0-.717-.26 5.453 5.453 0 0 0-1.426-.2c-.3 0-.573.028-.819.086a2.1 2.1 0 0 0-.623.242c-.17.104-.3.229-.393.374a.888.888 0 0 0-.14.49c0 .196.053.373.156.529.104.156.252.304.443.444s.423.276.696.41c.273.135.582.274.926.416.47.197.892.407 1.266.628.374.222.695.473.963.753.268.279.472.598.614.957.142.359.214.776.214 1.253 0 .657-.125 1.21-.373 1.656a3.033 3.033 0 0 1-1.012 1.085 4.38 4.38 0 0 1-1.487.596c-.566.12-1.163.18-1.79.18a9.916 9.916 0 0 1-1.84-.164 5.544 5.544 0 0 1-1.512-.493v-2.63a5.033 5.033 0 0 0 3.237 1.2c.333 0 .624-.03.872-.09.249-.06.456-.144.623-.25.166-.108.29-.234.373-.38a1.023 1.023 0 0 0-.074-1.089 2.12 2.12 0 0 0-.537-.5 5.597 5.597 0 0 0-.807-.444 27.72 27.72 0 0 0-1.007-.436c-.918-.383-1.602-.852-2.053-1.405-.45-.553-.676-1.222-.676-2.005 0-.614.123-1.141.369-1.582.246-.441.58-.804 1.004-1.089a4.494 4.494 0 0 1 1.47-.629 7.536 7.536 0 0 1 1.77-.201zm-15.113.188h9.563v2.166H9.506v9.646H6.789v-9.646H3.375z"},child:[]}]})(r)}const Xe=(r,l)=>me({queryKey:["file-content",r,l],queryFn:async()=>{if(!r)throw new Error("File path is required");const d=new URLSearchParams;d.append("path",r),l&&d.append("projectPath",l);const h=await _(`${M}/files/read?${d.toString()}`);if(!h.ok)throw h.status===403?new Error("访问被拒绝:文件在项目目录之外"):h.status===404?new Error("文件不存在"):new Error(`读取文件失败 (${h.status})`);return h.json()},enabled:!!r,staleTime:6e4,retry:!1}),Qe=(r,l)=>me({queryKey:["file-tree-lazy",r,l],queryFn:async()=>{if(!r)throw new Error("Project path is required");const d=new URLSearchParams;d.append("path",r),l&&d.append("showHiddenFiles","true");const h=await _(`${M}/files/browse?${d.toString()}`);if(!h.ok)throw new Error("Failed to browse directory");const i=await h.json(),x=[];for(const f of i.items)f.isDirectory?x.push({...f,children:[]}):x.push(f);return x},enabled:!!r,staleTime:3e4});class Ye{events=new Map;on(l,d){this.events.has(l)||this.events.set(l,[]),this.events.get(l).push(d)}off(l,d){const h=this.events.get(l);if(h){const i=h.indexOf(d);i>-1&&h.splice(i,1)}}emit(l,...d){const h=this.events.get(l);h&&h.forEach(i=>{try{i(...d)}catch(x){console.error(`Error in event handler for ${l}:`,x)}})}clear(){this.events.clear()}}const he=new Ye,xe={AI_RESPONSE_COMPLETE:"ai_response_complete",REFRESH_AGENT_CONTENT:"refresh_agent_content"},Ze=c.lazy(()=>Se(()=>import("./monaco-editor-DHKm5-VF.js").then(r=>r.i),[])),et=new Map([["js",e.jsx(Pe,{color:"#f7df1e"},"js")],["jsx",e.jsx(We,{color:"#61dafb"},"jsx")],["ts",e.jsx(de,{color:"#3178c6"},"ts")],["tsx",e.jsx(de,{color:"#3178c6"},"tsx")],["css",e.jsx($e,{color:"#1572b6"},"css")],["html",e.jsx(ie,{color:"#e34f26"},"html")],["htm",e.jsx(ie,{color:"#e34f26"},"htm")],["json",e.jsx(oe,{color:"#f9d71c"},"json")],["jsonl",e.jsx(oe,{color:"#e6a23c"},"jsonl")],["md",e.jsx(_e,{color:"#083fa1"},"md")],["csv",e.jsx(q,{color:"#00a86b"},"csv")],["pdf",e.jsx(Ue,{color:"#d63031"},"pdf")],["ppt",e.jsx(le,{color:"#d63031"},"ppt")],["pptx",e.jsx(le,{color:"#d63031"},"pptx")],["ico",e.jsx(j,{color:"#a9a9a9"},"ico")],["png",e.jsx(j,{color:"#a9a9a9"},"png")],["jpg",e.jsx(j,{color:"#a9a9a9"},"jpg")],["jpeg",e.jsx(j,{color:"#a9a9a9"},"jpeg")],["gif",e.jsx(j,{color:"#a9a9a9"},"gif")],["svg",e.jsx(j,{color:"#a9a9a9"},"svg")],["webp",e.jsx(j,{color:"#a9a9a9"},"webp")],["py",e.jsx(qe,{color:"#3776ab"},"py")],["java",e.jsx(Be,{color:"#007396"},"java")]]),P=({node:r})=>{const l=r.data.isHidden;if(r.data.isDirectory){const x=l?"#9ca3af":"#87b3d6";return r.isOpen?e.jsx(Je,{color:x}):e.jsx(Ke,{color:x})}const d=r.data.name.split(".").pop()?.toLowerCase()||"",h=l?"#9ca3af":"#6d8a9f",i=l?{opacity:.6}:{};return e.jsx("span",{style:i,children:et.get(d)||e.jsx(q,{color:h})})},tt=(r="")=>{const l=r.toLowerCase();if(l==="dockerfile"||l.startsWith("dockerfile."))return"dockerfile";switch(r.split(".").pop()?.toLowerCase()||""){case"js":case"jsx":return"javascript";case"ts":case"tsx":return"typescript";case"css":case"scss":case"sass":case"less":return"css";case"json":case"jsonl":return"json";case"html":case"htm":return"html";case"md":case"markdown":return"markdown";case"csv":return"csv";case"py":return"python";case"java":return"java";case"xml":return"xml";case"yaml":case"yml":return"yaml";case"sh":case"bash":return"shell";case"conf":case"config":case"ini":return"ini";case"nginx":return"nginx";case"sql":return"sql";case"go":return"go";case"rs":return"rust";case"c":case"cpp":case"cc":case"cxx":return"cpp";case"h":case"hpp":return"cpp";case"cs":return"csharp";case"php":return"php";case"rb":return"ruby";case"swift":return"swift";case"kt":return"kotlin";case"dockerfile":return"dockerfile";default:return"plaintext"}},rt=({imageUrl:r,fileName:l})=>{const{t:d}=ue("components"),[h,i]=c.useState(!0),[x,f]=c.useState(!1);return e.jsx("div",{className:"flex items-center justify-center h-full p-4",children:x?e.jsxs("div",{className:"text-center text-gray-500",children:[e.jsx(j,{className:"w-12 h-12 mx-auto mb-4 text-gray-300"}),e.jsx("p",{children:d("fileExplorer.imageLoadFailed")}),e.jsx("p",{className:"text-sm mt-2",children:l})]}):e.jsxs("div",{className:"relative max-w-full max-h-full",children:[h&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(T,{className:"w-8 h-8 animate-spin text-gray-400"})}),e.jsx("img",{src:r,alt:l,className:"max-w-full max-h-full object-contain bg-white dark:bg-gray-900 rounded shadow-lg",onLoad:()=>i(!1),onError:()=>{i(!1),f(!0)},style:{display:x?"none":"block"}})]})})},st=r=>{const l=r.toLowerCase();if(l==="dockerfile"||l.startsWith("dockerfile."))return"text";const d=r.split(".").pop()?.toLowerCase()||"",h=["js","jsx","ts","tsx","css","scss","sass","less","html","htm","json","jsonl","md","markdown","txt","py","java","xml","yaml","yml","sh","bash","bat","cmd","php","rb","go","rs","cpp","c","h","hpp","cc","cxx","cs","swift","kt","scala","clj","sql","dockerfile","gitignore","env","csv","tsv","conf","config","ini","toml","nginx","apache","properties","cfg"],i=["png","jpg","jpeg","gif","svg","webp","ico","bmp","tiff"];return h.includes(d)?"text":i.includes(d)?"image":"binary"},at=({node:r,style:l,dragHandle:d,isLoading:h=!1,onDirectoryToggle:i,onFileSelect:x})=>{const f=c.useCallback(y=>{y.preventDefault(),y.stopPropagation(),r.data.isDirectory?i?.(r):x?.(r)},[r,i,x]);return e.jsxs("div",{style:l,ref:d,className:`flex items-center cursor-pointer px-3 py-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 ${r.isSelected?"bg-blue-100 dark:bg-blue-900/30 text-blue-900 dark:text-blue-300":"text-gray-700 dark:text-gray-300"}`,onClick:f,children:[r.data.isDirectory&&e.jsx("span",{className:"mr-1 flex items-center",children:h?e.jsx(T,{className:"w-3 h-3 animate-spin text-gray-400"}):e.jsx(Ve,{className:`w-3 h-3 transition-transform text-gray-400 ${r.isOpen?"rotate-90":""}`})}),e.jsx("span",{className:"mr-2 flex items-center",children:e.jsx(P,{node:r})}),e.jsx("span",{className:`text-sm truncate flex-1 ${r.data.isHidden?"text-gray-400 dark:text-gray-500 italic":"text-gray-700 dark:text-gray-300"}`,children:r.data.name}),!r.data.isDirectory&&r.data.size&&e.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500 ml-2",children:[(r.data.size/1024).toFixed(1),"KB"]})]})},F=5,mt=({projectPath:r,onFileSelect:l,className:d="",height:h="100vh"})=>{const{t:i}=ue("components"),[x,f]=c.useState([]),[y,D]=c.useState(null),[fe,W]=c.useState(600),[z,A]=c.useState(!1),k=c.useRef(null),R=c.useRef(null),I=c.useRef(null),[U,ge]=c.useState(0),[J,pe]=c.useState(""),[ye,ve]=c.useState(document.documentElement.classList.contains("dark")),[L,S]=c.useState(new Set),[N,K]=c.useState([]),[O,H]=c.useState(new Set),[g,je]=c.useState(!1),[G,X]=c.useState(!1),{data:E,isLoading:V,error:Q,refetch:C}=Qe(r,g),p=c.useMemo(()=>x.find(t=>t.isActive)||null,[x]),{data:Y,isLoading:be,error:Z}=Xe(p?p.path:void 0,r);c.useEffect(()=>{const t=new MutationObserver(s=>{s.forEach(o=>{o.attributeName==="class"&&ve(document.documentElement.classList.contains("dark"))})});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),c.useEffect(()=>{if(E){const t=m=>m.filter(a=>g||!a.isHidden).map(a=>({id:a.path,name:a.name,path:a.path,isDirectory:a.isDirectory,size:a.size,modified:a.modified,isHidden:a.isHidden,children:a.children?t(a.children):void 0})),s=(m,a=new Set)=>(m.forEach(n=>{n.isDirectory&&n.children&&n.children.length>0&&(a.add(n.path),s(n.children,a))}),a),o=s(E);S(o),K(t(E))}},[E,g]);const ee=c.useCallback(async t=>{if(!(L.has(t)||O.has(t))){H(s=>new Set(s).add(t));try{const s=new URLSearchParams;s.append("path",t),g&&s.append("showHiddenFiles","true");const o=await _(`${M}/files/browse?${s.toString()}`);if(!o.ok)throw new Error("Failed to browse directory");const m=await o.json(),a=[];for(const n of m.items)n.isDirectory?a.push({...n,children:[]}):a.push(n);K(n=>{const b=Le=>Le.map(w=>w.path===t?{...w,children:a.map(v=>({id:v.path,name:v.name,path:v.path,isDirectory:v.isDirectory,size:v.size,modified:v.modified,isHidden:v.isHidden,children:v.isDirectory?[]:void 0}))}:w.children?{...w,children:b(w.children)}:w);return b(n)}),S(n=>new Set(n).add(t)),I.current&&a.length>0&&a.forEach(n=>{n.isDirectory&&I.current?.close(n.path)})}catch(s){throw console.error("Failed to load directory children:",s),s}finally{H(s=>{const o=new Set(s);return o.delete(t),o})}}},[L,O,g]),$=c.useCallback(()=>{S(new Set),H(new Set),C()},[C]),we=c.useCallback(()=>{je(t=>!t)},[]);c.useEffect(()=>{S(new Set),H(new Set),C()},[g,C]),c.useEffect(()=>{const t=()=>{if(k.current){const m=k.current.getBoundingClientRect(),a=m.height>0?m.height:600;W(a)}};let s=null;k.current&&(s=new ResizeObserver(m=>{for(const a of m){const{height:n}=a.contentRect;n>0&&W(n)}}),s.observe(k.current));const o=setTimeout(t,100);return window.addEventListener("resize",t),()=>{clearTimeout(o),window.removeEventListener("resize",t),s&&s.disconnect()}},[E]),c.useEffect(()=>{const t=s=>{R.current&&!R.current.contains(s.target)&&A(!1)};if(z)return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[z]),c.useEffect(()=>{const t=s=>{console.log("🔄 Received AI_RESPONSE_COMPLETE event in FileExplorer:",s),s.projectPath===r&&(console.log("🔄 Auto-refreshing file tree after AI response completion"),$())};return he.on(xe.AI_RESPONSE_COMPLETE,t),()=>{he.off(xe.AI_RESPONSE_COMPLETE,t)}},[r,$]);const te=N,ke=c.useMemo(()=>{const t={},s=o=>{o.forEach(m=>{m.isDirectory&&(t[m.id]=!1,m.children&&s(m.children))})};return N&&N.length>0&&s(N),t},[N]),re=c.useCallback((t,s=!1)=>({id:`tab-${t.path}`,name:t.name,path:t.path,isPinned:s,isActive:!1}),[]),B=c.useCallback((t,s=!1)=>{f(o=>{const m=o.findIndex(a=>a.path===t.path);if(m!==-1)return o.map((a,n)=>({...a,isActive:n===m,isPinned:s||a.isPinned}));{const a=re(t,s);return!s&&y?(D(a.id),o.map(n=>n.id===y?{...a,isActive:!0}:{...n,isActive:!1})):(s||D(a.id),[...o.map(n=>({...n,isActive:!1})),{...a,isActive:!0}])}}),l?.(t.path)},[re,y,l]),se=c.useCallback(t=>{f(s=>{const o=s.findIndex(n=>n.id===t);if(o===-1)return s;const m=s[o],a=s.filter(n=>n.id!==t);if(m.isActive&&a.length>0){const n=Math.min(o,a.length-1);a[n]={...a[n],isActive:!0}}return y===t&&D(null),a})},[y]),ae=c.useCallback(t=>{f(s=>s.map(o=>({...o,isActive:o.id===t})))},[]),[ce,Ne]=c.useState({}),Ee=c.useCallback(t=>{const s=Date.now(),o=ce[t.data.path]||0;if(s-o<300)return;Ne(b=>({...b,[t.data.path]:s}));const m=t.isOpen,a=t.data.children&&t.data.children.length>0,n=L.has(t.data.path);m?t.close():!a&&!n?(t.open(),ee(t.data.path).catch(b=>{console.error("Failed to load directory children:",b),t.close()})):t.open()},[ce,L,ee]),Ce=c.useCallback(t=>{t.select();const s=Date.now(),o=s-U<300&&J===t.data.path;ge(s),pe(t.data.path),o?B(t.data,!0):setTimeout(()=>{Date.now()-s>=300&&B(t.data,!1)},300)},[B,U,J]),ze=()=>{if(!p)return e.jsx("div",{className:"flex items-center justify-center h-full text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"text-center",children:[e.jsx(q,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-gray-600"}),e.jsx("p",{children:i("fileExplorer.selectFile")})]})});if(be)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400",children:[e.jsx(T,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:i("fileExplorer.loading")})]})});if(Z)return e.jsx("div",{className:"flex items-center justify-center h-full text-red-500 dark:text-red-400",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium",children:i("fileExplorer.loadFailed")}),e.jsx("p",{className:"text-sm mt-2 bg-red-50 dark:bg-red-900/30 px-3 py-2 rounded border border-red-200 dark:border-red-800",children:Z.message}),e.jsx("p",{className:"text-xs mt-2 text-gray-500 dark:text-gray-400",children:p.path})]})});switch(st(p.name)){case"image":const s=new URLSearchParams;s.append("path",p.path),r&&s.append("projectPath",r),s.append("binary","true");const o=`${M}/files/read?${s.toString()}`;return e.jsx(rt,{imageUrl:o,fileName:p.name});case"text":return Y?e.jsx(Fe.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full text-gray-500 dark:text-gray-400",children:e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900"})}),children:e.jsx(Ze,{height:"100%",theme:ye?"vs-dark":"vs-light",language:tt(p.name),value:Y.content,options:{readOnly:!0,minimap:{enabled:!1},fontSize:14,wordWrap:"on",scrollBeyondLastLine:!1}})}):e.jsx("div",{className:"flex items-center justify-center h-full text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:i("fileExplorer.cannotReadFile")})});default:return e.jsx("div",{className:"flex items-center justify-center h-full text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Ge,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-gray-600"}),e.jsx("p",{children:i("fileExplorer.previewNotSupported")}),e.jsxs("p",{className:"text-sm mt-2",children:[i("fileExplorer.fileLabel"),": ",p.name]})]})})}};return Q?e.jsx("div",{className:`flex items-center justify-center h-full text-red-500 dark:text-red-400 ${d}`,style:{height:h},children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium",children:i("fileExplorer.loadFailed")}),e.jsx("p",{className:"text-sm mt-2 bg-red-50 dark:bg-red-900/30 px-3 py-2 rounded border border-red-200 dark:border-red-800",children:Q.message}),e.jsxs("p",{className:"text-xs mt-2 text-gray-500 dark:text-gray-400",children:[i("fileExplorer.projectPath"),": ",r]}),e.jsx("button",{onClick:()=>C(),className:"mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors",children:i("fileExplorer.retry")})]})}):e.jsxs("div",{className:`flex h-full bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden ${d}`,children:[!G&&e.jsxs("div",{className:"w-80 border-r border-gray-200 dark:border-gray-700 flex flex-col h-full",children:[e.jsx("div",{className:"h-12 px-3 border-b border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 flex items-center flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:i("fileExplorer.title")}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx("button",{onClick:we,className:`p-1.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors ${g?"text-blue-600 dark:text-blue-400":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,title:g?"隐藏文件和文件夹":"显示隐藏文件和文件夹",children:g?e.jsx(Te,{className:"w-4 h-4"}):e.jsx(Me,{className:"w-4 h-4"})}),e.jsx("button",{onClick:$,className:"p-1.5 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:i("common:actions.refresh"),disabled:V,children:e.jsx(De,{className:`w-4 h-4 ${V?"animate-spin":""}`})}),e.jsx("button",{onClick:()=>X(!0),className:"p-1.5 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:i("fileExplorer.collapsePanel"),children:e.jsx(Ae,{className:"w-4 h-4"})})]})]})}),e.jsx("div",{ref:k,className:"flex-1 min-h-0 pl-2",children:V?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400",children:[e.jsx(T,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"text-sm",children:i("fileExplorer.loading")})]})}):te.length===0?e.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:e.jsx("p",{className:"text-sm",children:i("fileExplorer.emptyDirectory")})}):e.jsx(He,{data:te,width:320,height:fe,indent:20,rowHeight:36,initialOpenState:ke,ref:I,children:t=>e.jsx(at,{...t,isLoading:O.has(t.node.data.path),onDirectoryToggle:Ee,onFileSelect:Ce})})})]}),e.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[e.jsxs("div",{className:"h-12 border-b border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 flex items-center flex-shrink-0",children:[G&&e.jsx("button",{onClick:()=>X(!1),className:"p-1.5 mx-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:i("fileExplorer.expandPanel"),children:e.jsx(Re,{className:"w-4 h-4"})}),x.length>0?e.jsxs("div",{className:"flex items-center h-full w-full",children:[e.jsx("div",{className:"flex items-center h-full flex-1",children:x.slice(0,Math.min(F,x.length)).map(t=>e.jsxs("div",{className:`group relative flex items-center h-full px-3 border-r border-gray-200 dark:border-gray-700 cursor-pointer transition-colors ${t.isActive?"bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-white":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"} ${t.isPinned?"":"italic"}`,onClick:()=>ae(t.id),title:`${t.path} ${t.isPinned?"(固定)":"(临时)"}`,style:{minWidth:"120px",maxWidth:"180px"},children:[e.jsx(P,{node:{data:{name:t.name,isDirectory:!1},isOpen:!1}}),e.jsx("span",{className:"ml-2 text-sm truncate flex-1",children:t.name}),!t.isPinned&&e.jsx("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:"•"}),e.jsx("button",{className:"ml-2 p-0.5 rounded opacity-0 group-hover:opacity-100 hover:bg-gray-200 dark:hover:bg-gray-600 transition-opacity flex-shrink-0",onClick:s=>{s.stopPropagation(),se(t.id)},title:i("common:actions.close"),children:e.jsx(ne,{className:"w-3 h-3"})})]},t.id))}),x.length>F&&e.jsxs("div",{className:"relative",ref:R,children:[e.jsxs("button",{className:"flex items-center h-full px-3 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white transition-colors border-l border-gray-200 dark:border-gray-700",onClick:()=>A(!z),title:`${x.length-F} more tabs`,children:[e.jsx(Ie,{className:"w-4 h-4"}),e.jsx(Oe,{className:"w-3 h-3 ml-1"})]}),z&&e.jsx("div",{className:"absolute top-full right-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50 min-w-48 max-h-64 overflow-y-auto",children:x.slice(F).map(t=>e.jsxs("div",{className:`flex items-center px-3 py-2 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 ${t.isActive?"bg-blue-50 dark:bg-blue-900/30 text-blue-900 dark:text-blue-300":"text-gray-700 dark:text-gray-300"} ${t.isPinned?"":"italic"}`,onClick:()=>{ae(t.id),A(!1)},title:`${t.path} ${t.isPinned?"(固定)":"(临时)"}`,children:[e.jsx(P,{node:{data:{name:t.name,isDirectory:!1},isOpen:!1}}),e.jsx("span",{className:"ml-2 truncate flex-1",children:t.name}),!t.isPinned&&e.jsx("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:"•"}),e.jsx("button",{className:"ml-2 p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-gray-200 dark:hover:bg-gray-600 transition-opacity flex-shrink-0",onClick:s=>{s.stopPropagation(),se(t.id)},title:i("common:actions.close"),children:e.jsx(ne,{className:"w-3 h-3"})})]},t.id))})]})]}):e.jsx("div",{className:"flex items-center justify-center w-full h-full text-gray-500 dark:text-gray-400",children:e.jsx("span",{className:"text-sm",children:i("fileExplorer.noFiles")})})]}),e.jsx("div",{className:"flex-1 bg-gray-50 dark:bg-gray-900 min-h-0",children:ze()})]})]})};export{xe as E,mt as F,he as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{u as m}from"./index-Bn3v3S9-.js";import{u as o}from"./tools-IcPNZlPj.js";import{M as x,w as h,x as b,G as u}from"./ui-components-D1St49qC.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-ChrA1R0y.js";const $=()=>{const{t:r,i18n:l}=o("pages"),{isMobile:t}=m(),[s,g]=d.useState(()=>localStorage.getItem("theme")||"auto"),[i,n]=d.useState(l.language);d.useEffect(()=>{n(l.language)},[l.language]),d.useEffect(()=>{(()=>{s==="dark"?document.documentElement.classList.add("dark"):s==="light"?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")})(),localStorage.setItem("theme",s),window.dispatchEvent(new Event("themechange"))},[s]);const c=a=>{n(a),l.changeLanguage(a)};return e.jsxs("div",{className:`${t?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsx("h2",{className:`${t?"text-xl":"text-2xl"} font-bold text-gray-900 dark:text-white mb-2`,children:r("settings.general.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:r("settings.general.description")})]}),e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 ${t?"p-4":"p-6"}`,children:[e.jsx("h3",{className:`${t?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white mb-4`,children:r("settings.general.interfaceSettings")}),e.jsxs("div",{className:`${t?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"block font-medium text-gray-900 dark:text-white mb-3",children:r("settings.general.theme.label")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:r("settings.general.theme.description")}),e.jsx("div",{className:`${t?"grid grid-cols-1 gap-3":"grid grid-cols-3 gap-3"}`,children:[{value:"auto",label:r("settings.general.theme.auto"),icon:x},{value:"light",label:r("settings.general.theme.light"),icon:h},{value:"dark",label:r("settings.general.theme.dark"),icon:b}].map(a=>e.jsxs("button",{onClick:()=>g(a.value),className:`${t?"p-3":"p-4"} border-2 rounded-lg flex items-center ${t?"flex-row space-x-3":"flex-col space-y-2"} transition-all ${s===a.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx(a.icon,{className:`${t?"w-5 h-5":"w-6 h-6"}`}),e.jsx("span",{className:"text-sm font-medium",children:a.label})]},a.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block font-medium text-gray-900 dark:text-white mb-3 flex items-center space-x-2",children:[e.jsx(u,{className:`${t?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:r("settings.general.language.label")})]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:r("settings.general.language.description")}),e.jsx("div",{className:`${t?"grid grid-cols-1 gap-3":"grid grid-cols-2 gap-3"}`,children:[{value:"zh-CN",label:"中文简体",flag:"🇨🇳"},{value:"en-US",label:"English",flag:"🇺🇸"}].map(a=>e.jsxs("button",{onClick:()=>c(a.value),className:`${t?"p-3":"p-4"} border-2 rounded-lg flex items-center space-x-3 transition-all ${i===a.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx("span",{className:`${t?"text-xl":"text-2xl"}`,children:a.flag}),e.jsx("span",{className:"text-sm font-medium",children:a.label})]},a.value))})]})]})]})]})};export{$ as GeneralSettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{u as n}from"./tools-IcPNZlPj.js";import{_ as l,l as d,o as r,G as o,$ as c,a0 as x,e as m,Z as g,U as h}from"./ui-components-D1St49qC.js";import{L as s}from"./index-Bn3v3S9-.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-ChrA1R0y.js";const y=()=>{const{t}=n("pages");return i.useEffect(()=>{document.title=t("landing.pageTitle");const a=document.querySelector('meta[name="description"]');a&&a.setAttribute("content",t("landing.metaDescription"))},[t]),e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-blue-50",children:[e.jsx("nav",{className:"bg-white/80 backdrop-blur-sm border-b border-gray-200 sticky top-0 z-50",children:e.jsx("div",{className:"max-w-7xl 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-bold text-gray-900",children:"AgentStudio"})]}),e.jsxs(s,{to:"/dashboard",className:"inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors duration-200",children:[t("landing.nav.enterWorkspace"),e.jsx(l,{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-7xl mx-auto text-center",children:[e.jsxs("h1",{className:"text-5xl sm:text-6xl font-bold text-gray-900 mb-6",children:[e.jsx("span",{className:"bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:t("landing.hero.title")}),e.jsx("br",{}),t("landing.hero.subtitle")]}),e.jsx("p",{className:"text-xl text-gray-600 mb-8 max-w-3xl mx-auto leading-relaxed",children:t("landing.hero.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsxs(s,{to:"/dashboard",className:"inline-flex items-center px-8 py-4 bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-xl transition-all duration-200 shadow-lg hover:shadow-xl",children:[t("landing.hero.startNow"),e.jsx(d,{className:"ml-2 w-5 h-5"})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-8 py-4 bg-white hover:bg-gray-50 text-gray-700 font-semibold rounded-xl border border-gray-300 transition-all duration-200",children:[e.jsx(r,{className:"mr-2 w-5 h-5"}),t("landing.hero.viewSource")]})]})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-white",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-4",children:t("landing.features.title")}),e.jsx("p",{className:"text-lg text-gray-600 max-w-2xl mx-auto",children:t("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-gradient-to-br from-blue-50 to-indigo-50 p-8 rounded-2xl border border-blue-100",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(o,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.modernWeb.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.modernWeb.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-purple-50 to-pink-50 p-8 rounded-2xl border border-purple-100",children:[e.jsx("div",{className:"w-12 h-12 bg-purple-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(c,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.multiModel.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.multiModel.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-green-50 to-emerald-50 p-8 rounded-2xl border border-green-100",children:[e.jsx("div",{className:"w-12 h-12 bg-green-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(x,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.agentSystem.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.agentSystem.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-orange-50 to-red-50 p-8 rounded-2xl border border-orange-100",children:[e.jsx("div",{className:"w-12 h-12 bg-orange-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(m,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.fileManagement.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.fileManagement.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-teal-50 to-cyan-50 p-8 rounded-2xl border border-teal-100",children:[e.jsx("div",{className:"w-12 h-12 bg-teal-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(g,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.professionalTools.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.professionalTools.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-gray-50 to-slate-50 p-8 rounded-2xl border border-gray-100",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(h,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.secureReliable.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.secureReliable.description")})]})]})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-white",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-6",children:t("landing.quickStart.title")}),e.jsx("p",{className:"text-lg text-gray-600 mb-8",children:t("landing.quickStart.subtitle")}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-indigo-50 p-8 rounded-2xl border border-blue-100",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:t("landing.quickStart.endUserTitle")}),e.jsx("div",{className:"bg-gray-900 rounded-lg p-4 text-left text-sm text-green-400 font-mono mb-4",children:e.jsx("div",{children:"curl -fsSL https://raw.githubusercontent.com/okguitar/agentstudio/main/scripts/remote-install.sh | bash"})}),e.jsx("p",{className:"text-gray-600 text-sm",children:t("landing.quickStart.endUserDescription")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-purple-50 to-pink-50 p-8 rounded-2xl border border-purple-100",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:t("landing.quickStart.developerTitle")}),e.jsxs("div",{className:"bg-gray-900 rounded-lg p-4 text-left text-sm text-green-400 font-mono mb-4",children:[e.jsx("div",{children:"git clone https://github.com/okguitar/agentstudio.git"}),e.jsx("div",{children:"cd agentstudio"}),e.jsx("div",{children:"pnpm install && pnpm run dev"})]}),e.jsx("p",{className:"text-gray-600 text-sm",children:t("landing.quickStart.developerDescription")})]})]})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-gradient-to-r from-blue-600 to-purple-600",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h2",{className:"text-3xl font-bold text-white mb-6",children:t("landing.cta.title")}),e.jsx("p",{className:"text-xl text-blue-100 mb-8",children:t("landing.cta.subtitle")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsxs(s,{to:"/dashboard",className:"inline-flex items-center px-8 py-4 bg-white hover:bg-gray-100 text-blue-600 font-semibold rounded-xl transition-all duration-200 shadow-lg",children:[t("landing.cta.start"),e.jsx(l,{className:"ml-2 w-5 h-5"})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-8 py-4 bg-blue-500 hover:bg-blue-400 text-white font-semibold rounded-xl border border-blue-400 transition-all duration-200",children:[e.jsx(r,{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-7xl 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-bold text-white",children:"AgentStudio"})]}),e.jsx("p",{className:"text-gray-400 mb-4 max-w-md",children:t("landing.footer.description")}),e.jsx("div",{className:"text-sm text-gray-500",children:t("landing.footer.copyright")})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:t("landing.footer.product")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx(s,{to:"/dashboard",className:"hover:text-white transition-colors",children:t("landing.footer.workspace")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio",className:"hover:text-white transition-colors",children:t("landing.footer.sourceCode")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/releases",className:"hover:text-white transition-colors",children:t("landing.footer.releases")})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:t("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/wiki",className:"hover:text-white transition-colors",children:t("landing.footer.documentation")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/issues",className:"hover:text-white transition-colors",children:t("landing.footer.issues")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/discussions",className:"hover:text-white transition-colors",children:t("landing.footer.discussions")})})]})]})]})})})]})};export{y as default};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{e as ae,f as ne,g as le,r as ie}from"./index-Bn3v3S9-.js";import{j as M,s as $,k as I,C as J,t as de,I as P,a7 as U,a2 as F,a8 as oe,n as ce,v as xe,p as ue}from"./ui-components-D1St49qC.js";import{u as ge}from"./tools-IcPNZlPj.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-ChrA1R0y.js";const B=({error:s,title:m="Error occurred",showDetails:f=!0})=>{const[h,p]=d.useState(!1),[u,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
|
+
|
|
3
|
+
Details:
|
|
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(M,{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($,{className:"w-3 h-3"}),e.jsx("span",{children:"Hide Details"})]}):e.jsxs(e.Fragment,{children:[e.jsx(I,{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:u?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"w-3 h-3"}),e.jsx("span",{children:"Copied!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{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 je(){const{t:s}=ge("pages"),[m,f]=d.useState(""),{login:h,loginWithoutPassword:p,isLoading:u,error:g,checkPasswordRequired:q}=ae(),{services:a,currentService:c,switchService:w,addService:r,updateService:n,removeService:b}=ne(),G=le(),[y,H]=d.useState(!1),[W,j]=d.useState(!1),[X,N]=d.useState(null),[o,x]=d.useState({name:"",url:""}),[E,T]=d.useState(null),[A,O]=d.useState({}),[z,k]=d.useState(!0),[R,v]=d.useState(!0),[K,D]=d.useState(!1),S=G.state?.from?.pathname||"/";d.useEffect(()=>{let t=!0;return(async()=>{if(!c){k(!1);return}k(!0),D(!1);try{const i=await q();if(!t)return;i.success?(v(i.passwordRequired),!i.passwordRequired&&!K&&(D(!0),await p()&&t&&(window.location.href=S))):v(!0)}catch(i){console.error("Failed to check password requirement:",i),t&&v(!0)}finally{t&&k(!1)}})(),()=>{t=!1}},[c?.id]);const Q=async(t,l)=>{l&&T(l);try{const i=`${t}/api/health`,L=(await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(5e3)})).ok?"success":"error";return l&&O(re=>({...re,[l]:L})),L==="success"}catch{return l&&O(C=>({...C,[l]:"error"})),!1}finally{T(null)}},V=t=>{w(t),window.location.reload()},Y=()=>{o.name.trim()&&o.url.trim()&&(r({name:o.name.trim(),url:o.url.trim()}),x({name:"",url:""}),j(!1))},Z=t=>{o.name.trim()&&o.url.trim()&&(n(t,{name:o.name.trim(),url:o.url.trim()}),x({name:"",url:""}),N(null))},_=t=>{b(t)},ee=(t,l,i)=>{N(t),x({name:l,url:i})},te=async t=>{t.preventDefault(),await h(m)&&(window.location.href=S)},se=()=>{ie(),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(P,{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})]})})]}),z?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","正在检查连接...")})]})}):!R&&u?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(U,{className:"w-6 h-6 text-green-500"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("login.autoLoggingIn","正在自动登录...")})]})}):R?e.jsxs("form",{onSubmit:te,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
|
|
5
|
+
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
6
|
+
focus:ring-2 focus:ring-blue-500 focus:border-transparent
|
|
7
|
+
placeholder-gray-400 dark:placeholder-gray-500
|
|
8
|
+
transition-colors`})]}),g&&e.jsx(B,{error:g,title:"Login failed",showDetails:!0}),e.jsx("button",{type:"submit",disabled:u||!m,className:`w-full py-3 px-4 rounded-lg font-medium text-white
|
|
9
|
+
bg-blue-600 hover:bg-blue-700
|
|
10
|
+
disabled:bg-gray-400 disabled:cursor-not-allowed
|
|
11
|
+
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
|
|
12
|
+
transition-colors`,children:s(u?"login.loggingIn":"login.loginButton")})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"p-4 bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-200 dark:border-green-800",children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(U,{className:"w-5 h-5 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-sm text-green-700 dark:text-green-300",children:s("login.noPasswordRequired","此服务未设置密码,可直接登录")})]})}),g&&e.jsx(B,{error:g,title:"Login failed",showDetails:!0}),e.jsx("button",{onClick:async()=>{await p()&&(window.location.href=S)},disabled:u,className:`w-full py-3 px-4 rounded-lg font-medium text-white
|
|
13
|
+
bg-green-600 hover:bg-green-700
|
|
14
|
+
disabled:bg-gray-400 disabled:cursor-not-allowed
|
|
15
|
+
focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2
|
|
16
|
+
transition-colors`,children:u?s("login.loggingIn"):s("login.enterSystem","进入系统")})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s("login.footer")})}),e.jsxs("div",{className:"mt-6 border-t border-gray-200 dark:border-gray-700 pt-6",children:[e.jsxs("button",{onClick:()=>H(!y),className:"w-full flex items-center justify-between text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200",children:[e.jsxs("span",{className:"flex items-center space-x-2",children:[e.jsx(F,{className:"w-4 h-4"}),e.jsx("span",{children:s("login.manageServices")})]}),y?e.jsx($,{className:"w-4 h-4"}):e.jsx(I,{className:"w-4 h-4"})]}),e.jsxs("button",{onClick:se,className:"w-full mt-3 flex items-center justify-center space-x-2 text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors",children:[e.jsx(oe,{className:"w-4 h-4"}),e.jsx("span",{children:s("login.rerunOnboarding")})]}),y&&e.jsxs("div",{className:"mt-4 space-y-3",children:[a.map(t=>e.jsx("div",{className:`p-3 rounded-lg border ${t.id===c?.id?"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800":"bg-gray-50 dark:bg-gray-700/50 border-gray-200 dark:border-gray-600"}`,children:X===t.id?e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{type:"text",value:o.name,onChange:l=>x(i=>({...i,name:l.target.value})),placeholder:s("login.serviceName"),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),e.jsx("input",{type:"url",value:o.url,onChange:l=>x(i=>({...i,url:l.target.value})),placeholder:s("login.serviceUrl"),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx("button",{onClick:()=>Z(t.id),className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700",children:s("login.save")}),e.jsx("button",{onClick:()=>{N(null),x({name:"",url:""})},className:"px-2 py-1 text-xs bg-gray-500 text-white rounded hover:bg-gray-600",children:s("login.cancel")})]})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-start 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("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:t.name}),t.id===c?.id&&e.jsx("span",{className:"text-xs text-blue-600 dark:text-blue-400",children:s("login.current")})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate mt-1",children:t.url}),e.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[E===t.id?e.jsx("div",{className:"w-3 h-3 border-2 border-blue-600 border-t-transparent rounded-full animate-spin"}):A[t.id]==="success"?e.jsx(J,{className:"w-3 h-3 text-green-500"}):A[t.id]==="error"?e.jsx(ce,{className:"w-3 h-3 text-red-500"}):e.jsx(M,{className:"w-3 h-3 text-gray-400"}),e.jsx("button",{onClick:()=>Q(t.url,t.id),disabled:E===t.id,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-50",children:s("login.testConnection")})]})]}),e.jsxs("div",{className:"flex space-x-1 ml-2",children:[t.id!==c?.id&&e.jsx("button",{onClick:()=>V(t.id),className:"p-1 text-blue-600 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/30 rounded",title:s("login.switchTo"),children:e.jsx(P,{className:"w-3 h-3"})}),!t.isDefault&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>ee(t.id,t.name,t.url),className:"p-1 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-600 rounded",title:s("login.edit"),children:e.jsx(F,{className:"w-3 h-3"})}),e.jsx("button",{onClick:()=>_(t.id),className:"p-1 text-red-600 dark:text-red-400 hover:bg-red-100 dark:hover:bg-red-900/30 rounded",title:s("login.delete"),children:e.jsx(xe,{className:"w-3 h-3"})})]})]})]})})},t.id)),W?e.jsxs("div",{className:"p-3 rounded-lg border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50 space-y-2",children:[e.jsx("input",{type:"text",value:o.name,onChange:t=>x(l=>({...l,name:t.target.value})),placeholder:s("login.serviceName"),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white",autoFocus:!0}),e.jsx("input",{type:"url",value:o.url,onChange:t=>x(l=>({...l,url:t.target.value})),placeholder:s("login.serviceUrl"),className:"w-full px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx("button",{onClick:Y,className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700",children:s("login.add")}),e.jsx("button",{onClick:()=>{j(!1),x({name:"",url:""})},className:"px-2 py-1 text-xs bg-gray-500 text-white rounded hover:bg-gray-600",children:s("login.cancel")})]})]}):e.jsxs("button",{onClick:()=>j(!0),className:"w-full flex items-center justify-center space-x-2 p-3 text-sm text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 border border-dashed border-blue-300 dark:border-blue-700 rounded-lg",children:[e.jsx(ue,{className:"w-4 h-4"}),e.jsx("span",{children:s("login.addService")})]})]})]})]})})})}export{je as LoginPage};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{a as A,b as c}from"./index-Bn3v3S9-.js";import{u as Ce,b as U,c as S,A as d}from"./agents-ChrA1R0y.js";import{u as Te}from"./tools-IcPNZlPj.js";import{H as $e,R as Ee,I as Pe,C as Fe,j as ze,K as Z,p as De,J as qe,E as Le,t as _,N as Me,O as Ie,d as Re,v as Oe,Q as Qe,U as ee}from"./ui-components-D1St49qC.js";import"./syntax-highlighting-CnREyncB.js";async function Be(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/status`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch status");return r.json()}async function Ue(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/keys`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch keys");return r.json()}async function _e(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/tools`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch tools");return r.json()}async function He(s){const r=localStorage.getItem("authToken"),l=await fetch(`${d}/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 Je(s){const r=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}})).ok)throw new Error("Failed to revoke key")}async function Ve(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${d}/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 Ge(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${d}/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 te(s){const r=localStorage.getItem("authToken"),l=await fetch(`${d}/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 at=()=>{const{t:s}=Te("pages"),r=Ce(),[l,u]=i.useState(!1),[se,K]=i.useState(!1),[C,T]=i.useState(""),[y,H]=i.useState(null),[o,$]=i.useState(null),[b,J]=i.useState("cursor"),[E,ae]=i.useState(new Set),[re,P]=i.useState(!1),[F,V]=i.useState(null),[m,j]=i.useState(new Set),[h,z]=i.useState(!1),[ne,D]=i.useState(!1),[q,L]=i.useState(null),[G,W]=i.useState(""),[x,f]=i.useState(new Set),[p,M]=i.useState(!1),[ie,X]=i.useState(null),{data:N,isLoading:le,refetch:de}=U({queryKey:["mcpAdminStatus"],queryFn:Be}),{data:ce,isLoading:oe,refetch:me}=U({queryKey:["mcpAdminKeys"],queryFn:Ue}),{data:xe,isLoading:ge}=U({queryKey:["mcpAdminTools"],queryFn:_e}),I=S({mutationFn:He,onSuccess:async t=>{H(t.key),u(!1),T(""),j(new Set),z(!1),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]});try{const a=await te(t.key);$(a),K(!0)}catch{c(s("settings.mcpAdmin.errors.configFetch"))}},onError:t=>{c(s("settings.mcpAdmin.errors.createFailed"),t instanceof Error?t.message:void 0)}}),he=S({mutationFn:Je,onSuccess:()=>{A(s("settings.mcpAdmin.success.keyRevoked")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{c(s("settings.mcpAdmin.errors.revokeFailed"),t instanceof Error?t.message:void 0)}}),R=S({mutationFn:({keyId:t,data:a})=>Ve(t,a),onSuccess:()=>{A(s("settings.mcpAdmin.success.keyUpdated")),D(!1),L(null),r.invalidateQueries({queryKey:["mcpAdminKeys"]})},onError:t=>{c(s("settings.mcpAdmin.errors.updateFailed"),t instanceof Error?t.message:void 0)}}),pe=S({mutationFn:({keyId:t,enabled:a})=>Ge(t,a),onSuccess:(t,a)=>{A(a.enabled?s("settings.mcpAdmin.success.keyEnabled"):s("settings.mcpAdmin.success.keyDisabled")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{c(s("settings.mcpAdmin.errors.toggleFailed"),t instanceof Error?t.message:void 0)}}),ue=()=>{if(!C.trim()){c(s("settings.mcpAdmin.errors.descriptionRequired"));return}I.mutate({description:C.trim(),permissions:["admin:*"],allowedTools:h&&m.size>0?Array.from(m):void 0})},ye=t=>{j(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},be=()=>{j(new Set(k.map(t=>t.name)))},je=()=>{j(new Set)},fe=t=>{L(t),W(t.description),t.allowedTools&&t.allowedTools.length>0?(M(!0),f(new Set(t.allowedTools))):(M(!1),f(new Set)),D(!0)},ke=()=>{q&&R.mutate({keyId:q.id,data:{description:G.trim()||void 0,allowedTools:p&&x.size>0?Array.from(x):[]}})},ve=t=>{f(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},we=t=>{pe.mutate({keyId:t.id,enabled:!t.enabled})},Ne=t=>{confirm(s("settings.mcpAdmin.confirmRevoke"))&&he.mutate(t)},O=async t=>{try{await navigator.clipboard.writeText(t),A(s("settings.mcpAdmin.success.copied"))}catch{c(s("settings.mcpAdmin.errors.copyFailed"))}},Ae=t=>{ae(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},Se=async t=>{if(t.fullKey)try{const a=await te(t.fullKey);$(a),V(t.fullKey),K(!0)}catch{c(s("settings.mcpAdmin.errors.configFetch"))}},Y=ce?.keys||[],k=xe?.tools||[],Ke=(t,a="right")=>{const n=t.inputSchema?.properties||{},v=t.inputSchema?.required||[],g=Object.entries(n),w=a==="right"?"left-full ml-2":"right-full mr-2";return e.jsxs("div",{className:`absolute z-50 ${w} 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,B])=>e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-mono text-green-400",children:Q}),v.includes(Q)&&e.jsx("span",{className:"text-red-400 ml-1",children:"*"}),e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",B.type,")"]}),B.description&&e.jsx("p",{className:"text-gray-400 ml-2 mt-0.5",children:B.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:()=>P(!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($e,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.help.button")})]}),e.jsxs("button",{onClick:()=>{de(),me()},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(Ee,{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(Pe,{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")})]}),le?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"})]}):N?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(Fe,{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:N.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:N.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:N.activeKeyCount})]})]}):e.jsxs("div",{className:"flex items-center space-x-2 text-red-500",children:[e.jsx(ze,{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:[d,"/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(Z,{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:()=>u(!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(De,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.createKey")})]})]}),oe?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))}):Y.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Z,{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:Y.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:E.has(t.id)&&t.fullKey?t.fullKey:t.maskedKey}),!t.isRevoked&&t.fullKey&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Ae(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:E.has(t.id)?s("settings.mcpAdmin.hideKey"):s("settings.mcpAdmin.showKey"),children:E.has(t.id)?e.jsx(qe,{className:"w-4 h-4"}):e.jsx(Le,{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(_,{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:()=>we(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(Me,{className:"w-4 h-4"}):e.jsx(Ie,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>fe(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(Re,{className:"w-4 h-4"})}),t.fullKey&&e.jsx("button",{onClick:()=>Se(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:()=>Ne(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(Oe,{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(Qe,{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")})]}),ge?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:k.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:()=>X(t),onMouseLeave:()=>X(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})]}),ie?.name===t.name&&Ke(t,n?"left":"right")]},t.name)})})]}),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.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:C,onChange:t=>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
|
+
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
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=>z(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:be,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:je,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:k.map(t=>{const a=Object.entries(t.inputSchema?.properties||{}),n=a.length>0?`
|
|
4
|
+
${s("settings.mcpAdmin.toolParams")}: ${a.map(([g,w])=>`${g}(${w.type})`).join(", ")}`:"",v=`${t.description}${n}`;return e.jsxs("label",{title:v,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:()=>ye(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(ee,{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:()=>{u(!1),T(""),j(new Set),z(!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:ue,disabled:I.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:I.isPending?s("settings.mcpAdmin.creating"):s("settings.mcpAdmin.create")})]})]})}),se&&o&&(y||F)&&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(y?"settings.mcpAdmin.keyCreated":"settings.mcpAdmin.configTitle")}),y&&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:y||F}),e.jsx("button",{onClick:()=>O(y||F||""),className:"p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:e.jsx(_,{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 ${b==="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 ${b==="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:b==="cursor"?o.cursor.configPath:o.claudeDesktop.configPath})]}),e.jsxs("button",{onClick:()=>O(b==="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(_,{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:b==="cursor"?o.cursor.configString:o.claudeDesktop.configString})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx("button",{onClick:()=>{K(!1),H(null),V(null),$(null)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg",children:s("settings.mcpAdmin.done")})})]})}),ne&&q&&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:G,onChange:t=>W(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
|
|
5
|
+
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
6
|
+
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:p,onChange:t=>M(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")})]}),p&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("button",{onClick:()=>f(new Set(k.map(t=>t.name))),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:()=>f(new Set),className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.deselectAll")})]})]}),p&&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:k.map(t=>{const a=Object.entries(t.inputSchema?.properties||{}),n=a.length>0?`
|
|
7
|
+
${s("settings.mcpAdmin.toolParams")}: ${a.map(([g,w])=>`${g}(${w.type})`).join(", ")}`:"",v=`${t.description}${n}`;return e.jsxs("label",{title:v,className:`flex items-center space-x-2 p-2 rounded-lg cursor-pointer transition-colors ${x.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:x.has(t.name),onChange:()=>ve(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)})}),x.size>0&&e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.selectedToolsCount",{count:x.size})})]}),!p&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(ee,{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:()=>{D(!1),L(null)},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:ke,disabled:R.isPending||p&&x.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.saving"):s("settings.mcpAdmin.save")})]})]})}),re&&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-3xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.help.title")}),e.jsx("button",{onClick:()=>P(!1),className:"p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:"×"})]}),e.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.whatIs")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:s("settings.mcpAdmin.help.whatIsDesc")}),e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.howToUse")}),e.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-gray-600 dark:text-gray-400 mb-4",children:[e.jsx("li",{children:s("settings.mcpAdmin.help.step1")}),e.jsx("li",{children:s("settings.mcpAdmin.help.step2")}),e.jsx("li",{children:s("settings.mcpAdmin.help.step3")}),e.jsx("li",{children:s("settings.mcpAdmin.help.step4")})]}),e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.availableTools")}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-gray-600 dark:text-gray-400 mb-4",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"list_projects"})," - ",s("settings.mcpAdmin.help.toolListProjects")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"get_project"})," - ",s("settings.mcpAdmin.help.toolGetProject")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"list_agents"})," - ",s("settings.mcpAdmin.help.toolListAgents")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"get_agent"})," - ",s("settings.mcpAdmin.help.toolGetAgent")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"health_check"})," - ",s("settings.mcpAdmin.help.toolHealthCheck")]})]}),e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.examples")}),e.jsxs("div",{className:"bg-gray-100 dark:bg-gray-900 rounded-lg p-4 mb-4",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:s("settings.mcpAdmin.help.examplePrompt")}),e.jsx("code",{className:"text-sm text-purple-600 dark:text-purple-400",children:'"请帮我列出 AgentStudio 中所有的项目"'})]})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx("button",{onClick:()=>P(!1),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg",children:s("settings.mcpAdmin.done")})})]})})]})};export{at as McpAdminSettingsPage};
|