@truefoundry/trueforge 0.2.0 → 0.3.0-rc.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 (219) hide show
  1. package/dist/_frontend/assets/{AgentCodeSnippets-EK7KMIY2-BSbWDfhX.js → AgentCodeSnippets-BPC6TD7K-B1T1mqKJ.js} +1 -1
  2. package/dist/_frontend/assets/AgentCodeSnippets-BPC6TD7K-B1T1mqKJ.js.br +0 -0
  3. package/dist/_frontend/assets/AgentCodeSnippets-BPC6TD7K-B1T1mqKJ.js.gz +0 -0
  4. package/dist/_frontend/assets/{AgentMetricChart-UZCYOC4M-CoNlyHRt.js → AgentMetricChart-T6DZZ37Y-BikFOApC.js} +1 -1
  5. package/dist/_frontend/assets/AgentMetricChart-T6DZZ37Y-BikFOApC.js.br +0 -0
  6. package/dist/_frontend/assets/AgentMetricChart-T6DZZ37Y-BikFOApC.js.gz +0 -0
  7. package/dist/_frontend/assets/{AgentOverview-5UPMYHT2-WRvNQCHH.js → AgentOverview-BFU7EO4Y-B_AVURNj.js} +1 -1
  8. package/dist/_frontend/assets/AgentOverview-BFU7EO4Y-B_AVURNj.js.br +0 -0
  9. package/dist/_frontend/assets/AgentOverview-BFU7EO4Y-B_AVURNj.js.gz +0 -0
  10. package/dist/_frontend/assets/{AgentSessionEventTimeline-V6NPCYMW-D5pZyPP1.js → AgentSessionEventTimeline-ATVBTYDF-CQqNlw83.js} +1 -1
  11. package/dist/_frontend/assets/AgentSessionEventTimeline-ATVBTYDF-CQqNlw83.js.br +0 -0
  12. package/dist/_frontend/assets/AgentSessionEventTimeline-ATVBTYDF-CQqNlw83.js.gz +0 -0
  13. package/dist/_frontend/assets/{AgentSessionEventTimelineChart-YQWZBQCG-CqBkdMKC.js → AgentSessionEventTimelineChart-H577STKW-C60m-0SZ.js} +1 -1
  14. package/dist/_frontend/assets/AgentSessionEventTimelineChart-H577STKW-C60m-0SZ.js.br +0 -0
  15. package/dist/_frontend/assets/AgentSessionEventTimelineChart-H577STKW-C60m-0SZ.js.gz +0 -0
  16. package/dist/_frontend/assets/{AgentSessions-WNYVVB6Q-DIwFNwFg.js → AgentSessions-GDLBXFIK-DnsZyTRr.js} +1 -1
  17. package/dist/_frontend/assets/AgentSessions-GDLBXFIK-DnsZyTRr.js.br +0 -0
  18. package/dist/_frontend/assets/AgentSessions-GDLBXFIK-DnsZyTRr.js.gz +0 -0
  19. package/dist/_frontend/assets/{ConnectorSettings-O4I24244-22M_-mC7.js → ConnectorSettings-FYNF6J3F-COur0yqS.js} +1 -1
  20. package/dist/_frontend/assets/ConnectorSettings-FYNF6J3F-COur0yqS.js.br +0 -0
  21. package/dist/_frontend/assets/ConnectorSettings-FYNF6J3F-COur0yqS.js.gz +0 -0
  22. package/dist/_frontend/assets/{DockLayout-JMBZVMGB-C-VR3Ee2.js → DockLayout-SGUOMZ5E-CEDMk1ae.js} +1 -1
  23. package/dist/_frontend/assets/{DrawerLayout-E6G3IF6R-D8RZ3D7u.js → DrawerLayout-MJJYQDCW-D8DQQcQF.js} +2 -2
  24. package/dist/_frontend/assets/DrawerLayout-MJJYQDCW-D8DQQcQF.js.br +0 -0
  25. package/dist/_frontend/assets/DrawerLayout-MJJYQDCW-D8DQQcQF.js.gz +0 -0
  26. package/dist/_frontend/assets/ModelSettings-6EW7U2MP-DbtZxzUW.js +1 -0
  27. package/dist/_frontend/assets/ModelSettings-6EW7U2MP-DbtZxzUW.js.br +0 -0
  28. package/dist/_frontend/assets/ModelSettings-6EW7U2MP-DbtZxzUW.js.gz +0 -0
  29. package/dist/_frontend/assets/{SandboxSettings-H6BA2DJQ-ZI6uU_-B.js → SandboxSettings-HQVBGHXZ-CZe1E4Rj.js} +1 -1
  30. package/dist/_frontend/assets/SandboxSettings-HQVBGHXZ-CZe1E4Rj.js.br +0 -0
  31. package/dist/_frontend/assets/SandboxSettings-HQVBGHXZ-CZe1E4Rj.js.gz +0 -0
  32. package/dist/_frontend/assets/SchedulesPage-ZO3PJY4J-DnSsCsve.js +1 -0
  33. package/dist/_frontend/assets/SchedulesPage-ZO3PJY4J-DnSsCsve.js.br +0 -0
  34. package/dist/_frontend/assets/SchedulesPage-ZO3PJY4J-DnSsCsve.js.gz +0 -0
  35. package/dist/_frontend/assets/SettingsBuilder-FODMI7HG-CyRho5Uc.js +2 -0
  36. package/dist/_frontend/assets/SettingsBuilder-FODMI7HG-CyRho5Uc.js.br +0 -0
  37. package/dist/_frontend/assets/SettingsBuilder-FODMI7HG-CyRho5Uc.js.gz +0 -0
  38. package/dist/_frontend/assets/{ShellRouteSync-ZT4PBE6T-DkGPKx4y.js → ShellRouteSync-4I5BP2VY-SuZYdmPG.js} +1 -1
  39. package/dist/_frontend/assets/ShellRouteSync-4I5BP2VY-SuZYdmPG.js.br +0 -0
  40. package/dist/_frontend/assets/ShellRouteSync-4I5BP2VY-SuZYdmPG.js.gz +0 -0
  41. package/dist/_frontend/assets/SidebarLayout-ZLWG2YGO-iNuRGXgp.js +2 -0
  42. package/dist/_frontend/assets/SidebarLayout-ZLWG2YGO-iNuRGXgp.js.br +0 -0
  43. package/dist/_frontend/assets/SidebarLayout-ZLWG2YGO-iNuRGXgp.js.gz +0 -0
  44. package/dist/_frontend/assets/{SkillSettings-F5JGGFXR-Bz-nW3QX.js → SkillSettings-AFSAOU6O-EcWn2HFB.js} +1 -1
  45. package/dist/_frontend/assets/SkillSettings-AFSAOU6O-EcWn2HFB.js.br +0 -0
  46. package/dist/_frontend/assets/SkillSettings-AFSAOU6O-EcWn2HFB.js.gz +0 -0
  47. package/dist/_frontend/assets/TrueForgeUIWithRouter-RQX5XWGI-afnJ79jt.js +1 -0
  48. package/dist/_frontend/assets/WebSearchSettings-BW4CWGRR-Cs-t9iMH.js +1 -0
  49. package/dist/_frontend/assets/WebSearchSettings-BW4CWGRR-Cs-t9iMH.js.br +0 -0
  50. package/dist/_frontend/assets/WebSearchSettings-BW4CWGRR-Cs-t9iMH.js.gz +0 -0
  51. package/dist/_frontend/assets/{WidgetLayout-J7ZRW3V3-DYDWODqy.js → WidgetLayout-WIPKUIL4-VyhjEehs.js} +1 -1
  52. package/dist/_frontend/assets/WidgetLayout-WIPKUIL4-VyhjEehs.js.br +0 -0
  53. package/dist/_frontend/assets/WidgetLayout-WIPKUIL4-VyhjEehs.js.gz +0 -0
  54. package/dist/_frontend/assets/{chunk-62JRHF6Z-CtriJkXR.js → chunk-62JRHF6Z-DWQVXP0g.js} +1 -1
  55. package/dist/_frontend/assets/chunk-62JRHF6Z-DWQVXP0g.js.br +0 -0
  56. package/dist/_frontend/assets/chunk-62JRHF6Z-DWQVXP0g.js.gz +0 -0
  57. package/dist/_frontend/assets/chunk-TFQWCBFQ-CObdB7gd.js +1 -0
  58. package/dist/_frontend/assets/chunk-TFQWCBFQ-CObdB7gd.js.br +0 -0
  59. package/dist/_frontend/assets/chunk-TFQWCBFQ-CObdB7gd.js.gz +0 -0
  60. package/dist/_frontend/assets/{chunk-JEAULQNF-BD5-zY_K.js → chunk-TJGGIEF6-NrA1UOxh.js} +1 -1
  61. package/dist/_frontend/assets/chunk-TJGGIEF6-NrA1UOxh.js.br +0 -0
  62. package/dist/_frontend/assets/chunk-TJGGIEF6-NrA1UOxh.js.gz +0 -0
  63. package/dist/_frontend/assets/{chunk-MB7Z5FPI-CyN2m3rd.js → chunk-YN5ZBBQM-C6IH83Y_.js} +2 -2
  64. package/dist/_frontend/assets/chunk-YN5ZBBQM-C6IH83Y_.js.br +0 -0
  65. package/dist/_frontend/assets/chunk-YN5ZBBQM-C6IH83Y_.js.gz +0 -0
  66. package/dist/_frontend/assets/{cssMode-C-8VzKP7.js → cssMode-BLgfUUIP.js} +1 -1
  67. package/dist/_frontend/assets/cssMode-BLgfUUIP.js.br +0 -0
  68. package/dist/_frontend/assets/cssMode-BLgfUUIP.js.gz +0 -0
  69. package/dist/_frontend/assets/{freemarker2-DDwuEFeX.js → freemarker2-D9Zhxhbo.js} +1 -1
  70. package/dist/_frontend/assets/freemarker2-D9Zhxhbo.js.br +0 -0
  71. package/dist/_frontend/assets/freemarker2-D9Zhxhbo.js.gz +0 -0
  72. package/dist/_frontend/assets/{handlebars-DqPfTAei.js → handlebars-Cr-mYRIr.js} +1 -1
  73. package/dist/_frontend/assets/handlebars-Cr-mYRIr.js.br +0 -0
  74. package/dist/_frontend/assets/handlebars-Cr-mYRIr.js.gz +0 -0
  75. package/dist/_frontend/assets/{html-D0gOfqP6.js → html-BSXsByU9.js} +1 -1
  76. package/dist/_frontend/assets/html-BSXsByU9.js.br +0 -0
  77. package/dist/_frontend/assets/html-BSXsByU9.js.gz +0 -0
  78. package/dist/_frontend/assets/{htmlMode-gx5Bk3tY.js → htmlMode-Dl_li53P.js} +1 -1
  79. package/dist/_frontend/assets/htmlMode-Dl_li53P.js.br +0 -0
  80. package/dist/_frontend/assets/htmlMode-Dl_li53P.js.gz +0 -0
  81. package/dist/_frontend/assets/{index-JWYDBa7W.js → index-CPHXhr9t.js} +245 -245
  82. package/dist/_frontend/assets/index-CPHXhr9t.js.br +0 -0
  83. package/dist/_frontend/assets/index-CPHXhr9t.js.gz +0 -0
  84. package/dist/_frontend/assets/{index-Djblv9e3.js → index-DbkdD8rw.js} +3 -3
  85. package/dist/_frontend/assets/index-DbkdD8rw.js.br +0 -0
  86. package/dist/_frontend/assets/index-DbkdD8rw.js.gz +0 -0
  87. package/dist/_frontend/assets/{index-BWMZWgYr.js → index-Dwv00glI.js} +1 -1
  88. package/dist/_frontend/assets/index-Dwv00glI.js.br +0 -0
  89. package/dist/_frontend/assets/index-Dwv00glI.js.gz +0 -0
  90. package/dist/_frontend/assets/{javascript-DVPzhVD0.js → javascript-qaGDMU9N.js} +1 -1
  91. package/dist/_frontend/assets/{jsonMode-GEdzVuNq.js → jsonMode-BINBtD9i.js} +1 -1
  92. package/dist/_frontend/assets/jsonMode-BINBtD9i.js.br +0 -0
  93. package/dist/_frontend/assets/jsonMode-BINBtD9i.js.gz +0 -0
  94. package/dist/_frontend/assets/{liquid-BItsX3iF.js → liquid-DSnOJ-2h.js} +1 -1
  95. package/dist/_frontend/assets/liquid-DSnOJ-2h.js.br +0 -0
  96. package/dist/_frontend/assets/liquid-DSnOJ-2h.js.gz +0 -0
  97. package/dist/_frontend/assets/{lspLanguageFeatures-Cus-UaLQ.js → lspLanguageFeatures-B7zTxQeR.js} +1 -1
  98. package/dist/_frontend/assets/lspLanguageFeatures-B7zTxQeR.js.br +0 -0
  99. package/dist/_frontend/assets/lspLanguageFeatures-B7zTxQeR.js.gz +0 -0
  100. package/dist/_frontend/assets/{mdx-DKtnK9lB.js → mdx-BkeHwsFe.js} +1 -1
  101. package/dist/_frontend/assets/mdx-BkeHwsFe.js.br +0 -0
  102. package/dist/_frontend/assets/mdx-BkeHwsFe.js.gz +0 -0
  103. package/dist/_frontend/assets/{python-BTjir3x0.js → python-CBbLT2F3.js} +1 -1
  104. package/dist/_frontend/assets/python-CBbLT2F3.js.br +0 -0
  105. package/dist/_frontend/assets/python-CBbLT2F3.js.gz +0 -0
  106. package/dist/_frontend/assets/{razor-BW5FLKz0.js → razor-CqJ8opAm.js} +1 -1
  107. package/dist/_frontend/assets/razor-CqJ8opAm.js.br +0 -0
  108. package/dist/_frontend/assets/razor-CqJ8opAm.js.gz +0 -0
  109. package/dist/_frontend/assets/{tsMode-D_fZmsMS.js → tsMode-Dcw7IR7T.js} +1 -1
  110. package/dist/_frontend/assets/tsMode-Dcw7IR7T.js.br +0 -0
  111. package/dist/_frontend/assets/tsMode-Dcw7IR7T.js.gz +0 -0
  112. package/dist/_frontend/assets/{typescript-CGtHZQss.js → typescript-y4i1eGHh.js} +1 -1
  113. package/dist/_frontend/assets/typescript-y4i1eGHh.js.br +0 -0
  114. package/dist/_frontend/assets/typescript-y4i1eGHh.js.gz +0 -0
  115. package/dist/_frontend/assets/{workers-pKgmUfu_.js → workers-zrfOS25q.js} +1 -1
  116. package/dist/_frontend/assets/workers-zrfOS25q.js.br +0 -0
  117. package/dist/_frontend/assets/workers-zrfOS25q.js.gz +0 -0
  118. package/dist/_frontend/assets/{xml-BhrTu8Vy.js → xml-ByQHPnmR.js} +1 -1
  119. package/dist/_frontend/assets/xml-ByQHPnmR.js.br +0 -0
  120. package/dist/_frontend/assets/xml-ByQHPnmR.js.gz +0 -0
  121. package/dist/_frontend/assets/{yaml-G9x_AjyZ.js → yaml-sPjcg_YH.js} +1 -1
  122. package/dist/_frontend/assets/yaml-sPjcg_YH.js.br +0 -0
  123. package/dist/_frontend/assets/yaml-sPjcg_YH.js.gz +0 -0
  124. package/dist/_frontend/index.html +1 -1
  125. package/dist/controller-main.js +183 -21
  126. package/dist/controller-main.js.map +1 -1
  127. package/dist/main.js +1150 -363
  128. package/dist/main.js.map +1 -1
  129. package/dist/postgres/migrations/20260727_000001_init.js +175 -13
  130. package/dist/postgres/migrations/20260727_000001_init.js.map +1 -1
  131. package/dist/postgres/migrations/20260921_000001_web_search_provider.js +15 -0
  132. package/dist/postgres/migrations/20260921_000001_web_search_provider.js.map +1 -0
  133. package/dist/sqlite/migrations/20260921_000001_web_search_provider.js +25 -0
  134. package/dist/sqlite/migrations/20260921_000001_web_search_provider.js.map +1 -0
  135. package/package.json +4 -3
  136. package/dist/_frontend/assets/AgentCodeSnippets-EK7KMIY2-BSbWDfhX.js.br +0 -0
  137. package/dist/_frontend/assets/AgentCodeSnippets-EK7KMIY2-BSbWDfhX.js.gz +0 -0
  138. package/dist/_frontend/assets/AgentMetricChart-UZCYOC4M-CoNlyHRt.js.br +0 -0
  139. package/dist/_frontend/assets/AgentMetricChart-UZCYOC4M-CoNlyHRt.js.gz +0 -0
  140. package/dist/_frontend/assets/AgentOverview-5UPMYHT2-WRvNQCHH.js.br +0 -0
  141. package/dist/_frontend/assets/AgentOverview-5UPMYHT2-WRvNQCHH.js.gz +0 -0
  142. package/dist/_frontend/assets/AgentSessionEventTimeline-V6NPCYMW-D5pZyPP1.js.br +0 -0
  143. package/dist/_frontend/assets/AgentSessionEventTimeline-V6NPCYMW-D5pZyPP1.js.gz +0 -0
  144. package/dist/_frontend/assets/AgentSessionEventTimelineChart-YQWZBQCG-CqBkdMKC.js.br +0 -0
  145. package/dist/_frontend/assets/AgentSessionEventTimelineChart-YQWZBQCG-CqBkdMKC.js.gz +0 -0
  146. package/dist/_frontend/assets/AgentSessions-WNYVVB6Q-DIwFNwFg.js.br +0 -0
  147. package/dist/_frontend/assets/AgentSessions-WNYVVB6Q-DIwFNwFg.js.gz +0 -0
  148. package/dist/_frontend/assets/ConnectorSettings-O4I24244-22M_-mC7.js.br +0 -0
  149. package/dist/_frontend/assets/ConnectorSettings-O4I24244-22M_-mC7.js.gz +0 -0
  150. package/dist/_frontend/assets/DrawerLayout-E6G3IF6R-D8RZ3D7u.js.br +0 -0
  151. package/dist/_frontend/assets/DrawerLayout-E6G3IF6R-D8RZ3D7u.js.gz +0 -0
  152. package/dist/_frontend/assets/ModelSettings-ZVXMXIU4-CTVBWR_b.js +0 -1
  153. package/dist/_frontend/assets/ModelSettings-ZVXMXIU4-CTVBWR_b.js.br +0 -0
  154. package/dist/_frontend/assets/ModelSettings-ZVXMXIU4-CTVBWR_b.js.gz +0 -0
  155. package/dist/_frontend/assets/SandboxSettings-H6BA2DJQ-ZI6uU_-B.js.br +0 -0
  156. package/dist/_frontend/assets/SandboxSettings-H6BA2DJQ-ZI6uU_-B.js.gz +0 -0
  157. package/dist/_frontend/assets/SchedulesPage-FS2QZ5KB-rgCfvw8i.js +0 -1
  158. package/dist/_frontend/assets/SchedulesPage-FS2QZ5KB-rgCfvw8i.js.br +0 -0
  159. package/dist/_frontend/assets/SchedulesPage-FS2QZ5KB-rgCfvw8i.js.gz +0 -0
  160. package/dist/_frontend/assets/SettingsBuilder-VA3VGWZC-DIAqWtHn.js +0 -2
  161. package/dist/_frontend/assets/SettingsBuilder-VA3VGWZC-DIAqWtHn.js.br +0 -0
  162. package/dist/_frontend/assets/SettingsBuilder-VA3VGWZC-DIAqWtHn.js.gz +0 -0
  163. package/dist/_frontend/assets/ShellRouteSync-ZT4PBE6T-DkGPKx4y.js.br +0 -0
  164. package/dist/_frontend/assets/ShellRouteSync-ZT4PBE6T-DkGPKx4y.js.gz +0 -0
  165. package/dist/_frontend/assets/SidebarLayout-ICXEN7ZL--zbCMgyI.js +0 -2
  166. package/dist/_frontend/assets/SidebarLayout-ICXEN7ZL--zbCMgyI.js.br +0 -0
  167. package/dist/_frontend/assets/SidebarLayout-ICXEN7ZL--zbCMgyI.js.gz +0 -0
  168. package/dist/_frontend/assets/SkillSettings-F5JGGFXR-Bz-nW3QX.js.br +0 -0
  169. package/dist/_frontend/assets/SkillSettings-F5JGGFXR-Bz-nW3QX.js.gz +0 -0
  170. package/dist/_frontend/assets/TrueForgeUIWithRouter-MKJ7IEWG-DwIPuROH.js +0 -1
  171. package/dist/_frontend/assets/WidgetLayout-J7ZRW3V3-DYDWODqy.js.br +0 -0
  172. package/dist/_frontend/assets/WidgetLayout-J7ZRW3V3-DYDWODqy.js.gz +0 -0
  173. package/dist/_frontend/assets/chunk-62JRHF6Z-CtriJkXR.js.br +0 -0
  174. package/dist/_frontend/assets/chunk-62JRHF6Z-CtriJkXR.js.gz +0 -0
  175. package/dist/_frontend/assets/chunk-7VWUB5OV-DTCqM7Y6.js +0 -1
  176. package/dist/_frontend/assets/chunk-7VWUB5OV-DTCqM7Y6.js.br +0 -0
  177. package/dist/_frontend/assets/chunk-7VWUB5OV-DTCqM7Y6.js.gz +0 -0
  178. package/dist/_frontend/assets/chunk-JEAULQNF-BD5-zY_K.js.br +0 -0
  179. package/dist/_frontend/assets/chunk-JEAULQNF-BD5-zY_K.js.gz +0 -0
  180. package/dist/_frontend/assets/chunk-MB7Z5FPI-CyN2m3rd.js.br +0 -0
  181. package/dist/_frontend/assets/chunk-MB7Z5FPI-CyN2m3rd.js.gz +0 -0
  182. package/dist/_frontend/assets/cssMode-C-8VzKP7.js.br +0 -0
  183. package/dist/_frontend/assets/cssMode-C-8VzKP7.js.gz +0 -0
  184. package/dist/_frontend/assets/freemarker2-DDwuEFeX.js.br +0 -0
  185. package/dist/_frontend/assets/freemarker2-DDwuEFeX.js.gz +0 -0
  186. package/dist/_frontend/assets/handlebars-DqPfTAei.js.br +0 -0
  187. package/dist/_frontend/assets/handlebars-DqPfTAei.js.gz +0 -0
  188. package/dist/_frontend/assets/html-D0gOfqP6.js.br +0 -0
  189. package/dist/_frontend/assets/html-D0gOfqP6.js.gz +0 -0
  190. package/dist/_frontend/assets/htmlMode-gx5Bk3tY.js.br +0 -6
  191. package/dist/_frontend/assets/htmlMode-gx5Bk3tY.js.gz +0 -0
  192. package/dist/_frontend/assets/index-BWMZWgYr.js.br +0 -0
  193. package/dist/_frontend/assets/index-BWMZWgYr.js.gz +0 -0
  194. package/dist/_frontend/assets/index-Djblv9e3.js.br +0 -0
  195. package/dist/_frontend/assets/index-Djblv9e3.js.gz +0 -0
  196. package/dist/_frontend/assets/index-JWYDBa7W.js.br +0 -0
  197. package/dist/_frontend/assets/index-JWYDBa7W.js.gz +0 -0
  198. package/dist/_frontend/assets/jsonMode-GEdzVuNq.js.br +0 -0
  199. package/dist/_frontend/assets/jsonMode-GEdzVuNq.js.gz +0 -0
  200. package/dist/_frontend/assets/liquid-BItsX3iF.js.br +0 -0
  201. package/dist/_frontend/assets/liquid-BItsX3iF.js.gz +0 -0
  202. package/dist/_frontend/assets/lspLanguageFeatures-Cus-UaLQ.js.br +0 -0
  203. package/dist/_frontend/assets/lspLanguageFeatures-Cus-UaLQ.js.gz +0 -0
  204. package/dist/_frontend/assets/mdx-DKtnK9lB.js.br +0 -0
  205. package/dist/_frontend/assets/mdx-DKtnK9lB.js.gz +0 -0
  206. package/dist/_frontend/assets/python-BTjir3x0.js.br +0 -0
  207. package/dist/_frontend/assets/python-BTjir3x0.js.gz +0 -0
  208. package/dist/_frontend/assets/razor-BW5FLKz0.js.br +0 -0
  209. package/dist/_frontend/assets/razor-BW5FLKz0.js.gz +0 -0
  210. package/dist/_frontend/assets/tsMode-D_fZmsMS.js.br +0 -0
  211. package/dist/_frontend/assets/tsMode-D_fZmsMS.js.gz +0 -0
  212. package/dist/_frontend/assets/typescript-CGtHZQss.js.br +0 -0
  213. package/dist/_frontend/assets/typescript-CGtHZQss.js.gz +0 -0
  214. package/dist/_frontend/assets/workers-pKgmUfu_.js.br +0 -0
  215. package/dist/_frontend/assets/workers-pKgmUfu_.js.gz +0 -0
  216. package/dist/_frontend/assets/xml-BhrTu8Vy.js.br +0 -0
  217. package/dist/_frontend/assets/xml-BhrTu8Vy.js.gz +0 -0
  218. package/dist/_frontend/assets/yaml-G9x_AjyZ.js.br +0 -0
  219. package/dist/_frontend/assets/yaml-G9x_AjyZ.js.gz +0 -0
