@openhands/agent-canvas 1.0.0-rc.2 → 1.0.0-rc.4

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 (305) hide show
  1. package/README.md +2 -2
  2. package/README.windows.md +2 -2
  3. package/build/assets/acp-providers-C55k29rf.js +1 -0
  4. package/build/assets/{add-backend-modal-CIfhseZn.js → add-backend-modal-BdYxoUdL.js} +1 -1
  5. package/build/assets/agent-server-conversation-service.api-js3oYcdU.js +5 -0
  6. package/build/assets/{agent-settings-B6htMeS2.js → agent-settings-BNrffu3I.js} +1 -1
  7. package/build/assets/{alert-banner-D41ZKDZT.js → alert-banner-BzU93oDh.js} +1 -1
  8. package/build/assets/{analytics-consent-form-modal-TINgM_jV.js → analytics-consent-form-modal-DIfCKp6g.js} +1 -1
  9. package/build/assets/{api-key-entry-screen-Di1vHgIU.js → api-key-entry-screen-CGyS-Cna.js} +1 -1
  10. package/build/assets/{app-settings-CjCa1MOB.js → app-settings-DmOs4oik.js} +1 -1
  11. package/build/assets/{automation-detail-DPoxzTdV.js → automation-detail-DLbCVJCw.js} +1 -1
  12. package/build/assets/{automations-list-DwUEe2Ea.js → automations-list-CoYj4o97.js} +1 -1
  13. package/build/assets/{backend-form-modal-B6q897ZX.js → backend-form-modal-BUy-PzZN.js} +1 -1
  14. package/build/assets/{backend-synced-settings-badge-BwTawSCE.js → backend-synced-settings-badge-1A63yxGs.js} +1 -1
  15. package/build/assets/browser-B8bp1IqT.js +5 -0
  16. package/build/assets/{browser-tab-DiRTKik8.js → browser-tab-CiBRWB4X.js} +1 -1
  17. package/build/assets/chat-send-button-qKFZuB9E.js +1 -0
  18. package/build/assets/{circle-plus-check-toggle-B3_W6-nt.js → circle-plus-check-toggle-CboDp7XB.js} +1 -1
  19. package/build/assets/{condenser-settings-DczjwkIp.js → condenser-settings-FCBjvqSo.js} +1 -1
  20. package/build/assets/conversation-CT8AvxEH.js +1 -0
  21. package/build/assets/conversation-panel-DqDDs4WZ.js +1 -0
  22. package/build/assets/conversation-service.api-y_eB_43m.js +1 -0
  23. package/build/assets/conversation-store-CiYGBud3.js +6 -0
  24. package/build/assets/conversation-vNuLKgz6.js +19 -0
  25. package/build/assets/conversation-websocket-context-Bb4XBXoc.js +3 -0
  26. package/build/assets/{device-verify-BVl4GEvt.js → device-verify-BOQz2LJQ.js} +1 -1
  27. package/build/assets/{edit-automation-modal-kc_FzbzK.js → edit-automation-modal-C-oC5tis.js} +1 -1
  28. package/build/assets/{entry.client-CWkbusD1.js → entry.client-Db3BpFL_.js} +2 -2
  29. package/build/assets/{enum-filter-dropdown-DlY0Q3fj.js → enum-filter-dropdown-DFwoVtOw.js} +1 -1
  30. package/build/assets/{extensions-hub-NbQnt-cn.js → extensions-hub-BxZbAtjP.js} +1 -1
  31. package/build/assets/extensions-navigation-BIb-vAa2.js +1 -0
  32. package/build/assets/{files-tab-mK7Mdyuf.js → files-tab-DpulQlIo.js} +1 -1
  33. package/build/assets/{git-control-bar-branch-button-C1qmab0K.js → git-control-bar-branch-button-D1uam-nI.js} +1 -1
  34. package/build/assets/home-D77Xasws.js +1 -0
  35. package/build/assets/install-server-modal-BjmEphcZ.js +1 -0
  36. package/build/assets/{launch-BADsYeGp.js → launch-DgtB1JTX.js} +1 -1
  37. package/build/assets/llm-settings-B8kPJ0Of.js +1 -0
  38. package/build/assets/llm-settings-CjUpPsvA.js +1 -0
  39. package/build/assets/{manage-backends-modal-sH7l5NgI.js → manage-backends-modal-CTA-2x4F.js} +1 -1
  40. package/build/assets/manifest-510dd26f.js +1 -0
  41. package/build/assets/{markdown-renderer-CZq_UdmE.js → markdown-renderer-oOUs3tw5.js} +1 -1
  42. package/build/assets/{mcp-DdQ72_AO.js → mcp-CiokQDek.js} +2 -2
  43. package/build/assets/messages-BFJXB6MW.js +36 -0
  44. package/build/assets/model-selector-z_QOzaRV.js +1 -0
  45. package/build/assets/{onboarding-DCL9stdH.js → onboarding-CGUaLHfQ.js} +1 -1
  46. package/build/assets/{path-utils-CNd_jqv_.js → path-utils-0KWEiRs9.js} +1 -1
  47. package/build/assets/{planner-tab-QBnZgIXd.js → planner-tab-CNmJiZ22.js} +1 -1
  48. package/build/assets/{recommended-automations-launcher-B01jchhe.js → recommended-automations-launcher-C1_CKGHa.js} +8 -10
  49. package/build/assets/{root-BBV8Ew9E.js → root-DXsSPxni.js} +2 -2
  50. package/build/assets/root-layout-N4s3RLlj.js +2 -0
  51. package/build/assets/{sdk-section-page-BQKe3asw.js → sdk-section-page-DTyvCc52.js} +1 -1
  52. package/build/assets/{sdk-settings-schema-DoRnefvb.js → sdk-settings-schema-B0KrqqPX.js} +1 -1
  53. package/build/assets/{secrets-settings-D2EfzdpC.js → secrets-settings-BQNSDLKS.js} +1 -1
  54. package/build/assets/{settings-B7jVceyu.js → settings-BUlJrO_h.js} +1 -1
  55. package/build/assets/{settings-dropdown-input-BD7ziSoR.js → settings-dropdown-input-BUk4m23x.js} +1 -1
  56. package/build/assets/{settings-index-Xj0v9Oas.js → settings-index-DE91Eahc.js} +1 -1
  57. package/build/assets/{settings-modal-CDBy1S9S.js → settings-modal-CCaPYVqW.js} +1 -1
  58. package/build/assets/{settings-service.api-CTQ-LpAA.js → settings-service.api-4u2RKC8k.js} +1 -1
  59. package/build/assets/{settings-switch-CSHSqH99.js → settings-switch-BQiAS9ga.js} +1 -1
  60. package/build/assets/{settings-utils-BCbzc6-u.js → settings-utils-chxTa1vn.js} +1 -1
  61. package/build/assets/{shared-conversation-BHEbOdHj.js → shared-conversation-sBPLAawM.js} +1 -1
  62. package/build/assets/{sidebar-mobile-menu-toggle-YYPXGikp.js → sidebar-mobile-menu-toggle-BDXWzhyB.js} +1 -1
  63. package/build/assets/{sidebar-nav-link-CiXbBMQx.js → sidebar-nav-link-Bhlzlhp8.js} +1 -1
  64. package/build/assets/{skill-card-pill-row-BXILn-GK.js → skill-card-pill-row-Bg5joQf6.js} +1 -1
  65. package/build/assets/{skills-plugins-Bs5HiF1O.js → skills-plugins-fihjo1KZ.js} +1 -1
  66. package/build/assets/{skills-settings-CQYxMmWf.js → skills-settings-NQnuMwZP.js} +1 -1
  67. package/build/assets/{styled-tooltip-DEr7oa0m.js → styled-tooltip-GXy1qxsO.js} +1 -1
  68. package/build/assets/{task-list-tab-R9N3Wd-U.js → task-list-tab-Hl9BuVfq.js} +1 -1
  69. package/build/assets/telemetry-BoedM0mF.js +2 -0
  70. package/build/assets/{terminal-BTM3UFcQ.js → terminal-DRwe8--D.js} +1 -1
  71. package/build/assets/{use-active-conversation-BY5F6A1G.js → use-active-conversation-DJGoI9Mc.js} +1 -1
  72. package/build/assets/{use-agent-settings-schema-CsuMq16G.js → use-agent-settings-schema-DtusObuC.js} +1 -1
  73. package/build/assets/{use-agent-state-DX5NKEa_.js → use-agent-state-BXgWhFh6.js} +1 -1
  74. package/build/assets/{use-create-conversation-4iJytCT1.js → use-create-conversation-CzvaVA5A.js} +1 -1
  75. package/build/assets/use-event-store-DSpvASbC.js +1 -0
  76. package/build/assets/{use-get-secrets-BMnFFBUx.js → use-get-secrets-DiLgP147.js} +1 -1
  77. package/build/assets/use-handle-plan-click-CUZwmKIk.js +1 -0
  78. package/build/assets/{use-launch-skill-in-chat-BoqKmEHC.js → use-launch-skill-in-chat-ClRJlIx7.js} +1 -1
  79. package/build/assets/use-runtime-is-ready-CWkGQFsb.js +1 -0
  80. package/build/assets/{use-save-settings-hK6LYt0s.js → use-save-settings-CP23emUY.js} +1 -1
  81. package/build/assets/use-settings-0qFqC-r6.js +1 -0
  82. package/build/assets/{use-settings-nav-items-oZ-BlOWX.js → use-settings-nav-items-C6YxUn4h.js} +1 -1
  83. package/build/assets/{use-task-list-DydbuRFM.js → use-task-list-JPudBRv3.js} +1 -1
  84. package/build/assets/{use-tracking-DQU60djN.js → use-tracking-CjLZgh8X.js} +1 -1
  85. package/build/assets/{use-unified-vscode-url-D2Buvmxj.js → use-unified-vscode-url-DSn2tT08.js} +1 -1
  86. package/build/assets/{use-user-conversation-DwOGM1lc.js → use-user-conversation-CQ5IwnZk.js} +1 -1
  87. package/build/assets/{vendor~browser-3J6WDaAB.js → vendor~browser-Dwwc84Zf.js} +1 -1
  88. package/build/assets/{vendor~browser-tab-DYZ-OmbT.js → vendor~browser-tab-Bhohe29F.js} +1 -1
  89. package/build/assets/{vendor~files-tab-Diy4WrQz.js → vendor~files-tab-B447_Zns.js} +1 -1
  90. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CWwn0K2j.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CQQAW8hY.js} +1 -1
  91. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-dZ3D8RVL.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DFsI4CLy.js} +1 -1
  92. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BighOCzm.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DcvlNgbn.js} +1 -1
  93. package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D13hiNGV.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-ojk_J4bB.js} +1 -1
  94. package/build/assets/{vendor~launch-D65Vw0VZ.js → vendor~launch-BdXJCmwc.js} +1 -1
  95. package/build/assets/{vendor~root-layout~conversation-panel~conversation~shared-conversation-BJPgfJoU.js → vendor~root-layout~conversation-panel~conversation~shared-conversation-DToubnIU.js} +1 -1
  96. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~jpfhx3ls-BkicN-14.js → vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~jpfhx3ls-zdl_Rltz.js} +2 -2
  97. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-Cwz6a1DC.js → vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-BaCzvZac.js} +1 -1
  98. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-C37jLHRk.js → vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-BwbkftxT.js} +1 -1
  99. package/build/assets/{vendor~root-layout~home~mcp~automations-list-JQ-neDIa.js → vendor~root-layout~home~mcp~automations-list-CtdIEhjQ.js} +1 -1
  100. package/build/assets/{vendor~root-layout~home~mcp~automations-list-BTTZ58Mb.js → vendor~root-layout~home~mcp~automations-list-DGOI7kQz.js} +1 -1
  101. package/build/assets/{vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-UYEKKX0Y.js → vendor~root-layout~home~mcp~llm-settings~agent-settings~condenser-settings~verification-set~o7tv66sg-iPAfRWNQ.js} +2 -2
  102. package/build/assets/{verification-settings-Rabe5TpK.js → verification-settings-Cm02KmeI.js} +1 -1
  103. package/build/assets/{vscode-tab-zLD5Z-PP.js → vscode-tab-AF70Yke0.js} +1 -1
  104. package/build/index.html +4 -4
  105. package/build/locales/ar/openhands.json +1 -1
  106. package/build/locales/ca/openhands.json +1 -1
  107. package/build/locales/de/openhands.json +1 -1
  108. package/build/locales/en/openhands.json +1 -1
  109. package/build/locales/es/openhands.json +1 -1
  110. package/build/locales/fr/openhands.json +1 -1
  111. package/build/locales/it/openhands.json +1 -1
  112. package/build/locales/ja/openhands.json +1 -1
  113. package/build/locales/ko-KR/openhands.json +1 -1
  114. package/build/locales/no/openhands.json +1 -1
  115. package/build/locales/pt/openhands.json +1 -1
  116. package/build/locales/tr/openhands.json +1 -1
  117. package/build/locales/uk/openhands.json +1 -1
  118. package/build/locales/zh-CN/openhands.json +1 -1
  119. package/build/locales/zh-TW/openhands.json +1 -1
  120. package/config/defaults.json +2 -6
  121. package/dist/api/agent-server-adapter.cjs +3 -3
  122. package/dist/api/agent-server-adapter.cjs.map +1 -1
  123. package/dist/api/agent-server-adapter.js +90 -85
  124. package/dist/api/agent-server-adapter.js.map +1 -1
  125. package/dist/api/app-preferences-store.cjs.map +1 -1
  126. package/dist/api/app-preferences-store.d.ts +6 -2
  127. package/dist/api/app-preferences-store.js.map +1 -1
  128. package/dist/api/mcp-service/mcp-service.api.cjs +1 -1
  129. package/dist/api/mcp-service/mcp-service.api.cjs.map +1 -1
  130. package/dist/api/mcp-service/mcp-service.api.js +19 -14
  131. package/dist/api/mcp-service/mcp-service.api.js.map +1 -1
  132. package/dist/components/conversation-events/chat/event-content-helpers/should-render-event.cjs +1 -1
  133. package/dist/components/conversation-events/chat/event-content-helpers/should-render-event.cjs.map +1 -1
  134. package/dist/components/conversation-events/chat/event-content-helpers/should-render-event.js +9 -9
  135. package/dist/components/conversation-events/chat/event-content-helpers/should-render-event.js.map +1 -1
  136. package/dist/components/conversation-events/chat/event-message.cjs +1 -1
  137. package/dist/components/conversation-events/chat/event-message.cjs.map +1 -1
  138. package/dist/components/conversation-events/chat/event-message.js +80 -71
  139. package/dist/components/conversation-events/chat/event-message.js.map +1 -1
  140. package/dist/components/features/automations/recommended-automations-launcher.d.ts +7 -1
  141. package/dist/components/features/home/workspace-selection-form.d.ts +1 -0
  142. package/dist/components/features/mcp-page/custom-server-editor.cjs +1 -1
  143. package/dist/components/features/mcp-page/custom-server-editor.cjs.map +1 -1
  144. package/dist/components/features/mcp-page/custom-server-editor.js +63 -62
  145. package/dist/components/features/mcp-page/custom-server-editor.js.map +1 -1
  146. package/dist/components/features/onboarding/steps/setup-llm-step.d.ts +8 -0
  147. package/dist/components/features/sidebar/sidebar.cjs +1 -1
  148. package/dist/components/features/sidebar/sidebar.js +6 -6
  149. package/dist/components/features/skills/extensions-navigation.cjs +1 -1
  150. package/dist/components/features/skills/extensions-navigation.cjs.map +1 -1
  151. package/dist/components/features/skills/extensions-navigation.d.ts +1 -1
  152. package/dist/components/features/skills/extensions-navigation.js +27 -29
  153. package/dist/components/features/skills/extensions-navigation.js.map +1 -1
  154. package/dist/i18n/translation.cjs +1 -1
  155. package/dist/i18n/translation.cjs.map +1 -1
  156. package/dist/i18n/translation.js +15 -15
  157. package/dist/i18n/translation.js.map +1 -1
  158. package/dist/locales/ar/openhands.json +1 -1
  159. package/dist/locales/ca/openhands.json +1 -1
  160. package/dist/locales/de/openhands.json +1 -1
  161. package/dist/locales/en/openhands.json +1 -1
  162. package/dist/locales/es/openhands.json +1 -1
  163. package/dist/locales/fr/openhands.json +1 -1
  164. package/dist/locales/it/openhands.json +1 -1
  165. package/dist/locales/ja/openhands.json +1 -1
  166. package/dist/locales/ko-KR/openhands.json +1 -1
  167. package/dist/locales/no/openhands.json +1 -1
  168. package/dist/locales/pt/openhands.json +1 -1
  169. package/dist/locales/tr/openhands.json +1 -1
  170. package/dist/locales/uk/openhands.json +1 -1
  171. package/dist/locales/zh-CN/openhands.json +1 -1
  172. package/dist/locales/zh-TW/openhands.json +1 -1
  173. package/dist/node_modules/@openhands/typescript-client/dist/models/acp.cjs +1 -1
  174. package/dist/node_modules/@openhands/typescript-client/dist/models/acp.cjs.map +1 -1
  175. package/dist/node_modules/@openhands/typescript-client/dist/models/acp.js +10 -1
  176. package/dist/node_modules/@openhands/typescript-client/dist/models/acp.js.map +1 -1
  177. package/dist/package.cjs +1 -1
  178. package/dist/package.cjs.map +1 -1
  179. package/dist/package.js +5 -3
  180. package/dist/package.js.map +1 -1
  181. package/dist/routes/llm-settings.cjs +1 -1
  182. package/dist/routes/llm-settings.cjs.map +1 -1
  183. package/dist/routes/llm-settings.js +21 -21
  184. package/dist/routes/llm-settings.js.map +1 -1
  185. package/dist/types/agent-server/core/events/index.d.ts +1 -0
  186. package/dist/types/agent-server/core/events/streaming-delta-event.d.ts +7 -0
  187. package/dist/types/agent-server/core/openhands-event.d.ts +2 -2
  188. package/dist/types/agent-server/type-guards.cjs +1 -1
  189. package/dist/types/agent-server/type-guards.cjs.map +1 -1
  190. package/dist/types/agent-server/type-guards.d.ts +2 -0
  191. package/dist/types/agent-server/type-guards.js +3 -3
  192. package/dist/types/agent-server/type-guards.js.map +1 -1
  193. package/dist/utils/handle-event-for-ui.cjs +1 -1
  194. package/dist/utils/handle-event-for-ui.cjs.map +1 -1
  195. package/dist/utils/handle-event-for-ui.js +69 -13
  196. package/dist/utils/handle-event-for-ui.js.map +1 -1
  197. package/dist/utils/mcp-config.cjs +1 -1
  198. package/dist/utils/mcp-config.cjs.map +1 -1
  199. package/dist/utils/mcp-config.js +27 -19
  200. package/dist/utils/mcp-config.js.map +1 -1
  201. package/dist/utils/mcp-marketplace-utils.cjs +1 -1
  202. package/dist/utils/mcp-marketplace-utils.cjs.map +1 -1
  203. package/dist/utils/mcp-marketplace-utils.js +38 -18
  204. package/dist/utils/mcp-marketplace-utils.js.map +1 -1
  205. package/dist/utils/normalize-display-model.cjs +1 -1
  206. package/dist/utils/normalize-display-model.cjs.map +1 -1
  207. package/dist/utils/normalize-display-model.js +8 -7
  208. package/dist/utils/normalize-display-model.js.map +1 -1
  209. package/dist/utils/openhands-llm.cjs +1 -1
  210. package/dist/utils/openhands-llm.cjs.map +1 -1
  211. package/dist/utils/openhands-llm.d.ts +13 -0
  212. package/dist/utils/openhands-llm.js +9 -3
  213. package/dist/utils/openhands-llm.js.map +1 -1
  214. package/package.json +5 -3
  215. package/scripts/check-sdk-version-sync.mjs +6 -6
  216. package/scripts/dev-safe.mjs +83 -124
  217. package/scripts/dev-with-automation.mjs +83 -5
  218. package/scripts/logger.mjs +77 -0
  219. package/scripts/runtime-services-info.mjs +199 -0
  220. package/scripts/static-server.mjs +42 -4
  221. package/build/assets/acp-providers-DZEi8wDz.js +0 -1
  222. package/build/assets/agent-server-conversation-service.api-B82pNNTm.js +0 -5
  223. package/build/assets/browser-DTei6kki.js +0 -5
  224. package/build/assets/chat-send-button-06dIuWXm.js +0 -1
  225. package/build/assets/conversation-CBlJiDaV.js +0 -19
  226. package/build/assets/conversation-Dss8XCN_.js +0 -1
  227. package/build/assets/conversation-panel-B5sVpsz5.js +0 -1
  228. package/build/assets/conversation-service.api-B4s-xIOK.js +0 -1
  229. package/build/assets/conversation-store-kHcewy1E.js +0 -1
  230. package/build/assets/conversation-websocket-context-C2yKCqvj.js +0 -3
  231. package/build/assets/extensions-navigation-oOk5yl8X.js +0 -1
  232. package/build/assets/home-ChuA06Hv.js +0 -1
  233. package/build/assets/install-server-modal--lZ1HSHB.js +0 -1
  234. package/build/assets/llm-settings-D477P0Lg.js +0 -1
  235. package/build/assets/llm-settings-DtlQ7i4C.js +0 -1
  236. package/build/assets/manifest-17af0b17.js +0 -1
  237. package/build/assets/messages-luW9zf1w.js +0 -36
  238. package/build/assets/middleware-B5rcobhi.js +0 -6
  239. package/build/assets/model-selector-DzQRgNGZ.js +0 -1
  240. package/build/assets/root-layout-pQASEqtQ.js +0 -2
  241. package/build/assets/sidebar-store-B76R2gP8.js +0 -1
  242. package/build/assets/telemetry-DCrd7gnV.js +0 -2
  243. package/build/assets/use-event-store-Rw1YbvLm.js +0 -1
  244. package/build/assets/use-handle-plan-click-DYd5a6zN.js +0 -1
  245. package/build/assets/use-runtime-is-ready-DP-KKHO6.js +0 -1
  246. package/build/assets/use-settings-Clf0Y_P3.js +0 -1
  247. /package/build/assets/{automation-LZB0MjdV.js → automation-BzmydDjr.js} +0 -0
  248. /package/build/assets/{browser-store-BjhV_9wS.js → browser-store-C5uQbbIi.js} +0 -0
  249. /package/build/assets/{checkmark-BB7QCG5T.js → checkmark-SEZPnU2I.js} +0 -0
  250. /package/build/assets/{chevron-left-small-CuuwpRi9.js → chevron-left-small-x9_-ucHG.js} +0 -0
  251. /package/build/assets/{close-Cz0OAgTy.js → close-CbOsKMRg.js} +0 -0
  252. /package/build/assets/{code-tag-Cz9AIz-X.js → code-tag-C0vR_IQH.js} +0 -0
  253. /package/build/assets/{command-store-DAd3K0d_.js → command-store-BUWgE-vZ.js} +0 -0
  254. /package/build/assets/{confirmation-modal-C_lds1Tb.js → confirmation-modal-BPgWqWRI.js} +0 -0
  255. /package/build/assets/{context-menu-list-item-DhG1Ln5m.js → context-menu-list-item-CHWCx1Mc.js} +0 -0
  256. /package/build/assets/{conversation-state-store-BUU90dVq.js → conversation-state-store-DpgQaK_O.js} +0 -0
  257. /package/build/assets/{conversation-tab-empty-state-5bW9CQke.js → conversation-tab-empty-state-Ba5hbJhn.js} +0 -0
  258. /package/build/assets/{copy-CA1Dblua.js → copy-CAxUvM-U.js} +0 -0
  259. /package/build/assets/{dist-CBUfAk0Z.js → dist-CeJSjcAI.js} +0 -0
  260. /package/build/assets/{ellipsis-button-DRRmCrWi.js → ellipsis-button-CiLx8dqc.js} +0 -0
  261. /package/build/assets/{environment-switch-overlay-BrHKX6_Z.js → environment-switch-overlay-Cow6h62p.js} +0 -0
  262. /package/build/assets/{file-DM0ihEsO.js → file-BJCSojij.js} +0 -0
  263. /package/build/assets/{files-tab-store-QlUCuW8b.js → files-tab-store-CZAEwv3x.js} +0 -0
  264. /package/build/assets/{folder-UGYUKpqb.js → folder-wShAU0y7.js} +0 -0
  265. /package/build/assets/{git-status-mapper-N4-7eaeC.js → git-status-mapper-C3rfzUex.js} +0 -0
  266. /package/build/assets/{globe-2otpEmVh.js → globe-CQ_5xwpo.js} +0 -0
  267. /package/build/assets/{handle-capture-consent-OitMkDHc.js → handle-capture-consent-DDnXMC9Y.js} +0 -0
  268. /package/build/assets/{iconBase-B_5IRYeZ.js → iconBase-1A_WRQ4E.js} +0 -0
  269. /package/build/assets/{lesson-plan-5O2tVbD1.js → lesson-plan-B607buca.js} +0 -0
  270. /package/build/assets/{link-external-kU6aFXU6.js → link-external-DCsHkAj4.js} +0 -0
  271. /package/build/assets/{map-provider-BHow6ugd.js → map-provider-XSFHmdDs.js} +0 -0
  272. /package/build/assets/{modal-close-button-BCvw9IUN.js → modal-close-button-DY-rVmld.js} +0 -0
  273. /package/build/assets/{plan-components-BRiIX8Wn.js → plan-components-DsiDjcDi.js} +0 -0
  274. /package/build/assets/{sdk-settings-field-metadata-CtO73dY6.js → sdk-settings-field-metadata-CETNItbo.js} +0 -0
  275. /package/build/assets/{search-Cbh-hHBu.js → search-BqXT2Ied.js} +0 -0
  276. /package/build/assets/{secrets-service-DEIB-Cfk.js → secrets-service-rJqZtDmI.js} +0 -0
  277. /package/build/assets/{settings-KgLvVrSm.js → settings-BgL2HUsU.js} +0 -0
  278. /package/build/assets/{settings-gear-xGs_SPgZ.js → settings-gear-DFmoMp-6.js} +0 -0
  279. /package/build/assets/{settings-input-CPr7vX81.js → settings-input-DsoZj8Dm.js} +0 -0
  280. /package/build/assets/{settings-like-page-layout-classes-GknosJgv.js → settings-like-page-layout-classes-DENKlZpD.js} +0 -0
  281. /package/build/assets/{settings-list-classes-CYDn4jUg.js → settings-list-classes-D8VAVZmi.js} +0 -0
  282. /package/build/assets/{settings-section-header-context-aD2iq1gD.js → settings-section-header-context-D61smD-W.js} +0 -0
  283. /package/build/assets/{skills-CCaEu1KQ.js → skills-BDOWVle-.js} +0 -0
  284. /package/build/assets/{switch-skeleton-C87Tx3Tc.js → switch-skeleton-QpdcdxRP.js} +0 -0
  285. /package/build/assets/{terminal-DQJ6IJUd.js → terminal-BUww3Ssl.js} +0 -0
  286. /package/build/assets/{toggle-switch-C-7juZ1u.js → toggle-switch-DDr-DnEc.js} +0 -0
  287. /package/build/assets/{typography-U1gkzkXo.js → typography-Cx7uw7z3.js} +0 -0
  288. /package/build/assets/{u-check-circle-lbkXL2z4.js → u-check-circle-CftRwky1.js} +0 -0
  289. /package/build/assets/{u-check-circle-half-CirnoxXG.js → u-check-circle-half-sGVk0BtL.js} +0 -0
  290. /package/build/assets/{u-circuit-Danff2ks.js → u-circuit-Cg9tH5qb.js} +0 -0
  291. /package/build/assets/{u-edit-CH5nNya1.js → u-edit-foF02hwH.js} +0 -0
  292. /package/build/assets/{use-breakpoint-2sN462wJ.js → use-breakpoint-Dt2knceC.js} +0 -0
  293. /package/build/assets/{use-click-outside-element-_vianyPb.js → use-click-outside-element-Bu2A3s59.js} +0 -0
  294. /package/build/assets/{use-is-authed-DrocXcet.js → use-is-authed-fNsj-Adj.js} +0 -0
  295. /package/build/assets/{use-llm-profiles-BhZRf-NX.js → use-llm-profiles-CyNVoVqm.js} +0 -0
  296. /package/build/assets/{use-skills-v8pQ02ze.js → use-skills-BWHATXK-.js} +0 -0
  297. /package/build/assets/{v4-BMWDcIWQ.js → v4-BygpdDmc.js} +0 -0
  298. /package/build/assets/{vendor~browser-C3GKF4mj.js → vendor~browser-BYEwwJqV.js} +0 -0
  299. /package/build/assets/{vendor~conversation-panel~conversation~alert-banner-DMcFTqbt.js → vendor~conversation-panel~conversation~alert-banner-BnHToS5O.js} +0 -0
  300. /package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-Cntsv2EN.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-B4oeCCli.js} +0 -0
  301. /package/build/assets/{vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DTosGXG7.js → vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D8cqyq4k.js} +0 -0
  302. /package/build/assets/{vendor~terminal-CnKZILnC.js → vendor~terminal-aeP3PnKf.js} +0 -0
  303. /package/build/assets/{vscode-url-helper-CwQPl6QN.js → vscode-url-helper-DOCkV_-G.js} +0 -0
  304. /package/build/assets/{waiting-for-runtime-message-B1Dzhtj5.js → waiting-for-runtime-message-Bg27u9JB.js} +0 -0
  305. /package/build/assets/{x-mark-CmcVOTk2.js → x-mark-Cn-YJVbN.js} +0 -0
