@truefoundry/trueforge 0.2.0-rc.1 → 0.2.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_frontend/assets/AgentCodeSnippets-N546FNNS-DlWVvctF.js +1 -0
- package/dist/_frontend/assets/AgentCodeSnippets-N546FNNS-DlWVvctF.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-N546FNNS-DlWVvctF.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-YWJYVYYA-DTDXcVgE.js +1 -0
- package/dist/_frontend/assets/AgentMetricChart-YWJYVYYA-DTDXcVgE.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-YWJYVYYA-DTDXcVgE.js.gz +0 -0
- package/dist/_frontend/assets/{AgentOverview-EEBHJC32-Bn4qidnv.js → AgentOverview-VF74XC7I-DuR4GDFb.js} +1 -1
- package/dist/_frontend/assets/AgentOverview-VF74XC7I-DuR4GDFb.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-VF74XC7I-DuR4GDFb.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-RFR6LQMY-B_5nS70p.js +1 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-RFR6LQMY-B_5nS70p.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-RFR6LQMY-B_5nS70p.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-27CQF6FX-DSTwylcS.js +1 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-27CQF6FX-DSTwylcS.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-27CQF6FX-DSTwylcS.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-4IVX2SGD-Bf2N2ega.js +1 -0
- package/dist/_frontend/assets/AgentSessions-4IVX2SGD-Bf2N2ega.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-4IVX2SGD-Bf2N2ega.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-R5VEP7BO-Cvdqimeu.js +1 -0
- package/dist/_frontend/assets/ConnectorSettings-R5VEP7BO-Cvdqimeu.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-R5VEP7BO-Cvdqimeu.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-LM4AFMFY-DoBwJ3-e.js → DockLayout-F44RWGEY-DVcqWNpi.js} +1 -1
- package/dist/_frontend/assets/DrawerLayout-SQ323AVM-CrsDJpVR.js +2 -0
- package/dist/_frontend/assets/DrawerLayout-SQ323AVM-CrsDJpVR.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-SQ323AVM-CrsDJpVR.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-6QLS63HM-B0omK7y_.js +1 -0
- package/dist/_frontend/assets/ModelSettings-6QLS63HM-B0omK7y_.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-6QLS63HM-B0omK7y_.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-OLKDXIQS-O1pf1zn0.js +1 -0
- package/dist/_frontend/assets/SandboxSettings-OLKDXIQS-O1pf1zn0.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-OLKDXIQS-O1pf1zn0.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-TMOTK6DR-D9JlkZFv.js +1 -0
- package/dist/_frontend/assets/SchedulesPage-TMOTK6DR-D9JlkZFv.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-TMOTK6DR-D9JlkZFv.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-GISAH2WU-2fVa9yeg.js +2 -0
- package/dist/_frontend/assets/SettingsBuilder-GISAH2WU-2fVa9yeg.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-GISAH2WU-2fVa9yeg.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-EN33DUQ7-C280D67g.js +1 -0
- package/dist/_frontend/assets/ShellRouteSync-EN33DUQ7-C280D67g.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-EN33DUQ7-C280D67g.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-35K4AKTC-0-Mjo6gf.js +2 -0
- package/dist/_frontend/assets/SidebarLayout-35K4AKTC-0-Mjo6gf.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-35K4AKTC-0-Mjo6gf.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-JSX2BTII-BriJH4Oj.js +1 -0
- package/dist/_frontend/assets/SkillSettings-JSX2BTII-BriJH4Oj.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-JSX2BTII-BriJH4Oj.js.gz +0 -0
- package/dist/_frontend/assets/TrueForgeUIWithRouter-6VCR7ES3-CtIaYnA8.js +1 -0
- package/dist/_frontend/assets/WidgetLayout-RKBSN2FZ-u6iVYu3w.js +1 -0
- package/dist/_frontend/assets/WidgetLayout-RKBSN2FZ-u6iVYu3w.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-RKBSN2FZ-u6iVYu3w.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-62JRHF6Z-BLb_tkPU.js → chunk-62JRHF6Z-DYrEQoq5.js} +1 -1
- package/dist/_frontend/assets/chunk-62JRHF6Z-DYrEQoq5.js.br +0 -0
- package/dist/_frontend/assets/chunk-62JRHF6Z-DYrEQoq5.js.gz +0 -0
- package/dist/_frontend/assets/chunk-73FQVITT-mgvTPDmd.js +1 -0
- package/dist/_frontend/assets/chunk-73FQVITT-mgvTPDmd.js.br +0 -0
- package/dist/_frontend/assets/chunk-73FQVITT-mgvTPDmd.js.gz +0 -0
- package/dist/_frontend/assets/chunk-GIPFF6FZ-DPTdcXQj.js +2 -0
- package/dist/_frontend/assets/chunk-GIPFF6FZ-DPTdcXQj.js.br +0 -0
- package/dist/_frontend/assets/chunk-GIPFF6FZ-DPTdcXQj.js.gz +0 -0
- package/dist/_frontend/assets/chunk-LUG7E6BL-QKvrInc2.js +1 -0
- package/dist/_frontend/assets/chunk-LUG7E6BL-QKvrInc2.js.br +0 -0
- package/dist/_frontend/assets/chunk-LUG7E6BL-QKvrInc2.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-BNfxrwWp.js +1 -0
- package/dist/_frontend/assets/cssMode-BNfxrwWp.js.br +0 -0
- package/dist/_frontend/assets/cssMode-BNfxrwWp.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-mt8l8QVE.js → freemarker2-ClbLzW-k.js} +1 -1
- package/dist/_frontend/assets/freemarker2-ClbLzW-k.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-ClbLzW-k.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-C97jT8Zn.js → handlebars-5nE6yTDt.js} +1 -1
- package/dist/_frontend/assets/handlebars-5nE6yTDt.js.br +0 -0
- package/dist/_frontend/assets/handlebars-5nE6yTDt.js.gz +0 -0
- package/dist/_frontend/assets/{html-DKtvlaWU.js → html-BZRf7Zhg.js} +1 -1
- package/dist/_frontend/assets/html-BZRf7Zhg.js.br +0 -0
- package/dist/_frontend/assets/html-BZRf7Zhg.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-C6O73C_r.js +1 -0
- package/dist/_frontend/assets/htmlMode-C6O73C_r.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-C6O73C_r.js.gz +0 -0
- package/dist/_frontend/assets/{index-D8eVAzN5.css → index-BBGLYdJn.css} +1 -1
- package/dist/_frontend/assets/index-BBGLYdJn.css.br +0 -0
- package/dist/_frontend/assets/index-BBGLYdJn.css.gz +0 -0
- package/dist/_frontend/assets/index-D0Yf366e.js +18 -0
- package/dist/_frontend/assets/index-D0Yf366e.js.br +0 -0
- package/dist/_frontend/assets/index-D0Yf366e.js.gz +0 -0
- package/dist/_frontend/assets/{index-BW-oaxAt.js → index-DBjak9Sg.js} +4 -4
- package/dist/_frontend/assets/index-DBjak9Sg.js.br +0 -0
- package/dist/_frontend/assets/index-DBjak9Sg.js.gz +0 -0
- package/dist/_frontend/assets/index-DhA9jnhv.css +1 -0
- package/dist/_frontend/assets/index-DhA9jnhv.css.br +0 -0
- package/dist/_frontend/assets/index-DhA9jnhv.css.gz +0 -0
- package/dist/_frontend/assets/index-XpZpj5Rl.js +933 -0
- package/dist/_frontend/assets/index-XpZpj5Rl.js.br +0 -0
- package/dist/_frontend/assets/index-XpZpj5Rl.js.gz +0 -0
- package/dist/_frontend/assets/{javascript-Cs0N3w-s.js → javascript-CrSAQdU4.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-CqrfFSVA.js → jsonMode-Dal25yu2.js} +4 -4
- package/dist/_frontend/assets/jsonMode-Dal25yu2.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-Dal25yu2.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-C11lKF6J.js → liquid-Ci7gjLGv.js} +1 -1
- package/dist/_frontend/assets/liquid-Ci7gjLGv.js.br +0 -0
- package/dist/_frontend/assets/liquid-Ci7gjLGv.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-DBZtnSMo.js → lspLanguageFeatures-rM-QiA57.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-rM-QiA57.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-rM-QiA57.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-CCo4oKJJ.js → mdx-J3rSuJw4.js} +1 -1
- package/dist/_frontend/assets/mdx-J3rSuJw4.js.br +0 -0
- package/dist/_frontend/assets/mdx-J3rSuJw4.js.gz +0 -0
- package/dist/_frontend/assets/{python-627g_SSG.js → python-BSpXGEco.js} +1 -1
- package/dist/_frontend/assets/python-BSpXGEco.js.br +0 -0
- package/dist/_frontend/assets/python-BSpXGEco.js.gz +0 -0
- package/dist/_frontend/assets/{razor-BGDxoA7p.js → razor-DLV1uhEc.js} +1 -1
- package/dist/_frontend/assets/razor-DLV1uhEc.js.br +0 -0
- package/dist/_frontend/assets/razor-DLV1uhEc.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-gPT7Bbjh.js → tsMode-CQqRu3mP.js} +1 -1
- package/dist/_frontend/assets/tsMode-CQqRu3mP.js.br +0 -0
- package/dist/_frontend/assets/tsMode-CQqRu3mP.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-Cb0PzreF.js → typescript-BExfm66c.js} +1 -1
- package/dist/_frontend/assets/typescript-BExfm66c.js.br +0 -0
- package/dist/_frontend/assets/typescript-BExfm66c.js.gz +0 -0
- package/dist/_frontend/assets/{workers-BAgwFgJ0.js → workers-Cn25A5Lb.js} +1 -1
- package/dist/_frontend/assets/workers-Cn25A5Lb.js.br +0 -0
- package/dist/_frontend/assets/workers-Cn25A5Lb.js.gz +0 -0
- package/dist/_frontend/assets/{xml-BpvCCHF9.js → xml-D2IDD-hb.js} +1 -1
- package/dist/_frontend/assets/xml-D2IDD-hb.js.br +0 -0
- package/dist/_frontend/assets/xml-D2IDD-hb.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-f3XKmHoH.js → yaml-CY4c2A0Y.js} +1 -1
- package/dist/_frontend/assets/yaml-CY4c2A0Y.js.br +0 -0
- package/dist/_frontend/assets/yaml-CY4c2A0Y.js.gz +0 -0
- package/dist/_frontend/index.html +5 -2
- package/dist/controller-main.js +119 -21
- package/dist/controller-main.js.map +1 -1
- package/dist/main.js +15177 -13274
- 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/postgres/migrations/20260907_000001_schedule_run_reason.js +15 -0
- package/dist/postgres/migrations/20260907_000001_schedule_run_reason.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/dist/sqlite/migrations/20260907_000001_schedule_run_reason.js +17 -0
- package/dist/sqlite/migrations/20260907_000001_schedule_run_reason.js.map +1 -0
- package/package.json +17 -16
- package/dist/_frontend/assets/AgentCodeSnippets-NZOFJE57-Bn94i1Ie.js +0 -1
- 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 +0 -1
- 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 +0 -1
- 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 +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 +0 -2
- 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 +0 -1
- 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 +0 -1
- 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 +0 -1
- 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-CB2SckMT.css +0 -1
- package/dist/_frontend/assets/index-CB2SckMT.css.br +0 -0
- package/dist/_frontend/assets/index-CB2SckMT.css.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 +0 -923
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as u,r as s,j as t,I as x,e as i}from"./index-XpZpj5Rl.js";function h({snippets:a}){var c;const m=u("AgentCodeBlock"),[d,n]=s.useState((c=a[0])==null?void 0:c.language),[o,l]=s.useState("stream");s.useEffect(()=>{var e;n((e=a[0])==null?void 0:e.language),l("stream")},[a]);const r=a.find(e=>e.language===d)??a[0];return r===void 0?t.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."}):t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3 p-3 md:flex-row",children:[t.jsx("nav",{"aria-label":"Code sample languages",className:"flex shrink-0 gap-1 overflow-auto md:w-44 md:flex-col",children:a.map(e=>t.jsxs("button",{type:"button","aria-current":r.language===e.language?"page":void 0,className:i("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?t.jsx("img",{src:e.icon,alt:"",className:"size-4 shrink-0 object-contain"}):t.jsx(x,{name:"code",className:"size-4 shrink-0"}),e.labelName]},e.language))}),t.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:[t.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-1 border-b border-border px-3",children:[t.jsx("div",{className:"flex items-end gap-1",children:[["stream","Stream"],["nonStream","Non-stream"]].map(([e,g])=>t.jsx("button",{type:"button",className:i("relative h-10 cursor-pointer px-3 text-xs font-medium text-text-secondary",o===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:g},e))}),t.jsxs("a",{href:"https://trueforge.dev/api/use-agent",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-text-secondary",children:[t.jsx("span",{children:"View Docs"}),t.jsx(x,{name:"external-link",className:"size-3 shrink-0"})]})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t.jsx(m,{code:r.sampleCode[o],language:r.language})})]})]})}export{h as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ab as j,r as d,j as a,aw as C,av as k}from"./index-XpZpj5Rl.js";import{c as F,a as M,d as R,L as S,e as w,P as D,f as T,p}from"./index-D0Yf366e.js";M.register(R,S,w,D,T,p);var E=["#6366F1","#2563eb","#0EA5E9"],$=["#6366F1","#60a5fa","#38BDF8"],A=new Intl.NumberFormat(void 0,{maximumFractionDigits:4}),O=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});function f(e,t){return t==="$"?C(e):t==="ms"?k(e):`${A.format(e)}${t==="count"||t.length===0?"":` ${t}`}`}function _(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:O.format(t)}function G({graph:e,definition:t,error:u,colorIndex:b=0}){const l=j(),r=l==="dark"?$:E,i=l==="dark"?"#71717a":"#a1a1aa",m=l==="dark"?"#27272a":"#e4e4e7",c=d.useMemo(()=>e==null?[]:[...new Set(e.graphLines.flatMap(s=>s.values.map(o=>o.timestamp)))].sort(),[e]),y=d.useMemo(()=>({labels:c.map(_),datasets:(e==null?void 0:e.graphLines.map((s,o)=>{const L=new Map(s.values.map(n=>[n.timestamp,n.value])),x=r[(b+o)%r.length];return{label:s.name,data:c.map(n=>L.get(n)??null),borderColor:x,backgroundColor:x,pointRadius:0,pointHoverRadius:0,borderWidth:2,borderCapStyle:"butt",borderJoinStyle:"miter",tension:0,spanGaps:!0}}))??[]}),[b,r,e,c]),v=d.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:!1,interaction:{intersect:!1,mode:"index"},plugins:{legend:{display:((e==null?void 0:e.graphLines.length)??0)>1,labels:{color:i,boxWidth:10,boxHeight:2}},tooltip:{callbacks:{label:s=>{const o=s.parsed.y;return`${s.dataset.label??""}: ${o==null?"—":f(o,(e==null?void 0:e.unit)??"")}`}}}},scales:{x:{grid:{display:!1},border:{color:m},ticks:{color:i,maxRotation:0,autoSkip:!0,maxTicksLimit:8}},y:{beginAtZero:!0,grid:{color:m},border:{display:!1},ticks:{color:i,callback:s=>f(Number(s),(e==null?void 0:e.unit)??"")}}}}),[i,e,m]),N=(e==null?void 0:e.graphLines.some(s=>s.values.length>0))===!0;return a.jsxs("section",{className:"min-w-0 rounded-lg border border-border bg-card-bg p-4","data-slot":"agent-metric-chart",children:[a.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:(e==null?void 0:e.displayName)??t.displayName}),a.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:(e==null?void 0:e.description)??t.description}),a.jsx("div",{className:"mt-4 h-64",children:u!=null?a.jsx("div",{className:"flex h-full items-center justify-center text-sm text-failure-bg",children:u}):N?a.jsx(F,{data:y,options:v}):a.jsx("div",{className:"flex h-full items-center justify-center text-sm text-text-secondary",children:"No data"})})]})}export{G as AgentMetricChart};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as R,r as _,j as e,I as O,e as D}from"./index-XpZpj5Rl.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{c as u,ab as b,r,ac as f,j as t,ad as h,e as S}from"./index-XpZpj5Rl.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 p-2",children:t.jsx(d,{turns:l,segments:a,hiddenTypes:i,onSelectTurn:o})})]})}export{g as AgentSessionEventTimeline};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ab as Z,r as a,ae as Re,af as Ie,ag as Pe,ah as De,ai as Le,aj as Ge,ak as Be,al as m,ad as E,am as $,an as Y,ao as Oe,ap as $e,aq as He,ar as Xe,j as s,as as We,at as ze,au as Ue,av as Fe,aw as Ve,ax as Ke,ay as S,az as qe,aA as ve}from"./index-XpZpj5Rl.js";import{C as Ye,a as Je,B as Qe,b as Ze,L as et,P as tt,S as st,p as nt}from"./index-D0Yf366e.js";function at(n){return n.type!=="system"||n.description.trim().length>0}function Me({segment:n,subAgentLabel:r}){const d=!n.isMarker&&!qe.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:[r!=null?s.jsx("div",{className:"border-b border-border py-1.5 text-text-secondary",children:`Sub-Agent: ${r}`}):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 rt({turn:n,turnNumber:r,durationMs:d,segments:i}){const C=Z()==="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 ${r}`}),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(r=>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:r.description||r.title}),s.jsx("span",{className:"shrink-0 tabular-nums text-text-secondary",children:S(r.endMs-r.startMs)})]},r.id))})]})}function lt({group:n}){const r=Z()==="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,r)}}),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((r,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?r.description||r.title:`Sub-agent ${d+1}: ${r.description||r.title}`}),n.segments.length===1?null:s.jsx("span",{className:"shrink-0 tabular-nums text-text-secondary",children:S(r.endMs-r.startMs)})]},r.id))})]})}Je.register(Qe,Ze,et,tt,st,nt);var J=4,ye=12,be=12,ct=2,ut=8,dt=2,mt=30;function pt({heights:n,gaps:r}){const d=[];let i=0;return n.forEach((C,l)=>{d.push(i+C/2),i+=C+(r[l]??0)}),{centers:d,band:i}}function Q(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:r,y:d,base:i}=n;return typeof r!="number"||typeof d!="number"||typeof i!="number"?null:{x:(r+i)/2,y:d}}function yt({turns:n,segments:r,hiddenTypes:d,onSelectTurn:i}){var fe;const l=Z()==="dark",b=l?"#8c8c92":"#71717a",H=l?"#27272a":"#e4e4e7",ee=l?"#3f3f46":"#E0ECFD",te=l?"#52525b":"#E0ECFD",X=a.useRef(null),[se,je]=a.useState(0),[ne,we]=a.useState(mt),[o,ae]=a.useState(null),[ge,W]=a.useState(null),z=a.useRef(""),U=a.useRef(null);a.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=a.useCallback(()=>{const e=X.current,t=U.current;e==null||t==null||W({left:t,top:e.getBoundingClientRect().bottom})},[]),Ne=a.useCallback(()=>{z.current="",U.current=null,ae(null),W(null)},[]);a.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,...r.map(e=>e.endMs)),v=Math.max(1,ze(ke)),{turnStartsMs:re,turnOrdinals:oe,turnRanges:F}=a.useMemo(()=>Re(r),[r]),T=a.useMemo(()=>re.filter((e,t)=>t===0||e<=v),[v,re]),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=a.useMemo(()=>T.slice(1).map((e,t)=>({startMs:e+t*x,endMs:e+(t+1)*x})),[T,x]),_=a.useMemo(()=>r.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,r,x,oe]),R=a.useMemo(()=>Ie(_),[_]),j=a.useMemo(()=>_.filter(e=>!e.isMarker),[_]),y=a.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+J*M})),[M,x,F]),w=a.useMemo(()=>j.filter(e=>e.type==="sub_agent"),[j]),I=a.useMemo(()=>Pe(w),[w]),ue=a.useMemo(()=>De({bars:I,subAgentSegments:w}),[I,w]),g=a.useMemo(()=>Le({subAgentSegments:w,threadSegments:j,minWidthMs:J*M}),[j,M,w]),P=a.useMemo(()=>[...j.filter(e=>e.threadId===Ge),...I].sort((e,t)=>e.startMs-t.startMs||e.endMs-t.endMs),[j,I]),N=a.useMemo(()=>Be(P.filter(e=>e.type==="tool_call")).filter(e=>e.segments.length>1),[P]),de=a.useMemo(()=>new Set(N.flatMap(e=>e.segments.map(t=>t.id))),[N]),D=a.useMemo(()=>P.filter(e=>!de.has(e.id)),[de,P]),me=g.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}=a.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]),q=a.useMemo(()=>[...y.map(e=>({type:m.turn,bar:e})),...R.map(e=>({type:m.markerGroup,group:e})),...g.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}}),...N.map(e=>({type:m.toolCallGroup,group:e}))],[D,R,ue,g,N,y]),B=({label:e,range:t,y:c,color:u,hover:p,thickness:h,order:O=1,inflateAmount:he})=>({label:e,data:[{x:Ue(t),y:c}],backgroundColor:u,hoverBackgroundColor:p,hoverBorderColor:p,borderWidth:0,borderSkipped:!1,borderRadius:ct,minBarLength:J,barThickness:h,grouped:!1,order:O,...he==null?{}:{inflateAmount:he}}),Se=a.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=>Y(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}}),...g.flatMap(e=>e.segments.map(t=>B({label:`${Y(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:Q(t.type),inflateAmount:.5}))),...D.map(e=>B({label:`${Y(e.type)}: ${e.title}`,range:e,y:k[L]??0,color:E(e.type,l),hover:$(e.type,l),thickness:28,order:Q(e.type),inflateAmount:.5})),...N.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:Q("tool_call"),inflateAmount:.5}))]}),[k,L,l,D,R,A,g,N,y,ee,te]),Ce=a.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=a.useMemo(()=>({id:"timelineOverhead",afterLayout(e){const t=Math.round(e.height-e.chartArea.height);we(c=>c===t?c:t)}}),[]),Ae=a.useMemo(()=>({indexAxis:"y",animation:!1,responsive:!0,maintainAspectRatio:!1,onClick:(e,t)=>{var u;const c=q[((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:q[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&&(U.current=p.clientX,f()),c==null)return;const h=Xe(u);if(z.current!==h){if(z.current=h,ae(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,align:"inner",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,q,H,i,f,ce,ie,V,x]),pe=(o==null?void 0:o.type)===m.turn?n[o.bar.turnIndex]:void 0,_e=a.useMemo(()=>({height:G+ne}),[G,ne]),xe=(o==null?void 0:o.type)===m.turn&&pe!=null?s.jsx(rt,{turn:pe,turnNumber:o.bar.ordinal+1,durationMs:o.bar.durationMs,segments:r.filter(e=>e.turnIndex===o.bar.turnIndex)}):(o==null?void 0:o.type)===m.event&&at(o.segment)?s.jsx(Me,{segment:o.segment,subAgentLabel:o.segment.type==="sub_agent"||(fe=g.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:ge,children:s.jsx("div",{className:"w-full",style:_e,onMouseLeave:Ne,children:s.jsx(Ye,{type:"bar",data:Se,options:Ae,plugins:[Ce,Te]})})})})}export{yt as AgentSessionEventTimelineChart};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Fe=e=>{throw TypeError(e)};var Oe=(e,t,n)=>t.has(e)||Fe("Cannot "+n);var fe=(e,t,n)=>(Oe(e,t,"read from private field"),n?n.call(e):t.get(e)),Ge=(e,t,n)=>t.has(e)?Fe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Be=(e,t,n,o)=>(Oe(e,t,"write to private field"),o?o.call(e,n):t.set(e,n),n);import{a as wt}from"./chunk-73FQVITT-mgvTPDmd.js";import{r as w,j as P,bl as Ct,B as Lt,a as Pt,bm as Rt,bn as Et,E as kt,c as we,o as $e,M as Mt,L as He,I as It,e as Dt,bo as Tt}from"./index-XpZpj5Rl.js";function Nt(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function jt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function At(e){return e/100*window.innerHeight}function Ft(e){return e/100*window.innerWidth}function Ot(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,i]=Ot(n);switch(i){case"%":{o=r/100*e;break}case"px":{o=r;break}case"rem":{o=jt(t,r);break}case"em":{o=Nt(t,r);break}case"vh":{o=At(r);break}case"vw":{o=Ft(r);break}}return o}function O(e){return parseFloat(e.toFixed(3))}function de({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 Pe(e){const{panels:t}=e,n=de({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:i}=o;let u=0;if(i.collapsedSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:i.collapsedSize});u=O(c/n*100)}let a;if(i.defaultSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:i.defaultSize});a=O(c/n*100)}let s=0;if(i.minSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:i.minSize});s=O(c/n*100)}let l=100;if(i.maxSize!==void 0){const c=pe({groupSize:n,panelElement:r,styleProp:i.maxSize});l=O(c/n*100)}return{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:u,collapsible:i.collapsible===!0,defaultSize:a,disabled:i.disabled,minSize:s,maxSize:l,panelId:o.id}})}function M(e,t="Assertion error"){if(!e)throw Error(t)}function Re(e,t){return Array.from(t).sort(e==="horizontal"?Gt:Bt)}function Gt(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Bt(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function it(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function at(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 $t({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let r,i=Number.MAX_VALUE;for(const u of t){const{x:a,y:s}=at(o,u),l=e==="horizontal"?a:s;l<i&&(i=l,r=u)}return M(r,"No rect found"),r}let ve;function Ht(){return ve===void 0&&(typeof matchMedia=="function"?ve=!!matchMedia("(pointer:coarse)").matches:ve=!1),ve}function lt(e){const{element:t,orientation:n,panels:o,separators:r}=e,i=Re(n,Array.from(t.children).filter(it).map(v=>({element:v}))).map(({element:v})=>v),u=[];let a=!1,s=!1,l=-1,c=-1,h=0,f,x=[];{let v=-1;for(const d of i)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 i)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(s){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],k=$t({orientation:n,rects:[p,b],targetRect:E.element.getBoundingClientRect()});S=[E,k===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=Ht()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(m.width<E){const D=E-m.width;m=new DOMRect(m.x-D/2,m.y,m.width+D,m.height)}if(m.height<E){const D=E-m.height;m=new DOMRect(m.x,m.y-D/2,m.width,m.height+D)}const k=v<=l||v>c;!a&&!k&&u.push({group:e,groupSize:de({group:e}),panels:[f,g],separator:"width"in y?void 0:y,rect:m}),a=!1}}s=!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 s=!0}return u}var _;class ut{constructor(){Ge(this,_,{})}addListener(t,n){const o=fe(this,_)[t];return o===void 0?fe(this,_)[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=fe(this,_)[t];if(o!==void 0)if(o.length===1)o[0].call(null,n);else{let r=!1,i=null;const u=Array.from(o);for(let a=0;a<u.length;a++){const s=u[a];try{s.call(null,n)}catch(l){i===null&&(r=!0,i=l)}}if(r)throw i}}removeAllListeners(){Be(this,_,{})}removeListener(t,n){const o=fe(this,_)[t];if(o!==void 0){const r=o.indexOf(n);r>=0&&o.splice(r,1)}}}_=new WeakMap;let ue={cursorFlags:0,state:"inactive"};const ke=new ut;function ee(){return ue}function Wt(e){return ke.addListener("change",e)}function Ut(e){const t=ue,n={...ue};n.cursorFlags=e,ue=n,ke.emit("change",{prev:t,next:n})}function ce(e){const t=ue;ue=e,ke.emit("change",{prev:t,next:e})}const Vt=e=>e,Ce=()=>{},ct=1,dt=2,ft=4,pt=8,We=3,Ue=12;let be;function Ve(){return be===void 0&&(be=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(be=!0)),be}function Yt({cursorFlags:e,groups:t,state:n}){let o=0,r=0;switch(n){case"active":case"hover":t.forEach(i=>{if(!i.mutableState.disableCursor)switch(i.orientation){case"horizontal":{o++;break}case"vertical":{r++;break}}})}if(!(o===0&&r===0)){switch(n){case"active":{if(e&&Ve()){const i=(e&ct)!==0,u=(e&dt)!==0,a=(e&ft)!==0,s=(e&pt)!==0;if(i)return a?"se-resize":s?"ne-resize":"e-resize";if(u)return a?"sw-resize":s?"nw-resize":"w-resize";if(a)return"s-resize";if(s)return"n-resize"}break}}return Ve()?o>0&&r>0?"move":o>0?"ew-resize":"ns-resize":o>0&&r>0?"grab":o>0?"col-resize":"row-resize"}}const Ye=new WeakMap;function Me(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Ye.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=ee();switch(o.state){case"active":case"hover":{const r=Yt({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),i=`*, *:hover {cursor: ${r} !important; }`;if(t===i)return;t=i,r?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Ye.set(e,{prevStyle:t,styleSheet:n})}let U=new Map;const ht=new ut;function qt(e){U=new Map(U),U.delete(e)}function qe(e,t){for(const[n]of U)if(n.id===e)return n}function J(e,t){for(const[n,o]of U)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function K(){return U}function Ie(e,t){return ht.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function q(e,t,n){const o=U.get(e);U=new Map(U),U.set(e,t),ht.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:o,next:t})}function gt(e){const t=ee(),n=K();let o=!1;switch(t.state){case"active":ce({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Me(e),o=!0,t.hitRegions.forEach(r=>{if(!n.has(r.group))return;const i=J(r.group.id,!0);q(r.group,i,{isUserInteraction:!0})}))}return o}function Xe(e){e.defaultPrevented||gt(e.currentTarget)}function Xt(e,t,n){let o,r={x:1/0,y:1/0};for(const i of t){const u=at(n,i.rect);switch(e){case"horizontal":{u.x<=r.x&&(o=i,r=u);break}case"vertical":{u.y<=r.y&&(o=i,r=u);break}}}return o?{distance:r,hitRegion:o}:void 0}function _t(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Jt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Ke(e),b:Ke(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:Je(_e(n.a)),b:Je(_e(n.b))};if(r.a===r.b){const i=o.childNodes,u={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const s=i[a];if(s===u.a)return 1;if(s===u.b)return-1}}return Math.sign(r.a-r.b)}const Kt=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Zt(e){const t=getComputedStyle(mt(e)??e).display;return t==="flex"||t==="inline-flex"}function Qt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Zt(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"||Kt.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function _e(e){let t=e.length;for(;t--;){const n=e[t];if(M(n,"Missing node"),Qt(n))return n}return null}function Je(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ke(e){const t=[];for(;e;)t.push(e),e=mt(e);return t}function mt(e){const{parentNode:t}=e;return _t(t)?t.host:t}function en(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 tn({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!it(n)||n.contains(e)||e.contains(n))return!0;if(Jt(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(en(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function De(e,t){const n=[];return t.forEach((o,r)=>{if(r.disabled)return;const i=lt(r),u=Xt(r.orientation,i,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&tn({groupElement:r.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&n.push(u.hitRegion)}),n}function nn(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 A(e,t,n=0){return Math.abs(O(e)-O(t))<=n}function W(e,t){return A(e,t)?0:e>t?1:-1}function le({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:r=0,collapsible:i,disabled:u,maxSize:a=100,minSize:s=0}=t;if(u&&!e)return n;if(W(o,s)<0)if(i){const l=(r+s)/2;W(o,l)<0?o=r:o=s}else o=s;return o=Math.min(a,o),o=O(o),o}function ge({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:i}){if(A(e,0))return t;const u=i==="imperative-api",a=Object.values(t),s=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(i){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}`),A(y,p)){const m=S-y;W(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}`),A(y,S)){const m=y-p;W(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&&W(p,y)<0)if(e>0){const m=y-S,E=m/2,k=p+e;W(k,y)<0&&(e=W(e,E)<=0?0:m)}else{const m=y-S,E=100-m/2,k=p-e;W(k,y)<0&&(e=W(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=le({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=le({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:p,size:b});if(!A(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(nn(s,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=le({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:g,size:p});if(l[d]=b,!A(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,k=le({overrideDisabledPanels:u,panelConstraints:n[y],prevSize:m,size:E});if(A(m,k)||(S-=k-m,l[y]=k),A(S,0))break;e>0?y--:y++}}}const x=Object.values(l).reduce((d,g)=>g+d,0);if(!A(x,100,.1))return r;const v=Object.keys(r);return l.reduce((d,g,p)=>(d[v[p]]=g,d),{})}function te(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||W(e[n],t[n])!==0)return!1;return!0}function ne({layout:e,panelConstraints:t}){const n=Object.values(e),o=[...n],r=o.reduce((a,s)=>a+s,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(a=>`${a}%`).join(", ")}`);if(!A(r,100)&&o.length>0)for(let a=0;a<t.length;a++){const s=o[a];M(s!=null,`No layout data found for index ${a}`);const l=100/r*s;o[a]=l}let i=0;for(let a=0;a<t.length;a++){const s=n[a];M(s!=null,`No layout data found for index ${a}`);const l=o[a];M(l!=null,`No layout data found for index ${a}`);const c=le({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:s,size:l});l!=c&&(i+=l-c,o[a]=c)}if(!A(i,0))for(let a=0;a<t.length;a++){const s=o[a];M(s!=null,`No layout data found for index ${a}`);const l=s+i,c=le({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:s,size:l});if(s!==c&&(i-=c-s,o[a]=c,A(i,0)))break}const u=Object.keys(e);return o.reduce((a,s,l)=>(a[u[l]]=s,a),{})}function vt({groupId:e,panelId:t}){const n=()=>{const s=K();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:h,layout:f,groupSize:x,separatorToPanels:v}]of s)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 s=n().derivedPanelConstraints.find(l=>l.panelId===t);if(s!==void 0)return s;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const s=n().group.panels.find(l=>l.id===t);if(s!==void 0)return s;throw Error(`Layout not found for Panel ${t}`)},i=()=>{const s=n().layout[t];if(s!==void 0)return s;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:s,panels:l,prevLayout:c,derivedPanelConstraints:h})=>{const f=i(),x=l.findIndex(g=>g.id===t),v=x===0,d=x===l.length-1;if(d&&s<f&&(v||l.slice(0,x).every((g,p)=>{const b=h[p];return(b==null?void 0:b.collapsible)&&A(b.collapsedSize,c[b.panelId])}))){const g=l.slice(0,x).reduce((p,b)=>p+c[b.id],0);return{...c,[t]:O(100-g)}}return ge({delta:d?f-s:s-f,initialLayout:c,panelConstraints:h,pivotIndices:d?[x-1,x]:[x,x+1],prevLayout:c,trigger:"imperative-api"})},a=s=>{const l=i();if(s===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:h,group:f,groupSize:x,layout:v,separatorToPanels:d}=n(),g=u({nextSize:s,panels:f.panels,prevLayout:v,derivedPanelConstraints:h}),p=ne({layout:g,panelConstraints:h});te(v,p)||q(f,{defaultLayoutDeferred:c,derivedPanelConstraints:h,groupSize:x,layout:p,separatorToPanels:d})};return{collapse:()=>{const{collapsible:s,collapsedSize:l}=o(),{mutableValues:c}=r(),h=i();s&&h!==l&&(c.expandToSize=h,a(l))},expand:()=>{const{collapsible:s,collapsedSize:l,minSize:c}=o(),{mutableValues:h}=r(),f=i();if(s&&f===l){let x=h.expandToSize??c;x===0&&(x=1),a(x)}},getSize:()=>{const{group:s}=n(),l=i(),{element:c}=r(),h=s.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:h}},isCollapsed:()=>{const{collapsible:s,collapsedSize:l}=o(),c=i();return s&&A(l,c)},resize:s=>{const{group:l}=n(),{element:c}=r(),h=de({group:l}),f=pe({groupSize:h,panelElement:c,styleProp:s}),x=O(f/h*100);a(x)}}}function Ze(e){if(e.defaultPrevented)return;const t=K();De(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,i=vt({groupId:n.group.id,panelId:o.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function ye(e){const t=K();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 bt({groupId:e}){const t=()=>{const n=K();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:i,groupSize:u,layout:a,separatorToPanels:s}=t(),l=ne({layout:n,panelConstraints:r});return o?a:(te(a,l)||q(i,{defaultLayoutDeferred:o,derivedPanelConstraints:r,groupSize:u,layout:l,separatorToPanels:s}),l)}}}function Q(e,t){const n=ye(e),o=J(n.id,!0),r=n.separators.find(c=>c.element===e);M(r,"Matching separator not found");const i=o.separatorToPanels.get(r);M(i,"Matching panels not found");const u=i.map(c=>n.panels.indexOf(c)),a=bt({groupId:n.id}).getLayout(),s=ge({delta:t,initialLayout:a,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:a,trigger:"keyboard"}),l=ne({layout:s,panelConstraints:o.derivedPanelConstraints});te(a,l)||q(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:l,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Qe(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=ye(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Q(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Q(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Q(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Q(t,-5);break}case"End":{e.preventDefault(),Q(t,100);break}case"Enter":{e.preventDefault();const o=ye(t),r=J(o.id,!0),{derivedPanelConstraints:i,layout:u,separatorToPanels:a}=r,s=o.separators.find(f=>f.element===t);M(s,"Matching separator not found");const l=a.get(s);M(l,"Matching panels not found");const c=l[0],h=i.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;Q(t,x-f)}break}case"F6":{e.preventDefault();const o=ye(t).separators.map(u=>u.element),r=Array.from(o).findIndex(u=>u===e.currentTarget);M(r!==null,"Index not found");const i=e.shiftKey?r>0?r-1:o.length-1:r+1<o.length?r+1:0;o[i].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Q(t,-100);break}}}function et(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=K(),n=De(e,t),o=new Map;let r=!1;n.forEach(i=>{i.separator&&(r||(r=!0,i.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(i.group);u&&o.set(i.group,u.layout)}),ce({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function yt({document:e,event:t,hitRegions:n,initialLayoutMap:o,mountedGroups:r,pointerDownAtPoint:i,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;i?f==="horizontal"?d=(t.clientX-i.x)/h*100:d=(t.clientY-i.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 k=ge({delta:d,initialLayout:g,panelConstraints:S,pivotIndices:l.panels.map(D=>x.indexOf(D)),prevLayout:m,trigger:"mouse-or-touch"});if(te(k,m)){if(d!==0&&!v)switch(f){case"horizontal":{a|=d<0?ct:dt;break}case"vertical":{a|=d<0?ft:pt;break}}}else q(l.group,{defaultLayoutDeferred:b,derivedPanelConstraints:S,groupSize:y,layout:k,separatorToPanels:E})}});let s=0;t.movementX===0?s|=u&We:s|=a&We,t.movementY===0?s|=u&Ue:s|=a&Ue,Ut(s),Me(e)}function tt(e){const t=K(),n=ee();switch(n.state){case"active":yt({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function nt(e){var o,r;if(e.defaultPrevented)return;const t=ee(),n=K();switch(t.state){case"active":{if(e.buttons===0){ce({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(i=>{if(!n.has(i.group))return;const u=J(i.group.id,!0);q(i.group,u,{isUserInteraction:!0})});return}for(const i of t.hitRegions)if(i.separator){const{element:u}=i.separator;(o=u.hasPointerCapture)!=null&&o.call(u,e.pointerId)||((r=u.setPointerCapture)==null||r.call(u,e.pointerId))}yt({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const i=De(e,n);i.length===0?t.state!=="inactive"&&ce({cursorFlags:0,state:"inactive"}):ce({cursorFlags:0,hitRegions:i,state:"hover"}),Me(e.currentTarget);break}}}function ot(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ee().state){case"hover":ce({cursorFlags:0,state:"inactive"})}}function rt(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||gt(e.currentTarget)&&e.preventDefault()}function st(e){let t=0,n=0;const o={};for(const i of e)if(i.defaultSize!==void 0){t++;const u=O(i.defaultSize);n+=u,o[i.panelId]=u}else o[i.panelId]=void 0;const r=e.length-t;if(r!==0){const i=O((100-n)/r);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=i)}return o}function on(e,t,n){if(!n[0])return;const o=e.panels.find(s=>s.element===t);if(!o||!o.onResize)return;const r=de({group:e}),i=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,u=o.mutableValues.prevSize,a={asPercentage:O(i/r*100),inPixels:i};o.mutableValues.prevSize=a,o.onResize(a,o.id,u)}function rn(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 sn(e,t){return e.length!==t.length?!1:e.every((n,o)=>rn(n,t[o]))}function an({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let r=0,i=0,u=!1;const a=new Map,s=[];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=O(x/t*100);a.set(h.id,v),r+=v;break}case"preserve-relative-size":default:{s.push(h.id),i+=f;break}}}if(!u||s.length===0)return o;const l=100-r,c={...o};if(a.forEach((h,f)=>{c[f]=h}),i>0)for(const h of s){const f=o[h]??0;c[h]=O(f/i*l)}else{const h=O(l/s.length);for(const f of s)c[f]=h}return c}function ln(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 ae=new Map;function un(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,i=new n(v=>{for(const d of v){const{borderBoxSize:g,target:p}=d;if(p===e.element){if(t){const b=de({group:e});if(b===0)return;const S=J(e.id);if(!S)return;const y=Pe(e),m=S.defaultLayoutDeferred?st(y):S.layout,E=an({group:e,nextGroupSize:b,prevGroupSize:S.groupSize,prevLayout:m}),k=ne({layout:E,panelConstraints:y});if(!S.defaultLayoutDeferred&&te(S.layout,k)&&sn(S.derivedPanelConstraints,y)&&S.groupSize===b)continue;q(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:y,groupSize:b,layout:k,separatorToPanels:S.separatorToPanels})}}else on(e,p,g)}});i.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&&i.observe(v.element)});const u=de({group:e}),a=Pe(e),s=e.panels.map(({id:v})=>v).join(",");let l=e.mutableState.defaultLayout;l&&(ln(e.panels,l)||(l=void 0));const c=e.mutableState.layouts[s]??l??st(a),h=ne({layout:c,panelConstraints:a}),f=e.element.ownerDocument;ae.set(f,(ae.get(f)??0)+1);const x=new Map;return lt(e).forEach(v=>{v.separator&&x.set(v.separator,v.panels)}),q(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",Qe)}),ae.get(f)===1&&(f.addEventListener("contextmenu",Xe,!0),f.addEventListener("dblclick",Ze,!0),f.addEventListener("pointerdown",et,!0),f.addEventListener("pointerleave",tt),f.addEventListener("pointermove",nt),f.addEventListener("pointerout",ot),f.addEventListener("pointerup",rt,!0)),function(){t=!1,ae.set(f,Math.max(0,(ae.get(f)??0)-1)),qt(e),e.separators.forEach(v=>{v.element.removeEventListener("keydown",Qe)}),ae.get(f)||(f.removeEventListener("contextmenu",Xe,!0),f.removeEventListener("dblclick",Ze,!0),f.removeEventListener("pointerdown",et,!0),f.removeEventListener("pointerleave",tt),f.removeEventListener("pointermove",nt),f.removeEventListener("pointerout",ot),f.removeEventListener("pointerup",rt,!0)),i.disconnect()}}function cn(){const[e,t]=w.useState({}),n=w.useCallback(()=>t({}),[]);return[e,n]}function Te(e){const t=w.useId();return`${e??t}`}const oe=typeof window<"u"?w.useLayoutEffect:w.useEffect;function he(e){const t=w.useRef(e);return oe(()=>{t.current=e},[e]),w.useCallback((...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[t])}function Ne(...e){return he(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function je(e){const t=w.useRef({...e});return oe(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const St=w.createContext(null);function dn(e,t){const n=w.useRef({getLayout:()=>({}),setLayout:Vt});w.useImperativeHandle(t,()=>n.current,[]),oe(()=>{Object.assign(n.current,bt({groupId:e}))})}function xt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:r,elementRef:i,groupRef:u,id:a,onLayoutChange:s,onLayoutChanged:l,orientation:c="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...x}){const v=w.useRef({onLayoutChange:{},onLayoutChanged:{}}),d=he(C=>{te(v.current.onLayoutChange,C)||(v.current.onLayoutChange=C,s==null||s(C))}),g=he((C,z)=>{te(v.current.onLayoutChanged,C)||(v.current.onLayoutChanged=C,l==null||l(C,{isUserInteraction:z}))}),p=Te(a),b=w.useRef(null),[S,y]=cn(),m=w.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),E=Ne(b,i);dn(p,u);const k=he((C,z)=>{const I=ee(),R=qe(C),T=J(C);if(T){let G=!1;switch(I.state){case"active":{G=I.hitRegions.some(V=>V.group===R);break}}return{flexGrow:T.layout[z]??1,pointerEvents:G?"none":void 0}}if(n!=null&&n[z])return{flexGrow:n==null?void 0:n[z]}}),D=je({defaultLayout:n,disableCursor:o}),N=w.useMemo(()=>({get disableCursor(){return!!D.disableCursor},getPanelStyles:k,id:p,orientation:c,registerPanel:C=>{const z=m.current;return z.panels=Re(c,[...z.panels,C]),y(),()=>{z.panels=z.panels.filter(I=>I!==C),y()}},registerSeparator:C=>{const z=m.current;return z.separators=Re(c,[...z.separators,C]),y(),()=>{z.separators=z.separators.filter(I=>I!==C),y()}},updatePanelProps:(C,{disabled:z})=>{const I=m.current.panels.find(G=>G.id===C);I&&(I.panelConstraints.disabled=z);const R=qe(p),T=J(p);R&&T&&q(R,{...T,derivedPanelConstraints:Pe(R)})},updateSeparatorProps:(C,{disabled:z,disableDoubleClick:I})=>{const R=m.current.separators.find(T=>T.id===C);R&&(R.disabled=z,R.disableDoubleClick=I)}}),[k,p,y,c,D]),B=w.useRef(null);return oe(()=>{const C=b.current;if(C===null)return;const z=m.current;let I;if(D.defaultLayout!==void 0&&Object.keys(D.defaultLayout).length===z.panels.length){I={};for(const H of z.panels){const X=D.defaultLayout[H.id];X!==void 0&&(I[H.id]=X)}}const R={disabled:!!r,element:C,id:p,mutableState:{defaultLayout:I,disableCursor:!!D.disableCursor,expandedPanelSizes:m.current.lastExpandedPanelSizes,layouts:m.current.layouts},orientation:c,panels:z.panels,resizeTargetMinimumSize:z.resizeTargetMinimumSize,separators:z.separators};B.current=R;const T=un(R),{defaultLayoutDeferred:G,derivedPanelConstraints:V,layout:Y}=J(R.id,!0);!G&&V.length>0&&(d(Y),g(Y,!1));const Z=Ie(p,H=>{const{defaultLayoutDeferred:X,derivedPanelConstraints:j,layout:re}=H.next;if(X||j.length===0)return;const me=R.panels.map(({id:$})=>$).join(",");R.mutableState.layouts[me]=re,j.forEach($=>{if($.collapsible){const{layout:se}=H.prev??{};if(se){const xe=A($.collapsedSize,re[$.panelId]),ze=A($.collapsedSize,se[$.panelId]);xe&&!ze&&(R.mutableState.expandedPanelSizes[$.panelId]=se[$.panelId])}}});const Se=ee().state!=="active";d(re),Se&&g(re,H.isUserInteraction)});return()=>{B.current=null,T(),Z()}},[r,p,g,d,c,S,D]),w.useEffect(()=>{const C=B.current;C&&(C.mutableState.defaultLayout=n,C.mutableState.disableCursor=!!o)}),P.jsx(St.Provider,{value:N,children:P.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})})}xt.displayName="Group";function Ae(){const e=w.useContext(St);return M(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function fn(e,t){const{id:n}=Ae(),o=w.useRef({collapse:Ce,expand:Ce,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ce});w.useImperativeHandle(t,()=>o.current,[]),oe(()=>{Object.assign(o.current,vt({groupId:n,panelId:e}))})}function Ee({children:e,className:t,collapsedSize:n="0%",collapsible:o=!1,defaultSize:r,disabled:i,elementRef:u,groupResizeBehavior:a="preserve-relative-size",id:s,maxSize:l="100%",minSize:c="0%",onResize:h,panelRef:f,style:x,...v}){const d=!!s,g=Te(s),p=je({disabled:i}),b=w.useRef(null),S=Ne(b,u),{getPanelStyles:y,id:m,orientation:E,registerPanel:k,updatePanelProps:D}=Ae(),N=h!==null,B=he((R,T,G)=>{h==null||h(R,s,G)});oe(()=>{const R=b.current;if(R!==null){const T={element:R,id:g,idIsStable:d,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:N?B:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:o,defaultSize:r,disabled:p.disabled,maxSize:l,minSize:c}};return k(T)}},[a,n,o,r,N,g,d,l,c,B,k,p]),w.useEffect(()=>{D(g,{disabled:i})},[i,g,D]),fn(g,f);const C=()=>{const R=y(m,g);if(R)return JSON.stringify(R)},z=w.useSyncExternalStore(R=>Ie(m,R),C,C);let I;return z?I=JSON.parse(z):r!==void 0?I={flexGrow:void 0,flexShrink:void 0,flexBasis:r}:I={flexGrow:1},P.jsx("div",{...v,"data-disabled":i||void 0,"data-panel":!0,"data-testid":g,id:g,ref:S,style:{...pn,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...I},children:P.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...x,touchAction:E==="horizontal"?"pan-y":"pan-x"},children:e})})}Ee.displayName="Panel";const pn={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function hn({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let r,i;const u=e[n],a=t.find(s=>s.panelId===n);if(a){const s=a.maxSize,l=a.collapsible?a.collapsedSize:a.minSize,c=[o,o+1];i=ne({layout:ge({delta:l-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],r=ne({layout:ge({delta:s-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:i,valueNow:u}}function zt({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:r,id:i,style:u,...a}){const s=Te(i),l=je({disabled:n,disableDoubleClick:o}),[c,h]=w.useState({}),[f,x]=w.useState("inactive"),[v,d]=w.useState(!1),g=w.useRef(null),p=Ne(g,r),{disableCursor:b,id:S,orientation:y,registerSeparator:m,updateSeparatorProps:E}=Ae(),k=y==="horizontal"?"vertical":"horizontal";oe(()=>{const B=g.current;if(B!==null){const C={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:B,id:s},z=m(C),I=Wt(T=>{x(T.next.state!=="inactive"&&T.next.hitRegions.some(G=>G.separator===C)?T.next.state:"inactive")}),R=Ie(S,T=>{const{derivedPanelConstraints:G,layout:V,separatorToPanels:Y}=T.next,Z=Y.get(C);if(Z){const H=Z[0],X=Z.indexOf(H);h(hn({layout:V,panelConstraints:G,panelId:H.id,panelIndex:X}))}});return()=>{I(),R(),z()}}},[S,s,m,l]),w.useEffect(()=>{E(s,{disabled:n,disableDoubleClick:o})},[n,o,s,E]);let D;n&&!b&&(D="not-allowed");let N;if(n)N="disabled";else switch(f){case"active":{N="active";break}default:v?N="focus":N=f}return P.jsx("div",{...a,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":k,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":N,"data-testid":s,id:s,onBlur:()=>d(!1),onFocus:()=>d(!0),ref:p,role:"separator",style:{flexBasis:"auto",cursor:D,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}zt.displayName="Separator";async function gn({fetchPage:e}){const t=[];let n;do{const o=await e(n);t.push(...o.data),n=o.nextPageToken}while(n!=null&&n.length>0);return t}function Le(e){var n;const t=(n=e.title)==null?void 0:n.trim();return t!=null&&t.length>0?t:"Untitled session"}function mn(e){return"isMutable"in e&&typeof Reflect.get(e,"isMutable")=="boolean"?Reflect.get(e,"isMutable")===!0:e.agentName==null}function vn(e){return"sourceType"in e&&Reflect.get(e,"sourceType")==="schedule"?"schedule":void 0}function xn({agentId:e,startTimestamp:t,endTimestamp:n,shareView:o}){const r=Ct(),i=Lt(),u=Pt(),a=Rt(),{sessionId:s,updateShareSearch:l}=Et(),{allows:c}=kt({resourceType:"session",resourceIds:s==null?[]:[s]}),h=c(s,"MANAGE"),f=we("AgentSessionListRow"),x=we("AgentSessionDetailHeader"),v=we("AgentSessionTimelineContainer"),[d,g]=w.useState([]),[p,b]=w.useState(),[S,y]=w.useState(!0),[m,E]=w.useState(!1),[k,D]=w.useState(!1),N=w.useRef(0),[B,C]=w.useState(),[z,I]=w.useState(),[R,T]=w.useState(!1),[G,V]=w.useState(!1),Y=w.useMemo(()=>({order:"desc",limit:20,...e==null||e.length===0?{}:{agentId:e},...t==null?{}:{startTimestamp:t},...n==null?{}:{endTimestamp:n}}),[e,n,t]);w.useEffect(()=>{const L=++N.current;let F=!1;return y(!0),E(!1),D(!1),r.listSessions(Y).then(ie=>{F||N.current!==L||(g(ie.data),b(ie.nextPageToken))}).catch(()=>{F||N.current!==L||(g([]),b(void 0),D(!0))}).finally(()=>{!F&&N.current===L&&y(!1)}),()=>{F=!0}},[Y,r]);const Z=w.useCallback(async()=>{if(p==null||m)return;const L=N.current;E(!0);try{const F=await r.listSessions({...Y,pageToken:p});if(N.current!==L)return;g(ie=>[...ie,...F.data]),b(F.nextPageToken)}catch{}finally{N.current===L&&E(!1)}},[m,Y,p,r]);w.useEffect(()=>{if(s==null||s.length===0){C(void 0),I(void 0),V(!1),T(!1);return}let L=!1;return T(!0),V(!1),C(void 0),I(void 0),Promise.all([gn({fetchPage:F=>r.listSessionEvents({sessionId:s,limit:100,...F==null?{}:{pageToken:F}})}),i.getSession({sessionId:s}).catch(()=>{})]).then(([F,ie])=>{L||(C([...F].reverse()),I(ie))}).catch(()=>{L||V(!0)}).finally(()=>{L||T(!1)}),()=>{L=!0}},[i,s,r]);const H=L=>{const F=o==="sessions"?Tt(L.createdAt):null;l({sessionId:L.id,...o==="sessions"?{view:"sessions",...F==null?{}:{timeRange:F}}:{agentId:e??null,tab:"sessions",view:null,timeRange:null}})},X=()=>{s!=null&&l({sessionId:null})},j=d.find(L=>L.id===s),re=z!=null?Le(z):j!=null?Le(j):s??"Untitled session",me=z!=null?$e(z):j!=null?$e(j):!1,Se=z!=null?z.isMutable:j!=null?mn(j):!0,$=me?"Resume Agent building":"Resume Chat",se=s!=null&&a!=null?wt({sessionId:s,routes:a}):null,xe=()=>{if(!h||s==null||u==null)return;const L=(z==null?void 0:z.agentName)??(j==null?void 0:j.agentName);u.openHistorySession({sessionId:s,isMutable:Se,isCreateAgent:me,...L!=null&&L.length>0?{agentName:L}:{}})},ze=se!=null?{resumeHref:se,resumeLabel:$}:u!=null?{onResume:xe,resumeLabel:$}:{};return!S&&!k&&d.length===0&&(s==null||s.length===0)?P.jsx(Mt,{title:"No Sessions Found",description:"There are no sessions available at the moment.",className:"bg-primary-bg"}):P.jsxs(xt,{id:"agent-sessions-split",orientation:"horizontal",className:"h-full min-h-0 w-full",resizeTargetMinimumSize:{coarse:24,fine:11},children:[P.jsx(Ee,{id:"agent-sessions-list",defaultSize:"35%",minSize:"20%",maxSize:"50%",children:P.jsxs("aside",{className:"flex h-full min-h-0 w-full flex-col bg-sidebar-bg",children:[P.jsx("div",{className:"scrollbar-none min-h-0 flex-1 overflow-y-auto",children:S?P.jsx("div",{className:"space-y-2 p-3",role:"status","aria-label":"Loading sessions",children:["a","b","c"].map(L=>P.jsx(He,{className:"h-16 rounded-md"},L))}):k?P.jsx("p",{className:"px-3 py-6 text-center text-xs text-text-secondary",children:"Sessions could not be loaded."}):d.map(L=>P.jsx(f,{title:Le(L),agentName:L.agentName??void 0,sourceType:vn(L),lastActivityAt:L.lastActivityAt,metrics:L.metrics,active:L.id===s,onSelect:()=>H(L)},L.id))}),p!=null&&!S?P.jsx("div",{className:"shrink-0 border-t border-border p-3",children:P.jsx("button",{type:"button",disabled:m,onClick:()=>void Z(),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:m?"Loading…":"Load more"})}):null]})}),P.jsxs(zt,{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:[P.jsx("div",{"aria-hidden":!0,className:"absolute inset-y-0 -left-1.25 w-2.75"}),P.jsx("div",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-px bg-border transition-colors"}),P.jsx("div",{"aria-hidden":!0,className:Dt("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:P.jsx(It,{name:"grip-vertical",size:10})})]}),P.jsx(Ee,{id:"agent-session-detail",defaultSize:"65%",minSize:"30%",children:P.jsx("section",{className:"flex h-full min-w-0 flex-col bg-primary-bg",children:s==null?P.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-sm text-text-secondary",children:"Select a session to view details"}):G?P.jsx("div",{className:"flex flex-1 items-center justify-center px-6 text-sm text-text-secondary",children:"Session details could not be loaded."}):P.jsxs(P.Fragment,{children:[P.jsx(x,{title:re,sessionId:s,agentId:e,createdAt:(z==null?void 0:z.createdAt)??(j==null?void 0:j.createdAt),view:o,onClose:X,canResume:h,...ze}),R||B===void 0?P.jsx("div",{className:"flex flex-1 flex-col p-4",role:"status","aria-label":"Loading session details",children:P.jsx(He,{className:"min-h-64 flex-1 rounded-lg"})}):P.jsx(v,{sessionId:s,events:B,listMetrics:j==null?void 0:j.metrics})]})})})]})}export{xn as AgentSessions};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aD as ee,D as ce,r as a,aE as _,j as e,H as me,K as z,I as w,aG as te,a9 as K,aK as ue,e as D,aF as X}from"./index-XpZpj5Rl.js";var xe=[{value:"none",label:"None"},{value:"header",label:"API Key"},{value:"dcr",label:"OAuth"}],V=K("h-11 shadow-sm"),B=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),he=({open:n,onOpenChange:p,onSubmit:h,connector:r,busy:f=!1,error:v})=>{const[b,y]=a.useState(""),[j,g]=a.useState(""),[N,m]=a.useState(""),[o,k]=a.useState("dcr"),[C,F]=a.useState(""),[A,S]=a.useState(""),u=r!==void 0,d=K(`h-11 shadow-sm ${u?"cursor-not-allowed bg-secondary-bg/60 text-text-secondary opacity-40":""}`),i=()=>{y(""),g(""),m(""),k("dcr"),F(""),S("")};a.useEffect(()=>{n&&(y((r==null?void 0:r.name)??""),g((r==null?void 0:r.url)??""),m((r==null?void 0:r.description)??""),k((r==null?void 0:r.auth.type)??"dcr"),F(""),S((r==null?void 0:r.auth.type)==="header"?r.auth.headerName??"":""))},[r,n]);const T=l=>{l||i(),p(l)},I=!!C.trim()||(r==null?void 0:r.auth.type)==="header",E=!!b.trim()&&!!N.trim()&&!!j.trim()&&(o!=="header"||I),P=async l=>{if(l.preventDefault(),!E||f)return;const O=o==="header"?{type:"header",apiKey:C.trim(),...A.trim()?{headerName:A.trim()}:{}}:{type:o};try{await h({name:b.trim(),url:j.trim(),description:N.trim(),auth:O}),i(),p(!1)}catch{}};return e.jsx(te,{open:n,onOpenChange:T,title:u?"Edit MCP server":"Add MCP server",description:u?"Update how this connector authenticates.":"Point at a remote MCP endpoint. It then behaves like any other connector.",contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:l=>void P(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:b,readOnly:u,"aria-disabled":u,onChange:l=>{y(l.target.value)},placeholder:"analytics-postgres-mcp",autoFocus:!u,className:d})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"mcp-server-description",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Description",e.jsx(B,{})]}),e.jsx("textarea",{id:"mcp-server-description",value:N,onChange:l=>{m(l.target.value)},placeholder:"Query analytics from Postgres",required:!0,rows:3,className:K("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:j,onChange:l=>{g(l.target.value)},placeholder:"https://mcp.example.com/mcp",className:V})]}),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:xe.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 ${o===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:o===l.value,onChange:()=>{k(l.value)},className:"sr-only"}),l.label]},l.value))})]}),o==="dcr"?e.jsxs("div",{className:"flex gap-1.5 bg-secondary-bg/40 p-2 rounded-md",children:[e.jsx(w,{name:"info",className:"size-3.5 mt-1 text-text-secondary"}),e.jsx("div",{className:"text-xs text-text-secondary leading-5.5",children:"Sign-in only — the server must support dynamic client registration. Manual OAuth (client ID / secret) isn't supported yet."})]}):null,o==="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",(r==null?void 0:r.auth.type)==="header"?e.jsx("span",{className:"font-normal text-text-secondary",children:" (leave blank to keep current)"}):e.jsx(B,{})]}),e.jsx("input",{id:"mcp-server-api-key",type:"password",required:(r==null?void 0:r.auth.type)!=="header",value:C,onChange:l=>{F(l.target.value)},placeholder:"Paste the server token",className:V})]}),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:A,onChange:l=>{S(l.target.value)},placeholder:"Authorization",className:V})]})]}):null]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[v?e.jsx("p",{className:"text-failure-bg text-sm",children:v}):null,e.jsx(z.Primary,{type:"submit",size:"large",disabled:!E||f,className:"w-full shrink-0",children:u?"Save":"Add"})]})]})})},Z=he,U={dcr:"OAuth2",header:"API Key",none:"No Auth"};function pe({text:n}){const p=a.useRef(null),[h,r]=a.useState(!1),[f,v]=a.useState(!1),[b,y]=a.useState(16);return a.useLayoutEffect(()=>{r(!1),y(16)},[n]),a.useLayoutEffect(()=>{const j=p.current;if(!j)return;if(!h){y(16),v(j.scrollWidth>j.clientWidth+1);return}y(16);const g=requestAnimationFrame(()=>{y(j.scrollHeight)});return()=>cancelAnimationFrame(g)},[n,h]),n?e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("p",{ref:p,style:{maxHeight:b},className:D("mt-0.5 overflow-hidden font-mono text-xs leading-4 text-text-secondary transition-[max-height] duration-300 ease-in-out",!h&&"whitespace-nowrap",!h&&f&&"pr-[5.75rem]"),children:[n,h&&f?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:()=>r(!1),children:"Show less"})]}):null]}),!h&&f?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:()=>r(!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 fe=({connector:n,onBack:p,onConnectorRefreshed:h,onEdit:r,onDisconnect:f,busy:v=!1})=>{const{connectorCatalog:b}=ee(),{handleAuthorize:y,isOAuthLoading:j}=ue(),[g,N]=a.useState([]),[m,o]=a.useState(!0),[k,C]=a.useState(null),[F,A]=a.useState(!1);a.useEffect(()=>{let d=!1;return N([]),C(null),o(!0),b.getToolsByConnectorId({id:n.id}).then(i=>{d||N(i)}).catch(i=>{d||C(_(i,"Failed to load connector tools"))}).finally(()=>{d||o(!1)}),()=>{d=!0}},[n.authenticated,n.id,b]);const S=async()=>{A(!0),C(null);try{const d=await b.getConnector({id:n.id});h(d)}catch(d){C(_(d,"Failed to refresh connector details"))}finally{A(!1)}},u=j||F;return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:p,className:"mb-3 inline-flex w-fit items-center gap-1 rounded-md py-1 pr-2 text-sm text-text-secondary hover:text-text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",children:[e.jsx(w,{name:"chevron-left",className:"size-3.5"}),"Connectors"]}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-y-auto pb-1",children:[e.jsxs("header",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"text-lg font-semibold text-text-primary",children:n.name}),e.jsx("span",{className:"inline-flex items-center rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-text-secondary",children:U[n.auth.type]??U.none}),e.jsxs("span",{className:D("flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium",n.authenticated?"text-success-bg":"text-text-primary"),children:[e.jsx("span",{className:D("h-1.5 w-1.5 rounded-full",n.authenticated?"bg-success-bg":"bg-primary-button-bg")}),n.authenticated?"Connected":"Not authenticated"]})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:e.jsx("span",{className:"text-text-secondary",children:n.description})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(z.Secondary,{size:"small",type:"button",disabled:v,onClick:r,children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),n.auth.type==="dcr"&&!n.authenticated?e.jsx(z.Secondary,{size:"small",type:"button",disabled:v||u,onClick:()=>{y(n.id,d=>{d&&S()})},children:u?"Connecting…":"Connect"}):n.auth.type==="dcr"&&!n.requiresAuth?e.jsx(z.Secondary,{size:"small",type:"button",disabled:v,onClick:f,children:"Disconnect"}):null]})]}),e.jsx("section",{className:"mt-6","aria-labelledby":"connector-tools-heading",children:m?e.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center text-sm text-text-secondary",children:"Loading tools…"}):k?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:[k,n.auth.type==="dcr"&&!n.authenticated&&e.jsx("div",{className:"font-bold mt-1",children:"Click Connect and authenticate successfully to view tools."})]}):g.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:["· ",g.length]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:g.map(d=>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:d.name}),e.jsx(pe,{text:d.description})]})},d.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."})})]})]})},be=fe,ge=()=>{const{connectorCatalog:n}=ee(),p=ce(),[h,r]=a.useState(""),[f,v]=a.useState({ordered:[],authStatusById:new Map}),[b,y]=a.useState(!0),[j,g]=a.useState(null),[N,m]=a.useState(null),[o,k]=a.useState(!1),[C,F]=a.useState([]),[A,S]=a.useState(!1),[u,d]=a.useState(null),[i,T]=a.useState(null),[I,E]=a.useState(null),[P,l]=a.useState(""),O=a.useMemo(()=>(C??[]).reduce((t,s)=>(t[s.name]=s.logo??"",t),{}),[C]),Q=a.useCallback(async()=>{y(!0),g(null);try{const[t,s]=await Promise.all([n.listConnectors(),n.getConnectorCatalog()]);F(s);const c=t??[],M=new Set(c.map(x=>x.id)),W=[...c.map(x=>({connector:x,isConfigured:!0})),...s.filter(x=>!M.has(x.id)).map(x=>({connector:x,isConfigured:!1}))];v({ordered:W,authStatusById:new Map(W.map(x=>[x.connector.id,x.isConfigured?x.connector.authenticated:!1]))}),E(x=>x?t.find(oe=>oe.id===x.id)??null:null)}catch(t){g(_(t,"Failed to load connectors"))}finally{y(!1)}},[n]);a.useEffect(()=>{Q()},[Q]);const L=h.trim().toLowerCase(),q=a.useMemo(()=>L?f.ordered.filter(({connector:t})=>{var s;return t.name.toLowerCase().includes(L)||(((s=t.description)==null?void 0:s.toLowerCase().includes(L))??!1)||t.url.toLowerCase().includes(L)}):f.ordered,[f.ordered,L]),R=a.useMemo(()=>{const t=[];for(const s of q)if(s.isConfigured){const c=f.authStatusById.get(s.connector.id)??s.connector.authenticated;t.push(c===s.connector.authenticated?s.connector:{...s.connector,authenticated:c})}return t},[f.authStatusById,q]),$=a.useMemo(()=>{const t=[];for(const s of q)s.isConfigured||t.push(s.connector);return t},[q]),H=async(t,s=g)=>{k(!0),g(null);try{await t(),await Q()}catch(c){throw s(_(c,"Request failed")),c}finally{k(!1)}},G=()=>{T(null),l(""),m(null)},Y=async(t,s)=>{const c=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:c})},se=t=>{if(t.auth.type==="header"){l(""),m(null),T(t);return}H(async()=>{await Y(t)}).catch(()=>{})},ae=t=>{if(t.preventDefault(),!i||!P.trim())return;const s=i;m(null),H(async()=>{const c={type:"header",apiKey:P.trim(),...s.auth.type==="header"&&s.auth.headerName?{headerName:s.auth.headerName}:{}};await Y(s,c),G(),setTimeout(()=>{p==null||p.showSuccess({title:`${s.name} connected`})},100)},m).catch(()=>{})},J=async t=>{m(null),await H(async()=>{u?await n.updateConnector({id:u.id,...t}):await n.createConnector({...t})},m),setTimeout(()=>{p==null||p.showSuccess({title:`${t.name} ${u?"updated":"added"}`})},0)},re=t=>{H(async()=>{await n.disconnectConnector({id:t.id}),E(null)}).catch(()=>{})},ne=t=>{E(s=>(s==null?void 0:s.id)===t.id?t:s),v(s=>{const c=new Map(s.authStatusById);return c.set(t.id,t.authenticated),{ordered:s.ordered.map(M=>M.isConfigured&&M.connector.id===t.id?{connector:t,isConfigured:!0}:M),authStatusById:c}})},le=(t,s)=>{const c=O[t.name],M=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:c?e.jsx(X,{src:c,alt:t.name,className:"size-4.5"}):e.jsx(w,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:D("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:D("h-1.5 w-1.5 rounded-full",t.authenticated?"bg-success-bg":"bg-primary-button-bg")}),t.authenticated?"Connected":"Added"]})})]}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description})]})]});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:()=>{E(t)},children:[e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:M}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(z.Secondary,{size:"small",type:"button",disabled:o,onClick:x=>{x.stopPropagation(),m(null),d(t),S(!0)},children:[e.jsx(w,{name:"pencil",className:"size-3"}),"Edit"]}),e.jsx(w,{name:"chevron-right",className:"size-4"})]})]},t.id)},ie=t=>{const s=O[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(X,{src:s,alt:t.name,className:"size-4.5"}):e.jsx(w,{name:"mcp-server",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-text-secondary sm:truncate",children:t.description??t.url})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("span",{className:"hidden text-xs text-text-secondary sm:inline",children:U[t.auth.type]??U.none}),e.jsx(z.Secondary,{size:"small",type:"button",disabled:o,onClick:()=>{se(t)},children:t.auth.type==="dcr"?"Add":"Connect"})]})]},t.id)};if(I)return e.jsxs(e.Fragment,{children:[e.jsx(be,{connector:I,busy:o,onBack:()=>{E(null)},onConnectorRefreshed:ne,onEdit:()=>{m(null),d(I),S(!0)},onDisconnect:()=>{re(I)}}),e.jsx(Z,{open:A,onOpenChange:t=>{S(t),t||(d(null),m(null))},onSubmit:J,connector:u??void 0,busy:o,error:N})]});const de=R.length>0||$.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."}),j?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:j}):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(me,{query:h,setQuery:r,placeholder:"Search connectors"})}),e.jsxs(z.Secondary,{type:"button",onClick:()=>{m(null),d(null),S(!0)},children:[e.jsx(w,{name:"plus",size:"1rem",className:"mr-1"}),"Add MCP Server"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[b?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!b&&R.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 · ",R.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:R.map(t=>le(t))})]}):null,!b&&$.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 · ",$.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:$.map(t=>ie(t))})]}):null,!b&&!de?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.trim()?`No connectors match “${h.trim()}”.`:"No connectors yet."}):null]}),e.jsx(te,{open:i!==null,onOpenChange:t=>{t||G()},title:`Connect ${(i==null?void 0:i.name)??"connector"}`,description:i==null?void 0:i.url,contentSized:!0,className:"md:max-w-xl",children:e.jsxs("form",{onSubmit:ae,children:[e.jsxs("div",{className:"space-y-5 px-5 py-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(w,{name:"mcp-server",className:"size-6 text-text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-text-primary",children:i==null?void 0:i.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:i==null?void 0:i.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:P,onChange:t=>{l(t.target.value)},placeholder:`Paste the token from ${(i==null?void 0:i.name)??"the provider"}`,autoFocus:!0,required:!0,className:K("h-11")})]}),N?e.jsx("p",{className:"text-failure-bg text-sm",children:N}):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:G,disabled:o,children:"Cancel"}),e.jsx(z.Primary,{type:"submit",disabled:!P.trim()||o,children:"Connect"})]})]})}),e.jsx(Z,{open:A,onOpenChange:t=>{S(t),t||(d(null),m(null))},onSubmit:J,connector:u??void 0,busy:o,error:N})]})})]})},je=ge;export{je as default};
|
|
Binary file
|
|
Binary file
|
package/dist/_frontend/assets/{DockLayout-LM4AFMFY-DoBwJ3-e.js → DockLayout-F44RWGEY-DVcqWNpi.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as a}from"./chunk-
|
|
1
|
+
import{S as a}from"./chunk-GIPFF6FZ-DPTdcXQj.js";import{j as o,C as t,e as l}from"./index-XpZpj5Rl.js";import"./chunk-LUG7E6BL-QKvrInc2.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=["./SettingsBuilder-GISAH2WU-2fVa9yeg.js","./index-XpZpj5Rl.js","./index-BBGLYdJn.css","./SchedulesPage-TMOTK6DR-D9JlkZFv.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as E,a as P,b as I,c as t,r as a,s as L,j as s,P as z,I as l,d as c,S as g,e as B,_ as p}from"./index-XpZpj5Rl.js";import{A as k,S as D,N as T,T as R}from"./chunk-LUG7E6BL-QKvrInc2.js";var F=a.lazy(()=>p(()=>import("./SettingsBuilder-GISAH2WU-2fVa9yeg.js"),__vite__mapDeps([0,1,2]),import.meta.url)),M=a.lazy(()=>p(()=>import("./SchedulesPage-TMOTK6DR-D9JlkZFv.js"),__vite__mapDeps([3,1,2]),import.meta.url).then(i=>({default:i.SchedulesPage})));function V({className:i}){const f=E(),e=P(),d=I(),b=t("ClearChatButton"),j=t("AgentDetailsPage"),y=t("AgentsLibrary"),A=t("SessionsPage"),w=t("SaveAgentButton"),N=t("SelectAgentEmptyState"),v=t("UserAvatar"),S=a.useRef(null),C=(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,r=u||n||m||o,h=e!=null&&L(e.mode)&&!r&&(!d||e.agentConfigOpen),x=(e==null?void 0:e.isNewChatEnabled)!==!1,O=()=>{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(()=>{})},_=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return s.jsxs("div",{className:B("relative flex h-full min-h-0 w-full bg-primary-bg",i),children:[h?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(k,{showClose:d})}):null,s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[s.jsx(z,{className:"bg-topbar-bg",title:r?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(T,{}),end:s.jsxs(s.Fragment,{children:[r?null:s.jsxs(s.Fragment,{children:[s.jsx(b,{}),s.jsx(w,{})]}),s.jsx(D,{},"shell-actions"),s.jsx(v,{}),r?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:O,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:_,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(F,{})}):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(M,{})}):C?s.jsx(N,{}):s.jsx(R,{})})]})]})}export{V as DrawerLayout};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aD as be,D as fe,r as l,aE as Y,j as e,H as ge,K as B,I as L,aF as ie,aG as xe,aH as ye,aI as ve,e as P,aJ as je,a9 as Ne}from"./index-XpZpj5Rl.js";var me=Ne("h-11 shadow-sm"),we=({open:n,onOpenChange:o,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]=l.useState(""),[y,x]=l.useState(""),[w,$]=l.useState(!1),U=()=>{I(""),x(""),$(!1)};l.useEffect(()=>{n&&(I(""),x(E),$(!1))},[n,E]);const Q=i=>{i||U(),o(i)},T=M.trim(),X=!c||!!T,v=async i=>{if(i.preventDefault(),!(!X||O))try{await b({apiKey:T,baseUrl:y.trim()}),U(),o(!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(o=>{var b,k,p,E,d;return{id:o.id,name:o.name,advancedExpanded:!0,reasoningEfforts:(b=o.properties)==null?void 0:b.reasoningEfforts,contextLength:((p=(k=o.properties)==null?void 0:k.contextLength)==null?void 0:p.toString())??"",maxOutputTokens:((d=(E=o.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 o=n.trim();if(o==="")return null;const b=Number(o);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:o,onSubmit:b,reasoningEffortOptions:k,busy:p=!1,error:E,isEditMode:d=!1,initialValues:c})=>{const[S,O]=l.useState((c==null?void 0:c.name)??""),[F,M]=l.useState((c==null?void 0:c.baseUrl)??""),[I,y]=l.useState(""),[x,w]=l.useState(()=>ue(c)),[$,U]=l.useState(!1),[Q,T]=l.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(),o(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,le=!D&&!h&&x.every(s=>!J(s)&&!te(s)),se=$&&D,H=Q&&h,A=async()=>{if(K(),!le||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,oe=q(s),C=W(s),z=s.contextTouched&&oe,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:oe}):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:!le||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(),o=fe(),[b,k]=l.useState(""),[p,E]=l.useState([]),[d,c]=l.useState([]),[S,O]=l.useState(!0),[F,M]=l.useState(null),[I,y]=l.useState(null),[x,w]=l.useState(!1),[$,U]=l.useState(null),[Q,T]=l.useState(null),[X,v]=l.useState(null),[i,K]=l.useState(!1),[f,D]=l.useState(null),_=l.useMemo(()=>(d??[]).reduce((t,a)=>(t[a.name]=a.logo??"",t),{}),[d]),h=b.trim().toLowerCase(),J=l.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]);l.useEffect(()=>{J()},[J]);const te=l.useMemo(()=>new Set(p.map(t=>t.type)),[p]),q=l.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=l.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]),le=l.useMemo(()=>{var t;return(t=d.find(a=>a.type==="custom"))==null?void 0:t.supportedReasoningEfforts},[d]),se=l.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):o==null?M(Y(m,"Request failed")):o.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"))),o==null||o.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(()=>{o==null||o.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(()=>{o==null||o.showSuccess({title:"Model provider updated",description:`${a.name} was updated successfully.`})},0)},oe=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:"pencil",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:oe,onSubmit:f?R:j,reasoningEffortOptions:le,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,D as V,r,aE as B,j as e,S as J,I as N,a5 as Y,K as O,aG as Q,aH as W,aI as X,e as Z,aJ as ee,a9 as te}from"./index-XpZpj5Rl.js";var se={execTimeoutMs:3e5,autoStopIntervalInMinutes:15,autoArchiveIntervalInMinutes:10080,autoDeleteIntervalInMinutes:43200},F=te("h-11 shadow-sm");function U(s){if(s.trim()==="")return null;const l=Number(s);return!Number.isFinite(l)||l<0?null:l}var ae=({open:s,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(!s)return;const a=R??se;k(String(a.execTimeoutMs)),x(String(a.autoStopIntervalInMinutes)),i(String(a.autoArchiveIntervalInMinutes)),o(String(a.autoDeleteIntervalInMinutes)),f(""),v(!1)},[s,R]);const $=a=>{a||S(),l(a)},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 a=>{if(a.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:s,onOpenChange:$,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:a=>{f(a.target.value)},placeholder:y?"dtn_...":"Leave blank to keep existing",autoFocus:!0,className:F})]}),e.jsxs(W,{expanded:P,onChange:(a,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:a=>{k(a.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:a=>{x(a.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:a=>{i(a.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:a=>{o(a.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=ae,re=1e4,D=({execTimeoutMs:s,autoStopIntervalInMinutes:l,autoArchiveIntervalInMinutes:d,autoDeleteIntervalInMinutes:g})=>({execTimeoutMs:s,autoStopIntervalInMinutes:l,autoArchiveIntervalInMinutes:d,autoDeleteIntervalInMinutes:g}),le=s=>{switch(s){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:s,className:"text-text-secondary"}}},ie=()=>{const{sandboxCatalog:s}=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(s){t||w(!0),m(null);try{const[n,c]=await Promise.all([s.listSandboxProviders(),s.getSandboxProviderCatalog()]);g(n),R(c)}catch(n){m(B(n,"Failed to load sandbox providers"))}finally{t||w(!1)}}},[s]);r.useEffect(()=>{f()},[f]);const P=d.some(t=>t.snapshotSyncStatus.status==="pending");r.useEffect(()=>{if(!s||!P)return;const t=s;let n=!1,c;function j(){c=window.setTimeout(()=>{q()},re)}async function q(){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(B(L,"Failed to refresh sandbox providers")),j()}}return j(),()=>{n=!0,c!==void 0&&window.clearTimeout(c)}},[s,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]),$=r.useMemo(()=>o?D(o):i?D(i):null,[o,i]);if(!s)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(B(c,"Request failed")),c}finally{M(!1)}},A=async t=>{i&&(u(null),await h(async()=>{await s.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 s.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 s.updateSandboxProvider({id:t.id,...D(t)})}).catch(()=>{})},_=t=>{const n=s.deleteSandboxProvider;n&&h(async()=>{await n({id:t.id})}).catch(()=>{})},K=i!=null||o!=null,z=o!=null,a=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,q=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:[q,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"}),s.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:a,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:$,requireApiKey:!z,busy:x,error:k})]})},de=ie;export{de as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as Ne,B as Ie,D as je,r as i,E as fe,F as we,y as ye,G as Fe,q as ge,j as e,P as We,H as Qe,J as te,K as M,I as C,L as Ke,M as Te,N as Ce,O as Ye,Q as Ze,R as Ee,U as X,V as Je,W as ee,X as Xe,Y as et,Z as tt,$ as st,a0 as nt,a1 as at,e as G,c as rt,a2 as lt,a3 as he,d as it,a4 as ot,a5 as ct,a as dt,a6 as ut,a7 as mt,a8 as xt,a9 as ze,i as ht,aa as ft}from"./index-XpZpj5Rl.js";var Ae=[{value:"America/New_York",label:"America/New_York (ET)"},{value:"America/Chicago",label:"America/Chicago (CT)"},{value:"America/Denver",label:"America/Denver (MT)"},{value:"America/Los_Angeles",label:"America/Los_Angeles (PT)"},{value:"UTC",label:"UTC"},{value:"Europe/London",label:"Europe/London (GMT/BST)"},{value:"Europe/Berlin",label:"Europe/Berlin (CET)"},{value:"Asia/Kolkata",label:"Asia/Kolkata (IST)"},{value:"Asia/Tokyo",label:"Asia/Tokyo (JST)"}];function Me(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function gt(t){const n=Me(),l=new Set(Ae.map(o=>o.value));return[...[n,t].flatMap(o=>o==null||o.length===0||l.has(o)?[]:(l.add(o),[{value:o,label:o===n?`${o} (Local)`:o}])),...Ae]}var Le=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}],bt={"America/New_York":"ET","America/Chicago":"CT","America/Denver":"MT","America/Los_Angeles":"PT",UTC:"UTC","Europe/London":"GMT","Europe/Berlin":"CET","Asia/Kolkata":"IST","Asia/Tokyo":"JST"};function xe(){return{name:"",task:"",recurrence:"daily",hour:9,minute:0,weekdays:[1],customCron:"0 9 * * *",timezone:Me()}}function pt(t){return bt[t]??t.split("/").pop()??t}function $e(t){return t.toString().padStart(2,"0")}function de({hour:t,minute:n}){const l=t>=12?"PM":"AM",a=t%12===0?12:t%12;return`${String(a)}:${$e(n)} ${l}`}function be(t){const n=t.minute,l=t.hour;switch(t.recurrence){case"hourly":return`${String(n)} * * * *`;case"daily":return`${String(n)} ${String(l)} * * *`;case"weekly":{const a=[...t.weekdays].sort((c,g)=>c-g),o=a.length>0?a.join(","):"*";return`${String(n)} ${String(l)} * * ${o}`}case"custom":return t.customCron.trim()}}function re(t){const n=pt(t.timezone),l=t.cron.trim().split(/\s+/);if(l.length!==5)return t.cron;const[a,o,c,g,b]=l;if(c!=="*"||g!=="*")return t.cron;const u=Number(a),x=Number(o);if(o==="*"&&b==="*"&&a!==void 0&&!Number.isNaN(u))return`Hourly at :${$e(u)} ${n}`;if(b==="*"&&o!==void 0&&a!==void 0&&!Number.isNaN(x)&&!Number.isNaN(u))return`Daily ${de({hour:x,minute:u})} ${n}`;if(b==="1-5"&&o!==void 0&&a!==void 0&&!Number.isNaN(x)&&!Number.isNaN(u))return`Weekdays ${de({hour:x,minute:u})} ${n}`;if(b!=null&&/^\d(?:,\d)*$/.test(b)&&o!==void 0&&a!==void 0&&!Number.isNaN(x)&&!Number.isNaN(u)){const f=b.split(",").map(p=>{var N;return((N=Le.find(r=>r.value===Number(p)))==null?void 0:N.label)??p});return f.length===1?`Every ${f[0]==="Mon"?"Monday":f[0]} ${de({hour:x,minute:u})} ${n}`:`${f.join(", ")} ${de({hour:x,minute:u})} ${n}`}return t.cron}function Re(t){const n=xe(),l=t.cron.trim().split(/\s+/);if(l.length!==5)return{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron};const[a,o,c,g,b]=l,u=Number(a),x=Number(o);return c!=="*"||g!=="*"?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron}:o==="*"&&b==="*"&&!Number.isNaN(u)?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"hourly",minute:u,customCron:t.cron}:b==="*"&&!Number.isNaN(x)&&!Number.isNaN(u)?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"daily",hour:x,minute:u,customCron:t.cron}:b!=null&&/^\d(?:,\d)*$/.test(b)&&!Number.isNaN(x)&&!Number.isNaN(u)?{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"weekly",hour:x,minute:u,weekdays:b.split(",").map(Number),customCron:t.cron}:{...n,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron,hour:Number.isNaN(x)?n.hour:x,minute:Number.isNaN(u)?n.minute:u}}function Nt(t,n=Date.now()){if(t==null)return"Never";const l=Date.parse(t);if(Number.isNaN(l))return"Never";const a=Math.round((n-l)/1e3);if(a<60)return"just now";const o=Math.round(a/60);if(o<60)return`${String(o)} min ago`;const c=Math.round(o/60);if(c<48)return`${String(c)} hour${c===1?"":"s"} ago`;const g=Math.round(c/24);return`${String(g)} day${g===1?"":"s"} ago`}var jt=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"}],yt=Array.from({length:24},(t,n)=>({value:String(n),label:n.toString().padStart(2,"0")})),vt=[0,15,30,45].map(t=>({value:String(t),label:`:${t.toString().padStart(2,"0")}`}));function St({values:t,onChange:n,agentId:l,onAgentIdChange:a,agentOptions:o,agentOptionsLoaded:c=!0,agentPickerDisabled:g=!1,onBuildAgent:b}){const u=be(t),x=re({cron:u,timezone:t.timezone}),f=gt(t.timezone),p=(r,v)=>{n({...t,[r]:v})},N=r=>{const O=t.weekdays.includes(r)?t.weekdays.filter(_=>_!==r):[...t.weekdays,r];n({...t,weekdays:O.length>0?O:[r]})};return e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Agent"}),e.jsx(te,{"aria-label":"Agent",placeholder:"Select an agent",value:l,options:o.map(r=>({value:r.agentId,label:r.name})),onValueChange:r=>a==null?void 0:a(r),disabled:g||a==null,emptyContent:c?e.jsx("p",{className:"text-text-secondary px-3 py-5 text-center text-sm",children:"No Agents created yet"}):null,footer:c&&o.length===0&&b!=null?e.jsx("div",{className:"flex justify-end border-t border-border px-2 pt-2",children:e.jsxs(M.Ghost,{type:"button",onClick:b,children:[e.jsx(C,{name:"plus",className:"size-3.5"}),"Build Agent"]})}):null})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Name"}),e.jsx("input",{value:t.name,onChange:r=>p("name",r.target.value),placeholder:"harness-daily-digest",className:ze("h-8"),required:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Task"}),e.jsx("textarea",{value:t.task,onChange:r=>p("task",r.target.value),rows:3,placeholder:"Summarise yesterday's harness runs and post the digest…",className:ze("resize-y py-2"),required:!0})]}),e.jsxs("fieldset",{children:[e.jsx("legend",{className:"mb-1.5 text-sm font-medium",children:"Frequency"}),e.jsx("div",{className:"rounded-t-lg border border-border p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg border border-border bg-primary-bg p-1",children:jt.map(r=>{const v=t.recurrence===r.value;return e.jsx("button",{type:"button",className:G("rounded-md border px-2 py-2 text-sm font-medium transition-colors",v?"border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg":"border-transparent text-text-secondary hover:bg-ghost-button-hover"),"aria-pressed":v,onClick:()=>p("recurrence",r.value),children:r.label},r.value)})}),t.recurrence==="custom"?e.jsxs("div",{className:"rounded-md border border-border bg-secondary-bg/40 px-3 py-2",children:[e.jsx("span",{className:"block text-xs text-text-secondary",children:"Existing custom schedule"}),e.jsx("code",{className:"mt-1 block font-mono text-sm text-text-primary",children:t.customCron}),e.jsx("span",{className:"mt-1 block text-xs text-text-secondary",children:"Select Hourly, Daily, or Weekly to replace this schedule."})]}):null,t.recurrence==="weekly"?e.jsxs("fieldset",{children:[e.jsx("legend",{className:"mb-2 text-sm font-medium",children:"Days"}),e.jsx("div",{className:"flex gap-2",children:Le.map(r=>{const v=t.weekdays.includes(r.value);return e.jsx("button",{type:"button",className:G("min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium",v?"border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg":"border-border text-text-secondary hover:bg-ghost-button-hover"),"aria-pressed":v,onClick:()=>N(r.value),children:r.label},r.value)})})]}):null,e.jsxs("div",{className:"flex gap-4",children:[t.recurrence==="daily"||t.recurrence==="weekly"?e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Hour"}),e.jsx(te,{"aria-label":"Hour",value:String(t.hour),options:yt,onValueChange:r=>p("hour",Number(r))})]}):null,t.recurrence!=="custom"?e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Minute"}),e.jsx(te,{"aria-label":"Minute",value:String(t.minute),options:vt,onValueChange:r=>p("minute",Number(r))})]}):null,e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Timezone"}),e.jsx(te,{"aria-label":"Timezone",value:t.timezone,options:f,onValueChange:r=>p("timezone",r),menuClassName:"w-full min-w-0"})]})]})]})}),e.jsx("div",{className:"rounded-b-lg border border-t-0 border-border bg-primary-button-bg/10 px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{name:"clock",className:"size-4 shrink-0 text-primary-button-bg"}),e.jsx("span",{className:"shrink-0 text-xs font-medium text-text-secondary",children:"Schedule"}),e.jsx("p",{className:"min-w-0 flex-1 truncate text-sm text-text-primary",children:x||"—"}),e.jsx("code",{className:"shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary",children:u||"—"})]})})]})]})}function kt(t){return t.startsWith("manual-")}function wt(t){return t==="failed"?"failed":"success"}function Oe(t){return t==="failed"?"Failed":t==="triggered"?"Triggered":"Scheduled"}function _e(t){return kt(t)?"Manual test":"Cron"}function Tt(t,n=5){return t.filter(a=>a.status!=="scheduled").slice(0,n).reverse()}function pe(t){if(t==null)return"—";const n=new Date(t);return Number.isNaN(n.getTime())?"—":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).format(n)}function Ct({run:t}){return e.jsxs("div",{className:"flex flex-col gap-1 text-left text-xs",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Oe(t.status)}),e.jsx("p",{className:"text-text-secondary",children:_e(t.name)}),e.jsxs("p",{className:"text-text-secondary",children:["Scheduled for: ",pe(t.scheduledFor)]}),t.triggeredAt!=null?e.jsxs("p",{className:"text-text-secondary",children:["Triggered at: ",pe(t.triggeredAt)]}):null,e.jsxs("p",{className:"text-text-secondary",children:["Triggered by: ",t.triggeredBy]})]})}var Et={success:"border-emerald-600/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-400/35 dark:bg-emerald-500/15 dark:text-emerald-300",failed:"border-red-600/30 bg-red-500/10 text-red-700 dark:border-red-400/35 dark:bg-red-500/15 dark:text-red-300"};function Be({run:t}){const n=wt(t.status),l=pe(t.triggeredAt??t.scheduledFor);return e.jsx(ct,{content:e.jsx(Ct,{run:t}),side:"top",children:e.jsx("span",{className:G("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",Et[n]),"aria-label":`${Oe(t.status)} run at ${l}`,children:e.jsx(C,{name:n==="failed"?"triangle-exclamation":"check",className:"size-3.5"})})})}function Ue({status:t}){const n=t==="active";return e.jsxs("span",{className:G("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium",n?"border-emerald-600/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-400/35 dark:bg-emerald-500/15 dark:text-emerald-300":"border-amber-600/30 bg-amber-500/10 text-amber-800 dark:border-amber-400/35 dark:bg-amber-500/15 dark:text-amber-300"),children:[e.jsx("span",{className:G("size-1.5 shrink-0 rounded-full",n?"bg-emerald-600 dark:bg-emerald-400":"bg-amber-600 dark:bg-amber-400"),"aria-hidden":!0}),n?"Active":"Paused"]})}function zt(t,n){return t.find(l=>l.name===n||l.id===n)??null}function At({connector:t,onConnected:n}){return ht()==null?null:e.jsx(ft,{connector:t,onConnected:n})}function ae({label:t,children:n}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border px-3 py-2.5 last:border-b-0",children:[e.jsx("span",{className:"text-text-secondary shrink-0 text-[10px] font-semibold tracking-wide uppercase",children:t}),e.jsx("div",{className:"min-w-0 text-right text-sm text-text-primary",children:n})]})}function Rt({schedule:t,agentName:n,mcpMounts:l,onEditConfiguration:a}){const o=Ne(),c=je(),{connectors:g,ensureLoaded:b,refreshConnectors:u,loading:x,error:f}=xt(),[p,N]=i.useState(!1),[r,v]=i.useState(null),O=re({cron:t.cron,timezone:t.timezone}),_=async()=>{N(!0);try{const w=await o.createScheduleRun({scheduleId:t.id});v(w),c==null||c.showSuccess({title:"Test run started"})}catch(w){c==null||c.showError(w)}finally{N(!1)}};return i.useEffect(()=>{b()},[b]),i.useEffect(()=>{f!=null&&(c==null||c.showError(f))},[f,c]),e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx(ae,{label:"Agent",children:n}),e.jsx(ae,{label:"Name",children:t.name}),e.jsx(ae,{label:"Status",children:e.jsx(Ue,{status:t.status})}),e.jsx(ae,{label:"Task",children:e.jsx("span",{className:"whitespace-pre-wrap break-words",children:t.task})}),e.jsx(ae,{label:"Frequency",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[e.jsx("span",{children:O}),e.jsx("code",{className:"text-text-secondary font-mono text-xs",children:t.cron})]})}),e.jsx("div",{className:"flex justify-end px-3 py-2.5",children:e.jsxs(M.Secondary,{type:"button",size:"small",onClick:a,children:[e.jsx(C,{name:"pencil",className:"size-3.5"}),"Edit Configuration"]})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx("div",{className:"border-b border-border px-3 py-2",children:e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Tool Authorization"})}),l.length===0?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"No MCP connectors configured for this agent."}):e.jsx("ul",{className:"divide-y divide-border",children:l.map(w=>{const m=zt(g,w.name),k=(m==null?void 0:m.authenticated)===!0,V=m==null&&!x;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:G("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",k?"border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"border-border text-transparent"),"aria-hidden":!0,children:k?e.jsx(C,{name:"check",className:"size-3"}):null}),e.jsx("span",{className:"text-text-primary min-w-0 flex-1 truncate text-sm",children:w.name}),k?e.jsx("span",{className:"text-success-bg text-xs font-medium",children:"Connected"}):V?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):m!=null&&m.authenticated===!1?e.jsx(At,{connector:m,onConnected:u}):x?e.jsx("span",{className:"text-text-secondary text-xs",children:"Loading…"}):null]},w.name)})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Test Run"}),e.jsxs(M.Primary,{type:"button",disabled:p,size:"small",onClick:()=>void _(),children:[e.jsx(C,{name:p?"loader":"play",className:G("size-3.5",p&&"animate-spin")}),"Run Test"]})]}),r==null?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"Run a one-off test using the schedule task. This does not change the cron pending run."}):e.jsxs("div",{className:"flex items-center gap-3 px-3 py-3",children:[e.jsx(Be,{run:r}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:_e(r.name)}),e.jsx("p",{className:"text-text-secondary",children:Nt(r.triggeredAt??r.scheduledFor)})]})]})]})]})}function Pt({open:t,onOpenChange:n,mode:l,schedule:a,initialAgentId:o="",onSaved:c}){var ne;const g=Ne(),b=Ie(),u=dt(),x=je(),[f,p]=i.useState(xe),[N,r]=i.useState(o),[v,O]=i.useState([]),[_,w]=i.useState(!1),[m,k]=i.useState({kind:"form"}),[V,I]=i.useState(!1),[le,y]=i.useState(!1),[B,E]=i.useState(null),se=m.kind==="form"?m.saved:m.schedule,L=l==="edit"&&m.kind==="form"&&m.saved==null&&a!=null,$=m.kind==="form"&&m.saved!=null,q=l==="create"&&m.kind==="form"&&m.saved==null,{allows:W}=fe({resourceType:"agent",resourceIds:N.length===0?[]:[N]});i.useEffect(()=>{if(!t)return;let h=!1;return w(!1),Fe(b).then(S=>{h||(O(S),w(!0))}).catch(()=>{}),()=>{h=!0}},[t,b]),i.useEffect(()=>{if(!t){p(xe()),r(o),E(null),k({kind:"form"}),y(!1);return}if(l==="edit"&&a!=null){p(Re({name:a.name,task:a.task,cron:a.cron,timezone:a.timezone})),r(a.agentId),k({kind:"form"});return}p(xe()),r(o),k({kind:"form"})},[t,l,a,o]);const Q=i.useMemo(()=>v.map(h=>({agentId:ge(h),name:h.name})),[v]),z=i.useMemo(()=>v.find(h=>ge(h)===N)??null,[v,N]),A=(z==null?void 0:z.name)??(se==null?void 0:se.agentName)??(a==null?void 0:a.agentName)??((ne=Q.find(h=>h.agentId===N))==null?void 0:ne.name)??N,ie=i.useMemo(()=>{var S;return(((S=z==null?void 0:z.agentSpec)==null?void 0:S.mcpServers)??[]).map(ut).filter(T=>T!=null).map(T=>({name:T}))},[z]),U=i.useMemo(()=>{const h=be(f);return f.name.trim().length>0&&f.task.trim().length>0&&h.length>0&&N.length>0&&(!q||W(N,"USE"))},[N,W,f,q]),R=h=>{k({kind:"test",schedule:h}),p(Re({name:h.name,task:h.task,cron:h.cron,timezone:h.timezone})),r(h.agentId)},K=async h=>{if(h.preventDefault(),!U)return;const S=be(f);I(!0),E(null);try{if(L&&a!=null){await g.updateSchedule({id:a.id,name:f.name.trim(),task:f.task.trim(),cron:S,timezone:f.timezone,status:a.status}),c==null||c(),n(!1);return}if($&&m.kind==="form"&&m.saved!=null){const Z=await g.updateSchedule({id:m.saved.id,name:f.name.trim(),task:f.task.trim(),cron:S,timezone:f.timezone,status:"paused"});c==null||c(),R(Z),x==null||x.showSuccess({title:"Schedule saved as paused",description:re({cron:Z.cron,timezone:Z.timezone})});return}const T=await g.createSchedule({agentId:N,name:f.name.trim(),task:f.task.trim(),cron:S,timezone:f.timezone,status:"paused"});c==null||c(),R(T),x==null||x.showSuccess({title:"Schedule saved as paused",description:re({cron:T.cron,timezone:T.timezone})})}catch(T){const Z=T instanceof Error?T.message:"Failed to save schedule";E(Z)}finally{I(!1)}},oe=async()=>{if(m.kind==="test"){y(!0),E(null);try{await g.updateSchedule({id:m.schedule.id,name:m.schedule.name,task:m.schedule.task,cron:m.schedule.cron,timezone:m.schedule.timezone,status:"active"}),c==null||c(),x==null||x.showSuccess({title:"Schedule activated"}),n(!1)}catch(h){const S=h instanceof Error?h.message:"Failed to activate schedule";E(S),x==null||x.showError(h)}finally{y(!1)}}},Y=m.kind==="test"?"Test Schedule":L||$?"Edit Schedule":"New Schedule",F=m.kind==="test"?`Recurring unattended runs of ${A}.`:L||$?"Update cadence and task for this schedule.":"Create a recurring unattended run for an agent.";let P;return m.kind==="test"?P=e.jsxs("div",{className:"flex flex-col gap-2",children:[B!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:B}):null,e.jsx(M.Secondary,{type:"button",className:"w-full",disabled:le,onClick:()=>void oe(),children:"Activate Schedule"})]}):P=e.jsxs("div",{className:"flex flex-col gap-2",children:[B!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:B}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(M.Secondary,{type:"button",onClick:()=>n(!1),disabled:V,children:"Cancel"}),e.jsx(M.Primary,{type:"submit",form:"schedule-form",disabled:!U||V,children:"Save"})]})]}),e.jsx(mt,{open:t,onOpenChange:n,title:Y,description:F,anchor:"right",size:"xl",headerIcon:e.jsx("span",{className:"text-primary-button-bg inline-flex size-8 items-center justify-center",children:e.jsx(C,{name:m.kind==="test"||L||$?"calendar":"calendar-plus",className:"size-5"})}),footer:P,children:m.kind==="test"?e.jsx(Rt,{schedule:m.schedule,agentName:A,mcpMounts:ie,onEditConfiguration:()=>{E(null),k({kind:"form",saved:m.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:h=>void K(h),children:e.jsx(St,{values:f,onChange:p,agentId:N,onAgentIdChange:L||$?void 0:r,agentOptions:Q,agentOptionsLoaded:_,agentPickerDisabled:L||$,onBuildAgent:l==="create"&&(u==null?void 0:u.isComposerEnabled)===!0?()=>{n(!1),u.openAgentBuilder()}:void 0})})})}function Pe(t){return e.jsx(ot,{children:e.jsx(Pt,{...t})})}function Dt({runs:t}){const n=Tt(t);return n.length===0?e.jsx("span",{className:"text-text-secondary text-sm",children:"—"}):e.jsx("div",{className:"flex items-center gap-1",children:n.map(l=>e.jsx(Be,{run:l},l.id))})}var It=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],De=[10,25];function ue(t){return Math.min(Math.max(t,1),25)}function me(t){const n=ye(t);return{nameQuery:n.q??"",statusFilter:n.status??"all",agentFilter:n.agent??"all"}}function Ft(t){const n=ye(window.location.search);if(!n.isNew)return{kind:"closed"};const l=t??n.agent;return{kind:"create",...l==null?{}:{agentId:l}}}function Mt({schedule:t,running:n,canManage:l,canDelete:a,onRunNow:o,onEdit:c,onTogglePause:g,onDelete:b}){const u=rt("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1.5",children:[e.jsx(u,{allowed:l,children:e.jsxs(M.Secondary,{type:"button",disabled:n,"aria-label":`Run now ${t.name}`,size:"large",onClick:o,children:[e.jsx(C,{name:n?"loader":"play",className:G("size-3.5",n&&"animate-spin")}),"Run now"]})}),e.jsxs(lt,{align:"end",trigger:e.jsx("button",{type:"button",className:it({variant:"ghost",size:"icon"}),"aria-label":`Actions for ${t.name}`,children:e.jsx(C,{name:"ellipsis"})}),children:[e.jsx(u,{allowed:l,children:e.jsxs(he,{onClick:c,children:[e.jsx(C,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(u,{allowed:l,children:e.jsxs(he,{onClick:g,children:[e.jsx(C,{name:t.status==="active"?"pause":"play",className:"size-3.5"}),t.status==="active"?"Pause":"Resume"]})}),e.jsx(u,{allowed:a,children:e.jsxs(he,{className:"text-failure-bg focus:text-failure-bg",onClick:b,children:[e.jsx(C,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function $t({agentId:t}){const n=Ne(),l=Ie(),a=je(),[o,c]=i.useState([]),{allows:g}=fe({resourceType:"schedule",resourceIds:o.map(s=>s.id)}),[b,u]=i.useState({}),[x,f]=i.useState(!1),[p,N]=i.useState(()=>new Set),[r,v]=i.useState([]),[O,_]=i.useState(!0),[w,m]=i.useState(null),[k,V]=i.useState(()=>me(window.location.search).nameQuery),[I,le]=i.useState(()=>me(window.location.search).statusFilter),[y,B]=i.useState(()=>t??me(window.location.search).agentFilter),E=t??(y==="all"?null:y),se=i.useMemo(()=>E==null?r.map(s=>s.agentId):[E],[r,E]),{allows:L}=fe({resourceType:"agent",resourceIds:se}),$=l.permissions==null||(E==null?r.some(s=>L(s.agentId,"USE")):L(E,"USE")),[q,W]=i.useState(()=>Ft(t)),[Q,z]=i.useState(null),[A,ie]=i.useState(()=>ue(at)),[U,R]=i.useState(void 0),[K,oe]=i.useState(void 0),[Y,F]=i.useState([]),P=i.useRef(0),ne=i.useRef(!1),h=i.useCallback(async({rows:s,gen:d})=>{if(s.length===0){d===P.current&&u({});return}f(!0);try{const j=await Promise.allSettled(s.map(D=>n.listScheduleRuns({scheduleId:D.id})));if(d!==P.current)return;u(Object.fromEntries(s.map((D,H)=>{const J=j[H],qe=(J==null?void 0:J.status)==="fulfilled"?J.value:[];return[D.id,qe]})))}finally{d===P.current&&f(!1)}},[n]),S=i.useCallback(async({token:s,size:d,agentId:j})=>{const D=++P.current;_(!0),m(null);try{const H=await n.listSchedules({limit:ue(d),...s===void 0||s===""?{}:{pageToken:s},...j==="all"?{}:{agentIds:[j]}});if(D!==P.current)return;c(H.data),oe(H.nextPageToken),h({rows:H.data,gen:D})}catch(H){if(D!==P.current)return;const J=H instanceof Error?H.message:"Failed to load schedules";m(J),c([]),u({}),oe(void 0)}finally{D===P.current&&_(!1)}},[n,h]),T=i.useCallback(s=>{const d=(s==null?void 0:s.size)??A,j=(s==null?void 0:s.agentId)??y;R(void 0),F([]),S({token:void 0,size:d,agentId:j})},[y,S,A]);i.useEffect(()=>{we({agent:t===void 0&&y!=="all"?y:null,status:I==="all"?null:I,q:k.trim().length===0?null:k})},[y,t,I,k]),i.useEffect(()=>{t!==void 0&&B(s=>s===t?s:(R(void 0),F([]),t))},[t]),i.useEffect(()=>{ne.current||!ye(window.location.search).isNew||(ne.current=!0,we({isNew:null}))},[]),i.useEffect(()=>{const s=()=>{const d=me(window.location.search);V(d.nameQuery),le(d.statusFilter),B(j=>{const D=t??d.agentFilter;return j===D?j:(R(void 0),F([]),D)})};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[t]),i.useEffect(()=>{S({token:U,size:A,agentId:y})},[y,A,U,S]),i.useEffect(()=>{let s=!1;return Fe(l).then(d=>{s||v(d.map(j=>({agentId:ge(j),name:j.name})))}).catch(()=>{}),()=>{s=!0}},[l]);const Z=i.useMemo(()=>{const s=new Map;for(const d of r)s.set(d.agentId,d.name);return s},[r]),ce=i.useMemo(()=>{const s=k.trim().toLowerCase();return o.filter(d=>!(I!=="all"&&d.status!==I||s.length>0&&!d.name.toLowerCase().includes(s)))},[o,k,I]),ve=Y.length>0||K!=null,He=async s=>{if(!g(s.id,"MANAGE"))return;const d=s.status==="active"?"paused":"active";try{await n.updateSchedule({...s,status:d}),await S({token:U,size:A,agentId:y})}catch(j){a==null||a.showError(j)}},Ge=async s=>{if(g(s.id,"MANAGE")){N(d=>new Set(d).add(s.id));try{await n.createScheduleRun({scheduleId:s.id}),a==null||a.showSuccess({title:"Run started"});const d=await n.listScheduleRuns({scheduleId:s.id});u(j=>({...j,[s.id]:d}))}catch(d){a==null||a.showError(d)}finally{N(d=>{const j=new Set(d);return j.delete(s.id),j})}}},Ve=async s=>{if(g(s.id,"DELETE")){z(null);try{await n.deleteSchedule({id:s.id}),T()}catch(d){a==null||a.showError(d)}}},Se=()=>{K!=null&&(F(s=>[...s,U??""]),R(K))},ke=()=>{if(Y.length===0)return;const s=[...Y],d=s.pop();F(s),R(d===""?void 0:d)};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-primary-bg",children:[e.jsx(We,{title:t===void 0?"Scheduled Agents":void 0,end:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full sm:w-56",children:e.jsx(Qe,{query:k,setQuery:V,placeholder:"Search schedules by name"})}),e.jsx(te,{value:I,onValueChange:le,options:It,className:"sm:w-40","aria-label":"Filter by status"}),t===void 0?e.jsx(te,{value:y,onValueChange:s=>{B(s),R(void 0),F([])},options:[{value:"all",label:"All agents"},...r.map(s=>({value:s.agentId,label:s.name}))],className:"sm:w-40","aria-label":"Filter by agent"}):null,e.jsxs(M.Primary,{type:"button",disabled:!$,onClick:()=>$&&W({kind:"create",agentId:y!=="all"?y:void 0}),children:[e.jsx(C,{name:"plus",className:"size-3.5"}),"Create Schedule"]})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-4 py-4",children:O?e.jsx("div",{className:"flex flex-col gap-2",role:"status","aria-label":"Loading schedules",children:Array.from({length:5},(s,d)=>e.jsx(Ke,{className:"h-12 w-full rounded-md"},d))}):w!=null?e.jsx("p",{className:"text-failure-bg px-3 py-8 text-center text-sm",children:w}):o.length===0?e.jsx(Te,{title:"No Schedules Found",description:"Create one to get started.",className:"min-h-full"}):ce.length===0?e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(Te,{title:"No Schedules Found",description:"No schedules match your filters.",className:"flex-1"}),ve?e.jsx(Ce,{pageSize:A,rowCount:0,canPrev:Y.length>0,canNext:K!=null,onPrev:ke,onNext:Se,pageSizeOptions:De,onPageSizeChange:s=>{const d=ue(s);ie(d),R(void 0),F([])}}):null]}):e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs(Ye,{className:"min-w-[48rem]",children:[e.jsx(Ze,{children:e.jsxs(Ee,{className:"hover:bg-transparent",children:[e.jsx(X,{children:"Name"}),e.jsx(X,{children:"Agent"}),e.jsx(X,{children:"Frequency"}),e.jsx(X,{children:"Status"}),e.jsx(X,{children:"Last 5 runs"}),e.jsx(X,{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(Je,{children:ce.map(s=>{const d=re({cron:s.cron,timezone:s.timezone}),j=s.agentName??Z.get(s.agentId)??s.agentId;return e.jsxs(Ee,{children:[e.jsx(ee,{className:"text-text-primary font-medium",children:e.jsx("span",{className:"text-left !no-underline",children:s.name})}),e.jsx(ee,{children:j}),e.jsx(ee,{children:d}),e.jsx(ee,{children:e.jsx(Ue,{status:s.status})}),e.jsx(ee,{children:x?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):e.jsx(Dt,{runs:b[s.id]??[]})}),e.jsx(ee,{className:"text-right",children:e.jsx(Mt,{schedule:s,running:p.has(s.id),canManage:g(s.id,"MANAGE"),canDelete:g(s.id,"DELETE"),onRunNow:()=>void Ge(s),onEdit:()=>{g(s.id,"MANAGE")&&W({kind:"edit",schedule:s})},onTogglePause:()=>void He(s),onDelete:()=>{g(s.id,"DELETE")&&z(s)}})})]},s.id)})})]}),(ce.length>0||ve)&&e.jsx(Ce,{pageSize:A,rowCount:ce.length,canPrev:Y.length>0,canNext:K!=null,onPrev:ke,onNext:Se,pageSizeOptions:De,onPageSizeChange:s=>{const d=ue(s);ie(d),R(void 0),F([])}})]})}),q.kind==="create"?e.jsx(Pe,{open:!0,mode:"create",initialAgentId:q.agentId??"",onOpenChange:s=>{s||W({kind:"closed"})},onSaved:()=>T()}):null,q.kind==="edit"?e.jsx(Pe,{open:!0,mode:"edit",schedule:q.schedule,onOpenChange:s=>{s||W({kind:"closed"})},onSaved:()=>void S({token:U,size:A,agentId:y})}):null,Q!=null?e.jsxs(Xe,{open:!0,onOpenChange:s=>{s||z(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(et,{children:e.jsxs(tt,{children:[e.jsx(st,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",Q.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(nt,{children:[e.jsx(M.Secondary,{type:"button",onClick:()=>z(null),children:"Cancel"}),e.jsx(M.Destructive,{type:"button",disabled:!g(Q.id,"DELETE"),onClick:()=>void Ve(Q),children:"Delete"})]})]}):null]})}export{$t as SchedulesPage};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModelSettings-6QLS63HM-B0omK7y_.js","./index-XpZpj5Rl.js","./index-BBGLYdJn.css","./ConnectorSettings-R5VEP7BO-Cvdqimeu.js","./SkillSettings-JSX2BTII-BriJH4Oj.js","./SandboxSettings-OLKDXIQS-O1pf1zn0.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{g as h,i as v,aB as y,a8 as j,aC as S,r as t,j as e,P as _,I as p,d as k,e as f,_ as d,S as w}from"./index-XpZpj5Rl.js";var E=t.lazy(()=>d(()=>import("./ModelSettings-6QLS63HM-B0omK7y_.js"),__vite__mapDeps([0,1,2]),import.meta.url)),C=t.lazy(()=>d(()=>import("./ConnectorSettings-R5VEP7BO-Cvdqimeu.js"),__vite__mapDeps([3,1,2]),import.meta.url)),N=t.lazy(()=>d(()=>import("./SkillSettings-JSX2BTII-BriJH4Oj.js"),__vite__mapDeps([4,1,2]),import.meta.url)),L=t.lazy(()=>d(()=>import("./SandboxSettings-OLKDXIQS-O1pf1zn0.js"),__vite__mapDeps([5,1,2]),import.meta.url));function O(){return e.jsxs("div",{className:"flex flex-1 items-center justify-center py-8",role:"status","aria-live":"polite","aria-busy":"true",children:[e.jsx(w,{size:20,className:"text-text-secondary"}),e.jsx("span",{className:"sr-only",children:"Loading"})]})}var P=()=>{const{settingsOpen:n,settingsSection:l,setSettingsOpen:r}=h(),a=v(),u=y(),{refresh:m}=j(),i=S(),o=(a==null?void 0:a.skillCatalog)!=null,c=(a==null?void 0:a.sandboxCatalog)!=null,x=t.useCallback(()=>{r(!1)},[r]);t.useEffect(()=>{if(n)return()=>{m(),u==null||u()}},[n,m,u]),t.useEffect(()=>{!o&&l==="skills"&&r(n,"models"),!c&&l==="sandbox"&&r(n,"models")},[o,c,l,n,r]),t.useEffect(()=>{if(!n)return;const s=b=>{b.key==="Escape"&&(b.stopImmediatePropagation(),x())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[x,n]);const g=t.useMemo(()=>{const s=[{id:"models",label:"Models",icon:"cpu"},{id:"connectors",label:"Connectors",icon:"plug"}];return o&&s.push({id:"skills",label:"Skills",icon:"lightbulb"}),c&&s.push({id:"sandbox",label:"Sandbox providers",icon:"cube"}),s},[o,c]);return!n||!a?null:e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col bg-primary-bg",children:[e.jsx(_,{title:"Settings",start:e.jsx("button",{type:"button","aria-label":"Back",title:"Back",className:k({variant:"ghost",size:"icon"}),onClick:x,children:e.jsx(p,{name:"arrow-left"})})}),e.jsxs("div",{className:f("flex min-h-0 flex-1 flex-col",!i&&"md:flex-row"),children:[e.jsx("nav",{"aria-label":"Settings sections",className:f("flex w-full gap-1 border-b border-border bg-secondary-bg/40 p-2",i?"min-w-0":"justify-center md:w-48 md:flex-col md:justify-start md:border-b-0 md:border-r"),children:g.map(s=>e.jsxs("button",{type:"button","aria-current":l===s.id?"page":void 0,...i?{title:s.label}:{},className:f("flex min-h-9 items-center gap-2 rounded-md px-3 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",i?"min-w-0 flex-1 justify-center gap-1.5 px-1.5":"shrink-0",l===s.id?"bg-primary-button-bg text-primary-button-text":"text-text-secondary hover:bg-ghost-button-hover/60 hover:text-text-primary"),onClick:()=>{r(!0,s.id)},children:[e.jsx(p,{name:s.icon,className:"h-4 w-4 shrink-0"}),i?e.jsx("span",{className:"truncate",children:s.label}):s.label]},s.id))}),e.jsx("section",{className:"flex flex-col h-full flex-1 overflow-y-hidden px-6 py-4",children:e.jsx("div",{className:"w-full max-w-210 h-full min-h-0 flex flex-col mx-auto",children:e.jsxs(t.Suspense,{fallback:e.jsx(O,{}),children:[l==="models"?e.jsx(E,{}):null,l==="connectors"?e.jsx(C,{}):null,l==="skills"&&o?e.jsx(N,{}):null,l==="sandbox"&&c?e.jsx(L,{}):null]})})})]})]})},I=P;export{I as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as F,p as v,b as J,s as I}from"./chunk-73FQVITT-mgvTPDmd.js";import{g as ne,h as re,i as se,k as ae,l as ie,m as le,n as ue,r as a,t as oe,o as ce,p as ge,q as pe}from"./index-XpZpj5Rl.js";import{u as fe,a as ye}from"./chunk-62JRHF6Z-DYrEQoq5.js";var M="try_agent_name",_="history_agent_name";function V(n){return n!=null&&n.length>0?n:null}function E(n){const i=new URLSearchParams(n.startsWith("?")?n.slice(1):n),l=V(i.get(M));if(l!=null)return{intent:"try-agent",agentName:l};const e=V(i.get(_));return e==null?null:{intent:"history",agentName:e}}function he(n,i){n.delete(M),n.delete(_),i!=null&&n.set(i.intent==="try-agent"?M:_,i.agentName)}function X(n,i){const l=new URLSearchParams(n.startsWith("?")?n.slice(1):n);he(l,i);const e=l.toString();return e.length>0?`?${e}`:""}function Z(n){const i=n.activeRemoteId??n.pendingSessionId;if(i!=null)return{type:"session",sessionId:i};const{mode:l,agentConfigMode:e}=n;if(l.status==="active"&&l.isMutable&&l.isCreateAgent)return{type:"buildAgent"};if(l.status==="active"&&!l.isMutable&&e!=="SingleAgent"){const g=l.agentName??l.agentId;if(g!=null)return{type:"agent",agentName:g}}return{type:"root"}}function de(n){return n.settingsOpen?{type:"settings"}:n.schedulesOpen?{type:"schedules"}:n.sessionsOpen?{type:"sessionsBrowser"}:n.libraryOpen&&n.libraryAgentId!=null?{type:"libraryAgent",agentId:n.libraryAgentId}:n.libraryOpen?{type:"library"}:Z(n)}function b(n){return n.type==="root"||n.type==="agent"||n.type==="session"}function Ae({routes:n,activeRemoteId:i,initialSettingsOpen:l}){var j,z;const e=ne(),g=re(),B=se(),k=ae(),q=ie(),U=le(),$=ue(),C=fe(),s=ye(),o=a.useMemo(()=>oe({routes:n,catalog:B,capabilities:U,sessions:k,schedules:q}),[n,B,U,k,q]),T=o.settings!=null,x=[o.settings,o.sessionsBrowser,o.libraryAgent,o.schedules].join("\0"),W={settingsOpen:e.settingsOpen,libraryOpen:e.libraryOpen,sessionsOpen:e.sessionsOpen,libraryAgentId:e.libraryAgentId,schedulesOpen:e.schedulesOpen,pendingSessionId:e.pendingSessionId,activeRemoteId:i,mode:e.mode,agentConfigMode:e.agentConfigMode},p=de(W),ee=JSON.stringify(p),S=a.useRef(null),H=a.useRef(null),A=a.useRef(null),O=a.useRef(!1),P=a.useRef(null),m=a.useRef(null),w=a.useRef(null),f=a.useRef(null),Y=a.useRef(!1),G=a.useRef(!1),K=a.useCallback(t=>{if(w.current=t,g==null){e.openHistorySession({sessionId:t});return}g.getSession({sessionId:t}).then(r=>{w.current===t&&e.openHistorySession({sessionId:t,isMutable:r.isMutable,isCreateAgent:ce(r),...r.agentName!=null?{agentName:r.agentName}:{}})}).catch(()=>{w.current===t&&e.openHistorySession({sessionId:t})})},[g,e]),h=a.useCallback(t=>{if(t==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}const r=`${t.intent}\0${t.agentName}`,u=e.historyAgentFilter;if((u==null?void 0:u.intent)===t.intent&&u.agentName===t.agentName&&u.agentId!=null){f.current=null;return}f.current=r,e.setHistoryAgentFilter(t),g!=null&&ge({server:g,agentName:t.agentName}).then(c=>{if(f.current===r){if(c==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}f.current=null,e.setHistoryAgentFilter({agentId:pe(c),agentName:c.name,intent:t.intent})}}).catch(()=>{f.current===r&&(f.current=null,m.current=null,e.setHistoryAgentFilter(null))})},[g,e]),Q=a.useCallback(t=>{e.selectLibraryAgent({isMutable:!1,agentName:t}),h({intent:"try-agent",agentName:t})},[h,e]),L=a.useCallback(t=>{switch(t.type){case"settings":e.setSettingsOpen(!0);return;case"library":e.setLibraryOpen(!0);return;case"sessionsBrowser":e.setSessionsOpen(!0);return;case"libraryAgent":e.openLibraryAgent(t.agentId);return;case"schedules":e.setSchedulesOpen(!0);return;case"buildAgent":e.openAgentBuilder();return;case"session":if(e.setLibraryOpen(!1),e.pendingSessionId===t.sessionId||i===t.sessionId)return;K(t.sessionId);return;case"agent":e.setLibraryOpen(!1),Q(t.agentName);return;case"root":switch(e.setSettingsOpen(!1),e.setLibraryOpen(!1),e.setSchedulesOpen(!1),e.agentConfigMode){case"AgentLibrary":e.openLibraryHome();return;case"AgentComposer":case"AgentLibraryWithComposer":e.openDraft();return;case"SingleAgent":e.clearChat();return}}},[e,i,Q,K]);return a.useEffect(()=>{if(O.current)return;const t=F({pathname:s.pathname,search:s.search,routes:n});if(!$&&(t==null?void 0:t.type)==="settings")return;O.current=!0;const r=F({pathname:s.pathname,search:s.search,routes:o})??{type:"root"},u=r.type==="agent"?{intent:"try-agent",agentName:r.agentName}:b(r)?E(s.search):null;m.current=u,A.current=r;const c=T&&(l||r.type==="settings");if(r.type==="settings")T&&e.setSettingsOpen(!0);else if(r.type==="library")e.setLibraryOpen(!0);else if(r.type==="sessionsBrowser")e.setSessionsOpen(!0);else if(r.type==="libraryAgent")e.openLibraryAgent(r.agentId);else if(r.type==="schedules")e.setSchedulesOpen(!0);else{const R=Z(W);v(R,r)||L(r),c&&e.setSettingsOpen(!0)}r.type!=="agent"&&u!=null?h(u):b(r)||h(null);const d=c?{type:"settings"}:r;P.current=v(p,d)?null:d;const y=J(d,o),N=X(I(d,s.search),u);H.current=d,y!=null&&(y!==s.pathname||N!==s.search)&&(S.current=y!==s.pathname?y:null,C({pathname:y,search:N,hash:s.hash},{replace:!0}))},[$]),a.useEffect(()=>{if(!O.current)return;if(!Y.current){Y.current=!0;return}const t=P.current;if(t!=null){if(!v(p,t))return;P.current=null}const r=J(p,o);if(r==null)return;const c=`${o.basename.endsWith("/")?o.basename.slice(0,-1):o.basename}${s.pathname}`||"/",d=window.location.pathname===c?window.location.search:s.search,y=b(p),N=y?e.historyAgentFilter==null?m.current:{intent:e.historyAgentFilter.intent,agentName:e.historyAgentFilter.agentName}:null;!y&&e.historyAgentFilter!=null&&(f.current=null,e.setHistoryAgentFilter(null)),e.historyAgentFilter!=null&&(m.current=null);const R=X(I(p,d),N),D=H.current;if(H.current=p,r===s.pathname&&R===s.search)return;const te=p.type==="session"&&e.pendingSessionId==null&&D!=null&&D.type!=="session";S.current=r!==s.pathname?r:null,C({pathname:r,search:R,hash:s.hash},{replace:te})},[ee,x,(j=e.historyAgentFilter)==null?void 0:j.agentName,(z=e.historyAgentFilter)==null?void 0:z.intent]),a.useEffect(()=>{if(!O.current)return;if(!G.current){G.current=!0;return}if(S.current===s.pathname){S.current=null,A.current=p;return}const t=F({pathname:s.pathname,search:s.search,routes:o});if(t==null){const u=o.root,c=I({type:"root"},s.search);S.current=u,C({pathname:u,search:c,hash:s.hash},{replace:!0}),L({type:"root"}),h(E(c));return}const r=A.current;A.current=t,(r==null||!v(r,t))&&(t.type!=="settings"&&e.settingsOpen&&e.setSettingsOpen(!1),t.type!=="library"&&t.type!=="libraryAgent"&&e.libraryOpen&&e.setLibraryOpen(!1),t.type!=="sessionsBrowser"&&e.sessionsOpen&&e.setSessionsOpen(!1),t.type!=="schedules"&&e.schedulesOpen&&e.setSchedulesOpen(!1),L(t)),t.type!=="agent"&&b(t)?h(E(s.search)):b(t)||h(null)},[s.pathname,s.search]),null}export{Ae as ShellRouteSync};
|
|
Binary file
|
|
Binary file
|