@@ -0,0 +1,15 @@
1
+ // src/db/postgres/migrations/20260921_000001_web_search_provider.ts
2
+ import { sql } from "kysely";
3
+ async function up(db) {
4
+ await sql`SET LOCAL lock_timeout = '5s'`.execute(db);
5
+ await db.schema.createTable("web_search_provider").addColumn("tenant_id", "text", (col) => col.notNull()).addColumn("manifest", "jsonb", (col) => col.notNull()).addColumn("created_at", "timestamptz", (col) => col.notNull()).addColumn("updated_at", "timestamptz", (col) => col.notNull()).addPrimaryKeyConstraint("web_search_provider_pkey", ["tenant_id"]).execute();
6
+ }
7
+ async function down(db) {
8
+ await sql`SET LOCAL lock_timeout = '5s'`.execute(db);
9
+ await db.schema.dropTable("web_search_provider").ifExists().cascade().execute();
10
+ }
11
+ export {
12
+ down,
13
+ up
14
+ };
15
+ //# sourceMappingURL=20260921_000001_web_search_provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/db/postgres/migrations/20260921_000001_web_search_provider.ts"],"sourcesContent":["import { sql, type Kysely } from 'kysely';\n\n/**\n * Configured web-search provider (canonical DDL owner).\n *\n * Singleton per tenant: PK is `tenant_id` only. Manifest (type, auth) is one\n * jsonb document validated by Zod on every write.\n */\nexport async function up(db: Kysely<unknown>): Promise<void> {\n await sql`SET LOCAL lock_timeout = '5s'`.execute(db);\n await db.schema\n .createTable('web_search_provider')\n .addColumn('tenant_id', 'text', col => col.notNull())\n .addColumn('manifest', 'jsonb', col => col.notNull())\n .addColumn('created_at', 'timestamptz', col => col.notNull())\n .addColumn('updated_at', 'timestamptz', col => col.notNull())\n .addPrimaryKeyConstraint('web_search_provider_pkey', ['tenant_id'])\n .execute();\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n await sql`SET LOCAL lock_timeout = '5s'`.execute(db);\n await db.schema.dropTable('web_search_provider').ifExists().cascade().execute();\n}\n"],"mappings":";AAAA,SAAS,WAAwB;AAQjC,eAAsB,GAAG,IAAoC;AAC3D,QAAM,mCAAmC,QAAQ,EAAE;AACnD,QAAM,GAAG,OACN,YAAY,qBAAqB,EACjC,UAAU,aAAa,QAAQ,SAAO,IAAI,QAAQ,CAAC,EACnD,UAAU,YAAY,SAAS,SAAO,IAAI,QAAQ,CAAC,EACnD,UAAU,cAAc,eAAe,SAAO,IAAI,QAAQ,CAAC,EAC3D,UAAU,cAAc,eAAe,SAAO,IAAI,QAAQ,CAAC,EAC3D,wBAAwB,4BAA4B,CAAC,WAAW,CAAC,EACjE,QAAQ;AACb;AAEA,eAAsB,KAAK,IAAoC;AAC7D,QAAM,mCAAmC,QAAQ,EAAE;AACnD,QAAM,GAAG,OAAO,UAAU,qBAAqB,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ;AAChF;","names":[]}
@@ -0,0 +1,25 @@
1
+ // src/db/sqlite/migrations/20260921_000001_web_search_provider.ts
2
+ import { sql } from "kysely";
3
+ async function up(db) {
4
+ await db.transaction().execute(async (trx) => {
5
+ await sql`
6
+ CREATE TABLE web_search_provider (
7
+ tenant_id TEXT NOT NULL,
8
+ manifest BLOB NOT NULL,
9
+ created_at TEXT NOT NULL,
10
+ updated_at TEXT NOT NULL,
11
+ PRIMARY KEY (tenant_id)
12
+ ) STRICT
13
+ `.execute(trx);
14
+ });
15
+ }
16
+ async function down(db) {
17
+ await db.transaction().execute(async (trx) => {
18
+ await sql`DROP TABLE IF EXISTS web_search_provider`.execute(trx);
19
+ });
20
+ }
21
+ export {
22
+ down,
23
+ up
24
+ };
25
+ //# sourceMappingURL=20260921_000001_web_search_provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/db/sqlite/migrations/20260921_000001_web_search_provider.ts"],"sourcesContent":["import { sql, type Kysely } from 'kysely';\n\n/**\n * Configured web-search provider — mirrors Postgres `web_search_provider`.\n * Singleton per tenant: PK is `tenant_id` only.\n */\nexport async function up(db: Kysely<unknown>): Promise<void> {\n await db.transaction().execute(async trx => {\n await sql`\n CREATE TABLE web_search_provider (\n tenant_id TEXT NOT NULL,\n manifest BLOB NOT NULL,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL,\n PRIMARY KEY (tenant_id)\n ) STRICT\n `.execute(trx);\n });\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n await db.transaction().execute(async trx => {\n await sql`DROP TABLE IF EXISTS web_search_provider`.execute(trx);\n });\n}\n"],"mappings":";AAAA,SAAS,WAAwB;AAMjC,eAAsB,GAAG,IAAoC;AAC3D,QAAM,GAAG,YAAY,EAAE,QAAQ,OAAM,QAAO;AAC1C,UAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQJ,QAAQ,GAAG;AAAA,EACf,CAAC;AACH;AAEA,eAAsB,KAAK,IAAoC;AAC7D,QAAM,GAAG,YAAY,EAAE,QAAQ,OAAM,QAAO;AAC1C,UAAM,8CAA8C,QAAQ,GAAG;AAAA,EACjE,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truefoundry/trueforge",
3
- "version": "0.2.0",
3
+ "version": "0.3.0-rc.0",
4
4
  "description": "TrueForge Agent Harness: server, HTTP API, and chat UI (npx @truefoundry/trueforge)",