@@ -0,0 +1,19 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/files-tab-DpulQlIo.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor~files-tab-B447_Zns.js","assets/iconBase-1A_WRQ4E.js","assets/react-CM_dJw1Z.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-BaCzvZac.js","assets/mcp-client-xEdbDxOL.js","assets/settings-client-BUlG0Gzq.js","assets/agent-server-conversation-service.api-js3oYcdU.js","assets/preload-helper-CT1Z6Pdu.js","assets/profiles-client-CesbAK-7.js","assets/v4-BygpdDmc.js","assets/agent-server-client-options-Dvgeb3x4.js","assets/agent-server-compatibility-BANjmMTo.js","assets/server-client-Cz8PyIbN.js","assets/settings-service.api-4u2RKC8k.js","assets/proxy-wIasY2Po.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~e9ykmtgh-DMH1jSwL.js","assets/settings-BgL2HUsU.js","assets/acp-providers-C55k29rf.js","assets/declaration-IA661TBv.js","assets/common-Cfviy7yT.js","assets/QueryClientProvider-7oLZ1RtQ.js","assets/useQuery-JDs8UaWj.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~h07fzaqi-D15MEcqi.js","assets/suspense-C9MBE_9N.js","assets/useTranslation-CbJtty1g.js","assets/context-BBqptpXX.js","assets/vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-BwbkftxT.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DcvlNgbn.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-B4oeCCli.js","assets/objectWithoutPropertiesLoose-B-IA9dU9.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CQQAW8hY.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D8cqyq4k.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DFsI4CLy.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-ojk_J4bB.js","assets/react-CuAHzoGi.js","assets/conversation-tab-empty-state-Ba5hbJhn.js","assets/utils-CVcuFUYj.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~j8sdb9mk-oCzr0-9g.js","assets/markdown-renderer-oOUs3tw5.js","assets/checkmark-SEZPnU2I.js","assets/copy-CAxUvM-U.js","assets/active-backend-context-CQTk4wD8.js","assets/health-store-d-d2ssv4.js","assets/use-active-conversation-DJGoI9Mc.js","assets/conversation-service.api-y_eB_43m.js","assets/navigation-context-CszaA-CJ.js","assets/use-user-conversation-CQ5IwnZk.js","assets/use-agent-state-BXgWhFh6.js","assets/conversation-state-store-DpgQaK_O.js","assets/use-runtime-is-ready-CWkGQFsb.js","assets/chevron-left-small-x9_-ucHG.js","assets/file-BJCSojij.js","assets/folder-wShAU0y7.js","assets/link-external-DCsHkAj4.js","assets/files-tab-store-CZAEwv3x.js","assets/use-event-store-DSpvASbC.js","assets/typography-Cx7uw7z3.js","assets/dist-B-SKiGDl.js","assets/conversation-local-storage-D5Tre_GA.js","assets/git-status-mapper-C3rfzUex.js","assets/retrieve-axios-error-message-DbnSBc_1.js","assets/browser-tab-CiBRWB4X.js","assets/vendor~browser-tab-Bhohe29F.js","assets/browser-store-C5uQbbIi.js","assets/vscode-tab-AF70Yke0.js","assets/use-unified-vscode-url-DSn2tT08.js","assets/vscode-url-helper-DOCkV_-G.js","assets/waiting-for-runtime-message-Bg27u9JB.js","assets/brand-button-BoiPxAGm.js","assets/planner-tab-CNmJiZ22.js","assets/conversation-store-CiYGBud3.js","assets/plan-components-DsiDjcDi.js","assets/use-handle-plan-click-CUZwmKIk.js","assets/custom-toast-handlers-fgD4IYsu.js","assets/createLucideIcon-C9OEnwvX.js","assets/i18n-CyvU1o95.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~skills-settings~m~o9nrx3fm-87v-LliW.js","assets/use-create-conversation-CzvaVA5A.js","assets/useMutation-7hG0GuPx.js","assets/mutation-CaJwPR9O.js","assets/use-llm-profiles-CyNVoVqm.js","assets/query-keys-CQaji0wJ.js","assets/use-tracking-CjLZgh8X.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~oli4dvxu-CBEOG8NF.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~lpdshwee-CTmh4bwd.js","assets/use-settings-0qFqC-r6.js","assets/lesson-plan-B607buca.js","assets/task-list-tab-Hl9BuVfq.js","assets/use-task-list-JPudBRv3.js","assets/u-check-circle-half-sGVk0BtL.js","assets/u-check-circle-CftRwky1.js","assets/terminal-DRwe8--D.js","assets/vendor~terminal-aeP3PnKf.js","assets/vendor~terminal-T4IDBjWs.css","assets/command-store-BUWgE-vZ.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./preload-helper-CT1Z6Pdu.js";import{A as r,L as i,M as a,k as o}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as s}from"./react-dom-hVBnwgwZ.js";import{c,i as l,r as u,s as d,u as f}from"./path-utils-0KWEiRs9.js";import{t as p}from"./useMutation-7hG0GuPx.js";import{o as m,t as h}from"./declaration-IA661TBv.js";import{n as g}from"./QueryClientProvider-7oLZ1RtQ.js";import{t as _}from"./useQuery-JDs8UaWj.js";import{t as v}from"./Trans-rF21Jwln.js";import{t as y}from"./useTranslation-CbJtty1g.js";import{a as b,c as x,d as S,f as C,i as w,l as T,n as E,o as ee,r as D,s as O,t as te,u as k}from"./messages-BFJXB6MW.js";import{c as ne,d as re,f as A,i as j,l as ie,n as M,r as N,s as P,t as F,u as I}from"./sidebar-mobile-menu-toggle-BDXWzhyB.js";import{a as L,n as R,o as ae,r as oe,t as se}from"./custom-toast-handlers-fgD4IYsu.js";import{n as z,r as ce,t as B}from"./vendor~conversation-panel~conversation-DYHL7QoY.js";import{t as le}from"./x-8AbJWTbX.js";import{C as ue,P as de,S as V,T as H,b as fe,c as pe,d as me,l as he,m as ge,o as _e,t as U,u as ve,w as ye,x as be,y as xe}from"./utils-CVcuFUYj.js";import{t as Se}from"./common-Cfviy7yT.js";import{i as Ce}from"./agent-server-client-options-Dvgeb3x4.js";import{n as W}from"./active-backend-context-CQTk4wD8.js";import{a as we,i as Te,t as Ee}from"./agent-server-conversation-service.api-js3oYcdU.js";import{t as De}from"./modal-backdrop-B1si6TUd.js";import{n as Oe}from"./modal-body-2Po2nl1e.js";import{r as ke}from"./base-modal-Ba5WcNb6.js";import{t as Ae}from"./brand-button-BoiPxAGm.js";import{t as je}from"./loading-spinner-CFuA0UNt.js";import{n as Me}from"./navigation-context-CszaA-CJ.js";import{h as Ne}from"./vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~bok0tgtf-DveauQfg.js";import{O as Pe}from"./vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~mcp~~bok0tgtf-Dr8Ly0at.js";import{t as Fe}from"./styled-tooltip-GXy1qxsO.js";import{r as Ie,u as Le}from"./dropdown-classes-lT1LUsbO.js";import{c as Re,g as ze,h as Be,m as Ve,r as He,v as Ue}from"./chat-send-button-qKFZuB9E.js";import{t as We}from"./react-CuAHzoGi.js";import{r as Ge,t as G}from"./conversation-store-CiYGBud3.js";import{i as Ke,s as qe}from"./conversation-local-storage-D5Tre_GA.js";import{t as Je}from"./modal-close-button-DY-rVmld.js";import{t as Ye}from"./v4-BygpdDmc.js";import{t as Xe}from"./use-is-authed-fNsj-Adj.js";import{t as Ze}from"./use-click-outside-element-Bu2A3s59.js";import{r as Qe}from"./use-settings-0qFqC-r6.js";import{t as $e}from"./use-tracking-CjLZgh8X.js";import{t as et}from"./use-create-conversation-CzvaVA5A.js";import{r as tt}from"./conversation-service.api-y_eB_43m.js";import{i as nt}from"./vendor~root-layout~conversation-panel~conversation~shared-conversation-DToubnIU.js";import{n as rt,t as K}from"./context-menu-list-item-CHWCx1Mc.js";import{i as q,r as it,t as at}from"./ellipsis-button-CiLx8dqc.js";import{t as ot}from"./u-edit-foF02hwH.js";import{t as st}from"./skills-BDOWVle-.js";import{t as ct}from"./terminal-BUww3Ssl.js";import{t as lt}from"./use-user-conversation-CQ5IwnZk.js";import{t as ut}from"./conversation-state-store-DpgQaK_O.js";import{r as dt}from"./typography-Cx7uw7z3.js";import{C as ft,D as pt,E as mt,I as ht,M as gt,O as _t,P as vt,S as yt,T as bt,_ as xt,a as St,b as Ct,d as wt,f as Tt,g as Et,h as Dt,i as Ot,j as kt,k as At,m as jt,n as Mt,p as Nt,r as Pt,t as Ft,v as It,w as Lt,x as Rt,y as zt}from"./git-control-bar-branch-button-D1uam-nI.js";import{n as J,r as Bt,t as Y}from"./use-active-conversation-DJGoI9Mc.js";import{t as X}from"./use-agent-state-BXgWhFh6.js";import{a as Vt,c as Ht,d as Z,f as Ut,l as Wt,n as Gt,o as Kt,s as qt,t as Jt,u as Yt}from"./conversation-websocket-context-Bb4XBXoc.js";import{C as Xt,a as Zt,d as Qt,o as $t,t as en}from"./use-event-store-DSpvASbC.js";import{t as tn}from"./command-store-BUWgE-vZ.js";import{t as nn}from"./lesson-plan-B607buca.js";import{t as rn}from"./copy-CAxUvM-U.js";import{t as an}from"./use-runtime-is-ready-CWkGQFsb.js";import{r as on}from"./plan-components-DsiDjcDi.js";import{t as sn}from"./use-breakpoint-Dt2knceC.js";import{t as cn}from"./globe-CQ_5xwpo.js";import{n as ln,t as un}from"./use-unified-vscode-url-DSn2tT08.js";import{t as dn}from"./use-task-list-JPudBRv3.js";import{t as fn}from"./vendor~conversation-panel~conversation~alert-banner-BnHToS5O.js";var Q=e(t(),1),pn={curAgentState:V.LOADING},mn=We(e=>({...pn,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(pn)})),hn=`openhands-last-conversation-by-backend`;function gn(e,t){return t?`${e}::${t}`:e}function _n(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(hn);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}catch{return{}}}function vn(e){if(!(typeof window>`u`))try{window.localStorage.setItem(hn,JSON.stringify(e))}catch{}}function yn(e,t,n){if(!n)return;let r=_n();r[gn(e,t)]=n,vn(r)}function bn(e,t){let n=_n(),r=gn(e,t);r in n&&(delete n[r],vn(n))}var xn=e=>({action:C.CHANGE_AGENT_STATE,args:{agent_state:e}}),Sn=e=>`error`in e,Cn=e=>`type`in e&&e.type===`error`,wn=()=>{let{send:e}=S(),t=en(e=>e.events);Q.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!($t(n)&&Zt(n))){if(Sn(n)){if(n.error_code===401){R(`Session expired.`);return}typeof n.error==`string`?R(n.error):R(n.message);return}Cn(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(xn(V.PAUSED))}},[t.length])},Tn=()=>{let{curAgentState:e}=X();return{runtimeActive:!ue.includes(e)}};function En({children:e}){return wn(),Tn(),e}var $=m(),Dn=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,$.jsx)(`path`,{d:`M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z`})}),On={entriesByConversation:{}},kn=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),An=We()(Ge(e=>({...On,addPending:(t,n)=>{let r=Ye();return e(e=>kn(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>kn(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>kn(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>kn(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function jn({onClick:e}){let{t}=y(`openhands`);return(0,$.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-normal text-success bg-success/10 hover:bg-success/20 border border-success/30 transition-colors`,children:[(0,$.jsx)(Dn,{className:`w-3.5 h-3.5 fill-success`}),(0,$.jsx)(`span`,{children:t(h.CHAT_INTERFACE$BTW_GOT_IT)})]})}function Mn({conversationId:e}){let{t}=y(`openhands`),n=An(e=>e.entriesByConversation),r=An(e=>e.dismiss),i=e?n[e]??[]:[];return!e||i.length===0?null:(0,$.jsx)(`div`,{"data-testid":`btw-messages`,className:`flex flex-col w-full`,children:i.map(n=>{let i=n.status===`pending`;return(0,$.jsx)(T,{title:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`opacity-60`,children:t(h.CHAT_INTERFACE$BTW_PREFIX)}),(0,$.jsx)(`span`,{children:n.question}),i&&(0,$.jsx)(`span`,{"data-testid":`btw-spinner`,className:`inline-block w-3.5 h-3.5 ml-2 rounded-full border-2 border-[var(--oh-border-input)] border-t-transparent animate-spin`})]}),details:i?t(h.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,$.jsx)(jn,{onClick:()=>r(e,n.id)})},n.id)})})}var Nn=`${H} `,Pn=(e,t)=>{let n=An(e=>e.addPending),r=An(e=>e.resolve),i=An(e=>e.fail);return(0,Q.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(Nn);if(!e||!s){t(a);return}let c=o.slice(H.length).trim();if(!c)return;let l=n(e,c);u(e,c).then(({response:t})=>r(e,l,t)).catch(t=>i(e,l,t?.message??`Failed to ask agent`))},[e,t,n,r,i])},Fn=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function In(e){return U(Fn,e?`bg-[var(--oh-surface)] hover:bg-tertiary cursor-pointer text-white`:`bg-[var(--oh-surface)] cursor-not-allowed opacity-50 text-[var(--oh-muted)]`)}function Ln(e){return e?`white`:`var(--oh-muted)`}var Rn=`font-normal text-sm leading-5 truncate`;function zn({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=y(`openhands`),{trackPullButtonClick:a}=$e(),o=n&&t&&r;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(pe())},disabled:!o,className:U(In(o),`px-0.5 py-1 w-[76px] min-w-[76px]`),children:[(0,$.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,$.jsx)(ft,{width:12,height:12,color:Ln(o)})}),(0,$.jsx)(`div`,{className:U(Rn,`max-w-[76px]`),title:i(h.COMMON$PULL),children:i(h.COMMON$PULL)})]})}function Bn({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=y(`openhands`),{trackPushButtonClick:o}=$e(),s=n&&t&&i;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(he(r))},disabled:!s,className:U(In(s),`px-2 py-1 w-[77px] min-w-[77px]`),children:[(0,$.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,$.jsx)(Lt,{width:12,height:12,color:Ln(s)})}),(0,$.jsx)(`div`,{className:U(Rn,`max-w-[77px]`),title:a(h.COMMON$PUSH),children:a(h.COMMON$PUSH)})]})}function Vn({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=y(`openhands`),{trackCreatePrButtonClick:o}=$e(),s=n&&t&&i;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(_e(r))},disabled:!s,className:U(In(s),`px-2 py-1 w-[126px] min-w-[126px] h-7`),children:[(0,$.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,$.jsx)(yt,{width:12,height:12,color:Ln(s)})}),(0,$.jsx)(`div`,{className:U(Rn,`max-w-[126px]`),title:a(h.COMMON$PULL_REQUEST),children:a(h.COMMON$PULL_REQUEST)})]})}function Hn(e){return e.kind===`BashCommand`}function Un(e){return e.kind===`BashOutput`}function Wn(e){return e.kind===`BashError`}function Gn(e,t,n){let r=(0,Q.useRef)(null),i=(0,Q.useRef)([]),a=(0,Q.useRef)([]),o=(0,Q.useRef)(new Map);return(0,Q.useEffect)(()=>{if(!n)return;let s=Ce(e,t),c=new WebSocket(s);r.current=c,c.onopen=()=>{for(let{command:e,cwd:t,timeout:n,resolve:r,reject:o}of i.current)a.current.push({resolve:r,reject:o}),c.send(JSON.stringify({command:e,cwd:t,timeout:n}));i.current=[]},c.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Hn(t)){let e=a.current.shift();e&&o.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Un(t)&&t.command_id){let e=o.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(o.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else Wn(t)&&l(`Bash error: ${t.code}: ${t.detail}`)};function l(e){let t=Error(e);for(let{reject:e}of i.current)e(t);i.current=[];for(let e of a.current)e.reject(t);a.current=[];for(let e of o.current.values())e.reject(t);o.current.clear()}return c.onclose=()=>{r.current=null,l(`Bash WebSocket closed`)},c.onerror=()=>{r.current=null,l(`Bash WebSocket error`)},()=>{c.onclose=null,c.onerror=null,c.close(),r.current=null,l(`Bash WebSocket unmounted`)}},[n,e,t]),(0,Q.useCallback)((e,t,n)=>new Promise((o,s)=>{let c=r.current;if(!c||c.readyState===WebSocket.CLOSED||c.readyState===WebSocket.CLOSING){s(Error(`Bash WebSocket not available`));return}c.readyState===WebSocket.CONNECTING?i.current.push({command:e,cwd:t,timeout:n,resolve:o,reject:s}):(a.current.push({resolve:o,reject:s}),c.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var Kn={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function qn(e){return e.replace(/\.git$/,``)}function Jn(e){return e?Kn[e.toLowerCase()]??null:null}function Yn(e){let t=e.split(`/`).filter(Boolean),n=t.indexOf(`_git`);return n===-1?t.join(`/`):[...t.slice(0,n),...t.slice(n+1)].join(`/`)}function Xn(e,t,n){let r=qn(n.replace(/^\/+/,``)),i=Jn(t);return{url:e,host:t,repository:(i===`azure_devops`?Yn(r):r)||null,provider:i}}function Zn(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return Xn(t,e,n[2])}try{let e=new URL(t);return Xn(t,e.hostname||null,e.pathname)}catch{return null}}var Qn={repository:null,branch:null,provider:null,remoteUrl:null},$n=[`r=$(git remote get-url origin 2>/dev/null)`,`b=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)`,`if [ -z "$r$b" ]; then`,`n=$(find . -mindepth 2 -maxdepth 4 -name .git 2>/dev/null | cut -c3- | sed 's|/.git$||' | sort -u)`,`c=$(printf '%s\\n' "$n" | grep -c '[^[:space:]]')`,`if [ "$c" = "1" ] && [ -n "$n" ]; then`,`r=$(git -C "$n" remote get-url origin 2>/dev/null)`,`b=$(git -C "$n" rev-parse --abbrev-ref HEAD 2>/dev/null)`,`fi`,`fi`,`printf '%s\\n%s' "$r" "$b"`].join(`
3
+ `);async function er(e,t){let n=await e($n,t,10);if(n.exit_code!==0)return Qn;let r=n.stdout.indexOf(`
4
+ `),i=(r>=0?n.stdout.slice(0,r):n.stdout).trim(),a=(r>=0?n.stdout.slice(r+1):``).trim(),o=a&&a!==`HEAD`?a:null;if(!i&&!o)return Qn;let s=Zn(i);return{repository:s?.repository??null,provider:s?.provider??null,remoteUrl:i||null,branch:o}}var tr=()=>{let{data:e}=Y(),t=an(),{backend:n}=W(),r=n.kind===`local`,i=e?.id,a=e?.conversation_url,o=e?.session_api_key,s=e?.workspace?.working_dir?.trim(),c=!!e?.selected_repository,l=!!e?.git_provider,u=!!e?.selected_branch,d=r&&t&&!!i&&!!s&&(!c||!l||!u),f=Gn(a,o,d),p=(0,Q.useRef)(f);return p.current=f,_({queryKey:[`local-git-info`,i,a,o,s],queryFn:async()=>er((e,t,n)=>p.current(e,t,n),s),enabled:d,retry:!1,staleTime:1e4,refetchInterval:1e4,gcTime:1e3*60*5,meta:{disableToast:!0}})},nr=()=>{let e=g(),{t}=y(`openhands`);return p({mutationFn:e=>Ee.updateConversationRepository(e.conversationId,e.repository,e.branch,e.gitProvider),onMutate:async t=>{let n=[`user`,`conversation`,t.conversationId];await e.cancelQueries({queryKey:n});let r=e.getQueriesData({queryKey:n});return e.setQueriesData({queryKey:n},e=>e&&{...e,selected_repository:t.repository,selected_branch:t.branch??null,git_provider:t.gitProvider??null}),{previousEntries:r}},onError:(n,r,i)=>{i?.previousEntries.forEach(([t,n])=>{e.setQueryData(t,n)}),R(t(h.CONVERSATION$FAILED_TO_UPDATE_REPOSITORY))},onSuccess:()=>{oe(t(h.CONVERSATION$REPOSITORY_UPDATED))},onSettled:(t,n,r)=>{e.invalidateQueries({queryKey:[`user`,`conversation`,r.conversationId]}),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`local-git-info`,r.conversationId]})}})};function rr({children:e,tooltipMessage:t,testId:n,shouldShowTooltip:r}){return r?(0,$.jsx)(Fe,{content:t,placement:`top`,showArrow:!0,tooltipClassName:`bg-white text-black`,children:(0,$.jsx)(`span`,{"data-testid":n,className:`hover:opacity-100`,children:e})}):e}function ir({isOpen:e,onClose:t,onLaunch:n,defaultProvider:r=`github`}){let{t:i}=y(`openhands`),{providers:a}=Re(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{a.length===1&&!o?s(a[0]):a.length>1&&!o&&r&&a.includes(r)&&s(r)},[a,o,r]);let f=(0,Q.useCallback)(e=>{e!==o&&(s(e),l(null),d(null))},[o]),p=(0,Q.useCallback)(e=>{e?(l(e),d(null)):(l(null),d(null))},[]),m=(0,Q.useCallback)(e=>{d(e)},[]),g=()=>{!c||!u||(n(c,u),l(null),d(null),t())},_=()=>{s(null),l(null),d(null),t()};if(!e)return null;let v=c?.git_provider||o||r,b=!!c&&!!u;return(0,$.jsx)(De,{onClose:_,children:(0,$.jsxs)(Oe,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,$.jsx)(Je,{onClose:_,testId:`close-open-repository-modal`}),(0,$.jsx)(`div`,{className:`w-full pr-6`,children:(0,$.jsx)(ke,{title:i(h.CONVERSATION$OPEN_REPOSITORY)})}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 w-full`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-sm text-white font-normal leading-[22px]`,children:i(h.CONVERSATION$SELECT_OR_INSERT_LINK)}),a.length>1&&(0,$.jsx)(St,{providers:a,value:o,placeholder:`Select Provider`,onChange:f})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-[10px] w-full`,children:[(0,$.jsx)(Pt,{provider:v,value:c?.id||null,repositoryName:c?.full_name||null,onChange:p,placeholder:`Search repositories...`,className:`w-full`}),(0,$.jsx)(Ot,{repository:c?.full_name||null,provider:v,selectedBranch:u,onBranchSelect:m,defaultBranch:c?.main_branch||null,placeholder:`Select branch...`,disabled:!c,className:`w-full`})]})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 w-full`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(Ae,{type:`button`,variant:`secondary`,onClick:_,children:i(h.BUTTON$CANCEL)}),(0,$.jsx)(Ae,{type:`button`,variant:`primary`,onClick:g,isDisabled:!b,children:i(h.BUTTON$LAUNCH)})]})]})})}function ar({onSuggestionsClick:e}){let{t}=y(`openhands`),{conversationId:n}=J(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),{addRecentRepository:c}=He(),l=Z(e=>e.enqueuePendingMessage),u=Z(e=>e.markPendingMessageError),{backend:d}=W(),f=d.kind===`local`,{providers:p}=Re(),m=f||p.length>0,{data:g}=Y(),{repositoryInfo:_}=_t(),{data:v}=tr(),b=vt(),x=Gt()?.isLoadingHistory??!1,C=(0,Q.useRef)(b);(0,Q.useEffect)(()=>{C.current=b},[b]);let{send:w}=S(),T=(0,Q.useRef)(w);(0,Q.useEffect)(()=>{T.current=w},[w]);let E=O(),{mutate:ee}=nr(),{mutate:D,isPending:te}=et(),k=g?.selected_repository||_?.selectedRepository,ne=g?.git_provider||_?.gitProvider,re=g?.selected_branch||_?.selectedBranch,A=k||v?.repository||void 0,j=ne||v?.provider,ie=re||v?.branch||void 0,M=(g?.id?we(g.id):null)?.selected_workspace??null,N=M&&M.replace(/\/+$/,``).split(`/`).pop()||null,P=!!A&&!!j,F=!!g&&b===`OPEN`&&!x;(0,Q.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,Q.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&o(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let I=(e,r)=>{n&&(c(e),ee({conversationId:n,repository:e.full_name,branch:r.name,gitProvider:e.git_provider},{onSuccess:()=>{if(C.current!==`OPEN`){R(t(h.CONVERSATION$CLONE_COMMAND_FAILED_DISCONNECTED));return}let i=e.git_provider.charAt(0).toUpperCase()+e.git_provider.slice(1),a=`Clone ${e.full_name} from ${i} and checkout branch ${r.name}.`,o=n?l({conversationId:n,text:a}):null;E?.scrollDomToBottom(),Promise.resolve(T.current({action:`message`,args:{content:a,timestamp:new Date().toISOString()}})).catch(e=>{o&&u(o,e instanceof Error?e.message:`Failed to send message`)})}}))},L=!f||!!A||!!N,ae=f&&!P;return L||ie||P?(0,$.jsxs)(`div`,{className:`flex flex-row items-center`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row gap-2.5 items-center overflow-x-auto flex-nowrap relative scrollbar-hide`,children:[L?(0,$.jsx)(Mt,{selectedRepository:A,gitProvider:j,workspaceName:N,onClick:()=>i(!0),disabled:!F||ae}):null,ie?(0,$.jsx)(Ft,{selectedBranch:ie,selectedRepository:A,gitProvider:j}):null,P?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(rr,{tooltipMessage:t(h.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pull-button-tooltip`,shouldShowTooltip:!P,children:(0,$.jsx)(zn,{onSuggestionsClick:e,hasRepository:P,providerTokensReady:m,isConversationReady:F})}),(0,$.jsx)(rr,{tooltipMessage:t(h.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-push-button-tooltip`,shouldShowTooltip:!P,children:(0,$.jsx)(Bn,{onSuggestionsClick:e,hasRepository:P,providerTokensReady:m,currentGitProvider:j,isConversationReady:F})}),(0,$.jsx)(rr,{tooltipMessage:t(h.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pr-button-tooltip`,shouldShowTooltip:!P,children:(0,$.jsx)(Vn,{onSuggestionsClick:e,hasRepository:P,providerTokensReady:m,currentGitProvider:j,isConversationReady:F})})]}):null]}),(0,$.jsx)(ir,{isOpen:r,onClose:()=>i(!1),onLaunch:I,defaultProvider:j})]}):null}function or({onSubmit:e,disabled:t=!1}){let{images:n,files:r,imagesMarkedUploadAsFile:i,clearAllFiles:a,subConversationTaskId:o}=G(),{curAgentState:s}=X(),{data:c}=Y(),{conversationId:l}=Bt(),u=l??c?.id??null,{taskStatus:d}=pt(o,c?.id||null),{handleUpload:f}=wt(),p=Tt(u,Pn(u,t=>{let{imagesToEmbed:o,imagesAsFiles:s}=ht(n,i);e(t,o,[...r,...s]),a()}));return(0,$.jsxs)(`div`,{"data-testid":`interactive-chat-box`,children:[(0,$.jsx)(Nt,{disabled:t||s===V.AWAITING_USER_CONFIRMATION||ge(d),isNewConversationPending:t,onSubmit:p,onFilesPaste:f}),(0,$.jsx)(`div`,{className:`mt-3 pb-3`,children:(0,$.jsx)(ar,{onSuggestionsClick:e=>{p(e)}})})]})}function sr(){let e=en(e=>e.events),t=en(e=>e.uiEvents),n=Q.useMemo(()=>t.filter(Kt),[t]),r=Q.useMemo(()=>e,[e]),i=Q.useMemo(()=>n.length,[n]),a=Q.useMemo(()=>r.some(e=>e.source===`agent`&&!Xt(e)&&!Qt(e)),[r]),o=Vt(r);return{storeEvents:e,uiEvents:t,renderableEvents:n,allConversationEvents:r,totalEvents:i,hasSubstantiveAgentActions:a,conversationUserEventsExist:o,userEventsExist:o}}var cr=e=>`timestamp`in e?e.timestamp:void 0,lr=e=>{let t=!!e&&Ke(e),n=t?void 0:e,{data:r}=lt(e??null),{data:i,isFetched:a}=qt(n??void 0),o=en(e=>e.addEvents),[s,c]=Q.useState(!1),[l,u]=Q.useState(!0),d=Q.useRef(!1),f=Q.useRef(!0);return Q.useEffect(()=>{if(d.current=!1,c(!1),t){f.current=!1,u(!1);return}f.current=!0,u(!0)},[e,t]),Q.useEffect(()=>{t||!a||!i||i.hasMore||(f.current=!1,u(!1))},[t,a,i?.hasMore,n]),{isLoading:s,hasMore:l,loadOlder:Q.useCallback(async()=>{if(!e||Ke(e)||d.current||!f.current||!r)return;let{events:t}=en.getState(),n=t[0];if(!n)return;let i=cr(n);if(!i){f.current=!1,u(!1);return}d.current=!0,c(!0);try{let t=await Wt.searchEvents(e,r?.conversation_url??null,r?.session_api_key??null,{limit:50,sortOrder:`TIMESTAMP_DESC`,timestampLt:i});if(!Array.isArray(t.items))throw Error(`Invalid older-events response: expected page.items to be an array.`);let n=[...t.items].reverse();n.length>0&&o(n),(!t.next_page_id||t.items.length<50)&&(f.current=!1,u(!1))}finally{d.current=!1,c(!1)}},[e,r,r?.conversation_url,r?.session_api_key,o])}};function ur(){return(0,$.jsxs)(`div`,{className:`flex items-center space-x-1.5 rounded-full bg-[var(--oh-surface)] px-3 py-1.5`,children:[(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:0ms]`}),(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:75ms]`}),(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:150ms]`})]})}function dr({suggestion:e,onClick:t}){let{t:n}=y(`openhands`);return(0,$.jsxs)(`button`,{type:`button`,className:`list-none border border-[var(--oh-border)] rounded-[15px] hover:bg-surface-raised hover:border-[var(--oh-interactive-hover)] transition-colors flex-1 flex items-center justify-center cursor-pointer gap-[10px] h-[55px] px-4`,onClick:()=>t(e.value),children:[(0,Q.useMemo)(()=>{switch(e.label){case`INCREASE_TEST_COVERAGE`:return(0,$.jsx)(Rt,{width:24,height:24,color:`#fff`});case`AUTO_MERGE_PRS`:return(0,$.jsx)(Ct,{width:19,height:20,color:`#fff`});case`FIX_README`:return(0,$.jsx)(zt,{width:24,height:24,color:`#fff`});case`CLEAN_DEPENDENCIES`:return(0,$.jsx)(It,{width:24,height:24,color:`#fff`});default:return null}},[e]),(0,$.jsx)(`span`,{"data-testid":`suggestion`,className:`text-[15px] font-normal leading-5 text-white text-center cursor-pointer`,children:n(e.label)})]})}function fr({suggestions:e,onSuggestionClick:t}){return(0,$.jsx)(`div`,{"data-testid":`suggestions`,className:`grid grid-cols-2 gap-5 max-w-fit`,children:e.map((e,n)=>(0,$.jsx)(dr,{suggestion:e,onClick:t},n))})}var pr=h.SUGGESTIONS$HACKER_NEWS,mr=`Please write a bash script which displays the top story on Hacker News. It should show the title, the link, and the number of points.
5
+ The script should only use tools that are widely available on unix systems, like curl and grep.`,hr=h.SUGGESTIONS$HELLO_WORLD,gr=`I want to create a Hello World app in Javascript that:
6
+ * Displays Hello World in the middle.
7
+ * Has a button that when clicked, changes the greeting with a bouncing animation to fun versions of Hello.
8
+ * Has a counter for how many times the button has been clicked.
9
+ * Has another button that changes the app's background color.`,_r=h.SUGGESTIONS$TODO_APP,vr=`I want to create a VueJS app that allows me to:
10
+ * See all the items on my todo list
11
+ * add a new item to the list
12
+ * mark an item as done
13
+ * totally remove an item from the list
14
+ * change the text of an item
15
+ * set a due date on the item
16
+
17
+ This should be a client-only app with no backend. The list should persist in localStorage.`,yr={repo:xt,"non-repo":{[pr]:mr,[hr]:gr,[_r]:vr}};function br({onSuggestionsClick:e}){let{t}=y(`openhands`),{shouldHideSuggestions:n}=G();return(0,$.jsx)(Pe,{children:!n&&(0,$.jsxs)(B.div,{"data-testid":`chat-suggestions`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:`easeInOut`},className:`pointer-events-auto absolute inset-x-4 bottom-[151px] top-0 flex flex-col items-center justify-center md:inset-x-8`,children:[(0,$.jsx)(`div`,{className:`flex flex-col items-center p-4 rounded-xl w-full`,children:(0,$.jsx)(`span`,{className:`pb-6 text-[32px] font-medium leading-5 text-white`,children:t(h.LANDING$TITLE)})}),(0,$.jsx)(fr,{suggestions:Object.entries(yr.repo).slice(0,4).map(([e,t])=>({label:e,value:t})),onSuggestionClick:e})]})})}var xr={files:[],initialPrompt:null,selectedRepository:null,selectedRepositoryProvider:null,replayJson:null},Sr=We(e=>({...xr,addFile:t=>e(e=>({files:[...e.files,t]})),removeFile:t=>e(e=>({files:e.files.filter((e,n)=>n!==t)})),clearFiles:()=>e(()=>({files:[]})),setInitialPrompt:t=>e(()=>({initialPrompt:t})),clearInitialPrompt:()=>e(()=>({initialPrompt:null})),setSelectedRepository:t=>e(()=>({selectedRepository:t})),clearSelectedRepository:()=>e(()=>({selectedRepository:null})),setSelectedRepositoryProvider:t=>e(()=>({selectedRepositoryProvider:t})),setReplayJson:t=>e(()=>({replayJson:t})),reset:()=>e(()=>xr)})),Cr=e=>(0,$.jsx)(`svg`,{width:12,height:17,viewBox:`0 0 12 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.5304 6.46978L10.4697 7.53044L6.75006 3.81077L6.75006 17.0001H5.25006L5.25006 3.81077L1.53039 7.53044L0.469727 6.46978L6.00006 0.939453L11.5304 6.46978Z`,fill:`currentColor`})});function wr({onClick:e}){return(0,$.jsx)(`button`,{type:`button`,onClick:e,"data-testid":`scroll-to-bottom`,className:`flex items-center justify-center size-8 rounded-full bg-[var(--oh-surface)] text-[var(--oh-muted)] hover:bg-tertiary hover:text-white rotate-180 cursor-pointer transition-colors`,children:(0,$.jsx)(Cr,{width:15,height:15})})}var Tr=[{width:`w-[25%]`,height:`h-4`,align:`justify-end`},{width:`w-[60%]`,height:`h-4`,align:`justify-start`},{width:`w-[45%]`,height:`h-4`,align:`justify-start`},{width:`w-[65%]`,height:`h-20`,align:`justify-start`},{width:`w-[35%]`,height:`h-4`,align:`justify-end`},{width:`w-[50%]`,height:`h-4`,align:`justify-start`},{width:`w-[30%]`,height:`h-4`,align:`justify-end`},{width:`w-[75%]`,height:`h-4`,align:`justify-start`},{width:`w-[55%]`,height:`h-4`,align:`justify-start`}];function Er({width:e,height:t}){return(0,$.jsx)(`div`,{className:U(`rounded-md bg-foreground/5 animate-pulse`,e,t)})}function Dr(){return(0,$.jsx)(`div`,{className:`flex flex-col gap-6 p-4 w-full h-full overflow-hidden`,"data-testid":`chat-messages-skeleton`,"aria-label":`Loading conversation`,children:Tr.map((e,t)=>(0,$.jsx)(`div`,{className:U(`flex w-full`,e.align),children:(0,$.jsx)(Er,{width:e.width,height:e.height})},t))})}var Or=220;function kr({message:e,onDismiss:t,onRetry:n}){let{t:r,i18n:i}=y(`openhands`),[a,o]=Q.useState(!1),[s,c]=Q.useState(!1),l=Q.useRef(null),u=i.exists(e,{ns:`openhands`}),d=u?String(r(e)):e,f=d.length>Or,p=f&&!a;return Q.useLayoutEffect(()=>{let e=l.current;if(!e)return;let t=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(t)||t<=0){c(!1);return}c(e.getBoundingClientRect().height>t*1.5)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[d,p,a,e]),(0,$.jsxs)(`div`,{className:U(`flex w-full gap-2 rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface-raised)] p-2 text-[var(--oh-foreground)]`,s?`items-start`:`items-center`),"data-testid":`error-message-banner`,children:[(0,$.jsx)(ae,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:de},"data-testid":`error-message-banner-icon`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{ref:l,className:U(`whitespace-pre-wrap break-words text-sm text-[var(--oh-muted)]`,p&&`line-clamp-3`),"data-testid":`error-message-banner-content`,children:u?(0,$.jsx)(v,{ns:`openhands`,i18nKey:e}):e}),f&&(0,$.jsx)(`button`,{type:`button`,className:`mt-1 cursor-pointer text-xs font-normal text-[var(--oh-foreground)] underline`,onClick:()=>o(e=>!e),"data-testid":`error-message-banner-toggle`,children:r(a?h.COMMON$VIEW_LESS:h.COMMON$VIEW_MORE)})]}),(0,$.jsxs)(`div`,{className:U(`flex shrink-0 gap-1`,s?`self-start`:`items-center`),children:[n&&(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`error-message-banner-retry`,children:r(h.CHAT_INTERFACE$MESSAGE_RETRY)}),t&&(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 cursor-pointer rounded-md p-1 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-[var(--oh-foreground)]`,"aria-label":r(h.BUTTON$CLOSE),"data-testid":`error-message-banner-dismiss`,children:(0,$.jsx)(le,{className:`h-4 w-4`,"aria-hidden":!0})})]})]})}function Ar(){let{conversationId:e}=Bt(),t=Z(e=>e.pendingMessages),n=Z(e=>e.markPendingMessageError),r=Z(e=>e.markPendingMessageSending),i=Z(e=>e.removePendingMessage),a=G(e=>e.restoreMessageToInputIfEmpty),{send:o}=S(),s=Q.useMemo(()=>e?t.filter(t=>At(e,t.conversationId)):[],[t,e]),c=Q.useCallback(async e=>{let t=Z.getState().pendingMessages.find(t=>t.id===e);if(t){r(e);try{await o(k(t.text,t.imageUrls,t.fileUrls,t.timestamp))}catch(t){n(e,t instanceof Error?t.message:`Failed to send message`)}}},[o,n,r]),l=Q.useCallback((e,t)=>{a(t),i(e)},[a,i]);return s.length===0?null:(0,$.jsx)($.Fragment,{children:s.map(e=>(0,$.jsx)(w,{type:`user`,message:e.text,pendingStatus:e.status,onRetry:e.status===`error`?()=>c(e.id):void 0,onStop:e.status===`sending`?()=>l(e.id,e.text):void 0,children:e.imageUrls.length>0&&(0,$.jsx)(E,{size:`small`,images:e.imageUrls})},e.id))})}var jr=()=>{let{data:e}=Y();return p({mutationKey:[`unified-upload-files`],mutationFn:async t=>{let{conversationId:n,files:r}=t;return tt(n,r,e)},meta:{disableToast:!0}})},Mr=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3.25C9.92893 3.25 8.25 4.92893 8.25 7V10H7C6.44772 10 6 10.4477 6 11V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V11C18 10.4477 17.5523 10 17 10H15.75V7C15.75 4.92893 14.0711 3.25 12 3.25ZM14.25 10V7C14.25 5.75736 13.2426 4.75 12 4.75C10.7574 4.75 9.75 5.75736 9.75 7V10H14.25Z`,fill:`currentColor`})});function Nr(){let{t:e}=y(`openhands`),{data:t}=Qe();return t?.confirmation_mode?(0,$.jsx)(Fe,{closeDelay:100,content:e(h.COMMON$CONFIRMATION_MODE_ENABLED),tooltipClassName:`bg-white text-black hover:bg-transparent`,children:(0,$.jsx)(`div`,{className:`flex items-center justify-center w-[26px] h-[26px] rounded-lg bg-[var(--oh-surface)]`,children:(0,$.jsx)(Mr,{width:15,height:15})})}):null}var Pr=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{d:`M15 12C15 12.7956 14.6839 13.5587 14.1213 14.1213C13.5587 14.6839 12.7956 15 12 15C11.2044 15 10.4413 14.6839 9.87868 14.1213C9.31607 13.5587 9 12.7956 9 12C9 11.2044 9.31607 10.4413 9.87868 9.87868C10.4413 9.31607 11.2044 9 12 9C12.7956 9 13.5587 9.31607 14.1213 9.87868C14.6839 10.4413 15 11.2044 15 12Z`,fill:`currentColor`})});function Fr({status:e,statusColor:t}){return(0,$.jsx)(`div`,{"data-testid":`chat-status-indicator`,className:Ne(`w-full max-w-full rounded-[100px] p-1 bg-[var(--oh-surface)] flex items-center gap-1`),children:(0,$.jsxs)(Pe,{mode:`wait`,children:[(0,$.jsx)(B.span,{className:`flex-shrink-0 animate-[pulse_1.2s_ease-in-out_infinite]`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},children:(0,$.jsx)(Pr,{className:`w-4 h-4`,color:t})},`dot-${e}`),(0,$.jsx)(B.span,{initial:{opacity:0,y:-2},animate:{opacity:1,y:0},exit:{opacity:0,y:2},transition:{duration:.3},className:`pr-1.5 font-normal text-[11px] leading-[16px] normal-case break-words whitespace-normal`,children:e},`text-${e}`)]})})}var Ir=()=>{let e=g(),{navigate:t}=Me(),{t:n}=y(`openhands`),{data:r}=Y();return p({mutationFn:async()=>{if(!r?.id)throw Error(`No active conversation`);let e=await Ee.createConversation(void 0,void 0,void 0,void 0,void 0,void 0,void 0,r.sandbox_id??void 0);if(e.status===`ERROR`)throw Error(e.detail||`Failed to create new conversation`);return{newConversationId:e.app_conversation_id?e.app_conversation_id:`task-${e.id}`,oldConversationId:r.id}},onMutate:()=>{L.loading(n(h.CONVERSATION$CLEARING),{...se,id:`clear-conversation`})},onSuccess:r=>{L.dismiss(`clear-conversation`),oe(n(h.CONVERSATION$CLEAR_SUCCESS)),t(`/conversations/${r.newConversationId}`),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`v1-batch-get-app-conversations`]})},onError:e=>{L.dismiss(`clear-conversation`);let t=n(h.CONVERSATION$CLEAR_UNKNOWN_ERROR);e instanceof Error?t=e.message:typeof e==`string`&&(t=e),R(n(h.CONVERSATION$CLEAR_FAILED,{error:t}))}})};function Lr(e,t){return e?`github`:t?`replay`:`direct`}function Rr(){let{trackInitialQuerySubmitted:e,trackUserMessageSent:t}=$e(),{setMessageToSend:n}=G(),{errorMessage:r,removeErrorMessage:i,setErrorMessage:a}=Ut(),{isTask:o,taskStatus:s,taskDetail:c}=_t(),l=o,u=Gt(),{send:d}=S(),{renderableEvents:f,allConversationEvents:p,totalEvents:m,hasSubstantiveAgentActions:g,userEventsExist:_}=sr(),v=Z(e=>e.enqueuePendingMessage),C=Z(e=>e.markPendingMessageError),w=Z(e=>e.pendingMessages),{t:T}=y(`openhands`),E=Q.useRef(null),{scrollDomToBottom:D,onChatBodyScroll:O,hitBottom:ne,autoScroll:re,setAutoScroll:A,setHitBottom:j}=on(E),{mutate:ie,isPending:M}=Ir(),{curAgentState:N}=X(),{handleBuildPlanClick:P}=b(),{data:F}=Y(),I=F?.sandbox_status??null,L=I===`MISSING`||I===`ERROR`,ae=N===V.RUNNING||N===V.LOADING;Q.useEffect(()=>{if(ae)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),P(e),D())};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[ae,P,D]);let{selectedRepository:oe,replayJson:se}=Sr(),{conversationId:z}=Bt(),{mutateAsync:ce}=jr(),{isLoading:B,hasMore:le,loadOlder:ue}=lr(z),de=Q.useRef(null),H=Q.useCallback(e=>{if(l||B||!le)return;let t=e.scrollTop<=80,n=e.scrollHeight<=e.clientHeight+80;!t&&!n||(de.current={scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},ue().catch(e=>{de.current=null,a(e instanceof Error&&e.message?e.message:T(h.ERROR$GENERIC))}))},[le,B,l,ue,a,T]),fe=Q.useCallback(e=>{e.deltaY<0&&e.currentTarget.scrollTop<=0&&H(e.currentTarget)},[H]),pe=Q.useMemo(()=>z?w.some(e=>At(z,e.conversationId)):!1,[w,z]),he=p.length>0||pe||!u?.isLoadingHistory,ge=!!z,_e=!he&&!o,U=Yt(e=>z?(e.entriesByConversation[z]?.length??0)>0:!1),ye=async(r,i,a)=>{if(r.trim()===`/new`){if(!z){R(T(h.CONVERSATION$CLEAR_NO_ID));return}if(m===0){R(T(h.CONVERSATION$CLEAR_EMPTY));return}if(M)return;ie();return}let o=[...i],s=[...a];m===0?e({entryPoint:Lr(oe!==null,se!==null),queryCharacterLength:r.length,replayJsonSize:se?.length}):t({sessionMessageCount:m,currentMessageLength:r.length});let c=kt([...o,...s]);if(!c.isValid){R(`Error: ${c.errorMessage}`);return}let l=o.map(e=>gt(e)),u=await Promise.all(l),f=new Date().toISOString(),{skipped_files:p,uploaded_files:g}=s.length>0?await ce({conversationId:z,files:s}):{skipped_files:[],uploaded_files:[]};p.forEach(e=>R(e.reason));let _=`${T(`CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE`)}: ${g.join(`
18
+
19
+ `)}`,y=g.length>0?`${r}\n\n${_}`:r,b=v({conversationId:z,text:r,content:y,imageUrls:u,fileUrls:g,timestamp:f});D(),n(``);try{await d(k(y,u,g,f))}catch(e){C(b,e instanceof Error?e.message:`Failed to send message`)}};Q.useEffect(()=>{if(de.current&&E.current){let{scrollHeight:e,scrollTop:t}=de.current,n=E.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),de.current=null;return}re&&D()},[f.length,pe,D]);let be=Q.useRef(H);Q.useEffect(()=>{be.current=H}),Q.useEffect(()=>{let e=E.current;e&&be.current(e)},[f.length,le]);let xe={scrollRef:E,autoScroll:re,setAutoScroll:A,scrollDomToBottom:D,hitBottom:ne,setHitBottom:j,onChatBodyScroll:O},Se=N===V.LOADING||N===V.INIT,Ce=N===V.STOPPED,W=N===V.PAUSED,we=ve({isPausing:W,isTask:o,taskStatus:s,isStartingStatus:Se,isStopStatus:Ce,curAgentState:N}),Te=me({isPausing:W,isTask:o,taskStatus:s,taskDetail:c,isStartingStatus:Se,isStopStatus:Ce,curAgentState:N,errorMessage:r,t:T});return(0,$.jsx)(ee,{value:xe,children:(0,$.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!g&&!pe&&!_&&!U&&!_e&&!l&&m===0&&!L&&(0,$.jsx)(br,{onSuggestionsClick:e=>n(e)}),(0,$.jsxs)(`div`,{ref:E,"data-testid":`chat-scroll-container`,onScroll:e=>{O(e.currentTarget),H(e.currentTarget)},onWheel:fe,className:`custom-scrollbar-always flex min-h-0 grow flex-col gap-2 overflow-x-hidden overflow-y-auto px-0 pt-4 pb-8 md:px-4`,children:[_e&&ge&&(0,$.jsx)(Dr,{}),_e&&!ge&&(0,$.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,$.jsx)(je,{size:`small`})}),B&&(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-3 text-sm text-neutral-400`,"data-testid":`loading-older-events`,children:[(0,$.jsx)(je,{size:`small`}),(0,$.jsx)(`span`,{children:T(h.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,$.jsx)(x,{conversationId:z,anchorEventId:null}),he&&f.length>0&&(0,$.jsx)(te,{messages:f,allEvents:p}),(0,$.jsx)(Ar,{})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px]`,children:[(0,$.jsx)(Mn,{conversationId:z}),r&&(0,$.jsx)(kr,{message:r,onDismiss:i,onRetry:r===`Unable to connect to server`?()=>u?.reconnect():void 0}),L?(0,$.jsxs)(`div`,{"data-testid":`archived-conversation-banner`,className:`mx-1 px-4 py-3 rounded-lg bg-[var(--oh-surface)] border border-[var(--oh-border-subtle)]`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-[var(--oh-foreground)]`,children:T(I===`ERROR`?h.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:h.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,$.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:T(I===`ERROR`?h.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:h.CHAT_INTERFACE$ARCHIVED_SANDBOX_DESCRIPTION)})]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full mb-1 z-20`,children:(0,$.jsxs)(`div`,{className:`flex justify-between relative`,children:[(0,$.jsxs)(`div`,{className:`flex items-end gap-1 pointer-events-auto`,children:[(0,$.jsx)(Nr,{}),Se&&(0,$.jsx)(Fr,{statusColor:we,status:Te})]}),ne?N===V.RUNNING&&(0,$.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,$.jsx)(ur,{})}):(0,$.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,$.jsx)(wr,{onClick:D})})]})}),(0,$.jsx)(or,{onSubmit:ye,disabled:M})]})]})]})})}function zr({isRightPanelShown:e}){return(0,$.jsx)(`div`,{className:`flex justify-center w-full h-full`,children:(0,$.jsx)(`div`,{className:`w-full min-w-0 max-w-[800px] h-full flex flex-col min-h-0 transition-all duration-300 ease-in-out`,children:(0,$.jsx)(Rr,{})})})}function Br({className:e}){let{t}=y(`openhands`);return(0,$.jsxs)(`div`,{className:U(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,$.jsx)(f,{className:`h-8 w-8 shrink-0 animate-spin text-[var(--oh-text-secondary)]`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-base font-normal leading-5 text-[var(--oh-text-secondary)]`,children:t(h.HOME$LOADING)})]})}function Vr({children:e}){return(0,$.jsx)(`div`,{className:`absolute inset-0`,children:e})}function Hr({children:e}){return(0,$.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function Ur({children:e}){return(0,$.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}var Wr=(0,Q.lazy)(()=>n(()=>import(`./files-tab-DpulQlIo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62]))),Gr=(0,Q.lazy)(()=>n(()=>import(`./browser-tab-CiBRWB4X.js`),__vite__mapDeps([63,20,1,26,27,4,64,3,37,38,39,21,65,36]))),Kr=(0,Q.lazy)(()=>n(()=>import(`./vscode-tab-AF70Yke0.js`),__vite__mapDeps([66,1,20,26,27,4,67,8,9,5,6,7,10,11,12,13,14,15,16,17,18,19,21,23,24,25,22,46,43,44,45,47,48,51,38,39,49,50,36,68,69,37,70]))),qr=(0,Q.lazy)(()=>n(()=>import(`./planner-tab-CNmJiZ22.js`),__vite__mapDeps([71,1,20,26,27,4,72,36,60,37,38,39,21,40,32,30,31,33,34,28,3,29,35,41,42,73,70,74,75,76,77,78,79,8,9,5,6,7,10,11,12,13,14,15,16,17,18,19,80,24,81,22,82,23,25,43,44,83,84,85,86,87,45,46,47,48,88]))),Jr=(0,Q.lazy)(()=>n(()=>import(`./task-list-tab-Hl9BuVfq.js`),__vite__mapDeps([89,1,20,26,27,4,37,38,39,21,90,57,36,91,92,58,59]))),Yr=(0,Q.lazy)(()=>n(()=>import(`./terminal-DRwe8--D.js`),__vite__mapDeps([93,1,94,95,20,4,69,26,27,38,39,21,49,45,46,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,47,48,23,24,25,22,43,44,50,36,96]))),Xr={tasklist:{component:Jr},files:{component:Wr},browser:{component:Gr},vscode:{component:Kr},terminal:{component:Yr},planner:{component:qr}};function Zr(){let{selectedTab:e,shouldShownAgentLoading:t}=G(),{conversationId:n}=J(),r=(0,Q.useMemo)(()=>Xr[e]??Xr.files,[e]).component;return t?(0,$.jsx)(Br,{}):(0,$.jsx)(Hr,{children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Br,{}),children:(0,$.jsx)(Ur,{children:(0,$.jsx)(Vr,{children:(0,$.jsx)(r,{})},e===`terminal`?`${e}-${n}`:e)})})})}var Qr=()=>{let e=g(),t=Ut(e=>e.removeErrorMessage);return p({mutationKey:[`start-conversation`],mutationFn:async e=>d(e.conversationId),onMutate:async()=>(await e.cancelQueries({queryKey:[`user`,`conversations`]}),{previousConversations:e.getQueryData([`user`,`conversations`])}),onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:(t,n,r)=>{l(e,r.conversationId)},onSuccess:(n,r)=>{t(),c(e,r.conversationId,Se.RUNNING)}})},$r=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM10 9H14A1 1 0 0 1 15 10V14A1 1 0 0 1 14 15H10A1 1 0 0 1 9 14V10A1 1 0 0 1 10 9Z`,fill:`currentColor`})}),ei=e=>(0,$.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.9 1.50004C15.3 1.65004 17.55 2.85004 19.2 4.50004C21.15 6.60004 22.2 9.15004 22.2 12.15C22.2 14.55 21.3 16.8 19.8 18.75C18.3 20.55 16.2 21.9 13.8 22.35C11.4 22.8 9 22.5 6.9 21.3C4.8 20.1 3.15 18.3 2.25 16.05C1.35 13.8 1.2 11.25 1.95 9.00004C2.7 6.60004 4.05 4.65004 6.15 3.30004C8.1 1.95004 10.5 1.35004 12.9 1.50004ZM13.65 20.85C15.6 20.4 17.4 19.35 18.75 17.7C19.95 16.05 20.7 14.1 20.55 12C20.55 9.60004 19.65 7.20004 18 5.55004C16.5 4.05004 14.7 3.15004 12.6 3.00004C10.65 2.85004 8.55 3.30004 6.9 4.50004C5.25 5.70004 4.05 7.35004 3.45 9.45004C2.85 11.4 2.85 13.5 3.75 15.45C4.65 17.4 6 18.9 7.8 19.95C9.6 21 11.7 21.3 13.65 20.85Z`,fill:`currentColor`}),(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 7.49998L10.1655 6.87598L16.9155 11.376V12.624L10.1655 17.124L9 16.5V7.49998ZM10.5 8.90098V15.099L15.1485 12L10.5 8.90098Z`,fill:`currentColor`})]});function ti({icon:e,text:t,onClick:n,testId:r}){return(0,$.jsx)(K,{testId:r,onClick:n,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 w-full items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,$.jsx)(`span`,{className:Le,"aria-hidden":!0,children:e})]})})}function ni({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=X(),{isTask:i,taskStatus:a,taskDetail:o}=_t(),{t:s}=y(`openhands`),{errorMessage:c}=Ut(),l=r===V.LOADING||r===V.INIT,u=fe(t)||be(t),d=ve({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=me({isPausing:n,isTask:i,taskStatus:a,taskDetail:o,isStartingStatus:l,isStopStatus:u,curAgentState:r,errorMessage:c,t:s});return(0,$.jsx)(`div`,{className:e,"data-testid":`server-status`,children:(0,$.jsxs)(`div`,{className:`flex items-center`,children:[(0,$.jsx)(Pr,{className:`w-6 h-6 shrink-0`,color:d}),(0,$.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function ri({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=y(`openhands`),c=Ze(e),l=xe(r),u=be(r),d=l||u;return(0,$.jsxs)(rt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:U(`left-2 w-fit min-w-42`,a),children:[(0,$.jsx)(ni,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ue,{inset:`menu`}),l&&t&&(0,$.jsx)(ti,{icon:(0,$.jsx)($r,{width:18,height:18}),text:s(h.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,$.jsx)(ti,{icon:(0,$.jsx)(ei,{width:18,height:18}),text:s(h.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var ii=e(s(),1);function ai({isPublic:e,onToggle:t,ariaLabel:n}){return(0,$.jsxs)(`label`,{className:`relative inline-flex shrink-0 cursor-pointer items-center`,children:[(0,$.jsx)(`input`,{hidden:!0,type:`checkbox`,"data-testid":`share-publicly-button`,checked:e,"aria-label":n,onChange:e=>t(e.target.checked)}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:U(`inline-flex h-3.5 w-7 items-center rounded-full px-0.5 py-px transition-colors duration-200 ease-in-out`,e?`bg-white`:`bg-base-secondary`),children:(0,$.jsx)(`span`,{className:U(`block h-2 w-2 shrink-0 rounded-full transition-transform duration-200 ease-in-out`,e?`translate-x-[calc(1rem-1px)] bg-base-secondary`:`translate-x-px bg-tertiary-light`)})})]})}function oi({onClose:e,onRename:t,onDelete:n,onStop:r,onDisplayCost:i,onShowAgentTools:a,onShowSkills:o,onShowHooks:s,onTogglePublic:c,onCopyShareLink:l,onDownloadConversation:u,shareUrl:d,position:f=`bottom`,anchorRef:p}){let m=sn(),{t:g}=y(`openhands`),{backend:_}=W(),{data:v}=Y(),b=Ze(e),x=p?.current??null,[S,C]=Q.useState();Q.useLayoutEffect(()=>{if(!x)return;let e=()=>{let e=x.getBoundingClientRect();if(!e)return;let t={position:`fixed`,zIndex:9999};f===`top`?t.bottom=window.innerHeight-e.top+8:t.top=e.bottom+8,t.left=e.left,C(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[x,f]);let w=!!(a||o||s),T=!!i,E=!!(r||n),ee=_.kind===`cloud`?h.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:h.COMMON$STOP_CONVERSATION,D=_.kind===`cloud`&&!!c,O=v?.public||!1,te=!!x,k=(0,$.jsxs)(rt,{ref:b,testId:`conversation-name-context-menu`,position:f,alignment:`left`,className:U(m?`right-0 translate-x-[34%] left-auto`:``,te?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,$.jsx)(K,{testId:`rename-button`,onClick:t,children:(0,$.jsx)(q,{icon:(0,$.jsx)(ot,{width:16,height:16}),text:g(h.BUTTON$RENAME)})}),w&&(0,$.jsx)(Ue,{testId:`separator-tools`,inset:`menu`}),o&&(0,$.jsx)(K,{testId:`show-skills-button`,onClick:o,children:(0,$.jsx)(q,{icon:(0,$.jsx)(st,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:g(h.CONVERSATION$SHOW_SKILLS)})}),s&&(0,$.jsx)(K,{testId:`show-hooks-button`,onClick:s,children:(0,$.jsx)(q,{icon:(0,$.jsx)(bt,{width:16,height:16,"aria-hidden":!0}),text:g(h.CONVERSATION$SHOW_HOOKS)})}),a&&(0,$.jsx)(K,{testId:`show-agent-tools-button`,onClick:a,children:(0,$.jsx)(q,{icon:(0,$.jsx)(Be,{width:16,height:16}),text:g(h.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})}),u&&(0,$.jsx)(K,{testId:`download-trajectory-button`,onClick:u,children:(0,$.jsx)(q,{icon:(0,$.jsx)(ne,{width:16,height:16}),text:g(h.BUTTON$EXPORT_CONVERSATION)})}),(T||E)&&(0,$.jsx)(Ue,{testId:`separator-info-control`,inset:`menu`}),i&&(0,$.jsx)(K,{testId:`display-cost-button`,onClick:i,children:(0,$.jsx)(q,{icon:(0,$.jsx)(P,{width:16,height:16}),text:g(h.BUTTON$DISPLAY_COST)})}),D&&c&&(0,$.jsxs)(`li`,{className:`flex w-full items-center gap-2 rounded px-2 py-2 hover:bg-[var(--oh-interactive-hover)]`,children:[(0,$.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)]`,"aria-hidden":!0,children:(0,$.jsx)(z,{size:16})}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:g(h.CONVERSATION$SHARE_PUBLICLY)}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[O&&d&&l&&(0,$.jsxs)(`div`,{className:`mr-2 flex items-center gap-0.5`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`copy-share-link-button`,onClick:l,className:`rounded p-0.5 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(h.BUTTON$COPY_TO_CLIPBOARD),children:(0,$.jsx)(rn,{width:14,height:14})}),(0,$.jsx)(`a`,{"data-testid":`open-share-link-button`,href:d,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`rounded p-0.5 text-[var(--oh-muted)] no-underline visited:text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(h.BUTTON$OPEN_IN_NEW_TAB),children:(0,$.jsx)(ce,{size:14,"aria-hidden":!0})})]}),(0,$.jsx)(ai,{isPublic:O,onToggle:c,ariaLabel:g(h.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,$.jsx)(K,{testId:`stop-button`,onClick:r,children:(0,$.jsx)(q,{icon:(0,$.jsx)(Ve,{width:16,height:16}),text:g(ee)})}),n&&(0,$.jsx)(K,{testId:`delete-button`,onClick:n,children:(0,$.jsx)(q,{icon:(0,$.jsx)(it,{width:16,height:16}),text:g(h.COMMON$DELETE_CONVERSATION)})})]});return te?typeof document>`u`||!S?null:ii.createPortal((0,$.jsx)(`div`,{style:S,children:k}),document.body):k}function si({onClose:e}){let{t}=y(`openhands`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Je,{onClose:e,testId:`close-metrics-modal`}),(0,$.jsx)(`div`,{className:`w-full pr-6`,children:(0,$.jsx)(ke,{title:t(h.CONVERSATION$METRICS_INFO)})})]})}function ci({currentCost:e,maxBudget:t}){let n=e/t*100;return(0,$.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden mt-1`,children:(0,$.jsx)(`div`,{className:U(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function li({currentCost:e,maxBudget:t}){let{t:n}=y(`openhands`),r=e/t*100;return(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(h.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(h.CONVERSATION$USED)})})})}function ui({cost:e,maxBudgetPerTask:t}){let{t:n}=y(`openhands`);return e===null?null:(0,$.jsx)(`div`,{className:`border-b border-[var(--oh-border-subtle)]`,children:t!==null&&t>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ci,{currentCost:e,maxBudget:t}),(0,$.jsx)(li,{currentCost:e,maxBudget:t})]}):(0,$.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(h.CONVERSATION$NO_BUDGET_LIMIT)})})}function di({cost:e,maxBudgetPerTask:t}){let{t:n}=y(`openhands`);return e===null?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center pb-2`,children:[(0,$.jsx)(`span`,{className:`text-lg font-semibold`,children:n(h.CONVERSATION$TOTAL_COST)}),(0,$.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,$.jsx)(ui,{cost:e,maxBudgetPerTask:t})]})}function fi({label:e,value:t,labelClassName:n=``,valueClassName:r=`font-semibold`}){return(0,$.jsxs)(`div`,{className:`flex justify-between items-center border-b border-[var(--oh-border-subtle)] pb-2`,children:[(0,$.jsx)(`span`,{className:n,children:e}),(0,$.jsx)(`span`,{className:r,children:t})]})}function pi({usage:e}){let{t}=y(`openhands`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(fi,{label:t(h.CONVERSATION$INPUT),value:e.prompt_tokens.toLocaleString()}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pl-4 text-sm`,children:[(0,$.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(h.CONVERSATION$CACHE_HIT)}),(0,$.jsx)(`span`,{className:`text-right`,children:e.cache_read_tokens.toLocaleString()}),(0,$.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(h.CONVERSATION$CACHE_WRITE)}),(0,$.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,$.jsx)(fi,{label:t(h.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,$.jsx)(fi,{label:t(h.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function mi({perTurnToken:e,contextWindow:t}){let{t:n}=y(`openhands`),r=t>0?e/t*100:0,i=Math.min(100,r);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,$.jsx)(`span`,{className:`font-semibold`,children:n(h.CONVERSATION$CONTEXT_WINDOW)})}),(0,$.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full bg-foreground transition-all duration-300`,style:{width:`${i}%`}})}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsxs)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` (`,r.toFixed(2),`% `,n(h.CONVERSATION$USED),`)`]})})]})}function hi(){let{t:e}=y(`openhands`);return(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(h.CONVERSATION$NO_METRICS)})})}function gi(e){let{stats:t}=e;if(!t?.usage_to_metrics)return{accumulated_cost:0,max_budget_per_task:null,accumulated_token_usage:null};let n=0,r=null,i=null;for(let e of Object.values(t.usage_to_metrics))n+=e.accumulated_cost,r===null&&e.max_budget_per_task!==null&&(r=e.max_budget_per_task),e.accumulated_token_usage&&(i=i===null?{...e.accumulated_token_usage}:{prompt_tokens:i.prompt_tokens+e.accumulated_token_usage.prompt_tokens,completion_tokens:i.completion_tokens+e.accumulated_token_usage.completion_tokens,cache_read_tokens:i.cache_read_tokens+e.accumulated_token_usage.cache_read_tokens,cache_write_tokens:i.cache_write_tokens+e.accumulated_token_usage.cache_write_tokens,context_window:Math.max(i.context_window,e.accumulated_token_usage.context_window),per_turn_token:Math.max(i.per_turn_token,e.accumulated_token_usage.per_turn_token)});return{accumulated_cost:n,max_budget_per_task:r,accumulated_token_usage:i}}var _i=(e,t,n,r=!0)=>{let i=_({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return gi(await Ee.getRuntimeConversation(e,t,n))},enabled:r&&!!e&&!!t,staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,retry:!1});return{data:i.data,isLoading:i.isLoading,error:i.error}};function vi({isOpen:e,onOpenChange:t}){let n=Ht(),{data:r}=Y(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=_i(i,a,o,e),c=(0,Q.useMemo)(()=>s?{cost:s.accumulated_cost,max_budget_per_task:s.max_budget_per_task,usage:s.accumulated_token_usage?{prompt_tokens:s.accumulated_token_usage.prompt_tokens??0,completion_tokens:s.accumulated_token_usage.completion_tokens??0,cache_read_tokens:s.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:s.accumulated_token_usage.cache_write_tokens??0,context_window:s.accumulated_token_usage.context_window??0,per_turn_token:s.accumulated_token_usage.per_turn_token??0}:null}:n,[s,n]);return e?(0,$.jsx)(De,{onClose:()=>t(!1),children:(0,$.jsxs)(Oe,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,$.jsx)(si,{onClose:()=>t(!1)}),(0,$.jsxs)(`div`,{className:`w-full`,children:[(c?.cost!==null||c?.usage!==null)&&(0,$.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsx)(di,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pi,{usage:c.usage}),(0,$.jsx)(mi,{perTurnToken:c.usage.per_turn_token,contextWindow:c.usage.context_window})]})]})}),!c?.cost&&!c?.usage&&(0,$.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,$.jsx)(hi,{})})]})]})}):null}function yi(){let{t:e}=y(`openhands`),{conversationId:t}=J(),{data:n}=Y(),{mutate:r}=ie(),[i,a]=Q.useState(`view`),[o,s]=Q.useState(!1),c=Q.useRef(null),l=Q.useRef(null),{handleDelete:u,handleStop:d,handleDownloadConversation:f,handleDisplayCost:p,handleShowAgentTools:m,handleShowSkills:g,handleShowHooks:_,handleTogglePublic:v,handleCopyShareLink:b,shareUrl:x,handleConfirmDelete:S,handleConfirmStop:C,metricsModalVisible:w,setMetricsModalVisible:T,systemModalVisible:E,setSystemModalVisible:ee,skillsModalVisible:D,setSkillsModalVisible:O,hooksModalVisible:te,setHooksModalVisible:k,confirmDeleteModalVisible:ne,setConfirmDeleteModalVisible:A,confirmStopModalVisible:j,setConfirmStopModalVisible:M,systemMessage:N,shouldShowStop:P,shouldShowDownloadConversation:F,shouldShowDisplayCost:L,shouldShowAgentTools:R,shouldShowSkills:ae,shouldShowHooks:se}=mt({conversationId:t,executionStatus:n?.execution_status,showOptions:!0,onContextMenuToggle:s});return Q.useEffect(()=>{i===`edit`&&c.current?.focus()},[i]),n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 h-[22px] text-base font-normal text-left pl-0 lg:pl-1 min-w-0`,"data-testid":`conversation-name`,children:[i===`edit`?(0,$.jsx)(`input`,{ref:c,"data-testid":`conversation-name-input`,onClick:e=>{i===`edit`&&(e.preventDefault(),e.stopPropagation())},onBlur:()=>{if(c.current?.value&&t){let i=c.current.value.trim();i!==n?.title&&r({conversationId:t,newTitle:i},{onSuccess:()=>{oe(e(h.CONVERSATION$TITLE_UPDATED))}})}else c.current&&(c.current.value=n?.title??``);a(`view`)},onKeyUp:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&e.currentTarget.blur()},type:`text`,defaultValue:n.title||``,className:`text-white leading-5 bg-transparent border-none outline-none text-base font-normal w-fit max-w-fit field-sizing-content`}):(0,$.jsx)(`div`,{className:`text-white leading-5 truncate`,"data-testid":`conversation-name-title`,onDoubleClick:()=>{a(`edit`)},title:n.title||``,children:n.title}),i!==`edit`&&(0,$.jsxs)(`div`,{ref:l,className:`relative flex items-center shrink-0`,children:[(0,$.jsx)(at,{onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o)}}),o&&(0,$.jsx)(oi,{onClose:()=>s(!1),onRename:e=>{e.preventDefault(),e.stopPropagation(),a(`edit`),s(!1)},onDelete:u,onStop:P?d:void 0,onDisplayCost:L?p:void 0,onShowAgentTools:R?m:void 0,onShowSkills:ae?g:void 0,onShowHooks:se?_:void 0,onTogglePublic:v,onCopyShareLink:b,shareUrl:x,onDownloadConversation:F?f:void 0,position:`bottom`,anchorRef:l})]})]}),(0,$.jsx)(vi,{isOpen:w,onOpenChange:T}),(0,$.jsx)(Et,{isOpen:E,onClose:()=>ee(!1),systemMessage:N||null}),D&&(0,$.jsx)(Dt,{onClose:()=>O(!1)}),te&&(0,$.jsx)(jt,{onClose:()=>k(!1)}),ne&&(0,$.jsx)(re,{onConfirm:S,onCancel:()=>A(!1),conversationTitle:n?.title||``}),j&&(0,$.jsx)(I,{onConfirm:C,onCancel:()=>M(!1)})]}):null}function bi({children:e,tooltip:t,ariaLabel:n}){return(0,$.jsx)(Fe,{content:t,placement:`bottom`,tooltipClassName:`bg-white text-black text-xs font-medium leading-5`,children:(0,$.jsx)(`span`,{"data-aria-label":n,children:e})})}function xi({className:e}){let{t}=y(`openhands`),n=sn(),r=a(),{conversationId:i}=J(),{isRightPanelShown:o,setHasRightPanelToggled:s,setIsRightPanelShown:c,setSelectedTab:l}=G(),u=()=>{if(n){if(!i)return;s(!0),c(!0);let{selectedTab:e}=G.getState();e||l(`files`),r(`/conversations/${i}/panel`);return}let e=!o;if(s(e),e){let{selectedTab:e}=G.getState();e||l(`files`)}},d=t(n?h.COMMON$SHOW_PANEL:o?h.COMMON$HIDE_PANEL:h.COMMON$SHOW_PANEL),f=n?!1:o;return(0,$.jsx)(bi,{tooltip:d,ariaLabel:d,children:(0,$.jsx)(`button`,{type:`button`,onClick:u,className:U(N,e),"aria-label":d,"aria-pressed":f,"data-testid":`right-panel-toggle`,children:(0,$.jsx)(M,{className:`w-5 h-5 -scale-x-100`})})})}function Si(){let{conversationId:e}=J(),{data:t}=Y(),{curAgentState:n}=X(),{isTask:r,taskStatus:i}=_t(),{mutate:a}=ze(),{mutate:o}=Qr(),{providers:s}=Re(),c=t?.execution_status??null,l=ve({isPausing:!1,isTask:r,taskStatus:i,isStartingStatus:n===V.LOADING||n===V.INIT,isStopStatus:fe(c),curAgentState:n});return(0,$.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,$.jsxs)(`div`,{className:`flex items-center min-w-0`,children:[(0,$.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,$.jsx)(Pr,{className:`ml-[3.5px] w-6 h-6 cursor-pointer`,color:l}),(0,$.jsx)(ri,{onClose:()=>{},onStopServer:xe(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&a({conversationId:e})}:void 0,onStartServer:be(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&o({conversationId:e,providers:s})}:void 0,executionStatus:c,position:`bottom`,className:`opacity-0 invisible pointer-events-none group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto bottom-full left-0 mt-0 min-h-fit`,isPausing:!1})]}),(0,$.jsx)(yi,{})]}),(0,$.jsx)(xi,{className:`mr-2`})]})}var Ci=e=>(0,$.jsxs)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,$.jsx)(`path`,{d:`M3 10.5L6.5 14L14 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,$.jsx)(`path`,{d:`M7 10.5L10.5 14L18 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`})]});function wi({tabValue:e,icon:t,onClick:n,isActive:r,label:i,className:a,measureOnly:o}){return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{n()},...o?{}:{"data-testid":`conversation-tab-${e}`},"data-tab-measure":o?`true`:void 0,className:U(`flex items-center gap-2 rounded-md cursor-pointer`,`pl-1.5 pr-2 py-1 lg:py-1.5`,`text-[var(--oh-muted)] bg-transparent`,r&&`bg-[var(--oh-interactive-active)] text-white`,r?`hover:text-white hover:bg-[var(--oh-interactive-hover)]`:`hover:text-white hover:bg-white/5`,r?`focus-within:text-white`:`focus-within:text-[var(--oh-muted)]`,a),children:[(0,$.jsx)(t,{className:U(`w-5 h-5 text-inherit flex-shrink-0`)}),r&&i&&(0,$.jsx)(`span`,{className:`text-sm font-normal whitespace-nowrap`,children:i})]})}function Ti(){let{curAgentState:e}=X(),{t}=y(`openhands`),{data:n,refetch:r}=un(),i=ye.includes(e);return(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{children:t(h.COMMON$CODE)}),i?null:(0,$.jsx)(nt,{className:`w-3 h-3 text-inherit cursor-pointer`,onClick:async e=>{e.preventDefault(),e.stopPropagation();let t=n?.url;t||=(await r()).data?.url??null,t&&window.open(t,`_blank`,`noopener,noreferrer`)}})]})}var Ei=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7.13832 8.76476C8.25957 8.17949 9.52697 7.9727 10.7515 8.14436L14.9025 2.52826L21.4717 9.09737L15.8555 13.2484C16.0272 14.4729 15.8204 15.7403 15.2351 16.8616C15.1872 16.9535 15.1366 17.0444 15.0836 17.1343C14.8318 17.5605 14.5228 17.9624 14.1566 18.3286L10.4443 14.6163L4.75207 20.3085H3.69141V19.2478L9.38361 13.5556L5.6713 9.84332C6.03755 9.47708 6.43936 9.16808 6.86562 8.91632C6.95547 8.86326 7.04641 8.81274 7.13832 8.76476ZM15.0735 4.82054L19.1794 8.92641L14.2461 12.5727L14.3701 13.4567C14.492 14.3266 14.3596 15.2233 13.9758 16.0265L7.97338 10.0241C8.77665 9.64035 9.67335 9.50789 10.5432 9.62984L11.4272 9.75376L15.0735 4.82054Z`,fill:`currentColor`})}),Di=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{d:`M10.9706 10.1586C10.2819 10.0621 9.56905 10.1784 8.93842 10.5075C8.88672 10.5345 8.83557 10.5629 8.78504 10.5928C8.54529 10.7344 8.3193 10.9082 8.11331 11.1142L9.83702 12.8372L7.00054 15.75L7 17H8.25064L11.1628 14.1632L12.8857 15.8865C13.0917 15.6805 13.2655 15.4545 13.4071 15.2147C13.437 15.1642 13.4654 15.1131 13.4924 15.0614C13.8215 14.4308 13.9378 13.718 13.8413 13.0293L17 10.6946L13.3053 7L10.9706 10.1586Z`,fill:`currentColor`})});function Oi({isOpen:e,onClose:t,ignoreOutsideClickRef:n}){let r=Ze(t,n),{t:i}=y(`openhands`),{conversationId:a}=J(),{state:o,setUnpinnedTabs:s,setSelectedTab:c}=qe(a),{selectedTab:l,isRightPanelShown:u,setSelectedTab:d}=G(),{navigateToTab:f}=D(),{hasTaskList:p}=dn(),{backend:m}=W(),g=[{tab:`planner`,icon:nn,i18nKey:h.COMMON$PLANNER},{tab:`files`,icon:zt,i18nKey:h.COMMON$FILES},{tab:`vscode`,icon:ln,i18nKey:h.COMMON$CODE},{tab:`terminal`,icon:ct,i18nKey:h.COMMON$TERMINAL},{tab:`browser`,icon:cn,i18nKey:h.COMMON$BROWSER}];p&&g.unshift({tab:`tasklist`,icon:Ci,i18nKey:h.COMMON$TASK_LIST});let _=g.filter(({tab:e})=>e!==`vscode`&&e!==`planner`||m.kind===`cloud`);if(!e)return null;let v=e=>{f(e),t()},b=(e,t)=>{if(t.preventDefault(),t.stopPropagation(),o.unpinnedTabs.includes(e))s(o.unpinnedTabs.filter(t=>t!==e));else{let t=[...o.unpinnedTabs,e];if(s(t),l===e&&u){let n=_.find(({tab:n})=>n!==e&&!t.includes(n));n&&(d(n.tab),c(n.tab))}}};return(0,$.jsx)(rt,{ref:r,alignment:`right`,position:`bottom`,className:`z-[9999] mt-2 w-fit`,children:_.map(({tab:e,icon:t,i18nKey:n})=>{let r=!o.unpinnedTabs.includes(e);return(0,$.jsx)(`li`,{className:`list-none`,children:(0,$.jsxs)(`div`,{className:U(`group flex h-[30px] w-full min-w-0 items-stretch rounded`,`hover:bg-[var(--oh-interactive-hover)]`),children:[(0,$.jsxs)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-open-${e}`,className:U(`flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-l p-2 text-start text-white`,Ie),onClick:()=>v(e),children:[(0,$.jsx)(`span`,{className:Le,"aria-hidden":!0,children:(0,$.jsx)(t,{className:`h-4 w-4`})}),(0,$.jsx)(`span`,{className:`text-sm`,children:i(n)})]}),(0,$.jsx)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-pin-${e}`,className:U(`flex shrink-0 cursor-pointer items-center justify-center rounded-r px-2 text-white hover:bg-white/10`,Ie),"aria-pressed":r,"aria-label":r?`Unpin tab from bar`:`Pin tab to bar`,onClick:t=>b(e,t),children:r?(0,$.jsx)(`span`,{className:U(`-mr-[5px] ml-auto`,Le),"aria-hidden":!0,children:(0,$.jsx)(Di,{className:`h-7 w-7`})}):(0,$.jsx)(`span`,{className:U(`ml-auto`,Le),"aria-hidden":!0,children:(0,$.jsx)(Ei,{className:`h-4.5 w-4.5`})})})]})},e)})})}function ki({variant:e=`default`}){let{conversationId:t}=J(),{setSelectedTab:n,planContent:r}=G(),[i,a]=(0,Q.useState)(!1),{state:o}=qe(t),{hasTaskList:s}=dn(),{backend:c}=W(),{handleBuildPlanClick:l}=b(),{curAgentState:u}=X(),{selectTab:d,isTabActive:f,onTabChange:p,selectedTab:m,isRightPanelShown:g}=D();(0,Q.useEffect)(()=>{n(o.selectedTab)},[n,o.selectedTab]),(0,Q.useEffect)(()=>{g&&(m||p(`files`))},[g,m,p]);let{t:_,i18n:v}=y(`openhands`),x=[{tabValue:`files`,isActive:f(`files`),icon:zt,onClick:()=>d(`files`),tooltipContent:_(h.COMMON$FILES),tooltipAriaLabel:_(h.COMMON$FILES),label:_(h.COMMON$FILES)},{tabValue:`planner`,isActive:f(`planner`),icon:nn,onClick:()=>d(`planner`),tooltipContent:_(h.COMMON$PLANNER),tooltipAriaLabel:_(h.COMMON$PLANNER),label:_(h.COMMON$PLANNER)},{tabValue:`vscode`,isActive:f(`vscode`),icon:ln,onClick:()=>d(`vscode`),tooltipContent:(0,$.jsx)(Ti,{}),tooltipAriaLabel:_(h.COMMON$CODE),label:_(h.COMMON$CODE)},{tabValue:`terminal`,isActive:f(`terminal`),icon:ct,onClick:()=>d(`terminal`),tooltipContent:_(h.COMMON$TERMINAL),tooltipAriaLabel:_(h.COMMON$TERMINAL),label:_(h.COMMON$TERMINAL),className:`pl-2`},{tabValue:`browser`,isActive:f(`browser`),icon:cn,onClick:()=>d(`browser`),tooltipContent:_(h.COMMON$BROWSER),tooltipAriaLabel:_(h.COMMON$BROWSER),label:_(h.COMMON$BROWSER)}];s&&x.splice(1,0,{tabValue:`tasklist`,isActive:f(`tasklist`),icon:Ci,onClick:()=>d(`tasklist`),tooltipContent:_(h.COMMON$TASK_LIST),tooltipAriaLabel:_(h.COMMON$TASK_LIST),label:_(h.COMMON$TASK_LIST)});let S=x.filter(e=>e.tabValue===`vscode`&&c.kind!==`cloud`||e.tabValue===`planner`&&c.kind!==`cloud`?!1:o.unpinnedTabs.includes(e.tabValue)?m===e.tabValue:!0),C=o.unpinnedTabs.join(`,`),w=u===V.RUNNING||u===V.LOADING||!r,T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),ee=(0,Q.useRef)(null),O=(0,Q.useRef)(null),[te,k]=(0,Q.useState)(S.length);(0,Q.useLayoutEffect)(()=>{let e=T.current,t=E.current,n=ee.current;if(!e||!t||!n)return;let r=()=>{let r=t.querySelectorAll(`[data-tab-measure="true"]`),i=r.length,a=e.getBoundingClientRect().width;if(a===0){k(i);return}let o=Array.from(r).map(e=>e.getBoundingClientRect().width);if(o.length!==i||i===0){k(Math.max(0,i));return}let s=n.getBoundingClientRect().width,c=getComputedStyle(e).columnGap||getComputedStyle(e).gap,l=parseFloat(c)||6,u=0;for(let e=i;e>=0;--e){let t=s;for(let n=0;n<e;n+=1)t+=o[n]??0;if(e>0&&(t+=e*l),t<=a+.5){u=e;break}}k(e=>e===u?e:u)};if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(e),()=>i.disconnect()},[C,S.length,s,c.kind,m,g,v.language]);let ne=Math.min(te,S.length);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:U(`relative w-full min-w-0`,e===`compact`?`flex h-full min-h-0 items-center py-0 pl-0 pr-1`:`min-h-10 p-1`),children:[(0,$.jsx)(`div`,{ref:E,"aria-hidden":!0,className:`pointer-events-none absolute top-0 left-[-10000px] flex flex-nowrap items-center gap-1.5`,children:S.map(({tabValue:e,icon:t,isActive:n,tooltipContent:r,tooltipAriaLabel:i,label:a,className:o},s)=>(0,$.jsx)(bi,{tooltip:r,ariaLabel:i,children:(0,$.jsx)(wi,{tabValue:e,icon:t,onClick:()=>{},isActive:n,label:a,className:U(o,`shrink-0`),measureOnly:!0})},`measure-${e}-${s}`))}),(0,$.jsx)(`div`,{ref:T,className:`flex w-full min-w-0 flex-nowrap items-center justify-start`,children:(0,$.jsxs)(`div`,{className:`flex w-fit max-w-full min-w-0 flex-nowrap items-center gap-1.5`,children:[(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-nowrap items-center gap-1.5 overflow-x-hidden`,children:S.slice(0,ne).map(({tabValue:e,icon:t,onClick:n,isActive:r,tooltipContent:i,tooltipAriaLabel:a,label:o,className:s},c)=>(0,$.jsx)(bi,{tooltip:i,ariaLabel:a,children:(0,$.jsx)(wi,{tabValue:e,icon:t,onClick:n,isActive:r,label:o,className:U(s,`shrink-0`)})},`${e}-${c}`))}),(0,$.jsxs)(`div`,{ref:ee,className:`relative shrink-0`,children:[(0,$.jsx)(at,{ref:O,onClick:()=>a(!i),ariaLabel:_(h.COMMON$MORE_OPTIONS),iconClassName:e===`compact`?j:void 0}),(0,$.jsx)(Oi,{isOpen:i,onClose:()=>a(!1),ignoreOutsideClickRef:O})]})]})})]}),f(`planner`)&&(0,$.jsx)(`div`,{className:U(`flex h-10 min-h-10 shrink-0 items-center border-t border-[var(--oh-border)] pl-[10px] pr-1`),children:(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:w,className:U(`flex h-5 min-w-17 items-center justify-center rounded bg-white px-2 transition-opacity`,w?`cursor-not-allowed opacity-50`:`cursor-pointer hover:opacity-90`),"data-testid":`planner-tab-build-button`,children:(0,$.jsxs)(dt.Text,{className:`text-[11px] font-normal leading-5 text-black`,children:[_(h.COMMON$BUILD),` ⌘↩`]})})})]})}function Ai({onMouseDown:e,className:t,isDragging:n=!1}){let[r,i]=(0,Q.useState)(!1),a=n||r;return(0,$.jsxs)(`div`,{className:U(`relative z-10 w-0 shrink-0 self-stretch`,t),"aria-hidden":!0,children:[(0,$.jsx)(`div`,{className:`absolute inset-y-0 left-1/2 w-3 min-w-[12px] -translate-x-1/2 cursor-ew-resize`,onMouseDown:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1)}),(0,$.jsx)(`div`,{className:U(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`,a?`bg-white`:`bg-transparent`),"aria-hidden":!0})]})}var ji=200;function Mi({defaultLeftWidth:e=50,minLeftWidth:t=30,maxLeftWidth:n=80,storageKey:r=`desktop-layout-panel-width`}={}){let[i,a]=fn(r,e),o=(0,Q.useCallback)(e=>Math.max(t,Math.min(n,e)),[t,n]),[s,c]=(0,Q.useState)(()=>o(i)),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f=(0,Q.useCallback)(e=>{e.preventDefault(),u(!0)},[]),p=(0,Q.useCallback)(e=>{if(!l||!d.current)return;let t=d.current.getBoundingClientRect();c(o((e.clientX-t.left)/t.width*100))},[l,o]),m=(0,Q.useCallback)(()=>{l&&(u(!1),a(s))},[l,s,a]);return(0,Q.useLayoutEffect)(()=>{if(!l)return;let e=document.createElement(`div`);return e.setAttribute(`aria-hidden`,`true`),e.dataset.panelDragShield=``,Object.assign(e.style,{position:`fixed`,inset:`0`,zIndex:String(ji),cursor:`ew-resize`}),document.body.appendChild(e),document.addEventListener(`mousemove`,p),document.addEventListener(`mouseup`,m),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`,()=>{document.removeEventListener(`mousemove`,p),document.removeEventListener(`mouseup`,m),document.body.style.cursor=``,document.body.style.userSelect=``,e.remove()}},[l,p,m]),{leftWidth:s,rightWidth:100-s,isDragging:l,containerRef:d,handleMouseDown:f}}function Ni(e){return e?`translate-x-0 opacity-100`:`w-0 translate-x-full opacity-0`}function Pi(){let e=sn(),t=sn(767),{isRightPanelShown:n}=G(),{leftWidth:r,rightWidth:i,isDragging:a,containerRef:o,handleMouseDown:s}=Mi({defaultLeftWidth:50,minLeftWidth:30,maxLeftWidth:80,storageKey:`desktop-layout-panel-width`});return(0,$.jsx)(`div`,{className:U(e?`relative min-h-0 flex-1 flex flex-col`:`h-full flex flex-col overflow-hidden`),children:(0,$.jsxs)(`div`,{ref:o,className:U(`flex flex-1 overflow-hidden`,e?`flex-col`:`transition-all duration-300 ease-in-out`),style:e?void 0:{transitionProperty:a?`none`:`all`},children:[(0,$.jsxs)(`div`,{className:U(`flex flex-col bg-base overflow-hidden`,e?`flex-1`:`transition-all duration-300 ease-in-out`),style:e?void 0:{width:n?`${r}%`:`100%`,transitionProperty:a?`none`:`all`},children:[(0,$.jsxs)(`div`,{"data-testid":`chat-pane-header`,className:U(`flex h-10 min-h-10 shrink-0 items-center`,t&&`gap-2 pl-2.5`),children:[t?(0,$.jsx)(F,{}):null,(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(Si,{})})]}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,$.jsx)(zr,{isRightPanelShown:!e&&n})})]}),!e&&n&&(0,$.jsx)(Ai,{onMouseDown:s,isDragging:a}),!e&&(0,$.jsx)(`div`,{className:U(`transition-all duration-300 ease-in-out overflow-hidden`,Ni(n)),style:{width:n?`${i}%`:`0%`,transitionProperty:a?`opacity, transform`:`all`},children:(0,$.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:(0,$.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 bg-[var(--oh-surface)] border-l border-[var(--oh-border)] overflow-hidden`,children:[(0,$.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex shrink-0 flex-col border-b border-[var(--oh-border)]`,children:(0,$.jsx)(ki,{})}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,$.jsx)(Zr,{})})]})})})]})})}function Fi({onNavigateBack:e}){let{t}=y(`openhands`),{setIsRightPanelShown:n,setHasRightPanelToggled:r,setSelectedTab:i}=G();return Q.useLayoutEffect(()=>(n(!0),r(!0),G.getState().selectedTab||i(`files`),()=>{n(!1),r(!1)}),[n,r,i]),(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[var(--oh-surface)]`,children:[(0,$.jsxs)(`div`,{"data-testid":`conversation-mobile-panel-top`,className:`flex h-10 min-h-10 shrink-0 items-center gap-1.5 border-b border-[var(--oh-border)] pl-2.5`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`conversation-mobile-panel-back`,onClick:()=>{e()},"aria-label":t(h.COMMON$BACK),className:N,children:(0,$.jsx)(A,{size:20,className:j,"aria-hidden":!0,strokeWidth:2})}),(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 items-center self-stretch`,children:(0,$.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex h-full min-h-0 w-full min-w-0 flex-col justify-center`,children:(0,$.jsx)(ki,{variant:`compact`})})})]}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-[var(--oh-surface)]`,children:(0,$.jsx)(Zr,{})})]})}var Ii=1e3*60*5,Li=1e3*60*15,Ri=e=>{let t=e||[],n=W();return _({queryKey:[`v1`,`sub-conversations`,t,n.backend.id,n.orgId],queryFn:async()=>t.length===0?[]:Ee.batchGetAppConversations(t),enabled:t.length>0,staleTime:Ii,gcTime:Li,retry:!1})};function zi({children:e,conversationId:t}){let{data:n}=Y(),{data:r}=Ri(n?.sub_conversation_ids??[]),i=r?.filter(e=>e!==null);return(0,$.jsx)(Jt,{conversationId:t,conversationUrl:n?.sandbox_status===`PAUSED`?null:n?.conversation_url,sessionApiKey:n?.session_api_key,subConversationIds:n?.sub_conversation_ids,subConversations:i,children:e})}function Bi(){let{t:e}=y(`openhands`),{conversationId:t}=J(),n=r(`/conversations/:conversationId/panel`),{isTask:i,taskStatus:s,taskDetail:c}=_t(),l=W(),u=Q.useRef(l.backend.id),d=Q.useRef(l.orgId),f=u.current!==l.backend.id||d.current!==l.orgId,{data:p,isFetched:m}=Y(),{data:g}=Xe(),{resetConversationState:_}=G(),v=a(),b=o(),x=tn(e=>e.clearTerminal),S=ut(e=>e.reset),C=mn(e=>e.setCurrentAgentState),w=Ut(e=>e.removeErrorMessage);Q.useEffect(()=>{x(),_(),S(),C(V.LOADING),w()},[t,x,_,S,C,w]),Q.useEffect(()=>{if(i&&s===`ERROR`){R(c||e(h.CONVERSATION$FAILED_TO_START_FROM_TASK));let t=b.state?.resumedFromConversationId;v(t?`/conversations/${t}`:`/conversations`,{replace:!0})}},[i,s,c,e,v,b.state]),Q.useEffect(()=>{!m||!g||f||p||(bn(l.backend.id,l.orgId),R(e(h.CONVERSATION$NOT_EXIST_OR_NO_PERMISSION)),v(`/conversations`))},[p,m,g,v,e,f,l.backend.id,l.orgId]),Q.useEffect(()=>{f||t&&(t.startsWith(`task-`)||yn(l.backend.id,l.orgId,t))},[t,f,l.backend.id,l.orgId]);let T=Q.useRef(null);return Q.useEffect(()=>{!m||!p||l.backend.kind===`cloud`&&p.sandbox_status===`PAUSED`&&p.sandbox_id&&T.current!==p.id&&(T.current=p.id,Te(p.sandbox_id).catch(()=>{R(e(h.CONVERSATION$FAILED_TO_START_FROM_TASK))}))},[m,p?.id,p?.sandbox_status,p?.sandbox_id,l.backend.kind,e]),f?null:(0,$.jsx)(zi,{conversationId:t,children:(0,$.jsx)(En,{children:(0,$.jsx)(`div`,{"data-testid":`app-route`,className:`flex h-full flex-col`,children:n?(0,$.jsx)(Fi,{onNavigateBack:()=>v(`/conversations/${t}`)}):(0,$.jsx)(Pi,{})})})})}function Vi(){return(0,$.jsx)(Bi,{})}var Hi=i(Vi);export{Hi as t};
@@ -0,0 +1,3 @@
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{i as n,l as r,n as i}from"./path-utils-0KWEiRs9.js";import{t as a}from"./useMutation-7hG0GuPx.js";import{o}from"./declaration-IA661TBv.js";import{n as ee}from"./QueryClientProvider-7oLZ1RtQ.js";import{t as s}from"./useQuery-JDs8UaWj.js";import{a as c,c as l,n as u,o as d,r as f}from"./agent-server-client-options-Dvgeb3x4.js";import{n as p}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~oli4dvxu-CBEOG8NF.js";import{a as m}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~jxrvuot9-BaCzvZac.js";import{c as h,t as g}from"./agent-server-conversation-service.api-js3oYcdU.js";import{t as _}from"./proxy-wIasY2Po.js";import{t as v}from"./react-CuAHzoGi.js";import{r as y,t as b}from"./conversation-store-CiYGBud3.js";import{a as te}from"./conversation-local-storage-D5Tre_GA.js";import{t as x}from"./v4-BygpdDmc.js";import{t as ne}from"./use-user-conversation-CQ5IwnZk.js";import{t as re}from"./conversation-state-store-DpgQaK_O.js";import{S as ie,_ as ae,a as S,b as oe,c as se,d as C,f as ce,g as w,h as le,i as T,l as ue,m as de,o as fe,p as pe,r as E,s as me,t as D,u as he,v as O,w as k,x as A,y as ge}from"./use-event-store-DSpvASbC.js";import{t as _e}from"./command-store-BUWgE-vZ.js";import{t as j}from"./browser-store-C5uQbbIi.js";import{t as M}from"./files-tab-store-CZAEwv3x.js";var N=e(t(),1),ve=(e,t)=>{let[n,r]=N.useState(!1),[i,a]=N.useState(null),[o,ee]=N.useState([]),[s,c]=N.useState(null),[l,u]=N.useState(!1),d=N.useRef(null),f=N.useRef(0),p=N.useRef(null),m=N.useRef(!0),h=N.useRef(new WeakSet),g=N.useRef(t);N.useEffect(()=>{g.current=t},[t]);let _=N.useCallback(()=>{let t=e;if(g.current?.queryParams){let n=Object.entries(g.current.queryParams).reduce((e,[t,n])=>(e[t]=String(n),e),{});t=`${e}?${new URLSearchParams(n).toString()}`}let n=new WebSocket(t);d.current=n,h.current.add(n),n.onopen=e=>{r(!0),c(null),u(!1),f.current=0,g.current?.onOpen?.(e)},n.onmessage=e=>{a(e.data),ee(t=>[...t,e.data]),g.current?.onMessage?.(e)},n.onclose=e=>{let t=h.current.has(n);r(!1),e.code!==1e3&&(c(Error(`WebSocket closed with code ${e.code}: ${e.reason||`Connection closed unexpectedly`}`)),t&&g.current?.onError?.(e)),g.current?.onClose?.(e);let i=g.current?.reconnect?.enabled??!1,a=g.current?.reconnect?.maxAttempts??1/0;i&&t&&m.current&&f.current<a?(u(!0),f.current+=1,p.current=setTimeout(()=>{_()},3e3)):u(!1)},n.onerror=e=>{r(!1),g.current?.onError?.(e)}},[e]);N.useEffect(()=>(m.current=!0,f.current=0,e&&e.trim()!==``&&_(),()=>{if(m.current=!1,p.current&&=(clearTimeout(p.current),null),d.current){let{readyState:e}=d.current;h.current.delete(d.current),(e===WebSocket.CONNECTING||e===WebSocket.OPEN)&&d.current.close(),d.current=null}}),[e,_]);let v=N.useCallback(e=>{d.current?.readyState===WebSocket.OPEN&&d.current.send(e)},[]),y=N.useCallback(()=>{m.current=!1,u(!1),p.current&&=(clearTimeout(p.current),null),d.current&&(h.current.delete(d.current),d.current.close())},[]),b=N.useCallback(()=>{if(m.current=!0,f.current=0,u(!0),c(null),p.current&&=(clearTimeout(p.current),null),d.current){let e=d.current;h.current.delete(e),d.current=null,(e.readyState===WebSocket.CONNECTING||e.readyState===WebSocket.OPEN)&&e.close()}_()},[_]);return{isConnected:n,lastMessage:i,messages:o,error:s,socket:d.current,sendMessage:v,isReconnecting:l,attemptCount:f.current,disconnect:y,reconnect:b}},ye=`Unable to connect to server`,P={errorMessage:null,errorType:null},be=v(e=>({...P,setErrorMessage:(t,n=`conversation`)=>e(()=>({errorMessage:t,errorType:n})),removeErrorMessage:()=>e(()=>({errorMessage:null,errorType:null})),clearConnectionError:()=>e(e=>e.errorType===`connection`?{errorMessage:null,errorType:null}:e)})),F=15e4,I={pendingMessages:[]},L=()=>`pending-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,xe=v((e,t)=>({...I,enqueuePendingMessage:n=>{let r=L(),i={id:r,conversationId:n.conversationId,text:n.text,content:n.content??n.text,status:`sending`,imageUrls:n.imageUrls??[],fileUrls:n.fileUrls??[],timestamp:n.timestamp??new Date().toISOString()};return e(e=>({pendingMessages:[...e.pendingMessages,i]})),setTimeout(()=>{t().pendingMessages.find(e=>e.id===r)?.status===`sending`&&t().markPendingMessageError(r,`Send timed out`)},F),r},markPendingMessageError:(t,n)=>e(e=>({pendingMessages:e.pendingMessages.map(e=>e.id===t?{...e,status:`error`,errorMessage:n}:e)})),markPendingMessageSending:t=>e(e=>({pendingMessages:e.pendingMessages.map(e=>e.id===t?{...e,status:`sending`,errorMessage:void 0}:e)})),removePendingMessage:t=>e(e=>({pendingMessages:e.pendingMessages.filter(e=>e.id!==t)})),consumeMatchingPendingMessage:(t,n)=>{let r=null;return e(e=>{let i=e.pendingMessages.map((e,t)=>({m:e,i:t})).filter(({m:e})=>e.status===`sending`&&e.conversationId===t);if(i.length===0)return e;let a=i.find(({m:e})=>e.content===n)??i[0];return r=a.m,{pendingMessages:[...e.pendingMessages.slice(0,a.i),...e.pendingMessages.slice(a.i+1)]}}),r},clearPendingMessages:()=>e(()=>({...I})),reassignPendingMessages:(t,n)=>e(e=>({pendingMessages:e.pendingMessages.map(e=>e.conversationId===t?{...e,conversationId:n}:e)}))})),R=new Set([`files`,`browser`,`vscode`,`terminal`,`planner`,`tasklist`]);function z(e){let t=b.getState();t.setSelectedTab(e),t.isRightPanelShown||(t.setHasRightPanelToggled(!0),t.setIsRightPanelShown(!0))}function B(e){return R.has(e)}function Se(e){switch(e.command){case`navigate_to_file`:case`show_preview`:z(`files`),e.path&&M.getState().setSelectedPath(e.path);return;case`open_tab`:e.tab&&B(e.tab)?z(e.tab):e.tab&&console.warn(`[canvas_ui] Ignoring open_tab with unknown tab: ${e.tab}`);return}}var V=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:[...e.entriesByConversation[t]??[],n]}}),H=v()(y(e=>({entriesByConversation:{},activeProfileByConversation:{},show:(t,n,r)=>e(e=>V(e,t,{id:x(),anchorEventId:n,profiles:r})),recordSwitch:(t,n,r)=>e(e=>({...V(e,t,{id:x(),anchorEventId:n,profiles:[],switchedTo:r}),activeProfileByConversation:{...e.activeProfileByConversation,[t]:r}})),clearActiveProfile:t=>e(e=>{if(!(t in e.activeProfileByConversation))return e;let n={...e.activeProfileByConversation};return delete n[t],{activeProfileByConversation:n}}),clear:t=>e(e=>{let n={...e.entriesByConversation};delete n[t];let r={...e.activeProfileByConversation};return delete r[t],{entriesByConversation:n,activeProfileByConversation:r}}),clearAll:()=>e({entriesByConversation:{},activeProfileByConversation:{}})}),{name:`ModelStore`})),Ce=(e,t,n)=>{let{action:r}=e;if((r.kind===`StrReplaceEditorAction`||r.kind===`FileEditorAction`||r.kind===`ExecuteBashAction`)&&n.invalidateQueries({queryKey:[`file_changes`,t]},{cancelRefetch:!1}),(r.kind===`StrReplaceEditorAction`||r.kind===`FileEditorAction`)&&r.path){let e=i(r.path);n.invalidateQueries({queryKey:[`file_diff`,t,e]})}e.tool_name===`SwitchLLMTool`&&(n.invalidateQueries({queryKey:[`user`,`conversation`,t]}),H.getState().clearActiveProfile(t))},U=class{static async respondToConfirmation(e,t,n,r){let i=l().backend;return i.kind===`cloud`?_({backend:i,method:`POST`,hostOverride:c(t),path:`/api/conversations/${e}/events/respond_to_confirmation`,body:n,authMode:`session-api-key`,sessionApiKey:r}):new h(u({conversationUrl:t,sessionApiKey:r})).respondToConfirmation(e,n)}static async getEventCount(e,t,n){let r=l().backend;return r.kind===`cloud`?_({backend:r,method:`GET`,hostOverride:c(t),path:`/api/conversations/${e}/events/count`,authMode:`session-api-key`,sessionApiKey:n}):new h(u({conversationUrl:t,sessionApiKey:n})).getEventCount(e)}static async searchEvents(e,t,n,r={}){let i=l().backend,a=r.limit??100;if(i.kind===`cloud`){let t=Math.min(a,100),n=!!(r.sortOrder||r.pageId||r.timestampGte||r.timestampLt),o=new URLSearchParams;o.set(`limit`,String(t)),r.sortOrder&&o.set(`sort_order`,r.sortOrder),r.pageId&&o.set(`page_id`,r.pageId),r.timestampGte&&o.set(`timestamp__gte`,r.timestampGte),r.timestampLt&&o.set(`timestamp__lt`,r.timestampLt);let ee=t=>_({backend:i,method:`GET`,path:`/api/v1/conversation/${e}/events/search?${t.toString()}`});try{let e=await ee(o);return{items:e?.items??[],next_page_id:e?.next_page_id??null}}catch(e){if(!n)throw e;return console.warn(`[EventService] Cloud backend doesn't support pagination filters. Falling back to initial load only. Server needs OpenHands/OpenHands#14399.`),{items:[],next_page_id:null}}}let o=await new m(f({conversationUrl:t,sessionApiKey:n}),e).search({limit:a,...r.pageId?{page_id:r.pageId}:{},...r.sortOrder?{sort_order:r.sortOrder}:{},...r.timestampGte?{timestamp__gte:r.timestampGte}:{},...r.timestampLt?{timestamp__lt:r.timestampLt}:{}});return{items:o?.items??[],next_page_id:o?.next_page_id??null}}};function W({message:e,source:t,metadata:n={},posthog:r}){if(!r)return;let i=Error(e);r.captureException(i,{error_source:t||`unknown`,...n})}var we=()=>a({mutationKey:[`read-conversation-file`],mutationFn:async({conversationId:e,filePath:t})=>g.readConversationFile(e,t)}),Te=v(e=>({cost:null,max_budget_per_task:null,usage:null,setMetrics:t=>e(t)})),Ee=e=>{let{data:t}=ne(e??null);return s({queryKey:[`conversation-history`,e,t?.conversation_url??null,t?.session_api_key??null],enabled:!!e&&!!t,queryFn:async()=>{if(!e)return{events:[],hasMore:!1,nextPageId:null};let n=await U.searchEvents(e,t?.conversation_url??null,t?.session_api_key??null,{limit:50,sortOrder:`TIMESTAMP_DESC`});if(!Array.isArray(n.items))throw Error(`Invalid conversation history response: expected page.items to be an array.`);return{events:[...n.items].reverse(),hasMore:!!n.next_page_id||n.items.length>=50,nextPageId:n.next_page_id??null}},staleTime:1/0,gcTime:1800*1e3})},G=e=>{if(C(e))return!1;if(T(e)){let t=e.action.kind;return!(!t||t===`ExecuteBashAction`&&e.source===`user`||t===`PlanningFileEditorAction`||t===`SwitchLLMAction`)}return O(e)?!(e.observation.kind===`SwitchLLMObservation`&&!e.observation.is_error):ae(e)||S(e)||w(e)||E(e)?!0:A(e)?e.content!==null||e.reasoning_content!==null:!1},K=e=>e.some(e=>e.source===`user`),De=()=>{let{uiEvents:e}=D.getState();for(let t=e.length-1;t>=0;--t){let n=e[t];if(G(n))return String(n.id)}return null};function Oe(e,t,n=De()){H.getState().recordSwitch(e,n,t)}var ke=o(),Ae=(0,N.createContext)(void 0);function je(e){return e.llm_message.content.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function q({children:e,conversationId:t,conversationUrl:i,sessionApiKey:a,subConversations:o,subConversationIds:s}){let[c,l]=(0,N.useState)(`CONNECTING`),[f,m]=(0,N.useState)(`CONNECTING`),g=N.useRef(!1),_=N.useRef(!1),v=p(),y=ee(),x=D(e=>e.addEvent),ne=D(e=>e.addEvents),ae=D(e=>e.clearEventsForConversation),{setErrorMessage:w,removeErrorMessage:E,clearConnectionError:O}=be(),A=xe(e=>e.consumeMatchingPendingMessage),{setExecutionStatus:M}=re(),{appendInput:P,appendOutput:F}=_e(),I=j(e=>e.reset),[L,R]=(0,N.useState)(!0),[z,B]=(0,N.useState)(null),{setPlanContent:V}=b(),{mutate:H}=we(),G=(0,N.useRef)(0),K=(0,N.useRef)(null),De=e=>e?.toUpperCase().endsWith(`PLAN.MD`)??!1,q=(0,N.useCallback)(()=>{O()},[O]),J=(0,N.useCallback)(e=>{if(e.value.usage_to_metrics?.agent){let t=e.value.usage_to_metrics.agent,n={cost:t.accumulated_cost,max_budget_per_task:t.max_budget_per_task??null,usage:t.accumulated_token_usage?{prompt_tokens:t.accumulated_token_usage.prompt_tokens,completion_tokens:t.accumulated_token_usage.completion_tokens,cache_read_tokens:t.accumulated_token_usage.cache_read_tokens,cache_write_tokens:t.accumulated_token_usage.cache_write_tokens,context_window:t.accumulated_token_usage.context_window,per_turn_token:t.accumulated_token_usage.per_turn_token}:null};Te.getState().setMetrics(n)}},[]),{data:Y,isPending:X,isError:Me}=Ee(t),Ne=!!t&&X;(0,N.useLayoutEffect)(()=>{let e=t??null;D.getState().loadedConversationId!==e&&(ae(e),I())},[t,ae,I]),(0,N.useLayoutEffect)(()=>{if(!(!Y||Y.events.length===0)&&(ne(Y.events),t))for(let e of Y.events)k(e)&&A(t,je(e))},[Y,ne,t,A]);let Pe=(0,N.useMemo)(()=>{if(X)return null;let e=Y?.events??[],t=e[e.length-1];return!t||!(`timestamp`in t)||!t.timestamp?null:t.timestamp},[Y,X]),Fe=(0,N.useMemo)(()=>!t||!i||X&&!Me?null:d(t,i),[t,i,X,Me]),Z=(0,N.useMemo)(()=>{if(!o?.length)return null;let e=o[0];return!e?.id||!e.conversation_url?null:d(e.id,e.conversation_url)},[o]),Ie=(0,N.useMemo)(()=>Z?c===`CONNECTING`||f===`CONNECTING`?`CONNECTING`:c===`OPEN`&&f===`OPEN`?`OPEN`:c===`CLOSED`&&f===`CLOSED`?`CLOSED`:c===`CLOSING`||f===`CLOSING`?`CLOSING`:`CLOSED`:c,[c,f,Z]);(0,N.useEffect)(()=>{z!==null&&G.current>=z&&L&&R(!1)},[z,L,G]),(0,N.useEffect)(()=>{if(!L&&K.current){let{path:e,conversationId:t}=K.current;H({conversationId:t,filePath:e},{onSuccess:e=>{V(e)},onError:e=>{console.warn(`Failed to read conversation file:`,e)}}),K.current=null}},[L,H,V]),(0,N.useEffect)(()=>{g.current=!1,R(!!s?.length),B(null),G.current=0,K.current=null},[s]),(0,N.useEffect)(()=>{g.current=!1,_.current=!1,K.current=null},[t]);let Le=(0,N.useMemo)(()=>Ne||L,[Ne,L]),Re=(0,N.useCallback)(e=>{try{let i=JSON.parse(e.data);if(fe(i)){let e=!D.getState().eventIds.has(i.id)&&ie(i)?i:null;if(x(i),ce(i)){let e=i;W({message:e.detail,source:`conversation`,metadata:{eventId:e.id,errorCode:e.code},posthog:v}),w(e.detail)}else q();if(S(i)&&W({message:i.error,source:`agent`,metadata:{eventId:i.id,toolName:i.tool_name,toolCallId:i.tool_call_id},posthog:v}),k(i)&&t&&(A(t,je(i)),te(t,{draftMessage:null})),T(i)&&Ce(i,t||`test-conversation-id`,y),C(i)&&(le(i)&&M(i.value.execution_status),me(i)&&M(i.value),oe(i)&&J(i)),pe(i)&&P(i.action.command),de(i)&&F(i.observation.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
2
+ `)),ue(i)){let{screenshot_data:e}=i.observation;if(e){let t=e.startsWith(`data:`)?e:`data:image/png;base64,${e}`;j.getState().setScreenshotSrc(t)}}se(i)&&j.getState().setUrl(i.action.url),t&&e&&!e.observation.is_error&&(Oe(t,e.observation.profile_name),e.observation.active_model&&r(y,t,e.observation.active_model),n(y,t)),he(i)&&Se(i.action)}}catch(e){console.warn(`Failed to parse WebSocket message as JSON:`,e)}},[x,w,A,y,t,M,P,F,J,q,v]),ze=(0,N.useCallback)(e=>{try{let n=JSON.parse(e.data);if(L&&(G.current+=1,z!==null&&G.current>=z&&R(!1)),fe(n)){if(x({...n,isFromPlanningAgent:!0}),ce(n)){let e=n;W({message:e.detail,source:`planning_conversation`,metadata:{eventId:e.id,errorCode:e.code},posthog:v}),w(e.detail)}else q();if(S(n)&&W({message:n.error,source:`planning_agent`,metadata:{eventId:n.id,toolName:n.tool_name,toolCallId:n.tool_call_id},posthog:v}),k(n)&&t&&(A(t,je(n)),te(t,{draftMessage:null})),T(n)&&Ce(n,o?.[0]?.id||`test-conversation-id`,y),C(n)&&(le(n)&&M(n.value.execution_status),me(n)&&M(n.value),oe(n)&&J(n)),pe(n)&&P(n.action.command),de(n)&&F(n.observation.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
3
+ `)),ge(n)){let{path:e}=n.observation;if(De(e)){let t=o?.[0]?.id;t&&e&&(L?K.current={path:e,conversationId:t}:H({conversationId:t,filePath:e},{onSuccess:e=>{V(e)},onError:e=>{console.warn(`Failed to read conversation file:`,e)}}))}}}}catch(e){console.warn(`Failed to parse WebSocket message as JSON:`,e)}},[x,L,z,w,A,y,o,t,M,P,F,H,V,J,q,v]),Be=(0,N.useMemo)(()=>{let e=Pe?{resend_mode:`since`,after_timestamp:Pe}:{resend_mode:`all`};return a&&(e.session_api_key=a),{queryParams:e,reconnect:{enabled:!0},onOpen:()=>{l(`OPEN`),g.current=!0,O()},onClose:()=>{l(`CLOSED`)},onError:()=>{l(`CLOSED`),g.current&&w(ye,`connection`)},onMessage:Re}},[Re,w,O,a,Pe]),Ve=(0,N.useMemo)(()=>{let e={resend_all:!0};a&&(e.session_api_key=a);let t=o?.[0];return{queryParams:e,reconnect:{enabled:!0},onOpen:async()=>{if(m(`OPEN`),_.current=!0,O(),t?.id&&t.conversation_url)try{let e=await U.getEventCount(t.id,t.conversation_url,t.session_api_key);B(e),e===0&&R(!1)}catch{R(!1)}},onClose:()=>{m(`CLOSED`)},onError:()=>{m(`CLOSED`),_.current&&w(ye,`connection`)},onMessage:ze}},[ze,w,O,a,o]),{socket:Q,reconnect:He}=ve(Fe||``,Be),{socket:$,reconnect:Ue}=ve(Z||``,Ve),We=(0,N.useCallback)(()=>{if(E(),b.getState().conversationMode===`plan`&&Z){Ue();return}He()},[Z,He,Ue,E]),Ge=(0,N.useCallback)(async e=>{let n=b.getState().conversationMode===`plan`?$:Q;if(n?.readyState!==WebSocket.OPEN){if(!t){let e=Error(`No conversation ID available`);throw w(e.message),e}try{return await new h(u()).sendEvent(t,{role:`user`,content:e.content},{run:!0}),{queued:!0}}catch(e){throw w(e instanceof Error?e.message:`Failed to queue message for delivery`),e}}try{return n.send(JSON.stringify({...e,run:!0})),{queued:!1}}catch(e){throw w(e instanceof Error?e.message:`Failed to send message`),e}},[Q,$,w,t]);(0,N.useEffect)(()=>{Q&&Fe&&(()=>{switch(Q.readyState){case WebSocket.CONNECTING:l(`CONNECTING`);break;case WebSocket.OPEN:l(`OPEN`);break;case WebSocket.CLOSING:l(`CLOSING`);break;case WebSocket.CLOSED:l(`CLOSED`);break;default:l(`CLOSED`);break}})()},[Q,Fe]),(0,N.useEffect)(()=>{$&&Z&&(()=>{switch($.readyState){case WebSocket.CONNECTING:m(`CONNECTING`);break;case WebSocket.OPEN:m(`OPEN`);break;case WebSocket.CLOSING:m(`CLOSING`);break;case WebSocket.CLOSED:m(`CLOSED`);break;default:m(`CLOSED`);break}})()},[$,Z]);let Ke=(0,N.useMemo)(()=>({connectionState:Ie,sendMessage:Ge,isLoadingHistory:Le,reconnect:We}),[Ie,Ge,Le,We]);return(0,ke.jsx)(Ae.Provider,{value:Ke,children:e})}var J=()=>(0,N.useContext)(Ae)||null;export{K as a,Te as c,xe as d,be as f,De as i,U as l,J as n,G as o,ye as p,Oe as r,Ee as s,q as t,H as u};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{I as n,L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{t as o}from"./useTranslation-CbJtty1g.js";import{t as s}from"./utils-CVcuFUYj.js";import{t as c}from"./use-is-authed-DrocXcet.js";import{t as l}from"./typography-U1gkzkXo.js";var u=e(t(),1),d=i(),f=r(function(){let{t:e}=o(`openhands`),[t]=n(),{data:r,isLoading:i}=c(),[f,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(!1),g=t.get(`user_code`),_=async e=>{try{h(!0),(await fetch(`/oauth/device/verify-authenticated`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:`user_code=${encodeURIComponent(e)}`,credentials:`include`})).ok?p({success:!0,messageKey:a.DEVICE$SUCCESS_MESSAGE}):p({success:!1,messageKey:a.DEVICE$ERROR_FAILED})}catch{p({success:!1,messageKey:a.DEVICE$ERROR_OCCURRED})}finally{h(!1)}};return f?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsx)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:s(`mb-4`,f.success?`text-green-600`:`text-red-600`),children:f.success?(0,d.jsx)(`svg`,{className:`w-12 h-12 mx-auto`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,d.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})}):(0,d.jsx)(`svg`,{className:`w-12 h-12 mx-auto`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,d.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})}),(0,d.jsx)(`h2`,{className:`text-xl font-medium mb-2`,children:f.success?e(a.DEVICE$SUCCESS_TITLE):e(a.DEVICE$ERROR_TITLE)}),(0,d.jsx)(`p`,{className:`text-muted-foreground mb-4`,children:e(f.messageKey)}),!f.success&&(0,d.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90`,children:e(a.DEVICE$TRY_AGAIN)})]})})}):m?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsx)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4`}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:e(a.DEVICE$PROCESSING)})]})})}):r&&g?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background p-4`,children:(0,d.jsx)(`div`,{className:`flex flex-col items-center gap-6 w-full max-w-md`,children:(0,d.jsxs)(`div`,{className:`flex-1 min-w-0 max-w-md w-full mx-auto p-6 bg-card rounded-2xl shadow-lg border border-[var(--oh-border-subtle)]`,children:[(0,d.jsx)(l,{className:`text-2xl mb-4 text-center`,children:e(a.DEVICE$AUTHORIZATION_REQUEST)}),(0,d.jsxs)(`div`,{className:`mb-6 p-4 bg-base rounded-lg border border-[var(--oh-border-subtle)]`,children:[(0,d.jsx)(`p`,{className:`text-xs text-[var(--oh-text-subtle)] mb-2 text-center uppercase tracking-wider`,children:e(a.DEVICE$CODE_LABEL)}),(0,d.jsx)(`p`,{className:`text-xl font-mono font-semibold text-center tracking-[0.3em]`,children:g})]}),(0,d.jsxs)(`div`,{className:`mb-6 p-4 bg-amber-950/50 border-l-2 border-amber-500 rounded-r-lg`,children:[(0,d.jsx)(`p`,{className:`text-sm font-medium text-amber-500 mb-1`,children:e(a.DEVICE$SECURITY_NOTICE)}),(0,d.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:e(a.DEVICE$SECURITY_WARNING)})]}),(0,d.jsx)(`p`,{className:`text-muted-foreground mb-6 text-center`,children:e(a.DEVICE$CONFIRM_PROMPT)}),(0,d.jsxs)(`div`,{className:`flex gap-3`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>window.close(),className:`flex-1 px-4 py-2 border border-[var(--oh-border)] rounded-md hover:bg-muted text-[var(--oh-text-tertiary)]`,children:e(a.DEVICE$CANCEL)}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>_(g),className:`flex-1 px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700`,children:e(a.DEVICE$AUTHORIZE)})]})]})})}):r&&!g?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg`,children:[(0,d.jsx)(l,{className:`text-2xl mb-4 text-center`,children:e(a.DEVICE$AUTHORIZATION_TITLE)}),(0,d.jsx)(`p`,{className:`text-muted-foreground mb-6 text-center`,children:e(a.DEVICE$ENTER_CODE_PROMPT)}),(0,d.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`user_code`);t&&r&&_(t)},children:[(0,d.jsxs)(`div`,{className:`mb-4`,children:[(0,d.jsx)(`label`,{htmlFor:`user_code`,className:`block text-sm font-medium mb-2`,children:e(a.DEVICE$CODE_INPUT_LABEL)}),(0,d.jsx)(`input`,{type:`text`,id:`user_code`,name:`user_code`,required:!0,className:`w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring`,placeholder:e(a.DEVICE$CODE_PLACEHOLDER)})]}),(0,d.jsx)(`button`,{type:`submit`,className:`w-full px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90`,children:e(a.DEVICE$CONTINUE)})]})]})}):i?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4`}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:e(a.DEVICE$PROCESSING)})]})}):(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg text-center`,children:[(0,d.jsx)(l,{className:`text-2xl mb-4`,children:e(a.DEVICE$AUTH_REQUIRED)}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:e(a.DEVICE$SIGN_IN_PROMPT)})]})})});export{f as default};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{I as n,L as r}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{t as o}from"./useTranslation-CbJtty1g.js";import{t as s}from"./utils-CVcuFUYj.js";import{t as c}from"./use-is-authed-fNsj-Adj.js";import{t as l}from"./typography-Cx7uw7z3.js";var u=e(t(),1),d=i(),f=r(function(){let{t:e}=o(`openhands`),[t]=n(),{data:r,isLoading:i}=c(),[f,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(!1),g=t.get(`user_code`),_=async e=>{try{h(!0),(await fetch(`/oauth/device/verify-authenticated`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:`user_code=${encodeURIComponent(e)}`,credentials:`include`})).ok?p({success:!0,messageKey:a.DEVICE$SUCCESS_MESSAGE}):p({success:!1,messageKey:a.DEVICE$ERROR_FAILED})}catch{p({success:!1,messageKey:a.DEVICE$ERROR_OCCURRED})}finally{h(!1)}};return f?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsx)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:s(`mb-4`,f.success?`text-green-600`:`text-red-600`),children:f.success?(0,d.jsx)(`svg`,{className:`w-12 h-12 mx-auto`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,d.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})}):(0,d.jsx)(`svg`,{className:`w-12 h-12 mx-auto`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,d.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})}),(0,d.jsx)(`h2`,{className:`text-xl font-medium mb-2`,children:f.success?e(a.DEVICE$SUCCESS_TITLE):e(a.DEVICE$ERROR_TITLE)}),(0,d.jsx)(`p`,{className:`text-muted-foreground mb-4`,children:e(f.messageKey)}),!f.success&&(0,d.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90`,children:e(a.DEVICE$TRY_AGAIN)})]})})}):m?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsx)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4`}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:e(a.DEVICE$PROCESSING)})]})})}):r&&g?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background p-4`,children:(0,d.jsx)(`div`,{className:`flex flex-col items-center gap-6 w-full max-w-md`,children:(0,d.jsxs)(`div`,{className:`flex-1 min-w-0 max-w-md w-full mx-auto p-6 bg-card rounded-2xl shadow-lg border border-[var(--oh-border-subtle)]`,children:[(0,d.jsx)(l,{className:`text-2xl mb-4 text-center`,children:e(a.DEVICE$AUTHORIZATION_REQUEST)}),(0,d.jsxs)(`div`,{className:`mb-6 p-4 bg-base rounded-lg border border-[var(--oh-border-subtle)]`,children:[(0,d.jsx)(`p`,{className:`text-xs text-[var(--oh-text-subtle)] mb-2 text-center uppercase tracking-wider`,children:e(a.DEVICE$CODE_LABEL)}),(0,d.jsx)(`p`,{className:`text-xl font-mono font-semibold text-center tracking-[0.3em]`,children:g})]}),(0,d.jsxs)(`div`,{className:`mb-6 p-4 bg-amber-950/50 border-l-2 border-amber-500 rounded-r-lg`,children:[(0,d.jsx)(`p`,{className:`text-sm font-medium text-amber-500 mb-1`,children:e(a.DEVICE$SECURITY_NOTICE)}),(0,d.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:e(a.DEVICE$SECURITY_WARNING)})]}),(0,d.jsx)(`p`,{className:`text-muted-foreground mb-6 text-center`,children:e(a.DEVICE$CONFIRM_PROMPT)}),(0,d.jsxs)(`div`,{className:`flex gap-3`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>window.close(),className:`flex-1 px-4 py-2 border border-[var(--oh-border)] rounded-md hover:bg-muted text-[var(--oh-text-tertiary)]`,children:e(a.DEVICE$CANCEL)}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>_(g),className:`flex-1 px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700`,children:e(a.DEVICE$AUTHORIZE)})]})]})})}):r&&!g?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg`,children:[(0,d.jsx)(l,{className:`text-2xl mb-4 text-center`,children:e(a.DEVICE$AUTHORIZATION_TITLE)}),(0,d.jsx)(`p`,{className:`text-muted-foreground mb-6 text-center`,children:e(a.DEVICE$ENTER_CODE_PROMPT)}),(0,d.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`user_code`);t&&r&&_(t)},children:[(0,d.jsxs)(`div`,{className:`mb-4`,children:[(0,d.jsx)(`label`,{htmlFor:`user_code`,className:`block text-sm font-medium mb-2`,children:e(a.DEVICE$CODE_INPUT_LABEL)}),(0,d.jsx)(`input`,{type:`text`,id:`user_code`,name:`user_code`,required:!0,className:`w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring`,placeholder:e(a.DEVICE$CODE_PLACEHOLDER)})]}),(0,d.jsx)(`button`,{type:`submit`,className:`w-full px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90`,children:e(a.DEVICE$CONTINUE)})]})]})}):i?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4`}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:e(a.DEVICE$PROCESSING)})]})}):(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg text-center`,children:[(0,d.jsx)(l,{className:`text-2xl mb-4`,children:e(a.DEVICE$AUTH_REQUIRED)}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:e(a.DEVICE$SIGN_IN_PROMPT)})]})})});export{f as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./react-dom-hVBnwgwZ.js";import{t as r}from"./useMutation-7hG0GuPx.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{n as o}from"./QueryClientProvider-7oLZ1RtQ.js";import{t as s}from"./useQuery-JDs8UaWj.js";import{t as c}from"./useTranslation-CbJtty1g.js";import{n as l,r as u}from"./custom-toast-handlers-fgD4IYsu.js";import{t as d}from"./utils-CVcuFUYj.js";import{c as f,t as p,u as m}from"./agent-server-client-options-Dvgeb3x4.js";import{n as h}from"./active-backend-context-CQTk4wD8.js";import{r as g}from"./modal-classes-9XTtWCtF.js";import{c as ee,d as _,t as v}from"./brand-button-BoiPxAGm.js";import{r as y,u as b}from"./dropdown-classes-lT1LUsbO.js";import{n as te,r as ne}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~e9ykmtgh-DMH1jSwL.js";import{t as re}from"./proxy-wIasY2Po.js";import{t as ie}from"./settings-input-CPr7vX81.js";import{n as ae,t as x}from"./context-menu-list-item-DhG1Ln5m.js";import{t as S}from"./settings-dropdown-input-BD7ziSoR.js";import{t as C}from"./x-mark-CmcVOTk2.js";import{t as w}from"./automation-LZB0MjdV.js";var T=`/api/automation`,E=ne.create();E.interceptors.request.use(e=>{let t=m();if(!t)throw new p;e.baseURL||=t.host;let n=t.apiKey?.trim();return n&&e.headers.set(`X-Session-API-Key`,n),e});function D(e,t){let n=new URLSearchParams;return n.set(`limit`,String(e)),n.set(`offset`,String(t)),n.toString()}function O(e){return re({...e,forceProxy:!0})}var k=class e{static async listAutomations(e={}){let{limit:t=50,offset:n=0}=e,r=f().backend;if(r.kind===`cloud`)return O({backend:r,method:`GET`,path:`${T}/v1?${D(t,n)}`});let{data:i}=await E.get(`${T}/v1`,{params:{limit:t,offset:n}});return i}static async getAutomations(t=50,n=0){return e.listAutomations({limit:t,offset:n})}static async getAutomation(e){let t=f().backend,n=`${T}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`)return O({backend:t,method:`GET`,path:n});let{data:r}=await E.get(n);return r}static async updateAutomation(e,t){let n=f().backend,r=`${T}/v1/${encodeURIComponent(e)}`;if(n.kind===`cloud`)return O({backend:n,method:`PATCH`,path:r,body:t});let{data:i}=await E.patch(r,t);return i}static async deleteAutomation(e){let t=f().backend,n=`${T}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`){await O({backend:t,method:`DELETE`,path:n});return}await E.delete(n)}static async dispatchAutomation(e){let t=f().backend,n=`${T}/v1/${encodeURIComponent(e)}/dispatch`;if(t.kind===`cloud`)return O({backend:t,method:`POST`,path:n});let{data:r}=await E.post(n);return r}static async listAutomationRuns(e,t={}){let{limit:n=50,offset:r=0}=t,i=f().backend,a=`${T}/v1/${encodeURIComponent(e)}/runs`;if(i.kind===`cloud`)return O({backend:i,method:`GET`,path:`${a}?${D(n,r)}`});let{data:o}=await E.get(a,{params:{limit:n,offset:r}});return o}static async getAutomationRuns(t,n=50,r=0){return e.listAutomationRuns(t,{limit:n,offset:r})}static async toggleAutomation(t,n){return e.updateAutomation(t,{enabled:n})}static async downloadTarball(e,t){let n=f().backend,r=`${T}/v1/${encodeURIComponent(e)}/tarball`,i;if(n.kind===`cloud`)i=await O({backend:n,method:`GET`,path:r,responseType:`blob`});else{let{data:e}=await E.get(r,{responseType:`blob`});i=e}let a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`${t}.tar`,o.click(),URL.revokeObjectURL(a)}static async checkHealth(){let e=f().backend,t=`${T}/health`;try{if(e.kind===`cloud`)return await O({backend:e,method:`GET`,path:t,timeoutSeconds:5});let{data:n}=await E.get(t,{timeout:5e3});return n}catch{return{status:`error`}}}},A=e(t()),oe=e(n(),1),j=i(),M=[`automation-detail`],N=[`automation-runs`];function P(e){let{id:t,enabled:n=!0}=e,r=h();return s({queryKey:[...M,t,r.backend.id,r.orgId],queryFn:()=>k.getAutomation(t),staleTime:300*1e3,enabled:!!t&&n})}function F(e){let{id:t,limit:n=20,offset:r=0,enabled:i=!0}=e,a=h();return s({queryKey:[...N,t,{limit:n,offset:r},a.backend.id,a.orgId],queryFn:()=>k.getAutomationRuns(t,n,r),staleTime:60*1e3,enabled:!!t&&i,refetchInterval:e=>{let t=e.state.data;return t&&t.runs.some(e=>e.status===w.PENDING||e.status===w.RUNNING)?3e3:!1}})}var I=[`automations`];function L(e={}){let{limit:t=50,offset:n=0,enabled:r=!0}=e,i=h();return s({queryKey:[...I,{limit:t,offset:n},i.backend.id,i.orgId],queryFn:()=>k.getAutomations(t,n),staleTime:0,enabled:r})}function R(){let e=o();return r({mutationFn:({id:e,enabled:t})=>k.toggleAutomation(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:M})}})}function z(){let e=o();return r({mutationFn:({id:e,body:t})=>k.updateAutomation(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:M})}})}function B(){let e=o();return r({mutationFn:e=>k.deleteAutomation(e),onSuccess:()=>{e.invalidateQueries({queryKey:I})}})}function V(){let e=o();return r({mutationFn:e=>k.dispatchAutomation(e),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:M}),e.invalidateQueries({queryKey:[...N,n]})}})}var H=[`automation-health`];function U(){let e=h();return s({queryKey:[...H,e.backend.id,e.orgId],queryFn:()=>k.checkHealth(),staleTime:30*1e3,retry:!1})}var W=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,viewBox:`0 0 20 20`,...e,children:(0,j.jsx)(`path`,{d:`M10 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4z`})}),G=d(`inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,y),K=d(`inline-flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-md border-0 bg-transparent px-2 text-xs text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,y);function q({icon:e,label:t}){return(0,j.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,j.jsx)(`span`,{className:d(`[&_svg]:size-4`,b),"aria-hidden":!0,children:e}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t})]})}function se({items:e}){let{t}=c(`openhands`),[n,r]=(0,A.useState)(!1),[i,o]=(0,A.useState)(),s=(0,A.useRef)(null),l=(0,A.useRef)(null);(0,A.useLayoutEffect)(()=>{if(!n||!s.current)return;let e=()=>{let e=s.current?.getBoundingClientRect();e&&o({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[n]),(0,A.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;s.current?.contains(t)||l.current?.contains(t)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let u=n&&i?(0,j.jsx)(ae,{ref:l,theme:`popover`,className:`min-w-[10rem]`,children:e.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsx)(x,{onClick:t=>{t.stopPropagation(),e.onClick(),r(!1)},isDisabled:e.disabled,className:`group`,children:(0,j.jsx)(q,{icon:e.icon,label:e.label})})},e.label))}):null;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{ref:s,type:`button`,onClick:e=>{e.stopPropagation(),r(e=>!e)},className:G,"aria-label":t(a.AUTOMATIONS$ACTIONS_MENU),"aria-expanded":n,"aria-haspopup":`menu`,children:(0,j.jsx)(W,{className:`size-4`})}),n&&i&&typeof document<`u`?oe.createPortal((0,j.jsx)(`div`,{style:i,children:u}),document.body):null]})}function ce(e){return!0}var le=e=>(0,j.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,j.jsx)(`g`,{clipPath:`url(#clip0_8467_30872)`,children:(0,j.jsx)(`path`,{d:`M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z`,fill:`currentColor`,stroke:`currentColor`})}),(0,j.jsx)(`defs`,{children:(0,j.jsx)(`clipPath`,{id:`clip0_8467_30872`,children:(0,j.jsx)(`rect`,{width:24,height:24,fill:`white`})})})]}),ue=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})}),de=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z`})}),fe=/^(\d+)$/;function J(e,t,n){let r=e.match(fe);if(!r)return null;let i=Number(r[1]);return Number.isNaN(i)||i<t||i>n?null:i}function pe(e){let t=(e??``).trim();if(!t)return{kind:`custom`,raw:``};let n=t.split(/\s+/);if(n.length!==5)return{kind:`custom`,raw:t};let[r,i,a,o,s]=n,c=J(r,0,59),l=J(i,0,23);if(c===null||l===null)return{kind:`custom`,raw:t};if(a!==`*`||o!==`*`)return{kind:`custom`,raw:t,hour:l,minute:c};if(s===`*`||s===`0-6`)return{kind:`daily`,hour:l,minute:c};if(s===`1-5`)return{kind:`weekdays`,hour:l,minute:c};let u=J(s,0,6);return u===null?{kind:`custom`,raw:t,hour:l,minute:c}:{kind:`weekly`,hour:l,minute:c,weekday:u}}function me(e){let{kind:t,hour:n,minute:r,weekday:i}=e;switch(t){case`daily`:return`${r} ${n} * * *`;case`weekdays`:return`${r} ${n} * * 1-5`;case`weekly`:return`${r} ${n} * * ${i??1}`;default:return t}}function Y(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function X(e){let t=e.match(/^(\d{1,2}):(\d{2})$/);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return Number.isNaN(n)||Number.isNaN(r)||n<0||n>23||r<0||r>59?null:{hour:n,minute:r}}function Z(e){return e?Array.isArray(e)?e.join(`, `):e:`—`}var he=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5.636 5.636a9 9 0 1012.728 0M12 3v9`})}),Q=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})}),$=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z`})});function ge({onRetry:e}){let{t}=c(`openhands`);return(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,j.jsx)($,{className:`size-12 text-danger`}),(0,j.jsx)(`p`,{className:`mt-4 text-sm text-muted`,children:t(a.AUTOMATIONS$ERROR_TITLE)}),(0,j.jsx)(`button`,{type:`button`,onClick:e,className:`mt-4 rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:t(a.AUTOMATIONS$ERROR_RETRY)})]})}function _e({onRetry:e}){let{t}=c(`openhands`);return(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 px-4`,children:[(0,j.jsx)($,{className:`size-12 text-[var(--oh-warning)]`}),(0,j.jsx)(`h2`,{className:`mt-4 text-lg font-medium text-content`,children:t(a.AUTOMATIONS$BACKEND_UNAVAILABLE_TITLE)}),(0,j.jsx)(`p`,{className:`mt-2 text-sm text-muted text-center max-w-md`,children:t(a.AUTOMATIONS$BACKEND_UNAVAILABLE_MESSAGE)}),(0,j.jsx)(v,{type:`button`,variant:`secondary`,className:`mt-6`,onClick:e,children:t(a.AUTOMATIONS$BACKEND_UNAVAILABLE_RETRY)})]})}function ve({automationName:e,isOpen:t,onConfirm:n,onCancel:r}){let{t:i}=c(`openhands`);return t?(0,j.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,j.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":`Close`,children:(0,j.jsx)(C,{className:`size-5`})}),(0,j.jsx)(`h2`,{className:g,children:i(a.AUTOMATIONS$DELETE_CONFIRM_TITLE)}),(0,j.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:i(a.AUTOMATIONS$DELETE_CONFIRM_MESSAGE,{name:e})}),(0,j.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:i(a.AUTOMATIONS$CANCEL)}),(0,j.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg bg-danger px-4 py-2 text-sm text-white hover:bg-danger/80`,children:i(a.AUTOMATIONS$DELETE)})]})]})]}):null}var ye=[a.AUTOMATIONS$WEEKDAY_SUN,a.AUTOMATIONS$WEEKDAY_MON,a.AUTOMATIONS$WEEKDAY_TUE,a.AUTOMATIONS$WEEKDAY_WED,a.AUTOMATIONS$WEEKDAY_THU,a.AUTOMATIONS$WEEKDAY_FRI,a.AUTOMATIONS$WEEKDAY_SAT];function be(e){if(e.trigger.type===`event`)return{name:e.name,prompt:e.prompt??``,frequency:`custom`,weekday:1,timeOfDay:``,isCustomSchedule:!0,rawSchedule:``};let t=pe(e.trigger.schedule);return t.kind===`custom`?{name:e.name,prompt:e.prompt??``,frequency:`custom`,weekday:1,timeOfDay:t.hour!==void 0&&t.minute!==void 0?Y(t.hour,t.minute):``,isCustomSchedule:!0,rawSchedule:t.raw}:{name:e.name,prompt:e.prompt??``,frequency:t.kind,weekday:t.kind===`weekly`?t.weekday??1:1,timeOfDay:Y(t.hour,t.minute),isCustomSchedule:!1,rawSchedule:e.trigger.schedule??``}}function xe({automation:e,isOpen:t,onClose:n}){let{t:r}=c(`openhands`),i=z(),o=(0,A.useMemo)(()=>be(e),[e]),[s,f]=(0,A.useState)(o),[p,m]=(0,A.useState)(null);if((0,A.useEffect)(()=>{t&&(f(o),m(null))},[t,o]),!t)return null;let h=[{key:`daily`,label:r(a.AUTOMATIONS$FREQUENCY_DAILY)},{key:`weekdays`,label:r(a.AUTOMATIONS$FREQUENCY_WEEKDAYS)},{key:`weekly`,label:r(a.AUTOMATIONS$FREQUENCY_WEEKLY)},...s.isCustomSchedule?[{key:`custom`,label:r(a.AUTOMATIONS$FREQUENCY_CUSTOM)}]:[]],y=ye.map((e,t)=>({key:String(t),label:r(e)})),b=!s.isCustomSchedule||X(s.timeOfDay)!==null||s.timeOfDay===``;return(0,j.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`presentation`}),(0,j.jsxs)(`div`,{className:`relative w-full max-w-md rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:n,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":r(a.AUTOMATIONS$CANCEL),children:(0,j.jsx)(C,{className:`size-5`})}),(0,j.jsx)(`h2`,{className:g,children:r(a.AUTOMATIONS$EDIT_TITLE)}),(0,j.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let o=s.name.trim();if(!o){m(r(a.AUTOMATIONS$NAME_REQUIRED));return}m(null);let c={};o!==e.name&&(c.name=o);let d=s.prompt.trim();if(d!==(e.prompt??``).trim()&&(c.prompt=d.length===0?null:d),!s.isCustomSchedule&&s.frequency!==`custom`){let t=X(s.timeOfDay);if(t){let n=me({kind:s.frequency,hour:t.hour,minute:t.minute,weekday:s.frequency===`weekly`?s.weekday:void 0});n!==e.trigger.schedule&&(c.trigger={...e.trigger,schedule:n})}}if(Object.keys(c).length===0){n();return}i.mutate({id:e.id,body:c},{onSuccess:()=>{u(r(a.AUTOMATIONS$EDIT_SUCCESS)),n()},onError:e=>{l(te(e)?e.response?.data?.message||e.message||r(a.AUTOMATIONS$EDIT_ERROR):e.message||r(a.AUTOMATIONS$EDIT_ERROR))}})},className:`mt-4 flex flex-col gap-4`,"aria-label":r(a.AUTOMATIONS$EDIT_TITLE),children:[(0,j.jsx)(ie,{testId:`edit-automation-name`,name:`name`,type:`text`,label:r(a.AUTOMATIONS$NAME),value:s.name,onChange:e=>f(t=>({...t,name:e})),error:p??void 0,showRequiredTag:!0}),(0,j.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,j.jsx)(`span`,{className:`text-sm`,children:r(a.AUTOMATIONS$PROMPT)}),(0,j.jsx)(`textarea`,{"data-testid":`edit-automation-prompt`,name:`prompt`,value:s.prompt,onChange:e=>f(t=>({...t,prompt:e.target.value})),rows:4,className:d(ee,`placeholder:italic`)}),(0,j.jsx)(`span`,{className:`text-xs text-muted`,children:r(a.AUTOMATIONS$EDIT_PROMPT_HINT)})]}),e.trigger.type===`event`?(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg bg-[var(--oh-surface-raised)] p-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(a.AUTOMATIONS$DETAIL$TRIGGER)}),(0,j.jsx)(`span`,{className:`text-sm text-content`,children:r(a.AUTOMATIONS$DETAIL$TRIGGER_EVENT)})]}),e.trigger.source&&(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(a.AUTOMATIONS$DETAIL$EVENT_SOURCE)}),(0,j.jsx)(`span`,{className:`text-sm text-content`,children:e.trigger.source})]}),e.trigger.on&&(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(a.AUTOMATIONS$DETAIL$EVENT_TYPE)}),(0,j.jsx)(`code`,{className:`text-xs font-mono text-content`,children:Z(e.trigger.on)})]}),e.trigger.filter&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(a.AUTOMATIONS$DETAIL$EVENT_FILTER)}),(0,j.jsx)(`code`,{className:`text-xs font-mono text-content break-all`,children:e.trigger.filter})]})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(S,{testId:`edit-automation-frequency`,name:`frequency`,label:r(a.AUTOMATIONS$FREQUENCY),items:h,selectedKey:s.frequency,isDisabled:s.isCustomSchedule,onSelectionChange:e=>{!e||s.isCustomSchedule||f(t=>({...t,frequency:e}))}}),s.frequency===`weekly`&&!s.isCustomSchedule&&(0,j.jsx)(S,{testId:`edit-automation-weekday`,name:`weekday`,label:r(a.AUTOMATIONS$WEEKDAY),items:y,selectedKey:String(s.weekday),onSelectionChange:e=>{e!==null&&f(t=>({...t,weekday:Number(e)}))}}),(0,j.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,j.jsx)(`span`,{className:`text-sm`,children:r(a.AUTOMATIONS$TIME_OF_DAY)}),(0,j.jsx)(`input`,{"data-testid":`edit-automation-time`,name:`timeOfDay`,type:`time`,value:s.timeOfDay,onChange:e=>f(t=>({...t,timeOfDay:e.target.value})),disabled:s.isCustomSchedule&&!b,className:d(_,`disabled:bg-[var(--oh-surface-raised)]`)}),e.timezone&&(0,j.jsxs)(`span`,{className:`text-xs text-muted`,children:[r(a.AUTOMATIONS$TIMEZONE),`: `,e.timezone]})]}),s.isCustomSchedule&&(0,j.jsxs)(`p`,{className:`text-xs text-muted`,"data-testid":`custom-schedule-hint`,children:[r(a.AUTOMATIONS$CUSTOM_SCHEDULE_HINT),s.rawSchedule&&(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`code`,{className:`text-xs text-content`,children:s.rawSchedule})]})]})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex justify-end gap-3`,children:[(0,j.jsx)(v,{testId:`edit-automation-cancel`,type:`button`,variant:`secondary`,onClick:n,isDisabled:i.isPending,children:r(a.AUTOMATIONS$CANCEL)}),(0,j.jsx)(v,{testId:`edit-automation-save`,type:`submit`,variant:`primary`,isDisabled:i.isPending,"aria-busy":i.isPending,children:i.isPending?r(a.AUTOMATIONS$SAVING):r(a.AUTOMATIONS$SAVE)})]})]})]})]})}export{k as C,F as S,L as _,$ as a,R as b,Z as c,le as d,ce as f,U as g,K as h,ge as i,de as l,G as m,ve as n,Q as o,se as p,_e as r,he as s,xe as t,ue as u,B as v,P as x,V as y};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./react-dom-hVBnwgwZ.js";import{t as r}from"./useMutation-7hG0GuPx.js";import{o as i,t as a}from"./declaration-IA661TBv.js";import{n as o}from"./QueryClientProvider-7oLZ1RtQ.js";import{t as s}from"./useQuery-JDs8UaWj.js";import{t as c}from"./useTranslation-CbJtty1g.js";import{n as l,r as u}from"./custom-toast-handlers-fgD4IYsu.js";import{t as d}from"./utils-CVcuFUYj.js";import{c as f,t as p,u as m}from"./agent-server-client-options-Dvgeb3x4.js";import{n as h}from"./active-backend-context-CQTk4wD8.js";import{r as g}from"./modal-classes-9XTtWCtF.js";import{c as ee,d as _,t as v}from"./brand-button-BoiPxAGm.js";import{r as y,u as b}from"./dropdown-classes-lT1LUsbO.js";import{n as te,r as ne}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~e9ykmtgh-DMH1jSwL.js";import{t as re}from"./proxy-wIasY2Po.js";import{t as ie}from"./settings-input-DsoZj8Dm.js";import{n as ae,t as x}from"./context-menu-list-item-CHWCx1Mc.js";import{t as S}from"./settings-dropdown-input-BUk4m23x.js";import{t as C}from"./x-mark-Cn-YJVbN.js";import{t as w}from"./automation-BzmydDjr.js";var T=`/api/automation`,E=ne.create();E.interceptors.request.use(e=>{let t=m();if(!t)throw new p;e.baseURL||=t.host;let n=t.apiKey?.trim();return n&&e.headers.set(`X-Session-API-Key`,n),e});function D(e,t){let n=new URLSearchParams;return n.set(`limit`,String(e)),n.set(`offset`,String(t)),n.toString()}function O(e){return re({...e,forceProxy:!0})}var k=class e{static async listAutomations(e={}){let{limit:t=50,offset:n=0}=e,r=f().backend;if(r.kind===`cloud`)return O({backend:r,method:`GET`,path:`${T}/v1?${D(t,n)}`});let{data:i}=await E.get(`${T}/v1`,{params:{limit:t,offset:n}});return i}static async getAutomations(t=50,n=0){return e.listAutomations({limit:t,offset:n})}static async getAutomation(e){let t=f().backend,n=`${T}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`)return O({backend:t,method:`GET`,path:n});let{data:r}=await E.get(n);return r}static async updateAutomation(e,t){let n=f().backend,r=`${T}/v1/${encodeURIComponent(e)}`;if(n.kind===`cloud`)return O({backend:n,method:`PATCH`,path:r,body:t});let{data:i}=await E.patch(r,t);return i}static async deleteAutomation(e){let t=f().backend,n=`${T}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`){await O({backend:t,method:`DELETE`,path:n});return}await E.delete(n)}static async dispatchAutomation(e){let t=f().backend,n=`${T}/v1/${encodeURIComponent(e)}/dispatch`;if(t.kind===`cloud`)return O({backend:t,method:`POST`,path:n});let{data:r}=await E.post(n);return r}static async listAutomationRuns(e,t={}){let{limit:n=50,offset:r=0}=t,i=f().backend,a=`${T}/v1/${encodeURIComponent(e)}/runs`;if(i.kind===`cloud`)return O({backend:i,method:`GET`,path:`${a}?${D(n,r)}`});let{data:o}=await E.get(a,{params:{limit:n,offset:r}});return o}static async getAutomationRuns(t,n=50,r=0){return e.listAutomationRuns(t,{limit:n,offset:r})}static async toggleAutomation(t,n){return e.updateAutomation(t,{enabled:n})}static async downloadTarball(e,t){let n=f().backend,r=`${T}/v1/${encodeURIComponent(e)}/tarball`,i;if(n.kind===`cloud`)i=await O({backend:n,method:`GET`,path:r,responseType:`blob`});else{let{data:e}=await E.get(r,{responseType:`blob`});i=e}let a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`${t}.tar`,o.click(),URL.revokeObjectURL(a)}static async checkHealth(){let e=f().backend,t=`${T}/health`;try{if(e.kind===`cloud`)return await O({backend:e,method:`GET`,path:t,timeoutSeconds:5});let{data:n}=await E.get(t,{timeout:5e3});return n}catch{return{status:`error`}}}},A=e(t()),oe=e(n(),1),j=i(),M=[`automation-detail`],N=[`automation-runs`];function P(e){let{id:t,enabled:n=!0}=e,r=h();return s({queryKey:[...M,t,r.backend.id,r.orgId],queryFn:()=>k.getAutomation(t),staleTime:300*1e3,enabled:!!t&&n})}function F(e){let{id:t,limit:n=20,offset:r=0,enabled:i=!0}=e,a=h();return s({queryKey:[...N,t,{limit:n,offset:r},a.backend.id,a.orgId],queryFn:()=>k.getAutomationRuns(t,n,r),staleTime:60*1e3,enabled:!!t&&i,refetchInterval:e=>{let t=e.state.data;return t&&t.runs.some(e=>e.status===w.PENDING||e.status===w.RUNNING)?3e3:!1}})}var I=[`automations`];function L(e={}){let{limit:t=50,offset:n=0,enabled:r=!0}=e,i=h();return s({queryKey:[...I,{limit:t,offset:n},i.backend.id,i.orgId],queryFn:()=>k.getAutomations(t,n),staleTime:0,enabled:r})}function R(){let e=o();return r({mutationFn:({id:e,enabled:t})=>k.toggleAutomation(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:M})}})}function z(){let e=o();return r({mutationFn:({id:e,body:t})=>k.updateAutomation(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:M})}})}function B(){let e=o();return r({mutationFn:e=>k.deleteAutomation(e),onSuccess:()=>{e.invalidateQueries({queryKey:I})}})}function V(){let e=o();return r({mutationFn:e=>k.dispatchAutomation(e),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:I}),e.invalidateQueries({queryKey:M}),e.invalidateQueries({queryKey:[...N,n]})}})}var H=[`automation-health`];function U(){let e=h();return s({queryKey:[...H,e.backend.id,e.orgId],queryFn:()=>k.checkHealth(),staleTime:30*1e3,retry:!1})}var W=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,viewBox:`0 0 20 20`,...e,children:(0,j.jsx)(`path`,{d:`M10 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4z`})}),G=d(`inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,y),K=d(`inline-flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-md border-0 bg-transparent px-2 text-xs text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,y);function q({icon:e,label:t}){return(0,j.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,j.jsx)(`span`,{className:d(`[&_svg]:size-4`,b),"aria-hidden":!0,children:e}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t})]})}function se({items:e}){let{t}=c(`openhands`),[n,r]=(0,A.useState)(!1),[i,o]=(0,A.useState)(),s=(0,A.useRef)(null),l=(0,A.useRef)(null);(0,A.useLayoutEffect)(()=>{if(!n||!s.current)return;let e=()=>{let e=s.current?.getBoundingClientRect();e&&o({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[n]),(0,A.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;s.current?.contains(t)||l.current?.contains(t)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let u=n&&i?(0,j.jsx)(ae,{ref:l,theme:`popover`,className:`min-w-[10rem]`,children:e.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsx)(x,{onClick:t=>{t.stopPropagation(),e.onClick(),r(!1)},isDisabled:e.disabled,className:`group`,children:(0,j.jsx)(q,{icon:e.icon,label:e.label})})},e.label))}):null;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{ref:s,type:`button`,onClick:e=>{e.stopPropagation(),r(e=>!e)},className:G,"aria-label":t(a.AUTOMATIONS$ACTIONS_MENU),"aria-expanded":n,"aria-haspopup":`menu`,children:(0,j.jsx)(W,{className:`size-4`})}),n&&i&&typeof document<`u`?oe.createPortal((0,j.jsx)(`div`,{style:i,children:u}),document.body):null]})}function ce(e){return!0}var le=e=>(0,j.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,j.jsx)(`g`,{clipPath:`url(#clip0_8467_30872)`,children:(0,j.jsx)(`path`,{d:`M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z`,fill:`currentColor`,stroke:`currentColor`})}),(0,j.jsx)(`defs`,{children:(0,j.jsx)(`clipPath`,{id:`clip0_8467_30872`,children:(0,j.jsx)(`rect`,{width:24,height:24,fill:`white`})})})]}),ue=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})}),de=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z`})}),fe=/^(\d+)$/;function J(e,t,n){let r=e.match(fe);if(!r)return null;let i=Number(r[1]);return Number.isNaN(i)||i<t||i>n?null:i}function pe(e){let t=(e??``).trim();if(!t)return{kind:`custom`,raw:``};let n=t.split(/\s+/);if(n.length!==5)return{kind:`custom`,raw:t};let[r,i,a,o,s]=n,c=J(r,0,59),l=J(i,0,23);if(c===null||l===null)return{kind:`custom`,raw:t};if(a!==`*`||o!==`*`)return{kind:`custom`,raw:t,hour:l,minute:c};if(s===`*`||s===`0-6`)return{kind:`daily`,hour:l,minute:c};if(s===`1-5`)return{kind:`weekdays`,hour:l,minute:c};let u=J(s,0,6);return u===null?{kind:`custom`,raw:t,hour:l,minute:c}:{kind:`weekly`,hour:l,minute:c,weekday:u}}function me(e){let{kind:t,hour:n,minute:r,weekday:i}=e;switch(t){case`daily`:return`${r} ${n} * * *`;case`weekdays`:return`${r} ${n} * * 1-5`;case`weekly`:return`${r} ${n} * * ${i??1}`;default:return t}}function Y(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function X(e){let t=e.match(/^(\d{1,2}):(\d{2})$/);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return Number.isNaN(n)||Number.isNaN(r)||n<0||n>23||r<0||r>59?null:{hour:n,minute:r}}function Z(e){return e?Array.isArray(e)?e.join(`, `):e:`—`}var he=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5.636 5.636a9 9 0 1012.728 0M12 3v9`})}),Q=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})}),$=e=>(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,...e,children:(0,j.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z`})});function ge({onRetry:e}){let{t}=c(`openhands`);return(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,j.jsx)($,{className:`size-12 text-danger`}),(0,j.jsx)(`p`,{className:`mt-4 text-sm text-muted`,children:t(a.AUTOMATIONS$ERROR_TITLE)}),(0,j.jsx)(`button`,{type:`button`,onClick:e,className:`mt-4 rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:t(a.AUTOMATIONS$ERROR_RETRY)})]})}function _e({onRetry:e}){let{t}=c(`openhands`);return(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 px-4`,children:[(0,j.jsx)($,{className:`size-12 text-[var(--oh-warning)]`}),(0,j.jsx)(`h2`,{className:`mt-4 text-lg font-medium text-content`,children:t(a.AUTOMATIONS$BACKEND_UNAVAILABLE_TITLE)}),(0,j.jsx)(`p`,{className:`mt-2 text-sm text-muted text-center max-w-md`,children:t(a.AUTOMATIONS$BACKEND_UNAVAILABLE_MESSAGE)}),(0,j.jsx)(v,{type:`button`,variant:`secondary`,className:`mt-6`,onClick:e,children:t(a.AUTOMATIONS$BACKEND_UNAVAILABLE_RETRY)})]})}function ve({automationName:e,isOpen:t,onConfirm:n,onCancel:r}){let{t:i}=c(`openhands`);return t?(0,j.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,j.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":`Close`,children:(0,j.jsx)(C,{className:`size-5`})}),(0,j.jsx)(`h2`,{className:g,children:i(a.AUTOMATIONS$DELETE_CONFIRM_TITLE)}),(0,j.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:i(a.AUTOMATIONS$DELETE_CONFIRM_MESSAGE,{name:e})}),(0,j.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:i(a.AUTOMATIONS$CANCEL)}),(0,j.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg bg-danger px-4 py-2 text-sm text-white hover:bg-danger/80`,children:i(a.AUTOMATIONS$DELETE)})]})]})]}):null}var ye=[a.AUTOMATIONS$WEEKDAY_SUN,a.AUTOMATIONS$WEEKDAY_MON,a.AUTOMATIONS$WEEKDAY_TUE,a.AUTOMATIONS$WEEKDAY_WED,a.AUTOMATIONS$WEEKDAY_THU,a.AUTOMATIONS$WEEKDAY_FRI,a.AUTOMATIONS$WEEKDAY_SAT];function be(e){if(e.trigger.type===`event`)return{name:e.name,prompt:e.prompt??``,frequency:`custom`,weekday:1,timeOfDay:``,isCustomSchedule:!0,rawSchedule:``};let t=pe(e.trigger.schedule);return t.kind===`custom`?{name:e.name,prompt:e.prompt??``,frequency:`custom`,weekday:1,timeOfDay:t.hour!==void 0&&t.minute!==void 0?Y(t.hour,t.minute):``,isCustomSchedule:!0,rawSchedule:t.raw}:{name:e.name,prompt:e.prompt??``,frequency:t.kind,weekday:t.kind===`weekly`?t.weekday??1:1,timeOfDay:Y(t.hour,t.minute),isCustomSchedule:!1,rawSchedule:e.trigger.schedule??``}}function xe({automation:e,isOpen:t,onClose:n}){let{t:r}=c(`openhands`),i=z(),o=(0,A.useMemo)(()=>be(e),[e]),[s,f]=(0,A.useState)(o),[p,m]=(0,A.useState)(null);if((0,A.useEffect)(()=>{t&&(f(o),m(null))},[t,o]),!t)return null;let h=[{key:`daily`,label:r(a.AUTOMATIONS$FREQUENCY_DAILY)},{key:`weekdays`,label:r(a.AUTOMATIONS$FREQUENCY_WEEKDAYS)},{key:`weekly`,label:r(a.AUTOMATIONS$FREQUENCY_WEEKLY)},...s.isCustomSchedule?[{key:`custom`,label:r(a.AUTOMATIONS$FREQUENCY_CUSTOM)}]:[]],y=ye.map((e,t)=>({key:String(t),label:r(e)})),b=!s.isCustomSchedule||X(s.timeOfDay)!==null||s.timeOfDay===``;return(0,j.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`presentation`}),(0,j.jsxs)(`div`,{className:`relative w-full max-w-md rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:n,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":r(a.AUTOMATIONS$CANCEL),children:(0,j.jsx)(C,{className:`size-5`})}),(0,j.jsx)(`h2`,{className:g,children:r(a.AUTOMATIONS$EDIT_TITLE)}),(0,j.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let o=s.name.trim();if(!o){m(r(a.AUTOMATIONS$NAME_REQUIRED));return}m(null);let c={};o!==e.name&&(c.name=o);let d=s.prompt.trim();if(d!==(e.prompt??``).trim()&&(c.prompt=d.length===0?null:d),!s.isCustomSchedule&&s.frequency!==`custom`){let t=X(s.timeOfDay);if(t){let n=me({kind:s.frequency,hour:t.hour,minute:t.minute,weekday:s.frequency===`weekly`?s.weekday:void 0});n!==e.trigger.schedule&&(c.trigger={...e.trigger,schedule:n})}}if(Object.keys(c).length===0){n();return}i.mutate({id:e.id,body:c},{onSuccess:()=>{u(r(a.AUTOMATIONS$EDIT_SUCCESS)),n()},onError:e=>{l(te(e)?e.response?.data?.message||e.message||r(a.AUTOMATIONS$EDIT_ERROR):e.message||r(a.AUTOMATIONS$EDIT_ERROR))}})},className:`mt-4 flex flex-col gap-4`,"aria-label":r(a.AUTOMATIONS$EDIT_TITLE),children:[(0,j.jsx)(ie,{testId:`edit-automation-name`,name:`name`,type:`text`,label:r(a.AUTOMATIONS$NAME),value:s.name,onChange:e=>f(t=>({...t,name:e})),error:p??void 0,showRequiredTag:!0}),(0,j.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,j.jsx)(`span`,{className:`text-sm`,children:r(a.AUTOMATIONS$PROMPT)}),(0,j.jsx)(`textarea`,{"data-testid":`edit-automation-prompt`,name:`prompt`,value:s.prompt,onChange:e=>f(t=>({...t,prompt:e.target.value})),rows:4,className:d(ee,`placeholder:italic`)}),(0,j.jsx)(`span`,{className:`text-xs text-muted`,children:r(a.AUTOMATIONS$EDIT_PROMPT_HINT)})]}),e.trigger.type===`event`?(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg bg-[var(--oh-surface-raised)] p-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(a.AUTOMATIONS$DETAIL$TRIGGER)}),(0,j.jsx)(`span`,{className:`text-sm text-content`,children:r(a.AUTOMATIONS$DETAIL$TRIGGER_EVENT)})]}),e.trigger.source&&(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(a.AUTOMATIONS$DETAIL$EVENT_SOURCE)}),(0,j.jsx)(`span`,{className:`text-sm text-content`,children:e.trigger.source})]}),e.trigger.on&&(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(a.AUTOMATIONS$DETAIL$EVENT_TYPE)}),(0,j.jsx)(`code`,{className:`text-xs font-mono text-content`,children:Z(e.trigger.on)})]}),e.trigger.filter&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(a.AUTOMATIONS$DETAIL$EVENT_FILTER)}),(0,j.jsx)(`code`,{className:`text-xs font-mono text-content break-all`,children:e.trigger.filter})]})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(S,{testId:`edit-automation-frequency`,name:`frequency`,label:r(a.AUTOMATIONS$FREQUENCY),items:h,selectedKey:s.frequency,isDisabled:s.isCustomSchedule,onSelectionChange:e=>{!e||s.isCustomSchedule||f(t=>({...t,frequency:e}))}}),s.frequency===`weekly`&&!s.isCustomSchedule&&(0,j.jsx)(S,{testId:`edit-automation-weekday`,name:`weekday`,label:r(a.AUTOMATIONS$WEEKDAY),items:y,selectedKey:String(s.weekday),onSelectionChange:e=>{e!==null&&f(t=>({...t,weekday:Number(e)}))}}),(0,j.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,j.jsx)(`span`,{className:`text-sm`,children:r(a.AUTOMATIONS$TIME_OF_DAY)}),(0,j.jsx)(`input`,{"data-testid":`edit-automation-time`,name:`timeOfDay`,type:`time`,value:s.timeOfDay,onChange:e=>f(t=>({...t,timeOfDay:e.target.value})),disabled:s.isCustomSchedule&&!b,className:d(_,`disabled:bg-[var(--oh-surface-raised)]`)}),e.timezone&&(0,j.jsxs)(`span`,{className:`text-xs text-muted`,children:[r(a.AUTOMATIONS$TIMEZONE),`: `,e.timezone]})]}),s.isCustomSchedule&&(0,j.jsxs)(`p`,{className:`text-xs text-muted`,"data-testid":`custom-schedule-hint`,children:[r(a.AUTOMATIONS$CUSTOM_SCHEDULE_HINT),s.rawSchedule&&(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`code`,{className:`text-xs text-content`,children:s.rawSchedule})]})]})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex justify-end gap-3`,children:[(0,j.jsx)(v,{testId:`edit-automation-cancel`,type:`button`,variant:`secondary`,onClick:n,isDisabled:i.isPending,children:r(a.AUTOMATIONS$CANCEL)}),(0,j.jsx)(v,{testId:`edit-automation-save`,type:`submit`,variant:`primary`,isDisabled:i.isPending,"aria-busy":i.isPending,children:i.isPending?r(a.AUTOMATIONS$SAVING):r(a.AUTOMATIONS$SAVE)})]})]})]})]})}export{k as C,F as S,L as _,$ as a,R as b,Z as c,le as d,ce as f,U as g,K as h,ge as i,de as l,G as m,ve as n,Q as o,se as p,_e as r,he as s,xe as t,ue as u,B as v,P as x,V as y};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-DTei6kki.js","assets/vendor~browser-3J6WDaAB.js","assets/vendor~browser-C3GKF4mj.js","assets/settings-KgLvVrSm.js","assets/common-Cfviy7yT.js","assets/automation-LZB0MjdV.js","assets/query-client-config-CITeuHD7.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~h07fzaqi-D15MEcqi.js","assets/mutation-CaJwPR9O.js","assets/custom-toast-handlers-fgD4IYsu.js","assets/createLucideIcon-C9OEnwvX.js","assets/react-CM_dJw1Z.js","assets/declaration-IA661TBv.js","assets/utils-CVcuFUYj.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~j8sdb9mk-oCzr0-9g.js","assets/i18n-CyvU1o95.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~skills-settings~m~o9nrx3fm-87v-LliW.js","assets/health-store-d-d2ssv4.js","assets/retrieve-axios-error-message-DbnSBc_1.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./preload-helper-CT1Z6Pdu.js";import{n as r}from"./vendor~entry.client-Du9GpFmX.js";import{t as i}from"./vendor~entry.client-CySJvEhK.js";import{o as a}from"./declaration-IA661TBv.js";import{n as o,t as s}from"./providers-Bpq3xFRA.js";import{s as c}from"./i18n-CyvU1o95.js";var l=e(t(),1),u=i();function d({mockApi:e=void 0,hasWindow:t=typeof window<`u`}={}){return t&&e===`true`}var f=a();async function p(){if(await c(),d()){let{worker:e}=await n(async()=>{let{worker:e}=await import(`./browser-DTei6kki.js`);return{worker:e}},__vite__mapDeps([0,1,2,3,4,5]));await e.start({onUnhandledRequest:`bypass`});let{queryClient:t}=await n(async()=>{let{queryClient:e}=await import(`./query-client-config-CITeuHD7.js`).then(e=>e.i);return{queryClient:e}},__vite__mapDeps([6,7,8,9,10,11,12,13,14,15,4,16,17,18,19]));window.__TEST_INVALIDATE_QUERIES__=e=>void t.invalidateQueries(e?{queryKey:e}:void 0)}}p().then(()=>(0,l.startTransition)(()=>{(0,u.hydrateRoot)(document,(0,f.jsx)(l.StrictMode,{children:(0,f.jsx)(s,{analytics:o,withStyleRoot:!1,children:(0,f.jsx)(r,{})})}))}));
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-B8bp1IqT.js","assets/vendor~browser-Dwwc84Zf.js","assets/vendor~browser-BYEwwJqV.js","assets/settings-BgL2HUsU.js","assets/common-Cfviy7yT.js","assets/automation-BzmydDjr.js","assets/query-client-config-CITeuHD7.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~h07fzaqi-D15MEcqi.js","assets/mutation-CaJwPR9O.js","assets/custom-toast-handlers-fgD4IYsu.js","assets/createLucideIcon-C9OEnwvX.js","assets/react-CM_dJw1Z.js","assets/declaration-IA661TBv.js","assets/utils-CVcuFUYj.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~j8sdb9mk-oCzr0-9g.js","assets/i18n-CyvU1o95.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~skills-settings~m~o9nrx3fm-87v-LliW.js","assets/health-store-d-d2ssv4.js","assets/retrieve-axios-error-message-DbnSBc_1.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./preload-helper-CT1Z6Pdu.js";import{n as r}from"./vendor~entry.client-Du9GpFmX.js";import{t as i}from"./vendor~entry.client-CySJvEhK.js";import{o as a}from"./declaration-IA661TBv.js";import{n as o,t as s}from"./providers-Bpq3xFRA.js";import{s as c}from"./i18n-CyvU1o95.js";var l=e(t(),1),u=i();function d({mockApi:e=void 0,hasWindow:t=typeof window<`u`}={}){return t&&e===`true`}var f=a();async function p(){if(await c(),d()){let{worker:e}=await n(async()=>{let{worker:e}=await import(`./browser-B8bp1IqT.js`);return{worker:e}},__vite__mapDeps([0,1,2,3,4,5]));await e.start({onUnhandledRequest:`bypass`});let{queryClient:t}=await n(async()=>{let{queryClient:e}=await import(`./query-client-config-CITeuHD7.js`).then(e=>e.i);return{queryClient:e}},__vite__mapDeps([6,7,8,9,10,11,12,13,14,15,4,16,17,18,19]));window.__TEST_INVALIDATE_QUERIES__=e=>void t.invalidateQueries(e?{queryKey:e}:void 0)}}p().then(()=>(0,l.startTransition)(()=>{(0,u.hydrateRoot)(document,(0,f.jsx)(l.StrictMode,{children:(0,f.jsx)(s,{analytics:o,withStyleRoot:!1,children:(0,f.jsx)(r,{})})}))}));
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{o as n,t as r}from"./declaration-IA661TBv.js";import{t as i}from"./useTranslation-CbJtty1g.js";import{t as a}from"./check-BDAbW7je.js";import{t as o}from"./chevron-down-DUxWwzTm.js";import{t as s}from"./utils-CVcuFUYj.js";import{i as c,o as l,t as u}from"./dropdown-classes-lT1LUsbO.js";import{t as d}from"./use-click-outside-element-_vianyPb.js";var f=e(t(),1),p=n();function m({testId:e,value:t,onChange:n,options:m,labelKeyByValue:h}){let{t:g}=i(`openhands`),[_,v]=f.useState(!1),y=d(()=>v(!1)),b=m[0],x=g(h[t]);return(0,p.jsxs)(`div`,{ref:y,className:`relative shrink-0 w-auto`,"data-testid":e,children:[(0,p.jsxs)(`button`,{type:`button`,"data-testid":`dropdown-trigger`,"aria-haspopup":`menu`,"aria-expanded":_,"aria-label":g(r.CONVERSATION_PANEL$FILTER_LABEL),onClick:()=>v(e=>!e),className:s(u,b&&t!==b&&`border-white/60 bg-white/10`),children:[(0,p.jsx)(`span`,{className:`whitespace-nowrap`,children:x}),(0,p.jsx)(o,{className:s(`h-4 w-4 shrink-0 text-tertiary-alt transition-transform`,_&&`rotate-180`),"aria-hidden":!0})]}),_?(0,p.jsx)(`div`,{role:`menu`,"data-testid":`${e}-menu`,"aria-label":g(r.CONVERSATION_PANEL$FILTER_LABEL),className:s(`absolute right-0 top-full z-50 mt-1 min-w-full w-max`,`max-h-60 overflow-auto rounded-[6px] bg-tertiary p-1 context-menu-box-shadow`,c),children:m.map(r=>{let i=r===t;return(0,p.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":i,"data-testid":`${e}-${r}`,onClick:()=>{n(r),v(!1)},className:s(l,i&&`bg-[var(--oh-interactive-selected)]`),children:[(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:g(h[r])}),i?(0,p.jsx)(a,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}):null]},r)})}):null]})}export{m as t};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{o as n,t as r}from"./declaration-IA661TBv.js";import{t as i}from"./useTranslation-CbJtty1g.js";import{t as a}from"./check-BDAbW7je.js";import{t as o}from"./chevron-down-DUxWwzTm.js";import{t as s}from"./utils-CVcuFUYj.js";import{i as c,o as l,t as u}from"./dropdown-classes-lT1LUsbO.js";import{t as d}from"./use-click-outside-element-Bu2A3s59.js";var f=e(t(),1),p=n();function m({testId:e,value:t,onChange:n,options:m,labelKeyByValue:h}){let{t:g}=i(`openhands`),[_,v]=f.useState(!1),y=d(()=>v(!1)),b=m[0],x=g(h[t]);return(0,p.jsxs)(`div`,{ref:y,className:`relative shrink-0 w-auto`,"data-testid":e,children:[(0,p.jsxs)(`button`,{type:`button`,"data-testid":`dropdown-trigger`,"aria-haspopup":`menu`,"aria-expanded":_,"aria-label":g(r.CONVERSATION_PANEL$FILTER_LABEL),onClick:()=>v(e=>!e),className:s(u,b&&t!==b&&`border-white/60 bg-white/10`),children:[(0,p.jsx)(`span`,{className:`whitespace-nowrap`,children:x}),(0,p.jsx)(o,{className:s(`h-4 w-4 shrink-0 text-tertiary-alt transition-transform`,_&&`rotate-180`),"aria-hidden":!0})]}),_?(0,p.jsx)(`div`,{role:`menu`,"data-testid":`${e}-menu`,"aria-label":g(r.CONVERSATION_PANEL$FILTER_LABEL),className:s(`absolute right-0 top-full z-50 mt-1 min-w-full w-max`,`max-h-60 overflow-auto rounded-[6px] bg-tertiary p-1 context-menu-box-shadow`,c),children:m.map(r=>{let i=r===t;return(0,p.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":i,"data-testid":`${e}-${r}`,onClick:()=>{n(r),v(!1)},className:s(l,i&&`bg-[var(--oh-interactive-selected)]`),children:[(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:g(h[r])}),i?(0,p.jsx)(a,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}):null]},r)})}):null]})}export{m as t};
@@ -1 +1 @@
1
- import{L as e,s as t}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as n,t as r}from"./declaration-IA661TBv.js";import{t as i}from"./useTranslation-CbJtty1g.js";import{t as a}from"./sidebar-nav-link-CiXbBMQx.js";import{r as o}from"./typography-U1gkzkXo.js";import{t as s}from"./use-breakpoint-2sN462wJ.js";import{t as c}from"./backend-synced-settings-badge-BwTawSCE.js";import{t as l}from"./extensions-navigation-oOk5yl8X.js";var u=n();function d(){let{t:e}=i(`openhands`);return(0,u.jsxs)(`div`,{"data-testid":`extensions-mobile-hub`,className:`flex flex-col gap-4 px-4 py-2 md:hidden`,children:[(0,u.jsx)(o.H2,{children:e(r.NAV$CUSTOMIZE)}),(0,u.jsx)(`nav`,{className:`flex flex-col gap-0.5`,children:l.map(e=>(0,u.jsx)(a,{to:e.to,label:e.label,end:e.end,testId:`sidebar-extensions-${e.to}`,icon:e.icon,disabled:e.comingSoon},e.to))}),(0,u.jsx)(`div`,{className:`pt-1`,children:(0,u.jsx)(c,{})})]})}var f=e(function(){return s(768)?(0,u.jsx)(d,{}):(0,u.jsx)(t,{to:`/skills`,replace:!0})});export{f as default};
1
+ import{L as e,s as t}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as n,t as r}from"./declaration-IA661TBv.js";import{t as i}from"./useTranslation-CbJtty1g.js";import{t as a}from"./sidebar-nav-link-Bhlzlhp8.js";import{r as o}from"./typography-Cx7uw7z3.js";import{t as s}from"./use-breakpoint-Dt2knceC.js";import{t as c}from"./backend-synced-settings-badge-1A63yxGs.js";import{t as l}from"./extensions-navigation-BIb-vAa2.js";var u=n();function d(){let{t:e}=i(`openhands`);return(0,u.jsxs)(`div`,{"data-testid":`extensions-mobile-hub`,className:`flex flex-col gap-4 px-4 py-2 md:hidden`,children:[(0,u.jsx)(o.H2,{children:e(r.NAV$CUSTOMIZE)}),(0,u.jsx)(`nav`,{className:`flex flex-col gap-0.5`,children:l.map(e=>(0,u.jsx)(a,{to:e.to,label:e.label,end:e.end,testId:`sidebar-extensions-${e.to}`,icon:e.icon,disabled:e.comingSoon},e.to))}),(0,u.jsx)(`div`,{className:`pt-1`,children:(0,u.jsx)(c,{})})]})}var f=e(function(){return s(768)?(0,u.jsx)(d,{}):(0,u.jsx)(t,{to:`/skills`,replace:!0})});export{f as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-BFRubm34.js";import{t as e}from"./react-CM_dJw1Z.js";import{o as t,t as n}from"./declaration-IA661TBv.js";import{t as r}from"./useTranslation-CbJtty1g.js";import{t as i}from"./utils-CVcuFUYj.js";import{t as a}from"./navigation-link-DXg4oo29.js";import{c as o,m as s}from"./use-cloud-current-user-id-e1Pk7NxQ.js";import{t as c}from"./skills-BDOWVle-.js";import{t as l}from"./backend-synced-settings-badge-1A63yxGs.js";e();var u=t(),d=[{to:`/skills`,label:`Skills`,icon:(0,u.jsx)(c,{width:16,height:16,"aria-hidden":`true`}),end:!0},{to:`/mcp`,label:`MCP Servers`,icon:(0,u.jsx)(e=>(0,u.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,u.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2.25 3H21.75L22.5 3.75V13.5H21V9H3V19.5H13.5V21H2.25L1.5 20.25V3.75L2.25 3ZM3 7.5H21V4.5H3V7.5ZM10.5 18V16.359C10.2451 16.2664 10.0074 16.132 9.7965 15.9615L8.379 16.77L7.629 15.48L9.0345 14.6595C8.98649 14.3881 8.98649 14.1104 9.0345 13.839L7.629 13.02L8.379 11.73L9.7965 12.54C10.023 12.36 10.2585 12.2265 10.5 12.141V10.5H12V12.141C12.2568 12.2293 12.4953 12.3641 12.7035 12.5385L14.121 11.73L14.871 13.02L13.4655 13.8405C13.5133 14.1114 13.5133 14.3886 13.4655 14.6595L14.871 15.48L14.121 16.77L12.7035 15.96C12.4903 16.1274 12.2531 16.2619 12 16.359V18H10.5ZM10.125 14.25C10.125 14.562 10.2345 14.8275 10.4535 15.0465C10.5568 15.1528 10.6807 15.2367 10.8177 15.2932C10.9547 15.3497 11.1018 15.3776 11.25 15.375C11.3982 15.3776 11.5453 15.3497 11.6823 15.2932C11.8193 15.2367 11.9432 15.1528 12.0465 15.0465C12.1528 14.9432 12.2367 14.8193 12.2932 14.6823C12.3497 14.5453 12.3776 14.3982 12.375 14.25C12.3776 14.1018 12.3497 13.9547 12.2932 13.8177C12.2367 13.6807 12.1528 13.5568 12.0465 13.4535C11.9432 13.3472 11.8193 13.2633 11.6823 13.2068C11.5453 13.1503 11.3982 13.1224 11.25 13.125C11.1018 13.1224 10.9547 13.1503 10.8177 13.2068C10.6807 13.2633 10.5568 13.3472 10.4535 13.4535C10.3472 13.5568 10.2633 13.6807 10.2068 13.8177C10.1503 13.9547 10.1224 14.1018 10.125 14.25ZM18.126 22.5V20.859C17.8711 20.7663 17.6334 20.632 17.4225 20.4615L16.005 21.27L15.255 19.98L16.662 19.1595C16.614 18.8881 16.614 18.6104 16.662 18.339L15.255 17.52L16.005 16.23L17.4225 17.04C17.649 16.86 17.8845 16.7265 18.1275 16.641V15H19.6275V16.641C19.8837 16.7297 20.1216 16.8644 20.3295 17.0385L21.747 16.23L22.497 17.52L21.0915 18.3405C21.1396 18.6114 21.1396 18.8886 21.0915 19.1595L22.497 19.98L21.747 21.27L20.3295 20.46C20.1163 20.6275 19.8791 20.762 19.626 20.859V22.5H18.126ZM17.751 18.75C17.751 19.062 17.8605 19.3275 18.0795 19.5465C18.1828 19.6528 18.3067 19.7367 18.4437 19.7932C18.5807 19.8497 18.7278 19.8776 18.876 19.875C19.0242 19.8776 19.1713 19.8497 19.3083 19.7932C19.4453 19.7367 19.5692 19.6528 19.6725 19.5465C19.779 19.4434 19.8633 19.3195 19.9201 19.1825C19.9768 19.0455 20.0049 18.8983 20.0025 18.75C20.0049 18.6017 19.9768 18.4545 19.9201 18.3175C19.8633 18.1805 19.779 18.0566 19.6725 17.9535C19.5694 17.8474 19.4457 17.7636 19.309 17.7071C19.1722 17.6506 19.0254 17.6226 18.8775 17.625C18.7291 17.6222 18.5817 17.65 18.4444 17.7065C18.3072 17.763 18.183 17.847 18.0795 17.9535C17.9732 18.0568 17.8893 18.1807 17.8328 18.3177C17.7763 18.4547 17.7484 18.6018 17.751 18.75Z`,fill:`currentColor`})}),{width:16,height:16}),end:!0},{to:`/plugins`,label:`Plugins`,icon:(0,u.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,width:16,height:16,"aria-hidden":`true`,children:[(0,u.jsx)(`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`}),(0,u.jsx)(`path`,{d:`m3.3 7 8.7 5 8.7-5`}),(0,u.jsx)(`path`,{d:`M12 22V12`})]}),end:!0,comingSoon:!0}];function f(){let{t:e}=r(`openhands`);return(0,u.jsxs)(`aside`,{"data-testid":`extensions-navbar-desktop`,className:`hidden md:flex md:w-[260px] md:shrink-0 md:flex-col md:gap-2 md:sticky md:top-8 md:self-start`,children:[(0,u.jsx)(`span`,{className:`px-2 text-sm font-normal text-white`,children:e(n.NAV$CUSTOMIZE)}),(0,u.jsx)(`div`,{className:`flex flex-col gap-0.5 pt-0.5`,children:d.map(t=>{let r=(0,u.jsx)(`span`,{className:`shrink-0 flex items-center justify-center`,children:t.icon}),c=(0,u.jsx)(`span`,{className:`truncate`,children:t.label}),l=t.comingSoon&&(0,u.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-white/20 bg-white/5 px-1.5 py-0.5 text-[10px] font-medium text-[var(--oh-text-dim)]`,children:e(n.NAV$COMING_SOON)});return(0,u.jsxs)(a,{to:t.to,end:t.end,"data-testid":`sidebar-extensions-${t.to}`,className:({isActive:e})=>i(s(),`truncate`,e?o.active:o.idle),children:[r,c,l]},t.to)})}),(0,u.jsx)(`div`,{className:`px-2 pt-3`,children:(0,u.jsx)(l,{})})]})}export{f as n,d as t};