@truefoundry/trueforge 0.2.0-rc.1 → 0.2.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-NZOFJE57-Bn94i1Ie.js → AgentCodeSnippets-637HQUXD-C5c8zg9J.js} +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-637HQUXD-C5c8zg9J.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-637HQUXD-C5c8zg9J.js.gz +0 -0
- package/dist/_frontend/assets/{AgentMetricChart-JPU3MFQ2-pn-oatgo.js → AgentMetricChart-4FYECRIN-BN07l9mr.js} +1 -1
- package/dist/_frontend/assets/AgentMetricChart-4FYECRIN-BN07l9mr.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-4FYECRIN-BN07l9mr.js.gz +0 -0
- package/dist/_frontend/assets/{AgentOverview-EEBHJC32-Bn4qidnv.js → AgentOverview-3FJ5EE6N-D1pX5Emq.js} +1 -1
- package/dist/_frontend/assets/AgentOverview-3FJ5EE6N-D1pX5Emq.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-3FJ5EE6N-D1pX5Emq.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-VELWUYPR-S1LS04B9.js +1 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-VELWUYPR-S1LS04B9.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-VELWUYPR-S1LS04B9.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-CUKETHWM-D4LvjUpF.js +1 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-CUKETHWM-D4LvjUpF.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-CUKETHWM-D4LvjUpF.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessions-3MPDZASK-Dp6vYfGN.js → AgentSessions-T7MOGOTZ-wppcDkIn.js} +1 -1
- package/dist/_frontend/assets/AgentSessions-T7MOGOTZ-wppcDkIn.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-T7MOGOTZ-wppcDkIn.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-ESZ2RSRG-DLxrylX3.js +1 -0
- package/dist/_frontend/assets/ConnectorSettings-ESZ2RSRG-DLxrylX3.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-ESZ2RSRG-DLxrylX3.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-LM4AFMFY-DoBwJ3-e.js → DockLayout-NLFNU6F2-BGJvqqVS.js} +1 -1
- package/dist/_frontend/assets/DrawerLayout-PR3SMKA6-C13frtIA.js +2 -0
- package/dist/_frontend/assets/DrawerLayout-PR3SMKA6-C13frtIA.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-PR3SMKA6-C13frtIA.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-LYW64IRR-BLLhCXsR.js +1 -0
- package/dist/_frontend/assets/ModelSettings-LYW64IRR-BLLhCXsR.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-LYW64IRR-BLLhCXsR.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-DF64LHYI-7AeygCju.js +1 -0
- package/dist/_frontend/assets/SandboxSettings-DF64LHYI-7AeygCju.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-DF64LHYI-7AeygCju.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-WQU4H25F-BGlu6WXG.js +1 -0
- package/dist/_frontend/assets/SchedulesPage-WQU4H25F-BGlu6WXG.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-WQU4H25F-BGlu6WXG.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-LSXK2VN4-B0Y9JGuK.js +2 -0
- package/dist/_frontend/assets/SettingsBuilder-LSXK2VN4-B0Y9JGuK.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-LSXK2VN4-B0Y9JGuK.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-B22IAV2W-leIgCXVi.js +1 -0
- package/dist/_frontend/assets/ShellRouteSync-B22IAV2W-leIgCXVi.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-B22IAV2W-leIgCXVi.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-XW6LXB7R-Cfmnvl3i.js +2 -0
- package/dist/_frontend/assets/SidebarLayout-XW6LXB7R-Cfmnvl3i.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-XW6LXB7R-Cfmnvl3i.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-64VXUO6J-CeuMawWX.js +1 -0
- package/dist/_frontend/assets/SkillSettings-64VXUO6J-CeuMawWX.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-64VXUO6J-CeuMawWX.js.gz +0 -0
- package/dist/_frontend/assets/TrueForgeUIWithRouter-3TSLV22Q-BiR4AwMi.js +1 -0
- package/dist/_frontend/assets/{WidgetLayout-6QM45OQQ-Bp0tde9v.js → WidgetLayout-Q5P7PYSJ-D-NJInrA.js} +1 -1
- package/dist/_frontend/assets/WidgetLayout-Q5P7PYSJ-D-NJInrA.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-Q5P7PYSJ-D-NJInrA.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-62JRHF6Z-BLb_tkPU.js → chunk-62JRHF6Z-gAUkEAjv.js} +1 -1
- package/dist/_frontend/assets/chunk-62JRHF6Z-gAUkEAjv.js.br +0 -0
- package/dist/_frontend/assets/chunk-62JRHF6Z-gAUkEAjv.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-FJW36PD7-R_XSoO50.js → chunk-I3AL54MA--fCRbraS.js} +2 -2
- package/dist/_frontend/assets/chunk-I3AL54MA--fCRbraS.js.br +0 -0
- package/dist/_frontend/assets/chunk-I3AL54MA--fCRbraS.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-WVE3F724-CL71bP7s.js → chunk-SQGT43Z3-Di5-vYAQ.js} +1 -1
- package/dist/_frontend/assets/chunk-SQGT43Z3-Di5-vYAQ.js.br +0 -0
- package/dist/_frontend/assets/chunk-SQGT43Z3-Di5-vYAQ.js.gz +0 -0
- package/dist/_frontend/assets/chunk-VUMGMGKZ-CUX2iOMe.js +1 -0
- package/dist/_frontend/assets/chunk-VUMGMGKZ-CUX2iOMe.js.br +0 -0
- package/dist/_frontend/assets/chunk-VUMGMGKZ-CUX2iOMe.js.gz +0 -0
- package/dist/_frontend/assets/{cssMode-CVefs5W-.js → cssMode-Bmk_AUwV.js} +1 -1
- package/dist/_frontend/assets/cssMode-Bmk_AUwV.js.br +0 -0
- package/dist/_frontend/assets/cssMode-Bmk_AUwV.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-mt8l8QVE.js → freemarker2-BqULNxdn.js} +1 -1
- package/dist/_frontend/assets/freemarker2-BqULNxdn.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-BqULNxdn.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-C97jT8Zn.js → handlebars-D-wN_MMv.js} +1 -1
- package/dist/_frontend/assets/handlebars-D-wN_MMv.js.br +0 -0
- package/dist/_frontend/assets/handlebars-D-wN_MMv.js.gz +0 -0
- package/dist/_frontend/assets/{html-DKtvlaWU.js → html-DX_2Eu_G.js} +1 -1
- package/dist/_frontend/assets/html-DX_2Eu_G.js.br +0 -0
- package/dist/_frontend/assets/html-DX_2Eu_G.js.gz +0 -0
- package/dist/_frontend/assets/{htmlMode-BHsrcqlc.js → htmlMode-CqQ0rpq1.js} +1 -1
- package/dist/_frontend/assets/htmlMode-CqQ0rpq1.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-CqQ0rpq1.js.gz +0 -0
- package/dist/_frontend/assets/{index-BW-oaxAt.js → index-CNHFMp3w.js} +3 -3
- package/dist/_frontend/assets/index-CNHFMp3w.js.br +0 -0
- package/dist/_frontend/assets/index-CNHFMp3w.js.gz +0 -0
- package/dist/_frontend/assets/{index-DVCxCjDg.js → index-G4wOqi3O.js} +237 -237
- package/dist/_frontend/assets/index-G4wOqi3O.js.br +0 -0
- package/dist/_frontend/assets/index-G4wOqi3O.js.gz +0 -0
- package/dist/_frontend/assets/index-MPbqVnOf.js +18 -0
- package/dist/_frontend/assets/index-MPbqVnOf.js.br +0 -0
- package/dist/_frontend/assets/index-MPbqVnOf.js.gz +0 -0
- package/dist/_frontend/assets/{index-D8eVAzN5.css → index-SN54UIUh.css} +1 -1
- package/dist/_frontend/assets/index-SN54UIUh.css.br +0 -0
- package/dist/_frontend/assets/index-SN54UIUh.css.gz +0 -0
- package/dist/_frontend/assets/{javascript-Cs0N3w-s.js → javascript-CO_8uS79.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-CqrfFSVA.js → jsonMode-D0kqu8c3.js} +1 -1
- package/dist/_frontend/assets/jsonMode-D0kqu8c3.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-D0kqu8c3.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-C11lKF6J.js → liquid-CB807zJs.js} +1 -1
- package/dist/_frontend/assets/liquid-CB807zJs.js.br +0 -0
- package/dist/_frontend/assets/liquid-CB807zJs.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-DBZtnSMo.js → lspLanguageFeatures-D0-0mkv4.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-D0-0mkv4.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-D0-0mkv4.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-CCo4oKJJ.js → mdx-7_H2_m8y.js} +1 -1
- package/dist/_frontend/assets/mdx-7_H2_m8y.js.br +0 -0
- package/dist/_frontend/assets/mdx-7_H2_m8y.js.gz +0 -0
- package/dist/_frontend/assets/{python-627g_SSG.js → python-DhB7kQ15.js} +1 -1
- package/dist/_frontend/assets/python-DhB7kQ15.js.br +0 -0
- package/dist/_frontend/assets/python-DhB7kQ15.js.gz +0 -0
- package/dist/_frontend/assets/{razor-BGDxoA7p.js → razor-CDzQiIjH.js} +1 -1
- package/dist/_frontend/assets/razor-CDzQiIjH.js.br +0 -0
- package/dist/_frontend/assets/razor-CDzQiIjH.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-gPT7Bbjh.js → tsMode-CVP7xaF5.js} +1 -1
- package/dist/_frontend/assets/tsMode-CVP7xaF5.js.br +0 -0
- package/dist/_frontend/assets/tsMode-CVP7xaF5.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-Cb0PzreF.js → typescript-BTAuo6jN.js} +1 -1
- package/dist/_frontend/assets/typescript-BTAuo6jN.js.br +0 -0
- package/dist/_frontend/assets/typescript-BTAuo6jN.js.gz +0 -0
- package/dist/_frontend/assets/{workers-BAgwFgJ0.js → workers-Dl5avODY.js} +1 -1
- package/dist/_frontend/assets/workers-Dl5avODY.js.br +0 -0
- package/dist/_frontend/assets/workers-Dl5avODY.js.gz +0 -0
- package/dist/_frontend/assets/{xml-BpvCCHF9.js → xml-CKI7eM7V.js} +1 -1
- package/dist/_frontend/assets/xml-CKI7eM7V.js.br +0 -0
- package/dist/_frontend/assets/xml-CKI7eM7V.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-f3XKmHoH.js → yaml-Czn9FR3r.js} +1 -1
- package/dist/_frontend/assets/yaml-Czn9FR3r.js.br +0 -0
- package/dist/_frontend/assets/yaml-Czn9FR3r.js.gz +0 -0
- package/dist/_frontend/index.html +2 -2
- package/dist/controller-main.js +26 -14
- package/dist/controller-main.js.map +1 -1
- package/dist/main.js +581 -239
- package/dist/main.js.map +1 -1
- package/dist/postgres/migrations/20260831_000001_session_external_id.js.map +1 -1
- package/dist/postgres/migrations/20260902_000002_agent_external_id.js.map +1 -1
- package/dist/postgres/migrations/20260903_000002_created_by_subject.js +1 -1
- package/dist/postgres/migrations/20260903_000002_created_by_subject.js.map +1 -1
- package/dist/postgres/migrations/20260904_000001_schedule_agent_id.js.map +1 -1
- package/dist/postgres/migrations/20260904_000002_session_source.js +31 -0
- package/dist/postgres/migrations/20260904_000002_session_source.js.map +1 -0
- package/dist/postgres/migrations/20260904_000003_session_metadata_gin.js +24 -0
- package/dist/postgres/migrations/20260904_000003_session_metadata_gin.js.map +1 -0
- package/dist/sqlite/migrations/20260831_000001_session_external_id.js.map +1 -1
- package/dist/sqlite/migrations/20260902_000001_session_metadata.js.map +1 -1
- package/dist/sqlite/migrations/20260902_000002_agent_external_id.js.map +1 -1
- package/dist/sqlite/migrations/20260903_000001_drop_agent_metadata.js.map +1 -1
- package/dist/sqlite/migrations/20260903_000002_created_by_subject.js +1 -1
- package/dist/sqlite/migrations/20260903_000002_created_by_subject.js.map +1 -1
- package/dist/sqlite/migrations/20260904_000001_schedule_agent_id.js.map +1 -1
- package/dist/sqlite/migrations/20260904_000002_session_source.js +28 -0
- package/dist/sqlite/migrations/20260904_000002_session_source.js.map +1 -0
- package/package.json +18 -16
- package/dist/_frontend/assets/AgentCodeSnippets-NZOFJE57-Bn94i1Ie.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-NZOFJE57-Bn94i1Ie.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-JPU3MFQ2-pn-oatgo.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-JPU3MFQ2-pn-oatgo.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-EEBHJC32-Bn4qidnv.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-EEBHJC32-Bn4qidnv.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-26Z6IB3B-D_yCZz1m.js +0 -1
- package/dist/_frontend/assets/AgentSessionEventTimeline-26Z6IB3B-D_yCZz1m.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-26Z6IB3B-D_yCZz1m.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-CGCU7WBK-JGwv6e5T.js +0 -1
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-CGCU7WBK-JGwv6e5T.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-CGCU7WBK-JGwv6e5T.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-3MPDZASK-Dp6vYfGN.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-3MPDZASK-Dp6vYfGN.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-MXFRWWR6-BEwXZbPM.js +0 -1
- package/dist/_frontend/assets/ConnectorSettings-MXFRWWR6-BEwXZbPM.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-MXFRWWR6-BEwXZbPM.js.gz +0 -0
- package/dist/_frontend/assets/DrawerLayout-JR3O6RRB-BZ9sffvm.js +0 -2
- package/dist/_frontend/assets/DrawerLayout-JR3O6RRB-BZ9sffvm.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-JR3O6RRB-BZ9sffvm.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-G7IFNC2Y-DxVYHG2m.js +0 -1
- package/dist/_frontend/assets/ModelSettings-G7IFNC2Y-DxVYHG2m.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-G7IFNC2Y-DxVYHG2m.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-NXAANMAX-DhC28qE6.js +0 -1
- package/dist/_frontend/assets/SandboxSettings-NXAANMAX-DhC28qE6.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-NXAANMAX-DhC28qE6.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-KKLUDO6B-CWdrd7KY.js +0 -1
- package/dist/_frontend/assets/SchedulesPage-KKLUDO6B-CWdrd7KY.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-KKLUDO6B-CWdrd7KY.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-L34IQ56S-BQuxGH5w.js +0 -2
- package/dist/_frontend/assets/SettingsBuilder-L34IQ56S-BQuxGH5w.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-L34IQ56S-BQuxGH5w.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-CEBETGEJ-C4NOyyck.js +0 -1
- package/dist/_frontend/assets/ShellRouteSync-CEBETGEJ-C4NOyyck.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-CEBETGEJ-C4NOyyck.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-A2HJPPHS-kusjDx4J.js +0 -2
- package/dist/_frontend/assets/SidebarLayout-A2HJPPHS-kusjDx4J.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-A2HJPPHS-kusjDx4J.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-FGGMSUNO-CjrGBX5J.js +0 -1
- package/dist/_frontend/assets/SkillSettings-FGGMSUNO-CjrGBX5J.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-FGGMSUNO-CjrGBX5J.js.gz +0 -0
- package/dist/_frontend/assets/TrueForgeUIWithRouter-MZVJWJMB-CZ8BOF1k.js +0 -1
- package/dist/_frontend/assets/WidgetLayout-6QM45OQQ-Bp0tde9v.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-6QM45OQQ-Bp0tde9v.js.gz +0 -0
- package/dist/_frontend/assets/chunk-62JRHF6Z-BLb_tkPU.js.br +0 -0
- package/dist/_frontend/assets/chunk-62JRHF6Z-BLb_tkPU.js.gz +0 -0
- package/dist/_frontend/assets/chunk-DMMZSZTN-BBNhHida.js +0 -1
- package/dist/_frontend/assets/chunk-DMMZSZTN-BBNhHida.js.br +0 -0
- package/dist/_frontend/assets/chunk-DMMZSZTN-BBNhHida.js.gz +0 -0
- package/dist/_frontend/assets/chunk-FJW36PD7-R_XSoO50.js.br +0 -0
- package/dist/_frontend/assets/chunk-FJW36PD7-R_XSoO50.js.gz +0 -0
- package/dist/_frontend/assets/chunk-WVE3F724-CL71bP7s.js.br +0 -0
- package/dist/_frontend/assets/chunk-WVE3F724-CL71bP7s.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-CVefs5W-.js.br +0 -0
- package/dist/_frontend/assets/cssMode-CVefs5W-.js.gz +0 -0
- package/dist/_frontend/assets/freemarker2-mt8l8QVE.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-mt8l8QVE.js.gz +0 -0
- package/dist/_frontend/assets/handlebars-C97jT8Zn.js.br +0 -0
- package/dist/_frontend/assets/handlebars-C97jT8Zn.js.gz +0 -0
- package/dist/_frontend/assets/html-DKtvlaWU.js.br +0 -0
- package/dist/_frontend/assets/html-DKtvlaWU.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-BHsrcqlc.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-BHsrcqlc.js.gz +0 -0
- package/dist/_frontend/assets/index-BW-oaxAt.js.br +0 -0
- package/dist/_frontend/assets/index-BW-oaxAt.js.gz +0 -0
- package/dist/_frontend/assets/index-D8eVAzN5.css.br +0 -0
- package/dist/_frontend/assets/index-D8eVAzN5.css.gz +0 -0
- package/dist/_frontend/assets/index-DVCxCjDg.js.br +0 -0
- package/dist/_frontend/assets/index-DVCxCjDg.js.gz +0 -0
- package/dist/_frontend/assets/index-DuKoX4ct.js +0 -18
- package/dist/_frontend/assets/index-DuKoX4ct.js.br +0 -0
- package/dist/_frontend/assets/index-DuKoX4ct.js.gz +0 -0
- package/dist/_frontend/assets/jsonMode-CqrfFSVA.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-CqrfFSVA.js.gz +0 -0
- package/dist/_frontend/assets/liquid-C11lKF6J.js.br +0 -0
- package/dist/_frontend/assets/liquid-C11lKF6J.js.gz +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-DBZtnSMo.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-DBZtnSMo.js.gz +0 -0
- package/dist/_frontend/assets/mdx-CCo4oKJJ.js.br +0 -0
- package/dist/_frontend/assets/mdx-CCo4oKJJ.js.gz +0 -0
- package/dist/_frontend/assets/python-627g_SSG.js.br +0 -0
- package/dist/_frontend/assets/python-627g_SSG.js.gz +0 -0
- package/dist/_frontend/assets/razor-BGDxoA7p.js.br +0 -0
- package/dist/_frontend/assets/razor-BGDxoA7p.js.gz +0 -0
- package/dist/_frontend/assets/tsMode-gPT7Bbjh.js.br +0 -0
- package/dist/_frontend/assets/tsMode-gPT7Bbjh.js.gz +0 -0
- package/dist/_frontend/assets/typescript-Cb0PzreF.js.br +0 -0
- package/dist/_frontend/assets/typescript-Cb0PzreF.js.gz +0 -0
- package/dist/_frontend/assets/workers-BAgwFgJ0.js.br +0 -0
- package/dist/_frontend/assets/workers-BAgwFgJ0.js.gz +0 -0
- package/dist/_frontend/assets/xml-BpvCCHF9.js.br +0 -0
- package/dist/_frontend/assets/xml-BpvCCHF9.js.gz +0 -0
- package/dist/_frontend/assets/yaml-f3XKmHoH.js.br +0 -0
- package/dist/_frontend/assets/yaml-f3XKmHoH.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as i,r as o,j as a,I as u,d}from"./index-
|
|
1
|
+
import{b as i,r as o,j as a,I as u,d}from"./index-G4wOqi3O.js";function b({snippets:t}){var c;const m=i("AgentCodeBlock"),[g,n]=o.useState((c=t[0])==null?void 0:c.language),[s,l]=o.useState("stream");o.useEffect(()=>{var e;n((e=t[0])==null?void 0:e.language),l("stream")},[t]);const r=t.find(e=>e.language===g)??t[0];return r===void 0?a.jsx("div",{className:"flex h-full min-h-64 items-center justify-center px-6 text-sm text-text-secondary",children:"No code samples for this agent."}):a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3 p-3 md:flex-row",children:[a.jsx("nav",{"aria-label":"Code sample languages",className:"flex shrink-0 gap-1 overflow-auto md:w-44 md:flex-col",children:t.map(e=>a.jsxs("button",{type:"button","aria-current":r.language===e.language?"page":void 0,className:d("flex h-9 shrink-0 cursor-pointer items-center gap-2 rounded-md px-2.5 text-left text-xs text-text-secondary","hover:bg-ghost-button-hover hover:text-text-primary",r.language===e.language&&"bg-primary-button-bg/10 font-medium text-primary-button-bg"),onClick:()=>n(e.language),children:[e.icon?a.jsx("img",{src:e.icon,alt:"",className:"size-4 shrink-0 object-contain"}):a.jsx(u,{name:"code",className:"size-4 shrink-0"}),e.labelName]},e.language))}),a.jsxs("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-card-bg",children:[a.jsx("div",{className:"flex h-10 shrink-0 items-end gap-1 border-b border-border px-3",children:[["stream","Stream"],["nonStream","Non-stream"]].map(([e,x])=>a.jsx("button",{type:"button",className:d("relative h-10 cursor-pointer px-3 text-xs font-medium text-text-secondary",s===e&&"text-primary-button-bg after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary-button-bg"),onClick:()=>l(e),children:x},e))}),a.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:a.jsx(m,{code:r.sampleCode[s],language:r.language})})]})]})}export{b as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{z as L,r as d,j as a,Z as j,Y as k}from"./index-G4wOqi3O.js";import{c as C,a as M,d as R,L as T,e as w,P as D,f as S,p as $}from"./index-MPbqVnOf.js";M.register(R,T,w,D,S,$);var p=["#2563eb","#16a34a","#9333ea","#ea580c","#0891b2"],F=["#60a5fa","#4ade80","#c084fc","#fb923c","#22d3ee"],A=new Intl.NumberFormat(void 0,{maximumFractionDigits:4}),E=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});function b(e,t){return t==="$"?j(e):t==="ms"?k(e):`${A.format(e)}${t==="count"||t.length===0?"":` ${t}`}`}function O(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:E.format(t)}function I({graph:e,definition:t,error:u}){const l=L(),r=l==="dark"?F:p,n=l==="dark"?"#a1a1aa":"#71717a",m=l==="dark"?"#27272a":"#e4e4e7",c=d.useMemo(()=>e==null?[]:[...new Set(e.graphLines.flatMap(s=>s.values.map(o=>o.timestamp)))].sort(),[e]),f=d.useMemo(()=>({labels:c.map(O),datasets:(e==null?void 0:e.graphLines.map((s,o)=>{const N=new Map(s.values.map(i=>[i.timestamp,i.value])),x=r[o%r.length];return{label:s.name,data:c.map(i=>N.get(i)??null),borderColor:x,backgroundColor:x,pointRadius:2,pointHoverRadius:4,borderWidth:2,tension:.25,spanGaps:!0}}))??[]}),[r,e,c]),v=d.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:!1,interaction:{intersect:!1,mode:"index"},plugins:{legend:{display:((e==null?void 0:e.graphLines.length)??0)>1,labels:{color:n,boxWidth:10,boxHeight:2}},tooltip:{callbacks:{label:s=>{const o=s.parsed.y;return`${s.dataset.label??""}: ${o==null?"—":b(o,(e==null?void 0:e.unit)??"")}`}}}},scales:{x:{grid:{display:!1},border:{color:m},ticks:{color:n,maxRotation:0,autoSkip:!0,maxTicksLimit:8}},y:{beginAtZero:!0,grid:{color:m},border:{display:!1},ticks:{color:n,callback:s=>b(Number(s),(e==null?void 0:e.unit)??"")}}}}),[n,e,m]),y=(e==null?void 0:e.graphLines.some(s=>s.values.length>0))===!0;return a.jsxs("section",{className:"min-w-0 rounded-lg border border-border bg-card-bg p-4","data-slot":"agent-metric-chart",children:[a.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:(e==null?void 0:e.displayName)??t.displayName}),a.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:(e==null?void 0:e.description)??t.description}),a.jsx("div",{className:"mt-4 h-64",children:u!=null?a.jsx("div",{className:"flex h-full items-center justify-center text-sm text-failure-bg",children:u}):y?a.jsx(C,{data:f,options:v}):a.jsx("div",{className:"flex h-full items-center justify-center text-sm text-text-secondary",children:"No data"})})]})}export{I as AgentMetricChart};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as R,r as _,j as e,I as O,d as D}from"./index-
|
|
1
|
+
import{b as R,r as _,j as e,I as O,d as D}from"./index-G4wOqi3O.js";var i="text-right font-mono text-primary-button-bg";function p(t){return typeof t=="object"&&t!=null}function u(t){return!("name"in t)||typeof t.name!="string"?null:t.name}function x(t,...a){for(const l of a){const c=t==null?void 0:t[l];if(c!==void 0)return c}}function U(t){if(!p(t))return!1;const a=x(t,"enableTools","enable_tools");return a===void 0||Array.isArray(a)&&a.includes("@all")}function V(t){const a=t.lastIndexOf("/");return a>=0?t.slice(a+1):t}function L({detail:t}){var C,S,A,I,M,E,T,$;const a=R("Markdown"),l=R("AgentOverviewCard"),[c,F]=_.useState("markdown"),[h,g]=_.useState(!1),n=t.agentSpec,f=n.skills??[],b=n.mcpServers??[],j=p(n.model.params)?n.model.params:null,y=x(j,"maxTokens","max_tokens"),N=x(j,"temperature"),o=p(n.config)?n.config:null,m=p(o==null?void 0:o.sandbox)?o.sandbox:null,d=(C=n.instructions)!=null&&C.trim()?n.instructions:null,v=[["Sandbox",typeof(m==null?void 0:m.enabled)=="boolean"?m.enabled?"Enabled":"Disabled":void 0],["Iteration limit",x(o,"iterationLimit","iteration_limit")],["Response format",x(o,"responseFormat","response_format")]].filter(s=>typeof s[1]=="string"||typeof s[1]=="number"),w=[["Generative UI",(A=(S=n.config)==null?void 0:S.generativeUi)==null?void 0:A.enabled],["Dynamic sub-agents",(M=(I=n.config)==null?void 0:I.dynamicSubAgents)==null?void 0:M.enabled],["Ask user questions",(T=(E=n.config)==null?void 0:E.askUserQuestions)==null?void 0:T.enabled]].filter(s=>typeof s[1]=="boolean"),k=c==="markdown"?"Raw":"Markdown";return e.jsxs("div",{className:"grid min-h-0 flex-1 gap-3 overflow-auto p-4 md:grid-cols-[minmax(0,1fr)_18rem] md:overflow-hidden",children:[e.jsxs("section",{className:"flex min-h-64 flex-col rounded-lg border border-border bg-card-bg p-4 text-text-primary",children:[e.jsxs("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-2",children:[e.jsxs("h2",{className:"flex items-center gap-1.5 text-sm font-semibold text-text-primary",children:[e.jsx(O,{name:"book-open",className:"size-4 text-text-secondary"}),"Instructions"]}),d?e.jsxs("div",{className:"inline-flex h-7 items-stretch overflow-hidden rounded-md border border-border bg-primary-bg text-xs font-medium text-text-secondary",role:"group","aria-label":"Instructions actions",children:[e.jsx("button",{type:"button","aria-label":`Show ${k}`,onClick:()=>F(s=>s==="markdown"?"raw":"markdown"),className:"cursor-pointer px-2.5 transition-colors hover:bg-ghost-button-hover hover:text-text-primary",children:k}),e.jsx("span",{className:"w-px self-stretch bg-border","aria-hidden":!0}),e.jsx("button",{type:"button",title:h?"Copied!":"Copy","aria-label":h?"Copied!":"Copy",onClick:()=>{navigator.clipboard.writeText(d).then(()=>{g(!0),setTimeout(()=>g(!1),2e3)})},className:"inline-flex cursor-pointer items-center justify-center px-2 transition-colors hover:bg-ghost-button-hover hover:text-text-primary",children:e.jsx(O,{name:h?"check":"copy",size:12})})]}):null]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:d?c==="markdown"?e.jsx(a,{content:d,readOnly:!0,className:"text-sm"}):e.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-sm text-text-primary",children:d}):e.jsx("p",{className:"text-sm text-text-secondary",children:"No instructions for this agent."})})]}),e.jsxs("aside",{className:"flex min-h-0 min-w-0 flex-col gap-3 md:overflow-auto",children:[e.jsx(l,{title:"Model Configuration",icon:"cpu",children:e.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs",children:[e.jsx("dt",{className:"text-text-secondary",children:"Model"}),e.jsx("dd",{className:D(i,"truncate"),title:n.model.name,children:V(n.model.name)}),typeof y=="number"?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-text-secondary",children:"Max tokens"}),e.jsx("dd",{className:i,children:y})]}):null,(($=n.model.params)==null?void 0:$.reasoningEffort)!==void 0?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-text-secondary",children:"Reasoning"}),e.jsx("dd",{className:i,children:n.model.params.reasoningEffort})]}):null,typeof N=="number"?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-text-secondary",children:"Temperature"}),e.jsx("dd",{className:i,children:N})]}):null]})}),e.jsx(l,{title:"MCP Servers",icon:"plug",count:b.length,children:b.length===0?e.jsx("p",{className:"text-xs text-text-secondary",children:"No connectors attached."}):e.jsx("ul",{className:"space-y-1.5",children:b.map((s,r)=>e.jsx("li",{className:"rounded-md bg-secondary-bg px-2 py-1.5 text-xs",children:e.jsxs("span",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate",children:u(s)??`Connector ${r+1}`}),U(s)?e.jsx("span",{className:"shrink-0 rounded-full bg-primary-button-bg/10 px-1.5 py-0.5 text-[10px] text-primary-button-bg",children:"All tools"}):null]})},`${u(s)??"connector"}-${r}`))})}),e.jsx(l,{title:"Attached Skills",icon:"lightbulb",count:f.length,children:f.length===0?e.jsx("p",{className:"text-xs text-text-secondary",children:"No skills attached."}):e.jsx("ul",{className:"space-y-1.5",children:f.map((s,r)=>e.jsx("li",{className:"rounded-md bg-secondary-bg px-2 py-1.5 text-xs",children:u(s)??`Skill ${r+1}`},`${u(s)??"skill"}-${r}`))})}),v.length>0?e.jsx(l,{title:"Execution",icon:"terminal",children:e.jsx("dl",{className:"space-y-1 text-xs",children:v.map(([s,r])=>e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-text-secondary",children:s}),e.jsx("dd",{className:i,children:r})]},s))})}):null,w.length>0?e.jsx(l,{title:"Capabilities",icon:"cube",children:e.jsx("dl",{className:"space-y-1 text-xs",children:w.map(([s,r])=>e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-text-secondary",children:s}),e.jsx("dd",{className:i,children:r?"Enabled":"Disabled"})]},s))})}):null]})]})}export{L as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as u,z as b,r,A as f,j as t,B as h,d as S}from"./index-G4wOqi3O.js";function g({turns:l,segments:a,onSelectTurn:o}){const d=u("AgentSessionEventTimelineChart"),c=b()==="dark",[i,x]=r.useState(()=>new Set),p=r.useMemo(()=>{const e=new Set(a.map(s=>s.type));return f.filter(s=>e.has(s.id))},[a]),m=r.useCallback(e=>{x(s=>{const n=new Set(s);return n.has(e)?n.delete(e):n.add(e),n})},[]);return a.length===0?null:t.jsxs("div",{className:"w-full","data-slot":"agent-session-event-timeline",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2","data-slot":"agent-session-event-types",children:[t.jsx("span",{className:"text-xs font-medium uppercase text-text-secondary",children:"Event types"}),t.jsx("div",{className:"flex flex-wrap items-center gap-1",children:p.map(e=>{const s=!i.has(e.id);return t.jsxs("button",{type:"button","aria-pressed":s,className:S("flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium",s?"border-border text-text-primary":"border-transparent text-text-secondary opacity-80"),onClick:()=>m(e.id),children:[t.jsx("span",{className:"size-2 rounded-sm",style:{backgroundColor:h(e.id,c)}}),e.label]},e.id)})})]}),t.jsx("div",{className:"w-full py-2",children:t.jsx(d,{turns:l,segments:a,hiddenTypes:i,onSelectTurn:o})})]})}export{g as AgentSessionEventTimeline};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as q,r,D as Re,E as Ie,F as Pe,G as De,H as Le,M as Ge,J as Be,K as m,B as E,L as $,N as J,O as Oe,Q as $e,R as He,U as Xe,j as s,V as We,W as Ue,X as ze,Y as Fe,Z as Ve,$ as Ke,a0 as S,a1 as Ye,a2 as ve}from"./index-G4wOqi3O.js";import{C as Je,a as Qe,B as Ze,b as qe,L as et,P as tt,S as st,p as nt}from"./index-MPbqVnOf.js";function rt(n){return n.type!=="system"||n.description.trim().length>0}function Me({segment:n,subAgentLabel:a}){const d=!n.isMarker&&!Ye.has(n.type),i=n.description.trim();return n.type==="system"?i.length===0?null:s.jsx("p",{className:"max-w-[25rem] whitespace-normal break-words text-xs font-medium text-text-primary",children:i}):s.jsxs("div",{className:"max-h-72 max-w-[25rem] overflow-auto whitespace-normal break-words text-xs",children:[a!=null?s.jsx("div",{className:"border-b border-border py-1.5 text-text-secondary",children:`Sub-Agent: ${a}`}):null,s.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1",children:[s.jsx("span",{className:n.type==="error"?"font-medium text-failure-bg":"font-medium text-text-secondary",children:ve(n.type)}),d?s.jsx("span",{className:"tabular-nums text-text-secondary",children:S(n.endMs-n.startMs)}):null]}),i.length>0?s.jsx("p",{className:"mt-1.5 line-clamp-6 font-medium text-text-primary",children:i}):null]})}function at({turn:n,turnNumber:a,durationMs:d,segments:i}){const C=q()==="dark";return s.jsxs("div",{className:"max-h-72 w-72 max-w-full overflow-auto text-xs text-text-primary",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"font-semibold",children:`Turn ${a}`}),s.jsx("span",{className:"tabular-nums text-text-secondary",children:Fe(d)})]}),s.jsxs("div",{className:"mt-1 flex flex-col text-text-secondary",children:[n.totalCostInUsd!=null?s.jsx("span",{children:`Cost: ${Ve(n.totalCostInUsd)}`}):null,n.totalTokens!=null?s.jsx("span",{children:`Tokens: ${Ke(n.totalTokens)}`}):null]}),s.jsx("div",{className:"mt-2 border-t border-border pt-2",children:i.map(l=>{const b=l.type==="tool_call"||l.type==="sub_agent"?l.description:l.title;return s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:E(l.type,C)}}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:b}),l.isMarker?null:s.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-text-secondary",children:S(l.endMs-l.startMs)})]},l.id)})})]})}function ot({group:n}){return s.jsxs("div",{className:"max-h-72 w-80 max-w-full overflow-auto text-xs",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"font-medium text-text-secondary",children:"Tool calls"}),s.jsx("span",{className:"tabular-nums text-text-secondary",children:S(n.endMs-n.startMs)})]}),s.jsx("div",{className:"mt-1.5 border-t border-border pt-1.5",children:n.segments.map(a=>s.jsxs("div",{className:"flex items-center justify-between gap-2 py-0.5",children:[s.jsx("span",{className:"min-w-0 truncate font-medium text-text-primary",children:a.description||a.title}),s.jsx("span",{className:"shrink-0 tabular-nums text-text-secondary",children:S(a.endMs-a.startMs)})]},a.id))})]})}function lt({group:n}){const a=q()==="dark",d=n.segments.length===1?n.segments[0]:void 0;return d!=null?s.jsx(Me,{segment:d}):s.jsxs("div",{className:"max-h-72 w-80 max-w-full overflow-auto text-xs",children:[s.jsx("span",{className:"font-medium text-text-secondary",children:"Events"}),s.jsx("div",{className:"mt-1.5 border-t border-border pt-1.5",children:n.segments.map(i=>s.jsxs("div",{className:"flex min-w-0 items-start gap-1.5 py-0.5",children:[s.jsx("span",{className:"mt-1 size-1.5 shrink-0 rounded-full",style:{backgroundColor:E(i.type,a)}}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-medium text-text-secondary",children:ve(i.type)}),s.jsx("div",{className:"wrap-break-word font-medium text-text-primary",children:i.description.trim()||i.title})]})]},i.id))})]})}function it({group:n}){return s.jsxs("div",{className:"max-h-72 w-80 max-w-full overflow-auto text-xs",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"font-medium text-text-secondary",children:"Sub-agents"}),s.jsx("span",{className:"tabular-nums text-text-secondary",children:S(n.endMs-n.startMs)})]}),s.jsx("div",{className:"mt-1.5 border-t border-border pt-1.5",children:n.segments.map((a,d)=>s.jsxs("div",{className:"flex items-center justify-between gap-2 py-0.5",children:[s.jsx("span",{className:"min-w-0 truncate font-medium text-text-primary",children:n.segments.length===1?a.description||a.title:`Sub-agent ${d+1}: ${a.description||a.title}`}),n.segments.length===1?null:s.jsx("span",{className:"shrink-0 tabular-nums text-text-secondary",children:S(a.endMs-a.startMs)})]},a.id))})]})}Qe.register(Ze,qe,et,tt,st,nt);var Q=4,ye=12,be=12,ct=2,ut=8,dt=2,mt=30;function pt({heights:n,gaps:a}){const d=[];let i=0;return n.forEach((C,l)=>{d.push(i+C/2),i+=C+(a[l]??0)}),{centers:d,band:i}}function Z(n){return n==="sub_agent"?0:n==="model"?2:1}function xt(n){if(!("x"in n)||!("y"in n)||!("base"in n))return null;const{x:a,y:d,base:i}=n;return typeof a!="number"||typeof d!="number"||typeof i!="number"?null:{x:(a+i)/2,y:d}}function yt({turns:n,segments:a,hiddenTypes:d,onSelectTurn:i}){var fe;const l=q()==="dark",b=l?"#8c8c92":"#71717a",H=l?"#27272a":"#e4e4e7",ee=l?"#3f3f46":"#E0ECFD",te=l?"#52525b":"#E0ECFD",X=r.useRef(null),[se,je]=r.useState(0),[ne,we]=r.useState(mt),[o,re]=r.useState(null),[Ne,W]=r.useState(null),U=r.useRef(""),z=r.useRef(null);r.useEffect(()=>{const e=X.current;if(e==null)return;const t=()=>je(e.clientWidth);t();const c=new ResizeObserver(t);return c.observe(e),()=>c.disconnect()},[]);const f=r.useCallback(()=>{const e=X.current,t=z.current;e==null||t==null||W({left:t,top:e.getBoundingClientRect().bottom})},[]),ge=r.useCallback(()=>{U.current="",z.current=null,re(null),W(null)},[]);r.useEffect(()=>{if(o!=null)return f(),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[f,o]);const ke=Math.max(0,...a.map(e=>e.endMs)),v=Math.max(1,Ue(ke)),{turnStartsMs:ae,turnOrdinals:oe,turnRanges:F}=r.useMemo(()=>Re(a),[a]),T=r.useMemo(()=>ae.filter((e,t)=>t===0||e<=v),[v,ae]),le=Math.max(0,T.length-1),Ee=Math.max(se/2,se-ye*le-be),M=v/Math.max(1,Ee),x=ye*M,V=v+le*x,ie=V+be*M,ce=r.useMemo(()=>T.slice(1).map((e,t)=>({startMs:e+t*x,endMs:e+(t+1)*x})),[T,x]),_=r.useMemo(()=>a.flatMap(e=>{if(d.has(e.type))return[];const t=(oe.get(e.turnIndex)??0)*x;return[{...e,startMs:e.startMs+t,endMs:e.endMs+t}]}),[d,a,x,oe]),R=r.useMemo(()=>Ie(_),[_]),j=r.useMemo(()=>_.filter(e=>!e.isMarker),[_]),y=r.useMemo(()=>F.length<2?[]:F.map(e=>({...e,id:`turn-${e.turnIndex}`,durationMs:e.endMs-e.startMs,startMs:e.startMs+e.ordinal*x,endMs:e.endMs+e.ordinal*x+Q*M})),[M,x,F]),w=r.useMemo(()=>j.filter(e=>e.type==="sub_agent"),[j]),I=r.useMemo(()=>Pe(w),[w]),ue=r.useMemo(()=>De({bars:I,subAgentSegments:w}),[I,w]),N=r.useMemo(()=>Le({subAgentSegments:w,threadSegments:j,minWidthMs:Q*M}),[j,M,w]),P=r.useMemo(()=>{const e=new Set(I.map(t=>t.id));return j.filter(t=>t.threadId===Ge||t.type==="sub_agent"&&e.has(t.id))},[j,I]),g=r.useMemo(()=>Be(P.filter(e=>e.type==="tool_call")).filter(e=>e.segments.length>1),[P]),de=r.useMemo(()=>new Set(g.flatMap(e=>e.segments.map(t=>t.id))),[g]),D=r.useMemo(()=>P.filter(e=>!de.has(e.id)),[de,P]),me=N.reduce((e,t)=>Math.max(e,t.lane+1),0),K=y.length>0,A=K?1:0,L=A+1,{centers:k,band:G}=r.useMemo(()=>{const e=[...K?[16]:[],10,28,...Array.from({length:me},()=>12)],t=e.map((c,u)=>u===e.length-1?0:u===A?dt:ut);return pt({heights:e,gaps:t})},[K,me,A]),Y=r.useMemo(()=>[...y.map(e=>({type:m.turn,bar:e})),...R.map(e=>({type:m.markerGroup,group:e})),...N.flatMap(e=>e.segments.map(t=>({type:m.event,segment:t}))),...D.map(e=>{if(e.type!=="sub_agent")return{type:m.event,segment:e};const t=ue.find(c=>c.barId===e.id);return t==null?{type:m.event,segment:e}:{type:m.subAgentGroup,group:t}}),...g.map(e=>({type:m.toolCallGroup,group:e}))],[D,R,ue,N,g,y]),B=({label:e,range:t,y:c,color:u,hover:p,thickness:h,order:O=1,inflateAmount:he})=>({label:e,data:[{x:ze(t),y:c}],backgroundColor:u,hoverBackgroundColor:p,hoverBorderColor:p,borderWidth:0,borderSkipped:!1,borderRadius:ct,minBarLength:Q,barThickness:h,grouped:!1,order:O,...he==null?{}:{inflateAmount:he}}),Se=r.useMemo(()=>({datasets:[...y.map(e=>B({label:`Turn ${e.ordinal+1}`,range:e,y:k[0]??0,color:ee,hover:te,thickness:16})),...R.map(e=>{var u;const t=e.segments.length===1?(u=e.segments[0])==null?void 0:u.type:"system",c=E(t??"system",l);return{type:"scatter",label:e.segments.map(p=>J(p.type)).join(", "),data:[{x:e.startMs,y:k[A]??0}],pointStyle:"rectRot",pointRadius:5,pointHoverRadius:6,clip:!1,backgroundColor:c,hoverBackgroundColor:$(t??"system",l),borderWidth:0,order:0}}),...N.flatMap(e=>e.segments.map(t=>B({label:`${J(t.type)}: ${t.title}`,range:t,y:k[L+1+e.lane]??0,color:E(t.type,l),hover:$(t.type,l),thickness:12,order:Z(t.type),inflateAmount:.5}))),...D.map(e=>B({label:`${J(e.type)}: ${e.title}`,range:e,y:k[L]??0,color:E(e.type,l),hover:$(e.type,l),thickness:28,order:Z(e.type),inflateAmount:.5})),...g.map(e=>B({label:"Parallel tool calls",range:e,y:k[L]??0,color:E("tool_call",l),hover:$("tool_call",l),thickness:28,order:Z("tool_call"),inflateAmount:.5}))]}),[k,L,l,D,R,A,N,g,y,ee,te]),Ce=r.useMemo(()=>({id:"turnLabels",afterDatasetsDraw(e){const{ctx:t}=e;t.save(),t.fillStyle=b,t.font="500 10px sans-serif",t.textAlign="center",t.textBaseline="middle",y.forEach((c,u)=>{const p=e.getDatasetMeta(u).data[0];if(p==null)return;const h=xt(p);h&&t.fillText(`T${c.ordinal+1}`,h.x,h.y)}),t.restore()}}),[b,y]),Te=r.useMemo(()=>({id:"timelineOverhead",afterLayout(e){const t=Math.round(e.height-e.chartArea.height);we(c=>c===t?c:t)}}),[]),Ae=r.useMemo(()=>({indexAxis:"y",animation:!1,responsive:!0,maintainAspectRatio:!1,onClick:(e,t)=>{var u;const c=Y[((u=t[0])==null?void 0:u.datasetIndex)??-1];(c==null?void 0:c.type)===m.turn&&(i==null||i(c.bar.turnIndex))},onHover:(e,t)=>{var O;const c=(O=t[0])==null?void 0:O.datasetIndex,u=c==null?null:Y[c]??null,p=e.native;if((p==null?void 0:p.target)instanceof HTMLElement&&(p.target.style.cursor=(u==null?void 0:u.type)===m.turn?"pointer":"default"),p instanceof MouseEvent&&(z.current=p.clientX,f()),c==null)return;const h=Xe(u);if(U.current!==h){if(U.current=h,re(u),u==null){W(null);return}f()}},plugins:{legend:{display:!1},tooltip:{enabled:!1}},scales:{x:{type:"linear",position:"top",min:0,max:ie,grid:{color:H},border:{color:H},afterBuildTicks:e=>{e.ticks=He({activeTotalMs:v,turnStartsMs:T,turnGapMs:x})},ticks:{color:b,autoSkip:!1,includeBounds:!1,maxTicksLimit:9,callback:e=>{const t=Number(e);return t<=V?Oe($e(t,ce)):""}}},y:{type:"linear",display:!1,reverse:!0,offset:!1,min:0,max:G,grid:{display:!1}}}}),[v,T,b,G,Y,H,i,f,ce,ie,V,x]),pe=(o==null?void 0:o.type)===m.turn?n[o.bar.turnIndex]:void 0,_e=r.useMemo(()=>({height:G+ne}),[G,ne]),xe=(o==null?void 0:o.type)===m.turn&&pe!=null?s.jsx(at,{turn:pe,turnNumber:o.bar.ordinal+1,durationMs:o.bar.durationMs,segments:a.filter(e=>e.turnIndex===o.bar.turnIndex)}):(o==null?void 0:o.type)===m.event&&rt(o.segment)?s.jsx(Me,{segment:o.segment,subAgentLabel:o.segment.type==="sub_agent"||(fe=N.find(e=>e.threadId===o.segment.threadId))==null?void 0:fe.track.description}):(o==null?void 0:o.type)===m.toolCallGroup?s.jsx(ot,{group:o.group}):(o==null?void 0:o.type)===m.markerGroup?s.jsx(lt,{group:o.group}):(o==null?void 0:o.type)===m.subAgentGroup?s.jsx(it,{group:o.group}):null;return s.jsx("div",{ref:X,className:"w-full","data-slot":"agent-session-event-timeline-chart",children:s.jsx(We,{title:xe,side:"bottom",triggerClassName:"block w-full",followCursor:!0,open:o!=null&&xe!=null,className:"max-w-[min(25rem,calc(100vw-1rem))] whitespace-normal",anchor:Ne,children:s.jsx("div",{className:"w-full",style:_e,onMouseLeave:ge,children:s.jsx(Je,{type:"bar",data:Se,options:Ae,plugins:[Ce,Te]})})})})}export{yt as AgentSessionEventTimelineChart};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var je=e=>{throw TypeError(e)};var Ae=(e,t,n)=>t.has(e)||je("Cannot "+n);var fe=(e,t,n)=>(Ae(e,t,"read from private field"),n?n.call(e):t.get(e)),Fe=(e,t,n)=>t.has(e)?je("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Oe=(e,t,n,o)=>(Ae(e,t,"write to private field"),o?o.call(e,n):t.set(e,n),n);import{a as xt}from"./chunk-WVE3F724-CL71bP7s.js";import{r as z,j as R,b9 as zt,a1 as wt,u as Ct,ba as Lt,bb as Pt,b as xe,bc as Rt,p as Ge,ab as Et,aa as Be,I as kt,d as Mt,bd as Dt}from"./index-DVCxCjDg.js";function It(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function Nt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function Tt(e){return e/100*window.innerHeight}function jt(e){return e/100*window.innerWidth}function At(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function pe({groupSize:e,panelElement:t,styleProp:n}){let o;const[r,s]=At(n);switch(s){case"%":{o=r/100*e;break}case"px":{o=r;break}case"rem":{o=Nt(t,r);break}case"em":{o=It(t,r);break}case"vh":{o=Tt(r);break}case"vw":{o=jt(r);break}}return o}function G(e){return parseFloat(e.toFixed(3))}function ue({group:e}){const{orientation:t,panels:n}=e;return n.reduce((o,r)=>(o+=t==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o),0)}function Ce(e){const{panels:t}=e,n=ue({group:e});return n===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:r,panelConstraints:s}=o;let u=0;if(s.collapsedSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:s.collapsedSize});u=G(c/n*100)}let a;if(s.defaultSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:s.defaultSize});a=G(c/n*100)}let i=0;if(s.minSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:s.minSize});i=G(c/n*100)}let l=100;if(s.maxSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:s.maxSize});l=G(c/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:u,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:i,maxSize:l,panelId:o.id}})}function M(e,t="Assertion error"){if(!e)throw Error(t)}function Le(e,t){return Array.from(t).sort(e==="horizontal"?Ft:Ot)}function Ft(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Ot(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function rt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function it(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Gt({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let r,s=Number.MAX_VALUE;for(const u of t){const{x:a,y:i}=it(o,u),l=e==="horizontal"?a:i;l<s&&(s=l,r=u)}return M(r,"No rect found"),r}let be;function Bt(){return be===void 0&&(typeof matchMedia=="function"?be=!!matchMedia("(pointer:coarse)").matches:be=!1),be}function st(e){const{element:t,orientation:n,panels:o,separators:r}=e,s=Le(n,Array.from(t.children).filter(rt).map(v=>({element:v}))).map(({element:v})=>v),u=[];let a=!1,i=!1,l=-1,c=-1,h=0,f,x=[];{let v=-1;for(const d of s)d.hasAttribute("data-panel")&&(v++,d.hasAttribute("data-disabled")||(h++,l===-1&&(l=v),c=v))}if(h>1){let v=-1;for(const d of s)if(d.hasAttribute("data-panel")){v++;const g=o.find(p=>p.element===d);if(g){if(f){const p=f.element.getBoundingClientRect(),b=d.getBoundingClientRect();let S;if(i){const y=n==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),m=n==="horizontal"?new DOMRect(b.left,b.top,0,b.height):new DOMRect(b.left,b.top,b.width,0);switch(x.length){case 0:{S=[y,m];break}case 1:{const k=x[0],C=Gt({orientation:n,rects:[p,b],targetRect:k.element.getBoundingClientRect()});S=[k,C===p?m:y];break}default:{S=x;break}}}else x.length?S=x:S=[n==="horizontal"?new DOMRect(p.right,b.top,b.left-p.right,b.height):new DOMRect(b.left,p.bottom,b.width,b.top-p.bottom)];for(const y of S){let m="width"in y?y:y.element.getBoundingClientRect();const k=Bt()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(m.width<k){const N=k-m.width;m=new DOMRect(m.x-N/2,m.y,m.width+N,m.height)}if(m.height<k){const N=k-m.height;m=new DOMRect(m.x,m.y-N/2,m.width,m.height+N)}const C=v<=l||v>c;!a&&!C&&u.push({group:e,groupSize:ue({group:e}),panels:[f,g],separator:"width"in y?void 0:y,rect:m}),a=!1}}i=!1,f=g,x=[]}}else if(d.hasAttribute("data-separator")){d.ariaDisabled!==null&&(a=!0);const g=r.find(p=>p.element===d);g?x.push(g):(f=void 0,x=[])}else i=!0}return u}var Y;class at{constructor(){Fe(this,Y,{})}addListener(t,n){const o=fe(this,Y)[t];return o===void 0?fe(this,Y)[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=fe(this,Y)[t];if(o!==void 0)if(o.length===1)o[0].call(null,n);else{let r=!1,s=null;const u=Array.from(o);for(let a=0;a<u.length;a++){const i=u[a];try{i.call(null,n)}catch(l){s===null&&(r=!0,s=l)}}if(r)throw s}}removeAllListeners(){Oe(this,Y,{})}removeListener(t,n){const o=fe(this,Y)[t];if(o!==void 0){const r=o.indexOf(n);r>=0&&o.splice(r,1)}}}Y=new WeakMap;let ae={cursorFlags:0,state:"inactive"};const Re=new at;function Z(){return ae}function $t(e){return Re.addListener("change",e)}function Ht(e){const t=ae,n={...ae};n.cursorFlags=e,ae=n,Re.emit("change",{prev:t,next:n})}function le(e){const t=ae;ae=e,Re.emit("change",{prev:t,next:e})}const Wt=e=>e,ze=()=>{},lt=1,ut=2,ct=4,dt=8,$e=3,He=12;let ye;function We(){return ye===void 0&&(ye=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ye=!0)),ye}function Ut({cursorFlags:e,groups:t,state:n}){let o=0,r=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{o++;break}case"vertical":{r++;break}}})}if(!(o===0&&r===0)){switch(n){case"active":{if(e&&We()){const s=(e<)!==0,u=(e&ut)!==0,a=(e&ct)!==0,i=(e&dt)!==0;if(s)return a?"se-resize":i?"ne-resize":"e-resize";if(u)return a?"sw-resize":i?"nw-resize":"w-resize";if(a)return"s-resize";if(i)return"n-resize"}break}}return We()?o>0&&r>0?"move":o>0?"ew-resize":"ns-resize":o>0&&r>0?"grab":o>0?"col-resize":"row-resize"}}const Ue=new WeakMap;function Ee(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Ue.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const o=Z();switch(o.state){case"active":case"hover":{const r=Ut({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),s=`*, *:hover {cursor: ${r} !important; }`;if(t===s)return;t=s,r?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Ue.set(e,{prevStyle:t,styleSheet:n})}let W=new Map;const ft=new at;function Vt(e){W=new Map(W),W.delete(e)}function Ve(e,t){for(const[n]of W)if(n.id===e)return n}function q(e,t){for(const[n,o]of W)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function X(){return W}function ke(e,t){return ft.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function U(e,t,n){const o=W.get(e);W=new Map(W),W.set(e,t),ft.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:o,next:t})}function pt(e){const t=Z(),n=X();let o=!1;switch(t.state){case"active":le({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Ee(e),o=!0,t.hitRegions.forEach(r=>{if(!n.has(r.group))return;const s=q(r.group.id,!0);U(r.group,s,{isUserInteraction:!0})}))}return o}function Ye(e){e.defaultPrevented||pt(e.currentTarget)}function Yt(e,t,n){let o,r={x:1/0,y:1/0};for(const s of t){const u=it(n,s.rect);switch(e){case"horizontal":{u.x<=r.x&&(o=s,r=u);break}case"vertical":{u.y<=r.y&&(o=s,r=u);break}}}return o?{distance:r,hitRegion:o}:void 0}function qt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Xt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:_e(e),b:_e(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();M(o,"Stacking order can only be calculated for elements with a common ancestor");const r={a:Xe(qe(n.a)),b:Xe(qe(n.b))};if(r.a===r.b){const s=o.childNodes,u={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const i=s[a];if(i===u.a)return 1;if(i===u.b)return-1}}return Math.sign(r.a-r.b)}const _t=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Jt(e){const t=getComputedStyle(ht(e)??e).display;return t==="flex"||t==="inline-flex"}function Kt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Jt(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||_t.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function qe(e){let t=e.length;for(;t--;){const n=e[t];if(M(n,"Missing node"),Kt(n))return n}return null}function Xe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _e(e){const t=[];for(;e;)t.push(e),e=ht(e);return t}function ht(e){const{parentNode:t}=e;return qt(t)?t.host:t}function Zt(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Qt({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!rt(n)||n.contains(e)||e.contains(n))return!0;if(Xt(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(Zt(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function Me(e,t){const n=[];return t.forEach((o,r)=>{if(r.disabled)return;const s=st(r),u=Yt(r.orientation,s,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&Qt({groupElement:r.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&n.push(u.hitRegion)}),n}function en(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function O(e,t,n=0){return Math.abs(G(e)-G(t))<=n}function H(e,t){return O(e,t)?0:e>t?1:-1}function se({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:r=0,collapsible:s,disabled:u,maxSize:a=100,minSize:i=0}=t;if(u&&!e)return n;if(H(o,i)<0)if(s){const l=(r+i)/2;H(o,l)<0?o=r:o=i}else o=i;return o=Math.min(a,o),o=G(o),o}function ge({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:s}){if(O(e,0))return t;const u=s==="imperative-api",a=Object.values(t),i=Object.values(r),l=[...a],[c,h]=o;M(c!=null,"Invalid first pivot index"),M(h!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const d=e<0?h:c,g=n[d];M(g,`Panel constraints not found for index ${d}`);const{collapsedSize:p=0,collapsible:b,minSize:S=0}=g;if(b){const y=a[d];if(M(y!=null,`Previous layout not found for panel index ${d}`),O(y,p)){const m=S-y;H(m,Math.abs(e))>0&&(e=e<0?0-m:m)}}}{const d=e<0?c:h,g=n[d];M(g,`No panel constraints found for index ${d}`);const{collapsedSize:p=0,collapsible:b,minSize:S=0}=g;if(b){const y=a[d];if(M(y!=null,`Previous layout not found for panel index ${d}`),O(y,S)){const m=y-p;H(m,Math.abs(e))>0&&(e=e<0?0-m:m)}}}break}default:{const d=e<0?h:c,g=n[d];M(g,`Panel constraints not found for index ${d}`);const p=a[d],{collapsible:b,collapsedSize:S,minSize:y}=g;if(b&&H(p,y)<0)if(e>0){const m=y-S,k=m/2,C=p+e;H(C,y)<0&&(e=H(e,k)<=0?0:m)}else{const m=y-S,k=100-m/2,C=p-e;H(C,y)<0&&(e=H(100+e,k)>0?0:-m)}break}}{const d=e<0?1:-1;let g=e<0?h:c,p=0;for(;;){const S=a[g];M(S!=null,`Previous layout not found for panel index ${g}`);const y=se({overrideDisabledPanels:u,panelConstraints:n[g],prevSize:S,size:100})-S;if(p+=y,g+=d,g<0||g>=n.length)break}const b=Math.min(Math.abs(e),Math.abs(p));e=e<0?0-b:b}{let d=e<0?c:h;for(;d>=0&&d<n.length;){const g=Math.abs(e)-Math.abs(f),p=a[d];M(p!=null,`Previous layout not found for panel index ${d}`);const b=p-g,S=se({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:p,size:b});if(!O(p,S)&&(f+=p-S,l[d]=S,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?d--:d++}}if(en(i,l))return r;{const d=e<0?h:c,g=a[d];M(g!=null,`Previous layout not found for panel index ${d}`);const p=g+f,b=se({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:g,size:p});if(l[d]=b,!O(b,p)){let S=p-b,y=e<0?h:c;for(;y>=0&&y<n.length;){const m=l[y];M(m!=null,`Previous layout not found for panel index ${y}`);const k=m+S,C=se({overrideDisabledPanels:u,panelConstraints:n[y],prevSize:m,size:k});if(O(m,C)||(S-=C-m,l[y]=C),O(S,0))break;e>0?y--:y++}}}const x=Object.values(l).reduce((d,g)=>g+d,0);if(!O(x,100,.1))return r;const v=Object.keys(r);return l.reduce((d,g,p)=>(d[v[p]]=g,d),{})}function Q(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||H(e[n],t[n])!==0)return!1;return!0}function ee({layout:e,panelConstraints:t}){const n=Object.values(e),o=[...n],r=o.reduce((a,i)=>a+i,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(a=>`${a}%`).join(", ")}`);if(!O(r,100)&&o.length>0)for(let a=0;a<t.length;a++){const i=o[a];M(i!=null,`No layout data found for index ${a}`);const l=100/r*i;o[a]=l}let s=0;for(let a=0;a<t.length;a++){const i=n[a];M(i!=null,`No layout data found for index ${a}`);const l=o[a];M(l!=null,`No layout data found for index ${a}`);const c=se({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:i,size:l});l!=c&&(s+=l-c,o[a]=c)}if(!O(s,0))for(let a=0;a<t.length;a++){const i=o[a];M(i!=null,`No layout data found for index ${a}`);const l=i+s,c=se({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:i,size:l});if(i!==c&&(s-=c-i,o[a]=c,O(s,0)))break}const u=Object.keys(e);return o.reduce((a,i,l)=>(a[u[l]]=i,a),{})}function gt({groupId:e,panelId:t}){const n=()=>{const i=X();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:h,layout:f,groupSize:x,separatorToPanels:v}]of i)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:h,group:l,groupSize:x,layout:f,separatorToPanels:v};throw Error(`Group ${e} not found`)},o=()=>{const i=n().derivedPanelConstraints.find(l=>l.panelId===t);if(i!==void 0)return i;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const i=n().group.panels.find(l=>l.id===t);if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const i=n().layout[t];if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:i,panels:l,prevLayout:c,derivedPanelConstraints:h})=>{const f=s(),x=l.findIndex(g=>g.id===t),v=x===0,d=x===l.length-1;if(d&&i<f&&(v||l.slice(0,x).every((g,p)=>{const b=h[p];return(b==null?void 0:b.collapsible)&&O(b.collapsedSize,c[b.panelId])}))){const g=l.slice(0,x).reduce((p,b)=>p+c[b.id],0);return{...c,[t]:G(100-g)}}return ge({delta:d?f-i:i-f,initialLayout:c,panelConstraints:h,pivotIndices:d?[x-1,x]:[x,x+1],prevLayout:c,trigger:"imperative-api"})},a=i=>{const l=s();if(i===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:h,group:f,groupSize:x,layout:v,separatorToPanels:d}=n(),g=u({nextSize:i,panels:f.panels,prevLayout:v,derivedPanelConstraints:h}),p=ee({layout:g,panelConstraints:h});Q(v,p)||U(f,{defaultLayoutDeferred:c,derivedPanelConstraints:h,groupSize:x,layout:p,separatorToPanels:d})};return{collapse:()=>{const{collapsible:i,collapsedSize:l}=o(),{mutableValues:c}=r(),h=s();i&&h!==l&&(c.expandToSize=h,a(l))},expand:()=>{const{collapsible:i,collapsedSize:l,minSize:c}=o(),{mutableValues:h}=r(),f=s();if(i&&f===l){let x=h.expandToSize??c;x===0&&(x=1),a(x)}},getSize:()=>{const{group:i}=n(),l=s(),{element:c}=r(),h=i.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:h}},isCollapsed:()=>{const{collapsible:i,collapsedSize:l}=o(),c=s();return i&&O(l,c)},resize:i=>{const{group:l}=n(),{element:c}=r(),h=ue({group:l}),f=pe({groupSize:h,panelElement:c,styleProp:i}),x=G(f/h*100);a(x)}}}function Je(e){if(e.defaultPrevented)return;const t=X();Me(e,t).forEach(n=>{if(n.separator&&!n.separator.disableDoubleClick){const o=n.panels.find(r=>r.panelConstraints.defaultSize!==void 0);if(o){const r=o.panelConstraints.defaultSize,s=gt({groupId:n.group.id,panelId:o.id});s&&r!==void 0&&(s.resize(r),e.preventDefault())}}})}function Se(e){const t=X();for(const[n]of t)if(n.separators.some(o=>o.element===e))return n;throw Error("Could not find parent Group for separator element")}function mt({groupId:e}){const t=()=>{const n=X();for(const[o,r]of n)if(o.id===e)return{group:o,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:o}=t();return n?{}:o},setLayout(n){const{defaultLayoutDeferred:o,derivedPanelConstraints:r,group:s,groupSize:u,layout:a,separatorToPanels:i}=t(),l=ee({layout:n,panelConstraints:r});return o?a:(Q(a,l)||U(s,{defaultLayoutDeferred:o,derivedPanelConstraints:r,groupSize:u,layout:l,separatorToPanels:i}),l)}}}function K(e,t){const n=Se(e),o=q(n.id,!0),r=n.separators.find(c=>c.element===e);M(r,"Matching separator not found");const s=o.separatorToPanels.get(r);M(s,"Matching panels not found");const u=s.map(c=>n.panels.indexOf(c)),a=mt({groupId:n.id}).getLayout(),i=ge({delta:t,initialLayout:a,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:a,trigger:"keyboard"}),l=ee({layout:i,panelConstraints:o.derivedPanelConstraints});Q(a,l)||U(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:l,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Ke(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Se(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&K(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&K(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&K(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&K(t,-5);break}case"End":{e.preventDefault(),K(t,100);break}case"Enter":{e.preventDefault();const o=Se(t),r=q(o.id,!0),{derivedPanelConstraints:s,layout:u,separatorToPanels:a}=r,i=o.separators.find(f=>f.element===t);M(i,"Matching separator not found");const l=a.get(i);M(l,"Matching panels not found");const c=l[0],h=s.find(f=>f.panelId===c.id);if(M(h,"Panel metadata not found"),h.collapsible){const f=u[c.id],x=h.collapsedSize===f?o.mutableState.expandedPanelSizes[c.id]??h.minSize:h.collapsedSize;K(t,x-f)}break}case"F6":{e.preventDefault();const o=Se(t).separators.map(u=>u.element),r=Array.from(o).findIndex(u=>u===e.currentTarget);M(r!==null,"Index not found");const s=e.shiftKey?r>0?r-1:o.length-1:r+1<o.length?r+1:0;o[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),K(t,-100);break}}}function Ze(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=X(),n=Me(e,t),o=new Map;let r=!1;n.forEach(s=>{s.separator&&(r||(r=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(s.group);u&&o.set(s.group,u.layout)}),le({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function vt({document:e,event:t,hitRegions:n,initialLayoutMap:o,mountedGroups:r,pointerDownAtPoint:s,prevCursorFlags:u}){let a=0;n.forEach(l=>{const{group:c,groupSize:h}=l,{orientation:f,panels:x}=c,{disableCursor:v}=c.mutableState;let d=0;s?f==="horizontal"?d=(t.clientX-s.x)/h*100:d=(t.clientY-s.y)/h*100:f==="horizontal"?d=t.clientX<0?-100:100:d=t.clientY<0?-100:100;const g=o.get(c),p=r.get(c);if(!g||!p)return;const{defaultLayoutDeferred:b,derivedPanelConstraints:S,groupSize:y,layout:m,separatorToPanels:k}=p;if(S&&m&&k){const C=ge({delta:d,initialLayout:g,panelConstraints:S,pivotIndices:l.panels.map(N=>x.indexOf(N)),prevLayout:m,trigger:"mouse-or-touch"});if(Q(C,m)){if(d!==0&&!v)switch(f){case"horizontal":{a|=d<0?lt:ut;break}case"vertical":{a|=d<0?ct:dt;break}}}else U(l.group,{defaultLayoutDeferred:b,derivedPanelConstraints:S,groupSize:y,layout:C,separatorToPanels:k})}});let i=0;t.movementX===0?i|=u&$e:i|=a&$e,t.movementY===0?i|=u&He:i|=a&He,Ht(i),Ee(e)}function Qe(e){const t=X(),n=Z();switch(n.state){case"active":vt({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function et(e){var o,r;if(e.defaultPrevented)return;const t=Z(),n=X();switch(t.state){case"active":{if(e.buttons===0){le({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{if(!n.has(s.group))return;const u=q(s.group.id,!0);U(s.group,u,{isUserInteraction:!0})});return}for(const s of t.hitRegions)if(s.separator){const{element:u}=s.separator;(o=u.hasPointerCapture)!=null&&o.call(u,e.pointerId)||((r=u.setPointerCapture)==null||r.call(u,e.pointerId))}vt({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=Me(e,n);s.length===0?t.state!=="inactive"&&le({cursorFlags:0,state:"inactive"}):le({cursorFlags:0,hitRegions:s,state:"hover"}),Ee(e.currentTarget);break}}}function tt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Z().state){case"hover":le({cursorFlags:0,state:"inactive"})}}function nt(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||pt(e.currentTarget)&&e.preventDefault()}function ot(e){let t=0,n=0;const o={};for(const s of e)if(s.defaultSize!==void 0){t++;const u=G(s.defaultSize);n+=u,o[s.panelId]=u}else o[s.panelId]=void 0;const r=e.length-t;if(r!==0){const s=G((100-n)/r);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=s)}return o}function tn(e,t,n){if(!n[0])return;const o=e.panels.find(i=>i.element===t);if(!o||!o.onResize)return;const r=ue({group:e}),s=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,u=o.mutableValues.prevSize,a={asPercentage:G(s/r*100),inPixels:s};o.mutableValues.prevSize=a,o.onResize(a,o.id,u)}function nn(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function on(e,t){return e.length!==t.length?!1:e.every((n,o)=>nn(n,t[o]))}function rn({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let r=0,s=0,u=!1;const a=new Map,i=[];for(const h of e.panels){const f=o[h.id]??0;switch(h.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const x=f/100*n,v=G(x/t*100);a.set(h.id,v),r+=v;break}case"preserve-relative-size":default:{i.push(h.id),s+=f;break}}}if(!u||i.length===0)return o;const l=100-r,c={...o};if(a.forEach((h,f)=>{c[f]=h}),s>0)for(const h of i){const f=o[h]??0;c[h]=G(f/s*l)}else{const h=G(l/i.length);for(const f of i)c[f]=h}return c}function sn(e,t){const n=e.map(r=>r.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const r of n)if(!o.includes(r))return!1;return!0}const ie=new Map;function an(e){let t=!0;M(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,r=new Set,s=new n(v=>{for(const d of v){const{borderBoxSize:g,target:p}=d;if(p===e.element){if(t){const b=ue({group:e});if(b===0)return;const S=q(e.id);if(!S)return;const y=Ce(e),m=S.defaultLayoutDeferred?ot(y):S.layout,k=rn({group:e,nextGroupSize:b,prevGroupSize:S.groupSize,prevLayout:m}),C=ee({layout:k,panelConstraints:y});if(!S.defaultLayoutDeferred&&Q(S.layout,C)&&on(S.derivedPanelConstraints,y)&&S.groupSize===b)continue;U(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:y,groupSize:b,layout:C,separatorToPanels:S.separatorToPanels})}}else tn(e,p,g)}});s.observe(e.element),e.panels.forEach(v=>{M(!o.has(v.id),`Panel ids must be unique; id "${v.id}" was used more than once`),o.add(v.id),v.onResize&&s.observe(v.element)});const u=ue({group:e}),a=Ce(e),i=e.panels.map(({id:v})=>v).join(",");let l=e.mutableState.defaultLayout;l&&(sn(e.panels,l)||(l=void 0));const c=e.mutableState.layouts[i]??l??ot(a),h=ee({layout:c,panelConstraints:a}),f=e.element.ownerDocument;ie.set(f,(ie.get(f)??0)+1);const x=new Map;return st(e).forEach(v=>{v.separator&&x.set(v.separator,v.panels)}),U(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:a,groupSize:u,layout:h,separatorToPanels:x}),e.separators.forEach(v=>{M(!r.has(v.id),`Separator ids must be unique; id "${v.id}" was used more than once`),r.add(v.id),v.element.addEventListener("keydown",Ke)}),ie.get(f)===1&&(f.addEventListener("contextmenu",Ye,!0),f.addEventListener("dblclick",Je,!0),f.addEventListener("pointerdown",Ze,!0),f.addEventListener("pointerleave",Qe),f.addEventListener("pointermove",et),f.addEventListener("pointerout",tt),f.addEventListener("pointerup",nt,!0)),function(){t=!1,ie.set(f,Math.max(0,(ie.get(f)??0)-1)),Vt(e),e.separators.forEach(v=>{v.element.removeEventListener("keydown",Ke)}),ie.get(f)||(f.removeEventListener("contextmenu",Ye,!0),f.removeEventListener("dblclick",Je,!0),f.removeEventListener("pointerdown",Ze,!0),f.removeEventListener("pointerleave",Qe),f.removeEventListener("pointermove",et),f.removeEventListener("pointerout",tt),f.removeEventListener("pointerup",nt,!0)),s.disconnect()}}function ln(){const[e,t]=z.useState({}),n=z.useCallback(()=>t({}),[]);return[e,n]}function De(e){const t=z.useId();return`${e??t}`}const te=typeof window<"u"?z.useLayoutEffect:z.useEffect;function he(e){const t=z.useRef(e);return te(()=>{t.current=e},[e]),z.useCallback((...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[t])}function Ie(...e){return he(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Ne(e){const t=z.useRef({...e});return te(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const bt=z.createContext(null);function un(e,t){const n=z.useRef({getLayout:()=>({}),setLayout:Wt});z.useImperativeHandle(t,()=>n.current,[]),te(()=>{Object.assign(n.current,mt({groupId:e}))})}function yt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:r,elementRef:s,groupRef:u,id:a,onLayoutChange:i,onLayoutChanged:l,orientation:c="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...x}){const v=z.useRef({onLayoutChange:{},onLayoutChanged:{}}),d=he(w=>{Q(v.current.onLayoutChange,w)||(v.current.onLayoutChange=w,i==null||i(w))}),g=he((w,L)=>{Q(v.current.onLayoutChanged,w)||(v.current.onLayoutChanged=w,l==null||l(w,{isUserInteraction:L}))}),p=De(a),b=z.useRef(null),[S,y]=ln(),m=z.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),k=Ie(b,s);un(p,u);const C=he((w,L)=>{const D=Z(),E=Ve(w),j=q(w);if(j){let A=!1;switch(D.state){case"active":{A=D.hitRegions.some(_=>_.group===E);break}}return{flexGrow:j.layout[L]??1,pointerEvents:A?"none":void 0}}if(n!=null&&n[L])return{flexGrow:n==null?void 0:n[L]}}),N=Ne({defaultLayout:n,disableCursor:o}),B=z.useMemo(()=>({get disableCursor(){return!!N.disableCursor},getPanelStyles:C,id:p,orientation:c,registerPanel:w=>{const L=m.current;return L.panels=Le(c,[...L.panels,w]),y(),()=>{L.panels=L.panels.filter(D=>D!==w),y()}},registerSeparator:w=>{const L=m.current;return L.separators=Le(c,[...L.separators,w]),y(),()=>{L.separators=L.separators.filter(D=>D!==w),y()}},updatePanelProps:(w,{disabled:L})=>{const D=m.current.panels.find(A=>A.id===w);D&&(D.panelConstraints.disabled=L);const E=Ve(p),j=q(p);E&&j&&U(E,{...j,derivedPanelConstraints:Ce(E)})},updateSeparatorProps:(w,{disabled:L,disableDoubleClick:D})=>{const E=m.current.separators.find(j=>j.id===w);E&&(E.disabled=L,E.disableDoubleClick=D)}}),[C,p,y,c,N]),T=z.useRef(null);return te(()=>{const w=b.current;if(w===null)return;const L=m.current;let D;if(N.defaultLayout!==void 0&&Object.keys(N.defaultLayout).length===L.panels.length){D={};for(const I of L.panels){const V=N.defaultLayout[I.id];V!==void 0&&(D[I.id]=V)}}const E={disabled:!!r,element:w,id:p,mutableState:{defaultLayout:D,disableCursor:!!N.disableCursor,expandedPanelSizes:m.current.lastExpandedPanelSizes,layouts:m.current.layouts},orientation:c,panels:L.panels,resizeTargetMinimumSize:L.resizeTargetMinimumSize,separators:L.separators};T.current=E;const j=an(E),{defaultLayoutDeferred:A,derivedPanelConstraints:_,layout:ne}=q(E.id,!0);!A&&_.length>0&&(d(ne),g(ne,!1));const J=ke(p,I=>{const{defaultLayoutDeferred:V,derivedPanelConstraints:ce,layout:oe}=I.next;if(V||ce.length===0)return;const me=E.panels.map(({id:$})=>$).join(",");E.mutableState.layouts[me]=oe,ce.forEach($=>{if($.collapsible){const{layout:de}=I.prev??{};if(de){const P=O($.collapsedSize,oe[$.panelId]),F=O($.collapsedSize,de[$.panelId]);P&&!F&&(E.mutableState.expandedPanelSizes[$.panelId]=de[$.panelId])}}});const ve=Z().state!=="active";d(oe),ve&&g(oe,I.isUserInteraction)});return()=>{T.current=null,j(),J()}},[r,p,g,d,c,S,N]),z.useEffect(()=>{const w=T.current;w&&(w.mutableState.defaultLayout=n,w.mutableState.disableCursor=!!o)}),R.jsx(bt.Provider,{value:B,children:R.jsx("div",{...x,className:t,"data-group":!0,"data-testid":p,id:p,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:e})})}yt.displayName="Group";function Te(){const e=z.useContext(bt);return M(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function cn(e,t){const{id:n}=Te(),o=z.useRef({collapse:ze,expand:ze,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ze});z.useImperativeHandle(t,()=>o.current,[]),te(()=>{Object.assign(o.current,gt({groupId:n,panelId:e}))})}function Pe({children:e,className:t,collapsedSize:n="0%",collapsible:o=!1,defaultSize:r,disabled:s,elementRef:u,groupResizeBehavior:a="preserve-relative-size",id:i,maxSize:l="100%",minSize:c="0%",onResize:h,panelRef:f,style:x,...v}){const d=!!i,g=De(i),p=Ne({disabled:s}),b=z.useRef(null),S=Ie(b,u),{getPanelStyles:y,id:m,orientation:k,registerPanel:C,updatePanelProps:N}=Te(),B=h!==null,T=he((E,j,A)=>{h==null||h(E,i,A)});te(()=>{const E=b.current;if(E!==null){const j={element:E,id:g,idIsStable:d,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:B?T:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:o,defaultSize:r,disabled:p.disabled,maxSize:l,minSize:c}};return C(j)}},[a,n,o,r,B,g,d,l,c,T,C,p]),z.useEffect(()=>{N(g,{disabled:s})},[s,g,N]),cn(g,f);const w=()=>{const E=y(m,g);if(E)return JSON.stringify(E)},L=z.useSyncExternalStore(E=>ke(m,E),w,w);let D;return L?D=JSON.parse(L):r!==void 0?D={flexGrow:void 0,flexShrink:void 0,flexBasis:r}:D={flexGrow:1},R.jsx("div",{...v,"data-disabled":s||void 0,"data-panel":!0,"data-testid":g,id:g,ref:S,style:{...dn,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...D},children:R.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...x,touchAction:k==="horizontal"?"pan-y":"pan-x"},children:e})})}Pe.displayName="Panel";const dn={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function fn({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let r,s;const u=e[n],a=t.find(i=>i.panelId===n);if(a){const i=a.maxSize,l=a.collapsible?a.collapsedSize:a.minSize,c=[o,o+1];s=ee({layout:ge({delta:l-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],r=ee({layout:ge({delta:i-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:s,valueNow:u}}function St({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:r,id:s,style:u,...a}){const i=De(s),l=Ne({disabled:n,disableDoubleClick:o}),[c,h]=z.useState({}),[f,x]=z.useState("inactive"),[v,d]=z.useState(!1),g=z.useRef(null),p=Ie(g,r),{disableCursor:b,id:S,orientation:y,registerSeparator:m,updateSeparatorProps:k}=Te(),C=y==="horizontal"?"vertical":"horizontal";te(()=>{const T=g.current;if(T!==null){const w={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:T,id:i},L=m(w),D=$t(j=>{x(j.next.state!=="inactive"&&j.next.hitRegions.some(A=>A.separator===w)?j.next.state:"inactive")}),E=ke(S,j=>{const{derivedPanelConstraints:A,layout:_,separatorToPanels:ne}=j.next,J=ne.get(w);if(J){const I=J[0],V=J.indexOf(I);h(fn({layout:_,panelConstraints:A,panelId:I.id,panelIndex:V}))}});return()=>{D(),E(),L()}}},[S,i,m,l]),z.useEffect(()=>{k(i,{disabled:n,disableDoubleClick:o})},[n,o,i,k]);let N;n&&!b&&(N="not-allowed");let B;if(n)B="disabled";else switch(f){case"active":{B="active";break}default:v?B="focus":B=f}return R.jsx("div",{...a,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":B,"data-testid":i,id:i,onBlur:()=>d(!1),onFocus:()=>d(!0),ref:p,role:"separator",style:{flexBasis:"auto",cursor:N,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}St.displayName="Separator";function we(e){var n;const t=(n=e.title)==null?void 0:n.trim();return t!=null&&t.length>0?t:"Untitled session"}function pn(e){return"isMutable"in e&&typeof Reflect.get(e,"isMutable")=="boolean"?Reflect.get(e,"isMutable")===!0:e.agentName==null}function vn({agentId:e,startTimestamp:t,endTimestamp:n,shareView:o}){const r=zt(),s=wt(),u=Ct(),a=Lt(),{sessionId:i,updateShareSearch:l}=Pt(),c=xe("AgentSessionListRow"),h=xe("AgentSessionDetailHeader"),f=xe("AgentSessionTimelineContainer"),[x,v]=z.useState([]),[d,g]=z.useState(),[p,b]=z.useState(!0),[S,y]=z.useState(!1),[m,k]=z.useState(!1),C=z.useRef(0),[N,B]=z.useState(),[T,w]=z.useState(),[L,D]=z.useState(!1),[E,j]=z.useState(!1),A=z.useMemo(()=>({order:"desc",limit:20,...e==null||e.length===0?{}:{agentId:e},...t==null?{}:{startTimestamp:t},...n==null?{}:{endTimestamp:n}}),[e,n,t]);z.useEffect(()=>{const P=++C.current;let F=!1;return b(!0),y(!1),k(!1),r.listSessions(A).then(re=>{F||C.current!==P||(v(re.data),g(re.nextPageToken))}).catch(()=>{F||C.current!==P||(v([]),g(void 0),k(!0))}).finally(()=>{!F&&C.current===P&&b(!1)}),()=>{F=!0}},[A,r]);const _=z.useCallback(async()=>{if(d==null||S)return;const P=C.current;y(!0);try{const F=await r.listSessions({...A,pageToken:d});if(C.current!==P)return;v(re=>[...re,...F.data]),g(F.nextPageToken)}catch{}finally{C.current===P&&y(!1)}},[S,A,d,r]);z.useEffect(()=>{if(i==null||i.length===0){B(void 0),w(void 0),j(!1),D(!1);return}let P=!1;return D(!0),j(!1),B(void 0),w(void 0),Promise.all([Rt({fetchPage:F=>r.listSessionEvents({sessionId:i,limit:100,...F==null?{}:{pageToken:F}})}),s.getSession({sessionId:i}).catch(()=>{})]).then(([F,re])=>{P||(B([...F].reverse()),w(re))}).catch(()=>{P||j(!0)}).finally(()=>{P||D(!1)}),()=>{P=!0}},[s,i,r]);const ne=P=>{const F=o==="sessions"?Dt(P.createdAt):null;l({sessionId:P.id,...o==="sessions"?{view:"sessions",...F==null?{}:{timeRange:F}}:{agentId:e??null,tab:"sessions",view:null,timeRange:null}})},J=()=>{i!=null&&l({sessionId:null})},I=x.find(P=>P.id===i),V=T!=null?we(T):I!=null?we(I):i??"Untitled session",ce=T!=null?Ge(T):I!=null?Ge(I):!1,oe=T!=null?T.isMutable:I!=null?pn(I):!0,me=ce?"Resume Agent building":"Resume Chat",ve=i!=null&&a!=null?xt({sessionId:i,routes:a}):null,$=()=>{if(i==null||u==null)return;const P=(T==null?void 0:T.agentName)??(I==null?void 0:I.agentName);u.openHistorySession({sessionId:i,isMutable:oe,isCreateAgent:ce,...P!=null&&P.length>0?{agentName:P}:{}})},de=ve!=null?{resumeHref:ve,resumeLabel:me}:u!=null?{onResume:$,resumeLabel:me}:{};return!p&&!m&&x.length===0&&(i==null||i.length===0)?R.jsx(Et,{title:"No Sessions Found",description:"There are no sessions available at the moment.",className:"bg-primary-bg"}):R.jsxs(yt,{id:"agent-sessions-split",orientation:"horizontal",className:"h-full min-h-0 w-full",resizeTargetMinimumSize:{coarse:24,fine:11},children:[R.jsx(Pe,{id:"agent-sessions-list",defaultSize:"35%",minSize:"20%",maxSize:"50%",children:R.jsxs("aside",{className:"flex h-full min-h-0 w-full flex-col bg-sidebar-bg",children:[R.jsx("div",{className:"scrollbar-none min-h-0 flex-1 overflow-y-auto",children:p?R.jsx("div",{className:"space-y-2 p-3",role:"status","aria-label":"Loading sessions",children:["a","b","c"].map(P=>R.jsx(Be,{className:"h-16 rounded-md"},P))}):m?R.jsx("p",{className:"px-3 py-6 text-center text-xs text-text-secondary",children:"Sessions could not be loaded."}):x.map(P=>R.jsx(c,{title:we(P),agentName:P.agentName??void 0,lastActivityAt:P.lastActivityAt,metrics:P.metrics,active:P.id===i,onSelect:()=>ne(P)},P.id))}),d!=null&&!p?R.jsx("div",{className:"shrink-0 border-t border-border p-3",children:R.jsx("button",{type:"button",disabled:S,onClick:()=>void _(),className:"h-8 w-full rounded-md border border-border text-xs font-medium text-text-primary hover:bg-ghost-button-hover disabled:opacity-60",children:S?"Loading…":"Load more"})}):null]})}),R.jsxs(St,{id:"agent-sessions-resizer","aria-label":"Resize session list",className:"group/resizer relative z-10 w-0 cursor-col-resize focus-visible:outline-none",children:[R.jsx("div",{"aria-hidden":!0,className:"absolute inset-y-0 -left-1.25 w-2.75"}),R.jsx("div",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-px bg-border transition-colors"}),R.jsx("div",{"aria-hidden":!0,className:Mt("absolute top-1/2 left-0 z-10 flex h-4 w-2 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-xs shadow-sm transition-colors","bg-secondary-button-bg text-text-secondary","group-hover/resizer:bg-primary-button-bg group-hover/resizer:text-primary-button-text","group-active/resizer:bg-primary-button-bg group-active/resizer:text-primary-button-text","group-focus-visible/resizer:bg-primary-button-bg group-focus-visible/resizer:text-primary-button-text"),children:R.jsx(kt,{name:"grip-vertical",size:10})})]}),R.jsx(Pe,{id:"agent-session-detail",defaultSize:"65%",minSize:"30%",children:R.jsx("section",{className:"flex h-full min-w-0 flex-col bg-primary-bg",children:i==null?R.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-sm text-text-secondary",children:"Select a session to view details"}):E?R.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-sm text-text-secondary",children:"Session details could not be loaded."}):R.jsxs(R.Fragment,{children:[R.jsx(h,{title:V,sessionId:i,agentId:e,createdAt:(T==null?void 0:T.createdAt)??(I==null?void 0:I.createdAt),view:o,onClose:J,...de}),L||N===void 0?R.jsx("div",{className:"flex flex-1 flex-col p-4",role:"status","aria-label":"Loading session details",children:R.jsx(Be,{className:"min-h-64 flex-1 rounded-lg"})}):R.jsx(f,{sessionId:i,events:N,listMetrics:I==null?void 0:I.metrics})]})})})]})}export{vn as AgentSessions};
|
|
1
|
+
var Te=e=>{throw TypeError(e)};var Ae=(e,t,n)=>t.has(e)||Te("Cannot "+n);var fe=(e,t,n)=>(Ae(e,t,"read from private field"),n?n.call(e):t.get(e)),Fe=(e,t,n)=>t.has(e)?Te("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Oe=(e,t,n,o)=>(Ae(e,t,"write to private field"),o?o.call(e,n):t.set(e,n),n);import{a as xt}from"./chunk-SQGT43Z3-Di5-vYAQ.js";import{r as z,j as R,bg as zt,a7 as wt,u as Ct,bh as Lt,bi as Pt,b as xe,bj as Rt,v as Ge,ah as kt,ag as Be,I as Et,d as Mt,bk as Dt}from"./index-G4wOqi3O.js";function It(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function Nt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function jt(e){return e/100*window.innerHeight}function Tt(e){return e/100*window.innerWidth}function At(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function pe({groupSize:e,panelElement:t,styleProp:n}){let o;const[r,s]=At(n);switch(s){case"%":{o=r/100*e;break}case"px":{o=r;break}case"rem":{o=Nt(t,r);break}case"em":{o=It(t,r);break}case"vh":{o=jt(r);break}case"vw":{o=Tt(r);break}}return o}function G(e){return parseFloat(e.toFixed(3))}function ue({group:e}){const{orientation:t,panels:n}=e;return n.reduce((o,r)=>(o+=t==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o),0)}function Ce(e){const{panels:t}=e,n=ue({group:e});return n===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:r,panelConstraints:s}=o;let u=0;if(s.collapsedSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:s.collapsedSize});u=G(c/n*100)}let a;if(s.defaultSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:s.defaultSize});a=G(c/n*100)}let i=0;if(s.minSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:s.minSize});i=G(c/n*100)}let l=100;if(s.maxSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:s.maxSize});l=G(c/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:u,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:i,maxSize:l,panelId:o.id}})}function M(e,t="Assertion error"){if(!e)throw Error(t)}function Le(e,t){return Array.from(t).sort(e==="horizontal"?Ft:Ot)}function Ft(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Ot(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function rt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function it(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Gt({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let r,s=Number.MAX_VALUE;for(const u of t){const{x:a,y:i}=it(o,u),l=e==="horizontal"?a:i;l<s&&(s=l,r=u)}return M(r,"No rect found"),r}let be;function Bt(){return be===void 0&&(typeof matchMedia=="function"?be=!!matchMedia("(pointer:coarse)").matches:be=!1),be}function st(e){const{element:t,orientation:n,panels:o,separators:r}=e,s=Le(n,Array.from(t.children).filter(rt).map(v=>({element:v}))).map(({element:v})=>v),u=[];let a=!1,i=!1,l=-1,c=-1,h=0,f,x=[];{let v=-1;for(const d of s)d.hasAttribute("data-panel")&&(v++,d.hasAttribute("data-disabled")||(h++,l===-1&&(l=v),c=v))}if(h>1){let v=-1;for(const d of s)if(d.hasAttribute("data-panel")){v++;const g=o.find(p=>p.element===d);if(g){if(f){const p=f.element.getBoundingClientRect(),b=d.getBoundingClientRect();let S;if(i){const y=n==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),m=n==="horizontal"?new DOMRect(b.left,b.top,0,b.height):new DOMRect(b.left,b.top,b.width,0);switch(x.length){case 0:{S=[y,m];break}case 1:{const E=x[0],C=Gt({orientation:n,rects:[p,b],targetRect:E.element.getBoundingClientRect()});S=[E,C===p?m:y];break}default:{S=x;break}}}else x.length?S=x:S=[n==="horizontal"?new DOMRect(p.right,b.top,b.left-p.right,b.height):new DOMRect(b.left,p.bottom,b.width,b.top-p.bottom)];for(const y of S){let m="width"in y?y:y.element.getBoundingClientRect();const E=Bt()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(m.width<E){const N=E-m.width;m=new DOMRect(m.x-N/2,m.y,m.width+N,m.height)}if(m.height<E){const N=E-m.height;m=new DOMRect(m.x,m.y-N/2,m.width,m.height+N)}const C=v<=l||v>c;!a&&!C&&u.push({group:e,groupSize:ue({group:e}),panels:[f,g],separator:"width"in y?void 0:y,rect:m}),a=!1}}i=!1,f=g,x=[]}}else if(d.hasAttribute("data-separator")){d.ariaDisabled!==null&&(a=!0);const g=r.find(p=>p.element===d);g?x.push(g):(f=void 0,x=[])}else i=!0}return u}var Y;class at{constructor(){Fe(this,Y,{})}addListener(t,n){const o=fe(this,Y)[t];return o===void 0?fe(this,Y)[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=fe(this,Y)[t];if(o!==void 0)if(o.length===1)o[0].call(null,n);else{let r=!1,s=null;const u=Array.from(o);for(let a=0;a<u.length;a++){const i=u[a];try{i.call(null,n)}catch(l){s===null&&(r=!0,s=l)}}if(r)throw s}}removeAllListeners(){Oe(this,Y,{})}removeListener(t,n){const o=fe(this,Y)[t];if(o!==void 0){const r=o.indexOf(n);r>=0&&o.splice(r,1)}}}Y=new WeakMap;let ae={cursorFlags:0,state:"inactive"};const Re=new at;function Z(){return ae}function $t(e){return Re.addListener("change",e)}function Ht(e){const t=ae,n={...ae};n.cursorFlags=e,ae=n,Re.emit("change",{prev:t,next:n})}function le(e){const t=ae;ae=e,Re.emit("change",{prev:t,next:e})}const Wt=e=>e,ze=()=>{},lt=1,ut=2,ct=4,dt=8,$e=3,He=12;let ye;function We(){return ye===void 0&&(ye=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ye=!0)),ye}function Ut({cursorFlags:e,groups:t,state:n}){let o=0,r=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{o++;break}case"vertical":{r++;break}}})}if(!(o===0&&r===0)){switch(n){case"active":{if(e&&We()){const s=(e<)!==0,u=(e&ut)!==0,a=(e&ct)!==0,i=(e&dt)!==0;if(s)return a?"se-resize":i?"ne-resize":"e-resize";if(u)return a?"sw-resize":i?"nw-resize":"w-resize";if(a)return"s-resize";if(i)return"n-resize"}break}}return We()?o>0&&r>0?"move":o>0?"ew-resize":"ns-resize":o>0&&r>0?"grab":o>0?"col-resize":"row-resize"}}const Ue=new WeakMap;function ke(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Ue.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const o=Z();switch(o.state){case"active":case"hover":{const r=Ut({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),s=`*, *:hover {cursor: ${r} !important; }`;if(t===s)return;t=s,r?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Ue.set(e,{prevStyle:t,styleSheet:n})}let W=new Map;const ft=new at;function Vt(e){W=new Map(W),W.delete(e)}function Ve(e,t){for(const[n]of W)if(n.id===e)return n}function q(e,t){for(const[n,o]of W)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function X(){return W}function Ee(e,t){return ft.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function U(e,t,n){const o=W.get(e);W=new Map(W),W.set(e,t),ft.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:o,next:t})}function pt(e){const t=Z(),n=X();let o=!1;switch(t.state){case"active":le({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(ke(e),o=!0,t.hitRegions.forEach(r=>{if(!n.has(r.group))return;const s=q(r.group.id,!0);U(r.group,s,{isUserInteraction:!0})}))}return o}function Ye(e){e.defaultPrevented||pt(e.currentTarget)}function Yt(e,t,n){let o,r={x:1/0,y:1/0};for(const s of t){const u=it(n,s.rect);switch(e){case"horizontal":{u.x<=r.x&&(o=s,r=u);break}case"vertical":{u.y<=r.y&&(o=s,r=u);break}}}return o?{distance:r,hitRegion:o}:void 0}function qt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Xt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:_e(e),b:_e(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();M(o,"Stacking order can only be calculated for elements with a common ancestor");const r={a:Xe(qe(n.a)),b:Xe(qe(n.b))};if(r.a===r.b){const s=o.childNodes,u={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const i=s[a];if(i===u.a)return 1;if(i===u.b)return-1}}return Math.sign(r.a-r.b)}const _t=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Jt(e){const t=getComputedStyle(ht(e)??e).display;return t==="flex"||t==="inline-flex"}function Kt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Jt(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||_t.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function qe(e){let t=e.length;for(;t--;){const n=e[t];if(M(n,"Missing node"),Kt(n))return n}return null}function Xe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _e(e){const t=[];for(;e;)t.push(e),e=ht(e);return t}function ht(e){const{parentNode:t}=e;return qt(t)?t.host:t}function Zt(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Qt({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!rt(n)||n.contains(e)||e.contains(n))return!0;if(Xt(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(Zt(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function Me(e,t){const n=[];return t.forEach((o,r)=>{if(r.disabled)return;const s=st(r),u=Yt(r.orientation,s,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&Qt({groupElement:r.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&n.push(u.hitRegion)}),n}function en(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function O(e,t,n=0){return Math.abs(G(e)-G(t))<=n}function H(e,t){return O(e,t)?0:e>t?1:-1}function se({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:r=0,collapsible:s,disabled:u,maxSize:a=100,minSize:i=0}=t;if(u&&!e)return n;if(H(o,i)<0)if(s){const l=(r+i)/2;H(o,l)<0?o=r:o=i}else o=i;return o=Math.min(a,o),o=G(o),o}function ge({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:s}){if(O(e,0))return t;const u=s==="imperative-api",a=Object.values(t),i=Object.values(r),l=[...a],[c,h]=o;M(c!=null,"Invalid first pivot index"),M(h!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const d=e<0?h:c,g=n[d];M(g,`Panel constraints not found for index ${d}`);const{collapsedSize:p=0,collapsible:b,minSize:S=0}=g;if(b){const y=a[d];if(M(y!=null,`Previous layout not found for panel index ${d}`),O(y,p)){const m=S-y;H(m,Math.abs(e))>0&&(e=e<0?0-m:m)}}}{const d=e<0?c:h,g=n[d];M(g,`No panel constraints found for index ${d}`);const{collapsedSize:p=0,collapsible:b,minSize:S=0}=g;if(b){const y=a[d];if(M(y!=null,`Previous layout not found for panel index ${d}`),O(y,S)){const m=y-p;H(m,Math.abs(e))>0&&(e=e<0?0-m:m)}}}break}default:{const d=e<0?h:c,g=n[d];M(g,`Panel constraints not found for index ${d}`);const p=a[d],{collapsible:b,collapsedSize:S,minSize:y}=g;if(b&&H(p,y)<0)if(e>0){const m=y-S,E=m/2,C=p+e;H(C,y)<0&&(e=H(e,E)<=0?0:m)}else{const m=y-S,E=100-m/2,C=p-e;H(C,y)<0&&(e=H(100+e,E)>0?0:-m)}break}}{const d=e<0?1:-1;let g=e<0?h:c,p=0;for(;;){const S=a[g];M(S!=null,`Previous layout not found for panel index ${g}`);const y=se({overrideDisabledPanels:u,panelConstraints:n[g],prevSize:S,size:100})-S;if(p+=y,g+=d,g<0||g>=n.length)break}const b=Math.min(Math.abs(e),Math.abs(p));e=e<0?0-b:b}{let d=e<0?c:h;for(;d>=0&&d<n.length;){const g=Math.abs(e)-Math.abs(f),p=a[d];M(p!=null,`Previous layout not found for panel index ${d}`);const b=p-g,S=se({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:p,size:b});if(!O(p,S)&&(f+=p-S,l[d]=S,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?d--:d++}}if(en(i,l))return r;{const d=e<0?h:c,g=a[d];M(g!=null,`Previous layout not found for panel index ${d}`);const p=g+f,b=se({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:g,size:p});if(l[d]=b,!O(b,p)){let S=p-b,y=e<0?h:c;for(;y>=0&&y<n.length;){const m=l[y];M(m!=null,`Previous layout not found for panel index ${y}`);const E=m+S,C=se({overrideDisabledPanels:u,panelConstraints:n[y],prevSize:m,size:E});if(O(m,C)||(S-=C-m,l[y]=C),O(S,0))break;e>0?y--:y++}}}const x=Object.values(l).reduce((d,g)=>g+d,0);if(!O(x,100,.1))return r;const v=Object.keys(r);return l.reduce((d,g,p)=>(d[v[p]]=g,d),{})}function Q(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||H(e[n],t[n])!==0)return!1;return!0}function ee({layout:e,panelConstraints:t}){const n=Object.values(e),o=[...n],r=o.reduce((a,i)=>a+i,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(a=>`${a}%`).join(", ")}`);if(!O(r,100)&&o.length>0)for(let a=0;a<t.length;a++){const i=o[a];M(i!=null,`No layout data found for index ${a}`);const l=100/r*i;o[a]=l}let s=0;for(let a=0;a<t.length;a++){const i=n[a];M(i!=null,`No layout data found for index ${a}`);const l=o[a];M(l!=null,`No layout data found for index ${a}`);const c=se({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:i,size:l});l!=c&&(s+=l-c,o[a]=c)}if(!O(s,0))for(let a=0;a<t.length;a++){const i=o[a];M(i!=null,`No layout data found for index ${a}`);const l=i+s,c=se({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:i,size:l});if(i!==c&&(s-=c-i,o[a]=c,O(s,0)))break}const u=Object.keys(e);return o.reduce((a,i,l)=>(a[u[l]]=i,a),{})}function gt({groupId:e,panelId:t}){const n=()=>{const i=X();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:h,layout:f,groupSize:x,separatorToPanels:v}]of i)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:h,group:l,groupSize:x,layout:f,separatorToPanels:v};throw Error(`Group ${e} not found`)},o=()=>{const i=n().derivedPanelConstraints.find(l=>l.panelId===t);if(i!==void 0)return i;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const i=n().group.panels.find(l=>l.id===t);if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const i=n().layout[t];if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:i,panels:l,prevLayout:c,derivedPanelConstraints:h})=>{const f=s(),x=l.findIndex(g=>g.id===t),v=x===0,d=x===l.length-1;if(d&&i<f&&(v||l.slice(0,x).every((g,p)=>{const b=h[p];return(b==null?void 0:b.collapsible)&&O(b.collapsedSize,c[b.panelId])}))){const g=l.slice(0,x).reduce((p,b)=>p+c[b.id],0);return{...c,[t]:G(100-g)}}return ge({delta:d?f-i:i-f,initialLayout:c,panelConstraints:h,pivotIndices:d?[x-1,x]:[x,x+1],prevLayout:c,trigger:"imperative-api"})},a=i=>{const l=s();if(i===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:h,group:f,groupSize:x,layout:v,separatorToPanels:d}=n(),g=u({nextSize:i,panels:f.panels,prevLayout:v,derivedPanelConstraints:h}),p=ee({layout:g,panelConstraints:h});Q(v,p)||U(f,{defaultLayoutDeferred:c,derivedPanelConstraints:h,groupSize:x,layout:p,separatorToPanels:d})};return{collapse:()=>{const{collapsible:i,collapsedSize:l}=o(),{mutableValues:c}=r(),h=s();i&&h!==l&&(c.expandToSize=h,a(l))},expand:()=>{const{collapsible:i,collapsedSize:l,minSize:c}=o(),{mutableValues:h}=r(),f=s();if(i&&f===l){let x=h.expandToSize??c;x===0&&(x=1),a(x)}},getSize:()=>{const{group:i}=n(),l=s(),{element:c}=r(),h=i.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:h}},isCollapsed:()=>{const{collapsible:i,collapsedSize:l}=o(),c=s();return i&&O(l,c)},resize:i=>{const{group:l}=n(),{element:c}=r(),h=ue({group:l}),f=pe({groupSize:h,panelElement:c,styleProp:i}),x=G(f/h*100);a(x)}}}function Je(e){if(e.defaultPrevented)return;const t=X();Me(e,t).forEach(n=>{if(n.separator&&!n.separator.disableDoubleClick){const o=n.panels.find(r=>r.panelConstraints.defaultSize!==void 0);if(o){const r=o.panelConstraints.defaultSize,s=gt({groupId:n.group.id,panelId:o.id});s&&r!==void 0&&(s.resize(r),e.preventDefault())}}})}function Se(e){const t=X();for(const[n]of t)if(n.separators.some(o=>o.element===e))return n;throw Error("Could not find parent Group for separator element")}function mt({groupId:e}){const t=()=>{const n=X();for(const[o,r]of n)if(o.id===e)return{group:o,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:o}=t();return n?{}:o},setLayout(n){const{defaultLayoutDeferred:o,derivedPanelConstraints:r,group:s,groupSize:u,layout:a,separatorToPanels:i}=t(),l=ee({layout:n,panelConstraints:r});return o?a:(Q(a,l)||U(s,{defaultLayoutDeferred:o,derivedPanelConstraints:r,groupSize:u,layout:l,separatorToPanels:i}),l)}}}function K(e,t){const n=Se(e),o=q(n.id,!0),r=n.separators.find(c=>c.element===e);M(r,"Matching separator not found");const s=o.separatorToPanels.get(r);M(s,"Matching panels not found");const u=s.map(c=>n.panels.indexOf(c)),a=mt({groupId:n.id}).getLayout(),i=ge({delta:t,initialLayout:a,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:a,trigger:"keyboard"}),l=ee({layout:i,panelConstraints:o.derivedPanelConstraints});Q(a,l)||U(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:l,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Ke(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Se(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&K(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&K(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&K(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&K(t,-5);break}case"End":{e.preventDefault(),K(t,100);break}case"Enter":{e.preventDefault();const o=Se(t),r=q(o.id,!0),{derivedPanelConstraints:s,layout:u,separatorToPanels:a}=r,i=o.separators.find(f=>f.element===t);M(i,"Matching separator not found");const l=a.get(i);M(l,"Matching panels not found");const c=l[0],h=s.find(f=>f.panelId===c.id);if(M(h,"Panel metadata not found"),h.collapsible){const f=u[c.id],x=h.collapsedSize===f?o.mutableState.expandedPanelSizes[c.id]??h.minSize:h.collapsedSize;K(t,x-f)}break}case"F6":{e.preventDefault();const o=Se(t).separators.map(u=>u.element),r=Array.from(o).findIndex(u=>u===e.currentTarget);M(r!==null,"Index not found");const s=e.shiftKey?r>0?r-1:o.length-1:r+1<o.length?r+1:0;o[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),K(t,-100);break}}}function Ze(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=X(),n=Me(e,t),o=new Map;let r=!1;n.forEach(s=>{s.separator&&(r||(r=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(s.group);u&&o.set(s.group,u.layout)}),le({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function vt({document:e,event:t,hitRegions:n,initialLayoutMap:o,mountedGroups:r,pointerDownAtPoint:s,prevCursorFlags:u}){let a=0;n.forEach(l=>{const{group:c,groupSize:h}=l,{orientation:f,panels:x}=c,{disableCursor:v}=c.mutableState;let d=0;s?f==="horizontal"?d=(t.clientX-s.x)/h*100:d=(t.clientY-s.y)/h*100:f==="horizontal"?d=t.clientX<0?-100:100:d=t.clientY<0?-100:100;const g=o.get(c),p=r.get(c);if(!g||!p)return;const{defaultLayoutDeferred:b,derivedPanelConstraints:S,groupSize:y,layout:m,separatorToPanels:E}=p;if(S&&m&&E){const C=ge({delta:d,initialLayout:g,panelConstraints:S,pivotIndices:l.panels.map(N=>x.indexOf(N)),prevLayout:m,trigger:"mouse-or-touch"});if(Q(C,m)){if(d!==0&&!v)switch(f){case"horizontal":{a|=d<0?lt:ut;break}case"vertical":{a|=d<0?ct:dt;break}}}else U(l.group,{defaultLayoutDeferred:b,derivedPanelConstraints:S,groupSize:y,layout:C,separatorToPanels:E})}});let i=0;t.movementX===0?i|=u&$e:i|=a&$e,t.movementY===0?i|=u&He:i|=a&He,Ht(i),ke(e)}function Qe(e){const t=X(),n=Z();switch(n.state){case"active":vt({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function et(e){var o,r;if(e.defaultPrevented)return;const t=Z(),n=X();switch(t.state){case"active":{if(e.buttons===0){le({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{if(!n.has(s.group))return;const u=q(s.group.id,!0);U(s.group,u,{isUserInteraction:!0})});return}for(const s of t.hitRegions)if(s.separator){const{element:u}=s.separator;(o=u.hasPointerCapture)!=null&&o.call(u,e.pointerId)||((r=u.setPointerCapture)==null||r.call(u,e.pointerId))}vt({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=Me(e,n);s.length===0?t.state!=="inactive"&&le({cursorFlags:0,state:"inactive"}):le({cursorFlags:0,hitRegions:s,state:"hover"}),ke(e.currentTarget);break}}}function tt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Z().state){case"hover":le({cursorFlags:0,state:"inactive"})}}function nt(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||pt(e.currentTarget)&&e.preventDefault()}function ot(e){let t=0,n=0;const o={};for(const s of e)if(s.defaultSize!==void 0){t++;const u=G(s.defaultSize);n+=u,o[s.panelId]=u}else o[s.panelId]=void 0;const r=e.length-t;if(r!==0){const s=G((100-n)/r);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=s)}return o}function tn(e,t,n){if(!n[0])return;const o=e.panels.find(i=>i.element===t);if(!o||!o.onResize)return;const r=ue({group:e}),s=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,u=o.mutableValues.prevSize,a={asPercentage:G(s/r*100),inPixels:s};o.mutableValues.prevSize=a,o.onResize(a,o.id,u)}function nn(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function on(e,t){return e.length!==t.length?!1:e.every((n,o)=>nn(n,t[o]))}function rn({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let r=0,s=0,u=!1;const a=new Map,i=[];for(const h of e.panels){const f=o[h.id]??0;switch(h.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const x=f/100*n,v=G(x/t*100);a.set(h.id,v),r+=v;break}case"preserve-relative-size":default:{i.push(h.id),s+=f;break}}}if(!u||i.length===0)return o;const l=100-r,c={...o};if(a.forEach((h,f)=>{c[f]=h}),s>0)for(const h of i){const f=o[h]??0;c[h]=G(f/s*l)}else{const h=G(l/i.length);for(const f of i)c[f]=h}return c}function sn(e,t){const n=e.map(r=>r.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const r of n)if(!o.includes(r))return!1;return!0}const ie=new Map;function an(e){let t=!0;M(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,r=new Set,s=new n(v=>{for(const d of v){const{borderBoxSize:g,target:p}=d;if(p===e.element){if(t){const b=ue({group:e});if(b===0)return;const S=q(e.id);if(!S)return;const y=Ce(e),m=S.defaultLayoutDeferred?ot(y):S.layout,E=rn({group:e,nextGroupSize:b,prevGroupSize:S.groupSize,prevLayout:m}),C=ee({layout:E,panelConstraints:y});if(!S.defaultLayoutDeferred&&Q(S.layout,C)&&on(S.derivedPanelConstraints,y)&&S.groupSize===b)continue;U(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:y,groupSize:b,layout:C,separatorToPanels:S.separatorToPanels})}}else tn(e,p,g)}});s.observe(e.element),e.panels.forEach(v=>{M(!o.has(v.id),`Panel ids must be unique; id "${v.id}" was used more than once`),o.add(v.id),v.onResize&&s.observe(v.element)});const u=ue({group:e}),a=Ce(e),i=e.panels.map(({id:v})=>v).join(",");let l=e.mutableState.defaultLayout;l&&(sn(e.panels,l)||(l=void 0));const c=e.mutableState.layouts[i]??l??ot(a),h=ee({layout:c,panelConstraints:a}),f=e.element.ownerDocument;ie.set(f,(ie.get(f)??0)+1);const x=new Map;return st(e).forEach(v=>{v.separator&&x.set(v.separator,v.panels)}),U(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:a,groupSize:u,layout:h,separatorToPanels:x}),e.separators.forEach(v=>{M(!r.has(v.id),`Separator ids must be unique; id "${v.id}" was used more than once`),r.add(v.id),v.element.addEventListener("keydown",Ke)}),ie.get(f)===1&&(f.addEventListener("contextmenu",Ye,!0),f.addEventListener("dblclick",Je,!0),f.addEventListener("pointerdown",Ze,!0),f.addEventListener("pointerleave",Qe),f.addEventListener("pointermove",et),f.addEventListener("pointerout",tt),f.addEventListener("pointerup",nt,!0)),function(){t=!1,ie.set(f,Math.max(0,(ie.get(f)??0)-1)),Vt(e),e.separators.forEach(v=>{v.element.removeEventListener("keydown",Ke)}),ie.get(f)||(f.removeEventListener("contextmenu",Ye,!0),f.removeEventListener("dblclick",Je,!0),f.removeEventListener("pointerdown",Ze,!0),f.removeEventListener("pointerleave",Qe),f.removeEventListener("pointermove",et),f.removeEventListener("pointerout",tt),f.removeEventListener("pointerup",nt,!0)),s.disconnect()}}function ln(){const[e,t]=z.useState({}),n=z.useCallback(()=>t({}),[]);return[e,n]}function De(e){const t=z.useId();return`${e??t}`}const te=typeof window<"u"?z.useLayoutEffect:z.useEffect;function he(e){const t=z.useRef(e);return te(()=>{t.current=e},[e]),z.useCallback((...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[t])}function Ie(...e){return he(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Ne(e){const t=z.useRef({...e});return te(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const bt=z.createContext(null);function un(e,t){const n=z.useRef({getLayout:()=>({}),setLayout:Wt});z.useImperativeHandle(t,()=>n.current,[]),te(()=>{Object.assign(n.current,mt({groupId:e}))})}function yt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:r,elementRef:s,groupRef:u,id:a,onLayoutChange:i,onLayoutChanged:l,orientation:c="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...x}){const v=z.useRef({onLayoutChange:{},onLayoutChanged:{}}),d=he(w=>{Q(v.current.onLayoutChange,w)||(v.current.onLayoutChange=w,i==null||i(w))}),g=he((w,L)=>{Q(v.current.onLayoutChanged,w)||(v.current.onLayoutChanged=w,l==null||l(w,{isUserInteraction:L}))}),p=De(a),b=z.useRef(null),[S,y]=ln(),m=z.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),E=Ie(b,s);un(p,u);const C=he((w,L)=>{const D=Z(),k=Ve(w),T=q(w);if(T){let A=!1;switch(D.state){case"active":{A=D.hitRegions.some(_=>_.group===k);break}}return{flexGrow:T.layout[L]??1,pointerEvents:A?"none":void 0}}if(n!=null&&n[L])return{flexGrow:n==null?void 0:n[L]}}),N=Ne({defaultLayout:n,disableCursor:o}),B=z.useMemo(()=>({get disableCursor(){return!!N.disableCursor},getPanelStyles:C,id:p,orientation:c,registerPanel:w=>{const L=m.current;return L.panels=Le(c,[...L.panels,w]),y(),()=>{L.panels=L.panels.filter(D=>D!==w),y()}},registerSeparator:w=>{const L=m.current;return L.separators=Le(c,[...L.separators,w]),y(),()=>{L.separators=L.separators.filter(D=>D!==w),y()}},updatePanelProps:(w,{disabled:L})=>{const D=m.current.panels.find(A=>A.id===w);D&&(D.panelConstraints.disabled=L);const k=Ve(p),T=q(p);k&&T&&U(k,{...T,derivedPanelConstraints:Ce(k)})},updateSeparatorProps:(w,{disabled:L,disableDoubleClick:D})=>{const k=m.current.separators.find(T=>T.id===w);k&&(k.disabled=L,k.disableDoubleClick=D)}}),[C,p,y,c,N]),j=z.useRef(null);return te(()=>{const w=b.current;if(w===null)return;const L=m.current;let D;if(N.defaultLayout!==void 0&&Object.keys(N.defaultLayout).length===L.panels.length){D={};for(const I of L.panels){const V=N.defaultLayout[I.id];V!==void 0&&(D[I.id]=V)}}const k={disabled:!!r,element:w,id:p,mutableState:{defaultLayout:D,disableCursor:!!N.disableCursor,expandedPanelSizes:m.current.lastExpandedPanelSizes,layouts:m.current.layouts},orientation:c,panels:L.panels,resizeTargetMinimumSize:L.resizeTargetMinimumSize,separators:L.separators};j.current=k;const T=an(k),{defaultLayoutDeferred:A,derivedPanelConstraints:_,layout:ne}=q(k.id,!0);!A&&_.length>0&&(d(ne),g(ne,!1));const J=Ee(p,I=>{const{defaultLayoutDeferred:V,derivedPanelConstraints:ce,layout:oe}=I.next;if(V||ce.length===0)return;const me=k.panels.map(({id:$})=>$).join(",");k.mutableState.layouts[me]=oe,ce.forEach($=>{if($.collapsible){const{layout:de}=I.prev??{};if(de){const P=O($.collapsedSize,oe[$.panelId]),F=O($.collapsedSize,de[$.panelId]);P&&!F&&(k.mutableState.expandedPanelSizes[$.panelId]=de[$.panelId])}}});const ve=Z().state!=="active";d(oe),ve&&g(oe,I.isUserInteraction)});return()=>{j.current=null,T(),J()}},[r,p,g,d,c,S,N]),z.useEffect(()=>{const w=j.current;w&&(w.mutableState.defaultLayout=n,w.mutableState.disableCursor=!!o)}),R.jsx(bt.Provider,{value:B,children:R.jsx("div",{...x,className:t,"data-group":!0,"data-testid":p,id:p,ref:E,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:e})})}yt.displayName="Group";function je(){const e=z.useContext(bt);return M(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function cn(e,t){const{id:n}=je(),o=z.useRef({collapse:ze,expand:ze,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ze});z.useImperativeHandle(t,()=>o.current,[]),te(()=>{Object.assign(o.current,gt({groupId:n,panelId:e}))})}function Pe({children:e,className:t,collapsedSize:n="0%",collapsible:o=!1,defaultSize:r,disabled:s,elementRef:u,groupResizeBehavior:a="preserve-relative-size",id:i,maxSize:l="100%",minSize:c="0%",onResize:h,panelRef:f,style:x,...v}){const d=!!i,g=De(i),p=Ne({disabled:s}),b=z.useRef(null),S=Ie(b,u),{getPanelStyles:y,id:m,orientation:E,registerPanel:C,updatePanelProps:N}=je(),B=h!==null,j=he((k,T,A)=>{h==null||h(k,i,A)});te(()=>{const k=b.current;if(k!==null){const T={element:k,id:g,idIsStable:d,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:B?j:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:o,defaultSize:r,disabled:p.disabled,maxSize:l,minSize:c}};return C(T)}},[a,n,o,r,B,g,d,l,c,j,C,p]),z.useEffect(()=>{N(g,{disabled:s})},[s,g,N]),cn(g,f);const w=()=>{const k=y(m,g);if(k)return JSON.stringify(k)},L=z.useSyncExternalStore(k=>Ee(m,k),w,w);let D;return L?D=JSON.parse(L):r!==void 0?D={flexGrow:void 0,flexShrink:void 0,flexBasis:r}:D={flexGrow:1},R.jsx("div",{...v,"data-disabled":s||void 0,"data-panel":!0,"data-testid":g,id:g,ref:S,style:{...dn,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...D},children:R.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...x,touchAction:E==="horizontal"?"pan-y":"pan-x"},children:e})})}Pe.displayName="Panel";const dn={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function fn({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let r,s;const u=e[n],a=t.find(i=>i.panelId===n);if(a){const i=a.maxSize,l=a.collapsible?a.collapsedSize:a.minSize,c=[o,o+1];s=ee({layout:ge({delta:l-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],r=ee({layout:ge({delta:i-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:s,valueNow:u}}function St({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:r,id:s,style:u,...a}){const i=De(s),l=Ne({disabled:n,disableDoubleClick:o}),[c,h]=z.useState({}),[f,x]=z.useState("inactive"),[v,d]=z.useState(!1),g=z.useRef(null),p=Ie(g,r),{disableCursor:b,id:S,orientation:y,registerSeparator:m,updateSeparatorProps:E}=je(),C=y==="horizontal"?"vertical":"horizontal";te(()=>{const j=g.current;if(j!==null){const w={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:j,id:i},L=m(w),D=$t(T=>{x(T.next.state!=="inactive"&&T.next.hitRegions.some(A=>A.separator===w)?T.next.state:"inactive")}),k=Ee(S,T=>{const{derivedPanelConstraints:A,layout:_,separatorToPanels:ne}=T.next,J=ne.get(w);if(J){const I=J[0],V=J.indexOf(I);h(fn({layout:_,panelConstraints:A,panelId:I.id,panelIndex:V}))}});return()=>{D(),k(),L()}}},[S,i,m,l]),z.useEffect(()=>{E(i,{disabled:n,disableDoubleClick:o})},[n,o,i,E]);let N;n&&!b&&(N="not-allowed");let B;if(n)B="disabled";else switch(f){case"active":{B="active";break}default:v?B="focus":B=f}return R.jsx("div",{...a,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":B,"data-testid":i,id:i,onBlur:()=>d(!1),onFocus:()=>d(!0),ref:p,role:"separator",style:{flexBasis:"auto",cursor:N,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}St.displayName="Separator";function we(e){var n;const t=(n=e.title)==null?void 0:n.trim();return t!=null&&t.length>0?t:"Untitled session"}function pn(e){return"isMutable"in e&&typeof Reflect.get(e,"isMutable")=="boolean"?Reflect.get(e,"isMutable")===!0:e.agentName==null}function vn({agentId:e,startTimestamp:t,endTimestamp:n,shareView:o}){const r=zt(),s=wt(),u=Ct(),a=Lt(),{sessionId:i,updateShareSearch:l}=Pt(),c=xe("AgentSessionListRow"),h=xe("AgentSessionDetailHeader"),f=xe("AgentSessionTimelineContainer"),[x,v]=z.useState([]),[d,g]=z.useState(),[p,b]=z.useState(!0),[S,y]=z.useState(!1),[m,E]=z.useState(!1),C=z.useRef(0),[N,B]=z.useState(),[j,w]=z.useState(),[L,D]=z.useState(!1),[k,T]=z.useState(!1),A=z.useMemo(()=>({order:"desc",limit:20,...e==null||e.length===0?{}:{agentId:e},...t==null?{}:{startTimestamp:t},...n==null?{}:{endTimestamp:n}}),[e,n,t]);z.useEffect(()=>{const P=++C.current;let F=!1;return b(!0),y(!1),E(!1),r.listSessions(A).then(re=>{F||C.current!==P||(v(re.data),g(re.nextPageToken))}).catch(()=>{F||C.current!==P||(v([]),g(void 0),E(!0))}).finally(()=>{!F&&C.current===P&&b(!1)}),()=>{F=!0}},[A,r]);const _=z.useCallback(async()=>{if(d==null||S)return;const P=C.current;y(!0);try{const F=await r.listSessions({...A,pageToken:d});if(C.current!==P)return;v(re=>[...re,...F.data]),g(F.nextPageToken)}catch{}finally{C.current===P&&y(!1)}},[S,A,d,r]);z.useEffect(()=>{if(i==null||i.length===0){B(void 0),w(void 0),T(!1),D(!1);return}let P=!1;return D(!0),T(!1),B(void 0),w(void 0),Promise.all([Rt({fetchPage:F=>r.listSessionEvents({sessionId:i,limit:100,...F==null?{}:{pageToken:F}})}),s.getSession({sessionId:i}).catch(()=>{})]).then(([F,re])=>{P||(B([...F].reverse()),w(re))}).catch(()=>{P||T(!0)}).finally(()=>{P||D(!1)}),()=>{P=!0}},[s,i,r]);const ne=P=>{const F=o==="sessions"?Dt(P.createdAt):null;l({sessionId:P.id,...o==="sessions"?{view:"sessions",...F==null?{}:{timeRange:F}}:{agentId:e??null,tab:"sessions",view:null,timeRange:null}})},J=()=>{i!=null&&l({sessionId:null})},I=x.find(P=>P.id===i),V=j!=null?we(j):I!=null?we(I):i??"Untitled session",ce=j!=null?Ge(j):I!=null?Ge(I):!1,oe=j!=null?j.isMutable:I!=null?pn(I):!0,me=ce?"Resume Agent building":"Resume Chat",ve=i!=null&&a!=null?xt({sessionId:i,routes:a}):null,$=()=>{if(i==null||u==null)return;const P=(j==null?void 0:j.agentName)??(I==null?void 0:I.agentName);u.openHistorySession({sessionId:i,isMutable:oe,isCreateAgent:ce,...P!=null&&P.length>0?{agentName:P}:{}})},de=ve!=null?{resumeHref:ve,resumeLabel:me}:u!=null?{onResume:$,resumeLabel:me}:{};return!p&&!m&&x.length===0&&(i==null||i.length===0)?R.jsx(kt,{title:"No Sessions Found",description:"There are no sessions available at the moment.",className:"bg-primary-bg"}):R.jsxs(yt,{id:"agent-sessions-split",orientation:"horizontal",className:"h-full min-h-0 w-full",resizeTargetMinimumSize:{coarse:24,fine:11},children:[R.jsx(Pe,{id:"agent-sessions-list",defaultSize:"35%",minSize:"20%",maxSize:"50%",children:R.jsxs("aside",{className:"flex h-full min-h-0 w-full flex-col bg-sidebar-bg",children:[R.jsx("div",{className:"scrollbar-none min-h-0 flex-1 overflow-y-auto",children:p?R.jsx("div",{className:"space-y-2 p-3",role:"status","aria-label":"Loading sessions",children:["a","b","c"].map(P=>R.jsx(Be,{className:"h-16 rounded-md"},P))}):m?R.jsx("p",{className:"px-3 py-6 text-center text-xs text-text-secondary",children:"Sessions could not be loaded."}):x.map(P=>R.jsx(c,{title:we(P),agentName:P.agentName??void 0,lastActivityAt:P.lastActivityAt,metrics:P.metrics,active:P.id===i,onSelect:()=>ne(P)},P.id))}),d!=null&&!p?R.jsx("div",{className:"shrink-0 border-t border-border p-3",children:R.jsx("button",{type:"button",disabled:S,onClick:()=>void _(),className:"h-8 w-full rounded-md border border-border text-xs font-medium text-text-primary hover:bg-ghost-button-hover disabled:opacity-60",children:S?"Loading…":"Load more"})}):null]})}),R.jsxs(St,{id:"agent-sessions-resizer","aria-label":"Resize session list",className:"group/resizer relative z-10 w-0 cursor-col-resize focus-visible:outline-none",children:[R.jsx("div",{"aria-hidden":!0,className:"absolute inset-y-0 -left-1.25 w-2.75"}),R.jsx("div",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-px bg-border transition-colors"}),R.jsx("div",{"aria-hidden":!0,className:Mt("absolute top-1/2 left-0 z-10 flex h-4 w-2 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-xs shadow-sm transition-colors","bg-secondary-button-bg text-text-secondary","group-hover/resizer:bg-primary-button-bg group-hover/resizer:text-primary-button-text","group-active/resizer:bg-primary-button-bg group-active/resizer:text-primary-button-text","group-focus-visible/resizer:bg-primary-button-bg group-focus-visible/resizer:text-primary-button-text"),children:R.jsx(Et,{name:"grip-vertical",size:10})})]}),R.jsx(Pe,{id:"agent-session-detail",defaultSize:"65%",minSize:"30%",children:R.jsx("section",{className:"flex h-full min-w-0 flex-col bg-primary-bg",children:i==null?R.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-sm text-text-secondary",children:"Select a session to view details"}):k?R.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-sm text-text-secondary",children:"Session details could not be loaded."}):R.jsxs(R.Fragment,{children:[R.jsx(h,{title:V,sessionId:i,agentId:e,createdAt:(j==null?void 0:j.createdAt)??(I==null?void 0:I.createdAt),view:o,onClose:J,...de}),L||N===void 0?R.jsx("div",{className:"flex flex-1 flex-col p-4",role:"status","aria-label":"Loading session details",children:R.jsx(Be,{className:"min-h-64 flex-1 rounded-lg"})}):R.jsx(f,{sessionId:i,events:N,listMetrics:I==null?void 0:I.metrics})]})})})]})}export{vn as AgentSessions};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aD as J,a8 as de,r,aE as H,j as e,ad as oe,af as z,I as S,aG as X,aB as Q,aK as ce,d as L,aF as Y}from"./index-G4wOqi3O.js";var me=[{value:"dcr",label:"OAuth"},{value:"none",label:"None"},{value:"header",label:"API Key"}],$=Q("h-11 shadow-sm"),B=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),ue=({open:n,onOpenChange:u,onAdd:m,busy:v=!1,error:o})=>{const[f,y]=r.useState(""),[h,x]=r.useState(""),[p,w]=r.useState(""),[i,b]=r.useState("dcr"),[j,F]=r.useState(""),[k,M]=r.useState(""),A=()=>{y(""),x(""),w(""),b("dcr"),F(""),M("")},a=l=>{l||A(),u(l)},N=!!f.trim()&&!!p.trim()&&!!h.trim()&&(i!=="header"||!!j.trim()),E=async l=>{if(l.preventDefault(),!N||v)return;const I=i==="header"?{type:"header",apiKey:j.trim(),...k.trim()?{headerName:k.trim()}:{}}:{type:i};try{await m({name:f.trim(),url:h.trim(),description:p.trim(),auth:I}),A(),u(!1)}catch{}};return e.jsx(X,{open:n,onOpenChange:a,title:"Add MCP server",description:"Point at a remote MCP endpoint. It then behaves like any other connector.",contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(S,{name:"mcp-server",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:l=>void E(l),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Name",e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-name",type:"text",required:!0,value:f,onChange:l=>{y(l.target.value)},placeholder:"analytics-postgres-mcp",autoFocus:!0,className:$})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-description",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Description",e.jsx(B,{})]}),e.jsx("textarea",{id:"mcp-server-description",value:p,onChange:l=>{w(l.target.value)},placeholder:"Query analytics from Postgres",required:!0,rows:3,className:Q("resize-y py-2.5 shadow-sm")})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-url",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["URL",e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-url",type:"url",required:!0,value:h,onChange:l=>{x(l.target.value)},placeholder:"https://mcp.example.com/mcp",className:$})]}),e.jsxs("fieldset",{children:[e.jsxs("legend",{className:"mb-1.5 text-sm font-medium text-text-primary",children:["Auth type",e.jsx(B,{})]}),e.jsx("div",{className:"flex w-full flex-row rounded-md border border-border bg-secondary-bg/40 p-1",children:me.map(l=>e.jsxs("label",{className:`flex h-8 flex-1 cursor-pointer items-center justify-center rounded-sm text-sm font-medium transition-colors ${i===l.value?"bg-dropdown-selected-item-bg text-dropdown-selected-item-text shadow-sm":"text-text-secondary hover:text-text-primary"}`,children:[e.jsx("input",{type:"radio",name:"mcp-auth-type",value:l.value,checked:i===l.value,onChange:()=>{b(l.value)},className:"sr-only"}),l.label]},l.value))})]}),i==="dcr"?e.jsxs("div",{className:"flex gap-1.5 bg-secondary-bg/40 p-2 rounded-md",children:[e.jsx(S,{name:"info",className:"size-3.5 mt-1 text-text-secondary"}),e.jsx("div",{className:"text-xs text-text-secondary leading-5.5",children:"Sign-in only — the server must support dynamic client registration. Manual OAuth (client ID / secret) isn't supported yet."})]}):null,i==="header"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-api-key",type:"password",required:!0,value:j,onChange:l=>{F(l.target.value)},placeholder:"Paste the server token",className:$})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-header-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Header name ",e.jsx("span",{className:"font-normal text-text-secondary",children:"(optional)"})]}),e.jsx("input",{id:"mcp-server-header-name",type:"text",value:k,onChange:l=>{M(l.target.value)},placeholder:"Authorization",className:$})]})]}):null]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[o?e.jsx("p",{className:"text-failure-bg text-sm",children:o}):null,e.jsx(z.Primary,{type:"submit",size:"large",disabled:!N||v,className:"w-full shrink-0",children:"Add"})]})]})})},xe=ue,_={dcr:"OAuth2",header:"API Key",none:"No Auth"};function he({text:n}){const u=r.useRef(null),[m,v]=r.useState(!1),[o,f]=r.useState(!1),[y,h]=r.useState(16);return r.useLayoutEffect(()=>{v(!1),h(16)},[n]),r.useLayoutEffect(()=>{const x=u.current;if(!x)return;if(!m){h(16),f(x.scrollWidth>x.clientWidth+1);return}h(16);const p=requestAnimationFrame(()=>{h(x.scrollHeight)});return()=>cancelAnimationFrame(p)},[n,m]),n?e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("p",{ref:u,style:{maxHeight:y},className:L("mt-0.5 overflow-hidden font-mono text-xs leading-4 text-text-secondary transition-[max-height] duration-300 ease-in-out",!m&&"whitespace-nowrap",!m&&o&&"pr-[5.75rem]"),children:[n,m&&o?e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",className:"cursor-pointer font-mono text-xs font-medium text-text-primary/80 hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring","aria-expanded":!0,onClick:()=>v(!1),children:"Show less"})]}):null]}),!m&&o?e.jsxs("button",{type:"button",className:"absolute top-0.5 right-0 cursor-pointer bg-card-bg pl-1.5 font-mono text-xs font-medium leading-4 text-text-primary/80 hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring","aria-expanded":!1,onClick:()=>v(!0),children:[e.jsx("span",{"aria-hidden":!0,className:"text-text-secondary",children:"…"}),e.jsx("span",{className:"ml-1",children:"Read more"})]}):null]}):null}var pe=({connector:n,onBack:u,onConnectorRefreshed:m,onDisconnect:v,busy:o=!1})=>{const{connectorCatalog:f}=J(),{handleAuthorize:y,isOAuthLoading:h}=ce(),[x,p]=r.useState([]),[w,i]=r.useState(!0),[b,j]=r.useState(null),[F,k]=r.useState(!1);r.useEffect(()=>{let a=!1;return p([]),j(null),i(!0),f.getToolsByConnectorId({id:n.id}).then(N=>{a||p(N)}).catch(N=>{a||j(H(N,"Failed to load connector tools"))}).finally(()=>{a||i(!1)}),()=>{a=!0}},[n.authenticated,n.id,f]);const M=async()=>{k(!0),j(null);try{const a=await f.getConnector({id:n.id});m(a)}catch(a){j(H(a,"Failed to refresh connector details"))}finally{k(!1)}},A=h||F;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:u,className:"mb-3 inline-flex w-fit items-center gap-1 rounded-md py-1 pr-2 text-sm text-text-secondary hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",children:[e.jsx(S,{name:"chevron-left",className:"size-3.5"}),"Connectors"]}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-y-auto pb-1",children:[e.jsxs("header",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(S,{name:"mcp-server",className:"size-5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-lg font-semibold text-text-primary",children:n.name}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[e.jsxs("span",{className:L("flex items-center gap-1.5 text-xs font-medium",n.authenticated?"text-success-bg":"text-text-primary"),children:[e.jsx("span",{className:L("h-1.5 w-1.5 rounded-full",n.authenticated?"bg-success-bg":"bg-primary-button-bg")}),n.authenticated?"Connected":"Not authenticated"]}),e.jsxs("span",{className:"text-text-secondary",children:["· ",n.description]})]}),e.jsx("span",{className:"mt-2 inline-flex items-center rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-text-secondary",children:_[n.auth.type]??_.none})]}),n.auth.type==="dcr"&&!n.authenticated?e.jsx(z.Secondary,{size:"small",type:"button",disabled:o||A,onClick:()=>{y(n.id,a=>{a&&M()})},children:A?"Connecting…":"Connect"}):n.auth.type==="dcr"&&!n.requiresAuth?e.jsx(z.Secondary,{size:"small",type:"button",disabled:o,onClick:v,children:"Disconnect"}):null]}),e.jsx("section",{className:"mt-6","aria-labelledby":"connector-tools-heading",children:w?e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"Loading tools…"}):b?e.jsxs("div",{className:"rounded-xl border border-failure-bg/30 bg-failure-bg/10 p-6 text-center text-sm text-failure-bg",children:[b,n.auth.type==="dcr"&&!n.authenticated&&e.jsx("div",{className:"font-bold mt-1",children:"Click Connect and authenticate successfully to view tools."})]}):x.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("h5",{id:"connector-tools-heading",className:"mb-2 text-[0.8125rem] font-semibold text-text-primary",children:["Tools ",e.jsxs("span",{className:"font-normal text-text-secondary",children:["· ",x.length]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:x.map(a=>e.jsx("article",{className:"flex min-h-12 items-start gap-3 border-b border-border px-3 py-2 last:border-b-0",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h6",{className:"text-sm font-medium text-text-primary",children:a.name}),e.jsx(he,{text:a.description})]})},a.id))})]}):e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"No tools reported for this connector."})})]})]})},fe=pe,be=()=>{const{connectorCatalog:n}=J(),u=de(),[m,v]=r.useState(""),[o,f]=r.useState({ordered:[],authStatusById:new Map}),[y,h]=r.useState(!0),[x,p]=r.useState(null),[w,i]=r.useState(null),[b,j]=r.useState(!1),[F,k]=r.useState([]),[M,A]=r.useState(!1),[a,N]=r.useState(null),[E,l]=r.useState(null),[I,R]=r.useState(""),G=r.useMemo(()=>(F??[]).reduce((t,s)=>(t[s.name]=s.logo??"",t),{}),[F]),K=r.useCallback(async()=>{h(!0),p(null);try{const[t,s]=await Promise.all([n.listConnectors(),n.getConnectorCatalog()]);k(s);const d=t??[],g=new Set(d.map(c=>c.id)),C=[...d.map(c=>({connector:c,isConfigured:!0})),...s.filter(c=>!g.has(c.id)).map(c=>({connector:c,isConfigured:!1}))];f({ordered:C,authStatusById:new Map(C.map(c=>[c.connector.id,c.isConfigured?c.connector.authenticated:!1]))}),l(c=>c?t.find(ie=>ie.id===c.id)??null:null)}catch(t){p(H(t,"Failed to load connectors"))}finally{h(!1)}},[n]);r.useEffect(()=>{K()},[K]);const P=m.trim().toLowerCase(),T=r.useMemo(()=>P?o.ordered.filter(({connector:t})=>{var s;return t.name.toLowerCase().includes(P)||(((s=t.description)==null?void 0:s.toLowerCase().includes(P))??!1)||t.url.toLowerCase().includes(P)}):o.ordered,[o.ordered,P]),D=r.useMemo(()=>{const t=[];for(const s of T)if(s.isConfigured){const d=o.authStatusById.get(s.connector.id)??s.connector.authenticated;t.push(d===s.connector.authenticated?s.connector:{...s.connector,authenticated:d})}return t},[o.authStatusById,T]),O=r.useMemo(()=>{const t=[];for(const s of T)s.isConfigured||t.push(s.connector);return t},[T]),q=async(t,s=p)=>{j(!0),p(null);try{await t(),await K()}catch(d){throw s(H(d,"Request failed")),d}finally{j(!1)}},U=()=>{N(null),R(""),i(null)},W=async(t,s)=>{const d=s??(t.auth.type==="header"?{type:"header",...t.auth.headerName?{headerName:t.auth.headerName}:{}}:t.auth.type==="dcr"?{type:"dcr"}:{type:"none"});await n.createConnector({name:t.name,description:t.description??t.url,url:t.url,auth:d})},Z=t=>{if(t.auth.type==="header"){R(""),i(null),N(t);return}q(async()=>{await W(t)}).catch(()=>{})},ee=t=>{if(t.preventDefault(),!a||!I.trim())return;const s=a;i(null),q(async()=>{const d={type:"header",apiKey:I.trim(),...s.auth.type==="header"&&s.auth.headerName?{headerName:s.auth.headerName}:{}},g=o.ordered.find(({connector:c})=>c.id===s.id),C=g!=null&&g.isConfigured?g.connector:void 0;C?await n.updateConnector({id:C.id,name:C.name,description:C.description,url:C.url,auth:d}):await W(s,d),U(),setTimeout(()=>{u==null||u.showSuccess({title:`${s.name} ${C?"updated":"connected"}`})},100)},i).catch(()=>{})},te=async t=>{i(null),await q(async()=>{await n.createConnector({...t})},i),setTimeout(()=>{u==null||u.showSuccess({title:`${t.name} added`})},0)},se=t=>{q(async()=>{await n.disconnectConnector({id:t.id}),l(null)}).catch(()=>{})},ae=t=>{l(s=>(s==null?void 0:s.id)===t.id?t:s),f(s=>{const d=new Map(s.authStatusById);return d.set(t.id,t.authenticated),{ordered:s.ordered.map(g=>g.isConfigured&&g.connector.id===t.id?{connector:t,isConfigured:!0}:g),authStatusById:d}})},re=(t,s)=>{const d=G[t.name],g=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:d?e.jsx(Y,{src:d,alt:t.name,className:"size-4.5"}):e.jsx(S,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description})]})]});return e.jsxs("article",{className:"flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0 cursor-pointer transition-colors hover:bg-ghost-button-hover/60",onClick:()=>{l(t)},children:[e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:g}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:L("flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium",t.authenticated?"text-success-bg":"text-text-primary"),children:[e.jsx("span",{className:L("h-1.5 w-1.5 rounded-full",t.authenticated?"bg-success-bg":"bg-primary-button-bg")}),t.authenticated?"Connected":"Added"]})}),t.auth.type==="header"?e.jsxs(z.Secondary,{size:"small",type:"button",disabled:b,onClick:c=>{c.stopPropagation(),R(""),N(t)},children:[e.jsx(S,{name:"wrench",className:"size-3"}),"Replace Key"]}):null,e.jsx(S,{name:"chevron-right",className:"size-4"})]})]},t.id)},ne=t=>{const s=G[t.name];return e.jsxs("article",{className:"flex min-h-16 w-full items-center gap-3 border-b border-border p-3 text-left last:border-b-0",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:s?e.jsx(Y,{src:s,alt:t.name,className:"size-4.5"}):e.jsx(S,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description??t.url})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("span",{className:"hidden text-xs text-text-secondary sm:inline",children:_[t.auth.type]??_.none}),e.jsx(z.Secondary,{size:"small",type:"button",disabled:b,onClick:()=>{Z(t)},children:t.auth.type==="dcr"?"Add":"Connect"})]})]},t.id)},V=r.useMemo(()=>a!==null&&o.ordered.some(t=>t.isConfigured&&t.connector.id===a.id),[a,o.ordered]);if(E)return e.jsx(fe,{connector:E,busy:b,onBack:()=>{l(null)},onConnectorRefreshed:ae,onDisconnect:()=>{se(E)}});const le=D.length>0||O.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Connectors"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Connect tools your agents can use."}),x?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:x}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full flex-col gap-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(oe,{query:m,setQuery:v,placeholder:"Search connectors"})}),e.jsxs(z.Secondary,{type:"button",onClick:()=>{i(null),A(!0)},children:[e.jsx(S,{name:"plus",size:"1rem",className:"mr-1"}),"Add MCP Server"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[y?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!y&&D.length>0?e.jsxs("section",{"aria-labelledby":"connected-connectors-heading",children:[e.jsxs("h4",{id:"connected-connectors-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Configured · ",D.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:D.map(t=>re(t))})]}):null,!y&&O.length>0?e.jsxs("section",{"aria-labelledby":"available-connectors-heading",children:[e.jsxs("h4",{id:"available-connectors-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Available · ",O.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:O.map(t=>ne(t))})]}):null,!y&&!le?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:m.trim()?`No connectors match “${m.trim()}”.`:"No connectors yet."}):null]}),e.jsx(X,{open:a!==null,onOpenChange:t=>{t||U()},title:`${V?"Replace key for":"Connect"} ${(a==null?void 0:a.name)??"connector"}`,description:a==null?void 0:a.url,contentSized:!0,className:"md:max-w-xl",children:e.jsxs("form",{onSubmit:ee,children:[e.jsxs("div",{className:"space-y-5 px-5 py-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(S,{name:"mcp-server",className:"size-6 text-text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-text-primary",children:a==null?void 0:a.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:a==null?void 0:a.description})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"connector-api-key",className:"mb-2 block text-xs font-semibold uppercase tracking-wide text-text-secondary",children:"API key / token"}),e.jsx("input",{id:"connector-api-key",type:"password",value:I,onChange:t=>{R(t.target.value)},placeholder:`Paste the token from ${(a==null?void 0:a.name)??"the provider"}`,autoFocus:!0,required:!0,className:Q("h-11")})]}),w?e.jsx("p",{className:"text-failure-bg text-sm",children:w}):null]}),e.jsxs("footer",{className:"flex justify-end gap-2 border-t border-border px-5 py-4",children:[e.jsx(z.Ghost,{type:"button",onClick:U,disabled:b,children:"Cancel"}),e.jsx(z.Primary,{type:"submit",disabled:!I.trim()||b,children:V?"Replace Key":"Connect"})]})]})}),e.jsx(xe,{open:M,onOpenChange:t=>{A(t),t||i(null)},onAdd:te,busy:b,error:w})]})})]})},ye=be;export{ye as default};
|
|
Binary file
|
|
Binary file
|
package/dist/_frontend/assets/{DockLayout-LM4AFMFY-DoBwJ3-e.js → DockLayout-NLFNU6F2-BGJvqqVS.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as a}from"./chunk-
|
|
1
|
+
import{S as a}from"./chunk-I3AL54MA--fCRbraS.js";import{j as o,C as t,d as l}from"./index-G4wOqi3O.js";import"./chunk-VUMGMGKZ-CUX2iOMe.js";function n({className:r}){return o.jsx(t,{children:o.jsx("div",{"data-aui-compact-layout":!0,className:l("ml-auto flex h-full w-full max-w-[min(400px,100%)] min-h-0 min-w-0 flex-col border-l border-border bg-primary-bg shadow-[-4px_0_24px_color-mix(in_oklab,var(--shadow-color)_6%,transparent)]",r),children:o.jsx(a,{})})})}export{n as DockLayout};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsBuilder-LSXK2VN4-B0Y9JGuK.js","assets/index-G4wOqi3O.js","assets/index-SN54UIUh.css","assets/SchedulesPage-WQU4H25F-BGlu6WXG.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{h as _,u as E,a as P,b as t,r as a,s as I,j as s,P as L,I as l,e as c,S as g,d as z,_ as p}from"./index-G4wOqi3O.js";import{A as B,S as k,N as D,T}from"./chunk-VUMGMGKZ-CUX2iOMe.js";var R=a.lazy(()=>p(()=>import("./SettingsBuilder-LSXK2VN4-B0Y9JGuK.js"),__vite__mapDeps([0,1,2]))),F=a.lazy(()=>p(()=>import("./SchedulesPage-WQU4H25F-BGlu6WXG.js"),__vite__mapDeps([3,1,2])).then(r=>({default:r.SchedulesPage})));function V({className:r}){const f=_(),e=E(),d=P(),b=t("ClearChatButton"),j=t("AgentDetailsPage"),y=t("AgentsLibrary"),A=t("SessionsPage"),w=t("SaveAgentButton"),N=t("SelectAgentEmptyState"),S=a.useRef(null),h=(e==null?void 0:e.mode.status)==="idle",u=(e==null?void 0:e.settingsOpen)===!0,n=(e==null?void 0:e.libraryOpen)===!0,m=(e==null?void 0:e.sessionsOpen)===!0,o=(e==null?void 0:e.schedulesOpen)===!0,i=u||n||m||o,v=e!=null&&I(e.mode)&&!i&&(!d||e.agentConfigOpen),x=(e==null?void 0:e.isNewChatEnabled)!==!1,C=()=>{if(e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled){e.openDraft();return}e==null||e.setSettingsOpen(!1),e==null||e.setSchedulesOpen(!1),Promise.resolve(f.threads().switchToNewThread()).catch(()=>{})},O=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return s.jsxs("div",{className:z("relative flex h-full min-h-0 w-full bg-primary-bg",r),children:[v?s.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:w-88 md:max-w-none md:shrink-0 md:shadow-none",children:s.jsx(B,{showClose:d})}):null,s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[s.jsx(L,{className:"bg-topbar-bg",title:i?n||o?s.jsxs("button",{type:"button",className:c({variant:"ghost",size:"small"}),onClick:()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSchedulesOpen(!1)},children:[s.jsx(l,{name:"arrow-left"}),"Back to chat"]}):null:s.jsx(D,{}),end:s.jsxs(s.Fragment,{children:[i?null:s.jsxs(s.Fragment,{children:[s.jsx(b,{}),s.jsx(w,{})]}),s.jsx(k,{},"shell-actions"),i?null:s.jsxs(s.Fragment,{children:[x?s.jsx("button",{type:"button","aria-label":"New Chat",title:"New Chat",className:c({variant:"ghost",size:"icon"}),onClick:C,children:s.jsx(l,{name:"square-pen"})}):null,x&&(e!=null&&e.isComposerEnabled)?s.jsx("button",{type:"button","aria-label":"New Agent",title:"New Agent",className:c({variant:"ghost",size:"icon"}),onClick:O,children:s.jsx(l,{name:"agent-2"})}):null]})]})}),s.jsx("div",{ref:S,className:"min-h-0 min-w-0 flex-1",children:u?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(g,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(R,{})}):m?s.jsx(A,{}):n&&(e==null?void 0:e.libraryAgentId)!=null?s.jsx(j,{agentId:e.libraryAgentId},e.libraryAgentId):n?s.jsx(y,{}):o?s.jsx(a.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(g,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(F,{})}):h?s.jsx(N,{}):s.jsx(T,{})})]})]})}export{V as DrawerLayout};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aD as be,a8 as fe,r as o,aE as Y,j as e,ad as ge,af as B,I as L,aF as ie,aG as xe,aH as ye,aI as ve,d as P,aJ as je,aB as Ne}from"./index-G4wOqi3O.js";var me=Ne("h-11 shadow-sm"),we=({open:n,onOpenChange:l,onSave:b,title:k,description:p,initialBaseUrl:E="",baseUrlPlaceholder:d="https://api.openai.com/v1",requireApiKey:c=!0,submitLabel:S="Save",busy:O=!1,error:F})=>{const[M,I]=o.useState(""),[y,x]=o.useState(""),[w,$]=o.useState(!1),U=()=>{I(""),x(""),$(!1)};o.useEffect(()=>{n&&(I(""),x(E),$(!1))},[n,E]);const Q=i=>{i||U(),l(i)},T=M.trim(),X=!c||!!T,v=async i=>{if(i.preventDefault(),!(!X||O))try{await b({apiKey:T,baseUrl:y.trim()}),U(),l(!1)}catch{}};return e.jsx(xe,{open:n,onOpenChange:Q,title:k,description:p,contentSized:!0,children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:v,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",c?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"model-provider-api-key",type:"password",required:c,value:M,onChange:i=>{I(i.target.value)},placeholder:c?"Enter API key":"Enter a new key",autoFocus:!0,className:me}),c?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(ye,{expanded:w,onChange:(i,K)=>$(K),className:"rounded-md border border-border",children:[e.jsx(ve,{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(L,{name:"chevron-down",className:P("size-4 shrink-0 text-text-secondary transition-transform duration-200",w?"rotate-0":"-rotate-90")})]})}),e.jsxs(je,{className:"space-y-1.5 border-t border-border px-3 pb-3 pt-4",children:[e.jsx("label",{htmlFor:"model-provider-base-url",className:"block text-sm font-medium text-text-primary",children:"Base URL"}),e.jsx("input",{id:"model-provider-base-url",type:"url",value:y,onChange:i=>{x(i.target.value)},placeholder:d,className:me}),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:[F?e.jsx("p",{className:"text-failure-bg text-sm",children:F}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!X||O,className:"w-full shrink-0",children:S})]})]})})},Ce=we,ke="128000",Ee="4096",pe=()=>({id:"",name:"",advancedExpanded:!0,contextLength:"",maxOutputTokens:""}),ue=n=>(n==null?void 0:n.models.map(l=>{var b,k,p,E,d;return{id:l.id,name:l.name,advancedExpanded:!0,reasoningEfforts:(b=l.properties)==null?void 0:b.reasoningEfforts,contextLength:((p=(k=l.properties)==null?void 0:k.contextLength)==null?void 0:p.toString())??"",maxOutputTokens:((d=(E=l.properties)==null?void 0:E.maxOutputTokens)==null?void 0:d.toString())??"",nameDirty:!0}}))??[pe()],G="h-11 w-full rounded-md border border-border/70 bg-secondary-bg px-3 text-sm text-text-primary outline-none transition-colors placeholder:text-text-secondary/70 focus-visible:border-focus-ring focus-visible:ring-2 focus-visible:ring-focus-ring/50",V="border-failure-bg focus-visible:border-failure-bg focus-visible:ring-failure-bg";function ce(n){const l=n.trim();if(l==="")return null;const b=Number(l);return Number.isInteger(b)&&b>0?b:null}function Se(n){return n.replace(/([a-zA-Z])(\d)/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/g,"")}var re=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),ee=({children:n})=>e.jsx("p",{className:"mt-1 text-xs text-failure-bg",children:n}),ne=({children:n})=>e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:n}),Me=({open:n,onOpenChange:l,onSubmit:b,reasoningEffortOptions:k,busy:p=!1,error:E,isEditMode:d=!1,initialValues:c})=>{const[S,O]=o.useState((c==null?void 0:c.name)??""),[F,M]=o.useState((c==null?void 0:c.baseUrl)??""),[I,y]=o.useState(""),[x,w]=o.useState(()=>ue(c)),[$,U]=o.useState(!1),[Q,T]=o.useState(!1),X=()=>{O((c==null?void 0:c.name)??""),M((c==null?void 0:c.baseUrl)??""),y(""),w(ue(c)),U(!1),T(!1)},v=s=>{s||X(),l(s)},i=(s,r)=>{w(g=>g.map((u,j)=>j===s?{...u,...r}:u))},K=()=>{U(!0),T(!0),w(s=>s.map(r=>({...r,idTouched:!0,contextTouched:!0,maxTouched:!0})))},f=S.trim(),D=f?null:"Name is required.",_=F.trim();let h=null;if(!_)h="Base URL is required.";else try{new URL(_)}catch{h="Enter a valid URL."}const J=s=>s.id.trim()?null:"Model ID is required.",te=s=>s.name.trim()?null:"Model name is required.",q=s=>ce(s.contextLength)==null?"Set the model's context window.":null,W=s=>ce(s.maxOutputTokens)==null?"Set the max output tokens.":null,oe=!D&&!h&&x.every(s=>!J(s)&&!te(s)),se=$&&D,H=Q&&h,A=async()=>{if(K(),!oe||p)return;const s=x.findIndex(r=>q(r)||W(r));if(s!==-1){i(s,{advancedExpanded:!0});const r=x[s],g=r&&q(r)?"context-length":"max-output-tokens";setTimeout(()=>{var j;const u=document.getElementById(`custom-provider-model-${s}-${g}`);(j=u==null?void 0:u.scrollIntoView)==null||j.call(u,{block:"center",behavior:"smooth"}),u==null||u.focus()},0);return}try{await b({name:f,baseUrl:_,apiKey:I.trim(),models:x.map(r=>{var R;const g={};(R=r.reasoningEfforts)!=null&&R.length&&(g.reasoningEfforts=r.reasoningEfforts);const u=ce(r.contextLength);u!=null&&(g.contextLength=u);const j=ce(r.maxOutputTokens);return j!=null&&(g.maxOutputTokens=j),{id:r.id.trim(),name:r.name.trim(),...Object.keys(g).length>0?{properties:g}:{}}})}),v(!1)}catch{}};return e.jsx(xe,{open:n,onOpenChange:v,title:d?`Edit ${(c==null?void 0:c.name)??S}`:"Add custom provider",description:d?"Update the endpoint, credentials, and models for this provider.":"Connect any OpenAI-compatible endpoint, whether it's a local model, a proxy, or your own hosted service.",contentSized:!0,children:e.jsxs("form",{className:"flex min-h-0 flex-1 flex-col",onSubmit:s=>{s.preventDefault(),A()},children:[e.jsxs("div",{className:"min-h-0 flex-1 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(re,{})]}),e.jsx("input",{id:"custom-provider-name",type:"text",value:S,onChange:s=>O(s.target.value),onBlur:()=>U(!0),placeholder:"local-llama",autoFocus:!d,readOnly:d,"aria-readonly":d,"aria-invalid":se?!0:void 0,className:P(G,d&&"cursor-not-allowed bg-secondary-bg/60 text-text-secondary",se&&V)}),d?e.jsx(ne,{children:"Provider names cannot be changed after creation."}):null,se?e.jsx(ee,{children:D}):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(re,{})]}),e.jsx("input",{id:"custom-provider-base-url",type:"text",value:F,onChange:s=>M(s.target.value),onBlur:()=>T(!0),placeholder:"http://localhost:11434/v1",autoFocus:d,"aria-invalid":H?!0:void 0,className:P(G,H&&V)}),H?e.jsx(ee,{children:h}):_?null:e.jsx(ne,{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:I,onChange:s=>y(s.target.value),placeholder:"sk-…",className:G}),e.jsx(ne,{children:d?"Leave blank to keep the saved key, or enter a new key to replace it.":"Leave blank if your endpoint needs no key (e.g. a local model)."})]}),e.jsxs("fieldset",{className:"m-0 min-w-0 border-0 p-0",children:[e.jsxs("legend",{className:"float-left mb-2 w-full p-0 text-sm font-medium text-text-primary",children:["Models",e.jsx(re,{})]}),e.jsx("div",{className:"clear-both",children:x.map((s,r)=>{const g=J(s),u=s.idTouched&&g,j=te(s),R=!!j&&s.nameDirty,le=q(s),C=W(s),z=s.contextTouched&&le,ae=s.maxTouched&&C;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:t=>{const a=t.target.value;i(r,{id:a,...s.nameDirty?{}:{name:Se(a)}})},onBlur:()=>i(r,{idTouched:!0}),placeholder:"llama3.1:70b","aria-invalid":u?!0:void 0,className:P(G,"font-mono",u&&V)})]}),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:t=>i(r,{name:t.target.value,nameDirty:!0}),placeholder:"llama-3-1-70b","aria-invalid":R?!0:void 0,className:P(G,R&&V)})]}),e.jsx("button",{type:"button","aria-label":`Remove model ${r+1}`,disabled:x.length===1||p,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:()=>w(t=>t.filter((a,m)=>m!==r)),children:e.jsx(L,{name:"trash",className:"size-4"})})]}),u?e.jsx(ee,{children:g}):null,R?e.jsx(ee,{children:j}):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:()=>i(r,{advancedExpanded:!s.advancedExpanded}),children:[e.jsx(L,{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(re,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-context-length`,type:"number",min:1,inputMode:"numeric",value:s.contextLength,onChange:t=>i(r,{contextLength:t.target.value}),onBlur:()=>i(r,{contextTouched:!0}),placeholder:ke,"aria-invalid":z?!0:void 0,className:P(G,z&&V)}),z?e.jsx(ee,{children:le}):s.contextLength.trim()===""?e.jsx(ne,{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(re,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-max-output-tokens`,type:"number",min:1,inputMode:"numeric",value:s.maxOutputTokens,onChange:t=>i(r,{maxOutputTokens:t.target.value}),onBlur:()=>i(r,{maxTouched:!0}),placeholder:Ee,"aria-invalid":ae?!0:void 0,className:P(G,ae&&V)}),ae?e.jsx(ee,{children:C}):s.maxOutputTokens.trim()===""?e.jsx(ne,{children:"Longest reply the model allows — use its real limit."}):null]}),k&&k.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:p,onChange:t=>i(r,{reasoningEfforts:t.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:k.map(t=>{var m;const a=((m=s.reasoningEfforts)==null?void 0:m.includes(t))??!1;return e.jsx("button",{type:"button","aria-pressed":a,disabled:p,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",a?"border-primary-button-bg bg-primary-button-bg text-primary-button-text":"border-border text-text-secondary hover:bg-ghost-button-hover"),onClick:()=>{var Z;return i(r,{reasoningEfforts:a?(Z=s.reasoningEfforts)==null?void 0:Z.filter(de=>de!==t):[...s.reasoningEfforts??[],t]})},children:t},t)})}):null]}):null]}):null]})]},r)})}),e.jsxs(B.Secondary,{size:"small",type:"button",className:"mt-4 w-fit",onClick:()=>w(s=>[...s,pe()]),children:[e.jsx(L,{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:[E?e.jsx("p",{className:"text-failure-bg text-sm",children:E}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!oe||p,className:"w-full",children:d?"Save changes":"Add provider"})]})]})})},Ue=Me;function Te(n){return"baseUrl"in n&&typeof n.baseUrl=="string"?n.baseUrl:""}var Pe=()=>{const{modelCatalog:n}=be(),l=fe(),[b,k]=o.useState(""),[p,E]=o.useState([]),[d,c]=o.useState([]),[S,O]=o.useState(!0),[F,M]=o.useState(null),[I,y]=o.useState(null),[x,w]=o.useState(!1),[$,U]=o.useState(null),[Q,T]=o.useState(null),[X,v]=o.useState(null),[i,K]=o.useState(!1),[f,D]=o.useState(null),_=o.useMemo(()=>(d??[]).reduce((t,a)=>(t[a.name]=a.logo??"",t),{}),[d]),h=b.trim().toLowerCase(),J=o.useCallback(async()=>{O(!0),M(null);try{const[t,a]=await Promise.all([n.listModelProviders(),n.getModelProviderCatalog()]);E(t),c(a)}catch(t){M(Y(t,"Failed to load model providers"))}finally{O(!1)}},[n]);o.useEffect(()=>{J()},[J]);const te=o.useMemo(()=>new Set(p.map(t=>t.type)),[p]),q=o.useMemo(()=>p.filter(t=>{var a;return((a=t.name)==null?void 0:a.toLowerCase().includes(h))||t.models.some(m=>m.name.toLowerCase().includes(h)||m.id.toLowerCase().includes(h))}),[p,h]),W=o.useMemo(()=>d.filter(t=>t.type!=="custom"&&!te.has(t.type)&&(t.name.toLowerCase().includes(h)||t.models.some(a=>a.name.toLowerCase().includes(h)||a.id.toLowerCase().includes(h)))),[d,te,h]),oe=o.useMemo(()=>{var t;return(t=d.find(a=>a.type==="custom"))==null?void 0:t.supportedReasoningEfforts},[d]),se=o.useMemo(()=>{const t=new Map;for(const a of d)t.set(a.type,a.models);return t},[d]),H=()=>{U(null),T(null),v(null)},A=async(t,a)=>{w(!0),M(null);try{await t(),await J(),H()}catch(m){throw a?a(m):l==null?M(Y(m,"Request failed")):l.showError(m),m}finally{w(!1)}},s=async(t,a)=>{v(null),await A(async()=>{await n.createModelProvider({type:t.type,name:t.name,...a.baseUrl?{baseUrl:a.baseUrl}:{},apiKey:a.apiKey,models:t.models})},m=>v(Y(m,"Request failed")))},r=async(t,a)=>{v(null),await A(async()=>{await n.updateModelProvider({id:t.id,type:t.type,name:t.name,...a.baseUrl?{baseUrl:a.baseUrl}:{},apiKey:a.apiKey,models:t.models})},m=>v(Y(m,"Request failed"))),l==null||l.showSuccess({title:`${t.name} updated`})},g=t=>{n.deleteModelProvider&&A(async()=>{await n.deleteModelProvider({id:t.id})}).catch(()=>{})},u=(t,a)=>{A(async()=>{await n.updateModelProvider({id:t.id,type:t.type,name:t.name,...t.baseUrl?{baseUrl:t.baseUrl}:{},apiKey:"",models:a})}).catch(()=>{})},j=async t=>{y(null),await A(async()=>{await n.createModelProvider({type:"custom",name:t.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},a=>y(Y(a,"Request failed"))),setTimeout(()=>{l==null||l.showSuccess({title:`${t.name} added`})},0)},R=async t=>{if(!f)return;const a=f;y(null),await A(async()=>{await n.updateModelProvider({id:a.id,type:a.type,name:a.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},m=>y(Y(m,"Request failed"))),setTimeout(()=>{l==null||l.showSuccess({title:"Model provider updated",description:`${a.name} was updated successfully.`})},0)},le=f?{name:f.name,baseUrl:f.baseUrl??"",models:f.models}:void 0,C=$!=null?p.find(t=>t.id===$)??null:null,z=Q!=null?d.find(t=>t.type===Q)??null:null,ae=C!=null||z!=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."}),F?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:F}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full flex-col gap-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(ge,{query:b,setQuery:k,placeholder:"Search providers and models"})}),e.jsxs(B.Secondary,{type:"button",onClick:()=>{y(null),D(null),K(!0)},children:[e.jsx(L,{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:[S?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!S&&q.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:q.map(t=>{const a=se.get(t.type)??[],m=new Set(t.models.map(N=>N.id)),Z=a.filter(N=>!m.has(N.id)),de=_[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:de?e.jsx(ie,{src:de,alt:t.name,className:"size-4.5"}):e.jsx(L,{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:x,onClick:()=>{t.type==="custom"?(H(),y(null),D(t),K(!0)):(v(null),T(null),U(t.id))},children:[e.jsx(L,{name:"wrench",className:"size-3.5"}),"Edit"]}),n.deleteModelProvider?e.jsx(B.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:x,onClick:()=>{g(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(N=>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:N.name}),e.jsx("button",{type:"button","aria-label":`Remove ${N.name}`,disabled:x,className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring disabled:opacity-50",onClick:()=>{u(t,t.models.filter(he=>he.id!==N.id))},children:e.jsx(L,{name:"trash",className:"size-3.5"})})]},N.id)),Z.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 · ",Z.length]}),Z.map(N=>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:N.name}),e.jsx(B.Secondary,{size:"small",type:"button",disabled:x,onClick:()=>{u(t,[...t.models,N])},children:"Add"})]},N.id))]}):null]})]},t.id)})})]}):null,!S&&W.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:W.map(t=>{const a=_[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:a?e.jsx(ie,{src:a,alt:t.name,className:"size-4.5"}):e.jsx(L,{name:"cpu",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:t.models.map(m=>m.name).join(" · ")})]})]}),e.jsxs(B.Secondary,{type:"button",disabled:x,onClick:()=>{v(null),U(null),T(t.type)},children:[e.jsx(L,{name:"wrench",className:"size-4"}),"Configure"]})]})},t.type)})})]}):null,!S&&q.length===0&&W.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:h?`No providers match “${b.trim()}”.`:"No model providers yet."}):null]}),e.jsx(Ce,{open:ae,onOpenChange:t=>{t||H()},onSave:t=>{if(C)return r(C,t);if(z)return s(z,t)},title:C?"Edit Provider Details":"Configure Provider Details",initialBaseUrl:C?C.baseUrl??"":z?Te(z):"",requireApiKey:C==null,submitLabel:C?"Save":"Create",busy:x,error:X}),e.jsx(Ue,{open:i,onOpenChange:t=>{K(t),t||(y(null),D(null))},isEditMode:f!==null,initialValues:le,onSubmit:f?R:j,reasoningEffortOptions:oe,busy:x,error:I},(f==null?void 0:f.id)??"add-custom-provider")]})})]})},ze=Pe;export{ze as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aD as H,a8 as V,r,aE as q,j as e,S as J,I as N,ay as Y,af as O,aG as Q,aH as W,aI as X,d as Z,aJ as ee,aB as te}from"./index-G4wOqi3O.js";var ae={execTimeoutMs:3e5,autoStopIntervalInMinutes:15,autoArchiveIntervalInMinutes:10080,autoDeleteIntervalInMinutes:43200},F=te("h-11 shadow-sm");function U(a){if(a.trim()==="")return null;const l=Number(a);return!Number.isFinite(l)||l<0?null:l}var se=({open:a,onOpenChange:l,onSave:d,title:g,description:I,initialConfig:R=null,requireApiKey:y=!0,busy:w=!1,error:C})=>{const[m,k]=r.useState(""),[u,x]=r.useState(""),[M,i]=r.useState(""),[p,o]=r.useState(""),[b,f]=r.useState(""),[P,v]=r.useState(!1),S=()=>{k(""),x(""),i(""),o(""),f(""),v(!1)};r.useEffect(()=>{if(!a)return;const s=R??ae;k(String(s.execTimeoutMs)),x(String(s.autoStopIntervalInMinutes)),i(String(s.autoArchiveIntervalInMinutes)),o(String(s.autoDeleteIntervalInMinutes)),f(""),v(!1)},[a,R]);const B=s=>{s||S(),l(s)},h=U(m),A=U(u),T=U(M),E=U(p),_=b.trim(),K=(!y||!!_)&&h!=null&&A!=null&&T!=null&&E!=null,z=async s=>{if(s.preventDefault(),!(!K||w||h==null||A==null||T==null||E==null))try{await d({execTimeoutMs:h,autoStopIntervalInMinutes:A,autoArchiveIntervalInMinutes:T,autoDeleteIntervalInMinutes:E,apiKey:_}),S(),l(!1)}catch{}};return e.jsx(Q,{open:a,onOpenChange:B,title:g,description:I,contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(N,{name:"cube",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:z,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"sandbox-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",y?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"sandbox-api-key",type:"password",required:y,value:b,onChange:s=>{f(s.target.value)},placeholder:y?"dtn_...":"Leave blank to keep existing",autoFocus:!0,className:F})]}),e.jsxs(W,{expanded:P,onChange:(s,t)=>v(t),className:"rounded-md border border-border",children:[e.jsx(X,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced settings",e.jsx(N,{name:"chevron-down",className:Z("size-4 shrink-0 text-text-secondary transition-transform duration-200",P?"rotate-0":"-rotate-90")})]})}),e.jsxs(ee,{className:"space-y-4 border-t border-border px-3 pb-3 pt-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-exec-timeout",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Exec timeout (ms)"}),e.jsx("input",{id:"sandbox-exec-timeout",type:"number",min:0,required:!0,value:m,onChange:s=>{k(s.target.value)},placeholder:"300000",className:F})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-stop",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-stop interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-stop",type:"number",min:0,required:!0,value:u,onChange:s=>{x(s.target.value)},placeholder:"15",className:F})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-archive",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-archive interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-archive",type:"number",min:0,required:!0,value:M,onChange:s=>{i(s.target.value)},placeholder:"10080",className:F})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-delete",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-delete interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-delete",type:"number",min:0,required:!0,value:p,onChange:s=>{o(s.target.value)},placeholder:"43200",className:F})]})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[C?e.jsx("p",{className:"text-failure-bg text-sm",children:C}):null,e.jsx(O.Primary,{type:"submit",size:"large",disabled:!K||w,className:"w-full shrink-0",children:"Save"})]})]})})},ne=se,re=1e4,D=({execTimeoutMs:a,autoStopIntervalInMinutes:l,autoArchiveIntervalInMinutes:d,autoDeleteIntervalInMinutes:g})=>({execTimeoutMs:a,autoStopIntervalInMinutes:l,autoArchiveIntervalInMinutes:d,autoDeleteIntervalInMinutes:g}),le=a=>{switch(a){case"pending":return{label:"Syncing image...",className:"text-warning-bg"};case"ready":return{label:"Connected",className:"text-success-bg"};case"failed":return{label:"Sync failed",className:"text-failure-bg"};default:return{label:a,className:"text-text-secondary"}}},ie=()=>{const{sandboxCatalog:a}=H(),l=V(),[d,g]=r.useState([]),[I,R]=r.useState([]),[y,w]=r.useState(!0),[C,m]=r.useState(null),[k,u]=r.useState(null),[x,M]=r.useState(!1),[i,p]=r.useState(null),[o,b]=r.useState(null),f=r.useCallback(async({quiet:t=!1}={})=>{if(a){t||w(!0),m(null);try{const[n,c]=await Promise.all([a.listSandboxProviders(),a.getSandboxProviderCatalog()]);g(n),R(c)}catch(n){m(q(n,"Failed to load sandbox providers"))}finally{t||w(!1)}}},[a]);r.useEffect(()=>{f()},[f]);const P=d.some(t=>t.snapshotSyncStatus.status==="pending");r.useEffect(()=>{if(!a||!P)return;const t=a;let n=!1,c;function j(){c=window.setTimeout(()=>{$()},re)}async function $(){try{const L=await t.listSandboxProviders();if(n)return;g(L),m(null),L.some(G=>G.snapshotSyncStatus.status==="pending")&&j()}catch(L){if(n)return;m(q(L,"Failed to refresh sandbox providers")),j()}}return j(),()=>{n=!0,c!==void 0&&window.clearTimeout(c)}},[a,P]);const v=d.length>0,S=r.useMemo(()=>{if(v)return[];const t=new Set(d.map(n=>n.data.catalogId));return I.filter(n=>!t.has(n.id))},[I,d,v]),B=r.useMemo(()=>o?D(o):i?D(i):null,[o,i]);if(!a)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Sandbox provider catalog is not available."});const h=async(t,n=m)=>{M(!0),m(null);try{await t(),await f({quiet:!0})}catch(c){throw n(q(c,"Request failed")),c}finally{M(!1)}},A=async t=>{i&&(u(null),await h(async()=>{await a.createSandboxProvider({catalogId:i.id,name:i.name,type:i.type,...D(t),apiKey:t.apiKey})},u),p(null),setTimeout(()=>{l==null||l.showSuccess({title:`${i.name} configured`})},0))},T=async t=>{o&&(u(null),await h(async()=>{await a.updateSandboxProvider({id:o.id,...D(t),...t.apiKey?{apiKey:t.apiKey}:{}})},u),b(null),setTimeout(()=>{l==null||l.showSuccess({title:`${o.name} updated`})},0))},E=t=>{h(async()=>{await a.updateSandboxProvider({id:t.id,...D(t)})}).catch(()=>{})},_=t=>{const n=a.deleteSandboxProvider;n&&h(async()=>{await n({id:t.id})}).catch(()=>{})},K=i!=null||o!=null,z=o!=null,s=o?`Update ${o.name}`:i?`Configure ${i.name}`:"Configure sandbox provider";return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Sandbox providers"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Choose a provider that runs sandboxes for code, files and shell commands. Only one can be active at a time."}),C?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:C}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-auto",children:y?e.jsx("p",{className:"text-sm text-text-secondary",children:"Loading sandbox providers…"}):e.jsxs("div",{className:"space-y-6",children:[d.length>0?e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Configured · ",d.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:d.map(t=>{const n=t.data,c=le(t.snapshotSyncStatus.status),j=t.snapshotSyncStatus.statusReason,$=e.jsxs("span",{className:`inline-flex items-center gap-1.5 text-sm font-medium ${c.className}`,children:[t.snapshotSyncStatus.status==="pending"?e.jsx(J,{size:16,"aria-label":"Syncing snapshot image"}):t.snapshotSyncStatus.status==="ready"?e.jsx("span",{className:"size-2 rounded-full bg-success-bg","aria-hidden":!0}):t.snapshotSyncStatus.status==="failed"?e.jsx(N,{name:"triangle-exclamation",className:"size-4"}):null,c.label]});return e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(N,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:n.name})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[$,j?e.jsx(Y,{content:j,children:e.jsx("button",{type:"button","aria-label":"Snapshot sync status details",className:"inline-flex text-text-secondary transition-colors hover:text-text-primary",children:e.jsx(N,{name:"info",className:"size-4"})})}):null,t.snapshotSyncStatus.status==="failed"?e.jsx(O.Ghost,{size:"small",type:"button",disabled:x,onClick:()=>{E(n)},children:"Retry"}):null,e.jsx(O.Secondary,{size:"small",type:"button",disabled:x,onClick:()=>{u(null),p(null),b(n)},children:"Update"}),a.deleteSandboxProvider?e.jsx(O.Ghost,{size:"small",className:"text-text-secondary",type:"button",disabled:x,onClick:()=>{_(n)},children:"Remove"}):null]})]},n.id)})})]}):null,v?null:e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available · ",S.length]}),S.length===0?e.jsx("p",{className:"text-sm text-text-secondary",children:I.length>0?"All catalog providers are configured.":"No sandbox providers in the catalog."}):e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:S.map(t=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(N,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsx(O.Secondary,{type:"button",disabled:x,onClick:()=>{u(null),b(null),p(t)},children:"Configure"})]},t.id))})]})]})}),e.jsx(ne,{open:K,onOpenChange:t=>{t||(u(null),p(null),b(null))},onSave:z?T:A,title:s,description:z?"Update this sandbox provider. Leave API key blank to keep the existing key.":"Configure this sandbox provider. API key is never stored in the catalog.",initialConfig:B,requireApiKey:!z,busy:x,error:k})]})},de=ie;export{de as default};
|
|
Binary file
|
|
Binary file
|