@openhands/agent-canvas 1.0.0-beta.7 → 1.0.0-beta.8

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 (101) hide show
  1. package/README.md +2 -2
  2. package/build/assets/{acp-providers-CPdgcp13.js → acp-providers-BAX8OU5C.js} +1 -1
  3. package/build/assets/{acp-route-guard-BoVmCn0e.js → acp-route-guard-HPk6TV-L.js} +1 -1
  4. package/build/assets/{active-backend-context-Beu-LZL-.js → active-backend-context-BSPE-W72.js} +1 -1
  5. package/build/assets/{add-backend-modal-BheqYXHK.js → add-backend-modal-mXKmfMI2.js} +1 -1
  6. package/build/assets/agent-server-client-options-9agOSarV.js +1 -0
  7. package/build/assets/{agent-server-compatibility-CdI3N7dr.js → agent-server-compatibility-B7QStIcH.js} +1 -1
  8. package/build/assets/{agent-server-conversation-service.api-CORdqJZg.js → agent-server-conversation-service.api-B9TUYJon.js} +3 -3
  9. package/build/assets/{agent-settings-UFvcGjoI.js → agent-settings-g3F623RJ.js} +1 -1
  10. package/build/assets/{analytics-consent-form-modal-CVNugqzu.js → analytics-consent-form-modal-BQCNeNVt.js} +1 -1
  11. package/build/assets/{api-key-entry-screen-M6su2VSf.js → api-key-entry-screen-myuWMqzW.js} +1 -1
  12. package/build/assets/{app-settings-BlvBhBdc.js → app-settings-CCcX8ZEH.js} +1 -1
  13. package/build/assets/{automation-detail-BWrQk4Oa.js → automation-detail-BDHLHSJd.js} +1 -1
  14. package/build/assets/{automations-list-ux9KvYsU.js → automations-list-CiNtQhq_.js} +1 -1
  15. package/build/assets/{backend-form-modal-CDnEYjaU.js → backend-form-modal-D3bDMO3C.js} +1 -1
  16. package/build/assets/{backend-synced-settings-badge-BTIj-Ffq.js → backend-synced-settings-badge-BkW5evM0.js} +1 -1
  17. package/build/assets/{condenser-settings-BolbDvm5.js → condenser-settings-DCTulgLO.js} +1 -1
  18. package/build/assets/conversation-BKhikfYl.js +1 -0
  19. package/build/assets/{conversation-D0N4dw_p.js → conversation-DTn8jN8L.js} +3 -3
  20. package/build/assets/conversation-panel-DfHR42mG.js +1 -0
  21. package/build/assets/{conversation-service.api-BsJy6uuL.js → conversation-service.api-B6CkzaKD.js} +1 -1
  22. package/build/assets/{conversation-websocket-context-DvHgx_FE.js → conversation-websocket-context-DShEuLjh.js} +1 -1
  23. package/build/assets/{edit-automation-modal-BpX-t-HD.js → edit-automation-modal-DamwL0s0.js} +1 -1
  24. package/build/assets/{entry.client-Ck9rQCg-.js → entry.client-Cn71WM8q.js} +1 -1
  25. package/build/assets/{extensions-hub-CE9QOb5n.js → extensions-hub-CUEmfvGy.js} +1 -1
  26. package/build/assets/{extensions-navigation-DSLGNGbS.js → extensions-navigation-VQ-3umJ7.js} +1 -1
  27. package/build/assets/{files-tab-cL668j1I.js → files-tab-C47fQEeL.js} +1 -1
  28. package/build/assets/{git-control-bar-branch-button-DtIrOrie.js → git-control-bar-branch-button-BT0aWH-o.js} +1 -1
  29. package/build/assets/{git-provider-icon-CHdGBdU2.js → git-provider-icon-Pi-Cxpgv.js} +1 -1
  30. package/build/assets/{home-Cz2Veg56.js → home-C3k6sFvB.js} +1 -1
  31. package/build/assets/{install-server-modal-B9nXCS3u.js → install-server-modal-6fuq-TU6.js} +1 -1
  32. package/build/assets/{launch-CWz0dm4o.js → launch-DGghLfGx.js} +1 -1
  33. package/build/assets/{llm-client-CYEaUjGx.js → llm-client-BqyLKgUN.js} +1 -1
  34. package/build/assets/{llm-settings-DFkXHuvT.js → llm-settings-BKraGtOu.js} +1 -1
  35. package/build/assets/llm-settings-DRQTgOF1.js +1 -0
  36. package/build/assets/{manage-backends-modal-DpBD_vR9.js → manage-backends-modal-CRMwyU0t.js} +1 -1
  37. package/build/assets/{manage-workspaces-modal-CtRbxREx.js → manage-workspaces-modal-BYmGD1W7.js} +1 -1
  38. package/build/assets/{manifest-eed90ff5.js → manifest-99b06a11.js} +1 -1
  39. package/build/assets/{mcp-BUe7kiYM.js → mcp-CfDRAmPn.js} +1 -1
  40. package/build/assets/{messages-dqp_KYyl.js → messages-Ba1vaw6t.js} +1 -1
  41. package/build/assets/{model-selector-BvSTrkhT.js → model-selector-DcztJSxT.js} +1 -1
  42. package/build/assets/{option-service.api-DmNVxAvS.js → option-service.api-CGNANEcT.js} +1 -1
  43. package/build/assets/{organization-service.api-DbnougaQ.js → organization-service.api-BeuMC9QL.js} +1 -1
  44. package/build/assets/{path-utils-onx24uF5.js → path-utils-z12iCrQO.js} +1 -1
  45. package/build/assets/{planner-tab-CmIjLz7q.js → planner-tab-Dte6Vzza.js} +1 -1
  46. package/build/assets/{profiles-client-fEmgWkCW.js → profiles-client-BrqNmaDV.js} +1 -1
  47. package/build/assets/{providers-CbD7fiic.js → providers-eUyo6pgr.js} +1 -1
  48. package/build/assets/{proxy-BAdHH8QB.js → proxy-BqDMnUY-.js} +1 -1
  49. package/build/assets/{recommended-automations-launcher-uTyODuzB.js → recommended-automations-launcher-D5ADbXao.js} +1 -1
  50. package/build/assets/{root-DmjpFpTu.js → root-BmhaEJJ8.js} +2 -2
  51. package/build/assets/{root-layout-DejMsKhy.js → root-layout-CNggm0d8.js} +2 -2
  52. package/build/assets/{sdk-section-page-BgDlMhcq.js → sdk-section-page-CRCRY3PG.js} +1 -1
  53. package/build/assets/{secrets-service-B7CxNinp.js → secrets-service-B9AFn9OE.js} +1 -1
  54. package/build/assets/{secrets-settings-yK7CqIpm.js → secrets-settings-0UrKMS60.js} +1 -1
  55. package/build/assets/{server-client-Kh4QSwDJ.js → server-client-DYv_GHPl.js} +1 -1
  56. package/build/assets/{settings-DN5PpgRD.js → settings-6t6LGW04.js} +1 -1
  57. package/build/assets/{settings-index-DKC8IY1P.js → settings-index-CR6Ou73o.js} +1 -1
  58. package/build/assets/{settings-modal-DJ4kGzUx.js → settings-modal-T_Yk1Zfo.js} +1 -1
  59. package/build/assets/{settings-service.api-C3rxTtPj.js → settings-service.api-DwtyDeGh.js} +1 -1
  60. package/build/assets/{shared-conversation-h9YnBtCU.js → shared-conversation-BzccsVej.js} +1 -1
  61. package/build/assets/{sidebar-mobile-menu-toggle-D0-AvsnT.js → sidebar-mobile-menu-toggle-DGlRg6jG.js} +1 -1
  62. package/build/assets/{sidebar-nav-link-OhIeFyna.js → sidebar-nav-link-dgVb8Fpy.js} +1 -1
  63. package/build/assets/{skills-plugins-DNcsNF88.js → skills-plugins-DctDrZ8Y.js} +1 -1
  64. package/build/assets/{skills-settings-7liFiSY6.js → skills-settings-rvxImDj_.js} +1 -1
  65. package/build/assets/{terminal-CDhQGDua.js → terminal-KldRPIRT.js} +1 -1
  66. package/build/assets/{use-active-conversation-DHGcmjCK.js → use-active-conversation-sPgfSkql.js} +1 -1
  67. package/build/assets/{use-agent-settings-schema-CLoTOSJI.js → use-agent-settings-schema-B66kGIi_.js} +1 -1
  68. package/build/assets/{use-agent-state-PKrUPMJ3.js → use-agent-state-Dp3pD1h3.js} +1 -1
  69. package/build/assets/{use-cloud-current-user-id-Ddr75hEz.js → use-cloud-current-user-id-ClKFPjFz.js} +1 -1
  70. package/build/assets/{use-config-OIMQLQ2s.js → use-config-C9pvb0Sm.js} +1 -1
  71. package/build/assets/{use-create-conversation-Bszyp13O.js → use-create-conversation-B-lwTnfE.js} +1 -1
  72. package/build/assets/{use-get-secrets-8Jby8ele.js → use-get-secrets-oyC7PFRz.js} +1 -1
  73. package/build/assets/{use-handle-plan-click-CohJPvvW.js → use-handle-plan-click-DP6Rs-YP.js} +1 -1
  74. package/build/assets/{use-llm-profiles-C861aFAq.js → use-llm-profiles-Bh5JqZUZ.js} +1 -1
  75. package/build/assets/use-runtime-is-ready-BakOUVU-.js +1 -0
  76. package/build/assets/{use-save-settings-DkAOEfD9.js → use-save-settings-uXXkqvD7.js} +1 -1
  77. package/build/assets/{use-settings-D5hbTS9t.js → use-settings-DeO7nvpM.js} +1 -1
  78. package/build/assets/{use-settings-nav-items-BcSbo02d.js → use-settings-nav-items-BGMFn25b.js} +1 -1
  79. package/build/assets/{use-skills-D7PS0fH0.js → use-skills-DWIK3l3a.js} +1 -1
  80. package/build/assets/{use-unified-vscode-url-DEoe-NRI.js → use-unified-vscode-url-DXPtB317.js} +1 -1
  81. package/build/assets/{use-user-conversation-Cs5H1pUF.js → use-user-conversation-DJen4YIP.js} +1 -1
  82. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-hTzSytKK.js → vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-D8soyAAx.js} +1 -1
  83. package/build/assets/{verification-settings-Dlt8pINd.js → verification-settings-C_zHuDx9.js} +1 -1
  84. package/build/assets/{vscode-tab-DgepcYtF.js → vscode-tab-DH9x7xXS.js} +1 -1
  85. package/build/index.html +4 -4
  86. package/dist/api/agent-server-config.cjs +1 -1
  87. package/dist/api/agent-server-config.cjs.map +1 -1
  88. package/dist/api/agent-server-config.d.ts +17 -0
  89. package/dist/api/agent-server-config.js +7 -1
  90. package/dist/api/agent-server-config.js.map +1 -1
  91. package/dist/package.cjs +1 -1
  92. package/dist/package.cjs.map +1 -1
  93. package/dist/package.js +1 -1
  94. package/dist/package.js.map +1 -1
  95. package/package.json +1 -1
  96. package/scripts/static-server.mjs +15 -3
  97. package/build/assets/agent-server-client-options-HEOwGVIU.js +0 -1
  98. package/build/assets/conversation-DhRJuZLG.js +0 -1
  99. package/build/assets/conversation-panel-CNqHbS_Z.js +0 -1
  100. package/build/assets/llm-settings-DhrdCXqX.js +0 -1
  101. package/build/assets/use-runtime-is-ready-Do2h_hRl.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-DYXOLEck.js";import{i as r,r as i}from"./organization-service.api-DbnougaQ.js";import{o as a,t as o}from"./declaration-CR6HMp29.js";import{t as s}from"./useTranslation-B6voJV4y.js";import{t as c}from"./utils-DCVfKFRt.js";import{i as l,n as u,o as d,r as f}from"./health-store-B5f0S2FY.js";import{n as p,s as m}from"./agent-server-client-options-HEOwGVIU.js";import{r as h}from"./active-backend-context-Beu-LZL-.js";import{t as g}from"./server-client-Kh4QSwDJ.js";import{i as _}from"./agent-server-compatibility-CdI3N7dr.js";import{t as v}from"./modal-backdrop-RfNCrSpK.js";import{r as y,t as b}from"./modal-body-aoa2fx5W.js";import{n as x,r as S}from"./modal-classes-6YqcqA6y.js";import{t as C}from"./brand-button-DJ_S16rO.js";import{n as w}from"./navigation-context-BdKYH32C.js";import{t as T}from"./modal-close-button-CtWOUMmw.js";import{t as E}from"./settings-input-CehsXnb3.js";var D=a(),O=e(t(),1),k=1e4,A=4e3,j=`Invalid API key`;function M(e){return e===j}async function N(e){if(e.kind===`cloud`)return await i(e),!0;try{await new m(p({host:e.host,sessionApiKey:e.apiKey||null,timeout:A})).getSettings()}catch(e){throw _(e,401)?Error(j):e}return!0}function P(e,t={}){let{probeDisabledOnce:n=!1}=t,i=O.useSyncExternalStore(d,u,u),a=r({queries:e.map(e=>{let t=i[e.id]?.disabled===!0,r=!t||n;return{queryKey:[`backend-health`,e.id,e.kind,e.host,e.apiKey??``],queryFn:async()=>{try{let t=await N(e);return l(e.id),t}catch(t){throw f(e.id,t),t}},enabled:r,refetchInterval:t?!1:k,refetchIntervalInBackground:!1,refetchOnMount:t&&n?`always`:!0,refetchOnReconnect:!t,refetchOnWindowFocus:!t,retry:!1,staleTime:t?0:k,meta:{disableToast:!0}}})}),o={};return e.forEach((e,t)=>{let n=a[t],r=i[e.id],s=r?.disabled===!0,c=r?.consecutiveFailures??0,l=r?.lastError??null,u;u=s?!1:n.isSuccess?!0:n.isError?!1:null,o[e.id]={isConnected:u,consecutiveFailures:c,lastError:l,disabled:s}}),o}var F=e=>(0,D.jsxs)(`svg`,{width:1365,height:1365,viewBox:`0 -24 148 148`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,D.jsx)(`path`,{d:`M71.7542 16.863V2.97414C71.7542 1.82355 72.6872 0.890503 73.8378 0.890503C74.9884 0.890503 75.9214 1.82355 75.9214 2.97414V16.863C75.9214 18.0136 74.9884 18.9466 73.8378 18.9466C72.6872 18.9466 71.7542 18.0136 71.7542 16.863Z`,fill:`white`}),(0,D.jsx)(`path`,{d:`M82.5272 18.9329L89.4716 6.90477C90.0469 5.90832 91.3215 5.5668 92.3179 6.1421C93.3144 6.7174 93.6559 7.99197 93.0806 8.98841L86.1362 21.0165C85.5609 22.0129 84.2863 22.3545 83.2899 21.7792C82.2934 21.2039 81.9519 19.9293 82.5272 18.9329Z`,fill:`white`}),(0,D.jsx)(`path`,{d:`M65.1481 18.9329L58.2037 6.90477C57.6284 5.90832 56.3538 5.5668 55.3574 6.1421C54.3609 6.7174 54.0194 7.99197 54.5947 8.98841L61.5391 21.0165C62.1144 22.0129 63.389 22.3545 64.3854 21.7792C65.3819 21.2039 65.7234 19.9293 65.1481 18.9329Z`,fill:`white`}),(0,D.jsx)(`path`,{d:`M140.606 62.0292C140.606 58.409 141.583 47.6748 141.89 44.1323C142.097 41.7374 141.809 40.4247 141.424 39.7542C141.141 39.2626 140.699 38.915 139.634 38.8436C138.865 38.7921 138.027 39.0114 137.401 39.5761C136.814 40.1052 136.159 41.1682 136.159 43.3176L136.155 43.4388L135.198 59.758C135.164 60.3451 134.883 60.8911 134.424 61.2599C133.966 61.6284 133.374 61.7859 132.793 61.6941L122.764 60.1068L111.948 58.6703C110.949 58.5376 110.188 57.7084 110.142 56.7016L109.561 44.1323C109.535 43.621 109.51 43.1141 109.484 42.6146C109.241 37.9294 109.022 33.7805 109.022 32.4282C109.022 28.3859 108.338 26.6806 107.74 25.9634C107.263 25.3915 106.577 25.1402 105.11 25.1402C104.583 25.1402 104.212 25.2481 103.933 25.4111C103.659 25.5714 103.346 25.8587 103.049 26.4208C102.41 27.6257 101.945 29.891 102.118 33.8479C102.342 38.9804 102.692 42.8146 103.035 46.2718C103.377 49.7231 103.718 52.8561 103.908 56.4971C104.204 62.1966 104.178 66.1256 103.945 68.7924C103.828 70.124 103.656 71.1996 103.423 72.0501C103.202 72.8558 102.871 73.6757 102.296 74.2887C101.6 75.0303 100.608 75.3844 99.577 75.136C98.7592 74.9389 98.1847 74.4215 97.8706 74.0916C97.2141 73.4017 96.7501 72.5106 96.568 72.0512C95.5097 69.3812 92.2352 63.1808 87.8023 59.6811C86.5089 58.6599 85.5666 58.3652 84.9736 58.3204C84.4148 58.2783 84.0094 58.4436 83.6909 58.6967C83.34 58.9756 83.0781 59.3811 82.9479 59.7643C82.9019 59.8999 82.8823 59.9968 82.8741 60.0584C84.0759 62.0865 88.8421 69.5222 91.0896 77.069C92.7648 82.6941 96.8038 88.4259 99.8194 90.8809C102.74 93.258 107.988 94.7313 113.9 95.0218C119.756 95.3095 125.788 94.4121 130.033 92.5092C138.233 88.8334 139.903 80.7382 140.651 77.2292C141.232 74.5057 141.243 71.5987 141.087 68.9009C141.01 67.5551 140.894 66.2969 140.793 65.1373C140.695 64.0105 140.606 62.9215 140.606 62.0292ZM120.986 27.0953C120.986 25.8314 120.648 24.7049 120.089 23.9514C119.583 23.27 118.84 22.7987 117.646 22.7984C116.668 22.7982 116.011 22.9187 115.546 23.1167C115.13 23.2943 114.781 23.5699 114.463 24.0831C113.73 25.2671 113.192 27.6455 113.189 32.384L113.721 43.9088C113.91 47.5661 114.106 51.4922 114.235 54.7707L120.986 55.6666V27.0953ZM125.153 56.2652L131.172 57.218L131.992 43.267V32.5083C131.992 31.031 131.39 30.1275 130.678 29.5489C129.884 28.9039 128.957 28.6731 128.519 28.6731C127.722 28.6731 126.899 28.797 126.306 29.2179C125.849 29.5421 125.153 30.3087 125.153 32.5083V56.2652ZM136.159 35.4278C137.406 34.8069 138.74 34.6083 139.912 34.6868C142.037 34.8292 143.91 35.718 145.037 37.6779C146.06 39.4592 146.273 41.8136 146.041 44.4927C145.72 48.1949 144.772 58.6457 144.772 62.0292C144.772 62.708 144.843 63.6116 144.944 64.7758C145.042 65.907 145.165 67.2389 145.247 68.6606C145.411 71.4987 145.422 74.8383 144.727 78.0987C144.002 81.4953 142.041 91.6918 131.738 96.3108C126.731 98.5551 120.002 99.4936 113.696 99.1838C107.445 98.8767 101.128 97.3189 97.1887 94.1122C93.4809 91.0937 88.9938 84.6307 87.0962 78.2589C84.9529 71.0619 80.3109 63.9646 79.1527 61.9533C78.4706 60.7689 78.684 59.3628 79.0019 58.4258C79.3607 57.3688 80.0554 56.2631 81.0993 55.4337C82.1758 54.5784 83.6043 54.0377 85.2876 54.1647C86.9369 54.2893 88.6462 55.0393 90.3834 56.4107C94.8541 59.9401 98.1342 65.5082 99.7424 68.9231C99.759 68.7664 99.779 68.6024 99.7941 68.4298C100.003 66.0435 100.039 62.3344 99.7467 56.7132C99.5635 53.1942 99.2356 50.1809 98.8888 46.6828C98.5425 43.1904 98.184 39.2713 97.955 34.0302C97.7722 29.8481 98.2012 26.6722 99.3672 24.471C99.9716 23.3302 100.79 22.4223 101.83 21.814C102.866 21.2087 103.995 20.974 105.11 20.974C106.759 20.974 108.813 21.2062 110.448 22.7678C110.593 22.4576 110.75 22.1652 110.921 21.8899C111.676 20.6698 112.681 19.8084 113.912 19.2835C115.095 18.7791 116.378 18.6309 117.646 18.6311C120.195 18.6315 122.164 19.7567 123.434 21.4683C124.256 22.576 124.75 23.8775 124.985 25.1982C126.338 24.5876 127.691 24.5068 128.519 24.5068C129.933 24.5068 131.784 25.0791 133.305 26.3154C134.908 27.6179 136.159 29.6733 136.159 32.5083V35.4278Z`,fill:`white`}),(0,D.jsx)(`path`,{d:`M7.15661 62.0292C7.15661 58.409 6.17994 47.6748 5.87291 44.1323C5.6654 41.7374 5.95357 40.4247 6.33875 39.7542C6.62116 39.2626 7.06336 38.915 8.12834 38.8436C8.89759 38.7921 9.73544 39.0114 10.3616 39.5761C10.9484 40.1052 11.6032 41.1682 11.6032 43.3176L11.6074 43.4388L12.5644 59.758C12.5988 60.3451 12.8798 60.8911 13.338 61.2599C13.7961 61.6284 14.3887 61.7859 14.9695 61.6941L24.9988 60.1068L35.8143 58.6703C36.8135 58.5376 37.5741 57.7084 37.6208 56.7016L38.2015 44.1323C38.2279 43.621 38.2525 43.1141 38.2784 42.6146C38.5218 37.9294 38.7401 33.7805 38.7401 32.4282C38.7401 28.3859 39.4246 26.6806 40.0227 25.9634C40.4996 25.3915 41.185 25.1402 42.6523 25.1402C43.1794 25.1402 43.5505 25.2481 43.8295 25.4111C44.1038 25.5714 44.416 25.8587 44.7138 26.4208C45.3521 27.6257 45.8173 29.891 45.6444 33.8479C45.4201 38.9804 45.0703 42.8146 44.7275 46.2718C44.3853 49.7231 44.0443 52.8561 43.8548 56.4971C43.5582 62.1966 43.5847 66.1256 43.8179 68.7924C43.9344 70.124 44.1069 71.1996 44.3396 72.0501C44.5601 72.8558 44.891 73.6757 45.4663 74.2887C46.1625 75.0303 47.1546 75.3844 48.1855 75.136C49.0033 74.9389 49.5778 74.4215 49.8918 74.0916C50.5484 73.4017 51.0123 72.5106 51.1945 72.0512C52.2527 69.3812 55.5272 63.1808 59.9601 59.6811C61.2536 58.6599 62.1958 58.3652 62.7889 58.3204C63.3476 58.2783 63.753 58.4436 64.0715 58.6967C64.4225 58.9756 64.6844 59.3811 64.8146 59.7643C64.8606 59.8999 64.8801 59.9968 64.8883 60.0584C63.6866 62.0865 58.9204 69.5222 56.6729 77.069C54.9977 82.6941 50.9586 88.4259 47.9431 90.8809C45.0229 93.258 39.7747 94.7313 33.8624 95.0218C28.0068 95.3095 21.9748 94.4121 17.7297 92.5092C9.52988 88.8334 7.85961 80.7382 7.11129 77.2292C6.53054 74.5057 6.5195 71.5987 6.67496 68.9009C6.75251 67.5551 6.86809 66.2969 6.96901 65.1373C7.06707 64.0105 7.1566 62.9215 7.15661 62.0292ZM26.7768 27.0953C26.7768 25.8314 27.1147 24.7049 27.6737 23.9514C28.1792 23.27 28.9221 22.7987 30.1167 22.7984C31.0942 22.7982 31.7518 22.9187 32.2162 23.1167C32.6326 23.2943 32.9817 23.5699 33.2996 24.0831C34.0328 25.2671 34.5705 27.6455 34.5738 32.384L34.0416 43.9088C33.8524 47.5661 33.6565 51.4922 33.5273 54.7707L26.7768 55.6666V27.0953ZM22.6095 56.2652L16.5904 57.218L15.7705 43.267V32.5083C15.7705 31.031 16.3726 30.1275 17.0847 29.5489C17.8785 28.9039 18.8058 28.6731 19.2432 28.6731C20.0404 28.6731 20.8634 28.797 21.4565 29.2179C21.9131 29.5421 22.6095 30.3087 22.6095 32.5083V56.2652ZM11.6032 35.4278C10.3568 34.8069 9.02265 34.6083 7.8501 34.6868C5.72541 34.8292 3.85197 35.718 2.72584 37.6779C1.70247 39.4592 1.48924 41.8136 1.72143 44.4927C2.0423 48.1949 2.99038 58.6457 2.99038 62.0292C2.99037 62.708 2.91991 63.6116 2.81859 64.7758C2.72014 65.907 2.59699 67.2389 2.51505 68.6606C2.3515 71.4987 2.34041 74.8383 3.0357 78.0987C3.76005 81.4953 5.72154 91.6918 16.0245 96.3108C21.0311 98.5551 27.7601 99.4936 34.0669 99.1838C40.3172 98.8767 46.6346 97.3189 50.5737 94.1122C54.2816 91.0937 58.7686 84.6307 60.6662 78.2589C62.8095 71.0619 67.4515 63.9646 68.6098 61.9533C69.2919 60.7689 69.0785 59.3628 68.7605 58.4258C68.4018 57.3688 67.707 56.2631 66.6632 55.4337C65.5867 54.5784 64.1582 54.0377 62.4748 54.1647C60.8256 54.2893 59.1162 55.0393 57.379 56.4107C52.9083 59.9401 49.6283 65.5082 48.02 68.9231C48.0034 68.7664 47.9835 68.6024 47.9684 68.4298C47.7597 66.0435 47.7232 62.3344 48.0158 56.7132C48.1989 53.1942 48.5269 50.1809 48.8737 46.6828C49.22 43.1904 49.5784 39.2713 49.8075 34.0302C49.9903 29.8481 49.5612 26.6722 48.3952 24.471C47.7909 23.3302 46.9729 22.4223 45.9321 21.814C44.8964 21.2087 43.7676 20.974 42.6523 20.974C41.0038 20.974 38.9497 21.2062 37.3141 22.7678C37.1698 22.4576 37.0124 22.1652 36.8419 21.8899C36.0863 20.6698 35.0817 19.8084 33.8508 19.2835C32.6679 18.7791 31.3849 18.6309 30.1167 18.6311C27.5677 18.6315 25.5986 19.7567 24.3285 21.4683C23.5066 22.576 23.0121 23.8775 22.7771 25.1982C21.4247 24.5876 20.0718 24.5068 19.2432 24.5068C17.8298 24.5068 15.9788 25.0791 14.4573 26.3154C12.8542 27.6179 11.6032 29.6733 11.6032 32.5083V35.4278Z`,fill:`white`})]}),I=e=>(0,D.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,D.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M15.3235 10.9352L11.5016 14.2111L7.67969 10.9352L8.6152 9.84375L11.5016 12.3178L14.388 9.84375L15.3235 10.9352Z`,fill:`currentColor`})});function L({isConnected:e,className:t}){let n,r,i;return e===`unavailable`?(n=`bg-[var(--oh-text-tertiary)]`,r=`No Backend Available`,i=`unavailable`):e===!0?(n=`bg-[var(--oh-status-success)]`,r=`Connected`,i=`connected`):e===!1?(n=`bg-red-500`,r=`Disconnected`,i=`disconnected`):(n=`bg-[var(--oh-interactive-selected)]`,r=`Checking connection`,i=`checking`),(0,D.jsx)(`span`,{"data-testid":`backend-status-dot`,"data-status":i,"aria-label":r,title:r,role:`status`,className:c(`inline-block w-2 h-2 rounded-full shrink-0`,n,t)})}var R=class extends Error{constructor(e,t){super(e),this.code=t,this.name=`DeviceFlowError`}},ee=6e5,te=3e4;async function z(e,t,n,r,i,a){let o=r===void 0?void 0:typeof r==`string`||r instanceof Blob||r instanceof FormData||r instanceof URLSearchParams?r:JSON.stringify(r);return await fetch(`${e.replace(/\/+$/,``)}${n}`,{method:t,headers:{...i?{"Content-Type":i}:{}},body:o,signal:a})}async function B(e){let t=e.replace(/\/+$/,``);try{let e=await z(t,`POST`,`/oauth/device/authorize`,{},`application/json`);if(!e.ok)throw new R(`Failed to start device flow: Server returned ${e.status}`);let n=await e.json();if(!n.device_code||!n.user_code||!n.verification_uri)throw new R(`Invalid response from device authorization endpoint: missing required fields`);let r=n.verification_uri_complete??`${n.verification_uri}?user_code=${encodeURIComponent(n.user_code)}`;return{device_code:n.device_code,user_code:n.user_code,verification_uri:n.verification_uri,verification_uri_complete:r,expires_in:n.expires_in??600,interval:n.interval??5}}catch(e){throw e instanceof R?e:new R(`Failed to start device flow: ${e instanceof Error?e.message:String(e)}`)}}async function V(e,t,n){let r=e.replace(/\/+$/,``),i=n.timeout??ee,a=Math.max(1,n.interval)*1e3,o=Date.now();for(;Date.now()-o<i;){if(n.signal?.aborted)throw new R(`Authorization cancelled`,`cancelled`);try{let e=await z(r,`POST`,`/oauth/device/token`,new URLSearchParams({grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:t}).toString(),`application/x-www-form-urlencoded`,n.signal);if(e.ok){let t=await e.json();if(!t.access_token)throw new R(`Invalid token response: missing access_token`);return{access_token:t.access_token,token_type:t.token_type??`Bearer`,expires_in:t.expires_in}}let i;try{i=await e.json()}catch{throw new R(`Unexpected response from server: ${e.status}`)}let{error:o,error_description:s}=i;switch(o){case`authorization_pending`:break;case`slow_down`:a=typeof i.interval==`number`&&isFinite(i.interval)&&i.interval>0?Math.max(1,Math.min(i.interval,30))*1e3:Math.min(a+5e3,te);break;case`expired_token`:throw new R(`Device code has expired. Please try again.`,`expired_token`);case`access_denied`:throw new R(`Authorization request was denied.`,`access_denied`);default:throw new R(`Authorization error: ${o}${s?` - ${s}`:``}`,o)}}catch(e){if(e instanceof R)throw e;if(e instanceof DOMException&&e.name===`AbortError`)throw new R(`Authorization cancelled`,`cancelled`);console.warn(`Network error during polling, retrying:`,e)}try{await ne(a,n.signal)}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?new R(`Authorization cancelled`,`cancelled`):e}}throw new R(`Timeout waiting for authorization. Please try again.`,`timeout`)}function ne(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(new DOMException(`Aborted`,`AbortError`))},{once:!0})})}var H={status:`idle`,verificationUrl:null,userCode:null,apiKey:null,error:null,errorCode:null};function re(){let[e,t]=O.useState(H),n=O.useRef(null),r=O.useCallback(e=>{n.current?.abort();let r=new AbortController;n.current=r,t({...H,status:`starting`}),(async()=>{let n;try{n=await B(e)}catch(e){if(r.signal.aborted)return;let n=e instanceof Error?e.message:`Failed to start device flow`,i=e instanceof R?e.code:void 0;t({...H,status:`error`,error:n,errorCode:i??null});return}if(!r.signal.aborted){t({...H,status:`awaiting_authorization`,verificationUrl:n.verification_uri_complete,userCode:n.user_code});try{let i=await V(e,n.device_code,{interval:n.interval,signal:r.signal});if(r.signal.aborted)return;t({...H,status:`success`,apiKey:i.access_token})}catch(e){if(r.signal.aborted)return;if(e instanceof R&&e.code===`cancelled`){t(H);return}let n=e instanceof Error?e.message:`Authorization failed`,i=e instanceof R?e.code:void 0;t({...H,status:`error`,error:n,errorCode:i??null})}}})()},[]),i=O.useCallback(()=>{n.current?.abort(),n.current=null,t(H)},[]),a=O.useCallback(()=>{n.current?.abort(),n.current=null,t(H)},[]);return O.useEffect(()=>()=>{n.current?.abort()},[]),{...e,start:r,cancel:i,reset:a}}function U(e){try{return new URL(e).protocol===`https:`}catch{return!1}}function ie({host:e,onSuccess:t,testIdRoot:n,isDisabled:r=!1}){let{t:i}=s(`openhands`),a=re(),c=O.useRef(null);O.useEffect(()=>()=>{c.current?.close()},[]),O.useEffect(()=>{if(a.status===`awaiting_authorization`&&a.verificationUrl&&c.current&&!c.current.closed){if(!U(a.verificationUrl)){console.error(`Invalid verification URL protocol`);return}try{c.current.location.href=a.verificationUrl}catch{c.current=window.open(a.verificationUrl,`_blank`,`noopener,noreferrer`)}}},[a.status,a.verificationUrl]),O.useEffect(()=>{if(a.status===`success`&&a.apiKey)try{t(a.apiKey)}finally{a.reset(),c.current?.close()}},[a.status,a.apiKey,a.reset,t]);let l=()=>{let t=e.trim().replace(/\/+$/,``),n=/^https?:\/\//i.test(t)?t:`https://${t}`;try{let e=new URL(n);if(e.username||e.password)throw Error(`Invalid URL format`)}catch{return}c.current=window.open(`about:blank`,`_blank`),c.current||console.warn(`Popup blocked - user will need to use manual link`),a.start(n)};return(0,D.jsxs)(`div`,{"data-testid":`${n}-device-flow`,className:`flex flex-col gap-3`,children:[a.status===`idle`&&(0,D.jsx)(C,{type:`button`,variant:`primary`,onClick:l,testId:`${n}-login-button`,className:`w-full`,isDisabled:r,children:i(o.BACKEND$LOGIN_WITH_OPENHANDS)}),a.status===`starting`&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-base-tertiary rounded-lg`,"data-testid":`${n}-auth-starting`,role:`status`,"aria-live":`polite`,children:[(0,D.jsx)(W,{}),(0,D.jsx)(`span`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:i(o.BACKEND$AUTH_STARTING)})]}),a.status===`awaiting_authorization`&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 bg-base-tertiary rounded-lg`,"data-testid":`${n}-auth-awaiting`,role:`status`,"aria-live":`polite`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(W,{}),(0,D.jsx)(`span`,{className:`text-sm font-medium text-white`,children:i(o.BACKEND$AUTH_AWAITING)})]}),(0,D.jsx)(`p`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:i(o.BACKEND$AUTH_BROWSER_OPENED)}),a.verificationUrl&&U(a.verificationUrl)&&(0,D.jsxs)(`div`,{className:`text-xs text-[var(--oh-muted)]`,children:[(0,D.jsx)(`p`,{children:i(o.BACKEND$AUTH_OPEN_MANUALLY)}),(0,D.jsx)(`a`,{href:a.verificationUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 hover:underline break-all`,children:a.verificationUrl})]}),(0,D.jsx)(C,{type:`button`,variant:`secondary`,onClick:a.cancel,testId:`${n}-auth-cancel`,className:`w-full mt-2`,children:i(o.BACKEND$AUTH_CANCEL)})]}),a.status===`error`&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 bg-red-900/20 border border-red-700 rounded-lg`,"data-testid":`${n}-auth-error`,role:`alert`,children:[(0,D.jsx)(`p`,{className:`text-sm text-red-400`,children:a.error}),(0,D.jsx)(C,{type:`button`,variant:`secondary`,onClick:l,testId:`${n}-auth-retry`,className:`w-full`,children:i(o.BACKEND$AUTH_RETRY)})]})]})}function W(){return(0,D.jsxs)(`svg`,{className:`animate-spin h-4 w-4 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,D.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}function G(e){let t=e.trim().toLowerCase();return t.includes(`all-hands.dev`)||t.includes(`openhands.dev`)?`cloud`:`local`}function ae(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``);return!!(t===`localhost`||t===`::1`||t===`::`||t===`0.0.0.0`||/^127\./.test(t)||/^::ffff:127\./i.test(t)||/^10\./.test(t)||/^192\.168\./.test(t)||/^172\.(1[6-9]|2\d|3[01])\./.test(t)||/^fe[89ab][0-9a-f]:/i.test(t)||/^f[cd][0-9a-f]{2}:/i.test(t)||t.endsWith(`.local`)||!t.includes(`.`)&&!t.includes(`:`))}function K(e){let t=e.trim().replace(/\/+$/,``);if(!t)return``;if(/^https?:\/\//i.test(t))return t;let n=t.match(/^\[([^\]]+)\]/);return`${ae(n?n[1]:(t.match(/:/g)??[]).length>1?t:t.split(`:`)[0])?`http`:`https`}://${t}`}function q(e){let t=e.trim();if(!t||/\s/.test(t))return!1;let n=K(t);if(!n)return!1;try{let e=new URL(n);return(e.protocol===`http:`||e.protocol===`https:`)&&e.hostname.length>0}catch{return!1}}var J=`https://app.all-hands.dev`;function Y(e,t){return e(o.BACKEND$CONNECTION_TEST_FAILED,{host:t,interpolation:{escapeValue:!1}})}function oe(e){return e instanceof Error?e.message:typeof e==`string`?e:null}function X(e,t){let n=oe(t);return n?`${e}\n${n}`:e}async function Z(e){e.kind===`local`&&await new g(p({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo()}function se({backend:e,testIdRoot:t}){let{t:r}=s(`openhands`),i=P([e])[e.id],a=i?.isConnected??null,c=i?.disabled===!0,l=i?.consecutiveFailures??0,u=i?.lastError??null,{data:d}=n({queryKey:[`backend-version`,e.host,e.apiKey],queryFn:async()=>(await new g(p({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo()).version??null,retry:!1,staleTime:6e4,enabled:e.kind===`local`&&!c}),f;f=r(a===!0?o.ONBOARDING$BACKEND_STATUS_CONNECTED:a===!1?o.ONBOARDING$BACKEND_STATUS_DISCONNECTED:o.ONBOARDING$BACKEND_STATUS_CHECKING);let m=e.kind===`cloud`?r(o.BACKEND$KIND_CLOUD):r(o.BACKEND$KIND_LOCAL);return(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsxs)(`div`,{"data-testid":`${t}-status`,className:`flex items-center gap-3 text-sm`,children:[(0,D.jsx)(L,{isConnected:a}),(0,D.jsx)(`span`,{className:`text-white`,"data-testid":`${t}-status-label`,children:f}),(0,D.jsx)(`span`,{className:`text-tertiary-alt`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--oh-text-tertiary)]`,children:m}),d?(0,D.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,"data-testid":`${t}-version`,children:r(o.BACKEND$VERSION_LABEL,{version:d})}):null]}),c?(0,D.jsxs)(`div`,{"data-testid":`${t}-status-error`,className:`flex flex-col gap-1 rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm`,children:[(0,D.jsx)(`span`,{className:`font-semibold text-red-300`,children:r(o.BACKEND$HEALTH_FAILED_TITLE)}),(0,D.jsx)(`span`,{className:`text-xs text-[var(--oh-text-tertiary)]`,children:r(o.BACKEND$HEALTH_FAILED_DETAIL,{count:l})}),u?(0,D.jsx)(`span`,{"data-testid":`${t}-status-error-message`,className:`text-xs text-red-300 whitespace-pre-wrap break-words`,children:u}):null]}):null]})}function Q({mode:e,backend:t,onSubmitted:n,renderActions:r,testIdRoot:i,hostReadOnly:a,requireApiKey:c,onSubmitOverride:l}){let{t:u}=s(`openhands`),{addBackend:d,updateBackend:f}=h(),[p,m]=O.useState(t?.name??``),[g,_]=O.useState(t?.host??``),[v,y]=O.useState(t?.apiKey??``),[b,x]=O.useState(null),[S,w]=O.useState(!1),[T,k]=O.useState(!1),[A,j]=O.useState(!1),M=G(g),N=i??(e===`edit`?`edit-backend`:`add-backend`),P=c||M!==`local`,F=p.trim().length>0&&q(g)&&(!P||v.trim().length>0),I=T&&!p.trim()?u(o.BACKEND$NAME_REQUIRED):void 0,L=A?g.trim()?q(g)?void 0:u(o.BACKEND$HOST_INVALID):u(o.BACKEND$HOST_REQUIRED):void 0;return(0,D.jsxs)(`form`,{"data-testid":`${N}-form`,onSubmit:async r=>{if(r.preventDefault(),S)return;if(!F){k(!0),j(!0);return}let i={name:p.trim(),host:K(g),apiKey:v.trim(),kind:M};x(null),w(!0);try{if(l){await l(i);return}await Z(i),e===`edit`&&t?f(t.id,i):d(i),n()}catch(e){x(X(Y(u,i.host),e))}finally{w(!1)}},className:`flex flex-col gap-4`,children:[(0,D.jsx)(E,{testId:`${N}-name`,name:`${N}-name`,type:`text`,label:u(o.BACKEND$NAME_LABEL),value:p,onChange:e=>{m(e),x(null)},onBlur:()=>k(!0),placeholder:`Production`,className:`w-full`,showRequiredTag:!0,error:I}),(0,D.jsx)(E,{testId:`${N}-host`,name:`${N}-host`,type:`text`,label:u(o.BACKEND$HOST_LABEL),value:g,onChange:a?void 0:e=>{_(e),x(null)},onBlur:()=>j(!0),placeholder:J,className:`w-full`,showRequiredTag:!0,error:L,isDisabled:a}),(0,D.jsx)(E,{testId:`${N}-api-key`,name:`${N}-api-key`,type:`password`,label:u(o.BACKEND$KEY_LABEL),value:v,onChange:e=>{y(e),x(null)},placeholder:``,className:`w-full`}),b?(0,D.jsx)(`div`,{role:`alert`,"data-testid":`${N}-error`,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:b}):null,e===`edit`&&t&&(0,D.jsx)(se,{backend:t,testIdRoot:N}),r?r({canSubmit:F&&!S,isSubmitting:S,testIdRoot:N}):(0,D.jsxs)(`div`,{className:`flex justify-end gap-2 mt-2 w-full`,children:[(0,D.jsx)(C,{type:`button`,variant:`secondary`,onClick:n,testId:`${N}-cancel`,children:u(o.BUTTON$CANCEL)}),(0,D.jsx)(C,{type:`submit`,variant:`primary`,isDisabled:!F||S,testId:`${N}-submit`,children:u(o.BACKEND$SAVE)})]})]})}function $(){let{currentPath:e,navigate:t}=w();return O.useCallback(()=>{/^\/automations\/[^/]+/.test(e)?t(`/automations`):/^\/conversations\/[^/]+/.test(e)&&t(`/conversations`)},[e,t])}function ce({onClose:e}){let{t}=s(`openhands`),{addBackend:n}=h(),r=$(),[i,a]=O.useState(``),[c,l]=O.useState(``),[u,d]=O.useState(``),[f,p]=O.useState(null),[m,g]=O.useState(!1),_=G(c),v=i.trim().length>0&&q(c)&&(_===`local`||u.trim().length>0);return(0,D.jsxs)(`form`,{"data-testid":`add-backend-form`,onSubmit:async a=>{if(a.preventDefault(),!v||m)return;let o={name:i.trim(),host:K(c),apiKey:u.trim(),kind:_};p(null),g(!0);try{await Z(o),n(o),r(),e()}catch(e){p(X(Y(t,o.host),e))}finally{g(!1)}},className:`flex flex-col gap-4 flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,D.jsx)(E,{testId:`add-backend-name`,name:`add-backend-name`,type:`text`,label:t(o.BACKEND$NAME_LABEL),value:i,onChange:e=>{a(e),p(null)},placeholder:`e.g. My Server`,className:`w-full`}),(0,D.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,children:t(o.BACKEND$NAME_HELPER)})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,D.jsx)(E,{testId:`add-backend-host`,name:`add-backend-host`,type:`text`,label:t(o.BACKEND$HOST_LABEL),value:c,onChange:e=>{l(e),p(null)},placeholder:`http://localhost:8000`,className:`w-full`}),(0,D.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,"data-testid":`add-backend-host-helper`,children:t(o.BACKEND$HOST_HELPER)})]}),(0,D.jsx)(E,{testId:`add-backend-api-key`,name:`add-backend-api-key`,type:`password`,label:t(o.BACKEND$KEY_LABEL),value:u,onChange:e=>{d(e),p(null)},placeholder:`sk-••••••••••`,className:`w-full`}),f?(0,D.jsx)(`div`,{role:`alert`,"data-testid":`add-backend-error`,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:f}):null,(0,D.jsx)(C,{type:`submit`,variant:`secondary`,isDisabled:!v||m,testId:`add-backend-submit`,className:`w-full text-center`,children:t(m?o.ONBOARDING$BACKEND_STATUS_CHECKING:o.BACKEND$CONNECT)})]})}function le({onClose:e}){let{t}=s(`openhands`),{addBackend:n}=h(),r=$(),[i,a]=O.useState(!1),[l,u]=O.useState(``),d=l.trim()||J;return(0,D.jsxs)(`div`,{className:`flex flex-1 min-w-0 flex-col items-center gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,D.jsx)(F,{width:56,height:56,"aria-hidden":!0}),(0,D.jsx)(`h4`,{className:S,"data-testid":`add-backend-cloud-title`,children:t(o.BACKEND$CLOUD_TITLE)})]}),(0,D.jsx)(`p`,{className:`text-center text-sm leading-relaxed text-[var(--oh-muted)]`,children:t(o.BACKEND$CLOUD_DESCRIPTION)}),(0,D.jsx)(ie,{host:d,onSuccess:t=>{n({name:`OpenHands Cloud`,host:K(d),apiKey:t,kind:`cloud`}),r(),e()},testIdRoot:`add-backend`}),(0,D.jsxs)(`div`,{className:`w-full`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-expanded":i,"data-testid":`add-backend-advanced-toggle`,className:`flex w-full cursor-pointer items-center justify-center gap-1 text-center text-xs text-[var(--oh-muted)] transition-colors hover:text-content-2`,children:[(0,D.jsx)(`span`,{children:t(o.BACKEND$ADVANCED)}),(0,D.jsx)(I,{className:c(`h-4 w-4 shrink-0 text-muted transition-transform`,i&&`rotate-180`),"aria-hidden":!0})]}),(0,D.jsxs)(`div`,{className:c(`pt-2`,!i&&`pointer-events-none invisible`),"aria-hidden":!i,children:[(0,D.jsx)(E,{testId:`add-backend-cloud-host`,name:`add-backend-cloud-host`,type:`text`,label:t(o.BACKEND$HOST_LABEL),value:l,onChange:u,placeholder:J,className:`w-full`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-[var(--oh-muted)]`,children:t(o.BACKEND$LOGIN_CLOUD_HINT)})]})]})]})}function ue({mode:e,backend:t,onClose:n}){let{t:r}=s(`openhands`);if(e===`add`)return(0,D.jsx)(v,{onClose:n,closeOnEscape:!1,"aria-label":r(o.BACKEND$ADD_TITLE),children:(0,D.jsxs)(`div`,{"data-testid":`add-backend-modal`,className:c(`relative rounded-xl border border-[var(--oh-border)] bg-base-secondary`,y(`xl`),b),children:[(0,D.jsx)(T,{onClose:n,testId:`add-backend-close`}),(0,D.jsx)(`div`,{className:`px-6 pt-6 pb-2 pr-12`,children:(0,D.jsx)(`h2`,{className:x,children:r(o.BACKEND$ADD_TITLE)})}),(0,D.jsxs)(`div`,{className:`flex gap-6 px-6 pb-6 pt-2`,children:[(0,D.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,D.jsx)(ce,{onClose:n})}),(0,D.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center`,children:[(0,D.jsx)(`div`,{className:`flex-1 w-px bg-[var(--oh-border)]`}),(0,D.jsx)(`span`,{className:`py-3 text-xs uppercase text-[var(--oh-muted)]`,children:r(o.BACKEND$LOGIN_OR)}),(0,D.jsx)(`div`,{className:`flex-1 w-px bg-[var(--oh-border)]`})]}),(0,D.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,D.jsx)(le,{onClose:n})})]})]})});let i=`edit-backend`;return(0,D.jsx)(v,{onClose:n,closeOnEscape:!1,"aria-label":r(o.BACKEND$EDIT_TITLE),children:(0,D.jsxs)(`div`,{"data-testid":`${i}-modal`,className:c(`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)]`,y(`md`)),children:[(0,D.jsx)(T,{onClose:n,testId:`${i}-close`}),(0,D.jsx)(`h2`,{className:c(`pr-6`,x),children:r(o.BACKEND$EDIT_TITLE)}),(0,D.jsx)(Q,{mode:`edit`,backend:t,onSubmitted:n,testIdRoot:i})]})})}export{P as a,M as i,ue as n,L as r,Q as t};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-DYXOLEck.js";import{i as r,r as i}from"./organization-service.api-BeuMC9QL.js";import{o as a,t as o}from"./declaration-CR6HMp29.js";import{t as s}from"./useTranslation-B6voJV4y.js";import{t as c}from"./utils-DCVfKFRt.js";import{i as l,n as u,o as d,r as f}from"./health-store-B5f0S2FY.js";import{n as p,s as m}from"./agent-server-client-options-9agOSarV.js";import{r as h}from"./active-backend-context-BSPE-W72.js";import{t as g}from"./server-client-DYv_GHPl.js";import{i as _}from"./agent-server-compatibility-B7QStIcH.js";import{t as v}from"./modal-backdrop-RfNCrSpK.js";import{r as y,t as b}from"./modal-body-aoa2fx5W.js";import{n as x,r as S}from"./modal-classes-6YqcqA6y.js";import{t as C}from"./brand-button-DJ_S16rO.js";import{n as w}from"./navigation-context-BdKYH32C.js";import{t as T}from"./modal-close-button-CtWOUMmw.js";import{t as E}from"./settings-input-CehsXnb3.js";var D=a(),O=e(t(),1),k=1e4,A=4e3,j=`Invalid API key`;function M(e){return e===j}async function N(e){if(e.kind===`cloud`)return await i(e),!0;try{await new m(p({host:e.host,sessionApiKey:e.apiKey||null,timeout:A})).getSettings()}catch(e){throw _(e,401)?Error(j):e}return!0}function P(e,t={}){let{probeDisabledOnce:n=!1}=t,i=O.useSyncExternalStore(d,u,u),a=r({queries:e.map(e=>{let t=i[e.id]?.disabled===!0,r=!t||n;return{queryKey:[`backend-health`,e.id,e.kind,e.host,e.apiKey??``],queryFn:async()=>{try{let t=await N(e);return l(e.id),t}catch(t){throw f(e.id,t),t}},enabled:r,refetchInterval:t?!1:k,refetchIntervalInBackground:!1,refetchOnMount:t&&n?`always`:!0,refetchOnReconnect:!t,refetchOnWindowFocus:!t,retry:!1,staleTime:t?0:k,meta:{disableToast:!0}}})}),o={};return e.forEach((e,t)=>{let n=a[t],r=i[e.id],s=r?.disabled===!0,c=r?.consecutiveFailures??0,l=r?.lastError??null,u;u=s?!1:n.isSuccess?!0:n.isError?!1:null,o[e.id]={isConnected:u,consecutiveFailures:c,lastError:l,disabled:s}}),o}var F=e=>(0,D.jsxs)(`svg`,{width:1365,height:1365,viewBox:`0 -24 148 148`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,D.jsx)(`path`,{d:`M71.7542 16.863V2.97414C71.7542 1.82355 72.6872 0.890503 73.8378 0.890503C74.9884 0.890503 75.9214 1.82355 75.9214 2.97414V16.863C75.9214 18.0136 74.9884 18.9466 73.8378 18.9466C72.6872 18.9466 71.7542 18.0136 71.7542 16.863Z`,fill:`white`}),(0,D.jsx)(`path`,{d:`M82.5272 18.9329L89.4716 6.90477C90.0469 5.90832 91.3215 5.5668 92.3179 6.1421C93.3144 6.7174 93.6559 7.99197 93.0806 8.98841L86.1362 21.0165C85.5609 22.0129 84.2863 22.3545 83.2899 21.7792C82.2934 21.2039 81.9519 19.9293 82.5272 18.9329Z`,fill:`white`}),(0,D.jsx)(`path`,{d:`M65.1481 18.9329L58.2037 6.90477C57.6284 5.90832 56.3538 5.5668 55.3574 6.1421C54.3609 6.7174 54.0194 7.99197 54.5947 8.98841L61.5391 21.0165C62.1144 22.0129 63.389 22.3545 64.3854 21.7792C65.3819 21.2039 65.7234 19.9293 65.1481 18.9329Z`,fill:`white`}),(0,D.jsx)(`path`,{d:`M140.606 62.0292C140.606 58.409 141.583 47.6748 141.89 44.1323C142.097 41.7374 141.809 40.4247 141.424 39.7542C141.141 39.2626 140.699 38.915 139.634 38.8436C138.865 38.7921 138.027 39.0114 137.401 39.5761C136.814 40.1052 136.159 41.1682 136.159 43.3176L136.155 43.4388L135.198 59.758C135.164 60.3451 134.883 60.8911 134.424 61.2599C133.966 61.6284 133.374 61.7859 132.793 61.6941L122.764 60.1068L111.948 58.6703C110.949 58.5376 110.188 57.7084 110.142 56.7016L109.561 44.1323C109.535 43.621 109.51 43.1141 109.484 42.6146C109.241 37.9294 109.022 33.7805 109.022 32.4282C109.022 28.3859 108.338 26.6806 107.74 25.9634C107.263 25.3915 106.577 25.1402 105.11 25.1402C104.583 25.1402 104.212 25.2481 103.933 25.4111C103.659 25.5714 103.346 25.8587 103.049 26.4208C102.41 27.6257 101.945 29.891 102.118 33.8479C102.342 38.9804 102.692 42.8146 103.035 46.2718C103.377 49.7231 103.718 52.8561 103.908 56.4971C104.204 62.1966 104.178 66.1256 103.945 68.7924C103.828 70.124 103.656 71.1996 103.423 72.0501C103.202 72.8558 102.871 73.6757 102.296 74.2887C101.6 75.0303 100.608 75.3844 99.577 75.136C98.7592 74.9389 98.1847 74.4215 97.8706 74.0916C97.2141 73.4017 96.7501 72.5106 96.568 72.0512C95.5097 69.3812 92.2352 63.1808 87.8023 59.6811C86.5089 58.6599 85.5666 58.3652 84.9736 58.3204C84.4148 58.2783 84.0094 58.4436 83.6909 58.6967C83.34 58.9756 83.0781 59.3811 82.9479 59.7643C82.9019 59.8999 82.8823 59.9968 82.8741 60.0584C84.0759 62.0865 88.8421 69.5222 91.0896 77.069C92.7648 82.6941 96.8038 88.4259 99.8194 90.8809C102.74 93.258 107.988 94.7313 113.9 95.0218C119.756 95.3095 125.788 94.4121 130.033 92.5092C138.233 88.8334 139.903 80.7382 140.651 77.2292C141.232 74.5057 141.243 71.5987 141.087 68.9009C141.01 67.5551 140.894 66.2969 140.793 65.1373C140.695 64.0105 140.606 62.9215 140.606 62.0292ZM120.986 27.0953C120.986 25.8314 120.648 24.7049 120.089 23.9514C119.583 23.27 118.84 22.7987 117.646 22.7984C116.668 22.7982 116.011 22.9187 115.546 23.1167C115.13 23.2943 114.781 23.5699 114.463 24.0831C113.73 25.2671 113.192 27.6455 113.189 32.384L113.721 43.9088C113.91 47.5661 114.106 51.4922 114.235 54.7707L120.986 55.6666V27.0953ZM125.153 56.2652L131.172 57.218L131.992 43.267V32.5083C131.992 31.031 131.39 30.1275 130.678 29.5489C129.884 28.9039 128.957 28.6731 128.519 28.6731C127.722 28.6731 126.899 28.797 126.306 29.2179C125.849 29.5421 125.153 30.3087 125.153 32.5083V56.2652ZM136.159 35.4278C137.406 34.8069 138.74 34.6083 139.912 34.6868C142.037 34.8292 143.91 35.718 145.037 37.6779C146.06 39.4592 146.273 41.8136 146.041 44.4927C145.72 48.1949 144.772 58.6457 144.772 62.0292C144.772 62.708 144.843 63.6116 144.944 64.7758C145.042 65.907 145.165 67.2389 145.247 68.6606C145.411 71.4987 145.422 74.8383 144.727 78.0987C144.002 81.4953 142.041 91.6918 131.738 96.3108C126.731 98.5551 120.002 99.4936 113.696 99.1838C107.445 98.8767 101.128 97.3189 97.1887 94.1122C93.4809 91.0937 88.9938 84.6307 87.0962 78.2589C84.9529 71.0619 80.3109 63.9646 79.1527 61.9533C78.4706 60.7689 78.684 59.3628 79.0019 58.4258C79.3607 57.3688 80.0554 56.2631 81.0993 55.4337C82.1758 54.5784 83.6043 54.0377 85.2876 54.1647C86.9369 54.2893 88.6462 55.0393 90.3834 56.4107C94.8541 59.9401 98.1342 65.5082 99.7424 68.9231C99.759 68.7664 99.779 68.6024 99.7941 68.4298C100.003 66.0435 100.039 62.3344 99.7467 56.7132C99.5635 53.1942 99.2356 50.1809 98.8888 46.6828C98.5425 43.1904 98.184 39.2713 97.955 34.0302C97.7722 29.8481 98.2012 26.6722 99.3672 24.471C99.9716 23.3302 100.79 22.4223 101.83 21.814C102.866 21.2087 103.995 20.974 105.11 20.974C106.759 20.974 108.813 21.2062 110.448 22.7678C110.593 22.4576 110.75 22.1652 110.921 21.8899C111.676 20.6698 112.681 19.8084 113.912 19.2835C115.095 18.7791 116.378 18.6309 117.646 18.6311C120.195 18.6315 122.164 19.7567 123.434 21.4683C124.256 22.576 124.75 23.8775 124.985 25.1982C126.338 24.5876 127.691 24.5068 128.519 24.5068C129.933 24.5068 131.784 25.0791 133.305 26.3154C134.908 27.6179 136.159 29.6733 136.159 32.5083V35.4278Z`,fill:`white`}),(0,D.jsx)(`path`,{d:`M7.15661 62.0292C7.15661 58.409 6.17994 47.6748 5.87291 44.1323C5.6654 41.7374 5.95357 40.4247 6.33875 39.7542C6.62116 39.2626 7.06336 38.915 8.12834 38.8436C8.89759 38.7921 9.73544 39.0114 10.3616 39.5761C10.9484 40.1052 11.6032 41.1682 11.6032 43.3176L11.6074 43.4388L12.5644 59.758C12.5988 60.3451 12.8798 60.8911 13.338 61.2599C13.7961 61.6284 14.3887 61.7859 14.9695 61.6941L24.9988 60.1068L35.8143 58.6703C36.8135 58.5376 37.5741 57.7084 37.6208 56.7016L38.2015 44.1323C38.2279 43.621 38.2525 43.1141 38.2784 42.6146C38.5218 37.9294 38.7401 33.7805 38.7401 32.4282C38.7401 28.3859 39.4246 26.6806 40.0227 25.9634C40.4996 25.3915 41.185 25.1402 42.6523 25.1402C43.1794 25.1402 43.5505 25.2481 43.8295 25.4111C44.1038 25.5714 44.416 25.8587 44.7138 26.4208C45.3521 27.6257 45.8173 29.891 45.6444 33.8479C45.4201 38.9804 45.0703 42.8146 44.7275 46.2718C44.3853 49.7231 44.0443 52.8561 43.8548 56.4971C43.5582 62.1966 43.5847 66.1256 43.8179 68.7924C43.9344 70.124 44.1069 71.1996 44.3396 72.0501C44.5601 72.8558 44.891 73.6757 45.4663 74.2887C46.1625 75.0303 47.1546 75.3844 48.1855 75.136C49.0033 74.9389 49.5778 74.4215 49.8918 74.0916C50.5484 73.4017 51.0123 72.5106 51.1945 72.0512C52.2527 69.3812 55.5272 63.1808 59.9601 59.6811C61.2536 58.6599 62.1958 58.3652 62.7889 58.3204C63.3476 58.2783 63.753 58.4436 64.0715 58.6967C64.4225 58.9756 64.6844 59.3811 64.8146 59.7643C64.8606 59.8999 64.8801 59.9968 64.8883 60.0584C63.6866 62.0865 58.9204 69.5222 56.6729 77.069C54.9977 82.6941 50.9586 88.4259 47.9431 90.8809C45.0229 93.258 39.7747 94.7313 33.8624 95.0218C28.0068 95.3095 21.9748 94.4121 17.7297 92.5092C9.52988 88.8334 7.85961 80.7382 7.11129 77.2292C6.53054 74.5057 6.5195 71.5987 6.67496 68.9009C6.75251 67.5551 6.86809 66.2969 6.96901 65.1373C7.06707 64.0105 7.1566 62.9215 7.15661 62.0292ZM26.7768 27.0953C26.7768 25.8314 27.1147 24.7049 27.6737 23.9514C28.1792 23.27 28.9221 22.7987 30.1167 22.7984C31.0942 22.7982 31.7518 22.9187 32.2162 23.1167C32.6326 23.2943 32.9817 23.5699 33.2996 24.0831C34.0328 25.2671 34.5705 27.6455 34.5738 32.384L34.0416 43.9088C33.8524 47.5661 33.6565 51.4922 33.5273 54.7707L26.7768 55.6666V27.0953ZM22.6095 56.2652L16.5904 57.218L15.7705 43.267V32.5083C15.7705 31.031 16.3726 30.1275 17.0847 29.5489C17.8785 28.9039 18.8058 28.6731 19.2432 28.6731C20.0404 28.6731 20.8634 28.797 21.4565 29.2179C21.9131 29.5421 22.6095 30.3087 22.6095 32.5083V56.2652ZM11.6032 35.4278C10.3568 34.8069 9.02265 34.6083 7.8501 34.6868C5.72541 34.8292 3.85197 35.718 2.72584 37.6779C1.70247 39.4592 1.48924 41.8136 1.72143 44.4927C2.0423 48.1949 2.99038 58.6457 2.99038 62.0292C2.99037 62.708 2.91991 63.6116 2.81859 64.7758C2.72014 65.907 2.59699 67.2389 2.51505 68.6606C2.3515 71.4987 2.34041 74.8383 3.0357 78.0987C3.76005 81.4953 5.72154 91.6918 16.0245 96.3108C21.0311 98.5551 27.7601 99.4936 34.0669 99.1838C40.3172 98.8767 46.6346 97.3189 50.5737 94.1122C54.2816 91.0937 58.7686 84.6307 60.6662 78.2589C62.8095 71.0619 67.4515 63.9646 68.6098 61.9533C69.2919 60.7689 69.0785 59.3628 68.7605 58.4258C68.4018 57.3688 67.707 56.2631 66.6632 55.4337C65.5867 54.5784 64.1582 54.0377 62.4748 54.1647C60.8256 54.2893 59.1162 55.0393 57.379 56.4107C52.9083 59.9401 49.6283 65.5082 48.02 68.9231C48.0034 68.7664 47.9835 68.6024 47.9684 68.4298C47.7597 66.0435 47.7232 62.3344 48.0158 56.7132C48.1989 53.1942 48.5269 50.1809 48.8737 46.6828C49.22 43.1904 49.5784 39.2713 49.8075 34.0302C49.9903 29.8481 49.5612 26.6722 48.3952 24.471C47.7909 23.3302 46.9729 22.4223 45.9321 21.814C44.8964 21.2087 43.7676 20.974 42.6523 20.974C41.0038 20.974 38.9497 21.2062 37.3141 22.7678C37.1698 22.4576 37.0124 22.1652 36.8419 21.8899C36.0863 20.6698 35.0817 19.8084 33.8508 19.2835C32.6679 18.7791 31.3849 18.6309 30.1167 18.6311C27.5677 18.6315 25.5986 19.7567 24.3285 21.4683C23.5066 22.576 23.0121 23.8775 22.7771 25.1982C21.4247 24.5876 20.0718 24.5068 19.2432 24.5068C17.8298 24.5068 15.9788 25.0791 14.4573 26.3154C12.8542 27.6179 11.6032 29.6733 11.6032 32.5083V35.4278Z`,fill:`white`})]}),I=e=>(0,D.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,D.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M15.3235 10.9352L11.5016 14.2111L7.67969 10.9352L8.6152 9.84375L11.5016 12.3178L14.388 9.84375L15.3235 10.9352Z`,fill:`currentColor`})});function L({isConnected:e,className:t}){let n,r,i;return e===`unavailable`?(n=`bg-[var(--oh-text-tertiary)]`,r=`No Backend Available`,i=`unavailable`):e===!0?(n=`bg-[var(--oh-status-success)]`,r=`Connected`,i=`connected`):e===!1?(n=`bg-red-500`,r=`Disconnected`,i=`disconnected`):(n=`bg-[var(--oh-interactive-selected)]`,r=`Checking connection`,i=`checking`),(0,D.jsx)(`span`,{"data-testid":`backend-status-dot`,"data-status":i,"aria-label":r,title:r,role:`status`,className:c(`inline-block w-2 h-2 rounded-full shrink-0`,n,t)})}var R=class extends Error{constructor(e,t){super(e),this.code=t,this.name=`DeviceFlowError`}},ee=6e5,te=3e4;async function z(e,t,n,r,i,a){let o=r===void 0?void 0:typeof r==`string`||r instanceof Blob||r instanceof FormData||r instanceof URLSearchParams?r:JSON.stringify(r);return await fetch(`${e.replace(/\/+$/,``)}${n}`,{method:t,headers:{...i?{"Content-Type":i}:{}},body:o,signal:a})}async function B(e){let t=e.replace(/\/+$/,``);try{let e=await z(t,`POST`,`/oauth/device/authorize`,{},`application/json`);if(!e.ok)throw new R(`Failed to start device flow: Server returned ${e.status}`);let n=await e.json();if(!n.device_code||!n.user_code||!n.verification_uri)throw new R(`Invalid response from device authorization endpoint: missing required fields`);let r=n.verification_uri_complete??`${n.verification_uri}?user_code=${encodeURIComponent(n.user_code)}`;return{device_code:n.device_code,user_code:n.user_code,verification_uri:n.verification_uri,verification_uri_complete:r,expires_in:n.expires_in??600,interval:n.interval??5}}catch(e){throw e instanceof R?e:new R(`Failed to start device flow: ${e instanceof Error?e.message:String(e)}`)}}async function V(e,t,n){let r=e.replace(/\/+$/,``),i=n.timeout??ee,a=Math.max(1,n.interval)*1e3,o=Date.now();for(;Date.now()-o<i;){if(n.signal?.aborted)throw new R(`Authorization cancelled`,`cancelled`);try{let e=await z(r,`POST`,`/oauth/device/token`,new URLSearchParams({grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:t}).toString(),`application/x-www-form-urlencoded`,n.signal);if(e.ok){let t=await e.json();if(!t.access_token)throw new R(`Invalid token response: missing access_token`);return{access_token:t.access_token,token_type:t.token_type??`Bearer`,expires_in:t.expires_in}}let i;try{i=await e.json()}catch{throw new R(`Unexpected response from server: ${e.status}`)}let{error:o,error_description:s}=i;switch(o){case`authorization_pending`:break;case`slow_down`:a=typeof i.interval==`number`&&isFinite(i.interval)&&i.interval>0?Math.max(1,Math.min(i.interval,30))*1e3:Math.min(a+5e3,te);break;case`expired_token`:throw new R(`Device code has expired. Please try again.`,`expired_token`);case`access_denied`:throw new R(`Authorization request was denied.`,`access_denied`);default:throw new R(`Authorization error: ${o}${s?` - ${s}`:``}`,o)}}catch(e){if(e instanceof R)throw e;if(e instanceof DOMException&&e.name===`AbortError`)throw new R(`Authorization cancelled`,`cancelled`);console.warn(`Network error during polling, retrying:`,e)}try{await ne(a,n.signal)}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?new R(`Authorization cancelled`,`cancelled`):e}}throw new R(`Timeout waiting for authorization. Please try again.`,`timeout`)}function ne(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(new DOMException(`Aborted`,`AbortError`))},{once:!0})})}var H={status:`idle`,verificationUrl:null,userCode:null,apiKey:null,error:null,errorCode:null};function re(){let[e,t]=O.useState(H),n=O.useRef(null),r=O.useCallback(e=>{n.current?.abort();let r=new AbortController;n.current=r,t({...H,status:`starting`}),(async()=>{let n;try{n=await B(e)}catch(e){if(r.signal.aborted)return;let n=e instanceof Error?e.message:`Failed to start device flow`,i=e instanceof R?e.code:void 0;t({...H,status:`error`,error:n,errorCode:i??null});return}if(!r.signal.aborted){t({...H,status:`awaiting_authorization`,verificationUrl:n.verification_uri_complete,userCode:n.user_code});try{let i=await V(e,n.device_code,{interval:n.interval,signal:r.signal});if(r.signal.aborted)return;t({...H,status:`success`,apiKey:i.access_token})}catch(e){if(r.signal.aborted)return;if(e instanceof R&&e.code===`cancelled`){t(H);return}let n=e instanceof Error?e.message:`Authorization failed`,i=e instanceof R?e.code:void 0;t({...H,status:`error`,error:n,errorCode:i??null})}}})()},[]),i=O.useCallback(()=>{n.current?.abort(),n.current=null,t(H)},[]),a=O.useCallback(()=>{n.current?.abort(),n.current=null,t(H)},[]);return O.useEffect(()=>()=>{n.current?.abort()},[]),{...e,start:r,cancel:i,reset:a}}function U(e){try{return new URL(e).protocol===`https:`}catch{return!1}}function ie({host:e,onSuccess:t,testIdRoot:n,isDisabled:r=!1}){let{t:i}=s(`openhands`),a=re(),c=O.useRef(null);O.useEffect(()=>()=>{c.current?.close()},[]),O.useEffect(()=>{if(a.status===`awaiting_authorization`&&a.verificationUrl&&c.current&&!c.current.closed){if(!U(a.verificationUrl)){console.error(`Invalid verification URL protocol`);return}try{c.current.location.href=a.verificationUrl}catch{c.current=window.open(a.verificationUrl,`_blank`,`noopener,noreferrer`)}}},[a.status,a.verificationUrl]),O.useEffect(()=>{if(a.status===`success`&&a.apiKey)try{t(a.apiKey)}finally{a.reset(),c.current?.close()}},[a.status,a.apiKey,a.reset,t]);let l=()=>{let t=e.trim().replace(/\/+$/,``),n=/^https?:\/\//i.test(t)?t:`https://${t}`;try{let e=new URL(n);if(e.username||e.password)throw Error(`Invalid URL format`)}catch{return}c.current=window.open(`about:blank`,`_blank`),c.current||console.warn(`Popup blocked - user will need to use manual link`),a.start(n)};return(0,D.jsxs)(`div`,{"data-testid":`${n}-device-flow`,className:`flex flex-col gap-3`,children:[a.status===`idle`&&(0,D.jsx)(C,{type:`button`,variant:`primary`,onClick:l,testId:`${n}-login-button`,className:`w-full`,isDisabled:r,children:i(o.BACKEND$LOGIN_WITH_OPENHANDS)}),a.status===`starting`&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-base-tertiary rounded-lg`,"data-testid":`${n}-auth-starting`,role:`status`,"aria-live":`polite`,children:[(0,D.jsx)(W,{}),(0,D.jsx)(`span`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:i(o.BACKEND$AUTH_STARTING)})]}),a.status===`awaiting_authorization`&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 bg-base-tertiary rounded-lg`,"data-testid":`${n}-auth-awaiting`,role:`status`,"aria-live":`polite`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(W,{}),(0,D.jsx)(`span`,{className:`text-sm font-medium text-white`,children:i(o.BACKEND$AUTH_AWAITING)})]}),(0,D.jsx)(`p`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:i(o.BACKEND$AUTH_BROWSER_OPENED)}),a.verificationUrl&&U(a.verificationUrl)&&(0,D.jsxs)(`div`,{className:`text-xs text-[var(--oh-muted)]`,children:[(0,D.jsx)(`p`,{children:i(o.BACKEND$AUTH_OPEN_MANUALLY)}),(0,D.jsx)(`a`,{href:a.verificationUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-400 hover:underline break-all`,children:a.verificationUrl})]}),(0,D.jsx)(C,{type:`button`,variant:`secondary`,onClick:a.cancel,testId:`${n}-auth-cancel`,className:`w-full mt-2`,children:i(o.BACKEND$AUTH_CANCEL)})]}),a.status===`error`&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 bg-red-900/20 border border-red-700 rounded-lg`,"data-testid":`${n}-auth-error`,role:`alert`,children:[(0,D.jsx)(`p`,{className:`text-sm text-red-400`,children:a.error}),(0,D.jsx)(C,{type:`button`,variant:`secondary`,onClick:l,testId:`${n}-auth-retry`,className:`w-full`,children:i(o.BACKEND$AUTH_RETRY)})]})]})}function W(){return(0,D.jsxs)(`svg`,{className:`animate-spin h-4 w-4 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,D.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}function G(e){let t=e.trim().toLowerCase();return t.includes(`all-hands.dev`)||t.includes(`openhands.dev`)?`cloud`:`local`}function ae(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``);return!!(t===`localhost`||t===`::1`||t===`::`||t===`0.0.0.0`||/^127\./.test(t)||/^::ffff:127\./i.test(t)||/^10\./.test(t)||/^192\.168\./.test(t)||/^172\.(1[6-9]|2\d|3[01])\./.test(t)||/^fe[89ab][0-9a-f]:/i.test(t)||/^f[cd][0-9a-f]{2}:/i.test(t)||t.endsWith(`.local`)||!t.includes(`.`)&&!t.includes(`:`))}function K(e){let t=e.trim().replace(/\/+$/,``);if(!t)return``;if(/^https?:\/\//i.test(t))return t;let n=t.match(/^\[([^\]]+)\]/);return`${ae(n?n[1]:(t.match(/:/g)??[]).length>1?t:t.split(`:`)[0])?`http`:`https`}://${t}`}function q(e){let t=e.trim();if(!t||/\s/.test(t))return!1;let n=K(t);if(!n)return!1;try{let e=new URL(n);return(e.protocol===`http:`||e.protocol===`https:`)&&e.hostname.length>0}catch{return!1}}var J=`https://app.all-hands.dev`;function Y(e,t){return e(o.BACKEND$CONNECTION_TEST_FAILED,{host:t,interpolation:{escapeValue:!1}})}function oe(e){return e instanceof Error?e.message:typeof e==`string`?e:null}function X(e,t){let n=oe(t);return n?`${e}\n${n}`:e}async function Z(e){e.kind===`local`&&await new g(p({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo()}function se({backend:e,testIdRoot:t}){let{t:r}=s(`openhands`),i=P([e])[e.id],a=i?.isConnected??null,c=i?.disabled===!0,l=i?.consecutiveFailures??0,u=i?.lastError??null,{data:d}=n({queryKey:[`backend-version`,e.host,e.apiKey],queryFn:async()=>(await new g(p({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo()).version??null,retry:!1,staleTime:6e4,enabled:e.kind===`local`&&!c}),f;f=r(a===!0?o.ONBOARDING$BACKEND_STATUS_CONNECTED:a===!1?o.ONBOARDING$BACKEND_STATUS_DISCONNECTED:o.ONBOARDING$BACKEND_STATUS_CHECKING);let m=e.kind===`cloud`?r(o.BACKEND$KIND_CLOUD):r(o.BACKEND$KIND_LOCAL);return(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsxs)(`div`,{"data-testid":`${t}-status`,className:`flex items-center gap-3 text-sm`,children:[(0,D.jsx)(L,{isConnected:a}),(0,D.jsx)(`span`,{className:`text-white`,"data-testid":`${t}-status-label`,children:f}),(0,D.jsx)(`span`,{className:`text-tertiary-alt`,children:`·`}),(0,D.jsx)(`span`,{className:`text-[var(--oh-text-tertiary)]`,children:m}),d?(0,D.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,"data-testid":`${t}-version`,children:r(o.BACKEND$VERSION_LABEL,{version:d})}):null]}),c?(0,D.jsxs)(`div`,{"data-testid":`${t}-status-error`,className:`flex flex-col gap-1 rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm`,children:[(0,D.jsx)(`span`,{className:`font-semibold text-red-300`,children:r(o.BACKEND$HEALTH_FAILED_TITLE)}),(0,D.jsx)(`span`,{className:`text-xs text-[var(--oh-text-tertiary)]`,children:r(o.BACKEND$HEALTH_FAILED_DETAIL,{count:l})}),u?(0,D.jsx)(`span`,{"data-testid":`${t}-status-error-message`,className:`text-xs text-red-300 whitespace-pre-wrap break-words`,children:u}):null]}):null]})}function Q({mode:e,backend:t,onSubmitted:n,renderActions:r,testIdRoot:i,hostReadOnly:a,requireApiKey:c,onSubmitOverride:l}){let{t:u}=s(`openhands`),{addBackend:d,updateBackend:f}=h(),[p,m]=O.useState(t?.name??``),[g,_]=O.useState(t?.host??``),[v,y]=O.useState(t?.apiKey??``),[b,x]=O.useState(null),[S,w]=O.useState(!1),[T,k]=O.useState(!1),[A,j]=O.useState(!1),M=G(g),N=i??(e===`edit`?`edit-backend`:`add-backend`),P=c||M!==`local`,F=p.trim().length>0&&q(g)&&(!P||v.trim().length>0),I=T&&!p.trim()?u(o.BACKEND$NAME_REQUIRED):void 0,L=A?g.trim()?q(g)?void 0:u(o.BACKEND$HOST_INVALID):u(o.BACKEND$HOST_REQUIRED):void 0;return(0,D.jsxs)(`form`,{"data-testid":`${N}-form`,onSubmit:async r=>{if(r.preventDefault(),S)return;if(!F){k(!0),j(!0);return}let i={name:p.trim(),host:K(g),apiKey:v.trim(),kind:M};x(null),w(!0);try{if(l){await l(i);return}await Z(i),e===`edit`&&t?f(t.id,i):d(i),n()}catch(e){x(X(Y(u,i.host),e))}finally{w(!1)}},className:`flex flex-col gap-4`,children:[(0,D.jsx)(E,{testId:`${N}-name`,name:`${N}-name`,type:`text`,label:u(o.BACKEND$NAME_LABEL),value:p,onChange:e=>{m(e),x(null)},onBlur:()=>k(!0),placeholder:`Production`,className:`w-full`,showRequiredTag:!0,error:I}),(0,D.jsx)(E,{testId:`${N}-host`,name:`${N}-host`,type:`text`,label:u(o.BACKEND$HOST_LABEL),value:g,onChange:a?void 0:e=>{_(e),x(null)},onBlur:()=>j(!0),placeholder:J,className:`w-full`,showRequiredTag:!0,error:L,isDisabled:a}),(0,D.jsx)(E,{testId:`${N}-api-key`,name:`${N}-api-key`,type:`password`,label:u(o.BACKEND$KEY_LABEL),value:v,onChange:e=>{y(e),x(null)},placeholder:``,className:`w-full`}),b?(0,D.jsx)(`div`,{role:`alert`,"data-testid":`${N}-error`,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:b}):null,e===`edit`&&t&&(0,D.jsx)(se,{backend:t,testIdRoot:N}),r?r({canSubmit:F&&!S,isSubmitting:S,testIdRoot:N}):(0,D.jsxs)(`div`,{className:`flex justify-end gap-2 mt-2 w-full`,children:[(0,D.jsx)(C,{type:`button`,variant:`secondary`,onClick:n,testId:`${N}-cancel`,children:u(o.BUTTON$CANCEL)}),(0,D.jsx)(C,{type:`submit`,variant:`primary`,isDisabled:!F||S,testId:`${N}-submit`,children:u(o.BACKEND$SAVE)})]})]})}function $(){let{currentPath:e,navigate:t}=w();return O.useCallback(()=>{/^\/automations\/[^/]+/.test(e)?t(`/automations`):/^\/conversations\/[^/]+/.test(e)&&t(`/conversations`)},[e,t])}function ce({onClose:e}){let{t}=s(`openhands`),{addBackend:n}=h(),r=$(),[i,a]=O.useState(``),[c,l]=O.useState(``),[u,d]=O.useState(``),[f,p]=O.useState(null),[m,g]=O.useState(!1),_=G(c),v=i.trim().length>0&&q(c)&&(_===`local`||u.trim().length>0);return(0,D.jsxs)(`form`,{"data-testid":`add-backend-form`,onSubmit:async a=>{if(a.preventDefault(),!v||m)return;let o={name:i.trim(),host:K(c),apiKey:u.trim(),kind:_};p(null),g(!0);try{await Z(o),n(o),r(),e()}catch(e){p(X(Y(t,o.host),e))}finally{g(!1)}},className:`flex flex-col gap-4 flex-1 min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,D.jsx)(E,{testId:`add-backend-name`,name:`add-backend-name`,type:`text`,label:t(o.BACKEND$NAME_LABEL),value:i,onChange:e=>{a(e),p(null)},placeholder:`e.g. My Server`,className:`w-full`}),(0,D.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,children:t(o.BACKEND$NAME_HELPER)})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,D.jsx)(E,{testId:`add-backend-host`,name:`add-backend-host`,type:`text`,label:t(o.BACKEND$HOST_LABEL),value:c,onChange:e=>{l(e),p(null)},placeholder:`http://localhost:8000`,className:`w-full`}),(0,D.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)]`,"data-testid":`add-backend-host-helper`,children:t(o.BACKEND$HOST_HELPER)})]}),(0,D.jsx)(E,{testId:`add-backend-api-key`,name:`add-backend-api-key`,type:`password`,label:t(o.BACKEND$KEY_LABEL),value:u,onChange:e=>{d(e),p(null)},placeholder:`sk-••••••••••`,className:`w-full`}),f?(0,D.jsx)(`div`,{role:`alert`,"data-testid":`add-backend-error`,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:f}):null,(0,D.jsx)(C,{type:`submit`,variant:`secondary`,isDisabled:!v||m,testId:`add-backend-submit`,className:`w-full text-center`,children:t(m?o.ONBOARDING$BACKEND_STATUS_CHECKING:o.BACKEND$CONNECT)})]})}function le({onClose:e}){let{t}=s(`openhands`),{addBackend:n}=h(),r=$(),[i,a]=O.useState(!1),[l,u]=O.useState(``),d=l.trim()||J;return(0,D.jsxs)(`div`,{className:`flex flex-1 min-w-0 flex-col items-center gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,D.jsx)(F,{width:56,height:56,"aria-hidden":!0}),(0,D.jsx)(`h4`,{className:S,"data-testid":`add-backend-cloud-title`,children:t(o.BACKEND$CLOUD_TITLE)})]}),(0,D.jsx)(`p`,{className:`text-center text-sm leading-relaxed text-[var(--oh-muted)]`,children:t(o.BACKEND$CLOUD_DESCRIPTION)}),(0,D.jsx)(ie,{host:d,onSuccess:t=>{n({name:`OpenHands Cloud`,host:K(d),apiKey:t,kind:`cloud`}),r(),e()},testIdRoot:`add-backend`}),(0,D.jsxs)(`div`,{className:`w-full`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-expanded":i,"data-testid":`add-backend-advanced-toggle`,className:`flex w-full cursor-pointer items-center justify-center gap-1 text-center text-xs text-[var(--oh-muted)] transition-colors hover:text-content-2`,children:[(0,D.jsx)(`span`,{children:t(o.BACKEND$ADVANCED)}),(0,D.jsx)(I,{className:c(`h-4 w-4 shrink-0 text-muted transition-transform`,i&&`rotate-180`),"aria-hidden":!0})]}),(0,D.jsxs)(`div`,{className:c(`pt-2`,!i&&`pointer-events-none invisible`),"aria-hidden":!i,children:[(0,D.jsx)(E,{testId:`add-backend-cloud-host`,name:`add-backend-cloud-host`,type:`text`,label:t(o.BACKEND$HOST_LABEL),value:l,onChange:u,placeholder:J,className:`w-full`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-[var(--oh-muted)]`,children:t(o.BACKEND$LOGIN_CLOUD_HINT)})]})]})]})}function ue({mode:e,backend:t,onClose:n}){let{t:r}=s(`openhands`);if(e===`add`)return(0,D.jsx)(v,{onClose:n,closeOnEscape:!1,"aria-label":r(o.BACKEND$ADD_TITLE),children:(0,D.jsxs)(`div`,{"data-testid":`add-backend-modal`,className:c(`relative rounded-xl border border-[var(--oh-border)] bg-base-secondary`,y(`xl`),b),children:[(0,D.jsx)(T,{onClose:n,testId:`add-backend-close`}),(0,D.jsx)(`div`,{className:`px-6 pt-6 pb-2 pr-12`,children:(0,D.jsx)(`h2`,{className:x,children:r(o.BACKEND$ADD_TITLE)})}),(0,D.jsxs)(`div`,{className:`flex gap-6 px-6 pb-6 pt-2`,children:[(0,D.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,D.jsx)(ce,{onClose:n})}),(0,D.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center`,children:[(0,D.jsx)(`div`,{className:`flex-1 w-px bg-[var(--oh-border)]`}),(0,D.jsx)(`span`,{className:`py-3 text-xs uppercase text-[var(--oh-muted)]`,children:r(o.BACKEND$LOGIN_OR)}),(0,D.jsx)(`div`,{className:`flex-1 w-px bg-[var(--oh-border)]`})]}),(0,D.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,D.jsx)(le,{onClose:n})})]})]})});let i=`edit-backend`;return(0,D.jsx)(v,{onClose:n,closeOnEscape:!1,"aria-label":r(o.BACKEND$EDIT_TITLE),children:(0,D.jsxs)(`div`,{"data-testid":`${i}-modal`,className:c(`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)]`,y(`md`)),children:[(0,D.jsx)(T,{onClose:n,testId:`${i}-close`}),(0,D.jsx)(`h2`,{className:c(`pr-6`,x),children:r(o.BACKEND$EDIT_TITLE)}),(0,D.jsx)(Q,{mode:`edit`,backend:t,onSubmitted:n,testIdRoot:i})]})})}export{P as a,M as i,ue as n,L as r,Q as t};
