@truefoundry/trueforge 0.2.0-rc.9 → 0.2.0

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.
Files changed (222) hide show
  1. package/dist/_frontend/assets/{AgentCodeSnippets-T7PR6PDP-BtYr0hCd.js → AgentCodeSnippets-EK7KMIY2-BSbWDfhX.js} +1 -1
  2. package/dist/_frontend/assets/AgentCodeSnippets-EK7KMIY2-BSbWDfhX.js.br +0 -0
  3. package/dist/_frontend/assets/AgentCodeSnippets-EK7KMIY2-BSbWDfhX.js.gz +0 -0
  4. package/dist/_frontend/assets/AgentMetricChart-UZCYOC4M-CoNlyHRt.js +1 -0
  5. package/dist/_frontend/assets/AgentMetricChart-UZCYOC4M-CoNlyHRt.js.br +0 -0
  6. package/dist/_frontend/assets/AgentMetricChart-UZCYOC4M-CoNlyHRt.js.gz +0 -0
  7. package/dist/_frontend/assets/AgentOverview-5UPMYHT2-WRvNQCHH.js +1 -0
  8. package/dist/_frontend/assets/AgentOverview-5UPMYHT2-WRvNQCHH.js.br +0 -0
  9. package/dist/_frontend/assets/AgentOverview-5UPMYHT2-WRvNQCHH.js.gz +0 -0
  10. package/dist/_frontend/assets/{AgentSessionEventTimeline-SETKGGCI-T0eprzt1.js → AgentSessionEventTimeline-V6NPCYMW-D5pZyPP1.js} +1 -1
  11. package/dist/_frontend/assets/AgentSessionEventTimeline-V6NPCYMW-D5pZyPP1.js.br +0 -0
  12. package/dist/_frontend/assets/AgentSessionEventTimeline-V6NPCYMW-D5pZyPP1.js.gz +0 -0
  13. package/dist/_frontend/assets/{AgentSessionEventTimelineChart-4Y7PY5SJ-Bp3PJ8em.js → AgentSessionEventTimelineChart-YQWZBQCG-CqBkdMKC.js} +1 -1
  14. package/dist/_frontend/assets/AgentSessionEventTimelineChart-YQWZBQCG-CqBkdMKC.js.br +0 -0
  15. package/dist/_frontend/assets/AgentSessionEventTimelineChart-YQWZBQCG-CqBkdMKC.js.gz +0 -0
  16. package/dist/_frontend/assets/AgentSessions-WNYVVB6Q-DIwFNwFg.js +1 -0
  17. package/dist/_frontend/assets/AgentSessions-WNYVVB6Q-DIwFNwFg.js.br +0 -0
  18. package/dist/_frontend/assets/AgentSessions-WNYVVB6Q-DIwFNwFg.js.gz +0 -0
  19. package/dist/_frontend/assets/ConnectorSettings-O4I24244-22M_-mC7.js +1 -0
  20. package/dist/_frontend/assets/ConnectorSettings-O4I24244-22M_-mC7.js.br +0 -0
  21. package/dist/_frontend/assets/ConnectorSettings-O4I24244-22M_-mC7.js.gz +0 -0
  22. package/dist/_frontend/assets/{DockLayout-JRKCKAG2-bJF_JL96.js → DockLayout-JMBZVMGB-C-VR3Ee2.js} +1 -1
  23. package/dist/_frontend/assets/{DrawerLayout-U7YPUZBR-EBVDvExP.js → DrawerLayout-E6G3IF6R-D8RZ3D7u.js} +2 -2
  24. package/dist/_frontend/assets/DrawerLayout-E6G3IF6R-D8RZ3D7u.js.br +0 -0
  25. package/dist/_frontend/assets/DrawerLayout-E6G3IF6R-D8RZ3D7u.js.gz +0 -0
  26. package/dist/_frontend/assets/{ModelSettings-VXYMJEMO-YOyVspML.js → ModelSettings-ZVXMXIU4-CTVBWR_b.js} +1 -1
  27. package/dist/_frontend/assets/ModelSettings-ZVXMXIU4-CTVBWR_b.js.br +0 -0
  28. package/dist/_frontend/assets/ModelSettings-ZVXMXIU4-CTVBWR_b.js.gz +0 -0
  29. package/dist/_frontend/assets/SandboxSettings-H6BA2DJQ-ZI6uU_-B.js +1 -0
  30. package/dist/_frontend/assets/SandboxSettings-H6BA2DJQ-ZI6uU_-B.js.br +0 -0
  31. package/dist/_frontend/assets/SandboxSettings-H6BA2DJQ-ZI6uU_-B.js.gz +0 -0
  32. package/dist/_frontend/assets/SchedulesPage-FS2QZ5KB-rgCfvw8i.js +1 -0
  33. package/dist/_frontend/assets/SchedulesPage-FS2QZ5KB-rgCfvw8i.js.br +0 -0
  34. package/dist/_frontend/assets/SchedulesPage-FS2QZ5KB-rgCfvw8i.js.gz +0 -0
  35. package/dist/_frontend/assets/{SettingsBuilder-6FJVZLJT-Drq1vNUK.js → SettingsBuilder-VA3VGWZC-DIAqWtHn.js} +2 -2
  36. package/dist/_frontend/assets/SettingsBuilder-VA3VGWZC-DIAqWtHn.js.br +0 -0
  37. package/dist/_frontend/assets/SettingsBuilder-VA3VGWZC-DIAqWtHn.js.gz +0 -0
  38. package/dist/_frontend/assets/{ShellRouteSync-SJXFKUAJ-Yi-uh3fh.js → ShellRouteSync-ZT4PBE6T-DkGPKx4y.js} +1 -1
  39. package/dist/_frontend/assets/ShellRouteSync-ZT4PBE6T-DkGPKx4y.js.br +0 -0
  40. package/dist/_frontend/assets/ShellRouteSync-ZT4PBE6T-DkGPKx4y.js.gz +0 -0
  41. package/dist/_frontend/assets/{SidebarLayout-EQ7EYCWR-D-Rd9Wui.js → SidebarLayout-ICXEN7ZL--zbCMgyI.js} +2 -2
  42. package/dist/_frontend/assets/SidebarLayout-ICXEN7ZL--zbCMgyI.js.br +0 -0
  43. package/dist/_frontend/assets/SidebarLayout-ICXEN7ZL--zbCMgyI.js.gz +0 -0
  44. package/dist/_frontend/assets/{SkillSettings-IHVI7FDM-DEkrBUBp.js → SkillSettings-F5JGGFXR-Bz-nW3QX.js} +1 -1
  45. package/dist/_frontend/assets/SkillSettings-F5JGGFXR-Bz-nW3QX.js.br +0 -0
  46. package/dist/_frontend/assets/SkillSettings-F5JGGFXR-Bz-nW3QX.js.gz +0 -0
  47. package/dist/_frontend/assets/TrueForgeUIWithRouter-MKJ7IEWG-DwIPuROH.js +1 -0
  48. package/dist/_frontend/assets/{WidgetLayout-PN5ZDOLM-CcGUI6sr.js → WidgetLayout-J7ZRW3V3-DYDWODqy.js} +1 -1
  49. package/dist/_frontend/assets/WidgetLayout-J7ZRW3V3-DYDWODqy.js.br +0 -0
  50. package/dist/_frontend/assets/WidgetLayout-J7ZRW3V3-DYDWODqy.js.gz +0 -0
  51. package/dist/_frontend/assets/{chunk-62JRHF6Z-BrctyCH-.js → chunk-62JRHF6Z-CtriJkXR.js} +1 -1
  52. package/dist/_frontend/assets/chunk-62JRHF6Z-CtriJkXR.js.br +0 -0
  53. package/dist/_frontend/assets/chunk-62JRHF6Z-CtriJkXR.js.gz +0 -0
  54. package/dist/_frontend/assets/chunk-7VWUB5OV-DTCqM7Y6.js +1 -0
  55. package/dist/_frontend/assets/chunk-7VWUB5OV-DTCqM7Y6.js.br +0 -0
  56. package/dist/_frontend/assets/chunk-7VWUB5OV-DTCqM7Y6.js.gz +0 -0
  57. package/dist/_frontend/assets/{chunk-2QTH6JHX-DrgkYdZs.js → chunk-JEAULQNF-BD5-zY_K.js} +1 -1
  58. package/dist/_frontend/assets/chunk-JEAULQNF-BD5-zY_K.js.br +0 -0
  59. package/dist/_frontend/assets/chunk-JEAULQNF-BD5-zY_K.js.gz +0 -0
  60. package/dist/_frontend/assets/{chunk-2UBSLCKB-Bq4rnsqJ.js → chunk-MB7Z5FPI-CyN2m3rd.js} +2 -2
  61. package/dist/_frontend/assets/chunk-MB7Z5FPI-CyN2m3rd.js.br +0 -0
  62. package/dist/_frontend/assets/chunk-MB7Z5FPI-CyN2m3rd.js.gz +0 -0
  63. package/dist/_frontend/assets/{cssMode-jP6sLsrL.js → cssMode-C-8VzKP7.js} +1 -1
  64. package/dist/_frontend/assets/cssMode-C-8VzKP7.js.br +0 -0
  65. package/dist/_frontend/assets/cssMode-C-8VzKP7.js.gz +0 -0
  66. package/dist/_frontend/assets/{freemarker2-Dbeghe9Y.js → freemarker2-DDwuEFeX.js} +1 -1
  67. package/dist/_frontend/assets/freemarker2-DDwuEFeX.js.br +0 -0
  68. package/dist/_frontend/assets/freemarker2-DDwuEFeX.js.gz +0 -0
  69. package/dist/_frontend/assets/{handlebars-DTmlyeUV.js → handlebars-DqPfTAei.js} +1 -1
  70. package/dist/_frontend/assets/handlebars-DqPfTAei.js.br +0 -0
  71. package/dist/_frontend/assets/handlebars-DqPfTAei.js.gz +0 -0
  72. package/dist/_frontend/assets/{html-CjOPMUvl.js → html-D0gOfqP6.js} +1 -1
  73. package/dist/_frontend/assets/html-D0gOfqP6.js.br +0 -0
  74. package/dist/_frontend/assets/html-D0gOfqP6.js.gz +0 -0
  75. package/dist/_frontend/assets/{htmlMode-lgosNfbL.js → htmlMode-gx5Bk3tY.js} +1 -1
  76. package/dist/_frontend/assets/htmlMode-gx5Bk3tY.js.br +6 -0
  77. package/dist/_frontend/assets/htmlMode-gx5Bk3tY.js.gz +0 -0
  78. package/dist/_frontend/assets/{index-CF_3sCub.js → index-BWMZWgYr.js} +1 -1
  79. package/dist/_frontend/assets/index-BWMZWgYr.js.br +0 -0
  80. package/dist/_frontend/assets/index-BWMZWgYr.js.gz +0 -0
  81. package/dist/_frontend/assets/{index-Du3lx1aS.js → index-Djblv9e3.js} +3 -3
  82. package/dist/_frontend/assets/index-Djblv9e3.js.br +0 -0
  83. package/dist/_frontend/assets/index-Djblv9e3.js.gz +0 -0
  84. package/dist/_frontend/assets/{index-DVIyIfJR.js → index-JWYDBa7W.js} +257 -247
  85. package/dist/_frontend/assets/index-JWYDBa7W.js.br +0 -0
  86. package/dist/_frontend/assets/index-JWYDBa7W.js.gz +0 -0
  87. package/dist/_frontend/assets/{javascript-DiHw3Eat.js → javascript-DVPzhVD0.js} +1 -1
  88. package/dist/_frontend/assets/{jsonMode-DHUA2y1U.js → jsonMode-GEdzVuNq.js} +1 -1
  89. package/dist/_frontend/assets/jsonMode-GEdzVuNq.js.br +0 -0
  90. package/dist/_frontend/assets/jsonMode-GEdzVuNq.js.gz +0 -0
  91. package/dist/_frontend/assets/{liquid-CprftmsS.js → liquid-BItsX3iF.js} +1 -1
  92. package/dist/_frontend/assets/liquid-BItsX3iF.js.br +0 -0
  93. package/dist/_frontend/assets/liquid-BItsX3iF.js.gz +0 -0
  94. package/dist/_frontend/assets/{lspLanguageFeatures-gYxt31s1.js → lspLanguageFeatures-Cus-UaLQ.js} +1 -1
  95. package/dist/_frontend/assets/lspLanguageFeatures-Cus-UaLQ.js.br +0 -0
  96. package/dist/_frontend/assets/lspLanguageFeatures-Cus-UaLQ.js.gz +0 -0
  97. package/dist/_frontend/assets/{mdx-h6Mzhp-3.js → mdx-DKtnK9lB.js} +1 -1
  98. package/dist/_frontend/assets/mdx-DKtnK9lB.js.br +0 -0
  99. package/dist/_frontend/assets/mdx-DKtnK9lB.js.gz +0 -0
  100. package/dist/_frontend/assets/{python-Fgw1BN-I.js → python-BTjir3x0.js} +1 -1
  101. package/dist/_frontend/assets/python-BTjir3x0.js.br +0 -0
  102. package/dist/_frontend/assets/python-BTjir3x0.js.gz +0 -0
  103. package/dist/_frontend/assets/{razor-u10uqgtH.js → razor-BW5FLKz0.js} +1 -1
  104. package/dist/_frontend/assets/razor-BW5FLKz0.js.br +0 -0
  105. package/dist/_frontend/assets/razor-BW5FLKz0.js.gz +0 -0
  106. package/dist/_frontend/assets/{tsMode-DQQ14WKr.js → tsMode-D_fZmsMS.js} +1 -1
  107. package/dist/_frontend/assets/tsMode-D_fZmsMS.js.br +0 -0
  108. package/dist/_frontend/assets/tsMode-D_fZmsMS.js.gz +0 -0
  109. package/dist/_frontend/assets/{typescript-mwUa5zn0.js → typescript-CGtHZQss.js} +1 -1
  110. package/dist/_frontend/assets/typescript-CGtHZQss.js.br +0 -0
  111. package/dist/_frontend/assets/typescript-CGtHZQss.js.gz +0 -0
  112. package/dist/_frontend/assets/{workers-CZKhoZKF.js → workers-pKgmUfu_.js} +1 -1
  113. package/dist/_frontend/assets/workers-pKgmUfu_.js.br +0 -0
  114. package/dist/_frontend/assets/workers-pKgmUfu_.js.gz +0 -0
  115. package/dist/_frontend/assets/{xml-CZ3_PIeb.js → xml-BhrTu8Vy.js} +1 -1
  116. package/dist/_frontend/assets/xml-BhrTu8Vy.js.br +0 -0
  117. package/dist/_frontend/assets/xml-BhrTu8Vy.js.gz +0 -0
  118. package/dist/_frontend/assets/{yaml-DBARGNE3.js → yaml-G9x_AjyZ.js} +1 -1
  119. package/dist/_frontend/assets/yaml-G9x_AjyZ.js.br +0 -0
  120. package/dist/_frontend/assets/yaml-G9x_AjyZ.js.gz +0 -0
  121. package/dist/_frontend/index.html +1 -1
  122. package/dist/controller-main.js +175 -74
  123. package/dist/controller-main.js.map +1 -1
  124. package/dist/main.js +1374 -776
  125. package/dist/main.js.map +1 -1
  126. package/dist/postgres/migrations/20260727_000001_init.js +549 -4
  127. package/dist/postgres/migrations/20260727_000001_init.js.map +1 -1
  128. package/dist/postgres/migrations/20260916_000001_agent_web_search.js +28 -0
  129. package/dist/postgres/migrations/20260916_000001_agent_web_search.js.map +1 -0
  130. package/dist/postgres/migrations/20260918_000001_turn_active_executor_id.js +32 -0
  131. package/dist/postgres/migrations/20260918_000001_turn_active_executor_id.js.map +1 -0
  132. package/dist/sqlite/migrations/20260916_000001_agent_web_search.js +28 -0
  133. package/dist/sqlite/migrations/20260916_000001_agent_web_search.js.map +1 -0
  134. package/dist/sqlite/migrations/20260918_000001_turn_active_executor_id.js +33 -0
  135. package/dist/sqlite/migrations/20260918_000001_turn_active_executor_id.js.map +1 -0
  136. package/package.json +4 -4
  137. package/dist/_frontend/assets/AgentCodeSnippets-T7PR6PDP-BtYr0hCd.js.br +0 -0
  138. package/dist/_frontend/assets/AgentCodeSnippets-T7PR6PDP-BtYr0hCd.js.gz +0 -0
  139. package/dist/_frontend/assets/AgentMetricChart-J3RCSCAG-BeGf38SC.js +0 -1
  140. package/dist/_frontend/assets/AgentMetricChart-J3RCSCAG-BeGf38SC.js.br +0 -0
  141. package/dist/_frontend/assets/AgentMetricChart-J3RCSCAG-BeGf38SC.js.gz +0 -0
  142. package/dist/_frontend/assets/AgentOverview-WC7WMNMS-Mem5rK6Y.js +0 -1
  143. package/dist/_frontend/assets/AgentOverview-WC7WMNMS-Mem5rK6Y.js.br +0 -0
  144. package/dist/_frontend/assets/AgentOverview-WC7WMNMS-Mem5rK6Y.js.gz +0 -0
  145. package/dist/_frontend/assets/AgentSessionEventTimeline-SETKGGCI-T0eprzt1.js.br +0 -0
  146. package/dist/_frontend/assets/AgentSessionEventTimeline-SETKGGCI-T0eprzt1.js.gz +0 -0
  147. package/dist/_frontend/assets/AgentSessionEventTimelineChart-4Y7PY5SJ-Bp3PJ8em.js.br +0 -0
  148. package/dist/_frontend/assets/AgentSessionEventTimelineChart-4Y7PY5SJ-Bp3PJ8em.js.gz +0 -0
  149. package/dist/_frontend/assets/AgentSessions-YCAPM5GK-BA8KqWPB.js +0 -1
  150. package/dist/_frontend/assets/AgentSessions-YCAPM5GK-BA8KqWPB.js.br +0 -0
  151. package/dist/_frontend/assets/AgentSessions-YCAPM5GK-BA8KqWPB.js.gz +0 -0
  152. package/dist/_frontend/assets/ConnectorSettings-PXWRCFAL-Dgi-SPKS.js +0 -1
  153. package/dist/_frontend/assets/ConnectorSettings-PXWRCFAL-Dgi-SPKS.js.br +0 -0
  154. package/dist/_frontend/assets/ConnectorSettings-PXWRCFAL-Dgi-SPKS.js.gz +0 -0
  155. package/dist/_frontend/assets/DrawerLayout-U7YPUZBR-EBVDvExP.js.br +0 -0
  156. package/dist/_frontend/assets/DrawerLayout-U7YPUZBR-EBVDvExP.js.gz +0 -0
  157. package/dist/_frontend/assets/ModelSettings-VXYMJEMO-YOyVspML.js.br +0 -0
  158. package/dist/_frontend/assets/ModelSettings-VXYMJEMO-YOyVspML.js.gz +0 -0
  159. package/dist/_frontend/assets/SandboxSettings-6DRUH72J-B_nMtkgp.js +0 -1
  160. package/dist/_frontend/assets/SandboxSettings-6DRUH72J-B_nMtkgp.js.br +0 -0
  161. package/dist/_frontend/assets/SandboxSettings-6DRUH72J-B_nMtkgp.js.gz +0 -0
  162. package/dist/_frontend/assets/SchedulesPage-2G6F4XO6-CXGVFkK8.js +0 -1
  163. package/dist/_frontend/assets/SchedulesPage-2G6F4XO6-CXGVFkK8.js.br +0 -0
  164. package/dist/_frontend/assets/SchedulesPage-2G6F4XO6-CXGVFkK8.js.gz +0 -0
  165. package/dist/_frontend/assets/SettingsBuilder-6FJVZLJT-Drq1vNUK.js.br +0 -0
  166. package/dist/_frontend/assets/SettingsBuilder-6FJVZLJT-Drq1vNUK.js.gz +0 -0
  167. package/dist/_frontend/assets/ShellRouteSync-SJXFKUAJ-Yi-uh3fh.js.br +0 -0
  168. package/dist/_frontend/assets/ShellRouteSync-SJXFKUAJ-Yi-uh3fh.js.gz +0 -0
  169. package/dist/_frontend/assets/SidebarLayout-EQ7EYCWR-D-Rd9Wui.js.br +0 -0
  170. package/dist/_frontend/assets/SidebarLayout-EQ7EYCWR-D-Rd9Wui.js.gz +0 -0
  171. package/dist/_frontend/assets/SkillSettings-IHVI7FDM-DEkrBUBp.js.br +0 -0
  172. package/dist/_frontend/assets/SkillSettings-IHVI7FDM-DEkrBUBp.js.gz +0 -0
  173. package/dist/_frontend/assets/TrueForgeUIWithRouter-5OJFI3PF-BXv2aJab.js +0 -1
  174. package/dist/_frontend/assets/WidgetLayout-PN5ZDOLM-CcGUI6sr.js.br +0 -0
  175. package/dist/_frontend/assets/WidgetLayout-PN5ZDOLM-CcGUI6sr.js.gz +0 -0
  176. package/dist/_frontend/assets/chunk-2QTH6JHX-DrgkYdZs.js.br +0 -0
  177. package/dist/_frontend/assets/chunk-2QTH6JHX-DrgkYdZs.js.gz +0 -0
  178. package/dist/_frontend/assets/chunk-2UBSLCKB-Bq4rnsqJ.js.br +0 -0
  179. package/dist/_frontend/assets/chunk-2UBSLCKB-Bq4rnsqJ.js.gz +0 -0
  180. package/dist/_frontend/assets/chunk-62JRHF6Z-BrctyCH-.js.br +0 -0
  181. package/dist/_frontend/assets/chunk-62JRHF6Z-BrctyCH-.js.gz +0 -0
  182. package/dist/_frontend/assets/chunk-PX6MNNN3-DWHQBAi-.js +0 -1
  183. package/dist/_frontend/assets/chunk-PX6MNNN3-DWHQBAi-.js.br +0 -0
  184. package/dist/_frontend/assets/chunk-PX6MNNN3-DWHQBAi-.js.gz +0 -0
  185. package/dist/_frontend/assets/cssMode-jP6sLsrL.js.br +0 -0
  186. package/dist/_frontend/assets/cssMode-jP6sLsrL.js.gz +0 -0
  187. package/dist/_frontend/assets/freemarker2-Dbeghe9Y.js.br +0 -0
  188. package/dist/_frontend/assets/freemarker2-Dbeghe9Y.js.gz +0 -0
  189. package/dist/_frontend/assets/handlebars-DTmlyeUV.js.br +0 -0
  190. package/dist/_frontend/assets/handlebars-DTmlyeUV.js.gz +0 -0
  191. package/dist/_frontend/assets/html-CjOPMUvl.js.br +0 -0
  192. package/dist/_frontend/assets/html-CjOPMUvl.js.gz +0 -0
  193. package/dist/_frontend/assets/htmlMode-lgosNfbL.js.br +0 -10
  194. package/dist/_frontend/assets/htmlMode-lgosNfbL.js.gz +0 -0
  195. package/dist/_frontend/assets/index-CF_3sCub.js.br +0 -0
  196. package/dist/_frontend/assets/index-CF_3sCub.js.gz +0 -0
  197. package/dist/_frontend/assets/index-DVIyIfJR.js.br +0 -0
  198. package/dist/_frontend/assets/index-DVIyIfJR.js.gz +0 -0
  199. package/dist/_frontend/assets/index-Du3lx1aS.js.br +0 -0
  200. package/dist/_frontend/assets/index-Du3lx1aS.js.gz +0 -0
  201. package/dist/_frontend/assets/jsonMode-DHUA2y1U.js.br +0 -0
  202. package/dist/_frontend/assets/jsonMode-DHUA2y1U.js.gz +0 -0
  203. package/dist/_frontend/assets/liquid-CprftmsS.js.br +0 -0
  204. package/dist/_frontend/assets/liquid-CprftmsS.js.gz +0 -0
  205. package/dist/_frontend/assets/lspLanguageFeatures-gYxt31s1.js.br +0 -0
  206. package/dist/_frontend/assets/lspLanguageFeatures-gYxt31s1.js.gz +0 -0
  207. package/dist/_frontend/assets/mdx-h6Mzhp-3.js.br +0 -0
  208. package/dist/_frontend/assets/mdx-h6Mzhp-3.js.gz +0 -0
  209. package/dist/_frontend/assets/python-Fgw1BN-I.js.br +0 -0
  210. package/dist/_frontend/assets/python-Fgw1BN-I.js.gz +0 -0
  211. package/dist/_frontend/assets/razor-u10uqgtH.js.br +0 -0
  212. package/dist/_frontend/assets/razor-u10uqgtH.js.gz +0 -0
  213. package/dist/_frontend/assets/tsMode-DQQ14WKr.js.br +0 -0
  214. package/dist/_frontend/assets/tsMode-DQQ14WKr.js.gz +0 -0
  215. package/dist/_frontend/assets/typescript-mwUa5zn0.js.br +0 -0
  216. package/dist/_frontend/assets/typescript-mwUa5zn0.js.gz +0 -0
  217. package/dist/_frontend/assets/workers-CZKhoZKF.js.br +0 -0
  218. package/dist/_frontend/assets/workers-CZKhoZKF.js.gz +0 -0
  219. package/dist/_frontend/assets/xml-CZ3_PIeb.js.br +0 -0
  220. package/dist/_frontend/assets/xml-CZ3_PIeb.js.gz +0 -0
  221. package/dist/_frontend/assets/yaml-DBARGNE3.js.br +0 -0
  222. package/dist/_frontend/assets/yaml-DBARGNE3.js.gz +0 -0