5
5
  "author": "TrueFoundry",
6
6
  "license": "MIT",
@@ -39,6 +39,7 @@
39
39
  "hono": "^4.13.5",
40
40
  "jose": "^6.2.10",
41
41
  "kysely": "^0.29.5",
42
+ "lru-cache": "^11.5.3",
42
43
  "openid-client": "^6.8.7",
43
44
  "pg": "^8.23.0",
44
45
  "redis": "^5.12.1",
@@ -47,8 +48,8 @@
47
48
  "winston": "^3.19.0",
48
49
  "yaml": "^2.9.0",
49
50
  "zod": "^4.4.3",
50
- "@truefoundry/trueforge-core": "0.2.0",
51
- "@truefoundry/trueforge-sdk": "0.2.0"
51
+ "@truefoundry/trueforge-core": "0.3.0-rc.0",
52
+ "@truefoundry/trueforge-sdk": "0.2.1-rc.0"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@swc/core": "^1.16.1",
@@ -1 +0,0 @@
1
- import{aT as be,N as fe,r as l,aU as J,j as e,U as ge,W as B,I as L,aV as ie,aW as xe,aX as ye,aY as ve,e as P,aZ as je,ap as Ne}from"./index-JWYDBa7W.js";var me=Ne("h-11 shadow-sm"),we=({open:n,onOpenChange:o,onSave:b,title:k,description:p,initialBaseUrl:E="",baseUrlPlaceholder:d="https://api.openai.com/v1",requireApiKey:c=!0,submitLabel:S="Save",busy:O=!1,error:F})=>{const[U,$]=l.useState(""),[y,x]=l.useState(""),[w,I]=l.useState(!1),M=()=>{$(""),x(""),I(!1)};l.useEffect(()=>{n&&($(""),x(E),I(!1))},[n,E]);const X=i=>{i||M(),o(i)},T=U.trim(),Q=!c||!!T,v=async i=>{if(i.preventDefault(),!(!Q||O))try{await b({apiKey:T,baseUrl:y.trim()}),M(),o(!1)}catch{}};return e.jsx(xe,{open:n,onOpenChange:X,title:k,description:p,contentSized:!0,children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:v,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"model-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",c?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"model-provider-api-key",type:"password",required:c,value:U,onChange:i=>{$(i.target.value)},placeholder:c?"Enter API key":"Enter a new key",autoFocus:!0,className:me}),c?null:e.jsx("p",{className:"mt-1.5 text-xs text-text-secondary",children:"Leave blank to keep the current key; enter a new one to replace it."})]}),e.jsxs(ye,{expanded:w,onChange:(i,K)=>I(K),className:"rounded-md border border-border",children:[e.jsx(ve,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced · custom endpoint",e.jsx(L,{name:"chevron-down",className:P("size-4 shrink-0 text-text-secondary transition-transform duration-200",w?"rotate-0":"-rotate-90")})]})}),e.jsxs(je,{className:"space-y-1.5 border-t border-border px-3 pb-3 pt-4",children:[e.jsx("label",{htmlFor:"model-provider-base-url",className:"block text-sm font-medium text-text-primary",children:"Base URL"}),e.jsx("input",{id:"model-provider-base-url",type:"url",value:y,onChange:i=>{x(i.target.value)},placeholder:d,className:me}),e.jsx("p",{className:"text-xs text-text-secondary",children:"Leave blank unless you use a regional or proxy endpoint."})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[F?e.jsx("p",{className:"text-failure-bg text-sm",children:F}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!Q||O,className:"w-full shrink-0",children:S})]})]})})},Ce=we,ke="128000",Ee="4096",pe=()=>({id:"",name:"",advancedExpanded:!0,contextLength:"",maxOutputTokens:""}),ue=n=>(n==null?void 0:n.models.map(o=>{var b,k,p,E,d;return{id:o.id,name:o.name,advancedExpanded:!0,reasoningEfforts:(b=o.properties)==null?void 0:b.reasoningEfforts,contextLength:((p=(k=o.properties)==null?void 0:k.contextLength)==null?void 0:p.toString())??"",maxOutputTokens:((d=(E=o.properties)==null?void 0:E.maxOutputTokens)==null?void 0:d.toString())??"",nameDirty:!0}}))??[pe()],W="h-11 w-full rounded-md border border-border/70 bg-secondary-bg px-3 text-sm text-text-primary outline-none transition-colors placeholder:text-text-secondary/70 focus-visible:border-focus-ring focus-visible:ring-2 focus-visible:ring-focus-ring/50",V="border-failure-bg focus-visible:border-failure-bg focus-visible:ring-failure-bg";function ce(n){const o=n.trim();if(o==="")return null;const b=Number(o);return Number.isInteger(b)&&b>0?b:null}function Se(n){return n.replace(/([a-zA-Z])(\d)/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/g,"")}var re=()=>e.jsx("span",{className:"ml-0.5 text-failure-bg","aria-hidden":!0,children:"*"}),ee=({children:n})=>e.jsx("p",{className:"mt-1 text-xs text-failure-bg",children:n}),ne=({children:n})=>e.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:n}),Ue=({open:n,onOpenChange:o,onSubmit:b,reasoningEffortOptions:k,busy:p=!1,error:E,isEditMode:d=!1,initialValues:c})=>{const[S,O]=l.useState((c==null?void 0:c.name)??""),[F,U]=l.useState((c==null?void 0:c.baseUrl)??""),[$,y]=l.useState(""),[x,w]=l.useState(()=>ue(c)),[I,M]=l.useState(!1),[X,T]=l.useState(!1),Q=()=>{O((c==null?void 0:c.name)??""),U((c==null?void 0:c.baseUrl)??""),y(""),w(ue(c)),M(!1),T(!1)},v=s=>{s||Q(),o(s)},i=(s,r)=>{w(g=>g.map((u,j)=>j===s?{...u,...r}:u))},K=()=>{M(!0),T(!0),w(s=>s.map(r=>({...r,idTouched:!0,contextTouched:!0,maxTouched:!0})))},f=S.trim(),D=f?null:"Name is required.",_=F.trim();let h=null;if(!_)h="Base URL is required.";else try{new URL(_)}catch{h="Enter a valid URL."}const Z=s=>s.id.trim()?null:"Model ID is required.",te=s=>s.name.trim()?null:"Model name is required.",q=s=>ce(s.contextLength)==null?"Set the model's context window.":null,G=s=>ce(s.maxOutputTokens)==null?"Set the max output tokens.":null,le=!D&&!h&&x.every(s=>!Z(s)&&!te(s)),se=I&&D,H=X&&h,A=async()=>{if(K(),!le||p)return;const s=x.findIndex(r=>q(r)||G(r));if(s!==-1){i(s,{advancedExpanded:!0});const r=x[s],g=r&&q(r)?"context-length":"max-output-tokens";setTimeout(()=>{var j;const u=document.getElementById(`custom-provider-model-${s}-${g}`);(j=u==null?void 0:u.scrollIntoView)==null||j.call(u,{block:"center",behavior:"smooth"}),u==null||u.focus()},0);return}try{await b({name:f,baseUrl:_,apiKey:$.trim(),models:x.map(r=>{var R;const g={};(R=r.reasoningEfforts)!=null&&R.length&&(g.reasoningEfforts=r.reasoningEfforts);const u=ce(r.contextLength);u!=null&&(g.contextLength=u);const j=ce(r.maxOutputTokens);return j!=null&&(g.maxOutputTokens=j),{id:r.id.trim(),name:r.name.trim(),...Object.keys(g).length>0?{properties:g}:{}}})}),v(!1)}catch{}};return e.jsx(xe,{open:n,onOpenChange:v,title:d?`Edit ${(c==null?void 0:c.name)??S}`:"Add custom provider",description:d?"Update the endpoint, credentials, and models for this provider.":"Connect any OpenAI-compatible endpoint, whether it's a local model, a proxy, or your own hosted service.",contentSized:!0,children:e.jsxs("form",{className:"flex min-h-0 flex-1 flex-col",onSubmit:s=>{s.preventDefault(),A()},children:[e.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-5 pt-4 pb-8",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-name",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Name",e.jsx(re,{})]}),e.jsx("input",{id:"custom-provider-name",type:"text",value:S,onChange:s=>O(s.target.value),onBlur:()=>M(!0),placeholder:"local-llama",autoFocus:!d,readOnly:d,"aria-readonly":d,"aria-invalid":se?!0:void 0,className:P(W,d&&"cursor-not-allowed bg-secondary-bg/60 text-text-secondary",se&&V)}),d?e.jsx(ne,{children:"Provider names cannot be changed after creation."}):null,se?e.jsx(ee,{children:D}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-base-url",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["Base URL",e.jsx(re,{})]}),e.jsx("input",{id:"custom-provider-base-url",type:"text",value:F,onChange:s=>U(s.target.value),onBlur:()=>T(!0),placeholder:"http://localhost:11434/v1",autoFocus:d,"aria-invalid":H?!0:void 0,className:P(W,H&&V)}),H?e.jsx(ee,{children:h}):_?null:e.jsx(ne,{children:"OpenAI-compatible endpoint, usually ending in /v1."})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"custom-provider-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"custom-provider-api-key",type:"password",value:$,onChange:s=>y(s.target.value),placeholder:"sk-…",className:W}),e.jsx(ne,{children:d?"Leave blank to keep the saved key, or enter a new key to replace it.":"Leave blank if your endpoint needs no key (e.g. a local model)."})]}),e.jsxs("fieldset",{className:"m-0 min-w-0 border-0 p-0",children:[e.jsxs("legend",{className:"float-left mb-2 w-full p-0 text-sm font-medium text-text-primary",children:["Models",e.jsx(re,{})]}),e.jsx("div",{className:"clear-both",children:x.map((s,r)=>{const g=Z(s),u=s.idTouched&&g,j=te(s),R=!!j&&s.nameDirty,oe=q(s),C=G(s),z=s.contextTouched&&oe,ae=s.maxTouched&&C;return e.jsxs("div",{className:P("pb-6",r>0?"border-t border-border pt-6":"pt-1"),style:r>0?{borderTopWidth:"0.5px"}:void 0,children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_2rem] items-end gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-id`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model ID"}),e.jsx("input",{id:`custom-provider-model-${r}-id`,type:"text",value:s.id,onChange:t=>{const a=t.target.value;i(r,{id:a,...s.nameDirty?{}:{name:Se(a)}})},onBlur:()=>i(r,{idTouched:!0}),placeholder:"llama3.1:70b","aria-invalid":u?!0:void 0,className:P(W,"font-mono",u&&V)})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:`custom-provider-model-${r}-name`,className:"mb-1 block text-xs font-normal text-text-secondary",children:"Model name"}),e.jsx("input",{id:`custom-provider-model-${r}-name`,type:"text",value:s.name,onChange:t=>i(r,{name:t.target.value,nameDirty:!0}),placeholder:"llama-3-1-70b","aria-invalid":R?!0:void 0,className:P(W,R&&V)})]}),e.jsx("button",{type:"button","aria-label":`Remove model ${r+1}`,disabled:x.length===1||p,className:"mb-0.5 flex size-9 items-center justify-center rounded-md text-text-secondary transition-colors hover:text-text-primary disabled:opacity-40",onClick:()=>w(t=>t.filter((a,m)=>m!==r)),children:e.jsx(L,{name:"trash",className:"size-4"})})]}),u?e.jsx(ee,{children:g}):null,R?e.jsx(ee,{children:j}):null,e.jsxs("div",{className:"mt-2",children:[e.jsxs("button",{type:"button","aria-expanded":s.advancedExpanded,"aria-controls":`custom-provider-model-${r}-advanced`,className:"flex cursor-pointer items-center gap-1.5 text-sm font-medium text-text-primary",onClick:()=>i(r,{advancedExpanded:!s.advancedExpanded}),children:[e.jsx(L,{name:"chevron-down",className:P("size-4 text-text-secondary transition-transform",s.advancedExpanded?"":"-rotate-90")}),"Advanced"]}),s.advancedExpanded?e.jsxs("div",{id:`custom-provider-model-${r}-advanced`,className:"mt-3 space-y-4 pl-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-context-length`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Context length",e.jsx(re,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-context-length`,type:"number",min:1,inputMode:"numeric",value:s.contextLength,onChange:t=>i(r,{contextLength:t.target.value}),onBlur:()=>i(r,{contextTouched:!0}),placeholder:ke,"aria-invalid":z?!0:void 0,className:P(W,z&&V)}),z?e.jsx(ee,{children:oe}):s.contextLength.trim()===""?e.jsx(ne,{children:"Model's total token window."}):null]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:`custom-provider-model-${r}-max-output-tokens`,className:"mb-1.5 block text-xs font-medium text-text-secondary",children:["Max output tokens",e.jsx(re,{})]}),e.jsx("input",{id:`custom-provider-model-${r}-max-output-tokens`,type:"number",min:1,inputMode:"numeric",value:s.maxOutputTokens,onChange:t=>i(r,{maxOutputTokens:t.target.value}),onBlur:()=>i(r,{maxTouched:!0}),placeholder:Ee,"aria-invalid":ae?!0:void 0,className:P(W,ae&&V)}),ae?e.jsx(ee,{children:C}):s.maxOutputTokens.trim()===""?e.jsx(ne,{children:"Longest reply the model allows — use its real limit."}):null]}),k&&k.length>0?e.jsxs("div",{children:[e.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 select-none",children:[e.jsx("input",{type:"checkbox",className:"size-4 shrink-0 cursor-pointer accent-primary-button-bg disabled:cursor-not-allowed disabled:opacity-50",checked:s.reasoningEfforts!==void 0,"aria-label":`Enable reasoning effort for model ${r+1}`,disabled:p,onChange:t=>i(r,{reasoningEfforts:t.target.checked?[]:void 0})}),e.jsx("span",{className:"text-text-secondary text-xs font-medium",children:"Reasoning effort"})]}),s.reasoningEfforts!==void 0?e.jsx("div",{role:"group","aria-label":`Supported reasoning efforts for model ${r+1}`,className:"mt-2 flex flex-wrap gap-2",children:k.map(t=>{var m;const a=((m=s.reasoningEfforts)==null?void 0:m.includes(t))??!1;return e.jsx("button",{type:"button","aria-pressed":a,disabled:p,className:P("rounded-full border px-3 py-1 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/40 disabled:opacity-50",a?"border-primary-button-bg bg-primary-button-bg text-primary-button-text":"border-border text-text-secondary hover:bg-ghost-button-hover"),onClick:()=>{var Y;return i(r,{reasoningEfforts:a?(Y=s.reasoningEfforts)==null?void 0:Y.filter(de=>de!==t):[...s.reasoningEfforts??[],t]})},children:t},t)})}):null]}):null]}):null]})]},r)})}),e.jsxs(B.Secondary,{size:"small",type:"button",className:"mt-4 w-fit",onClick:()=>w(s=>[...s,pe()]),children:[e.jsx(L,{name:"plus",className:"size-3.5"}),"Add model"]})]})]}),e.jsxs("div",{className:"shrink-0 space-y-3 border-t border-border px-5 py-4",children:[E?e.jsx("p",{className:"text-failure-bg text-sm",children:E}):null,e.jsx(B.Primary,{type:"submit",size:"large",disabled:!le||p,className:"w-full",children:d?"Save changes":"Add provider"})]})]})})},Me=Ue;function Te(n){return"baseUrl"in n&&typeof n.baseUrl=="string"?n.baseUrl:""}var Pe=()=>{const{modelCatalog:n}=be(),o=fe(),[b,k]=l.useState(""),[p,E]=l.useState([]),[d,c]=l.useState([]),[S,O]=l.useState(!0),[F,U]=l.useState(null),[$,y]=l.useState(null),[x,w]=l.useState(!1),[I,M]=l.useState(null),[X,T]=l.useState(null),[Q,v]=l.useState(null),[i,K]=l.useState(!1),[f,D]=l.useState(null),_=l.useMemo(()=>(d??[]).reduce((t,a)=>(t[a.name]=a.logo??"",t),{}),[d]),h=b.trim().toLowerCase(),Z=l.useCallback(async()=>{O(!0),U(null);try{const[t,a]=await Promise.all([n.listModelProviders(),n.getModelProviderCatalog()]);E(t),c(a)}catch(t){U(J(t,"Failed to load model providers"))}finally{O(!1)}},[n]);l.useEffect(()=>{Z()},[Z]);const te=l.useMemo(()=>new Set(p.map(t=>t.type)),[p]),q=l.useMemo(()=>p.filter(t=>{var a;return((a=t.name)==null?void 0:a.toLowerCase().includes(h))||t.models.some(m=>m.name.toLowerCase().includes(h)||m.id.toLowerCase().includes(h))}),[p,h]),G=l.useMemo(()=>d.filter(t=>t.type!=="custom"&&!te.has(t.type)&&(t.name.toLowerCase().includes(h)||t.models.some(a=>a.name.toLowerCase().includes(h)||a.id.toLowerCase().includes(h)))),[d,te,h]),le=l.useMemo(()=>{var t;return(t=d.find(a=>a.type==="custom"))==null?void 0:t.supportedReasoningEfforts},[d]),se=l.useMemo(()=>{const t=new Map;for(const a of d)t.set(a.type,a.models);return t},[d]),H=()=>{M(null),T(null),v(null)},A=async(t,a)=>{w(!0),U(null);try{await t(),await Z(),H()}catch(m){throw a?a(m):o==null?U(J(m,"Request failed")):o.showError(m),m}finally{w(!1)}},s=async(t,a)=>{v(null),await A(async()=>{await n.createModelProvider({type:t.type,name:t.name,...a.baseUrl?{baseUrl:a.baseUrl}:{},apiKey:a.apiKey,models:t.models})},m=>v(J(m,"Request failed")))},r=async(t,a)=>{v(null),await A(async()=>{await n.updateModelProvider({id:t.id,type:t.type,name:t.name,...a.baseUrl?{baseUrl:a.baseUrl}:{},apiKey:a.apiKey,models:t.models})},m=>v(J(m,"Request failed"))),o==null||o.showSuccess({title:`${t.name} updated`})},g=t=>{n.deleteModelProvider&&A(async()=>{await n.deleteModelProvider({id:t.id})}).catch(()=>{})},u=(t,a)=>{A(async()=>{await n.updateModelProvider({id:t.id,type:t.type,name:t.name,...t.baseUrl?{baseUrl:t.baseUrl}:{},apiKey:"",models:a})}).catch(()=>{})},j=async t=>{y(null),await A(async()=>{await n.createModelProvider({type:"custom",name:t.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},a=>y(J(a,"Request failed"))),setTimeout(()=>{o==null||o.showSuccess({title:`${t.name} added`})},0)},R=async t=>{if(!f)return;const a=f;y(null),await A(async()=>{await n.updateModelProvider({id:a.id,type:a.type,name:a.name,baseUrl:t.baseUrl,apiKey:t.apiKey,models:t.models})},m=>y(J(m,"Request failed"))),setTimeout(()=>{o==null||o.showSuccess({title:"Model provider updated",description:`${a.name} was updated successfully.`})},0)},oe=f?{name:f.name,baseUrl:f.baseUrl??"",models:f.models}:void 0,C=I!=null?p.find(t=>t.id===I)??null:null,z=X!=null?d.find(t=>t.type===X)??null:null,ae=C!=null||z!=null;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Models"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Connect providers and choose which models are available."}),F?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:F}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-hidden",children:e.jsxs("div",{className:"flex h-full flex-col gap-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(ge,{query:b,setQuery:k,placeholder:"Search providers and models"})}),e.jsxs(B.Secondary,{type:"button",onClick:()=>{y(null),D(null),K(!0)},children:[e.jsx(L,{name:"plus",size:"1rem",className:"mr-1"}),"Add Custom Provider"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 overflow-y-auto",children:[S?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!S&&q.length>0?e.jsxs("section",{"aria-labelledby":"configured-providers-heading",children:[e.jsx("div",{id:"configured-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Configured"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:q.map(t=>{const a=se.get(t.type)??[],m=new Set(t.models.map(N=>N.id)),Y=a.filter(N=>!m.has(N.id)),de=_[t.name];return e.jsxs("article",{className:"border-b border-border p-3 last:border-b-0",children:[e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:de?e.jsx(ie,{src:de,alt:t.name,className:"size-4.5"}):e.jsx(L,{name:"cpu",className:"size-4.5"})}),e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border bg-secondary-bg/40 px-2 py-0.5 text-xs font-medium text-success-bg",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success-bg"}),"Connected"]}),e.jsxs(B.Secondary,{size:"small",className:"text-[0.8125rem]",type:"button","aria-label":`Edit ${t.name}`,title:`Edit ${t.name}`,disabled:x,onClick:()=>{t.type==="custom"?(H(),y(null),D(t),K(!0)):(v(null),T(null),M(t.id))},children:[e.jsx(L,{name:"pencil",className:"size-3.5"}),"Edit"]}),n.deleteModelProvider?e.jsx(B.Secondary,{size:"small",className:"transition-colors hover:bg-failure-bg/10 hover:text-failure-bg",type:"button",disabled:x,onClick:()=>{g(t)},children:"Remove"}):null]})]}),e.jsxs("div",{className:"mt-3 overflow-hidden rounded-lg border border-border bg-secondary-bg/30",children:[t.models.map(N=>e.jsxs("div",{className:"flex min-h-10 items-center gap-3 border-b border-border px-3 py-2 text-sm text-text-primary last:border-b-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:N.name}),e.jsx("button",{type:"button","aria-label":`Remove ${N.name}`,disabled:x,className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring disabled:opacity-50",onClick:()=>{u(t,t.models.filter(he=>he.id!==N.id))},children:e.jsx(L,{name:"trash",className:"size-3.5"})})]},N.id)),Y.length>0?e.jsxs("section",{children:[e.jsxs("div",{className:"border-b border-border bg-secondary-bg/40 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available to add · ",Y.length]}),Y.map(N=>e.jsxs("div",{className:"flex min-h-12 items-center gap-3 border-b border-border px-3 py-2 text-sm text-text-primary last:border-b-0",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:N.name}),e.jsx(B.Secondary,{size:"small",type:"button",disabled:x,onClick:()=>{u(t,[...t.models,N])},children:"Add"})]},N.id))]}):null]})]},t.id)})})]}):null,!S&&G.length>0?e.jsxs("section",{"aria-labelledby":"available-providers-heading",className:"mt-2",children:[e.jsx("div",{id:"available-providers-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:"Available"}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:G.map(t=>{const a=_[t.name];return e.jsx("article",{className:"border-b border-border p-3 last:border-b-0",children:e.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:a?e.jsx(ie,{src:a,alt:t.name,className:"size-4.5"}):e.jsx(L,{name:"cpu",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h5",{className:"truncate text-base font-medium text-text-primary",children:t.name}),e.jsx("p",{className:"truncate text-sm text-text-secondary",children:t.models.map(m=>m.name).join(" · ")})]})]}),e.jsxs(B.Secondary,{type:"button",disabled:x,onClick:()=>{v(null),M(null),T(t.type)},children:[e.jsx(L,{name:"wrench",className:"size-4"}),"Configure"]})]})},t.type)})})]}):null,!S&&q.length===0&&G.length===0?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:h?`No providers match “${b.trim()}”.`:"No model providers yet."}):null]}),e.jsx(Ce,{open:ae,onOpenChange:t=>{t||H()},onSave:t=>{if(C)return r(C,t);if(z)return s(z,t)},title:C?"Edit Provider Details":"Configure Provider Details",initialBaseUrl:C?C.baseUrl??"":z?Te(z):"",requireApiKey:C==null,submitLabel:C?"Save":"Create",busy:x,error:Q}),e.jsx(Me,{open:i,onOpenChange:t=>{K(t),t||(y(null),D(null))},isEditMode:f!==null,initialValues:oe,onSubmit:f?R:j,reasoningEffortOptions:le,busy:x,error:$},(f==null?void 0:f.id)??"add-custom-provider")]})})]})},ze=Pe;export{ze as default};
@@ -1 +0,0 @@
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 +0,0 @@
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,2 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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,6 +0,0 @@
1
- �
2
  ��N���t-M���4�� GJ�����
3
- �V��b�����.�-��e�i<
4
- �a�ӱ�5T��c-��x���<�F�@�h��1�0���6<�H�(
5
- J��)N����+����
6
- m!��`2�w�\{�j��U��ᄑ�0�5�ƈ ��'��uEk�ьT(H<�5��&5\n�-B5$������EH�/�����+6Xs2��j/�rm�"�w�4V�c��/���HYsSwq�H�����X���lW�*���*<R�v�J����B�2Iܨ]��.�ij�mBn3����{g(.T�6�w _� hʉ��*Ĕь����rL�.{P�,�2�i��XQ'-E`�g(۲����?�l@sQ"$4%�#�X�xmIM�o��E��dx2�J �ڃ?��)Bu�
7
- X�_k�}