@truefoundry/trueforge 0.187.0-rc.1 → 0.187.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_frontend/assets/{AgentCodeSnippets-IQBCA7PK-BjFskF44.js → AgentCodeSnippets-KRNZUDA3-CNnaws58.js} +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-KRNZUDA3-CNnaws58.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-KRNZUDA3-CNnaws58.js.gz +0 -0
- package/dist/_frontend/assets/{AgentMetricChart-7V42QCLW-B6i3t-3u.js → AgentMetricChart-OV2LLPBQ-DW-hRGPF.js} +1 -1
- package/dist/_frontend/assets/AgentMetricChart-OV2LLPBQ-DW-hRGPF.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-OV2LLPBQ-DW-hRGPF.js.gz +0 -0
- package/dist/_frontend/assets/{AgentOverview-NUS7DF3V-BLN7Mc1A.js → AgentOverview-DIVQXYTD-Dk4w7kJi.js} +1 -1
- package/dist/_frontend/assets/AgentOverview-DIVQXYTD-Dk4w7kJi.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-DIVQXYTD-Dk4w7kJi.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimeline-YV5IMM36-CjuIEqY5.js → AgentSessionEventTimeline-B37KD6JC-BBlyCGa-.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimeline-B37KD6JC-BBlyCGa-.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-B37KD6JC-BBlyCGa-.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimelineChart-T47VTMR6-cJdpKneN.js → AgentSessionEventTimelineChart-GGVUJ6AM-sRgpwM2S.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-GGVUJ6AM-sRgpwM2S.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-GGVUJ6AM-sRgpwM2S.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessions-JVLIS2OC-DfKqLMq_.js → AgentSessions-WLZRCGYQ-BaQt6Mdz.js} +1 -1
- package/dist/_frontend/assets/AgentSessions-WLZRCGYQ-BaQt6Mdz.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-WLZRCGYQ-BaQt6Mdz.js.gz +0 -0
- package/dist/_frontend/assets/{AppearanceSettings-EY2WXRWB-C3VtWEAm.js → AppearanceSettings-UEYHOB2J-DmthQL1S.js} +1 -1
- package/dist/_frontend/assets/AppearanceSettings-UEYHOB2J-DmthQL1S.js.br +0 -0
- package/dist/_frontend/assets/AppearanceSettings-UEYHOB2J-DmthQL1S.js.gz +0 -0
- package/dist/_frontend/assets/{ConnectorSettings-X6OHZ6KA-u4N4OWzr.js → ConnectorSettings-VQ7CTUM5-BLj1QcxG.js} +1 -1
- package/dist/_frontend/assets/ConnectorSettings-VQ7CTUM5-BLj1QcxG.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-VQ7CTUM5-BLj1QcxG.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-SEEHTHCB-qMMUFfFT.js → DockLayout-AEFR44GJ-Cvdwne2I.js} +1 -1
- package/dist/_frontend/assets/{DrawerLayout-DPIUGY42-Bxv9hChU.js → DrawerLayout-IMYRUVVF-9mp6LCtM.js} +2 -2
- package/dist/_frontend/assets/DrawerLayout-IMYRUVVF-9mp6LCtM.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-IMYRUVVF-9mp6LCtM.js.gz +0 -0
- package/dist/_frontend/assets/{EnvironmentsPage-EUA7T7IZ-B9cZm1H2.js → EnvironmentsPage-I4OX4N6O-CaSrJiI0.js} +1 -1
- package/dist/_frontend/assets/EnvironmentsPage-I4OX4N6O-CaSrJiI0.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-I4OX4N6O-CaSrJiI0.js.gz +0 -0
- package/dist/_frontend/assets/{MemorySettings-7IT3OBVB-CXPWhBSp.js → MemorySettings-6Y7OQGBZ-Cx6tkpwR.js} +1 -1
- package/dist/_frontend/assets/MemorySettings-6Y7OQGBZ-Cx6tkpwR.js.br +0 -0
- package/dist/_frontend/assets/MemorySettings-6Y7OQGBZ-Cx6tkpwR.js.gz +0 -0
- package/dist/_frontend/assets/{ModelSettings-PNXNGQ5L-ePcg3Aqh.js → ModelSettings-PXQVXZIW-Bq8R7Ku5.js} +1 -1
- package/dist/_frontend/assets/ModelSettings-PXQVXZIW-Bq8R7Ku5.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-PXQVXZIW-Bq8R7Ku5.js.gz +0 -0
- package/dist/_frontend/assets/{SandboxSettings-H5NXXJGM-D5w4szt5.js → SandboxSettings-IH7HAGW2-BtilbrtJ.js} +1 -1
- package/dist/_frontend/assets/SandboxSettings-IH7HAGW2-BtilbrtJ.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-IH7HAGW2-BtilbrtJ.js.gz +0 -0
- package/dist/_frontend/assets/{SchedulesPage-CAQD2Q4F-CO8Z5teK.js → SchedulesPage-I52TNBAZ-ClnGQZ5d.js} +1 -1
- package/dist/_frontend/assets/SchedulesPage-I52TNBAZ-ClnGQZ5d.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-I52TNBAZ-ClnGQZ5d.js.gz +0 -0
- package/dist/_frontend/assets/{SettingsBuilder-YMBHISA3-BXfV41lI.js → SettingsBuilder-OKV2POOV-CsW3joKv.js} +2 -2
- package/dist/_frontend/assets/SettingsBuilder-OKV2POOV-CsW3joKv.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-OKV2POOV-CsW3joKv.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-RMJGHQAP-c5W1ir3h.js +1 -0
- package/dist/_frontend/assets/ShellRouteSync-RMJGHQAP-c5W1ir3h.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-RMJGHQAP-c5W1ir3h.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-LHUY6YNV-BWILGqg4.js +2 -0
- package/dist/_frontend/assets/SidebarLayout-LHUY6YNV-BWILGqg4.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-LHUY6YNV-BWILGqg4.js.gz +0 -0
- package/dist/_frontend/assets/{SkillSettings-NVL4XWDS-BYXZ85YV.js → SkillSettings-DNSX7ANY-DCUzAc7H.js} +1 -1
- package/dist/_frontend/assets/SkillSettings-DNSX7ANY-DCUzAc7H.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-DNSX7ANY-DCUzAc7H.js.gz +0 -0
- package/dist/_frontend/assets/{TrueForgeUIWithRouter-7O2WTUMN-B1RH13sW.js → TrueForgeUIWithRouter-4U734LMX-C0-HJ0AT.js} +1 -1
- package/dist/_frontend/assets/{WebSearchSettings-QHDG5HBJ-BnNzyKFb.js → WebSearchSettings-A7WZKVHW-l95PltgD.js} +1 -1
- package/dist/_frontend/assets/WebSearchSettings-A7WZKVHW-l95PltgD.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-A7WZKVHW-l95PltgD.js.gz +0 -0
- package/dist/_frontend/assets/{WidgetLayout-VSLU2TXO-DRJouw53.js → WidgetLayout-4DQOLH36-CeDtG2Zz.js} +1 -1
- package/dist/_frontend/assets/WidgetLayout-4DQOLH36-CeDtG2Zz.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-4DQOLH36-CeDtG2Zz.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-2PBSR643-DucDomKE.js → chunk-4QN7ONBR-CtFqtChE.js} +1 -1
- package/dist/_frontend/assets/chunk-4QN7ONBR-CtFqtChE.js.br +0 -0
- package/dist/_frontend/assets/chunk-4QN7ONBR-CtFqtChE.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-XOQYBULH-CRvLiR9N.js → chunk-BNMKM5SY-CiR8M-oi.js} +1 -1
- package/dist/_frontend/assets/chunk-DW4YYV6Q-Cm0KW5r-.js +1 -0
- package/dist/_frontend/assets/chunk-DW4YYV6Q-Cm0KW5r-.js.br +0 -0
- package/dist/_frontend/assets/chunk-DW4YYV6Q-Cm0KW5r-.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-EAY2YDVF-BEYTBRlX.js → chunk-LBXXYCLT-bkjw_srH.js} +2 -2
- package/dist/_frontend/assets/chunk-LBXXYCLT-bkjw_srH.js.br +0 -0
- package/dist/_frontend/assets/chunk-LBXXYCLT-bkjw_srH.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-OB3PAWPO-CdLNGkFp.js → chunk-OB3PAWPO-CYqixJeQ.js} +1 -1
- package/dist/_frontend/assets/chunk-OB3PAWPO-CYqixJeQ.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-CYqixJeQ.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-OO6QO7FR-Clj6a-iP.js → chunk-OO6QO7FR-DrdcbTUi.js} +1 -1
- package/dist/_frontend/assets/chunk-OO6QO7FR-DrdcbTUi.js.br +0 -0
- package/dist/_frontend/assets/chunk-OO6QO7FR-DrdcbTUi.js.gz +0 -0
- package/dist/_frontend/assets/{cssMode-DuqNkvPv.js → cssMode-DDD53ZUi.js} +1 -1
- package/dist/_frontend/assets/cssMode-DDD53ZUi.js.br +0 -0
- package/dist/_frontend/assets/cssMode-DDD53ZUi.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-BUfzpeUx.js → freemarker2-CRj5NS3U.js} +1 -1
- package/dist/_frontend/assets/freemarker2-CRj5NS3U.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-CRj5NS3U.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-BLeRLDUd.js → handlebars-C6YyUK7_.js} +1 -1
- package/dist/_frontend/assets/handlebars-C6YyUK7_.js.br +0 -0
- package/dist/_frontend/assets/handlebars-C6YyUK7_.js.gz +0 -0
- package/dist/_frontend/assets/{html-wpJwQ7Au.js → html-CpXVWyO_.js} +1 -1
- package/dist/_frontend/assets/html-CpXVWyO_.js.br +0 -0
- package/dist/_frontend/assets/html-CpXVWyO_.js.gz +0 -0
- package/dist/_frontend/assets/{htmlMode-BWjgtyr-.js → htmlMode-Dszq47gi.js} +1 -1
- package/dist/_frontend/assets/htmlMode-Dszq47gi.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-Dszq47gi.js.gz +0 -0
- package/dist/_frontend/assets/{index-aGz8KXsj.js → index-B8Nmgjfa.js} +3 -3
- package/dist/_frontend/assets/index-B8Nmgjfa.js.br +0 -0
- package/dist/_frontend/assets/index-B8Nmgjfa.js.gz +0 -0
- package/dist/_frontend/assets/{index-DJa8qqht.css → index-BOoQko_5.css} +1 -1
- package/dist/_frontend/assets/index-BOoQko_5.css.br +0 -0
- package/dist/_frontend/assets/index-BOoQko_5.css.gz +0 -0
- package/dist/_frontend/assets/{index-DdfF63OT.js → index-C5ROvRRa.js} +279 -279
- package/dist/_frontend/assets/index-C5ROvRRa.js.br +0 -0
- package/dist/_frontend/assets/index-C5ROvRRa.js.gz +0 -0
- package/dist/_frontend/assets/{javascript-680NVpb6.js → javascript-B88igjtP.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-B1wjPa_B.js → jsonMode-BZzU_TMA.js} +1 -1
- package/dist/_frontend/assets/jsonMode-BZzU_TMA.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-BZzU_TMA.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-DLZXw_l9.js → liquid-Brdo2hkK.js} +1 -1
- package/dist/_frontend/assets/liquid-Brdo2hkK.js.br +0 -0
- package/dist/_frontend/assets/liquid-Brdo2hkK.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-D2El5kWs.js → lspLanguageFeatures-DacM8YTI.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-DacM8YTI.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-DacM8YTI.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-BzqZXT2Y.js → mdx-Rpde0mTI.js} +1 -1
- package/dist/_frontend/assets/mdx-Rpde0mTI.js.br +0 -0
- package/dist/_frontend/assets/mdx-Rpde0mTI.js.gz +0 -0
- package/dist/_frontend/assets/{python-CL4qUpZU.js → python-BdIx5c_G.js} +1 -1
- package/dist/_frontend/assets/python-BdIx5c_G.js.br +0 -0
- package/dist/_frontend/assets/python-BdIx5c_G.js.gz +0 -0
- package/dist/_frontend/assets/{razor-Dx9DYEQN.js → razor-DA1tjeuw.js} +1 -1
- package/dist/_frontend/assets/razor-DA1tjeuw.js.br +0 -0
- package/dist/_frontend/assets/razor-DA1tjeuw.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-BSSS0gzy.js → tsMode-CXE4YxbN.js} +1 -1
- package/dist/_frontend/assets/tsMode-CXE4YxbN.js.br +0 -0
- package/dist/_frontend/assets/tsMode-CXE4YxbN.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-BFmTNmj1.js → typescript-Chefx5R7.js} +1 -1
- package/dist/_frontend/assets/typescript-Chefx5R7.js.br +0 -0
- package/dist/_frontend/assets/typescript-Chefx5R7.js.gz +0 -0
- package/dist/_frontend/assets/{workers-DJIs8BcT.js → workers-EMqh1N7k.js} +1 -1
- package/dist/_frontend/assets/workers-EMqh1N7k.js.br +0 -0
- package/dist/_frontend/assets/workers-EMqh1N7k.js.gz +0 -0
- package/dist/_frontend/assets/{xml-D3m5kfkf.js → xml-BXOoSnTt.js} +1 -1
- package/dist/_frontend/assets/xml-BXOoSnTt.js.br +0 -0
- package/dist/_frontend/assets/xml-BXOoSnTt.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-DFIuplXI.js → yaml-CvUTtZnk.js} +1 -1
- package/dist/_frontend/assets/yaml-CvUTtZnk.js.br +0 -0
- package/dist/_frontend/assets/yaml-CvUTtZnk.js.gz +0 -0
- package/dist/_frontend/index.html +2 -2
- package/package.json +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-IQBCA7PK-BjFskF44.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-IQBCA7PK-BjFskF44.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-7V42QCLW-B6i3t-3u.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-7V42QCLW-B6i3t-3u.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-NUS7DF3V-BLN7Mc1A.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-NUS7DF3V-BLN7Mc1A.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-YV5IMM36-CjuIEqY5.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-YV5IMM36-CjuIEqY5.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-T47VTMR6-cJdpKneN.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-T47VTMR6-cJdpKneN.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-JVLIS2OC-DfKqLMq_.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-JVLIS2OC-DfKqLMq_.js.gz +0 -0
- package/dist/_frontend/assets/AppearanceSettings-EY2WXRWB-C3VtWEAm.js.br +0 -0
- package/dist/_frontend/assets/AppearanceSettings-EY2WXRWB-C3VtWEAm.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-X6OHZ6KA-u4N4OWzr.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-X6OHZ6KA-u4N4OWzr.js.gz +0 -0
- package/dist/_frontend/assets/DrawerLayout-DPIUGY42-Bxv9hChU.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-DPIUGY42-Bxv9hChU.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-EUA7T7IZ-B9cZm1H2.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-EUA7T7IZ-B9cZm1H2.js.gz +0 -0
- package/dist/_frontend/assets/MemorySettings-7IT3OBVB-CXPWhBSp.js.br +0 -0
- package/dist/_frontend/assets/MemorySettings-7IT3OBVB-CXPWhBSp.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-PNXNGQ5L-ePcg3Aqh.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-PNXNGQ5L-ePcg3Aqh.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-H5NXXJGM-D5w4szt5.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-H5NXXJGM-D5w4szt5.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-CAQD2Q4F-CO8Z5teK.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-CAQD2Q4F-CO8Z5teK.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-YMBHISA3-BXfV41lI.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-YMBHISA3-BXfV41lI.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-RY46ZMDU-9e9CFMDE.js +0 -1
- package/dist/_frontend/assets/ShellRouteSync-RY46ZMDU-9e9CFMDE.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-RY46ZMDU-9e9CFMDE.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-DSB56OFA-CjOToD_g.js +0 -2
- package/dist/_frontend/assets/SidebarLayout-DSB56OFA-CjOToD_g.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-DSB56OFA-CjOToD_g.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-NVL4XWDS-BYXZ85YV.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-NVL4XWDS-BYXZ85YV.js.gz +0 -0
- package/dist/_frontend/assets/WebSearchSettings-QHDG5HBJ-BnNzyKFb.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-QHDG5HBJ-BnNzyKFb.js.gz +0 -0
- package/dist/_frontend/assets/WidgetLayout-VSLU2TXO-DRJouw53.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-VSLU2TXO-DRJouw53.js.gz +0 -0
- package/dist/_frontend/assets/chunk-2PBSR643-DucDomKE.js.br +0 -0
- package/dist/_frontend/assets/chunk-2PBSR643-DucDomKE.js.gz +0 -0
- package/dist/_frontend/assets/chunk-EAY2YDVF-BEYTBRlX.js.br +0 -0
- package/dist/_frontend/assets/chunk-EAY2YDVF-BEYTBRlX.js.gz +0 -0
- package/dist/_frontend/assets/chunk-KWC2LXMU-DxiqJRhP.js +0 -1
- package/dist/_frontend/assets/chunk-KWC2LXMU-DxiqJRhP.js.br +0 -0
- package/dist/_frontend/assets/chunk-KWC2LXMU-DxiqJRhP.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-CdLNGkFp.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-CdLNGkFp.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OO6QO7FR-Clj6a-iP.js.br +0 -0
- package/dist/_frontend/assets/chunk-OO6QO7FR-Clj6a-iP.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-DuqNkvPv.js.br +0 -0
- package/dist/_frontend/assets/cssMode-DuqNkvPv.js.gz +0 -0
- package/dist/_frontend/assets/freemarker2-BUfzpeUx.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-BUfzpeUx.js.gz +0 -0
- package/dist/_frontend/assets/handlebars-BLeRLDUd.js.br +0 -0
- package/dist/_frontend/assets/handlebars-BLeRLDUd.js.gz +0 -0
- package/dist/_frontend/assets/html-wpJwQ7Au.js.br +0 -0
- package/dist/_frontend/assets/html-wpJwQ7Au.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-BWjgtyr-.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-BWjgtyr-.js.gz +0 -0
- package/dist/_frontend/assets/index-DJa8qqht.css.br +0 -0
- package/dist/_frontend/assets/index-DJa8qqht.css.gz +0 -0
- package/dist/_frontend/assets/index-DdfF63OT.js.br +0 -0
- package/dist/_frontend/assets/index-DdfF63OT.js.gz +0 -0
- package/dist/_frontend/assets/index-aGz8KXsj.js.br +0 -0
- package/dist/_frontend/assets/index-aGz8KXsj.js.gz +0 -0
- package/dist/_frontend/assets/jsonMode-B1wjPa_B.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-B1wjPa_B.js.gz +0 -0
- package/dist/_frontend/assets/liquid-DLZXw_l9.js.br +0 -0
- package/dist/_frontend/assets/liquid-DLZXw_l9.js.gz +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-D2El5kWs.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-D2El5kWs.js.gz +0 -0
- package/dist/_frontend/assets/mdx-BzqZXT2Y.js.br +0 -0
- package/dist/_frontend/assets/mdx-BzqZXT2Y.js.gz +0 -0
- package/dist/_frontend/assets/python-CL4qUpZU.js.br +0 -0
- package/dist/_frontend/assets/python-CL4qUpZU.js.gz +0 -0
- package/dist/_frontend/assets/razor-Dx9DYEQN.js.br +0 -0
- package/dist/_frontend/assets/razor-Dx9DYEQN.js.gz +0 -0
- package/dist/_frontend/assets/tsMode-BSSS0gzy.js.br +0 -0
- package/dist/_frontend/assets/tsMode-BSSS0gzy.js.gz +0 -0
- package/dist/_frontend/assets/typescript-BFmTNmj1.js.br +0 -0
- package/dist/_frontend/assets/typescript-BFmTNmj1.js.gz +0 -0
- package/dist/_frontend/assets/workers-DJIs8BcT.js.br +0 -0
- package/dist/_frontend/assets/workers-DJIs8BcT.js.gz +0 -0
- package/dist/_frontend/assets/xml-D3m5kfkf.js.br +0 -0
- package/dist/_frontend/assets/xml-D3m5kfkf.js.gz +0 -0
- package/dist/_frontend/assets/yaml-DFIuplXI.js.br +0 -0
- package/dist/_frontend/assets/yaml-DFIuplXI.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as G}from"./chunk-XOQYBULH-CRvLiR9N.js";import{bV as Y,$ as Z,a0 as H,r as a,x as L,ch as J,j as e,I as T,ab as O,bY as Q,bZ as W,b_ as ee,g as te,b$ as se,at as $,aE as ae}from"./index-DdfF63OT.js";var ne={execTimeoutMs:3e5,autoStopIntervalInMinutes:15,autoArchiveIntervalInMinutes:10080,autoDeleteIntervalInMinutes:43200},E=ae("h-11 shadow-sm");function R(n){if(n.trim()==="")return null;const r=Number(n);return!Number.isFinite(r)||r<0?null:r}var re=({open:n,onOpenChange:r,onSave:p,title:c,description:z,initialConfig:y=null,requireApiKey:j=!0,busy:M=!1,error:w})=>{const[k,m]=a.useState(""),[D,d]=a.useState(""),[u,S]=a.useState(""),[l,x]=a.useState(""),[o,b]=a.useState(""),[N,h]=a.useState(!1),P=()=>{m(""),d(""),S(""),x(""),b(""),h(!1)};a.useEffect(()=>{if(!n)return;const s=y??ne;m(String(s.execTimeoutMs)),d(String(s.autoStopIntervalInMinutes)),S(String(s.autoArchiveIntervalInMinutes)),x(String(s.autoDeleteIntervalInMinutes)),b(""),h(!1)},[n,y]);const I=s=>{s||P(),r(s)},f=R(k),v=R(D),g=R(u),A=R(l),C=o.trim(),_=(!j||!!C)&&f!=null&&v!=null&&g!=null&&A!=null,B=async s=>{if(s.preventDefault(),!(!_||M||f==null||v==null||g==null||A==null))try{await p({execTimeoutMs:f,autoStopIntervalInMinutes:v,autoArchiveIntervalInMinutes:g,autoDeleteIntervalInMinutes:A,apiKey:C}),P(),r(!1)}catch{}};return e.jsx(Q,{open:n,onOpenChange:I,title:c,description:z,contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:B,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"sandbox-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",j?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"sandbox-api-key",type:"password",required:j,value:o,onChange:s=>{b(s.target.value)},placeholder:j?"dtn_...":"Leave blank to keep existing",autoFocus:!0,className:E})]}),e.jsxs(W,{expanded:N,onChange:(s,K)=>h(K),className:"rounded-md border border-border",children:[e.jsx(ee,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced settings",e.jsx(T,{name:"chevron-down",className:te("size-4 shrink-0 text-text-secondary transition-transform duration-200",N?"rotate-0":"-rotate-90")})]})}),e.jsxs(se,{className:"space-y-4 border-t border-border px-3 pb-3 pt-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-exec-timeout",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Exec timeout (ms)"}),e.jsx("input",{id:"sandbox-exec-timeout",type:"number",min:0,required:!0,value:k,onChange:s=>{m(s.target.value)},placeholder:"300000",className:E})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-stop",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-stop interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-stop",type:"number",min:0,required:!0,value:D,onChange:s=>{d(s.target.value)},placeholder:"15",className:E})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-archive",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-archive interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-archive",type:"number",min:0,required:!0,value:u,onChange:s=>{S(s.target.value)},placeholder:"10080",className:E})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-delete",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-delete interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-delete",type:"number",min:0,required:!0,value:l,onChange:s=>{x(s.target.value)},placeholder:"43200",className:E})]})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[w?e.jsx("p",{className:"text-failure-bg text-sm",children:w}):null,e.jsx(O.Primary,{type:"submit",size:"large",disabled:!_||M,className:"w-full shrink-0",children:"Save"})]})]})})},le=re,U=({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:p,autoDeleteIntervalInMinutes:c})=>({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:p,autoDeleteIntervalInMinutes:c}),oe=()=>{const{sandboxCatalog:n}=Y(),r=Z(),p=H(),[c,z]=a.useState([]),[y,j]=a.useState([]),[M,w]=a.useState(!0),[k,m]=a.useState(null),[D,d]=a.useState(null),[u,S]=a.useState(!1),[l,x]=a.useState(null),[o,b]=a.useState(null),[N,h]=a.useState(null),[P,I]=a.useState(null),f=a.useCallback(async({quiet:t=!1}={})=>{if(n){t||w(!0),m(null);try{const[i,F]=await Promise.all([n.listSandboxProviders(),n.getSandboxProviderCatalog()]);z(i),j(F)}catch(i){m(L(i,"Failed to load sandbox providers"))}finally{t||w(!1)}}},[n]);a.useEffect(()=>{f()},[f]);const v=c.length>0,g=a.useMemo(()=>{if(v)return[];const t=new Set(c.map(i=>i.catalogId));return y.filter(i=>!t.has(i.id))},[y,c,v]),A=a.useMemo(()=>{const t=o??l;return t==null||!J(t)?null:U(t)},[o,l]);if(!n)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Sandbox provider catalog is not available."});const C=async(t,i=m)=>{S(!0),m(null);try{await t(),await f({quiet:!0})}catch(F){throw i(L(F,"Request failed")),F}finally{S(!1)}},_=async t=>{l&&(d(null),await C(async()=>{await n.createSandboxProvider({catalogId:l.id,name:l.name,type:l.type,...U(t),apiKey:t.apiKey})},d),x(null),setTimeout(()=>{r==null||r.showSuccess({title:`${l.name} configured`}),p($.Settings.SANDBOX_PROVIDER_SAVED,{provider_name:l.name,mode:"create"})},0))},B=async t=>{o&&(d(null),await C(async()=>{await n.updateSandboxProvider({id:o.id,...U(t),...t.apiKey?{apiKey:t.apiKey}:{}})},d),b(null),setTimeout(()=>{r==null||r.showSuccess({title:`${o.name} updated`}),p($.Settings.SANDBOX_PROVIDER_SAVED,{provider_name:o.name,mode:"update"})},0))},s=()=>{u||(h(null),I(null))},K=t=>{const i=n.deleteSandboxProvider;i&&(I(null),C(async()=>{await i({id:t.id}),p($.Settings.SANDBOX_PROVIDER_DELETED,{provider_name:t.name}),h(null)},I).catch(()=>{}))},q=l!=null||o!=null,V=o!=null,X=o?`Update ${o.name}`:l?`Configure ${l.name}`:"Configure sandbox provider";return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Sandbox providers"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Choose a provider that runs sandboxes for code, files and shell commands. Only one can be active at a time."}),k?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:k}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-auto",children:M?e.jsx("p",{className:"text-sm text-text-secondary",children:"Loading sandbox providers…"}):e.jsxs("div",{className:"space-y-6",children:[c.length>0?e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Configured · ",c.length]}),e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:[c.map(t=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-success-bg",children:[e.jsx("span",{className:"size-2 rounded-full bg-success-bg","aria-hidden":!0}),"Connected"]}),e.jsx(O.Secondary,{size:"small",type:"button",disabled:u,onClick:()=>{d(null),x(null),b(t)},children:"Update"}),n.deleteSandboxProvider?e.jsx(O.Ghost,{size:"small",className:"text-text-secondary",type:"button",disabled:u,onClick:()=>{I(null),h(t)},children:"Remove"}):null]})]},t.id))," "]})]}):null,v?null:e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available · ",g.length]}),g.length===0?e.jsx("p",{className:"text-sm text-text-secondary",children:y.length>0?"All catalog providers are configured.":"No sandbox providers in the catalog."}):e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:g.map(t=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsx(O.Secondary,{type:"button",disabled:u,onClick:()=>{d(null),b(null),x(t)},children:"Configure"})]},t.id))})]})]})}),N?e.jsx(G,{title:"Remove sandbox provider?",description:`“${N.name}” will stop running sandboxes for code, files and shell commands.`,busy:u,error:P,onCancel:s,onConfirm:()=>{K(N)}}):null,e.jsx(le,{open:q,onOpenChange:t=>{t||(d(null),x(null),b(null))},onSave:V?B:_,title:X,description:V?"Update this sandbox provider. Leave API key blank to keep the existing key.":"Configure this sandbox provider. API key is never stored in the catalog.",initialConfig:A,requireApiKey:!V,busy:u,error:D})]})},ce=oe;export{ce as default};
|
|
1
|
+
import{C as G}from"./chunk-BNMKM5SY-CiR8M-oi.js";import{bV as Y,$ as Z,a0 as H,r as a,x as L,ch as J,j as e,I as T,ab as O,bY as Q,bZ as W,b_ as ee,g as te,b$ as se,at as $,aE as ae}from"./index-C5ROvRRa.js";var ne={execTimeoutMs:3e5,autoStopIntervalInMinutes:15,autoArchiveIntervalInMinutes:10080,autoDeleteIntervalInMinutes:43200},E=ae("h-11 shadow-sm");function R(n){if(n.trim()==="")return null;const r=Number(n);return!Number.isFinite(r)||r<0?null:r}var re=({open:n,onOpenChange:r,onSave:p,title:c,description:z,initialConfig:y=null,requireApiKey:j=!0,busy:M=!1,error:w})=>{const[k,m]=a.useState(""),[D,d]=a.useState(""),[u,S]=a.useState(""),[l,x]=a.useState(""),[o,b]=a.useState(""),[N,h]=a.useState(!1),P=()=>{m(""),d(""),S(""),x(""),b(""),h(!1)};a.useEffect(()=>{if(!n)return;const s=y??ne;m(String(s.execTimeoutMs)),d(String(s.autoStopIntervalInMinutes)),S(String(s.autoArchiveIntervalInMinutes)),x(String(s.autoDeleteIntervalInMinutes)),b(""),h(!1)},[n,y]);const I=s=>{s||P(),r(s)},f=R(k),v=R(D),g=R(u),A=R(l),C=o.trim(),_=(!j||!!C)&&f!=null&&v!=null&&g!=null&&A!=null,B=async s=>{if(s.preventDefault(),!(!_||M||f==null||v==null||g==null||A==null))try{await p({execTimeoutMs:f,autoStopIntervalInMinutes:v,autoArchiveIntervalInMinutes:g,autoDeleteIntervalInMinutes:A,apiKey:C}),P(),r(!1)}catch{}};return e.jsx(Q,{open:n,onOpenChange:I,title:c,description:z,contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:B,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"sandbox-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",j?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"sandbox-api-key",type:"password",required:j,value:o,onChange:s=>{b(s.target.value)},placeholder:j?"dtn_...":"Leave blank to keep existing",autoFocus:!0,className:E})]}),e.jsxs(W,{expanded:N,onChange:(s,K)=>h(K),className:"rounded-md border border-border",children:[e.jsx(ee,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced settings",e.jsx(T,{name:"chevron-down",className:te("size-4 shrink-0 text-text-secondary transition-transform duration-200",N?"rotate-0":"-rotate-90")})]})}),e.jsxs(se,{className:"space-y-4 border-t border-border px-3 pb-3 pt-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-exec-timeout",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Exec timeout (ms)"}),e.jsx("input",{id:"sandbox-exec-timeout",type:"number",min:0,required:!0,value:k,onChange:s=>{m(s.target.value)},placeholder:"300000",className:E})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-stop",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-stop interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-stop",type:"number",min:0,required:!0,value:D,onChange:s=>{d(s.target.value)},placeholder:"15",className:E})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-archive",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-archive interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-archive",type:"number",min:0,required:!0,value:u,onChange:s=>{S(s.target.value)},placeholder:"10080",className:E})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-delete",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-delete interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-delete",type:"number",min:0,required:!0,value:l,onChange:s=>{x(s.target.value)},placeholder:"43200",className:E})]})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[w?e.jsx("p",{className:"text-failure-bg text-sm",children:w}):null,e.jsx(O.Primary,{type:"submit",size:"large",disabled:!_||M,className:"w-full shrink-0",children:"Save"})]})]})})},le=re,U=({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:p,autoDeleteIntervalInMinutes:c})=>({execTimeoutMs:n,autoStopIntervalInMinutes:r,autoArchiveIntervalInMinutes:p,autoDeleteIntervalInMinutes:c}),oe=()=>{const{sandboxCatalog:n}=Y(),r=Z(),p=H(),[c,z]=a.useState([]),[y,j]=a.useState([]),[M,w]=a.useState(!0),[k,m]=a.useState(null),[D,d]=a.useState(null),[u,S]=a.useState(!1),[l,x]=a.useState(null),[o,b]=a.useState(null),[N,h]=a.useState(null),[P,I]=a.useState(null),f=a.useCallback(async({quiet:t=!1}={})=>{if(n){t||w(!0),m(null);try{const[i,F]=await Promise.all([n.listSandboxProviders(),n.getSandboxProviderCatalog()]);z(i),j(F)}catch(i){m(L(i,"Failed to load sandbox providers"))}finally{t||w(!1)}}},[n]);a.useEffect(()=>{f()},[f]);const v=c.length>0,g=a.useMemo(()=>{if(v)return[];const t=new Set(c.map(i=>i.catalogId));return y.filter(i=>!t.has(i.id))},[y,c,v]),A=a.useMemo(()=>{const t=o??l;return t==null||!J(t)?null:U(t)},[o,l]);if(!n)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Sandbox provider catalog is not available."});const C=async(t,i=m)=>{S(!0),m(null);try{await t(),await f({quiet:!0})}catch(F){throw i(L(F,"Request failed")),F}finally{S(!1)}},_=async t=>{l&&(d(null),await C(async()=>{await n.createSandboxProvider({catalogId:l.id,name:l.name,type:l.type,...U(t),apiKey:t.apiKey})},d),x(null),setTimeout(()=>{r==null||r.showSuccess({title:`${l.name} configured`}),p($.Settings.SANDBOX_PROVIDER_SAVED,{provider_name:l.name,mode:"create"})},0))},B=async t=>{o&&(d(null),await C(async()=>{await n.updateSandboxProvider({id:o.id,...U(t),...t.apiKey?{apiKey:t.apiKey}:{}})},d),b(null),setTimeout(()=>{r==null||r.showSuccess({title:`${o.name} updated`}),p($.Settings.SANDBOX_PROVIDER_SAVED,{provider_name:o.name,mode:"update"})},0))},s=()=>{u||(h(null),I(null))},K=t=>{const i=n.deleteSandboxProvider;i&&(I(null),C(async()=>{await i({id:t.id}),p($.Settings.SANDBOX_PROVIDER_DELETED,{provider_name:t.name}),h(null)},I).catch(()=>{}))},q=l!=null||o!=null,V=o!=null,X=o?`Update ${o.name}`:l?`Configure ${l.name}`:"Configure sandbox provider";return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Sandbox providers"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Choose a provider that runs sandboxes for code, files and shell commands. Only one can be active at a time."}),k?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:k}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-auto",children:M?e.jsx("p",{className:"text-sm text-text-secondary",children:"Loading sandbox providers…"}):e.jsxs("div",{className:"space-y-6",children:[c.length>0?e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Configured · ",c.length]}),e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:[c.map(t=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-success-bg",children:[e.jsx("span",{className:"size-2 rounded-full bg-success-bg","aria-hidden":!0}),"Connected"]}),e.jsx(O.Secondary,{size:"small",type:"button",disabled:u,onClick:()=>{d(null),x(null),b(t)},children:"Update"}),n.deleteSandboxProvider?e.jsx(O.Ghost,{size:"small",className:"text-text-secondary",type:"button",disabled:u,onClick:()=>{I(null),h(t)},children:"Remove"}):null]})]},t.id))," "]})]}):null,v?null:e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available · ",g.length]}),g.length===0?e.jsx("p",{className:"text-sm text-text-secondary",children:y.length>0?"All catalog providers are configured.":"No sandbox providers in the catalog."}):e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:g.map(t=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(T,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsx(O.Secondary,{type:"button",disabled:u,onClick:()=>{d(null),b(null),x(t)},children:"Configure"})]},t.id))})]})]})}),N?e.jsx(G,{title:"Remove sandbox provider?",description:`“${N.name}” will stop running sandboxes for code, files and shell commands.`,busy:u,error:P,onCancel:s,onConfirm:()=>{K(N)}}):null,e.jsx(le,{open:q,onOpenChange:t=>{t||(d(null),x(null),b(null))},onSave:V?B:_,title:X,description:V?"Update this sandbox provider. Leave API key blank to keep the existing key.":"Configure this sandbox provider. API key is never stored in the catalog.",initialConfig:A,requireApiKey:!V,busy:u,error:D})]})},ce=oe;export{ce as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as ms}from"./chunk-2PBSR643-DucDomKE.js";import{W as ve,X as xs,r as u,Y as J,Z as qe,$ as Se,a0 as Qe,b as Ge,m as hs,a1 as pe,a2 as Pe,x as fs,a3 as gs,a4 as Re,a5 as Ie,a6 as ke,a7 as bs,j as e,P as ps,a8 as Ns,a9 as me,aa as He,z as Ke,ab as M,I as z,ac as js,ad as fe,ae as ys,af as vs,ag as Fe,ah as H,ai as Ss,aj as K,V as Ve,ak as ks,g as O,al as ws,am as Ts,an as Cs,ao as Es,ap as As,aq as zs,ar as Ds,as as Ps,at as V,au as Rs,av as Is,d as Fs,aw as _s,ax as ge,f as Ls,ay as Ms,az as Os,aA as $s,aB as Bs,aC as Us,aD as qs,aE as be,l as Qs,aF as Gs,aG as Hs}from"./index-DdfF63OT.js";var _e=[{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 We(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Ks(s){const a=We(),n=new Set(_e.map(c=>c.value));return[...[a,s].flatMap(c=>c==null||c.length===0||n.has(c)?[]:(n.add(c),[{value:c,label:c===a?`${c} (Local)`:c}])),..._e]}var Ye=[{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"}],Vs={"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 xe(){return{name:"",task:"",recurrence:"daily",hour:9,minute:0,weekdays:[1],customCron:"0 9 * * *",timezone:We()}}function Ws(s){return Vs[s]??s.split("/").pop()??s}function Ze(s){return s.toString().padStart(2,"0")}function ue({hour:s,minute:a}){const n=s>=12?"PM":"AM",i=s%12===0?12:s%12;return`${String(i)}:${Ze(a)} ${n}`}function Ne(s){const a=s.minute,n=s.hour;switch(s.recurrence){case"hourly":return`${String(a)} * * * *`;case"daily":return`${String(a)} ${String(n)} * * *`;case"weekly":{const i=[...s.weekdays].sort((l,p)=>l-p),c=i.length>0?i.join(","):"*";return`${String(a)} ${String(n)} * * ${c}`}case"custom":return s.customCron.trim()}}function je(s){return s.trim().split(/\s+/).length===5}function ae(s){const a=Ws(s.timezone),n=s.cron.trim().split(/\s+/);if(n.length!==5)return s.cron;const[i,c,l,p,b]=n;if(l!=="*"||p!=="*")return s.cron;const m=Number(i),x=Number(c);if(c==="*"&&b==="*"&&i!==void 0&&!Number.isNaN(m))return`Hourly at :${Ze(m)} ${a}`;if(b==="*"&&c!==void 0&&i!==void 0&&!Number.isNaN(x)&&!Number.isNaN(m))return`Daily ${ue({hour:x,minute:m})} ${a}`;if(b==="1-5"&&c!==void 0&&i!==void 0&&!Number.isNaN(x)&&!Number.isNaN(m))return`Weekdays ${ue({hour:x,minute:m})} ${a}`;if(b!=null&&/^\d(?:,\d)*$/.test(b)&&c!==void 0&&i!==void 0&&!Number.isNaN(x)&&!Number.isNaN(m)){const T=b.split(",").map(f=>{var C;return((C=Ye.find(N=>N.value===Number(f)))==null?void 0:C.label)??f});return T.length===1?`Every ${T[0]==="Mon"?"Monday":T[0]} ${ue({hour:x,minute:m})} ${a}`:`${T.join(", ")} ${ue({hour:x,minute:m})} ${a}`}return s.cron}function Le(s){const a=xe(),n=s.cron.trim().split(/\s+/);if(n.length!==5)return{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"custom",customCron:s.cron};const[i,c,l,p,b]=n,m=Number(i),x=Number(c);return l!=="*"||p!=="*"?{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"custom",customCron:s.cron}:c==="*"&&b==="*"&&!Number.isNaN(m)?{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"hourly",minute:m,customCron:s.cron}:b==="*"&&!Number.isNaN(x)&&!Number.isNaN(m)?{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"daily",hour:x,minute:m,customCron:s.cron}:b!=null&&/^\d(?:,\d)*$/.test(b)&&!Number.isNaN(x)&&!Number.isNaN(m)?{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"weekly",hour:x,minute:m,weekdays:b.split(",").map(Number),customCron:s.cron}:{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"custom",customCron:s.cron,hour:Number.isNaN(x)?a.hour:x,minute:Number.isNaN(m)?a.minute:m}}function Ys(s,a=Date.now()){return Hs(s,{fallback:"Never",nowMs:a})}var Zs=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"custom",label:"Custom"}],Js=Array.from({length:24},(s,a)=>({value:String(a),label:a.toString().padStart(2,"0")})),Xs=[0,15,30,45].map(s=>({value:String(s),label:`:${s.toString().padStart(2,"0")}`}));function et({values:s,onChange:a,agentId:n,agentLabel:i,onAgentIdChange:c,onAgentPicked:l,agentPickerDisabled:p=!1,onBuildAgent:b}){const m=Ne(s),x=ae({cron:m,timezone:s.timezone}),T=Ks(s.timezone),f=(r,j)=>{a({...s,[r]:j})},C=r=>{const j=r==="custom"&&s.recurrence!=="custom"?m:s.customCron;a({...s,recurrence:r,customCron:j})},N=r=>{const k=s.weekdays.includes(r)?s.weekdays.filter(o=>o!==r):[...s.weekdays,r];a({...s,weekdays:k.length>0?k:[r]})};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(He,{"aria-label":"Agent",placeholder:"Search agent",value:n,selectedLabel:i,onValueChange:r=>c==null?void 0:c(r),onAgentPicked:l,disabled:p||c==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:s.name,onChange:r=>f("name",r.target.value),placeholder:"harness-daily-digest",className:be("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:s.task,onChange:r=>f("task",r.target.value),rows:3,placeholder:"Summarise yesterday's harness runs and post the digest…",className:be("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:Zs.map(r=>{const j=s.recurrence===r.value;return e.jsx("button",{type:"button",className:O("rounded-md border px-2 py-2 text-sm font-medium transition-colors",j?"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":j,onClick:()=>C(r.value),children:r.label},r.value)})}),s.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:s.customCron,onChange:r=>f("customCron",r.target.value),placeholder:"0 */4 * * *",spellCheck:!1,"aria-invalid":!je(s.customCron),className:O(be("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."}),je(s.customCron)?null:e.jsx("span",{className:"mt-1 block text-xs text-failure-bg",children:"Enter exactly 5 space-separated fields."})]}):null,s.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:Ye.map(r=>{const j=s.weekdays.includes(r.value);return e.jsx("button",{type:"button",className:O("min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium",j?"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":j,onClick:()=>N(r.value),children:r.label},r.value)})})]}):null,e.jsxs("div",{className:"flex gap-4",children:[s.recurrence==="daily"||s.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(me,{"aria-label":"Hour",value:String(s.hour),options:Js,onValueChange:r=>f("hour",Number(r))})]}):null,s.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(me,{"aria-label":"Minute",value:String(s.minute),options:Xs,onValueChange:r=>f("minute",Number(r))})]}):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(me,{"aria-label":"Timezone",value:s.timezone,options:T,onValueChange:r=>f("timezone",r),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(z,{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:x||"—"}),e.jsx("code",{className:"shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary",children:m||"—"})]})})]})]})}function st(s){return s.startsWith("manual-")}function tt(s){return s==="failed"?"failed":"success"}function Je(s){return s==="failed"?"Failed":s==="triggered"?"Triggered":"Scheduled"}function Xe(s){return st(s)?"Manual test":"Cron"}function at(s,a=5){return s.filter(i=>i.status!=="scheduled").slice(0,a).reverse()}function ye(s){if(s==null)return"—";const a=new Date(s);return Number.isNaN(a.getTime())?"—":Us(a)}function nt({run:s}){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:Je(s.status)}),e.jsx("p",{className:"text-text-secondary",children:Xe(s.name)}),e.jsxs("p",{className:"text-text-secondary",children:["Scheduled for: ",ye(s.scheduledFor)]}),s.triggeredAt!=null?e.jsxs("p",{className:"text-text-secondary",children:["Triggered at: ",ye(s.triggeredAt)]}):null,e.jsxs("p",{className:"text-text-secondary",children:["Triggered by: ",s.triggeredBy]}),s.status==="failed"&&s.reason?e.jsxs("p",{className:"text-text-secondary",children:["Reason: ",s.reason]}):null]})}var rt={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 es({run:s,onOpenSession:a}){const n=tt(s.status),i=ye(s.triggeredAt??s.scheduledFor),c=`${Je(s.status)} run at ${i}`,l=O("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",rt[n]),p=e.jsx(z,{name:n==="failed"?"triangle-exclamation":"check",className:"size-3.5"});return e.jsx(Ve,{content:e.jsx(nt,{run:s}),className:"max-w-sm whitespace-normal",side:"top",children:a!=null&&s.sessionId!=null&&s.sessionId!==""?e.jsx("button",{type:"button",className:O(l,"cursor-pointer hover:brightness-95"),"aria-label":`Open session for ${c}`,onClick:()=>a(s),children:p}):e.jsx("span",{className:l,"aria-label":c,children:p})})}function ss({status:s}){const a=s==="active";return e.jsx(ms,{variant:a?"success":"warning",shape:"pill",size:"md",dot:!0,children:a?"Active":"Paused"})}function lt(s,a){return s.find(n=>n.name===a||n.id===a)??null}function it({connector:s,onConnected:a}){return Qs()==null?null:e.jsx(Gs,{connector:s,onConnected:a})}function se({label:s,children:a}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border px-3 py-2.5 last:border-b-0",children:[e.jsx("span",{className:"text-text-secondary shrink-0 text-[10px] font-semibold tracking-wide uppercase",children:s}),e.jsx("div",{className:"min-w-0 text-right text-sm text-text-primary",children:a})]})}function ct({schedule:s,agentName:a,mcpMounts:n,onEditConfiguration:i}){const c=ve(),l=Se(),{connectors:p,ensureLoaded:b,refreshConnectors:m,loading:x,error:T}=qs(),[f,C]=u.useState(!1),[N,r]=u.useState(null),j=ae({cron:s.cron,timezone:s.timezone}),k=async()=>{C(!0);try{const o=await c.createScheduleRun({scheduleId:s.id});r(o),l==null||l.showSuccess({title:"Test run started"})}catch(o){l==null||l.showError(o)}finally{C(!1)}};return u.useEffect(()=>{b()},[b]),u.useEffect(()=>{T!=null&&(l==null||l.showError(T))},[T,l]),e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx(se,{label:"Agent",children:a}),e.jsx(se,{label:"Name",children:s.name}),e.jsx(se,{label:"Status",children:e.jsx(ss,{status:s.status})}),e.jsx(se,{label:"Task",children:e.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.task})}),e.jsx(se,{label:"Frequency",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[e.jsx("span",{children:j}),e.jsx("code",{className:"text-text-secondary font-mono text-xs",children:s.cron})]})}),e.jsx("div",{className:"flex justify-end px-3 py-2.5",children:e.jsxs(M.Secondary,{type:"button",size:"small",onClick:i,children:[e.jsx(z,{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"})}),n.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:n.map(o=>{const g=lt(p,o.name),I=(g==null?void 0:g.authenticated)===!0,v=g==null&&!x;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:O("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",I?"border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"border-border text-transparent"),"aria-hidden":!0,children:I?e.jsx(z,{name:"check",className:"size-3"}):null}),e.jsx("span",{className:"text-text-primary min-w-0 flex-1 truncate text-sm",children:o.name}),I?e.jsx("span",{className:"text-success-bg text-xs font-medium",children:"Connected"}):v?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):g!=null&&g.authenticated===!1?e.jsx(it,{connector:g,onConnected:m}):x?e.jsx("span",{className:"text-text-secondary text-xs",children:"Loading…"}):null]},o.name)})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Test Run"}),e.jsxs(M.Primary,{type:"button",disabled:f,size:"small",onClick:()=>void k(),children:[e.jsx(z,{name:f?"loader":"play",className:O("size-3.5",f&&"animate-spin")}),"Run Test"]})]}),N==null?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"Run a one-off test using the schedule task. This does not change the cron pending run."}):e.jsxs("div",{className:"flex items-center gap-3 px-3 py-3",children:[e.jsx(es,{run:N}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Xe(N.name)}),e.jsx("p",{className:"text-text-secondary",children:Ys(N.triggeredAt??N.scheduledFor)})]})]})]})]})}function ot({open:s,onOpenChange:a,mode:n,schedule:i,initialAgentId:c="",onSaved:l}){const p=ve(),b=qe(),m=Ge(),x=Se(),T=Qe(),[f,C]=u.useState(xe),[N,r]=u.useState(c),[j,k]=u.useState(null),[o,g]=u.useState({kind:"form"}),[I,v]=u.useState(!1),[X,$]=u.useState(!1),[W,_]=u.useState(null),Q=u.useRef(N);Q.current=N;const B=o.kind==="form"?o.saved:o.schedule,P=n==="edit"&&o.kind==="form"&&o.saved==null&&i!=null,R=o.kind==="form"&&o.saved!=null,G=n==="create"&&o.kind==="form"&&o.saved==null,{allows:ne}=pe({resourceType:"agent",resourceIds:N.length===0?[]:[N]});u.useEffect(()=>{if(!s){C(xe()),r(c),k(null),_(null),g({kind:"form"}),$(!1);return}if(n==="edit"&&i!=null){C(Le({name:i.name,task:i.task,cron:i.cron,timezone:i.timezone})),r(i.agentId),k(null),g({kind:"form"});return}C(xe()),r(c),k(null),g({kind:"form"})},[s,n,i,c]),u.useEffect(()=>{if(!s||n!=="create"||c.length===0)return;let h=!1;const E=c;return Os({server:b,agentKey:E}).then(S=>{h||S==null||Q.current===E&&(k(S),r(Ke(S)))}).catch(()=>{}),()=>{h=!0}},[s,n,c,b]);const A=(j==null?void 0:j.name)??(B==null?void 0:B.agentName)??(i==null?void 0:i.agentName)??(N.length>0?N:""),ee=u.useMemo(()=>{var E;return(((E=j==null?void 0:j.agentSpec)==null?void 0:E.mcpServers)??[]).map($s).filter(S=>S!=null).map(S=>({name:S}))},[j]),U=u.useMemo(()=>{const h=Ne(f);return f.name.trim().length>0&&f.task.trim().length>0&&je(h)&&N.length>0&&(!G||ne(N,"USE"))},[N,ne,f,G]),Y=h=>{g({kind:"test",schedule:h}),C(Le({name:h.name,task:h.task,cron:h.cron,timezone:h.timezone})),r(h.agentId)},re=async h=>{if(h.preventDefault(),!U)return;const E=Ne(f);v(!0),_(null);try{if(P&&i!=null){await p.updateSchedule({id:i.id,name:f.name.trim(),task:f.task.trim(),cron:E,timezone:f.timezone,status:i.status}),T(V.Schedule.EDITED,{schedule_id:i.id,agent_id:i.agentId}),l==null||l(),a(!1);return}if(R&&o.kind==="form"&&o.saved!=null){const D=await p.updateSchedule({id:o.saved.id,name:f.name.trim(),task:f.task.trim(),cron:E,timezone:f.timezone,status:"paused"});T(V.Schedule.EDITED,{schedule_id:D.id,agent_id:D.agentId}),l==null||l(),Y(D),x==null||x.showSuccess({title:"Schedule saved as paused",description:ae({cron:D.cron,timezone:D.timezone})});return}const S=await p.createSchedule({agentId:N,name:f.name.trim(),task:f.task.trim(),cron:E,timezone:f.timezone,status:"paused"});T(V.Schedule.CREATED,{schedule_id:S.id,agent_id:N}),l==null||l(),Y(S),x==null||x.showSuccess({title:"Schedule saved as paused",description:ae({cron:S.cron,timezone:S.timezone})})}catch(S){const D=S instanceof Error?S.message:"Failed to save schedule";_(D)}finally{v(!1)}},le=async()=>{if(o.kind==="test"){$(!0),_(null);try{await p.updateSchedule({id:o.schedule.id,name:o.schedule.name,task:o.schedule.task,cron:o.schedule.cron,timezone:o.schedule.timezone,status:"active"}),l==null||l(),x==null||x.showSuccess({title:"Schedule activated"}),a(!1)}catch(h){const E=h instanceof Error?h.message:"Failed to activate schedule";_(E),x==null||x.showError(h)}finally{$(!1)}}},L=o.kind==="test"?"Test Schedule":P||R?"Edit Schedule":"New Schedule",Z=o.kind==="test"?`Recurring unattended runs of ${A}.`:P||R?"Update cadence and task for this schedule.":"Create a recurring unattended run for an agent.";let F;return o.kind==="test"?F=e.jsxs("div",{className:"flex flex-col gap-2",children:[W!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:W}):null,e.jsx(M.Secondary,{type:"button",className:"w-full",disabled:X,onClick:()=>void le(),children:"Activate Schedule"})]}):F=e.jsxs("div",{className:"flex flex-col gap-2",children:[W!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:W}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(M.Secondary,{type:"button",onClick:()=>a(!1),disabled:I,children:"Cancel"}),e.jsx(M.Primary,{type:"submit",form:"schedule-form",disabled:!U||I,children:"Save"})]})]}),e.jsx(Bs,{open:s,onOpenChange:a,title:L,description:Z,anchor:"right",size:"xl",headerIcon:e.jsx("span",{className:"text-primary-button-bg inline-flex size-8 items-center justify-center",children:e.jsx(z,{name:o.kind==="test"||P||R?"calendar":"calendar-plus",className:"size-5"})}),footer:F,children:o.kind==="test"?e.jsx(ct,{schedule:o.schedule,agentName:A,mcpMounts:ee,onEditConfiguration:()=>{_(null),g({kind:"form",saved:o.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:h=>void re(h),children:e.jsx(et,{values:f,onChange:C,agentId:N,agentLabel:A,onAgentIdChange:P||R?void 0:h=>{r(h),h.length===0&&k(null)},onAgentPicked:k,agentPickerDisabled:P||R,onBuildAgent:n==="create"&&(m==null?void 0:m.isComposerEnabled)===!0?()=>{a(!1),m.openAgentBuilder()}:void 0})})})}function Me(s){return e.jsx(Ms,{children:e.jsx(ot,{...s})})}function dt({runs:s,onOpenSession:a}){const n=at(s);return n.length===0?e.jsx("span",{className:"text-text-secondary text-sm",children:"—"}):e.jsx("div",{className:"flex items-center gap-1",children:n.map(i=>e.jsx(es,{run:i,...a==null?{}:{onOpenSession:a}},i.id))})}var ut=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],mt=[10,25],Oe=[],$e=[];function Be(s){return Math.min(Math.max(s,1),25)}function Ue(s){return s===void 0||s===""?void 0:s}function te(s){const a=ke(s);return{nameQuery:a.q??"",statusFilter:a.status??"all",agentFilter:a.agent??"all",scheduleId:a.scheduleId}}function xt(s){const a=ke(window.location.search);if(!a.isNew)return{kind:"closed"};const n=s??a.agent;return{kind:"create",...n==null?{}:{agentId:n}}}function ht({schedule:s,running:a,canManage:n,canDelete:i,onRunNow:c,onEdit:l,onTogglePause:p,onDelete:b}){const m=Fs("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1",children:[e.jsx(m,{allowed:n,children:e.jsxs(M.Secondary,{type:"button",disabled:a,"aria-label":`Run now ${s.name}`,size:"large",onClick:c,children:[e.jsx(z,{name:a?"loader":"play",className:O("size-3.5",a&&"animate-spin")}),"Run now"]})}),e.jsxs(_s,{align:"end",trigger:e.jsx("button",{type:"button",className:Ls({variant:"ghost",size:"icon",className:"h-8 w-6"}),"aria-label":`Actions for ${s.name}`,children:e.jsx(z,{name:"ellipsis-vertical"})}),children:[e.jsx(m,{allowed:n,children:e.jsxs(ge,{onClick:l,children:[e.jsx(z,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(m,{allowed:n,children:e.jsxs(ge,{onClick:p,children:[e.jsx(z,{name:s.status==="active"?"pause":"play",className:"size-3.5"}),s.status==="active"?"Pause":"Resume"]})}),e.jsx(m,{allowed:i,children:e.jsxs(ge,{className:"text-failure-bg focus:text-failure-bg",onClick:b,children:[e.jsx(z,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function bt({agentId:s}){var Ae,ze,De;const a=ve(),n=xs(),i=u.useCallback(()=>{n.invalidateQueries({queryKey:J.schedules.all()})},[n]),c=qe(),l=Se(),p=Qe(),b=Ge(),m=hs(),x=b!=null&&Ps({sessions:m}),[T,f]=u.useState(()=>new Set),[C,N]=u.useState({}),[r,j]=u.useState(()=>te(window.location.search).nameQuery),[k,o]=u.useState(()=>te(window.location.search).statusFilter),[g,I]=u.useState(()=>s??te(window.location.search).agentFilter),[v,X]=u.useState(()=>te(window.location.search).scheduleId),$=s??(g==="all"?null:g),{allows:W}=pe({resourceType:"agent",resourceIds:$==null?[]:[$]}),_=c.permissions==null||$==null||W($,"USE"),[Q,B]=u.useState(()=>xt(s)),[P,R]=u.useState(null),[G,ne]=u.useState(()=>Be(Ds)),A=JSON.stringify([G,g]),[ee,U]=u.useState(()=>({scope:A,token:void 0}));ee.scope!==A&&U({scope:A,token:void 0});const Y=ee.scope===A?ee.token:void 0,re=u.useRef(!1),le=u.useMemo(()=>({limit:G,...Y===void 0?{}:{pageToken:Y},...g==="all"?{}:{agentIds:[g]}}),[g,G,Y]),L=v!=null,Z=Pe({queryKey:J.schedules.detail(v??""),queryFn:()=>v==null?Promise.reject(new Error("Pinned schedule id is required.")):a.getSchedule({id:v}),enabled:L},n),F=Pe({queryKey:J.schedules.list(le),queryFn:()=>a.listSchedules(le),enabled:!L,placeholderData:Re},n),h=u.useMemo(()=>{var t,d;return L?((t=Z.data)==null?void 0:t.id)===v?[Z.data]:Oe:((d=F.data)==null?void 0:d.data)??Oe},[Z.data,(Ae=F.data)==null?void 0:Ae.data,L,v]),E=!F.isPlaceholderData,S=L||!E?void 0:Ue((ze=F.data)==null?void 0:ze.nextPageToken),D=L||!E?void 0:Ue((De=F.data)==null?void 0:De.previousPageToken),ie=L?Z:F,ts=ie.isPending||ie.isPlaceholderData,ce=ie.error!=null&&h.length===0?fs(ie.error,"Check your connection and try again."):null,we=ts&&h.length===0,{allows:q}=pe({resourceType:"schedule",resourceIds:h.map(t=>t.id)}),oe=h.map(t=>t.id),Te=gs({queries:oe.map(t=>({queryKey:J.schedules.runs(t),queryFn:()=>a.listScheduleRuns({scheduleId:t}),placeholderData:Re}))},n),as=u.useMemo(()=>{const t=new Map;for(let d=0;d<oe.length;d+=1){const w=oe[d];if(w===void 0)continue;const y=Te[d];t.set(w,{runs:(y==null?void 0:y.data)??$e,pending:(y==null?void 0:y.isPending)===!0&&y.data===void 0,failed:(y==null?void 0:y.isError)===!0&&y.data===void 0})}return t},[Te,oe]),Ce=u.useCallback(()=>{X(null),U({scope:A,token:void 0})},[A]),ns=({run:t,schedule:d})=>{if(!x||b==null||t.sessionId==null)return;p(V.Schedule.RUN_SESSION_OPENED,{schedule_id:d.id,agent_id:d.agentId});const w=Rs(t.triggeredAt??t.scheduledFor);Is({sessionId:t.sessionId,view:"sessions",...w==null?{}:{timeRange:w}}),b.setSessionsOpen(!0)};u.useEffect(()=>{Ie({agent:s===void 0&&g!=="all"?g:null,status:k==="all"?null:k,q:r.trim().length===0?null:r,scheduleId:v})},[g,s,k,r,v]),u.useEffect(()=>{s!==void 0&&I(t=>t===s?t:s)},[s]),u.useEffect(()=>{re.current||!ke(window.location.search).isNew||(re.current=!0,Ie({isNew:null}))},[]),u.useEffect(()=>{const t=()=>{const d=te(window.location.search);j(d.nameQuery),o(d.statusFilter),X(w=>w===d.scheduleId?w:d.scheduleId),I(w=>{const y=s??d.agentFilter;return w===y?w:y})};return window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)}},[s]),u.useEffect(()=>{if(v==null||r.trim().length>0)return;const t=h.find(d=>d.id===v);t!=null&&j(t.name)},[r,v,h]);const de=u.useMemo(()=>{if(v!=null)return h;const t=r.trim().toLowerCase();return h.filter(d=>!(k!=="all"&&d.status!==k||t.length>0&&!d.name.toLowerCase().includes(t)))},[h,r,k,v]),Ee=bs(h),rs=D!=null||S!=null,ls=async t=>{if(!q(t.id,"MANAGE"))return;const d=t.status==="active"?"paused":"active";try{await a.updateSchedule({...t,status:d}),i(),p(V.Schedule.TOGGLED,{schedule_id:t.id,agent_id:t.agentId,next_status:d})}catch(w){l==null||l.showError(w)}},is=async t=>{if(q(t.id,"MANAGE")){f(d=>new Set(d).add(t.id));try{await a.createScheduleRun({scheduleId:t.id}),p(V.Schedule.RUN_NOW,{schedule_id:t.id,agent_id:t.agentId}),l==null||l.showSuccess({title:"Run started"}),n.invalidateQueries({queryKey:J.schedules.runs(t.id)}),v!=null&&n.invalidateQueries({queryKey:J.schedules.detail(v)})}catch(d){l==null||l.showError(d)}finally{f(d=>{const w=new Set(d);return w.delete(t.id),w})}}},cs=async t=>{if(q(t.id,"DELETE")){R(null);try{await a.deleteSchedule({id:t.id}),i(),p(V.Schedule.DELETED,{schedule_id:t.id,agent_id:t.agentId}),Ce()}catch(d){l==null||l.showError(d)}}},os=()=>{S!=null&&U({scope:A,token:S})},ds=()=>{D!=null&&U({scope:A,token:D})},he=()=>{v!=null&&(X(null),U({scope:A,token:void 0}))};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card-bg",children:[e.jsx(ps,{title:s===void 0?"Agent Schedules":void 0,end:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full sm:w-60",children:e.jsx(Ns,{query:r,setQuery:t=>{j(t),he()},placeholder:"Search schedules by name"})}),e.jsx(me,{value:k,onValueChange:t=>{o(t),he()},options:ut,className:"sm:w-40","aria-label":"Filter by status"}),s===void 0?e.jsx(He,{value:g,selectedLabel:g==="all"?"All agents":C[g]??g,onValueChange:t=>{I(t),he()},onAgentPicked:t=>{N(d=>({...d,[Ke(t)]:t.name}))},allOption:{value:"all",label:"All agents"},className:"sm:w-48","aria-label":"Filter by agent",placeholder:"Search agent"}):null,e.jsxs(M.Primary,{type:"button",disabled:!_,onClick:()=>_&&B({kind:"create",agentId:g!=="all"?g:void 0}),children:[e.jsx(z,{name:"plus",className:"size-3.5"}),"New Schedule"]})]})}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:O("min-h-0 flex-1 overflow-auto",ce!=null?"flex flex-col":void 0),children:we?e.jsx("div",{className:"flex flex-col gap-2 py-1",role:"status","aria-label":"Loading schedules",children:Array.from({length:5},(t,d)=>e.jsx(js,{className:"h-12 w-full rounded-md"},d))}):ce!=null?e.jsx("div",{role:"alert",className:"flex flex-1 flex-col items-center justify-center",children:e.jsx(fe,{title:"Couldn't load schedules",description:ce,className:"h-auto min-h-0 flex-none py-0"})}):h.length===0?e.jsx(fe,{title:"No Schedules Found",description:"Create one to get started.",className:"min-h-full"}):de.length===0?e.jsx(fe,{title:"No Schedules Found",description:"No schedules match your filters.",className:"min-h-full"}):e.jsxs(ys,{className:"min-w-240 bg-card-bg",children:[e.jsx(vs,{children:e.jsxs(Fe,{className:"hover:bg-transparent",children:[e.jsx(H,{children:"Schedule Name"}),e.jsx(H,{children:"Task"}),Ee?e.jsx(H,{children:"Created by"}):null,e.jsx(H,{children:"Frequency"}),e.jsx(H,{children:"Status"}),e.jsx(H,{children:"Last 5 runs"}),e.jsx(H,{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(Ss,{children:de.map(t=>{const d=ae({cron:t.cron,timezone:t.timezone}),w=t.agentName??C[t.agentId]??t.agentId,y=as.get(t.id);return e.jsxs(Fe,{children:[e.jsxs(K,{className:"w-48 max-w-48",children:[e.jsx("span",{className:"text-text-primary block truncate font-medium",children:t.name}),e.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(z,{name:"agent-2",className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:w})]})]}),e.jsx(K,{className:"w-64 max-w-64",children:e.jsx(Ve,{content:t.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:t.task})})}),Ee?e.jsx(K,{children:e.jsx(ks,{subject:t.createdBySubject})}):null,e.jsx(K,{children:d}),e.jsx(K,{children:e.jsx(ss,{status:t.status})}),e.jsx(K,{children:(y==null?void 0:y.pending)===!0?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):(y==null?void 0:y.failed)===!0?e.jsx("span",{className:"text-text-secondary text-sm",children:"Couldn't load runs"}):e.jsx(dt,{runs:(y==null?void 0:y.runs)??$e,...x?{onOpenSession:us=>ns({run:us,schedule:t})}:{}})}),e.jsx(K,{className:"text-right",children:e.jsx(ht,{schedule:t,running:T.has(t.id),canManage:q(t.id,"MANAGE"),canDelete:q(t.id,"DELETE"),onRunNow:()=>void is(t),onEdit:()=>{q(t.id,"MANAGE")&&B({kind:"edit",schedule:t})},onTogglePause:()=>void ls(t),onDelete:()=>{q(t.id,"DELETE")&&R(t)}})})]},t.id)})})]})}),!we&&ce==null&&(de.length>0||rs)?e.jsx("div",{className:"shrink-0 border-t border-border",children:e.jsx(ws,{pageSize:G,rowCount:de.length,canPrev:D!=null,canNext:S!=null,onPrev:ds,onNext:os,pageSizeOptions:mt,onPageSizeChange:t=>{ne(Be(t))}})}):null]}),Q.kind==="create"?e.jsx(Me,{open:!0,mode:"create",initialAgentId:Q.agentId??"",onOpenChange:t=>{t||B({kind:"closed"})},onSaved:()=>{i(),Ce()}}):null,Q.kind==="edit"?e.jsx(Me,{open:!0,mode:"edit",schedule:Q.schedule,onOpenChange:t=>{t||B({kind:"closed"})},onSaved:()=>{i()}}):null,P!=null?e.jsxs(Ts,{open:!0,onOpenChange:t=>{t||R(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(Cs,{children:e.jsxs(Es,{children:[e.jsx(As,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",P.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(zs,{children:[e.jsx(M.Secondary,{type:"button",onClick:()=>R(null),children:"Cancel"}),e.jsx(M.Destructive,{type:"button",disabled:!q(P.id,"DELETE"),onClick:()=>void cs(P),children:"Delete"})]})]}):null]})}export{bt as SchedulesPage};
|
|
1
|
+
import{B as ms}from"./chunk-4QN7ONBR-CtFqtChE.js";import{W as ve,X as xs,r as u,Y as J,Z as qe,$ as Se,a0 as Qe,b as Ge,m as hs,a1 as pe,a2 as Pe,x as fs,a3 as gs,a4 as Re,a5 as Ie,a6 as ke,a7 as bs,j as e,P as ps,a8 as Ns,a9 as me,aa as He,z as Ke,ab as M,I as z,ac as js,ad as fe,ae as ys,af as vs,ag as Fe,ah as H,ai as Ss,aj as K,V as Ve,ak as ks,g as O,al as ws,am as Ts,an as Cs,ao as Es,ap as As,aq as zs,ar as Ds,as as Ps,at as V,au as Rs,av as Is,d as Fs,aw as _s,ax as ge,f as Ls,ay as Ms,az as Os,aA as $s,aB as Bs,aC as Us,aD as qs,aE as be,l as Qs,aF as Gs,aG as Hs}from"./index-C5ROvRRa.js";var _e=[{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 We(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Ks(s){const a=We(),n=new Set(_e.map(c=>c.value));return[...[a,s].flatMap(c=>c==null||c.length===0||n.has(c)?[]:(n.add(c),[{value:c,label:c===a?`${c} (Local)`:c}])),..._e]}var Ye=[{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"}],Vs={"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 xe(){return{name:"",task:"",recurrence:"daily",hour:9,minute:0,weekdays:[1],customCron:"0 9 * * *",timezone:We()}}function Ws(s){return Vs[s]??s.split("/").pop()??s}function Ze(s){return s.toString().padStart(2,"0")}function ue({hour:s,minute:a}){const n=s>=12?"PM":"AM",i=s%12===0?12:s%12;return`${String(i)}:${Ze(a)} ${n}`}function Ne(s){const a=s.minute,n=s.hour;switch(s.recurrence){case"hourly":return`${String(a)} * * * *`;case"daily":return`${String(a)} ${String(n)} * * *`;case"weekly":{const i=[...s.weekdays].sort((l,p)=>l-p),c=i.length>0?i.join(","):"*";return`${String(a)} ${String(n)} * * ${c}`}case"custom":return s.customCron.trim()}}function je(s){return s.trim().split(/\s+/).length===5}function ae(s){const a=Ws(s.timezone),n=s.cron.trim().split(/\s+/);if(n.length!==5)return s.cron;const[i,c,l,p,b]=n;if(l!=="*"||p!=="*")return s.cron;const m=Number(i),x=Number(c);if(c==="*"&&b==="*"&&i!==void 0&&!Number.isNaN(m))return`Hourly at :${Ze(m)} ${a}`;if(b==="*"&&c!==void 0&&i!==void 0&&!Number.isNaN(x)&&!Number.isNaN(m))return`Daily ${ue({hour:x,minute:m})} ${a}`;if(b==="1-5"&&c!==void 0&&i!==void 0&&!Number.isNaN(x)&&!Number.isNaN(m))return`Weekdays ${ue({hour:x,minute:m})} ${a}`;if(b!=null&&/^\d(?:,\d)*$/.test(b)&&c!==void 0&&i!==void 0&&!Number.isNaN(x)&&!Number.isNaN(m)){const T=b.split(",").map(f=>{var C;return((C=Ye.find(N=>N.value===Number(f)))==null?void 0:C.label)??f});return T.length===1?`Every ${T[0]==="Mon"?"Monday":T[0]} ${ue({hour:x,minute:m})} ${a}`:`${T.join(", ")} ${ue({hour:x,minute:m})} ${a}`}return s.cron}function Le(s){const a=xe(),n=s.cron.trim().split(/\s+/);if(n.length!==5)return{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"custom",customCron:s.cron};const[i,c,l,p,b]=n,m=Number(i),x=Number(c);return l!=="*"||p!=="*"?{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"custom",customCron:s.cron}:c==="*"&&b==="*"&&!Number.isNaN(m)?{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"hourly",minute:m,customCron:s.cron}:b==="*"&&!Number.isNaN(x)&&!Number.isNaN(m)?{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"daily",hour:x,minute:m,customCron:s.cron}:b!=null&&/^\d(?:,\d)*$/.test(b)&&!Number.isNaN(x)&&!Number.isNaN(m)?{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"weekly",hour:x,minute:m,weekdays:b.split(",").map(Number),customCron:s.cron}:{...a,name:s.name,task:s.task,timezone:s.timezone,recurrence:"custom",customCron:s.cron,hour:Number.isNaN(x)?a.hour:x,minute:Number.isNaN(m)?a.minute:m}}function Ys(s,a=Date.now()){return Hs(s,{fallback:"Never",nowMs:a})}var Zs=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"custom",label:"Custom"}],Js=Array.from({length:24},(s,a)=>({value:String(a),label:a.toString().padStart(2,"0")})),Xs=[0,15,30,45].map(s=>({value:String(s),label:`:${s.toString().padStart(2,"0")}`}));function et({values:s,onChange:a,agentId:n,agentLabel:i,onAgentIdChange:c,onAgentPicked:l,agentPickerDisabled:p=!1,onBuildAgent:b}){const m=Ne(s),x=ae({cron:m,timezone:s.timezone}),T=Ks(s.timezone),f=(r,j)=>{a({...s,[r]:j})},C=r=>{const j=r==="custom"&&s.recurrence!=="custom"?m:s.customCron;a({...s,recurrence:r,customCron:j})},N=r=>{const k=s.weekdays.includes(r)?s.weekdays.filter(o=>o!==r):[...s.weekdays,r];a({...s,weekdays:k.length>0?k:[r]})};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(He,{"aria-label":"Agent",placeholder:"Search agent",value:n,selectedLabel:i,onValueChange:r=>c==null?void 0:c(r),onAgentPicked:l,disabled:p||c==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:s.name,onChange:r=>f("name",r.target.value),placeholder:"harness-daily-digest",className:be("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:s.task,onChange:r=>f("task",r.target.value),rows:3,placeholder:"Summarise yesterday's harness runs and post the digest…",className:be("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:Zs.map(r=>{const j=s.recurrence===r.value;return e.jsx("button",{type:"button",className:O("rounded-md border px-2 py-2 text-sm font-medium transition-colors",j?"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":j,onClick:()=>C(r.value),children:r.label},r.value)})}),s.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:s.customCron,onChange:r=>f("customCron",r.target.value),placeholder:"0 */4 * * *",spellCheck:!1,"aria-invalid":!je(s.customCron),className:O(be("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."}),je(s.customCron)?null:e.jsx("span",{className:"mt-1 block text-xs text-failure-bg",children:"Enter exactly 5 space-separated fields."})]}):null,s.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:Ye.map(r=>{const j=s.weekdays.includes(r.value);return e.jsx("button",{type:"button",className:O("min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium",j?"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":j,onClick:()=>N(r.value),children:r.label},r.value)})})]}):null,e.jsxs("div",{className:"flex gap-4",children:[s.recurrence==="daily"||s.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(me,{"aria-label":"Hour",value:String(s.hour),options:Js,onValueChange:r=>f("hour",Number(r))})]}):null,s.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(me,{"aria-label":"Minute",value:String(s.minute),options:Xs,onValueChange:r=>f("minute",Number(r))})]}):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(me,{"aria-label":"Timezone",value:s.timezone,options:T,onValueChange:r=>f("timezone",r),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(z,{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:x||"—"}),e.jsx("code",{className:"shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary",children:m||"—"})]})})]})]})}function st(s){return s.startsWith("manual-")}function tt(s){return s==="failed"?"failed":"success"}function Je(s){return s==="failed"?"Failed":s==="triggered"?"Triggered":"Scheduled"}function Xe(s){return st(s)?"Manual test":"Cron"}function at(s,a=5){return s.filter(i=>i.status!=="scheduled").slice(0,a).reverse()}function ye(s){if(s==null)return"—";const a=new Date(s);return Number.isNaN(a.getTime())?"—":Us(a)}function nt({run:s}){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:Je(s.status)}),e.jsx("p",{className:"text-text-secondary",children:Xe(s.name)}),e.jsxs("p",{className:"text-text-secondary",children:["Scheduled for: ",ye(s.scheduledFor)]}),s.triggeredAt!=null?e.jsxs("p",{className:"text-text-secondary",children:["Triggered at: ",ye(s.triggeredAt)]}):null,e.jsxs("p",{className:"text-text-secondary",children:["Triggered by: ",s.triggeredBy]}),s.status==="failed"&&s.reason?e.jsxs("p",{className:"text-text-secondary",children:["Reason: ",s.reason]}):null]})}var rt={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 es({run:s,onOpenSession:a}){const n=tt(s.status),i=ye(s.triggeredAt??s.scheduledFor),c=`${Je(s.status)} run at ${i}`,l=O("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",rt[n]),p=e.jsx(z,{name:n==="failed"?"triangle-exclamation":"check",className:"size-3.5"});return e.jsx(Ve,{content:e.jsx(nt,{run:s}),className:"max-w-sm whitespace-normal",side:"top",children:a!=null&&s.sessionId!=null&&s.sessionId!==""?e.jsx("button",{type:"button",className:O(l,"cursor-pointer hover:brightness-95"),"aria-label":`Open session for ${c}`,onClick:()=>a(s),children:p}):e.jsx("span",{className:l,"aria-label":c,children:p})})}function ss({status:s}){const a=s==="active";return e.jsx(ms,{variant:a?"success":"warning",shape:"pill",size:"md",dot:!0,children:a?"Active":"Paused"})}function lt(s,a){return s.find(n=>n.name===a||n.id===a)??null}function it({connector:s,onConnected:a}){return Qs()==null?null:e.jsx(Gs,{connector:s,onConnected:a})}function se({label:s,children:a}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border px-3 py-2.5 last:border-b-0",children:[e.jsx("span",{className:"text-text-secondary shrink-0 text-[10px] font-semibold tracking-wide uppercase",children:s}),e.jsx("div",{className:"min-w-0 text-right text-sm text-text-primary",children:a})]})}function ct({schedule:s,agentName:a,mcpMounts:n,onEditConfiguration:i}){const c=ve(),l=Se(),{connectors:p,ensureLoaded:b,refreshConnectors:m,loading:x,error:T}=qs(),[f,C]=u.useState(!1),[N,r]=u.useState(null),j=ae({cron:s.cron,timezone:s.timezone}),k=async()=>{C(!0);try{const o=await c.createScheduleRun({scheduleId:s.id});r(o),l==null||l.showSuccess({title:"Test run started"})}catch(o){l==null||l.showError(o)}finally{C(!1)}};return u.useEffect(()=>{b()},[b]),u.useEffect(()=>{T!=null&&(l==null||l.showError(T))},[T,l]),e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx(se,{label:"Agent",children:a}),e.jsx(se,{label:"Name",children:s.name}),e.jsx(se,{label:"Status",children:e.jsx(ss,{status:s.status})}),e.jsx(se,{label:"Task",children:e.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.task})}),e.jsx(se,{label:"Frequency",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[e.jsx("span",{children:j}),e.jsx("code",{className:"text-text-secondary font-mono text-xs",children:s.cron})]})}),e.jsx("div",{className:"flex justify-end px-3 py-2.5",children:e.jsxs(M.Secondary,{type:"button",size:"small",onClick:i,children:[e.jsx(z,{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"})}),n.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:n.map(o=>{const g=lt(p,o.name),I=(g==null?void 0:g.authenticated)===!0,v=g==null&&!x;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:O("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",I?"border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"border-border text-transparent"),"aria-hidden":!0,children:I?e.jsx(z,{name:"check",className:"size-3"}):null}),e.jsx("span",{className:"text-text-primary min-w-0 flex-1 truncate text-sm",children:o.name}),I?e.jsx("span",{className:"text-success-bg text-xs font-medium",children:"Connected"}):v?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):g!=null&&g.authenticated===!1?e.jsx(it,{connector:g,onConnected:m}):x?e.jsx("span",{className:"text-text-secondary text-xs",children:"Loading…"}):null]},o.name)})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Test Run"}),e.jsxs(M.Primary,{type:"button",disabled:f,size:"small",onClick:()=>void k(),children:[e.jsx(z,{name:f?"loader":"play",className:O("size-3.5",f&&"animate-spin")}),"Run Test"]})]}),N==null?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"Run a one-off test using the schedule task. This does not change the cron pending run."}):e.jsxs("div",{className:"flex items-center gap-3 px-3 py-3",children:[e.jsx(es,{run:N}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Xe(N.name)}),e.jsx("p",{className:"text-text-secondary",children:Ys(N.triggeredAt??N.scheduledFor)})]})]})]})]})}function ot({open:s,onOpenChange:a,mode:n,schedule:i,initialAgentId:c="",onSaved:l}){const p=ve(),b=qe(),m=Ge(),x=Se(),T=Qe(),[f,C]=u.useState(xe),[N,r]=u.useState(c),[j,k]=u.useState(null),[o,g]=u.useState({kind:"form"}),[I,v]=u.useState(!1),[X,$]=u.useState(!1),[W,_]=u.useState(null),Q=u.useRef(N);Q.current=N;const B=o.kind==="form"?o.saved:o.schedule,P=n==="edit"&&o.kind==="form"&&o.saved==null&&i!=null,R=o.kind==="form"&&o.saved!=null,G=n==="create"&&o.kind==="form"&&o.saved==null,{allows:ne}=pe({resourceType:"agent",resourceIds:N.length===0?[]:[N]});u.useEffect(()=>{if(!s){C(xe()),r(c),k(null),_(null),g({kind:"form"}),$(!1);return}if(n==="edit"&&i!=null){C(Le({name:i.name,task:i.task,cron:i.cron,timezone:i.timezone})),r(i.agentId),k(null),g({kind:"form"});return}C(xe()),r(c),k(null),g({kind:"form"})},[s,n,i,c]),u.useEffect(()=>{if(!s||n!=="create"||c.length===0)return;let h=!1;const E=c;return Os({server:b,agentKey:E}).then(S=>{h||S==null||Q.current===E&&(k(S),r(Ke(S)))}).catch(()=>{}),()=>{h=!0}},[s,n,c,b]);const A=(j==null?void 0:j.name)??(B==null?void 0:B.agentName)??(i==null?void 0:i.agentName)??(N.length>0?N:""),ee=u.useMemo(()=>{var E;return(((E=j==null?void 0:j.agentSpec)==null?void 0:E.mcpServers)??[]).map($s).filter(S=>S!=null).map(S=>({name:S}))},[j]),U=u.useMemo(()=>{const h=Ne(f);return f.name.trim().length>0&&f.task.trim().length>0&&je(h)&&N.length>0&&(!G||ne(N,"USE"))},[N,ne,f,G]),Y=h=>{g({kind:"test",schedule:h}),C(Le({name:h.name,task:h.task,cron:h.cron,timezone:h.timezone})),r(h.agentId)},re=async h=>{if(h.preventDefault(),!U)return;const E=Ne(f);v(!0),_(null);try{if(P&&i!=null){await p.updateSchedule({id:i.id,name:f.name.trim(),task:f.task.trim(),cron:E,timezone:f.timezone,status:i.status}),T(V.Schedule.EDITED,{schedule_id:i.id,agent_id:i.agentId}),l==null||l(),a(!1);return}if(R&&o.kind==="form"&&o.saved!=null){const D=await p.updateSchedule({id:o.saved.id,name:f.name.trim(),task:f.task.trim(),cron:E,timezone:f.timezone,status:"paused"});T(V.Schedule.EDITED,{schedule_id:D.id,agent_id:D.agentId}),l==null||l(),Y(D),x==null||x.showSuccess({title:"Schedule saved as paused",description:ae({cron:D.cron,timezone:D.timezone})});return}const S=await p.createSchedule({agentId:N,name:f.name.trim(),task:f.task.trim(),cron:E,timezone:f.timezone,status:"paused"});T(V.Schedule.CREATED,{schedule_id:S.id,agent_id:N}),l==null||l(),Y(S),x==null||x.showSuccess({title:"Schedule saved as paused",description:ae({cron:S.cron,timezone:S.timezone})})}catch(S){const D=S instanceof Error?S.message:"Failed to save schedule";_(D)}finally{v(!1)}},le=async()=>{if(o.kind==="test"){$(!0),_(null);try{await p.updateSchedule({id:o.schedule.id,name:o.schedule.name,task:o.schedule.task,cron:o.schedule.cron,timezone:o.schedule.timezone,status:"active"}),l==null||l(),x==null||x.showSuccess({title:"Schedule activated"}),a(!1)}catch(h){const E=h instanceof Error?h.message:"Failed to activate schedule";_(E),x==null||x.showError(h)}finally{$(!1)}}},L=o.kind==="test"?"Test Schedule":P||R?"Edit Schedule":"New Schedule",Z=o.kind==="test"?`Recurring unattended runs of ${A}.`:P||R?"Update cadence and task for this schedule.":"Create a recurring unattended run for an agent.";let F;return o.kind==="test"?F=e.jsxs("div",{className:"flex flex-col gap-2",children:[W!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:W}):null,e.jsx(M.Secondary,{type:"button",className:"w-full",disabled:X,onClick:()=>void le(),children:"Activate Schedule"})]}):F=e.jsxs("div",{className:"flex flex-col gap-2",children:[W!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:W}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(M.Secondary,{type:"button",onClick:()=>a(!1),disabled:I,children:"Cancel"}),e.jsx(M.Primary,{type:"submit",form:"schedule-form",disabled:!U||I,children:"Save"})]})]}),e.jsx(Bs,{open:s,onOpenChange:a,title:L,description:Z,anchor:"right",size:"xl",headerIcon:e.jsx("span",{className:"text-primary-button-bg inline-flex size-8 items-center justify-center",children:e.jsx(z,{name:o.kind==="test"||P||R?"calendar":"calendar-plus",className:"size-5"})}),footer:F,children:o.kind==="test"?e.jsx(ct,{schedule:o.schedule,agentName:A,mcpMounts:ee,onEditConfiguration:()=>{_(null),g({kind:"form",saved:o.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:h=>void re(h),children:e.jsx(et,{values:f,onChange:C,agentId:N,agentLabel:A,onAgentIdChange:P||R?void 0:h=>{r(h),h.length===0&&k(null)},onAgentPicked:k,agentPickerDisabled:P||R,onBuildAgent:n==="create"&&(m==null?void 0:m.isComposerEnabled)===!0?()=>{a(!1),m.openAgentBuilder()}:void 0})})})}function Me(s){return e.jsx(Ms,{children:e.jsx(ot,{...s})})}function dt({runs:s,onOpenSession:a}){const n=at(s);return n.length===0?e.jsx("span",{className:"text-text-secondary text-sm",children:"—"}):e.jsx("div",{className:"flex items-center gap-1",children:n.map(i=>e.jsx(es,{run:i,...a==null?{}:{onOpenSession:a}},i.id))})}var ut=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],mt=[10,25],Oe=[],$e=[];function Be(s){return Math.min(Math.max(s,1),25)}function Ue(s){return s===void 0||s===""?void 0:s}function te(s){const a=ke(s);return{nameQuery:a.q??"",statusFilter:a.status??"all",agentFilter:a.agent??"all",scheduleId:a.scheduleId}}function xt(s){const a=ke(window.location.search);if(!a.isNew)return{kind:"closed"};const n=s??a.agent;return{kind:"create",...n==null?{}:{agentId:n}}}function ht({schedule:s,running:a,canManage:n,canDelete:i,onRunNow:c,onEdit:l,onTogglePause:p,onDelete:b}){const m=Fs("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1",children:[e.jsx(m,{allowed:n,children:e.jsxs(M.Secondary,{type:"button",disabled:a,"aria-label":`Run now ${s.name}`,size:"large",onClick:c,children:[e.jsx(z,{name:a?"loader":"play",className:O("size-3.5",a&&"animate-spin")}),"Run now"]})}),e.jsxs(_s,{align:"end",trigger:e.jsx("button",{type:"button",className:Ls({variant:"ghost",size:"icon",className:"h-8 w-6"}),"aria-label":`Actions for ${s.name}`,children:e.jsx(z,{name:"ellipsis-vertical"})}),children:[e.jsx(m,{allowed:n,children:e.jsxs(ge,{onClick:l,children:[e.jsx(z,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(m,{allowed:n,children:e.jsxs(ge,{onClick:p,children:[e.jsx(z,{name:s.status==="active"?"pause":"play",className:"size-3.5"}),s.status==="active"?"Pause":"Resume"]})}),e.jsx(m,{allowed:i,children:e.jsxs(ge,{className:"text-failure-bg focus:text-failure-bg",onClick:b,children:[e.jsx(z,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function bt({agentId:s}){var Ae,ze,De;const a=ve(),n=xs(),i=u.useCallback(()=>{n.invalidateQueries({queryKey:J.schedules.all()})},[n]),c=qe(),l=Se(),p=Qe(),b=Ge(),m=hs(),x=b!=null&&Ps({sessions:m}),[T,f]=u.useState(()=>new Set),[C,N]=u.useState({}),[r,j]=u.useState(()=>te(window.location.search).nameQuery),[k,o]=u.useState(()=>te(window.location.search).statusFilter),[g,I]=u.useState(()=>s??te(window.location.search).agentFilter),[v,X]=u.useState(()=>te(window.location.search).scheduleId),$=s??(g==="all"?null:g),{allows:W}=pe({resourceType:"agent",resourceIds:$==null?[]:[$]}),_=c.permissions==null||$==null||W($,"USE"),[Q,B]=u.useState(()=>xt(s)),[P,R]=u.useState(null),[G,ne]=u.useState(()=>Be(Ds)),A=JSON.stringify([G,g]),[ee,U]=u.useState(()=>({scope:A,token:void 0}));ee.scope!==A&&U({scope:A,token:void 0});const Y=ee.scope===A?ee.token:void 0,re=u.useRef(!1),le=u.useMemo(()=>({limit:G,...Y===void 0?{}:{pageToken:Y},...g==="all"?{}:{agentIds:[g]}}),[g,G,Y]),L=v!=null,Z=Pe({queryKey:J.schedules.detail(v??""),queryFn:()=>v==null?Promise.reject(new Error("Pinned schedule id is required.")):a.getSchedule({id:v}),enabled:L},n),F=Pe({queryKey:J.schedules.list(le),queryFn:()=>a.listSchedules(le),enabled:!L,placeholderData:Re},n),h=u.useMemo(()=>{var t,d;return L?((t=Z.data)==null?void 0:t.id)===v?[Z.data]:Oe:((d=F.data)==null?void 0:d.data)??Oe},[Z.data,(Ae=F.data)==null?void 0:Ae.data,L,v]),E=!F.isPlaceholderData,S=L||!E?void 0:Ue((ze=F.data)==null?void 0:ze.nextPageToken),D=L||!E?void 0:Ue((De=F.data)==null?void 0:De.previousPageToken),ie=L?Z:F,ts=ie.isPending||ie.isPlaceholderData,ce=ie.error!=null&&h.length===0?fs(ie.error,"Check your connection and try again."):null,we=ts&&h.length===0,{allows:q}=pe({resourceType:"schedule",resourceIds:h.map(t=>t.id)}),oe=h.map(t=>t.id),Te=gs({queries:oe.map(t=>({queryKey:J.schedules.runs(t),queryFn:()=>a.listScheduleRuns({scheduleId:t}),placeholderData:Re}))},n),as=u.useMemo(()=>{const t=new Map;for(let d=0;d<oe.length;d+=1){const w=oe[d];if(w===void 0)continue;const y=Te[d];t.set(w,{runs:(y==null?void 0:y.data)??$e,pending:(y==null?void 0:y.isPending)===!0&&y.data===void 0,failed:(y==null?void 0:y.isError)===!0&&y.data===void 0})}return t},[Te,oe]),Ce=u.useCallback(()=>{X(null),U({scope:A,token:void 0})},[A]),ns=({run:t,schedule:d})=>{if(!x||b==null||t.sessionId==null)return;p(V.Schedule.RUN_SESSION_OPENED,{schedule_id:d.id,agent_id:d.agentId});const w=Rs(t.triggeredAt??t.scheduledFor);Is({sessionId:t.sessionId,view:"sessions",...w==null?{}:{timeRange:w}}),b.setSessionsOpen(!0)};u.useEffect(()=>{Ie({agent:s===void 0&&g!=="all"?g:null,status:k==="all"?null:k,q:r.trim().length===0?null:r,scheduleId:v})},[g,s,k,r,v]),u.useEffect(()=>{s!==void 0&&I(t=>t===s?t:s)},[s]),u.useEffect(()=>{re.current||!ke(window.location.search).isNew||(re.current=!0,Ie({isNew:null}))},[]),u.useEffect(()=>{const t=()=>{const d=te(window.location.search);j(d.nameQuery),o(d.statusFilter),X(w=>w===d.scheduleId?w:d.scheduleId),I(w=>{const y=s??d.agentFilter;return w===y?w:y})};return window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)}},[s]),u.useEffect(()=>{if(v==null||r.trim().length>0)return;const t=h.find(d=>d.id===v);t!=null&&j(t.name)},[r,v,h]);const de=u.useMemo(()=>{if(v!=null)return h;const t=r.trim().toLowerCase();return h.filter(d=>!(k!=="all"&&d.status!==k||t.length>0&&!d.name.toLowerCase().includes(t)))},[h,r,k,v]),Ee=bs(h),rs=D!=null||S!=null,ls=async t=>{if(!q(t.id,"MANAGE"))return;const d=t.status==="active"?"paused":"active";try{await a.updateSchedule({...t,status:d}),i(),p(V.Schedule.TOGGLED,{schedule_id:t.id,agent_id:t.agentId,next_status:d})}catch(w){l==null||l.showError(w)}},is=async t=>{if(q(t.id,"MANAGE")){f(d=>new Set(d).add(t.id));try{await a.createScheduleRun({scheduleId:t.id}),p(V.Schedule.RUN_NOW,{schedule_id:t.id,agent_id:t.agentId}),l==null||l.showSuccess({title:"Run started"}),n.invalidateQueries({queryKey:J.schedules.runs(t.id)}),v!=null&&n.invalidateQueries({queryKey:J.schedules.detail(v)})}catch(d){l==null||l.showError(d)}finally{f(d=>{const w=new Set(d);return w.delete(t.id),w})}}},cs=async t=>{if(q(t.id,"DELETE")){R(null);try{await a.deleteSchedule({id:t.id}),i(),p(V.Schedule.DELETED,{schedule_id:t.id,agent_id:t.agentId}),Ce()}catch(d){l==null||l.showError(d)}}},os=()=>{S!=null&&U({scope:A,token:S})},ds=()=>{D!=null&&U({scope:A,token:D})},he=()=>{v!=null&&(X(null),U({scope:A,token:void 0}))};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card-bg",children:[e.jsx(ps,{title:s===void 0?"Agent Schedules":void 0,end:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full sm:w-60",children:e.jsx(Ns,{query:r,setQuery:t=>{j(t),he()},placeholder:"Search schedules by name"})}),e.jsx(me,{value:k,onValueChange:t=>{o(t),he()},options:ut,className:"sm:w-40","aria-label":"Filter by status"}),s===void 0?e.jsx(He,{value:g,selectedLabel:g==="all"?"All agents":C[g]??g,onValueChange:t=>{I(t),he()},onAgentPicked:t=>{N(d=>({...d,[Ke(t)]:t.name}))},allOption:{value:"all",label:"All agents"},className:"sm:w-48","aria-label":"Filter by agent",placeholder:"Search agent"}):null,e.jsxs(M.Primary,{type:"button",disabled:!_,onClick:()=>_&&B({kind:"create",agentId:g!=="all"?g:void 0}),children:[e.jsx(z,{name:"plus",className:"size-3.5"}),"New Schedule"]})]})}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:O("min-h-0 flex-1 overflow-auto",ce!=null?"flex flex-col":void 0),children:we?e.jsx("div",{className:"flex flex-col gap-2 py-1",role:"status","aria-label":"Loading schedules",children:Array.from({length:5},(t,d)=>e.jsx(js,{className:"h-12 w-full rounded-md"},d))}):ce!=null?e.jsx("div",{role:"alert",className:"flex flex-1 flex-col items-center justify-center",children:e.jsx(fe,{title:"Couldn't load schedules",description:ce,className:"h-auto min-h-0 flex-none py-0"})}):h.length===0?e.jsx(fe,{title:"No Schedules Found",description:"Create one to get started.",className:"min-h-full"}):de.length===0?e.jsx(fe,{title:"No Schedules Found",description:"No schedules match your filters.",className:"min-h-full"}):e.jsxs(ys,{className:"min-w-240 bg-card-bg",children:[e.jsx(vs,{children:e.jsxs(Fe,{className:"hover:bg-transparent",children:[e.jsx(H,{children:"Schedule Name"}),e.jsx(H,{children:"Task"}),Ee?e.jsx(H,{children:"Created by"}):null,e.jsx(H,{children:"Frequency"}),e.jsx(H,{children:"Status"}),e.jsx(H,{children:"Last 5 runs"}),e.jsx(H,{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(Ss,{children:de.map(t=>{const d=ae({cron:t.cron,timezone:t.timezone}),w=t.agentName??C[t.agentId]??t.agentId,y=as.get(t.id);return e.jsxs(Fe,{children:[e.jsxs(K,{className:"w-48 max-w-48",children:[e.jsx("span",{className:"text-text-primary block truncate font-medium",children:t.name}),e.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(z,{name:"agent-2",className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:w})]})]}),e.jsx(K,{className:"w-64 max-w-64",children:e.jsx(Ve,{content:t.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:t.task})})}),Ee?e.jsx(K,{children:e.jsx(ks,{subject:t.createdBySubject})}):null,e.jsx(K,{children:d}),e.jsx(K,{children:e.jsx(ss,{status:t.status})}),e.jsx(K,{children:(y==null?void 0:y.pending)===!0?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):(y==null?void 0:y.failed)===!0?e.jsx("span",{className:"text-text-secondary text-sm",children:"Couldn't load runs"}):e.jsx(dt,{runs:(y==null?void 0:y.runs)??$e,...x?{onOpenSession:us=>ns({run:us,schedule:t})}:{}})}),e.jsx(K,{className:"text-right",children:e.jsx(ht,{schedule:t,running:T.has(t.id),canManage:q(t.id,"MANAGE"),canDelete:q(t.id,"DELETE"),onRunNow:()=>void is(t),onEdit:()=>{q(t.id,"MANAGE")&&B({kind:"edit",schedule:t})},onTogglePause:()=>void ls(t),onDelete:()=>{q(t.id,"DELETE")&&R(t)}})})]},t.id)})})]})}),!we&&ce==null&&(de.length>0||rs)?e.jsx("div",{className:"shrink-0 border-t border-border",children:e.jsx(ws,{pageSize:G,rowCount:de.length,canPrev:D!=null,canNext:S!=null,onPrev:ds,onNext:os,pageSizeOptions:mt,onPageSizeChange:t=>{ne(Be(t))}})}):null]}),Q.kind==="create"?e.jsx(Me,{open:!0,mode:"create",initialAgentId:Q.agentId??"",onOpenChange:t=>{t||B({kind:"closed"})},onSaved:()=>{i(),Ce()}}):null,Q.kind==="edit"?e.jsx(Me,{open:!0,mode:"edit",schedule:Q.schedule,onOpenChange:t=>{t||B({kind:"closed"})},onSaved:()=>{i()}}):null,P!=null?e.jsxs(Ts,{open:!0,onOpenChange:t=>{t||R(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(Cs,{children:e.jsxs(Es,{children:[e.jsx(As,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",P.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(zs,{children:[e.jsx(M.Secondary,{type:"button",onClick:()=>R(null),children:"Cancel"}),e.jsx(M.Destructive,{type:"button",disabled:!q(P.id,"DELETE"),onClick:()=>void cs(P),children:"Delete"})]})]}):null]})}export{bt as SchedulesPage};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./AppearanceSettings-
|
|
2
|
-
import{i as L,l as A,bH as I,p as M,q as R,bI as T,a0 as z,aD as V,bJ as B,c as H,bK as W,r,at as C,bL as K,j as n,P as q,I as N,f as F,g as m,bM as G,bN as J,_ as t,S as Q}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./AppearanceSettings-UEYHOB2J-DmthQL1S.js","./index-C5ROvRRa.js","./index-BOoQko_5.css","./ModelSettings-PXQVXZIW-Bq8R7Ku5.js","./chunk-BNMKM5SY-CiR8M-oi.js","./ConnectorSettings-VQ7CTUM5-BLj1QcxG.js","./SkillSettings-DNSX7ANY-DCUzAc7H.js","./SandboxSettings-IH7HAGW2-BtilbrtJ.js","./WebSearchSettings-A7WZKVHW-l95PltgD.js","./MemorySettings-6Y7OQGBZ-Cx6tkpwR.js","./EnvironmentsPage-I4OX4N6O-CaSrJiI0.js","./chunk-4QN7ONBR-CtFqtChE.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as L,l as A,bH as I,p as M,q as R,bI as T,a0 as z,aD as V,bJ as B,c as H,bK as W,r,at as C,bL as K,j as n,P as q,I as N,f as F,g as m,bM as G,bN as J,_ as t,S as Q}from"./index-C5ROvRRa.js";var U=r.lazy(()=>t(()=>import("./AppearanceSettings-UEYHOB2J-DmthQL1S.js"),__vite__mapDeps([0,1,2]),import.meta.url)),X=r.lazy(()=>t(()=>import("./ModelSettings-PXQVXZIW-Bq8R7Ku5.js"),__vite__mapDeps([3,4,1,2]),import.meta.url)),Y=r.lazy(()=>t(()=>import("./ConnectorSettings-VQ7CTUM5-BLj1QcxG.js"),__vite__mapDeps([5,4,1,2]),import.meta.url)),Z=r.lazy(()=>t(()=>import("./SkillSettings-DNSX7ANY-DCUzAc7H.js"),__vite__mapDeps([6,4,1,2]),import.meta.url)),$=r.lazy(()=>t(()=>import("./SandboxSettings-IH7HAGW2-BtilbrtJ.js"),__vite__mapDeps([7,4,1,2]),import.meta.url)),ee=r.lazy(()=>t(()=>import("./WebSearchSettings-A7WZKVHW-l95PltgD.js"),__vite__mapDeps([8,4,1,2]),import.meta.url)),se=r.lazy(()=>t(()=>import("./MemorySettings-6Y7OQGBZ-Cx6tkpwR.js"),__vite__mapDeps([9,1,2]),import.meta.url)),ne=r.lazy(()=>t(()=>import("./EnvironmentsPage-I4OX4N6O-CaSrJiI0.js"),__vite__mapDeps([10,4,1,2,11]),import.meta.url).then(f=>({default:f.EnvironmentsPage})));function re(){return n.jsxs("div",{className:"flex flex-1 items-center justify-center py-8",role:"status","aria-live":"polite","aria-busy":"true",children:[n.jsx(Q,{size:20,className:"text-text-secondary"}),n.jsx("span",{className:"sr-only",children:"Loading"})]})}var le=({headerStart:f}={})=>{const{settingsOpen:a,settingsSection:o,setSettingsOpen:u}=L(),l=A(),g=I(),O=M(),i=R(),v=i==null?void 0:i.settings,y=i!=null&&i.auto.status!=="not_configured",p=T(),x=z(),{refresh:_}=V(),P=B(),D=H(),d=P||D,E=(l==null?void 0:l.skillCatalog)!=null,w=(l==null?void 0:l.sandboxCatalog)!=null,j=W({sandboxEnvironments:O,capabilities:i}),S=(l==null?void 0:l.webSearchCatalog)!=null||g!=null,k=(l==null?void 0:l.memoryCatalog)!=null||g!=null,h=r.useCallback(()=>{x(C.Settings.CLOSED,{section:o}),u(!1)},[o,u,x]);r.useEffect(()=>{if(a)return()=>{_(),p==null||p()}},[a,_,p]),r.useEffect(()=>{if(!a)return;const s=c=>{c.key==="Escape"&&(J()||(c.stopImmediatePropagation(),h()))};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[h,a]);const b=r.useMemo(()=>{const s=[{id:"models",label:"Models",icon:"cpu",capability:y?void 0:"modelProviders"},{id:"connectors",label:"Connectors",icon:"plug",capability:"mcpServers"}];return E&&s.push({id:"skills",label:"Skills",icon:"lightbulb",capability:"skills"}),w&&s.push({id:"sandbox",label:"Sandbox providers",icon:"cube",capability:"sandboxProviders"}),j&&s.push({id:"environments",label:"Environments",icon:"monitor"}),S&&s.push({id:"web-search",label:"Web search",icon:"search",capability:"webSearch"}),k&&s.push({id:"memory",label:"Memory",icon:"brain",capability:"memoryProviders"}),s.push({id:"appearance",label:"Appearance",icon:"type"}),s.filter(c=>c.capability==null||K({settings:v,section:c.capability}))},[y,E,w,j,S,k,v]),e=b.find(s=>s.id===o);return r.useEffect(()=>{const s=b[0];e!==void 0||s===void 0||u(a,s.id)},[e,b,a,u]),!a||!l?null:n.jsxs("div",{className:"flex h-full min-h-0 w-full min-w-0 flex-col overflow-x-hidden bg-card-bg",children:[n.jsx(q,{title:"Settings",start:f??n.jsx("button",{type:"button","aria-label":"Back",title:"Back",className:F({variant:"ghost",size:"icon"}),onClick:h,children:n.jsx(N,{name:"arrow-left"})})}),n.jsxs("div",{className:m("flex min-h-0 min-w-0 flex-1 flex-col",!d&&"md:flex-row"),children:[n.jsx("nav",{"aria-label":"Settings sections",className:m("flex w-full min-w-0 gap-1 border-b border-border bg-card-bg p-2",d?"overflow-x-auto":"justify-center md:w-48 md:flex-col md:justify-start md:border-b-0 md:border-r"),children:b.map(s=>n.jsxs("button",{type:"button","aria-current":o===s.id?"page":void 0,...d?{title:s.label}:{},className:m("flex min-h-9 cursor-pointer items-center gap-2 rounded-md px-2 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",d?"min-w-0 flex-1 justify-center gap-1.5 px-1.5":"shrink-0",o===s.id?G:"text-text-secondary hover:bg-ghost-button-hover/60 hover:text-text-primary"),onClick:()=>{x(C.Settings.SECTION_CHANGED,{section:s.id}),u(!0,s.id)},children:[n.jsx(N,{name:s.icon,className:"h-4 w-4 shrink-0"}),d?n.jsx("span",{className:"truncate",children:s.label}):s.label]},s.id))}),n.jsx("section",{className:m("flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden overflow-y-hidden bg-card-bg",(e==null?void 0:e.id)==="environments"?"p-0":"px-4 py-4 sm:px-6"),children:n.jsx("div",{className:m("mx-auto flex h-full min-h-0 w-full min-w-0 flex-col",(e==null?void 0:e.id)==="environments"?"max-w-none":"max-w-210"),children:n.jsxs(r.Suspense,{fallback:n.jsx(re,{}),children:[(e==null?void 0:e.id)==="models"?n.jsx(X,{}):null,(e==null?void 0:e.id)==="connectors"?n.jsx(Y,{}):null,(e==null?void 0:e.id)==="skills"?n.jsx(Z,{}):null,(e==null?void 0:e.id)==="sandbox"?n.jsx($,{}):null,(e==null?void 0:e.id)==="environments"?n.jsx(ne,{embedded:!0}):null,(e==null?void 0:e.id)==="web-search"?n.jsx(ee,{}):null,(e==null?void 0:e.id)==="memory"?n.jsx(se,{}):null,(e==null?void 0:e.id)==="appearance"?n.jsx(U,{}):null]})})})]})]})},ae=le;export{ae as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as ce,k as pe,l as ge,m as ye,n as fe,o as he,p as de,q as me,t as Se,r as a,v as Ae,w as be,x as Oe,y as ve,z as Ne,A as M,B as E,E as ee,F as _}from"./index-C5ROvRRa.js";import{u as Re,a as Ee}from"./chunk-OB3PAWPO-CYqixJeQ.js";var T="try_agent_name",$="history_agent_name";function ne(t){return t!=null&&t.length>0?t:null}function B(t){const o=new URLSearchParams(t.startsWith("?")?t.slice(1):t),e=ne(o.get(T));if(e!=null)return{intent:"try-agent",agentName:e};const c=ne(o.get($));return c==null?null:{intent:"history",agentName:c}}function Ce(t,o){t.delete(T),t.delete($),o!=null&&t.set(o.intent==="try-agent"?T:$,o.agentName)}function te(t,o){const e=new URLSearchParams(t.startsWith("?")?t.slice(1):t);Ce(e,o);const c=e.toString();return c.length>0?`?${c}`:""}function se(t){const o=t.sessionAccessError!=null?t.pendingSessionId:t.activeRemoteId??t.pendingSessionId;if(o!=null)return{type:"session",sessionId:o};const{mode:e,agentConfigMode:c}=t;if(e.status==="active"&&e.isMutable&&e.isCreateAgent)return{type:"buildAgent"};if(e.status==="active"&&!e.isMutable&&c!=="SingleAgent"){const d=e.agentName??e.agentId;if(d!=null)return{type:"agent",agentName:d}}return{type:"root"}}function Ie(t){return t.settingsOpen&&t.settingsSection==="environments"?{type:"environments"}:t.settingsOpen?{type:"settings"}:t.schedulesOpen?{type:"schedules"}:t.environmentsOpen?{type:"environments"}:t.sessionsOpen&&t.sharedSessionId!=null?{type:"sharedSession",sessionId:t.sharedSessionId}:t.sessionsOpen?{type:"sessionsBrowser"}:t.libraryOpen&&t.libraryAgentId!=null?{type:"libraryAgent",agentId:t.libraryAgentId}:t.libraryOpen?{type:"library"}:se(t)}function O(t){return t.type==="root"||t.type==="agent"||t.type==="session"}function k(t){return t==="try-agent"}function Pe(t){return t.type==="sessionsBrowser"||t.type==="sharedSession"}function we({routes:t,activeRemoteId:o}){var V,X;const e=ce(),c=pe(),d=ge(),v=ye(),C=fe(),q=he(),G=de(),K=me(),W=Se(),I=Re(),r=Ee(),u=a.useMemo(()=>Ae({routes:t,catalog:d,capabilities:K,sessions:v,schedules:q,sandboxEnvironments:G}),[t,d,K,v,q,G]),re=u.settings!=null,ie=[u.settings,u.sessionsBrowser,u.sharedSession,u.libraryAgent,u.schedules,u.environments].join("\0"),Y={settingsOpen:e.settingsOpen,settingsSection:e.settingsSection,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},p=Ie(Y),ae=JSON.stringify(p),m=a.useRef(null),P=a.useRef(null),N=a.useRef(null),R=a.useRef(!1),S=a.useRef(null),[le,oe]=a.useState(0),h=a.useRef(null),F=a.useRef(null),U=`${e.runtimeKey}\0${e.pendingSessionEpoch}`,H=a.useRef(U);H.current=U;const g=a.useRef(null),z=a.useRef(!1),Q=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=S.current;(s==null?void 0:s.type)==="session"&&s.sessionId===n&&(S.current=null,oe(l=>l+1))},[]),D=a.useCallback(n=>{if(F.current=n,c==null){e.openHistorySession({sessionId:n});return}const s=H.current,l=C==null||v==null?Promise.resolve(!0):C.listPermissions({resourceType:"session",resourceIds:[n]}).then(i=>(i.data.permissions[n]??[]).includes("MANAGE")).catch(()=>!0);Promise.all([c.getSession({sessionId:n}),l]).then(([i,y])=>{if(F.current!==n){A(n);return}if(!y){A(n),e.openSharedSession(n);return}e.openHistorySession({sessionId:n,isMutable:i.isMutable,isCreateAgent:be(i),...i.agentName!=null?{agentName:i.agentName}:{}})}).catch(i=>{if(F.current!==n){A(n);return}if(H.current!==s){A(n);return}e.openInaccessibleSession({sessionId:n,message:Oe(i,"This session could not be loaded.")})})},[C,A,c,v,e]),f=a.useCallback(n=>{if(n==null){g.current=null,h.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){g.current=null;return}g.current=s,e.setHistoryAgentFilter(n),c!=null&&ve({server:c,agentName:n.agentName}).then(i=>{if(g.current===s){if(i==null){g.current=null,h.current=null,e.setHistoryAgentFilter(null);return}g.current=null,e.setHistoryAgentFilter({agentId:Ne(i),agentName:i.name,intent:n.intent})}}).catch(()=>{g.current===s&&(g.current=null,h.current=null,e.setHistoryAgentFilter(null))})},[c,e]),J=a.useCallback(n=>{e.selectLibraryAgent({isMutable:!1,agentName:n}),f({intent:"try-agent",agentName:n})},[f,e]),w=a.useCallback(n=>{switch(n.type){case"settings":e.setSettingsOpen(!0,e.settingsSection==="environments"?"appearance":void 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;D(n.sessionId);return;case"agent":e.setLibraryOpen(!1),J(n.agentName);return;case"root":j();return}},[e,o,j,J,D]);return a.useEffect(()=>{var b;if(R.current)return;const n=M({pathname:r.pathname,search:r.search,routes:t});if(!W&&((n==null?void 0:n.type)==="settings"||(n==null?void 0:n.type)==="environments"))return;R.current=!0;const s=M({pathname:r.pathname,search:r.search,routes:u})??{type:"root"},l=s.type==="agent"?{intent:"try-agent",agentName:s.agentName}:O(s)?B(r.search):null;if(h.current=l,N.current=s,s.type==="settings")re&&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 L=se(Y);E(L,s)||w(s)}s.type!=="agent"&&l!=null?f(l):!O(s)&&k((b=e.historyAgentFilter)==null?void 0:b.intent)&&f(null),S.current=E(p,s)?null:s;const i=ee(s,u),y=te(_(s,r.search),l);P.current=s,i!=null&&(i!==r.pathname||y!==r.search)&&(m.current=i!==r.pathname?i:null,I({pathname:i,search:y,hash:r.hash},{replace:!0}))},[W]),a.useEffect(()=>{if(!R.current)return;if(!z.current){z.current=!0;return}const n=S.current;if(n!=null){if(!E(p,n))return;S.current=null}const s=ee(p,u);if(s==null)return;const i=`${u.basename.endsWith("/")?u.basename.slice(0,-1):u.basename}${r.pathname}`||"/",y=window.location.pathname===i?window.location.search:r.search,b=O(p),L=b?e.historyAgentFilter==null?h.current:{intent:e.historyAgentFilter.intent,agentName:e.historyAgentFilter.agentName}:null;!b&&e.historyAgentFilter!=null&&k(e.historyAgentFilter.intent)&&(g.current=null,e.setHistoryAgentFilter(null)),e.historyAgentFilter!=null&&(h.current=null);const Z=te(_(p,y),L),x=P.current;if(P.current=p,s===r.pathname&&Z===r.search)return;const ue=p.type==="session"&&e.pendingSessionId==null&&x!=null&&x.type!=="session";m.current=s!==r.pathname?s:null,I({pathname:s,search:Z,hash:r.hash},{replace:ue})},[ae,ie,le,(V=e.historyAgentFilter)==null?void 0:V.agentName,(X=e.historyAgentFilter)==null?void 0:X.intent]),a.useEffect(()=>{var l;if(!R.current)return;if(!Q.current){Q.current=!0;return}if(m.current===r.pathname){m.current=null,N.current=p;return}const n=M({pathname:r.pathname,search:r.search,routes:u});if(n==null){const i=u.root,y=_({type:"root"},r.search);m.current=i,I({pathname:i,search:y,hash:r.hash},{replace:!0}),w({type:"root"}),f(B(y));return}const s=N.current;N.current=n,(s==null||!E(s,n))&&(n.type!=="settings"&&e.settingsOpen&&e.setSettingsOpen(!1),n.type!=="library"&&n.type!=="libraryAgent"&&e.libraryOpen&&e.setLibraryOpen(!1),!Pe(n)&&e.sessionsOpen&&e.setSessionsOpen(!1),n.type!=="schedules"&&e.schedulesOpen&&e.setSchedulesOpen(!1),n.type!=="environments"&&e.environmentsOpen&&e.setEnvironmentsOpen(!1),w(n)),n.type!=="agent"&&O(n)?f(B(r.search)):!O(n)&&k((l=e.historyAgentFilter)==null?void 0:l.intent)&&f(null)},[r.pathname,r.search]),null}export{we as ShellRouteSync};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-OKV2POOV-CsW3joKv.js","./index-C5ROvRRa.js","./index-BOoQko_5.css","./SchedulesPage-I52TNBAZ-ClnGQZ5d.js","./chunk-4QN7ONBR-CtFqtChE.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{dj as z,r as l,j as s,dk as Pe,cj as k,dl as rt,dm as hn,u as ne,dn as ot,dp as at,dq as it,dr as ct,ds as lt,dt as oe,du as pn,dv as O,dw as xn,dx as gn,dy as vn,dz as wn,dA as bn,dB as yn,dC as In,dD as Cn,dE as Ee,dF as Sn,dG as jn,dH as ve,dI as Mn,dJ as Ln,dK as Nn,dL as dt,dM as Ye,dN as we,dO as Ae,dP as de,dQ as De,dR as _e,dS as Oe,dT as qe,k as ke,a0 as ut,b as ae,d as M,cq as Tn,a1 as Rn,cr as Ce,dU as Pn,ct as mt,cu as En,cs as An,dV as Dn,g as D,$ as _n,dW as On,dX as kn,at as pe,cW as xe,dY as he,dZ as Bn,w as Fn,d_ as Je,V as Kn,bJ as ft,c as Be,f as re,I as X,d$ as ht,e0 as zn,s as Fe,e1 as Qe,bY as $n,aE as Hn,ab as Ze,e2 as Gn,a8 as Un,ax as et,z as Se,e3 as pt,e4 as xt,e5 as Vn,e6 as Wn,P as Xn,S as tt,D as Yn,e7 as Ke,e8 as ze,e9 as gt,d7 as $e,_ as vt,d8 as wt,d9 as qn,d6 as bt,dc as je,ea as Jn}from"./index-C5ROvRRa.js";import{A as Qn,N as Zn,T as es,S as Me}from"./chunk-DW4YYV6Q-Cm0KW5r-.js";import{C as ts}from"./chunk-BNMKM5SY-CiR8M-oi.js";import{s as ns,u as ss,S as rs}from"./chunk-OO6QO7FR-DrdcbTUi.js";const yt=l.memo(n=>{const t=z(6),{index:e,archived:r,components:o}=n,i=r===void 0?!1:r,c=o.ThreadListItem;let a;t[0]!==c?(a=s.jsx(c,{}),t[0]=c,t[1]=a):a=t[1];let m;return t[2]!==i||t[3]!==e||t[4]!==a?(m=s.jsx(Pe,{index:e,archived:i,children:a}),t[2]=i,t[3]=e,t[4]=a,t[5]=m):m=t[5],m},(n,t)=>n.index===t.index&&n.archived===t.archived&&n.components.ThreadListItem===t.components.ThreadListItem);yt.displayName="ThreadListPrimitive.ItemByIndex";const nt=({archived:n,children:t})=>{const e=k(r=>n?r.threads.archivedThreadIds.length:r.threads.threadIds.length);return rt(()=>Array.from({length:e},(r,o)=>s.jsx(Pe,{index:o,archived:n,children:s.jsx(hn,{getItemState:i=>i.threads().item({index:o,archived:n}).getState(),children:i=>t({get threadListItem(){return i()}})})},o)),[e,n,t])},It=n=>{const t=z(8),{archived:e,components:r,children:o}=n,i=e===void 0?!1:e;if(r){const a=r.ThreadListItem;let m;t[0]!==a?(m=()=>s.jsx(a,{}),t[0]=a,t[1]=m):m=t[1];let d;return t[2]!==i||t[3]!==m?(d=s.jsx(nt,{archived:i,children:m}),t[2]=i,t[3]=m,t[4]=d):d=t[4],d}let c;return t[5]!==i||t[6]!==o?(c=s.jsx(nt,{archived:i,children:o}),t[5]=i,t[6]=o,t[7]=c):c=t[7],c};It.displayName="ThreadListPrimitive.Items";const Ct=n=>{const t=z(2),{fallback:e}=n,r=k(os)||e;let o;return t[0]!==r?(o=s.jsx(s.Fragment,{children:r}),t[0]=r,t[1]=o):o=t[1],o};Ct.displayName="ThreadListItemPrimitive.Title";function os(n){return n.threadListItem.title}const as=()=>{const n=z(4),t=ne();let e;n[0]!==t?(e=()=>{t.threadListItem().archive()},n[0]=t,n[1]=e):e=n[1];const r=e;let o;return n[2]!==r?(o={archive:r},n[2]=r,n[3]=o):o=n[3],o},is=()=>{const n=z(4),t=ne();let e;n[0]!==t?(e=()=>{t.threadListItem().delete()},n[0]=t,n[1]=e):e=n[1];const r=e;let o;return n[2]!==r?(o={delete:r},n[2]=r,n[3]=o):o=n[3],o},cs=()=>{const n=z(4),t=ne();let e;n[0]!==t?(e=()=>{t.threadListItem().unarchive()},n[0]=t,n[1]=e):e=n[1];const r=e;let o;return n[2]!==r?(o={unarchive:r},n[2]=r,n[3]=o):o=n[3],o},ls=()=>{const n=z(4),t=ne();let e;n[0]!==t?(e=()=>{t.threadListItem().switchTo()},n[0]=t,n[1]=e):e=n[1];const r=e;let o;return n[2]!==r?(o={switchTo:r},n[2]=r,n[3]=o):o=n[3],o},ds=()=>{const n=z(4),t=ne();let e;n[0]!==t?(e=()=>{t.threads().switchToNewThread()},n[0]=t,n[1]=e):e=n[1];const r=e;let o;return n[2]!==r?(o={switchToNewThread:r},n[2]=r,n[3]=o):o=n[3],o},us=()=>{const n=z(5),t=ne(),e=k(ms);let r;n[0]!==t?(r=()=>{t.threads().loadMore()},n[0]=t,n[1]=r):r=n[1];const o=r;let i;return n[2]!==e||n[3]!==o?(i={loadMore:o,disabled:e},n[2]=e,n[3]=o,n[4]=i):i=n[4],i};function ms(n){return!n.threads.hasMore||n.threads.isLoading||n.threads.isLoadingMore}var fs=Object.defineProperty,N=(n,t)=>fs(n,"name",{value:t,configurable:!0}),hs=["Enter"," "],ps=["ArrowDown","PageUp","Home"],St=["ArrowUp","PageDown","End"],xs=[...ps,...St],be="Menu",[Le,gs,vs]=ct(be),[ie,jt]=ot(be,[vs,at,it]),He=at(),Mt=it(),[ws,ue]=ie(be),[bs,Ge]=ie(be),ys=N(n=>{const{__scopeMenu:t,open:e=!1,children:r,dir:o,onOpenChange:i,modal:c=!0}=n,a=He(t),[m,d]=l.useState(null),f=l.useRef(!1),u=jn(i),h=ve(o);return l.useEffect(()=>{const p=N(()=>{f.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=N(()=>f.current=!1,"handlePointer");return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),l.useEffect(()=>{if(!e)return;const p=N(()=>u(!1),"handleBlur");return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[e,u]),s.jsx(Mn,{...a,children:s.jsx(ws,{scope:t,open:e,onOpenChange:u,content:m,onContentChange:d,children:s.jsx(bs,{scope:t,onClose:l.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:h,modal:c,children:r})})})},"Menu"),Is=l.forwardRef(N(function(t,e){const{__scopeMenu:r,...o}=t,i=He(r);return s.jsx(Ln,{...i,...o,ref:e})},"MenuAnchor")),Lt="MenuPortal",[Cs,Ss]=ie(Lt,{forceMount:void 0}),js=N(n=>{const{__scopeMenu:t,forceMount:e,children:r,container:o}=n,i=ue(Lt,t);return s.jsx(Cs,{scope:t,forceMount:e,children:s.jsx(lt,{present:e||i.open,children:s.jsx(Nn,{asChild:!0,container:o,children:r})})})},"MenuPortal"),se="MenuContent",[Ms,Nt]=ie(se),Ls=l.forwardRef(N(function(t,e){const r=Ss(se,t.__scopeMenu),{forceMount:o=r.forceMount,...i}=t,c=ue(se,t.__scopeMenu),a=Ge(se,t.__scopeMenu);return s.jsx(Le.Provider,{scope:t.__scopeMenu,children:s.jsx(lt,{present:o||c.open,children:s.jsx(Le.Slot,{scope:t.__scopeMenu,children:a.modal?s.jsx(Ns,{...i,ref:e}):s.jsx(Ts,{...i,ref:e})})})})},"MenuContent")),Ns=l.forwardRef(N(function(t,e){const r=ue(se,t.__scopeMenu),o=l.useRef(null),i=oe(e,o);return l.useEffect(()=>{const c=o.current;if(c)return pn(c)},[]),s.jsx(Tt,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:O(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),Ts=l.forwardRef(N(function(t,e){const r=ue(se,t.__scopeMenu);return s.jsx(Tt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),Rs=Sn("MenuContent.ScrollLock"),Tt=l.forwardRef(N(function(t,e){const{__scopeMenu:r,loop:o=!1,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:a,disableOutsidePointerEvents:m,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:h,onInteractOutside:p,onDismiss:g,disableOutsideScroll:x,...S}=t,I=ue(se,r),j=Ge(se,r),C=He(r),_=Mt(r),R=gs(r),[L,G]=l.useState(null),K=l.useRef(null),U=oe(e,K,I.onContentChange),$=l.useRef(0),y=l.useRef(""),T=l.useRef(0),P=l.useRef(null),q=l.useRef("right"),V=l.useRef(0),te=x?gn:l.Fragment,J=x?{as:Rs,allowPinchZoom:!0}:void 0,Q=N(v=>{var ee,H;const w=y.current+v,A=R().filter(F=>!F.disabled),B=document.activeElement,b=(ee=A.find(F=>F.ref.current===B))==null?void 0:ee.textValue,Z=A.map(F=>F.textValue),Y=Dt(Z,w,b),W=(H=A.find(F=>F.textValue===Y))==null?void 0:H.ref.current;N((function F(fe){y.current=fe,window.clearTimeout($.current),fe!==""&&($.current=window.setTimeout(()=>F(""),1e3))}),"updateSearch")(w),W&&setTimeout(()=>W.focus())},"handleTypeaheadSearch");l.useEffect(()=>()=>window.clearTimeout($.current),[]),xn();const E=l.useCallback(v=>{var A,B;return q.current===((A=P.current)==null?void 0:A.side)&&Ot(v,(B=P.current)==null?void 0:B.area)},[]);return s.jsx(Ms,{scope:r,searchRef:y,onItemEnter:l.useCallback(v=>{E(v)&&v.preventDefault()},[E]),onItemLeave:l.useCallback(v=>{var w;E(v)||((w=K.current)==null||w.focus(),G(null))},[E]),onTriggerLeave:l.useCallback(v=>{E(v)&&v.preventDefault()},[E]),pointerGraceTimerRef:T,onPointerGraceIntentChange:l.useCallback(v=>{P.current=v},[]),children:s.jsx(te,{...J,children:s.jsx(vn,{asChild:!0,trapped:i,onMountAutoFocus:O(c,v=>{var w;v.preventDefault(),(w=K.current)==null||w.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:s.jsx(wn,{asChild:!0,disableOutsidePointerEvents:m,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:h,onInteractOutside:p,onDismiss:g,children:s.jsx(bn,{asChild:!0,..._,dir:j.dir,orientation:"vertical",loop:o,currentTabStopId:L,onCurrentTabStopIdChange:G,onEntryFocus:O(d,v=>{j.isUsingKeyboardRef.current||v.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(yn,{role:"menu","aria-orientation":"vertical","data-state":Rt(I.open),"data-radix-menu-content":"",dir:j.dir,...C,...S,ref:U,style:{outline:"none",...S.style},onKeyDown:O(S.onKeyDown,v=>{const A=v.target.closest("[data-radix-menu-content]")===v.currentTarget,B=v.ctrlKey||v.altKey||v.metaKey,b=v.key.length===1;A&&(v.key==="Tab"&&v.preventDefault(),!B&&b&&Q(v.key));const Z=K.current;if(v.target!==Z||!xs.includes(v.key))return;v.preventDefault();const W=R().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);St.includes(v.key)&&W.reverse(),Et(W)}),onBlur:O(t.onBlur,v=>{v.currentTarget.contains(v.target)||(window.clearTimeout($.current),y.current="")}),onPointerMove:O(t.onPointerMove,ge(v=>{const w=v.target,A=V.current!==v.clientX;if(v.currentTarget.contains(w)&&A){const B=v.clientX>V.current?"right":"left";q.current=B,V.current=v.clientX}}))})})})})})})},"MenuContentImpl")),Ne="MenuItem",st="menu.itemSelect",Ps=l.forwardRef(N(function(t,e){const{disabled:r=!1,onSelect:o,...i}=t,c=l.useRef(null),a=Ge(Ne,t.__scopeMenu),m=Nt(Ne,t.__scopeMenu),d=oe(e,c),f=l.useRef(!1),u=N(()=>{const h=c.current;if(!r&&h){const p=new CustomEvent(st,{bubbles:!0,cancelable:!0});h.addEventListener(st,g=>o==null?void 0:o(g),{once:!0}),In(h,p),p.defaultPrevented?f.current=!1:a.onClose()}},"handleSelect");return s.jsx(Es,{...i,ref:d,disabled:r,onClick:O(t.onClick,u),onPointerDown:h=>{var p;(p=t.onPointerDown)==null||p.call(t,h),f.current=!0},onPointerUp:O(t.onPointerUp,h=>{var p;f.current||(p=h.currentTarget)==null||p.click()}),onKeyDown:O(t.onKeyDown,h=>{r||h.target!==h.currentTarget||m.searchRef.current!==""&&h.key===" "||hs.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),Es=l.forwardRef(N(function(t,e){const{__scopeMenu:r,disabled:o=!1,textValue:i,...c}=t,a=Nt(Ne,r),m=Mt(r),d=l.useRef(null),f=oe(e,d),[u,h]=l.useState(!1),[p,g]=l.useState("");return l.useEffect(()=>{const x=d.current;x&&g((x.textContent??"").trim())},[c.children]),s.jsx(Le.ItemSlot,{scope:r,disabled:o,textValue:i??p,children:s.jsx(Cn,{asChild:!0,...m,focusable:!o,children:s.jsx(Ee.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...c,ref:f,onPointerMove:O(t.onPointerMove,ge(x=>{o?a.onItemLeave(x):(a.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:O(t.onPointerLeave,ge(x=>a.onItemLeave(x))),onFocus:O(t.onFocus,()=>h(!0)),onBlur:O(t.onBlur,()=>h(!1))})})})},"MenuItemImpl")),As="MenuRadioGroup",[qr,Jr]=ie(As,{value:void 0,onValueChange:N(()=>{},"onValueChange")}),Ds="MenuItemIndicator",[Qr,Zr]=ie(Ds,{checked:!1}),_s=l.forwardRef(N(function(t,e){const{__scopeMenu:r,...o}=t;return s.jsx(Ee.div,{role:"separator","aria-orientation":"horizontal",...o,ref:e})},"MenuSeparator")),Os="MenuSub",[eo,to]=ie(Os);function Rt(n){return n?"open":"closed"}N(Rt,"getOpenState");function Pt(n){return n==="indeterminate"}N(Pt,"isIndeterminate");function ks(n){return Pt(n)?"indeterminate":n?"checked":"unchecked"}N(ks,"getCheckedState");function Et(n){const t=document.activeElement;for(const e of n)if(e===t||(e.focus(),document.activeElement!==t))return}N(Et,"focusFirst");function At(n,t){return n.map((e,r)=>n[(t+r)%n.length])}N(At,"wrapArray");function Dt(n,t,e){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=e?n.indexOf(e):-1;let c=At(n,Math.max(i,0));o.length===1&&(c=c.filter(d=>d!==e));const m=c.find(d=>d.toLowerCase().startsWith(o.toLowerCase()));return m!==e?m:void 0}N(Dt,"getNextMatch");function _t(n,t){const{x:e,y:r}=n;let o=!1;for(let i=0,c=t.length-1;i<t.length;c=i++){const a=t[i],m=t[c],d=a.x,f=a.y,u=m.x,h=m.y;f>r!=h>r&&e<(u-d)*(r-f)/(h-f)+d&&(o=!o)}return o}N(_t,"isPointInPolygon");function Ot(n,t){if(!t)return!1;const e={x:n.clientX,y:n.clientY};return _t(e,t)}N(Ot,"isPointerInGraceArea");function ge(n){return t=>t.pointerType==="mouse"?n(t):void 0}N(ge,"whenMouse");var Bs=ys,Fs=Is,Ks=js,zs=Ls,$s=Ps,Hs=_s,Gs=Object.defineProperty,ce=(n,t)=>Gs(n,"name",{value:t,configurable:!0}),Ue="DropdownMenu",[Us,kt]=ot(Ue,[jt]),le=jt(),[Vs,Bt]=Us(Ue),Ft=ce(n=>{const{__scopeDropdownMenu:t,children:e,dir:r,open:o,defaultOpen:i,onOpenChange:c,modal:a=!0}=n,m=le(t),d=l.useRef(null),[f,u]=dt({prop:o,defaultProp:i??!1,onChange:c,caller:Ue});return s.jsx(Vs,{scope:t,triggerId:Ye(),triggerRef:d,contentId:Ye(),open:f,onOpenChange:u,onOpenToggle:l.useCallback(()=>u(h=>!h),[u]),modal:a,children:s.jsx(Bs,{...m,open:f,onOpenChange:u,dir:r,modal:a,children:e})})},"DropdownMenu"),Ws="DropdownMenuTrigger",Kt=l.forwardRef(ce(function(t,e){const{__scopeDropdownMenu:r,disabled:o=!1,...i}=t,c=Bt(Ws,r),a=le(r),m=oe(e,c.triggerRef);return s.jsx(Fs,{asChild:!0,...a,children:s.jsx(Ee.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":o?"":void 0,disabled:o,...i,ref:m,onPointerDown:O(t.onPointerDown,d=>{!o&&d.button===0&&d.ctrlKey===!1&&(c.onOpenToggle(),c.open||d.preventDefault())}),onKeyDown:O(t.onKeyDown,d=>{o||(["Enter"," "].includes(d.key)&&c.onOpenToggle(),d.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})},"DropdownMenuTrigger")),zt=ce(n=>{const{__scopeDropdownMenu:t,...e}=n,r=le(t);return s.jsx(Ks,{...r,...e})},"DropdownMenuPortal"),Xs="DropdownMenuContent",$t=l.forwardRef(ce(function(t,e){const{__scopeDropdownMenu:r,...o}=t,i=Bt(Xs,r),c=le(r),a=l.useRef(!1);return s.jsx(zs,{id:i.contentId,"aria-labelledby":i.triggerId,...c,...o,ref:e,onCloseAutoFocus:O(t.onCloseAutoFocus,m=>{var d;a.current||(d=i.triggerRef.current)==null||d.focus(),a.current=!1,m.preventDefault()}),onInteractOutside:O(t.onInteractOutside,m=>{const d=m.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,u=d.button===2||f;(!i.modal||u)&&(a.current=!0)}),style:{...t.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")),Ht=l.forwardRef(ce(function(t,e){const{__scopeDropdownMenu:r,...o}=t,i=le(r);return s.jsx($s,{...i,...o,ref:e})},"DropdownMenuItem")),Gt=l.forwardRef(ce(function(t,e){const{__scopeDropdownMenu:r,...o}=t,i=le(r);return s.jsx(Hs,{...i,...o,ref:e})},"DropdownMenuSeparator")),Ut=Ft,Vt=Kt,Ys=zt,Wt=$t,Xt=Ht,Yt=Gt;const qs=Object.freeze(Object.defineProperty({__proto__:null,Content:Wt,DropdownMenu:Ft,DropdownMenuContent:$t,DropdownMenuItem:Ht,DropdownMenuPortal:zt,DropdownMenuSeparator:Gt,DropdownMenuTrigger:Kt,Item:Xt,Portal:Ys,Root:Ut,Separator:Yt,Trigger:Vt,createDropdownMenuScope:kt},Symbol.toStringTag,{value:"Module"})),Js=we(Vt),Qs=we(Wt),Zs=we(Xt),er=we(Yt),qt=l.forwardRef((n,t)=>{const e=z(15);let r,o,i;e[0]!==n?({onClick:o,disabled:r,...i}=n,e[0]=n,e[1]=r,e[2]=o,e[3]=i):(r=e[1],o=e[2],i=e[3]);const c=k(tr),{switchToNewThread:a}=ds();let m;e[4]!==c?(m=c?{"data-active":"true","aria-current":"true"}:null,e[4]=c,e[5]=m):m=e[5];let d;e[6]!==o||e[7]!==a?(d=O(o,a),e[6]=o,e[7]=a,e[8]=d):d=e[8];let f;return e[9]!==r||e[10]!==t||e[11]!==i||e[12]!==m||e[13]!==d?(f=s.jsx(Ae.button,{type:"button",...m,...i,ref:t,disabled:r,onClick:d}),e[9]=r,e[10]=t,e[11]=i,e[12]=m,e[13]=d,e[14]=f):f=e[14],f});qt.displayName="ThreadListPrimitive.New";function tr(n){return n.threads.newThreadId===n.threads.mainThreadId}const nr=()=>{const{loadMore:n,disabled:t}=us();return t?null:n},sr=de("ThreadListPrimitive.LoadMore",nr),[rr,or]=ct("ThreadList"),Te=rr,Jt=_e(null),ar=Jt.Provider,Ve=()=>De(Jt),Qt=l.forwardRef((n,t)=>{const e=z(3);let r;return e[0]!==n||e[1]!==t?(r=s.jsx(Te.Provider,{scope:void 0,children:s.jsx(Te.Slot,{scope:void 0,children:s.jsx(Ae.div,{...n,ref:t})})}),e[0]=n,e[1]=t,e[2]=r):r=e[2],r});Qt.displayName="ThreadListPrimitive.Root";var ir=Oe({ItemByIndex:()=>yt,Items:()=>It,LoadMore:()=>sr,New:()=>qt,Root:()=>Qt});const Zt=l.forwardRef((n,t)=>{const e=k(d=>d.threads.mainThreadId===d.threadListItem.id),r=qe(null),o=qe(null),i=rt(()=>({triggerRef:r,moreRef:o}),[]),c=or(void 0),a=ve(),m=d=>{const f=a==="rtl"?"ArrowLeft":"ArrowRight",u=a==="rtl"?"ArrowRight":"ArrowLeft",h=r.current,p=o.current;if(h&&d.target===h)if(d.key==="ArrowDown"||d.key==="ArrowUp"){const g=c().map(S=>S.ref.current).filter(S=>S!==null),x=g[g.indexOf(h)+(d.key==="ArrowDown"?1:-1)];x&&(x.focus(),d.preventDefault())}else d.key===f&&p&&(p.focus(),d.preventDefault());else p&&d.target===p&&d.key===u&&(h==null||h.focus(),d.preventDefault())};return s.jsx(ar,{value:i,children:s.jsx(Ae.div,{...e?{"data-active":"true","aria-current":"true"}:null,...n,onKeyDown:O(n.onKeyDown,m),ref:t})})});Zt.displayName="ThreadListItemPrimitive.Root";const cr=()=>{const{archive:n}=as();return n},lr=de("ThreadListItemPrimitive.Archive",cr),dr=()=>{const{unarchive:n}=cs();return n},ur=de("ThreadListItemPrimitive.Unarchive",dr),mr=()=>{const{delete:n}=is();return n},fr=de("ThreadListItemPrimitive.Delete",mr),hr=()=>{const{switchTo:n}=ls();return n},pr=de("ThreadListItemPrimitive.Trigger",hr),en=l.forwardRef((n,t)=>{var i;const e=z(3),r=oe(t,(i=Ve())==null?void 0:i.triggerRef);let o;return e[0]!==n||e[1]!==r?(o=s.jsx(Te.ItemSlot,{scope:void 0,children:s.jsx(pr,{...n,ref:r})}),e[0]=n,e[1]=r,e[2]=o):o=e[2],o});en.displayName="ThreadListItemPrimitive.Trigger";var xr=Oe({Archive:()=>lr,Delete:()=>fr,Root:()=>Zt,Title:()=>Ct,Trigger:()=>en,Unarchive:()=>ur});const me=kt(),tn=_e(()=>{}),nn=()=>De(tn),sn=_e(!1),rn=()=>De(sn),on=n=>{const t=z(26);let e,r,o,i,c,a,m;t[0]!==n?({__scopeThreadListItemMore:e,open:c,defaultOpen:r,onOpenChange:i,sharedFocusGroup:m,modal:o,...a}=n,t[0]=n,t[1]=e,t[2]=r,t[3]=o,t[4]=i,t[5]=c,t[6]=a,t[7]=m):(e=t[1],r=t[2],o=t[3],i=t[4],c=t[5],a=t[6],m=t[7]);const d=m===void 0?!1:m,f=d?!1:o??!0,u=me(e),h=r??!1;let p;t[8]!==i?(p=i?{onChange:i}:{},t[8]=i,t[9]=p):p=t[9];let g;t[10]!==c||t[11]!==h||t[12]!==p?(g={prop:c,defaultProp:h,caller:"ThreadListItemMorePrimitive.Root",...p},t[10]=c,t[11]=h,t[12]=p,t[13]=g):g=t[13];const[x,S]=dt(g);let I;t[14]!==f||t[15]!==x||t[16]!==a||t[17]!==u||t[18]!==S?(I=s.jsx(Ut,{...u,...a,modal:f,open:x,onOpenChange:S}),t[14]=f,t[15]=x,t[16]=a,t[17]=u,t[18]=S,t[19]=I):I=t[19];let j;t[20]!==S||t[21]!==I?(j=s.jsx(tn.Provider,{value:S,children:I}),t[20]=S,t[21]=I,t[22]=j):j=t[22];let C;return t[23]!==d||t[24]!==j?(C=s.jsx(sn.Provider,{value:d,children:j}),t[23]=d,t[24]=j,t[25]=C):C=t[25],C};on.displayName="ThreadListItemMorePrimitive.Root";const an=l.forwardRef((n,t)=>{const e=z(10),{__scopeThreadListItemMore:r,...o}=n,i=me(r),c=Ve(),a=nn(),m=rn(),d=oe(t,c==null?void 0:c.moreRef),f=ve()==="rtl"?"ArrowLeft":"ArrowRight",u=Js;let h;e[0]!==f||e[1]!==a||e[2]!==m?(h=x=>{!m||x.key!==f||(x.preventDefault(),a(!0))},e[0]=f,e[1]=a,e[2]=m,e[3]=h):h=e[3];const p=O(o.onKeyDown,h);let g;return e[4]!==u||e[5]!==d||e[6]!==o||e[7]!==i||e[8]!==p?(g=s.jsx(u,{...i,...o,onKeyDown:p,ref:d}),e[4]=u,e[5]=d,e[6]=o,e[7]=i,e[8]=p,e[9]=g):g=e[9],g});an.displayName="ThreadListItemMorePrimitive.Trigger";const cn=l.forwardRef((n,t)=>{const e=z(21),{__scopeThreadListItemMore:r,portalProps:o,sideOffset:i,...c}=n,a=i===void 0?4:i,m=me(r),d=nn(),f=Ve(),u=rn(),h=ve()==="rtl"?"ArrowRight":"ArrowLeft",p=qs,g=Qs;let x;e[0]!==h||e[1]!==(f==null?void 0:f.moreRef)||e[2]!==d||e[3]!==u?(x=R=>{var L;!u||R.key!==h||(R.preventDefault(),d(!1),(L=f==null?void 0:f.moreRef.current)==null||L.focus())},e[0]=h,e[1]=f==null?void 0:f.moreRef,e[2]=d,e[3]=u,e[4]=x):x=e[4];const S=O(c.onKeyDown,x);let I;e[5]!==(f==null?void 0:f.moreRef)||e[6]!==u?(I=()=>{var R;u&&((R=f==null?void 0:f.moreRef.current)==null||R.focus())},e[5]=f==null?void 0:f.moreRef,e[6]=u,e[7]=I):I=e[7];const j=O(c.onEscapeKeyDown,I);let C;e[8]!==g||e[9]!==t||e[10]!==c||e[11]!==m||e[12]!==a||e[13]!==S||e[14]!==j?(C=s.jsx(g,{...m,...c,onKeyDown:S,onEscapeKeyDown:j,ref:t,sideOffset:a}),e[8]=g,e[9]=t,e[10]=c,e[11]=m,e[12]=a,e[13]=S,e[14]=j,e[15]=C):C=e[15];let _;return e[16]!==o||e[17]!==m||e[18]!==p.Portal||e[19]!==C?(_=s.jsx(p.Portal,{...m,...o,children:C}),e[16]=o,e[17]=m,e[18]=p.Portal,e[19]=C,e[20]=_):_=e[20],_});cn.displayName="ThreadListItemMorePrimitive.Content";const ln=l.forwardRef((n,t)=>{const e=z(7);let r,o;e[0]!==n?({__scopeThreadListItemMore:r,...o}=n,e[0]=n,e[1]=r,e[2]=o):(r=e[1],o=e[2]);const i=me(r);let c;return e[3]!==t||e[4]!==o||e[5]!==i?(c=s.jsx(Zs,{...i,...o,ref:t}),e[3]=t,e[4]=o,e[5]=i,e[6]=c):c=e[6],c});ln.displayName="ThreadListItemMorePrimitive.Item";const dn=l.forwardRef((n,t)=>{const e=z(7);let r,o;e[0]!==n?({__scopeThreadListItemMore:r,...o}=n,e[0]=n,e[1]=r,e[2]=o):(r=e[1],o=e[2]);const i=me(r);let c;return e[3]!==t||e[4]!==o||e[5]!==i?(c=s.jsx(er,{...i,...o,ref:t}),e[3]=t,e[4]=o,e[5]=i,e[6]=c):c=e[6],c});dn.displayName="ThreadListItemMorePrimitive.Separator";var ye=Oe({Content:()=>cn,Item:()=>ln,Root:()=>on,Separator:()=>dn,Trigger:()=>an});function gr({agents:n,selected:t,query:e}){if(t==null||t.agentId==null||t.agentId.length===0||e.trim()!=="")return[...n];const r=t.agentId,o=n.find(c=>Se(c)===r),i=n.filter(c=>Se(c)!==r);return o!=null?[o,...i]:[{name:t.agentName,agentId:r},...i]}function vr(){var $;const n=ae(),t=ke(),e=Be(),r=ft(),o=e||r,[i,c]=l.useState(!1),[a,m]=l.useState(""),[d,f]=l.useState(null),u=l.useRef(null),h=l.useRef(null),p=l.useId(),g=(n==null?void 0:n.isLibraryEnabled)===!0&&t!=null,x=(($=n==null?void 0:n.historyAgentFilter)==null?void 0:$.intent)==="history"?n.historyAgentFilter:null;l.useEffect(()=>{i||m("")},[i]);const{agents:S,isInitialLoading:I,isSearching:j,loadingMore:C,hasMore:_,listRef:R,sentinelRef:L}=Gn({enabled:i&&g,query:a}),G=l.useMemo(()=>gr({agents:S,selected:x,query:a}),[S,a,x]);if(l.useLayoutEffect(()=>{if(!i||o){f(null);return}const y=()=>{var P;const T=(P=u.current)==null?void 0:P.getBoundingClientRect();T&&f({top:T.top,left:T.right+4})};return y(),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0),()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0)}},[i,o]),l.useEffect(()=>{if(!i||o)return;const y=T=>{var q,V;const P=T.target;(q=u.current)!=null&&q.contains(P)||(V=h.current)!=null&&V.contains(P)||c(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i,o]),!g)return null;const K=y=>{const T=y==null&&x==null,P=y!=null&&x!=null&&y.agentId===x.agentId&&y.agentName===x.agentName;if(T||P){c(!1);return}(n==null?void 0:n.isComposerEnabled)===!0?n.openDraft():n==null||n.openLibraryHome(),n==null||n.setHistoryAgentFilter(y),c(!1)},U=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"p-1",onMouseDown:y=>y.stopPropagation(),children:[s.jsx(Un,{query:a,setQuery:m,placeholder:"Search agents"}),j?s.jsx("p",{className:"text-text-secondary px-1 pt-1 text-[11px]",role:"status",children:"Searching…"}):null]}),s.jsxs("div",{ref:R,className:D("mt-1 overflow-y-auto",o?"min-h-0 flex-1 px-1 pb-2":"min-h-48 max-h-64"),children:[a.trim()===""?s.jsxs(et,{className:D("justify-between",x==null&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>K(null),children:["All chats",x==null?s.jsx(X,{name:"check",className:"size-3.5 shrink-0"}):null]}):null,I&&G.length===0?s.jsx("p",{className:"px-2 py-3 text-center text-xs text-text-secondary",children:"Loading…"}):G.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:[G.map(y=>{const T=Se(y),P=(x==null?void 0:x.agentId)===T;return s.jsxs(et,{className:D("justify-between gap-2 text-left",P&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>K({agentId:T,agentName:y.name,intent:"history"}),children:[s.jsx("span",{className:"min-w-0 truncate",children:y.name}),P?s.jsx(X,{name:"check",className:"size-3.5 shrink-0"}):null]},T)}),_?s.jsx("div",{ref:L,className:"flex h-6 shrink-0 items-center justify-center","aria-hidden":!0,children:C?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:u,type:"button","aria-label":x!=null?`Filter chat history by agent (${x.agentName})`:"Filter chat history by agent","aria-haspopup":o?"dialog":"menu","aria-expanded":i,"aria-controls":i?p:void 0,title:"Filter by agent",className:re({variant:"ghost",size:"icon",className:D("relative size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text",x!=null&&"text-text-primary")}),onClick:()=>c(y=>!y),children:[s.jsx(X,{name:"funnel",className:"size-3.5"}),x!=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]}),o&&i?s.jsx(ht,{open:!0,onOpenChange:c,id:p,"aria-label":"Filter agents",children:s.jsx("div",{className:"flex min-h-0 flex-1 flex-col p-2",role:"menu",children:U})}):null,!o&&i&&d!=null?pt.createPortal(s.jsx("div",{ref:h,id:p,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:U}),xt(u.current)):null]})}function wr({open:n,initialTitle:t,saving:e=!1,onOpenChange:r,onSave:o}){const[i,c]=l.useState(t),a=l.useRef(null);l.useEffect(()=>{n&&c(t)},[n,t]),l.useEffect(()=>{if(!n)return;const p=a.current;p!=null&&(p.focus(),p.select())},[n]);const m=i.trim(),f=m.length>0&&m.length<=Qe&&!e,u=()=>{f&&o(m)},h=p=>{e||r(p)};return s.jsx($n,{open:n,onOpenChange:h,title:"Rename session",contentSized:!0,"aria-label":"Rename session",footer:s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(Ze.Secondary,{type:"button",disabled:e,onClick:()=>h(!1),children:"Cancel"}),s.jsx(Ze.Primary,{type:"button",disabled:!f,onClick:u,children:"Save"})]}),children:s.jsx("div",{className:"px-5 py-4",children:s.jsx("input",{ref:a,"aria-label":"Session title",value:i,readOnly:e,maxLength:Qe,className:Hn("h-9"),onChange:p=>c(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),u())}})})})}var br="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",yr="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 Ir({canRename:n,renameDisabled:t,canDelete:e,deleteDisabled:r,onRename:o,onDelete:i}){const c=M("PermissionGuard"),a=ft(),m=Be(),[d,f]=l.useState(!1),[u,h]=l.useState(),p=m||a,g=l.useCallback(j=>{const C=j==null?void 0:j.closest(".aui-theme-root");h(C instanceof HTMLElement?C:void 0)},[]),x=re({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-inherit hover:bg-transparent hover:text-inherit"}),S=n?s.jsx(c,{allowed:!t,children:s.jsxs("button",{type:"button",className:br,disabled:t,onClick:()=>{t||(f(!1),o())},children:[s.jsx(X,{name:"pencil",className:"size-3.5"}),"Rename"]})}):null,I=e?s.jsx(c,{allowed:!r,children:s.jsxs("button",{type:"button",className:yr,disabled:r,onClick:()=>{r||(f(!1),i())},children:[s.jsx(X,{name:"trash",className:"size-3.5"}),"Delete"]})}):null;return p?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":"Session actions",title:"Session actions","aria-haspopup":"dialog","aria-expanded":d,className:x,onClick:()=>f(!0),children:s.jsx(X,{name:"ellipsis",className:"size-3.5"})}),d?s.jsx(ht,{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:[S,I]})}):null]}):s.jsxs(ye.Root,{sharedFocusGroup:!0,children:[s.jsx(ye.Trigger,{ref:g,"aria-label":"Session actions",title:"Session actions",className:x,children:s.jsx(X,{name:"ellipsis",className:"size-3.5"})}),s.jsxs(ye.Content,{portalProps:{container:u},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:[S,I]})]})}function Cr({selectionRef:n,onThreadOpen:t,canRenameSession:e,canDeleteSession:r,canManageResource:o,canDeleteResource:i}){const c=ne(),a=ae(),m=ke(),d=l.useRef(a==null?void 0:a.runtimeKey);d.current=a==null?void 0:a.runtimeKey;const f=ut(),u=_n(),h=M("ThreadListRow"),p=k(w=>w.threadListItem.id),g=k(w=>w.threadListItem.remoteId),x=k(w=>w.threadListItem.title),S=k(w=>w.threadListItem.lastMessageAt),I=k(w=>w.threadListItem.custom),j=k(w=>w.threads.mainThreadId),C=On(I),_=Ce(I),R=kn(S,mt(I)),L=e&&g!=null,G=r&&g!=null,K=L||G,U=g!=null&&!o(g),$=g!=null&&!i(g),y=(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,[T,P]=l.useState(!1),[q,V]=l.useState(!1),[te,J]=l.useState(!1),Q=x??"New Chat",E=async w=>{if(w===(x??"").trim()){P(!1);return}V(!0);try{await c.threadListItem().rename(w),f(pe.Session.RENAMED,xe(void 0,{sessionId:g,agentName:C})),P(!1)}catch(A){u==null||u.showError(A)}finally{V(!1)}},v=({sessionMutable:w,rowAgentName:A,rowIsCreateAgent:B})=>{const b=!w&&(a==null?void 0:a.mode.status)==="active"&&!a.mode.isMutable&&(A==null?a.mode.agentName==null&&a.mode.agentId==null:a.mode.agentName===A||a.mode.agentId===A),Z=zn({sessionMutable:w,shellMutable:(a==null?void 0:a.mode.status)==="active"&&a.mode.isMutable,sessionIsCreateAgent:B,shellIsCreateAgent:(a==null?void 0:a.mode)!=null&&Fe(a.mode),...(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((b||Z)&&g!=null&&(a==null?void 0:a.sessionAccessError)==null){Promise.resolve(c.threads().switchToThread(p)).catch(()=>{});return}if(g!=null){a==null||a.openHistorySession({sessionId:g,isMutable:w,isCreateAgent:B,...A!=null?{agentName:A}:{}});return}Promise.resolve(c.threads().switchToThread(p)).catch(()=>{})};return s.jsxs(xr.Root,{className:"min-w-0",children:[s.jsx(h,{title:Q,active:p===j&&!y,...C!=null&&!he(I)?{showTryAgentIcon:!0}:{},..._==null?{}:{lastTurnStatus:_},...R==null?{}:{lastMessageAt:R},onSelect:()=>{f(pe.Session.SELECTED,xe({is_mutable:he(I)},{sessionId:g,agentName:C}));const w=++n.current,A=a==null?void 0:a.runtimeKey;if(t==null||t(),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&&m!=null&&Bn(I)===void 0&&C==null){m.getSession({sessionId:g}).then(B=>({sessionMutable:B.isMutable,rowAgentName:B.agentName??void 0,rowIsCreateAgent:Fn(B)}),()=>({sessionMutable:he(I),rowAgentName:C,rowIsCreateAgent:Je(I)})).then(B=>{n.current===w&&d.current===A&&v(B)});return}v({sessionMutable:he(I),rowAgentName:C,rowIsCreateAgent:Je(I)})},actions:K?s.jsx(Ir,{canRename:L,renameDisabled:U,canDelete:G,deleteDisabled:$,onRename:()=>P(!0),onDelete:()=>J(!0)}):void 0}),te?s.jsx(ts,{title:"Delete chat",description:`“${Q}” will be permanently deleted. This cannot be undone.`,confirmLabel:"Delete",onCancel:()=>J(!1),onConfirm:()=>{J(!1),Promise.resolve(c.threadListItem().delete()).then(()=>{f(pe.Session.DELETED,xe(void 0,{sessionId:g,agentName:C}))},w=>{u==null||u.showError(w)})}}):null,s.jsx(wr,{open:T,initialTitle:x??"",saving:q,onOpenChange:P,onSave:w=>{E(w)}})]})}function Sr(n){const t=k(r=>r.threads.threadIds),e=k(r=>r.threads.threadItems);return l.useMemo(()=>{const r=Dn({threadIds:t,threadItems:e});if(n==="default")return r;const o=new Map;for(const i of e)o.set(i.id,i),i.remoteId!=null&&o.set(i.remoteId,i);return r.filter(i=>{const c=t[i];if(c===void 0)return!1;const a=o.get(c);return(a==null?void 0:a.remoteId)!=null})},[t,e,n])}function jr(n){return n==="recent-history"||n==="mobile-drawer"}function Mr({selectionRef:n,indices:t,onThreadOpen:e,canRenameSession:r,canDeleteSession:o,canManageResource:i,canDeleteResource:c}){const a=k(m=>m.threads.threadIds);return s.jsx(s.Fragment,{children:t.map(m=>{const d=a[m]??String(m);return s.jsx(Pe,{index:m,archived:!1,children:s.jsx(Cr,{selectionRef:n,onThreadOpen:e,canRenameSession:r,canDeleteSession:o,canManageResource:i,canDeleteResource:c})},d)})})}var Lr="aui_thread-list-viewport",Nr=80;function un({onThreadOpen:n,variant:t}){const e=ae(),r=M("ChatHistorySearchButton"),o=e==null?void 0:e.historyAgentFilter,i=o==null?void 0:o.intent,c=i==="history",a=(e==null?void 0:e.isLibraryEnabled)===!0&&i!=="try-agent",m=c&&o!=null?`Chats for ${o.agentName}`:"Chat History",d=s.jsx("h2",{className:"aui-chat-history-heading min-w-0 max-w-full truncate px-2.5 text-xs font-medium uppercase tracking-wider",children:m});return s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1",children:[c?s.jsx(Kn,{content:m,side:"bottom",interactive:!1,triggerClassName:"min-w-0 flex-1 overflow-hidden",children:d}):s.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:d}),s.jsxs("div",{className:"flex shrink-0 items-center",children:[s.jsx(r,{onThreadOpen:n,variant:t}),a?s.jsx(vr,{}):null]})]})}function Tr({children:n,viewportRef:t,hideScrollbar:e,showHeading:r=!0,onThreadOpen:o,variant:i}){return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r?s.jsx("div",{className:"flex shrink-0 items-center gap-1 px-1 py-1",children:s.jsx(un,{onThreadOpen:o,variant:i})}):null,s.jsx("div",{ref:t,"data-slot":Lr,className:D("relative flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",e&&"aui-scrollbar-hidden"),children:n})]})}function We({onThreadOpen:n,variant:t="default"}={}){const e=ne(),r=ke(),o=ut(),i=k(b=>b.threads.isLoading),c=k(b=>b.threads.isLoadingMore),a=k(b=>b.threads.hasMore),m=k(b=>b.threads.threadIds),d=k(b=>b.threads.threadItems),f=k(b=>b.threads.mainThreadId),u=ae(),h=M("ThreadListShell"),p=M("ThreadListNewButton"),g=M("AgentsLibraryButton"),x=M("SessionsBrowserButton"),S=M("SchedulesButton"),I=M("ThreadListRowSkeleton"),j=M("ThreadListEmptyState"),C=Sr(t),_=l.useRef(null),R=l.useRef(a),L=l.useRef(e),G=l.useRef(0),K=Tn(),U=l.useRef(K);R.current=a,L.current=e,U.current=K;const $=(u==null?void 0:u.isNewChatEnabled)!==!1,y=(u==null?void 0:u.mode.status)==="idle",T=jr(t),P=t==="mobile-drawer",q=typeof(r==null?void 0:r.renameSession)=="function",V=typeof(r==null?void 0:r.deleteSession)=="function",te=l.useMemo(()=>d.flatMap(b=>b.remoteId==null?[]:[b.remoteId]),[d]),{allows:J}=Rn({resourceType:"session",resourceIds:te}),Q=l.useMemo(()=>y||i||r==null?null:ns(d.flatMap(b=>b.id===f?[]:[Ce(b.custom)])),[y,i,f,r,d]),E=u==null?void 0:u.listSessionsAgentId;ss({intervalMs:Q,poll:l.useCallback(async()=>{if(r==null)return;const b=U.current;try{const Z=await r.listSessions({createdByMe:!0,limit:rs,startTimestamp:Pn(),...E==null||E.length===0?{}:{agentId:E}}),Y=new Map(Z.data.map(H=>{var F;return[H.id,{status:(F=H.lastTurnDetails)==null?void 0:F.state.status,updatedAt:H.updatedAt}]})),W=L.current.threads().getState(),ee=W.mainThreadId;for(const H of W.threadItems){if(H.id===ee&&(b||U.current)||H.remoteId==null||!Y.has(H.remoteId))continue;const F=Y.get(H.remoteId);if(F==null)continue;const fe=Ce(H.custom),fn=mt(H.custom)??H.lastMessageAt;F.status===fe&&!En(F.updatedAt,fn)||L.current.threads().item({id:H.id}).updateCustom(An(H.custom,F.status??null,F.updatedAt))}}catch{}},[E,r])}),l.useEffect(()=>{if(y||i||c)return;const b=_.current;if(!b)return;let Z=!1;const Y=()=>{if(Z||!R.current||b.clientHeight<=0)return;const ee=b.scrollHeight-b.scrollTop-b.clientHeight;b.scrollHeight>b.clientHeight&&ee>Nr||L.current.threads().loadMore()};b.addEventListener("scroll",Y,{passive:!0});const W=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>Y());return W?W.observe(b):window.addEventListener("resize",Y),Y(),()=>{Z=!0,b.removeEventListener("scroll",Y),W==null||W.disconnect(),W||window.removeEventListener("resize",Y)}},[a,y,i,c,m.length]);const v=()=>{if(o(pe.Session.NEW,xe({is_composer_enabled:(u==null?void 0:u.isComposerEnabled)===!0},{...(u==null?void 0:u.mode.status)==="active"?{agentId:u.mode.agentId,agentName:u.mode.agentName}:{}})),n==null||n(),u==null||u.setLibraryOpen(!1),u==null||u.setSessionsOpen(!1),u!=null&&u.isComposerEnabled){u.openDraft();return}u==null||u.setSettingsOpen(!1),u==null||u.setSchedulesOpen(!1),u==null||u.setEnvironmentsOpen(!1),Promise.resolve(e.threads().switchToNewThread()).catch(()=>{})};let w;y?w=s.jsx(j,{message:T?"No recent chats":void 0}):i?w=s.jsx(I,{}):C.length===0?w=s.jsx(j,{message:T?"No recent chats":void 0}):w=s.jsx(ir.Root,{className:"flex min-h-0 flex-col gap-0.5",children:s.jsx(Mr,{selectionRef:G,indices:C,onThreadOpen:n,canRenameSession:q,canDeleteSession:V,canManageResource:b=>J(b,"MANAGE"),canDeleteResource:b=>J(b,"DELETE")})});const A=t==="recent-history",B=A?s.jsx(un,{onThreadOpen:n,variant:t}):s.jsxs("div",{className:"flex w-full flex-col gap-1 py-2",children:[$?s.jsx(p,{onClick:v}):null,s.jsx("div",{className:"contents",onClick:()=>{P&&(n==null||n())},children:s.jsx(g,{})}),P?null:s.jsxs(s.Fragment,{children:[s.jsx(x,{}),s.jsx(S,{})]})]});return s.jsx(h,{header:B,...A?{headerClassName:"min-h-0 border-b-0 px-0 pb-2",bodyClassName:"p-0"}:{},children:s.jsxs(Tr,{viewportRef:_,hideScrollbar:T,showHeading:!A,onThreadOpen:n,variant:t,children:[w,!y&&a?s.jsx("div",{className:"h-4 shrink-0","aria-hidden":!0}):null]})})}var Rr=l.lazy(()=>vt(()=>import("./SettingsBuilder-OKV2POOV-CsW3joKv.js"),__vite__mapDeps([0,1,2]),import.meta.url)),Pr=l.lazy(()=>vt(()=>import("./SchedulesPage-I52TNBAZ-ClnGQZ5d.js"),__vite__mapDeps([3,4,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),Xe="h-5 w-5 shrink-0 object-contain",Er="w-64",Ar="aui-sidebar-rail-collapsed",Dr="w-80",_r="aui-recent-chat-history",mn="aui-sidebar-collapsed",Re="bg-primary-bg",Ie="bg-card-bg",Or=D(Jn,"h-8 w-full !justify-start px-2.5 text-sm leading-5 font-normal text-sidebar-text shadow-none",$e);function kr(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(mn)==="1"}catch{return!1}}function Br(n){try{window.localStorage.setItem(mn,n?"1":"0")}catch{}}function Fr(){const n=ae(),[t,e]=l.useState(!1),[r,o]=l.useState(null),i=l.useRef(null),c=l.useRef(null),a=l.useId();l.useLayoutEffect(()=>{if(!t){o(null);return}const f=()=>{var h;const u=(h=i.current)==null?void 0:h.getBoundingClientRect();u&&o({top:u.top,left:u.right+8})};return f(),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),()=>{window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0)}},[t]),l.useEffect(()=>{if(!t)return;const f=h=>{var g,x;const p=h.target;p instanceof Node&&((g=i.current)!=null&&g.contains(p)||(x=c.current)!=null&&x.contains(p)||e(!1))},u=h=>{var p;h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),e(!1),(p=i.current)==null||p.focus())};return document.addEventListener("mousedown",f),document.addEventListener("keydown",u,!0),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",u,!0)}},[t]);const m=s.jsx("button",{ref:i,type:"button","aria-label":"Open chat history","aria-haspopup":"dialog","aria-expanded":t,"aria-controls":t?a:void 0,className:re({variant:"ghost",className:D(bt,t&&wt)}),onClick:()=>{n==null||n.setSettingsOpen(!1),n==null||n.setLibraryOpen(!1),n==null||n.setSessionsOpen(!1),n==null||n.setSchedulesOpen(!1),e(f=>!f)},children:s.jsx(X,{name:"message-square-text"})}),d=t&&r!=null?pt.createPortal(s.jsx("div",{ref:c,id:a,role:"dialog","aria-label":"Chat History",style:{top:r.top,left:r.left},className:"aui-collapsed-chat-history-popover aui-popup-enter fixed z-[200] flex flex-col overflow-hidden border border-border bg-card-bg text-text-primary",onMouseDown:f=>f.stopPropagation(),children:s.jsx(We,{variant:"recent-history",onThreadOpen:()=>e(!1)})}),xt(i.current)):null;return s.jsxs(s.Fragment,{children:[t?m:s.jsx(je,{content:"Chat History",children:m}),d]})}function Kr({compact:n=!1}){var C;const t=ne(),e=ae(),r=M("AgentsLibraryButton"),o=M("SessionsBrowserButton"),i=M("SchedulesButton"),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,m=e==null?void 0:e.mode,f=k(_=>{const R=_.threads.mainThreadId,L=_.threads.threadItems.find(G=>G.id===R);return((L==null?void 0:L.remoteId)??_.threadListItem.remoteId)!=null})||(e==null?void 0:e.pendingSessionId)!=null,u=!a&&!f&&(m==null?void 0:m.status)==="active"&&!m.isCreateAgent&&((C=e==null?void 0:e.historyAgentFilter)==null?void 0:C.intent)!=="try-agent",h=!a&&!f&&m!=null&&Fe(m),p=()=>{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),Promise.resolve(t.threads().switchToNewThread()).catch(()=>{})},g=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()},x=n?bt:Or,S=n?wt:qn,I=s.jsxs("button",{type:"button","aria-label":"Start new chat","aria-current":u?"page":void 0,className:re({variant:"ghost",className:D(x,u&&S)}),onClick:p,children:[s.jsx(X,{name:"square-pen"}),n?null:s.jsx("span",{className:"truncate",children:"New Chat"})]}),j=s.jsxs("button",{type:"button","aria-label":"Start new agent","aria-current":h?"page":void 0,className:re({variant:"ghost",className:D(x,h&&S)}),onClick:g,children:[s.jsx(X,{name:"message-ai-3-line"}),n?null:s.jsx("span",{className:"truncate",children:"New Agent"})]});return s.jsxs("nav",{className:D("flex shrink-0 flex-col gap-1",n?"items-center":"items-stretch"),"aria-label":"Sidebar",children:[c?n?s.jsx(je,{content:"New chat",children:I}):I:null,c&&(e!=null&&e.isComposerEnabled)?n?s.jsx(je,{content:"New Agent",children:j}):j:null,s.jsx(r,{compact:n}),s.jsx(o,{compact:n}),s.jsx(i,{compact:n}),n?s.jsx(Fr,{}):null]})}function zr(){return s.jsx("aside",{id:_r,"aria-label":"Recent chats",tabIndex:-1,className:"flex min-h-0 min-w-0 flex-1 flex-col pt-4 outline-none",children:s.jsx(We,{variant:"recent-history"})})}function $r({onExpand:n}){const t=Ke(),e=ze(t),r=M("BrandLogo"),[o,i]=l.useState(!1);return s.jsx("button",{type:"button","aria-label":"Expand sidebar",className:D("flex size-5 shrink-0 items-center justify-center rounded-md text-sidebar-text",$e,"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring"),onClick:n,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onFocus:()=>i(!0),onBlur:()=>i(!1),children:o?s.jsx(X,{name:"panel-left-open",className:"size-3.5"}):s.jsx(r,{linked:!1,variant:e.collapsedVariant,className:Xe})})}function Hr({className:n,railRef:t,collapsed:e,onCollapsedChange:r,...o}){const i=Ke(),c=ze(i),a=gt(),m=M("BrandLogo"),d=M("UserAvatar");return s.jsxs("aside",{ref:t,"data-slot":"aui_app-rail","data-collapsed":e?"true":"false",className:D(e?Ar:Er,"flex min-h-0 shrink-0 flex-col overflow-x-hidden text-sidebar-text",Re,n),...o,children:[s.jsx("div",{className:D("flex shrink-0 flex-col pt-1.5",e?"px-1.5":"pl-1.5 pr-3"),children:s.jsx("div",{className:D("flex h-14 w-full shrink-0 items-center text-text-primary",e?"justify-center":"gap-2 pl-2.5"),children:e?s.jsx($r,{onExpand:()=>r(!1)}):s.jsxs(s.Fragment,{children:[s.jsx(m,{variant:c.collapsedVariant,className:Xe}),a!=null&&(c.showTitle||c.expandedVariant==="logo")?s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:a}):s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx("button",{type:"button","aria-label":"Collapse sidebar",title:"Collapse sidebar",className:re({variant:"ghost",size:"icon",className:D("size-7 shrink-0 text-sidebar-text",$e)}),onClick:()=>r(!0),children:s.jsx(X,{name:"panel-left-close",className:"size-3.5"})})]})})}),s.jsxs("div",{className:D("flex min-h-0 flex-1 flex-col pt-1",e?"px-2":"px-3"),children:[s.jsx(Kr,{compact:e}),e?null:s.jsx(zr,{})]}),e?s.jsxs("footer",{className:"flex shrink-0 flex-col items-center gap-1 px-2 pt-2 pb-2",children:[s.jsx(Me,{iconOnly:!0,showDocs:!1}),s.jsx(d,{iconOnly:!0})]}):s.jsxs("footer",{className:"flex shrink-0 items-center gap-2 px-3 pt-2 pb-2",children:[s.jsx(d,{className:"max-w-none flex-1 flex-row items-center justify-start gap-2 [&_span]:text-left [&_span]:text-xs"}),s.jsx(Me,{showDocs:!1})]})]})}function Gr({drawerRef:n,onClose:t}){const e=Ke(),r=ze(e),o=gt(),i=M("BrandLogo"),c=M("UserAvatar");return s.jsxs("aside",{ref:n,role:"dialog","aria-label":"Navigation",tabIndex:-1,className:D(Dr,"aui-mobile-nav-drawer 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:r.collapsedVariant,className:Xe}),o!=null&&(r.showTitle||r.expandedVariant==="logo")?s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:o}):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:t,children:s.jsx(X,{name:"xmark"})})]}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(We,{variant:"mobile-drawer",onThreadOpen:t})}),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(Me,{labeled:!0,onAction:t,className:"contents"}),s.jsx(c,{labeled:!0})]})]})}function Ur({className:n}){const t=ae(),e=Be(),r=M("AgentDetailsPage"),o=M("AgentsLibrary"),i=M("SessionsPage"),c=M("ShareChatButton"),a=M("ResetAgentBuilderButton"),m=M("ClearChatButton"),d=M("SaveAgentButton"),f=M("AgentUnsavedChangesStatus"),u=M("SelectAgentEmptyState"),[h,p]=l.useState(!1),[g,x]=l.useState(kr),S=l.useRef(null),I=l.useRef(null),j=l.useRef(null),C=l.useRef(!1),_=(t==null?void 0:t.mode.status)==="idle",R=(t==null?void 0:t.settingsOpen)===!0,L=(t==null?void 0:t.libraryOpen)===!0,G=L&&(t==null?void 0:t.libraryAgentId)==null,K=(t==null?void 0:t.sessionsOpen)===!0,U=(t==null?void 0:t.schedulesOpen)===!0,$=R||L||K||U,y=t!=null&&Fe(t.mode),T=e&&(K||U||y&&!R&&!L),P=y&&!$&&!e,q=Wn(),V=e&&(R||G),te=()=>p(!1),J=l.useCallback(E=>{x(E),Br(E)},[]),Q=s.jsx("button",{ref:S,type:"button","aria-label":"Navigation","aria-expanded":h,className:D(re({variant:"ghost",size:"icon"}),"md:hidden"),onClick:()=>p(!0),children:s.jsx(X,{name:"panel-left"})});return l.useEffect(()=>{if(!h)return;const E=v=>{v.key==="Escape"&&document.querySelector("dialog[open]")==null&&(v.stopImmediatePropagation(),p(!1))};return window.addEventListener("keydown",E,!0),()=>window.removeEventListener("keydown",E,!0)},[h]),l.useEffect(()=>{var v,w;const E=j.current;if(h){C.current=!0,E&&(E.inert=!0),(v=I.current)==null||v.focus();return}C.current&&(E&&(E.inert=!1),(w=S.current)==null||w.focus(),C.current=!1)},[h]),s.jsxs("div",{className:D("relative flex h-full min-h-0 w-full min-w-0",Re,n),children:[s.jsx(Hr,{className:"hidden md:flex",collapsed:g,onCollapsedChange:J}),s.jsx("div",{className:D("aui-shell-card-inset flex min-h-0 min-w-0 flex-1 flex-col",Re),children:s.jsx("div",{className:D("relative z-[1] flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden md:rounded-2xl md:border md:border-border md:shadow-[-0.25rem_0_1.25rem_color-mix(in_oklab,var(--shadow-color)_7%,transparent),0_0.0625rem_0.375rem_color-mix(in_oklab,var(--shadow-color)_3.5%,transparent)]",Ie),children:s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[P?s.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"flex min-h-0 w-full max-w-sm shrink-0 flex-col border-r border-border md:max-w-140 md:flex-1 2xl:max-w-150",children:s.jsx(Qn,{})}):null,s.jsxs("div",{className:D("flex min-h-0 min-w-0 flex-1 flex-col",Ie),children:[V?null:s.jsx(Xn,{className:D(Ie,($||_||!q||T)&&"md:hidden"),start:Q,title:!$&&!T?s.jsx(Zn,{}):null,end:!$&&!T?s.jsxs(s.Fragment,{children:[s.jsx(f,{}),s.jsx(a,{}),s.jsx(c,{}),s.jsx(m,{}),s.jsx(d,{})]}):null}),s.jsx("div",{ref:j,className:"min-h-0 min-w-0 flex-1",children:s.jsx("div",{className:"h-full min-h-0 motion-safe:animate-in motion-safe:fade-in motion-safe:duration-150 motion-reduce:animate-none",children:R?s.jsx(l.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(tt,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(Rr,{...V?{headerStart:Q}:{}})}):T?s.jsx(Yn,{}):K?s.jsx(i,{}):L&&(t==null?void 0:t.libraryAgentId)!=null?s.jsx(r,{agentId:t.libraryAgentId},t.libraryAgentId):L?s.jsx(o,{onSelectAgent:te,...V?{headerStart:Q}:{}}):U?s.jsx(l.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(tt,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(Pr,{})}):_?s.jsx(u,{}):s.jsx(es,{})},R?"settings":T?"desktop-only":K?"sessions":L&&(t==null?void 0:t.libraryAgentId)!=null?`agent:${t.libraryAgentId}`:L?"library":U?"schedules":_?"idle":"thread")})]})]})})}),h?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":"Close navigation backdrop",className:"aui-mobile-nav-backdrop absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden",onClick:te}),s.jsx(Gr,{drawerRef:I,onClose:te})]}):null]})}function no({className:n}){return s.jsx(Vn,{children:s.jsx(Ur,{className:n})})}export{no as SidebarLayout};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as V}from"./chunk-
|
|
1
|
+
import{C as V}from"./chunk-BNMKM5SY-CiR8M-oi.js";import{bV as Y,$ as J,a0 as W,r as l,x as q,j as e,a8 as X,ab as E,I as G,bY as Z,aE as y,at as _}from"./index-C5ROvRRa.js";var ee=({open:s,onOpenChange:c,onImport:d,busy:p=!1,error:S})=>{const[i,N]=l.useState(""),[m,C]=l.useState(""),[n,j]=l.useState(""),[u,x]=l.useState(""),[b,h]=l.useState(""),o=()=>{N(""),C(""),j(""),x(""),h("")},v=()=>{o(),c(!1)},f=async a=>{if(a.preventDefault(),!(!i.trim()||!m.trim()||!n.trim()||!u.trim()||!b.trim()||p))try{await d({name:i.trim(),description:m.trim(),repoURL:n.trim(),path:u.trim(),ref:b.trim()}),v()}catch{}},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:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-description",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Description"}),e.jsx("textarea",{id:"skill-description",value:m,onChange:a=>{C(a.target.value)},placeholder:"Generate release notes from merged pull requests",required:!0,rows:3,className:y("resize-y py-2.5")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-repo-url",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Repository URL"}),e.jsx("input",{id:"skill-repo-url",type:"url",value:n,onChange:a=>{j(a.target.value)},placeholder:"https://github.com/org/repo",required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-path",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Folder containing the SKILL.md"}),e.jsx("input",{id:"skill-path",value:u,onChange:a=>{x(a.target.value)},placeholder:"skills/release-notes",required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-ref",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Branch"}),e.jsx("input",{id:"skill-ref",value:b,onChange:a=>{h(a.target.value)},placeholder:"main",required:!0,className:y("h-11")})]}),e.jsxs("div",{className:"space-y-3",children:[S?e.jsx("p",{className:"text-failure-bg text-sm",children:S}):null,e.jsx(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}=Y(),c=J(),d=W(),[p,S]=l.useState(""),[i,N]=l.useState([]),[m,C]=l.useState([]),[n,j]=l.useState(!0),[u,x]=l.useState(null),[b,h]=l.useState(null),[o,v]=l.useState(!1),[f,L]=l.useState(!1),[a,O]=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(q(t,"Failed to load skills"))}finally{j(!1)}}},[s]);l.useEffect(()=>{M()},[M]);const k=p.trim().toLowerCase(),w=l.useMemo(()=>i.filter(t=>B(k,t.name,t.description)),[i,k]),R=l.useMemo(()=>{const t=new Set(i.flatMap(r=>se(r)?[r.catalogId]:[]));return m.filter(r=>!t.has(r.id)&&B(k,r.name,r.description))},[m,i,k]),z=async(t,r=x)=>{v(!0),x(null);try{await t(),await M()}catch(g){throw le(g)&&L(!0),r(q(g,"Request failed")),g}finally{v(!1)}};if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Skills catalog is not available."});const T=t=>{z(async()=>{await s.createSkill({catalogId:t.id,name:t.name,description:t.description,repoURL:t.repoURL,path:t.path,ref:t.ref}),d(_.Settings.SKILL_IMPORTED,{skill_name:t.name})}).catch(()=>{})},$=()=>{o||(F(null),I(null))},K=t=>{const r=s.deleteSkill;r&&(I(null),z(async()=>{await r({id:t.id}),d(_.Settings.SKILL_DELETED,{skill_name:t.name}),F(null)},I).catch(()=>{}))},H=async t=>{h(null),await z(async()=>{await s.createSkill(t)},h),setTimeout(()=>{c==null||c.showSuccess({title:`${t.name} imported`}),d(_.Settings.SKILL_IMPORTED,{skill_name:t.name})},0)},U=({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:"scroll-text",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(X,{query:p,setQuery:S,placeholder:"Search skills"})}),e.jsxs(E.Secondary,{type:"button",className:"shrink-0",disabled:o||f,onClick:()=>{h(null),O(!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=>U({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=>U({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:k?`No skills match “${p.trim()}”.`:"No skills yet."}):null]})]}),D?e.jsx(V,{title:"Remove skill?",description:`“${D.name}” will no longer be available to your agents.`,busy:o,error:P,onCancel:$,onConfirm:()=>{K(D)}}):null,e.jsx(te,{open:a,onOpenChange:t=>{O(t),t||h(null)},onImport:H,busy:o||f,error:b})]})},ne=ae;export{ne as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,a,j as o,T as n}from"./index-
|
|
1
|
+
import{r as t,a,j as o,T as n}from"./index-C5ROvRRa.js";import{B as u}from"./chunk-OB3PAWPO-CYqixJeQ.js";function l({routes:e,...s}){const r=t.useMemo(()=>a(e),[e]);return o.jsx(u,{basename:r.basename||void 0,children:o.jsx(n,{...s,resolvedRoutes:r})})}export{l as TrueForgeUIWithRouter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as le}from"./chunk-
|
|
1
|
+
import{C as le}from"./chunk-BNMKM5SY-CiR8M-oi.js";import{l as ie,q as ce,t as oe,bH as de,X as ue,$ as me,a0 as he,a2 as H,Y as v,r as l,x as k,j as e,ac as G,aR as xe,I as F,ab as K,at as O,bY as be,aE as ge}from"./index-C5ROvRRa.js";var fe=ge("h-11 shadow-sm"),pe=({open:x,onOpenChange:f,onSave:E,title:n,description:b,requireApiKey:t=!0,busy:p=!1,error:P})=>{const[s,o]=l.useState(""),d=()=>{o("")};l.useEffect(()=>{x&&o("")},[x]);const u=m=>{m||d(),f(m)},y=s.trim(),i=!t||!!y,w=async m=>{if(m.preventDefault(),!(!i||p))try{await E({apiKey:y}),d(),f(!1)}catch{}};return e.jsx(be,{open:x,onOpenChange:u,title:n,description:b,contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(F,{name:"search",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:w,children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"web-search-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",t?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"web-search-api-key",type:"password",required:t,value:s,onChange:m=>{o(m.target.value)},placeholder:t?"Parallel API key":"Leave blank to keep existing",autoFocus:!0,className:fe})]})}),e.jsxs("div",{className:"mt-6 space-y-3",children:[P?e.jsx("p",{className:"text-failure-bg text-sm",children:P}):null,e.jsx(K.Primary,{type:"submit",size:"large",disabled:!i||p,className:"w-full shrink-0",children:"Save"})]})]})})},ye=pe,we=[],ve=[],je=()=>{var L,Q,U,V,Y;const x=ie(),f=(L=ce())==null?void 0:L.settings,E=oe(),n=de(),b=ue(),t=me(),p=he(),s=E&&((Q=f==null?void 0:f.webSearch)==null?void 0:Q.manageProviders)!==!1?x==null?void 0:x.webSearchCatalog:void 0,o=H({queryKey:v.settings.configuration(),queryFn:()=>n==null?Promise.reject(new Error("Configuration server is not configured.")):n.getConfiguration(),enabled:n!=null},b),d=H({queryKey:v.settings.webSearchProviders(),queryFn:async()=>{if(s==null)throw new Error("Web search catalog is not configured.");const[a,r]=await Promise.all([s.listWebSearchProviders(),s.getWebSearchProviderCatalog()]);return{providers:a,catalog:r}},enabled:s!=null},b),u=((U=o.data)==null?void 0:U.webSearch.enabled)??null,y=n!=null&&o.isPending,i=((V=d.data)==null?void 0:V.providers)??we,w=((Y=d.data)==null?void 0:Y.catalog)??ve,m=d.isPending,[j,R]=l.useState(!1),[X,A]=l.useState(!1),[J,S]=l.useState(null),[Z,g]=l.useState(null),[T,z]=l.useState(!1),[c,N]=l.useState(null),[h,C]=l.useState(null),ee=o.isError?k(o.error,"Failed to load the web search setting"):d.isError?k(d.error,"Failed to load web search providers"):null,D=async a=>{if(n){R(!0),S(null);try{const r=await n.updateConfiguration({webSearch:{enabled:a}});await b.cancelQueries({queryKey:v.settings.configuration()}),b.setQueryData(v.settings.configuration(),r),t==null||t.showSuccess({title:r.webSearch.enabled?"Web search turned on":"Web search turned off"}),p(O.Settings.WEB_SEARCH_TENANT_TOGGLED,{enabled:r.webSearch.enabled})}catch(r){S(k(r,"Failed to save the web search setting"))}finally{R(!1)}}},W=i.length>0,_=l.useMemo(()=>{if(W)return[];const a=new Set(i.map(r=>r.catalogId));return w.filter(r=>!a.has(r.id))},[w,i,W]),ae=n==null||u!==null,q=s!=null&&ae&&u!==!1;if(s==null&&n==null)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Web search provider catalog is not available."});const B=async(a,r=S)=>{z(!0),S(null);try{await a(),await b.invalidateQueries({queryKey:v.settings.webSearchProviders()})}catch($){throw r(k($,"Request failed")),$}finally{z(!1)}},se=async a=>{!c||!s||(g(null),await B(async()=>{await s.createWebSearchProvider({catalogId:c.id,name:c.name,type:c.type,apiKey:a.apiKey})},g),N(null),setTimeout(()=>{t==null||t.showSuccess({title:`${c.name} configured`}),p(O.Settings.WEB_SEARCH_PROVIDER_SAVED,{provider_name:c.name,mode:"create"})},0))},te=async a=>{!h||!s||(g(null),await B(async()=>{await s.updateWebSearchProvider({id:h.id,...a.apiKey?{apiKey:a.apiKey}:{}})},g),C(null),setTimeout(()=>{t==null||t.showSuccess({title:`${h.name} updated`}),p(O.Settings.WEB_SEARCH_PROVIDER_SAVED,{provider_name:h.name,mode:"update"})},0))},M=J??ee,re=c!=null||h!=null,I=h!=null,ne=h?`Update ${h.name}`:c?`Configure ${c.name}`:"Configure web search provider";return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Web search"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Let agents search the web and fetch page content."}),M?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:M}):null,y?e.jsx(G,{className:"mt-4 h-16 w-full rounded-xl bg-gray-150 dark:bg-secondary-bg",role:"status","aria-label":"Loading web search"}):null,u!==null?e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-4 rounded-xl border border-border bg-card-bg p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h4",{className:"text-sm font-medium text-text-primary",children:"Allow web search"}),e.jsx("p",{className:"mt-0.5 text-xs text-text-secondary",children:u?"New chats may use web search. Chats already using it keep it.":"New chats cannot use web search. Chats already using it keep it."})]}),e.jsx(xe,{checked:u,disabled:j,"aria-label":"Allow web search",onCheckedChange:a=>{if(a){D(!0);return}A(!0)}})]}):null,u===!1?e.jsxs("p",{className:"mt-3 text-sm text-text-secondary",children:["Turn this back on whenever you want. Nothing is deleted while web search is off",s==null?".":", and provider setup comes back with it."]}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-auto",children:s!=null&&(y||q&&m)?e.jsx(G,{className:"h-16 w-full rounded-xl bg-gray-150 dark:bg-secondary-bg",role:"status","aria-label":"Loading web search providers"}):q?e.jsxs("div",{className:"space-y-6",children:[e.jsx("p",{className:"text-sm text-text-secondary",children:"Configure a provider so agents can search the web. Only one can be active at a time."}),i.length>0?e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Configured · ",i.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:i.map(a=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(F,{name:"search",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:a.name}),e.jsx("p",{className:"truncate text-xs text-text-secondary",children:"Parallel web search"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-success-bg",children:[e.jsx("span",{className:"size-2 rounded-full bg-success-bg","aria-hidden":!0}),"Connected"]}),e.jsx(K.Secondary,{size:"small",type:"button",disabled:T,onClick:()=>{g(null),N(null),C(a)},children:"Update"})]})]},a.id))})]}):null,W?null:e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available · ",_.length]}),_.length===0?e.jsx("p",{className:"text-sm text-text-secondary",children:w.length>0?"All catalog providers are configured.":"No web search providers in the catalog."}):e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:_.map(a=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(F,{name:"search",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:a.name}),e.jsx("p",{className:"truncate text-xs text-text-secondary",children:"Parallel web search"})]})]}),e.jsx(K.Secondary,{type:"button",disabled:T,onClick:()=>{g(null),C(null),N(a)},children:"Configure"})]},a.id))})]})]}):null}),X?e.jsx(le,{title:"Turn off web search?",description:"Existing chats, agents, and schedules that already use web search keep access. New chats and agents created after this do not. You can turn this back on later.",confirmLabel:"Turn off",busy:j,onCancel:()=>{j||A(!1)},onConfirm:()=>{j||D(!1).finally(()=>A(!1))}}):null,e.jsx(ye,{open:re,onOpenChange:a=>{a||(g(null),N(null),C(null))},onSave:I?te:se,title:ne,description:I?"Update this web search provider. Leave API key blank to keep the existing key.":"Configure this web search provider. API key is never stored in the catalog.",requireApiKey:!I,busy:T,error:Z})]})},Ce=je;export{Ce as default};
|
|
Binary file
|
|
Binary file
|