agentstudio 0.1.30 → 0.2.2

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.
Files changed (120) hide show
  1. package/index.d.ts.map +1 -1
  2. package/index.js +24 -4
  3. package/index.js.map +1 -1
  4. package/package.json +2 -1
  5. package/public/assets/{AgentsPage-VVVyzMq0.js → AgentsPage-DgoZNP6l.js} +2 -2
  6. package/public/assets/{Button-B9AQtJ7x.js → Button-BHiMThm4.js} +1 -1
  7. package/public/assets/{ChatPage-p1JCfA2A.js → ChatPage-LoTJrT43.js} +4 -4
  8. package/public/assets/{CommandForm-B_beYCv3.js → CommandForm-CZRscRtm.js} +2 -2
  9. package/public/assets/{CommandsPage-Blc1Kt4Z.js → CommandsPage-CwEoyASk.js} +1 -1
  10. package/public/assets/{DashboardPage-Dokn4y-N.js → DashboardPage-BSi_T1tY.js} +1 -1
  11. package/public/assets/{FileBrowser-Dg9PfXOo.js → FileBrowser-Df-zwNDa.js} +4 -4
  12. package/public/assets/FileExplorer-BB3suHzW.js +1 -0
  13. package/public/assets/GeneralSettingsPage-DcGmAzci.js +1 -0
  14. package/public/assets/LandingPage-DPKvTTja.js +1 -0
  15. package/public/assets/{LoginPage-D2Ykhr7D.js → LoginPage-BPJUgLru.js} +5 -5
  16. package/public/assets/McpAdminSettingsPage-CZZS-pa0.js +7 -0
  17. package/public/assets/{McpPage-DkD9BOrP.js → McpPage-CPF7txxc.js} +1 -1
  18. package/public/assets/MemorySettingsPage-YenW4l-g.js +1 -0
  19. package/public/assets/PluginsPage-zlAB63Im.js +1 -0
  20. package/public/assets/{ProjectSelector-B1_umywl.js → ProjectSelector-Bq0NQ_bV.js} +1 -1
  21. package/public/assets/{ProjectsPage-CQ8zwJ5D.js → ProjectsPage-BMBRp4RN.js} +5 -5
  22. package/public/assets/ScheduledTasksPage-B_hOD6AS.js +1 -0
  23. package/public/assets/{SettingsLayout-CccK5RVj.js → SettingsLayout-CY9Siffq.js} +1 -1
  24. package/public/assets/{SkillsPage-D_LECy2S.js → SkillsPage-X-LMnwZd.js} +1 -1
  25. package/public/assets/{SubagentForm-D9EFQxlZ.js → SubagentForm-Cq06CQqr.js} +3 -3
  26. package/public/assets/SubagentsPage-DIG_rKjQ.js +1 -0
  27. package/public/assets/SystemInfoPage-CWgKWnQg.js +1 -0
  28. package/public/assets/{TelemetrySettingsPage-DMngnKDW.js → TelemetrySettingsPage-BLnMagRZ.js} +1 -1
  29. package/public/assets/{ToastTestPage-CafmBcnU.js → ToastTestPage-CQ0nobQd.js} +1 -1
  30. package/public/assets/{ToolsList-CnepUgI-.js → ToolsList-C9LELdNX.js} +1 -1
  31. package/public/assets/UnifiedToolSelector-Bw-E7HW4.js +1 -0
  32. package/public/assets/{VersionSettingsPage-D9hYO4VL.js → VersionSettingsPage-BxjDPWm0.js} +2 -2
  33. package/public/assets/WebSocketTunnelPage-CQWcZK_H.js +1 -0
  34. package/public/assets/{_basePickBy-lvDxpUoY.js → _basePickBy-D_S4EWYL.js} +1 -1
  35. package/public/assets/{_baseUniq-DyqfOLmW.js → _baseUniq-BmQef9o6.js} +1 -1
  36. package/public/assets/{agents-DmLFhp96.js → agents-D9dWnZr0.js} +1 -1
  37. package/public/assets/{arc-DuR7lLva.js → arc-DzCTkvPU.js} +1 -1
  38. package/public/assets/{architectureDiagram-VXUJARFQ-CkKlTxxx.js → architectureDiagram-VXUJARFQ-8nWlVbiO.js} +1 -1
  39. package/public/assets/{blockDiagram-VD42YOAC-DdR02awp.js → blockDiagram-VD42YOAC-DbHo3vzo.js} +1 -1
  40. package/public/assets/{c4Diagram-YG6GDRKO-MlkMVL2r.js → c4Diagram-YG6GDRKO-DqFGiZ7Y.js} +1 -1
  41. package/public/assets/channel-DlGw39mX.js +1 -0
  42. package/public/assets/{chunk-4BX2VUAB-BI02zXQl.js → chunk-4BX2VUAB-KZtUHSw3.js} +1 -1
  43. package/public/assets/{chunk-55IACEB6-DtWZPbH-.js → chunk-55IACEB6-DTotxzVH.js} +1 -1
  44. package/public/assets/{chunk-B4BG7PRW-yLeRKRZl.js → chunk-B4BG7PRW-CkjDO6x_.js} +1 -1
  45. package/public/assets/{chunk-DI55MBZ5-DF-5ELa5.js → chunk-DI55MBZ5-ZN0hc9BQ.js} +1 -1
  46. package/public/assets/{chunk-FMBD7UC4-BjJNxbrL.js → chunk-FMBD7UC4--jXmtjeY.js} +1 -1
  47. package/public/assets/{chunk-QN33PNHL-rs7Z3IPT.js → chunk-QN33PNHL-D-FiWiLB.js} +1 -1
  48. package/public/assets/{chunk-QZHKN3VN-DoIXOkrg.js → chunk-QZHKN3VN-BRs4hln6.js} +1 -1
  49. package/public/assets/{chunk-TZMSLE5B-xkKgCGO2.js → chunk-TZMSLE5B-BUZTflc7.js} +1 -1
  50. package/public/assets/classDiagram-2ON5EDUG-7Lo3C-C9.js +1 -0
  51. package/public/assets/classDiagram-v2-WZHVMYZB-7Lo3C-C9.js +1 -0
  52. package/public/assets/clone-180En6VP.js +1 -0
  53. package/public/assets/{cose-bilkent-S5V4N54A-BIz6tY7t.js → cose-bilkent-S5V4N54A-s2WN1XmV.js} +1 -1
  54. package/public/assets/{dagre-6UL2VRFP-CponDeYZ.js → dagre-6UL2VRFP-CxaKwQyB.js} +1 -1
  55. package/public/assets/{diagram-PSM6KHXK-D31S6iiK.js → diagram-PSM6KHXK-SU1hlbjn.js} +1 -1
  56. package/public/assets/{diagram-QEK2KX5R-C6RWP-cs.js → diagram-QEK2KX5R-hcM85tep.js} +1 -1
  57. package/public/assets/{diagram-S2PKOQOG-BKs_7af1.js → diagram-S2PKOQOG-BOmtKWhQ.js} +1 -1
  58. package/public/assets/{erDiagram-Q2GNP2WA-Ro9hB6-s.js → erDiagram-Q2GNP2WA-CsTay3Qr.js} +1 -1
  59. package/public/assets/{flowDiagram-NV44I4VS-IKSFEVlB.js → flowDiagram-NV44I4VS-QLwVU4W3.js} +1 -1
  60. package/public/assets/{ganttDiagram-LVOFAZNH-CPDNSzAq.js → ganttDiagram-LVOFAZNH-CEJd76u6.js} +1 -1
  61. package/public/assets/{gitGraphDiagram-NY62KEGX-c_yb5ztL.js → gitGraphDiagram-NY62KEGX-Cr7KuVc8.js} +1 -1
  62. package/public/assets/{graph-BoMdSZEp.js → graph-B12xs1JB.js} +1 -1
  63. package/public/assets/{index-BUj-AMWq.js → index-BFYHztzB.js} +27 -27
  64. package/public/assets/index-isG0t1ZM.css +1 -0
  65. package/public/assets/infoDiagram-F6ZHWCRC-B6PyESp0.js +2 -0
  66. package/public/assets/{journeyDiagram-XKPGCS4Q-D4izttrO.js → journeyDiagram-XKPGCS4Q-DSlyGZSv.js} +1 -1
  67. package/public/assets/{kanban-definition-3W4ZIXB7-DE7WCrea.js → kanban-definition-3W4ZIXB7-DbDLw__g.js} +1 -1
  68. package/public/assets/{layout-BezNHWMi.js → layout-OtboCb25.js} +1 -1
  69. package/public/assets/{linear-KRX5ckNK.js → linear-Bg3HtxIB.js} +1 -1
  70. package/public/assets/{mindmap-definition-VGOIOE7T-Dlr09KqO.js → mindmap-definition-VGOIOE7T-DZ4bp0qm.js} +1 -1
  71. package/public/assets/{pieDiagram-ADFJNKIX-Bbzzfu-z.js → pieDiagram-ADFJNKIX-Am2n8jc0.js} +1 -1
  72. package/public/assets/{quadrantDiagram-AYHSOK5B-DubsKDPG.js → quadrantDiagram-AYHSOK5B-DPm8iQzH.js} +1 -1
  73. package/public/assets/{requirementDiagram-UZGBJVZJ-B-rG6Gty.js → requirementDiagram-UZGBJVZJ-hVW5YE3R.js} +1 -1
  74. package/public/assets/{sankeyDiagram-TZEHDZUN-DU7Rgr_5.js → sankeyDiagram-TZEHDZUN-DX8gGHoq.js} +1 -1
  75. package/public/assets/{sequenceDiagram-WL72ISMW-BRlH6dPX.js → sequenceDiagram-WL72ISMW-Brl8T0m9.js} +1 -1
  76. package/public/assets/{stateDiagram-FKZM4ZOC-BeAzs0_-.js → stateDiagram-FKZM4ZOC-CxrXSnfX.js} +1 -1
  77. package/public/assets/stateDiagram-v2-4FDKWEC3-BJfGHaLv.js +1 -0
  78. package/public/assets/{table-aqcpYX4Z.js → table-D-FJ6K6j.js} +1 -1
  79. package/public/assets/{timeline-definition-IT6M3QCI-BU_B1RmT.js → timeline-definition-IT6M3QCI-CO6fKxuR.js} +1 -1
  80. package/public/assets/{tools-XV29tg8x.js → tools-zTM46-tZ.js} +1 -1
  81. package/public/assets/{treemap-KMMF4GRG-CP2M7QfX.js → treemap-KMMF4GRG-BsoblFM5.js} +1 -1
  82. package/public/assets/{ui-components-ND8WdSiV.js → ui-components-BsYwJvCF.js} +138 -123
  83. package/public/assets/{useAgents-COcSvqDE.js → useAgents-BlQGwXjx.js} +1 -1
  84. package/public/assets/{useClaudeVersions-C8b4adpW.js → useClaudeVersions-DJ6VKG1y.js} +1 -1
  85. package/public/assets/{useCommands-D79pjz3C.js → useCommands-DOxDeFSx.js} +1 -1
  86. package/public/assets/{useProjects-CP0Q5-jg.js → useProjects-cgsJNlsy.js} +1 -1
  87. package/public/assets/{useSessions-C2gXprHI.js → useSessions-BAxZ6l2n.js} +1 -1
  88. package/public/assets/{xychartDiagram-PRI3JC2R-OdQKUqyr.js → xychartDiagram-PRI3JC2R-B6g-H_PO.js} +1 -1
  89. package/public/index.html +5 -5
  90. package/routes/projects.d.ts.map +1 -1
  91. package/routes/projects.js +80 -1
  92. package/routes/projects.js.map +1 -1
  93. package/routes/tunnel.d.ts +10 -0
  94. package/routes/tunnel.d.ts.map +1 -0
  95. package/routes/tunnel.js +296 -0
  96. package/routes/tunnel.js.map +1 -0
  97. package/services/a2a/a2aQueryService.d.ts.map +1 -1
  98. package/services/a2a/a2aQueryService.js +95 -52
  99. package/services/a2a/a2aQueryService.js.map +1 -1
  100. package/services/tunnelService.d.ts +148 -0
  101. package/services/tunnelService.d.ts.map +1 -0
  102. package/services/tunnelService.js +406 -0
  103. package/services/tunnelService.js.map +1 -0
  104. package/public/assets/FileExplorer-B7BFy0Tu.js +0 -1
  105. package/public/assets/GeneralSettingsPage-DLSSSadp.js +0 -1
  106. package/public/assets/LandingPage-Ck2WpTto.js +0 -1
  107. package/public/assets/McpAdminSettingsPage-BAKOckWx.js +0 -7
  108. package/public/assets/MemorySettingsPage-CiUs5u2g.js +0 -1
  109. package/public/assets/PluginsPage-CkXNjZMq.js +0 -1
  110. package/public/assets/ScheduledTasksPage-BjSzD4T2.js +0 -1
  111. package/public/assets/SubagentsPage-D_sdehiT.js +0 -1
  112. package/public/assets/SystemInfoPage-vz5Ey9DK.js +0 -1
  113. package/public/assets/UnifiedToolSelector-CnFTY88B.js +0 -1
  114. package/public/assets/channel-DHM1jRJ0.js +0 -1
  115. package/public/assets/classDiagram-2ON5EDUG-BJtIba9N.js +0 -1
  116. package/public/assets/classDiagram-v2-WZHVMYZB-BJtIba9N.js +0 -1
  117. package/public/assets/clone-Bbn_OKGL.js +0 -1
  118. package/public/assets/index-CEBbr0XW.css +0 -1
  119. package/public/assets/infoDiagram-F6ZHWCRC-904Ek2Zh.js +0 -2
  120. package/public/assets/stateDiagram-v2-4FDKWEC3-C0c8d9Xs.js +0 -1
