agentstudio 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{AgentsPage-DgoZNP6l.js → AgentsPage-rLPOC44M.js} +1 -1
- package/public/assets/{Button-BHiMThm4.js → Button-CfU7z0eT.js} +1 -1
- package/public/assets/{ChatPage-LoTJrT43.js → ChatPage-Cl0wXezZ.js} +88 -88
- package/public/assets/{CommandsPage-CwEoyASk.js → CommandsPage-BgFvm2GI.js} +1 -1
- package/public/assets/{DashboardPage-BSi_T1tY.js → DashboardPage-BoonTnMH.js} +1 -1
- package/public/assets/{FileBrowser-Df-zwNDa.js → FileBrowser-BiAm3yrg.js} +1 -1
- package/public/assets/{GeneralSettingsPage-DcGmAzci.js → GeneralSettingsPage-BDayH81k.js} +1 -1
- package/public/assets/{LandingPage-DPKvTTja.js → LandingPage-DqS5qWgL.js} +1 -1
- package/public/assets/{LoginPage-BPJUgLru.js → LoginPage-C87yR34d.js} +1 -1
- package/public/assets/{McpAdminSettingsPage-CZZS-pa0.js → McpAdminSettingsPage-DIJs6UrH.js} +1 -1
- package/public/assets/{McpPage-CPF7txxc.js → McpPage-Dc4U_68i.js} +1 -1
- package/public/assets/{MemorySettingsPage-YenW4l-g.js → MemorySettingsPage-TErKrnR2.js} +1 -1
- package/public/assets/{PluginsPage-zlAB63Im.js → PluginsPage-DmCoLCdj.js} +1 -1
- package/public/assets/{ProjectSelector-Bq0NQ_bV.js → ProjectSelector-CFrsNw4L.js} +1 -1
- package/public/assets/{ProjectsPage-BMBRp4RN.js → ProjectsPage-DjumWKPo.js} +1 -1
- package/public/assets/{ScheduledTasksPage-B_hOD6AS.js → ScheduledTasksPage-CsFL7MD9.js} +1 -1
- package/public/assets/{SettingsLayout-CY9Siffq.js → SettingsLayout-D18ZK4TY.js} +1 -1
- package/public/assets/{SkillsPage-X-LMnwZd.js → SkillsPage-DxIdnjRM.js} +1 -1
- package/public/assets/{SubagentsPage-DIG_rKjQ.js → SubagentsPage-DWCgPFzI.js} +1 -1
- package/public/assets/{SystemInfoPage-CWgKWnQg.js → SystemInfoPage-C_kd76VQ.js} +1 -1
- package/public/assets/{TelemetrySettingsPage-BLnMagRZ.js → TelemetrySettingsPage-recK8TS7.js} +1 -1
- package/public/assets/{ToastTestPage-CQ0nobQd.js → ToastTestPage-DYwSASe6.js} +1 -1
- package/public/assets/{VersionSettingsPage-BxjDPWm0.js → VersionSettingsPage-DC_PL1Lo.js} +1 -1
- package/public/assets/{_basePickBy-D_S4EWYL.js → _basePickBy-DtI5oYel.js} +1 -1
- package/public/assets/{_baseUniq-BmQef9o6.js → _baseUniq-kP1SFZPO.js} +1 -1
- package/public/assets/{arc-DzCTkvPU.js → arc-cZ3PN_u0.js} +1 -1
- package/public/assets/{architectureDiagram-VXUJARFQ-8nWlVbiO.js → architectureDiagram-VXUJARFQ-BRn1b9Ct.js} +1 -1
- package/public/assets/{blockDiagram-VD42YOAC-DbHo3vzo.js → blockDiagram-VD42YOAC-B6Fmf92Z.js} +1 -1
- package/public/assets/{c4Diagram-YG6GDRKO-DqFGiZ7Y.js → c4Diagram-YG6GDRKO-BdApn9Kl.js} +1 -1
- package/public/assets/channel-CIc09SLj.js +1 -0
- package/public/assets/{chunk-4BX2VUAB-KZtUHSw3.js → chunk-4BX2VUAB-CFByNt-E.js} +1 -1
- package/public/assets/{chunk-55IACEB6-DTotxzVH.js → chunk-55IACEB6-DOcPvMrL.js} +1 -1
- package/public/assets/{chunk-B4BG7PRW-CkjDO6x_.js → chunk-B4BG7PRW-CYQhDwZH.js} +1 -1
- package/public/assets/{chunk-DI55MBZ5-ZN0hc9BQ.js → chunk-DI55MBZ5-fO-G4DQE.js} +1 -1
- package/public/assets/{chunk-FMBD7UC4--jXmtjeY.js → chunk-FMBD7UC4-CvFCkBe9.js} +1 -1
- package/public/assets/{chunk-QN33PNHL-D-FiWiLB.js → chunk-QN33PNHL-C4dfuLJX.js} +1 -1
- package/public/assets/{chunk-QZHKN3VN-BRs4hln6.js → chunk-QZHKN3VN-BHcbArKX.js} +1 -1
- package/public/assets/{chunk-TZMSLE5B-BUZTflc7.js → chunk-TZMSLE5B-NAHq3aeT.js} +1 -1
- package/public/assets/{classDiagram-2ON5EDUG-7Lo3C-C9.js → classDiagram-2ON5EDUG-BX8bS8-I.js} +1 -1
- package/public/assets/{classDiagram-v2-WZHVMYZB-7Lo3C-C9.js → classDiagram-v2-WZHVMYZB-BX8bS8-I.js} +1 -1
- package/public/assets/clone-CPcgYjA1.js +1 -0
- package/public/assets/{cose-bilkent-S5V4N54A-s2WN1XmV.js → cose-bilkent-S5V4N54A-C06C9ZJa.js} +1 -1
- package/public/assets/{dagre-6UL2VRFP-CxaKwQyB.js → dagre-6UL2VRFP-DCPyTNLq.js} +1 -1
- package/public/assets/{diagram-PSM6KHXK-SU1hlbjn.js → diagram-PSM6KHXK-D_EHe21D.js} +1 -1
- package/public/assets/{diagram-QEK2KX5R-hcM85tep.js → diagram-QEK2KX5R-BlulhQOc.js} +1 -1
- package/public/assets/{diagram-S2PKOQOG-BOmtKWhQ.js → diagram-S2PKOQOG-DeNVHhsT.js} +1 -1
- package/public/assets/{erDiagram-Q2GNP2WA-CsTay3Qr.js → erDiagram-Q2GNP2WA-Bnz9kE57.js} +1 -1
- package/public/assets/{flowDiagram-NV44I4VS-QLwVU4W3.js → flowDiagram-NV44I4VS-CFn031Y3.js} +1 -1
- package/public/assets/{ganttDiagram-LVOFAZNH-CEJd76u6.js → ganttDiagram-LVOFAZNH-BSduoCu_.js} +1 -1
- package/public/assets/{gitGraphDiagram-NY62KEGX-Cr7KuVc8.js → gitGraphDiagram-NY62KEGX-Bjbb7yAS.js} +1 -1
- package/public/assets/{graph-B12xs1JB.js → graph-D2RBy8e5.js} +1 -1
- package/public/assets/{index-BFYHztzB.js → index-BLjehayc.js} +2 -2
- package/public/assets/{infoDiagram-F6ZHWCRC-B6PyESp0.js → infoDiagram-F6ZHWCRC-BfeoDjKc.js} +1 -1
- package/public/assets/{journeyDiagram-XKPGCS4Q-DSlyGZSv.js → journeyDiagram-XKPGCS4Q-8tSVYPVe.js} +1 -1
- package/public/assets/{kanban-definition-3W4ZIXB7-DbDLw__g.js → kanban-definition-3W4ZIXB7-DwrpLyOH.js} +1 -1
- package/public/assets/{layout-OtboCb25.js → layout-B6w-fMcI.js} +1 -1
- package/public/assets/{linear-Bg3HtxIB.js → linear-ClbokBhh.js} +1 -1
- package/public/assets/{mindmap-definition-VGOIOE7T-DZ4bp0qm.js → mindmap-definition-VGOIOE7T-BurOGP_m.js} +1 -1
- package/public/assets/{pieDiagram-ADFJNKIX-Am2n8jc0.js → pieDiagram-ADFJNKIX-MUQTeIhp.js} +1 -1
- package/public/assets/{quadrantDiagram-AYHSOK5B-DPm8iQzH.js → quadrantDiagram-AYHSOK5B-COgCGFdz.js} +1 -1
- package/public/assets/{requirementDiagram-UZGBJVZJ-hVW5YE3R.js → requirementDiagram-UZGBJVZJ-DlYkINPo.js} +1 -1
- package/public/assets/{sankeyDiagram-TZEHDZUN-DX8gGHoq.js → sankeyDiagram-TZEHDZUN-oj7WNP67.js} +1 -1
- package/public/assets/{sequenceDiagram-WL72ISMW-Brl8T0m9.js → sequenceDiagram-WL72ISMW-TUi1zhlp.js} +1 -1
- package/public/assets/{stateDiagram-FKZM4ZOC-CxrXSnfX.js → stateDiagram-FKZM4ZOC-B7tNjdp0.js} +1 -1
- package/public/assets/{stateDiagram-v2-4FDKWEC3-BJfGHaLv.js → stateDiagram-v2-4FDKWEC3-9TkkItno.js} +1 -1
- package/public/assets/{table-D-FJ6K6j.js → table-Br8ioTXr.js} +1 -1
- package/public/assets/{timeline-definition-IT6M3QCI-CO6fKxuR.js → timeline-definition-IT6M3QCI-CSSGR7Wj.js} +1 -1
- package/public/assets/{treemap-KMMF4GRG-BsoblFM5.js → treemap-KMMF4GRG-BAb3Fz4w.js} +1 -1
- package/public/assets/{xychartDiagram-PRI3JC2R-B6g-H_PO.js → xychartDiagram-PRI3JC2R-Cd2BfyOw.js} +1 -1
- package/public/index.html +1 -1
- package/routes/sessions.d.ts.map +1 -1
- package/routes/sessions.js +17 -3
- package/routes/sessions.js.map +1 -1
- package/services/__tests__/projectMetadataStorage.test.d.ts +5 -0
- package/services/__tests__/projectMetadataStorage.test.d.ts.map +1 -0
- package/services/__tests__/projectMetadataStorage.test.js +154 -0
- package/services/__tests__/projectMetadataStorage.test.js.map +1 -0
- package/services/projectMetadataStorage.d.ts +7 -1
- package/services/projectMetadataStorage.d.ts.map +1 -1
- package/services/projectMetadataStorage.js +102 -27
- package/services/projectMetadataStorage.js.map +1 -1
- package/services/sessionManager.d.ts.map +1 -1
- package/services/sessionManager.js +17 -3
- package/services/sessionManager.js.map +1 -1
- package/public/assets/channel-DlGw39mX.js +0 -1
- package/public/assets/clone-180En6VP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{T as P,a as D,b as j,c as m,d as B,e as x}from"./table-D-FJ6K6j.js";import{u as L,a as R}from"./useCommands-DOxDeFSx.js";import{C as q}from"./CommandForm-CZRscRtm.js";import{f as N}from"./dateFormat-CXa8VnEC.js";import{b as z}from"./index-BFYHztzB.js";import{T as f}from"./ToolsList-C9LELdNX.js";import{u as J}from"./tools-zTM46-tZ.js";import{j as v,g as G,v as I,o as k,m as w,J as C,y as $,E as K}from"./ui-components-BsYwJvCF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-D9dWnZr0.js";import"./UnifiedToolSelector-Bw-E7HW4.js";const re=()=>{const{t}=J("pages"),{isMobile:a}=z(),[d]=i.useState({scope:"user"}),[n,T]=i.useState(""),[S,r]=i.useState(!1),[F,l]=i.useState(null),[g,o]=i.useState(null),[u,b]=i.useState({}),{data:A=[],isLoading:M,error:E,refetch:y}=L({...d,search:n.trim()||void 0}),h=R(),H=async s=>{try{await h.mutateAsync(s.id),o(null)}catch(c){console.error("Failed to delete command:",c)}},p=A.filter(s=>!(d.scope&&d.scope!=="all"&&s.scope!==d.scope||d.namespace&&s.namespace!==d.namespace));return M?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-blue-500 mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:t("commands.loading")})]})}):E?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(v,{className:"h-16 w-16 text-red-500 mx-auto mb-4"}),e.jsx("p",{className:"text-red-600 text-lg mb-2",children:t("commands.error.loadFailed")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:t("commands.error.cannotLoadCommands")}),e.jsx("button",{onClick:()=>y(),className:"bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg transition-colors",children:t("commands.error.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:`${a?"mb-4":"flex items-center justify-between mb-6"}`,children:e.jsxs("div",{children:[e.jsx("h1",{className:`${a?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:t("commands.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mt-1":"mt-2"}`,children:t("commands.subtitle")})]})}),e.jsxs("div",{className:`${a?"space-y-3":"flex items-center space-x-4"}`,children:[e.jsxs("div",{className:`${a?"":"flex-1"} relative`,children:[e.jsx(G,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:t("commands.searchPlaceholder"),value:n,onChange:s=>T(s.target.value),className:`pl-10 pr-4 ${a?"py-2":"py-3"} w-full border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${a?"text-sm":""}`})]}),e.jsxs("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-2.5 px-4":"flex items-center space-x-2 px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors ${a?"text-sm":""}`,children:[e.jsx(I,{className:`${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:t("commands.createButton")})]})]})]}),p.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:`${a?"text-4xl":"text-6xl"} mb-4`,children:"⚡"}),e.jsx("h3",{className:`${a?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:t(n?"commands.empty.noMatchingCommands":"commands.empty.noCommands")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:t(n?"commands.empty.adjustSearch":"commands.empty.createFirst")}),!n&&e.jsx("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-3 px-4":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:t("commands.createButton")})]}):e.jsx(e.Fragment,{children:a?e.jsx("div",{className:"space-y-4",children:p.map((s,c)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`${a?"text-lg":"text-xl"} mr-3`,children:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:`${a?"text-sm":"text-base"} font-medium text-gray-900 dark:text-white`,children:[s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`,s.argumentHint&&e.jsx("code",{className:"ml-2 bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:s.description})]})]})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.model"),":"]}),s.model?e.jsxs("div",{className:"flex items-center text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-sm",children:s.model})]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})]}),e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-start text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2 mt-1",children:[t("commands.table.tools"),":"]}),e.jsx("div",{className:"flex-1",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!0,emptyMessage:t("commands.table.inheritSettings")})})]})}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.createdAt"),":"]}),e.jsxs("div",{className:"flex items-center text-gray-500 dark:text-gray-400",children:[e.jsx(w,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end space-x-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})]},s.id+"-"+c))}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(P,{children:[e.jsx(D,{children:e.jsxs(j,{children:[e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.command")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.model")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.tools")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.createdAt")}),e.jsx(m,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.actions")})]})}),e.jsx(B,{children:p.map((s,c)=>e.jsxs(j,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(x,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${s.source==="plugin"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"}`,children:s.source==="plugin"?t("commands.source.plugin"):t("commands.source.local")}),s.argumentHint&&e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-xs mt-1",children:s.description})]})]})}),e.jsx(x,{className:"px-6 py-4",children:s.model?e.jsxs("div",{className:"text-sm text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 inline mr-1"}),s.model]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!1,emptyMessage:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(w,{className:"w-4 h-4"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.source==="plugin"?e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:t("commands.actions.view"),children:[e.jsx(K,{className:"w-3 h-3 mr-1"}),t("commands.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:t("commands.actions.editCommand"),children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})})})]},s.id+"-"+c))})]})})}),S&&e.jsx(q,{command:F,onClose:()=>{r(!1),l(null)},onSuccess:()=>{r(!1),l(null),y()}}),g&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl ${a?"w-full max-w-sm":"max-w-md w-full mx-4"} p-6`,children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(v,{className:`${a?"h-5 w-5":"h-6 w-6"} text-red-600`})}),e.jsx("div",{className:"flex-1",children:e.jsx("h3",{className:`${a?"text-base":"text-lg"} font-medium text-gray-900 dark:text-white`,children:t("commands.delete.title")})})]}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mb-4 text-sm":"mb-6"}`,children:t("commands.delete.confirmMessage",{name:g.name})}),e.jsxs("div",{className:`${a?"grid grid-cols-2 gap-2":"flex justify-end space-x-3"}`,children:[e.jsx("button",{onClick:()=>o(null),className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg transition-colors`,children:t("commands.delete.cancel")}),e.jsx("button",{onClick:()=>H(g),disabled:h.isPending,className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors disabled:opacity-50`,children:h.isPending?t("commands.delete.deleting"):t("commands.delete.delete")})]})]})})]})};export{re as CommandsPage};
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{T as P,a as D,b as j,c as m,d as B,e as x}from"./table-Br8ioTXr.js";import{u as L,a as R}from"./useCommands-DOxDeFSx.js";import{C as q}from"./CommandForm-CZRscRtm.js";import{f as N}from"./dateFormat-CXa8VnEC.js";import{b as z}from"./index-BLjehayc.js";import{T as f}from"./ToolsList-C9LELdNX.js";import{u as J}from"./tools-zTM46-tZ.js";import{j as v,g as G,v as I,o as k,m as w,J as C,y as $,E as K}from"./ui-components-BsYwJvCF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-D9dWnZr0.js";import"./UnifiedToolSelector-Bw-E7HW4.js";const re=()=>{const{t}=J("pages"),{isMobile:a}=z(),[d]=i.useState({scope:"user"}),[n,T]=i.useState(""),[S,r]=i.useState(!1),[F,l]=i.useState(null),[g,o]=i.useState(null),[u,b]=i.useState({}),{data:A=[],isLoading:M,error:E,refetch:y}=L({...d,search:n.trim()||void 0}),h=R(),H=async s=>{try{await h.mutateAsync(s.id),o(null)}catch(c){console.error("Failed to delete command:",c)}},p=A.filter(s=>!(d.scope&&d.scope!=="all"&&s.scope!==d.scope||d.namespace&&s.namespace!==d.namespace));return M?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-blue-500 mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:t("commands.loading")})]})}):E?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(v,{className:"h-16 w-16 text-red-500 mx-auto mb-4"}),e.jsx("p",{className:"text-red-600 text-lg mb-2",children:t("commands.error.loadFailed")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:t("commands.error.cannotLoadCommands")}),e.jsx("button",{onClick:()=>y(),className:"bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg transition-colors",children:t("commands.error.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:`${a?"mb-4":"flex items-center justify-between mb-6"}`,children:e.jsxs("div",{children:[e.jsx("h1",{className:`${a?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:t("commands.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mt-1":"mt-2"}`,children:t("commands.subtitle")})]})}),e.jsxs("div",{className:`${a?"space-y-3":"flex items-center space-x-4"}`,children:[e.jsxs("div",{className:`${a?"":"flex-1"} relative`,children:[e.jsx(G,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:t("commands.searchPlaceholder"),value:n,onChange:s=>T(s.target.value),className:`pl-10 pr-4 ${a?"py-2":"py-3"} w-full border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${a?"text-sm":""}`})]}),e.jsxs("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-2.5 px-4":"flex items-center space-x-2 px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors ${a?"text-sm":""}`,children:[e.jsx(I,{className:`${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:t("commands.createButton")})]})]})]}),p.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:`${a?"text-4xl":"text-6xl"} mb-4`,children:"⚡"}),e.jsx("h3",{className:`${a?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:t(n?"commands.empty.noMatchingCommands":"commands.empty.noCommands")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:t(n?"commands.empty.adjustSearch":"commands.empty.createFirst")}),!n&&e.jsx("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-3 px-4":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:t("commands.createButton")})]}):e.jsx(e.Fragment,{children:a?e.jsx("div",{className:"space-y-4",children:p.map((s,c)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`${a?"text-lg":"text-xl"} mr-3`,children:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:`${a?"text-sm":"text-base"} font-medium text-gray-900 dark:text-white`,children:[s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`,s.argumentHint&&e.jsx("code",{className:"ml-2 bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:s.description})]})]})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.model"),":"]}),s.model?e.jsxs("div",{className:"flex items-center text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-sm",children:s.model})]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})]}),e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-start text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2 mt-1",children:[t("commands.table.tools"),":"]}),e.jsx("div",{className:"flex-1",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!0,emptyMessage:t("commands.table.inheritSettings")})})]})}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.createdAt"),":"]}),e.jsxs("div",{className:"flex items-center text-gray-500 dark:text-gray-400",children:[e.jsx(w,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end space-x-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})]},s.id+"-"+c))}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(P,{children:[e.jsx(D,{children:e.jsxs(j,{children:[e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.command")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.model")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.tools")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.createdAt")}),e.jsx(m,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.actions")})]})}),e.jsx(B,{children:p.map((s,c)=>e.jsxs(j,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(x,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${s.source==="plugin"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"}`,children:s.source==="plugin"?t("commands.source.plugin"):t("commands.source.local")}),s.argumentHint&&e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-xs mt-1",children:s.description})]})]})}),e.jsx(x,{className:"px-6 py-4",children:s.model?e.jsxs("div",{className:"text-sm text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 inline mr-1"}),s.model]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!1,emptyMessage:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(w,{className:"w-4 h-4"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.source==="plugin"?e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:t("commands.actions.view"),children:[e.jsx(K,{className:"w-3 h-3 mr-1"}),t("commands.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:t("commands.actions.editCommand"),children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})})})]},s.id+"-"+c))})]})})}),S&&e.jsx(q,{command:F,onClose:()=>{r(!1),l(null)},onSuccess:()=>{r(!1),l(null),y()}}),g&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl ${a?"w-full max-w-sm":"max-w-md w-full mx-4"} p-6`,children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(v,{className:`${a?"h-5 w-5":"h-6 w-6"} text-red-600`})}),e.jsx("div",{className:"flex-1",children:e.jsx("h3",{className:`${a?"text-base":"text-lg"} font-medium text-gray-900 dark:text-white`,children:t("commands.delete.title")})})]}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mb-4 text-sm":"mb-6"}`,children:t("commands.delete.confirmMessage",{name:g.name})}),e.jsxs("div",{className:`${a?"grid grid-cols-2 gap-2":"flex justify-end space-x-3"}`,children:[e.jsx("button",{onClick:()=>o(null),className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg transition-colors`,children:t("commands.delete.cancel")}),e.jsx("button",{onClick:()=>H(g),disabled:h.isPending,className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors disabled:opacity-50`,children:h.isPending?t("commands.delete.deleting"):t("commands.delete.delete")})]})]})})]})};export{re as CommandsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{u as B}from"./useProjects-cgsJNlsy.js";import{u as O,a as Q}from"./useAgents-BlQGwXjx.js";import{u as _,c as W,a as X}from"./useSessions-BAxZ6l2n.js";import{u as G}from"./agents-D9dWnZr0.js";import{u as J,s as x,a as P}from"./index-BFYHztzB.js";import{u as Y}from"./tools-zTM46-tZ.js";import{p as Z,h as ee,e as ae,o as se,q as re,S as te,f as le,r as de,s as oe,t as ne,u as h,L as b,v as ie,k as ce,w as ue,x as ge,y as me,j as xe,X as he}from"./ui-components-BsYwJvCF.js";import"./syntax-highlighting-CnREyncB.js";const Ve=()=>{const{t:s}=Y("pages"),A=J(),I=G(),{data:$,isLoading:F}=B(),{data:D}=O(!0),{data:M,refetch:p}=_(),T=Q(),[i,f]=d.useState(""),[t,u]=d.useState(null),[j,g]=d.useState(!1),[y,k]=d.useState(!1),[w,v]=d.useState(!1),[N,C]=d.useState(null),o=$?.projects||[],n=D?.agents||[],c=M?.sessions||[];d.useEffect(()=>{o.length>0&&!t&&u(o[0])},[o,t]);const m=a=>{if(!a)return n[0];if(a.defaultAgent){const r=n.find(l=>l.id===a.defaultAgent);if(r)return r}return n[0]},q=async()=>{const a=n.find(r=>r.id==="claude-code")||n[0];if(a){k(!0);try{const r="default-workspace",l=await T.mutateAsync({agentId:a.id,projectName:r});await I.invalidateQueries({queryKey:["projects"]}),u(l.project),x(s("dashboard.projectCreated.title",{defaultValue:"项目创建成功"}),s("dashboard.projectCreated.message",{defaultValue:"已经为您创建项目:{{name}},你现在可以开始与 Agent 工作了。",name:r}))}catch(r){console.error("Failed to create default project:",r)}finally{k(!1)}}},V=()=>{const a=m(t);if(!i.trim()||!t||!a)return;const r=encodeURIComponent(i),l=`/chat/${a.id}?project=${encodeURIComponent(t.path)}&message=${r}`;window.open(l,"_blank")},E=async a=>{C(a);try{await X(a),await p(),x(s("dashboard.sessions.closed",{defaultValue:"会话已关闭"}),s("dashboard.sessions.closedMessage",{defaultValue:"会话已成功关闭"}))}catch(r){console.error("Failed to close session:",r),P(s("dashboard.sessions.closeFailed",{defaultValue:"关闭失败"}),r instanceof Error?r.message:s("dashboard.sessions.closeError",{defaultValue:"无法关闭会话"}))}finally{C(null)}},L=async()=>{if(c.length!==0){v(!0);try{const a=await W();await p(),x(s("dashboard.sessions.allCleared",{defaultValue:"全部清除"}),s("dashboard.sessions.allClearedMessage",{defaultValue:"已清除 {{count}} 个会话",count:a.clearedCount}))}catch(a){console.error("Failed to clear all sessions:",a),P(s("dashboard.sessions.clearFailed",{defaultValue:"清除失败"}),a instanceof Error?a.message:s("dashboard.sessions.clearError",{defaultValue:"无法清除会话"}))}finally{v(!1)}}},R=[{icon:Z,label:s("dashboard.templates.organizeFiles",{defaultValue:"整理文件"}),prompt:"帮我整理一下当前目录下的文件。请先分析目录结构,然后提出整理方案让我确认,最后再执行。"},{icon:ee,label:s("dashboard.templates.analyzeFiles",{defaultValue:"文件分析"}),prompt:"帮我分析一下当前项目的文件结构和代码情况,给出概要报告。"},{icon:ae,label:s("dashboard.templates.writeDoc",{defaultValue:"写一份文档"}),prompt:"帮我为这个项目写一份 README 文档,包含项目介绍、安装步骤和使用说明。"},{icon:se,label:s("dashboard.templates.codeReview",{defaultValue:"代码审查"}),prompt:"帮我审查一下这个项目的代码质量,包括代码风格、潜在问题和改进建议。"},{icon:re,label:s("dashboard.templates.checkWeather",{defaultValue:"查深圳天气"}),prompt:"查一下深圳现在的天气情况。"},{icon:te,label:s("dashboard.templates.quickTask",{defaultValue:"自由提问"}),prompt:""}],z=[{icon:le,label:s("dashboard.quickLinks.projects",{defaultValue:"项目管理"}),path:"/projects",color:"text-blue-500 bg-blue-50 dark:bg-blue-900/30"},{icon:de,label:s("dashboard.quickLinks.modelSettings",{defaultValue:"模型供应商"}),path:"/settings/suppliers",color:"text-purple-500 bg-purple-50 dark:bg-purple-900/30"},{icon:oe,label:s("dashboard.quickLinks.scheduledTasks",{defaultValue:"定时任务"}),path:"/scheduled-tasks",color:"text-green-500 bg-green-50 dark:bg-green-900/30"},{icon:ne,label:s("dashboard.quickLinks.customAgents",{defaultValue:"自定义 Agent"}),path:"/agents",color:"text-orange-500 bg-orange-50 dark:bg-orange-900/30"}],U=a=>{if(a){const r=m(t);if(t&&r){const l=encodeURIComponent(a),S=`/chat/${r.id}?project=${encodeURIComponent(t.path)}&message=${l}`;window.open(S,"_blank")}else f(a)}},H=!F&&o.length===0,K=a=>{const r=Math.floor(a/1e3);if(r<60)return`${r}s`;const l=Math.floor(r/60);return l<60?`${l}m`:`${Math.floor(l/60)}h`};return e.jsx("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-auto",children:e.jsxs("div",{className:"flex-1 flex flex-col items-center px-6 py-8",children:[e.jsx("div",{className:"text-center mb-8",children:e.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 dark:text-white",children:s("dashboard.welcome.title",{defaultValue:"让我们开始工作吧"})})}),e.jsxs("div",{className:"w-full max-w-2xl",children:[H&&e.jsxs("div",{className:"mb-6 p-6 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-2xl text-center",children:[e.jsx(h,{className:"w-12 h-12 text-amber-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-lg font-medium text-amber-800 dark:text-amber-200 mb-2",children:s("dashboard.noProjectsHint.title",{defaultValue:"还没有项目"})}),e.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-300 mb-4",children:s("dashboard.noProjectsHint.description",{defaultValue:"创建一个项目来开始与 AI 协作"})}),e.jsx("button",{onClick:q,disabled:y||n.length===0,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-amber-600 hover:bg-amber-700 disabled:bg-amber-400 text-white rounded-xl font-medium transition-colors",children:y?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:s("dashboard.noProjectsHint.creating",{defaultValue:"创建中..."})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4"}),e.jsx("span",{children:s("dashboard.noProjectsHint.createButton",{defaultValue:"一键创建默认项目"})})]})})]}),e.jsx("div",{className:"mb-6 grid grid-cols-2 md:grid-cols-3 gap-3",children:R.map((a,r)=>e.jsxs("button",{onClick:()=>U(a.prompt),className:"flex items-center gap-3 px-4 py-3.5 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-600/50 hover:border-gray-300 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-700 hover:shadow-md text-left transition-all group",children:[e.jsx("div",{className:"flex-shrink-0 p-2 bg-gray-100 dark:bg-gray-700 rounded-lg",children:e.jsx(a.icon,{className:"w-5 h-5 text-gray-500 dark:text-gray-300"})}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200 group-hover:text-gray-900 dark:group-hover:text-white transition-colors",children:a.label})]},r))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("textarea",{value:i,onChange:a=>f(a.target.value),onKeyDown:a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),V())},placeholder:s("dashboard.inputPlaceholder",{defaultValue:"描述你想要完成的任务..."}),className:"w-full px-5 py-4 text-base bg-transparent border-none outline-none resize-none text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500",rows:3}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-100 dark:border-gray-700",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>g(!j),className:"flex items-center gap-2 px-3 py-1.5 bg-gray-50 dark:bg-gray-700/50 rounded-lg border border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500 transition-colors",children:[e.jsx(h,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300 max-w-[150px] truncate",children:t?.name||s("dashboard.selectProject",{defaultValue:"选择项目"})}),e.jsx(ce,{className:"w-3.5 h-3.5 text-gray-400"})]}),j&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>g(!1)}),e.jsxs("div",{className:"absolute left-0 top-full mt-2 w-72 bg-white dark:bg-gray-800 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700 z-20 max-h-64 overflow-y-auto",children:[o.map(a=>e.jsxs("button",{onClick:()=>{u(a),g(!1)},className:`w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700/50 flex items-center gap-3 first:rounded-t-xl last:rounded-b-xl ${t?.id===a.id?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[e.jsx(h,{className:`w-4 h-4 flex-shrink-0 ${t?.id===a.id?"text-blue-500":"text-gray-400"}`}),e.jsx("span",{className:`text-sm truncate ${t?.id===a.id?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"}`,children:a.name})]},a.id)),o.length===0&&e.jsx("div",{className:"px-4 py-6 text-center text-gray-500 text-sm",children:s("dashboard.noProjects",{defaultValue:"暂无项目"})})]})]})]}),e.jsxs("button",{onClick:V,disabled:!i.trim()||!t||!m(t),className:"flex items-center gap-2 px-5 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 dark:disabled:bg-gray-600 text-white rounded-xl font-medium transition-colors disabled:cursor-not-allowed",children:[e.jsx("span",{children:s("dashboard.startChat",{defaultValue:"开始对话"})}),e.jsx(ue,{className:"w-4 h-4"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3 text-sm text-gray-400 dark:text-gray-500",children:[e.jsx(ge,{className:"w-4 h-4 animate-bounce"}),e.jsx("span",{children:s("dashboard.welcome.subtitle",{defaultValue:"选择一个项目,开始与 AI 协作完成任务"})})]})]}),e.jsxs("div",{className:"mt-10",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-4 text-center",children:s("dashboard.quickLinks.title",{defaultValue:"快捷入口"})}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:z.map((a,r)=>e.jsxs("button",{onClick:()=>A(a.path),className:"flex flex-col items-center gap-2 p-4 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-md transition-all group",children:[e.jsx("div",{className:`p-2.5 rounded-lg ${a.color}`,children:e.jsx(a.icon,{className:"w-5 h-5"})}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white transition-colors",children:a.label})]},r))})]}),c.length>0&&e.jsxs("div",{className:"mt-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:[s("dashboard.sessions.title",{defaultValue:"活跃会话"})," (",c.length,")"]}),e.jsxs("button",{onClick:L,disabled:w,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-50",children:[w?e.jsx(b,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(me,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:s("dashboard.sessions.clearAll",{defaultValue:"清除全部"})})]})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 divide-y divide-gray-100 dark:divide-gray-700 max-h-64 overflow-y-auto",children:c.map(a=>{const r=a.projectPath?a.projectPath.split("/").pop()||a.projectPath:"-",l=a.sessionTitle||`${s("dashboard.sessions.session",{defaultValue:"会话"})} ${a.sessionId.slice(0,8)}`;return e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${a.status==="confirmed"?"bg-green-500":"bg-amber-500"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 truncate font-medium",children:l}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 mt-0.5",children:[e.jsx("span",{className:"truncate max-w-[120px]",title:r,children:r}),e.jsx("span",{children:"•"}),e.jsx("span",{children:a.agentId}),a.modelId&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{className:"bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded",children:a.modelId.replace("claude-","").replace(/-\d{8}$/,"")})]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:K(a.idleTimeMs)}),a.heartbeatTimedOut&&e.jsx("span",{className:"text-amber-500 flex items-center gap-1",children:e.jsx(xe,{className:"w-3 h-3"})})]})]})]}),e.jsx("button",{onClick:()=>E(a.sessionId),disabled:N===a.sessionId,className:"p-1.5 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-50",title:s("dashboard.sessions.close",{defaultValue:"关闭会话"}),children:N===a.sessionId?e.jsx(b,{className:"w-4 h-4 animate-spin"}):e.jsx(he,{className:"w-4 h-4"})})]},a.sessionId)})})]})]})]})})};export{Ve as DashboardPage};
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{u as B}from"./useProjects-cgsJNlsy.js";import{u as O,a as Q}from"./useAgents-BlQGwXjx.js";import{u as _,c as W,a as X}from"./useSessions-BAxZ6l2n.js";import{u as G}from"./agents-D9dWnZr0.js";import{u as J,s as x,a as P}from"./index-BLjehayc.js";import{u as Y}from"./tools-zTM46-tZ.js";import{p as Z,h as ee,e as ae,o as se,q as re,S as te,f as le,r as de,s as oe,t as ne,u as h,L as b,v as ie,k as ce,w as ue,x as ge,y as me,j as xe,X as he}from"./ui-components-BsYwJvCF.js";import"./syntax-highlighting-CnREyncB.js";const Ve=()=>{const{t:s}=Y("pages"),A=J(),I=G(),{data:$,isLoading:F}=B(),{data:D}=O(!0),{data:M,refetch:p}=_(),T=Q(),[i,f]=d.useState(""),[t,u]=d.useState(null),[j,g]=d.useState(!1),[y,k]=d.useState(!1),[w,v]=d.useState(!1),[N,C]=d.useState(null),o=$?.projects||[],n=D?.agents||[],c=M?.sessions||[];d.useEffect(()=>{o.length>0&&!t&&u(o[0])},[o,t]);const m=a=>{if(!a)return n[0];if(a.defaultAgent){const r=n.find(l=>l.id===a.defaultAgent);if(r)return r}return n[0]},q=async()=>{const a=n.find(r=>r.id==="claude-code")||n[0];if(a){k(!0);try{const r="default-workspace",l=await T.mutateAsync({agentId:a.id,projectName:r});await I.invalidateQueries({queryKey:["projects"]}),u(l.project),x(s("dashboard.projectCreated.title",{defaultValue:"项目创建成功"}),s("dashboard.projectCreated.message",{defaultValue:"已经为您创建项目:{{name}},你现在可以开始与 Agent 工作了。",name:r}))}catch(r){console.error("Failed to create default project:",r)}finally{k(!1)}}},V=()=>{const a=m(t);if(!i.trim()||!t||!a)return;const r=encodeURIComponent(i),l=`/chat/${a.id}?project=${encodeURIComponent(t.path)}&message=${r}`;window.open(l,"_blank")},E=async a=>{C(a);try{await X(a),await p(),x(s("dashboard.sessions.closed",{defaultValue:"会话已关闭"}),s("dashboard.sessions.closedMessage",{defaultValue:"会话已成功关闭"}))}catch(r){console.error("Failed to close session:",r),P(s("dashboard.sessions.closeFailed",{defaultValue:"关闭失败"}),r instanceof Error?r.message:s("dashboard.sessions.closeError",{defaultValue:"无法关闭会话"}))}finally{C(null)}},L=async()=>{if(c.length!==0){v(!0);try{const a=await W();await p(),x(s("dashboard.sessions.allCleared",{defaultValue:"全部清除"}),s("dashboard.sessions.allClearedMessage",{defaultValue:"已清除 {{count}} 个会话",count:a.clearedCount}))}catch(a){console.error("Failed to clear all sessions:",a),P(s("dashboard.sessions.clearFailed",{defaultValue:"清除失败"}),a instanceof Error?a.message:s("dashboard.sessions.clearError",{defaultValue:"无法清除会话"}))}finally{v(!1)}}},R=[{icon:Z,label:s("dashboard.templates.organizeFiles",{defaultValue:"整理文件"}),prompt:"帮我整理一下当前目录下的文件。请先分析目录结构,然后提出整理方案让我确认,最后再执行。"},{icon:ee,label:s("dashboard.templates.analyzeFiles",{defaultValue:"文件分析"}),prompt:"帮我分析一下当前项目的文件结构和代码情况,给出概要报告。"},{icon:ae,label:s("dashboard.templates.writeDoc",{defaultValue:"写一份文档"}),prompt:"帮我为这个项目写一份 README 文档,包含项目介绍、安装步骤和使用说明。"},{icon:se,label:s("dashboard.templates.codeReview",{defaultValue:"代码审查"}),prompt:"帮我审查一下这个项目的代码质量,包括代码风格、潜在问题和改进建议。"},{icon:re,label:s("dashboard.templates.checkWeather",{defaultValue:"查深圳天气"}),prompt:"查一下深圳现在的天气情况。"},{icon:te,label:s("dashboard.templates.quickTask",{defaultValue:"自由提问"}),prompt:""}],z=[{icon:le,label:s("dashboard.quickLinks.projects",{defaultValue:"项目管理"}),path:"/projects",color:"text-blue-500 bg-blue-50 dark:bg-blue-900/30"},{icon:de,label:s("dashboard.quickLinks.modelSettings",{defaultValue:"模型供应商"}),path:"/settings/suppliers",color:"text-purple-500 bg-purple-50 dark:bg-purple-900/30"},{icon:oe,label:s("dashboard.quickLinks.scheduledTasks",{defaultValue:"定时任务"}),path:"/scheduled-tasks",color:"text-green-500 bg-green-50 dark:bg-green-900/30"},{icon:ne,label:s("dashboard.quickLinks.customAgents",{defaultValue:"自定义 Agent"}),path:"/agents",color:"text-orange-500 bg-orange-50 dark:bg-orange-900/30"}],U=a=>{if(a){const r=m(t);if(t&&r){const l=encodeURIComponent(a),S=`/chat/${r.id}?project=${encodeURIComponent(t.path)}&message=${l}`;window.open(S,"_blank")}else f(a)}},H=!F&&o.length===0,K=a=>{const r=Math.floor(a/1e3);if(r<60)return`${r}s`;const l=Math.floor(r/60);return l<60?`${l}m`:`${Math.floor(l/60)}h`};return e.jsx("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-auto",children:e.jsxs("div",{className:"flex-1 flex flex-col items-center px-6 py-8",children:[e.jsx("div",{className:"text-center mb-8",children:e.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 dark:text-white",children:s("dashboard.welcome.title",{defaultValue:"让我们开始工作吧"})})}),e.jsxs("div",{className:"w-full max-w-2xl",children:[H&&e.jsxs("div",{className:"mb-6 p-6 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-2xl text-center",children:[e.jsx(h,{className:"w-12 h-12 text-amber-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-lg font-medium text-amber-800 dark:text-amber-200 mb-2",children:s("dashboard.noProjectsHint.title",{defaultValue:"还没有项目"})}),e.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-300 mb-4",children:s("dashboard.noProjectsHint.description",{defaultValue:"创建一个项目来开始与 AI 协作"})}),e.jsx("button",{onClick:q,disabled:y||n.length===0,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-amber-600 hover:bg-amber-700 disabled:bg-amber-400 text-white rounded-xl font-medium transition-colors",children:y?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:s("dashboard.noProjectsHint.creating",{defaultValue:"创建中..."})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4"}),e.jsx("span",{children:s("dashboard.noProjectsHint.createButton",{defaultValue:"一键创建默认项目"})})]})})]}),e.jsx("div",{className:"mb-6 grid grid-cols-2 md:grid-cols-3 gap-3",children:R.map((a,r)=>e.jsxs("button",{onClick:()=>U(a.prompt),className:"flex items-center gap-3 px-4 py-3.5 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-600/50 hover:border-gray-300 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-700 hover:shadow-md text-left transition-all group",children:[e.jsx("div",{className:"flex-shrink-0 p-2 bg-gray-100 dark:bg-gray-700 rounded-lg",children:e.jsx(a.icon,{className:"w-5 h-5 text-gray-500 dark:text-gray-300"})}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200 group-hover:text-gray-900 dark:group-hover:text-white transition-colors",children:a.label})]},r))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("textarea",{value:i,onChange:a=>f(a.target.value),onKeyDown:a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),V())},placeholder:s("dashboard.inputPlaceholder",{defaultValue:"描述你想要完成的任务..."}),className:"w-full px-5 py-4 text-base bg-transparent border-none outline-none resize-none text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500",rows:3}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-100 dark:border-gray-700",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>g(!j),className:"flex items-center gap-2 px-3 py-1.5 bg-gray-50 dark:bg-gray-700/50 rounded-lg border border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500 transition-colors",children:[e.jsx(h,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300 max-w-[150px] truncate",children:t?.name||s("dashboard.selectProject",{defaultValue:"选择项目"})}),e.jsx(ce,{className:"w-3.5 h-3.5 text-gray-400"})]}),j&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>g(!1)}),e.jsxs("div",{className:"absolute left-0 top-full mt-2 w-72 bg-white dark:bg-gray-800 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700 z-20 max-h-64 overflow-y-auto",children:[o.map(a=>e.jsxs("button",{onClick:()=>{u(a),g(!1)},className:`w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700/50 flex items-center gap-3 first:rounded-t-xl last:rounded-b-xl ${t?.id===a.id?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[e.jsx(h,{className:`w-4 h-4 flex-shrink-0 ${t?.id===a.id?"text-blue-500":"text-gray-400"}`}),e.jsx("span",{className:`text-sm truncate ${t?.id===a.id?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"}`,children:a.name})]},a.id)),o.length===0&&e.jsx("div",{className:"px-4 py-6 text-center text-gray-500 text-sm",children:s("dashboard.noProjects",{defaultValue:"暂无项目"})})]})]})]}),e.jsxs("button",{onClick:V,disabled:!i.trim()||!t||!m(t),className:"flex items-center gap-2 px-5 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 dark:disabled:bg-gray-600 text-white rounded-xl font-medium transition-colors disabled:cursor-not-allowed",children:[e.jsx("span",{children:s("dashboard.startChat",{defaultValue:"开始对话"})}),e.jsx(ue,{className:"w-4 h-4"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3 text-sm text-gray-400 dark:text-gray-500",children:[e.jsx(ge,{className:"w-4 h-4 animate-bounce"}),e.jsx("span",{children:s("dashboard.welcome.subtitle",{defaultValue:"选择一个项目,开始与 AI 协作完成任务"})})]})]}),e.jsxs("div",{className:"mt-10",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-4 text-center",children:s("dashboard.quickLinks.title",{defaultValue:"快捷入口"})}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:z.map((a,r)=>e.jsxs("button",{onClick:()=>A(a.path),className:"flex flex-col items-center gap-2 p-4 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-md transition-all group",children:[e.jsx("div",{className:`p-2.5 rounded-lg ${a.color}`,children:e.jsx(a.icon,{className:"w-5 h-5"})}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white transition-colors",children:a.label})]},r))})]}),c.length>0&&e.jsxs("div",{className:"mt-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:[s("dashboard.sessions.title",{defaultValue:"活跃会话"})," (",c.length,")"]}),e.jsxs("button",{onClick:L,disabled:w,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-50",children:[w?e.jsx(b,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(me,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:s("dashboard.sessions.clearAll",{defaultValue:"清除全部"})})]})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 divide-y divide-gray-100 dark:divide-gray-700 max-h-64 overflow-y-auto",children:c.map(a=>{const r=a.projectPath?a.projectPath.split("/").pop()||a.projectPath:"-",l=a.sessionTitle||`${s("dashboard.sessions.session",{defaultValue:"会话"})} ${a.sessionId.slice(0,8)}`;return e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${a.status==="confirmed"?"bg-green-500":"bg-amber-500"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 truncate font-medium",children:l}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 mt-0.5",children:[e.jsx("span",{className:"truncate max-w-[120px]",title:r,children:r}),e.jsx("span",{children:"•"}),e.jsx("span",{children:a.agentId}),a.modelId&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{className:"bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded",children:a.modelId.replace("claude-","").replace(/-\d{8}$/,"")})]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:K(a.idleTimeMs)}),a.heartbeatTimedOut&&e.jsx("span",{className:"text-amber-500 flex items-center gap-1",children:e.jsx(xe,{className:"w-3 h-3"})})]})]})]}),e.jsx("button",{onClick:()=>E(a.sessionId),disabled:N===a.sessionId,className:"p-1.5 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-50",title:s("dashboard.sessions.close",{defaultValue:"关闭会话"}),children:N===a.sessionId?e.jsx(b,{className:"w-4 h-4 animate-spin"}):e.jsx(he,{className:"w-4 h-4"})})]},a.sessionId)})})]})]})]})})};export{Ve as DashboardPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as o}from"./monaco-editor-DHKm5-VF.js";import{a as K,A as W}from"./agents-D9dWnZr0.js";import{a as de}from"./index-
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as o}from"./monaco-editor-DHKm5-VF.js";import{a as K,A as W}from"./agents-D9dWnZr0.js";import{a as de}from"./index-BLjehayc.js";import{u as ee}from"./tools-zTM46-tZ.js";import{X as T,as as te,at as Y,g as _,au as q,l as G,av as ae,aw as Z,Y as ce,I as xe,H as ge,k as he,ax as ye,x as me,ai as be,a8 as ue,E as pe,u as re,e as fe,ay as we}from"./ui-components-BsYwJvCF.js";const ve=({filePath:F,onClose:h})=>{const{t}=ee("components"),[p,A]=o.useState([]),[N,U]=o.useState(!0),[M,s]=o.useState(null),[d,V]=o.useState(""),[i,b]=o.useState(1),[P,$]=o.useState(!1),[v]=o.useState(50),[O,H]=o.useState(""),z=c=>{const n=c.split(`
|
|
2
2
|
`).filter(x=>x.trim()),g=[];for(const x of n){const u=[];let S="",D=!1;for(let L=0;L<x.length;L++){const R=x[L];R==='"'?D&&x[L+1]==='"'?(S+='"',L++):D=!D:R===","&&!D?(u.push(S.trim()),S=""):S+=R}u.push(S.trim()),g.push(u)}return g};o.useEffect(()=>{(async()=>{try{U(!0),s(null);const n=F.split(/[/\\]/).pop()||"unknown.csv";H(n);const g=await K(`${W}/files/read?path=${encodeURIComponent(F)}`);if(!g.ok)throw new Error(t("csvPreview.errors.loadFailed"));const x=await g.json(),u=z(x.content);A(u)}catch(n){console.error("Failed to load CSV:",n),s(n instanceof Error?n.message:t("csvPreview.errors.unknownError"))}finally{U(!1)}})()},[F,t]);const j=o.useMemo(()=>{if(!d)return p;const c=d.toLowerCase();return p.filter(n=>n.some(g=>g.toLowerCase().includes(c)))},[p,d]),y=Math.ceil(j.length/v),f=(i-1)*v,C=f+v,m=j.slice(f,C);o.useEffect(()=>{b(1)},[d]),o.useEffect(()=>{const c=n=>{n.key==="Escape"?h():n.key==="ArrowLeft"&&i>1?b(i-1):n.key==="ArrowRight"&&i<y?b(i+1):n.ctrlKey&&n.key==="f"&&(n.preventDefault(),document.getElementById("csv-search")?.focus())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[h,i,y]);const k=()=>{const c=p.map(x=>x.map(u=>u.includes(",")||u.includes('"')||u.includes(`
|
|
3
3
|
`)?`"${u.replace(/"/g,'""')}"`:u).join(",")).join(`
|
|
4
4
|
`),n=new Blob([c],{type:"text/csv;charset=utf-8;"}),g=document.createElement("a");g.href=URL.createObjectURL(n),g.download=O,g.click(),URL.revokeObjectURL(g.href)};if(N)return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 flex items-center space-x-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:t("csvPreview.loading")})]})});if(M)return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t("csvPreview.errors.title")}),e.jsx("button",{onClick:h,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(T,{className:"w-5 h-5"})})]}),e.jsx("p",{className:"text-red-600 dark:text-red-400",children:M}),e.jsx("button",{onClick:h,className:"mt-4 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",children:t("csvPreview.actions.close")})]})});const I=P?"fixed inset-4 bg-white dark:bg-gray-900 flex flex-col z-50":"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50";return e.jsx("div",{className:I,children:P?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:O}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t("csvPreview.info.rowCount",{count:j.length}),d&&` (${t("csvPreview.info.filtered")})`]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>$(!1),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("csvPreview.actions.minimize"),children:e.jsx(te,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:k,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("csvPreview.actions.download"),children:e.jsx(Y,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("csvPreview.actions.close"),children:e.jsx(T,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(_,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{id:"csv-search",type:"text",value:d,onChange:c=>V(c.target.value),placeholder:t("csvPreview.search.placeholder"),className:"w-full pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-800 dark:text-white dark:placeholder-gray-400"})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:m.length>0?e.jsx("div",{className:"min-w-full",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800 sticky top-0",children:e.jsx("tr",{children:m[0]?.map((c,n)=>e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-200 dark:border-gray-700",children:c||t("csvPreview.table.untitled")},n))})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700",children:m.slice(1).map((c,n)=>e.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800",children:c.map((g,x)=>e.jsx("td",{className:"px-4 py-2 text-sm text-gray-900 dark:text-white whitespace-nowrap border-b border-gray-100 dark:border-gray-800",children:g||"-"},x))},n))})]})}):e.jsx("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:t("csvPreview.empty.noData")})})}),y>1&&e.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("csvPreview.pagination.showing",{start:f+1,end:Math.min(C,j.length),total:j.length})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>b(Math.max(1,i-1)),disabled:i===1,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.previous"),children:e.jsx(q,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 px-3",children:[i," / ",y]}),e.jsx("button",{onClick:()=>b(Math.min(y,i+1)),disabled:i===y,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.next"),children:e.jsx(G,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})]})]})]}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-6xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:O}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t("csvPreview.info.rowCount",{count:j.length}),d&&` (${t("csvPreview.info.filtered")})`]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>$(!0),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("csvPreview.actions.maximize"),children:e.jsx(ae,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:k,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("csvPreview.actions.download"),children:e.jsx(Y,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("csvPreview.actions.close"),children:e.jsx(T,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"p-4 border-b border-gray-100 dark:border-gray-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(_,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{id:"csv-search",type:"text",value:d,onChange:c=>V(c.target.value),placeholder:t("csvPreview.search.placeholder"),className:"w-full pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:m.length>0?e.jsx("div",{className:"min-w-full",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800 sticky top-0",children:e.jsx("tr",{children:m[0]?.map((c,n)=>e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-200 dark:border-gray-700",children:c||t("csvPreview.table.untitled")},n))})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700",children:m.slice(1).map((c,n)=>e.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800",children:c.map((g,x)=>e.jsx("td",{className:"px-4 py-2 text-sm text-gray-900 dark:text-white whitespace-nowrap border-b border-gray-100 dark:border-gray-800",children:g||"-"},x))},n))})]})}):e.jsx("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:t("csvPreview.empty.noData")})})}),y>1&&e.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("csvPreview.pagination.showing",{start:f+1,end:Math.min(C,j.length),total:j.length})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>b(Math.max(1,i-1)),disabled:i===1,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.previous"),children:e.jsx(q,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 px-3",children:[i," / ",y]}),e.jsx("button",{onClick:()=>b(Math.min(y,i+1)),disabled:i===y,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.next"),children:e.jsx(G,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"px-4 py-2 text-xs text-gray-500 dark:text-gray-400 text-center border-t border-gray-100 dark:border-gray-700",children:t("csvPreview.instructions")})]})})},je=({filePath:F,onClose:h})=>{const{t}=ee("components"),[p,A]=o.useState([]),[N,U]=o.useState(!0),[M,s]=o.useState(null),[d,V]=o.useState(""),[i,b]=o.useState(1),[P,$]=o.useState(!1),[v]=o.useState(20),[O,H]=o.useState(""),[z,j]=o.useState(new Set),[y,f]=o.useState(null),C=a=>{const l=a.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{b as T,d as S,e as A,i as U,f as V}from"./index-BFYHztzB.js";import{u as L}from"./tools-zTM46-tZ.js";import{r as D,K as G,M,N as h,O as R,Q as W,G as _,R as F,U as O,V as c,Y as P,_ as H,$ as Q,e as z,a0 as b,a1 as y,a2 as K,j as u}from"./ui-components-BsYwJvCF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-D9dWnZr0.js";const te=()=>{const{t:s,i18n:d}=L("pages"),{isMobile:a}=T(),[n,p]=i.useState(()=>localStorage.getItem("theme")||"auto"),[j,g]=i.useState(d.language),{currentVersion:m,latestVersion:x,hasUpdate:k,forceCheck:N,isChecking:o,dismissUpdate:f,showUpdateNotification:v}=S(),{systemInfo:r,refetch:w}=A(),[l,C]=i.useState(U());i.useEffect(()=>{g(d.language)},[d.language]),i.useEffect(()=>{(()=>{n==="dark"?document.documentElement.classList.add("dark"):n==="light"?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")})(),localStorage.setItem("theme",n),window.dispatchEvent(new Event("themechange"))},[n]);const $=t=>{g(t),d.changeLanguage(t)},E=()=>{N(),w()},I=()=>{const t=!l;V(t),C(t)};return e.jsxs("div",{className:`${a?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsxs("h1",{className:`${a?"text-xl":"text-2xl"} font-bold text-gray-900 dark:text-white mb-2 flex items-center gap-2`,children:[e.jsx(D,{className:"w-6 h-6"}),s("settings.general.title")]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.general.description")})]}),v&&x&&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-4",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-800 rounded-full",children:e.jsx(G,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-blue-900 dark:text-blue-100",children:s("settings.systemInfo.updateAvailable")}),e.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300 mt-1",children:s("version.newVersionAvailable",{version:x})}),e.jsxs("div",{className:"mt-3 flex space-x-2",children:[e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700",children:[e.jsx(M,{className:"w-3 h-3 mr-1"}),s("settings.systemInfo.viewReleases")]}),e.jsx("button",{onClick:f,className:"px-3 py-1.5 text-blue-700 dark:text-blue-300 text-sm bg-blue-100 dark:bg-blue-800 hover:bg-blue-200 dark:hover:bg-blue-700 rounded-lg",children:s("version.dismiss")})]})]})]})})}),e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 ${a?"p-4":"p-6"}`,children:[e.jsxs("h2",{className:`${a?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2`,children:[e.jsx(h,{className:"w-5 h-5"}),s("settings.general.interfaceSettings")]}),e.jsxs("div",{className:`${a?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"block font-medium text-gray-900 dark:text-white mb-2",children:s("settings.general.theme.label")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:s("settings.general.theme.description")}),e.jsx("div",{className:`${a?"grid grid-cols-1 gap-2":"grid grid-cols-3 gap-3"}`,children:[{value:"auto",label:s("settings.general.theme.auto"),icon:h},{value:"light",label:s("settings.general.theme.light"),icon:R},{value:"dark",label:s("settings.general.theme.dark"),icon:W}].map(t=>e.jsxs("button",{onClick:()=>p(t.value),className:`${a?"p-3":"p-4"} border-2 rounded-lg flex items-center ${a?"flex-row space-x-3":"flex-col space-y-2"} transition-all ${n===t.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx(t.icon,{className:`${a?"w-5 h-5":"w-6 h-6"}`}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block font-medium text-gray-900 dark:text-white mb-2 flex items-center space-x-2",children:[e.jsx(_,{className:`${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:s("settings.general.language.label")})]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:s("settings.general.language.description")}),e.jsx("div",{className:`${a?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-3"}`,children:[{value:"zh-CN",label:"中文简体",flag:"🇨🇳"},{value:"en-US",label:"English",flag:"🇺🇸"}].map(t=>e.jsxs("button",{onClick:()=>$(t.value),className:`${a?"p-3":"p-4"} border-2 rounded-lg flex items-center space-x-3 transition-all ${j===t.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx("span",{className:`${a?"text-xl":"text-2xl"}`,children:t.flag}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]},t.value))})]})]})]}),e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 ${a?"p-4":"p-6"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:`${a?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white flex items-center gap-2`,children:[e.jsx(F,{className:"w-5 h-5"}),s("settings.systemInfo.title")]}),e.jsxs("button",{onClick:E,disabled:o,className:"inline-flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700 disabled:opacity-50",children:[e.jsx(O,{className:`w-3 h-3 mr-1 ${o?"animate-spin":""}`}),s("settings.systemInfo.checkUpdate")]})]}),e.jsxs("div",{className:"space-y-4",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.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(c,{className:"w-4 h-4"}),s("settings.systemInfo.currentVersion")]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"font-mono text-gray-900 dark:text-white",children:["v",m||r?.app.version||"-"]}),!k&&m&&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(P,{className:"w-3 h-3 mr-1"}),s("settings.systemInfo.upToDate")]})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(H,{className:"w-4 h-4"}),"Node.js"]}),e.jsx("p",{className:"font-mono text-gray-900 dark:text-white",children:r?.runtime.nodeVersion||"-"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-1",children:s("settings.systemInfo.platform")}),e.jsxs("p",{className:"text-gray-900 dark:text-white capitalize",children:[r?.runtime.platform||"-"," (",r?.runtime.arch||"-",")"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("a",{href:r?.links.github||"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(Q,{className:"w-4 h-4 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"GitHub"})]}),e.jsxs("a",{href:r?.links.releases||"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(c,{className:"w-4 h-4 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"Releases"})]}),e.jsxs("a",{href:r?.links.changelog||"https://github.com/okguitar/agentstudio/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(z,{className:"w-4 h-4 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"Changelog"})]}),e.jsxs("a",{href:r?.links.npm||"https://www.npmjs.com/package/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(c,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"npm"})]})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsxs("div",{className:`${a?"p-4":"p-6"}`,children:[e.jsxs("h2",{className:`${a?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2`,children:[e.jsx(b,{className:"w-5 h-5"}),s("settings.telemetry.title","Telemetry & Analytics")]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${l?"bg-blue-100 dark:bg-blue-900/30":"bg-gray-100 dark:bg-gray-700"}`,children:e.jsx(b,{className:`w-5 h-5 ${l?"text-blue-600 dark:text-blue-400":"text-gray-500"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:s("settings.telemetry.enableTelemetry","Enable Anonymous Telemetry")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.telemetry.enableDescription","Help improve AgentStudio by sharing anonymous usage data")})]})]}),e.jsx("button",{onClick:I,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${l?"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 ${l?"translate-x-6":"translate-x-1"}`})})]})]}),e.jsx("div",{className:`px-4 py-2 border-t ${l?"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800":"bg-gray-50 dark:bg-gray-700/50 border-gray-200 dark:border-gray-700"}`,children:e.jsx("div",{className:"flex items-center gap-2 text-sm",children:l?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-green-700 dark:text-green-400",children:s("settings.telemetry.statusEnabled","Telemetry is enabled. Thank you for helping improve AgentStudio!")})]}):e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("settings.telemetry.statusDisabled","Telemetry is disabled. No data is being collected.")})]})})}),e.jsxs("details",{className:"border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("summary",{className:"px-4 py-3 cursor-pointer text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4"}),s("settings.telemetry.privacyDetails","Privacy & Data Collection Details")]}),e.jsxs("div",{className:"px-4 pb-4 space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2 flex items-center gap-2 text-sm",children:[e.jsx(y,{className:"w-4 h-4 text-green-500"}),s("settings.telemetry.whatWeCollect","What We Collect")]}),e.jsxs("ul",{className:"space-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.installId","Anonymous Installation ID")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.version","App Version & OS")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.features","Feature Usage")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.errors","Error Reports")]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2 flex items-center gap-2 text-sm",children:[e.jsx(u,{className:"w-4 h-4 text-red-500"}),s("settings.telemetry.whatWeNeverCollect","What We Never Collect")]}),e.jsxs("ul",{className:"space-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.files","File contents, code, or project data")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.keys","API keys, passwords, or credentials")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.pii","Personal identifying information")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.conversations","Chat conversations or AI responses")]})]})]})]})]})]})]})};export{te as GeneralSettingsPage};
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{b as T,d as S,e as A,i as U,f as V}from"./index-BLjehayc.js";import{u as L}from"./tools-zTM46-tZ.js";import{r as D,K as G,M,N as h,O as R,Q as W,G as _,R as F,U as O,V as c,Y as P,_ as H,$ as Q,e as z,a0 as b,a1 as y,a2 as K,j as u}from"./ui-components-BsYwJvCF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-D9dWnZr0.js";const te=()=>{const{t:s,i18n:d}=L("pages"),{isMobile:a}=T(),[n,p]=i.useState(()=>localStorage.getItem("theme")||"auto"),[j,g]=i.useState(d.language),{currentVersion:m,latestVersion:x,hasUpdate:k,forceCheck:N,isChecking:o,dismissUpdate:f,showUpdateNotification:v}=S(),{systemInfo:r,refetch:w}=A(),[l,C]=i.useState(U());i.useEffect(()=>{g(d.language)},[d.language]),i.useEffect(()=>{(()=>{n==="dark"?document.documentElement.classList.add("dark"):n==="light"?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")})(),localStorage.setItem("theme",n),window.dispatchEvent(new Event("themechange"))},[n]);const $=t=>{g(t),d.changeLanguage(t)},E=()=>{N(),w()},I=()=>{const t=!l;V(t),C(t)};return e.jsxs("div",{className:`${a?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsxs("h1",{className:`${a?"text-xl":"text-2xl"} font-bold text-gray-900 dark:text-white mb-2 flex items-center gap-2`,children:[e.jsx(D,{className:"w-6 h-6"}),s("settings.general.title")]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.general.description")})]}),v&&x&&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-4",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-800 rounded-full",children:e.jsx(G,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-blue-900 dark:text-blue-100",children:s("settings.systemInfo.updateAvailable")}),e.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300 mt-1",children:s("version.newVersionAvailable",{version:x})}),e.jsxs("div",{className:"mt-3 flex space-x-2",children:[e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700",children:[e.jsx(M,{className:"w-3 h-3 mr-1"}),s("settings.systemInfo.viewReleases")]}),e.jsx("button",{onClick:f,className:"px-3 py-1.5 text-blue-700 dark:text-blue-300 text-sm bg-blue-100 dark:bg-blue-800 hover:bg-blue-200 dark:hover:bg-blue-700 rounded-lg",children:s("version.dismiss")})]})]})]})})}),e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 ${a?"p-4":"p-6"}`,children:[e.jsxs("h2",{className:`${a?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2`,children:[e.jsx(h,{className:"w-5 h-5"}),s("settings.general.interfaceSettings")]}),e.jsxs("div",{className:`${a?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"block font-medium text-gray-900 dark:text-white mb-2",children:s("settings.general.theme.label")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:s("settings.general.theme.description")}),e.jsx("div",{className:`${a?"grid grid-cols-1 gap-2":"grid grid-cols-3 gap-3"}`,children:[{value:"auto",label:s("settings.general.theme.auto"),icon:h},{value:"light",label:s("settings.general.theme.light"),icon:R},{value:"dark",label:s("settings.general.theme.dark"),icon:W}].map(t=>e.jsxs("button",{onClick:()=>p(t.value),className:`${a?"p-3":"p-4"} border-2 rounded-lg flex items-center ${a?"flex-row space-x-3":"flex-col space-y-2"} transition-all ${n===t.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx(t.icon,{className:`${a?"w-5 h-5":"w-6 h-6"}`}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block font-medium text-gray-900 dark:text-white mb-2 flex items-center space-x-2",children:[e.jsx(_,{className:`${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:s("settings.general.language.label")})]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:s("settings.general.language.description")}),e.jsx("div",{className:`${a?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-3"}`,children:[{value:"zh-CN",label:"中文简体",flag:"🇨🇳"},{value:"en-US",label:"English",flag:"🇺🇸"}].map(t=>e.jsxs("button",{onClick:()=>$(t.value),className:`${a?"p-3":"p-4"} border-2 rounded-lg flex items-center space-x-3 transition-all ${j===t.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx("span",{className:`${a?"text-xl":"text-2xl"}`,children:t.flag}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]},t.value))})]})]})]}),e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 ${a?"p-4":"p-6"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:`${a?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white flex items-center gap-2`,children:[e.jsx(F,{className:"w-5 h-5"}),s("settings.systemInfo.title")]}),e.jsxs("button",{onClick:E,disabled:o,className:"inline-flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700 disabled:opacity-50",children:[e.jsx(O,{className:`w-3 h-3 mr-1 ${o?"animate-spin":""}`}),s("settings.systemInfo.checkUpdate")]})]}),e.jsxs("div",{className:"space-y-4",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.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(c,{className:"w-4 h-4"}),s("settings.systemInfo.currentVersion")]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"font-mono text-gray-900 dark:text-white",children:["v",m||r?.app.version||"-"]}),!k&&m&&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(P,{className:"w-3 h-3 mr-1"}),s("settings.systemInfo.upToDate")]})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(H,{className:"w-4 h-4"}),"Node.js"]}),e.jsx("p",{className:"font-mono text-gray-900 dark:text-white",children:r?.runtime.nodeVersion||"-"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-1",children:s("settings.systemInfo.platform")}),e.jsxs("p",{className:"text-gray-900 dark:text-white capitalize",children:[r?.runtime.platform||"-"," (",r?.runtime.arch||"-",")"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("a",{href:r?.links.github||"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(Q,{className:"w-4 h-4 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"GitHub"})]}),e.jsxs("a",{href:r?.links.releases||"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(c,{className:"w-4 h-4 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"Releases"})]}),e.jsxs("a",{href:r?.links.changelog||"https://github.com/okguitar/agentstudio/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(z,{className:"w-4 h-4 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"Changelog"})]}),e.jsxs("a",{href:r?.links.npm||"https://www.npmjs.com/package/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(c,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"npm"})]})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsxs("div",{className:`${a?"p-4":"p-6"}`,children:[e.jsxs("h2",{className:`${a?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2`,children:[e.jsx(b,{className:"w-5 h-5"}),s("settings.telemetry.title","Telemetry & Analytics")]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${l?"bg-blue-100 dark:bg-blue-900/30":"bg-gray-100 dark:bg-gray-700"}`,children:e.jsx(b,{className:`w-5 h-5 ${l?"text-blue-600 dark:text-blue-400":"text-gray-500"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:s("settings.telemetry.enableTelemetry","Enable Anonymous Telemetry")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.telemetry.enableDescription","Help improve AgentStudio by sharing anonymous usage data")})]})]}),e.jsx("button",{onClick:I,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${l?"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 ${l?"translate-x-6":"translate-x-1"}`})})]})]}),e.jsx("div",{className:`px-4 py-2 border-t ${l?"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800":"bg-gray-50 dark:bg-gray-700/50 border-gray-200 dark:border-gray-700"}`,children:e.jsx("div",{className:"flex items-center gap-2 text-sm",children:l?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-green-700 dark:text-green-400",children:s("settings.telemetry.statusEnabled","Telemetry is enabled. Thank you for helping improve AgentStudio!")})]}):e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("settings.telemetry.statusDisabled","Telemetry is disabled. No data is being collected.")})]})})}),e.jsxs("details",{className:"border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("summary",{className:"px-4 py-3 cursor-pointer text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4"}),s("settings.telemetry.privacyDetails","Privacy & Data Collection Details")]}),e.jsxs("div",{className:"px-4 pb-4 space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2 flex items-center gap-2 text-sm",children:[e.jsx(y,{className:"w-4 h-4 text-green-500"}),s("settings.telemetry.whatWeCollect","What We Collect")]}),e.jsxs("ul",{className:"space-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.installId","Anonymous Installation ID")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.version","App Version & OS")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.features","Feature Usage")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.errors","Error Reports")]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2 flex items-center gap-2 text-sm",children:[e.jsx(u,{className:"w-4 h-4 text-red-500"}),s("settings.telemetry.whatWeNeverCollect","What We Never Collect")]}),e.jsxs("ul",{className:"space-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.files","File contents, code, or project data")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.keys","API keys, passwords, or credentials")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.pii","Personal identifying information")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.conversations","Chat conversations or AI responses")]})]})]})]})]})]})]})};export{te as GeneralSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{u}from"./tools-zTM46-tZ.js";import{aj as N,e as k,$ as f,G as g,ak as w,Z as o,Y as t,I as h,N as v,a2 as i,al as C,f as A,o as p,m as S,am as F,t as E,X as s}from"./ui-components-BsYwJvCF.js";import{L as y}from"./index-BFYHztzB.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-D9dWnZr0.js";const G=()=>{const{t:a,i18n:r}=u("pages"),[x,c]=d.useState(!1),[j,n]=d.useState(!1),b=()=>{const l=r.language==="zh-CN"?"en-US":"zh-CN";r.changeLanguage(l)},m=()=>{navigator.clipboard.writeText("npm install -g agentstudio && agentstudio start"),c(!0),setTimeout(()=>c(!1),2e3)};return d.useEffect(()=>{document.title=a("landing.pageTitle");const l=document.querySelector('meta[name="description"]');l&&l.setAttribute("content",a("landing.metaDescription"))},[a]),e.jsxs("div",{className:"min-h-screen bg-white dark:bg-gray-950",children:[e.jsx("nav",{className:"bg-white/90 dark:bg-gray-950/90 backdrop-blur-sm border-b border-gray-100 dark:border-gray-800 sticky top-0 z-50",children:e.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex justify-between items-center h-16",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"AgentStudio"})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("button",{onClick:()=>n(!0),className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 transition-colors",children:[e.jsx(N,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:a("landing.nav.wechat")||"微信群"})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(k,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:a("landing.nav.docs")})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(f,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"GitHub"})]}),e.jsxs("button",{onClick:b,className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",title:r.language==="zh-CN"?"Switch to English":"切换到中文",children:[e.jsx(g,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:r.language==="zh-CN"?"EN":"中文"})]}),e.jsxs(y,{to:"/dashboard",className:"inline-flex items-center px-4 py-2 bg-gray-900 dark:bg-white hover:bg-gray-800 dark:hover:bg-gray-100 text-white dark:text-gray-900 font-medium rounded-lg transition-colors duration-200",children:[a("landing.nav.enterWorkspace"),e.jsx(w,{className:"ml-2 w-4 h-4"})]})]})]})})}),e.jsx("section",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800 text-sm text-gray-600 dark:text-gray-400 mb-6",children:[e.jsx(o,{className:"w-4 h-4 mr-2 text-amber-500"}),a("landing.hero.badge")]}),e.jsx("h1",{className:"text-4xl sm:text-5xl lg:text-6xl font-bold text-gray-900 dark:text-white mb-6 leading-tight",children:a("landing.hero.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-4 max-w-2xl mx-auto",children:a("landing.hero.subtitle")}),e.jsx("p",{className:"text-lg text-gray-500 dark:text-gray-500 mb-8 max-w-2xl mx-auto",children:a("landing.hero.description")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:a("landing.hero.installHint")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:m,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:x?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:a("landing.preview.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a("landing.preview.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-chat.png",alt:a("landing.preview.chatAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.chatCaption")})]}),e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-mcp.png",alt:a("landing.preview.mcpAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.mcpCaption")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.features.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.features.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(v,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.localWorkspace.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(g,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.webExperience.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(o,{className:"w-5 h-5 mr-2 mt-0.5 text-amber-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(C,{className:"w-5 h-5 mr-2 mt-0.5 text-purple-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(A,{className:"w-5 h-5 mr-2 mt-0.5 text-blue-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(p,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.sdkFeatures.title")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:"MCP"}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.skills")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.commands")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.plugins")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.memory")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.subagent")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.multiModel")})]}),e.jsx("p",{className:"mt-4 text-sm text-gray-500 dark:text-gray-500",children:a("landing.features.sdkFeatures.anthropicCompat")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 text-sm mb-4",children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),a("landing.scheduler.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.scheduler.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 mb-8",children:a("landing.scheduler.description")})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-2xl p-6 border border-gray-100 dark:border-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.scheduler.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📊"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🔍"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📝"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario3.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📈"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario4.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario4.desc")})]})]})]})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1 bg-white dark:bg-gray-800 rounded-2xl p-6 border border-gray-100 dark:border-gray-700",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.a2a.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🤵"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"💻"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📱"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario3.desc")})]})]})]})]}),e.jsxs("div",{className:"order-1 lg:order-2",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 text-sm mb-4",children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),a("landing.a2a.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.a2a.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.a2a.description")})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 text-sm mb-4",children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),a("landing.customAgent.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.customAgent.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.customAgent.description")})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📊"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example1")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🤵"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example2")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📝"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example3")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🔍"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example4")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.comparison.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.comparison.subtitle")})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-100 dark:border-gray-700 overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-700",children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400",children:a("landing.comparison.dimension")}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-semibold text-gray-900 dark:text-white",children:"AgentStudio"}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-medium text-gray-500 dark:text-gray-400",children:"Claude Code"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:[e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.interface")}),e.jsxs("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:["Web ",a("landing.comparison.webInterface")]}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.cli")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.targetUsers")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.everyone")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.developers")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.toolDisplay")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.visual")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.textOnly")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.fileBrowser")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.agentCustom")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.scheduler")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.a2a")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.mobileAccess")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-amber-600 dark:text-amber-400",children:a("landing.comparison.beta")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]})]})]})})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-6",children:a("landing.cta.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-8",children:a("landing.cta.subtitle")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:m,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:x?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center px-8 py-4 bg-white dark:bg-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 font-semibold rounded-xl border border-gray-200 dark:border-gray-700 transition-all duration-200",children:[e.jsx(p,{className:"mr-2 w-5 h-5"}),"GitHub"]})]})}),e.jsx("footer",{className:"bg-gray-900 text-gray-300 py-12 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-8",children:[e.jsxs("div",{className:"col-span-1 md:col-span-2",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-white",children:"AgentStudio"})]}),e.jsx("p",{className:"text-gray-400 mb-4 max-w-md",children:a("landing.footer.description")}),e.jsx("div",{className:"text-sm text-gray-500",children:a("landing.footer.copyright")})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.product")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx(y,{to:"/dashboard",className:"hover:text-white transition-colors",children:a("landing.footer.workspace")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.sourceCode")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.releases")})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.support")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.documentation")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/issues",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.issues")})}),e.jsx("li",{children:e.jsx("button",{onClick:()=>n(!0),className:"hover:text-white transition-colors text-left w-full",children:a("landing.footer.wechat")||"微信群"})})]})]})]})})}),j&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 relative",children:[e.jsx("button",{onClick:()=>n(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors",children:e.jsx(s,{className:"w-5 h-5"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:a("landing.wechat.title")||"加入微信群"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/wechat-qr-code.png",alt:"WeChat QR Code",className:"w-64 h-64 object-contain border border-gray-200 dark:border-gray-700 rounded-lg"})}),e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:e.jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 text-center",children:[a("landing.wechat.fallback")||"二维码失效?请添加微信号:",e.jsx("span",{className:"font-mono font-semibold ml-1",children:a("landing.wechat.wechatId")||"your-wechat-id"})]})}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center",children:a("landing.wechat.tip")||"扫码或添加微信号,即可加入交流群"})]})]})})]})};export{G as default};
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{u}from"./tools-zTM46-tZ.js";import{aj as N,e as k,$ as f,G as g,ak as w,Z as o,Y as t,I as h,N as v,a2 as i,al as C,f as A,o as p,m as S,am as F,t as E,X as s}from"./ui-components-BsYwJvCF.js";import{L as y}from"./index-BLjehayc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-D9dWnZr0.js";const G=()=>{const{t:a,i18n:r}=u("pages"),[x,c]=d.useState(!1),[j,n]=d.useState(!1),b=()=>{const l=r.language==="zh-CN"?"en-US":"zh-CN";r.changeLanguage(l)},m=()=>{navigator.clipboard.writeText("npm install -g agentstudio && agentstudio start"),c(!0),setTimeout(()=>c(!1),2e3)};return d.useEffect(()=>{document.title=a("landing.pageTitle");const l=document.querySelector('meta[name="description"]');l&&l.setAttribute("content",a("landing.metaDescription"))},[a]),e.jsxs("div",{className:"min-h-screen bg-white dark:bg-gray-950",children:[e.jsx("nav",{className:"bg-white/90 dark:bg-gray-950/90 backdrop-blur-sm border-b border-gray-100 dark:border-gray-800 sticky top-0 z-50",children:e.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex justify-between items-center h-16",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"AgentStudio"})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("button",{onClick:()=>n(!0),className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 transition-colors",children:[e.jsx(N,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:a("landing.nav.wechat")||"微信群"})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(k,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:a("landing.nav.docs")})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(f,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"GitHub"})]}),e.jsxs("button",{onClick:b,className:"inline-flex items-center text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",title:r.language==="zh-CN"?"Switch to English":"切换到中文",children:[e.jsx(g,{className:"w-5 h-5 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:r.language==="zh-CN"?"EN":"中文"})]}),e.jsxs(y,{to:"/dashboard",className:"inline-flex items-center px-4 py-2 bg-gray-900 dark:bg-white hover:bg-gray-800 dark:hover:bg-gray-100 text-white dark:text-gray-900 font-medium rounded-lg transition-colors duration-200",children:[a("landing.nav.enterWorkspace"),e.jsx(w,{className:"ml-2 w-4 h-4"})]})]})]})})}),e.jsx("section",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800 text-sm text-gray-600 dark:text-gray-400 mb-6",children:[e.jsx(o,{className:"w-4 h-4 mr-2 text-amber-500"}),a("landing.hero.badge")]}),e.jsx("h1",{className:"text-4xl sm:text-5xl lg:text-6xl font-bold text-gray-900 dark:text-white mb-6 leading-tight",children:a("landing.hero.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-4 max-w-2xl mx-auto",children:a("landing.hero.subtitle")}),e.jsx("p",{className:"text-lg text-gray-500 dark:text-gray-500 mb-8 max-w-2xl mx-auto",children:a("landing.hero.description")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:a("landing.hero.installHint")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:m,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:x?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:a("landing.preview.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a("landing.preview.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-chat.png",alt:a("landing.preview.chatAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.chatCaption")})]}),e.jsxs("div",{className:"group",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 overflow-hidden shadow-lg hover:shadow-xl transition-shadow",children:e.jsx("img",{src:"/screenshot-mcp.png",alt:a("landing.preview.mcpAlt"),className:"w-full h-auto"})}),e.jsx("p",{className:"text-center mt-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.preview.mcpCaption")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.features.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.features.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(v,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.localWorkspace.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(i,{className:"w-5 h-5 mr-2 mt-0.5 text-green-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.localWorkspace.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(g,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.webExperience.title")}),e.jsxs("ul",{className:"space-y-2 text-gray-600 dark:text-gray-400",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx(o,{className:"w-5 h-5 mr-2 mt-0.5 text-amber-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point1")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(C,{className:"w-5 h-5 mr-2 mt-0.5 text-purple-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point2")})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx(A,{className:"w-5 h-5 mr-2 mt-0.5 text-blue-500 flex-shrink-0"}),e.jsx("span",{children:a("landing.features.webExperience.point3")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-2xl border border-gray-100 dark:border-gray-700",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center mb-6",children:e.jsx(p,{className:"w-6 h-6 text-gray-700 dark:text-gray-300"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-3",children:a("landing.features.sdkFeatures.title")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:"MCP"}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.skills")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.commands")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.plugins")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.memory")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.subagent")}),e.jsx("span",{className:"px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-full text-sm",children:a("landing.features.sdkFeatures.multiModel")})]}),e.jsx("p",{className:"mt-4 text-sm text-gray-500 dark:text-gray-500",children:a("landing.features.sdkFeatures.anthropicCompat")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 text-sm mb-4",children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),a("landing.scheduler.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.scheduler.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 mb-8",children:a("landing.scheduler.description")})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-2xl p-6 border border-gray-100 dark:border-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.scheduler.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📊"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🔍"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📝"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario3.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📈"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.scheduler.scenario4.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.scheduler.scenario4.desc")})]})]})]})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1 bg-white dark:bg-gray-800 rounded-2xl p-6 border border-gray-100 dark:border-gray-700",children:[e.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4",children:a("landing.a2a.scenariosTitle")}),e.jsxs("ul",{className:"space-y-4",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"🤵"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario1.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario1.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"💻"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario2.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario2.desc")})]})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"text-2xl mr-3",children:"📱"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.a2a.scenario3.title")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-sm",children:a("landing.a2a.scenario3.desc")})]})]})]})]}),e.jsxs("div",{className:"order-1 lg:order-2",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 text-sm mb-4",children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),a("landing.a2a.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.a2a.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.a2a.description")})]})]})})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsxs("div",{className:"inline-flex items-center px-3 py-1 rounded-full bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 text-sm mb-4",children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),a("landing.customAgent.badge")]}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.customAgent.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto",children:a("landing.customAgent.description")})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📊"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example1")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🤵"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example2")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"📝"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example3")})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-xl border border-gray-100 dark:border-gray-700 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🔍"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a("landing.customAgent.example4")})]})]})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:a("landing.comparison.title")}),e.jsx("p",{className:"text-lg text-gray-600 dark:text-gray-400",children:a("landing.comparison.subtitle")})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-2xl border border-gray-100 dark:border-gray-700 overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-700",children:[e.jsx("th",{className:"px-6 py-4 text-left text-sm font-medium text-gray-500 dark:text-gray-400",children:a("landing.comparison.dimension")}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-semibold text-gray-900 dark:text-white",children:"AgentStudio"}),e.jsx("th",{className:"px-6 py-4 text-center text-sm font-medium text-gray-500 dark:text-gray-400",children:"Claude Code"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:[e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.interface")}),e.jsxs("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:["Web ",a("landing.comparison.webInterface")]}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.cli")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.targetUsers")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.everyone")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.developers")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.toolDisplay")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-900 dark:text-white",children:a("landing.comparison.visual")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-gray-500 dark:text-gray-500",children:a("landing.comparison.textOnly")})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.fileBrowser")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.agentCustom")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.scheduler")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.a2a")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(t,{className:"w-5 h-5 text-green-500 mx-auto"})}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 text-sm text-gray-600 dark:text-gray-400",children:a("landing.comparison.mobileAccess")}),e.jsx("td",{className:"px-6 py-4 text-center text-sm text-amber-600 dark:text-amber-400",children:a("landing.comparison.beta")}),e.jsx("td",{className:"px-6 py-4 text-center",children:e.jsx(s,{className:"w-5 h-5 text-gray-300 dark:text-gray-600 mx-auto"})})]})]})]})})]})}),e.jsx("section",{className:"py-20 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-6",children:a("landing.cta.title")}),e.jsx("p",{className:"text-xl text-gray-600 dark:text-gray-400 mb-8",children:a("landing.cta.subtitle")}),e.jsx("div",{className:"bg-gray-900 dark:bg-gray-800 rounded-xl p-4 max-w-xl mx-auto mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("code",{className:"text-green-400 text-sm sm:text-base font-mono flex-1",children:"npm install -g agentstudio && agentstudio start"}),e.jsx("button",{onClick:m,className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition-colors flex items-center gap-1.5 text-sm flex-shrink-0 min-w-[72px] justify-center",title:a("landing.hero.copyCommand"),children:x?e.jsx(t,{className:"w-4 h-4 text-green-400"}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4"}),e.jsx("span",{children:a("landing.hero.copy")})]})})]})}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center px-8 py-4 bg-white dark:bg-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 font-semibold rounded-xl border border-gray-200 dark:border-gray-700 transition-all duration-200",children:[e.jsx(p,{className:"mr-2 w-5 h-5"}),"GitHub"]})]})}),e.jsx("footer",{className:"bg-gray-900 text-gray-300 py-12 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-8",children:[e.jsxs("div",{className:"col-span-1 md:col-span-2",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-semibold text-white",children:"AgentStudio"})]}),e.jsx("p",{className:"text-gray-400 mb-4 max-w-md",children:a("landing.footer.description")}),e.jsx("div",{className:"text-sm text-gray-500",children:a("landing.footer.copyright")})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.product")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx(y,{to:"/dashboard",className:"hover:text-white transition-colors",children:a("landing.footer.workspace")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.sourceCode")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.releases")})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:a("landing.footer.support")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/blob/main/docs/USER_MANUAL.md",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.documentation")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/issues",target:"_blank",rel:"noopener noreferrer",className:"hover:text-white transition-colors",children:a("landing.footer.issues")})}),e.jsx("li",{children:e.jsx("button",{onClick:()=>n(!0),className:"hover:text-white transition-colors text-left w-full",children:a("landing.footer.wechat")||"微信群"})})]})]})]})})}),j&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full p-6 relative",children:[e.jsx("button",{onClick:()=>n(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors",children:e.jsx(s,{className:"w-5 h-5"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:a("landing.wechat.title")||"加入微信群"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/wechat-qr-code.png",alt:"WeChat QR Code",className:"w-64 h-64 object-contain border border-gray-200 dark:border-gray-700 rounded-lg"})}),e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:e.jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 text-center",children:[a("landing.wechat.fallback")||"二维码失效?请添加微信号:",e.jsx("span",{className:"font-mono font-semibold ml-1",children:a("landing.wechat.wechatId")||"your-wechat-id"})]})}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 text-center",children:a("landing.wechat.tip")||"扫码或添加微信号,即可加入交流群"})]})]})})]})};export{G as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{j as ae,k as ne,l as le,r as ie}from"./index-
|
|
1
|
+
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{j as ae,k as ne,l as le,r as ie}from"./index-BLjehayc.js";import{j as M,H as $,k as I,C as J,I as de,_ as P,aq as U,r as F,ar as oe,n as ce,y as xe,v as ue}from"./ui-components-BsYwJvCF.js";import{u as ge}from"./tools-zTM46-tZ.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-D9dWnZr0.js";const B=({error:s,title:m="Error occurred",showDetails:f=!0})=>{const[h,p]=d.useState(!1),[u,g]=d.useState(!1),a=(()=>{if(s instanceof Error){const r=s,n={stack:s.stack||"",name:s.name};return r.requestUrl&&(n.requestUrl=r.requestUrl),r.requestMethod&&(n.requestMethod=r.requestMethod),r.requestBody&&(n.requestBody=r.requestBody),r.statusCode&&(n.statusCode=r.statusCode),r.statusText&&(n.statusText=r.statusText),r.url&&(n.apiBaseUrl=r.url),r.timestamp&&(n.timestamp=new Date(r.timestamp).toISOString()),r.isNetworkError&&(n.isNetworkError=!0),r.isTimeout&&(n.isTimeout=!0),r.isAbortError&&(n.isAbortError=!0),r.originalError&&(n.originalError=r.originalError),r.type&&(n.errorType=r.type),{message:s.message,details:JSON.stringify(n,null,2),raw:s}}else if(typeof s=="object"&&s!==null){const r=s,n={};return Object.keys(r).forEach(b=>{b!=="message"&&(n[b]=r[b])}),{message:r.message||JSON.stringify(s),details:Object.keys(n).length>0?JSON.stringify(n,null,2):r.stack||JSON.stringify(s,null,2),raw:s}}else return{message:String(s),details:"",raw:String(s)}})(),c=f&&(a.details||a.raw),w=async()=>{const r=a.details?`${m}: ${a.message}
|
|
2
2
|
|
|
3
3
|
Details:
|
|
4
4
|
${a.details}`:`${m}: ${a.message}`;try{await navigator.clipboard.writeText(r),g(!0),setTimeout(()=>g(!1),2e3)}catch(n){console.error("Failed to copy error details:",n)}};return e.jsx("div",{className:"p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(M,{className:"w-4 h-4 text-red-600 dark:text-red-400 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-medium",children:a.message}),typeof a.raw=="object"&&a.raw&&"requestUrl"in a.raw&&e.jsxs("div",{className:"mt-1 text-xs text-red-500 dark:text-red-400",children:["requestUrl"in a.raw&&a.raw.requestUrl&&e.jsxs("span",{children:["Request: ",("requestMethod"in a.raw?a.raw.requestMethod:"POST")||"POST"," ",a.raw.requestUrl]}),"statusCode"in a.raw&&a.raw.statusCode&&e.jsxs("span",{className:"ml-2",children:["Status: ",a.raw.statusCode]}),"isNetworkError"in a.raw&&a.raw.isNetworkError&&e.jsx("span",{className:"ml-2",children:"• Network Error"}),"isTimeout"in a.raw&&a.raw.isTimeout&&e.jsx("span",{className:"ml-2",children:"• Request Timeout"})]}),c&&e.jsx("button",{onClick:r=>{r.preventDefault(),r.stopPropagation(),p(!h)},className:"flex items-center space-x-1 mt-2 text-xs text-red-500 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors",type:"button",children:h?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-3 h-3"}),e.jsx("span",{children:"Hide Details"})]}):e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-3 h-3"}),e.jsx("span",{children:"Show Details"})]})}),e.jsx("div",{className:`overflow-hidden transition-all duration-200 ease-in-out ${h&&c?"max-h-96 opacity-100 mt-3":"max-h-0 opacity-0"}`,children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"p-2 bg-red-100 dark:bg-red-900/40 rounded border border-red-200 dark:border-red-700",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-red-700 dark:text-red-300",children:"Technical Details:"}),e.jsx("button",{onClick:r=>{r.preventDefault(),r.stopPropagation(),w()},className:"flex items-center space-x-1 px-2 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 transition-colors",title:"Copy error details",type:"button",children:u?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"w-3 h-3"}),e.jsx("span",{children:"Copied!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"w-3 h-3"}),e.jsx("span",{children:"Copy"})]})})]}),e.jsx("pre",{className:"text-xs text-red-800 dark:text-red-200 whitespace-pre-wrap break-words overflow-x-auto font-mono max-h-40 overflow-y-auto",children:typeof a.details=="string"?a.details:JSON.stringify(a.details)})]}),e.jsxs("div",{className:"text-xs text-red-500 dark:text-red-400",children:["Time: ",new Date().toLocaleString()]}),e.jsxs("div",{className:"text-xs text-red-500 dark:text-red-400",children:["Browser: ",navigator.userAgent.split(" ")[0]," | URL: ",window.location.href]})]})})]})]})})};function je(){const{t:s}=ge("pages"),[m,f]=d.useState(""),{login:h,loginWithoutPassword:p,isLoading:u,error:g,checkPasswordRequired:q}=ae(),{services:a,currentService:c,switchService:w,addService:r,updateService:n,removeService:b}=ne(),H=le(),[y,G]=d.useState(!1),[W,j]=d.useState(!1),[X,N]=d.useState(null),[o,x]=d.useState({name:"",url:""}),[E,T]=d.useState(null),[A,O]=d.useState({}),[_,k]=d.useState(!0),[R,v]=d.useState(!0),[z,D]=d.useState(!1),S=H.state?.from?.pathname||"/";d.useEffect(()=>{let t=!0;return(async()=>{if(!c){k(!1);return}k(!0),D(!1);try{const i=await q();if(!t)return;i.success?(v(i.passwordRequired),!i.passwordRequired&&!z&&(D(!0),await p()&&t&&(window.location.href=S))):v(!0)}catch(i){console.error("Failed to check password requirement:",i),t&&v(!0)}finally{t&&k(!1)}})(),()=>{t=!1}},[c?.id]);const K=async(t,l)=>{l&&T(l);try{const i=`${t}/api/health`,L=(await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(5e3)})).ok?"success":"error";return l&&O(re=>({...re,[l]:L})),L==="success"}catch{return l&&O(C=>({...C,[l]:"error"})),!1}finally{T(null)}},Q=t=>{w(t),window.location.reload()},V=()=>{o.name.trim()&&o.url.trim()&&(r({name:o.name.trim(),url:o.url.trim()}),x({name:"",url:""}),j(!1))},Y=t=>{o.name.trim()&&o.url.trim()&&(n(t,{name:o.name.trim(),url:o.url.trim()}),x({name:"",url:""}),N(null))},Z=t=>{b(t)},ee=(t,l,i)=>{N(t),x({name:l,url:i})},te=async t=>{t.preventDefault(),await h(m)&&(window.location.href=S)},se=()=>{ie(),window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800",children:e.jsx("div",{className:"max-w-md w-full mx-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-xl p-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-2",children:s("login.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("login.subtitle")}),c&&e.jsx("div",{className:"mt-4 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800",children:e.jsxs("div",{className:"flex items-center justify-center space-x-2 text-sm text-blue-700 dark:text-blue-300",children:[e.jsx(P,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium",children:c.name}),e.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"•"}),e.jsx("span",{className:"text-xs truncate max-w-40",children:c.url})]})})]}),_?e.jsx("div",{className:"space-y-6 text-center",children:e.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("login.checkingConnection","正在检查连接...")})]})}):!R&&u?e.jsx("div",{className:"space-y-6 text-center",children:e.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[e.jsx(U,{className:"w-6 h-6 text-green-500"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("login.autoLoggingIn","正在自动登录...")})]})}):R?e.jsxs("form",{onSubmit:te,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("login.passwordLabel")}),e.jsx("input",{id:"password",type:"password",value:m,onChange:t=>f(t.target.value),placeholder:s("login.passwordPlaceholder"),required:!0,autoFocus:!0,className:`w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600
|
|
@@ -1,4 +1,4 @@
|
|
|
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-BFYHztzB.js";import{u as Ke,b as U,c as S,A as d}from"./agents-D9dWnZr0.js";import{u as Te}from"./tools-zTM46-tZ.js";import{a6 as $e,U as Ee,_ as Pe,C as Fe,j as ze,a7 as Z,v as De,a8 as qe,E as Le,I as _,a9 as Me,aa as Ie,d as Re,y as Be,ab as Oe,a2 as ee}from"./ui-components-BsYwJvCF.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,X]=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"))}},Y=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))}):Y.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Z,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.noKeys")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:s("settings.mcpAdmin.noKeysHint")})]}):e.jsx("div",{className:"space-y-3",children:Y.map(t=>e.jsx("div",{className:`p-4 rounded-lg border ${t.isRevoked?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-60":t.enabled?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700":"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-70"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.description}),t.isRevoked&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300 rounded",children:s("settings.mcpAdmin.revoked")}),!t.isRevoked&&!t.enabled&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 rounded",children:s("settings.mcpAdmin.disabled")})]}),e.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[e.jsx("code",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:E.has(t.id)&&t.fullKey?t.fullKey:t.maskedKey}),!t.isRevoked&&t.fullKey&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Ae(t.id),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:E.has(t.id)?s("settings.mcpAdmin.hideKey"):s("settings.mcpAdmin.showKey"),children:E.has(t.id)?e.jsx(qe,{className:"w-4 h-4"}):e.jsx(Le,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>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:()=>X(t),onMouseLeave:()=>X(null),children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-sm text-gray-900 dark:text-white",children:t.name}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t.description})]}),ie?.name===t.name&&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
|
|
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-BLjehayc.js";import{u as Ke,b as U,c as S,A as d}from"./agents-D9dWnZr0.js";import{u as Te}from"./tools-zTM46-tZ.js";import{a6 as $e,U as Ee,_ as Pe,C as Fe,j as ze,a7 as Z,v as De,a8 as qe,E as Le,I as _,a9 as Me,aa as Ie,d as Re,y as Be,ab as Oe,a2 as ee}from"./ui-components-BsYwJvCF.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,X]=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"))}},Y=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))}):Y.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Z,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.noKeys")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:s("settings.mcpAdmin.noKeysHint")})]}):e.jsx("div",{className:"space-y-3",children:Y.map(t=>e.jsx("div",{className:`p-4 rounded-lg border ${t.isRevoked?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-60":t.enabled?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700":"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-70"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.description}),t.isRevoked&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300 rounded",children:s("settings.mcpAdmin.revoked")}),!t.isRevoked&&!t.enabled&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 rounded",children:s("settings.mcpAdmin.disabled")})]}),e.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[e.jsx("code",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:E.has(t.id)&&t.fullKey?t.fullKey:t.maskedKey}),!t.isRevoked&&t.fullKey&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Ae(t.id),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:E.has(t.id)?s("settings.mcpAdmin.hideKey"):s("settings.mcpAdmin.showKey"),children:E.has(t.id)?e.jsx(qe,{className:"w-4 h-4"}):e.jsx(Le,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>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:()=>X(t),onMouseLeave:()=>X(null),children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-sm text-gray-900 dark:text-white",children:t.name}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t.description})]}),ie?.name===t.name&&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
2
|
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
3
3
|
focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:t=>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
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
|