agentstudio 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts.map +1 -1
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{AgentsPage-CKTz2ND6.js → AgentsPage-Nvg2xu6K.js} +2 -2
- package/public/assets/{Button-Dg6ni5Yl.js → Button-Co56C389.js} +1 -1
- package/public/assets/{ChatPage-DkO3kzY2.js → ChatPage-D6sol0ad.js} +5 -5
- package/public/assets/{CommandForm-CIfw9mVj.js → CommandForm-Bk7F_HU8.js} +1 -1
- package/public/assets/{CommandsPage-BgN0E41K.js → CommandsPage-DZHyOdKd.js} +1 -1
- package/public/assets/{DashboardPage-Duu6pBON.js → DashboardPage-29qC7Ev1.js} +2 -2
- package/public/assets/{FileBrowser-Bnm7ZyGT.js → FileBrowser-BYweUPH4.js} +4 -4
- package/public/assets/FileExplorer-DNYj6Tsx.js +1 -0
- package/public/assets/{GeneralSettingsPage-BJTiwSqP.js → GeneralSettingsPage-D9Xa7Nd8.js} +1 -1
- package/public/assets/LandingPage-CjnT-cvO.js +1 -0
- package/public/assets/{LoginPage-DCI_RABC.js → LoginPage-DcaGNCXH.js} +3 -3
- package/public/assets/McpAdminSettingsPage-DgR3E2Bd.js +7 -0
- package/public/assets/{McpPage-Dj4bE6a2.js → McpPage-CtWf1CoL.js} +1 -1
- package/public/assets/{MemorySettingsPage-v7kI6DEB.js → MemorySettingsPage-JTry4Ccp.js} +1 -1
- package/public/assets/PluginsPage-D-BHjQ3P.js +1 -0
- package/public/assets/{ProjectSelector-DKkhmVGz.js → ProjectSelector-DSXOjMQC.js} +1 -1
- package/public/assets/{ProjectsPage-6nGz1v6U.js → ProjectsPage-lLUk4-Xa.js} +5 -5
- package/public/assets/ScheduledTasksPage-5hPbd9Vs.js +1 -0
- package/public/assets/{SettingsLayout-stXQCl6u.js → SettingsLayout-DGJspXLp.js} +1 -1
- package/public/assets/SkillsPage-DBw0m7D2.js +18 -0
- package/public/assets/{SubagentForm-iYJ0l9vh.js → SubagentForm-BdUK1U4y.js} +1 -1
- package/public/assets/{SubagentsPage-ksh-LWAC.js → SubagentsPage-Dnq70IFd.js} +1 -1
- package/public/assets/{ToastTestPage-pxyInZeD.js → ToastTestPage-BfJQRFIm.js} +1 -1
- package/public/assets/{ToolsList-CWZLcBx2.js → ToolsList-Dl5F2fWk.js} +1 -1
- package/public/assets/UnifiedToolSelector-CNbPsiuq.js +1 -0
- package/public/assets/{VersionSettingsPage-ClLBqAIC.js → VersionSettingsPage-BfoCcham.js} +1 -1
- package/public/assets/{_basePickBy-Ce1_TuBk.js → _basePickBy-7C_e0Xv1.js} +1 -1
- package/public/assets/{_baseUniq-Dt6C4BgZ.js → _baseUniq-eGJNLBzx.js} +1 -1
- package/public/assets/{agents-C4aCwcCz.js → agents-ChrA1R0y.js} +1 -1
- package/public/assets/arc-CuA752eE.js +1 -0
- package/public/assets/{architectureDiagram-VXUJARFQ-rnurJGX4.js → architectureDiagram-VXUJARFQ-BnPYh1OW.js} +1 -1
- package/public/assets/{blockDiagram-VD42YOAC-CM33sjhb.js → blockDiagram-VD42YOAC-72nsMt_i.js} +1 -1
- package/public/assets/{c4Diagram-YG6GDRKO-B1tJjciL.js → c4Diagram-YG6GDRKO-BNJSAXcg.js} +1 -1
- package/public/assets/channel-CIunGC5m.js +1 -0
- package/public/assets/{chunk-4BX2VUAB-vbzk_8Ta.js → chunk-4BX2VUAB-RPxkCWhH.js} +1 -1
- package/public/assets/{chunk-55IACEB6-CNXjTgeK.js → chunk-55IACEB6-3ePDt0kp.js} +1 -1
- package/public/assets/{chunk-B4BG7PRW-CykotMKj.js → chunk-B4BG7PRW-CBg_BBfl.js} +1 -1
- package/public/assets/{chunk-DI55MBZ5-DbZodDrP.js → chunk-DI55MBZ5-DIh69TUJ.js} +1 -1
- package/public/assets/{chunk-FMBD7UC4-u0h-4JXb.js → chunk-FMBD7UC4-BbjwhyTe.js} +1 -1
- package/public/assets/{chunk-QN33PNHL-B7VLbRpC.js → chunk-QN33PNHL-BpH-o_YR.js} +1 -1
- package/public/assets/{chunk-QZHKN3VN-DfcZEdwM.js → chunk-QZHKN3VN-DYB7rh5Q.js} +1 -1
- package/public/assets/{chunk-TZMSLE5B-BP4O9iGm.js → chunk-TZMSLE5B-DPCYEVb3.js} +1 -1
- package/public/assets/classDiagram-2ON5EDUG-aUQHFsTA.js +1 -0
- package/public/assets/classDiagram-v2-WZHVMYZB-aUQHFsTA.js +1 -0
- package/public/assets/clone-Ckf7tA1V.js +1 -0
- package/public/assets/{cose-bilkent-S5V4N54A-CSV8iDOr.js → cose-bilkent-S5V4N54A-CnpfmL-Y.js} +1 -1
- package/public/assets/{dagre-6UL2VRFP-S5vHkFwY.js → dagre-6UL2VRFP-DR9x77Xf.js} +1 -1
- package/public/assets/{diagram-PSM6KHXK-Bl4NbJsm.js → diagram-PSM6KHXK-SONPsQNx.js} +1 -1
- package/public/assets/{diagram-QEK2KX5R-D-6ipdkt.js → diagram-QEK2KX5R-BKYFSfC1.js} +1 -1
- package/public/assets/{diagram-S2PKOQOG-DBuN3kfb.js → diagram-S2PKOQOG-CkM0APZj.js} +1 -1
- package/public/assets/{erDiagram-Q2GNP2WA-DEhlyUw1.js → erDiagram-Q2GNP2WA-BX1DpOGx.js} +1 -1
- package/public/assets/{flowDiagram-NV44I4VS-PsSk5-Xf.js → flowDiagram-NV44I4VS-HAAlzNbq.js} +1 -1
- package/public/assets/{ganttDiagram-LVOFAZNH-PfD-vtKp.js → ganttDiagram-LVOFAZNH-BqzWexqa.js} +1 -1
- package/public/assets/{gitGraphDiagram-NY62KEGX-CUq51Mt1.js → gitGraphDiagram-NY62KEGX-CIPmSp43.js} +1 -1
- package/public/assets/{graph-Bc5M3bvZ.js → graph-m515btDj.js} +1 -1
- package/public/assets/{index-ImPzdvfG.js → index-Bn3v3S9-.js} +47 -47
- package/public/assets/index-DWieeYj4.css +1 -0
- package/public/assets/infoDiagram-F6ZHWCRC-Pn4yNWrF.js +2 -0
- package/public/assets/{journeyDiagram-XKPGCS4Q-CTyau8Sh.js → journeyDiagram-XKPGCS4Q-BfzTomS0.js} +1 -1
- package/public/assets/{kanban-definition-3W4ZIXB7-2R3dHQq1.js → kanban-definition-3W4ZIXB7-Cgju7b-L.js} +1 -1
- package/public/assets/{layout-BCktuL_6.js → layout-BKQfQSxJ.js} +1 -1
- package/public/assets/{linear-lHuinZOC.js → linear-DigtLz3B.js} +1 -1
- package/public/assets/{mindmap-definition-VGOIOE7T-Dl8qR3zk.js → mindmap-definition-VGOIOE7T-qopraVFy.js} +1 -1
- package/public/assets/{pieDiagram-ADFJNKIX-Bqcukh_c.js → pieDiagram-ADFJNKIX-BcoaAI-L.js} +2 -2
- package/public/assets/{quadrantDiagram-AYHSOK5B-C_uML1JV.js → quadrantDiagram-AYHSOK5B-D-DwcoSd.js} +1 -1
- package/public/assets/{requirementDiagram-UZGBJVZJ-QUbH9ShO.js → requirementDiagram-UZGBJVZJ-DbQCpx77.js} +1 -1
- package/public/assets/{sankeyDiagram-TZEHDZUN-CEomXpQ1.js → sankeyDiagram-TZEHDZUN-BVk8387S.js} +1 -1
- package/public/assets/{sequenceDiagram-WL72ISMW-DNsDMjTd.js → sequenceDiagram-WL72ISMW-BdzICjxO.js} +1 -1
- package/public/assets/{stateDiagram-FKZM4ZOC-BA_Narwp.js → stateDiagram-FKZM4ZOC-CYY-uUvJ.js} +1 -1
- package/public/assets/stateDiagram-v2-4FDKWEC3-Dh2Kvomq.js +1 -0
- package/public/assets/{tabManager-CkNKjP4G.js → tabManager-B2LQO_Ll.js} +1 -1
- package/public/assets/{table-CSWCaVuS.js → table-D0L2RL5i.js} +1 -1
- package/public/assets/{timeline-definition-IT6M3QCI-DeEgHBeI.js → timeline-definition-IT6M3QCI-BAvjPYvX.js} +1 -1
- package/public/assets/{tools-C7xmF_rB.js → tools-IcPNZlPj.js} +1 -1
- package/public/assets/{treemap-KMMF4GRG-5HQSTjk6.js → treemap-KMMF4GRG-DtkpVA56.js} +1 -1
- package/public/assets/{ui-components-BNdpaz32.js → ui-components-D1St49qC.js} +129 -119
- package/public/assets/{useAgents-C9aEFOWD.js → useAgents-BnDTkOG8.js} +1 -1
- package/public/assets/{useClaudeVersions-CcFqpR2o.js → useClaudeVersions-CD59tFWM.js} +1 -1
- package/public/assets/{useCommands-BadxYHf2.js → useCommands-mvMu3mMD.js} +1 -1
- package/public/assets/{useProjects-Dgk7ldPq.js → useProjects-YXOjaOwL.js} +1 -1
- package/public/assets/{xychartDiagram-PRI3JC2R-C7BNHmgo.js → xychartDiagram-PRI3JC2R-ByBTDWE2.js} +1 -1
- package/public/index.html +5 -5
- package/routes/mcp.d.ts +23 -0
- package/routes/mcp.d.ts.map +1 -1
- package/routes/mcp.js +21 -18
- package/routes/mcp.js.map +1 -1
- package/routes/mcpAdmin.d.ts +16 -0
- package/routes/mcpAdmin.d.ts.map +1 -0
- package/routes/mcpAdmin.js +308 -0
- package/routes/mcpAdmin.js.map +1 -0
- package/routes/mcpAdminManagement.d.ts +17 -0
- package/routes/mcpAdminManagement.d.ts.map +1 -0
- package/routes/mcpAdminManagement.js +345 -0
- package/routes/mcpAdminManagement.js.map +1 -0
- package/services/mcpAdmin/__tests__/adminApiKeyService.test.d.ts +5 -0
- package/services/mcpAdmin/__tests__/adminApiKeyService.test.d.ts.map +1 -0
- package/services/mcpAdmin/__tests__/adminApiKeyService.test.js +289 -0
- package/services/mcpAdmin/__tests__/adminApiKeyService.test.js.map +1 -0
- package/services/mcpAdmin/__tests__/mcpAdminRoutes.test.d.ts +5 -0
- package/services/mcpAdmin/__tests__/mcpAdminRoutes.test.d.ts.map +1 -0
- package/services/mcpAdmin/__tests__/mcpAdminRoutes.test.js +345 -0
- package/services/mcpAdmin/__tests__/mcpAdminRoutes.test.js.map +1 -0
- package/services/mcpAdmin/__tests__/mcpAdminServer.test.d.ts +5 -0
- package/services/mcpAdmin/__tests__/mcpAdminServer.test.d.ts.map +1 -0
- package/services/mcpAdmin/__tests__/mcpAdminServer.test.js +453 -0
- package/services/mcpAdmin/__tests__/mcpAdminServer.test.js.map +1 -0
- package/services/mcpAdmin/__tests__/tools.test.d.ts +5 -0
- package/services/mcpAdmin/__tests__/tools.test.d.ts.map +1 -0
- package/services/mcpAdmin/__tests__/tools.test.js +371 -0
- package/services/mcpAdmin/__tests__/tools.test.js.map +1 -0
- package/services/mcpAdmin/adminApiKeyService.d.ts +61 -0
- package/services/mcpAdmin/adminApiKeyService.d.ts.map +1 -0
- package/services/mcpAdmin/adminApiKeyService.js +270 -0
- package/services/mcpAdmin/adminApiKeyService.js.map +1 -0
- package/services/mcpAdmin/index.d.ts +10 -0
- package/services/mcpAdmin/index.d.ts.map +1 -0
- package/services/mcpAdmin/index.js +43 -0
- package/services/mcpAdmin/index.js.map +1 -0
- package/services/mcpAdmin/mcpAdminServer.d.ts +76 -0
- package/services/mcpAdmin/mcpAdminServer.d.ts.map +1 -0
- package/services/mcpAdmin/mcpAdminServer.js +243 -0
- package/services/mcpAdmin/mcpAdminServer.js.map +1 -0
- package/services/mcpAdmin/tools/agentTools.d.ts +27 -0
- package/services/mcpAdmin/tools/agentTools.d.ts.map +1 -0
- package/services/mcpAdmin/tools/agentTools.js +359 -0
- package/services/mcpAdmin/tools/agentTools.js.map +1 -0
- package/services/mcpAdmin/tools/index.d.ts +15 -0
- package/services/mcpAdmin/tools/index.d.ts.map +1 -0
- package/services/mcpAdmin/tools/index.js +30 -0
- package/services/mcpAdmin/tools/index.js.map +1 -0
- package/services/mcpAdmin/tools/mcpServerTools.d.ts +27 -0
- package/services/mcpAdmin/tools/mcpServerTools.d.ts.map +1 -0
- package/services/mcpAdmin/tools/mcpServerTools.js +334 -0
- package/services/mcpAdmin/tools/mcpServerTools.js.map +1 -0
- package/services/mcpAdmin/tools/projectTools.d.ts +27 -0
- package/services/mcpAdmin/tools/projectTools.d.ts.map +1 -0
- package/services/mcpAdmin/tools/projectTools.js +353 -0
- package/services/mcpAdmin/tools/projectTools.js.map +1 -0
- package/services/mcpAdmin/tools/systemTools.d.ts +23 -0
- package/services/mcpAdmin/tools/systemTools.d.ts.map +1 -0
- package/services/mcpAdmin/tools/systemTools.js +241 -0
- package/services/mcpAdmin/tools/systemTools.js.map +1 -0
- package/services/mcpAdmin/types.d.ts +124 -0
- package/services/mcpAdmin/types.d.ts.map +1 -0
- package/services/mcpAdmin/types.js +18 -0
- package/services/mcpAdmin/types.js.map +1 -0
- package/public/assets/FileExplorer-Dy8ZFDtK.js +0 -1
- package/public/assets/LandingPage-CCqtSDce.js +0 -1
- package/public/assets/PluginsPage-CQ08px0h.js +0 -1
- package/public/assets/ScheduledTasksPage-Dv8qPeLY.js +0 -1
- package/public/assets/SkillsPage-DlQPlwG5.js +0 -18
- package/public/assets/UnifiedToolSelector-A2UIt1Xn.js +0 -1
- package/public/assets/arc-c63c3GDw.js +0 -1
- package/public/assets/channel-6fK1csbi.js +0 -1
- package/public/assets/classDiagram-2ON5EDUG-PrDkNsdA.js +0 -1
- package/public/assets/classDiagram-v2-WZHVMYZB-PrDkNsdA.js +0 -1
- package/public/assets/clone-CXX9AxT7.js +0 -1
- package/public/assets/index-TEVaBQiv.css +0 -1
- package/public/assets/infoDiagram-F6ZHWCRC-BTR1hJCm.js +0 -2
- package/public/assets/stateDiagram-v2-4FDKWEC3-Cy5am68v.js +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{a as A,b as c}from"./index-Bn3v3S9-.js";import{u as Ce,b as U,c as S,A as d}from"./agents-ChrA1R0y.js";import{u as Te}from"./tools-IcPNZlPj.js";import{H as $e,R as Ee,I as Pe,C as Fe,j as ze,K as Z,p as De,J as qe,E as Le,t as _,N as Me,O as Ie,d as Re,v as Oe,Q as Qe,U as ee}from"./ui-components-D1St49qC.js";import"./syntax-highlighting-CnREyncB.js";async function Be(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/status`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch status");return r.json()}async function Ue(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/keys`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch keys");return r.json()}async function _e(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/tools`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch tools");return r.json()}async function He(s){const r=localStorage.getItem("authToken"),l=await fetch(`${d}/mcp-admin-management/keys`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new Error("Failed to create key");return l.json()}async function Je(s){const r=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}})).ok)throw new Error("Failed to revoke key")}async function Ve(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}`,{method:"PUT",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(r)})).ok)throw new Error("Failed to update key")}async function Ge(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}/toggle`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:r})})).ok)throw new Error("Failed to toggle key")}async function te(s){const r=localStorage.getItem("authToken"),l=await fetch(`${d}/mcp-admin-management/config-snippet?apiKey=${encodeURIComponent(s)}`,{headers:{Authorization:`Bearer ${r}`}});if(!l.ok)throw new Error("Failed to fetch config");return l.json()}const at=()=>{const{t:s}=Te("pages"),r=Ce(),[l,u]=i.useState(!1),[se,K]=i.useState(!1),[C,T]=i.useState(""),[y,H]=i.useState(null),[o,$]=i.useState(null),[b,J]=i.useState("cursor"),[E,ae]=i.useState(new Set),[re,P]=i.useState(!1),[F,V]=i.useState(null),[m,j]=i.useState(new Set),[h,z]=i.useState(!1),[ne,D]=i.useState(!1),[q,L]=i.useState(null),[G,W]=i.useState(""),[x,f]=i.useState(new Set),[p,M]=i.useState(!1),[ie,X]=i.useState(null),{data:N,isLoading:le,refetch:de}=U({queryKey:["mcpAdminStatus"],queryFn:Be}),{data:ce,isLoading:oe,refetch:me}=U({queryKey:["mcpAdminKeys"],queryFn:Ue}),{data:xe,isLoading:ge}=U({queryKey:["mcpAdminTools"],queryFn:_e}),I=S({mutationFn:He,onSuccess:async t=>{H(t.key),u(!1),T(""),j(new Set),z(!1),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]});try{const a=await te(t.key);$(a),K(!0)}catch{c(s("settings.mcpAdmin.errors.configFetch"))}},onError:t=>{c(s("settings.mcpAdmin.errors.createFailed"),t instanceof Error?t.message:void 0)}}),he=S({mutationFn:Je,onSuccess:()=>{A(s("settings.mcpAdmin.success.keyRevoked")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{c(s("settings.mcpAdmin.errors.revokeFailed"),t instanceof Error?t.message:void 0)}}),R=S({mutationFn:({keyId:t,data:a})=>Ve(t,a),onSuccess:()=>{A(s("settings.mcpAdmin.success.keyUpdated")),D(!1),L(null),r.invalidateQueries({queryKey:["mcpAdminKeys"]})},onError:t=>{c(s("settings.mcpAdmin.errors.updateFailed"),t instanceof Error?t.message:void 0)}}),pe=S({mutationFn:({keyId:t,enabled:a})=>Ge(t,a),onSuccess:(t,a)=>{A(a.enabled?s("settings.mcpAdmin.success.keyEnabled"):s("settings.mcpAdmin.success.keyDisabled")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{c(s("settings.mcpAdmin.errors.toggleFailed"),t instanceof Error?t.message:void 0)}}),ue=()=>{if(!C.trim()){c(s("settings.mcpAdmin.errors.descriptionRequired"));return}I.mutate({description:C.trim(),permissions:["admin:*"],allowedTools:h&&m.size>0?Array.from(m):void 0})},ye=t=>{j(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},be=()=>{j(new Set(k.map(t=>t.name)))},je=()=>{j(new Set)},fe=t=>{L(t),W(t.description),t.allowedTools&&t.allowedTools.length>0?(M(!0),f(new Set(t.allowedTools))):(M(!1),f(new Set)),D(!0)},ke=()=>{q&&R.mutate({keyId:q.id,data:{description:G.trim()||void 0,allowedTools:p&&x.size>0?Array.from(x):[]}})},ve=t=>{f(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},we=t=>{pe.mutate({keyId:t.id,enabled:!t.enabled})},Ne=t=>{confirm(s("settings.mcpAdmin.confirmRevoke"))&&he.mutate(t)},O=async t=>{try{await navigator.clipboard.writeText(t),A(s("settings.mcpAdmin.success.copied"))}catch{c(s("settings.mcpAdmin.errors.copyFailed"))}},Ae=t=>{ae(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},Se=async t=>{if(t.fullKey)try{const a=await te(t.fullKey);$(a),V(t.fullKey),K(!0)}catch{c(s("settings.mcpAdmin.errors.configFetch"))}},Y=ce?.keys||[],k=xe?.tools||[],Ke=(t,a="right")=>{const n=t.inputSchema?.properties||{},v=t.inputSchema?.required||[],g=Object.entries(n),w=a==="right"?"left-full ml-2":"right-full mr-2";return e.jsxs("div",{className:`absolute z-50 ${w} top-0 w-72 bg-gray-900 text-white rounded-lg shadow-xl p-3 text-sm`,children:[e.jsx("div",{className:"font-medium text-blue-300 mb-1",children:t.name}),e.jsx("p",{className:"text-gray-300 text-xs mb-2",children:t.description}),g.length>0&&e.jsxs("div",{className:"border-t border-gray-700 pt-2",children:[e.jsxs("div",{className:"text-xs text-gray-400 mb-1",children:[s("settings.mcpAdmin.toolParams"),":"]}),e.jsx("div",{className:"space-y-1",children:g.map(([Q,B])=>e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-mono text-green-400",children:Q}),v.includes(Q)&&e.jsx("span",{className:"text-red-400 ml-1",children:"*"}),e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",B.type,")"]}),B.description&&e.jsx("p",{className:"text-gray-400 ml-2 mt-0.5",children:B.description})]},Q))})]}),g.length===0&&e.jsx("div",{className:"text-xs text-gray-500 italic",children:s("settings.mcpAdmin.noParams")})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:s("settings.mcpAdmin.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.mcpAdmin.subtitle")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("button",{onClick:()=>P(!0),className:"flex items-center space-x-2 px-3 py-2 text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:[e.jsx($e,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.help.button")})]}),e.jsxs("button",{onClick:()=>{de(),me()},className:"flex items-center space-x-2 px-3 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:[e.jsx(Ee,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.refresh")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(Pe,{className:"w-6 h-6 text-blue-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.serverStatus")})]}),le?e.jsxs("div",{className:"animate-pulse space-y-3",children:[e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/3"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/2"})]}):N?e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{className:"w-5 h-5 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.status")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.status.active")})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.version")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:N.version})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.tools")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:N.toolCount})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.activeKeys")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:N.activeKeyCount})]})]}):e.jsxs("div",{className:"flex items-center space-x-2 text-red-500",children:[e.jsx(ze,{className:"w-5 h-5"}),e.jsx("span",{children:s("settings.mcpAdmin.status.unavailable")})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("settings.mcpAdmin.endpoint"),": ",e.jsxs("code",{className:"bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded text-sm",children:[d,"/mcp-admin"]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(Z,{className:"w-6 h-6 text-yellow-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.apiKeys")})]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center space-x-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[e.jsx(De,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.createKey")})]})]}),oe?e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(t=>e.jsx("div",{className:"h-16 bg-gray-200 dark:bg-gray-700 rounded"},t))}):Y.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Z,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.noKeys")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:s("settings.mcpAdmin.noKeysHint")})]}):e.jsx("div",{className:"space-y-3",children:Y.map(t=>e.jsx("div",{className:`p-4 rounded-lg border ${t.isRevoked?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-60":t.enabled?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700":"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-70"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.description}),t.isRevoked&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300 rounded",children:s("settings.mcpAdmin.revoked")}),!t.isRevoked&&!t.enabled&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 rounded",children:s("settings.mcpAdmin.disabled")})]}),e.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[e.jsx("code",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:E.has(t.id)&&t.fullKey?t.fullKey:t.maskedKey}),!t.isRevoked&&t.fullKey&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Ae(t.id),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:E.has(t.id)?s("settings.mcpAdmin.hideKey"):s("settings.mcpAdmin.showKey"),children:E.has(t.id)?e.jsx(qe,{className:"w-4 h-4"}):e.jsx(Le,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>O(t.fullKey),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:s("settings.mcpAdmin.copyKey"),children:e.jsx(_,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{children:[s("settings.mcpAdmin.createdAt"),": ",new Date(t.createdAt).toLocaleDateString()]}),t.lastUsedAt&&e.jsxs("span",{children:[s("settings.mcpAdmin.lastUsed"),": ",new Date(t.lastUsedAt).toLocaleDateString()]}),t.allowedTools&&t.allowedTools.length>0?e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:["🔒 ",s("settings.mcpAdmin.limitedTools",{count:t.allowedTools.length})]}):e.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["✓ ",s("settings.mcpAdmin.allToolsAccess")]})]})]}),e.jsx("div",{className:"flex items-center space-x-2 ml-4",children:!t.isRevoked&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>we(t),className:`p-2 rounded-lg transition-colors ${t.enabled?"text-green-600 hover:bg-green-50 dark:hover:bg-green-900/20":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:t.enabled?s("settings.mcpAdmin.disableKey"):s("settings.mcpAdmin.enableKey"),children:t.enabled?e.jsx(Me,{className:"w-4 h-4"}):e.jsx(Ie,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>fe(t),className:"p-2 text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.editKey"),children:e.jsx(Re,{className:"w-4 h-4"})}),t.fullKey&&e.jsx("button",{onClick:()=>Se(t),className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.viewConfig"),children:s("settings.mcpAdmin.viewConfig")}),e.jsx("button",{onClick:()=>Ne(t.id),className:"p-2 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.revokeKey"),children:e.jsx(Oe,{className:"w-4 h-4"})})]})})]})},t.id))})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(Qe,{className:"w-6 h-6 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.availableTools")})]}),ge?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4].map(t=>e.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded"},t))}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:k.map((t,a)=>{const n=a%2===1;return e.jsxs("div",{className:"relative flex items-start space-x-3 p-3 bg-gray-50 dark:bg-gray-900 rounded-lg cursor-help hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",onMouseEnter:()=>X(t),onMouseLeave:()=>X(null),children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-sm text-gray-900 dark:text-white",children:t.name}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t.description})]}),ie?.name===t.name&&Ke(t,n?"left":"right")]},t.name)})})]}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:s("settings.mcpAdmin.createKeyTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.keyDescription")}),e.jsx("input",{type:"text",value:C,onChange:t=>T(t.target.value),placeholder:s("settings.mcpAdmin.keyDescriptionPlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
|
|
2
|
+
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
3
|
+
focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:t=>z(t.target.checked),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s("settings.mcpAdmin.limitTools")})]}),h&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("button",{onClick:be,className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.selectAll")}),e.jsx("span",{className:"text-gray-400",children:"|"}),e.jsx("button",{onClick:je,className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.deselectAll")})]})]}),h&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-3 max-h-64 overflow-y-auto",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(t=>{const a=Object.entries(t.inputSchema?.properties||{}),n=a.length>0?`
|
|
4
|
+
${s("settings.mcpAdmin.toolParams")}: ${a.map(([g,w])=>`${g}(${w.type})`).join(", ")}`:"",v=`${t.description}${n}`;return e.jsxs("label",{title:v,className:`flex items-center space-x-2 p-2 rounded-lg cursor-pointer transition-colors ${m.has(t.name)?"bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800":"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750"}`,children:[e.jsx("input",{type:"checkbox",checked:m.has(t.name),onChange:()=>ye(t.name),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"text-sm font-mono text-gray-900 dark:text-white truncate",children:t.name})})]},t.name)})}),m.size>0&&e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.selectedToolsCount",{count:m.size})})]}),!h&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(ee,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.fullPermissions")})]})]})]}),e.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[e.jsx("button",{onClick:()=>{u(!1),T(""),j(new Set),z(!1)},className:"px-4 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:s("settings.mcpAdmin.cancel")}),e.jsx("button",{onClick:ue,disabled:I.isPending||h&&m.size===0,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50",children:I.isPending?s("settings.mcpAdmin.creating"):s("settings.mcpAdmin.create")})]})]})}),se&&o&&(y||F)&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:s(y?"settings.mcpAdmin.keyCreated":"settings.mcpAdmin.configTitle")}),y&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:e.jsxs("p",{className:"text-sm text-yellow-700 dark:text-yellow-400",children:["⚠️ ",s("settings.mcpAdmin.saveKeyWarning")]})}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.yourApiKey")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("code",{className:"flex-1 p-3 bg-gray-100 dark:bg-gray-900 rounded-lg font-mono text-sm break-all",children:y||F}),e.jsx("button",{onClick:()=>O(y||F||""),className:"p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:e.jsx(_,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex space-x-2 mb-4",children:[e.jsx("button",{onClick:()=>J("cursor"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${b==="cursor"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:"Cursor"}),e.jsx("button",{onClick:()=>J("claude-desktop"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${b==="claude-desktop"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:"Claude Desktop"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[s("settings.mcpAdmin.configFile"),":",e.jsx("code",{className:"ml-2 text-xs text-gray-500",children:b==="cursor"?o.cursor.configPath:o.claudeDesktop.configPath})]}),e.jsxs("button",{onClick:()=>O(b==="cursor"?o.cursor.configString:o.claudeDesktop.configString),className:"flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700",children:[e.jsx(_,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.copyConfig")})]})]}),e.jsx("pre",{className:"p-4 bg-gray-900 text-gray-100 rounded-lg overflow-x-auto text-sm font-mono",children:b==="cursor"?o.cursor.configString:o.claudeDesktop.configString})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx("button",{onClick:()=>{K(!1),H(null),V(null),$(null)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg",children:s("settings.mcpAdmin.done")})})]})}),ne&&q&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:s("settings.mcpAdmin.editKeyTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.keyDescription")}),e.jsx("input",{type:"text",value:G,onChange:t=>W(t.target.value),placeholder:s("settings.mcpAdmin.keyDescriptionPlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
|
|
5
|
+
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
6
|
+
focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:t=>M(t.target.checked),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s("settings.mcpAdmin.limitTools")})]}),p&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("button",{onClick:()=>f(new Set(k.map(t=>t.name))),className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.selectAll")}),e.jsx("span",{className:"text-gray-400",children:"|"}),e.jsx("button",{onClick:()=>f(new Set),className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.deselectAll")})]})]}),p&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-3 max-h-64 overflow-y-auto",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(t=>{const a=Object.entries(t.inputSchema?.properties||{}),n=a.length>0?`
|
|
7
|
+
${s("settings.mcpAdmin.toolParams")}: ${a.map(([g,w])=>`${g}(${w.type})`).join(", ")}`:"",v=`${t.description}${n}`;return e.jsxs("label",{title:v,className:`flex items-center space-x-2 p-2 rounded-lg cursor-pointer transition-colors ${x.has(t.name)?"bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800":"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750"}`,children:[e.jsx("input",{type:"checkbox",checked:x.has(t.name),onChange:()=>ve(t.name),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"text-sm font-mono text-gray-900 dark:text-white truncate",children:t.name})})]},t.name)})}),x.size>0&&e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.selectedToolsCount",{count:x.size})})]}),!p&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(ee,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.fullPermissions")})]})]})]}),e.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[e.jsx("button",{onClick:()=>{D(!1),L(null)},className:"px-4 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:s("settings.mcpAdmin.cancel")}),e.jsx("button",{onClick:ke,disabled:R.isPending||p&&x.size===0,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50",children:R.isPending?s("settings.mcpAdmin.saving"):s("settings.mcpAdmin.save")})]})]})}),re&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-3xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.help.title")}),e.jsx("button",{onClick:()=>P(!1),className:"p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:"×"})]}),e.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.whatIs")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:s("settings.mcpAdmin.help.whatIsDesc")}),e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.howToUse")}),e.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-gray-600 dark:text-gray-400 mb-4",children:[e.jsx("li",{children:s("settings.mcpAdmin.help.step1")}),e.jsx("li",{children:s("settings.mcpAdmin.help.step2")}),e.jsx("li",{children:s("settings.mcpAdmin.help.step3")}),e.jsx("li",{children:s("settings.mcpAdmin.help.step4")})]}),e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.availableTools")}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-gray-600 dark:text-gray-400 mb-4",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"list_projects"})," - ",s("settings.mcpAdmin.help.toolListProjects")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"get_project"})," - ",s("settings.mcpAdmin.help.toolGetProject")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"list_agents"})," - ",s("settings.mcpAdmin.help.toolListAgents")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"get_agent"})," - ",s("settings.mcpAdmin.help.toolGetAgent")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"health_check"})," - ",s("settings.mcpAdmin.help.toolHealthCheck")]})]}),e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.examples")}),e.jsxs("div",{className:"bg-gray-100 dark:bg-gray-900 rounded-lg p-4 mb-4",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:s("settings.mcpAdmin.help.examplePrompt")}),e.jsx("code",{className:"text-sm text-purple-600 dark:text-purple-400",children:'"请帮我列出 AgentStudio 中所有的项目"'})]})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx("button",{onClick:()=>P(!1),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg",children:s("settings.mcpAdmin.done")})})]})})]})};export{at as McpAdminSettingsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-ChrA1R0y.js";import{u as ce,s as U,a as V,b}from"./index-Bn3v3S9-.js";import{T as me,a as xe,b as B,c as v,d as pe,e as C}from"./table-D0L2RL5i.js";import{u as ge}from"./tools-IcPNZlPj.js";import{g as ue,L as N,p as he,C as M,n as be,q as fe,r as W,s as z,k as X,t as G,u as K,v as Y,E as ye}from"./ui-components-D1St49qC.js";import"./syntax-highlighting-CnREyncB.js";const Te=()=>{const{t:s}=ge("pages"),{isMobile:l}=ce(),[x,c]=m.useState([]),[Z,q]=m.useState(!0),[$,ee]=m.useState(""),[w,te]=m.useState(""),[se,f]=m.useState(!1),[p,D]=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({}),ae=async()=>{try{q(!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{q(!1)}};Q.useEffect(()=>{ae()},[]),Q.useEffect(()=>{const t=setTimeout(()=>{te($)},300);return()=>clearTimeout(t)},[$]);const k=async t=>{try{console.log("Validating MCP server:",t),c(a=>a.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 a=await r.json();c(n=>n.map(i=>i.name===t?{...i,status:"active",tools:a.tools||[],error:void 0}:i))}else{const a=await r.json();let n=a.error||s("mcp.errors.validationFailed");a.details&&(n+=`
|
|
2
2
|
${a.details}`),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"?`{
|
|
3
3
|
"type": "stdio",
|
|
4
4
|
"command": "npx",
|
|
@@ -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-ChrA1R0y.js";import{a as h,b as p}from"./index-Bn3v3S9-.js";import{u as b}from"./tools-IcPNZlPj.js";import{u as f,e as j,y as u,z as k}from"./ui-components-D1St49qC.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as o,W as A}from"./monaco-editor-DHKm5-VF.js";import{u as Z,b as D,c as E,a as w,A as N}from"./agents-ChrA1R0y.js";import{b as P,a as T,s as H,u as z}from"./index-Bn3v3S9-.js";import{u as F}from"./tools-IcPNZlPj.js";import{c as de,B as v}from"./Button-Co56C389.js";import{aD as I,aE as K,f as q,g as X,p as J,R as oe,v as _,X as ue,E as Y,e as me,I as xe,aF as ge,Z as pe,$ as he,o as ye,aG as be,C as fe,ab as je}from"./ui-components-D1St49qC.js";import{F as ve}from"./FileExplorer-DNYj6Tsx.js";import"./syntax-highlighting-CnREyncB.js";const ee=o.createContext(void 0),se=()=>{const s=o.useContext(ee);if(!s)throw new Error("Tabs compound components must be used within Tabs");return s},ae=o.forwardRef(({value:s,onValueChange:a,defaultValue:l,className:i,children:n},r)=>{const[p,m]=o.useState(s||l||"");o.useEffect(()=>{s!==void 0&&m(s)},[s]);const y=o.useCallback(t=>{m(t),a?.(t)},[a]);return e.jsx(ee.Provider,{value:{value:p,onValueChange:y},children:e.jsx("div",{ref:r,className:i,children:n})})});ae.displayName="Tabs";const te=o.forwardRef(({className:s,children:a,...l},i)=>e.jsx("div",{ref:i,className:`inline-flex h-10 items-center justify-center rounded-md bg-gray-100 dark:bg-gray-800 p-1 text-gray-500 dark:text-gray-400 ${s||""}`,...l,children:a}));te.displayName="TabsList";const Q=o.forwardRef(({className:s,value:a,children:l,...i},n)=>{const{value:r,onValueChange:p}=se(),m=r===a;return e.jsx("button",{ref:n,type:"button",role:"tab","aria-selected":m,onClick:()=>p?.(a),className:`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${m?"bg-white dark:bg-gray-950 text-gray-950 dark:text-gray-50 shadow-sm":"hover:bg-gray-200/50 dark:hover:bg-gray-700/50"} ${s||""}`,...i,children:l})});Q.displayName="TabsTrigger";const V=o.forwardRef(({className:s,value:a,children:l,...i},n)=>{const{value:r}=se();return r!==a?null:e.jsx("div",{ref:n,role:"tabpanel",className:`mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 ${s||""}`,...i,children:l})});V.displayName="TabsContent";const ke=()=>{const s=Z(),{t:a}=F("pages"),{data:l=[],isLoading:i,error:n,refetch:r}=D({queryKey:["plugin-marketplaces"],queryFn:async()=>{const t=await w(`${N}/plugins/marketplaces`);if(!t.ok)throw new Error("Failed to fetch marketplaces");return(await t.json()).marketplaces}}),p=E({mutationFn:async t=>{const u=await w(`${N}/plugins/marketplaces`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!u.ok){const h=await u.json();throw new Error(h.error||"Failed to add marketplace")}return u.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["plugin-marketplaces"]}),s.invalidateQueries({queryKey:["plugins-available"]}),T(a("plugins.messages.marketplaceAddSuccess"))},onError:t=>{P(a("plugins.messages.marketplaceAddError"),t.message)}}),m=E({mutationFn:async t=>{const u=await w(`${N}/plugins/marketplaces/${t}/sync`,{method:"POST"});if(!u.ok){const h=await u.json();throw new Error(h.error||"Failed to sync marketplace")}return u.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["plugin-marketplaces"]}),s.invalidateQueries({queryKey:["plugins-available"]}),T(a("plugins.messages.marketplaceSyncSuccess"))},onError:t=>{P(a("plugins.messages.marketplaceSyncError"),t.message)}}),y=E({mutationFn:async t=>{const u=await w(`${N}/plugins/marketplaces/${t}`,{method:"DELETE"});if(!u.ok){const h=await u.json();throw new Error(h.error||"Failed to remove marketplace")}return u.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["plugin-marketplaces"]}),s.invalidateQueries({queryKey:["plugins-available"]}),s.invalidateQueries({queryKey:["plugins-installed"]}),T(a("plugins.messages.marketplaceRemoveSuccess"))},onError:t=>{P(a("plugins.messages.marketplaceRemoveError"),t.message)}});return{marketplaces:l,isLoading:i,error:n,refetch:r,addMarketplace:p.mutate,isAddingMarketplace:p.isPending,syncMarketplace:m.mutate,isSyncingMarketplace:m.isPending,removeMarketplace:y.mutate,isRemovingMarketplace:y.isPending}},we=()=>{const s=Z(),{t:a}=F("pages"),{data:l=[],isLoading:i,error:n,refetch:r}=D({queryKey:["plugins-available"],queryFn:async()=>{const g=await w(`${N}/plugins/available`);if(!g.ok)throw new Error("Failed to fetch available plugins");return(await g.json()).plugins}}),{data:p=[],isLoading:m,error:y,refetch:t}=D({queryKey:["plugins-installed"],queryFn:async()=>{const g=await w(`${N}/plugins/installed`);if(!g.ok)throw new Error("Failed to fetch installed plugins");return(await g.json()).plugins}}),u=E({mutationFn:async g=>{const f=await w(`${N}/plugins/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(!f.ok){const b=await f.json();throw new Error(b.error||"Failed to install plugin")}return f.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["plugins-available"]}),s.invalidateQueries({queryKey:["plugins-installed"]}),H(a("plugins.messages.installSuccess"))},onError:g=>{P(a("plugins.messages.installError"),g.message)}}),h=E({mutationFn:async({marketplaceName:g,pluginName:f})=>{const b=await w(`${N}/plugins/${g}/${f}/enable`,{method:"POST"});if(!b.ok){const x=await b.json();throw new Error(x.error||"Failed to enable plugin")}return b.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["plugins-available"]}),s.invalidateQueries({queryKey:["plugins-installed"]}),H(a("plugins.messages.enableSuccess"))},onError:g=>{P(a("plugins.messages.enableError"),g.message)}}),S=E({mutationFn:async({marketplaceName:g,pluginName:f})=>{const b=await w(`${N}/plugins/${g}/${f}/disable`,{method:"POST"});if(!b.ok){const x=await b.json();throw new Error(x.error||"Failed to disable plugin")}return b.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["plugins-available"]}),s.invalidateQueries({queryKey:["plugins-installed"]}),T(a("plugins.messages.disableSuccess"))},onError:g=>{P(a("plugins.messages.disableError"),g.message)}}),j=E({mutationFn:async({marketplaceName:g,pluginName:f})=>{const b=await w(`${N}/plugins/${g}/${f}`,{method:"DELETE"});if(!b.ok){const x=await b.json();throw new Error(x.error||"Failed to uninstall plugin")}return b.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["plugins-available"]}),s.invalidateQueries({queryKey:["plugins-installed"]}),T(a("plugins.messages.uninstallSuccess"))},onError:g=>{P(a("plugins.messages.uninstallError"),g.message)}});return{availablePlugins:l,isLoadingAvailable:i,availableError:n,refetchAvailable:r,installedPlugins:p,isLoadingInstalled:m,installedError:y,refetchInstalled:t,installPlugin:u.mutate,isInstallingPlugin:u.isPending,enablePlugin:h.mutate,isEnablingPlugin:h.isPending,disablePlugin:S.mutate,isDisablingPlugin:S.isPending,uninstallPlugin:j.mutate,isUninstallingPlugin:j.isPending}},Ne=(s,a)=>D({queryKey:["plugin-detail",s,a],queryFn:async()=>{if(!s||!a)return null;const l=await w(`${N}/plugins/${s}/${a}`);if(!l.ok)throw new Error("Failed to fetch plugin details");return await l.json()},enabled:!!s&&!!a}),Se=(s,a,l)=>D({queryKey:["plugin-file-content",s,a,l],queryFn:async()=>{if(!s||!a||!l)return null;const i=await w(`${N}/plugins/${s}/${a}/files/${l}`);if(!i.ok)throw new Error("Failed to fetch file content");return await i.json()},enabled:!!s&&!!a&&!!l}),M=A.forwardRef(({className:s,type:a,...l},i)=>e.jsx("input",{type:a,className:de("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),ref:i,...l}));M.displayName="Input";const $=o.forwardRef(({className:s,...a},l)=>e.jsx("label",{ref:l,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 ${s||""}`,...a}));$.displayName="Label";const re=({open:s,onOpenChange:a,children:l})=>(o.useEffect(()=>{const i=n=>{n.key==="Escape"&&s&&a&&a(!1)};return s&&(document.addEventListener("keydown",i),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}},[s,a]),s?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50",onClick:()=>a&&a(!1)}),e.jsx("div",{className:"relative z-50 w-full flex items-center justify-center",children:l})]}):null),O=o.forwardRef(({className:s,children:a,...l},i)=>e.jsx("div",{ref:i,className:`relative bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 ${s||""}`,...l,children:a}));O.displayName="DialogContent";const le=({className:s,children:a,...l})=>e.jsx("div",{className:`mb-4 ${s||""}`,...l,children:a}),B=o.forwardRef(({className:s,children:a,...l},i)=>e.jsx("h2",{ref:i,className:`text-lg font-semibold text-gray-900 dark:text-white ${s||""}`,...l,children:a}));B.displayName="DialogTitle";const Ce=({className:s,children:a,...l})=>e.jsx("div",{className:`flex justify-end space-x-2 ${s||""}`,...l,children:a}),G=o.forwardRef(({children:s,value:a,onValueChange:l,...i},n)=>{const[r,p]=o.useState(!1),[m,y]=o.useState(a||"");o.useEffect(()=>{a!==void 0&&y(a)},[a]);const t=u=>{y(u),l&&l(u),p(!1)};return e.jsx("div",{ref:n,className:"relative",...i,children:o.Children.map(s,u=>o.isValidElement(u)?o.cloneElement(u,{selectedValue:m,isOpen:r,setIsOpen:p,onSelect:t}):u)})});G.displayName="Select";const U=o.forwardRef(({children:s,selectedValue:a,isOpen:l,setIsOpen:i,className:n,...r},p)=>e.jsxs("button",{ref:p,type:"button",onClick:()=>i&&i(!l),className:`flex h-10 w-full items-center justify-between rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 ${n||""}`,...r,children:[e.jsx("div",{className:"flex-1 text-left flex items-center",children:s}),e.jsx("svg",{className:"h-4 w-4 opacity-50 ml-2 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}));U.displayName="SelectTrigger";const ne=o.forwardRef(({placeholder:s,selectedValue:a,children:l},i)=>l?e.jsx("span",{ref:i,children:l}):e.jsx("span",{ref:i,children:a||s}));ne.displayName="SelectValue";const W=o.forwardRef(({children:s,isOpen:a,onSelect:l,...i},n)=>a?e.jsx("div",{ref:n,className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 shadow-lg",...i,children:o.Children.map(s,r=>o.isValidElement(r)?o.cloneElement(r,{onSelect:l}):r)}):null);W.displayName="SelectContent";const L=o.forwardRef(({value:s,children:a,onSelect:l,...i},n)=>e.jsx("div",{ref:n,onClick:()=>l&&l(s),className:"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-900 dark:text-gray-100",...i,children:a}));L.displayName="SelectItem";const Ee=({isOpen:s,onClose:a,onAdd:l,isAdding:i})=>{const{t:n}=F("pages"),[r,p]=o.useState({name:"",type:"github",source:"",description:"",branch:"main"}),m=t=>{t.preventDefault(),l(r),y()},y=()=>{p({name:"",type:"github",source:"",description:"",branch:"main"}),a()};return e.jsx(re,{open:s,onOpenChange:y,children:e.jsxs(O,{className:"max-w-[600px] w-full max-h-[90vh] overflow-y-auto",children:[e.jsx(le,{children:e.jsx(B,{children:n("plugins.marketplaces.addModal.title")})}),e.jsxs("form",{onSubmit:m,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx($,{htmlFor:"name",children:n("plugins.marketplaces.addModal.name")}),e.jsx(M,{id:"name",value:r.name,onChange:t=>p({...r,name:t.target.value}),placeholder:n("plugins.marketplaces.addModal.namePlaceholder"),required:!0})]}),e.jsxs("div",{children:[e.jsx($,{htmlFor:"type",children:n("plugins.marketplaces.addModal.type")}),e.jsxs(G,{value:r.type,onValueChange:t=>p({...r,type:t}),children:[e.jsx(U,{children:e.jsxs("div",{className:"flex items-center space-x-2",children:[r.type==="github"&&e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-4 h-4"}),e.jsx("span",{children:"GitHub"})]}),r.type==="git"&&e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:"Git Repository"})]}),r.type==="local"&&e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"w-4 h-4"}),e.jsx("span",{children:"Local Directory"})]})]})}),e.jsxs(W,{children:[e.jsx(L,{value:"github",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{className:"w-4 h-4"}),e.jsx("span",{children:"GitHub"})]})}),e.jsx(L,{value:"git",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:"Git Repository"})]})}),e.jsx(L,{value:"local",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(q,{className:"w-4 h-4"}),e.jsx("span",{children:"Local Directory"})]})})]})]})]}),e.jsxs("div",{children:[e.jsx($,{htmlFor:"source",children:n("plugins.marketplaces.addModal.source")}),e.jsx(M,{id:"source",value:r.source,onChange:t=>p({...r,source:t.target.value}),placeholder:r.type==="local"?n("plugins.marketplaces.addModal.sourcePlaceholderLocal"):r.type==="github"?n("plugins.marketplaces.addModal.sourcePlaceholderGithub"):n("plugins.marketplaces.addModal.sourcePlaceholderGit"),required:!0})]}),(r.type==="git"||r.type==="github")&&e.jsxs("div",{children:[e.jsx($,{htmlFor:"branch",children:n("plugins.marketplaces.addModal.branch")}),e.jsx(M,{id:"branch",value:r.branch,onChange:t=>p({...r,branch:t.target.value}),placeholder:n("plugins.marketplaces.addModal.branchPlaceholder")})]}),e.jsxs("div",{children:[e.jsx($,{htmlFor:"description",children:n("plugins.marketplaces.addModal.description")}),e.jsx(M,{id:"description",value:r.description,onChange:t=>p({...r,description:t.target.value}),placeholder:n("plugins.marketplaces.addModal.descriptionPlaceholder")})]})]}),e.jsxs(Ce,{className:"mt-6",children:[e.jsx(v,{type:"button",variant:"outline",onClick:y,disabled:i,children:n("plugins.marketplaces.addModal.cancel")}),e.jsx(v,{type:"submit",disabled:i,children:n(i?"plugins.marketplaces.addModal.adding":"plugins.marketplaces.addModal.add")})]})]})]})})},Pe=({marketplaces:s,isLoading:a,onAddMarketplace:l,isAdding:i,onSyncMarketplace:n,isSyncing:r,onRemoveMarketplace:p,isRemoving:m,onMarketplaceClick:y})=>{const{t}=F("pages"),{isMobile:u}=z(),[h,S]=o.useState(""),[j,g]=o.useState(!1),f=s.filter(x=>x.displayName.toLowerCase().includes(h.toLowerCase())||x.source.toLowerCase().includes(h.toLowerCase())),b=(x,C)=>{window.confirm(t("plugins.marketplaces.confirmDelete",{name:C}))&&p(x)};return a?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:"Loading..."})]})}):e.jsxs("div",{children:[e.jsxs("div",{className:`${u?"space-y-3":"flex items-center justify-between"} mb-6`,children:[e.jsxs("div",{className:`${u?"":"flex-1 max-w-md"} relative`,children:[e.jsx(X,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5"}),e.jsx(M,{type:"text",placeholder:t("plugins.marketplaces.searchPlaceholder"),value:h,onChange:x=>S(x.target.value),className:"pl-10"})]}),e.jsxs(v,{onClick:()=>g(!0),className:u?"w-full":"",children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),t("plugins.marketplaces.addButton")]})]}),f.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-6xl mb-4",children:"📦"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:t(h?"plugins.marketplaces.noResults":"plugins.marketplaces.noMarketplaces")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:t("plugins.marketplaces.addFirst")}),!h&&e.jsxs(v,{onClick:()=>g(!0),children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),t("plugins.marketplaces.addButton")]})]}):e.jsx("div",{className:"space-y-4",children:f.map(x=>e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6 hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 cursor-pointer",onClick:()=>y?.(x.id),children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white hover:text-blue-600 dark:hover:text-blue-400",children:x.displayName}),e.jsxs("span",{className:"px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300 flex items-center space-x-1",children:[x.type==="github"&&e.jsx(I,{className:"w-3 h-3"}),x.type==="git"&&e.jsx(K,{className:"w-3 h-3"}),x.type==="local"&&e.jsx(q,{className:"w-3 h-3"}),e.jsx("span",{children:t(`plugins.marketplaces.types.${x.type}`)})]})]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:x.source}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{children:[x.pluginCount," plugins"]}),x.lastSync&&e.jsxs("span",{children:["Last sync: ",new Date(x.lastSync).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2 ml-4",children:[e.jsx(v,{variant:"outline",size:"sm",onClick:()=>n(x.id),disabled:r,className:"border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",title:t("plugins.marketplaces.actions.sync"),children:e.jsx(oe,{className:`w-4 h-4 text-green-600 dark:text-green-400 ${r?"animate-spin":""}`})}),e.jsx(v,{variant:"outline",size:"sm",onClick:()=>b(x.id,x.displayName),disabled:m,className:"border-red-300 dark:border-red-700 hover:bg-red-50 dark:hover:bg-red-900/30",title:t("plugins.marketplaces.actions.delete"),children:e.jsx(_,{className:"w-4 h-4 text-red-600 dark:text-red-400"})})]})]})},x.id))}),e.jsx(Ee,{isOpen:j,onClose:()=>g(!1),onAdd:l,isAdding:i})]})},Me=({isOpen:s,onClose:a,marketplaceName:l,pluginName:i})=>{const{t:n}=F("pages"),{data:r,isLoading:p}=Ne(s?l:null,s?i:null),[m,y]=o.useState("overview");A.useEffect(()=>{r&&console.log("Plugin Detail Data:",r)},[r]);const[t,u]=o.useState(null),[h,S]=o.useState(null),{data:j}=Se(t?l:null,t?i:null,t),g=d=>{u(d.relativePath),y("file")},f=d=>{const c=d.relativePath.includes("/")?d.relativePath.substring(0,d.relativePath.lastIndexOf("/")):"";S(c),y("directory")},b=()=>{y("overview"),u(null),S(null)},x=d=>{switch(d){case"command":return e.jsx(ye,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"});case"agent":return e.jsx(he,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"});case"skill":return e.jsx(pe,{className:"w-4 h-4 text-green-600 dark:text-green-400"});case"hook":return e.jsx(ge,{className:"w-4 h-4 text-orange-600 dark:text-orange-400"});case"mcp":return e.jsx(xe,{className:"w-4 h-4 text-red-600 dark:text-red-400"});default:return e.jsx(me,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}},C=d=>{const c=`plugins.detail.componentTypes.${d}`;return n(c,{defaultValue:d})};if(!s)return null;const k=[];return r?.components&&(r.components.commands?.forEach(d=>k.push({...d,typeLabel:"command"})),r.components.agents?.forEach(d=>k.push({...d,typeLabel:"agent"})),r.components.skills?.forEach(d=>k.push({...d,typeLabel:"skill"})),r.components.hooks?.forEach(d=>k.push({...d,typeLabel:"hook"})),r.components.mcpServers?.forEach(d=>k.push({...d,typeLabel:"mcp"}))),e.jsx(re,{open:s,onOpenChange:a,children:e.jsxs(O,{className:"max-w-[1200px] w-full h-[90vh] overflow-hidden flex flex-col",children:[e.jsx(le,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(B,{children:[m==="overview"&&(r?.manifest?.name||i),m==="file"&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(v,{variant:"ghost",size:"sm",onClick:b,children:["← ",n("plugins.detail.back")]}),e.jsx("span",{className:"text-base",children:t})]}),m==="directory"&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(v,{variant:"ghost",size:"sm",onClick:b,children:["← ",n("plugins.detail.back")]}),e.jsx("span",{className:"text-base",children:h||n("plugins.detail.root")})]})]}),e.jsx(v,{variant:"ghost",size:"sm",onClick:a,children:e.jsx(ue,{className:"w-4 h-4"})})]})}),p?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})}):r?e.jsxs("div",{className:"flex-1 overflow-hidden min-h-0",children:[m==="overview"&&e.jsxs("div",{className:"h-full overflow-y-auto p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:r?.manifest?.name||i}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:r?.manifest?.description||r?.plugin?.manifest?.description||n("plugins.detail.noDescription")})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("plugins.detail.version")}),e.jsx("p",{className:"text-gray-900 dark:text-white",children:r?.manifest?.version||r?.plugin?.manifest?.version||"-"})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("plugins.detail.author")}),e.jsx("p",{className:"text-gray-900 dark:text-white",children:(()=>{const d=r?.manifest?.author||r?.plugin?.manifest?.author;return d?typeof d=="string"?d:d.name:"-"})()})]}),(r?.manifest?.license||r?.plugin?.manifest?.license)&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("plugins.detail.license")}),e.jsx("p",{className:"text-gray-900 dark:text-white",children:r?.manifest?.license||r?.plugin?.manifest?.license})]})]})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:[n("plugins.detail.components")," (",k.length,")"]}),k.length>0?e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("plugins.detail.type")}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("plugins.detail.name")}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("plugins.detail.description")}),e.jsx("th",{className:"px-4 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:n("plugins.detail.actions")})]})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700",children:k.map((d,c)=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800",children:[e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[x(d.type),e.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:C(d.type)})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"text-sm font-mono text-gray-900 dark:text-white",children:d.name})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:d.description||"-"})}),e.jsxs("td",{className:"px-4 py-3 text-right space-x-2",children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>g(d),title:n("plugins.detail.viewEntryFile"),className:"text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30",children:e.jsx(Y,{className:"w-4 h-4"})}),d.type==="skill"&&e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>f(d),title:n("plugins.detail.browseDirectory"),className:"text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/30",children:e.jsx(q,{className:"w-4 h-4"})})]})]},c))})]})}):e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:n("plugins.detail.noComponents")})]})]}),m==="file"&&e.jsx("div",{className:"h-full overflow-y-auto p-6",children:j?e.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100 p-4 rounded-lg font-mono",children:j.content}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})}),m==="directory"&&r?.plugin?.installPath&&e.jsx(ve,{projectPath:h?`${r.plugin.installPath}/${h}`:r.plugin.installPath,onFileSelect:d=>{console.log("Selected file:",d)},className:"h-full"})]}):e.jsx("div",{className:"text-center py-12 text-gray-500",children:n("plugins.detail.loadFailed")})]})})},Fe=({plugins:s,isLoading:a,marketplaces:l,onInstallPlugin:i,isInstalling:n,onUninstallPlugin:r,isUninstalling:p,selectedMarketplace:m,onMarketplaceChange:y})=>{const{t}=F("pages"),{isMobile:u}=z(),[h,S]=o.useState(""),[j,g]=o.useState(null),[f,b]=o.useState(!1),x=s.filter(c=>{const R=c.name.toLowerCase().includes(h.toLowerCase())||c.description.toLowerCase().includes(h.toLowerCase()),ie=!m||c.marketplaceId===m,ce=!f||c.installed;return R&&ie&&ce}),C=A.useMemo(()=>m?l.find(R=>R.id===m)?.displayName||m:t("plugins.browse.filters.allMarketplaces"),[m,l,t]),k=c=>{i({pluginName:c.name,marketplaceName:c.marketplaceName,marketplaceId:c.marketplaceId})},d=c=>{window.confirm(t("plugins.browse.confirmUninstall",{name:c.name}))&&r({marketplaceName:c.marketplaceName,pluginName:c.name})};return a?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:"Loading..."})]})}):l.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-6xl mb-4",children:"📦"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:t("plugins.browse.noMarketplaces")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:t("plugins.browse.goAddMarketplace")})]}):e.jsxs("div",{children:[e.jsxs("div",{className:`${u?"space-y-3":"flex items-center gap-4"} mb-6`,children:[e.jsxs("div",{className:`${u?"":"flex-1 max-w-md"} relative`,children:[e.jsx(X,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5"}),e.jsx(M,{type:"text",placeholder:t("plugins.browse.searchPlaceholder"),value:h,onChange:c=>S(c.target.value),className:"pl-10"})]}),e.jsx("div",{className:`${u?"":"w-64"}`,children:e.jsxs(G,{value:m??"all",onValueChange:c=>y(c==="all"?null:c),children:[e.jsx(U,{className:"text-gray-900 dark:text-gray-100",children:e.jsx(ne,{children:C})}),e.jsxs(W,{children:[e.jsx(L,{value:"all",children:t("plugins.browse.filters.allMarketplaces")}),l.map(c=>e.jsx(L,{value:c.id,children:c.displayName},c.id))]})]})}),e.jsxs("div",{className:" flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"showOnlyInstalled",checked:f,onChange:c=>b(c.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),e.jsx("label",{htmlFor:"showOnlyInstalled",className:"text-sm font-medium text-gray-900 dark:text-gray-300 cursor-pointer whitespace-nowrap",children:t("plugins.browse.filters.showOnlyInstalled")})]})]}),x.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-6xl mb-4",children:"🔍"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:t("plugins.browse.noResults")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:t("plugins.browse.adjustSearch")})]}):e.jsx("div",{className:"space-y-4",children:x.map(c=>e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx(be,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c.name}),c.installed&&e.jsxs("span",{className:"px-2 py-1 text-xs font-medium rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300 flex items-center space-x-1",children:[e.jsx(fe,{className:"w-3 h-3"}),e.jsx("span",{children:t("plugins.browse.card.installed")})]})]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:c.description}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{children:[t("plugins.browse.card.from")," ",c.marketplace]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:t("plugins.browse.card.version",{version:c.version})}),c.components.commands>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:t("plugins.browse.components.commands",{count:c.components.commands})})]}),c.components.skills>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:t("plugins.browse.components.skills",{count:c.components.skills})})]}),c.components.agents>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:t("plugins.browse.components.agents",{count:c.components.agents})})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2 ml-4",children:[e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>g({marketplace:c.marketplaceName,name:c.name}),className:"border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",children:[e.jsx(Y,{className:"w-4 h-4 mr-1 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:t("plugins.browse.actions.details")})]}),c.installed?e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>d(c),disabled:p,className:"border-red-300 dark:border-red-700 hover:bg-red-50 dark:hover:bg-red-900/30",children:[e.jsx(_,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"ml-1 text-red-600 dark:text-red-400",children:t("plugins.browse.actions.uninstall")})]}):e.jsxs(v,{variant:"outline",size:"sm",disabled:n,onClick:()=>k(c),className:"border-blue-300 dark:border-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/30",children:[e.jsx(je,{className:"w-4 h-4 mr-1 text-blue-600 dark:text-blue-400"}),e.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:t("plugins.browse.actions.install")})]})]})]})},`${c.name}@${c.marketplace}`))}),j&&e.jsx(Me,{isOpen:!!j,onClose:()=>g(null),marketplaceName:j.marketplace,pluginName:j.name})]})},Ve=()=>{const{t:s}=F("pages"),{isMobile:a}=z(),[l,i]=o.useState("marketplaces"),[n,r]=o.useState(null),p=c=>{r(c),i("browse")},{marketplaces:m,isLoading:y,addMarketplace:t,isAddingMarketplace:u,syncMarketplace:h,isSyncingMarketplace:S,removeMarketplace:j,isRemovingMarketplace:g}=ke(),{availablePlugins:f,isLoadingAvailable:b,installPlugin:x,isInstallingPlugin:C,uninstallPlugin:k,isUninstallingPlugin:d}=we();return e.jsxs("div",{className:`${a?"p-4":"p-8"}`,children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:`${a?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:s("plugins.title")}),e.jsx("p",{className:"mt-2 text-gray-600 dark:text-gray-400",children:s("plugins.subtitle")})]}),e.jsxs(ae,{value:l,onValueChange:i,className:"w-full",children:[e.jsxs(te,{className:`grid w-full ${a?"grid-cols-2":"grid-cols-2 max-w-xl"}`,children:[e.jsx(Q,{value:"marketplaces",children:s("plugins.tabs.marketplaces")}),e.jsx(Q,{value:"browse",children:s("plugins.tabs.browse")})]}),e.jsx(V,{value:"marketplaces",className:"mt-6",children:e.jsx(Pe,{marketplaces:m,isLoading:y,onAddMarketplace:t,isAdding:u,onSyncMarketplace:h,isSyncing:S,onRemoveMarketplace:j,isRemoving:g,onMarketplaceClick:p})}),e.jsx(V,{value:"browse",className:"mt-6",children:e.jsx(Fe,{plugins:f,isLoading:b,marketplaces:m,onInstallPlugin:x,isInstalling:C,onUninstallPlugin:k,isUninstalling:d,selectedMarketplace:n,onMarketplaceChange:r})})]})]})};export{Ve as PluginsPage,Ve as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as x}from"./monaco-editor-DHKm5-VF.js";import{b as X,a as D,A as F}from"./agents-C4aCwcCz.js";import{u as G,a as J,b as M}from"./useAgents-C9aEFOWD.js";import{F as v}from"./FileBrowser-Bnm7ZyGT.js";import{b as S}from"./index-ImPzdvfG.js";import{u as E}from"./tools-C7xmF_rB.js";import{X as I,H as A,g as V,I as Y}from"./ui-components-BNdpaz32.js";const ie=({agent:s,onProjectSelect:c,onClose:g})=>{const{t:r}=E("components"),[l,j]=x.useState(!1),[f,d]=x.useState(!1),[$,u]=x.useState(!1),[B,b]=x.useState(!1),[P,w]=x.useState(""),[q,N]=x.useState(!1),C=G(),z=J(),k=X(),{data:L,isLoading:Q}=M(s.id),p=L?.projects||[],R=async()=>{j(!0);try{const t=s.id.replace(/[-_]/g,"-"),a=new Date().toISOString().slice(0,16).replace(/[:T]/g,"-"),i=`${t}-project-${a}`,m=await C.mutateAsync({agentId:s.id,projectName:i});await k.invalidateQueries({queryKey:["agent-projects",s.id]}),c(m.project.path)}catch(t){console.error("Failed to create project:",t),S(r("projectSelector.createProjectFailed",{error:""}),t instanceof Error?t.message:r("projectSelector.unknownError"))}finally{j(!1)}},K=()=>{u(!0)},T=(t,a)=>{a&&(w(t),u(!1),N(!0))},U=async t=>{j(!0);try{const a=t,i=await C.mutateAsync({agentId:s.id,projectName:a,parentDirectory:P||void 0});await k.invalidateQueries({queryKey:["agent-projects",s.id]}),c(i.project.path)}catch(a){console.error("Failed to create project:",a),S(r("projectSelector.createProjectFailed",{error:""}),a instanceof Error?a.message:r("projectSelector.unknownError"))}finally{j(!1),N(!1),w("")}},W=()=>{d(!0)},_=async(t,a)=>{if(a){const i=t.replace(/\/$/,""),m=p.map(o=>o.path.replace(/\/$/,""));let n=m.includes(i);if(!n)try{const o=await D(`${F}/files/browse?path=${encodeURIComponent(t)}/.cc-sessions`);o.ok&&(await o.json()).items?.some(y=>y.isDirectory&&y.name===s.id)&&(n=!0)}catch{}if(console.log("Import path comparison:",{selectedPath:i,agentProjects:m,isExisting:n}),n)c(t),b(!1);else if(window.confirm(r("projectSelector.importConfirmation",{agentName:s.name,path:t})))try{await z.mutateAsync({agentId:s.id,projectPath:t}),await k.invalidateQueries({queryKey:["agent-projects",s.id]}),c(t),b(!1)}catch(h){console.error("Failed to import project:",h),S(r("projectSelector.importProjectFailed",{error:""}),h instanceof Error?h.message:r("projectSelector.unknownError"))}}},H=async(t,a)=>{if(a){const i=t.replace(/\/$/,""),m=p.map(o=>o.path.replace(/\/$/,""));let n=m.includes(i);if(!n)try{const o=await D(`${F}/files/browse?path=${encodeURIComponent(t)}/.cc-sessions`);o.ok&&(await o.json()).items?.some(y=>y.isDirectory&&y.name===s.id)&&(n=!0)}catch{}console.log("Path comparison:",{selectedPath:i,agentProjects:m,isExisting:n}),(n||window.confirm(r("projectSelector.importConfirmation",{agentName:s.name,path:t})))&&(c(t),d(!1))}};return e.jsxs("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-6xl mx-4 max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"text-2xl",children:s.ui.icon}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:s.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r("projectSelector.selectProjectDirectory")})]})]}),e.jsx("button",{onClick:g,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex-shrink-0",children:e.jsx(I,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col md:flex-row",children:[e.jsxs("div",{className:"w-full md:w-1/2 p-6 md:border-r border-gray-200 dark:border-gray-700",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mb-4",children:r("projectSelector.projectActions")}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{onClick:R,disabled:l,className:"w-full flex items-center space-x-4 p-4 border border-primary/40 dark:border-primary/60 rounded-lg hover:bg-primary/5 dark:hover:bg-primary/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(A,{className:`w-6 h-6 ${l?"text-gray-400 dark:text-gray-500":"text-primary"}`})}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r(l?"projectSelector.creatingProject":"projectSelector.quickCreateProject")}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("projectSelector.quickCreateDescription")})]})]}),e.jsxs("button",{onClick:K,disabled:l,className:"w-full flex items-center space-x-4 p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(A,{className:"w-6 h-6 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r("projectSelector.customLocationCreate")}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("projectSelector.customLocationDescription")})]})]}),e.jsxs("button",{onClick:W,className:"w-full flex items-center space-x-4 p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(V,{className:"w-6 h-6 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r("projectSelector.browseProject")}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("projectSelector.browseDescription")})]})]})]})]}),e.jsxs("div",{className:"w-full md:w-1/2 p-6 flex flex-col min-h-[300px] md:min-h-0",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mb-4",children:r("projectSelector.recentProjects")}),Q?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-blue-600 dark:border-t-blue-500 rounded-full mx-auto mb-3"}),e.jsx("p",{className:"text-sm",children:r("projectSelector.loadingProjects")})]})}):p.length>0?e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{className:"space-y-2 max-h-full overflow-y-auto",children:p.map((t,a)=>e.jsxs("button",{onClick:()=>c(t.path),className:"w-full flex items-center space-x-3 p-4 border border-gray-100 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors text-left",children:[e.jsx("div",{className:"w-5 h-5 flex-shrink-0 text-xl text-primary",children:t.defaultAgentIcon||"📁"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.name}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:t.path}),e.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:r("projectSelector.lastAccessed",{date:new Date(t.lastAccessed).toLocaleString()})})]})]},t.id||a))})}):e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx(Y,{className:"w-16 h-16 text-gray-300 dark:text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-base font-medium",children:r("projectSelector.noRecentProjects")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:r("projectSelector.createProjectToStart")})]})})]})]}),e.jsx("div",{className:"flex justify-end p-6 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsx("button",{onClick:g,className:"px-6 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:r("projectSelector.cancel")})})]}),f&&e.jsx(v,{title:r("projectSelector.selectProjectDirectory"),allowFiles:!1,allowDirectories:!0,onSelect:H,onClose:()=>d(!1)}),$&&e.jsx(v,{title:r("projectSelector.selectParentDirectory"),allowFiles:!1,allowDirectories:!0,allowNewDirectory:!0,onSelect:T,onClose:()=>u(!1)}),B&&e.jsx(v,{title:r("projectSelector.importProject"),allowFiles:!1,allowDirectories:!0,onSelect:_,onClose:()=>b(!1)}),q&&e.jsx(Z,{parentDirectory:P,onConfirm:U,onCancel:()=>{N(!1),w("")}})]})},Z=({parentDirectory:s,onConfirm:c,onCancel:g})=>{const{t:r}=E("components"),[l,j]=x.useState(""),f=d=>{d.preventDefault(),l.trim()&&c(l.trim())};return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[60]",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r("projectSelector.dialog.createNewProject")}),e.jsx("button",{onClick:g,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(I,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:r("projectSelector.dialog.projectWillBeCreatedAt")}),e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-700 rounded text-sm font-mono text-gray-800 dark:text-gray-200 break-all",children:s})]}),e.jsxs("form",{onSubmit:f,children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"projectName",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectSelector.dialog.projectName")}),e.jsx("input",{id:"projectName",type:"text",value:l,onChange:d=>j(d.target.value),placeholder:r("projectSelector.dialog.projectNamePlaceholder"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-transparent",autoFocus:!0,required:!0})]}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:r("projectSelector.dialog.cancel")}),e.jsx("button",{type:"submit",disabled:!l.trim(),className:"px-4 py-2 text-sm bg-blue-600 dark:bg-blue-500 text-white rounded-lg hover:bg-blue-700 dark:hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("projectSelector.dialog.createProject")})]})]})]})})};export{ie as P};
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as x}from"./monaco-editor-DHKm5-VF.js";import{u as X,a as D,A as F}from"./agents-ChrA1R0y.js";import{u as Y,a as G,b as H}from"./useAgents-BnDTkOG8.js";import{F as v}from"./FileBrowser-BYweUPH4.js";import{b as S}from"./index-Bn3v3S9-.js";import{u as E}from"./tools-IcPNZlPj.js";import{X as I,V as A,g as J,Y as M}from"./ui-components-D1St49qC.js";const ie=({agent:s,onProjectSelect:c,onClose:g})=>{const{t:r}=E("components"),[l,j]=x.useState(!1),[f,d]=x.useState(!1),[$,u]=x.useState(!1),[B,b]=x.useState(!1),[P,w]=x.useState(""),[q,N]=x.useState(!1),C=Y(),z=G(),k=X(),{data:L,isLoading:Q}=H(s.id),p=L?.projects||[],R=async()=>{j(!0);try{const t=s.id.replace(/[-_]/g,"-"),a=new Date().toISOString().slice(0,16).replace(/[:T]/g,"-"),i=`${t}-project-${a}`,m=await C.mutateAsync({agentId:s.id,projectName:i});await k.invalidateQueries({queryKey:["agent-projects",s.id]}),c(m.project.path)}catch(t){console.error("Failed to create project:",t),S(r("projectSelector.createProjectFailed",{error:""}),t instanceof Error?t.message:r("projectSelector.unknownError"))}finally{j(!1)}},K=()=>{u(!0)},T=(t,a)=>{a&&(w(t),u(!1),N(!0))},U=async t=>{j(!0);try{const a=t,i=await C.mutateAsync({agentId:s.id,projectName:a,parentDirectory:P||void 0});await k.invalidateQueries({queryKey:["agent-projects",s.id]}),c(i.project.path)}catch(a){console.error("Failed to create project:",a),S(r("projectSelector.createProjectFailed",{error:""}),a instanceof Error?a.message:r("projectSelector.unknownError"))}finally{j(!1),N(!1),w("")}},W=()=>{d(!0)},_=async(t,a)=>{if(a){const i=t.replace(/\/$/,""),m=p.map(o=>o.path.replace(/\/$/,""));let n=m.includes(i);if(!n)try{const o=await D(`${F}/files/browse?path=${encodeURIComponent(t)}/.cc-sessions`);o.ok&&(await o.json()).items?.some(y=>y.isDirectory&&y.name===s.id)&&(n=!0)}catch{}if(console.log("Import path comparison:",{selectedPath:i,agentProjects:m,isExisting:n}),n)c(t),b(!1);else if(window.confirm(r("projectSelector.importConfirmation",{agentName:s.name,path:t})))try{await z.mutateAsync({agentId:s.id,projectPath:t}),await k.invalidateQueries({queryKey:["agent-projects",s.id]}),c(t),b(!1)}catch(h){console.error("Failed to import project:",h),S(r("projectSelector.importProjectFailed",{error:""}),h instanceof Error?h.message:r("projectSelector.unknownError"))}}},O=async(t,a)=>{if(a){const i=t.replace(/\/$/,""),m=p.map(o=>o.path.replace(/\/$/,""));let n=m.includes(i);if(!n)try{const o=await D(`${F}/files/browse?path=${encodeURIComponent(t)}/.cc-sessions`);o.ok&&(await o.json()).items?.some(y=>y.isDirectory&&y.name===s.id)&&(n=!0)}catch{}console.log("Path comparison:",{selectedPath:i,agentProjects:m,isExisting:n}),(n||window.confirm(r("projectSelector.importConfirmation",{agentName:s.name,path:t})))&&(c(t),d(!1))}};return e.jsxs("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-6xl mx-4 max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"text-2xl",children:s.ui.icon}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:s.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r("projectSelector.selectProjectDirectory")})]})]}),e.jsx("button",{onClick:g,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex-shrink-0",children:e.jsx(I,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col md:flex-row",children:[e.jsxs("div",{className:"w-full md:w-1/2 p-6 md:border-r border-gray-200 dark:border-gray-700",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mb-4",children:r("projectSelector.projectActions")}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{onClick:R,disabled:l,className:"w-full flex items-center space-x-4 p-4 border border-primary/40 dark:border-primary/60 rounded-lg hover:bg-primary/5 dark:hover:bg-primary/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(A,{className:`w-6 h-6 ${l?"text-gray-400 dark:text-gray-500":"text-primary"}`})}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r(l?"projectSelector.creatingProject":"projectSelector.quickCreateProject")}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("projectSelector.quickCreateDescription")})]})]}),e.jsxs("button",{onClick:K,disabled:l,className:"w-full flex items-center space-x-4 p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(A,{className:"w-6 h-6 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r("projectSelector.customLocationCreate")}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("projectSelector.customLocationDescription")})]})]}),e.jsxs("button",{onClick:W,className:"w-full flex items-center space-x-4 p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(J,{className:"w-6 h-6 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r("projectSelector.browseProject")}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("projectSelector.browseDescription")})]})]})]})]}),e.jsxs("div",{className:"w-full md:w-1/2 p-6 flex flex-col min-h-[300px] md:min-h-0",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mb-4",children:r("projectSelector.recentProjects")}),Q?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-blue-600 dark:border-t-blue-500 rounded-full mx-auto mb-3"}),e.jsx("p",{className:"text-sm",children:r("projectSelector.loadingProjects")})]})}):p.length>0?e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{className:"space-y-2 max-h-full overflow-y-auto",children:p.map((t,a)=>e.jsxs("button",{onClick:()=>c(t.path),className:"w-full flex items-center space-x-3 p-4 border border-gray-100 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors text-left",children:[e.jsx("div",{className:"w-5 h-5 flex-shrink-0 text-xl text-primary",children:t.defaultAgentIcon||"📁"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.name}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:t.path}),e.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:r("projectSelector.lastAccessed",{date:new Date(t.lastAccessed).toLocaleString()})})]})]},t.id||a))})}):e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx(M,{className:"w-16 h-16 text-gray-300 dark:text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-base font-medium",children:r("projectSelector.noRecentProjects")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:r("projectSelector.createProjectToStart")})]})})]})]}),e.jsx("div",{className:"flex justify-end p-6 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsx("button",{onClick:g,className:"px-6 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:r("projectSelector.cancel")})})]}),f&&e.jsx(v,{title:r("projectSelector.selectProjectDirectory"),allowFiles:!1,allowDirectories:!0,onSelect:O,onClose:()=>d(!1)}),$&&e.jsx(v,{title:r("projectSelector.selectParentDirectory"),allowFiles:!1,allowDirectories:!0,allowNewDirectory:!0,onSelect:T,onClose:()=>u(!1)}),B&&e.jsx(v,{title:r("projectSelector.importProject"),allowFiles:!1,allowDirectories:!0,onSelect:_,onClose:()=>b(!1)}),q&&e.jsx(Z,{parentDirectory:P,onConfirm:U,onCancel:()=>{N(!1),w("")}})]})},Z=({parentDirectory:s,onConfirm:c,onCancel:g})=>{const{t:r}=E("components"),[l,j]=x.useState(""),f=d=>{d.preventDefault(),l.trim()&&c(l.trim())};return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[60]",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r("projectSelector.dialog.createNewProject")}),e.jsx("button",{onClick:g,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(I,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:r("projectSelector.dialog.projectWillBeCreatedAt")}),e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-700 rounded text-sm font-mono text-gray-800 dark:text-gray-200 break-all",children:s})]}),e.jsxs("form",{onSubmit:f,children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"projectName",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectSelector.dialog.projectName")}),e.jsx("input",{id:"projectName",type:"text",value:l,onChange:d=>j(d.target.value),placeholder:r("projectSelector.dialog.projectNamePlaceholder"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-transparent",autoFocus:!0,required:!0})]}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:r("projectSelector.dialog.cancel")}),e.jsx("button",{type:"submit",disabled:!l.trim(),className:"px-4 py-2 text-sm bg-blue-600 dark:bg-blue-500 text-white rounded-lg hover:bg-blue-700 dark:hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("projectSelector.dialog.createProject")})]})]})]})})};export{ie as P};
|