@openhands/agent-canvas 1.19.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/README.md +1 -1
  2. package/README.windows.md +2 -2
  3. package/build/assets/{acp-providers-BQ4o4vqy.js → acp-providers-DOKcGeaV.js} +1 -1
  4. package/build/assets/active-backend-context-BETEdaJl.js +2 -0
  5. package/build/assets/{agent-context-settings-D9i6ezoJ.js → agent-context-settings-Dir0loAn.js} +1 -1
  6. package/build/assets/{agent-profiles-service.api-U-9YzDFU.js → agent-profiles-service.api-CiMVQAIT.js} +1 -1
  7. package/build/assets/{agent-profiles-settings-D-bUV2PX.js → agent-profiles-settings-CT5owzRT.js} +1 -1
  8. package/build/assets/{agent-server-conversation-service.api-BaVQ6NpE.js → agent-server-conversation-service.api-BtOlitCD.js} +3 -3
  9. package/build/assets/agent-settings-BnzyTgCb.js +2 -0
  10. package/build/assets/agent-settings-CeXj3xK-.js +1 -0
  11. package/build/assets/{alert-banner-BkVt_8Or.js → alert-banner-Ccx1Du6n.js} +1 -1
  12. package/build/assets/{api-key-entry-screen-fAIld-n7.js → api-key-entry-screen-DXIuzBjY.js} +1 -1
  13. package/build/assets/{app-settings-DITbrM2u.js → app-settings-DkIJVTKL.js} +1 -1
  14. package/build/assets/{automation-detail-DawHmaOl.js → automation-detail-CF2SweVs.js} +1 -1
  15. package/build/assets/{automation-disabled-reason-DtgC8Ppt.js → automation-disabled-reason-QFtMrdOr.js} +1 -1
  16. package/build/assets/{automation-export-Kv6e0bHx.js → automation-export-CkvehhPF.js} +1 -1
  17. package/build/assets/{automation-git-sync-Dd98G_Oz.js → automation-git-sync-di4tBAyZ.js} +1 -1
  18. package/build/assets/automation-setup-route-FERj7WEe.js +3 -0
  19. package/build/assets/{automation-templates-Xhr-FDAB.js → automation-templates-DlaCRvD-.js} +1 -1
  20. package/build/assets/{automations-list-BeP1LuzQ.js → automations-list-yK7ETmYP.js} +1 -1
  21. package/build/assets/{back-nav-button-DWNiN277.js → back-nav-button-oDvIxpQ5.js} +1 -1
  22. package/build/assets/{backend-form-modal-DeaUJIik.js → backend-form-modal-DzYf_arO.js} +1 -1
  23. package/build/assets/{backend-synced-settings-badge-Br85iWIY.js → backend-synced-settings-badge-DXDDHWX4.js} +1 -1
  24. package/build/assets/{badge-Cdnei7Ly.js → badge-CDHZEVeN.js} +1 -1
  25. package/build/assets/{base-modal-Ds7grR67.js → base-modal-CZq4kB_H.js} +1 -1
  26. package/build/assets/{brand-button-mQq2Ld1I.js → brand-button-CGUwj6zK.js} +1 -1
  27. package/build/assets/{browser-Bfum8fkE.js → browser-kY6jN61T.js} +1 -1
  28. package/build/assets/{browser-tab-CmYT4j_r.js → browser-tab-DFyZXsnB.js} +1 -1
  29. package/build/assets/{canvas-extension-page-CokKSVRG.js → canvas-extension-page-DsGq1DtT.js} +1 -1
  30. package/build/assets/{canvas-extensions-BoQEYG-2.js → canvas-extensions-Cb2Z0Hdc.js} +1 -1
  31. package/build/assets/{canvas-extensions-runtime-Du2M5iEX.js → canvas-extensions-runtime-DS6eT4nK.js} +1 -1
  32. package/build/assets/{chat-send-button-DM3JgMc2.js → chat-send-button-B6aVaD9V.js} +1 -1
  33. package/build/assets/{circle-plus-check-toggle-BbYBiUwv.js → circle-plus-check-toggle-ZOXpJ3I2.js} +1 -1
  34. package/build/assets/{cloud-funnel-analytics-D02kgq1s.js → cloud-funnel-analytics-BH_zxjiO.js} +1 -1
  35. package/build/assets/{cog-Dy1eWbSZ.js → cog-DVZT1f0s.js} +1 -1
  36. package/build/assets/{command-menu-mehU3Evb.js → command-menu-ImeHQ6c2.js} +1 -1
  37. package/build/assets/{commits-tab-DhQW8CXi.js → commits-tab-B5SUF66c.js} +1 -1
  38. package/build/assets/{condenser-settings-eRk6Fkx6.js → condenser-settings-BlGOXEXM.js} +1 -1
  39. package/build/assets/{confirmation-modal-BmVt_c0I.js → confirmation-modal-oN1EId79.js} +1 -1
  40. package/build/assets/{context-menu-list-item-lx2zk9G7.js → context-menu-list-item-DIm5xQg6.js} +1 -1
  41. package/build/assets/{conversation-BOj0ENI6.js → conversation-9a53tdbO.js} +3 -3
  42. package/build/assets/conversation-XRsI28ZM.js +1 -0
  43. package/build/assets/conversation-panel-XRsI28ZM.js +1 -0
  44. package/build/assets/{conversation-state-store-C6YncQNo.js → conversation-state-store-Br-eE-gg.js} +1 -1
  45. package/build/assets/{conversation-tab-empty-state-DIhwCC2J.js → conversation-tab-empty-state-BT1GrnKP.js} +1 -1
  46. package/build/assets/{copy-to-clipboard-button-DVNXLylP.js → copy-to-clipboard-button-CvTHqY13.js} +1 -1
  47. package/build/assets/{device-verify-LP-x7nra.js → device-verify-DX0xdNjo.js} +1 -1
  48. package/build/assets/{dropdown-classes-goDldkiu.js → dropdown-classes-DyyMaaXl.js} +1 -1
  49. package/build/assets/edit-automation-modal-bfD-5NIc.js +1 -0
  50. package/build/assets/{empty-state-Cd-TFe7i.js → empty-state-B5advKVW.js} +1 -1
  51. package/build/assets/{entry.client-CJdjIvMZ.js → entry.client-D_2gnSyB.js} +2 -2
  52. package/build/assets/{enum-filter-dropdown-pocrz9AL.js → enum-filter-dropdown-VAJp5mqh.js} +1 -1
  53. package/build/assets/{environment-switch-overlay-Dwe78wRl.js → environment-switch-overlay-C7x_yhEs.js} +1 -1
  54. package/build/assets/{error-state-SuWwztxV.js → error-state-BgYl7YeB.js} +1 -1
  55. package/build/assets/{extensions-hub-O0esK3Er.js → extensions-hub-DjhOed1I.js} +1 -1
  56. package/build/assets/{extensions-navigation-CgCVSXje.js → extensions-navigation-Di-J2KUR.js} +1 -1
  57. package/build/assets/{files-tab-B_6t8ljw.js → files-tab-BNDp3e_x.js} +1 -1
  58. package/build/assets/{form-control-classes-lQfLxzH4.js → form-control-classes-BVI_szaj.js} +1 -1
  59. package/build/assets/{get-git-path-Bp5rsUkl.js → get-git-path-DOe6PM_a.js} +1 -1
  60. package/build/assets/git-repo-dropdown-1fZGYtYm.js +1 -0
  61. package/build/assets/{git-repo-dropdown-DPQVumZg.js → git-repo-dropdown-DNlinQ7r.js} +1 -1
  62. package/build/assets/{highlighted-source-view-Bp0sgK-f.js → highlighted-source-view-DPerL6tF.js} +1 -1
  63. package/build/assets/home-4lyLzYjG.js +1 -0
  64. package/build/assets/{home-BghzJd-D.js → home-BGaB0EeK.js} +1 -1
  65. package/build/assets/{home-automation-run-tooltip-BdpCckKO.js → home-automation-run-tooltip-v5n7zXR0.js} +1 -1
  66. package/build/assets/{home-store-DNQpfIEO.js → home-store-roz1x6D5.js} +1 -1
  67. package/build/assets/{hooks-service-DkxnQa4N.js → hooks-service-tzRqtAlm.js} +1 -1
  68. package/build/assets/index-home-6Y_Y7kOo.js +1 -0
  69. package/build/assets/{install-server-modal-DvxxYKia.js → install-server-modal-DkMCfj0J.js} +1 -1
  70. package/build/assets/{key-CwTE6XJj.js → key-DpfBWQbk.js} +1 -1
  71. package/build/assets/{launch-jsRGPRBx.js → launch-TrnYlJe6.js} +1 -1
  72. package/build/assets/llm-not-configured-banner-BdjItKQR.js +27 -0
  73. package/build/assets/{llm-settings-dkQ5Oq7W.js → llm-settings-CUgt39uu.js} +1 -1
  74. package/build/assets/llm-settings-DEfw-fUJ.js +1 -0
  75. package/build/assets/{llm-subscription-service-BiQaZbvv.js → llm-subscription-service-LGYVzyAc.js} +1 -1
  76. package/build/assets/{loading-spinner-DK1sAwVg.js → loading-spinner-BJc2J0Dw.js} +1 -1
  77. package/build/assets/{manage-backends-modal-DqCJohsX.js → manage-backends-modal-CIjk0B2H.js} +1 -1
  78. package/build/assets/manifest-23d79467.js +1 -0
  79. package/build/assets/{manifest-subpage-layout-sxuPqfUr.js → manifest-subpage-layout-DGYRoP_8.js} +1 -1
  80. package/build/assets/{markdown-renderer-BH5pqDuJ.js → markdown-renderer-DRpwRlNm.js} +1 -1
  81. package/build/assets/{mcp-BtaJDXnP.js → mcp-CoUOIGBF.js} +1 -1
  82. package/build/assets/{mcp-installed-servers-Br4ZLsjr.js → mcp-installed-servers-BW51n6PC.js} +1 -1
  83. package/build/assets/{mcp-page-DwbnQpVs.js → mcp-page-hZ4aJjj_.js} +1 -1
  84. package/build/assets/{messages-DmFJlW6c.js → messages-WUb9Yh-p.js} +1 -1
  85. package/build/assets/{modal-body-DBweM2EN.js → modal-body-B_95ci1c.js} +1 -1
  86. package/build/assets/{modal-classes-jvG85nkU.js → modal-classes-BPcBCWVj.js} +1 -1
  87. package/build/assets/{modal-close-button-BrM5fNnn.js → modal-close-button-Cq3dma5u.js} +1 -1
  88. package/build/assets/{onboarding-CQ8T6T0U.js → onboarding-Cc4Av7bi.js} +1 -1
  89. package/build/assets/{onboarding-modal-CnliiaSN.js → onboarding-modal-DCFD4Dsa.js} +1 -1
  90. package/build/assets/{organization-service.api-DmFUEmu5.js → organization-service.api-zhHpQU0t.js} +1 -1
  91. package/build/assets/{planner-tab-CXph_C9F.js → planner-tab-yISBVUKu.js} +1 -1
  92. package/build/assets/{plugins-management-service-CcEpfNKz.js → plugins-management-service-2oP6_tWr.js} +1 -1
  93. package/build/assets/{profiles-service.api-DdF_4Zhe.js → profiles-service.api-B5thiTI3.js} +1 -1
  94. package/build/assets/{providers-BWRnl31s.js → providers-Co9PsD0s.js} +1 -1
  95. package/build/assets/{proxy-DbEf3Nqr.js → proxy-BCCQUna8.js} +1 -1
  96. package/build/assets/{recommended-automations-launcher-r0oI91HN.js → recommended-automations-launcher-D1Do753p.js} +1 -1
  97. package/build/assets/{root-j2fFRlWS.js → root-D1y82Lhg.js} +2 -2
  98. package/build/assets/{root-layout-CfGgm2lo.js → root-layout-cQTYEG2w.js} +2 -2
  99. package/build/assets/{schema-field-c3Ncgm4x.js → schema-field-DSi0d7a8.js} +1 -1
  100. package/build/assets/{sdk-section-page-DFEiuiFQ.js → sdk-section-page-DCoI2dtd.js} +1 -1
  101. package/build/assets/{secret-form-WXXNFqTM.js → secret-form-BDvzojzN.js} +1 -1
  102. package/build/assets/{secrets-service-DU6wh3wX.js → secrets-service-C3CNNEpY.js} +1 -1
  103. package/build/assets/{secrets-settings-BEqbPvjy.js → secrets-settings-BKqfYQt5.js} +1 -1
  104. package/build/assets/{settings-DjaSQwFh.js → settings-C8ZLONyx.js} +1 -1
  105. package/build/assets/{settings-dropdown-input-BRR2OZwi.js → settings-dropdown-input-Df_HXRk4.js} +1 -1
  106. package/build/assets/{settings-index-DHv4XFcM.js → settings-index-BWvlGHg3.js} +1 -1
  107. package/build/assets/{settings-input-Cm4VxUon.js → settings-input-B3i5U9GL.js} +1 -1
  108. package/build/assets/{settings-list-classes-CaUfKZ33.js → settings-list-classes-DbqcSiVW.js} +1 -1
  109. package/build/assets/{settings-modal-djXuAnBO.js → settings-modal-DHKJSBPL.js} +1 -1
  110. package/build/assets/{settings-nav-DFb3hBMr.js → settings-nav-BThjwLWD.js} +1 -1
  111. package/build/assets/{settings-service.api-Q9lKW1TX.js → settings-service.api-CYBTLGOd.js} +1 -1
  112. package/build/assets/{settings-switch-seaSJc7t.js → settings-switch-CI93Iozg.js} +1 -1
  113. package/build/assets/{shared-conversation-x3rxVCon.js → shared-conversation-C7OILS-U.js} +1 -1
  114. package/build/assets/{sidebar-layout-B6mcvvdV.js → sidebar-layout-Csb6Geq0.js} +1 -1
  115. package/build/assets/{sidebar-mobile-menu-toggle-CEqS8KnA.js → sidebar-mobile-menu-toggle-B2xwXm4s.js} +1 -1
  116. package/build/assets/{sidebar-nav-link-BTHX11LG.js → sidebar-nav-link-Xv7QEMVS.js} +1 -1
  117. package/build/assets/{sidebar-onboarding-checklist-storage-BP1kzn6p.js → sidebar-onboarding-checklist-storage-_zxMqHS0.js} +1 -1
  118. package/build/assets/{skill-card-pill-row-TD39nfP3.js → skill-card-pill-row-CxOFySng.js} +1 -1
  119. package/build/assets/{skill-enablement-DXeaImBz.js → skill-enablement-BBKya60C.js} +1 -1
  120. package/build/assets/{skill-filter-CdBbbwjm.js → skill-filter-BvtbD--b.js} +1 -1
  121. package/build/assets/{skill-icon-badge-vUEp7gsC.js → skill-icon-badge-CVxE42yg.js} +1 -1
  122. package/build/assets/{skill-scope-BTRBQt0-.js → skill-scope-C0NxJnpT.js} +1 -1
  123. package/build/assets/{skills-plugins-k1tUNAw4.js → skills-plugins-BGjX4jve.js} +1 -1
  124. package/build/assets/{skills-settings-CENviPT7.js → skills-settings-d3ZwIjSP.js} +1 -1
  125. package/build/assets/{styled-tooltip-DVAlWYnL.js → styled-tooltip-CknPQH4Y.js} +1 -1
  126. package/build/assets/{task-list-tab-BLKF_x9f.js → task-list-tab-CQisRcPh.js} +1 -1
  127. package/build/assets/{terminal-Ckbnqb23.js → terminal-Bs50gJPC.js} +1 -1
  128. package/build/assets/{toggle-switch-DeiG9Mf6.js → toggle-switch-D3TBxlsc.js} +1 -1
  129. package/build/assets/{trash-CXN2R54L.js → trash-D1QMHInX.js} +1 -1
  130. package/build/assets/{typography-NarNyelM.js → typography-BdAApXGl.js} +1 -1
  131. package/build/assets/{usage-tab-Drd3O006.js → usage-tab-ClVHAFJy.js} +1 -1
  132. package/build/assets/{use-acp-credential-form-CJ5wPsQm.js → use-acp-credential-form-GfqcTJl5.js} +1 -1
  133. package/build/assets/{use-activate-agent-profile-iQZ0U3qV.js → use-activate-agent-profile-DO6SNPkK.js} +1 -1
  134. package/build/assets/{use-agent-profiles-LCvb5OXT.js → use-agent-profiles-YsBlt3tT.js} +1 -1
  135. package/build/assets/{use-automation-health-DdgSa8sA.js → use-automation-health-CbQ9n-k7.js} +1 -1
  136. package/build/assets/{use-automation-permissions-D3kEeieu.js → use-automation-permissions-gFy-2VD0.js} +1 -1
  137. package/build/assets/{use-automations-CEubcYTD.js → use-automations-7_XBXHQK.js} +1 -1
  138. package/build/assets/{use-can-manage-org-profiles-CB8ybxFK.js → use-can-manage-org-profiles-Dt4YkPO7.js} +1 -1
  139. package/build/assets/{use-canvas-extensions-BMacwi2v.js → use-canvas-extensions-BhYQrtMK.js} +1 -1
  140. package/build/assets/{use-cloud-current-user-id-BEKRd6XZ.js → use-cloud-current-user-id-Dqw6qQUg.js} +1 -1
  141. package/build/assets/{use-config-3WYcJsgC.js → use-config-BJ_FJCjV.js} +1 -1
  142. package/build/assets/use-create-conversation-D15Px574.js +1 -0
  143. package/build/assets/use-create-secret-D_qPU88t.js +1 -0
  144. package/build/assets/{use-free-models-Ci3FkKEm.js → use-free-models-FAk2nngq.js} +1 -1
  145. package/build/assets/{use-get-secrets-fqS0kxt6.js → use-get-secrets-Pbo9jh2A.js} +1 -1
  146. package/build/assets/{use-llm-configured-B71ZEVg2.js → use-llm-configured-DF9BYmIe.js} +1 -1
  147. package/build/assets/{use-llm-profiles-xtCBMbef.js → use-llm-profiles-U4u1gzuk.js} +1 -1
  148. package/build/assets/use-manifest-capabilities-D81_YdAF.js +1 -0
  149. package/build/assets/{use-onboarding-completion-CEgjL02y.js → use-onboarding-completion-C4W-m2Jk.js} +1 -1
  150. package/build/assets/{use-pinned-home-route-pK4IlJ-p.js → use-pinned-home-route-DByWTojw.js} +1 -1
  151. package/build/assets/{use-plugins-marketplace-B8-ZEB34.js → use-plugins-marketplace-CTRoukH0.js} +1 -1
  152. package/build/assets/{use-save-agent-profile-D7hJuW_u.js → use-save-agent-profile-xpHBxMZM.js} +1 -1
  153. package/build/assets/{use-save-settings-CikTu5xV.js → use-save-settings-CmX41wlf.js} +1 -1
  154. package/build/assets/{use-settings-BWIH5EuN.js → use-settings-D69cw06D.js} +1 -1
  155. package/build/assets/{use-settings-nav-items-DSKwLDnd.js → use-settings-nav-items-CVz0SnDr.js} +1 -1
  156. package/build/assets/use-tracking-BAFpgpgq.js +3 -0
  157. package/build/assets/{use-user-conversation-C_l65DqW.js → use-user-conversation-BBDXUbOc.js} +1 -1
  158. package/build/assets/utils-CbjwNcR-.js +1 -0
  159. package/build/assets/{vendor~browser-hbU4u2Ag.js → vendor~browser-BZ-zIfb6.js} +1 -1
  160. package/build/assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~b0x1wrp2-DvZtOcoT.js +2 -0
  161. package/build/assets/{vendor~root-layout~index-home~home~conversation-panel~conversation~mcp~automations-list~aut~ibfbmr9f-CxhwKuAd.js → vendor~root-layout~index-home~home~conversation-panel~conversation~mcp~automations-list~aut~ibfbmr9f-BIjRfQ4u.js} +1 -1
  162. package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~inibp4qe-BFRW8wt-.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~inibp4qe-BBfdJIV9.js} +1 -1
  163. package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~eo2nf80n-3eJ4ExtV.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~eo2nf80n-fgzdgvrL.js} +3579 -165
  164. package/build/assets/{vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~jz4f6vo2-C7HiY4Ae.js → vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~jz4f6vo2-BqdU447s.js} +794 -227
  165. package/build/assets/{verification-settings-PKtoIUUY.js → verification-settings-BXspn27q.js} +1 -1
  166. package/build/index.html +4 -4
  167. package/build/locales/ar/openhands.json +8 -1
  168. package/build/locales/ca/openhands.json +8 -1
  169. package/build/locales/de/openhands.json +8 -1
  170. package/build/locales/en/openhands.json +8 -1
  171. package/build/locales/es/openhands.json +8 -1
  172. package/build/locales/fr/openhands.json +8 -1
  173. package/build/locales/it/openhands.json +8 -1
  174. package/build/locales/ja/openhands.json +8 -1
  175. package/build/locales/ko-KR/openhands.json +8 -1
  176. package/build/locales/no/openhands.json +8 -1
  177. package/build/locales/pt/openhands.json +8 -1
  178. package/build/locales/tr/openhands.json +8 -1
  179. package/build/locales/uk/openhands.json +8 -1
  180. package/build/locales/zh-CN/openhands.json +8 -1
  181. package/build/locales/zh-TW/openhands.json +8 -1
  182. package/config/defaults.json +3 -3
  183. package/dist/api/agent-profiles-service/profile-field-support.d.ts +2 -0
  184. package/dist/components/features/automations/agent-profile-selector.d.ts +7 -0
  185. package/dist/config/defaults.cjs +1 -1
  186. package/dist/config/defaults.cjs.map +1 -1
  187. package/dist/config/defaults.js +3 -3
  188. package/dist/config/defaults.js.map +1 -1
  189. package/dist/constants/profile-scope.d.ts +2 -2
  190. package/dist/hooks/mutation/use-create-conversation.cjs +1 -1
  191. package/dist/hooks/mutation/use-create-conversation.cjs.map +1 -1
  192. package/dist/hooks/mutation/use-create-conversation.js +30 -19
  193. package/dist/hooks/mutation/use-create-conversation.js.map +1 -1
  194. package/dist/hooks/mutation/use-switch-acp-model.cjs +1 -1
  195. package/dist/hooks/mutation/use-switch-acp-model.cjs.map +1 -1
  196. package/dist/hooks/mutation/use-switch-acp-model.js +11 -12
  197. package/dist/hooks/mutation/use-switch-acp-model.js.map +1 -1
  198. package/dist/hooks/query/query-keys.cjs +1 -1
  199. package/dist/hooks/query/query-keys.cjs.map +1 -1
  200. package/dist/hooks/query/query-keys.d.ts +1 -0
  201. package/dist/hooks/query/query-keys.js +10 -1
  202. package/dist/hooks/query/query-keys.js.map +1 -1
  203. package/dist/hooks/query/use-active-acp-profile-detail.cjs +1 -1
  204. package/dist/hooks/query/use-active-acp-profile-detail.cjs.map +1 -1
  205. package/dist/hooks/query/use-active-acp-profile-detail.d.ts +0 -9
  206. package/dist/hooks/query/use-active-acp-profile-detail.js +4 -13
  207. package/dist/hooks/query/use-active-acp-profile-detail.js.map +1 -1
  208. package/dist/i18n/declaration.cjs +1 -1
  209. package/dist/i18n/declaration.cjs.map +1 -1
  210. package/dist/i18n/declaration.d.ts +8 -1
  211. package/dist/i18n/declaration.js +1 -1
  212. package/dist/i18n/declaration.js.map +1 -1
  213. package/dist/i18n/translation.cjs +2 -2
  214. package/dist/i18n/translation.cjs.map +1 -1
  215. package/dist/i18n/translation.js +119 -0
  216. package/dist/i18n/translation.js.map +1 -1
  217. package/dist/locales/ar/openhands.json +8 -1
  218. package/dist/locales/ca/openhands.json +8 -1
  219. package/dist/locales/de/openhands.json +8 -1
  220. package/dist/locales/en/openhands.json +8 -1
  221. package/dist/locales/es/openhands.json +8 -1
  222. package/dist/locales/fr/openhands.json +8 -1
  223. package/dist/locales/it/openhands.json +8 -1
  224. package/dist/locales/ja/openhands.json +8 -1
  225. package/dist/locales/ko-KR/openhands.json +8 -1
  226. package/dist/locales/no/openhands.json +8 -1
  227. package/dist/locales/pt/openhands.json +8 -1
  228. package/dist/locales/tr/openhands.json +8 -1
  229. package/dist/locales/uk/openhands.json +8 -1
  230. package/dist/locales/zh-CN/openhands.json +8 -1
  231. package/dist/locales/zh-TW/openhands.json +8 -1
  232. package/dist/manifests/automation-setup.cjs.map +1 -1
  233. package/dist/manifests/automation-setup.js.map +1 -1
  234. package/dist/manifests/manifest-local-validation.cjs.map +1 -1
  235. package/dist/manifests/manifest-local-validation.js.map +1 -1
  236. package/dist/node_modules/@openhands/extensions/automations/bundle-index.cjs +3670 -247
  237. package/dist/node_modules/@openhands/extensions/automations/bundle-index.cjs.map +1 -1
  238. package/dist/node_modules/@openhands/extensions/automations/bundle-index.js +26 -3
  239. package/dist/node_modules/@openhands/extensions/automations/bundle-index.js.map +1 -1
  240. package/dist/node_modules/@openhands/extensions/automations/catalog/github-agents-md-maintainer/manifest.cjs +1 -1
  241. package/dist/node_modules/@openhands/extensions/automations/catalog/github-agents-md-maintainer/manifest.cjs.map +1 -1
  242. package/dist/node_modules/@openhands/extensions/automations/catalog/github-agents-md-maintainer/manifest.js +4 -1
  243. package/dist/node_modules/@openhands/extensions/automations/catalog/github-agents-md-maintainer/manifest.js.map +1 -1
  244. package/dist/node_modules/@openhands/extensions/automations/catalog/github-delivery-watchdog/manifest.cjs +2 -0
  245. package/dist/node_modules/@openhands/extensions/automations/catalog/github-delivery-watchdog/manifest.cjs.map +1 -0
  246. package/dist/node_modules/@openhands/extensions/automations/catalog/github-delivery-watchdog/manifest.js +79 -0
  247. package/dist/node_modules/@openhands/extensions/automations/catalog/github-delivery-watchdog/manifest.js.map +1 -0
  248. package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-to-pr/manifest.cjs +1 -11
  249. package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-to-pr/manifest.cjs.map +1 -1
  250. package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-to-pr/manifest.js +25 -11
  251. package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-to-pr/manifest.js.map +1 -1
  252. package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-triage/manifest.cjs +2 -0
  253. package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-triage/manifest.cjs.map +1 -0
  254. package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-triage/manifest.js +72 -0
  255. package/dist/node_modules/@openhands/extensions/automations/catalog/github-issue-triage/manifest.js.map +1 -0
  256. package/dist/node_modules/@openhands/extensions/automations/catalog/github-pr-reviewer/manifest.cjs +1 -10
  257. package/dist/node_modules/@openhands/extensions/automations/catalog/github-pr-reviewer/manifest.cjs.map +1 -1
  258. package/dist/node_modules/@openhands/extensions/automations/catalog/github-pr-reviewer/manifest.js +24 -11
  259. package/dist/node_modules/@openhands/extensions/automations/catalog/github-pr-reviewer/manifest.js.map +1 -1
  260. package/dist/node_modules/@openhands/extensions/automations/catalog/gitlab-issue-to-mr/manifest.cjs +12 -0
  261. package/dist/node_modules/@openhands/extensions/automations/catalog/gitlab-issue-to-mr/manifest.cjs.map +1 -0
  262. package/dist/node_modules/@openhands/extensions/automations/catalog/gitlab-issue-to-mr/manifest.js +115 -0
  263. package/dist/node_modules/@openhands/extensions/automations/catalog/gitlab-issue-to-mr/manifest.js.map +1 -0
  264. package/dist/node_modules/@openhands/extensions/automations/catalog-index.cjs +1 -1
  265. package/dist/node_modules/@openhands/extensions/automations/catalog-index.cjs.map +1 -1
  266. package/dist/node_modules/@openhands/extensions/automations/catalog-index.js +20 -14
  267. package/dist/node_modules/@openhands/extensions/automations/catalog-index.js.map +1 -1
  268. package/dist/node_modules/@openhands/extensions/integrations/catalog/reportportal.cjs +2 -0
  269. package/dist/node_modules/@openhands/extensions/integrations/catalog/reportportal.cjs.map +1 -0
  270. package/dist/node_modules/@openhands/extensions/integrations/catalog/reportportal.js +73 -0
  271. package/dist/node_modules/@openhands/extensions/integrations/catalog/reportportal.js.map +1 -0
  272. package/dist/node_modules/@openhands/extensions/integrations/catalog-index.cjs +1 -1
  273. package/dist/node_modules/@openhands/extensions/integrations/catalog-index.cjs.map +1 -1
  274. package/dist/node_modules/@openhands/extensions/integrations/catalog-index.js +9 -7
  275. package/dist/node_modules/@openhands/extensions/integrations/catalog-index.js.map +1 -1
  276. package/dist/node_modules/@openhands/extensions/skills/index.cjs +794 -227
  277. package/dist/node_modules/@openhands/extensions/skills/index.cjs.map +1 -1
  278. package/dist/node_modules/@openhands/extensions/skills/index.js +46 -6
  279. package/dist/node_modules/@openhands/extensions/skills/index.js.map +1 -1
  280. package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.cjs +1 -1
  281. package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.cjs.map +1 -1
  282. package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.js +9 -10
  283. package/dist/node_modules/@openhands/typescript-client/dist/client/openhands-client.js.map +1 -1
  284. package/dist/node_modules/@openhands/typescript-client/dist/client/settings-client.cjs +1 -1
  285. package/dist/node_modules/@openhands/typescript-client/dist/client/settings-client.cjs.map +1 -1
  286. package/dist/node_modules/@openhands/typescript-client/dist/client/settings-client.js +2 -2
  287. package/dist/node_modules/@openhands/typescript-client/dist/client/settings-client.js.map +1 -1
  288. package/dist/node_modules/@openhands/typescript-client/dist/clients.cjs +1 -1
  289. package/dist/node_modules/@openhands/typescript-client/dist/clients.js +0 -1
  290. package/dist/node_modules/@openhands/typescript-client/dist/conversation/conversation-manager.cjs +1 -1
  291. package/dist/node_modules/@openhands/typescript-client/dist/conversation/conversation-manager.js +0 -1
  292. package/dist/package.cjs +1 -1
  293. package/dist/package.cjs.map +1 -1
  294. package/dist/package.js +3 -3
  295. package/dist/package.js.map +1 -1
  296. package/dist/routes/agent-settings.d.ts +6 -0
  297. package/dist/types/automation.cjs.map +1 -1
  298. package/dist/types/automation.d.ts +3 -1
  299. package/dist/types/automation.js.map +1 -1
  300. package/package.json +3 -3
  301. package/scripts/check-sdk-version-sync.mjs +6 -6
  302. package/scripts/dev-safe.mjs +14 -1
  303. package/scripts/docker-build.mjs +3 -0
  304. package/build/assets/active-backend-context-BsLfwrXB.js +0 -2
  305. package/build/assets/agent-settings-BZJHtaIK.js +0 -2
  306. package/build/assets/agent-settings-D4snDd6u.js +0 -1
  307. package/build/assets/automation-setup-route-Cdc109ZD.js +0 -3
  308. package/build/assets/conversation-SouWlGvs.js +0 -1
  309. package/build/assets/conversation-panel-SouWlGvs.js +0 -1
  310. package/build/assets/edit-automation-modal-BJJR9wSW.js +0 -1
  311. package/build/assets/git-repo-dropdown-CbD0_LPN.js +0 -1
  312. package/build/assets/home-CXZ8zawS.js +0 -1
  313. package/build/assets/index-home-Ca6Q5CtT.js +0 -1
  314. package/build/assets/llm-not-configured-banner-DMdL1vaX.js +0 -27
  315. package/build/assets/llm-settings-lNDerSlu.js +0 -1
  316. package/build/assets/manifest-ff93dc8c.js +0 -1
  317. package/build/assets/use-create-conversation-Be-eVpFp.js +0 -1
  318. package/build/assets/use-create-secret-Bk9ZxTjl.js +0 -1
  319. package/build/assets/use-manifest-capabilities-Bso6A_-A.js +0 -1
  320. package/build/assets/use-tracking-ChnSFChv.js +0 -3
  321. package/build/assets/utils-D-gOfhmN.js +0 -1
  322. package/build/assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~b0x1wrp2-D6owle9R.js +0 -2
  323. package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.cjs +0 -2
  324. package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.cjs.map +0 -1
  325. package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.js +0 -18
  326. package/dist/node_modules/@openhands/typescript-client/dist/client/desktop-client.js.map +0 -1