@@ -1,7 +0,0 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{s as A,a as c}from"./index-BUj-AMWq.js";import{u as Ke,b as U,c as S,A as d}from"./agents-DmLFhp96.js";import{u as Te}from"./tools-XV29tg8x.js";import{U as $e,V as Ee,Y as Pe,C as Fe,j as ze,_ as Z,v as De,$ as qe,E as Le,I as _,a0 as Me,a1 as Ie,d as Re,y as Be,a2 as Oe,a3 as ee}from"./ui-components-ND8WdSiV.js";import"./syntax-highlighting-CnREyncB.js";async function Qe(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/status`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch status");return r.json()}async function Ue(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/keys`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch keys");return r.json()}async function _e(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/tools`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch tools");return r.json()}async function He(s){const r=localStorage.getItem("authToken"),l=await fetch(`${d}/mcp-admin-management/keys`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new Error("Failed to create key");return l.json()}async function Ve(s){const r=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}})).ok)throw new Error("Failed to revoke key")}async function Je(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}`,{method:"PUT",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(r)})).ok)throw new Error("Failed to update key")}async function Ge(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}/toggle`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:r})})).ok)throw new Error("Failed to toggle key")}async function te(s){const r=localStorage.getItem("authToken"),l=await fetch(`${d}/mcp-admin-management/config-snippet?apiKey=${encodeURIComponent(s)}`,{headers:{Authorization:`Bearer ${r}`}});if(!l.ok)throw new Error("Failed to fetch config");return l.json()}const at=()=>{const{t:s}=Te("pages"),r=Ke(),[l,u]=i.useState(!1),[se,C]=i.useState(!1),[K,T]=i.useState(""),[y,H]=i.useState(null),[o,$]=i.useState(null),[b,V]=i.useState("cursor"),[E,ae]=i.useState(new Set),[re,P]=i.useState(!1),[F,J]=i.useState(null),[m,j]=i.useState(new Set),[h,z]=i.useState(!1),[ne,D]=i.useState(!1),[q,L]=i.useState(null),[G,W]=i.useState(""),[x,f]=i.useState(new Set),[p,M]=i.useState(!1),[ie,Y]=i.useState(null),{data:N,isLoading:le,refetch:de}=U({queryKey:["mcpAdminStatus"],queryFn:Qe}),{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),C(!0)}catch{c(s("settings.mcpAdmin.errors.configFetch"))}},onError:t=>{c(s("settings.mcpAdmin.errors.createFailed"),t instanceof Error?t.message:void 0)}}),he=S({mutationFn:Ve,onSuccess:()=>{A(s("settings.mcpAdmin.success.keyRevoked")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{c(s("settings.mcpAdmin.errors.revokeFailed"),t instanceof Error?t.message:void 0)}}),R=S({mutationFn:({keyId:t,data:a})=>Je(t,a),onSuccess:()=>{A(s("settings.mcpAdmin.success.keyUpdated")),D(!1),L(null),r.invalidateQueries({queryKey:["mcpAdminKeys"]})},onError:t=>{c(s("settings.mcpAdmin.errors.updateFailed"),t instanceof Error?t.message:void 0)}}),pe=S({mutationFn:({keyId:t,enabled:a})=>Ge(t,a),onSuccess:(t,a)=>{A(a.enabled?s("settings.mcpAdmin.success.keyEnabled"):s("settings.mcpAdmin.success.keyDisabled")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{c(s("settings.mcpAdmin.errors.toggleFailed"),t instanceof Error?t.message:void 0)}}),ue=()=>{if(!K.trim()){c(s("settings.mcpAdmin.errors.descriptionRequired"));return}I.mutate({description:K.trim(),permissions:["admin:*"],allowedTools:h&&m.size>0?Array.from(m):void 0})},ye=t=>{j(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},be=()=>{j(new Set(k.map(t=>t.name)))},je=()=>{j(new Set)},fe=t=>{L(t),W(t.description),t.allowedTools&&t.allowedTools.length>0?(M(!0),f(new Set(t.allowedTools))):(M(!1),f(new Set)),D(!0)},ke=()=>{q&&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)},B=async t=>{try{await navigator.clipboard.writeText(t),A(s("settings.mcpAdmin.success.copied"))}catch{c(s("settings.mcpAdmin.errors.copyFailed"))}},Ae=t=>{ae(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},Se=async t=>{if(t.fullKey)try{const a=await te(t.fullKey);$(a),J(t.fullKey),C(!0)}catch{c(s("settings.mcpAdmin.errors.configFetch"))}},X=ce?.keys||[],k=xe?.tools||[],Ce=(t,a="right")=>{const n=t.inputSchema?.properties||{},v=t.inputSchema?.required||[],g=Object.entries(n),w=a==="right"?"left-full ml-2":"right-full mr-2";return e.jsxs("div",{className:`absolute z-50 ${w} top-0 w-72 bg-gray-900 text-white rounded-lg shadow-xl p-3 text-sm`,children:[e.jsx("div",{className:"font-medium text-blue-300 mb-1",children:t.name}),e.jsx("p",{className:"text-gray-300 text-xs mb-2",children:t.description}),g.length>0&&e.jsxs("div",{className:"border-t border-gray-700 pt-2",children:[e.jsxs("div",{className:"text-xs text-gray-400 mb-1",children:[s("settings.mcpAdmin.toolParams"),":"]}),e.jsx("div",{className:"space-y-1",children:g.map(([O,Q])=>e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-mono text-green-400",children:O}),v.includes(O)&&e.jsx("span",{className:"text-red-400 ml-1",children:"*"}),e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",Q.type,")"]}),Q.description&&e.jsx("p",{className:"text-gray-400 ml-2 mt-0.5",children:Q.description})]},O))})]}),g.length===0&&e.jsx("div",{className:"text-xs text-gray-500 italic",children:s("settings.mcpAdmin.noParams")})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:s("settings.mcpAdmin.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.mcpAdmin.subtitle")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("button",{onClick:()=>P(!0),className:"flex items-center space-x-2 px-3 py-2 text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:[e.jsx($e,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.help.button")})]}),e.jsxs("button",{onClick:()=>{de(),me()},className:"flex items-center space-x-2 px-3 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:[e.jsx(Ee,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.refresh")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(Pe,{className:"w-6 h-6 text-blue-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.serverStatus")})]}),le?e.jsxs("div",{className:"animate-pulse space-y-3",children:[e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/3"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/2"})]}):N?e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{className:"w-5 h-5 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.status")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.status.active")})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.version")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:N.version})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.tools")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:N.toolCount})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.activeKeys")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:N.activeKeyCount})]})]}):e.jsxs("div",{className:"flex items-center space-x-2 text-red-500",children:[e.jsx(ze,{className:"w-5 h-5"}),e.jsx("span",{children:s("settings.mcpAdmin.status.unavailable")})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("settings.mcpAdmin.endpoint"),": ",e.jsxs("code",{className:"bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded text-sm",children:[d,"/mcp-admin"]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(Z,{className:"w-6 h-6 text-yellow-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.apiKeys")})]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center space-x-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[e.jsx(De,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.createKey")})]})]}),oe?e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(t=>e.jsx("div",{className:"h-16 bg-gray-200 dark:bg-gray-700 rounded"},t))}):X.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Z,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.noKeys")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:s("settings.mcpAdmin.noKeysHint")})]}):e.jsx("div",{className:"space-y-3",children:X.map(t=>e.jsx("div",{className:`p-4 rounded-lg border ${t.isRevoked?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-60":t.enabled?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700":"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-70"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.description}),t.isRevoked&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300 rounded",children:s("settings.mcpAdmin.revoked")}),!t.isRevoked&&!t.enabled&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 rounded",children:s("settings.mcpAdmin.disabled")})]}),e.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[e.jsx("code",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:E.has(t.id)&&t.fullKey?t.fullKey:t.maskedKey}),!t.isRevoked&&t.fullKey&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Ae(t.id),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:E.has(t.id)?s("settings.mcpAdmin.hideKey"):s("settings.mcpAdmin.showKey"),children:E.has(t.id)?e.jsx(qe,{className:"w-4 h-4"}):e.jsx(Le,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>B(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(Be,{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(Oe,{className:"w-6 h-6 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.availableTools")})]}),ge?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4].map(t=>e.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded"},t))}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:k.map((t,a)=>{const n=a%2===1;return e.jsxs("div",{className:"relative flex items-start space-x-3 p-3 bg-gray-50 dark:bg-gray-900 rounded-lg cursor-help hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",onMouseEnter:()=>Y(t),onMouseLeave:()=>Y(null),children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-sm text-gray-900 dark:text-white",children:t.name}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t.description})]}),ie?.name===t.name&&Ce(t,n?"left":"right")]},t.name)})})]}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:s("settings.mcpAdmin.createKeyTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.keyDescription")}),e.jsx("input",{type:"text",value:K,onChange:t=>T(t.target.value),placeholder:s("settings.mcpAdmin.keyDescriptionPlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
2
- bg-white dark:bg-gray-700 text-gray-900 dark:text-white
3
- focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:t=>z(t.target.checked),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s("settings.mcpAdmin.limitTools")})]}),h&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("button",{onClick:be,className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.selectAll")}),e.jsx("span",{className:"text-gray-400",children:"|"}),e.jsx("button",{onClick:je,className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.deselectAll")})]})]}),h&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-3 max-h-64 overflow-y-auto",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(t=>{const a=Object.entries(t.inputSchema?.properties||{}),n=a.length>0?`
4
- ${s("settings.mcpAdmin.toolParams")}: ${a.map(([g,w])=>`${g}(${w.type})`).join(", ")}`:"",v=`${t.description}${n}`;return e.jsxs("label",{title:v,className:`flex items-center space-x-2 p-2 rounded-lg cursor-pointer transition-colors ${m.has(t.name)?"bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800":"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750"}`,children:[e.jsx("input",{type:"checkbox",checked:m.has(t.name),onChange:()=>ye(t.name),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"text-sm font-mono text-gray-900 dark:text-white truncate",children:t.name})})]},t.name)})}),m.size>0&&e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.selectedToolsCount",{count:m.size})})]}),!h&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(ee,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.fullPermissions")})]})]})]}),e.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[e.jsx("button",{onClick:()=>{u(!1),T(""),j(new Set),z(!1)},className:"px-4 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:s("settings.mcpAdmin.cancel")}),e.jsx("button",{onClick:ue,disabled: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:()=>B(y||F||""),className:"p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:e.jsx(_,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex space-x-2 mb-4",children:[e.jsx("button",{onClick:()=>V("cursor"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${b==="cursor"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:"Cursor"}),e.jsx("button",{onClick:()=>V("claude-desktop"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${b==="claude-desktop"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:"Claude Desktop"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[s("settings.mcpAdmin.configFile"),":",e.jsx("code",{className:"ml-2 text-xs text-gray-500",children:b==="cursor"?o.cursor.configPath:o.claudeDesktop.configPath})]}),e.jsxs("button",{onClick:()=>B(b==="cursor"?o.cursor.configString:o.claudeDesktop.configString),className:"flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700",children:[e.jsx(_,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.copyConfig")})]})]}),e.jsx("pre",{className:"p-4 bg-gray-900 text-gray-100 rounded-lg overflow-x-auto text-sm font-mono",children:b==="cursor"?o.cursor.configString:o.claudeDesktop.configString})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx("button",{onClick:()=>{C(!1),H(null),J(null),$(null)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg",children:s("settings.mcpAdmin.done")})})]})}),ne&&q&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:s("settings.mcpAdmin.editKeyTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.keyDescription")}),e.jsx("input",{type:"text",value:G,onChange:t=>W(t.target.value),placeholder:s("settings.mcpAdmin.keyDescriptionPlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
5
- bg-white dark:bg-gray-700 text-gray-900 dark:text-white
6
- focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:t=>M(t.target.checked),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s("settings.mcpAdmin.limitTools")})]}),p&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("button",{onClick:()=>f(new Set(k.map(t=>t.name))),className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.selectAll")}),e.jsx("span",{className:"text-gray-400",children:"|"}),e.jsx("button",{onClick:()=>f(new Set),className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.deselectAll")})]})]}),p&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-3 max-h-64 overflow-y-auto",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(t=>{const a=Object.entries(t.inputSchema?.properties||{}),n=a.length>0?`
7
- ${s("settings.mcpAdmin.toolParams")}: ${a.map(([g,w])=>`${g}(${w.type})`).join(", ")}`:"",v=`${t.description}${n}`;return e.jsxs("label",{title:v,className:`flex items-center space-x-2 p-2 rounded-lg cursor-pointer transition-colors ${x.has(t.name)?"bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800":"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750"}`,children:[e.jsx("input",{type:"checkbox",checked:x.has(t.name),onChange:()=>ve(t.name),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"text-sm font-mono text-gray-900 dark:text-white truncate",children:t.name})})]},t.name)})}),x.size>0&&e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.selectedToolsCount",{count:x.size})})]}),!p&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(ee,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.fullPermissions")})]})]})]}),e.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[e.jsx("button",{onClick:()=>{D(!1),L(null)},className:"px-4 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:s("settings.mcpAdmin.cancel")}),e.jsx("button",{onClick:ke,disabled: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 +0,0 @@
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-DmLFhp96.js";import{s as h,a as p}from"./index-BUj-AMWq.js";import{u as b}from"./tools-XV29tg8x.js";import{J as f,e as j,O as u,Q as k}from"./ui-components-ND8WdSiV.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};
@@ -1 +0,0 @@
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-DmLFhp96.js";import{a as P,s as T,c as H,b as z}from"./index-BUj-AMWq.js";import{u as F}from"./tools-XV29tg8x.js";import{c as de,B as v}from"./Button-B9AQtJ7x.js";import{ab as I,aM as K,f as q,g as X,v as J,V as oe,y as Y,X as ue,E as _,e as me,Y as xe,aN as ge,Z as pe,t as he,o as ye,a9 as be,C as fe,ao as je}from"./ui-components-ND8WdSiV.js";import{F as ve}from"./FileExplorer-B7BFy0Tu.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(Y,{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(_,{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(_,{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(Y,{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 +0,0 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i,W as ve}from"./monaco-editor-DHKm5-VF.js";import{T as ue,a as ge,b as Y,c as N,d as he,e as j}from"./table-aqcpYX4Z.js";import{b as B,u as $,c as P,a as k,A as w}from"./agents-DmLFhp96.js";import{u as Ne}from"./useAgents-COcSvqDE.js";import{u as Se}from"./useProjects-CP0Q5-jg.js";import{u as Ce}from"./useClaudeVersions-C8b4adpW.js";import{a as g,s as C}from"./index-BUj-AMWq.js";import{m as O,t as Te,f as Ee,au as ce,k as me,R as Ie,av as ye,ah as pe,O as $e,aw as Ae,L as ae,l as qe,e as oe,n as be,C as fe,A as Me,r as Fe,v as xe,ax as Pe,ay as Re,V as De,az as Ke,J as Oe,y as Qe,X as Le}from"./ui-components-ND8WdSiV.js";import"./syntax-highlighting-CnREyncB.js";import"./tools-XV29tg8x.js";const d={all:["scheduled-tasks"],lists:()=>[...d.all,"list"],list:()=>[...d.lists()],details:()=>[...d.all,"detail"],detail:t=>[...d.details(),t],history:t=>[...d.all,"history",t],status:()=>[...d.all,"status"]},Ve=()=>B({queryKey:d.list(),queryFn:async()=>{const t=await k(`${w}/scheduled-tasks`);if(!t.ok)throw new Error("Failed to fetch scheduled tasks");return t.json()},refetchInterval:t=>t.state.data?.some(c=>c.lastRunStatus==="running")?3e3:!1}),He=(t,n=50)=>B({queryKey:d.history(t),queryFn:async()=>{const l=await k(`${w}/scheduled-tasks/${t}/history?limit=${n}`);if(!l.ok)throw new Error("Failed to fetch task execution history");return l.json()},enabled:!!t,refetchInterval:l=>l.state.data?.some(A=>A.status==="running")?3e3:!1}),ze=()=>B({queryKey:d.status(),queryFn:async()=>{const t=await k(`${w}/scheduled-tasks/status`);if(!t.ok)throw new Error("Failed to fetch scheduler status");return t.json()},refetchInterval:3e4}),Be=()=>{const t=$();return P({mutationFn:async n=>{const l=await k(`${w}/scheduled-tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to create scheduled task")}return l.json()},onSuccess:()=>{t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.status()})}})},Ue=()=>{const t=$();return P({mutationFn:async({taskId:n,data:l})=>{const c=await k(`${w}/scheduled-tasks/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok){const p=await c.json().catch(()=>({}));throw new Error(p.error||"Failed to update scheduled task")}return c.json()},onSuccess:n=>{t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.detail(n.id)}),t.invalidateQueries({queryKey:d.status()})}})},_e=()=>{const t=$();return P({mutationFn:async n=>{const l=await k(`${w}/scheduled-tasks/${n}`,{method:"DELETE"});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to delete scheduled task")}},onSuccess:()=>{t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.status()})}})},Je=()=>{const t=$();return P({mutationFn:async n=>{const l=await k(`${w}/scheduled-tasks/${n}/toggle`,{method:"POST"});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to toggle scheduled task")}return l.json()},onSuccess:n=>{t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.detail(n.id)}),t.invalidateQueries({queryKey:d.status()})}})},je=()=>{const t=$();return P({mutationFn:async n=>{const l=await k(`${w}/scheduled-tasks/${n}/run`,{method:"POST"});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to run scheduled task")}return l.json()},onSuccess:(n,l)=>{t.invalidateQueries({queryKey:d.detail(l)}),t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.history(l)})}})},We=()=>{const t=$();return P({mutationFn:async n=>{const l=await k(`${w}/scheduled-tasks/executions/${n}/stop`,{method:"POST"});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to stop execution")}return l.json()},onSuccess:()=>{t.invalidateQueries({queryKey:d.all})}})},Xe=()=>B({queryKey:[...d.all,"running"],queryFn:async()=>{const t=await k(`${w}/scheduled-tasks/running`);if(!t.ok)throw new Error("Failed to fetch running executions");return t.json()},refetchInterval:3e3}),Ge=()=>{const t=$();return P({mutationFn:async()=>{const n=await k(`${w}/scheduled-tasks/scheduler/enable`,{method:"POST"});if(!n.ok){const l=await n.json().catch(()=>({}));throw new Error(l.error||"Failed to enable scheduler")}return n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:d.status()})}})},Ye=()=>{const t=$();return P({mutationFn:async()=>{const n=await k(`${w}/scheduled-tasks/scheduler/disable`,{method:"POST"});if(!n.ok){const l=await n.json().catch(()=>({}));throw new Error(l.error||"Failed to disable scheduler")}return n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:d.status()})}})},Z={all:["task-executor"],stats:()=>[...Z.all,"stats"],health:()=>[...Z.all,"health"]},Ze=()=>B({queryKey:Z.stats(),queryFn:async()=>{const t=await k(`${w}/task-executor/stats`);if(!t.ok)throw new Error("Failed to fetch task executor stats");return t.json()},refetchInterval:5e3}),et=()=>B({queryKey:[...Z.all,"config"],queryFn:async()=>{const t=await k(`${w}/task-executor/config`);if(!t.ok)throw new Error("Failed to fetch task executor config");return t.json()}}),tt=()=>{const t=$();return P({mutationFn:async n=>{const l=await k(`${w}/task-executor/config`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to update executor config")}return l.json()},onSuccess:()=>{t.invalidateQueries({queryKey:Z.all})}})},rt=[{label:"每 5 分钟",value:"*/5 * * * *"},{label:"每 15 分钟",value:"*/15 * * * *"},{label:"每 30 分钟",value:"*/30 * * * *"},{label:"每小时",value:"0 * * * *"},{label:"每天 9:00",value:"0 9 * * *"},{label:"每天 18:00",value:"0 18 * * *"},{label:"每周一 9:00",value:"0 9 * * 1"},{label:"每月 1 日 9:00",value:"0 9 1 * *"}],st=t=>{if(!t){const n=new Date;return n.setHours(n.getHours()+1),n.setMinutes(0),n.setSeconds(0),n.toISOString().slice(0,16)}return new Date(t).toISOString().slice(0,16)},at=t=>new Date(t).toISOString(),nt=({task:t,agents:n,onSave:l,onCancel:c})=>{const p=!!t,A=Be(),Q=Ue(),L=je(),{data:U}=Se(),R=U?.projects||[],{data:o}=Ce(),[v,_]=i.useState(t?.name||""),[S,J]=i.useState(t?.description||""),[b,q]=i.useState(t?.agentId||""),[f,V]=i.useState(t?.projectPath||""),[m,s]=i.useState(t?.schedule.type||"interval"),[x,u]=i.useState(t?.schedule.intervalMinutes||30),[h,H]=i.useState(t?.schedule.cronExpression||"*/30 * * * *"),[W,ee]=i.useState(st(t?.schedule.executeAt)),[M,ne]=i.useState(t?.triggerMessage||""),[E,le]=i.useState(t?.enabled??!0),[T,de]=i.useState(!!t?.modelOverride?.modelId),[I,te]=i.useState(t?.modelOverride?.versionId||""),[K,z]=i.useState(t?.modelOverride?.modelId||""),[X,re]=i.useState(!1),[G,r]=i.useState(!1),y=i.useMemo(()=>o?.versions?I?o.versions.find(ie=>ie.id===I)?.models||[]:(o.versions.find(D=>D.id===o.defaultVersionId)||o.versions[0])?.models||[]:[],[o,I]);i.useEffect(()=>{T&&o?.versions&&I&&(o.versions.some(D=>D.id===I)||(te(o.defaultVersionId||""),z("")))},[o,I,T]),i.useEffect(()=>{T&&y.length>0&&(y.some(D=>D.id===K)||z(y[0].id))},[y,K,T]),i.useEffect(()=>{!b&&n.length>0&&q(n[0].id)},[b,n]),i.useEffect(()=>{!f&&R.length>0&&V(R[0].path)},[f,R]);const F=()=>m==="interval"?{type:"interval",intervalMinutes:x}:m==="once"?{type:"once",executeAt:at(W)}:{type:"cron",cronExpression:h},se=()=>{if(!(!T||!K))return{versionId:I||void 0,modelId:K}},ke=async()=>{if(!v.trim()){g("请输入任务名称");return}if(!b){g("请选择 Agent");return}if(!f){g("请选择项目路径");return}if(!M.trim()){g("请输入触发消息");return}if(m==="interval"&&(!x||x<1)){g("间隔时间必须大于 0");return}if(m==="cron"&&!h.trim()){g("请输入 Cron 表达式");return}if(m==="once"){const a=new Date(W).getTime();if(isNaN(a)){g("请选择有效的执行时间");return}if(a<=Date.now()){g("执行时间必须在未来");return}}re(!0);try{if(p)await Q.mutateAsync({taskId:t.id,data:{name:v.trim(),description:S.trim()||void 0,agentId:b,projectPath:f,schedule:F(),triggerMessage:M.trim(),enabled:E,modelOverride:se()}}),C("任务已更新");else{const a={name:v.trim(),description:S.trim()||void 0,agentId:b,projectPath:f,schedule:F(),triggerMessage:M.trim(),enabled:E,modelOverride:se()};await A.mutateAsync(a),C("任务已创建")}l()}catch{g(p?"更新失败":"创建失败")}finally{re(!1)}},we=async()=>{if(!v.trim()){g("请输入任务名称");return}if(!b){g("请选择 Agent");return}if(!f){g("请选择项目路径");return}if(!M.trim()){g("请输入触发消息");return}r(!0);try{let a;if(p)await Q.mutateAsync({taskId:t.id,data:{name:v.trim(),description:S.trim()||void 0,agentId:b,projectPath:f,schedule:F(),triggerMessage:M.trim(),enabled:E,modelOverride:se()}}),a=t.id,C("任务已更新");else{const D={name:v.trim(),description:S.trim()||void 0,agentId:b,projectPath:f,schedule:F(),triggerMessage:M.trim(),enabled:E,modelOverride:se()};a=(await A.mutateAsync(D)).id,C("任务已创建")}await L.mutateAsync(a),C("任务已开始执行,请在执行历史中查看结果"),l()}catch{g("操作失败")}finally{r(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-5xl max-h-[90vh] overflow-hidden 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",{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:p?"编辑定时任务":"创建定时任务"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"配置 Agent 的自动执行计划"})]}),e.jsx("button",{onClick:c,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5"}),"基本信息"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"任务名称 *"}),e.jsx("input",{type:"text",value:v,onChange:a=>_(a.target.value),placeholder:"例如:每日代码检查",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"描述"}),e.jsx("input",{type:"text",value:S,onChange:a=>J(a.target.value),placeholder:"可选的任务描述",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(Te,{className:"w-5 h-5"}),"执行配置"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"执行 Agent *"}),e.jsx("select",{value:b,onChange:a=>q(a.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:n.map(a=>e.jsxs("option",{value:a.id,children:[a.ui?.icon||"🤖"," ",a.name]},a.id))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 flex items-center gap-2",children:[e.jsx(Ee,{className:"w-4 h-4"}),"项目路径 *"]}),e.jsx("select",{value:f,onChange:a=>V(a.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:R.map(a=>e.jsx("option",{value:a.path,children:a.name||a.path},a.path))}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Agent 将在此项目目录下执行"})]}),e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"覆盖模型配置"})]}),e.jsx("button",{type:"button",onClick:()=>de(!T),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${T?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${T?"translate-x-5":"translate-x-1"}`})})]}),T&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"可以为定时任务指定不同于 Agent 默认的模型"}),o?.versions&&o.versions.length>1&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:"供应商"}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:I,onChange:a=>te(a.target.value),className:"w-full appearance-none px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[e.jsx("option",{value:"",children:o.defaultVersionId?`默认 (${o.versions.find(a=>a.id===o.defaultVersionId)?.name})`:"默认"}),o.versions.filter(a=>a.id!==o.defaultVersionId).map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]}),e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none text-gray-500",children:e.jsx(me,{className:"w-4 h-4"})})]})]}),y.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:"模型"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:y.map(a=>e.jsxs("button",{type:"button",onClick:()=>z(a.id),className:`flex items-center justify-between px-3 py-2 text-sm rounded-lg border transition-all ${K===a.id?"border-purple-500 bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300 shadow-sm":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 text-gray-700 dark:text-gray-300"}`,children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ce,{className:"w-4 h-4 opacity-70"}),e.jsx("span",{className:"font-medium",children:a.name})]}),a.isVision&&e.jsx("span",{className:"text-xs bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded text-gray-500",children:"Vision"})]},a.id))})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5"}),"调度规则"]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"radio",name:"scheduleType",value:"interval",checked:m==="interval",onChange:()=>s("interval"),className:"mr-2"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:"间隔执行"})]}),e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"radio",name:"scheduleType",value:"cron",checked:m==="cron",onChange:()=>s("cron"),className:"mr-2"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:"Cron 表达式"})]}),e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"radio",name:"scheduleType",value:"once",checked:m==="once",onChange:()=>s("once"),className:"mr-2"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:"仅执行一次"})]})]}),m==="interval"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"间隔时间(分钟)"}),e.jsx("input",{type:"number",min:1,max:10080,value:x,onChange:a=>u(parseInt(a.target.value)||30),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsxs("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:["每隔 ",x," 分钟执行一次"]})]}),m==="cron"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Cron 表达式"}),e.jsx("input",{type:"text",value:h,onChange:a=>H(a.target.value),placeholder:"*/30 * * * *",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white font-mono focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:rt.map(a=>e.jsx("button",{type:"button",onClick:()=>H(a.value),className:`px-2 py-1 text-xs rounded-full border transition-colors ${h===a.value?"bg-blue-100 border-blue-300 text-blue-700 dark:bg-blue-900 dark:border-blue-700 dark:text-blue-300":"bg-gray-50 border-gray-200 text-gray-600 hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700"}`,children:a.label},a.value))})]}),m==="once"&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 flex items-center gap-2",children:[e.jsx(Ie,{className:"w-4 h-4"}),"执行时间"]}),e.jsx("input",{type:"datetime-local",value:W,onChange:a=>ee(a.target.value),min:new Date().toISOString().slice(0,16),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"任务将在指定时间执行一次后自动禁用"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(ye,{className:"w-5 h-5"}),"触发消息"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"发送给 Agent 的消息 *"}),e.jsx("textarea",{value:M,onChange:a=>ne(a.target.value),placeholder:"请检查代码质量并生成报告...",rows:5,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-y"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"定时触发时,这条消息会发送给选定的 Agent"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"启用任务"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"创建后立即开始调度"})]}),e.jsx("button",{type:"button",onClick:()=>le(!E),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${E?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${E?"translate-x-6":"translate-x-1"}`})})]}),e.jsxs("div",{className:"flex justify-between pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("button",{onClick:c,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",children:"取消"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:we,disabled:X||G,className:"inline-flex items-center px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors disabled:opacity-50",title:"保存任务并立即执行一次",children:[e.jsx(pe,{className:"w-4 h-4 mr-2"}),G?"执行中...":"保存并执行"]}),e.jsxs("button",{onClick:ke,disabled:X||G,className:"inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50",children:[e.jsx($e,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})]})})]})})},lt=({taskId:t,taskName:n,agentId:l,projectPath:c,onBack:p})=>{const{data:A=[],isLoading:Q}=He(t),[L,U]=i.useState(new Set),R=s=>{U(x=>{const u=new Set(x);return u.has(s)?u.delete(s):u.add(s),u})},o=s=>s?new Date(s).toLocaleString("zh-CN"):"-",v=s=>new Date(s).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),_=s=>{if(!s.completedAt)return"-";const x=new Date(s.startedAt).getTime(),h=new Date(s.completedAt).getTime()-x;return h<1e3?`${h}ms`:h<6e4?`${(h/1e3).toFixed(1)}s`:`${Math.floor(h/6e4)}m ${Math.floor(h%6e4/1e3)}s`},S=s=>{switch(s){case"running":return e.jsx(ae,{className:"w-5 h-5 text-blue-500 animate-spin"});case"success":return e.jsx(fe,{className:"w-5 h-5 text-green-500"});case"error":return e.jsx(be,{className:"w-5 h-5 text-red-500"});default:return e.jsx(O,{className:"w-5 h-5 text-gray-400"})}},J=s=>{switch(s){case"running":return e.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"运行中"});case"success":return e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"成功"});case"error":return e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"失败"});default:return e.jsx("span",{className:"text-gray-500",children:"未知"})}},b=s=>{switch(s){case"error":return"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20";case"warn":return"text-yellow-600 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-900/20";case"info":return"text-blue-600 dark:text-blue-400";case"debug":return"text-gray-500 dark:text-gray-400";default:return"text-gray-600 dark:text-gray-400"}},q=s=>{switch(s){case"system":return"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400";case"assistant":return"bg-blue-100 text-blue-600 dark:bg-blue-900 dark:text-blue-400";case"tool_use":return"bg-purple-100 text-purple-600 dark:bg-purple-900 dark:text-purple-400";case"result":return"bg-green-100 text-green-600 dark:bg-green-900 dark:text-green-400";case"error":return"bg-red-100 text-red-600 dark:bg-red-900 dark:text-red-400";default:return"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"}},f=s=>{const x=s.agentId||l,u=s.projectPath||c;if(!x||!s.sessionId)return null;let h=`/chat/${encodeURIComponent(x)}?session=${encodeURIComponent(s.sessionId)}`;return u&&(h+=`&project=${encodeURIComponent(u)}`),h},V=(s,x)=>{x.stopPropagation();const u=f(s);u&&window.open(u,"_blank")},m=s=>!s||s.length===0?e.jsx("div",{className:"text-center py-4 text-gray-500 dark:text-gray-400",children:"暂无执行日志"}):e.jsx("div",{className:"space-y-1 max-h-96 overflow-y-auto",children:s.map((x,u)=>e.jsxs("div",{className:`flex items-start gap-2 px-3 py-1.5 rounded text-sm font-mono ${b(x.level)}`,children:[e.jsx("span",{className:"text-gray-400 dark:text-gray-500 shrink-0 w-24",children:v(x.timestamp)}),e.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs shrink-0 ${q(x.type)}`,children:x.type}),e.jsx("span",{className:"flex-1 break-all whitespace-pre-wrap",children:x.message})]},u))});return e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("button",{onClick:p,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",children:e.jsx(Ae,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"执行历史"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:["任务:",n]})]})]}),Q?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(ae,{className:"w-8 h-8 animate-spin text-gray-400"})}):A.length===0?e.jsxs("div",{className:"text-center py-12 bg-gray-50 dark:bg-gray-800 rounded-lg",children:[e.jsx(O,{className:"w-12 h-12 mx-auto text-gray-400 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"暂无执行记录"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"任务尚未执行过"})]}):e.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(ue,{children:[e.jsx(ge,{children:e.jsxs(Y,{children:[e.jsx(N,{className:"w-[40px]"}),e.jsx(N,{className:"w-[80px]",children:"状态"}),e.jsx(N,{children:"开始时间"}),e.jsx(N,{children:"完成时间"}),e.jsx(N,{children:"耗时"}),e.jsx(N,{children:"结果摘要"}),e.jsx(N,{className:"w-[100px]",children:"操作"})]})}),e.jsx(he,{children:A.map(s=>e.jsxs(ve.Fragment,{children:[e.jsxs(Y,{className:"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800",onClick:()=>R(s.id),children:[e.jsx(j,{className:"p-2",children:e.jsx("button",{className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",children:L.has(s.id)?e.jsx(me,{className:"w-4 h-4 text-gray-500"}):e.jsx(qe,{className:"w-4 h-4 text-gray-500"})})}),e.jsx(j,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[S(s.status),J(s.status)]})}),e.jsx(j,{children:e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:o(s.startedAt)})}),e.jsx(j,{children:e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:o(s.completedAt)})}),e.jsx(j,{children:e.jsx("span",{className:"text-sm font-mono text-gray-600 dark:text-gray-400",children:_(s)})}),e.jsx(j,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.logs&&s.logs.length>0&&e.jsx("span",{title:"有详细日志",children:e.jsx(oe,{className:"w-4 h-4 text-gray-400 shrink-0"})}),s.error?e.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 max-w-md truncate",children:s.error}):s.responseSummary?e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400 max-w-md truncate",children:s.responseSummary}):e.jsx("span",{className:"text-sm text-gray-400",children:"-"})]})}),e.jsx(j,{children:s.sessionId&&f(s)&&e.jsx("button",{onClick:x=>V(s,x),className:"inline-flex items-center justify-center p-2 text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded transition-colors",title:"在新窗口继续会话",children:e.jsx(ye,{className:"w-4 h-4"})})})]}),L.has(s.id)&&e.jsx(Y,{children:e.jsx(j,{colSpan:7,className:"bg-gray-50 dark:bg-gray-800/50 p-4",children:e.jsxs("div",{className:"space-y-3",children:[s.errorStack&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("h4",{className:"text-sm font-medium text-red-700 dark:text-red-400 mb-2",children:"错误堆栈"}),e.jsx("pre",{className:"text-xs text-red-600 dark:text-red-400 whitespace-pre-wrap overflow-x-auto",children:s.errorStack})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[e.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[e.jsx(oe,{className:"w-4 h-4"}),"执行日志",s.logs&&e.jsxs("span",{className:"text-xs text-gray-400",children:["(",s.logs.length," 条)"]})]}),m(s.logs)]}),s.sessionId&&e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Session ID: ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded",children:s.sessionId})]})]})})})]},s.id))})]})})]})},bt=()=>{const t=$(),{data:n=[],isLoading:l}=Ve(),{data:c}=Ne(!0),{data:p}=ze(),A=_e(),Q=Je(),L=je(),U=We(),{data:R}=Xe(),o=Ge(),v=Ye(),[_,S]=i.useState(null),[J,b]=i.useState(!1),[q,f]=i.useState(null),[V,m]=i.useState(!1),[s,x]=i.useState(2),{data:u}=Ze(),{data:h}=et(),H=tt(),W=r=>R?.executions?.find(F=>F.taskId===r)?.executionId||null,ee=c?.agents||[],M=r=>ee.find(F=>F.id===r)?.name||r,ne=r=>{if(r.schedule.type==="interval"&&r.schedule.intervalMinutes){const y=r.schedule.intervalMinutes;return y<60?`每 ${y} 分钟`:`每 ${Math.floor(y/60)} 小时`}return r.schedule.type==="cron"&&r.schedule.cronExpression?r.schedule.cronExpression:r.schedule.type==="once"&&r.schedule.executeAt?`一次性 @ ${new Date(r.schedule.executeAt).toLocaleString("zh-CN")}`:"-"},E=r=>r?new Date(r).toLocaleString("zh-CN"):"-",le=async r=>{try{await Q.mutateAsync(r.id),C(r.enabled?"任务已暂停":"任务已启用")}catch{g("操作失败")}},T=async r=>{if(confirm(`确定要删除任务 "${r.name}" 吗?`))try{await A.mutateAsync(r.id),C("任务已删除")}catch{g("删除失败")}},de=async r=>{try{await L.mutateAsync(r.id),C("任务已开始执行"),t.invalidateQueries({queryKey:d.lists()})}catch{g("执行失败")}},I=async r=>{const y=W(r.id);if(!y){g("找不到正在运行的执行");return}try{await U.mutateAsync(y),C("任务已停止"),t.invalidateQueries({queryKey:d.lists()})}catch{g("停止失败")}},te=async()=>{if(p)try{p.enabled?(await v.mutateAsync(),C("调度器已禁用")):(await o.mutateAsync(),C("调度器已启用"))}catch{g("操作失败")}},K=r=>{S(r),b(!0)},z=()=>{S(null),b(!0)},X=()=>{S(null),b(!1),t.invalidateQueries({queryKey:d.lists()})},re=()=>{S(null),b(!1)},G=r=>r.lastRunStatus==="running"?e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:[e.jsx(ae,{className:"w-3 h-3 mr-1 animate-spin"}),"运行中"]}):r.lastRunStatus==="success"?e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:[e.jsx(fe,{className:"w-3 h-3 mr-1"}),"成功"]}):r.lastRunStatus==="error"?e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",children:[e.jsx(be,{className:"w-3 h-3 mr-1"}),"失败"]}):e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400",children:"未执行"});if(q){const r=n.find(y=>y.id===q);return e.jsx(lt,{taskId:q,taskName:r?.name||q,agentId:r?.agentId,projectPath:r?.projectPath,onBack:()=>f(null)})}return e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(O,{className:"w-8 h-8"}),"定时任务"]}),e.jsx("p",{className:"mt-2 text-gray-600 dark:text-gray-400",children:"配置 Agent 的自动执行计划"})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[p&&e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("button",{onClick:te,disabled:o.isPending||v.isPending,className:`flex items-center gap-2 px-3 py-1.5 rounded-lg transition-colors ${p.enabled?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 hover:bg-green-100 dark:hover:bg-green-900/30":"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 hover:bg-orange-100 dark:hover:bg-orange-900/30"} ${o.isPending||v.isPending?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,title:p.enabled?"点击禁用调度器":"点击启用调度器",children:[e.jsx(O,{className:`w-4 h-4 ${o.isPending||v.isPending?"animate-pulse":""}`}),e.jsx("span",{className:"font-medium",children:p.enabled?"调度器已启用":"调度器已禁用"})]}),u&&e.jsxs("div",{className:"flex items-center gap-3 text-gray-500 dark:text-gray-400",children:[e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),e.jsxs("span",{className:`flex items-center gap-1 ${u.runningTasks>0?"text-blue-600 dark:text-blue-400":""}`,children:[e.jsx(Me,{className:`w-4 h-4 ${u.runningTasks>0?"animate-pulse":""}`}),"运行: ",u.runningTasks]}),e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:["队列: ",u.queuedTasks]}),e.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["完成: ",u.completedTasks]}),e.jsxs("span",{className:"text-red-600 dark:text-red-400",children:["失败: ",u.failedTasks]}),e.jsx("button",{onClick:()=>{h&&x(h.maxConcurrent),m(!0)},className:"ml-2 p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:"执行器设置",children:e.jsx(Fe,{className:"w-4 h-4"})})]})]}),e.jsxs("button",{onClick:z,className:"inline-flex items-center px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(xe,{className:"w-5 h-5 mr-2"}),"新建任务"]})]})]}),l?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(ae,{className:"w-8 h-8 animate-spin text-gray-400"})}):n.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(O,{className:"w-16 h-16 mx-auto text-gray-400 mb-4"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:"暂无定时任务"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"创建定时任务来让 Agent 自动执行工作"}),e.jsxs("button",{onClick:z,className:"inline-flex items-center px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(xe,{className:"w-5 h-5 mr-2"}),"创建第一个任务"]})]}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(ue,{children:[e.jsx(ge,{children:e.jsxs(Y,{children:[e.jsx(N,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"状态"}),e.jsx(N,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"任务名称"}),e.jsx(N,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Agent"}),e.jsx(N,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"调度规则"}),e.jsx(N,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"上次执行"}),e.jsx(N,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"下次执行"}),e.jsx(N,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:"操作"})]})}),e.jsx(he,{children:n.map(r=>e.jsxs(Y,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(j,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("button",{onClick:()=>le(r),className:`p-1 rounded-full transition-colors ${r.enabled?"text-green-600 hover:bg-green-100 dark:hover:bg-green-900":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:r.enabled?"点击暂停":"点击启用",children:r.enabled?e.jsx(pe,{className:"w-5 h-5 fill-current"}):e.jsx(Pe,{className:"w-5 h-5"})})}),e.jsx(j,{className:"px-6 py-4",children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r.name}),r.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-[200px]",children:r.description})]})}),e.jsx(j,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:M(r.agentId)})}),e.jsx(j,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"text-sm font-mono text-gray-600 dark:text-gray-400",children:ne(r)})}),e.jsx(j,{className:"px-6 py-4",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[G(r),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:E(r.lastRunAt)})]})}),e.jsx(j,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:r.enabled?E(r.nextRunAt):"-"})}),e.jsx(j,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.lastRunStatus==="running"?e.jsx("button",{onClick:()=>I(r),className:"p-2 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900 rounded-lg transition-colors",title:"停止执行",children:e.jsx(Re,{className:"w-4 h-4"})}):e.jsx("button",{onClick:()=>de(r),className:"p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900 rounded-lg transition-colors",title:"立即执行",children:e.jsx(De,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>f(r.id),className:"p-2 text-gray-500 hover:text-purple-600 hover:bg-purple-50 dark:hover:bg-purple-900 rounded-lg transition-colors",title:"执行历史",children:e.jsx(Ke,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>K(r),className:"p-2 text-gray-500 hover:text-green-600 hover:bg-green-50 dark:hover:bg-green-900 rounded-lg transition-colors",title:"编辑",children:e.jsx(Oe,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>T(r),className:"p-2 text-gray-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900 rounded-lg transition-colors",title:"删除",children:e.jsx(Qe,{className:"w-4 h-4"})})]})})]},r.id))})]})}),J&&e.jsx(nt,{task:_,agents:ee,onSave:X,onCancel:re}),V&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"执行器设置"}),e.jsx("button",{onClick:()=>m(!1),className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx(Le,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("div",{className:"px-6 py-4 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-2",children:"最大并发数 (1-10)"}),e.jsx("input",{type:"number",min:1,max:10,value:s,onChange:r=>x(Math.min(10,Math.max(1,parseInt(r.target.value)||1))),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-white focus:ring-2 focus:ring-blue-500"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"允许同时执行的最大任务数量"})]}),h&&e.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["当前配置: 并发 ",h.maxConcurrent]})]}),e.jsxs("div",{className:"flex justify-end gap-3 px-6 py-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("button",{onClick:()=>m(!1),className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:"取消"}),e.jsx("button",{onClick:async()=>{try{await H.mutateAsync({maxConcurrent:s}),C(`并发数已更新为 ${s}`),m(!1)}catch(r){g(r instanceof Error?r.message:"更新失败")}},disabled:H.isPending,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",children:H.isPending?"保存中...":"保存"})]})]})})]})};export{bt as ScheduledTasksPage,bt as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{T as D,a as R,b as f,c as o,d as B,e as m}from"./table-aqcpYX4Z.js";import{u as H,a as L,S as q}from"./SubagentForm-D9EFQxlZ.js";import{f as N}from"./dateFormat-CXa8VnEC.js";import{b as z}from"./index-BUj-AMWq.js";import{T as k}from"./ToolsList-CnepUgI-.js";import{u as J}from"./tools-XV29tg8x.js";import{j as G,g as I,v as K,R as v,E as w,J as $,y as h}from"./ui-components-ND8WdSiV.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DmLFhp96.js";import"./UnifiedToolSelector-CnFTY88B.js";const re=()=>{const{t:s}=J("pages"),{isMobile:t}=z(),[a,S]=i.useState(""),[C,n]=i.useState(!1),[T,d]=i.useState(null),[g,c]=i.useState(null),[p,y]=i.useState({}),{data:b=[],isLoading:F,error:E,refetch:j}=H({search:a.trim()||void 0}),u=L(),M=async r=>{try{await u.mutateAsync(r.id),c(null)}catch(l){console.error("Failed to delete subagent:",l)}},x=r=>{d(r),n(!0)},A=()=>{n(!1),d(null)},P=()=>{j()};return F?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:`animate-spin rounded-full ${t?"h-8 w-8":"h-12 w-12"} border-b-2 border-blue-600 mx-auto ${t?"mb-3":"mb-4"}`}),e.jsx("div",{className:`text-gray-600 dark:text-gray-400 ${t?"text-sm":""}`,children:s("settings.subagents.loading")})]})}):E?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(G,{className:`${t?"h-8 w-8":"h-12 w-12"} text-red-500 mx-auto ${t?"mb-3":"mb-4"}`}),e.jsx("h3",{className:`${t?"text-base":"text-lg"} font-medium text-gray-900 dark:text-white mb-2`,children:s("settings.subagents.loadFailed")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${t?"mb-4 text-sm":"mb-4"}`,children:s("settings.subagents.loadFailedMessage")}),e.jsx("button",{onClick:()=>j(),className:`${t?"px-4 py-2.5 text-sm":"px-4 py-2"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:s("settings.subagents.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:t?"mb-4":"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsx("h1",{className:`${t?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:s("settings.subagents.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${t?"mt-1":"mt-2"}`,children:s("settings.subagents.subtitle")})]})}),e.jsxs("div",{className:t?"space-y-3":"flex items-center space-x-4",children:[e.jsxs("div",{className:`${t?"":"flex-1"} relative`,children:[e.jsx(I,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${t?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:s("settings.subagents.searchPlaceholder"),value:a,onChange:r=>S(r.target.value),className:`pl-10 pr-4 ${t?"py-2":"py-3"} w-full 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 ${t?"text-sm":""}`})]}),e.jsxs("button",{onClick:()=>{d(null),n(!0)},className:`${t?"w-full py-2.5 px-4 flex items-center justify-center space-x-2":"flex items-center space-x-2 px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors ${t?"text-sm":"whitespace-nowrap"}`,children:[e.jsx(K,{className:t?"w-4 h-4":"w-5 h-5"}),e.jsx("span",{children:s("settings.subagents.createButton")})]})]})]}),b.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:`${t?"text-4xl":"text-6xl"} mb-4`,children:"🤖"}),e.jsx("h3",{className:`${t?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:s(a?"settings.subagents.noSubagentsSearch":"settings.subagents.noSubagents")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:s(a?"settings.subagents.adjustSearch":"settings.subagents.createFirst")}),!a&&e.jsx("button",{onClick:()=>{d(null),n(!0)},className:`${t?"w-full py-3 px-4":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:s("settings.subagents.createButton")})]}):e.jsx(e.Fragment,{children:t?e.jsx("div",{className:"space-y-4",children:b.map((r,l)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`${t?"text-lg":"text-xl"} mr-3`,children:"🤖"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:`${t?"text-sm":"text-base"} font-medium text-gray-900 dark:text-white`,children:r.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${r.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:r.source==="plugin"?s("settings.subagents.source.plugin"):s("settings.subagents.source.local")})]}),r.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r.description})]})]})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-start text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2 mt-1",children:[s("settings.subagents.table.tools"),":"]}),e.jsx("div",{className:"flex-1",children:e.jsx(k,{tools:r.tools||[],id:r.id,expandedTools:p,setExpandedTools:y,isMobile:!0,emptyMessage:s("settings.subagents.table.inheritSettings")})})]})}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[s("settings.subagents.table.createdAt"),":"]}),e.jsxs("div",{className:"flex items-center text-gray-500 dark:text-gray-400",children:[e.jsx(v,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:N(r.createdAt)})]})]})]}),e.jsx("div",{className:"flex items-center justify-end space-x-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:r.source==="plugin"?e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx(w,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>x(r),className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx($,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.edit")]}),e.jsx("button",{onClick:()=>c(r),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:s("settings.subagents.actions.deleteTitle"),children:e.jsx(h,{className:"w-4 h-4"})})]})})]},r.id+"-"+l))}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(D,{children:[e.jsx(R,{children:e.jsxs(f,{children:[e.jsx(o,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.subagent")}),e.jsx(o,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.tools")}),e.jsx(o,{className:"px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.createdAt")}),e.jsx(o,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:s("settings.subagents.table.actions")})]})}),e.jsx(B,{children:b.map((r,l)=>e.jsxs(f,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(m,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:"🤖"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${r.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:r.source==="plugin"?s("settings.subagents.source.plugin"):s("settings.subagents.source.local")})]}),r.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-xs",children:r.description})]})]})}),e.jsx(m,{className:"px-6 py-4",children:e.jsx(k,{tools:r.tools||[],id:r.id,expandedTools:p,setExpandedTools:y,isMobile:!1,emptyMessage:s("settings.subagents.table.inheritSettings")})}),e.jsx(m,{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(v,{className:"w-4 h-4"}),e.jsx("span",{children:N(r.createdAt)})]})}),e.jsx(m,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:r.source==="plugin"?e.jsxs("button",{onClick:()=>x(r),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("settings.subagents.actions.viewTitle"),children:[e.jsx(w,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>x(r),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("settings.subagents.actions.editTitle"),children:[e.jsx($,{className:"w-3 h-3 mr-1"}),s("settings.subagents.actions.edit")]}),e.jsx("button",{onClick:()=>c(r),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:s("settings.subagents.actions.deleteTitle"),children:e.jsx(h,{className:"w-4 h-4"})})]})})})]},r.id+"-"+l))})]})})}),C&&e.jsx(q,{subagent:T,onClose:A,onSuccess:P}),g&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl ${t?"w-full max-w-sm":"max-w-md w-full"}`,children:[e.jsx("div",{className:`${t?"px-4 py-3":"px-6 py-4"} border-b border-gray-200 dark:border-gray-700`,children:e.jsx("h3",{className:`${t?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white`,children:s("settings.subagents.deleteConfirm.title")})}),e.jsxs("div",{className:`${t?"px-4 py-3":"px-6 py-4"}`,children:[e.jsx("p",{className:`${t?"text-sm":""} text-gray-600 dark:text-gray-400`,children:s("settings.subagents.deleteConfirm.message",{name:g.name})}),e.jsx("p",{className:`text-gray-500 dark:text-gray-400 ${t?"mt-1 text-xs":"mt-2"}`,children:s("settings.subagents.deleteConfirm.warning")})]}),e.jsxs("div",{className:`${t?"grid grid-cols-2 gap-2 px-4 py-3":"flex items-center justify-end space-x-3 px-6 py-4"} border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700/50`,children:[e.jsx("button",{onClick:()=>c(null),className:`${t?"px-3 py-2.5 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/50 transition-colors`,children:s("settings.subagents.deleteConfirm.cancel")}),e.jsxs("button",{onClick:()=>M(g),disabled:u.isPending,className:`${t?"flex items-center justify-center space-x-1 px-3 py-2.5 text-sm":"flex items-center space-x-2 px-4 py-2"} bg-red-600 hover:bg-red-700 disabled:bg-red-400 text-white rounded-lg transition-colors`,children:[u.isPending?e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-white border-t-transparent"}):e.jsx(h,{className:`${t?"h-3 w-3":"h-4 w-4"}`}),e.jsx("span",{children:s("settings.subagents.deleteConfirm.delete")})]})]})]})})]})};export{re as SubagentsPage};
@@ -1 +0,0 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{e as h,f as y}from"./index-BUj-AMWq.js";import{u as b}from"./tools-XV29tg8x.js";import{a6 as p,V as j,a7 as u,a8 as r,a9 as l,aa as f,Y as k,ab as N,e as v}from"./ui-components-ND8WdSiV.js";import"./monaco-editor-DHKm5-VF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DmLFhp96.js";const S=()=>{const{t:s}=b("pages"),{currentVersion:d,latestVersion:a,hasUpdate:n,forceCheck:o,isChecking:i,dismissUpdate:m,showUpdateNotification:x}=h(),{systemInfo:t,refetch:c}=y(),g=()=>{o(),c()};return e.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white flex items-center",children:[e.jsx(p,{className:"w-6 h-6 mr-2"}),s("settings.systemInfo.title")]}),e.jsx("p",{className:"mt-1 text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.subtitle")})]}),e.jsxs("button",{onClick:g,disabled:i,className:"inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(j,{className:`w-4 h-4 mr-2 ${i?"animate-spin":""}`}),s("settings.systemInfo.checkUpdate")]})]}),x&&a&&e.jsx("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/30 dark:to-indigo-900/30 border border-blue-200 dark:border-blue-800 rounded-xl p-6",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-start space-x-4",children:[e.jsx("div",{className:"p-3 bg-blue-100 dark:bg-blue-800 rounded-full",children:e.jsx(u,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-blue-900 dark:text-blue-100",children:s("settings.systemInfo.updateAvailable")}),e.jsx("p",{className:"mt-1 text-blue-700 dark:text-blue-300",children:s("version.newVersionAvailable",{version:a})}),e.jsxs("div",{className:"mt-4 flex space-x-3",children:[e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(r,{className:"w-4 h-4 mr-2"}),s("settings.systemInfo.viewReleases")]}),e.jsx("button",{onClick:m,className:"inline-flex items-center px-4 py-2 text-blue-700 dark:text-blue-300 bg-blue-100 dark:bg-blue-800 hover:bg-blue-200 dark:hover:bg-blue-700 rounded-lg transition-colors",children:s("version.dismiss")})]})]})]})})}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[e.jsx(l,{className:"w-5 h-5 mr-2"}),s("settings.systemInfo.versionInfo")]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.appName")}),e.jsx("p",{className:"mt-1 text-lg font-semibold text-gray-900 dark:text-white",children:t?.app.name||"AgentStudio"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.currentVersion")}),e.jsxs("div",{className:"mt-1 flex items-center",children:[e.jsxs("span",{className:"text-lg font-mono text-gray-900 dark:text-white",children:["v",d||t?.app.version||"-"]}),!n&&e.jsxs("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:[e.jsx(f,{className:"w-3 h-3 mr-1"}),s("settings.systemInfo.upToDate")]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.latestVersion")}),e.jsx("p",{className:"mt-1 text-lg font-mono text-gray-900 dark:text-white",children:a?`v${a}`:"-"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:["Node.js ",s("settings.systemInfo.version")]}),e.jsx("p",{className:"mt-1 font-mono text-gray-900 dark:text-white",children:t?.runtime.nodeVersion||"-"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.platform")}),e.jsxs("p",{className:"mt-1 text-gray-900 dark:text-white capitalize",children:[t?.runtime.platform||"-"," (",t?.runtime.arch||"-",")"]})]})]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[e.jsx(k,{className:"w-5 h-5 mr-2"}),s("settings.systemInfo.runtimeInfo")]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Node.js"}),e.jsx("p",{className:"mt-1 font-mono text-gray-900 dark:text-white",children:t?.runtime.nodeVersion||"-"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.platform")}),e.jsx("p",{className:"mt-1 text-gray-900 dark:text-white capitalize",children:t?.runtime.platform||"-"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.architecture")}),e.jsx("p",{className:"mt-1 text-gray-900 dark:text-white",children:t?.runtime.arch||"-"})]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[e.jsx(r,{className:"w-5 h-5 mr-2"}),s("settings.systemInfo.links")]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("a",{href:t?.links.github||"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(N,{className:"w-6 h-6 text-gray-700 dark:text-gray-300 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"GitHub"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewSource")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]}),e.jsxs("a",{href:t?.links.releases||"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(l,{className:"w-6 h-6 text-gray-700 dark:text-gray-300 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"Releases"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewReleases")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]}),e.jsxs("a",{href:t?.links.changelog||"https://github.com/okguitar/agentstudio/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(v,{className:"w-6 h-6 text-gray-700 dark:text-gray-300 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"Changelog"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewChangelog")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]}),e.jsxs("a",{href:t?.links.npm||"https://www.npmjs.com/package/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:[e.jsx(l,{className:"w-6 h-6 text-red-600 dark:text-red-400 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"npm"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.systemInfo.viewNpm")})]}),e.jsx(r,{className:"w-4 h-4 text-gray-400 ml-auto"})]})]})})]})]})};export{S as SystemInfoPage};
@@ -1 +0,0 @@
1
- import{j as t}from"./data-structures-C0h9Oap1.js";import{r as g}from"./monaco-editor-DHKm5-VF.js";import{a as Q,A as Z}from"./agents-DmLFhp96.js";import{u as M}from"./tools-XV29tg8x.js";import{X as R,a2 as ee,ai as te,aa as N,aj as O,ak as E,V as re,j as D,k as se,l as ae}from"./ui-components-ND8WdSiV.js";const I={Bash:"终端命令",BashOutput:"终端命令输出",KillBash:"杀死终端命令",Edit:"文件编辑",Read:"读取文件",Write:"写入文件",Glob:"文件搜索",Grep:"文本搜索",NotebookEdit:"笔记本编辑",WebFetch:"网页获取",WebSearch:"网络搜索",TodoWrite:"任务管理",Task:"任务执行",ExitPlanMode:"退出计划模式",Skill:"技能调用"},ne={Bash:"执行命令行操作",BashOutput:"获取终端命令输出",KillBash:"杀死终端命令",Edit:"编辑文件内容",Read:"读取文件内容",Write:"创建或覆盖文件",Glob:"使用通配符搜索文件",Grep:"在文件中搜索文本",NotebookEdit:"编辑Jupyter笔记本",WebFetch:"获取网页内容",WebSearch:"搜索网络信息",TodoWrite:"创建和管理待办事项",Task:"执行复杂任务",ExitPlanMode:"退出计划模式",Skill:"调用预定义的技能"};function F(d){return I[d]||d}function ie(d){return ne[d]||""}function le(){const d=new Set([...Object.keys(I)]);return Array.from(d).map(m=>({name:m,label:F(m),description:ie(m)}))}const b=le(),ge=({isOpen:d,onClose:m,selectedRegularTools:i,onRegularToolsChange:f,selectedMcpTools:l,onMcpToolsChange:h,mcpToolsEnabled:G,onMcpEnabledChange:U,presetTools:y=[],readonly:P=!1})=>{const{t:c}=M("components"),[u,K]=g.useState([]),[v,A]=g.useState(!1),[p,T]=g.useState(null),[C,V]=g.useState(new Set),[S,W]=g.useState("regular");g.useEffect(()=>{d&&q()},[d]);const q=async()=>{A(!0),T(null);try{const e=await Q(`${Z}/mcp`);if(!e.ok)throw new Error("Failed to fetch MCP configurations");const r=await e.json();K(r.servers||[])}catch(e){console.error("Failed to fetch MCP servers:",e),T(e instanceof Error?e.message:"Unknown error")}finally{A(!1)}},L=e=>y.some(r=>r.name===e&&r.enabled),j=e=>{if(y.some(s=>s.name===e&&s.enabled))return!0;const r=e.split("__");if(r.length===3&&r[0]==="mcp"){const s=`${r[1]}.${r[2]}`;if(y.some(x=>x.name===s&&x.enabled))return!0;const a=`mcp__${r[1]}__${r[2]}`;if(y.some(x=>x.name===a&&x.enabled))return!0}return!1},z=e=>{L(e)&&i.includes(e)||(i.includes(e)?f(i.filter(r=>r!==e)):f([...i,e]))},H=e=>{j(e)&&l.includes(e)||(l.includes(e)?h(l.filter(r=>r!==e)):h([...l,e]))},J=e=>{const r=new Set(C);r.has(e)?r.delete(e):r.add(e),V(r)},B=e=>{const r=u.find(s=>s.name===e);return!r||!r.tools?!1:r.tools.some(s=>{const a=`mcp__${e}__${s}`;return j(a)})},X=(e,r)=>{const s=u.find(n=>n.name===e);if(!s||!s.tools)return;const a=s.tools.map(n=>`mcp__${e}__${n}`),x=B(e);if(r)if(x){const n=a.filter(o=>!j(o));h(l.filter(o=>!n.includes(o)))}else h(l.filter(n=>!a.includes(n)));else{const n=[...l];a.forEach(o=>{n.includes(o)||n.push(o)}),h(n)}},Y=e=>{const r=u.find(a=>a.name===e);return!r||!r.tools?!1:r.tools.map(a=>`mcp__${e}__${a}`).every(a=>l.includes(a))};return d?t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[60]",onClick:m,children:t.jsxs("div",{className:"unified-tool-selector-popup w-96 max-h-[500px] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg flex flex-col",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"p-4 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:c("unifiedToolSelector.title")}),t.jsx("button",{type:"button",onClick:m,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:t.jsx(R,{className:"w-5 h-5"})})]}),t.jsxs("div",{className:"flex space-x-1 mb-2 bg-gray-100 dark:bg-gray-700 rounded-lg p-1",children:[t.jsxs("button",{type:"button",onClick:()=>W("regular"),className:`flex-1 flex items-center justify-center space-x-2 px-3 py-2 rounded-md text-sm font-medium transition-colors ${S==="regular"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:[t.jsx(ee,{className:"w-4 h-4"}),t.jsx("span",{children:c("unifiedToolSelector.tabs.regular")}),i.length>0&&t.jsx("span",{className:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 text-xs rounded-full px-2 py-0.5 min-w-[20px] text-center",children:i.length})]}),t.jsxs("button",{type:"button",onClick:()=>W("mcp"),className:`flex-1 flex items-center justify-center space-x-2 px-3 py-2 rounded-md text-sm font-medium transition-colors ${S==="mcp"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:[t.jsx(te,{className:"w-4 h-4"}),t.jsx("span",{children:c("unifiedToolSelector.tabs.mcp")}),l.length>0&&t.jsx("span",{className:"bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400 text-xs rounded-full px-2 py-0.5 min-w-[20px] text-center",children:l.filter(e=>e.startsWith("mcp__")&&e.split("__").length===3).length})]})]})]}),t.jsx("div",{className:"px-4 pb-4 overflow-y-auto flex-1",children:S==="regular"?t.jsx("div",{className:"space-y-2",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"flex items-center justify-end p-2 hover:bg-gray-50 dark:hover:bg-gray-700 rounded",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 font-medium",children:c("unifiedToolSelector.selectAll")}),t.jsx("button",{type:"button",onClick:()=>{i.length===b.length?f([]):f(b.map(e=>e.name))},className:`w-4 h-4 border-2 rounded flex items-center justify-center transition-colors ${i.length===b.length||i.length>0?"bg-blue-600 border-blue-600 text-white":"border-gray-300 dark:border-gray-600 hover:border-blue-500"}`,children:i.length===b.length?t.jsx(N,{className:"w-3 h-3"}):i.length>0?t.jsx(O,{className:"w-3 h-3"}):null})]})}),b.map(e=>{const r=i.includes(e.name),s=L(e.name),a=P||s&&r;return t.jsx("div",{className:`flex items-center justify-between p-2 rounded ${a?"bg-gray-50 dark:bg-gray-700":"hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{type:"button",onClick:()=>z(e.name),disabled:a,className:`w-4 h-4 border-2 rounded flex items-center justify-center transition-colors ${r?s?"bg-orange-500 border-orange-500 text-white cursor-not-allowed":"bg-blue-600 border-blue-600 text-white":a?"border-gray-200 dark:border-gray-600 cursor-not-allowed":"border-gray-300 dark:border-gray-600 hover:border-blue-500"}`,children:r&&(s?t.jsx(E,{className:"w-3 h-3"}):t.jsx(N,{className:"w-3 h-3"}))}),t.jsxs("span",{className:`text-sm ${a?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`,children:[F(e.name)," (",e.name,")",s&&t.jsxs("span",{className:"ml-1 text-xs text-orange-600 dark:text-orange-400",children:["[",c("unifiedToolSelector.preset"),"]"]})]})]})},e.name)})]})}):t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"flex items-center justify-end p-2",children:t.jsxs("label",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:c("unifiedToolSelector.enableMcpTools")}),t.jsx("input",{type:"checkbox",checked:G,onChange:e=>U(e.target.checked),className:"w-4 h-4 text-green-600 border-gray-300 dark:border-gray-600 rounded focus:ring-green-500"})]})}),v&&t.jsxs("div",{className:"flex items-center justify-center py-4",children:[t.jsx(re,{className:"w-4 h-4 text-gray-400 animate-spin mr-2"}),t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:c("unifiedToolSelector.loading")})]}),p&&t.jsxs("div",{className:"flex items-center justify-center py-4 text-red-600 dark:text-red-400",children:[t.jsx(D,{className:"w-4 h-4 mr-2"}),t.jsx("span",{className:"text-sm",children:p})]}),!v&&!p&&u.length===0&&t.jsx("div",{className:"text-center py-4 text-gray-500 dark:text-gray-400",children:t.jsx("span",{className:"text-sm",children:c("unifiedToolSelector.noMcpServers")})}),!v&&!p&&u.map(e=>{const r=C.has(e.name),s=e.status==="active",a=Y(e.name),x=e.tools?.some(o=>l.includes(`mcp__${e.name}__${o}`)),n=B(e.name);return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[t.jsxs("div",{className:"flex items-center justify-between p-3",children:[t.jsxs("button",{type:"button",onClick:()=>J(e.name),className:"flex items-center space-x-2 flex-1 text-left hover:bg-gray-50 dark:hover:bg-gray-700 -m-1 p-1 rounded transition-colors",disabled:!s,children:[r?t.jsx(se,{className:"w-4 h-4 text-gray-400"}):t.jsx(ae,{className:"w-4 h-4 text-gray-400"}),t.jsx("div",{className:`w-2 h-2 rounded-full ${s?"bg-green-500":"bg-red-500"}`}),t.jsx("span",{className:`font-medium ${s?"text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"}`,children:e.name}),t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:c("unifiedToolSelector.toolsCount",{count:e.tools?.length||0})})]}),s&&e.tools&&e.tools.length>0&&t.jsx("button",{type:"button",onClick:()=>X(e.name,a),className:`w-4 h-4 border-2 rounded flex items-center justify-center transition-colors ${a?n?"bg-orange-500 border-orange-500 text-white":"bg-green-600 border-green-600 text-white":x?n?"bg-orange-400 border-orange-400 text-white":"bg-blue-600 border-blue-600 text-white":"border-gray-300 dark:border-gray-600 hover:border-green-500"}`,children:a?n?t.jsx(E,{className:"w-3 h-3"}):t.jsx(N,{className:"w-3 h-3"}):x?t.jsx(O,{className:"w-3 h-3"}):null})]}),r&&s&&e.tools&&t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-3 space-y-2",children:e.tools.map(o=>{const _=`mcp__${e.name}__${o}`,$=l.includes(_),k=j(_),w=P||k&&$;return t.jsx("div",{className:`flex items-center justify-between p-2 rounded ${w?"bg-gray-50 dark:bg-gray-700":"hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{type:"button",onClick:()=>H(_),disabled:w,className:`w-4 h-4 border-2 rounded flex items-center justify-center transition-colors ${$?k?"bg-orange-500 border-orange-500 text-white cursor-not-allowed":"bg-green-600 border-green-600 text-white":w?"border-gray-200 dark:border-gray-600 cursor-not-allowed":"border-gray-300 dark:border-gray-600 hover:border-green-500"}`,children:$&&(k?t.jsx(E,{className:"w-3 h-3"}):t.jsx(N,{className:"w-3 h-3"}))}),t.jsxs("span",{className:`text-sm ${w?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`,children:[o,k&&t.jsxs("span",{className:"ml-1 text-xs text-orange-600 dark:text-orange-400",children:["[",c("unifiedToolSelector.preset"),"]"]})]})]})},o)})}),!s&&t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-3",children:t.jsxs("div",{className:"flex items-center text-red-600 dark:text-red-400",children:[t.jsx(D,{className:"w-4 h-4 mr-2"}),t.jsx("span",{className:"text-sm",children:e.error||c("unifiedToolSelector.serverUnavailable")})]})})]},e.name)})]})})]})}):null};export{ge as U,F as g};
@@ -1 +0,0 @@
1
- import{U as a,M as n}from"./ChatPage-p1JCfA2A.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{s as t,c as i,a as o,C as a}from"./chunk-B4BG7PRW-yLeRKRZl.js";import{_ as m}from"./ChatPage-p1JCfA2A.js";import"./chunk-FMBD7UC4-BjJNxbrL.js";import"./chunk-55IACEB6-DtWZPbH-.js";import"./chunk-QN33PNHL-rs7Z3IPT.js";import"./data-structures-C0h9Oap1.js";import"./monaco-editor-DHKm5-VF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DmLFhp96.js";import"./tools-XV29tg8x.js";import"./ui-components-ND8WdSiV.js";import"./useAgents-COcSvqDE.js";import"./useSessions-C2gXprHI.js";import"./index-BUj-AMWq.js";import"./useCommands-D79pjz3C.js";import"./useClaudeVersions-C8b4adpW.js";import"./FileExplorer-B7BFy0Tu.js";import"./UnifiedToolSelector-CnFTY88B.js";import"./FileBrowser-Dg9PfXOo.js";import"./ProjectSelector-B1_umywl.js";var x={parser:o,get db(){return new a},renderer:i,styles:t,init:m(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{x as diagram};
@@ -1 +0,0 @@
1
- import{s as t,c as i,a as o,C as a}from"./chunk-B4BG7PRW-yLeRKRZl.js";import{_ as m}from"./ChatPage-p1JCfA2A.js";import"./chunk-FMBD7UC4-BjJNxbrL.js";import"./chunk-55IACEB6-DtWZPbH-.js";import"./chunk-QN33PNHL-rs7Z3IPT.js";import"./data-structures-C0h9Oap1.js";import"./monaco-editor-DHKm5-VF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DmLFhp96.js";import"./tools-XV29tg8x.js";import"./ui-components-ND8WdSiV.js";import"./useAgents-COcSvqDE.js";import"./useSessions-C2gXprHI.js";import"./index-BUj-AMWq.js";import"./useCommands-D79pjz3C.js";import"./useClaudeVersions-C8b4adpW.js";import"./FileExplorer-B7BFy0Tu.js";import"./UnifiedToolSelector-CnFTY88B.js";import"./FileBrowser-Dg9PfXOo.js";import"./ProjectSelector-B1_umywl.js";var x={parser:o,get db(){return new a},renderer:i,styles:t,init:m(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{x as diagram};
@@ -1 +0,0 @@
1
- import{b as r}from"./_baseUniq-DyqfOLmW.js";var e=4;function a(o){return r(o,e)}export{a as c};