@truefoundry/trueforge 0.179.2 → 0.180.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_frontend/assets/{AgentCodeSnippets-GX5MTZLF-D1o4DvyC.js → AgentCodeSnippets-EI7L6AZD-B95q1Hjm.js} +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-EI7L6AZD-B95q1Hjm.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-EI7L6AZD-B95q1Hjm.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-2UEF3GEL-DBH9LK9O.js +1 -0
- package/dist/_frontend/assets/AgentMetricChart-2UEF3GEL-DBH9LK9O.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-2UEF3GEL-DBH9LK9O.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-HEFKPIVO-Dq6tr7kQ.js +1 -0
- package/dist/_frontend/assets/AgentOverview-HEFKPIVO-Dq6tr7kQ.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-HEFKPIVO-Dq6tr7kQ.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimeline-ZBW3AIU2-BjA4oeYw.js → AgentSessionEventTimeline-5AMYAJEU-B57r1KB8.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimeline-5AMYAJEU-B57r1KB8.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-5AMYAJEU-B57r1KB8.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimelineChart-VQNS2G4D-o3La8fse.js → AgentSessionEventTimelineChart-MCIIMESZ-tHXn5h6a.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-MCIIMESZ-tHXn5h6a.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-MCIIMESZ-tHXn5h6a.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-IBTWEXR3-BkHj0ugQ.js +1 -0
- package/dist/_frontend/assets/AgentSessions-IBTWEXR3-BkHj0ugQ.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-IBTWEXR3-BkHj0ugQ.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-WIXOLTUY-DCK3VbLC.js +1 -0
- package/dist/_frontend/assets/ConnectorSettings-WIXOLTUY-DCK3VbLC.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-WIXOLTUY-DCK3VbLC.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-YSSOMIEK-S7QeeWVV.js → DockLayout-W7IJXA3A-46pvLKrm.js} +1 -1
- package/dist/_frontend/assets/DrawerLayout-6NM2OK7V-DNiz2kq8.js +2 -0
- package/dist/_frontend/assets/DrawerLayout-6NM2OK7V-DNiz2kq8.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-6NM2OK7V-DNiz2kq8.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-CP45I45Z-Qvooua0r.js +3 -0
- package/dist/_frontend/assets/EnvironmentsPage-CP45I45Z-Qvooua0r.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-CP45I45Z-Qvooua0r.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-RORWGM3U-C46mJ_bm.js +1 -0
- package/dist/_frontend/assets/ModelSettings-RORWGM3U-C46mJ_bm.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-RORWGM3U-C46mJ_bm.js.gz +0 -0
- package/dist/_frontend/assets/{SandboxSettings-Y3NPODM5-CD9DUFxP.js → SandboxSettings-HHLZG6WS-DGO4et3u.js} +1 -1
- package/dist/_frontend/assets/SandboxSettings-HHLZG6WS-DGO4et3u.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-HHLZG6WS-DGO4et3u.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-T7EAUTOK-N-OW1kvz.js +1 -0
- package/dist/_frontend/assets/SchedulesPage-T7EAUTOK-N-OW1kvz.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-T7EAUTOK-N-OW1kvz.js.gz +0 -0
- package/dist/_frontend/assets/{SettingsBuilder-CVPLV5HY-D0lac3y-.js → SettingsBuilder-L2OFMRXP-Dh8lEf0J.js} +2 -2
- package/dist/_frontend/assets/SettingsBuilder-L2OFMRXP-Dh8lEf0J.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-L2OFMRXP-Dh8lEf0J.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-RP3jr7cD.js +1 -0
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-RP3jr7cD.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-ZNUJRPCZ-RP3jr7cD.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-5ZOKBF2G-bNBjXx3r.js +2 -0
- package/dist/_frontend/assets/SidebarLayout-5ZOKBF2G-bNBjXx3r.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-5ZOKBF2G-bNBjXx3r.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-TGEVQYVZ-7tUcODoO.js +1 -0
- package/dist/_frontend/assets/SkillSettings-TGEVQYVZ-7tUcODoO.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-TGEVQYVZ-7tUcODoO.js.gz +0 -0
- package/dist/_frontend/assets/{TrueForgeUIWithRouter-SZT3KVCD-BMJaD7KT.js → TrueForgeUIWithRouter-CXREADWK-Qoq2vKOi.js} +1 -1
- package/dist/_frontend/assets/{WebSearchSettings-SUBJH2C5-DL7KJKp-.js → WebSearchSettings-SXQIWYIB-BL4uxR02.js} +1 -1
- package/dist/_frontend/assets/WebSearchSettings-SXQIWYIB-BL4uxR02.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-SXQIWYIB-BL4uxR02.js.gz +0 -0
- package/dist/_frontend/assets/{WidgetLayout-Q3F3UWN3-BQaDzdhk.js → WidgetLayout-7WFNZ2IB-DOiTcCPs.js} +1 -1
- package/dist/_frontend/assets/WidgetLayout-7WFNZ2IB-DOiTcCPs.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-7WFNZ2IB-DOiTcCPs.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-ICZTJLTU-CSBYGLaq.js → chunk-4BKRLRXL--PTlsbLc.js} +1 -1
- package/dist/_frontend/assets/chunk-4BKRLRXL--PTlsbLc.js.br +0 -0
- package/dist/_frontend/assets/chunk-4BKRLRXL--PTlsbLc.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-GSAVSNGR-BJhfT2HB.js → chunk-HEZQT2S7-Cy_0RIlD.js} +1 -1
- package/dist/_frontend/assets/{chunk-OB3PAWPO-WTBtRmxH.js → chunk-OB3PAWPO-D_HivAkv.js} +1 -1
- package/dist/_frontend/assets/chunk-OB3PAWPO-D_HivAkv.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-D_HivAkv.js.gz +0 -0
- package/dist/_frontend/assets/chunk-PMXDHCX7-CdA5wX19.js +1 -0
- package/dist/_frontend/assets/chunk-PMXDHCX7-CdA5wX19.js.br +0 -0
- package/dist/_frontend/assets/chunk-PMXDHCX7-CdA5wX19.js.gz +0 -0
- package/dist/_frontend/assets/chunk-ROEY5URA-D9QfyGUQ.js +2 -0
- package/dist/_frontend/assets/chunk-ROEY5URA-D9QfyGUQ.js.br +0 -0
- package/dist/_frontend/assets/chunk-ROEY5URA-D9QfyGUQ.js.gz +0 -0
- package/dist/_frontend/assets/{cssMode-BnrOGoXe.js → cssMode-DYweAuD0.js} +1 -1
- package/dist/_frontend/assets/cssMode-DYweAuD0.js.br +0 -0
- package/dist/_frontend/assets/cssMode-DYweAuD0.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-Cu2qkLE9.js → freemarker2-BgnrKMUJ.js} +1 -1
- package/dist/_frontend/assets/freemarker2-BgnrKMUJ.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-BgnrKMUJ.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-qoIGMfY0.js → handlebars-BuxRYVDg.js} +1 -1
- package/dist/_frontend/assets/handlebars-BuxRYVDg.js.br +0 -0
- package/dist/_frontend/assets/handlebars-BuxRYVDg.js.gz +0 -0
- package/dist/_frontend/assets/{html-jIKazNfg.js → html-B26vpw9A.js} +1 -1
- package/dist/_frontend/assets/html-B26vpw9A.js.br +0 -0
- package/dist/_frontend/assets/html-B26vpw9A.js.gz +0 -0
- package/dist/_frontend/assets/{htmlMode-M1ZSzZKt.js → htmlMode-DmYbS8Mn.js} +1 -1
- package/dist/_frontend/assets/htmlMode-DmYbS8Mn.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-DmYbS8Mn.js.gz +0 -0
- package/dist/_frontend/assets/{index-BJsGMvc-.js → index-BkqFR0mB.js} +243 -243
- package/dist/_frontend/assets/index-BkqFR0mB.js.br +0 -0
- package/dist/_frontend/assets/index-BkqFR0mB.js.gz +0 -0
- package/dist/_frontend/assets/{index-YbpMGQU0.js → index-DO2Lw8LG.js} +3 -3
- package/dist/_frontend/assets/index-DO2Lw8LG.js.br +0 -0
- package/dist/_frontend/assets/index-DO2Lw8LG.js.gz +0 -0
- package/dist/_frontend/assets/{index-4r7-LeFK.js → index-ouLu_TJW.js} +1 -1
- package/dist/_frontend/assets/index-ouLu_TJW.js.br +0 -0
- package/dist/_frontend/assets/index-ouLu_TJW.js.gz +0 -0
- package/dist/_frontend/assets/{javascript-X_qdyURb.js → javascript-DM8v37Dy.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-CT04G6VA.js → jsonMode-DMae7QLZ.js} +1 -1
- package/dist/_frontend/assets/jsonMode-DMae7QLZ.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-DMae7QLZ.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-B2a653EE.js → liquid-lgQW01T7.js} +1 -1
- package/dist/_frontend/assets/liquid-lgQW01T7.js.br +0 -0
- package/dist/_frontend/assets/liquid-lgQW01T7.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-mffTaZGc.js → lspLanguageFeatures-dlo6U4a7.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-dlo6U4a7.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-dlo6U4a7.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-DN_e2xx5.js → mdx-B56hEfFP.js} +1 -1
- package/dist/_frontend/assets/mdx-B56hEfFP.js.br +0 -0
- package/dist/_frontend/assets/mdx-B56hEfFP.js.gz +0 -0
- package/dist/_frontend/assets/{python-CMZDwpP1.js → python-D3uJaW0Z.js} +1 -1
- package/dist/_frontend/assets/python-D3uJaW0Z.js.br +0 -0
- package/dist/_frontend/assets/python-D3uJaW0Z.js.gz +0 -0
- package/dist/_frontend/assets/{razor-CJvSmNFI.js → razor-CA2L2x1h.js} +1 -1
- package/dist/_frontend/assets/razor-CA2L2x1h.js.br +0 -0
- package/dist/_frontend/assets/razor-CA2L2x1h.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-ZJxciJ2G.js → tsMode-DqNAhXjm.js} +1 -1
- package/dist/_frontend/assets/tsMode-DqNAhXjm.js.br +0 -0
- package/dist/_frontend/assets/tsMode-DqNAhXjm.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-DS4oUy9B.js → typescript-gk4F4p_p.js} +1 -1
- package/dist/_frontend/assets/typescript-gk4F4p_p.js.br +0 -0
- package/dist/_frontend/assets/typescript-gk4F4p_p.js.gz +0 -0
- package/dist/_frontend/assets/{workers-DPKHJxKo.js → workers-Dt5cwyc9.js} +1 -1
- package/dist/_frontend/assets/workers-Dt5cwyc9.js.br +0 -0
- package/dist/_frontend/assets/workers-Dt5cwyc9.js.gz +0 -0
- package/dist/_frontend/assets/{xml-BJmCYv7o.js → xml-CzsdIMnF.js} +1 -1
- package/dist/_frontend/assets/xml-CzsdIMnF.js.br +0 -0
- package/dist/_frontend/assets/xml-CzsdIMnF.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-DzYUCVsV.js → yaml-BnfYb4jg.js} +1 -1
- package/dist/_frontend/assets/yaml-BnfYb4jg.js.br +0 -0
- package/dist/_frontend/assets/yaml-BnfYb4jg.js.gz +0 -0
- package/dist/_frontend/index.html +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/controller-main.js +27 -5
- package/dist/controller-main.js.map +1 -1
- package/dist/main.js +419 -257
- package/dist/main.js.map +1 -1
- package/dist/postgres/migrations/20261009_000001_model_message_model_backfill.js +94 -0
- package/dist/postgres/migrations/20261009_000001_model_message_model_backfill.js.map +1 -0
- package/dist/sqlite/migrations/20261009_000001_model_message_model_backfill.js +91 -0
- package/dist/sqlite/migrations/20261009_000001_model_message_model_backfill.js.map +1 -0
- package/package.json +3 -3
- package/dist/_frontend/assets/AgentCodeSnippets-GX5MTZLF-D1o4DvyC.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-GX5MTZLF-D1o4DvyC.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-MMZYPKVN-8E4ELOjM.js +0 -1
- package/dist/_frontend/assets/AgentMetricChart-MMZYPKVN-8E4ELOjM.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-MMZYPKVN-8E4ELOjM.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-OBBGSUOK-D0-uAThW.js +0 -1
- package/dist/_frontend/assets/AgentOverview-OBBGSUOK-D0-uAThW.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-OBBGSUOK-D0-uAThW.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-ZBW3AIU2-BjA4oeYw.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-ZBW3AIU2-BjA4oeYw.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-VQNS2G4D-o3La8fse.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-VQNS2G4D-o3La8fse.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-OB32CD3H-BvEB36Q4.js +0 -1
- package/dist/_frontend/assets/AgentSessions-OB32CD3H-BvEB36Q4.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-OB32CD3H-BvEB36Q4.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-XXE32AUQ-Bi01homi.js +0 -1
- package/dist/_frontend/assets/ConnectorSettings-XXE32AUQ-Bi01homi.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-XXE32AUQ-Bi01homi.js.gz +0 -0
- package/dist/_frontend/assets/DrawerLayout-T6U5AGG7-BQoBVjqu.js +0 -2
- package/dist/_frontend/assets/DrawerLayout-T6U5AGG7-BQoBVjqu.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-T6U5AGG7-BQoBVjqu.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-OXKHJMOO-C-t7Dp_i.js +0 -3
- package/dist/_frontend/assets/EnvironmentsPage-OXKHJMOO-C-t7Dp_i.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-OXKHJMOO-C-t7Dp_i.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-J5QDA4OJ-1_KW1bju.js +0 -1
- package/dist/_frontend/assets/ModelSettings-J5QDA4OJ-1_KW1bju.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-J5QDA4OJ-1_KW1bju.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-Y3NPODM5-CD9DUFxP.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-Y3NPODM5-CD9DUFxP.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-HLHAOIS6-BcDOMjiM.js +0 -1
- package/dist/_frontend/assets/SchedulesPage-HLHAOIS6-BcDOMjiM.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-HLHAOIS6-BcDOMjiM.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-CVPLV5HY-D0lac3y-.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-CVPLV5HY-D0lac3y-.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-XIPKA3OH-ByKCgD91.js +0 -1
- package/dist/_frontend/assets/ShellRouteSync-XIPKA3OH-ByKCgD91.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-XIPKA3OH-ByKCgD91.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-LHIKWYLB-DgTk6yLL.js +0 -2
- package/dist/_frontend/assets/SidebarLayout-LHIKWYLB-DgTk6yLL.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-LHIKWYLB-DgTk6yLL.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-6I63TUL7-D4s5Ticy.js +0 -1
- package/dist/_frontend/assets/SkillSettings-6I63TUL7-D4s5Ticy.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-6I63TUL7-D4s5Ticy.js.gz +0 -0
- package/dist/_frontend/assets/WebSearchSettings-SUBJH2C5-DL7KJKp-.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-SUBJH2C5-DL7KJKp-.js.gz +0 -0
- package/dist/_frontend/assets/WidgetLayout-Q3F3UWN3-BQaDzdhk.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-Q3F3UWN3-BQaDzdhk.js.gz +0 -0
- package/dist/_frontend/assets/chunk-BZ2EOR5X-BgN-bqzz.js +0 -1
- package/dist/_frontend/assets/chunk-ICZTJLTU-CSBYGLaq.js.br +0 -0
- package/dist/_frontend/assets/chunk-ICZTJLTU-CSBYGLaq.js.gz +0 -0
- package/dist/_frontend/assets/chunk-NYCSPKHJ-BXKEzm55.js +0 -1
- package/dist/_frontend/assets/chunk-NYCSPKHJ-BXKEzm55.js.br +0 -0
- package/dist/_frontend/assets/chunk-NYCSPKHJ-BXKEzm55.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-WTBtRmxH.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-WTBtRmxH.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OD7JCND5-BlwWGx2k.js +0 -2
- package/dist/_frontend/assets/chunk-OD7JCND5-BlwWGx2k.js.br +0 -0
- package/dist/_frontend/assets/chunk-OD7JCND5-BlwWGx2k.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-BnrOGoXe.js.br +0 -0
- package/dist/_frontend/assets/cssMode-BnrOGoXe.js.gz +0 -0
- package/dist/_frontend/assets/freemarker2-Cu2qkLE9.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-Cu2qkLE9.js.gz +0 -0
- package/dist/_frontend/assets/handlebars-qoIGMfY0.js.br +0 -0
- package/dist/_frontend/assets/handlebars-qoIGMfY0.js.gz +0 -0
- package/dist/_frontend/assets/html-jIKazNfg.js.br +0 -0
- package/dist/_frontend/assets/html-jIKazNfg.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-M1ZSzZKt.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-M1ZSzZKt.js.gz +0 -0
- package/dist/_frontend/assets/index-4r7-LeFK.js.br +0 -0
- package/dist/_frontend/assets/index-4r7-LeFK.js.gz +0 -0
- package/dist/_frontend/assets/index-BJsGMvc-.js.br +0 -0
- package/dist/_frontend/assets/index-BJsGMvc-.js.gz +0 -0
- package/dist/_frontend/assets/index-YbpMGQU0.js.br +0 -0
- package/dist/_frontend/assets/index-YbpMGQU0.js.gz +0 -0
- package/dist/_frontend/assets/jsonMode-CT04G6VA.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-CT04G6VA.js.gz +0 -0
- package/dist/_frontend/assets/liquid-B2a653EE.js.br +0 -0
- package/dist/_frontend/assets/liquid-B2a653EE.js.gz +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-mffTaZGc.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-mffTaZGc.js.gz +0 -0
- package/dist/_frontend/assets/mdx-DN_e2xx5.js.br +0 -0
- package/dist/_frontend/assets/mdx-DN_e2xx5.js.gz +0 -0
- package/dist/_frontend/assets/python-CMZDwpP1.js.br +0 -0
- package/dist/_frontend/assets/python-CMZDwpP1.js.gz +0 -0
- package/dist/_frontend/assets/razor-CJvSmNFI.js.br +0 -0
- package/dist/_frontend/assets/razor-CJvSmNFI.js.gz +0 -0
- package/dist/_frontend/assets/tsMode-ZJxciJ2G.js.br +0 -0
- package/dist/_frontend/assets/tsMode-ZJxciJ2G.js.gz +0 -0
- package/dist/_frontend/assets/typescript-DS4oUy9B.js.br +0 -0
- package/dist/_frontend/assets/typescript-DS4oUy9B.js.gz +0 -0
- package/dist/_frontend/assets/workers-DPKHJxKo.js.br +0 -0
- package/dist/_frontend/assets/workers-DPKHJxKo.js.gz +0 -0
- package/dist/_frontend/assets/xml-BJmCYv7o.js.br +0 -0
- package/dist/_frontend/assets/xml-BJmCYv7o.js.gz +0 -0
- package/dist/_frontend/assets/yaml-DzYUCVsV.js.br +0 -0
- package/dist/_frontend/assets/yaml-DzYUCVsV.js.gz +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as we}from"./chunk-GSAVSNGR-BJhfT2HB.js";import{b5 as Ee,t as Ce,U as ke,r as l,W as G,j as e,$ as Se,a2 as B,I as U,b6 as fe,b7 as ye,b8 as Me,b9 as Le,g as P,ba as Pe,al as de,as as Ue}from"./index-BJsGMvc-.js";var ve=Ue("h-11 shadow-sm"),Te=({open:a,onOpenChange:i,onSave:f,title:j,description:N,initialBaseUrl:g="",baseUrlPlaceholder:h="https://api.openai.com/v1",requireApiKey:o=!0,submitLabel:K="Save",busy:M=!1,error:$})=>{const[A,C]=l.useState(""),[q,x]=l.useState(""),[p,I]=l.useState(!1),T=()=>{C(""),x(""),I(!1)};l.useEffect(()=>{a&&(C(""),x(g),I(!1))},[a,g]);const H=d=>{d||T(),i(d)},R=A.trim(),_=!o||!!R,J=async d=>{if(d.preventDefault(),!(!_||M))try{await f({apiKey:R,baseUrl:q.trim()}),T(),i(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:H,title:j,description:N,contentSized:!0,children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:J,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"model-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",o?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"model-provider-api-key",type:"password",required:o,value:A,onChange:d=>{C(d.target.value)},placeholder:o?"Enter API key":"Enter a new key",autoFocus:!0,className:ve}),o?null:e.jsx("p",{className:"mt-1.5 text-xs text-text-secondary",children:"Leave blank to keep the current key; enter a new one to replace it."})]}),e.jsxs(Me,{expanded:p,onChange:(d,ae)=>I(ae),className:"rounded-md border border-border",children:[e.jsx(Le,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced · custom endpoint",e.jsx(U,{name:"chevron-down",className:P("size-4 shrink-0 text-text-secondary transition-transform duration-200",p?"rotate-0":"-rotate-90")})]})}),e.jsxs(Pe,{className:"space-y-1.5 border-t border-border px-3 pb-3 pt-4",children:[e.jsx("label",{htmlFor:"model-provider-base-url",className:"block text-sm font-medium text-text-primary",children:"Base URL"}),e.jsx("input",{id:"model-provider-base-url",type:"url",value:q,onChange:d=>{x(d.target.value)},placeholder:h,className:ve}),e.jsx("p",{className:"text-xs text-text-secondary",children:"Leave blank unless you use a regional or proxy endpoint."})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[$?e.jsx("p",{className:"text-failure-bg text-sm",children:$}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!_||M,className:"w-full shrink-0",children:K})]})]})})},Re=Te,Oe="128000",De="4096",je=()=>({id:"",name:"",advancedExpanded:!0,contextLength:"",maxOutputTokens:""}),ge=a=>(a==null?void 0:a.models.map(i=>{var f,j,N,g,h;return{id:i.id,name:i.name,advancedExpanded:!0,reasoningEfforts:(f=i.properties)==null?void 0:f.reasoningEfforts,contextLength:((N=(j=i.properties)==null?void 0:j.contextLength)==null?void 0:N.toString())??"",maxOutputTokens:((h=(g=i.properties)==null?void 0:g.maxOutputTokens)==null?void 0:h.toString())??"",nameDirty:!0}}))??[je()],Z="h-11 w-full rounded-md border border-border/70 bg-secondary-bg px-3 text-sm text-text-primary outline-none transition-colors placeholder:text-text-secondary/70 focus-visible:border-focus-ring focus-visible:ring-2 focus-visible:ring-focus-ring/50",se="border-failure-bg focus-visible:border-failure-bg focus-visible:ring-failure-bg";function pe(a){const i=a.trim();if(i==="")return null;const f=Number(i);return Number.isInteger(f)&&f>0?f:null}function $e(a){return a.replace(/([a-zA-Z])(\d)/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/g,"")}var ie=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),re=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-failure-bg",children:a}),ce=({children:a})=>e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:a}),Ae=({open:a,onOpenChange:i,onSubmit:f,reasoningEffortOptions:j,busy:N=!1,error:g,isEditMode:h=!1,initialValues:o})=>{const[K,M]=l.useState((o==null?void 0:o.name)??""),[$,A]=l.useState((o==null?void 0:o.baseUrl)??""),[C,q]=l.useState(""),[x,p]=l.useState(()=>ge(o)),[I,T]=l.useState(!1),[H,R]=l.useState(!1),_=()=>{M((o==null?void 0:o.name)??""),A((o==null?void 0:o.baseUrl)??""),q(""),p(ge(o)),T(!1),R(!1)},J=s=>{s||_(),i(s)},d=(s,r)=>{p(y=>y.map((m,b)=>b===s?{...m,...r}:m))},ae=()=>{T(!0),R(!0),p(s=>s.map(r=>({...r,idTouched:!0,contextTouched:!0,maxTouched:!0})))},Y=K.trim(),v=Y?null:"Name is required.",z=$.trim();let k=null;if(!z)k="Base URL is required.";else try{new URL(z)}catch{k="Enter a valid URL."}const Q=s=>s.id.trim()?null:"Model ID is required.",me=s=>s.name.trim()?null:"Model name is required.",O=s=>pe(s.contextLength)==null?"Set the model's context window.":null,ne=s=>pe(s.maxOutputTokens)==null?"Set the max output tokens.":null,w=!v&&!k&&x.every(s=>!Q(s)&&!me(s)),W=I&&v,V=H&&k,oe=async()=>{if(ae(),!w||N)return;const s=x.findIndex(r=>O(r)||ne(r));if(s!==-1){d(s,{advancedExpanded:!0});const r=x[s],y=r&&O(r)?"context-length":"max-output-tokens";setTimeout(()=>{var b;const m=document.getElementById(`custom-provider-model-${s}-${y}`);(b=m==null?void 0:m.scrollIntoView)==null||b.call(m,{block:"center",behavior:"smooth"}),m==null||m.focus()},0);return}try{await f({name:Y,baseUrl:z,apiKey:C.trim(),models:x.map(r=>{var F;const y={};(F=r.reasoningEfforts)!=null&&F.length&&(y.reasoningEfforts=r.reasoningEfforts);const m=pe(r.contextLength);m!=null&&(y.contextLength=m);const b=pe(r.maxOutputTokens);return b!=null&&(y.maxOutputTokens=b),{id:r.id.trim(),name:r.name.trim(),...Object.keys(y).length>0?{properties:y}:{}}})}),J(!1)}catch{}};return e.jsx(ye,{open:a,onOpenChange:J,title:h?`Edit ${(o==null?void 0:o.name)??K}`:"Add custom provider",description:h?"Update the endpoint, credentials, and models for this provider.":"Connect any OpenAI-compatible endpoint, whether it's a local model, a proxy, or your own hosted service.",contentSized:!0,children:e.jsxs("form",{className:"flex min-h-0 flex-auto flex-col",onSubmit:s=>{s.preventDefault(),oe()},children:[e.jsxs("div",{className:"min-h-0 flex-auto space-y-4 overflow-y-auto px-5 pt-4 pb-8",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Name",e.jsx(ie,{})]}),e.jsx("input",{id:"custom-provider-name",type:"text",value:K,onChange:s=>M(s.target.value),onBlur:()=>T(!0),placeholder:"local-llama",autoFocus:!h,readOnly:h,"aria-readonly":h,"aria-invalid":W?!0:void 0,className:P(Z,h&&"cursor-not-allowed bg-secondary-bg/60 text-text-secondary",W&&se)}),h?e.jsx(ce,{children:"Provider names cannot be changed after creation."}):null,W?e.jsx(re,{children:v}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-base-url",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Base URL",e.jsx(ie,{})]}),e.jsx("input",{id:"custom-provider-base-url",type:"text",value:$,onChange:s=>A(s.target.value),onBlur:()=>R(!0),placeholder:"http://localhost:11434/v1",autoFocus:h,"aria-invalid":V?!0:void 0,className:P(Z,V&&se)}),V?e.jsx(re,{children:k}):z?null:e.jsx(ce,{children:"OpenAI-compatible endpoint, usually ending in /v1."})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"custom-provider-api-key",type:"password",value:C,onChange:s=>q(s.target.value),placeholder:"sk-…",className:Z}),e.jsx(ce,{children:h?"Leave blank to keep the saved key, or enter a new key to replace it.":"Leave blank if your endpoint needs no key (e.g. a local model)."})]}),e.jsxs("fieldset",{className:"m-0 min-w-0 border-0 p-0",children:[e.jsxs("legend",{className:"float-left mb-2 w-full p-0 text-sm font-medium text-text-primary",children:["Models",e.jsx(ie,{})]}),e.jsx("div",{className:"clear-both",children:x.map((s,r)=>{const y=Q(s),m=s.idTouched&&y,b=me(s),F=!!b&&s.nameDirty,ue=O(s),xe=ne(s),ee=s.contextTouched&&ue,le=s.maxTouched&&xe;return e.jsxs("div",{className:P("pb-6",r>0?"border-t border-border pt-6":"pt-1"),style:r>0?{borderTopWidth:"0.5px"}:void 0,children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_2rem] items-end gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-id`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model ID"}),e.jsx("input",{id:`custom-provider-model-${r}-id`,type:"text",value:s.id,onChange:u=>{const D=u.target.value;d(r,{id:D,...s.nameDirty?{}:{name:$e(D)}})},onBlur:()=>d(r,{idTouched:!0}),placeholder:"llama3.1:70b","aria-invalid":m?!0:void 0,className:P(Z,"font-mono",m&&se)})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-name`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model name"}),e.jsx("input",{id:`custom-provider-model-${r}-name`,type:"text",value:s.name,onChange:u=>d(r,{name:u.target.value,nameDirty:!0}),placeholder:"llama-3-1-70b","aria-invalid":F?!0:void 0,className:P(Z,F&&se)})]}),e.jsx("button",{type:"button","aria-label":`Remove model ${r+1}`,disabled:x.length===1||N,className:"mb-0.5 flex size-9 items-center justify-center rounded-md text-text-secondary transition-colors hover:text-text-primary disabled:opacity-40",onClick:()=>p(u=>u.filter((D,te)=>te!==r)),children:e.jsx(U,{name:"trash",className:"size-4"})})]}),m?e.jsx(re,{children:y}):null,F?e.jsx(re,{children:b}):null,e.jsxs("div",{className:"mt-2",children:[e.jsxs("button",{type:"button","aria-expanded":s.advancedExpanded,"aria-controls":`custom-provider-model-${r}-advanced`,className:"flex cursor-pointer items-center gap-1.5 text-sm font-medium text-text-primary",onClick:()=>d(r,{advancedExpanded:!s.advancedExpanded}),children:[e.jsx(U,{name:"chevron-down",className:P("size-4 text-text-secondary transition-transform",s.advancedExpanded?"":"-rotate-90")}),"Advanced"]}),s.advancedExpanded?e.jsxs("div",{id:`custom-provider-model-${r}-advanced`,className:"mt-3 space-y-4 pl-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-context-length`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Context length",e.jsx(ie,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-context-length`,type:"number",min:1,inputMode:"numeric",value:s.contextLength,onChange:u=>d(r,{contextLength:u.target.value}),onBlur:()=>d(r,{contextTouched:!0}),placeholder:Oe,"aria-invalid":ee?!0:void 0,className:P(Z,ee&&se)}),ee?e.jsx(re,{children:ue}):s.contextLength.trim()===""?e.jsx(ce,{children:"Model's total token window."}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-max-output-tokens`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Max output tokens",e.jsx(ie,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-max-output-tokens`,type:"number",min:1,inputMode:"numeric",value:s.maxOutputTokens,onChange:u=>d(r,{maxOutputTokens:u.target.value}),onBlur:()=>d(r,{maxTouched:!0}),placeholder:De,"aria-invalid":le?!0:void 0,className:P(Z,le&&se)}),le?e.jsx(re,{children:xe}):s.maxOutputTokens.trim()===""?e.jsx(ce,{children:"Longest reply the model allows — use its real limit."}):null]}),j&&j.length>0?e.jsxs("div",{children:[e.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 select-none",children:[e.jsx("input",{type:"checkbox",className:"size-4 shrink-0 cursor-pointer accent-primary-button-bg disabled:cursor-not-allowed disabled:opacity-50",checked:s.reasoningEfforts!==void 0,"aria-label":`Enable reasoning effort for model ${r+1}`,disabled:N,onChange:u=>d(r,{reasoningEfforts:u.target.checked?[]:void 0})}),e.jsx("span",{className:"text-text-secondary text-xs font-medium",children:"Reasoning effort"})]}),s.reasoningEfforts!==void 0?e.jsx("div",{role:"group","aria-label":`Supported reasoning efforts for model ${r+1}`,className:"mt-2 flex flex-wrap gap-2",children:j.map(u=>{var te;const D=((te=s.reasoningEfforts)==null?void 0:te.includes(u))??!1;return e.jsx("button",{type:"button","aria-pressed":D,disabled:N,className:P("rounded-full border px-3 py-1 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/40 disabled:opacity-50",D?"border-primary-button-bg bg-primary-button-bg text-primary-button-text":"border-border text-text-secondary hover:bg-ghost-button-hover"),onClick:()=>{var S;return d(r,{reasoningEfforts:D?(S=s.reasoningEfforts)==null?void 0:S.filter(X=>X!==u):[...s.reasoningEfforts??[],u]})},children:u},u)})}):null]}):null]}):null]})]},r)})}),e.jsxs(B.Secondary,{size:"small",type:"button",className:"mt-4 w-fit",onClick:()=>p(s=>[...s,je()]),children:[e.jsx(U,{name:"plus",className:"size-3.5"}),"Add model"]})]})]}),e.jsxs("div",{className:"shrink-0 space-y-3 border-t border-border px-5 py-4",children:[g?e.jsx("p",{className:"text-failure-bg text-sm",children:g}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!w||N,className:"w-full",children:h?"Save changes":"Add provider"})]})]})})},Ie=Ae;function he(a){return a.kind==="model"&&a.provider.models.length===1}function _e(a){return a.kind==="provider"?`“${a.provider.name}” and all of its models will no longer be available to your agents.`:he(a)?`“${a.model.name}” is the only model left in ${a.provider.name}, so the whole provider will be removed.`:`“${a.model.name}” will no longer be available to your agents. The rest of ${a.provider.name} stays configured.`}function ze(a){return"baseUrl"in a&&typeof a.baseUrl=="string"?a.baseUrl:""}var Fe=()=>{const{modelCatalog:a}=Ee(),i=Ce(),f=ke(),[j,N]=l.useState(""),[g,h]=l.useState([]),[o,K]=l.useState([]),[M,$]=l.useState(!0),[A,C]=l.useState(null),[q,x]=l.useState(null),[p,I]=l.useState(!1),[T,H]=l.useState(null),[R,_]=l.useState(null),[J,d]=l.useState(null),[ae,Y]=l.useState(!1),[v,z]=l.useState(null),[k,Q]=l.useState(null),[me,O]=l.useState(null),ne=l.useMemo(()=>(o??[]).reduce((t,n)=>(t[n.name]=n.logo??"",t),{}),[o]),w=j.trim().toLowerCase(),W=l.useCallback(async()=>{$(!0),C(null);try{const[t,n]=await Promise.all([a.listModelProviders(),a.getModelProviderCatalog()]);h(t),K(n)}catch(t){C(G(t,"Failed to load model providers"))}finally{$(!1)}},[a]);l.useEffect(()=>{W()},[W]);const V=l.useMemo(()=>new Set(g.map(t=>t.type)),[g]),oe=l.useMemo(()=>g.filter(t=>{var n;return((n=t.name)==null?void 0:n.toLowerCase().includes(w))||t.models.some(c=>c.name.toLowerCase().includes(w)||c.id.toLowerCase().includes(w))}),[g,w]),s=l.useMemo(()=>o.filter(t=>t.type!=="custom"&&!V.has(t.type)&&(t.name.toLowerCase().includes(w)||t.models.some(n=>n.name.toLowerCase().includes(w)||n.id.toLowerCase().includes(w)))),[o,V,w]),r=l.useMemo(()=>{var t;return(t=o.find(n=>n.type==="custom"))==null?void 0:t.supportedReasoningEfforts},[o]),y=l.useMemo(()=>{const t=new Map;for(const n of o)t.set(n.type,n.models);return t},[o]),m=()=>{H(null),_(null),d(null)},b=async(t,n)=>{I(!0),C(null);try{await t(),await W(),m()}catch(c){throw n?n(c):i==null?C(G(c,"Request failed")):i.showError(c),c}finally{I(!1)}},F=async(t,n)=>{d(null),await b(async()=>{await a.createModelProvider({type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},c=>d(G(c,"Request failed"))),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"create"})},ue=async(t,n)=>{d(null),await b(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...n.baseUrl?{baseUrl:n.baseUrl}:{},apiKey:n.apiKey,models:t.models})},c=>d(G(c,"Request failed"))),i==null||i.showSuccess({title:`${t.name} updated`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"update"})},xe=()=>{p||(Q(null),O(null))},ee=({provider:t,models:n},c)=>b(async()=>{await a.updateModelProvider({id:t.id,type:t.type,name:t.name,...t.baseUrl?{baseUrl:t.baseUrl}:{},apiKey:"",models:n})},c),le=t=>{O(null);const n=L=>O(G(L,"Request failed"));let c;if(t.kind==="model"&&!he(t))c=ee({provider:t.provider,models:t.provider.models.filter(L=>L.id!==t.model.id)},n);else{const L=a.deleteModelProvider;L!==void 0&&(c=b(async()=>{await L({id:t.provider.id}),f(de.Settings.MODEL_PROVIDER_DELETED,{provider_name:t.provider.name})},n))}c==null||c.then(()=>Q(null)).catch(()=>{})},u=async t=>{x(null),await b(async()=>{await a.createModelProvider({type:"custom",name:t.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},n=>x(G(n,"Request failed"))),setTimeout(()=>{i==null||i.showSuccess({title:`${t.name} added`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:t.name,mode:"create"})},0)},D=async t=>{if(!v)return;const n=v;x(null),await b(async()=>{await a.updateModelProvider({id:n.id,type:n.type,name:n.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},c=>x(G(c,"Request failed"))),setTimeout(()=>{i==null||i.showSuccess({title:"Model provider updated",description:`${n.name} was updated successfully.`}),f(de.Settings.MODEL_PROVIDER_SAVED,{provider_name:n.name,mode:"update"})},0)},te=v?{name:v.name,baseUrl:v.baseUrl??"",models:v.models}:void 0,S=T!=null?g.find(t=>t.id===T)??null:null,X=R!=null?o.find(t=>t.type===R)??null:null,Ne=S!=null||X!=null;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Models"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Connect providers and choose which models are available."}),A?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:A}):null,e.jsx("div",{className:"mt-4 min-h-0 min-w-0 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full min-w-0 flex-col gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Se,{query:j,setQuery:N,placeholder:"Search providers and models"})}),e.jsxs(B.Secondary,{type:"button",className:"shrink-0 sm:self-auto",onClick:()=>{x(null),z(null),Y(!0)},children:[e.jsx(U,{name:"plus",size:"1rem",className:"mr-1"}),"Add Custom Provider"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 overflow-y-auto",children:[M?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!M&&oe.length>0?e.jsxs("section",{"aria-labelledby":"configured-providers-heading",children:[e.jsx("div",{id:"configured-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Configured"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:oe.map(t=>{const n=y.get(t.type)??[],c=new Set(t.models.map(E=>E.id)),L=n.filter(E=>!c.has(E.id)),be=ne[t.name];return e.jsxs("article",{className:"border-b border-border p-3 last:border-b-0",children:[e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:be?e.jsx(fe,{src:be,alt:t.name,className:"size-4.5"}):e.jsx(U,{name:"cpu",className:"size-4.5"})}),e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-success-bg",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success-bg"}),"Connected"]}),e.jsxs(B.Secondary,{size:"small",className:"text-[0.8125rem]",type:"button","aria-label":`Edit ${t.name}`,title:`Edit ${t.name}`,disabled:p,onClick:()=>{t.type==="custom"?(m(),x(null),z(t),Y(!0)):(d(null),_(null),H(t.id))},children:[e.jsx(U,{name:"pencil",className:"size-3.5"}),"Edit"]}),a.deleteModelProvider?e.jsx(B.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:p,onClick:()=>{O(null),Q({kind:"provider",provider:t})},children:"Remove"}):null]})]}),e.jsxs("div",{className:"mt-3 overflow-hidden rounded-lg border border-border bg-secondary-bg/30",children:[t.models.map(E=>e.jsxs("div",{className:"flex min-h-10 items-center gap-3 border-b border-border px-3 py-2 text-sm text-text-primary last:border-b-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:E.name}),t.models.length>1||a.deleteModelProvider?e.jsx("button",{type:"button","aria-label":`Remove ${E.name}`,disabled:p,className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring disabled:opacity-50",onClick:()=>{O(null),Q({kind:"model",provider:t,model:E})},children:e.jsx(U,{name:"trash",className:"size-3.5"})}):null]},E.id)),L.length>0?e.jsxs("section",{children:[e.jsxs("div",{className:"border-b border-border bg-secondary-bg/40 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available to add · ",L.length]}),L.map(E=>e.jsxs("div",{className:"flex min-h-12 items-center gap-3 border-b border-border px-3 py-2 text-sm text-text-primary last:border-b-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:E.name}),e.jsx(B.Secondary,{size:"small",type:"button",disabled:p,onClick:()=>{ee({provider:t,models:[...t.models,E]}).catch(()=>{})},children:"Add"})]},E.id))]}):null]})]},t.id)})})]}):null,!M&&s.length>0?e.jsxs("section",{"aria-labelledby":"available-providers-heading",className:"mt-2",children:[e.jsx("div",{id:"available-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Available"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:s.map(t=>{const n=ne[t.name];return e.jsx("article",{className:"border-b border-border p-3 last:border-b-0",children:e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:n?e.jsx(fe,{src:n,alt:t.name,className:"size-4.5"}):e.jsx(U,{name:"cpu",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:t.models.map(c=>c.name).join(" · ")})]})]}),e.jsxs(B.Secondary,{type:"button",disabled:p,onClick:()=>{d(null),H(null),_(t.type)},children:[e.jsx(U,{name:"wrench",className:"size-4"}),"Configure"]})]})},t.type)})})]}):null,!M&&oe.length===0&&s.length===0?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:w?`No providers match “${j.trim()}”.`:"No model providers yet."}):null]}),k?e.jsx(we,{title:k.kind==="model"&&!he(k)?"Remove model?":"Remove provider?",description:_e(k),busy:p,error:me,onCancel:xe,onConfirm:()=>{le(k)}}):null,e.jsx(Re,{open:Ne,onOpenChange:t=>{t||m()},onSave:t=>{if(S)return ue(S,t);if(X)return F(X,t)},title:S?"Edit Provider Details":"Configure Provider Details",initialBaseUrl:S?S.baseUrl??"":X?ze(X):"",requireApiKey:S==null,submitLabel:S?"Save":"Create",busy:p,error:J}),e.jsx(Ie,{open:ae,onOpenChange:t=>{Y(t),t||(x(null),z(null))},isEditMode:v!==null,initialValues:te,onSubmit:v?D:u,reasoningEffortOptions:r,busy:p,error:q},(v==null?void 0:v.id)??"add-custom-provider")]})})]})},qe=Fe;export{qe as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{B as Ye}from"./chunk-ICZTJLTU-CSBYGLaq.js";import{Q as pe,R as Ie,t as Ne,U as Le,r as i,V as fe,W as Ze,X as Te,Y as je,Z as Je,j as e,P as Xe,$ as et,a0 as ue,a1 as Fe,y as _e,a2 as M,I as C,a3 as tt,a4 as xe,a5 as Ce,a6 as st,a7 as at,a8 as Ee,a9 as W,aa as nt,ab as Q,O as Me,ac as rt,g as K,ad as lt,ae as it,af as ct,ag as ot,ah as dt,ai as ut,d as mt,aj as xt,ak as he,f as ht,al as ee,am as ft,b as gt,an as bt,ao as pt,ap as Nt,aq as jt,ar as yt,as as ze,l as vt,at as St,au as kt}from"./index-BJsGMvc-.js";var Ae=[{value:"America/New_York",label:"America/New_York (ET)"},{value:"America/Chicago",label:"America/Chicago (CT)"},{value:"America/Denver",label:"America/Denver (MT)"},{value:"America/Los_Angeles",label:"America/Los_Angeles (PT)"},{value:"UTC",label:"UTC"},{value:"Europe/London",label:"Europe/London (GMT/BST)"},{value:"Europe/Berlin",label:"Europe/Berlin (CET)"},{value:"Asia/Kolkata",label:"Asia/Kolkata (IST)"},{value:"Asia/Tokyo",label:"Asia/Tokyo (JST)"}];function $e(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function wt(t){const a=$e(),l=new Set(Ae.map(c=>c.value));return[...[a,t].flatMap(c=>c==null||c.length===0||l.has(c)?[]:(l.add(c),[{value:c,label:c===a?`${c} (Local)`:c}])),...Ae]}var Oe=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}],Tt={"America/New_York":"ET","America/Chicago":"CT","America/Denver":"MT","America/Los_Angeles":"PT",UTC:"UTC","Europe/London":"GMT","Europe/Berlin":"CET","Asia/Kolkata":"IST","Asia/Tokyo":"JST"};function me(){return{name:"",task:"",recurrence:"daily",hour:9,minute:0,weekdays:[1],customCron:"0 9 * * *",timezone:$e()}}function Ct(t){return Tt[t]??t.split("/").pop()??t}function Be(t){return t.toString().padStart(2,"0")}function ce({hour:t,minute:a}){const l=t>=12?"PM":"AM",r=t%12===0?12:t%12;return`${String(r)}:${Be(a)} ${l}`}function ge(t){const a=t.minute,l=t.hour;switch(t.recurrence){case"hourly":return`${String(a)} * * * *`;case"daily":return`${String(a)} ${String(l)} * * *`;case"weekly":{const r=[...t.weekdays].sort((o,N)=>o-N),c=r.length>0?r.join(","):"*";return`${String(a)} ${String(l)} * * ${c}`}case"custom":return t.customCron.trim()}}function ae(t){const a=Ct(t.timezone),l=t.cron.trim().split(/\s+/);if(l.length!==5)return t.cron;const[r,c,o,N,g]=l;if(o!=="*"||N!=="*")return t.cron;const x=Number(r),d=Number(c);if(c==="*"&&g==="*"&&r!==void 0&&!Number.isNaN(x))return`Hourly at :${Be(x)} ${a}`;if(g==="*"&&c!==void 0&&r!==void 0&&!Number.isNaN(d)&&!Number.isNaN(x))return`Daily ${ce({hour:d,minute:x})} ${a}`;if(g==="1-5"&&c!==void 0&&r!==void 0&&!Number.isNaN(d)&&!Number.isNaN(x))return`Weekdays ${ce({hour:d,minute:x})} ${a}`;if(g!=null&&/^\d(?:,\d)*$/.test(g)&&c!==void 0&&r!==void 0&&!Number.isNaN(d)&&!Number.isNaN(x)){const k=g.split(",").map(h=>{var w;return((w=Oe.find(n=>n.value===Number(h)))==null?void 0:w.label)??h});return k.length===1?`Every ${k[0]==="Mon"?"Monday":k[0]} ${ce({hour:d,minute:x})} ${a}`:`${k.join(", ")} ${ce({hour:d,minute:x})} ${a}`}return t.cron}function Re(t){const a=me(),l=t.cron.trim().split(/\s+/);if(l.length!==5)return{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron};const[r,c,o,N,g]=l,x=Number(r),d=Number(c);return o!=="*"||N!=="*"?{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron}:c==="*"&&g==="*"&&!Number.isNaN(x)?{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"hourly",minute:x,customCron:t.cron}:g==="*"&&!Number.isNaN(d)&&!Number.isNaN(x)?{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"daily",hour:d,minute:x,customCron:t.cron}:g!=null&&/^\d(?:,\d)*$/.test(g)&&!Number.isNaN(d)&&!Number.isNaN(x)?{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"weekly",hour:d,minute:x,weekdays:g.split(",").map(Number),customCron:t.cron}:{...a,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron,hour:Number.isNaN(d)?a.hour:d,minute:Number.isNaN(x)?a.minute:x}}function Et(t,a=Date.now()){return kt(t,{fallback:"Never",nowMs:a})}var zt=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"}],At=Array.from({length:24},(t,a)=>({value:String(a),label:a.toString().padStart(2,"0")})),Rt=[0,15,30,45].map(t=>({value:String(t),label:`:${t.toString().padStart(2,"0")}`}));function Pt({values:t,onChange:a,agentId:l,agentLabel:r,onAgentIdChange:c,onAgentPicked:o,agentPickerDisabled:N=!1,onBuildAgent:g}){const x=ge(t),d=ae({cron:x,timezone:t.timezone}),k=wt(t.timezone),h=(n,p)=>{a({...t,[n]:p})},w=n=>{const T=t.weekdays.includes(n)?t.weekdays.filter(E=>E!==n):[...t.weekdays,n];a({...t,weekdays:T.length>0?T:[n]})};return e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Agent"}),e.jsx(Fe,{"aria-label":"Agent",placeholder:"Search agent",value:l,selectedLabel:r,onValueChange:n=>c==null?void 0:c(n),onAgentPicked:o,disabled:N||c==null,onBuildAgent:g})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Name"}),e.jsx("input",{value:t.name,onChange:n=>h("name",n.target.value),placeholder:"harness-daily-digest",className:ze("h-8"),required:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Task"}),e.jsx("textarea",{value:t.task,onChange:n=>h("task",n.target.value),rows:3,placeholder:"Summarise yesterday's harness runs and post the digest…",className:ze("resize-y py-2"),required:!0})]}),e.jsxs("fieldset",{children:[e.jsx("legend",{className:"mb-1.5 text-sm font-medium",children:"Frequency"}),e.jsx("div",{className:"rounded-t-lg border border-border p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg border border-border bg-primary-bg p-1",children:zt.map(n=>{const p=t.recurrence===n.value;return e.jsx("button",{type:"button",className:K("rounded-md border px-2 py-2 text-sm font-medium transition-colors",p?"border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg":"border-transparent text-text-secondary hover:bg-ghost-button-hover"),"aria-pressed":p,onClick:()=>h("recurrence",n.value),children:n.label},n.value)})}),t.recurrence==="custom"?e.jsxs("div",{className:"rounded-md border border-border bg-secondary-bg/40 px-3 py-2",children:[e.jsx("span",{className:"block text-xs text-text-secondary",children:"Existing custom schedule"}),e.jsx("code",{className:"mt-1 block font-mono text-sm text-text-primary",children:t.customCron}),e.jsx("span",{className:"mt-1 block text-xs text-text-secondary",children:"Select Hourly, Daily, or Weekly to replace this schedule."})]}):null,t.recurrence==="weekly"?e.jsxs("fieldset",{children:[e.jsx("legend",{className:"mb-2 text-sm font-medium",children:"Days"}),e.jsx("div",{className:"flex gap-2",children:Oe.map(n=>{const p=t.weekdays.includes(n.value);return e.jsx("button",{type:"button",className:K("min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium",p?"border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg":"border-border text-text-secondary hover:bg-ghost-button-hover"),"aria-pressed":p,onClick:()=>w(n.value),children:n.label},n.value)})})]}):null,e.jsxs("div",{className:"flex gap-4",children:[t.recurrence==="daily"||t.recurrence==="weekly"?e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Hour"}),e.jsx(ue,{"aria-label":"Hour",value:String(t.hour),options:At,onValueChange:n=>h("hour",Number(n))})]}):null,t.recurrence!=="custom"?e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Minute"}),e.jsx(ue,{"aria-label":"Minute",value:String(t.minute),options:Rt,onValueChange:n=>h("minute",Number(n))})]}):null,e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Timezone"}),e.jsx(ue,{"aria-label":"Timezone",value:t.timezone,options:k,onValueChange:n=>h("timezone",n),menuClassName:"w-full min-w-0"})]})]})]})}),e.jsx("div",{className:"rounded-b-lg border border-t-0 border-border bg-primary-button-bg/10 px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{name:"clock",className:"size-4 shrink-0 text-primary-button-bg"}),e.jsx("span",{className:"shrink-0 text-xs font-medium text-text-secondary",children:"Schedule"}),e.jsx("p",{className:"min-w-0 flex-1 truncate text-sm text-text-primary",children:d||"—"}),e.jsx("code",{className:"shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary",children:x||"—"})]})})]})]})}function Dt(t){return t.startsWith("manual-")}function It(t){return t==="failed"?"failed":"success"}function Ue(t){return t==="failed"?"Failed":t==="triggered"?"Triggered":"Scheduled"}function Ge(t){return Dt(t)?"Manual test":"Cron"}function Lt(t,a=5){return t.filter(r=>r.status!=="scheduled").slice(0,a).reverse()}function be(t){if(t==null)return"—";const a=new Date(t);return Number.isNaN(a.getTime())?"—":jt(a)}function Ft({run:t}){return e.jsxs("div",{className:"flex flex-col gap-1 text-left text-xs",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Ue(t.status)}),e.jsx("p",{className:"text-text-secondary",children:Ge(t.name)}),e.jsxs("p",{className:"text-text-secondary",children:["Scheduled for: ",be(t.scheduledFor)]}),t.triggeredAt!=null?e.jsxs("p",{className:"text-text-secondary",children:["Triggered at: ",be(t.triggeredAt)]}):null,e.jsxs("p",{className:"text-text-secondary",children:["Triggered by: ",t.triggeredBy]}),t.status==="failed"&&t.reason?e.jsxs("p",{className:"text-text-secondary",children:["Reason: ",t.reason]}):null]})}var _t={success:"border-emerald-600/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-400/35 dark:bg-emerald-500/15 dark:text-emerald-300",failed:"border-red-600/30 bg-red-500/10 text-red-700 dark:border-red-400/35 dark:bg-red-500/15 dark:text-red-300"};function He({run:t}){const a=It(t.status),l=be(t.triggeredAt??t.scheduledFor);return e.jsx(Me,{content:e.jsx(Ft,{run:t}),className:"max-w-sm whitespace-normal",side:"top",children:e.jsx("span",{className:K("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",_t[a]),"aria-label":`${Ue(t.status)} run at ${l}`,children:e.jsx(C,{name:a==="failed"?"triangle-exclamation":"check",className:"size-3.5"})})})}function qe({status:t}){const a=t==="active";return e.jsx(Ye,{variant:a?"success":"warning",shape:"pill",size:"md",dot:!0,children:a?"Active":"Paused"})}function Mt(t,a){return t.find(l=>l.name===a||l.id===a)??null}function $t({connector:t,onConnected:a}){return vt()==null?null:e.jsx(St,{connector:t,onConnected:a})}function se({label:t,children:a}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border px-3 py-2.5 last:border-b-0",children:[e.jsx("span",{className:"text-text-secondary shrink-0 text-[10px] font-semibold tracking-wide uppercase",children:t}),e.jsx("div",{className:"min-w-0 text-right text-sm text-text-primary",children:a})]})}function Ot({schedule:t,agentName:a,mcpMounts:l,onEditConfiguration:r}){const c=pe(),o=Ne(),{connectors:N,ensureLoaded:g,refreshConnectors:x,loading:d,error:k}=yt(),[h,w]=i.useState(!1),[n,p]=i.useState(null),T=ae({cron:t.cron,timezone:t.timezone}),E=async()=>{w(!0);try{const m=await c.createScheduleRun({scheduleId:t.id});p(m),o==null||o.showSuccess({title:"Test run started"})}catch(m){o==null||o.showError(m)}finally{w(!1)}};return i.useEffect(()=>{g()},[g]),i.useEffect(()=>{k!=null&&(o==null||o.showError(k))},[k,o]),e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx(se,{label:"Agent",children:a}),e.jsx(se,{label:"Name",children:t.name}),e.jsx(se,{label:"Status",children:e.jsx(qe,{status:t.status})}),e.jsx(se,{label:"Task",children:e.jsx("span",{className:"whitespace-pre-wrap break-words",children:t.task})}),e.jsx(se,{label:"Frequency",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[e.jsx("span",{children:T}),e.jsx("code",{className:"text-text-secondary font-mono text-xs",children:t.cron})]})}),e.jsx("div",{className:"flex justify-end px-3 py-2.5",children:e.jsxs(M.Secondary,{type:"button",size:"small",onClick:r,children:[e.jsx(C,{name:"pencil",className:"size-3.5"}),"Edit Configuration"]})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx("div",{className:"border-b border-border px-3 py-2",children:e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Tool Authorization"})}),l.length===0?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"No MCP connectors configured for this agent."}):e.jsx("ul",{className:"divide-y divide-border",children:l.map(m=>{const S=Mt(N,m.name),F=(S==null?void 0:S.authenticated)===!0,z=S==null&&!d;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:K("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",F?"border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"border-border text-transparent"),"aria-hidden":!0,children:F?e.jsx(C,{name:"check",className:"size-3"}):null}),e.jsx("span",{className:"text-text-primary min-w-0 flex-1 truncate text-sm",children:m.name}),F?e.jsx("span",{className:"text-success-bg text-xs font-medium",children:"Connected"}):z?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):S!=null&&S.authenticated===!1?e.jsx($t,{connector:S,onConnected:x}):d?e.jsx("span",{className:"text-text-secondary text-xs",children:"Loading…"}):null]},m.name)})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Test Run"}),e.jsxs(M.Primary,{type:"button",disabled:h,size:"small",onClick:()=>void E(),children:[e.jsx(C,{name:h?"loader":"play",className:K("size-3.5",h&&"animate-spin")}),"Run Test"]})]}),n==null?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"Run a one-off test using the schedule task. This does not change the cron pending run."}):e.jsxs("div",{className:"flex items-center gap-3 px-3 py-3",children:[e.jsx(He,{run:n}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Ge(n.name)}),e.jsx("p",{className:"text-text-secondary",children:Et(n.triggeredAt??n.scheduledFor)})]})]})]})]})}function Bt({open:t,onOpenChange:a,mode:l,schedule:r,initialAgentId:c="",onSaved:o}){const N=pe(),g=Ie(),x=gt(),d=Ne(),k=Le(),[h,w]=i.useState(me),[n,p]=i.useState(c),[T,E]=i.useState(null),[m,S]=i.useState({kind:"form"}),[F,z]=i.useState(!1),[ne,A]=i.useState(!1),[G,b]=i.useState(null),Y=i.useRef(n);Y.current=n;const $=m.kind==="form"?m.saved:m.schedule,O=l==="edit"&&m.kind==="form"&&m.saved==null&&r!=null,_=m.kind==="form"&&m.saved!=null,H=l==="create"&&m.kind==="form"&&m.saved==null,{allows:q}=fe({resourceType:"agent",resourceIds:n.length===0?[]:[n]});i.useEffect(()=>{if(!t){w(me()),p(c),E(null),b(null),S({kind:"form"}),A(!1);return}if(l==="edit"&&r!=null){w(Re({name:r.name,task:r.task,cron:r.cron,timezone:r.timezone})),p(r.agentId),E(null),S({kind:"form"});return}w(me()),p(c),E(null),S({kind:"form"})},[t,l,r,c]),i.useEffect(()=>{if(!t||l!=="create"||c.length===0)return;let f=!1;const j=c;return bt({server:g,agentKey:j}).then(y=>{f||y==null||Y.current===j&&(E(y),p(_e(y)))}).catch(()=>{}),()=>{f=!0}},[t,l,c,g]);const B=(T==null?void 0:T.name)??($==null?void 0:$.agentName)??(r==null?void 0:r.agentName)??(n.length>0?n:""),Z=i.useMemo(()=>{var j;return(((j=T==null?void 0:T.agentSpec)==null?void 0:j.mcpServers)??[]).map(pt).filter(y=>y!=null).map(y=>({name:y}))},[T]),R=i.useMemo(()=>{const f=ge(h);return h.name.trim().length>0&&h.task.trim().length>0&&f.length>0&&n.length>0&&(!H||q(n,"USE"))},[n,q,h,H]),te=f=>{S({kind:"test",schedule:f}),w(Re({name:f.name,task:f.task,cron:f.cron,timezone:f.timezone})),p(f.agentId)},J=async f=>{if(f.preventDefault(),!R)return;const j=ge(h);z(!0),b(null);try{if(O&&r!=null){await N.updateSchedule({id:r.id,name:h.name.trim(),task:h.task.trim(),cron:j,timezone:h.timezone,status:r.status}),k(ee.Schedule.EDITED,{schedule_id:r.id,agent_id:r.agentId}),o==null||o(),a(!1);return}if(_&&m.kind==="form"&&m.saved!=null){const L=await N.updateSchedule({id:m.saved.id,name:h.name.trim(),task:h.task.trim(),cron:j,timezone:h.timezone,status:"paused"});k(ee.Schedule.EDITED,{schedule_id:L.id,agent_id:L.agentId}),o==null||o(),te(L),d==null||d.showSuccess({title:"Schedule saved as paused",description:ae({cron:L.cron,timezone:L.timezone})});return}const y=await N.createSchedule({agentId:n,name:h.name.trim(),task:h.task.trim(),cron:j,timezone:h.timezone,status:"paused"});k(ee.Schedule.CREATED,{schedule_id:y.id,agent_id:n}),o==null||o(),te(y),d==null||d.showSuccess({title:"Schedule saved as paused",description:ae({cron:y.cron,timezone:y.timezone})})}catch(y){const L=y instanceof Error?y.message:"Failed to save schedule";b(L)}finally{z(!1)}},D=async()=>{if(m.kind==="test"){A(!0),b(null);try{await N.updateSchedule({id:m.schedule.id,name:m.schedule.name,task:m.schedule.task,cron:m.schedule.cron,timezone:m.schedule.timezone,status:"active"}),o==null||o(),d==null||d.showSuccess({title:"Schedule activated"}),a(!1)}catch(f){const j=f instanceof Error?f.message:"Failed to activate schedule";b(j),d==null||d.showError(f)}finally{A(!1)}}},V=m.kind==="test"?"Test Schedule":O||_?"Edit Schedule":"New Schedule",re=m.kind==="test"?`Recurring unattended runs of ${B}.`:O||_?"Update cadence and task for this schedule.":"Create a recurring unattended run for an agent.";let I;return m.kind==="test"?I=e.jsxs("div",{className:"flex flex-col gap-2",children:[G!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:G}):null,e.jsx(M.Secondary,{type:"button",className:"w-full",disabled:ne,onClick:()=>void D(),children:"Activate Schedule"})]}):I=e.jsxs("div",{className:"flex flex-col gap-2",children:[G!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:G}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(M.Secondary,{type:"button",onClick:()=>a(!1),disabled:F,children:"Cancel"}),e.jsx(M.Primary,{type:"submit",form:"schedule-form",disabled:!R||F,children:"Save"})]})]}),e.jsx(Nt,{open:t,onOpenChange:a,title:V,description:re,anchor:"right",size:"xl",headerIcon:e.jsx("span",{className:"text-primary-button-bg inline-flex size-8 items-center justify-center",children:e.jsx(C,{name:m.kind==="test"||O||_?"calendar":"calendar-plus",className:"size-5"})}),footer:I,children:m.kind==="test"?e.jsx(Ot,{schedule:m.schedule,agentName:B,mcpMounts:Z,onEditConfiguration:()=>{b(null),S({kind:"form",saved:m.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:f=>void J(f),children:e.jsx(Pt,{values:h,onChange:w,agentId:n,agentLabel:B,onAgentIdChange:O||_?void 0:f=>{p(f),f.length===0&&E(null)},onAgentPicked:E,agentPickerDisabled:O||_,onBuildAgent:l==="create"&&(x==null?void 0:x.isComposerEnabled)===!0?()=>{a(!1),x.openAgentBuilder()}:void 0})})})}function Pe(t){return e.jsx(ft,{children:e.jsx(Bt,{...t})})}function Ut({runs:t}){const a=Lt(t);return a.length===0?e.jsx("span",{className:"text-text-secondary text-sm",children:"—"}):e.jsx("div",{className:"flex items-center gap-1",children:a.map(l=>e.jsx(He,{run:l},l.id))})}var Gt=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],De=[10,25];function oe(t){return Math.min(Math.max(t,1),25)}function de(t){const a=je(t);return{nameQuery:a.q??"",statusFilter:a.status??"all",agentFilter:a.agent??"all"}}function Ht(t){const a=je(window.location.search);if(!a.isNew)return{kind:"closed"};const l=t??a.agent;return{kind:"create",...l==null?{}:{agentId:l}}}function qt({schedule:t,running:a,canManage:l,canDelete:r,onRunNow:c,onEdit:o,onTogglePause:N,onDelete:g}){const x=mt("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1.5",children:[e.jsx(x,{allowed:l,children:e.jsxs(M.Secondary,{type:"button",disabled:a,"aria-label":`Run now ${t.name}`,size:"large",onClick:c,children:[e.jsx(C,{name:a?"loader":"play",className:K("size-3.5",a&&"animate-spin")}),"Run now"]})}),e.jsxs(xt,{align:"end",trigger:e.jsx("button",{type:"button",className:ht({variant:"ghost",size:"icon"}),"aria-label":`Actions for ${t.name}`,children:e.jsx(C,{name:"ellipsis"})}),children:[e.jsx(x,{allowed:l,children:e.jsxs(he,{onClick:o,children:[e.jsx(C,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(x,{allowed:l,children:e.jsxs(he,{onClick:N,children:[e.jsx(C,{name:t.status==="active"?"pause":"play",className:"size-3.5"}),t.status==="active"?"Pause":"Resume"]})}),e.jsx(x,{allowed:r,children:e.jsxs(he,{className:"text-failure-bg focus:text-failure-bg",onClick:g,children:[e.jsx(C,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function Qt({agentId:t}){const a=pe(),l=Ie(),r=Ne(),c=Le(),[o,N]=i.useState([]),{allows:g}=fe({resourceType:"schedule",resourceIds:o.map(s=>s.id)}),[x,d]=i.useState({}),[k,h]=i.useState(!1),[w,n]=i.useState(()=>new Set),[p,T]=i.useState({}),[E,m]=i.useState(!0),[S,F]=i.useState(null),[z,ne]=i.useState(()=>de(window.location.search).nameQuery),[A,G]=i.useState(()=>de(window.location.search).statusFilter),[b,Y]=i.useState(()=>t??de(window.location.search).agentFilter),$=t??(b==="all"?null:b),{allows:O}=fe({resourceType:"agent",resourceIds:$==null?[]:[$]}),_=l.permissions==null||$==null||O($,"USE"),[H,q]=i.useState(()=>Ht(t)),[B,Z]=i.useState(null),[R,te]=i.useState(()=>oe(ut)),[J,D]=i.useState(void 0),[V,re]=i.useState(void 0),[I,f]=i.useState(void 0),j=i.useRef(0),y=i.useRef(!1),L=i.useCallback(async({rows:s,gen:u})=>{if(s.length===0){u===j.current&&d({});return}h(!0);try{const v=await Promise.allSettled(s.map(P=>a.listScheduleRuns({scheduleId:P.id})));if(u!==j.current)return;d(Object.fromEntries(s.map((P,U)=>{const ie=v[U],Ke=(ie==null?void 0:ie.status)==="fulfilled"?ie.value:[];return[P.id,Ke]})))}finally{u===j.current&&h(!1)}},[a]),X=i.useCallback(async({token:s,size:u,agentId:v})=>{const P=++j.current;m(!0),F(null);try{const U=await a.listSchedules({limit:oe(u),...s===void 0||s===""?{}:{pageToken:s},...v==="all"?{}:{agentIds:[v]}});if(P!==j.current)return;N(U.data),re(U.nextPageToken),f(U.previousPageToken),L({rows:U.data,gen:P})}catch(U){if(P!==j.current)return;F(Ze(U,"Check your connection and try again.")),N([]),d({}),re(void 0),f(void 0)}finally{P===j.current&&m(!1)}},[a,L]),ye=i.useCallback(s=>{const u=(s==null?void 0:s.size)??R,v=(s==null?void 0:s.agentId)??b;D(void 0),f(void 0),X({token:void 0,size:u,agentId:v})},[b,X,R]);i.useEffect(()=>{Te({agent:t===void 0&&b!=="all"?b:null,status:A==="all"?null:A,q:z.trim().length===0?null:z})},[b,t,A,z]),i.useEffect(()=>{t!==void 0&&Y(s=>s===t?s:(D(void 0),f(void 0),t))},[t]),i.useEffect(()=>{y.current||!je(window.location.search).isNew||(y.current=!0,Te({isNew:null}))},[]),i.useEffect(()=>{const s=()=>{const u=de(window.location.search);ne(u.nameQuery),G(u.statusFilter),Y(v=>{const P=t??u.agentFilter;return v===P?v:(D(void 0),f(void 0),P)})};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[t]),i.useEffect(()=>{X({token:J,size:R,agentId:b})},[b,R,J,X]);const le=i.useMemo(()=>{const s=z.trim().toLowerCase();return o.filter(u=>!(A!=="all"&&u.status!==A||s.length>0&&!u.name.toLowerCase().includes(s)))},[o,z,A]),ve=Je(o),Se=I!=null||V!=null,Ve=async s=>{if(!g(s.id,"MANAGE"))return;const u=s.status==="active"?"paused":"active";try{await a.updateSchedule({...s,status:u}),c(ee.Schedule.TOGGLED,{schedule_id:s.id,agent_id:s.agentId,next_status:u}),await X({token:J,size:R,agentId:b})}catch(v){r==null||r.showError(v)}},We=async s=>{if(g(s.id,"MANAGE")){n(u=>new Set(u).add(s.id));try{await a.createScheduleRun({scheduleId:s.id}),c(ee.Schedule.RUN_NOW,{schedule_id:s.id,agent_id:s.agentId}),r==null||r.showSuccess({title:"Run started"});const u=await a.listScheduleRuns({scheduleId:s.id});d(v=>({...v,[s.id]:u}))}catch(u){r==null||r.showError(u)}finally{n(u=>{const v=new Set(u);return v.delete(s.id),v})}}},Qe=async s=>{if(g(s.id,"DELETE")){Z(null);try{await a.deleteSchedule({id:s.id}),c(ee.Schedule.DELETED,{schedule_id:s.id,agent_id:s.agentId}),ye()}catch(u){r==null||r.showError(u)}}},ke=()=>{V!=null&&D(V)},we=()=>{I==null||I===""||D(I)};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-primary-bg",children:[e.jsx(Xe,{title:t===void 0?"Agent Schedules":void 0,end:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full sm:w-60",children:e.jsx(et,{query:z,setQuery:ne,placeholder:"Search schedules by name"})}),e.jsx(ue,{value:A,onValueChange:G,options:Gt,className:"sm:w-40","aria-label":"Filter by status"}),t===void 0?e.jsx(Fe,{value:b,selectedLabel:b==="all"?"All agents":p[b]??b,onValueChange:s=>{Y(s),D(void 0),f(void 0)},onAgentPicked:s=>{T(u=>({...u,[_e(s)]:s.name}))},allOption:{value:"all",label:"All agents"},className:"sm:w-48","aria-label":"Filter by agent",placeholder:"Search agent"}):null,e.jsxs(M.Primary,{type:"button",disabled:!_,onClick:()=>_&&q({kind:"create",agentId:b!=="all"?b:void 0}),children:[e.jsx(C,{name:"plus",className:"size-3.5"}),"New Schedule"]})]})}),e.jsx("div",{className:K("min-h-0 flex-1 overflow-auto px-4 py-4",S!=null?"flex flex-col":void 0),children:E?e.jsx("div",{className:"flex flex-col gap-2",role:"status","aria-label":"Loading schedules",children:Array.from({length:5},(s,u)=>e.jsx(tt,{className:"h-12 w-full rounded-md"},u))}):S!=null?e.jsx("div",{role:"alert",className:"flex flex-1 flex-col items-center justify-center",children:e.jsx(xe,{title:"Couldn't load schedules",description:S,className:"h-auto min-h-0 flex-none py-0"})}):o.length===0?e.jsx(xe,{title:"No Schedules Found",description:"Create one to get started.",className:"min-h-full"}):le.length===0?e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(xe,{title:"No Schedules Found",description:"No schedules match your filters.",className:"flex-1"}),Se?e.jsx(Ce,{pageSize:R,rowCount:0,canPrev:I!=null,canNext:V!=null,onPrev:we,onNext:ke,pageSizeOptions:De,onPageSizeChange:s=>{const u=oe(s);te(u),D(void 0),f(void 0)}}):null]}):e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs(st,{className:"min-w-240",children:[e.jsx(at,{children:e.jsxs(Ee,{className:"hover:bg-transparent",children:[e.jsx(W,{children:"Schedule Name"}),e.jsx(W,{children:"Task"}),ve?e.jsx(W,{children:"Created by"}):null,e.jsx(W,{children:"Frequency"}),e.jsx(W,{children:"Status"}),e.jsx(W,{children:"Last 5 runs"}),e.jsx(W,{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(nt,{children:le.map(s=>{const u=ae({cron:s.cron,timezone:s.timezone}),v=s.agentName??p[s.agentId]??s.agentId;return e.jsxs(Ee,{children:[e.jsxs(Q,{className:"w-48 max-w-48",children:[e.jsx("span",{className:"text-text-primary block truncate font-medium",children:s.name}),e.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(C,{name:"agent-2",className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:v})]})]}),e.jsx(Q,{className:"w-64 max-w-64",children:e.jsx(Me,{content:s.task,className:"max-w-sm whitespace-normal text-left",triggerClassName:"block min-w-0 w-full max-w-full",children:e.jsx("span",{className:"block truncate",children:s.task})})}),ve?e.jsx(Q,{children:e.jsx(rt,{subject:s.createdBySubject})}):null,e.jsx(Q,{children:u}),e.jsx(Q,{children:e.jsx(qe,{status:s.status})}),e.jsx(Q,{children:k?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):e.jsx(Ut,{runs:x[s.id]??[]})}),e.jsx(Q,{className:"text-right",children:e.jsx(qt,{schedule:s,running:w.has(s.id),canManage:g(s.id,"MANAGE"),canDelete:g(s.id,"DELETE"),onRunNow:()=>void We(s),onEdit:()=>{g(s.id,"MANAGE")&&q({kind:"edit",schedule:s})},onTogglePause:()=>void Ve(s),onDelete:()=>{g(s.id,"DELETE")&&Z(s)}})})]},s.id)})})]}),(le.length>0||Se)&&e.jsx(Ce,{pageSize:R,rowCount:le.length,canPrev:I!=null,canNext:V!=null,onPrev:we,onNext:ke,pageSizeOptions:De,onPageSizeChange:s=>{const u=oe(s);te(u),D(void 0),f(void 0)}})]})}),H.kind==="create"?e.jsx(Pe,{open:!0,mode:"create",initialAgentId:H.agentId??"",onOpenChange:s=>{s||q({kind:"closed"})},onSaved:()=>ye()}):null,H.kind==="edit"?e.jsx(Pe,{open:!0,mode:"edit",schedule:H.schedule,onOpenChange:s=>{s||q({kind:"closed"})},onSaved:()=>void X({token:J,size:R,agentId:b})}):null,B!=null?e.jsxs(lt,{open:!0,onOpenChange:s=>{s||Z(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(it,{children:e.jsxs(ct,{children:[e.jsx(ot,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",B.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(dt,{children:[e.jsx(M.Secondary,{type:"button",onClick:()=>Z(null),children:"Cancel"}),e.jsx(M.Destructive,{type:"button",disabled:!g(B.id,"DELETE"),onClick:()=>void Qe(B),children:"Delete"})]})]}):null]})}export{Qt as SchedulesPage};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as ie}from"./chunk-BZ2EOR5X-BgN-bqzz.js";import{i as le,k as oe,l as ue,m as ce,n as pe,o as ge,p as fe,q as ye,t as he,r as a,v as de,w as me,x as Se,y as be,z as M,A as C,B as x,E as _}from"./index-BJsGMvc-.js";import{u as Ae,a as Oe}from"./chunk-OB3PAWPO-WTBtRmxH.js";var k="try_agent_name",T="history_agent_name";function ee(n){return n!=null&&n.length>0?n:null}function B(n){const i=new URLSearchParams(n.startsWith("?")?n.slice(1):n),l=ee(i.get(k));if(l!=null)return{intent:"try-agent",agentName:l};const c=ee(i.get(T));return c==null?null:{intent:"history",agentName:c}}function ve(n,i){n.delete(k),n.delete(T),i!=null&&n.set(i.intent==="try-agent"?k:T,i.agentName)}function te(n,i){const l=new URLSearchParams(n.startsWith("?")?n.slice(1):n);ve(l,i);const c=l.toString();return c.length>0?`?${c}`:""}function ne(n){const i=n.activeRemoteId??n.pendingSessionId;if(i!=null)return{type:"session",sessionId:i};const{mode:l,agentConfigMode:c}=n;if(l.status==="active"&&l.isMutable&&l.isCreateAgent)return{type:"buildAgent"};if(l.status==="active"&&!l.isMutable&&c!=="SingleAgent"){const e=l.agentName??l.agentId;if(e!=null)return{type:"agent",agentName:e}}return{type:"root"}}function Ne(n){return n.settingsOpen?{type:"settings"}:n.schedulesOpen?{type:"schedules"}:n.environmentsOpen?{type:"environments"}:n.sessionsOpen&&n.sharedSessionId!=null?{type:"sharedSession",sessionId:n.sharedSessionId}:n.sessionsOpen?{type:"sessionsBrowser"}:n.libraryOpen&&n.libraryAgentId!=null?{type:"libraryAgent",agentId:n.libraryAgentId}:n.libraryOpen?{type:"library"}:ne(n)}function A(n){return n.type==="root"||n.type==="agent"||n.type==="session"}function Re(n){return n.type==="sessionsBrowser"||n.type==="sharedSession"}function Ce({routes:n,activeRemoteId:i,initialSettingsOpen:l,onError:c}){var V,X;const e=le(),m=oe(),q=ue(),U=ce(),$=pe(),W=ge(),Y=fe(),G=ye(),P=he(),H=Ae(),r=Oe(),o=a.useMemo(()=>de({routes:n,catalog:q,capabilities:Y,sessions:U,schedules:$,sandboxEnvironments:W}),[n,q,Y,U,$,W]),K=o.settings!=null,se=[o.settings,o.sessionsBrowser,o.sharedSession,o.libraryAgent,o.schedules,o.environments].join("\0"),z={settingsOpen:e.settingsOpen,libraryOpen:e.libraryOpen,sessionsOpen:e.sessionsOpen,sharedSessionId:e.sharedSessionId,libraryAgentId:e.libraryAgentId,schedulesOpen:e.schedulesOpen,environmentsOpen:e.environmentsOpen,pendingSessionId:e.pendingSessionId,activeRemoteId:i,mode:e.mode,agentConfigMode:e.agentConfigMode},g=Ne(z),re=JSON.stringify(g),b=a.useRef(null),L=a.useRef(null),O=a.useRef(null),v=a.useRef(!1),N=a.useRef(null),S=a.useRef(null),R=a.useRef(null),f=a.useRef(null),Q=a.useRef(!1),j=a.useRef(!1),E=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]),D=a.useCallback(t=>{if(R.current=t,m==null){e.openHistorySession({sessionId:t});return}m.getSession({sessionId:t}).then(s=>{R.current===t&&e.openHistorySession({sessionId:t,isMutable:s.isMutable,isCreateAgent:me(s),...s.agentName!=null?{agentName:s.agentName}:{}})}).catch(s=>{R.current===t&&(R.current=null,N.current=null,ie({error:s,...c!=null?{onError:c}:{},...P!=null?{showError:P.showError}:{}}),E())})},[E,c,m,e,P]),h=a.useCallback(t=>{if(t==null){f.current=null,S.current=null,e.setHistoryAgentFilter(null);return}const s=`${t.intent}\0${t.agentName}`,u=e.historyAgentFilter;if((u==null?void 0:u.intent)===t.intent&&u.agentName===t.agentName&&u.agentId!=null){f.current=null;return}f.current=s,e.setHistoryAgentFilter(t),m!=null&&Se({server:m,agentName:t.agentName}).then(p=>{if(f.current===s){if(p==null){f.current=null,S.current=null,e.setHistoryAgentFilter(null);return}f.current=null,e.setHistoryAgentFilter({agentId:be(p),agentName:p.name,intent:t.intent})}}).catch(()=>{f.current===s&&(f.current=null,S.current=null,e.setHistoryAgentFilter(null))})},[m,e]),J=a.useCallback(t=>{e.selectLibraryAgent({isMutable:!1,agentName:t}),h({intent:"try-agent",agentName:t})},[h,e]),F=a.useCallback(t=>{switch(t.type){case"settings":e.setSettingsOpen(!0);return;case"library":e.setLibraryOpen(!0);return;case"sessionsBrowser":e.setSessionsOpen(!0);return;case"sharedSession":e.openSharedSession(t.sessionId);return;case"libraryAgent":e.openLibraryAgent(t.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===t.sessionId||i===t.sessionId)return;D(t.sessionId);return;case"agent":e.setLibraryOpen(!1),J(t.agentName);return;case"root":E();return}},[e,i,E,J,D]);return a.useEffect(()=>{if(v.current)return;const t=M({pathname:r.pathname,search:r.search,routes:n});if(!G&&(t==null?void 0:t.type)==="settings")return;v.current=!0;const s=M({pathname:r.pathname,search:r.search,routes:o})??{type:"root"},u=s.type==="agent"?{intent:"try-agent",agentName:s.agentName}:A(s)?B(r.search):null;S.current=u,O.current=s;const p=K&&(l||s.type==="settings");if(s.type==="settings")K&&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 w=ne(z);C(w,s)||F(s),p&&e.setSettingsOpen(!0)}s.type!=="agent"&&u!=null?h(u):A(s)||h(null);const d=p?{type:"settings"}:s;N.current=C(g,d)?null:d;const y=x(d,o),I=te(_(d,r.search),u);L.current=d,y!=null&&(y!==r.pathname||I!==r.search)&&(b.current=y!==r.pathname?y:null,H({pathname:y,search:I,hash:r.hash},{replace:!0}))},[G]),a.useEffect(()=>{if(!v.current)return;if(!Q.current){Q.current=!0;return}const t=N.current;if(t!=null){if(!C(g,t))return;N.current=null}const s=x(g,o);if(s==null)return;const p=`${o.basename.endsWith("/")?o.basename.slice(0,-1):o.basename}${r.pathname}`||"/",d=window.location.pathname===p?window.location.search:r.search,y=A(g),I=y?e.historyAgentFilter==null?S.current:{intent:e.historyAgentFilter.intent,agentName:e.historyAgentFilter.agentName}:null;!y&&e.historyAgentFilter!=null&&(f.current=null,e.setHistoryAgentFilter(null)),e.historyAgentFilter!=null&&(S.current=null);const w=te(_(g,d),I),Z=L.current;if(L.current=g,s===r.pathname&&w===r.search)return;const ae=g.type==="session"&&e.pendingSessionId==null&&Z!=null&&Z.type!=="session";b.current=s!==r.pathname?s:null,H({pathname:s,search:w,hash:r.hash},{replace:ae})},[re,se,(V=e.historyAgentFilter)==null?void 0:V.agentName,(X=e.historyAgentFilter)==null?void 0:X.intent]),a.useEffect(()=>{if(!v.current)return;if(!j.current){j.current=!0;return}if(b.current===r.pathname){b.current=null,O.current=g;return}const t=M({pathname:r.pathname,search:r.search,routes:o});if(t==null){const u=o.root,p=_({type:"root"},r.search);b.current=u,H({pathname:u,search:p,hash:r.hash},{replace:!0}),F({type:"root"}),h(B(p));return}const s=O.current;O.current=t,(s==null||!C(s,t))&&(t.type!=="settings"&&e.settingsOpen&&e.setSettingsOpen(!1),t.type!=="library"&&t.type!=="libraryAgent"&&e.libraryOpen&&e.setLibraryOpen(!1),!Re(t)&&e.sessionsOpen&&e.setSessionsOpen(!1),t.type!=="schedules"&&e.schedulesOpen&&e.setSchedulesOpen(!1),t.type!=="environments"&&e.environmentsOpen&&e.setEnvironmentsOpen(!1),F(t)),t.type!=="agent"&&A(t)?h(B(r.search)):A(t)||h(null)},[r.pathname,r.search]),null}export{Ce as ShellRouteSync};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-CVPLV5HY-D0lac3y-.js","./index-BJsGMvc-.js","./index-B01pXqvC.css","./SchedulesPage-HLHAOIS6-BcDOMjiM.js","./chunk-ICZTJLTU-CSBYGLaq.js","./EnvironmentsPage-OXKHJMOO-C-t7Dp_i.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c1 as _,c2 as Zt,u as V,j as r,c3 as en,r as m,be as P,c4 as We,c5 as tn,c6 as Xe,c7 as Ye,c8 as qe,c9 as Je,ca as Qe,cb as Q,cc as nn,cd as N,ce as rn,cf as sn,cg as on,ch as an,ci as cn,cj as ln,ck as un,cl as dn,cm as Ie,cn as mn,co as fn,cp as me,cq as pn,cr as hn,cs as xn,ct as Ze,cu as ke,cv as fe,cw as je,cx as ae,cy as Me,cz as Se,cA as Ce,cB as Be,k as et,U as tt,b as ne,d as L,V as gn,cC as vn,g as $,t as bn,cD as wn,al as le,bL as ue,cE as Fe,cF as yn,c as Le,b3 as nt,cG as In,$ as jn,ak as Ke,I as H,y as Mn,f as te,cH as rt,cI as Sn,cJ as Cn,cK as $e,b7 as Ln,as as Tn,a2 as ze,s as st,cL as Nn,P as Rn,cM as Pn,S as ge,D as En,cN as ot,cO as at,bq as Dn,_ as Te,cP as An,bU as _n}from"./index-BJsGMvc-.js";import{A as On,N as kn,T as Bn,S as it}from"./chunk-NYCSPKHJ-BXKEzm55.js";const Ne=n=>{const e=_(8),{index:t,archived:s,children:o}=n;let i;e[0]!==s||e[1]!==t?(i=Zt({source:"threads",query:{type:"index",index:t,archived:s},get:u=>u.threads().item({index:t,archived:s})}),e[0]=s,e[1]=t,e[2]=i):i=e[2];let a;e[3]!==i?(a={threadListItem:i},e[3]=i,e[4]=a):a=e[4];const l=V(a);let d;return e[5]!==l||e[6]!==o?(d=r.jsx(en,{value:l,children:o}),e[5]=l,e[6]=o,e[7]=d):d=e[7],d},ct=m.memo(n=>{const e=_(6),{index:t,archived:s,components:o}=n,i=s===void 0?!1:s,a=o.ThreadListItem;let l;e[0]!==a?(l=r.jsx(a,{}),e[0]=a,e[1]=l):l=e[1];let d;return e[2]!==i||e[3]!==t||e[4]!==l?(d=r.jsx(Ne,{index:t,archived:i,children:l}),e[2]=i,e[3]=t,e[4]=l,e[5]=d):d=e[5],d},(n,e)=>n.index===e.index&&n.archived===e.archived&&n.components.ThreadListItem===e.components.ThreadListItem);ct.displayName="ThreadListPrimitive.ItemByIndex";const Ge=({archived:n,children:e})=>{const t=P(s=>n?s.threads.archivedThreadIds.length:s.threads.threadIds.length);return We(()=>Array.from({length:t},(s,o)=>r.jsx(Ne,{index:o,archived:n,children:r.jsx(tn,{getItemState:i=>i.threads().item({index:o,archived:n}).getState(),children:i=>e({get threadListItem(){return i()}})})},o)),[t,n,e])},lt=n=>{const e=_(8),{archived:t,components:s,children:o}=n,i=t===void 0?!1:t;if(s){const l=s.ThreadListItem;let d;e[0]!==l?(d=()=>r.jsx(l,{}),e[0]=l,e[1]=d):d=e[1];let u;return e[2]!==i||e[3]!==d?(u=r.jsx(Ge,{archived:i,children:d}),e[2]=i,e[3]=d,e[4]=u):u=e[4],u}let a;return e[5]!==i||e[6]!==o?(a=r.jsx(Ge,{archived:i,children:o}),e[5]=i,e[6]=o,e[7]=a):a=e[7],a};lt.displayName="ThreadListPrimitive.Items";const ut=n=>{const e=_(2),{fallback:t}=n,s=P(Fn)||t;let o;return e[0]!==s?(o=r.jsx(r.Fragment,{children:s}),e[0]=s,e[1]=o):o=e[1],o};ut.displayName="ThreadListItemPrimitive.Title";function Fn(n){return n.threadListItem.title}const Kn=()=>{const n=_(4),e=V();let t;n[0]!==e?(t=()=>{e.threadListItem().archive()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={archive:s},n[2]=s,n[3]=o):o=n[3],o},$n=()=>{const n=_(4),e=V();let t;n[0]!==e?(t=()=>{e.threadListItem().delete()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={delete:s},n[2]=s,n[3]=o):o=n[3],o},zn=()=>{const n=_(4),e=V();let t;n[0]!==e?(t=()=>{e.threadListItem().unarchive()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={unarchive:s},n[2]=s,n[3]=o):o=n[3],o},Gn=()=>{const n=_(4),e=V();let t;n[0]!==e?(t=()=>{e.threadListItem().switchTo()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={switchTo:s},n[2]=s,n[3]=o):o=n[3],o},Hn=()=>{const n=_(4),e=V();let t;n[0]!==e?(t=()=>{e.threads().switchToNewThread()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={switchToNewThread:s},n[2]=s,n[3]=o):o=n[3],o},Un=()=>{const n=_(5),e=V(),t=P(Vn);let s;n[0]!==e?(s=()=>{e.threads().loadMore()},n[0]=e,n[1]=s):s=n[1];const o=s;let i;return n[2]!==t||n[3]!==o?(i={loadMore:o,disabled:t},n[2]=t,n[3]=o,n[4]=i):i=n[4],i};function Vn(n){return!n.threads.hasMore||n.threads.isLoading||n.threads.isLoadingMore}var Wn=Object.defineProperty,S=(n,e)=>Wn(n,"name",{value:e,configurable:!0}),Xn=["Enter"," "],Yn=["ArrowDown","PageUp","Home"],dt=["ArrowUp","PageDown","End"],qn=[...Yn,...dt],pe="Menu",[be,Jn,Qn]=Je(pe),[Z,mt]=Xe(pe,[Qn,Ye,qe]),Re=Ye(),ft=qe(),[Zn,ie]=Z(pe),[er,Pe]=Z(pe),tr=S(n=>{const{__scopeMenu:e,open:t=!1,children:s,dir:o,onOpenChange:i,modal:a=!0}=n,l=Re(e),[d,u]=m.useState(null),c=m.useRef(!1),f=fn(i),h=me(o);return m.useEffect(()=>{const p=S(()=>{c.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},"handleKeyDown"),v=S(()=>c.current=!1,"handlePointer");return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),m.useEffect(()=>{if(!t)return;const p=S(()=>f(!1),"handleBlur");return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[t,f]),r.jsx(pn,{...l,children:r.jsx(Zn,{scope:e,open:t,onOpenChange:f,content:d,onContentChange:u,children:r.jsx(er,{scope:e,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:c,dir:h,modal:a,children:s})})})},"Menu"),nr=m.forwardRef(S(function(e,t){const{__scopeMenu:s,...o}=e,i=Re(s);return r.jsx(hn,{...i,...o,ref:t})},"MenuAnchor")),pt="MenuPortal",[rr,sr]=Z(pt,{forceMount:void 0}),or=S(n=>{const{__scopeMenu:e,forceMount:t,children:s,container:o}=n,i=ie(pt,e);return r.jsx(rr,{scope:e,forceMount:t,children:r.jsx(Qe,{present:t||i.open,children:r.jsx(xn,{asChild:!0,container:o,children:s})})})},"MenuPortal"),J="MenuContent",[ar,ht]=Z(J),ir=m.forwardRef(S(function(e,t){const s=sr(J,e.__scopeMenu),{forceMount:o=s.forceMount,...i}=e,a=ie(J,e.__scopeMenu),l=Pe(J,e.__scopeMenu);return r.jsx(be.Provider,{scope:e.__scopeMenu,children:r.jsx(Qe,{present:o||a.open,children:r.jsx(be.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(cr,{...i,ref:t}):r.jsx(lr,{...i,ref:t})})})})},"MenuContent")),cr=m.forwardRef(S(function(e,t){const s=ie(J,e.__scopeMenu),o=m.useRef(null),i=Q(t,o);return m.useEffect(()=>{const a=o.current;if(a)return nn(a)},[]),r.jsx(xt,{...e,ref:i,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:N(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentModal")),lr=m.forwardRef(S(function(e,t){const s=ie(J,e.__scopeMenu);return r.jsx(xt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentNonModal")),ur=mn("MenuContent.ScrollLock"),xt=m.forwardRef(S(function(e,t){const{__scopeMenu:s,loop:o=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:d,onEntryFocus:u,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:p,onDismiss:v,disableOutsideScroll:x,...b}=e,M=ie(J,s),y=Pe(J,s),C=Re(s),O=ft(s),E=Jn(s),[k,B]=m.useState(null),R=m.useRef(null),j=Q(t,R,M.onContentChange),T=m.useRef(0),D=m.useRef(""),U=m.useRef(0),w=m.useRef(null),K=m.useRef("right"),G=m.useRef(0),F=x?sn:m.Fragment,W=x?{as:ur,allowPinchZoom:!0}:void 0,I=S(g=>{var ee,_e;const A=D.current+g,z=E().filter(Y=>!Y.disabled),q=document.activeElement,he=(ee=z.find(Y=>Y.ref.current===q))==null?void 0:ee.textValue,xe=z.map(Y=>Y.textValue),Ae=yt(xe,A,he),oe=(_e=z.find(Y=>Y.textValue===Ae))==null?void 0:_e.ref.current;S((function Y(Oe){D.current=Oe,window.clearTimeout(T.current),Oe!==""&&(T.current=window.setTimeout(()=>Y(""),1e3))}),"updateSearch")(A),oe&&setTimeout(()=>oe.focus())},"handleTypeaheadSearch");m.useEffect(()=>()=>window.clearTimeout(T.current),[]),rn();const X=m.useCallback(g=>{var z,q;return K.current===((z=w.current)==null?void 0:z.side)&&jt(g,(q=w.current)==null?void 0:q.area)},[]);return r.jsx(ar,{scope:s,searchRef:D,onItemEnter:m.useCallback(g=>{X(g)&&g.preventDefault()},[X]),onItemLeave:m.useCallback(g=>{var A;X(g)||((A=R.current)==null||A.focus(),B(null))},[X]),onTriggerLeave:m.useCallback(g=>{X(g)&&g.preventDefault()},[X]),pointerGraceTimerRef:U,onPointerGraceIntentChange:m.useCallback(g=>{w.current=g},[]),children:r.jsx(F,{...W,children:r.jsx(on,{asChild:!0,trapped:i,onMountAutoFocus:N(a,g=>{var A;g.preventDefault(),(A=R.current)==null||A.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(an,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:p,onDismiss:v,children:r.jsx(cn,{asChild:!0,...O,dir:y.dir,orientation:"vertical",loop:o,currentTabStopId:k,onCurrentTabStopIdChange:B,onEntryFocus:N(u,g=>{y.isUsingKeyboardRef.current||g.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(ln,{role:"menu","aria-orientation":"vertical","data-state":gt(M.open),"data-radix-menu-content":"",dir:y.dir,...C,...b,ref:j,style:{outline:"none",...b.style},onKeyDown:N(b.onKeyDown,g=>{const z=g.target.closest("[data-radix-menu-content]")===g.currentTarget,q=g.ctrlKey||g.altKey||g.metaKey,he=g.key.length===1;z&&(g.key==="Tab"&&g.preventDefault(),!q&&he&&I(g.key));const xe=R.current;if(g.target!==xe||!qn.includes(g.key))return;g.preventDefault();const oe=E().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);dt.includes(g.key)&&oe.reverse(),bt(oe)}),onBlur:N(e.onBlur,g=>{g.currentTarget.contains(g.target)||(window.clearTimeout(T.current),D.current="")}),onPointerMove:N(e.onPointerMove,de(g=>{const A=g.target,z=G.current!==g.clientX;if(g.currentTarget.contains(A)&&z){const q=g.clientX>G.current?"right":"left";K.current=q,G.current=g.clientX}}))})})})})})})},"MenuContentImpl")),we="MenuItem",He="menu.itemSelect",dr=m.forwardRef(S(function(e,t){const{disabled:s=!1,onSelect:o,...i}=e,a=m.useRef(null),l=Pe(we,e.__scopeMenu),d=ht(we,e.__scopeMenu),u=Q(t,a),c=m.useRef(!1),f=S(()=>{const h=a.current;if(!s&&h){const p=new CustomEvent(He,{bubbles:!0,cancelable:!0});h.addEventListener(He,v=>o==null?void 0:o(v),{once:!0}),un(h,p),p.defaultPrevented?c.current=!1:l.onClose()}},"handleSelect");return r.jsx(mr,{...i,ref:u,disabled:s,onClick:N(e.onClick,f),onPointerDown:h=>{var p;(p=e.onPointerDown)==null||p.call(e,h),c.current=!0},onPointerUp:N(e.onPointerUp,h=>{var p;c.current||(p=h.currentTarget)==null||p.click()}),onKeyDown:N(e.onKeyDown,h=>{s||h.target!==h.currentTarget||d.searchRef.current!==""&&h.key===" "||Xn.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),mr=m.forwardRef(S(function(e,t){const{__scopeMenu:s,disabled:o=!1,textValue:i,...a}=e,l=ht(we,s),d=ft(s),u=m.useRef(null),c=Q(t,u),[f,h]=m.useState(!1),[p,v]=m.useState("");return m.useEffect(()=>{const x=u.current;x&&v((x.textContent??"").trim())},[a.children]),r.jsx(be.ItemSlot,{scope:s,disabled:o,textValue:i??p,children:r.jsx(dn,{asChild:!0,...d,focusable:!o,children:r.jsx(Ie.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...a,ref:c,onPointerMove:N(e.onPointerMove,de(x=>{o?l.onItemLeave(x):(l.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:N(e.onPointerLeave,de(x=>l.onItemLeave(x))),onFocus:N(e.onFocus,()=>h(!0)),onBlur:N(e.onBlur,()=>h(!1))})})})},"MenuItemImpl")),fr="MenuRadioGroup",[Is,js]=Z(fr,{value:void 0,onValueChange:S(()=>{},"onValueChange")}),pr="MenuItemIndicator",[Ms,Ss]=Z(pr,{checked:!1}),hr=m.forwardRef(S(function(e,t){const{__scopeMenu:s,...o}=e;return r.jsx(Ie.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})},"MenuSeparator")),xr="MenuSub",[Cs,Ls]=Z(xr);function gt(n){return n?"open":"closed"}S(gt,"getOpenState");function vt(n){return n==="indeterminate"}S(vt,"isIndeterminate");function gr(n){return vt(n)?"indeterminate":n?"checked":"unchecked"}S(gr,"getCheckedState");function bt(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}S(bt,"focusFirst");function wt(n,e){return n.map((t,s)=>n[(e+s)%n.length])}S(wt,"wrapArray");function yt(n,e,t){const o=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let a=wt(n,Math.max(i,0));o.length===1&&(a=a.filter(u=>u!==t));const d=a.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return d!==t?d:void 0}S(yt,"getNextMatch");function It(n,e){const{x:t,y:s}=n;let o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i],d=e[a],u=l.x,c=l.y,f=d.x,h=d.y;c>s!=h>s&&t<(f-u)*(s-c)/(h-c)+u&&(o=!o)}return o}S(It,"isPointInPolygon");function jt(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return It(t,e)}S(jt,"isPointerInGraceArea");function de(n){return e=>e.pointerType==="mouse"?n(e):void 0}S(de,"whenMouse");var vr=tr,br=nr,wr=or,yr=ir,Ir=dr,jr=hr,Mr=Object.defineProperty,re=(n,e)=>Mr(n,"name",{value:e,configurable:!0}),Ee="DropdownMenu",[Sr,Mt]=Xe(Ee,[mt]),se=mt(),[Cr,St]=Sr(Ee),Ct=re(n=>{const{__scopeDropdownMenu:e,children:t,dir:s,open:o,defaultOpen:i,onOpenChange:a,modal:l=!0}=n,d=se(e),u=m.useRef(null),[c,f]=Ze({prop:o,defaultProp:i??!1,onChange:a,caller:Ee});return r.jsx(Cr,{scope:e,triggerId:ke(),triggerRef:u,contentId:ke(),open:c,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(h=>!h),[f]),modal:l,children:r.jsx(vr,{...d,open:c,onOpenChange:f,dir:s,modal:l,children:t})})},"DropdownMenu"),Lr="DropdownMenuTrigger",Lt=m.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,disabled:o=!1,...i}=e,a=St(Lr,s),l=se(s),d=Q(t,a.triggerRef);return r.jsx(br,{asChild:!0,...l,children:r.jsx(Ie.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...i,ref:d,onPointerDown:N(e.onPointerDown,u=>{!o&&u.button===0&&u.ctrlKey===!1&&(a.onOpenToggle(),a.open||u.preventDefault())}),onKeyDown:N(e.onKeyDown,u=>{o||(["Enter"," "].includes(u.key)&&a.onOpenToggle(),u.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})},"DropdownMenuTrigger")),Tt=re(n=>{const{__scopeDropdownMenu:e,...t}=n,s=se(e);return r.jsx(wr,{...s,...t})},"DropdownMenuPortal"),Tr="DropdownMenuContent",Nt=m.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=St(Tr,s),a=se(s),l=m.useRef(!1);return r.jsx(yr,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...o,ref:t,onCloseAutoFocus:N(e.onCloseAutoFocus,d=>{var u;l.current||(u=i.triggerRef.current)==null||u.focus(),l.current=!1,d.preventDefault()}),onInteractOutside:N(e.onInteractOutside,d=>{const u=d.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0,f=u.button===2||c;(!i.modal||f)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),Rt=m.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=se(s);return r.jsx(Ir,{...i,...o,ref:t})},"DropdownMenuItem")),Pt=m.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=se(s);return r.jsx(jr,{...i,...o,ref:t})},"DropdownMenuSeparator")),Et=Ct,Dt=Lt,Nr=Tt,At=Nt,_t=Rt,Ot=Pt;const Rr=Object.freeze(Object.defineProperty({__proto__:null,Content:At,DropdownMenu:Ct,DropdownMenuContent:Nt,DropdownMenuItem:Rt,DropdownMenuPortal:Tt,DropdownMenuSeparator:Pt,DropdownMenuTrigger:Lt,Item:_t,Portal:Nr,Root:Et,Separator:Ot,Trigger:Dt,createDropdownMenuScope:Mt},Symbol.toStringTag,{value:"Module"})),Pr=fe(Dt),Er=fe(At),Dr=fe(_t),Ar=fe(Ot),kt=m.forwardRef((n,e)=>{const t=_(15);let s,o,i;t[0]!==n?({onClick:o,disabled:s,...i}=n,t[0]=n,t[1]=s,t[2]=o,t[3]=i):(s=t[1],o=t[2],i=t[3]);const a=P(_r),{switchToNewThread:l}=Hn();let d;t[4]!==a?(d=a?{"data-active":"true","aria-current":"true"}:null,t[4]=a,t[5]=d):d=t[5];let u;t[6]!==o||t[7]!==l?(u=N(o,l),t[6]=o,t[7]=l,t[8]=u):u=t[8];let c;return t[9]!==s||t[10]!==e||t[11]!==i||t[12]!==d||t[13]!==u?(c=r.jsx(je.button,{type:"button",...d,...i,ref:e,disabled:s,onClick:u}),t[9]=s,t[10]=e,t[11]=i,t[12]=d,t[13]=u,t[14]=c):c=t[14],c});kt.displayName="ThreadListPrimitive.New";function _r(n){return n.threads.newThreadId===n.threads.mainThreadId}const Or=()=>{const{loadMore:n,disabled:e}=Un();return e?null:n},kr=ae("ThreadListPrimitive.LoadMore",Or),[Br,Fr]=Je("ThreadList"),ye=Br,Bt=Se(null),Kr=Bt.Provider,De=()=>Me(Bt),Ft=m.forwardRef((n,e)=>{const t=_(3);let s;return t[0]!==n||t[1]!==e?(s=r.jsx(ye.Provider,{scope:void 0,children:r.jsx(ye.Slot,{scope:void 0,children:r.jsx(je.div,{...n,ref:e})})}),t[0]=n,t[1]=e,t[2]=s):s=t[2],s});Ft.displayName="ThreadListPrimitive.Root";var $r=Ce({ItemByIndex:()=>ct,Items:()=>lt,LoadMore:()=>kr,New:()=>kt,Root:()=>Ft});const Kt=m.forwardRef((n,e)=>{const t=P(u=>u.threads.mainThreadId===u.threadListItem.id),s=Be(null),o=Be(null),i=We(()=>({triggerRef:s,moreRef:o}),[]),a=Fr(void 0),l=me(),d=u=>{const c=l==="rtl"?"ArrowLeft":"ArrowRight",f=l==="rtl"?"ArrowRight":"ArrowLeft",h=s.current,p=o.current;if(h&&u.target===h)if(u.key==="ArrowDown"||u.key==="ArrowUp"){const v=a().map(b=>b.ref.current).filter(b=>b!==null),x=v[v.indexOf(h)+(u.key==="ArrowDown"?1:-1)];x&&(x.focus(),u.preventDefault())}else u.key===c&&p&&(p.focus(),u.preventDefault());else p&&u.target===p&&u.key===f&&(h==null||h.focus(),u.preventDefault())};return r.jsx(Kr,{value:i,children:r.jsx(je.div,{...t?{"data-active":"true","aria-current":"true"}:null,...n,onKeyDown:N(n.onKeyDown,d),ref:e})})});Kt.displayName="ThreadListItemPrimitive.Root";const zr=()=>{const{archive:n}=Kn();return n},Gr=ae("ThreadListItemPrimitive.Archive",zr),Hr=()=>{const{unarchive:n}=zn();return n},Ur=ae("ThreadListItemPrimitive.Unarchive",Hr),Vr=()=>{const{delete:n}=$n();return n},Wr=ae("ThreadListItemPrimitive.Delete",Vr),Xr=()=>{const{switchTo:n}=Gn();return n},Yr=ae("ThreadListItemPrimitive.Trigger",Xr),$t=m.forwardRef((n,e)=>{var i;const t=_(3),s=Q(e,(i=De())==null?void 0:i.triggerRef);let o;return t[0]!==n||t[1]!==s?(o=r.jsx(ye.ItemSlot,{scope:void 0,children:r.jsx(Yr,{...n,ref:s})}),t[0]=n,t[1]=s,t[2]=o):o=t[2],o});$t.displayName="ThreadListItemPrimitive.Trigger";var zt=Ce({Archive:()=>Gr,Delete:()=>Wr,Root:()=>Kt,Title:()=>ut,Trigger:()=>$t,Unarchive:()=>Ur});const ce=Mt(),Gt=Se(()=>{}),Ht=()=>Me(Gt),Ut=Se(!1),Vt=()=>Me(Ut),Wt=n=>{const e=_(26);let t,s,o,i,a,l,d;e[0]!==n?({__scopeThreadListItemMore:t,open:a,defaultOpen:s,onOpenChange:i,sharedFocusGroup:d,modal:o,...l}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=o,e[4]=i,e[5]=a,e[6]=l,e[7]=d):(t=e[1],s=e[2],o=e[3],i=e[4],a=e[5],l=e[6],d=e[7]);const u=d===void 0?!1:d,c=u?!1:o??!0,f=ce(t),h=s??!1;let p;e[8]!==i?(p=i?{onChange:i}:{},e[8]=i,e[9]=p):p=e[9];let v;e[10]!==a||e[11]!==h||e[12]!==p?(v={prop:a,defaultProp:h,caller:"ThreadListItemMorePrimitive.Root",...p},e[10]=a,e[11]=h,e[12]=p,e[13]=v):v=e[13];const[x,b]=Ze(v);let M;e[14]!==c||e[15]!==x||e[16]!==l||e[17]!==f||e[18]!==b?(M=r.jsx(Et,{...f,...l,modal:c,open:x,onOpenChange:b}),e[14]=c,e[15]=x,e[16]=l,e[17]=f,e[18]=b,e[19]=M):M=e[19];let y;e[20]!==b||e[21]!==M?(y=r.jsx(Gt.Provider,{value:b,children:M}),e[20]=b,e[21]=M,e[22]=y):y=e[22];let C;return e[23]!==u||e[24]!==y?(C=r.jsx(Ut.Provider,{value:u,children:y}),e[23]=u,e[24]=y,e[25]=C):C=e[25],C};Wt.displayName="ThreadListItemMorePrimitive.Root";const Xt=m.forwardRef((n,e)=>{const t=_(10),{__scopeThreadListItemMore:s,...o}=n,i=ce(s),a=De(),l=Ht(),d=Vt(),u=Q(e,a==null?void 0:a.moreRef),c=me()==="rtl"?"ArrowLeft":"ArrowRight",f=Pr;let h;t[0]!==c||t[1]!==l||t[2]!==d?(h=x=>{!d||x.key!==c||(x.preventDefault(),l(!0))},t[0]=c,t[1]=l,t[2]=d,t[3]=h):h=t[3];const p=N(o.onKeyDown,h);let v;return t[4]!==f||t[5]!==u||t[6]!==o||t[7]!==i||t[8]!==p?(v=r.jsx(f,{...i,...o,onKeyDown:p,ref:u}),t[4]=f,t[5]=u,t[6]=o,t[7]=i,t[8]=p,t[9]=v):v=t[9],v});Xt.displayName="ThreadListItemMorePrimitive.Trigger";const Yt=m.forwardRef((n,e)=>{const t=_(21),{__scopeThreadListItemMore:s,portalProps:o,sideOffset:i,...a}=n,l=i===void 0?4:i,d=ce(s),u=Ht(),c=De(),f=Vt(),h=me()==="rtl"?"ArrowRight":"ArrowLeft",p=Rr,v=Er;let x;t[0]!==h||t[1]!==(c==null?void 0:c.moreRef)||t[2]!==u||t[3]!==f?(x=E=>{var k;!f||E.key!==h||(E.preventDefault(),u(!1),(k=c==null?void 0:c.moreRef.current)==null||k.focus())},t[0]=h,t[1]=c==null?void 0:c.moreRef,t[2]=u,t[3]=f,t[4]=x):x=t[4];const b=N(a.onKeyDown,x);let M;t[5]!==(c==null?void 0:c.moreRef)||t[6]!==f?(M=()=>{var E;f&&((E=c==null?void 0:c.moreRef.current)==null||E.focus())},t[5]=c==null?void 0:c.moreRef,t[6]=f,t[7]=M):M=t[7];const y=N(a.onEscapeKeyDown,M);let C;t[8]!==v||t[9]!==e||t[10]!==a||t[11]!==d||t[12]!==l||t[13]!==b||t[14]!==y?(C=r.jsx(v,{...d,...a,onKeyDown:b,onEscapeKeyDown:y,ref:e,sideOffset:l}),t[8]=v,t[9]=e,t[10]=a,t[11]=d,t[12]=l,t[13]=b,t[14]=y,t[15]=C):C=t[15];let O;return t[16]!==o||t[17]!==d||t[18]!==p.Portal||t[19]!==C?(O=r.jsx(p.Portal,{...d,...o,children:C}),t[16]=o,t[17]=d,t[18]=p.Portal,t[19]=C,t[20]=O):O=t[20],O});Yt.displayName="ThreadListItemMorePrimitive.Content";const qt=m.forwardRef((n,e)=>{const t=_(7);let s,o;t[0]!==n?({__scopeThreadListItemMore:s,...o}=n,t[0]=n,t[1]=s,t[2]=o):(s=t[1],o=t[2]);const i=ce(s);let a;return t[3]!==e||t[4]!==o||t[5]!==i?(a=r.jsx(Dr,{...i,...o,ref:e}),t[3]=e,t[4]=o,t[5]=i,t[6]=a):a=t[6],a});qt.displayName="ThreadListItemMorePrimitive.Item";const Jt=m.forwardRef((n,e)=>{const t=_(7);let s,o;t[0]!==n?({__scopeThreadListItemMore:s,...o}=n,t[0]=n,t[1]=s,t[2]=o):(s=t[1],o=t[2]);const i=ce(s);let a;return t[3]!==e||t[4]!==o||t[5]!==i?(a=r.jsx(Ar,{...i,...o,ref:e}),t[3]=e,t[4]=o,t[5]=i,t[6]=a):a=t[6],a});Jt.displayName="ThreadListItemMorePrimitive.Separator";var ve=Ce({Content:()=>Yt,Item:()=>qt,Root:()=>Wt,Separator:()=>Jt,Trigger:()=>Xt});function qr(){const n=ne(),e=et(),t=Le(),s=nt(),o=t||s,[i,a]=m.useState(!1),[l,d]=m.useState(""),[u,c]=m.useState(null),f=m.useRef(null),h=m.useRef(null),p=m.useId(),v=(n==null?void 0:n.isLibraryEnabled)===!0&&e!=null,x=(n==null?void 0:n.historyAgentFilter)??null;m.useEffect(()=>{i||d("")},[i]);const{agents:b,isInitialLoading:M,isSearching:y,loadingMore:C,hasMore:O,listRef:E,sentinelRef:k}=In({enabled:i&&v,query:l});if(m.useLayoutEffect(()=>{if(!i||o){c(null);return}const j=()=>{var D;const T=(D=f.current)==null?void 0:D.getBoundingClientRect();T&&c({top:T.top,left:T.right+4})};return j(),window.addEventListener("resize",j),window.addEventListener("scroll",j,!0),()=>{window.removeEventListener("resize",j),window.removeEventListener("scroll",j,!0)}},[i,o]),m.useEffect(()=>{if(!i||o)return;const j=T=>{var U,w;const D=T.target;(U=f.current)!=null&&U.contains(D)||(w=h.current)!=null&&w.contains(D)||a(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[i,o]),!v)return null;const B=j=>{(n==null?void 0:n.isComposerEnabled)===!0?n.openDraft():n==null||n.openLibraryHome(),n==null||n.setHistoryAgentFilter(j),a(!1)},R=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"p-1",onMouseDown:j=>j.stopPropagation(),children:[r.jsx(jn,{query:l,setQuery:d,placeholder:"Search agents"}),y?r.jsx("p",{className:"text-text-secondary px-1 pt-1 text-[11px]",role:"status",children:"Searching…"}):null]}),r.jsxs("div",{ref:E,className:$("mt-1 overflow-y-auto",o?"min-h-0 flex-1 px-1 pb-2":"min-h-48 max-h-64"),children:[l.trim()===""?r.jsxs(Ke,{className:$("justify-between",x==null&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>B(null),children:["All chats",x==null?r.jsx(H,{name:"check",className:"size-3.5 shrink-0"}):null]}):null,M?r.jsx("p",{className:"px-2 py-3 text-center text-xs text-text-secondary",children:"Loading…"}):b.length===0?r.jsx("p",{className:"text-text-secondary px-2 py-6 text-center text-xs",role:"status",children:l.trim()?`No agents match "${l.trim()}".`:"No agents yet."}):r.jsxs(r.Fragment,{children:[b.map(j=>{const T=Mn(j),D=(x==null?void 0:x.agentId)===T;return r.jsxs(Ke,{className:$("justify-between gap-2 text-left",D&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>B({agentId:T,agentName:j.name,intent:"history"}),children:[r.jsx("span",{className:"min-w-0 truncate",children:j.name}),D?r.jsx(H,{name:"check",className:"size-3.5 shrink-0"}):null]},T)}),O?r.jsx("div",{ref:k,className:"flex h-6 shrink-0 items-center justify-center","aria-hidden":!0,children:C?r.jsx("span",{className:"text-text-secondary text-[11px]",role:"status",children:"Loading more…"}):null}):null]})]})]});return r.jsxs("div",{className:"relative shrink-0",children:[r.jsxs("button",{ref:f,type:"button","aria-label":x!=null?`Filter chat history by agent (${x.agentName})`:"Filter chat history by agent","aria-haspopup":o?"dialog":"menu","aria-expanded":i,"aria-controls":i?p:void 0,title:"Filter by agent",className:te({variant:"ghost",size:"icon",className:$("relative size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text",x!=null&&"text-text-primary")}),onClick:()=>a(j=>!j),children:[r.jsx(H,{name:"funnel",className:"size-3.5"}),x!=null?r.jsx("span",{className:"bg-primary-button-bg absolute top-1 right-1 size-1.5 rounded-full","aria-hidden":!0,"data-testid":"history-filter-active-dot"}):null]}),o&&i?r.jsx(rt,{open:!0,onOpenChange:a,id:p,"aria-label":"Filter agents",children:r.jsx("div",{className:"flex min-h-0 flex-1 flex-col p-2",role:"menu",children:R})}):null,!o&&i&&u!=null?Sn.createPortal(r.jsx("div",{ref:h,id:p,role:"menu","aria-label":"Filter agents",style:{top:u.top,left:u.left},className:"aui-popup-enter font-sans-flex fixed z-50 w-56 rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md",children:R}),Cn(f.current)):null]})}function Jr({open:n,initialTitle:e,saving:t=!1,onOpenChange:s,onSave:o}){const[i,a]=m.useState(e),l=m.useRef(null);m.useEffect(()=>{n&&a(e)},[n,e]),m.useEffect(()=>{if(!n)return;const p=l.current;p!=null&&(p.focus(),p.select())},[n]);const d=i.trim(),c=d.length>0&&d.length<=$e&&!t,f=()=>{c&&o(d)},h=p=>{t||s(p)};return r.jsx(Ln,{open:n,onOpenChange:h,title:"Rename session",contentSized:!0,"aria-label":"Rename session",footer:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ze.Secondary,{type:"button",disabled:t,onClick:()=>h(!1),children:"Cancel"}),r.jsx(ze.Primary,{type:"button",disabled:!c,onClick:f,children:"Save"})]}),children:r.jsx("div",{className:"px-5 py-4",children:r.jsx("input",{ref:l,"aria-label":"Session title",value:i,readOnly:t,maxLength:$e,className:Tn("h-9"),onChange:p=>a(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),f())}})})})}var Qr="flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium outline-none transition-colors hover:bg-ghost-button-hover focus:bg-ghost-button-hover data-[highlighted]:bg-ghost-button-hover",Zr="flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-failure-bg outline-none transition-colors hover:bg-failure-bg/12 hover:text-failure-bg focus:bg-failure-bg/12 focus:text-failure-bg data-[highlighted]:bg-failure-bg/12 data-[highlighted]:text-failure-bg";function es({canRename:n,renameDisabled:e,canDelete:t,deleteDisabled:s,onRename:o,onDelete:i}){const a=L("PermissionGuard"),l=nt(),d=Le(),[u,c]=m.useState(!1),[f,h]=m.useState(),p=d||l,v=m.useCallback(y=>{const C=y==null?void 0:y.closest(".aui-theme-root");h(C instanceof HTMLElement?C:void 0)},[]),x=te({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-text-secondary hover:bg-transparent hover:text-text-primary"}),b=n?r.jsx(a,{allowed:!e,children:r.jsxs("button",{type:"button",className:Qr,disabled:e,onClick:()=>{e||(c(!1),o())},children:[r.jsx(H,{name:"pencil",className:"size-3.5"}),"Rename"]})}):null,M=t?r.jsx(a,{allowed:!s,children:r.jsxs(zt.Delete,{className:Zr,onClick:()=>{s||(c(!1),i())},children:[r.jsx(H,{name:"trash",className:"size-3.5"}),"Delete"]})}):null;return p?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Session actions",title:"Session actions","aria-haspopup":"dialog","aria-expanded":u,className:x,onClick:()=>c(!0),children:r.jsx(H,{name:"ellipsis",className:"size-3.5"})}),u?r.jsx(rt,{open:!0,onOpenChange:c,"aria-label":"Session actions",children:r.jsxs("div",{className:"flex flex-col gap-1 p-2 *:w-full",role:"menu",children:[b,M]})}):null]}):r.jsxs(ve.Root,{sharedFocusGroup:!0,children:[r.jsx(ve.Trigger,{ref:v,"aria-label":"Session actions",title:"Session actions",className:x,children:r.jsx(H,{name:"ellipsis",className:"size-3.5"})}),r.jsxs(ve.Content,{portalProps:{container:f},align:"end",sideOffset:4,className:"aui-popup-enter font-sans-flex z-50 min-w-32 rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md *:w-full",children:[b,M]})]})}function ts({onThreadOpen:n,canRenameSession:e,canDeleteSession:t,canManageResource:s,canDeleteResource:o}){const i=V(),a=ne(),l=tt(),d=bn(),u=L("ThreadListRow"),c=P(w=>w.threadListItem.id),f=P(w=>w.threadListItem.remoteId),h=P(w=>w.threadListItem.title),p=P(w=>w.threadListItem.lastMessageAt),v=P(w=>w.threadListItem.custom),x=P(w=>w.threads.mainThreadId),b=wn(v),M=e&&f!=null,y=t&&f!=null,C=M||y,O=f!=null&&!s(f),E=f!=null&&!o(f),k=(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,[B,R]=m.useState(!1),[j,T]=m.useState(!1),D=h??"New Chat",U=async w=>{if(w===(h??"").trim()){R(!1);return}T(!0);try{await i.threadListItem().rename(w),l(le.Session.RENAMED,ue(void 0,{sessionId:f,agentName:b})),R(!1)}catch(K){d==null||d.showError(K)}finally{T(!1)}};return r.jsxs(zt.Root,{className:"min-w-0",children:[r.jsx(u,{title:D,active:c===x&&!k,agentName:b,lastMessageAt:p,onSelect:()=>{l(le.Session.SELECTED,ue({is_mutable:Fe(v)},{sessionId:f,agentName:b})),n==null||n(),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);const w=Fe(v),K=!w&&(a==null?void 0:a.mode.status)==="active"&&!a.mode.isMutable&&(b==null?a.mode.agentName==null&&a.mode.agentId==null:a.mode.agentName===b||a.mode.agentId===b),G=yn({sessionMutable:w,shellMutable:(a==null?void 0:a.mode.status)==="active"&&a.mode.isMutable,...(a==null?void 0:a.mode.status)==="active"&&a.mode.isMutable?{shellAgentName:a.mode.agentName,shellAgentId:a.mode.agentId}:{},remoteId:f,pendingSessionId:a==null?void 0:a.pendingSessionId});if((K||G)&&f!=null){Promise.resolve(i.threads().switchToThread(c)).catch(()=>{});return}if(f!=null){a==null||a.openHistorySession({sessionId:f,isMutable:w,...b!=null?{agentName:b}:{}});return}Promise.resolve(i.threads().switchToThread(c)).catch(()=>{})},actions:C?r.jsx(es,{canRename:M,renameDisabled:O,canDelete:y,deleteDisabled:E,onRename:()=>R(!0),onDelete:()=>{l(le.Session.DELETED,ue(void 0,{sessionId:f,agentName:b}))}}):void 0}),r.jsx(Jr,{open:B,initialTitle:h??"",saving:j,onOpenChange:R,onSave:w=>{U(w)}})]})}function ns(n){const e=P(s=>s.threads.threadIds),t=P(s=>s.threads.threadItems);return m.useMemo(()=>{const s=vn({threadIds:e,threadItems:t});if(n==="default")return s;const o=new Map;for(const i of t)o.set(i.id,i),i.remoteId!=null&&o.set(i.remoteId,i);return s.filter(i=>{const a=e[i];if(a===void 0)return!1;const l=o.get(a);return(l==null?void 0:l.remoteId)!=null})},[e,t,n])}function rs(n){return n==="recent-history"||n==="mobile-drawer"}function ss({indices:n,onThreadOpen:e,canRenameSession:t,canDeleteSession:s,canManageResource:o,canDeleteResource:i}){const a=P(l=>l.threads.threadIds);return r.jsx(r.Fragment,{children:n.map(l=>{const d=a[l]??String(l);return r.jsx(Ne,{index:l,archived:!1,children:r.jsx(ts,{onThreadOpen:e,canRenameSession:t,canDeleteSession:s,canManageResource:o,canDeleteResource:i})},d)})})}var os="aui_thread-list-viewport",as=80;function is({children:n,viewportRef:e,hideScrollbar:t}){var d;const s=ne(),o=P(u=>u.threadListItem.remoteId),i=(d=s==null?void 0:s.historyAgentFilter)==null?void 0:d.intent,a=(s==null?void 0:s.isLibraryEnabled)===!0&&i!=="try-agent"&&(i==="history"||s.mode.status!=="active"||s.mode.isMutable||s.pendingSessionId!=null||o!=null),l=(s==null?void 0:s.historyAgentFilter)==null?"Chat History":`Chats for ${s.historyAgentFilter.agentName}`;return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-1 py-1",children:[r.jsx("h2",{className:"min-w-0 flex-1 truncate px-1.5 py-1 text-sm font-medium text-text-secondary",children:l}),a?r.jsx(qr,{}):null]}),r.jsx("div",{ref:e,"data-slot":os,className:$("flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",t&&"aui-scrollbar-hidden"),children:n})]})}function Qt({onThreadOpen:n,variant:e="default"}={}){const t=V(),s=et(),o=tt(),i=P(I=>I.threads.isLoading),a=P(I=>I.threads.isLoadingMore),l=P(I=>I.threads.hasMore),d=P(I=>I.threads.threadIds),u=P(I=>I.threads.threadItems),c=ne(),f=L("ThreadListShell"),h=L("ThreadListNewButton"),p=L("AgentsLibraryButton"),v=L("SessionsBrowserButton"),x=L("SchedulesButton"),b=L("EnvironmentsButton"),M=L("ThreadListRowSkeleton"),y=L("ThreadListEmptyState"),C=ns(e),O=m.useRef(null),E=m.useRef(l),k=m.useRef(t);E.current=l,k.current=t;const B=(c==null?void 0:c.isNewChatEnabled)!==!1,R=(c==null?void 0:c.mode.status)==="idle",j=rs(e),T=e==="mobile-drawer",D=typeof(s==null?void 0:s.renameSession)=="function",U=typeof(s==null?void 0:s.deleteSession)=="function",w=m.useMemo(()=>u.flatMap(I=>I.remoteId==null?[]:[I.remoteId]),[u]),{allows:K}=gn({resourceType:"session",resourceIds:w});m.useEffect(()=>{if(R||i||a)return;const I=O.current;if(!I)return;let X=!1;const g=()=>{if(X||!E.current||I.clientHeight<=0)return;const z=I.scrollHeight-I.scrollTop-I.clientHeight;I.scrollHeight>I.clientHeight&&z>as||k.current.threads().loadMore()};I.addEventListener("scroll",g,{passive:!0});const A=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>g());return A?A.observe(I):window.addEventListener("resize",g),g(),()=>{X=!0,I.removeEventListener("scroll",g),A==null||A.disconnect(),A||window.removeEventListener("resize",g)}},[l,R,i,a,d.length]);const G=()=>{if(o(le.Session.NEW,ue({is_composer_enabled:(c==null?void 0:c.isComposerEnabled)===!0},{...(c==null?void 0:c.mode.status)==="active"?{agentId:c.mode.agentId,agentName:c.mode.agentName}:{}})),n==null||n(),c==null||c.setLibraryOpen(!1),c==null||c.setSessionsOpen(!1),c!=null&&c.isComposerEnabled){c.openDraft();return}c==null||c.setSettingsOpen(!1),c==null||c.setSchedulesOpen(!1),c==null||c.setEnvironmentsOpen(!1),Promise.resolve(t.threads().switchToNewThread()).catch(()=>{})};let F;R?F=r.jsx(y,{message:j?"No recent chats":void 0}):i?F=r.jsx(M,{}):C.length===0?F=r.jsx(y,{message:j?"No recent chats":void 0}):F=r.jsx($r.Root,{className:"flex min-h-0 flex-col gap-0.5",children:r.jsx(ss,{indices:C,onThreadOpen:n,canRenameSession:D,canDeleteSession:U,canManageResource:I=>K(I,"MANAGE"),canDeleteResource:I=>K(I,"DELETE")})});const W=e==="recent-history"?null:r.jsxs("div",{className:"flex flex-col gap-1",children:[B?r.jsx(h,{onClick:G}):null,r.jsx("div",{className:"contents",onClick:()=>{T&&(n==null||n())},children:r.jsx(p,{})}),T?null:r.jsxs(r.Fragment,{children:[r.jsx(v,{}),r.jsx(x,{}),r.jsx(b,{})]})]});return r.jsx(f,{header:W,children:r.jsxs(is,{viewportRef:O,hideScrollbar:j,children:[F,!R&&l?r.jsx("div",{className:"h-4 shrink-0","aria-hidden":!0}):null]})})}var cs=m.lazy(()=>Te(()=>import("./SettingsBuilder-CVPLV5HY-D0lac3y-.js"),__vite__mapDeps([0,1,2]),import.meta.url)),ls=m.lazy(()=>Te(()=>import("./SchedulesPage-HLHAOIS6-BcDOMjiM.js"),__vite__mapDeps([3,4,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),us=m.lazy(()=>Te(()=>import("./EnvironmentsPage-OXKHJMOO-C-t7Dp_i.js"),__vite__mapDeps([5,4,1,2]),import.meta.url).then(n=>({default:n.EnvironmentsPage}))),ds="h-5 w-5 max-w-40 shrink-0 object-contain",ms="h-5 max-w-40 shrink-0 object-contain",fs="w-20",ps="w-80",Ue=$(_n,"text-sidebar-text"),Ve="bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";function hs({overlayOpen:n,mode:e}){return!n&&(e==null?void 0:e.status)==="active"&&!e.isCreateAgent}function xs(){return Dn().presentation==="full"?null:r.jsx("aside",{"aria-label":"Recent chats",className:"hidden min-h-0 w-64 shrink-0 border-r border-border bg-sidebar-bg md:flex",children:r.jsx(Qt,{variant:"recent-history"})})}function gs(){var p;const n=V(),e=ne(),t=L("AgentsLibraryButton"),s=L("SessionsBrowserButton"),o=L("SchedulesButton"),i=L("EnvironmentsButton"),a=(e==null?void 0:e.isNewChatEnabled)!==!1,l=(e==null?void 0:e.settingsOpen)===!0||(e==null?void 0:e.libraryOpen)===!0||(e==null?void 0:e.sessionsOpen)===!0||(e==null?void 0:e.schedulesOpen)===!0||(e==null?void 0:e.environmentsOpen)===!0,d=e==null?void 0:e.mode,u=!l&&(d==null?void 0:d.status)==="active"&&!d.isCreateAgent&&((p=e==null?void 0:e.historyAgentFilter)==null?void 0:p.intent)!=="try-agent",c=!l&&d!=null&&st(d),f=()=>{if(e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled){e.openDraft();return}e==null||e.setSettingsOpen(!1),e==null||e.setSchedulesOpen(!1),e==null||e.setEnvironmentsOpen(!1),Promise.resolve(n.threads().switchToNewThread()).catch(()=>{})},h=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return r.jsxs("nav",{className:"flex min-h-0 flex-1 flex-col items-center gap-1 p-1","aria-label":"Sidebar",children:[a?r.jsxs("button",{type:"button","aria-label":"Start new chat",title:"New chat","aria-current":u?"page":void 0,className:te({variant:"ghost",className:$(Ue,u&&Ve)}),onClick:f,children:[r.jsx(H,{name:"square-pen",size:14}),r.jsx("span",{className:"text-center",children:"New Chat"})]}):null,a&&(e!=null&&e.isComposerEnabled)?r.jsxs("button",{type:"button","aria-label":"Start new agent",title:"New Agent","aria-current":c?"page":void 0,className:te({variant:"ghost",className:$(Ue,c&&Ve)}),onClick:h,children:[r.jsx(H,{name:"agent-2",size:14}),r.jsx("span",{className:"text-center whitespace-nowrap",children:"Build Agent"})]}):null,r.jsx(t,{compact:!0}),r.jsx(s,{compact:!0}),r.jsx(o,{compact:!0}),r.jsx(i,{compact:!0})]})}function vs({className:n,railRef:e,...t}){const s=ot(),o=at(s),i=L("BrandLogo"),a=L("UserAvatar");return r.jsxs("aside",{ref:e,className:$(fs,"flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar-bg",n),...t,children:[r.jsx("div",{className:"flex h-14 w-full shrink-0 items-center justify-center text-text-primary",children:r.jsx(i,{variant:o.collapsedVariant,className:ds})}),r.jsx(gs,{}),r.jsxs("footer",{className:"flex shrink-0 flex-col items-center border-border p-2",children:[r.jsx(it,{labeled:!0,className:"flex-col"}),r.jsx(a,{labeled:!0,className:"mt-2 py-1.5"})]})]})}function bs({drawerRef:n,onClose:e}){const t=ot(),s=at(t),o=An(),i=L("BrandLogo"),a=L("UserAvatar");return r.jsxs("aside",{ref:n,role:"dialog","aria-label":"Navigation",tabIndex:-1,className:$(ps,"absolute inset-y-0 left-0 z-10 flex min-h-0 flex-col border-r border-border bg-sidebar-bg shadow-lg outline-none md:hidden"),children:[r.jsxs("div",{className:"flex h-14 w-full shrink-0 items-center gap-2 border-b border-border px-3 text-text-primary",children:[r.jsx(i,{variant:s.expandedVariant,className:ms}),s.showTitle&&o!=null?r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:o}):r.jsx("span",{className:"min-w-0 flex-1"}),r.jsx("button",{type:"button","aria-label":"Close navigation",className:te({variant:"ghost",size:"icon"}),onClick:e,children:r.jsx(H,{name:"xmark"})})]}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Qt,{variant:"mobile-drawer",onThreadOpen:e})}),r.jsxs("footer",{className:"flex shrink-0 items-center justify-around gap-1 border-t border-border p-2 text-sidebar-text",children:[r.jsx(it,{labeled:!0,onAction:e,className:"contents"}),r.jsx(a,{labeled:!0})]})]})}function Ts({className:n}){const e=ne(),t=Le(),s=L("AgentDetailsPage"),o=L("AgentsLibrary"),i=L("SessionsPage"),a=L("ShareChatButton"),l=L("ClearChatButton"),d=L("SaveAgentButton"),u=L("SelectAgentEmptyState"),[c,f]=m.useState(!1),h=m.useRef(null),p=m.useRef(null),v=m.useRef(null),x=m.useRef(!1),b=(e==null?void 0:e.mode.status)==="idle",M=(e==null?void 0:e.settingsOpen)===!0,y=(e==null?void 0:e.libraryOpen)===!0,C=y&&(e==null?void 0:e.libraryAgentId)==null,O=(e==null?void 0:e.sessionsOpen)===!0,E=(e==null?void 0:e.schedulesOpen)===!0,k=(e==null?void 0:e.environmentsOpen)===!0,B=M||y||O||E||k,R=e!=null&&st(e.mode),j=t&&(O||E||k||R&&!M&&!y),T=R&&!B&&!t,D=hs({overlayOpen:B,mode:e==null?void 0:e.mode}),U=Nn(),w=t&&(M||C),K=()=>f(!1),G=r.jsx("button",{ref:h,type:"button","aria-label":"Navigation","aria-expanded":c,className:$(te({variant:"ghost",size:"icon"}),"md:hidden"),onClick:()=>f(!0),children:r.jsx(H,{name:"panel-left"})});return m.useEffect(()=>{if(!c)return;const F=W=>{W.key==="Escape"&&(W.stopImmediatePropagation(),f(!1))};return window.addEventListener("keydown",F,!0),()=>window.removeEventListener("keydown",F,!0)},[c]),m.useEffect(()=>{var W,I;const F=v.current;if(c){x.current=!0,F&&(F.inert=!0),(W=p.current)==null||W.focus();return}x.current&&(F&&(F.inert=!1),(I=h.current)==null||I.focus(),x.current=!1)},[c]),r.jsxs("div",{className:$("relative flex h-full min-h-0 w-full min-w-0",n),children:[r.jsx(vs,{className:"hidden md:flex"}),T?r.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:max-w-140 md:flex-1 md:shadow-none 2xl:max-w-150",children:r.jsx(On,{})}):null,r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-primary-bg",children:[w?null:r.jsx(Rn,{className:$("bg-topbar-bg",(B||b||!U||j)&&"md:hidden"),start:G,title:!B&&!j?r.jsx(kn,{}):null,end:!B&&!j?r.jsxs(r.Fragment,{children:[r.jsx(a,{}),r.jsx(l,{}),r.jsx(d,{})]}):null}),r.jsx(Pn,{children:r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[D?r.jsx(xs,{}):null,r.jsx("div",{ref:v,className:"min-h-0 min-w-0 flex-1",children:M?r.jsx(m.Suspense,{fallback:r.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[r.jsx(ge,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(cs,{...w?{headerStart:G}:{}})}):j?r.jsx(En,{}):O?r.jsx(i,{}):y&&(e==null?void 0:e.libraryAgentId)!=null?r.jsx(s,{agentId:e.libraryAgentId},e.libraryAgentId):y?r.jsx(o,{onSelectAgent:K,...w?{headerStart:G}:{}}):E?r.jsx(m.Suspense,{fallback:r.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[r.jsx(ge,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(ls,{})}):k?r.jsx(m.Suspense,{fallback:r.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[r.jsx(ge,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(us,{})}):b?r.jsx(u,{}):r.jsx(Bn,{})})]})})]}),c?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Close navigation backdrop",className:"absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden",onClick:K}),r.jsx(bs,{drawerRef:p,onClose:K})]}):null]})}export{Ts as SidebarLayout};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as W}from"./chunk-GSAVSNGR-BJhfT2HB.js";import{b5 as J,t as V,U as X,r as l,W as q,j as e,$ as Y,a2 as L,I as U,b7 as Z,as as y,al as _}from"./index-BJsGMvc-.js";var ee=({open:s,onOpenChange:c,onImport:d,busy:p=!1,error:S})=>{const[i,N]=l.useState(""),[m,C]=l.useState(""),[n,j]=l.useState(""),[u,x]=l.useState(""),[b,h]=l.useState(""),o=()=>{N(""),C(""),j(""),x(""),h("")},v=()=>{o(),c(!1)},f=async a=>{if(a.preventDefault(),!(!i.trim()||!m.trim()||!n.trim()||!u.trim()||!b.trim()||p))try{await d({name:i.trim(),description:m.trim(),repoURL:n.trim(),path:u.trim(),ref:b.trim()}),v()}catch{}},E=!!(i.trim()&&m.trim()&&n.trim()&&u.trim()&&b.trim())&&!p;return e.jsx(Z,{open:s,onOpenChange:a=>{a||v()},title:"Import from GitHub",description:"Import a skill from a SKILL.md file in a GitHub repository.",headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary",children:e.jsx(U,{name:"github",className:"size-5"})}),contentSized:!0,className:"md:max-w-2xl",children:e.jsx("form",{onSubmit:a=>void f(a),children:e.jsxs("div",{className:"space-y-5 px-5 py-5 md:px-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-name",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Name"}),e.jsx("input",{id:"skill-name",value:i,onChange:a=>{N(a.target.value)},placeholder:"release-notes",autoFocus:!0,required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-description",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Description"}),e.jsx("textarea",{id:"skill-description",value:m,onChange:a=>{C(a.target.value)},placeholder:"Generate release notes from merged pull requests",required:!0,rows:3,className:y("resize-y py-2.5")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-repo-url",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Repository URL"}),e.jsx("input",{id:"skill-repo-url",type:"url",value:n,onChange:a=>{j(a.target.value)},placeholder:"https://github.com/org/repo",required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-path",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Folder containing the SKILL.md"}),e.jsx("input",{id:"skill-path",value:u,onChange:a=>{x(a.target.value)},placeholder:"skills/release-notes",required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-ref",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Branch"}),e.jsx("input",{id:"skill-ref",value:b,onChange:a=>{h(a.target.value)},placeholder:"main",required:!0,className:y("h-11")})]}),e.jsxs("div",{className:"space-y-3",children:[S?e.jsx("p",{className:"text-failure-bg text-sm",children:S}):null,e.jsx(L.Primary,{type:"submit",disabled:!E,className:"w-full",children:"Import"})]})]})})})},te=ee,B=(s,c,d)=>!s||c.toLowerCase().includes(s)||d.toLowerCase().includes(s),se=s=>"catalogId"in s;function le(s){return typeof s=="object"&&s!==null&&Reflect.get(s,"statusCode")===424}var ae=()=>{const{skillCatalog:s}=J(),c=V(),d=X(),[p,S]=l.useState(""),[i,N]=l.useState([]),[m,C]=l.useState([]),[n,j]=l.useState(!0),[u,x]=l.useState(null),[b,h]=l.useState(null),[o,v]=l.useState(!1),[f,E]=l.useState(!1),[a,G]=l.useState(!1),[D,F]=l.useState(null),[P,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)&&E(!0),r(q(g,"Request failed")),g}finally{v(!1)}};if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Skills catalog is not available."});const T=t=>{z(async()=>{await s.createSkill({catalogId:t.id,name:t.name,description:t.description,repoURL:t.repoURL,path:t.path,ref:t.ref}),d(_.Settings.SKILL_IMPORTED,{skill_name:t.name})}).catch(()=>{})},$=()=>{o||(F(null),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)},O=({key:t,name:r,description:g,action:Q})=>e.jsxs("article",{className:"flex min-h-16 items-center gap-3 border-b border-border p-3 last:border-b-0",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(U,{name:"lightbulb",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:r}),g?e.jsx("p",{className:"mt-0.5 truncate text-sm text-text-secondary",children:g}):null]}),Q]},t),A=w.length>0||R.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Skills"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Use built-in skills or import custom skills from GitHub."}),u?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:u}):null,e.jsxs("div",{className:"mt-4 flex min-h-0 flex-1 flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Y,{query:p,setQuery:S,placeholder:"Search skills"})}),e.jsxs(L.Secondary,{type:"button",className:"shrink-0",disabled:o||f,onClick:()=>{h(null),G(!0)},children:[e.jsx(U,{name:"github",className:"size-4"}),"Import from GitHub"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[n?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!n&&w.length>0?e.jsxs("section",{"aria-labelledby":"enabled-skills-heading",children:[e.jsxs("h4",{id:"enabled-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Enabled · ",w.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:w.map(t=>O({key:t.id,name:t.name,description:t.description,action:s.deleteSkill?e.jsx(L.Secondary,{size:"small",type:"button",disabled:o||f,"aria-label":`Remove ${t.name}`,onClick:()=>{I(null),F(t)},children:"Remove"}):null}))})]}):null,!n&&R.length>0?e.jsxs("section",{"aria-labelledby":"available-skills-heading",children:[e.jsxs("h4",{id:"available-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Available · ",R.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:R.map(t=>O({key:t.id,name:t.name,description:t.description,action:e.jsx(L.Secondary,{size:"small",type:"button",disabled:o||f,"aria-label":`Enable ${t.name}`,onClick:()=>{T(t)},children:"Enable"})}))})]}):null,!n&&!A?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:k?`No skills match “${p.trim()}”.`:"No skills yet."}):null]})]}),D?e.jsx(W,{title:"Remove skill?",description:`“${D.name}” will no longer be available to your agents.`,busy:o,error:P,onCancel:$,onConfirm:()=>{K(D)}}):null,e.jsx(te,{open:a,onOpenChange:t=>{G(t),t||h(null)},onImport:H,busy:o||f,error:b})]})},ne=ae;export{ne as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function n({error:o,onError:r,showError:c}){const s=r??c;s==null||s(o)}export{n as r};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as d,bd as ue,b as z,d as v,be as M,bf as de,bg as me,bh as fe,bi as he,bj as U,bk as K,k as te,u as ne,bl as _,bm as ge,bn as pe,bo as xe,bp as be,bq as ve,b3 as Ce,c as Se,t as je,br as we,bs as G,bt as se,bu as oe,bv as ye,l as re,U as J,bw as W,al as T,bx as X,am as ke,by as Ie,bz as Ae,bA as Me,bB as Re,bC as P,a2 as $,bD as Ne,bE as Ee,bF as Te,bG as Pe,bb as De,ar as ae,bH as Le,bI as ie,bJ as Oe,bK as _e,bL as B,bM as Fe,bN as Ue,bO as Be,bP as He,i as Ve,V as ze,p as le,s as We,bQ as qe,bR as Qe,bS as Ke,bT as Ge,I as V,f as q,g as O,bU as Q,bV as Je,O as Ye,bW as Xe}from"./index-BJsGMvc-.js";function $e(){var p;const{pending:s}=se(),t=Le(),[n,a]=d.useState({approvalId:null,index:0}),r=d.useRef(null),c=s.length,u=n.approvalId==null?-1:s.findIndex(f=>f.approvalId===n.approvalId),i=u>=0?u:c===0?0:Math.min(n.index,c-1),o=(p=s[i])==null?void 0:p.approvalId;d.useEffect(()=>{const f=o??null;n.approvalId===f&&n.index===i||a({approvalId:f,index:i})},[o,i,n.approvalId,n.index]),d.useEffect(()=>{if(o==null||t==null){o==null&&(r.current=null);return}r.current!==o&&(r.current=o,t.focus(o))},[o,t]);const l=d.useCallback(()=>{var C;const f=Math.max(0,i-1);a({approvalId:((C=s[f])==null?void 0:C.approvalId)??null,index:f})},[s,i]),m=d.useCallback(()=>{var C;const f=Math.min(Math.max(c-1,0),i+1);a({approvalId:((C=s[f])==null?void 0:C.approvalId)??null,index:f})},[c,s,i]),g=d.useCallback(()=>{o==null||t==null||t.focus(o)},[o,t]);return{count:c,index:i,canPrev:i>0,canNext:i<c-1,goPrev:l,goNext:m,focusCurrent:g}}function Ze(){const s=v("ApprovalNavBanner"),{count:t,index:n,canPrev:a,canNext:r,goPrev:c,goNext:u,focusCurrent:i}=$e();return t===0?null:e.jsx(s,{total:t,current:n+1,canPrev:a,canNext:r,onPrev:c,onNext:u,onFocusCurrent:i})}var L={radioValue:"",custom:""};function et({disabled:s=!1}){const t=v("AskUserPrompt"),{pending:n,respond:a}=G(),r=J(),c=_(),u=n[0],i=d.useMemo(()=>u==null?[]:[{id:u.toolCallId,question:u.question??"Answer required",options:u.options??[]}],[u]),[o,l]=d.useState(0),[m,g]=d.useState({});d.useEffect(()=>{l(0),g({})},[u==null?void 0:u.toolCallId]);const p=Math.min(o,Math.max(i.length-1,0)),f=i[p],C=f==null?L:m[f.id]??L,j=d.useCallback(S=>{const I=m[S]??L;return I.radioValue===W?I.custom.trim():I.radioValue.trim()},[m]),x=d.useMemo(()=>i.every(S=>j(S.id)),[j,i]),w=C.radioValue===W?C.custom.trim():C.radioValue.trim(),y=c||s||f==null||w.length===0,R=y||!x,A=d.useCallback((S,I)=>{g(E=>({...E,[S]:{...E[S]??L,...I}}))},[]),N=d.useCallback(()=>{if(s||u==null||!x)return;const S=j(u.toolCallId);if(!S)return;const I=m[u.toolCallId]??L;r(T.AskUser.SUBMITTED,{tool_call_id:u.toolCallId,question_count:i.length,is_custom_option:I.radioValue===W}),a({toolCallId:u.toolCallId,content:S})},[x,m,s,j,u,i.length,a,r]);return u==null||f==null?null:e.jsx(t,{questions:i,readOnly:c||s,currentQuestion:f,currentQuestionIndex:p,currentAnswer:C,totalQuestions:i.length,isMultiQuestion:i.length>1,isLastQuestion:p===i.length-1,allQuestionsAnswered:x,isSubmitDisabled:y,isSubmitAllDisabled:R,onCurrentQuestionIndexChange:l,onCurrentAnswerChange:A,onSubmit:N})}function tt(s){var a,r,c;const t=s.thread.messages,n=t[t.length-1];return(n==null?void 0:n.role)!=="assistant"||((a=n.status)==null?void 0:a.type)!=="requires-action"?!1:((c=(r=n.metadata)==null?void 0:r.custom)==null?void 0:c.pendingMcpAuth)===!0}function nt(){const s=M(tt),{pending:t}=G(),{pending:n}=se(),a=oe();if(s)return{kind:"mcp"};const r=t[0];if(r!=null){const c=r.toolName;return c!=null&&(a==null?void 0:a[c])!=null?{kind:"custom",toolName:c}:{kind:"ask-user"}}return n.length>0?{kind:"approval"}:{kind:"compose"}}function st({disabled:s=!1}){const t=oe(),{pending:n,respond:a}=G(),r=_(),c=n[0],u=d.useCallback(o=>{if(s||c==null)return;const l=o.trim();l&&a({toolCallId:c.toolCallId,content:l})},[s,c,a]);if(c==null||c.toolName==null)return null;const i=t==null?void 0:t[c.toolName];return i==null?null:e.jsx(i,{args:c.args??{},disabled:r||s,onSubmit:u})}function ot({servers:s,onContinue:t,readOnly:n}){const a=v("McpAuthPrompt"),{handleAuthorize:r}=De(),{refreshConnectors:c}=ae(),[u,i]=d.useState(()=>new Set),o=d.useRef(u),[l,m]=d.useState(!1),g=d.useRef(!1),p=d.useRef(0);d.useEffect(()=>()=>{p.current+=1},[]);const f=()=>{n||g.current||(g.current=!0,m(!0),t().catch(()=>{g.current=!1,m(!1)}))},C=j=>{const x=p.current;r(j,w=>{if(x!==p.current||!w)return;const y=new Set([...o.current,j]);o.current=y,i(y),c(),s.every(R=>y.has(R.id))&&f()})};return e.jsx(a,{servers:s,connectedServerIds:u,continueLoading:l,onConnect:C,onContinue:f,readOnly:n})}function rt({disabled:s=!1}){const t=v("McpAuthPrompt"),{pending:n,resume:a}=ye(),r=_(),c=re();if(!n)return null;if(c){const i=JSON.stringify(n.mcpServers.map(o=>o.id));return e.jsx(ot,{servers:n.mcpServers,onContinue:a,readOnly:r||s},i)}const u=i=>{const o=n.mcpServers.find(l=>l.id===i);o!=null&&o.authUrl&&window.open(o.authUrl,"_blank","noopener,noreferrer")};return e.jsx(t,{servers:n.mcpServers,onConnect:u,onContinue:()=>{s||a()},readOnly:r||s})}function at({disabled:s,hasText:t,hasAttachments:n,requiresModel:a,hasModel:r}){return!s&&(t||n)&&(!a||r)}function Z({placeholder:s,connectedToBanner:t=!1}){var F,D;const n=v("ComposerShell"),a=ne(),r=z(),c=J(),u=M(b=>b.threadListItem.remoteId),i=M(b=>b.composer.text.trim().length>0),o=M(b=>b.composer.attachments.length),l=o>0,m=i||l,{agentSpec:g}=ie(),p=r==null||r.mode.status==="active"&&r.mode.isMutable,f=!!((D=(F=g==null?void 0:g.model)==null?void 0:F.name)!=null&&D.trim()),{isBusy:C,send:j,resetBusy:x}=Oe(),w=K(),y=_e(),R=d.useRef(null),A=!w,N=at({disabled:A,hasText:i,hasAttachments:l,requiresModel:p,hasModel:f}),S=(r==null?void 0:r.mode.status)==="active"?{agentId:r.mode.agentId,agentName:r.mode.agentName}:{},I=()=>{var b;N&&(c(T.Message.SENT,B({has_text:i,has_attachments:l,attachment_count:o,requires_model:p,model:(b=g==null?void 0:g.model)==null?void 0:b.name},{sessionId:u,...S})),j(()=>a.composer().send()))},E=b=>{b.key!=="Enter"||b.shiftKey||b.nativeEvent.isComposing||N&&(b.preventDefault(),I())};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:R,type:"file",multiple:!0,hidden:!0,onChange:b=>{const h=b.target.files;if(h){c(T.Attachment.PICKED,B({file_count:h.length},{sessionId:u,...S}));for(const k of h)a.composer().addAttachment(k)}b.target.value=""}}),e.jsx(P.AttachmentDropzone,{disabled:A,"data-slot":"aui_composer-attachment-dropzone",className:"w-full rounded-[0.75rem] transition-[box-shadow] data-[dragging=true]:ring-focus-ring/20 data-[dragging=true]:ring-3",onDropCapture:b=>{var k;if(A)return;const h=(k=b.dataTransfer)==null?void 0:k.files;h==null||h.length===0||c(T.Attachment.PICKED,B({file_count:h.length},{sessionId:u,...S}))},children:e.jsx(P.Root,{"data-slot":"aui_composer-root",className:"w-full",onSubmit:b=>{b.preventDefault(),I()},children:e.jsx(n,{className:t?"rounded-t-none border-t-0 focus-within:ring-0":void 0,attachments:e.jsx(Fe,{}),input:e.jsx(P.Input,{"data-slot":"aui_composer-input",placeholder:s,disabled:A,submitMode:"enter",onKeyDown:E,"aria-label":"Message input",className:"text-text-primary placeholder:text-text-secondary/80 max-h-[10lh] min-h-10 w-full resize-none overflow-y-auto rounded-lg border-none bg-transparent px-1 py-1 text-base leading-normal shadow-none outline-none disabled:cursor-not-allowed"}),disabled:A,canSubmit:N,hasContent:m,isRunning:C,onSubmit:I,onCancel:w?()=>{c(T.Message.CANCELLED,B(void 0,{sessionId:u,...S})),x(),y()}:void 0,onAttach:w?()=>{var b;return(b=R.current)==null?void 0:b.click()}:void 0})})})]})}function H({placeholder:s,connectedToBanner:t=!1}){const n=z(),a=v("ComposerLeftSection"),r=v("ComposerRightSection"),c=X("ComposerLeftSection"),u=X("ComposerRightSection"),i=v("DraftComposerLeftSection"),o=v("DraftComposerRightSection");return(n==null?void 0:n.mode.status)==="active"&&n.mode.isMutable?e.jsx(ke,{children:e.jsx(Ie,{overrides:{ComposerLeftSection:c?i:a,ComposerRightSection:u?o:r},children:e.jsx(Z,{placeholder:s,connectedToBanner:t})})}):e.jsx(Z,{placeholder:s,connectedToBanner:t})}function it({placeholder:s="Ask anything... (Shift+Enter for new line)"}){const t=nt(),n=K(),a=t.kind==="mcp"?e.jsx(rt,{disabled:!n}):t.kind==="custom"?e.jsx(st,{disabled:!n}):t.kind==="ask-user"?e.jsx(et,{disabled:!n}):t.kind==="approval"?e.jsx(Ze,{}):null;return a==null?e.jsx(H,{placeholder:s}):t.kind==="approval"?e.jsxs("div",{"data-slot":"aui_composer-pause","data-pause-kind":t.kind,className:"flex w-full flex-col",children:[a,e.jsx(H,{placeholder:s,connectedToBanner:!0})]}):t.kind==="mcp"?e.jsxs("div",{"data-slot":"aui_composer-pause","data-pause-kind":t.kind,className:"relative flex w-full flex-col",children:[e.jsx("div",{className:"pb-2",children:a}),e.jsx("div",{className:"relative z-10 -mt-3",children:e.jsx(H,{placeholder:s})})]}):e.jsxs("div",{"data-slot":"aui_composer-pause","data-pause-kind":t.kind,className:"flex w-full flex-col",children:[a,e.jsx("div",{className:"relative z-10 -mt-1",children:e.jsx(H,{placeholder:s})})]})}var lt=200,ee='[data-slot="aui_thread-viewport"]';function ct(){const s=v("HistoryLoader"),{hasOlderHistory:t,isLoadingOlderHistory:n,loadOlderHistory:a}=ge(),[r,c]=d.useState(null),u=d.useRef(!1),i=d.useCallback(async()=>{if(u.current)return;u.current=!0;const o=(r==null?void 0:r.closest(ee))??null,l=(o==null?void 0:o.scrollHeight)??0,m=(o==null?void 0:o.scrollTop)??0;try{await a(),requestAnimationFrame(()=>{if(o==null)return;const g=o.scrollHeight-l;g>0&&o.scrollTo({top:m+g,behavior:"instant"})})}catch{}finally{u.current=!1}},[r,a]);return d.useEffect(()=>{if(r==null||!t)return;const o=r.closest(ee),l=new IntersectionObserver(m=>{m.some(g=>g.isIntersecting)&&i()},{root:o,rootMargin:`${lt}px 0px 0px 0px`});return l.observe(r),()=>l.disconnect()},[r,t,i]),t?e.jsx(s,{ref:c,isLoading:n}):null}function ut(){const s=v("ResumeUnavailable");return be()?e.jsx(s,{}):null}function dt(){return M(t=>{var n;return(((n=t.message.attachments)==null?void 0:n.length)??0)>0})?e.jsx("div",{className:"pointer-events-none mb-2 opacity-90",children:e.jsx(Ue,{})}):null}function mt(){const s=v("UserMessageEdit"),t=v("MessageTimestamp"),n=_(),a=K(),r=M(o=>o.message.createdAt),{cancel:c,disabled:u}=Ae(),{disabled:i}=Me();return e.jsx(Re.Root,{"data-role":"user",children:e.jsx(P.Root,{"data-slot":"aui_user-edit-composer-root",className:"fade-in slide-in-from-bottom-1 animate-in flex w-full justify-end px-2 duration-150",children:e.jsx(s,{timestamp:e.jsx(t,{createdAt:r}),attachments:e.jsx(dt,{}),input:e.jsx("div",{className:"mt-1 rounded border border-border bg-secondary-bg p-2 text-text-primary",children:e.jsx(P.Input,{"data-slot":"aui_user-edit-input",disabled:n||!a,submitMode:"enter","aria-label":"Edit message",className:"max-h-32 min-h-10 w-full resize-none border-none bg-transparent p-0 text-base leading-[1.34] outline-none focus:shadow-none"})}),footer:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx($.Secondary,{type:"button",disabled:u,onClick:c,children:"Cancel"}),e.jsx(P.Send,{asChild:!0,children:e.jsx($.Primary,{type:"submit",disabled:i||n||!a,children:"Save & Rerun"})})]})})})})}function ft(){const s=te(),t=ne(),n=M(i=>i.threadListItem.remoteId),a=M(i=>i.threadListItem.title),r=_(),c=d.useRef(!1),u=d.useRef(void 0);d.useEffect(()=>{u.current=void 0},[n]),d.useEffect(()=>{const i=c.current&&!r;if(c.current=r,!i||s==null||n==null||u.current===n)return;if(a!=null&&a.trim()!==""){u.current=n;return}let o=!1;return s.getSession({sessionId:n}).then(l=>{if(o)return;const m=typeof l.title=="string"?l.title.trim():"";if(m.length!==0)return u.current=n,t.threadListItem().rename(m)}).catch(()=>{}),()=>{o=!0}},[t,r,n,s,a])}var ce="trueforge.file-preview-width";function ht(){try{const s=sessionStorage.getItem(ce);if(s==null)return null;const t=Number(s);return Number.isFinite(t)?t:null}catch{return null}}function gt(s){try{sessionStorage.setItem(ce,String(Math.round(s)))}catch{}}function pt(){const s=ve(),t=v("FilePreviewPanel"),n=Ce(),a=Se(),r=je(),[c,u]=d.useState(0),[i,o]=d.useState(!1),[l,m]=d.useState(ht),g=we(s.target,c),p=s.target,f=s.presentation==="full"?"full":n||a?"overlay":"side";if(d.useLayoutEffect(()=>{var y;if(p==null||f!=="side")return;const x=((y=document.querySelector('[data-slot="aui_file-preview-row"]'))==null?void 0:y.getBoundingClientRect().width)??0;if(x<=0)return;const w=l==null?Ne(x):Ee({requested:l,rowWidth:x});(l==null||Math.abs(w-l)>1)&&m(w)},[f,p,l]),p==null)return null;const C=g.view.status==="error",j=()=>{i||(o(!0),(async()=>{try{const x=g.blob??await p.load();Te(x,Pe(p.path))}catch(x){r!=null?r.showError(x):console.error("Failed to download sandbox file",x)}finally{o(!1)}})())};return e.jsx(t,{name:p.name,placement:f,view:g.view,onClose:s.close,onDownload:j,onEnterFullPage:()=>s.setPresentation("full"),onExitFullPage:()=>s.setPresentation("panel"),downloadBusy:i,...f==="side"&&l!=null?{widthPx:l}:{},...f==="side"?{onWidthChange:x=>{m(x),gt(x)}}:{},...C?{onRetry:()=>u(x=>x+1)}:{}})}function xt({children:s}){return e.jsx("div",{className:"animate-in fade-in slide-in-from-bottom-1 fill-mode-both duration-200",children:s})}function bt({isEditing:s}){return M(n=>n.message.role)==="user"?s?e.jsx(mt,{}):e.jsx(pe,{}):e.jsx(xe,{})}function vt({composer:s}){d.useEffect(()=>{ue()},[]),ft();const t=z(),n=v("WelcomeScreen"),a=v("MessageListSkeleton"),r=v("ScrollToBottomButton"),c=v("MessageGroup"),u=v("ThreadComposerAreaShell"),i=v("ThreadRootShell"),o=v("ThreadViewportShell"),l=M(de),m=M(p=>p.thread.isLoading),g=(t==null?void 0:t.mode.status)==="active"?t.mode.agentName!=null&&t.mode.agentName.length>0?t.mode.agentName:t.mode.isMutable&&t.mode.isCreateAgent?"Start building a new Agent":void 0:void 0;return e.jsx(me,{children:e.jsx(fe,{children:e.jsx(he,{children:e.jsx(U.Root,{asChild:!0,children:e.jsx(i,{children:e.jsxs("div",{"data-slot":"aui_file-preview-row",className:"relative flex min-h-0 w-full min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsx(U.Viewport,{asChild:!0,autoScroll:!0,children:e.jsxs(o,{isEmpty:l,children:[l&&e.jsx(n,{heading:g}),l&&!m&&s,m?e.jsx(a,{}):!l&&e.jsxs(e.Fragment,{children:[e.jsx(ct,{}),e.jsxs(c,{children:[e.jsx(U.Messages,{children:({message:p})=>e.jsx(xt,{children:e.jsx(bt,{isEditing:p.role==="user"&&p.composer.isEditing})})}),e.jsx(ut,{})]})]})]})}),!m&&!l&&e.jsxs(u,{isEmpty:l,children:[e.jsx(U.ScrollToBottom,{asChild:!0,children:e.jsx(r,{})}),s]})]}),e.jsx(pt,{})]})})})})})})}function St(){return e.jsx(vt,{composer:e.jsx(it,{})})}function jt({className:s}){const t=Je(),n=M(c=>c.threadListItem.title);if(t===null)return null;const a=(n==null?void 0:n.trim())??"",r=t.allowThreadTitle&&a.length>0?a:t.name;return e.jsxs("h1",{className:O("flex min-w-0 items-center gap-1.5",Xe,s),children:[e.jsx("span",{className:"truncate",title:r,children:r}),t.isEditing?e.jsx(Ye,{content:"Try changes here, then choose Update agent to save.",side:"bottom",children:e.jsxs("span",{className:"border-warning-bg/40 bg-warning-bg/10 text-warning-bg inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium",children:[e.jsx(V,{name:"pencil",className:"size-3"}),"Editing"]})}):null]})}function wt({className:s,labeled:t=!1,onAction:n}){const a=z(),r=J(),c=re(),u=le(),{mode:i,setTheme:o}=Ke(),l=v("ShellActionsActionSlot"),m=i==="dark",g=m?"Light":"Dark",p=Ge({catalog:c,capabilities:u}),f="hover:bg-secondary-button-hover hover:text-ghost-button-text";return e.jsxs("div",{className:O("flex shrink-0 items-center gap-1",t?"w-full flex-col items-center gap-1 text-sidebar-text":"text-text-primary",s),children:[e.jsxs("a",{href:"https://trueforge.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"Documentation",title:"Documentation",className:q({variant:"ghost",size:t?void 0:"icon",className:O(f,t&&Q)}),onClick:()=>n==null?void 0:n(),children:[e.jsx(V,{name:"book-open",size:t?14:void 0}),t?e.jsx("span",{className:"text-center",children:"Docs"}):null]}),e.jsxs("button",{type:"button","aria-label":m?"Switch to light theme":"Switch to dark theme",title:m?"Light theme":"Dark theme",className:q({variant:"ghost",size:t?void 0:"icon",className:O(f,t&&Q)}),onClick:()=>{o(m?"light":"dark"),n==null||n()},children:[e.jsx(V,{name:m?"sun":"moon",size:t?14:void 0}),t?e.jsx("span",{className:"text-center",children:g}):null]}),a!=null&&p?e.jsxs("button",{type:"button","aria-label":"Settings",title:"Settings","aria-expanded":a.settingsOpen,"aria-current":a.settingsOpen?"page":void 0,className:q({variant:"ghost",size:t?void 0:"icon",className:O(f,t&&Q,a.settingsOpen&&"bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text")}),onClick:()=>{a.settingsOpen||r(T.Settings.OPENED),a.setSettingsOpen(!0),n==null||n()},children:[e.jsx(V,{name:"settings",size:t?14:void 0}),t?e.jsx("span",{className:"text-center",children:"Settings"}):null]}):null,e.jsx(l,{})]})}function yt({showClose:s=!1}){var D,b;const{agentSpec:t}=ie(),n=Be(),a=He(),r=Ve(),c=r.mode.status==="active"?r.mode.agentId:void 0,{allows:u}=ze({resourceType:"agent",resourceIds:c==null?[]:[c]}),i=u(c,"MANAGE"),o=te(),l=le(),m=ae(),g=v("AgentConfigPanel"),p=v("AgentConfigEditors"),[f,C]=d.useState(null),j=We(r.mode),{draft:x,flush:w}=qe(),y=d.useCallback(()=>{w(),a(),r.setAgentConfigOpen(!1)},[a,w,r]);d.useEffect(()=>{j&&m.ensureLoaded()},[m,j]),d.useEffect(()=>{i||C(null)},[i]),d.useEffect(()=>{if(!s||!r.agentConfigOpen)return;const h=k=>{!k.defaultPrevented&&k.key==="Escape"&&f===null&&document.querySelector("dialog[open]")===null&&y()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[y,f,r.agentConfigOpen,s]);const R=d.useRef({flushAgentSpec:a,flushInstructions:w});R.current={flushAgentSpec:a,flushInstructions:w},d.useEffect(()=>()=>{const{flushAgentSpec:h,flushInstructions:k}=R.current;k();try{h()}catch{}},[]);const A=d.useCallback(({next:h,instructions:k})=>{var Y;if(i){if(h.skills&&h.skills.length>0&&(l==null?void 0:l.sandbox.enabled)===!0){n==null||n({...h,instructions:k||void 0,config:{...h.config,sandbox:{...(Y=h.config)==null?void 0:Y.sandbox,enabled:!0}}});return}n==null||n({...h,instructions:k||void 0})}},[i,l==null?void 0:l.sandbox.enabled,n]),N=d.useCallback(h=>{A({next:h,instructions:x})},[A,x]),S=d.useCallback(h=>{t!==null&&A({next:Qe({spec:t,messages:h.messages}),instructions:h.instructions})},[t,A]),I=d.useCallback(async h=>(o==null?void 0:o.getMcpTools)===void 0?[]:o.getMcpTools({connectorId:h}),[o]),E=d.useCallback(async h=>{var k;return(k=o==null?void 0:o.getMcpConnector)==null?void 0:k.call(o,{connectorId:h})},[o]);if(!j||t===null||s&&!r.agentConfigOpen)return null;const F=m.models.find(h=>h.name===t.model.name);return e.jsxs(e.Fragment,{children:[e.jsx(g,{spec:t,model:F,models:m.models,modelsLoading:m.loading,modelsError:m.error,skills:m.skills,skillsAvailable:(l==null?void 0:l.skill.enabled)===!0,webSearchAvailable:((D=l==null?void 0:l.webSearch)==null?void 0:D.enabled)===!0,instructions:x,onOpenEditor:h=>{i&&C(h)},onChange:N,disabled:!i,onClose:s?y:void 0}),e.jsx(p,{editor:f,spec:t,models:m.models,connectors:m.connectors,skills:m.skills,loading:m.loading,error:m.error,skillsDisabled:(l==null?void 0:l.skill.enabled)!==!0,sandboxAvailable:(l==null?void 0:l.sandbox.enabled)===!0,webSearchAvailable:((b=l==null?void 0:l.webSearch)==null?void 0:b.enabled)===!0,instructions:x,onInstructionsSave:S,...(o==null?void 0:o.getMcpConnector)===void 0?{}:{loadMcpConnector:E},loadMcpTools:I,onRefreshConnectors:m.refreshConnectors,onChange:N,onClose:()=>C(null)})]})}export{yt as A,jt as N,wt as S,St as T};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-CVPLV5HY-D0lac3y-.js","./index-BJsGMvc-.js","./index-B01pXqvC.css","./SchedulesPage-HLHAOIS6-BcDOMjiM.js","./chunk-ICZTJLTU-CSBYGLaq.js","./EnvironmentsPage-OXKHJMOO-C-t7Dp_i.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as _,b as P,d as t,e as L,r as a,j as s,S as c,P as z,I as l,f as d,g as B,_ as u}from"./index-BJsGMvc-.js";import{N as I,T,S as k,A as D}from"./chunk-NYCSPKHJ-BXKEzm55.js";var V=a.lazy(()=>u(()=>import("./SettingsBuilder-CVPLV5HY-D0lac3y-.js"),__vite__mapDeps([0,1,2]),import.meta.url)),R=a.lazy(()=>u(()=>import("./SchedulesPage-HLHAOIS6-BcDOMjiM.js"),__vite__mapDeps([3,4,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),F=a.lazy(()=>u(()=>import("./EnvironmentsPage-OXKHJMOO-C-t7Dp_i.js"),__vite__mapDeps([5,4,1,2]),import.meta.url).then(n=>({default:n.EnvironmentsPage})));function q({className:n,threadHeaderEnd:f}){const r=_(),e=P(),j=t("ClearChatButton"),g=t("AgentDetailsPage"),v=t("AgentsLibrary"),b=t("SessionsPage"),h=t("ShareChatButton"),N=t("SaveAgentButton"),y=t("SelectAgentEmptyState"),A=t("UserAvatar"),i=(e==null?void 0:e.mode.status)==="idle",S=(e==null?void 0:e.settingsOpen)===!0,o=(e==null?void 0:e.libraryOpen)===!0,C=(e==null?void 0:e.sessionsOpen)===!0,m=(e==null?void 0:e.schedulesOpen)===!0,x=(e==null?void 0:e.environmentsOpen)===!0,O=L(),p=(e==null?void 0:e.isNewChatEnabled)!==!1;a.useEffect(()=>{i||Promise.resolve(r.threads().switchToNewThread()).catch(()=>{})},[r,i]);const w=()=>{if(e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled){e.openDraft();return}e==null||e.setSettingsOpen(!1),e==null||e.setSchedulesOpen(!1),e==null||e.setEnvironmentsOpen(!1),Promise.resolve(r.threads().switchToNewThread()).catch(()=>{})},E=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return s.jsxs("div",{className:B("relative flex h-full min-h-0 flex-col",n),children:[S?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(a.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(c,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(V,{})})}):C?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(b,{})}):o&&(e==null?void 0:e.libraryAgentId)!=null?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(g,{agentId:e.libraryAgentId},e.libraryAgentId)}):o?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(v,{})}):m?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(a.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(c,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(R,{})})}):x?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(a.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(c,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(F,{})})}):s.jsxs(s.Fragment,{children:[s.jsx(z,{start:s.jsxs(s.Fragment,{children:[p&&!O?s.jsx("button",{type:"button","aria-label":"New Chat",title:"New Chat",className:d({variant:"ghost",size:"icon"}),onClick:w,children:s.jsx(l,{name:"square-pen"})}):null,p&&(e!=null&&e.isComposerEnabled)?s.jsx("button",{type:"button","aria-label":"New Agent",title:"New Agent",className:d({variant:"ghost",size:"icon"}),onClick:E,children:s.jsx(l,{name:"agent-2"})}):null]}),title:s.jsx(I,{}),end:s.jsxs(s.Fragment,{children:[s.jsx(h,{}),s.jsx(j,{}),s.jsx(N,{}),f]})}),s.jsx("div",{className:"min-h-0 flex-1",children:i?s.jsx(y,{}):s.jsx(T,{})})]}),s.jsxs("footer",{className:"flex shrink-0 items-center justify-between border-t border-border px-2 py-1.5",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o||m||x?s.jsxs("button",{type:"button",className:d({variant:"ghost",size:"small"}),onClick:()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSchedulesOpen(!1),e==null||e.setEnvironmentsOpen(!1)},children:[s.jsx(l,{name:"arrow-left"}),"Back to chat"]}):null,s.jsx(A,{})]}),s.jsx(k,{},"shell-actions")]}),e!=null&&e.agentConfigOpen?s.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"absolute inset-0 z-20 border-l border-border shadow-xl",children:s.jsx(D,{showClose:!0})}):null]})}export{q as S};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|