@@ -1,3 +1,3 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{B as r,H as i,U as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{l as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as s}from"./useQuery-DAAacS7O.js";import{t as c}from"./useTranslation-CCgUjPJF.js";import{Q as l,ct as u,n as d,st as f}from"./active-backend-context-BsLfwrXB.js";import{K as p,a as m,t as h}from"./utils-D-gOfhmN.js";import{a as g,c as _,n as v}from"./agent-server-client-options-EHB23gyx.js";import{C as y,S as b,a as x,c as S,d as C,f as w,g as T,i as E,l as D,o as O,p as k,s as A,t as j}from"./automation-disabled-reason-DtgC8Ppt.js";import{r as M}from"./context-menu-list-item-lx2zk9G7.js";import{y as N}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~b0x1wrp2-D6owle9R.js";import{t as P}from"./proxy-DbEf3Nqr.js";import{n as F}from"./organization-service.api-DmFUEmu5.js";import{C as ee,P as I,n as L,t as R}from"./use-tracking-ChnSFChv.js";import{t as te}from"./use-settings-BWIH5EuN.js";import{r as z}from"./modal-classes-jvG85nkU.js";import{t as ne}from"./brand-button-mQq2Ld1I.js";import{n as re}from"./navigation-context-CQZwH_tC.js";import{n as ie}from"./use-create-conversation-Be-eVpFp.js";import{t as ae}from"./u-edit-DAkcF52u.js";import{t as B}from"./terminal-BUpID2wS.js";import{t as V}from"./toggle-switch-DeiG9Mf6.js";import{n as H,t as oe}from"./use-automation-health-DdgSa8sA.js";import{t as U}from"./automation-C_eCrGyP.js";import{i as se,l as ce,o as le,r as ue,u as de}from"./use-automations-CEubcYTD.js";import{t as fe}from"./use-user-conversation-C_l65DqW.js";import{n as W}from"./api-error-message-BXo0lCI5.js";import{t as pe}from"./x-mark-BopmFoBq.js";import{n as me,r as he,t as ge}from"./link-external-B4gx3EeM.js";import{t as _e}from"./edit-automation-modal-BJJR9wSW.js";import{n as ve,t as ye}from"./use-automation-permissions-D3kEeieu.js";import{n as be,t as xe}from"./trash-CXN2R54L.js";import{n as Se,r as Ce,t as we}from"./error-state-SuWwztxV.js";import{i as Te,r as Ee,t as De}from"./automation-export-Kv6e0bHx.js";import{a as G,i as Oe,n as K,r as q,t as ke}from"./cog-Dy1eWbSZ.js";var J=e(t());function Ae(e){let{backend:t,orgId:n}=d(),r=t.kind===`cloud`&&!!n&&!!e;return s({queryKey:[`cloud-org-member`,t.id,n,e,t.connectionRevision??0],queryFn:()=>F(n,e,t),enabled:r,staleTime:1e3*60*5,retry:!1,meta:{disableToast:!0}})}var Y=n(),X=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function je({active:e}){let{t}=c(`openhands`);return(0,Y.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:h(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e?`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`:`bg-surface-raised text-muted`),children:t(e?p.AUTOMATIONS$DETAIL$ACTIVE:p.AUTOMATIONS$DETAIL$INACTIVE)})}function Me({automation:e,onToggle:t,onEdit:n,onDelete:r,onExport:i,onDownloadTarball:a,onRunNow:o,isRunningNow:s=!1,canManage:l=!0,canToggle:u=l}){let{t:d}=c(`openhands`),f=[{label:d(p.AUTOMATIONS$EXPORT),icon:(0,Y.jsx)(X,{className:`size-4`}),onClick:i},{label:d(p.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,Y.jsx)(X,{className:`size-4`}),onClick:a},...l&&n?[{label:d(p.AUTOMATIONS$EDIT),icon:(0,Y.jsx)(ae,{className:`size-4`}),onClick:n}]:[],...u?[{label:e.enabled?d(p.AUTOMATIONS$TURN_OFF):d(p.AUTOMATIONS$TURN_ON),icon:(0,Y.jsx)(E,{className:`size-4`}),onClick:t}]:[],...l?[{label:d(p.AUTOMATIONS$DELETE),icon:(0,Y.jsx)(xe,{className:`size-4`}),onClick:r}]:[]];return(0,Y.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,Y.jsx)(je,{active:e.enabled})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&o&&(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:s||!e.enabled,onClick:o,children:[(0,Y.jsx)(x,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),d(s?p.AUTOMATIONS$STARTING:p.AUTOMATIONS$RUN_NOW)]}),u&&(0,Y.jsx)(V,{enabled:e.enabled,label:e.enabled?d(p.AUTOMATIONS$TURN_OFF):d(p.AUTOMATIONS$TURN_ON),onToggle:t}),(0,Y.jsx)(be,{items:f})]})]})})}function Ne({automation:e}){let{t,i18n:n}=c(`openhands`),r=j(e,t);if(!r)return null;let i=!k(e.disabled_at);return(0,Y.jsxs)(`div`,{"data-testid":`automation-disabled-reason-banner`,className:`flex flex-col gap-2 rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)] px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(he,{className:`size-4 shrink-0 text-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t(p.AUTOMATIONS$DETAIL$DISABLED_REASON_HEADING)})]}),(0,Y.jsx)(`p`,{"data-testid":`automation-disabled-reason-text`,className:`text-sm leading-5 text-[var(--oh-text-secondary)]`,children:r.text}),i?(0,Y.jsx)(`p`,{"data-testid":`automation-disabled-reason-timestamp`,className:`text-xs text-muted`,children:t(p.AUTOMATIONS$DETAIL$DISABLED_AT,{time:w(e.disabled_at,n.language,t)})}):null]})}var Pe=240,Fe=`max-h-60`;function Ie({prompt:e}){let{t}=c(`openhands`),[n,r]=J.useState(!1),[i,a]=J.useState(!1),o=J.useRef(null),s=i&&!n;return J.useLayoutEffect(()=>{let e=o.current;if(!e)return;let t=()=>{a(e.scrollHeight>Pe)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,Y.jsx)(q,{icon:(0,Y.jsx)(B,{className:`size-4`}),title:t(p.AUTOMATIONS$DETAIL$PROMPT),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`p`,{ref:o,className:h(`whitespace-pre-wrap text-sm leading-6 text-content`,s&&h(Fe,`overflow-hidden`)),"data-testid":`automation-prompt-content`,children:e}),s?(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-[var(--oh-surface)] to-transparent`,"aria-hidden":!0,"data-testid":`automation-prompt-fade`}):null]}),i?(0,Y.jsx)(`button`,{type:`button`,className:`self-start cursor-pointer text-sm font-normal text-[var(--oh-muted)] hover:text-white`,onClick:()=>r(e=>!e),"data-testid":`automation-prompt-toggle`,children:t(n?p.COMMON$VIEW_LESS:p.COMMON$VIEW_MORE)}):null]})})}var Le=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),Re=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Y.jsx)(`path`,{d:`M12 4C9.79086 4 8 5.79086 8 8C8 10.2091 9.79086 12 12 12C14.2091 12 16 10.2091 16 8C16 5.79086 14.2091 4 12 4ZM6 8C6 4.68629 8.68629 2 12 2C15.3137 2 18 4.68629 18 8C18 11.3137 15.3137 14 12 14C8.68629 14 6 11.3137 6 8ZM8 18C6.34315 18 5 19.3431 5 21C5 21.5523 4.55228 22 4 22C3.44772 22 3 21.5523 3 21C3 18.2386 5.23858 16 8 16H16C18.7614 16 21 18.2386 21 21C21 21.5523 20.5523 22 20 22C19.4477 22 19 21.5523 19 21C19 19.3431 17.6569 18 16 18H8Z`,fill:`currentColor`})}),ze=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function Be({branch:e}){return(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}var Ve=60;function He({filter:e}){let{t}=c(`openhands`),[n,r]=(0,J.useState)(!1),i=e.length>Ve;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:i&&!n?`${e.slice(0,Ve)}…`:e}),i&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`text-xs text-muted hover:text-content self-start`,children:t(n?p.SETTINGS$SKILLS_SHOW_LESS:p.SETTINGS$SKILLS_SHOW_MORE)})]})}function Ue({automation:e,runsAs:t}){let{t:n}=c(`openhands`),r=e.trigger.type===`event`,i=e.trigger.schedule??``;e.trigger.schedule_human&&(i=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let a=n(r?p.AUTOMATIONS$DETAIL$TRIGGER_EVENT:p.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);return(0,Y.jsx)(q,{icon:(0,Y.jsx)(ke,{className:`size-4`}),title:n(p.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Oe,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,Y.jsx)(Be,{branch:e.branch})]})}),(0,Y.jsx)(K,{icon:(0,Y.jsx)(A,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$TRIGGER),children:a}),!r&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Le,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$SCHEDULE),children:i}),r&&e.trigger.source&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),label:n(p.AUTOMATIONS$DETAIL$EVENT_SOURCE),children:e.trigger.source}),r&&e.trigger.on&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(ge,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$EVENT_TYPE),children:T(e.trigger.on)}),r&&e.trigger.filter&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(me,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$EVENT_FILTER),children:(0,Y.jsx)(He,{filter:e.trigger.filter})}),t&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Re,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$RUNS_AS),children:(0,Y.jsx)(`span`,{className:`break-all`,children:t})}),(0,Y.jsx)(K,{icon:(0,Y.jsx)(y,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$MODEL),children:e.model??n(p.COMMON$ACTIVE_PROFILE)}),e.notification&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(ze,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var We=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function Ge({name:e}){return(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function Ke({plugins:e}){let{t}=c(`openhands`);return(0,Y.jsx)(q,{icon:(0,Y.jsx)(We,{className:`size-4`}),title:t(p.AUTOMATIONS$DETAIL$PLUGINS),children:(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,Y.jsx)(Ge,{name:e},e))})})}var qe=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function Je({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=c(`openhands`),i=r.language;return(0,Y.jsx)(q,{icon:(0,Y.jsx)(qe,{className:`size-4`}),title:n(p.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,Y.jsx)(K,{icon:(0,Y.jsx)(Le,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$CREATED),children:C(e,i)}),(0,Y.jsx)(K,{icon:(0,Y.jsx)(H,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$LAST_RUN),children:t?w(t,i,n):n(p.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var Ye=100,Xe=[`run_id`,`automation_id`,`automation_name`,`trigger`,`start_time`,`end_time`,`duration_seconds`,`status`,`conversation_id`,`conversation_url`,`error`,`cost`,`phase`];function Ze(e,t){return`${e.name.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||e.id}.activity-log.${t}`}function Qe(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function $e(e){let t=[Xe.join(`,`)];for(let n of e){let e=Xe.map(e=>{let t=n[e];return t==null?``:Qe(e===`trigger`?JSON.stringify(t):String(t))});t.push(e.join(`,`))}return`${t.join(`
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{B as r,H as i,U as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{l as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as s}from"./useQuery-DAAacS7O.js";import{t as c}from"./useTranslation-CCgUjPJF.js";import{Q as l,ct as u,n as d,st as f}from"./active-backend-context-BETEdaJl.js";import{K as p,a as m,t as h}from"./utils-CbjwNcR-.js";import{a as g,c as _,n as v}from"./agent-server-client-options-EHB23gyx.js";import{C as y,S as b,a as x,c as S,d as C,f as w,g as T,i as E,l as D,o as O,p as k,s as A,t as j}from"./automation-disabled-reason-QFtMrdOr.js";import{r as M}from"./context-menu-list-item-DIm5xQg6.js";import{y as N}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~b0x1wrp2-DvZtOcoT.js";import{t as P}from"./proxy-BCCQUna8.js";import{n as F}from"./organization-service.api-zhHpQU0t.js";import{C as ee,P as I,n as L,t as R}from"./use-tracking-BAFpgpgq.js";import{t as te}from"./use-settings-D69cw06D.js";import{r as z}from"./modal-classes-BPcBCWVj.js";import{t as ne}from"./brand-button-CGUwj6zK.js";import{n as re}from"./navigation-context-CQZwH_tC.js";import{n as ie}from"./use-create-conversation-D15Px574.js";import{t as ae}from"./u-edit-DAkcF52u.js";import{t as B}from"./terminal-BUpID2wS.js";import{t as V}from"./toggle-switch-D3TBxlsc.js";import{n as H,t as oe}from"./use-automation-health-CbQ9n-k7.js";import{t as U}from"./automation-C_eCrGyP.js";import{i as se,l as ce,o as le,r as ue,u as de}from"./use-automations-7_XBXHQK.js";import{t as fe}from"./use-user-conversation-BBDXUbOc.js";import{n as W}from"./api-error-message-BXo0lCI5.js";import{t as pe}from"./x-mark-BopmFoBq.js";import{n as me,r as he,t as ge}from"./link-external-B4gx3EeM.js";import{t as _e}from"./edit-automation-modal-bfD-5NIc.js";import{n as ve,t as ye}from"./use-automation-permissions-gFy-2VD0.js";import{n as be,t as xe}from"./trash-D1QMHInX.js";import{n as Se,r as Ce,t as we}from"./error-state-BgYl7YeB.js";import{i as Te,r as Ee,t as De}from"./automation-export-CkvehhPF.js";import{a as G,i as Oe,n as K,r as q,t as ke}from"./cog-DVZT1f0s.js";var J=e(t());function Ae(e){let{backend:t,orgId:n}=d(),r=t.kind===`cloud`&&!!n&&!!e;return s({queryKey:[`cloud-org-member`,t.id,n,e,t.connectionRevision??0],queryFn:()=>F(n,e,t),enabled:r,staleTime:1e3*60*5,retry:!1,meta:{disableToast:!0}})}var Y=n(),X=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function je({active:e}){let{t}=c(`openhands`);return(0,Y.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:h(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e?`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`:`bg-surface-raised text-muted`),children:t(e?p.AUTOMATIONS$DETAIL$ACTIVE:p.AUTOMATIONS$DETAIL$INACTIVE)})}function Me({automation:e,onToggle:t,onEdit:n,onDelete:r,onExport:i,onDownloadTarball:a,onRunNow:o,isRunningNow:s=!1,canManage:l=!0,canToggle:u=l}){let{t:d}=c(`openhands`),f=[{label:d(p.AUTOMATIONS$EXPORT),icon:(0,Y.jsx)(X,{className:`size-4`}),onClick:i},{label:d(p.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,Y.jsx)(X,{className:`size-4`}),onClick:a},...l&&n?[{label:d(p.AUTOMATIONS$EDIT),icon:(0,Y.jsx)(ae,{className:`size-4`}),onClick:n}]:[],...u?[{label:e.enabled?d(p.AUTOMATIONS$TURN_OFF):d(p.AUTOMATIONS$TURN_ON),icon:(0,Y.jsx)(E,{className:`size-4`}),onClick:t}]:[],...l?[{label:d(p.AUTOMATIONS$DELETE),icon:(0,Y.jsx)(xe,{className:`size-4`}),onClick:r}]:[]];return(0,Y.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,Y.jsx)(je,{active:e.enabled})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&o&&(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:s||!e.enabled,onClick:o,children:[(0,Y.jsx)(x,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),d(s?p.AUTOMATIONS$STARTING:p.AUTOMATIONS$RUN_NOW)]}),u&&(0,Y.jsx)(V,{enabled:e.enabled,label:e.enabled?d(p.AUTOMATIONS$TURN_OFF):d(p.AUTOMATIONS$TURN_ON),onToggle:t}),(0,Y.jsx)(be,{items:f})]})]})})}function Ne({automation:e}){let{t,i18n:n}=c(`openhands`),r=j(e,t);if(!r)return null;let i=!k(e.disabled_at);return(0,Y.jsxs)(`div`,{"data-testid":`automation-disabled-reason-banner`,className:`flex flex-col gap-2 rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)] px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(he,{className:`size-4 shrink-0 text-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t(p.AUTOMATIONS$DETAIL$DISABLED_REASON_HEADING)})]}),(0,Y.jsx)(`p`,{"data-testid":`automation-disabled-reason-text`,className:`text-sm leading-5 text-[var(--oh-text-secondary)]`,children:r.text}),i?(0,Y.jsx)(`p`,{"data-testid":`automation-disabled-reason-timestamp`,className:`text-xs text-muted`,children:t(p.AUTOMATIONS$DETAIL$DISABLED_AT,{time:w(e.disabled_at,n.language,t)})}):null]})}var Pe=240,Fe=`max-h-60`;function Ie({prompt:e}){let{t}=c(`openhands`),[n,r]=J.useState(!1),[i,a]=J.useState(!1),o=J.useRef(null),s=i&&!n;return J.useLayoutEffect(()=>{let e=o.current;if(!e)return;let t=()=>{a(e.scrollHeight>Pe)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,Y.jsx)(q,{icon:(0,Y.jsx)(B,{className:`size-4`}),title:t(p.AUTOMATIONS$DETAIL$PROMPT),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`p`,{ref:o,className:h(`whitespace-pre-wrap text-sm leading-6 text-content`,s&&h(Fe,`overflow-hidden`)),"data-testid":`automation-prompt-content`,children:e}),s?(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-[var(--oh-surface)] to-transparent`,"aria-hidden":!0,"data-testid":`automation-prompt-fade`}):null]}),i?(0,Y.jsx)(`button`,{type:`button`,className:`self-start cursor-pointer text-sm font-normal text-[var(--oh-muted)] hover:text-white`,onClick:()=>r(e=>!e),"data-testid":`automation-prompt-toggle`,children:t(n?p.COMMON$VIEW_LESS:p.COMMON$VIEW_MORE)}):null]})})}var Le=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),Re=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Y.jsx)(`path`,{d:`M12 4C9.79086 4 8 5.79086 8 8C8 10.2091 9.79086 12 12 12C14.2091 12 16 10.2091 16 8C16 5.79086 14.2091 4 12 4ZM6 8C6 4.68629 8.68629 2 12 2C15.3137 2 18 4.68629 18 8C18 11.3137 15.3137 14 12 14C8.68629 14 6 11.3137 6 8ZM8 18C6.34315 18 5 19.3431 5 21C5 21.5523 4.55228 22 4 22C3.44772 22 3 21.5523 3 21C3 18.2386 5.23858 16 8 16H16C18.7614 16 21 18.2386 21 21C21 21.5523 20.5523 22 20 22C19.4477 22 19 21.5523 19 21C19 19.3431 17.6569 18 16 18H8Z`,fill:`currentColor`})}),ze=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function Be({branch:e}){return(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}var Ve=60;function He({filter:e}){let{t}=c(`openhands`),[n,r]=(0,J.useState)(!1),i=e.length>Ve;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:i&&!n?`${e.slice(0,Ve)}…`:e}),i&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`text-xs text-muted hover:text-content self-start`,children:t(n?p.SETTINGS$SKILLS_SHOW_LESS:p.SETTINGS$SKILLS_SHOW_MORE)})]})}function Ue({automation:e,runsAs:t}){let{t:n}=c(`openhands`),r=e.trigger.type===`event`,i=e.trigger.schedule??``;e.trigger.schedule_human&&(i=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let a=n(r?p.AUTOMATIONS$DETAIL$TRIGGER_EVENT:p.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);return(0,Y.jsx)(q,{icon:(0,Y.jsx)(ke,{className:`size-4`}),title:n(p.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Oe,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,Y.jsx)(Be,{branch:e.branch})]})}),(0,Y.jsx)(K,{icon:(0,Y.jsx)(A,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$TRIGGER),children:a}),!r&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Le,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$SCHEDULE),children:i}),r&&e.trigger.source&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),label:n(p.AUTOMATIONS$DETAIL$EVENT_SOURCE),children:e.trigger.source}),r&&e.trigger.on&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(ge,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$EVENT_TYPE),children:T(e.trigger.on)}),r&&e.trigger.filter&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(me,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$EVENT_FILTER),children:(0,Y.jsx)(He,{filter:e.trigger.filter})}),t&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(Re,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$RUNS_AS),children:(0,Y.jsx)(`span`,{className:`break-all`,children:t})}),(0,Y.jsx)(K,{icon:(0,Y.jsx)(y,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$MODEL),children:e.model??n(p.COMMON$ACTIVE_PROFILE)}),e.notification&&(0,Y.jsx)(K,{icon:(0,Y.jsx)(ze,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var We=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function Ge({name:e}){return(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function Ke({plugins:e}){let{t}=c(`openhands`);return(0,Y.jsx)(q,{icon:(0,Y.jsx)(We,{className:`size-4`}),title:t(p.AUTOMATIONS$DETAIL$PLUGINS),children:(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,Y.jsx)(Ge,{name:e},e))})})}var qe=e=>(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,Y.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function Je({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=c(`openhands`),i=r.language;return(0,Y.jsx)(q,{icon:(0,Y.jsx)(qe,{className:`size-4`}),title:n(p.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,Y.jsx)(K,{icon:(0,Y.jsx)(Le,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$CREATED),children:C(e,i)}),(0,Y.jsx)(K,{icon:(0,Y.jsx)(H,{className:`size-3.5`}),label:n(p.AUTOMATIONS$DETAIL$LAST_RUN),children:t?w(t,i,n):n(p.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var Ye=100,Xe=[`run_id`,`automation_id`,`automation_name`,`trigger`,`start_time`,`end_time`,`duration_seconds`,`status`,`conversation_id`,`conversation_url`,`error`,`cost`,`phase`];function Ze(e,t){return`${e.name.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||e.id}.activity-log.${t}`}function Qe(e){return/[",\n\r]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function $e(e){let t=[Xe.join(`,`)];for(let n of e){let e=Xe.map(e=>{let t=n[e];return t==null?``:Qe(e===`trigger`?JSON.stringify(t):String(t))});t.push(e.join(`,`))}return`${t.join(`
2
2
  `)}\n`}function et(e,t){if(!e)return null;let n=`/conversations/${e}`;return t?`${t.replace(/\/$/,``)}${n}`:n}function tt(e,t,n){let r=e.started_at||null,i=e.completed_at,a=null;return r&&i&&(a=(new Date(i).getTime()-new Date(r).getTime())/1e3),{run_id:e.id,automation_id:t.id,automation_name:t.name,trigger:t.trigger,start_time:r,end_time:i,duration_seconds:a,status:e.status,conversation_id:e.conversation_id,conversation_url:et(e.conversation_id,n),error:e.error_detail,cost:e.cost??null,phase:e.phase_code?.trim()||e.phase_label?.trim()||null}}async function nt(e,t){let n=[],r=0,i=1/0;for(;r<i;){let a=await L.listAutomationRuns(e.id,{limit:Ye,offset:r});for(let r of a.runs)n.push(tt(r,e,t));if(i=a.total,r+=a.runs.length,a.runs.length===0)break}return n}async function rt(e){let{automation:t,format:n,conversationBaseUrl:r}=e,i=await nt(t,r);if(n===`json`){m(new Blob([`${JSON.stringify({runs:i,total:i.length},null,2)}\n`],{type:`application/json`}),Ze(t,`json`));return}m(new Blob([$e(i)],{type:`text/csv;charset=utf-8`}),Ze(t,`csv`))}var it=20;function at(e){return e.kind===`BashOutput`}var ot=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<it;o+=1){let o=await e.searchEvents(t,n,{kind__eq:`BashOutput`,command_id__eq:r,sort_order:`TIMESTAMP`,...a?{page_id:a}:{}});if(o.items.forEach(e=>{at(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=_().backend;if(r.kind===`cloud`){if(!e)throw Error(`BashService.listOutputs requires a conversation URL on cloud backends`);let i=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{t!=null&&i.set(e,String(t))}),P({backend:r,method:`GET`,hostOverride:g(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new N(v({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},st=[`bash-command-logs`];function ct(e){switch(e){case`MISSING`:return`missing`;case`PAUSED`:return`paused`;case`STARTING`:return`starting`;case`ERROR`:return`errored`;case`RUNNING`:case null:case void 0:default:return null}}function lt(e){let t=o.isAxiosError(e)?e.response?.status:l(e)?e.status:void 0;if(t!==void 0)return t===404||t>=500?`unreachable`:null;if(o.isAxiosError(e)||e instanceof TypeError)return`unreachable`;if(e instanceof Error){let t=e.cause instanceof Error?e.cause.name:null;if(e.name===`AbortError`||e.name===`TimeoutError`||t===`AbortError`||t===`TimeoutError`)return`unreachable`}return null}function ut(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,i=d(),a=fe(r?t??null:null),o=a.data,c=o?.conversation_url??null,l=o?.session_api_key??null,u=i.backend.kind===`cloud`,f=a.isFetched,p=null,m=!1;u&&f&&(o?p=ct(o.sandbox_status)??(o.conversation_url?null:`missing`):m=!0);let h=r&&!!n&&(u?!!c:!0)&&!p&&!m,g=s({queryKey:[...st,n,c,l,i.backend.id,i.orgId],queryFn:()=>ot.listOutputs(c,l,n),enabled:h,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?lt(g.error):null,v=p??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&a.isPending,conversationMissing:m,sandboxIssue:v}}var dt=4e3;function ft(e,t){return e.length<=t?e:`…(truncated)…\n${e.slice(e.length-t)}`}function pt({automationName:e,automationPrompt:t,errorDetail:n,stderr:r,runId:i}){let a=r?.trim()||n?.trim()||``,o=a?ft(a,dt):`No error output was captured for this run.`,s=e?.trim(),c=[`${s?`The scheduled automation "${s}" failed during a run.`:`A scheduled automation failed during a run.`} Please investigate the error and fix the root cause.`],l=t?.trim();return l&&c.push(``,`What the automation was set up to do:`,l),c.push(``,`Error output from the failed run (run ${i}):`,o,``,`Please diagnose why it failed and propose or implement a fix.`),c.join(`
3
3
  `)}function mt({run:e,automation:t,stderr:n}){let{t:r}=c(`openhands`),{navigate:i}=re(),a=ie();return(0,Y.jsx)(ne,{testId:`debug-automation-button`,type:`button`,variant:`primary`,onClick:()=>{if(a.isPending)return;let r=pt({automationName:t?.name,automationPrompt:t?.prompt,errorDetail:e.error_detail,stderr:n,runId:e.id});a.mutate({query:r},{onSuccess:e=>{i(`/conversations/${e.conversation_id}`)}})},isDisabled:a.isPending,"aria-busy":a.isPending,children:r(p.AUTOMATIONS$DETAIL$DEBUG_WITH_OPENHANDS)})}var ht={missing:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_MISSING,paused:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_PAUSED,starting:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_STARTING,errored:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_ERROR,unreachable:p.AUTOMATIONS$DETAIL$LOGS_SANDBOX_UNREACHABLE};function gt(e,t){return[...e].sort((e,t)=>{let n=e.timestamp.localeCompare(t.timestamp);return n===0?(e.order??0)-(t.order??0):n}).map(e=>e[t]??``).join(``)}function Z(e){return typeof e==`string`?e.trim()||null:typeof e==`number`||typeof e==`boolean`?String(e):null}function _t(e){if(!e)return null;let t=Z(e.formatted_detail)??Z(e.detail),n=[Z(e.phase),Z(e.kind),Z(e.source),Z(e.operation),Z(e.code),Z(e.status_code)].filter(Boolean);return t&&n.length>0?`${t} (${n.join(` · `)})`:t||(n.length>0?n.join(` · `):JSON.stringify(e))}function vt({run:e}){let{t}=c(`openhands`);if(!e)return null;let n=b(e),r=n.taskOutcome?.outcomeSummary??null,i=n.customTaskMetadataText,a=e.status===U.COMPLETED||n.taskOutcome?n.badgeStatus:null,o=e.error_detail?.trim()||null,s=_t(e.status_detail),l=o||s;return(0,Y.jsxs)(`dl`,{className:`mt-4 grid gap-3 rounded-lg border border-[var(--oh-border)] bg-black/20 p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[5rem_minmax(0,1fr)] sm:items-center`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$RUN_LABEL)}),(0,Y.jsx)(`dd`,{children:(0,Y.jsx)(`span`,{className:`inline-flex rounded-md bg-surface-raised px-2 py-0.5 font-mono text-[10px] font-medium text-muted`,children:e.status})})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[5rem_minmax(0,1fr)] sm:items-start`,children:[(0,Y.jsx)(`dt`,{className:`pt-0.5 text-muted`,children:t(p.AUTOMATIONS$DETAIL$TASK_LABEL)}),(0,Y.jsxs)(`dd`,{className:`min-w-0 space-y-2`,children:[a?(0,Y.jsx)(O,{status:a,compact:!0}):null,r?(0,Y.jsx)(`p`,{className:`break-words text-content`,children:r}):i?(0,Y.jsx)(`p`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$CUSTOM_TASK_METADATA)}):(0,Y.jsx)(`p`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$NO_TASK_OUTCOME)}),i?(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Y.jsx)(`p`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$TASK_METADATA)}),(0,Y.jsx)(`pre`,{"data-testid":`automation-task-metadata`,className:`max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md border border-[var(--oh-border)] bg-black/30 p-2 font-mono text-[11px] leading-4 text-content`,children:i})]}):null]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[5rem_minmax(0,1fr)] sm:items-start`,children:[(0,Y.jsx)(`dt`,{className:`pt-0.5 text-muted`,children:t(p.AUTOMATIONS$DETAIL$SYSTEM_LABEL)}),(0,Y.jsx)(`dd`,{className:`min-w-0 space-y-1 break-words text-content`,children:l?(0,Y.jsxs)(Y.Fragment,{children:[o?(0,Y.jsxs)(`p`,{children:[(0,Y.jsxs)(`span`,{className:`text-muted`,children:[t(p.COMMON$ERROR),`:`,` `]}),o]}):null,s?(0,Y.jsxs)(`p`,{children:[(0,Y.jsxs)(`span`,{className:`text-muted`,children:[t(p.AUTOMATIONS$DETAIL$STATUS_DETAIL),`:`,` `]}),s]}):null]}):(0,Y.jsx)(`p`,{className:`text-muted`,children:t(p.AUTOMATIONS$DETAIL$NO_SYSTEM_ISSUES)})})]})]})}function yt({conversationId:e,bashCommandId:t,isOpen:n,onClose:r,run:i,automation:a}){let{t:o}=c(`openhands`),[s,l]=(0,J.useState)(`stdout`),{data:u,isFetching:d,isResolvingConversation:f,sandboxIssue:m,conversationMissing:g,error:_}=ut({conversationId:e,bashCommandId:t,enabled:n});(0,J.useEffect)(()=>{n&&l(`stdout`)},[n,t]),(0,J.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,r]);let{stdout:v,stderr:y}=(0,J.useMemo)(()=>u?{stdout:gt(u,`stdout`),stderr:gt(u,`stderr`)}:{stdout:``,stderr:``},[u]);if(!n)return null;let b=f||d&&!u,x=!t,S=s===`stdout`?v:y,C=`border-b-2 px-3 py-2 text-sm font-normal transition-colors focus:outline-none`,w=`border-[var(--oh-primary)] text-white`,T=`border-transparent text-muted hover:text-content`;return(0,Y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":o(p.AUTOMATIONS$DETAIL$LOGS_TITLE),children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,Y.jsxs)(`div`,{className:`relative flex max-h-[80vh] w-full max-w-3xl flex-col rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":o(p.AUTOMATIONS$CANCEL),children:(0,Y.jsx)(pe,{className:`size-5`})}),(0,Y.jsx)(`h2`,{className:h(`pr-8`,z),children:o(p.AUTOMATIONS$DETAIL$LOGS_TITLE)}),(0,Y.jsx)(vt,{run:i}),(0,Y.jsxs)(`div`,{role:`tablist`,"aria-label":o(p.AUTOMATIONS$DETAIL$LOGS_TITLE),className:`mt-4 flex gap-1 border-b border-[var(--oh-border)]`,children:[(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":s===`stdout`,"aria-controls":`run-logs-panel-stdout`,id:`run-logs-tab-stdout`,tabIndex:s===`stdout`?0:-1,onClick:()=>l(`stdout`),className:`${C} ${s===`stdout`?w:T}`,children:o(p.AUTOMATIONS$DETAIL$LOGS_TAB_OUTPUT)}),(0,Y.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":s===`stderr`,"aria-controls":`run-logs-panel-stderr`,id:`run-logs-tab-stderr`,tabIndex:s===`stderr`?0:-1,onClick:()=>l(`stderr`),className:`${C} ${s===`stderr`?w:T}`,children:o(p.AUTOMATIONS$DETAIL$LOGS_TAB_ERROR)})]}),(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`run-logs-panel-${s}`,"aria-labelledby":`run-logs-tab-${s}`,className:`mt-3 min-h-[12rem] flex-1 overflow-auto rounded-lg border border-[var(--oh-border)] bg-black/40 p-4 font-mono text-xs`,children:[x&&(0,Y.jsx)(`p`,{className:`text-muted italic`,children:o(p.AUTOMATIONS$DETAIL$LOGS_NO_COMMAND)}),!x&&g&&(0,Y.jsx)(`p`,{className:`text-muted italic`,children:o(p.AUTOMATIONS$DETAIL$LOGS_CONVERSATION_MISSING)}),!x&&!g&&m&&(0,Y.jsx)(`p`,{"data-testid":`run-logs-sandbox-issue-${m}`,className:`text-muted italic`,children:o(ht[m])}),!x&&!g&&!m&&b&&(0,Y.jsx)(`p`,{className:`text-muted italic`,children:o(p.AUTOMATIONS$DETAIL$LOGS_LOADING)}),!x&&!g&&!m&&!b&&_&&!u&&(0,Y.jsxs)(`p`,{className:`text-danger`,children:[o(p.AUTOMATIONS$DETAIL$LOGS_ERROR),`: `,String(_)]}),!b&&!m&&u&&(0,Y.jsx)(`pre`,{"data-testid":`run-logs-output-${s}`,className:`whitespace-pre-wrap break-words ${s===`stderr`?`text-danger`:`text-content`}`,children:S.length>0?S:(0,Y.jsx)(`span`,{className:`text-muted italic`,children:o(p.AUTOMATIONS$DETAIL$LOGS_EMPTY)})})]}),i?.status===U.FAILED&&(0,Y.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,Y.jsx)(mt,{run:i,automation:a,stderr:y})})]})]})}function bt(e,t){return new Date(e).toLocaleDateString(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function xt(e){return`/conversations/${e}`}function St(e){return typeof e!=`number`||!Number.isFinite(e)?null:`$${e.toFixed(4)}`}function Ct({run:e,automation:t}){let{t:n,i18n:r}=c(`openhands`),i=!!e.conversation_id,a=!!e.bash_command_id,o=e.status===U.COMPLETED||e.status===U.FAILED||e.status===U.CANCELLED||e.status===U.SKIPPED,s=!i&&o,l=D(e.status),[u,d]=(0,J.useState)(!1),[f]=(0,J.useState)(()=>new Date().toISOString()),m=bt(k(e.started_at)?f:e.started_at,r.language),h=St(e.cost),g=b(e),_=a?(0,Y.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),e.preventDefault(),d(!0)},className:`rounded-md p-1 text-muted hover:bg-surface-raised hover:text-foreground focus:bg-surface-raised focus:outline-none`,"aria-label":n(p.AUTOMATIONS$DETAIL$LOGS_VIEW,{timestamp:m}),title:n(p.AUTOMATIONS$DETAIL$LOGS_VIEW_SHORT),children:(0,Y.jsx)(B,{className:`size-4`})}):null,v=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-content`,children:m}),s&&(0,Y.jsx)(`span`,{className:`text-xs text-muted`,children:n(p.AUTOMATIONS$DETAIL$NO_CONVERSATION)})]}),g.summary?(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted`,children:g.summary}):null]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h&&(0,Y.jsx)(`span`,{"data-testid":`run-cost`,title:n(p.AUTOMATIONS$DETAIL$RUN_COST),className:`text-xs tabular-nums text-muted`,children:h}),_,l&&(0,Y.jsx)(S,{status:e.status,code:e.phase_code,label:e.phase_label,updatedAt:e.phase_updated_at,wide:!0}),(0,Y.jsx)(O,{status:g.badgeStatus})]})]});return(0,Y.jsxs)(Y.Fragment,{children:[i&&e.conversation_id?(0,Y.jsx)(`a`,{href:xt(e.conversation_id),className:`flex items-center justify-between px-5 py-3 transition-colors cursor-pointer hover:bg-surface-raised focus:bg-surface-raised focus:outline-none`,"aria-label":n(p.AUTOMATIONS$DETAIL$VIEW_CONVERSATION_FOR_RUN,{timestamp:m}),children:v}):(0,Y.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 cursor-default`,children:v}),a&&(0,Y.jsx)(yt,{conversationId:e.conversation_id,bashCommandId:e.bash_command_id,isOpen:u,onClose:()=>d(!1),run:e,automation:t})]})}var Q=20,wt=100;function Tt({automation:e,highlightedRunId:t=null}){let{t:n}=c(`openhands`),r=d(),{trackAutomationActivityLogExported:i}=R(),[a,o]=(0,J.useState)(Q),s=(0,J.useRef)(null),[l,u]=(0,J.useState)(!1),{data:m,isLoading:g}=de({id:e.id,limit:a,offset:0}),_=m?m.total>m.runs.length:!1,v=!g&&(m?.total??0)>0&&!l,y=async t=>{if(v){u(!0);try{await rt({automation:e,format:t,conversationBaseUrl:window.location.origin}),i({backendKind:r.backend.kind,format:t})}catch(e){f(W(e,n(p.AUTOMATIONS$DETAIL$EXPORT_ACTIVITY_LOG_ERROR)))}finally{u(!1)}}};return(0,J.useEffect)(()=>{if(!(!t||!m?.runs.length)){if(m.runs.findIndex(e=>e.id===t)<0){_&&a<wt&&o(e=>e+Q);return}s.current?.scrollIntoView({behavior:`smooth`,block:`center`})}},[m?.runs,_,t,a]),(0,Y.jsxs)(`div`,{"data-testid":`automation-activity-log`,className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,Y.jsx)(`span`,{className:`size-4 text-muted`,children:(0,Y.jsx)(qe,{className:`size-4`})}),(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:n(p.AUTOMATIONS$DETAIL$ACTIVITY_LOG)}),(0,Y.jsxs)(`div`,{className:`ml-auto flex items-center gap-3`,children:[(0,Y.jsx)(`button`,{type:`button`,"data-testid":`activity-log-export-json`,disabled:!v,onClick:()=>void y(`json`),className:`text-sm text-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,children:n(p.AUTOMATIONS$DETAIL$EXPORT_JSON)}),(0,Y.jsx)(`button`,{type:`button`,"data-testid":`activity-log-export-csv`,disabled:!v,onClick:()=>void y(`csv`),className:`text-sm text-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,children:n(p.AUTOMATIONS$DETAIL$EXPORT_CSV)})]})]}),g&&(0,Y.jsx)(`div`,{className:`space-y-1 p-5`,children:Array.from({length:3}).map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,Y.jsx)(`div`,{className:`h-5 w-64 animate-pulse rounded bg-surface-raised`}),(0,Y.jsx)(`div`,{className:`h-6 w-24 animate-pulse rounded-full bg-surface-raised`})]},`skeleton-${t}`))}),!g&&m?.runs.length===0&&(0,Y.jsx)(`p`,{className:`px-5 py-8 text-center text-sm text-muted`,children:n(p.AUTOMATIONS$DETAIL$NO_RUNS)}),!g&&m&&m.runs.length>0&&(0,Y.jsxs)(`div`,{children:[m.runs.map((n,r)=>{let i=n.id===t;return(0,Y.jsx)(`div`,{ref:i?s:void 0,"data-testid":i?`automation-run-highlight-${n.id}`:void 0,className:h(r>0?`border-t border-[var(--oh-border)]`:``,i&&`bg-[var(--oh-focus)]/10`),children:(0,Y.jsx)(Ct,{run:n,automation:e})},n.id)}),_&&(0,Y.jsx)(`div`,{className:`border-t border-[var(--oh-border)] px-5 py-3`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(e=>e+Q),className:`text-sm text-muted hover:text-foreground`,children:n(p.AUTOMATIONS$DETAIL$LOAD_MORE_RUNS)})})]})]})}function $({className:e}){return(0,Y.jsx)(`div`,{className:h(`animate-pulse rounded bg-surface-raised`,e)})}function Et(){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`detail-skeleton`,children:[(0,Y.jsx)($,{className:`h-5 w-40`}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)($,{className:`h-6 w-48`}),(0,Y.jsx)($,{className:`h-6 w-16 rounded-full`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)($,{className:`h-6 w-11 rounded-full`}),(0,Y.jsx)($,{className:`h-8 w-8`})]})]}),(0,Y.jsx)($,{className:`h-5 w-96`}),(0,Y.jsx)($,{className:`h-36 w-full rounded-2xl`}),(0,Y.jsx)($,{className:`h-72 w-full rounded-2xl`}),(0,Y.jsx)($,{className:`h-32 w-full rounded-2xl`}),(0,Y.jsx)($,{className:`h-40 w-full rounded-2xl`})]})}function Dt(){let{t:e}=c(`openhands`);return(0,Y.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,Y.jsx)(Ce,{className:`size-12 text-muted`}),(0,Y.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(p.AUTOMATIONS$DETAIL$NOT_FOUND_TITLE)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(p.AUTOMATIONS$DETAIL$NOT_FOUND_MESSAGE)}),(0,Y.jsx)(`div`,{className:`mt-6`,children:(0,Y.jsx)(G,{})})]})}var Ot={id:``,name:``,prompt:null,trigger:{type:`cron`},enabled:!1,created_at:``,updated_at:``},kt=()=>{if(!I())throw new Response(null,{status:404,statusText:`Not Found`});return null},At=a(function(){let{t:e}=c(`openhands`),{automationId:t}=r(),[n]=i(),a=n.get(`run`),{navigate:o}=re(),[s,l]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),{data:_,isLoading:v,refetch:y}=oe(),b=_?.status===`ok`,x=d(),S=(0,J.useRef)(x.backend.id).current!==x.backend.id,{data:C,isLoading:w,isError:T,error:E,refetch:D}=ce({id:t??``,enabled:b&&!S}),{trackPrebuiltAutomationEnabled:O,trackAutomationExported:k}=R(),A=le(),j=ue(),M=se(),{canManage:N}=ye(),P=ve(C??Ot),F=Ae(C?.user_id),I=T&&te(E)===404;if(v)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)(Et,{})})});if(!b)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)(Se,{onRetry:y})})});if(w)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)(Et,{})})});if(I)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)(Dt,{})})});if(T||!C)return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsx)(we,{onRetry:()=>D()})})});let z=()=>{let e=!C.enabled;A.mutate({id:C.id,enabled:e}),e&&O({automationId:C.id,automationName:C.name})},ne=()=>{j.mutate(C.id,{onSuccess:()=>{o?.(ee())}})},ie=()=>{M.mutate(C.id,{onSuccess:()=>{u(e(p.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{f(W(t,e(p.AUTOMATIONS$RUN_NOW_ERROR)))}})},ae=()=>{let e=`${JSON.stringify(Ee(C),null,2)}\n`;m(new Blob([e],{type:`application/json`}),De(C)),k({backendKind:x.backend.kind})},B=N||P,V=null;x.backend.kind===`cloud`&&C.user_id&&(V=F.data?.email??(F.isError?C.user_id:null));let H=C.enabled?B:P;return(0,Y.jsx)(`div`,{className:`min-h-full`,children:(0,Y.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(G,{}),(0,Y.jsx)(Me,{automation:C,onToggle:z,onEdit:()=>g(!0),onDelete:()=>l(!0),onExport:ae,onDownloadTarball:()=>L.downloadTarball(C.id,C.name),onRunNow:ie,isRunningNow:M.isPending,canManage:B,canToggle:H}),(0,Y.jsx)(Ne,{automation:C}),C.prompt&&(0,Y.jsx)(Ie,{prompt:C.prompt}),(0,Y.jsx)(Ue,{automation:C,runsAs:V}),C.plugins&&C.plugins.length>0&&(0,Y.jsx)(Ke,{plugins:C.plugins}),(0,Y.jsx)(Je,{createdAt:C.created_at,lastRunAt:C.last_triggered_at}),(0,Y.jsx)(Tt,{automation:C,highlightedRunId:a}),(0,Y.jsx)(Te,{automationName:C.name,isOpen:s,onConfirm:ne,onCancel:()=>l(!1)}),h&&(0,Y.jsx)(_e,{automation:C,isOpen:h,onClose:()=>g(!1)})]})})})});export{kt as clientLoader,At as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-Cyuzqnbw.js";import{St as e,i as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{i as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as i}from"./useTranslation-CCgUjPJF.js";import{K as a,t as o}from"./utils-D-gOfhmN.js";import{c as s}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~eo2nf80n-3eJ4ExtV.js";import{t as c}from"./loader-circle-BxJgk73D.js";import{t as l}from"./styled-tooltip-DVAlWYnL.js";import{u}from"./dropdown-classes-goDldkiu.js";import{n as d}from"./use-automation-health-DdgSa8sA.js";import{t as f}from"./automation-C_eCrGyP.js";var p=r(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);e();var m=n(),ee=e=>(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,m.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`})}),te=[`success`,`partial_success`,`blocked`,`failed`,`unknown`];function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(e){return typeof e==`string`&&te.includes(e)}function _(e){return typeof e==`string`&&e.trim()||null}var v=new Set([`status`,`outcome_summary`]);function y(e){return e.run_metadata?.finish_tool_response??null}function b(e){let t=_(e);if(t)return t;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(e==null)return null;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function x(e){if(e==null)return null;if(!h(e))return e;let t=Object.entries(e).filter(([e])=>!v.has(e));return t.length>0?Object.fromEntries(t):`status`in e&&!g(e.status)?{status:e.status}:null}function ne(e){let t=y(e);if(!h(t))return null;let n=_(t.outcome_summary);return typeof t.status!=`string`&&!n?null:{status:g(t.status)?t.status:`unknown`,outcomeSummary:n}}function S(e){let t=y(e),n=x(t),r=b(n),i=ne(e),a=_(e.error_detail);return e.status===f.COMPLETED?{badgeStatus:i?.status??(t===null?`success`:`unknown`),summary:i?.outcomeSummary??null,taskOutcome:i,customTaskMetadata:n,customTaskMetadataText:r}:{badgeStatus:e.status,summary:a,taskOutcome:i,customTaskMetadata:n,customTaskMetadataText:r}}function C(e){switch(e){case f.COMPLETED:case`success`:return a.AUTOMATIONS$DETAIL$SUCCESSFUL;case f.FAILED:case`failed`:return a.AUTOMATIONS$DETAIL$FAILED;case f.PENDING:return a.AUTOMATIONS$DETAIL$PENDING;case f.RUNNING:return a.AUTOMATIONS$DETAIL$RUNNING;case f.CANCELLED:return a.AUTOMATIONS$DETAIL$CANCELLED;case f.SKIPPED:return a.AUTOMATIONS$DETAIL$SKIPPED;case`blocked`:return a.AUTOMATIONS$DETAIL$BLOCKED;case`partial_success`:return a.AUTOMATIONS$DETAIL$PARTIAL;case`unknown`:return a.AUTOMATIONS$DETAIL$NEEDS_REVIEW;default:return a.FEATURED_AUTOMATIONS$STATUS_UNKNOWN}}var w=/^(\d+)$/;function T(e,t,n){let r=e.match(w);if(!r)return null;let i=Number(r[1]);return Number.isNaN(i)||i<t||i>n?null:i}function re(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=T(r,0,59),l=T(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=T(s,0,6);return u===null?{kind:`custom`,raw:t,hour:l,minute:c}:{kind:`weekly`,hour:l,minute:c,weekday:u}}function ie(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 ae(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function E(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 D(e){return e?Array.isArray(e)?e.join(`, `):e:`—`}var O=`*/10 * * * *`,k=new Set([`@yearly`,`@annually`,`@monthly`,`@weekly`,`@daily`,`@midnight`,`@hourly`]),A=5,j=7,M=[[0,59],[0,23],[1,31],[1,12],[0,7]],N=2,P=3,F=[0,31,29,31,30,31,30,31,31,30,31,30,31],I=`JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC`,L=`SUN|MON|TUE|WED|THU|FRI|SAT`,R=/^(\*|\d+(?:-\d+)?)(?:\/(\d+))?$/,z=[null,null,/^(?:\?|L|\d+W)$/i,RegExp(`^(?:${I})(?:-(?:${I}))?(?:/\\d+)?$`,`i`),RegExp(`^(?:(?:${L}|\\d+)(?:-(?:${L}|\\d+))?(?:/\\d+)?(?:#\\d+)?|\\?)$`,`i`)];function B(e,[t,n],r){let i=new Set;for(let a of e.split(`,`)){let e=a.match(R);if(!e)return r?.test(a)?{kind:`unmodelled`}:{kind:`invalid`};let[,o,s]=e,c=s===void 0?1:Number(s);if(c<1)return{kind:`invalid`};if(o===`*`){for(let e=t;e<=n;e+=c)i.add(e);continue}let[l,u]=o.split(`-`),d=T(l,t,n);if(d===null)return{kind:`invalid`};if(u===void 0){i.add(d);continue}let f=T(u,t,n);if(f===null)return{kind:`invalid`};if(f<d)return{kind:`unmodelled`};for(let e=d;e<=f;e+=c)i.add(e)}return{kind:`values`,values:[...i]}}function V(e){let t=e.trim();if(!t)return{errorKey:a.AUTOMATIONS$ERROR_CRON_INVALID};if(t.startsWith(`@`))return k.has(t.toLowerCase())?{schedule:t}:{errorKey:a.AUTOMATIONS$ERROR_CRON_INVALID};let n=t.split(/\s+/);if(n.length<A||n.length>j)return{errorKey:a.AUTOMATIONS$ERROR_CRON_INVALID};let r=M.map((e,t)=>B(n[t],e,z[t]));if(r.some(e=>e.kind===`invalid`))return{errorKey:a.AUTOMATIONS$ERROR_CRON_INVALID};let i=r[N],o=r[P];return i.kind===`values`&&o.kind===`values`&&!o.values.some(e=>i.values.some(t=>t<=F[e]))?{errorKey:a.AUTOMATIONS$ERROR_CRON_UNREACHABLE}:{schedule:t}}function H(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function U(e){if(!e)return!0;let t=new Date(e).getTime();return Number.isNaN(t)||t===0}function W(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),o=Math.floor(r/36e5),s=Math.floor(r/864e5);return i<1?n(a.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(a.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):o<24?n(a.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:o}):s===1?n(a.AUTOMATIONS$DETAIL$TIME_YESTERDAY):s<7?n(a.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:s}):H(e,t)}function G(e){return e===f.FAILED||e===f.PENDING||e===f.RUNNING}function K(e){return e===f.PENDING||e===f.RUNNING}var q={queued:a.AUTOMATIONS$DETAIL$PHASE_QUEUED,sandbox_provisioning:a.AUTOMATIONS$DETAIL$PHASE_SANDBOX_PROVISIONING,bundle_upload:a.AUTOMATIONS$DETAIL$PHASE_BUNDLE_UPLOAD,entrypoint_start:a.AUTOMATIONS$DETAIL$PHASE_ENTRYPOINT_START,preparing:a.AUTOMATIONS$DETAIL$PHASE_PREPARING,running_agent:a.AUTOMATIONS$DETAIL$PHASE_RUNNING_AGENT};function J(e,t,n){let r=t&&Object.hasOwn(q,t)?q[t]:void 0;return r?e(r):n?.trim()||t?.trim()||null}function oe(e,t,n){return!e||U(e)?null:W(e,t,n)}function Y({status:e,code:t,label:n,updatedAt:r}){let{t:a,i18n:o}=i(`openhands`),s=J(a,t,n);return s?{text:s,age:K(e)?oe(r,o.language,a):null}:null}function se({status:e,code:n,label:r,updatedAt:i,wide:a=!1}){let s=Y({status:e,code:n,label:r,updatedAt:i});if(!s)return null;let{text:c,age:l}=s;return(0,m.jsx)(t,{content:(0,m.jsxs)(m.Fragment,{children:[c,l?(0,m.jsx)(`span`,{className:`mt-1 block text-muted`,children:l}):null]}),placement:`top`,closeDelay:100,disableAnimation:!1,classNames:{content:`max-w-xs whitespace-pre-wrap break-words rounded-xl border border-[var(--oh-border)] bg-base-secondary px-3 py-2 text-left text-xs text-white shadow-xl`},children:(0,m.jsxs)(`span`,{className:`flex min-w-0 cursor-default items-center gap-1`,children:[(0,m.jsx)(`span`,{"data-testid":`run-phase`,className:o(`min-w-0 truncate text-xs text-muted`,a?`max-w-[28rem]`:`max-w-[12rem]`),children:c}),l?(0,m.jsxs)(`span`,{"data-testid":`run-phase-age`,className:`shrink-0 whitespace-nowrap text-xs text-muted`,children:[`· `,l]}):null]})})}var X=e=>(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),ce=e=>(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),Z={[f.COMPLETED]:{style:`bg-[var(--oh-success)]/10 text-[var(--oh-success)]`,iconTone:`text-[var(--oh-success)]`},success:{style:`bg-[var(--oh-success)]/10 text-[var(--oh-success)]`,iconTone:`text-[var(--oh-success)]`},[f.FAILED]:{style:`bg-[var(--oh-danger)]/10 text-danger`,iconTone:`text-danger`},failed:{style:`bg-[var(--oh-danger)]/10 text-danger`,iconTone:`text-danger`},blocked:{style:`bg-[var(--oh-warning)]/10 text-[var(--oh-warning)]`,iconTone:`text-[var(--oh-warning)]`},partial_success:{style:`bg-[var(--oh-warning)]/10 text-[var(--oh-warning)]`,iconTone:`text-[var(--oh-warning)]`},unknown:{style:`bg-[var(--oh-warning)]/10 text-[var(--oh-warning)]`,iconTone:`text-[var(--oh-warning)]`},[f.PENDING]:{style:`bg-surface-raised text-muted`,iconTone:`text-muted`},[f.RUNNING]:{style:`bg-surface-raised text-muted`,iconTone:`text-muted`},[f.CANCELLED]:{style:`bg-surface-raised text-muted`,iconTone:`text-muted`},[f.SKIPPED]:{style:`bg-surface-raised text-muted`,iconTone:`text-muted`}};function Q({status:e,compact:t=!1}){let n=t?`size-3`:`size-3.5`;switch(e){case f.COMPLETED:case`success`:return(0,m.jsx)(X,{"data-testid":`run-status-icon-completed`,className:n});case f.FAILED:case`failed`:return(0,m.jsx)(ce,{"data-testid":`run-status-icon-failed`,className:n});case f.RUNNING:return(0,m.jsx)(c,{"data-testid":`run-status-icon-running`,className:o(n,`animate-spin motion-reduce:animate-none`),"aria-hidden":`true`});case`blocked`:case`partial_success`:return(0,m.jsx)(s,{"data-testid":`run-status-icon-warning`,className:n,"aria-hidden":`true`});case`unknown`:return(0,m.jsx)(p,{"data-testid":`run-status-icon-needs-review`,className:n,"aria-hidden":`true`});default:return(0,m.jsx)(d,{"data-testid":`run-status-icon-pending`,className:n})}}function le({status:e,iconOnly:t=!1,showLabel:n=!1,compact:r=!1}){let{t:a}=i(`openhands`),s=Z[e]??Z[f.PENDING],c=a(C(e));return t?n?(0,m.jsxs)(`span`,{"data-testid":`run-status-badge-icon`,className:o(`inline-flex min-w-0 shrink-0 items-center gap-1.5 text-xs font-medium`,s.iconTone),children:[(0,m.jsx)(Q,{status:e,compact:r}),(0,m.jsx)(`span`,{className:`truncate`,children:c})]}):(0,m.jsx)(l,{content:c,placement:`top`,children:(0,m.jsx)(`span`,{role:`img`,"aria-label":c,"data-testid":`run-status-badge-icon`,className:o(`inline-flex shrink-0 cursor-default items-center justify-center`,s.iconTone),children:(0,m.jsx)(Q,{status:e,compact:r})})}):(0,m.jsxs)(`span`,{className:o(`inline-flex items-center rounded-full font-medium`,r?`gap-1 pl-1 pr-1.5 py-0 text-[10px] leading-4`:`gap-1.5 pl-2 pr-2.5 py-1 text-xs`,s.style),children:[(0,m.jsx)(Q,{status:e,compact:r}),c]})}var ue=e=>(0,m.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,m.jsx)(`path`,{d:`M8.4 3.9c-1.1-.66-2.5.13-2.5 1.4v13.4c0 1.27 1.4 2.06 2.5 1.4l11.2-6.7c1.06-.64 1.06-2.16 0-2.8L8.4 3.9Z`,fill:`currentColor`})}),de=e=>(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5.636 5.636a9 9 0 1012.728 0M12 3v9`})});function fe({icon:e,label:t}){return(0,m.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,m.jsx)(`span`,{className:o(`[&_svg]:size-4`,u),"aria-hidden":!0,children:e}),(0,m.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t})]})}var pe=new Set([`user`]),me=new Set([`manual`,`manual_delete`]);function $(e){return!e.enabled&&!!e.disabled_reason}function he(e){let t=e.disabled_reason;if(t&&me.has(t))return!0;let n=e.disabled_detail?.source;return!!(n&&pe.has(n))}function ge(e,t){return $(e)?he(e)?{text:t(a.AUTOMATIONS$DETAIL$DISABLED_MANUAL)}:{text:e.disabled_reason}:null}export{ee as C,S,ae as _,ue as a,V as b,se as c,H as d,W as f,D as g,ie as h,de as i,G as l,O as m,$ as n,le as o,U as p,fe as r,X as s,ge as t,Y as u,re as v,C as x,E as y};
1
+ import"./rolldown-runtime-Cyuzqnbw.js";import{St as e,i as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{i as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as i}from"./useTranslation-CCgUjPJF.js";import{K as a,t as o}from"./utils-CbjwNcR-.js";import{c as s}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~eo2nf80n-fgzdgvrL.js";import{t as c}from"./loader-circle-BxJgk73D.js";import{t as l}from"./styled-tooltip-CknPQH4Y.js";import{u}from"./dropdown-classes-DyyMaaXl.js";import{n as d}from"./use-automation-health-CbQ9n-k7.js";import{t as f}from"./automation-C_eCrGyP.js";var p=r(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);e();var m=n(),ee=e=>(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,m.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`})}),te=[`success`,`partial_success`,`blocked`,`failed`,`unknown`];function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(e){return typeof e==`string`&&te.includes(e)}function _(e){return typeof e==`string`&&e.trim()||null}var v=new Set([`status`,`outcome_summary`]);function y(e){return e.run_metadata?.finish_tool_response??null}function b(e){let t=_(e);if(t)return t;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(e==null)return null;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function x(e){if(e==null)return null;if(!h(e))return e;let t=Object.entries(e).filter(([e])=>!v.has(e));return t.length>0?Object.fromEntries(t):`status`in e&&!g(e.status)?{status:e.status}:null}function ne(e){let t=y(e);if(!h(t))return null;let n=_(t.outcome_summary);return typeof t.status!=`string`&&!n?null:{status:g(t.status)?t.status:`unknown`,outcomeSummary:n}}function S(e){let t=y(e),n=x(t),r=b(n),i=ne(e),a=_(e.error_detail);return e.status===f.COMPLETED?{badgeStatus:i?.status??(t===null?`success`:`unknown`),summary:i?.outcomeSummary??null,taskOutcome:i,customTaskMetadata:n,customTaskMetadataText:r}:{badgeStatus:e.status,summary:a,taskOutcome:i,customTaskMetadata:n,customTaskMetadataText:r}}function C(e){switch(e){case f.COMPLETED:case`success`:return a.AUTOMATIONS$DETAIL$SUCCESSFUL;case f.FAILED:case`failed`:return a.AUTOMATIONS$DETAIL$FAILED;case f.PENDING:return a.AUTOMATIONS$DETAIL$PENDING;case f.RUNNING:return a.AUTOMATIONS$DETAIL$RUNNING;case f.CANCELLED:return a.AUTOMATIONS$DETAIL$CANCELLED;case f.SKIPPED:return a.AUTOMATIONS$DETAIL$SKIPPED;case`blocked`:return a.AUTOMATIONS$DETAIL$BLOCKED;case`partial_success`:return a.AUTOMATIONS$DETAIL$PARTIAL;case`unknown`:return a.AUTOMATIONS$DETAIL$NEEDS_REVIEW;default:return a.FEATURED_AUTOMATIONS$STATUS_UNKNOWN}}var w=/^(\d+)$/;function T(e,t,n){let r=e.match(w);if(!r)return null;let i=Number(r[1]);return Number.isNaN(i)||i<t||i>n?null:i}function re(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=T(r,0,59),l=T(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=T(s,0,6);return u===null?{kind:`custom`,raw:t,hour:l,minute:c}:{kind:`weekly`,hour:l,minute:c,weekday:u}}function ie(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 ae(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function E(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 D(e){return e?Array.isArray(e)?e.join(`, `):e:`—`}var O=`*/10 * * * *`,k=new Set([`@yearly`,`@annually`,`@monthly`,`@weekly`,`@daily`,`@midnight`,`@hourly`]),A=5,j=7,M=[[0,59],[0,23],[1,31],[1,12],[0,7]],N=2,P=3,F=[0,31,29,31,30,31,30,31,31,30,31,30,31],I=`JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC`,L=`SUN|MON|TUE|WED|THU|FRI|SAT`,R=/^(\*|\d+(?:-\d+)?)(?:\/(\d+))?$/,z=[null,null,/^(?:\?|L|\d+W)$/i,RegExp(`^(?:${I})(?:-(?:${I}))?(?:/\\d+)?$`,`i`),RegExp(`^(?:(?:${L}|\\d+)(?:-(?:${L}|\\d+))?(?:/\\d+)?(?:#\\d+)?|\\?)$`,`i`)];function B(e,[t,n],r){let i=new Set;for(let a of e.split(`,`)){let e=a.match(R);if(!e)return r?.test(a)?{kind:`unmodelled`}:{kind:`invalid`};let[,o,s]=e,c=s===void 0?1:Number(s);if(c<1)return{kind:`invalid`};if(o===`*`){for(let e=t;e<=n;e+=c)i.add(e);continue}let[l,u]=o.split(`-`),d=T(l,t,n);if(d===null)return{kind:`invalid`};if(u===void 0){i.add(d);continue}let f=T(u,t,n);if(f===null)return{kind:`invalid`};if(f<d)return{kind:`unmodelled`};for(let e=d;e<=f;e+=c)i.add(e)}return{kind:`values`,values:[...i]}}function V(e){let t=e.trim();if(!t)return{errorKey:a.AUTOMATIONS$ERROR_CRON_INVALID};if(t.startsWith(`@`))return k.has(t.toLowerCase())?{schedule:t}:{errorKey:a.AUTOMATIONS$ERROR_CRON_INVALID};let n=t.split(/\s+/);if(n.length<A||n.length>j)return{errorKey:a.AUTOMATIONS$ERROR_CRON_INVALID};let r=M.map((e,t)=>B(n[t],e,z[t]));if(r.some(e=>e.kind===`invalid`))return{errorKey:a.AUTOMATIONS$ERROR_CRON_INVALID};let i=r[N],o=r[P];return i.kind===`values`&&o.kind===`values`&&!o.values.some(e=>i.values.some(t=>t<=F[e]))?{errorKey:a.AUTOMATIONS$ERROR_CRON_UNREACHABLE}:{schedule:t}}function H(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function U(e){if(!e)return!0;let t=new Date(e).getTime();return Number.isNaN(t)||t===0}function W(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),o=Math.floor(r/36e5),s=Math.floor(r/864e5);return i<1?n(a.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(a.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):o<24?n(a.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:o}):s===1?n(a.AUTOMATIONS$DETAIL$TIME_YESTERDAY):s<7?n(a.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:s}):H(e,t)}function G(e){return e===f.FAILED||e===f.PENDING||e===f.RUNNING}function K(e){return e===f.PENDING||e===f.RUNNING}var q={queued:a.AUTOMATIONS$DETAIL$PHASE_QUEUED,sandbox_provisioning:a.AUTOMATIONS$DETAIL$PHASE_SANDBOX_PROVISIONING,bundle_upload:a.AUTOMATIONS$DETAIL$PHASE_BUNDLE_UPLOAD,entrypoint_start:a.AUTOMATIONS$DETAIL$PHASE_ENTRYPOINT_START,preparing:a.AUTOMATIONS$DETAIL$PHASE_PREPARING,running_agent:a.AUTOMATIONS$DETAIL$PHASE_RUNNING_AGENT};function J(e,t,n){let r=t&&Object.hasOwn(q,t)?q[t]:void 0;return r?e(r):n?.trim()||t?.trim()||null}function oe(e,t,n){return!e||U(e)?null:W(e,t,n)}function Y({status:e,code:t,label:n,updatedAt:r}){let{t:a,i18n:o}=i(`openhands`),s=J(a,t,n);return s?{text:s,age:K(e)?oe(r,o.language,a):null}:null}function se({status:e,code:n,label:r,updatedAt:i,wide:a=!1}){let s=Y({status:e,code:n,label:r,updatedAt:i});if(!s)return null;let{text:c,age:l}=s;return(0,m.jsx)(t,{content:(0,m.jsxs)(m.Fragment,{children:[c,l?(0,m.jsx)(`span`,{className:`mt-1 block text-muted`,children:l}):null]}),placement:`top`,closeDelay:100,disableAnimation:!1,classNames:{content:`max-w-xs whitespace-pre-wrap break-words rounded-xl border border-[var(--oh-border)] bg-base-secondary px-3 py-2 text-left text-xs text-white shadow-xl`},children:(0,m.jsxs)(`span`,{className:`flex min-w-0 cursor-default items-center gap-1`,children:[(0,m.jsx)(`span`,{"data-testid":`run-phase`,className:o(`min-w-0 truncate text-xs text-muted`,a?`max-w-[28rem]`:`max-w-[12rem]`),children:c}),l?(0,m.jsxs)(`span`,{"data-testid":`run-phase-age`,className:`shrink-0 whitespace-nowrap text-xs text-muted`,children:[`· `,l]}):null]})})}var X=e=>(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),ce=e=>(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),Z={[f.COMPLETED]:{style:`bg-[var(--oh-success)]/10 text-[var(--oh-success)]`,iconTone:`text-[var(--oh-success)]`},success:{style:`bg-[var(--oh-success)]/10 text-[var(--oh-success)]`,iconTone:`text-[var(--oh-success)]`},[f.FAILED]:{style:`bg-[var(--oh-danger)]/10 text-danger`,iconTone:`text-danger`},failed:{style:`bg-[var(--oh-danger)]/10 text-danger`,iconTone:`text-danger`},blocked:{style:`bg-[var(--oh-warning)]/10 text-[var(--oh-warning)]`,iconTone:`text-[var(--oh-warning)]`},partial_success:{style:`bg-[var(--oh-warning)]/10 text-[var(--oh-warning)]`,iconTone:`text-[var(--oh-warning)]`},unknown:{style:`bg-[var(--oh-warning)]/10 text-[var(--oh-warning)]`,iconTone:`text-[var(--oh-warning)]`},[f.PENDING]:{style:`bg-surface-raised text-muted`,iconTone:`text-muted`},[f.RUNNING]:{style:`bg-surface-raised text-muted`,iconTone:`text-muted`},[f.CANCELLED]:{style:`bg-surface-raised text-muted`,iconTone:`text-muted`},[f.SKIPPED]:{style:`bg-surface-raised text-muted`,iconTone:`text-muted`}};function Q({status:e,compact:t=!1}){let n=t?`size-3`:`size-3.5`;switch(e){case f.COMPLETED:case`success`:return(0,m.jsx)(X,{"data-testid":`run-status-icon-completed`,className:n});case f.FAILED:case`failed`:return(0,m.jsx)(ce,{"data-testid":`run-status-icon-failed`,className:n});case f.RUNNING:return(0,m.jsx)(c,{"data-testid":`run-status-icon-running`,className:o(n,`animate-spin motion-reduce:animate-none`),"aria-hidden":`true`});case`blocked`:case`partial_success`:return(0,m.jsx)(s,{"data-testid":`run-status-icon-warning`,className:n,"aria-hidden":`true`});case`unknown`:return(0,m.jsx)(p,{"data-testid":`run-status-icon-needs-review`,className:n,"aria-hidden":`true`});default:return(0,m.jsx)(d,{"data-testid":`run-status-icon-pending`,className:n})}}function le({status:e,iconOnly:t=!1,showLabel:n=!1,compact:r=!1}){let{t:a}=i(`openhands`),s=Z[e]??Z[f.PENDING],c=a(C(e));return t?n?(0,m.jsxs)(`span`,{"data-testid":`run-status-badge-icon`,className:o(`inline-flex min-w-0 shrink-0 items-center gap-1.5 text-xs font-medium`,s.iconTone),children:[(0,m.jsx)(Q,{status:e,compact:r}),(0,m.jsx)(`span`,{className:`truncate`,children:c})]}):(0,m.jsx)(l,{content:c,placement:`top`,children:(0,m.jsx)(`span`,{role:`img`,"aria-label":c,"data-testid":`run-status-badge-icon`,className:o(`inline-flex shrink-0 cursor-default items-center justify-center`,s.iconTone),children:(0,m.jsx)(Q,{status:e,compact:r})})}):(0,m.jsxs)(`span`,{className:o(`inline-flex items-center rounded-full font-medium`,r?`gap-1 pl-1 pr-1.5 py-0 text-[10px] leading-4`:`gap-1.5 pl-2 pr-2.5 py-1 text-xs`,s.style),children:[(0,m.jsx)(Q,{status:e,compact:r}),c]})}var ue=e=>(0,m.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,m.jsx)(`path`,{d:`M8.4 3.9c-1.1-.66-2.5.13-2.5 1.4v13.4c0 1.27 1.4 2.06 2.5 1.4l11.2-6.7c1.06-.64 1.06-2.16 0-2.8L8.4 3.9Z`,fill:`currentColor`})}),de=e=>(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5.636 5.636a9 9 0 1012.728 0M12 3v9`})});function fe({icon:e,label:t}){return(0,m.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,m.jsx)(`span`,{className:o(`[&_svg]:size-4`,u),"aria-hidden":!0,children:e}),(0,m.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t})]})}var pe=new Set([`user`]),me=new Set([`manual`,`manual_delete`]);function $(e){return!e.enabled&&!!e.disabled_reason}function he(e){let t=e.disabled_reason;if(t&&me.has(t))return!0;let n=e.disabled_detail?.source;return!!(n&&pe.has(n))}function ge(e,t){return $(e)?he(e)?{text:t(a.AUTOMATIONS$DETAIL$DISABLED_MANUAL)}:{text:e.disabled_reason}:null}export{ee as C,S,ae as _,ue as a,V as b,se as c,H as d,W as f,D as g,ie as h,de as i,G as l,O as m,$ as n,le as o,U as p,fe as r,X as s,ge as t,Y as u,re as v,C as x,E as y};
@@ -1,2 +1,2 @@
1
- import{yt as e}from"./vendor-styling-Ck5D_A2Q.js";import{t}from"./useTranslation-CCgUjPJF.js";import{K as n}from"./utils-D-gOfhmN.js";import{k as r}from"./use-tracking-ChnSFChv.js";import{r as i}from"./modal-classes-jvG85nkU.js";import{t as a}from"./x-mark-BopmFoBq.js";var o=e();function s({automationName:e,isOpen:r,onConfirm:s,onCancel:c}){let{t:l}=t(`openhands`);return r?(0,o.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,o.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:c,onKeyDown:e=>{e.key===`Escape`&&c()},role:`presentation`}),(0,o.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,o.jsx)(`button`,{type:`button`,onClick:c,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":l(n.BUTTON$CLOSE),children:(0,o.jsx)(a,{className:`size-5`})}),(0,o.jsx)(`h2`,{className:i,children:l(n.AUTOMATIONS$DELETE_CONFIRM_TITLE)}),(0,o.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:l(n.AUTOMATIONS$DELETE_CONFIRM_MESSAGE,{name:e})}),(0,o.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,o.jsx)(`button`,{type:`button`,onClick:c,className:`rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:l(n.AUTOMATIONS$CANCEL)}),(0,o.jsx)(`button`,{type:`button`,onClick:s,className:`rounded-lg bg-danger px-4 py-2 text-sm text-white hover:bg-danger/80`,children:l(n.AUTOMATIONS$DELETE)})]})]})]}):null}var c=new Set([`cron`,`schedule`,`event`]),l=class extends Error{issues;constructor(e){super(e.join(`
1
+ import{yt as e}from"./vendor-styling-Ck5D_A2Q.js";import{t}from"./useTranslation-CCgUjPJF.js";import{K as n}from"./utils-CbjwNcR-.js";import{k as r}from"./use-tracking-BAFpgpgq.js";import{r as i}from"./modal-classes-BPcBCWVj.js";import{t as a}from"./x-mark-BopmFoBq.js";var o=e();function s({automationName:e,isOpen:r,onConfirm:s,onCancel:c}){let{t:l}=t(`openhands`);return r?(0,o.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,o.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:c,onKeyDown:e=>{e.key===`Escape`&&c()},role:`presentation`}),(0,o.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,o.jsx)(`button`,{type:`button`,onClick:c,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":l(n.BUTTON$CLOSE),children:(0,o.jsx)(a,{className:`size-5`})}),(0,o.jsx)(`h2`,{className:i,children:l(n.AUTOMATIONS$DELETE_CONFIRM_TITLE)}),(0,o.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:l(n.AUTOMATIONS$DELETE_CONFIRM_MESSAGE,{name:e})}),(0,o.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,o.jsx)(`button`,{type:`button`,onClick:c,className:`rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:l(n.AUTOMATIONS$CANCEL)}),(0,o.jsx)(`button`,{type:`button`,onClick:s,className:`rounded-lg bg-danger px-4 py-2 text-sm text-white hover:bg-danger/80`,children:l(n.AUTOMATIONS$DELETE)})]})]})]}):null}var c=new Set([`cron`,`schedule`,`event`]),l=class extends Error{issues;constructor(e){super(e.join(`
2
2
  `)),this.name=`AutomationFileValidationError`,this.issues=e}};function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e,t,n,r){let i=e[t];if(typeof i!=`string`||i.trim().length===0){r.push(`${n}: expected a non-empty string`);return}return i}function f(e,t,n,r){let i=e[t];if(i!==void 0){if(typeof i!=`string`){r.push(`${n}: expected a string`);return}return i}}function p(e,t){if(!u(e)){t.push(`spec.trigger: expected an object`);return}let n=d(e,`type`,`spec.trigger.type`,t);n&&!c.has(n)&&t.push(`spec.trigger.type: expected one of "cron", "schedule", or "event"`);let r=f(e,`schedule`,`spec.trigger.schedule`,t),i=f(e,`schedule_human`,`spec.trigger.schedule_human`,t),a=f(e,`timezone`,`spec.trigger.timezone`,t),o=f(e,`source`,`spec.trigger.source`,t),s=f(e,`filter`,`spec.trigger.filter`,t),l;if(e.on!==void 0&&(typeof e.on==`string`||Array.isArray(e.on)&&e.on.length>0&&e.on.every(e=>typeof e==`string`&&e.trim().length>0)?l=e.on:t.push(`spec.trigger.on: expected a string or a non-empty array of strings`)),(n===`cron`||n===`schedule`)&&!r?.trim()&&t.push(`spec.trigger.schedule: required for a scheduled trigger`),n===`event`&&(o?.trim()||t.push(`spec.trigger.source: required for an event trigger`),(l===void 0||typeof l==`string`&&l.trim().length===0)&&t.push(`spec.trigger.on: required for an event trigger`)),!(!n||!c.has(n)))return{type:n,...r!==void 0&&{schedule:r},...i!==void 0&&{schedule_human:i},...a!==void 0&&{timezone:a},...o!==void 0&&{source:o},...l!==void 0&&{on:l},...s!==void 0&&{filter:s}}}function m(e){let t=e.timezone??e.trigger.timezone,n={name:e.name,trigger:{...e.trigger},enabled:e.enabled,prompt:e.prompt,...e.repository!==void 0&&{repository:e.repository},...e.model!==void 0&&{model:e.model},...e.timeout!=null&&{timeout:e.timeout},...e.branch!==void 0&&{branch:e.branch},...e.plugins!==void 0&&{plugins:[...e.plugins]},...e.notification!==void 0&&{notification:e.notification},...t!==void 0&&{timezone:t}},i=r();return{version:i.fileVersion,kind:i.fileKind,spec:n}}function h(e){return`${e.name.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||e.id}${r().filenameSuffix}`}function g(e){let t=[];if(!u(e))throw new l([`file: expected a JSON object`]);let n=r();if(e.version!==n.fileVersion&&t.push(`version: expected ${n.fileVersion}`),e.kind!==n.fileKind&&t.push(`kind: expected "${n.fileKind}"`),!u(e.spec))throw t.push(`spec: expected an object`),new l(t);let i=d(e.spec,`name`,`spec.name`,t),a=d(e.spec,`prompt`,`spec.prompt`,t),o=p(e.spec.trigger,t),s=e.spec.enabled;typeof s!=`boolean`&&t.push(`spec.enabled: expected a boolean`);let c=f(e.spec,`repository`,`spec.repository`,t),m=f(e.spec,`branch`,`spec.branch`,t),h=f(e.spec,`notification`,`spec.notification`,t),g=f(e.spec,`timezone`,`spec.timezone`,t),_;e.spec.model===null||e.spec.model===void 0||typeof e.spec.model==`string`&&e.spec.model.trim().length>0?_=e.spec.model:t.push(`spec.model: expected a non-empty string or null`);let v;e.spec.timeout===null||e.spec.timeout===void 0||typeof e.spec.timeout==`number`&&Number.isInteger(e.spec.timeout)&&e.spec.timeout>0?v=e.spec.timeout:t.push(`spec.timeout: expected a positive integer`);let y;if(e.spec.plugins!==void 0&&(Array.isArray(e.spec.plugins)&&e.spec.plugins.every(e=>typeof e==`string`&&e.trim().length>0)?y=[...e.spec.plugins]:t.push(`spec.plugins: expected an array of non-empty strings`)),t.length>0||!i||!a||!o)throw new l(t);return{name:i,prompt:a,trigger:o,enabled:s,...c!==void 0&&{repository:c},..._!==void 0&&{model:_},...v!==void 0&&{timeout:v},...m!==void 0&&{branch:m},...y!==void 0&&{plugins:y},...h!==void 0&&{notification:h},...g!==void 0&&{timezone:g}}}export{s as i,g as n,m as r,h as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{U as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{f as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~ew9ih1s8-40UR63Gt.js";import{t as a}from"./useMutation-Cszf8mKy.js";import{t as o}from"./useQuery-DAAacS7O.js";import{t as s}from"./useTranslation-CCgUjPJF.js";import{ct as c,n as l,st as u}from"./active-backend-context-BsLfwrXB.js";import{K as d,t as f}from"./utils-D-gOfhmN.js";import{t as p}from"./check-Bo8s5Ylg.js";import{t as m}from"./refresh-cw-BtdC3T8P.js";import{t as h}from"./triangle-alert-DEdu-b_L.js";import{n as g,t as _}from"./use-tracking-ChnSFChv.js";import{t as v}from"./use-settings-BWIH5EuN.js";import{t as y}from"./brand-button-mQq2Ld1I.js";import{t as b}from"./settings-input-Cm4VxUon.js";import{t as x}from"./format-time-delta-BIR5Os7T.js";import{t as S}from"./folder-C1ou4_DT.js";import{n as C,t as w}from"./use-automation-health-DdgSa8sA.js";import{t as T}from"./settings-switch-seaSJc7t.js";import{n as E}from"./api-error-message-BXo0lCI5.js";import{t as D}from"./use-automation-permissions-D3kEeieu.js";import{t as O}from"./parse-git-remote-url-BG8pcKL8.js";import{n as k,r as A,t as j}from"./error-state-SuWwztxV.js";import{a as M,i as N,n as P,r as F,t as ee}from"./cog-Dy1eWbSZ.js";var I=e(t()),L=[`git-sync-status`];function R(e={}){let{enabled:t=!0,refetchInterval:n=!1}=e,r=l();return o({queryKey:[...L,r.backend.id,r.orgId],queryFn:()=>g.getGitSyncStatus(),staleTime:10*1e3,enabled:t,refetchInterval:n,retry:(e,t)=>v(t)===void 0&&e<2,meta:{disableToast:!0}})}function te(){let e=i(),t=l(),{trackGitSyncConfigUpdated:n}=_();return a({mutationFn:e=>g.updateGitSyncConfig(e),onSuccess:async r=>{let i=[...L,t.backend.id,t.orgId];await e.cancelQueries({queryKey:i}),e.setQueryData(i,r),n({backendKind:t.backend.kind})},meta:{disableToast:!0}})}function ne(){return a({mutationFn:e=>g.checkGitSyncConfig(e),retry:!1,meta:{disableToast:!0}})}function z(){let e=i(),t=l(),{trackGitSyncTriggered:n}=_();return a({mutationFn:()=>g.triggerGitSync(),onSuccess:()=>{e.invalidateQueries({queryKey:L}),n({backendKind:t.backend.kind})},meta:{disableToast:!0}})}var B=n();function V({className:e}){return(0,B.jsx)(`div`,{className:f(`animate-pulse rounded bg-surface-raised`,e)})}function H(){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`git-sync-skeleton`,children:[(0,B.jsx)(V,{className:`h-5 w-40`}),(0,B.jsx)(V,{className:`h-6 w-48`}),(0,B.jsx)(V,{className:`h-5 w-96`}),(0,B.jsx)(V,{className:`h-48 w-full rounded-2xl`}),(0,B.jsx)(V,{className:`h-96 w-full rounded-2xl`})]})}function U(){let{t:e}=s(`openhands`);return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,B.jsx)(A,{className:`size-12 text-muted`}),(0,B.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(d.AUTOMATIONS$GIT_SYNC$NOT_LOCAL_TITLE)}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(d.AUTOMATIONS$GIT_SYNC$NOT_LOCAL_MESSAGE)}),(0,B.jsx)(`div`,{className:`mt-6`,children:(0,B.jsx)(M,{})})]})}function W(){let{t:e}=s(`openhands`);return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,B.jsx)(A,{className:`size-12 text-muted`}),(0,B.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(d.AUTOMATIONS$GIT_SYNC$UNSUPPORTED_TITLE)}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(d.AUTOMATIONS$GIT_SYNC$UNSUPPORTED_MESSAGE)}),(0,B.jsx)(`div`,{className:`mt-6`,children:(0,B.jsx)(M,{})})]})}function G({error:e,errorAt:t}){let{t:n}=s(`openhands`);return(0,B.jsxs)(`div`,{role:`alert`,"data-testid":`git-sync-error-banner`,className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-300 whitespace-pre-wrap break-words`,children:[(0,B.jsx)(`p`,{className:`font-medium`,children:n(d.AUTOMATIONS$GIT_SYNC$LAST_ERROR_TITLE)}),(0,B.jsx)(`p`,{className:`mt-1`,children:e}),t&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-red-300/70`,children:`${x(t)} ${n(d.CONVERSATION$AGO)}`})]})}var K=e=>(0,B.jsx)(`svg`,{viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,B.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2.4375 9C2.4375 5.37563 5.37563 2.4375 9 2.4375C12.6244 2.4375 15.5625 5.37563 15.5625 9C15.5625 12.6244 12.6244 15.5625 9 15.5625C5.37563 15.5625 2.4375 12.6244 2.4375 9ZM4.13812 6.5625C4.81317 5.21867 6.02897 4.19333 7.49996 3.77204C7.15155 4.17641 6.85182 4.65395 6.60713 5.17892C6.40828 5.60556 6.24263 6.06975 6.11494 6.5625H4.13812ZM3.72196 7.6875C3.61778 8.10783 3.5625 8.54746 3.5625 9C3.5625 9.45254 3.61778 9.89217 3.72196 10.3125H5.89738C5.84161 9.88758 5.8125 9.44852 5.8125 8.99998C5.8125 8.55142 5.84161 8.11239 5.89737 7.6875H3.72196ZM7.0333 7.6875C6.97087 8.10689 6.9375 8.54634 6.9375 8.99998C6.9375 9.45367 6.97087 9.89313 7.0333 10.3125H10.9667C11.0291 9.89311 11.0625 9.45367 11.0625 9.00002C11.0625 8.54637 11.0291 8.1069 10.9667 7.6875H7.0333ZM12.1026 7.6875C12.1584 8.1124 12.1875 8.55145 12.1875 9.00002C12.1875 9.44858 12.1584 9.88762 12.1026 10.3125H14.278C14.3822 9.89217 14.4375 9.45254 14.4375 9C14.4375 8.54746 14.3822 8.10783 14.278 7.6875H12.1026ZM13.8619 6.5625H11.885C11.7574 6.06976 11.5917 5.6056 11.3929 5.17897C11.1482 4.65397 10.8484 4.1764 10.5 3.77203C11.971 4.19331 13.1868 5.21866 13.8619 6.5625ZM10.7171 6.5625H7.28293C7.38007 6.23971 7.49559 5.93571 7.62681 5.65419C7.99835 4.85708 8.48101 4.26914 8.99997 3.92442C9.51895 4.26913 10.0016 4.8571 10.3732 5.65424C10.5044 5.93575 10.6199 6.23973 10.7171 6.5625ZM4.13812 11.4375H6.11496C6.24963 11.9572 6.42655 12.4452 6.64015 12.8909C6.87835 13.3879 7.16685 13.8413 7.50006 14.228C6.02902 13.8067 4.81318 12.7814 4.13812 11.4375ZM10.7171 11.4375H7.28295C7.3869 11.7829 7.51191 12.1068 7.65465 12.4047C8.02305 13.1733 8.49456 13.7398 9.00007 14.0756C9.51902 13.7308 10.0017 13.1429 10.3732 12.3458C10.5044 12.0643 10.6199 11.7603 10.7171 11.4375ZM11.3929 12.8211C11.5917 12.3944 11.7574 11.9303 11.8851 11.4375H13.8619C13.1868 12.7813 11.971 13.8067 10.5 14.228C10.8485 13.8236 11.1482 13.346 11.3929 12.8211Z`,fill:`currentColor`})});function q({tone:e,label:t,testId:n}){return(0,B.jsx)(`span`,{"data-testid":n,className:f(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e===`success`&&`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`,e===`warning`&&`bg-[var(--oh-warning)]/15 text-[var(--oh-warning)]`,e===`neutral`&&`bg-surface-raised text-muted`),children:t})}function J(e){let[,t]=(0,I.useState)(0);(0,I.useEffect)(()=>{if(!e)return;let n=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(n)},[e])}function Y({state:e,startedAt:t,pendingCount:n}){let{t:r}=s(`openhands`),i=e===`running`;if(J(i&&t!==null),e===`idle`)return null;let a=e===`failed`;return(0,B.jsxs)(`div`,{"data-testid":`git-sync-activity-row`,"data-state":e,className:f(`mt-4 flex flex-wrap items-center gap-x-2 gap-y-1 rounded-md px-3 py-2 text-sm`,i&&`bg-tertiary text-content`,e===`succeeded`&&`bg-green-500/10 text-green-300`,a&&`bg-red-500/10 text-red-300`),children:[i&&(0,B.jsx)(m,{className:`size-4 animate-spin`,"aria-hidden":!0}),e===`succeeded`&&(0,B.jsx)(p,{className:`size-4`,"aria-hidden":!0}),a&&(0,B.jsx)(h,{className:`size-4`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`font-medium`,children:[i&&r(d.AUTOMATIONS$GIT_SYNC$SYNCING),e===`succeeded`&&r(d.AUTOMATIONS$GIT_SYNC$SYNC_COMPLETED),a&&r(d.AUTOMATIONS$GIT_SYNC$SYNC_FAILED)]}),i&&t&&(0,B.jsx)(`span`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$SYNC_STARTED_AGO,{time:x(t)})}),i&&n>0&&(0,B.jsx)(`span`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$SYNC_PENDING_COUNT,{count:n})})]})}function X(e){let t=O(e);if(!t?.host||!t.repository)return null;if(/^https?:\/\//i.test(t.url)){let e=new URL(t.url);return e.username=``,e.password=``,e.pathname=e.pathname.replace(/\.git$/,``),e.toString()}return`https://${t.host}/${t.repository}`}function Z({status:e,onSyncNow:t,isSyncing:n,syncActivity:r,syncStartedAt:i,canManage:a}){let{t:o}=s(`openhands`),c=X(e.repo_url);return(0,B.jsxs)(F,{icon:(0,B.jsx)(N,{className:`size-4`}),title:o(d.AUTOMATIONS$GIT_SYNC$STATUS_TITLE),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(q,{testId:`git-sync-enabled-pill`,tone:e.enabled?`success`:`neutral`,label:o(e.enabled?d.AUTOMATIONS$GIT_SYNC$ENABLED:d.AUTOMATIONS$GIT_SYNC$DISABLED)}),(0,B.jsx)(q,{testId:`git-sync-encryption-pill`,tone:e.encryption_enabled?`success`:`neutral`,label:o(e.encryption_enabled?d.AUTOMATIONS$GIT_SYNC$ENCRYPTED:d.AUTOMATIONS$GIT_SYNC$NOT_ENCRYPTED)})]}),(0,B.jsx)(y,{testId:`git-sync-now-button`,type:`button`,variant:`secondary`,isDisabled:!a||!e.enabled||n,onClick:t,startContent:(0,B.jsx)(m,{className:f(`size-4`,n&&`animate-spin`),"aria-hidden":!0}),children:o(n?d.AUTOMATIONS$GIT_SYNC$SYNCING:d.AUTOMATIONS$GIT_SYNC$SYNC_NOW)})]}),(0,B.jsx)(Y,{state:r,startedAt:i,pendingCount:e.dirty_count}),(0,B.jsxs)(`div`,{className:`mt-5 grid grid-cols-2 gap-x-4 gap-y-5`,children:[(0,B.jsx)(P,{icon:(0,B.jsx)(K,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$REPOSITORY),children:c?(0,B.jsx)(`a`,{"data-testid":`git-sync-repo-link`,href:c,target:`_blank`,rel:`noopener noreferrer`,className:`break-all underline transition-colors hover:text-foreground`,children:e.repo_url}):(0,B.jsx)(`span`,{className:`break-all`,children:e.repo_url||o(d.AUTOMATIONS$GIT_SYNC$NOT_CONFIGURED)})}),(0,B.jsx)(P,{icon:(0,B.jsx)(N,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$FIELD_BRANCH),children:e.branch}),(0,B.jsx)(P,{icon:(0,B.jsx)(S,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$FIELD_PATH),children:e.path}),(0,B.jsx)(P,{icon:(0,B.jsx)(N,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$LAST_SYNCED_COMMIT),children:e.last_synced_commit?(0,B.jsx)(`span`,{className:`font-mono`,children:e.last_synced_commit.slice(0,7)}):o(d.AUTOMATIONS$GIT_SYNC$NEVER_SYNCED)}),(0,B.jsx)(P,{icon:(0,B.jsx)(C,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$LAST_SYNCED_AT),children:e.last_synced_at?`${x(e.last_synced_at)} ${o(d.CONVERSATION$AGO)}`:o(d.AUTOMATIONS$GIT_SYNC$NEVER_SYNCED)}),(0,B.jsx)(P,{icon:(0,B.jsx)(C,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$FIELD_INTERVAL),children:e.interval_seconds>0?o(d.AUTOMATIONS$GIT_SYNC$EVERY_N_SECONDS,{count:e.interval_seconds}):o(d.AUTOMATIONS$GIT_SYNC$MANUAL_ONLY)}),(0,B.jsx)(P,{icon:(0,B.jsx)(C,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$PENDING_CHANGES),children:(0,B.jsx)(`span`,{className:f(e.dirty_count>0&&`text-[var(--oh-warning)]`),children:e.dirty_count})})]})]})}var Q=`git-sync-save-and-sync`;function $({status:e,canManage:t,onSyncNow:n}){let{t:r}=s(`openhands`),{mutate:i,isPending:a}=te(),{mutateAsync:o,isPending:l}=ne(),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),[x,S]=(0,I.useState)(!1),[C,w]=(0,I.useState)(!1),[D,O]=(0,I.useState)(!1),[k,A]=(0,I.useState)(!1),[j,M]=(0,I.useState)(null),N=j??e.enabled,P=j!==null&&N!==e.enabled,[L,R]=(0,I.useState)(``),[z,V]=(0,I.useState)(!1),[H,U]=(0,I.useState)(``),[W,G]=(0,I.useState)(!1),K=L.trim().length>0||z,q=H.trim().length>0||W,J=!P&&!m&&!g&&!x&&!C&&!D&&!k&&!K&&!q,Y=()=>{M(null),h(!1),_(!1),S(!1),w(!1),O(!1),A(!1),R(``),V(!1),U(``),G(!1),p(null)},X=e=>{V(e),R(``)},Z=e=>{G(e),U(``)},$=(e,t)=>e.get(t)?.toString().trim()||null,re=(e,t)=>{i(e,{onSuccess:()=>{c(r(d.AUTOMATIONS$GIT_SYNC$CONFIG_SAVED)),Y(),t&&n()},onError:e=>{u(v(e)===409?r(d.AUTOMATIONS$GIT_SYNC$ENABLE_BLOCKED_ERROR):E(e,r(d.ERROR$GENERIC)))}})},ie=e=>[`repo_url`,`branch`,`token`].filter(t=>t in e).map(t=>`${t}=${e[t]}`).join(`&`),ae=async e=>{try{let t=await o(e);return t.ok?null:t.detail??r(d.AUTOMATIONS$GIT_SYNC$CHECK_FAILED_TITLE)}catch{return null}};return(0,B.jsx)(F,{icon:(0,B.jsx)(ee,{className:`size-4`}),title:r(d.AUTOMATIONS$GIT_SYNC$CONFIG_TITLE),children:(0,B.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault();let t=e.nativeEvent.submitter?.getAttribute(`name`)===Q,n=new FormData(e.currentTarget),r={};if(P&&(r.enabled=N),m){let e=n.get(`git-sync-interval-input`)?.toString().trim(),t=Number(e);r.interval_seconds=e&&Number.isFinite(t)?Math.max(0,Math.trunc(t)):0}g&&(r.repo_url=$(n,`git-sync-repo-url-input`)),x&&(r.branch=$(n,`git-sync-branch-input`)),C&&(r.path=$(n,`git-sync-path-input`)),D&&(r.author_name=$(n,`git-sync-author-name-input`)),k&&(r.author_email=$(n,`git-sync-author-email-input`));let i=L.trim(),a=H.trim();z?r.token=null:i&&(r.token=i),W?r.encryption_key=null:a&&(r.encryption_key=a);let o=ie(r);if(o&&f?.key!==o){let e=await ae(r);if(e){p({key:o,detail:e});return}}p(null),re(r,t)},className:`flex flex-col gap-6`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(T,{testId:`git-sync-enabled-switch`,isToggled:N,isDisabled:!t,onToggle:M,children:r(d.AUTOMATIONS$GIT_SYNC$FIELD_ENABLED)}),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$ENABLED_HELP)})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(b,{testId:`git-sync-interval-input`,name:`git-sync-interval-input`,type:`number`,min:0,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_INTERVAL),defaultValue:String(e.interval_seconds),isDisabled:!t,onChange:t=>h(t.trim()!==String(e.interval_seconds))}),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$INTERVAL_HELP)})]}),(0,B.jsx)(b,{testId:`git-sync-repo-url-input`,name:`git-sync-repo-url-input`,type:`text`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_REPO_URL),defaultValue:e.repo_url,placeholder:r(d.AUTOMATIONS$GIT_SYNC$REPO_URL_PLACEHOLDER),isDisabled:!t,onChange:t=>_(t.trim()!==e.repo_url)}),(0,B.jsx)(b,{testId:`git-sync-branch-input`,name:`git-sync-branch-input`,type:`text`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_BRANCH),defaultValue:e.branch,placeholder:r(d.AUTOMATIONS$GIT_SYNC$BRANCH_PLACEHOLDER),isDisabled:!t,onChange:t=>S(t.trim()!==e.branch)}),(0,B.jsx)(b,{testId:`git-sync-path-input`,name:`git-sync-path-input`,type:`text`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_PATH),defaultValue:e.path,placeholder:r(d.AUTOMATIONS$GIT_SYNC$PATH_PLACEHOLDER),isDisabled:!t,onChange:t=>w(t.trim()!==e.path)}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(b,{testId:`git-sync-author-name-input`,name:`git-sync-author-name-input`,type:`text`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_AUTHOR_NAME),showOptionalTag:!0,defaultValue:``,isDisabled:!t,onChange:()=>O(!0)}),(0,B.jsx)(b,{testId:`git-sync-author-email-input`,name:`git-sync-author-email-input`,type:`email`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_AUTHOR_EMAIL),showOptionalTag:!0,defaultValue:``,isDisabled:!t,onChange:()=>A(!0)}),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$AUTHOR_HELP)})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(b,{testId:`git-sync-token-input`,name:`git-sync-token-input`,type:`password`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_TOKEN),placeholder:r(d.AUTOMATIONS$GIT_SYNC$TOKEN_PLACEHOLDER),isDisabled:!t||z,onChange:R},z?`token-cleared`:`token-editable`),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$TOKEN_HELP)}),(0,B.jsx)(T,{testId:`git-sync-clear-token-switch`,isToggled:z,isDisabled:!t,onToggle:X,children:r(d.AUTOMATIONS$GIT_SYNC$CLEAR_TOKEN)})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(b,{testId:`git-sync-encryption-key-input`,name:`git-sync-encryption-key-input`,type:`password`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_ENCRYPTION_KEY),placeholder:r(e.encryption_enabled?d.AUTOMATIONS$GIT_SYNC$KEY_SET_PLACEHOLDER:d.AUTOMATIONS$GIT_SYNC$KEY_UNSET_PLACEHOLDER),isDisabled:!t||W,onChange:U},W?`key-cleared`:`key-editable`),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$ENCRYPTION_KEY_HELP)}),(0,B.jsx)(T,{testId:`git-sync-clear-encryption-key-switch`,isToggled:W,isDisabled:!t,onToggle:Z,children:r(d.AUTOMATIONS$GIT_SYNC$CLEAR_ENCRYPTION_KEY)})]}),f&&(0,B.jsxs)(`div`,{role:`alert`,"data-testid":`git-sync-check-failure`,className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-300 whitespace-pre-wrap break-words`,children:[(0,B.jsx)(`p`,{className:`font-medium`,children:r(d.AUTOMATIONS$GIT_SYNC$CHECK_FAILED_TITLE)}),(0,B.jsx)(`p`,{className:`mt-1`,children:f.detail}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-red-300/70`,children:r(d.AUTOMATIONS$GIT_SYNC$CHECK_FAILED_HINT)})]}),(0,B.jsxs)(`div`,{className:`flex justify-start gap-3`,children:[(0,B.jsxs)(y,{testId:`git-sync-save-button`,variant:`primary`,type:`submit`,isDisabled:!t||a||l||J,children:[!a&&!l&&r(d.SETTINGS$SAVE_CHANGES),l&&r(d.AUTOMATIONS$GIT_SYNC$CHECKING),a&&r(d.SETTINGS$SAVING)]}),(0,B.jsx)(y,{testId:`git-sync-save-and-sync-button`,name:Q,variant:`secondary`,type:`submit`,isDisabled:!t||a||l||J||!N,children:r(d.AUTOMATIONS$GIT_SYNC$SAVE_AND_SYNC)})]})]})})}var re=3e3,ie=15e3,ae=3e4,oe=e=>({state:`running`,startedAt:e.sync_started_at??new Date().toISOString(),lastSyncedAt:e.last_synced_at,lastErrorAt:e.last_error_at}),se=r(function(){let{t:e}=s(`openhands`),t=l(),{canManage:n}=D(),[r,i]=(0,I.useState)({state:`idle`}),a=r.state===`running`,{data:o,isLoading:c,refetch:f}=w(),p=o?.status===`ok`,m=t.backend.kind===`local`,{data:h,isLoading:g,error:_,refetch:y}=R({enabled:p&&m,refetchInterval:a?re:ie});(0,I.useEffect)(()=>{h?.sync_in_progress&&i(e=>e.state===`running`?e:oe(h))},[h]),(0,I.useEffect)(()=>{r.state!==`running`||!h||(h.last_error_at&&h.last_error_at!==r.lastErrorAt?i({state:`failed`}):h.last_synced_at&&h.last_synced_at!==r.lastSyncedAt&&i({state:`succeeded`}))},[h,r]),(0,I.useEffect)(()=>{if(!a)return;let e=setTimeout(()=>i({state:`idle`}),ae);return()=>clearTimeout(e)},[a,r]);let b=z();if(!m)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(U,{})})});if(c)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(H,{})})});if(!p)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(k,{onRetry:f})})});if(g)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(H,{})})});if(!h)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:v(_)===404?(0,B.jsx)(W,{}):(0,B.jsx)(j,{onRetry:()=>y()})})});let x=()=>{b.mutate(void 0,{onSuccess:()=>i(oe(h)),onError:t=>{u(v(t)===503?e(d.AUTOMATIONS$GIT_SYNC$SYNC_DISABLED_ERROR):E(t,e(d.ERROR$GENERIC)))}})};return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(M,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:e(d.AUTOMATIONS$GIT_SYNC$TITLE)}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(d.AUTOMATIONS$GIT_SYNC$SUBTITLE)})]}),h.last_error&&(0,B.jsx)(G,{error:h.last_error,errorAt:h.last_error_at}),(0,B.jsx)(Z,{status:h,onSyncNow:x,isSyncing:b.isPending||a,syncActivity:r.state,syncStartedAt:a?r.startedAt:null,canManage:n}),(0,B.jsx)($,{status:h,canManage:n,onSyncNow:x})]})})})});export{se as default};
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{U as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{f as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~ew9ih1s8-40UR63Gt.js";import{t as a}from"./useMutation-Cszf8mKy.js";import{t as o}from"./useQuery-DAAacS7O.js";import{t as s}from"./useTranslation-CCgUjPJF.js";import{ct as c,n as l,st as u}from"./active-backend-context-BETEdaJl.js";import{K as d,t as f}from"./utils-CbjwNcR-.js";import{t as p}from"./check-Bo8s5Ylg.js";import{t as m}from"./refresh-cw-BtdC3T8P.js";import{t as h}from"./triangle-alert-DEdu-b_L.js";import{n as g,t as _}from"./use-tracking-BAFpgpgq.js";import{t as v}from"./use-settings-D69cw06D.js";import{t as y}from"./brand-button-CGUwj6zK.js";import{t as b}from"./settings-input-B3i5U9GL.js";import{t as x}from"./format-time-delta-BIR5Os7T.js";import{t as S}from"./folder-C1ou4_DT.js";import{n as C,t as w}from"./use-automation-health-CbQ9n-k7.js";import{t as T}from"./settings-switch-CI93Iozg.js";import{n as E}from"./api-error-message-BXo0lCI5.js";import{t as D}from"./use-automation-permissions-gFy-2VD0.js";import{t as O}from"./parse-git-remote-url-BG8pcKL8.js";import{n as k,r as A,t as j}from"./error-state-BgYl7YeB.js";import{a as M,i as N,n as P,r as F,t as ee}from"./cog-DVZT1f0s.js";var I=e(t()),L=[`git-sync-status`];function R(e={}){let{enabled:t=!0,refetchInterval:n=!1}=e,r=l();return o({queryKey:[...L,r.backend.id,r.orgId],queryFn:()=>g.getGitSyncStatus(),staleTime:10*1e3,enabled:t,refetchInterval:n,retry:(e,t)=>v(t)===void 0&&e<2,meta:{disableToast:!0}})}function te(){let e=i(),t=l(),{trackGitSyncConfigUpdated:n}=_();return a({mutationFn:e=>g.updateGitSyncConfig(e),onSuccess:async r=>{let i=[...L,t.backend.id,t.orgId];await e.cancelQueries({queryKey:i}),e.setQueryData(i,r),n({backendKind:t.backend.kind})},meta:{disableToast:!0}})}function ne(){return a({mutationFn:e=>g.checkGitSyncConfig(e),retry:!1,meta:{disableToast:!0}})}function z(){let e=i(),t=l(),{trackGitSyncTriggered:n}=_();return a({mutationFn:()=>g.triggerGitSync(),onSuccess:()=>{e.invalidateQueries({queryKey:L}),n({backendKind:t.backend.kind})},meta:{disableToast:!0}})}var B=n();function V({className:e}){return(0,B.jsx)(`div`,{className:f(`animate-pulse rounded bg-surface-raised`,e)})}function H(){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`git-sync-skeleton`,children:[(0,B.jsx)(V,{className:`h-5 w-40`}),(0,B.jsx)(V,{className:`h-6 w-48`}),(0,B.jsx)(V,{className:`h-5 w-96`}),(0,B.jsx)(V,{className:`h-48 w-full rounded-2xl`}),(0,B.jsx)(V,{className:`h-96 w-full rounded-2xl`})]})}function U(){let{t:e}=s(`openhands`);return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,B.jsx)(A,{className:`size-12 text-muted`}),(0,B.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(d.AUTOMATIONS$GIT_SYNC$NOT_LOCAL_TITLE)}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(d.AUTOMATIONS$GIT_SYNC$NOT_LOCAL_MESSAGE)}),(0,B.jsx)(`div`,{className:`mt-6`,children:(0,B.jsx)(M,{})})]})}function W(){let{t:e}=s(`openhands`);return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,B.jsx)(A,{className:`size-12 text-muted`}),(0,B.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(d.AUTOMATIONS$GIT_SYNC$UNSUPPORTED_TITLE)}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(d.AUTOMATIONS$GIT_SYNC$UNSUPPORTED_MESSAGE)}),(0,B.jsx)(`div`,{className:`mt-6`,children:(0,B.jsx)(M,{})})]})}function G({error:e,errorAt:t}){let{t:n}=s(`openhands`);return(0,B.jsxs)(`div`,{role:`alert`,"data-testid":`git-sync-error-banner`,className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-300 whitespace-pre-wrap break-words`,children:[(0,B.jsx)(`p`,{className:`font-medium`,children:n(d.AUTOMATIONS$GIT_SYNC$LAST_ERROR_TITLE)}),(0,B.jsx)(`p`,{className:`mt-1`,children:e}),t&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-red-300/70`,children:`${x(t)} ${n(d.CONVERSATION$AGO)}`})]})}var K=e=>(0,B.jsx)(`svg`,{viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,B.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2.4375 9C2.4375 5.37563 5.37563 2.4375 9 2.4375C12.6244 2.4375 15.5625 5.37563 15.5625 9C15.5625 12.6244 12.6244 15.5625 9 15.5625C5.37563 15.5625 2.4375 12.6244 2.4375 9ZM4.13812 6.5625C4.81317 5.21867 6.02897 4.19333 7.49996 3.77204C7.15155 4.17641 6.85182 4.65395 6.60713 5.17892C6.40828 5.60556 6.24263 6.06975 6.11494 6.5625H4.13812ZM3.72196 7.6875C3.61778 8.10783 3.5625 8.54746 3.5625 9C3.5625 9.45254 3.61778 9.89217 3.72196 10.3125H5.89738C5.84161 9.88758 5.8125 9.44852 5.8125 8.99998C5.8125 8.55142 5.84161 8.11239 5.89737 7.6875H3.72196ZM7.0333 7.6875C6.97087 8.10689 6.9375 8.54634 6.9375 8.99998C6.9375 9.45367 6.97087 9.89313 7.0333 10.3125H10.9667C11.0291 9.89311 11.0625 9.45367 11.0625 9.00002C11.0625 8.54637 11.0291 8.1069 10.9667 7.6875H7.0333ZM12.1026 7.6875C12.1584 8.1124 12.1875 8.55145 12.1875 9.00002C12.1875 9.44858 12.1584 9.88762 12.1026 10.3125H14.278C14.3822 9.89217 14.4375 9.45254 14.4375 9C14.4375 8.54746 14.3822 8.10783 14.278 7.6875H12.1026ZM13.8619 6.5625H11.885C11.7574 6.06976 11.5917 5.6056 11.3929 5.17897C11.1482 4.65397 10.8484 4.1764 10.5 3.77203C11.971 4.19331 13.1868 5.21866 13.8619 6.5625ZM10.7171 6.5625H7.28293C7.38007 6.23971 7.49559 5.93571 7.62681 5.65419C7.99835 4.85708 8.48101 4.26914 8.99997 3.92442C9.51895 4.26913 10.0016 4.8571 10.3732 5.65424C10.5044 5.93575 10.6199 6.23973 10.7171 6.5625ZM4.13812 11.4375H6.11496C6.24963 11.9572 6.42655 12.4452 6.64015 12.8909C6.87835 13.3879 7.16685 13.8413 7.50006 14.228C6.02902 13.8067 4.81318 12.7814 4.13812 11.4375ZM10.7171 11.4375H7.28295C7.3869 11.7829 7.51191 12.1068 7.65465 12.4047C8.02305 13.1733 8.49456 13.7398 9.00007 14.0756C9.51902 13.7308 10.0017 13.1429 10.3732 12.3458C10.5044 12.0643 10.6199 11.7603 10.7171 11.4375ZM11.3929 12.8211C11.5917 12.3944 11.7574 11.9303 11.8851 11.4375H13.8619C13.1868 12.7813 11.971 13.8067 10.5 14.228C10.8485 13.8236 11.1482 13.346 11.3929 12.8211Z`,fill:`currentColor`})});function q({tone:e,label:t,testId:n}){return(0,B.jsx)(`span`,{"data-testid":n,className:f(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e===`success`&&`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`,e===`warning`&&`bg-[var(--oh-warning)]/15 text-[var(--oh-warning)]`,e===`neutral`&&`bg-surface-raised text-muted`),children:t})}function J(e){let[,t]=(0,I.useState)(0);(0,I.useEffect)(()=>{if(!e)return;let n=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(n)},[e])}function Y({state:e,startedAt:t,pendingCount:n}){let{t:r}=s(`openhands`),i=e===`running`;if(J(i&&t!==null),e===`idle`)return null;let a=e===`failed`;return(0,B.jsxs)(`div`,{"data-testid":`git-sync-activity-row`,"data-state":e,className:f(`mt-4 flex flex-wrap items-center gap-x-2 gap-y-1 rounded-md px-3 py-2 text-sm`,i&&`bg-tertiary text-content`,e===`succeeded`&&`bg-green-500/10 text-green-300`,a&&`bg-red-500/10 text-red-300`),children:[i&&(0,B.jsx)(m,{className:`size-4 animate-spin`,"aria-hidden":!0}),e===`succeeded`&&(0,B.jsx)(p,{className:`size-4`,"aria-hidden":!0}),a&&(0,B.jsx)(h,{className:`size-4`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`font-medium`,children:[i&&r(d.AUTOMATIONS$GIT_SYNC$SYNCING),e===`succeeded`&&r(d.AUTOMATIONS$GIT_SYNC$SYNC_COMPLETED),a&&r(d.AUTOMATIONS$GIT_SYNC$SYNC_FAILED)]}),i&&t&&(0,B.jsx)(`span`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$SYNC_STARTED_AGO,{time:x(t)})}),i&&n>0&&(0,B.jsx)(`span`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$SYNC_PENDING_COUNT,{count:n})})]})}function X(e){let t=O(e);if(!t?.host||!t.repository)return null;if(/^https?:\/\//i.test(t.url)){let e=new URL(t.url);return e.username=``,e.password=``,e.pathname=e.pathname.replace(/\.git$/,``),e.toString()}return`https://${t.host}/${t.repository}`}function Z({status:e,onSyncNow:t,isSyncing:n,syncActivity:r,syncStartedAt:i,canManage:a}){let{t:o}=s(`openhands`),c=X(e.repo_url);return(0,B.jsxs)(F,{icon:(0,B.jsx)(N,{className:`size-4`}),title:o(d.AUTOMATIONS$GIT_SYNC$STATUS_TITLE),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(q,{testId:`git-sync-enabled-pill`,tone:e.enabled?`success`:`neutral`,label:o(e.enabled?d.AUTOMATIONS$GIT_SYNC$ENABLED:d.AUTOMATIONS$GIT_SYNC$DISABLED)}),(0,B.jsx)(q,{testId:`git-sync-encryption-pill`,tone:e.encryption_enabled?`success`:`neutral`,label:o(e.encryption_enabled?d.AUTOMATIONS$GIT_SYNC$ENCRYPTED:d.AUTOMATIONS$GIT_SYNC$NOT_ENCRYPTED)})]}),(0,B.jsx)(y,{testId:`git-sync-now-button`,type:`button`,variant:`secondary`,isDisabled:!a||!e.enabled||n,onClick:t,startContent:(0,B.jsx)(m,{className:f(`size-4`,n&&`animate-spin`),"aria-hidden":!0}),children:o(n?d.AUTOMATIONS$GIT_SYNC$SYNCING:d.AUTOMATIONS$GIT_SYNC$SYNC_NOW)})]}),(0,B.jsx)(Y,{state:r,startedAt:i,pendingCount:e.dirty_count}),(0,B.jsxs)(`div`,{className:`mt-5 grid grid-cols-2 gap-x-4 gap-y-5`,children:[(0,B.jsx)(P,{icon:(0,B.jsx)(K,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$REPOSITORY),children:c?(0,B.jsx)(`a`,{"data-testid":`git-sync-repo-link`,href:c,target:`_blank`,rel:`noopener noreferrer`,className:`break-all underline transition-colors hover:text-foreground`,children:e.repo_url}):(0,B.jsx)(`span`,{className:`break-all`,children:e.repo_url||o(d.AUTOMATIONS$GIT_SYNC$NOT_CONFIGURED)})}),(0,B.jsx)(P,{icon:(0,B.jsx)(N,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$FIELD_BRANCH),children:e.branch}),(0,B.jsx)(P,{icon:(0,B.jsx)(S,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$FIELD_PATH),children:e.path}),(0,B.jsx)(P,{icon:(0,B.jsx)(N,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$LAST_SYNCED_COMMIT),children:e.last_synced_commit?(0,B.jsx)(`span`,{className:`font-mono`,children:e.last_synced_commit.slice(0,7)}):o(d.AUTOMATIONS$GIT_SYNC$NEVER_SYNCED)}),(0,B.jsx)(P,{icon:(0,B.jsx)(C,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$LAST_SYNCED_AT),children:e.last_synced_at?`${x(e.last_synced_at)} ${o(d.CONVERSATION$AGO)}`:o(d.AUTOMATIONS$GIT_SYNC$NEVER_SYNCED)}),(0,B.jsx)(P,{icon:(0,B.jsx)(C,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$FIELD_INTERVAL),children:e.interval_seconds>0?o(d.AUTOMATIONS$GIT_SYNC$EVERY_N_SECONDS,{count:e.interval_seconds}):o(d.AUTOMATIONS$GIT_SYNC$MANUAL_ONLY)}),(0,B.jsx)(P,{icon:(0,B.jsx)(C,{className:`size-3.5`}),label:o(d.AUTOMATIONS$GIT_SYNC$PENDING_CHANGES),children:(0,B.jsx)(`span`,{className:f(e.dirty_count>0&&`text-[var(--oh-warning)]`),children:e.dirty_count})})]})]})}var Q=`git-sync-save-and-sync`;function $({status:e,canManage:t,onSyncNow:n}){let{t:r}=s(`openhands`),{mutate:i,isPending:a}=te(),{mutateAsync:o,isPending:l}=ne(),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),[x,S]=(0,I.useState)(!1),[C,w]=(0,I.useState)(!1),[D,O]=(0,I.useState)(!1),[k,A]=(0,I.useState)(!1),[j,M]=(0,I.useState)(null),N=j??e.enabled,P=j!==null&&N!==e.enabled,[L,R]=(0,I.useState)(``),[z,V]=(0,I.useState)(!1),[H,U]=(0,I.useState)(``),[W,G]=(0,I.useState)(!1),K=L.trim().length>0||z,q=H.trim().length>0||W,J=!P&&!m&&!g&&!x&&!C&&!D&&!k&&!K&&!q,Y=()=>{M(null),h(!1),_(!1),S(!1),w(!1),O(!1),A(!1),R(``),V(!1),U(``),G(!1),p(null)},X=e=>{V(e),R(``)},Z=e=>{G(e),U(``)},$=(e,t)=>e.get(t)?.toString().trim()||null,re=(e,t)=>{i(e,{onSuccess:()=>{c(r(d.AUTOMATIONS$GIT_SYNC$CONFIG_SAVED)),Y(),t&&n()},onError:e=>{u(v(e)===409?r(d.AUTOMATIONS$GIT_SYNC$ENABLE_BLOCKED_ERROR):E(e,r(d.ERROR$GENERIC)))}})},ie=e=>[`repo_url`,`branch`,`token`].filter(t=>t in e).map(t=>`${t}=${e[t]}`).join(`&`),ae=async e=>{try{let t=await o(e);return t.ok?null:t.detail??r(d.AUTOMATIONS$GIT_SYNC$CHECK_FAILED_TITLE)}catch{return null}};return(0,B.jsx)(F,{icon:(0,B.jsx)(ee,{className:`size-4`}),title:r(d.AUTOMATIONS$GIT_SYNC$CONFIG_TITLE),children:(0,B.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault();let t=e.nativeEvent.submitter?.getAttribute(`name`)===Q,n=new FormData(e.currentTarget),r={};if(P&&(r.enabled=N),m){let e=n.get(`git-sync-interval-input`)?.toString().trim(),t=Number(e);r.interval_seconds=e&&Number.isFinite(t)?Math.max(0,Math.trunc(t)):0}g&&(r.repo_url=$(n,`git-sync-repo-url-input`)),x&&(r.branch=$(n,`git-sync-branch-input`)),C&&(r.path=$(n,`git-sync-path-input`)),D&&(r.author_name=$(n,`git-sync-author-name-input`)),k&&(r.author_email=$(n,`git-sync-author-email-input`));let i=L.trim(),a=H.trim();z?r.token=null:i&&(r.token=i),W?r.encryption_key=null:a&&(r.encryption_key=a);let o=ie(r);if(o&&f?.key!==o){let e=await ae(r);if(e){p({key:o,detail:e});return}}p(null),re(r,t)},className:`flex flex-col gap-6`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(T,{testId:`git-sync-enabled-switch`,isToggled:N,isDisabled:!t,onToggle:M,children:r(d.AUTOMATIONS$GIT_SYNC$FIELD_ENABLED)}),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$ENABLED_HELP)})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(b,{testId:`git-sync-interval-input`,name:`git-sync-interval-input`,type:`number`,min:0,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_INTERVAL),defaultValue:String(e.interval_seconds),isDisabled:!t,onChange:t=>h(t.trim()!==String(e.interval_seconds))}),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$INTERVAL_HELP)})]}),(0,B.jsx)(b,{testId:`git-sync-repo-url-input`,name:`git-sync-repo-url-input`,type:`text`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_REPO_URL),defaultValue:e.repo_url,placeholder:r(d.AUTOMATIONS$GIT_SYNC$REPO_URL_PLACEHOLDER),isDisabled:!t,onChange:t=>_(t.trim()!==e.repo_url)}),(0,B.jsx)(b,{testId:`git-sync-branch-input`,name:`git-sync-branch-input`,type:`text`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_BRANCH),defaultValue:e.branch,placeholder:r(d.AUTOMATIONS$GIT_SYNC$BRANCH_PLACEHOLDER),isDisabled:!t,onChange:t=>S(t.trim()!==e.branch)}),(0,B.jsx)(b,{testId:`git-sync-path-input`,name:`git-sync-path-input`,type:`text`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_PATH),defaultValue:e.path,placeholder:r(d.AUTOMATIONS$GIT_SYNC$PATH_PLACEHOLDER),isDisabled:!t,onChange:t=>w(t.trim()!==e.path)}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(b,{testId:`git-sync-author-name-input`,name:`git-sync-author-name-input`,type:`text`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_AUTHOR_NAME),showOptionalTag:!0,defaultValue:``,isDisabled:!t,onChange:()=>O(!0)}),(0,B.jsx)(b,{testId:`git-sync-author-email-input`,name:`git-sync-author-email-input`,type:`email`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_AUTHOR_EMAIL),showOptionalTag:!0,defaultValue:``,isDisabled:!t,onChange:()=>A(!0)}),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$AUTHOR_HELP)})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(b,{testId:`git-sync-token-input`,name:`git-sync-token-input`,type:`password`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_TOKEN),placeholder:r(d.AUTOMATIONS$GIT_SYNC$TOKEN_PLACEHOLDER),isDisabled:!t||z,onChange:R},z?`token-cleared`:`token-editable`),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$TOKEN_HELP)}),(0,B.jsx)(T,{testId:`git-sync-clear-token-switch`,isToggled:z,isDisabled:!t,onToggle:X,children:r(d.AUTOMATIONS$GIT_SYNC$CLEAR_TOKEN)})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(b,{testId:`git-sync-encryption-key-input`,name:`git-sync-encryption-key-input`,type:`password`,label:r(d.AUTOMATIONS$GIT_SYNC$FIELD_ENCRYPTION_KEY),placeholder:r(e.encryption_enabled?d.AUTOMATIONS$GIT_SYNC$KEY_SET_PLACEHOLDER:d.AUTOMATIONS$GIT_SYNC$KEY_UNSET_PLACEHOLDER),isDisabled:!t||W,onChange:U},W?`key-cleared`:`key-editable`),(0,B.jsx)(`p`,{className:`text-xs text-muted`,children:r(d.AUTOMATIONS$GIT_SYNC$ENCRYPTION_KEY_HELP)}),(0,B.jsx)(T,{testId:`git-sync-clear-encryption-key-switch`,isToggled:W,isDisabled:!t,onToggle:Z,children:r(d.AUTOMATIONS$GIT_SYNC$CLEAR_ENCRYPTION_KEY)})]}),f&&(0,B.jsxs)(`div`,{role:`alert`,"data-testid":`git-sync-check-failure`,className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-300 whitespace-pre-wrap break-words`,children:[(0,B.jsx)(`p`,{className:`font-medium`,children:r(d.AUTOMATIONS$GIT_SYNC$CHECK_FAILED_TITLE)}),(0,B.jsx)(`p`,{className:`mt-1`,children:f.detail}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-red-300/70`,children:r(d.AUTOMATIONS$GIT_SYNC$CHECK_FAILED_HINT)})]}),(0,B.jsxs)(`div`,{className:`flex justify-start gap-3`,children:[(0,B.jsxs)(y,{testId:`git-sync-save-button`,variant:`primary`,type:`submit`,isDisabled:!t||a||l||J,children:[!a&&!l&&r(d.SETTINGS$SAVE_CHANGES),l&&r(d.AUTOMATIONS$GIT_SYNC$CHECKING),a&&r(d.SETTINGS$SAVING)]}),(0,B.jsx)(y,{testId:`git-sync-save-and-sync-button`,name:Q,variant:`secondary`,type:`submit`,isDisabled:!t||a||l||J||!N,children:r(d.AUTOMATIONS$GIT_SYNC$SAVE_AND_SYNC)})]})]})})}var re=3e3,ie=15e3,ae=3e4,oe=e=>({state:`running`,startedAt:e.sync_started_at??new Date().toISOString(),lastSyncedAt:e.last_synced_at,lastErrorAt:e.last_error_at}),se=r(function(){let{t:e}=s(`openhands`),t=l(),{canManage:n}=D(),[r,i]=(0,I.useState)({state:`idle`}),a=r.state===`running`,{data:o,isLoading:c,refetch:f}=w(),p=o?.status===`ok`,m=t.backend.kind===`local`,{data:h,isLoading:g,error:_,refetch:y}=R({enabled:p&&m,refetchInterval:a?re:ie});(0,I.useEffect)(()=>{h?.sync_in_progress&&i(e=>e.state===`running`?e:oe(h))},[h]),(0,I.useEffect)(()=>{r.state!==`running`||!h||(h.last_error_at&&h.last_error_at!==r.lastErrorAt?i({state:`failed`}):h.last_synced_at&&h.last_synced_at!==r.lastSyncedAt&&i({state:`succeeded`}))},[h,r]),(0,I.useEffect)(()=>{if(!a)return;let e=setTimeout(()=>i({state:`idle`}),ae);return()=>clearTimeout(e)},[a,r]);let b=z();if(!m)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(U,{})})});if(c)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(H,{})})});if(!p)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(k,{onRetry:f})})});if(g)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsx)(H,{})})});if(!h)return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:v(_)===404?(0,B.jsx)(W,{}):(0,B.jsx)(j,{onRetry:()=>y()})})});let x=()=>{b.mutate(void 0,{onSuccess:()=>i(oe(h)),onError:t=>{u(v(t)===503?e(d.AUTOMATIONS$GIT_SYNC$SYNC_DISABLED_ERROR):E(t,e(d.ERROR$GENERIC)))}})};return(0,B.jsx)(`div`,{className:`min-h-full`,children:(0,B.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(M,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:e(d.AUTOMATIONS$GIT_SYNC$TITLE)}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(d.AUTOMATIONS$GIT_SYNC$SUBTITLE)})]}),h.last_error&&(0,B.jsx)(G,{error:h.last_error,errorAt:h.last_error_at}),(0,B.jsx)(Z,{status:h,onSyncNow:x,isSyncing:b.isPending||a,syncActivity:r.state,syncStartedAt:a?r.startedAt:null,canManage:n}),(0,B.jsx)($,{status:h,canManage:n,onSyncNow:x})]})})})});export{se as default};
@@ -0,0 +1,3 @@
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{F as r,P as i,R as a,U as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{l as s}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as c}from"./useTranslation-CCgUjPJF.js";import{$ as l,n as u}from"./active-backend-context-BETEdaJl.js";import{K as d,t as f}from"./utils-CbjwNcR-.js";import{r as p}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~skills-setti~eo2nf80n-fgzdgvrL.js";import{t as m}from"./loading-spinner-BJc2J0Dw.js";import{C as h,I as g,L as _,P as v,R as ee,S as y,_ as te,a as b,b as ne,c as x,d as re,f as S,g as ie,h as C,i as w,l as ae,m as oe,n as T,o as se,p as E,r as ce,s as D,t as le,u as ue,v as de,y as fe}from"./use-tracking-BAFpgpgq.js";import{l as O}from"./settings-service.api-CYBTLGOd.js";import{n as pe}from"./use-settings-D69cw06D.js";import{t as me}from"./modal-backdrop-BSzNhM4r.js";import{n as he}from"./modal-classes-BPcBCWVj.js";import{f as ge,l as _e}from"./form-control-classes-BVI_szaj.js";import{t as k}from"./brand-button-CGUwj6zK.js";import{t as A}from"./navigation-link-Bxo3-4vo.js";import{t as ve}from"./settings-dropdown-input-Df_HXRk4.js";import{o as ye,s as j,t as M}from"./conversation-store-DC-JlJuq.js";import{t as be}from"./modal-close-button-Cq3dma5u.js";import{t as N}from"./settings-input-B3i5U9GL.js";import{t as xe}from"./use-llm-profiles-U4u1gzuk.js";import{n as P}from"./use-create-conversation-D15Px574.js";import{t as Se}from"./api-error-message-BXo0lCI5.js";import{t as F}from"./mcp-installed-servers-BW51n6PC.js";import{t as I}from"./vendor~root-layout~index-home~home~conversation-panel~conversation~mcp~automations-list~aut~ibfbmr9f-BIjRfQ4u.js";import{n as L,o as Ce,s as R}from"./mcp-marketplace-utils-BwEnDYqm.js";import{a as we,i as Te,n as Ee,r as De}from"./use-manifest-capabilities-D81_YdAF.js";import{t as z}from"./git-repo-dropdown-DNlinQ7r.js";import"./git-repo-dropdown-1fZGYtYm.js";var B=e(t(),1);function Oe(e){let t=e.requires.integrations,{data:n,isLoading:r}=pe(),i=(0,B.useMemo)(()=>F(O(n?.agent_settings?.mcp_config)),[n?.agent_settings?.mcp_config]),a=(0,B.useMemo)(()=>{let e=R(I);return Object.entries(t).map(([t,n])=>({id:t,requirement:n,entry:Ce(t,e)??null})).filter(({entry:e})=>!e||!L(e,i))},[t,i]),o=a.filter(({requirement:e})=>e.required!==!1);return{blockingIntegrations:o,warningIntegrations:a.filter(({requirement:e})=>e.required===!1),isBlocked:o.length>0,isLoading:r}}var V={fieldErrors:{},formErrors:[]};function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function U(e,t){let n=e[0]===`body`?e.slice(1):e,r=[],i=t;return n.forEach(e=>{if(typeof e==`number`){Array.isArray(i)&&r.length>0&&(r[r.length-1]+=`[${e}]`,i=i[e]);return}H(i)&&e in i&&(r.push(e),i=i[e])}),r.join(`.`)}function ke(e,t){if(!H(e))return[];if(Array.isArray(e.errors))return e.errors.flatMap(e=>!H(e)||typeof e.message!=`string`?[]:[{path:typeof e.field==`string`?e.field:``,message:e.message}]);let{detail:n}=e;return typeof n==`string`?[{path:``,message:n}]:Array.isArray(n)?n.flatMap(e=>!H(e)||typeof e.msg!=`string`?[]:[{path:U(Array.isArray(e.loc)?e.loc:[],t),message:e.msg}]):[]}function Ae(e,t){return t[e]??t[e.replace(/\[\d+\]/g,`[0]`)]}function je(e,t){if(e.length===0)return V;let n={},r=[];return e.forEach(({path:e,message:i})=>{let a=e?Ae(e,t):void 0;if(!a?.length){r.push(i);return}a.forEach(e=>{e in n||(n[e]=i)})}),{fieldErrors:n,formErrors:r}}var Me={fieldErrors:{},formErrors:[]},W=[404,501];function G(e){return W.some(t=>l(e,t)||s.isAxiosError(e)&&e.response?.status===t)}function Ne(e){let t=(0,B.useRef)(0);return(0,B.useCallback)(async(n,r,i)=>{try{let a=b(e,n,r,i);if(!a)return null;t.current+=1;let o=t.current,s=await T.validateDraft(a);return o===t.current?s?.valid?Me:je(ke(s,a.draft),se(e,r,i)):null}catch(e){return G(e)||console.warn(`Automation setup preflight failed:`,e),null}},[e])}var K=new TextEncoder,q=512,Pe=100,J=148;function Fe(e,t,n){let r=new Uint8Array(q),i=(e,t)=>{for(let n=0;n<t.length;n+=1)r[e+n]=t.charCodeAt(n)&127},a=(e,t,n)=>i(e,n.toString(8).padStart(t-1,`0`));return r.set(t,0),a(100,8,e.mode??420),a(108,8,0),a(116,8,0),a(124,12,n),a(136,12,0),r[156]=48,i(257,`ustar`),i(263,`00`),r.fill(32,J,156),i(J,r.reduce((e,t)=>e+t,0).toString(8).padStart(6,`0`)),r[154]=0,r[155]=32,r}function Ie(e){let t=[];for(let n of e){let e=K.encode(n.name);if(e.length>Pe)throw Error(`tar: name too long for a ustar header: ${n.name}`);let r=K.encode(n.content);t.push(Fe(n,e,r.length));let i=new Uint8Array(Math.ceil(r.length/q)*q);i.set(r),t.push(i)}t.push(new Uint8Array(q*2));let n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(new ArrayBuffer(n)),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}async function Le(e){let t=Ie(e),n=new ReadableStream({start(e){e.enqueue(t),e.close()}}),r=new Response(n.pipeThrough(new CompressionStream(`gzip`)));return new Uint8Array(await r.arrayBuffer())}function Re(e){let t=p?.(e);if(!t||Object.keys(t).length===0)throw Error(`The published extensions package ships no bundle files for '${e}'.`);return t}function ze(e){let t=(e.entrypoint.trim().split(` `)[0]??``).replace(/^\.\//,``);return new Set([e.setupScript,t in e.files?t:void 0].filter(e=>e!==void 0))}async function Be(e,t){let n=e.setup.bundle;if(!n)throw Error(`'${e.id}' declares no bundle.`);let r=Re(e.id),i=Object.keys(n.files).filter(e=>typeof r[e]!=`string`);if(i.length>0)throw Error(`The published extensions package is missing bundle files for '${e.id}': ${i.join(`, `)}.`);let a=w(e,t)?.template,o=ze(n),s=Object.keys(n.files).sort().map(e=>({name:e,content:r[e],mode:o.has(e)?493:420}));return s.push({name:_,content:`${JSON.stringify(a?.config??{},null,2)}\n`}),Le(s)}function Ve(e){return typeof File<`u`&&e instanceof File}function He(e,t,n){let r=t.tarball,i=Ve(r)?{name:r.name,size:r.size,lastModified:r.lastModified}:r;return`${e.id}
2
+ ${n??``}
3
+ ${JSON.stringify({...t,tarball:i})}`}async function Ue(e){let t=e.tarball;if(!Ve(t))throw Error(`Choose a tarball before creating this automation.`);return new Uint8Array(await t.arrayBuffer())}function We(){let e=P(),t=M(e=>e.setMessageToSend),n=(0,B.useRef)(null),r=(0,B.useCallback)(async n=>{let r=await e.mutateAsync({});return r.conversation_id.startsWith(`task-`)&&r.task_id?j(r.task_id,n):ye(r.conversation_id,{draftMessage:n}),window.setTimeout(()=>t(n),0),{response:{...r}}},[e,t]);return(0,B.useCallback)(async(e,t,i,a,o)=>{if(!i)return r(ce(e,t));if(D(e)||x(e,o)){let r=He(e,t,o),i=n.current?.path??null;if(n.current?.key!==r||i===null){let a=D(e)?await Be(e,t):await Ue(t);i=await T.uploadAutomationTarball(e.id,a),n.current={key:r,path:i}}let s=w(e,t,i,a,o);if(!s)throw Error(`'${e.id}' produced no create request.`);return{response:await T.createAutomationDraft(s,e,o)}}return{response:await T.createAutomationDraft(i,e,o)}},[r])}var Y=n();function Ge({name:e,field:t,values:n,canListRepositories:r,placeholder:i,disabled:a,onChange:o,onBlur:s}){let{t:l}=c(`openhands`),[u,f]=(0,B.useState)(``),p=e=>{let t=e.trim();!t||n.includes(t)||(o([...n,t]),f(``),s())},m=e=>{o(n.filter(t=>t!==e)),s()};return(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,"data-testid":`setup-list-${e}`,children:[n.length>0&&(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:n.map(t=>(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-md border border-[var(--oh-border)] px-3 py-1.5`,children:[(0,Y.jsx)(`span`,{className:`truncate text-sm`,children:t}),(0,Y.jsx)(k,{testId:`setup-list-${e}-remove-${t}`,type:`button`,variant:`ghost-danger`,isDisabled:a,ariaLabel:l(d.COMMON$REMOVE),onClick:()=>m(t),children:l(d.COMMON$REMOVE)})]},t))}),r?(0,Y.jsx)(z,{provider:t.provider??`github`,value:null,repositoryName:null,placeholder:i,disabled:a,onChange:e=>{e?.full_name&&p(e.full_name)}}):(0,Y.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Y.jsx)(`div`,{className:`grow`,children:(0,Y.jsx)(N,{testId:`setup-field-${e}`,name:e,label:``,ariaLabel:t.label,type:`text`,value:u,placeholder:i,isDisabled:a,onChange:f,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),p(u))},onBlur:()=>p(u)})}),(0,Y.jsx)(k,{testId:`setup-list-${e}-add`,type:`button`,variant:`secondary`,isDisabled:a||u.trim()===``,onClick:()=>p(u),children:l(d.BUTTON$ADD)})]})]})}function Ke({name:e,field:t,value:n,error:r,options:i,isOptionsLoading:a=!1,repository:o,disabled:s,onChange:l,onRepositoryChange:p,onBlur:m}){let{t:h}=c(`openhands`),{backend:g}=u(),_=`setup-field-${e}`,v=(0,Y.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,children:t.help}),ee=g.kind===`cloud`,y=t.placeholder??h(d.SETUP$REPOSITORY_PLACEHOLDER);if(t.type===`repo-picker`&&t.multiple)return(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2.5`,children:[(0,Y.jsx)(Z,{field:t}),(0,Y.jsx)(Ge,{name:e,field:t,values:E(n),canListRepositories:ee,placeholder:y,disabled:s,onChange:l,onBlur:m}),(0,Y.jsx)(Q,{testId:_,error:r}),v]});if(t.type===`repo-picker`&&ee)return(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2.5`,children:[(0,Y.jsx)(Z,{field:t}),(0,Y.jsx)(z,{provider:t.provider??`github`,value:o?.id??null,repositoryName:o?.full_name??S(n)??null,placeholder:t.placeholder,disabled:s,onChange:e=>{p(e??null),l(e?.full_name??``),m()}}),(0,Y.jsx)(Q,{testId:_,error:r}),v]});if(t.type===`select`||t.type===`llm-profile`||[`timezone`,`event-source`,`event-type`].includes(t.type)&&i.length>0){let o=i.length>0,c=t.type===`llm-profile`&&!a&&!o;return(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2.5`,children:[(0,Y.jsx)(ve,{testId:_,name:e,label:(0,Y.jsx)(X,{field:t}),items:i.map(e=>({key:e.value,label:e.label})),selectedKey:S(n)||void 0,placeholder:c?h(d.MODEL$NO_SAVED_PROFILES):t.placeholder,isDisabled:s||c,isLoading:a,required:t.required,onSelectionChange:e=>{l(e===null?``:String(e)),m()}}),(0,Y.jsx)(Q,{testId:_,error:r}),v]})}if(t.type===`plugin-sources`)return(0,Y.jsxs)(`label`,{className:`flex w-full flex-col gap-2.5`,children:[(0,Y.jsx)(X,{field:t}),(0,Y.jsx)(`textarea`,{"data-testid":_,name:e,rows:4,value:S(n),placeholder:t.placeholder,disabled:s,"aria-invalid":!!r,onChange:e=>l(e.target.value),onBlur:m,className:f(_e,r&&`border-red-500`)}),(0,Y.jsx)(Q,{testId:_,error:r}),v]});if(t.type===`tarball-upload`)return(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2.5`,children:[(0,Y.jsx)(Z,{field:t}),(0,Y.jsx)(`input`,{"data-testid":_,name:e,type:`file`,accept:`.tar,.tar.gz,.tgz,application/gzip,application/x-tar`,disabled:s,"aria-invalid":!!r,onChange:e=>{l(e.target.files?.[0]??``),m()},className:f(ge,`file:mr-3 file:rounded-md file:border-0 file:bg-neutral-700 file:px-3 file:py-1.5 file:text-sm file:text-white`,r&&`border-red-500`)}),S(n)&&(0,Y.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,children:S(n)}),(0,Y.jsx)(Q,{testId:_,error:r}),v]});if(t.type===`textarea`)return(0,Y.jsxs)(`label`,{className:`flex w-full flex-col gap-2.5`,children:[(0,Y.jsx)(X,{field:t}),(0,Y.jsx)(`textarea`,{"data-testid":_,name:e,rows:4,value:S(n),placeholder:t.placeholder,disabled:s,"aria-invalid":!!r,onChange:e=>l(e.target.value),onBlur:m,className:f(_e,r&&`border-red-500`)}),(0,Y.jsx)(Q,{testId:_,error:r}),v]});let te=t.type===`repo-picker`?y:t.placeholder;return(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2.5`,children:[(0,Y.jsx)(N,{testId:_,name:e,type:t.type===`number`?`number`:`text`,label:t.label,value:S(n),placeholder:te,isDisabled:s,min:t.constraints?.min,max:t.constraints?.max,showRequiredTag:t.required,error:r,onChange:l,onBlur:m}),v]})}function X({field:e}){return(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[e.label,e.required&&(0,Y.jsx)(`span`,{className:`text-sm leading-none text-red-400`,"aria-hidden":!0,children:`*`})]})}function Z({field:e}){return(0,Y.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Y.jsx)(X,{field:e})})}function Q({testId:e,error:t}){return t?(0,Y.jsx)(`p`,{role:`alert`,"data-testid":`${e}-error`,className:`-mt-1 text-xs text-red-400`,children:t}):null}var qe=`/mcp`;function Je({prerequisites:e}){let{t}=c(`openhands`),{blockingIntegrations:n,warningIntegrations:r}=e;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`setup-prerequisites`,children:[[...n,...r].map(({id:e,requirement:t,entry:n})=>(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-sm`,children:n?.name??e}),(0,Y.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:t.message})]},e)),(0,Y.jsx)(A,{to:qe,className:`text-sm underline`,children:t(d.SETUP$MANAGE_INTEGRATIONS)})]})}function Ye({setup:e,values:t,selectedTrigger:n,selectedAction:r}){let{t:i}=c(`openhands`);return(0,Y.jsx)(`div`,{className:`flex flex-col gap-4`,"data-testid":`setup-review`,children:(0,Y.jsxs)(`dl`,{className:`flex flex-col gap-3`,children:[r&&e.actions?.[r]&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-[var(--oh-muted)]`,children:i(d.SETUP$ACTION_LABEL)}),(0,Y.jsx)(`dd`,{className:`text-sm break-words`,children:e.actions[r]?.label})]}),Object.entries(re(e,n,r)).map(([e,n])=>(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-[var(--oh-muted)]`,children:n.label}),(0,Y.jsx)(`dd`,{className:`text-sm break-words`,children:E(t[e]).join(`, `)||i(d.SETUP$EMPTY_VALUE)})]},e))]})})}var Xe=400,$={fieldErrors:{},formErrors:[]};function Ze(e){return e.formErrors.length>0||Object.keys(e.fieldErrors).length>0}function Qe(e){return typeof e.conversation_id==`string`?`/conversations/${e.conversation_id}`:typeof e.id==`string`?y(e.id):null}function $e({entry:e,onClose:t}){let{t:n}=c(`openhands`),r=a(),i=Ee(e),o=Oe(e),s=Ne(e),l=We(),{trackAutomationSetupOpened:u,trackAutomationSetupValidated:p,trackAutomationSetupCreated:h,trackAutomationSetupFailed:g}=le(),[_,v]=(0,B.useState)(`prerequisites`),y=(0,B.useMemo)(()=>fe(e.setup),[e]),b=(0,B.useMemo)(()=>y.length===0?[]:i.capabilities?Te(e,i.capabilities):y,[y,i.capabilities,e]),x=(0,B.useMemo)(()=>ue(e.setup),[e]),[S,T]=(0,B.useState)(()=>te(e.setup)),[E,ce]=(0,B.useState)(()=>ie(e.setup)),[D,O]=(0,B.useState)(()=>C(e.setup,te(e.setup),ie(e.setup))),[pe,ge]=(0,B.useState)({}),[_e,A]=(0,B.useState)({}),[ye,j]=(0,B.useState)($),[M,N]=(0,B.useState)(!1),P=(0,B.useRef)(D),F=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{F.current&&window.clearTimeout(F.current)},[]);let I=(0,B.useMemo)(()=>x.length===0?[]:(i.capabilities?De(e,i.capabilities):x).filter(t=>ae(e,t).length===0),[x,i.capabilities,e]),L=(0,B.useMemo)(()=>re(e.setup,S,E),[e,S,E]),Ce=D.agent_profile_id?Object.fromEntries(Object.entries(L).filter(([,e])=>e.type!==`llm-profile`)):L,R=(0,B.useMemo)(()=>Object.values(L).some(e=>e.type===`llm-profile`),[L]),{data:z,isLoading:V}=xe({enabled:R}),H=(0,B.useMemo)(()=>(z?.profiles??[]).map(e=>({value:e.name,label:e.name})),[z?.profiles]),U=(0,B.useMemo)(()=>{let t=de(e.setup,i.capabilities,S,E);return!R||V?t:Object.entries(L).reduce((e,[t,n])=>n.type===`llm-profile`?{...e,[t]:{options:H}}:e,t)},[e.setup,i.capabilities,S,E,R,V,L,H]),Ae=(0,B.useMemo)(()=>w(e,D,void 0,S,E),[e,D,S,E]),Me=(0,B.useMemo)(()=>se(e,S,E),[e,S,E]),W=(0,B.useRef)(!1);(0,B.useEffect)(()=>{W.current||(W.current=!0,u({automationId:e.id}))},[e.id,u]);let G=(0,B.useMemo)(()=>ae(e,E),[e,E]),K=i.supported===!1||G.length>0,q=[...i.unmet,...G],Pe=o.blockingIntegrations.length>0||o.warningIntegrations.length>0,J=_===`prerequisites`&&!Pe?`form`:_,Fe=t=>{T(t),P.current={...C(e.setup,t,E),...P.current},O(P.current),A({}),j($)},Ie=t=>{ce(t),P.current={...C(e.setup,S,t),...P.current},O(P.current),A({}),j($)};(0,B.useEffect)(()=>{y.length===0||i.isLoading||S&&b.includes(S)||b.length>0&&Fe(b[0])},[b,y.length,i.isLoading,S]),(0,B.useEffect)(()=>{x.length===0||i.isLoading||E&&I.includes(E)||I.length>0&&Ie(I[0])},[I,x.length,i.isLoading,E]);let Le=(e,t)=>{P.current={...P.current,[e]:t},O(P.current),A(({[e]:t,...n})=>n),j(t=>{if(!(e in t.fieldErrors))return t;let{[e]:n,...r}=t.fieldErrors;return{...t,fieldErrors:r}})},Re=()=>{F.current&&window.clearTimeout(F.current),F.current=window.setTimeout(()=>{s(P.current,S,E).then(e=>{e&&j(e)})},Xe)},ze=async()=>{if(J===`prerequisites`){v(`form`);return}let t=ne(e.setup,D,U,S,E);if(Object.keys(t).length>0){A(t);return}A({});let n=await s(D,S,E);if(n&&Ze(n)){j(n);return}j($),p({automationId:e.id}),v(`review`)},Be=async(i,a)=>{N(!0);try{let{response:n}=await l(e,D,i,S,E);h({automationId:e.id,setupMode:a});let o=Qe(n);o?r(o,{replace:!0}):t()}catch(t){g({automationId:e.id,setupMode:a});let r=je(ke(Se(t),i),Me);j(Ze(r)?r:{fieldErrors:{},formErrors:[n(d.SETUP$SUBMIT_FAILED)]}),v(`form`)}finally{N(!1)}},Ve=()=>Be(Ae,e.setup.mode),He=()=>Be(null,`assisted`),Ue=e.setup.mode===`direct`&&(ee(e)!==null||e.setup.message!==void 0),Ge=e=>{let t=_e[e];return t?et(t,n):ye.fieldErrors[e]},X=i.isLoading||o.isLoading,Z=R&&V,Q=K?n(d.SETUP$UNAVAILABLE_TITLE):J===`prerequisites`?n(d.SETUP$PREREQUISITES_TITLE):J===`review`?n(d.SETUP$REVIEW_TITLE):e.name;return(0,Y.jsx)(me,{onClose:t,"aria-label":e.name,children:(0,Y.jsxs)(`div`,{"data-testid":`setup-dialog`,className:`relative flex max-h-[85vh] w-[92vw] max-w-lg flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,Y.jsx)(be,{onClose:t,testId:`setup-dialog-close`,disabled:M}),(0,Y.jsx)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:(0,Y.jsx)(`h2`,{className:f(`pr-6`,he),children:Q})}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6`,children:[X&&(0,Y.jsx)(`div`,{className:`flex justify-center py-6`,children:(0,Y.jsx)(m,{size:`small`})}),!X&&K&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:n(d.SETUP$UNSUPPORTED_MESSAGE)}),q.length>0&&(0,Y.jsx)(`p`,{"data-testid":`setup-unmet-requirements`,className:`text-sm text-[var(--oh-muted)]`,children:q.join(`, `)})]}),!X&&!K&&J===`prerequisites`&&(0,Y.jsx)(Je,{prerequisites:o}),!X&&!K&&J===`form`&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:e.description}),e.setup.form.note&&(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:e.setup.form.note}),x.length>1&&I.length>1&&(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2.5`,children:[(0,Y.jsx)(ve,{testId:`setup-action-kind`,name:`actionKind`,label:n(d.SETUP$ACTION_LABEL),items:I.map(t=>({key:t,label:e.setup.actions?.[t]?.label??t})),selectedKey:E??void 0,isDisabled:M,required:!0,onSelectionChange:e=>{e!==null&&Ie(String(e))}}),E&&e.setup.actions?.[E]&&(0,Y.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,children:e.setup.actions[E]?.help})]}),b.length>1&&(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2.5`,children:[(0,Y.jsx)(ve,{testId:`setup-trigger-kind`,name:`triggerKind`,label:n(d.SETUP$TRIGGER_LABEL),items:b.map(e=>({key:e,label:e===`cron`?`Scheduled`:`Event`})),selectedKey:S??void 0,isDisabled:M,required:!0,onSelectionChange:e=>{e!==null&&Fe(String(e))}}),(0,Y.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,children:n(d.SETUP$TRIGGER_HELP)})]}),i.capabilities?.features.includes(`agentProfiles`)&&(0,Y.jsx)(we,{value:typeof D.agent_profile_id==`string`?D.agent_profile_id:null,onChange:e=>Le(`agent_profile_id`,e??``)}),Object.entries(Ce).map(([e,t])=>(0,Y.jsx)(Ke,{name:e,field:t,value:D[e]??``,error:Ge(e),options:oe(e,t,U),repository:pe[e]??null,disabled:M,isOptionsLoading:t.type===`llm-profile`&&Z,onChange:t=>Le(e,t),onRepositoryChange:t=>ge(n=>({...n,[e]:t})),onBlur:Re},e))]}),!X&&!K&&J===`review`&&(0,Y.jsx)(Ye,{setup:e.setup,values:D,selectedTrigger:S,selectedAction:E}),ye.formErrors.map(e=>(0,Y.jsx)(`p`,{role:`alert`,"data-testid":`setup-form-error`,className:`pt-4 text-sm text-red-400`,children:e},e))]}),(0,Y.jsxs)(`footer`,{className:`flex flex-shrink-0 justify-end gap-2 px-6 pb-6 pt-4`,children:[J===`review`&&(0,Y.jsx)(k,{testId:`setup-back-button`,type:`button`,variant:`secondary`,isDisabled:M,onClick:()=>v(`form`),children:n(d.BUTTON$BACK)}),K?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{type:`button`,variant:`secondary`,isDisabled:M,onClick:t,children:n(d.BUTTON$CLOSE)}),Ue&&(0,Y.jsx)(k,{testId:`setup-fallback-conversation`,type:`button`,variant:`primary`,isDisabled:M,onClick:He,children:n(d.SETUP$FALLBACK_CONVERSATION)})]}):(0,Y.jsx)(k,{testId:`setup-continue-button`,type:`button`,variant:`primary`,isDisabled:X||Z||M||J===`prerequisites`&&o.isBlocked,onClick:J===`review`?Ve:ze,children:n(J===`review`?d.SETUP$CONFIRM:d.BUTTON$CONTINUE)})]})]})})}function et(e,t){switch(e.code){case`required`:return t(d.SETUP$VALIDATION_REQUIRED);case`minLength`:return t(d.SETUP$VALIDATION_MIN_LENGTH,{length:e.length});case`maxLength`:return t(d.SETUP$VALIDATION_MAX_LENGTH,{length:e.length});case`min`:return`Must be at least ${e.value}.`;case`max`:return`Must be at most ${e.value}.`;case`invalidOption`:return t(d.SETUP$VALIDATION_INVALID_OPTION);case`unsafeExpressionLiteral`:return t(d.SETUP$VALIDATION_UNSAFE_VALUE);default:return e}}var tt=({params:e})=>{let t=g.findById(e.automationId??``);if(!t||!v())throw new Response(null,{status:404,statusText:`Not Found`});return{automationId:t.id}},nt=o(function(){let{automationId:e}=i(),t=r(),n=a(),o=g.findById(e);return o?(0,Y.jsx)($e,{entry:o,onClose:()=>{t.key==="default"?n(h(),{replace:!0}):n(-1)}}):null});export{tt as clientLoader,nt as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{U as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{t as i}from"./recommended-automations-launcher-r0oI91HN.js";import{N as a}from"./use-tracking-ChnSFChv.js";import{n as o,r as s,t as c}from"./manifest-subpage-layout-sxuPqfUr.js";var l=e(t(),1),u=n(),d=()=>{if(!a())throw new Response(null,{status:404,statusText:`Not Found`});return null},f=r(function(){let[e,t]=(0,l.useState)(``),n=a(),r=o();return!n||!r?null:(0,u.jsxs)(c,{heading:r.heading,navTestIdBase:`automations-navbar`,items:r.items,children:[(0,u.jsxs)(`div`,{className:`min-w-0`,children:[(0,u.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:n.title}),(0,u.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:n.description})]}),(0,u.jsx)(`div`,{className:`w-full`,children:(0,u.jsx)(s,{value:e,onChange:t})}),(0,u.jsx)(i,{query:e})]})});export{d as clientLoader,f as default};
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Ck5D_A2Q.js";import{U as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{t as i}from"./recommended-automations-launcher-D1Do753p.js";import{N as a}from"./use-tracking-BAFpgpgq.js";import{n as o,r as s,t as c}from"./manifest-subpage-layout-DGYRoP_8.js";var l=e(t(),1),u=n(),d=()=>{if(!a())throw new Response(null,{status:404,statusText:`Not Found`});return null},f=r(function(){let[e,t]=(0,l.useState)(``),n=a(),r=o();return!n||!r?null:(0,u.jsxs)(c,{heading:r.heading,navTestIdBase:`automations-navbar`,items:r.items,children:[(0,u.jsxs)(`div`,{className:`min-w-0`,children:[(0,u.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:n.title}),(0,u.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:n.description})]}),(0,u.jsx)(`div`,{className:`w-full`,children:(0,u.jsx)(s,{value:e,onChange:t})}),(0,u.jsx)(i,{query:e})]})});export{d as clientLoader,f as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,bt as n,yt as r}from"./vendor-styling-Ck5D_A2Q.js";import{U as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{i as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as o}from"./useQueries-pUohFMSP.js";import{t as s}from"./recommended-automations-launcher-r0oI91HN.js";import{t as c}from"./useTranslation-CCgUjPJF.js";import{ct as l,lt as u,n as d,st as f}from"./active-backend-context-BsLfwrXB.js";import{K as p,a as m,t as h}from"./utils-D-gOfhmN.js";import{t as g}from"./check-Bo8s5Ylg.js";import{t as _}from"./chevron-down-Cr6Fn_wS.js";import{g as v,r as y}from"./automation-disabled-reason-DtgC8Ppt.js";import{i as b,n as ee,r as te,t as ne}from"./empty-state-Cd-TFe7i.js";import{P as x,_ as re,c as ie,g as ae,h as oe,l as se,m as ce}from"./home-automation-run-tooltip-BdpCckKO.js";import{t as S}from"./list-filter-B8PQk3RA.js";import{t as C}from"./plus-C2e21TFC.js";import{t as le}from"./refresh-cw-BtdC3T8P.js";import{n as w,t as T}from"./context-menu-list-item-lx2zk9G7.js";import{A as ue,D as de,G as fe,P as E,S as pe,W as me,n as D,t as he,x as O}from"./use-tracking-ChnSFChv.js";import{t as k}from"./modal-backdrop-BSzNhM4r.js";import{n as ge}from"./modal-classes-jvG85nkU.js";import{t as A}from"./brand-button-mQq2Ld1I.js";import{n as _e}from"./navigation-context-CQZwH_tC.js";import{t as j,u as M}from"./dropdown-classes-goDldkiu.js";import{t as N}from"./modal-close-button-BrM5fNnn.js";import{t as P}from"./use-click-outside-element-W6Os4Nlb.js";import{t as F}from"./enum-filter-dropdown-pocrz9AL.js";import{t as ve}from"./use-automation-health-DdgSa8sA.js";import{t as I}from"./automation-C_eCrGyP.js";import{a as ye,c as L,i as be,o as xe,r as Se,t as Ce}from"./use-automations-CEubcYTD.js";import{a as R}from"./extension-module-card-classes-DpeaYhYo.js";import{n as we}from"./api-error-message-BXo0lCI5.js";import{t as Te}from"./edit-automation-modal-BJJR9wSW.js";import{t as Ee}from"./use-automation-permissions-D3kEeieu.js";import{n as De,t as Oe}from"./error-state-SuWwztxV.js";import{n as ke,r as Ae,t as je}from"./manifest-subpage-layout-sxuPqfUr.js";import{i as Me,n as Ne,r as Pe,t as Fe}from"./automation-export-Kv6e0bHx.js";var z=a(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),Ie=a(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),Le=a(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),B=e(t(),1),V=e(n(),1),H=r();function U({icon:e,label:t,isSelected:n}){return(0,H.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,H.jsx)(`span`,{className:M,"aria-hidden":!0,children:(0,H.jsx)(e,{})}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,H.jsx)(g,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}var W=[{value:`grid`,icon:Ie,labelKey:p.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:Le,labelKey:p.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function Re({view:e,onChange:t,disabled:n=!1}){let{t:r}=c(`openhands`),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(),l=(0,B.useRef)(null),u=(0,B.useRef)(null),d=(W.find(t=>t.value===e)??W[0]).icon;(0,B.useLayoutEffect)(()=>{if(!i||!l.current)return;let e=()=>{let e=l.current?.getBoundingClientRect();e&&s({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)}},[i]),(0,B.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;l.current?.contains(t)||u.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let f=i&&o?(0,H.jsx)(w,{ref:u,theme:`popover`,className:`min-w-[10rem]`,children:W.map(n=>(0,H.jsx)(`li`,{children:(0,H.jsx)(T,{testId:n.testId,onClick:()=>{t(n.value),a(!1)},className:`group`,children:(0,H.jsx)(U,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{ref:l,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(p.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||a(e=>!e)},className:h(`inline-flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-[var(--oh-border)] bg-base-secondary text-white transition-colors hover:bg-[var(--oh-interactive-hover)] focus-visible:border-white/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-base-secondary`),children:(0,H.jsx)(d,{className:`size-4`,"aria-hidden":!0})}),i&&o&&typeof document<`u`?V.createPortal((0,H.jsx)(`div`,{style:o,children:f}),document.body):null]})}function ze({onAdd:e,onImport:t,isAddDisabled:n=!1}){let{t:r}=c(`openhands`),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(),l=(0,B.useRef)(null),u=(0,B.useRef)(null);(0,B.useLayoutEffect)(()=>{if(!i||!l.current)return;let e=()=>{let e=l.current?.getBoundingClientRect();e&&s({position:`fixed`,zIndex:9999,top:e.bottom+2,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)}},[i]),(0,B.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;l.current?.contains(t)||u.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let d=e=>{e(),a(!1)},f=i&&o?(0,H.jsxs)(w,{ref:u,testId:`automations-add-automation-menu`,theme:`popover`,position:`none`,alignment:`none`,spacing:`none`,className:`min-w-[10rem]`,children:[(0,H.jsx)(`li`,{children:(0,H.jsx)(T,{testId:`automations-add-automation-create`,isDisabled:n,className:`group`,onClick:()=>{n||d(e)},children:(0,H.jsx)(y,{icon:(0,H.jsx)(C,{className:`size-4`,"aria-hidden":!0}),label:r(p.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})})}),(0,H.jsx)(`li`,{children:(0,H.jsx)(T,{testId:`automations-import-automation`,className:`group`,onClick:()=>d(t),children:(0,H.jsx)(y,{icon:(0,H.jsx)(z,{className:`size-4`,"aria-hidden":!0}),label:r(p.AUTOMATIONS$IMPORT)})})})]}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(A,{ref:l,type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`whitespace-nowrap`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[r(p.AUTOMATIONS$ADD_AUTOMATION),(0,H.jsx)(_,{className:`size-4 shrink-0`,"aria-hidden":!0})]}),i&&o&&typeof document<`u`?V.createPortal((0,H.jsx)(`div`,{style:o,children:f}),document.body):null]})}function G({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`dt`,{className:`text-xs font-medium uppercase tracking-wide text-muted`,children:e}),(0,H.jsx)(`dd`,{className:`whitespace-pre-wrap break-words text-sm text-content`,children:t})]})}function K(e){let t=e.dataTransfer?.files;return t&&t.length>0?t[0]:null}function Be({onFile:e}){let{t}=c(`openhands`),n=(0,B.useRef)(null),[r,i]=(0,B.useState)(!1),a=()=>n.current?.click();return(0,H.jsxs)(`div`,{className:`flex flex-col gap-5 px-6 pb-6`,children:[(0,H.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[t(p.AUTOMATIONS$IMPORT_EXPLAIN),` `,(0,H.jsx)(`a`,{href:O,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`import-automation-format-docs`,className:`text-white no-underline transition-colors hover:text-white`,children:t(p.AUTOMATIONS$IMPORT_FORMAT_DOCS)})]}),(0,H.jsx)(`p`,{className:`text-sm text-tertiary-light`,children:t(p.AUTOMATIONS$IMPORT_DISABLED_NOTICE)}),(0,H.jsx)(`input`,{ref:n,type:`file`,accept:`application/json,.json`,className:`hidden`,"data-testid":`automations-import-file`,onChange:()=>{let t=n.current,r=t?.files?.[0];t&&(t.value=``),r&&e(r)}}),(0,H.jsxs)(`div`,{"data-testid":`import-automation-dropzone`,"data-active":r?`true`:`false`,onClick:a,onDragEnter:e=>{e.preventDefault(),i(!0)},onDragOver:e=>{e.preventDefault(),i(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||i(!1)},onDrop:t=>{t.preventDefault(),i(!1);let n=K(t);n&&e(n)},className:h(`flex cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-10 text-center`,r?`border-[var(--oh-focus)] bg-[var(--oh-interactive-hover)]`:`border-[var(--oh-border)] bg-[var(--oh-surface)]`),children:[(0,H.jsx)(z,{className:`size-8 text-[var(--oh-muted)]`,"aria-hidden":!0}),(0,H.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(p.AUTOMATIONS$IMPORT_DROPZONE)}),(0,H.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:t(p.AUTOMATIONS$IMPORT_OR)}),(0,H.jsx)(A,{testId:`import-automation-choose-file`,type:`button`,variant:`secondary`,onClick:e=>{e?.stopPropagation(),a()},children:t(p.AUTOMATIONS$IMPORT_CHOOSE_FILE)})]})]})}function Ve({isOpen:e,spec:t,isImporting:n,onClose:r,onImport:i,onFile:a}){let{t:o}=c(`openhands`);if(!e)return null;let s=t?t.trigger.type===`event`?[t.trigger.source,v(t.trigger.on)].filter(Boolean).join(`: `):[t.trigger.schedule_human??t.trigger.schedule,t.timezone??t.trigger.timezone].filter(Boolean).join(` · `):``;return(0,H.jsx)(k,{onClose:n?void 0:r,closeOnEscape:!n,closeOnBackdropClick:!n,"aria-label":o(p.AUTOMATIONS$IMPORT),children:(0,H.jsxs)(`div`,{"data-testid":`import-automation-modal`,"data-view":t?`preview`:`picker`,className:`relative flex max-h-[85vh] w-[min(36rem,calc(100vw-2rem))] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,H.jsx)(N,{onClose:r,testId:`import-automation-modal-close`,disabled:n}),(0,H.jsxs)(`header`,{className:`px-6 pb-4 pt-6`,children:[(0,H.jsx)(`h2`,{className:h(`pr-6`,ge),children:o(p.AUTOMATIONS$IMPORT)}),t?(0,H.jsx)(`p`,{className:`mt-2 text-sm text-tertiary-light`,children:o(p.AUTOMATIONS$IMPORT_PREVIEW_DESCRIPTION)}):null]}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`dl`,{className:`mx-6 flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] px-4 py-4`,children:[(0,H.jsx)(G,{label:o(p.AUTOMATIONS$NAME),value:t.name}),(0,H.jsx)(G,{label:o(p.AUTOMATIONS$DETAIL$TRIGGER),value:s}),(0,H.jsx)(G,{label:o(p.AUTOMATIONS$PROMPT),value:t.prompt??``}),t.plugins&&t.plugins.length>0?(0,H.jsx)(G,{label:o(p.AUTOMATIONS$DETAIL$PLUGINS),value:t.plugins.join(`, `)}):null]}),(0,H.jsxs)(`footer`,{className:`px-6 py-5`,children:[(0,H.jsx)(`p`,{className:`mb-4 text-sm text-tertiary-light`,children:o(p.AUTOMATIONS$IMPORT_DISABLED_NOTICE)}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,H.jsx)(A,{testId:`import-automation-cancel`,type:`button`,variant:`secondary`,onClick:r,isDisabled:n,children:o(p.AUTOMATIONS$CANCEL)}),(0,H.jsx)(A,{testId:`import-automation-confirm`,type:`button`,variant:`primary`,onClick:i,isDisabled:n,"aria-busy":n,children:o(n?p.AUTOMATIONS$IMPORTING:p.AUTOMATIONS$IMPORT)})]})]})]}):(0,H.jsx)(Be,{onFile:a})]})})}var q=20,He=15e3,Ue=e=>e.status===I.PENDING||e.status===I.RUNNING;function We(e,t={}){let{enabled:n=!0}=t,r=d();return o({queries:e.map(e=>({queryKey:[...L,e.id,{limit:q,offset:0},r.backend.id,r.orgId],queryFn:({signal:t})=>x.run(()=>D.getAutomationRuns(e.id,q,0),t),staleTime:60*1e3,retry:!1,refetchOnWindowFocus:!1,meta:{disableToast:!0},enabled:n&&!!e.id,refetchInterval:e=>{let t=e.state.data?.runs?.[0];return t&&Ue(t)?He:!1}})),combine:t=>{let n=new Map;return e.forEach((e,r)=>{let i=t[r];n.set(e.id,{summary:i.data?re(i.data):null,isLoading:i.isLoading,isError:i.isError})}),n}})}function J({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e}),t]})}function Y(e){return Object.fromEntries(e.map(e=>[e.value,e.label]))}function Ge({spec:e,status:t,trigger:n,sort:r,onStatusChange:i,onTriggerChange:a,onSortChange:o}){let{t:s}=c(`openhands`),[l,u]=(0,B.useState)(!1),d=P(()=>u(!1)),f=e.filters.find(e=>e.id===`status`),m=e.filters.find(e=>e.id===`trigger`),g=[f&&t!==f.options[0]?.value,m&&n!==m.options[0]?.value,r!==e.sort.default].filter(Boolean).length,v=s(p.AUTOMATIONS$FILTERS),y=f?.options[0]?.value,b=m?.options[0]?.value;return(0,H.jsxs)(`div`,{ref:d,className:`relative shrink-0 w-auto`,"data-testid":`automations-filters`,children:[(0,H.jsxs)(`button`,{type:`button`,"data-testid":`dropdown-trigger`,"aria-haspopup":`true`,"aria-expanded":l,"aria-label":v,onClick:()=>u(e=>!e),className:h(j,`h-9 py-0`,g>0&&`border-white/60 bg-white/10`),children:[(0,H.jsx)(S,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`whitespace-nowrap`,children:v}),g>0?(0,H.jsx)(`span`,{className:`rounded-full bg-white px-1.5 text-[11px] font-medium text-black`,children:g}):null,(0,H.jsx)(_,{className:h(`h-4 w-4 shrink-0 text-tertiary-alt transition-transform`,l&&`rotate-180`),"aria-hidden":!0})]}),l?(0,H.jsxs)(`div`,{role:`group`,"data-testid":`automations-filters-menu`,"aria-label":v,className:`absolute right-0 top-full z-50 mt-1 flex min-w-[16rem] w-max flex-col gap-3 overflow-visible rounded-[6px] bg-tertiary p-3 context-menu-box-shadow`,children:[f?(0,H.jsx)(J,{label:f.label,children:(0,H.jsx)(F,{testId:`automations-filter-status`,value:t,onChange:i,options:f.options.map(e=>e.value),labelByValue:Y(f.options),ariaLabel:f.label,fullWidth:!0})}):null,m?(0,H.jsx)(J,{label:m.label,children:(0,H.jsx)(F,{testId:`automations-filter-trigger`,value:n,onChange:a,options:m.options.map(e=>e.value),labelByValue:Y(m.options),ariaLabel:m.label,fullWidth:!0})}):null,(0,H.jsx)(J,{label:e.sort.label,children:(0,H.jsx)(F,{testId:`automations-sort`,value:r,onChange:o,options:e.sort.options.map(e=>e.value),labelByValue:Y(e.sort.options),ariaLabel:e.sort.label,fullWidth:!0})}),g>0?(0,H.jsx)(`button`,{type:`button`,"data-testid":`automations-filters-reset`,onClick:()=>{y&&i(y),b&&a(b),o(e.sort.default)},className:`self-start text-sm text-muted hover:text-foreground`,children:s(p.AUTOMATIONS$RESET_ALL)}):null]}):null]})}function Ke({onClear:e}){let{t}=c(`openhands`);return(0,H.jsxs)(`div`,{"data-testid":`automations-filtered-empty`,className:`rounded-xl border border-dashed border-[var(--oh-border)] p-8 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted`,children:t(p.AUTOMATIONS$NO_FILTER_MATCHES)}),(0,H.jsx)(`button`,{type:`button`,"data-testid":`automations-clear-filters`,onClick:e,className:`mt-2 text-sm text-white underline-offset-2 hover:underline`,children:t(p.AUTOMATIONS$CLEAR_FILTERS)})]})}function qe({label:e,tiles:t}){return(0,H.jsx)(`section`,{"aria-label":e,className:`grid grid-cols-2 gap-3 xl:grid-cols-4`,children:t.map(e=>(0,H.jsxs)(`div`,{"data-testid":`overview-tile-${e.key}`,className:h(R,`p-4`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-xs text-muted`,children:e.label}),(0,H.jsx)(e.Icon,{className:`size-4 shrink-0 text-[var(--oh-muted)]`,"aria-hidden":!0})]}),(0,H.jsx)(`div`,{className:`mt-2 text-xl font-semibold text-content`,children:e.value}),(0,H.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted`,children:e.detail})]},e.key))})}var Je=50,X=()=>{if(!E())throw new Response(null,{status:404,statusText:`Not Found`});return null},Z=i(function(){let{t:e}=c(`openhands`),t=ue(),n=(0,B.useMemo)(()=>de(),[]),r=ke(),i=n&&r?{spec:n,nav:r}:null,[a,o]=(0,B.useState)(``),[g,_]=(0,B.useState)(`all`),[v,y]=(0,B.useState)(`all`),[x,re]=(0,B.useState)(n?.sort.default??`last-run`),[S,C]=(0,B.useState)(()=>ie()),[w,T]=(0,B.useState)(Je),[E,D]=(0,B.useState)(null),[O,k]=(0,B.useState)(null),[ge,j]=(0,B.useState)(!1),[M,N]=(0,B.useState)(null),[P,F]=(0,B.useState)(!1),I=d(),{navigate:L}=_e(),R=I.backend.kind===`local`,{canManage:z}=Ee(),{data:Ie,isLoading:Le,refetch:V}=ve(),U=Ie?.status===`ok`,{data:W,isLoading:G,isError:K,refetch:Be}=Ce({limit:w,offset:0,enabled:U}),q=We(W?.automations??[],{enabled:U&&i!==null}),{trackPrebuiltAutomationEnabled:He,trackAutomationExported:Ue}=he(),J=xe(),Y=Se(),X=be(),Z=ye(),Q=(0,B.useMemo)(()=>W?.automations?n?ce(W.automations,{search:a,status:g,trigger:v,sort:x},q):W.automations.filter(e=>ae(e,a)):[],[W?.automations,n,a,g,v,x,q]),$=(0,B.useMemo)(()=>Q.filter(e=>e.enabled),[Q]),Ye=(0,B.useMemo)(()=>Q.filter(e=>!e.enabled),[Q]),Xe=(e,t)=>{let n=!t;if(J.mutate({id:e,enabled:n}),n){let t=W?.automations.find(t=>t.id===e);He({automationId:e,automationName:t?.name??e})}},Ze=t=>{X.mutate(t,{onSuccess:()=>{l(e(p.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{f(we(t,e(p.AUTOMATIONS$RUN_NOW_ERROR)))}})},Qe=e=>{let t=W?.automations.find(t=>t.id===e);t&&D({id:e,name:t.name})},$e=e=>{let t=W?.automations.find(t=>t.id===e);t&&k(t)},et=e=>{let t=`${JSON.stringify(Pe(e),null,2)}\n`;m(new Blob([t],{type:`application/json`}),Fe(e)),Ue({backendKind:I.backend.kind})},tt=async t=>{try{let n;try{n=JSON.parse(await t.text())}catch{f(e(p.AUTOMATIONS$IMPORT_INVALID_JSON));return}N(Ne(n))}catch(t){f(t instanceof Error?t.message:e(p.ERROR$GENERIC))}},nt=()=>{M&&Z.mutate({...M,enabled:!1},{onSuccess:t=>{F(!1),N(null),u(e(p.AUTOMATIONS$IMPORT_SUCCESS,{name:t.name}),e(p.AUTOMATIONS$IMPORT_VIEW),pe(t.id))},onError:t=>{f(we(t,e(p.ERROR$GENERIC)))}})},rt=()=>{E&&(Y.mutate(E.id),D(null))},it=(0,B.useCallback)(e=>{C(e),se(e)},[]),at=()=>{o(``),_(`all`),y(`all`)},ot=(0,B.useMemo)(()=>{if(!n)return[];let e=W?.automations??[];return n.overview.tiles.map(t=>{let n=oe(t.metric,e,q),r=n.isZero&&t.zeroDetail?t.zeroDetail:t.detail;return{key:t.metric,label:t.label,value:n.display,detail:me(r,n.placeholderValues),Icon:fe[t.icon]}})},[n,W?.automations,q]),st=i?{spec:i.spec.insights,byId:q}:void 0,ct=e=>i?(0,H.jsx)(je,{heading:i.nav.heading,navTestIdBase:`automations-navbar`,items:i.nav.items,children:e}):(0,H.jsx)(`div`,{className:`min-h-full`,children:(0,H.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:e})}),lt=W?W.total>W.automations.length:!1,ut=!G&&!K&&W?.automations.length===0;return ct(Le?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:t.listTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t.listSubtitle}),(0,H.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,H.jsx)(b,{},`skeleton-${String(t)}`))})]}):U?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:t.listTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t.listSubtitle})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2`,children:[R&&(0,H.jsx)(A,{type:`button`,variant:`secondary`,testId:`automations-git-sync`,className:`whitespace-nowrap`,onClick:()=>L?.(`/automations/git-sync`),startContent:(0,H.jsx)(le,{className:`size-4`,"aria-hidden":!0}),children:e(p.AUTOMATIONS$GIT_SYNC$NAV_BUTTON)}),z?(0,H.jsx)(ze,{onAdd:()=>j(!0),onImport:()=>F(!0)}):null]})]}),i&&(0,H.jsx)(qe,{label:i.spec.overview.label,tiles:ot}),(0,H.jsxs)(`div`,{className:h(`flex items-stretch gap-2`,i?`flex-wrap`:`mt-6`),children:[(0,H.jsx)(Ae,{value:a,onChange:o}),i&&(0,H.jsx)(Ge,{spec:i.spec,status:g,trigger:v,sort:x,onStatusChange:_,onTriggerChange:y,onSortChange:re}),(0,H.jsx)(Re,{view:S,onChange:it,disabled:ut})]}),(0,H.jsxs)(`div`,{className:h(`flex flex-col gap-6`,!i&&`mt-6`),children:[G&&(0,H.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,H.jsx)(b,{},`skeleton-${String(t)}`))}),K&&!G&&(0,H.jsx)(Oe,{onRetry:Be}),ut&&(0,H.jsx)(ne,{}),!G&&!K&&W&&W.automations.length>0&&(i&&Q.length===0?(0,H.jsx)(Ke,{onClear:at}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(te,{title:e(p.AUTOMATIONS$ACTIVE),count:$.length,automations:$,view:S,onToggle:Xe,onRunNow:Ze,runPendingId:X.isPending?X.variables??null:null,onDelete:Qe,onExport:et,onEdit:$e,insights:st}),(0,H.jsx)(te,{title:e(p.AUTOMATIONS$INACTIVE),count:Ye.length,automations:Ye,view:S,onToggle:Xe,onRunNow:Ze,runPendingId:X.isPending?X.variables??null:null,onDelete:Qe,onExport:et,onEdit:$e,insights:st}),lt&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>T(e=>e+Je),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(p.AUTOMATIONS$LOAD_MORE)})]}))]}),!i&&(0,H.jsx)(`div`,{className:`mt-6`,children:(0,H.jsx)(s,{query:a})}),(0,H.jsx)(Me,{automationName:E?.name??``,isOpen:E!==null,onConfirm:rt,onCancel:()=>D(null)}),O&&(0,H.jsx)(Te,{automation:O,isOpen:O!==null,onClose:()=>k(null)}),(0,H.jsx)(ee,{isOpen:ge,onClose:()=>j(!1)}),(0,H.jsx)(Ve,{isOpen:P,spec:M,isImporting:Z.isPending,onClose:()=>{F(!1),N(null)},onImport:nt,onFile:tt})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:t.listTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t.listSubtitle}),(0,H.jsx)(De,{onRetry:V})]}))});export{X as clientLoader,Z as default};
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,bt as n,yt as r}from"./vendor-styling-Ck5D_A2Q.js";import{U as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~i58xkef6-cHFhpUBq.js";import{i as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as o}from"./useQueries-pUohFMSP.js";import{t as s}from"./recommended-automations-launcher-D1Do753p.js";import{t as c}from"./useTranslation-CCgUjPJF.js";import{ct as l,lt as u,n as d,st as f}from"./active-backend-context-BETEdaJl.js";import{K as p,a as m,t as h}from"./utils-CbjwNcR-.js";import{t as g}from"./check-Bo8s5Ylg.js";import{t as _}from"./chevron-down-Cr6Fn_wS.js";import{g as v,r as y}from"./automation-disabled-reason-QFtMrdOr.js";import{i as b,n as ee,r as te,t as ne}from"./empty-state-B5advKVW.js";import{P as x,_ as re,c as ie,g as ae,h as oe,l as se,m as ce}from"./home-automation-run-tooltip-v5n7zXR0.js";import{t as S}from"./list-filter-B8PQk3RA.js";import{t as C}from"./plus-C2e21TFC.js";import{t as le}from"./refresh-cw-BtdC3T8P.js";import{n as w,t as T}from"./context-menu-list-item-DIm5xQg6.js";import{A as ue,D as de,G as fe,P as E,S as pe,W as me,n as D,t as he,x as O}from"./use-tracking-BAFpgpgq.js";import{t as k}from"./modal-backdrop-BSzNhM4r.js";import{n as ge}from"./modal-classes-BPcBCWVj.js";import{t as A}from"./brand-button-CGUwj6zK.js";import{n as _e}from"./navigation-context-CQZwH_tC.js";import{t as j,u as M}from"./dropdown-classes-DyyMaaXl.js";import{t as N}from"./modal-close-button-Cq3dma5u.js";import{t as P}from"./use-click-outside-element-W6Os4Nlb.js";import{t as F}from"./enum-filter-dropdown-VAJp5mqh.js";import{t as ve}from"./use-automation-health-CbQ9n-k7.js";import{t as I}from"./automation-C_eCrGyP.js";import{a as ye,c as L,i as be,o as xe,r as Se,t as Ce}from"./use-automations-7_XBXHQK.js";import{a as R}from"./extension-module-card-classes-DpeaYhYo.js";import{n as we}from"./api-error-message-BXo0lCI5.js";import{t as Te}from"./edit-automation-modal-bfD-5NIc.js";import{t as Ee}from"./use-automation-permissions-gFy-2VD0.js";import{n as De,t as Oe}from"./error-state-BgYl7YeB.js";import{n as ke,r as Ae,t as je}from"./manifest-subpage-layout-DGYRoP_8.js";import{i as Me,n as Ne,r as Pe,t as Fe}from"./automation-export-CkvehhPF.js";var z=a(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),Ie=a(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),Le=a(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),B=e(t(),1),V=e(n(),1),H=r();function U({icon:e,label:t,isSelected:n}){return(0,H.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,H.jsx)(`span`,{className:M,"aria-hidden":!0,children:(0,H.jsx)(e,{})}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,H.jsx)(g,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}var W=[{value:`grid`,icon:Ie,labelKey:p.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:Le,labelKey:p.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function Re({view:e,onChange:t,disabled:n=!1}){let{t:r}=c(`openhands`),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(),l=(0,B.useRef)(null),u=(0,B.useRef)(null),d=(W.find(t=>t.value===e)??W[0]).icon;(0,B.useLayoutEffect)(()=>{if(!i||!l.current)return;let e=()=>{let e=l.current?.getBoundingClientRect();e&&s({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)}},[i]),(0,B.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;l.current?.contains(t)||u.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let f=i&&o?(0,H.jsx)(w,{ref:u,theme:`popover`,className:`min-w-[10rem]`,children:W.map(n=>(0,H.jsx)(`li`,{children:(0,H.jsx)(T,{testId:n.testId,onClick:()=>{t(n.value),a(!1)},className:`group`,children:(0,H.jsx)(U,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{ref:l,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(p.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||a(e=>!e)},className:h(`inline-flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-[var(--oh-border)] bg-base-secondary text-white transition-colors hover:bg-[var(--oh-interactive-hover)] focus-visible:border-white/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-base-secondary`),children:(0,H.jsx)(d,{className:`size-4`,"aria-hidden":!0})}),i&&o&&typeof document<`u`?V.createPortal((0,H.jsx)(`div`,{style:o,children:f}),document.body):null]})}function ze({onAdd:e,onImport:t,isAddDisabled:n=!1}){let{t:r}=c(`openhands`),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(),l=(0,B.useRef)(null),u=(0,B.useRef)(null);(0,B.useLayoutEffect)(()=>{if(!i||!l.current)return;let e=()=>{let e=l.current?.getBoundingClientRect();e&&s({position:`fixed`,zIndex:9999,top:e.bottom+2,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)}},[i]),(0,B.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;l.current?.contains(t)||u.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let d=e=>{e(),a(!1)},f=i&&o?(0,H.jsxs)(w,{ref:u,testId:`automations-add-automation-menu`,theme:`popover`,position:`none`,alignment:`none`,spacing:`none`,className:`min-w-[10rem]`,children:[(0,H.jsx)(`li`,{children:(0,H.jsx)(T,{testId:`automations-add-automation-create`,isDisabled:n,className:`group`,onClick:()=>{n||d(e)},children:(0,H.jsx)(y,{icon:(0,H.jsx)(C,{className:`size-4`,"aria-hidden":!0}),label:r(p.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})})}),(0,H.jsx)(`li`,{children:(0,H.jsx)(T,{testId:`automations-import-automation`,className:`group`,onClick:()=>d(t),children:(0,H.jsx)(y,{icon:(0,H.jsx)(z,{className:`size-4`,"aria-hidden":!0}),label:r(p.AUTOMATIONS$IMPORT)})})})]}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(A,{ref:l,type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`whitespace-nowrap`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[r(p.AUTOMATIONS$ADD_AUTOMATION),(0,H.jsx)(_,{className:`size-4 shrink-0`,"aria-hidden":!0})]}),i&&o&&typeof document<`u`?V.createPortal((0,H.jsx)(`div`,{style:o,children:f}),document.body):null]})}function G({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`dt`,{className:`text-xs font-medium uppercase tracking-wide text-muted`,children:e}),(0,H.jsx)(`dd`,{className:`whitespace-pre-wrap break-words text-sm text-content`,children:t})]})}function K(e){let t=e.dataTransfer?.files;return t&&t.length>0?t[0]:null}function Be({onFile:e}){let{t}=c(`openhands`),n=(0,B.useRef)(null),[r,i]=(0,B.useState)(!1),a=()=>n.current?.click();return(0,H.jsxs)(`div`,{className:`flex flex-col gap-5 px-6 pb-6`,children:[(0,H.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[t(p.AUTOMATIONS$IMPORT_EXPLAIN),` `,(0,H.jsx)(`a`,{href:O,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`import-automation-format-docs`,className:`text-white no-underline transition-colors hover:text-white`,children:t(p.AUTOMATIONS$IMPORT_FORMAT_DOCS)})]}),(0,H.jsx)(`p`,{className:`text-sm text-tertiary-light`,children:t(p.AUTOMATIONS$IMPORT_DISABLED_NOTICE)}),(0,H.jsx)(`input`,{ref:n,type:`file`,accept:`application/json,.json`,className:`hidden`,"data-testid":`automations-import-file`,onChange:()=>{let t=n.current,r=t?.files?.[0];t&&(t.value=``),r&&e(r)}}),(0,H.jsxs)(`div`,{"data-testid":`import-automation-dropzone`,"data-active":r?`true`:`false`,onClick:a,onDragEnter:e=>{e.preventDefault(),i(!0)},onDragOver:e=>{e.preventDefault(),i(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||i(!1)},onDrop:t=>{t.preventDefault(),i(!1);let n=K(t);n&&e(n)},className:h(`flex cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-10 text-center`,r?`border-[var(--oh-focus)] bg-[var(--oh-interactive-hover)]`:`border-[var(--oh-border)] bg-[var(--oh-surface)]`),children:[(0,H.jsx)(z,{className:`size-8 text-[var(--oh-muted)]`,"aria-hidden":!0}),(0,H.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(p.AUTOMATIONS$IMPORT_DROPZONE)}),(0,H.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:t(p.AUTOMATIONS$IMPORT_OR)}),(0,H.jsx)(A,{testId:`import-automation-choose-file`,type:`button`,variant:`secondary`,onClick:e=>{e?.stopPropagation(),a()},children:t(p.AUTOMATIONS$IMPORT_CHOOSE_FILE)})]})]})}function Ve({isOpen:e,spec:t,isImporting:n,onClose:r,onImport:i,onFile:a}){let{t:o}=c(`openhands`);if(!e)return null;let s=t?t.trigger.type===`event`?[t.trigger.source,v(t.trigger.on)].filter(Boolean).join(`: `):[t.trigger.schedule_human??t.trigger.schedule,t.timezone??t.trigger.timezone].filter(Boolean).join(` · `):``;return(0,H.jsx)(k,{onClose:n?void 0:r,closeOnEscape:!n,closeOnBackdropClick:!n,"aria-label":o(p.AUTOMATIONS$IMPORT),children:(0,H.jsxs)(`div`,{"data-testid":`import-automation-modal`,"data-view":t?`preview`:`picker`,className:`relative flex max-h-[85vh] w-[min(36rem,calc(100vw-2rem))] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,H.jsx)(N,{onClose:r,testId:`import-automation-modal-close`,disabled:n}),(0,H.jsxs)(`header`,{className:`px-6 pb-4 pt-6`,children:[(0,H.jsx)(`h2`,{className:h(`pr-6`,ge),children:o(p.AUTOMATIONS$IMPORT)}),t?(0,H.jsx)(`p`,{className:`mt-2 text-sm text-tertiary-light`,children:o(p.AUTOMATIONS$IMPORT_PREVIEW_DESCRIPTION)}):null]}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`dl`,{className:`mx-6 flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] px-4 py-4`,children:[(0,H.jsx)(G,{label:o(p.AUTOMATIONS$NAME),value:t.name}),(0,H.jsx)(G,{label:o(p.AUTOMATIONS$DETAIL$TRIGGER),value:s}),(0,H.jsx)(G,{label:o(p.AUTOMATIONS$PROMPT),value:t.prompt??``}),t.plugins&&t.plugins.length>0?(0,H.jsx)(G,{label:o(p.AUTOMATIONS$DETAIL$PLUGINS),value:t.plugins.join(`, `)}):null]}),(0,H.jsxs)(`footer`,{className:`px-6 py-5`,children:[(0,H.jsx)(`p`,{className:`mb-4 text-sm text-tertiary-light`,children:o(p.AUTOMATIONS$IMPORT_DISABLED_NOTICE)}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,H.jsx)(A,{testId:`import-automation-cancel`,type:`button`,variant:`secondary`,onClick:r,isDisabled:n,children:o(p.AUTOMATIONS$CANCEL)}),(0,H.jsx)(A,{testId:`import-automation-confirm`,type:`button`,variant:`primary`,onClick:i,isDisabled:n,"aria-busy":n,children:o(n?p.AUTOMATIONS$IMPORTING:p.AUTOMATIONS$IMPORT)})]})]})]}):(0,H.jsx)(Be,{onFile:a})]})})}var q=20,He=15e3,Ue=e=>e.status===I.PENDING||e.status===I.RUNNING;function We(e,t={}){let{enabled:n=!0}=t,r=d();return o({queries:e.map(e=>({queryKey:[...L,e.id,{limit:q,offset:0},r.backend.id,r.orgId],queryFn:({signal:t})=>x.run(()=>D.getAutomationRuns(e.id,q,0),t),staleTime:60*1e3,retry:!1,refetchOnWindowFocus:!1,meta:{disableToast:!0},enabled:n&&!!e.id,refetchInterval:e=>{let t=e.state.data?.runs?.[0];return t&&Ue(t)?He:!1}})),combine:t=>{let n=new Map;return e.forEach((e,r)=>{let i=t[r];n.set(e.id,{summary:i.data?re(i.data):null,isLoading:i.isLoading,isError:i.isError})}),n}})}function J({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e}),t]})}function Y(e){return Object.fromEntries(e.map(e=>[e.value,e.label]))}function Ge({spec:e,status:t,trigger:n,sort:r,onStatusChange:i,onTriggerChange:a,onSortChange:o}){let{t:s}=c(`openhands`),[l,u]=(0,B.useState)(!1),d=P(()=>u(!1)),f=e.filters.find(e=>e.id===`status`),m=e.filters.find(e=>e.id===`trigger`),g=[f&&t!==f.options[0]?.value,m&&n!==m.options[0]?.value,r!==e.sort.default].filter(Boolean).length,v=s(p.AUTOMATIONS$FILTERS),y=f?.options[0]?.value,b=m?.options[0]?.value;return(0,H.jsxs)(`div`,{ref:d,className:`relative shrink-0 w-auto`,"data-testid":`automations-filters`,children:[(0,H.jsxs)(`button`,{type:`button`,"data-testid":`dropdown-trigger`,"aria-haspopup":`true`,"aria-expanded":l,"aria-label":v,onClick:()=>u(e=>!e),className:h(j,`h-9 py-0`,g>0&&`border-white/60 bg-white/10`),children:[(0,H.jsx)(S,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`whitespace-nowrap`,children:v}),g>0?(0,H.jsx)(`span`,{className:`rounded-full bg-white px-1.5 text-[11px] font-medium text-black`,children:g}):null,(0,H.jsx)(_,{className:h(`h-4 w-4 shrink-0 text-tertiary-alt transition-transform`,l&&`rotate-180`),"aria-hidden":!0})]}),l?(0,H.jsxs)(`div`,{role:`group`,"data-testid":`automations-filters-menu`,"aria-label":v,className:`absolute right-0 top-full z-50 mt-1 flex min-w-[16rem] w-max flex-col gap-3 overflow-visible rounded-[6px] bg-tertiary p-3 context-menu-box-shadow`,children:[f?(0,H.jsx)(J,{label:f.label,children:(0,H.jsx)(F,{testId:`automations-filter-status`,value:t,onChange:i,options:f.options.map(e=>e.value),labelByValue:Y(f.options),ariaLabel:f.label,fullWidth:!0})}):null,m?(0,H.jsx)(J,{label:m.label,children:(0,H.jsx)(F,{testId:`automations-filter-trigger`,value:n,onChange:a,options:m.options.map(e=>e.value),labelByValue:Y(m.options),ariaLabel:m.label,fullWidth:!0})}):null,(0,H.jsx)(J,{label:e.sort.label,children:(0,H.jsx)(F,{testId:`automations-sort`,value:r,onChange:o,options:e.sort.options.map(e=>e.value),labelByValue:Y(e.sort.options),ariaLabel:e.sort.label,fullWidth:!0})}),g>0?(0,H.jsx)(`button`,{type:`button`,"data-testid":`automations-filters-reset`,onClick:()=>{y&&i(y),b&&a(b),o(e.sort.default)},className:`self-start text-sm text-muted hover:text-foreground`,children:s(p.AUTOMATIONS$RESET_ALL)}):null]}):null]})}function Ke({onClear:e}){let{t}=c(`openhands`);return(0,H.jsxs)(`div`,{"data-testid":`automations-filtered-empty`,className:`rounded-xl border border-dashed border-[var(--oh-border)] p-8 text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted`,children:t(p.AUTOMATIONS$NO_FILTER_MATCHES)}),(0,H.jsx)(`button`,{type:`button`,"data-testid":`automations-clear-filters`,onClick:e,className:`mt-2 text-sm text-white underline-offset-2 hover:underline`,children:t(p.AUTOMATIONS$CLEAR_FILTERS)})]})}function qe({label:e,tiles:t}){return(0,H.jsx)(`section`,{"aria-label":e,className:`grid grid-cols-2 gap-3 xl:grid-cols-4`,children:t.map(e=>(0,H.jsxs)(`div`,{"data-testid":`overview-tile-${e.key}`,className:h(R,`p-4`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-xs text-muted`,children:e.label}),(0,H.jsx)(e.Icon,{className:`size-4 shrink-0 text-[var(--oh-muted)]`,"aria-hidden":!0})]}),(0,H.jsx)(`div`,{className:`mt-2 text-xl font-semibold text-content`,children:e.value}),(0,H.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted`,children:e.detail})]},e.key))})}var Je=50,X=()=>{if(!E())throw new Response(null,{status:404,statusText:`Not Found`});return null},Z=i(function(){let{t:e}=c(`openhands`),t=ue(),n=(0,B.useMemo)(()=>de(),[]),r=ke(),i=n&&r?{spec:n,nav:r}:null,[a,o]=(0,B.useState)(``),[g,_]=(0,B.useState)(`all`),[v,y]=(0,B.useState)(`all`),[x,re]=(0,B.useState)(n?.sort.default??`last-run`),[S,C]=(0,B.useState)(()=>ie()),[w,T]=(0,B.useState)(Je),[E,D]=(0,B.useState)(null),[O,k]=(0,B.useState)(null),[ge,j]=(0,B.useState)(!1),[M,N]=(0,B.useState)(null),[P,F]=(0,B.useState)(!1),I=d(),{navigate:L}=_e(),R=I.backend.kind===`local`,{canManage:z}=Ee(),{data:Ie,isLoading:Le,refetch:V}=ve(),U=Ie?.status===`ok`,{data:W,isLoading:G,isError:K,refetch:Be}=Ce({limit:w,offset:0,enabled:U}),q=We(W?.automations??[],{enabled:U&&i!==null}),{trackPrebuiltAutomationEnabled:He,trackAutomationExported:Ue}=he(),J=xe(),Y=Se(),X=be(),Z=ye(),Q=(0,B.useMemo)(()=>W?.automations?n?ce(W.automations,{search:a,status:g,trigger:v,sort:x},q):W.automations.filter(e=>ae(e,a)):[],[W?.automations,n,a,g,v,x,q]),$=(0,B.useMemo)(()=>Q.filter(e=>e.enabled),[Q]),Ye=(0,B.useMemo)(()=>Q.filter(e=>!e.enabled),[Q]),Xe=(e,t)=>{let n=!t;if(J.mutate({id:e,enabled:n}),n){let t=W?.automations.find(t=>t.id===e);He({automationId:e,automationName:t?.name??e})}},Ze=t=>{X.mutate(t,{onSuccess:()=>{l(e(p.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{f(we(t,e(p.AUTOMATIONS$RUN_NOW_ERROR)))}})},Qe=e=>{let t=W?.automations.find(t=>t.id===e);t&&D({id:e,name:t.name})},$e=e=>{let t=W?.automations.find(t=>t.id===e);t&&k(t)},et=e=>{let t=`${JSON.stringify(Pe(e),null,2)}\n`;m(new Blob([t],{type:`application/json`}),Fe(e)),Ue({backendKind:I.backend.kind})},tt=async t=>{try{let n;try{n=JSON.parse(await t.text())}catch{f(e(p.AUTOMATIONS$IMPORT_INVALID_JSON));return}N(Ne(n))}catch(t){f(t instanceof Error?t.message:e(p.ERROR$GENERIC))}},nt=()=>{M&&Z.mutate({...M,enabled:!1},{onSuccess:t=>{F(!1),N(null),u(e(p.AUTOMATIONS$IMPORT_SUCCESS,{name:t.name}),e(p.AUTOMATIONS$IMPORT_VIEW),pe(t.id))},onError:t=>{f(we(t,e(p.ERROR$GENERIC)))}})},rt=()=>{E&&(Y.mutate(E.id),D(null))},it=(0,B.useCallback)(e=>{C(e),se(e)},[]),at=()=>{o(``),_(`all`),y(`all`)},ot=(0,B.useMemo)(()=>{if(!n)return[];let e=W?.automations??[];return n.overview.tiles.map(t=>{let n=oe(t.metric,e,q),r=n.isZero&&t.zeroDetail?t.zeroDetail:t.detail;return{key:t.metric,label:t.label,value:n.display,detail:me(r,n.placeholderValues),Icon:fe[t.icon]}})},[n,W?.automations,q]),st=i?{spec:i.spec.insights,byId:q}:void 0,ct=e=>i?(0,H.jsx)(je,{heading:i.nav.heading,navTestIdBase:`automations-navbar`,items:i.nav.items,children:e}):(0,H.jsx)(`div`,{className:`min-h-full`,children:(0,H.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:e})}),lt=W?W.total>W.automations.length:!1,ut=!G&&!K&&W?.automations.length===0;return ct(Le?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:t.listTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t.listSubtitle}),(0,H.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,H.jsx)(b,{},`skeleton-${String(t)}`))})]}):U?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:t.listTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t.listSubtitle})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2`,children:[R&&(0,H.jsx)(A,{type:`button`,variant:`secondary`,testId:`automations-git-sync`,className:`whitespace-nowrap`,onClick:()=>L?.(`/automations/git-sync`),startContent:(0,H.jsx)(le,{className:`size-4`,"aria-hidden":!0}),children:e(p.AUTOMATIONS$GIT_SYNC$NAV_BUTTON)}),z?(0,H.jsx)(ze,{onAdd:()=>j(!0),onImport:()=>F(!0)}):null]})]}),i&&(0,H.jsx)(qe,{label:i.spec.overview.label,tiles:ot}),(0,H.jsxs)(`div`,{className:h(`flex items-stretch gap-2`,i?`flex-wrap`:`mt-6`),children:[(0,H.jsx)(Ae,{value:a,onChange:o}),i&&(0,H.jsx)(Ge,{spec:i.spec,status:g,trigger:v,sort:x,onStatusChange:_,onTriggerChange:y,onSortChange:re}),(0,H.jsx)(Re,{view:S,onChange:it,disabled:ut})]}),(0,H.jsxs)(`div`,{className:h(`flex flex-col gap-6`,!i&&`mt-6`),children:[G&&(0,H.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,H.jsx)(b,{},`skeleton-${String(t)}`))}),K&&!G&&(0,H.jsx)(Oe,{onRetry:Be}),ut&&(0,H.jsx)(ne,{}),!G&&!K&&W&&W.automations.length>0&&(i&&Q.length===0?(0,H.jsx)(Ke,{onClear:at}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(te,{title:e(p.AUTOMATIONS$ACTIVE),count:$.length,automations:$,view:S,onToggle:Xe,onRunNow:Ze,runPendingId:X.isPending?X.variables??null:null,onDelete:Qe,onExport:et,onEdit:$e,insights:st}),(0,H.jsx)(te,{title:e(p.AUTOMATIONS$INACTIVE),count:Ye.length,automations:Ye,view:S,onToggle:Xe,onRunNow:Ze,runPendingId:X.isPending?X.variables??null:null,onDelete:Qe,onExport:et,onEdit:$e,insights:st}),lt&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>T(e=>e+Je),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(p.AUTOMATIONS$LOAD_MORE)})]}))]}),!i&&(0,H.jsx)(`div`,{className:`mt-6`,children:(0,H.jsx)(s,{query:a})}),(0,H.jsx)(Me,{automationName:E?.name??``,isOpen:E!==null,onConfirm:rt,onCancel:()=>D(null)}),O&&(0,H.jsx)(Te,{automation:O,isOpen:O!==null,onClose:()=>k(null)}),(0,H.jsx)(ee,{isOpen:ge,onClose:()=>j(!1)}),(0,H.jsx)(Ve,{isOpen:P,spec:M,isImporting:Z.isPending,onClose:()=>{F(!1),N(null)},onImport:nt,onFile:tt})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:t.listTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t.listSubtitle}),(0,H.jsx)(De,{onRetry:V})]}))});export{X as clientLoader,Z as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-Cyuzqnbw.js";import{St as e,yt as t}from"./vendor-styling-Ck5D_A2Q.js";import{i as n}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as r}from"./utils-D-gOfhmN.js";import{r as i}from"./form-control-classes-lQfLxzH4.js";import{t as a}from"./navigation-link-Bxo3-4vo.js";var o=n(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);e();var s=t();function c({children:e}){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{size:20,"aria-hidden":!0}),e]})}function l(e){let{children:t,testId:n,className:o}=e,l=r(i,o);return`to`in e?(0,s.jsx)(a,{to:e.to,onClick:e.onClick,"data-testid":n,className:l,children:(0,s.jsx)(c,{children:t})}):(0,s.jsx)(`button`,{type:`button`,onClick:e.onClick,"data-testid":n,className:l,children:(0,s.jsx)(c,{children:t})})}export{l as t};
1
+ import"./rolldown-runtime-Cyuzqnbw.js";import{St as e,yt as t}from"./vendor-styling-Ck5D_A2Q.js";import{i as n}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~czjee3a3-BXXGJNDU.js";import{t as r}from"./utils-CbjwNcR-.js";import{r as i}from"./form-control-classes-BVI_szaj.js";import{t as a}from"./navigation-link-Bxo3-4vo.js";var o=n(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);e();var s=t();function c({children:e}){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{size:20,"aria-hidden":!0}),e]})}function l(e){let{children:t,testId:n,className:o}=e,l=r(i,o);return`to`in e?(0,s.jsx)(a,{to:e.to,onClick:e.onClick,"data-testid":n,className:l,children:(0,s.jsx)(c,{children:t})}):(0,s.jsx)(`button`,{type:`button`,onClick:e.onClick,"data-testid":n,className:l,children:(0,s.jsx)(c,{children:t})})}export{l as t};