@truefoundry/trueforge 0.177.0-rc.3 → 0.177.0
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-EKIN7ZIE-C5CLSAF4.js → AgentCodeSnippets-EKIN7ZIE-BK__Jr49.js} +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-EKIN7ZIE-BK__Jr49.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-EKIN7ZIE-BK__Jr49.js.gz +0 -0
- package/dist/_frontend/assets/{AgentMetricChart-ULFKK6JR-FtA01qmu.js → AgentMetricChart-ULFKK6JR-DUqlzc0i.js} +1 -1
- package/dist/_frontend/assets/AgentMetricChart-ULFKK6JR-DUqlzc0i.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-ULFKK6JR-DUqlzc0i.js.gz +0 -0
- package/dist/_frontend/assets/{AgentOverview-NGCJR4UF-fx3rPzpV.js → AgentOverview-NGCJR4UF-lBAH6Tl_.js} +1 -1
- package/dist/_frontend/assets/AgentOverview-NGCJR4UF-lBAH6Tl_.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-NGCJR4UF-lBAH6Tl_.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimeline-NDDZQZ2R-CH1XYpww.js → AgentSessionEventTimeline-NDDZQZ2R-CRKwrZYO.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimeline-NDDZQZ2R-CRKwrZYO.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-NDDZQZ2R-CRKwrZYO.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimelineChart-5AY5YW4U-BlYnXFpI.js → AgentSessionEventTimelineChart-5AY5YW4U-Btf6r_vC.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-5AY5YW4U-Btf6r_vC.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-5AY5YW4U-Btf6r_vC.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessions-AJF4A3MH-CZV-aznK.js → AgentSessions-AJF4A3MH-C3zdVGKE.js} +1 -1
- package/dist/_frontend/assets/AgentSessions-AJF4A3MH-C3zdVGKE.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-AJF4A3MH-C3zdVGKE.js.gz +0 -0
- package/dist/_frontend/assets/{ConnectorSettings-NIHX4DYV-C8ZogPrq.js → ConnectorSettings-NIHX4DYV-Cqd9W9dr.js} +1 -1
- package/dist/_frontend/assets/ConnectorSettings-NIHX4DYV-Cqd9W9dr.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-NIHX4DYV-Cqd9W9dr.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-ELMFMPFZ-CKI3C0ch.js → DockLayout-ELMFMPFZ-64HWC5vP.js} +1 -1
- package/dist/_frontend/assets/{DrawerLayout-SYUH47FF-D1qxqK4y.js → DrawerLayout-SYUH47FF-bW9h_jzW.js} +2 -2
- package/dist/_frontend/assets/DrawerLayout-SYUH47FF-bW9h_jzW.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-SYUH47FF-bW9h_jzW.js.gz +0 -0
- package/dist/_frontend/assets/{EnvironmentsPage-YV2D2VMM-DHm83CQD.js → EnvironmentsPage-YV2D2VMM-DlNlyfm2.js} +1 -1
- package/dist/_frontend/assets/EnvironmentsPage-YV2D2VMM-DlNlyfm2.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-YV2D2VMM-DlNlyfm2.js.gz +0 -0
- package/dist/_frontend/assets/{ModelSettings-KMU4MUTS-DKc1chiV.js → ModelSettings-KMU4MUTS-4qLH7ibV.js} +1 -1
- package/dist/_frontend/assets/ModelSettings-KMU4MUTS-4qLH7ibV.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-KMU4MUTS-4qLH7ibV.js.gz +0 -0
- package/dist/_frontend/assets/{SandboxSettings-XYOVCK6J-DOwzraoP.js → SandboxSettings-XYOVCK6J-CbwTlTY9.js} +1 -1
- package/dist/_frontend/assets/SandboxSettings-XYOVCK6J-CbwTlTY9.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-XYOVCK6J-CbwTlTY9.js.gz +0 -0
- package/dist/_frontend/assets/{SchedulesPage-UNS7BDS6-2nutAZJw.js → SchedulesPage-UNS7BDS6-CjgOxBTD.js} +1 -1
- package/dist/_frontend/assets/SchedulesPage-UNS7BDS6-CjgOxBTD.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-UNS7BDS6-CjgOxBTD.js.gz +0 -0
- package/dist/_frontend/assets/{SettingsBuilder-OU3B7YHU-WqPteovS.js → SettingsBuilder-OU3B7YHU-DYpXgbEN.js} +2 -2
- package/dist/_frontend/assets/SettingsBuilder-OU3B7YHU-DYpXgbEN.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-OU3B7YHU-DYpXgbEN.js.gz +0 -0
- package/dist/_frontend/assets/{ShellRouteSync-M5WTXCX5-C5n2eFQd.js → ShellRouteSync-M5WTXCX5-BecyJLZB.js} +1 -1
- package/dist/_frontend/assets/ShellRouteSync-M5WTXCX5-BecyJLZB.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-M5WTXCX5-BecyJLZB.js.gz +0 -0
- package/dist/_frontend/assets/{SidebarLayout-MGDOLVJB-DPugimAt.js → SidebarLayout-MGDOLVJB-bzsOzbNs.js} +2 -2
- package/dist/_frontend/assets/SidebarLayout-MGDOLVJB-bzsOzbNs.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-MGDOLVJB-bzsOzbNs.js.gz +0 -0
- package/dist/_frontend/assets/{SkillSettings-QPZ43BZT-B9qYhwe9.js → SkillSettings-QPZ43BZT-B7Q1Wv_4.js} +1 -1
- package/dist/_frontend/assets/SkillSettings-QPZ43BZT-B7Q1Wv_4.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-QPZ43BZT-B7Q1Wv_4.js.gz +0 -0
- package/dist/_frontend/assets/{TrueForgeUIWithRouter-VAVREKS2-DtJ-vwCY.js → TrueForgeUIWithRouter-VAVREKS2-DG9NN-mB.js} +1 -1
- package/dist/_frontend/assets/{WebSearchSettings-VOFJUVYH-CTUZZW9E.js → WebSearchSettings-VOFJUVYH-SgpUTawp.js} +1 -1
- package/dist/_frontend/assets/WebSearchSettings-VOFJUVYH-SgpUTawp.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-VOFJUVYH-SgpUTawp.js.gz +0 -0
- package/dist/_frontend/assets/{WidgetLayout-CJYOCWXG-B8IRc4Pg.js → WidgetLayout-CJYOCWXG-hW-w0wXo.js} +1 -1
- package/dist/_frontend/assets/WidgetLayout-CJYOCWXG-hW-w0wXo.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-CJYOCWXG-hW-w0wXo.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-C5376XWU-3UMp6mV3.js → chunk-C5376XWU-CUgFlwPN.js} +1 -1
- package/dist/_frontend/assets/{chunk-EGUH4WJX-guSUC8c3.js → chunk-EGUH4WJX-SANPGRqh.js} +1 -1
- package/dist/_frontend/assets/chunk-EGUH4WJX-SANPGRqh.js.br +0 -0
- package/dist/_frontend/assets/chunk-EGUH4WJX-SANPGRqh.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-OB3PAWPO-p2vzYyn5.js → chunk-OB3PAWPO-DQ_P-4S-.js} +1 -1
- package/dist/_frontend/assets/chunk-OB3PAWPO-DQ_P-4S-.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-DQ_P-4S-.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-RO36YFVR-BEh5biv9.js → chunk-RO36YFVR-D08M8Asc.js} +1 -1
- package/dist/_frontend/assets/chunk-RO36YFVR-D08M8Asc.js.br +0 -0
- package/dist/_frontend/assets/chunk-RO36YFVR-D08M8Asc.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-X2GIDKWH-ywdnTKgd.js → chunk-X2GIDKWH-CMjGi2n8.js} +2 -2
- package/dist/_frontend/assets/chunk-X2GIDKWH-CMjGi2n8.js.br +0 -0
- package/dist/_frontend/assets/chunk-X2GIDKWH-CMjGi2n8.js.gz +0 -0
- package/dist/_frontend/assets/{cssMode-BYOhQ66e.js → cssMode-DBcp10nw.js} +1 -1
- package/dist/_frontend/assets/cssMode-DBcp10nw.js.br +10 -0
- package/dist/_frontend/assets/cssMode-DBcp10nw.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-BmR7Gxkv.js → freemarker2-kn4ZhL8s.js} +1 -1
- package/dist/_frontend/assets/freemarker2-kn4ZhL8s.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-kn4ZhL8s.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-CNCHi4gs.js → handlebars-hJoSbeEv.js} +1 -1
- package/dist/_frontend/assets/handlebars-hJoSbeEv.js.br +0 -0
- package/dist/_frontend/assets/handlebars-hJoSbeEv.js.gz +0 -0
- package/dist/_frontend/assets/{html-zWUW5B97.js → html-Cb9UIhE4.js} +1 -1
- package/dist/_frontend/assets/html-Cb9UIhE4.js.br +0 -0
- package/dist/_frontend/assets/html-Cb9UIhE4.js.gz +0 -0
- package/dist/_frontend/assets/{htmlMode-BH--T_yQ.js → htmlMode-b3R93yfn.js} +1 -1
- package/dist/_frontend/assets/htmlMode-b3R93yfn.js.br +8 -0
- package/dist/_frontend/assets/htmlMode-b3R93yfn.js.gz +0 -0
- package/dist/_frontend/assets/{index-BvpV5jNz.js → index-D6YKMpJU.js} +235 -235
- package/dist/_frontend/assets/index-D6YKMpJU.js.br +0 -0
- package/dist/_frontend/assets/index-D6YKMpJU.js.gz +0 -0
- package/dist/_frontend/assets/{index-CiRBPQDQ.js → index-DyV3Kxi4.js} +3 -3
- package/dist/_frontend/assets/index-DyV3Kxi4.js.br +0 -0
- package/dist/_frontend/assets/index-DyV3Kxi4.js.gz +0 -0
- package/dist/_frontend/assets/{index-dB4L7-7t.js → index-R1kS-j0r.js} +1 -1
- package/dist/_frontend/assets/index-R1kS-j0r.js.br +0 -0
- package/dist/_frontend/assets/index-R1kS-j0r.js.gz +0 -0
- package/dist/_frontend/assets/{javascript-BdXt947S.js → javascript-CSvI9_rd.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-DLoTdzqM.js → jsonMode-B-bur220.js} +1 -1
- package/dist/_frontend/assets/jsonMode-B-bur220.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-B-bur220.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-uZVyOlu3.js → liquid-B2c7_pgJ.js} +1 -1
- package/dist/_frontend/assets/liquid-B2c7_pgJ.js.br +0 -0
- package/dist/_frontend/assets/liquid-B2c7_pgJ.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-dzIIeBGp.js → lspLanguageFeatures-Dru3qdb_.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-Dru3qdb_.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-Dru3qdb_.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-JQ7BTCkt.js → mdx-BJ8Sv1r2.js} +1 -1
- package/dist/_frontend/assets/mdx-BJ8Sv1r2.js.br +0 -0
- package/dist/_frontend/assets/mdx-BJ8Sv1r2.js.gz +0 -0
- package/dist/_frontend/assets/{python-DLUoFAlA.js → python-Dd-s66vK.js} +1 -1
- package/dist/_frontend/assets/python-Dd-s66vK.js.br +0 -0
- package/dist/_frontend/assets/python-Dd-s66vK.js.gz +0 -0
- package/dist/_frontend/assets/{razor-DSARItYP.js → razor-CZgtByAc.js} +1 -1
- package/dist/_frontend/assets/razor-CZgtByAc.js.br +0 -0
- package/dist/_frontend/assets/razor-CZgtByAc.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-CKEEvLsZ.js → tsMode-BKdqN2QK.js} +1 -1
- package/dist/_frontend/assets/tsMode-BKdqN2QK.js.br +0 -0
- package/dist/_frontend/assets/tsMode-BKdqN2QK.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-DQf325iz.js → typescript-DfaR9qdT.js} +1 -1
- package/dist/_frontend/assets/typescript-DfaR9qdT.js.br +0 -0
- package/dist/_frontend/assets/typescript-DfaR9qdT.js.gz +0 -0
- package/dist/_frontend/assets/{workers-DVgczsEQ.js → workers--wwmRDDg.js} +1 -1
- package/dist/_frontend/assets/workers--wwmRDDg.js.br +0 -0
- package/dist/_frontend/assets/workers--wwmRDDg.js.gz +0 -0
- package/dist/_frontend/assets/{xml-CkTe4kOt.js → xml-DSX1f9L4.js} +1 -1
- package/dist/_frontend/assets/xml-DSX1f9L4.js.br +0 -0
- package/dist/_frontend/assets/xml-DSX1f9L4.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-zYetyRdv.js → yaml-CMmrTeSX.js} +1 -1
- package/dist/_frontend/assets/yaml-CMmrTeSX.js.br +0 -0
- package/dist/_frontend/assets/yaml-CMmrTeSX.js.gz +0 -0
- package/dist/_frontend/index.html +1 -1
- package/dist/controller-main.js +1 -1
- package/dist/controller-main.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/postgres/migrations/20260727_000001_init.js +1 -1
- package/dist/postgres/migrations/20260727_000001_init.js.map +1 -1
- package/package.json +3 -3
- package/dist/_frontend/assets/AgentCodeSnippets-EKIN7ZIE-C5CLSAF4.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-EKIN7ZIE-C5CLSAF4.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-ULFKK6JR-FtA01qmu.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-ULFKK6JR-FtA01qmu.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-NGCJR4UF-fx3rPzpV.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-NGCJR4UF-fx3rPzpV.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-NDDZQZ2R-CH1XYpww.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-NDDZQZ2R-CH1XYpww.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-5AY5YW4U-BlYnXFpI.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-5AY5YW4U-BlYnXFpI.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-AJF4A3MH-CZV-aznK.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-AJF4A3MH-CZV-aznK.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-NIHX4DYV-C8ZogPrq.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-NIHX4DYV-C8ZogPrq.js.gz +0 -0
- package/dist/_frontend/assets/DrawerLayout-SYUH47FF-D1qxqK4y.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-SYUH47FF-D1qxqK4y.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-YV2D2VMM-DHm83CQD.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-YV2D2VMM-DHm83CQD.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-KMU4MUTS-DKc1chiV.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-KMU4MUTS-DKc1chiV.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-XYOVCK6J-DOwzraoP.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-XYOVCK6J-DOwzraoP.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-UNS7BDS6-2nutAZJw.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-UNS7BDS6-2nutAZJw.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-OU3B7YHU-WqPteovS.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-OU3B7YHU-WqPteovS.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-M5WTXCX5-C5n2eFQd.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-M5WTXCX5-C5n2eFQd.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-MGDOLVJB-DPugimAt.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-MGDOLVJB-DPugimAt.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-QPZ43BZT-B9qYhwe9.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-QPZ43BZT-B9qYhwe9.js.gz +0 -0
- package/dist/_frontend/assets/WebSearchSettings-VOFJUVYH-CTUZZW9E.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-VOFJUVYH-CTUZZW9E.js.gz +0 -0
- package/dist/_frontend/assets/WidgetLayout-CJYOCWXG-B8IRc4Pg.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-CJYOCWXG-B8IRc4Pg.js.gz +0 -0
- package/dist/_frontend/assets/chunk-EGUH4WJX-guSUC8c3.js.br +0 -0
- package/dist/_frontend/assets/chunk-EGUH4WJX-guSUC8c3.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-p2vzYyn5.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-p2vzYyn5.js.gz +0 -0
- package/dist/_frontend/assets/chunk-RO36YFVR-BEh5biv9.js.br +0 -0
- package/dist/_frontend/assets/chunk-RO36YFVR-BEh5biv9.js.gz +0 -0
- package/dist/_frontend/assets/chunk-X2GIDKWH-ywdnTKgd.js.br +0 -0
- package/dist/_frontend/assets/chunk-X2GIDKWH-ywdnTKgd.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-BYOhQ66e.js.br +0 -0
- package/dist/_frontend/assets/cssMode-BYOhQ66e.js.gz +0 -0
- package/dist/_frontend/assets/freemarker2-BmR7Gxkv.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-BmR7Gxkv.js.gz +0 -0
- package/dist/_frontend/assets/handlebars-CNCHi4gs.js.br +0 -0
- package/dist/_frontend/assets/handlebars-CNCHi4gs.js.gz +0 -0
- package/dist/_frontend/assets/html-zWUW5B97.js.br +0 -0
- package/dist/_frontend/assets/html-zWUW5B97.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-BH--T_yQ.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-BH--T_yQ.js.gz +0 -0
- package/dist/_frontend/assets/index-BvpV5jNz.js.br +0 -0
- package/dist/_frontend/assets/index-BvpV5jNz.js.gz +0 -0
- package/dist/_frontend/assets/index-CiRBPQDQ.js.br +0 -0
- package/dist/_frontend/assets/index-CiRBPQDQ.js.gz +0 -0
- package/dist/_frontend/assets/index-dB4L7-7t.js.br +0 -0
- package/dist/_frontend/assets/index-dB4L7-7t.js.gz +0 -0
- package/dist/_frontend/assets/jsonMode-DLoTdzqM.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-DLoTdzqM.js.gz +0 -0
- package/dist/_frontend/assets/liquid-uZVyOlu3.js.br +0 -0
- package/dist/_frontend/assets/liquid-uZVyOlu3.js.gz +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-dzIIeBGp.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-dzIIeBGp.js.gz +0 -0
- package/dist/_frontend/assets/mdx-JQ7BTCkt.js.br +0 -0
- package/dist/_frontend/assets/mdx-JQ7BTCkt.js.gz +0 -0
- package/dist/_frontend/assets/python-DLUoFAlA.js.br +0 -0
- package/dist/_frontend/assets/python-DLUoFAlA.js.gz +0 -0
- package/dist/_frontend/assets/razor-DSARItYP.js.br +0 -0
- package/dist/_frontend/assets/razor-DSARItYP.js.gz +0 -0
- package/dist/_frontend/assets/tsMode-CKEEvLsZ.js.br +0 -0
- package/dist/_frontend/assets/tsMode-CKEEvLsZ.js.gz +0 -0
- package/dist/_frontend/assets/typescript-DQf325iz.js.br +0 -0
- package/dist/_frontend/assets/typescript-DQf325iz.js.gz +0 -0
- package/dist/_frontend/assets/workers-DVgczsEQ.js.br +0 -0
- package/dist/_frontend/assets/workers-DVgczsEQ.js.gz +0 -0
- package/dist/_frontend/assets/xml-CkTe4kOt.js.br +0 -0
- package/dist/_frontend/assets/xml-CkTe4kOt.js.gz +0 -0
- package/dist/_frontend/assets/yaml-zYetyRdv.js.br +0 -0
- package/dist/_frontend/assets/yaml-zYetyRdv.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as Se}from"./chunk-C5376XWU-3UMp6mV3.js";import{aX as ce,t as we,b2 as me,r as a,aY as G,j as e,Y as ke,a0 as j,I as w,a_ as ue,ap as V,g as $,aZ as de}from"./index-BvpV5jNz.js";var ze=[{value:"none",label:"None"},{value:"header",label:"API Key"},{value:"dcr",label:"OAuth"}],se=V("h-11 shadow-sm"),O=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),Ae=({open:r,onOpenChange:f,onSubmit:y,connector:n,busy:g=!1,error:E})=>{const[u,h]=a.useState(""),[p,k]=a.useState(""),[z,N]=a.useState(""),[b,o]=a.useState("dcr"),[c,C]=a.useState(""),[F,M]=a.useState(""),v=n!==void 0,A=V(`h-11 shadow-sm ${v?"cursor-not-allowed bg-secondary-bg/60 text-text-secondary opacity-40":""}`),i=()=>{h(""),k(""),N(""),o("dcr"),C(""),M("")};a.useEffect(()=>{r&&(h((n==null?void 0:n.name)??""),k((n==null?void 0:n.url)??""),N((n==null?void 0:n.description)??""),o((n==null?void 0:n.auth.type)??"dcr"),C(""),M((n==null?void 0:n.auth.type)==="header"?n.auth.headerName??"":""))},[n,r]);const S=l=>{l||i(),f(l)},d=!!c.trim()||(n==null?void 0:n.auth.type)==="header",R=!!u.trim()&&!!z.trim()&&!!p.trim()&&(b!=="header"||d),I=async l=>{if(l.preventDefault(),!R||g)return;const Z=b==="header"?{type:"header",apiKey:c.trim(),...F.trim()?{headerName:F.trim()}:{}}:{type:b};try{await y({name:u.trim(),url:p.trim(),description:z.trim(),auth:Z}),i(),f(!1)}catch{}};return e.jsx(ue,{open:r,onOpenChange:S,title:v?"Edit MCP server":"Add MCP server",description:v?"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 I(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(O,{})]}),e.jsx("input",{id:"mcp-server-name",type:"text",required:!0,value:u,readOnly:v,"aria-disabled":v,onChange:l=>{h(l.target.value)},placeholder:"analytics-postgres-mcp",autoFocus:!v,className:A})]}),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(O,{})]}),e.jsx("textarea",{id:"mcp-server-description",value:z,onChange:l=>{N(l.target.value)},placeholder:"Query analytics from Postgres",required:!0,rows:3,className:V("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(O,{})]}),e.jsx("input",{id:"mcp-server-url",type:"url",required:!0,value:p,onChange:l=>{k(l.target.value)},placeholder:"https://mcp.example.com/mcp",className:se})]}),e.jsxs("fieldset",{children:[e.jsxs("legend",{className:"mb-1.5 text-sm font-medium text-text-primary",children:["Auth type",e.jsx(O,{})]}),e.jsx("div",{className:"flex w-full flex-row rounded-md border border-border bg-secondary-bg/40 p-1",children:ze.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 ${b===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:b===l.value,onChange:()=>{o(l.value)},className:"sr-only"}),l.label]},l.value))})]}),b==="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,b==="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(O,{})]}),e.jsx("input",{id:"mcp-server-api-key",type:"password",required:(n==null?void 0:n.auth.type)!=="header",value:c,onChange:l=>{C(l.target.value)},placeholder:"Bearer <Paste the token from the provider>","aria-describedby":"mcp-server-api-key-hint",className:se}),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 "${F.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:F,onChange:l=>{M(l.target.value)},placeholder:"Authorization",className:se})]})]}):null]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[E?e.jsx("p",{className:"text-failure-bg text-sm",children:E}):null,e.jsx(j.Primary,{type:"submit",size:"large",disabled:!R||g,className:"w-full shrink-0",children:v?"Save":"Add"})]})]})})},oe=Ae,X={dcr:"OAuth2",header:"API Key",none:"No Auth"};function Ee({text:r}){const f=a.useRef(null),[y,n]=a.useState(!1),[g,E]=a.useState(!1),[u,h]=a.useState(16);return a.useLayoutEffect(()=>{n(!1),h(16)},[r]),a.useLayoutEffect(()=>{const p=f.current;if(!p)return;if(!y){h(16),E(p.scrollWidth>p.clientWidth+1);return}h(16);const k=requestAnimationFrame(()=>{h(p.scrollHeight)});return()=>cancelAnimationFrame(k)},[r,y]),r?e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("p",{ref:f,style:{maxHeight:u},className:$("mt-0.5 overflow-hidden font-mono text-xs leading-4 text-text-secondary transition-[max-height] duration-300 ease-in-out",!y&&"whitespace-nowrap",!y&&g&&"pr-[5.75rem]"),children:[r,y&&g?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]}),!y&&g?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 Fe=({connector:r,onBack:f,onConnectorRefreshed:y,onEdit:n,onDisconnect:g,onRemove:E,busy:u=!1})=>{const{connectorCatalog:h}=ce(),{handleAuthorize:p,isOAuthLoading:k}=me(),[z,N]=a.useState([]),[b,o]=a.useState(!0),[c,C]=a.useState(null),[F,M]=a.useState(!1);a.useEffect(()=>{let i=!1;return N([]),C(null),o(!0),h.getToolsByConnectorId({id:r.id}).then(S=>{i||N(S)}).catch(S=>{i||C(G(S,"Failed to load connector tools"))}).finally(()=>{i||o(!1)}),()=>{i=!0}},[r.authenticated,r.id,h]);const v=async()=>{M(!0),C(null);try{const i=await h.getConnector({id:r.id});y(i)}catch(i){C(G(i,"Failed to refresh connector details"))}finally{M(!1)}},A=k||F;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:f,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:X[r.auth.type]??X.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(j.Secondary,{size:"small",type:"button",disabled:u,onClick:n,children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.auth.type==="dcr"&&!r.authenticated?e.jsx(j.Secondary,{size:"small",type:"button",disabled:u||A,onClick:()=>{p(r.id,i=>{i&&v()})},children:A?"Connecting…":"Connect"}):r.auth.type==="dcr"&&!r.requiresAuth?e.jsx(j.Secondary,{size:"small",type:"button",disabled:u,onClick:g,children:"Disconnect"}):null,E?e.jsx(j.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:u,"aria-label":`Remove ${r.name}`,onClick:E,children:"Remove"}):null]})]}),e.jsx("section",{className:"mt-6","aria-labelledby":"connector-tools-heading",children:b?e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"Loading tools…"}):c?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:[c,r.auth.type==="dcr"&&!r.authenticated&&e.jsx("div",{className:"font-bold mt-1",children:"Click Connect and authenticate successfully to view tools."})]}):z.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:["· ",z.length]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:z.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(Ee,{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."})})]})]})},Me=Fe,Ie=()=>{const{connectorCatalog:r}=ce(),f=we(),{handleAuthorize:y,isOAuthLoading:n}=me(),[g,E]=a.useState(""),[u,h]=a.useState({ordered:[],authStatusById:new Map}),[p,k]=a.useState(!0),[z,N]=a.useState(null),[b,o]=a.useState(null),[c,C]=a.useState(!1),[F,M]=a.useState([]),[v,A]=a.useState(!1),[i,S]=a.useState(null),[d,R]=a.useState(null),[I,l]=a.useState(null),[Z,ae]=a.useState(null),[J,q]=a.useState(null),[xe,D]=a.useState(null),[_,ee]=a.useState(""),re=a.useMemo(()=>(F??[]).reduce((t,s)=>(t[s.name]=s.logo??"",t),{}),[F]),H=a.useCallback(async()=>{k(!0),N(null);try{const[t,s]=await Promise.all([r.listConnectors(),r.getConnectorCatalog()]);M(s);const m=t??[],P=new Set(m.map(x=>x.id)),Y=[...m.map(x=>({connector:x,isConfigured:!0})),...s.filter(x=>!P.has(x.id)).map(x=>({connector:x,isConfigured:!1}))];h({ordered:Y,authStatusById:new Map(Y.map(x=>[x.connector.id,x.isConfigured?x.connector.authenticated:!1]))}),l(x=>x?t.find(W=>W.id===x.id)??null:null)}catch(t){N(G(t,"Failed to load connectors"))}finally{k(!1)}},[r]);a.useEffect(()=>{H()},[H]);const L=g.trim().toLowerCase(),U=a.useMemo(()=>L?u.ordered.filter(({connector:t})=>{var s;return t.name.toLowerCase().includes(L)||(((s=t.description)==null?void 0:s.toLowerCase().includes(L))??!1)||t.url.toLowerCase().includes(L)}):u.ordered,[u.ordered,L]),K=a.useMemo(()=>{const t=[];for(const s of U)if(s.isConfigured){const m=u.authStatusById.get(s.connector.id)??s.connector.authenticated;t.push(m===s.connector.authenticated?s.connector:{...s.connector,authenticated:m})}return t},[u.authStatusById,U]),Q=a.useMemo(()=>{const t=[];for(const s of U)s.isConfigured||t.push(s.connector);return t},[U]),B=async(t,s=N)=>{C(!0),N(null);try{await t(),await H()}catch(m){throw s(G(m,"Request failed")),m}finally{C(!1)}},te=()=>{R(null),ee(""),o(null)},ne=async(t,s)=>{const m=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:m})},he=t=>{if(t.auth.type==="header"){ee(""),o(null),R(t);return}B(async()=>{await ne(t)}).catch(()=>{})},pe=t=>{if(t.preventDefault(),!d||!_.trim())return;const s=d;o(null),B(async()=>{const m={type:"header",apiKey:_.trim(),...s.auth.type==="header"&&s.auth.headerName?{headerName:s.auth.headerName}:{}};await ne(s,m),te(),setTimeout(()=>{f==null||f.showSuccess({title:`${s.name} connected`})},100)},o).catch(()=>{})},le=async t=>{o(null),await B(async()=>{i?await r.updateConnector({id:i.id,...t}):await r.createConnector({...t})},o),setTimeout(()=>{f==null||f.showSuccess({title:`${t.name} ${i?"updated":"added"}`})},0)},fe=t=>{B(async()=>{await r.disconnectConnector({id:t.id}),l(null)}).catch(()=>{})},be=()=>{c||(q(null),D(null))},ge=t=>{const s=r.deleteConnector;s&&(D(null),B(async()=>{await s({id:t.id}),q(null),l(null)},D).catch(()=>{}))},ye=t=>{l(s=>(s==null?void 0:s.id)===t.id?t:s),h(s=>{const m=new Map(s.authStatusById);return m.set(t.id,t.authenticated),{ordered:s.ordered.map(P=>P.isConfigured&&P.connector.id===t.id?{connector:t,isConfigured:!0}:P),authStatusById:m}})},ve=(t,s)=>{const m=re[t.name],P=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:m?e.jsx(de,{src:m,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})]})]}),Y="flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0",x=t.auth.type==="dcr"&&!t.authenticated,W=n&&Z===t.id;return e.jsxs("article",{className:`${Y} cursor-pointer transition-colors hover:bg-ghost-button-hover/60`,onClick:()=>{l(t)},children:[e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:P}),e.jsxs("div",{className:"flex items-center gap-2",children:[x?e.jsx(j.Secondary,{size:"small",type:"button",disabled:c||W,onClick:T=>{T.stopPropagation(),ae(t.id),y(t.id,Ce=>{ae(null),Ce&&H()})},children:W?"Connecting…":"Connect"}):null,e.jsxs(j.Secondary,{size:"small",type:"button",disabled:c,onClick:T=>{T.stopPropagation(),o(null),S(t),A(!0)},children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.deleteConnector?e.jsx(j.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:c,"aria-label":`Remove ${t.name}`,onClick:T=>{T.stopPropagation(),D(null),q(t)},children:"Remove"}):null,e.jsx(w,{name:"chevron-right",className:"size-4"})]})]},t.id)},je=t=>{const s=re[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(de,{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:X[t.auth.type]??X.none}),e.jsx(j.Secondary,{size:"small",type:"button",disabled:c,onClick:()=>{he(t)},children:t.auth.type==="dcr"?"Add":"Connect"})]})]},t.id)},ie=J?e.jsx(Se,{title:"Remove connector?",description:`“${J.name}” will no longer be available to your agents.`,busy:c,error:xe,onCancel:be,onConfirm:()=>{ge(J)}}):null;if(I)return e.jsxs(e.Fragment,{children:[e.jsx(Me,{connector:I,busy:c,onBack:()=>{l(null)},onConnectorRefreshed:ye,onEdit:()=>{o(null),S(I),A(!0)},onDisconnect:()=>{fe(I)},onRemove:r.deleteConnector?()=>{D(null),q(I)}:void 0}),e.jsx(oe,{open:v,onOpenChange:t=>{A(t),t||(S(null),o(null))},onSubmit:le,connector:i??void 0,busy:c,error:b}),ie]});const Ne=K.length>0||Q.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."}),z?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:z}):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(ke,{query:g,setQuery:E,placeholder:"Search connectors"})}),e.jsxs(j.Secondary,{type:"button",className:"shrink-0",onClick:()=>{o(null),S(null),A(!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:[p?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!p&&K.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 · ",K.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:K.map(t=>ve(t))})]}):null,!p&&Q.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 · ",Q.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:Q.map(t=>je(t))})]}):null,!p&&!Ne?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(ue,{open:d!==null,onOpenChange:t=>{t||te()},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:pe,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:_,onChange:t=>{ee(t.target.value)},placeholder:`Bearer <Paste the token from ${(d==null?void 0:d.name)??"the provider"}>`,autoFocus:!0,required:!0,className:V("h-11")})]}),b?e.jsx("p",{className:"text-failure-bg text-sm",children:b}):null]}),e.jsxs("footer",{className:"flex justify-end gap-2 border-t border-border px-5 py-4",children:[e.jsx(j.Ghost,{type:"button",onClick:te,disabled:c,children:"Cancel"}),e.jsx(j.Primary,{type:"submit",disabled:!_.trim()||c,children:"Connect"})]})]})}),e.jsx(oe,{open:v,onOpenChange:t=>{A(t),t||(S(null),o(null))},onSubmit:le,connector:i??void 0,busy:c,error:b}),ie]})})]})},De=Ie;export{De as default};
|
|
1
|
+
import{C as Se}from"./chunk-C5376XWU-CUgFlwPN.js";import{aX as ce,t as we,b2 as me,r as a,aY as G,j as e,Y as ke,a0 as j,I as w,a_ as ue,ap as V,g as $,aZ as de}from"./index-D6YKMpJU.js";var ze=[{value:"none",label:"None"},{value:"header",label:"API Key"},{value:"dcr",label:"OAuth"}],se=V("h-11 shadow-sm"),O=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),Ae=({open:r,onOpenChange:f,onSubmit:y,connector:n,busy:g=!1,error:E})=>{const[u,h]=a.useState(""),[p,k]=a.useState(""),[z,N]=a.useState(""),[b,o]=a.useState("dcr"),[c,C]=a.useState(""),[F,M]=a.useState(""),v=n!==void 0,A=V(`h-11 shadow-sm ${v?"cursor-not-allowed bg-secondary-bg/60 text-text-secondary opacity-40":""}`),i=()=>{h(""),k(""),N(""),o("dcr"),C(""),M("")};a.useEffect(()=>{r&&(h((n==null?void 0:n.name)??""),k((n==null?void 0:n.url)??""),N((n==null?void 0:n.description)??""),o((n==null?void 0:n.auth.type)??"dcr"),C(""),M((n==null?void 0:n.auth.type)==="header"?n.auth.headerName??"":""))},[n,r]);const S=l=>{l||i(),f(l)},d=!!c.trim()||(n==null?void 0:n.auth.type)==="header",R=!!u.trim()&&!!z.trim()&&!!p.trim()&&(b!=="header"||d),I=async l=>{if(l.preventDefault(),!R||g)return;const Z=b==="header"?{type:"header",apiKey:c.trim(),...F.trim()?{headerName:F.trim()}:{}}:{type:b};try{await y({name:u.trim(),url:p.trim(),description:z.trim(),auth:Z}),i(),f(!1)}catch{}};return e.jsx(ue,{open:r,onOpenChange:S,title:v?"Edit MCP server":"Add MCP server",description:v?"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 I(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(O,{})]}),e.jsx("input",{id:"mcp-server-name",type:"text",required:!0,value:u,readOnly:v,"aria-disabled":v,onChange:l=>{h(l.target.value)},placeholder:"analytics-postgres-mcp",autoFocus:!v,className:A})]}),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(O,{})]}),e.jsx("textarea",{id:"mcp-server-description",value:z,onChange:l=>{N(l.target.value)},placeholder:"Query analytics from Postgres",required:!0,rows:3,className:V("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(O,{})]}),e.jsx("input",{id:"mcp-server-url",type:"url",required:!0,value:p,onChange:l=>{k(l.target.value)},placeholder:"https://mcp.example.com/mcp",className:se})]}),e.jsxs("fieldset",{children:[e.jsxs("legend",{className:"mb-1.5 text-sm font-medium text-text-primary",children:["Auth type",e.jsx(O,{})]}),e.jsx("div",{className:"flex w-full flex-row rounded-md border border-border bg-secondary-bg/40 p-1",children:ze.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 ${b===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:b===l.value,onChange:()=>{o(l.value)},className:"sr-only"}),l.label]},l.value))})]}),b==="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,b==="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(O,{})]}),e.jsx("input",{id:"mcp-server-api-key",type:"password",required:(n==null?void 0:n.auth.type)!=="header",value:c,onChange:l=>{C(l.target.value)},placeholder:"Bearer <Paste the token from the provider>","aria-describedby":"mcp-server-api-key-hint",className:se}),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 "${F.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:F,onChange:l=>{M(l.target.value)},placeholder:"Authorization",className:se})]})]}):null]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[E?e.jsx("p",{className:"text-failure-bg text-sm",children:E}):null,e.jsx(j.Primary,{type:"submit",size:"large",disabled:!R||g,className:"w-full shrink-0",children:v?"Save":"Add"})]})]})})},oe=Ae,X={dcr:"OAuth2",header:"API Key",none:"No Auth"};function Ee({text:r}){const f=a.useRef(null),[y,n]=a.useState(!1),[g,E]=a.useState(!1),[u,h]=a.useState(16);return a.useLayoutEffect(()=>{n(!1),h(16)},[r]),a.useLayoutEffect(()=>{const p=f.current;if(!p)return;if(!y){h(16),E(p.scrollWidth>p.clientWidth+1);return}h(16);const k=requestAnimationFrame(()=>{h(p.scrollHeight)});return()=>cancelAnimationFrame(k)},[r,y]),r?e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("p",{ref:f,style:{maxHeight:u},className:$("mt-0.5 overflow-hidden font-mono text-xs leading-4 text-text-secondary transition-[max-height] duration-300 ease-in-out",!y&&"whitespace-nowrap",!y&&g&&"pr-[5.75rem]"),children:[r,y&&g?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]}),!y&&g?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 Fe=({connector:r,onBack:f,onConnectorRefreshed:y,onEdit:n,onDisconnect:g,onRemove:E,busy:u=!1})=>{const{connectorCatalog:h}=ce(),{handleAuthorize:p,isOAuthLoading:k}=me(),[z,N]=a.useState([]),[b,o]=a.useState(!0),[c,C]=a.useState(null),[F,M]=a.useState(!1);a.useEffect(()=>{let i=!1;return N([]),C(null),o(!0),h.getToolsByConnectorId({id:r.id}).then(S=>{i||N(S)}).catch(S=>{i||C(G(S,"Failed to load connector tools"))}).finally(()=>{i||o(!1)}),()=>{i=!0}},[r.authenticated,r.id,h]);const v=async()=>{M(!0),C(null);try{const i=await h.getConnector({id:r.id});y(i)}catch(i){C(G(i,"Failed to refresh connector details"))}finally{M(!1)}},A=k||F;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:f,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:X[r.auth.type]??X.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(j.Secondary,{size:"small",type:"button",disabled:u,onClick:n,children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.auth.type==="dcr"&&!r.authenticated?e.jsx(j.Secondary,{size:"small",type:"button",disabled:u||A,onClick:()=>{p(r.id,i=>{i&&v()})},children:A?"Connecting…":"Connect"}):r.auth.type==="dcr"&&!r.requiresAuth?e.jsx(j.Secondary,{size:"small",type:"button",disabled:u,onClick:g,children:"Disconnect"}):null,E?e.jsx(j.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:u,"aria-label":`Remove ${r.name}`,onClick:E,children:"Remove"}):null]})]}),e.jsx("section",{className:"mt-6","aria-labelledby":"connector-tools-heading",children:b?e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"Loading tools…"}):c?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:[c,r.auth.type==="dcr"&&!r.authenticated&&e.jsx("div",{className:"font-bold mt-1",children:"Click Connect and authenticate successfully to view tools."})]}):z.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:["· ",z.length]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:z.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(Ee,{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."})})]})]})},Me=Fe,Ie=()=>{const{connectorCatalog:r}=ce(),f=we(),{handleAuthorize:y,isOAuthLoading:n}=me(),[g,E]=a.useState(""),[u,h]=a.useState({ordered:[],authStatusById:new Map}),[p,k]=a.useState(!0),[z,N]=a.useState(null),[b,o]=a.useState(null),[c,C]=a.useState(!1),[F,M]=a.useState([]),[v,A]=a.useState(!1),[i,S]=a.useState(null),[d,R]=a.useState(null),[I,l]=a.useState(null),[Z,ae]=a.useState(null),[J,q]=a.useState(null),[xe,D]=a.useState(null),[_,ee]=a.useState(""),re=a.useMemo(()=>(F??[]).reduce((t,s)=>(t[s.name]=s.logo??"",t),{}),[F]),H=a.useCallback(async()=>{k(!0),N(null);try{const[t,s]=await Promise.all([r.listConnectors(),r.getConnectorCatalog()]);M(s);const m=t??[],P=new Set(m.map(x=>x.id)),Y=[...m.map(x=>({connector:x,isConfigured:!0})),...s.filter(x=>!P.has(x.id)).map(x=>({connector:x,isConfigured:!1}))];h({ordered:Y,authStatusById:new Map(Y.map(x=>[x.connector.id,x.isConfigured?x.connector.authenticated:!1]))}),l(x=>x?t.find(W=>W.id===x.id)??null:null)}catch(t){N(G(t,"Failed to load connectors"))}finally{k(!1)}},[r]);a.useEffect(()=>{H()},[H]);const L=g.trim().toLowerCase(),U=a.useMemo(()=>L?u.ordered.filter(({connector:t})=>{var s;return t.name.toLowerCase().includes(L)||(((s=t.description)==null?void 0:s.toLowerCase().includes(L))??!1)||t.url.toLowerCase().includes(L)}):u.ordered,[u.ordered,L]),K=a.useMemo(()=>{const t=[];for(const s of U)if(s.isConfigured){const m=u.authStatusById.get(s.connector.id)??s.connector.authenticated;t.push(m===s.connector.authenticated?s.connector:{...s.connector,authenticated:m})}return t},[u.authStatusById,U]),Q=a.useMemo(()=>{const t=[];for(const s of U)s.isConfigured||t.push(s.connector);return t},[U]),B=async(t,s=N)=>{C(!0),N(null);try{await t(),await H()}catch(m){throw s(G(m,"Request failed")),m}finally{C(!1)}},te=()=>{R(null),ee(""),o(null)},ne=async(t,s)=>{const m=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:m})},he=t=>{if(t.auth.type==="header"){ee(""),o(null),R(t);return}B(async()=>{await ne(t)}).catch(()=>{})},pe=t=>{if(t.preventDefault(),!d||!_.trim())return;const s=d;o(null),B(async()=>{const m={type:"header",apiKey:_.trim(),...s.auth.type==="header"&&s.auth.headerName?{headerName:s.auth.headerName}:{}};await ne(s,m),te(),setTimeout(()=>{f==null||f.showSuccess({title:`${s.name} connected`})},100)},o).catch(()=>{})},le=async t=>{o(null),await B(async()=>{i?await r.updateConnector({id:i.id,...t}):await r.createConnector({...t})},o),setTimeout(()=>{f==null||f.showSuccess({title:`${t.name} ${i?"updated":"added"}`})},0)},fe=t=>{B(async()=>{await r.disconnectConnector({id:t.id}),l(null)}).catch(()=>{})},be=()=>{c||(q(null),D(null))},ge=t=>{const s=r.deleteConnector;s&&(D(null),B(async()=>{await s({id:t.id}),q(null),l(null)},D).catch(()=>{}))},ye=t=>{l(s=>(s==null?void 0:s.id)===t.id?t:s),h(s=>{const m=new Map(s.authStatusById);return m.set(t.id,t.authenticated),{ordered:s.ordered.map(P=>P.isConfigured&&P.connector.id===t.id?{connector:t,isConfigured:!0}:P),authStatusById:m}})},ve=(t,s)=>{const m=re[t.name],P=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:m?e.jsx(de,{src:m,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})]})]}),Y="flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0",x=t.auth.type==="dcr"&&!t.authenticated,W=n&&Z===t.id;return e.jsxs("article",{className:`${Y} cursor-pointer transition-colors hover:bg-ghost-button-hover/60`,onClick:()=>{l(t)},children:[e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:P}),e.jsxs("div",{className:"flex items-center gap-2",children:[x?e.jsx(j.Secondary,{size:"small",type:"button",disabled:c||W,onClick:T=>{T.stopPropagation(),ae(t.id),y(t.id,Ce=>{ae(null),Ce&&H()})},children:W?"Connecting…":"Connect"}):null,e.jsxs(j.Secondary,{size:"small",type:"button",disabled:c,onClick:T=>{T.stopPropagation(),o(null),S(t),A(!0)},children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.deleteConnector?e.jsx(j.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:c,"aria-label":`Remove ${t.name}`,onClick:T=>{T.stopPropagation(),D(null),q(t)},children:"Remove"}):null,e.jsx(w,{name:"chevron-right",className:"size-4"})]})]},t.id)},je=t=>{const s=re[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(de,{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:X[t.auth.type]??X.none}),e.jsx(j.Secondary,{size:"small",type:"button",disabled:c,onClick:()=>{he(t)},children:t.auth.type==="dcr"?"Add":"Connect"})]})]},t.id)},ie=J?e.jsx(Se,{title:"Remove connector?",description:`“${J.name}” will no longer be available to your agents.`,busy:c,error:xe,onCancel:be,onConfirm:()=>{ge(J)}}):null;if(I)return e.jsxs(e.Fragment,{children:[e.jsx(Me,{connector:I,busy:c,onBack:()=>{l(null)},onConnectorRefreshed:ye,onEdit:()=>{o(null),S(I),A(!0)},onDisconnect:()=>{fe(I)},onRemove:r.deleteConnector?()=>{D(null),q(I)}:void 0}),e.jsx(oe,{open:v,onOpenChange:t=>{A(t),t||(S(null),o(null))},onSubmit:le,connector:i??void 0,busy:c,error:b}),ie]});const Ne=K.length>0||Q.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."}),z?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:z}):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(ke,{query:g,setQuery:E,placeholder:"Search connectors"})}),e.jsxs(j.Secondary,{type:"button",className:"shrink-0",onClick:()=>{o(null),S(null),A(!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:[p?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!p&&K.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 · ",K.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:K.map(t=>ve(t))})]}):null,!p&&Q.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 · ",Q.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:Q.map(t=>je(t))})]}):null,!p&&!Ne?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(ue,{open:d!==null,onOpenChange:t=>{t||te()},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:pe,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:_,onChange:t=>{ee(t.target.value)},placeholder:`Bearer <Paste the token from ${(d==null?void 0:d.name)??"the provider"}>`,autoFocus:!0,required:!0,className:V("h-11")})]}),b?e.jsx("p",{className:"text-failure-bg text-sm",children:b}):null]}),e.jsxs("footer",{className:"flex justify-end gap-2 border-t border-border px-5 py-4",children:[e.jsx(j.Ghost,{type:"button",onClick:te,disabled:c,children:"Cancel"}),e.jsx(j.Primary,{type:"submit",disabled:!_.trim()||c,children:"Connect"})]})]})}),e.jsx(oe,{open:v,onOpenChange:t=>{A(t),t||(S(null),o(null))},onSubmit:le,connector:i??void 0,busy:c,error:b}),ie]})})]})},De=Ie;export{De as default};
|
|
Binary file
|
|
Binary file
|
package/dist/_frontend/assets/{DockLayout-ELMFMPFZ-CKI3C0ch.js → DockLayout-ELMFMPFZ-64HWC5vP.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as a}from"./chunk-X2GIDKWH-
|
|
1
|
+
import{S as a}from"./chunk-X2GIDKWH-CMjGi2n8.js";import{j as o,C as t,g as l}from"./index-D6YKMpJU.js";import"./chunk-RO36YFVR-D08M8Asc.js";function n({className:r}){return o.jsx(t,{children:o.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)]",r),children:o.jsx(a,{})})})}export{n as DockLayout};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-OU3B7YHU-
|
|
2
|
-
import{u as z,b as T,c as R,d as t,r as a,e as V,s as F,j as s,P as M,I as x,f as g,S as f,D as H,g as U,_ as j}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-OU3B7YHU-DYpXgbEN.js","./index-D6YKMpJU.js","./index-B01pXqvC.css","./SchedulesPage-UNS7BDS6-CjgOxBTD.js","./chunk-EGUH4WJX-SANPGRqh.js","./EnvironmentsPage-YV2D2VMM-DlNlyfm2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as z,b as T,c as R,d as t,r as a,e as V,s as F,j as s,P as M,I as x,f as g,S as f,D as H,g as U,_ as j}from"./index-D6YKMpJU.js";import{A as q,S as G,N as J,T as K}from"./chunk-RO36YFVR-D08M8Asc.js";var Q=a.lazy(()=>j(()=>import("./SettingsBuilder-OU3B7YHU-DYpXgbEN.js"),__vite__mapDeps([0,1,2]),import.meta.url)),W=a.lazy(()=>j(()=>import("./SchedulesPage-UNS7BDS6-CjgOxBTD.js"),__vite__mapDeps([3,4,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),X=a.lazy(()=>j(()=>import("./EnvironmentsPage-YV2D2VMM-DlNlyfm2.js"),__vite__mapDeps([5,4,1,2]),import.meta.url).then(n=>({default:n.EnvironmentsPage})));function $({className:n}){const y=z(),e=T(),u=R(),v=t("ClearChatButton"),A=t("AgentDetailsPage"),N=t("AgentsLibrary"),h=t("SessionsPage"),C=t("ShareChatButton"),O=t("SaveAgentButton"),S=t("SelectAgentEmptyState"),w=t("UserAvatar"),E=a.useRef(null),_=(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=V(),p=e!=null&&F(e.mode),i=u&&(m||o||c||p&&!d&&!r),L=p&&!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(()=>{})},B=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()},D=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSchedulesOpen(!1),e==null||e.setSessionsOpen(!1),e==null||e.setEnvironmentsOpen(!1),i&&p&&(e==null||e.openDraft())},I=i||r||o||c;return s.jsxs("div",{className:U("relative flex h-full min-h-0 w-full bg-primary-bg",n),children:[L?s.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:s.jsx(q,{})}):null,s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[s.jsx(M,{className:"bg-topbar-bg",title:I?s.jsxs("button",{type:"button",className:g({variant:"ghost",size:"small"}),onClick:D,children:[s.jsx(x,{name:"arrow-left"}),"Back to chat"]}):l?null:s.jsx(J,{}),end:s.jsxs(s.Fragment,{children:[!l&&!i?s.jsxs(s.Fragment,{children:[s.jsx(C,{}),s.jsx(v,{}),s.jsx(O,{})]}):null,s.jsx(G,{},"shell-actions"),s.jsx(w,{}),!l&&!i?s.jsxs(s.Fragment,{children:[b&&!P?s.jsx("button",{type:"button","aria-label":"New Chat",title:"New Chat",className:g({variant:"ghost",size:"icon"}),onClick:k,children:s.jsx(x,{name:"square-pen"})}):null,b&&(e!=null&&e.isComposerEnabled)&&!u?s.jsx("button",{type:"button","aria-label":"New Agent",title:"New Agent",className:g({variant:"ghost",size:"icon"}),onClick:B,children:s.jsx(x,{name:"agent-2"})}):null]}):null]})}),s.jsx("div",{ref:E,className:"min-h-0 min-w-0 flex-1",children:d?s.jsx(a.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(f,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(Q,{})}):i?s.jsx(H,{}):m?s.jsx(h,{}):r&&(e==null?void 0:e.libraryAgentId)!=null?s.jsx(A,{agentId:e.libraryAgentId},e.libraryAgentId):r?s.jsx(N,{}):o?s.jsx(a.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(f,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(W,{})}):c?s.jsx(a.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(f,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(X,{})}):_?s.jsx(S,{}):s.jsx(K,{})})]})]})}export{$ as DrawerLayout};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as tn}from"./chunk-EGUH4WJX-
|
|
1
|
+
import{B as tn}from"./chunk-EGUH4WJX-SANPGRqh.js";import{cG as os,b as sn,t as as,r as L,cH as Ye,aY as At,cI as qt,cJ as Ut,j as d,P as nn,Y as rn,a0 as re,I as Qe,a1 as on,a2 as Vt,cK as an,a4 as ln,a5 as cn,a6 as Yt,a7 as ce,a8 as fn,a9 as fe,O as ls,ar as un,f as yt,a3 as hn,ab as cs,ac as fs,ad as us,ae as hs,af as ds,ag as dn,am as mn,cL as pn,g as ge,cM as gn}from"./index-D6YKMpJU.js";const vt=Symbol.for("yaml.alias"),bt=Symbol.for("yaml.document"),se=Symbol.for("yaml.map"),ms=Symbol.for("yaml.pair"),z=Symbol.for("yaml.scalar"),Se=Symbol.for("yaml.seq"),H=Symbol.for("yaml.node.type"),Ne=s=>!!s&&typeof s=="object"&&s[H]===vt,$e=s=>!!s&&typeof s=="object"&&s[H]===bt,_e=s=>!!s&&typeof s=="object"&&s[H]===se,B=s=>!!s&&typeof s=="object"&&s[H]===ms,x=s=>!!s&&typeof s=="object"&&s[H]===z,Be=s=>!!s&&typeof s=="object"&&s[H]===Se;function $(s){if(s&&typeof s=="object")switch(s[H]){case se:case Se:return!0}return!1}function _(s){if(s&&typeof s=="object")switch(s[H]){case vt:case se:case z:case Se:return!0}return!1}const ps=s=>(x(s)||$(s))&&!!s.anchor,ie=Symbol("break visit"),yn=Symbol("skip children"),Le=Symbol("remove node");function Ee(s,e){const t=bn(e);$e(s)?de(null,s.contents,t,Object.freeze([s]))===Le&&(s.contents=null):de(null,s,t,Object.freeze([]))}Ee.BREAK=ie;Ee.SKIP=yn;Ee.REMOVE=Le;function de(s,e,t,n){const i=wn(s,e,t,n);if(_(i)||B(i))return kn(s,n,i),de(s,i,t,n);if(typeof i!="symbol"){if($(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=de(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===ie)return ie;o===Le&&(e.items.splice(r,1),r-=1)}}}else if(B(e)){n=Object.freeze(n.concat(e));const r=de("key",e.key,t,n);if(r===ie)return ie;r===Le&&(e.key=null);const o=de("value",e.value,t,n);if(o===ie)return ie;o===Le&&(e.value=null)}}return i}function bn(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function wn(s,e,t,n){var i,r,o,a,l;if(typeof t=="function")return t(s,e,n);if(_e(e))return(i=t.Map)==null?void 0:i.call(t,s,e,n);if(Be(e))return(r=t.Seq)==null?void 0:r.call(t,s,e,n);if(B(e))return(o=t.Pair)==null?void 0:o.call(t,s,e,n);if(x(e))return(a=t.Scalar)==null?void 0:a.call(t,s,e,n);if(Ne(e))return(l=t.Alias)==null?void 0:l.call(t,s,e,n)}function kn(s,e,t){const n=e[e.length-1];if($(n))n.items[s]=t;else if(B(n))s==="key"?n.key=t:n.value=t;else if($e(n))n.contents=t;else{const i=Ne(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const Sn={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Nn=s=>s.replace(/[!,[\]{}]/g,e=>Sn[e]);class q{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},q.defaultYaml,e),this.tags=Object.assign({},q.defaultTags,t)}clone(){const e=new q(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new q(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:q.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},q.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:q.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},q.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Nn(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&_(e.contents)){const r={};Ee(e.contents,(o,a)=>{_(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
2
2
|
`)}}q.defaultYaml={explicit:!1,version:"1.2"};q.defaultTags={"!!":"tag:yaml.org,2002:"};function gs(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function ys(s){const e=new Set;return Ee(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function bs(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function En(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i??(i=ys(s));const o=bs(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(x(o.node)||$(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}function me(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],a=me(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=me(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(const i of Array.from(n)){const r=me(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const o=me(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}function G(s,e,t){if(Array.isArray(s))return s.map((n,i)=>G(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!ps(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!(t!=null&&t.keep)?Number(s):s}class Ot{constructor(e){Object.defineProperty(this,H,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!$e(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=G(this,"",o);if(typeof i=="function")for(const{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?me(r,{"":a},"",a):a}}class Tt extends Ot{constructor(e){super(vt),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if((t==null?void 0:t.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let n;t!=null&&t.aliasResolveCache?n=t.aliasResolveCache:(n=[],Ee(e,{Node:(r,o)=>{(Ne(o)||ps(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(const r of n){if(r===this)break;r.anchor===this.source&&(i=r)}if(i&&t){const{anchors:r,doc:o,maxAliasCount:a}=t;let l=r.get(i);if(l||(G(i,null,t),l=r.get(i)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Je(o,i,r)),l.count*l.aliasCount>a)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}}return i}toJSON(e,t){if(!t)return{source:this.source};const n=this.resolve(t.doc,t);if(!n){const i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return t.anchors.get(n).res}toString(e,t,n){const i=`*${this.source}`;if(e){if(gs(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function Je(s,e,t){if(Ne(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if($(e)){let n=0;for(const i of e.items){const r=Je(s,i,t);r>n&&(n=r)}return n}else if(B(e)){const n=Je(s,e.key,t),i=Je(s,e.value,t);return Math.max(n,i)}return 1}const ws=s=>!s||typeof s!="function"&&typeof s!="object";class O extends Ot{constructor(e){super(z),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:G(this.value,e,t)}toString(){return String(this.value)}}O.BLOCK_FOLDED="BLOCK_FOLDED";O.BLOCK_LITERAL="BLOCK_LITERAL";O.PLAIN="PLAIN";O.QUOTE_DOUBLE="QUOTE_DOUBLE";O.QUOTE_SINGLE="QUOTE_SINGLE";const An="tag:yaml.org,2002:";function vn(s,e,t){if(e){const n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>{var i;return((i=n.identify)==null?void 0:i.call(n,s))&&!n.format})}function xe(s,e,t){var f,p,h;if($e(s)&&(s=s.contents),_(s))return s;if(B(s)){const y=(p=(f=t.schema[se]).createNode)==null?void 0:p.call(f,t.schema,null,t);return y.items.push(s),y}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t;let l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=i(s)),new Tt(l.anchor);l={anchor:null,node:null},a.set(s,l)}e!=null&&e.startsWith("!!")&&(e=An+e.slice(2));let c=vn(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const y=new O(s);return l&&(l.node=y),y}c=s instanceof Map?o[se]:Symbol.iterator in Object(s)?o[Se]:o[se]}r&&(r(c),delete t.onTagObj);const m=c!=null&&c.createNode?c.createNode(t.schema,s,t):typeof((h=c==null?void 0:c.nodeClass)==null?void 0:h.from)=="function"?c.nodeClass.from(t.schema,s,t):new O(s);return e?m.tag=e:c.default||(m.tag=c.tag),l&&(l.node=m),m}function We(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return xe(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const Te=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class ks extends Ot{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>_(n)||B(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Te(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if($(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,We(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if($(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&x(r)?r.value:r:$(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!B(t))return!1;const n=t.value;return n==null||e&&x(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return $(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if($(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,We(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}const On=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function X(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const oe=(s,e,t)=>s.endsWith(`
|
|
3
3
|
`)?X(t,e):t.includes(`
|
|
4
4
|
`)?`
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as je}from"./chunk-C5376XWU-3UMp6mV3.js";import{aX as Ne,t as we,r as o,aY as Z,j as e,Y as Ce,a0 as H,I as O,aZ as be,a_ as ye,a$ as ke,b0 as Ee,g as z,b1 as Se,ap as Me}from"./index-BvpV5jNz.js";var fe=Me("h-11 shadow-sm"),Ue=({open:a,onOpenChange:l,onSave:f,title:E,description:h,initialBaseUrl:S="",baseUrlPlaceholder:d="https://api.openai.com/v1",requireApiKey:i=!0,submitLabel:M="Save",busy:I=!1,error:A})=>{const[U,B]=o.useState(""),[y,x]=o.useState(""),[k,D]=o.useState(!1),T=()=>{B(""),x(""),D(!1)};o.useEffect(()=>{a&&(B(""),x(S),D(!1))},[a,S]);const W=u=>{u||T(),l(u)},P=U.trim(),J=!i||!!P,j=async u=>{if(u.preventDefault(),!(!J||I))try{await f({apiKey:P,baseUrl:y.trim()}),T(),l(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:W,title:E,description:h,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",i?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"model-provider-api-key",type:"password",required:i,value:U,onChange:u=>{B(u.target.value)},placeholder:i?"Enter API key":"Enter a new key",autoFocus:!0,className:fe}),i?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(ke,{expanded:k,onChange:(u,X)=>D(X),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 · custom endpoint",e.jsx(O,{name:"chevron-down",className:z("size-4 shrink-0 text-text-secondary transition-transform duration-200",k?"rotate-0":"-rotate-90")})]})}),e.jsxs(Se,{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:y,onChange:u=>{x(u.target.value)},placeholder:d,className:fe}),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:[A?e.jsx("p",{className:"text-failure-bg text-sm",children:A}):null,e.jsx(H.Primary,{type:"submit",size:"large",disabled:!J||I,className:"w-full shrink-0",children:M})]})]})})},Te=Ue,Pe="128000",Le="4096",ge=()=>({id:"",name:"",advancedExpanded:!0,contextLength:"",maxOutputTokens:""}),ve=a=>(a==null?void 0:a.models.map(l=>{var f,E,h,S,d;return{id:l.id,name:l.name,advancedExpanded:!0,reasoningEfforts:(f=l.properties)==null?void 0:f.reasoningEfforts,contextLength:((h=(E=l.properties)==null?void 0:E.contextLength)==null?void 0:h.toString())??"",maxOutputTokens:((d=(S=l.properties)==null?void 0:S.maxOutputTokens)==null?void 0:d.toString())??"",nameDirty:!0}}))??[ge()],G="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 ue(a){const l=a.trim();if(l==="")return null;const f=Number(l);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 de=()=>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}),ie=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:a}),Re=({open:a,onOpenChange:l,onSubmit:f,reasoningEffortOptions:E,busy:h=!1,error:S,isEditMode:d=!1,initialValues:i})=>{const[M,I]=o.useState((i==null?void 0:i.name)??""),[A,U]=o.useState((i==null?void 0:i.baseUrl)??""),[B,y]=o.useState(""),[x,k]=o.useState(()=>ve(i)),[D,T]=o.useState(!1),[W,P]=o.useState(!1),J=()=>{I((i==null?void 0:i.name)??""),U((i==null?void 0:i.baseUrl)??""),y(""),k(ve(i)),T(!1),P(!1)},j=s=>{s||J(),l(s)},u=(s,r)=>{k(b=>b.map((c,w)=>w===s?{...c,...r}:c))},X=()=>{T(!0),P(!0),k(s=>s.map(r=>({...r,idTouched:!0,contextTouched:!0,maxTouched:!0})))},v=M.trim(),Q=v?null:"Name is required.",L=A.trim();let $=null;if(!L)$="Base URL is required.";else try{new URL(L)}catch{$="Enter a valid URL."}const ce=s=>s.id.trim()?null:"Model ID is required.",K=s=>s.name.trim()?null:"Model name is required.",V=s=>ue(s.contextLength)==null?"Set the model's context window.":null,N=s=>ue(s.maxOutputTokens)==null?"Set the max output tokens.":null,ee=!Q&&!$&&x.every(s=>!ce(s)&&!K(s)),te=D&&Q,Y=W&&$,ae=async()=>{if(X(),!ee||h)return;const s=x.findIndex(r=>V(r)||N(r));if(s!==-1){u(s,{advancedExpanded:!0});const r=x[s],b=r&&V(r)?"context-length":"max-output-tokens";setTimeout(()=>{var w;const c=document.getElementById(`custom-provider-model-${s}-${b}`);(w=c==null?void 0:c.scrollIntoView)==null||w.call(c,{block:"center",behavior:"smooth"}),c==null||c.focus()},0);return}try{await f({name:v,baseUrl:L,apiKey:B.trim(),models:x.map(r=>{var _;const b={};(_=r.reasoningEfforts)!=null&&_.length&&(b.reasoningEfforts=r.reasoningEfforts);const c=ue(r.contextLength);c!=null&&(b.contextLength=c);const w=ue(r.maxOutputTokens);return w!=null&&(b.maxOutputTokens=w),{id:r.id.trim(),name:r.name.trim(),...Object.keys(b).length>0?{properties:b}:{}}})}),j(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:j,title:d?`Edit ${(i==null?void 0:i.name)??M}`:"Add custom provider",description:d?"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(),ae()},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(de,{})]}),e.jsx("input",{id:"custom-provider-name",type:"text",value:M,onChange:s=>I(s.target.value),onBlur:()=>T(!0),placeholder:"local-llama",autoFocus:!d,readOnly:d,"aria-readonly":d,"aria-invalid":te?!0:void 0,className:z(G,d&&"cursor-not-allowed bg-secondary-bg/60 text-text-secondary",te&&se)}),d?e.jsx(ie,{children:"Provider names cannot be changed after creation."}):null,te?e.jsx(re,{children:Q}):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(de,{})]}),e.jsx("input",{id:"custom-provider-base-url",type:"text",value:A,onChange:s=>U(s.target.value),onBlur:()=>P(!0),placeholder:"http://localhost:11434/v1",autoFocus:d,"aria-invalid":Y?!0:void 0,className:z(G,Y&&se)}),Y?e.jsx(re,{children:$}):L?null:e.jsx(ie,{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:B,onChange:s=>y(s.target.value),placeholder:"sk-…",className:G}),e.jsx(ie,{children:d?"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(de,{})]}),e.jsx("div",{className:"clear-both",children:x.map((s,r)=>{const b=ce(s),c=s.idTouched&&b,w=K(s),_=!!w&&s.nameDirty,me=V(s),ne=N(s),oe=s.contextTouched&&me,le=s.maxTouched&≠return e.jsxs("div",{className:z("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:p=>{const F=p.target.value;u(r,{id:F,...s.nameDirty?{}:{name:$e(F)}})},onBlur:()=>u(r,{idTouched:!0}),placeholder:"llama3.1:70b","aria-invalid":c?!0:void 0,className:z(G,"font-mono",c&&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:p=>u(r,{name:p.target.value,nameDirty:!0}),placeholder:"llama-3-1-70b","aria-invalid":_?!0:void 0,className:z(G,_&&se)})]}),e.jsx("button",{type:"button","aria-label":`Remove model ${r+1}`,disabled:x.length===1||h,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:()=>k(p=>p.filter((F,g)=>g!==r)),children:e.jsx(O,{name:"trash",className:"size-4"})})]}),c?e.jsx(re,{children:b}):null,_?e.jsx(re,{children:w}):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:()=>u(r,{advancedExpanded:!s.advancedExpanded}),children:[e.jsx(O,{name:"chevron-down",className:z("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(de,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-context-length`,type:"number",min:1,inputMode:"numeric",value:s.contextLength,onChange:p=>u(r,{contextLength:p.target.value}),onBlur:()=>u(r,{contextTouched:!0}),placeholder:Pe,"aria-invalid":oe?!0:void 0,className:z(G,oe&&se)}),oe?e.jsx(re,{children:me}):s.contextLength.trim()===""?e.jsx(ie,{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(de,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-max-output-tokens`,type:"number",min:1,inputMode:"numeric",value:s.maxOutputTokens,onChange:p=>u(r,{maxOutputTokens:p.target.value}),onBlur:()=>u(r,{maxTouched:!0}),placeholder:Le,"aria-invalid":le?!0:void 0,className:z(G,le&&se)}),le?e.jsx(re,{children:ne}):s.maxOutputTokens.trim()===""?e.jsx(ie,{children:"Longest reply the model allows — use its real limit."}):null]}),E&&E.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:h,onChange:p=>u(r,{reasoningEfforts:p.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:E.map(p=>{var g;const F=((g=s.reasoningEfforts)==null?void 0:g.includes(p))??!1;return e.jsx("button",{type:"button","aria-pressed":F,disabled:h,className:z("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",F?"border-primary-button-bg bg-primary-button-bg text-primary-button-text":"border-border text-text-secondary hover:bg-ghost-button-hover"),onClick:()=>{var q;return u(r,{reasoningEfforts:F?(q=s.reasoningEfforts)==null?void 0:q.filter(xe=>xe!==p):[...s.reasoningEfforts??[],p]})},children:p},p)})}):null]}):null]}):null]})]},r)})}),e.jsxs(H.Secondary,{size:"small",type:"button",className:"mt-4 w-fit",onClick:()=>k(s=>[...s,ge()]),children:[e.jsx(O,{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:[S?e.jsx("p",{className:"text-failure-bg text-sm",children:S}):null,e.jsx(H.Primary,{type:"submit",size:"large",disabled:!ee||h,className:"w-full",children:d?"Save changes":"Add provider"})]})]})})},ze=Re;function pe(a){return a.kind==="model"&&a.provider.models.length===1}function Oe(a){return a.kind==="provider"?`“${a.provider.name}” and all of its models will no longer be available to your agents.`:pe(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 Fe(a){return"baseUrl"in a&&typeof a.baseUrl=="string"?a.baseUrl:""}var Ie=()=>{const{modelCatalog:a}=Ne(),l=we(),[f,E]=o.useState(""),[h,S]=o.useState([]),[d,i]=o.useState([]),[M,I]=o.useState(!0),[A,U]=o.useState(null),[B,y]=o.useState(null),[x,k]=o.useState(!1),[D,T]=o.useState(null),[W,P]=o.useState(null),[J,j]=o.useState(null),[u,X]=o.useState(!1),[v,Q]=o.useState(null),[L,$]=o.useState(null),[ce,K]=o.useState(null),V=o.useMemo(()=>(d??[]).reduce((t,n)=>(t[n.name]=n.logo??"",t),{}),[d]),N=f.trim().toLowerCase(),ee=o.useCallback(async()=>{I(!0),U(null);try{const[t,n]=await Promise.all([a.listModelProviders(),a.getModelProviderCatalog()]);S(t),i(n)}catch(t){U(Z(t,"Failed to load model providers"))}finally{I(!1)}},[a]);o.useEffect(()=>{ee()},[ee]);const te=o.useMemo(()=>new Set(h.map(t=>t.type)),[h]),Y=o.useMemo(()=>h.filter(t=>{var n;return((n=t.name)==null?void 0:n.toLowerCase().includes(N))||t.models.some(m=>m.name.toLowerCase().includes(N)||m.id.toLowerCase().includes(N))}),[h,N]),ae=o.useMemo(()=>d.filter(t=>t.type!=="custom"&&!te.has(t.type)&&(t.name.toLowerCase().includes(N)||t.models.some(n=>n.name.toLowerCase().includes(N)||n.id.toLowerCase().includes(N)))),[d,te,N]),s=o.useMemo(()=>{var t;return(t=d.find(n=>n.type==="custom"))==null?void 0:t.supportedReasoningEfforts},[d]),r=o.useMemo(()=>{const t=new Map;for(const n of d)t.set(n.type,n.models);return t},[d]),b=()=>{T(null),P(null),j(null)},c=async(t,n)=>{k(!0),U(null);try{await t(),await ee(),b()}catch(m){throw n?n(m):l==null?U(Z(m,"Request failed")):l.showError(m),m}finally{k(!1)}},w=async(t,n)=>{j(null),await c(async()=>{await a.createModelProvider({type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},m=>j(Z(m,"Request failed")))},_=async(t,n)=>{j(null),await c(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},m=>j(Z(m,"Request failed"))),l==null||l.showSuccess({title:`${t.name} updated`})},me=()=>{x||($(null),K(null))},ne=({provider:t,models:n},m)=>c(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...t.baseUrl?{baseUrl:t.baseUrl}:{},apiKey:"",models:n})},m),oe=t=>{K(null);const n=R=>K(Z(R,"Request failed"));let m;if(t.kind==="model"&&!pe(t))m=ne({provider:t.provider,models:t.provider.models.filter(R=>R.id!==t.model.id)},n);else{const R=a.deleteModelProvider;R!==void 0&&(m=c(async()=>{await R({id:t.provider.id})},n))}m==null||m.then(()=>$(null)).catch(()=>{})},le=async t=>{y(null),await c(async()=>{await a.createModelProvider({type:"custom",name:t.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},n=>y(Z(n,"Request failed"))),setTimeout(()=>{l==null||l.showSuccess({title:`${t.name} added`})},0)},p=async t=>{if(!v)return;const n=v;y(null),await c(async()=>{await a.updateModelProvider({id:n.id,type:n.type,name:n.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},m=>y(Z(m,"Request failed"))),setTimeout(()=>{l==null||l.showSuccess({title:"Model provider updated",description:`${n.name} was updated successfully.`})},0)},F=v?{name:v.name,baseUrl:v.baseUrl??"",models:v.models}:void 0,g=D!=null?h.find(t=>t.id===D)??null:null,q=W!=null?d.find(t=>t.type===W)??null:null,xe=g!=null||q!=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(Ce,{query:f,setQuery:E,placeholder:"Search providers and models"})}),e.jsxs(H.Secondary,{type:"button",className:"shrink-0 sm:self-auto",onClick:()=>{y(null),Q(null),X(!0)},children:[e.jsx(O,{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&&Y.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:Y.map(t=>{const n=r.get(t.type)??[],m=new Set(t.models.map(C=>C.id)),R=n.filter(C=>!m.has(C.id)),he=V[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:he?e.jsx(be,{src:he,alt:t.name,className:"size-4.5"}):e.jsx(O,{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(H.Secondary,{size:"small",className:"text-[0.8125rem]",type:"button","aria-label":`Edit ${t.name}`,title:`Edit ${t.name}`,disabled:x,onClick:()=>{t.type==="custom"?(b(),y(null),Q(t),X(!0)):(j(null),P(null),T(t.id))},children:[e.jsx(O,{name:"pencil",className:"size-3.5"}),"Edit"]}),a.deleteModelProvider?e.jsx(H.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:x,onClick:()=>{K(null),$({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:x,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:()=>{K(null),$({kind:"model",provider:t,model:C})},children:e.jsx(O,{name:"trash",className:"size-3.5"})}):null]},C.id)),R.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 · ",R.length]}),R.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(H.Secondary,{size:"small",type:"button",disabled:x,onClick:()=>{ne({provider:t,models:[...t.models,C]}).catch(()=>{})},children:"Add"})]},C.id))]}):null]})]},t.id)})})]}):null,!M&&ae.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:ae.map(t=>{const n=V[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(be,{src:n,alt:t.name,className:"size-4.5"}):e.jsx(O,{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(m=>m.name).join(" · ")})]})]}),e.jsxs(H.Secondary,{type:"button",disabled:x,onClick:()=>{j(null),T(null),P(t.type)},children:[e.jsx(O,{name:"wrench",className:"size-4"}),"Configure"]})]})},t.type)})})]}):null,!M&&Y.length===0&&ae.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:N?`No providers match “${f.trim()}”.`:"No model providers yet."}):null]}),L?e.jsx(je,{title:L.kind==="model"&&!pe(L)?"Remove model?":"Remove provider?",description:Oe(L),busy:x,error:ce,onCancel:me,onConfirm:()=>{oe(L)}}):null,e.jsx(Te,{open:xe,onOpenChange:t=>{t||b()},onSave:t=>{if(g)return _(g,t);if(q)return w(q,t)},title:g?"Edit Provider Details":"Configure Provider Details",initialBaseUrl:g?g.baseUrl??"":q?Fe(q):"",requireApiKey:g==null,submitLabel:g?"Save":"Create",busy:x,error:J}),e.jsx(ze,{open:u,onOpenChange:t=>{X(t),t||(y(null),Q(null))},isEditMode:v!==null,initialValues:F,onSubmit:v?p:le,reasoningEffortOptions:s,busy:x,error:B},(v==null?void 0:v.id)??"add-custom-provider")]})})]})},De=Ie;export{De as default};
|
|
1
|
+
import{C as je}from"./chunk-C5376XWU-CUgFlwPN.js";import{aX as Ne,t as we,r as o,aY as Z,j as e,Y as Ce,a0 as H,I as O,aZ as be,a_ as ye,a$ as ke,b0 as Ee,g as z,b1 as Se,ap as Me}from"./index-D6YKMpJU.js";var fe=Me("h-11 shadow-sm"),Ue=({open:a,onOpenChange:l,onSave:f,title:E,description:h,initialBaseUrl:S="",baseUrlPlaceholder:d="https://api.openai.com/v1",requireApiKey:i=!0,submitLabel:M="Save",busy:I=!1,error:A})=>{const[U,B]=o.useState(""),[y,x]=o.useState(""),[k,D]=o.useState(!1),T=()=>{B(""),x(""),D(!1)};o.useEffect(()=>{a&&(B(""),x(S),D(!1))},[a,S]);const W=u=>{u||T(),l(u)},P=U.trim(),J=!i||!!P,j=async u=>{if(u.preventDefault(),!(!J||I))try{await f({apiKey:P,baseUrl:y.trim()}),T(),l(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:W,title:E,description:h,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",i?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"model-provider-api-key",type:"password",required:i,value:U,onChange:u=>{B(u.target.value)},placeholder:i?"Enter API key":"Enter a new key",autoFocus:!0,className:fe}),i?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(ke,{expanded:k,onChange:(u,X)=>D(X),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 · custom endpoint",e.jsx(O,{name:"chevron-down",className:z("size-4 shrink-0 text-text-secondary transition-transform duration-200",k?"rotate-0":"-rotate-90")})]})}),e.jsxs(Se,{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:y,onChange:u=>{x(u.target.value)},placeholder:d,className:fe}),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:[A?e.jsx("p",{className:"text-failure-bg text-sm",children:A}):null,e.jsx(H.Primary,{type:"submit",size:"large",disabled:!J||I,className:"w-full shrink-0",children:M})]})]})})},Te=Ue,Pe="128000",Le="4096",ge=()=>({id:"",name:"",advancedExpanded:!0,contextLength:"",maxOutputTokens:""}),ve=a=>(a==null?void 0:a.models.map(l=>{var f,E,h,S,d;return{id:l.id,name:l.name,advancedExpanded:!0,reasoningEfforts:(f=l.properties)==null?void 0:f.reasoningEfforts,contextLength:((h=(E=l.properties)==null?void 0:E.contextLength)==null?void 0:h.toString())??"",maxOutputTokens:((d=(S=l.properties)==null?void 0:S.maxOutputTokens)==null?void 0:d.toString())??"",nameDirty:!0}}))??[ge()],G="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 ue(a){const l=a.trim();if(l==="")return null;const f=Number(l);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 de=()=>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}),ie=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:a}),Re=({open:a,onOpenChange:l,onSubmit:f,reasoningEffortOptions:E,busy:h=!1,error:S,isEditMode:d=!1,initialValues:i})=>{const[M,I]=o.useState((i==null?void 0:i.name)??""),[A,U]=o.useState((i==null?void 0:i.baseUrl)??""),[B,y]=o.useState(""),[x,k]=o.useState(()=>ve(i)),[D,T]=o.useState(!1),[W,P]=o.useState(!1),J=()=>{I((i==null?void 0:i.name)??""),U((i==null?void 0:i.baseUrl)??""),y(""),k(ve(i)),T(!1),P(!1)},j=s=>{s||J(),l(s)},u=(s,r)=>{k(b=>b.map((c,w)=>w===s?{...c,...r}:c))},X=()=>{T(!0),P(!0),k(s=>s.map(r=>({...r,idTouched:!0,contextTouched:!0,maxTouched:!0})))},v=M.trim(),Q=v?null:"Name is required.",L=A.trim();let $=null;if(!L)$="Base URL is required.";else try{new URL(L)}catch{$="Enter a valid URL."}const ce=s=>s.id.trim()?null:"Model ID is required.",K=s=>s.name.trim()?null:"Model name is required.",V=s=>ue(s.contextLength)==null?"Set the model's context window.":null,N=s=>ue(s.maxOutputTokens)==null?"Set the max output tokens.":null,ee=!Q&&!$&&x.every(s=>!ce(s)&&!K(s)),te=D&&Q,Y=W&&$,ae=async()=>{if(X(),!ee||h)return;const s=x.findIndex(r=>V(r)||N(r));if(s!==-1){u(s,{advancedExpanded:!0});const r=x[s],b=r&&V(r)?"context-length":"max-output-tokens";setTimeout(()=>{var w;const c=document.getElementById(`custom-provider-model-${s}-${b}`);(w=c==null?void 0:c.scrollIntoView)==null||w.call(c,{block:"center",behavior:"smooth"}),c==null||c.focus()},0);return}try{await f({name:v,baseUrl:L,apiKey:B.trim(),models:x.map(r=>{var _;const b={};(_=r.reasoningEfforts)!=null&&_.length&&(b.reasoningEfforts=r.reasoningEfforts);const c=ue(r.contextLength);c!=null&&(b.contextLength=c);const w=ue(r.maxOutputTokens);return w!=null&&(b.maxOutputTokens=w),{id:r.id.trim(),name:r.name.trim(),...Object.keys(b).length>0?{properties:b}:{}}})}),j(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:j,title:d?`Edit ${(i==null?void 0:i.name)??M}`:"Add custom provider",description:d?"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(),ae()},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(de,{})]}),e.jsx("input",{id:"custom-provider-name",type:"text",value:M,onChange:s=>I(s.target.value),onBlur:()=>T(!0),placeholder:"local-llama",autoFocus:!d,readOnly:d,"aria-readonly":d,"aria-invalid":te?!0:void 0,className:z(G,d&&"cursor-not-allowed bg-secondary-bg/60 text-text-secondary",te&&se)}),d?e.jsx(ie,{children:"Provider names cannot be changed after creation."}):null,te?e.jsx(re,{children:Q}):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(de,{})]}),e.jsx("input",{id:"custom-provider-base-url",type:"text",value:A,onChange:s=>U(s.target.value),onBlur:()=>P(!0),placeholder:"http://localhost:11434/v1",autoFocus:d,"aria-invalid":Y?!0:void 0,className:z(G,Y&&se)}),Y?e.jsx(re,{children:$}):L?null:e.jsx(ie,{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:B,onChange:s=>y(s.target.value),placeholder:"sk-…",className:G}),e.jsx(ie,{children:d?"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(de,{})]}),e.jsx("div",{className:"clear-both",children:x.map((s,r)=>{const b=ce(s),c=s.idTouched&&b,w=K(s),_=!!w&&s.nameDirty,me=V(s),ne=N(s),oe=s.contextTouched&&me,le=s.maxTouched&≠return e.jsxs("div",{className:z("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:p=>{const F=p.target.value;u(r,{id:F,...s.nameDirty?{}:{name:$e(F)}})},onBlur:()=>u(r,{idTouched:!0}),placeholder:"llama3.1:70b","aria-invalid":c?!0:void 0,className:z(G,"font-mono",c&&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:p=>u(r,{name:p.target.value,nameDirty:!0}),placeholder:"llama-3-1-70b","aria-invalid":_?!0:void 0,className:z(G,_&&se)})]}),e.jsx("button",{type:"button","aria-label":`Remove model ${r+1}`,disabled:x.length===1||h,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:()=>k(p=>p.filter((F,g)=>g!==r)),children:e.jsx(O,{name:"trash",className:"size-4"})})]}),c?e.jsx(re,{children:b}):null,_?e.jsx(re,{children:w}):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:()=>u(r,{advancedExpanded:!s.advancedExpanded}),children:[e.jsx(O,{name:"chevron-down",className:z("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(de,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-context-length`,type:"number",min:1,inputMode:"numeric",value:s.contextLength,onChange:p=>u(r,{contextLength:p.target.value}),onBlur:()=>u(r,{contextTouched:!0}),placeholder:Pe,"aria-invalid":oe?!0:void 0,className:z(G,oe&&se)}),oe?e.jsx(re,{children:me}):s.contextLength.trim()===""?e.jsx(ie,{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(de,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-max-output-tokens`,type:"number",min:1,inputMode:"numeric",value:s.maxOutputTokens,onChange:p=>u(r,{maxOutputTokens:p.target.value}),onBlur:()=>u(r,{maxTouched:!0}),placeholder:Le,"aria-invalid":le?!0:void 0,className:z(G,le&&se)}),le?e.jsx(re,{children:ne}):s.maxOutputTokens.trim()===""?e.jsx(ie,{children:"Longest reply the model allows — use its real limit."}):null]}),E&&E.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:h,onChange:p=>u(r,{reasoningEfforts:p.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:E.map(p=>{var g;const F=((g=s.reasoningEfforts)==null?void 0:g.includes(p))??!1;return e.jsx("button",{type:"button","aria-pressed":F,disabled:h,className:z("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",F?"border-primary-button-bg bg-primary-button-bg text-primary-button-text":"border-border text-text-secondary hover:bg-ghost-button-hover"),onClick:()=>{var q;return u(r,{reasoningEfforts:F?(q=s.reasoningEfforts)==null?void 0:q.filter(xe=>xe!==p):[...s.reasoningEfforts??[],p]})},children:p},p)})}):null]}):null]}):null]})]},r)})}),e.jsxs(H.Secondary,{size:"small",type:"button",className:"mt-4 w-fit",onClick:()=>k(s=>[...s,ge()]),children:[e.jsx(O,{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:[S?e.jsx("p",{className:"text-failure-bg text-sm",children:S}):null,e.jsx(H.Primary,{type:"submit",size:"large",disabled:!ee||h,className:"w-full",children:d?"Save changes":"Add provider"})]})]})})},ze=Re;function pe(a){return a.kind==="model"&&a.provider.models.length===1}function Oe(a){return a.kind==="provider"?`“${a.provider.name}” and all of its models will no longer be available to your agents.`:pe(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 Fe(a){return"baseUrl"in a&&typeof a.baseUrl=="string"?a.baseUrl:""}var Ie=()=>{const{modelCatalog:a}=Ne(),l=we(),[f,E]=o.useState(""),[h,S]=o.useState([]),[d,i]=o.useState([]),[M,I]=o.useState(!0),[A,U]=o.useState(null),[B,y]=o.useState(null),[x,k]=o.useState(!1),[D,T]=o.useState(null),[W,P]=o.useState(null),[J,j]=o.useState(null),[u,X]=o.useState(!1),[v,Q]=o.useState(null),[L,$]=o.useState(null),[ce,K]=o.useState(null),V=o.useMemo(()=>(d??[]).reduce((t,n)=>(t[n.name]=n.logo??"",t),{}),[d]),N=f.trim().toLowerCase(),ee=o.useCallback(async()=>{I(!0),U(null);try{const[t,n]=await Promise.all([a.listModelProviders(),a.getModelProviderCatalog()]);S(t),i(n)}catch(t){U(Z(t,"Failed to load model providers"))}finally{I(!1)}},[a]);o.useEffect(()=>{ee()},[ee]);const te=o.useMemo(()=>new Set(h.map(t=>t.type)),[h]),Y=o.useMemo(()=>h.filter(t=>{var n;return((n=t.name)==null?void 0:n.toLowerCase().includes(N))||t.models.some(m=>m.name.toLowerCase().includes(N)||m.id.toLowerCase().includes(N))}),[h,N]),ae=o.useMemo(()=>d.filter(t=>t.type!=="custom"&&!te.has(t.type)&&(t.name.toLowerCase().includes(N)||t.models.some(n=>n.name.toLowerCase().includes(N)||n.id.toLowerCase().includes(N)))),[d,te,N]),s=o.useMemo(()=>{var t;return(t=d.find(n=>n.type==="custom"))==null?void 0:t.supportedReasoningEfforts},[d]),r=o.useMemo(()=>{const t=new Map;for(const n of d)t.set(n.type,n.models);return t},[d]),b=()=>{T(null),P(null),j(null)},c=async(t,n)=>{k(!0),U(null);try{await t(),await ee(),b()}catch(m){throw n?n(m):l==null?U(Z(m,"Request failed")):l.showError(m),m}finally{k(!1)}},w=async(t,n)=>{j(null),await c(async()=>{await a.createModelProvider({type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},m=>j(Z(m,"Request failed")))},_=async(t,n)=>{j(null),await c(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},m=>j(Z(m,"Request failed"))),l==null||l.showSuccess({title:`${t.name} updated`})},me=()=>{x||($(null),K(null))},ne=({provider:t,models:n},m)=>c(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...t.baseUrl?{baseUrl:t.baseUrl}:{},apiKey:"",models:n})},m),oe=t=>{K(null);const n=R=>K(Z(R,"Request failed"));let m;if(t.kind==="model"&&!pe(t))m=ne({provider:t.provider,models:t.provider.models.filter(R=>R.id!==t.model.id)},n);else{const R=a.deleteModelProvider;R!==void 0&&(m=c(async()=>{await R({id:t.provider.id})},n))}m==null||m.then(()=>$(null)).catch(()=>{})},le=async t=>{y(null),await c(async()=>{await a.createModelProvider({type:"custom",name:t.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},n=>y(Z(n,"Request failed"))),setTimeout(()=>{l==null||l.showSuccess({title:`${t.name} added`})},0)},p=async t=>{if(!v)return;const n=v;y(null),await c(async()=>{await a.updateModelProvider({id:n.id,type:n.type,name:n.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},m=>y(Z(m,"Request failed"))),setTimeout(()=>{l==null||l.showSuccess({title:"Model provider updated",description:`${n.name} was updated successfully.`})},0)},F=v?{name:v.name,baseUrl:v.baseUrl??"",models:v.models}:void 0,g=D!=null?h.find(t=>t.id===D)??null:null,q=W!=null?d.find(t=>t.type===W)??null:null,xe=g!=null||q!=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(Ce,{query:f,setQuery:E,placeholder:"Search providers and models"})}),e.jsxs(H.Secondary,{type:"button",className:"shrink-0 sm:self-auto",onClick:()=>{y(null),Q(null),X(!0)},children:[e.jsx(O,{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&&Y.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:Y.map(t=>{const n=r.get(t.type)??[],m=new Set(t.models.map(C=>C.id)),R=n.filter(C=>!m.has(C.id)),he=V[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:he?e.jsx(be,{src:he,alt:t.name,className:"size-4.5"}):e.jsx(O,{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(H.Secondary,{size:"small",className:"text-[0.8125rem]",type:"button","aria-label":`Edit ${t.name}`,title:`Edit ${t.name}`,disabled:x,onClick:()=>{t.type==="custom"?(b(),y(null),Q(t),X(!0)):(j(null),P(null),T(t.id))},children:[e.jsx(O,{name:"pencil",className:"size-3.5"}),"Edit"]}),a.deleteModelProvider?e.jsx(H.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:x,onClick:()=>{K(null),$({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:x,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:()=>{K(null),$({kind:"model",provider:t,model:C})},children:e.jsx(O,{name:"trash",className:"size-3.5"})}):null]},C.id)),R.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 · ",R.length]}),R.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(H.Secondary,{size:"small",type:"button",disabled:x,onClick:()=>{ne({provider:t,models:[...t.models,C]}).catch(()=>{})},children:"Add"})]},C.id))]}):null]})]},t.id)})})]}):null,!M&&ae.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:ae.map(t=>{const n=V[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(be,{src:n,alt:t.name,className:"size-4.5"}):e.jsx(O,{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(m=>m.name).join(" · ")})]})]}),e.jsxs(H.Secondary,{type:"button",disabled:x,onClick:()=>{j(null),T(null),P(t.type)},children:[e.jsx(O,{name:"wrench",className:"size-4"}),"Configure"]})]})},t.type)})})]}):null,!M&&Y.length===0&&ae.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:N?`No providers match “${f.trim()}”.`:"No model providers yet."}):null]}),L?e.jsx(je,{title:L.kind==="model"&&!pe(L)?"Remove model?":"Remove provider?",description:Oe(L),busy:x,error:ce,onCancel:me,onConfirm:()=>{oe(L)}}):null,e.jsx(Te,{open:xe,onOpenChange:t=>{t||b()},onSave:t=>{if(g)return _(g,t);if(q)return w(q,t)},title:g?"Edit Provider Details":"Configure Provider Details",initialBaseUrl:g?g.baseUrl??"":q?Fe(q):"",requireApiKey:g==null,submitLabel:g?"Save":"Create",busy:x,error:J}),e.jsx(ze,{open:u,onOpenChange:t=>{X(t),t||(y(null),Q(null))},isEditMode:v!==null,initialValues:F,onSubmit:v?p:le,reasoningEffortOptions:s,busy:x,error:B},(v==null?void 0:v.id)??"add-custom-provider")]})})]})},De=Ie;export{De as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as G}from"./chunk-C5376XWU-
|
|
1
|
+
import{C as G}from"./chunk-C5376XWU-CUgFlwPN.js";import{aX as Y,t as V,r as a,aY as B,b3 as X,j as e,I as O,a0 as K,a_ as H,a$ as J,b0 as Q,g as W,b1 as Z,ap as ee}from"./index-D6YKMpJU.js";var te={execTimeoutMs:3e5,autoStopIntervalInMinutes:15,autoArchiveIntervalInMinutes:10080,autoDeleteIntervalInMinutes:43200},E=ee("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 se=({open:n,onOpenChange:r,onSave:d,title:N,description:S,initialConfig:F=null,requireApiKey:y=!0,busy:I=!1,error:C})=>{const[m,w]=a.useState(""),[c,u]=a.useState(""),[k,l]=a.useState(""),[x,o]=a.useState(""),[b,p]=a.useState(""),[j,M]=a.useState(!1),h=()=>{w(""),u(""),l(""),o(""),p(""),M(!1)};a.useEffect(()=>{if(!n)return;const s=F??te;w(String(s.execTimeoutMs)),u(String(s.autoStopIntervalInMinutes)),l(String(s.autoArchiveIntervalInMinutes)),o(String(s.autoDeleteIntervalInMinutes)),p(""),M(!1)},[n,F]);const A=s=>{s||h(),r(s)},f=R(m),v=R(c),P=R(k),g=R(x),D=b.trim(),z=(!y||!!D)&&f!=null&&v!=null&&P!=null&&g!=null,_=async s=>{if(s.preventDefault(),!(!z||I||f==null||v==null||P==null||g==null))try{await d({execTimeoutMs:f,autoStopIntervalInMinutes:v,autoArchiveIntervalInMinutes:P,autoDeleteIntervalInMinutes:g,apiKey:D}),h(),r(!1)}catch{}};return e.jsx(H,{open:n,onOpenChange:A,title:N,description:S,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(O,{name:"cube",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:_,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",y?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"sandbox-api-key",type:"password",required:y,value:b,onChange:s=>{p(s.target.value)},placeholder:y?"dtn_...":"Leave blank to keep existing",autoFocus:!0,className:E})]}),e.jsxs(J,{expanded:j,onChange:(s,U)=>M(U),className:"rounded-md border border-border",children:[e.jsx(Q,{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(O,{name:"chevron-down",className:W("size-4 shrink-0 text-text-secondary transition-transform duration-200",j?"rotate-0":"-rotate-90")})]})}),e.jsxs(Z,{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:m,onChange:s=>{w(s.target.value)},placeholder:"300000",className:E})]}),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:c,onChange:s=>{u(s.target.value)},placeholder:"15",className:E})]}),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:k,onChange:s=>{l(s.target.value)},placeholder:"10080",className:E})]}),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:x,onChange:s=>{o(s.target.value)},placeholder:"43200",className:E})]})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[C?e.jsx("p",{className:"text-failure-bg text-sm",children:C}):null,e.jsx(K.Primary,{type:"submit",size:"large",disabled:!z||I,className:"w-full shrink-0",children:"Save"})]})]})})},ae=se,q=({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:d,autoDeleteIntervalInMinutes:N})=>({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:d,autoDeleteIntervalInMinutes:N}),ne=()=>{const{sandboxCatalog:n}=Y(),r=V(),[d,N]=a.useState([]),[S,F]=a.useState([]),[y,I]=a.useState(!0),[C,m]=a.useState(null),[w,c]=a.useState(null),[u,k]=a.useState(!1),[l,x]=a.useState(null),[o,b]=a.useState(null),[p,j]=a.useState(null),[M,h]=a.useState(null),A=a.useCallback(async({quiet:t=!1}={})=>{if(n){t||I(!0),m(null);try{const[i,T]=await Promise.all([n.listSandboxProviders(),n.getSandboxProviderCatalog()]);N(i),F(T)}catch(i){m(B(i,"Failed to load sandbox providers"))}finally{t||I(!1)}}},[n]);a.useEffect(()=>{A()},[A]);const f=d.length>0,v=a.useMemo(()=>{if(f)return[];const t=new Set(d.map(i=>i.catalogId));return S.filter(i=>!t.has(i.id))},[S,d,f]),P=a.useMemo(()=>{const t=o??l;return t==null||!X(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 g=async(t,i=m)=>{k(!0),m(null);try{await t(),await A({quiet:!0})}catch(T){throw i(B(T,"Request failed")),T}finally{k(!1)}},D=async t=>{l&&(c(null),await g(async()=>{await n.createSandboxProvider({catalogId:l.id,name:l.name,type:l.type,...q(t),apiKey:t.apiKey})},c),x(null),setTimeout(()=>{r==null||r.showSuccess({title:`${l.name} configured`})},0))},z=async t=>{o&&(c(null),await g(async()=>{await n.updateSandboxProvider({id:o.id,...q(t),...t.apiKey?{apiKey:t.apiKey}:{}})},c),b(null),setTimeout(()=>{r==null||r.showSuccess({title:`${o.name} updated`})},0))},_=()=>{u||(j(null),h(null))},s=t=>{const i=n.deleteSandboxProvider;i&&(h(null),g(async()=>{await i({id:t.id}),j(null)},h).catch(()=>{}))},U=l!=null||o!=null,$=o!=null,L=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."}),C?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:C}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-auto",children:y?e.jsx("p",{className:"text-sm text-text-secondary",children:"Loading sandbox providers…"}):e.jsxs("div",{className:"space-y-6",children:[d.length>0?e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Configured · ",d.length]}),e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:[d.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(O,{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(K.Secondary,{size:"small",type:"button",disabled:u,onClick:()=>{c(null),x(null),b(t)},children:"Update"}),n.deleteSandboxProvider?e.jsx(K.Ghost,{size:"small",className:"text-text-secondary",type:"button",disabled:u,onClick:()=>{h(null),j(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 · ",v.length]}),v.length===0?e.jsx("p",{className:"text-sm text-text-secondary",children:S.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:v.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(O,{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(K.Secondary,{type:"button",disabled:u,onClick:()=>{c(null),b(null),x(t)},children:"Configure"})]},t.id))})]})]})}),p?e.jsx(G,{title:"Remove sandbox provider?",description:`“${p.name}” will stop running sandboxes for code, files and shell commands.`,busy:u,error:M,onCancel:_,onConfirm:()=>{s(p)}}):null,e.jsx(ae,{open:U,onOpenChange:t=>{t||(c(null),x(null),b(null))},onSave:$?z:D,title:L,description:$?"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:P,requireApiKey:!$,busy:u,error:w})]})},oe=ne;export{oe as default};
|
|
Binary file
|
|
Binary file
|