@truefoundry/trueforge 0.186.0-rc.2 → 0.186.0-rc.3
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-D2J3IH37-CQZZoOBC.js → AgentCodeSnippets-D2J3IH37-B16-5UJ8.js} +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-D2J3IH37-B16-5UJ8.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-D2J3IH37-B16-5UJ8.js.gz +0 -0
- package/dist/_frontend/assets/{AgentMetricChart-TCZEIIUV-5Rtf3TvY.js → AgentMetricChart-TCZEIIUV-DbrMMNdJ.js} +1 -1
- package/dist/_frontend/assets/AgentMetricChart-TCZEIIUV-DbrMMNdJ.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-TCZEIIUV-DbrMMNdJ.js.gz +0 -0
- package/dist/_frontend/assets/{AgentOverview-ZSZENAFZ-D0HM5BSW.js → AgentOverview-ZSZENAFZ-l5cpV4_J.js} +1 -1
- package/dist/_frontend/assets/AgentOverview-ZSZENAFZ-l5cpV4_J.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-ZSZENAFZ-l5cpV4_J.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimeline-26TTGY3F-6FMUgy7r.js → AgentSessionEventTimeline-26TTGY3F-CsLh4dWe.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimeline-26TTGY3F-CsLh4dWe.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-26TTGY3F-CsLh4dWe.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimelineChart-SV6ZYNU2-CNDMPnla.js → AgentSessionEventTimelineChart-SV6ZYNU2-DcBfkYyl.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-SV6ZYNU2-DcBfkYyl.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-SV6ZYNU2-DcBfkYyl.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessions-W2EDVBCS-lqR7dkcO.js → AgentSessions-W2EDVBCS-CgUHXoz0.js} +1 -1
- package/dist/_frontend/assets/AgentSessions-W2EDVBCS-CgUHXoz0.js.br +0 -0
- package/dist/_frontend/assets/{AgentSessions-W2EDVBCS-lqR7dkcO.js.gz → AgentSessions-W2EDVBCS-CgUHXoz0.js.gz} +0 -0
- package/dist/_frontend/assets/{ConnectorSettings-E3KBW7HI-CMwC3bcI.js → ConnectorSettings-E3KBW7HI-Bqrsm5Dp.js} +1 -1
- package/dist/_frontend/assets/ConnectorSettings-E3KBW7HI-Bqrsm5Dp.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-E3KBW7HI-Bqrsm5Dp.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-OYD7YJSD-CqCN5TbW.js → DockLayout-OYD7YJSD-CKhifnZT.js} +1 -1
- package/dist/_frontend/assets/{DrawerLayout-IGDKPIOC-CF0zSf6U.js → DrawerLayout-IGDKPIOC-BIDPsNsC.js} +2 -2
- package/dist/_frontend/assets/DrawerLayout-IGDKPIOC-BIDPsNsC.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-IGDKPIOC-BIDPsNsC.js.gz +0 -0
- package/dist/_frontend/assets/{EnvironmentsPage-BUA2EGXE-Dt-L2w8t.js → EnvironmentsPage-BUA2EGXE-CcV5njoc.js} +1 -1
- package/dist/_frontend/assets/EnvironmentsPage-BUA2EGXE-CcV5njoc.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-BUA2EGXE-CcV5njoc.js.gz +0 -0
- package/dist/_frontend/assets/{MemorySettings-Y6HNEYIW-DL6nR8e0.js → MemorySettings-Y6HNEYIW-O-E_902u.js} +1 -1
- package/dist/_frontend/assets/MemorySettings-Y6HNEYIW-O-E_902u.js.br +0 -0
- package/dist/_frontend/assets/MemorySettings-Y6HNEYIW-O-E_902u.js.gz +0 -0
- package/dist/_frontend/assets/{ModelSettings-3RSWQ5WD-YyI5xGN4.js → ModelSettings-3RSWQ5WD-BUbTYQmV.js} +1 -1
- package/dist/_frontend/assets/ModelSettings-3RSWQ5WD-BUbTYQmV.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-3RSWQ5WD-BUbTYQmV.js.gz +0 -0
- package/dist/_frontend/assets/{SandboxSettings-YIEGCYQO-Bn_-fbRJ.js → SandboxSettings-YIEGCYQO-CunudcIx.js} +1 -1
- package/dist/_frontend/assets/SandboxSettings-YIEGCYQO-CunudcIx.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-YIEGCYQO-CunudcIx.js.gz +0 -0
- package/dist/_frontend/assets/{SchedulesPage-OVDMYD6Q-DWmVgOrq.js → SchedulesPage-OVDMYD6Q-BKu9sdHs.js} +1 -1
- package/dist/_frontend/assets/SchedulesPage-OVDMYD6Q-BKu9sdHs.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-OVDMYD6Q-BKu9sdHs.js.gz +0 -0
- package/dist/_frontend/assets/{SettingsBuilder-6WNST3GI-CQudqTjg.js → SettingsBuilder-6WNST3GI-DtS3ib0p.js} +2 -2
- package/dist/_frontend/assets/SettingsBuilder-6WNST3GI-DtS3ib0p.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-6WNST3GI-DtS3ib0p.js.gz +0 -0
- package/dist/_frontend/assets/{ShellRouteSync-4T763MWC-BOFQkqAR.js → ShellRouteSync-4T763MWC-DJolNJIN.js} +1 -1
- package/dist/_frontend/assets/ShellRouteSync-4T763MWC-DJolNJIN.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-4T763MWC-DJolNJIN.js.gz +0 -0
- package/dist/_frontend/assets/{SidebarLayout-YWA6PPZM-CFjD1Kmo.js → SidebarLayout-YWA6PPZM-BMDCIIhu.js} +2 -2
- package/dist/_frontend/assets/SidebarLayout-YWA6PPZM-BMDCIIhu.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-YWA6PPZM-BMDCIIhu.js.gz +0 -0
- package/dist/_frontend/assets/{SkillSettings-XLK6REIA-CJVGKalf.js → SkillSettings-XLK6REIA-UZs1mGXm.js} +1 -1
- package/dist/_frontend/assets/SkillSettings-XLK6REIA-UZs1mGXm.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-XLK6REIA-UZs1mGXm.js.gz +0 -0
- package/dist/_frontend/assets/{TrueForgeUIWithRouter-LFJ4E5VL-o7uC8O0Z.js → TrueForgeUIWithRouter-LFJ4E5VL-D9VrxQsf.js} +1 -1
- package/dist/_frontend/assets/{WebSearchSettings-PKYKXD26-Ccfvu3fp.js → WebSearchSettings-PKYKXD26-vhZuRM_V.js} +1 -1
- package/dist/_frontend/assets/WebSearchSettings-PKYKXD26-vhZuRM_V.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-PKYKXD26-vhZuRM_V.js.gz +0 -0
- package/dist/_frontend/assets/{WidgetLayout-HQZFWVZ2-CW9j2zi5.js → WidgetLayout-HQZFWVZ2-Cd_pMqY7.js} +1 -1
- package/dist/_frontend/assets/WidgetLayout-HQZFWVZ2-Cd_pMqY7.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-HQZFWVZ2-Cd_pMqY7.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-HED32BFK-CHoNWtNi.js → chunk-HED32BFK-BfnKrlUJ.js} +2 -2
- package/dist/_frontend/assets/chunk-HED32BFK-BfnKrlUJ.js.br +0 -0
- package/dist/_frontend/assets/chunk-HED32BFK-BfnKrlUJ.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-HK4WITDD-Dk6A8b9_.js → chunk-HK4WITDD-DSX_ymmz.js} +1 -1
- package/dist/_frontend/assets/chunk-HK4WITDD-DSX_ymmz.js.br +0 -0
- package/dist/_frontend/assets/chunk-HK4WITDD-DSX_ymmz.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-HWOHXUGH-IwYpHY-Y.js → chunk-HWOHXUGH-KXcUS5XW.js} +1 -1
- package/dist/_frontend/assets/chunk-HWOHXUGH-KXcUS5XW.js.br +0 -0
- package/dist/_frontend/assets/chunk-HWOHXUGH-KXcUS5XW.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-LFIIKLPG-gJeIso6M.js → chunk-LFIIKLPG-DcaznAz-.js} +1 -1
- package/dist/_frontend/assets/{chunk-OB3PAWPO-B6HZEUGp.js → chunk-OB3PAWPO-Bm8RoZbE.js} +1 -1
- package/dist/_frontend/assets/chunk-OB3PAWPO-Bm8RoZbE.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-Bm8RoZbE.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-OXW7TUTC-moy4-cpX.js → chunk-OXW7TUTC-UBWEIyxU.js} +1 -1
- package/dist/_frontend/assets/chunk-OXW7TUTC-UBWEIyxU.js.br +0 -0
- package/dist/_frontend/assets/chunk-OXW7TUTC-UBWEIyxU.js.gz +0 -0
- package/dist/_frontend/assets/{cssMode-BHHgzHoT.js → cssMode-CKX3vknZ.js} +1 -1
- package/dist/_frontend/assets/cssMode-CKX3vknZ.js.br +6 -0
- package/dist/_frontend/assets/cssMode-CKX3vknZ.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-tWNHna9o.js → freemarker2-BxWZ5P9I.js} +1 -1
- package/dist/_frontend/assets/freemarker2-BxWZ5P9I.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-BxWZ5P9I.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-YCt9F20a.js → handlebars-By1rPqIP.js} +1 -1
- package/dist/_frontend/assets/handlebars-By1rPqIP.js.br +0 -0
- package/dist/_frontend/assets/handlebars-By1rPqIP.js.gz +0 -0
- package/dist/_frontend/assets/{html-Vo6CgJvZ.js → html-DV1yPfEc.js} +1 -1
- package/dist/_frontend/assets/html-DV1yPfEc.js.br +0 -0
- package/dist/_frontend/assets/html-DV1yPfEc.js.gz +0 -0
- package/dist/_frontend/assets/{htmlMode-BkGzSsp7.js → htmlMode-Elrz_gVm.js} +1 -1
- package/dist/_frontend/assets/htmlMode-Elrz_gVm.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-Elrz_gVm.js.gz +0 -0
- package/dist/_frontend/assets/{index-CdSOK6zy.js → index-DUcQ3h0s.js} +3 -3
- package/dist/_frontend/assets/index-DUcQ3h0s.js.br +0 -0
- package/dist/_frontend/assets/index-DUcQ3h0s.js.gz +0 -0
- package/dist/_frontend/assets/{index-DY4Vt5qS.js → index-aDyvsTqL.js} +5 -5
- package/dist/_frontend/assets/index-aDyvsTqL.js.br +0 -0
- package/dist/_frontend/assets/index-aDyvsTqL.js.gz +0 -0
- package/dist/_frontend/assets/{javascript-hhlexC1d.js → javascript-DItLzBZi.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-CmaZrTmo.js → jsonMode-DqOjSnL2.js} +1 -1
- package/dist/_frontend/assets/jsonMode-DqOjSnL2.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-DqOjSnL2.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-B12Ow-wY.js → liquid-DLYzaUKm.js} +1 -1
- package/dist/_frontend/assets/liquid-DLYzaUKm.js.br +0 -0
- package/dist/_frontend/assets/liquid-DLYzaUKm.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-BAdtNMdy.js → lspLanguageFeatures-PB1varoG.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-PB1varoG.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-PB1varoG.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-DnqsUsp9.js → mdx-DHNySSed.js} +1 -1
- package/dist/_frontend/assets/mdx-DHNySSed.js.br +0 -0
- package/dist/_frontend/assets/mdx-DHNySSed.js.gz +0 -0
- package/dist/_frontend/assets/{python-zclzTpCV.js → python-yMHIyjYS.js} +1 -1
- package/dist/_frontend/assets/python-yMHIyjYS.js.br +0 -0
- package/dist/_frontend/assets/python-yMHIyjYS.js.gz +0 -0
- package/dist/_frontend/assets/{razor-DXCJzDhT.js → razor-Bnk6A3iA.js} +1 -1
- package/dist/_frontend/assets/razor-Bnk6A3iA.js.br +0 -0
- package/dist/_frontend/assets/razor-Bnk6A3iA.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-ba0WSSwR.js → tsMode-kj0LQhk5.js} +1 -1
- package/dist/_frontend/assets/tsMode-kj0LQhk5.js.br +0 -0
- package/dist/_frontend/assets/tsMode-kj0LQhk5.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-Cxw8coCj.js → typescript-D7hMcG1O.js} +1 -1
- package/dist/_frontend/assets/typescript-D7hMcG1O.js.br +0 -0
- package/dist/_frontend/assets/typescript-D7hMcG1O.js.gz +0 -0
- package/dist/_frontend/assets/{workers-RQlmz_Lv.js → workers-CGQFLoPd.js} +1 -1
- package/dist/_frontend/assets/workers-CGQFLoPd.js.br +5 -0
- package/dist/_frontend/assets/workers-CGQFLoPd.js.gz +0 -0
- package/dist/_frontend/assets/{xml-Bb7-oq8W.js → xml-Bm7N302L.js} +1 -1
- package/dist/_frontend/assets/xml-Bm7N302L.js.br +0 -0
- package/dist/_frontend/assets/xml-Bm7N302L.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-DqJHVcwV.js → yaml-DauWP5pc.js} +1 -1
- package/dist/_frontend/assets/yaml-DauWP5pc.js.br +0 -0
- package/dist/_frontend/assets/yaml-DauWP5pc.js.gz +0 -0
- package/dist/_frontend/index.html +1 -1
- package/package.json +2 -2
- package/dist/_frontend/assets/AgentCodeSnippets-D2J3IH37-CQZZoOBC.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-D2J3IH37-CQZZoOBC.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-TCZEIIUV-5Rtf3TvY.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-TCZEIIUV-5Rtf3TvY.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-ZSZENAFZ-D0HM5BSW.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-ZSZENAFZ-D0HM5BSW.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-26TTGY3F-6FMUgy7r.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-26TTGY3F-6FMUgy7r.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-SV6ZYNU2-CNDMPnla.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-SV6ZYNU2-CNDMPnla.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-W2EDVBCS-lqR7dkcO.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-E3KBW7HI-CMwC3bcI.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-E3KBW7HI-CMwC3bcI.js.gz +0 -0
- package/dist/_frontend/assets/DrawerLayout-IGDKPIOC-CF0zSf6U.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-IGDKPIOC-CF0zSf6U.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-BUA2EGXE-Dt-L2w8t.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-BUA2EGXE-Dt-L2w8t.js.gz +0 -0
- package/dist/_frontend/assets/MemorySettings-Y6HNEYIW-DL6nR8e0.js.br +0 -0
- package/dist/_frontend/assets/MemorySettings-Y6HNEYIW-DL6nR8e0.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-3RSWQ5WD-YyI5xGN4.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-3RSWQ5WD-YyI5xGN4.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-YIEGCYQO-Bn_-fbRJ.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-YIEGCYQO-Bn_-fbRJ.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-OVDMYD6Q-DWmVgOrq.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-OVDMYD6Q-DWmVgOrq.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-6WNST3GI-CQudqTjg.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-6WNST3GI-CQudqTjg.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-4T763MWC-BOFQkqAR.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-4T763MWC-BOFQkqAR.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-YWA6PPZM-CFjD1Kmo.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-YWA6PPZM-CFjD1Kmo.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-XLK6REIA-CJVGKalf.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-XLK6REIA-CJVGKalf.js.gz +0 -0
- package/dist/_frontend/assets/WebSearchSettings-PKYKXD26-Ccfvu3fp.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-PKYKXD26-Ccfvu3fp.js.gz +0 -0
- package/dist/_frontend/assets/WidgetLayout-HQZFWVZ2-CW9j2zi5.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-HQZFWVZ2-CW9j2zi5.js.gz +0 -0
- package/dist/_frontend/assets/chunk-HED32BFK-CHoNWtNi.js.br +0 -0
- package/dist/_frontend/assets/chunk-HED32BFK-CHoNWtNi.js.gz +0 -0
- package/dist/_frontend/assets/chunk-HK4WITDD-Dk6A8b9_.js.br +0 -0
- package/dist/_frontend/assets/chunk-HK4WITDD-Dk6A8b9_.js.gz +0 -0
- package/dist/_frontend/assets/chunk-HWOHXUGH-IwYpHY-Y.js.br +0 -0
- package/dist/_frontend/assets/chunk-HWOHXUGH-IwYpHY-Y.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-B6HZEUGp.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-B6HZEUGp.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OXW7TUTC-moy4-cpX.js.br +0 -0
- package/dist/_frontend/assets/chunk-OXW7TUTC-moy4-cpX.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-BHHgzHoT.js.br +0 -0
- package/dist/_frontend/assets/cssMode-BHHgzHoT.js.gz +0 -0
- package/dist/_frontend/assets/freemarker2-tWNHna9o.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-tWNHna9o.js.gz +0 -0
- package/dist/_frontend/assets/handlebars-YCt9F20a.js.br +0 -0
- package/dist/_frontend/assets/handlebars-YCt9F20a.js.gz +0 -0
- package/dist/_frontend/assets/html-Vo6CgJvZ.js.br +0 -0
- package/dist/_frontend/assets/html-Vo6CgJvZ.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-BkGzSsp7.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-BkGzSsp7.js.gz +0 -0
- package/dist/_frontend/assets/index-CdSOK6zy.js.br +0 -0
- package/dist/_frontend/assets/index-CdSOK6zy.js.gz +0 -0
- package/dist/_frontend/assets/index-DY4Vt5qS.js.br +0 -0
- package/dist/_frontend/assets/index-DY4Vt5qS.js.gz +0 -0
- package/dist/_frontend/assets/jsonMode-CmaZrTmo.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-CmaZrTmo.js.gz +0 -0
- package/dist/_frontend/assets/liquid-B12Ow-wY.js.br +0 -0
- package/dist/_frontend/assets/liquid-B12Ow-wY.js.gz +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-BAdtNMdy.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-BAdtNMdy.js.gz +0 -0
- package/dist/_frontend/assets/mdx-DnqsUsp9.js.br +0 -0
- package/dist/_frontend/assets/mdx-DnqsUsp9.js.gz +0 -0
- package/dist/_frontend/assets/python-zclzTpCV.js.br +0 -0
- package/dist/_frontend/assets/python-zclzTpCV.js.gz +0 -0
- package/dist/_frontend/assets/razor-DXCJzDhT.js.br +0 -0
- package/dist/_frontend/assets/razor-DXCJzDhT.js.gz +0 -0
- package/dist/_frontend/assets/tsMode-ba0WSSwR.js.br +0 -0
- package/dist/_frontend/assets/tsMode-ba0WSSwR.js.gz +0 -0
- package/dist/_frontend/assets/typescript-Cxw8coCj.js.br +0 -0
- package/dist/_frontend/assets/typescript-Cxw8coCj.js.gz +0 -0
- package/dist/_frontend/assets/workers-RQlmz_Lv.js.br +0 -0
- package/dist/_frontend/assets/workers-RQlmz_Lv.js.gz +0 -0
- package/dist/_frontend/assets/xml-Bb7-oq8W.js.br +0 -0
- package/dist/_frontend/assets/xml-Bb7-oq8W.js.gz +0 -0
- package/dist/_frontend/assets/yaml-DqJHVcwV.js.br +0 -0
- package/dist/_frontend/assets/yaml-DqJHVcwV.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as rt}from"./chunk-HWOHXUGH-IwYpHY-Y.js";import{l as Te,o as Ue,p as Ce,q as Ge,t as He,v as lt,r as o,w as ve,x as it,y as Fe,z as Ee,A as ot,j as e,P as ct,S as dt,B as xe,C as qe,D as Ve,E as $,I as R,F as ut,G as Ne,H as _e,J as mt,K as ht,L as Le,M as W,N as xt,O as K,k as We,Q as ft,c as B,R as gt,U as bt,V as pt,W as Nt,X as jt,Y as yt,Z as vt,_ as Q,$ as St,a0 as wt,u as kt,a1 as Tt,a2 as je,a3 as Ct,a4 as Et,a5 as zt,a6 as At,a7 as Rt,a8 as It,a9 as Pt,aa as ye,ab as Dt,ac as Ft,ad as _t}from"./index-DY4Vt5qS.js";var Oe=[{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 Ke(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Lt(t){const n=Ke(),r=new Set(Oe.map(l=>l.value));return[...[n,t].flatMap(l=>l==null||l.length===0||r.has(l)?[]:(r.add(l),[{value:l,label:l===n?`${l} (Local)`:l}])),...Oe]}var Qe=[{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"}],Ot={"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 fe(){return{name:"",task:"",recurrence:"daily",hour:9,minute:0,weekdays:[1],customCron:"0 9 * * *",timezone:Ke()}}function Mt(t){return Ot[t]??t.split("/").pop()??t}function Ye(t){return t.toString().padStart(2,"0")}function me({hour:t,minute:n}){const r=t>=12?"PM":"AM",a=t%12===0?12:t%12;return`${String(a)}:${Ye(n)} ${r}`}function Se(t){const n=t.minute,r=t.hour;switch(t.recurrence){case"hourly":return`${String(n)} * * * *`;case"daily":return`${String(n)} ${String(r)} * * *`;case"weekly":{const a=[...t.weekdays].sort((u,S)=>u-S),l=a.length>0?a.join(","):"*";return`${String(n)} ${String(r)} * * ${l}`}case"custom":return t.customCron.trim()}}function we(t){return t.trim().split(/\s+/).length===5}function ce(t){const n=Mt(t.timezone),r=t.cron.trim().split(/\s+/);if(r.length!==5)return t.cron;const[a,l,u,S,b]=r;if(u!=="*"||S!=="*")return t.cron;const d=Number(a),h=Number(l);if(l==="*"&&b==="*"&&a!==void 0&&!Number.isNaN(d))return`Hourly at :${Ye(d)} ${n}`;if(b==="*"&&l!==void 0&&a!==void 0&&!Number.isNaN(h)&&!Number.isNaN(d))return`Daily ${me({hour:h,minute:d})} ${n}`;if(b==="1-5"&&l!==void 0&&a!==void 0&&!Number.isNaN(h)&&!Number.isNaN(d))return`Weekdays ${me({hour:h,minute:d})} ${n}`;if(b!=null&&/^\d(?:,\d)*$/.test(b)&&l!==void 0&&a!==void 0&&!Number.isNaN(h)&&!Number.isNaN(d)){const j=b.split(",").map(x=>{var k;return((k=Qe.find(p=>p.value===Number(x)))==null?void 0:k.label)??x});return j.length===1?`Every ${j[0]==="Mon"?"Monday":j[0]} ${me({hour:h,minute:d})} ${n}`:`${j.join(", ")} ${me({hour:h,minute:d})} ${n}`}return t.cron}function Me(t){const n=fe(),r=t.cron.trim().split(/\s+/);if(r.length!==5)return{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron};const[a,l,u,S,b]=r,d=Number(a),h=Number(l);return u!=="*"||S!=="*"?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron}:l==="*"&&b==="*"&&!Number.isNaN(d)?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"hourly",minute:d,customCron:t.cron}:b==="*"&&!Number.isNaN(h)&&!Number.isNaN(d)?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"daily",hour:h,minute:d,customCron:t.cron}:b!=null&&/^\d(?:,\d)*$/.test(b)&&!Number.isNaN(h)&&!Number.isNaN(d)?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"weekly",hour:h,minute:d,weekdays:b.split(",").map(Number),customCron:t.cron}:{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron,hour:Number.isNaN(h)?n.hour:h,minute:Number.isNaN(d)?n.minute:d}}function $t(t,n=Date.now()){return _t(t,{fallback:"Never",nowMs:n})}var Bt=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"custom",label:"Custom"}],Ut=Array.from({length:24},(t,n)=>({value:String(n),label:n.toString().padStart(2,"0")})),Gt=[0,15,30,45].map(t=>({value:String(t),label:`:${t.toString().padStart(2,"0")}`}));function Ht({values:t,onChange:n,agentId:r,agentLabel:a,onAgentIdChange:l,onAgentPicked:u,agentPickerDisabled:S=!1,onBuildAgent:b}){const d=Se(t),h=ce({cron:d,timezone:t.timezone}),j=Lt(t.timezone),x=(i,y)=>{n({...t,[i]:y})},k=i=>{const y=i==="custom"&&t.recurrence!=="custom"?d:t.customCron;n({...t,recurrence:i,customCron:y})},p=i=>{const z=t.weekdays.includes(i)?t.weekdays.filter(m=>m!==i):[...t.weekdays,i];n({...t,weekdays:z.length>0?z:[i]})};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(qe,{"aria-label":"Agent",placeholder:"Search agent",value:r,selectedLabel:a,onValueChange:i=>l==null?void 0:l(i),onAgentPicked:u,disabled:S||l==null,onBuildAgent:b})]}),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:i=>x("name",i.target.value),placeholder:"harness-daily-digest",className:ye("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:i=>x("task",i.target.value),rows:3,placeholder:"Summarise yesterday's harness runs and post the digest…",className:ye("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-4 gap-1 rounded-lg border border-border bg-primary-bg p-1",children:Bt.map(i=>{const y=t.recurrence===i.value;return e.jsx("button",{type:"button",className:B("rounded-md border px-2 py-2 text-sm font-medium transition-colors",y?"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":y,onClick:()=>k(i.value),children:i.label},i.value)})}),t.recurrence==="custom"?e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Cron expression"}),e.jsx("input",{"aria-label":"Cron expression",value:t.customCron,onChange:i=>x("customCron",i.target.value),placeholder:"0 */4 * * *",spellCheck:!1,"aria-invalid":!we(t.customCron),className:B(ye("h-8"),"font-mono")}),e.jsx("span",{className:"mt-1 block text-xs text-text-secondary",children:"minute hour day-of-month month day-of-week. Runs must be at least 1 hour apart."}),we(t.customCron)?null:e.jsx("span",{className:"mt-1 block text-xs text-failure-bg",children:"Enter exactly 5 space-separated fields."})]}):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:Qe.map(i=>{const y=t.weekdays.includes(i.value);return e.jsx("button",{type:"button",className:B("min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium",y?"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":y,onClick:()=>p(i.value),children:i.label},i.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(xe,{"aria-label":"Hour",value:String(t.hour),options:Ut,onValueChange:i=>x("hour",Number(i))})]}):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(xe,{"aria-label":"Minute",value:String(t.minute),options:Gt,onValueChange:i=>x("minute",Number(i))})]}):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(xe,{"aria-label":"Timezone",value:t.timezone,options:j,onValueChange:i=>x("timezone",i),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(R,{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:h||"—"}),e.jsx("code",{className:"shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary",children:d||"—"})]})})]})]})}function qt(t){return t.startsWith("manual-")}function Vt(t){return t==="failed"?"failed":"success"}function Ze(t){return t==="failed"?"Failed":t==="triggered"?"Triggered":"Scheduled"}function Je(t){return qt(t)?"Manual test":"Cron"}function Wt(t,n=5){return t.filter(a=>a.status!=="scheduled").slice(0,n).reverse()}function ke(t){if(t==null)return"—";const n=new Date(t);return Number.isNaN(n.getTime())?"—":It(n)}function Kt({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:Ze(t.status)}),e.jsx("p",{className:"text-text-secondary",children:Je(t.name)}),e.jsxs("p",{className:"text-text-secondary",children:["Scheduled for: ",ke(t.scheduledFor)]}),t.triggeredAt!=null?e.jsxs("p",{className:"text-text-secondary",children:["Triggered at: ",ke(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 Qt={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 Xe({run:t,onOpenSession:n}){const r=Vt(t.status),a=ke(t.triggeredAt??t.scheduledFor),l=`${Ze(t.status)} run at ${a}`,u=B("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",Qt[r]),S=e.jsx(R,{name:r==="failed"?"triangle-exclamation":"check",className:"size-3.5"});return e.jsx(We,{content:e.jsx(Kt,{run:t}),className:"max-w-sm whitespace-normal",side:"top",children:n!=null&&t.sessionId!=null&&t.sessionId!==""?e.jsx("button",{type:"button",className:B(u,"cursor-pointer hover:brightness-95"),"aria-label":`Open session for ${l}`,onClick:()=>n(t),children:S}):e.jsx("span",{className:u,"aria-label":l,children:S})})}function et({status:t}){const n=t==="active";return e.jsx(rt,{variant:n?"success":"warning",shape:"pill",size:"md",dot:!0,children:n?"Active":"Paused"})}function Yt(t,n){return t.find(r=>r.name===n||r.id===n)??null}function Zt({connector:t,onConnected:n}){return Dt()==null?null:e.jsx(Ft,{connector:t,onConnected:n})}function ie({label:t,children:n}){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:n})]})}function Jt({schedule:t,agentName:n,mcpMounts:r,onEditConfiguration:a}){const l=Te(),u=Ce(),{connectors:S,ensureLoaded:b,refreshConnectors:d,loading:h,error:j}=Pt(),[x,k]=o.useState(!1),[p,i]=o.useState(null),y=ce({cron:t.cron,timezone:t.timezone}),z=async()=>{k(!0);try{const m=await l.createScheduleRun({scheduleId:t.id});i(m),u==null||u.showSuccess({title:"Test run started"})}catch(m){u==null||u.showError(m)}finally{k(!1)}};return o.useEffect(()=>{b()},[b]),o.useEffect(()=>{j!=null&&(u==null||u.showError(j))},[j,u]),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(ie,{label:"Agent",children:n}),e.jsx(ie,{label:"Name",children:t.name}),e.jsx(ie,{label:"Status",children:e.jsx(et,{status:t.status})}),e.jsx(ie,{label:"Task",children:e.jsx("span",{className:"whitespace-pre-wrap break-words",children:t.task})}),e.jsx(ie,{label:"Frequency",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[e.jsx("span",{children:y}),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($.Secondary,{type:"button",size:"small",onClick:a,children:[e.jsx(R,{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"})}),r.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:r.map(m=>{const C=Yt(S,m.name),U=(C==null?void 0:C.authenticated)===!0,q=C==null&&!h;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:B("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",U?"border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"border-border text-transparent"),"aria-hidden":!0,children:U?e.jsx(R,{name:"check",className:"size-3"}):null}),e.jsx("span",{className:"text-text-primary min-w-0 flex-1 truncate text-sm",children:m.name}),U?e.jsx("span",{className:"text-success-bg text-xs font-medium",children:"Connected"}):q?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):C!=null&&C.authenticated===!1?e.jsx(Zt,{connector:C,onConnected:d}):h?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($.Primary,{type:"button",disabled:x,size:"small",onClick:()=>void z(),children:[e.jsx(R,{name:x?"loader":"play",className:B("size-3.5",x&&"animate-spin")}),"Run Test"]})]}),p==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(Xe,{run:p}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Je(p.name)}),e.jsx("p",{className:"text-text-secondary",children:$t(p.triggeredAt??p.scheduledFor)})]})]})]})]})}function Xt({open:t,onOpenChange:n,mode:r,schedule:a,initialAgentId:l="",onSaved:u}){const S=Te(),b=Ue(),d=He(),h=Ce(),j=Ge(),[x,k]=o.useState(fe),[p,i]=o.useState(l),[y,z]=o.useState(null),[m,C]=o.useState({kind:"form"}),[U,q]=o.useState(!1),[re,Y]=o.useState(!1),[A,_]=o.useState(null),L=o.useRef(p);L.current=p;const Z=m.kind==="form"?m.saved:m.schedule,N=r==="edit"&&m.kind==="form"&&m.saved==null&&a!=null,O=m.kind==="form"&&m.saved!=null,T=r==="create"&&m.kind==="form"&&m.saved==null,{allows:J}=ve({resourceType:"agent",resourceIds:p.length===0?[]:[p]});o.useEffect(()=>{if(!t){k(fe()),i(l),z(null),_(null),C({kind:"form"}),Y(!1);return}if(r==="edit"&&a!=null){k(Me({name:a.name,task:a.task,cron:a.cron,timezone:a.timezone})),i(a.agentId),z(null),C({kind:"form"});return}k(fe()),i(l),z(null),C({kind:"form"})},[t,r,a,l]),o.useEffect(()=>{if(!t||r!=="create"||l.length===0)return;let f=!1;const v=l;return zt({server:b,agentKey:v}).then(w=>{f||w==null||L.current===v&&(z(w),i(Ve(w)))}).catch(()=>{}),()=>{f=!0}},[t,r,l,b]);const G=(y==null?void 0:y.name)??(Z==null?void 0:Z.agentName)??(a==null?void 0:a.agentName)??(p.length>0?p:""),ge=o.useMemo(()=>{var v;return(((v=y==null?void 0:y.agentSpec)==null?void 0:v.mcpServers)??[]).map(At).filter(w=>w!=null).map(w=>({name:w}))},[y]),le=o.useMemo(()=>{const f=Se(x);return x.name.trim().length>0&&x.task.trim().length>0&&we(f)&&p.length>0&&(!T||J(p,"USE"))},[p,J,x,T]),V=f=>{C({kind:"test",schedule:f}),k(Me({name:f.name,task:f.task,cron:f.cron,timezone:f.timezone})),i(f.agentId)},X=async f=>{if(f.preventDefault(),!le)return;const v=Se(x);q(!0),_(null);try{if(N&&a!=null){await S.updateSchedule({id:a.id,name:x.name.trim(),task:x.task.trim(),cron:v,timezone:x.timezone,status:a.status}),j(Q.Schedule.EDITED,{schedule_id:a.id,agent_id:a.agentId}),u==null||u(),n(!1);return}if(O&&m.kind==="form"&&m.saved!=null){const I=await S.updateSchedule({id:m.saved.id,name:x.name.trim(),task:x.task.trim(),cron:v,timezone:x.timezone,status:"paused"});j(Q.Schedule.EDITED,{schedule_id:I.id,agent_id:I.agentId}),u==null||u(),V(I),h==null||h.showSuccess({title:"Schedule saved as paused",description:ce({cron:I.cron,timezone:I.timezone})});return}const w=await S.createSchedule({agentId:p,name:x.name.trim(),task:x.task.trim(),cron:v,timezone:x.timezone,status:"paused"});j(Q.Schedule.CREATED,{schedule_id:w.id,agent_id:p}),u==null||u(),V(w),h==null||h.showSuccess({title:"Schedule saved as paused",description:ce({cron:w.cron,timezone:w.timezone})})}catch(w){const I=w instanceof Error?w.message:"Failed to save schedule";_(I)}finally{q(!1)}},ee=async()=>{if(m.kind==="test"){Y(!0),_(null);try{await S.updateSchedule({id:m.schedule.id,name:m.schedule.name,task:m.schedule.task,cron:m.schedule.cron,timezone:m.schedule.timezone,status:"active"}),u==null||u(),h==null||h.showSuccess({title:"Schedule activated"}),n(!1)}catch(f){const v=f instanceof Error?f.message:"Failed to activate schedule";_(v),h==null||h.showError(f)}finally{Y(!1)}}},te=m.kind==="test"?"Test Schedule":N||O?"Edit Schedule":"New Schedule",M=m.kind==="test"?`Recurring unattended runs of ${G}.`:N||O?"Update cadence and task for this schedule.":"Create a recurring unattended run for an agent.";let se;return m.kind==="test"?se=e.jsxs("div",{className:"flex flex-col gap-2",children:[A!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:A}):null,e.jsx($.Secondary,{type:"button",className:"w-full",disabled:re,onClick:()=>void ee(),children:"Activate Schedule"})]}):se=e.jsxs("div",{className:"flex flex-col gap-2",children:[A!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:A}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx($.Secondary,{type:"button",onClick:()=>n(!1),disabled:U,children:"Cancel"}),e.jsx($.Primary,{type:"submit",form:"schedule-form",disabled:!le||U,children:"Save"})]})]}),e.jsx(Rt,{open:t,onOpenChange:n,title:te,description:M,anchor:"right",size:"xl",headerIcon:e.jsx("span",{className:"text-primary-button-bg inline-flex size-8 items-center justify-center",children:e.jsx(R,{name:m.kind==="test"||N||O?"calendar":"calendar-plus",className:"size-5"})}),footer:se,children:m.kind==="test"?e.jsx(Jt,{schedule:m.schedule,agentName:G,mcpMounts:ge,onEditConfiguration:()=>{_(null),C({kind:"form",saved:m.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:f=>void X(f),children:e.jsx(Ht,{values:x,onChange:k,agentId:p,agentLabel:G,onAgentIdChange:N||O?void 0:f=>{i(f),f.length===0&&z(null)},onAgentPicked:z,agentPickerDisabled:N||O,onBuildAgent:r==="create"&&(d==null?void 0:d.isComposerEnabled)===!0?()=>{n(!1),d.openAgentBuilder()}:void 0})})})}function $e(t){return e.jsx(Et,{children:e.jsx(Xt,{...t})})}function es({runs:t,onOpenSession:n}){const r=Wt(t);return r.length===0?e.jsx("span",{className:"text-text-secondary text-sm",children:"—"}):e.jsx("div",{className:"flex items-center gap-1",children:r.map(a=>e.jsx(Xe,{run:a,...n==null?{}:{onOpenSession:n}},a.id))})}var ts=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],Be=[10,25];function he(t){return Math.min(Math.max(t,1),25)}function oe(t){const n=Ee(t);return{nameQuery:n.q??"",statusFilter:n.status??"all",agentFilter:n.agent??"all",scheduleId:n.scheduleId}}function ss(t){const n=Ee(window.location.search);if(!n.isNew)return{kind:"closed"};const r=t??n.agent;return{kind:"create",...r==null?{}:{agentId:r}}}function ns({schedule:t,running:n,canManage:r,canDelete:a,onRunNow:l,onEdit:u,onTogglePause:S,onDelete:b}){const d=kt("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1.5",children:[e.jsx(d,{allowed:r,children:e.jsxs($.Secondary,{type:"button",disabled:n,"aria-label":`Run now ${t.name}`,size:"large",onClick:l,children:[e.jsx(R,{name:n?"loader":"play",className:B("size-3.5",n&&"animate-spin")}),"Run now"]})}),e.jsxs(Tt,{align:"end",trigger:e.jsx("button",{type:"button",className:Ct({variant:"ghost",size:"icon"}),"aria-label":`Actions for ${t.name}`,children:e.jsx(R,{name:"ellipsis"})}),children:[e.jsx(d,{allowed:r,children:e.jsxs(je,{onClick:u,children:[e.jsx(R,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(d,{allowed:r,children:e.jsxs(je,{onClick:S,children:[e.jsx(R,{name:t.status==="active"?"pause":"play",className:"size-3.5"}),t.status==="active"?"Pause":"Resume"]})}),e.jsx(d,{allowed:a,children:e.jsxs(je,{className:"text-failure-bg focus:text-failure-bg",onClick:b,children:[e.jsx(R,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function ls({agentId:t}){const n=Te(),r=Ue(),a=Ce(),l=Ge(),u=He(),S=lt(),b=u!=null&&vt({sessions:S}),[d,h]=o.useState([]),{allows:j}=ve({resourceType:"schedule",resourceIds:d.map(s=>s.id)}),[x,k]=o.useState({}),[p,i]=o.useState(!1),[y,z]=o.useState(()=>new Set),[m,C]=o.useState({}),[U,q]=o.useState(!0),[re,Y]=o.useState(null),[A,_]=o.useState(()=>oe(window.location.search).nameQuery),[L,Z]=o.useState(()=>oe(window.location.search).statusFilter),[N,O]=o.useState(()=>t??oe(window.location.search).agentFilter),[T,J]=o.useState(()=>oe(window.location.search).scheduleId),G=t??(N==="all"?null:N),{allows:ge}=ve({resourceType:"agent",resourceIds:G==null?[]:[G]}),le=r.permissions==null||G==null||ge(G,"USE"),[V,X]=o.useState(()=>ss(t)),[ee,te]=o.useState(null),[M,se]=o.useState(()=>he(yt)),[f,v]=o.useState(void 0),[w,I]=o.useState(void 0),[ne,P]=o.useState(void 0),tt=({run:s,schedule:c})=>{if(!b||u==null||s.sessionId==null)return;l(Q.Schedule.RUN_SESSION_OPENED,{schedule_id:c.id,agent_id:c.agentId});const g=St(s.triggeredAt??s.scheduledFor);wt({sessionId:s.sessionId,view:"sessions",...g==null?{}:{timeRange:g}}),u.setSessionsOpen(!0)},H=o.useRef(0),ze=o.useRef(!1),be=o.useCallback(async({rows:s,gen:c})=>{if(s.length===0){c===H.current&&k({});return}i(!0);try{const g=await Promise.allSettled(s.map(E=>n.listScheduleRuns({scheduleId:E.id})));if(c!==H.current)return;k(Object.fromEntries(s.map((E,D)=>{const F=g[D],ue=(F==null?void 0:F.status)==="fulfilled"?F.value:[];return[E.id,ue]})))}finally{c===H.current&&i(!1)}},[n]),ae=o.useCallback(async({token:s,size:c,agentId:g,pinnedScheduleId:E})=>{const D=++H.current;q(!0),Y(null);try{if(E!=null){const ue=await n.getSchedule({id:E});if(D!==H.current)return;h([ue]),I(void 0),P(void 0),be({rows:[ue],gen:D});return}const F=await n.listSchedules({limit:he(c),...s===void 0||s===""?{}:{pageToken:s},...g==="all"?{}:{agentIds:[g]}});if(D!==H.current)return;h(F.data),I(F.nextPageToken),P(F.previousPageToken),be({rows:F.data,gen:D})}catch(F){if(D!==H.current)return;Y(it(F,"Check your connection and try again.")),h([]),k({}),I(void 0),P(void 0)}finally{D===H.current&&q(!1)}},[n,be]),Ae=o.useCallback(s=>{const c=(s==null?void 0:s.size)??M,g=(s==null?void 0:s.agentId)??N;J(null),v(void 0),P(void 0),ae({token:void 0,size:c,agentId:g,pinnedScheduleId:null})},[N,ae,M]);o.useEffect(()=>{Fe({agent:t===void 0&&N!=="all"?N:null,status:L==="all"?null:L,q:A.trim().length===0?null:A,scheduleId:T})},[N,t,L,A,T]),o.useEffect(()=>{t!==void 0&&O(s=>s===t?s:(v(void 0),P(void 0),t))},[t]),o.useEffect(()=>{ze.current||!Ee(window.location.search).isNew||(ze.current=!0,Fe({isNew:null}))},[]),o.useEffect(()=>{const s=()=>{const c=oe(window.location.search);_(c.nameQuery),Z(c.statusFilter),J(g=>g===c.scheduleId?g:(v(void 0),P(void 0),c.scheduleId)),O(g=>{const E=t??c.agentFilter;return g===E?g:(v(void 0),P(void 0),E)})};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[t]),o.useEffect(()=>{ae({token:f,size:M,agentId:N,pinnedScheduleId:T})},[N,M,f,ae,T]),o.useEffect(()=>{if(T==null||A.trim().length>0)return;const s=d.find(c=>c.id===T);s!=null&&_(s.name)},[A,T,d]);const de=o.useMemo(()=>{if(T!=null)return d;const s=A.trim().toLowerCase();return d.filter(c=>!(L!=="all"&&c.status!==L||s.length>0&&!c.name.toLowerCase().includes(s)))},[d,A,L,T]),Re=ot(d),Ie=ne!=null||w!=null,st=async s=>{if(!j(s.id,"MANAGE"))return;const c=s.status==="active"?"paused":"active";try{await n.updateSchedule({...s,status:c}),l(Q.Schedule.TOGGLED,{schedule_id:s.id,agent_id:s.agentId,next_status:c}),await ae({token:f,size:M,agentId:N,pinnedScheduleId:T})}catch(g){a==null||a.showError(g)}},nt=async s=>{if(j(s.id,"MANAGE")){z(c=>new Set(c).add(s.id));try{if(await n.createScheduleRun({scheduleId:s.id}),l(Q.Schedule.RUN_NOW,{schedule_id:s.id,agent_id:s.agentId}),a==null||a.showSuccess({title:"Run started"}),T!=null){const g=await n.getSchedule({id:T});h(E=>{const D=E.length===1?E[0]:void 0;return D!=null&&D.id===g.id?[g]:E})}const c=await n.listScheduleRuns({scheduleId:s.id});k(g=>({...g,[s.id]:c}))}catch(c){a==null||a.showError(c)}finally{z(c=>{const g=new Set(c);return g.delete(s.id),g})}}},at=async s=>{if(j(s.id,"DELETE")){te(null);try{await n.deleteSchedule({id:s.id}),l(Q.Schedule.DELETED,{schedule_id:s.id,agent_id:s.agentId}),Ae()}catch(c){a==null||a.showError(c)}}},Pe=()=>{w!=null&&v(w)},De=()=>{ne==null||ne===""||v(ne)},pe=()=>{T!=null&&(J(null),v(void 0),P(void 0))};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-primary-bg",children:[e.jsx(ct,{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(dt,{query:A,setQuery:s=>{_(s),pe()},placeholder:"Search schedules by name"})}),e.jsx(xe,{value:L,onValueChange:s=>{Z(s),pe()},options:ts,className:"sm:w-40","aria-label":"Filter by status"}),t===void 0?e.jsx(qe,{value:N,selectedLabel:N==="all"?"All agents":m[N]??N,onValueChange:s=>{O(s),v(void 0),P(void 0),pe()},onAgentPicked:s=>{C(c=>({...c,[Ve(s)]:s.name}))},allOption:{value:"all",label:"All agents"},className:"sm:w-48","aria-label":"Filter by agent",placeholder:"Search agent"}):null,e.jsxs($.Primary,{type:"button",disabled:!le,onClick:()=>le&&X({kind:"create",agentId:N!=="all"?N:void 0}),children:[e.jsx(R,{name:"plus",className:"size-3.5"}),"New Schedule"]})]})}),e.jsx("div",{className:B("min-h-0 flex-1 overflow-auto px-4 py-4",re!=null?"flex flex-col":void 0),children:U?e.jsx("div",{className:"flex flex-col gap-2",role:"status","aria-label":"Loading schedules",children:Array.from({length:5},(s,c)=>e.jsx(ut,{className:"h-12 w-full rounded-md"},c))}):re!=null?e.jsx("div",{role:"alert",className:"flex flex-1 flex-col items-center justify-center",children:e.jsx(Ne,{title:"Couldn't load schedules",description:re,className:"h-auto min-h-0 flex-none py-0"})}):d.length===0?e.jsx(Ne,{title:"No Schedules Found",description:"Create one to get started.",className:"min-h-full"}):de.length===0?e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(Ne,{title:"No Schedules Found",description:"No schedules match your filters.",className:"flex-1"}),Ie?e.jsx(_e,{pageSize:M,rowCount:0,canPrev:ne!=null,canNext:w!=null,onPrev:De,onNext:Pe,pageSizeOptions:Be,onPageSizeChange:s=>{const c=he(s);se(c),v(void 0),P(void 0)}}):null]}):e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs(mt,{className:"min-w-240",children:[e.jsx(ht,{children:e.jsxs(Le,{className:"hover:bg-transparent",children:[e.jsx(W,{children:"Schedule Name"}),e.jsx(W,{children:"Task"}),Re?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(xt,{children:de.map(s=>{const c=ce({cron:s.cron,timezone:s.timezone}),g=s.agentName??m[s.agentId]??s.agentId;return e.jsxs(Le,{children:[e.jsxs(K,{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(R,{name:"agent-2",className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:g})]})]}),e.jsx(K,{className:"w-64 max-w-64",children:e.jsx(We,{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})})}),Re?e.jsx(K,{children:e.jsx(ft,{subject:s.createdBySubject})}):null,e.jsx(K,{children:c}),e.jsx(K,{children:e.jsx(et,{status:s.status})}),e.jsx(K,{children:p?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):e.jsx(es,{runs:x[s.id]??[],...b?{onOpenSession:E=>tt({run:E,schedule:s})}:{}})}),e.jsx(K,{className:"text-right",children:e.jsx(ns,{schedule:s,running:y.has(s.id),canManage:j(s.id,"MANAGE"),canDelete:j(s.id,"DELETE"),onRunNow:()=>void nt(s),onEdit:()=>{j(s.id,"MANAGE")&&X({kind:"edit",schedule:s})},onTogglePause:()=>void st(s),onDelete:()=>{j(s.id,"DELETE")&&te(s)}})})]},s.id)})})]}),(de.length>0||Ie)&&e.jsx(_e,{pageSize:M,rowCount:de.length,canPrev:ne!=null,canNext:w!=null,onPrev:De,onNext:Pe,pageSizeOptions:Be,onPageSizeChange:s=>{const c=he(s);se(c),v(void 0),P(void 0)}})]})}),V.kind==="create"?e.jsx($e,{open:!0,mode:"create",initialAgentId:V.agentId??"",onOpenChange:s=>{s||X({kind:"closed"})},onSaved:()=>Ae()}):null,V.kind==="edit"?e.jsx($e,{open:!0,mode:"edit",schedule:V.schedule,onOpenChange:s=>{s||X({kind:"closed"})},onSaved:()=>void ae({token:f,size:M,agentId:N,pinnedScheduleId:T})}):null,ee!=null?e.jsxs(gt,{open:!0,onOpenChange:s=>{s||te(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(bt,{children:e.jsxs(pt,{children:[e.jsx(Nt,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",ee.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(jt,{children:[e.jsx($.Secondary,{type:"button",onClick:()=>te(null),children:"Cancel"}),e.jsx($.Destructive,{type:"button",disabled:!j(ee.id,"DELETE"),onClick:()=>void at(ee),children:"Delete"})]})]}):null]})}export{ls as SchedulesPage};
|
|
1
|
+
import{B as rt}from"./chunk-HWOHXUGH-KXcUS5XW.js";import{l as Te,o as Ue,p as Ce,q as Ge,t as He,v as lt,r as o,w as ve,x as it,y as Fe,z as Ee,A as ot,j as e,P as ct,S as dt,B as xe,C as qe,D as Ve,E as $,I as R,F as ut,G as Ne,H as _e,J as mt,K as ht,L as Le,M as W,N as xt,O as K,k as We,Q as ft,c as B,R as gt,U as bt,V as pt,W as Nt,X as jt,Y as yt,Z as vt,_ as Q,$ as St,a0 as wt,u as kt,a1 as Tt,a2 as je,a3 as Ct,a4 as Et,a5 as zt,a6 as At,a7 as Rt,a8 as It,a9 as Pt,aa as ye,ab as Dt,ac as Ft,ad as _t}from"./index-aDyvsTqL.js";var Oe=[{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 Ke(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Lt(t){const n=Ke(),r=new Set(Oe.map(l=>l.value));return[...[n,t].flatMap(l=>l==null||l.length===0||r.has(l)?[]:(r.add(l),[{value:l,label:l===n?`${l} (Local)`:l}])),...Oe]}var Qe=[{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"}],Ot={"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 fe(){return{name:"",task:"",recurrence:"daily",hour:9,minute:0,weekdays:[1],customCron:"0 9 * * *",timezone:Ke()}}function Mt(t){return Ot[t]??t.split("/").pop()??t}function Ye(t){return t.toString().padStart(2,"0")}function me({hour:t,minute:n}){const r=t>=12?"PM":"AM",a=t%12===0?12:t%12;return`${String(a)}:${Ye(n)} ${r}`}function Se(t){const n=t.minute,r=t.hour;switch(t.recurrence){case"hourly":return`${String(n)} * * * *`;case"daily":return`${String(n)} ${String(r)} * * *`;case"weekly":{const a=[...t.weekdays].sort((u,S)=>u-S),l=a.length>0?a.join(","):"*";return`${String(n)} ${String(r)} * * ${l}`}case"custom":return t.customCron.trim()}}function we(t){return t.trim().split(/\s+/).length===5}function ce(t){const n=Mt(t.timezone),r=t.cron.trim().split(/\s+/);if(r.length!==5)return t.cron;const[a,l,u,S,b]=r;if(u!=="*"||S!=="*")return t.cron;const d=Number(a),h=Number(l);if(l==="*"&&b==="*"&&a!==void 0&&!Number.isNaN(d))return`Hourly at :${Ye(d)} ${n}`;if(b==="*"&&l!==void 0&&a!==void 0&&!Number.isNaN(h)&&!Number.isNaN(d))return`Daily ${me({hour:h,minute:d})} ${n}`;if(b==="1-5"&&l!==void 0&&a!==void 0&&!Number.isNaN(h)&&!Number.isNaN(d))return`Weekdays ${me({hour:h,minute:d})} ${n}`;if(b!=null&&/^\d(?:,\d)*$/.test(b)&&l!==void 0&&a!==void 0&&!Number.isNaN(h)&&!Number.isNaN(d)){const j=b.split(",").map(x=>{var k;return((k=Qe.find(p=>p.value===Number(x)))==null?void 0:k.label)??x});return j.length===1?`Every ${j[0]==="Mon"?"Monday":j[0]} ${me({hour:h,minute:d})} ${n}`:`${j.join(", ")} ${me({hour:h,minute:d})} ${n}`}return t.cron}function Me(t){const n=fe(),r=t.cron.trim().split(/\s+/);if(r.length!==5)return{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron};const[a,l,u,S,b]=r,d=Number(a),h=Number(l);return u!=="*"||S!=="*"?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron}:l==="*"&&b==="*"&&!Number.isNaN(d)?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"hourly",minute:d,customCron:t.cron}:b==="*"&&!Number.isNaN(h)&&!Number.isNaN(d)?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"daily",hour:h,minute:d,customCron:t.cron}:b!=null&&/^\d(?:,\d)*$/.test(b)&&!Number.isNaN(h)&&!Number.isNaN(d)?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"weekly",hour:h,minute:d,weekdays:b.split(",").map(Number),customCron:t.cron}:{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron,hour:Number.isNaN(h)?n.hour:h,minute:Number.isNaN(d)?n.minute:d}}function $t(t,n=Date.now()){return _t(t,{fallback:"Never",nowMs:n})}var Bt=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"custom",label:"Custom"}],Ut=Array.from({length:24},(t,n)=>({value:String(n),label:n.toString().padStart(2,"0")})),Gt=[0,15,30,45].map(t=>({value:String(t),label:`:${t.toString().padStart(2,"0")}`}));function Ht({values:t,onChange:n,agentId:r,agentLabel:a,onAgentIdChange:l,onAgentPicked:u,agentPickerDisabled:S=!1,onBuildAgent:b}){const d=Se(t),h=ce({cron:d,timezone:t.timezone}),j=Lt(t.timezone),x=(i,y)=>{n({...t,[i]:y})},k=i=>{const y=i==="custom"&&t.recurrence!=="custom"?d:t.customCron;n({...t,recurrence:i,customCron:y})},p=i=>{const z=t.weekdays.includes(i)?t.weekdays.filter(m=>m!==i):[...t.weekdays,i];n({...t,weekdays:z.length>0?z:[i]})};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(qe,{"aria-label":"Agent",placeholder:"Search agent",value:r,selectedLabel:a,onValueChange:i=>l==null?void 0:l(i),onAgentPicked:u,disabled:S||l==null,onBuildAgent:b})]}),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:i=>x("name",i.target.value),placeholder:"harness-daily-digest",className:ye("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:i=>x("task",i.target.value),rows:3,placeholder:"Summarise yesterday's harness runs and post the digest…",className:ye("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-4 gap-1 rounded-lg border border-border bg-primary-bg p-1",children:Bt.map(i=>{const y=t.recurrence===i.value;return e.jsx("button",{type:"button",className:B("rounded-md border px-2 py-2 text-sm font-medium transition-colors",y?"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":y,onClick:()=>k(i.value),children:i.label},i.value)})}),t.recurrence==="custom"?e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Cron expression"}),e.jsx("input",{"aria-label":"Cron expression",value:t.customCron,onChange:i=>x("customCron",i.target.value),placeholder:"0 */4 * * *",spellCheck:!1,"aria-invalid":!we(t.customCron),className:B(ye("h-8"),"font-mono")}),e.jsx("span",{className:"mt-1 block text-xs text-text-secondary",children:"minute hour day-of-month month day-of-week. Runs must be at least 1 hour apart."}),we(t.customCron)?null:e.jsx("span",{className:"mt-1 block text-xs text-failure-bg",children:"Enter exactly 5 space-separated fields."})]}):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:Qe.map(i=>{const y=t.weekdays.includes(i.value);return e.jsx("button",{type:"button",className:B("min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium",y?"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":y,onClick:()=>p(i.value),children:i.label},i.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(xe,{"aria-label":"Hour",value:String(t.hour),options:Ut,onValueChange:i=>x("hour",Number(i))})]}):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(xe,{"aria-label":"Minute",value:String(t.minute),options:Gt,onValueChange:i=>x("minute",Number(i))})]}):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(xe,{"aria-label":"Timezone",value:t.timezone,options:j,onValueChange:i=>x("timezone",i),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(R,{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:h||"—"}),e.jsx("code",{className:"shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary",children:d||"—"})]})})]})]})}function qt(t){return t.startsWith("manual-")}function Vt(t){return t==="failed"?"failed":"success"}function Ze(t){return t==="failed"?"Failed":t==="triggered"?"Triggered":"Scheduled"}function Je(t){return qt(t)?"Manual test":"Cron"}function Wt(t,n=5){return t.filter(a=>a.status!=="scheduled").slice(0,n).reverse()}function ke(t){if(t==null)return"—";const n=new Date(t);return Number.isNaN(n.getTime())?"—":It(n)}function Kt({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:Ze(t.status)}),e.jsx("p",{className:"text-text-secondary",children:Je(t.name)}),e.jsxs("p",{className:"text-text-secondary",children:["Scheduled for: ",ke(t.scheduledFor)]}),t.triggeredAt!=null?e.jsxs("p",{className:"text-text-secondary",children:["Triggered at: ",ke(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 Qt={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 Xe({run:t,onOpenSession:n}){const r=Vt(t.status),a=ke(t.triggeredAt??t.scheduledFor),l=`${Ze(t.status)} run at ${a}`,u=B("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",Qt[r]),S=e.jsx(R,{name:r==="failed"?"triangle-exclamation":"check",className:"size-3.5"});return e.jsx(We,{content:e.jsx(Kt,{run:t}),className:"max-w-sm whitespace-normal",side:"top",children:n!=null&&t.sessionId!=null&&t.sessionId!==""?e.jsx("button",{type:"button",className:B(u,"cursor-pointer hover:brightness-95"),"aria-label":`Open session for ${l}`,onClick:()=>n(t),children:S}):e.jsx("span",{className:u,"aria-label":l,children:S})})}function et({status:t}){const n=t==="active";return e.jsx(rt,{variant:n?"success":"warning",shape:"pill",size:"md",dot:!0,children:n?"Active":"Paused"})}function Yt(t,n){return t.find(r=>r.name===n||r.id===n)??null}function Zt({connector:t,onConnected:n}){return Dt()==null?null:e.jsx(Ft,{connector:t,onConnected:n})}function ie({label:t,children:n}){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:n})]})}function Jt({schedule:t,agentName:n,mcpMounts:r,onEditConfiguration:a}){const l=Te(),u=Ce(),{connectors:S,ensureLoaded:b,refreshConnectors:d,loading:h,error:j}=Pt(),[x,k]=o.useState(!1),[p,i]=o.useState(null),y=ce({cron:t.cron,timezone:t.timezone}),z=async()=>{k(!0);try{const m=await l.createScheduleRun({scheduleId:t.id});i(m),u==null||u.showSuccess({title:"Test run started"})}catch(m){u==null||u.showError(m)}finally{k(!1)}};return o.useEffect(()=>{b()},[b]),o.useEffect(()=>{j!=null&&(u==null||u.showError(j))},[j,u]),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(ie,{label:"Agent",children:n}),e.jsx(ie,{label:"Name",children:t.name}),e.jsx(ie,{label:"Status",children:e.jsx(et,{status:t.status})}),e.jsx(ie,{label:"Task",children:e.jsx("span",{className:"whitespace-pre-wrap break-words",children:t.task})}),e.jsx(ie,{label:"Frequency",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[e.jsx("span",{children:y}),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($.Secondary,{type:"button",size:"small",onClick:a,children:[e.jsx(R,{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"})}),r.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:r.map(m=>{const C=Yt(S,m.name),U=(C==null?void 0:C.authenticated)===!0,q=C==null&&!h;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:B("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",U?"border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"border-border text-transparent"),"aria-hidden":!0,children:U?e.jsx(R,{name:"check",className:"size-3"}):null}),e.jsx("span",{className:"text-text-primary min-w-0 flex-1 truncate text-sm",children:m.name}),U?e.jsx("span",{className:"text-success-bg text-xs font-medium",children:"Connected"}):q?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):C!=null&&C.authenticated===!1?e.jsx(Zt,{connector:C,onConnected:d}):h?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($.Primary,{type:"button",disabled:x,size:"small",onClick:()=>void z(),children:[e.jsx(R,{name:x?"loader":"play",className:B("size-3.5",x&&"animate-spin")}),"Run Test"]})]}),p==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(Xe,{run:p}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Je(p.name)}),e.jsx("p",{className:"text-text-secondary",children:$t(p.triggeredAt??p.scheduledFor)})]})]})]})]})}function Xt({open:t,onOpenChange:n,mode:r,schedule:a,initialAgentId:l="",onSaved:u}){const S=Te(),b=Ue(),d=He(),h=Ce(),j=Ge(),[x,k]=o.useState(fe),[p,i]=o.useState(l),[y,z]=o.useState(null),[m,C]=o.useState({kind:"form"}),[U,q]=o.useState(!1),[re,Y]=o.useState(!1),[A,_]=o.useState(null),L=o.useRef(p);L.current=p;const Z=m.kind==="form"?m.saved:m.schedule,N=r==="edit"&&m.kind==="form"&&m.saved==null&&a!=null,O=m.kind==="form"&&m.saved!=null,T=r==="create"&&m.kind==="form"&&m.saved==null,{allows:J}=ve({resourceType:"agent",resourceIds:p.length===0?[]:[p]});o.useEffect(()=>{if(!t){k(fe()),i(l),z(null),_(null),C({kind:"form"}),Y(!1);return}if(r==="edit"&&a!=null){k(Me({name:a.name,task:a.task,cron:a.cron,timezone:a.timezone})),i(a.agentId),z(null),C({kind:"form"});return}k(fe()),i(l),z(null),C({kind:"form"})},[t,r,a,l]),o.useEffect(()=>{if(!t||r!=="create"||l.length===0)return;let f=!1;const v=l;return zt({server:b,agentKey:v}).then(w=>{f||w==null||L.current===v&&(z(w),i(Ve(w)))}).catch(()=>{}),()=>{f=!0}},[t,r,l,b]);const G=(y==null?void 0:y.name)??(Z==null?void 0:Z.agentName)??(a==null?void 0:a.agentName)??(p.length>0?p:""),ge=o.useMemo(()=>{var v;return(((v=y==null?void 0:y.agentSpec)==null?void 0:v.mcpServers)??[]).map(At).filter(w=>w!=null).map(w=>({name:w}))},[y]),le=o.useMemo(()=>{const f=Se(x);return x.name.trim().length>0&&x.task.trim().length>0&&we(f)&&p.length>0&&(!T||J(p,"USE"))},[p,J,x,T]),V=f=>{C({kind:"test",schedule:f}),k(Me({name:f.name,task:f.task,cron:f.cron,timezone:f.timezone})),i(f.agentId)},X=async f=>{if(f.preventDefault(),!le)return;const v=Se(x);q(!0),_(null);try{if(N&&a!=null){await S.updateSchedule({id:a.id,name:x.name.trim(),task:x.task.trim(),cron:v,timezone:x.timezone,status:a.status}),j(Q.Schedule.EDITED,{schedule_id:a.id,agent_id:a.agentId}),u==null||u(),n(!1);return}if(O&&m.kind==="form"&&m.saved!=null){const I=await S.updateSchedule({id:m.saved.id,name:x.name.trim(),task:x.task.trim(),cron:v,timezone:x.timezone,status:"paused"});j(Q.Schedule.EDITED,{schedule_id:I.id,agent_id:I.agentId}),u==null||u(),V(I),h==null||h.showSuccess({title:"Schedule saved as paused",description:ce({cron:I.cron,timezone:I.timezone})});return}const w=await S.createSchedule({agentId:p,name:x.name.trim(),task:x.task.trim(),cron:v,timezone:x.timezone,status:"paused"});j(Q.Schedule.CREATED,{schedule_id:w.id,agent_id:p}),u==null||u(),V(w),h==null||h.showSuccess({title:"Schedule saved as paused",description:ce({cron:w.cron,timezone:w.timezone})})}catch(w){const I=w instanceof Error?w.message:"Failed to save schedule";_(I)}finally{q(!1)}},ee=async()=>{if(m.kind==="test"){Y(!0),_(null);try{await S.updateSchedule({id:m.schedule.id,name:m.schedule.name,task:m.schedule.task,cron:m.schedule.cron,timezone:m.schedule.timezone,status:"active"}),u==null||u(),h==null||h.showSuccess({title:"Schedule activated"}),n(!1)}catch(f){const v=f instanceof Error?f.message:"Failed to activate schedule";_(v),h==null||h.showError(f)}finally{Y(!1)}}},te=m.kind==="test"?"Test Schedule":N||O?"Edit Schedule":"New Schedule",M=m.kind==="test"?`Recurring unattended runs of ${G}.`:N||O?"Update cadence and task for this schedule.":"Create a recurring unattended run for an agent.";let se;return m.kind==="test"?se=e.jsxs("div",{className:"flex flex-col gap-2",children:[A!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:A}):null,e.jsx($.Secondary,{type:"button",className:"w-full",disabled:re,onClick:()=>void ee(),children:"Activate Schedule"})]}):se=e.jsxs("div",{className:"flex flex-col gap-2",children:[A!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:A}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx($.Secondary,{type:"button",onClick:()=>n(!1),disabled:U,children:"Cancel"}),e.jsx($.Primary,{type:"submit",form:"schedule-form",disabled:!le||U,children:"Save"})]})]}),e.jsx(Rt,{open:t,onOpenChange:n,title:te,description:M,anchor:"right",size:"xl",headerIcon:e.jsx("span",{className:"text-primary-button-bg inline-flex size-8 items-center justify-center",children:e.jsx(R,{name:m.kind==="test"||N||O?"calendar":"calendar-plus",className:"size-5"})}),footer:se,children:m.kind==="test"?e.jsx(Jt,{schedule:m.schedule,agentName:G,mcpMounts:ge,onEditConfiguration:()=>{_(null),C({kind:"form",saved:m.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:f=>void X(f),children:e.jsx(Ht,{values:x,onChange:k,agentId:p,agentLabel:G,onAgentIdChange:N||O?void 0:f=>{i(f),f.length===0&&z(null)},onAgentPicked:z,agentPickerDisabled:N||O,onBuildAgent:r==="create"&&(d==null?void 0:d.isComposerEnabled)===!0?()=>{n(!1),d.openAgentBuilder()}:void 0})})})}function $e(t){return e.jsx(Et,{children:e.jsx(Xt,{...t})})}function es({runs:t,onOpenSession:n}){const r=Wt(t);return r.length===0?e.jsx("span",{className:"text-text-secondary text-sm",children:"—"}):e.jsx("div",{className:"flex items-center gap-1",children:r.map(a=>e.jsx(Xe,{run:a,...n==null?{}:{onOpenSession:n}},a.id))})}var ts=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],Be=[10,25];function he(t){return Math.min(Math.max(t,1),25)}function oe(t){const n=Ee(t);return{nameQuery:n.q??"",statusFilter:n.status??"all",agentFilter:n.agent??"all",scheduleId:n.scheduleId}}function ss(t){const n=Ee(window.location.search);if(!n.isNew)return{kind:"closed"};const r=t??n.agent;return{kind:"create",...r==null?{}:{agentId:r}}}function ns({schedule:t,running:n,canManage:r,canDelete:a,onRunNow:l,onEdit:u,onTogglePause:S,onDelete:b}){const d=kt("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1.5",children:[e.jsx(d,{allowed:r,children:e.jsxs($.Secondary,{type:"button",disabled:n,"aria-label":`Run now ${t.name}`,size:"large",onClick:l,children:[e.jsx(R,{name:n?"loader":"play",className:B("size-3.5",n&&"animate-spin")}),"Run now"]})}),e.jsxs(Tt,{align:"end",trigger:e.jsx("button",{type:"button",className:Ct({variant:"ghost",size:"icon"}),"aria-label":`Actions for ${t.name}`,children:e.jsx(R,{name:"ellipsis"})}),children:[e.jsx(d,{allowed:r,children:e.jsxs(je,{onClick:u,children:[e.jsx(R,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(d,{allowed:r,children:e.jsxs(je,{onClick:S,children:[e.jsx(R,{name:t.status==="active"?"pause":"play",className:"size-3.5"}),t.status==="active"?"Pause":"Resume"]})}),e.jsx(d,{allowed:a,children:e.jsxs(je,{className:"text-failure-bg focus:text-failure-bg",onClick:b,children:[e.jsx(R,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function ls({agentId:t}){const n=Te(),r=Ue(),a=Ce(),l=Ge(),u=He(),S=lt(),b=u!=null&&vt({sessions:S}),[d,h]=o.useState([]),{allows:j}=ve({resourceType:"schedule",resourceIds:d.map(s=>s.id)}),[x,k]=o.useState({}),[p,i]=o.useState(!1),[y,z]=o.useState(()=>new Set),[m,C]=o.useState({}),[U,q]=o.useState(!0),[re,Y]=o.useState(null),[A,_]=o.useState(()=>oe(window.location.search).nameQuery),[L,Z]=o.useState(()=>oe(window.location.search).statusFilter),[N,O]=o.useState(()=>t??oe(window.location.search).agentFilter),[T,J]=o.useState(()=>oe(window.location.search).scheduleId),G=t??(N==="all"?null:N),{allows:ge}=ve({resourceType:"agent",resourceIds:G==null?[]:[G]}),le=r.permissions==null||G==null||ge(G,"USE"),[V,X]=o.useState(()=>ss(t)),[ee,te]=o.useState(null),[M,se]=o.useState(()=>he(yt)),[f,v]=o.useState(void 0),[w,I]=o.useState(void 0),[ne,P]=o.useState(void 0),tt=({run:s,schedule:c})=>{if(!b||u==null||s.sessionId==null)return;l(Q.Schedule.RUN_SESSION_OPENED,{schedule_id:c.id,agent_id:c.agentId});const g=St(s.triggeredAt??s.scheduledFor);wt({sessionId:s.sessionId,view:"sessions",...g==null?{}:{timeRange:g}}),u.setSessionsOpen(!0)},H=o.useRef(0),ze=o.useRef(!1),be=o.useCallback(async({rows:s,gen:c})=>{if(s.length===0){c===H.current&&k({});return}i(!0);try{const g=await Promise.allSettled(s.map(E=>n.listScheduleRuns({scheduleId:E.id})));if(c!==H.current)return;k(Object.fromEntries(s.map((E,D)=>{const F=g[D],ue=(F==null?void 0:F.status)==="fulfilled"?F.value:[];return[E.id,ue]})))}finally{c===H.current&&i(!1)}},[n]),ae=o.useCallback(async({token:s,size:c,agentId:g,pinnedScheduleId:E})=>{const D=++H.current;q(!0),Y(null);try{if(E!=null){const ue=await n.getSchedule({id:E});if(D!==H.current)return;h([ue]),I(void 0),P(void 0),be({rows:[ue],gen:D});return}const F=await n.listSchedules({limit:he(c),...s===void 0||s===""?{}:{pageToken:s},...g==="all"?{}:{agentIds:[g]}});if(D!==H.current)return;h(F.data),I(F.nextPageToken),P(F.previousPageToken),be({rows:F.data,gen:D})}catch(F){if(D!==H.current)return;Y(it(F,"Check your connection and try again.")),h([]),k({}),I(void 0),P(void 0)}finally{D===H.current&&q(!1)}},[n,be]),Ae=o.useCallback(s=>{const c=(s==null?void 0:s.size)??M,g=(s==null?void 0:s.agentId)??N;J(null),v(void 0),P(void 0),ae({token:void 0,size:c,agentId:g,pinnedScheduleId:null})},[N,ae,M]);o.useEffect(()=>{Fe({agent:t===void 0&&N!=="all"?N:null,status:L==="all"?null:L,q:A.trim().length===0?null:A,scheduleId:T})},[N,t,L,A,T]),o.useEffect(()=>{t!==void 0&&O(s=>s===t?s:(v(void 0),P(void 0),t))},[t]),o.useEffect(()=>{ze.current||!Ee(window.location.search).isNew||(ze.current=!0,Fe({isNew:null}))},[]),o.useEffect(()=>{const s=()=>{const c=oe(window.location.search);_(c.nameQuery),Z(c.statusFilter),J(g=>g===c.scheduleId?g:(v(void 0),P(void 0),c.scheduleId)),O(g=>{const E=t??c.agentFilter;return g===E?g:(v(void 0),P(void 0),E)})};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[t]),o.useEffect(()=>{ae({token:f,size:M,agentId:N,pinnedScheduleId:T})},[N,M,f,ae,T]),o.useEffect(()=>{if(T==null||A.trim().length>0)return;const s=d.find(c=>c.id===T);s!=null&&_(s.name)},[A,T,d]);const de=o.useMemo(()=>{if(T!=null)return d;const s=A.trim().toLowerCase();return d.filter(c=>!(L!=="all"&&c.status!==L||s.length>0&&!c.name.toLowerCase().includes(s)))},[d,A,L,T]),Re=ot(d),Ie=ne!=null||w!=null,st=async s=>{if(!j(s.id,"MANAGE"))return;const c=s.status==="active"?"paused":"active";try{await n.updateSchedule({...s,status:c}),l(Q.Schedule.TOGGLED,{schedule_id:s.id,agent_id:s.agentId,next_status:c}),await ae({token:f,size:M,agentId:N,pinnedScheduleId:T})}catch(g){a==null||a.showError(g)}},nt=async s=>{if(j(s.id,"MANAGE")){z(c=>new Set(c).add(s.id));try{if(await n.createScheduleRun({scheduleId:s.id}),l(Q.Schedule.RUN_NOW,{schedule_id:s.id,agent_id:s.agentId}),a==null||a.showSuccess({title:"Run started"}),T!=null){const g=await n.getSchedule({id:T});h(E=>{const D=E.length===1?E[0]:void 0;return D!=null&&D.id===g.id?[g]:E})}const c=await n.listScheduleRuns({scheduleId:s.id});k(g=>({...g,[s.id]:c}))}catch(c){a==null||a.showError(c)}finally{z(c=>{const g=new Set(c);return g.delete(s.id),g})}}},at=async s=>{if(j(s.id,"DELETE")){te(null);try{await n.deleteSchedule({id:s.id}),l(Q.Schedule.DELETED,{schedule_id:s.id,agent_id:s.agentId}),Ae()}catch(c){a==null||a.showError(c)}}},Pe=()=>{w!=null&&v(w)},De=()=>{ne==null||ne===""||v(ne)},pe=()=>{T!=null&&(J(null),v(void 0),P(void 0))};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-primary-bg",children:[e.jsx(ct,{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(dt,{query:A,setQuery:s=>{_(s),pe()},placeholder:"Search schedules by name"})}),e.jsx(xe,{value:L,onValueChange:s=>{Z(s),pe()},options:ts,className:"sm:w-40","aria-label":"Filter by status"}),t===void 0?e.jsx(qe,{value:N,selectedLabel:N==="all"?"All agents":m[N]??N,onValueChange:s=>{O(s),v(void 0),P(void 0),pe()},onAgentPicked:s=>{C(c=>({...c,[Ve(s)]:s.name}))},allOption:{value:"all",label:"All agents"},className:"sm:w-48","aria-label":"Filter by agent",placeholder:"Search agent"}):null,e.jsxs($.Primary,{type:"button",disabled:!le,onClick:()=>le&&X({kind:"create",agentId:N!=="all"?N:void 0}),children:[e.jsx(R,{name:"plus",className:"size-3.5"}),"New Schedule"]})]})}),e.jsx("div",{className:B("min-h-0 flex-1 overflow-auto px-4 py-4",re!=null?"flex flex-col":void 0),children:U?e.jsx("div",{className:"flex flex-col gap-2",role:"status","aria-label":"Loading schedules",children:Array.from({length:5},(s,c)=>e.jsx(ut,{className:"h-12 w-full rounded-md"},c))}):re!=null?e.jsx("div",{role:"alert",className:"flex flex-1 flex-col items-center justify-center",children:e.jsx(Ne,{title:"Couldn't load schedules",description:re,className:"h-auto min-h-0 flex-none py-0"})}):d.length===0?e.jsx(Ne,{title:"No Schedules Found",description:"Create one to get started.",className:"min-h-full"}):de.length===0?e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(Ne,{title:"No Schedules Found",description:"No schedules match your filters.",className:"flex-1"}),Ie?e.jsx(_e,{pageSize:M,rowCount:0,canPrev:ne!=null,canNext:w!=null,onPrev:De,onNext:Pe,pageSizeOptions:Be,onPageSizeChange:s=>{const c=he(s);se(c),v(void 0),P(void 0)}}):null]}):e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs(mt,{className:"min-w-240",children:[e.jsx(ht,{children:e.jsxs(Le,{className:"hover:bg-transparent",children:[e.jsx(W,{children:"Schedule Name"}),e.jsx(W,{children:"Task"}),Re?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(xt,{children:de.map(s=>{const c=ce({cron:s.cron,timezone:s.timezone}),g=s.agentName??m[s.agentId]??s.agentId;return e.jsxs(Le,{children:[e.jsxs(K,{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(R,{name:"agent-2",className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:g})]})]}),e.jsx(K,{className:"w-64 max-w-64",children:e.jsx(We,{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})})}),Re?e.jsx(K,{children:e.jsx(ft,{subject:s.createdBySubject})}):null,e.jsx(K,{children:c}),e.jsx(K,{children:e.jsx(et,{status:s.status})}),e.jsx(K,{children:p?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):e.jsx(es,{runs:x[s.id]??[],...b?{onOpenSession:E=>tt({run:E,schedule:s})}:{}})}),e.jsx(K,{className:"text-right",children:e.jsx(ns,{schedule:s,running:y.has(s.id),canManage:j(s.id,"MANAGE"),canDelete:j(s.id,"DELETE"),onRunNow:()=>void nt(s),onEdit:()=>{j(s.id,"MANAGE")&&X({kind:"edit",schedule:s})},onTogglePause:()=>void st(s),onDelete:()=>{j(s.id,"DELETE")&&te(s)}})})]},s.id)})})]}),(de.length>0||Ie)&&e.jsx(_e,{pageSize:M,rowCount:de.length,canPrev:ne!=null,canNext:w!=null,onPrev:De,onNext:Pe,pageSizeOptions:Be,onPageSizeChange:s=>{const c=he(s);se(c),v(void 0),P(void 0)}})]})}),V.kind==="create"?e.jsx($e,{open:!0,mode:"create",initialAgentId:V.agentId??"",onOpenChange:s=>{s||X({kind:"closed"})},onSaved:()=>Ae()}):null,V.kind==="edit"?e.jsx($e,{open:!0,mode:"edit",schedule:V.schedule,onOpenChange:s=>{s||X({kind:"closed"})},onSaved:()=>void ae({token:f,size:M,agentId:N,pinnedScheduleId:T})}):null,ee!=null?e.jsxs(gt,{open:!0,onOpenChange:s=>{s||te(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(bt,{children:e.jsxs(pt,{children:[e.jsx(Nt,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",ee.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(jt,{children:[e.jsx($.Secondary,{type:"button",onClick:()=>te(null),children:"Cancel"}),e.jsx($.Destructive,{type:"button",disabled:!j(ee.id,"DELETE"),onClick:()=>void at(ee),children:"Delete"})]})]}):null]})}export{ls as SchedulesPage};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModelSettings-3RSWQ5WD-
|
|
2
|
-
import{bn as O,ab as D,bz as P,b as L,bA as I,q as A,a9 as M,bB as z,bf as T,r,_ as S,bC as R,j as s,P as B,I as E,a3 as V,c as p,bD as W,bk as n,bi as H}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModelSettings-3RSWQ5WD-BUbTYQmV.js","./chunk-LFIIKLPG-DcaznAz-.js","./index-aDyvsTqL.js","./index-B01pXqvC.css","./ConnectorSettings-E3KBW7HI-Bqrsm5Dp.js","./SkillSettings-XLK6REIA-UZs1mGXm.js","./SandboxSettings-YIEGCYQO-CunudcIx.js","./WebSearchSettings-PKYKXD26-vhZuRM_V.js","./MemorySettings-Y6HNEYIW-O-E_902u.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{bn as O,ab as D,bz as P,b as L,bA as I,q as A,a9 as M,bB as z,bf as T,r,_ as S,bC as R,j as s,P as B,I as E,a3 as V,c as p,bD as W,bk as n,bi as H}from"./index-aDyvsTqL.js";var q=r.lazy(()=>n(()=>import("./ModelSettings-3RSWQ5WD-BUbTYQmV.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),F=r.lazy(()=>n(()=>import("./ConnectorSettings-E3KBW7HI-Bqrsm5Dp.js"),__vite__mapDeps([4,1,2,3]),import.meta.url)),G=r.lazy(()=>n(()=>import("./SkillSettings-XLK6REIA-UZs1mGXm.js"),__vite__mapDeps([5,1,2,3]),import.meta.url)),K=r.lazy(()=>n(()=>import("./SandboxSettings-YIEGCYQO-CunudcIx.js"),__vite__mapDeps([6,1,2,3]),import.meta.url)),J=r.lazy(()=>n(()=>import("./WebSearchSettings-PKYKXD26-vhZuRM_V.js"),__vite__mapDeps([7,1,2,3]),import.meta.url)),Q=r.lazy(()=>n(()=>import("./MemorySettings-Y6HNEYIW-O-E_902u.js"),__vite__mapDeps([8,2,3]),import.meta.url));function U(){return s.jsxs("div",{className:"flex flex-1 items-center justify-center py-8",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(H,{size:20,className:"text-text-secondary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]})}var X=({headerStart:k}={})=>{var j;const{settingsOpen:i,settingsSection:a,setSettingsOpen:o}=O(),l=D(),x=P(),h=(j=L())==null?void 0:j.settings,c=I(),m=A(),{refresh:y}=M(),C=z(),N=T(),u=C||N,g=(l==null?void 0:l.skillCatalog)!=null,v=(l==null?void 0:l.sandboxCatalog)!=null,_=(l==null?void 0:l.webSearchCatalog)!=null||x!=null,w=(l==null?void 0:l.memoryCatalog)!=null||x!=null,f=r.useCallback(()=>{m(S.Settings.CLOSED,{section:a}),o(!1)},[a,o,m]);r.useEffect(()=>{if(i)return()=>{y(),c==null||c()}},[i,y,c]),r.useEffect(()=>{if(!i)return;const e=b=>{b.key==="Escape"&&(W()||(b.stopImmediatePropagation(),f()))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[f,i]);const d=r.useMemo(()=>{const e=[{id:"models",label:"Models",icon:"cpu",capability:"modelProviders"},{id:"connectors",label:"Connectors",icon:"plug",capability:"mcpServers"}];return g&&e.push({id:"skills",label:"Skills",icon:"lightbulb",capability:"skills"}),v&&e.push({id:"sandbox",label:"Sandbox providers",icon:"cube",capability:"sandboxProviders"}),_&&e.push({id:"web-search",label:"Web search",icon:"search",capability:"webSearch"}),w&&e.push({id:"memory",label:"Memory",icon:"brain",capability:"memoryProviders"}),e.filter(b=>R({settings:h,section:b.capability}))},[g,v,_,w,h]),t=d.find(e=>e.id===a);return r.useEffect(()=>{const e=d[0];t!==void 0||e===void 0||o(i,e.id)},[t,d,i,o]),!i||!l?null:s.jsxs("div",{className:"flex h-full min-h-0 w-full min-w-0 flex-col overflow-x-hidden bg-primary-bg",children:[s.jsx(B,{title:"Settings",start:k??s.jsx("button",{type:"button","aria-label":"Back",title:"Back",className:V({variant:"ghost",size:"icon"}),onClick:f,children:s.jsx(E,{name:"arrow-left"})})}),s.jsxs("div",{className:p("flex min-h-0 min-w-0 flex-1 flex-col",!u&&"md:flex-row"),children:[s.jsx("nav",{"aria-label":"Settings sections",className:p("flex w-full min-w-0 gap-1 border-b border-border bg-secondary-bg/40 p-2",u?"overflow-x-auto":"justify-center md:w-48 md:flex-col md:justify-start md:border-b-0 md:border-r"),children:d.map(e=>s.jsxs("button",{type:"button","aria-current":a===e.id?"page":void 0,...u?{title:e.label}:{},className:p("flex min-h-9 items-center gap-2 rounded-md px-3 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",u?"min-w-0 flex-1 justify-center gap-1.5 px-1.5":"shrink-0",a===e.id?"bg-primary-button-bg/10 text-primary-button-bg":"text-text-secondary hover:bg-ghost-button-hover/60 hover:text-text-primary"),onClick:()=>{m(S.Settings.SECTION_CHANGED,{section:e.id}),o(!0,e.id)},children:[s.jsx(E,{name:e.icon,className:"h-4 w-4 shrink-0"}),u?s.jsx("span",{className:"truncate",children:e.label}):e.label]},e.id))}),s.jsx("section",{className:"flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden overflow-y-hidden px-4 py-4 sm:px-6",children:s.jsx("div",{className:"mx-auto flex h-full min-h-0 w-full min-w-0 max-w-210 flex-col",children:s.jsxs(r.Suspense,{fallback:s.jsx(U,{}),children:[(t==null?void 0:t.id)==="models"?s.jsx(q,{}):null,(t==null?void 0:t.id)==="connectors"?s.jsx(F,{}):null,(t==null?void 0:t.id)==="skills"?s.jsx(G,{}):null,(t==null?void 0:t.id)==="sandbox"?s.jsx(K,{}):null,(t==null?void 0:t.id)==="web-search"?s.jsx(J,{}):null,(t==null?void 0:t.id)==="memory"?s.jsx(Q,{}):null]})})})]})]})},Z=X;export{Z as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bn as ce,d as pe,ab as ge,v as ye,bo as fe,bp as he,bq as de,b as me,br as Se,r as a,bs as be,bt as Ae,x as Oe,bu as ve,D as Ne,bv as _,bw as P,bx as ne,by as B}from"./index-
|
|
1
|
+
import{bn as ce,d as pe,ab as ge,v as ye,bo as fe,bp as he,bq as de,b as me,br as Se,r as a,bs as be,bt as Ae,x as Oe,bu as ve,D as Ne,bv as _,bw as P,bx as ne,by as B}from"./index-aDyvsTqL.js";import{u as Re,a as Ee}from"./chunk-OB3PAWPO-Bm8RoZbE.js";var $="try_agent_name",k="history_agent_name";function te(t){return t!=null&&t.length>0?t:null}function T(t){const o=new URLSearchParams(t.startsWith("?")?t.slice(1):t),u=te(o.get($));if(u!=null)return{intent:"try-agent",agentName:u};const e=te(o.get(k));return e==null?null:{intent:"history",agentName:e}}function Ce(t,o){t.delete($),t.delete(k),o!=null&&t.set(o.intent==="try-agent"?$:k,o.agentName)}function se(t,o){const u=new URLSearchParams(t.startsWith("?")?t.slice(1):t);Ce(u,o);const e=u.toString();return e.length>0?`?${e}`:""}function re(t){const o=t.sessionAccessError!=null?t.pendingSessionId:t.activeRemoteId??t.pendingSessionId;if(o!=null)return{type:"session",sessionId:o};const{mode:u,agentConfigMode:e}=t;if(u.status==="active"&&u.isMutable&&u.isCreateAgent)return{type:"buildAgent"};if(u.status==="active"&&!u.isMutable&&e!=="SingleAgent"){const p=u.agentName??u.agentId;if(p!=null)return{type:"agent",agentName:p}}return{type:"root"}}function Pe(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"}:re(t)}function O(t){return t.type==="root"||t.type==="agent"||t.type==="session"}function Ie(t){return t.type==="sessionsBrowser"||t.type==="sharedSession"}function Le({routes:t,activeRemoteId:o,initialSettingsOpen:u}){var Z,x;const e=ce(),p=pe(),q=ge(),v=ye(),I=fe(),G=he(),K=de(),W=me(),Y=Se(),w=Re(),r=Ee(),c=a.useMemo(()=>be({routes:t,catalog:q,capabilities:W,sessions:v,schedules:G,sandboxEnvironments:K}),[t,q,W,v,G,K]),U=c.settings!=null,ae=[c.settings,c.sessionsBrowser,c.sharedSession,c.libraryAgent,c.schedules,c.environments].join("\0"),D={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:o,sessionAccessError:e.sessionAccessError,mode:e.mode,agentConfigMode:e.agentConfigMode},g=Pe(D),ie=JSON.stringify(g),S=a.useRef(null),H=a.useRef(null),N=a.useRef(null),R=a.useRef(!1),b=a.useRef(null),[le,oe]=a.useState(0),m=a.useRef(null),L=a.useRef(null),Q=`${e.runtimeKey}\0${e.pendingSessionEpoch}`,M=a.useRef(Q);M.current=Q;const y=a.useRef(null),j=a.useRef(!1),z=a.useRef(!1),J=a.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]),A=a.useCallback(n=>{const s=b.current;(s==null?void 0:s.type)==="session"&&s.sessionId===n&&(b.current=null,oe(l=>l+1))},[]),V=a.useCallback(n=>{if(L.current=n,p==null){e.openHistorySession({sessionId:n});return}const s=M.current,l=I==null||v==null?Promise.resolve(!0):I.listPermissions({resourceType:"session",resourceIds:[n]}).then(i=>(i.data.permissions[n]??[]).includes("MANAGE")).catch(()=>!0);Promise.all([p.getSession({sessionId:n}),l]).then(([i,f])=>{if(L.current!==n){A(n);return}if(!f){A(n),e.openSharedSession(n);return}e.openHistorySession({sessionId:n,isMutable:i.isMutable,isCreateAgent:Ae(i),...i.agentName!=null?{agentName:i.agentName}:{}})}).catch(i=>{if(L.current!==n){A(n);return}if(M.current!==s){A(n);return}e.openInaccessibleSession({sessionId:n,message:Oe(i,"This session could not be loaded.")})})},[I,A,p,v,e]),d=a.useCallback(n=>{if(n==null){y.current=null,m.current=null,e.setHistoryAgentFilter(null);return}const s=`${n.intent}\0${n.agentName}`,l=e.historyAgentFilter;if((l==null?void 0:l.intent)===n.intent&&l.agentName===n.agentName&&l.agentId!=null){y.current=null;return}y.current=s,e.setHistoryAgentFilter(n),p!=null&&ve({server:p,agentName:n.agentName}).then(i=>{if(y.current===s){if(i==null){y.current=null,m.current=null,e.setHistoryAgentFilter(null);return}y.current=null,e.setHistoryAgentFilter({agentId:Ne(i),agentName:i.name,intent:n.intent})}}).catch(()=>{y.current===s&&(y.current=null,m.current=null,e.setHistoryAgentFilter(null))})},[p,e]),X=a.useCallback(n=>{e.selectLibraryAgent({isMutable:!1,agentName:n}),d({intent:"try-agent",agentName:n})},[d,e]),F=a.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||o===n.sessionId)return;V(n.sessionId);return;case"agent":e.setLibraryOpen(!1),X(n.agentName);return;case"root":J();return}},[e,o,J,X,V]);return a.useEffect(()=>{if(R.current)return;const n=_({pathname:r.pathname,search:r.search,routes:t});if(!Y&&((n==null?void 0:n.type)==="settings"||(n==null?void 0:n.type)==="environments"))return;R.current=!0;const s=_({pathname:r.pathname,search:r.search,routes:c})??{type:"root"},l=s.type==="agent"?{intent:"try-agent",agentName:s.agentName}:O(s)?T(r.search):null;m.current=l,N.current=s;const i=U&&(u||s.type==="settings");if(s.type==="settings")U&&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 C=re(D);P(C,s)||F(s),i&&e.setSettingsOpen(!0)}s.type!=="agent"&&l!=null?d(l):O(s)||d(null);const f=i?{type:"settings"}:s;b.current=P(g,f)?null:f;const h=ne(f,c),E=se(B(f,r.search),l);H.current=f,h!=null&&(h!==r.pathname||E!==r.search)&&(S.current=h!==r.pathname?h:null,w({pathname:h,search:E,hash:r.hash},{replace:!0}))},[Y]),a.useEffect(()=>{if(!R.current)return;if(!j.current){j.current=!0;return}const n=b.current;if(n!=null){if(!P(g,n))return;b.current=null}const s=ne(g,c);if(s==null)return;const i=`${c.basename.endsWith("/")?c.basename.slice(0,-1):c.basename}${r.pathname}`||"/",f=window.location.pathname===i?window.location.search:r.search,h=O(g),E=h?e.historyAgentFilter==null?m.current:{intent:e.historyAgentFilter.intent,agentName:e.historyAgentFilter.agentName}:null;!h&&e.historyAgentFilter!=null&&(y.current=null,e.setHistoryAgentFilter(null)),e.historyAgentFilter!=null&&(m.current=null);const C=se(B(g,f),E),ee=H.current;if(H.current=g,s===r.pathname&&C===r.search)return;const ue=g.type==="session"&&e.pendingSessionId==null&&ee!=null&&ee.type!=="session";S.current=s!==r.pathname?s:null,w({pathname:s,search:C,hash:r.hash},{replace:ue})},[ie,ae,le,(Z=e.historyAgentFilter)==null?void 0:Z.agentName,(x=e.historyAgentFilter)==null?void 0:x.intent]),a.useEffect(()=>{if(!R.current)return;if(!z.current){z.current=!0;return}if(S.current===r.pathname){S.current=null,N.current=g;return}const n=_({pathname:r.pathname,search:r.search,routes:c});if(n==null){const l=c.root,i=B({type:"root"},r.search);S.current=l,w({pathname:l,search:i,hash:r.hash},{replace:!0}),F({type:"root"}),d(T(i));return}const s=N.current;N.current=n,(s==null||!P(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),F(n)),n.type!=="agent"&&O(n)?d(T(r.search)):O(n)||d(null)},[r.pathname,r.search]),null}export{Le as ShellRouteSync};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-6WNST3GI-
|
|
2
|
-
import{cI as B,cJ as sn,be as J,j as s,cK as rn,r as m,bU as A,cL as qe,cM as on,cN as Qe,cO as Ze,cP as Je,cQ as et,cR as tt,cS as oe,cT as an,cU as P,cV as cn,cW as ln,cX as dn,cY as un,cZ as mn,c_ as fn,c$ as hn,d0 as pn,d1 as Te,d2 as xn,d3 as gn,d4 as ge,d5 as vn,d6 as bn,d7 as wn,d8 as nt,d9 as ze,da as ve,db as Re,dc as de,dd as Ne,de as Pe,df as Ee,dg as $e,d as Ae,q as st,t as ie,u as T,b$ as yn,w as In,c0 as Me,dh as jn,c2 as rt,c3 as Mn,c1 as Sn,di as Cn,k as ot,I as V,a3 as re,c as W,p as Ln,dj as Tn,dk as Rn,_ as he,bS as pe,dl as we,dm as Nn,bf as De,bB as at,dn as Pn,S as En,a2 as Ge,D as An,dp as it,dq as Dn,dr as _n,ds as On,dt as He,bG as kn,aa as Bn,E as Ue,bh as ct,du as Fn,P as Kn,dv as zn,bi as ye,bj as $n,dw as lt,dx as dt,c8 as Gn,bk as _e,dy as Hn,cF as Un}from"./index-DY4Vt5qS.js";import{A as Vn,N as Wn,T as Xn,S as ut}from"./chunk-OXW7TUTC-moy4-cpX.js";import{C as Yn}from"./chunk-LFIIKLPG-gJeIso6M.js";import{s as qn,u as Qn,S as Zn}from"./chunk-HK4WITDD-Dk6A8b9_.js";const Oe=n=>{const e=B(8),{index:t,archived:o,children:r}=n;let i;e[0]!==o||e[1]!==t?(i=sn({source:"threads",query:{type:"index",index:t,archived:o},get:d=>d.threads().item({index:t,archived:o})}),e[0]=o,e[1]=t,e[2]=i):i=e[2];let c;e[3]!==i?(c={threadListItem:i},e[3]=i,e[4]=c):c=e[4];const a=J(c);let u;return e[5]!==a||e[6]!==r?(u=s.jsx(rn,{value:a,children:r}),e[5]=a,e[6]=r,e[7]=u):u=e[7],u},mt=m.memo(n=>{const e=B(6),{index:t,archived:o,components:r}=n,i=o===void 0?!1:o,c=r.ThreadListItem;let a;e[0]!==c?(a=s.jsx(c,{}),e[0]=c,e[1]=a):a=e[1];let u;return e[2]!==i||e[3]!==t||e[4]!==a?(u=s.jsx(Oe,{index:t,archived:i,children:a}),e[2]=i,e[3]=t,e[4]=a,e[5]=u):u=e[5],u},(n,e)=>n.index===e.index&&n.archived===e.archived&&n.components.ThreadListItem===e.components.ThreadListItem);mt.displayName="ThreadListPrimitive.ItemByIndex";const Ve=({archived:n,children:e})=>{const t=A(o=>n?o.threads.archivedThreadIds.length:o.threads.threadIds.length);return qe(()=>Array.from({length:t},(o,r)=>s.jsx(Oe,{index:r,archived:n,children:s.jsx(on,{getItemState:i=>i.threads().item({index:r,archived:n}).getState(),children:i=>e({get threadListItem(){return i()}})})},r)),[t,n,e])},ft=n=>{const e=B(8),{archived:t,components:o,children:r}=n,i=t===void 0?!1:t;if(o){const a=o.ThreadListItem;let u;e[0]!==a?(u=()=>s.jsx(a,{}),e[0]=a,e[1]=u):u=e[1];let d;return e[2]!==i||e[3]!==u?(d=s.jsx(Ve,{archived:i,children:u}),e[2]=i,e[3]=u,e[4]=d):d=e[4],d}let c;return e[5]!==i||e[6]!==r?(c=s.jsx(Ve,{archived:i,children:r}),e[5]=i,e[6]=r,e[7]=c):c=e[7],c};ft.displayName="ThreadListPrimitive.Items";const ht=n=>{const e=B(2),{fallback:t}=n,o=A(Jn)||t;let r;return e[0]!==o?(r=s.jsx(s.Fragment,{children:o}),e[0]=o,e[1]=r):r=e[1],r};ht.displayName="ThreadListItemPrimitive.Title";function Jn(n){return n.threadListItem.title}const es=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threadListItem().archive()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={archive:o},n[2]=o,n[3]=r):r=n[3],r},ts=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threadListItem().delete()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={delete:o},n[2]=o,n[3]=r):r=n[3],r},ns=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threadListItem().unarchive()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={unarchive:o},n[2]=o,n[3]=r):r=n[3],r},ss=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threadListItem().switchTo()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={switchTo:o},n[2]=o,n[3]=r):r=n[3],r},rs=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threads().switchToNewThread()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={switchToNewThread:o},n[2]=o,n[3]=r):r=n[3],r},os=()=>{const n=B(5),e=J(),t=A(as);let o;n[0]!==e?(o=()=>{e.threads().loadMore()},n[0]=e,n[1]=o):o=n[1];const r=o;let i;return n[2]!==t||n[3]!==r?(i={loadMore:r,disabled:t},n[2]=t,n[3]=r,n[4]=i):i=n[4],i};function as(n){return!n.threads.hasMore||n.threads.isLoading||n.threads.isLoadingMore}var is=Object.defineProperty,R=(n,e)=>is(n,"name",{value:e,configurable:!0}),cs=["Enter"," "],ls=["ArrowDown","PageUp","Home"],pt=["ArrowUp","PageDown","End"],ds=[...ls,...pt],be="Menu",[Se,us,ms]=et(be),[ae,xt]=Qe(be,[ms,Ze,Je]),ke=Ze(),gt=Je(),[fs,ue]=ae(be),[hs,Be]=ae(be),ps=R(n=>{const{__scopeMenu:e,open:t=!1,children:o,dir:r,onOpenChange:i,modal:c=!0}=n,a=ke(e),[u,d]=m.useState(null),f=m.useRef(!1),l=gn(i),p=ge(r);return m.useEffect(()=>{const h=R(()=>{f.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=R(()=>f.current=!1,"handlePointer");return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),m.useEffect(()=>{if(!t)return;const h=R(()=>l(!1),"handleBlur");return window.addEventListener("blur",h),()=>window.removeEventListener("blur",h)},[t,l]),s.jsx(vn,{...a,children:s.jsx(fs,{scope:e,open:t,onOpenChange:l,content:u,onContentChange:d,children:s.jsx(hs,{scope:e,onClose:m.useCallback(()=>l(!1),[l]),isUsingKeyboardRef:f,dir:p,modal:c,children:o})})})},"Menu"),xs=m.forwardRef(R(function(e,t){const{__scopeMenu:o,...r}=e,i=ke(o);return s.jsx(bn,{...i,...r,ref:t})},"MenuAnchor")),vt="MenuPortal",[gs,vs]=ae(vt,{forceMount:void 0}),bs=R(n=>{const{__scopeMenu:e,forceMount:t,children:o,container:r}=n,i=ue(vt,e);return s.jsx(gs,{scope:e,forceMount:t,children:s.jsx(tt,{present:t||i.open,children:s.jsx(wn,{asChild:!0,container:r,children:o})})})},"MenuPortal"),se="MenuContent",[ws,bt]=ae(se),ys=m.forwardRef(R(function(e,t){const o=vs(se,e.__scopeMenu),{forceMount:r=o.forceMount,...i}=e,c=ue(se,e.__scopeMenu),a=Be(se,e.__scopeMenu);return s.jsx(Se.Provider,{scope:e.__scopeMenu,children:s.jsx(tt,{present:r||c.open,children:s.jsx(Se.Slot,{scope:e.__scopeMenu,children:a.modal?s.jsx(Is,{...i,ref:t}):s.jsx(js,{...i,ref:t})})})})},"MenuContent")),Is=m.forwardRef(R(function(e,t){const o=ue(se,e.__scopeMenu),r=m.useRef(null),i=oe(t,r);return m.useEffect(()=>{const c=r.current;if(c)return an(c)},[]),s.jsx(wt,{...e,ref:i,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:P(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentModal")),js=m.forwardRef(R(function(e,t){const o=ue(se,e.__scopeMenu);return s.jsx(wt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentNonModal")),Ms=xn("MenuContent.ScrollLock"),wt=m.forwardRef(R(function(e,t){const{__scopeMenu:o,loop:r=!1,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:a,disableOutsidePointerEvents:u,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:p,onInteractOutside:h,onDismiss:g,disableOutsideScroll:v,...y}=e,I=ue(se,o),S=Be(se,o),j=ke(o),D=gt(o),N=us(o),[U,F]=m.useState(null),G=m.useRef(null),M=oe(t,G,I.onContentChange),C=m.useRef(0),E=m.useRef(""),_=m.useRef(0),K=m.useRef(null),ee=m.useRef("right"),Q=m.useRef(0),te=v?ln:m.Fragment,Y=v?{as:Ms,allowPinchZoom:!0}:void 0,q=R(x=>{var Z,$;const b=E.current+x,L=N().filter(k=>!k.disabled),z=document.activeElement,w=(Z=L.find(k=>k.ref.current===z))==null?void 0:Z.textValue,ne=L.map(k=>k.textValue),X=St(ne,b,w),H=($=L.find(k=>k.textValue===X))==null?void 0:$.ref.current;R((function k(fe){E.current=fe,window.clearTimeout(C.current),fe!==""&&(C.current=window.setTimeout(()=>k(""),1e3))}),"updateSearch")(b),H&&setTimeout(()=>H.focus())},"handleTypeaheadSearch");m.useEffect(()=>()=>window.clearTimeout(C.current),[]),cn();const O=m.useCallback(x=>{var L,z;return ee.current===((L=K.current)==null?void 0:L.side)&&Lt(x,(z=K.current)==null?void 0:z.area)},[]);return s.jsx(ws,{scope:o,searchRef:E,onItemEnter:m.useCallback(x=>{O(x)&&x.preventDefault()},[O]),onItemLeave:m.useCallback(x=>{var b;O(x)||((b=G.current)==null||b.focus(),F(null))},[O]),onTriggerLeave:m.useCallback(x=>{O(x)&&x.preventDefault()},[O]),pointerGraceTimerRef:_,onPointerGraceIntentChange:m.useCallback(x=>{K.current=x},[]),children:s.jsx(te,{...Y,children:s.jsx(dn,{asChild:!0,trapped:i,onMountAutoFocus:P(c,x=>{var b;x.preventDefault(),(b=G.current)==null||b.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:s.jsx(un,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:p,onInteractOutside:h,onDismiss:g,children:s.jsx(mn,{asChild:!0,...D,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:U,onCurrentTabStopIdChange:F,onEntryFocus:P(d,x=>{S.isUsingKeyboardRef.current||x.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(fn,{role:"menu","aria-orientation":"vertical","data-state":yt(I.open),"data-radix-menu-content":"",dir:S.dir,...j,...y,ref:M,style:{outline:"none",...y.style},onKeyDown:P(y.onKeyDown,x=>{const L=x.target.closest("[data-radix-menu-content]")===x.currentTarget,z=x.ctrlKey||x.altKey||x.metaKey,w=x.key.length===1;L&&(x.key==="Tab"&&x.preventDefault(),!z&&w&&q(x.key));const ne=G.current;if(x.target!==ne||!ds.includes(x.key))return;x.preventDefault();const H=N().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);pt.includes(x.key)&&H.reverse(),jt(H)}),onBlur:P(e.onBlur,x=>{x.currentTarget.contains(x.target)||(window.clearTimeout(C.current),E.current="")}),onPointerMove:P(e.onPointerMove,xe(x=>{const b=x.target,L=Q.current!==x.clientX;if(x.currentTarget.contains(b)&&L){const z=x.clientX>Q.current?"right":"left";ee.current=z,Q.current=x.clientX}}))})})})})})})},"MenuContentImpl")),Ce="MenuItem",We="menu.itemSelect",Ss=m.forwardRef(R(function(e,t){const{disabled:o=!1,onSelect:r,...i}=e,c=m.useRef(null),a=Be(Ce,e.__scopeMenu),u=bt(Ce,e.__scopeMenu),d=oe(t,c),f=m.useRef(!1),l=R(()=>{const p=c.current;if(!o&&p){const h=new CustomEvent(We,{bubbles:!0,cancelable:!0});p.addEventListener(We,g=>r==null?void 0:r(g),{once:!0}),hn(p,h),h.defaultPrevented?f.current=!1:a.onClose()}},"handleSelect");return s.jsx(Cs,{...i,ref:d,disabled:o,onClick:P(e.onClick,l),onPointerDown:p=>{var h;(h=e.onPointerDown)==null||h.call(e,p),f.current=!0},onPointerUp:P(e.onPointerUp,p=>{var h;f.current||(h=p.currentTarget)==null||h.click()}),onKeyDown:P(e.onKeyDown,p=>{o||p.target!==p.currentTarget||u.searchRef.current!==""&&p.key===" "||cs.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})},"MenuItem")),Cs=m.forwardRef(R(function(e,t){const{__scopeMenu:o,disabled:r=!1,textValue:i,...c}=e,a=bt(Ce,o),u=gt(o),d=m.useRef(null),f=oe(t,d),[l,p]=m.useState(!1),[h,g]=m.useState("");return m.useEffect(()=>{const v=d.current;v&&g((v.textContent??"").trim())},[c.children]),s.jsx(Se.ItemSlot,{scope:o,disabled:r,textValue:i??h,children:s.jsx(pn,{asChild:!0,...u,focusable:!r,children:s.jsx(Te.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...c,ref:f,onPointerMove:P(e.onPointerMove,xe(v=>{r?a.onItemLeave(v):(a.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:P(e.onPointerLeave,xe(v=>a.onItemLeave(v))),onFocus:P(e.onFocus,()=>p(!0)),onBlur:P(e.onBlur,()=>p(!1))})})})},"MenuItemImpl")),Ls="MenuRadioGroup",[Fr,Kr]=ae(Ls,{value:void 0,onValueChange:R(()=>{},"onValueChange")}),Ts="MenuItemIndicator",[zr,$r]=ae(Ts,{checked:!1}),Rs=m.forwardRef(R(function(e,t){const{__scopeMenu:o,...r}=e;return s.jsx(Te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})},"MenuSeparator")),Ns="MenuSub",[Gr,Hr]=ae(Ns);function yt(n){return n?"open":"closed"}R(yt,"getOpenState");function It(n){return n==="indeterminate"}R(It,"isIndeterminate");function Ps(n){return It(n)?"indeterminate":n?"checked":"unchecked"}R(Ps,"getCheckedState");function jt(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}R(jt,"focusFirst");function Mt(n,e){return n.map((t,o)=>n[(e+o)%n.length])}R(Mt,"wrapArray");function St(n,e,t){const r=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let c=Mt(n,Math.max(i,0));r.length===1&&(c=c.filter(d=>d!==t));const u=c.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return u!==t?u:void 0}R(St,"getNextMatch");function Ct(n,e){const{x:t,y:o}=n;let r=!1;for(let i=0,c=e.length-1;i<e.length;c=i++){const a=e[i],u=e[c],d=a.x,f=a.y,l=u.x,p=u.y;f>o!=p>o&&t<(l-d)*(o-f)/(p-f)+d&&(r=!r)}return r}R(Ct,"isPointInPolygon");function Lt(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return Ct(t,e)}R(Lt,"isPointerInGraceArea");function xe(n){return e=>e.pointerType==="mouse"?n(e):void 0}R(xe,"whenMouse");var Es=ps,As=xs,Ds=bs,_s=ys,Os=Ss,ks=Rs,Bs=Object.defineProperty,ce=(n,e)=>Bs(n,"name",{value:e,configurable:!0}),Fe="DropdownMenu",[Fs,Tt]=Qe(Fe,[xt]),le=xt(),[Ks,Rt]=Fs(Fe),Nt=ce(n=>{const{__scopeDropdownMenu:e,children:t,dir:o,open:r,defaultOpen:i,onOpenChange:c,modal:a=!0}=n,u=le(e),d=m.useRef(null),[f,l]=nt({prop:r,defaultProp:i??!1,onChange:c,caller:Fe});return s.jsx(Ks,{scope:e,triggerId:ze(),triggerRef:d,contentId:ze(),open:f,onOpenChange:l,onOpenToggle:m.useCallback(()=>l(p=>!p),[l]),modal:a,children:s.jsx(Es,{...u,open:f,onOpenChange:l,dir:o,modal:a,children:t})})},"DropdownMenu"),zs="DropdownMenuTrigger",Pt=m.forwardRef(ce(function(e,t){const{__scopeDropdownMenu:o,disabled:r=!1,...i}=e,c=Rt(zs,o),a=le(o),u=oe(t,c.triggerRef);return s.jsx(As,{asChild:!0,...a,children:s.jsx(Te.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:u,onPointerDown:P(e.onPointerDown,d=>{!r&&d.button===0&&d.ctrlKey===!1&&(c.onOpenToggle(),c.open||d.preventDefault())}),onKeyDown:P(e.onKeyDown,d=>{r||(["Enter"," "].includes(d.key)&&c.onOpenToggle(),d.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})},"DropdownMenuTrigger")),Et=ce(n=>{const{__scopeDropdownMenu:e,...t}=n,o=le(e);return s.jsx(Ds,{...o,...t})},"DropdownMenuPortal"),$s="DropdownMenuContent",At=m.forwardRef(ce(function(e,t){const{__scopeDropdownMenu:o,...r}=e,i=Rt($s,o),c=le(o),a=m.useRef(!1);return s.jsx(_s,{id:i.contentId,"aria-labelledby":i.triggerId,...c,...r,ref:t,onCloseAutoFocus:P(e.onCloseAutoFocus,u=>{var d;a.current||(d=i.triggerRef.current)==null||d.focus(),a.current=!1,u.preventDefault()}),onInteractOutside:P(e.onInteractOutside,u=>{const d=u.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,l=d.button===2||f;(!i.modal||l)&&(a.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")),Dt=m.forwardRef(ce(function(e,t){const{__scopeDropdownMenu:o,...r}=e,i=le(o);return s.jsx(Os,{...i,...r,ref:t})},"DropdownMenuItem")),_t=m.forwardRef(ce(function(e,t){const{__scopeDropdownMenu:o,...r}=e,i=le(o);return s.jsx(ks,{...i,...r,ref:t})},"DropdownMenuSeparator")),Ot=Nt,kt=Pt,Gs=Et,Bt=At,Ft=Dt,Kt=_t;const Hs=Object.freeze(Object.defineProperty({__proto__:null,Content:Bt,DropdownMenu:Nt,DropdownMenuContent:At,DropdownMenuItem:Dt,DropdownMenuPortal:Et,DropdownMenuSeparator:_t,DropdownMenuTrigger:Pt,Item:Ft,Portal:Gs,Root:Ot,Separator:Kt,Trigger:kt,createDropdownMenuScope:Tt},Symbol.toStringTag,{value:"Module"})),Us=ve(kt),Vs=ve(Bt),Ws=ve(Ft),Xs=ve(Kt),zt=m.forwardRef((n,e)=>{const t=B(15);let o,r,i;t[0]!==n?({onClick:r,disabled:o,...i}=n,t[0]=n,t[1]=o,t[2]=r,t[3]=i):(o=t[1],r=t[2],i=t[3]);const c=A(Ys),{switchToNewThread:a}=rs();let u;t[4]!==c?(u=c?{"data-active":"true","aria-current":"true"}:null,t[4]=c,t[5]=u):u=t[5];let d;t[6]!==r||t[7]!==a?(d=P(r,a),t[6]=r,t[7]=a,t[8]=d):d=t[8];let f;return t[9]!==o||t[10]!==e||t[11]!==i||t[12]!==u||t[13]!==d?(f=s.jsx(Re.button,{type:"button",...u,...i,ref:e,disabled:o,onClick:d}),t[9]=o,t[10]=e,t[11]=i,t[12]=u,t[13]=d,t[14]=f):f=t[14],f});zt.displayName="ThreadListPrimitive.New";function Ys(n){return n.threads.newThreadId===n.threads.mainThreadId}const qs=()=>{const{loadMore:n,disabled:e}=os();return e?null:n},Qs=de("ThreadListPrimitive.LoadMore",qs),[Zs,Js]=et("ThreadList"),Le=Zs,$t=Pe(null),er=$t.Provider,Ke=()=>Ne($t),Gt=m.forwardRef((n,e)=>{const t=B(3);let o;return t[0]!==n||t[1]!==e?(o=s.jsx(Le.Provider,{scope:void 0,children:s.jsx(Le.Slot,{scope:void 0,children:s.jsx(Re.div,{...n,ref:e})})}),t[0]=n,t[1]=e,t[2]=o):o=t[2],o});Gt.displayName="ThreadListPrimitive.Root";var tr=Ee({ItemByIndex:()=>mt,Items:()=>ft,LoadMore:()=>Qs,New:()=>zt,Root:()=>Gt});const Ht=m.forwardRef((n,e)=>{const t=A(d=>d.threads.mainThreadId===d.threadListItem.id),o=$e(null),r=$e(null),i=qe(()=>({triggerRef:o,moreRef:r}),[]),c=Js(void 0),a=ge(),u=d=>{const f=a==="rtl"?"ArrowLeft":"ArrowRight",l=a==="rtl"?"ArrowRight":"ArrowLeft",p=o.current,h=r.current;if(p&&d.target===p)if(d.key==="ArrowDown"||d.key==="ArrowUp"){const g=c().map(y=>y.ref.current).filter(y=>y!==null),v=g[g.indexOf(p)+(d.key==="ArrowDown"?1:-1)];v&&(v.focus(),d.preventDefault())}else d.key===f&&h&&(h.focus(),d.preventDefault());else h&&d.target===h&&d.key===l&&(p==null||p.focus(),d.preventDefault())};return s.jsx(er,{value:i,children:s.jsx(Re.div,{...t?{"data-active":"true","aria-current":"true"}:null,...n,onKeyDown:P(n.onKeyDown,u),ref:e})})});Ht.displayName="ThreadListItemPrimitive.Root";const nr=()=>{const{archive:n}=es();return n},sr=de("ThreadListItemPrimitive.Archive",nr),rr=()=>{const{unarchive:n}=ns();return n},or=de("ThreadListItemPrimitive.Unarchive",rr),ar=()=>{const{delete:n}=ts();return n},ir=de("ThreadListItemPrimitive.Delete",ar),cr=()=>{const{switchTo:n}=ss();return n},lr=de("ThreadListItemPrimitive.Trigger",cr),Ut=m.forwardRef((n,e)=>{var i;const t=B(3),o=oe(e,(i=Ke())==null?void 0:i.triggerRef);let r;return t[0]!==n||t[1]!==o?(r=s.jsx(Le.ItemSlot,{scope:void 0,children:s.jsx(lr,{...n,ref:o})}),t[0]=n,t[1]=o,t[2]=r):r=t[2],r});Ut.displayName="ThreadListItemPrimitive.Trigger";var dr=Ee({Archive:()=>sr,Delete:()=>ir,Root:()=>Ht,Title:()=>ht,Trigger:()=>Ut,Unarchive:()=>or});const me=Tt(),Vt=Pe(()=>{}),Wt=()=>Ne(Vt),Xt=Pe(!1),Yt=()=>Ne(Xt),qt=n=>{const e=B(26);let t,o,r,i,c,a,u;e[0]!==n?({__scopeThreadListItemMore:t,open:c,defaultOpen:o,onOpenChange:i,sharedFocusGroup:u,modal:r,...a}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i,e[5]=c,e[6]=a,e[7]=u):(t=e[1],o=e[2],r=e[3],i=e[4],c=e[5],a=e[6],u=e[7]);const d=u===void 0?!1:u,f=d?!1:r??!0,l=me(t),p=o??!1;let h;e[8]!==i?(h=i?{onChange:i}:{},e[8]=i,e[9]=h):h=e[9];let g;e[10]!==c||e[11]!==p||e[12]!==h?(g={prop:c,defaultProp:p,caller:"ThreadListItemMorePrimitive.Root",...h},e[10]=c,e[11]=p,e[12]=h,e[13]=g):g=e[13];const[v,y]=nt(g);let I;e[14]!==f||e[15]!==v||e[16]!==a||e[17]!==l||e[18]!==y?(I=s.jsx(Ot,{...l,...a,modal:f,open:v,onOpenChange:y}),e[14]=f,e[15]=v,e[16]=a,e[17]=l,e[18]=y,e[19]=I):I=e[19];let S;e[20]!==y||e[21]!==I?(S=s.jsx(Vt.Provider,{value:y,children:I}),e[20]=y,e[21]=I,e[22]=S):S=e[22];let j;return e[23]!==d||e[24]!==S?(j=s.jsx(Xt.Provider,{value:d,children:S}),e[23]=d,e[24]=S,e[25]=j):j=e[25],j};qt.displayName="ThreadListItemMorePrimitive.Root";const Qt=m.forwardRef((n,e)=>{const t=B(10),{__scopeThreadListItemMore:o,...r}=n,i=me(o),c=Ke(),a=Wt(),u=Yt(),d=oe(e,c==null?void 0:c.moreRef),f=ge()==="rtl"?"ArrowLeft":"ArrowRight",l=Us;let p;t[0]!==f||t[1]!==a||t[2]!==u?(p=v=>{!u||v.key!==f||(v.preventDefault(),a(!0))},t[0]=f,t[1]=a,t[2]=u,t[3]=p):p=t[3];const h=P(r.onKeyDown,p);let g;return t[4]!==l||t[5]!==d||t[6]!==r||t[7]!==i||t[8]!==h?(g=s.jsx(l,{...i,...r,onKeyDown:h,ref:d}),t[4]=l,t[5]=d,t[6]=r,t[7]=i,t[8]=h,t[9]=g):g=t[9],g});Qt.displayName="ThreadListItemMorePrimitive.Trigger";const Zt=m.forwardRef((n,e)=>{const t=B(21),{__scopeThreadListItemMore:o,portalProps:r,sideOffset:i,...c}=n,a=i===void 0?4:i,u=me(o),d=Wt(),f=Ke(),l=Yt(),p=ge()==="rtl"?"ArrowRight":"ArrowLeft",h=Hs,g=Vs;let v;t[0]!==p||t[1]!==(f==null?void 0:f.moreRef)||t[2]!==d||t[3]!==l?(v=N=>{var U;!l||N.key!==p||(N.preventDefault(),d(!1),(U=f==null?void 0:f.moreRef.current)==null||U.focus())},t[0]=p,t[1]=f==null?void 0:f.moreRef,t[2]=d,t[3]=l,t[4]=v):v=t[4];const y=P(c.onKeyDown,v);let I;t[5]!==(f==null?void 0:f.moreRef)||t[6]!==l?(I=()=>{var N;l&&((N=f==null?void 0:f.moreRef.current)==null||N.focus())},t[5]=f==null?void 0:f.moreRef,t[6]=l,t[7]=I):I=t[7];const S=P(c.onEscapeKeyDown,I);let j;t[8]!==g||t[9]!==e||t[10]!==c||t[11]!==u||t[12]!==a||t[13]!==y||t[14]!==S?(j=s.jsx(g,{...u,...c,onKeyDown:y,onEscapeKeyDown:S,ref:e,sideOffset:a}),t[8]=g,t[9]=e,t[10]=c,t[11]=u,t[12]=a,t[13]=y,t[14]=S,t[15]=j):j=t[15];let D;return t[16]!==r||t[17]!==u||t[18]!==h.Portal||t[19]!==j?(D=s.jsx(h.Portal,{...u,...r,children:j}),t[16]=r,t[17]=u,t[18]=h.Portal,t[19]=j,t[20]=D):D=t[20],D});Zt.displayName="ThreadListItemMorePrimitive.Content";const Jt=m.forwardRef((n,e)=>{const t=B(7);let o,r;t[0]!==n?({__scopeThreadListItemMore:o,...r}=n,t[0]=n,t[1]=o,t[2]=r):(o=t[1],r=t[2]);const i=me(o);let c;return t[3]!==e||t[4]!==r||t[5]!==i?(c=s.jsx(Ws,{...i,...r,ref:e}),t[3]=e,t[4]=r,t[5]=i,t[6]=c):c=t[6],c});Jt.displayName="ThreadListItemMorePrimitive.Item";const en=m.forwardRef((n,e)=>{const t=B(7);let o,r;t[0]!==n?({__scopeThreadListItemMore:o,...r}=n,t[0]=n,t[1]=o,t[2]=r):(o=t[1],r=t[2]);const i=me(o);let c;return t[3]!==e||t[4]!==r||t[5]!==i?(c=s.jsx(Xs,{...i,...r,ref:e}),t[3]=e,t[4]=r,t[5]=i,t[6]=c):c=t[6],c});en.displayName="ThreadListItemMorePrimitive.Separator";var Ie=Ee({Content:()=>Zt,Item:()=>Jt,Root:()=>qt,Separator:()=>en,Trigger:()=>Qt});function ur(){const n=ie(),e=Ae(),t=De(),o=at(),r=t||o,[i,c]=m.useState(!1),[a,u]=m.useState(""),[d,f]=m.useState(null),l=m.useRef(null),p=m.useRef(null),h=m.useId(),g=(n==null?void 0:n.isLibraryEnabled)===!0&&e!=null,v=(n==null?void 0:n.historyAgentFilter)??null;m.useEffect(()=>{i||u("")},[i]);const{agents:y,isInitialLoading:I,isSearching:S,loadingMore:j,hasMore:D,listRef:N,sentinelRef:U}=Pn({enabled:i&&g,query:a});if(m.useLayoutEffect(()=>{if(!i||r){f(null);return}const M=()=>{var E;const C=(E=l.current)==null?void 0:E.getBoundingClientRect();C&&f({top:C.top,left:C.right+4})};return M(),window.addEventListener("resize",M),window.addEventListener("scroll",M,!0),()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0)}},[i,r]),m.useEffect(()=>{if(!i||r)return;const M=C=>{var _,K;const E=C.target;(_=l.current)!=null&&_.contains(E)||(K=p.current)!=null&&K.contains(E)||c(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[i,r]),!g)return null;const F=M=>{(n==null?void 0:n.isComposerEnabled)===!0?n.openDraft():n==null||n.openLibraryHome(),n==null||n.setHistoryAgentFilter(M),c(!1)},G=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"p-1",onMouseDown:M=>M.stopPropagation(),children:[s.jsx(En,{query:a,setQuery:u,placeholder:"Search agents"}),S?s.jsx("p",{className:"text-text-secondary px-1 pt-1 text-[11px]",role:"status",children:"Searching…"}):null]}),s.jsxs("div",{ref:N,className:W("mt-1 overflow-y-auto",r?"min-h-0 flex-1 px-1 pb-2":"min-h-48 max-h-64"),children:[a.trim()===""?s.jsxs(Ge,{className:W("justify-between",v==null&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>F(null),children:["All chats",v==null?s.jsx(V,{name:"check",className:"size-3.5 shrink-0"}):null]}):null,I?s.jsx("p",{className:"px-2 py-3 text-center text-xs text-text-secondary",children:"Loading…"}):y.length===0?s.jsx("p",{className:"text-text-secondary px-2 py-6 text-center text-xs",role:"status",children:a.trim()?`No agents match "${a.trim()}".`:"No agents yet."}):s.jsxs(s.Fragment,{children:[y.map(M=>{const C=An(M),E=(v==null?void 0:v.agentId)===C;return s.jsxs(Ge,{className:W("justify-between gap-2 text-left",E&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>F({agentId:C,agentName:M.name,intent:"history"}),children:[s.jsx("span",{className:"min-w-0 truncate",children:M.name}),E?s.jsx(V,{name:"check",className:"size-3.5 shrink-0"}):null]},C)}),D?s.jsx("div",{ref:U,className:"flex h-6 shrink-0 items-center justify-center","aria-hidden":!0,children:j?s.jsx("span",{className:"text-text-secondary text-[11px]",role:"status",children:"Loading more…"}):null}):null]})]})]});return s.jsxs("div",{className:"relative shrink-0",children:[s.jsxs("button",{ref:l,type:"button","aria-label":v!=null?`Filter chat history by agent (${v.agentName})`:"Filter chat history by agent","aria-haspopup":r?"dialog":"menu","aria-expanded":i,"aria-controls":i?h:void 0,title:"Filter by agent",className:re({variant:"ghost",size:"icon",className:W("relative size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text",v!=null&&"text-text-primary")}),onClick:()=>c(M=>!M),children:[s.jsx(V,{name:"funnel",className:"size-3.5"}),v!=null?s.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]}),r&&i?s.jsx(it,{open:!0,onOpenChange:c,id:h,"aria-label":"Filter agents",children:s.jsx("div",{className:"flex min-h-0 flex-1 flex-col p-2",role:"menu",children:G})}):null,!r&&i&&d!=null?Dn.createPortal(s.jsx("div",{ref:p,id:h,role:"menu","aria-label":"Filter agents",style:{top:d.top,left:d.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:G}),_n(l.current)):null]})}function mr({open:n,initialTitle:e,saving:t=!1,onOpenChange:o,onSave:r}){const[i,c]=m.useState(e),a=m.useRef(null);m.useEffect(()=>{n&&c(e)},[n,e]),m.useEffect(()=>{if(!n)return;const h=a.current;h!=null&&(h.focus(),h.select())},[n]);const u=i.trim(),f=u.length>0&&u.length<=He&&!t,l=()=>{f&&r(u)},p=h=>{t||o(h)};return s.jsx(kn,{open:n,onOpenChange:p,title:"Rename session",contentSized:!0,"aria-label":"Rename session",footer:s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(Ue.Secondary,{type:"button",disabled:t,onClick:()=>p(!1),children:"Cancel"}),s.jsx(Ue.Primary,{type:"button",disabled:!f,onClick:l,children:"Save"})]}),children:s.jsx("div",{className:"px-5 py-4",children:s.jsx("input",{ref:a,"aria-label":"Session title",value:i,readOnly:t,maxLength:He,className:Bn("h-9"),onChange:h=>c(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),l())}})})})}var fr="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",hr="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 pr({canRename:n,renameDisabled:e,canDelete:t,deleteDisabled:o,onRename:r,onDelete:i}){const c=T("PermissionGuard"),a=at(),u=De(),[d,f]=m.useState(!1),[l,p]=m.useState(),h=u||a,g=m.useCallback(S=>{const j=S==null?void 0:S.closest(".aui-theme-root");p(j instanceof HTMLElement?j:void 0)},[]),v=re({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-text-secondary hover:bg-transparent hover:text-text-primary"}),y=n?s.jsx(c,{allowed:!e,children:s.jsxs("button",{type:"button",className:fr,disabled:e,onClick:()=>{e||(f(!1),r())},children:[s.jsx(V,{name:"pencil",className:"size-3.5"}),"Rename"]})}):null,I=t?s.jsx(c,{allowed:!o,children:s.jsxs("button",{type:"button",className:hr,disabled:o,onClick:()=>{o||(f(!1),i())},children:[s.jsx(V,{name:"trash",className:"size-3.5"}),"Delete"]})}):null;return h?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":"Session actions",title:"Session actions","aria-haspopup":"dialog","aria-expanded":d,className:v,onClick:()=>f(!0),children:s.jsx(V,{name:"ellipsis",className:"size-3.5"})}),d?s.jsx(it,{open:!0,onOpenChange:f,"aria-label":"Session actions",children:s.jsxs("div",{className:"flex flex-col gap-1 p-2 *:w-full",role:"menu",children:[y,I]})}):null]}):s.jsxs(Ie.Root,{sharedFocusGroup:!0,children:[s.jsx(Ie.Trigger,{ref:g,"aria-label":"Session actions",title:"Session actions",className:v,children:s.jsx(V,{name:"ellipsis",className:"size-3.5"})}),s.jsxs(Ie.Content,{portalProps:{container:l},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:[y,I]})]})}function xr({selectionRef:n,onThreadOpen:e,canRenameSession:t,canDeleteSession:o,canManageResource:r,canDeleteResource:i}){const c=J(),a=ie(),u=Ae(),d=m.useRef(a==null?void 0:a.runtimeKey);d.current=a==null?void 0:a.runtimeKey;const f=st(),l=Ln(),p=T("ThreadListRow"),h=A(b=>b.threadListItem.id),g=A(b=>b.threadListItem.remoteId),v=A(b=>b.threadListItem.title),y=A(b=>b.threadListItem.lastMessageAt),I=A(b=>b.threadListItem.custom),S=A(b=>b.threads.mainThreadId),j=Tn(I),D=Me(I),N=Rn(y,rt(I)),U=t&&g!=null,F=o&&g!=null,G=U||F,M=g!=null&&!r(g),C=g!=null&&!i(g),E=(a==null?void 0:a.libraryOpen)===!0||(a==null?void 0:a.sessionsOpen)===!0||(a==null?void 0:a.schedulesOpen)===!0||(a==null?void 0:a.environmentsOpen)===!0,[_,K]=m.useState(!1),[ee,Q]=m.useState(!1),[te,Y]=m.useState(!1),q=v??"New Chat",O=async b=>{if(b===(v??"").trim()){K(!1);return}Q(!0);try{await c.threadListItem().rename(b),f(he.Session.RENAMED,pe(void 0,{sessionId:g,agentName:j})),K(!1)}catch(L){l==null||l.showError(L)}finally{Q(!1)}},x=({sessionMutable:b,rowAgentName:L})=>{const z=!b&&(a==null?void 0:a.mode.status)==="active"&&!a.mode.isMutable&&(L==null?a.mode.agentName==null&&a.mode.agentId==null:a.mode.agentName===L||a.mode.agentId===L),w=On({sessionMutable:b,shellMutable:(a==null?void 0:a.mode.status)==="active"&&a.mode.isMutable,...(a==null?void 0:a.mode.status)==="active"&&a.mode.isMutable?{shellAgentName:a.mode.agentName,shellAgentId:a.mode.agentId}:{},remoteId:g,pendingSessionId:a==null?void 0:a.pendingSessionId});if((z||w)&&g!=null&&(a==null?void 0:a.sessionAccessError)==null){Promise.resolve(c.threads().switchToThread(h)).catch(()=>{});return}if(g!=null){a==null||a.openHistorySession({sessionId:g,isMutable:b,...L!=null?{agentName:L}:{}});return}Promise.resolve(c.threads().switchToThread(h)).catch(()=>{})};return s.jsxs(dr.Root,{className:"min-w-0",children:[s.jsx(p,{title:q,active:h===S&&!E,agentName:j,...D==null?{}:{lastTurnStatus:D},...N==null?{}:{lastMessageAt:N},onSelect:()=>{f(he.Session.SELECTED,pe({is_mutable:we(I)},{sessionId:g,agentName:j}));const b=++n.current,L=a==null?void 0:a.runtimeKey;if(e==null||e(),a==null||a.setSettingsOpen(!1),a==null||a.setLibraryOpen(!1),a==null||a.setSessionsOpen(!1),a==null||a.setSchedulesOpen(!1),a==null||a.setEnvironmentsOpen(!1),g!=null&&u!=null&&Nn(I)===void 0&&j==null){u.getSession({sessionId:g}).then(z=>({sessionMutable:z.isMutable,rowAgentName:z.agentName??void 0}),()=>({sessionMutable:we(I),rowAgentName:j})).then(z=>{n.current===b&&d.current===L&&x(z)});return}x({sessionMutable:we(I),rowAgentName:j})},actions:G?s.jsx(pr,{canRename:U,renameDisabled:M,canDelete:F,deleteDisabled:C,onRename:()=>K(!0),onDelete:()=>Y(!0)}):void 0}),te?s.jsx(Yn,{title:"Delete chat",description:`“${q}” will be permanently deleted. This cannot be undone.`,confirmLabel:"Delete",onCancel:()=>Y(!1),onConfirm:()=>{Y(!1),Promise.resolve(c.threadListItem().delete()).then(()=>{f(he.Session.DELETED,pe(void 0,{sessionId:g,agentName:j}))},b=>{l==null||l.showError(b)})}}):null,s.jsx(mr,{open:_,initialTitle:v??"",saving:ee,onOpenChange:K,onSave:b=>{O(b)}})]})}function gr(n){const e=A(o=>o.threads.threadIds),t=A(o=>o.threads.threadItems);return m.useMemo(()=>{const o=Cn({threadIds:e,threadItems:t});if(n==="default")return o;const r=new Map;for(const i of t)r.set(i.id,i),i.remoteId!=null&&r.set(i.remoteId,i);return o.filter(i=>{const c=e[i];if(c===void 0)return!1;const a=r.get(c);return(a==null?void 0:a.remoteId)!=null})},[e,t,n])}function vr(n){return n==="recent-history"||n==="mobile-drawer"}function br({selectionRef:n,indices:e,onThreadOpen:t,canRenameSession:o,canDeleteSession:r,canManageResource:i,canDeleteResource:c}){const a=A(u=>u.threads.threadIds);return s.jsx(s.Fragment,{children:e.map(u=>{const d=a[u]??String(u);return s.jsx(Oe,{index:u,archived:!1,children:s.jsx(xr,{selectionRef:n,onThreadOpen:t,canRenameSession:o,canDeleteSession:r,canManageResource:i,canDeleteResource:c})},d)})})}var wr="aui_thread-list-viewport",yr=80;function Ir({children:n,viewportRef:e,hideScrollbar:t,onCollapse:o}){var d;const r=ie(),i=A(f=>f.threadListItem.remoteId),c=(d=r==null?void 0:r.historyAgentFilter)==null?void 0:d.intent,a=(r==null?void 0:r.isLibraryEnabled)===!0&&c!=="try-agent"&&(c==="history"||r.mode.status!=="active"||r.mode.isMutable||r.pendingSessionId!=null||i!=null),u=(r==null?void 0:r.historyAgentFilter)==null?"Chat History":`Chats for ${r.historyAgentFilter.agentName}`;return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-1 py-1",children:[s.jsx("h2",{className:"min-w-0 flex-1 truncate px-1.5 py-1 text-sm font-medium text-text-secondary",children:u}),a?s.jsx(ur,{}):null,o!=null?s.jsx(ot,{content:"Close chat history",side:"right",children:s.jsx("button",{type:"button","aria-label":"Close chat history","aria-expanded":!0,className:re({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text"}),onClick:o,children:s.jsx(V,{name:"panel-left-close",className:"size-3.5"})})}):null]}),s.jsx("div",{ref:e,"data-slot":wr,className:W("flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",t&&"aui-scrollbar-hidden"),children:n})]})}function tn({onThreadOpen:n,onCollapseRecentHistory:e,variant:t="default"}={}){const o=J(),r=Ae(),i=st(),c=A(w=>w.threads.isLoading),a=A(w=>w.threads.isLoadingMore),u=A(w=>w.threads.hasMore),d=A(w=>w.threads.threadIds),f=A(w=>w.threads.threadItems),l=ie(),p=T("ThreadListShell"),h=T("ThreadListNewButton"),g=T("AgentsLibraryButton"),v=T("SessionsBrowserButton"),y=T("SchedulesButton"),I=T("EnvironmentsButton"),S=T("ThreadListRowSkeleton"),j=T("ThreadListEmptyState"),D=gr(t),N=m.useRef(null),U=m.useRef(u),F=m.useRef(o),G=m.useRef(0),M=yn(),C=m.useRef(M);U.current=u,F.current=o,C.current=M;const E=(l==null?void 0:l.isNewChatEnabled)!==!1,_=(l==null?void 0:l.mode.status)==="idle",K=vr(t),ee=t==="mobile-drawer",Q=typeof(r==null?void 0:r.renameSession)=="function",te=typeof(r==null?void 0:r.deleteSession)=="function",Y=m.useMemo(()=>f.flatMap(w=>w.remoteId==null?[]:[w.remoteId]),[f]),{allows:q}=In({resourceType:"session",resourceIds:Y}),O=m.useMemo(()=>_||c||r==null?null:qn(f.map(w=>Me(w.custom))),[_,c,r,f]),x=l==null?void 0:l.listSessionsAgentId;Qn({intervalMs:O,poll:m.useCallback(async()=>{if(r==null)return;const w=C.current;try{const ne=await r.listSessions({createdByMe:!0,limit:Zn,startTimestamp:jn(),...x==null||x.length===0?{}:{agentId:x}}),X=new Map(ne.data.map($=>{var k;return[$.id,{status:(k=$.lastTurnDetails)==null?void 0:k.state.status,updatedAt:$.updatedAt}]})),H=F.current.threads().getState(),Z=H.mainThreadId;for(const $ of H.threadItems){if($.id===Z&&(w||C.current)||$.remoteId==null||!X.has($.remoteId))continue;const k=X.get($.remoteId);if(k==null)continue;const fe=Me($.custom),nn=rt($.custom)??$.lastMessageAt;k.status===fe&&!Mn(k.updatedAt,nn)||F.current.threads().item({id:$.id}).updateCustom(Sn($.custom,k.status??null,k.updatedAt))}}catch{}},[x,r])}),m.useEffect(()=>{if(_||c||a)return;const w=N.current;if(!w)return;let ne=!1;const X=()=>{if(ne||!U.current||w.clientHeight<=0)return;const Z=w.scrollHeight-w.scrollTop-w.clientHeight;w.scrollHeight>w.clientHeight&&Z>yr||F.current.threads().loadMore()};w.addEventListener("scroll",X,{passive:!0});const H=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>X());return H?H.observe(w):window.addEventListener("resize",X),X(),()=>{ne=!0,w.removeEventListener("scroll",X),H==null||H.disconnect(),H||window.removeEventListener("resize",X)}},[u,_,c,a,d.length]);const b=()=>{if(i(he.Session.NEW,pe({is_composer_enabled:(l==null?void 0:l.isComposerEnabled)===!0},{...(l==null?void 0:l.mode.status)==="active"?{agentId:l.mode.agentId,agentName:l.mode.agentName}:{}})),n==null||n(),l==null||l.setLibraryOpen(!1),l==null||l.setSessionsOpen(!1),l!=null&&l.isComposerEnabled){l.openDraft();return}l==null||l.setSettingsOpen(!1),l==null||l.setSchedulesOpen(!1),l==null||l.setEnvironmentsOpen(!1),Promise.resolve(o.threads().switchToNewThread()).catch(()=>{})};let L;_?L=s.jsx(j,{message:K?"No recent chats":void 0}):c?L=s.jsx(S,{}):D.length===0?L=s.jsx(j,{message:K?"No recent chats":void 0}):L=s.jsx(tr.Root,{className:"flex min-h-0 flex-col gap-0.5",children:s.jsx(br,{selectionRef:G,indices:D,onThreadOpen:n,canRenameSession:Q,canDeleteSession:te,canManageResource:w=>q(w,"MANAGE"),canDeleteResource:w=>q(w,"DELETE")})});const z=t==="recent-history"?null:s.jsxs("div",{className:"flex flex-col gap-1",children:[E?s.jsx(h,{onClick:b}):null,s.jsx("div",{className:"contents",onClick:()=>{ee&&(n==null||n())},children:s.jsx(g,{})}),ee?null:s.jsxs(s.Fragment,{children:[s.jsx(v,{}),s.jsx(y,{}),s.jsx(I,{})]})]});return s.jsx(p,{header:z,children:s.jsxs(Ir,{viewportRef:N,hideScrollbar:K,onCollapse:t==="recent-history"?e:void 0,children:[L,!_&&u?s.jsx("div",{className:"h-4 shrink-0","aria-hidden":!0}):null]})})}var jr=m.lazy(()=>_e(()=>import("./SettingsBuilder-6WNST3GI-CQudqTjg.js"),__vite__mapDeps([0,1,2]),import.meta.url)),Mr=m.lazy(()=>_e(()=>import("./SchedulesPage-OVDMYD6Q-DWmVgOrq.js"),__vite__mapDeps([3,4,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),Sr=m.lazy(()=>_e(()=>import("./EnvironmentsPage-BUA2EGXE-Dt-L2w8t.js"),__vite__mapDeps([5,6,1,2,4]),import.meta.url).then(n=>({default:n.EnvironmentsPage}))),Cr="h-5 w-5 max-w-40 shrink-0 object-contain",Lr="h-5 max-w-40 shrink-0 object-contain",Tr="w-20",Rr="w-80",je="aui-recent-chat-history",Xe=W(Un,"text-sidebar-text"),Ye="bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";function Nr({overlayOpen:n,mode:e}){return!n&&(e==null?void 0:e.status)==="active"&&!e.isCreateAgent}function Pr({collapsed:n,onCollapsedChange:e}){return Gn().presentation==="full"?null:n?s.jsx("aside",{id:je,"aria-label":"Recent chats",className:"hidden min-h-0 w-12 shrink-0 flex-col border-r border-border bg-sidebar-bg md:flex",children:s.jsx("div",{className:"flex w-full items-start justify-center p-2",children:s.jsx(ot,{content:"Open chat history",side:"right",children:s.jsx("button",{type:"button","aria-label":"Open chat history","aria-controls":je,"aria-expanded":!1,className:re({variant:"ghost",size:"icon",className:"size-7 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text"}),onClick:()=>e(!1),children:s.jsx(V,{name:"panel-left-open",className:"size-3.5"})})})})}):s.jsx("aside",{id:je,"aria-label":"Recent chats",className:"hidden min-h-0 w-64 shrink-0 border-r border-border bg-sidebar-bg md:flex",children:s.jsx(tn,{variant:"recent-history",onCollapseRecentHistory:()=>e(!0)})})}function Er(){var h;const n=J(),e=ie(),t=T("AgentsLibraryButton"),o=T("SessionsBrowserButton"),r=T("SchedulesButton"),i=T("EnvironmentsButton"),c=(e==null?void 0:e.isNewChatEnabled)!==!1,a=(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,u=e==null?void 0:e.mode,d=!a&&(u==null?void 0:u.status)==="active"&&!u.isCreateAgent&&((h=e==null?void 0:e.historyAgentFilter)==null?void 0:h.intent)!=="try-agent",f=!a&&u!=null&&ct(u),l=()=>{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(()=>{})},p=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return s.jsxs("nav",{className:"flex min-h-0 flex-1 flex-col items-center gap-1 p-1","aria-label":"Sidebar",children:[c?s.jsxs("button",{type:"button","aria-label":"Start new chat",title:"New chat","aria-current":d?"page":void 0,className:re({variant:"ghost",className:W(Xe,d&&Ye)}),onClick:l,children:[s.jsx(V,{name:"square-pen",size:14}),s.jsx("span",{className:"text-center",children:"New Chat"})]}):null,c&&(e!=null&&e.isComposerEnabled)?s.jsxs("button",{type:"button","aria-label":"Start new agent",title:"New Agent","aria-current":f?"page":void 0,className:re({variant:"ghost",className:W(Xe,f&&Ye)}),onClick:p,children:[s.jsx(V,{name:"agent-2",size:14}),s.jsx("span",{className:"text-center whitespace-nowrap",children:"Build Agent"})]}):null,s.jsx(t,{compact:!0}),s.jsx(o,{compact:!0}),s.jsx(r,{compact:!0}),s.jsx(i,{compact:!0})]})}function Ar({className:n,railRef:e,...t}){const o=lt(),r=dt(o),i=T("BrandLogo"),c=T("UserAvatar");return s.jsxs("aside",{ref:e,className:W(Tr,"flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar-bg",n),...t,children:[s.jsx("div",{className:"flex h-14 w-full shrink-0 items-center justify-center text-text-primary",children:s.jsx(i,{variant:r.collapsedVariant,className:Cr})}),s.jsx(Er,{}),s.jsxs("footer",{className:"flex shrink-0 flex-col items-center border-border p-2",children:[s.jsx(ut,{labeled:!0,className:"flex-col"}),s.jsx(c,{labeled:!0,className:"mt-2 py-1.5"})]})]})}function Dr({drawerRef:n,onClose:e}){const t=lt(),o=dt(t),r=Hn(),i=T("BrandLogo"),c=T("UserAvatar");return s.jsxs("aside",{ref:n,role:"dialog","aria-label":"Navigation",tabIndex:-1,className:W(Rr,"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:[s.jsxs("div",{className:"flex h-14 w-full shrink-0 items-center gap-2 border-b border-border px-3 text-text-primary",children:[s.jsx(i,{variant:o.expandedVariant,className:Lr}),o.showTitle&&r!=null?s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:r}):s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx("button",{type:"button","aria-label":"Close navigation",className:re({variant:"ghost",size:"icon"}),onClick:e,children:s.jsx(V,{name:"xmark"})})]}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(tn,{variant:"mobile-drawer",onThreadOpen:e})}),s.jsxs("footer",{className:"flex shrink-0 items-center justify-around gap-1 border-t border-border p-2 text-sidebar-text",children:[s.jsx(ut,{labeled:!0,onAction:e,className:"contents"}),s.jsx(c,{labeled:!0})]})]})}function Ur({className:n}){const e=ie(),t=De(),o=T("AgentDetailsPage"),r=T("AgentsLibrary"),i=T("SessionsPage"),c=T("ShareChatButton"),a=T("ResetAgentBuilderButton"),u=T("ClearChatButton"),d=T("SaveAgentButton"),f=T("SelectAgentEmptyState"),[l,p]=m.useState(!1),[h,g]=m.useState(!1),v=m.useRef(null),y=m.useRef(null),I=m.useRef(null),S=m.useRef(!1),j=(e==null?void 0:e.mode.status)==="idle",D=(e==null?void 0:e.settingsOpen)===!0,N=(e==null?void 0:e.libraryOpen)===!0,U=N&&(e==null?void 0:e.libraryAgentId)==null,F=(e==null?void 0:e.sessionsOpen)===!0,G=(e==null?void 0:e.schedulesOpen)===!0,M=(e==null?void 0:e.environmentsOpen)===!0,C=D||N||F||G||M,E=e!=null&&ct(e.mode),_=t&&(F||G||M||E&&!D&&!N),K=E&&!C&&!t,ee=Nr({overlayOpen:C,mode:e==null?void 0:e.mode}),Q=Fn(),te=t&&(D||U),Y=()=>p(!1),q=s.jsx("button",{ref:v,type:"button","aria-label":"Navigation","aria-expanded":l,className:W(re({variant:"ghost",size:"icon"}),"md:hidden"),onClick:()=>p(!0),children:s.jsx(V,{name:"panel-left"})});return m.useEffect(()=>{if(!l)return;const O=x=>{x.key==="Escape"&&(x.stopImmediatePropagation(),p(!1))};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[l]),m.useEffect(()=>{var x,b;const O=I.current;if(l){S.current=!0,O&&(O.inert=!0),(x=y.current)==null||x.focus();return}S.current&&(O&&(O.inert=!1),(b=v.current)==null||b.focus(),S.current=!1)},[l]),s.jsxs("div",{className:W("relative flex h-full min-h-0 w-full min-w-0",n),children:[s.jsx(Ar,{className:"hidden md:flex"}),K?s.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:max-w-140 md:flex-1 md:shadow-none 2xl:max-w-150",children:s.jsx(Vn,{})}):null,s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-primary-bg",children:[te?null:s.jsx(Kn,{className:W("bg-topbar-bg",(C||j||!Q||_)&&"md:hidden"),start:q,title:!C&&!_?s.jsx(Wn,{}):null,end:!C&&!_?s.jsxs(s.Fragment,{children:[s.jsx(a,{}),s.jsx(c,{}),s.jsx(u,{}),s.jsx(d,{})]}):null}),s.jsx(zn,{children:s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[ee?s.jsx(Pr,{collapsed:h,onCollapsedChange:g}):null,s.jsx("div",{ref:I,className:"min-h-0 min-w-0 flex-1",children:D?s.jsx(m.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(ye,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(jr,{...te?{headerStart:q}:{}})}):_?s.jsx($n,{}):F?s.jsx(i,{}):N&&(e==null?void 0:e.libraryAgentId)!=null?s.jsx(o,{agentId:e.libraryAgentId},e.libraryAgentId):N?s.jsx(r,{onSelectAgent:Y,...te?{headerStart:q}:{}}):G?s.jsx(m.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(ye,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(Mr,{})}):M?s.jsx(m.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(ye,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(Sr,{})}):j?s.jsx(f,{}):s.jsx(Xn,{})})]})})]}),l?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":"Close navigation backdrop",className:"absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden",onClick:Y}),s.jsx(Dr,{drawerRef:y,onClose:Y})]}):null]})}export{Ur as SidebarLayout};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-6WNST3GI-DtS3ib0p.js","./index-aDyvsTqL.js","./index-B01pXqvC.css","./SchedulesPage-OVDMYD6Q-BKu9sdHs.js","./chunk-HWOHXUGH-KXcUS5XW.js","./EnvironmentsPage-BUA2EGXE-CcV5njoc.js","./chunk-LFIIKLPG-DcaznAz-.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{cI as B,cJ as sn,be as J,j as s,cK as rn,r as m,bU as A,cL as qe,cM as on,cN as Qe,cO as Ze,cP as Je,cQ as et,cR as tt,cS as oe,cT as an,cU as P,cV as cn,cW as ln,cX as dn,cY as un,cZ as mn,c_ as fn,c$ as hn,d0 as pn,d1 as Te,d2 as xn,d3 as gn,d4 as ge,d5 as vn,d6 as bn,d7 as wn,d8 as nt,d9 as ze,da as ve,db as Re,dc as de,dd as Ne,de as Pe,df as Ee,dg as $e,d as Ae,q as st,t as ie,u as T,b$ as yn,w as In,c0 as Me,dh as jn,c2 as rt,c3 as Mn,c1 as Sn,di as Cn,k as ot,I as V,a3 as re,c as W,p as Ln,dj as Tn,dk as Rn,_ as he,bS as pe,dl as we,dm as Nn,bf as De,bB as at,dn as Pn,S as En,a2 as Ge,D as An,dp as it,dq as Dn,dr as _n,ds as On,dt as He,bG as kn,aa as Bn,E as Ue,bh as ct,du as Fn,P as Kn,dv as zn,bi as ye,bj as $n,dw as lt,dx as dt,c8 as Gn,bk as _e,dy as Hn,cF as Un}from"./index-aDyvsTqL.js";import{A as Vn,N as Wn,T as Xn,S as ut}from"./chunk-OXW7TUTC-UBWEIyxU.js";import{C as Yn}from"./chunk-LFIIKLPG-DcaznAz-.js";import{s as qn,u as Qn,S as Zn}from"./chunk-HK4WITDD-DSX_ymmz.js";const Oe=n=>{const e=B(8),{index:t,archived:o,children:r}=n;let i;e[0]!==o||e[1]!==t?(i=sn({source:"threads",query:{type:"index",index:t,archived:o},get:d=>d.threads().item({index:t,archived:o})}),e[0]=o,e[1]=t,e[2]=i):i=e[2];let c;e[3]!==i?(c={threadListItem:i},e[3]=i,e[4]=c):c=e[4];const a=J(c);let u;return e[5]!==a||e[6]!==r?(u=s.jsx(rn,{value:a,children:r}),e[5]=a,e[6]=r,e[7]=u):u=e[7],u},mt=m.memo(n=>{const e=B(6),{index:t,archived:o,components:r}=n,i=o===void 0?!1:o,c=r.ThreadListItem;let a;e[0]!==c?(a=s.jsx(c,{}),e[0]=c,e[1]=a):a=e[1];let u;return e[2]!==i||e[3]!==t||e[4]!==a?(u=s.jsx(Oe,{index:t,archived:i,children:a}),e[2]=i,e[3]=t,e[4]=a,e[5]=u):u=e[5],u},(n,e)=>n.index===e.index&&n.archived===e.archived&&n.components.ThreadListItem===e.components.ThreadListItem);mt.displayName="ThreadListPrimitive.ItemByIndex";const Ve=({archived:n,children:e})=>{const t=A(o=>n?o.threads.archivedThreadIds.length:o.threads.threadIds.length);return qe(()=>Array.from({length:t},(o,r)=>s.jsx(Oe,{index:r,archived:n,children:s.jsx(on,{getItemState:i=>i.threads().item({index:r,archived:n}).getState(),children:i=>e({get threadListItem(){return i()}})})},r)),[t,n,e])},ft=n=>{const e=B(8),{archived:t,components:o,children:r}=n,i=t===void 0?!1:t;if(o){const a=o.ThreadListItem;let u;e[0]!==a?(u=()=>s.jsx(a,{}),e[0]=a,e[1]=u):u=e[1];let d;return e[2]!==i||e[3]!==u?(d=s.jsx(Ve,{archived:i,children:u}),e[2]=i,e[3]=u,e[4]=d):d=e[4],d}let c;return e[5]!==i||e[6]!==r?(c=s.jsx(Ve,{archived:i,children:r}),e[5]=i,e[6]=r,e[7]=c):c=e[7],c};ft.displayName="ThreadListPrimitive.Items";const ht=n=>{const e=B(2),{fallback:t}=n,o=A(Jn)||t;let r;return e[0]!==o?(r=s.jsx(s.Fragment,{children:o}),e[0]=o,e[1]=r):r=e[1],r};ht.displayName="ThreadListItemPrimitive.Title";function Jn(n){return n.threadListItem.title}const es=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threadListItem().archive()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={archive:o},n[2]=o,n[3]=r):r=n[3],r},ts=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threadListItem().delete()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={delete:o},n[2]=o,n[3]=r):r=n[3],r},ns=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threadListItem().unarchive()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={unarchive:o},n[2]=o,n[3]=r):r=n[3],r},ss=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threadListItem().switchTo()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={switchTo:o},n[2]=o,n[3]=r):r=n[3],r},rs=()=>{const n=B(4),e=J();let t;n[0]!==e?(t=()=>{e.threads().switchToNewThread()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={switchToNewThread:o},n[2]=o,n[3]=r):r=n[3],r},os=()=>{const n=B(5),e=J(),t=A(as);let o;n[0]!==e?(o=()=>{e.threads().loadMore()},n[0]=e,n[1]=o):o=n[1];const r=o;let i;return n[2]!==t||n[3]!==r?(i={loadMore:r,disabled:t},n[2]=t,n[3]=r,n[4]=i):i=n[4],i};function as(n){return!n.threads.hasMore||n.threads.isLoading||n.threads.isLoadingMore}var is=Object.defineProperty,R=(n,e)=>is(n,"name",{value:e,configurable:!0}),cs=["Enter"," "],ls=["ArrowDown","PageUp","Home"],pt=["ArrowUp","PageDown","End"],ds=[...ls,...pt],be="Menu",[Se,us,ms]=et(be),[ae,xt]=Qe(be,[ms,Ze,Je]),ke=Ze(),gt=Je(),[fs,ue]=ae(be),[hs,Be]=ae(be),ps=R(n=>{const{__scopeMenu:e,open:t=!1,children:o,dir:r,onOpenChange:i,modal:c=!0}=n,a=ke(e),[u,d]=m.useState(null),f=m.useRef(!1),l=gn(i),p=ge(r);return m.useEffect(()=>{const h=R(()=>{f.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=R(()=>f.current=!1,"handlePointer");return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),m.useEffect(()=>{if(!t)return;const h=R(()=>l(!1),"handleBlur");return window.addEventListener("blur",h),()=>window.removeEventListener("blur",h)},[t,l]),s.jsx(vn,{...a,children:s.jsx(fs,{scope:e,open:t,onOpenChange:l,content:u,onContentChange:d,children:s.jsx(hs,{scope:e,onClose:m.useCallback(()=>l(!1),[l]),isUsingKeyboardRef:f,dir:p,modal:c,children:o})})})},"Menu"),xs=m.forwardRef(R(function(e,t){const{__scopeMenu:o,...r}=e,i=ke(o);return s.jsx(bn,{...i,...r,ref:t})},"MenuAnchor")),vt="MenuPortal",[gs,vs]=ae(vt,{forceMount:void 0}),bs=R(n=>{const{__scopeMenu:e,forceMount:t,children:o,container:r}=n,i=ue(vt,e);return s.jsx(gs,{scope:e,forceMount:t,children:s.jsx(tt,{present:t||i.open,children:s.jsx(wn,{asChild:!0,container:r,children:o})})})},"MenuPortal"),se="MenuContent",[ws,bt]=ae(se),ys=m.forwardRef(R(function(e,t){const o=vs(se,e.__scopeMenu),{forceMount:r=o.forceMount,...i}=e,c=ue(se,e.__scopeMenu),a=Be(se,e.__scopeMenu);return s.jsx(Se.Provider,{scope:e.__scopeMenu,children:s.jsx(tt,{present:r||c.open,children:s.jsx(Se.Slot,{scope:e.__scopeMenu,children:a.modal?s.jsx(Is,{...i,ref:t}):s.jsx(js,{...i,ref:t})})})})},"MenuContent")),Is=m.forwardRef(R(function(e,t){const o=ue(se,e.__scopeMenu),r=m.useRef(null),i=oe(t,r);return m.useEffect(()=>{const c=r.current;if(c)return an(c)},[]),s.jsx(wt,{...e,ref:i,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:P(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentModal")),js=m.forwardRef(R(function(e,t){const o=ue(se,e.__scopeMenu);return s.jsx(wt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentNonModal")),Ms=xn("MenuContent.ScrollLock"),wt=m.forwardRef(R(function(e,t){const{__scopeMenu:o,loop:r=!1,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:a,disableOutsidePointerEvents:u,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:p,onInteractOutside:h,onDismiss:g,disableOutsideScroll:v,...y}=e,I=ue(se,o),S=Be(se,o),j=ke(o),D=gt(o),N=us(o),[U,F]=m.useState(null),G=m.useRef(null),M=oe(t,G,I.onContentChange),C=m.useRef(0),E=m.useRef(""),_=m.useRef(0),K=m.useRef(null),ee=m.useRef("right"),Q=m.useRef(0),te=v?ln:m.Fragment,Y=v?{as:Ms,allowPinchZoom:!0}:void 0,q=R(x=>{var Z,$;const b=E.current+x,L=N().filter(k=>!k.disabled),z=document.activeElement,w=(Z=L.find(k=>k.ref.current===z))==null?void 0:Z.textValue,ne=L.map(k=>k.textValue),X=St(ne,b,w),H=($=L.find(k=>k.textValue===X))==null?void 0:$.ref.current;R((function k(fe){E.current=fe,window.clearTimeout(C.current),fe!==""&&(C.current=window.setTimeout(()=>k(""),1e3))}),"updateSearch")(b),H&&setTimeout(()=>H.focus())},"handleTypeaheadSearch");m.useEffect(()=>()=>window.clearTimeout(C.current),[]),cn();const O=m.useCallback(x=>{var L,z;return ee.current===((L=K.current)==null?void 0:L.side)&&Lt(x,(z=K.current)==null?void 0:z.area)},[]);return s.jsx(ws,{scope:o,searchRef:E,onItemEnter:m.useCallback(x=>{O(x)&&x.preventDefault()},[O]),onItemLeave:m.useCallback(x=>{var b;O(x)||((b=G.current)==null||b.focus(),F(null))},[O]),onTriggerLeave:m.useCallback(x=>{O(x)&&x.preventDefault()},[O]),pointerGraceTimerRef:_,onPointerGraceIntentChange:m.useCallback(x=>{K.current=x},[]),children:s.jsx(te,{...Y,children:s.jsx(dn,{asChild:!0,trapped:i,onMountAutoFocus:P(c,x=>{var b;x.preventDefault(),(b=G.current)==null||b.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:s.jsx(un,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:p,onInteractOutside:h,onDismiss:g,children:s.jsx(mn,{asChild:!0,...D,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:U,onCurrentTabStopIdChange:F,onEntryFocus:P(d,x=>{S.isUsingKeyboardRef.current||x.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(fn,{role:"menu","aria-orientation":"vertical","data-state":yt(I.open),"data-radix-menu-content":"",dir:S.dir,...j,...y,ref:M,style:{outline:"none",...y.style},onKeyDown:P(y.onKeyDown,x=>{const L=x.target.closest("[data-radix-menu-content]")===x.currentTarget,z=x.ctrlKey||x.altKey||x.metaKey,w=x.key.length===1;L&&(x.key==="Tab"&&x.preventDefault(),!z&&w&&q(x.key));const ne=G.current;if(x.target!==ne||!ds.includes(x.key))return;x.preventDefault();const H=N().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);pt.includes(x.key)&&H.reverse(),jt(H)}),onBlur:P(e.onBlur,x=>{x.currentTarget.contains(x.target)||(window.clearTimeout(C.current),E.current="")}),onPointerMove:P(e.onPointerMove,xe(x=>{const b=x.target,L=Q.current!==x.clientX;if(x.currentTarget.contains(b)&&L){const z=x.clientX>Q.current?"right":"left";ee.current=z,Q.current=x.clientX}}))})})})})})})},"MenuContentImpl")),Ce="MenuItem",We="menu.itemSelect",Ss=m.forwardRef(R(function(e,t){const{disabled:o=!1,onSelect:r,...i}=e,c=m.useRef(null),a=Be(Ce,e.__scopeMenu),u=bt(Ce,e.__scopeMenu),d=oe(t,c),f=m.useRef(!1),l=R(()=>{const p=c.current;if(!o&&p){const h=new CustomEvent(We,{bubbles:!0,cancelable:!0});p.addEventListener(We,g=>r==null?void 0:r(g),{once:!0}),hn(p,h),h.defaultPrevented?f.current=!1:a.onClose()}},"handleSelect");return s.jsx(Cs,{...i,ref:d,disabled:o,onClick:P(e.onClick,l),onPointerDown:p=>{var h;(h=e.onPointerDown)==null||h.call(e,p),f.current=!0},onPointerUp:P(e.onPointerUp,p=>{var h;f.current||(h=p.currentTarget)==null||h.click()}),onKeyDown:P(e.onKeyDown,p=>{o||p.target!==p.currentTarget||u.searchRef.current!==""&&p.key===" "||cs.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})},"MenuItem")),Cs=m.forwardRef(R(function(e,t){const{__scopeMenu:o,disabled:r=!1,textValue:i,...c}=e,a=bt(Ce,o),u=gt(o),d=m.useRef(null),f=oe(t,d),[l,p]=m.useState(!1),[h,g]=m.useState("");return m.useEffect(()=>{const v=d.current;v&&g((v.textContent??"").trim())},[c.children]),s.jsx(Se.ItemSlot,{scope:o,disabled:r,textValue:i??h,children:s.jsx(pn,{asChild:!0,...u,focusable:!r,children:s.jsx(Te.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...c,ref:f,onPointerMove:P(e.onPointerMove,xe(v=>{r?a.onItemLeave(v):(a.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:P(e.onPointerLeave,xe(v=>a.onItemLeave(v))),onFocus:P(e.onFocus,()=>p(!0)),onBlur:P(e.onBlur,()=>p(!1))})})})},"MenuItemImpl")),Ls="MenuRadioGroup",[Fr,Kr]=ae(Ls,{value:void 0,onValueChange:R(()=>{},"onValueChange")}),Ts="MenuItemIndicator",[zr,$r]=ae(Ts,{checked:!1}),Rs=m.forwardRef(R(function(e,t){const{__scopeMenu:o,...r}=e;return s.jsx(Te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})},"MenuSeparator")),Ns="MenuSub",[Gr,Hr]=ae(Ns);function yt(n){return n?"open":"closed"}R(yt,"getOpenState");function It(n){return n==="indeterminate"}R(It,"isIndeterminate");function Ps(n){return It(n)?"indeterminate":n?"checked":"unchecked"}R(Ps,"getCheckedState");function jt(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}R(jt,"focusFirst");function Mt(n,e){return n.map((t,o)=>n[(e+o)%n.length])}R(Mt,"wrapArray");function St(n,e,t){const r=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let c=Mt(n,Math.max(i,0));r.length===1&&(c=c.filter(d=>d!==t));const u=c.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return u!==t?u:void 0}R(St,"getNextMatch");function Ct(n,e){const{x:t,y:o}=n;let r=!1;for(let i=0,c=e.length-1;i<e.length;c=i++){const a=e[i],u=e[c],d=a.x,f=a.y,l=u.x,p=u.y;f>o!=p>o&&t<(l-d)*(o-f)/(p-f)+d&&(r=!r)}return r}R(Ct,"isPointInPolygon");function Lt(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return Ct(t,e)}R(Lt,"isPointerInGraceArea");function xe(n){return e=>e.pointerType==="mouse"?n(e):void 0}R(xe,"whenMouse");var Es=ps,As=xs,Ds=bs,_s=ys,Os=Ss,ks=Rs,Bs=Object.defineProperty,ce=(n,e)=>Bs(n,"name",{value:e,configurable:!0}),Fe="DropdownMenu",[Fs,Tt]=Qe(Fe,[xt]),le=xt(),[Ks,Rt]=Fs(Fe),Nt=ce(n=>{const{__scopeDropdownMenu:e,children:t,dir:o,open:r,defaultOpen:i,onOpenChange:c,modal:a=!0}=n,u=le(e),d=m.useRef(null),[f,l]=nt({prop:r,defaultProp:i??!1,onChange:c,caller:Fe});return s.jsx(Ks,{scope:e,triggerId:ze(),triggerRef:d,contentId:ze(),open:f,onOpenChange:l,onOpenToggle:m.useCallback(()=>l(p=>!p),[l]),modal:a,children:s.jsx(Es,{...u,open:f,onOpenChange:l,dir:o,modal:a,children:t})})},"DropdownMenu"),zs="DropdownMenuTrigger",Pt=m.forwardRef(ce(function(e,t){const{__scopeDropdownMenu:o,disabled:r=!1,...i}=e,c=Rt(zs,o),a=le(o),u=oe(t,c.triggerRef);return s.jsx(As,{asChild:!0,...a,children:s.jsx(Te.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:u,onPointerDown:P(e.onPointerDown,d=>{!r&&d.button===0&&d.ctrlKey===!1&&(c.onOpenToggle(),c.open||d.preventDefault())}),onKeyDown:P(e.onKeyDown,d=>{r||(["Enter"," "].includes(d.key)&&c.onOpenToggle(),d.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})},"DropdownMenuTrigger")),Et=ce(n=>{const{__scopeDropdownMenu:e,...t}=n,o=le(e);return s.jsx(Ds,{...o,...t})},"DropdownMenuPortal"),$s="DropdownMenuContent",At=m.forwardRef(ce(function(e,t){const{__scopeDropdownMenu:o,...r}=e,i=Rt($s,o),c=le(o),a=m.useRef(!1);return s.jsx(_s,{id:i.contentId,"aria-labelledby":i.triggerId,...c,...r,ref:t,onCloseAutoFocus:P(e.onCloseAutoFocus,u=>{var d;a.current||(d=i.triggerRef.current)==null||d.focus(),a.current=!1,u.preventDefault()}),onInteractOutside:P(e.onInteractOutside,u=>{const d=u.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,l=d.button===2||f;(!i.modal||l)&&(a.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")),Dt=m.forwardRef(ce(function(e,t){const{__scopeDropdownMenu:o,...r}=e,i=le(o);return s.jsx(Os,{...i,...r,ref:t})},"DropdownMenuItem")),_t=m.forwardRef(ce(function(e,t){const{__scopeDropdownMenu:o,...r}=e,i=le(o);return s.jsx(ks,{...i,...r,ref:t})},"DropdownMenuSeparator")),Ot=Nt,kt=Pt,Gs=Et,Bt=At,Ft=Dt,Kt=_t;const Hs=Object.freeze(Object.defineProperty({__proto__:null,Content:Bt,DropdownMenu:Nt,DropdownMenuContent:At,DropdownMenuItem:Dt,DropdownMenuPortal:Et,DropdownMenuSeparator:_t,DropdownMenuTrigger:Pt,Item:Ft,Portal:Gs,Root:Ot,Separator:Kt,Trigger:kt,createDropdownMenuScope:Tt},Symbol.toStringTag,{value:"Module"})),Us=ve(kt),Vs=ve(Bt),Ws=ve(Ft),Xs=ve(Kt),zt=m.forwardRef((n,e)=>{const t=B(15);let o,r,i;t[0]!==n?({onClick:r,disabled:o,...i}=n,t[0]=n,t[1]=o,t[2]=r,t[3]=i):(o=t[1],r=t[2],i=t[3]);const c=A(Ys),{switchToNewThread:a}=rs();let u;t[4]!==c?(u=c?{"data-active":"true","aria-current":"true"}:null,t[4]=c,t[5]=u):u=t[5];let d;t[6]!==r||t[7]!==a?(d=P(r,a),t[6]=r,t[7]=a,t[8]=d):d=t[8];let f;return t[9]!==o||t[10]!==e||t[11]!==i||t[12]!==u||t[13]!==d?(f=s.jsx(Re.button,{type:"button",...u,...i,ref:e,disabled:o,onClick:d}),t[9]=o,t[10]=e,t[11]=i,t[12]=u,t[13]=d,t[14]=f):f=t[14],f});zt.displayName="ThreadListPrimitive.New";function Ys(n){return n.threads.newThreadId===n.threads.mainThreadId}const qs=()=>{const{loadMore:n,disabled:e}=os();return e?null:n},Qs=de("ThreadListPrimitive.LoadMore",qs),[Zs,Js]=et("ThreadList"),Le=Zs,$t=Pe(null),er=$t.Provider,Ke=()=>Ne($t),Gt=m.forwardRef((n,e)=>{const t=B(3);let o;return t[0]!==n||t[1]!==e?(o=s.jsx(Le.Provider,{scope:void 0,children:s.jsx(Le.Slot,{scope:void 0,children:s.jsx(Re.div,{...n,ref:e})})}),t[0]=n,t[1]=e,t[2]=o):o=t[2],o});Gt.displayName="ThreadListPrimitive.Root";var tr=Ee({ItemByIndex:()=>mt,Items:()=>ft,LoadMore:()=>Qs,New:()=>zt,Root:()=>Gt});const Ht=m.forwardRef((n,e)=>{const t=A(d=>d.threads.mainThreadId===d.threadListItem.id),o=$e(null),r=$e(null),i=qe(()=>({triggerRef:o,moreRef:r}),[]),c=Js(void 0),a=ge(),u=d=>{const f=a==="rtl"?"ArrowLeft":"ArrowRight",l=a==="rtl"?"ArrowRight":"ArrowLeft",p=o.current,h=r.current;if(p&&d.target===p)if(d.key==="ArrowDown"||d.key==="ArrowUp"){const g=c().map(y=>y.ref.current).filter(y=>y!==null),v=g[g.indexOf(p)+(d.key==="ArrowDown"?1:-1)];v&&(v.focus(),d.preventDefault())}else d.key===f&&h&&(h.focus(),d.preventDefault());else h&&d.target===h&&d.key===l&&(p==null||p.focus(),d.preventDefault())};return s.jsx(er,{value:i,children:s.jsx(Re.div,{...t?{"data-active":"true","aria-current":"true"}:null,...n,onKeyDown:P(n.onKeyDown,u),ref:e})})});Ht.displayName="ThreadListItemPrimitive.Root";const nr=()=>{const{archive:n}=es();return n},sr=de("ThreadListItemPrimitive.Archive",nr),rr=()=>{const{unarchive:n}=ns();return n},or=de("ThreadListItemPrimitive.Unarchive",rr),ar=()=>{const{delete:n}=ts();return n},ir=de("ThreadListItemPrimitive.Delete",ar),cr=()=>{const{switchTo:n}=ss();return n},lr=de("ThreadListItemPrimitive.Trigger",cr),Ut=m.forwardRef((n,e)=>{var i;const t=B(3),o=oe(e,(i=Ke())==null?void 0:i.triggerRef);let r;return t[0]!==n||t[1]!==o?(r=s.jsx(Le.ItemSlot,{scope:void 0,children:s.jsx(lr,{...n,ref:o})}),t[0]=n,t[1]=o,t[2]=r):r=t[2],r});Ut.displayName="ThreadListItemPrimitive.Trigger";var dr=Ee({Archive:()=>sr,Delete:()=>ir,Root:()=>Ht,Title:()=>ht,Trigger:()=>Ut,Unarchive:()=>or});const me=Tt(),Vt=Pe(()=>{}),Wt=()=>Ne(Vt),Xt=Pe(!1),Yt=()=>Ne(Xt),qt=n=>{const e=B(26);let t,o,r,i,c,a,u;e[0]!==n?({__scopeThreadListItemMore:t,open:c,defaultOpen:o,onOpenChange:i,sharedFocusGroup:u,modal:r,...a}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i,e[5]=c,e[6]=a,e[7]=u):(t=e[1],o=e[2],r=e[3],i=e[4],c=e[5],a=e[6],u=e[7]);const d=u===void 0?!1:u,f=d?!1:r??!0,l=me(t),p=o??!1;let h;e[8]!==i?(h=i?{onChange:i}:{},e[8]=i,e[9]=h):h=e[9];let g;e[10]!==c||e[11]!==p||e[12]!==h?(g={prop:c,defaultProp:p,caller:"ThreadListItemMorePrimitive.Root",...h},e[10]=c,e[11]=p,e[12]=h,e[13]=g):g=e[13];const[v,y]=nt(g);let I;e[14]!==f||e[15]!==v||e[16]!==a||e[17]!==l||e[18]!==y?(I=s.jsx(Ot,{...l,...a,modal:f,open:v,onOpenChange:y}),e[14]=f,e[15]=v,e[16]=a,e[17]=l,e[18]=y,e[19]=I):I=e[19];let S;e[20]!==y||e[21]!==I?(S=s.jsx(Vt.Provider,{value:y,children:I}),e[20]=y,e[21]=I,e[22]=S):S=e[22];let j;return e[23]!==d||e[24]!==S?(j=s.jsx(Xt.Provider,{value:d,children:S}),e[23]=d,e[24]=S,e[25]=j):j=e[25],j};qt.displayName="ThreadListItemMorePrimitive.Root";const Qt=m.forwardRef((n,e)=>{const t=B(10),{__scopeThreadListItemMore:o,...r}=n,i=me(o),c=Ke(),a=Wt(),u=Yt(),d=oe(e,c==null?void 0:c.moreRef),f=ge()==="rtl"?"ArrowLeft":"ArrowRight",l=Us;let p;t[0]!==f||t[1]!==a||t[2]!==u?(p=v=>{!u||v.key!==f||(v.preventDefault(),a(!0))},t[0]=f,t[1]=a,t[2]=u,t[3]=p):p=t[3];const h=P(r.onKeyDown,p);let g;return t[4]!==l||t[5]!==d||t[6]!==r||t[7]!==i||t[8]!==h?(g=s.jsx(l,{...i,...r,onKeyDown:h,ref:d}),t[4]=l,t[5]=d,t[6]=r,t[7]=i,t[8]=h,t[9]=g):g=t[9],g});Qt.displayName="ThreadListItemMorePrimitive.Trigger";const Zt=m.forwardRef((n,e)=>{const t=B(21),{__scopeThreadListItemMore:o,portalProps:r,sideOffset:i,...c}=n,a=i===void 0?4:i,u=me(o),d=Wt(),f=Ke(),l=Yt(),p=ge()==="rtl"?"ArrowRight":"ArrowLeft",h=Hs,g=Vs;let v;t[0]!==p||t[1]!==(f==null?void 0:f.moreRef)||t[2]!==d||t[3]!==l?(v=N=>{var U;!l||N.key!==p||(N.preventDefault(),d(!1),(U=f==null?void 0:f.moreRef.current)==null||U.focus())},t[0]=p,t[1]=f==null?void 0:f.moreRef,t[2]=d,t[3]=l,t[4]=v):v=t[4];const y=P(c.onKeyDown,v);let I;t[5]!==(f==null?void 0:f.moreRef)||t[6]!==l?(I=()=>{var N;l&&((N=f==null?void 0:f.moreRef.current)==null||N.focus())},t[5]=f==null?void 0:f.moreRef,t[6]=l,t[7]=I):I=t[7];const S=P(c.onEscapeKeyDown,I);let j;t[8]!==g||t[9]!==e||t[10]!==c||t[11]!==u||t[12]!==a||t[13]!==y||t[14]!==S?(j=s.jsx(g,{...u,...c,onKeyDown:y,onEscapeKeyDown:S,ref:e,sideOffset:a}),t[8]=g,t[9]=e,t[10]=c,t[11]=u,t[12]=a,t[13]=y,t[14]=S,t[15]=j):j=t[15];let D;return t[16]!==r||t[17]!==u||t[18]!==h.Portal||t[19]!==j?(D=s.jsx(h.Portal,{...u,...r,children:j}),t[16]=r,t[17]=u,t[18]=h.Portal,t[19]=j,t[20]=D):D=t[20],D});Zt.displayName="ThreadListItemMorePrimitive.Content";const Jt=m.forwardRef((n,e)=>{const t=B(7);let o,r;t[0]!==n?({__scopeThreadListItemMore:o,...r}=n,t[0]=n,t[1]=o,t[2]=r):(o=t[1],r=t[2]);const i=me(o);let c;return t[3]!==e||t[4]!==r||t[5]!==i?(c=s.jsx(Ws,{...i,...r,ref:e}),t[3]=e,t[4]=r,t[5]=i,t[6]=c):c=t[6],c});Jt.displayName="ThreadListItemMorePrimitive.Item";const en=m.forwardRef((n,e)=>{const t=B(7);let o,r;t[0]!==n?({__scopeThreadListItemMore:o,...r}=n,t[0]=n,t[1]=o,t[2]=r):(o=t[1],r=t[2]);const i=me(o);let c;return t[3]!==e||t[4]!==r||t[5]!==i?(c=s.jsx(Xs,{...i,...r,ref:e}),t[3]=e,t[4]=r,t[5]=i,t[6]=c):c=t[6],c});en.displayName="ThreadListItemMorePrimitive.Separator";var Ie=Ee({Content:()=>Zt,Item:()=>Jt,Root:()=>qt,Separator:()=>en,Trigger:()=>Qt});function ur(){const n=ie(),e=Ae(),t=De(),o=at(),r=t||o,[i,c]=m.useState(!1),[a,u]=m.useState(""),[d,f]=m.useState(null),l=m.useRef(null),p=m.useRef(null),h=m.useId(),g=(n==null?void 0:n.isLibraryEnabled)===!0&&e!=null,v=(n==null?void 0:n.historyAgentFilter)??null;m.useEffect(()=>{i||u("")},[i]);const{agents:y,isInitialLoading:I,isSearching:S,loadingMore:j,hasMore:D,listRef:N,sentinelRef:U}=Pn({enabled:i&&g,query:a});if(m.useLayoutEffect(()=>{if(!i||r){f(null);return}const M=()=>{var E;const C=(E=l.current)==null?void 0:E.getBoundingClientRect();C&&f({top:C.top,left:C.right+4})};return M(),window.addEventListener("resize",M),window.addEventListener("scroll",M,!0),()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0)}},[i,r]),m.useEffect(()=>{if(!i||r)return;const M=C=>{var _,K;const E=C.target;(_=l.current)!=null&&_.contains(E)||(K=p.current)!=null&&K.contains(E)||c(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[i,r]),!g)return null;const F=M=>{(n==null?void 0:n.isComposerEnabled)===!0?n.openDraft():n==null||n.openLibraryHome(),n==null||n.setHistoryAgentFilter(M),c(!1)},G=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"p-1",onMouseDown:M=>M.stopPropagation(),children:[s.jsx(En,{query:a,setQuery:u,placeholder:"Search agents"}),S?s.jsx("p",{className:"text-text-secondary px-1 pt-1 text-[11px]",role:"status",children:"Searching…"}):null]}),s.jsxs("div",{ref:N,className:W("mt-1 overflow-y-auto",r?"min-h-0 flex-1 px-1 pb-2":"min-h-48 max-h-64"),children:[a.trim()===""?s.jsxs(Ge,{className:W("justify-between",v==null&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>F(null),children:["All chats",v==null?s.jsx(V,{name:"check",className:"size-3.5 shrink-0"}):null]}):null,I?s.jsx("p",{className:"px-2 py-3 text-center text-xs text-text-secondary",children:"Loading…"}):y.length===0?s.jsx("p",{className:"text-text-secondary px-2 py-6 text-center text-xs",role:"status",children:a.trim()?`No agents match "${a.trim()}".`:"No agents yet."}):s.jsxs(s.Fragment,{children:[y.map(M=>{const C=An(M),E=(v==null?void 0:v.agentId)===C;return s.jsxs(Ge,{className:W("justify-between gap-2 text-left",E&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>F({agentId:C,agentName:M.name,intent:"history"}),children:[s.jsx("span",{className:"min-w-0 truncate",children:M.name}),E?s.jsx(V,{name:"check",className:"size-3.5 shrink-0"}):null]},C)}),D?s.jsx("div",{ref:U,className:"flex h-6 shrink-0 items-center justify-center","aria-hidden":!0,children:j?s.jsx("span",{className:"text-text-secondary text-[11px]",role:"status",children:"Loading more…"}):null}):null]})]})]});return s.jsxs("div",{className:"relative shrink-0",children:[s.jsxs("button",{ref:l,type:"button","aria-label":v!=null?`Filter chat history by agent (${v.agentName})`:"Filter chat history by agent","aria-haspopup":r?"dialog":"menu","aria-expanded":i,"aria-controls":i?h:void 0,title:"Filter by agent",className:re({variant:"ghost",size:"icon",className:W("relative size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text",v!=null&&"text-text-primary")}),onClick:()=>c(M=>!M),children:[s.jsx(V,{name:"funnel",className:"size-3.5"}),v!=null?s.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]}),r&&i?s.jsx(it,{open:!0,onOpenChange:c,id:h,"aria-label":"Filter agents",children:s.jsx("div",{className:"flex min-h-0 flex-1 flex-col p-2",role:"menu",children:G})}):null,!r&&i&&d!=null?Dn.createPortal(s.jsx("div",{ref:p,id:h,role:"menu","aria-label":"Filter agents",style:{top:d.top,left:d.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:G}),_n(l.current)):null]})}function mr({open:n,initialTitle:e,saving:t=!1,onOpenChange:o,onSave:r}){const[i,c]=m.useState(e),a=m.useRef(null);m.useEffect(()=>{n&&c(e)},[n,e]),m.useEffect(()=>{if(!n)return;const h=a.current;h!=null&&(h.focus(),h.select())},[n]);const u=i.trim(),f=u.length>0&&u.length<=He&&!t,l=()=>{f&&r(u)},p=h=>{t||o(h)};return s.jsx(kn,{open:n,onOpenChange:p,title:"Rename session",contentSized:!0,"aria-label":"Rename session",footer:s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(Ue.Secondary,{type:"button",disabled:t,onClick:()=>p(!1),children:"Cancel"}),s.jsx(Ue.Primary,{type:"button",disabled:!f,onClick:l,children:"Save"})]}),children:s.jsx("div",{className:"px-5 py-4",children:s.jsx("input",{ref:a,"aria-label":"Session title",value:i,readOnly:t,maxLength:He,className:Bn("h-9"),onChange:h=>c(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),l())}})})})}var fr="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",hr="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 pr({canRename:n,renameDisabled:e,canDelete:t,deleteDisabled:o,onRename:r,onDelete:i}){const c=T("PermissionGuard"),a=at(),u=De(),[d,f]=m.useState(!1),[l,p]=m.useState(),h=u||a,g=m.useCallback(S=>{const j=S==null?void 0:S.closest(".aui-theme-root");p(j instanceof HTMLElement?j:void 0)},[]),v=re({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-text-secondary hover:bg-transparent hover:text-text-primary"}),y=n?s.jsx(c,{allowed:!e,children:s.jsxs("button",{type:"button",className:fr,disabled:e,onClick:()=>{e||(f(!1),r())},children:[s.jsx(V,{name:"pencil",className:"size-3.5"}),"Rename"]})}):null,I=t?s.jsx(c,{allowed:!o,children:s.jsxs("button",{type:"button",className:hr,disabled:o,onClick:()=>{o||(f(!1),i())},children:[s.jsx(V,{name:"trash",className:"size-3.5"}),"Delete"]})}):null;return h?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":"Session actions",title:"Session actions","aria-haspopup":"dialog","aria-expanded":d,className:v,onClick:()=>f(!0),children:s.jsx(V,{name:"ellipsis",className:"size-3.5"})}),d?s.jsx(it,{open:!0,onOpenChange:f,"aria-label":"Session actions",children:s.jsxs("div",{className:"flex flex-col gap-1 p-2 *:w-full",role:"menu",children:[y,I]})}):null]}):s.jsxs(Ie.Root,{sharedFocusGroup:!0,children:[s.jsx(Ie.Trigger,{ref:g,"aria-label":"Session actions",title:"Session actions",className:v,children:s.jsx(V,{name:"ellipsis",className:"size-3.5"})}),s.jsxs(Ie.Content,{portalProps:{container:l},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:[y,I]})]})}function xr({selectionRef:n,onThreadOpen:e,canRenameSession:t,canDeleteSession:o,canManageResource:r,canDeleteResource:i}){const c=J(),a=ie(),u=Ae(),d=m.useRef(a==null?void 0:a.runtimeKey);d.current=a==null?void 0:a.runtimeKey;const f=st(),l=Ln(),p=T("ThreadListRow"),h=A(b=>b.threadListItem.id),g=A(b=>b.threadListItem.remoteId),v=A(b=>b.threadListItem.title),y=A(b=>b.threadListItem.lastMessageAt),I=A(b=>b.threadListItem.custom),S=A(b=>b.threads.mainThreadId),j=Tn(I),D=Me(I),N=Rn(y,rt(I)),U=t&&g!=null,F=o&&g!=null,G=U||F,M=g!=null&&!r(g),C=g!=null&&!i(g),E=(a==null?void 0:a.libraryOpen)===!0||(a==null?void 0:a.sessionsOpen)===!0||(a==null?void 0:a.schedulesOpen)===!0||(a==null?void 0:a.environmentsOpen)===!0,[_,K]=m.useState(!1),[ee,Q]=m.useState(!1),[te,Y]=m.useState(!1),q=v??"New Chat",O=async b=>{if(b===(v??"").trim()){K(!1);return}Q(!0);try{await c.threadListItem().rename(b),f(he.Session.RENAMED,pe(void 0,{sessionId:g,agentName:j})),K(!1)}catch(L){l==null||l.showError(L)}finally{Q(!1)}},x=({sessionMutable:b,rowAgentName:L})=>{const z=!b&&(a==null?void 0:a.mode.status)==="active"&&!a.mode.isMutable&&(L==null?a.mode.agentName==null&&a.mode.agentId==null:a.mode.agentName===L||a.mode.agentId===L),w=On({sessionMutable:b,shellMutable:(a==null?void 0:a.mode.status)==="active"&&a.mode.isMutable,...(a==null?void 0:a.mode.status)==="active"&&a.mode.isMutable?{shellAgentName:a.mode.agentName,shellAgentId:a.mode.agentId}:{},remoteId:g,pendingSessionId:a==null?void 0:a.pendingSessionId});if((z||w)&&g!=null&&(a==null?void 0:a.sessionAccessError)==null){Promise.resolve(c.threads().switchToThread(h)).catch(()=>{});return}if(g!=null){a==null||a.openHistorySession({sessionId:g,isMutable:b,...L!=null?{agentName:L}:{}});return}Promise.resolve(c.threads().switchToThread(h)).catch(()=>{})};return s.jsxs(dr.Root,{className:"min-w-0",children:[s.jsx(p,{title:q,active:h===S&&!E,agentName:j,...D==null?{}:{lastTurnStatus:D},...N==null?{}:{lastMessageAt:N},onSelect:()=>{f(he.Session.SELECTED,pe({is_mutable:we(I)},{sessionId:g,agentName:j}));const b=++n.current,L=a==null?void 0:a.runtimeKey;if(e==null||e(),a==null||a.setSettingsOpen(!1),a==null||a.setLibraryOpen(!1),a==null||a.setSessionsOpen(!1),a==null||a.setSchedulesOpen(!1),a==null||a.setEnvironmentsOpen(!1),g!=null&&u!=null&&Nn(I)===void 0&&j==null){u.getSession({sessionId:g}).then(z=>({sessionMutable:z.isMutable,rowAgentName:z.agentName??void 0}),()=>({sessionMutable:we(I),rowAgentName:j})).then(z=>{n.current===b&&d.current===L&&x(z)});return}x({sessionMutable:we(I),rowAgentName:j})},actions:G?s.jsx(pr,{canRename:U,renameDisabled:M,canDelete:F,deleteDisabled:C,onRename:()=>K(!0),onDelete:()=>Y(!0)}):void 0}),te?s.jsx(Yn,{title:"Delete chat",description:`“${q}” will be permanently deleted. This cannot be undone.`,confirmLabel:"Delete",onCancel:()=>Y(!1),onConfirm:()=>{Y(!1),Promise.resolve(c.threadListItem().delete()).then(()=>{f(he.Session.DELETED,pe(void 0,{sessionId:g,agentName:j}))},b=>{l==null||l.showError(b)})}}):null,s.jsx(mr,{open:_,initialTitle:v??"",saving:ee,onOpenChange:K,onSave:b=>{O(b)}})]})}function gr(n){const e=A(o=>o.threads.threadIds),t=A(o=>o.threads.threadItems);return m.useMemo(()=>{const o=Cn({threadIds:e,threadItems:t});if(n==="default")return o;const r=new Map;for(const i of t)r.set(i.id,i),i.remoteId!=null&&r.set(i.remoteId,i);return o.filter(i=>{const c=e[i];if(c===void 0)return!1;const a=r.get(c);return(a==null?void 0:a.remoteId)!=null})},[e,t,n])}function vr(n){return n==="recent-history"||n==="mobile-drawer"}function br({selectionRef:n,indices:e,onThreadOpen:t,canRenameSession:o,canDeleteSession:r,canManageResource:i,canDeleteResource:c}){const a=A(u=>u.threads.threadIds);return s.jsx(s.Fragment,{children:e.map(u=>{const d=a[u]??String(u);return s.jsx(Oe,{index:u,archived:!1,children:s.jsx(xr,{selectionRef:n,onThreadOpen:t,canRenameSession:o,canDeleteSession:r,canManageResource:i,canDeleteResource:c})},d)})})}var wr="aui_thread-list-viewport",yr=80;function Ir({children:n,viewportRef:e,hideScrollbar:t,onCollapse:o}){var d;const r=ie(),i=A(f=>f.threadListItem.remoteId),c=(d=r==null?void 0:r.historyAgentFilter)==null?void 0:d.intent,a=(r==null?void 0:r.isLibraryEnabled)===!0&&c!=="try-agent"&&(c==="history"||r.mode.status!=="active"||r.mode.isMutable||r.pendingSessionId!=null||i!=null),u=(r==null?void 0:r.historyAgentFilter)==null?"Chat History":`Chats for ${r.historyAgentFilter.agentName}`;return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-1 py-1",children:[s.jsx("h2",{className:"min-w-0 flex-1 truncate px-1.5 py-1 text-sm font-medium text-text-secondary",children:u}),a?s.jsx(ur,{}):null,o!=null?s.jsx(ot,{content:"Close chat history",side:"right",children:s.jsx("button",{type:"button","aria-label":"Close chat history","aria-expanded":!0,className:re({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text"}),onClick:o,children:s.jsx(V,{name:"panel-left-close",className:"size-3.5"})})}):null]}),s.jsx("div",{ref:e,"data-slot":wr,className:W("flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",t&&"aui-scrollbar-hidden"),children:n})]})}function tn({onThreadOpen:n,onCollapseRecentHistory:e,variant:t="default"}={}){const o=J(),r=Ae(),i=st(),c=A(w=>w.threads.isLoading),a=A(w=>w.threads.isLoadingMore),u=A(w=>w.threads.hasMore),d=A(w=>w.threads.threadIds),f=A(w=>w.threads.threadItems),l=ie(),p=T("ThreadListShell"),h=T("ThreadListNewButton"),g=T("AgentsLibraryButton"),v=T("SessionsBrowserButton"),y=T("SchedulesButton"),I=T("EnvironmentsButton"),S=T("ThreadListRowSkeleton"),j=T("ThreadListEmptyState"),D=gr(t),N=m.useRef(null),U=m.useRef(u),F=m.useRef(o),G=m.useRef(0),M=yn(),C=m.useRef(M);U.current=u,F.current=o,C.current=M;const E=(l==null?void 0:l.isNewChatEnabled)!==!1,_=(l==null?void 0:l.mode.status)==="idle",K=vr(t),ee=t==="mobile-drawer",Q=typeof(r==null?void 0:r.renameSession)=="function",te=typeof(r==null?void 0:r.deleteSession)=="function",Y=m.useMemo(()=>f.flatMap(w=>w.remoteId==null?[]:[w.remoteId]),[f]),{allows:q}=In({resourceType:"session",resourceIds:Y}),O=m.useMemo(()=>_||c||r==null?null:qn(f.map(w=>Me(w.custom))),[_,c,r,f]),x=l==null?void 0:l.listSessionsAgentId;Qn({intervalMs:O,poll:m.useCallback(async()=>{if(r==null)return;const w=C.current;try{const ne=await r.listSessions({createdByMe:!0,limit:Zn,startTimestamp:jn(),...x==null||x.length===0?{}:{agentId:x}}),X=new Map(ne.data.map($=>{var k;return[$.id,{status:(k=$.lastTurnDetails)==null?void 0:k.state.status,updatedAt:$.updatedAt}]})),H=F.current.threads().getState(),Z=H.mainThreadId;for(const $ of H.threadItems){if($.id===Z&&(w||C.current)||$.remoteId==null||!X.has($.remoteId))continue;const k=X.get($.remoteId);if(k==null)continue;const fe=Me($.custom),nn=rt($.custom)??$.lastMessageAt;k.status===fe&&!Mn(k.updatedAt,nn)||F.current.threads().item({id:$.id}).updateCustom(Sn($.custom,k.status??null,k.updatedAt))}}catch{}},[x,r])}),m.useEffect(()=>{if(_||c||a)return;const w=N.current;if(!w)return;let ne=!1;const X=()=>{if(ne||!U.current||w.clientHeight<=0)return;const Z=w.scrollHeight-w.scrollTop-w.clientHeight;w.scrollHeight>w.clientHeight&&Z>yr||F.current.threads().loadMore()};w.addEventListener("scroll",X,{passive:!0});const H=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>X());return H?H.observe(w):window.addEventListener("resize",X),X(),()=>{ne=!0,w.removeEventListener("scroll",X),H==null||H.disconnect(),H||window.removeEventListener("resize",X)}},[u,_,c,a,d.length]);const b=()=>{if(i(he.Session.NEW,pe({is_composer_enabled:(l==null?void 0:l.isComposerEnabled)===!0},{...(l==null?void 0:l.mode.status)==="active"?{agentId:l.mode.agentId,agentName:l.mode.agentName}:{}})),n==null||n(),l==null||l.setLibraryOpen(!1),l==null||l.setSessionsOpen(!1),l!=null&&l.isComposerEnabled){l.openDraft();return}l==null||l.setSettingsOpen(!1),l==null||l.setSchedulesOpen(!1),l==null||l.setEnvironmentsOpen(!1),Promise.resolve(o.threads().switchToNewThread()).catch(()=>{})};let L;_?L=s.jsx(j,{message:K?"No recent chats":void 0}):c?L=s.jsx(S,{}):D.length===0?L=s.jsx(j,{message:K?"No recent chats":void 0}):L=s.jsx(tr.Root,{className:"flex min-h-0 flex-col gap-0.5",children:s.jsx(br,{selectionRef:G,indices:D,onThreadOpen:n,canRenameSession:Q,canDeleteSession:te,canManageResource:w=>q(w,"MANAGE"),canDeleteResource:w=>q(w,"DELETE")})});const z=t==="recent-history"?null:s.jsxs("div",{className:"flex flex-col gap-1",children:[E?s.jsx(h,{onClick:b}):null,s.jsx("div",{className:"contents",onClick:()=>{ee&&(n==null||n())},children:s.jsx(g,{})}),ee?null:s.jsxs(s.Fragment,{children:[s.jsx(v,{}),s.jsx(y,{}),s.jsx(I,{})]})]});return s.jsx(p,{header:z,children:s.jsxs(Ir,{viewportRef:N,hideScrollbar:K,onCollapse:t==="recent-history"?e:void 0,children:[L,!_&&u?s.jsx("div",{className:"h-4 shrink-0","aria-hidden":!0}):null]})})}var jr=m.lazy(()=>_e(()=>import("./SettingsBuilder-6WNST3GI-DtS3ib0p.js"),__vite__mapDeps([0,1,2]),import.meta.url)),Mr=m.lazy(()=>_e(()=>import("./SchedulesPage-OVDMYD6Q-BKu9sdHs.js"),__vite__mapDeps([3,4,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),Sr=m.lazy(()=>_e(()=>import("./EnvironmentsPage-BUA2EGXE-CcV5njoc.js"),__vite__mapDeps([5,6,1,2,4]),import.meta.url).then(n=>({default:n.EnvironmentsPage}))),Cr="h-5 w-5 max-w-40 shrink-0 object-contain",Lr="h-5 max-w-40 shrink-0 object-contain",Tr="w-20",Rr="w-80",je="aui-recent-chat-history",Xe=W(Un,"text-sidebar-text"),Ye="bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";function Nr({overlayOpen:n,mode:e}){return!n&&(e==null?void 0:e.status)==="active"&&!e.isCreateAgent}function Pr({collapsed:n,onCollapsedChange:e}){return Gn().presentation==="full"?null:n?s.jsx("aside",{id:je,"aria-label":"Recent chats",className:"hidden min-h-0 w-12 shrink-0 flex-col border-r border-border bg-sidebar-bg md:flex",children:s.jsx("div",{className:"flex w-full items-start justify-center p-2",children:s.jsx(ot,{content:"Open chat history",side:"right",children:s.jsx("button",{type:"button","aria-label":"Open chat history","aria-controls":je,"aria-expanded":!1,className:re({variant:"ghost",size:"icon",className:"size-7 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text"}),onClick:()=>e(!1),children:s.jsx(V,{name:"panel-left-open",className:"size-3.5"})})})})}):s.jsx("aside",{id:je,"aria-label":"Recent chats",className:"hidden min-h-0 w-64 shrink-0 border-r border-border bg-sidebar-bg md:flex",children:s.jsx(tn,{variant:"recent-history",onCollapseRecentHistory:()=>e(!0)})})}function Er(){var h;const n=J(),e=ie(),t=T("AgentsLibraryButton"),o=T("SessionsBrowserButton"),r=T("SchedulesButton"),i=T("EnvironmentsButton"),c=(e==null?void 0:e.isNewChatEnabled)!==!1,a=(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,u=e==null?void 0:e.mode,d=!a&&(u==null?void 0:u.status)==="active"&&!u.isCreateAgent&&((h=e==null?void 0:e.historyAgentFilter)==null?void 0:h.intent)!=="try-agent",f=!a&&u!=null&&ct(u),l=()=>{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(()=>{})},p=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return s.jsxs("nav",{className:"flex min-h-0 flex-1 flex-col items-center gap-1 p-1","aria-label":"Sidebar",children:[c?s.jsxs("button",{type:"button","aria-label":"Start new chat",title:"New chat","aria-current":d?"page":void 0,className:re({variant:"ghost",className:W(Xe,d&&Ye)}),onClick:l,children:[s.jsx(V,{name:"square-pen",size:14}),s.jsx("span",{className:"text-center",children:"New Chat"})]}):null,c&&(e!=null&&e.isComposerEnabled)?s.jsxs("button",{type:"button","aria-label":"Start new agent",title:"New Agent","aria-current":f?"page":void 0,className:re({variant:"ghost",className:W(Xe,f&&Ye)}),onClick:p,children:[s.jsx(V,{name:"agent-2",size:14}),s.jsx("span",{className:"text-center whitespace-nowrap",children:"Build Agent"})]}):null,s.jsx(t,{compact:!0}),s.jsx(o,{compact:!0}),s.jsx(r,{compact:!0}),s.jsx(i,{compact:!0})]})}function Ar({className:n,railRef:e,...t}){const o=lt(),r=dt(o),i=T("BrandLogo"),c=T("UserAvatar");return s.jsxs("aside",{ref:e,className:W(Tr,"flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar-bg",n),...t,children:[s.jsx("div",{className:"flex h-14 w-full shrink-0 items-center justify-center text-text-primary",children:s.jsx(i,{variant:r.collapsedVariant,className:Cr})}),s.jsx(Er,{}),s.jsxs("footer",{className:"flex shrink-0 flex-col items-center border-border p-2",children:[s.jsx(ut,{labeled:!0,className:"flex-col"}),s.jsx(c,{labeled:!0,className:"mt-2 py-1.5"})]})]})}function Dr({drawerRef:n,onClose:e}){const t=lt(),o=dt(t),r=Hn(),i=T("BrandLogo"),c=T("UserAvatar");return s.jsxs("aside",{ref:n,role:"dialog","aria-label":"Navigation",tabIndex:-1,className:W(Rr,"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:[s.jsxs("div",{className:"flex h-14 w-full shrink-0 items-center gap-2 border-b border-border px-3 text-text-primary",children:[s.jsx(i,{variant:o.expandedVariant,className:Lr}),o.showTitle&&r!=null?s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:r}):s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx("button",{type:"button","aria-label":"Close navigation",className:re({variant:"ghost",size:"icon"}),onClick:e,children:s.jsx(V,{name:"xmark"})})]}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(tn,{variant:"mobile-drawer",onThreadOpen:e})}),s.jsxs("footer",{className:"flex shrink-0 items-center justify-around gap-1 border-t border-border p-2 text-sidebar-text",children:[s.jsx(ut,{labeled:!0,onAction:e,className:"contents"}),s.jsx(c,{labeled:!0})]})]})}function Ur({className:n}){const e=ie(),t=De(),o=T("AgentDetailsPage"),r=T("AgentsLibrary"),i=T("SessionsPage"),c=T("ShareChatButton"),a=T("ResetAgentBuilderButton"),u=T("ClearChatButton"),d=T("SaveAgentButton"),f=T("SelectAgentEmptyState"),[l,p]=m.useState(!1),[h,g]=m.useState(!1),v=m.useRef(null),y=m.useRef(null),I=m.useRef(null),S=m.useRef(!1),j=(e==null?void 0:e.mode.status)==="idle",D=(e==null?void 0:e.settingsOpen)===!0,N=(e==null?void 0:e.libraryOpen)===!0,U=N&&(e==null?void 0:e.libraryAgentId)==null,F=(e==null?void 0:e.sessionsOpen)===!0,G=(e==null?void 0:e.schedulesOpen)===!0,M=(e==null?void 0:e.environmentsOpen)===!0,C=D||N||F||G||M,E=e!=null&&ct(e.mode),_=t&&(F||G||M||E&&!D&&!N),K=E&&!C&&!t,ee=Nr({overlayOpen:C,mode:e==null?void 0:e.mode}),Q=Fn(),te=t&&(D||U),Y=()=>p(!1),q=s.jsx("button",{ref:v,type:"button","aria-label":"Navigation","aria-expanded":l,className:W(re({variant:"ghost",size:"icon"}),"md:hidden"),onClick:()=>p(!0),children:s.jsx(V,{name:"panel-left"})});return m.useEffect(()=>{if(!l)return;const O=x=>{x.key==="Escape"&&(x.stopImmediatePropagation(),p(!1))};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[l]),m.useEffect(()=>{var x,b;const O=I.current;if(l){S.current=!0,O&&(O.inert=!0),(x=y.current)==null||x.focus();return}S.current&&(O&&(O.inert=!1),(b=v.current)==null||b.focus(),S.current=!1)},[l]),s.jsxs("div",{className:W("relative flex h-full min-h-0 w-full min-w-0",n),children:[s.jsx(Ar,{className:"hidden md:flex"}),K?s.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:max-w-140 md:flex-1 md:shadow-none 2xl:max-w-150",children:s.jsx(Vn,{})}):null,s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-primary-bg",children:[te?null:s.jsx(Kn,{className:W("bg-topbar-bg",(C||j||!Q||_)&&"md:hidden"),start:q,title:!C&&!_?s.jsx(Wn,{}):null,end:!C&&!_?s.jsxs(s.Fragment,{children:[s.jsx(a,{}),s.jsx(c,{}),s.jsx(u,{}),s.jsx(d,{})]}):null}),s.jsx(zn,{children:s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[ee?s.jsx(Pr,{collapsed:h,onCollapsedChange:g}):null,s.jsx("div",{ref:I,className:"min-h-0 min-w-0 flex-1",children:D?s.jsx(m.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(ye,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(jr,{...te?{headerStart:q}:{}})}):_?s.jsx($n,{}):F?s.jsx(i,{}):N&&(e==null?void 0:e.libraryAgentId)!=null?s.jsx(o,{agentId:e.libraryAgentId},e.libraryAgentId):N?s.jsx(r,{onSelectAgent:Y,...te?{headerStart:q}:{}}):G?s.jsx(m.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(ye,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(Mr,{})}):M?s.jsx(m.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(ye,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(Sr,{})}):j?s.jsx(f,{}):s.jsx(Xn,{})})]})})]}),l?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":"Close navigation backdrop",className:"absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden",onClick:Y}),s.jsx(Dr,{drawerRef:y,onClose:Y})]}):null]})}export{Ur as SidebarLayout};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as J}from"./chunk-LFIIKLPG-
|
|
1
|
+
import{C as J}from"./chunk-LFIIKLPG-DcaznAz-.js";import{bE as V,p as W,q as X,r as l,x as U,j as e,S as Y,E,I as G,bG as Z,aa as k,_ as z}from"./index-aDyvsTqL.js";var ee=({open:s,onOpenChange:c,onImport:d,busy:p=!1,error:y})=>{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{}},L=!!(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(G,{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:k("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:k("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:k("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:k("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:k("h-11")})]}),e.jsxs("div",{className:"space-y-3",children:[y?e.jsx("p",{className:"text-failure-bg text-sm",children:y}):null,e.jsx(E.Primary,{type:"submit",disabled:!L,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}=V(),c=W(),d=X(),[p,y]=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,L]=l.useState(!1),[a,q]=l.useState(!1),[D,F]=l.useState(null),[P,I]=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(U(t,"Failed to load skills"))}finally{j(!1)}}},[s]);l.useEffect(()=>{M()},[M]);const S=p.trim().toLowerCase(),w=l.useMemo(()=>i.filter(t=>B(S,t.name,t.description)),[i,S]),R=l.useMemo(()=>{const t=new Set(i.flatMap(r=>se(r)?[r.catalogId]:[]));return m.filter(r=>!t.has(r.id)&&B(S,r.name,r.description))},[m,i,S]),_=async(t,r=x)=>{v(!0),x(null);try{await t(),await M()}catch(g){throw le(g)&&L(!0),r(U(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=>{_(async()=>{await s.createSkill({catalogId:t.id,name:t.name,description:t.description,repoURL:t.repoURL,path:t.path,ref:t.ref}),d(z.Settings.SKILL_IMPORTED,{skill_name:t.name})}).catch(()=>{})},K=()=>{o||(F(null),I(null))},$=t=>{const r=s.deleteSkill;r&&(I(null),_(async()=>{await r({id:t.id}),d(z.Settings.SKILL_DELETED,{skill_name:t.name}),F(null)},I).catch(()=>{}))},H=async t=>{h(null),await _(async()=>{await s.createSkill(t)},h),setTimeout(()=>{c==null||c.showSuccess({title:`${t.name} imported`}),d(z.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(G,{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=w.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:y,placeholder:"Search skills"})}),e.jsxs(E.Secondary,{type:"button",className:"shrink-0",disabled:o||f,onClick:()=>{h(null),q(!0)},children:[e.jsx(G,{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&&w.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 · ",w.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:w.map(t=>O({key:t.id,name:t.name,description:t.description,action:s.deleteSkill?e.jsx(E.Secondary,{size:"small",type:"button",disabled:o||f,"aria-label":`Remove ${t.name}`,onClick:()=>{I(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(E.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:S?`No skills match “${p.trim()}”.`:"No skills yet."}):null]})]}),D?e.jsx(J,{title:"Remove skill?",description:`“${D.name}” will no longer be available to your agents.`,busy:o,error:P,onCancel:K,onConfirm:()=>{$(D)}}):null,e.jsx(te,{open:a,onOpenChange:t=>{q(t),t||h(null)},onImport:H,busy:o||f,error:b})]})},ne=ae;export{ne as default};
|
|
Binary file
|
|
Binary file
|