@@ -1 +1 @@
1
- import{o as e,t}from"./declaration-CR6HMp29.js";import{t as n}from"./useTranslation-B6voJV4y.js";import{n as r}from"./active-backend-context-Beu-LZL-.js";import{n as i,t as a}from"./use-cloud-current-user-id-Ddr75hEz.js";import{r as o}from"./typography-BDgnT7Yp.js";var s=e();function c(){let{t:e}=n(),o=r(),s=i(),c=a();if(o.backend.kind!==`cloud`||!o.orgId)return o.backend.name;let l=s[o.backend.id]?.orgs.find(e=>e.id===o.orgId);if(!l)return o.backend.name;let u=c[o.backend.id]?.userId??null,d=u&&l.id===u?e(t.BACKEND$PERSONAL_WORKSPACE):l.name;return`${o.backend.name} – ${d}`}function l(){let{t:e}=n(),i=r(),a=c();return(0,s.jsx)(`div`,{"data-testid":`backend-synced-settings-badge`,className:`flex items-center`,children:(0,s.jsx)(o.Text,{className:`text-[11px] font-medium text-[var(--oh-text-dim)] leading-5`,children:e(t.SETTINGS$BACKEND_SYNCED_BADGE,{name:a,host:i.backend.host,interpolation:{escapeValue:!1}})})})}export{l as t};
1
+ import{o as e,t}from"./declaration-CR6HMp29.js";import{t as n}from"./useTranslation-B6voJV4y.js";import{n as r}from"./active-backend-context-BSPE-W72.js";import{n as i,t as a}from"./use-cloud-current-user-id-ClKFPjFz.js";import{r as o}from"./typography-BDgnT7Yp.js";var s=e();function c(){let{t:e}=n(),o=r(),s=i(),c=a();if(o.backend.kind!==`cloud`||!o.orgId)return o.backend.name;let l=s[o.backend.id]?.orgs.find(e=>e.id===o.orgId);if(!l)return o.backend.name;let u=c[o.backend.id]?.userId??null,d=u&&l.id===u?e(t.BACKEND$PERSONAL_WORKSPACE):l.name;return`${o.backend.name} – ${d}`}function l(){let{t:e}=n(),i=r(),a=c();return(0,s.jsx)(`div`,{"data-testid":`backend-synced-settings-badge`,className:`flex items-center`,children:(0,s.jsx)(o.Text,{className:`text-[11px] font-medium text-[var(--oh-text-dim)] leading-5`,children:e(t.SETTINGS$BACKEND_SYNCED_BADGE,{name:a,host:i.backend.host,interpolation:{escapeValue:!1}})})})}export{l as t};
@@ -1 +1 @@
1
- import{L as e}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as t}from"./declaration-CR6HMp29.js";import{t as n}from"./sdk-section-page-BgDlMhcq.js";var r=t();function i(){return(0,r.jsx)(n,{sectionKeys:[`condenser`],testId:`condenser-settings-screen`})}var a=e(i);export{a as default};
1
+ import{L as e}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as t}from"./declaration-CR6HMp29.js";import{t as n}from"./sdk-section-page-CRCRY3PG.js";var r=t();function i(){return(0,r.jsx)(n,{sectionKeys:[`condenser`],testId:`condenser-settings-screen`})}var a=e(i);export{a as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./conversation-DTn8jN8L.js";export{e as default};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/files-tab-cL668j1I.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor~files-tab-BtkpAiMX.js","assets/iconBase-DE30Zj_-.js","assets/react-CM_dJw1Z.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-hTzSytKK.js","assets/agent-server-client-options-HEOwGVIU.js","assets/agent-server-conversation-service.api-CORdqJZg.js","assets/preload-helper-CT1Z6Pdu.js","assets/profiles-client-fEmgWkCW.js","assets/v4-khGvL7i2.js","assets/agent-server-compatibility-CdI3N7dr.js","assets/server-client-Kh4QSwDJ.js","assets/settings-service.api-C3rxTtPj.js","assets/proxy-BAdHH8QB.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-CLlsvdNP.js","assets/settings-DGY6n4J2.js","assets/acp-providers-CPdgcp13.js","assets/declaration-CR6HMp29.js","assets/common-DqjLSBOt.js","assets/vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-DYXOLEck.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~g56ukk6u-DsSvIDZQ.js","assets/QueryClientProvider-Cnr-Yl3j.js","assets/useTranslation-B6voJV4y.js","assets/context-CEQZwATj.js","assets/vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-d2oallMa.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-E4d6IEfI.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CG96FCly.js","assets/objectWithoutPropertiesLoose-DSQKyRhw.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BED5W_c4.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CyZ-3lDQ.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-6ByzelMS.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CCbqAFiI.js","assets/react-Dy05vyj5.js","assets/conversation-tab-empty-state-CStQLPVW.js","assets/utils-DCVfKFRt.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~hkqzh1hb-BZ0HXuHD.js","assets/markdown-renderer-B3IAVfv4.js","assets/checkmark-Dus0b6jt.js","assets/copy-Chg-sFu3.js","assets/active-backend-context-Beu-LZL-.js","assets/health-store-B5f0S2FY.js","assets/use-active-conversation-DHGcmjCK.js","assets/conversation-service.api-BsJy6uuL.js","assets/navigation-context-BdKYH32C.js","assets/use-user-conversation-Cs5H1pUF.js","assets/use-agent-state-PKrUPMJ3.js","assets/conversation-state-store-D-w0uurj.js","assets/use-runtime-is-ready-Do2h_hRl.js","assets/chevron-left-small-_uvG7RVM.js","assets/file-BTY6Gyy9.js","assets/folder-D1T2W1cj.js","assets/link-external-DGxVm4Ps.js","assets/files-tab-store-m0ARqX_E.js","assets/use-event-store-BomO7ywK.js","assets/typography-BDgnT7Yp.js","assets/dist-C3NfioQC.js","assets/conversation-local-storage-YmOVXxxW.js","assets/git-status-mapper-DnL9OC8_.js","assets/retrieve-axios-error-message-BY-yIkIq.js","assets/browser-tab-dvSPdvkm.js","assets/vendor~browser-tab-BxhTtM9_.js","assets/browser-store-DAsixKdU.js","assets/vscode-tab-DgepcYtF.js","assets/use-unified-vscode-url-DEoe-NRI.js","assets/vscode-url-helper-Cwy1A62q.js","assets/waiting-for-runtime-message-CdK3btDZ.js","assets/brand-button-DJ_S16rO.js","assets/planner-tab-CmIjLz7q.js","assets/plan-components-CRDMQzsS.js","assets/use-handle-plan-click-CohJPvvW.js","assets/custom-toast-handlers-ufGJ6_Rc.js","assets/createLucideIcon-Ddu8jDOQ.js","assets/i18n-DET2iOyh.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~skills-settings~m~o9nrx3fm-D44TR8hL.js","assets/use-create-conversation-Bszyp13O.js","assets/useMutation-GSSKKebK.js","assets/mutation-D0OogFCz.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jfc6hidu-DJS-rJdI.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~zm51vy4j-BClAMeFe.js","assets/use-settings-D5hbTS9t.js","assets/query-keys-tAsQcc_9.js","assets/conversation-store-CC-isCnP.js","assets/middleware-CfatjPYZ.js","assets/lesson-plan-duSsqWVs.js","assets/task-list-tab-DT6_zfUs.js","assets/use-task-list-CsT10CBb.js","assets/u-check-circle-half-steSK_JB.js","assets/u-check-circle-DOauqQKb.js","assets/terminal-CDhQGDua.js","assets/vendor~terminal-DZaJIY8A.js","assets/vendor~terminal-T4IDBjWs.css","assets/command-store-CE1weJy8.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./preload-helper-CT1Z6Pdu.js";import{A as r,L as i,M as a,k as o}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as s}from"./react-dom-hVBnwgwZ.js";import{t as c}from"./vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-DYXOLEck.js";import{c as l,i as u,r as d,s as f}from"./path-utils-onx24uF5.js";import{t as p}from"./useMutation-GSSKKebK.js";import{o as m,t as h}from"./declaration-CR6HMp29.js";import{n as g}from"./QueryClientProvider-Cnr-Yl3j.js";import{t as _}from"./Trans-4jmk54WC.js";import{t as v}from"./useTranslation-B6voJV4y.js";import{a as y,c as b,d as x,f as S,i as C,l as w,n as T,o as ee,r as E,s as D,t as te,u as O}from"./messages-dqp_KYyl.js";import{c as k,d as A,f as ne,i as j,l as M,n as N,r as P,s as F,t as I,u as L}from"./sidebar-mobile-menu-toggle-D0-AvsnT.js";import{a as R,n as z,o as B,r as re,t as ie}from"./custom-toast-handlers-ufGJ6_Rc.js";import{n as V,r as ae,t as oe}from"./vendor~conversation-panel~conversation-C9o-K1hW.js";import{a as se,c as ce,d as H,f as le,l as ue,m as de,n as fe,o as pe,s as me,t as he,u as ge}from"./conversation-websocket-context-DvHgx_FE.js";import{t as _e}from"./x-JOBEVLW0.js";import{C as ve,P as ye,S as U,T as be,b as xe,c as Se,d as Ce,l as we,m as Te,o as Ee,t as W,u as De,w as Oe,x as ke,y as Ae}from"./utils-DCVfKFRt.js";import{t as je}from"./common-DqjLSBOt.js";import{i as Me}from"./agent-server-client-options-HEOwGVIU.js";import{n as G}from"./active-backend-context-Beu-LZL-.js";import{n as Ne}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jfc6hidu-DJS-rJdI.js";import{a as Pe,i as Fe,t as Ie}from"./agent-server-conversation-service.api-CORdqJZg.js";import{t as Le}from"./modal-backdrop-RfNCrSpK.js";import{n as Re}from"./modal-body-aoa2fx5W.js";import{r as ze}from"./base-modal-C2oy2EBG.js";import{t as Be}from"./brand-button-DJ_S16rO.js";import{t as Ve}from"./loading-spinner-5GT9q1xy.js";import{n as He}from"./navigation-context-BdKYH32C.js";import{h as Ue}from"./vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-tTR8C6m0.js";import{O as We}from"./vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-6Rm8U_Sr.js";import{t as Ge}from"./styled-tooltip-hdfMXPQC.js";import{r as Ke,u as qe}from"./dropdown-classes-BsVmxlNG.js";import{_ as Je,h as Ye,m as Xe,n as Ze,p as Qe,s as $e}from"./git-provider-icon-CHdGBdU2.js";import{t as et}from"./react-Dy05vyj5.js";import{n as tt}from"./middleware-CfatjPYZ.js";import{i as nt,s as rt}from"./conversation-local-storage-YmOVXxxW.js";import{t as K}from"./conversation-store-CC-isCnP.js";import{t as it}from"./modal-close-button-CtWOUMmw.js";import{t as at}from"./v4-khGvL7i2.js";import{t as ot}from"./use-is-authed-dw2026rR.js";import{t as st}from"./use-click-outside-element-DhxCUyWl.js";import{r as ct}from"./use-settings-D5hbTS9t.js";import{n as lt,t as ut}from"./use-create-conversation-Bszyp13O.js";import{r as dt}from"./conversation-service.api-BsJy6uuL.js";import{i as ft}from"./vendor~root-layout~conversation-panel~conversation~shared-conversation-DW31UyBp.js";import{n as pt,t as q}from"./context-menu-list-item-7tAcm2c3.js";import{i as J,r as mt,t as ht}from"./ellipsis-button-Vh5MvRZa.js";import{t as gt}from"./u-edit-BbrptMCa.js";import{t as _t}from"./skills-0GRKX5Xj.js";import{t as vt}from"./terminal-CPYWdo4j.js";import{t as yt}from"./use-user-conversation-Cs5H1pUF.js";import{t as bt}from"./conversation-state-store-D-w0uurj.js";import{C as xt,D as St,E as Ct,I as wt,M as Tt,O as Et,P as Dt,S as Ot,T as kt,_ as At,a as jt,b as Mt,d as Nt,f as Pt,g as Ft,h as It,i as Lt,j as Rt,k as zt,m as Bt,n as Vt,p as Ht,r as Ut,t as Wt,v as Gt,w as Kt,x as qt,y as Jt}from"./git-control-bar-branch-button-DtIrOrie.js";import{n as Y,r as Yt,t as X}from"./use-active-conversation-DHGcmjCK.js";import{t as Z}from"./use-agent-state-PKrUPMJ3.js";import{S as Xt,a as Zt,d as Qt,o as $t,t as en}from"./use-event-store-BomO7ywK.js";import{t as tn}from"./command-store-CE1weJy8.js";import{r as nn}from"./typography-BDgnT7Yp.js";import{t as rn}from"./lesson-plan-duSsqWVs.js";import{t as an}from"./copy-Chg-sFu3.js";import{t as on}from"./use-runtime-is-ready-Do2h_hRl.js";import{r as sn}from"./plan-components-CRDMQzsS.js";import{t as cn}from"./use-breakpoint-DF_RiQ6s.js";import{t as ln}from"./globe-Bzj_0oXT.js";import{n as un,t as dn}from"./use-unified-vscode-url-DEoe-NRI.js";import{t as fn}from"./use-task-list-CsT10CBb.js";import{t as pn}from"./vendor~conversation-panel~conversation~alert-banner-w-I2sY6c.js";var Q=e(t(),1),mn={curAgentState:U.LOADING},hn=et(e=>({...mn,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(mn)})),gn=`openhands-last-conversation-by-backend`;function _n(e,t){return t?`${e}::${t}`:e}function vn(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(gn);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}catch{return{}}}function yn(e){if(!(typeof window>`u`))try{window.localStorage.setItem(gn,JSON.stringify(e))}catch{}}function bn(e,t,n){if(!n)return;let r=vn();r[_n(e,t)]=n,yn(r)}function xn(e,t){let n=vn(),r=_n(e,t);r in n&&(delete n[r],yn(n))}var Sn=e=>({action:S.CHANGE_AGENT_STATE,args:{agent_state:e}}),Cn=e=>`error`in e,wn=e=>`type`in e&&e.type===`error`,Tn=()=>{let{send:e}=x(),t=en(e=>e.events);Q.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!($t(n)&&Zt(n))){if(Cn(n)){if(n.error_code===401){z(`Session expired.`);return}typeof n.error==`string`?z(n.error):z(n.message);return}wn(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(Sn(U.PAUSED))}},[t.length])},En=()=>{let{curAgentState:e}=Z();return{runtimeActive:!ve.includes(e)}};function Dn({children:e}){return Tn(),En(),e}var $=m(),On=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,$.jsx)(`path`,{d:`M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z`})}),kn={entriesByConversation:{}},An=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),jn=et()(tt(e=>({...kn,addPending:(t,n)=>{let r=at();return e(e=>An(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>An(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>An(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>An(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function Mn({onClick:e}){let{t}=v(`openhands`);return(0,$.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-normal text-success bg-success/10 hover:bg-success/20 border border-success/30 transition-colors`,children:[(0,$.jsx)(On,{className:`w-3.5 h-3.5 fill-success`}),(0,$.jsx)(`span`,{children:t(h.CHAT_INTERFACE$BTW_GOT_IT)})]})}function Nn({conversationId:e}){let{t}=v(`openhands`),n=jn(e=>e.entriesByConversation),r=jn(e=>e.dismiss),i=e?n[e]??[]:[];return!e||i.length===0?null:(0,$.jsx)(`div`,{"data-testid":`btw-messages`,className:`flex flex-col w-full`,children:i.map(n=>{let i=n.status===`pending`;return(0,$.jsx)(w,{title:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`opacity-60`,children:t(h.CHAT_INTERFACE$BTW_PREFIX)}),(0,$.jsx)(`span`,{children:n.question}),i&&(0,$.jsx)(`span`,{"data-testid":`btw-spinner`,className:`inline-block w-3.5 h-3.5 ml-2 rounded-full border-2 border-[var(--oh-border-input)] border-t-transparent animate-spin`})]}),details:i?t(h.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,$.jsx)(Mn,{onClick:()=>r(e,n.id)})},n.id)})})}var Pn=`${be} `,Fn=(e,t)=>{let n=jn(e=>e.addPending),r=jn(e=>e.resolve),i=jn(e=>e.fail);return(0,Q.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(Pn);if(!e||!s){t(a);return}let c=o.slice(be.length).trim();if(!c)return;let l=n(e,c);d(e,c).then(({response:t})=>r(e,l,t)).catch(t=>i(e,l,t?.message??`Failed to ask agent`))},[e,t,n,r,i])},In=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function Ln(e){return W(In,e?`bg-[var(--oh-surface)] hover:bg-tertiary cursor-pointer text-white`:`bg-[var(--oh-surface)] cursor-not-allowed opacity-50 text-[var(--oh-muted)]`)}function Rn(e){return e?`white`:`var(--oh-muted)`}var zn=`font-normal text-sm leading-5 truncate`;function Bn({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=v(`openhands`),{trackPullButtonClick:a}=lt(),o=n&&t&&r;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(Se())},disabled:!o,className:W(Ln(o),`px-0.5 py-1 w-[76px] min-w-[76px]`),children:[(0,$.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,$.jsx)(xt,{width:12,height:12,color:Rn(o)})}),(0,$.jsx)(`div`,{className:W(zn,`max-w-[76px]`),title:i(h.COMMON$PULL),children:i(h.COMMON$PULL)})]})}function Vn({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=v(`openhands`),{trackPushButtonClick:o}=lt(),s=n&&t&&i;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(we(r))},disabled:!s,className:W(Ln(s),`px-2 py-1 w-[77px] min-w-[77px]`),children:[(0,$.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,$.jsx)(Kt,{width:12,height:12,color:Rn(s)})}),(0,$.jsx)(`div`,{className:W(zn,`max-w-[77px]`),title:a(h.COMMON$PUSH),children:a(h.COMMON$PUSH)})]})}function Hn({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=v(`openhands`),{trackCreatePrButtonClick:o}=lt(),s=n&&t&&i;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(Ee(r))},disabled:!s,className:W(Ln(s),`px-2 py-1 w-[126px] min-w-[126px] h-7`),children:[(0,$.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,$.jsx)(Ot,{width:12,height:12,color:Rn(s)})}),(0,$.jsx)(`div`,{className:W(zn,`max-w-[126px]`),title:a(h.COMMON$PULL_REQUEST),children:a(h.COMMON$PULL_REQUEST)})]})}function Un(e){return e.kind===`BashCommand`}function Wn(e){return e.kind===`BashOutput`}function Gn(e){return e.kind===`BashError`}function Kn(e,t,n){let r=(0,Q.useRef)(null),i=(0,Q.useRef)([]),a=(0,Q.useRef)([]),o=(0,Q.useRef)(new Map);return(0,Q.useEffect)(()=>{if(!n)return;let s=Me(e,t),c=new WebSocket(s);r.current=c,c.onopen=()=>{for(let{command:e,cwd:t,timeout:n,resolve:r,reject:o}of i.current)a.current.push({resolve:r,reject:o}),c.send(JSON.stringify({command:e,cwd:t,timeout:n}));i.current=[]},c.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Un(t)){let e=a.current.shift();e&&o.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Wn(t)&&t.command_id){let e=o.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(o.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else Gn(t)&&l(`Bash error: ${t.code}: ${t.detail}`)};function l(e){let t=Error(e);for(let{reject:e}of i.current)e(t);i.current=[];for(let e of a.current)e.reject(t);a.current=[];for(let e of o.current.values())e.reject(t);o.current.clear()}return c.onclose=()=>{r.current=null,l(`Bash WebSocket closed`)},c.onerror=()=>{r.current=null,l(`Bash WebSocket error`)},()=>{c.onclose=null,c.onerror=null,c.close(),r.current=null,l(`Bash WebSocket unmounted`)}},[n,e,t]),(0,Q.useCallback)((e,t,n)=>new Promise((o,s)=>{let c=r.current;if(!c||c.readyState===WebSocket.CLOSED||c.readyState===WebSocket.CLOSING){s(Error(`Bash WebSocket not available`));return}c.readyState===WebSocket.CONNECTING?i.current.push({command:e,cwd:t,timeout:n,resolve:o,reject:s}):(a.current.push({resolve:o,reject:s}),c.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var qn={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function Jn(e){return e.replace(/\.git$/,``)}function Yn(e){return e?qn[e.toLowerCase()]??null:null}function Xn(e){let t=e.split(`/`).filter(Boolean),n=t.indexOf(`_git`);return n===-1?t.join(`/`):[...t.slice(0,n),...t.slice(n+1)].join(`/`)}function Zn(e,t,n){let r=Jn(n.replace(/^\/+/,``)),i=Yn(t);return{url:e,host:t,repository:(i===`azure_devops`?Xn(r):r)||null,provider:i}}function Qn(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return Zn(t,e,n[2])}try{let e=new URL(t);return Zn(t,e.hostname||null,e.pathname)}catch{return null}}var $n={repository:null,branch:null,provider:null,remoteUrl:null},er=[`r=$(git remote get-url origin 2>/dev/null)`,`b=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)`,`if [ -z "$r$b" ]; then`,`n=$(find . -mindepth 2 -maxdepth 4 -name .git 2>/dev/null | cut -c3- | sed 's|/.git$||' | sort -u)`,`c=$(printf '%s\\n' "$n" | grep -c '[^[:space:]]')`,`if [ "$c" = "1" ] && [ -n "$n" ]; then`,`r=$(git -C "$n" remote get-url origin 2>/dev/null)`,`b=$(git -C "$n" rev-parse --abbrev-ref HEAD 2>/dev/null)`,`fi`,`fi`,`printf '%s\\n%s' "$r" "$b"`].join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/files-tab-C47fQEeL.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor~files-tab-BtkpAiMX.js","assets/iconBase-DE30Zj_-.js","assets/react-CM_dJw1Z.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-D8soyAAx.js","assets/agent-server-client-options-9agOSarV.js","assets/agent-server-conversation-service.api-B9TUYJon.js","assets/preload-helper-CT1Z6Pdu.js","assets/profiles-client-BrqNmaDV.js","assets/v4-khGvL7i2.js","assets/agent-server-compatibility-B7QStIcH.js","assets/server-client-DYv_GHPl.js","assets/settings-service.api-DwtyDeGh.js","assets/proxy-BqDMnUY-.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-CLlsvdNP.js","assets/settings-DGY6n4J2.js","assets/acp-providers-BAX8OU5C.js","assets/declaration-CR6HMp29.js","assets/common-DqjLSBOt.js","assets/vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-DYXOLEck.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~g56ukk6u-DsSvIDZQ.js","assets/QueryClientProvider-Cnr-Yl3j.js","assets/useTranslation-B6voJV4y.js","assets/context-CEQZwATj.js","assets/vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-d2oallMa.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-E4d6IEfI.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CG96FCly.js","assets/objectWithoutPropertiesLoose-DSQKyRhw.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BED5W_c4.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CyZ-3lDQ.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-6ByzelMS.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CCbqAFiI.js","assets/react-Dy05vyj5.js","assets/conversation-tab-empty-state-CStQLPVW.js","assets/utils-DCVfKFRt.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~hkqzh1hb-BZ0HXuHD.js","assets/markdown-renderer-B3IAVfv4.js","assets/checkmark-Dus0b6jt.js","assets/copy-Chg-sFu3.js","assets/active-backend-context-BSPE-W72.js","assets/health-store-B5f0S2FY.js","assets/use-active-conversation-sPgfSkql.js","assets/conversation-service.api-B6CkzaKD.js","assets/navigation-context-BdKYH32C.js","assets/use-user-conversation-DJen4YIP.js","assets/use-agent-state-Dp3pD1h3.js","assets/conversation-state-store-D-w0uurj.js","assets/use-runtime-is-ready-BakOUVU-.js","assets/chevron-left-small-_uvG7RVM.js","assets/file-BTY6Gyy9.js","assets/folder-D1T2W1cj.js","assets/link-external-DGxVm4Ps.js","assets/files-tab-store-m0ARqX_E.js","assets/use-event-store-BomO7ywK.js","assets/typography-BDgnT7Yp.js","assets/dist-C3NfioQC.js","assets/conversation-local-storage-YmOVXxxW.js","assets/git-status-mapper-DnL9OC8_.js","assets/retrieve-axios-error-message-BY-yIkIq.js","assets/browser-tab-dvSPdvkm.js","assets/vendor~browser-tab-BxhTtM9_.js","assets/browser-store-DAsixKdU.js","assets/vscode-tab-DH9x7xXS.js","assets/use-unified-vscode-url-DXPtB317.js","assets/vscode-url-helper-Cwy1A62q.js","assets/waiting-for-runtime-message-CdK3btDZ.js","assets/brand-button-DJ_S16rO.js","assets/planner-tab-Dte6Vzza.js","assets/plan-components-CRDMQzsS.js","assets/use-handle-plan-click-DP6Rs-YP.js","assets/custom-toast-handlers-ufGJ6_Rc.js","assets/createLucideIcon-Ddu8jDOQ.js","assets/i18n-DET2iOyh.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~skills-settings~m~o9nrx3fm-D44TR8hL.js","assets/use-create-conversation-B-lwTnfE.js","assets/useMutation-GSSKKebK.js","assets/mutation-D0OogFCz.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jfc6hidu-DJS-rJdI.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~zm51vy4j-BClAMeFe.js","assets/use-settings-DeO7nvpM.js","assets/query-keys-tAsQcc_9.js","assets/conversation-store-CC-isCnP.js","assets/middleware-CfatjPYZ.js","assets/lesson-plan-duSsqWVs.js","assets/task-list-tab-DT6_zfUs.js","assets/use-task-list-CsT10CBb.js","assets/u-check-circle-half-steSK_JB.js","assets/u-check-circle-DOauqQKb.js","assets/terminal-KldRPIRT.js","assets/vendor~terminal-DZaJIY8A.js","assets/vendor~terminal-T4IDBjWs.css","assets/command-store-CE1weJy8.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./preload-helper-CT1Z6Pdu.js";import{A as r,L as i,M as a,k as o}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as s}from"./react-dom-hVBnwgwZ.js";import{t as c}from"./vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-DYXOLEck.js";import{c as l,i as u,r as d,s as f}from"./path-utils-z12iCrQO.js";import{t as p}from"./useMutation-GSSKKebK.js";import{o as m,t as h}from"./declaration-CR6HMp29.js";import{n as g}from"./QueryClientProvider-Cnr-Yl3j.js";import{t as _}from"./Trans-4jmk54WC.js";import{t as v}from"./useTranslation-B6voJV4y.js";import{a as y,c as b,d as x,f as S,i as C,l as w,n as T,o as ee,r as E,s as D,t as te,u as O}from"./messages-Ba1vaw6t.js";import{c as k,d as A,f as ne,i as j,l as M,n as N,r as P,s as F,t as I,u as L}from"./sidebar-mobile-menu-toggle-DGlRg6jG.js";import{a as R,n as z,o as B,r as re,t as ie}from"./custom-toast-handlers-ufGJ6_Rc.js";import{n as V,r as ae,t as oe}from"./vendor~conversation-panel~conversation-C9o-K1hW.js";import{a as se,c as ce,d as H,f as le,l as ue,m as de,n as fe,o as pe,s as me,t as he,u as ge}from"./conversation-websocket-context-DShEuLjh.js";import{t as _e}from"./x-JOBEVLW0.js";import{C as ve,P as ye,S as U,T as be,b as xe,c as Se,d as Ce,l as we,m as Te,o as Ee,t as W,u as De,w as Oe,x as ke,y as Ae}from"./utils-DCVfKFRt.js";import{t as je}from"./common-DqjLSBOt.js";import{i as Me}from"./agent-server-client-options-9agOSarV.js";import{n as G}from"./active-backend-context-BSPE-W72.js";import{n as Ne}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jfc6hidu-DJS-rJdI.js";import{a as Pe,i as Fe,t as Ie}from"./agent-server-conversation-service.api-B9TUYJon.js";import{t as Le}from"./modal-backdrop-RfNCrSpK.js";import{n as Re}from"./modal-body-aoa2fx5W.js";import{r as ze}from"./base-modal-C2oy2EBG.js";import{t as Be}from"./brand-button-DJ_S16rO.js";import{t as Ve}from"./loading-spinner-5GT9q1xy.js";import{n as He}from"./navigation-context-BdKYH32C.js";import{h as Ue}from"./vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-tTR8C6m0.js";import{O as We}from"./vendor~root-layout~home~conversation-panel~conversation~extensions-hub~skills-settings~skil~iguv7bgw-6Rm8U_Sr.js";import{t as Ge}from"./styled-tooltip-hdfMXPQC.js";import{r as Ke,u as qe}from"./dropdown-classes-BsVmxlNG.js";import{_ as Je,h as Ye,m as Xe,n as Ze,p as Qe,s as $e}from"./git-provider-icon-Pi-Cxpgv.js";import{t as et}from"./react-Dy05vyj5.js";import{n as tt}from"./middleware-CfatjPYZ.js";import{i as nt,s as rt}from"./conversation-local-storage-YmOVXxxW.js";import{t as K}from"./conversation-store-CC-isCnP.js";import{t as it}from"./modal-close-button-CtWOUMmw.js";import{t as at}from"./v4-khGvL7i2.js";import{t as ot}from"./use-is-authed-dw2026rR.js";import{t as st}from"./use-click-outside-element-DhxCUyWl.js";import{r as ct}from"./use-settings-DeO7nvpM.js";import{n as lt,t as ut}from"./use-create-conversation-B-lwTnfE.js";import{r as dt}from"./conversation-service.api-B6CkzaKD.js";import{i as ft}from"./vendor~root-layout~conversation-panel~conversation~shared-conversation-DW31UyBp.js";import{n as pt,t as q}from"./context-menu-list-item-7tAcm2c3.js";import{i as J,r as mt,t as ht}from"./ellipsis-button-Vh5MvRZa.js";import{t as gt}from"./u-edit-BbrptMCa.js";import{t as _t}from"./skills-0GRKX5Xj.js";import{t as vt}from"./terminal-CPYWdo4j.js";import{t as yt}from"./use-user-conversation-DJen4YIP.js";import{t as bt}from"./conversation-state-store-D-w0uurj.js";import{C as xt,D as St,E as Ct,I as wt,M as Tt,O as Et,P as Dt,S as Ot,T as kt,_ as At,a as jt,b as Mt,d as Nt,f as Pt,g as Ft,h as It,i as Lt,j as Rt,k as zt,m as Bt,n as Vt,p as Ht,r as Ut,t as Wt,v as Gt,w as Kt,x as qt,y as Jt}from"./git-control-bar-branch-button-BT0aWH-o.js";import{n as Y,r as Yt,t as X}from"./use-active-conversation-sPgfSkql.js";import{t as Z}from"./use-agent-state-Dp3pD1h3.js";import{S as Xt,a as Zt,d as Qt,o as $t,t as en}from"./use-event-store-BomO7ywK.js";import{t as tn}from"./command-store-CE1weJy8.js";import{r as nn}from"./typography-BDgnT7Yp.js";import{t as rn}from"./lesson-plan-duSsqWVs.js";import{t as an}from"./copy-Chg-sFu3.js";import{t as on}from"./use-runtime-is-ready-BakOUVU-.js";import{r as sn}from"./plan-components-CRDMQzsS.js";import{t as cn}from"./use-breakpoint-DF_RiQ6s.js";import{t as ln}from"./globe-Bzj_0oXT.js";import{n as un,t as dn}from"./use-unified-vscode-url-DXPtB317.js";import{t as fn}from"./use-task-list-CsT10CBb.js";import{t as pn}from"./vendor~conversation-panel~conversation~alert-banner-w-I2sY6c.js";var Q=e(t(),1),mn={curAgentState:U.LOADING},hn=et(e=>({...mn,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(mn)})),gn=`openhands-last-conversation-by-backend`;function _n(e,t){return t?`${e}::${t}`:e}function vn(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(gn);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}catch{return{}}}function yn(e){if(!(typeof window>`u`))try{window.localStorage.setItem(gn,JSON.stringify(e))}catch{}}function bn(e,t,n){if(!n)return;let r=vn();r[_n(e,t)]=n,yn(r)}function xn(e,t){let n=vn(),r=_n(e,t);r in n&&(delete n[r],yn(n))}var Sn=e=>({action:S.CHANGE_AGENT_STATE,args:{agent_state:e}}),Cn=e=>`error`in e,wn=e=>`type`in e&&e.type===`error`,Tn=()=>{let{send:e}=x(),t=en(e=>e.events);Q.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!($t(n)&&Zt(n))){if(Cn(n)){if(n.error_code===401){z(`Session expired.`);return}typeof n.error==`string`?z(n.error):z(n.message);return}wn(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(Sn(U.PAUSED))}},[t.length])},En=()=>{let{curAgentState:e}=Z();return{runtimeActive:!ve.includes(e)}};function Dn({children:e}){return Tn(),En(),e}var $=m(),On=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,$.jsx)(`path`,{d:`M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z`})}),kn={entriesByConversation:{}},An=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),jn=et()(tt(e=>({...kn,addPending:(t,n)=>{let r=at();return e(e=>An(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>An(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>An(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>An(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function Mn({onClick:e}){let{t}=v(`openhands`);return(0,$.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-normal text-success bg-success/10 hover:bg-success/20 border border-success/30 transition-colors`,children:[(0,$.jsx)(On,{className:`w-3.5 h-3.5 fill-success`}),(0,$.jsx)(`span`,{children:t(h.CHAT_INTERFACE$BTW_GOT_IT)})]})}function Nn({conversationId:e}){let{t}=v(`openhands`),n=jn(e=>e.entriesByConversation),r=jn(e=>e.dismiss),i=e?n[e]??[]:[];return!e||i.length===0?null:(0,$.jsx)(`div`,{"data-testid":`btw-messages`,className:`flex flex-col w-full`,children:i.map(n=>{let i=n.status===`pending`;return(0,$.jsx)(w,{title:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`opacity-60`,children:t(h.CHAT_INTERFACE$BTW_PREFIX)}),(0,$.jsx)(`span`,{children:n.question}),i&&(0,$.jsx)(`span`,{"data-testid":`btw-spinner`,className:`inline-block w-3.5 h-3.5 ml-2 rounded-full border-2 border-[var(--oh-border-input)] border-t-transparent animate-spin`})]}),details:i?t(h.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,$.jsx)(Mn,{onClick:()=>r(e,n.id)})},n.id)})})}var Pn=`${be} `,Fn=(e,t)=>{let n=jn(e=>e.addPending),r=jn(e=>e.resolve),i=jn(e=>e.fail);return(0,Q.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(Pn);if(!e||!s){t(a);return}let c=o.slice(be.length).trim();if(!c)return;let l=n(e,c);d(e,c).then(({response:t})=>r(e,l,t)).catch(t=>i(e,l,t?.message??`Failed to ask agent`))},[e,t,n,r,i])},In=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function Ln(e){return W(In,e?`bg-[var(--oh-surface)] hover:bg-tertiary cursor-pointer text-white`:`bg-[var(--oh-surface)] cursor-not-allowed opacity-50 text-[var(--oh-muted)]`)}function Rn(e){return e?`white`:`var(--oh-muted)`}var zn=`font-normal text-sm leading-5 truncate`;function Bn({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=v(`openhands`),{trackPullButtonClick:a}=lt(),o=n&&t&&r;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(Se())},disabled:!o,className:W(Ln(o),`px-0.5 py-1 w-[76px] min-w-[76px]`),children:[(0,$.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,$.jsx)(xt,{width:12,height:12,color:Rn(o)})}),(0,$.jsx)(`div`,{className:W(zn,`max-w-[76px]`),title:i(h.COMMON$PULL),children:i(h.COMMON$PULL)})]})}function Vn({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=v(`openhands`),{trackPushButtonClick:o}=lt(),s=n&&t&&i;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(we(r))},disabled:!s,className:W(Ln(s),`px-2 py-1 w-[77px] min-w-[77px]`),children:[(0,$.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,$.jsx)(Kt,{width:12,height:12,color:Rn(s)})}),(0,$.jsx)(`div`,{className:W(zn,`max-w-[77px]`),title:a(h.COMMON$PUSH),children:a(h.COMMON$PUSH)})]})}function Hn({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=v(`openhands`),{trackCreatePrButtonClick:o}=lt(),s=n&&t&&i;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(Ee(r))},disabled:!s,className:W(Ln(s),`px-2 py-1 w-[126px] min-w-[126px] h-7`),children:[(0,$.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,$.jsx)(Ot,{width:12,height:12,color:Rn(s)})}),(0,$.jsx)(`div`,{className:W(zn,`max-w-[126px]`),title:a(h.COMMON$PULL_REQUEST),children:a(h.COMMON$PULL_REQUEST)})]})}function Un(e){return e.kind===`BashCommand`}function Wn(e){return e.kind===`BashOutput`}function Gn(e){return e.kind===`BashError`}function Kn(e,t,n){let r=(0,Q.useRef)(null),i=(0,Q.useRef)([]),a=(0,Q.useRef)([]),o=(0,Q.useRef)(new Map);return(0,Q.useEffect)(()=>{if(!n)return;let s=Me(e,t),c=new WebSocket(s);r.current=c,c.onopen=()=>{for(let{command:e,cwd:t,timeout:n,resolve:r,reject:o}of i.current)a.current.push({resolve:r,reject:o}),c.send(JSON.stringify({command:e,cwd:t,timeout:n}));i.current=[]},c.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Un(t)){let e=a.current.shift();e&&o.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Wn(t)&&t.command_id){let e=o.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(o.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else Gn(t)&&l(`Bash error: ${t.code}: ${t.detail}`)};function l(e){let t=Error(e);for(let{reject:e}of i.current)e(t);i.current=[];for(let e of a.current)e.reject(t);a.current=[];for(let e of o.current.values())e.reject(t);o.current.clear()}return c.onclose=()=>{r.current=null,l(`Bash WebSocket closed`)},c.onerror=()=>{r.current=null,l(`Bash WebSocket error`)},()=>{c.onclose=null,c.onerror=null,c.close(),r.current=null,l(`Bash WebSocket unmounted`)}},[n,e,t]),(0,Q.useCallback)((e,t,n)=>new Promise((o,s)=>{let c=r.current;if(!c||c.readyState===WebSocket.CLOSED||c.readyState===WebSocket.CLOSING){s(Error(`Bash WebSocket not available`));return}c.readyState===WebSocket.CONNECTING?i.current.push({command:e,cwd:t,timeout:n,resolve:o,reject:s}):(a.current.push({resolve:o,reject:s}),c.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var qn={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function Jn(e){return e.replace(/\.git$/,``)}function Yn(e){return e?qn[e.toLowerCase()]??null:null}function Xn(e){let t=e.split(`/`).filter(Boolean),n=t.indexOf(`_git`);return n===-1?t.join(`/`):[...t.slice(0,n),...t.slice(n+1)].join(`/`)}function Zn(e,t,n){let r=Jn(n.replace(/^\/+/,``)),i=Yn(t);return{url:e,host:t,repository:(i===`azure_devops`?Xn(r):r)||null,provider:i}}function Qn(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return Zn(t,e,n[2])}try{let e=new URL(t);return Zn(t,e.hostname||null,e.pathname)}catch{return null}}var $n={repository:null,branch:null,provider:null,remoteUrl:null},er=[`r=$(git remote get-url origin 2>/dev/null)`,`b=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)`,`if [ -z "$r$b" ]; then`,`n=$(find . -mindepth 2 -maxdepth 4 -name .git 2>/dev/null | cut -c3- | sed 's|/.git$||' | sort -u)`,`c=$(printf '%s\\n' "$n" | grep -c '[^[:space:]]')`,`if [ "$c" = "1" ] && [ -n "$n" ]; then`,`r=$(git -C "$n" remote get-url origin 2>/dev/null)`,`b=$(git -C "$n" rev-parse --abbrev-ref HEAD 2>/dev/null)`,`fi`,`fi`,`printf '%s\\n%s' "$r" "$b"`].join(`
3
3
  `);async function tr(e,t){let n=await e(er,t,10);if(n.exit_code!==0)return $n;let r=n.stdout.indexOf(`
