@truefoundry/trueforge 0.2.0-rc.9 → 0.2.1
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-T7PR6PDP-BtYr0hCd.js → AgentCodeSnippets-DAZWEBJS-BRFLL3U-.js} +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-DAZWEBJS-BRFLL3U-.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-DAZWEBJS-BRFLL3U-.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-VDIE3S2P-D_xJ9A8R.js +1 -0
- package/dist/_frontend/assets/AgentMetricChart-VDIE3S2P-D_xJ9A8R.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-VDIE3S2P-D_xJ9A8R.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-5JIVYXPX-C7wS6H9h.js +1 -0
- package/dist/_frontend/assets/AgentOverview-5JIVYXPX-C7wS6H9h.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-5JIVYXPX-C7wS6H9h.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimeline-SETKGGCI-T0eprzt1.js → AgentSessionEventTimeline-WELJSS6O-UXUue7Eb.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimeline-WELJSS6O-UXUue7Eb.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-WELJSS6O-UXUue7Eb.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimelineChart-4Y7PY5SJ-Bp3PJ8em.js → AgentSessionEventTimelineChart-ADB3KICM-Ci7-9UDP.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-ADB3KICM-Ci7-9UDP.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-ADB3KICM-Ci7-9UDP.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-NSN4LIGJ-ZjsdJ6V6.js +1 -0
- package/dist/_frontend/assets/AgentSessions-NSN4LIGJ-ZjsdJ6V6.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-NSN4LIGJ-ZjsdJ6V6.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-C6MFCKYX-BvX0CZ86.js +1 -0
- package/dist/_frontend/assets/ConnectorSettings-C6MFCKYX-BvX0CZ86.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-C6MFCKYX-BvX0CZ86.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-JRKCKAG2-bJF_JL96.js → DockLayout-VY7OZ55R-BoHuHGZ4.js} +1 -1
- package/dist/_frontend/assets/{DrawerLayout-U7YPUZBR-EBVDvExP.js → DrawerLayout-B2UA3CZO-Bnc8xIc0.js} +2 -2
- package/dist/_frontend/assets/DrawerLayout-B2UA3CZO-Bnc8xIc0.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-B2UA3CZO-Bnc8xIc0.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-3YAHICJ3-CYXhuUMp.js +1 -0
- package/dist/_frontend/assets/ModelSettings-3YAHICJ3-CYXhuUMp.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-3YAHICJ3-CYXhuUMp.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-ALR6F5KU-BhpQsOwg.js +1 -0
- package/dist/_frontend/assets/SandboxSettings-ALR6F5KU-BhpQsOwg.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-ALR6F5KU-BhpQsOwg.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-TIS3BH67-CoDDvRbI.js +1 -0
- package/dist/_frontend/assets/SchedulesPage-TIS3BH67-CoDDvRbI.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-TIS3BH67-CoDDvRbI.js.gz +0 -0
- package/dist/_frontend/assets/{SettingsBuilder-6FJVZLJT-Drq1vNUK.js → SettingsBuilder-G5CP5X6Q-XQVNLXzw.js} +2 -2
- package/dist/_frontend/assets/SettingsBuilder-G5CP5X6Q-XQVNLXzw.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-G5CP5X6Q-XQVNLXzw.js.gz +0 -0
- package/dist/_frontend/assets/{ShellRouteSync-SJXFKUAJ-Yi-uh3fh.js → ShellRouteSync-G7IJ5VIW-BoBswHkA.js} +1 -1
- package/dist/_frontend/assets/ShellRouteSync-G7IJ5VIW-BoBswHkA.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-G7IJ5VIW-BoBswHkA.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-FKRLGEDB-CqSBeNMU.js +2 -0
- package/dist/_frontend/assets/SidebarLayout-FKRLGEDB-CqSBeNMU.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-FKRLGEDB-CqSBeNMU.js.gz +0 -0
- package/dist/_frontend/assets/{SkillSettings-IHVI7FDM-DEkrBUBp.js → SkillSettings-E5SJ4U3T-hOs4000P.js} +1 -1
- package/dist/_frontend/assets/SkillSettings-E5SJ4U3T-hOs4000P.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-E5SJ4U3T-hOs4000P.js.gz +0 -0
- package/dist/_frontend/assets/TrueForgeUIWithRouter-WD7O3TWR-rfYDejkx.js +1 -0
- package/dist/_frontend/assets/{WidgetLayout-PN5ZDOLM-CcGUI6sr.js → WidgetLayout-KQZTQNE7-CLurTXc-.js} +1 -1
- package/dist/_frontend/assets/WidgetLayout-KQZTQNE7-CLurTXc-.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-KQZTQNE7-CLurTXc-.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-62JRHF6Z-BrctyCH-.js → chunk-62JRHF6Z-DVHPxtc3.js} +1 -1
- package/dist/_frontend/assets/chunk-62JRHF6Z-DVHPxtc3.js.br +0 -0
- package/dist/_frontend/assets/chunk-62JRHF6Z-DVHPxtc3.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-2QTH6JHX-DrgkYdZs.js → chunk-B76JC5B2-BMXX-7i9.js} +1 -1
- package/dist/_frontend/assets/chunk-B76JC5B2-BMXX-7i9.js.br +0 -0
- package/dist/_frontend/assets/chunk-B76JC5B2-BMXX-7i9.js.gz +0 -0
- package/dist/_frontend/assets/chunk-G7BT4OKG-D-wOOnsv.js +1 -0
- package/dist/_frontend/assets/chunk-G7BT4OKG-D-wOOnsv.js.br +0 -0
- package/dist/_frontend/assets/chunk-G7BT4OKG-D-wOOnsv.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-2UBSLCKB-Bq4rnsqJ.js → chunk-IGYCJIU7-COFxTXYC.js} +2 -2
- package/dist/_frontend/assets/chunk-IGYCJIU7-COFxTXYC.js.br +0 -0
- package/dist/_frontend/assets/chunk-IGYCJIU7-COFxTXYC.js.gz +0 -0
- package/dist/_frontend/assets/{cssMode-jP6sLsrL.js → cssMode-BMGYEB3M.js} +1 -1
- package/dist/_frontend/assets/cssMode-BMGYEB3M.js.br +0 -0
- package/dist/_frontend/assets/cssMode-BMGYEB3M.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-Dbeghe9Y.js → freemarker2-By56tpWC.js} +1 -1
- package/dist/_frontend/assets/freemarker2-By56tpWC.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-By56tpWC.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-DTmlyeUV.js → handlebars-cEjR9Fs2.js} +1 -1
- package/dist/_frontend/assets/handlebars-cEjR9Fs2.js.br +0 -0
- package/dist/_frontend/assets/handlebars-cEjR9Fs2.js.gz +0 -0
- package/dist/_frontend/assets/{html-CjOPMUvl.js → html-tYW1suOW.js} +1 -1
- package/dist/_frontend/assets/html-tYW1suOW.js.br +0 -0
- package/dist/_frontend/assets/html-tYW1suOW.js.gz +0 -0
- package/dist/_frontend/assets/{htmlMode-lgosNfbL.js → htmlMode-D8PP1KzI.js} +1 -1
- package/dist/_frontend/assets/htmlMode-D8PP1KzI.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-D8PP1KzI.js.gz +0 -0
- package/dist/_frontend/assets/{index-Du3lx1aS.js → index-BS4907Xx.js} +3 -3
- package/dist/_frontend/assets/index-BS4907Xx.js.br +0 -0
- package/dist/_frontend/assets/index-BS4907Xx.js.gz +0 -0
- package/dist/_frontend/assets/{index-CF_3sCub.js → index-DUFuoecn.js} +1 -1
- package/dist/_frontend/assets/index-DUFuoecn.js.br +0 -0
- package/dist/_frontend/assets/{index-CF_3sCub.js.gz → index-DUFuoecn.js.gz} +0 -0
- package/dist/_frontend/assets/index-G7kdtXvB.js +943 -0
- package/dist/_frontend/assets/index-G7kdtXvB.js.br +0 -0
- package/dist/_frontend/assets/index-G7kdtXvB.js.gz +0 -0
- package/dist/_frontend/assets/{javascript-DiHw3Eat.js → javascript-osiUQvXx.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-DHUA2y1U.js → jsonMode-CdMHir1V.js} +1 -1
- package/dist/_frontend/assets/jsonMode-CdMHir1V.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-CdMHir1V.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-CprftmsS.js → liquid-DXwQHd5_.js} +1 -1
- package/dist/_frontend/assets/liquid-DXwQHd5_.js.br +0 -0
- package/dist/_frontend/assets/liquid-DXwQHd5_.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-gYxt31s1.js → lspLanguageFeatures-CEI6BsAF.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-CEI6BsAF.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-CEI6BsAF.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-h6Mzhp-3.js → mdx-9AQsIt7X.js} +1 -1
- package/dist/_frontend/assets/mdx-9AQsIt7X.js.br +0 -0
- package/dist/_frontend/assets/mdx-9AQsIt7X.js.gz +0 -0
- package/dist/_frontend/assets/{python-Fgw1BN-I.js → python-OXQa8Ri9.js} +1 -1
- package/dist/_frontend/assets/python-OXQa8Ri9.js.br +0 -0
- package/dist/_frontend/assets/python-OXQa8Ri9.js.gz +0 -0
- package/dist/_frontend/assets/{razor-u10uqgtH.js → razor-BU90Q8Je.js} +1 -1
- package/dist/_frontend/assets/razor-BU90Q8Je.js.br +0 -0
- package/dist/_frontend/assets/razor-BU90Q8Je.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-DQQ14WKr.js → tsMode-B3c5Otu4.js} +1 -1
- package/dist/_frontend/assets/tsMode-B3c5Otu4.js.br +0 -0
- package/dist/_frontend/assets/tsMode-B3c5Otu4.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-mwUa5zn0.js → typescript-CtOR5Qmc.js} +1 -1
- package/dist/_frontend/assets/typescript-CtOR5Qmc.js.br +0 -0
- package/dist/_frontend/assets/typescript-CtOR5Qmc.js.gz +0 -0
- package/dist/_frontend/assets/{workers-CZKhoZKF.js → workers-Dx3N8uH5.js} +1 -1
- package/dist/_frontend/assets/workers-Dx3N8uH5.js.br +3 -0
- package/dist/_frontend/assets/workers-Dx3N8uH5.js.gz +0 -0
- package/dist/_frontend/assets/{xml-CZ3_PIeb.js → xml-DW3BhbEz.js} +1 -1
- package/dist/_frontend/assets/xml-DW3BhbEz.js.br +0 -0
- package/dist/_frontend/assets/xml-DW3BhbEz.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-DBARGNE3.js → yaml-BZ76X4yO.js} +1 -1
- package/dist/_frontend/assets/yaml-BZ76X4yO.js.br +0 -0
- package/dist/_frontend/assets/yaml-BZ76X4yO.js.gz +0 -0
- package/dist/_frontend/index.html +1 -1
- package/dist/controller-main.js +199 -75
- package/dist/controller-main.js.map +1 -1
- package/dist/main.js +1483 -784
- package/dist/main.js.map +1 -1
- package/dist/postgres/migrations/20260727_000001_init.js +572 -4
- package/dist/postgres/migrations/20260727_000001_init.js.map +1 -1
- package/dist/postgres/migrations/20260916_000001_agent_web_search.js +28 -0
- package/dist/postgres/migrations/20260916_000001_agent_web_search.js.map +1 -0
- package/dist/postgres/migrations/20260918_000001_turn_active_executor_id.js +32 -0
- package/dist/postgres/migrations/20260918_000001_turn_active_executor_id.js.map +1 -0
- package/dist/sqlite/migrations/20260916_000001_agent_web_search.js +28 -0
- package/dist/sqlite/migrations/20260916_000001_agent_web_search.js.map +1 -0
- package/dist/sqlite/migrations/20260918_000001_turn_active_executor_id.js +33 -0
- package/dist/sqlite/migrations/20260918_000001_turn_active_executor_id.js.map +1 -0
- package/package.json +5 -4
- package/dist/_frontend/assets/AgentCodeSnippets-T7PR6PDP-BtYr0hCd.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-T7PR6PDP-BtYr0hCd.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-J3RCSCAG-BeGf38SC.js +0 -1
- package/dist/_frontend/assets/AgentMetricChart-J3RCSCAG-BeGf38SC.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-J3RCSCAG-BeGf38SC.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-WC7WMNMS-Mem5rK6Y.js +0 -1
- package/dist/_frontend/assets/AgentOverview-WC7WMNMS-Mem5rK6Y.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-WC7WMNMS-Mem5rK6Y.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-SETKGGCI-T0eprzt1.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-SETKGGCI-T0eprzt1.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-4Y7PY5SJ-Bp3PJ8em.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-4Y7PY5SJ-Bp3PJ8em.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-YCAPM5GK-BA8KqWPB.js +0 -1
- package/dist/_frontend/assets/AgentSessions-YCAPM5GK-BA8KqWPB.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-YCAPM5GK-BA8KqWPB.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-PXWRCFAL-Dgi-SPKS.js +0 -1
- package/dist/_frontend/assets/ConnectorSettings-PXWRCFAL-Dgi-SPKS.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-PXWRCFAL-Dgi-SPKS.js.gz +0 -0
- package/dist/_frontend/assets/DrawerLayout-U7YPUZBR-EBVDvExP.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-U7YPUZBR-EBVDvExP.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-VXYMJEMO-YOyVspML.js +0 -1
- package/dist/_frontend/assets/ModelSettings-VXYMJEMO-YOyVspML.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-VXYMJEMO-YOyVspML.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-6DRUH72J-B_nMtkgp.js +0 -1
- package/dist/_frontend/assets/SandboxSettings-6DRUH72J-B_nMtkgp.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-6DRUH72J-B_nMtkgp.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-2G6F4XO6-CXGVFkK8.js +0 -1
- package/dist/_frontend/assets/SchedulesPage-2G6F4XO6-CXGVFkK8.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-2G6F4XO6-CXGVFkK8.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-6FJVZLJT-Drq1vNUK.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-6FJVZLJT-Drq1vNUK.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-SJXFKUAJ-Yi-uh3fh.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-SJXFKUAJ-Yi-uh3fh.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-EQ7EYCWR-D-Rd9Wui.js +0 -2
- package/dist/_frontend/assets/SidebarLayout-EQ7EYCWR-D-Rd9Wui.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-EQ7EYCWR-D-Rd9Wui.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-IHVI7FDM-DEkrBUBp.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-IHVI7FDM-DEkrBUBp.js.gz +0 -0
- package/dist/_frontend/assets/TrueForgeUIWithRouter-5OJFI3PF-BXv2aJab.js +0 -1
- package/dist/_frontend/assets/WidgetLayout-PN5ZDOLM-CcGUI6sr.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-PN5ZDOLM-CcGUI6sr.js.gz +0 -0
- package/dist/_frontend/assets/chunk-2QTH6JHX-DrgkYdZs.js.br +0 -0
- package/dist/_frontend/assets/chunk-2QTH6JHX-DrgkYdZs.js.gz +0 -0
- package/dist/_frontend/assets/chunk-2UBSLCKB-Bq4rnsqJ.js.br +0 -0
- package/dist/_frontend/assets/chunk-2UBSLCKB-Bq4rnsqJ.js.gz +0 -0
- package/dist/_frontend/assets/chunk-62JRHF6Z-BrctyCH-.js.br +0 -0
- package/dist/_frontend/assets/chunk-62JRHF6Z-BrctyCH-.js.gz +0 -0
- package/dist/_frontend/assets/chunk-PX6MNNN3-DWHQBAi-.js +0 -1
- package/dist/_frontend/assets/chunk-PX6MNNN3-DWHQBAi-.js.br +0 -0
- package/dist/_frontend/assets/chunk-PX6MNNN3-DWHQBAi-.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-jP6sLsrL.js.br +0 -0
- package/dist/_frontend/assets/cssMode-jP6sLsrL.js.gz +0 -0
- package/dist/_frontend/assets/freemarker2-Dbeghe9Y.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-Dbeghe9Y.js.gz +0 -0
- package/dist/_frontend/assets/handlebars-DTmlyeUV.js.br +0 -0
- package/dist/_frontend/assets/handlebars-DTmlyeUV.js.gz +0 -0
- package/dist/_frontend/assets/html-CjOPMUvl.js.br +0 -0
- package/dist/_frontend/assets/html-CjOPMUvl.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-lgosNfbL.js.br +0 -10
- package/dist/_frontend/assets/htmlMode-lgosNfbL.js.gz +0 -0
- package/dist/_frontend/assets/index-CF_3sCub.js.br +0 -0
- package/dist/_frontend/assets/index-DVIyIfJR.js +0 -933
- package/dist/_frontend/assets/index-DVIyIfJR.js.br +0 -0
- package/dist/_frontend/assets/index-DVIyIfJR.js.gz +0 -0
- package/dist/_frontend/assets/index-Du3lx1aS.js.br +0 -0
- package/dist/_frontend/assets/index-Du3lx1aS.js.gz +0 -0
- package/dist/_frontend/assets/jsonMode-DHUA2y1U.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-DHUA2y1U.js.gz +0 -0
- package/dist/_frontend/assets/liquid-CprftmsS.js.br +0 -0
- package/dist/_frontend/assets/liquid-CprftmsS.js.gz +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-gYxt31s1.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-gYxt31s1.js.gz +0 -0
- package/dist/_frontend/assets/mdx-h6Mzhp-3.js.br +0 -0
- package/dist/_frontend/assets/mdx-h6Mzhp-3.js.gz +0 -0
- package/dist/_frontend/assets/python-Fgw1BN-I.js.br +0 -0
- package/dist/_frontend/assets/python-Fgw1BN-I.js.gz +0 -0
- package/dist/_frontend/assets/razor-u10uqgtH.js.br +0 -0
- package/dist/_frontend/assets/razor-u10uqgtH.js.gz +0 -0
- package/dist/_frontend/assets/tsMode-DQQ14WKr.js.br +0 -0
- package/dist/_frontend/assets/tsMode-DQQ14WKr.js.gz +0 -0
- package/dist/_frontend/assets/typescript-mwUa5zn0.js.br +0 -0
- package/dist/_frontend/assets/typescript-mwUa5zn0.js.gz +0 -0
- package/dist/_frontend/assets/workers-CZKhoZKF.js.br +0 -0
- package/dist/_frontend/assets/workers-CZKhoZKF.js.gz +0 -0
- package/dist/_frontend/assets/xml-CZ3_PIeb.js.br +0 -0
- package/dist/_frontend/assets/xml-CZ3_PIeb.js.gz +0 -0
- package/dist/_frontend/assets/yaml-DBARGNE3.js.br +0 -0
- package/dist/_frontend/assets/yaml-DBARGNE3.js.gz +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aL as be,D as fe,r as l,aM as Y,j as e,H as ge,K as B,I as L,aN as ie,aO as xe,aP as ye,aQ as ve,e as T,aR as je,ah as Ne}from"./index-DVIyIfJR.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:z=!1,error:F})=>{const[M,$]=l.useState(""),[y,x]=l.useState(""),[w,I]=l.useState(!1),U=()=>{$(""),x(""),I(!1)};l.useEffect(()=>{n&&($(""),x(E),I(!1))},[n,E]);const X=i=>{i||U(),o(i)},P=M.trim(),G=!c||!!P,v=async i=>{if(i.preventDefault(),!(!G||z))try{await b({apiKey:P,baseUrl:y.trim()}),U(),o(!1)}catch{}};return e.jsx(xe,{open:n,onOpenChange:X,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.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)=>I(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:T("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:!G||z,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()],Q="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,z]=l.useState((c==null?void 0:c.name)??""),[F,M]=l.useState((c==null?void 0:c.baseUrl)??""),[$,y]=l.useState(""),[x,w]=l.useState(()=>ue(c)),[I,U]=l.useState(!1),[X,P]=l.useState(!1),G=()=>{z((c==null?void 0:c.name)??""),M((c==null?void 0:c.baseUrl)??""),y(""),w(ue(c)),U(!1),P(!1)},v=s=>{s||G(),o(s)},i=(s,r)=>{w(g=>g.map((u,j)=>j===s?{...u,...r}:u))},K=()=>{U(!0),P(!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 W=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,Z=s=>ce(s.maxOutputTokens)==null?"Set the max output tokens.":null,le=!D&&!h&&x.every(s=>!W(s)&&!te(s)),se=I&&D,H=X&&h,R=async()=>{if(K(),!le||p)return;const s=x.findIndex(r=>q(r)||Z(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:$.trim(),models:x.map(r=>{var A;const g={};(A=r.reasoningEfforts)!=null&&A.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(),R()},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=>z(s.target.value),onBlur:()=>U(!0),placeholder:"local-llama",autoFocus:!d,readOnly:d,"aria-readonly":d,"aria-invalid":se?!0:void 0,className:T(Q,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:()=>P(!0),placeholder:"http://localhost:11434/v1",autoFocus:d,"aria-invalid":H?!0:void 0,className:T(Q,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:$,onChange:s=>y(s.target.value),placeholder:"sk-…",className:Q}),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=W(s),u=s.idTouched&&g,j=te(s),A=!!j&&s.nameDirty,oe=q(s),C=Z(s),O=s.contextTouched&&oe,ae=s.maxTouched&&C;return e.jsxs("div",{className:T("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:T(Q,"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":A?!0:void 0,className:T(Q,A&&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,A?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:T("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":O?!0:void 0,className:T(Q,O&&V)}),O?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:T(Q,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:T("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 J;return i(r,{reasoningEfforts:a?(J=s.reasoningEfforts)==null?void 0:J.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 Pe(n){return"baseUrl"in n&&typeof n.baseUrl=="string"?n.baseUrl:""}var Te=()=>{const{modelCatalog:n}=be(),o=fe(),[b,k]=l.useState(""),[p,E]=l.useState([]),[d,c]=l.useState([]),[S,z]=l.useState(!0),[F,M]=l.useState(null),[$,y]=l.useState(null),[x,w]=l.useState(!1),[I,U]=l.useState(null),[X,P]=l.useState(null),[G,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(),W=l.useCallback(async()=>{z(!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{z(!1)}},[n]);l.useEffect(()=>{W()},[W]);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]),Z=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),P(null),v(null)},R=async(t,a)=>{w(!0),M(null);try{await t(),await W(),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 R(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 R(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&&R(async()=>{await n.deleteModelProvider({id:t.id})}).catch(()=>{})},u=(t,a)=>{R(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 R(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)},A=async t=>{if(!f)return;const a=f;y(null),await R(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=I!=null?p.find(t=>t.id===I)??null:null,O=X!=null?d.find(t=>t.type===X)??null:null,ae=C!=null||O!=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)),J=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),P(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)),J.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 · ",J.length]}),J.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&&Z.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:Z.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),P(t.type)},children:[e.jsx(L,{name:"wrench",className:"size-4"}),"Configure"]})]})},t.type)})})]}):null,!S&&q.length===0&&Z.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(O)return s(O,t)},title:C?"Edit Provider Details":"Configure Provider Details",initialBaseUrl:C?C.baseUrl??"":O?Pe(O):"",requireApiKey:C==null,submitLabel:C?"Save":"Create",busy:x,error:G}),e.jsx(Ue,{open:i,onOpenChange:t=>{K(t),t||(y(null),D(null))},isEditMode:f!==null,initialValues:oe,onSubmit:f?A:j,reasoningEffortOptions:le,busy:x,error:$},(f==null?void 0:f.id)??"add-custom-provider")]})})]})},Oe=Te;export{Oe as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aL as V,D as H,r,aM as B,j as e,S as Q,I as N,ac as Y,K as R,aO as J,aP as W,aQ as X,e as Z,aR as ee,ah as te}from"./index-DVIyIfJR.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:D=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=D??se;k(String(a.execTimeoutMs)),x(String(a.autoStopIntervalInMinutes)),i(String(a.autoArchiveIntervalInMinutes)),o(String(a.autoDeleteIntervalInMinutes)),f(""),v(!1)},[s,D]);const $=a=>{a||S(),l(a)},h=U(m),A=U(u),T=U(M),z=U(p),_=b.trim(),K=(!y||!!_)&&h!=null&&A!=null&&T!=null&&z!=null,E=async a=>{if(a.preventDefault(),!(!K||w||h==null||A==null||T==null||z==null))try{await d({execTimeoutMs:h,autoStopIntervalInMinutes:A,autoArchiveIntervalInMinutes:T,autoDeleteIntervalInMinutes:z,apiKey:_}),S(),l(!1)}catch{}};return e.jsx(J,{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:E,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(R.Primary,{type:"submit",size:"large",disabled:!K||w,className:"w-full shrink-0",children:"Save"})]})]})})},ne=ae,re=1e4,O=({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}=V(),l=H(),[d,g]=r.useState([]),[I,D]=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),D(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?O(o):i?O(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,...O(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,...O(t),...t.apiKey?{apiKey:t.apiKey}:{}})},u),b(null),setTimeout(()=>{l==null||l.showSuccess({title:`${o.name} updated`})},0))},z=t=>{h(async()=>{await s.updateSandboxProvider({id:t.id,...O(t)})}).catch(()=>{})},_=t=>{const n=s.deleteSandboxProvider;n&&h(async()=>{await n({id:t.id})}).catch(()=>{})},K=i!=null||o!=null,E=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(Q,{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(R.Ghost,{size:"small",type:"button",disabled:x,onClick:()=>{z(n)},children:"Retry"}):null,e.jsx(R.Secondary,{size:"small",type:"button",disabled:x,onClick:()=>{u(null),p(null),b(n)},children:"Update"}),s.deleteSandboxProvider?e.jsx(R.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(R.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:E?T:A,title:a,description:E?"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:!E,busy:x,error:k})]})},de=ie;export{de as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as ge,B as Le,D as be,r as l,E as xe,F as Se,y as pe,G as Ke,j as e,P as Qe,H as We,J as ce,q as ue,K as H,I as A,L as Ye,M as ke,N as Te,O as Ze,Q as Je,R as Ce,U as J,V as Xe,W as X,X as et,Y as tt,Z as st,$ as nt,a0 as at,a1 as rt,a2 as lt,a3 as it,a4 as ot,e as $,a5 as Ee,a6 as ct,a7 as dt,a8 as ut,c as mt,a9 as xt,aa as me,d as ht,ab as ft,ac as gt,a as bt,ad as pt,ae as Nt,af as yt,ag as jt,ah as ze,i as vt,ai as wt}from"./index-DVIyIfJR.js";function Fe({value:t,selectedLabel:s,onValueChange:i,onAgentPicked:a,disabled:r=!1,onBuildAgent:d,allOption:b,"aria-label":y="Agent",placeholder:m="Search agent",className:f}){const[u,p]=l.useState(!1),[j,o]=l.useState(""),[w,E]=l.useState(null),g=l.useRef(null),k=l.useRef(null),C=l.useRef(null),z=l.useRef(null),q=l.useId(),{agents:R,isInitialLoading:F,isSearching:v,loadingMore:Q,hasMore:B,error:D,listRef:I,sentinelRef:G}=it({enabled:u&&!r,query:j});l.useEffect(()=>{u||o("")},[u]),l.useLayoutEffect(()=>{if(!u){E(null);return}const h=()=>{const c=k.current;if(!c)return;const N=c.getBoundingClientRect();E({top:N.bottom+4,left:N.left,width:N.width})};return h(),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[u]),l.useEffect(()=>{if(!u)return;const h=c=>{var N,S;c.target instanceof Node&&((N=g.current)!=null&&N.contains(c.target)||(S=z.current)!=null&&S.contains(c.target)||p(!1))};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[u]);const O=()=>{var h;p(!1),o(""),(h=C.current)==null||h.blur()},_=h=>{const c=ue(h);i(c),a==null||a(h),O()},W=()=>{b!=null&&(i(b.value),O())},P=u?j:s,U=j.trim(),V=!F&&D!=null,L=!F&&D==null&&R.length===0&&U==="",K=!F&&D==null&&R.length===0&&U!=="",ee=u&&w!=null&&!r?ot.createPortal(e.jsxs("div",{ref:z,className:ct("fixed z-[200] flex max-h-64 flex-col overflow-hidden"),style:{top:w.top,left:w.left,width:w.width},onMouseDown:h=>h.stopPropagation(),children:[e.jsxs("div",{ref:I,id:q,role:"listbox","aria-label":y,className:"min-h-0 flex-1 overflow-y-auto p-1",children:[b!=null&&U===""?e.jsxs("button",{type:"button",role:"option","aria-selected":t===b.value,className:Ee(),onClick:W,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:b.label}),e.jsx(A,{name:"check",className:$("ml-auto size-4 shrink-0",t===b.value?"opacity-100":"opacity-0")})]}):null,F?e.jsx("p",{className:"text-text-secondary px-3 py-5 text-center text-sm",role:"status",children:"Loading…"}):V?e.jsx("p",{className:"text-failure-bg px-3 py-5 text-center text-sm",role:"alert",children:D}):L?e.jsx("p",{className:"text-text-secondary px-3 py-5 text-center text-sm",children:"No Agents created yet"}):K?e.jsxs("p",{className:"text-text-secondary px-3 py-5 text-center text-sm",role:"status",children:['No agents match "',U,'".']}):e.jsxs(e.Fragment,{children:[v?e.jsx("p",{className:"sr-only",role:"status",children:"Searching…"}):null,R.map(h=>{const c=ue(h),N=t===c;return e.jsxs("button",{type:"button",role:"option","aria-selected":N,className:Ee(),onClick:()=>_(h),children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:h.name}),e.jsx(A,{name:"check",className:$("ml-auto size-4 shrink-0",N?"opacity-100":"opacity-0")})]},c)}),B?e.jsx("div",{ref:G,className:"flex h-6 shrink-0 items-center justify-center","aria-hidden":!0,children:Q?e.jsx("span",{className:"text-text-secondary text-[11px]",role:"status",children:"Loading more…"}):null}):null]})]}),L&&d!=null?e.jsx("div",{className:"flex justify-end border-t border-border px-2 pt-2",children:e.jsxs(H.Ghost,{type:"button",onClick:d,children:[e.jsx(A,{name:"plus",className:"size-3.5"}),"Build Agent"]})}):null]}),dt(g.current)):null;return e.jsxs("div",{ref:g,className:$("relative",f),children:[e.jsxs("div",{ref:k,className:ut(r?"cursor-not-allowed opacity-50":"cursor-text"),children:[e.jsx("input",{ref:C,type:"text",role:"combobox","aria-label":y,"aria-expanded":u,"aria-controls":u?q:void 0,"aria-autocomplete":"list",disabled:r,placeholder:m,value:P,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-text-secondary/70 disabled:cursor-not-allowed",onFocus:()=>{r||p(!0)},onChange:h=>{r||(o(h.target.value),p(!0))},onKeyDown:h=>{var c;if(h.key==="Escape"){h.preventDefault(),p(!1),(c=C.current)==null||c.blur();return}h.key==="ArrowDown"&&!u&&!r&&(h.preventDefault(),p(!0))}}),e.jsx(A,{name:"chevron-down",className:"size-4 shrink-0 text-text-secondary"})]}),ee]})}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 Ie(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function St(t){const s=Ie(),i=new Set(Ae.map(r=>r.value));return[...[s,t].flatMap(r=>r==null||r.length===0||i.has(r)?[]:(i.add(r),[{value:r,label:r===s?`${r} (Local)`:r}])),...Ae]}var Me=[{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"}],kt={"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 de(){return{name:"",task:"",recurrence:"daily",hour:9,minute:0,weekdays:[1],customCron:"0 9 * * *",timezone:Ie()}}function Tt(t){return kt[t]??t.split("/").pop()??t}function $e(t){return t.toString().padStart(2,"0")}function le({hour:t,minute:s}){const i=t>=12?"PM":"AM",a=t%12===0?12:t%12;return`${String(a)}:${$e(s)} ${i}`}function he(t){const s=t.minute,i=t.hour;switch(t.recurrence){case"hourly":return`${String(s)} * * * *`;case"daily":return`${String(s)} ${String(i)} * * *`;case"weekly":{const a=[...t.weekdays].sort((d,b)=>d-b),r=a.length>0?a.join(","):"*";return`${String(s)} ${String(i)} * * ${r}`}case"custom":return t.customCron.trim()}}function ae(t){const s=Tt(t.timezone),i=t.cron.trim().split(/\s+/);if(i.length!==5)return t.cron;const[a,r,d,b,y]=i;if(d!=="*"||b!=="*")return t.cron;const m=Number(a),f=Number(r);if(r==="*"&&y==="*"&&a!==void 0&&!Number.isNaN(m))return`Hourly at :${$e(m)} ${s}`;if(y==="*"&&r!==void 0&&a!==void 0&&!Number.isNaN(f)&&!Number.isNaN(m))return`Daily ${le({hour:f,minute:m})} ${s}`;if(y==="1-5"&&r!==void 0&&a!==void 0&&!Number.isNaN(f)&&!Number.isNaN(m))return`Weekdays ${le({hour:f,minute:m})} ${s}`;if(y!=null&&/^\d(?:,\d)*$/.test(y)&&r!==void 0&&a!==void 0&&!Number.isNaN(f)&&!Number.isNaN(m)){const u=y.split(",").map(p=>{var j;return((j=Me.find(o=>o.value===Number(p)))==null?void 0:j.label)??p});return u.length===1?`Every ${u[0]==="Mon"?"Monday":u[0]} ${le({hour:f,minute:m})} ${s}`:`${u.join(", ")} ${le({hour:f,minute:m})} ${s}`}return t.cron}function Re(t){const s=de(),i=t.cron.trim().split(/\s+/);if(i.length!==5)return{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron};const[a,r,d,b,y]=i,m=Number(a),f=Number(r);return d!=="*"||b!=="*"?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron}:r==="*"&&y==="*"&&!Number.isNaN(m)?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"hourly",minute:m,customCron:t.cron}:y==="*"&&!Number.isNaN(f)&&!Number.isNaN(m)?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"daily",hour:f,minute:m,customCron:t.cron}:y!=null&&/^\d(?:,\d)*$/.test(y)&&!Number.isNaN(f)&&!Number.isNaN(m)?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"weekly",hour:f,minute:m,weekdays:y.split(",").map(Number),customCron:t.cron}:{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron,hour:Number.isNaN(f)?s.hour:f,minute:Number.isNaN(m)?s.minute:m}}function Ct(t,s=Date.now()){if(t==null)return"Never";const i=Date.parse(t);if(Number.isNaN(i))return"Never";const a=Math.round((s-i)/1e3);if(a<60)return"just now";const r=Math.round(a/60);if(r<60)return`${String(r)} min ago`;const d=Math.round(r/60);if(d<48)return`${String(d)} hour${d===1?"":"s"} ago`;const b=Math.round(d/24);return`${String(b)} day${b===1?"":"s"} ago`}var Et=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"}],zt=Array.from({length:24},(t,s)=>({value:String(s),label:s.toString().padStart(2,"0")})),At=[0,15,30,45].map(t=>({value:String(t),label:`:${t.toString().padStart(2,"0")}`}));function Rt({values:t,onChange:s,agentId:i,agentLabel:a,onAgentIdChange:r,onAgentPicked:d,agentPickerDisabled:b=!1,onBuildAgent:y}){const m=he(t),f=ae({cron:m,timezone:t.timezone}),u=St(t.timezone),p=(o,w)=>{s({...t,[o]:w})},j=o=>{const E=t.weekdays.includes(o)?t.weekdays.filter(g=>g!==o):[...t.weekdays,o];s({...t,weekdays:E.length>0?E:[o]})};return e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Agent"}),e.jsx(Fe,{"aria-label":"Agent",placeholder:"Search agent",value:i,selectedLabel:a,onValueChange:o=>r==null?void 0:r(o),onAgentPicked:d,disabled:b||r==null,onBuildAgent:y})]}),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:o=>p("name",o.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:o=>p("task",o.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:Et.map(o=>{const w=t.recurrence===o.value;return e.jsx("button",{type:"button",className:$("rounded-md border px-2 py-2 text-sm font-medium transition-colors",w?"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":w,onClick:()=>p("recurrence",o.value),children:o.label},o.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:Me.map(o=>{const w=t.weekdays.includes(o.value);return e.jsx("button",{type:"button",className:$("min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium",w?"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":w,onClick:()=>j(o.value),children:o.label},o.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(ce,{"aria-label":"Hour",value:String(t.hour),options:zt,onValueChange:o=>p("hour",Number(o))})]}):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(ce,{"aria-label":"Minute",value:String(t.minute),options:At,onValueChange:o=>p("minute",Number(o))})]}):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(ce,{"aria-label":"Timezone",value:t.timezone,options:u,onValueChange:o=>p("timezone",o),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(A,{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:f||"—"}),e.jsx("code",{className:"shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary",children:m||"—"})]})})]})]})}function Dt(t){return t.startsWith("manual-")}function Pt(t){return t==="failed"?"failed":"success"}function Be(t){return t==="failed"?"Failed":t==="triggered"?"Triggered":"Scheduled"}function Oe(t){return Dt(t)?"Manual test":"Cron"}function Lt(t,s=5){return t.filter(a=>a.status!=="scheduled").slice(0,s).reverse()}function fe(t){if(t==null)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?"—":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0}).format(s)}function Ft({run:t}){return e.jsxs("div",{className:"flex flex-col gap-1 text-left text-xs",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Be(t.status)}),e.jsx("p",{className:"text-text-secondary",children:Oe(t.name)}),e.jsxs("p",{className:"text-text-secondary",children:["Scheduled for: ",fe(t.scheduledFor)]}),t.triggeredAt!=null?e.jsxs("p",{className:"text-text-secondary",children:["Triggered at: ",fe(t.triggeredAt)]}):null,e.jsxs("p",{className:"text-text-secondary",children:["Triggered by: ",t.triggeredBy]})]})}var It={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 _e({run:t}){const s=Pt(t.status),i=fe(t.triggeredAt??t.scheduledFor);return e.jsx(gt,{content:e.jsx(Ft,{run:t}),side:"top",children:e.jsx("span",{className:$("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",It[s]),"aria-label":`${Be(t.status)} run at ${i}`,children:e.jsx(A,{name:s==="failed"?"triangle-exclamation":"check",className:"size-3.5"})})})}function Ue({status:t}){const s=t==="active";return e.jsxs("span",{className:$("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium",s?"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:$("size-1.5 shrink-0 rounded-full",s?"bg-emerald-600 dark:bg-emerald-400":"bg-amber-600 dark:bg-amber-400"),"aria-hidden":!0}),s?"Active":"Paused"]})}function Mt(t,s){return t.find(i=>i.name===s||i.id===s)??null}function $t({connector:t,onConnected:s}){return vt()==null?null:e.jsx(wt,{connector:t,onConnected:s})}function ne({label:t,children:s}){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:s})]})}function Bt({schedule:t,agentName:s,mcpMounts:i,onEditConfiguration:a}){const r=ge(),d=be(),{connectors:b,ensureLoaded:y,refreshConnectors:m,loading:f,error:u}=jt(),[p,j]=l.useState(!1),[o,w]=l.useState(null),E=ae({cron:t.cron,timezone:t.timezone}),g=async()=>{j(!0);try{const k=await r.createScheduleRun({scheduleId:t.id});w(k),d==null||d.showSuccess({title:"Test run started"})}catch(k){d==null||d.showError(k)}finally{j(!1)}};return l.useEffect(()=>{y()},[y]),l.useEffect(()=>{u!=null&&(d==null||d.showError(u))},[u,d]),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(ne,{label:"Agent",children:s}),e.jsx(ne,{label:"Name",children:t.name}),e.jsx(ne,{label:"Status",children:e.jsx(Ue,{status:t.status})}),e.jsx(ne,{label:"Task",children:e.jsx("span",{className:"whitespace-pre-wrap break-words",children:t.task})}),e.jsx(ne,{label:"Frequency",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[e.jsx("span",{children:E}),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(H.Secondary,{type:"button",size:"small",onClick:a,children:[e.jsx(A,{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"})}),i.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:i.map(k=>{const C=Mt(b,k.name),z=(C==null?void 0:C.authenticated)===!0,q=C==null&&!f;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:$("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",z?"border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"border-border text-transparent"),"aria-hidden":!0,children:z?e.jsx(A,{name:"check",className:"size-3"}):null}),e.jsx("span",{className:"text-text-primary min-w-0 flex-1 truncate text-sm",children:k.name}),z?e.jsx("span",{className:"text-success-bg text-xs font-medium",children:"Connected"}):q?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):C!=null&&C.authenticated===!1?e.jsx($t,{connector:C,onConnected:m}):f?e.jsx("span",{className:"text-text-secondary text-xs",children:"Loading…"}):null]},k.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(H.Primary,{type:"button",disabled:p,size:"small",onClick:()=>void g(),children:[e.jsx(A,{name:p?"loader":"play",className:$("size-3.5",p&&"animate-spin")}),"Run Test"]})]}),o==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(_e,{run:o}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Oe(o.name)}),e.jsx("p",{className:"text-text-secondary",children:Ct(o.triggeredAt??o.scheduledFor)})]})]})]})]})}function Ot({open:t,onOpenChange:s,mode:i,schedule:a,initialAgentId:r="",onSaved:d}){const b=ge(),y=Le(),m=bt(),f=be(),[u,p]=l.useState(de),[j,o]=l.useState(r),[w,E]=l.useState(null),[g,k]=l.useState({kind:"form"}),[C,z]=l.useState(!1),[q,R]=l.useState(!1),[F,v]=l.useState(null),Q=l.useRef(j);Q.current=j;const B=g.kind==="form"?g.saved:g.schedule,D=i==="edit"&&g.kind==="form"&&g.saved==null&&a!=null,I=g.kind==="form"&&g.saved!=null,G=i==="create"&&g.kind==="form"&&g.saved==null,{allows:O}=xe({resourceType:"agent",resourceIds:j.length===0?[]:[j]});l.useEffect(()=>{if(!t){p(de()),o(r),E(null),v(null),k({kind:"form"}),R(!1);return}if(i==="edit"&&a!=null){p(Re({name:a.name,task:a.task,cron:a.cron,timezone:a.timezone})),o(a.agentId),E(null),k({kind:"form"});return}p(de()),o(r),E(null),k({kind:"form"})},[t,i,a,r]),l.useEffect(()=>{if(!t||i!=="create"||r.length===0)return;let c=!1;const N=r;return pt({server:y,agentKey:N}).then(S=>{c||S==null||Q.current===N&&(E(S),o(ue(S)))}).catch(()=>{}),()=>{c=!0}},[t,i,r,y]);const _=(w==null?void 0:w.name)??(B==null?void 0:B.agentName)??(a==null?void 0:a.agentName)??(j.length>0?j:""),W=l.useMemo(()=>{var N;return(((N=w==null?void 0:w.agentSpec)==null?void 0:N.mcpServers)??[]).map(Nt).filter(S=>S!=null).map(S=>({name:S}))},[w]),P=l.useMemo(()=>{const c=he(u);return u.name.trim().length>0&&u.task.trim().length>0&&c.length>0&&j.length>0&&(!G||O(j,"USE"))},[j,O,u,G]),U=c=>{k({kind:"test",schedule:c}),p(Re({name:c.name,task:c.task,cron:c.cron,timezone:c.timezone})),o(c.agentId)},V=async c=>{if(c.preventDefault(),!P)return;const N=he(u);z(!0),v(null);try{if(D&&a!=null){await b.updateSchedule({id:a.id,name:u.name.trim(),task:u.task.trim(),cron:N,timezone:u.timezone,status:a.status}),d==null||d(),s(!1);return}if(I&&g.kind==="form"&&g.saved!=null){const Y=await b.updateSchedule({id:g.saved.id,name:u.name.trim(),task:u.task.trim(),cron:N,timezone:u.timezone,status:"paused"});d==null||d(),U(Y),f==null||f.showSuccess({title:"Schedule saved as paused",description:ae({cron:Y.cron,timezone:Y.timezone})});return}const S=await b.createSchedule({agentId:j,name:u.name.trim(),task:u.task.trim(),cron:N,timezone:u.timezone,status:"paused"});d==null||d(),U(S),f==null||f.showSuccess({title:"Schedule saved as paused",description:ae({cron:S.cron,timezone:S.timezone})})}catch(S){const Y=S instanceof Error?S.message:"Failed to save schedule";v(Y)}finally{z(!1)}},L=async()=>{if(g.kind==="test"){R(!0),v(null);try{await b.updateSchedule({id:g.schedule.id,name:g.schedule.name,task:g.schedule.task,cron:g.schedule.cron,timezone:g.schedule.timezone,status:"active"}),d==null||d(),f==null||f.showSuccess({title:"Schedule activated"}),s(!1)}catch(c){const N=c instanceof Error?c.message:"Failed to activate schedule";v(N),f==null||f.showError(c)}finally{R(!1)}}},K=g.kind==="test"?"Test Schedule":D||I?"Edit Schedule":"New Schedule",ee=g.kind==="test"?`Recurring unattended runs of ${_}.`:D||I?"Update cadence and task for this schedule.":"Create a recurring unattended run for an agent.";let h;return g.kind==="test"?h=e.jsxs("div",{className:"flex flex-col gap-2",children:[F!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:F}):null,e.jsx(H.Secondary,{type:"button",className:"w-full",disabled:q,onClick:()=>void L(),children:"Activate Schedule"})]}):h=e.jsxs("div",{className:"flex flex-col gap-2",children:[F!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:F}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(H.Secondary,{type:"button",onClick:()=>s(!1),disabled:C,children:"Cancel"}),e.jsx(H.Primary,{type:"submit",form:"schedule-form",disabled:!P||C,children:"Save"})]})]}),e.jsx(yt,{open:t,onOpenChange:s,title:K,description:ee,anchor:"right",size:"xl",headerIcon:e.jsx("span",{className:"text-primary-button-bg inline-flex size-8 items-center justify-center",children:e.jsx(A,{name:g.kind==="test"||D||I?"calendar":"calendar-plus",className:"size-5"})}),footer:h,children:g.kind==="test"?e.jsx(Bt,{schedule:g.schedule,agentName:_,mcpMounts:W,onEditConfiguration:()=>{v(null),k({kind:"form",saved:g.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:c=>void V(c),children:e.jsx(Rt,{values:u,onChange:p,agentId:j,agentLabel:_,onAgentIdChange:D||I?void 0:c=>{o(c),c.length===0&&E(null)},onAgentPicked:E,agentPickerDisabled:D||I,onBuildAgent:i==="create"&&(m==null?void 0:m.isComposerEnabled)===!0?()=>{s(!1),m.openAgentBuilder()}:void 0})})})}function De(t){return e.jsx(ft,{children:e.jsx(Ot,{...t})})}function _t({runs:t}){const s=Lt(t);return s.length===0?e.jsx("span",{className:"text-text-secondary text-sm",children:"—"}):e.jsx("div",{className:"flex items-center gap-1",children:s.map(i=>e.jsx(_e,{run:i},i.id))})}var Ut=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],Pe=[10,25];function ie(t){return Math.min(Math.max(t,1),25)}function oe(t){const s=pe(t);return{nameQuery:s.q??"",statusFilter:s.status??"all",agentFilter:s.agent??"all"}}function Ht(t){const s=pe(window.location.search);if(!s.isNew)return{kind:"closed"};const i=t??s.agent;return{kind:"create",...i==null?{}:{agentId:i}}}function qt({schedule:t,running:s,canManage:i,canDelete:a,onRunNow:r,onEdit:d,onTogglePause:b,onDelete:y}){const m=mt("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1.5",children:[e.jsx(m,{allowed:i,children:e.jsxs(H.Secondary,{type:"button",disabled:s,"aria-label":`Run now ${t.name}`,size:"large",onClick:r,children:[e.jsx(A,{name:s?"loader":"play",className:$("size-3.5",s&&"animate-spin")}),"Run now"]})}),e.jsxs(xt,{align:"end",trigger:e.jsx("button",{type:"button",className:ht({variant:"ghost",size:"icon"}),"aria-label":`Actions for ${t.name}`,children:e.jsx(A,{name:"ellipsis"})}),children:[e.jsx(m,{allowed:i,children:e.jsxs(me,{onClick:d,children:[e.jsx(A,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(m,{allowed:i,children:e.jsxs(me,{onClick:b,children:[e.jsx(A,{name:t.status==="active"?"pause":"play",className:"size-3.5"}),t.status==="active"?"Pause":"Resume"]})}),e.jsx(m,{allowed:a,children:e.jsxs(me,{className:"text-failure-bg focus:text-failure-bg",onClick:y,children:[e.jsx(A,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function Vt({agentId:t}){const s=ge(),i=Le(),a=be(),[r,d]=l.useState([]),{allows:b}=xe({resourceType:"schedule",resourceIds:r.map(n=>n.id)}),[y,m]=l.useState({}),[f,u]=l.useState(!1),[p,j]=l.useState(()=>new Set),[o,w]=l.useState({}),[E,g]=l.useState(!0),[k,C]=l.useState(null),[z,q]=l.useState(()=>oe(window.location.search).nameQuery),[R,F]=l.useState(()=>oe(window.location.search).statusFilter),[v,Q]=l.useState(()=>t??oe(window.location.search).agentFilter),B=t??(v==="all"?null:v),{allows:D}=xe({resourceType:"agent",resourceIds:B==null?[]:[B]}),I=i.permissions==null||B==null||D(B,"USE"),[G,O]=l.useState(()=>Ht(t)),[_,W]=l.useState(null),[P,U]=l.useState(()=>ie(lt)),[V,L]=l.useState(void 0),[K,ee]=l.useState(void 0),[h,c]=l.useState([]),N=l.useRef(0),S=l.useRef(!1),Y=l.useCallback(async({rows:n,gen:x})=>{if(n.length===0){x===N.current&&m({});return}u(!0);try{const T=await Promise.allSettled(n.map(M=>s.listScheduleRuns({scheduleId:M.id})));if(x!==N.current)return;m(Object.fromEntries(n.map((M,Z)=>{const se=T[Z],Ve=(se==null?void 0:se.status)==="fulfilled"?se.value:[];return[M.id,Ve]})))}finally{x===N.current&&u(!1)}},[s]),te=l.useCallback(async({token:n,size:x,agentId:T})=>{const M=++N.current;g(!0),C(null);try{const Z=await s.listSchedules({limit:ie(x),...n===void 0||n===""?{}:{pageToken:n},...T==="all"?{}:{agentIds:[T]}});if(M!==N.current)return;d(Z.data),ee(Z.nextPageToken),Y({rows:Z.data,gen:M})}catch(Z){if(M!==N.current)return;const se=Z instanceof Error?Z.message:"Failed to load schedules";C(se),d([]),m({}),ee(void 0)}finally{M===N.current&&g(!1)}},[s,Y]),Ne=l.useCallback(n=>{const x=(n==null?void 0:n.size)??P,T=(n==null?void 0:n.agentId)??v;L(void 0),c([]),te({token:void 0,size:x,agentId:T})},[v,te,P]);l.useEffect(()=>{Se({agent:t===void 0&&v!=="all"?v:null,status:R==="all"?null:R,q:z.trim().length===0?null:z})},[v,t,R,z]),l.useEffect(()=>{t!==void 0&&Q(n=>n===t?n:(L(void 0),c([]),t))},[t]),l.useEffect(()=>{S.current||!pe(window.location.search).isNew||(S.current=!0,Se({isNew:null}))},[]),l.useEffect(()=>{const n=()=>{const x=oe(window.location.search);q(x.nameQuery),F(x.statusFilter),Q(T=>{const M=t??x.agentFilter;return T===M?T:(L(void 0),c([]),M)})};return window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}},[t]),l.useEffect(()=>{te({token:V,size:P,agentId:v})},[v,P,V,te]);const re=l.useMemo(()=>{const n=z.trim().toLowerCase();return r.filter(x=>!(R!=="all"&&x.status!==R||n.length>0&&!x.name.toLowerCase().includes(n)))},[r,z,R]),ye=Ke(r),je=h.length>0||K!=null,He=async n=>{if(!b(n.id,"MANAGE"))return;const x=n.status==="active"?"paused":"active";try{await s.updateSchedule({...n,status:x}),await te({token:V,size:P,agentId:v})}catch(T){a==null||a.showError(T)}},qe=async n=>{if(b(n.id,"MANAGE")){j(x=>new Set(x).add(n.id));try{await s.createScheduleRun({scheduleId:n.id}),a==null||a.showSuccess({title:"Run started"});const x=await s.listScheduleRuns({scheduleId:n.id});m(T=>({...T,[n.id]:x}))}catch(x){a==null||a.showError(x)}finally{j(x=>{const T=new Set(x);return T.delete(n.id),T})}}},Ge=async n=>{if(b(n.id,"DELETE")){W(null);try{await s.deleteSchedule({id:n.id}),Ne()}catch(x){a==null||a.showError(x)}}},ve=()=>{K!=null&&(c(n=>[...n,V??""]),L(K))},we=()=>{if(h.length===0)return;const n=[...h],x=n.pop();c(n),L(x===""?void 0:x)};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-primary-bg",children:[e.jsx(Qe,{title:t===void 0?"Scheduled Agents":void 0,end:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full sm:w-60",children:e.jsx(We,{query:z,setQuery:q,placeholder:"Search schedules by name"})}),e.jsx(ce,{value:R,onValueChange:F,options:Ut,className:"sm:w-40","aria-label":"Filter by status"}),t===void 0?e.jsx(Fe,{value:v,selectedLabel:v==="all"?"All agents":o[v]??v,onValueChange:n=>{Q(n),L(void 0),c([])},onAgentPicked:n=>{w(x=>({...x,[ue(n)]:n.name}))},allOption:{value:"all",label:"All agents"},className:"sm:w-48","aria-label":"Filter by agent",placeholder:"Search agent"}):null,e.jsxs(H.Primary,{type:"button",disabled:!I,onClick:()=>I&&O({kind:"create",agentId:v!=="all"?v:void 0}),children:[e.jsx(A,{name:"plus",className:"size-3.5"}),"Create Schedule"]})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-4 py-4",children:E?e.jsx("div",{className:"flex flex-col gap-2",role:"status","aria-label":"Loading schedules",children:Array.from({length:5},(n,x)=>e.jsx(Ye,{className:"h-12 w-full rounded-md"},x))}):k!=null?e.jsx("p",{className:"text-failure-bg px-3 py-8 text-center text-sm",children:k}):r.length===0?e.jsx(ke,{title:"No Schedules Found",description:"Create one to get started.",className:"min-h-full"}):re.length===0?e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(ke,{title:"No Schedules Found",description:"No schedules match your filters.",className:"flex-1"}),je?e.jsx(Te,{pageSize:P,rowCount:0,canPrev:h.length>0,canNext:K!=null,onPrev:we,onNext:ve,pageSizeOptions:Pe,onPageSizeChange:n=>{const x=ie(n);U(x),L(void 0),c([])}}):null]}):e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs(Ze,{className:"min-w-[48rem]",children:[e.jsx(Je,{children:e.jsxs(Ce,{className:"hover:bg-transparent",children:[e.jsx(J,{children:"Name"}),e.jsx(J,{children:"Agent"}),ye?e.jsx(J,{children:"Created by"}):null,e.jsx(J,{children:"Frequency"}),e.jsx(J,{children:"Status"}),e.jsx(J,{children:"Last 5 runs"}),e.jsx(J,{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(Xe,{children:re.map(n=>{const x=ae({cron:n.cron,timezone:n.timezone}),T=n.agentName??o[n.agentId]??n.agentId;return e.jsxs(Ce,{children:[e.jsx(X,{className:"text-text-primary font-medium",children:e.jsx("span",{className:"text-left !no-underline",children:n.name})}),e.jsx(X,{children:T}),ye?e.jsx(X,{children:e.jsx(et,{subject:n.createdBySubject})}):null,e.jsx(X,{children:x}),e.jsx(X,{children:e.jsx(Ue,{status:n.status})}),e.jsx(X,{children:f?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):e.jsx(_t,{runs:y[n.id]??[]})}),e.jsx(X,{className:"text-right",children:e.jsx(qt,{schedule:n,running:p.has(n.id),canManage:b(n.id,"MANAGE"),canDelete:b(n.id,"DELETE"),onRunNow:()=>void qe(n),onEdit:()=>{b(n.id,"MANAGE")&&O({kind:"edit",schedule:n})},onTogglePause:()=>void He(n),onDelete:()=>{b(n.id,"DELETE")&&W(n)}})})]},n.id)})})]}),(re.length>0||je)&&e.jsx(Te,{pageSize:P,rowCount:re.length,canPrev:h.length>0,canNext:K!=null,onPrev:we,onNext:ve,pageSizeOptions:Pe,onPageSizeChange:n=>{const x=ie(n);U(x),L(void 0),c([])}})]})}),G.kind==="create"?e.jsx(De,{open:!0,mode:"create",initialAgentId:G.agentId??"",onOpenChange:n=>{n||O({kind:"closed"})},onSaved:()=>Ne()}):null,G.kind==="edit"?e.jsx(De,{open:!0,mode:"edit",schedule:G.schedule,onOpenChange:n=>{n||O({kind:"closed"})},onSaved:()=>void te({token:V,size:P,agentId:v})}):null,_!=null?e.jsxs(tt,{open:!0,onOpenChange:n=>{n||W(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(st,{children:e.jsxs(nt,{children:[e.jsx(at,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",_.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(rt,{children:[e.jsx(H.Secondary,{type:"button",onClick:()=>W(null),children:"Cancel"}),e.jsx(H.Destructive,{type:"button",disabled:!b(_.id,"DELETE"),onClick:()=>void Ge(_),children:"Delete"})]})]}):null]})}export{Vt as SchedulesPage};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-6FJVZLJT-Drq1vNUK.js","./index-DVIyIfJR.js","./index-B01pXqvC.css","./SchedulesPage-2G6F4XO6-CXGVFkK8.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{bx as N,by as Ut,u as G,j as s,bz as Vt,r as d,aU as S,bA as Ge,bB as Wt,bC as He,bD as Ue,bE as Ve,bF as We,bG as Xe,bH as X,bI as Xt,bJ as C,bK as Yt,bL as qt,bM as Qt,bN as Zt,bO as Jt,bP as en,bQ as tn,bR as nn,bS as be,bT as rn,bU as sn,bV as ce,bW as on,bX as an,bY as cn,bZ as Ye,b_ as Ee,b$ as le,c0 as we,c1 as se,c2 as Ie,c3 as ye,c4 as Me,c5 as _e,h as qe,a as Z,c as T,E as ln,c6 as un,e as F,c7 as dn,c8 as mn,c9 as fn,b as Le,aK as Qe,a3 as hn,H as pn,aa as Ae,I as z,q as xn,d as re,ca as Ze,a4 as gn,a7 as vn,s as Je,cb as bn,P as wn,S as Oe,cc as In,cd as yn,_ as et,bq as Mn}from"./index-DVIyIfJR.js";import{A as Ln,N as Cn,T as jn,S as Tn}from"./chunk-PX6MNNN3-DWHQBAi-.js";const Ce=n=>{const e=N(8),{index:t,archived:o,children:r}=n;let a;e[0]!==o||e[1]!==t?(a=Ut({source:"threads",query:{type:"index",index:t,archived:o},get:i=>i.threads().item({index:t,archived:o})}),e[0]=o,e[1]=t,e[2]=a):a=e[2];let c;e[3]!==a?(c={threadListItem:a},e[3]=a,e[4]=c):c=e[4];const l=G(c);let u;return e[5]!==l||e[6]!==r?(u=s.jsx(Vt,{value:l,children:r}),e[5]=l,e[6]=r,e[7]=u):u=e[7],u},tt=d.memo(n=>{const e=N(6),{index:t,archived:o,components:r}=n,a=o===void 0?!1:o,c=r.ThreadListItem;let l;e[0]!==c?(l=s.jsx(c,{}),e[0]=c,e[1]=l):l=e[1];let u;return e[2]!==a||e[3]!==t||e[4]!==l?(u=s.jsx(Ce,{index:t,archived:a,children:l}),e[2]=a,e[3]=t,e[4]=l,e[5]=u):u=e[5],u},(n,e)=>n.index===e.index&&n.archived===e.archived&&n.components.ThreadListItem===e.components.ThreadListItem);tt.displayName="ThreadListPrimitive.ItemByIndex";const ke=({archived:n,children:e})=>{const t=S(o=>n?o.threads.archivedThreadIds.length:o.threads.threadIds.length);return Ge(()=>Array.from({length:t},(o,r)=>s.jsx(Ce,{index:r,archived:n,children:s.jsx(Wt,{getItemState:a=>a.threads().item({index:r,archived:n}).getState(),children:a=>e({get threadListItem(){return a()}})})},r)),[t,n,e])},nt=n=>{const e=N(8),{archived:t,components:o,children:r}=n,a=t===void 0?!1:t;if(o){const l=o.ThreadListItem;let u;e[0]!==l?(u=()=>s.jsx(l,{}),e[0]=l,e[1]=u):u=e[1];let i;return e[2]!==a||e[3]!==u?(i=s.jsx(ke,{archived:a,children:u}),e[2]=a,e[3]=u,e[4]=i):i=e[4],i}let c;return e[5]!==a||e[6]!==r?(c=s.jsx(ke,{archived:a,children:r}),e[5]=a,e[6]=r,e[7]=c):c=e[7],c};nt.displayName="ThreadListPrimitive.Items";const rt=n=>{const e=N(2),{fallback:t}=n,o=S(Sn)||t;let r;return e[0]!==o?(r=s.jsx(s.Fragment,{children:o}),e[0]=o,e[1]=r):r=e[1],r};rt.displayName="ThreadListItemPrimitive.Title";function Sn(n){return n.threadListItem.title}const Rn=()=>{const n=N(4),e=G();let t;n[0]!==e?(t=()=>{e.threadListItem().archive()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={archive:o},n[2]=o,n[3]=r):r=n[3],r},Pn=()=>{const n=N(4),e=G();let t;n[0]!==e?(t=()=>{e.threadListItem().delete()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={delete:o},n[2]=o,n[3]=r):r=n[3],r},Nn=()=>{const n=N(4),e=G();let t;n[0]!==e?(t=()=>{e.threadListItem().unarchive()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={unarchive:o},n[2]=o,n[3]=r):r=n[3],r},Dn=()=>{const n=N(4),e=G();let t;n[0]!==e?(t=()=>{e.threadListItem().switchTo()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={switchTo:o},n[2]=o,n[3]=r):r=n[3],r},En=()=>{const n=N(4),e=G();let t;n[0]!==e?(t=()=>{e.threads().switchToNewThread()},n[0]=e,n[1]=t):t=n[1];const o=t;let r;return n[2]!==o?(r={switchToNewThread:o},n[2]=o,n[3]=r):r=n[3],r},_n=()=>{const n=N(5),e=G(),t=S(An);let o;n[0]!==e?(o=()=>{e.threads().loadMore()},n[0]=e,n[1]=o):o=n[1];const r=o;let a;return n[2]!==t||n[3]!==r?(a={loadMore:r,disabled:t},n[2]=t,n[3]=r,n[4]=a):a=n[4],a};function An(n){return!n.threads.hasMore||n.threads.isLoading||n.threads.isLoadingMore}var On=Object.defineProperty,y=(n,e)=>On(n,"name",{value:e,configurable:!0}),kn=["Enter"," "],Fn=["ArrowDown","PageUp","Home"],st=["ArrowUp","PageDown","End"],Bn=[...Fn,...st],ue="Menu",[pe,Kn,$n]=We(ue),[Y,ot]=He(ue,[$n,Ue,Ve]),je=Ue(),at=Ve(),[zn,oe]=Y(ue),[Gn,Te]=Y(ue),Hn=y(n=>{const{__scopeMenu:e,open:t=!1,children:o,dir:r,onOpenChange:a,modal:c=!0}=n,l=je(e),[u,i]=d.useState(null),m=d.useRef(!1),h=sn(a),f=ce(r);return d.useEffect(()=>{const p=y(()=>{m.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},"handleKeyDown"),b=y(()=>m.current=!1,"handlePointer");return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),d.useEffect(()=>{if(!t)return;const p=y(()=>h(!1),"handleBlur");return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[t,h]),s.jsx(on,{...l,children:s.jsx(zn,{scope:e,open:t,onOpenChange:h,content:u,onContentChange:i,children:s.jsx(Gn,{scope:e,onClose:d.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:f,modal:c,children:o})})})},"Menu"),Un=d.forwardRef(y(function(e,t){const{__scopeMenu:o,...r}=e,a=je(o);return s.jsx(an,{...a,...r,ref:t})},"MenuAnchor")),it="MenuPortal",[Vn,Wn]=Y(it,{forceMount:void 0}),Xn=y(n=>{const{__scopeMenu:e,forceMount:t,children:o,container:r}=n,a=oe(it,e);return s.jsx(Vn,{scope:e,forceMount:t,children:s.jsx(Xe,{present:t||a.open,children:s.jsx(cn,{asChild:!0,container:r,children:o})})})},"MenuPortal"),W="MenuContent",[Yn,ct]=Y(W),qn=d.forwardRef(y(function(e,t){const o=Wn(W,e.__scopeMenu),{forceMount:r=o.forceMount,...a}=e,c=oe(W,e.__scopeMenu),l=Te(W,e.__scopeMenu);return s.jsx(pe.Provider,{scope:e.__scopeMenu,children:s.jsx(Xe,{present:r||c.open,children:s.jsx(pe.Slot,{scope:e.__scopeMenu,children:l.modal?s.jsx(Qn,{...a,ref:t}):s.jsx(Zn,{...a,ref:t})})})})},"MenuContent")),Qn=d.forwardRef(y(function(e,t){const o=oe(W,e.__scopeMenu),r=d.useRef(null),a=X(t,r);return d.useEffect(()=>{const c=r.current;if(c)return Xt(c)},[]),s.jsx(lt,{...e,ref:a,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:C(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentModal")),Zn=d.forwardRef(y(function(e,t){const o=oe(W,e.__scopeMenu);return s.jsx(lt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentNonModal")),Jn=rn("MenuContent.ScrollLock"),lt=d.forwardRef(y(function(e,t){const{__scopeMenu:o,loop:r=!1,trapFocus:a,onOpenAutoFocus:c,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:i,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:p,onDismiss:b,disableOutsideScroll:x,...g}=e,M=oe(W,o),L=Te(W,o),j=je(o),P=at(o),_=Kn(o),[A,O]=d.useState(null),D=d.useRef(null),I=X(t,D,M.onContentChange),R=d.useRef(0),E=d.useRef(""),B=d.useRef(0),w=d.useRef(null),te=d.useRef("right"),K=d.useRef(0),U=x?qt:d.Fragment,de=x?{as:Jn,allowPinchZoom:!0}:void 0,Ht=y(v=>{var Q,Ne;const k=E.current+v,$=_().filter(H=>!H.disabled),V=document.activeElement,me=(Q=$.find(H=>H.ref.current===V))==null?void 0:Q.textValue,fe=$.map(H=>H.textValue),Pe=ht(fe,k,me),ne=(Ne=$.find(H=>H.textValue===Pe))==null?void 0:Ne.ref.current;y((function H(De){E.current=De,window.clearTimeout(R.current),De!==""&&(R.current=window.setTimeout(()=>H(""),1e3))}),"updateSearch")(k),ne&&setTimeout(()=>ne.focus())},"handleTypeaheadSearch");d.useEffect(()=>()=>window.clearTimeout(R.current),[]),Yt();const q=d.useCallback(v=>{var $,V;return te.current===(($=w.current)==null?void 0:$.side)&&xt(v,(V=w.current)==null?void 0:V.area)},[]);return s.jsx(Yn,{scope:o,searchRef:E,onItemEnter:d.useCallback(v=>{q(v)&&v.preventDefault()},[q]),onItemLeave:d.useCallback(v=>{var k;q(v)||((k=D.current)==null||k.focus(),O(null))},[q]),onTriggerLeave:d.useCallback(v=>{q(v)&&v.preventDefault()},[q]),pointerGraceTimerRef:B,onPointerGraceIntentChange:d.useCallback(v=>{w.current=v},[]),children:s.jsx(U,{...de,children:s.jsx(Qt,{asChild:!0,trapped:a,onMountAutoFocus:C(c,v=>{var k;v.preventDefault(),(k=D.current)==null||k.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:s.jsx(Zt,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:p,onDismiss:b,children:s.jsx(Jt,{asChild:!0,...P,dir:L.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:O,onEntryFocus:C(i,v=>{L.isUsingKeyboardRef.current||v.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(en,{role:"menu","aria-orientation":"vertical","data-state":ut(M.open),"data-radix-menu-content":"",dir:L.dir,...j,...g,ref:I,style:{outline:"none",...g.style},onKeyDown:C(g.onKeyDown,v=>{const $=v.target.closest("[data-radix-menu-content]")===v.currentTarget,V=v.ctrlKey||v.altKey||v.metaKey,me=v.key.length===1;$&&(v.key==="Tab"&&v.preventDefault(),!V&&me&&Ht(v.key));const fe=D.current;if(v.target!==fe||!Bn.includes(v.key))return;v.preventDefault();const ne=_().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);st.includes(v.key)&&ne.reverse(),mt(ne)}),onBlur:C(e.onBlur,v=>{v.currentTarget.contains(v.target)||(window.clearTimeout(R.current),E.current="")}),onPointerMove:C(e.onPointerMove,ie(v=>{const k=v.target,$=K.current!==v.clientX;if(v.currentTarget.contains(k)&&$){const V=v.clientX>K.current?"right":"left";te.current=V,K.current=v.clientX}}))})})})})})})},"MenuContentImpl")),xe="MenuItem",Fe="menu.itemSelect",er=d.forwardRef(y(function(e,t){const{disabled:o=!1,onSelect:r,...a}=e,c=d.useRef(null),l=Te(xe,e.__scopeMenu),u=ct(xe,e.__scopeMenu),i=X(t,c),m=d.useRef(!1),h=y(()=>{const f=c.current;if(!o&&f){const p=new CustomEvent(Fe,{bubbles:!0,cancelable:!0});f.addEventListener(Fe,b=>r==null?void 0:r(b),{once:!0}),tn(f,p),p.defaultPrevented?m.current=!1:l.onClose()}},"handleSelect");return s.jsx(tr,{...a,ref:i,disabled:o,onClick:C(e.onClick,h),onPointerDown:f=>{var p;(p=e.onPointerDown)==null||p.call(e,f),m.current=!0},onPointerUp:C(e.onPointerUp,f=>{var p;m.current||(p=f.currentTarget)==null||p.click()}),onKeyDown:C(e.onKeyDown,f=>{o||f.target!==f.currentTarget||u.searchRef.current!==""&&f.key===" "||kn.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})},"MenuItem")),tr=d.forwardRef(y(function(e,t){const{__scopeMenu:o,disabled:r=!1,textValue:a,...c}=e,l=ct(xe,o),u=at(o),i=d.useRef(null),m=X(t,i),[h,f]=d.useState(!1),[p,b]=d.useState("");return d.useEffect(()=>{const x=i.current;x&&b((x.textContent??"").trim())},[c.children]),s.jsx(pe.ItemSlot,{scope:o,disabled:r,textValue:a??p,children:s.jsx(nn,{asChild:!0,...u,focusable:!r,children:s.jsx(be.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...c,ref:m,onPointerMove:C(e.onPointerMove,ie(x=>{r?l.onItemLeave(x):(l.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:C(e.onPointerLeave,ie(x=>l.onItemLeave(x))),onFocus:C(e.onFocus,()=>f(!0)),onBlur:C(e.onBlur,()=>f(!1))})})})},"MenuItemImpl")),nr="MenuRadioGroup",[ns,rs]=Y(nr,{value:void 0,onValueChange:y(()=>{},"onValueChange")}),rr="MenuItemIndicator",[ss,os]=Y(rr,{checked:!1}),sr=d.forwardRef(y(function(e,t){const{__scopeMenu:o,...r}=e;return s.jsx(be.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})},"MenuSeparator")),or="MenuSub",[as,is]=Y(or);function ut(n){return n?"open":"closed"}y(ut,"getOpenState");function dt(n){return n==="indeterminate"}y(dt,"isIndeterminate");function ar(n){return dt(n)?"indeterminate":n?"checked":"unchecked"}y(ar,"getCheckedState");function mt(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}y(mt,"focusFirst");function ft(n,e){return n.map((t,o)=>n[(e+o)%n.length])}y(ft,"wrapArray");function ht(n,e,t){const r=e.length>1&&Array.from(e).every(i=>i===e[0])?e[0]:e,a=t?n.indexOf(t):-1;let c=ft(n,Math.max(a,0));r.length===1&&(c=c.filter(i=>i!==t));const u=c.find(i=>i.toLowerCase().startsWith(r.toLowerCase()));return u!==t?u:void 0}y(ht,"getNextMatch");function pt(n,e){const{x:t,y:o}=n;let r=!1;for(let a=0,c=e.length-1;a<e.length;c=a++){const l=e[a],u=e[c],i=l.x,m=l.y,h=u.x,f=u.y;m>o!=f>o&&t<(h-i)*(o-m)/(f-m)+i&&(r=!r)}return r}y(pt,"isPointInPolygon");function xt(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return pt(t,e)}y(xt,"isPointerInGraceArea");function ie(n){return e=>e.pointerType==="mouse"?n(e):void 0}y(ie,"whenMouse");var ir=Hn,cr=Un,lr=Xn,ur=qn,dr=er,mr=sr,fr=Object.defineProperty,J=(n,e)=>fr(n,"name",{value:e,configurable:!0}),Se="DropdownMenu",[hr,gt]=He(Se,[ot]),ee=ot(),[pr,vt]=hr(Se),bt=J(n=>{const{__scopeDropdownMenu:e,children:t,dir:o,open:r,defaultOpen:a,onOpenChange:c,modal:l=!0}=n,u=ee(e),i=d.useRef(null),[m,h]=Ye({prop:r,defaultProp:a??!1,onChange:c,caller:Se});return s.jsx(pr,{scope:e,triggerId:Ee(),triggerRef:i,contentId:Ee(),open:m,onOpenChange:h,onOpenToggle:d.useCallback(()=>h(f=>!f),[h]),modal:l,children:s.jsx(ir,{...u,open:m,onOpenChange:h,dir:o,modal:l,children:t})})},"DropdownMenu"),xr="DropdownMenuTrigger",wt=d.forwardRef(J(function(e,t){const{__scopeDropdownMenu:o,disabled:r=!1,...a}=e,c=vt(xr,o),l=ee(o),u=X(t,c.triggerRef);return s.jsx(cr,{asChild:!0,...l,children:s.jsx(be.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:u,onPointerDown:C(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(c.onOpenToggle(),c.open||i.preventDefault())}),onKeyDown:C(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&c.onOpenToggle(),i.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})},"DropdownMenuTrigger")),It=J(n=>{const{__scopeDropdownMenu:e,...t}=n,o=ee(e);return s.jsx(lr,{...o,...t})},"DropdownMenuPortal"),gr="DropdownMenuContent",yt=d.forwardRef(J(function(e,t){const{__scopeDropdownMenu:o,...r}=e,a=vt(gr,o),c=ee(o),l=d.useRef(!1);return s.jsx(ur,{id:a.contentId,"aria-labelledby":a.triggerId,...c,...r,ref:t,onCloseAutoFocus:C(e.onCloseAutoFocus,u=>{var i;l.current||(i=a.triggerRef.current)==null||i.focus(),l.current=!1,u.preventDefault()}),onInteractOutside:C(e.onInteractOutside,u=>{const i=u.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,h=i.button===2||m;(!a.modal||h)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),Mt=d.forwardRef(J(function(e,t){const{__scopeDropdownMenu:o,...r}=e,a=ee(o);return s.jsx(dr,{...a,...r,ref:t})},"DropdownMenuItem")),Lt=d.forwardRef(J(function(e,t){const{__scopeDropdownMenu:o,...r}=e,a=ee(o);return s.jsx(mr,{...a,...r,ref:t})},"DropdownMenuSeparator")),Ct=bt,jt=wt,vr=It,Tt=yt,St=Mt,Rt=Lt;const br=Object.freeze(Object.defineProperty({__proto__:null,Content:Tt,DropdownMenu:bt,DropdownMenuContent:yt,DropdownMenuItem:Mt,DropdownMenuPortal:It,DropdownMenuSeparator:Lt,DropdownMenuTrigger:wt,Item:St,Portal:vr,Root:Ct,Separator:Rt,Trigger:jt,createDropdownMenuScope:gt},Symbol.toStringTag,{value:"Module"})),wr=le(jt),Ir=le(Tt),yr=le(St),Mr=le(Rt),Pt=d.forwardRef((n,e)=>{const t=N(15);let o,r,a;t[0]!==n?({onClick:r,disabled:o,...a}=n,t[0]=n,t[1]=o,t[2]=r,t[3]=a):(o=t[1],r=t[2],a=t[3]);const c=S(Lr),{switchToNewThread:l}=En();let u;t[4]!==c?(u=c?{"data-active":"true","aria-current":"true"}:null,t[4]=c,t[5]=u):u=t[5];let i;t[6]!==r||t[7]!==l?(i=C(r,l),t[6]=r,t[7]=l,t[8]=i):i=t[8];let m;return t[9]!==o||t[10]!==e||t[11]!==a||t[12]!==u||t[13]!==i?(m=s.jsx(we.button,{type:"button",...u,...a,ref:e,disabled:o,onClick:i}),t[9]=o,t[10]=e,t[11]=a,t[12]=u,t[13]=i,t[14]=m):m=t[14],m});Pt.displayName="ThreadListPrimitive.New";function Lr(n){return n.threads.newThreadId===n.threads.mainThreadId}const Cr=()=>{const{loadMore:n,disabled:e}=_n();return e?null:n},jr=se("ThreadListPrimitive.LoadMore",Cr),[Tr,Sr]=We("ThreadList"),ge=Tr,Nt=ye(null),Rr=Nt.Provider,Re=()=>Ie(Nt),Dt=d.forwardRef((n,e)=>{const t=N(3);let o;return t[0]!==n||t[1]!==e?(o=s.jsx(ge.Provider,{scope:void 0,children:s.jsx(ge.Slot,{scope:void 0,children:s.jsx(we.div,{...n,ref:e})})}),t[0]=n,t[1]=e,t[2]=o):o=t[2],o});Dt.displayName="ThreadListPrimitive.Root";var Pr=Me({ItemByIndex:()=>tt,Items:()=>nt,LoadMore:()=>jr,New:()=>Pt,Root:()=>Dt});const Et=d.forwardRef((n,e)=>{const t=S(i=>i.threads.mainThreadId===i.threadListItem.id),o=_e(null),r=_e(null),a=Ge(()=>({triggerRef:o,moreRef:r}),[]),c=Sr(void 0),l=ce(),u=i=>{const m=l==="rtl"?"ArrowLeft":"ArrowRight",h=l==="rtl"?"ArrowRight":"ArrowLeft",f=o.current,p=r.current;if(f&&i.target===f)if(i.key==="ArrowDown"||i.key==="ArrowUp"){const b=c().map(g=>g.ref.current).filter(g=>g!==null),x=b[b.indexOf(f)+(i.key==="ArrowDown"?1:-1)];x&&(x.focus(),i.preventDefault())}else i.key===m&&p&&(p.focus(),i.preventDefault());else p&&i.target===p&&i.key===h&&(f==null||f.focus(),i.preventDefault())};return s.jsx(Rr,{value:a,children:s.jsx(we.div,{...t?{"data-active":"true","aria-current":"true"}:null,...n,onKeyDown:C(n.onKeyDown,u),ref:e})})});Et.displayName="ThreadListItemPrimitive.Root";const Nr=()=>{const{archive:n}=Rn();return n},Dr=se("ThreadListItemPrimitive.Archive",Nr),Er=()=>{const{unarchive:n}=Nn();return n},_r=se("ThreadListItemPrimitive.Unarchive",Er),Ar=()=>{const{delete:n}=Pn();return n},Or=se("ThreadListItemPrimitive.Delete",Ar),kr=()=>{const{switchTo:n}=Dn();return n},Fr=se("ThreadListItemPrimitive.Trigger",kr),_t=d.forwardRef((n,e)=>{var a;const t=N(3),o=X(e,(a=Re())==null?void 0:a.triggerRef);let r;return t[0]!==n||t[1]!==o?(r=s.jsx(ge.ItemSlot,{scope:void 0,children:s.jsx(Fr,{...n,ref:o})}),t[0]=n,t[1]=o,t[2]=r):r=t[2],r});_t.displayName="ThreadListItemPrimitive.Trigger";var ve=Me({Archive:()=>Dr,Delete:()=>Or,Root:()=>Et,Title:()=>rt,Trigger:()=>_t,Unarchive:()=>_r});const ae=gt(),At=ye(()=>{}),Ot=()=>Ie(At),kt=ye(!1),Ft=()=>Ie(kt),Bt=n=>{const e=N(26);let t,o,r,a,c,l,u;e[0]!==n?({__scopeThreadListItemMore:t,open:c,defaultOpen:o,onOpenChange:a,sharedFocusGroup:u,modal:r,...l}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=a,e[5]=c,e[6]=l,e[7]=u):(t=e[1],o=e[2],r=e[3],a=e[4],c=e[5],l=e[6],u=e[7]);const i=u===void 0?!1:u,m=i?!1:r??!0,h=ae(t),f=o??!1;let p;e[8]!==a?(p=a?{onChange:a}:{},e[8]=a,e[9]=p):p=e[9];let b;e[10]!==c||e[11]!==f||e[12]!==p?(b={prop:c,defaultProp:f,caller:"ThreadListItemMorePrimitive.Root",...p},e[10]=c,e[11]=f,e[12]=p,e[13]=b):b=e[13];const[x,g]=Ye(b);let M;e[14]!==m||e[15]!==x||e[16]!==l||e[17]!==h||e[18]!==g?(M=s.jsx(Ct,{...h,...l,modal:m,open:x,onOpenChange:g}),e[14]=m,e[15]=x,e[16]=l,e[17]=h,e[18]=g,e[19]=M):M=e[19];let L;e[20]!==g||e[21]!==M?(L=s.jsx(At.Provider,{value:g,children:M}),e[20]=g,e[21]=M,e[22]=L):L=e[22];let j;return e[23]!==i||e[24]!==L?(j=s.jsx(kt.Provider,{value:i,children:L}),e[23]=i,e[24]=L,e[25]=j):j=e[25],j};Bt.displayName="ThreadListItemMorePrimitive.Root";const Kt=d.forwardRef((n,e)=>{const t=N(10),{__scopeThreadListItemMore:o,...r}=n,a=ae(o),c=Re(),l=Ot(),u=Ft(),i=X(e,c==null?void 0:c.moreRef),m=ce()==="rtl"?"ArrowLeft":"ArrowRight",h=wr;let f;t[0]!==m||t[1]!==l||t[2]!==u?(f=x=>{!u||x.key!==m||(x.preventDefault(),l(!0))},t[0]=m,t[1]=l,t[2]=u,t[3]=f):f=t[3];const p=C(r.onKeyDown,f);let b;return t[4]!==h||t[5]!==i||t[6]!==r||t[7]!==a||t[8]!==p?(b=s.jsx(h,{...a,...r,onKeyDown:p,ref:i}),t[4]=h,t[5]=i,t[6]=r,t[7]=a,t[8]=p,t[9]=b):b=t[9],b});Kt.displayName="ThreadListItemMorePrimitive.Trigger";const $t=d.forwardRef((n,e)=>{const t=N(21),{__scopeThreadListItemMore:o,portalProps:r,sideOffset:a,...c}=n,l=a===void 0?4:a,u=ae(o),i=Ot(),m=Re(),h=Ft(),f=ce()==="rtl"?"ArrowRight":"ArrowLeft",p=br,b=Ir;let x;t[0]!==f||t[1]!==(m==null?void 0:m.moreRef)||t[2]!==i||t[3]!==h?(x=_=>{var A;!h||_.key!==f||(_.preventDefault(),i(!1),(A=m==null?void 0:m.moreRef.current)==null||A.focus())},t[0]=f,t[1]=m==null?void 0:m.moreRef,t[2]=i,t[3]=h,t[4]=x):x=t[4];const g=C(c.onKeyDown,x);let M;t[5]!==(m==null?void 0:m.moreRef)||t[6]!==h?(M=()=>{var _;h&&((_=m==null?void 0:m.moreRef.current)==null||_.focus())},t[5]=m==null?void 0:m.moreRef,t[6]=h,t[7]=M):M=t[7];const L=C(c.onEscapeKeyDown,M);let j;t[8]!==b||t[9]!==e||t[10]!==c||t[11]!==u||t[12]!==l||t[13]!==g||t[14]!==L?(j=s.jsx(b,{...u,...c,onKeyDown:g,onEscapeKeyDown:L,ref:e,sideOffset:l}),t[8]=b,t[9]=e,t[10]=c,t[11]=u,t[12]=l,t[13]=g,t[14]=L,t[15]=j):j=t[15];let P;return t[16]!==r||t[17]!==u||t[18]!==p.Portal||t[19]!==j?(P=s.jsx(p.Portal,{...u,...r,children:j}),t[16]=r,t[17]=u,t[18]=p.Portal,t[19]=j,t[20]=P):P=t[20],P});$t.displayName="ThreadListItemMorePrimitive.Content";const zt=d.forwardRef((n,e)=>{const t=N(7);let o,r;t[0]!==n?({__scopeThreadListItemMore:o,...r}=n,t[0]=n,t[1]=o,t[2]=r):(o=t[1],r=t[2]);const a=ae(o);let c;return t[3]!==e||t[4]!==r||t[5]!==a?(c=s.jsx(yr,{...a,...r,ref:e}),t[3]=e,t[4]=r,t[5]=a,t[6]=c):c=t[6],c});zt.displayName="ThreadListItemMorePrimitive.Item";const Gt=d.forwardRef((n,e)=>{const t=N(7);let o,r;t[0]!==n?({__scopeThreadListItemMore:o,...r}=n,t[0]=n,t[1]=o,t[2]=r):(o=t[1],r=t[2]);const a=ae(o);let c;return t[3]!==e||t[4]!==r||t[5]!==a?(c=s.jsx(Mr,{...a,...r,ref:e}),t[3]=e,t[4]=r,t[5]=a,t[6]=c):c=t[6],c});Gt.displayName="ThreadListItemMorePrimitive.Separator";var he=Me({Content:()=>$t,Item:()=>zt,Root:()=>Bt,Separator:()=>Gt,Trigger:()=>Kt});function Br(){const n=Z(),e=qe(),t=Le(),o=Qe(),r=t||o,[a,c]=d.useState(!1),[l,u]=d.useState(""),[i,m]=d.useState(null),h=d.useRef(null),f=d.useRef(null),p=d.useId(),b=(n==null?void 0:n.isLibraryEnabled)===!0&&e!=null,x=(n==null?void 0:n.historyAgentFilter)??null;d.useEffect(()=>{a||u("")},[a]);const{agents:g,isInitialLoading:M,isSearching:L,loadingMore:j,hasMore:P,listRef:_,sentinelRef:A}=hn({enabled:a&&b,query:l});if(d.useLayoutEffect(()=>{if(!a||r){m(null);return}const I=()=>{var E;const R=(E=h.current)==null?void 0:E.getBoundingClientRect();R&&m({top:R.top,left:R.right+4})};return I(),window.addEventListener("resize",I),window.addEventListener("scroll",I,!0),()=>{window.removeEventListener("resize",I),window.removeEventListener("scroll",I,!0)}},[a,r]),d.useEffect(()=>{if(!a||r)return;const I=R=>{var B,w;const E=R.target;(B=h.current)!=null&&B.contains(E)||(w=f.current)!=null&&w.contains(E)||c(!1)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[a,r]),!b)return null;const O=I=>{(n==null?void 0:n.isComposerEnabled)===!0?n.openDraft():n==null||n.openLibraryHome(),n==null||n.setHistoryAgentFilter(I),c(!1)},D=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"p-1",onMouseDown:I=>I.stopPropagation(),children:[s.jsx(pn,{query:l,setQuery:u,placeholder:"Search agents"}),L?s.jsx("p",{className:"text-text-secondary px-1 pt-1 text-[11px]",role:"status",children:"Searching…"}):null]}),s.jsxs("div",{ref:_,className:F("mt-1 overflow-y-auto",r?"min-h-0 flex-1 px-1 pb-2":"min-h-48 max-h-64"),children:[l.trim()===""?s.jsxs(Ae,{className:F("justify-between",x==null&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>O(null),children:["All chats",x==null?s.jsx(z,{name:"check",className:"size-3.5 shrink-0"}):null]}):null,M?s.jsx("p",{className:"px-2 py-3 text-center text-xs text-text-secondary",children:"Loading…"}):g.length===0?s.jsx("p",{className:"text-text-secondary px-2 py-6 text-center text-xs",role:"status",children:l.trim()?`No agents match "${l.trim()}".`:"No agents yet."}):s.jsxs(s.Fragment,{children:[g.map(I=>{const R=xn(I),E=(x==null?void 0:x.agentId)===R;return s.jsxs(Ae,{className:F("justify-between gap-2 text-left",E&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>O({agentId:R,agentName:I.name,intent:"history"}),children:[s.jsx("span",{className:"min-w-0 truncate",children:I.name}),E?s.jsx(z,{name:"check",className:"size-3.5 shrink-0"}):null]},R)}),P?s.jsx("div",{ref:A,className:"flex h-6 shrink-0 items-center justify-center","aria-hidden":!0,children:j?s.jsx("span",{className:"text-text-secondary text-[11px]",role:"status",children:"Loading more…"}):null}):null]})]})]});return s.jsxs("div",{className:"relative shrink-0",children:[s.jsxs("button",{ref:h,type:"button","aria-label":x!=null?`Filter chat history by agent (${x.agentName})`:"Filter chat history by agent","aria-haspopup":r?"dialog":"menu","aria-expanded":a,"aria-controls":a?p:void 0,title:"Filter by agent",className:re({variant:"ghost",size:"icon",className:F("relative size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text",x!=null&&"text-text-primary")}),onClick:()=>c(I=>!I),children:[s.jsx(z,{name:"funnel",className:"size-3.5"}),x!=null?s.jsx("span",{className:"bg-primary-button-bg absolute top-1 right-1 size-1.5 rounded-full","aria-hidden":!0,"data-testid":"history-filter-active-dot"}):null]}),r&&a?s.jsx(Ze,{open:!0,onOpenChange:c,id:p,"aria-label":"Filter agents",children:s.jsx("div",{className:"flex min-h-0 flex-1 flex-col p-2",role:"menu",children:D})}):null,!r&&a&&i!=null?gn.createPortal(s.jsx("div",{ref:f,id:p,role:"menu","aria-label":"Filter agents",style:{top:i.top,left:i.left},className:"aui-popup-enter font-sans-flex fixed z-50 w-56 rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md",children:D}),vn(h.current)):null]})}var Be="flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-failure-bg outline-none transition-colors hover:bg-failure-bg/12 hover:text-failure-bg focus:bg-failure-bg/12 focus:text-failure-bg data-[highlighted]:bg-failure-bg/12 data-[highlighted]:text-failure-bg";function Kr({disabled:n}){const e=T("PermissionGuard"),t=Qe(),o=Le(),[r,a]=d.useState(!1),[c,l]=d.useState(),u=o||t,i=d.useCallback(h=>{const f=h==null?void 0:h.closest(".aui-theme-root");l(f instanceof HTMLElement?f:void 0)},[]),m=re({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-text-secondary hover:bg-transparent hover:text-text-primary"});return u?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":"Session actions",title:"Session actions","aria-haspopup":"dialog","aria-expanded":r,className:m,onClick:()=>a(!0),children:s.jsx(z,{name:"ellipsis",className:"size-3.5"})}),r?s.jsx(Ze,{open:!0,onOpenChange:a,"aria-label":"Session actions",children:s.jsx("div",{className:"flex flex-col gap-1 p-2 *:w-full",role:"menu",children:s.jsx(e,{allowed:!n,children:s.jsxs(ve.Delete,{className:Be,onClick:()=>{n||a(!1)},children:[s.jsx(z,{name:"trash",className:"size-3.5"}),"Delete"]})})})}):null]}):s.jsxs(he.Root,{sharedFocusGroup:!0,children:[s.jsx(he.Trigger,{ref:i,"aria-label":"Session actions",title:"Session actions",className:m,children:s.jsx(z,{name:"ellipsis",className:"size-3.5"})}),s.jsx(he.Content,{portalProps:{container:c},align:"end",sideOffset:4,className:"aui-popup-enter font-sans-flex z-50 min-w-[8rem] rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md *:w-full",children:s.jsx(e,{allowed:!n,children:s.jsxs(ve.Delete,{className:Be,children:[s.jsx(z,{name:"trash",className:"size-3.5"}),"Delete"]})})})]})}function $r({onThreadOpen:n,canDeleteSession:e,canDeleteResource:t}){const o=G(),r=Z(),a=T("ThreadListRow"),c=S(g=>g.threadListItem.id),l=S(g=>g.threadListItem.remoteId),u=S(g=>g.threadListItem.title),i=S(g=>g.threadListItem.lastMessageAt),m=S(g=>g.threadListItem.custom),h=S(g=>g.threads.mainThreadId),f=dn(m),p=e&&l!=null,b=l!=null&&!t(l),x=(r==null?void 0:r.libraryOpen)===!0||(r==null?void 0:r.sessionsOpen)===!0||(r==null?void 0:r.schedulesOpen)===!0;return s.jsx(ve.Root,{className:"min-w-0",children:s.jsx(a,{title:u??"New Chat",active:c===h&&!x,agentName:f,lastMessageAt:i,onSelect:()=>{n==null||n(),r==null||r.setSettingsOpen(!1),r==null||r.setLibraryOpen(!1),r==null||r.setSessionsOpen(!1),r==null||r.setSchedulesOpen(!1);const g=mn(m),M=!g&&(r==null?void 0:r.mode.status)==="active"&&!r.mode.isMutable&&(f==null?r.mode.agentName==null&&r.mode.agentId==null:r.mode.agentName===f||r.mode.agentId===f),L=fn({sessionMutable:g,shellMutable:(r==null?void 0:r.mode.status)==="active"&&r.mode.isMutable,...(r==null?void 0:r.mode.status)==="active"&&r.mode.isMutable?{shellAgentName:r.mode.agentName,shellAgentId:r.mode.agentId}:{},remoteId:l,pendingSessionId:r==null?void 0:r.pendingSessionId});if((M||L)&&l!=null){Promise.resolve(o.threads().switchToThread(c)).catch(()=>{});return}if(l!=null){r==null||r.openHistorySession({sessionId:l,isMutable:g,...f!=null?{agentName:f}:{}});return}Promise.resolve(o.threads().switchToThread(c)).catch(()=>{})},actions:p?s.jsx(Kr,{disabled:b}):void 0})})}function zr(n){const e=S(o=>o.threads.threadIds),t=S(o=>o.threads.threadItems);return d.useMemo(()=>{const o=un({threadIds:e,threadItems:t});if(n==="default")return o;const r=new Map;for(const a of t)r.set(a.id,a),a.remoteId!=null&&r.set(a.remoteId,a);return o.filter(a=>{const c=e[a];if(c===void 0)return!1;const l=r.get(c);return(l==null?void 0:l.remoteId)!=null})},[e,t,n])}function Gr({indices:n,onThreadOpen:e,canDeleteSession:t,canDeleteResource:o}){const r=S(a=>a.threads.threadIds);return s.jsx(s.Fragment,{children:n.map(a=>{const c=r[a]??String(a);return s.jsx(Ce,{index:a,archived:!1,children:s.jsx($r,{onThreadOpen:e,canDeleteSession:t,canDeleteResource:o})},c)})})}var Hr="aui_thread-list-viewport",Ur=80;function Vr({children:n,viewportRef:e,hideScrollbar:t}){var u;const o=Z(),r=S(i=>i.threadListItem.remoteId),a=(u=o==null?void 0:o.historyAgentFilter)==null?void 0:u.intent,c=(o==null?void 0:o.isLibraryEnabled)===!0&&a!=="try-agent"&&(a==="history"||o.mode.status!=="active"||o.mode.isMutable||o.pendingSessionId!=null||r!=null),l=(o==null?void 0:o.historyAgentFilter)==null?"Chat History":`Chats for ${o.historyAgentFilter.agentName}`;return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-1 py-1",children:[s.jsx("h2",{className:"min-w-0 flex-1 truncate px-1.5 py-1 text-sm font-medium text-text-secondary",children:l}),c?s.jsx(Br,{}):null]}),s.jsx("div",{ref:e,"data-slot":Hr,className:F("flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",t&&"aui-scrollbar-hidden"),children:n})]})}function Wr({onThreadOpen:n,variant:e="default"}={}){const t=G(),o=qe(),r=S(w=>w.threads.isLoading),a=S(w=>w.threads.isLoadingMore),c=S(w=>w.threads.hasMore),l=S(w=>w.threads.threadIds),u=S(w=>w.threads.threadItems),i=Z(),m=T("ThreadListShell"),h=T("ThreadListNewButton"),f=T("AgentsLibraryButton"),p=T("SessionsBrowserButton"),b=T("SchedulesButton"),x=T("ThreadListRowSkeleton"),g=T("ThreadListEmptyState"),M=zr(e),L=d.useRef(null),j=d.useRef(c),P=d.useRef(t);j.current=c,P.current=t;const _=(i==null?void 0:i.isNewChatEnabled)!==!1,A=(i==null?void 0:i.mode.status)==="idle",O=e==="recent-history",D=typeof(o==null?void 0:o.deleteSession)=="function",I=d.useMemo(()=>u.flatMap(w=>w.remoteId==null?[]:[w.remoteId]),[u]),{allows:R}=ln({resourceType:"session",resourceIds:I});d.useEffect(()=>{if(A||r||a)return;const w=L.current;if(!w)return;let te=!1;const K=()=>{if(te||!j.current||w.clientHeight<=0)return;const de=w.scrollHeight-w.scrollTop-w.clientHeight;w.scrollHeight>w.clientHeight&&de>Ur||P.current.threads().loadMore()};w.addEventListener("scroll",K,{passive:!0});const U=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>K());return U?U.observe(w):window.addEventListener("resize",K),K(),()=>{te=!0,w.removeEventListener("scroll",K),U==null||U.disconnect(),U||window.removeEventListener("resize",K)}},[c,A,r,a,l.length]);const E=()=>{if(n==null||n(),i==null||i.setLibraryOpen(!1),i==null||i.setSessionsOpen(!1),i!=null&&i.isComposerEnabled){i.openDraft();return}i==null||i.setSettingsOpen(!1),i==null||i.setSchedulesOpen(!1),Promise.resolve(t.threads().switchToNewThread()).catch(()=>{})};let B;return A?B=s.jsx(g,{message:O?"No recent chats":void 0}):r?B=s.jsx(x,{}):M.length===0?B=s.jsx(g,{message:O?"No recent chats":void 0}):B=s.jsx(Pr.Root,{className:"flex min-h-0 flex-col gap-0.5",children:s.jsx(Gr,{indices:M,onThreadOpen:n,canDeleteSession:D,canDeleteResource:w=>R(w,"DELETE")})}),s.jsx(m,{header:O?null:s.jsxs("div",{className:"flex flex-col gap-1",children:[_?s.jsx(h,{onClick:E}):null,s.jsx(f,{}),s.jsx(p,{}),s.jsx(b,{})]}),children:s.jsxs(Vr,{viewportRef:L,hideScrollbar:O,children:[B,!A&&c?s.jsx("div",{className:"h-4 shrink-0","aria-hidden":!0}):null]})})}var Xr=d.lazy(()=>et(()=>import("./SettingsBuilder-6FJVZLJT-Drq1vNUK.js"),__vite__mapDeps([0,1,2]),import.meta.url)),Yr=d.lazy(()=>et(()=>import("./SchedulesPage-2G6F4XO6-CXGVFkK8.js"),__vite__mapDeps([3,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),qr="h-5 w-5 max-w-40 shrink-0 object-contain",Qr="w-20",Ke=F(Mn,"text-sidebar-text"),$e="bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";function Zr({overlayOpen:n,mode:e}){return!n&&(e==null?void 0:e.status)==="active"&&!e.isCreateAgent}function Jr(){var f;const n=G(),e=Z(),t=T("AgentsLibraryButton"),o=T("SessionsBrowserButton"),r=T("SchedulesButton"),a=(e==null?void 0:e.isNewChatEnabled)!==!1,c=(e==null?void 0:e.settingsOpen)===!0||(e==null?void 0:e.libraryOpen)===!0||(e==null?void 0:e.sessionsOpen)===!0||(e==null?void 0:e.schedulesOpen)===!0,l=e==null?void 0:e.mode,u=!c&&(l==null?void 0:l.status)==="active"&&!l.isCreateAgent&&((f=e==null?void 0:e.historyAgentFilter)==null?void 0:f.intent)!=="try-agent",i=!c&&l!=null&&Je(l),m=()=>{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(n.threads().switchToNewThread()).catch(()=>{})},h=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return s.jsxs("nav",{className:"flex min-h-0 flex-1 flex-col items-center gap-1 p-1","aria-label":"Sidebar",children:[a?s.jsxs("button",{type:"button","aria-label":"Start new chat",title:"New chat","aria-current":u?"page":void 0,className:re({variant:"ghost",className:F(Ke,u&&$e)}),onClick:m,children:[s.jsx(z,{name:"square-pen",size:14}),s.jsx("span",{className:"text-center",children:"New Chat"})]}):null,a&&(e!=null&&e.isComposerEnabled)?s.jsxs("button",{type:"button","aria-label":"Start new agent",title:"New Agent","aria-current":i?"page":void 0,className:re({variant:"ghost",className:F(Ke,i&&$e)}),onClick:h,children:[s.jsx(z,{name:"agent-2",size:14}),s.jsx("span",{className:"text-center whitespace-nowrap",children:"Build Agent"})]}):null,s.jsx(t,{compact:!0}),s.jsx(o,{compact:!0}),s.jsx(r,{compact:!0})]})}function ze({onNavigate:n,className:e,railRef:t,...o}){const r=In(),a=yn(r),c=T("BrandLogo"),l=T("UserAvatar");return s.jsxs("aside",{ref:t,className:F(Qr,"flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar-bg",e),onClick:u=>{if(n==null)return;const i=u.target;i instanceof Element&&i.closest("button")!=null&&n()},...o,children:[s.jsx("div",{className:"flex h-14 w-full shrink-0 items-center justify-center text-text-primary",children:s.jsx(c,{variant:a.collapsedVariant,className:qr})}),s.jsx(Jr,{}),s.jsxs("footer",{className:"flex shrink-0 flex-col items-center border-border p-2",children:[s.jsx(Tn,{labeled:!0,className:"flex-col"}),s.jsx(l,{labeled:!0,className:"mt-1"})]})]})}function cs({className:n}){const e=Z(),t=Le(),o=T("AgentDetailsPage"),r=T("AgentsLibrary"),a=T("SessionsPage"),c=T("ClearChatButton"),l=T("SaveAgentButton"),u=T("SelectAgentEmptyState"),[i,m]=d.useState(!1),h=d.useRef(null),f=d.useRef(null),p=d.useRef(null),b=d.useRef(!1),x=(e==null?void 0:e.mode.status)==="idle",g=(e==null?void 0:e.settingsOpen)===!0,M=(e==null?void 0:e.libraryOpen)===!0,L=(e==null?void 0:e.sessionsOpen)===!0,j=(e==null?void 0:e.schedulesOpen)===!0,P=g||M||L||j,_=e!=null&&Je(e.mode)&&!P&&(!t||e.agentConfigOpen),A=Zr({overlayOpen:P,mode:e==null?void 0:e.mode}),O=bn();return d.useEffect(()=>{if(!i)return;const D=I=>{I.key==="Escape"&&m(!1)};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[i]),d.useEffect(()=>{var I,R;const D=p.current;if(i){b.current=!0,D&&(D.inert=!0),(I=f.current)==null||I.focus();return}b.current&&(D&&(D.inert=!1),(R=h.current)==null||R.focus(),b.current=!1)},[i]),s.jsxs("div",{className:F("relative flex h-full min-h-0 w-full min-w-0",n),children:[s.jsx(ze,{className:"hidden md:flex"}),_?s.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:max-w-140 md:flex-1 md:shadow-none 2xl:max-w-150",children:s.jsx(Ln,{showClose:t})}):null,s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-primary-bg",children:[s.jsx(wn,{className:F("bg-topbar-bg",(P||x||!O)&&"md:hidden"),start:P?null:s.jsx("button",{ref:h,type:"button","aria-label":"Navigation","aria-expanded":i,className:F(re({variant:"ghost",size:"icon"}),"md:hidden"),onClick:()=>m(!0),children:s.jsx(z,{name:"bars"})}),title:P?null:s.jsx(Cn,{}),end:P?null:s.jsxs(s.Fragment,{children:[s.jsx(c,{}),s.jsx(l,{})]})}),s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[A?s.jsx("aside",{"aria-label":"Recent chats",className:"hidden min-h-0 w-64 shrink-0 border-r border-border bg-sidebar-bg md:flex",children:s.jsx(Wr,{variant:"recent-history"})}):null,s.jsx("div",{ref:p,className:"min-h-0 min-w-0 flex-1",children:g?s.jsx(d.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(Oe,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(Xr,{})}):L?s.jsx(a,{}):M&&(e==null?void 0:e.libraryAgentId)!=null?s.jsx(o,{agentId:e.libraryAgentId},e.libraryAgentId):M?s.jsx(r,{onSelectAgent:()=>m(!1)}):j?s.jsx(d.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(Oe,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(Yr,{})}):x?s.jsx(u,{}):s.jsx(jn,{})})]})]}),i?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-label":"Close navigation",className:"absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden",onClick:()=>m(!1)}),s.jsx(ze,{railRef:f,role:"dialog","aria-label":"Navigation",tabIndex:-1,onNavigate:()=>m(!1),className:"absolute inset-y-0 left-0 z-10 shadow-lg outline-none md:hidden"})]}):null]})}export{cs as SidebarLayout};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,j as o,T as a}from"./index-DVIyIfJR.js";import{r as m}from"./chunk-2QTH6JHX-DrgkYdZs.js";import{B as i}from"./chunk-62JRHF6Z-BrctyCH-.js";function p({routes:e,...s}){const r=t.useMemo(()=>m(e),[e]);return o.jsx(i,{basename:r.basename||void 0,children:o.jsx(a,{...s,resolvedRoutes:r})})}export{p as TrueForgeUIWithRouter};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as n,r as d,aT as se,a as D,c as p,aU as j,aV as oe,aW as re,aX as ae,aY as P,aZ as B,h as X,u as Y,a_ as E,a$ as ie,b0 as le,b1 as ce,b2 as ue,b3 as H,b4 as $,b5 as Z,b6 as de,i as J,b7 as z,b8 as Q,ab as me,b9 as pe,ba as fe,bb as ge,bc as he,bd as N,K as q,aS as xe,ag as ee,be,bf as ne,bg as Ce,bh as ve,bi as Se,bj as je,bk as Ae,bl as ye,g as Me,E as ke,m as te,s as Ie,bm as Re,bn as Te,bo as Ne,bp as we,I as O,d as _,e as w,bq as F,br as Ee,ac as Pe,bs as Le}from"./index-DVIyIfJR.js";function Oe(){var C;const{pending:o}=$(),e=be(),[t,i]=d.useState({approvalId:null,index:0}),a=d.useRef(null),r=o.length,u=t.approvalId==null?-1:o.findIndex(h=>h.approvalId===t.approvalId),l=u>=0?u:r===0?0:Math.min(t.index,r-1),s=(C=o[l])==null?void 0:C.approvalId;d.useEffect(()=>{const h=s??null;t.approvalId===h&&t.index===l||i({approvalId:h,index:l})},[s,l,t.approvalId,t.index]),d.useEffect(()=>{if(s==null||e==null){s==null&&(a.current=null);return}a.current!==s&&(a.current=s,e.focus(s))},[s,e]);const c=d.useCallback(()=>{var b;const h=Math.max(0,l-1);i({approvalId:((b=o[h])==null?void 0:b.approvalId)??null,index:h})},[o,l]),m=d.useCallback(()=>{var b;const h=Math.min(Math.max(r-1,0),l+1);i({approvalId:((b=o[h])==null?void 0:b.approvalId)??null,index:h})},[r,o,l]),g=d.useCallback(()=>{s==null||e==null||e.focus(s)},[s,e]);return{count:r,index:l,canPrev:l>0,canNext:l<r-1,goPrev:c,goNext:m,focusCurrent:g}}function De(){const o=p("ApprovalNavBanner"),{count:e,index:t,canPrev:i,canNext:a,goPrev:r,goNext:u,focusCurrent:l}=Oe();return e===0?null:n.jsx(o,{total:e,current:t+1,canPrev:i,canNext:a,onPrev:r,onNext:u,onFocusCurrent:l})}var L={radioValue:"",custom:""};function Ue({disabled:o=!1}){const e=p("AskUserPrompt"),{pending:t,respond:i}=H(),a=E(),r=t[0],u=d.useMemo(()=>r==null?[]:[{id:r.toolCallId,question:r.question??"Answer required",options:r.options??[]}],[r]),[l,s]=d.useState(0),[c,m]=d.useState({});d.useEffect(()=>{s(0),m({})},[r==null?void 0:r.toolCallId]);const g=Math.min(l,Math.max(u.length-1,0)),C=u[g],h=C==null?L:c[C.id]??L,b=d.useCallback(v=>{const x=c[v]??L;return x.radioValue===z?x.custom.trim():x.radioValue.trim()},[c]),A=d.useMemo(()=>u.every(v=>b(v.id)),[b,u]),y=h.radioValue===z?h.custom.trim():h.radioValue.trim(),S=a||o||C==null||y.length===0,k=S||!A,M=d.useCallback((v,x)=>{m(T=>({...T,[v]:{...T[v]??L,...x}}))},[]),R=d.useCallback(()=>{if(o||r==null||!A)return;const v=b(r.toolCallId);v&&i({toolCallId:r.toolCallId,content:v})},[A,o,b,r,i]);return r==null||C==null?null:n.jsx(e,{questions:u,readOnly:a||o,currentQuestion:C,currentQuestionIndex:g,currentAnswer:h,totalQuestions:u.length,isMultiQuestion:u.length>1,isLastQuestion:g===u.length-1,allQuestionsAnswered:A,isSubmitDisabled:S,isSubmitAllDisabled:k,onCurrentQuestionIndexChange:s,onCurrentAnswerChange:M,onSubmit:R})}function _e(o){var i,a,r;const e=o.thread.messages,t=e[e.length-1];return(t==null?void 0:t.role)!=="assistant"||((i=t.status)==null?void 0:i.type)!=="requires-action"?!1:((r=(a=t.metadata)==null?void 0:a.custom)==null?void 0:r.pendingMcpAuth)===!0}function Fe(){const o=j(_e),{pending:e}=H(),{pending:t}=$(),i=Z();if(o)return{kind:"mcp"};const a=e[0];if(a!=null){const r=a.toolName;return r!=null&&(i==null?void 0:i[r])!=null?{kind:"custom",toolName:r}:{kind:"ask-user"}}return t.length>0?{kind:"approval"}:{kind:"compose"}}function Be({disabled:o=!1}){const e=Z(),{pending:t,respond:i}=H(),a=E(),r=t[0],u=d.useCallback(s=>{if(o||r==null)return;const c=s.trim();c&&i({toolCallId:r.toolCallId,content:c})},[o,r,i]);if(r==null||r.toolName==null)return null;const l=e==null?void 0:e[r.toolName];return l==null?null:n.jsx(l,{args:r.args??{},disabled:a||o,onSubmit:u})}function He({servers:o,onContinue:e,readOnly:t}){const i=p("McpAuthPrompt"),{handleAuthorize:a}=xe(),{refreshConnectors:r}=ee(),u=l=>{a(l,s=>{s&&r()})};return n.jsx(i,{servers:o,onConnect:u,onContinue:e,readOnly:t})}function Ve({disabled:o=!1}){const e=p("McpAuthPrompt"),{pending:t,resume:i}=de(),a=E(),r=J();if(!t)return null;if(r)return n.jsx(He,{servers:t.mcpServers,onContinue:()=>{o||i()},readOnly:a||o});const u=l=>{const s=t.mcpServers.find(c=>c.id===l);s!=null&&s.authUrl&&window.open(s.authUrl,"_blank","noopener,noreferrer")};return n.jsx(e,{servers:t.mcpServers,onConnect:u,onContinue:()=>{o||i()},readOnly:a||o})}function ze({disabled:o,hasText:e,hasAttachments:t,requiresModel:i,hasModel:a}){return!o&&(e||t)&&(!i||a)}function W({placeholder:o,forceDisabled:e=!1,connectedToBanner:t=!1}){var R,v;const i=p("ComposerShell"),a=Y(),r=D(),u=j(x=>x.composer.text.trim().length>0),l=j(x=>x.composer.attachments.length>0),{agentSpec:s}=ne(),c=r==null||r.mode.status==="active"&&r.mode.isMutable,m=!!((v=(R=s==null?void 0:s.model)==null?void 0:R.name)!=null&&v.trim()),{isBusy:g,send:C,resetBusy:h}=Ce(),b=B(),A=ve(),y=d.useRef(null),S=g||e||!b,k=ze({disabled:S,hasText:u,hasAttachments:l,requiresModel:c,hasModel:m}),M=()=>{k&&C(()=>a.composer().send())};return n.jsxs(n.Fragment,{children:[n.jsx("input",{ref:y,type:"file",multiple:!0,hidden:!0,onChange:x=>{const T=x.target.files;if(T)for(const U of T)a.composer().addAttachment(U);x.target.value=""}}),n.jsx(N.AttachmentDropzone,{disabled:S,"data-slot":"aui_composer-attachment-dropzone",className:"w-full rounded-[0.75rem] transition-[box-shadow] data-[dragging=true]:ring-focus-ring/20 data-[dragging=true]:ring-3",children:n.jsx(N.Root,{"data-slot":"aui_composer-root",className:"w-full",onSubmit:x=>{x.preventDefault(),M()},children:n.jsx(i,{className:t?"rounded-t-none border-t-0 focus-within:ring-0":void 0,attachments:n.jsx(Se,{}),input:n.jsx(N.Input,{"data-slot":"aui_composer-input",placeholder:o,disabled:S,submitMode:"enter","aria-label":"Message input",className:"text-text-primary placeholder:text-text-secondary/80 max-h-[10lh] min-h-10 w-full resize-none overflow-y-auto rounded-lg border-none bg-transparent px-1 py-1 text-base leading-normal shadow-none outline-none disabled:cursor-not-allowed"}),disabled:S,canSubmit:k,isRunning:g&&!e,onSubmit:M,onCancel:b?()=>{h(),A()}:void 0,onAttach:b?()=>{var x;return(x=y.current)==null?void 0:x.click()}:void 0})})})]})}function G({placeholder:o,forceDisabled:e=!1,connectedToBanner:t=!1}){const i=D(),a=p("ComposerLeftSection"),r=p("ComposerRightSection"),u=Q("ComposerLeftSection"),l=Q("ComposerRightSection"),s=p("DraftComposerLeftSection"),c=p("DraftComposerRightSection");return(i==null?void 0:i.mode.status)==="active"&&i.mode.isMutable?n.jsx(me,{children:n.jsx(pe,{overrides:{ComposerLeftSection:u?s:a,ComposerRightSection:l?c:r},children:n.jsx(W,{placeholder:o,forceDisabled:e,connectedToBanner:t})})}):n.jsx(W,{placeholder:o,forceDisabled:e,connectedToBanner:t})}function Qe({placeholder:o="Ask anything... (Shift+Enter for new line)"}){const e=Fe(),t=B();return e.kind==="mcp"?n.jsx(Ve,{disabled:!t}):e.kind==="custom"?n.jsx(Be,{disabled:!t}):e.kind==="ask-user"?n.jsx(Ue,{disabled:!t}):e.kind==="approval"?n.jsxs("div",{"data-slot":"aui_composer-approval-pause",className:"flex w-full flex-col",children:[n.jsx(De,{}),n.jsx(G,{placeholder:o,forceDisabled:!0,connectedToBanner:!0})]}):n.jsx(G,{placeholder:o})}var qe=200,K='[data-slot="aui_thread-viewport"]';function We(){const o=p("HistoryLoader"),{hasOlderHistory:e,isLoadingOlderHistory:t,loadOlderHistory:i}=ie(),[a,r]=d.useState(null),u=d.useRef(!1),l=d.useCallback(async()=>{if(u.current)return;u.current=!0;const s=(a==null?void 0:a.closest(K))??null,c=(s==null?void 0:s.scrollHeight)??0,m=(s==null?void 0:s.scrollTop)??0;try{await i(),requestAnimationFrame(()=>{if(s==null)return;const g=s.scrollHeight-c;g>0&&s.scrollTo({top:m+g,behavior:"instant"})})}catch{}finally{u.current=!1}},[a,i]);return d.useEffect(()=>{if(a==null||!e)return;const s=a.closest(K),c=new IntersectionObserver(m=>{m.some(g=>g.isIntersecting)&&l()},{root:s,rootMargin:`${qe}px 0px 0px 0px`});return c.observe(a),()=>c.disconnect()},[a,e,l]),e?n.jsx(o,{ref:r,isLoading:t}):null}function Ge(){const o=p("ResumeUnavailable");return ue()?n.jsx(o,{}):null}function Ke(){return j(e=>{var t;return(((t=e.message.attachments)==null?void 0:t.length)??0)>0})?n.jsx("div",{className:"pointer-events-none mb-2 opacity-90",children:n.jsx(je,{})}):null}function Xe(){const o=p("UserMessageEdit"),e=p("MessageTimestamp"),t=E(),i=B(),a=j(s=>s.message.createdAt),{cancel:r,disabled:u}=fe(),{disabled:l}=ge();return n.jsx(he.Root,{"data-role":"user",children:n.jsx(N.Root,{"data-slot":"aui_user-edit-composer-root",className:"fade-in slide-in-from-bottom-1 animate-in flex w-full justify-end px-2 duration-150",children:n.jsx(o,{timestamp:n.jsx(e,{createdAt:a}),attachments:n.jsx(Ke,{}),input:n.jsx("div",{className:"mt-1 rounded border border-border bg-secondary-bg p-2 text-text-primary",children:n.jsx(N.Input,{"data-slot":"aui_user-edit-input",disabled:t||!i,submitMode:"enter","aria-label":"Edit message",className:"max-h-32 min-h-10 w-full resize-none border-none bg-transparent p-0 text-base leading-[1.34] outline-none focus:shadow-none"})}),footer:n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx(q.Secondary,{type:"button",disabled:u,onClick:r,children:"Cancel"}),n.jsx(N.Send,{asChild:!0,children:n.jsx(q.Primary,{type:"submit",disabled:l||t||!i,children:"Save & Rerun"})})]})})})})}function Ye(){const o=X(),e=Y(),t=j(l=>l.threadListItem.remoteId),i=j(l=>l.threadListItem.title),a=E(),r=d.useRef(!1),u=d.useRef(void 0);d.useEffect(()=>{u.current=void 0},[t]),d.useEffect(()=>{const l=r.current&&!a;if(r.current=a,!l||o==null||t==null||u.current===t)return;if(i!=null&&i.trim()!==""){u.current=t;return}let s=!1;return o.getSession({sessionId:t}).then(c=>{if(s)return;const m=typeof c.title=="string"?c.title.trim():"";if(m.length!==0)return u.current=t,e.threadListItem().rename(m)}).catch(()=>{}),()=>{s=!0}},[e,a,t,o,i])}function $e({children:o}){return n.jsx("div",{className:"animate-in fade-in slide-in-from-bottom-1 fill-mode-both duration-200",children:o})}function Ze({isEditing:o}){return j(t=>t.message.role)==="user"?o?n.jsx(Xe,{}):n.jsx(le,{}):n.jsx(ce,{})}function Je({composer:o}){d.useEffect(()=>{se()},[]),Ye();const e=D(),t=p("WelcomeScreen"),i=p("MessageListSkeleton"),a=p("ScrollToBottomButton"),r=p("MessageGroup"),u=p("ThreadComposerAreaShell"),l=p("ThreadRootShell"),s=p("ThreadViewportShell"),c=j(oe),m=j(C=>C.thread.isLoading),g=(e==null?void 0:e.mode.status)==="active"?e.mode.agentName!=null&&e.mode.agentName.length>0?e.mode.agentName:e.mode.isMutable&&e.mode.isCreateAgent?"Start building a new Agent":void 0:void 0;return n.jsx(re,{children:n.jsx(ae,{children:n.jsx(P.Root,{asChild:!0,children:n.jsxs(l,{children:[n.jsx(P.Viewport,{asChild:!0,autoScroll:!0,children:n.jsxs(s,{isEmpty:c,children:[c&&n.jsx(t,{heading:g}),c&&!m&&o,m?n.jsx(i,{}):!c&&n.jsxs(n.Fragment,{children:[n.jsx(We,{}),n.jsxs(r,{children:[n.jsx(P.Messages,{children:({message:C})=>n.jsx($e,{children:n.jsx(Ze,{isEditing:C.role==="user"&&C.composer.isEditing})})}),n.jsx(Ge,{})]})]})]})}),!m&&!c&&n.jsxs(u,{isEmpty:c,children:[n.jsx(P.ScrollToBottom,{asChild:!0,children:n.jsx(a,{})}),o]})]})})})})}function nn(){return n.jsx(Je,{composer:n.jsx(Qe,{})})}function tn({className:o}){const e=Ee(),t=j(r=>r.threadListItem.title);if(e===null)return null;const i=(t==null?void 0:t.trim())??"",a=e.allowThreadTitle&&i.length>0?i:e.name;return n.jsxs("h1",{className:w("flex min-w-0 items-center gap-1.5",Le,o),children:[n.jsx("span",{className:"truncate",title:a,children:a}),e.isEditing?n.jsx(Pe,{content:"Try changes here, then choose Update agent to save.",side:"bottom",children:n.jsxs("span",{className:"border-warning-bg/40 bg-warning-bg/10 text-warning-bg inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium",children:[n.jsx(O,{name:"pencil",className:"size-3"}),"Editing"]})}):null]})}function sn({className:o,labeled:e=!1}){const t=D(),i=J(),a=te(),{mode:r,setTheme:u}=Ne(),l=p("ShellActionsActionSlot"),s=r==="dark",c=s?"Light":"Dark",m=we({catalog:i,capabilities:a}),g="hover:bg-secondary-button-hover hover:text-ghost-button-text";return n.jsxs("div",{className:w("flex shrink-0 items-center gap-1",e?"w-full flex-col items-center gap-1 text-sidebar-text":"text-text-primary",o),children:[n.jsxs("a",{href:"https://trueforge.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"Documentation",title:"Documentation",className:_({variant:"ghost",size:e?void 0:"icon",className:w(g,e&&F)}),children:[n.jsx(O,{name:"book-open",size:e?14:void 0}),e?n.jsx("span",{className:"text-center",children:"Docs"}):null]}),n.jsxs("button",{type:"button","aria-label":s?"Switch to light theme":"Switch to dark theme",title:s?"Light theme":"Dark theme",className:_({variant:"ghost",size:e?void 0:"icon",className:w(g,e&&F)}),onClick:()=>u(s?"light":"dark"),children:[n.jsx(O,{name:s?"sun":"moon",size:e?14:void 0}),e?n.jsx("span",{className:"text-center",children:c}):null]}),t!=null&&m?n.jsxs("button",{type:"button","aria-label":"Settings",title:"Settings","aria-expanded":t.settingsOpen,"aria-current":t.settingsOpen?"page":void 0,className:_({variant:"ghost",size:e?void 0:"icon",className:w(g,e&&F,t.settingsOpen&&"bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text")}),onClick:()=>t.setSettingsOpen(!0),children:[n.jsx(O,{name:"settings",size:e?14:void 0}),e?n.jsx("span",{className:"text-center",children:"Settings"}):null]}):null,n.jsx(l,{})]})}function on({showClose:o=!1}){const{agentSpec:e}=ne(),t=Ae(),i=ye(),a=Me(),r=a.mode.status==="active"?a.mode.agentId:void 0,{allows:u}=ke({resourceType:"agent",resourceIds:r==null?[]:[r]}),l=u(r,"MANAGE"),s=X(),c=te(),m=ee(),g=p("AgentConfigPanel"),C=p("AgentConfigEditors"),[h,b]=d.useState(null),A=Ie(a.mode),{draft:y,flush:S}=Re(),k=d.useCallback(()=>{S(),i(),a.setAgentConfigOpen(!1)},[i,S,a]);d.useEffect(()=>{A&&m.ensureLoaded()},[m,A]),d.useEffect(()=>{l||b(null)},[l]),d.useEffect(()=>{if(!o||!a.agentConfigOpen)return;const f=I=>{!I.defaultPrevented&&I.key==="Escape"&&h===null&&document.querySelector("dialog[open]")===null&&k()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[k,h,a.agentConfigOpen,o]),d.useEffect(()=>()=>{S();try{i()}catch{}},[i,S]);const M=d.useCallback(({next:f,instructions:I})=>{var V;if(l){if(f.skills&&f.skills.length>0&&(c==null?void 0:c.sandbox.enabled)===!0){t==null||t({...f,instructions:I||void 0,config:{...f.config,sandbox:{...(V=f.config)==null?void 0:V.sandbox,enabled:!0}}});return}t==null||t({...f,instructions:I||void 0})}},[l,c==null?void 0:c.sandbox.enabled,t]),R=d.useCallback(f=>{M({next:f,instructions:y})},[M,y]),v=d.useCallback(f=>{e!==null&&M({next:Te({spec:e,messages:f.messages}),instructions:f.instructions})},[e,M]),x=d.useCallback(async f=>(s==null?void 0:s.getMcpTools)===void 0?[]:s.getMcpTools({connectorId:f}),[s]),T=d.useCallback(async f=>{var I;return(I=s==null?void 0:s.getMcpConnector)==null?void 0:I.call(s,{connectorId:f})},[s]);if(!A||e===null||o&&!a.agentConfigOpen)return null;const U=m.models.find(f=>f.name===e.model.name);return n.jsxs(n.Fragment,{children:[n.jsx(g,{spec:e,model:U,models:m.models,modelsLoading:m.loading,modelsError:m.error,skills:m.skills,skillsAvailable:(c==null?void 0:c.skill.enabled)===!0,instructions:y,onOpenEditor:f=>{l&&b(f)},onChange:R,disabled:!l,onClose:o?k:void 0}),n.jsx(C,{editor:h,spec:e,models:m.models,connectors:m.connectors,skills:m.skills,loading:m.loading,error:m.error,skillsDisabled:(c==null?void 0:c.skill.enabled)!==!0,sandboxAvailable:(c==null?void 0:c.sandbox.enabled)===!0,instructions:y,onInstructionsSave:v,...(s==null?void 0:s.getMcpConnector)===void 0?{}:{loadMcpConnector:T},loadMcpTools:x,onRefreshConnectors:m.refreshConnectors,onChange:R,onClose:()=>b(null)})]})}export{on as A,tn as N,sn as S,nn as T};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
�
|
|
2
|
v�!������|^��q�%�KS����U���`���m�������{��0�\B!;� �~:�¯���k��C(\#Pz(�%�{z`L$L�|��
|
|
3
|
-
�ʄ��U�V jӠ-�i̛�# �'�MALd�ֹy�6R,��X�eI��Q��z�P9�[-dm���8����k
|
|
4
|
-
J��)�����+��d�
|
|
5
|
-
בb�-�3
|
|
6
|
-
�]��&T�-�a�L0b�Q�P���tv5Ҋ��c�[U`��9J"��`R�w�\{�j��U��#ᄑ�0�r�� ���3��8oi2�
|
|
7
|
-
�ײ:C1߸�˭�E��t����:�)��,��y����֗�yR��Y����jz5gˤ�&TQ���qO�5���R���LW����(<�b��4��w#��e��Q�:<��ӉeM���f=����P]���?>3|�1�)�*�*XDS6r�r��=��@`K��D��(��@����2�p�>�D�P���L�b�kKH*B<�ֲ(�GzR� [V*��Ry�\��CPC�e��rE ��=�,�w26
|
|
8
|
-
�D'�Jk8�� �;,��F�x��g���)ƤDM�њ*B-Z�|���m}:̎U�д=��hy�;
|
|
9
|
-
�O#�&��"��C�++��vG+k���ta�'�����vo�f07���
|
|
10
|
-
X�Wk�}
|
|
11
|
-
7���~
|
|
Binary file
|
|
Binary file
|