agentstudio 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{AgentsPage-Nvg2xu6K.js → AgentsPage-CtuoPrly.js} +2 -2
- package/public/assets/{Button-Co56C389.js → Button-DtXXTa68.js} +1 -1
- package/public/assets/{ChatPage-D6sol0ad.js → ChatPage-Ht-lF7H1.js} +178 -149
- package/public/assets/CloudflareTunnelPage-BJNk2Ilw.js +1 -0
- package/public/assets/{CommandForm-Bk7F_HU8.js → CommandForm-hHwraC0y.js} +1 -1
- package/public/assets/{CommandsPage-DZHyOdKd.js → CommandsPage-DLySuqrX.js} +1 -1
- package/public/assets/DashboardPage-BuUwTPV6.js +1 -0
- package/public/assets/{FileBrowser-BYweUPH4.js → FileBrowser-CDuDggHj.js} +5 -5
- package/public/assets/{FileExplorer-DNYj6Tsx.js → FileExplorer-D5l2HgDS.js} +1 -1
- package/public/assets/{GeneralSettingsPage-D9Xa7Nd8.js → GeneralSettingsPage-EODcSgWo.js} +1 -1
- package/public/assets/LandingPage-BAPul_Kj.js +1 -0
- package/public/assets/{LoginPage-DcaGNCXH.js → LoginPage-CQo-eq6b.js} +4 -4
- package/public/assets/McpAdminSettingsPage-BlEhZLV9.js +7 -0
- package/public/assets/{McpPage-CtWf1CoL.js → McpPage-DLMLfSAG.js} +4 -4
- package/public/assets/{MemorySettingsPage-JTry4Ccp.js → MemorySettingsPage-By_AtsBT.js} +1 -1
- package/public/assets/{PluginsPage-D-BHjQ3P.js → PluginsPage-1Z4TkAow.js} +1 -1
- package/public/assets/ProjectSelector-2mn8IO5d.js +1 -0
- package/public/assets/{ProjectsPage-lLUk4-Xa.js → ProjectsPage-CWWZuVNb.js} +5 -5
- package/public/assets/ScheduledTasksPage-BcosBF2P.js +1 -0
- package/public/assets/SettingsLayout-a2GRHdeo.js +1 -0
- package/public/assets/SkillsPage-zIEnU63B.js +18 -0
- package/public/assets/{SubagentForm-BdUK1U4y.js → SubagentForm-DEzelVPW.js} +1 -1
- package/public/assets/{SubagentsPage-Dnq70IFd.js → SubagentsPage-CS6hYApE.js} +1 -1
- package/public/assets/{ToastTestPage-BfJQRFIm.js → ToastTestPage-7Uhhhl-X.js} +1 -1
- package/public/assets/{ToolsList-Dl5F2fWk.js → ToolsList-I7JqIU7m.js} +1 -1
- package/public/assets/UnifiedToolSelector-Cw1xKmPZ.js +1 -0
- package/public/assets/{VersionSettingsPage-BfoCcham.js → VersionSettingsPage-7qtAfOC7.js} +3 -3
- package/public/assets/{_basePickBy-7C_e0Xv1.js → _basePickBy-DQTDhNdw.js} +1 -1
- package/public/assets/{_baseUniq-eGJNLBzx.js → _baseUniq-B_gfAzTb.js} +1 -1
- package/public/assets/{agents-ChrA1R0y.js → agents-B3InAIfY.js} +1 -1
- package/public/assets/{arc-CuA752eE.js → arc-Do_7w4P3.js} +1 -1
- package/public/assets/architectureDiagram-VXUJARFQ-CGxYnv44.js +36 -0
- package/public/assets/{blockDiagram-VD42YOAC-72nsMt_i.js → blockDiagram-VD42YOAC-DMToAyob.js} +1 -1
- package/public/assets/{c4Diagram-YG6GDRKO-BNJSAXcg.js → c4Diagram-YG6GDRKO-CEukDAnl.js} +1 -1
- package/public/assets/channel-Cr4EWrFf.js +1 -0
- package/public/assets/{chunk-4BX2VUAB-RPxkCWhH.js → chunk-4BX2VUAB-Djex-iWv.js} +1 -1
- package/public/assets/{chunk-55IACEB6-3ePDt0kp.js → chunk-55IACEB6-Dq-JM11t.js} +1 -1
- package/public/assets/{chunk-B4BG7PRW-CBg_BBfl.js → chunk-B4BG7PRW-COcDV1Bz.js} +1 -1
- package/public/assets/{chunk-DI55MBZ5-DIh69TUJ.js → chunk-DI55MBZ5-AiToZLMc.js} +1 -1
- package/public/assets/{chunk-FMBD7UC4-BbjwhyTe.js → chunk-FMBD7UC4-CIUbRtI8.js} +1 -1
- package/public/assets/{chunk-QN33PNHL-BpH-o_YR.js → chunk-QN33PNHL-DWVKAIM5.js} +1 -1
- package/public/assets/{chunk-QZHKN3VN-DYB7rh5Q.js → chunk-QZHKN3VN-CH3FeiqK.js} +1 -1
- package/public/assets/{chunk-TZMSLE5B-DPCYEVb3.js → chunk-TZMSLE5B-DAEUDEL5.js} +1 -1
- package/public/assets/classDiagram-2ON5EDUG-BCYMgV2U.js +1 -0
- package/public/assets/classDiagram-v2-WZHVMYZB-BCYMgV2U.js +1 -0
- package/public/assets/clone-T66nRwp8.js +1 -0
- package/public/assets/cose-bilkent-S5V4N54A-CyCeb_x1.js +1 -0
- package/public/assets/dagre-6UL2VRFP-D2pLZr7B.js +4 -0
- package/public/assets/diagram-PSM6KHXK-D3y-uGlf.js +24 -0
- package/public/assets/diagram-QEK2KX5R-BWiK1jr7.js +43 -0
- package/public/assets/diagram-S2PKOQOG-Cbs-OyQV.js +24 -0
- package/public/assets/{erDiagram-Q2GNP2WA-BX1DpOGx.js → erDiagram-Q2GNP2WA-mmj7cEQ3.js} +1 -1
- package/public/assets/{flowDiagram-NV44I4VS-HAAlzNbq.js → flowDiagram-NV44I4VS-C-D2yYgt.js} +1 -1
- package/public/assets/ganttDiagram-LVOFAZNH-CjVweKuf.js +267 -0
- package/public/assets/gitGraphDiagram-NY62KEGX-B5Fajpr9.js +65 -0
- package/public/assets/{graph-m515btDj.js → graph-BkrzwQTG.js} +1 -1
- package/public/assets/{index-Bn3v3S9-.js → index-C8oBHB0h.js} +41 -41
- package/public/assets/index-C9P0ZrJZ.css +1 -0
- package/public/assets/infoDiagram-F6ZHWCRC-KYBfowoc.js +2 -0
- package/public/assets/{journeyDiagram-XKPGCS4Q-BfzTomS0.js → journeyDiagram-XKPGCS4Q-G0GXThg3.js} +1 -1
- package/public/assets/{kanban-definition-3W4ZIXB7-Cgju7b-L.js → kanban-definition-3W4ZIXB7-CL5GnHw8.js} +1 -1
- package/public/assets/{layout-BKQfQSxJ.js → layout-Dv8_9WGx.js} +1 -1
- package/public/assets/{linear-DigtLz3B.js → linear-Bo6VfLsh.js} +1 -1
- package/public/assets/{mindmap-definition-VGOIOE7T-qopraVFy.js → mindmap-definition-VGOIOE7T-Bs3tu0GR.js} +1 -1
- package/public/assets/{pieDiagram-ADFJNKIX-BcoaAI-L.js → pieDiagram-ADFJNKIX-Cb8bwKps.js} +1 -1
- package/public/assets/{quadrantDiagram-AYHSOK5B-D-DwcoSd.js → quadrantDiagram-AYHSOK5B-Dbrv0MtL.js} +1 -1
- package/public/assets/{requirementDiagram-UZGBJVZJ-DbQCpx77.js → requirementDiagram-UZGBJVZJ-nBiRIqA6.js} +1 -1
- package/public/assets/sankeyDiagram-TZEHDZUN-CxJ9tzJO.js +10 -0
- package/public/assets/{sequenceDiagram-WL72ISMW-BdzICjxO.js → sequenceDiagram-WL72ISMW-Cd7CbJ23.js} +1 -1
- package/public/assets/stateDiagram-FKZM4ZOC-BUzdDNZC.js +1 -0
- package/public/assets/stateDiagram-v2-4FDKWEC3-TEx1vYfv.js +1 -0
- package/public/assets/{table-D0L2RL5i.js → table-CHBLEjZn.js} +1 -1
- package/public/assets/{timeline-definition-IT6M3QCI-BAvjPYvX.js → timeline-definition-IT6M3QCI-DJ3qh1sp.js} +1 -1
- package/public/assets/{tools-IcPNZlPj.js → tools-CUwQTL-8.js} +1 -1
- package/public/assets/{treemap-KMMF4GRG-DtkpVA56.js → treemap-KMMF4GRG-pUUUNNXu.js} +1 -1
- package/public/assets/{ui-components-D1St49qC.js → ui-components-icUM6BEH.js} +110 -110
- package/public/assets/{useAgents-BnDTkOG8.js → useAgents-HXlzUYSz.js} +2 -2
- package/public/assets/{useClaudeVersions-CD59tFWM.js → useClaudeVersions-DQ5Wg6Zy.js} +1 -1
- package/public/assets/{useCommands-mvMu3mMD.js → useCommands-vX47i_1v.js} +1 -1
- package/public/assets/{useProjects-YXOjaOwL.js → useProjects-DR0CTJHB.js} +1 -1
- package/public/assets/useSessions-CanqFxtL.js +1 -0
- package/public/assets/{xychartDiagram-PRI3JC2R-ByBTDWE2.js → xychartDiagram-PRI3JC2R-HeLAL-7k.js} +1 -1
- package/public/index.html +5 -5
- package/public/screenshot-chat.png +0 -0
- package/public/screenshot-mcp.png +0 -0
- package/routes/agents.d.ts.map +1 -1
- package/routes/agents.js +17 -0
- package/routes/agents.js.map +1 -1
- package/routes/cloudflareTunnel.d.ts +4 -0
- package/routes/cloudflareTunnel.d.ts.map +1 -0
- package/routes/cloudflareTunnel.js +250 -0
- package/routes/cloudflareTunnel.js.map +1 -0
- package/services/claudeSession.d.ts +9 -0
- package/services/claudeSession.d.ts.map +1 -1
- package/services/claudeSession.js +16 -0
- package/services/claudeSession.js.map +1 -1
- package/services/sessionManager.d.ts +6 -0
- package/services/sessionManager.d.ts.map +1 -1
- package/services/sessionManager.js +37 -2
- package/services/sessionManager.js.map +1 -1
- package/public/assets/DashboardPage-29qC7Ev1.js +0 -15
- package/public/assets/LandingPage-CjnT-cvO.js +0 -1
- package/public/assets/McpAdminSettingsPage-DgR3E2Bd.js +0 -7
- package/public/assets/ProjectSelector-DSXOjMQC.js +0 -1
- package/public/assets/ScheduledTasksPage-5hPbd9Vs.js +0 -1
- package/public/assets/SettingsLayout-DGJspXLp.js +0 -1
- package/public/assets/SkillsPage-DBw0m7D2.js +0 -18
- package/public/assets/UnifiedToolSelector-CNbPsiuq.js +0 -1
- package/public/assets/architectureDiagram-VXUJARFQ-BnPYh1OW.js +0 -36
- package/public/assets/channel-CIunGC5m.js +0 -1
- package/public/assets/classDiagram-2ON5EDUG-aUQHFsTA.js +0 -1
- package/public/assets/classDiagram-v2-WZHVMYZB-aUQHFsTA.js +0 -1
- package/public/assets/clone-Ckf7tA1V.js +0 -1
- package/public/assets/cose-bilkent-S5V4N54A-CnpfmL-Y.js +0 -1
- package/public/assets/dagre-6UL2VRFP-DR9x77Xf.js +0 -4
- package/public/assets/diagram-PSM6KHXK-SONPsQNx.js +0 -24
- package/public/assets/diagram-QEK2KX5R-BKYFSfC1.js +0 -43
- package/public/assets/diagram-S2PKOQOG-CkM0APZj.js +0 -24
- package/public/assets/ganttDiagram-LVOFAZNH-BqzWexqa.js +0 -267
- package/public/assets/gitGraphDiagram-NY62KEGX-CIPmSp43.js +0 -65
- package/public/assets/index-DWieeYj4.css +0 -1
- package/public/assets/infoDiagram-F6ZHWCRC-Pn4yNWrF.js +0 -2
- package/public/assets/sankeyDiagram-TZEHDZUN-BVk8387S.js +0 -10
- package/public/assets/stateDiagram-FKZM4ZOC-CYY-uUvJ.js +0 -1
- package/public/assets/stateDiagram-v2-4FDKWEC3-Dh2Kvomq.js +0 -1
- package/public/assets/tabManager-B2LQO_Ll.js +0 -30
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{u as n}from"./tools-IcPNZlPj.js";import{_ as l,l as d,o as r,G as o,$ as c,a0 as x,e as m,Z as g,U as h}from"./ui-components-D1St49qC.js";import{L as s}from"./index-Bn3v3S9-.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-ChrA1R0y.js";const y=()=>{const{t}=n("pages");return i.useEffect(()=>{document.title=t("landing.pageTitle");const a=document.querySelector('meta[name="description"]');a&&a.setAttribute("content",t("landing.metaDescription"))},[t]),e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-blue-50",children:[e.jsx("nav",{className:"bg-white/80 backdrop-blur-sm border-b border-gray-200 sticky top-0 z-50",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex justify-between items-center h-16",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-bold text-gray-900",children:"AgentStudio"})]}),e.jsxs(s,{to:"/dashboard",className:"inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors duration-200",children:[t("landing.nav.enterWorkspace"),e.jsx(l,{className:"ml-2 w-4 h-4"})]})]})})}),e.jsx("section",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-7xl mx-auto text-center",children:[e.jsxs("h1",{className:"text-5xl sm:text-6xl font-bold text-gray-900 mb-6",children:[e.jsx("span",{className:"bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent",children:t("landing.hero.title")}),e.jsx("br",{}),t("landing.hero.subtitle")]}),e.jsx("p",{className:"text-xl text-gray-600 mb-8 max-w-3xl mx-auto leading-relaxed",children:t("landing.hero.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsxs(s,{to:"/dashboard",className:"inline-flex items-center px-8 py-4 bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-xl transition-all duration-200 shadow-lg hover:shadow-xl",children:[t("landing.hero.startNow"),e.jsx(d,{className:"ml-2 w-5 h-5"})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-8 py-4 bg-white hover:bg-gray-50 text-gray-700 font-semibold rounded-xl border border-gray-300 transition-all duration-200",children:[e.jsx(r,{className:"mr-2 w-5 h-5"}),t("landing.hero.viewSource")]})]})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-white",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-4",children:t("landing.features.title")}),e.jsx("p",{className:"text-lg text-gray-600 max-w-2xl mx-auto",children:t("landing.features.subtitle")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-indigo-50 p-8 rounded-2xl border border-blue-100",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(o,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.modernWeb.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.modernWeb.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-purple-50 to-pink-50 p-8 rounded-2xl border border-purple-100",children:[e.jsx("div",{className:"w-12 h-12 bg-purple-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(c,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.multiModel.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.multiModel.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-green-50 to-emerald-50 p-8 rounded-2xl border border-green-100",children:[e.jsx("div",{className:"w-12 h-12 bg-green-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(x,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.agentSystem.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.agentSystem.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-orange-50 to-red-50 p-8 rounded-2xl border border-orange-100",children:[e.jsx("div",{className:"w-12 h-12 bg-orange-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(m,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.fileManagement.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.fileManagement.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-teal-50 to-cyan-50 p-8 rounded-2xl border border-teal-100",children:[e.jsx("div",{className:"w-12 h-12 bg-teal-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(g,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.professionalTools.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.professionalTools.description")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-gray-50 to-slate-50 p-8 rounded-2xl border border-gray-100",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-600 rounded-lg flex items-center justify-center mb-6",children:e.jsx(h,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-3",children:t("landing.features.secureReliable.title")}),e.jsx("p",{className:"text-gray-600 leading-relaxed",children:t("landing.features.secureReliable.description")})]})]})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-white",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-6",children:t("landing.quickStart.title")}),e.jsx("p",{className:"text-lg text-gray-600 mb-8",children:t("landing.quickStart.subtitle")}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-indigo-50 p-8 rounded-2xl border border-blue-100",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:t("landing.quickStart.endUserTitle")}),e.jsx("div",{className:"bg-gray-900 rounded-lg p-4 text-left text-sm text-green-400 font-mono mb-4",children:e.jsx("div",{children:"curl -fsSL https://raw.githubusercontent.com/okguitar/agentstudio/main/scripts/remote-install.sh | bash"})}),e.jsx("p",{className:"text-gray-600 text-sm",children:t("landing.quickStart.endUserDescription")})]}),e.jsxs("div",{className:"bg-gradient-to-br from-purple-50 to-pink-50 p-8 rounded-2xl border border-purple-100",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:t("landing.quickStart.developerTitle")}),e.jsxs("div",{className:"bg-gray-900 rounded-lg p-4 text-left text-sm text-green-400 font-mono mb-4",children:[e.jsx("div",{children:"git clone https://github.com/okguitar/agentstudio.git"}),e.jsx("div",{children:"cd agentstudio"}),e.jsx("div",{children:"pnpm install && pnpm run dev"})]}),e.jsx("p",{className:"text-gray-600 text-sm",children:t("landing.quickStart.developerDescription")})]})]})]})}),e.jsx("section",{className:"py-16 px-4 sm:px-6 lg:px-8 bg-gradient-to-r from-blue-600 to-purple-600",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h2",{className:"text-3xl font-bold text-white mb-6",children:t("landing.cta.title")}),e.jsx("p",{className:"text-xl text-blue-100 mb-8",children:t("landing.cta.subtitle")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsxs(s,{to:"/dashboard",className:"inline-flex items-center px-8 py-4 bg-white hover:bg-gray-100 text-blue-600 font-semibold rounded-xl transition-all duration-200 shadow-lg",children:[t("landing.cta.start"),e.jsx(l,{className:"ml-2 w-5 h-5"})]}),e.jsxs("a",{href:"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-8 py-4 bg-blue-500 hover:bg-blue-400 text-white font-semibold rounded-xl border border-blue-400 transition-all duration-200",children:[e.jsx(r,{className:"mr-2 w-5 h-5"}),"GitHub"]})]})]})}),e.jsx("footer",{className:"bg-gray-900 text-gray-300 py-12 px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-8",children:[e.jsxs("div",{className:"col-span-1 md:col-span-2",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("img",{src:"/cc-studio.png",alt:"AgentStudio",className:"w-8 h-8"}),e.jsx("span",{className:"text-xl font-bold text-white",children:"AgentStudio"})]}),e.jsx("p",{className:"text-gray-400 mb-4 max-w-md",children:t("landing.footer.description")}),e.jsx("div",{className:"text-sm text-gray-500",children:t("landing.footer.copyright")})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:t("landing.footer.product")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx(s,{to:"/dashboard",className:"hover:text-white transition-colors",children:t("landing.footer.workspace")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio",className:"hover:text-white transition-colors",children:t("landing.footer.sourceCode")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/releases",className:"hover:text-white transition-colors",children:t("landing.footer.releases")})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold mb-4",children:t("landing.footer.support")}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/wiki",className:"hover:text-white transition-colors",children:t("landing.footer.documentation")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/issues",className:"hover:text-white transition-colors",children:t("landing.footer.issues")})}),e.jsx("li",{children:e.jsx("a",{href:"https://github.com/okguitar/agentstudio/discussions",className:"hover:text-white transition-colors",children:t("landing.footer.discussions")})})]})]})]})})})]})};export{y as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{a as A,b as c}from"./index-Bn3v3S9-.js";import{u as Ce,b as U,c as S,A as d}from"./agents-ChrA1R0y.js";import{u as Te}from"./tools-IcPNZlPj.js";import{H as $e,R as Ee,I as Pe,C as Fe,j as ze,K as Z,p as De,J as qe,E as Le,t as _,N as Me,O as Ie,d as Re,v as Oe,Q as Qe,U as ee}from"./ui-components-D1St49qC.js";import"./syntax-highlighting-CnREyncB.js";async function Be(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/status`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch status");return r.json()}async function Ue(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/keys`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch keys");return r.json()}async function _e(){const s=localStorage.getItem("authToken"),r=await fetch(`${d}/mcp-admin-management/tools`,{headers:{Authorization:`Bearer ${s}`}});if(!r.ok)throw new Error("Failed to fetch tools");return r.json()}async function He(s){const r=localStorage.getItem("authToken"),l=await fetch(`${d}/mcp-admin-management/keys`,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok)throw new Error("Failed to create key");return l.json()}async function Je(s){const r=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}})).ok)throw new Error("Failed to revoke key")}async function Ve(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}`,{method:"PUT",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(r)})).ok)throw new Error("Failed to update key")}async function Ge(s,r){const l=localStorage.getItem("authToken");if(!(await fetch(`${d}/mcp-admin-management/keys/${s}/toggle`,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:r})})).ok)throw new Error("Failed to toggle key")}async function te(s){const r=localStorage.getItem("authToken"),l=await fetch(`${d}/mcp-admin-management/config-snippet?apiKey=${encodeURIComponent(s)}`,{headers:{Authorization:`Bearer ${r}`}});if(!l.ok)throw new Error("Failed to fetch config");return l.json()}const at=()=>{const{t:s}=Te("pages"),r=Ce(),[l,u]=i.useState(!1),[se,K]=i.useState(!1),[C,T]=i.useState(""),[y,H]=i.useState(null),[o,$]=i.useState(null),[b,J]=i.useState("cursor"),[E,ae]=i.useState(new Set),[re,P]=i.useState(!1),[F,V]=i.useState(null),[m,j]=i.useState(new Set),[h,z]=i.useState(!1),[ne,D]=i.useState(!1),[q,L]=i.useState(null),[G,W]=i.useState(""),[x,f]=i.useState(new Set),[p,M]=i.useState(!1),[ie,X]=i.useState(null),{data:N,isLoading:le,refetch:de}=U({queryKey:["mcpAdminStatus"],queryFn:Be}),{data:ce,isLoading:oe,refetch:me}=U({queryKey:["mcpAdminKeys"],queryFn:Ue}),{data:xe,isLoading:ge}=U({queryKey:["mcpAdminTools"],queryFn:_e}),I=S({mutationFn:He,onSuccess:async t=>{H(t.key),u(!1),T(""),j(new Set),z(!1),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]});try{const a=await te(t.key);$(a),K(!0)}catch{c(s("settings.mcpAdmin.errors.configFetch"))}},onError:t=>{c(s("settings.mcpAdmin.errors.createFailed"),t instanceof Error?t.message:void 0)}}),he=S({mutationFn:Je,onSuccess:()=>{A(s("settings.mcpAdmin.success.keyRevoked")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{c(s("settings.mcpAdmin.errors.revokeFailed"),t instanceof Error?t.message:void 0)}}),R=S({mutationFn:({keyId:t,data:a})=>Ve(t,a),onSuccess:()=>{A(s("settings.mcpAdmin.success.keyUpdated")),D(!1),L(null),r.invalidateQueries({queryKey:["mcpAdminKeys"]})},onError:t=>{c(s("settings.mcpAdmin.errors.updateFailed"),t instanceof Error?t.message:void 0)}}),pe=S({mutationFn:({keyId:t,enabled:a})=>Ge(t,a),onSuccess:(t,a)=>{A(a.enabled?s("settings.mcpAdmin.success.keyEnabled"):s("settings.mcpAdmin.success.keyDisabled")),r.invalidateQueries({queryKey:["mcpAdminKeys"]}),r.invalidateQueries({queryKey:["mcpAdminStatus"]})},onError:t=>{c(s("settings.mcpAdmin.errors.toggleFailed"),t instanceof Error?t.message:void 0)}}),ue=()=>{if(!C.trim()){c(s("settings.mcpAdmin.errors.descriptionRequired"));return}I.mutate({description:C.trim(),permissions:["admin:*"],allowedTools:h&&m.size>0?Array.from(m):void 0})},ye=t=>{j(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},be=()=>{j(new Set(k.map(t=>t.name)))},je=()=>{j(new Set)},fe=t=>{L(t),W(t.description),t.allowedTools&&t.allowedTools.length>0?(M(!0),f(new Set(t.allowedTools))):(M(!1),f(new Set)),D(!0)},ke=()=>{q&&R.mutate({keyId:q.id,data:{description:G.trim()||void 0,allowedTools:p&&x.size>0?Array.from(x):[]}})},ve=t=>{f(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},we=t=>{pe.mutate({keyId:t.id,enabled:!t.enabled})},Ne=t=>{confirm(s("settings.mcpAdmin.confirmRevoke"))&&he.mutate(t)},O=async t=>{try{await navigator.clipboard.writeText(t),A(s("settings.mcpAdmin.success.copied"))}catch{c(s("settings.mcpAdmin.errors.copyFailed"))}},Ae=t=>{ae(a=>{const n=new Set(a);return n.has(t)?n.delete(t):n.add(t),n})},Se=async t=>{if(t.fullKey)try{const a=await te(t.fullKey);$(a),V(t.fullKey),K(!0)}catch{c(s("settings.mcpAdmin.errors.configFetch"))}},Y=ce?.keys||[],k=xe?.tools||[],Ke=(t,a="right")=>{const n=t.inputSchema?.properties||{},v=t.inputSchema?.required||[],g=Object.entries(n),w=a==="right"?"left-full ml-2":"right-full mr-2";return e.jsxs("div",{className:`absolute z-50 ${w} top-0 w-72 bg-gray-900 text-white rounded-lg shadow-xl p-3 text-sm`,children:[e.jsx("div",{className:"font-medium text-blue-300 mb-1",children:t.name}),e.jsx("p",{className:"text-gray-300 text-xs mb-2",children:t.description}),g.length>0&&e.jsxs("div",{className:"border-t border-gray-700 pt-2",children:[e.jsxs("div",{className:"text-xs text-gray-400 mb-1",children:[s("settings.mcpAdmin.toolParams"),":"]}),e.jsx("div",{className:"space-y-1",children:g.map(([Q,B])=>e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-mono text-green-400",children:Q}),v.includes(Q)&&e.jsx("span",{className:"text-red-400 ml-1",children:"*"}),e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",B.type,")"]}),B.description&&e.jsx("p",{className:"text-gray-400 ml-2 mt-0.5",children:B.description})]},Q))})]}),g.length===0&&e.jsx("div",{className:"text-xs text-gray-500 italic",children:s("settings.mcpAdmin.noParams")})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:s("settings.mcpAdmin.title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.mcpAdmin.subtitle")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("button",{onClick:()=>P(!0),className:"flex items-center space-x-2 px-3 py-2 text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:[e.jsx($e,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.help.button")})]}),e.jsxs("button",{onClick:()=>{de(),me()},className:"flex items-center space-x-2 px-3 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:[e.jsx(Ee,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.refresh")})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(Pe,{className:"w-6 h-6 text-blue-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.serverStatus")})]}),le?e.jsxs("div",{className:"animate-pulse space-y-3",children:[e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/3"}),e.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/2"})]}):N?e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{className:"w-5 h-5 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.status")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.status.active")})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.version")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:N.version})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.tools")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:N.toolCount})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.status.activeKeys")}),e.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:N.activeKeyCount})]})]}):e.jsxs("div",{className:"flex items-center space-x-2 text-red-500",children:[e.jsx(ze,{className:"w-5 h-5"}),e.jsx("span",{children:s("settings.mcpAdmin.status.unavailable")})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("settings.mcpAdmin.endpoint"),": ",e.jsxs("code",{className:"bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded text-sm",children:[d,"/mcp-admin"]})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(Z,{className:"w-6 h-6 text-yellow-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.apiKeys")})]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center space-x-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[e.jsx(De,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.createKey")})]})]}),oe?e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2].map(t=>e.jsx("div",{className:"h-16 bg-gray-200 dark:bg-gray-700 rounded"},t))}):Y.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Z,{className:"w-12 h-12 text-gray-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.noKeys")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:s("settings.mcpAdmin.noKeysHint")})]}):e.jsx("div",{className:"space-y-3",children:Y.map(t=>e.jsx("div",{className:`p-4 rounded-lg border ${t.isRevoked?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-60":t.enabled?"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700":"bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 opacity-70"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.description}),t.isRevoked&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300 rounded",children:s("settings.mcpAdmin.revoked")}),!t.isRevoked&&!t.enabled&&e.jsx("span",{className:"px-2 py-0.5 text-xs bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 rounded",children:s("settings.mcpAdmin.disabled")})]}),e.jsxs("div",{className:"flex items-center space-x-2 mt-2",children:[e.jsx("code",{className:"text-sm text-gray-500 dark:text-gray-400 font-mono bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:E.has(t.id)&&t.fullKey?t.fullKey:t.maskedKey}),!t.isRevoked&&t.fullKey&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>Ae(t.id),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:E.has(t.id)?s("settings.mcpAdmin.hideKey"):s("settings.mcpAdmin.showKey"),children:E.has(t.id)?e.jsx(qe,{className:"w-4 h-4"}):e.jsx(Le,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>O(t.fullKey),className:"p-1.5 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",title:s("settings.mcpAdmin.copyKey"),children:e.jsx(_,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-x-4 gap-y-1 mt-2 text-xs text-gray-400",children:[e.jsxs("span",{children:[s("settings.mcpAdmin.createdAt"),": ",new Date(t.createdAt).toLocaleDateString()]}),t.lastUsedAt&&e.jsxs("span",{children:[s("settings.mcpAdmin.lastUsed"),": ",new Date(t.lastUsedAt).toLocaleDateString()]}),t.allowedTools&&t.allowedTools.length>0?e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:["🔒 ",s("settings.mcpAdmin.limitedTools",{count:t.allowedTools.length})]}):e.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["✓ ",s("settings.mcpAdmin.allToolsAccess")]})]})]}),e.jsx("div",{className:"flex items-center space-x-2 ml-4",children:!t.isRevoked&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>we(t),className:`p-2 rounded-lg transition-colors ${t.enabled?"text-green-600 hover:bg-green-50 dark:hover:bg-green-900/20":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:t.enabled?s("settings.mcpAdmin.disableKey"):s("settings.mcpAdmin.enableKey"),children:t.enabled?e.jsx(Me,{className:"w-4 h-4"}):e.jsx(Ie,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>fe(t),className:"p-2 text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.editKey"),children:e.jsx(Re,{className:"w-4 h-4"})}),t.fullKey&&e.jsx("button",{onClick:()=>Se(t),className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.viewConfig"),children:s("settings.mcpAdmin.viewConfig")}),e.jsx("button",{onClick:()=>Ne(t.id),className:"p-2 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",title:s("settings.mcpAdmin.revokeKey"),children:e.jsx(Oe,{className:"w-4 h-4"})})]})})]})},t.id))})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx(Qe,{className:"w-6 h-6 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.availableTools")})]}),ge?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4].map(t=>e.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded"},t))}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:k.map((t,a)=>{const n=a%2===1;return e.jsxs("div",{className:"relative flex items-start space-x-3 p-3 bg-gray-50 dark:bg-gray-900 rounded-lg cursor-help hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",onMouseEnter:()=>X(t),onMouseLeave:()=>X(null),children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-sm text-gray-900 dark:text-white",children:t.name}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t.description})]}),ie?.name===t.name&&Ke(t,n?"left":"right")]},t.name)})})]}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:s("settings.mcpAdmin.createKeyTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.keyDescription")}),e.jsx("input",{type:"text",value:C,onChange:t=>T(t.target.value),placeholder:s("settings.mcpAdmin.keyDescriptionPlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
|
|
2
|
-
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
3
|
-
focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:t=>z(t.target.checked),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s("settings.mcpAdmin.limitTools")})]}),h&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("button",{onClick:be,className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.selectAll")}),e.jsx("span",{className:"text-gray-400",children:"|"}),e.jsx("button",{onClick:je,className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.deselectAll")})]})]}),h&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-3 max-h-64 overflow-y-auto",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(t=>{const a=Object.entries(t.inputSchema?.properties||{}),n=a.length>0?`
|
|
4
|
-
${s("settings.mcpAdmin.toolParams")}: ${a.map(([g,w])=>`${g}(${w.type})`).join(", ")}`:"",v=`${t.description}${n}`;return e.jsxs("label",{title:v,className:`flex items-center space-x-2 p-2 rounded-lg cursor-pointer transition-colors ${m.has(t.name)?"bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800":"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750"}`,children:[e.jsx("input",{type:"checkbox",checked:m.has(t.name),onChange:()=>ye(t.name),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"text-sm font-mono text-gray-900 dark:text-white truncate",children:t.name})})]},t.name)})}),m.size>0&&e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.selectedToolsCount",{count:m.size})})]}),!h&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(ee,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.fullPermissions")})]})]})]}),e.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[e.jsx("button",{onClick:()=>{u(!1),T(""),j(new Set),z(!1)},className:"px-4 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:s("settings.mcpAdmin.cancel")}),e.jsx("button",{onClick:ue,disabled:I.isPending||h&&m.size===0,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50",children:I.isPending?s("settings.mcpAdmin.creating"):s("settings.mcpAdmin.create")})]})]})}),se&&o&&(y||F)&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:s(y?"settings.mcpAdmin.keyCreated":"settings.mcpAdmin.configTitle")}),y&&e.jsx("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:e.jsxs("p",{className:"text-sm text-yellow-700 dark:text-yellow-400",children:["⚠️ ",s("settings.mcpAdmin.saveKeyWarning")]})}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.yourApiKey")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("code",{className:"flex-1 p-3 bg-gray-100 dark:bg-gray-900 rounded-lg font-mono text-sm break-all",children:y||F}),e.jsx("button",{onClick:()=>O(y||F||""),className:"p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:e.jsx(_,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex space-x-2 mb-4",children:[e.jsx("button",{onClick:()=>J("cursor"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${b==="cursor"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:"Cursor"}),e.jsx("button",{onClick:()=>J("claude-desktop"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${b==="claude-desktop"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:"Claude Desktop"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[s("settings.mcpAdmin.configFile"),":",e.jsx("code",{className:"ml-2 text-xs text-gray-500",children:b==="cursor"?o.cursor.configPath:o.claudeDesktop.configPath})]}),e.jsxs("button",{onClick:()=>O(b==="cursor"?o.cursor.configString:o.claudeDesktop.configString),className:"flex items-center space-x-1 text-sm text-blue-600 hover:text-blue-700",children:[e.jsx(_,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.copyConfig")})]})]}),e.jsx("pre",{className:"p-4 bg-gray-900 text-gray-100 rounded-lg overflow-x-auto text-sm font-mono",children:b==="cursor"?o.cursor.configString:o.claudeDesktop.configString})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx("button",{onClick:()=>{K(!1),H(null),V(null),$(null)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg",children:s("settings.mcpAdmin.done")})})]})}),ne&&q&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:s("settings.mcpAdmin.editKeyTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:s("settings.mcpAdmin.keyDescription")}),e.jsx("input",{type:"text",value:G,onChange:t=>W(t.target.value),placeholder:s("settings.mcpAdmin.keyDescriptionPlaceholder"),className:`w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
|
|
5
|
-
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
|
|
6
|
-
focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:t=>M(t.target.checked),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s("settings.mcpAdmin.limitTools")})]}),p&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx("button",{onClick:()=>f(new Set(k.map(t=>t.name))),className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.selectAll")}),e.jsx("span",{className:"text-gray-400",children:"|"}),e.jsx("button",{onClick:()=>f(new Set),className:"text-blue-600 hover:text-blue-700",children:s("settings.mcpAdmin.deselectAll")})]})]}),p&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-3 max-h-64 overflow-y-auto",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(t=>{const a=Object.entries(t.inputSchema?.properties||{}),n=a.length>0?`
|
|
7
|
-
${s("settings.mcpAdmin.toolParams")}: ${a.map(([g,w])=>`${g}(${w.type})`).join(", ")}`:"",v=`${t.description}${n}`;return e.jsxs("label",{title:v,className:`flex items-center space-x-2 p-2 rounded-lg cursor-pointer transition-colors ${x.has(t.name)?"bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800":"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-750"}`,children:[e.jsx("input",{type:"checkbox",checked:x.has(t.name),onChange:()=>ve(t.name),className:"w-4 h-4 text-blue-600 rounded border-gray-300 dark:border-gray-600"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"text-sm font-mono text-gray-900 dark:text-white truncate",children:t.name})})]},t.name)})}),x.size>0&&e.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:s("settings.mcpAdmin.selectedToolsCount",{count:x.size})})]}),!p&&e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(ee,{className:"w-4 h-4"}),e.jsx("span",{children:s("settings.mcpAdmin.fullPermissions")})]})]})]}),e.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[e.jsx("button",{onClick:()=>{D(!1),L(null)},className:"px-4 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:s("settings.mcpAdmin.cancel")}),e.jsx("button",{onClick:ke,disabled:R.isPending||p&&x.size===0,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50",children:R.isPending?s("settings.mcpAdmin.saving"):s("settings.mcpAdmin.save")})]})]})}),re&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-3xl w-full mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s("settings.mcpAdmin.help.title")}),e.jsx("button",{onClick:()=>P(!1),className:"p-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",children:"×"})]}),e.jsxs("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.whatIs")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:s("settings.mcpAdmin.help.whatIsDesc")}),e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.howToUse")}),e.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-gray-600 dark:text-gray-400 mb-4",children:[e.jsx("li",{children:s("settings.mcpAdmin.help.step1")}),e.jsx("li",{children:s("settings.mcpAdmin.help.step2")}),e.jsx("li",{children:s("settings.mcpAdmin.help.step3")}),e.jsx("li",{children:s("settings.mcpAdmin.help.step4")})]}),e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.availableTools")}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-gray-600 dark:text-gray-400 mb-4",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"list_projects"})," - ",s("settings.mcpAdmin.help.toolListProjects")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"get_project"})," - ",s("settings.mcpAdmin.help.toolGetProject")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"list_agents"})," - ",s("settings.mcpAdmin.help.toolListAgents")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"get_agent"})," - ",s("settings.mcpAdmin.help.toolGetAgent")]}),e.jsxs("li",{children:[e.jsx("strong",{children:"health_check"})," - ",s("settings.mcpAdmin.help.toolHealthCheck")]})]}),e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mt-4 mb-2",children:s("settings.mcpAdmin.help.examples")}),e.jsxs("div",{className:"bg-gray-100 dark:bg-gray-900 rounded-lg p-4 mb-4",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:s("settings.mcpAdmin.help.examplePrompt")}),e.jsx("code",{className:"text-sm text-purple-600 dark:text-purple-400",children:'"请帮我列出 AgentStudio 中所有的项目"'})]})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx("button",{onClick:()=>P(!1),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg",children:s("settings.mcpAdmin.done")})})]})})]})};export{at as McpAdminSettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as x}from"./monaco-editor-DHKm5-VF.js";import{u as X,a as D,A as F}from"./agents-ChrA1R0y.js";import{u as Y,a as G,b as H}from"./useAgents-BnDTkOG8.js";import{F as v}from"./FileBrowser-BYweUPH4.js";import{b as S}from"./index-Bn3v3S9-.js";import{u as E}from"./tools-IcPNZlPj.js";import{X as I,V as A,g as J,Y as M}from"./ui-components-D1St49qC.js";const ie=({agent:s,onProjectSelect:c,onClose:g})=>{const{t:r}=E("components"),[l,j]=x.useState(!1),[f,d]=x.useState(!1),[$,u]=x.useState(!1),[B,b]=x.useState(!1),[P,w]=x.useState(""),[q,N]=x.useState(!1),C=Y(),z=G(),k=X(),{data:L,isLoading:Q}=H(s.id),p=L?.projects||[],R=async()=>{j(!0);try{const t=s.id.replace(/[-_]/g,"-"),a=new Date().toISOString().slice(0,16).replace(/[:T]/g,"-"),i=`${t}-project-${a}`,m=await C.mutateAsync({agentId:s.id,projectName:i});await k.invalidateQueries({queryKey:["agent-projects",s.id]}),c(m.project.path)}catch(t){console.error("Failed to create project:",t),S(r("projectSelector.createProjectFailed",{error:""}),t instanceof Error?t.message:r("projectSelector.unknownError"))}finally{j(!1)}},K=()=>{u(!0)},T=(t,a)=>{a&&(w(t),u(!1),N(!0))},U=async t=>{j(!0);try{const a=t,i=await C.mutateAsync({agentId:s.id,projectName:a,parentDirectory:P||void 0});await k.invalidateQueries({queryKey:["agent-projects",s.id]}),c(i.project.path)}catch(a){console.error("Failed to create project:",a),S(r("projectSelector.createProjectFailed",{error:""}),a instanceof Error?a.message:r("projectSelector.unknownError"))}finally{j(!1),N(!1),w("")}},W=()=>{d(!0)},_=async(t,a)=>{if(a){const i=t.replace(/\/$/,""),m=p.map(o=>o.path.replace(/\/$/,""));let n=m.includes(i);if(!n)try{const o=await D(`${F}/files/browse?path=${encodeURIComponent(t)}/.cc-sessions`);o.ok&&(await o.json()).items?.some(y=>y.isDirectory&&y.name===s.id)&&(n=!0)}catch{}if(console.log("Import path comparison:",{selectedPath:i,agentProjects:m,isExisting:n}),n)c(t),b(!1);else if(window.confirm(r("projectSelector.importConfirmation",{agentName:s.name,path:t})))try{await z.mutateAsync({agentId:s.id,projectPath:t}),await k.invalidateQueries({queryKey:["agent-projects",s.id]}),c(t),b(!1)}catch(h){console.error("Failed to import project:",h),S(r("projectSelector.importProjectFailed",{error:""}),h instanceof Error?h.message:r("projectSelector.unknownError"))}}},O=async(t,a)=>{if(a){const i=t.replace(/\/$/,""),m=p.map(o=>o.path.replace(/\/$/,""));let n=m.includes(i);if(!n)try{const o=await D(`${F}/files/browse?path=${encodeURIComponent(t)}/.cc-sessions`);o.ok&&(await o.json()).items?.some(y=>y.isDirectory&&y.name===s.id)&&(n=!0)}catch{}console.log("Path comparison:",{selectedPath:i,agentProjects:m,isExisting:n}),(n||window.confirm(r("projectSelector.importConfirmation",{agentName:s.name,path:t})))&&(c(t),d(!1))}};return e.jsxs("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-6xl mx-4 max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"text-2xl",children:s.ui.icon}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:s.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r("projectSelector.selectProjectDirectory")})]})]}),e.jsx("button",{onClick:g,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex-shrink-0",children:e.jsx(I,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col md:flex-row",children:[e.jsxs("div",{className:"w-full md:w-1/2 p-6 md:border-r border-gray-200 dark:border-gray-700",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mb-4",children:r("projectSelector.projectActions")}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{onClick:R,disabled:l,className:"w-full flex items-center space-x-4 p-4 border border-primary/40 dark:border-primary/60 rounded-lg hover:bg-primary/5 dark:hover:bg-primary/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(A,{className:`w-6 h-6 ${l?"text-gray-400 dark:text-gray-500":"text-primary"}`})}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r(l?"projectSelector.creatingProject":"projectSelector.quickCreateProject")}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("projectSelector.quickCreateDescription")})]})]}),e.jsxs("button",{onClick:K,disabled:l,className:"w-full flex items-center space-x-4 p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(A,{className:"w-6 h-6 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r("projectSelector.customLocationCreate")}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("projectSelector.customLocationDescription")})]})]}),e.jsxs("button",{onClick:W,className:"w-full flex items-center space-x-4 p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(J,{className:"w-6 h-6 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r("projectSelector.browseProject")}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:r("projectSelector.browseDescription")})]})]})]})]}),e.jsxs("div",{className:"w-full md:w-1/2 p-6 flex flex-col min-h-[300px] md:min-h-0",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 dark:text-white mb-4",children:r("projectSelector.recentProjects")}),Q?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-blue-600 dark:border-t-blue-500 rounded-full mx-auto mb-3"}),e.jsx("p",{className:"text-sm",children:r("projectSelector.loadingProjects")})]})}):p.length>0?e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{className:"space-y-2 max-h-full overflow-y-auto",children:p.map((t,a)=>e.jsxs("button",{onClick:()=>c(t.path),className:"w-full flex items-center space-x-3 p-4 border border-gray-100 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors text-left",children:[e.jsx("div",{className:"w-5 h-5 flex-shrink-0 text-xl text-primary",children:t.defaultAgentIcon||"📁"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white truncate",children:t.name}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:t.path}),e.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:r("projectSelector.lastAccessed",{date:new Date(t.lastAccessed).toLocaleString()})})]})]},t.id||a))})}):e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx(M,{className:"w-16 h-16 text-gray-300 dark:text-gray-600 mx-auto mb-3"}),e.jsx("p",{className:"text-base font-medium",children:r("projectSelector.noRecentProjects")}),e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:r("projectSelector.createProjectToStart")})]})})]})]}),e.jsx("div",{className:"flex justify-end p-6 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsx("button",{onClick:g,className:"px-6 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:r("projectSelector.cancel")})})]}),f&&e.jsx(v,{title:r("projectSelector.selectProjectDirectory"),allowFiles:!1,allowDirectories:!0,onSelect:O,onClose:()=>d(!1)}),$&&e.jsx(v,{title:r("projectSelector.selectParentDirectory"),allowFiles:!1,allowDirectories:!0,allowNewDirectory:!0,onSelect:T,onClose:()=>u(!1)}),B&&e.jsx(v,{title:r("projectSelector.importProject"),allowFiles:!1,allowDirectories:!0,onSelect:_,onClose:()=>b(!1)}),q&&e.jsx(Z,{parentDirectory:P,onConfirm:U,onCancel:()=>{N(!1),w("")}})]})},Z=({parentDirectory:s,onConfirm:c,onCancel:g})=>{const{t:r}=E("components"),[l,j]=x.useState(""),f=d=>{d.preventDefault(),l.trim()&&c(l.trim())};return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[60]",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md mx-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r("projectSelector.dialog.createNewProject")}),e.jsx("button",{onClick:g,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(I,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:r("projectSelector.dialog.projectWillBeCreatedAt")}),e.jsx("div",{className:"p-2 bg-gray-100 dark:bg-gray-700 rounded text-sm font-mono text-gray-800 dark:text-gray-200 break-all",children:s})]}),e.jsxs("form",{onSubmit:f,children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"projectName",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:r("projectSelector.dialog.projectName")}),e.jsx("input",{id:"projectName",type:"text",value:l,onChange:d=>j(d.target.value),placeholder:r("projectSelector.dialog.projectNamePlaceholder"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-transparent",autoFocus:!0,required:!0})]}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:r("projectSelector.dialog.cancel")}),e.jsx("button",{type:"submit",disabled:!l.trim(),className:"px-4 py-2 text-sm bg-blue-600 dark:bg-blue-500 text-white rounded-lg hover:bg-blue-700 dark:hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("projectSelector.dialog.createProject")})]})]})]})})};export{ie as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as o,W as ve}from"./monaco-editor-DHKm5-VF.js";import{T as xe,a as ue,b as U,c as k,d as ge,e as j}from"./table-D0L2RL5i.js";import{b as G,u as M,c as R,a as N,A as S}from"./agents-ChrA1R0y.js";import{c as we}from"./useAgents-BnDTkOG8.js";import{u as Ne}from"./useProjects-YXOjaOwL.js";import{u as Se}from"./useClaudeVersions-CD59tFWM.js";import{b as u,a as C}from"./index-Bn3v3S9-.js";import{m as D,$ as Ce,f as Te,an as ie,k as he,D as Ee,am as me,a1 as ye,y as Ie,ao as Ae,L as X,l as $e,e as ce,n as pe,C as be,a2 as qe,p as oe,ap as Me,aq as Pe,R as Re,ar as De,u as Fe,v as Ke}from"./ui-components-D1St49qC.js";import"./syntax-highlighting-CnREyncB.js";import"./tools-IcPNZlPj.js";const d={all:["scheduled-tasks"],lists:()=>[...d.all,"list"],list:()=>[...d.lists()],details:()=>[...d.all,"detail"],detail:t=>[...d.details(),t],history:t=>[...d.all,"history",t],status:()=>[...d.all,"status"]},Oe=()=>G({queryKey:d.list(),queryFn:async()=>{const t=await N(`${S}/scheduled-tasks`);if(!t.ok)throw new Error("Failed to fetch scheduled tasks");return t.json()},refetchInterval:t=>t.state.data?.some(c=>c.lastRunStatus==="running")?3e3:!1}),Qe=(t,n=50)=>G({queryKey:d.history(t),queryFn:async()=>{const l=await N(`${S}/scheduled-tasks/${t}/history?limit=${n}`);if(!l.ok)throw new Error("Failed to fetch task execution history");return l.json()},enabled:!!t,refetchInterval:l=>l.state.data?.some(I=>I.status==="running")?3e3:!1}),Le=()=>G({queryKey:d.status(),queryFn:async()=>{const t=await N(`${S}/scheduled-tasks/status`);if(!t.ok)throw new Error("Failed to fetch scheduler status");return t.json()},refetchInterval:3e4}),Ve=()=>{const t=M();return R({mutationFn:async n=>{const l=await N(`${S}/scheduled-tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to create scheduled task")}return l.json()},onSuccess:()=>{t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.status()})}})},He=()=>{const t=M();return R({mutationFn:async({taskId:n,data:l})=>{const c=await N(`${S}/scheduled-tasks/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok){const g=await c.json().catch(()=>({}));throw new Error(g.error||"Failed to update scheduled task")}return c.json()},onSuccess:n=>{t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.detail(n.id)}),t.invalidateQueries({queryKey:d.status()})}})},Be=()=>{const t=M();return R({mutationFn:async n=>{const l=await N(`${S}/scheduled-tasks/${n}`,{method:"DELETE"});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to delete scheduled task")}},onSuccess:()=>{t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.status()})}})},ze=()=>{const t=M();return R({mutationFn:async n=>{const l=await N(`${S}/scheduled-tasks/${n}/toggle`,{method:"POST"});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to toggle scheduled task")}return l.json()},onSuccess:n=>{t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.detail(n.id)}),t.invalidateQueries({queryKey:d.status()})}})},je=()=>{const t=M();return R({mutationFn:async n=>{const l=await N(`${S}/scheduled-tasks/${n}/run`,{method:"POST"});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to run scheduled task")}return l.json()},onSuccess:(n,l)=>{t.invalidateQueries({queryKey:d.detail(l)}),t.invalidateQueries({queryKey:d.lists()}),t.invalidateQueries({queryKey:d.history(l)})}})},Ue=()=>{const t=M();return R({mutationFn:async n=>{const l=await N(`${S}/scheduled-tasks/executions/${n}/stop`,{method:"POST"});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||"Failed to stop execution")}return l.json()},onSuccess:()=>{t.invalidateQueries({queryKey:d.all})}})},_e=()=>G({queryKey:[...d.all,"running"],queryFn:async()=>{const t=await N(`${S}/scheduled-tasks/running`);if(!t.ok)throw new Error("Failed to fetch running executions");return t.json()},refetchInterval:3e3}),We=()=>{const t=M();return R({mutationFn:async()=>{const n=await N(`${S}/scheduled-tasks/scheduler/enable`,{method:"POST"});if(!n.ok){const l=await n.json().catch(()=>({}));throw new Error(l.error||"Failed to enable scheduler")}return n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:d.status()})}})},Je=()=>{const t=M();return R({mutationFn:async()=>{const n=await N(`${S}/scheduled-tasks/scheduler/disable`,{method:"POST"});if(!n.ok){const l=await n.json().catch(()=>({}));throw new Error(l.error||"Failed to disable scheduler")}return n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:d.status()})}})},Xe=[{label:"每 5 分钟",value:"*/5 * * * *"},{label:"每 15 分钟",value:"*/15 * * * *"},{label:"每 30 分钟",value:"*/30 * * * *"},{label:"每小时",value:"0 * * * *"},{label:"每天 9:00",value:"0 9 * * *"},{label:"每天 18:00",value:"0 18 * * *"},{label:"每周一 9:00",value:"0 9 * * 1"},{label:"每月 1 日 9:00",value:"0 9 1 * *"}],Ge=t=>{if(!t){const n=new Date;return n.setHours(n.getHours()+1),n.setMinutes(0),n.setSeconds(0),n.toISOString().slice(0,16)}return new Date(t).toISOString().slice(0,16)},Ye=t=>new Date(t).toISOString(),Ze=({task:t,agents:n,onSave:l,onCancel:c})=>{const g=!!t,I=Ve(),F=He(),K=je(),{data:V}=Ne(),P=V?.projects||[],{data:x}=Se(),[f,H]=o.useState(t?.name||""),[v,B]=o.useState(t?.description||""),[m,A]=o.useState(t?.agentId||""),[b,O]=o.useState(t?.projectPath||""),[y,s]=o.useState(t?.schedule.type||"interval"),[i,h]=o.useState(t?.schedule.intervalMinutes||30),[p,_]=o.useState(t?.schedule.cronExpression||"*/30 * * * *"),[z,Y]=o.useState(Ge(t?.schedule.executeAt)),[$,Z]=o.useState(t?.triggerMessage||""),[T,ee]=o.useState(t?.enabled??!0),[q,te]=o.useState(!!t?.modelOverride?.modelId),[r,w]=o.useState(t?.modelOverride?.versionId||""),[E,ae]=o.useState(t?.modelOverride?.modelId||""),[re,ne]=o.useState(!1),[se,le]=o.useState(!1),Q=o.useMemo(()=>x?.versions?r?x.versions.find(de=>de.id===r)?.models||[]:(x.versions.find(L=>L.id===x.defaultVersionId)||x.versions[0])?.models||[]:[],[x,r]);o.useEffect(()=>{q&&Q.length>0&&(Q.some(L=>L.id===E)||ae(Q[0].id))},[Q,E,q]),o.useEffect(()=>{!m&&n.length>0&&A(n[0].id)},[m,n]),o.useEffect(()=>{!b&&P.length>0&&O(P[0].path)},[b,P]);const W=()=>y==="interval"?{type:"interval",intervalMinutes:i}:y==="once"?{type:"once",executeAt:Ye(z)}:{type:"cron",cronExpression:p},J=()=>{if(!(!q||!E))return{versionId:r||void 0,modelId:E}},fe=async()=>{if(!f.trim()){u("请输入任务名称");return}if(!m){u("请选择 Agent");return}if(!b){u("请选择项目路径");return}if(!$.trim()){u("请输入触发消息");return}if(y==="interval"&&(!i||i<1)){u("间隔时间必须大于 0");return}if(y==="cron"&&!p.trim()){u("请输入 Cron 表达式");return}if(y==="once"){const a=new Date(z).getTime();if(isNaN(a)){u("请选择有效的执行时间");return}if(a<=Date.now()){u("执行时间必须在未来");return}}ne(!0);try{if(g)await F.mutateAsync({taskId:t.id,data:{name:f.trim(),description:v.trim()||void 0,agentId:m,projectPath:b,schedule:W(),triggerMessage:$.trim(),enabled:T,modelOverride:J()}}),C("任务已更新");else{const a={name:f.trim(),description:v.trim()||void 0,agentId:m,projectPath:b,schedule:W(),triggerMessage:$.trim(),enabled:T,modelOverride:J()};await I.mutateAsync(a),C("任务已创建")}l()}catch{u(g?"更新失败":"创建失败")}finally{ne(!1)}},ke=async()=>{if(!f.trim()){u("请输入任务名称");return}if(!m){u("请选择 Agent");return}if(!b){u("请选择项目路径");return}if(!$.trim()){u("请输入触发消息");return}le(!0);try{let a;if(g)await F.mutateAsync({taskId:t.id,data:{name:f.trim(),description:v.trim()||void 0,agentId:m,projectPath:b,schedule:W(),triggerMessage:$.trim(),enabled:T,modelOverride:J()}}),a=t.id,C("任务已更新");else{const L={name:f.trim(),description:v.trim()||void 0,agentId:m,projectPath:b,schedule:W(),triggerMessage:$.trim(),enabled:T,modelOverride:J()};a=(await I.mutateAsync(L)).id,C("任务已创建")}await K.mutateAsync(a),C("任务已开始执行,请在执行历史中查看结果"),l()}catch{u("操作失败")}finally{le(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-5xl max-h-[90vh] overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:g?"编辑定时任务":"创建定时任务"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"配置 Agent 的自动执行计划"})]}),e.jsx("button",{onClick:c,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(D,{className:"w-5 h-5"}),"基本信息"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"任务名称 *"}),e.jsx("input",{type:"text",value:f,onChange:a=>H(a.target.value),placeholder:"例如:每日代码检查",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"描述"}),e.jsx("input",{type:"text",value:v,onChange:a=>B(a.target.value),placeholder:"可选的任务描述",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(Ce,{className:"w-5 h-5"}),"执行配置"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"执行 Agent *"}),e.jsx("select",{value:m,onChange:a=>A(a.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:n.map(a=>e.jsxs("option",{value:a.id,children:[a.ui?.icon||"🤖"," ",a.name]},a.id))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 flex items-center gap-2",children:[e.jsx(Te,{className:"w-4 h-4"}),"项目路径 *"]}),e.jsx("select",{value:b,onChange:a=>O(a.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:P.map(a=>e.jsx("option",{value:a.path,children:a.name||a.path},a.path))}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Agent 将在此项目目录下执行"})]}),e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"覆盖模型配置"})]}),e.jsx("button",{type:"button",onClick:()=>te(!q),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${q?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${q?"translate-x-5":"translate-x-1"}`})})]}),q&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"可以为定时任务指定不同于 Agent 默认的模型"}),x?.versions&&x.versions.length>1&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:"供应商"}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:r,onChange:a=>w(a.target.value),className:"w-full appearance-none px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[e.jsx("option",{value:"",children:x.defaultVersionId?`默认 (${x.versions.find(a=>a.id===x.defaultVersionId)?.name})`:"默认"}),x.versions.filter(a=>a.id!==x.defaultVersionId).map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]}),e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none text-gray-500",children:e.jsx(he,{className:"w-4 h-4"})})]})]}),Q.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-500 dark:text-gray-400 mb-1",children:"模型"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Q.map(a=>e.jsxs("button",{type:"button",onClick:()=>ae(a.id),className:`flex items-center justify-between px-3 py-2 text-sm rounded-lg border transition-all ${E===a.id?"border-purple-500 bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300 shadow-sm":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 text-gray-700 dark:text-gray-300"}`,children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ie,{className:"w-4 h-4 opacity-70"}),e.jsx("span",{className:"font-medium",children:a.name})]}),a.isVision&&e.jsx("span",{className:"text-xs bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded text-gray-500",children:"Vision"})]},a.id))})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(D,{className:"w-5 h-5"}),"调度规则"]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"radio",name:"scheduleType",value:"interval",checked:y==="interval",onChange:()=>s("interval"),className:"mr-2"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:"间隔执行"})]}),e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"radio",name:"scheduleType",value:"cron",checked:y==="cron",onChange:()=>s("cron"),className:"mr-2"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:"Cron 表达式"})]}),e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"radio",name:"scheduleType",value:"once",checked:y==="once",onChange:()=>s("once"),className:"mr-2"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:"仅执行一次"})]})]}),y==="interval"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"间隔时间(分钟)"}),e.jsx("input",{type:"number",min:1,max:10080,value:i,onChange:a=>h(parseInt(a.target.value)||30),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsxs("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:["每隔 ",i," 分钟执行一次"]})]}),y==="cron"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Cron 表达式"}),e.jsx("input",{type:"text",value:p,onChange:a=>_(a.target.value),placeholder:"*/30 * * * *",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white font-mono focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Xe.map(a=>e.jsx("button",{type:"button",onClick:()=>_(a.value),className:`px-2 py-1 text-xs rounded-full border transition-colors ${p===a.value?"bg-blue-100 border-blue-300 text-blue-700 dark:bg-blue-900 dark:border-blue-700 dark:text-blue-300":"bg-gray-50 border-gray-200 text-gray-600 hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700"}`,children:a.label},a.value))})]}),y==="once"&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1 flex items-center gap-2",children:[e.jsx(Ee,{className:"w-4 h-4"}),"执行时间"]}),e.jsx("input",{type:"datetime-local",value:z,onChange:a=>Y(a.target.value),min:new Date().toISOString().slice(0,16),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"任务将在指定时间执行一次后自动禁用"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-lg font-medium text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(me,{className:"w-5 h-5"}),"触发消息"]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"发送给 Agent 的消息 *"}),e.jsx("textarea",{value:$,onChange:a=>Z(a.target.value),placeholder:"请检查代码质量并生成报告...",rows:5,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-y"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"定时触发时,这条消息会发送给选定的 Agent"})]})]}),e.jsxs("div",{className:"flex items-center justify-between py-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"启用任务"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"创建后立即开始调度"})]}),e.jsx("button",{type:"button",onClick:()=>ee(!T),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${T?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${T?"translate-x-6":"translate-x-1"}`})})]}),e.jsxs("div",{className:"flex justify-between pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("button",{onClick:c,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",children:"取消"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:ke,disabled:re||se,className:"inline-flex items-center px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors disabled:opacity-50",title:"保存任务并立即执行一次",children:[e.jsx(ye,{className:"w-4 h-4 mr-2"}),se?"执行中...":"保存并执行"]}),e.jsxs("button",{onClick:fe,disabled:re||se,className:"inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50",children:[e.jsx(Ie,{className:"w-4 h-4 mr-2"}),re?"保存中...":"保存"]})]})]})]})})]})})},et=({taskId:t,taskName:n,agentId:l,projectPath:c,onBack:g})=>{const{data:I=[],isLoading:F}=Qe(t),[K,V]=o.useState(new Set),P=s=>{V(i=>{const h=new Set(i);return h.has(s)?h.delete(s):h.add(s),h})},x=s=>s?new Date(s).toLocaleString("zh-CN"):"-",f=s=>new Date(s).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),H=s=>{if(!s.completedAt)return"-";const i=new Date(s.startedAt).getTime(),p=new Date(s.completedAt).getTime()-i;return p<1e3?`${p}ms`:p<6e4?`${(p/1e3).toFixed(1)}s`:`${Math.floor(p/6e4)}m ${Math.floor(p%6e4/1e3)}s`},v=s=>{switch(s){case"running":return e.jsx(X,{className:"w-5 h-5 text-blue-500 animate-spin"});case"success":return e.jsx(be,{className:"w-5 h-5 text-green-500"});case"error":return e.jsx(pe,{className:"w-5 h-5 text-red-500"});default:return e.jsx(D,{className:"w-5 h-5 text-gray-400"})}},B=s=>{switch(s){case"running":return e.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"运行中"});case"success":return e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"成功"});case"error":return e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"失败"});default:return e.jsx("span",{className:"text-gray-500",children:"未知"})}},m=s=>{switch(s){case"error":return"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20";case"warn":return"text-yellow-600 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-900/20";case"info":return"text-blue-600 dark:text-blue-400";case"debug":return"text-gray-500 dark:text-gray-400";default:return"text-gray-600 dark:text-gray-400"}},A=s=>{switch(s){case"system":return"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400";case"assistant":return"bg-blue-100 text-blue-600 dark:bg-blue-900 dark:text-blue-400";case"tool_use":return"bg-purple-100 text-purple-600 dark:bg-purple-900 dark:text-purple-400";case"result":return"bg-green-100 text-green-600 dark:bg-green-900 dark:text-green-400";case"error":return"bg-red-100 text-red-600 dark:bg-red-900 dark:text-red-400";default:return"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"}},b=s=>{const i=s.agentId||l,h=s.projectPath||c;if(!i||!s.sessionId)return null;let p=`/chat/${encodeURIComponent(i)}?session=${encodeURIComponent(s.sessionId)}`;return h&&(p+=`&project=${encodeURIComponent(h)}`),p},O=(s,i)=>{i.stopPropagation();const h=b(s);h&&window.open(h,"_blank")},y=s=>!s||s.length===0?e.jsx("div",{className:"text-center py-4 text-gray-500 dark:text-gray-400",children:"暂无执行日志"}):e.jsx("div",{className:"space-y-1 max-h-96 overflow-y-auto",children:s.map((i,h)=>e.jsxs("div",{className:`flex items-start gap-2 px-3 py-1.5 rounded text-sm font-mono ${m(i.level)}`,children:[e.jsx("span",{className:"text-gray-400 dark:text-gray-500 shrink-0 w-24",children:f(i.timestamp)}),e.jsx("span",{className:`px-1.5 py-0.5 rounded text-xs shrink-0 ${A(i.type)}`,children:i.type}),e.jsx("span",{className:"flex-1 break-all whitespace-pre-wrap",children:i.message})]},h))});return e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("button",{onClick:g,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",children:e.jsx(Ae,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"执行历史"}),e.jsxs("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:["任务:",n]})]})]}),F?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(X,{className:"w-8 h-8 animate-spin text-gray-400"})}):I.length===0?e.jsxs("div",{className:"text-center py-12 bg-gray-50 dark:bg-gray-800 rounded-lg",children:[e.jsx(D,{className:"w-12 h-12 mx-auto text-gray-400 mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"暂无执行记录"}),e.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"任务尚未执行过"})]}):e.jsx("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(xe,{children:[e.jsx(ue,{children:e.jsxs(U,{children:[e.jsx(k,{className:"w-[40px]"}),e.jsx(k,{className:"w-[80px]",children:"状态"}),e.jsx(k,{children:"开始时间"}),e.jsx(k,{children:"完成时间"}),e.jsx(k,{children:"耗时"}),e.jsx(k,{children:"结果摘要"}),e.jsx(k,{className:"w-[100px]",children:"操作"})]})}),e.jsx(ge,{children:I.map(s=>e.jsxs(ve.Fragment,{children:[e.jsxs(U,{className:"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800",onClick:()=>P(s.id),children:[e.jsx(j,{className:"p-2",children:e.jsx("button",{className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",children:K.has(s.id)?e.jsx(he,{className:"w-4 h-4 text-gray-500"}):e.jsx($e,{className:"w-4 h-4 text-gray-500"})})}),e.jsx(j,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[v(s.status),B(s.status)]})}),e.jsx(j,{children:e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:x(s.startedAt)})}),e.jsx(j,{children:e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:x(s.completedAt)})}),e.jsx(j,{children:e.jsx("span",{className:"text-sm font-mono text-gray-600 dark:text-gray-400",children:H(s)})}),e.jsx(j,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.logs&&s.logs.length>0&&e.jsx("span",{title:"有详细日志",children:e.jsx(ce,{className:"w-4 h-4 text-gray-400 shrink-0"})}),s.error?e.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 max-w-md truncate",children:s.error}):s.responseSummary?e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400 max-w-md truncate",children:s.responseSummary}):e.jsx("span",{className:"text-sm text-gray-400",children:"-"})]})}),e.jsx(j,{children:s.sessionId&&b(s)&&e.jsx("button",{onClick:i=>O(s,i),className:"inline-flex items-center justify-center p-2 text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded transition-colors",title:"在新窗口继续会话",children:e.jsx(me,{className:"w-4 h-4"})})})]}),K.has(s.id)&&e.jsx(U,{children:e.jsx(j,{colSpan:7,className:"bg-gray-50 dark:bg-gray-800/50 p-4",children:e.jsxs("div",{className:"space-y-3",children:[s.errorStack&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("h4",{className:"text-sm font-medium text-red-700 dark:text-red-400 mb-2",children:"错误堆栈"}),e.jsx("pre",{className:"text-xs text-red-600 dark:text-red-400 whitespace-pre-wrap overflow-x-auto",children:s.errorStack})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[e.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2",children:[e.jsx(ce,{className:"w-4 h-4"}),"执行日志",s.logs&&e.jsxs("span",{className:"text-xs text-gray-400",children:["(",s.logs.length," 条)"]})]}),y(s.logs)]}),s.sessionId&&e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Session ID: ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded",children:s.sessionId})]})]})})})]},s.id))})]})})]})},ut=()=>{const t=M(),{data:n=[],isLoading:l}=Oe(),{data:c}=we(!0),{data:g}=Le(),I=Be(),F=ze(),K=je(),V=Ue(),{data:P}=_e(),x=We(),f=Je(),[H,v]=o.useState(null),[B,m]=o.useState(!1),[A,b]=o.useState(null),O=r=>P?.executions?.find(E=>E.taskId===r)?.executionId||null,y=c?.agents||[],s=r=>y.find(E=>E.id===r)?.name||r,i=r=>{if(r.schedule.type==="interval"&&r.schedule.intervalMinutes){const w=r.schedule.intervalMinutes;return w<60?`每 ${w} 分钟`:`每 ${Math.floor(w/60)} 小时`}return r.schedule.type==="cron"&&r.schedule.cronExpression?r.schedule.cronExpression:r.schedule.type==="once"&&r.schedule.executeAt?`一次性 @ ${new Date(r.schedule.executeAt).toLocaleString("zh-CN")}`:"-"},h=r=>r?new Date(r).toLocaleString("zh-CN"):"-",p=async r=>{try{await F.mutateAsync(r.id),C(r.enabled?"任务已暂停":"任务已启用")}catch{u("操作失败")}},_=async r=>{if(confirm(`确定要删除任务 "${r.name}" 吗?`))try{await I.mutateAsync(r.id),C("任务已删除")}catch{u("删除失败")}},z=async r=>{try{await K.mutateAsync(r.id),C("任务已开始执行"),t.invalidateQueries({queryKey:d.lists()})}catch{u("执行失败")}},Y=async r=>{const w=O(r.id);if(!w){u("找不到正在运行的执行");return}try{await V.mutateAsync(w),C("任务已停止"),t.invalidateQueries({queryKey:d.lists()})}catch{u("停止失败")}},$=async()=>{if(g)try{g.enabled?(await f.mutateAsync(),C("调度器已禁用")):(await x.mutateAsync(),C("调度器已启用"))}catch{u("操作失败")}},Z=r=>{v(r),m(!0)},T=()=>{v(null),m(!0)},ee=()=>{v(null),m(!1),t.invalidateQueries({queryKey:d.lists()})},q=()=>{v(null),m(!1)},te=r=>r.lastRunStatus==="running"?e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:[e.jsx(X,{className:"w-3 h-3 mr-1 animate-spin"}),"运行中"]}):r.lastRunStatus==="success"?e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:[e.jsx(be,{className:"w-3 h-3 mr-1"}),"成功"]}):r.lastRunStatus==="error"?e.jsxs("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",children:[e.jsx(pe,{className:"w-3 h-3 mr-1"}),"失败"]}):e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400",children:"未执行"});if(A){const r=n.find(w=>w.id===A);return e.jsx(et,{taskId:A,taskName:r?.name||A,agentId:r?.agentId,projectPath:r?.projectPath,onBack:()=>b(null)})}return e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(D,{className:"w-8 h-8"}),"定时任务"]}),e.jsx("p",{className:"mt-2 text-gray-600 dark:text-gray-400",children:"配置 Agent 的自动执行计划"})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[g&&e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("button",{onClick:$,disabled:x.isPending||f.isPending,className:`flex items-center gap-2 px-3 py-1.5 rounded-lg transition-colors ${g.enabled?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 hover:bg-green-100 dark:hover:bg-green-900/30":"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 hover:bg-orange-100 dark:hover:bg-orange-900/30"} ${x.isPending||f.isPending?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,title:g.enabled?"点击禁用调度器":"点击启用调度器",children:[e.jsx(D,{className:`w-4 h-4 ${x.isPending||f.isPending?"animate-pulse":""}`}),e.jsx("span",{className:"font-medium",children:g.enabled?"调度器已启用":"调度器已禁用"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[e.jsx(qe,{className:"w-4 h-4"}),e.jsxs("span",{children:["活跃: ",g.activeTaskCount," / 运行中: ",g.runningTaskCount]})]})]}),e.jsxs("button",{onClick:T,className:"inline-flex items-center px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(oe,{className:"w-5 h-5 mr-2"}),"新建任务"]})]})]}),l?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(X,{className:"w-8 h-8 animate-spin text-gray-400"})}):n.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx(D,{className:"w-16 h-16 mx-auto text-gray-400 mb-4"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:"暂无定时任务"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"创建定时任务来让 Agent 自动执行工作"}),e.jsxs("button",{onClick:T,className:"inline-flex items-center px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(oe,{className:"w-5 h-5 mr-2"}),"创建第一个任务"]})]}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(xe,{children:[e.jsx(ue,{children:e.jsxs(U,{children:[e.jsx(k,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"状态"}),e.jsx(k,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"任务名称"}),e.jsx(k,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Agent"}),e.jsx(k,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"调度规则"}),e.jsx(k,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"上次执行"}),e.jsx(k,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"下次执行"}),e.jsx(k,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:"操作"})]})}),e.jsx(ge,{children:n.map(r=>e.jsxs(U,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(j,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("button",{onClick:()=>p(r),className:`p-1 rounded-full transition-colors ${r.enabled?"text-green-600 hover:bg-green-100 dark:hover:bg-green-900":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:r.enabled?"点击暂停":"点击启用",children:r.enabled?e.jsx(ye,{className:"w-5 h-5 fill-current"}):e.jsx(Me,{className:"w-5 h-5"})})}),e.jsx(j,{className:"px-6 py-4",children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:r.name}),r.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-[200px]",children:r.description})]})}),e.jsx(j,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:s(r.agentId)})}),e.jsx(j,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"text-sm font-mono text-gray-600 dark:text-gray-400",children:i(r)})}),e.jsx(j,{className:"px-6 py-4",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[te(r),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:h(r.lastRunAt)})]})}),e.jsx(j,{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:r.enabled?h(r.nextRunAt):"-"})}),e.jsx(j,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.lastRunStatus==="running"?e.jsx("button",{onClick:()=>Y(r),className:"p-2 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900 rounded-lg transition-colors",title:"停止执行",children:e.jsx(Pe,{className:"w-4 h-4"})}):e.jsx("button",{onClick:()=>z(r),className:"p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900 rounded-lg transition-colors",title:"立即执行",children:e.jsx(Re,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>b(r.id),className:"p-2 text-gray-500 hover:text-purple-600 hover:bg-purple-50 dark:hover:bg-purple-900 rounded-lg transition-colors",title:"执行历史",children:e.jsx(De,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>Z(r),className:"p-2 text-gray-500 hover:text-green-600 hover:bg-green-50 dark:hover:bg-green-900 rounded-lg transition-colors",title:"编辑",children:e.jsx(Fe,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>_(r),className:"p-2 text-gray-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900 rounded-lg transition-colors",title:"删除",children:e.jsx(Ke,{className:"w-4 h-4"})})]})})]},r.id))})]})}),B&&e.jsx(Ze,{task:H,agents:y,onSave:ee,onCancel:q})]})};export{ut as ScheduledTasksPage,ut as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./data-structures-C0h9Oap1.js";import{u as i,O as r}from"./index-Bn3v3S9-.js";import"./monaco-editor-DHKm5-VF.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-ChrA1R0y.js";import"./tools-IcPNZlPj.js";import"./ui-components-D1St49qC.js";const l=()=>{const{isMobile:o}=i();return t.jsx("div",{className:o?"p-4":"p-8",children:t.jsx("div",{children:t.jsx(r,{})})})};export{l as SettingsLayout};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./data-structures-C0h9Oap1.js";import{r as c}from"./monaco-editor-DHKm5-VF.js";import{T as ge,a as be,b as Z,c as q,d as fe,e as O}from"./table-D0L2RL5i.js";import{g as ye,a as f,b as te,u as X,c as V,A as _}from"./agents-ChrA1R0y.js";import{U as ke}from"./UnifiedToolSelector-CNbPsiuq.js";import{u as J}from"./tools-IcPNZlPj.js";import{a2 as we,e as je,aB as ve,X as Q,p as ae,g as Ne,E as Se,f as Te,u as Ce,v as Fe}from"./ui-components-D1St49qC.js";import{B as z}from"./Button-Co56C389.js";import{F as $e}from"./FileExplorer-DNYj6Tsx.js";import{T as Ee}from"./ToolsList-Dl5F2fWk.js";import"./syntax-highlighting-CnREyncB.js";import"./index-Bn3v3S9-.js";class De{baseURL=`${ye()}/skills`;async getAllSkills(r){const s=new URLSearchParams;r?.scope&&s.append("scope",r.scope),r?.includeDisabled&&s.append("includeDisabled","true");const l=await f(`${this.baseURL}?${s.toString()}`);if(!l.ok)throw new Error(`Failed to fetch skills: ${l.statusText}`);const o=await l.json();return this.transformToSkillListItems(o.skills)}async getSkill(r,s){const l=s?`?scope=${s}`:"",o=await f(`${this.baseURL}/${r}${l}`);if(o.status===404)return null;if(!o.ok)throw new Error(`Failed to fetch skill: ${o.statusText}`);return(await o.json()).skill}async createSkill(r){const s=await f(`${this.baseURL}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to create skill")}return(await s.json()).skill}async updateSkill(r,s){const l=await f(`${this.baseURL}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!l.ok){const x=await l.json();throw new Error(x.error||"Failed to update skill")}return(await l.json()).skill}async deleteSkill(r,s){const l=s?`?scope=${s}`:"",o=await f(`${this.baseURL}/${r}${l}`,{method:"DELETE"});if(o.status===404)return!1;if(!o.ok)throw new Error(`Failed to delete skill: ${o.statusText}`);return!0}async getSkillDirectoryInfo(r){const s=await f(`${this.baseURL}/${r}/directory`);if(s.status===404)return null;if(!s.ok)throw new Error(`Failed to fetch skill directory info: ${s.statusText}`);return(await s.json()).directoryInfo}async validateSkillManifest(r){const s=await f(`${this.baseURL}/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r})});if(!s.ok)throw new Error(`Failed to validate skill manifest: ${s.statusText}`);return await s.json()}async getSkillFile(r,s){const l=await f(`${this.baseURL}/${r}/files/${s}`);if(!l.ok)throw new Error(`Failed to fetch skill file: ${l.statusText}`);return(await l.json()).content}async updateSkillFile(r,s,l){const o=await f(`${this.baseURL}/${r}/files/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})});if(!o.ok)throw new Error(`Failed to update skill file: ${o.statusText}`)}transformToSkillListItems(r){return r.map(s=>({id:s.id,name:s.name,description:s.description,scope:s.scope,projectName:s.scope==="project"?"Current Project":void 0,source:s.source,enabled:s.enabled,createdAt:s.createdAt,updatedAt:s.updatedAt,allowedTools:s.allowedTools,toolCount:s.allowedTools?.length||0,usageCount:0,lastUsed:void 0}))}}const A=new De,y={all:["skills"],lists:()=>[...y.all,"list"],list:a=>[...y.lists(),a],details:()=>[...y.all,"detail"],detail:a=>[...y.details(),a],directory:a=>[...y.all,"directory",a]},Le=a=>te({queryKey:y.list(a||{}),queryFn:()=>A.getAllSkills(a),staleTime:300*1e3}),Me=(a,r)=>te({queryKey:y.detail(a),queryFn:()=>A.getSkill(a,r),enabled:!!a,staleTime:300*1e3}),Pe=()=>{const a=X();return V({mutationFn:r=>A.createSkill(r),onSuccess:r=>{a.invalidateQueries({queryKey:y.lists()}),a.setQueryData(y.detail(r.id),r)},onError:r=>{console.error("Failed to create skill:",r)}})},Ae=()=>{const a=X();return V({mutationFn:({skillId:r,updates:s})=>A.updateSkill(r,s),onSuccess:r=>{a.setQueryData(y.detail(r.id),r),a.invalidateQueries({queryKey:y.lists()})},onError:r=>{console.error("Failed to update skill:",r)}})},Ie=()=>{const a=X();return V({mutationFn:({skillId:r,scope:s})=>A.deleteSkill(r,s),onSuccess:(r,{skillId:s})=>{a.removeQueries({queryKey:y.detail(s)}),a.invalidateQueries({queryKey:y.lists()})},onError:r=>{console.error("Failed to delete skill:",r)}})},Re=()=>V({mutationFn:a=>A.validateSkillManifest(a),onError:a=>{console.error("Failed to validate skill manifest:",a)}}),Ue=({onClose:a,onSuccess:r,editSkill:s})=>{const{t:l}=J(["skills","common"]),o=!!s,[x,p]=c.useState("basic"),[n,h]=c.useState({name:"",description:"",allowedTools:[],content:"",additionalFiles:[]}),[m,j]=c.useState([]),[k,F]=c.useState(""),[$,M]=c.useState(!1),[S,E]=c.useState([]),[g,v]=c.useState([]),[T,I]=c.useState(!1),P=Pe(),R=Ae(),U=Re(),B=Me(s?.id||"",s?.scope||"user"),C=o?B.data:null,K=o?B.isLoading:!1,[d,N]=c.useState(0),[H,D]=c.useState(0),[L,Y]=c.useState(!1);c.useEffect(()=>{if(!L){const t=[...S];T&&t.push(...g),h(i=>({...i,allowedTools:t})),N(Date.now())}},[S,g,T,L]),c.useEffect(()=>{!L&&(n.name||n.description)&&N(Date.now())},[n.name,n.description,L]),c.useEffect(()=>{!L&&n.content&&D(Date.now())},[n.content,L]),c.useEffect(()=>{if(o&&C){h({name:C.name,description:C.description,allowedTools:C.allowedTools||[],content:"",additionalFiles:(C.files||[]).filter(u=>!u.path.endsWith("SKILL.md")).map(u=>({id:Math.random().toString(36).substr(2,9),name:u.name,path:u.path,type:u.type,content:""}))});const t=C.allowedTools||[],i=t.filter(u=>!u.startsWith("mcp__")),b=t.filter(u=>u.startsWith("mcp__"));E(i),v(b),I(b.length>0),(async()=>{try{const u=await fetch(`/api/skills/${s.id}/files/SKILL.md`);if(u.ok){const he=await u.json();h(pe=>({...pe,content:he.content})),D(Date.now())}}catch(u){console.error("Failed to load skill manifest:",u)}})()}},[o,C,s]),c.useEffect(()=>{if(n.content){const i=setTimeout(async()=>{try{const b=await U.mutateAsync(n.content);j(b.errors.map(w=>w.message)||[])}catch{j(["Validation failed"])}},500);return()=>clearTimeout(i)}},[n.content,U]);const se=async()=>{try{if(o){const t={name:n.name,description:n.description,allowedTools:n.allowedTools,content:n.content,additionalFiles:n.additionalFiles.map(i=>({name:i.name,path:i.path,type:i.type,content:i.content}))};await R.mutateAsync({skillId:s.id,updates:t})}else{const t={name:n.name,description:n.description,scope:"user",allowedTools:n.allowedTools,content:n.content,additionalFiles:n.additionalFiles.map(i=>({name:i.name,path:i.path,type:i.type,content:i.content}))};await P.mutateAsync(t)}r()}catch(t){console.error(o?"Failed to update skill:":"Failed to create skill:",t),alert(l(o?"errors.updateFailed":"errors.createFailed"))}},re=()=>{const t={id:Math.random().toString(36).substr(2,9),name:"New File",path:"new-file.md",type:"markdown",content:""};h(i=>({...i,additionalFiles:[...i.additionalFiles,t]}))},le=t=>{h(i=>({...i,additionalFiles:i.additionalFiles.filter(b=>b.id!==t)}))},W=(t,i)=>{h(b=>({...b,additionalFiles:b.additionalFiles.map(w=>w.id===t?{...w,...i}:w)}))},ne=n.name.trim()!==""&&!k&&n.description.trim()!==""&&n.content.trim()!==""&&m.length===0,oe=()=>{switch(x){case"basic":return n.name.trim()!==""&&!k&&n.description.trim()!=="";case"manifest":return n.content.trim()!==""&&m.length===0;case"files":return!0;default:return!1}},G=()=>{if(!L){if(Y(!0),d>H){if(n.name&&n.description){const t=ee(n.name,n.description,n.allowedTools);h(i=>({...i,content:t})),D(Date.now())}}else if(H>d){const t=Be(n.content);if(t&&(t.name&&t.name!==n.name||t.description&&t.description!==n.description||t.allowedTools&&JSON.stringify(t.allowedTools)!==JSON.stringify(n.allowedTools))){h(u=>({...u,name:t.name||u.name,description:t.description||u.description,allowedTools:t.allowedTools||u.allowedTools}));const b=(t.allowedTools||[]).filter(u=>!u.startsWith("mcp__")),w=(t.allowedTools||[]).filter(u=>u.startsWith("mcp__"));E(b),v(w),I(w.length>0),N(Date.now())}}else if(!n.content&&n.name&&n.description){const t=ee(n.name,n.description,n.allowedTools);h(i=>({...i,content:t})),D(Date.now())}setTimeout(()=>Y(!1),100)}},ie=()=>{G(),x==="basic"?p("manifest"):x==="manifest"&&p("files")},de=t=>{G(),p(t)},ce=[{id:"basic",label:l("create.tabs.basic"),icon:we},{id:"manifest",label:l("create.tabs.manifest"),icon:je},{id:"files",label:l("create.tabs.files"),icon:ve}],xe=t=>t?t.length>64?"技能名称不能超过64个字符":/^[a-z0-9-]+$/.test(t)?t.startsWith("-")||t.endsWith("-")?"不能以连字符开始或结束":t.includes("--")?"不能包含连续的连字符":"":"只能使用小写字母、数字和连字符":"",ue=t=>{h(i=>({...i,name:t})),F(xe(t))},me=t=>{t.key==="Escape"&&a()};return o&&K?e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsx("div",{className:"bg-white rounded-lg p-6 w-full max-w-md",children:e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})})}):e.jsxs("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onKeyDown:me,children:[e.jsxs("div",{className:"bg-white rounded-lg w-full max-w-3xl max-h-[90vh] overflow-hidden flex flex-col dark:bg-gray-800 dark:text-white",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:o?`编辑技能 - ${s?.name}`:l("create.title")}),e.jsx("p",{className:"text-sm text-gray-600 mt-1 dark:text-gray-300",children:o?"修改现有技能的配置和功能":l("create.subtitle")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[x!=="files"?e.jsx("button",{onClick:ie,disabled:!oe(),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors dark:bg-blue-500 dark:hover:bg-blue-600",children:l("common:actions.next")}):e.jsx("button",{onClick:se,disabled:!ne||P.isPending||R.isPending,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors dark:bg-blue-500 dark:hover:bg-blue-600",children:P.isPending||R.isPending?l("common:status.saving"):l(o?"common:actions.save":"common:actions.create")}),e.jsx("button",{onClick:a,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-lg transition-colors dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700",children:e.jsx(Q,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:ce.map(t=>{const i=t.icon,b=x===t.id,w=t.id==="basic"&&n.name.trim()!==""&&n.description.trim()!==""||t.id==="manifest"&&n.content.trim()!==""&&m.length===0||t.id==="files";return e.jsxs("button",{onClick:()=>de(t.id),className:`flex items-center gap-2 px-6 py-3 font-medium text-sm transition-colors ${b?"text-blue-600 border-b-2 border-blue-600 dark:text-blue-400 dark:border-blue-400":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,children:[e.jsx(i,{className:"w-4 h-4"}),t.label,w&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"})]},t.id)})}),e.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[x==="basic"&&e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:"技能名称 (Slug)"}),e.jsx("input",{type:"text",value:n.name,onChange:t=>ue(t.target.value),disabled:o,className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-400 dark:focus:border-blue-400 font-mono ${o?"bg-gray-100 text-gray-500 cursor-not-allowed dark:bg-gray-600 dark:text-gray-400":k?"border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300"}`,placeholder:"my-awesome-skill"}),k?e.jsx("p",{className:"text-xs text-red-500 mt-1 dark:text-red-400",children:k}):e.jsx("p",{className:"text-xs text-gray-500 mt-1 dark:text-gray-400",children:o?"技能名称在编辑模式下不能修改":"只能使用小写字母、数字和连字符,最多64个字符"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:l("create.basic.description")}),e.jsx("textarea",{value:n.description,onChange:t=>{h(i=>({...i,description:t.target.value}))},rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none resize-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.basic.descriptionPlaceholder")}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 dark:text-gray-400",children:l("create.basic.descriptionHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:l("create.basic.allowedTools")}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{type:"button",onClick:()=>M(!$),className:"px-3 py-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 rounded-lg transition-colors text-sm",children:l("create.basic.selectTools")}),(S.length>0||g.length>0)&&e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["常规工具 ",S.length," 个",g.length>0&&`, MCP工具 ${g.length} 个`]})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 dark:text-gray-400",children:l("create.basic.allowedToolsHint")})]})]}),x==="manifest"&&e.jsx("div",{className:"space-y-6 max-w-2xl",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2 dark:text-gray-300",children:l("create.content.skillManifest")}),e.jsx("textarea",{value:n.content,onChange:t=>h(i=>({...i,content:t.target.value})),rows:15,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none font-mono text-sm resize-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400"}),m.length>0&&e.jsxs("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-lg dark:bg-red-900/20 dark:border-red-800",children:[e.jsxs("h4",{className:"text-sm font-medium text-red-800 mb-1 dark:text-red-400",children:[l("editor.errors.validationErrors"),":"]}),e.jsx("ul",{className:"text-sm text-red-700 space-y-1 dark:text-red-300",children:m.map((t,i)=>e.jsxs("li",{children:["• ",t]},i))})]})]})}),x==="files"&&e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:l("create.content.additionalFiles")}),e.jsxs("button",{onClick:re,className:"flex items-center gap-2 px-3 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors dark:bg-green-500 dark:hover:bg-green-600",children:[e.jsx(ae,{className:"w-4 h-4"}),l("create.content.addFile")]})]}),n.additionalFiles.length===0?e.jsxs("div",{className:"text-center py-8 border-2 border-dashed border-gray-300 rounded-lg",children:[e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:l("create.content.noFiles")}),e.jsx("p",{className:"text-sm text-gray-500 mt-1 dark:text-gray-400",children:l("create.content.noFilesHint")})]}):e.jsx("div",{className:"space-y-4",children:n.additionalFiles.map(t=>e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("input",{type:"text",value:t.name,onChange:i=>W(t.id,{name:i.target.value}),className:"flex-1 px-2 py-1 border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.content.fileName")}),e.jsx("input",{type:"text",value:t.path,onChange:i=>W(t.id,{path:i.target.value}),className:"flex-1 px-2 py-1 border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none font-mono text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.content.filePath")}),e.jsxs("select",{value:t.type,onChange:i=>W(t.id,{type:i.target.value}),className:"px-2 py-1 border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-400 dark:focus:border-blue-400",children:[e.jsx("option",{value:"markdown",children:l("create.content.fileType.markdown")}),e.jsx("option",{value:"text",children:l("create.content.fileType.text")}),e.jsx("option",{value:"script",children:l("create.content.fileType.script")}),e.jsx("option",{value:"template",children:l("create.content.fileType.template")}),e.jsx("option",{value:"other",children:l("create.content.fileType.other")})]})]}),e.jsx("button",{onClick:()=>le(t.id),className:"p-1 text-red-500 hover:text-red-700 hover:bg-red-50 rounded transition-colors dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20",children:e.jsx(Q,{className:"w-4 h-4"})})]}),e.jsx("textarea",{value:t.content,onChange:i=>W(t.id,{content:i.target.value}),rows:6,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none font-mono text-sm resize-none dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-400 dark:focus:border-blue-400",placeholder:l("create.content.fileContent")})]},t.id))})]})]})]}),e.jsx(ke,{isOpen:$,onClose:()=>M(!1),selectedRegularTools:S,onRegularToolsChange:E,selectedMcpTools:g,onMcpToolsChange:v,mcpToolsEnabled:T,onMcpEnabledChange:I})]})};function Be(a){try{const r=a.match(/^---\s*\n(.*?)\n---/s);if(!r)return null;const l=r[1].split(`
|
|
2
|
-
`),o={};for(const x of l){const p=x.trim();if(p.startsWith("name:"))o.name=p.replace("name:","").trim();else if(p.startsWith("description:"))o.description=p.replace("description:","").trim();else if(p.startsWith("allowed-tools:")){const n=p.replace("allowed-tools:","").trim();if(n.startsWith("[")&&n.endsWith("]")){const h=n.slice(1,-1).split(",").map(m=>m.trim().replace(/^"(.*)"$/,"$1")).filter(m=>m.length>0);o.allowedTools=h}}}return o}catch(r){return console.error("Failed to parse skill content:",r),null}}function ee(a,r,s){const l=s.length>0?`
|
|
3
|
-
allowed-tools: [${s.map(x=>`"${x}"`).join(", ")}]`:"",o=a.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" ");return`---
|
|
4
|
-
name: ${a}
|
|
5
|
-
description: ${r}${l}
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# ${o}
|
|
9
|
-
|
|
10
|
-
## Description
|
|
11
|
-
${r}
|
|
12
|
-
|
|
13
|
-
## Instructions
|
|
14
|
-
Provide clear, step-by-step guidance for Claude on how to use this skill.
|
|
15
|
-
|
|
16
|
-
## Examples
|
|
17
|
-
Show concrete examples of using this skill.
|
|
18
|
-
`}const Ke=({skill:a,onClose:r})=>{const{t:s}=J("skills"),[l,o]=c.useState(""),[x,p]=c.useState(!0),[n,h]=c.useState([]);return c.useEffect(()=>{(async()=>{try{p(!0);const j=await f(`${_}/skills/${a.id}/files/SKILL.md`);if(j.ok){const F=await j.json();o(F.content)}const k=await f(`${_}/skills/${a.id}?scope=${a.scope}`);if(k.ok){const S=((await k.json()).skill?.files||[]).filter(g=>!g.path.endsWith("SKILL.md")),E=await Promise.all(S.map(async g=>{try{const v=await f(`${_}/skills/${a.id}/files/${g.path}`);if(v.ok){const T=await v.json();return{name:g.path,content:T.content}}}catch(v){console.error(`Failed to load file ${g.path}:`,v)}return null}));h(E.filter(Boolean))}}catch(j){console.error("Failed to load skill content:",j)}finally{p(!1)}})()},[a.id,a.scope]),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 shadow-xl max-w-4xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:a.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",children:s("scope.user")}),e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",children:a.source==="plugin"?s("source.plugin"):s("source.local")})]})]}),e.jsx(z,{variant:"ghost",onClick:r,className:"ml-4",children:e.jsx(Q,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:x?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("detail.description")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:a.description})]}),a.allowedTools&&a.allowedTools.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("detail.allowedTools")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.allowedTools.map(m=>e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md text-xs font-mono bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",children:m},m))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"SKILL.md"}),e.jsx("pre",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 text-sm overflow-x-auto",children:e.jsx("code",{className:"text-gray-800 dark:text-gray-200",children:l})})]}),n.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("detail.additionalFiles")}),e.jsx("div",{className:"space-y-4",children:n.map(m=>e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:m.name}),e.jsx("pre",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 text-sm overflow-x-auto",children:e.jsx("code",{className:"text-gray-800 dark:text-gray-200",children:m.content})})]},m.name))})]})]})}),e.jsx("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex justify-end",children:e.jsx(z,{variant:"outline",onClick:r,children:s("detail.close")})})]})})},We=({isOpen:a,onClose:r,skillName:s,installPath:l})=>{const{t:o}=J("skills");return a?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 shadow-xl max-w-[1200px] w-full h-[90vh] overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:[s," - ",o("detail.files")]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:l})]}),e.jsx(z,{variant:"ghost",onClick:r,className:"ml-4",children:e.jsx(Q,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:e.jsx($e,{projectPath:l,onFileSelect:x=>{console.log("Selected file:",x)},className:"h-full"})}),e.jsx("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex justify-end",children:e.jsx(z,{variant:"outline",onClick:r,children:o("detail.close")})})]})}):null},qe=()=>{const{t:a}=J("skills"),[r,s]=c.useState(""),[l,o]=c.useState(null),[x,p]=c.useState(!1),[n,h]=c.useState(!1),[m,j]=c.useState(null),[k,F]=c.useState(!1),[$,M]=c.useState(null),[S,E]=c.useState({}),{data:g=[],isLoading:v,error:T}=Le({scope:"user",includeDisabled:!1}),I=Ie(),P=g.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())||d.description.toLowerCase().includes(r.toLowerCase())),R=d=>{j(d),h(!0)},U=d=>{o(d),p(!0)},B=async d=>{try{const N=await f(`${_}/skills/${d.id}?scope=${d.scope}`);if(N.ok){const D=(await N.json()).skill;D.installPath&&(M({name:d.name,installPath:D.installPath}),F(!0))}}catch(N){console.error("Failed to fetch skill data:",N)}},C=async d=>{if(window.confirm(a("deleteConfirm",{name:d.name})))try{await I.mutateAsync({skillId:d.id,scope:"user"})}catch(N){console.error("Failed to delete skill:",N),alert(a("errors.deleteFailed"))}},K=()=>{o(null),p(!0)};return T?e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 dark:bg-red-900/20 dark:border-red-800",children:[e.jsx("h3",{className:"text-red-800 font-medium dark:text-red-400",children:a("errors.loadFailed")}),e.jsx("p",{className:"text-red-600 text-sm mt-1 dark:text-red-300",children:T instanceof Error?T.message:"An unknown error occurred"})]})}):e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:a("title")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-2",children:a("subtitle")})]})}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Ne,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5"}),e.jsx("input",{type:"text",placeholder:a("searchPlaceholder"),value:r,onChange:d=>s(d.target.value),className:"pl-10 pr-4 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"})]}),e.jsxs("button",{onClick:K,className:"flex items-center space-x-2 px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors whitespace-nowrap",children:[e.jsx(ae,{className:"w-5 h-5"}),e.jsx("span",{children:a("createButton")})]})]})]}),v?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):P.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-6xl mb-4",children:"⚡"}),e.jsx("h3",{className:"text-xl font-medium text-gray-900 dark:text-white mb-2",children:a(r?"noSkillsSearch":"noSkills")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:a(r?"adjustSearch":"createFirst")}),!r&&e.jsx("button",{onClick:K,className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:a("createButton")})]}):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(ge,{children:[e.jsx(be,{children:e.jsxs(Z,{children:[e.jsx(q,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider w-48",children:a("table.skill")}),e.jsx(q,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider w-96",children:a("table.tools")}),e.jsx(q,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider w-40",children:a("table.updated")}),e.jsx(q,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider w-32",children:a("table.actions")})]})}),e.jsx(fe,{children:P.map(d=>e.jsxs(Z,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(O,{className:"px-6 py-4 max-w-xs",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-2xl mr-4 flex-shrink-0",children:"⚡"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:`text-sm font-medium ${d.enabled?"text-gray-900 dark:text-white":"text-gray-600 dark:text-gray-400"} truncate`,children:d.name}),e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300 flex-shrink-0",children:a("scope.user")}),e.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium flex-shrink-0 ${d.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:d.source==="plugin"?a("source.plugin"):a("source.local")})]}),e.jsx("div",{className:`text-sm ${d.enabled?"text-gray-500 dark:text-gray-400":"text-gray-400 dark:text-gray-500"} line-clamp-2`,children:d.description})]})]})}),e.jsx(O,{className:"px-6 py-4",children:e.jsx(Ee,{tools:d.allowedTools||[],id:d.id,expandedTools:S,setExpandedTools:E,isMobile:!1,emptyMessage:"无工具限制"})}),e.jsxs(O,{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400 w-40",children:[new Date(d.updatedAt).toLocaleDateString(),d.usageCount!==void 0&&d.usageCount>0&&e.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500",children:a("preview.usage",{count:d.usageCount})})]}),e.jsx(O,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium w-32",children:e.jsx("div",{className:"flex items-center space-x-2",children:d.source==="plugin"?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>R(d),className:"p-1 text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/50 rounded transition-colors",title:a("preview.actions.view"),children:e.jsx(Se,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>B(d),className:"p-1 text-purple-600 hover:bg-purple-50 dark:hover:bg-purple-900/50 rounded transition-colors",title:a("preview.actions.browseFiles"),children:e.jsx(Te,{className:"w-4 h-4"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>U(d),className:"p-1 text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/50 rounded transition-colors",title:a("preview.actions.edit"),children:e.jsx(Ce,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>C(d),className:"p-1 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded transition-colors",title:a("preview.actions.delete"),children:e.jsx(Fe,{className:"w-4 h-4"})})]})})})]},d.id))})]})}),x&&e.jsx(Ue,{onClose:()=>{p(!1),o(null)},onSuccess:()=>{p(!1),o(null)},editSkill:l||void 0}),n&&m&&e.jsx(Ke,{skill:m,onClose:()=>{h(!1),j(null)}}),k&&$&&e.jsx(We,{isOpen:k,skillName:$.name,installPath:$.installPath,onClose:()=>{F(!1),M(null)}})]})},tt=()=>e.jsx(qe,{});export{tt as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./data-structures-C0h9Oap1.js";import{r as g}from"./monaco-editor-DHKm5-VF.js";import{a as Y,A as Z}from"./agents-ChrA1R0y.js";import{u as M}from"./tools-IcPNZlPj.js";import{X as R,Q as ee,a3 as te,a4 as N,a5 as O,a6 as E,R as re,j as D,k as se,l as ae}from"./ui-components-D1St49qC.js";const I={Bash:"终端命令",BashOutput:"终端命令输出",KillBash:"杀死终端命令",Edit:"文件编辑",Read:"读取文件",Write:"写入文件",Glob:"文件搜索",Grep:"文本搜索",NotebookEdit:"笔记本编辑",WebFetch:"网页获取",WebSearch:"网络搜索",TodoWrite:"任务管理",Task:"任务执行",ExitPlanMode:"退出计划模式",Skill:"技能调用"},ne={Bash:"执行命令行操作",BashOutput:"获取终端命令输出",KillBash:"杀死终端命令",Edit:"编辑文件内容",Read:"读取文件内容",Write:"创建或覆盖文件",Glob:"使用通配符搜索文件",Grep:"在文件中搜索文本",NotebookEdit:"编辑Jupyter笔记本",WebFetch:"获取网页内容",WebSearch:"搜索网络信息",TodoWrite:"创建和管理待办事项",Task:"执行复杂任务",ExitPlanMode:"退出计划模式",Skill:"调用预定义的技能"};function F(d){return I[d]||d}function ie(d){return ne[d]||""}function le(){const d=new Set([...Object.keys(I)]);return Array.from(d).map(m=>({name:m,label:F(m),description:ie(m)}))}const b=le(),ge=({isOpen:d,onClose:m,selectedRegularTools:i,onRegularToolsChange:f,selectedMcpTools:l,onMcpToolsChange:h,mcpToolsEnabled:G,onMcpEnabledChange:U,presetTools:y=[],readonly:P=!1})=>{const{t:c}=M("components"),[u,K]=g.useState([]),[v,A]=g.useState(!1),[p,T]=g.useState(null),[C,q]=g.useState(new Set),[S,W]=g.useState("regular");g.useEffect(()=>{d&&z()},[d]);const z=async()=>{A(!0),T(null);try{const e=await Y(`${Z}/mcp`);if(!e.ok)throw new Error("Failed to fetch MCP configurations");const r=await e.json();K(r.servers||[])}catch(e){console.error("Failed to fetch MCP servers:",e),T(e instanceof Error?e.message:"Unknown error")}finally{A(!1)}},L=e=>y.some(r=>r.name===e&&r.enabled),j=e=>{if(y.some(s=>s.name===e&&s.enabled))return!0;const r=e.split("__");if(r.length===3&&r[0]==="mcp"){const s=`${r[1]}.${r[2]}`;if(y.some(x=>x.name===s&&x.enabled))return!0;const a=`mcp__${r[1]}__${r[2]}`;if(y.some(x=>x.name===a&&x.enabled))return!0}return!1},H=e=>{L(e)&&i.includes(e)||(i.includes(e)?f(i.filter(r=>r!==e)):f([...i,e]))},J=e=>{j(e)&&l.includes(e)||(l.includes(e)?h(l.filter(r=>r!==e)):h([...l,e]))},Q=e=>{const r=new Set(C);r.has(e)?r.delete(e):r.add(e),q(r)},B=e=>{const r=u.find(s=>s.name===e);return!r||!r.tools?!1:r.tools.some(s=>{const a=`mcp__${e}__${s}`;return j(a)})},V=(e,r)=>{const s=u.find(n=>n.name===e);if(!s||!s.tools)return;const a=s.tools.map(n=>`mcp__${e}__${n}`),x=B(e);if(r)if(x){const n=a.filter(o=>!j(o));h(l.filter(o=>!n.includes(o)))}else h(l.filter(n=>!a.includes(n)));else{const n=[...l];a.forEach(o=>{n.includes(o)||n.push(o)}),h(n)}},X=e=>{const r=u.find(a=>a.name===e);return!r||!r.tools?!1:r.tools.map(a=>`mcp__${e}__${a}`).every(a=>l.includes(a))};return d?t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[60]",onClick:m,children:t.jsxs("div",{className:"unified-tool-selector-popup w-96 max-h-[500px] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg flex flex-col",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"p-4 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:c("unifiedToolSelector.title")}),t.jsx("button",{type:"button",onClick:m,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:t.jsx(R,{className:"w-5 h-5"})})]}),t.jsxs("div",{className:"flex space-x-1 mb-2 bg-gray-100 dark:bg-gray-700 rounded-lg p-1",children:[t.jsxs("button",{type:"button",onClick:()=>W("regular"),className:`flex-1 flex items-center justify-center space-x-2 px-3 py-2 rounded-md text-sm font-medium transition-colors ${S==="regular"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:[t.jsx(ee,{className:"w-4 h-4"}),t.jsx("span",{children:c("unifiedToolSelector.tabs.regular")}),i.length>0&&t.jsx("span",{className:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 text-xs rounded-full px-2 py-0.5 min-w-[20px] text-center",children:i.length})]}),t.jsxs("button",{type:"button",onClick:()=>W("mcp"),className:`flex-1 flex items-center justify-center space-x-2 px-3 py-2 rounded-md text-sm font-medium transition-colors ${S==="mcp"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:[t.jsx(te,{className:"w-4 h-4"}),t.jsx("span",{children:c("unifiedToolSelector.tabs.mcp")}),l.length>0&&t.jsx("span",{className:"bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400 text-xs rounded-full px-2 py-0.5 min-w-[20px] text-center",children:l.filter(e=>e.startsWith("mcp__")&&e.split("__").length===3).length})]})]})]}),t.jsx("div",{className:"px-4 pb-4 overflow-y-auto flex-1",children:S==="regular"?t.jsx("div",{className:"space-y-2",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"flex items-center justify-end p-2 hover:bg-gray-50 dark:hover:bg-gray-700 rounded",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 font-medium",children:c("unifiedToolSelector.selectAll")}),t.jsx("button",{type:"button",onClick:()=>{i.length===b.length?f([]):f(b.map(e=>e.name))},className:`w-4 h-4 border-2 rounded flex items-center justify-center transition-colors ${i.length===b.length||i.length>0?"bg-blue-600 border-blue-600 text-white":"border-gray-300 dark:border-gray-600 hover:border-blue-500"}`,children:i.length===b.length?t.jsx(N,{className:"w-3 h-3"}):i.length>0?t.jsx(O,{className:"w-3 h-3"}):null})]})}),b.map(e=>{const r=i.includes(e.name),s=L(e.name),a=P||s&&r;return t.jsx("div",{className:`flex items-center justify-between p-2 rounded ${a?"bg-gray-50 dark:bg-gray-700":"hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{type:"button",onClick:()=>H(e.name),disabled:a,className:`w-4 h-4 border-2 rounded flex items-center justify-center transition-colors ${r?s?"bg-orange-500 border-orange-500 text-white cursor-not-allowed":"bg-blue-600 border-blue-600 text-white":a?"border-gray-200 dark:border-gray-600 cursor-not-allowed":"border-gray-300 dark:border-gray-600 hover:border-blue-500"}`,children:r&&(s?t.jsx(E,{className:"w-3 h-3"}):t.jsx(N,{className:"w-3 h-3"}))}),t.jsxs("span",{className:`text-sm ${a?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`,children:[F(e.name)," (",e.name,")",s&&t.jsxs("span",{className:"ml-1 text-xs text-orange-600 dark:text-orange-400",children:["[",c("unifiedToolSelector.preset"),"]"]})]})]})},e.name)})]})}):t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"flex items-center justify-end p-2",children:t.jsxs("label",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:c("unifiedToolSelector.enableMcpTools")}),t.jsx("input",{type:"checkbox",checked:G,onChange:e=>U(e.target.checked),className:"w-4 h-4 text-green-600 border-gray-300 dark:border-gray-600 rounded focus:ring-green-500"})]})}),v&&t.jsxs("div",{className:"flex items-center justify-center py-4",children:[t.jsx(re,{className:"w-4 h-4 text-gray-400 animate-spin mr-2"}),t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:c("unifiedToolSelector.loading")})]}),p&&t.jsxs("div",{className:"flex items-center justify-center py-4 text-red-600 dark:text-red-400",children:[t.jsx(D,{className:"w-4 h-4 mr-2"}),t.jsx("span",{className:"text-sm",children:p})]}),!v&&!p&&u.length===0&&t.jsx("div",{className:"text-center py-4 text-gray-500 dark:text-gray-400",children:t.jsx("span",{className:"text-sm",children:c("unifiedToolSelector.noMcpServers")})}),!v&&!p&&u.map(e=>{const r=C.has(e.name),s=e.status==="active",a=X(e.name),x=e.tools?.some(o=>l.includes(`mcp__${e.name}__${o}`)),n=B(e.name);return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[t.jsxs("div",{className:"flex items-center justify-between p-3",children:[t.jsxs("button",{type:"button",onClick:()=>Q(e.name),className:"flex items-center space-x-2 flex-1 text-left hover:bg-gray-50 dark:hover:bg-gray-700 -m-1 p-1 rounded transition-colors",disabled:!s,children:[r?t.jsx(se,{className:"w-4 h-4 text-gray-400"}):t.jsx(ae,{className:"w-4 h-4 text-gray-400"}),t.jsx("div",{className:`w-2 h-2 rounded-full ${s?"bg-green-500":"bg-red-500"}`}),t.jsx("span",{className:`font-medium ${s?"text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"}`,children:e.name}),t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:c("unifiedToolSelector.toolsCount",{count:e.tools?.length||0})})]}),s&&e.tools&&e.tools.length>0&&t.jsx("button",{type:"button",onClick:()=>V(e.name,a),className:`w-4 h-4 border-2 rounded flex items-center justify-center transition-colors ${a?n?"bg-orange-500 border-orange-500 text-white":"bg-green-600 border-green-600 text-white":x?n?"bg-orange-400 border-orange-400 text-white":"bg-blue-600 border-blue-600 text-white":"border-gray-300 dark:border-gray-600 hover:border-green-500"}`,children:a?n?t.jsx(E,{className:"w-3 h-3"}):t.jsx(N,{className:"w-3 h-3"}):x?t.jsx(O,{className:"w-3 h-3"}):null})]}),r&&s&&e.tools&&t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-3 space-y-2",children:e.tools.map(o=>{const _=`mcp__${e.name}__${o}`,$=l.includes(_),k=j(_),w=P||k&&$;return t.jsx("div",{className:`flex items-center justify-between p-2 rounded ${w?"bg-gray-50 dark:bg-gray-700":"hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{type:"button",onClick:()=>J(_),disabled:w,className:`w-4 h-4 border-2 rounded flex items-center justify-center transition-colors ${$?k?"bg-orange-500 border-orange-500 text-white cursor-not-allowed":"bg-green-600 border-green-600 text-white":w?"border-gray-200 dark:border-gray-600 cursor-not-allowed":"border-gray-300 dark:border-gray-600 hover:border-green-500"}`,children:$&&(k?t.jsx(E,{className:"w-3 h-3"}):t.jsx(N,{className:"w-3 h-3"}))}),t.jsxs("span",{className:`text-sm ${w?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`,children:[o,k&&t.jsxs("span",{className:"ml-1 text-xs text-orange-600 dark:text-orange-400",children:["[",c("unifiedToolSelector.preset"),"]"]})]})]})},o)})}),!s&&t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-3",children:t.jsxs("div",{className:"flex items-center text-red-600 dark:text-red-400",children:[t.jsx(D,{className:"w-4 h-4 mr-2"}),t.jsx("span",{className:"text-sm",children:e.error||c("unifiedToolSelector.serverUnavailable")})]})})]},e.name)})]})})]})}):null};export{ge as U,F as g};
|