4
4
  `),i=(r>=0?n.stdout.slice(0,r):n.stdout).trim(),a=(r>=0?n.stdout.slice(r+1):``).trim(),o=a&&a!==`HEAD`?a:null;if(!i&&!o)return $n;let s=Qn(i);return{repository:s?.repository??null,provider:s?.provider??null,remoteUrl:i||null,branch:o}}var nr=()=>{let{data:e}=X(),t=on(),{backend:n}=G(),r=n.kind===`local`,i=e?.id,a=e?.conversation_url,o=e?.session_api_key,s=e?.workspace?.working_dir?.trim(),l=!!e?.selected_repository,u=!!e?.git_provider,d=!!e?.selected_branch,f=r&&t&&!!i&&!!s&&(!l||!u||!d),p=Kn(a,o,f),m=(0,Q.useRef)(p);return m.current=p,c({queryKey:[`local-git-info`,i,a,o,s],queryFn:async()=>tr((e,t,n)=>m.current(e,t,n),s),enabled:f,retry:!1,staleTime:1e4,refetchInterval:1e4,gcTime:1e3*60*5,meta:{disableToast:!0}})},rr=()=>{let e=g(),{t}=v(`openhands`);return p({mutationFn:e=>Ie.updateConversationRepository(e.conversationId,e.repository,e.branch,e.gitProvider),onMutate:async t=>{let n=[`user`,`conversation`,t.conversationId];await e.cancelQueries({queryKey:n});let r=e.getQueriesData({queryKey:n});return e.setQueriesData({queryKey:n},e=>e&&{...e,selected_repository:t.repository,selected_branch:t.branch??null,git_provider:t.gitProvider??null}),{previousEntries:r}},onError:(n,r,i)=>{i?.previousEntries.forEach(([t,n])=>{e.setQueryData(t,n)}),z(t(h.CONVERSATION$FAILED_TO_UPDATE_REPOSITORY))},onSuccess:()=>{re(t(h.CONVERSATION$REPOSITORY_UPDATED))},onSettled:(t,n,r)=>{e.invalidateQueries({queryKey:[`user`,`conversation`,r.conversationId]}),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`local-git-info`,r.conversationId]})}})};function ir({children:e,tooltipMessage:t,testId:n,shouldShowTooltip:r}){return r?(0,$.jsx)(Ge,{content:t,placement:`top`,showArrow:!0,tooltipClassName:`bg-white text-black`,children:(0,$.jsx)(`span`,{"data-testid":n,className:`hover:opacity-100`,children:e})}):e}function ar({isOpen:e,onClose:t,onLaunch:n,defaultProvider:r=`github`}){let{t:i}=v(`openhands`),{providers:a}=$e(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{a.length===1&&!o?s(a[0]):a.length>1&&!o&&r&&a.includes(r)&&s(r)},[a,o,r]);let f=(0,Q.useCallback)(e=>{e!==o&&(s(e),l(null),d(null))},[o]),p=(0,Q.useCallback)(e=>{e?(l(e),d(null)):(l(null),d(null))},[]),m=(0,Q.useCallback)(e=>{d(e)},[]),g=()=>{!c||!u||(n(c,u),l(null),d(null),t())},_=()=>{s(null),l(null),d(null),t()};if(!e)return null;let y=c?.git_provider||o||r,b=!!c&&!!u;return(0,$.jsx)(Le,{onClose:_,children:(0,$.jsxs)(Re,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,$.jsx)(it,{onClose:_,testId:`close-open-repository-modal`}),(0,$.jsx)(`div`,{className:`w-full pr-6`,children:(0,$.jsx)(ze,{title:i(h.CONVERSATION$OPEN_REPOSITORY)})}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 w-full`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-sm text-white font-normal leading-[22px]`,children:i(h.CONVERSATION$SELECT_OR_INSERT_LINK)}),a.length>1&&(0,$.jsx)(jt,{providers:a,value:o,placeholder:`Select Provider`,onChange:f})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-[10px] w-full`,children:[(0,$.jsx)(Ut,{provider:y,value:c?.id||null,repositoryName:c?.full_name||null,onChange:p,placeholder:`Search repositories...`,className:`w-full`}),(0,$.jsx)(Lt,{repository:c?.full_name||null,provider:y,selectedBranch:u,onBranchSelect:m,defaultBranch:c?.main_branch||null,placeholder:`Select branch...`,disabled:!c,className:`w-full`})]})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 w-full`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(Be,{type:`button`,variant:`secondary`,onClick:_,children:i(h.BUTTON$CANCEL)}),(0,$.jsx)(Be,{type:`button`,variant:`primary`,onClick:g,isDisabled:!b,children:i(h.BUTTON$LAUNCH)})]})]})})}function or({onSuggestionsClick:e}){let{t}=v(`openhands`),{conversationId:n}=Y(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),{addRecentRepository:c}=Ze(),l=H(e=>e.enqueuePendingMessage),u=H(e=>e.markPendingMessageError),{backend:d}=G(),f=d.kind===`local`,{providers:p}=$e(),m=f||p.length>0,{data:g}=X(),{repositoryInfo:_}=Et(),{data:y}=nr(),b=Dt(),S=fe()?.isLoadingHistory??!1,C=(0,Q.useRef)(b);(0,Q.useEffect)(()=>{C.current=b},[b]);let{send:w}=x(),T=(0,Q.useRef)(w);(0,Q.useEffect)(()=>{T.current=w},[w]);let ee=D(),{mutate:E}=rr(),{mutate:te,isPending:O}=ut(),k=g?.selected_repository||_?.selectedRepository,A=g?.git_provider||_?.gitProvider,ne=g?.selected_branch||_?.selectedBranch,j=k||y?.repository||void 0,M=A||y?.provider,N=ne||y?.branch||void 0,P=(g?.id?Pe(g.id):null)?.selected_workspace??null,F=P&&P.replace(/\/+$/,``).split(`/`).pop()||null,I=!!j&&!!M,L=!!g&&b===`OPEN`&&!S;(0,Q.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,Q.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&o(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let R=(e,r)=>{n&&(c(e),E({conversationId:n,repository:e.full_name,branch:r.name,gitProvider:e.git_provider},{onSuccess:()=>{if(C.current!==`OPEN`){z(t(h.CONVERSATION$CLONE_COMMAND_FAILED_DISCONNECTED));return}let i=e.git_provider.charAt(0).toUpperCase()+e.git_provider.slice(1),a=`Clone ${e.full_name} from ${i} and checkout branch ${r.name}.`,o=n?l({conversationId:n,text:a}):null;ee?.scrollDomToBottom(),Promise.resolve(T.current({action:`message`,args:{content:a,timestamp:new Date().toISOString()}})).catch(e=>{o&&u(o,e instanceof Error?e.message:`Failed to send message`)})}}))},B=!f||!!j||!!F,re=f&&!I;return B||N||I?(0,$.jsxs)(`div`,{className:`flex flex-row items-center`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row gap-2.5 items-center overflow-x-auto flex-nowrap relative scrollbar-hide`,children:[B?(0,$.jsx)(Vt,{selectedRepository:j,gitProvider:M,workspaceName:F,onClick:()=>i(!0),disabled:!L||re}):null,N?(0,$.jsx)(Wt,{selectedBranch:N,selectedRepository:j,gitProvider:M}):null,I?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ir,{tooltipMessage:t(h.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pull-button-tooltip`,shouldShowTooltip:!I,children:(0,$.jsx)(Bn,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,isConversationReady:L})}),(0,$.jsx)(ir,{tooltipMessage:t(h.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-push-button-tooltip`,shouldShowTooltip:!I,children:(0,$.jsx)(Vn,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:M,isConversationReady:L})}),(0,$.jsx)(ir,{tooltipMessage:t(h.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pr-button-tooltip`,shouldShowTooltip:!I,children:(0,$.jsx)(Hn,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:M,isConversationReady:L})})]}):null]}),(0,$.jsx)(ar,{isOpen:r,onClose:()=>i(!1),onLaunch:R,defaultProvider:M})]}):null}function sr({onSubmit:e,disabled:t=!1}){let{images:n,files:r,imagesMarkedUploadAsFile:i,clearAllFiles:a,subConversationTaskId:o}=K(),{curAgentState:s}=Z(),{data:c}=X(),{conversationId:l}=Yt(),u=l??c?.id??null,{taskStatus:d}=St(o,c?.id||null),{handleUpload:f}=Nt(),p=Pt(u,Fn(u,t=>{let{imagesToEmbed:o,imagesAsFiles:s}=wt(n,i);e(t,o,[...r,...s]),a()}));return(0,$.jsxs)(`div`,{"data-testid":`interactive-chat-box`,children:[(0,$.jsx)(Ht,{disabled:t||s===U.AWAITING_USER_CONFIRMATION||Te(d),isNewConversationPending:t,onSubmit:p,onFilesPaste:f}),(0,$.jsx)(`div`,{className:`mt-3 pb-3`,children:(0,$.jsx)(or,{onSuggestionsClick:e=>{p(e)}})})]})}function cr(){let e=en(e=>e.events),t=en(e=>e.uiEvents),n=Q.useMemo(()=>t.filter(pe),[t]),r=Q.useMemo(()=>e,[e]),i=Q.useMemo(()=>n.length,[n]),a=Q.useMemo(()=>r.some(e=>e.source===`agent`&&!Xt(e)&&!Qt(e)),[r]),o=se(r);return{storeEvents:e,uiEvents:t,renderableEvents:n,allConversationEvents:r,totalEvents:i,hasSubstantiveAgentActions:a,conversationUserEventsExist:o,userEventsExist:o}}var lr=e=>`timestamp`in e?e.timestamp:void 0,ur=e=>{let t=!!e&&nt(e),n=t?void 0:e,{data:r}=yt(e??null),{data:i,isFetched:a}=me(n??void 0),o=en(e=>e.addEvents),[s,c]=Q.useState(!1),[l,u]=Q.useState(!0),d=Q.useRef(!1),f=Q.useRef(!0);return Q.useEffect(()=>{if(d.current=!1,c(!1),t){f.current=!1,u(!1);return}f.current=!0,u(!0)},[e,t]),Q.useEffect(()=>{t||!a||!i||i.hasMore||(f.current=!1,u(!1))},[t,a,i?.hasMore,n]),{isLoading:s,hasMore:l,loadOlder:Q.useCallback(async()=>{if(!e||nt(e)||d.current||!f.current||!r)return;let{events:t}=en.getState(),n=t[0];if(!n)return;let i=lr(n);if(!i){f.current=!1,u(!1);return}d.current=!0,c(!0);try{let t=await ue.searchEvents(e,r?.conversation_url??null,r?.session_api_key??null,{limit:50,sortOrder:`TIMESTAMP_DESC`,timestampLt:i});if(!Array.isArray(t.items))throw Error(`Invalid older-events response: expected page.items to be an array.`);let n=[...t.items].reverse();n.length>0&&o(n),(!t.next_page_id||t.items.length<50)&&(f.current=!1,u(!1))}finally{d.current=!1,c(!1)}},[e,r,r?.conversation_url,r?.session_api_key,o])}};function dr(){return(0,$.jsxs)(`div`,{className:`flex items-center space-x-1.5 rounded-full bg-[var(--oh-surface)] px-3 py-1.5`,children:[(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:0ms]`}),(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:75ms]`}),(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:150ms]`})]})}function fr({suggestion:e,onClick:t}){let{t:n}=v(`openhands`);return(0,$.jsxs)(`button`,{type:`button`,className:`list-none border border-[var(--oh-border)] rounded-[15px] hover:bg-surface-raised hover:border-[var(--oh-interactive-hover)] transition-colors flex-1 flex items-center justify-center cursor-pointer gap-[10px] h-[55px] px-4`,onClick:()=>t(e.value),children:[(0,Q.useMemo)(()=>{switch(e.label){case`INCREASE_TEST_COVERAGE`:return(0,$.jsx)(qt,{width:24,height:24,color:`#fff`});case`AUTO_MERGE_PRS`:return(0,$.jsx)(Mt,{width:19,height:20,color:`#fff`});case`FIX_README`:return(0,$.jsx)(Jt,{width:24,height:24,color:`#fff`});case`CLEAN_DEPENDENCIES`:return(0,$.jsx)(Gt,{width:24,height:24,color:`#fff`});default:return null}},[e]),(0,$.jsx)(`span`,{"data-testid":`suggestion`,className:`text-[15px] font-normal leading-5 text-white text-center cursor-pointer`,children:n(e.label)})]})}function pr({suggestions:e,onSuggestionClick:t}){return(0,$.jsx)(`div`,{"data-testid":`suggestions`,className:`grid grid-cols-2 gap-5 max-w-fit`,children:e.map((e,n)=>(0,$.jsx)(fr,{suggestion:e,onClick:t},n))})}var mr=h.SUGGESTIONS$HACKER_NEWS,hr=`Please write a bash script which displays the top story on Hacker News. It should show the title, the link, and the number of points.
5
5
  The script should only use tools that are widely available on unix systems, like curl and grep.`,gr=h.SUGGESTIONS$HELLO_WORLD,_r=`I want to create a Hello World app in Javascript that:
@@ -16,4 +16,4 @@ The script should only use tools that are widely available on unix systems, like
16
16
 
17
17
  This should be a client-only app with no backend. The list should persist in localStorage.`,br={repo:At,"non-repo":{[mr]:hr,[gr]:_r,[vr]:yr}};function xr({onSuggestionsClick:e}){let{t}=v(`openhands`),{shouldHideSuggestions:n}=K();return(0,$.jsx)(We,{children:!n&&(0,$.jsxs)(oe.div,{"data-testid":`chat-suggestions`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:`easeInOut`},className:`pointer-events-auto absolute inset-x-4 bottom-[151px] top-0 flex flex-col items-center justify-center md:inset-x-8`,children:[(0,$.jsx)(`div`,{className:`flex flex-col items-center p-4 rounded-xl w-full`,children:(0,$.jsx)(`span`,{className:`pb-6 text-[32px] font-medium leading-5 text-white`,children:t(h.LANDING$TITLE)})}),(0,$.jsx)(pr,{suggestions:Object.entries(br.repo).slice(0,4).map(([e,t])=>({label:e,value:t})),onSuggestionClick:e})]})})}var Sr={files:[],initialPrompt:null,selectedRepository:null,selectedRepositoryProvider:null,replayJson:null},Cr=et(e=>({...Sr,addFile:t=>e(e=>({files:[...e.files,t]})),removeFile:t=>e(e=>({files:e.files.filter((e,n)=>n!==t)})),clearFiles:()=>e(()=>({files:[]})),setInitialPrompt:t=>e(()=>({initialPrompt:t})),clearInitialPrompt:()=>e(()=>({initialPrompt:null})),setSelectedRepository:t=>e(()=>({selectedRepository:t})),clearSelectedRepository:()=>e(()=>({selectedRepository:null})),setSelectedRepositoryProvider:t=>e(()=>({selectedRepositoryProvider:t})),setReplayJson:t=>e(()=>({replayJson:t})),reset:()=>e(()=>Sr)})),wr=e=>(0,$.jsx)(`svg`,{width:12,height:17,viewBox:`0 0 12 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.5304 6.46978L10.4697 7.53044L6.75006 3.81077L6.75006 17.0001H5.25006L5.25006 3.81077L1.53039 7.53044L0.469727 6.46978L6.00006 0.939453L11.5304 6.46978Z`,fill:`currentColor`})});function Tr({onClick:e}){return(0,$.jsx)(`button`,{type:`button`,onClick:e,"data-testid":`scroll-to-bottom`,className:`flex items-center justify-center size-8 rounded-full bg-[var(--oh-surface)] text-[var(--oh-muted)] hover:bg-tertiary hover:text-white rotate-180 cursor-pointer transition-colors`,children:(0,$.jsx)(wr,{width:15,height:15})})}var Er=[{width:`w-[25%]`,height:`h-4`,align:`justify-end`},{width:`w-[60%]`,height:`h-4`,align:`justify-start`},{width:`w-[45%]`,height:`h-4`,align:`justify-start`},{width:`w-[65%]`,height:`h-20`,align:`justify-start`},{width:`w-[35%]`,height:`h-4`,align:`justify-end`},{width:`w-[50%]`,height:`h-4`,align:`justify-start`},{width:`w-[30%]`,height:`h-4`,align:`justify-end`},{width:`w-[75%]`,height:`h-4`,align:`justify-start`},{width:`w-[55%]`,height:`h-4`,align:`justify-start`}];function Dr({width:e,height:t}){return(0,$.jsx)(`div`,{className:W(`rounded-md bg-foreground/5 animate-pulse`,e,t)})}function Or(){return(0,$.jsx)(`div`,{className:`flex flex-col gap-6 p-4 w-full h-full overflow-hidden`,"data-testid":`chat-messages-skeleton`,"aria-label":`Loading conversation`,children:Er.map((e,t)=>(0,$.jsx)(`div`,{className:W(`flex w-full`,e.align),children:(0,$.jsx)(Dr,{width:e.width,height:e.height})},t))})}var kr=220;function Ar({message:e,onDismiss:t,onRetry:n}){let{t:r,i18n:i}=v(`openhands`),[a,o]=Q.useState(!1),[s,c]=Q.useState(!1),l=Q.useRef(null),u=i.exists(e,{ns:`openhands`}),d=u?String(r(e)):e,f=d.length>kr,p=f&&!a;return Q.useLayoutEffect(()=>{let e=l.current;if(!e)return;let t=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(t)||t<=0){c(!1);return}c(e.getBoundingClientRect().height>t*1.5)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[d,p,a,e]),(0,$.jsxs)(`div`,{className:W(`flex w-full gap-2 rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface-raised)] p-2 text-[var(--oh-foreground)]`,s?`items-start`:`items-center`),"data-testid":`error-message-banner`,children:[(0,$.jsx)(B,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:ye},"data-testid":`error-message-banner-icon`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{ref:l,className:W(`whitespace-pre-wrap break-words text-sm text-[var(--oh-muted)]`,p&&`line-clamp-3`),"data-testid":`error-message-banner-content`,children:u?(0,$.jsx)(_,{ns:`openhands`,i18nKey:e}):e}),f&&(0,$.jsx)(`button`,{type:`button`,className:`mt-1 cursor-pointer text-xs font-normal text-[var(--oh-foreground)] underline`,onClick:()=>o(e=>!e),"data-testid":`error-message-banner-toggle`,children:r(a?h.COMMON$VIEW_LESS:h.COMMON$VIEW_MORE)})]}),(0,$.jsxs)(`div`,{className:W(`flex shrink-0 gap-1`,s?`self-start`:`items-center`),children:[n&&(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`error-message-banner-retry`,children:r(h.CHAT_INTERFACE$MESSAGE_RETRY)}),t&&(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 cursor-pointer rounded-md p-1 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-[var(--oh-foreground)]`,"aria-label":r(h.BUTTON$CLOSE),"data-testid":`error-message-banner-dismiss`,children:(0,$.jsx)(_e,{className:`h-4 w-4`,"aria-hidden":!0})})]})]})}function jr(){let{conversationId:e}=Yt(),t=H(e=>e.pendingMessages),n=H(e=>e.markPendingMessageError),r=H(e=>e.markPendingMessageSending),i=H(e=>e.removePendingMessage),a=K(e=>e.restoreMessageToInputIfEmpty),{send:o}=x(),s=Q.useMemo(()=>e?t.filter(t=>zt(e,t.conversationId)):[],[t,e]),c=Q.useCallback(async e=>{let t=H.getState().pendingMessages.find(t=>t.id===e);if(t){r(e);try{await o(O(t.text,t.imageUrls,t.fileUrls,t.timestamp))}catch(t){n(e,t instanceof Error?t.message:`Failed to send message`)}}},[o,n,r]),l=Q.useCallback((e,t)=>{a(t),i(e)},[a,i]);return s.length===0?null:(0,$.jsx)($.Fragment,{children:s.map(e=>(0,$.jsx)(E,{type:`user`,message:e.text,pendingStatus:e.status,onRetry:e.status===`error`?()=>c(e.id):void 0,onStop:e.status===`sending`?()=>l(e.id,e.text):void 0,children:e.imageUrls.length>0&&(0,$.jsx)(T,{size:`small`,images:e.imageUrls})},e.id))})}var Mr=()=>{let{data:e}=X();return p({mutationKey:[`unified-upload-files`],mutationFn:async t=>{let{conversationId:n,files:r}=t;return dt(n,r,e)},meta:{disableToast:!0}})},Nr=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3.25C9.92893 3.25 8.25 4.92893 8.25 7V10H7C6.44772 10 6 10.4477 6 11V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V11C18 10.4477 17.5523 10 17 10H15.75V7C15.75 4.92893 14.0711 3.25 12 3.25ZM14.25 10V7C14.25 5.75736 13.2426 4.75 12 4.75C10.7574 4.75 9.75 5.75736 9.75 7V10H14.25Z`,fill:`currentColor`})});function Pr(){let{t:e}=v(`openhands`),{data:t}=ct();return t?.confirmation_mode?(0,$.jsx)(Ge,{closeDelay:100,content:e(h.COMMON$CONFIRMATION_MODE_ENABLED),tooltipClassName:`bg-white text-black hover:bg-transparent`,children:(0,$.jsx)(`div`,{className:`flex items-center justify-center w-[26px] h-[26px] rounded-lg bg-[var(--oh-surface)]`,children:(0,$.jsx)(Nr,{width:15,height:15})})}):null}var Fr=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{d:`M15 12C15 12.7956 14.6839 13.5587 14.1213 14.1213C13.5587 14.6839 12.7956 15 12 15C11.2044 15 10.4413 14.6839 9.87868 14.1213C9.31607 13.5587 9 12.7956 9 12C9 11.2044 9.31607 10.4413 9.87868 9.87868C10.4413 9.31607 11.2044 9 12 9C12.7956 9 13.5587 9.31607 14.1213 9.87868C14.6839 10.4413 15 11.2044 15 12Z`,fill:`currentColor`})});function Ir({status:e,statusColor:t}){return(0,$.jsx)(`div`,{"data-testid":`chat-status-indicator`,className:Ue(`w-full max-w-full rounded-[100px] p-1 bg-[var(--oh-surface)] flex items-center gap-1`),children:(0,$.jsxs)(We,{mode:`wait`,children:[(0,$.jsx)(oe.span,{className:`flex-shrink-0 animate-[pulse_1.2s_ease-in-out_infinite]`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},children:(0,$.jsx)(Fr,{className:`w-4 h-4`,color:t})},`dot-${e}`),(0,$.jsx)(oe.span,{initial:{opacity:0,y:-2},animate:{opacity:1,y:0},exit:{opacity:0,y:2},transition:{duration:.3},className:`pr-1.5 font-normal text-[11px] leading-[16px] normal-case break-words whitespace-normal`,children:e},`text-${e}`)]})})}var Lr=()=>{let e=g(),{navigate:t}=He(),{t:n}=v(`openhands`),{data:r}=X();return p({mutationFn:async()=>{if(!r?.id)throw Error(`No active conversation`);let e=await Ie.createConversation(void 0,void 0,void 0,void 0,void 0,void 0,void 0,r.sandbox_id??void 0);if(e.status===`ERROR`)throw Error(e.detail||`Failed to create new conversation`);return{newConversationId:e.app_conversation_id?e.app_conversation_id:`task-${e.id}`,oldConversationId:r.id}},onMutate:()=>{R.loading(n(h.CONVERSATION$CLEARING),{...ie,id:`clear-conversation`})},onSuccess:r=>{R.dismiss(`clear-conversation`),re(n(h.CONVERSATION$CLEAR_SUCCESS)),t(`/conversations/${r.newConversationId}`),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`v1-batch-get-app-conversations`]})},onError:e=>{R.dismiss(`clear-conversation`);let t=n(h.CONVERSATION$CLEAR_UNKNOWN_ERROR);e instanceof Error?t=e.message:typeof e==`string`&&(t=e),z(n(h.CONVERSATION$CLEAR_FAILED,{error:t}))}})};function Rr(e,t){return e?`github`:t?`replay`:`direct`}function zr(){let e=Ne(),{setMessageToSend:t}=K(),{errorMessage:n,removeErrorMessage:r,setErrorMessage:i}=le(),{isTask:a,taskStatus:o,taskDetail:s}=Et(),c=a,l=fe(),{send:u}=x(),{renderableEvents:d,allConversationEvents:f,totalEvents:p,hasSubstantiveAgentActions:m,userEventsExist:g}=cr(),_=H(e=>e.enqueuePendingMessage),S=H(e=>e.markPendingMessageError),C=H(e=>e.pendingMessages),{t:w}=v(`openhands`),T=Q.useRef(null),{scrollDomToBottom:E,onChatBodyScroll:D,hitBottom:k,autoScroll:A,setAutoScroll:ne,setHitBottom:j}=sn(T),{mutate:M,isPending:N}=Lr(),{curAgentState:P}=Z(),{handleBuildPlanClick:F}=y(),{data:I}=X(),L=I?.sandbox_status??null,R=L===`MISSING`||L===`ERROR`,B=P===U.RUNNING||P===U.LOADING;Q.useEffect(()=>{if(B)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),F(e),E())};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[B,F,E]);let{selectedRepository:re,replayJson:ie}=Cr(),{conversationId:V}=Yt(),{mutateAsync:ae}=Mr(),{isLoading:oe,hasMore:se,loadOlder:ce}=ur(V),ue=Q.useRef(null),de=Q.useCallback(e=>{if(c||oe||!se)return;let t=e.scrollTop<=80,n=e.scrollHeight<=e.clientHeight+80;!t&&!n||(ue.current={scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},ce().catch(e=>{ue.current=null,i(e instanceof Error&&e.message?e.message:w(h.ERROR$GENERIC))}))},[se,oe,c,ce,i,w]),pe=Q.useCallback(e=>{e.deltaY<0&&e.currentTarget.scrollTop<=0&&de(e.currentTarget)},[de]),me=Q.useMemo(()=>V?C.some(e=>zt(V,e.conversationId)):!1,[C,V]),he=f.length>0||me||!l?.isLoadingHistory,_e=!!V,ve=!he&&!a,ye=ge(e=>V?(e.entriesByConversation[V]?.length??0)>0:!1),be=async(n,r,i)=>{if(n.trim()===`/new`){if(!V){z(w(h.CONVERSATION$CLEAR_NO_ID));return}if(p===0){z(w(h.CONVERSATION$CLEAR_EMPTY));return}if(N)return;M();return}let a=[...r],o=[...i];p===0?e.capture(`initial_query_submitted`,{entry_point:Rr(re!==null,ie!==null),query_character_length:n.length,replay_json_size:ie?.length}):e.capture(`user_message_sent`,{session_message_count:p,current_message_length:n.length});let s=Rt([...a,...o]);if(!s.isValid){z(`Error: ${s.errorMessage}`);return}let c=a.map(e=>Tt(e)),l=await Promise.all(c),d=new Date().toISOString(),{skipped_files:f,uploaded_files:m}=o.length>0?await ae({conversationId:V,files:o}):{skipped_files:[],uploaded_files:[]};f.forEach(e=>z(e.reason));let g=`${w(`CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE`)}: ${m.join(`
18
18
 
19
- `)}`,v=m.length>0?`${n}\n\n${g}`:n,y=_({conversationId:V,text:n,content:v,imageUrls:l,fileUrls:m,timestamp:d});E(),t(``);try{await u(O(v,l,m,d))}catch(e){S(y,e instanceof Error?e.message:`Failed to send message`)}};Q.useEffect(()=>{if(ue.current&&T.current){let{scrollHeight:e,scrollTop:t}=ue.current,n=T.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),ue.current=null;return}A&&E()},[d.length,me,E]);let xe=Q.useRef(de);Q.useEffect(()=>{xe.current=de}),Q.useEffect(()=>{let e=T.current;e&&xe.current(e)},[d.length,se]);let Se={scrollRef:T,autoScroll:A,setAutoScroll:ne,scrollDomToBottom:E,hitBottom:k,setHitBottom:j,onChatBodyScroll:D},we=P===U.LOADING||P===U.INIT,Te=P===U.STOPPED,Ee=P===U.PAUSED,W=De({isPausing:Ee,isTask:a,taskStatus:o,isStartingStatus:we,isStopStatus:Te,curAgentState:P}),Oe=Ce({isPausing:Ee,isTask:a,taskStatus:o,taskDetail:s,isStartingStatus:we,isStopStatus:Te,curAgentState:P,errorMessage:n,t:w});return(0,$.jsx)(ee,{value:Se,children:(0,$.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!m&&!me&&!g&&!ye&&!ve&&!c&&p===0&&!R&&(0,$.jsx)(xr,{onSuggestionsClick:e=>t(e)}),(0,$.jsxs)(`div`,{ref:T,"data-testid":`chat-scroll-container`,onScroll:e=>{D(e.currentTarget),de(e.currentTarget)},onWheel:pe,className:`custom-scrollbar-always flex min-h-0 grow flex-col gap-2 overflow-x-hidden overflow-y-auto px-0 pt-4 pb-8 md:px-4`,children:[ve&&_e&&(0,$.jsx)(Or,{}),ve&&!_e&&(0,$.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,$.jsx)(Ve,{size:`small`})}),oe&&(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-3 text-sm text-neutral-400`,"data-testid":`loading-older-events`,children:[(0,$.jsx)(Ve,{size:`small`}),(0,$.jsx)(`span`,{children:w(h.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,$.jsx)(b,{conversationId:V,anchorEventId:null}),he&&d.length>0&&(0,$.jsx)(te,{messages:d,allEvents:f}),(0,$.jsx)(jr,{})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px]`,children:[(0,$.jsx)(Nn,{conversationId:V}),n&&(0,$.jsx)(Ar,{message:n,onDismiss:r,onRetry:n===`Unable to connect to server`?()=>l?.reconnect():void 0}),R?(0,$.jsxs)(`div`,{"data-testid":`archived-conversation-banner`,className:`mx-1 px-4 py-3 rounded-lg bg-[var(--oh-surface)] border border-[var(--oh-border-subtle)]`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-[var(--oh-foreground)]`,children:w(L===`ERROR`?h.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:h.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,$.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:w(L===`ERROR`?h.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:h.CHAT_INTERFACE$ARCHIVED_SANDBOX_DESCRIPTION)})]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full mb-1 z-20`,children:(0,$.jsxs)(`div`,{className:`flex justify-between relative`,children:[(0,$.jsxs)(`div`,{className:`flex items-end gap-1 pointer-events-auto`,children:[(0,$.jsx)(Pr,{}),we&&(0,$.jsx)(Ir,{statusColor:W,status:Oe})]}),k?P===U.RUNNING&&(0,$.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,$.jsx)(dr,{})}):(0,$.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,$.jsx)(Tr,{onClick:E})})]})}),(0,$.jsx)(sr,{onSubmit:be,disabled:N})]})]})]})})}function Br({isRightPanelShown:e}){return(0,$.jsx)(`div`,{className:`flex justify-center w-full h-full`,children:(0,$.jsx)(`div`,{className:`w-full min-w-0 max-w-[800px] h-full flex flex-col min-h-0 transition-all duration-300 ease-in-out`,children:(0,$.jsx)(zr,{})})})}function Vr({className:e}){let{t}=v(`openhands`);return(0,$.jsxs)(`div`,{className:W(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,$.jsx)(de,{className:`h-8 w-8 shrink-0 animate-spin text-[var(--oh-text-secondary)]`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-base font-normal leading-5 text-[var(--oh-text-secondary)]`,children:t(h.HOME$LOADING)})]})}function Hr({children:e}){return(0,$.jsx)(`div`,{className:`absolute inset-0`,children:e})}function Ur({children:e}){return(0,$.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function Wr({children:e}){return(0,$.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}var Gr=(0,Q.lazy)(()=>n(()=>import(`./files-tab-cL668j1I.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]))),Kr=(0,Q.lazy)(()=>n(()=>import(`./browser-tab-dvSPdvkm.js`),__vite__mapDeps([60,18,1,23,24,4,61,3,34,35,36,19,62,33]))),qr=(0,Q.lazy)(()=>n(()=>import(`./vscode-tab-DgepcYtF.js`),__vite__mapDeps([63,1,18,23,24,4,64,7,8,5,6,9,10,11,12,13,14,15,16,17,19,20,21,22,43,40,41,42,44,45,48,35,36,46,47,33,65,66,34,67]))),Jr=(0,Q.lazy)(()=>n(()=>import(`./planner-tab-CmIjLz7q.js`),__vite__mapDeps([68,1,18,23,24,4,34,35,36,19,37,29,27,28,30,31,25,3,26,32,38,39,69,67,70,71,72,73,74,75,7,8,5,6,9,10,11,12,13,14,15,16,17,76,21,77,22,78,79,80,20,40,41,81,42,43,44,45,82,83,33,57,84]))),Yr=(0,Q.lazy)(()=>n(()=>import(`./task-list-tab-DT6_zfUs.js`),__vite__mapDeps([85,1,18,23,24,4,34,35,36,19,86,54,33,87,88,55,56]))),Xr=(0,Q.lazy)(()=>n(()=>import(`./terminal-CDhQGDua.js`),__vite__mapDeps([89,1,90,91,18,4,66,23,24,35,36,19,46,42,43,5,6,7,8,9,10,11,12,13,14,15,16,17,44,45,20,21,22,40,41,47,33,92]))),Zr={tasklist:{component:Yr},files:{component:Gr},browser:{component:Kr},vscode:{component:qr},terminal:{component:Xr},planner:{component:Jr}};function Qr(){let{selectedTab:e,shouldShownAgentLoading:t}=K(),{conversationId:n}=Y(),r=(0,Q.useMemo)(()=>Zr[e]??Zr.files,[e]).component;return t?(0,$.jsx)(Vr,{}):(0,$.jsx)(Ur,{children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Vr,{}),children:(0,$.jsx)(Wr,{children:(0,$.jsx)(Hr,{children:(0,$.jsx)(r,{})},e===`terminal`?`${e}-${n}`:e)})})})}var $r=()=>{let e=g(),t=le(e=>e.removeErrorMessage);return p({mutationKey:[`start-conversation`],mutationFn:async e=>f(e.conversationId),onMutate:async()=>(await e.cancelQueries({queryKey:[`user`,`conversations`]}),{previousConversations:e.getQueryData([`user`,`conversations`])}),onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:(t,n,r)=>{u(e,r.conversationId)},onSuccess:(n,r)=>{t(),l(e,r.conversationId,je.RUNNING)}})},ei=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM10 9H14A1 1 0 0 1 15 10V14A1 1 0 0 1 14 15H10A1 1 0 0 1 9 14V10A1 1 0 0 1 10 9Z`,fill:`currentColor`})}),ti=e=>(0,$.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.9 1.50004C15.3 1.65004 17.55 2.85004 19.2 4.50004C21.15 6.60004 22.2 9.15004 22.2 12.15C22.2 14.55 21.3 16.8 19.8 18.75C18.3 20.55 16.2 21.9 13.8 22.35C11.4 22.8 9 22.5 6.9 21.3C4.8 20.1 3.15 18.3 2.25 16.05C1.35 13.8 1.2 11.25 1.95 9.00004C2.7 6.60004 4.05 4.65004 6.15 3.30004C8.1 1.95004 10.5 1.35004 12.9 1.50004ZM13.65 20.85C15.6 20.4 17.4 19.35 18.75 17.7C19.95 16.05 20.7 14.1 20.55 12C20.55 9.60004 19.65 7.20004 18 5.55004C16.5 4.05004 14.7 3.15004 12.6 3.00004C10.65 2.85004 8.55 3.30004 6.9 4.50004C5.25 5.70004 4.05 7.35004 3.45 9.45004C2.85 11.4 2.85 13.5 3.75 15.45C4.65 17.4 6 18.9 7.8 19.95C9.6 21 11.7 21.3 13.65 20.85Z`,fill:`currentColor`}),(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 7.49998L10.1655 6.87598L16.9155 11.376V12.624L10.1655 17.124L9 16.5V7.49998ZM10.5 8.90098V15.099L15.1485 12L10.5 8.90098Z`,fill:`currentColor`})]});function ni({icon:e,text:t,onClick:n,testId:r}){return(0,$.jsx)(q,{testId:r,onClick:n,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 w-full items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,$.jsx)(`span`,{className:qe,"aria-hidden":!0,children:e})]})})}function ri({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=Z(),{isTask:i,taskStatus:a,taskDetail:o}=Et(),{t:s}=v(`openhands`),{errorMessage:c}=le(),l=r===U.LOADING||r===U.INIT,u=xe(t)||ke(t),d=De({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=Ce({isPausing:n,isTask:i,taskStatus:a,taskDetail:o,isStartingStatus:l,isStopStatus:u,curAgentState:r,errorMessage:c,t:s});return(0,$.jsx)(`div`,{className:e,"data-testid":`server-status`,children:(0,$.jsxs)(`div`,{className:`flex items-center`,children:[(0,$.jsx)(Fr,{className:`w-6 h-6 shrink-0`,color:d}),(0,$.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function ii({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=v(`openhands`),c=st(e),l=Ae(r),u=ke(r),d=l||u;return(0,$.jsxs)(pt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:W(`left-2 w-fit min-w-42`,a),children:[(0,$.jsx)(ri,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Je,{inset:`menu`}),l&&t&&(0,$.jsx)(ni,{icon:(0,$.jsx)(ei,{width:18,height:18}),text:s(h.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,$.jsx)(ni,{icon:(0,$.jsx)(ti,{width:18,height:18}),text:s(h.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var ai=e(s(),1);function oi({isPublic:e,onToggle:t,ariaLabel:n}){return(0,$.jsxs)(`label`,{className:`relative inline-flex shrink-0 cursor-pointer items-center`,children:[(0,$.jsx)(`input`,{hidden:!0,type:`checkbox`,"data-testid":`share-publicly-button`,checked:e,"aria-label":n,onChange:e=>t(e.target.checked)}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:W(`inline-flex h-3.5 w-7 items-center rounded-full px-0.5 py-px transition-colors duration-200 ease-in-out`,e?`bg-white`:`bg-base-secondary`),children:(0,$.jsx)(`span`,{className:W(`block h-2 w-2 shrink-0 rounded-full transition-transform duration-200 ease-in-out`,e?`translate-x-[calc(1rem-1px)] bg-base-secondary`:`translate-x-px bg-tertiary-light`)})})]})}function si({onClose:e,onRename:t,onDelete:n,onStop:r,onDisplayCost:i,onShowAgentTools:a,onShowSkills:o,onShowHooks:s,onTogglePublic:c,onCopyShareLink:l,onDownloadConversation:u,shareUrl:d,position:f=`bottom`,anchorRef:p}){let m=cn(),{t:g}=v(`openhands`),{backend:_}=G(),{data:y}=X(),b=st(e),x=p?.current??null,[S,C]=Q.useState();Q.useLayoutEffect(()=>{if(!x)return;let e=()=>{let e=x.getBoundingClientRect();if(!e)return;let t={position:`fixed`,zIndex:9999};f===`top`?t.bottom=window.innerHeight-e.top+8:t.top=e.bottom+8,t.left=e.left,C(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[x,f]);let w=!!(a||o||s),T=!!i,ee=!!(r||n),E=_.kind===`cloud`?h.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:h.COMMON$STOP_CONVERSATION,D=_.kind===`cloud`&&!!c,te=y?.public||!1,O=!!x,A=(0,$.jsxs)(pt,{ref:b,testId:`conversation-name-context-menu`,position:f,alignment:`left`,className:W(m?`right-0 translate-x-[34%] left-auto`:``,O?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,$.jsx)(q,{testId:`rename-button`,onClick:t,children:(0,$.jsx)(J,{icon:(0,$.jsx)(gt,{width:16,height:16}),text:g(h.BUTTON$RENAME)})}),w&&(0,$.jsx)(Je,{testId:`separator-tools`,inset:`menu`}),o&&(0,$.jsx)(q,{testId:`show-skills-button`,onClick:o,children:(0,$.jsx)(J,{icon:(0,$.jsx)(_t,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:g(h.CONVERSATION$SHOW_SKILLS)})}),s&&(0,$.jsx)(q,{testId:`show-hooks-button`,onClick:s,children:(0,$.jsx)(J,{icon:(0,$.jsx)(kt,{width:16,height:16,"aria-hidden":!0}),text:g(h.CONVERSATION$SHOW_HOOKS)})}),a&&(0,$.jsx)(q,{testId:`show-agent-tools-button`,onClick:a,children:(0,$.jsx)(J,{icon:(0,$.jsx)(Xe,{width:16,height:16}),text:g(h.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})}),u&&(0,$.jsx)(q,{testId:`download-trajectory-button`,onClick:u,children:(0,$.jsx)(J,{icon:(0,$.jsx)(k,{width:16,height:16}),text:g(h.BUTTON$EXPORT_CONVERSATION)})}),(T||ee)&&(0,$.jsx)(Je,{testId:`separator-info-control`,inset:`menu`}),i&&(0,$.jsx)(q,{testId:`display-cost-button`,onClick:i,children:(0,$.jsx)(J,{icon:(0,$.jsx)(F,{width:16,height:16}),text:g(h.BUTTON$DISPLAY_COST)})}),D&&c&&(0,$.jsxs)(`li`,{className:`flex w-full items-center gap-2 rounded px-2 py-2 hover:bg-[var(--oh-interactive-hover)]`,children:[(0,$.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)]`,"aria-hidden":!0,children:(0,$.jsx)(V,{size:16})}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:g(h.CONVERSATION$SHARE_PUBLICLY)}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[te&&d&&l&&(0,$.jsxs)(`div`,{className:`mr-2 flex items-center gap-0.5`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`copy-share-link-button`,onClick:l,className:`rounded p-0.5 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(h.BUTTON$COPY_TO_CLIPBOARD),children:(0,$.jsx)(an,{width:14,height:14})}),(0,$.jsx)(`a`,{"data-testid":`open-share-link-button`,href:d,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`rounded p-0.5 text-[var(--oh-muted)] no-underline visited:text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(h.BUTTON$OPEN_IN_NEW_TAB),children:(0,$.jsx)(ae,{size:14,"aria-hidden":!0})})]}),(0,$.jsx)(oi,{isPublic:te,onToggle:c,ariaLabel:g(h.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,$.jsx)(q,{testId:`stop-button`,onClick:r,children:(0,$.jsx)(J,{icon:(0,$.jsx)(Qe,{width:16,height:16}),text:g(E)})}),n&&(0,$.jsx)(q,{testId:`delete-button`,onClick:n,children:(0,$.jsx)(J,{icon:(0,$.jsx)(mt,{width:16,height:16}),text:g(h.COMMON$DELETE_CONVERSATION)})})]});return O?typeof document>`u`||!S?null:ai.createPortal((0,$.jsx)(`div`,{style:S,children:A}),document.body):A}function ci({onClose:e}){let{t}=v(`openhands`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(it,{onClose:e,testId:`close-metrics-modal`}),(0,$.jsx)(`div`,{className:`w-full pr-6`,children:(0,$.jsx)(ze,{title:t(h.CONVERSATION$METRICS_INFO)})})]})}function li({currentCost:e,maxBudget:t}){let n=e/t*100;return(0,$.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden mt-1`,children:(0,$.jsx)(`div`,{className:W(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function ui({currentCost:e,maxBudget:t}){let{t:n}=v(`openhands`),r=e/t*100;return(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(h.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(h.CONVERSATION$USED)})})})}function di({cost:e,maxBudgetPerTask:t}){let{t:n}=v(`openhands`);return e===null?null:(0,$.jsx)(`div`,{className:`border-b border-[var(--oh-border-subtle)]`,children:t!==null&&t>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(li,{currentCost:e,maxBudget:t}),(0,$.jsx)(ui,{currentCost:e,maxBudget:t})]}):(0,$.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(h.CONVERSATION$NO_BUDGET_LIMIT)})})}function fi({cost:e,maxBudgetPerTask:t}){let{t:n}=v(`openhands`);return e===null?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center pb-2`,children:[(0,$.jsx)(`span`,{className:`text-lg font-semibold`,children:n(h.CONVERSATION$TOTAL_COST)}),(0,$.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,$.jsx)(di,{cost:e,maxBudgetPerTask:t})]})}function pi({label:e,value:t,labelClassName:n=``,valueClassName:r=`font-semibold`}){return(0,$.jsxs)(`div`,{className:`flex justify-between items-center border-b border-[var(--oh-border-subtle)] pb-2`,children:[(0,$.jsx)(`span`,{className:n,children:e}),(0,$.jsx)(`span`,{className:r,children:t})]})}function mi({usage:e}){let{t}=v(`openhands`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pi,{label:t(h.CONVERSATION$INPUT),value:e.prompt_tokens.toLocaleString()}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pl-4 text-sm`,children:[(0,$.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(h.CONVERSATION$CACHE_HIT)}),(0,$.jsx)(`span`,{className:`text-right`,children:e.cache_read_tokens.toLocaleString()}),(0,$.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(h.CONVERSATION$CACHE_WRITE)}),(0,$.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,$.jsx)(pi,{label:t(h.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,$.jsx)(pi,{label:t(h.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function hi({perTurnToken:e,contextWindow:t}){let{t:n}=v(`openhands`),r=t>0?e/t*100:0,i=Math.min(100,r);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,$.jsx)(`span`,{className:`font-semibold`,children:n(h.CONVERSATION$CONTEXT_WINDOW)})}),(0,$.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full bg-foreground transition-all duration-300`,style:{width:`${i}%`}})}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsxs)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` (`,r.toFixed(2),`% `,n(h.CONVERSATION$USED),`)`]})})]})}function gi(){let{t:e}=v(`openhands`);return(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(h.CONVERSATION$NO_METRICS)})})}function _i(e){let{stats:t}=e;if(!t?.usage_to_metrics)return{accumulated_cost:0,max_budget_per_task:null,accumulated_token_usage:null};let n=0,r=null,i=null;for(let e of Object.values(t.usage_to_metrics))n+=e.accumulated_cost,r===null&&e.max_budget_per_task!==null&&(r=e.max_budget_per_task),e.accumulated_token_usage&&(i=i===null?{...e.accumulated_token_usage}:{prompt_tokens:i.prompt_tokens+e.accumulated_token_usage.prompt_tokens,completion_tokens:i.completion_tokens+e.accumulated_token_usage.completion_tokens,cache_read_tokens:i.cache_read_tokens+e.accumulated_token_usage.cache_read_tokens,cache_write_tokens:i.cache_write_tokens+e.accumulated_token_usage.cache_write_tokens,context_window:Math.max(i.context_window,e.accumulated_token_usage.context_window),per_turn_token:Math.max(i.per_turn_token,e.accumulated_token_usage.per_turn_token)});return{accumulated_cost:n,max_budget_per_task:r,accumulated_token_usage:i}}var vi=(e,t,n,r=!0)=>{let i=c({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return _i(await Ie.getRuntimeConversation(e,t,n))},enabled:r&&!!e&&!!t,staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,retry:!1});return{data:i.data,isLoading:i.isLoading,error:i.error}};function yi({isOpen:e,onOpenChange:t}){let n=ce(),{data:r}=X(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=vi(i,a,o,e),c=(0,Q.useMemo)(()=>s?{cost:s.accumulated_cost,max_budget_per_task:s.max_budget_per_task,usage:s.accumulated_token_usage?{prompt_tokens:s.accumulated_token_usage.prompt_tokens??0,completion_tokens:s.accumulated_token_usage.completion_tokens??0,cache_read_tokens:s.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:s.accumulated_token_usage.cache_write_tokens??0,context_window:s.accumulated_token_usage.context_window??0,per_turn_token:s.accumulated_token_usage.per_turn_token??0}:null}:n,[s,n]);return e?(0,$.jsx)(Le,{onClose:()=>t(!1),children:(0,$.jsxs)(Re,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,$.jsx)(ci,{onClose:()=>t(!1)}),(0,$.jsxs)(`div`,{className:`w-full`,children:[(c?.cost!==null||c?.usage!==null)&&(0,$.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsx)(fi,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mi,{usage:c.usage}),(0,$.jsx)(hi,{perTurnToken:c.usage.per_turn_token,contextWindow:c.usage.context_window})]})]})}),!c?.cost&&!c?.usage&&(0,$.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,$.jsx)(gi,{})})]})]})}):null}function bi(){let{t:e}=v(`openhands`),{conversationId:t}=Y(),{data:n}=X(),{mutate:r}=M(),[i,a]=Q.useState(`view`),[o,s]=Q.useState(!1),c=Q.useRef(null),l=Q.useRef(null),{handleDelete:u,handleStop:d,handleDownloadConversation:f,handleDisplayCost:p,handleShowAgentTools:m,handleShowSkills:g,handleShowHooks:_,handleTogglePublic:y,handleCopyShareLink:b,shareUrl:x,handleConfirmDelete:S,handleConfirmStop:C,metricsModalVisible:w,setMetricsModalVisible:T,systemModalVisible:ee,setSystemModalVisible:E,skillsModalVisible:D,setSkillsModalVisible:te,hooksModalVisible:O,setHooksModalVisible:k,confirmDeleteModalVisible:ne,setConfirmDeleteModalVisible:j,confirmStopModalVisible:N,setConfirmStopModalVisible:P,systemMessage:F,shouldShowStop:I,shouldShowDownloadConversation:R,shouldShowDisplayCost:z,shouldShowAgentTools:B,shouldShowSkills:ie,shouldShowHooks:V}=Ct({conversationId:t,executionStatus:n?.execution_status,showOptions:!0,onContextMenuToggle:s});return Q.useEffect(()=>{i===`edit`&&c.current?.focus()},[i]),n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 h-[22px] text-base font-normal text-left pl-0 lg:pl-1 min-w-0`,"data-testid":`conversation-name`,children:[i===`edit`?(0,$.jsx)(`input`,{ref:c,"data-testid":`conversation-name-input`,onClick:e=>{i===`edit`&&(e.preventDefault(),e.stopPropagation())},onBlur:()=>{if(c.current?.value&&t){let i=c.current.value.trim();i!==n?.title&&r({conversationId:t,newTitle:i},{onSuccess:()=>{re(e(h.CONVERSATION$TITLE_UPDATED))}})}else c.current&&(c.current.value=n?.title??``);a(`view`)},onKeyUp:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&e.currentTarget.blur()},type:`text`,defaultValue:n.title||``,className:`text-white leading-5 bg-transparent border-none outline-none text-base font-normal w-fit max-w-fit field-sizing-content`}):(0,$.jsx)(`div`,{className:`text-white leading-5 truncate`,"data-testid":`conversation-name-title`,onDoubleClick:()=>{a(`edit`)},title:n.title||``,children:n.title}),i!==`edit`&&(0,$.jsxs)(`div`,{ref:l,className:`relative flex items-center shrink-0`,children:[(0,$.jsx)(ht,{onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o)}}),o&&(0,$.jsx)(si,{onClose:()=>s(!1),onRename:e=>{e.preventDefault(),e.stopPropagation(),a(`edit`),s(!1)},onDelete:u,onStop:I?d:void 0,onDisplayCost:z?p:void 0,onShowAgentTools:B?m:void 0,onShowSkills:ie?g:void 0,onShowHooks:V?_:void 0,onTogglePublic:y,onCopyShareLink:b,shareUrl:x,onDownloadConversation:R?f:void 0,position:`bottom`,anchorRef:l})]})]}),(0,$.jsx)(yi,{isOpen:w,onOpenChange:T}),(0,$.jsx)(Ft,{isOpen:ee,onClose:()=>E(!1),systemMessage:F||null}),D&&(0,$.jsx)(It,{onClose:()=>te(!1)}),O&&(0,$.jsx)(Bt,{onClose:()=>k(!1)}),ne&&(0,$.jsx)(A,{onConfirm:S,onCancel:()=>j(!1),conversationTitle:n?.title||``}),N&&(0,$.jsx)(L,{onConfirm:C,onCancel:()=>P(!1)})]}):null}function xi({children:e,tooltip:t,ariaLabel:n}){return(0,$.jsx)(Ge,{content:t,placement:`bottom`,tooltipClassName:`bg-white text-black text-xs font-medium leading-5`,children:(0,$.jsx)(`span`,{"data-aria-label":n,children:e})})}function Si({className:e}){let{t}=v(`openhands`),n=cn(),r=a(),{conversationId:i}=Y(),{isRightPanelShown:o,setHasRightPanelToggled:s,setIsRightPanelShown:c,setSelectedTab:l}=K(),u=()=>{if(n){if(!i)return;s(!0),c(!0);let{selectedTab:e}=K.getState();e||l(`files`),r(`/conversations/${i}/panel`);return}let e=!o;if(s(e),e){let{selectedTab:e}=K.getState();e||l(`files`)}},d=t(n?h.COMMON$SHOW_PANEL:o?h.COMMON$HIDE_PANEL:h.COMMON$SHOW_PANEL),f=n?!1:o;return(0,$.jsx)(xi,{tooltip:d,ariaLabel:d,children:(0,$.jsx)(`button`,{type:`button`,onClick:u,className:W(P,e),"aria-label":d,"aria-pressed":f,"data-testid":`right-panel-toggle`,children:(0,$.jsx)(N,{className:`w-5 h-5 -scale-x-100`})})})}function Ci(){let{conversationId:e}=Y(),{data:t}=X(),{curAgentState:n}=Z(),{isTask:r,taskStatus:i}=Et(),{mutate:a}=Ye(),{mutate:o}=$r(),{providers:s}=$e(),c=t?.execution_status??null,l=De({isPausing:!1,isTask:r,taskStatus:i,isStartingStatus:n===U.LOADING||n===U.INIT,isStopStatus:xe(c),curAgentState:n});return(0,$.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,$.jsxs)(`div`,{className:`flex items-center min-w-0`,children:[(0,$.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,$.jsx)(Fr,{className:`ml-[3.5px] w-6 h-6 cursor-pointer`,color:l}),(0,$.jsx)(ii,{onClose:()=>{},onStopServer:Ae(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&a({conversationId:e})}:void 0,onStartServer:ke(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&o({conversationId:e,providers:s})}:void 0,executionStatus:c,position:`bottom`,className:`opacity-0 invisible pointer-events-none group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto bottom-full left-0 mt-0 min-h-fit`,isPausing:!1})]}),(0,$.jsx)(bi,{})]}),(0,$.jsx)(Si,{className:`mr-2`})]})}var wi=e=>(0,$.jsxs)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,$.jsx)(`path`,{d:`M3 10.5L6.5 14L14 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,$.jsx)(`path`,{d:`M7 10.5L10.5 14L18 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`})]});function Ti({tabValue:e,icon:t,onClick:n,isActive:r,label:i,className:a,measureOnly:o}){return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{n()},...o?{}:{"data-testid":`conversation-tab-${e}`},"data-tab-measure":o?`true`:void 0,className:W(`flex items-center gap-2 rounded-md cursor-pointer`,`pl-1.5 pr-2 py-1 lg:py-1.5`,`text-[var(--oh-muted)] bg-transparent`,r&&`bg-[var(--oh-interactive-active)] text-white`,r?`hover:text-white hover:bg-[var(--oh-interactive-hover)]`:`hover:text-white hover:bg-white/5`,r?`focus-within:text-white`:`focus-within:text-[var(--oh-muted)]`,a),children:[(0,$.jsx)(t,{className:W(`w-5 h-5 text-inherit flex-shrink-0`)}),r&&i&&(0,$.jsx)(`span`,{className:`text-sm font-normal whitespace-nowrap`,children:i})]})}function Ei(){let{curAgentState:e}=Z(),{t}=v(`openhands`),{data:n,refetch:r}=dn(),i=Oe.includes(e);return(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{children:t(h.COMMON$CODE)}),i?null:(0,$.jsx)(ft,{className:`w-3 h-3 text-inherit cursor-pointer`,onClick:async e=>{e.preventDefault(),e.stopPropagation();let t=n?.url;t||=(await r()).data?.url??null,t&&window.open(t,`_blank`,`noopener,noreferrer`)}})]})}var Di=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7.13832 8.76476C8.25957 8.17949 9.52697 7.9727 10.7515 8.14436L14.9025 2.52826L21.4717 9.09737L15.8555 13.2484C16.0272 14.4729 15.8204 15.7403 15.2351 16.8616C15.1872 16.9535 15.1366 17.0444 15.0836 17.1343C14.8318 17.5605 14.5228 17.9624 14.1566 18.3286L10.4443 14.6163L4.75207 20.3085H3.69141V19.2478L9.38361 13.5556L5.6713 9.84332C6.03755 9.47708 6.43936 9.16808 6.86562 8.91632C6.95547 8.86326 7.04641 8.81274 7.13832 8.76476ZM15.0735 4.82054L19.1794 8.92641L14.2461 12.5727L14.3701 13.4567C14.492 14.3266 14.3596 15.2233 13.9758 16.0265L7.97338 10.0241C8.77665 9.64035 9.67335 9.50789 10.5432 9.62984L11.4272 9.75376L15.0735 4.82054Z`,fill:`currentColor`})}),Oi=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{d:`M10.9706 10.1586C10.2819 10.0621 9.56905 10.1784 8.93842 10.5075C8.88672 10.5345 8.83557 10.5629 8.78504 10.5928C8.54529 10.7344 8.3193 10.9082 8.11331 11.1142L9.83702 12.8372L7.00054 15.75L7 17H8.25064L11.1628 14.1632L12.8857 15.8865C13.0917 15.6805 13.2655 15.4545 13.4071 15.2147C13.437 15.1642 13.4654 15.1131 13.4924 15.0614C13.8215 14.4308 13.9378 13.718 13.8413 13.0293L17 10.6946L13.3053 7L10.9706 10.1586Z`,fill:`currentColor`})});function ki({isOpen:e,onClose:t,ignoreOutsideClickRef:n}){let r=st(t,n),{t:i}=v(`openhands`),{conversationId:a}=Y(),{state:o,setUnpinnedTabs:s,setSelectedTab:c}=rt(a),{selectedTab:l,isRightPanelShown:u,setSelectedTab:d}=K(),{navigateToTab:f}=C(),{hasTaskList:p}=fn(),{backend:m}=G(),g=[{tab:`planner`,icon:rn,i18nKey:h.COMMON$PLANNER},{tab:`files`,icon:Jt,i18nKey:h.COMMON$FILES},{tab:`vscode`,icon:un,i18nKey:h.COMMON$CODE},{tab:`terminal`,icon:vt,i18nKey:h.COMMON$TERMINAL},{tab:`browser`,icon:ln,i18nKey:h.COMMON$BROWSER}];p&&g.unshift({tab:`tasklist`,icon:wi,i18nKey:h.COMMON$TASK_LIST});let _=g.filter(({tab:e})=>e!==`vscode`&&e!==`planner`||m.kind===`cloud`);if(!e)return null;let y=e=>{f(e),t()},b=(e,t)=>{if(t.preventDefault(),t.stopPropagation(),o.unpinnedTabs.includes(e))s(o.unpinnedTabs.filter(t=>t!==e));else{let t=[...o.unpinnedTabs,e];if(s(t),l===e&&u){let n=_.find(({tab:n})=>n!==e&&!t.includes(n));n&&(d(n.tab),c(n.tab))}}};return(0,$.jsx)(pt,{ref:r,alignment:`right`,position:`bottom`,className:`z-[9999] mt-2 w-fit`,children:_.map(({tab:e,icon:t,i18nKey:n})=>{let r=!o.unpinnedTabs.includes(e);return(0,$.jsx)(`li`,{className:`list-none`,children:(0,$.jsxs)(`div`,{className:W(`group flex h-[30px] w-full min-w-0 items-stretch rounded`,`hover:bg-[var(--oh-interactive-hover)]`),children:[(0,$.jsxs)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-open-${e}`,className:W(`flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-l p-2 text-start text-white`,Ke),onClick:()=>y(e),children:[(0,$.jsx)(`span`,{className:qe,"aria-hidden":!0,children:(0,$.jsx)(t,{className:`h-4 w-4`})}),(0,$.jsx)(`span`,{className:`text-sm`,children:i(n)})]}),(0,$.jsx)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-pin-${e}`,className:W(`flex shrink-0 cursor-pointer items-center justify-center rounded-r px-2 text-white hover:bg-white/10`,Ke),"aria-pressed":r,"aria-label":r?`Unpin tab from bar`:`Pin tab to bar`,onClick:t=>b(e,t),children:r?(0,$.jsx)(`span`,{className:W(`-mr-[5px] ml-auto`,qe),"aria-hidden":!0,children:(0,$.jsx)(Oi,{className:`h-7 w-7`})}):(0,$.jsx)(`span`,{className:W(`ml-auto`,qe),"aria-hidden":!0,children:(0,$.jsx)(Di,{className:`h-4.5 w-4.5`})})})]})},e)})})}function Ai({variant:e=`default`}){let{conversationId:t}=Y(),{setSelectedTab:n,planContent:r}=K(),[i,a]=(0,Q.useState)(!1),{state:o}=rt(t),{hasTaskList:s}=fn(),{backend:c}=G(),{handleBuildPlanClick:l}=y(),{curAgentState:u}=Z(),{selectTab:d,isTabActive:f,onTabChange:p,selectedTab:m,isRightPanelShown:g}=C();(0,Q.useEffect)(()=>{n(o.selectedTab)},[n,o.selectedTab]),(0,Q.useEffect)(()=>{g&&(m||p(`files`))},[g,m,p]);let{t:_,i18n:b}=v(`openhands`),x=[{tabValue:`files`,isActive:f(`files`),icon:Jt,onClick:()=>d(`files`),tooltipContent:_(h.COMMON$FILES),tooltipAriaLabel:_(h.COMMON$FILES),label:_(h.COMMON$FILES)},{tabValue:`planner`,isActive:f(`planner`),icon:rn,onClick:()=>d(`planner`),tooltipContent:_(h.COMMON$PLANNER),tooltipAriaLabel:_(h.COMMON$PLANNER),label:_(h.COMMON$PLANNER)},{tabValue:`vscode`,isActive:f(`vscode`),icon:un,onClick:()=>d(`vscode`),tooltipContent:(0,$.jsx)(Ei,{}),tooltipAriaLabel:_(h.COMMON$CODE),label:_(h.COMMON$CODE)},{tabValue:`terminal`,isActive:f(`terminal`),icon:vt,onClick:()=>d(`terminal`),tooltipContent:_(h.COMMON$TERMINAL),tooltipAriaLabel:_(h.COMMON$TERMINAL),label:_(h.COMMON$TERMINAL),className:`pl-2`},{tabValue:`browser`,isActive:f(`browser`),icon:ln,onClick:()=>d(`browser`),tooltipContent:_(h.COMMON$BROWSER),tooltipAriaLabel:_(h.COMMON$BROWSER),label:_(h.COMMON$BROWSER)}];s&&x.splice(1,0,{tabValue:`tasklist`,isActive:f(`tasklist`),icon:wi,onClick:()=>d(`tasklist`),tooltipContent:_(h.COMMON$TASK_LIST),tooltipAriaLabel:_(h.COMMON$TASK_LIST),label:_(h.COMMON$TASK_LIST)});let S=x.filter(e=>e.tabValue===`vscode`&&c.kind!==`cloud`||e.tabValue===`planner`&&c.kind!==`cloud`?!1:o.unpinnedTabs.includes(e.tabValue)?m===e.tabValue:!0),w=o.unpinnedTabs.join(`,`),T=u===U.RUNNING||u===U.LOADING||!r,ee=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),te=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(S.length);(0,Q.useLayoutEffect)(()=>{let e=ee.current,t=E.current,n=D.current;if(!e||!t||!n)return;let r=()=>{let r=t.querySelectorAll(`[data-tab-measure="true"]`),i=r.length,a=e.getBoundingClientRect().width;if(a===0){k(i);return}let o=Array.from(r).map(e=>e.getBoundingClientRect().width);if(o.length!==i||i===0){k(Math.max(0,i));return}let s=n.getBoundingClientRect().width,c=getComputedStyle(e).columnGap||getComputedStyle(e).gap,l=parseFloat(c)||6,u=0;for(let e=i;e>=0;--e){let t=s;for(let n=0;n<e;n+=1)t+=o[n]??0;if(e>0&&(t+=e*l),t<=a+.5){u=e;break}}k(e=>e===u?e:u)};if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(e),()=>i.disconnect()},[w,S.length,s,c.kind,m,g,b.language]);let A=Math.min(O,S.length);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:W(`relative w-full min-w-0`,e===`compact`?`flex h-full min-h-0 items-center py-0 pl-0 pr-1`:`min-h-10 p-1`),children:[(0,$.jsx)(`div`,{ref:E,"aria-hidden":!0,className:`pointer-events-none absolute top-0 left-[-10000px] flex flex-nowrap items-center gap-1.5`,children:S.map(({tabValue:e,icon:t,isActive:n,tooltipContent:r,tooltipAriaLabel:i,label:a,className:o},s)=>(0,$.jsx)(xi,{tooltip:r,ariaLabel:i,children:(0,$.jsx)(Ti,{tabValue:e,icon:t,onClick:()=>{},isActive:n,label:a,className:W(o,`shrink-0`),measureOnly:!0})},`measure-${e}-${s}`))}),(0,$.jsx)(`div`,{ref:ee,className:`flex w-full min-w-0 flex-nowrap items-center justify-start`,children:(0,$.jsxs)(`div`,{className:`flex w-fit max-w-full min-w-0 flex-nowrap items-center gap-1.5`,children:[(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-nowrap items-center gap-1.5 overflow-x-hidden`,children:S.slice(0,A).map(({tabValue:e,icon:t,onClick:n,isActive:r,tooltipContent:i,tooltipAriaLabel:a,label:o,className:s},c)=>(0,$.jsx)(xi,{tooltip:i,ariaLabel:a,children:(0,$.jsx)(Ti,{tabValue:e,icon:t,onClick:n,isActive:r,label:o,className:W(s,`shrink-0`)})},`${e}-${c}`))}),(0,$.jsxs)(`div`,{ref:D,className:`relative shrink-0`,children:[(0,$.jsx)(ht,{ref:te,onClick:()=>a(!i),ariaLabel:_(h.COMMON$MORE_OPTIONS),iconClassName:e===`compact`?j:void 0}),(0,$.jsx)(ki,{isOpen:i,onClose:()=>a(!1),ignoreOutsideClickRef:te})]})]})})]}),f(`planner`)&&(0,$.jsx)(`div`,{className:W(`flex h-10 min-h-10 shrink-0 items-center border-t border-[var(--oh-border)] pl-[10px] pr-1`),children:(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:T,className:W(`flex h-5 min-w-17 items-center justify-center rounded bg-white px-2 transition-opacity`,T?`cursor-not-allowed opacity-50`:`cursor-pointer hover:opacity-90`),"data-testid":`planner-tab-build-button`,children:(0,$.jsxs)(nn.Text,{className:`text-[11px] font-normal leading-5 text-black`,children:[_(h.COMMON$BUILD),` ⌘↩`]})})})]})}function ji({onMouseDown:e,className:t,isDragging:n=!1}){let[r,i]=(0,Q.useState)(!1),a=n||r;return(0,$.jsxs)(`div`,{className:W(`relative z-10 w-0 shrink-0 self-stretch`,t),"aria-hidden":!0,children:[(0,$.jsx)(`div`,{className:`absolute inset-y-0 left-1/2 w-3 min-w-[12px] -translate-x-1/2 cursor-ew-resize`,onMouseDown:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1)}),(0,$.jsx)(`div`,{className:W(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`,a?`bg-white`:`bg-transparent`),"aria-hidden":!0})]})}var Mi=200;function Ni({defaultLeftWidth:e=50,minLeftWidth:t=30,maxLeftWidth:n=80,storageKey:r=`desktop-layout-panel-width`}={}){let[i,a]=pn(r,e),o=(0,Q.useCallback)(e=>Math.max(t,Math.min(n,e)),[t,n]),[s,c]=(0,Q.useState)(()=>o(i)),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f=(0,Q.useCallback)(e=>{e.preventDefault(),u(!0)},[]),p=(0,Q.useCallback)(e=>{if(!l||!d.current)return;let t=d.current.getBoundingClientRect();c(o((e.clientX-t.left)/t.width*100))},[l,o]),m=(0,Q.useCallback)(()=>{l&&(u(!1),a(s))},[l,s,a]);return(0,Q.useLayoutEffect)(()=>{if(!l)return;let e=document.createElement(`div`);return e.setAttribute(`aria-hidden`,`true`),e.dataset.panelDragShield=``,Object.assign(e.style,{position:`fixed`,inset:`0`,zIndex:String(Mi),cursor:`ew-resize`}),document.body.appendChild(e),document.addEventListener(`mousemove`,p),document.addEventListener(`mouseup`,m),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`,()=>{document.removeEventListener(`mousemove`,p),document.removeEventListener(`mouseup`,m),document.body.style.cursor=``,document.body.style.userSelect=``,e.remove()}},[l,p,m]),{leftWidth:s,rightWidth:100-s,isDragging:l,containerRef:d,handleMouseDown:f}}function Pi(e){return e?`translate-x-0 opacity-100`:`w-0 translate-x-full opacity-0`}function Fi(){let e=cn(),t=cn(767),{isRightPanelShown:n}=K(),{leftWidth:r,rightWidth:i,isDragging:a,containerRef:o,handleMouseDown:s}=Ni({defaultLeftWidth:50,minLeftWidth:30,maxLeftWidth:80,storageKey:`desktop-layout-panel-width`});return(0,$.jsx)(`div`,{className:W(e?`relative min-h-0 flex-1 flex flex-col`:`h-full flex flex-col overflow-hidden`),children:(0,$.jsxs)(`div`,{ref:o,className:W(`flex flex-1 overflow-hidden`,e?`flex-col`:`transition-all duration-300 ease-in-out`),style:e?void 0:{transitionProperty:a?`none`:`all`},children:[(0,$.jsxs)(`div`,{className:W(`flex flex-col bg-base overflow-hidden`,e?`flex-1`:`transition-all duration-300 ease-in-out`),style:e?void 0:{width:n?`${r}%`:`100%`,transitionProperty:a?`none`:`all`},children:[(0,$.jsxs)(`div`,{"data-testid":`chat-pane-header`,className:W(`flex h-10 min-h-10 shrink-0 items-center`,t&&`gap-2 pl-2.5`),children:[t?(0,$.jsx)(I,{}):null,(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(Ci,{})})]}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,$.jsx)(Br,{isRightPanelShown:!e&&n})})]}),!e&&n&&(0,$.jsx)(ji,{onMouseDown:s,isDragging:a}),!e&&(0,$.jsx)(`div`,{className:W(`transition-all duration-300 ease-in-out overflow-hidden`,Pi(n)),style:{width:n?`${i}%`:`0%`,transitionProperty:a?`opacity, transform`:`all`},children:(0,$.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:(0,$.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 bg-[var(--oh-surface)] border-l border-[var(--oh-border)] overflow-hidden`,children:[(0,$.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex shrink-0 flex-col border-b border-[var(--oh-border)]`,children:(0,$.jsx)(Ai,{})}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,$.jsx)(Qr,{})})]})})})]})})}function Ii({onNavigateBack:e}){let{t}=v(`openhands`),{setIsRightPanelShown:n,setHasRightPanelToggled:r,setSelectedTab:i}=K();return Q.useLayoutEffect(()=>(n(!0),r(!0),K.getState().selectedTab||i(`files`),()=>{n(!1),r(!1)}),[n,r,i]),(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[var(--oh-surface)]`,children:[(0,$.jsxs)(`div`,{"data-testid":`conversation-mobile-panel-top`,className:`flex h-10 min-h-10 shrink-0 items-center gap-1.5 border-b border-[var(--oh-border)] pl-2.5`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`conversation-mobile-panel-back`,onClick:()=>{e()},"aria-label":t(h.COMMON$BACK),className:P,children:(0,$.jsx)(ne,{size:20,className:j,"aria-hidden":!0,strokeWidth:2})}),(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 items-center self-stretch`,children:(0,$.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex h-full min-h-0 w-full min-w-0 flex-col justify-center`,children:(0,$.jsx)(Ai,{variant:`compact`})})})]}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-[var(--oh-surface)]`,children:(0,$.jsx)(Qr,{})})]})}var Li=1e3*60*5,Ri=1e3*60*15,zi=e=>{let t=e||[],n=G();return c({queryKey:[`v1`,`sub-conversations`,t,n.backend.id,n.orgId],queryFn:async()=>t.length===0?[]:Ie.batchGetAppConversations(t),enabled:t.length>0,staleTime:Li,gcTime:Ri,retry:!1})};function Bi({children:e,conversationId:t}){let{data:n}=X(),{data:r}=zi(n?.sub_conversation_ids??[]),i=r?.filter(e=>e!==null);return(0,$.jsx)(he,{conversationId:t,conversationUrl:n?.sandbox_status===`PAUSED`?null:n?.conversation_url,sessionApiKey:n?.session_api_key,subConversationIds:n?.sub_conversation_ids,subConversations:i,children:e})}function Vi(){let{t:e}=v(`openhands`),{conversationId:t}=Y(),n=r(`/conversations/:conversationId/panel`),{isTask:i,taskStatus:s,taskDetail:c}=Et(),l=G(),u=Q.useRef(l.backend.id),d=Q.useRef(l.orgId),f=u.current!==l.backend.id||d.current!==l.orgId,{data:p,isFetched:m}=X(),{data:g}=ot(),{resetConversationState:_}=K(),y=a(),b=o(),x=tn(e=>e.clearTerminal),S=bt(e=>e.reset),C=hn(e=>e.setCurrentAgentState),w=le(e=>e.removeErrorMessage);Q.useEffect(()=>{x(),_(),S(),C(U.LOADING),w()},[t,x,_,S,C,w]),Q.useEffect(()=>{if(i&&s===`ERROR`){z(c||e(h.CONVERSATION$FAILED_TO_START_FROM_TASK));let t=b.state?.resumedFromConversationId;y(t?`/conversations/${t}`:`/conversations`,{replace:!0})}},[i,s,c,e,y,b.state]),Q.useEffect(()=>{!m||!g||f||p||(xn(l.backend.id,l.orgId),z(e(h.CONVERSATION$NOT_EXIST_OR_NO_PERMISSION)),y(`/conversations`))},[p,m,g,y,e,f,l.backend.id,l.orgId]),Q.useEffect(()=>{f||t&&(t.startsWith(`task-`)||bn(l.backend.id,l.orgId,t))},[t,f,l.backend.id,l.orgId]);let T=Q.useRef(null);return Q.useEffect(()=>{!m||!p||l.backend.kind===`cloud`&&p.sandbox_status===`PAUSED`&&p.sandbox_id&&T.current!==p.id&&(T.current=p.id,Fe(p.sandbox_id).catch(()=>{z(e(h.CONVERSATION$FAILED_TO_START_FROM_TASK))}))},[m,p?.id,p?.sandbox_status,p?.sandbox_id,l.backend.kind,e]),f?null:(0,$.jsx)(Bi,{conversationId:t,children:(0,$.jsx)(Dn,{children:(0,$.jsx)(`div`,{"data-testid":`app-route`,className:`flex h-full flex-col`,children:n?(0,$.jsx)(Ii,{onNavigateBack:()=>y(`/conversations/${t}`)}):(0,$.jsx)(Fi,{})})})})}function Hi(){return(0,$.jsx)(Vi,{})}var Ui=i(Hi);export{Ui as t};
19
+ `)}`,v=m.length>0?`${n}\n\n${g}`:n,y=_({conversationId:V,text:n,content:v,imageUrls:l,fileUrls:m,timestamp:d});E(),t(``);try{await u(O(v,l,m,d))}catch(e){S(y,e instanceof Error?e.message:`Failed to send message`)}};Q.useEffect(()=>{if(ue.current&&T.current){let{scrollHeight:e,scrollTop:t}=ue.current,n=T.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),ue.current=null;return}A&&E()},[d.length,me,E]);let xe=Q.useRef(de);Q.useEffect(()=>{xe.current=de}),Q.useEffect(()=>{let e=T.current;e&&xe.current(e)},[d.length,se]);let Se={scrollRef:T,autoScroll:A,setAutoScroll:ne,scrollDomToBottom:E,hitBottom:k,setHitBottom:j,onChatBodyScroll:D},we=P===U.LOADING||P===U.INIT,Te=P===U.STOPPED,Ee=P===U.PAUSED,W=De({isPausing:Ee,isTask:a,taskStatus:o,isStartingStatus:we,isStopStatus:Te,curAgentState:P}),Oe=Ce({isPausing:Ee,isTask:a,taskStatus:o,taskDetail:s,isStartingStatus:we,isStopStatus:Te,curAgentState:P,errorMessage:n,t:w});return(0,$.jsx)(ee,{value:Se,children:(0,$.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!m&&!me&&!g&&!ye&&!ve&&!c&&p===0&&!R&&(0,$.jsx)(xr,{onSuggestionsClick:e=>t(e)}),(0,$.jsxs)(`div`,{ref:T,"data-testid":`chat-scroll-container`,onScroll:e=>{D(e.currentTarget),de(e.currentTarget)},onWheel:pe,className:`custom-scrollbar-always flex min-h-0 grow flex-col gap-2 overflow-x-hidden overflow-y-auto px-0 pt-4 pb-8 md:px-4`,children:[ve&&_e&&(0,$.jsx)(Or,{}),ve&&!_e&&(0,$.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,$.jsx)(Ve,{size:`small`})}),oe&&(0,$.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-3 text-sm text-neutral-400`,"data-testid":`loading-older-events`,children:[(0,$.jsx)(Ve,{size:`small`}),(0,$.jsx)(`span`,{children:w(h.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,$.jsx)(b,{conversationId:V,anchorEventId:null}),he&&d.length>0&&(0,$.jsx)(te,{messages:d,allEvents:f}),(0,$.jsx)(jr,{})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px]`,children:[(0,$.jsx)(Nn,{conversationId:V}),n&&(0,$.jsx)(Ar,{message:n,onDismiss:r,onRetry:n===`Unable to connect to server`?()=>l?.reconnect():void 0}),R?(0,$.jsxs)(`div`,{"data-testid":`archived-conversation-banner`,className:`mx-1 px-4 py-3 rounded-lg bg-[var(--oh-surface)] border border-[var(--oh-border-subtle)]`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-[var(--oh-foreground)]`,children:w(L===`ERROR`?h.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:h.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,$.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:w(L===`ERROR`?h.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:h.CHAT_INTERFACE$ARCHIVED_SANDBOX_DESCRIPTION)})]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full mb-1 z-20`,children:(0,$.jsxs)(`div`,{className:`flex justify-between relative`,children:[(0,$.jsxs)(`div`,{className:`flex items-end gap-1 pointer-events-auto`,children:[(0,$.jsx)(Pr,{}),we&&(0,$.jsx)(Ir,{statusColor:W,status:Oe})]}),k?P===U.RUNNING&&(0,$.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,$.jsx)(dr,{})}):(0,$.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,$.jsx)(Tr,{onClick:E})})]})}),(0,$.jsx)(sr,{onSubmit:be,disabled:N})]})]})]})})}function Br({isRightPanelShown:e}){return(0,$.jsx)(`div`,{className:`flex justify-center w-full h-full`,children:(0,$.jsx)(`div`,{className:`w-full min-w-0 max-w-[800px] h-full flex flex-col min-h-0 transition-all duration-300 ease-in-out`,children:(0,$.jsx)(zr,{})})})}function Vr({className:e}){let{t}=v(`openhands`);return(0,$.jsxs)(`div`,{className:W(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,$.jsx)(de,{className:`h-8 w-8 shrink-0 animate-spin text-[var(--oh-text-secondary)]`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-base font-normal leading-5 text-[var(--oh-text-secondary)]`,children:t(h.HOME$LOADING)})]})}function Hr({children:e}){return(0,$.jsx)(`div`,{className:`absolute inset-0`,children:e})}function Ur({children:e}){return(0,$.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function Wr({children:e}){return(0,$.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}var Gr=(0,Q.lazy)(()=>n(()=>import(`./files-tab-C47fQEeL.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]))),Kr=(0,Q.lazy)(()=>n(()=>import(`./browser-tab-dvSPdvkm.js`),__vite__mapDeps([60,18,1,23,24,4,61,3,34,35,36,19,62,33]))),qr=(0,Q.lazy)(()=>n(()=>import(`./vscode-tab-DH9x7xXS.js`),__vite__mapDeps([63,1,18,23,24,4,64,7,8,5,6,9,10,11,12,13,14,15,16,17,19,20,21,22,43,40,41,42,44,45,48,35,36,46,47,33,65,66,34,67]))),Jr=(0,Q.lazy)(()=>n(()=>import(`./planner-tab-Dte6Vzza.js`),__vite__mapDeps([68,1,18,23,24,4,34,35,36,19,37,29,27,28,30,31,25,3,26,32,38,39,69,67,70,71,72,73,74,75,7,8,5,6,9,10,11,12,13,14,15,16,17,76,21,77,22,78,79,80,20,40,41,81,42,43,44,45,82,83,33,57,84]))),Yr=(0,Q.lazy)(()=>n(()=>import(`./task-list-tab-DT6_zfUs.js`),__vite__mapDeps([85,1,18,23,24,4,34,35,36,19,86,54,33,87,88,55,56]))),Xr=(0,Q.lazy)(()=>n(()=>import(`./terminal-KldRPIRT.js`),__vite__mapDeps([89,1,90,91,18,4,66,23,24,35,36,19,46,42,43,5,6,7,8,9,10,11,12,13,14,15,16,17,44,45,20,21,22,40,41,47,33,92]))),Zr={tasklist:{component:Yr},files:{component:Gr},browser:{component:Kr},vscode:{component:qr},terminal:{component:Xr},planner:{component:Jr}};function Qr(){let{selectedTab:e,shouldShownAgentLoading:t}=K(),{conversationId:n}=Y(),r=(0,Q.useMemo)(()=>Zr[e]??Zr.files,[e]).component;return t?(0,$.jsx)(Vr,{}):(0,$.jsx)(Ur,{children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Vr,{}),children:(0,$.jsx)(Wr,{children:(0,$.jsx)(Hr,{children:(0,$.jsx)(r,{})},e===`terminal`?`${e}-${n}`:e)})})})}var $r=()=>{let e=g(),t=le(e=>e.removeErrorMessage);return p({mutationKey:[`start-conversation`],mutationFn:async e=>f(e.conversationId),onMutate:async()=>(await e.cancelQueries({queryKey:[`user`,`conversations`]}),{previousConversations:e.getQueryData([`user`,`conversations`])}),onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:(t,n,r)=>{u(e,r.conversationId)},onSuccess:(n,r)=>{t(),l(e,r.conversationId,je.RUNNING)}})},ei=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM10 9H14A1 1 0 0 1 15 10V14A1 1 0 0 1 14 15H10A1 1 0 0 1 9 14V10A1 1 0 0 1 10 9Z`,fill:`currentColor`})}),ti=e=>(0,$.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.9 1.50004C15.3 1.65004 17.55 2.85004 19.2 4.50004C21.15 6.60004 22.2 9.15004 22.2 12.15C22.2 14.55 21.3 16.8 19.8 18.75C18.3 20.55 16.2 21.9 13.8 22.35C11.4 22.8 9 22.5 6.9 21.3C4.8 20.1 3.15 18.3 2.25 16.05C1.35 13.8 1.2 11.25 1.95 9.00004C2.7 6.60004 4.05 4.65004 6.15 3.30004C8.1 1.95004 10.5 1.35004 12.9 1.50004ZM13.65 20.85C15.6 20.4 17.4 19.35 18.75 17.7C19.95 16.05 20.7 14.1 20.55 12C20.55 9.60004 19.65 7.20004 18 5.55004C16.5 4.05004 14.7 3.15004 12.6 3.00004C10.65 2.85004 8.55 3.30004 6.9 4.50004C5.25 5.70004 4.05 7.35004 3.45 9.45004C2.85 11.4 2.85 13.5 3.75 15.45C4.65 17.4 6 18.9 7.8 19.95C9.6 21 11.7 21.3 13.65 20.85Z`,fill:`currentColor`}),(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 7.49998L10.1655 6.87598L16.9155 11.376V12.624L10.1655 17.124L9 16.5V7.49998ZM10.5 8.90098V15.099L15.1485 12L10.5 8.90098Z`,fill:`currentColor`})]});function ni({icon:e,text:t,onClick:n,testId:r}){return(0,$.jsx)(q,{testId:r,onClick:n,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 w-full items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,$.jsx)(`span`,{className:qe,"aria-hidden":!0,children:e})]})})}function ri({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=Z(),{isTask:i,taskStatus:a,taskDetail:o}=Et(),{t:s}=v(`openhands`),{errorMessage:c}=le(),l=r===U.LOADING||r===U.INIT,u=xe(t)||ke(t),d=De({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=Ce({isPausing:n,isTask:i,taskStatus:a,taskDetail:o,isStartingStatus:l,isStopStatus:u,curAgentState:r,errorMessage:c,t:s});return(0,$.jsx)(`div`,{className:e,"data-testid":`server-status`,children:(0,$.jsxs)(`div`,{className:`flex items-center`,children:[(0,$.jsx)(Fr,{className:`w-6 h-6 shrink-0`,color:d}),(0,$.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function ii({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=v(`openhands`),c=st(e),l=Ae(r),u=ke(r),d=l||u;return(0,$.jsxs)(pt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:W(`left-2 w-fit min-w-42`,a),children:[(0,$.jsx)(ri,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Je,{inset:`menu`}),l&&t&&(0,$.jsx)(ni,{icon:(0,$.jsx)(ei,{width:18,height:18}),text:s(h.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,$.jsx)(ni,{icon:(0,$.jsx)(ti,{width:18,height:18}),text:s(h.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var ai=e(s(),1);function oi({isPublic:e,onToggle:t,ariaLabel:n}){return(0,$.jsxs)(`label`,{className:`relative inline-flex shrink-0 cursor-pointer items-center`,children:[(0,$.jsx)(`input`,{hidden:!0,type:`checkbox`,"data-testid":`share-publicly-button`,checked:e,"aria-label":n,onChange:e=>t(e.target.checked)}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:W(`inline-flex h-3.5 w-7 items-center rounded-full px-0.5 py-px transition-colors duration-200 ease-in-out`,e?`bg-white`:`bg-base-secondary`),children:(0,$.jsx)(`span`,{className:W(`block h-2 w-2 shrink-0 rounded-full transition-transform duration-200 ease-in-out`,e?`translate-x-[calc(1rem-1px)] bg-base-secondary`:`translate-x-px bg-tertiary-light`)})})]})}function si({onClose:e,onRename:t,onDelete:n,onStop:r,onDisplayCost:i,onShowAgentTools:a,onShowSkills:o,onShowHooks:s,onTogglePublic:c,onCopyShareLink:l,onDownloadConversation:u,shareUrl:d,position:f=`bottom`,anchorRef:p}){let m=cn(),{t:g}=v(`openhands`),{backend:_}=G(),{data:y}=X(),b=st(e),x=p?.current??null,[S,C]=Q.useState();Q.useLayoutEffect(()=>{if(!x)return;let e=()=>{let e=x.getBoundingClientRect();if(!e)return;let t={position:`fixed`,zIndex:9999};f===`top`?t.bottom=window.innerHeight-e.top+8:t.top=e.bottom+8,t.left=e.left,C(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[x,f]);let w=!!(a||o||s),T=!!i,ee=!!(r||n),E=_.kind===`cloud`?h.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:h.COMMON$STOP_CONVERSATION,D=_.kind===`cloud`&&!!c,te=y?.public||!1,O=!!x,A=(0,$.jsxs)(pt,{ref:b,testId:`conversation-name-context-menu`,position:f,alignment:`left`,className:W(m?`right-0 translate-x-[34%] left-auto`:``,O?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,$.jsx)(q,{testId:`rename-button`,onClick:t,children:(0,$.jsx)(J,{icon:(0,$.jsx)(gt,{width:16,height:16}),text:g(h.BUTTON$RENAME)})}),w&&(0,$.jsx)(Je,{testId:`separator-tools`,inset:`menu`}),o&&(0,$.jsx)(q,{testId:`show-skills-button`,onClick:o,children:(0,$.jsx)(J,{icon:(0,$.jsx)(_t,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:g(h.CONVERSATION$SHOW_SKILLS)})}),s&&(0,$.jsx)(q,{testId:`show-hooks-button`,onClick:s,children:(0,$.jsx)(J,{icon:(0,$.jsx)(kt,{width:16,height:16,"aria-hidden":!0}),text:g(h.CONVERSATION$SHOW_HOOKS)})}),a&&(0,$.jsx)(q,{testId:`show-agent-tools-button`,onClick:a,children:(0,$.jsx)(J,{icon:(0,$.jsx)(Xe,{width:16,height:16}),text:g(h.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})}),u&&(0,$.jsx)(q,{testId:`download-trajectory-button`,onClick:u,children:(0,$.jsx)(J,{icon:(0,$.jsx)(k,{width:16,height:16}),text:g(h.BUTTON$EXPORT_CONVERSATION)})}),(T||ee)&&(0,$.jsx)(Je,{testId:`separator-info-control`,inset:`menu`}),i&&(0,$.jsx)(q,{testId:`display-cost-button`,onClick:i,children:(0,$.jsx)(J,{icon:(0,$.jsx)(F,{width:16,height:16}),text:g(h.BUTTON$DISPLAY_COST)})}),D&&c&&(0,$.jsxs)(`li`,{className:`flex w-full items-center gap-2 rounded px-2 py-2 hover:bg-[var(--oh-interactive-hover)]`,children:[(0,$.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)]`,"aria-hidden":!0,children:(0,$.jsx)(V,{size:16})}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:g(h.CONVERSATION$SHARE_PUBLICLY)}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[te&&d&&l&&(0,$.jsxs)(`div`,{className:`mr-2 flex items-center gap-0.5`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`copy-share-link-button`,onClick:l,className:`rounded p-0.5 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(h.BUTTON$COPY_TO_CLIPBOARD),children:(0,$.jsx)(an,{width:14,height:14})}),(0,$.jsx)(`a`,{"data-testid":`open-share-link-button`,href:d,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`rounded p-0.5 text-[var(--oh-muted)] no-underline visited:text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(h.BUTTON$OPEN_IN_NEW_TAB),children:(0,$.jsx)(ae,{size:14,"aria-hidden":!0})})]}),(0,$.jsx)(oi,{isPublic:te,onToggle:c,ariaLabel:g(h.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,$.jsx)(q,{testId:`stop-button`,onClick:r,children:(0,$.jsx)(J,{icon:(0,$.jsx)(Qe,{width:16,height:16}),text:g(E)})}),n&&(0,$.jsx)(q,{testId:`delete-button`,onClick:n,children:(0,$.jsx)(J,{icon:(0,$.jsx)(mt,{width:16,height:16}),text:g(h.COMMON$DELETE_CONVERSATION)})})]});return O?typeof document>`u`||!S?null:ai.createPortal((0,$.jsx)(`div`,{style:S,children:A}),document.body):A}function ci({onClose:e}){let{t}=v(`openhands`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(it,{onClose:e,testId:`close-metrics-modal`}),(0,$.jsx)(`div`,{className:`w-full pr-6`,children:(0,$.jsx)(ze,{title:t(h.CONVERSATION$METRICS_INFO)})})]})}function li({currentCost:e,maxBudget:t}){let n=e/t*100;return(0,$.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden mt-1`,children:(0,$.jsx)(`div`,{className:W(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function ui({currentCost:e,maxBudget:t}){let{t:n}=v(`openhands`),r=e/t*100;return(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(h.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(h.CONVERSATION$USED)})})})}function di({cost:e,maxBudgetPerTask:t}){let{t:n}=v(`openhands`);return e===null?null:(0,$.jsx)(`div`,{className:`border-b border-[var(--oh-border-subtle)]`,children:t!==null&&t>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(li,{currentCost:e,maxBudget:t}),(0,$.jsx)(ui,{currentCost:e,maxBudget:t})]}):(0,$.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(h.CONVERSATION$NO_BUDGET_LIMIT)})})}function fi({cost:e,maxBudgetPerTask:t}){let{t:n}=v(`openhands`);return e===null?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center pb-2`,children:[(0,$.jsx)(`span`,{className:`text-lg font-semibold`,children:n(h.CONVERSATION$TOTAL_COST)}),(0,$.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,$.jsx)(di,{cost:e,maxBudgetPerTask:t})]})}function pi({label:e,value:t,labelClassName:n=``,valueClassName:r=`font-semibold`}){return(0,$.jsxs)(`div`,{className:`flex justify-between items-center border-b border-[var(--oh-border-subtle)] pb-2`,children:[(0,$.jsx)(`span`,{className:n,children:e}),(0,$.jsx)(`span`,{className:r,children:t})]})}function mi({usage:e}){let{t}=v(`openhands`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pi,{label:t(h.CONVERSATION$INPUT),value:e.prompt_tokens.toLocaleString()}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pl-4 text-sm`,children:[(0,$.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(h.CONVERSATION$CACHE_HIT)}),(0,$.jsx)(`span`,{className:`text-right`,children:e.cache_read_tokens.toLocaleString()}),(0,$.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(h.CONVERSATION$CACHE_WRITE)}),(0,$.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,$.jsx)(pi,{label:t(h.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,$.jsx)(pi,{label:t(h.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function hi({perTurnToken:e,contextWindow:t}){let{t:n}=v(`openhands`),r=t>0?e/t*100:0,i=Math.min(100,r);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,$.jsx)(`span`,{className:`font-semibold`,children:n(h.CONVERSATION$CONTEXT_WINDOW)})}),(0,$.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full bg-foreground transition-all duration-300`,style:{width:`${i}%`}})}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsxs)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` (`,r.toFixed(2),`% `,n(h.CONVERSATION$USED),`)`]})})]})}function gi(){let{t:e}=v(`openhands`);return(0,$.jsx)(`div`,{className:`text-center`,children:(0,$.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(h.CONVERSATION$NO_METRICS)})})}function _i(e){let{stats:t}=e;if(!t?.usage_to_metrics)return{accumulated_cost:0,max_budget_per_task:null,accumulated_token_usage:null};let n=0,r=null,i=null;for(let e of Object.values(t.usage_to_metrics))n+=e.accumulated_cost,r===null&&e.max_budget_per_task!==null&&(r=e.max_budget_per_task),e.accumulated_token_usage&&(i=i===null?{...e.accumulated_token_usage}:{prompt_tokens:i.prompt_tokens+e.accumulated_token_usage.prompt_tokens,completion_tokens:i.completion_tokens+e.accumulated_token_usage.completion_tokens,cache_read_tokens:i.cache_read_tokens+e.accumulated_token_usage.cache_read_tokens,cache_write_tokens:i.cache_write_tokens+e.accumulated_token_usage.cache_write_tokens,context_window:Math.max(i.context_window,e.accumulated_token_usage.context_window),per_turn_token:Math.max(i.per_turn_token,e.accumulated_token_usage.per_turn_token)});return{accumulated_cost:n,max_budget_per_task:r,accumulated_token_usage:i}}var vi=(e,t,n,r=!0)=>{let i=c({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return _i(await Ie.getRuntimeConversation(e,t,n))},enabled:r&&!!e&&!!t,staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,retry:!1});return{data:i.data,isLoading:i.isLoading,error:i.error}};function yi({isOpen:e,onOpenChange:t}){let n=ce(),{data:r}=X(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=vi(i,a,o,e),c=(0,Q.useMemo)(()=>s?{cost:s.accumulated_cost,max_budget_per_task:s.max_budget_per_task,usage:s.accumulated_token_usage?{prompt_tokens:s.accumulated_token_usage.prompt_tokens??0,completion_tokens:s.accumulated_token_usage.completion_tokens??0,cache_read_tokens:s.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:s.accumulated_token_usage.cache_write_tokens??0,context_window:s.accumulated_token_usage.context_window??0,per_turn_token:s.accumulated_token_usage.per_turn_token??0}:null}:n,[s,n]);return e?(0,$.jsx)(Le,{onClose:()=>t(!1),children:(0,$.jsxs)(Re,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,$.jsx)(ci,{onClose:()=>t(!1)}),(0,$.jsxs)(`div`,{className:`w-full`,children:[(c?.cost!==null||c?.usage!==null)&&(0,$.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsx)(fi,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mi,{usage:c.usage}),(0,$.jsx)(hi,{perTurnToken:c.usage.per_turn_token,contextWindow:c.usage.context_window})]})]})}),!c?.cost&&!c?.usage&&(0,$.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,$.jsx)(gi,{})})]})]})}):null}function bi(){let{t:e}=v(`openhands`),{conversationId:t}=Y(),{data:n}=X(),{mutate:r}=M(),[i,a]=Q.useState(`view`),[o,s]=Q.useState(!1),c=Q.useRef(null),l=Q.useRef(null),{handleDelete:u,handleStop:d,handleDownloadConversation:f,handleDisplayCost:p,handleShowAgentTools:m,handleShowSkills:g,handleShowHooks:_,handleTogglePublic:y,handleCopyShareLink:b,shareUrl:x,handleConfirmDelete:S,handleConfirmStop:C,metricsModalVisible:w,setMetricsModalVisible:T,systemModalVisible:ee,setSystemModalVisible:E,skillsModalVisible:D,setSkillsModalVisible:te,hooksModalVisible:O,setHooksModalVisible:k,confirmDeleteModalVisible:ne,setConfirmDeleteModalVisible:j,confirmStopModalVisible:N,setConfirmStopModalVisible:P,systemMessage:F,shouldShowStop:I,shouldShowDownloadConversation:R,shouldShowDisplayCost:z,shouldShowAgentTools:B,shouldShowSkills:ie,shouldShowHooks:V}=Ct({conversationId:t,executionStatus:n?.execution_status,showOptions:!0,onContextMenuToggle:s});return Q.useEffect(()=>{i===`edit`&&c.current?.focus()},[i]),n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 h-[22px] text-base font-normal text-left pl-0 lg:pl-1 min-w-0`,"data-testid":`conversation-name`,children:[i===`edit`?(0,$.jsx)(`input`,{ref:c,"data-testid":`conversation-name-input`,onClick:e=>{i===`edit`&&(e.preventDefault(),e.stopPropagation())},onBlur:()=>{if(c.current?.value&&t){let i=c.current.value.trim();i!==n?.title&&r({conversationId:t,newTitle:i},{onSuccess:()=>{re(e(h.CONVERSATION$TITLE_UPDATED))}})}else c.current&&(c.current.value=n?.title??``);a(`view`)},onKeyUp:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&e.currentTarget.blur()},type:`text`,defaultValue:n.title||``,className:`text-white leading-5 bg-transparent border-none outline-none text-base font-normal w-fit max-w-fit field-sizing-content`}):(0,$.jsx)(`div`,{className:`text-white leading-5 truncate`,"data-testid":`conversation-name-title`,onDoubleClick:()=>{a(`edit`)},title:n.title||``,children:n.title}),i!==`edit`&&(0,$.jsxs)(`div`,{ref:l,className:`relative flex items-center shrink-0`,children:[(0,$.jsx)(ht,{onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o)}}),o&&(0,$.jsx)(si,{onClose:()=>s(!1),onRename:e=>{e.preventDefault(),e.stopPropagation(),a(`edit`),s(!1)},onDelete:u,onStop:I?d:void 0,onDisplayCost:z?p:void 0,onShowAgentTools:B?m:void 0,onShowSkills:ie?g:void 0,onShowHooks:V?_:void 0,onTogglePublic:y,onCopyShareLink:b,shareUrl:x,onDownloadConversation:R?f:void 0,position:`bottom`,anchorRef:l})]})]}),(0,$.jsx)(yi,{isOpen:w,onOpenChange:T}),(0,$.jsx)(Ft,{isOpen:ee,onClose:()=>E(!1),systemMessage:F||null}),D&&(0,$.jsx)(It,{onClose:()=>te(!1)}),O&&(0,$.jsx)(Bt,{onClose:()=>k(!1)}),ne&&(0,$.jsx)(A,{onConfirm:S,onCancel:()=>j(!1),conversationTitle:n?.title||``}),N&&(0,$.jsx)(L,{onConfirm:C,onCancel:()=>P(!1)})]}):null}function xi({children:e,tooltip:t,ariaLabel:n}){return(0,$.jsx)(Ge,{content:t,placement:`bottom`,tooltipClassName:`bg-white text-black text-xs font-medium leading-5`,children:(0,$.jsx)(`span`,{"data-aria-label":n,children:e})})}function Si({className:e}){let{t}=v(`openhands`),n=cn(),r=a(),{conversationId:i}=Y(),{isRightPanelShown:o,setHasRightPanelToggled:s,setIsRightPanelShown:c,setSelectedTab:l}=K(),u=()=>{if(n){if(!i)return;s(!0),c(!0);let{selectedTab:e}=K.getState();e||l(`files`),r(`/conversations/${i}/panel`);return}let e=!o;if(s(e),e){let{selectedTab:e}=K.getState();e||l(`files`)}},d=t(n?h.COMMON$SHOW_PANEL:o?h.COMMON$HIDE_PANEL:h.COMMON$SHOW_PANEL),f=n?!1:o;return(0,$.jsx)(xi,{tooltip:d,ariaLabel:d,children:(0,$.jsx)(`button`,{type:`button`,onClick:u,className:W(P,e),"aria-label":d,"aria-pressed":f,"data-testid":`right-panel-toggle`,children:(0,$.jsx)(N,{className:`w-5 h-5 -scale-x-100`})})})}function Ci(){let{conversationId:e}=Y(),{data:t}=X(),{curAgentState:n}=Z(),{isTask:r,taskStatus:i}=Et(),{mutate:a}=Ye(),{mutate:o}=$r(),{providers:s}=$e(),c=t?.execution_status??null,l=De({isPausing:!1,isTask:r,taskStatus:i,isStartingStatus:n===U.LOADING||n===U.INIT,isStopStatus:xe(c),curAgentState:n});return(0,$.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,$.jsxs)(`div`,{className:`flex items-center min-w-0`,children:[(0,$.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,$.jsx)(Fr,{className:`ml-[3.5px] w-6 h-6 cursor-pointer`,color:l}),(0,$.jsx)(ii,{onClose:()=>{},onStopServer:Ae(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&a({conversationId:e})}:void 0,onStartServer:ke(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&o({conversationId:e,providers:s})}:void 0,executionStatus:c,position:`bottom`,className:`opacity-0 invisible pointer-events-none group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto bottom-full left-0 mt-0 min-h-fit`,isPausing:!1})]}),(0,$.jsx)(bi,{})]}),(0,$.jsx)(Si,{className:`mr-2`})]})}var wi=e=>(0,$.jsxs)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,$.jsx)(`path`,{d:`M3 10.5L6.5 14L14 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,$.jsx)(`path`,{d:`M7 10.5L10.5 14L18 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`})]});function Ti({tabValue:e,icon:t,onClick:n,isActive:r,label:i,className:a,measureOnly:o}){return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{n()},...o?{}:{"data-testid":`conversation-tab-${e}`},"data-tab-measure":o?`true`:void 0,className:W(`flex items-center gap-2 rounded-md cursor-pointer`,`pl-1.5 pr-2 py-1 lg:py-1.5`,`text-[var(--oh-muted)] bg-transparent`,r&&`bg-[var(--oh-interactive-active)] text-white`,r?`hover:text-white hover:bg-[var(--oh-interactive-hover)]`:`hover:text-white hover:bg-white/5`,r?`focus-within:text-white`:`focus-within:text-[var(--oh-muted)]`,a),children:[(0,$.jsx)(t,{className:W(`w-5 h-5 text-inherit flex-shrink-0`)}),r&&i&&(0,$.jsx)(`span`,{className:`text-sm font-normal whitespace-nowrap`,children:i})]})}function Ei(){let{curAgentState:e}=Z(),{t}=v(`openhands`),{data:n,refetch:r}=dn(),i=Oe.includes(e);return(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{children:t(h.COMMON$CODE)}),i?null:(0,$.jsx)(ft,{className:`w-3 h-3 text-inherit cursor-pointer`,onClick:async e=>{e.preventDefault(),e.stopPropagation();let t=n?.url;t||=(await r()).data?.url??null,t&&window.open(t,`_blank`,`noopener,noreferrer`)}})]})}var Di=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7.13832 8.76476C8.25957 8.17949 9.52697 7.9727 10.7515 8.14436L14.9025 2.52826L21.4717 9.09737L15.8555 13.2484C16.0272 14.4729 15.8204 15.7403 15.2351 16.8616C15.1872 16.9535 15.1366 17.0444 15.0836 17.1343C14.8318 17.5605 14.5228 17.9624 14.1566 18.3286L10.4443 14.6163L4.75207 20.3085H3.69141V19.2478L9.38361 13.5556L5.6713 9.84332C6.03755 9.47708 6.43936 9.16808 6.86562 8.91632C6.95547 8.86326 7.04641 8.81274 7.13832 8.76476ZM15.0735 4.82054L19.1794 8.92641L14.2461 12.5727L14.3701 13.4567C14.492 14.3266 14.3596 15.2233 13.9758 16.0265L7.97338 10.0241C8.77665 9.64035 9.67335 9.50789 10.5432 9.62984L11.4272 9.75376L15.0735 4.82054Z`,fill:`currentColor`})}),Oi=e=>(0,$.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,$.jsx)(`path`,{d:`M10.9706 10.1586C10.2819 10.0621 9.56905 10.1784 8.93842 10.5075C8.88672 10.5345 8.83557 10.5629 8.78504 10.5928C8.54529 10.7344 8.3193 10.9082 8.11331 11.1142L9.83702 12.8372L7.00054 15.75L7 17H8.25064L11.1628 14.1632L12.8857 15.8865C13.0917 15.6805 13.2655 15.4545 13.4071 15.2147C13.437 15.1642 13.4654 15.1131 13.4924 15.0614C13.8215 14.4308 13.9378 13.718 13.8413 13.0293L17 10.6946L13.3053 7L10.9706 10.1586Z`,fill:`currentColor`})});function ki({isOpen:e,onClose:t,ignoreOutsideClickRef:n}){let r=st(t,n),{t:i}=v(`openhands`),{conversationId:a}=Y(),{state:o,setUnpinnedTabs:s,setSelectedTab:c}=rt(a),{selectedTab:l,isRightPanelShown:u,setSelectedTab:d}=K(),{navigateToTab:f}=C(),{hasTaskList:p}=fn(),{backend:m}=G(),g=[{tab:`planner`,icon:rn,i18nKey:h.COMMON$PLANNER},{tab:`files`,icon:Jt,i18nKey:h.COMMON$FILES},{tab:`vscode`,icon:un,i18nKey:h.COMMON$CODE},{tab:`terminal`,icon:vt,i18nKey:h.COMMON$TERMINAL},{tab:`browser`,icon:ln,i18nKey:h.COMMON$BROWSER}];p&&g.unshift({tab:`tasklist`,icon:wi,i18nKey:h.COMMON$TASK_LIST});let _=g.filter(({tab:e})=>e!==`vscode`&&e!==`planner`||m.kind===`cloud`);if(!e)return null;let y=e=>{f(e),t()},b=(e,t)=>{if(t.preventDefault(),t.stopPropagation(),o.unpinnedTabs.includes(e))s(o.unpinnedTabs.filter(t=>t!==e));else{let t=[...o.unpinnedTabs,e];if(s(t),l===e&&u){let n=_.find(({tab:n})=>n!==e&&!t.includes(n));n&&(d(n.tab),c(n.tab))}}};return(0,$.jsx)(pt,{ref:r,alignment:`right`,position:`bottom`,className:`z-[9999] mt-2 w-fit`,children:_.map(({tab:e,icon:t,i18nKey:n})=>{let r=!o.unpinnedTabs.includes(e);return(0,$.jsx)(`li`,{className:`list-none`,children:(0,$.jsxs)(`div`,{className:W(`group flex h-[30px] w-full min-w-0 items-stretch rounded`,`hover:bg-[var(--oh-interactive-hover)]`),children:[(0,$.jsxs)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-open-${e}`,className:W(`flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-l p-2 text-start text-white`,Ke),onClick:()=>y(e),children:[(0,$.jsx)(`span`,{className:qe,"aria-hidden":!0,children:(0,$.jsx)(t,{className:`h-4 w-4`})}),(0,$.jsx)(`span`,{className:`text-sm`,children:i(n)})]}),(0,$.jsx)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-pin-${e}`,className:W(`flex shrink-0 cursor-pointer items-center justify-center rounded-r px-2 text-white hover:bg-white/10`,Ke),"aria-pressed":r,"aria-label":r?`Unpin tab from bar`:`Pin tab to bar`,onClick:t=>b(e,t),children:r?(0,$.jsx)(`span`,{className:W(`-mr-[5px] ml-auto`,qe),"aria-hidden":!0,children:(0,$.jsx)(Oi,{className:`h-7 w-7`})}):(0,$.jsx)(`span`,{className:W(`ml-auto`,qe),"aria-hidden":!0,children:(0,$.jsx)(Di,{className:`h-4.5 w-4.5`})})})]})},e)})})}function Ai({variant:e=`default`}){let{conversationId:t}=Y(),{setSelectedTab:n,planContent:r}=K(),[i,a]=(0,Q.useState)(!1),{state:o}=rt(t),{hasTaskList:s}=fn(),{backend:c}=G(),{handleBuildPlanClick:l}=y(),{curAgentState:u}=Z(),{selectTab:d,isTabActive:f,onTabChange:p,selectedTab:m,isRightPanelShown:g}=C();(0,Q.useEffect)(()=>{n(o.selectedTab)},[n,o.selectedTab]),(0,Q.useEffect)(()=>{g&&(m||p(`files`))},[g,m,p]);let{t:_,i18n:b}=v(`openhands`),x=[{tabValue:`files`,isActive:f(`files`),icon:Jt,onClick:()=>d(`files`),tooltipContent:_(h.COMMON$FILES),tooltipAriaLabel:_(h.COMMON$FILES),label:_(h.COMMON$FILES)},{tabValue:`planner`,isActive:f(`planner`),icon:rn,onClick:()=>d(`planner`),tooltipContent:_(h.COMMON$PLANNER),tooltipAriaLabel:_(h.COMMON$PLANNER),label:_(h.COMMON$PLANNER)},{tabValue:`vscode`,isActive:f(`vscode`),icon:un,onClick:()=>d(`vscode`),tooltipContent:(0,$.jsx)(Ei,{}),tooltipAriaLabel:_(h.COMMON$CODE),label:_(h.COMMON$CODE)},{tabValue:`terminal`,isActive:f(`terminal`),icon:vt,onClick:()=>d(`terminal`),tooltipContent:_(h.COMMON$TERMINAL),tooltipAriaLabel:_(h.COMMON$TERMINAL),label:_(h.COMMON$TERMINAL),className:`pl-2`},{tabValue:`browser`,isActive:f(`browser`),icon:ln,onClick:()=>d(`browser`),tooltipContent:_(h.COMMON$BROWSER),tooltipAriaLabel:_(h.COMMON$BROWSER),label:_(h.COMMON$BROWSER)}];s&&x.splice(1,0,{tabValue:`tasklist`,isActive:f(`tasklist`),icon:wi,onClick:()=>d(`tasklist`),tooltipContent:_(h.COMMON$TASK_LIST),tooltipAriaLabel:_(h.COMMON$TASK_LIST),label:_(h.COMMON$TASK_LIST)});let S=x.filter(e=>e.tabValue===`vscode`&&c.kind!==`cloud`||e.tabValue===`planner`&&c.kind!==`cloud`?!1:o.unpinnedTabs.includes(e.tabValue)?m===e.tabValue:!0),w=o.unpinnedTabs.join(`,`),T=u===U.RUNNING||u===U.LOADING||!r,ee=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),te=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(S.length);(0,Q.useLayoutEffect)(()=>{let e=ee.current,t=E.current,n=D.current;if(!e||!t||!n)return;let r=()=>{let r=t.querySelectorAll(`[data-tab-measure="true"]`),i=r.length,a=e.getBoundingClientRect().width;if(a===0){k(i);return}let o=Array.from(r).map(e=>e.getBoundingClientRect().width);if(o.length!==i||i===0){k(Math.max(0,i));return}let s=n.getBoundingClientRect().width,c=getComputedStyle(e).columnGap||getComputedStyle(e).gap,l=parseFloat(c)||6,u=0;for(let e=i;e>=0;--e){let t=s;for(let n=0;n<e;n+=1)t+=o[n]??0;if(e>0&&(t+=e*l),t<=a+.5){u=e;break}}k(e=>e===u?e:u)};if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(e),()=>i.disconnect()},[w,S.length,s,c.kind,m,g,b.language]);let A=Math.min(O,S.length);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:W(`relative w-full min-w-0`,e===`compact`?`flex h-full min-h-0 items-center py-0 pl-0 pr-1`:`min-h-10 p-1`),children:[(0,$.jsx)(`div`,{ref:E,"aria-hidden":!0,className:`pointer-events-none absolute top-0 left-[-10000px] flex flex-nowrap items-center gap-1.5`,children:S.map(({tabValue:e,icon:t,isActive:n,tooltipContent:r,tooltipAriaLabel:i,label:a,className:o},s)=>(0,$.jsx)(xi,{tooltip:r,ariaLabel:i,children:(0,$.jsx)(Ti,{tabValue:e,icon:t,onClick:()=>{},isActive:n,label:a,className:W(o,`shrink-0`),measureOnly:!0})},`measure-${e}-${s}`))}),(0,$.jsx)(`div`,{ref:ee,className:`flex w-full min-w-0 flex-nowrap items-center justify-start`,children:(0,$.jsxs)(`div`,{className:`flex w-fit max-w-full min-w-0 flex-nowrap items-center gap-1.5`,children:[(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-nowrap items-center gap-1.5 overflow-x-hidden`,children:S.slice(0,A).map(({tabValue:e,icon:t,onClick:n,isActive:r,tooltipContent:i,tooltipAriaLabel:a,label:o,className:s},c)=>(0,$.jsx)(xi,{tooltip:i,ariaLabel:a,children:(0,$.jsx)(Ti,{tabValue:e,icon:t,onClick:n,isActive:r,label:o,className:W(s,`shrink-0`)})},`${e}-${c}`))}),(0,$.jsxs)(`div`,{ref:D,className:`relative shrink-0`,children:[(0,$.jsx)(ht,{ref:te,onClick:()=>a(!i),ariaLabel:_(h.COMMON$MORE_OPTIONS),iconClassName:e===`compact`?j:void 0}),(0,$.jsx)(ki,{isOpen:i,onClose:()=>a(!1),ignoreOutsideClickRef:te})]})]})})]}),f(`planner`)&&(0,$.jsx)(`div`,{className:W(`flex h-10 min-h-10 shrink-0 items-center border-t border-[var(--oh-border)] pl-[10px] pr-1`),children:(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:T,className:W(`flex h-5 min-w-17 items-center justify-center rounded bg-white px-2 transition-opacity`,T?`cursor-not-allowed opacity-50`:`cursor-pointer hover:opacity-90`),"data-testid":`planner-tab-build-button`,children:(0,$.jsxs)(nn.Text,{className:`text-[11px] font-normal leading-5 text-black`,children:[_(h.COMMON$BUILD),` ⌘↩`]})})})]})}function ji({onMouseDown:e,className:t,isDragging:n=!1}){let[r,i]=(0,Q.useState)(!1),a=n||r;return(0,$.jsxs)(`div`,{className:W(`relative z-10 w-0 shrink-0 self-stretch`,t),"aria-hidden":!0,children:[(0,$.jsx)(`div`,{className:`absolute inset-y-0 left-1/2 w-3 min-w-[12px] -translate-x-1/2 cursor-ew-resize`,onMouseDown:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1)}),(0,$.jsx)(`div`,{className:W(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`,a?`bg-white`:`bg-transparent`),"aria-hidden":!0})]})}var Mi=200;function Ni({defaultLeftWidth:e=50,minLeftWidth:t=30,maxLeftWidth:n=80,storageKey:r=`desktop-layout-panel-width`}={}){let[i,a]=pn(r,e),o=(0,Q.useCallback)(e=>Math.max(t,Math.min(n,e)),[t,n]),[s,c]=(0,Q.useState)(()=>o(i)),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f=(0,Q.useCallback)(e=>{e.preventDefault(),u(!0)},[]),p=(0,Q.useCallback)(e=>{if(!l||!d.current)return;let t=d.current.getBoundingClientRect();c(o((e.clientX-t.left)/t.width*100))},[l,o]),m=(0,Q.useCallback)(()=>{l&&(u(!1),a(s))},[l,s,a]);return(0,Q.useLayoutEffect)(()=>{if(!l)return;let e=document.createElement(`div`);return e.setAttribute(`aria-hidden`,`true`),e.dataset.panelDragShield=``,Object.assign(e.style,{position:`fixed`,inset:`0`,zIndex:String(Mi),cursor:`ew-resize`}),document.body.appendChild(e),document.addEventListener(`mousemove`,p),document.addEventListener(`mouseup`,m),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`,()=>{document.removeEventListener(`mousemove`,p),document.removeEventListener(`mouseup`,m),document.body.style.cursor=``,document.body.style.userSelect=``,e.remove()}},[l,p,m]),{leftWidth:s,rightWidth:100-s,isDragging:l,containerRef:d,handleMouseDown:f}}function Pi(e){return e?`translate-x-0 opacity-100`:`w-0 translate-x-full opacity-0`}function Fi(){let e=cn(),t=cn(767),{isRightPanelShown:n}=K(),{leftWidth:r,rightWidth:i,isDragging:a,containerRef:o,handleMouseDown:s}=Ni({defaultLeftWidth:50,minLeftWidth:30,maxLeftWidth:80,storageKey:`desktop-layout-panel-width`});return(0,$.jsx)(`div`,{className:W(e?`relative min-h-0 flex-1 flex flex-col`:`h-full flex flex-col overflow-hidden`),children:(0,$.jsxs)(`div`,{ref:o,className:W(`flex flex-1 overflow-hidden`,e?`flex-col`:`transition-all duration-300 ease-in-out`),style:e?void 0:{transitionProperty:a?`none`:`all`},children:[(0,$.jsxs)(`div`,{className:W(`flex flex-col bg-base overflow-hidden`,e?`flex-1`:`transition-all duration-300 ease-in-out`),style:e?void 0:{width:n?`${r}%`:`100%`,transitionProperty:a?`none`:`all`},children:[(0,$.jsxs)(`div`,{"data-testid":`chat-pane-header`,className:W(`flex h-10 min-h-10 shrink-0 items-center`,t&&`gap-2 pl-2.5`),children:[t?(0,$.jsx)(I,{}):null,(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(Ci,{})})]}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,$.jsx)(Br,{isRightPanelShown:!e&&n})})]}),!e&&n&&(0,$.jsx)(ji,{onMouseDown:s,isDragging:a}),!e&&(0,$.jsx)(`div`,{className:W(`transition-all duration-300 ease-in-out overflow-hidden`,Pi(n)),style:{width:n?`${i}%`:`0%`,transitionProperty:a?`opacity, transform`:`all`},children:(0,$.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:(0,$.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 bg-[var(--oh-surface)] border-l border-[var(--oh-border)] overflow-hidden`,children:[(0,$.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex shrink-0 flex-col border-b border-[var(--oh-border)]`,children:(0,$.jsx)(Ai,{})}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,$.jsx)(Qr,{})})]})})})]})})}function Ii({onNavigateBack:e}){let{t}=v(`openhands`),{setIsRightPanelShown:n,setHasRightPanelToggled:r,setSelectedTab:i}=K();return Q.useLayoutEffect(()=>(n(!0),r(!0),K.getState().selectedTab||i(`files`),()=>{n(!1),r(!1)}),[n,r,i]),(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[var(--oh-surface)]`,children:[(0,$.jsxs)(`div`,{"data-testid":`conversation-mobile-panel-top`,className:`flex h-10 min-h-10 shrink-0 items-center gap-1.5 border-b border-[var(--oh-border)] pl-2.5`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`conversation-mobile-panel-back`,onClick:()=>{e()},"aria-label":t(h.COMMON$BACK),className:P,children:(0,$.jsx)(ne,{size:20,className:j,"aria-hidden":!0,strokeWidth:2})}),(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 items-center self-stretch`,children:(0,$.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex h-full min-h-0 w-full min-w-0 flex-col justify-center`,children:(0,$.jsx)(Ai,{variant:`compact`})})})]}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-[var(--oh-surface)]`,children:(0,$.jsx)(Qr,{})})]})}var Li=1e3*60*5,Ri=1e3*60*15,zi=e=>{let t=e||[],n=G();return c({queryKey:[`v1`,`sub-conversations`,t,n.backend.id,n.orgId],queryFn:async()=>t.length===0?[]:Ie.batchGetAppConversations(t),enabled:t.length>0,staleTime:Li,gcTime:Ri,retry:!1})};function Bi({children:e,conversationId:t}){let{data:n}=X(),{data:r}=zi(n?.sub_conversation_ids??[]),i=r?.filter(e=>e!==null);return(0,$.jsx)(he,{conversationId:t,conversationUrl:n?.sandbox_status===`PAUSED`?null:n?.conversation_url,sessionApiKey:n?.session_api_key,subConversationIds:n?.sub_conversation_ids,subConversations:i,children:e})}function Vi(){let{t:e}=v(`openhands`),{conversationId:t}=Y(),n=r(`/conversations/:conversationId/panel`),{isTask:i,taskStatus:s,taskDetail:c}=Et(),l=G(),u=Q.useRef(l.backend.id),d=Q.useRef(l.orgId),f=u.current!==l.backend.id||d.current!==l.orgId,{data:p,isFetched:m}=X(),{data:g}=ot(),{resetConversationState:_}=K(),y=a(),b=o(),x=tn(e=>e.clearTerminal),S=bt(e=>e.reset),C=hn(e=>e.setCurrentAgentState),w=le(e=>e.removeErrorMessage);Q.useEffect(()=>{x(),_(),S(),C(U.LOADING),w()},[t,x,_,S,C,w]),Q.useEffect(()=>{if(i&&s===`ERROR`){z(c||e(h.CONVERSATION$FAILED_TO_START_FROM_TASK));let t=b.state?.resumedFromConversationId;y(t?`/conversations/${t}`:`/conversations`,{replace:!0})}},[i,s,c,e,y,b.state]),Q.useEffect(()=>{!m||!g||f||p||(xn(l.backend.id,l.orgId),z(e(h.CONVERSATION$NOT_EXIST_OR_NO_PERMISSION)),y(`/conversations`))},[p,m,g,y,e,f,l.backend.id,l.orgId]),Q.useEffect(()=>{f||t&&(t.startsWith(`task-`)||bn(l.backend.id,l.orgId,t))},[t,f,l.backend.id,l.orgId]);let T=Q.useRef(null);return Q.useEffect(()=>{!m||!p||l.backend.kind===`cloud`&&p.sandbox_status===`PAUSED`&&p.sandbox_id&&T.current!==p.id&&(T.current=p.id,Fe(p.sandbox_id).catch(()=>{z(e(h.CONVERSATION$FAILED_TO_START_FROM_TASK))}))},[m,p?.id,p?.sandbox_status,p?.sandbox_id,l.backend.kind,e]),f?null:(0,$.jsx)(Bi,{conversationId:t,children:(0,$.jsx)(Dn,{children:(0,$.jsx)(`div`,{"data-testid":`app-route`,className:`flex h-full flex-col`,children:n?(0,$.jsx)(Ii,{onNavigateBack:()=>y(`/conversations/${t}`)}):(0,$.jsx)(Fi,{})})})})}function Hi(){return(0,$.jsx)(Vi,{})}var Ui=i(Hi);export{Ui as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./conversation-DTn8jN8L.js";export{e as default};
@@ -1 +1 @@
1
- import{D as e,d as t,n,r}from"./agent-server-client-options-HEOwGVIU.js";import{i,r as a,s as o}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-hTzSytKK.js";import{a as s,n as c,t as l}from"./agent-server-conversation-service.api-CORdqJZg.js";var u=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function d(e){let t=e.split(/[\\/]+/).filter(Boolean),n=t[t.length-1];if(!n||n===`.`||n===`..`)throw Error(`Invalid file name`);return n}function f(e){return e.startsWith(`/`)?e:`/${e}`}function p(e,t){let n=d(e);return`${f(t.replace(/\/+$/,``))}/${n}`}async function m(t,n){if(n?.id===t&&n.workspace?.working_dir?.trim())return n.workspace.working_dir.trim();let r=s(t);return r?.selected_workspace?.trim()?r.selected_workspace.trim():u.test(t)?l.resolveConversationWorkingDir(t):e()}var h=5;async function g(e,n){if(n?.id===e&&n.conversation_url?.trim()&&n.session_api_key?.trim())return{conversationUrl:n.conversation_url.trim(),sessionApiKey:n.session_api_key.trim()};if(t().backend.kind===`cloud`){let[t]=await c([e]);return{conversationUrl:t?.conversation_url?.trim()??null,sessionApiKey:t?.session_api_key?.trim()??null}}return{conversationUrl:null,sessionApiKey:null}}function _(e){if(!e.conversationUrl||!e.sessionApiKey)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return{conversationUrl:e.conversationUrl,sessionApiKey:e.sessionApiKey}}async function v(e,n,r){let i=await m(e,r),a=await g(e,r),o=t().backend.kind===`cloud`,s=r?.id===e?r.session_api_key??a.sessionApiKey:a.sessionApiKey,c=r?.id===e?r.conversation_url??a.conversationUrl:a.conversationUrl;if(o){let e=_({conversationUrl:c,sessionApiKey:s});return y({files:n,workingDir:i,conversationUrl:e.conversationUrl,sessionApiKey:e.sessionApiKey})}return y({files:n,workingDir:i,conversationUrl:c,sessionApiKey:s})}async function y(e){let{files:t,workingDir:r,conversationUrl:i,sessionApiKey:o}=e,s=new a(n({conversationUrl:i,sessionApiKey:o,workingDir:r})),c=async e=>{try{let t=d(e.name),n=p(e.name,r);return await s.fileUpload(e,n),{uploadedFile:t,skippedFile:null}}catch(t){return{uploadedFile:null,skippedFile:{name:e.name,reason:t instanceof Error?t.message:`Upload failed`}}}},l=[];for(let e=0;e<t.length;e+=h){let n=t.slice(e,e+h);l.push(...await Promise.all(n.map(c)))}return{uploaded_files:l.flatMap(e=>e.uploadedFile?[e.uploadedFile]:[]),skipped_files:l.flatMap(e=>e.skippedFile?[e.skippedFile]:[])}}var b=class{static currentConversation=null;static setCurrentConversation(e){this.currentConversation=e}static getClientOverrides(){return{sessionApiKey:this.currentConversation?.session_api_key}}static async getVSCodeUrl(t){let r=this.currentConversation?.id===t?this.currentConversation?.workspace?.working_dir??e():e();return{vscode_url:await new o(n(this.getClientOverrides())).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:r})}}static async getTrajectory(e){return{trajectory:(await new i(r(this.getClientOverrides()),e).search({limit:1e4})).items??[]}}static async uploadFiles(e,t){return v(e,t,this.currentConversation)}};export{g as n,v as r,b as t};
1
+ import{D as e,d as t,n,r}from"./agent-server-client-options-9agOSarV.js";import{i,r as a,s as o}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-D8soyAAx.js";import{a as s,n as c,t as l}from"./agent-server-conversation-service.api-B9TUYJon.js";var u=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function d(e){let t=e.split(/[\\/]+/).filter(Boolean),n=t[t.length-1];if(!n||n===`.`||n===`..`)throw Error(`Invalid file name`);return n}function f(e){return e.startsWith(`/`)?e:`/${e}`}function p(e,t){let n=d(e);return`${f(t.replace(/\/+$/,``))}/${n}`}async function m(t,n){if(n?.id===t&&n.workspace?.working_dir?.trim())return n.workspace.working_dir.trim();let r=s(t);return r?.selected_workspace?.trim()?r.selected_workspace.trim():u.test(t)?l.resolveConversationWorkingDir(t):e()}var h=5;async function g(e,n){if(n?.id===e&&n.conversation_url?.trim()&&n.session_api_key?.trim())return{conversationUrl:n.conversation_url.trim(),sessionApiKey:n.session_api_key.trim()};if(t().backend.kind===`cloud`){let[t]=await c([e]);return{conversationUrl:t?.conversation_url?.trim()??null,sessionApiKey:t?.session_api_key?.trim()??null}}return{conversationUrl:null,sessionApiKey:null}}function _(e){if(!e.conversationUrl||!e.sessionApiKey)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return{conversationUrl:e.conversationUrl,sessionApiKey:e.sessionApiKey}}async function v(e,n,r){let i=await m(e,r),a=await g(e,r),o=t().backend.kind===`cloud`,s=r?.id===e?r.session_api_key??a.sessionApiKey:a.sessionApiKey,c=r?.id===e?r.conversation_url??a.conversationUrl:a.conversationUrl;if(o){let e=_({conversationUrl:c,sessionApiKey:s});return y({files:n,workingDir:i,conversationUrl:e.conversationUrl,sessionApiKey:e.sessionApiKey})}return y({files:n,workingDir:i,conversationUrl:c,sessionApiKey:s})}async function y(e){let{files:t,workingDir:r,conversationUrl:i,sessionApiKey:o}=e,s=new a(n({conversationUrl:i,sessionApiKey:o,workingDir:r})),c=async e=>{try{let t=d(e.name),n=p(e.name,r);return await s.fileUpload(e,n),{uploadedFile:t,skippedFile:null}}catch(t){return{uploadedFile:null,skippedFile:{name:e.name,reason:t instanceof Error?t.message:`Upload failed`}}}},l=[];for(let e=0;e<t.length;e+=h){let n=t.slice(e,e+h);l.push(...await Promise.all(n.map(c)))}return{uploaded_files:l.flatMap(e=>e.uploadedFile?[e.uploadedFile]:[]),skipped_files:l.flatMap(e=>e.skippedFile?[e.skippedFile]:[])}}var b=class{static currentConversation=null;static setCurrentConversation(e){this.currentConversation=e}static getClientOverrides(){return{sessionApiKey:this.currentConversation?.session_api_key}}static async getVSCodeUrl(t){let r=this.currentConversation?.id===t?this.currentConversation?.workspace?.working_dir??e():e();return{vscode_url:await new o(n(this.getClientOverrides())).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:r})}}static async getTrajectory(e){return{trajectory:(await new i(r(this.getClientOverrides()),e).search({limit:1e4})).items??[]}}static async uploadFiles(e,t){return v(e,t,this.currentConversation)}};export{g as n,v as r,b as t};