@truefoundry/trueforge 0.180.0 → 0.180.1
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/dist/_frontend/assets/{AgentCodeSnippets-SQIFBJRR-DzPCvf4d.js → AgentCodeSnippets-AZKBLIDK-Bh1Z-M9v.js} +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-AZKBLIDK-Bh1Z-M9v.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-AZKBLIDK-Bh1Z-M9v.js.gz +0 -0
- package/dist/_frontend/assets/{AgentMetricChart-GGEDYHIM-D4y11_kp.js → AgentMetricChart-XMBMFHRJ-DCMHC3Ni.js} +1 -1
- package/dist/_frontend/assets/AgentMetricChart-XMBMFHRJ-DCMHC3Ni.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-XMBMFHRJ-DCMHC3Ni.js.gz +0 -0
- package/dist/_frontend/assets/{AgentOverview-SONOXEA2-DVW9dpOp.js → AgentOverview-A4G7LV7H-Wue1-Z49.js} +1 -1
- package/dist/_frontend/assets/AgentOverview-A4G7LV7H-Wue1-Z49.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-A4G7LV7H-Wue1-Z49.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimeline-VTUD4LL3-uCjuzqN4.js → AgentSessionEventTimeline-YC24Y5EG-B9yncSPx.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimeline-YC24Y5EG-B9yncSPx.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-YC24Y5EG-B9yncSPx.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimelineChart-K3HU6HSO-XJLVw6b2.js → AgentSessionEventTimelineChart-G2FO6IOQ-royEegjl.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-G2FO6IOQ-royEegjl.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-G2FO6IOQ-royEegjl.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessions-5AD6ZDRM-C5RT7EY0.js → AgentSessions-Q5V55RAP-o77xA76a.js} +1 -1
- package/dist/_frontend/assets/AgentSessions-Q5V55RAP-o77xA76a.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-Q5V55RAP-o77xA76a.js.gz +0 -0
- package/dist/_frontend/assets/{ConnectorSettings-FAMLKHRT-CbgoOQBA.js → ConnectorSettings-WPYGAY6V-D1xTfAjp.js} +1 -1
- package/dist/_frontend/assets/ConnectorSettings-WPYGAY6V-D1xTfAjp.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-WPYGAY6V-D1xTfAjp.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-6X5P5E3T-DKDOGTZ4.js → DockLayout-4D2FHI2S-VT0vOxxV.js} +1 -1
- package/dist/_frontend/assets/{DrawerLayout-MB3JP4YC-Cs4K8WbP.js → DrawerLayout-KFFHWDRO-V1PvLl-g.js} +2 -2
- package/dist/_frontend/assets/DrawerLayout-KFFHWDRO-V1PvLl-g.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-KFFHWDRO-V1PvLl-g.js.gz +0 -0
- package/dist/_frontend/assets/{EnvironmentsPage-AD3I5BXA-B1Bwzgoh.js → EnvironmentsPage-FJLSJBQT-Dsc78Ggo.js} +1 -1
- package/dist/_frontend/assets/EnvironmentsPage-FJLSJBQT-Dsc78Ggo.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-FJLSJBQT-Dsc78Ggo.js.gz +0 -0
- package/dist/_frontend/assets/{ModelSettings-KYX762EG-fzXe6Th3.js → ModelSettings-HFZVCM65-BB7S_vUH.js} +1 -1
- package/dist/_frontend/assets/ModelSettings-HFZVCM65-BB7S_vUH.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-HFZVCM65-BB7S_vUH.js.gz +0 -0
- package/dist/_frontend/assets/{SandboxSettings-ZE4Z65F5-RaO5UYxl.js → SandboxSettings-WX5IEY4T-DhYZ4ecM.js} +1 -1
- package/dist/_frontend/assets/SandboxSettings-WX5IEY4T-DhYZ4ecM.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-WX5IEY4T-DhYZ4ecM.js.gz +0 -0
- package/dist/_frontend/assets/{SchedulesPage-QI2TK6XX-C_OjU_1-.js → SchedulesPage-L3AK7JJI-Cj-DMCfm.js} +1 -1
- package/dist/_frontend/assets/SchedulesPage-L3AK7JJI-Cj-DMCfm.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-L3AK7JJI-Cj-DMCfm.js.gz +0 -0
- package/dist/_frontend/assets/{SettingsBuilder-OTFRXULU-Cc6qAu_o.js → SettingsBuilder-C7HL754X-BhpCKRCk.js} +2 -2
- package/dist/_frontend/assets/SettingsBuilder-C7HL754X-BhpCKRCk.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-C7HL754X-BhpCKRCk.js.gz +0 -0
- package/dist/_frontend/assets/{ShellRouteSync-ZNUJRPCZ-7PDpM3Tt.js → ShellRouteSync-ZNUJRPCZ-CWUS4K5K.js} +1 -1
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-CWUS4K5K.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-CWUS4K5K.js.gz +0 -0
- package/dist/_frontend/assets/{SidebarLayout-WMJUGCNE-DlivhNaL.js → SidebarLayout-PHJQH6T5-CnYP0lm_.js} +2 -2
- package/dist/_frontend/assets/SidebarLayout-PHJQH6T5-CnYP0lm_.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-PHJQH6T5-CnYP0lm_.js.gz +0 -0
- package/dist/_frontend/assets/{SkillSettings-V2YF42KU-BJs98jMY.js → SkillSettings-4FRAJ7AP-CZ2Fq57p.js} +1 -1
- package/dist/_frontend/assets/SkillSettings-4FRAJ7AP-CZ2Fq57p.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-4FRAJ7AP-CZ2Fq57p.js.gz +0 -0
- package/dist/_frontend/assets/{TrueForgeUIWithRouter-76JMT47N-CnpzH7-n.js → TrueForgeUIWithRouter-DFYJFRW5-BkfbEYp9.js} +1 -1
- package/dist/_frontend/assets/{WebSearchSettings-LFQ4V4FB-D7w_63MH.js → WebSearchSettings-FDNEHFSR-BAvKZY3c.js} +1 -1
- package/dist/_frontend/assets/WebSearchSettings-FDNEHFSR-BAvKZY3c.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-FDNEHFSR-BAvKZY3c.js.gz +0 -0
- package/dist/_frontend/assets/{WidgetLayout-TB2YRZUR-Bymizc6I.js → WidgetLayout-DZCGKWLV-B7upLKr8.js} +1 -1
- package/dist/_frontend/assets/WidgetLayout-DZCGKWLV-B7upLKr8.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-DZCGKWLV-B7upLKr8.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-4BKRLRXL-DLUyrNQ3.js → chunk-4BKRLRXL-CG21G8ZQ.js} +1 -1
- package/dist/_frontend/assets/chunk-4BKRLRXL-CG21G8ZQ.js.br +0 -0
- package/dist/_frontend/assets/chunk-4BKRLRXL-CG21G8ZQ.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-ZSP5XG3J-9vEyCWu1.js → chunk-5MP3OBDD-Cnbi6k-M.js} +2 -2
- package/dist/_frontend/assets/chunk-5MP3OBDD-Cnbi6k-M.js.br +0 -0
- package/dist/_frontend/assets/chunk-5MP3OBDD-Cnbi6k-M.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-C43ZVKUS-ClJ9CpD6.js → chunk-C4DROCIN-CGWCL0tw.js} +1 -1
- package/dist/_frontend/assets/{chunk-W7NO436B-9jA-ex4y.js → chunk-K6BABP2I-DmT0oS_X.js} +1 -1
- package/dist/_frontend/assets/chunk-K6BABP2I-DmT0oS_X.js.br +0 -0
- package/dist/_frontend/assets/chunk-K6BABP2I-DmT0oS_X.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-OB3PAWPO-D3Luy7W3.js → chunk-OB3PAWPO-Dx28HnLj.js} +1 -1
- package/dist/_frontend/assets/chunk-OB3PAWPO-Dx28HnLj.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-Dx28HnLj.js.gz +0 -0
- package/dist/_frontend/assets/{cssMode-JOuT28rz.js → cssMode-DCkOsmFW.js} +1 -1
- package/dist/_frontend/assets/cssMode-DCkOsmFW.js.br +0 -0
- package/dist/_frontend/assets/cssMode-DCkOsmFW.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-CZJ58vDF.js → freemarker2-CdE1pkjo.js} +1 -1
- package/dist/_frontend/assets/freemarker2-CdE1pkjo.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-CdE1pkjo.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-CUvie110.js → handlebars-D-2f2QEW.js} +1 -1
- package/dist/_frontend/assets/handlebars-D-2f2QEW.js.br +0 -0
- package/dist/_frontend/assets/handlebars-D-2f2QEW.js.gz +0 -0
- package/dist/_frontend/assets/{html-DD_vjw5l.js → html-D5m7rmoI.js} +1 -1
- package/dist/_frontend/assets/html-D5m7rmoI.js.br +0 -0
- package/dist/_frontend/assets/html-D5m7rmoI.js.gz +0 -0
- package/dist/_frontend/assets/{htmlMode-Bs5cHvWx.js → htmlMode-uOaQmV2H.js} +1 -1
- package/dist/_frontend/assets/htmlMode-uOaQmV2H.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-uOaQmV2H.js.gz +0 -0
- package/dist/_frontend/assets/{index-JVnCghrh.js → index-CZBlpRlU.js} +1 -1
- package/dist/_frontend/assets/index-CZBlpRlU.js.br +0 -0
- package/dist/_frontend/assets/index-CZBlpRlU.js.gz +0 -0
- package/dist/_frontend/assets/{index-IV_K3kGI.js → index-DsXPuzpi.js} +3 -3
- package/dist/_frontend/assets/index-DsXPuzpi.js.br +0 -0
- package/dist/_frontend/assets/index-DsXPuzpi.js.gz +0 -0
- package/dist/_frontend/assets/{index-PV6Uc-B5.js → index-KCrUroEv.js} +4 -4
- package/dist/_frontend/assets/index-KCrUroEv.js.br +0 -0
- package/dist/_frontend/assets/index-KCrUroEv.js.gz +0 -0
- package/dist/_frontend/assets/{javascript-R_9qXwYL.js → javascript-DqQSJk6b.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-8OQdDgk6.js → jsonMode-CvgZoyE3.js} +1 -1
- package/dist/_frontend/assets/jsonMode-CvgZoyE3.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-CvgZoyE3.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-BAdDEBi9.js → liquid-BDG_FwJG.js} +1 -1
- package/dist/_frontend/assets/liquid-BDG_FwJG.js.br +0 -0
- package/dist/_frontend/assets/liquid-BDG_FwJG.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-CNxTXCEe.js → lspLanguageFeatures-BxrBeGeN.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-BxrBeGeN.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-BxrBeGeN.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-zRCES-UR.js → mdx-Bbp-MAMp.js} +1 -1
- package/dist/_frontend/assets/mdx-Bbp-MAMp.js.br +0 -0
- package/dist/_frontend/assets/mdx-Bbp-MAMp.js.gz +0 -0
- package/dist/_frontend/assets/{python-CHTiGyj6.js → python-DsOBiVLf.js} +1 -1
- package/dist/_frontend/assets/python-DsOBiVLf.js.br +0 -0
- package/dist/_frontend/assets/python-DsOBiVLf.js.gz +0 -0
- package/dist/_frontend/assets/{razor-CU2s7Hbi.js → razor-DyPrir8f.js} +1 -1
- package/dist/_frontend/assets/razor-DyPrir8f.js.br +0 -0
- package/dist/_frontend/assets/razor-DyPrir8f.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-CJLsaAN3.js → tsMode-B8j2vyh9.js} +1 -1
- package/dist/_frontend/assets/tsMode-B8j2vyh9.js.br +0 -0
- package/dist/_frontend/assets/tsMode-B8j2vyh9.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-C6qGKHm0.js → typescript-DcqRUGBI.js} +1 -1
- package/dist/_frontend/assets/typescript-DcqRUGBI.js.br +0 -0
- package/dist/_frontend/assets/typescript-DcqRUGBI.js.gz +0 -0
- package/dist/_frontend/assets/{workers-DeOwcFUN.js → workers-xNbMtZ2G.js} +1 -1
- package/dist/_frontend/assets/workers-xNbMtZ2G.js.br +0 -0
- package/dist/_frontend/assets/workers-xNbMtZ2G.js.gz +0 -0
- package/dist/_frontend/assets/{xml-ccL_LPm9.js → xml-SgxzHXjE.js} +1 -1
- package/dist/_frontend/assets/xml-SgxzHXjE.js.br +0 -0
- package/dist/_frontend/assets/xml-SgxzHXjE.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-YzcQ27WY.js → yaml-DcMhrb0Z.js} +1 -1
- package/dist/_frontend/assets/yaml-DcMhrb0Z.js.br +0 -0
- package/dist/_frontend/assets/yaml-DcMhrb0Z.js.gz +0 -0
- package/dist/_frontend/index.html +1 -1
- package/package.json +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-SQIFBJRR-DzPCvf4d.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-SQIFBJRR-DzPCvf4d.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-GGEDYHIM-D4y11_kp.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-GGEDYHIM-D4y11_kp.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-SONOXEA2-DVW9dpOp.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-SONOXEA2-DVW9dpOp.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-VTUD4LL3-uCjuzqN4.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-VTUD4LL3-uCjuzqN4.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-K3HU6HSO-XJLVw6b2.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-K3HU6HSO-XJLVw6b2.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-5AD6ZDRM-C5RT7EY0.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-5AD6ZDRM-C5RT7EY0.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-FAMLKHRT-CbgoOQBA.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-FAMLKHRT-CbgoOQBA.js.gz +0 -0
- package/dist/_frontend/assets/DrawerLayout-MB3JP4YC-Cs4K8WbP.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-MB3JP4YC-Cs4K8WbP.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-AD3I5BXA-B1Bwzgoh.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-AD3I5BXA-B1Bwzgoh.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-KYX762EG-fzXe6Th3.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-KYX762EG-fzXe6Th3.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-ZE4Z65F5-RaO5UYxl.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-ZE4Z65F5-RaO5UYxl.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-QI2TK6XX-C_OjU_1-.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-QI2TK6XX-C_OjU_1-.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-OTFRXULU-Cc6qAu_o.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-OTFRXULU-Cc6qAu_o.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-7PDpM3Tt.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-7PDpM3Tt.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-WMJUGCNE-DlivhNaL.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-WMJUGCNE-DlivhNaL.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-V2YF42KU-BJs98jMY.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-V2YF42KU-BJs98jMY.js.gz +0 -0
- package/dist/_frontend/assets/WebSearchSettings-LFQ4V4FB-D7w_63MH.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-LFQ4V4FB-D7w_63MH.js.gz +0 -0
- package/dist/_frontend/assets/WidgetLayout-TB2YRZUR-Bymizc6I.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-TB2YRZUR-Bymizc6I.js.gz +0 -0
- package/dist/_frontend/assets/chunk-4BKRLRXL-DLUyrNQ3.js.br +0 -0
- package/dist/_frontend/assets/chunk-4BKRLRXL-DLUyrNQ3.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-D3Luy7W3.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-D3Luy7W3.js.gz +0 -0
- package/dist/_frontend/assets/chunk-W7NO436B-9jA-ex4y.js.br +0 -0
- package/dist/_frontend/assets/chunk-W7NO436B-9jA-ex4y.js.gz +0 -0
- package/dist/_frontend/assets/chunk-ZSP5XG3J-9vEyCWu1.js.br +0 -0
- package/dist/_frontend/assets/chunk-ZSP5XG3J-9vEyCWu1.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-JOuT28rz.js.br +0 -0
- package/dist/_frontend/assets/cssMode-JOuT28rz.js.gz +0 -0
- package/dist/_frontend/assets/freemarker2-CZJ58vDF.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-CZJ58vDF.js.gz +0 -0
- package/dist/_frontend/assets/handlebars-CUvie110.js.br +0 -0
- package/dist/_frontend/assets/handlebars-CUvie110.js.gz +0 -0
- package/dist/_frontend/assets/html-DD_vjw5l.js.br +0 -0
- package/dist/_frontend/assets/html-DD_vjw5l.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-Bs5cHvWx.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-Bs5cHvWx.js.gz +0 -0
- package/dist/_frontend/assets/index-IV_K3kGI.js.br +0 -0
- package/dist/_frontend/assets/index-IV_K3kGI.js.gz +0 -0
- package/dist/_frontend/assets/index-JVnCghrh.js.br +0 -0
- package/dist/_frontend/assets/index-JVnCghrh.js.gz +0 -0
- package/dist/_frontend/assets/index-PV6Uc-B5.js.br +0 -0
- package/dist/_frontend/assets/index-PV6Uc-B5.js.gz +0 -0
- package/dist/_frontend/assets/jsonMode-8OQdDgk6.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-8OQdDgk6.js.gz +0 -0
- package/dist/_frontend/assets/liquid-BAdDEBi9.js.br +0 -0
- package/dist/_frontend/assets/liquid-BAdDEBi9.js.gz +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-CNxTXCEe.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-CNxTXCEe.js.gz +0 -0
- package/dist/_frontend/assets/mdx-zRCES-UR.js.br +0 -0
- package/dist/_frontend/assets/mdx-zRCES-UR.js.gz +0 -0
- package/dist/_frontend/assets/python-CHTiGyj6.js.br +0 -0
- package/dist/_frontend/assets/python-CHTiGyj6.js.gz +0 -0
- package/dist/_frontend/assets/razor-CU2s7Hbi.js.br +0 -0
- package/dist/_frontend/assets/razor-CU2s7Hbi.js.gz +0 -0
- package/dist/_frontend/assets/tsMode-CJLsaAN3.js.br +0 -0
- package/dist/_frontend/assets/tsMode-CJLsaAN3.js.gz +0 -0
- package/dist/_frontend/assets/typescript-C6qGKHm0.js.br +0 -0
- package/dist/_frontend/assets/typescript-C6qGKHm0.js.gz +0 -0
- package/dist/_frontend/assets/workers-DeOwcFUN.js.br +0 -0
- package/dist/_frontend/assets/workers-DeOwcFUN.js.gz +0 -0
- package/dist/_frontend/assets/xml-ccL_LPm9.js.br +0 -0
- package/dist/_frontend/assets/xml-ccL_LPm9.js.gz +0 -0
- package/dist/_frontend/assets/yaml-YzcQ27WY.js.br +0 -0
- package/dist/_frontend/assets/yaml-YzcQ27WY.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as ke}from"./chunk-C43ZVKUS-ClJ9CpD6.js";import{b6 as me,p as Ae,q as Ee,bc as ue,r as a,v as J,j as e,S as ze,C as N,I as w,b8 as xe,a6 as X,c as $,_ as L,b7 as oe}from"./index-PV6Uc-B5.js";var Fe=[{value:"none",label:"None"},{value:"header",label:"API Key"},{value:"dcr",label:"OAuth"}],ae=X("h-11 shadow-sm"),B=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),Me=({open:r,onOpenChange:p,onSubmit:x,connector:n,busy:k=!1,error:g})=>{const[y,c]=a.useState(""),[b,v]=a.useState(""),[A,E]=a.useState(""),[f,C]=a.useState("dcr"),[m,o]=a.useState(""),[z,F]=a.useState(""),S=n!==void 0,D=X(`h-11 shadow-sm ${S?"cursor-not-allowed bg-secondary-bg/60 text-text-secondary opacity-40":""}`),i=()=>{c(""),v(""),E(""),C("dcr"),o(""),F("")};a.useEffect(()=>{r&&(c((n==null?void 0:n.name)??""),v((n==null?void 0:n.url)??""),E((n==null?void 0:n.description)??""),C((n==null?void 0:n.auth.type)??"dcr"),o(""),F((n==null?void 0:n.auth.type)==="header"?n.auth.headerName??"":""))},[n,r]);const j=l=>{l||i(),p(l)},I=!!m.trim()||(n==null?void 0:n.auth.type)==="header",d=!!y.trim()&&!!A.trim()&&!!b.trim()&&(f!=="header"||I),q=async l=>{if(l.preventDefault(),!d||k)return;const M=f==="header"?{type:"header",apiKey:m.trim(),...z.trim()?{headerName:z.trim()}:{}}:{type:f};try{await x({name:y.trim(),url:b.trim(),description:A.trim(),auth:M}),i(),p(!1)}catch{}};return e.jsx(xe,{open:r,onOpenChange:j,title:S?"Edit MCP server":"Add MCP server",description:S?"Update how this connector authenticates.":"Point at a remote MCP endpoint. It then behaves like any other connector.",contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:l=>void q(l),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Name",e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-name",type:"text",required:!0,value:y,readOnly:S,"aria-disabled":S,onChange:l=>{c(l.target.value)},placeholder:"analytics-postgres-mcp",autoFocus:!S,className:D})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-description",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Description",e.jsx(B,{})]}),e.jsx("textarea",{id:"mcp-server-description",value:A,onChange:l=>{E(l.target.value)},placeholder:"Query analytics from Postgres",required:!0,rows:3,className:X("resize-y py-2.5 shadow-sm")})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-url",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["URL",e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-url",type:"url",required:!0,value:b,onChange:l=>{v(l.target.value)},placeholder:"https://mcp.example.com/mcp",className:ae})]}),e.jsxs("fieldset",{children:[e.jsxs("legend",{className:"mb-1.5 text-sm font-medium text-text-primary",children:["Auth type",e.jsx(B,{})]}),e.jsx("div",{className:"flex w-full flex-row rounded-md border border-border bg-secondary-bg/40 p-1",children:Fe.map(l=>e.jsxs("label",{className:`flex h-8 flex-1 cursor-pointer items-center justify-center rounded-sm text-sm font-medium transition-colors ${f===l.value?"bg-dropdown-selected-item-bg text-dropdown-selected-item-text shadow-sm":"text-text-secondary hover:text-text-primary"}`,children:[e.jsx("input",{type:"radio",name:"mcp-auth-type",value:l.value,checked:f===l.value,onChange:()=>{C(l.value)},className:"sr-only"}),l.label]},l.value))})]}),f==="dcr"?e.jsxs("div",{className:"flex gap-1.5 bg-secondary-bg/40 p-2 rounded-md",children:[e.jsx(w,{name:"info",className:"size-3.5 mt-1 text-text-secondary"}),e.jsx("div",{className:"text-xs text-text-secondary leading-5.5",children:"Sign-in only — the server must support dynamic client registration. Manual OAuth (client ID / secret) isn't supported yet."})]}):null,f==="header"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",(n==null?void 0:n.auth.type)==="header"?e.jsx("span",{className:"font-normal text-text-secondary",children:" (leave blank to keep current)"}):e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-api-key",type:"password",required:(n==null?void 0:n.auth.type)!=="header",value:m,onChange:l=>{o(l.target.value)},placeholder:"Bearer <Paste the token from the provider>","aria-describedby":"mcp-server-api-key-hint",className:ae}),e.jsx("p",{id:"mcp-server-api-key-hint",className:"mt-1.5 text-xs text-text-secondary",children:`This is the value for the "${z.trim()||"Authorization"}" header.`})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-header-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Header name ",e.jsx("span",{className:"font-normal text-text-secondary",children:"(optional)"})]}),e.jsx("input",{id:"mcp-server-header-name",type:"text",value:z,onChange:l=>{F(l.target.value)},placeholder:"Authorization",className:ae})]})]}):null]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[g?e.jsx("p",{className:"text-failure-bg text-sm",children:g}):null,e.jsx(N.Primary,{type:"submit",size:"large",disabled:!d||k,className:"w-full shrink-0",children:S?"Save":"Add"})]})]})})},ce=Me,Z={dcr:"OAuth2",header:"API Key",none:"No Auth"};function De({text:r}){const p=a.useRef(null),[x,n]=a.useState(!1),[k,g]=a.useState(!1),[y,c]=a.useState(16);return a.useLayoutEffect(()=>{n(!1),c(16)},[r]),a.useLayoutEffect(()=>{const b=p.current;if(!b)return;if(!x){c(16),g(b.scrollWidth>b.clientWidth+1);return}c(16);const v=requestAnimationFrame(()=>{c(b.scrollHeight)});return()=>cancelAnimationFrame(v)},[r,x]),r?e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("p",{ref:p,style:{maxHeight:y},className:$("mt-0.5 overflow-hidden font-mono text-xs leading-4 text-text-secondary transition-[max-height] duration-300 ease-in-out",!x&&"whitespace-nowrap",!x&&k&&"pr-[5.75rem]"),children:[r,x&&k?e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",className:"cursor-pointer font-mono text-xs font-medium text-text-primary/80 hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring","aria-expanded":!0,onClick:()=>n(!1),children:"Show less"})]}):null]}),!x&&k?e.jsxs("button",{type:"button",className:"absolute top-0.5 right-0 cursor-pointer bg-card-bg pl-1.5 font-mono text-xs font-medium leading-4 text-text-primary/80 hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring","aria-expanded":!1,onClick:()=>n(!0),children:[e.jsx("span",{"aria-hidden":!0,className:"text-text-secondary",children:"…"}),e.jsx("span",{className:"ml-1",children:"Read more"})]}):null]}):null}var Ie=({connector:r,onBack:p,onConnectorRefreshed:x,onEdit:n,onDisconnect:k,onRemove:g,busy:y=!1})=>{const{connectorCatalog:c}=me(),{handleAuthorize:b,isOAuthLoading:v}=ue(),[A,E]=a.useState([]),[f,C]=a.useState(!0),[m,o]=a.useState(null),[z,F]=a.useState(!1);a.useEffect(()=>{let i=!1;return E([]),o(null),C(!0),c.getToolsByConnectorId({id:r.id}).then(j=>{i||E(j)}).catch(j=>{i||o(J(j,"Failed to load connector tools"))}).finally(()=>{i||C(!1)}),()=>{i=!0}},[r.authenticated,r.id,c]);const S=async()=>{F(!0),o(null);try{const i=await c.getConnector({id:r.id});x(i)}catch(i){o(J(i,"Failed to refresh connector details"))}finally{F(!1)}},D=v||z;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:p,className:"mb-3 inline-flex w-fit items-center gap-1 rounded-md py-1 pr-2 text-sm text-text-secondary hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",children:[e.jsx(w,{name:"chevron-left",className:"size-3.5"}),"Connectors"]}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-y-auto pb-1",children:[e.jsxs("header",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"text-lg font-semibold text-text-primary",children:r.name}),e.jsx("span",{className:"inline-flex items-center rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-text-secondary",children:Z[r.auth.type]??Z.none}),e.jsxs("span",{className:$("flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium",r.authenticated?"text-success-bg":"text-text-primary"),children:[e.jsx("span",{className:$("h-1.5 w-1.5 rounded-full",r.authenticated?"bg-success-bg":"bg-primary-button-bg")}),r.authenticated?"Connected":"Not authenticated"]})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:e.jsx("span",{className:"text-text-secondary",children:r.description})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(N.Secondary,{size:"small",type:"button",disabled:y,onClick:n,children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.auth.type==="dcr"&&!r.authenticated?e.jsx(N.Secondary,{size:"small",type:"button",disabled:y||D,onClick:()=>{b(r.id,i=>{i&&S()})},children:D?"Connecting…":"Connect"}):r.auth.type==="dcr"&&!r.requiresAuth?e.jsx(N.Secondary,{size:"small",type:"button",disabled:y,onClick:k,children:"Disconnect"}):null,g?e.jsx(N.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:y,"aria-label":`Remove ${r.name}`,onClick:g,children:"Remove"}):null]})]}),e.jsx("section",{className:"mt-6","aria-labelledby":"connector-tools-heading",children:f?e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"Loading tools…"}):m?e.jsxs("div",{className:"rounded-xl border border-failure-bg/30 bg-failure-bg/10 p-6 text-center text-sm text-failure-bg",children:[m,r.auth.type==="dcr"&&!r.authenticated&&e.jsx("div",{className:"font-bold mt-1",children:"Click Connect and authenticate successfully to view tools."})]}):A.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("h5",{id:"connector-tools-heading",className:"mb-2 text-[0.8125rem] font-semibold text-text-primary",children:["Tools ",e.jsxs("span",{className:"font-normal text-text-secondary",children:["· ",A.length]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:A.map(i=>e.jsx("article",{className:"flex min-h-12 items-start gap-3 border-b border-border px-3 py-2 last:border-b-0",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h6",{className:"text-sm font-medium text-text-primary",children:i.name}),e.jsx(De,{text:i.description})]})},i.id))})]}):e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"No tools reported for this connector."})})]})]})},Oe=Ie,Re=()=>{const{connectorCatalog:r}=me(),p=Ae(),x=Ee(),{handleAuthorize:n,isOAuthLoading:k}=ue(),[g,y]=a.useState(""),[c,b]=a.useState({ordered:[],authStatusById:new Map}),[v,A]=a.useState(!0),[E,f]=a.useState(null),[C,m]=a.useState(null),[o,z]=a.useState(!1),[F,S]=a.useState([]),[D,i]=a.useState(!1),[j,I]=a.useState(null),[d,q]=a.useState(null),[l,M]=a.useState(null),[he,re]=a.useState(null),[ee,H]=a.useState(null),[pe,R]=a.useState(null),[U,te]=a.useState(""),ne=a.useMemo(()=>(F??[]).reduce((t,s)=>(t[s.name]=s.logo??"",t),{}),[F]),V=a.useCallback(async()=>{A(!0),f(null);try{const[t,s]=await Promise.all([r.listConnectors(),r.getConnectorCatalog()]);S(s);const u=t??[],O=new Set(u.map(h=>h.id)),G=[...u.map(h=>({connector:h,isConfigured:!0})),...s.filter(h=>!O.has(h.id)).map(h=>({connector:h,isConfigured:!1}))];b({ordered:G,authStatusById:new Map(G.map(h=>[h.connector.id,h.isConfigured?h.connector.authenticated:!1]))}),M(h=>h?t.find(Y=>Y.id===h.id)??null:null)}catch(t){f(J(t,"Failed to load connectors"))}finally{A(!1)}},[r]);a.useEffect(()=>{V()},[V]);const T=g.trim().toLowerCase(),K=a.useMemo(()=>T?c.ordered.filter(({connector:t})=>{var s;return t.name.toLowerCase().includes(T)||(((s=t.description)==null?void 0:s.toLowerCase().includes(T))??!1)||t.url.toLowerCase().includes(T)}):c.ordered,[c.ordered,T]),Q=a.useMemo(()=>{const t=[];for(const s of K)if(s.isConfigured){const u=c.authStatusById.get(s.connector.id)??s.connector.authenticated;t.push(u===s.connector.authenticated?s.connector:{...s.connector,authenticated:u})}return t},[c.authStatusById,K]),W=a.useMemo(()=>{const t=[];for(const s of K)s.isConfigured||t.push(s.connector);return t},[K]),P=async(t,s=f)=>{z(!0),f(null);try{await t(),await V()}catch(u){throw s(J(u,"Request failed")),u}finally{z(!1)}},se=()=>{q(null),te(""),m(null)},le=async(t,s)=>{const u=s??(t.auth.type==="header"?{type:"header",...t.auth.headerName?{headerName:t.auth.headerName}:{}}:t.auth.type==="dcr"?{type:"dcr"}:{type:"none"});await r.createConnector({name:t.name,description:t.description??t.url,url:t.url,auth:u})},fe=t=>{if(t.auth.type==="header"){te(""),m(null),q(t);return}P(async()=>{await le(t),x(L.Settings.CONNECTOR_SAVED,{connector_name:t.name,mode:"create"})}).catch(()=>{})},be=t=>{if(t.preventDefault(),!d||!U.trim())return;const s=d;m(null),P(async()=>{const u={type:"header",apiKey:U.trim(),...s.auth.type==="header"&&s.auth.headerName?{headerName:s.auth.headerName}:{}};await le(s,u),se(),setTimeout(()=>{p==null||p.showSuccess({title:`${s.name} connected`}),x(L.Settings.CONNECTOR_SAVED,{connector_name:s.name,mode:"create"})},100)},m).catch(()=>{})},ie=async t=>{m(null),await P(async()=>{j?await r.updateConnector({id:j.id,...t}):await r.createConnector({...t})},m),setTimeout(()=>{p==null||p.showSuccess({title:`${t.name} ${j?"updated":"added"}`}),x(L.Settings.CONNECTOR_SAVED,{connector_name:t.name,mode:j?"update":"create"})},0)},ge=t=>{P(async()=>{await r.disconnectConnector({id:t.id}),x(L.Settings.CONNECTOR_DISCONNECTED,{connector_name:t.name}),M(null)}).catch(()=>{})},ye=()=>{o||(H(null),R(null))},ve=t=>{const s=r.deleteConnector;s&&(R(null),P(async()=>{await s({id:t.id}),x(L.Settings.CONNECTOR_DELETED,{connector_name:t.name}),H(null),M(null)},R).catch(()=>{}))},je=t=>{M(s=>(s==null?void 0:s.id)===t.id?t:s),b(s=>{const u=new Map(s.authStatusById);return u.set(t.id,t.authenticated),{ordered:s.ordered.map(O=>O.isConfigured&&O.connector.id===t.id?{connector:t,isConfigured:!0}:O),authStatusById:u}})},Ne=(t,s)=>{const u=ne[t.name],O=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:u?e.jsx(oe,{src:u,alt:t.name,className:"size-4.5"}):e.jsx(w,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:$("flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium",t.authenticated?"text-success-bg":"text-text-primary"),children:[e.jsx("span",{className:$("h-1.5 w-1.5 rounded-full",t.authenticated?"bg-success-bg":"bg-primary-button-bg")}),t.authenticated?"Connected":"Added"]})})]}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description})]})]}),G="flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0",h=t.auth.type==="dcr"&&!t.authenticated,Y=k&&he===t.id;return e.jsxs("article",{className:`${G} cursor-pointer transition-colors hover:bg-ghost-button-hover/60`,onClick:()=>{M(t)},children:[e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:O}),e.jsxs("div",{className:"flex items-center gap-2",children:[h?e.jsx(N.Secondary,{size:"small",type:"button",disabled:o||Y,onClick:_=>{_.stopPropagation(),re(t.id),n(t.id,we=>{re(null),we&&V()})},children:Y?"Connecting…":"Connect"}):null,e.jsxs(N.Secondary,{size:"small",type:"button",disabled:o,onClick:_=>{_.stopPropagation(),m(null),I(t),i(!0)},children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.deleteConnector?e.jsx(N.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:o,"aria-label":`Remove ${t.name}`,onClick:_=>{_.stopPropagation(),R(null),H(t)},children:"Remove"}):null,e.jsx(w,{name:"chevron-right",className:"size-4"})]})]},t.id)},Ce=t=>{const s=ne[t.name];return e.jsxs("article",{className:"flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:s?e.jsx(oe,{src:s,alt:t.name,className:"size-4.5"}):e.jsx(w,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description??t.url})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("span",{className:"hidden text-xs text-text-secondary sm:inline",children:Z[t.auth.type]??Z.none}),e.jsx(N.Secondary,{size:"small",type:"button",disabled:o,onClick:()=>{fe(t)},children:t.auth.type==="dcr"?"Add":"Connect"})]})]},t.id)},de=ee?e.jsx(ke,{title:"Remove connector?",description:`“${ee.name}” will no longer be available to your agents.`,busy:o,error:pe,onCancel:ye,onConfirm:()=>{ve(ee)}}):null;if(l)return e.jsxs(e.Fragment,{children:[e.jsx(Oe,{connector:l,busy:o,onBack:()=>{M(null)},onConnectorRefreshed:je,onEdit:()=>{m(null),I(l),i(!0)},onDisconnect:()=>{ge(l)},onRemove:r.deleteConnector?()=>{R(null),H(l)}:void 0}),e.jsx(ce,{open:D,onOpenChange:t=>{i(t),t||(I(null),m(null))},onSubmit:ie,connector:j??void 0,busy:o,error:C}),de]});const Se=Q.length>0||W.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Connectors"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Connect tools your agents can use."}),E?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:E}):null,e.jsx("div",{className:"mt-4 min-h-0 min-w-0 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full min-w-0 flex-col gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(ze,{query:g,setQuery:y,placeholder:"Search connectors"})}),e.jsxs(N.Secondary,{type:"button",className:"shrink-0",onClick:()=>{m(null),I(null),i(!0)},children:[e.jsx(w,{name:"plus",size:"1rem",className:"mr-1"}),"Add MCP Server"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[v?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!v&&Q.length>0?e.jsxs("section",{"aria-labelledby":"connected-connectors-heading",children:[e.jsxs("h4",{id:"connected-connectors-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Configured · ",Q.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:Q.map(t=>Ne(t))})]}):null,!v&&W.length>0?e.jsxs("section",{"aria-labelledby":"available-connectors-heading",children:[e.jsxs("h4",{id:"available-connectors-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Available · ",W.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:W.map(t=>Ce(t))})]}):null,!v&&!Se?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:g.trim()?`No connectors match “${g.trim()}”.`:"No connectors yet."}):null]}),e.jsx(xe,{open:d!==null,onOpenChange:t=>{t||se()},title:`Connect ${(d==null?void 0:d.name)??"connector"}`,description:d==null?void 0:d.url,contentSized:!0,className:"md:max-w-xl",children:e.jsxs("form",{onSubmit:be,children:[e.jsxs("div",{className:"space-y-5 px-5 py-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-6 text-text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-text-primary",children:d==null?void 0:d.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:d==null?void 0:d.description})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"connector-api-key",className:"mb-2 block text-xs font-semibold uppercase tracking-wide text-text-secondary",children:"API key / token"}),e.jsx("input",{id:"connector-api-key",type:"password",value:U,onChange:t=>{te(t.target.value)},placeholder:`Bearer <Paste the token from ${(d==null?void 0:d.name)??"the provider"}>`,autoFocus:!0,required:!0,className:X("h-11")})]}),C?e.jsx("p",{className:"text-failure-bg text-sm",children:C}):null]}),e.jsxs("footer",{className:"flex justify-end gap-2 border-t border-border px-5 py-4",children:[e.jsx(N.Ghost,{type:"button",onClick:se,disabled:o,children:"Cancel"}),e.jsx(N.Primary,{type:"submit",disabled:!U.trim()||o,children:"Connect"})]})]})}),e.jsx(ce,{open:D,onOpenChange:t=>{i(t),t||(I(null),m(null))},onSubmit:ie,connector:j??void 0,busy:o,error:C}),de]})})]})},_e=Re;export{_e as default};
|
|
1
|
+
import{C as ke}from"./chunk-C4DROCIN-CGWCL0tw.js";import{b6 as me,p as Ae,q as Ee,bc as ue,r as a,v as J,j as e,S as ze,C as N,I as w,b8 as xe,a6 as X,c as $,_ as L,b7 as oe}from"./index-KCrUroEv.js";var Fe=[{value:"none",label:"None"},{value:"header",label:"API Key"},{value:"dcr",label:"OAuth"}],ae=X("h-11 shadow-sm"),B=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),Me=({open:r,onOpenChange:p,onSubmit:x,connector:n,busy:k=!1,error:g})=>{const[y,c]=a.useState(""),[b,v]=a.useState(""),[A,E]=a.useState(""),[f,C]=a.useState("dcr"),[m,o]=a.useState(""),[z,F]=a.useState(""),S=n!==void 0,D=X(`h-11 shadow-sm ${S?"cursor-not-allowed bg-secondary-bg/60 text-text-secondary opacity-40":""}`),i=()=>{c(""),v(""),E(""),C("dcr"),o(""),F("")};a.useEffect(()=>{r&&(c((n==null?void 0:n.name)??""),v((n==null?void 0:n.url)??""),E((n==null?void 0:n.description)??""),C((n==null?void 0:n.auth.type)??"dcr"),o(""),F((n==null?void 0:n.auth.type)==="header"?n.auth.headerName??"":""))},[n,r]);const j=l=>{l||i(),p(l)},I=!!m.trim()||(n==null?void 0:n.auth.type)==="header",d=!!y.trim()&&!!A.trim()&&!!b.trim()&&(f!=="header"||I),q=async l=>{if(l.preventDefault(),!d||k)return;const M=f==="header"?{type:"header",apiKey:m.trim(),...z.trim()?{headerName:z.trim()}:{}}:{type:f};try{await x({name:y.trim(),url:b.trim(),description:A.trim(),auth:M}),i(),p(!1)}catch{}};return e.jsx(xe,{open:r,onOpenChange:j,title:S?"Edit MCP server":"Add MCP server",description:S?"Update how this connector authenticates.":"Point at a remote MCP endpoint. It then behaves like any other connector.",contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:l=>void q(l),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Name",e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-name",type:"text",required:!0,value:y,readOnly:S,"aria-disabled":S,onChange:l=>{c(l.target.value)},placeholder:"analytics-postgres-mcp",autoFocus:!S,className:D})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-description",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Description",e.jsx(B,{})]}),e.jsx("textarea",{id:"mcp-server-description",value:A,onChange:l=>{E(l.target.value)},placeholder:"Query analytics from Postgres",required:!0,rows:3,className:X("resize-y py-2.5 shadow-sm")})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-url",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["URL",e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-url",type:"url",required:!0,value:b,onChange:l=>{v(l.target.value)},placeholder:"https://mcp.example.com/mcp",className:ae})]}),e.jsxs("fieldset",{children:[e.jsxs("legend",{className:"mb-1.5 text-sm font-medium text-text-primary",children:["Auth type",e.jsx(B,{})]}),e.jsx("div",{className:"flex w-full flex-row rounded-md border border-border bg-secondary-bg/40 p-1",children:Fe.map(l=>e.jsxs("label",{className:`flex h-8 flex-1 cursor-pointer items-center justify-center rounded-sm text-sm font-medium transition-colors ${f===l.value?"bg-dropdown-selected-item-bg text-dropdown-selected-item-text shadow-sm":"text-text-secondary hover:text-text-primary"}`,children:[e.jsx("input",{type:"radio",name:"mcp-auth-type",value:l.value,checked:f===l.value,onChange:()=>{C(l.value)},className:"sr-only"}),l.label]},l.value))})]}),f==="dcr"?e.jsxs("div",{className:"flex gap-1.5 bg-secondary-bg/40 p-2 rounded-md",children:[e.jsx(w,{name:"info",className:"size-3.5 mt-1 text-text-secondary"}),e.jsx("div",{className:"text-xs text-text-secondary leading-5.5",children:"Sign-in only — the server must support dynamic client registration. Manual OAuth (client ID / secret) isn't supported yet."})]}):null,f==="header"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",(n==null?void 0:n.auth.type)==="header"?e.jsx("span",{className:"font-normal text-text-secondary",children:" (leave blank to keep current)"}):e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-api-key",type:"password",required:(n==null?void 0:n.auth.type)!=="header",value:m,onChange:l=>{o(l.target.value)},placeholder:"Bearer <Paste the token from the provider>","aria-describedby":"mcp-server-api-key-hint",className:ae}),e.jsx("p",{id:"mcp-server-api-key-hint",className:"mt-1.5 text-xs text-text-secondary",children:`This is the value for the "${z.trim()||"Authorization"}" header.`})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-header-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Header name ",e.jsx("span",{className:"font-normal text-text-secondary",children:"(optional)"})]}),e.jsx("input",{id:"mcp-server-header-name",type:"text",value:z,onChange:l=>{F(l.target.value)},placeholder:"Authorization",className:ae})]})]}):null]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[g?e.jsx("p",{className:"text-failure-bg text-sm",children:g}):null,e.jsx(N.Primary,{type:"submit",size:"large",disabled:!d||k,className:"w-full shrink-0",children:S?"Save":"Add"})]})]})})},ce=Me,Z={dcr:"OAuth2",header:"API Key",none:"No Auth"};function De({text:r}){const p=a.useRef(null),[x,n]=a.useState(!1),[k,g]=a.useState(!1),[y,c]=a.useState(16);return a.useLayoutEffect(()=>{n(!1),c(16)},[r]),a.useLayoutEffect(()=>{const b=p.current;if(!b)return;if(!x){c(16),g(b.scrollWidth>b.clientWidth+1);return}c(16);const v=requestAnimationFrame(()=>{c(b.scrollHeight)});return()=>cancelAnimationFrame(v)},[r,x]),r?e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("p",{ref:p,style:{maxHeight:y},className:$("mt-0.5 overflow-hidden font-mono text-xs leading-4 text-text-secondary transition-[max-height] duration-300 ease-in-out",!x&&"whitespace-nowrap",!x&&k&&"pr-[5.75rem]"),children:[r,x&&k?e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",className:"cursor-pointer font-mono text-xs font-medium text-text-primary/80 hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring","aria-expanded":!0,onClick:()=>n(!1),children:"Show less"})]}):null]}),!x&&k?e.jsxs("button",{type:"button",className:"absolute top-0.5 right-0 cursor-pointer bg-card-bg pl-1.5 font-mono text-xs font-medium leading-4 text-text-primary/80 hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring","aria-expanded":!1,onClick:()=>n(!0),children:[e.jsx("span",{"aria-hidden":!0,className:"text-text-secondary",children:"…"}),e.jsx("span",{className:"ml-1",children:"Read more"})]}):null]}):null}var Ie=({connector:r,onBack:p,onConnectorRefreshed:x,onEdit:n,onDisconnect:k,onRemove:g,busy:y=!1})=>{const{connectorCatalog:c}=me(),{handleAuthorize:b,isOAuthLoading:v}=ue(),[A,E]=a.useState([]),[f,C]=a.useState(!0),[m,o]=a.useState(null),[z,F]=a.useState(!1);a.useEffect(()=>{let i=!1;return E([]),o(null),C(!0),c.getToolsByConnectorId({id:r.id}).then(j=>{i||E(j)}).catch(j=>{i||o(J(j,"Failed to load connector tools"))}).finally(()=>{i||C(!1)}),()=>{i=!0}},[r.authenticated,r.id,c]);const S=async()=>{F(!0),o(null);try{const i=await c.getConnector({id:r.id});x(i)}catch(i){o(J(i,"Failed to refresh connector details"))}finally{F(!1)}},D=v||z;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:p,className:"mb-3 inline-flex w-fit items-center gap-1 rounded-md py-1 pr-2 text-sm text-text-secondary hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",children:[e.jsx(w,{name:"chevron-left",className:"size-3.5"}),"Connectors"]}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-y-auto pb-1",children:[e.jsxs("header",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"text-lg font-semibold text-text-primary",children:r.name}),e.jsx("span",{className:"inline-flex items-center rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-text-secondary",children:Z[r.auth.type]??Z.none}),e.jsxs("span",{className:$("flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium",r.authenticated?"text-success-bg":"text-text-primary"),children:[e.jsx("span",{className:$("h-1.5 w-1.5 rounded-full",r.authenticated?"bg-success-bg":"bg-primary-button-bg")}),r.authenticated?"Connected":"Not authenticated"]})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:e.jsx("span",{className:"text-text-secondary",children:r.description})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(N.Secondary,{size:"small",type:"button",disabled:y,onClick:n,children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.auth.type==="dcr"&&!r.authenticated?e.jsx(N.Secondary,{size:"small",type:"button",disabled:y||D,onClick:()=>{b(r.id,i=>{i&&S()})},children:D?"Connecting…":"Connect"}):r.auth.type==="dcr"&&!r.requiresAuth?e.jsx(N.Secondary,{size:"small",type:"button",disabled:y,onClick:k,children:"Disconnect"}):null,g?e.jsx(N.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:y,"aria-label":`Remove ${r.name}`,onClick:g,children:"Remove"}):null]})]}),e.jsx("section",{className:"mt-6","aria-labelledby":"connector-tools-heading",children:f?e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"Loading tools…"}):m?e.jsxs("div",{className:"rounded-xl border border-failure-bg/30 bg-failure-bg/10 p-6 text-center text-sm text-failure-bg",children:[m,r.auth.type==="dcr"&&!r.authenticated&&e.jsx("div",{className:"font-bold mt-1",children:"Click Connect and authenticate successfully to view tools."})]}):A.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("h5",{id:"connector-tools-heading",className:"mb-2 text-[0.8125rem] font-semibold text-text-primary",children:["Tools ",e.jsxs("span",{className:"font-normal text-text-secondary",children:["· ",A.length]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:A.map(i=>e.jsx("article",{className:"flex min-h-12 items-start gap-3 border-b border-border px-3 py-2 last:border-b-0",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h6",{className:"text-sm font-medium text-text-primary",children:i.name}),e.jsx(De,{text:i.description})]})},i.id))})]}):e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"No tools reported for this connector."})})]})]})},Oe=Ie,Re=()=>{const{connectorCatalog:r}=me(),p=Ae(),x=Ee(),{handleAuthorize:n,isOAuthLoading:k}=ue(),[g,y]=a.useState(""),[c,b]=a.useState({ordered:[],authStatusById:new Map}),[v,A]=a.useState(!0),[E,f]=a.useState(null),[C,m]=a.useState(null),[o,z]=a.useState(!1),[F,S]=a.useState([]),[D,i]=a.useState(!1),[j,I]=a.useState(null),[d,q]=a.useState(null),[l,M]=a.useState(null),[he,re]=a.useState(null),[ee,H]=a.useState(null),[pe,R]=a.useState(null),[U,te]=a.useState(""),ne=a.useMemo(()=>(F??[]).reduce((t,s)=>(t[s.name]=s.logo??"",t),{}),[F]),V=a.useCallback(async()=>{A(!0),f(null);try{const[t,s]=await Promise.all([r.listConnectors(),r.getConnectorCatalog()]);S(s);const u=t??[],O=new Set(u.map(h=>h.id)),G=[...u.map(h=>({connector:h,isConfigured:!0})),...s.filter(h=>!O.has(h.id)).map(h=>({connector:h,isConfigured:!1}))];b({ordered:G,authStatusById:new Map(G.map(h=>[h.connector.id,h.isConfigured?h.connector.authenticated:!1]))}),M(h=>h?t.find(Y=>Y.id===h.id)??null:null)}catch(t){f(J(t,"Failed to load connectors"))}finally{A(!1)}},[r]);a.useEffect(()=>{V()},[V]);const T=g.trim().toLowerCase(),K=a.useMemo(()=>T?c.ordered.filter(({connector:t})=>{var s;return t.name.toLowerCase().includes(T)||(((s=t.description)==null?void 0:s.toLowerCase().includes(T))??!1)||t.url.toLowerCase().includes(T)}):c.ordered,[c.ordered,T]),Q=a.useMemo(()=>{const t=[];for(const s of K)if(s.isConfigured){const u=c.authStatusById.get(s.connector.id)??s.connector.authenticated;t.push(u===s.connector.authenticated?s.connector:{...s.connector,authenticated:u})}return t},[c.authStatusById,K]),W=a.useMemo(()=>{const t=[];for(const s of K)s.isConfigured||t.push(s.connector);return t},[K]),P=async(t,s=f)=>{z(!0),f(null);try{await t(),await V()}catch(u){throw s(J(u,"Request failed")),u}finally{z(!1)}},se=()=>{q(null),te(""),m(null)},le=async(t,s)=>{const u=s??(t.auth.type==="header"?{type:"header",...t.auth.headerName?{headerName:t.auth.headerName}:{}}:t.auth.type==="dcr"?{type:"dcr"}:{type:"none"});await r.createConnector({name:t.name,description:t.description??t.url,url:t.url,auth:u})},fe=t=>{if(t.auth.type==="header"){te(""),m(null),q(t);return}P(async()=>{await le(t),x(L.Settings.CONNECTOR_SAVED,{connector_name:t.name,mode:"create"})}).catch(()=>{})},be=t=>{if(t.preventDefault(),!d||!U.trim())return;const s=d;m(null),P(async()=>{const u={type:"header",apiKey:U.trim(),...s.auth.type==="header"&&s.auth.headerName?{headerName:s.auth.headerName}:{}};await le(s,u),se(),setTimeout(()=>{p==null||p.showSuccess({title:`${s.name} connected`}),x(L.Settings.CONNECTOR_SAVED,{connector_name:s.name,mode:"create"})},100)},m).catch(()=>{})},ie=async t=>{m(null),await P(async()=>{j?await r.updateConnector({id:j.id,...t}):await r.createConnector({...t})},m),setTimeout(()=>{p==null||p.showSuccess({title:`${t.name} ${j?"updated":"added"}`}),x(L.Settings.CONNECTOR_SAVED,{connector_name:t.name,mode:j?"update":"create"})},0)},ge=t=>{P(async()=>{await r.disconnectConnector({id:t.id}),x(L.Settings.CONNECTOR_DISCONNECTED,{connector_name:t.name}),M(null)}).catch(()=>{})},ye=()=>{o||(H(null),R(null))},ve=t=>{const s=r.deleteConnector;s&&(R(null),P(async()=>{await s({id:t.id}),x(L.Settings.CONNECTOR_DELETED,{connector_name:t.name}),H(null),M(null)},R).catch(()=>{}))},je=t=>{M(s=>(s==null?void 0:s.id)===t.id?t:s),b(s=>{const u=new Map(s.authStatusById);return u.set(t.id,t.authenticated),{ordered:s.ordered.map(O=>O.isConfigured&&O.connector.id===t.id?{connector:t,isConfigured:!0}:O),authStatusById:u}})},Ne=(t,s)=>{const u=ne[t.name],O=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:u?e.jsx(oe,{src:u,alt:t.name,className:"size-4.5"}):e.jsx(w,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:$("flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium",t.authenticated?"text-success-bg":"text-text-primary"),children:[e.jsx("span",{className:$("h-1.5 w-1.5 rounded-full",t.authenticated?"bg-success-bg":"bg-primary-button-bg")}),t.authenticated?"Connected":"Added"]})})]}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description})]})]}),G="flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0",h=t.auth.type==="dcr"&&!t.authenticated,Y=k&&he===t.id;return e.jsxs("article",{className:`${G} cursor-pointer transition-colors hover:bg-ghost-button-hover/60`,onClick:()=>{M(t)},children:[e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:O}),e.jsxs("div",{className:"flex items-center gap-2",children:[h?e.jsx(N.Secondary,{size:"small",type:"button",disabled:o||Y,onClick:_=>{_.stopPropagation(),re(t.id),n(t.id,we=>{re(null),we&&V()})},children:Y?"Connecting…":"Connect"}):null,e.jsxs(N.Secondary,{size:"small",type:"button",disabled:o,onClick:_=>{_.stopPropagation(),m(null),I(t),i(!0)},children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.deleteConnector?e.jsx(N.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:o,"aria-label":`Remove ${t.name}`,onClick:_=>{_.stopPropagation(),R(null),H(t)},children:"Remove"}):null,e.jsx(w,{name:"chevron-right",className:"size-4"})]})]},t.id)},Ce=t=>{const s=ne[t.name];return e.jsxs("article",{className:"flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:s?e.jsx(oe,{src:s,alt:t.name,className:"size-4.5"}):e.jsx(w,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description??t.url})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("span",{className:"hidden text-xs text-text-secondary sm:inline",children:Z[t.auth.type]??Z.none}),e.jsx(N.Secondary,{size:"small",type:"button",disabled:o,onClick:()=>{fe(t)},children:t.auth.type==="dcr"?"Add":"Connect"})]})]},t.id)},de=ee?e.jsx(ke,{title:"Remove connector?",description:`“${ee.name}” will no longer be available to your agents.`,busy:o,error:pe,onCancel:ye,onConfirm:()=>{ve(ee)}}):null;if(l)return e.jsxs(e.Fragment,{children:[e.jsx(Oe,{connector:l,busy:o,onBack:()=>{M(null)},onConnectorRefreshed:je,onEdit:()=>{m(null),I(l),i(!0)},onDisconnect:()=>{ge(l)},onRemove:r.deleteConnector?()=>{R(null),H(l)}:void 0}),e.jsx(ce,{open:D,onOpenChange:t=>{i(t),t||(I(null),m(null))},onSubmit:ie,connector:j??void 0,busy:o,error:C}),de]});const Se=Q.length>0||W.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Connectors"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Connect tools your agents can use."}),E?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:E}):null,e.jsx("div",{className:"mt-4 min-h-0 min-w-0 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full min-w-0 flex-col gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(ze,{query:g,setQuery:y,placeholder:"Search connectors"})}),e.jsxs(N.Secondary,{type:"button",className:"shrink-0",onClick:()=>{m(null),I(null),i(!0)},children:[e.jsx(w,{name:"plus",size:"1rem",className:"mr-1"}),"Add MCP Server"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[v?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!v&&Q.length>0?e.jsxs("section",{"aria-labelledby":"connected-connectors-heading",children:[e.jsxs("h4",{id:"connected-connectors-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Configured · ",Q.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:Q.map(t=>Ne(t))})]}):null,!v&&W.length>0?e.jsxs("section",{"aria-labelledby":"available-connectors-heading",children:[e.jsxs("h4",{id:"available-connectors-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Available · ",W.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:W.map(t=>Ce(t))})]}):null,!v&&!Se?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:g.trim()?`No connectors match “${g.trim()}”.`:"No connectors yet."}):null]}),e.jsx(xe,{open:d!==null,onOpenChange:t=>{t||se()},title:`Connect ${(d==null?void 0:d.name)??"connector"}`,description:d==null?void 0:d.url,contentSized:!0,className:"md:max-w-xl",children:e.jsxs("form",{onSubmit:be,children:[e.jsxs("div",{className:"space-y-5 px-5 py-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-6 text-text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-text-primary",children:d==null?void 0:d.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:d==null?void 0:d.description})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"connector-api-key",className:"mb-2 block text-xs font-semibold uppercase tracking-wide text-text-secondary",children:"API key / token"}),e.jsx("input",{id:"connector-api-key",type:"password",value:U,onChange:t=>{te(t.target.value)},placeholder:`Bearer <Paste the token from ${(d==null?void 0:d.name)??"the provider"}>`,autoFocus:!0,required:!0,className:X("h-11")})]}),C?e.jsx("p",{className:"text-failure-bg text-sm",children:C}):null]}),e.jsxs("footer",{className:"flex justify-end gap-2 border-t border-border px-5 py-4",children:[e.jsx(N.Ghost,{type:"button",onClick:se,disabled:o,children:"Cancel"}),e.jsx(N.Primary,{type:"submit",disabled:!U.trim()||o,children:"Connect"})]})]})}),e.jsx(ce,{open:D,onOpenChange:t=>{i(t),t||(I(null),m(null))},onSubmit:ie,connector:j??void 0,busy:o,error:C}),de]})})]})},_e=Re;export{_e as default};
|
|
Binary file
|
|
Binary file
|
package/dist/_frontend/assets/{DockLayout-6X5P5E3T-DKDOGTZ4.js → DockLayout-4D2FHI2S-VT0vOxxV.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as r}from"./chunk-
|
|
1
|
+
import{S as r}from"./chunk-5MP3OBDD-Cnbi6k-M.js";import{j as a,aQ as t,c as l}from"./index-KCrUroEv.js";import"./chunk-K6BABP2I-DmT0oS_X.js";function c({className:o}){return a.jsx(t,{children:a.jsx("div",{"data-aui-compact-layout":!0,className:l("ml-auto flex h-full w-full max-w-[min(400px,100%)] min-h-0 min-w-0 flex-col border-l border-border bg-primary-bg shadow-[-4px_0_24px_color-mix(in_oklab,var(--shadow-color)_6%,transparent)]",o),children:a.jsx(r,{})})})}export{c as DockLayout};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-
|
|
2
|
-
import{aJ as T,a0 as R,aK as V,u as s,r as a,aL as M,aM as F,j as t,P as H,I as p,Z as g,aN as f,aO as U,c as q,aP as j}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-C7HL754X-BhpCKRCk.js","./index-KCrUroEv.js","./index-B01pXqvC.css","./SchedulesPage-L3AK7JJI-Cj-DMCfm.js","./chunk-4BKRLRXL-CG21G8ZQ.js","./EnvironmentsPage-FJLSJBQT-Dsc78Ggo.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aJ as T,a0 as R,aK as V,u as s,r as a,aL as M,aM as F,j as t,P as H,I as p,Z as g,aN as f,aO as U,c as q,aP as j}from"./index-KCrUroEv.js";import{A as J,S as K,N as Z,T as G}from"./chunk-K6BABP2I-DmT0oS_X.js";var Q=a.lazy(()=>j(()=>import("./SettingsBuilder-C7HL754X-BhpCKRCk.js"),__vite__mapDeps([0,1,2]),import.meta.url)),W=a.lazy(()=>j(()=>import("./SchedulesPage-L3AK7JJI-Cj-DMCfm.js"),__vite__mapDeps([3,4,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),X=a.lazy(()=>j(()=>import("./EnvironmentsPage-FJLSJBQT-Dsc78Ggo.js"),__vite__mapDeps([5,4,1,2]),import.meta.url).then(n=>({default:n.EnvironmentsPage})));function ee({className:n}){const y=T(),e=R(),u=V(),v=s("ClearChatButton"),A=s("ResetAgentBuilderButton"),N=s("AgentDetailsPage"),O=s("AgentsLibrary"),h=s("SessionsPage"),C=s("ShareChatButton"),S=s("SaveAgentButton"),w=s("SelectAgentEmptyState"),E=s("UserAvatar"),_=a.useRef(null),B=(e==null?void 0:e.mode.status)==="idle",d=(e==null?void 0:e.settingsOpen)===!0,r=(e==null?void 0:e.libraryOpen)===!0,m=(e==null?void 0:e.sessionsOpen)===!0,o=(e==null?void 0:e.schedulesOpen)===!0,c=(e==null?void 0:e.environmentsOpen)===!0,l=d||r||m||o||c,P=M(),x=e!=null&&F(e.mode),i=u&&(m||o||c||x&&!d&&!r),L=x&&!l&&!u,b=(e==null?void 0:e.isNewChatEnabled)!==!1,k=()=>{if(e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled){e.openDraft();return}e==null||e.setSettingsOpen(!1),e==null||e.setSchedulesOpen(!1),e==null||e.setEnvironmentsOpen(!1),Promise.resolve(y.threads().switchToNewThread()).catch(()=>{})},I=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()},z=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSchedulesOpen(!1),e==null||e.setSessionsOpen(!1),e==null||e.setEnvironmentsOpen(!1),i&&x&&(e==null||e.openDraft())},D=i||r||o||c;return t.jsxs("div",{className:q("relative flex h-full min-h-0 w-full bg-primary-bg",n),children:[L?t.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:w-88 md:max-w-none md:shrink-0 md:shadow-none",children:t.jsx(J,{})}):null,t.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[t.jsx(H,{className:"bg-topbar-bg",title:D?t.jsxs("button",{type:"button",className:g({variant:"ghost",size:"small"}),onClick:z,children:[t.jsx(p,{name:"arrow-left"}),"Back to chat"]}):l?null:t.jsx(Z,{}),end:t.jsxs(t.Fragment,{children:[!l&&!i?t.jsxs(t.Fragment,{children:[t.jsx(A,{}),t.jsx(C,{}),t.jsx(v,{}),t.jsx(S,{})]}):null,t.jsx(K,{},"shell-actions"),t.jsx(E,{}),!l&&!i?t.jsxs(t.Fragment,{children:[b&&!P?t.jsx("button",{type:"button","aria-label":"New Chat",title:"New Chat",className:g({variant:"ghost",size:"icon"}),onClick:k,children:t.jsx(p,{name:"square-pen"})}):null,b&&(e!=null&&e.isComposerEnabled)&&!u?t.jsx("button",{type:"button","aria-label":"New Agent",title:"New Agent",className:g({variant:"ghost",size:"icon"}),onClick:I,children:t.jsx(p,{name:"agent-2"})}):null]}):null]})}),t.jsx("div",{ref:_,className:"min-h-0 min-w-0 flex-1",children:d?t.jsx(a.Suspense,{fallback:t.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[t.jsx(f,{size:28,className:"text-text-primary"}),t.jsx("span",{className:"sr-only",children:"Loading"})]}),children:t.jsx(Q,{})}):i?t.jsx(U,{}):m?t.jsx(h,{}):r&&(e==null?void 0:e.libraryAgentId)!=null?t.jsx(N,{agentId:e.libraryAgentId},e.libraryAgentId):r?t.jsx(O,{}):o?t.jsx(a.Suspense,{fallback:t.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[t.jsx(f,{size:28,className:"text-text-primary"}),t.jsx("span",{className:"sr-only",children:"Loading"})]}),children:t.jsx(W,{})}):c?t.jsx(a.Suspense,{fallback:t.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[t.jsx(f,{size:28,className:"text-text-primary"}),t.jsx("span",{className:"sr-only",children:"Loading"})]}),children:t.jsx(X,{})}):B?t.jsx(w,{}):t.jsx(G,{})})]})]})}export{ee as DrawerLayout};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{B as fe}from"./chunk-4BKRLRXL-
|
|
1
|
+
import{B as fe}from"./chunk-4BKRLRXL-CG21G8ZQ.js";import{aa as ie,a0 as ge,ab as ve,p as re,q as le,r as c,ac as O,v as oe,ad as X,ae as ee,j as e,P as Ne,S as be,C as R,I as P,E as q,D as je,af as ye,G as ke,H as we,J as te,K as T,L as Ee,M as B,k as ce,a9 as Se,Z as Q,F as Ce,c as F,O as Ae,Q as Te,R as Be,U as Pe,V as De,W as Le,a3 as Re,_ as Z,ag as _e}from"./index-KCrUroEv.js";var Ve="default";function me(t){return t.trim()===Ve}function ze(t,l){return me(t.name)||l===void 0||t.createdBySubject.subjectId!==l}function Oe(t){const l=(t==null?void 0:t.cpu)??1,n=(t==null?void 0:t.memory)??1,a=(t==null?void 0:t.disk)??3;return`${String(l)} vCPU · ${String(n)} GB RAM · ${String(a)} GB disk`}function Fe(t){var a;if((t==null?void 0:t.networkBlockAll)===!0)return"Blocked";const l=((a=t==null?void 0:t.domainAllowList)==null?void 0:a.trim())??"";if(l.length===0)return"Unrestricted";const n=l.split(",").map(s=>s.trim()).filter(s=>s.length>0).length;return n===0?"Unrestricted":`${String(n)} allowed domain${n===1?"":"s"}`}function ne(){return{name:"",description:"",image:{type:"build",buildScript:""},resources:{cpu:1,memory:1,disk:3},networking:{networkBlockAll:!1}}}function se(t){var l,n,a,s,m,i,o,u;return{name:t.name,description:t.description??"",buildScript:((l=t.image)==null?void 0:l.buildScript)??"",cpu:String(((n=t.resources)==null?void 0:n.cpu)??1),memory:String(((a=t.resources)==null?void 0:a.memory)??1),disk:String(((s=t.resources)==null?void 0:s.disk)??3),networkBlockAll:((m=t.networking)==null?void 0:m.networkBlockAll)===!0,domainAllowList:((i=t.networking)==null?void 0:i.domainAllowList)??"",secrets:((u=(o=t.networking)==null?void 0:o.secrets)==null?void 0:u.map(d=>({...d,hosts:[...d.hosts]})))??[],environmentVariables:Object.entries(t.environmentVariables??{}).map(([d,g])=>({key:d,value:g}))}}function Ie(t){const l=Number(t.cpu),n=Number(t.memory),a=Number(t.disk),s=Object.fromEntries(t.environmentVariables.map(i=>[i.key.trim(),i.value]).filter(([i,o])=>i.length>0&&o.length>0)),m=t.networkBlockAll?void 0:t.secrets.map(i=>({env:i.env.trim(),value:i.value,hosts:i.hosts.map(o=>o.trim()).filter(o=>o.length>0)})).filter(i=>i.env.length>0&&i.value.length>0);return{name:t.name.trim(),...t.description.trim().length===0?{}:{description:t.description.trim()},...t.buildScript.trim().length===0?{}:{image:{type:"build",buildScript:t.buildScript}},resources:{cpu:Number.isFinite(l)&&l>0?l:1,memory:Number.isFinite(n)&&n>0?n:1,disk:Number.isFinite(a)&&a>0?a:3},...Object.keys(s).length===0?{}:{environmentVariables:s},networking:t.networkBlockAll?{networkBlockAll:!0}:{networkBlockAll:!1,...t.domainAllowList.trim().length===0?{}:{domainAllowList:t.domainAllowList.trim()},...m==null||m.length===0?{}:{secrets:m}}}}function Me(t){const l=t.name.trim();if(l.length===0)return"Name is required";if(me(l))return'Name "default" is reserved';const n=Number(t.cpu),a=Number(t.memory),s=Number(t.disk);if(!Number.isFinite(n)||n<=0)return"CPU must be a positive number";if(!Number.isFinite(a)||a<=0)return"Memory must be a positive number";if(!Number.isFinite(s)||s<=0)return"Disk must be a positive number";if(!t.networkBlockAll){for(const m of t.secrets)if(m.env.trim().length!==0&&m.value.trim().length===0)return"Secret value is required"}return null}var f="w-full rounded-md border border-border bg-input-box-bg px-2.5 py-1.5 text-sm text-text-primary placeholder:text-text-secondary/70 outline-none focus:border-primary-button-bg",ae="text-sm font-medium text-text-primary",z="rounded-lg border border-border p-4 flex flex-col gap-4";function Ge({values:t,onChange:l,nameDisabled:n}){const a=s=>l({...t,...s});return e.jsxs("div",{className:"flex flex-col gap-4 pb-8",children:[e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:ae,children:"Name"}),e.jsx("input",{className:F(f,n&&"opacity-70"),value:t.name,disabled:n,placeholder:"my-environment",onChange:s=>a({name:s.target.value})})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:ae,children:"Description"}),e.jsx("textarea",{className:F(f,"min-h-20 resize-y"),value:t.description,placeholder:"write description ...",onChange:s=>a({description:s.target.value})})]}),e.jsxs("div",{className:z,children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Image And Resources"}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsxs("span",{className:"text-xs font-medium text-text-secondary",children:["Build Script (",t.buildScript.length,"/5120)"]}),e.jsx("textarea",{className:F(f,"min-h-24 resize-y font-mono text-xs"),value:t.buildScript,placeholder:`set -ex
|
|
2
2
|
pip install httpx
|
|
3
3
|
`,onChange:s=>a({buildScript:s.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"CPU"}),e.jsx("input",{className:f,type:"number",min:.1,step:"any",value:t.cpu,placeholder:"type...",onChange:s=>a({cpu:s.target.value})})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"Memory (GB)"}),e.jsx("input",{className:f,type:"number",min:.1,step:"any",value:t.memory,placeholder:"type...",onChange:s=>a({memory:s.target.value})})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"Disk (GB)"}),e.jsx("input",{className:f,type:"number",min:.1,step:"any",value:t.disk,placeholder:"type...",onChange:s=>a({disk:s.target.value})})]})]})]}),e.jsxs("div",{className:z,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Environment Variables"}),e.jsx("button",{type:"button",className:"cursor-pointer text-xs font-medium text-text-secondary transition-colors hover:text-text-primary",onClick:()=>a({environmentVariables:[...t.environmentVariables,{key:"",value:""}]}),children:"+ Add Variables"})]}),t.environmentVariables.map((s,m)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx("input",{className:f,value:s.key,placeholder:"KEY",onChange:i=>{const o=t.environmentVariables.map((u,d)=>d===m?{...u,key:i.target.value}:u);a({environmentVariables:o})}}),e.jsx("input",{className:f,value:s.value,placeholder:"value",onChange:i=>{const o=t.environmentVariables.map((u,d)=>d===m?{...u,value:i.target.value}:u);a({environmentVariables:o})}})]}),e.jsx("button",{type:"button",className:Q({variant:"ghost",size:"icon"}),"aria-label":"Remove environment variable",onClick:()=>a({environmentVariables:t.environmentVariables.filter((i,o)=>o!==m)}),children:e.jsx(P,{name:"trash",className:"size-3.5 text-failure-bg"})})]},m))]}),e.jsxs("div",{className:z,children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Block All Network"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Overrides the domain allow list"})]}),e.jsx(_e,{checked:t.networkBlockAll,onCheckedChange:s=>a({networkBlockAll:s}),"aria-label":"Block All Network"})]}),t.networkBlockAll?null:e.jsxs("label",{className:"flex flex-col gap-1.5 pt-1",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"Domain Allow List"}),e.jsx("input",{className:f,value:t.domainAllowList,placeholder:"api.github.com,api.openai.com",onChange:s=>a({domainAllowList:s.target.value})})]})]}),t.networkBlockAll?null:e.jsxs("div",{className:z,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Secrets"}),e.jsxs("span",{className:"text-xs text-text-secondary",children:["Synced immediately with existing sandboxes."," ",e.jsxs("a",{href:"https://trueforge.dev/sandbox#how-changes-reach-a-running-session",target:"_blank",rel:"noreferrer",className:"text-primary-button-bg inline-flex items-center gap-1 hover:underline",children:["Learn more",e.jsx(P,{name:"external-link",className:"size-3"})]})]})]}),e.jsx("button",{type:"button",className:"cursor-pointer text-xs font-medium text-text-secondary transition-colors hover:text-text-primary",onClick:()=>a({secrets:[...t.secrets,{env:"",value:"",hosts:[]}]}),children:"+ Add Secret"})]}),t.secrets.map((s,m)=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx("input",{className:f,value:s.env,placeholder:"ENV_NAME",onChange:i=>{const o=t.secrets.map((u,d)=>d===m?{...u,env:i.target.value}:u);a({secrets:o})}}),e.jsx("input",{className:f,type:"password",value:s.value,placeholder:"value",onChange:i=>{const o=t.secrets.map((u,d)=>d===m?{...u,value:i.target.value}:u);a({secrets:o})}})]}),e.jsx("button",{type:"button",className:Q({variant:"ghost",size:"icon"}),"aria-label":"Remove secret",onClick:()=>a({secrets:t.secrets.filter((i,o)=>o!==m)}),children:e.jsx(P,{name:"trash",className:"size-3.5 text-failure-bg"})})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("input",{className:f,value:s.hosts.join(","),placeholder:"api.github.com,api.openai.com",onChange:i=>{const o=i.target.value.split(",").map(d=>d.trim()),u=t.secrets.map((d,g)=>g===m?{...d,hosts:o}:d);a({secrets:u})}}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Hosts allowed to resolve secret (comma-separated)."})]})]},m))]})]})}function Ue({open:t,onOpenChange:l,mode:n,environment:a,onSaved:s}){const m=ie(),i=re(),o=le(),[u,d]=c.useState(()=>se(ne())),[g,S]=c.useState(!1),[v,b]=c.useState(null);c.useEffect(()=>{if(!t){b(null),S(!1);return}const p=n==="edit"&&a!=null?a.manifest:ne();d(se(p)),b(null)},[t,n,a]);const C=async p=>{p.preventDefault(),b(null);const k=Me(u);if(k!=null){b(k);return}S(!0);try{const N=Ie(u),D=n==="create"?await m.createEnvironment({manifest:N}):await m.createOrUpdateEnvironment({manifest:N});o(n==="create"?Z.Environment.CREATED:Z.Environment.EDITED,{environment_name:D.name,environment_id:D.id}),i==null||i.showSuccess({title:n==="create"?"Environment created":"Environment updated"}),s==null||s(),l(!1)}catch(N){b(oe(N,"Failed to save environment")),i==null||i.showError(N)}finally{S(!1)}},y=n==="create"?"New environment":(a==null?void 0:a.name)??"Edit environment";return e.jsx(Re,{open:t,onOpenChange:l,title:y,description:"Configure the environment.",size:"xl",footer:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(R.Secondary,{type:"button",disabled:g,onClick:()=>l(!1),children:"Cancel"}),e.jsx(R.Primary,{type:"submit",form:"environment-form",disabled:g,children:g?"Saving…":n==="create"?"Create":"Save"})]}),children:e.jsxs("form",{id:"environment-form",className:"flex min-h-0 flex-1 flex-col gap-4 px-5 pt-4 pb-10",onSubmit:p=>void C(p),children:[v!=null?e.jsx("p",{className:"text-sm text-failure-bg",children:v}):null,e.jsx(Ge,{values:u,onChange:d,nameDisabled:n==="edit"})]})})}var He={pending:{label:"Building",variant:"info",icon:"loader"},ready:{label:"Ready",variant:"success",icon:"check"},failed:{label:"Failed",variant:"destructive",icon:"triangle-exclamation"}};function qe({status:t,statusReason:l}){const n=He[t],a=e.jsxs(fe,{variant:n.variant,shape:"rounded",size:"sm",children:[e.jsx(P,{name:n.icon,className:n.icon==="loader"?"size-3.5 shrink-0 animate-spin":"size-3.5 shrink-0"}),n.label]});return t==="failed"&&l!=null&&l.length>0?e.jsx(ce,{content:l,children:a}):a}var $e=[10,25],Qe=1e4;function $(t){return Math.min(Math.max(t,1),25)}function Ze(){return O(window.location.search).isNew?{kind:"create"}:{kind:"closed"}}function Ye(t){const l=ie(),n=ge(),a=ve(),s=re(),m=le(),[i,o]=c.useState([]),[u,d]=c.useState(!0),[g,S]=c.useState(null),[v,b]=c.useState(()=>O(window.location.search).q??""),[C,y]=c.useState(()=>Ze()),[p,k]=c.useState(null),[N,D]=c.useState(!1),[w,de]=c.useState(()=>$(Le)),[_,L]=c.useState(void 0),[I,K]=c.useState(void 0),[M,G]=c.useState(void 0),V=c.useRef(0),J=c.useRef(!1),W=c.useRef((n==null?void 0:n.settingsOpen)??!1),U=(n==null?void 0:n.settingsOpen)??!1,A=c.useCallback(async({token:r,size:x,silent:j=!1})=>{const E=++V.current;j||(d(!0),S(null));try{const h=await l.listEnvironments({limit:$(x),...r===void 0||r===""?{}:{pageToken:r}});if(E!==V.current)return;o(h.data),K(h.nextPageToken),G(h.previousPageToken)}catch(h){if(E!==V.current)return;j||(S(oe(h,"Check your connection and try again.")),o([]),K(void 0),G(void 0))}finally{E===V.current&&!j&&d(!1)}},[l]);c.useEffect(()=>{X({q:v.trim().length===0?null:v})},[v]),c.useEffect(()=>{A({token:_,size:w})},[A,w,_]),c.useEffect(()=>{W.current&&!U&&A({token:_,size:w}),W.current=U},[U,A,_,w]),c.useEffect(()=>{const r=i.filter(j=>j.status==="pending");if(r.length===0)return;const x=window.setInterval(async()=>{try{const E=(await Promise.all(r.map(h=>l.getEnvironment({name:h.name}).catch(()=>null)))).filter(h=>h!=null);if(E.length===0)return;o(h=>h.map(Y=>E.find(he=>he.name===Y.name)??Y)),E.some(h=>h.status!=="pending")&&(n==null||n.invalidateEnvironmentsList())}catch{}},Qe);return()=>window.clearInterval(x)},[i,l,n]),c.useEffect(()=>{J.current||O(window.location.search).isNew&&(J.current=!0,y({kind:"create"}),X({isNew:null}))},[]),c.useEffect(()=>{const r=()=>{const x=O(window.location.search);b(x.q??""),x.isNew&&y({kind:"create"})};return window.addEventListener(ee,r),()=>window.removeEventListener(ee,r)},[]);const H=c.useMemo(()=>{const r=v.trim().toLowerCase();return r.length===0?i:i.filter(x=>x.name.toLowerCase().includes(r)||x.description.toLowerCase().includes(r))},[i,v]),ue=I!=null||M!=null||i.length>0,xe=()=>{y({kind:"create"})},pe=async()=>{if(p!=null){D(!0);try{await l.deleteEnvironment({name:p.name}),m(Z.Environment.DELETED,{environment_name:p.name,environment_id:p.id}),s==null||s.showSuccess({title:"Environment deleted"}),k(null),L(void 0),n==null||n.invalidateEnvironmentsList(),A({token:void 0,size:w})}catch(r){s==null||s.showError(r)}finally{D(!1)}}};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-primary-bg",children:[e.jsx(Ne,{title:"Environments",end:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-64",children:e.jsx(be,{query:v,setQuery:b,placeholder:"Search environments by name"})}),e.jsxs(R.Primary,{type:"button",onClick:xe,children:[e.jsx(P,{name:"plus",className:"size-3.5"}),"New Environment"]})]})}),e.jsx("div",{className:F("min-h-0 flex-1 overflow-auto px-4 py-4",g!=null?"flex flex-col":void 0),children:g!=null?e.jsx("div",{role:"alert",className:"flex flex-1 flex-col items-center justify-center",children:e.jsx(q,{title:"Couldn't load environments",description:g,className:"h-auto min-h-0 flex-none py-0"})}):u?e.jsx("div",{className:"flex flex-col gap-2",role:"status","aria-label":"Loading environments",children:Array.from({length:5},(r,x)=>e.jsx(je,{className:"h-12 w-full rounded-md"},x))}):i.length===0?e.jsx(q,{title:"No environments yet",description:"Create an environment to customize sandbox images, resources, and networking.",className:"min-h-full"}):H.length===0?e.jsx(q,{title:"No environments found",description:e.jsxs(e.Fragment,{children:["No environments match ",e.jsx(ye,{children:v.trim()}),"."]}),className:"min-h-full"}):e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs(ke,{className:"min-w-240",children:[e.jsx(we,{children:e.jsxs(te,{className:"hover:bg-transparent",children:[e.jsx(T,{className:"w-96 max-w-96",children:"Name"}),e.jsx(T,{children:"Build Status"}),e.jsx(T,{children:"Resources"}),e.jsx(T,{children:"Networking"}),e.jsx(T,{children:"Updated"}),e.jsx(T,{className:"w-16"})]})}),e.jsx(Ee,{children:H.map(r=>{const x=ze(r,a==null?void 0:a.subjectId);return e.jsxs(te,{className:x?void 0:"cursor-pointer",onClick:()=>{x||y({kind:"edit",environment:r})},children:[e.jsx(B,{className:"w-96 max-w-96",children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:r.name}),r.description.length>0?e.jsx(ce,{content:r.description,className:"max-w-sm whitespace-normal text-left",triggerClassName:"block min-w-0 w-full max-w-full",children:e.jsx("span",{className:"block truncate text-xs text-text-secondary",children:r.description})}):null]})}),e.jsx(B,{children:e.jsx(qe,{status:r.status,statusReason:r.statusReason})}),e.jsx(B,{className:"text-sm text-text-secondary",children:Oe(r.manifest.resources)}),e.jsx(B,{className:"text-sm text-text-secondary",children:Fe(r.manifest.networking)}),e.jsx(B,{className:"text-sm text-text-secondary",children:x?"—":Se(r.updatedAt)}),e.jsx(B,{children:x?null:e.jsx("button",{type:"button",className:Q({variant:"ghost",size:"icon"}),"aria-label":`Delete ${r.name}`,onClick:j=>{j.stopPropagation(),k(r)},children:e.jsx(P,{name:"trash",className:"size-3.5 text-failure-bg"})})})]},r.id)})})]}),ue?e.jsx(Ce,{pageSize:w,rowCount:H.length,canPrev:M!=null,canNext:I!=null,onPrev:()=>L(M),onNext:()=>L(I),pageSizeOptions:$e,onPageSizeChange:r=>{de($(r)),L(void 0),G(void 0)}}):null]})}),e.jsx(Ue,{open:C.kind!=="closed",mode:C.kind==="edit"?"edit":"create",...C.kind==="edit"?{environment:C.environment}:{},onOpenChange:r=>{r||y({kind:"closed"})},onSaved:()=>{L(void 0),n==null||n.invalidateEnvironmentsList(),A({token:void 0,size:w})}}),e.jsx(Ae,{open:p!=null,onOpenChange:r=>!r&&k(null),children:e.jsxs(Te,{children:[e.jsx(Be,{children:e.jsx(Pe,{children:"Delete environment"})}),e.jsxs("p",{className:"text-sm text-text-secondary",children:["Delete ",e.jsx("span",{className:"font-medium text-text-primary",children:p==null?void 0:p.name}),"? This cannot be undone. Delete fails if any agent still references the environment."]}),e.jsxs(De,{children:[e.jsx(R.Secondary,{type:"button",disabled:N,onClick:()=>k(null),children:"Cancel"}),e.jsx(R.Primary,{type:"button",disabled:N,onClick:()=>void pe(),children:N?"Deleting…":"Delete"})]})]})})]})}export{Ye as EnvironmentsPage,Qe as PENDING_ENVIRONMENTS_POLL_INTERVAL_MS};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as we}from"./chunk-C43ZVKUS-ClJ9CpD6.js";import{b6 as Ce,p as Ee,q as ke,r as l,v as W,j as e,S as Se,C as B,I as T,b7 as fe,b8 as ye,b9 as Me,ba as Le,c as P,bb as Pe,_ as de,a6 as Te}from"./index-PV6Uc-B5.js";var ve=Te("h-11 shadow-sm"),Ue=({open:a,onOpenChange:i,onSave:f,title:j,description:N,initialBaseUrl:g="",baseUrlPlaceholder:h="https://api.openai.com/v1",requireApiKey:o=!0,submitLabel:K="Save",busy:M=!1,error:$})=>{const[A,E]=l.useState(""),[q,x]=l.useState(""),[p,I]=l.useState(!1),U=()=>{E(""),x(""),I(!1)};l.useEffect(()=>{a&&(E(""),x(g),I(!1))},[a,g]);const H=d=>{d||U(),i(d)},R=A.trim(),_=!o||!!R,J=async d=>{if(d.preventDefault(),!(!_||M))try{await f({apiKey:R,baseUrl:q.trim()}),U(),i(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:H,title:j,description:N,contentSized:!0,children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:J,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"model-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",o?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"model-provider-api-key",type:"password",required:o,value:A,onChange:d=>{E(d.target.value)},placeholder:o?"Enter API key":"Enter a new key",autoFocus:!0,className:ve}),o?null:e.jsx("p",{className:"mt-1.5 text-xs text-text-secondary",children:"Leave blank to keep the current key; enter a new one to replace it."})]}),e.jsxs(Me,{expanded:p,onChange:(d,ae)=>I(ae),className:"rounded-md border border-border",children:[e.jsx(Le,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced · custom endpoint",e.jsx(T,{name:"chevron-down",className:P("size-4 shrink-0 text-text-secondary transition-transform duration-200",p?"rotate-0":"-rotate-90")})]})}),e.jsxs(Pe,{className:"space-y-1.5 border-t border-border px-3 pb-3 pt-4",children:[e.jsx("label",{htmlFor:"model-provider-base-url",className:"block text-sm font-medium text-text-primary",children:"Base URL"}),e.jsx("input",{id:"model-provider-base-url",type:"url",value:q,onChange:d=>{x(d.target.value)},placeholder:h,className:ve}),e.jsx("p",{className:"text-xs text-text-secondary",children:"Leave blank unless you use a regional or proxy endpoint."})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[$?e.jsx("p",{className:"text-failure-bg text-sm",children:$}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!_||M,className:"w-full shrink-0",children:K})]})]})})},Re=Ue,Oe="128000",De="4096",je=()=>({id:"",name:"",advancedExpanded:!0,contextLength:"",maxOutputTokens:""}),ge=a=>(a==null?void 0:a.models.map(i=>{var f,j,N,g,h;return{id:i.id,name:i.name,advancedExpanded:!0,reasoningEfforts:(f=i.properties)==null?void 0:f.reasoningEfforts,contextLength:((N=(j=i.properties)==null?void 0:j.contextLength)==null?void 0:N.toString())??"",maxOutputTokens:((h=(g=i.properties)==null?void 0:g.maxOutputTokens)==null?void 0:h.toString())??"",nameDirty:!0}}))??[je()],Z="h-11 w-full rounded-md border border-border/70 bg-secondary-bg px-3 text-sm text-text-primary outline-none transition-colors placeholder:text-text-secondary/70 focus-visible:border-focus-ring focus-visible:ring-2 focus-visible:ring-focus-ring/50",se="border-failure-bg focus-visible:border-failure-bg focus-visible:ring-failure-bg";function pe(a){const i=a.trim();if(i==="")return null;const f=Number(i);return Number.isInteger(f)&&f>0?f:null}function $e(a){return a.replace(/([a-zA-Z])(\d)/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/g,"")}var ie=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),re=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-failure-bg",children:a}),ce=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:a}),Ae=({open:a,onOpenChange:i,onSubmit:f,reasoningEffortOptions:j,busy:N=!1,error:g,isEditMode:h=!1,initialValues:o})=>{const[K,M]=l.useState((o==null?void 0:o.name)??""),[$,A]=l.useState((o==null?void 0:o.baseUrl)??""),[E,q]=l.useState(""),[x,p]=l.useState(()=>ge(o)),[I,U]=l.useState(!1),[H,R]=l.useState(!1),_=()=>{M((o==null?void 0:o.name)??""),A((o==null?void 0:o.baseUrl)??""),q(""),p(ge(o)),U(!1),R(!1)},J=s=>{s||_(),i(s)},d=(s,r)=>{p(y=>y.map((m,b)=>b===s?{...m,...r}:m))},ae=()=>{U(!0),R(!0),p(s=>s.map(r=>({...r,idTouched:!0,contextTouched:!0,maxTouched:!0})))},Y=K.trim(),v=Y?null:"Name is required.",z=$.trim();let k=null;if(!z)k="Base URL is required.";else try{new URL(z)}catch{k="Enter a valid URL."}const Q=s=>s.id.trim()?null:"Model ID is required.",me=s=>s.name.trim()?null:"Model name is required.",O=s=>pe(s.contextLength)==null?"Set the model's context window.":null,ne=s=>pe(s.maxOutputTokens)==null?"Set the max output tokens.":null,w=!v&&!k&&x.every(s=>!Q(s)&&!me(s)),X=I&&v,V=H&&k,oe=async()=>{if(ae(),!w||N)return;const s=x.findIndex(r=>O(r)||ne(r));if(s!==-1){d(s,{advancedExpanded:!0});const r=x[s],y=r&&O(r)?"context-length":"max-output-tokens";setTimeout(()=>{var b;const m=document.getElementById(`custom-provider-model-${s}-${y}`);(b=m==null?void 0:m.scrollIntoView)==null||b.call(m,{block:"center",behavior:"smooth"}),m==null||m.focus()},0);return}try{await f({name:Y,baseUrl:z,apiKey:E.trim(),models:x.map(r=>{var F;const y={};(F=r.reasoningEfforts)!=null&&F.length&&(y.reasoningEfforts=r.reasoningEfforts);const m=pe(r.contextLength);m!=null&&(y.contextLength=m);const b=pe(r.maxOutputTokens);return b!=null&&(y.maxOutputTokens=b),{id:r.id.trim(),name:r.name.trim(),...Object.keys(y).length>0?{properties:y}:{}}})}),J(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:J,title:h?`Edit ${(o==null?void 0:o.name)??K}`:"Add custom provider",description:h?"Update the endpoint, credentials, and models for this provider.":"Connect any OpenAI-compatible endpoint, whether it's a local model, a proxy, or your own hosted service.",contentSized:!0,children:e.jsxs("form",{className:"flex min-h-0 flex-auto flex-col",onSubmit:s=>{s.preventDefault(),oe()},children:[e.jsxs("div",{className:"min-h-0 flex-auto space-y-4 overflow-y-auto px-5 pt-4 pb-8",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Name",e.jsx(ie,{})]}),e.jsx("input",{id:"custom-provider-name",type:"text",value:K,onChange:s=>M(s.target.value),onBlur:()=>U(!0),placeholder:"local-llama",autoFocus:!h,readOnly:h,"aria-readonly":h,"aria-invalid":X?!0:void 0,className:P(Z,h&&"cursor-not-allowed bg-secondary-bg/60 text-text-secondary",X&&se)}),h?e.jsx(ce,{children:"Provider names cannot be changed after creation."}):null,X?e.jsx(re,{children:v}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-base-url",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Base URL",e.jsx(ie,{})]}),e.jsx("input",{id:"custom-provider-base-url",type:"text",value:$,onChange:s=>A(s.target.value),onBlur:()=>R(!0),placeholder:"http://localhost:11434/v1",autoFocus:h,"aria-invalid":V?!0:void 0,className:P(Z,V&&se)}),V?e.jsx(re,{children:k}):z?null:e.jsx(ce,{children:"OpenAI-compatible endpoint, usually ending in /v1."})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"custom-provider-api-key",type:"password",value:E,onChange:s=>q(s.target.value),placeholder:"sk-…",className:Z}),e.jsx(ce,{children:h?"Leave blank to keep the saved key, or enter a new key to replace it.":"Leave blank if your endpoint needs no key (e.g. a local model)."})]}),e.jsxs("fieldset",{className:"m-0 min-w-0 border-0 p-0",children:[e.jsxs("legend",{className:"float-left mb-2 w-full p-0 text-sm font-medium text-text-primary",children:["Models",e.jsx(ie,{})]}),e.jsx("div",{className:"clear-both",children:x.map((s,r)=>{const y=Q(s),m=s.idTouched&&y,b=me(s),F=!!b&&s.nameDirty,ue=O(s),xe=ne(s),ee=s.contextTouched&&ue,le=s.maxTouched&&xe;return e.jsxs("div",{className:P("pb-6",r>0?"border-t border-border pt-6":"pt-1"),style:r>0?{borderTopWidth:"0.5px"}:void 0,children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_2rem] items-end gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-id`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model ID"}),e.jsx("input",{id:`custom-provider-model-${r}-id`,type:"text",value:s.id,onChange:u=>{const D=u.target.value;d(r,{id:D,...s.nameDirty?{}:{name:$e(D)}})},onBlur:()=>d(r,{idTouched:!0}),placeholder:"llama3.1:70b","aria-invalid":m?!0:void 0,className:P(Z,"font-mono",m&&se)})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-name`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model name"}),e.jsx("input",{id:`custom-provider-model-${r}-name`,type:"text",value:s.name,onChange:u=>d(r,{name:u.target.value,nameDirty:!0}),placeholder:"llama-3-1-70b","aria-invalid":F?!0:void 0,className:P(Z,F&&se)})]}),e.jsx("button",{type:"button","aria-label":`Remove model ${r+1}`,disabled:x.length===1||N,className:"mb-0.5 flex size-9 items-center justify-center rounded-md text-text-secondary transition-colors hover:text-text-primary disabled:opacity-40",onClick:()=>p(u=>u.filter((D,te)=>te!==r)),children:e.jsx(T,{name:"trash",className:"size-4"})})]}),m?e.jsx(re,{children:y}):null,F?e.jsx(re,{children:b}):null,e.jsxs("div",{className:"mt-2",children:[e.jsxs("button",{type:"button","aria-expanded":s.advancedExpanded,"aria-controls":`custom-provider-model-${r}-advanced`,className:"flex cursor-pointer items-center gap-1.5 text-sm font-medium text-text-primary",onClick:()=>d(r,{advancedExpanded:!s.advancedExpanded}),children:[e.jsx(T,{name:"chevron-down",className:P("size-4 text-text-secondary transition-transform",s.advancedExpanded?"":"-rotate-90")}),"Advanced"]}),s.advancedExpanded?e.jsxs("div",{id:`custom-provider-model-${r}-advanced`,className:"mt-3 space-y-4 pl-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-context-length`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Context length",e.jsx(ie,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-context-length`,type:"number",min:1,inputMode:"numeric",value:s.contextLength,onChange:u=>d(r,{contextLength:u.target.value}),onBlur:()=>d(r,{contextTouched:!0}),placeholder:Oe,"aria-invalid":ee?!0:void 0,className:P(Z,ee&&se)}),ee?e.jsx(re,{children:ue}):s.contextLength.trim()===""?e.jsx(ce,{children:"Model's total token window."}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-max-output-tokens`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Max output tokens",e.jsx(ie,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-max-output-tokens`,type:"number",min:1,inputMode:"numeric",value:s.maxOutputTokens,onChange:u=>d(r,{maxOutputTokens:u.target.value}),onBlur:()=>d(r,{maxTouched:!0}),placeholder:De,"aria-invalid":le?!0:void 0,className:P(Z,le&&se)}),le?e.jsx(re,{children:xe}):s.maxOutputTokens.trim()===""?e.jsx(ce,{children:"Longest reply the model allows — use its real limit."}):null]}),j&&j.length>0?e.jsxs("div",{children:[e.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 select-none",children:[e.jsx("input",{type:"checkbox",className:"size-4 shrink-0 cursor-pointer accent-primary-button-bg disabled:cursor-not-allowed disabled:opacity-50",checked:s.reasoningEfforts!==void 0,"aria-label":`Enable reasoning effort for model ${r+1}`,disabled:N,onChange:u=>d(r,{reasoningEfforts:u.target.checked?[]:void 0})}),e.jsx("span",{className:"text-text-secondary text-xs font-medium",children:"Reasoning effort"})]}),s.reasoningEfforts!==void 0?e.jsx("div",{role:"group","aria-label":`Supported reasoning efforts for model ${r+1}`,className:"mt-2 flex flex-wrap gap-2",children:j.map(u=>{var te;const D=((te=s.reasoningEfforts)==null?void 0:te.includes(u))??!1;return e.jsx("button",{type:"button","aria-pressed":D,disabled:N,className:P("rounded-full border px-3 py-1 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/40 disabled:opacity-50",D?"border-primary-button-bg bg-primary-button-bg text-primary-button-text":"border-border text-text-secondary hover:bg-ghost-button-hover"),onClick:()=>{var S;return d(r,{reasoningEfforts:D?(S=s.reasoningEfforts)==null?void 0:S.filter(G=>G!==u):[...s.reasoningEfforts??[],u]})},children:u},u)})}):null]}):null]}):null]})]},r)})}),e.jsxs(B.Secondary,{size:"small",type:"button",className:"mt-4 w-fit",onClick:()=>p(s=>[...s,je()]),children:[e.jsx(T,{name:"plus",className:"size-3.5"}),"Add model"]})]})]}),e.jsxs("div",{className:"shrink-0 space-y-3 border-t border-border px-5 py-4",children:[g?e.jsx("p",{className:"text-failure-bg text-sm",children:g}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!w||N,className:"w-full",children:h?"Save changes":"Add provider"})]})]})})},Ie=Ae;function he(a){return a.kind==="model"&&a.provider.models.length===1}function _e(a){return a.kind==="provider"?`“${a.provider.name}” and all of its models will no longer be available to your agents.`:he(a)?`“${a.model.name}” is the only model left in ${a.provider.name}, so the whole provider will be removed.`:`“${a.model.name}” will no longer be available to your agents. The rest of ${a.provider.name} stays configured.`}function ze(a){return"baseUrl"in a&&typeof a.baseUrl=="string"?a.baseUrl:""}var Fe=()=>{const{modelCatalog:a}=Ce(),i=Ee(),f=ke(),[j,N]=l.useState(""),[g,h]=l.useState([]),[o,K]=l.useState([]),[M,$]=l.useState(!0),[A,E]=l.useState(null),[q,x]=l.useState(null),[p,I]=l.useState(!1),[U,H]=l.useState(null),[R,_]=l.useState(null),[J,d]=l.useState(null),[ae,Y]=l.useState(!1),[v,z]=l.useState(null),[k,Q]=l.useState(null),[me,O]=l.useState(null),ne=l.useMemo(()=>(o??[]).reduce((t,n)=>(t[n.name]=n.logo??"",t),{}),[o]),w=j.trim().toLowerCase(),X=l.useCallback(async()=>{$(!0),E(null);try{const[t,n]=await Promise.all([a.listModelProviders(),a.getModelProviderCatalog()]);h(t),K(n)}catch(t){E(W(t,"Failed to load model providers"))}finally{$(!1)}},[a]);l.useEffect(()=>{X()},[X]);const V=l.useMemo(()=>new Set(g.map(t=>t.type)),[g]),oe=l.useMemo(()=>g.filter(t=>{var n;return((n=t.name)==null?void 0:n.toLowerCase().includes(w))||t.models.some(c=>c.name.toLowerCase().includes(w)||c.id.toLowerCase().includes(w))}),[g,w]),s=l.useMemo(()=>o.filter(t=>t.type!=="custom"&&!V.has(t.type)&&(t.name.toLowerCase().includes(w)||t.models.some(n=>n.name.toLowerCase().includes(w)||n.id.toLowerCase().includes(w)))),[o,V,w]),r=l.useMemo(()=>{var t;return(t=o.find(n=>n.type==="custom"))==null?void 0:t.supportedReasoningEfforts},[o]),y=l.useMemo(()=>{const t=new Map;for(const n of o)t.set(n.type,n.models);return t},[o]),m=()=>{H(null),_(null),d(null)},b=async(t,n)=>{I(!0),E(null);try{await t(),await X(),m()}catch(c){throw n?n(c):i==null?E(W(c,"Request failed")):i.showError(c),c}finally{I(!1)}},F=async(t,n)=>{d(null),await b(async()=>{await a.createModelProvider({type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},c=>d(W(c,"Request failed"))),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"create"})},ue=async(t,n)=>{d(null),await b(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},c=>d(W(c,"Request failed"))),i==null||i.showSuccess({title:`${t.name} updated`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"update"})},xe=()=>{p||(Q(null),O(null))},ee=({provider:t,models:n},c)=>b(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...t.baseUrl?{baseUrl:t.baseUrl}:{},apiKey:"",models:n})},c),le=t=>{O(null);const n=L=>O(W(L,"Request failed"));let c;if(t.kind==="model"&&!he(t))c=ee({provider:t.provider,models:t.provider.models.filter(L=>L.id!==t.model.id)},n);else{const L=a.deleteModelProvider;L!==void 0&&(c=b(async()=>{await L({id:t.provider.id}),f(de.Settings.MODEL_PROVIDER_DELETED,{provider_name:t.provider.name})},n))}c==null||c.then(()=>Q(null)).catch(()=>{})},u=async t=>{x(null),await b(async()=>{await a.createModelProvider({type:"custom",name:t.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},n=>x(W(n,"Request failed"))),setTimeout(()=>{i==null||i.showSuccess({title:`${t.name} added`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"create"})},0)},D=async t=>{if(!v)return;const n=v;x(null),await b(async()=>{await a.updateModelProvider({id:n.id,type:n.type,name:n.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},c=>x(W(c,"Request failed"))),setTimeout(()=>{i==null||i.showSuccess({title:"Model provider updated",description:`${n.name} was updated successfully.`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:n.name,mode:"update"})},0)},te=v?{name:v.name,baseUrl:v.baseUrl??"",models:v.models}:void 0,S=U!=null?g.find(t=>t.id===U)??null:null,G=R!=null?o.find(t=>t.type===R)??null:null,Ne=S!=null||G!=null;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Models"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Connect providers and choose which models are available."}),A?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:A}):null,e.jsx("div",{className:"mt-4 min-h-0 min-w-0 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full min-w-0 flex-col gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Se,{query:j,setQuery:N,placeholder:"Search providers and models"})}),e.jsxs(B.Secondary,{type:"button",className:"shrink-0 sm:self-auto",onClick:()=>{x(null),z(null),Y(!0)},children:[e.jsx(T,{name:"plus",size:"1rem",className:"mr-1"}),"Add Custom Provider"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 overflow-y-auto",children:[M?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!M&&oe.length>0?e.jsxs("section",{"aria-labelledby":"configured-providers-heading",children:[e.jsx("div",{id:"configured-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Configured"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:oe.map(t=>{const n=y.get(t.type)??[],c=new Set(t.models.map(C=>C.id)),L=n.filter(C=>!c.has(C.id)),be=ne[t.name];return e.jsxs("article",{className:"border-b border-border p-3 last:border-b-0",children:[e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:be?e.jsx(fe,{src:be,alt:t.name,className:"size-4.5"}):e.jsx(T,{name:"cpu",className:"size-4.5"})}),e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-success-bg",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success-bg"}),"Connected"]}),e.jsxs(B.Secondary,{size:"small",className:"text-[0.8125rem]",type:"button","aria-label":`Edit ${t.name}`,title:`Edit ${t.name}`,disabled:p,onClick:()=>{t.type==="custom"?(m(),x(null),z(t),Y(!0)):(d(null),_(null),H(t.id))},children:[e.jsx(T,{name:"pencil",className:"size-3.5"}),"Edit"]}),a.deleteModelProvider?e.jsx(B.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:p,onClick:()=>{O(null),Q({kind:"provider",provider:t})},children:"Remove"}):null]})]}),e.jsxs("div",{className:"mt-3 overflow-hidden rounded-lg border border-border bg-secondary-bg/30",children:[t.models.map(C=>e.jsxs("div",{className:"flex min-h-10 items-center gap-3 border-b border-border px-3 py-2 text-sm text-text-primary last:border-b-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:C.name}),t.models.length>1||a.deleteModelProvider?e.jsx("button",{type:"button","aria-label":`Remove ${C.name}`,disabled:p,className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring disabled:opacity-50",onClick:()=>{O(null),Q({kind:"model",provider:t,model:C})},children:e.jsx(T,{name:"trash",className:"size-3.5"})}):null]},C.id)),L.length>0?e.jsxs("section",{children:[e.jsxs("div",{className:"border-b border-border bg-secondary-bg/40 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available to add · ",L.length]}),L.map(C=>e.jsxs("div",{className:"flex min-h-12 items-center gap-3 border-b border-border px-3 py-2 text-sm text-text-primary last:border-b-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:C.name}),e.jsx(B.Secondary,{size:"small",type:"button",disabled:p,onClick:()=>{ee({provider:t,models:[...t.models,C]}).catch(()=>{})},children:"Add"})]},C.id))]}):null]})]},t.id)})})]}):null,!M&&s.length>0?e.jsxs("section",{"aria-labelledby":"available-providers-heading",className:"mt-2",children:[e.jsx("div",{id:"available-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Available"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:s.map(t=>{const n=ne[t.name];return e.jsx("article",{className:"border-b border-border p-3 last:border-b-0",children:e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:n?e.jsx(fe,{src:n,alt:t.name,className:"size-4.5"}):e.jsx(T,{name:"cpu",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:t.models.map(c=>c.name).join(" · ")})]})]}),e.jsxs(B.Secondary,{type:"button",disabled:p,onClick:()=>{d(null),H(null),_(t.type)},children:[e.jsx(T,{name:"wrench",className:"size-4"}),"Configure"]})]})},t.type)})})]}):null,!M&&oe.length===0&&s.length===0?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:w?`No providers match “${j.trim()}”.`:"No model providers yet."}):null]}),k?e.jsx(we,{title:k.kind==="model"&&!he(k)?"Remove model?":"Remove provider?",description:_e(k),busy:p,error:me,onCancel:xe,onConfirm:()=>{le(k)}}):null,e.jsx(Re,{open:Ne,onOpenChange:t=>{t||m()},onSave:t=>{if(S)return ue(S,t);if(G)return F(G,t)},title:S?"Edit Provider Details":"Configure Provider Details",initialBaseUrl:S?S.baseUrl??"":G?ze(G):"",requireApiKey:S==null,submitLabel:S?"Save":"Create",busy:p,error:J}),e.jsx(Ie,{open:ae,onOpenChange:t=>{Y(t),t||(x(null),z(null))},isEditMode:v!==null,initialValues:te,onSubmit:v?D:u,reasoningEffortOptions:r,busy:p,error:q},(v==null?void 0:v.id)??"add-custom-provider")]})})]})},qe=Fe;export{qe as default};
|
|
1
|
+
import{C as we}from"./chunk-C4DROCIN-CGWCL0tw.js";import{b6 as Ce,p as Ee,q as ke,r as l,v as W,j as e,S as Se,C as B,I as T,b7 as fe,b8 as ye,b9 as Me,ba as Le,c as P,bb as Pe,_ as de,a6 as Te}from"./index-KCrUroEv.js";var ve=Te("h-11 shadow-sm"),Ue=({open:a,onOpenChange:i,onSave:f,title:j,description:N,initialBaseUrl:g="",baseUrlPlaceholder:h="https://api.openai.com/v1",requireApiKey:o=!0,submitLabel:K="Save",busy:M=!1,error:$})=>{const[A,E]=l.useState(""),[q,x]=l.useState(""),[p,I]=l.useState(!1),U=()=>{E(""),x(""),I(!1)};l.useEffect(()=>{a&&(E(""),x(g),I(!1))},[a,g]);const H=d=>{d||U(),i(d)},R=A.trim(),_=!o||!!R,J=async d=>{if(d.preventDefault(),!(!_||M))try{await f({apiKey:R,baseUrl:q.trim()}),U(),i(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:H,title:j,description:N,contentSized:!0,children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:J,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"model-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",o?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"model-provider-api-key",type:"password",required:o,value:A,onChange:d=>{E(d.target.value)},placeholder:o?"Enter API key":"Enter a new key",autoFocus:!0,className:ve}),o?null:e.jsx("p",{className:"mt-1.5 text-xs text-text-secondary",children:"Leave blank to keep the current key; enter a new one to replace it."})]}),e.jsxs(Me,{expanded:p,onChange:(d,ae)=>I(ae),className:"rounded-md border border-border",children:[e.jsx(Le,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced · custom endpoint",e.jsx(T,{name:"chevron-down",className:P("size-4 shrink-0 text-text-secondary transition-transform duration-200",p?"rotate-0":"-rotate-90")})]})}),e.jsxs(Pe,{className:"space-y-1.5 border-t border-border px-3 pb-3 pt-4",children:[e.jsx("label",{htmlFor:"model-provider-base-url",className:"block text-sm font-medium text-text-primary",children:"Base URL"}),e.jsx("input",{id:"model-provider-base-url",type:"url",value:q,onChange:d=>{x(d.target.value)},placeholder:h,className:ve}),e.jsx("p",{className:"text-xs text-text-secondary",children:"Leave blank unless you use a regional or proxy endpoint."})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[$?e.jsx("p",{className:"text-failure-bg text-sm",children:$}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!_||M,className:"w-full shrink-0",children:K})]})]})})},Re=Ue,Oe="128000",De="4096",je=()=>({id:"",name:"",advancedExpanded:!0,contextLength:"",maxOutputTokens:""}),ge=a=>(a==null?void 0:a.models.map(i=>{var f,j,N,g,h;return{id:i.id,name:i.name,advancedExpanded:!0,reasoningEfforts:(f=i.properties)==null?void 0:f.reasoningEfforts,contextLength:((N=(j=i.properties)==null?void 0:j.contextLength)==null?void 0:N.toString())??"",maxOutputTokens:((h=(g=i.properties)==null?void 0:g.maxOutputTokens)==null?void 0:h.toString())??"",nameDirty:!0}}))??[je()],Z="h-11 w-full rounded-md border border-border/70 bg-secondary-bg px-3 text-sm text-text-primary outline-none transition-colors placeholder:text-text-secondary/70 focus-visible:border-focus-ring focus-visible:ring-2 focus-visible:ring-focus-ring/50",se="border-failure-bg focus-visible:border-failure-bg focus-visible:ring-failure-bg";function pe(a){const i=a.trim();if(i==="")return null;const f=Number(i);return Number.isInteger(f)&&f>0?f:null}function $e(a){return a.replace(/([a-zA-Z])(\d)/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/g,"")}var ie=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),re=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-failure-bg",children:a}),ce=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:a}),Ae=({open:a,onOpenChange:i,onSubmit:f,reasoningEffortOptions:j,busy:N=!1,error:g,isEditMode:h=!1,initialValues:o})=>{const[K,M]=l.useState((o==null?void 0:o.name)??""),[$,A]=l.useState((o==null?void 0:o.baseUrl)??""),[E,q]=l.useState(""),[x,p]=l.useState(()=>ge(o)),[I,U]=l.useState(!1),[H,R]=l.useState(!1),_=()=>{M((o==null?void 0:o.name)??""),A((o==null?void 0:o.baseUrl)??""),q(""),p(ge(o)),U(!1),R(!1)},J=s=>{s||_(),i(s)},d=(s,r)=>{p(y=>y.map((m,b)=>b===s?{...m,...r}:m))},ae=()=>{U(!0),R(!0),p(s=>s.map(r=>({...r,idTouched:!0,contextTouched:!0,maxTouched:!0})))},Y=K.trim(),v=Y?null:"Name is required.",z=$.trim();let k=null;if(!z)k="Base URL is required.";else try{new URL(z)}catch{k="Enter a valid URL."}const Q=s=>s.id.trim()?null:"Model ID is required.",me=s=>s.name.trim()?null:"Model name is required.",O=s=>pe(s.contextLength)==null?"Set the model's context window.":null,ne=s=>pe(s.maxOutputTokens)==null?"Set the max output tokens.":null,w=!v&&!k&&x.every(s=>!Q(s)&&!me(s)),X=I&&v,V=H&&k,oe=async()=>{if(ae(),!w||N)return;const s=x.findIndex(r=>O(r)||ne(r));if(s!==-1){d(s,{advancedExpanded:!0});const r=x[s],y=r&&O(r)?"context-length":"max-output-tokens";setTimeout(()=>{var b;const m=document.getElementById(`custom-provider-model-${s}-${y}`);(b=m==null?void 0:m.scrollIntoView)==null||b.call(m,{block:"center",behavior:"smooth"}),m==null||m.focus()},0);return}try{await f({name:Y,baseUrl:z,apiKey:E.trim(),models:x.map(r=>{var F;const y={};(F=r.reasoningEfforts)!=null&&F.length&&(y.reasoningEfforts=r.reasoningEfforts);const m=pe(r.contextLength);m!=null&&(y.contextLength=m);const b=pe(r.maxOutputTokens);return b!=null&&(y.maxOutputTokens=b),{id:r.id.trim(),name:r.name.trim(),...Object.keys(y).length>0?{properties:y}:{}}})}),J(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:J,title:h?`Edit ${(o==null?void 0:o.name)??K}`:"Add custom provider",description:h?"Update the endpoint, credentials, and models for this provider.":"Connect any OpenAI-compatible endpoint, whether it's a local model, a proxy, or your own hosted service.",contentSized:!0,children:e.jsxs("form",{className:"flex min-h-0 flex-auto flex-col",onSubmit:s=>{s.preventDefault(),oe()},children:[e.jsxs("div",{className:"min-h-0 flex-auto space-y-4 overflow-y-auto px-5 pt-4 pb-8",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Name",e.jsx(ie,{})]}),e.jsx("input",{id:"custom-provider-name",type:"text",value:K,onChange:s=>M(s.target.value),onBlur:()=>U(!0),placeholder:"local-llama",autoFocus:!h,readOnly:h,"aria-readonly":h,"aria-invalid":X?!0:void 0,className:P(Z,h&&"cursor-not-allowed bg-secondary-bg/60 text-text-secondary",X&&se)}),h?e.jsx(ce,{children:"Provider names cannot be changed after creation."}):null,X?e.jsx(re,{children:v}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-base-url",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Base URL",e.jsx(ie,{})]}),e.jsx("input",{id:"custom-provider-base-url",type:"text",value:$,onChange:s=>A(s.target.value),onBlur:()=>R(!0),placeholder:"http://localhost:11434/v1",autoFocus:h,"aria-invalid":V?!0:void 0,className:P(Z,V&&se)}),V?e.jsx(re,{children:k}):z?null:e.jsx(ce,{children:"OpenAI-compatible endpoint, usually ending in /v1."})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"custom-provider-api-key",type:"password",value:E,onChange:s=>q(s.target.value),placeholder:"sk-…",className:Z}),e.jsx(ce,{children:h?"Leave blank to keep the saved key, or enter a new key to replace it.":"Leave blank if your endpoint needs no key (e.g. a local model)."})]}),e.jsxs("fieldset",{className:"m-0 min-w-0 border-0 p-0",children:[e.jsxs("legend",{className:"float-left mb-2 w-full p-0 text-sm font-medium text-text-primary",children:["Models",e.jsx(ie,{})]}),e.jsx("div",{className:"clear-both",children:x.map((s,r)=>{const y=Q(s),m=s.idTouched&&y,b=me(s),F=!!b&&s.nameDirty,ue=O(s),xe=ne(s),ee=s.contextTouched&&ue,le=s.maxTouched&&xe;return e.jsxs("div",{className:P("pb-6",r>0?"border-t border-border pt-6":"pt-1"),style:r>0?{borderTopWidth:"0.5px"}:void 0,children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_2rem] items-end gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-id`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model ID"}),e.jsx("input",{id:`custom-provider-model-${r}-id`,type:"text",value:s.id,onChange:u=>{const D=u.target.value;d(r,{id:D,...s.nameDirty?{}:{name:$e(D)}})},onBlur:()=>d(r,{idTouched:!0}),placeholder:"llama3.1:70b","aria-invalid":m?!0:void 0,className:P(Z,"font-mono",m&&se)})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-name`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model name"}),e.jsx("input",{id:`custom-provider-model-${r}-name`,type:"text",value:s.name,onChange:u=>d(r,{name:u.target.value,nameDirty:!0}),placeholder:"llama-3-1-70b","aria-invalid":F?!0:void 0,className:P(Z,F&&se)})]}),e.jsx("button",{type:"button","aria-label":`Remove model ${r+1}`,disabled:x.length===1||N,className:"mb-0.5 flex size-9 items-center justify-center rounded-md text-text-secondary transition-colors hover:text-text-primary disabled:opacity-40",onClick:()=>p(u=>u.filter((D,te)=>te!==r)),children:e.jsx(T,{name:"trash",className:"size-4"})})]}),m?e.jsx(re,{children:y}):null,F?e.jsx(re,{children:b}):null,e.jsxs("div",{className:"mt-2",children:[e.jsxs("button",{type:"button","aria-expanded":s.advancedExpanded,"aria-controls":`custom-provider-model-${r}-advanced`,className:"flex cursor-pointer items-center gap-1.5 text-sm font-medium text-text-primary",onClick:()=>d(r,{advancedExpanded:!s.advancedExpanded}),children:[e.jsx(T,{name:"chevron-down",className:P("size-4 text-text-secondary transition-transform",s.advancedExpanded?"":"-rotate-90")}),"Advanced"]}),s.advancedExpanded?e.jsxs("div",{id:`custom-provider-model-${r}-advanced`,className:"mt-3 space-y-4 pl-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-context-length`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Context length",e.jsx(ie,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-context-length`,type:"number",min:1,inputMode:"numeric",value:s.contextLength,onChange:u=>d(r,{contextLength:u.target.value}),onBlur:()=>d(r,{contextTouched:!0}),placeholder:Oe,"aria-invalid":ee?!0:void 0,className:P(Z,ee&&se)}),ee?e.jsx(re,{children:ue}):s.contextLength.trim()===""?e.jsx(ce,{children:"Model's total token window."}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-max-output-tokens`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Max output tokens",e.jsx(ie,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-max-output-tokens`,type:"number",min:1,inputMode:"numeric",value:s.maxOutputTokens,onChange:u=>d(r,{maxOutputTokens:u.target.value}),onBlur:()=>d(r,{maxTouched:!0}),placeholder:De,"aria-invalid":le?!0:void 0,className:P(Z,le&&se)}),le?e.jsx(re,{children:xe}):s.maxOutputTokens.trim()===""?e.jsx(ce,{children:"Longest reply the model allows — use its real limit."}):null]}),j&&j.length>0?e.jsxs("div",{children:[e.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 select-none",children:[e.jsx("input",{type:"checkbox",className:"size-4 shrink-0 cursor-pointer accent-primary-button-bg disabled:cursor-not-allowed disabled:opacity-50",checked:s.reasoningEfforts!==void 0,"aria-label":`Enable reasoning effort for model ${r+1}`,disabled:N,onChange:u=>d(r,{reasoningEfforts:u.target.checked?[]:void 0})}),e.jsx("span",{className:"text-text-secondary text-xs font-medium",children:"Reasoning effort"})]}),s.reasoningEfforts!==void 0?e.jsx("div",{role:"group","aria-label":`Supported reasoning efforts for model ${r+1}`,className:"mt-2 flex flex-wrap gap-2",children:j.map(u=>{var te;const D=((te=s.reasoningEfforts)==null?void 0:te.includes(u))??!1;return e.jsx("button",{type:"button","aria-pressed":D,disabled:N,className:P("rounded-full border px-3 py-1 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/40 disabled:opacity-50",D?"border-primary-button-bg bg-primary-button-bg text-primary-button-text":"border-border text-text-secondary hover:bg-ghost-button-hover"),onClick:()=>{var S;return d(r,{reasoningEfforts:D?(S=s.reasoningEfforts)==null?void 0:S.filter(G=>G!==u):[...s.reasoningEfforts??[],u]})},children:u},u)})}):null]}):null]}):null]})]},r)})}),e.jsxs(B.Secondary,{size:"small",type:"button",className:"mt-4 w-fit",onClick:()=>p(s=>[...s,je()]),children:[e.jsx(T,{name:"plus",className:"size-3.5"}),"Add model"]})]})]}),e.jsxs("div",{className:"shrink-0 space-y-3 border-t border-border px-5 py-4",children:[g?e.jsx("p",{className:"text-failure-bg text-sm",children:g}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!w||N,className:"w-full",children:h?"Save changes":"Add provider"})]})]})})},Ie=Ae;function he(a){return a.kind==="model"&&a.provider.models.length===1}function _e(a){return a.kind==="provider"?`“${a.provider.name}” and all of its models will no longer be available to your agents.`:he(a)?`“${a.model.name}” is the only model left in ${a.provider.name}, so the whole provider will be removed.`:`“${a.model.name}” will no longer be available to your agents. The rest of ${a.provider.name} stays configured.`}function ze(a){return"baseUrl"in a&&typeof a.baseUrl=="string"?a.baseUrl:""}var Fe=()=>{const{modelCatalog:a}=Ce(),i=Ee(),f=ke(),[j,N]=l.useState(""),[g,h]=l.useState([]),[o,K]=l.useState([]),[M,$]=l.useState(!0),[A,E]=l.useState(null),[q,x]=l.useState(null),[p,I]=l.useState(!1),[U,H]=l.useState(null),[R,_]=l.useState(null),[J,d]=l.useState(null),[ae,Y]=l.useState(!1),[v,z]=l.useState(null),[k,Q]=l.useState(null),[me,O]=l.useState(null),ne=l.useMemo(()=>(o??[]).reduce((t,n)=>(t[n.name]=n.logo??"",t),{}),[o]),w=j.trim().toLowerCase(),X=l.useCallback(async()=>{$(!0),E(null);try{const[t,n]=await Promise.all([a.listModelProviders(),a.getModelProviderCatalog()]);h(t),K(n)}catch(t){E(W(t,"Failed to load model providers"))}finally{$(!1)}},[a]);l.useEffect(()=>{X()},[X]);const V=l.useMemo(()=>new Set(g.map(t=>t.type)),[g]),oe=l.useMemo(()=>g.filter(t=>{var n;return((n=t.name)==null?void 0:n.toLowerCase().includes(w))||t.models.some(c=>c.name.toLowerCase().includes(w)||c.id.toLowerCase().includes(w))}),[g,w]),s=l.useMemo(()=>o.filter(t=>t.type!=="custom"&&!V.has(t.type)&&(t.name.toLowerCase().includes(w)||t.models.some(n=>n.name.toLowerCase().includes(w)||n.id.toLowerCase().includes(w)))),[o,V,w]),r=l.useMemo(()=>{var t;return(t=o.find(n=>n.type==="custom"))==null?void 0:t.supportedReasoningEfforts},[o]),y=l.useMemo(()=>{const t=new Map;for(const n of o)t.set(n.type,n.models);return t},[o]),m=()=>{H(null),_(null),d(null)},b=async(t,n)=>{I(!0),E(null);try{await t(),await X(),m()}catch(c){throw n?n(c):i==null?E(W(c,"Request failed")):i.showError(c),c}finally{I(!1)}},F=async(t,n)=>{d(null),await b(async()=>{await a.createModelProvider({type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},c=>d(W(c,"Request failed"))),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"create"})},ue=async(t,n)=>{d(null),await b(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},c=>d(W(c,"Request failed"))),i==null||i.showSuccess({title:`${t.name} updated`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"update"})},xe=()=>{p||(Q(null),O(null))},ee=({provider:t,models:n},c)=>b(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...t.baseUrl?{baseUrl:t.baseUrl}:{},apiKey:"",models:n})},c),le=t=>{O(null);const n=L=>O(W(L,"Request failed"));let c;if(t.kind==="model"&&!he(t))c=ee({provider:t.provider,models:t.provider.models.filter(L=>L.id!==t.model.id)},n);else{const L=a.deleteModelProvider;L!==void 0&&(c=b(async()=>{await L({id:t.provider.id}),f(de.Settings.MODEL_PROVIDER_DELETED,{provider_name:t.provider.name})},n))}c==null||c.then(()=>Q(null)).catch(()=>{})},u=async t=>{x(null),await b(async()=>{await a.createModelProvider({type:"custom",name:t.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},n=>x(W(n,"Request failed"))),setTimeout(()=>{i==null||i.showSuccess({title:`${t.name} added`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"create"})},0)},D=async t=>{if(!v)return;const n=v;x(null),await b(async()=>{await a.updateModelProvider({id:n.id,type:n.type,name:n.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},c=>x(W(c,"Request failed"))),setTimeout(()=>{i==null||i.showSuccess({title:"Model provider updated",description:`${n.name} was updated successfully.`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:n.name,mode:"update"})},0)},te=v?{name:v.name,baseUrl:v.baseUrl??"",models:v.models}:void 0,S=U!=null?g.find(t=>t.id===U)??null:null,G=R!=null?o.find(t=>t.type===R)??null:null,Ne=S!=null||G!=null;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Models"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Connect providers and choose which models are available."}),A?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:A}):null,e.jsx("div",{className:"mt-4 min-h-0 min-w-0 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full min-w-0 flex-col gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Se,{query:j,setQuery:N,placeholder:"Search providers and models"})}),e.jsxs(B.Secondary,{type:"button",className:"shrink-0 sm:self-auto",onClick:()=>{x(null),z(null),Y(!0)},children:[e.jsx(T,{name:"plus",size:"1rem",className:"mr-1"}),"Add Custom Provider"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 overflow-y-auto",children:[M?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!M&&oe.length>0?e.jsxs("section",{"aria-labelledby":"configured-providers-heading",children:[e.jsx("div",{id:"configured-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Configured"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:oe.map(t=>{const n=y.get(t.type)??[],c=new Set(t.models.map(C=>C.id)),L=n.filter(C=>!c.has(C.id)),be=ne[t.name];return e.jsxs("article",{className:"border-b border-border p-3 last:border-b-0",children:[e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:be?e.jsx(fe,{src:be,alt:t.name,className:"size-4.5"}):e.jsx(T,{name:"cpu",className:"size-4.5"})}),e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-success-bg",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success-bg"}),"Connected"]}),e.jsxs(B.Secondary,{size:"small",className:"text-[0.8125rem]",type:"button","aria-label":`Edit ${t.name}`,title:`Edit ${t.name}`,disabled:p,onClick:()=>{t.type==="custom"?(m(),x(null),z(t),Y(!0)):(d(null),_(null),H(t.id))},children:[e.jsx(T,{name:"pencil",className:"size-3.5"}),"Edit"]}),a.deleteModelProvider?e.jsx(B.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:p,onClick:()=>{O(null),Q({kind:"provider",provider:t})},children:"Remove"}):null]})]}),e.jsxs("div",{className:"mt-3 overflow-hidden rounded-lg border border-border bg-secondary-bg/30",children:[t.models.map(C=>e.jsxs("div",{className:"flex min-h-10 items-center gap-3 border-b border-border px-3 py-2 text-sm text-text-primary last:border-b-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:C.name}),t.models.length>1||a.deleteModelProvider?e.jsx("button",{type:"button","aria-label":`Remove ${C.name}`,disabled:p,className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring disabled:opacity-50",onClick:()=>{O(null),Q({kind:"model",provider:t,model:C})},children:e.jsx(T,{name:"trash",className:"size-3.5"})}):null]},C.id)),L.length>0?e.jsxs("section",{children:[e.jsxs("div",{className:"border-b border-border bg-secondary-bg/40 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available to add · ",L.length]}),L.map(C=>e.jsxs("div",{className:"flex min-h-12 items-center gap-3 border-b border-border px-3 py-2 text-sm text-text-primary last:border-b-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:C.name}),e.jsx(B.Secondary,{size:"small",type:"button",disabled:p,onClick:()=>{ee({provider:t,models:[...t.models,C]}).catch(()=>{})},children:"Add"})]},C.id))]}):null]})]},t.id)})})]}):null,!M&&s.length>0?e.jsxs("section",{"aria-labelledby":"available-providers-heading",className:"mt-2",children:[e.jsx("div",{id:"available-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Available"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:s.map(t=>{const n=ne[t.name];return e.jsx("article",{className:"border-b border-border p-3 last:border-b-0",children:e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:n?e.jsx(fe,{src:n,alt:t.name,className:"size-4.5"}):e.jsx(T,{name:"cpu",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:t.models.map(c=>c.name).join(" · ")})]})]}),e.jsxs(B.Secondary,{type:"button",disabled:p,onClick:()=>{d(null),H(null),_(t.type)},children:[e.jsx(T,{name:"wrench",className:"size-4"}),"Configure"]})]})},t.type)})})]}):null,!M&&oe.length===0&&s.length===0?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:w?`No providers match “${j.trim()}”.`:"No model providers yet."}):null]}),k?e.jsx(we,{title:k.kind==="model"&&!he(k)?"Remove model?":"Remove provider?",description:_e(k),busy:p,error:me,onCancel:xe,onConfirm:()=>{le(k)}}):null,e.jsx(Re,{open:Ne,onOpenChange:t=>{t||m()},onSave:t=>{if(S)return ue(S,t);if(G)return F(G,t)},title:S?"Edit Provider Details":"Configure Provider Details",initialBaseUrl:S?S.baseUrl??"":G?ze(G):"",requireApiKey:S==null,submitLabel:S?"Save":"Create",busy:p,error:J}),e.jsx(Ie,{open:ae,onOpenChange:t=>{Y(t),t||(x(null),z(null))},isEditMode:v!==null,initialValues:te,onSubmit:v?D:u,reasoningEffortOptions:r,busy:p,error:q},(v==null?void 0:v.id)??"add-custom-provider")]})})]})},qe=Fe;export{qe as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as G}from"./chunk-C43ZVKUS-ClJ9CpD6.js";import{b6 as Y,p as H,q as J,r as a,v as L,bd as Q,j as e,I as T,C as O,b8 as W,b9 as Z,ba as ee,c as te,bb as se,_ as V,a6 as ae}from"./index-PV6Uc-B5.js";var ne={execTimeoutMs:3e5,autoStopIntervalInMinutes:15,autoArchiveIntervalInMinutes:10080,autoDeleteIntervalInMinutes:43200},M=ae("h-11 shadow-sm");function R(n){if(n.trim()==="")return null;const r=Number(n);return!Number.isFinite(r)||r<0?null:r}var re=({open:n,onOpenChange:r,onSave:p,title:c,description:z,initialConfig:y=null,requireApiKey:j=!0,busy:E=!1,error:w})=>{const[k,m]=a.useState(""),[D,d]=a.useState(""),[u,S]=a.useState(""),[l,x]=a.useState(""),[o,b]=a.useState(""),[N,h]=a.useState(!1),P=()=>{m(""),d(""),S(""),x(""),b(""),h(!1)};a.useEffect(()=>{if(!n)return;const s=y??ne;m(String(s.execTimeoutMs)),d(String(s.autoStopIntervalInMinutes)),S(String(s.autoArchiveIntervalInMinutes)),x(String(s.autoDeleteIntervalInMinutes)),b(""),h(!1)},[n,y]);const I=s=>{s||P(),r(s)},v=R(k),f=R(D),g=R(u),A=R(l),C=o.trim(),_=(!j||!!C)&&v!=null&&f!=null&&g!=null&&A!=null,B=async s=>{if(s.preventDefault(),!(!_||E||v==null||f==null||g==null||A==null))try{await p({execTimeoutMs:v,autoStopIntervalInMinutes:f,autoArchiveIntervalInMinutes:g,autoDeleteIntervalInMinutes:A,apiKey:C}),P(),r(!1)}catch{}};return e.jsx(W,{open:n,onOpenChange:I,title:c,description:z,contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:B,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"sandbox-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",j?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"sandbox-api-key",type:"password",required:j,value:o,onChange:s=>{b(s.target.value)},placeholder:j?"dtn_...":"Leave blank to keep existing",autoFocus:!0,className:M})]}),e.jsxs(Z,{expanded:N,onChange:(s,K)=>h(K),className:"rounded-md border border-border",children:[e.jsx(ee,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced settings",e.jsx(T,{name:"chevron-down",className:te("size-4 shrink-0 text-text-secondary transition-transform duration-200",N?"rotate-0":"-rotate-90")})]})}),e.jsxs(se,{className:"space-y-4 border-t border-border px-3 pb-3 pt-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-exec-timeout",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Exec timeout (ms)"}),e.jsx("input",{id:"sandbox-exec-timeout",type:"number",min:0,required:!0,value:k,onChange:s=>{m(s.target.value)},placeholder:"300000",className:M})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-stop",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-stop interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-stop",type:"number",min:0,required:!0,value:D,onChange:s=>{d(s.target.value)},placeholder:"15",className:M})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-archive",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-archive interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-archive",type:"number",min:0,required:!0,value:u,onChange:s=>{S(s.target.value)},placeholder:"10080",className:M})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-delete",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-delete interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-delete",type:"number",min:0,required:!0,value:l,onChange:s=>{x(s.target.value)},placeholder:"43200",className:M})]})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[w?e.jsx("p",{className:"text-failure-bg text-sm",children:w}):null,e.jsx(O.Primary,{type:"submit",size:"large",disabled:!_||E,className:"w-full shrink-0",children:"Save"})]})]})})},le=re,q=({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:p,autoDeleteIntervalInMinutes:c})=>({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:p,autoDeleteIntervalInMinutes:c}),oe=()=>{const{sandboxCatalog:n}=Y(),r=H(),p=J(),[c,z]=a.useState([]),[y,j]=a.useState([]),[E,w]=a.useState(!0),[k,m]=a.useState(null),[D,d]=a.useState(null),[u,S]=a.useState(!1),[l,x]=a.useState(null),[o,b]=a.useState(null),[N,h]=a.useState(null),[P,I]=a.useState(null),v=a.useCallback(async({quiet:t=!1}={})=>{if(n){t||w(!0),m(null);try{const[i,F]=await Promise.all([n.listSandboxProviders(),n.getSandboxProviderCatalog()]);z(i),j(F)}catch(i){m(L(i,"Failed to load sandbox providers"))}finally{t||w(!1)}}},[n]);a.useEffect(()=>{v()},[v]);const f=c.length>0,g=a.useMemo(()=>{if(f)return[];const t=new Set(c.map(i=>i.catalogId));return y.filter(i=>!t.has(i.id))},[y,c,f]),A=a.useMemo(()=>{const t=o??l;return t==null||!Q(t)?null:q(t)},[o,l]);if(!n)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Sandbox provider catalog is not available."});const C=async(t,i=m)=>{S(!0),m(null);try{await t(),await v({quiet:!0})}catch(F){throw i(L(F,"Request failed")),F}finally{S(!1)}},_=async t=>{l&&(d(null),await C(async()=>{await n.createSandboxProvider({catalogId:l.id,name:l.name,type:l.type,...q(t),apiKey:t.apiKey})},d),x(null),setTimeout(()=>{r==null||r.showSuccess({title:`${l.name} configured`}),p(V.Settings.SANDBOX_PROVIDER_SAVED,{provider_name:l.name,mode:"create"})},0))},B=async t=>{o&&(d(null),await C(async()=>{await n.updateSandboxProvider({id:o.id,...q(t),...t.apiKey?{apiKey:t.apiKey}:{}})},d),b(null),setTimeout(()=>{r==null||r.showSuccess({title:`${o.name} updated`}),p(V.Settings.SANDBOX_PROVIDER_SAVED,{provider_name:o.name,mode:"update"})},0))},s=()=>{u||(h(null),I(null))},K=t=>{const i=n.deleteSandboxProvider;i&&(I(null),C(async()=>{await i({id:t.id}),p(V.Settings.SANDBOX_PROVIDER_DELETED,{provider_name:t.name}),h(null)},I).catch(()=>{}))},$=l!=null||o!=null,U=o!=null,X=o?`Update ${o.name}`:l?`Configure ${l.name}`:"Configure sandbox provider";return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Sandbox providers"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Choose a provider that runs sandboxes for code, files and shell commands. Only one can be active at a time."}),k?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:k}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-auto",children:E?e.jsx("p",{className:"text-sm text-text-secondary",children:"Loading sandbox providers…"}):e.jsxs("div",{className:"space-y-6",children:[c.length>0?e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Configured · ",c.length]}),e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:[c.map(t=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-success-bg",children:[e.jsx("span",{className:"size-2 rounded-full bg-success-bg","aria-hidden":!0}),"Connected"]}),e.jsx(O.Secondary,{size:"small",type:"button",disabled:u,onClick:()=>{d(null),x(null),b(t)},children:"Update"}),n.deleteSandboxProvider?e.jsx(O.Ghost,{size:"small",className:"text-text-secondary",type:"button",disabled:u,onClick:()=>{I(null),h(t)},children:"Remove"}):null]})]},t.id))," "]})]}):null,f?null:e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available · ",g.length]}),g.length===0?e.jsx("p",{className:"text-sm text-text-secondary",children:y.length>0?"All catalog providers are configured.":"No sandbox providers in the catalog."}):e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:g.map(t=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsx(O.Secondary,{type:"button",disabled:u,onClick:()=>{d(null),b(null),x(t)},children:"Configure"})]},t.id))})]})]})}),N?e.jsx(G,{title:"Remove sandbox provider?",description:`“${N.name}” will stop running sandboxes for code, files and shell commands.`,busy:u,error:P,onCancel:s,onConfirm:()=>{K(N)}}):null,e.jsx(le,{open:$,onOpenChange:t=>{t||(d(null),x(null),b(null))},onSave:U?B:_,title:X,description:U?"Update this sandbox provider. Leave API key blank to keep the existing key.":"Configure this sandbox provider. API key is never stored in the catalog.",initialConfig:A,requireApiKey:!U,busy:u,error:D})]})},ce=oe;export{ce as default};
|
|
1
|
+
import{C as G}from"./chunk-C4DROCIN-CGWCL0tw.js";import{b6 as Y,p as H,q as J,r as a,v as L,bd as Q,j as e,I as T,C as O,b8 as W,b9 as Z,ba as ee,c as te,bb as se,_ as V,a6 as ae}from"./index-KCrUroEv.js";var ne={execTimeoutMs:3e5,autoStopIntervalInMinutes:15,autoArchiveIntervalInMinutes:10080,autoDeleteIntervalInMinutes:43200},M=ae("h-11 shadow-sm");function R(n){if(n.trim()==="")return null;const r=Number(n);return!Number.isFinite(r)||r<0?null:r}var re=({open:n,onOpenChange:r,onSave:p,title:c,description:z,initialConfig:y=null,requireApiKey:j=!0,busy:E=!1,error:w})=>{const[k,m]=a.useState(""),[D,d]=a.useState(""),[u,S]=a.useState(""),[l,x]=a.useState(""),[o,b]=a.useState(""),[N,h]=a.useState(!1),P=()=>{m(""),d(""),S(""),x(""),b(""),h(!1)};a.useEffect(()=>{if(!n)return;const s=y??ne;m(String(s.execTimeoutMs)),d(String(s.autoStopIntervalInMinutes)),S(String(s.autoArchiveIntervalInMinutes)),x(String(s.autoDeleteIntervalInMinutes)),b(""),h(!1)},[n,y]);const I=s=>{s||P(),r(s)},v=R(k),f=R(D),g=R(u),A=R(l),C=o.trim(),_=(!j||!!C)&&v!=null&&f!=null&&g!=null&&A!=null,B=async s=>{if(s.preventDefault(),!(!_||E||v==null||f==null||g==null||A==null))try{await p({execTimeoutMs:v,autoStopIntervalInMinutes:f,autoArchiveIntervalInMinutes:g,autoDeleteIntervalInMinutes:A,apiKey:C}),P(),r(!1)}catch{}};return e.jsx(W,{open:n,onOpenChange:I,title:c,description:z,contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:B,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"sandbox-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",j?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"sandbox-api-key",type:"password",required:j,value:o,onChange:s=>{b(s.target.value)},placeholder:j?"dtn_...":"Leave blank to keep existing",autoFocus:!0,className:M})]}),e.jsxs(Z,{expanded:N,onChange:(s,K)=>h(K),className:"rounded-md border border-border",children:[e.jsx(ee,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced settings",e.jsx(T,{name:"chevron-down",className:te("size-4 shrink-0 text-text-secondary transition-transform duration-200",N?"rotate-0":"-rotate-90")})]})}),e.jsxs(se,{className:"space-y-4 border-t border-border px-3 pb-3 pt-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-exec-timeout",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Exec timeout (ms)"}),e.jsx("input",{id:"sandbox-exec-timeout",type:"number",min:0,required:!0,value:k,onChange:s=>{m(s.target.value)},placeholder:"300000",className:M})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-stop",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-stop interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-stop",type:"number",min:0,required:!0,value:D,onChange:s=>{d(s.target.value)},placeholder:"15",className:M})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-archive",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-archive interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-archive",type:"number",min:0,required:!0,value:u,onChange:s=>{S(s.target.value)},placeholder:"10080",className:M})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-delete",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-delete interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-delete",type:"number",min:0,required:!0,value:l,onChange:s=>{x(s.target.value)},placeholder:"43200",className:M})]})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[w?e.jsx("p",{className:"text-failure-bg text-sm",children:w}):null,e.jsx(O.Primary,{type:"submit",size:"large",disabled:!_||E,className:"w-full shrink-0",children:"Save"})]})]})})},le=re,q=({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:p,autoDeleteIntervalInMinutes:c})=>({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:p,autoDeleteIntervalInMinutes:c}),oe=()=>{const{sandboxCatalog:n}=Y(),r=H(),p=J(),[c,z]=a.useState([]),[y,j]=a.useState([]),[E,w]=a.useState(!0),[k,m]=a.useState(null),[D,d]=a.useState(null),[u,S]=a.useState(!1),[l,x]=a.useState(null),[o,b]=a.useState(null),[N,h]=a.useState(null),[P,I]=a.useState(null),v=a.useCallback(async({quiet:t=!1}={})=>{if(n){t||w(!0),m(null);try{const[i,F]=await Promise.all([n.listSandboxProviders(),n.getSandboxProviderCatalog()]);z(i),j(F)}catch(i){m(L(i,"Failed to load sandbox providers"))}finally{t||w(!1)}}},[n]);a.useEffect(()=>{v()},[v]);const f=c.length>0,g=a.useMemo(()=>{if(f)return[];const t=new Set(c.map(i=>i.catalogId));return y.filter(i=>!t.has(i.id))},[y,c,f]),A=a.useMemo(()=>{const t=o??l;return t==null||!Q(t)?null:q(t)},[o,l]);if(!n)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Sandbox provider catalog is not available."});const C=async(t,i=m)=>{S(!0),m(null);try{await t(),await v({quiet:!0})}catch(F){throw i(L(F,"Request failed")),F}finally{S(!1)}},_=async t=>{l&&(d(null),await C(async()=>{await n.createSandboxProvider({catalogId:l.id,name:l.name,type:l.type,...q(t),apiKey:t.apiKey})},d),x(null),setTimeout(()=>{r==null||r.showSuccess({title:`${l.name} configured`}),p(V.Settings.SANDBOX_PROVIDER_SAVED,{provider_name:l.name,mode:"create"})},0))},B=async t=>{o&&(d(null),await C(async()=>{await n.updateSandboxProvider({id:o.id,...q(t),...t.apiKey?{apiKey:t.apiKey}:{}})},d),b(null),setTimeout(()=>{r==null||r.showSuccess({title:`${o.name} updated`}),p(V.Settings.SANDBOX_PROVIDER_SAVED,{provider_name:o.name,mode:"update"})},0))},s=()=>{u||(h(null),I(null))},K=t=>{const i=n.deleteSandboxProvider;i&&(I(null),C(async()=>{await i({id:t.id}),p(V.Settings.SANDBOX_PROVIDER_DELETED,{provider_name:t.name}),h(null)},I).catch(()=>{}))},$=l!=null||o!=null,U=o!=null,X=o?`Update ${o.name}`:l?`Configure ${l.name}`:"Configure sandbox provider";return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Sandbox providers"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Choose a provider that runs sandboxes for code, files and shell commands. Only one can be active at a time."}),k?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:k}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-auto",children:E?e.jsx("p",{className:"text-sm text-text-secondary",children:"Loading sandbox providers…"}):e.jsxs("div",{className:"space-y-6",children:[c.length>0?e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Configured · ",c.length]}),e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:[c.map(t=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-success-bg",children:[e.jsx("span",{className:"size-2 rounded-full bg-success-bg","aria-hidden":!0}),"Connected"]}),e.jsx(O.Secondary,{size:"small",type:"button",disabled:u,onClick:()=>{d(null),x(null),b(t)},children:"Update"}),n.deleteSandboxProvider?e.jsx(O.Ghost,{size:"small",className:"text-text-secondary",type:"button",disabled:u,onClick:()=>{I(null),h(t)},children:"Remove"}):null]})]},t.id))," "]})]}):null,f?null:e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available · ",g.length]}),g.length===0?e.jsx("p",{className:"text-sm text-text-secondary",children:y.length>0?"All catalog providers are configured.":"No sandbox providers in the catalog."}):e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:g.map(t=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsx(O.Secondary,{type:"button",disabled:u,onClick:()=>{d(null),b(null),x(t)},children:"Configure"})]},t.id))})]})]})}),N?e.jsx(G,{title:"Remove sandbox provider?",description:`“${N.name}” will stop running sandboxes for code, files and shell commands.`,busy:u,error:P,onCancel:s,onConfirm:()=>{K(N)}}):null,e.jsx(le,{open:$,onOpenChange:t=>{t||(d(null),x(null),b(null))},onSave:U?B:_,title:X,description:U?"Update this sandbox provider. Leave API key blank to keep the existing key.":"Configure this sandbox provider. API key is never stored in the catalog.",initialConfig:A,requireApiKey:!U,busy:u,error:D})]})},ce=oe;export{ce as default};
|
|
Binary file
|
|
Binary file
|