agentstudio 0.1.21 → 0.1.22
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/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{AgentsPage-Nvg2xu6K.js → AgentsPage-CtuoPrly.js} +2 -2
- package/public/assets/{Button-Co56C389.js → Button-DtXXTa68.js} +1 -1
- package/public/assets/{ChatPage-D6sol0ad.js → ChatPage-Ht-lF7H1.js} +178 -149
- package/public/assets/CloudflareTunnelPage-BJNk2Ilw.js +1 -0
- package/public/assets/{CommandForm-Bk7F_HU8.js → CommandForm-hHwraC0y.js} +1 -1
- package/public/assets/{CommandsPage-DZHyOdKd.js → CommandsPage-DLySuqrX.js} +1 -1
- package/public/assets/DashboardPage-BuUwTPV6.js +1 -0
- package/public/assets/{FileBrowser-BYweUPH4.js → FileBrowser-CDuDggHj.js} +5 -5
- package/public/assets/{FileExplorer-DNYj6Tsx.js → FileExplorer-D5l2HgDS.js} +1 -1
- package/public/assets/{GeneralSettingsPage-D9Xa7Nd8.js → GeneralSettingsPage-EODcSgWo.js} +1 -1
- package/public/assets/LandingPage-BAPul_Kj.js +1 -0
- package/public/assets/{LoginPage-DcaGNCXH.js → LoginPage-CQo-eq6b.js} +4 -4
- package/public/assets/McpAdminSettingsPage-BlEhZLV9.js +7 -0
- package/public/assets/{McpPage-CtWf1CoL.js → McpPage-DLMLfSAG.js} +4 -4
- package/public/assets/{MemorySettingsPage-JTry4Ccp.js → MemorySettingsPage-By_AtsBT.js} +1 -1
- package/public/assets/{PluginsPage-D-BHjQ3P.js → PluginsPage-1Z4TkAow.js} +1 -1
- package/public/assets/ProjectSelector-2mn8IO5d.js +1 -0
- package/public/assets/{ProjectsPage-lLUk4-Xa.js → ProjectsPage-CWWZuVNb.js} +5 -5
- package/public/assets/ScheduledTasksPage-BcosBF2P.js +1 -0
- package/public/assets/SettingsLayout-a2GRHdeo.js +1 -0
- package/public/assets/SkillsPage-zIEnU63B.js +18 -0
- package/public/assets/{SubagentForm-BdUK1U4y.js → SubagentForm-DEzelVPW.js} +1 -1
- package/public/assets/{SubagentsPage-Dnq70IFd.js → SubagentsPage-CS6hYApE.js} +1 -1
- package/public/assets/{ToastTestPage-BfJQRFIm.js → ToastTestPage-7Uhhhl-X.js} +1 -1
- package/public/assets/{ToolsList-Dl5F2fWk.js → ToolsList-I7JqIU7m.js} +1 -1
- package/public/assets/UnifiedToolSelector-Cw1xKmPZ.js +1 -0
- package/public/assets/{VersionSettingsPage-BfoCcham.js → VersionSettingsPage-7qtAfOC7.js} +3 -3
- package/public/assets/{_basePickBy-7C_e0Xv1.js → _basePickBy-DQTDhNdw.js} +1 -1
- package/public/assets/{_baseUniq-eGJNLBzx.js → _baseUniq-B_gfAzTb.js} +1 -1
- package/public/assets/{agents-ChrA1R0y.js → agents-B3InAIfY.js} +1 -1
- package/public/assets/{arc-CuA752eE.js → arc-Do_7w4P3.js} +1 -1
- package/public/assets/architectureDiagram-VXUJARFQ-CGxYnv44.js +36 -0
- package/public/assets/{blockDiagram-VD42YOAC-72nsMt_i.js → blockDiagram-VD42YOAC-DMToAyob.js} +1 -1
- package/public/assets/{c4Diagram-YG6GDRKO-BNJSAXcg.js → c4Diagram-YG6GDRKO-CEukDAnl.js} +1 -1
- package/public/assets/channel-Cr4EWrFf.js +1 -0
- package/public/assets/{chunk-4BX2VUAB-RPxkCWhH.js → chunk-4BX2VUAB-Djex-iWv.js} +1 -1
- package/public/assets/{chunk-55IACEB6-3ePDt0kp.js → chunk-55IACEB6-Dq-JM11t.js} +1 -1
- package/public/assets/{chunk-B4BG7PRW-CBg_BBfl.js → chunk-B4BG7PRW-COcDV1Bz.js} +1 -1
- package/public/assets/{chunk-DI55MBZ5-DIh69TUJ.js → chunk-DI55MBZ5-AiToZLMc.js} +1 -1
- package/public/assets/{chunk-FMBD7UC4-BbjwhyTe.js → chunk-FMBD7UC4-CIUbRtI8.js} +1 -1
- package/public/assets/{chunk-QN33PNHL-BpH-o_YR.js → chunk-QN33PNHL-DWVKAIM5.js} +1 -1
- package/public/assets/{chunk-QZHKN3VN-DYB7rh5Q.js → chunk-QZHKN3VN-CH3FeiqK.js} +1 -1
- package/public/assets/{chunk-TZMSLE5B-DPCYEVb3.js → chunk-TZMSLE5B-DAEUDEL5.js} +1 -1
- package/public/assets/classDiagram-2ON5EDUG-BCYMgV2U.js +1 -0
- package/public/assets/classDiagram-v2-WZHVMYZB-BCYMgV2U.js +1 -0
- package/public/assets/clone-T66nRwp8.js +1 -0
- package/public/assets/cose-bilkent-S5V4N54A-CyCeb_x1.js +1 -0
- package/public/assets/dagre-6UL2VRFP-D2pLZr7B.js +4 -0
- package/public/assets/diagram-PSM6KHXK-D3y-uGlf.js +24 -0
- package/public/assets/diagram-QEK2KX5R-BWiK1jr7.js +43 -0
- package/public/assets/diagram-S2PKOQOG-Cbs-OyQV.js +24 -0
- package/public/assets/{erDiagram-Q2GNP2WA-BX1DpOGx.js → erDiagram-Q2GNP2WA-mmj7cEQ3.js} +1 -1
- package/public/assets/{flowDiagram-NV44I4VS-HAAlzNbq.js → flowDiagram-NV44I4VS-C-D2yYgt.js} +1 -1
- package/public/assets/ganttDiagram-LVOFAZNH-CjVweKuf.js +267 -0
- package/public/assets/gitGraphDiagram-NY62KEGX-B5Fajpr9.js +65 -0
- package/public/assets/{graph-m515btDj.js → graph-BkrzwQTG.js} +1 -1
- package/public/assets/{index-Bn3v3S9-.js → index-C8oBHB0h.js} +41 -41
- package/public/assets/index-C9P0ZrJZ.css +1 -0
- package/public/assets/infoDiagram-F6ZHWCRC-KYBfowoc.js +2 -0
- package/public/assets/{journeyDiagram-XKPGCS4Q-BfzTomS0.js → journeyDiagram-XKPGCS4Q-G0GXThg3.js} +1 -1
- package/public/assets/{kanban-definition-3W4ZIXB7-Cgju7b-L.js → kanban-definition-3W4ZIXB7-CL5GnHw8.js} +1 -1
- package/public/assets/{layout-BKQfQSxJ.js → layout-Dv8_9WGx.js} +1 -1
- package/public/assets/{linear-DigtLz3B.js → linear-Bo6VfLsh.js} +1 -1
- package/public/assets/{mindmap-definition-VGOIOE7T-qopraVFy.js → mindmap-definition-VGOIOE7T-Bs3tu0GR.js} +1 -1
- package/public/assets/{pieDiagram-ADFJNKIX-BcoaAI-L.js → pieDiagram-ADFJNKIX-Cb8bwKps.js} +1 -1
- package/public/assets/{quadrantDiagram-AYHSOK5B-D-DwcoSd.js → quadrantDiagram-AYHSOK5B-Dbrv0MtL.js} +1 -1
- package/public/assets/{requirementDiagram-UZGBJVZJ-DbQCpx77.js → requirementDiagram-UZGBJVZJ-nBiRIqA6.js} +1 -1
- package/public/assets/sankeyDiagram-TZEHDZUN-CxJ9tzJO.js +10 -0
- package/public/assets/{sequenceDiagram-WL72ISMW-BdzICjxO.js → sequenceDiagram-WL72ISMW-Cd7CbJ23.js} +1 -1
- package/public/assets/stateDiagram-FKZM4ZOC-BUzdDNZC.js +1 -0
- package/public/assets/stateDiagram-v2-4FDKWEC3-TEx1vYfv.js +1 -0
- package/public/assets/{table-D0L2RL5i.js → table-CHBLEjZn.js} +1 -1
- package/public/assets/{timeline-definition-IT6M3QCI-BAvjPYvX.js → timeline-definition-IT6M3QCI-DJ3qh1sp.js} +1 -1
- package/public/assets/{tools-IcPNZlPj.js → tools-CUwQTL-8.js} +1 -1
- package/public/assets/{treemap-KMMF4GRG-DtkpVA56.js → treemap-KMMF4GRG-pUUUNNXu.js} +1 -1
- package/public/assets/{ui-components-D1St49qC.js → ui-components-icUM6BEH.js} +110 -110
- package/public/assets/{useAgents-BnDTkOG8.js → useAgents-HXlzUYSz.js} +2 -2
- package/public/assets/{useClaudeVersions-CD59tFWM.js → useClaudeVersions-DQ5Wg6Zy.js} +1 -1
- package/public/assets/{useCommands-mvMu3mMD.js → useCommands-vX47i_1v.js} +1 -1
- package/public/assets/{useProjects-YXOjaOwL.js → useProjects-DR0CTJHB.js} +1 -1
- package/public/assets/useSessions-CanqFxtL.js +1 -0
- package/public/assets/{xychartDiagram-PRI3JC2R-ByBTDWE2.js → xychartDiagram-PRI3JC2R-HeLAL-7k.js} +1 -1
- package/public/index.html +5 -5
- package/public/screenshot-chat.png +0 -0
- package/public/screenshot-mcp.png +0 -0
- package/routes/agents.d.ts.map +1 -1
- package/routes/agents.js +17 -0
- package/routes/agents.js.map +1 -1
- package/routes/cloudflareTunnel.d.ts +4 -0
- package/routes/cloudflareTunnel.d.ts.map +1 -0
- package/routes/cloudflareTunnel.js +250 -0
- package/routes/cloudflareTunnel.js.map +1 -0
- package/services/claudeSession.d.ts +9 -0
- package/services/claudeSession.d.ts.map +1 -1
- package/services/claudeSession.js +16 -0
- package/services/claudeSession.js.map +1 -1
- package/services/sessionManager.d.ts +6 -0
- package/services/sessionManager.d.ts.map +1 -1
- package/services/sessionManager.js +37 -2
- package/services/sessionManager.js.map +1 -1
- package/public/assets/DashboardPage-29qC7Ev1.js +0 -15
- package/public/assets/LandingPage-CjnT-cvO.js +0 -1
- package/public/assets/McpAdminSettingsPage-DgR3E2Bd.js +0 -7
- package/public/assets/ProjectSelector-DSXOjMQC.js +0 -1
- package/public/assets/ScheduledTasksPage-5hPbd9Vs.js +0 -1
- package/public/assets/SettingsLayout-DGJspXLp.js +0 -1
- package/public/assets/SkillsPage-DBw0m7D2.js +0 -18
- package/public/assets/UnifiedToolSelector-CNbPsiuq.js +0 -1
- package/public/assets/architectureDiagram-VXUJARFQ-BnPYh1OW.js +0 -36
- package/public/assets/channel-CIunGC5m.js +0 -1
- package/public/assets/classDiagram-2ON5EDUG-aUQHFsTA.js +0 -1
- package/public/assets/classDiagram-v2-WZHVMYZB-aUQHFsTA.js +0 -1
- package/public/assets/clone-Ckf7tA1V.js +0 -1
- package/public/assets/cose-bilkent-S5V4N54A-CnpfmL-Y.js +0 -1
- package/public/assets/dagre-6UL2VRFP-DR9x77Xf.js +0 -4
- package/public/assets/diagram-PSM6KHXK-SONPsQNx.js +0 -24
- package/public/assets/diagram-QEK2KX5R-BKYFSfC1.js +0 -43
- package/public/assets/diagram-S2PKOQOG-CkM0APZj.js +0 -24
- package/public/assets/ganttDiagram-LVOFAZNH-BqzWexqa.js +0 -267
- package/public/assets/gitGraphDiagram-NY62KEGX-CIPmSp43.js +0 -65
- package/public/assets/index-DWieeYj4.css +0 -1
- package/public/assets/infoDiagram-F6ZHWCRC-Pn4yNWrF.js +0 -2
- package/public/assets/sankeyDiagram-TZEHDZUN-BVk8387S.js +0 -10
- package/public/assets/stateDiagram-FKZM4ZOC-CYY-uUvJ.js +0 -1
- package/public/assets/stateDiagram-v2-4FDKWEC3-Dh2Kvomq.js +0 -1
- package/public/assets/tabManager-B2LQO_Ll.js +0 -30
|
@@ -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 h}from"./tools-CUwQTL-8.js";import{e as p,a9 as y,aa as j,Z as c,a3 as t,z as m,H as b,a1 as r,G as u,ab as N,f as k,o as g,m as f,ac as w,r as v,X as s}from"./ui-components-icUM6BEH.js";import{L as o}from"./index-C8oBHB0h.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-B3InAIfY.js";const W=()=>{const{t:a}=h("pages"),[l,n]=i.useState(!1),d=()=>{navigator.clipboard.writeText("npm install -g agentstudio && agentstudio start"),n(!0),setTimeout(()=>n(!1),2e3)};return i.useEffect(()=>{document.title=a("landing.pageTitle");const x=document.querySelector('meta[name="description"]');x&&x.setAttribute("content",a("landing.metaDescription"))},[a]),e.jsxs("div",{className:"min-h-screen bg-white dark:bg-gray-950",children:[e.jsx("nav",{className:"bg-white/90 dark:bg-gray-950/90 backdrop-blur-sm border-b border-gray-100 dark:border-gray-800 sticky top-0 z-50",children:e.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex justify-between items-center h-16",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"AgentStudio"})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(p,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:a("landing.nav.docs")})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(y,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"GitHub"})]}),e.jsxs(o,{to:"/dashboard",className:"inline-flex items-center px-4 py-2 bg-gray-900 dark:bg-white hover:bg-gray-800 dark:hover:bg-gray-100 text-white dark:text-gray-900 font-medium rounded-lg transition-colors duration-200",children:[a("landing.nav.enterWorkspace"),e.jsx(j,{className:"ml-2 w-4 h-4"})]})]})]})})}),e.jsx("section",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800 text-sm text-gray-600 dark:text-gray-400 mb-6",children:[e.jsx(c,{className:"w-4 h-4 mr-2 text-amber-500"}),a("landing.hero.badge")]}),e.jsx("h1",{className:"text-4xl sm:text-5xl lg:text-6xl font-bold text-gray-900 dark:text-white mb-6 leading-tight",children:a("landing.hero.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-4 max-w-2xl mx-auto",children:a("landing.hero.subtitle")}),e.jsx("p",{className:"text-lg text-gray-500 dark:text-gray-500 mb-8 max-w-2xl mx-auto",children:a("landing.hero.description")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:a("landing.hero.installHint")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:d,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:l?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(m,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:a("landing.preview.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a("landing.preview.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-chat.png",alt:a("landing.preview.chatAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.chatCaption")})]}),e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-mcp.png",alt:a("landing.preview.mcpAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.mcpCaption")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.features.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.features.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(b,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.localWorkspace.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(r,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(r,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(r,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(u,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.webExperience.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(c,{className:"w-5 h-5 mr-2 mt-0.5 text-amber-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(N,{className:"w-5 h-5 mr-2 mt-0.5 text-purple-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(k,{className:"w-5 h-5 mr-2 mt-0.5 text-blue-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(g,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.sdkFeatures.title")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:"MCP"}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.skills")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.commands")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.plugins")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.memory")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.subagent")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.multiModel")})]}),e.jsx("p",{className:"mt-4 text-sm text-gray-500 dark:text-gray-500",children:a("landing.features.sdkFeatures.anthropicCompat")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 text-sm mb-4",children:[e.jsx(f,{className:"w-4 h-4 mr-2"}),a("landing.scheduler.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.scheduler.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 mb-8",children:a("landing.scheduler.description")})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-2xl p-6 border border-gray-100 dark:border-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.scheduler.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📊"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🔍"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📝"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario3.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📈"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario4.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario4.desc")})]})]})]})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1 bg-white dark:bg-gray-800 rounded-2xl p-6 border border-gray-100 dark:border-gray-700",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.a2a.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🤵"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"💻"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📱"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario3.desc")})]})]})]})]}),e.jsxs("div",{className:"order-1 lg:order-2",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 text-sm mb-4",children:[e.jsx(w,{className:"w-4 h-4 mr-2"}),a("landing.a2a.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.a2a.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.a2a.description")})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 text-sm mb-4",children:[e.jsx(v,{className:"w-4 h-4 mr-2"}),a("landing.customAgent.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.customAgent.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.customAgent.description")})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📊"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example1")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🤵"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example2")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📝"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example3")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🔍"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example4")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.comparison.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.comparison.subtitle")})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-100 dark:border-gray-700 overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-700",children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400",children:a("landing.comparison.dimension")}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-semibold text-gray-900 dark:text-white",children:"AgentStudio"}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-medium text-gray-500 dark:text-gray-400",children:"Claude Code"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:[e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.interface")}),e.jsxs("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:["Web ",a("landing.comparison.webInterface")]}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.cli")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.targetUsers")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.everyone")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.developers")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.toolDisplay")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.visual")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.textOnly")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.fileBrowser")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.agentCustom")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.scheduler")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.a2a")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.mobileAccess")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-amber-600 dark:text-amber-400",children:a("landing.comparison.beta")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]})]})]})})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-6",children:a("landing.cta.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-8",children:a("landing.cta.subtitle")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:d,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:l?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(m,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center px-8 py-4 bg-white dark:bg-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 font-semibold rounded-xl border border-gray-200 dark:border-gray-700 transition-all duration-200",children:[e.jsx(g,{className:"mr-2 w-5 h-5"}),"GitHub"]})]})}),e.jsx("footer",{className:"bg-gray-900 text-gray-300 py-12 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-8",children:[e.jsxs("div",{className:"col-span-1 md:col-span-2",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-white",children:"AgentStudio"})]}),e.jsx("p",{className:"text-gray-400 mb-4 max-w-md",children:a("landing.footer.description")}),e.jsx("div",{className:"text-sm text-gray-500",children:a("landing.footer.copyright")})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.product")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx(o,{to:"/dashboard",className:"hover:text-white transition-colors",children:a("landing.footer.workspace")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.sourceCode")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.releases")})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.support")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.documentation")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/issues",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.issues")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/discussions",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.discussions")})})]})]})]})})})]})};export{W as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{f as ae,g as ne,h as le,r as ie}from"./index-C8oBHB0h.js";import{j as M,y as $,k as I,C as J,z as de,U as L,ah as P,p as F,ai as oe,n as ce,v as xe,t as ue}from"./ui-components-icUM6BEH.js";import{u as ge}from"./tools-CUwQTL-8.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-B3InAIfY.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
2
|
|
|
3
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(),
|
|
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(),z=le(),[y,G]=d.useState(!1),[H,j]=d.useState(!1),[W,N]=d.useState(null),[o,x]=d.useState({name:"",url:""}),[E,T]=d.useState(null),[A,O]=d.useState({}),[X,k]=d.useState(!0),[R,v]=d.useState(!0),[K,U]=d.useState(!1),S=z.state?.from?.pathname||"/";d.useEffect(()=>{let t=!0;return(async()=>{if(!c){k(!1);return}k(!0),U(!1);try{const i=await q();if(!t)return;i.success?(v(i.passwordRequired),!i.passwordRequired&&!K&&(U(!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`,D=(await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(5e3)})).ok?"success":"error";return l&&O(re=>({...re,[l]:D})),D==="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(L,{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})]})})]}),X?e.jsx("div",{className:"space-y-6 text-center",children:e.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[e.jsx("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(P,{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
5
|
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
6
6
|
focus:ring-2 focus:ring-blue-500 focus:border-transparent
|
|
7
7
|
placeholder-gray-400 dark:placeholder-gray-500
|
|
@@ -9,8 +9,8 @@ ${a.details}`:`${m}: ${a.message}`;try{await navigator.clipboard.writeText(r),g(
|
|
|
9
9
|
bg-blue-600 hover:bg-blue-700
|
|
10
10
|
disabled:bg-gray-400 disabled:cursor-not-allowed
|
|
11
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(
|
|
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(P,{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
13
|
bg-green-600 hover:bg-green-700
|
|
14
14
|
disabled:bg-gray-400 disabled:cursor-not-allowed
|
|
15
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:()=>
|
|
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:()=>G(!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:W===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(L,{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)),H?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{s as A,a as c}from"./index-C8oBHB0h.js";import{u as Ke,b as U,c as S,A as d}from"./agents-B3InAIfY.js";import{u as Te}from"./tools-CUwQTL-8.js";import{Q as $e,R as Ee,U as Pe,C as Fe,j as ze,V as Z,t as De,Y as qe,E as Le,z as _,_ as Me,$ as Re,d as Ie,v as Qe,a0 as Be,a1 as ee}from"./ui-components-icUM6BEH.js";import"./syntax-highlighting-CnREyncB.js";async function Oe(){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 Ve(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 Je(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=Ke(),[l,u]=i.useState(!1),[se,C]=i.useState(!1),[K,T]=i.useState(""),[y,H]=i.useState(null),[o,$]=i.useState(null),[b,V]=i.useState("cursor"),[E,ae]=i.useState(new Set),[re,P]=i.useState(!1),[F,J]=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,Y]=i.useState(null),{data:N,isLoading:le,refetch:de}=U({queryKey:["mcpAdminStatus"],queryFn:Oe}),{data:ce,isLoading:oe,refetch:me}=U({queryKey:["mcpAdminKeys"],queryFn:Ue}),{data:xe,isLoading:ge}=U({queryKey:["mcpAdminTools"],queryFn:_e}),R=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),C(!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:Ve,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)}}),I=S({mutationFn:({keyId:t,data:a})=>Je(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(!K.trim()){c(s("settings.mcpAdmin.errors.descriptionRequired"));return}R.mutate({description:K.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&&I.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)},Q=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),J(t.fullKey),C(!0)}catch{c(s("settings.mcpAdmin.errors.configFetch"))}},X=ce?.keys||[],k=xe?.tools||[],Ce=(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(([B,O])=>e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-mono text-green-400",children:B}),v.includes(B)&&e.jsx("span",{className:"text-red-400 ml-1",children:"*"}),e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",O.type,")"]}),O.description&&e.jsx("p",{className:"text-gray-400 ml-2 mt-0.5",children:O.description})]},B))})]}),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))}):X.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:X.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:()=>Q(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(Re,{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(Ie,{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(Qe,{className:"w-4 h-4"})})]})})]})},t.id))})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(Be,{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:()=>Y(t),onMouseLeave:()=>Y(null),children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-sm text-gray-900 dark:text-white",children:t.name}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t.description})]}),ie?.name===t.name&&Ce(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:K,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:R.isPending||h&&m.size===0,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50",children:R.isPending?s("settings.mcpAdmin.creating"):s("settings.mcpAdmin.create")})]})]})}),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:()=>Q(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:()=>V("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:()=>V("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:()=>Q(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:()=>{C(!1),H(null),J(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:I.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:I.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};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as m,W as Q}from"./monaco-editor-DHKm5-VF.js";import{a as g,A as u}from"./agents-
|
|
2
|
-
${a.details}`),c(i=>i.map(d=>d.name===t?{...d,status:"error",error:n,tools:void 0}:d))}}catch(r){console.error("MCP server validation failed:",r),c(a=>a.map(n=>n.name===t?{...n,status:"error",error:s("mcp.errors.networkError"),tools:void 0}:n))}},re=async()=>{for(const t of x)await k(t.name)},F=x.filter(t=>{const r=w.toLowerCase(),a=t.name.toLowerCase().includes(r),n=t.command?.toLowerCase().includes(r)||!1,i=t.args?.join(" ").toLowerCase().includes(r)||!1,d=t.url?.toLowerCase().includes(r)||!1;return a||n||i||d}),E=t=>{D(t);const{name:r,status:a,error:n,tools:i,lastValidated:d,...j}=t;y({name:t.name,type:t.type,config:JSON.stringify(j,null,2)}),f(!0)},H=t=>{let r="";t.type==="stdio"?r=`${t.command} ${t.args?.join(" ")||""}`.trim():r=t.url||"",navigator.clipboard.writeText(r).then(()=>{V(s("mcp.commandCopied"))}).catch(()=>{b(s("mcp.errors.copyFailed"))})},J=async t=>{if(window.confirm(s("mcp.confirmDelete",{name:t})))try{const r=await g(`${u}/mcp/${t}`,{method:"DELETE"});if(r.ok)c(a=>a.filter(n=>n.name!==t));else{const a=await r.json();throw new Error(a.error||s("mcp.errors.deleteFailed"))}}catch(r){console.error("Delete config failed:",r),b(s("mcp.errors.deleteFailed"),r instanceof Error?r.message:s("errors:common.unknownError"))}},R=()=>{y({name:"",type:"stdio",config:""}),D(null)},le=async()=>{try{L(!0);const t=await g(`${u}/mcp/claude-code`);if(t.ok){const a=(await t.json()).servers||[];if(a.length===0){U(s("mcp.import.noConfigFound"));return}let n=0,i=0;for(const d of a){if(x.find(P=>P.name===d.name)){i++;continue}const ie={...d},_=await g(`${u}/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(_.ok){const P=await _.json();c(de=>[P.server,...de]),n++}}n>0?V(s("mcp.import.success",{imported:n,skipped:i})):U(s("mcp.import.allExist"))}else{const r=await t.json();throw new Error(r.error||s("mcp.errors.importFailed"))}}catch(t){console.error("Failed to import from Claude Code:",t),b(s("mcp.errors.importFailed"),t instanceof Error?t.message:s("errors:common.unknownError"))}finally{L(!1)}},A=(t,r)=>{if(!t.trim())return!1;try{const a=JSON.parse(t);if(!a.type||a.type!==r)return!1;if(r==="stdio"){if(!a.command||!Array.isArray(a.args))return!1}else if(r==="http"&&(!a.url||typeof a.url!="string"))return!1;return!(a.timeout&&typeof a.timeout!="number"||a.autoApprove&&!Array.isArray(a.autoApprove))}catch{return!1}},ne=async t=>{if(t.preventDefault(),!o.name.trim()){b(s("mcp.form.nameRequired"));return}if(!A(o.config,o.type)){b(s("mcp.form.configInvalid",{fields:o.type==="stdio"?s("mcp.form.requiredFieldsStdio"):s("mcp.form.requiredFieldsHttp")}));return}O(!0);try{const r=JSON.parse(o.config);let a;if(p)console.log("Updating existing MCP server:",p.name,"with config:",r),a=await g(`${u}/mcp/${p.name}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});else{const n={name:o.name,...r};a=await g(`${u}/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}if(a.ok){const n=await a.json();c(p?d=>d.map(j=>j.name===p.name?n.server:j):d=>[n.server,...d]),R(),f(!1);const i=n.server.name;await k(i)}else{const n=await a.json();throw new Error(n.error||s("mcp.errors.saveFailed"))}}catch(r){console.error("Failed to save MCP config:",r),b(s("mcp.errors.saveFailed"),r instanceof Error?r.message:s("errors:common.unknownError"))}finally{O(!1)}},oe=()=>{f(!1),R()};return Z?e.jsx("div",{className:`${l?"p-4":"p-8"} flex items-center justify-center min-h-[60vh]`,children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:s("mcp.loading")})]})}):e.jsxs("div",{className:`${l?"p-4":"p-8"}`,children:[e.jsxs("div",{className:`${l?"mb-6":"mb-8"}`,children:[e.jsx("div",{className:`flex items-center ${l?"mb-4":"justify-between mb-6"}`,children:e.jsxs("div",{children:[e.jsx("h1",{className:`${l?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:s("mcp.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${l?"mt-1":"mt-2"}`,children:s("mcp.subtitle")})]})}),e.jsx("div",{className:"mb-6 bg-white dark:bg-gray-800 rounded-lg shadow p-4 md:p-6 border border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-gray-900 dark:text-gray-100",children:x.length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.total")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-green-600 dark:text-green-400",children:x.filter(t=>t.status==="active").length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.active")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-red-600 dark:text-red-400",children:x.filter(t=>t.status==="error").length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.error")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-blue-600 dark:text-blue-400",children:x.filter(t=>t.status==="validating").length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.validating")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-purple-600 dark:text-purple-400",children:x.reduce((t,r)=>t+(r.tools?.length||0),0)}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:s("mcp.stats.tools")})]})]})}),e.jsxs("div",{className:`${l?"space-y-3":"flex items-center space-x-4"}`,children:[e.jsxs("div",{className:`${l?"":"flex-1"} relative`,children:[e.jsx(ue,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${l?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:s("mcp.searchPlaceholder"),value:$,onChange:t=>ee(t.target.value),className:`pl-10 pr-4 ${l?"py-2":"py-3"} w-full border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${l?"text-sm":""}`})]}),e.jsxs("div",{className:`${l?"flex space-x-2":"flex items-center space-x-3"}`,children:[e.jsxs("button",{onClick:re,disabled:x.length===0,className:`${l?"flex-1 px-3 py-2 text-sm":"px-5 py-3"} bg-gray-600 text-white rounded-lg hover:bg-gray-700 hover:shadow-md active:scale-95 transition-all whitespace-nowrap font-medium flex items-center ${l?"justify-center":"space-x-2"} disabled:opacity-50 disabled:cursor-not-allowed`,title:s("mcp.validateAll"),children:[e.jsx(N,{className:`${l?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:s("mcp.validateAll")})]}),e.jsxs("button",{onClick:le,disabled:T,className:`${l?"flex-1 px-3 py-2 text-sm":"px-5 py-3"} bg-green-600 text-white rounded-lg hover:bg-green-700 hover:shadow-md active:scale-95 transition-all whitespace-nowrap font-medium flex items-center ${l?"justify-center":"space-x-2"} disabled:opacity-50 disabled:cursor-not-allowed`,children:[T&&e.jsx(N,{className:`${l?"w-4 h-4":"w-5 h-5"} animate-spin`}),e.jsx("span",{children:s(T?"mcp.import.importing":"mcp.import.button")})]}),e.jsxs("button",{onClick:()=>f(!0),className:`${l?"flex-1 px-3 py-2 text-sm":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 hover:shadow-md active:scale-95 transition-all whitespace-nowrap flex items-center ${l?"justify-center":"space-x-2"} font-medium`,children:[e.jsx(he,{className:`${l?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:s("mcp.addServer")})]})]})]})]}),F.length===0?e.jsxs("div",{className:`text-center ${l?"py-8":"py-16"} bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700`,children:[e.jsx("div",{className:`${l?"text-4xl":"text-6xl"} mb-4`,children:"🖥️"}),e.jsx("h3",{className:`${l?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:s(w?"mcp.noResults":"mcp.noServers")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${l?"mb-4":"mb-6"}`,children:s(w?"mcp.adjustSearch":"mcp.addFirstServer")}),!w&&e.jsx("button",{onClick:()=>f(!0),className:`${l?"px-4 py-2 text-sm":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:s("mcp.addServer")})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"md:hidden space-y-4",children:F.map((t,r)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow overflow-hidden",children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-start space-x-3 mb-3",children:[e.jsx("div",{className:"text-2xl",children:t.type==="http"?"🌐":"🖥️"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-base font-medium text-gray-900 dark:text-white truncate",children:t.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:t.type==="stdio"?`${t.command} ${t.args?.join(" ")||""}`.trim():t.url})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm mb-3",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 block mb-1",children:[s("mcp.table.type"),":"]}),e.jsx("span",{className:`inline-flex items-center px-2 py-1 text-xs font-medium rounded-full ${t.type==="http"?"bg-blue-100 text-blue-800":"bg-purple-100 text-purple-800"}`,children:t.type==="http"?"HTTP":"Stdio"})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 block mb-1",children:[s("mcp.table.status"),":"]}),t.status==="active"&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-green-100 text-green-800",children:[e.jsx(M,{className:"w-3 h-3 mr-1"}),s("mcp.status.active")]}),t.status==="error"&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-red-100 text-red-800",children:[e.jsx(be,{className:"w-3 h-3 mr-1"}),s("mcp.status.error")]}),t.status==="validating"&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800",children:[e.jsx(N,{className:"w-3 h-3 mr-1 animate-spin"}),s("mcp.status.validating")]}),!t.status&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800",children:[e.jsx(fe,{className:"w-3 h-3 mr-1"}),s("mcp.status.unvalidated")]})]})]}),t.status==="active"&&t.tools&&t.tools.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("button",{onClick:()=>I(a=>({...a,[t.name]:!a[t.name]})),className:"flex items-center space-x-2 text-sm text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors mb-2 w-full",children:[e.jsx(W,{className:"w-4 h-4"}),e.jsxs("span",{className:"font-medium",children:[t.tools.length," ",s("mcp.table.tools")]}),h[t.name]?e.jsx(z,{className:"w-4 h-4 ml-auto text-gray-400"}):e.jsx(X,{className:"w-4 h-4 ml-auto text-gray-400"})]}),h[t.name]&&e.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-40 overflow-y-auto",children:t.tools.map((a,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-1 rounded text-xs font-mono border border-green-200 dark:border-green-800",title:a,children:a},n))}),!h[t.name]&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.tools.slice(0,3).map((a,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-0.5 rounded text-xs font-mono",title:a,children:a},n)),t.tools.length>3&&e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 text-xs text-gray-500 dark:text-gray-400",children:["+",t.tools.length-3]})]})]}),t.status==="error"&&t.error&&e.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 mb-3 p-2 bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words font-sans text-xs",children:t.error})})]}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:s("mcp.table.actions")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>k(t.name),disabled:t.status==="validating",className:"p-2 text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/50 rounded-md transition-colors disabled:opacity-50",title:s("mcp.actions.validate"),children:t.status==="validating"?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(M,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>H(t),className:"p-2 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-900/50 rounded-md transition-colors",title:s("mcp.actions.copyCommand"),children:e.jsx(G,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>E(t),className:"p-2 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/50 rounded-md transition-colors",title:s("mcp.actions.edit"),children:e.jsx(K,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>J(t.name),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-md transition-colors",title:s("mcp.actions.delete"),children:e.jsx(Y,{className:"w-4 h-4"})})]})]})})]},t.name+"-"+r))}),e.jsx("div",{className:"hidden md:block bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(me,{children:[e.jsx(xe,{children:e.jsxs(B,{children:[e.jsx(v,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("mcp.table.server")}),e.jsx(v,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("mcp.table.type")}),e.jsx(v,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("mcp.table.tools")}),e.jsx(v,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("mcp.table.actions")})]})}),e.jsx(pe,{children:F.map((t,r)=>e.jsxs(B,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(C,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:t.type==="http"?"🌐":"🖥️"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:t.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${t.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:t.source==="plugin"?s("mcp.source.plugin"):s("mcp.source.local")})]}),t.status==="error"&&t.error&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 mt-1 max-w-md",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words font-sans",children:t.error})})]})]})}),e.jsx(C,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`inline-flex items-center px-2 py-1 text-xs font-medium rounded-full ${t.type==="http"?"bg-blue-100 text-blue-800":"bg-purple-100 text-purple-800"}`,children:t.type==="http"?"HTTP":"Stdio"})}),e.jsx(C,{className:"px-6 py-4",children:t.status==="active"&&t.tools&&t.tools.length>0?e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>I(a=>({...a,[t.name]:!a[t.name]})),className:"flex items-center space-x-2 text-sm text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors mb-2 group",children:[e.jsx(W,{className:"w-4 h-4"}),e.jsxs("span",{className:"font-medium",children:[t.tools.length," ",s("mcp.table.tools")]}),h[t.name]?e.jsx(z,{className:"w-4 h-4 text-gray-400 group-hover:text-blue-600"}):e.jsx(X,{className:"w-4 h-4 text-gray-400 group-hover:text-blue-600"})]}),h[t.name]&&e.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-48 overflow-y-auto pr-2",children:t.tools.map((a,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-1 rounded text-xs font-mono border border-green-200 dark:border-green-800 hover:bg-green-100 dark:hover:bg-green-900/50 transition-colors",title:a,children:a},n))}),!h[t.name]&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.tools.slice(0,5).map((a,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-0.5 rounded text-xs font-mono",title:a,children:a},n)),t.tools.length>5&&e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 text-xs text-gray-500 dark:text-gray-400",children:["+",t.tools.length-5]})]})]}):e.jsx("span",{className:"text-sm text-gray-400",children:t.status==="active"?s("mcp.table.noTools"):"-"})}),e.jsx(C,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx("button",{onClick:()=>k(t.name),disabled:t.status==="validating",className:"inline-flex items-center px-2 py-1 text-xs font-medium text-green-600 bg-green-50 dark:bg-green-900/50 rounded-md hover:bg-green-100 dark:hover:bg-green-900/70 transition-colors disabled:opacity-50",title:s("mcp.actions.validate"),children:t.status==="validating"?e.jsx(N,{className:"w-3 h-3 animate-spin"}):e.jsx(M,{className:"w-3 h-3"})}),e.jsx("button",{onClick:()=>H(t),className:"inline-flex items-center px-2 py-1 text-xs font-medium text-gray-600 bg-gray-50 dark:bg-gray-900/50 rounded-md hover:bg-gray-100 dark:hover:bg-gray-900/70 transition-colors",title:s("mcp.actions.copyCommand"),children:e.jsx(G,{className:"w-3 h-3"})}),t.source==="plugin"?e.jsxs("button",{onClick:()=>E(t),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:s("mcp.actions.view"),children:[e.jsx(ye,{className:"w-3 h-3 mr-1"}),s("mcp.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>E(t),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:s("mcp.actions.edit"),children:[e.jsx(K,{className:"w-3 h-3 mr-1"}),s("mcp.actions.edit")]}),e.jsx("button",{onClick:()=>J(t.name),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:s("mcp.actions.delete"),children:e.jsx(Y,{className:"w-4 h-4"})})]})]})})]},t.name+"-"+r))})]})})]}),se&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsx("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full ${l?"max-w-full":"max-w-2xl"} mx-4 max-h-[90vh] overflow-y-auto`,children:e.jsxs("div",{className:`${l?"p-4":"p-6"}`,children:[e.jsxs("div",{className:`flex items-center ${l?"flex-col space-y-3":"justify-between"} mb-4`,children:[e.jsx("h2",{className:`${l?"text-lg":"text-xl"} font-semibold text-gray-900 dark:text-white`,children:s(p?"mcp.modal.editTitle":"mcp.modal.addTitle")}),e.jsxs("div",{className:`flex ${l?"w-full space-x-2":"space-x-3"}`,children:[e.jsx("button",{type:"button",onClick:oe,disabled:S,className:`${l?"flex-1 px-3 py-2 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50`,children:s("common:actions.cancel")}),e.jsx("button",{type:"submit",form:"mcp-config-form",disabled:S||!o.name.trim()||!A(o.config,o.type),className:`${l?"flex-1 px-3 py-2 text-sm":"px-4 py-2"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed`,children:s(S?"mcp.modal.saving":p?"mcp.modal.saveConfig":"mcp.modal.addConfig")})]})]}),e.jsx("form",{id:"mcp-config-form",onSubmit:ne,children:e.jsxs("div",{className:`${l?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("mcp.form.serverName")}),e.jsx("input",{type:"text",value:o.name,onChange:t=>y({...o,name:t.target.value}),placeholder:s("mcp.form.serverNamePlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${l?"text-sm":""}`,required:!0,disabled:!!p}),p&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:s("mcp.form.nameNotEditable")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("mcp.form.mcpType")}),e.jsxs("select",{value:o.type,onChange:t=>{const r=t.target.value;y({...o,type:r,config:r==="stdio"?`{
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as m,W as Q}from"./monaco-editor-DHKm5-VF.js";import{a as g,A as u}from"./agents-B3InAIfY.js";import{b as ce,c as U,s as V,a as b}from"./index-C8oBHB0h.js";import{T as me,a as xe,b as B,c as v,d as pe,e as C}from"./table-CHBLEjZn.js";import{u as ge}from"./tools-CUwQTL-8.js";import{g as ue,L as w,t as he,C as M,n as be,w as fe,x as z,y as W,k as X,z as G,D as K,v as Y,E as ye}from"./ui-components-icUM6BEH.js";import"./syntax-highlighting-CnREyncB.js";const Te=()=>{const{t:a}=ge("pages"),{isMobile:l}=ce(),[x,c]=m.useState([]),[Z,D]=m.useState(!0),[$,ee]=m.useState(""),[N,te]=m.useState(""),[ae,f]=m.useState(!1),[p,q]=m.useState(null),[o,y]=m.useState({name:"",type:"stdio",config:""}),[S,O]=m.useState(!1),[T,L]=m.useState(!1),[h,I]=m.useState({}),se=async()=>{try{D(!0);const t=await g(`${u}/mcp`);if(t.ok){const r=await t.json();c(r.servers||[])}else console.error("Failed to load MCP configs:",t.status),c([])}catch(t){console.error("Failed to load MCP configs:",t),c([])}finally{D(!1)}};Q.useEffect(()=>{se()},[]),Q.useEffect(()=>{const t=setTimeout(()=>{te($)},300);return()=>clearTimeout(t)},[$]);const k=async t=>{try{console.log("Validating MCP server:",t),c(s=>s.map(n=>n.name===t?{...n,status:"validating"}:n));const r=await g(`${u}/mcp/${t}/validate`,{method:"POST"});if(console.log("Validation response status:",r.status),r.ok){const s=await r.json();c(n=>n.map(i=>i.name===t?{...i,status:"active",tools:s.tools||[],error:void 0}:i))}else{const s=await r.json();let n=s.error||a("mcp.errors.validationFailed");s.details&&(n+=`
|
|
2
|
+
${s.details}`),c(i=>i.map(d=>d.name===t?{...d,status:"error",error:n,tools:void 0}:d))}}catch(r){console.error("MCP server validation failed:",r),c(s=>s.map(n=>n.name===t?{...n,status:"error",error:a("mcp.errors.networkError"),tools:void 0}:n))}},re=async()=>{for(const t of x)await k(t.name)},F=x.filter(t=>{const r=N.toLowerCase(),s=t.name.toLowerCase().includes(r),n=t.command?.toLowerCase().includes(r)||!1,i=t.args?.join(" ").toLowerCase().includes(r)||!1,d=t.url?.toLowerCase().includes(r)||!1;return s||n||i||d}),E=t=>{q(t);const{name:r,status:s,error:n,tools:i,lastValidated:d,...j}=t;y({name:t.name,type:t.type,config:JSON.stringify(j,null,2)}),f(!0)},H=t=>{let r="";t.type==="stdio"?r=`${t.command} ${t.args?.join(" ")||""}`.trim():r=t.url||"",navigator.clipboard.writeText(r).then(()=>{V(a("mcp.commandCopied"))}).catch(()=>{b(a("mcp.errors.copyFailed"))})},J=async t=>{if(window.confirm(a("mcp.confirmDelete",{name:t})))try{const r=await g(`${u}/mcp/${t}`,{method:"DELETE"});if(r.ok)c(s=>s.filter(n=>n.name!==t));else{const s=await r.json();throw new Error(s.error||a("mcp.errors.deleteFailed"))}}catch(r){console.error("Delete config failed:",r),b(a("mcp.errors.deleteFailed"),r instanceof Error?r.message:a("errors:common.unknownError"))}},R=()=>{y({name:"",type:"stdio",config:""}),q(null)},le=async()=>{try{L(!0);const t=await g(`${u}/mcp/claude-code`);if(t.ok){const s=(await t.json()).servers||[];if(s.length===0){U(a("mcp.import.noConfigFound"));return}let n=0,i=0;for(const d of s){if(x.find(P=>P.name===d.name)){i++;continue}const ie={...d},_=await g(`${u}/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(_.ok){const P=await _.json();c(de=>[P.server,...de]),n++}}n>0?V(a("mcp.import.success",{imported:n,skipped:i})):U(a("mcp.import.allExist"))}else{const r=await t.json();throw new Error(r.error||a("mcp.errors.importFailed"))}}catch(t){console.error("Failed to import from Claude Code:",t),b(a("mcp.errors.importFailed"),t instanceof Error?t.message:a("errors:common.unknownError"))}finally{L(!1)}},A=(t,r)=>{if(!t.trim())return!1;try{const s=JSON.parse(t);if(!s.type||s.type!==r)return!1;if(r==="stdio"){if(!s.command||!Array.isArray(s.args))return!1}else if(r==="http"&&(!s.url||typeof s.url!="string"))return!1;return!(s.timeout&&typeof s.timeout!="number"||s.autoApprove&&!Array.isArray(s.autoApprove))}catch{return!1}},ne=async t=>{if(t.preventDefault(),!o.name.trim()){b(a("mcp.form.nameRequired"));return}if(!A(o.config,o.type)){b(a("mcp.form.configInvalid",{fields:o.type==="stdio"?a("mcp.form.requiredFieldsStdio"):a("mcp.form.requiredFieldsHttp")}));return}O(!0);try{const r=JSON.parse(o.config);let s;if(p)console.log("Updating existing MCP server:",p.name,"with config:",r),s=await g(`${u}/mcp/${p.name}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});else{const n={name:o.name,...r};s=await g(`${u}/mcp`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}if(s.ok){const n=await s.json();c(p?d=>d.map(j=>j.name===p.name?n.server:j):d=>[n.server,...d]),R(),f(!1);const i=n.server.name;await k(i)}else{const n=await s.json();throw new Error(n.error||a("mcp.errors.saveFailed"))}}catch(r){console.error("Failed to save MCP config:",r),b(a("mcp.errors.saveFailed"),r instanceof Error?r.message:a("errors:common.unknownError"))}finally{O(!1)}},oe=()=>{f(!1),R()};return Z?e.jsx("div",{className:`${l?"p-4":"p-8"} flex items-center justify-center min-h-[60vh]`,children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:a("mcp.loading")})]})}):e.jsxs("div",{className:`${l?"p-4":"p-8"}`,children:[e.jsxs("div",{className:`${l?"mb-6":"mb-8"}`,children:[e.jsx("div",{className:`flex items-center ${l?"mb-4":"justify-between mb-6"}`,children:e.jsxs("div",{children:[e.jsx("h1",{className:`${l?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:a("mcp.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${l?"mt-1":"mt-2"}`,children:a("mcp.subtitle")})]})}),e.jsx("div",{className:"mb-6 bg-white dark:bg-gray-800 rounded-lg shadow p-4 md:p-6 border border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-gray-900 dark:text-gray-100",children:x.length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:a("mcp.stats.total")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-green-600 dark:text-green-400",children:x.filter(t=>t.status==="active").length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:a("mcp.stats.active")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-red-600 dark:text-red-400",children:x.filter(t=>t.status==="error").length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:a("mcp.stats.error")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-blue-600 dark:text-blue-400",children:x.filter(t=>t.status==="validating").length}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:a("mcp.stats.validating")})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold text-purple-600 dark:text-purple-400",children:x.reduce((t,r)=>t+(r.tools?.length||0),0)}),e.jsx("div",{className:"text-xs md:text-sm text-gray-600 dark:text-gray-400",children:a("mcp.stats.tools")})]})]})}),e.jsxs("div",{className:`${l?"space-y-3":"flex items-center space-x-4"}`,children:[e.jsxs("div",{className:`${l?"":"flex-1"} relative`,children:[e.jsx(ue,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${l?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:a("mcp.searchPlaceholder"),value:$,onChange:t=>ee(t.target.value),className:`pl-10 pr-4 ${l?"py-2":"py-3"} w-full border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${l?"text-sm":""}`})]}),e.jsxs("div",{className:`${l?"flex space-x-2":"flex items-center space-x-3"}`,children:[e.jsxs("button",{onClick:re,disabled:x.length===0,className:`${l?"flex-1 px-3 py-2 text-sm":"px-5 py-3"} bg-gray-600 text-white rounded-lg hover:bg-gray-700 hover:shadow-md active:scale-95 transition-all whitespace-nowrap font-medium flex items-center ${l?"justify-center":"space-x-2"} disabled:opacity-50 disabled:cursor-not-allowed`,title:a("mcp.validateAll"),children:[e.jsx(w,{className:`${l?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:a("mcp.validateAll")})]}),e.jsxs("button",{onClick:le,disabled:T,className:`${l?"flex-1 px-3 py-2 text-sm":"px-5 py-3"} bg-green-600 text-white rounded-lg hover:bg-green-700 hover:shadow-md active:scale-95 transition-all whitespace-nowrap font-medium flex items-center ${l?"justify-center":"space-x-2"} disabled:opacity-50 disabled:cursor-not-allowed`,children:[T&&e.jsx(w,{className:`${l?"w-4 h-4":"w-5 h-5"} animate-spin`}),e.jsx("span",{children:a(T?"mcp.import.importing":"mcp.import.button")})]}),e.jsxs("button",{onClick:()=>f(!0),className:`${l?"flex-1 px-3 py-2 text-sm":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 hover:shadow-md active:scale-95 transition-all whitespace-nowrap flex items-center ${l?"justify-center":"space-x-2"} font-medium`,children:[e.jsx(he,{className:`${l?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:a("mcp.addServer")})]})]})]})]}),F.length===0?e.jsxs("div",{className:`text-center ${l?"py-8":"py-16"} bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700`,children:[e.jsx("div",{className:`${l?"text-4xl":"text-6xl"} mb-4`,children:"🖥️"}),e.jsx("h3",{className:`${l?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:a(N?"mcp.noResults":"mcp.noServers")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${l?"mb-4":"mb-6"}`,children:a(N?"mcp.adjustSearch":"mcp.addFirstServer")}),!N&&e.jsx("button",{onClick:()=>f(!0),className:`${l?"px-4 py-2 text-sm":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:a("mcp.addServer")})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"md:hidden space-y-4",children:F.map((t,r)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow overflow-hidden",children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-start space-x-3 mb-3",children:[e.jsx("div",{className:"text-2xl",children:t.type==="http"?"🌐":"🖥️"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-base font-medium text-gray-900 dark:text-white truncate",children:t.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:t.type==="stdio"?`${t.command} ${t.args?.join(" ")||""}`.trim():t.url})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm mb-3",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 block mb-1",children:[a("mcp.table.type"),":"]}),e.jsx("span",{className:`inline-flex items-center px-2 py-1 text-xs font-medium rounded-full ${t.type==="http"?"bg-blue-100 text-blue-800":"bg-purple-100 text-purple-800"}`,children:t.type==="http"?"HTTP":"Stdio"})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 block mb-1",children:[a("mcp.table.status"),":"]}),t.status==="active"&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-green-100 text-green-800",children:[e.jsx(M,{className:"w-3 h-3 mr-1"}),a("mcp.status.active")]}),t.status==="error"&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-red-100 text-red-800",children:[e.jsx(be,{className:"w-3 h-3 mr-1"}),a("mcp.status.error")]}),t.status==="validating"&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800",children:[e.jsx(w,{className:"w-3 h-3 mr-1 animate-spin"}),a("mcp.status.validating")]}),!t.status&&e.jsxs("span",{className:"inline-flex items-center px-2 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-800",children:[e.jsx(fe,{className:"w-3 h-3 mr-1"}),a("mcp.status.unvalidated")]})]})]}),t.status==="active"&&t.tools&&t.tools.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("button",{onClick:()=>I(s=>({...s,[t.name]:!s[t.name]})),className:"flex items-center space-x-2 text-sm text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors mb-2 w-full",children:[e.jsx(z,{className:"w-4 h-4"}),e.jsxs("span",{className:"font-medium",children:[t.tools.length," ",a("mcp.table.tools")]}),h[t.name]?e.jsx(W,{className:"w-4 h-4 ml-auto text-gray-400"}):e.jsx(X,{className:"w-4 h-4 ml-auto text-gray-400"})]}),h[t.name]&&e.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-40 overflow-y-auto",children:t.tools.map((s,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-1 rounded text-xs font-mono border border-green-200 dark:border-green-800",title:s,children:s},n))}),!h[t.name]&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.tools.slice(0,3).map((s,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-0.5 rounded text-xs font-mono",title:s,children:s},n)),t.tools.length>3&&e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 text-xs text-gray-500 dark:text-gray-400",children:["+",t.tools.length-3]})]})]}),t.status==="error"&&t.error&&e.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 mb-3 p-2 bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words font-sans text-xs",children:t.error})})]}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:a("mcp.table.actions")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>k(t.name),disabled:t.status==="validating",className:"p-2 text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/50 rounded-md transition-colors disabled:opacity-50",title:a("mcp.actions.validate"),children:t.status==="validating"?e.jsx(w,{className:"w-4 h-4 animate-spin"}):e.jsx(M,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>H(t),className:"p-2 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-900/50 rounded-md transition-colors",title:a("mcp.actions.copyCommand"),children:e.jsx(G,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>E(t),className:"p-2 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/50 rounded-md transition-colors",title:a("mcp.actions.edit"),children:e.jsx(K,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>J(t.name),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-md transition-colors",title:a("mcp.actions.delete"),children:e.jsx(Y,{className:"w-4 h-4"})})]})]})})]},t.name+"-"+r))}),e.jsx("div",{className:"hidden md:block bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(me,{children:[e.jsx(xe,{children:e.jsxs(B,{children:[e.jsx(v,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:a("mcp.table.server")}),e.jsx(v,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:a("mcp.table.type")}),e.jsx(v,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:a("mcp.table.tools")}),e.jsx(v,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:a("mcp.table.actions")})]})}),e.jsx(pe,{children:F.map((t,r)=>e.jsxs(B,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(C,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:t.type==="http"?"🌐":"🖥️"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:t.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${t.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:t.source==="plugin"?a("mcp.source.plugin"):a("mcp.source.local")})]}),t.status==="error"&&t.error&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 mt-1 max-w-md",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words font-sans",children:t.error})})]})]})}),e.jsx(C,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`inline-flex items-center px-2 py-1 text-xs font-medium rounded-full ${t.type==="http"?"bg-blue-100 text-blue-800":"bg-purple-100 text-purple-800"}`,children:t.type==="http"?"HTTP":"Stdio"})}),e.jsx(C,{className:"px-6 py-4",children:t.status==="active"&&t.tools&&t.tools.length>0?e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>I(s=>({...s,[t.name]:!s[t.name]})),className:"flex items-center space-x-2 text-sm text-gray-700 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400 transition-colors mb-2 group",children:[e.jsx(z,{className:"w-4 h-4"}),e.jsxs("span",{className:"font-medium",children:[t.tools.length," ",a("mcp.table.tools")]}),h[t.name]?e.jsx(W,{className:"w-4 h-4 text-gray-400 group-hover:text-blue-600"}):e.jsx(X,{className:"w-4 h-4 text-gray-400 group-hover:text-blue-600"})]}),h[t.name]&&e.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-48 overflow-y-auto pr-2",children:t.tools.map((s,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-1 rounded text-xs font-mono border border-green-200 dark:border-green-800 hover:bg-green-100 dark:hover:bg-green-900/50 transition-colors",title:s,children:s},n))}),!h[t.name]&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.tools.slice(0,5).map((s,n)=>e.jsx("code",{className:"inline-block bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-0.5 rounded text-xs font-mono",title:s,children:s},n)),t.tools.length>5&&e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 text-xs text-gray-500 dark:text-gray-400",children:["+",t.tools.length-5]})]})]}):e.jsx("span",{className:"text-sm text-gray-400",children:t.status==="active"?a("mcp.table.noTools"):"-"})}),e.jsx(C,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx("button",{onClick:()=>k(t.name),disabled:t.status==="validating",className:"inline-flex items-center px-2 py-1 text-xs font-medium text-green-600 bg-green-50 dark:bg-green-900/50 rounded-md hover:bg-green-100 dark:hover:bg-green-900/70 transition-colors disabled:opacity-50",title:a("mcp.actions.validate"),children:t.status==="validating"?e.jsx(w,{className:"w-3 h-3 animate-spin"}):e.jsx(M,{className:"w-3 h-3"})}),e.jsx("button",{onClick:()=>H(t),className:"inline-flex items-center px-2 py-1 text-xs font-medium text-gray-600 bg-gray-50 dark:bg-gray-900/50 rounded-md hover:bg-gray-100 dark:hover:bg-gray-900/70 transition-colors",title:a("mcp.actions.copyCommand"),children:e.jsx(G,{className:"w-3 h-3"})}),t.source==="plugin"?e.jsxs("button",{onClick:()=>E(t),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:a("mcp.actions.view"),children:[e.jsx(ye,{className:"w-3 h-3 mr-1"}),a("mcp.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>E(t),className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:a("mcp.actions.edit"),children:[e.jsx(K,{className:"w-3 h-3 mr-1"}),a("mcp.actions.edit")]}),e.jsx("button",{onClick:()=>J(t.name),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:a("mcp.actions.delete"),children:e.jsx(Y,{className:"w-4 h-4"})})]})]})})]},t.name+"-"+r))})]})})]}),ae&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsx("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full ${l?"max-w-full":"max-w-2xl"} mx-4 max-h-[90vh] overflow-y-auto`,children:e.jsxs("div",{className:`${l?"p-4":"p-6"}`,children:[e.jsxs("div",{className:`flex items-center ${l?"flex-col space-y-3":"justify-between"} mb-4`,children:[e.jsx("h2",{className:`${l?"text-lg":"text-xl"} font-semibold text-gray-900 dark:text-white`,children:a(p?"mcp.modal.editTitle":"mcp.modal.addTitle")}),e.jsxs("div",{className:`flex ${l?"w-full space-x-2":"space-x-3"}`,children:[e.jsx("button",{type:"button",onClick:oe,disabled:S,className:`${l?"flex-1 px-3 py-2 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50`,children:a("common:actions.cancel")}),e.jsx("button",{type:"submit",form:"mcp-config-form",disabled:S||!o.name.trim()||!A(o.config,o.type),className:`${l?"flex-1 px-3 py-2 text-sm":"px-4 py-2"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed`,children:a(S?"mcp.modal.saving":p?"mcp.modal.saveConfig":"mcp.modal.addConfig")})]})]}),e.jsx("form",{id:"mcp-config-form",onSubmit:ne,children:e.jsxs("div",{className:`${l?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("mcp.form.serverName")}),e.jsx("input",{type:"text",value:o.name,onChange:t=>y({...o,name:t.target.value}),placeholder:a("mcp.form.serverNamePlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${l?"text-sm":""}`,required:!0,disabled:!!p}),p&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:a("mcp.form.nameNotEditable")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("mcp.form.mcpType")}),e.jsxs("select",{value:o.type,onChange:t=>{const r=t.target.value;y({...o,type:r,config:r==="stdio"?`{
|
|
3
3
|
"type": "stdio",
|
|
4
4
|
"command": "npx",
|
|
5
5
|
"args": [
|
|
@@ -18,7 +18,7 @@ ${a.details}`),c(i=>i.map(d=>d.name===t?{...d,status:"error",error:n,tools:void
|
|
|
18
18
|
"autoApprove": [
|
|
19
19
|
"interactive_feedback"
|
|
20
20
|
]
|
|
21
|
-
}`})},className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${l?"text-sm":""}`,required:!0,children:[e.jsx("option",{value:"stdio",children:
|
|
21
|
+
}`})},className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${l?"text-sm":""}`,required:!0,children:[e.jsx("option",{value:"stdio",children:a("mcp.form.stdioOption")}),e.jsx("option",{value:"http",children:a("mcp.form.httpOption")})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:a("mcp.form.selectConnectionType")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:a("mcp.form.configuration")}),e.jsx("textarea",{value:o.config,onChange:t=>y({...o,config:t.target.value}),placeholder:o.type==="stdio"?`{
|
|
22
22
|
"type": "stdio",
|
|
23
23
|
"command": "npx",
|
|
24
24
|
"args": [
|
|
@@ -37,4 +37,4 @@ ${a.details}`),c(i=>i.map(d=>d.name===t?{...d,status:"error",error:n,tools:void
|
|
|
37
37
|
"autoApprove": [
|
|
38
38
|
"interactive_feedback"
|
|
39
39
|
]
|
|
40
|
-
}`,rows:l?10:15,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 ${l?"text-xs":""}`,required:!0}),o.config&&!A(o.config,o.type)&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:
|
|
40
|
+
}`,rows:l?10:15,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 ${l?"text-xs":""}`,required:!0}),o.config&&!A(o.config,o.type)&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:a("mcp.form.configFormatError",{fields:o.type==="stdio"?a("mcp.form.requiredFieldsStdio"):a("mcp.form.requiredFieldsHttp")})}),e.jsxs("div",{className:`mt-2 text-xs text-gray-500 dark:text-gray-400 ${l?"text-xs":""}`,children:[e.jsx("p",{children:e.jsx("strong",{children:a("mcp.form.requiredFields")})}),e.jsxs("ul",{className:"list-disc ml-4 mt-1",children:[e.jsxs("li",{children:[e.jsx("code",{children:"type"}),": ",a("mcp.form.typeField")]}),o.type==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:[e.jsx("code",{children:"command"}),": ",a("mcp.form.commandField")]}),e.jsxs("li",{children:[e.jsx("code",{children:"args"}),": ",a("mcp.form.argsField")]})]}):e.jsxs("li",{children:[e.jsx("code",{children:"url"}),": ",a("mcp.form.urlField")]})]}),e.jsx("p",{className:"mt-2",children:e.jsx("strong",{children:a("mcp.form.optionalFields")})}),e.jsxs("ul",{className:"list-disc ml-4 mt-1",children:[e.jsxs("li",{children:[e.jsx("code",{children:"timeout"}),": ",a("mcp.form.timeoutField")]}),e.jsxs("li",{children:[e.jsx("code",{children:"autoApprove"}),": ",a("mcp.form.autoApproveField")]})]})]})]})]})})]})})})]})};export{Te as McpPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as a}from"./monaco-editor-DHKm5-VF.js";import{a as m,A as g}from"./agents-
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as a}from"./monaco-editor-DHKm5-VF.js";import{a as m,A as g}from"./agents-B3InAIfY.js";import{s as h,a as p}from"./index-C8oBHB0h.js";import{u as b}from"./tools-CUwQTL-8.js";import{D as f,e as j,K as u,N as k}from"./ui-components-icUM6BEH.js";import"./syntax-highlighting-CnREyncB.js";const F=()=>{const{t:s}=b("pages"),[r,l]=a.useState(""),[o,i]=a.useState(!1),[n,d]=a.useState(!1);a.useEffect(()=>{c()},[]);const c=async()=>{d(!0);try{const t=await m(`${g}/settings/global-memory`);if(t.ok){const y=await t.text();l(y)}}catch(t){console.error("Failed to load global memory:",t)}finally{d(!1)}},x=async()=>{try{if((await m(`${g}/settings/global-memory`,{method:"POST",headers:{"Content-Type":"text/plain"},body:r})).ok)i(!1),h(s("settings.memorySettings.saveSuccess"));else throw new Error("Failed to save")}catch(t){console.error("Failed to save global memory:",t),p(s("settings.memorySettings.saveFailed"))}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:s("settings.memorySettings.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.memorySettings.description")})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("settings.memorySettings.fileSourceInfo")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"block font-medium text-gray-900 dark:text-white",children:s("settings.memorySettings.memoryContent")}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsxs("button",{onClick:()=>i(!o),className:"flex items-center space-x-1 px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[e.jsx(f,{className:"w-4 h-4"}),e.jsx("span",{children:s(o?"settings.memorySettings.cancelEdit":"settings.memorySettings.edit")})]}),e.jsxs("button",{onClick:c,disabled:n,className:"flex items-center space-x-1 px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700/50 disabled:opacity-50",children:[e.jsx(j,{className:"w-4 h-4"}),e.jsx("span",{children:s(n?"settings.memorySettings.refreshing":"settings.memorySettings.refresh")})]})]})]}),o?e.jsxs("div",{className:"space-y-3",children:[e.jsx("textarea",{value:r,onChange:t=>l(t.target.value),rows:20,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent font-mono text-sm",placeholder:s("settings.memorySettings.placeholder")}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx("button",{onClick:()=>i(!1),className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-300",children:s("settings.memorySettings.cancel")}),e.jsxs("button",{onClick:x,className:"flex items-center space-x-1 px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:[e.jsx(u,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.memorySettings.saveMemory")})]})]})]}):e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-gray-50 dark:bg-gray-700/50 min-h-[300px]",children:n?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:s("settings.memorySettings.loading")})}):r?e.jsx("pre",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap font-mono",children:r}):e.jsx("div",{className:"flex items-center justify-center h-64 text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"text-center",children:[e.jsx(k,{className:"w-12 h-12 mx-auto mb-3 text-gray-300 dark:text-gray-600"}),e.jsx("p",{children:s("settings.memorySettings.noMemory")}),e.jsx("p",{className:"text-xs mt-1",children:s("settings.memorySettings.clickEditToStart")})]})})}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 space-y-1",children:[e.jsxs("p",{children:["• ",s("settings.memorySettings.infoAutoLoad")]}),e.jsxs("p",{children:["• ",s("settings.memorySettings.infoSuggestions")]}),e.jsxs("p",{children:["• ",s("settings.memorySettings.infoFileLocation")]})]})]})]})})]})};export{F as MemorySettingsPage};
|