@truefoundry/trueforge 0.180.0-rc.1 → 0.180.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_frontend/assets/{AgentCodeSnippets-KJETGNKQ-DnLvvpR_.js → AgentCodeSnippets-EI7L6AZD-B95q1Hjm.js} +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-EI7L6AZD-B95q1Hjm.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-EI7L6AZD-B95q1Hjm.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-2UEF3GEL-DBH9LK9O.js +1 -0
- package/dist/_frontend/assets/AgentMetricChart-2UEF3GEL-DBH9LK9O.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-2UEF3GEL-DBH9LK9O.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-HEFKPIVO-Dq6tr7kQ.js +1 -0
- package/dist/_frontend/assets/AgentOverview-HEFKPIVO-Dq6tr7kQ.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-HEFKPIVO-Dq6tr7kQ.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimeline-J3AD4KFZ-rb89dfgl.js → AgentSessionEventTimeline-5AMYAJEU-B57r1KB8.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimeline-5AMYAJEU-B57r1KB8.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-5AMYAJEU-B57r1KB8.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimelineChart-KQE3BNJP-DhfBHfpK.js → AgentSessionEventTimelineChart-MCIIMESZ-tHXn5h6a.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-MCIIMESZ-tHXn5h6a.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-MCIIMESZ-tHXn5h6a.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessions-SD3U74MM-C7AvihJc.js → AgentSessions-IBTWEXR3-BkHj0ugQ.js} +1 -1
- package/dist/_frontend/assets/AgentSessions-IBTWEXR3-BkHj0ugQ.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-IBTWEXR3-BkHj0ugQ.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-WIXOLTUY-DCK3VbLC.js +1 -0
- package/dist/_frontend/assets/ConnectorSettings-WIXOLTUY-DCK3VbLC.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-WIXOLTUY-DCK3VbLC.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-FPKAUN4P-CtsN7Dlz.js → DockLayout-W7IJXA3A-46pvLKrm.js} +1 -1
- package/dist/_frontend/assets/{DrawerLayout-WP7MROGW-DBvy2qrx.js → DrawerLayout-6NM2OK7V-DNiz2kq8.js} +2 -2
- package/dist/_frontend/assets/DrawerLayout-6NM2OK7V-DNiz2kq8.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-6NM2OK7V-DNiz2kq8.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-CP45I45Z-Qvooua0r.js +3 -0
- package/dist/_frontend/assets/EnvironmentsPage-CP45I45Z-Qvooua0r.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-CP45I45Z-Qvooua0r.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-RORWGM3U-C46mJ_bm.js +1 -0
- package/dist/_frontend/assets/ModelSettings-RORWGM3U-C46mJ_bm.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-RORWGM3U-C46mJ_bm.js.gz +0 -0
- package/dist/_frontend/assets/{SandboxSettings-RA2QQA2U-BZ1p6y_g.js → SandboxSettings-HHLZG6WS-DGO4et3u.js} +1 -1
- package/dist/_frontend/assets/SandboxSettings-HHLZG6WS-DGO4et3u.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-HHLZG6WS-DGO4et3u.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-T7EAUTOK-N-OW1kvz.js +1 -0
- package/dist/_frontend/assets/SchedulesPage-T7EAUTOK-N-OW1kvz.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-T7EAUTOK-N-OW1kvz.js.gz +0 -0
- package/dist/_frontend/assets/{SettingsBuilder-MZNSGTCG-DW5WrGhz.js → SettingsBuilder-L2OFMRXP-Dh8lEf0J.js} +2 -2
- package/dist/_frontend/assets/SettingsBuilder-L2OFMRXP-Dh8lEf0J.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-L2OFMRXP-Dh8lEf0J.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-RP3jr7cD.js +1 -0
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-RP3jr7cD.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-RP3jr7cD.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-5ZOKBF2G-bNBjXx3r.js +2 -0
- package/dist/_frontend/assets/SidebarLayout-5ZOKBF2G-bNBjXx3r.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-5ZOKBF2G-bNBjXx3r.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-TGEVQYVZ-7tUcODoO.js +1 -0
- package/dist/_frontend/assets/SkillSettings-TGEVQYVZ-7tUcODoO.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-TGEVQYVZ-7tUcODoO.js.gz +0 -0
- package/dist/_frontend/assets/{TrueForgeUIWithRouter-IF7PNLNK-C3mp2pw1.js → TrueForgeUIWithRouter-CXREADWK-Qoq2vKOi.js} +1 -1
- package/dist/_frontend/assets/{WebSearchSettings-6L5OSPPU-CKnmuR-J.js → WebSearchSettings-SXQIWYIB-BL4uxR02.js} +1 -1
- package/dist/_frontend/assets/WebSearchSettings-SXQIWYIB-BL4uxR02.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-SXQIWYIB-BL4uxR02.js.gz +0 -0
- package/dist/_frontend/assets/{WidgetLayout-IBJNY7CF-D3Hdd9b-.js → WidgetLayout-7WFNZ2IB-DOiTcCPs.js} +1 -1
- package/dist/_frontend/assets/WidgetLayout-7WFNZ2IB-DOiTcCPs.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-7WFNZ2IB-DOiTcCPs.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-WG6NEBF3-D6-L7Ege.js → chunk-4BKRLRXL--PTlsbLc.js} +1 -1
- package/dist/_frontend/assets/chunk-4BKRLRXL--PTlsbLc.js.br +0 -0
- package/dist/_frontend/assets/chunk-4BKRLRXL--PTlsbLc.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-2UUABLZI-Dls_33ja.js → chunk-HEZQT2S7-Cy_0RIlD.js} +1 -1
- package/dist/_frontend/assets/{chunk-OB3PAWPO-dRLyZPUL.js → chunk-OB3PAWPO-D_HivAkv.js} +1 -1
- package/dist/_frontend/assets/chunk-OB3PAWPO-D_HivAkv.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-D_HivAkv.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-MTB32EHM-CWUHnCTs.js → chunk-PMXDHCX7-CdA5wX19.js} +1 -1
- package/dist/_frontend/assets/chunk-PMXDHCX7-CdA5wX19.js.br +0 -0
- package/dist/_frontend/assets/chunk-PMXDHCX7-CdA5wX19.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-KIRLJDZF-D5aQQ46r.js → chunk-ROEY5URA-D9QfyGUQ.js} +2 -2
- package/dist/_frontend/assets/chunk-ROEY5URA-D9QfyGUQ.js.br +0 -0
- package/dist/_frontend/assets/chunk-ROEY5URA-D9QfyGUQ.js.gz +0 -0
- package/dist/_frontend/assets/{cssMode-B1pKERIR.js → cssMode-DYweAuD0.js} +1 -1
- package/dist/_frontend/assets/cssMode-DYweAuD0.js.br +0 -0
- package/dist/_frontend/assets/cssMode-DYweAuD0.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-D558YrVo.js → freemarker2-BgnrKMUJ.js} +1 -1
- package/dist/_frontend/assets/freemarker2-BgnrKMUJ.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-BgnrKMUJ.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-DjToD8O0.js → handlebars-BuxRYVDg.js} +1 -1
- package/dist/_frontend/assets/handlebars-BuxRYVDg.js.br +0 -0
- package/dist/_frontend/assets/handlebars-BuxRYVDg.js.gz +0 -0
- package/dist/_frontend/assets/{html-Bj1OwSpp.js → html-B26vpw9A.js} +1 -1
- package/dist/_frontend/assets/html-B26vpw9A.js.br +0 -0
- package/dist/_frontend/assets/html-B26vpw9A.js.gz +0 -0
- package/dist/_frontend/assets/{htmlMode-1Un8e6H0.js → htmlMode-DmYbS8Mn.js} +1 -1
- package/dist/_frontend/assets/htmlMode-DmYbS8Mn.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-DmYbS8Mn.js.gz +0 -0
- package/dist/_frontend/assets/{index-Cq_o2Abd.js → index-BkqFR0mB.js} +242 -242
- package/dist/_frontend/assets/index-BkqFR0mB.js.br +0 -0
- package/dist/_frontend/assets/index-BkqFR0mB.js.gz +0 -0
- package/dist/_frontend/assets/{index-skbT0X6M.js → index-DO2Lw8LG.js} +3 -3
- package/dist/_frontend/assets/index-DO2Lw8LG.js.br +0 -0
- package/dist/_frontend/assets/index-DO2Lw8LG.js.gz +0 -0
- package/dist/_frontend/assets/{index-BvbVkgsP.js → index-ouLu_TJW.js} +1 -1
- package/dist/_frontend/assets/index-ouLu_TJW.js.br +0 -0
- package/dist/_frontend/assets/index-ouLu_TJW.js.gz +0 -0
- package/dist/_frontend/assets/{javascript-C0aMIA2x.js → javascript-DM8v37Dy.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-BGQys1IY.js → jsonMode-DMae7QLZ.js} +1 -1
- package/dist/_frontend/assets/jsonMode-DMae7QLZ.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-DMae7QLZ.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-BJfOa52w.js → liquid-lgQW01T7.js} +1 -1
- package/dist/_frontend/assets/liquid-lgQW01T7.js.br +0 -0
- package/dist/_frontend/assets/liquid-lgQW01T7.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-BPXxuQUC.js → lspLanguageFeatures-dlo6U4a7.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-dlo6U4a7.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-dlo6U4a7.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-DEftgzGF.js → mdx-B56hEfFP.js} +1 -1
- package/dist/_frontend/assets/mdx-B56hEfFP.js.br +0 -0
- package/dist/_frontend/assets/mdx-B56hEfFP.js.gz +0 -0
- package/dist/_frontend/assets/{python-B9hN9eL0.js → python-D3uJaW0Z.js} +1 -1
- package/dist/_frontend/assets/python-D3uJaW0Z.js.br +0 -0
- package/dist/_frontend/assets/python-D3uJaW0Z.js.gz +0 -0
- package/dist/_frontend/assets/{razor-B_YBri1R.js → razor-CA2L2x1h.js} +1 -1
- package/dist/_frontend/assets/razor-CA2L2x1h.js.br +0 -0
- package/dist/_frontend/assets/razor-CA2L2x1h.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-DmXjhObM.js → tsMode-DqNAhXjm.js} +1 -1
- package/dist/_frontend/assets/tsMode-DqNAhXjm.js.br +0 -0
- package/dist/_frontend/assets/tsMode-DqNAhXjm.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-CzGhzNVJ.js → typescript-gk4F4p_p.js} +1 -1
- package/dist/_frontend/assets/typescript-gk4F4p_p.js.br +0 -0
- package/dist/_frontend/assets/typescript-gk4F4p_p.js.gz +0 -0
- package/dist/_frontend/assets/{workers-CKeuqANe.js → workers-Dt5cwyc9.js} +1 -1
- package/dist/_frontend/assets/workers-Dt5cwyc9.js.br +0 -0
- package/dist/_frontend/assets/workers-Dt5cwyc9.js.gz +0 -0
- package/dist/_frontend/assets/{xml-BejVXqNL.js → xml-CzsdIMnF.js} +1 -1
- package/dist/_frontend/assets/xml-CzsdIMnF.js.br +0 -0
- package/dist/_frontend/assets/xml-CzsdIMnF.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-DThQJB0u.js → yaml-BnfYb4jg.js} +1 -1
- package/dist/_frontend/assets/yaml-BnfYb4jg.js.br +0 -0
- package/dist/_frontend/assets/yaml-BnfYb4jg.js.gz +0 -0
- package/dist/_frontend/index.html +1 -1
- package/dist/main.js +3 -1
- package/dist/main.js.map +1 -1
- package/package.json +2 -2
- package/dist/_frontend/assets/AgentCodeSnippets-KJETGNKQ-DnLvvpR_.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-KJETGNKQ-DnLvvpR_.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-WVOTRK46-BdnyQ_oy.js +0 -1
- package/dist/_frontend/assets/AgentMetricChart-WVOTRK46-BdnyQ_oy.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-WVOTRK46-BdnyQ_oy.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-JQQP6DDA-CfAWTQzb.js +0 -1
- package/dist/_frontend/assets/AgentOverview-JQQP6DDA-CfAWTQzb.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-JQQP6DDA-CfAWTQzb.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-J3AD4KFZ-rb89dfgl.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-J3AD4KFZ-rb89dfgl.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-KQE3BNJP-DhfBHfpK.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-KQE3BNJP-DhfBHfpK.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-SD3U74MM-C7AvihJc.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-SD3U74MM-C7AvihJc.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-73EOLURL-D0T099Hf.js +0 -1
- package/dist/_frontend/assets/ConnectorSettings-73EOLURL-D0T099Hf.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-73EOLURL-D0T099Hf.js.gz +0 -0
- package/dist/_frontend/assets/DrawerLayout-WP7MROGW-DBvy2qrx.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-WP7MROGW-DBvy2qrx.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-FCDIVAKH-Crq_Zjm_.js +0 -3
- package/dist/_frontend/assets/EnvironmentsPage-FCDIVAKH-Crq_Zjm_.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-FCDIVAKH-Crq_Zjm_.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-O2PPI7KP-B-pD-nIV.js +0 -1
- package/dist/_frontend/assets/ModelSettings-O2PPI7KP-B-pD-nIV.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-O2PPI7KP-B-pD-nIV.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-RA2QQA2U-BZ1p6y_g.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-RA2QQA2U-BZ1p6y_g.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-YFIJGKZO-BbTOcGO5.js +0 -1
- package/dist/_frontend/assets/SchedulesPage-YFIJGKZO-BbTOcGO5.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-YFIJGKZO-BbTOcGO5.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-MZNSGTCG-DW5WrGhz.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-MZNSGTCG-DW5WrGhz.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-VORG6HSK-DlG8FUO5.js +0 -1
- package/dist/_frontend/assets/ShellRouteSync-VORG6HSK-DlG8FUO5.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-VORG6HSK-DlG8FUO5.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-2ZSKQ46M-DO6rRES5.js +0 -2
- package/dist/_frontend/assets/SidebarLayout-2ZSKQ46M-DO6rRES5.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-2ZSKQ46M-DO6rRES5.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-EE4BYHMX-DhNcJrAy.js +0 -1
- package/dist/_frontend/assets/SkillSettings-EE4BYHMX-DhNcJrAy.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-EE4BYHMX-DhNcJrAy.js.gz +0 -0
- package/dist/_frontend/assets/WebSearchSettings-6L5OSPPU-CKnmuR-J.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-6L5OSPPU-CKnmuR-J.js.gz +0 -0
- package/dist/_frontend/assets/WidgetLayout-IBJNY7CF-D3Hdd9b-.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-IBJNY7CF-D3Hdd9b-.js.gz +0 -0
- package/dist/_frontend/assets/chunk-KIRLJDZF-D5aQQ46r.js.br +0 -0
- package/dist/_frontend/assets/chunk-KIRLJDZF-D5aQQ46r.js.gz +0 -0
- package/dist/_frontend/assets/chunk-MTB32EHM-CWUHnCTs.js.br +0 -0
- package/dist/_frontend/assets/chunk-MTB32EHM-CWUHnCTs.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-dRLyZPUL.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-dRLyZPUL.js.gz +0 -0
- package/dist/_frontend/assets/chunk-WG6NEBF3-D6-L7Ege.js.br +0 -0
- package/dist/_frontend/assets/chunk-WG6NEBF3-D6-L7Ege.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-B1pKERIR.js.br +0 -0
- package/dist/_frontend/assets/cssMode-B1pKERIR.js.gz +0 -0
- package/dist/_frontend/assets/freemarker2-D558YrVo.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-D558YrVo.js.gz +0 -0
- package/dist/_frontend/assets/handlebars-DjToD8O0.js.br +0 -0
- package/dist/_frontend/assets/handlebars-DjToD8O0.js.gz +0 -0
- package/dist/_frontend/assets/html-Bj1OwSpp.js.br +0 -0
- package/dist/_frontend/assets/html-Bj1OwSpp.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-1Un8e6H0.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-1Un8e6H0.js.gz +0 -0
- package/dist/_frontend/assets/index-BvbVkgsP.js.br +0 -0
- package/dist/_frontend/assets/index-BvbVkgsP.js.gz +0 -0
- package/dist/_frontend/assets/index-Cq_o2Abd.js.br +0 -0
- package/dist/_frontend/assets/index-Cq_o2Abd.js.gz +0 -0
- package/dist/_frontend/assets/index-skbT0X6M.js.br +0 -0
- package/dist/_frontend/assets/index-skbT0X6M.js.gz +0 -0
- package/dist/_frontend/assets/jsonMode-BGQys1IY.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-BGQys1IY.js.gz +0 -0
- package/dist/_frontend/assets/liquid-BJfOa52w.js.br +0 -0
- package/dist/_frontend/assets/liquid-BJfOa52w.js.gz +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-BPXxuQUC.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-BPXxuQUC.js.gz +0 -0
- package/dist/_frontend/assets/mdx-DEftgzGF.js.br +0 -0
- package/dist/_frontend/assets/mdx-DEftgzGF.js.gz +0 -0
- package/dist/_frontend/assets/python-B9hN9eL0.js.br +0 -0
- package/dist/_frontend/assets/python-B9hN9eL0.js.gz +0 -0
- package/dist/_frontend/assets/razor-B_YBri1R.js.br +0 -0
- package/dist/_frontend/assets/razor-B_YBri1R.js.gz +0 -0
- package/dist/_frontend/assets/tsMode-DmXjhObM.js.br +0 -0
- package/dist/_frontend/assets/tsMode-DmXjhObM.js.gz +0 -0
- package/dist/_frontend/assets/typescript-CzGhzNVJ.js.br +0 -0
- package/dist/_frontend/assets/typescript-CzGhzNVJ.js.gz +0 -0
- package/dist/_frontend/assets/workers-CKeuqANe.js.br +0 -0
- package/dist/_frontend/assets/workers-CKeuqANe.js.gz +0 -0
- package/dist/_frontend/assets/xml-BejVXqNL.js.br +0 -0
- package/dist/_frontend/assets/xml-BejVXqNL.js.gz +0 -0
- package/dist/_frontend/assets/yaml-DThQJB0u.js.br +0 -0
- package/dist/_frontend/assets/yaml-DThQJB0u.js.gz +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truefoundry/trueforge",
|
|
3
|
-
"version": "0.180.0-rc.
|
|
3
|
+
"version": "0.180.0-rc.2",
|
|
4
4
|
"description": "TrueForge Agent Harness: server, HTTP API, and chat UI (npx @truefoundry/trueforge)",
|
|
5
5
|
"author": "TrueFoundry",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"winston": "^3.19.0",
|
|
52
52
|
"yaml": "^2.9.1",
|
|
53
53
|
"zod": "^4.6.5",
|
|
54
|
-
"@truefoundry/trueforge-core": "0.180.0-rc.
|
|
54
|
+
"@truefoundry/trueforge-core": "0.180.0-rc.2",
|
|
55
55
|
"@truefoundry/trueforge-sdk": "0.180.0-rc.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aD as j,r as d,j as a,aZ as C,aY as k}from"./index-Cq_o2Abd.js";import{c as D,a as F,d as M,L as R,e as S,P as T,f as p,p as w}from"./index-BvbVkgsP.js";F.register(M,R,S,T,p,w);var E=["#6366F1","#2563eb","#0EA5E9"],$=["#6366F1","#60a5fa","#38BDF8"],A=new Intl.NumberFormat(void 0,{maximumFractionDigits:4}),O=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});function f(e,t){return t==="$"?C(e):t==="ms"?k(e):`${A.format(e)}${t==="count"||t.length===0?"":` ${t}`}`}function _(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:O.format(t)}function G({graph:e,definition:t,error:u,colorIndex:b=0}){const l=j(),r=l==="dark"?$:E,i=l==="dark"?"#71717a":"#a1a1aa",m=l==="dark"?"#27272a":"#e4e4e7",c=d.useMemo(()=>e==null?[]:[...new Set(e.graphLines.flatMap(s=>s.values.map(o=>o.timestamp)))].sort(),[e]),y=d.useMemo(()=>({labels:c.map(_),datasets:(e==null?void 0:e.graphLines.map((s,o)=>{const L=new Map(s.values.map(n=>[n.timestamp,n.value])),x=r[(b+o)%r.length];return{label:s.name,data:c.map(n=>L.get(n)??null),borderColor:x,backgroundColor:x,pointRadius:0,pointHoverRadius:0,borderWidth:2,borderCapStyle:"butt",borderJoinStyle:"miter",tension:0,spanGaps:!0}}))??[]}),[b,r,e,c]),v=d.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:!1,interaction:{intersect:!1,mode:"index"},plugins:{legend:{display:((e==null?void 0:e.graphLines.length)??0)>1,labels:{color:i,boxWidth:10,boxHeight:2}},tooltip:{callbacks:{label:s=>{const o=s.parsed.y;return`${s.dataset.label??""}: ${o==null?"—":f(o,(e==null?void 0:e.unit)??"")}`}}}},scales:{x:{grid:{display:!1},border:{color:m},ticks:{color:i,maxRotation:0,autoSkip:!0,maxTicksLimit:8}},y:{beginAtZero:!0,grid:{color:m},border:{display:!1},ticks:{color:i,callback:s=>f(Number(s),(e==null?void 0:e.unit)??"")}}}}),[i,e,m]),N=(e==null?void 0:e.graphLines.some(s=>s.values.length>0))===!0;return a.jsxs("section",{className:"min-w-0 rounded-lg border border-border bg-card-bg p-4","data-slot":"agent-metric-chart",children:[a.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:(e==null?void 0:e.displayName)??t.displayName}),a.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:(e==null?void 0:e.description)??t.description}),a.jsx("div",{className:"mt-4 h-64",children:u!=null?a.jsx("div",{className:"flex h-full items-center justify-center text-sm text-failure-bg",children:u}):N?a.jsx(D,{data:y,options:v}):a.jsx("div",{className:"flex h-full items-center justify-center text-sm text-text-secondary",children:"No data"})})]})}export{G as AgentMetricChart};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as I,p as U,r as y,j as e,I as w,g as M,k as V,F as q,G as W,H,J,K as Q,L as X,M as Y,N as Z,O as ee}from"./index-Cq_o2Abd.js";var te={read:"border-border bg-secondary-bg text-text-secondary",write:"border-border bg-secondary-bg text-text-primary",destructive:"border-failure-bg/30 bg-failure-bg/10 text-failure-bg"},B={read:0,write:1,unknown:2,destructive:3};function se(t){return t===1?"1 tool":`${t} tools`}function ne(t){return t.includes(Z)?"All tools":t.filter(l=>l.startsWith("@")).join(" ")}function re({count:t}){return e.jsxs("span",{className:"border-warning-bg/40 bg-warning-bg/10 text-warning-bg inline-flex shrink-0 items-center gap-1 rounded-full border px-1.5 py-0.5 text-[0.625rem] font-medium","aria-label":`${t} ${t===1?"tool needs":"tools need"} approval`,children:[e.jsx(w,{name:"shield-check",className:"size-2.5"}),t]})}function ae({kind:t}){return e.jsx("span",{className:M("shrink-0 rounded-full border px-1.5 py-0.5 text-[0.625rem] font-medium",te[t]),children:t})}function oe({approvalRequired:t,toolName:l}){return e.jsx(ee,{content:t?"Asks for approval before running":"Runs without asking for approval",triggerClassName:"shrink-0",children:e.jsx("span",{role:"img","aria-label":`${l} ${t?"requires approval":"runs without approval"}`,className:M("flex size-5 items-center justify-center rounded-md border",t?"border-warning-bg/50 bg-warning-bg/10 text-warning-bg":"border-border text-text-secondary"),children:e.jsx(w,{name:t?"shield-check":"shield",className:"size-3"})})})}function le({mcpServers:t}){const l=I("AgentOverviewCard"),i=V(),c=i==null?void 0:i.getMcpTools,u=y.useMemo(()=>q(t),[t]),[T,N]=y.useState({}),[k,s]=y.useState(()=>new Set);return y.useEffect(()=>{if(c===void 0)return;let r=!1;for(const x of u)c({connectorId:x.name}).then(f=>{r||N(h=>({...h,[x.name]:f}))},()=>{});return()=>{r=!0}},[c,u]),u.length===0?e.jsx(l,{title:"MCP Servers & Tools",icon:"plug",count:0,children:e.jsx("p",{className:"text-text-secondary text-xs",children:"No connectors attached."})}):e.jsx(l,{title:"MCP Servers & Tools",icon:"plug",count:u.length,children:e.jsx("ul",{className:"space-y-1.5",children:u.map(r=>{const x=T[r.name]??[],f=W(r.value),h=H(r.value),m=J({enableSelectors:h,disableSelectors:Q(r.value),tools:x}),d=m.names.map(n=>{const o=x.find(S=>S.name===n),g=o===void 0?void 0:X(o);return{toolName:n,kind:g,approvalRequired:Y({toolName:n,tools:x,selectors:f})}}).sort((n,o)=>B[n.kind??"unknown"]-B[o.kind??"unknown"]),p=d.filter(n=>n.approvalRequired).length,b=k.has(r.id);return e.jsxs("li",{className:"overflow-hidden rounded-md border border-border",children:[e.jsxs("button",{type:"button","aria-expanded":b,disabled:d.length===0,className:"flex w-full cursor-pointer items-center gap-2 bg-secondary-bg px-2.5 py-2 text-left text-xs hover:bg-ghost-button-hover disabled:cursor-default disabled:hover:bg-secondary-bg",onClick:()=>s(n=>{const o=new Set(n);return b?o.delete(r.id):o.add(r.id),o}),children:[e.jsx(w,{name:"chevron-down",className:M("size-3 shrink-0 text-text-secondary transition-transform",b?void 0:"-rotate-90",d.length===0&&"invisible")}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:r.name}),e.jsx("span",{className:"shrink-0 text-text-secondary",children:m.resolved?se(d.length):ne(h)}),p>0?e.jsx(re,{count:p}):null]}),b?e.jsx("ul",{className:"divide-y divide-border border-t border-border",children:d.map(({toolName:n,kind:o,approvalRequired:g})=>e.jsxs("li",{className:"flex items-center gap-2 px-2.5 py-1.5",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[0.6875rem]",title:n,children:n}),o?e.jsx(ae,{kind:o}):null,e.jsx(oe,{approvalRequired:g,toolName:n})]},n))}):null]},r.id)})})})}var v="text-right font-mono text-primary-button-bg";function A(t){return typeof t=="object"&&t!=null}function G(t){return!("name"in t)||typeof t.name!="string"?null:t.name}function C(t,...l){for(const i of l){const c=t==null?void 0:t[i];if(c!==void 0)return c}}function ie(t){const l=t.lastIndexOf("/");return l>=0?t.slice(l+1):t}function de({detail:t}){var S,O,E,F,L,R,_,$,D,z,K,P;const l=I("Markdown"),i=I("AgentOverviewCard"),c=U(),[u,T]=y.useState("markdown"),[N,k]=y.useState(!1),s=t.agentSpec,r=s.skills??[],x=A(s.model.params)?s.model.params:null,f=C(x,"maxTokens","max_tokens"),h=C(x,"temperature"),m=A(s.config)?s.config:null,d=A(m==null?void 0:m.sandbox)?m.sandbox:null,p=(S=s.instructions)!=null&&S.trim()?s.instructions:null,b=(O=t.description)!=null&&O.trim()?t.description:null,n=[["Sandbox",typeof(d==null?void 0:d.enabled)=="boolean"?d.enabled?"Enabled":"Disabled":void 0],["Iteration limit",C(m,"iterationLimit","iteration_limit")],["Response format",C(m,"responseFormat","response_format")]].filter(a=>typeof a[1]=="string"||typeof a[1]=="number"),o=[["Generative UI",(F=(E=s.config)==null?void 0:E.generativeUi)==null?void 0:F.enabled],["Dynamic sub-agents",(R=(L=s.config)==null?void 0:L.dynamicSubAgents)==null?void 0:R.enabled],["Ask user questions",($=(_=s.config)==null?void 0:_.askUserQuestions)==null?void 0:$.enabled],...((D=c==null?void 0:c.webSearch)==null?void 0:D.enabled)===!0?[["Web search",(K=(z=s.config)==null?void 0:z.webSearch)==null?void 0:K.enabled]]:[]].filter(a=>typeof a[1]=="boolean"),g=u==="markdown"?"Raw":"Markdown";return e.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4 md:overflow-hidden",children:e.jsxs("div",{className:"grid min-h-0 flex-1 gap-3 md:grid-cols-[minmax(0,1fr)_22rem] md:overflow-hidden",children:[e.jsxs("section",{className:"flex min-h-64 flex-col rounded-lg border border-border bg-card-bg p-4 text-text-primary",children:[e.jsxs("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-2",children:[e.jsxs("h2",{className:"flex items-center gap-1.5 text-sm font-semibold text-text-primary",children:[e.jsx(w,{name:"book-open",className:"size-4 text-text-secondary"}),"Instructions"]}),p?e.jsxs("div",{className:"inline-flex h-7 items-stretch overflow-hidden rounded-md border border-border bg-primary-bg text-xs font-medium text-text-secondary",role:"group","aria-label":"Instructions actions",children:[e.jsx("button",{type:"button","aria-label":`Show ${g}`,onClick:()=>T(a=>a==="markdown"?"raw":"markdown"),className:"cursor-pointer px-2.5 transition-colors hover:bg-ghost-button-hover hover:text-text-primary",children:g}),e.jsx("span",{className:"w-px self-stretch bg-border","aria-hidden":!0}),e.jsx("button",{type:"button",title:N?"Copied!":"Copy","aria-label":N?"Copied!":"Copy",onClick:()=>{navigator.clipboard.writeText(p).then(()=>{k(!0),setTimeout(()=>k(!1),2e3)})},className:"inline-flex cursor-pointer items-center justify-center px-2 transition-colors hover:bg-ghost-button-hover hover:text-text-primary",children:e.jsx(w,{name:N?"check":"copy",size:12})})]}):null]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:p?u==="markdown"?e.jsx(l,{content:p,readOnly:!0,className:"text-sm"}):e.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-sm text-text-primary",children:p}):e.jsx("p",{className:"text-sm text-text-secondary",children:"No instructions for this agent."})})]}),e.jsxs("aside",{className:"flex min-h-0 min-w-0 flex-col gap-3 md:overflow-auto",children:[b?e.jsx(i,{title:"Description",icon:"file",children:e.jsx("p",{className:"text-xs text-text-secondary",children:b})}):null,e.jsx(i,{title:"Model Configuration",icon:"cpu",children:e.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs",children:[e.jsx("dt",{className:"text-text-secondary",children:"Model"}),e.jsx("dd",{className:M(v,"truncate"),title:s.model.name,children:ie(s.model.name)}),typeof f=="number"?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-text-secondary",children:"Max tokens"}),e.jsx("dd",{className:v,children:f})]}):null,((P=s.model.params)==null?void 0:P.reasoningEffort)!==void 0?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-text-secondary",children:"Reasoning"}),e.jsx("dd",{className:v,children:s.model.params.reasoningEffort})]}):null,typeof h=="number"?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-text-secondary",children:"Temperature"}),e.jsx("dd",{className:v,children:h})]}):null]})}),e.jsx(le,{mcpServers:s.mcpServers}),e.jsx(i,{title:"Attached Skills",icon:"lightbulb",count:r.length,children:r.length===0?e.jsx("p",{className:"text-xs text-text-secondary",children:"No skills attached."}):e.jsx("ul",{className:"space-y-1.5",children:r.map((a,j)=>e.jsx("li",{className:"rounded-md bg-secondary-bg px-2 py-1.5 text-xs",children:G(a)??`Skill ${j+1}`},`${G(a)??"skill"}-${j}`))})}),n.length>0?e.jsx(i,{title:"Execution",icon:"terminal",children:e.jsx("dl",{className:"space-y-1 text-xs",children:n.map(([a,j])=>e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-text-secondary",children:a}),e.jsx("dd",{className:v,children:j})]},a))})}):null,o.length>0?e.jsx(i,{title:"Capabilities",icon:"cube",children:e.jsx("dl",{className:"space-y-1 text-xs",children:o.map(([a,j])=>e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-text-secondary",children:a}),e.jsx("dd",{className:v,children:j?"Enabled":"Disabled"})]},a))})}):null]})]})})}export{de as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as ke}from"./chunk-2UUABLZI-Dls_33ja.js";import{b5 as me,U as Ae,V as Ee,bb as ue,r as a,w as J,j as e,$ as ze,a2 as N,I as w,b7 as xe,as as X,g as $,al as _,b6 as oe}from"./index-Cq_o2Abd.js";var Fe=[{value:"none",label:"None"},{value:"header",label:"API Key"},{value:"dcr",label:"OAuth"}],ae=X("h-11 shadow-sm"),B=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),Me=({open:r,onOpenChange:p,onSubmit:x,connector:n,busy:k=!1,error:g})=>{const[y,c]=a.useState(""),[b,v]=a.useState(""),[A,E]=a.useState(""),[f,C]=a.useState("dcr"),[m,o]=a.useState(""),[z,F]=a.useState(""),S=n!==void 0,D=X(`h-11 shadow-sm ${S?"cursor-not-allowed bg-secondary-bg/60 text-text-secondary opacity-40":""}`),i=()=>{c(""),v(""),E(""),C("dcr"),o(""),F("")};a.useEffect(()=>{r&&(c((n==null?void 0:n.name)??""),v((n==null?void 0:n.url)??""),E((n==null?void 0:n.description)??""),C((n==null?void 0:n.auth.type)??"dcr"),o(""),F((n==null?void 0:n.auth.type)==="header"?n.auth.headerName??"":""))},[n,r]);const j=l=>{l||i(),p(l)},I=!!m.trim()||(n==null?void 0:n.auth.type)==="header",d=!!y.trim()&&!!A.trim()&&!!b.trim()&&(f!=="header"||I),q=async l=>{if(l.preventDefault(),!d||k)return;const M=f==="header"?{type:"header",apiKey:m.trim(),...z.trim()?{headerName:z.trim()}:{}}:{type:f};try{await x({name:y.trim(),url:b.trim(),description:A.trim(),auth:M}),i(),p(!1)}catch{}};return e.jsx(xe,{open:r,onOpenChange:j,title:S?"Edit MCP server":"Add MCP server",description:S?"Update how this connector authenticates.":"Point at a remote MCP endpoint. It then behaves like any other connector.",contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:l=>void q(l),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Name",e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-name",type:"text",required:!0,value:y,readOnly:S,"aria-disabled":S,onChange:l=>{c(l.target.value)},placeholder:"analytics-postgres-mcp",autoFocus:!S,className:D})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-description",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Description",e.jsx(B,{})]}),e.jsx("textarea",{id:"mcp-server-description",value:A,onChange:l=>{E(l.target.value)},placeholder:"Query analytics from Postgres",required:!0,rows:3,className:X("resize-y py-2.5 shadow-sm")})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-url",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["URL",e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-url",type:"url",required:!0,value:b,onChange:l=>{v(l.target.value)},placeholder:"https://mcp.example.com/mcp",className:ae})]}),e.jsxs("fieldset",{children:[e.jsxs("legend",{className:"mb-1.5 text-sm font-medium text-text-primary",children:["Auth type",e.jsx(B,{})]}),e.jsx("div",{className:"flex w-full flex-row rounded-md border border-border bg-secondary-bg/40 p-1",children:Fe.map(l=>e.jsxs("label",{className:`flex h-8 flex-1 cursor-pointer items-center justify-center rounded-sm text-sm font-medium transition-colors ${f===l.value?"bg-dropdown-selected-item-bg text-dropdown-selected-item-text shadow-sm":"text-text-secondary hover:text-text-primary"}`,children:[e.jsx("input",{type:"radio",name:"mcp-auth-type",value:l.value,checked:f===l.value,onChange:()=>{C(l.value)},className:"sr-only"}),l.label]},l.value))})]}),f==="dcr"?e.jsxs("div",{className:"flex gap-1.5 bg-secondary-bg/40 p-2 rounded-md",children:[e.jsx(w,{name:"info",className:"size-3.5 mt-1 text-text-secondary"}),e.jsx("div",{className:"text-xs text-text-secondary leading-5.5",children:"Sign-in only — the server must support dynamic client registration. Manual OAuth (client ID / secret) isn't supported yet."})]}):null,f==="header"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",(n==null?void 0:n.auth.type)==="header"?e.jsx("span",{className:"font-normal text-text-secondary",children:" (leave blank to keep current)"}):e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-api-key",type:"password",required:(n==null?void 0:n.auth.type)!=="header",value:m,onChange:l=>{o(l.target.value)},placeholder:"Bearer <Paste the token from the provider>","aria-describedby":"mcp-server-api-key-hint",className:ae}),e.jsx("p",{id:"mcp-server-api-key-hint",className:"mt-1.5 text-xs text-text-secondary",children:`This is the value for the "${z.trim()||"Authorization"}" header.`})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-header-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Header name ",e.jsx("span",{className:"font-normal text-text-secondary",children:"(optional)"})]}),e.jsx("input",{id:"mcp-server-header-name",type:"text",value:z,onChange:l=>{F(l.target.value)},placeholder:"Authorization",className:ae})]})]}):null]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[g?e.jsx("p",{className:"text-failure-bg text-sm",children:g}):null,e.jsx(N.Primary,{type:"submit",size:"large",disabled:!d||k,className:"w-full shrink-0",children:S?"Save":"Add"})]})]})})},ce=Me,Z={dcr:"OAuth2",header:"API Key",none:"No Auth"};function De({text:r}){const p=a.useRef(null),[x,n]=a.useState(!1),[k,g]=a.useState(!1),[y,c]=a.useState(16);return a.useLayoutEffect(()=>{n(!1),c(16)},[r]),a.useLayoutEffect(()=>{const b=p.current;if(!b)return;if(!x){c(16),g(b.scrollWidth>b.clientWidth+1);return}c(16);const v=requestAnimationFrame(()=>{c(b.scrollHeight)});return()=>cancelAnimationFrame(v)},[r,x]),r?e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("p",{ref:p,style:{maxHeight:y},className:$("mt-0.5 overflow-hidden font-mono text-xs leading-4 text-text-secondary transition-[max-height] duration-300 ease-in-out",!x&&"whitespace-nowrap",!x&&k&&"pr-[5.75rem]"),children:[r,x&&k?e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",className:"cursor-pointer font-mono text-xs font-medium text-text-primary/80 hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring","aria-expanded":!0,onClick:()=>n(!1),children:"Show less"})]}):null]}),!x&&k?e.jsxs("button",{type:"button",className:"absolute top-0.5 right-0 cursor-pointer bg-card-bg pl-1.5 font-mono text-xs font-medium leading-4 text-text-primary/80 hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring","aria-expanded":!1,onClick:()=>n(!0),children:[e.jsx("span",{"aria-hidden":!0,className:"text-text-secondary",children:"…"}),e.jsx("span",{className:"ml-1",children:"Read more"})]}):null]}):null}var Ie=({connector:r,onBack:p,onConnectorRefreshed:x,onEdit:n,onDisconnect:k,onRemove:g,busy:y=!1})=>{const{connectorCatalog:c}=me(),{handleAuthorize:b,isOAuthLoading:v}=ue(),[A,E]=a.useState([]),[f,C]=a.useState(!0),[m,o]=a.useState(null),[z,F]=a.useState(!1);a.useEffect(()=>{let i=!1;return E([]),o(null),C(!0),c.getToolsByConnectorId({id:r.id}).then(j=>{i||E(j)}).catch(j=>{i||o(J(j,"Failed to load connector tools"))}).finally(()=>{i||C(!1)}),()=>{i=!0}},[r.authenticated,r.id,c]);const S=async()=>{F(!0),o(null);try{const i=await c.getConnector({id:r.id});x(i)}catch(i){o(J(i,"Failed to refresh connector details"))}finally{F(!1)}},D=v||z;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:p,className:"mb-3 inline-flex w-fit items-center gap-1 rounded-md py-1 pr-2 text-sm text-text-secondary hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",children:[e.jsx(w,{name:"chevron-left",className:"size-3.5"}),"Connectors"]}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-y-auto pb-1",children:[e.jsxs("header",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"text-lg font-semibold text-text-primary",children:r.name}),e.jsx("span",{className:"inline-flex items-center rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-text-secondary",children:Z[r.auth.type]??Z.none}),e.jsxs("span",{className:$("flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium",r.authenticated?"text-success-bg":"text-text-primary"),children:[e.jsx("span",{className:$("h-1.5 w-1.5 rounded-full",r.authenticated?"bg-success-bg":"bg-primary-button-bg")}),r.authenticated?"Connected":"Not authenticated"]})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:e.jsx("span",{className:"text-text-secondary",children:r.description})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(N.Secondary,{size:"small",type:"button",disabled:y,onClick:n,children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.auth.type==="dcr"&&!r.authenticated?e.jsx(N.Secondary,{size:"small",type:"button",disabled:y||D,onClick:()=>{b(r.id,i=>{i&&S()})},children:D?"Connecting…":"Connect"}):r.auth.type==="dcr"&&!r.requiresAuth?e.jsx(N.Secondary,{size:"small",type:"button",disabled:y,onClick:k,children:"Disconnect"}):null,g?e.jsx(N.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:y,"aria-label":`Remove ${r.name}`,onClick:g,children:"Remove"}):null]})]}),e.jsx("section",{className:"mt-6","aria-labelledby":"connector-tools-heading",children:f?e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"Loading tools…"}):m?e.jsxs("div",{className:"rounded-xl border border-failure-bg/30 bg-failure-bg/10 p-6 text-center text-sm text-failure-bg",children:[m,r.auth.type==="dcr"&&!r.authenticated&&e.jsx("div",{className:"font-bold mt-1",children:"Click Connect and authenticate successfully to view tools."})]}):A.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("h5",{id:"connector-tools-heading",className:"mb-2 text-[0.8125rem] font-semibold text-text-primary",children:["Tools ",e.jsxs("span",{className:"font-normal text-text-secondary",children:["· ",A.length]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:A.map(i=>e.jsx("article",{className:"flex min-h-12 items-start gap-3 border-b border-border px-3 py-2 last:border-b-0",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h6",{className:"text-sm font-medium text-text-primary",children:i.name}),e.jsx(De,{text:i.description})]})},i.id))})]}):e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"No tools reported for this connector."})})]})]})},Oe=Ie,Re=()=>{const{connectorCatalog:r}=me(),p=Ae(),x=Ee(),{handleAuthorize:n,isOAuthLoading:k}=ue(),[g,y]=a.useState(""),[c,b]=a.useState({ordered:[],authStatusById:new Map}),[v,A]=a.useState(!0),[E,f]=a.useState(null),[C,m]=a.useState(null),[o,z]=a.useState(!1),[F,S]=a.useState([]),[D,i]=a.useState(!1),[j,I]=a.useState(null),[d,q]=a.useState(null),[l,M]=a.useState(null),[he,re]=a.useState(null),[ee,H]=a.useState(null),[pe,R]=a.useState(null),[U,te]=a.useState(""),ne=a.useMemo(()=>(F??[]).reduce((t,s)=>(t[s.name]=s.logo??"",t),{}),[F]),V=a.useCallback(async()=>{A(!0),f(null);try{const[t,s]=await Promise.all([r.listConnectors(),r.getConnectorCatalog()]);S(s);const u=t??[],O=new Set(u.map(h=>h.id)),G=[...u.map(h=>({connector:h,isConfigured:!0})),...s.filter(h=>!O.has(h.id)).map(h=>({connector:h,isConfigured:!1}))];b({ordered:G,authStatusById:new Map(G.map(h=>[h.connector.id,h.isConfigured?h.connector.authenticated:!1]))}),M(h=>h?t.find(Y=>Y.id===h.id)??null:null)}catch(t){f(J(t,"Failed to load connectors"))}finally{A(!1)}},[r]);a.useEffect(()=>{V()},[V]);const T=g.trim().toLowerCase(),K=a.useMemo(()=>T?c.ordered.filter(({connector:t})=>{var s;return t.name.toLowerCase().includes(T)||(((s=t.description)==null?void 0:s.toLowerCase().includes(T))??!1)||t.url.toLowerCase().includes(T)}):c.ordered,[c.ordered,T]),Q=a.useMemo(()=>{const t=[];for(const s of K)if(s.isConfigured){const u=c.authStatusById.get(s.connector.id)??s.connector.authenticated;t.push(u===s.connector.authenticated?s.connector:{...s.connector,authenticated:u})}return t},[c.authStatusById,K]),W=a.useMemo(()=>{const t=[];for(const s of K)s.isConfigured||t.push(s.connector);return t},[K]),P=async(t,s=f)=>{z(!0),f(null);try{await t(),await V()}catch(u){throw s(J(u,"Request failed")),u}finally{z(!1)}},se=()=>{q(null),te(""),m(null)},le=async(t,s)=>{const u=s??(t.auth.type==="header"?{type:"header",...t.auth.headerName?{headerName:t.auth.headerName}:{}}:t.auth.type==="dcr"?{type:"dcr"}:{type:"none"});await r.createConnector({name:t.name,description:t.description??t.url,url:t.url,auth:u})},fe=t=>{if(t.auth.type==="header"){te(""),m(null),q(t);return}P(async()=>{await le(t),x(_.Settings.CONNECTOR_SAVED,{connector_name:t.name,mode:"create"})}).catch(()=>{})},be=t=>{if(t.preventDefault(),!d||!U.trim())return;const s=d;m(null),P(async()=>{const u={type:"header",apiKey:U.trim(),...s.auth.type==="header"&&s.auth.headerName?{headerName:s.auth.headerName}:{}};await le(s,u),se(),setTimeout(()=>{p==null||p.showSuccess({title:`${s.name} connected`}),x(_.Settings.CONNECTOR_SAVED,{connector_name:s.name,mode:"create"})},100)},m).catch(()=>{})},ie=async t=>{m(null),await P(async()=>{j?await r.updateConnector({id:j.id,...t}):await r.createConnector({...t})},m),setTimeout(()=>{p==null||p.showSuccess({title:`${t.name} ${j?"updated":"added"}`}),x(_.Settings.CONNECTOR_SAVED,{connector_name:t.name,mode:j?"update":"create"})},0)},ge=t=>{P(async()=>{await r.disconnectConnector({id:t.id}),x(_.Settings.CONNECTOR_DISCONNECTED,{connector_name:t.name}),M(null)}).catch(()=>{})},ye=()=>{o||(H(null),R(null))},ve=t=>{const s=r.deleteConnector;s&&(R(null),P(async()=>{await s({id:t.id}),x(_.Settings.CONNECTOR_DELETED,{connector_name:t.name}),H(null),M(null)},R).catch(()=>{}))},je=t=>{M(s=>(s==null?void 0:s.id)===t.id?t:s),b(s=>{const u=new Map(s.authStatusById);return u.set(t.id,t.authenticated),{ordered:s.ordered.map(O=>O.isConfigured&&O.connector.id===t.id?{connector:t,isConfigured:!0}:O),authStatusById:u}})},Ne=(t,s)=>{const u=ne[t.name],O=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:u?e.jsx(oe,{src:u,alt:t.name,className:"size-4.5"}):e.jsx(w,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:$("flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium",t.authenticated?"text-success-bg":"text-text-primary"),children:[e.jsx("span",{className:$("h-1.5 w-1.5 rounded-full",t.authenticated?"bg-success-bg":"bg-primary-button-bg")}),t.authenticated?"Connected":"Added"]})})]}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description})]})]}),G="flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0",h=t.auth.type==="dcr"&&!t.authenticated,Y=k&&he===t.id;return e.jsxs("article",{className:`${G} cursor-pointer transition-colors hover:bg-ghost-button-hover/60`,onClick:()=>{M(t)},children:[e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:O}),e.jsxs("div",{className:"flex items-center gap-2",children:[h?e.jsx(N.Secondary,{size:"small",type:"button",disabled:o||Y,onClick:L=>{L.stopPropagation(),re(t.id),n(t.id,we=>{re(null),we&&V()})},children:Y?"Connecting…":"Connect"}):null,e.jsxs(N.Secondary,{size:"small",type:"button",disabled:o,onClick:L=>{L.stopPropagation(),m(null),I(t),i(!0)},children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),r.deleteConnector?e.jsx(N.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:o,"aria-label":`Remove ${t.name}`,onClick:L=>{L.stopPropagation(),R(null),H(t)},children:"Remove"}):null,e.jsx(w,{name:"chevron-right",className:"size-4"})]})]},t.id)},Ce=t=>{const s=ne[t.name];return e.jsxs("article",{className:"flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:s?e.jsx(oe,{src:s,alt:t.name,className:"size-4.5"}):e.jsx(w,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description??t.url})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("span",{className:"hidden text-xs text-text-secondary sm:inline",children:Z[t.auth.type]??Z.none}),e.jsx(N.Secondary,{size:"small",type:"button",disabled:o,onClick:()=>{fe(t)},children:t.auth.type==="dcr"?"Add":"Connect"})]})]},t.id)},de=ee?e.jsx(ke,{title:"Remove connector?",description:`“${ee.name}” will no longer be available to your agents.`,busy:o,error:pe,onCancel:ye,onConfirm:()=>{ve(ee)}}):null;if(l)return e.jsxs(e.Fragment,{children:[e.jsx(Oe,{connector:l,busy:o,onBack:()=>{M(null)},onConnectorRefreshed:je,onEdit:()=>{m(null),I(l),i(!0)},onDisconnect:()=>{ge(l)},onRemove:r.deleteConnector?()=>{R(null),H(l)}:void 0}),e.jsx(ce,{open:D,onOpenChange:t=>{i(t),t||(I(null),m(null))},onSubmit:ie,connector:j??void 0,busy:o,error:C}),de]});const Se=Q.length>0||W.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Connectors"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Connect tools your agents can use."}),E?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:E}):null,e.jsx("div",{className:"mt-4 min-h-0 min-w-0 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full min-w-0 flex-col gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(ze,{query:g,setQuery:y,placeholder:"Search connectors"})}),e.jsxs(N.Secondary,{type:"button",className:"shrink-0",onClick:()=>{m(null),I(null),i(!0)},children:[e.jsx(w,{name:"plus",size:"1rem",className:"mr-1"}),"Add MCP Server"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[v?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!v&&Q.length>0?e.jsxs("section",{"aria-labelledby":"connected-connectors-heading",children:[e.jsxs("h4",{id:"connected-connectors-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Configured · ",Q.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:Q.map(t=>Ne(t))})]}):null,!v&&W.length>0?e.jsxs("section",{"aria-labelledby":"available-connectors-heading",children:[e.jsxs("h4",{id:"available-connectors-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Available · ",W.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:W.map(t=>Ce(t))})]}):null,!v&&!Se?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:g.trim()?`No connectors match “${g.trim()}”.`:"No connectors yet."}):null]}),e.jsx(xe,{open:d!==null,onOpenChange:t=>{t||se()},title:`Connect ${(d==null?void 0:d.name)??"connector"}`,description:d==null?void 0:d.url,contentSized:!0,className:"md:max-w-xl",children:e.jsxs("form",{onSubmit:be,children:[e.jsxs("div",{className:"space-y-5 px-5 py-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-6 text-text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-text-primary",children:d==null?void 0:d.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:d==null?void 0:d.description})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"connector-api-key",className:"mb-2 block text-xs font-semibold uppercase tracking-wide text-text-secondary",children:"API key / token"}),e.jsx("input",{id:"connector-api-key",type:"password",value:U,onChange:t=>{te(t.target.value)},placeholder:`Bearer <Paste the token from ${(d==null?void 0:d.name)??"the provider"}>`,autoFocus:!0,required:!0,className:X("h-11")})]}),C?e.jsx("p",{className:"text-failure-bg text-sm",children:C}):null]}),e.jsxs("footer",{className:"flex justify-end gap-2 border-t border-border px-5 py-4",children:[e.jsx(N.Ghost,{type:"button",onClick:se,disabled:o,children:"Cancel"}),e.jsx(N.Primary,{type:"submit",disabled:!U.trim()||o,children:"Connect"})]})]})}),e.jsx(ce,{open:D,onOpenChange:t=>{i(t),t||(I(null),m(null))},onSubmit:ie,connector:j??void 0,busy:o,error:C}),de]})})]})},Le=Re;export{Le as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{B as fe}from"./chunk-WG6NEBF3-D6-L7Ege.js";import{av as re,b as ge,aw as ve,U as ie,V as le,r as c,ax as z,w as oe,ay as X,az as ee,j as e,P as Ne,$ as be,a2 as L,I as R,a4 as q,a3 as je,aA as ye,a6 as ke,a7 as we,a8 as te,a9 as T,aa as Ee,ab as B,O as ce,au as Se,f as Q,a5 as Ce,g as I,ad as Ae,ae as Te,af as Be,ag as Pe,ah as De,ai as Le,ap as Re,al as Z,aB as _e}from"./index-Cq_o2Abd.js";var Ve="default";function me(t){return t.trim()===Ve}function Oe(t,l){return me(t.name)||l===void 0||t.createdBySubject.subjectId!==l}function ze(t){const l=(t==null?void 0:t.cpu)??1,s=(t==null?void 0:t.memory)??1,a=(t==null?void 0:t.disk)??3;return`${String(l)} vCPU · ${String(s)} GB RAM · ${String(a)} GB disk`}function Ie(t){var a;if((t==null?void 0:t.networkBlockAll)===!0)return"Blocked";const l=((a=t==null?void 0:t.domainAllowList)==null?void 0:a.trim())??"";if(l.length===0)return"Unrestricted";const s=l.split(",").map(n=>n.trim()).filter(n=>n.length>0).length;return s===0?"Unrestricted":`${String(s)} allowed domain${s===1?"":"s"}`}function ne(){return{name:"",description:"",image:{type:"build",buildScript:""},resources:{cpu:1,memory:1,disk:3},networking:{networkBlockAll:!1}}}function se(t){var l,s,a,n,m,r,o,u;return{name:t.name,description:t.description??"",buildScript:((l=t.image)==null?void 0:l.buildScript)??"",cpu:String(((s=t.resources)==null?void 0:s.cpu)??1),memory:String(((a=t.resources)==null?void 0:a.memory)??1),disk:String(((n=t.resources)==null?void 0:n.disk)??3),networkBlockAll:((m=t.networking)==null?void 0:m.networkBlockAll)===!0,domainAllowList:((r=t.networking)==null?void 0:r.domainAllowList)??"",secrets:((u=(o=t.networking)==null?void 0:o.secrets)==null?void 0:u.map(d=>({...d,hosts:[...d.hosts]})))??[],environmentVariables:Object.entries(t.environmentVariables??{}).map(([d,g])=>({key:d,value:g}))}}function Fe(t){const l=Number(t.cpu),s=Number(t.memory),a=Number(t.disk),n=Object.fromEntries(t.environmentVariables.map(r=>[r.key.trim(),r.value]).filter(([r,o])=>r.length>0&&o.length>0)),m=t.networkBlockAll?void 0:t.secrets.map(r=>({env:r.env.trim(),value:r.value,hosts:r.hosts.map(o=>o.trim()).filter(o=>o.length>0)})).filter(r=>r.env.length>0&&r.value.length>0);return{name:t.name.trim(),...t.description.trim().length===0?{}:{description:t.description.trim()},...t.buildScript.trim().length===0?{}:{image:{type:"build",buildScript:t.buildScript}},resources:{cpu:Number.isFinite(l)&&l>0?l:1,memory:Number.isFinite(s)&&s>0?s:1,disk:Number.isFinite(a)&&a>0?a:3},...Object.keys(n).length===0?{}:{environmentVariables:n},networking:t.networkBlockAll?{networkBlockAll:!0}:{networkBlockAll:!1,...t.domainAllowList.trim().length===0?{}:{domainAllowList:t.domainAllowList.trim()},...m==null||m.length===0?{}:{secrets:m}}}}function Me(t){const l=t.name.trim();if(l.length===0)return"Name is required";if(me(l))return'Name "default" is reserved';const s=Number(t.cpu),a=Number(t.memory),n=Number(t.disk);if(!Number.isFinite(s)||s<=0)return"CPU must be a positive number";if(!Number.isFinite(a)||a<=0)return"Memory must be a positive number";if(!Number.isFinite(n)||n<=0)return"Disk must be a positive number";if(!t.networkBlockAll){for(const m of t.secrets)if(m.env.trim().length!==0&&m.value.trim().length===0)return"Secret value is required"}return null}var f="w-full rounded-md border border-border bg-input-box-bg px-2.5 py-1.5 text-sm text-text-primary placeholder:text-text-secondary/70 outline-none focus:border-primary-button-bg",ae="text-sm font-medium text-text-primary",O="rounded-lg border border-border p-4 flex flex-col gap-4";function Ge({values:t,onChange:l,nameDisabled:s}){const a=n=>l({...t,...n});return e.jsxs("div",{className:"flex flex-col gap-4 pb-8",children:[e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:ae,children:"Name"}),e.jsx("input",{className:I(f,s&&"opacity-70"),value:t.name,disabled:s,placeholder:"my-environment",onChange:n=>a({name:n.target.value})})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:ae,children:"Description"}),e.jsx("textarea",{className:I(f,"min-h-20 resize-y"),value:t.description,placeholder:"write description ...",onChange:n=>a({description:n.target.value})})]}),e.jsxs("div",{className:O,children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Image And Resources"}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsxs("span",{className:"text-xs font-medium text-text-secondary",children:["Build Script (",t.buildScript.length,"/5120)"]}),e.jsx("textarea",{className:I(f,"min-h-24 resize-y font-mono text-xs"),value:t.buildScript,placeholder:`set -ex
|
|
2
|
-
pip install httpx
|
|
3
|
-
`,onChange:n=>a({buildScript:n.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"CPU"}),e.jsx("input",{className:f,type:"number",min:.1,step:"any",value:t.cpu,placeholder:"type...",onChange:n=>a({cpu:n.target.value})})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"Memory (GB)"}),e.jsx("input",{className:f,type:"number",min:.1,step:"any",value:t.memory,placeholder:"type...",onChange:n=>a({memory:n.target.value})})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"Disk (GB)"}),e.jsx("input",{className:f,type:"number",min:.1,step:"any",value:t.disk,placeholder:"type...",onChange:n=>a({disk:n.target.value})})]})]})]}),e.jsxs("div",{className:O,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Environment Variables"}),e.jsx("button",{type:"button",className:"cursor-pointer text-xs font-medium text-text-secondary transition-colors hover:text-text-primary",onClick:()=>a({environmentVariables:[...t.environmentVariables,{key:"",value:""}]}),children:"+ Add Variables"})]}),t.environmentVariables.map((n,m)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx("input",{className:f,value:n.key,placeholder:"KEY",onChange:r=>{const o=t.environmentVariables.map((u,d)=>d===m?{...u,key:r.target.value}:u);a({environmentVariables:o})}}),e.jsx("input",{className:f,value:n.value,placeholder:"value",onChange:r=>{const o=t.environmentVariables.map((u,d)=>d===m?{...u,value:r.target.value}:u);a({environmentVariables:o})}})]}),e.jsx("button",{type:"button",className:Q({variant:"ghost",size:"icon"}),"aria-label":"Remove environment variable",onClick:()=>a({environmentVariables:t.environmentVariables.filter((r,o)=>o!==m)}),children:e.jsx(R,{name:"trash",className:"size-3.5 text-failure-bg"})})]},m))]}),e.jsxs("div",{className:O,children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-medium text-text-primary",children:"Block All Network"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Overrides the domain allow list"})]}),e.jsx(_e,{checked:t.networkBlockAll,onCheckedChange:n=>a({networkBlockAll:n}),"aria-label":"Block All Network"})]}),t.networkBlockAll?null:e.jsxs("label",{className:"flex flex-col gap-1.5 pt-1",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"Domain Allow List"}),e.jsx("input",{className:f,value:t.domainAllowList,placeholder:"api.github.com,api.openai.com",onChange:n=>a({domainAllowList:n.target.value})})]})]}),t.networkBlockAll?null:e.jsxs("div",{className:O,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Secrets"}),e.jsxs("span",{className:"text-xs text-text-secondary",children:["Synced immediately with existing sandboxes."," ",e.jsxs("a",{href:"https://trueforge.dev/sandbox#how-changes-reach-a-running-session",target:"_blank",rel:"noreferrer",className:"text-primary-button-bg inline-flex items-center gap-1 hover:underline",children:["Learn more",e.jsx(R,{name:"external-link",className:"size-3"})]})]})]}),e.jsx("button",{type:"button",className:"cursor-pointer text-xs font-medium text-text-secondary transition-colors hover:text-text-primary",onClick:()=>a({secrets:[...t.secrets,{env:"",value:"",hosts:[]}]}),children:"+ Add Secret"})]}),t.secrets.map((n,m)=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx("input",{className:f,value:n.env,placeholder:"ENV_NAME",onChange:r=>{const o=t.secrets.map((u,d)=>d===m?{...u,env:r.target.value}:u);a({secrets:o})}}),e.jsx("input",{className:f,type:"password",value:n.value,placeholder:"value",onChange:r=>{const o=t.secrets.map((u,d)=>d===m?{...u,value:r.target.value}:u);a({secrets:o})}})]}),e.jsx("button",{type:"button",className:Q({variant:"ghost",size:"icon"}),"aria-label":"Remove secret",onClick:()=>a({secrets:t.secrets.filter((r,o)=>o!==m)}),children:e.jsx(R,{name:"trash",className:"size-3.5 text-failure-bg"})})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("input",{className:f,value:n.hosts.join(","),placeholder:"api.github.com,api.openai.com",onChange:r=>{const o=r.target.value.split(",").map(d=>d.trim()),u=t.secrets.map((d,g)=>g===m?{...d,hosts:o}:d);a({secrets:u})}}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Hosts allowed to resolve secret (comma-separated)."})]})]},m))]})]})}function Ue({open:t,onOpenChange:l,mode:s,environment:a,onSaved:n}){const m=re(),r=ie(),o=le(),[u,d]=c.useState(()=>se(ne())),[g,S]=c.useState(!1),[v,b]=c.useState(null);c.useEffect(()=>{if(!t){b(null),S(!1);return}const p=s==="edit"&&a!=null?a.manifest:ne();d(se(p)),b(null)},[t,s,a]);const C=async p=>{p.preventDefault(),b(null);const k=Me(u);if(k!=null){b(k);return}S(!0);try{const N=Fe(u),P=s==="create"?await m.createEnvironment({manifest:N}):await m.createOrUpdateEnvironment({manifest:N});o(s==="create"?Z.Environment.CREATED:Z.Environment.EDITED,{environment_name:P.name,environment_id:P.id}),r==null||r.showSuccess({title:s==="create"?"Environment created":"Environment updated"}),n==null||n(),l(!1)}catch(N){b(oe(N,"Failed to save environment")),r==null||r.showError(N)}finally{S(!1)}},y=s==="create"?"New environment":(a==null?void 0:a.name)??"Edit environment";return e.jsx(Re,{open:t,onOpenChange:l,title:y,description:"Configure the environment.",size:"xl",footer:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(L.Secondary,{type:"button",disabled:g,onClick:()=>l(!1),children:"Cancel"}),e.jsx(L.Primary,{type:"submit",form:"environment-form",disabled:g,children:g?"Saving…":s==="create"?"Create":"Save"})]}),children:e.jsxs("form",{id:"environment-form",className:"flex min-h-0 flex-1 flex-col gap-4 px-5 pt-4 pb-10",onSubmit:p=>void C(p),children:[v!=null?e.jsx("p",{className:"text-sm text-failure-bg",children:v}):null,e.jsx(Ge,{values:u,onChange:d,nameDisabled:s==="edit"})]})})}var He={pending:{label:"Building",variant:"info"},ready:{label:"Ready",variant:"success"},failed:{label:"Failed",variant:"destructive"}};function qe({status:t,statusReason:l}){const s=He[t],a=e.jsx(fe,{variant:s.variant,shape:"rounded",size:"sm",children:s.label});return t==="failed"&&l!=null&&l.length>0?e.jsx(ce,{content:l,children:a}):a}var $e=[10,25],Qe=1e4;function $(t){return Math.min(Math.max(t,1),25)}function Ze(){return z(window.location.search).isNew?{kind:"create"}:{kind:"closed"}}function We(t){const l=re(),s=ge(),a=ve(),n=ie(),m=le(),[r,o]=c.useState([]),[u,d]=c.useState(!0),[g,S]=c.useState(null),[v,b]=c.useState(()=>z(window.location.search).q??""),[C,y]=c.useState(()=>Ze()),[p,k]=c.useState(null),[N,P]=c.useState(!1),[w,de]=c.useState(()=>$(Le)),[_,D]=c.useState(void 0),[F,K]=c.useState(void 0),[M,G]=c.useState(void 0),V=c.useRef(0),Y=c.useRef(!1),J=c.useRef((s==null?void 0:s.settingsOpen)??!1),U=(s==null?void 0:s.settingsOpen)??!1,A=c.useCallback(async({token:i,size:x,silent:j=!1})=>{const E=++V.current;j||(d(!0),S(null));try{const h=await l.listEnvironments({limit:$(x),...i===void 0||i===""?{}:{pageToken:i}});if(E!==V.current)return;o(h.data),K(h.nextPageToken),G(h.previousPageToken)}catch(h){if(E!==V.current)return;j||(S(oe(h,"Check your connection and try again.")),o([]),K(void 0),G(void 0))}finally{E===V.current&&!j&&d(!1)}},[l]);c.useEffect(()=>{X({q:v.trim().length===0?null:v})},[v]),c.useEffect(()=>{A({token:_,size:w})},[A,w,_]),c.useEffect(()=>{J.current&&!U&&A({token:_,size:w}),J.current=U},[U,A,_,w]),c.useEffect(()=>{const i=r.filter(j=>j.status==="pending");if(i.length===0)return;const x=window.setInterval(async()=>{try{const E=(await Promise.all(i.map(h=>l.getEnvironment({name:h.name}).catch(()=>null)))).filter(h=>h!=null);if(E.length===0)return;o(h=>h.map(W=>E.find(he=>he.name===W.name)??W)),E.some(h=>h.status!=="pending")&&(s==null||s.invalidateEnvironmentsList())}catch{}},Qe);return()=>window.clearInterval(x)},[r,l,s]),c.useEffect(()=>{Y.current||z(window.location.search).isNew&&(Y.current=!0,y({kind:"create"}),X({isNew:null}))},[]),c.useEffect(()=>{const i=()=>{const x=z(window.location.search);b(x.q??""),x.isNew&&y({kind:"create"})};return window.addEventListener(ee,i),()=>window.removeEventListener(ee,i)},[]);const H=c.useMemo(()=>{const i=v.trim().toLowerCase();return i.length===0?r:r.filter(x=>x.name.toLowerCase().includes(i)||x.description.toLowerCase().includes(i))},[r,v]),ue=F!=null||M!=null||r.length>0,xe=()=>{y({kind:"create"})},pe=async()=>{if(p!=null){P(!0);try{await l.deleteEnvironment({name:p.name}),m(Z.Environment.DELETED,{environment_name:p.name,environment_id:p.id}),n==null||n.showSuccess({title:"Environment deleted"}),k(null),D(void 0),s==null||s.invalidateEnvironmentsList(),A({token:void 0,size:w})}catch(i){n==null||n.showError(i)}finally{P(!1)}}};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-primary-bg",children:[e.jsx(Ne,{title:"Environments",end:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-64",children:e.jsx(be,{query:v,setQuery:b,placeholder:"Search environments by name"})}),e.jsxs(L.Primary,{type:"button",onClick:xe,children:[e.jsx(R,{name:"plus",className:"size-3.5"}),"New Environment"]})]})}),e.jsx("div",{className:I("min-h-0 flex-1 overflow-auto px-4 py-4",g!=null?"flex flex-col":void 0),children:g!=null?e.jsx("div",{role:"alert",className:"flex flex-1 flex-col items-center justify-center",children:e.jsx(q,{title:"Couldn't load environments",description:g,className:"h-auto min-h-0 flex-none py-0"})}):u?e.jsx("div",{className:"flex flex-col gap-2",role:"status","aria-label":"Loading environments",children:Array.from({length:5},(i,x)=>e.jsx(je,{className:"h-12 w-full rounded-md"},x))}):r.length===0?e.jsx(q,{title:"No environments yet",description:"Create an environment to customize sandbox images, resources, and networking.",className:"min-h-full"}):H.length===0?e.jsx(q,{title:"No environments found",description:e.jsxs(e.Fragment,{children:["No environments match ",e.jsx(ye,{children:v.trim()}),"."]}),className:"min-h-full"}):e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs(ke,{className:"min-w-240",children:[e.jsx(we,{children:e.jsxs(te,{className:"hover:bg-transparent",children:[e.jsx(T,{className:"w-96 max-w-96",children:"Name"}),e.jsx(T,{children:"Build Status"}),e.jsx(T,{children:"Resources"}),e.jsx(T,{children:"Networking"}),e.jsx(T,{children:"Updated"}),e.jsx(T,{className:"w-16"})]})}),e.jsx(Ee,{children:H.map(i=>{const x=Oe(i,a==null?void 0:a.subjectId);return e.jsxs(te,{className:x?void 0:"cursor-pointer",onClick:()=>{x||y({kind:"edit",environment:i})},children:[e.jsx(B,{className:"w-96 max-w-96",children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:i.name}),i.description.length>0?e.jsx(ce,{content:i.description,className:"max-w-sm whitespace-normal text-left",triggerClassName:"block min-w-0 w-full max-w-full",children:e.jsx("span",{className:"block truncate text-xs text-text-secondary",children:i.description})}):null]})}),e.jsx(B,{children:e.jsx(qe,{status:i.status,statusReason:i.statusReason})}),e.jsx(B,{className:"text-sm text-text-secondary",children:ze(i.manifest.resources)}),e.jsx(B,{className:"text-sm text-text-secondary",children:Ie(i.manifest.networking)}),e.jsx(B,{className:"text-sm text-text-secondary",children:x?"—":Se(i.updatedAt)}),e.jsx(B,{children:x?null:e.jsx("button",{type:"button",className:Q({variant:"ghost",size:"icon"}),"aria-label":`Delete ${i.name}`,onClick:j=>{j.stopPropagation(),k(i)},children:e.jsx(R,{name:"trash",className:"size-3.5 text-failure-bg"})})})]},i.id)})})]}),ue?e.jsx(Ce,{pageSize:w,rowCount:H.length,canPrev:M!=null,canNext:F!=null,onPrev:()=>D(M),onNext:()=>D(F),pageSizeOptions:$e,onPageSizeChange:i=>{de($(i)),D(void 0),G(void 0)}}):null]})}),e.jsx(Ue,{open:C.kind!=="closed",mode:C.kind==="edit"?"edit":"create",...C.kind==="edit"?{environment:C.environment}:{},onOpenChange:i=>{i||y({kind:"closed"})},onSaved:()=>{D(void 0),s==null||s.invalidateEnvironmentsList(),A({token:void 0,size:w})}}),e.jsx(Ae,{open:p!=null,onOpenChange:i=>!i&&k(null),children:e.jsxs(Te,{children:[e.jsx(Be,{children:e.jsx(Pe,{children:"Delete environment"})}),e.jsxs("p",{className:"text-sm text-text-secondary",children:["Delete ",e.jsx("span",{className:"font-medium text-text-primary",children:p==null?void 0:p.name}),"? This cannot be undone. Delete fails if any agent still references the environment."]}),e.jsxs(De,{children:[e.jsx(L.Secondary,{type:"button",disabled:N,onClick:()=>k(null),children:"Cancel"}),e.jsx(L.Primary,{type:"button",disabled:N,onClick:()=>void pe(),children:N?"Deleting…":"Delete"})]})]})})]})}export{We as EnvironmentsPage,Qe as PENDING_ENVIRONMENTS_POLL_INTERVAL_MS};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as we}from"./chunk-2UUABLZI-Dls_33ja.js";import{b5 as Ee,U as Ce,V as ke,r as l,w as W,j as e,$ as Se,a2 as B,I as U,b6 as fe,b7 as ye,b8 as Me,b9 as Le,g as P,ba as Pe,al as de,as as Ue}from"./index-Cq_o2Abd.js";var ve=Ue("h-11 shadow-sm"),Te=({open:a,onOpenChange:i,onSave:f,title:j,description:N,initialBaseUrl:g="",baseUrlPlaceholder:h="https://api.openai.com/v1",requireApiKey:o=!0,submitLabel:K="Save",busy:M=!1,error:$})=>{const[A,C]=l.useState(""),[q,x]=l.useState(""),[p,I]=l.useState(!1),T=()=>{C(""),x(""),I(!1)};l.useEffect(()=>{a&&(C(""),x(g),I(!1))},[a,g]);const H=d=>{d||T(),i(d)},R=A.trim(),_=!o||!!R,J=async d=>{if(d.preventDefault(),!(!_||M))try{await f({apiKey:R,baseUrl:q.trim()}),T(),i(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:H,title:j,description:N,contentSized:!0,children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:J,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"model-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",o?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"model-provider-api-key",type:"password",required:o,value:A,onChange:d=>{C(d.target.value)},placeholder:o?"Enter API key":"Enter a new key",autoFocus:!0,className:ve}),o?null:e.jsx("p",{className:"mt-1.5 text-xs text-text-secondary",children:"Leave blank to keep the current key; enter a new one to replace it."})]}),e.jsxs(Me,{expanded:p,onChange:(d,ae)=>I(ae),className:"rounded-md border border-border",children:[e.jsx(Le,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced · custom endpoint",e.jsx(U,{name:"chevron-down",className:P("size-4 shrink-0 text-text-secondary transition-transform duration-200",p?"rotate-0":"-rotate-90")})]})}),e.jsxs(Pe,{className:"space-y-1.5 border-t border-border px-3 pb-3 pt-4",children:[e.jsx("label",{htmlFor:"model-provider-base-url",className:"block text-sm font-medium text-text-primary",children:"Base URL"}),e.jsx("input",{id:"model-provider-base-url",type:"url",value:q,onChange:d=>{x(d.target.value)},placeholder:h,className:ve}),e.jsx("p",{className:"text-xs text-text-secondary",children:"Leave blank unless you use a regional or proxy endpoint."})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[$?e.jsx("p",{className:"text-failure-bg text-sm",children:$}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!_||M,className:"w-full shrink-0",children:K})]})]})})},Re=Te,Oe="128000",De="4096",je=()=>({id:"",name:"",advancedExpanded:!0,contextLength:"",maxOutputTokens:""}),ge=a=>(a==null?void 0:a.models.map(i=>{var f,j,N,g,h;return{id:i.id,name:i.name,advancedExpanded:!0,reasoningEfforts:(f=i.properties)==null?void 0:f.reasoningEfforts,contextLength:((N=(j=i.properties)==null?void 0:j.contextLength)==null?void 0:N.toString())??"",maxOutputTokens:((h=(g=i.properties)==null?void 0:g.maxOutputTokens)==null?void 0:h.toString())??"",nameDirty:!0}}))??[je()],Z="h-11 w-full rounded-md border border-border/70 bg-secondary-bg px-3 text-sm text-text-primary outline-none transition-colors placeholder:text-text-secondary/70 focus-visible:border-focus-ring focus-visible:ring-2 focus-visible:ring-focus-ring/50",se="border-failure-bg focus-visible:border-failure-bg focus-visible:ring-failure-bg";function pe(a){const i=a.trim();if(i==="")return null;const f=Number(i);return Number.isInteger(f)&&f>0?f:null}function $e(a){return a.replace(/([a-zA-Z])(\d)/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/g,"")}var ie=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),re=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-failure-bg",children:a}),ce=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:a}),Ae=({open:a,onOpenChange:i,onSubmit:f,reasoningEffortOptions:j,busy:N=!1,error:g,isEditMode:h=!1,initialValues:o})=>{const[K,M]=l.useState((o==null?void 0:o.name)??""),[$,A]=l.useState((o==null?void 0:o.baseUrl)??""),[C,q]=l.useState(""),[x,p]=l.useState(()=>ge(o)),[I,T]=l.useState(!1),[H,R]=l.useState(!1),_=()=>{M((o==null?void 0:o.name)??""),A((o==null?void 0:o.baseUrl)??""),q(""),p(ge(o)),T(!1),R(!1)},J=s=>{s||_(),i(s)},d=(s,r)=>{p(y=>y.map((m,b)=>b===s?{...m,...r}:m))},ae=()=>{T(!0),R(!0),p(s=>s.map(r=>({...r,idTouched:!0,contextTouched:!0,maxTouched:!0})))},Y=K.trim(),v=Y?null:"Name is required.",z=$.trim();let k=null;if(!z)k="Base URL is required.";else try{new URL(z)}catch{k="Enter a valid URL."}const Q=s=>s.id.trim()?null:"Model ID is required.",me=s=>s.name.trim()?null:"Model name is required.",O=s=>pe(s.contextLength)==null?"Set the model's context window.":null,ne=s=>pe(s.maxOutputTokens)==null?"Set the max output tokens.":null,w=!v&&!k&&x.every(s=>!Q(s)&&!me(s)),X=I&&v,V=H&&k,oe=async()=>{if(ae(),!w||N)return;const s=x.findIndex(r=>O(r)||ne(r));if(s!==-1){d(s,{advancedExpanded:!0});const r=x[s],y=r&&O(r)?"context-length":"max-output-tokens";setTimeout(()=>{var b;const m=document.getElementById(`custom-provider-model-${s}-${y}`);(b=m==null?void 0:m.scrollIntoView)==null||b.call(m,{block:"center",behavior:"smooth"}),m==null||m.focus()},0);return}try{await f({name:Y,baseUrl:z,apiKey:C.trim(),models:x.map(r=>{var F;const y={};(F=r.reasoningEfforts)!=null&&F.length&&(y.reasoningEfforts=r.reasoningEfforts);const m=pe(r.contextLength);m!=null&&(y.contextLength=m);const b=pe(r.maxOutputTokens);return b!=null&&(y.maxOutputTokens=b),{id:r.id.trim(),name:r.name.trim(),...Object.keys(y).length>0?{properties:y}:{}}})}),J(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:J,title:h?`Edit ${(o==null?void 0:o.name)??K}`:"Add custom provider",description:h?"Update the endpoint, credentials, and models for this provider.":"Connect any OpenAI-compatible endpoint, whether it's a local model, a proxy, or your own hosted service.",contentSized:!0,children:e.jsxs("form",{className:"flex min-h-0 flex-auto flex-col",onSubmit:s=>{s.preventDefault(),oe()},children:[e.jsxs("div",{className:"min-h-0 flex-auto space-y-4 overflow-y-auto px-5 pt-4 pb-8",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Name",e.jsx(ie,{})]}),e.jsx("input",{id:"custom-provider-name",type:"text",value:K,onChange:s=>M(s.target.value),onBlur:()=>T(!0),placeholder:"local-llama",autoFocus:!h,readOnly:h,"aria-readonly":h,"aria-invalid":X?!0:void 0,className:P(Z,h&&"cursor-not-allowed bg-secondary-bg/60 text-text-secondary",X&&se)}),h?e.jsx(ce,{children:"Provider names cannot be changed after creation."}):null,X?e.jsx(re,{children:v}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-base-url",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Base URL",e.jsx(ie,{})]}),e.jsx("input",{id:"custom-provider-base-url",type:"text",value:$,onChange:s=>A(s.target.value),onBlur:()=>R(!0),placeholder:"http://localhost:11434/v1",autoFocus:h,"aria-invalid":V?!0:void 0,className:P(Z,V&&se)}),V?e.jsx(re,{children:k}):z?null:e.jsx(ce,{children:"OpenAI-compatible endpoint, usually ending in /v1."})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"custom-provider-api-key",type:"password",value:C,onChange:s=>q(s.target.value),placeholder:"sk-…",className:Z}),e.jsx(ce,{children:h?"Leave blank to keep the saved key, or enter a new key to replace it.":"Leave blank if your endpoint needs no key (e.g. a local model)."})]}),e.jsxs("fieldset",{className:"m-0 min-w-0 border-0 p-0",children:[e.jsxs("legend",{className:"float-left mb-2 w-full p-0 text-sm font-medium text-text-primary",children:["Models",e.jsx(ie,{})]}),e.jsx("div",{className:"clear-both",children:x.map((s,r)=>{const y=Q(s),m=s.idTouched&&y,b=me(s),F=!!b&&s.nameDirty,ue=O(s),xe=ne(s),ee=s.contextTouched&&ue,le=s.maxTouched&&xe;return e.jsxs("div",{className:P("pb-6",r>0?"border-t border-border pt-6":"pt-1"),style:r>0?{borderTopWidth:"0.5px"}:void 0,children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_2rem] items-end gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-id`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model ID"}),e.jsx("input",{id:`custom-provider-model-${r}-id`,type:"text",value:s.id,onChange:u=>{const D=u.target.value;d(r,{id:D,...s.nameDirty?{}:{name:$e(D)}})},onBlur:()=>d(r,{idTouched:!0}),placeholder:"llama3.1:70b","aria-invalid":m?!0:void 0,className:P(Z,"font-mono",m&&se)})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-name`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model name"}),e.jsx("input",{id:`custom-provider-model-${r}-name`,type:"text",value:s.name,onChange:u=>d(r,{name:u.target.value,nameDirty:!0}),placeholder:"llama-3-1-70b","aria-invalid":F?!0:void 0,className:P(Z,F&&se)})]}),e.jsx("button",{type:"button","aria-label":`Remove model ${r+1}`,disabled:x.length===1||N,className:"mb-0.5 flex size-9 items-center justify-center rounded-md text-text-secondary transition-colors hover:text-text-primary disabled:opacity-40",onClick:()=>p(u=>u.filter((D,te)=>te!==r)),children:e.jsx(U,{name:"trash",className:"size-4"})})]}),m?e.jsx(re,{children:y}):null,F?e.jsx(re,{children:b}):null,e.jsxs("div",{className:"mt-2",children:[e.jsxs("button",{type:"button","aria-expanded":s.advancedExpanded,"aria-controls":`custom-provider-model-${r}-advanced`,className:"flex cursor-pointer items-center gap-1.5 text-sm font-medium text-text-primary",onClick:()=>d(r,{advancedExpanded:!s.advancedExpanded}),children:[e.jsx(U,{name:"chevron-down",className:P("size-4 text-text-secondary transition-transform",s.advancedExpanded?"":"-rotate-90")}),"Advanced"]}),s.advancedExpanded?e.jsxs("div",{id:`custom-provider-model-${r}-advanced`,className:"mt-3 space-y-4 pl-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-context-length`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Context length",e.jsx(ie,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-context-length`,type:"number",min:1,inputMode:"numeric",value:s.contextLength,onChange:u=>d(r,{contextLength:u.target.value}),onBlur:()=>d(r,{contextTouched:!0}),placeholder:Oe,"aria-invalid":ee?!0:void 0,className:P(Z,ee&&se)}),ee?e.jsx(re,{children:ue}):s.contextLength.trim()===""?e.jsx(ce,{children:"Model's total token window."}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-max-output-tokens`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Max output tokens",e.jsx(ie,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-max-output-tokens`,type:"number",min:1,inputMode:"numeric",value:s.maxOutputTokens,onChange:u=>d(r,{maxOutputTokens:u.target.value}),onBlur:()=>d(r,{maxTouched:!0}),placeholder:De,"aria-invalid":le?!0:void 0,className:P(Z,le&&se)}),le?e.jsx(re,{children:xe}):s.maxOutputTokens.trim()===""?e.jsx(ce,{children:"Longest reply the model allows — use its real limit."}):null]}),j&&j.length>0?e.jsxs("div",{children:[e.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 select-none",children:[e.jsx("input",{type:"checkbox",className:"size-4 shrink-0 cursor-pointer accent-primary-button-bg disabled:cursor-not-allowed disabled:opacity-50",checked:s.reasoningEfforts!==void 0,"aria-label":`Enable reasoning effort for model ${r+1}`,disabled:N,onChange:u=>d(r,{reasoningEfforts:u.target.checked?[]:void 0})}),e.jsx("span",{className:"text-text-secondary text-xs font-medium",children:"Reasoning effort"})]}),s.reasoningEfforts!==void 0?e.jsx("div",{role:"group","aria-label":`Supported reasoning efforts for model ${r+1}`,className:"mt-2 flex flex-wrap gap-2",children:j.map(u=>{var te;const D=((te=s.reasoningEfforts)==null?void 0:te.includes(u))??!1;return e.jsx("button",{type:"button","aria-pressed":D,disabled:N,className:P("rounded-full border px-3 py-1 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/40 disabled:opacity-50",D?"border-primary-button-bg bg-primary-button-bg text-primary-button-text":"border-border text-text-secondary hover:bg-ghost-button-hover"),onClick:()=>{var S;return d(r,{reasoningEfforts:D?(S=s.reasoningEfforts)==null?void 0:S.filter(G=>G!==u):[...s.reasoningEfforts??[],u]})},children:u},u)})}):null]}):null]}):null]})]},r)})}),e.jsxs(B.Secondary,{size:"small",type:"button",className:"mt-4 w-fit",onClick:()=>p(s=>[...s,je()]),children:[e.jsx(U,{name:"plus",className:"size-3.5"}),"Add model"]})]})]}),e.jsxs("div",{className:"shrink-0 space-y-3 border-t border-border px-5 py-4",children:[g?e.jsx("p",{className:"text-failure-bg text-sm",children:g}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!w||N,className:"w-full",children:h?"Save changes":"Add provider"})]})]})})},Ie=Ae;function he(a){return a.kind==="model"&&a.provider.models.length===1}function _e(a){return a.kind==="provider"?`“${a.provider.name}” and all of its models will no longer be available to your agents.`:he(a)?`“${a.model.name}” is the only model left in ${a.provider.name}, so the whole provider will be removed.`:`“${a.model.name}” will no longer be available to your agents. The rest of ${a.provider.name} stays configured.`}function ze(a){return"baseUrl"in a&&typeof a.baseUrl=="string"?a.baseUrl:""}var Fe=()=>{const{modelCatalog:a}=Ee(),i=Ce(),f=ke(),[j,N]=l.useState(""),[g,h]=l.useState([]),[o,K]=l.useState([]),[M,$]=l.useState(!0),[A,C]=l.useState(null),[q,x]=l.useState(null),[p,I]=l.useState(!1),[T,H]=l.useState(null),[R,_]=l.useState(null),[J,d]=l.useState(null),[ae,Y]=l.useState(!1),[v,z]=l.useState(null),[k,Q]=l.useState(null),[me,O]=l.useState(null),ne=l.useMemo(()=>(o??[]).reduce((t,n)=>(t[n.name]=n.logo??"",t),{}),[o]),w=j.trim().toLowerCase(),X=l.useCallback(async()=>{$(!0),C(null);try{const[t,n]=await Promise.all([a.listModelProviders(),a.getModelProviderCatalog()]);h(t),K(n)}catch(t){C(W(t,"Failed to load model providers"))}finally{$(!1)}},[a]);l.useEffect(()=>{X()},[X]);const V=l.useMemo(()=>new Set(g.map(t=>t.type)),[g]),oe=l.useMemo(()=>g.filter(t=>{var n;return((n=t.name)==null?void 0:n.toLowerCase().includes(w))||t.models.some(c=>c.name.toLowerCase().includes(w)||c.id.toLowerCase().includes(w))}),[g,w]),s=l.useMemo(()=>o.filter(t=>t.type!=="custom"&&!V.has(t.type)&&(t.name.toLowerCase().includes(w)||t.models.some(n=>n.name.toLowerCase().includes(w)||n.id.toLowerCase().includes(w)))),[o,V,w]),r=l.useMemo(()=>{var t;return(t=o.find(n=>n.type==="custom"))==null?void 0:t.supportedReasoningEfforts},[o]),y=l.useMemo(()=>{const t=new Map;for(const n of o)t.set(n.type,n.models);return t},[o]),m=()=>{H(null),_(null),d(null)},b=async(t,n)=>{I(!0),C(null);try{await t(),await X(),m()}catch(c){throw n?n(c):i==null?C(W(c,"Request failed")):i.showError(c),c}finally{I(!1)}},F=async(t,n)=>{d(null),await b(async()=>{await a.createModelProvider({type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},c=>d(W(c,"Request failed"))),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"create"})},ue=async(t,n)=>{d(null),await b(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},c=>d(W(c,"Request failed"))),i==null||i.showSuccess({title:`${t.name} updated`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"update"})},xe=()=>{p||(Q(null),O(null))},ee=({provider:t,models:n},c)=>b(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...t.baseUrl?{baseUrl:t.baseUrl}:{},apiKey:"",models:n})},c),le=t=>{O(null);const n=L=>O(W(L,"Request failed"));let c;if(t.kind==="model"&&!he(t))c=ee({provider:t.provider,models:t.provider.models.filter(L=>L.id!==t.model.id)},n);else{const L=a.deleteModelProvider;L!==void 0&&(c=b(async()=>{await L({id:t.provider.id}),f(de.Settings.MODEL_PROVIDER_DELETED,{provider_name:t.provider.name})},n))}c==null||c.then(()=>Q(null)).catch(()=>{})},u=async t=>{x(null),await b(async()=>{await a.createModelProvider({type:"custom",name:t.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},n=>x(W(n,"Request failed"))),setTimeout(()=>{i==null||i.showSuccess({title:`${t.name} added`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"create"})},0)},D=async t=>{if(!v)return;const n=v;x(null),await b(async()=>{await a.updateModelProvider({id:n.id,type:n.type,name:n.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},c=>x(W(c,"Request failed"))),setTimeout(()=>{i==null||i.showSuccess({title:"Model provider updated",description:`${n.name} was updated successfully.`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:n.name,mode:"update"})},0)},te=v?{name:v.name,baseUrl:v.baseUrl??"",models:v.models}:void 0,S=T!=null?g.find(t=>t.id===T)??null:null,G=R!=null?o.find(t=>t.type===R)??null:null,Ne=S!=null||G!=null;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Models"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Connect providers and choose which models are available."}),A?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:A}):null,e.jsx("div",{className:"mt-4 min-h-0 min-w-0 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full min-w-0 flex-col gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Se,{query:j,setQuery:N,placeholder:"Search providers and models"})}),e.jsxs(B.Secondary,{type:"button",className:"shrink-0 sm:self-auto",onClick:()=>{x(null),z(null),Y(!0)},children:[e.jsx(U,{name:"plus",size:"1rem",className:"mr-1"}),"Add Custom Provider"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 overflow-y-auto",children:[M?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!M&&oe.length>0?e.jsxs("section",{"aria-labelledby":"configured-providers-heading",children:[e.jsx("div",{id:"configured-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Configured"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:oe.map(t=>{const n=y.get(t.type)??[],c=new Set(t.models.map(E=>E.id)),L=n.filter(E=>!c.has(E.id)),be=ne[t.name];return e.jsxs("article",{className:"border-b border-border p-3 last:border-b-0",children:[e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:be?e.jsx(fe,{src:be,alt:t.name,className:"size-4.5"}):e.jsx(U,{name:"cpu",className:"size-4.5"})}),e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-success-bg",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success-bg"}),"Connected"]}),e.jsxs(B.Secondary,{size:"small",className:"text-[0.8125rem]",type:"button","aria-label":`Edit ${t.name}`,title:`Edit ${t.name}`,disabled:p,onClick:()=>{t.type==="custom"?(m(),x(null),z(t),Y(!0)):(d(null),_(null),H(t.id))},children:[e.jsx(U,{name:"pencil",className:"size-3.5"}),"Edit"]}),a.deleteModelProvider?e.jsx(B.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:p,onClick:()=>{O(null),Q({kind:"provider",provider:t})},children:"Remove"}):null]})]}),e.jsxs("div",{className:"mt-3 overflow-hidden rounded-lg border border-border bg-secondary-bg/30",children:[t.models.map(E=>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:E.name}),t.models.length>1||a.deleteModelProvider?e.jsx("button",{type:"button","aria-label":`Remove ${E.name}`,disabled:p,className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring disabled:opacity-50",onClick:()=>{O(null),Q({kind:"model",provider:t,model:E})},children:e.jsx(U,{name:"trash",className:"size-3.5"})}):null]},E.id)),L.length>0?e.jsxs("section",{children:[e.jsxs("div",{className:"border-b border-border bg-secondary-bg/40 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available to add · ",L.length]}),L.map(E=>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:E.name}),e.jsx(B.Secondary,{size:"small",type:"button",disabled:p,onClick:()=>{ee({provider:t,models:[...t.models,E]}).catch(()=>{})},children:"Add"})]},E.id))]}):null]})]},t.id)})})]}):null,!M&&s.length>0?e.jsxs("section",{"aria-labelledby":"available-providers-heading",className:"mt-2",children:[e.jsx("div",{id:"available-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Available"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:s.map(t=>{const n=ne[t.name];return e.jsx("article",{className:"border-b border-border p-3 last:border-b-0",children:e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:n?e.jsx(fe,{src:n,alt:t.name,className:"size-4.5"}):e.jsx(U,{name:"cpu",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:t.models.map(c=>c.name).join(" · ")})]})]}),e.jsxs(B.Secondary,{type:"button",disabled:p,onClick:()=>{d(null),H(null),_(t.type)},children:[e.jsx(U,{name:"wrench",className:"size-4"}),"Configure"]})]})},t.type)})})]}):null,!M&&oe.length===0&&s.length===0?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:w?`No providers match “${j.trim()}”.`:"No model providers yet."}):null]}),k?e.jsx(we,{title:k.kind==="model"&&!he(k)?"Remove model?":"Remove provider?",description:_e(k),busy:p,error:me,onCancel:xe,onConfirm:()=>{le(k)}}):null,e.jsx(Re,{open:Ne,onOpenChange:t=>{t||m()},onSave:t=>{if(S)return ue(S,t);if(G)return F(G,t)},title:S?"Edit Provider Details":"Configure Provider Details",initialBaseUrl:S?S.baseUrl??"":G?ze(G):"",requireApiKey:S==null,submitLabel:S?"Save":"Create",busy:p,error:J}),e.jsx(Ie,{open:ae,onOpenChange:t=>{Y(t),t||(x(null),z(null))},isEditMode:v!==null,initialValues:te,onSubmit:v?D:u,reasoningEffortOptions:r,busy:p,error:q},(v==null?void 0:v.id)??"add-custom-provider")]})})]})},qe=Fe;export{qe as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{B as Ye}from"./chunk-WG6NEBF3-D6-L7Ege.js";import{Q as pe,R as Ie,U as Ne,V as Le,r as i,W as fe,w as Ze,X as Te,Y as je,Z as Je,j as e,P as Xe,$ as et,a0 as ue,a1 as Fe,y as _e,a2 as M,I as C,a3 as tt,a4 as xe,a5 as Ce,a6 as st,a7 as at,a8 as Ee,a9 as W,aa as nt,ab as Q,O as Me,ac as rt,g as K,ad as lt,ae as it,af as ct,ag as ot,ah as dt,ai as ut,d as mt,aj as xt,ak as he,f as ht,al as ee,am as ft,b as gt,an as bt,ao as pt,ap as Nt,aq as jt,ar as yt,as as ze,l as vt,at as St,au as kt}from"./index-Cq_o2Abd.js";var Ae=[{value:"America/New_York",label:"America/New_York (ET)"},{value:"America/Chicago",label:"America/Chicago (CT)"},{value:"America/Denver",label:"America/Denver (MT)"},{value:"America/Los_Angeles",label:"America/Los_Angeles (PT)"},{value:"UTC",label:"UTC"},{value:"Europe/London",label:"Europe/London (GMT/BST)"},{value:"Europe/Berlin",label:"Europe/Berlin (CET)"},{value:"Asia/Kolkata",label:"Asia/Kolkata (IST)"},{value:"Asia/Tokyo",label:"Asia/Tokyo (JST)"}];function $e(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function wt(t){const a=$e(),l=new Set(Ae.map(c=>c.value));return[...[a,t].flatMap(c=>c==null||c.length===0||l.has(c)?[]:(l.add(c),[{value:c,label:c===a?`${c} (Local)`:c}])),...Ae]}var Oe=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}],Tt={"America/New_York":"ET","America/Chicago":"CT","America/Denver":"MT","America/Los_Angeles":"PT",UTC:"UTC","Europe/London":"GMT","Europe/Berlin":"CET","Asia/Kolkata":"IST","Asia/Tokyo":"JST"};function me(){return{name:"",task:"",recurrence:"daily",hour:9,minute:0,weekdays:[1],customCron:"0 9 * * *",timezone:$e()}}function Ct(t){return Tt[t]??t.split("/").pop()??t}function Be(t){return t.toString().padStart(2,"0")}function ce({hour:t,minute:a}){const l=t>=12?"PM":"AM",r=t%12===0?12:t%12;return`${String(r)}:${Be(a)} ${l}`}function ge(t){const a=t.minute,l=t.hour;switch(t.recurrence){case"hourly":return`${String(a)} * * * *`;case"daily":return`${String(a)} ${String(l)} * * *`;case"weekly":{const r=[...t.weekdays].sort((o,N)=>o-N),c=r.length>0?r.join(","):"*";return`${String(a)} ${String(l)} * * ${c}`}case"custom":return t.customCron.trim()}}function ae(t){const a=Ct(t.timezone),l=t.cron.trim().split(/\s+/);if(l.length!==5)return t.cron;const[r,c,o,N,g]=l;if(o!=="*"||N!=="*")return t.cron;const x=Number(r),d=Number(c);if(c==="*"&&g==="*"&&r!==void 0&&!Number.isNaN(x))return`Hourly at :${Be(x)} ${a}`;if(g==="*"&&c!==void 0&&r!==void 0&&!Number.isNaN(d)&&!Number.isNaN(x))return`Daily ${ce({hour:d,minute:x})} ${a}`;if(g==="1-5"&&c!==void 0&&r!==void 0&&!Number.isNaN(d)&&!Number.isNaN(x))return`Weekdays ${ce({hour:d,minute:x})} ${a}`;if(g!=null&&/^\d(?:,\d)*$/.test(g)&&c!==void 0&&r!==void 0&&!Number.isNaN(d)&&!Number.isNaN(x)){const k=g.split(",").map(h=>{var w;return((w=Oe.find(n=>n.value===Number(h)))==null?void 0:w.label)??h});return k.length===1?`Every ${k[0]==="Mon"?"Monday":k[0]} ${ce({hour:d,minute:x})} ${a}`:`${k.join(", ")} ${ce({hour:d,minute:x})} ${a}`}return t.cron}function Re(t){const a=me(),l=t.cron.trim().split(/\s+/);if(l.length!==5)return{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron};const[r,c,o,N,g]=l,x=Number(r),d=Number(c);return o!=="*"||N!=="*"?{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron}:c==="*"&&g==="*"&&!Number.isNaN(x)?{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"hourly",minute:x,customCron:t.cron}:g==="*"&&!Number.isNaN(d)&&!Number.isNaN(x)?{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"daily",hour:d,minute:x,customCron:t.cron}:g!=null&&/^\d(?:,\d)*$/.test(g)&&!Number.isNaN(d)&&!Number.isNaN(x)?{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"weekly",hour:d,minute:x,weekdays:g.split(",").map(Number),customCron:t.cron}:{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron,hour:Number.isNaN(d)?a.hour:d,minute:Number.isNaN(x)?a.minute:x}}function Et(t,a=Date.now()){return kt(t,{fallback:"Never",nowMs:a})}var zt=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"}],At=Array.from({length:24},(t,a)=>({value:String(a),label:a.toString().padStart(2,"0")})),Rt=[0,15,30,45].map(t=>({value:String(t),label:`:${t.toString().padStart(2,"0")}`}));function Pt({values:t,onChange:a,agentId:l,agentLabel:r,onAgentIdChange:c,onAgentPicked:o,agentPickerDisabled:N=!1,onBuildAgent:g}){const x=ge(t),d=ae({cron:x,timezone:t.timezone}),k=wt(t.timezone),h=(n,p)=>{a({...t,[n]:p})},w=n=>{const T=t.weekdays.includes(n)?t.weekdays.filter(E=>E!==n):[...t.weekdays,n];a({...t,weekdays:T.length>0?T:[n]})};return e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Agent"}),e.jsx(Fe,{"aria-label":"Agent",placeholder:"Search agent",value:l,selectedLabel:r,onValueChange:n=>c==null?void 0:c(n),onAgentPicked:o,disabled:N||c==null,onBuildAgent:g})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Name"}),e.jsx("input",{value:t.name,onChange:n=>h("name",n.target.value),placeholder:"harness-daily-digest",className:ze("h-8"),required:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Task"}),e.jsx("textarea",{value:t.task,onChange:n=>h("task",n.target.value),rows:3,placeholder:"Summarise yesterday's harness runs and post the digest…",className:ze("resize-y py-2"),required:!0})]}),e.jsxs("fieldset",{children:[e.jsx("legend",{className:"mb-1.5 text-sm font-medium",children:"Frequency"}),e.jsx("div",{className:"rounded-t-lg border border-border p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg border border-border bg-primary-bg p-1",children:zt.map(n=>{const p=t.recurrence===n.value;return e.jsx("button",{type:"button",className:K("rounded-md border px-2 py-2 text-sm font-medium transition-colors",p?"border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg":"border-transparent text-text-secondary hover:bg-ghost-button-hover"),"aria-pressed":p,onClick:()=>h("recurrence",n.value),children:n.label},n.value)})}),t.recurrence==="custom"?e.jsxs("div",{className:"rounded-md border border-border bg-secondary-bg/40 px-3 py-2",children:[e.jsx("span",{className:"block text-xs text-text-secondary",children:"Existing custom schedule"}),e.jsx("code",{className:"mt-1 block font-mono text-sm text-text-primary",children:t.customCron}),e.jsx("span",{className:"mt-1 block text-xs text-text-secondary",children:"Select Hourly, Daily, or Weekly to replace this schedule."})]}):null,t.recurrence==="weekly"?e.jsxs("fieldset",{children:[e.jsx("legend",{className:"mb-2 text-sm font-medium",children:"Days"}),e.jsx("div",{className:"flex gap-2",children:Oe.map(n=>{const p=t.weekdays.includes(n.value);return e.jsx("button",{type:"button",className:K("min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium",p?"border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg":"border-border text-text-secondary hover:bg-ghost-button-hover"),"aria-pressed":p,onClick:()=>w(n.value),children:n.label},n.value)})})]}):null,e.jsxs("div",{className:"flex gap-4",children:[t.recurrence==="daily"||t.recurrence==="weekly"?e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Hour"}),e.jsx(ue,{"aria-label":"Hour",value:String(t.hour),options:At,onValueChange:n=>h("hour",Number(n))})]}):null,t.recurrence!=="custom"?e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Minute"}),e.jsx(ue,{"aria-label":"Minute",value:String(t.minute),options:Rt,onValueChange:n=>h("minute",Number(n))})]}):null,e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Timezone"}),e.jsx(ue,{"aria-label":"Timezone",value:t.timezone,options:k,onValueChange:n=>h("timezone",n),menuClassName:"w-full min-w-0"})]})]})]})}),e.jsx("div",{className:"rounded-b-lg border border-t-0 border-border bg-primary-button-bg/10 px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{name:"clock",className:"size-4 shrink-0 text-primary-button-bg"}),e.jsx("span",{className:"shrink-0 text-xs font-medium text-text-secondary",children:"Schedule"}),e.jsx("p",{className:"min-w-0 flex-1 truncate text-sm text-text-primary",children:d||"—"}),e.jsx("code",{className:"shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary",children:x||"—"})]})})]})]})}function Dt(t){return t.startsWith("manual-")}function It(t){return t==="failed"?"failed":"success"}function Ue(t){return t==="failed"?"Failed":t==="triggered"?"Triggered":"Scheduled"}function Ge(t){return Dt(t)?"Manual test":"Cron"}function Lt(t,a=5){return t.filter(r=>r.status!=="scheduled").slice(0,a).reverse()}function be(t){if(t==null)return"—";const a=new Date(t);return Number.isNaN(a.getTime())?"—":jt(a)}function Ft({run:t}){return e.jsxs("div",{className:"flex flex-col gap-1 text-left text-xs",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Ue(t.status)}),e.jsx("p",{className:"text-text-secondary",children:Ge(t.name)}),e.jsxs("p",{className:"text-text-secondary",children:["Scheduled for: ",be(t.scheduledFor)]}),t.triggeredAt!=null?e.jsxs("p",{className:"text-text-secondary",children:["Triggered at: ",be(t.triggeredAt)]}):null,e.jsxs("p",{className:"text-text-secondary",children:["Triggered by: ",t.triggeredBy]}),t.status==="failed"&&t.reason?e.jsxs("p",{className:"text-text-secondary",children:["Reason: ",t.reason]}):null]})}var _t={success:"border-emerald-600/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-400/35 dark:bg-emerald-500/15 dark:text-emerald-300",failed:"border-red-600/30 bg-red-500/10 text-red-700 dark:border-red-400/35 dark:bg-red-500/15 dark:text-red-300"};function He({run:t}){const a=It(t.status),l=be(t.triggeredAt??t.scheduledFor);return e.jsx(Me,{content:e.jsx(Ft,{run:t}),className:"max-w-sm whitespace-normal",side:"top",children:e.jsx("span",{className:K("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",_t[a]),"aria-label":`${Ue(t.status)} run at ${l}`,children:e.jsx(C,{name:a==="failed"?"triangle-exclamation":"check",className:"size-3.5"})})})}function qe({status:t}){const a=t==="active";return e.jsx(Ye,{variant:a?"success":"warning",shape:"pill",size:"md",dot:!0,children:a?"Active":"Paused"})}function Mt(t,a){return t.find(l=>l.name===a||l.id===a)??null}function $t({connector:t,onConnected:a}){return vt()==null?null:e.jsx(St,{connector:t,onConnected:a})}function se({label:t,children:a}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border px-3 py-2.5 last:border-b-0",children:[e.jsx("span",{className:"text-text-secondary shrink-0 text-[10px] font-semibold tracking-wide uppercase",children:t}),e.jsx("div",{className:"min-w-0 text-right text-sm text-text-primary",children:a})]})}function Ot({schedule:t,agentName:a,mcpMounts:l,onEditConfiguration:r}){const c=pe(),o=Ne(),{connectors:N,ensureLoaded:g,refreshConnectors:x,loading:d,error:k}=yt(),[h,w]=i.useState(!1),[n,p]=i.useState(null),T=ae({cron:t.cron,timezone:t.timezone}),E=async()=>{w(!0);try{const m=await c.createScheduleRun({scheduleId:t.id});p(m),o==null||o.showSuccess({title:"Test run started"})}catch(m){o==null||o.showError(m)}finally{w(!1)}};return i.useEffect(()=>{g()},[g]),i.useEffect(()=>{k!=null&&(o==null||o.showError(k))},[k,o]),e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx(se,{label:"Agent",children:a}),e.jsx(se,{label:"Name",children:t.name}),e.jsx(se,{label:"Status",children:e.jsx(qe,{status:t.status})}),e.jsx(se,{label:"Task",children:e.jsx("span",{className:"whitespace-pre-wrap break-words",children:t.task})}),e.jsx(se,{label:"Frequency",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[e.jsx("span",{children:T}),e.jsx("code",{className:"text-text-secondary font-mono text-xs",children:t.cron})]})}),e.jsx("div",{className:"flex justify-end px-3 py-2.5",children:e.jsxs(M.Secondary,{type:"button",size:"small",onClick:r,children:[e.jsx(C,{name:"pencil",className:"size-3.5"}),"Edit Configuration"]})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx("div",{className:"border-b border-border px-3 py-2",children:e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Tool Authorization"})}),l.length===0?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"No MCP connectors configured for this agent."}):e.jsx("ul",{className:"divide-y divide-border",children:l.map(m=>{const S=Mt(N,m.name),F=(S==null?void 0:S.authenticated)===!0,z=S==null&&!d;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:K("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",F?"border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"border-border text-transparent"),"aria-hidden":!0,children:F?e.jsx(C,{name:"check",className:"size-3"}):null}),e.jsx("span",{className:"text-text-primary min-w-0 flex-1 truncate text-sm",children:m.name}),F?e.jsx("span",{className:"text-success-bg text-xs font-medium",children:"Connected"}):z?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):S!=null&&S.authenticated===!1?e.jsx($t,{connector:S,onConnected:x}):d?e.jsx("span",{className:"text-text-secondary text-xs",children:"Loading…"}):null]},m.name)})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Test Run"}),e.jsxs(M.Primary,{type:"button",disabled:h,size:"small",onClick:()=>void E(),children:[e.jsx(C,{name:h?"loader":"play",className:K("size-3.5",h&&"animate-spin")}),"Run Test"]})]}),n==null?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"Run a one-off test using the schedule task. This does not change the cron pending run."}):e.jsxs("div",{className:"flex items-center gap-3 px-3 py-3",children:[e.jsx(He,{run:n}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Ge(n.name)}),e.jsx("p",{className:"text-text-secondary",children:Et(n.triggeredAt??n.scheduledFor)})]})]})]})]})}function Bt({open:t,onOpenChange:a,mode:l,schedule:r,initialAgentId:c="",onSaved:o}){const N=pe(),g=Ie(),x=gt(),d=Ne(),k=Le(),[h,w]=i.useState(me),[n,p]=i.useState(c),[T,E]=i.useState(null),[m,S]=i.useState({kind:"form"}),[F,z]=i.useState(!1),[ne,A]=i.useState(!1),[G,b]=i.useState(null),Y=i.useRef(n);Y.current=n;const $=m.kind==="form"?m.saved:m.schedule,O=l==="edit"&&m.kind==="form"&&m.saved==null&&r!=null,_=m.kind==="form"&&m.saved!=null,H=l==="create"&&m.kind==="form"&&m.saved==null,{allows:q}=fe({resourceType:"agent",resourceIds:n.length===0?[]:[n]});i.useEffect(()=>{if(!t){w(me()),p(c),E(null),b(null),S({kind:"form"}),A(!1);return}if(l==="edit"&&r!=null){w(Re({name:r.name,task:r.task,cron:r.cron,timezone:r.timezone})),p(r.agentId),E(null),S({kind:"form"});return}w(me()),p(c),E(null),S({kind:"form"})},[t,l,r,c]),i.useEffect(()=>{if(!t||l!=="create"||c.length===0)return;let f=!1;const j=c;return bt({server:g,agentKey:j}).then(y=>{f||y==null||Y.current===j&&(E(y),p(_e(y)))}).catch(()=>{}),()=>{f=!0}},[t,l,c,g]);const B=(T==null?void 0:T.name)??($==null?void 0:$.agentName)??(r==null?void 0:r.agentName)??(n.length>0?n:""),Z=i.useMemo(()=>{var j;return(((j=T==null?void 0:T.agentSpec)==null?void 0:j.mcpServers)??[]).map(pt).filter(y=>y!=null).map(y=>({name:y}))},[T]),R=i.useMemo(()=>{const f=ge(h);return h.name.trim().length>0&&h.task.trim().length>0&&f.length>0&&n.length>0&&(!H||q(n,"USE"))},[n,q,h,H]),te=f=>{S({kind:"test",schedule:f}),w(Re({name:f.name,task:f.task,cron:f.cron,timezone:f.timezone})),p(f.agentId)},J=async f=>{if(f.preventDefault(),!R)return;const j=ge(h);z(!0),b(null);try{if(O&&r!=null){await N.updateSchedule({id:r.id,name:h.name.trim(),task:h.task.trim(),cron:j,timezone:h.timezone,status:r.status}),k(ee.Schedule.EDITED,{schedule_id:r.id,agent_id:r.agentId}),o==null||o(),a(!1);return}if(_&&m.kind==="form"&&m.saved!=null){const L=await N.updateSchedule({id:m.saved.id,name:h.name.trim(),task:h.task.trim(),cron:j,timezone:h.timezone,status:"paused"});k(ee.Schedule.EDITED,{schedule_id:L.id,agent_id:L.agentId}),o==null||o(),te(L),d==null||d.showSuccess({title:"Schedule saved as paused",description:ae({cron:L.cron,timezone:L.timezone})});return}const y=await N.createSchedule({agentId:n,name:h.name.trim(),task:h.task.trim(),cron:j,timezone:h.timezone,status:"paused"});k(ee.Schedule.CREATED,{schedule_id:y.id,agent_id:n}),o==null||o(),te(y),d==null||d.showSuccess({title:"Schedule saved as paused",description:ae({cron:y.cron,timezone:y.timezone})})}catch(y){const L=y instanceof Error?y.message:"Failed to save schedule";b(L)}finally{z(!1)}},D=async()=>{if(m.kind==="test"){A(!0),b(null);try{await N.updateSchedule({id:m.schedule.id,name:m.schedule.name,task:m.schedule.task,cron:m.schedule.cron,timezone:m.schedule.timezone,status:"active"}),o==null||o(),d==null||d.showSuccess({title:"Schedule activated"}),a(!1)}catch(f){const j=f instanceof Error?f.message:"Failed to activate schedule";b(j),d==null||d.showError(f)}finally{A(!1)}}},V=m.kind==="test"?"Test Schedule":O||_?"Edit Schedule":"New Schedule",re=m.kind==="test"?`Recurring unattended runs of ${B}.`:O||_?"Update cadence and task for this schedule.":"Create a recurring unattended run for an agent.";let I;return m.kind==="test"?I=e.jsxs("div",{className:"flex flex-col gap-2",children:[G!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:G}):null,e.jsx(M.Secondary,{type:"button",className:"w-full",disabled:ne,onClick:()=>void D(),children:"Activate Schedule"})]}):I=e.jsxs("div",{className:"flex flex-col gap-2",children:[G!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:G}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(M.Secondary,{type:"button",onClick:()=>a(!1),disabled:F,children:"Cancel"}),e.jsx(M.Primary,{type:"submit",form:"schedule-form",disabled:!R||F,children:"Save"})]})]}),e.jsx(Nt,{open:t,onOpenChange:a,title:V,description:re,anchor:"right",size:"xl",headerIcon:e.jsx("span",{className:"text-primary-button-bg inline-flex size-8 items-center justify-center",children:e.jsx(C,{name:m.kind==="test"||O||_?"calendar":"calendar-plus",className:"size-5"})}),footer:I,children:m.kind==="test"?e.jsx(Ot,{schedule:m.schedule,agentName:B,mcpMounts:Z,onEditConfiguration:()=>{b(null),S({kind:"form",saved:m.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:f=>void J(f),children:e.jsx(Pt,{values:h,onChange:w,agentId:n,agentLabel:B,onAgentIdChange:O||_?void 0:f=>{p(f),f.length===0&&E(null)},onAgentPicked:E,agentPickerDisabled:O||_,onBuildAgent:l==="create"&&(x==null?void 0:x.isComposerEnabled)===!0?()=>{a(!1),x.openAgentBuilder()}:void 0})})})}function Pe(t){return e.jsx(ft,{children:e.jsx(Bt,{...t})})}function Ut({runs:t}){const a=Lt(t);return a.length===0?e.jsx("span",{className:"text-text-secondary text-sm",children:"—"}):e.jsx("div",{className:"flex items-center gap-1",children:a.map(l=>e.jsx(He,{run:l},l.id))})}var Gt=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],De=[10,25];function oe(t){return Math.min(Math.max(t,1),25)}function de(t){const a=je(t);return{nameQuery:a.q??"",statusFilter:a.status??"all",agentFilter:a.agent??"all"}}function Ht(t){const a=je(window.location.search);if(!a.isNew)return{kind:"closed"};const l=t??a.agent;return{kind:"create",...l==null?{}:{agentId:l}}}function qt({schedule:t,running:a,canManage:l,canDelete:r,onRunNow:c,onEdit:o,onTogglePause:N,onDelete:g}){const x=mt("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1.5",children:[e.jsx(x,{allowed:l,children:e.jsxs(M.Secondary,{type:"button",disabled:a,"aria-label":`Run now ${t.name}`,size:"large",onClick:c,children:[e.jsx(C,{name:a?"loader":"play",className:K("size-3.5",a&&"animate-spin")}),"Run now"]})}),e.jsxs(xt,{align:"end",trigger:e.jsx("button",{type:"button",className:ht({variant:"ghost",size:"icon"}),"aria-label":`Actions for ${t.name}`,children:e.jsx(C,{name:"ellipsis"})}),children:[e.jsx(x,{allowed:l,children:e.jsxs(he,{onClick:o,children:[e.jsx(C,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(x,{allowed:l,children:e.jsxs(he,{onClick:N,children:[e.jsx(C,{name:t.status==="active"?"pause":"play",className:"size-3.5"}),t.status==="active"?"Pause":"Resume"]})}),e.jsx(x,{allowed:r,children:e.jsxs(he,{className:"text-failure-bg focus:text-failure-bg",onClick:g,children:[e.jsx(C,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function Qt({agentId:t}){const a=pe(),l=Ie(),r=Ne(),c=Le(),[o,N]=i.useState([]),{allows:g}=fe({resourceType:"schedule",resourceIds:o.map(s=>s.id)}),[x,d]=i.useState({}),[k,h]=i.useState(!1),[w,n]=i.useState(()=>new Set),[p,T]=i.useState({}),[E,m]=i.useState(!0),[S,F]=i.useState(null),[z,ne]=i.useState(()=>de(window.location.search).nameQuery),[A,G]=i.useState(()=>de(window.location.search).statusFilter),[b,Y]=i.useState(()=>t??de(window.location.search).agentFilter),$=t??(b==="all"?null:b),{allows:O}=fe({resourceType:"agent",resourceIds:$==null?[]:[$]}),_=l.permissions==null||$==null||O($,"USE"),[H,q]=i.useState(()=>Ht(t)),[B,Z]=i.useState(null),[R,te]=i.useState(()=>oe(ut)),[J,D]=i.useState(void 0),[V,re]=i.useState(void 0),[I,f]=i.useState(void 0),j=i.useRef(0),y=i.useRef(!1),L=i.useCallback(async({rows:s,gen:u})=>{if(s.length===0){u===j.current&&d({});return}h(!0);try{const v=await Promise.allSettled(s.map(P=>a.listScheduleRuns({scheduleId:P.id})));if(u!==j.current)return;d(Object.fromEntries(s.map((P,U)=>{const ie=v[U],Ke=(ie==null?void 0:ie.status)==="fulfilled"?ie.value:[];return[P.id,Ke]})))}finally{u===j.current&&h(!1)}},[a]),X=i.useCallback(async({token:s,size:u,agentId:v})=>{const P=++j.current;m(!0),F(null);try{const U=await a.listSchedules({limit:oe(u),...s===void 0||s===""?{}:{pageToken:s},...v==="all"?{}:{agentIds:[v]}});if(P!==j.current)return;N(U.data),re(U.nextPageToken),f(U.previousPageToken),L({rows:U.data,gen:P})}catch(U){if(P!==j.current)return;F(Ze(U,"Check your connection and try again.")),N([]),d({}),re(void 0),f(void 0)}finally{P===j.current&&m(!1)}},[a,L]),ye=i.useCallback(s=>{const u=(s==null?void 0:s.size)??R,v=(s==null?void 0:s.agentId)??b;D(void 0),f(void 0),X({token:void 0,size:u,agentId:v})},[b,X,R]);i.useEffect(()=>{Te({agent:t===void 0&&b!=="all"?b:null,status:A==="all"?null:A,q:z.trim().length===0?null:z})},[b,t,A,z]),i.useEffect(()=>{t!==void 0&&Y(s=>s===t?s:(D(void 0),f(void 0),t))},[t]),i.useEffect(()=>{y.current||!je(window.location.search).isNew||(y.current=!0,Te({isNew:null}))},[]),i.useEffect(()=>{const s=()=>{const u=de(window.location.search);ne(u.nameQuery),G(u.statusFilter),Y(v=>{const P=t??u.agentFilter;return v===P?v:(D(void 0),f(void 0),P)})};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[t]),i.useEffect(()=>{X({token:J,size:R,agentId:b})},[b,R,J,X]);const le=i.useMemo(()=>{const s=z.trim().toLowerCase();return o.filter(u=>!(A!=="all"&&u.status!==A||s.length>0&&!u.name.toLowerCase().includes(s)))},[o,z,A]),ve=Je(o),Se=I!=null||V!=null,Ve=async s=>{if(!g(s.id,"MANAGE"))return;const u=s.status==="active"?"paused":"active";try{await a.updateSchedule({...s,status:u}),c(ee.Schedule.TOGGLED,{schedule_id:s.id,agent_id:s.agentId,next_status:u}),await X({token:J,size:R,agentId:b})}catch(v){r==null||r.showError(v)}},We=async s=>{if(g(s.id,"MANAGE")){n(u=>new Set(u).add(s.id));try{await a.createScheduleRun({scheduleId:s.id}),c(ee.Schedule.RUN_NOW,{schedule_id:s.id,agent_id:s.agentId}),r==null||r.showSuccess({title:"Run started"});const u=await a.listScheduleRuns({scheduleId:s.id});d(v=>({...v,[s.id]:u}))}catch(u){r==null||r.showError(u)}finally{n(u=>{const v=new Set(u);return v.delete(s.id),v})}}},Qe=async s=>{if(g(s.id,"DELETE")){Z(null);try{await a.deleteSchedule({id:s.id}),c(ee.Schedule.DELETED,{schedule_id:s.id,agent_id:s.agentId}),ye()}catch(u){r==null||r.showError(u)}}},ke=()=>{V!=null&&D(V)},we=()=>{I==null||I===""||D(I)};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-primary-bg",children:[e.jsx(Xe,{title:t===void 0?"Agent Schedules":void 0,end:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full sm:w-60",children:e.jsx(et,{query:z,setQuery:ne,placeholder:"Search schedules by name"})}),e.jsx(ue,{value:A,onValueChange:G,options:Gt,className:"sm:w-40","aria-label":"Filter by status"}),t===void 0?e.jsx(Fe,{value:b,selectedLabel:b==="all"?"All agents":p[b]??b,onValueChange:s=>{Y(s),D(void 0),f(void 0)},onAgentPicked:s=>{T(u=>({...u,[_e(s)]:s.name}))},allOption:{value:"all",label:"All agents"},className:"sm:w-48","aria-label":"Filter by agent",placeholder:"Search agent"}):null,e.jsxs(M.Primary,{type:"button",disabled:!_,onClick:()=>_&&q({kind:"create",agentId:b!=="all"?b:void 0}),children:[e.jsx(C,{name:"plus",className:"size-3.5"}),"New Schedule"]})]})}),e.jsx("div",{className:K("min-h-0 flex-1 overflow-auto px-4 py-4",S!=null?"flex flex-col":void 0),children:E?e.jsx("div",{className:"flex flex-col gap-2",role:"status","aria-label":"Loading schedules",children:Array.from({length:5},(s,u)=>e.jsx(tt,{className:"h-12 w-full rounded-md"},u))}):S!=null?e.jsx("div",{role:"alert",className:"flex flex-1 flex-col items-center justify-center",children:e.jsx(xe,{title:"Couldn't load schedules",description:S,className:"h-auto min-h-0 flex-none py-0"})}):o.length===0?e.jsx(xe,{title:"No Schedules Found",description:"Create one to get started.",className:"min-h-full"}):le.length===0?e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(xe,{title:"No Schedules Found",description:"No schedules match your filters.",className:"flex-1"}),Se?e.jsx(Ce,{pageSize:R,rowCount:0,canPrev:I!=null,canNext:V!=null,onPrev:we,onNext:ke,pageSizeOptions:De,onPageSizeChange:s=>{const u=oe(s);te(u),D(void 0),f(void 0)}}):null]}):e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs(st,{className:"min-w-240",children:[e.jsx(at,{children:e.jsxs(Ee,{className:"hover:bg-transparent",children:[e.jsx(W,{children:"Schedule Name"}),e.jsx(W,{children:"Task"}),ve?e.jsx(W,{children:"Created by"}):null,e.jsx(W,{children:"Frequency"}),e.jsx(W,{children:"Status"}),e.jsx(W,{children:"Last 5 runs"}),e.jsx(W,{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(nt,{children:le.map(s=>{const u=ae({cron:s.cron,timezone:s.timezone}),v=s.agentName??p[s.agentId]??s.agentId;return e.jsxs(Ee,{children:[e.jsxs(Q,{className:"w-48 max-w-48",children:[e.jsx("span",{className:"text-text-primary block truncate font-medium",children:s.name}),e.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(C,{name:"agent-2",className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:v})]})]}),e.jsx(Q,{className:"w-64 max-w-64",children:e.jsx(Me,{content:s.task,className:"max-w-sm whitespace-normal text-left",triggerClassName:"block min-w-0 w-full max-w-full",children:e.jsx("span",{className:"block truncate",children:s.task})})}),ve?e.jsx(Q,{children:e.jsx(rt,{subject:s.createdBySubject})}):null,e.jsx(Q,{children:u}),e.jsx(Q,{children:e.jsx(qe,{status:s.status})}),e.jsx(Q,{children:k?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):e.jsx(Ut,{runs:x[s.id]??[]})}),e.jsx(Q,{className:"text-right",children:e.jsx(qt,{schedule:s,running:w.has(s.id),canManage:g(s.id,"MANAGE"),canDelete:g(s.id,"DELETE"),onRunNow:()=>void We(s),onEdit:()=>{g(s.id,"MANAGE")&&q({kind:"edit",schedule:s})},onTogglePause:()=>void Ve(s),onDelete:()=>{g(s.id,"DELETE")&&Z(s)}})})]},s.id)})})]}),(le.length>0||Se)&&e.jsx(Ce,{pageSize:R,rowCount:le.length,canPrev:I!=null,canNext:V!=null,onPrev:we,onNext:ke,pageSizeOptions:De,onPageSizeChange:s=>{const u=oe(s);te(u),D(void 0),f(void 0)}})]})}),H.kind==="create"?e.jsx(Pe,{open:!0,mode:"create",initialAgentId:H.agentId??"",onOpenChange:s=>{s||q({kind:"closed"})},onSaved:()=>ye()}):null,H.kind==="edit"?e.jsx(Pe,{open:!0,mode:"edit",schedule:H.schedule,onOpenChange:s=>{s||q({kind:"closed"})},onSaved:()=>void X({token:J,size:R,agentId:b})}):null,B!=null?e.jsxs(lt,{open:!0,onOpenChange:s=>{s||Z(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(it,{children:e.jsxs(ct,{children:[e.jsx(ot,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",B.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(dt,{children:[e.jsx(M.Secondary,{type:"button",onClick:()=>Z(null),children:"Cancel"}),e.jsx(M.Destructive,{type:"button",disabled:!g(B.id,"DELETE"),onClick:()=>void Qe(B),children:"Delete"})]})]}):null]})}export{Qt as SchedulesPage};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as ue,k as ce,l as pe,m as ge,n as fe,o as ye,p as he,q as de,r as i,t as me,v as Se,w as be,x as Ae,y as Oe,z as F,A as I,B as ee,E as M}from"./index-Cq_o2Abd.js";import{u as ve,a as Ne}from"./chunk-OB3PAWPO-dRLyZPUL.js";var _="try_agent_name",k="history_agent_name";function ne(t){return t!=null&&t.length>0?t:null}function B(t){const l=new URLSearchParams(t.startsWith("?")?t.slice(1):t),o=ne(l.get(_));if(o!=null)return{intent:"try-agent",agentName:o};const e=ne(l.get(k));return e==null?null:{intent:"history",agentName:e}}function Re(t,l){t.delete(_),t.delete(k),l!=null&&t.set(l.intent==="try-agent"?_:k,l.agentName)}function te(t,l){const o=new URLSearchParams(t.startsWith("?")?t.slice(1):t);Re(o,l);const e=o.toString();return e.length>0?`?${e}`:""}function se(t){const l=t.sessionAccessError!=null?t.pendingSessionId:t.activeRemoteId??t.pendingSessionId;if(l!=null)return{type:"session",sessionId:l};const{mode:o,agentConfigMode:e}=t;if(o.status==="active"&&o.isMutable&&o.isCreateAgent)return{type:"buildAgent"};if(o.status==="active"&&!o.isMutable&&e!=="SingleAgent"){const p=o.agentName??o.agentId;if(p!=null)return{type:"agent",agentName:p}}return{type:"root"}}function Ee(t){return t.settingsOpen?{type:"settings"}:t.schedulesOpen?{type:"schedules"}:t.environmentsOpen?{type:"environments"}:t.sessionsOpen&&t.sharedSessionId!=null?{type:"sharedSession",sessionId:t.sharedSessionId}:t.sessionsOpen?{type:"sessionsBrowser"}:t.libraryOpen&&t.libraryAgentId!=null?{type:"libraryAgent",agentId:t.libraryAgentId}:t.libraryOpen?{type:"library"}:se(t)}function A(t){return t.type==="root"||t.type==="agent"||t.type==="session"}function Ie(t){return t.type==="sessionsBrowser"||t.type==="sharedSession"}function we({routes:t,activeRemoteId:l,initialSettingsOpen:o}){var X,Z;const e=ue(),p=ce(),$=pe(),q=ge(),T=fe(),U=ye(),K=he(),W=de(),C=ve(),r=Ne(),u=i.useMemo(()=>me({routes:t,catalog:$,capabilities:K,sessions:q,schedules:T,sandboxEnvironments:U}),[t,$,K,q,T,U]),Y=u.settings!=null,re=[u.settings,u.sessionsBrowser,u.sharedSession,u.libraryAgent,u.schedules,u.environments].join("\0"),G={settingsOpen:e.settingsOpen,libraryOpen:e.libraryOpen,sessionsOpen:e.sessionsOpen,sharedSessionId:e.sharedSessionId,libraryAgentId:e.libraryAgentId,schedulesOpen:e.schedulesOpen,environmentsOpen:e.environmentsOpen,pendingSessionId:e.pendingSessionId,activeRemoteId:l,sessionAccessError:e.sessionAccessError,mode:e.mode,agentConfigMode:e.agentConfigMode},g=Ee(G),ae=JSON.stringify(g),S=i.useRef(null),P=i.useRef(null),O=i.useRef(null),v=i.useRef(!1),b=i.useRef(null),[ie,le]=i.useState(0),m=i.useRef(null),w=i.useRef(null),z=`${e.runtimeKey}\0${e.pendingSessionEpoch}`,H=i.useRef(z);H.current=z;const f=i.useRef(null),Q=i.useRef(!1),j=i.useRef(!1),D=i.useCallback(()=>{switch(e.setSettingsOpen(!1),e.setLibraryOpen(!1),e.setSchedulesOpen(!1),e.setEnvironmentsOpen(!1),e.agentConfigMode){case"AgentLibrary":e.openLibraryHome();return;case"AgentComposer":case"AgentLibraryWithComposer":e.openDraft();return;case"SingleAgent":e.clearChat();return}},[e]),N=i.useCallback(n=>{const s=b.current;(s==null?void 0:s.type)==="session"&&s.sessionId===n&&(b.current=null,le(a=>a+1))},[]),J=i.useCallback(n=>{if(w.current=n,p==null){e.openHistorySession({sessionId:n});return}const s=H.current;p.getSession({sessionId:n}).then(a=>{if(w.current!==n){N(n);return}e.openHistorySession({sessionId:n,isMutable:a.isMutable,isCreateAgent:Se(a),...a.agentName!=null?{agentName:a.agentName}:{}})}).catch(a=>{if(w.current!==n){N(n);return}if(H.current!==s){N(n);return}e.openInaccessibleSession({sessionId:n,message:be(a,"This session could not be loaded.")})})},[N,p,e]),h=i.useCallback(n=>{if(n==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}const s=`${n.intent}\0${n.agentName}`,a=e.historyAgentFilter;if((a==null?void 0:a.intent)===n.intent&&a.agentName===n.agentName&&a.agentId!=null){f.current=null;return}f.current=s,e.setHistoryAgentFilter(n),p!=null&&Ae({server:p,agentName:n.agentName}).then(c=>{if(f.current===s){if(c==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}f.current=null,e.setHistoryAgentFilter({agentId:Oe(c),agentName:c.name,intent:n.intent})}}).catch(()=>{f.current===s&&(f.current=null,m.current=null,e.setHistoryAgentFilter(null))})},[p,e]),V=i.useCallback(n=>{e.selectLibraryAgent({isMutable:!1,agentName:n}),h({intent:"try-agent",agentName:n})},[h,e]),L=i.useCallback(n=>{switch(n.type){case"settings":e.setSettingsOpen(!0);return;case"library":e.setLibraryOpen(!0);return;case"sessionsBrowser":e.setSessionsOpen(!0);return;case"sharedSession":e.openSharedSession(n.sessionId);return;case"libraryAgent":e.openLibraryAgent(n.agentId);return;case"schedules":e.setSchedulesOpen(!0);return;case"environments":e.setEnvironmentsOpen(!0);return;case"buildAgent":e.openAgentBuilder();return;case"session":if(e.setLibraryOpen(!1),e.pendingSessionId===n.sessionId||l===n.sessionId)return;J(n.sessionId);return;case"agent":e.setLibraryOpen(!1),V(n.agentName);return;case"root":D();return}},[e,l,D,V,J]);return i.useEffect(()=>{if(v.current)return;const n=F({pathname:r.pathname,search:r.search,routes:t});if(!W&&(n==null?void 0:n.type)==="settings")return;v.current=!0;const s=F({pathname:r.pathname,search:r.search,routes:u})??{type:"root"},a=s.type==="agent"?{intent:"try-agent",agentName:s.agentName}:A(s)?B(r.search):null;m.current=a,O.current=s;const c=Y&&(o||s.type==="settings");if(s.type==="settings")Y&&e.setSettingsOpen(!0);else if(s.type==="library")e.setLibraryOpen(!0);else if(s.type==="sessionsBrowser")e.setSessionsOpen(!0);else if(s.type==="libraryAgent")e.openLibraryAgent(s.agentId);else if(s.type==="schedules")e.setSchedulesOpen(!0);else if(s.type==="environments")e.setEnvironmentsOpen(!0);else{const E=se(G);I(E,s)||L(s),c&&e.setSettingsOpen(!0)}s.type!=="agent"&&a!=null?h(a):A(s)||h(null);const d=c?{type:"settings"}:s;b.current=I(g,d)?null:d;const y=ee(d,u),R=te(M(d,r.search),a);P.current=d,y!=null&&(y!==r.pathname||R!==r.search)&&(S.current=y!==r.pathname?y:null,C({pathname:y,search:R,hash:r.hash},{replace:!0}))},[W]),i.useEffect(()=>{if(!v.current)return;if(!Q.current){Q.current=!0;return}const n=b.current;if(n!=null){if(!I(g,n))return;b.current=null}const s=ee(g,u);if(s==null)return;const c=`${u.basename.endsWith("/")?u.basename.slice(0,-1):u.basename}${r.pathname}`||"/",d=window.location.pathname===c?window.location.search:r.search,y=A(g),R=y?e.historyAgentFilter==null?m.current:{intent:e.historyAgentFilter.intent,agentName:e.historyAgentFilter.agentName}:null;!y&&e.historyAgentFilter!=null&&(f.current=null,e.setHistoryAgentFilter(null)),e.historyAgentFilter!=null&&(m.current=null);const E=te(M(g,d),R),x=P.current;if(P.current=g,s===r.pathname&&E===r.search)return;const oe=g.type==="session"&&e.pendingSessionId==null&&x!=null&&x.type!=="session";S.current=s!==r.pathname?s:null,C({pathname:s,search:E,hash:r.hash},{replace:oe})},[ae,re,ie,(X=e.historyAgentFilter)==null?void 0:X.agentName,(Z=e.historyAgentFilter)==null?void 0:Z.intent]),i.useEffect(()=>{if(!v.current)return;if(!j.current){j.current=!0;return}if(S.current===r.pathname){S.current=null,O.current=g;return}const n=F({pathname:r.pathname,search:r.search,routes:u});if(n==null){const a=u.root,c=M({type:"root"},r.search);S.current=a,C({pathname:a,search:c,hash:r.hash},{replace:!0}),L({type:"root"}),h(B(c));return}const s=O.current;O.current=n,(s==null||!I(s,n))&&(n.type!=="settings"&&e.settingsOpen&&e.setSettingsOpen(!1),n.type!=="library"&&n.type!=="libraryAgent"&&e.libraryOpen&&e.setLibraryOpen(!1),!Ie(n)&&e.sessionsOpen&&e.setSessionsOpen(!1),n.type!=="schedules"&&e.schedulesOpen&&e.setSchedulesOpen(!1),n.type!=="environments"&&e.environmentsOpen&&e.setEnvironmentsOpen(!1),L(n)),n.type!=="agent"&&A(n)?h(B(r.search)):A(n)||h(null)},[r.pathname,r.search]),null}export{we as ShellRouteSync};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-MZNSGTCG-DW5WrGhz.js","./index-Cq_o2Abd.js","./index-B01pXqvC.css","./SchedulesPage-YFIJGKZO-BbTOcGO5.js","./chunk-WG6NEBF3-D6-L7Ege.js","./EnvironmentsPage-FCDIVAKH-Crq_Zjm_.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c1 as _,c2 as Zt,u as X,j as r,c3 as en,r as m,be as P,c4 as We,c5 as tn,c6 as Xe,c7 as Ye,c8 as qe,c9 as Je,ca as Qe,cb as Q,cc as nn,cd as R,ce as rn,cf as sn,cg as on,ch as an,ci as cn,cj as ln,ck as un,cl as dn,cm as Ie,cn as mn,co as fn,cp as me,cq as pn,cr as hn,cs as xn,ct as Ze,cu as ke,cv as fe,cw as je,cx as ae,cy as Me,cz as Se,cA as Ce,cB as Be,k as et,V as tt,b as ne,d as C,W as gn,cC as vn,g as K,U as bn,cD as wn,al as le,bL as ue,cE as Fe,cF as yn,c as Le,b3 as nt,cG as In,$ as jn,ak as Ke,I as V,y as Mn,f as te,cH as rt,cI as Sn,cJ as Cn,cK as $e,b7 as Ln,as as Tn,a2 as ze,s as st,cL as Nn,P as Rn,cM as Pn,S as ge,D as En,cN as ot,cO as at,bq as Dn,_ as Te,cP as An,bU as _n}from"./index-Cq_o2Abd.js";import{A as On,N as kn,T as Bn,S as it}from"./chunk-MTB32EHM-CWUHnCTs.js";const Ne=n=>{const e=_(8),{index:t,archived:s,children:a}=n;let i;e[0]!==s||e[1]!==t?(i=Zt({source:"threads",query:{type:"index",index:t,archived:s},get:u=>u.threads().item({index:t,archived:s})}),e[0]=s,e[1]=t,e[2]=i):i=e[2];let o;e[3]!==i?(o={threadListItem:i},e[3]=i,e[4]=o):o=e[4];const l=X(o);let d;return e[5]!==l||e[6]!==a?(d=r.jsx(en,{value:l,children:a}),e[5]=l,e[6]=a,e[7]=d):d=e[7],d},ct=m.memo(n=>{const e=_(6),{index:t,archived:s,components:a}=n,i=s===void 0?!1:s,o=a.ThreadListItem;let l;e[0]!==o?(l=r.jsx(o,{}),e[0]=o,e[1]=l):l=e[1];let d;return e[2]!==i||e[3]!==t||e[4]!==l?(d=r.jsx(Ne,{index:t,archived:i,children:l}),e[2]=i,e[3]=t,e[4]=l,e[5]=d):d=e[5],d},(n,e)=>n.index===e.index&&n.archived===e.archived&&n.components.ThreadListItem===e.components.ThreadListItem);ct.displayName="ThreadListPrimitive.ItemByIndex";const Ge=({archived:n,children:e})=>{const t=P(s=>n?s.threads.archivedThreadIds.length:s.threads.threadIds.length);return We(()=>Array.from({length:t},(s,a)=>r.jsx(Ne,{index:a,archived:n,children:r.jsx(tn,{getItemState:i=>i.threads().item({index:a,archived:n}).getState(),children:i=>e({get threadListItem(){return i()}})})},a)),[t,n,e])},lt=n=>{const e=_(8),{archived:t,components:s,children:a}=n,i=t===void 0?!1:t;if(s){const l=s.ThreadListItem;let d;e[0]!==l?(d=()=>r.jsx(l,{}),e[0]=l,e[1]=d):d=e[1];let u;return e[2]!==i||e[3]!==d?(u=r.jsx(Ge,{archived:i,children:d}),e[2]=i,e[3]=d,e[4]=u):u=e[4],u}let o;return e[5]!==i||e[6]!==a?(o=r.jsx(Ge,{archived:i,children:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o};lt.displayName="ThreadListPrimitive.Items";const ut=n=>{const e=_(2),{fallback:t}=n,s=P(Fn)||t;let a;return e[0]!==s?(a=r.jsx(r.Fragment,{children:s}),e[0]=s,e[1]=a):a=e[1],a};ut.displayName="ThreadListItemPrimitive.Title";function Fn(n){return n.threadListItem.title}const Kn=()=>{const n=_(4),e=X();let t;n[0]!==e?(t=()=>{e.threadListItem().archive()},n[0]=e,n[1]=t):t=n[1];const s=t;let a;return n[2]!==s?(a={archive:s},n[2]=s,n[3]=a):a=n[3],a},$n=()=>{const n=_(4),e=X();let t;n[0]!==e?(t=()=>{e.threadListItem().delete()},n[0]=e,n[1]=t):t=n[1];const s=t;let a;return n[2]!==s?(a={delete:s},n[2]=s,n[3]=a):a=n[3],a},zn=()=>{const n=_(4),e=X();let t;n[0]!==e?(t=()=>{e.threadListItem().unarchive()},n[0]=e,n[1]=t):t=n[1];const s=t;let a;return n[2]!==s?(a={unarchive:s},n[2]=s,n[3]=a):a=n[3],a},Gn=()=>{const n=_(4),e=X();let t;n[0]!==e?(t=()=>{e.threadListItem().switchTo()},n[0]=e,n[1]=t):t=n[1];const s=t;let a;return n[2]!==s?(a={switchTo:s},n[2]=s,n[3]=a):a=n[3],a},Hn=()=>{const n=_(4),e=X();let t;n[0]!==e?(t=()=>{e.threads().switchToNewThread()},n[0]=e,n[1]=t):t=n[1];const s=t;let a;return n[2]!==s?(a={switchToNewThread:s},n[2]=s,n[3]=a):a=n[3],a},Un=()=>{const n=_(5),e=X(),t=P(Vn);let s;n[0]!==e?(s=()=>{e.threads().loadMore()},n[0]=e,n[1]=s):s=n[1];const a=s;let i;return n[2]!==t||n[3]!==a?(i={loadMore:a,disabled:t},n[2]=t,n[3]=a,n[4]=i):i=n[4],i};function Vn(n){return!n.threads.hasMore||n.threads.isLoading||n.threads.isLoadingMore}var Wn=Object.defineProperty,L=(n,e)=>Wn(n,"name",{value:e,configurable:!0}),Xn=["Enter"," "],Yn=["ArrowDown","PageUp","Home"],dt=["ArrowUp","PageDown","End"],qn=[...Yn,...dt],pe="Menu",[be,Jn,Qn]=Je(pe),[Z,mt]=Xe(pe,[Qn,Ye,qe]),Re=Ye(),ft=qe(),[Zn,ie]=Z(pe),[er,Pe]=Z(pe),tr=L(n=>{const{__scopeMenu:e,open:t=!1,children:s,dir:a,onOpenChange:i,modal:o=!0}=n,l=Re(e),[d,u]=m.useState(null),c=m.useRef(!1),f=fn(i),h=me(a);return m.useEffect(()=>{const p=L(()=>{c.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},"handleKeyDown"),v=L(()=>c.current=!1,"handlePointer");return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),m.useEffect(()=>{if(!t)return;const p=L(()=>f(!1),"handleBlur");return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[t,f]),r.jsx(pn,{...l,children:r.jsx(Zn,{scope:e,open:t,onOpenChange:f,content:d,onContentChange:u,children:r.jsx(er,{scope:e,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:c,dir:h,modal:o,children:s})})})},"Menu"),nr=m.forwardRef(L(function(e,t){const{__scopeMenu:s,...a}=e,i=Re(s);return r.jsx(hn,{...i,...a,ref:t})},"MenuAnchor")),pt="MenuPortal",[rr,sr]=Z(pt,{forceMount:void 0}),or=L(n=>{const{__scopeMenu:e,forceMount:t,children:s,container:a}=n,i=ie(pt,e);return r.jsx(rr,{scope:e,forceMount:t,children:r.jsx(Qe,{present:t||i.open,children:r.jsx(xn,{asChild:!0,container:a,children:s})})})},"MenuPortal"),J="MenuContent",[ar,ht]=Z(J),ir=m.forwardRef(L(function(e,t){const s=sr(J,e.__scopeMenu),{forceMount:a=s.forceMount,...i}=e,o=ie(J,e.__scopeMenu),l=Pe(J,e.__scopeMenu);return r.jsx(be.Provider,{scope:e.__scopeMenu,children:r.jsx(Qe,{present:a||o.open,children:r.jsx(be.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(cr,{...i,ref:t}):r.jsx(lr,{...i,ref:t})})})})},"MenuContent")),cr=m.forwardRef(L(function(e,t){const s=ie(J,e.__scopeMenu),a=m.useRef(null),i=Q(t,a);return m.useEffect(()=>{const o=a.current;if(o)return nn(o)},[]),r.jsx(xt,{...e,ref:i,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentModal")),lr=m.forwardRef(L(function(e,t){const s=ie(J,e.__scopeMenu);return r.jsx(xt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentNonModal")),ur=mn("MenuContent.ScrollLock"),xt=m.forwardRef(L(function(e,t){const{__scopeMenu:s,loop:a=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:d,onEntryFocus:u,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:p,onDismiss:v,disableOutsideScroll:x,...b}=e,S=ie(J,s),y=Pe(J,s),j=Re(s),O=ft(s),E=Jn(s),[k,B]=m.useState(null),N=m.useRef(null),M=Q(t,N,S.onContentChange),T=m.useRef(0),D=m.useRef(""),W=m.useRef(0),I=m.useRef(null),F=m.useRef("right"),G=m.useRef(0),H=x?sn:m.Fragment,U=x?{as:ur,allowPinchZoom:!0}:void 0,w=L(g=>{var ee,_e;const A=D.current+g,z=E().filter(Y=>!Y.disabled),q=document.activeElement,he=(ee=z.find(Y=>Y.ref.current===q))==null?void 0:ee.textValue,xe=z.map(Y=>Y.textValue),Ae=yt(xe,A,he),oe=(_e=z.find(Y=>Y.textValue===Ae))==null?void 0:_e.ref.current;L((function Y(Oe){D.current=Oe,window.clearTimeout(T.current),Oe!==""&&(T.current=window.setTimeout(()=>Y(""),1e3))}),"updateSearch")(A),oe&&setTimeout(()=>oe.focus())},"handleTypeaheadSearch");m.useEffect(()=>()=>window.clearTimeout(T.current),[]),rn();const $=m.useCallback(g=>{var z,q;return F.current===((z=I.current)==null?void 0:z.side)&&jt(g,(q=I.current)==null?void 0:q.area)},[]);return r.jsx(ar,{scope:s,searchRef:D,onItemEnter:m.useCallback(g=>{$(g)&&g.preventDefault()},[$]),onItemLeave:m.useCallback(g=>{var A;$(g)||((A=N.current)==null||A.focus(),B(null))},[$]),onTriggerLeave:m.useCallback(g=>{$(g)&&g.preventDefault()},[$]),pointerGraceTimerRef:W,onPointerGraceIntentChange:m.useCallback(g=>{I.current=g},[]),children:r.jsx(H,{...U,children:r.jsx(on,{asChild:!0,trapped:i,onMountAutoFocus:R(o,g=>{var A;g.preventDefault(),(A=N.current)==null||A.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(an,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:p,onDismiss:v,children:r.jsx(cn,{asChild:!0,...O,dir:y.dir,orientation:"vertical",loop:a,currentTabStopId:k,onCurrentTabStopIdChange:B,onEntryFocus:R(u,g=>{y.isUsingKeyboardRef.current||g.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(ln,{role:"menu","aria-orientation":"vertical","data-state":gt(S.open),"data-radix-menu-content":"",dir:y.dir,...j,...b,ref:M,style:{outline:"none",...b.style},onKeyDown:R(b.onKeyDown,g=>{const z=g.target.closest("[data-radix-menu-content]")===g.currentTarget,q=g.ctrlKey||g.altKey||g.metaKey,he=g.key.length===1;z&&(g.key==="Tab"&&g.preventDefault(),!q&&he&&w(g.key));const xe=N.current;if(g.target!==xe||!qn.includes(g.key))return;g.preventDefault();const oe=E().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);dt.includes(g.key)&&oe.reverse(),bt(oe)}),onBlur:R(e.onBlur,g=>{g.currentTarget.contains(g.target)||(window.clearTimeout(T.current),D.current="")}),onPointerMove:R(e.onPointerMove,de(g=>{const A=g.target,z=G.current!==g.clientX;if(g.currentTarget.contains(A)&&z){const q=g.clientX>G.current?"right":"left";F.current=q,G.current=g.clientX}}))})})})})})})},"MenuContentImpl")),we="MenuItem",He="menu.itemSelect",dr=m.forwardRef(L(function(e,t){const{disabled:s=!1,onSelect:a,...i}=e,o=m.useRef(null),l=Pe(we,e.__scopeMenu),d=ht(we,e.__scopeMenu),u=Q(t,o),c=m.useRef(!1),f=L(()=>{const h=o.current;if(!s&&h){const p=new CustomEvent(He,{bubbles:!0,cancelable:!0});h.addEventListener(He,v=>a==null?void 0:a(v),{once:!0}),un(h,p),p.defaultPrevented?c.current=!1:l.onClose()}},"handleSelect");return r.jsx(mr,{...i,ref:u,disabled:s,onClick:R(e.onClick,f),onPointerDown:h=>{var p;(p=e.onPointerDown)==null||p.call(e,h),c.current=!0},onPointerUp:R(e.onPointerUp,h=>{var p;c.current||(p=h.currentTarget)==null||p.click()}),onKeyDown:R(e.onKeyDown,h=>{s||h.target!==h.currentTarget||d.searchRef.current!==""&&h.key===" "||Xn.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),mr=m.forwardRef(L(function(e,t){const{__scopeMenu:s,disabled:a=!1,textValue:i,...o}=e,l=ht(we,s),d=ft(s),u=m.useRef(null),c=Q(t,u),[f,h]=m.useState(!1),[p,v]=m.useState("");return m.useEffect(()=>{const x=u.current;x&&v((x.textContent??"").trim())},[o.children]),r.jsx(be.ItemSlot,{scope:s,disabled:a,textValue:i??p,children:r.jsx(dn,{asChild:!0,...d,focusable:!a,children:r.jsx(Ie.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...o,ref:c,onPointerMove:R(e.onPointerMove,de(x=>{a?l.onItemLeave(x):(l.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,de(x=>l.onItemLeave(x))),onFocus:R(e.onFocus,()=>h(!0)),onBlur:R(e.onBlur,()=>h(!1))})})})},"MenuItemImpl")),fr="MenuRadioGroup",[Is,js]=Z(fr,{value:void 0,onValueChange:L(()=>{},"onValueChange")}),pr="MenuItemIndicator",[Ms,Ss]=Z(pr,{checked:!1}),hr=m.forwardRef(L(function(e,t){const{__scopeMenu:s,...a}=e;return r.jsx(Ie.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})},"MenuSeparator")),xr="MenuSub",[Cs,Ls]=Z(xr);function gt(n){return n?"open":"closed"}L(gt,"getOpenState");function vt(n){return n==="indeterminate"}L(vt,"isIndeterminate");function gr(n){return vt(n)?"indeterminate":n?"checked":"unchecked"}L(gr,"getCheckedState");function bt(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}L(bt,"focusFirst");function wt(n,e){return n.map((t,s)=>n[(e+s)%n.length])}L(wt,"wrapArray");function yt(n,e,t){const a=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let o=wt(n,Math.max(i,0));a.length===1&&(o=o.filter(u=>u!==t));const d=o.find(u=>u.toLowerCase().startsWith(a.toLowerCase()));return d!==t?d:void 0}L(yt,"getNextMatch");function It(n,e){const{x:t,y:s}=n;let a=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const l=e[i],d=e[o],u=l.x,c=l.y,f=d.x,h=d.y;c>s!=h>s&&t<(f-u)*(s-c)/(h-c)+u&&(a=!a)}return a}L(It,"isPointInPolygon");function jt(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return It(t,e)}L(jt,"isPointerInGraceArea");function de(n){return e=>e.pointerType==="mouse"?n(e):void 0}L(de,"whenMouse");var vr=tr,br=nr,wr=or,yr=ir,Ir=dr,jr=hr,Mr=Object.defineProperty,re=(n,e)=>Mr(n,"name",{value:e,configurable:!0}),Ee="DropdownMenu",[Sr,Mt]=Xe(Ee,[mt]),se=mt(),[Cr,St]=Sr(Ee),Ct=re(n=>{const{__scopeDropdownMenu:e,children:t,dir:s,open:a,defaultOpen:i,onOpenChange:o,modal:l=!0}=n,d=se(e),u=m.useRef(null),[c,f]=Ze({prop:a,defaultProp:i??!1,onChange:o,caller:Ee});return r.jsx(Cr,{scope:e,triggerId:ke(),triggerRef:u,contentId:ke(),open:c,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(h=>!h),[f]),modal:l,children:r.jsx(vr,{...d,open:c,onOpenChange:f,dir:s,modal:l,children:t})})},"DropdownMenu"),Lr="DropdownMenuTrigger",Lt=m.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,disabled:a=!1,...i}=e,o=St(Lr,s),l=se(s),d=Q(t,o.triggerRef);return r.jsx(br,{asChild:!0,...l,children:r.jsx(Ie.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...i,ref:d,onPointerDown:R(e.onPointerDown,u=>{!a&&u.button===0&&u.ctrlKey===!1&&(o.onOpenToggle(),o.open||u.preventDefault())}),onKeyDown:R(e.onKeyDown,u=>{a||(["Enter"," "].includes(u.key)&&o.onOpenToggle(),u.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})},"DropdownMenuTrigger")),Tt=re(n=>{const{__scopeDropdownMenu:e,...t}=n,s=se(e);return r.jsx(wr,{...s,...t})},"DropdownMenuPortal"),Tr="DropdownMenuContent",Nt=m.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,...a}=e,i=St(Tr,s),o=se(s),l=m.useRef(!1);return r.jsx(yr,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...a,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,d=>{var u;l.current||(u=i.triggerRef.current)==null||u.focus(),l.current=!1,d.preventDefault()}),onInteractOutside:R(e.onInteractOutside,d=>{const u=d.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0,f=u.button===2||c;(!i.modal||f)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),Rt=m.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,...a}=e,i=se(s);return r.jsx(Ir,{...i,...a,ref:t})},"DropdownMenuItem")),Pt=m.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,...a}=e,i=se(s);return r.jsx(jr,{...i,...a,ref:t})},"DropdownMenuSeparator")),Et=Ct,Dt=Lt,Nr=Tt,At=Nt,_t=Rt,Ot=Pt;const Rr=Object.freeze(Object.defineProperty({__proto__:null,Content:At,DropdownMenu:Ct,DropdownMenuContent:Nt,DropdownMenuItem:Rt,DropdownMenuPortal:Tt,DropdownMenuSeparator:Pt,DropdownMenuTrigger:Lt,Item:_t,Portal:Nr,Root:Et,Separator:Ot,Trigger:Dt,createDropdownMenuScope:Mt},Symbol.toStringTag,{value:"Module"})),Pr=fe(Dt),Er=fe(At),Dr=fe(_t),Ar=fe(Ot),kt=m.forwardRef((n,e)=>{const t=_(15);let s,a,i;t[0]!==n?({onClick:a,disabled:s,...i}=n,t[0]=n,t[1]=s,t[2]=a,t[3]=i):(s=t[1],a=t[2],i=t[3]);const o=P(_r),{switchToNewThread:l}=Hn();let d;t[4]!==o?(d=o?{"data-active":"true","aria-current":"true"}:null,t[4]=o,t[5]=d):d=t[5];let u;t[6]!==a||t[7]!==l?(u=R(a,l),t[6]=a,t[7]=l,t[8]=u):u=t[8];let c;return t[9]!==s||t[10]!==e||t[11]!==i||t[12]!==d||t[13]!==u?(c=r.jsx(je.button,{type:"button",...d,...i,ref:e,disabled:s,onClick:u}),t[9]=s,t[10]=e,t[11]=i,t[12]=d,t[13]=u,t[14]=c):c=t[14],c});kt.displayName="ThreadListPrimitive.New";function _r(n){return n.threads.newThreadId===n.threads.mainThreadId}const Or=()=>{const{loadMore:n,disabled:e}=Un();return e?null:n},kr=ae("ThreadListPrimitive.LoadMore",Or),[Br,Fr]=Je("ThreadList"),ye=Br,Bt=Se(null),Kr=Bt.Provider,De=()=>Me(Bt),Ft=m.forwardRef((n,e)=>{const t=_(3);let s;return t[0]!==n||t[1]!==e?(s=r.jsx(ye.Provider,{scope:void 0,children:r.jsx(ye.Slot,{scope:void 0,children:r.jsx(je.div,{...n,ref:e})})}),t[0]=n,t[1]=e,t[2]=s):s=t[2],s});Ft.displayName="ThreadListPrimitive.Root";var $r=Ce({ItemByIndex:()=>ct,Items:()=>lt,LoadMore:()=>kr,New:()=>kt,Root:()=>Ft});const Kt=m.forwardRef((n,e)=>{const t=P(u=>u.threads.mainThreadId===u.threadListItem.id),s=Be(null),a=Be(null),i=We(()=>({triggerRef:s,moreRef:a}),[]),o=Fr(void 0),l=me(),d=u=>{const c=l==="rtl"?"ArrowLeft":"ArrowRight",f=l==="rtl"?"ArrowRight":"ArrowLeft",h=s.current,p=a.current;if(h&&u.target===h)if(u.key==="ArrowDown"||u.key==="ArrowUp"){const v=o().map(b=>b.ref.current).filter(b=>b!==null),x=v[v.indexOf(h)+(u.key==="ArrowDown"?1:-1)];x&&(x.focus(),u.preventDefault())}else u.key===c&&p&&(p.focus(),u.preventDefault());else p&&u.target===p&&u.key===f&&(h==null||h.focus(),u.preventDefault())};return r.jsx(Kr,{value:i,children:r.jsx(je.div,{...t?{"data-active":"true","aria-current":"true"}:null,...n,onKeyDown:R(n.onKeyDown,d),ref:e})})});Kt.displayName="ThreadListItemPrimitive.Root";const zr=()=>{const{archive:n}=Kn();return n},Gr=ae("ThreadListItemPrimitive.Archive",zr),Hr=()=>{const{unarchive:n}=zn();return n},Ur=ae("ThreadListItemPrimitive.Unarchive",Hr),Vr=()=>{const{delete:n}=$n();return n},Wr=ae("ThreadListItemPrimitive.Delete",Vr),Xr=()=>{const{switchTo:n}=Gn();return n},Yr=ae("ThreadListItemPrimitive.Trigger",Xr),$t=m.forwardRef((n,e)=>{var i;const t=_(3),s=Q(e,(i=De())==null?void 0:i.triggerRef);let a;return t[0]!==n||t[1]!==s?(a=r.jsx(ye.ItemSlot,{scope:void 0,children:r.jsx(Yr,{...n,ref:s})}),t[0]=n,t[1]=s,t[2]=a):a=t[2],a});$t.displayName="ThreadListItemPrimitive.Trigger";var zt=Ce({Archive:()=>Gr,Delete:()=>Wr,Root:()=>Kt,Title:()=>ut,Trigger:()=>$t,Unarchive:()=>Ur});const ce=Mt(),Gt=Se(()=>{}),Ht=()=>Me(Gt),Ut=Se(!1),Vt=()=>Me(Ut),Wt=n=>{const e=_(26);let t,s,a,i,o,l,d;e[0]!==n?({__scopeThreadListItemMore:t,open:o,defaultOpen:s,onOpenChange:i,sharedFocusGroup:d,modal:a,...l}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=a,e[4]=i,e[5]=o,e[6]=l,e[7]=d):(t=e[1],s=e[2],a=e[3],i=e[4],o=e[5],l=e[6],d=e[7]);const u=d===void 0?!1:d,c=u?!1:a??!0,f=ce(t),h=s??!1;let p;e[8]!==i?(p=i?{onChange:i}:{},e[8]=i,e[9]=p):p=e[9];let v;e[10]!==o||e[11]!==h||e[12]!==p?(v={prop:o,defaultProp:h,caller:"ThreadListItemMorePrimitive.Root",...p},e[10]=o,e[11]=h,e[12]=p,e[13]=v):v=e[13];const[x,b]=Ze(v);let S;e[14]!==c||e[15]!==x||e[16]!==l||e[17]!==f||e[18]!==b?(S=r.jsx(Et,{...f,...l,modal:c,open:x,onOpenChange:b}),e[14]=c,e[15]=x,e[16]=l,e[17]=f,e[18]=b,e[19]=S):S=e[19];let y;e[20]!==b||e[21]!==S?(y=r.jsx(Gt.Provider,{value:b,children:S}),e[20]=b,e[21]=S,e[22]=y):y=e[22];let j;return e[23]!==u||e[24]!==y?(j=r.jsx(Ut.Provider,{value:u,children:y}),e[23]=u,e[24]=y,e[25]=j):j=e[25],j};Wt.displayName="ThreadListItemMorePrimitive.Root";const Xt=m.forwardRef((n,e)=>{const t=_(10),{__scopeThreadListItemMore:s,...a}=n,i=ce(s),o=De(),l=Ht(),d=Vt(),u=Q(e,o==null?void 0:o.moreRef),c=me()==="rtl"?"ArrowLeft":"ArrowRight",f=Pr;let h;t[0]!==c||t[1]!==l||t[2]!==d?(h=x=>{!d||x.key!==c||(x.preventDefault(),l(!0))},t[0]=c,t[1]=l,t[2]=d,t[3]=h):h=t[3];const p=R(a.onKeyDown,h);let v;return t[4]!==f||t[5]!==u||t[6]!==a||t[7]!==i||t[8]!==p?(v=r.jsx(f,{...i,...a,onKeyDown:p,ref:u}),t[4]=f,t[5]=u,t[6]=a,t[7]=i,t[8]=p,t[9]=v):v=t[9],v});Xt.displayName="ThreadListItemMorePrimitive.Trigger";const Yt=m.forwardRef((n,e)=>{const t=_(21),{__scopeThreadListItemMore:s,portalProps:a,sideOffset:i,...o}=n,l=i===void 0?4:i,d=ce(s),u=Ht(),c=De(),f=Vt(),h=me()==="rtl"?"ArrowRight":"ArrowLeft",p=Rr,v=Er;let x;t[0]!==h||t[1]!==(c==null?void 0:c.moreRef)||t[2]!==u||t[3]!==f?(x=E=>{var k;!f||E.key!==h||(E.preventDefault(),u(!1),(k=c==null?void 0:c.moreRef.current)==null||k.focus())},t[0]=h,t[1]=c==null?void 0:c.moreRef,t[2]=u,t[3]=f,t[4]=x):x=t[4];const b=R(o.onKeyDown,x);let S;t[5]!==(c==null?void 0:c.moreRef)||t[6]!==f?(S=()=>{var E;f&&((E=c==null?void 0:c.moreRef.current)==null||E.focus())},t[5]=c==null?void 0:c.moreRef,t[6]=f,t[7]=S):S=t[7];const y=R(o.onEscapeKeyDown,S);let j;t[8]!==v||t[9]!==e||t[10]!==o||t[11]!==d||t[12]!==l||t[13]!==b||t[14]!==y?(j=r.jsx(v,{...d,...o,onKeyDown:b,onEscapeKeyDown:y,ref:e,sideOffset:l}),t[8]=v,t[9]=e,t[10]=o,t[11]=d,t[12]=l,t[13]=b,t[14]=y,t[15]=j):j=t[15];let O;return t[16]!==a||t[17]!==d||t[18]!==p.Portal||t[19]!==j?(O=r.jsx(p.Portal,{...d,...a,children:j}),t[16]=a,t[17]=d,t[18]=p.Portal,t[19]=j,t[20]=O):O=t[20],O});Yt.displayName="ThreadListItemMorePrimitive.Content";const qt=m.forwardRef((n,e)=>{const t=_(7);let s,a;t[0]!==n?({__scopeThreadListItemMore:s,...a}=n,t[0]=n,t[1]=s,t[2]=a):(s=t[1],a=t[2]);const i=ce(s);let o;return t[3]!==e||t[4]!==a||t[5]!==i?(o=r.jsx(Dr,{...i,...a,ref:e}),t[3]=e,t[4]=a,t[5]=i,t[6]=o):o=t[6],o});qt.displayName="ThreadListItemMorePrimitive.Item";const Jt=m.forwardRef((n,e)=>{const t=_(7);let s,a;t[0]!==n?({__scopeThreadListItemMore:s,...a}=n,t[0]=n,t[1]=s,t[2]=a):(s=t[1],a=t[2]);const i=ce(s);let o;return t[3]!==e||t[4]!==a||t[5]!==i?(o=r.jsx(Ar,{...i,...a,ref:e}),t[3]=e,t[4]=a,t[5]=i,t[6]=o):o=t[6],o});Jt.displayName="ThreadListItemMorePrimitive.Separator";var ve=Ce({Content:()=>Yt,Item:()=>qt,Root:()=>Wt,Separator:()=>Jt,Trigger:()=>Xt});function qr(){const n=ne(),e=et(),t=Le(),s=nt(),a=t||s,[i,o]=m.useState(!1),[l,d]=m.useState(""),[u,c]=m.useState(null),f=m.useRef(null),h=m.useRef(null),p=m.useId(),v=(n==null?void 0:n.isLibraryEnabled)===!0&&e!=null,x=(n==null?void 0:n.historyAgentFilter)??null;m.useEffect(()=>{i||d("")},[i]);const{agents:b,isInitialLoading:S,isSearching:y,loadingMore:j,hasMore:O,listRef:E,sentinelRef:k}=In({enabled:i&&v,query:l});if(m.useLayoutEffect(()=>{if(!i||a){c(null);return}const M=()=>{var D;const T=(D=f.current)==null?void 0:D.getBoundingClientRect();T&&c({top:T.top,left:T.right+4})};return M(),window.addEventListener("resize",M),window.addEventListener("scroll",M,!0),()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0)}},[i,a]),m.useEffect(()=>{if(!i||a)return;const M=T=>{var W,I;const D=T.target;(W=f.current)!=null&&W.contains(D)||(I=h.current)!=null&&I.contains(D)||o(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[i,a]),!v)return null;const B=M=>{(n==null?void 0:n.isComposerEnabled)===!0?n.openDraft():n==null||n.openLibraryHome(),n==null||n.setHistoryAgentFilter(M),o(!1)},N=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"p-1",onMouseDown:M=>M.stopPropagation(),children:[r.jsx(jn,{query:l,setQuery:d,placeholder:"Search agents"}),y?r.jsx("p",{className:"text-text-secondary px-1 pt-1 text-[11px]",role:"status",children:"Searching…"}):null]}),r.jsxs("div",{ref:E,className:K("mt-1 overflow-y-auto",a?"min-h-0 flex-1 px-1 pb-2":"min-h-48 max-h-64"),children:[l.trim()===""?r.jsxs(Ke,{className:K("justify-between",x==null&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>B(null),children:["All chats",x==null?r.jsx(V,{name:"check",className:"size-3.5 shrink-0"}):null]}):null,S?r.jsx("p",{className:"px-2 py-3 text-center text-xs text-text-secondary",children:"Loading…"}):b.length===0?r.jsx("p",{className:"text-text-secondary px-2 py-6 text-center text-xs",role:"status",children:l.trim()?`No agents match "${l.trim()}".`:"No agents yet."}):r.jsxs(r.Fragment,{children:[b.map(M=>{const T=Mn(M),D=(x==null?void 0:x.agentId)===T;return r.jsxs(Ke,{className:K("justify-between gap-2 text-left",D&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>B({agentId:T,agentName:M.name,intent:"history"}),children:[r.jsx("span",{className:"min-w-0 truncate",children:M.name}),D?r.jsx(V,{name:"check",className:"size-3.5 shrink-0"}):null]},T)}),O?r.jsx("div",{ref:k,className:"flex h-6 shrink-0 items-center justify-center","aria-hidden":!0,children:j?r.jsx("span",{className:"text-text-secondary text-[11px]",role:"status",children:"Loading more…"}):null}):null]})]})]});return r.jsxs("div",{className:"relative shrink-0",children:[r.jsxs("button",{ref:f,type:"button","aria-label":x!=null?`Filter chat history by agent (${x.agentName})`:"Filter chat history by agent","aria-haspopup":a?"dialog":"menu","aria-expanded":i,"aria-controls":i?p:void 0,title:"Filter by agent",className:te({variant:"ghost",size:"icon",className:K("relative size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text",x!=null&&"text-text-primary")}),onClick:()=>o(M=>!M),children:[r.jsx(V,{name:"funnel",className:"size-3.5"}),x!=null?r.jsx("span",{className:"bg-primary-button-bg absolute top-1 right-1 size-1.5 rounded-full","aria-hidden":!0,"data-testid":"history-filter-active-dot"}):null]}),a&&i?r.jsx(rt,{open:!0,onOpenChange:o,id:p,"aria-label":"Filter agents",children:r.jsx("div",{className:"flex min-h-0 flex-1 flex-col p-2",role:"menu",children:N})}):null,!a&&i&&u!=null?Sn.createPortal(r.jsx("div",{ref:h,id:p,role:"menu","aria-label":"Filter agents",style:{top:u.top,left:u.left},className:"aui-popup-enter font-sans-flex fixed z-50 w-56 rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md",children:N}),Cn(f.current)):null]})}function Jr({open:n,initialTitle:e,saving:t=!1,onOpenChange:s,onSave:a}){const[i,o]=m.useState(e),l=m.useRef(null);m.useEffect(()=>{n&&o(e)},[n,e]),m.useEffect(()=>{if(!n)return;const p=l.current;p!=null&&(p.focus(),p.select())},[n]);const d=i.trim(),c=d.length>0&&d.length<=$e&&!t,f=()=>{c&&a(d)},h=p=>{t||s(p)};return r.jsx(Ln,{open:n,onOpenChange:h,title:"Rename session",contentSized:!0,"aria-label":"Rename session",footer:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ze.Secondary,{type:"button",disabled:t,onClick:()=>h(!1),children:"Cancel"}),r.jsx(ze.Primary,{type:"button",disabled:!c,onClick:f,children:"Save"})]}),children:r.jsx("div",{className:"px-5 py-4",children:r.jsx("input",{ref:l,"aria-label":"Session title",value:i,readOnly:t,maxLength:$e,className:Tn("h-9"),onChange:p=>o(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),f())}})})})}var Qr="flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium outline-none transition-colors hover:bg-ghost-button-hover focus:bg-ghost-button-hover data-[highlighted]:bg-ghost-button-hover",Zr="flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-failure-bg outline-none transition-colors hover:bg-failure-bg/12 hover:text-failure-bg focus:bg-failure-bg/12 focus:text-failure-bg data-[highlighted]:bg-failure-bg/12 data-[highlighted]:text-failure-bg";function es({canRename:n,renameDisabled:e,canDelete:t,deleteDisabled:s,onRename:a,onDelete:i}){const o=C("PermissionGuard"),l=nt(),d=Le(),[u,c]=m.useState(!1),[f,h]=m.useState(),p=d||l,v=m.useCallback(y=>{const j=y==null?void 0:y.closest(".aui-theme-root");h(j instanceof HTMLElement?j:void 0)},[]),x=te({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-text-secondary hover:bg-transparent hover:text-text-primary"}),b=n?r.jsx(o,{allowed:!e,children:r.jsxs("button",{type:"button",className:Qr,disabled:e,onClick:()=>{e||(c(!1),a())},children:[r.jsx(V,{name:"pencil",className:"size-3.5"}),"Rename"]})}):null,S=t?r.jsx(o,{allowed:!s,children:r.jsxs(zt.Delete,{className:Zr,onClick:()=>{s||(c(!1),i())},children:[r.jsx(V,{name:"trash",className:"size-3.5"}),"Delete"]})}):null;return p?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Session actions",title:"Session actions","aria-haspopup":"dialog","aria-expanded":u,className:x,onClick:()=>c(!0),children:r.jsx(V,{name:"ellipsis",className:"size-3.5"})}),u?r.jsx(rt,{open:!0,onOpenChange:c,"aria-label":"Session actions",children:r.jsxs("div",{className:"flex flex-col gap-1 p-2 *:w-full",role:"menu",children:[b,S]})}):null]}):r.jsxs(ve.Root,{sharedFocusGroup:!0,children:[r.jsx(ve.Trigger,{ref:v,"aria-label":"Session actions",title:"Session actions",className:x,children:r.jsx(V,{name:"ellipsis",className:"size-3.5"})}),r.jsxs(ve.Content,{portalProps:{container:f},align:"end",sideOffset:4,className:"aui-popup-enter font-sans-flex z-50 min-w-32 rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md *:w-full",children:[b,S]})]})}function ts({onThreadOpen:n,canRenameSession:e,canDeleteSession:t,canManageResource:s,canDeleteResource:a}){const i=X(),o=ne(),l=tt(),d=bn(),u=C("ThreadListRow"),c=P(I=>I.threadListItem.id),f=P(I=>I.threadListItem.remoteId),h=P(I=>I.threadListItem.title),p=P(I=>I.threadListItem.lastMessageAt),v=P(I=>I.threadListItem.custom),x=P(I=>I.threads.mainThreadId),b=wn(v),S=e&&f!=null,y=t&&f!=null,j=S||y,O=f!=null&&!s(f),E=f!=null&&!a(f),k=(o==null?void 0:o.libraryOpen)===!0||(o==null?void 0:o.sessionsOpen)===!0||(o==null?void 0:o.schedulesOpen)===!0||(o==null?void 0:o.environmentsOpen)===!0,[B,N]=m.useState(!1),[M,T]=m.useState(!1),D=h??"New Chat",W=async I=>{if(I===(h??"").trim()){N(!1);return}T(!0);try{await i.threadListItem().rename(I),l(le.Session.RENAMED,ue(void 0,{sessionId:f,agentName:b})),N(!1)}catch(F){d==null||d.showError(F)}finally{T(!1)}};return r.jsxs(zt.Root,{className:"min-w-0",children:[r.jsx(u,{title:D,active:c===x&&!k,agentName:b,lastMessageAt:p,onSelect:()=>{l(le.Session.SELECTED,ue({is_mutable:Fe(v)},{sessionId:f,agentName:b})),n==null||n(),o==null||o.setSettingsOpen(!1),o==null||o.setLibraryOpen(!1),o==null||o.setSessionsOpen(!1),o==null||o.setSchedulesOpen(!1),o==null||o.setEnvironmentsOpen(!1);const I=Fe(v),F=!I&&(o==null?void 0:o.mode.status)==="active"&&!o.mode.isMutable&&(b==null?o.mode.agentName==null&&o.mode.agentId==null:o.mode.agentName===b||o.mode.agentId===b),G=yn({sessionMutable:I,shellMutable:(o==null?void 0:o.mode.status)==="active"&&o.mode.isMutable,...(o==null?void 0:o.mode.status)==="active"&&o.mode.isMutable?{shellAgentName:o.mode.agentName,shellAgentId:o.mode.agentId}:{},remoteId:f,pendingSessionId:o==null?void 0:o.pendingSessionId});if((F||G)&&f!=null&&(o==null?void 0:o.sessionAccessError)==null){Promise.resolve(i.threads().switchToThread(c)).catch(()=>{});return}if(f!=null){o==null||o.openHistorySession({sessionId:f,isMutable:I,...b!=null?{agentName:b}:{}});return}Promise.resolve(i.threads().switchToThread(c)).catch(()=>{})},actions:j?r.jsx(es,{canRename:S,renameDisabled:O,canDelete:y,deleteDisabled:E,onRename:()=>N(!0),onDelete:()=>{l(le.Session.DELETED,ue(void 0,{sessionId:f,agentName:b}))}}):void 0}),r.jsx(Jr,{open:B,initialTitle:h??"",saving:M,onOpenChange:N,onSave:I=>{W(I)}})]})}function ns(n){const e=P(s=>s.threads.threadIds),t=P(s=>s.threads.threadItems);return m.useMemo(()=>{const s=vn({threadIds:e,threadItems:t});if(n==="default")return s;const a=new Map;for(const i of t)a.set(i.id,i),i.remoteId!=null&&a.set(i.remoteId,i);return s.filter(i=>{const o=e[i];if(o===void 0)return!1;const l=a.get(o);return(l==null?void 0:l.remoteId)!=null})},[e,t,n])}function rs(n){return n==="recent-history"||n==="mobile-drawer"}function ss({indices:n,onThreadOpen:e,canRenameSession:t,canDeleteSession:s,canManageResource:a,canDeleteResource:i}){const o=P(l=>l.threads.threadIds);return r.jsx(r.Fragment,{children:n.map(l=>{const d=o[l]??String(l);return r.jsx(Ne,{index:l,archived:!1,children:r.jsx(ts,{onThreadOpen:e,canRenameSession:t,canDeleteSession:s,canManageResource:a,canDeleteResource:i})},d)})})}var os="aui_thread-list-viewport",as=80;function is({children:n,viewportRef:e,hideScrollbar:t}){var d;const s=ne(),a=P(u=>u.threadListItem.remoteId),i=(d=s==null?void 0:s.historyAgentFilter)==null?void 0:d.intent,o=(s==null?void 0:s.isLibraryEnabled)===!0&&i!=="try-agent"&&(i==="history"||s.mode.status!=="active"||s.mode.isMutable||s.pendingSessionId!=null||a!=null),l=(s==null?void 0:s.historyAgentFilter)==null?"Chat History":`Chats for ${s.historyAgentFilter.agentName}`;return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-1 py-1",children:[r.jsx("h2",{className:"min-w-0 flex-1 truncate px-1.5 py-1 text-sm font-medium text-text-secondary",children:l}),o?r.jsx(qr,{}):null]}),r.jsx("div",{ref:e,"data-slot":os,className:K("flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",t&&"aui-scrollbar-hidden"),children:n})]})}function Qt({onThreadOpen:n,variant:e="default"}={}){const t=X(),s=et(),a=tt(),i=P(w=>w.threads.isLoading),o=P(w=>w.threads.isLoadingMore),l=P(w=>w.threads.hasMore),d=P(w=>w.threads.threadIds),u=P(w=>w.threads.threadItems),c=ne(),f=C("ThreadListShell"),h=C("ThreadListNewButton"),p=C("AgentsLibraryButton"),v=C("SessionsBrowserButton"),x=C("SchedulesButton"),b=C("EnvironmentsButton"),S=C("ThreadListRowSkeleton"),y=C("ThreadListEmptyState"),j=ns(e),O=m.useRef(null),E=m.useRef(l),k=m.useRef(t);E.current=l,k.current=t;const B=(c==null?void 0:c.isNewChatEnabled)!==!1,N=(c==null?void 0:c.mode.status)==="idle",M=rs(e),T=e==="mobile-drawer",D=typeof(s==null?void 0:s.renameSession)=="function",W=typeof(s==null?void 0:s.deleteSession)=="function",I=m.useMemo(()=>u.flatMap(w=>w.remoteId==null?[]:[w.remoteId]),[u]),{allows:F}=gn({resourceType:"session",resourceIds:I});m.useEffect(()=>{if(N||i||o)return;const w=O.current;if(!w)return;let $=!1;const g=()=>{if($||!E.current||w.clientHeight<=0)return;const z=w.scrollHeight-w.scrollTop-w.clientHeight;w.scrollHeight>w.clientHeight&&z>as||k.current.threads().loadMore()};w.addEventListener("scroll",g,{passive:!0});const A=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>g());return A?A.observe(w):window.addEventListener("resize",g),g(),()=>{$=!0,w.removeEventListener("scroll",g),A==null||A.disconnect(),A||window.removeEventListener("resize",g)}},[l,N,i,o,d.length]);const G=()=>{if(a(le.Session.NEW,ue({is_composer_enabled:(c==null?void 0:c.isComposerEnabled)===!0},{...(c==null?void 0:c.mode.status)==="active"?{agentId:c.mode.agentId,agentName:c.mode.agentName}:{}})),n==null||n(),c==null||c.setLibraryOpen(!1),c==null||c.setSessionsOpen(!1),c!=null&&c.isComposerEnabled){c.openDraft();return}c==null||c.setSettingsOpen(!1),c==null||c.setSchedulesOpen(!1),c==null||c.setEnvironmentsOpen(!1),Promise.resolve(t.threads().switchToNewThread()).catch(()=>{})};let H;N?H=r.jsx(y,{message:M?"No recent chats":void 0}):i?H=r.jsx(S,{}):j.length===0?H=r.jsx(y,{message:M?"No recent chats":void 0}):H=r.jsx($r.Root,{className:"flex min-h-0 flex-col gap-0.5",children:r.jsx(ss,{indices:j,onThreadOpen:n,canRenameSession:D,canDeleteSession:W,canManageResource:w=>F(w,"MANAGE"),canDeleteResource:w=>F(w,"DELETE")})});const U=e==="recent-history"?null:r.jsxs("div",{className:"flex flex-col gap-1",children:[B?r.jsx(h,{onClick:G}):null,r.jsx("div",{className:"contents",onClick:()=>{T&&(n==null||n())},children:r.jsx(p,{})}),T?null:r.jsxs(r.Fragment,{children:[r.jsx(v,{}),r.jsx(x,{}),r.jsx(b,{})]})]});return r.jsx(f,{header:U,children:r.jsxs(is,{viewportRef:O,hideScrollbar:M,children:[H,!N&&l?r.jsx("div",{className:"h-4 shrink-0","aria-hidden":!0}):null]})})}var cs=m.lazy(()=>Te(()=>import("./SettingsBuilder-MZNSGTCG-DW5WrGhz.js"),__vite__mapDeps([0,1,2]),import.meta.url)),ls=m.lazy(()=>Te(()=>import("./SchedulesPage-YFIJGKZO-BbTOcGO5.js"),__vite__mapDeps([3,4,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),us=m.lazy(()=>Te(()=>import("./EnvironmentsPage-FCDIVAKH-Crq_Zjm_.js"),__vite__mapDeps([5,4,1,2]),import.meta.url).then(n=>({default:n.EnvironmentsPage}))),ds="h-5 w-5 max-w-40 shrink-0 object-contain",ms="h-5 max-w-40 shrink-0 object-contain",fs="w-20",ps="w-80",Ue=K(_n,"text-sidebar-text"),Ve="bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";function hs({overlayOpen:n,mode:e}){return!n&&(e==null?void 0:e.status)==="active"&&!e.isCreateAgent}function xs(){return Dn().presentation==="full"?null:r.jsx("aside",{"aria-label":"Recent chats",className:"hidden min-h-0 w-64 shrink-0 border-r border-border bg-sidebar-bg md:flex",children:r.jsx(Qt,{variant:"recent-history"})})}function gs(){var p;const n=X(),e=ne(),t=C("AgentsLibraryButton"),s=C("SessionsBrowserButton"),a=C("SchedulesButton"),i=C("EnvironmentsButton"),o=(e==null?void 0:e.isNewChatEnabled)!==!1,l=(e==null?void 0:e.settingsOpen)===!0||(e==null?void 0:e.libraryOpen)===!0||(e==null?void 0:e.sessionsOpen)===!0||(e==null?void 0:e.schedulesOpen)===!0||(e==null?void 0:e.environmentsOpen)===!0,d=e==null?void 0:e.mode,u=!l&&(d==null?void 0:d.status)==="active"&&!d.isCreateAgent&&((p=e==null?void 0:e.historyAgentFilter)==null?void 0:p.intent)!=="try-agent",c=!l&&d!=null&&st(d),f=()=>{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(n.threads().switchToNewThread()).catch(()=>{})},h=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return r.jsxs("nav",{className:"flex min-h-0 flex-1 flex-col items-center gap-1 p-1","aria-label":"Sidebar",children:[o?r.jsxs("button",{type:"button","aria-label":"Start new chat",title:"New chat","aria-current":u?"page":void 0,className:te({variant:"ghost",className:K(Ue,u&&Ve)}),onClick:f,children:[r.jsx(V,{name:"square-pen",size:14}),r.jsx("span",{className:"text-center",children:"New Chat"})]}):null,o&&(e!=null&&e.isComposerEnabled)?r.jsxs("button",{type:"button","aria-label":"Start new agent",title:"New Agent","aria-current":c?"page":void 0,className:te({variant:"ghost",className:K(Ue,c&&Ve)}),onClick:h,children:[r.jsx(V,{name:"agent-2",size:14}),r.jsx("span",{className:"text-center whitespace-nowrap",children:"Build Agent"})]}):null,r.jsx(t,{compact:!0}),r.jsx(s,{compact:!0}),r.jsx(a,{compact:!0}),r.jsx(i,{compact:!0})]})}function vs({className:n,railRef:e,...t}){const s=ot(),a=at(s),i=C("BrandLogo"),o=C("UserAvatar");return r.jsxs("aside",{ref:e,className:K(fs,"flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar-bg",n),...t,children:[r.jsx("div",{className:"flex h-14 w-full shrink-0 items-center justify-center text-text-primary",children:r.jsx(i,{variant:a.collapsedVariant,className:ds})}),r.jsx(gs,{}),r.jsxs("footer",{className:"flex shrink-0 flex-col items-center border-border p-2",children:[r.jsx(it,{labeled:!0,className:"flex-col"}),r.jsx(o,{labeled:!0,className:"mt-2 py-1.5"})]})]})}function bs({drawerRef:n,onClose:e}){const t=ot(),s=at(t),a=An(),i=C("BrandLogo"),o=C("UserAvatar");return r.jsxs("aside",{ref:n,role:"dialog","aria-label":"Navigation",tabIndex:-1,className:K(ps,"absolute inset-y-0 left-0 z-10 flex min-h-0 flex-col border-r border-border bg-sidebar-bg shadow-lg outline-none md:hidden"),children:[r.jsxs("div",{className:"flex h-14 w-full shrink-0 items-center gap-2 border-b border-border px-3 text-text-primary",children:[r.jsx(i,{variant:s.expandedVariant,className:ms}),s.showTitle&&a!=null?r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:a}):r.jsx("span",{className:"min-w-0 flex-1"}),r.jsx("button",{type:"button","aria-label":"Close navigation",className:te({variant:"ghost",size:"icon"}),onClick:e,children:r.jsx(V,{name:"xmark"})})]}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Qt,{variant:"mobile-drawer",onThreadOpen:e})}),r.jsxs("footer",{className:"flex shrink-0 items-center justify-around gap-1 border-t border-border p-2 text-sidebar-text",children:[r.jsx(it,{labeled:!0,onAction:e,className:"contents"}),r.jsx(o,{labeled:!0})]})]})}function Ts({className:n}){const e=ne(),t=Le(),s=C("AgentDetailsPage"),a=C("AgentsLibrary"),i=C("SessionsPage"),o=C("ShareChatButton"),l=C("ResetAgentBuilderButton"),d=C("ClearChatButton"),u=C("SaveAgentButton"),c=C("SelectAgentEmptyState"),[f,h]=m.useState(!1),p=m.useRef(null),v=m.useRef(null),x=m.useRef(null),b=m.useRef(!1),S=(e==null?void 0:e.mode.status)==="idle",y=(e==null?void 0:e.settingsOpen)===!0,j=(e==null?void 0:e.libraryOpen)===!0,O=j&&(e==null?void 0:e.libraryAgentId)==null,E=(e==null?void 0:e.sessionsOpen)===!0,k=(e==null?void 0:e.schedulesOpen)===!0,B=(e==null?void 0:e.environmentsOpen)===!0,N=y||j||E||k||B,M=e!=null&&st(e.mode),T=t&&(E||k||B||M&&!y&&!j),D=M&&!N&&!t,W=hs({overlayOpen:N,mode:e==null?void 0:e.mode}),I=Nn(),F=t&&(y||O),G=()=>h(!1),H=r.jsx("button",{ref:p,type:"button","aria-label":"Navigation","aria-expanded":f,className:K(te({variant:"ghost",size:"icon"}),"md:hidden"),onClick:()=>h(!0),children:r.jsx(V,{name:"panel-left"})});return m.useEffect(()=>{if(!f)return;const U=w=>{w.key==="Escape"&&(w.stopImmediatePropagation(),h(!1))};return window.addEventListener("keydown",U,!0),()=>window.removeEventListener("keydown",U,!0)},[f]),m.useEffect(()=>{var w,$;const U=x.current;if(f){b.current=!0,U&&(U.inert=!0),(w=v.current)==null||w.focus();return}b.current&&(U&&(U.inert=!1),($=p.current)==null||$.focus(),b.current=!1)},[f]),r.jsxs("div",{className:K("relative flex h-full min-h-0 w-full min-w-0",n),children:[r.jsx(vs,{className:"hidden md:flex"}),D?r.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:max-w-140 md:flex-1 md:shadow-none 2xl:max-w-150",children:r.jsx(On,{})}):null,r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-primary-bg",children:[F?null:r.jsx(Rn,{className:K("bg-topbar-bg",(N||S||!I||T)&&"md:hidden"),start:H,title:!N&&!T?r.jsx(kn,{}):null,end:!N&&!T?r.jsxs(r.Fragment,{children:[r.jsx(l,{}),r.jsx(o,{}),r.jsx(d,{}),r.jsx(u,{})]}):null}),r.jsx(Pn,{children:r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[W?r.jsx(xs,{}):null,r.jsx("div",{ref:x,className:"min-h-0 min-w-0 flex-1",children:y?r.jsx(m.Suspense,{fallback:r.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[r.jsx(ge,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(cs,{...F?{headerStart:H}:{}})}):T?r.jsx(En,{}):E?r.jsx(i,{}):j&&(e==null?void 0:e.libraryAgentId)!=null?r.jsx(s,{agentId:e.libraryAgentId},e.libraryAgentId):j?r.jsx(a,{onSelectAgent:G,...F?{headerStart:H}:{}}):k?r.jsx(m.Suspense,{fallback:r.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[r.jsx(ge,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(ls,{})}):B?r.jsx(m.Suspense,{fallback:r.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[r.jsx(ge,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(us,{})}):S?r.jsx(c,{}):r.jsx(Bn,{})})]})})]}),f?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Close navigation backdrop",className:"absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden",onClick:G}),r.jsx(bs,{drawerRef:v,onClose:G})]}):null]})}export{Ts as SidebarLayout};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as V}from"./chunk-2UUABLZI-Dls_33ja.js";import{b5 as J,U as W,V as X,r as l,w as q,j as e,$ as Y,a2 as L,I as U,b7 as Z,as as y,al as _}from"./index-Cq_o2Abd.js";var ee=({open:s,onOpenChange:c,onImport:d,busy:p=!1,error:S})=>{const[i,N]=l.useState(""),[m,C]=l.useState(""),[n,j]=l.useState(""),[u,x]=l.useState(""),[b,h]=l.useState(""),o=()=>{N(""),C(""),j(""),x(""),h("")},v=()=>{o(),c(!1)},f=async a=>{if(a.preventDefault(),!(!i.trim()||!m.trim()||!n.trim()||!u.trim()||!b.trim()||p))try{await d({name:i.trim(),description:m.trim(),repoURL:n.trim(),path:u.trim(),ref:b.trim()}),v()}catch{}},E=!!(i.trim()&&m.trim()&&n.trim()&&u.trim()&&b.trim())&&!p;return e.jsx(Z,{open:s,onOpenChange:a=>{a||v()},title:"Import from GitHub",description:"Import a skill from a SKILL.md file in a GitHub repository.",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",children:e.jsx(U,{name:"github",className:"size-5"})}),contentSized:!0,className:"md:max-w-2xl",children:e.jsx("form",{onSubmit:a=>void f(a),children:e.jsxs("div",{className:"space-y-5 px-5 py-5 md:px-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-name",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Name"}),e.jsx("input",{id:"skill-name",value:i,onChange:a=>{N(a.target.value)},placeholder:"release-notes",autoFocus:!0,required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-description",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Description"}),e.jsx("textarea",{id:"skill-description",value:m,onChange:a=>{C(a.target.value)},placeholder:"Generate release notes from merged pull requests",required:!0,rows:3,className:y("resize-y py-2.5")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-repo-url",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Repository URL"}),e.jsx("input",{id:"skill-repo-url",type:"url",value:n,onChange:a=>{j(a.target.value)},placeholder:"https://github.com/org/repo",required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-path",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Folder containing the SKILL.md"}),e.jsx("input",{id:"skill-path",value:u,onChange:a=>{x(a.target.value)},placeholder:"skills/release-notes",required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-ref",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Branch"}),e.jsx("input",{id:"skill-ref",value:b,onChange:a=>{h(a.target.value)},placeholder:"main",required:!0,className:y("h-11")})]}),e.jsxs("div",{className:"space-y-3",children:[S?e.jsx("p",{className:"text-failure-bg text-sm",children:S}):null,e.jsx(L.Primary,{type:"submit",disabled:!E,className:"w-full",children:"Import"})]})]})})})},te=ee,B=(s,c,d)=>!s||c.toLowerCase().includes(s)||d.toLowerCase().includes(s),se=s=>"catalogId"in s;function le(s){return typeof s=="object"&&s!==null&&Reflect.get(s,"statusCode")===424}var ae=()=>{const{skillCatalog:s}=J(),c=W(),d=X(),[p,S]=l.useState(""),[i,N]=l.useState([]),[m,C]=l.useState([]),[n,j]=l.useState(!0),[u,x]=l.useState(null),[b,h]=l.useState(null),[o,v]=l.useState(!1),[f,E]=l.useState(!1),[a,G]=l.useState(!1),[D,F]=l.useState(null),[P,w]=l.useState(null),M=l.useCallback(async()=>{if(s){j(!0),x(null);try{const[t,r]=await Promise.all([s.listSkills(),s.getSkillCatalog()]);N(t),C(r)}catch(t){x(q(t,"Failed to load skills"))}finally{j(!1)}}},[s]);l.useEffect(()=>{M()},[M]);const k=p.trim().toLowerCase(),I=l.useMemo(()=>i.filter(t=>B(k,t.name,t.description)),[i,k]),R=l.useMemo(()=>{const t=new Set(i.flatMap(r=>se(r)?[r.catalogId]:[]));return m.filter(r=>!t.has(r.id)&&B(k,r.name,r.description))},[m,i,k]),z=async(t,r=x)=>{v(!0),x(null);try{await t(),await M()}catch(g){throw le(g)&&E(!0),r(q(g,"Request failed")),g}finally{v(!1)}};if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Skills catalog is not available."});const T=t=>{z(async()=>{await s.createSkill({catalogId:t.id,name:t.name,description:t.description,repoURL:t.repoURL,path:t.path,ref:t.ref}),d(_.Settings.SKILL_IMPORTED,{skill_name:t.name})}).catch(()=>{})},$=()=>{o||(F(null),w(null))},K=t=>{const r=s.deleteSkill;r&&(w(null),z(async()=>{await r({id:t.id}),d(_.Settings.SKILL_DELETED,{skill_name:t.name}),F(null)},w).catch(()=>{}))},H=async t=>{h(null),await z(async()=>{await s.createSkill(t)},h),setTimeout(()=>{c==null||c.showSuccess({title:`${t.name} imported`}),d(_.Settings.SKILL_IMPORTED,{skill_name:t.name})},0)},O=({key:t,name:r,description:g,action:Q})=>e.jsxs("article",{className:"flex min-h-16 items-center gap-3 border-b border-border p-3 last:border-b-0",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(U,{name:"lightbulb",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:r}),g?e.jsx("p",{className:"mt-0.5 truncate text-sm text-text-secondary",children:g}):null]}),Q]},t),A=I.length>0||R.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Skills"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Use built-in skills or import custom skills from GitHub."}),u?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:u}):null,e.jsxs("div",{className:"mt-4 flex min-h-0 flex-1 flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Y,{query:p,setQuery:S,placeholder:"Search skills"})}),e.jsxs(L.Secondary,{type:"button",className:"shrink-0",disabled:o||f,onClick:()=>{h(null),G(!0)},children:[e.jsx(U,{name:"github",className:"size-4"}),"Import from GitHub"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[n?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!n&&I.length>0?e.jsxs("section",{"aria-labelledby":"enabled-skills-heading",children:[e.jsxs("h4",{id:"enabled-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Enabled · ",I.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:I.map(t=>O({key:t.id,name:t.name,description:t.description,action:s.deleteSkill?e.jsx(L.Secondary,{size:"small",type:"button",disabled:o||f,"aria-label":`Remove ${t.name}`,onClick:()=>{w(null),F(t)},children:"Remove"}):null}))})]}):null,!n&&R.length>0?e.jsxs("section",{"aria-labelledby":"available-skills-heading",children:[e.jsxs("h4",{id:"available-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Available · ",R.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:R.map(t=>O({key:t.id,name:t.name,description:t.description,action:e.jsx(L.Secondary,{size:"small",type:"button",disabled:o||f,"aria-label":`Enable ${t.name}`,onClick:()=>{T(t)},children:"Enable"})}))})]}):null,!n&&!A?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:k?`No skills match “${p.trim()}”.`:"No skills yet."}):null]})]}),D?e.jsx(V,{title:"Remove skill?",description:`“${D.name}” will no longer be available to your agents.`,busy:o,error:P,onCancel:$,onConfirm:()=>{K(D)}}):null,e.jsx(te,{open:a,onOpenChange:t=>{G(t),t||h(null)},onImport:H,busy:o||f,error:b})]})},ne=ae;export{ne as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|