@@ -0,0 +1 @@
1
+ import{L as ge,M as Le,N as be,r as l,O as xe,Q as Se,J as pe,R as Qe,j as e,P as We,U as Ke,V as ce,q as ue,W as q,I as R,X as Ye,Y as ke,Z as Te,$ as Ze,a0 as Je,a1 as Ce,a2 as J,a3 as Xe,a4 as X,a5 as et,a6 as tt,a7 as st,a8 as nt,a9 as at,aa as rt,ab as lt,ac as it,ad as ot,e as $,ae as Ee,af as ct,ag as dt,ah as ut,c as mt,ai as xt,aj as me,d as ht,ak as ft,E as gt,a as bt,al as pt,am as Nt,an as yt,ao as jt,ap as ze,i as vt,aq as wt}from"./index-JWYDBa7W.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),H=l.useId(),{agents:A,isInitialLoading:F,isSearching:v,loadingMore:W,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()},K=()=>{b!=null&&(i(b.value),O())},P=u?j:s,U=j.trim(),V=!F&&D!=null,L=!F&&D==null&&A.length===0&&U==="",Q=!F&&D==null&&A.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:H,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:K,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:b.label}),e.jsx(R,{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"}):Q?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,A.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(R,{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:W?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(q.Ghost,{type:"button",onClick:d,children:[e.jsx(R,{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?H: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(R,{name:"chevron-down",className:"size-4 shrink-0 text-text-secondary"})]}),ee]})}var Re=[{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(Re.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}])),...Re]}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 Ae(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")})),Rt=[0,15,30,45].map(t=>({value:String(t),label:`:${t.toString().padStart(2,"0")}`}));function At({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:Rt,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(R,{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(R,{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(q.Secondary,{type:"button",size:"small",onClick:a,children:[e.jsx(R,{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,H=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(R,{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"}):H?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(q.Primary,{type:"button",disabled:p,size:"small",onClick:()=>void g(),children:[e.jsx(R,{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),[H,A]=l.useState(!1),[F,v]=l.useState(null),W=l.useRef(j);W.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"}),A(!1);return}if(i==="edit"&&a!=null){p(Ae({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||W.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:""),K=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(Ae({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"){A(!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{A(!1)}}},Q=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(q.Secondary,{type:"button",className:"w-full",disabled:H,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(q.Secondary,{type:"button",onClick:()=>s(!1),disabled:C,children:"Cancel"}),e.jsx(q.Primary,{type:"submit",form:"schedule-form",disabled:!P||C,children:"Save"})]})]}),e.jsx(yt,{open:t,onOpenChange:s,title:Q,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(R,{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:K,onEditConfiguration:()=>{v(null),k({kind:"form",saved:g.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:c=>void V(c),children:e.jsx(At,{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 qt(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 Ht({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(q.Secondary,{type:"button",disabled:s,"aria-label":`Run now ${t.name}`,size:"large",onClick:r,children:[e.jsx(R,{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(R,{name:"ellipsis"})}),children:[e.jsx(m,{allowed:i,children:e.jsxs(me,{onClick:d,children:[e.jsx(R,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(m,{allowed:i,children:e.jsxs(me,{onClick:b,children:[e.jsx(R,{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(R,{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,H]=l.useState(()=>oe(window.location.search).nameQuery),[A,F]=l.useState(()=>oe(window.location.search).statusFilter),[v,W]=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(()=>qt(t)),[_,K]=l.useState(null),[P,U]=l.useState(()=>ie(lt)),[V,L]=l.useState(void 0),[Q,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:A==="all"?null:A,q:z.trim().length===0?null:z})},[v,t,A,z]),l.useEffect(()=>{t!==void 0&&W(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);H(x.nameQuery),F(x.statusFilter),W(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=>!(A!=="all"&&x.status!==A||n.length>0&&!x.name.toLowerCase().includes(n)))},[r,z,A]),ye=Qe(r),je=h.length>0||Q!=null,qe=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)}},He=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")){K(null);try{await s.deleteSchedule({id:n.id}),Ne()}catch(x){a==null||a.showError(x)}}},ve=()=>{Q!=null&&(c(n=>[...n,V??""]),L(Q))},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(We,{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(Ke,{query:z,setQuery:H,placeholder:"Search schedules by name"})}),e.jsx(ce,{value:A,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=>{W(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(q.Primary,{type:"button",disabled:!I,onClick:()=>I&&O({kind:"create",agentId:v!=="all"?v:void 0}),children:[e.jsx(R,{name:"plus",className:"size-3.5"}),"New 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:Q!=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(Ht,{schedule:n,running:p.has(n.id),canManage:b(n.id,"MANAGE"),canDelete:b(n.id,"DELETE"),onRunNow:()=>void He(n),onEdit:()=>{b(n.id,"MANAGE")&&O({kind:"edit",schedule:n})},onTogglePause:()=>void qe(n),onDelete:()=>{b(n.id,"DELETE")&&K(n)}})})]},n.id)})})]}),(re.length>0||je)&&e.jsx(Te,{pageSize:P,rowCount:re.length,canPrev:h.length>0,canNext:Q!=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||K(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(q.Secondary,{type:"button",onClick:()=>K(null),children:"Cancel"}),e.jsx(q.Destructive,{type:"button",disabled:!b(_.id,"DELETE"),onClick:()=>void Ge(_),children:"Delete"})]})]}):null]})}export{Vt as SchedulesPage};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModelSettings-VXYMJEMO-YOyVspML.js","./index-DVIyIfJR.js","./index-B01pXqvC.css","./ConnectorSettings-PXWRCFAL-Dgi-SPKS.js","./SkillSettings-IHVI7FDM-DEkrBUBp.js","./SandboxSettings-6DRUH72J-B_nMtkgp.js"])))=>i.map(i=>d[i]);
2
- import{g as h,i as v,aJ as y,ag as j,aK as S,r as t,j as e,P as _,I as p,d as k,e as f,_ as d,S as w}from"./index-DVIyIfJR.js";var E=t.lazy(()=>d(()=>import("./ModelSettings-VXYMJEMO-YOyVspML.js"),__vite__mapDeps([0,1,2]),import.meta.url)),C=t.lazy(()=>d(()=>import("./ConnectorSettings-PXWRCFAL-Dgi-SPKS.js"),__vite__mapDeps([3,1,2]),import.meta.url)),N=t.lazy(()=>d(()=>import("./SkillSettings-IHVI7FDM-DEkrBUBp.js"),__vite__mapDeps([4,1,2]),import.meta.url)),L=t.lazy(()=>d(()=>import("./SandboxSettings-6DRUH72J-B_nMtkgp.js"),__vite__mapDeps([5,1,2]),import.meta.url));function O(){return e.jsxs("div",{className:"flex flex-1 items-center justify-center py-8",role:"status","aria-live":"polite","aria-busy":"true",children:[e.jsx(w,{size:20,className:"text-text-secondary"}),e.jsx("span",{className:"sr-only",children:"Loading"})]})}var P=()=>{const{settingsOpen:n,settingsSection:l,setSettingsOpen:r}=h(),a=v(),u=y(),{refresh:m}=j(),i=S(),o=(a==null?void 0:a.skillCatalog)!=null,c=(a==null?void 0:a.sandboxCatalog)!=null,x=t.useCallback(()=>{r(!1)},[r]);t.useEffect(()=>{if(n)return()=>{m(),u==null||u()}},[n,m,u]),t.useEffect(()=>{!o&&l==="skills"&&r(n,"models"),!c&&l==="sandbox"&&r(n,"models")},[o,c,l,n,r]),t.useEffect(()=>{if(!n)return;const s=b=>{b.key==="Escape"&&(b.stopImmediatePropagation(),x())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[x,n]);const g=t.useMemo(()=>{const s=[{id:"models",label:"Models",icon:"cpu"},{id:"connectors",label:"Connectors",icon:"plug"}];return o&&s.push({id:"skills",label:"Skills",icon:"lightbulb"}),c&&s.push({id:"sandbox",label:"Sandbox providers",icon:"cube"}),s},[o,c]);return!n||!a?null:e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col bg-primary-bg",children:[e.jsx(_,{title:"Settings",start:e.jsx("button",{type:"button","aria-label":"Back",title:"Back",className:k({variant:"ghost",size:"icon"}),onClick:x,children:e.jsx(p,{name:"arrow-left"})})}),e.jsxs("div",{className:f("flex min-h-0 flex-1 flex-col",!i&&"md:flex-row"),children:[e.jsx("nav",{"aria-label":"Settings sections",className:f("flex w-full gap-1 border-b border-border bg-secondary-bg/40 p-2",i?"min-w-0":"justify-center md:w-48 md:flex-col md:justify-start md:border-b-0 md:border-r"),children:g.map(s=>e.jsxs("button",{type:"button","aria-current":l===s.id?"page":void 0,...i?{title:s.label}:{},className:f("flex min-h-9 items-center gap-2 rounded-md px-3 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",i?"min-w-0 flex-1 justify-center gap-1.5 px-1.5":"shrink-0",l===s.id?"bg-primary-button-bg/10 text-primary-button-bg":"text-text-secondary hover:bg-ghost-button-hover/60 hover:text-text-primary"),onClick:()=>{r(!0,s.id)},children:[e.jsx(p,{name:s.icon,className:"h-4 w-4 shrink-0"}),i?e.jsx("span",{className:"truncate",children:s.label}):s.label]},s.id))}),e.jsx("section",{className:"flex flex-col h-full flex-1 overflow-y-hidden px-6 py-4",children:e.jsx("div",{className:"w-full max-w-210 h-full min-h-0 flex flex-col mx-auto",children:e.jsxs(t.Suspense,{fallback:e.jsx(O,{}),children:[l==="models"?e.jsx(E,{}):null,l==="connectors"?e.jsx(C,{}):null,l==="skills"&&o?e.jsx(N,{}):null,l==="sandbox"&&c?e.jsx(L,{}):null]})})})]})]})},I=P;export{I as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModelSettings-ZVXMXIU4-CTVBWR_b.js","./index-JWYDBa7W.js","./index-B01pXqvC.css","./ConnectorSettings-O4I24244-22M_-mC7.js","./SkillSettings-F5JGGFXR-Bz-nW3QX.js","./SandboxSettings-H6BA2DJQ-ZI6uU_-B.js"])))=>i.map(i=>d[i]);
2
+ import{g as h,i as v,aR as y,ao as j,aS as S,r as t,j as e,P as _,I as p,d as k,e as f,_ as d,S as w}from"./index-JWYDBa7W.js";var E=t.lazy(()=>d(()=>import("./ModelSettings-ZVXMXIU4-CTVBWR_b.js"),__vite__mapDeps([0,1,2]),import.meta.url)),C=t.lazy(()=>d(()=>import("./ConnectorSettings-O4I24244-22M_-mC7.js"),__vite__mapDeps([3,1,2]),import.meta.url)),N=t.lazy(()=>d(()=>import("./SkillSettings-F5JGGFXR-Bz-nW3QX.js"),__vite__mapDeps([4,1,2]),import.meta.url)),L=t.lazy(()=>d(()=>import("./SandboxSettings-H6BA2DJQ-ZI6uU_-B.js"),__vite__mapDeps([5,1,2]),import.meta.url));function O(){return e.jsxs("div",{className:"flex flex-1 items-center justify-center py-8",role:"status","aria-live":"polite","aria-busy":"true",children:[e.jsx(w,{size:20,className:"text-text-secondary"}),e.jsx("span",{className:"sr-only",children:"Loading"})]})}var P=()=>{const{settingsOpen:n,settingsSection:l,setSettingsOpen:r}=h(),a=v(),u=y(),{refresh:m}=j(),i=S(),o=(a==null?void 0:a.skillCatalog)!=null,c=(a==null?void 0:a.sandboxCatalog)!=null,x=t.useCallback(()=>{r(!1)},[r]);t.useEffect(()=>{if(n)return()=>{m(),u==null||u()}},[n,m,u]),t.useEffect(()=>{!o&&l==="skills"&&r(n,"models"),!c&&l==="sandbox"&&r(n,"models")},[o,c,l,n,r]),t.useEffect(()=>{if(!n)return;const s=b=>{b.key==="Escape"&&(b.stopImmediatePropagation(),x())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[x,n]);const g=t.useMemo(()=>{const s=[{id:"models",label:"Models",icon:"cpu"},{id:"connectors",label:"Connectors",icon:"plug"}];return o&&s.push({id:"skills",label:"Skills",icon:"lightbulb"}),c&&s.push({id:"sandbox",label:"Sandbox providers",icon:"cube"}),s},[o,c]);return!n||!a?null:e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col bg-primary-bg",children:[e.jsx(_,{title:"Settings",start:e.jsx("button",{type:"button","aria-label":"Back",title:"Back",className:k({variant:"ghost",size:"icon"}),onClick:x,children:e.jsx(p,{name:"arrow-left"})})}),e.jsxs("div",{className:f("flex min-h-0 flex-1 flex-col",!i&&"md:flex-row"),children:[e.jsx("nav",{"aria-label":"Settings sections",className:f("flex w-full gap-1 border-b border-border bg-secondary-bg/40 p-2",i?"min-w-0":"justify-center md:w-48 md:flex-col md:justify-start md:border-b-0 md:border-r"),children:g.map(s=>e.jsxs("button",{type:"button","aria-current":l===s.id?"page":void 0,...i?{title:s.label}:{},className:f("flex min-h-9 items-center gap-2 rounded-md px-3 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",i?"min-w-0 flex-1 justify-center gap-1.5 px-1.5":"shrink-0",l===s.id?"bg-primary-button-bg/10 text-primary-button-bg":"text-text-secondary hover:bg-ghost-button-hover/60 hover:text-text-primary"),onClick:()=>{r(!0,s.id)},children:[e.jsx(p,{name:s.icon,className:"h-4 w-4 shrink-0"}),i?e.jsx("span",{className:"truncate",children:s.label}):s.label]},s.id))}),e.jsx("section",{className:"flex flex-col h-full flex-1 overflow-y-hidden px-6 py-4",children:e.jsx("div",{className:"w-full max-w-210 h-full min-h-0 flex flex-col mx-auto",children:e.jsxs(t.Suspense,{fallback:e.jsx(O,{}),children:[l==="models"?e.jsx(E,{}):null,l==="connectors"?e.jsx(C,{}):null,l==="skills"&&o?e.jsx(N,{}):null,l==="sandbox"&&c?e.jsx(L,{}):null]})})})]})]})},I=P;export{I as default};
@@ -1 +1 @@
1
- import{m as F,p as v,b as J,s as I}from"./chunk-2QTH6JHX-DrgkYdZs.js";import{g as ne,h as re,i as se,k as ae,l as ie,m as le,n as ue,r as a,t as oe,o as ce,p as ge,q as pe}from"./index-DVIyIfJR.js";import{u as fe,a as ye}from"./chunk-62JRHF6Z-BrctyCH-.js";var M="try_agent_name",_="history_agent_name";function V(n){return n!=null&&n.length>0?n:null}function E(n){const i=new URLSearchParams(n.startsWith("?")?n.slice(1):n),l=V(i.get(M));if(l!=null)return{intent:"try-agent",agentName:l};const e=V(i.get(_));return e==null?null:{intent:"history",agentName:e}}function he(n,i){n.delete(M),n.delete(_),i!=null&&n.set(i.intent==="try-agent"?M:_,i.agentName)}function X(n,i){const l=new URLSearchParams(n.startsWith("?")?n.slice(1):n);he(l,i);const e=l.toString();return e.length>0?`?${e}`:""}function Z(n){const i=n.activeRemoteId??n.pendingSessionId;if(i!=null)return{type:"session",sessionId:i};const{mode:l,agentConfigMode:e}=n;if(l.status==="active"&&l.isMutable&&l.isCreateAgent)return{type:"buildAgent"};if(l.status==="active"&&!l.isMutable&&e!=="SingleAgent"){const g=l.agentName??l.agentId;if(g!=null)return{type:"agent",agentName:g}}return{type:"root"}}function de(n){return n.settingsOpen?{type:"settings"}:n.schedulesOpen?{type:"schedules"}:n.sessionsOpen?{type:"sessionsBrowser"}:n.libraryOpen&&n.libraryAgentId!=null?{type:"libraryAgent",agentId:n.libraryAgentId}:n.libraryOpen?{type:"library"}:Z(n)}function b(n){return n.type==="root"||n.type==="agent"||n.type==="session"}function Ae({routes:n,activeRemoteId:i,initialSettingsOpen:l}){var j,z;const e=ne(),g=re(),B=se(),k=ae(),q=ie(),U=le(),$=ue(),C=fe(),s=ye(),o=a.useMemo(()=>oe({routes:n,catalog:B,capabilities:U,sessions:k,schedules:q}),[n,B,U,k,q]),T=o.settings!=null,x=[o.settings,o.sessionsBrowser,o.libraryAgent,o.schedules].join("\0"),W={settingsOpen:e.settingsOpen,libraryOpen:e.libraryOpen,sessionsOpen:e.sessionsOpen,libraryAgentId:e.libraryAgentId,schedulesOpen:e.schedulesOpen,pendingSessionId:e.pendingSessionId,activeRemoteId:i,mode:e.mode,agentConfigMode:e.agentConfigMode},p=de(W),ee=JSON.stringify(p),S=a.useRef(null),H=a.useRef(null),A=a.useRef(null),O=a.useRef(!1),P=a.useRef(null),m=a.useRef(null),w=a.useRef(null),f=a.useRef(null),Y=a.useRef(!1),G=a.useRef(!1),K=a.useCallback(t=>{if(w.current=t,g==null){e.openHistorySession({sessionId:t});return}g.getSession({sessionId:t}).then(r=>{w.current===t&&e.openHistorySession({sessionId:t,isMutable:r.isMutable,isCreateAgent:ce(r),...r.agentName!=null?{agentName:r.agentName}:{}})}).catch(()=>{w.current===t&&e.openHistorySession({sessionId:t})})},[g,e]),h=a.useCallback(t=>{if(t==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}const r=`${t.intent}\0${t.agentName}`,u=e.historyAgentFilter;if((u==null?void 0:u.intent)===t.intent&&u.agentName===t.agentName&&u.agentId!=null){f.current=null;return}f.current=r,e.setHistoryAgentFilter(t),g!=null&&ge({server:g,agentName:t.agentName}).then(c=>{if(f.current===r){if(c==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}f.current=null,e.setHistoryAgentFilter({agentId:pe(c),agentName:c.name,intent:t.intent})}}).catch(()=>{f.current===r&&(f.current=null,m.current=null,e.setHistoryAgentFilter(null))})},[g,e]),Q=a.useCallback(t=>{e.selectLibraryAgent({isMutable:!1,agentName:t}),h({intent:"try-agent",agentName:t})},[h,e]),L=a.useCallback(t=>{switch(t.type){case"settings":e.setSettingsOpen(!0);return;case"library":e.setLibraryOpen(!0);return;case"sessionsBrowser":e.setSessionsOpen(!0);return;case"libraryAgent":e.openLibraryAgent(t.agentId);return;case"schedules":e.setSchedulesOpen(!0);return;case"buildAgent":e.openAgentBuilder();return;case"session":if(e.setLibraryOpen(!1),e.pendingSessionId===t.sessionId||i===t.sessionId)return;K(t.sessionId);return;case"agent":e.setLibraryOpen(!1),Q(t.agentName);return;case"root":switch(e.setSettingsOpen(!1),e.setLibraryOpen(!1),e.setSchedulesOpen(!1),e.agentConfigMode){case"AgentLibrary":e.openLibraryHome();return;case"AgentComposer":case"AgentLibraryWithComposer":e.openDraft();return;case"SingleAgent":e.clearChat();return}}},[e,i,Q,K]);return a.useEffect(()=>{if(O.current)return;const t=F({pathname:s.pathname,search:s.search,routes:n});if(!$&&(t==null?void 0:t.type)==="settings")return;O.current=!0;const r=F({pathname:s.pathname,search:s.search,routes:o})??{type:"root"},u=r.type==="agent"?{intent:"try-agent",agentName:r.agentName}:b(r)?E(s.search):null;m.current=u,A.current=r;const c=T&&(l||r.type==="settings");if(r.type==="settings")T&&e.setSettingsOpen(!0);else if(r.type==="library")e.setLibraryOpen(!0);else if(r.type==="sessionsBrowser")e.setSessionsOpen(!0);else if(r.type==="libraryAgent")e.openLibraryAgent(r.agentId);else if(r.type==="schedules")e.setSchedulesOpen(!0);else{const R=Z(W);v(R,r)||L(r),c&&e.setSettingsOpen(!0)}r.type!=="agent"&&u!=null?h(u):b(r)||h(null);const d=c?{type:"settings"}:r;P.current=v(p,d)?null:d;const y=J(d,o),N=X(I(d,s.search),u);H.current=d,y!=null&&(y!==s.pathname||N!==s.search)&&(S.current=y!==s.pathname?y:null,C({pathname:y,search:N,hash:s.hash},{replace:!0}))},[$]),a.useEffect(()=>{if(!O.current)return;if(!Y.current){Y.current=!0;return}const t=P.current;if(t!=null){if(!v(p,t))return;P.current=null}const r=J(p,o);if(r==null)return;const c=`${o.basename.endsWith("/")?o.basename.slice(0,-1):o.basename}${s.pathname}`||"/",d=window.location.pathname===c?window.location.search:s.search,y=b(p),N=y?e.historyAgentFilter==null?m.current:{intent:e.historyAgentFilter.intent,agentName:e.historyAgentFilter.agentName}:null;!y&&e.historyAgentFilter!=null&&(f.current=null,e.setHistoryAgentFilter(null)),e.historyAgentFilter!=null&&(m.current=null);const R=X(I(p,d),N),D=H.current;if(H.current=p,r===s.pathname&&R===s.search)return;const te=p.type==="session"&&e.pendingSessionId==null&&D!=null&&D.type!=="session";S.current=r!==s.pathname?r:null,C({pathname:r,search:R,hash:s.hash},{replace:te})},[ee,x,(j=e.historyAgentFilter)==null?void 0:j.agentName,(z=e.historyAgentFilter)==null?void 0:z.intent]),a.useEffect(()=>{if(!O.current)return;if(!G.current){G.current=!0;return}if(S.current===s.pathname){S.current=null,A.current=p;return}const t=F({pathname:s.pathname,search:s.search,routes:o});if(t==null){const u=o.root,c=I({type:"root"},s.search);S.current=u,C({pathname:u,search:c,hash:s.hash},{replace:!0}),L({type:"root"}),h(E(c));return}const r=A.current;A.current=t,(r==null||!v(r,t))&&(t.type!=="settings"&&e.settingsOpen&&e.setSettingsOpen(!1),t.type!=="library"&&t.type!=="libraryAgent"&&e.libraryOpen&&e.setLibraryOpen(!1),t.type!=="sessionsBrowser"&&e.sessionsOpen&&e.setSessionsOpen(!1),t.type!=="schedules"&&e.schedulesOpen&&e.setSchedulesOpen(!1),L(t)),t.type!=="agent"&&b(t)?h(E(s.search)):b(t)||h(null)},[s.pathname,s.search]),null}export{Ae as ShellRouteSync};
1
+ import{m as F,p as v,b as J,s as I}from"./chunk-JEAULQNF-BD5-zY_K.js";import{g as ne,h as re,i as se,k as ae,l as ie,m as le,n as ue,r as a,t as oe,o as ce,p as ge,q as pe}from"./index-JWYDBa7W.js";import{u as fe,a as ye}from"./chunk-62JRHF6Z-CtriJkXR.js";var M="try_agent_name",_="history_agent_name";function V(n){return n!=null&&n.length>0?n:null}function E(n){const i=new URLSearchParams(n.startsWith("?")?n.slice(1):n),l=V(i.get(M));if(l!=null)return{intent:"try-agent",agentName:l};const e=V(i.get(_));return e==null?null:{intent:"history",agentName:e}}function he(n,i){n.delete(M),n.delete(_),i!=null&&n.set(i.intent==="try-agent"?M:_,i.agentName)}function X(n,i){const l=new URLSearchParams(n.startsWith("?")?n.slice(1):n);he(l,i);const e=l.toString();return e.length>0?`?${e}`:""}function Z(n){const i=n.activeRemoteId??n.pendingSessionId;if(i!=null)return{type:"session",sessionId:i};const{mode:l,agentConfigMode:e}=n;if(l.status==="active"&&l.isMutable&&l.isCreateAgent)return{type:"buildAgent"};if(l.status==="active"&&!l.isMutable&&e!=="SingleAgent"){const g=l.agentName??l.agentId;if(g!=null)return{type:"agent",agentName:g}}return{type:"root"}}function de(n){return n.settingsOpen?{type:"settings"}:n.schedulesOpen?{type:"schedules"}:n.sessionsOpen?{type:"sessionsBrowser"}:n.libraryOpen&&n.libraryAgentId!=null?{type:"libraryAgent",agentId:n.libraryAgentId}:n.libraryOpen?{type:"library"}:Z(n)}function b(n){return n.type==="root"||n.type==="agent"||n.type==="session"}function Ae({routes:n,activeRemoteId:i,initialSettingsOpen:l}){var j,z;const e=ne(),g=re(),B=se(),k=ae(),q=ie(),U=le(),$=ue(),C=fe(),s=ye(),o=a.useMemo(()=>oe({routes:n,catalog:B,capabilities:U,sessions:k,schedules:q}),[n,B,U,k,q]),T=o.settings!=null,x=[o.settings,o.sessionsBrowser,o.libraryAgent,o.schedules].join("\0"),W={settingsOpen:e.settingsOpen,libraryOpen:e.libraryOpen,sessionsOpen:e.sessionsOpen,libraryAgentId:e.libraryAgentId,schedulesOpen:e.schedulesOpen,pendingSessionId:e.pendingSessionId,activeRemoteId:i,mode:e.mode,agentConfigMode:e.agentConfigMode},p=de(W),ee=JSON.stringify(p),S=a.useRef(null),H=a.useRef(null),A=a.useRef(null),O=a.useRef(!1),P=a.useRef(null),m=a.useRef(null),w=a.useRef(null),f=a.useRef(null),Y=a.useRef(!1),G=a.useRef(!1),K=a.useCallback(t=>{if(w.current=t,g==null){e.openHistorySession({sessionId:t});return}g.getSession({sessionId:t}).then(r=>{w.current===t&&e.openHistorySession({sessionId:t,isMutable:r.isMutable,isCreateAgent:ce(r),...r.agentName!=null?{agentName:r.agentName}:{}})}).catch(()=>{w.current===t&&e.openHistorySession({sessionId:t})})},[g,e]),h=a.useCallback(t=>{if(t==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}const r=`${t.intent}\0${t.agentName}`,u=e.historyAgentFilter;if((u==null?void 0:u.intent)===t.intent&&u.agentName===t.agentName&&u.agentId!=null){f.current=null;return}f.current=r,e.setHistoryAgentFilter(t),g!=null&&ge({server:g,agentName:t.agentName}).then(c=>{if(f.current===r){if(c==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}f.current=null,e.setHistoryAgentFilter({agentId:pe(c),agentName:c.name,intent:t.intent})}}).catch(()=>{f.current===r&&(f.current=null,m.current=null,e.setHistoryAgentFilter(null))})},[g,e]),Q=a.useCallback(t=>{e.selectLibraryAgent({isMutable:!1,agentName:t}),h({intent:"try-agent",agentName:t})},[h,e]),L=a.useCallback(t=>{switch(t.type){case"settings":e.setSettingsOpen(!0);return;case"library":e.setLibraryOpen(!0);return;case"sessionsBrowser":e.setSessionsOpen(!0);return;case"libraryAgent":e.openLibraryAgent(t.agentId);return;case"schedules":e.setSchedulesOpen(!0);return;case"buildAgent":e.openAgentBuilder();return;case"session":if(e.setLibraryOpen(!1),e.pendingSessionId===t.sessionId||i===t.sessionId)return;K(t.sessionId);return;case"agent":e.setLibraryOpen(!1),Q(t.agentName);return;case"root":switch(e.setSettingsOpen(!1),e.setLibraryOpen(!1),e.setSchedulesOpen(!1),e.agentConfigMode){case"AgentLibrary":e.openLibraryHome();return;case"AgentComposer":case"AgentLibraryWithComposer":e.openDraft();return;case"SingleAgent":e.clearChat();return}}},[e,i,Q,K]);return a.useEffect(()=>{if(O.current)return;const t=F({pathname:s.pathname,search:s.search,routes:n});if(!$&&(t==null?void 0:t.type)==="settings")return;O.current=!0;const r=F({pathname:s.pathname,search:s.search,routes:o})??{type:"root"},u=r.type==="agent"?{intent:"try-agent",agentName:r.agentName}:b(r)?E(s.search):null;m.current=u,A.current=r;const c=T&&(l||r.type==="settings");if(r.type==="settings")T&&e.setSettingsOpen(!0);else if(r.type==="library")e.setLibraryOpen(!0);else if(r.type==="sessionsBrowser")e.setSessionsOpen(!0);else if(r.type==="libraryAgent")e.openLibraryAgent(r.agentId);else if(r.type==="schedules")e.setSchedulesOpen(!0);else{const R=Z(W);v(R,r)||L(r),c&&e.setSettingsOpen(!0)}r.type!=="agent"&&u!=null?h(u):b(r)||h(null);const d=c?{type:"settings"}:r;P.current=v(p,d)?null:d;const y=J(d,o),N=X(I(d,s.search),u);H.current=d,y!=null&&(y!==s.pathname||N!==s.search)&&(S.current=y!==s.pathname?y:null,C({pathname:y,search:N,hash:s.hash},{replace:!0}))},[$]),a.useEffect(()=>{if(!O.current)return;if(!Y.current){Y.current=!0;return}const t=P.current;if(t!=null){if(!v(p,t))return;P.current=null}const r=J(p,o);if(r==null)return;const c=`${o.basename.endsWith("/")?o.basename.slice(0,-1):o.basename}${s.pathname}`||"/",d=window.location.pathname===c?window.location.search:s.search,y=b(p),N=y?e.historyAgentFilter==null?m.current:{intent:e.historyAgentFilter.intent,agentName:e.historyAgentFilter.agentName}:null;!y&&e.historyAgentFilter!=null&&(f.current=null,e.setHistoryAgentFilter(null)),e.historyAgentFilter!=null&&(m.current=null);const R=X(I(p,d),N),D=H.current;if(H.current=p,r===s.pathname&&R===s.search)return;const te=p.type==="session"&&e.pendingSessionId==null&&D!=null&&D.type!=="session";S.current=r!==s.pathname?r:null,C({pathname:r,search:R,hash:s.hash},{replace:te})},[ee,x,(j=e.historyAgentFilter)==null?void 0:j.agentName,(z=e.historyAgentFilter)==null?void 0:z.intent]),a.useEffect(()=>{if(!O.current)return;if(!G.current){G.current=!0;return}if(S.current===s.pathname){S.current=null,A.current=p;return}const t=F({pathname:s.pathname,search:s.search,routes:o});if(t==null){const u=o.root,c=I({type:"root"},s.search);S.current=u,C({pathname:u,search:c,hash:s.hash},{replace:!0}),L({type:"root"}),h(E(c));return}const r=A.current;A.current=t,(r==null||!v(r,t))&&(t.type!=="settings"&&e.settingsOpen&&e.setSettingsOpen(!1),t.type!=="library"&&t.type!=="libraryAgent"&&e.libraryOpen&&e.setLibraryOpen(!1),t.type!=="sessionsBrowser"&&e.sessionsOpen&&e.setSessionsOpen(!1),t.type!=="schedules"&&e.schedulesOpen&&e.setSchedulesOpen(!1),L(t)),t.type!=="agent"&&b(t)?h(E(s.search)):b(t)||h(null)},[s.pathname,s.search]),null}export{Ae as ShellRouteSync};
@@ -1,2 +1,2 @@
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};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-VA3VGWZC-DIAqWtHn.js","./index-JWYDBa7W.js","./index-B01pXqvC.css","./SchedulesPage-FS2QZ5KB-rgCfvw8i.js"])))=>i.map(i=>d[i]);
2
+ import{bF as N,bG as Ut,u as G,j as s,bH as Vt,r as d,b0 as S,bI as Ge,bJ as Wt,bK as He,bL as Ue,bM as Ve,bN as We,bO as Xe,bP as X,bQ as Xt,bR as C,bS as Yt,bT as qt,bU as Qt,bV as Zt,bW as Jt,bX as en,bY as tn,bZ as nn,b_ as be,b$ as rn,c0 as sn,c1 as ce,c2 as on,c3 as an,c4 as cn,c5 as Ye,c6 as _e,c7 as le,c8 as we,c9 as se,ca as Ie,cb as ye,cc as Me,cd as Ee,h as qe,a as Z,c as T,O as ln,ce as un,e as F,cf as dn,cg as mn,ch as fn,b as Le,aS as Qe,ac as hn,U as pn,aj as Ae,I as z,q as xn,d as re,ci as Ze,ad as gn,ag as vn,s as Je,cj as bn,P as wn,S as Oe,ck as In,cl as yn,_ as et,by as Mn}from"./index-JWYDBa7W.js";import{A as Ln,N as Cn,T as jn,S as Tn}from"./chunk-7VWUB5OV-DTCqM7Y6.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},_n=()=>{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},En=()=>{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,$n,Kn]=We(ue),[Y,ot]=He(ue,[Kn,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),E=$n(o),[A,O]=d.useState(null),D=d.useRef(null),I=X(t,D,M.onContentChange),R=d.useRef(0),_=d.useRef(""),B=d.useRef(0),w=d.useRef(null),te=d.useRef("right"),$=d.useRef(0),U=x?qt:d.Fragment,de=x?{as:Jn,allowPinchZoom:!0}:void 0,Ht=y(v=>{var Q,Ne;const k=_.current+v,K=E().filter(H=>!H.disabled),V=document.activeElement,me=(Q=K.find(H=>H.ref.current===V))==null?void 0:Q.textValue,fe=K.map(H=>H.textValue),Pe=ht(fe,k,me),ne=(Ne=K.find(H=>H.textValue===Pe))==null?void 0:Ne.ref.current;y((function H(De){_.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 K,V;return te.current===((K=w.current)==null?void 0:K.side)&&xt(v,(V=w.current)==null?void 0:V.area)},[]);return s.jsx(Yn,{scope:o,searchRef:_,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 K=v.target.closest("[data-radix-menu-content]")===v.currentTarget,V=v.ctrlKey||v.altKey||v.metaKey,me=v.key.length===1;K&&(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=E().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),_.current="")}),onPointerMove:C(e.onPointerMove,ie(v=>{const k=v.target,K=$.current!==v.clientX;if(v.currentTarget.contains(k)&&K){const V=v.clientX>$.current?"right":"left";te.current=V,$.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:_e(),triggerRef:i,contentId:_e(),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}=_n();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}=En();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 _t=d.forwardRef((n,e)=>{const t=S(i=>i.threads.mainThreadId===i.threadListItem.id),o=Ee(null),r=Ee(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})})});_t.displayName="ThreadListItemPrimitive.Root";const Nr=()=>{const{archive:n}=Rn();return n},Dr=se("ThreadListItemPrimitive.Archive",Nr),_r=()=>{const{unarchive:n}=Nn();return n},Er=se("ThreadListItemPrimitive.Unarchive",_r),Ar=()=>{const{delete:n}=Pn();return n},Or=se("ThreadListItemPrimitive.Delete",Ar),kr=()=>{const{switchTo:n}=Dn();return n},Fr=se("ThreadListItemPrimitive.Trigger",kr),Et=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});Et.displayName="ThreadListItemPrimitive.Trigger";var ve=Me({Archive:()=>Dr,Delete:()=>Or,Root:()=>_t,Title:()=>rt,Trigger:()=>Et,Unarchive:()=>Er});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 $t=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});$t.displayName="ThreadListItemMorePrimitive.Trigger";const Kt=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=E=>{var A;!h||E.key!==f||(E.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 E;h&&((E=m==null?void 0:m.moreRef.current)==null||E.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});Kt.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:()=>Kt,Item:()=>zt,Root:()=>Bt,Separator:()=>Gt,Trigger:()=>$t});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:E,sentinelRef:A}=hn({enabled:a&&b,query:l});if(d.useLayoutEffect(()=>{if(!a||r){m(null);return}const I=()=>{var _;const R=(_=h.current)==null?void 0:_.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 _=R.target;(B=h.current)!=null&&B.contains(_)||(w=f.current)!=null&&w.contains(_)||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:E,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),_=(x==null?void 0:x.agentId)===R;return s.jsxs(Ae,{className:F("justify-between gap-2 text-left",_&&"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}),_?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 $r({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 Kr({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($r,{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(Kr,{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 E=(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 $=()=>{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",$,{passive:!0});const U=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>$());return U?U.observe(w):window.addEventListener("resize",$),$(),()=>{te=!0,w.removeEventListener("scroll",$),U==null||U.disconnect(),U||window.removeEventListener("resize",$)}},[c,A,r,a,l.length]);const _=()=>{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:[E?s.jsx(h,{onClick:_}):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-VA3VGWZC-DIAqWtHn.js"),__vite__mapDeps([0,1,2]),import.meta.url)),Yr=d.lazy(()=>et(()=>import("./SchedulesPage-FS2QZ5KB-rgCfvw8i.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",$e=F(Mn,"text-sidebar-text"),Ke="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($e,u&&Ke)}),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($e,i&&Ke)}),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-2 py-1.5"})]})]})}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=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"}),E?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};
@@ -1 +1 @@
1
- import{aL as $,D as K,r as a,aM as G,j as e,H as P,K as I,I as z,aO as Q,ah as k}from"./index-DVIyIfJR.js";var _=({open:s,onOpenChange:o,onImport:c,busy:v=!1,error:d})=>{const[p,g]=a.useState(""),[b,m]=a.useState(""),[u,j]=a.useState(""),[i,S]=a.useState(""),[n,x]=a.useState(""),N=()=>{g(""),m(""),j(""),S(""),x("")},h=()=>{N(),o(!1)},R=async l=>{if(l.preventDefault(),!(!p.trim()||!b.trim()||!u.trim()||!i.trim()||!n.trim()||v))try{await c({name:p.trim(),description:b.trim(),repoURL:u.trim(),path:i.trim(),ref:n.trim()}),h()}catch{}},L=!!(p.trim()&&b.trim()&&u.trim()&&i.trim()&&n.trim())&&!v;return e.jsx(Q,{open:s,onOpenChange:l=>{l||h()},title:"Import from GitHub",description:"Import a skill from a SKILL.md file in a GitHub repository.",headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary",children:e.jsx(z,{name:"github",className:"size-5"})}),contentSized:!0,className:"md:max-w-2xl",children:e.jsx("form",{onSubmit:l=>void R(l),children:e.jsxs("div",{className:"space-y-5 px-5 py-5 md:px-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-name",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Name"}),e.jsx("input",{id:"skill-name",value:p,onChange:l=>{g(l.target.value)},placeholder:"release-notes",autoFocus:!0,required:!0,className:k("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-description",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Description"}),e.jsx("textarea",{id:"skill-description",value:b,onChange:l=>{m(l.target.value)},placeholder:"Generate release notes from merged pull requests",required:!0,rows:3,className:k("resize-y py-2.5")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-repo-url",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Repository URL"}),e.jsx("input",{id:"skill-repo-url",type:"url",value:u,onChange:l=>{j(l.target.value)},placeholder:"https://github.com/org/repo",required:!0,className:k("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-path",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Folder containing the SKILL.md"}),e.jsx("input",{id:"skill-path",value:i,onChange:l=>{S(l.target.value)},placeholder:"skills/release-notes",required:!0,className:k("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-ref",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Branch"}),e.jsx("input",{id:"skill-ref",value:n,onChange:l=>{x(l.target.value)},placeholder:"main",required:!0,className:k("h-11")})]}),e.jsxs("div",{className:"space-y-3",children:[d?e.jsx("p",{className:"text-failure-bg text-sm",children:d}):null,e.jsx(I.Primary,{type:"submit",disabled:!L,className:"w-full",children:"Import"})]})]})})})},T=_,U=(s,o,c)=>!s||o.toLowerCase().includes(s)||c.toLowerCase().includes(s),A=s=>"catalogId"in s;function J(s){return typeof s=="object"&&s!==null&&Reflect.get(s,"statusCode")===424}var V=()=>{const{skillCatalog:s}=$(),o=K(),[c,v]=a.useState(""),[d,p]=a.useState([]),[g,b]=a.useState([]),[m,u]=a.useState(!0),[j,i]=a.useState(null),[S,n]=a.useState(null),[x,N]=a.useState(!1),[h,R]=a.useState(!1),[L,l]=a.useState(!1),E=a.useCallback(async()=>{if(s){u(!0),i(null);try{const[t,r]=await Promise.all([s.listSkills(),s.getSkillCatalog()]);p(t),b(r)}catch(t){i(G(t,"Failed to load skills"))}finally{u(!1)}}},[s]);a.useEffect(()=>{E()},[E]);const y=c.trim().toLowerCase(),w=a.useMemo(()=>d.filter(t=>U(y,t.name,t.description)),[d,y]),C=a.useMemo(()=>{const t=new Set(d.flatMap(r=>A(r)?[r.catalogId]:[]));return g.filter(r=>!t.has(r.id)&&U(y,r.name,r.description))},[g,d,y]),F=async(t,r=i)=>{N(!0),i(null);try{await t(),await E()}catch(f){throw J(f)&&R(!0),r(G(f,"Request failed")),f}finally{N(!1)}};if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Skills catalog is not available."});const q=t=>{F(async()=>{await s.createSkill({catalogId:t.id,name:t.name,description:t.description,repoURL:t.repoURL,path:t.path,ref:t.ref})}).catch(()=>{})},B=t=>{const r=s.deleteSkill;r&&F(async()=>{await r({id:t.id})}).catch(()=>{})},O=async t=>{n(null),await F(async()=>{await s.createSkill(t)},n),setTimeout(()=>{o==null||o.showSuccess({title:`${t.name} imported`})},0)},M=({key:t,name:r,description:f,action:H})=>e.jsxs("article",{className:"flex min-h-16 items-center gap-3 border-b border-border p-3 last:border-b-0",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(z,{name:"lightbulb",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:r}),f?e.jsx("p",{className:"mt-0.5 truncate text-sm text-text-secondary",children:f}):null]}),H]},t),D=w.length>0||C.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Skills"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Use built-in skills or import custom skills from GitHub."}),j?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:j}):null,e.jsxs("div",{className:"mt-4 flex min-h-0 flex-1 flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(P,{query:c,setQuery:v,placeholder:"Search skills"})}),e.jsxs(I.Secondary,{type:"button",className:"shrink-0",disabled:x||h,onClick:()=>{n(null),l(!0)},children:[e.jsx(z,{name:"github",className:"size-4"}),"Import from GitHub"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[m?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!m&&w.length>0?e.jsxs("section",{"aria-labelledby":"enabled-skills-heading",children:[e.jsxs("h4",{id:"enabled-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Enabled · ",w.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:w.map(t=>M({key:t.id,name:t.name,description:t.description,action:s.deleteSkill?e.jsx(I.Secondary,{size:"small",type:"button",disabled:x||h,"aria-label":`Remove ${t.name}`,onClick:()=>{B(t)},children:"Remove"}):null}))})]}):null,!m&&C.length>0?e.jsxs("section",{"aria-labelledby":"available-skills-heading",children:[e.jsxs("h4",{id:"available-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Available · ",C.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:C.map(t=>M({key:t.id,name:t.name,description:t.description,action:e.jsx(I.Secondary,{size:"small",type:"button",disabled:x||h,"aria-label":`Enable ${t.name}`,onClick:()=>{q(t)},children:"Enable"})}))})]}):null,!m&&!D?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:y?`No skills match “${c.trim()}”.`:"No skills yet."}):null]})]}),e.jsx(T,{open:L,onOpenChange:t=>{l(t),t||n(null)},onImport:O,busy:x||h,error:S})]})},X=V;export{X as default};
1
+ import{aT as $,N as P,r as a,aU as U,j as e,U as Q,W as I,I as z,aW as T,ap as k}from"./index-JWYDBa7W.js";var _=({open:s,onOpenChange:o,onImport:c,busy:v=!1,error:d})=>{const[p,g]=a.useState(""),[b,m]=a.useState(""),[u,j]=a.useState(""),[i,S]=a.useState(""),[n,x]=a.useState(""),N=()=>{g(""),m(""),j(""),S(""),x("")},h=()=>{N(),o(!1)},R=async l=>{if(l.preventDefault(),!(!p.trim()||!b.trim()||!u.trim()||!i.trim()||!n.trim()||v))try{await c({name:p.trim(),description:b.trim(),repoURL:u.trim(),path:i.trim(),ref:n.trim()}),h()}catch{}},L=!!(p.trim()&&b.trim()&&u.trim()&&i.trim()&&n.trim())&&!v;return e.jsx(T,{open:s,onOpenChange:l=>{l||h()},title:"Import from GitHub",description:"Import a skill from a SKILL.md file in a GitHub repository.",headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary",children:e.jsx(z,{name:"github",className:"size-5"})}),contentSized:!0,className:"md:max-w-2xl",children:e.jsx("form",{onSubmit:l=>void R(l),children:e.jsxs("div",{className:"space-y-5 px-5 py-5 md:px-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-name",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Name"}),e.jsx("input",{id:"skill-name",value:p,onChange:l=>{g(l.target.value)},placeholder:"release-notes",autoFocus:!0,required:!0,className:k("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-description",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Description"}),e.jsx("textarea",{id:"skill-description",value:b,onChange:l=>{m(l.target.value)},placeholder:"Generate release notes from merged pull requests",required:!0,rows:3,className:k("resize-y py-2.5")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-repo-url",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Repository URL"}),e.jsx("input",{id:"skill-repo-url",type:"url",value:u,onChange:l=>{j(l.target.value)},placeholder:"https://github.com/org/repo",required:!0,className:k("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-path",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Folder containing the SKILL.md"}),e.jsx("input",{id:"skill-path",value:i,onChange:l=>{S(l.target.value)},placeholder:"skills/release-notes",required:!0,className:k("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-ref",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Branch"}),e.jsx("input",{id:"skill-ref",value:n,onChange:l=>{x(l.target.value)},placeholder:"main",required:!0,className:k("h-11")})]}),e.jsxs("div",{className:"space-y-3",children:[d?e.jsx("p",{className:"text-failure-bg text-sm",children:d}):null,e.jsx(I.Primary,{type:"submit",disabled:!L,className:"w-full",children:"Import"})]})]})})})},K=_,G=(s,o,c)=>!s||o.toLowerCase().includes(s)||c.toLowerCase().includes(s),W=s=>"catalogId"in s;function A(s){return typeof s=="object"&&s!==null&&Reflect.get(s,"statusCode")===424}var J=()=>{const{skillCatalog:s}=$(),o=P(),[c,v]=a.useState(""),[d,p]=a.useState([]),[g,b]=a.useState([]),[m,u]=a.useState(!0),[j,i]=a.useState(null),[S,n]=a.useState(null),[x,N]=a.useState(!1),[h,R]=a.useState(!1),[L,l]=a.useState(!1),E=a.useCallback(async()=>{if(s){u(!0),i(null);try{const[t,r]=await Promise.all([s.listSkills(),s.getSkillCatalog()]);p(t),b(r)}catch(t){i(U(t,"Failed to load skills"))}finally{u(!1)}}},[s]);a.useEffect(()=>{E()},[E]);const y=c.trim().toLowerCase(),w=a.useMemo(()=>d.filter(t=>G(y,t.name,t.description)),[d,y]),C=a.useMemo(()=>{const t=new Set(d.flatMap(r=>W(r)?[r.catalogId]:[]));return g.filter(r=>!t.has(r.id)&&G(y,r.name,r.description))},[g,d,y]),F=async(t,r=i)=>{N(!0),i(null);try{await t(),await E()}catch(f){throw A(f)&&R(!0),r(U(f,"Request failed")),f}finally{N(!1)}};if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Skills catalog is not available."});const q=t=>{F(async()=>{await s.createSkill({catalogId:t.id,name:t.name,description:t.description,repoURL:t.repoURL,path:t.path,ref:t.ref})}).catch(()=>{})},B=t=>{const r=s.deleteSkill;r&&F(async()=>{await r({id:t.id})}).catch(()=>{})},O=async t=>{n(null),await F(async()=>{await s.createSkill(t)},n),setTimeout(()=>{o==null||o.showSuccess({title:`${t.name} imported`})},0)},M=({key:t,name:r,description:f,action:H})=>e.jsxs("article",{className:"flex min-h-16 items-center gap-3 border-b border-border p-3 last:border-b-0",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(z,{name:"lightbulb",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:r}),f?e.jsx("p",{className:"mt-0.5 truncate text-sm text-text-secondary",children:f}):null]}),H]},t),D=w.length>0||C.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Skills"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Use built-in skills or import custom skills from GitHub."}),j?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:j}):null,e.jsxs("div",{className:"mt-4 flex min-h-0 flex-1 flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Q,{query:c,setQuery:v,placeholder:"Search skills"})}),e.jsxs(I.Secondary,{type:"button",className:"shrink-0",disabled:x||h,onClick:()=>{n(null),l(!0)},children:[e.jsx(z,{name:"github",className:"size-4"}),"Import from GitHub"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[m?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!m&&w.length>0?e.jsxs("section",{"aria-labelledby":"enabled-skills-heading",children:[e.jsxs("h4",{id:"enabled-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Enabled · ",w.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:w.map(t=>M({key:t.id,name:t.name,description:t.description,action:s.deleteSkill?e.jsx(I.Secondary,{size:"small",type:"button",disabled:x||h,"aria-label":`Remove ${t.name}`,onClick:()=>{B(t)},children:"Remove"}):null}))})]}):null,!m&&C.length>0?e.jsxs("section",{"aria-labelledby":"available-skills-heading",children:[e.jsxs("h4",{id:"available-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Available · ",C.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:C.map(t=>M({key:t.id,name:t.name,description:t.description,action:e.jsx(I.Secondary,{size:"small",type:"button",disabled:x||h,"aria-label":`Enable ${t.name}`,onClick:()=>{q(t)},children:"Enable"})}))})]}):null,!m&&!D?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:y?`No skills match “${c.trim()}”.`:"No skills yet."}):null]})]}),e.jsx(K,{open:L,onOpenChange:t=>{l(t),t||n(null)},onImport:O,busy:x||h,error:S})]})},X=J;export{X as default};
@@ -0,0 +1 @@
1
+ import{r as t,j as o,T as a}from"./index-JWYDBa7W.js";import{r as m}from"./chunk-JEAULQNF-BD5-zY_K.js";import{B as i}from"./chunk-62JRHF6Z-CtriJkXR.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};
@@ -1 +1 @@
1
- import{S as m}from"./chunk-2UBSLCKB-Bq4rnsqJ.js";import{c as x,f,r,j as e,C as p,I as b,d as h,e as v}from"./index-DVIyIfJR.js";import"./chunk-PX6MNNN3-DWHQBAi-.js";function j({className:u}){const d=x("BrandLogo"),{open:a,setOpen:n}=f(),l=r.useRef(null),s=r.useRef(null),i=r.useRef(!1);return r.useEffect(()=>{if(!a)return;const t=o=>{var c;o.key==="Escape"&&!((c=s.current)!=null&&c.querySelector("dialog[open]"))&&n(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,n]),r.useEffect(()=>{var t,o;if(a){i.current=!0,(t=s.current)==null||t.focus();return}i.current&&((o=l.current)==null||o.focus(),i.current=!1)},[a]),e.jsxs("div",{className:v("pointer-events-none relative h-full min-h-0 w-full",u),children:[a?e.jsx("div",{ref:s,"data-aui-compact-layout":!0,className:"pointer-events-auto absolute right-[max(1.25rem,env(safe-area-inset-right,0px))] bottom-[calc(5.25rem+env(safe-area-inset-bottom,0px))] z-[19] flex h-[min(560px,calc(100%-6.5rem-env(safe-area-inset-bottom,0px)))] max-h-[calc(100%-6.5rem)] w-[min(380px,calc(100%-2.5rem))] flex-col overflow-hidden rounded-xl border border-border bg-primary-bg shadow-[0_16px_48px_color-mix(in_oklab,var(--shadow-color)_14%,transparent)] outline-none",role:"dialog","aria-modal":!0,"aria-label":"Chat",tabIndex:-1,children:e.jsx(p,{children:e.jsx(m,{threadHeaderEnd:e.jsx("button",{type:"button","aria-label":"Close",title:"Close",className:h({variant:"ghost",size:"icon"}),onClick:()=>n(!1),children:e.jsx(b,{name:"xmark"})})})})}):null,e.jsx("button",{ref:l,type:"button",className:"pointer-events-auto absolute right-[max(1.25rem,env(safe-area-inset-right,0px))] bottom-[max(1.25rem,env(safe-area-inset-bottom,0px))] z-20 flex size-14 cursor-pointer items-center justify-center rounded-full text-sm font-medium shadow-[0_8px_24px_color-mix(in_oklab,var(--primary-button-bg)_45%,transparent)]",style:{backgroundColor:"var(--primary-button-bg)",color:"var(--primary-button-text)"},"aria-expanded":a,"aria-label":a?"Close chat":"Open chat",onClick:()=>n(t=>!t),children:a?e.jsx("span",{"aria-hidden":!0,className:"text-xl leading-none",children:"×"}):e.jsx(d,{variant:"icon",className:"size-6"})})]})}export{j as WidgetLayout};
1
+ import{S as m}from"./chunk-MB7Z5FPI-CyN2m3rd.js";import{c as x,f,r,j as e,C as p,I as b,d as h,e as v}from"./index-JWYDBa7W.js";import"./chunk-7VWUB5OV-DTCqM7Y6.js";function j({className:u}){const d=x("BrandLogo"),{open:a,setOpen:n}=f(),l=r.useRef(null),s=r.useRef(null),i=r.useRef(!1);return r.useEffect(()=>{if(!a)return;const t=o=>{var c;o.key==="Escape"&&!((c=s.current)!=null&&c.querySelector("dialog[open]"))&&n(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,n]),r.useEffect(()=>{var t,o;if(a){i.current=!0,(t=s.current)==null||t.focus();return}i.current&&((o=l.current)==null||o.focus(),i.current=!1)},[a]),e.jsxs("div",{className:v("pointer-events-none relative h-full min-h-0 w-full",u),children:[a?e.jsx("div",{ref:s,"data-aui-compact-layout":!0,className:"pointer-events-auto absolute right-[max(1.25rem,env(safe-area-inset-right,0px))] bottom-[calc(5.25rem+env(safe-area-inset-bottom,0px))] z-[19] flex h-[min(560px,calc(100%-6.5rem-env(safe-area-inset-bottom,0px)))] max-h-[calc(100%-6.5rem)] w-[min(380px,calc(100%-2.5rem))] flex-col overflow-hidden rounded-xl border border-border bg-primary-bg shadow-[0_16px_48px_color-mix(in_oklab,var(--shadow-color)_14%,transparent)] outline-none",role:"dialog","aria-modal":!0,"aria-label":"Chat",tabIndex:-1,children:e.jsx(p,{children:e.jsx(m,{threadHeaderEnd:e.jsx("button",{type:"button","aria-label":"Close",title:"Close",className:h({variant:"ghost",size:"icon"}),onClick:()=>n(!1),children:e.jsx(b,{name:"xmark"})})})})}):null,e.jsx("button",{ref:l,type:"button",className:"pointer-events-auto absolute right-[max(1.25rem,env(safe-area-inset-right,0px))] bottom-[max(1.25rem,env(safe-area-inset-bottom,0px))] z-20 flex size-14 cursor-pointer items-center justify-center rounded-full text-sm font-medium shadow-[0_8px_24px_color-mix(in_oklab,var(--primary-button-bg)_45%,transparent)]",style:{backgroundColor:"var(--primary-button-bg)",color:"var(--primary-button-text)"},"aria-expanded":a,"aria-label":a?"Close chat":"Open chat",onClick:()=>n(t=>!t),children:a?e.jsx("span",{"aria-hidden":!0,className:"text-xl leading-none",children:"×"}):e.jsx(d,{variant:"icon",className:"size-6"})})]})}export{j as WidgetLayout};
@@ -1,4 +1,4 @@
1
- import{r as i}from"./index-DVIyIfJR.js";/**
1
+ import{r as i}from"./index-JWYDBa7W.js";/**
2
2
  * react-router v7.18.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
@@ -0,0 +1 @@
1
+ import{j as n,r as d,a$ as re,a as D,c as f,b0 as j,b1 as ae,b2 as ie,b3 as le,b4 as P,b5 as B,h as Y,u as J,b6 as E,b7 as ce,b8 as ue,b9 as de,ba as me,bb as H,bc as Z,bd as ee,be as fe,i as ne,bf as q,bg as W,ak as pe,bh as ge,bi as he,bj as xe,bk as be,bl as N,W as G,a_ as Ce,ao as te,bm as ve,bn as se,bo as Se,bp as je,bq as Ae,br as ye,bs as Me,bt as ke,g as Ie,O as we,m as oe,s as Re,bu as Ne,bv as Te,bw as Ee,bx as Pe,I as L,d as _,e as T,by as F,bz as Oe,E as Le,bA as De}from"./index-JWYDBa7W.js";function Ue(){var C;const{pending:o}=Z(),e=ve(),[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),c=u>=0?u:r===0?0:Math.min(t.index,r-1),s=(C=o[c])==null?void 0:C.approvalId;d.useEffect(()=>{const h=s??null;t.approvalId===h&&t.index===c||i({approvalId:h,index:c})},[s,c,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 l=d.useCallback(()=>{var b;const h=Math.max(0,c-1);i({approvalId:((b=o[h])==null?void 0:b.approvalId)??null,index:h})},[o,c]),m=d.useCallback(()=>{var b;const h=Math.min(Math.max(r-1,0),c+1);i({approvalId:((b=o[h])==null?void 0:b.approvalId)??null,index:h})},[r,o,c]),g=d.useCallback(()=>{s==null||e==null||e.focus(s)},[s,e]);return{count:r,index:c,canPrev:c>0,canNext:c<r-1,goPrev:l,goNext:m,focusCurrent:g}}function _e(){const o=f("ApprovalNavBanner"),{count:e,index:t,canPrev:i,canNext:a,goPrev:r,goNext:u,focusCurrent:c}=Ue();return e===0?null:n.jsx(o,{total:e,current:t+1,canPrev:i,canNext:a,onPrev:r,onNext:u,onFocusCurrent:c})}var O={radioValue:"",custom:""};function Fe({disabled:o=!1}){const e=f("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]),[c,s]=d.useState(0),[l,m]=d.useState({});d.useEffect(()=>{s(0),m({})},[r==null?void 0:r.toolCallId]);const g=Math.min(c,Math.max(u.length-1,0)),C=u[g],h=C==null?O:l[C.id]??O,b=d.useCallback(v=>{const x=l[v]??O;return x.radioValue===q?x.custom.trim():x.radioValue.trim()},[l]),A=d.useMemo(()=>u.every(v=>b(v.id)),[b,u]),y=h.radioValue===q?h.custom.trim():h.radioValue.trim(),S=a||o||C==null||y.length===0,k=S||!A,M=d.useCallback((v,x)=>{m(R=>({...R,[v]:{...R[v]??O,...x}}))},[]),w=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:w})}function Be(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 He(){const o=j(Be),{pending:e}=H(),{pending:t}=Z(),i=ee();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 ze({disabled:o=!1}){const e=ee(),{pending:t,respond:i}=H(),a=E(),r=t[0],u=d.useCallback(s=>{if(o||r==null)return;const l=s.trim();l&&i({toolCallId:r.toolCallId,content:l})},[o,r,i]);if(r==null||r.toolName==null)return null;const c=e==null?void 0:e[r.toolName];return c==null?null:n.jsx(c,{args:r.args??{},disabled:a||o,onSubmit:u})}function Ve({servers:o,onContinue:e,readOnly:t}){const i=f("McpAuthPrompt"),{handleAuthorize:a}=Ce(),{refreshConnectors:r}=te(),u=c=>{a(c,s=>{s&&r()})};return n.jsx(i,{servers:o,onConnect:u,onContinue:e,readOnly:t})}function Qe({disabled:o=!1}){const e=f("McpAuthPrompt"),{pending:t,resume:i}=fe(),a=E(),r=ne();if(!t)return null;if(r)return n.jsx(Ve,{servers:t.mcpServers,onContinue:()=>{o||i()},readOnly:a||o});const u=c=>{const s=t.mcpServers.find(l=>l.id===c);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 qe({disabled:o,hasText:e,hasAttachments:t,requiresModel:i,hasModel:a}){return!o&&(e||t)&&(!i||a)}function K({placeholder:o,forceDisabled:e=!1,connectedToBanner:t=!1}){var w,v;const i=f("ComposerShell"),a=J(),r=D(),u=j(x=>x.composer.text.trim().length>0),c=j(x=>x.composer.attachments.length>0),{agentSpec:s}=se(),l=r==null||r.mode.status==="active"&&r.mode.isMutable,m=!!((v=(w=s==null?void 0:s.model)==null?void 0:w.name)!=null&&v.trim()),{isBusy:g,send:C,resetBusy:h}=Se(),b=B(),A=je(),y=d.useRef(null),S=g||e||!b,k=qe({disabled:S,hasText:u,hasAttachments:c,requiresModel:l,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 R=x.target.files;if(R)for(const U of R)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(Ae,{}),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 $({placeholder:o,forceDisabled:e=!1,connectedToBanner:t=!1}){const i=D(),a=f("ComposerLeftSection"),r=f("ComposerRightSection"),u=W("ComposerLeftSection"),c=W("ComposerRightSection"),s=f("DraftComposerLeftSection"),l=f("DraftComposerRightSection");return(i==null?void 0:i.mode.status)==="active"&&i.mode.isMutable?n.jsx(pe,{children:n.jsx(ge,{overrides:{ComposerLeftSection:u?s:a,ComposerRightSection:c?l:r},children:n.jsx(K,{placeholder:o,forceDisabled:e,connectedToBanner:t})})}):n.jsx(K,{placeholder:o,forceDisabled:e,connectedToBanner:t})}function We({placeholder:o="Ask anything... (Shift+Enter for new line)"}){const e=He(),t=B();return e.kind==="mcp"?n.jsx(Qe,{disabled:!t}):e.kind==="custom"?n.jsx(ze,{disabled:!t}):e.kind==="ask-user"?n.jsx(Fe,{disabled:!t}):e.kind==="approval"?n.jsxs("div",{"data-slot":"aui_composer-approval-pause",className:"flex w-full flex-col",children:[n.jsx(_e,{}),n.jsx($,{placeholder:o,forceDisabled:!0,connectedToBanner:!0})]}):n.jsx($,{placeholder:o})}var Ge=200,X='[data-slot="aui_thread-viewport"]';function Ke(){const o=f("HistoryLoader"),{hasOlderHistory:e,isLoadingOlderHistory:t,loadOlderHistory:i}=ce(),[a,r]=d.useState(null),u=d.useRef(!1),c=d.useCallback(async()=>{if(u.current)return;u.current=!0;const s=(a==null?void 0:a.closest(X))??null,l=(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-l;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(X),l=new IntersectionObserver(m=>{m.some(g=>g.isIntersecting)&&c()},{root:s,rootMargin:`${Ge}px 0px 0px 0px`});return l.observe(a),()=>l.disconnect()},[a,e,c]),e?n.jsx(o,{ref:r,isLoading:t}):null}function $e(){const o=f("ResumeUnavailable");return me()?n.jsx(o,{}):null}function Xe(){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(ye,{})}):null}function Ye(){const o=f("UserMessageEdit"),e=f("MessageTimestamp"),t=E(),i=B(),a=j(s=>s.message.createdAt),{cancel:r,disabled:u}=he(),{disabled:c}=xe();return n.jsx(be.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(Xe,{}),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(G.Secondary,{type:"button",disabled:u,onClick:r,children:"Cancel"}),n.jsx(N.Send,{asChild:!0,children:n.jsx(G.Primary,{type:"submit",disabled:c||t||!i,children:"Save & Rerun"})})]})})})})}function Je(){const o=Y(),e=J(),t=j(c=>c.threadListItem.remoteId),i=j(c=>c.threadListItem.title),a=E(),r=d.useRef(!1),u=d.useRef(void 0);d.useEffect(()=>{u.current=void 0},[t]),d.useEffect(()=>{const c=r.current&&!a;if(r.current=a,!c||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(l=>{if(s)return;const m=typeof l.title=="string"?l.title.trim():"";if(m.length!==0)return u.current=t,e.threadListItem().rename(m)}).catch(()=>{}),()=>{s=!0}},[e,a,t,o,i])}function Ze({children:o}){return n.jsx("div",{className:"animate-in fade-in slide-in-from-bottom-1 fill-mode-both duration-200",children:o})}function en({isEditing:o}){return j(t=>t.message.role)==="user"?o?n.jsx(Ye,{}):n.jsx(ue,{}):n.jsx(de,{})}function nn({composer:o}){d.useEffect(()=>{re()},[]),Je();const e=D(),t=f("WelcomeScreen"),i=f("MessageListSkeleton"),a=f("ScrollToBottomButton"),r=f("MessageGroup"),u=f("ThreadComposerAreaShell"),c=f("ThreadRootShell"),s=f("ThreadViewportShell"),l=j(ae),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(ie,{children:n.jsx(le,{children:n.jsx(P.Root,{asChild:!0,children:n.jsxs(c,{children:[n.jsx(P.Viewport,{asChild:!0,autoScroll:!0,children:n.jsxs(s,{isEmpty:l,children:[l&&n.jsx(t,{heading:g}),l&&!m&&o,m?n.jsx(i,{}):!l&&n.jsxs(n.Fragment,{children:[n.jsx(Ke,{}),n.jsxs(r,{children:[n.jsx(P.Messages,{children:({message:C})=>n.jsx(Ze,{children:n.jsx(en,{isEditing:C.role==="user"&&C.composer.isEditing})})}),n.jsx($e,{})]})]})]})}),!m&&!l&&n.jsxs(u,{isEmpty:l,children:[n.jsx(P.ScrollToBottom,{asChild:!0,children:n.jsx(a,{})}),o]})]})})})})}function sn(){return n.jsx(nn,{composer:n.jsx(We,{})})}function on({className:o}){const e=Oe(),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:T("flex min-w-0 items-center gap-1.5",De,o),children:[n.jsx("span",{className:"truncate",title:a,children:a}),e.isEditing?n.jsx(Le,{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(L,{name:"pencil",className:"size-3"}),"Editing"]})}):null]})}function rn({className:o,labeled:e=!1}){const t=D(),i=ne(),a=oe(),{mode:r,setTheme:u}=Ee(),c=f("ShellActionsActionSlot"),s=r==="dark",l=s?"Light":"Dark",m=Pe({catalog:i,capabilities:a}),g="hover:bg-secondary-button-hover hover:text-ghost-button-text";return n.jsxs("div",{className:T("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:T(g,e&&F)}),children:[n.jsx(L,{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:T(g,e&&F)}),onClick:()=>u(s?"light":"dark"),children:[n.jsx(L,{name:s?"sun":"moon",size:e?14:void 0}),e?n.jsx("span",{className:"text-center",children:l}):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:T(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(L,{name:"settings",size:e?14:void 0}),e?n.jsx("span",{className:"text-center",children:"Settings"}):null]}):null,n.jsx(c,{})]})}function an({showClose:o=!1}){var z,V;const{agentSpec:e}=se(),t=Me(),i=ke(),a=Ie(),r=a.mode.status==="active"?a.mode.agentId:void 0,{allows:u}=we({resourceType:"agent",resourceIds:r==null?[]:[r]}),c=u(r,"MANAGE"),s=Y(),l=oe(),m=te(),g=f("AgentConfigPanel"),C=f("AgentConfigEditors"),[h,b]=d.useState(null),A=Re(a.mode),{draft:y,flush:S}=Ne(),k=d.useCallback(()=>{S(),i(),a.setAgentConfigOpen(!1)},[i,S,a]);d.useEffect(()=>{A&&m.ensureLoaded()},[m,A]),d.useEffect(()=>{c||b(null)},[c]),d.useEffect(()=>{if(!o||!a.agentConfigOpen)return;const p=I=>{!I.defaultPrevented&&I.key==="Escape"&&h===null&&document.querySelector("dialog[open]")===null&&k()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[k,h,a.agentConfigOpen,o]),d.useEffect(()=>()=>{S();try{i()}catch{}},[i,S]);const M=d.useCallback(({next:p,instructions:I})=>{var Q;if(c){if(p.skills&&p.skills.length>0&&(l==null?void 0:l.sandbox.enabled)===!0){t==null||t({...p,instructions:I||void 0,config:{...p.config,sandbox:{...(Q=p.config)==null?void 0:Q.sandbox,enabled:!0}}});return}t==null||t({...p,instructions:I||void 0})}},[c,l==null?void 0:l.sandbox.enabled,t]),w=d.useCallback(p=>{M({next:p,instructions:y})},[M,y]),v=d.useCallback(p=>{e!==null&&M({next:Te({spec:e,messages:p.messages}),instructions:p.instructions})},[e,M]),x=d.useCallback(async p=>(s==null?void 0:s.getMcpTools)===void 0?[]:s.getMcpTools({connectorId:p}),[s]),R=d.useCallback(async p=>{var I;return(I=s==null?void 0:s.getMcpConnector)==null?void 0:I.call(s,{connectorId:p})},[s]);if(!A||e===null||o&&!a.agentConfigOpen)return null;const U=m.models.find(p=>p.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:(l==null?void 0:l.skill.enabled)===!0,webSearchAvailable:((z=l==null?void 0:l.webSearch)==null?void 0:z.enabled)===!0,instructions:y,onOpenEditor:p=>{c&&b(p)},onChange:w,disabled:!c,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:(l==null?void 0:l.skill.enabled)!==!0,sandboxAvailable:(l==null?void 0:l.sandbox.enabled)===!0,webSearchAvailable:((V=l==null?void 0:l.webSearch)==null?void 0:V.enabled)===!0,instructions:y,onInstructionsSave:v,...(s==null?void 0:s.getMcpConnector)===void 0?{}:{loadMcpConnector:R},loadMcpTools:x,onRefreshConnectors:m.refreshConnectors,onChange:w,onClose:()=>b(null)})]})}export{an as A,on as N,rn as S,sn as T};
@@ -1 +1 @@
1
- import{v as h,w as u,x as g,y as m,z as w}from"./index-DVIyIfJR.js";var l={root:"/",settings:"/settings",library:"/library",libraryAgent:"/library/:agentId",schedules:"/schedules",buildAgent:"/build-agent",agent:"/agents/:agentName",session:"/sessions/:sessionId",sessionsBrowser:"/sessions"};function f(n){const e=n.trim(),s=e.startsWith("/")?e:`/${e}`;return s.length>1&&s.endsWith("/")?s.slice(0,-1):s}function a(n,e){return n===!1?null:f(n??e)}function R(n){const e=n==null?void 0:n.paths;return{basename:(n==null?void 0:n.basename)??"",root:f((e==null?void 0:e.root)??l.root),settings:a(e==null?void 0:e.settings,l.settings),library:a(e==null?void 0:e.library,l.library),libraryAgent:a(e==null?void 0:e.libraryAgent,l.libraryAgent),schedules:a(e==null?void 0:e.schedules,l.schedules),buildAgent:a(e==null?void 0:e.buildAgent,l.buildAgent),agent:a(e==null?void 0:e.agent,l.agent),session:a(e==null?void 0:e.session,l.session),sessionsBrowser:a(e==null?void 0:e.sessionsBrowser,l.sessionsBrowser)}}function y(n){return n.split("/").filter(e=>e.length>0)}function c(n,e){return"/"+y(n).map(s=>s.startsWith(":")?encodeURIComponent(e):s).join("/")}function S(n,e){switch(n.type){case"root":return e.root;case"settings":return e.settings;case"library":return e.library;case"libraryAgent":return e.libraryAgent==null?null:c(e.libraryAgent,n.agentId);case"schedules":return e.schedules;case"buildAgent":return e.buildAgent;case"agent":return e.agent==null?null:c(e.agent,n.agentName);case"session":return e.session==null?null:c(e.session,n.sessionId);case"sessionsBrowser":return e.sessionsBrowser}}function v({sessionId:n,routes:e,href:s=typeof window>"u"?"http://localhost/":window.location.href}){const i=S({type:"session",sessionId:n},e);if(i==null)return null;const t=new URL(s),r=e.basename.endsWith("/")?e.basename.slice(0,-1):e.basename;return t.pathname=`${r}${i}`||"/",t.search=A({type:"session"},t.search),t.hash="",t.toString()}function A(n,e){if(n.type==="settings")return e;const s=new URLSearchParams(e.startsWith("?")?e.slice(1):e);if(n.type==="sessionsBrowser")u(s,{tab:null}),g(s);else if(n.type==="libraryAgent"){const t=h(e),r=m(e);u(s,{view:null,timeRange:null,...t.sessionId!=null&&t.agentId!==n.agentId?{sessionId:null,agentId:null}:{}}),g(s),t.tab==="schedules"&&w(s,{status:r.status,q:r.q,isNew:r.isNew})}else n.type==="schedules"?u(s,{sessionId:null,agentId:null,tab:null,view:null,timeRange:null}):(u(s,{sessionId:null,agentId:null,tab:null,view:null,timeRange:null}),g(s));const i=s.toString();return i.length>0?`?${i}`:""}function p(n){try{return decodeURIComponent(n)}catch{return null}}function d(n,e){const s=y(n);if(s.length!==e.length)return null;let i=null;for(const[t,r]of s.entries()){const o=e[t];if(o===void 0)return null;if(r.startsWith(":")){const b=p(o);if(b==null)return null;i=b}else if(r!==o)return null}return i}function I(n,e){const s=f(n),i=y(s);if(e.settings!=null&&s===e.settings)return{type:"settings"};if(e.library!=null&&s===e.library)return{type:"library"};if(e.sessionsBrowser!=null&&s===e.sessionsBrowser)return{type:"sessionsBrowser"};if(e.libraryAgent!=null){const t=d(e.libraryAgent,i);if(t!=null)return{type:"libraryAgent",agentId:t}}if(e.schedules!=null&&s===e.schedules)return{type:"schedules"};if(e.buildAgent!=null&&s===e.buildAgent)return{type:"buildAgent"};if(e.agent!=null){const t=d(e.agent,i);if(t!=null)return{type:"agent",agentName:t}}if(e.session!=null){const t=d(e.session,i);if(t!=null)return{type:"session",sessionId:t}}return s===e.root?{type:"root"}:null}function N({pathname:n,search:e,routes:s}){const i=I(n,s);if(i==null||i.type!=="root")return i;const{agentId:t}=h(e);return t!=null?{type:"libraryAgent",agentId:t}:i}function P(n,e){return n.type!==e.type?!1:n.type==="agent"&&e.type==="agent"?n.agentName===e.agentName:n.type==="libraryAgent"&&e.type==="libraryAgent"?n.agentId===e.agentId:n.type==="session"&&e.type==="session"?n.sessionId===e.sessionId:!0}export{v as a,S as b,N as m,P as p,R as r,A as s};
1
+ import{F as h,G as u,H as g,J as m,K as w}from"./index-JWYDBa7W.js";var l={root:"/",settings:"/settings",library:"/library",libraryAgent:"/library/:agentId",schedules:"/schedules",buildAgent:"/build-agent",agent:"/agents/:agentName",session:"/sessions/:sessionId",sessionsBrowser:"/sessions"};function f(n){const e=n.trim(),s=e.startsWith("/")?e:`/${e}`;return s.length>1&&s.endsWith("/")?s.slice(0,-1):s}function a(n,e){return n===!1?null:f(n??e)}function R(n){const e=n==null?void 0:n.paths;return{basename:(n==null?void 0:n.basename)??"",root:f((e==null?void 0:e.root)??l.root),settings:a(e==null?void 0:e.settings,l.settings),library:a(e==null?void 0:e.library,l.library),libraryAgent:a(e==null?void 0:e.libraryAgent,l.libraryAgent),schedules:a(e==null?void 0:e.schedules,l.schedules),buildAgent:a(e==null?void 0:e.buildAgent,l.buildAgent),agent:a(e==null?void 0:e.agent,l.agent),session:a(e==null?void 0:e.session,l.session),sessionsBrowser:a(e==null?void 0:e.sessionsBrowser,l.sessionsBrowser)}}function y(n){return n.split("/").filter(e=>e.length>0)}function c(n,e){return"/"+y(n).map(s=>s.startsWith(":")?encodeURIComponent(e):s).join("/")}function S(n,e){switch(n.type){case"root":return e.root;case"settings":return e.settings;case"library":return e.library;case"libraryAgent":return e.libraryAgent==null?null:c(e.libraryAgent,n.agentId);case"schedules":return e.schedules;case"buildAgent":return e.buildAgent;case"agent":return e.agent==null?null:c(e.agent,n.agentName);case"session":return e.session==null?null:c(e.session,n.sessionId);case"sessionsBrowser":return e.sessionsBrowser}}function N({sessionId:n,routes:e,href:s=typeof window>"u"?"http://localhost/":window.location.href}){const i=S({type:"session",sessionId:n},e);if(i==null)return null;const t=new URL(s),r=e.basename.endsWith("/")?e.basename.slice(0,-1):e.basename;return t.pathname=`${r}${i}`||"/",t.search=A({type:"session"},t.search),t.hash="",t.toString()}function A(n,e){if(n.type==="settings")return e;const s=new URLSearchParams(e.startsWith("?")?e.slice(1):e);if(n.type==="sessionsBrowser")u(s,{tab:null}),g(s);else if(n.type==="libraryAgent"){const t=h(e),r=m(e);u(s,{view:null,timeRange:null,...t.sessionId!=null&&t.agentId!==n.agentId?{sessionId:null,agentId:null}:{}}),g(s),t.tab==="schedules"&&w(s,{status:r.status,q:r.q,isNew:r.isNew})}else n.type==="schedules"?u(s,{sessionId:null,agentId:null,tab:null,view:null,timeRange:null}):(u(s,{sessionId:null,agentId:null,tab:null,view:null,timeRange:null}),g(s));const i=s.toString();return i.length>0?`?${i}`:""}function p(n){try{return decodeURIComponent(n)}catch{return null}}function d(n,e){const s=y(n);if(s.length!==e.length)return null;let i=null;for(const[t,r]of s.entries()){const o=e[t];if(o===void 0)return null;if(r.startsWith(":")){const b=p(o);if(b==null)return null;i=b}else if(r!==o)return null}return i}function I(n,e){const s=f(n),i=y(s);if(e.settings!=null&&s===e.settings)return{type:"settings"};if(e.library!=null&&s===e.library)return{type:"library"};if(e.sessionsBrowser!=null&&s===e.sessionsBrowser)return{type:"sessionsBrowser"};if(e.libraryAgent!=null){const t=d(e.libraryAgent,i);if(t!=null)return{type:"libraryAgent",agentId:t}}if(e.schedules!=null&&s===e.schedules)return{type:"schedules"};if(e.buildAgent!=null&&s===e.buildAgent)return{type:"buildAgent"};if(e.agent!=null){const t=d(e.agent,i);if(t!=null)return{type:"agent",agentName:t}}if(e.session!=null){const t=d(e.session,i);if(t!=null)return{type:"session",sessionId:t}}return s===e.root?{type:"root"}:null}function v({pathname:n,search:e,routes:s}){const i=I(n,s);if(i==null||i.type!=="root")return i;const{agentId:t}=h(e);return t!=null?{type:"libraryAgent",agentId:t}:i}function P(n,e){return n.type!==e.type?!1:n.type==="agent"&&e.type==="agent"?n.agentName===e.agentName:n.type==="libraryAgent"&&e.type==="libraryAgent"?n.agentId===e.agentId:n.type==="session"&&e.type==="session"?n.sessionId===e.sessionId:!0}export{N as a,S as b,v as m,P as p,R as r,A as s};