@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{I as n,L as r,M as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.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{t as l}from"./modal-backdrop-RfNCrSpK.js";import{r as u,t as d}from"./modal-body-aoa2fx5W.js";import{t as f}from"./brand-button-DJ_S16rO.js";import{t as p}from"./modal-close-button-CtWOUMmw.js";import{t as m}from"./settings-input-CehsXnb3.js";import{t as h}from"./use-create-conversation-Bszyp13O.js";import{r as g}from"./typography-BDgnT7Yp.js";import{n as _,t as v}from"./vendor~launch-BXgl67Re.js";var y=e(t(),1),b=a();function x({pluginIndex:e,paramKey:t,paramValue:n,onParameterChange:r}){let i=`plugin-${e}-param-${t}`;return typeof n==`boolean`?(0,b.jsxs)(`label`,{htmlFor:i,className:`flex w-full cursor-pointer items-center gap-2.5`,children:[(0,b.jsx)(`input`,{id:i,"data-testid":i,type:`checkbox`,checked:n,onChange:n=>r(e,t,n.target.checked),className:`h-4 w-4 shrink-0 rounded`}),(0,b.jsx)(`span`,{className:`text-sm`,children:t})]}):typeof n==`number`?(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`number`,label:t,value:String(n),className:`w-full`,onChange:n=>r(e,t,n===``?0:parseFloat(n)||0)}):(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`text`,label:t,value:String(n??``),className:`w-full`,onChange:n=>r(e,t,n)})}function S({plugin:e,originalIndex:t,isExpanded:n,onToggle:r,getPluginDisplayName:i,onParameterChange:a}){let{t:c}=s(`openhands`);return e.parameters&&Object.keys(e.parameters).length>0?(0,b.jsxs)(`div`,{className:`rounded-lg border border-[var(--oh-border)] bg-tertiary`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-between px-4 py-3 text-left hover:bg-base-tertiary rounded-t-lg cursor-pointer`,"data-testid":`plugin-section-${t}`,children:[(0,b.jsx)(g.Text,{className:`text-base font-normal`,children:i(e)}),n?(0,b.jsx)(v,{className:`h-5 w-5 text-white`}):(0,b.jsx)(_,{className:`h-5 w-5 text-white`})]}),n&&(0,b.jsxs)(`div`,{className:`border-t border-[var(--oh-border-subtle)] px-4 pb-3`,children:[e.ref&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[c(o.LAUNCH$PLUGIN_REF),` `,e.ref]}),e.repo_path&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[c(o.LAUNCH$PLUGIN_PATH),` `,e.repo_path]}),(0,b.jsx)(`div`,{className:`flex flex-col gap-4`,children:Object.entries(e.parameters||{}).map(([e,n])=>(0,b.jsx)(x,{pluginIndex:t,paramKey:e,paramValue:n,onParameterChange:a},e))})]})]}):null}function C({plugins:e,message:t,isLoading:n=!1,onStartConversation:r,onClose:i}){let{t:a}=s(`openhands`),[m,h]=y.useState(e),[_,v]=y.useState(()=>{let t={};return e.forEach((e,n)=>{e.parameters&&Object.keys(e.parameters).length>0&&(t[n]=!0)}),t}),[x,C]=y.useState(!1),w=m.filter(e=>e.parameters&&Object.keys(e.parameters).length>0),T=m.filter(e=>!e.parameters||Object.keys(e.parameters).length===0),E=e=>{v(t=>({...t,[e]:!t[e]}))},D=(e,t,n)=>{h(r=>{let i=[...r],a={...i[e]};return a.parameters={...a.parameters,[t]:n},i[e]=a,i})},O=e=>{let{source:t,repo_path:n}=e;if(n){let e=n.split(`/`);return e[e.length-1]}if(t.startsWith(`github:`))return t.replace(`github:`,``);if(t.includes(`/`)){let e=t.split(`/`);return e[e.length-1].replace(`.git`,``)}return t},k=e=>{let{source:t}=e;return t.startsWith(`github:`)?t.replace(`github:`,``):t.includes(`github.com/`)&&t.split(`github.com/`)[1]?.replace(`.git`,``)||t},A=()=>{let e=m.map(e=>k(e));return[...new Set(e)]},j=()=>{r(m,t)},M=m.length===1?O(m[0]):a(o.LAUNCH$MODAL_TITLE_GENERIC);return(0,b.jsx)(l,{onClose:i,children:(0,b.jsxs)(`div`,{"data-testid":`plugin-launch-modal`,className:c(`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)] max-h-[80vh]`,u(`md`),d),children:[(0,b.jsx)(p,{onClose:i,testId:`close-button`}),(0,b.jsxs)(g.H2,{className:`pr-6`,children:[a(o.LAUNCH$MODAL_TITLE),` `,M]}),t&&(0,b.jsx)(`p`,{className:`text-sm text-white`,children:t}),(0,b.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar`,children:[w.length>0&&(0,b.jsx)(`div`,{className:`space-y-3`,children:m.map((e,t)=>(0,b.jsx)(S,{plugin:e,originalIndex:t,isExpanded:!!_[t],onToggle:()=>E(t),getPluginDisplayName:O,onParameterChange:D},`plugin-${t}`))}),T.length>0&&(0,b.jsxs)(`div`,{className:c(w.length>0&&`mt-4`),children:[(0,b.jsx)(g.H3,{className:`mb-2 text-white`,children:w.length>0?a(o.LAUNCH$ADDITIONAL_PLUGINS):a(o.LAUNCH$PLUGINS)}),(0,b.jsx)(`div`,{className:`space-y-2`,children:T.map((e,t)=>(0,b.jsxs)(`div`,{className:`rounded-md bg-tertiary px-3 py-2 text-sm`,children:[(0,b.jsx)(`div`,{className:`font-medium`,children:O(e)}),(0,b.jsxs)(`div`,{className:`text-xs text-white mt-1`,children:[k(e),e.repo_path&&(0,b.jsxs)(`span`,{className:`ml-1`,children:[`/ `,e.repo_path]}),e.ref&&(0,b.jsxs)(`span`,{className:`ml-2`,children:[`@ `,e.ref]})]})]},`simple-plugin-${t}`))})]})]}),(0,b.jsxs)(`div`,{className:`pt-4 border-t border-[var(--oh-border-subtle)]`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,b.jsx)(`input`,{id:`trust-checkbox`,"data-testid":`trust-checkbox`,type:`checkbox`,checked:x,onChange:e=>C(e.target.checked),className:`mt-1 h-4 w-4 flex-shrink-0`}),(0,b.jsx)(`label`,{htmlFor:`trust-checkbox`,className:`text-sm text-white`,children:a(o.LAUNCH$TRUST_SKILL_CHECKBOX,{sources:A().join(`, `),interpolation:{escapeValue:!1}})})]}),(0,b.jsx)(`div`,{className:`flex w-full justify-end mt-8`,children:(0,b.jsx)(f,{testId:`start-conversation-button`,type:`button`,variant:`primary`,onClick:j,isDisabled:n||!x,className:`px-4`,children:a(n?o.LAUNCH$STARTING:o.LAUNCH$START_CONVERSATION)})})]})]})})}function w(e){if(e)return e.replace(/<[^>]*>/g,``).slice(0,500)||void 0}function T(e){let t=e.get(`plugins`);if(t)try{let n=atob(t),r=JSON.parse(n);if(!Array.isArray(r))return{plugins:[],error:`invalid_format`};let i=[];for(let e of r){if(typeof e!=`object`||!e||typeof e.source!=`string`)return{plugins:[],error:`invalid_format`};i.push({source:e.source,ref:e.ref??null,repo_path:e.repo_path??null,parameters:e.parameters??null})}return i.length===0?{plugins:[],error:`no_plugins`}:{plugins:i,message:w(e.get(`message`))}}catch{return{plugins:[],error:`invalid_format`}}let n=e.get(`plugin_source`);return n?{plugins:[{source:n,ref:e.get(`plugin_ref`)??null,repo_path:e.get(`plugin_repo_path`)??null,parameters:null}],message:w(e.get(`message`))}:{plugins:[],error:`no_plugins`}}function E({errorType:e,onGoHome:t,onTryAgain:n}){let{t:r}=s(`openhands`),i={no_plugins:r(o.LAUNCH$ERROR_NO_PLUGINS),invalid_format:r(o.LAUNCH$ERROR_INVALID_FORMAT),creation_failed:r(o.LAUNCH$ERROR_CREATION_FAILED)};return(0,b.jsx)(`div`,{className:`flex h-full items-center justify-center`,"data-testid":`launch-error`,children:(0,b.jsxs)(`div`,{className:`max-w-md rounded-lg bg-[var(--oh-surface)] p-6 text-center`,children:[(0,b.jsx)(`h2`,{className:`mb-4 text-xl font-medium text-red-400`,children:r(o.LAUNCH$ERROR_TITLE)}),(0,b.jsx)(`p`,{className:`mb-6 text-[var(--oh-text-tertiary)]`,children:i[e]}),(0,b.jsxs)(`div`,{className:`flex justify-center gap-3`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md bg-tertiary px-4 py-2 text-sm text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`go-home-button`,children:r(o.LAUNCH$GO_HOME)}),n&&(0,b.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md bg-blue-600 px-4 py-2 text-sm text-white hover:bg-blue-700`,"data-testid":`try-again-button`,children:r(o.LAUNCH$TRY_AGAIN)})]})]})})}var D=r(function(){let[e]=n(),t=i(),{t:r}=s(`openhands`),a=h(),[c,l]=y.useState(null),u=y.useMemo(()=>T(e),[e]),d=async(e,n)=>{l(null);try{t(`/conversations/${(await a.mutateAsync({plugins:e,query:n})).conversation_id}`)}catch{l(r(o.LAUNCH$ERROR_CREATION_UNKNOWN))}},f=()=>{t(`/conversations`)};return u.error?(0,b.jsx)(E,{errorType:u.error,onGoHome:f}):c?(0,b.jsx)(E,{errorType:`creation_failed`,onGoHome:f,onTryAgain:()=>{l(null),window.location.reload()}}):(0,b.jsx)(`div`,{className:`h-full`,"data-testid":`launch-route`,children:(0,b.jsx)(C,{plugins:u.plugins,message:u.message,isLoading:a.isPending,onStartConversation:d,onClose:f})})});export{D as default};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{I as n,L as r,M as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.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{t as l}from"./modal-backdrop-RfNCrSpK.js";import{r as u,t as d}from"./modal-body-aoa2fx5W.js";import{t as f}from"./brand-button-DJ_S16rO.js";import{t as p}from"./modal-close-button-CtWOUMmw.js";import{t as m}from"./settings-input-CehsXnb3.js";import{t as h}from"./use-create-conversation-B-lwTnfE.js";import{r as g}from"./typography-BDgnT7Yp.js";import{n as _,t as v}from"./vendor~launch-BXgl67Re.js";var y=e(t(),1),b=a();function x({pluginIndex:e,paramKey:t,paramValue:n,onParameterChange:r}){let i=`plugin-${e}-param-${t}`;return typeof n==`boolean`?(0,b.jsxs)(`label`,{htmlFor:i,className:`flex w-full cursor-pointer items-center gap-2.5`,children:[(0,b.jsx)(`input`,{id:i,"data-testid":i,type:`checkbox`,checked:n,onChange:n=>r(e,t,n.target.checked),className:`h-4 w-4 shrink-0 rounded`}),(0,b.jsx)(`span`,{className:`text-sm`,children:t})]}):typeof n==`number`?(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`number`,label:t,value:String(n),className:`w-full`,onChange:n=>r(e,t,n===``?0:parseFloat(n)||0)}):(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`text`,label:t,value:String(n??``),className:`w-full`,onChange:n=>r(e,t,n)})}function S({plugin:e,originalIndex:t,isExpanded:n,onToggle:r,getPluginDisplayName:i,onParameterChange:a}){let{t:c}=s(`openhands`);return e.parameters&&Object.keys(e.parameters).length>0?(0,b.jsxs)(`div`,{className:`rounded-lg border border-[var(--oh-border)] bg-tertiary`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-between px-4 py-3 text-left hover:bg-base-tertiary rounded-t-lg cursor-pointer`,"data-testid":`plugin-section-${t}`,children:[(0,b.jsx)(g.Text,{className:`text-base font-normal`,children:i(e)}),n?(0,b.jsx)(v,{className:`h-5 w-5 text-white`}):(0,b.jsx)(_,{className:`h-5 w-5 text-white`})]}),n&&(0,b.jsxs)(`div`,{className:`border-t border-[var(--oh-border-subtle)] px-4 pb-3`,children:[e.ref&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[c(o.LAUNCH$PLUGIN_REF),` `,e.ref]}),e.repo_path&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[c(o.LAUNCH$PLUGIN_PATH),` `,e.repo_path]}),(0,b.jsx)(`div`,{className:`flex flex-col gap-4`,children:Object.entries(e.parameters||{}).map(([e,n])=>(0,b.jsx)(x,{pluginIndex:t,paramKey:e,paramValue:n,onParameterChange:a},e))})]})]}):null}function C({plugins:e,message:t,isLoading:n=!1,onStartConversation:r,onClose:i}){let{t:a}=s(`openhands`),[m,h]=y.useState(e),[_,v]=y.useState(()=>{let t={};return e.forEach((e,n)=>{e.parameters&&Object.keys(e.parameters).length>0&&(t[n]=!0)}),t}),[x,C]=y.useState(!1),w=m.filter(e=>e.parameters&&Object.keys(e.parameters).length>0),T=m.filter(e=>!e.parameters||Object.keys(e.parameters).length===0),E=e=>{v(t=>({...t,[e]:!t[e]}))},D=(e,t,n)=>{h(r=>{let i=[...r],a={...i[e]};return a.parameters={...a.parameters,[t]:n},i[e]=a,i})},O=e=>{let{source:t,repo_path:n}=e;if(n){let e=n.split(`/`);return e[e.length-1]}if(t.startsWith(`github:`))return t.replace(`github:`,``);if(t.includes(`/`)){let e=t.split(`/`);return e[e.length-1].replace(`.git`,``)}return t},k=e=>{let{source:t}=e;return t.startsWith(`github:`)?t.replace(`github:`,``):t.includes(`github.com/`)&&t.split(`github.com/`)[1]?.replace(`.git`,``)||t},A=()=>{let e=m.map(e=>k(e));return[...new Set(e)]},j=()=>{r(m,t)},M=m.length===1?O(m[0]):a(o.LAUNCH$MODAL_TITLE_GENERIC);return(0,b.jsx)(l,{onClose:i,children:(0,b.jsxs)(`div`,{"data-testid":`plugin-launch-modal`,className:c(`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)] max-h-[80vh]`,u(`md`),d),children:[(0,b.jsx)(p,{onClose:i,testId:`close-button`}),(0,b.jsxs)(g.H2,{className:`pr-6`,children:[a(o.LAUNCH$MODAL_TITLE),` `,M]}),t&&(0,b.jsx)(`p`,{className:`text-sm text-white`,children:t}),(0,b.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar`,children:[w.length>0&&(0,b.jsx)(`div`,{className:`space-y-3`,children:m.map((e,t)=>(0,b.jsx)(S,{plugin:e,originalIndex:t,isExpanded:!!_[t],onToggle:()=>E(t),getPluginDisplayName:O,onParameterChange:D},`plugin-${t}`))}),T.length>0&&(0,b.jsxs)(`div`,{className:c(w.length>0&&`mt-4`),children:[(0,b.jsx)(g.H3,{className:`mb-2 text-white`,children:w.length>0?a(o.LAUNCH$ADDITIONAL_PLUGINS):a(o.LAUNCH$PLUGINS)}),(0,b.jsx)(`div`,{className:`space-y-2`,children:T.map((e,t)=>(0,b.jsxs)(`div`,{className:`rounded-md bg-tertiary px-3 py-2 text-sm`,children:[(0,b.jsx)(`div`,{className:`font-medium`,children:O(e)}),(0,b.jsxs)(`div`,{className:`text-xs text-white mt-1`,children:[k(e),e.repo_path&&(0,b.jsxs)(`span`,{className:`ml-1`,children:[`/ `,e.repo_path]}),e.ref&&(0,b.jsxs)(`span`,{className:`ml-2`,children:[`@ `,e.ref]})]})]},`simple-plugin-${t}`))})]})]}),(0,b.jsxs)(`div`,{className:`pt-4 border-t border-[var(--oh-border-subtle)]`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,b.jsx)(`input`,{id:`trust-checkbox`,"data-testid":`trust-checkbox`,type:`checkbox`,checked:x,onChange:e=>C(e.target.checked),className:`mt-1 h-4 w-4 flex-shrink-0`}),(0,b.jsx)(`label`,{htmlFor:`trust-checkbox`,className:`text-sm text-white`,children:a(o.LAUNCH$TRUST_SKILL_CHECKBOX,{sources:A().join(`, `),interpolation:{escapeValue:!1}})})]}),(0,b.jsx)(`div`,{className:`flex w-full justify-end mt-8`,children:(0,b.jsx)(f,{testId:`start-conversation-button`,type:`button`,variant:`primary`,onClick:j,isDisabled:n||!x,className:`px-4`,children:a(n?o.LAUNCH$STARTING:o.LAUNCH$START_CONVERSATION)})})]})]})})}function w(e){if(e)return e.replace(/<[^>]*>/g,``).slice(0,500)||void 0}function T(e){let t=e.get(`plugins`);if(t)try{let n=atob(t),r=JSON.parse(n);if(!Array.isArray(r))return{plugins:[],error:`invalid_format`};let i=[];for(let e of r){if(typeof e!=`object`||!e||typeof e.source!=`string`)return{plugins:[],error:`invalid_format`};i.push({source:e.source,ref:e.ref??null,repo_path:e.repo_path??null,parameters:e.parameters??null})}return i.length===0?{plugins:[],error:`no_plugins`}:{plugins:i,message:w(e.get(`message`))}}catch{return{plugins:[],error:`invalid_format`}}let n=e.get(`plugin_source`);return n?{plugins:[{source:n,ref:e.get(`plugin_ref`)??null,repo_path:e.get(`plugin_repo_path`)??null,parameters:null}],message:w(e.get(`message`))}:{plugins:[],error:`no_plugins`}}function E({errorType:e,onGoHome:t,onTryAgain:n}){let{t:r}=s(`openhands`),i={no_plugins:r(o.LAUNCH$ERROR_NO_PLUGINS),invalid_format:r(o.LAUNCH$ERROR_INVALID_FORMAT),creation_failed:r(o.LAUNCH$ERROR_CREATION_FAILED)};return(0,b.jsx)(`div`,{className:`flex h-full items-center justify-center`,"data-testid":`launch-error`,children:(0,b.jsxs)(`div`,{className:`max-w-md rounded-lg bg-[var(--oh-surface)] p-6 text-center`,children:[(0,b.jsx)(`h2`,{className:`mb-4 text-xl font-medium text-red-400`,children:r(o.LAUNCH$ERROR_TITLE)}),(0,b.jsx)(`p`,{className:`mb-6 text-[var(--oh-text-tertiary)]`,children:i[e]}),(0,b.jsxs)(`div`,{className:`flex justify-center gap-3`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md bg-tertiary px-4 py-2 text-sm text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`go-home-button`,children:r(o.LAUNCH$GO_HOME)}),n&&(0,b.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md bg-blue-600 px-4 py-2 text-sm text-white hover:bg-blue-700`,"data-testid":`try-again-button`,children:r(o.LAUNCH$TRY_AGAIN)})]})]})})}var D=r(function(){let[e]=n(),t=i(),{t:r}=s(`openhands`),a=h(),[c,l]=y.useState(null),u=y.useMemo(()=>T(e),[e]),d=async(e,n)=>{l(null);try{t(`/conversations/${(await a.mutateAsync({plugins:e,query:n})).conversation_id}`)}catch{l(r(o.LAUNCH$ERROR_CREATION_UNKNOWN))}},f=()=>{t(`/conversations`)};return u.error?(0,b.jsx)(E,{errorType:u.error,onGoHome:f}):c?(0,b.jsx)(E,{errorType:`creation_failed`,onGoHome:f,onTryAgain:()=>{l(null),window.location.reload()}}):(0,b.jsx)(`div`,{className:`h-full`,"data-testid":`launch-route`,children:(0,b.jsx)(C,{plugins:u.plugins,message:u.message,isLoading:a.isPending,onStartConversation:d,onClose:f})})});export{D as default};
@@ -1 +1 @@
1
- import{c as e}from"./agent-server-client-options-HEOwGVIU.js";var t=class{constructor(t){this.host=t.host.replace(/\/$/,``),this.apiKey=t.apiKey,this.client=new e({baseUrl:this.host,apiKey:this.apiKey,timeout:t.timeout||6e4})}async getProviders(){return(await this.client.get(`/api/llm/providers`)).data.providers}async getModels(e){return(await this.client.get(`/api/llm/models`,{params:e?{provider:e}:void 0})).data.models}async getVerifiedModels(){return(await this.client.get(`/api/llm/models/verified`)).data.models}close(){this.client.close()}};export{t};
1
+ import{c as e}from"./agent-server-client-options-9agOSarV.js";var t=class{constructor(t){this.host=t.host.replace(/\/$/,``),this.apiKey=t.apiKey,this.client=new e({baseUrl:this.host,apiKey:this.apiKey,timeout:t.timeout||6e4})}async getProviders(){return(await this.client.get(`/api/llm/providers`)).data.providers}async getModels(e){return(await this.client.get(`/api/llm/models`,{params:e?{provider:e}:void 0})).data.models}async getVerifiedModels(){return(await this.client.get(`/api/llm/models/verified`)).data.models}close(){this.client.close()}};export{t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as r}from"./react-dom-hVBnwgwZ.js";import{t as i}from"./useMutation-GSSKKebK.js";import{o as a,t as o}from"./declaration-CR6HMp29.js";import{n as s}from"./QueryClientProvider-Cnr-Yl3j.js";import{t as c}from"./useTranslation-B6voJV4y.js";import{t as l}from"./createLucideIcon-Ddu8jDOQ.js";import{t as u}from"./back-nav-button-7dQJ2k3O.js";import{n as d,r as f}from"./custom-toast-handlers-ufGJ6_Rc.js";import{t as p}from"./utils-DCVfKFRt.js";import{n as m}from"./active-backend-context-Beu-LZL-.js";import{a as h,n as g}from"./query-keys-tAsQcc_9.js";import{t as _}from"./modal-backdrop-RfNCrSpK.js";import{r as v,t as y}from"./modal-body-aoa2fx5W.js";import{r as b}from"./base-modal-C2oy2EBG.js";import{t as x}from"./brand-button-DJ_S16rO.js";import{t as S}from"./loading-spinner-5GT9q1xy.js";import{n as C,t as w}from"./model-selector-BvSTrkhT.js";import{i as T}from"./dropdown-classes-BsVmxlNG.js";import{t as E}from"./settings-input-CehsXnb3.js";import{t as D}from"./settings-DGY6n4J2.js";import{t as O}from"./settings-service.api-C3rxTtPj.js";import{r as k}from"./use-settings-D5hbTS9t.js";import{i as A,r as j,t as M}from"./ellipsis-button-Vh5MvRZa.js";import{t as N}from"./u-edit-BbrptMCa.js";import{n as P,t as F}from"./use-llm-profiles-C861aFAq.js";import{r as ee}from"./typography-BDgnT7Yp.js";import{c as te,d as I,u as ne}from"./sdk-settings-schema-CLmJ9sho.js";import{t as L}from"./use-agent-settings-schema-CLoTOSJI.js";import{t as re}from"./sdk-section-page-BgDlMhcq.js";import{t as ie}from"./u-check-circle-DOauqQKb.js";import{i as ae,n as oe,r as se,t as ce}from"./settings-list-classes-E3v_f6QG.js";import{n as le}from"./settings-section-header-context-DewwJ0-F.js";var ue=l(`text-cursor`,[[`path`,{d:`M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1`,key:`uvaxm9`}],[`path`,{d:`M7 22h1a4 4 0 0 0 4-4v-1`,key:`11xy8d`}],[`path`,{d:`M7 2h1a4 4 0 0 1 4 4v1`,key:`1uw06m`}]]),R=e(t()),z=a(),de=e=>(0,z.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,z.jsx)(`path`,{d:`M9.9509 15.588H10.8349L16.5125 9.91042L15.6285 9.0264L10.3991 14.2681L8.00867 11.8777L7.12465 12.7617L9.9509 15.588Z`,fill:`currentColor`}),(0,z.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.8521 3.29895C14.8443 3.42346 16.712 4.41954 18.0816 5.78916C19.7002 7.53231 20.5718 9.64898 20.5718 12.1392C20.5718 14.1314 19.8247 15.999 18.5796 17.6177C17.3345 19.1118 15.5914 20.2324 13.5992 20.6059C11.607 20.9794 9.61486 20.7304 7.87171 19.7343C6.12856 18.7382 4.75895 17.2441 4.01189 15.3765C3.26482 13.5088 3.14031 11.3921 3.76286 9.52447C4.38542 7.53231 5.50601 5.91367 7.24916 4.79308C8.86779 3.67248 10.86 3.17444 12.8521 3.29895ZM13.4747 19.3608C15.0933 18.9873 16.5874 18.1157 17.708 16.7461C18.7041 15.3765 19.3267 13.7578 19.2022 12.0147C19.2022 10.0225 18.4551 8.03035 17.0855 6.66073C15.8404 5.41563 14.3463 4.66857 12.6031 4.54405C10.9845 4.41954 9.24132 4.79308 7.87171 5.78916C6.50209 6.78524 5.50601 8.15486 5.00797 9.89801C4.50993 11.5166 4.50993 13.2598 5.25699 14.8784C6.00405 16.4971 7.12465 17.7422 8.61877 18.6137C10.1129 19.4853 11.856 19.7343 13.4747 19.3608Z`,fill:`currentColor`})]});function fe({testId:e,isSet:t}){return(0,z.jsx)(`span`,{"data-testid":e||(t?`set-indicator`:`unset-indicator`),children:(0,z.jsx)(de,{className:p(t?`text-success`:`text-danger`)})})}var B=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;function V(e,{isRequired:t=!1}={}){return e===``?!t:B.test(e)}function H(e){let t=e.split(`/`),n=(t[t.length-1]||e).replace(/[^A-Za-z0-9._-]/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``);return n&&!/^[A-Za-z0-9]/.test(n)&&(n=`profile-${n}`),n.length>64&&(n=n.substring(0,64).replace(/-+$/,``)),n||`default-profile`}var U=(0,R.forwardRef)(function({testId:e,ruleTestId:t,value:n,onChange:r,onKeyDown:i,placeholder:a,isDisabled:s,isOptional:l,isRequired:u=!1},d){let{t:f}=c(`openhands`),m=V(n,{isRequired:u}),h=l?`${f(o.SETTINGS$PROFILE_NAME_LABEL)} (${f(o.COMMON$OPTIONAL)})`:f(o.SETTINGS$PROFILE_NAME_LABEL),g=R.useId(),_=t??`${g}-rule`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(E,{ref:d,testId:e,label:h,type:`text`,className:`w-full`,value:n,placeholder:a??f(o.SETTINGS$PROFILE_NAME_PLACEHOLDER),onChange:r,onKeyDown:i,isDisabled:s,ariaDescribedBy:_,ariaInvalid:!m}),(0,z.jsx)(`p`,{id:_,"data-testid":t,className:p(`text-xs`,m?`text-[var(--oh-muted)]`:`text-red-400`),children:f(o.SETTINGS$PROFILE_NAME_RULE)})]})});function W({isOpen:e,title:t,width:n=`md`,children:r,footer:i,onClose:a,initialFocusRef:o}){let s=(0,R.useRef)(null);return(0,R.useEffect)(()=>{if(!e)return;let t=o?.current??s.current;if(t){let e=setTimeout(()=>{t.focus()},0);return()=>clearTimeout(e)}},[e,o]),(0,R.useEffect)(()=>{if(!e||!s.current)return;let t=s.current,n=e=>{if(e.key!==`Tab`)return;let n=t.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`),r=n[0],i=n[n.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r?.focus())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e]),e?(0,z.jsx)(_,{onClose:a,children:(0,z.jsxs)(`div`,{ref:s,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`modal-title`,className:p(`bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)]`,v(n),y),children:[(0,z.jsx)(b,{id:`modal-title`,title:t}),r,(0,z.jsx)(`div`,{className:`w-full flex justify-end gap-2 mt-2`,children:i})]})}):null}function pe(){let e=s();return i({mutationFn:({name:e,newName:t})=>P.renameProfile(e,t),onSuccess:async()=>{O.invalidateCache(),await e.invalidateQueries({queryKey:g.all}),await e.invalidateQueries({queryKey:h.personal()})},meta:{disableToast:!0}})}function me({profile:e,onClose:t}){let{t:n}=c(`openhands`),[r,i]=(0,R.useState)(``),a=pe(),s=(0,R.useRef)(null);if((0,R.useEffect)(()=>{i(e?.name??``)},[e?.name]),!e)return null;let l=V(r,{isRequired:!0}),u=r===e.name,p=async()=>{if(!l){d(n(o.SETTINGS$PROFILE_NAME_RULE));return}if(u){t();return}try{await a.mutateAsync({name:e.name,newName:r}),f(n(o.SETTINGS$PROFILE_RENAMED,{name:r})),t()}catch(e){d(e instanceof Error?e.message:n(o.ERROR$GENERIC))}},m=()=>{a.isPending||t()},h=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(x,{type:`button`,variant:`tertiary`,onClick:m,isDisabled:a.isPending,children:n(o.BUTTON$CANCEL)}),(0,z.jsx)(x,{testId:`rename-profile-submit`,type:`button`,variant:`primary`,onClick:p,isDisabled:a.isPending||!l,children:a.isPending?(0,z.jsx)(S,{size:`small`}):n(o.BUTTON$RENAME)})]});return(0,z.jsx)(W,{isOpen:!0,title:n(o.SETTINGS$PROFILE_RENAME_TITLE),footer:h,onClose:m,initialFocusRef:s,children:(0,z.jsx)(`div`,{"data-testid":`rename-profile-modal`,className:`flex flex-col gap-3`,children:(0,z.jsx)(U,{ref:s,testId:`rename-profile-input`,ruleTestId:`rename-profile-rule`,value:r,onChange:i,isRequired:!0,onKeyDown:e=>{e.key===`Enter`&&!a.isPending&&l&&p()}})})})}function he(){let e=s();return i({mutationFn:e=>P.deleteProfile(e),onSuccess:async()=>{O.invalidateCache(),await e.invalidateQueries({queryKey:g.all}),await e.invalidateQueries({queryKey:h.personal()})},meta:{disableToast:!0}})}function ge({profile:e,onClose:t}){let{t:n}=c(`openhands`),r=he(),i=(0,R.useRef)(null);if(!e)return null;let a=async()=>{try{await r.mutateAsync(e.name),f(n(o.SETTINGS$PROFILE_DELETED,{name:e.name})),t()}catch(e){d(e instanceof Error?e.message:n(o.ERROR$GENERIC))}},s=()=>{r.isPending||t()},l=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(x,{ref:i,type:`button`,variant:`tertiary`,onClick:s,isDisabled:r.isPending,children:n(o.BUTTON$CANCEL)}),(0,z.jsx)(x,{testId:`delete-profile-confirm`,type:`button`,variant:`danger`,onClick:a,isDisabled:r.isPending,"aria-busy":r.isPending,children:r.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(S,{size:`small`}),(0,z.jsx)(`span`,{className:`sr-only`,children:n(o.BUTTON$DELETE)})]}):n(o.BUTTON$DELETE)})]});return(0,z.jsx)(W,{isOpen:!0,title:n(o.SETTINGS$PROFILE_DELETE_TITLE),footer:l,onClose:s,initialFocusRef:i,children:(0,z.jsx)(`p`,{className:`text-sm break-all`,children:n(o.SETTINGS$PROFILE_DELETE_CONFIRMATION,{name:e.name})})})}var _e=e(r(),1);function G({index:e,icon:t,label:n,onClick:r,onKeyDown:i,menuItemsRef:a,disabled:o,testId:s}){return(0,z.jsx)(`button`,{ref:t=>{a.current[e]=t},type:`button`,onClick:r,onKeyDown:t=>i(t,e),disabled:o,className:p(`group w-full cursor-pointer rounded px-2 py-2 text-start text-nowrap text-sm font-normal`,`text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent`),role:`menuitem`,"data-testid":s,children:(0,z.jsx)(A,{icon:t,text:n})})}function ve({onEdit:e,onRename:t,onSetActive:n,onDelete:r,isActive:i,isActivating:a,onClose:s,anchorRef:l}){let{t:u}=c(`openhands`),d=(0,R.useRef)(null),f=(0,R.useRef)([]),m=l?.current??null,[h,g]=(0,R.useState)();(0,R.useLayoutEffect)(()=>{if(!m)return;let e=()=>{let e=m.getBoundingClientRect();e&&g({position:`fixed`,zIndex:9999,top:e.bottom+8,right:window.innerWidth-e.right,width:`max-content`})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[m]),(0,R.useEffect)(()=>{f.current[0]?.focus()},[]),(0,R.useEffect)(()=>{let e=e=>{let t=e.target;d.current&&!d.current.contains(t)&&s()},t=e=>{e.key===`Escape`&&s()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[s]);let _=e=>{e(),s()},v=(0,R.useCallback)((e,t)=>{if(e.key===`Tab`){s();return}let n=f.current.filter(Boolean).length;if(e.key===`ArrowDown`){e.preventDefault();let r=(t+1)%n;f.current[r]?.focus()}else if(e.key===`ArrowUp`){e.preventDefault();let r=(t-1+n)%n;f.current[r]?.focus()}},[s]),y=i||a,b=!!m,x=(0,z.jsxs)(`div`,{ref:d,className:p(`absolute right-0 top-full z-10 mt-2 w-[160px] rounded-md border border-[var(--oh-border-subtle)] bg-tertiary px-1 py-1 shadow-lg`,T,b&&`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`),role:`menu`,"aria-orientation":`vertical`,"data-testid":`profile-actions-menu`,children:[(0,z.jsx)(G,{index:0,icon:(0,z.jsx)(N,{width:16,height:16}),label:u(o.SETTINGS$PROFILE_EDIT),onClick:()=>_(e),onKeyDown:v,menuItemsRef:f,testId:`profile-edit`}),(0,z.jsx)(G,{index:1,icon:(0,z.jsx)(ue,{"aria-hidden":!0,className:`size-4`,strokeWidth:2}),label:u(o.BUTTON$RENAME),onClick:()=>_(t),onKeyDown:v,menuItemsRef:f,testId:`profile-rename`}),(0,z.jsx)(G,{index:2,icon:(0,z.jsx)(ie,{width:16,height:16}),label:u(o.SETTINGS$PROFILE_SET_ACTIVE),onClick:()=>_(n),onKeyDown:v,menuItemsRef:f,disabled:y,testId:`profile-set-active`}),(0,z.jsx)(G,{index:3,icon:(0,z.jsx)(j,{width:16,height:16}),label:u(o.BUTTON$DELETE),onClick:()=>_(r),onKeyDown:v,menuItemsRef:f,testId:`profile-delete`})]});return b?typeof document>`u`||!h?null:_e.createPortal((0,z.jsx)(`div`,{style:h,children:x}),document.body):x}function ye({children:e,className:t,...n}){return(0,z.jsx)(`span`,{className:p(`text-sm leading-4 text-black font-semibold tracking-tighter bg-primary p-1 rounded-full`,t),...n,children:e})}function be({profile:e,isActive:t,onActivate:n,onEdit:r,onRename:i,onDelete:a,isActivating:s}){let{t:l}=c(`openhands`),[u,d]=(0,R.useState)(!1),f=(0,R.useRef)(null);return(0,z.jsxs)(`div`,{"data-testid":`profile-row`,className:p(ae,`justify-between gap-3`),children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm font-medium text-white`,title:e.name,children:e.name}),e.model?(0,z.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm text-[var(--oh-muted)]`,title:e.model,children:e.model}):null,t&&(0,z.jsx)(ye,{className:`shrink-0 whitespace-nowrap px-2.5 py-1 text-xs`,"data-testid":`profile-active-badge`,children:l(o.SETTINGS$PROFILE_ACTIVE)})]}),(0,z.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,z.jsx)(M,{ref:f,onClick:()=>d(e=>!e),ariaLabel:l(o.SETTINGS$PROFILE_MENU),testId:`profile-menu-trigger`,className:se}),u&&(0,z.jsx)(ve,{anchorRef:f,onEdit:()=>r(e),onRename:()=>i(e),onSetActive:()=>n(e.name),onDelete:()=>a(e),isActive:t,isActivating:s,onClose:()=>d(!1)})]})]})}function xe({isLoading:e,loadError:t,profiles:n,active:r,onActivate:i,onEdit:a,onRename:s,onDelete:l,isActivating:u}){let{t:d}=c(`openhands`);return e?(0,z.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,z.jsx)(S,{size:`large`})}):t?(0,z.jsx)(`p`,{className:`text-sm text-red-400`,children:d(o.SETTINGS$PROFILES_LOAD_ERROR)}):n.length===0?(0,z.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)] italic`,children:d(o.SETTINGS$PROFILES_EMPTY)}):(0,z.jsx)(`div`,{className:p(ce,oe),children:n.map(e=>(0,z.jsx)(be,{profile:e,isActive:e.name===r,onActivate:i,onEdit:a,onRename:s,onDelete:l,isActivating:u},e.name))})}function K(){let e=s();return i({mutationFn:e=>P.activateProfile(e),onSuccess:async()=>{O.invalidateCache(),await e.invalidateQueries({queryKey:g.all}),await e.invalidateQueries({queryKey:h.personal()})},meta:{disableToast:!0}})}function Se({onAddProfile:e,onEditProfile:t}){let{t:n}=c(`openhands`),{data:r,isLoading:i,error:a}=F(),s=K(),[l,u]=(0,R.useState)(null),[p,m]=(0,R.useState)(null),h=r?.profiles??[],g=r?.active_profile??null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`h2`,{className:`text-base font-medium text-white`,children:n(o.SETTINGS$AVAILABLE_PROFILES)}),e?(0,z.jsx)(x,{testId:`add-llm-profile`,type:`button`,variant:`secondary`,className:`ml-auto`,onClick:e,children:n(o.SETTINGS$ADD_LLM_PROFILE)}):null]}),(0,z.jsx)(xe,{isLoading:i,loadError:a??null,profiles:h,active:g,onActivate:async e=>{try{await s.mutateAsync(e),f(n(o.SETTINGS$PROFILE_ACTIVATED,{name:e}))}catch(e){console.error(`Failed to activate profile:`,e),d(n(o.ERROR$GENERIC))}},onEdit:e=>{t?.(e)},onRename:u,onDelete:m,isActivating:s.isPending})]}),(0,z.jsx)(me,{profile:l,onClose:()=>u(null)}),(0,z.jsx)(ge,{profile:p,onClose:()=>m(null)})]})}function q(){let e=s();return i({mutationFn:({name:e,request:t})=>P.saveProfile(e,t),onSuccess:async()=>{O.invalidateCache(),await e.invalidateQueries({queryKey:g.all}),await e.invalidateQueries({queryKey:h.personal()})},meta:{disableToast:!0}})}var J=`https://llm-proxy.app.all-hands.dev/`;function Y(e){return typeof e==`string`&&e.startsWith(`openhands/`)}function Ce({activeProfileName:e,originalName:t,savedName:n}){return e?t?e===t:e===n:!1}function we(){let{t:e}=c(`openhands`),{setHideSectionHeader:t}=le(),n=q(),r=K(),{data:i}=F(),{data:a}=k(),{data:s}=L(a?.agent_settings_schema),l=(0,R.useRef)(s);l.current=s;let[p,m]=(0,R.useState)(`list`),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(null),[S,C]=(0,R.useState)(!1);(0,R.useEffect)(()=>(t(p!==`list`),()=>t(!1)),[p,t]);let w=(0,R.useMemo)(()=>new Set(i?.profiles.map(e=>e.name)??[]),[i]),T=(0,R.useMemo)(()=>!(!V(h,{isRequired:!0})||p===`create`&&w.has(h)||p===`edit`&&h!==_?.profile.name&&w.has(h)),[h,p,w,_?.profile.name]),E=(0,R.useCallback)(()=>{g(``),v(null),m(`create`)},[]),D=(0,R.useCallback)(async t=>{try{let e=(await P.getProfile(t.name,`encrypted`)).config??{},n=l.current?.sections.find(e=>e.key===`llm`)?.fields??[],r={};for(let t of n){let n=t.key.startsWith(`llm.`)?t.key.slice(4):t.key;r[t.key]=ne(t,e[n])}n.length===0&&(r[`llm.model`]=e.model??``,r[`llm.api_key`]=e.api_key??``,r[`llm.base_url`]=e.base_url??``),v({profile:t,initialValues:r,baseConfig:e}),g(t.name),m(`edit`)}catch(t){console.error(`Failed to fetch profile details:`,t),d(e(o.ERROR$GENERIC))}},[e]),O=(0,R.useCallback)(()=>{m(`list`),v(null),g(``),b(null)},[]),A=(0,R.useCallback)(e=>{if(b(e),p===`create`&&!h){let t=e.values[`llm.model`];if(typeof t==`string`&&t){let e=H(t);w.has(e)||g(e)}}},[p,h,w]),j=(0,R.useCallback)(async()=>{if(!y||!T)return;let t;try{t=y.getDirtyPayload().llm??{}}catch(t){d(t instanceof Error?t.message:e(o.ERROR$GENERIC));return}let a=p===`edit`&&_?.baseConfig?{..._.baseConfig}:{},s={...a,...t};if(y.view===`basic`&&(Y(s.model)?s.base_url=J:delete s.base_url),typeof s.api_key!=`string`||s.api_key.trim()===``){let e=typeof a.api_key==`string`?a.api_key:``;e?s.api_key=e:delete s.api_key}if(!(typeof s.model==`string`&&s.model)){d(e(o.SETTINGS$MODEL_REQUIRED));return}let c=h.trim(),l=_?.profile.name,u=p===`edit`&&l&&l!==c,m=Ce({activeProfileName:i?.active_profile,originalName:l,savedName:c});C(!0);try{u&&await P.renameProfile(l,c),await n.mutateAsync({name:c,request:{llm:s,include_secrets:!0}}),m&&await r.mutateAsync(c),f(e(p===`create`?o.SETTINGS$PROFILE_CREATED:o.SETTINGS$PROFILE_UPDATED,{name:c})),O()}catch(t){console.error(`Failed to save profile:`,t),d(e(o.ERROR$GENERIC))}finally{C(!1)}},[y,T,h,p,_,i?.active_profile,n,r,e,O]);if(p===`list`)return(0,z.jsx)(Se,{onAddProfile:E,onEditProfile:D});let M=e(p===`edit`?o.SETTINGS$EDIT_LLM_PROFILE:o.SETTINGS$ADD_LLM_PROFILE),N=p===`edit`&&_?e(o.SETTINGS$PROFILE_LOADED,{name:_.profile.name}):e(o.SETTINGS$PROFILE_SAVE_HINT);return(0,z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(u,{testId:`back-to-profiles`,onClick:O,children:e(o.BUTTON$BACK)}),(0,z.jsx)(ee.H2,{testId:`profile-editor-title`,children:M}),(0,z.jsx)(`p`,{"data-testid":`profile-editor-description`,className:`text-sm leading-5 text-tertiary-light`,children:N})]}),(0,z.jsx)(U,{testId:`profile-name-input`,value:h,onChange:g,isRequired:!0}),(0,z.jsx)($,{embedded:!0,hideSaveButton:!0,initialValueOverrides:p===`edit`&&_?.initialValues?_.initialValues:{"llm.model":``,"llm.api_key":``,"llm.base_url":``},onSaveControlChange:A},p===`edit`?`edit-${_?.profile.name}`:`new-profile`),(0,z.jsxs)(`div`,{className:`flex justify-start gap-3 pt-4`,children:[(0,z.jsx)(x,{testId:`cancel-profile-btn`,type:`button`,variant:`secondary`,onClick:O,children:e(o.BUTTON$CANCEL)}),(0,z.jsx)(x,{testId:`save-profile-btn`,type:`button`,variant:`primary`,onClick:j,isDisabled:!T||S||!y,"aria-busy":S,children:e(S?o.STATUS$SAVING:o.BUTTON$SAVE)})]})]})}var Te=new Set([`llm.model`,`llm.api_key`,`llm.base_url`]),Ee=(e,t)=>!e||!t?null:`${e}/${t}`,X=(e,t)=>e?.sections.flatMap(e=>e.fields).find(e=>e.key===t)?.default??null,Z={openai:new Set([`https://api.openai.com`,`https://api.openai.com/v1`]),openhands:new Set([J,`https://llm-proxy.app.all-hands.dev/v1`]),litellm_proxy:new Set([J,`https://llm-proxy.app.all-hands.dev/v1`])},De=e=>{try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``)||``;return`${t.origin}${n}`}catch{return e.trim().replace(/\/+$/,``)}},Oe=(e,t)=>{let n=De(t),{provider:r}=C(e);if(r){let e=Z[r];if(e)return e.has(n)}return Object.values(Z).some(e=>e?.has(n))};function Q({testId:e}){let{t}=c(`openhands`);return(0,z.jsx)(I,{testId:e,text:t(o.SETTINGS$OPENHANDS_API_KEY_HELP_TEXT),linkText:t(o.SETTINGS$NAV_API_KEYS),href:`https://app.all-hands.dev/settings/api-keys`,suffix:` ${t(o.SETTINGS$OPENHANDS_API_KEY_HELP_SUFFIX)}`})}function $({scope:e=`personal`,onSaveSuccess:t,initialValueOverrides:n,embedded:r,hideSaveButton:i,onSaveControlChange:a}){let{t:s}=c(`openhands`),{data:l}=k(e),{data:u}=L(l?.agent_settings_schema),d=String(D.agent_settings?.llm?.model??``),f=R.useCallback((e,t)=>{let n=te(e,t);if(n!==`basic`)return n;let r=e.llm_model??``,i=e.llm_base_url?.trim()??``;return i.length>0&&!Oe(r,i)?`all`:`basic`},[]);return(0,z.jsx)(re,{scope:e,sectionKeys:[`llm`],excludeKeys:Te,header:R.useCallback(({values:e,isDisabled:t,view:n,onChange:i})=>{let a=typeof e[`llm.model`]==`string`?e[`llm.model`]:``,c=typeof e[`llm.base_url`]==`string`?e[`llm.base_url`]:``,u=a.startsWith(`openhands/`),f=typeof e[`llm.api_key`]==`string`?e[`llm.api_key`]:``,p=r?f.length>0:!!l?.llm_api_key_set,m=(e,n)=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(E,{testId:e,label:s(o.SETTINGS_FORM$API_KEY),type:`password`,className:`w-full`,value:f,placeholder:p?`<hidden>`:``,onChange:e=>i(`llm.api_key`,e),isDisabled:t,startContent:p?(0,z.jsx)(fe,{isSet:p}):void 0}),(0,z.jsx)(I,{testId:n,text:s(o.SETTINGS$DONT_KNOW_API_KEY),linkText:s(o.SETTINGS$CLICK_FOR_INSTRUCTIONS),href:`https://docs.openhands.dev/usage/local-setup#getting-an-api-key`})]});return(0,z.jsx)(`div`,{className:`flex flex-col gap-6`,children:n===`basic`?(0,z.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-testid":`llm-settings-form-basic`,children:[(0,z.jsx)(w,{currentModel:a||void 0,currentBaseUrl:c||void 0,onChange:(e,t)=>{let n=Ee(e,t);n&&i(`llm.model`,n)},wrapperClassName:`!flex-col !gap-6`,isDisabled:t}),u?(0,z.jsx)(Q,{testId:`openhands-api-key-help`}):null,m(`llm-api-key-input`,`llm-api-key-help-anchor`)]}):(0,z.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-testid":`llm-settings-form-advanced`,children:[(0,z.jsx)(E,{testId:`llm-custom-model-input`,label:s(o.SETTINGS$CUSTOM_MODEL),type:`text`,className:`w-full`,value:a,placeholder:d,onChange:e=>i(`llm.model`,e),isDisabled:t}),u?(0,z.jsx)(Q,{testId:`openhands-api-key-help-2`}):null,(0,z.jsx)(E,{testId:`base-url-input`,label:s(o.SETTINGS$BASE_URL),type:`text`,className:`w-full`,value:c,placeholder:`https://api.openai.com`,onChange:e=>i(`llm.base_url`,e),isDisabled:t}),m(`llm-api-key-input`,`llm-api-key-help-anchor-advanced`)]})})},[d,r,l?.llm_api_key_set,s]),buildPayload:R.useCallback((e,t)=>{let n=structuredClone(e),r=n.llm??{};return t.view===`basic`&&(r.base_url=Y(r.model??t.values[`llm.model`])?J:X(u,`llm.base_url`),n.llm=r),{agent_settings_diff:n}},[u]),getInitialView:f,forceShowAdvancedView:!0,allowAllView:!0,onSaveSuccess:t,initialValueOverrides:n,embedded:r,hideSaveButton:i,onSaveControlChange:a,testId:`llm-settings-screen`})}var ke=n(function(){let{backend:e}=m();return e.kind===`cloud`?(0,z.jsx)($,{}):(0,z.jsx)(we,{})});export{H as a,K as i,ke as n,q as r,$ as t};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as r}from"./react-dom-hVBnwgwZ.js";import{t as i}from"./useMutation-GSSKKebK.js";import{o as a,t as o}from"./declaration-CR6HMp29.js";import{n as s}from"./QueryClientProvider-Cnr-Yl3j.js";import{t as c}from"./useTranslation-B6voJV4y.js";import{t as l}from"./createLucideIcon-Ddu8jDOQ.js";import{t as u}from"./back-nav-button-7dQJ2k3O.js";import{n as d,r as f}from"./custom-toast-handlers-ufGJ6_Rc.js";import{t as p}from"./utils-DCVfKFRt.js";import{n as m}from"./active-backend-context-BSPE-W72.js";import{a as h,n as g}from"./query-keys-tAsQcc_9.js";import{t as _}from"./modal-backdrop-RfNCrSpK.js";import{r as v,t as y}from"./modal-body-aoa2fx5W.js";import{r as b}from"./base-modal-C2oy2EBG.js";import{t as x}from"./brand-button-DJ_S16rO.js";import{t as S}from"./loading-spinner-5GT9q1xy.js";import{n as C,t as w}from"./model-selector-DcztJSxT.js";import{i as T}from"./dropdown-classes-BsVmxlNG.js";import{t as E}from"./settings-input-CehsXnb3.js";import{t as D}from"./settings-DGY6n4J2.js";import{t as O}from"./settings-service.api-DwtyDeGh.js";import{r as k}from"./use-settings-DeO7nvpM.js";import{i as A,r as j,t as M}from"./ellipsis-button-Vh5MvRZa.js";import{t as N}from"./u-edit-BbrptMCa.js";import{n as P,t as F}from"./use-llm-profiles-Bh5JqZUZ.js";import{r as ee}from"./typography-BDgnT7Yp.js";import{c as te,d as I,u as ne}from"./sdk-settings-schema-CLmJ9sho.js";import{t as L}from"./use-agent-settings-schema-B66kGIi_.js";import{t as re}from"./sdk-section-page-CRCRY3PG.js";import{t as ie}from"./u-check-circle-DOauqQKb.js";import{i as ae,n as oe,r as se,t as ce}from"./settings-list-classes-E3v_f6QG.js";import{n as le}from"./settings-section-header-context-DewwJ0-F.js";var ue=l(`text-cursor`,[[`path`,{d:`M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1`,key:`uvaxm9`}],[`path`,{d:`M7 22h1a4 4 0 0 0 4-4v-1`,key:`11xy8d`}],[`path`,{d:`M7 2h1a4 4 0 0 1 4 4v1`,key:`1uw06m`}]]),R=e(t()),z=a(),de=e=>(0,z.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,z.jsx)(`path`,{d:`M9.9509 15.588H10.8349L16.5125 9.91042L15.6285 9.0264L10.3991 14.2681L8.00867 11.8777L7.12465 12.7617L9.9509 15.588Z`,fill:`currentColor`}),(0,z.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.8521 3.29895C14.8443 3.42346 16.712 4.41954 18.0816 5.78916C19.7002 7.53231 20.5718 9.64898 20.5718 12.1392C20.5718 14.1314 19.8247 15.999 18.5796 17.6177C17.3345 19.1118 15.5914 20.2324 13.5992 20.6059C11.607 20.9794 9.61486 20.7304 7.87171 19.7343C6.12856 18.7382 4.75895 17.2441 4.01189 15.3765C3.26482 13.5088 3.14031 11.3921 3.76286 9.52447C4.38542 7.53231 5.50601 5.91367 7.24916 4.79308C8.86779 3.67248 10.86 3.17444 12.8521 3.29895ZM13.4747 19.3608C15.0933 18.9873 16.5874 18.1157 17.708 16.7461C18.7041 15.3765 19.3267 13.7578 19.2022 12.0147C19.2022 10.0225 18.4551 8.03035 17.0855 6.66073C15.8404 5.41563 14.3463 4.66857 12.6031 4.54405C10.9845 4.41954 9.24132 4.79308 7.87171 5.78916C6.50209 6.78524 5.50601 8.15486 5.00797 9.89801C4.50993 11.5166 4.50993 13.2598 5.25699 14.8784C6.00405 16.4971 7.12465 17.7422 8.61877 18.6137C10.1129 19.4853 11.856 19.7343 13.4747 19.3608Z`,fill:`currentColor`})]});function fe({testId:e,isSet:t}){return(0,z.jsx)(`span`,{"data-testid":e||(t?`set-indicator`:`unset-indicator`),children:(0,z.jsx)(de,{className:p(t?`text-success`:`text-danger`)})})}var B=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;function V(e,{isRequired:t=!1}={}){return e===``?!t:B.test(e)}function H(e){let t=e.split(`/`),n=(t[t.length-1]||e).replace(/[^A-Za-z0-9._-]/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``);return n&&!/^[A-Za-z0-9]/.test(n)&&(n=`profile-${n}`),n.length>64&&(n=n.substring(0,64).replace(/-+$/,``)),n||`default-profile`}var U=(0,R.forwardRef)(function({testId:e,ruleTestId:t,value:n,onChange:r,onKeyDown:i,placeholder:a,isDisabled:s,isOptional:l,isRequired:u=!1},d){let{t:f}=c(`openhands`),m=V(n,{isRequired:u}),h=l?`${f(o.SETTINGS$PROFILE_NAME_LABEL)} (${f(o.COMMON$OPTIONAL)})`:f(o.SETTINGS$PROFILE_NAME_LABEL),g=R.useId(),_=t??`${g}-rule`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(E,{ref:d,testId:e,label:h,type:`text`,className:`w-full`,value:n,placeholder:a??f(o.SETTINGS$PROFILE_NAME_PLACEHOLDER),onChange:r,onKeyDown:i,isDisabled:s,ariaDescribedBy:_,ariaInvalid:!m}),(0,z.jsx)(`p`,{id:_,"data-testid":t,className:p(`text-xs`,m?`text-[var(--oh-muted)]`:`text-red-400`),children:f(o.SETTINGS$PROFILE_NAME_RULE)})]})});function W({isOpen:e,title:t,width:n=`md`,children:r,footer:i,onClose:a,initialFocusRef:o}){let s=(0,R.useRef)(null);return(0,R.useEffect)(()=>{if(!e)return;let t=o?.current??s.current;if(t){let e=setTimeout(()=>{t.focus()},0);return()=>clearTimeout(e)}},[e,o]),(0,R.useEffect)(()=>{if(!e||!s.current)return;let t=s.current,n=e=>{if(e.key!==`Tab`)return;let n=t.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`),r=n[0],i=n[n.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r?.focus())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e]),e?(0,z.jsx)(_,{onClose:a,children:(0,z.jsxs)(`div`,{ref:s,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`modal-title`,className:p(`bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)]`,v(n),y),children:[(0,z.jsx)(b,{id:`modal-title`,title:t}),r,(0,z.jsx)(`div`,{className:`w-full flex justify-end gap-2 mt-2`,children:i})]})}):null}function pe(){let e=s();return i({mutationFn:({name:e,newName:t})=>P.renameProfile(e,t),onSuccess:async()=>{O.invalidateCache(),await e.invalidateQueries({queryKey:g.all}),await e.invalidateQueries({queryKey:h.personal()})},meta:{disableToast:!0}})}function me({profile:e,onClose:t}){let{t:n}=c(`openhands`),[r,i]=(0,R.useState)(``),a=pe(),s=(0,R.useRef)(null);if((0,R.useEffect)(()=>{i(e?.name??``)},[e?.name]),!e)return null;let l=V(r,{isRequired:!0}),u=r===e.name,p=async()=>{if(!l){d(n(o.SETTINGS$PROFILE_NAME_RULE));return}if(u){t();return}try{await a.mutateAsync({name:e.name,newName:r}),f(n(o.SETTINGS$PROFILE_RENAMED,{name:r})),t()}catch(e){d(e instanceof Error?e.message:n(o.ERROR$GENERIC))}},m=()=>{a.isPending||t()},h=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(x,{type:`button`,variant:`tertiary`,onClick:m,isDisabled:a.isPending,children:n(o.BUTTON$CANCEL)}),(0,z.jsx)(x,{testId:`rename-profile-submit`,type:`button`,variant:`primary`,onClick:p,isDisabled:a.isPending||!l,children:a.isPending?(0,z.jsx)(S,{size:`small`}):n(o.BUTTON$RENAME)})]});return(0,z.jsx)(W,{isOpen:!0,title:n(o.SETTINGS$PROFILE_RENAME_TITLE),footer:h,onClose:m,initialFocusRef:s,children:(0,z.jsx)(`div`,{"data-testid":`rename-profile-modal`,className:`flex flex-col gap-3`,children:(0,z.jsx)(U,{ref:s,testId:`rename-profile-input`,ruleTestId:`rename-profile-rule`,value:r,onChange:i,isRequired:!0,onKeyDown:e=>{e.key===`Enter`&&!a.isPending&&l&&p()}})})})}function he(){let e=s();return i({mutationFn:e=>P.deleteProfile(e),onSuccess:async()=>{O.invalidateCache(),await e.invalidateQueries({queryKey:g.all}),await e.invalidateQueries({queryKey:h.personal()})},meta:{disableToast:!0}})}function ge({profile:e,onClose:t}){let{t:n}=c(`openhands`),r=he(),i=(0,R.useRef)(null);if(!e)return null;let a=async()=>{try{await r.mutateAsync(e.name),f(n(o.SETTINGS$PROFILE_DELETED,{name:e.name})),t()}catch(e){d(e instanceof Error?e.message:n(o.ERROR$GENERIC))}},s=()=>{r.isPending||t()},l=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(x,{ref:i,type:`button`,variant:`tertiary`,onClick:s,isDisabled:r.isPending,children:n(o.BUTTON$CANCEL)}),(0,z.jsx)(x,{testId:`delete-profile-confirm`,type:`button`,variant:`danger`,onClick:a,isDisabled:r.isPending,"aria-busy":r.isPending,children:r.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(S,{size:`small`}),(0,z.jsx)(`span`,{className:`sr-only`,children:n(o.BUTTON$DELETE)})]}):n(o.BUTTON$DELETE)})]});return(0,z.jsx)(W,{isOpen:!0,title:n(o.SETTINGS$PROFILE_DELETE_TITLE),footer:l,onClose:s,initialFocusRef:i,children:(0,z.jsx)(`p`,{className:`text-sm break-all`,children:n(o.SETTINGS$PROFILE_DELETE_CONFIRMATION,{name:e.name})})})}var _e=e(r(),1);function G({index:e,icon:t,label:n,onClick:r,onKeyDown:i,menuItemsRef:a,disabled:o,testId:s}){return(0,z.jsx)(`button`,{ref:t=>{a.current[e]=t},type:`button`,onClick:r,onKeyDown:t=>i(t,e),disabled:o,className:p(`group w-full cursor-pointer rounded px-2 py-2 text-start text-nowrap text-sm font-normal`,`text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent`),role:`menuitem`,"data-testid":s,children:(0,z.jsx)(A,{icon:t,text:n})})}function ve({onEdit:e,onRename:t,onSetActive:n,onDelete:r,isActive:i,isActivating:a,onClose:s,anchorRef:l}){let{t:u}=c(`openhands`),d=(0,R.useRef)(null),f=(0,R.useRef)([]),m=l?.current??null,[h,g]=(0,R.useState)();(0,R.useLayoutEffect)(()=>{if(!m)return;let e=()=>{let e=m.getBoundingClientRect();e&&g({position:`fixed`,zIndex:9999,top:e.bottom+8,right:window.innerWidth-e.right,width:`max-content`})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[m]),(0,R.useEffect)(()=>{f.current[0]?.focus()},[]),(0,R.useEffect)(()=>{let e=e=>{let t=e.target;d.current&&!d.current.contains(t)&&s()},t=e=>{e.key===`Escape`&&s()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[s]);let _=e=>{e(),s()},v=(0,R.useCallback)((e,t)=>{if(e.key===`Tab`){s();return}let n=f.current.filter(Boolean).length;if(e.key===`ArrowDown`){e.preventDefault();let r=(t+1)%n;f.current[r]?.focus()}else if(e.key===`ArrowUp`){e.preventDefault();let r=(t-1+n)%n;f.current[r]?.focus()}},[s]),y=i||a,b=!!m,x=(0,z.jsxs)(`div`,{ref:d,className:p(`absolute right-0 top-full z-10 mt-2 w-[160px] rounded-md border border-[var(--oh-border-subtle)] bg-tertiary px-1 py-1 shadow-lg`,T,b&&`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`),role:`menu`,"aria-orientation":`vertical`,"data-testid":`profile-actions-menu`,children:[(0,z.jsx)(G,{index:0,icon:(0,z.jsx)(N,{width:16,height:16}),label:u(o.SETTINGS$PROFILE_EDIT),onClick:()=>_(e),onKeyDown:v,menuItemsRef:f,testId:`profile-edit`}),(0,z.jsx)(G,{index:1,icon:(0,z.jsx)(ue,{"aria-hidden":!0,className:`size-4`,strokeWidth:2}),label:u(o.BUTTON$RENAME),onClick:()=>_(t),onKeyDown:v,menuItemsRef:f,testId:`profile-rename`}),(0,z.jsx)(G,{index:2,icon:(0,z.jsx)(ie,{width:16,height:16}),label:u(o.SETTINGS$PROFILE_SET_ACTIVE),onClick:()=>_(n),onKeyDown:v,menuItemsRef:f,disabled:y,testId:`profile-set-active`}),(0,z.jsx)(G,{index:3,icon:(0,z.jsx)(j,{width:16,height:16}),label:u(o.BUTTON$DELETE),onClick:()=>_(r),onKeyDown:v,menuItemsRef:f,testId:`profile-delete`})]});return b?typeof document>`u`||!h?null:_e.createPortal((0,z.jsx)(`div`,{style:h,children:x}),document.body):x}function ye({children:e,className:t,...n}){return(0,z.jsx)(`span`,{className:p(`text-sm leading-4 text-black font-semibold tracking-tighter bg-primary p-1 rounded-full`,t),...n,children:e})}function be({profile:e,isActive:t,onActivate:n,onEdit:r,onRename:i,onDelete:a,isActivating:s}){let{t:l}=c(`openhands`),[u,d]=(0,R.useState)(!1),f=(0,R.useRef)(null);return(0,z.jsxs)(`div`,{"data-testid":`profile-row`,className:p(ae,`justify-between gap-3`),children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm font-medium text-white`,title:e.name,children:e.name}),e.model?(0,z.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm text-[var(--oh-muted)]`,title:e.model,children:e.model}):null,t&&(0,z.jsx)(ye,{className:`shrink-0 whitespace-nowrap px-2.5 py-1 text-xs`,"data-testid":`profile-active-badge`,children:l(o.SETTINGS$PROFILE_ACTIVE)})]}),(0,z.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,z.jsx)(M,{ref:f,onClick:()=>d(e=>!e),ariaLabel:l(o.SETTINGS$PROFILE_MENU),testId:`profile-menu-trigger`,className:se}),u&&(0,z.jsx)(ve,{anchorRef:f,onEdit:()=>r(e),onRename:()=>i(e),onSetActive:()=>n(e.name),onDelete:()=>a(e),isActive:t,isActivating:s,onClose:()=>d(!1)})]})]})}function xe({isLoading:e,loadError:t,profiles:n,active:r,onActivate:i,onEdit:a,onRename:s,onDelete:l,isActivating:u}){let{t:d}=c(`openhands`);return e?(0,z.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,z.jsx)(S,{size:`large`})}):t?(0,z.jsx)(`p`,{className:`text-sm text-red-400`,children:d(o.SETTINGS$PROFILES_LOAD_ERROR)}):n.length===0?(0,z.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)] italic`,children:d(o.SETTINGS$PROFILES_EMPTY)}):(0,z.jsx)(`div`,{className:p(ce,oe),children:n.map(e=>(0,z.jsx)(be,{profile:e,isActive:e.name===r,onActivate:i,onEdit:a,onRename:s,onDelete:l,isActivating:u},e.name))})}function K(){let e=s();return i({mutationFn:e=>P.activateProfile(e),onSuccess:async()=>{O.invalidateCache(),await e.invalidateQueries({queryKey:g.all}),await e.invalidateQueries({queryKey:h.personal()})},meta:{disableToast:!0}})}function Se({onAddProfile:e,onEditProfile:t}){let{t:n}=c(`openhands`),{data:r,isLoading:i,error:a}=F(),s=K(),[l,u]=(0,R.useState)(null),[p,m]=(0,R.useState)(null),h=r?.profiles??[],g=r?.active_profile??null;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`h2`,{className:`text-base font-medium text-white`,children:n(o.SETTINGS$AVAILABLE_PROFILES)}),e?(0,z.jsx)(x,{testId:`add-llm-profile`,type:`button`,variant:`secondary`,className:`ml-auto`,onClick:e,children:n(o.SETTINGS$ADD_LLM_PROFILE)}):null]}),(0,z.jsx)(xe,{isLoading:i,loadError:a??null,profiles:h,active:g,onActivate:async e=>{try{await s.mutateAsync(e),f(n(o.SETTINGS$PROFILE_ACTIVATED,{name:e}))}catch(e){console.error(`Failed to activate profile:`,e),d(n(o.ERROR$GENERIC))}},onEdit:e=>{t?.(e)},onRename:u,onDelete:m,isActivating:s.isPending})]}),(0,z.jsx)(me,{profile:l,onClose:()=>u(null)}),(0,z.jsx)(ge,{profile:p,onClose:()=>m(null)})]})}function q(){let e=s();return i({mutationFn:({name:e,request:t})=>P.saveProfile(e,t),onSuccess:async()=>{O.invalidateCache(),await e.invalidateQueries({queryKey:g.all}),await e.invalidateQueries({queryKey:h.personal()})},meta:{disableToast:!0}})}var J=`https://llm-proxy.app.all-hands.dev/`;function Y(e){return typeof e==`string`&&e.startsWith(`openhands/`)}function Ce({activeProfileName:e,originalName:t,savedName:n}){return e?t?e===t:e===n:!1}function we(){let{t:e}=c(`openhands`),{setHideSectionHeader:t}=le(),n=q(),r=K(),{data:i}=F(),{data:a}=k(),{data:s}=L(a?.agent_settings_schema),l=(0,R.useRef)(s);l.current=s;let[p,m]=(0,R.useState)(`list`),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(null),[S,C]=(0,R.useState)(!1);(0,R.useEffect)(()=>(t(p!==`list`),()=>t(!1)),[p,t]);let w=(0,R.useMemo)(()=>new Set(i?.profiles.map(e=>e.name)??[]),[i]),T=(0,R.useMemo)(()=>!(!V(h,{isRequired:!0})||p===`create`&&w.has(h)||p===`edit`&&h!==_?.profile.name&&w.has(h)),[h,p,w,_?.profile.name]),E=(0,R.useCallback)(()=>{g(``),v(null),m(`create`)},[]),D=(0,R.useCallback)(async t=>{try{let e=(await P.getProfile(t.name,`encrypted`)).config??{},n=l.current?.sections.find(e=>e.key===`llm`)?.fields??[],r={};for(let t of n){let n=t.key.startsWith(`llm.`)?t.key.slice(4):t.key;r[t.key]=ne(t,e[n])}n.length===0&&(r[`llm.model`]=e.model??``,r[`llm.api_key`]=e.api_key??``,r[`llm.base_url`]=e.base_url??``),v({profile:t,initialValues:r,baseConfig:e}),g(t.name),m(`edit`)}catch(t){console.error(`Failed to fetch profile details:`,t),d(e(o.ERROR$GENERIC))}},[e]),O=(0,R.useCallback)(()=>{m(`list`),v(null),g(``),b(null)},[]),A=(0,R.useCallback)(e=>{if(b(e),p===`create`&&!h){let t=e.values[`llm.model`];if(typeof t==`string`&&t){let e=H(t);w.has(e)||g(e)}}},[p,h,w]),j=(0,R.useCallback)(async()=>{if(!y||!T)return;let t;try{t=y.getDirtyPayload().llm??{}}catch(t){d(t instanceof Error?t.message:e(o.ERROR$GENERIC));return}let a=p===`edit`&&_?.baseConfig?{..._.baseConfig}:{},s={...a,...t};if(y.view===`basic`&&(Y(s.model)?s.base_url=J:delete s.base_url),typeof s.api_key!=`string`||s.api_key.trim()===``){let e=typeof a.api_key==`string`?a.api_key:``;e?s.api_key=e:delete s.api_key}if(!(typeof s.model==`string`&&s.model)){d(e(o.SETTINGS$MODEL_REQUIRED));return}let c=h.trim(),l=_?.profile.name,u=p===`edit`&&l&&l!==c,m=Ce({activeProfileName:i?.active_profile,originalName:l,savedName:c});C(!0);try{u&&await P.renameProfile(l,c),await n.mutateAsync({name:c,request:{llm:s,include_secrets:!0}}),m&&await r.mutateAsync(c),f(e(p===`create`?o.SETTINGS$PROFILE_CREATED:o.SETTINGS$PROFILE_UPDATED,{name:c})),O()}catch(t){console.error(`Failed to save profile:`,t),d(e(o.ERROR$GENERIC))}finally{C(!1)}},[y,T,h,p,_,i?.active_profile,n,r,e,O]);if(p===`list`)return(0,z.jsx)(Se,{onAddProfile:E,onEditProfile:D});let M=e(p===`edit`?o.SETTINGS$EDIT_LLM_PROFILE:o.SETTINGS$ADD_LLM_PROFILE),N=p===`edit`&&_?e(o.SETTINGS$PROFILE_LOADED,{name:_.profile.name}):e(o.SETTINGS$PROFILE_SAVE_HINT);return(0,z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(u,{testId:`back-to-profiles`,onClick:O,children:e(o.BUTTON$BACK)}),(0,z.jsx)(ee.H2,{testId:`profile-editor-title`,children:M}),(0,z.jsx)(`p`,{"data-testid":`profile-editor-description`,className:`text-sm leading-5 text-tertiary-light`,children:N})]}),(0,z.jsx)(U,{testId:`profile-name-input`,value:h,onChange:g,isRequired:!0}),(0,z.jsx)($,{embedded:!0,hideSaveButton:!0,initialValueOverrides:p===`edit`&&_?.initialValues?_.initialValues:{"llm.model":``,"llm.api_key":``,"llm.base_url":``},onSaveControlChange:A},p===`edit`?`edit-${_?.profile.name}`:`new-profile`),(0,z.jsxs)(`div`,{className:`flex justify-start gap-3 pt-4`,children:[(0,z.jsx)(x,{testId:`cancel-profile-btn`,type:`button`,variant:`secondary`,onClick:O,children:e(o.BUTTON$CANCEL)}),(0,z.jsx)(x,{testId:`save-profile-btn`,type:`button`,variant:`primary`,onClick:j,isDisabled:!T||S||!y,"aria-busy":S,children:e(S?o.STATUS$SAVING:o.BUTTON$SAVE)})]})]})}var Te=new Set([`llm.model`,`llm.api_key`,`llm.base_url`]),Ee=(e,t)=>!e||!t?null:`${e}/${t}`,X=(e,t)=>e?.sections.flatMap(e=>e.fields).find(e=>e.key===t)?.default??null,Z={openai:new Set([`https://api.openai.com`,`https://api.openai.com/v1`]),openhands:new Set([J,`https://llm-proxy.app.all-hands.dev/v1`]),litellm_proxy:new Set([J,`https://llm-proxy.app.all-hands.dev/v1`])},De=e=>{try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``)||``;return`${t.origin}${n}`}catch{return e.trim().replace(/\/+$/,``)}},Oe=(e,t)=>{let n=De(t),{provider:r}=C(e);if(r){let e=Z[r];if(e)return e.has(n)}return Object.values(Z).some(e=>e?.has(n))};function Q({testId:e}){let{t}=c(`openhands`);return(0,z.jsx)(I,{testId:e,text:t(o.SETTINGS$OPENHANDS_API_KEY_HELP_TEXT),linkText:t(o.SETTINGS$NAV_API_KEYS),href:`https://app.all-hands.dev/settings/api-keys`,suffix:` ${t(o.SETTINGS$OPENHANDS_API_KEY_HELP_SUFFIX)}`})}function $({scope:e=`personal`,onSaveSuccess:t,initialValueOverrides:n,embedded:r,hideSaveButton:i,onSaveControlChange:a}){let{t:s}=c(`openhands`),{data:l}=k(e),{data:u}=L(l?.agent_settings_schema),d=String(D.agent_settings?.llm?.model??``),f=R.useCallback((e,t)=>{let n=te(e,t);if(n!==`basic`)return n;let r=e.llm_model??``,i=e.llm_base_url?.trim()??``;return i.length>0&&!Oe(r,i)?`all`:`basic`},[]);return(0,z.jsx)(re,{scope:e,sectionKeys:[`llm`],excludeKeys:Te,header:R.useCallback(({values:e,isDisabled:t,view:n,onChange:i})=>{let a=typeof e[`llm.model`]==`string`?e[`llm.model`]:``,c=typeof e[`llm.base_url`]==`string`?e[`llm.base_url`]:``,u=a.startsWith(`openhands/`),f=typeof e[`llm.api_key`]==`string`?e[`llm.api_key`]:``,p=r?f.length>0:!!l?.llm_api_key_set,m=(e,n)=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(E,{testId:e,label:s(o.SETTINGS_FORM$API_KEY),type:`password`,className:`w-full`,value:f,placeholder:p?`<hidden>`:``,onChange:e=>i(`llm.api_key`,e),isDisabled:t,startContent:p?(0,z.jsx)(fe,{isSet:p}):void 0}),(0,z.jsx)(I,{testId:n,text:s(o.SETTINGS$DONT_KNOW_API_KEY),linkText:s(o.SETTINGS$CLICK_FOR_INSTRUCTIONS),href:`https://docs.openhands.dev/usage/local-setup#getting-an-api-key`})]});return(0,z.jsx)(`div`,{className:`flex flex-col gap-6`,children:n===`basic`?(0,z.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-testid":`llm-settings-form-basic`,children:[(0,z.jsx)(w,{currentModel:a||void 0,currentBaseUrl:c||void 0,onChange:(e,t)=>{let n=Ee(e,t);n&&i(`llm.model`,n)},wrapperClassName:`!flex-col !gap-6`,isDisabled:t}),u?(0,z.jsx)(Q,{testId:`openhands-api-key-help`}):null,m(`llm-api-key-input`,`llm-api-key-help-anchor`)]}):(0,z.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-testid":`llm-settings-form-advanced`,children:[(0,z.jsx)(E,{testId:`llm-custom-model-input`,label:s(o.SETTINGS$CUSTOM_MODEL),type:`text`,className:`w-full`,value:a,placeholder:d,onChange:e=>i(`llm.model`,e),isDisabled:t}),u?(0,z.jsx)(Q,{testId:`openhands-api-key-help-2`}):null,(0,z.jsx)(E,{testId:`base-url-input`,label:s(o.SETTINGS$BASE_URL),type:`text`,className:`w-full`,value:c,placeholder:`https://api.openai.com`,onChange:e=>i(`llm.base_url`,e),isDisabled:t}),m(`llm-api-key-input`,`llm-api-key-help-anchor-advanced`)]})})},[d,r,l?.llm_api_key_set,s]),buildPayload:R.useCallback((e,t)=>{let n=structuredClone(e),r=n.llm??{};return t.view===`basic`&&(r.base_url=Y(r.model??t.values[`llm.model`])?J:X(u,`llm.base_url`),n.llm=r),{agent_settings_diff:n}},[u]),getInitialView:f,forceShowAdvancedView:!0,allowAllView:!0,onSaveSuccess:t,initialValueOverrides:n,embedded:r,hideSaveButton:i,onSaveControlChange:a,testId:`llm-settings-screen`})}var ke=n(function(){let{backend:e}=m();return e.kind===`cloud`?(0,z.jsx)($,{}):(0,z.jsx)(we,{})});export{H as a,K as i,ke as n,q as r,$ as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./llm-settings-BKraGtOu.js";export{e as default};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./rolldown-runtime-BFRubm34.js";import{t as n}from"./react-CM_dJw1Z.js";import{t as r}from"./vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-DYXOLEck.js";import{o as i,t as a}from"./declaration-CR6HMp29.js";import{t as o}from"./useTranslation-B6voJV4y.js";import{t as s}from"./pencil-Dr0b2jL1.js";import{t as c}from"./plus-DT-M0FA1.js";import{t as l}from"./trash-2-CbVljPko.js";import{t as u}from"./utils-DCVfKFRt.js";import{n as d}from"./agent-server-client-options-HEOwGVIU.js";import{r as f}from"./active-backend-context-Beu-LZL-.js";import{t as p}from"./server-client-Kh4QSwDJ.js";import{t as m}from"./modal-backdrop-RfNCrSpK.js";import{r as h,t as g}from"./modal-body-aoa2fx5W.js";import{n as _}from"./modal-classes-6YqcqA6y.js";import{t as v}from"./brand-button-DJ_S16rO.js";import{a as y,i as b,n as x,r as S}from"./backend-form-modal-CDnEYjaU.js";import{t as C}from"./modal-close-button-CtWOUMmw.js";import{t as w}from"./confirmation-modal-B5Ca6qFE.js";var T=t({ManageBackendsModal:()=>j}),E=e(n(),1),D=i(),O=`inline-flex cursor-pointer items-center justify-center rounded-md p-1 text-muted transition-colors hover:bg-interactive-hover hover:text-white`;function k({backend:e}){let{t}=o(`openhands`),{data:n}=r({queryKey:[`backend-version`,e.host,e.apiKey],queryFn:async()=>(await new p(d({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo()).version??null,retry:!1,staleTime:6e4,enabled:e.kind===`local`});return n?(0,D.jsx)(`span`,{className:`inline-flex shrink-0 items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface)] px-1.5 py-0.5 text-[10px] font-medium leading-none text-[var(--oh-text-dim)]`,"data-testid":`manage-backends-version-${e.name}`,children:t(a.BACKEND$VERSION_LABEL,{version:n})}):null}function A({backend:e,health:t,onEdit:n,onRemove:r}){let{t:i}=o(`openhands`),c=b(t?.lastError),d,f=`text-[var(--oh-muted)]`;c?(d=i(a.AUTH$INVALID_KEY),f=`text-red-300`):t?.isConnected===!0?(d=i(a.ONBOARDING$BACKEND_STATUS_CONNECTED),f=`text-green-300`):t?.isConnected===!1?(d=i(a.ONBOARDING$BACKEND_STATUS_DISCONNECTED),f=`text-red-300`):d=i(a.ONBOARDING$BACKEND_STATUS_CHECKING);let p=c?!1:t?.isConnected??null;return(0,D.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-3`,"data-testid":`manage-backends-row-${e.name}`,children:[(0,D.jsx)(S,{isConnected:p}),(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`truncate text-sm text-white`,children:e.name}),(0,D.jsx)(k,{backend:e})]}),(0,D.jsx)(`span`,{className:`truncate text-xs text-[var(--oh-muted)]`,children:e.host}),(0,D.jsx)(`span`,{"data-testid":`manage-backends-status-${e.name}`,className:u(`truncate text-xs`,f),children:d})]}),(0,D.jsx)(`span`,{className:`px-2 py-1 rounded-full text-[11px] uppercase tracking-wide text-[var(--oh-text-tertiary)] bg-[var(--oh-surface)] border border-[var(--oh-border)]`,children:e.kind===`cloud`?i(a.BACKEND$KIND_CLOUD):i(a.BACKEND$KIND_LOCAL)}),(0,D.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:n,"aria-label":i(a.BACKEND$EDIT),"data-testid":`manage-backends-edit-${e.name}`,className:O,children:(0,D.jsx)(s,{"aria-hidden":!0,className:`size-4`,strokeWidth:2})}),(0,D.jsx)(`button`,{type:`button`,onClick:r,"aria-label":i(a.BACKEND$REMOVE),"data-testid":`manage-backends-remove-${e.name}`,className:O,children:(0,D.jsx)(l,{"aria-hidden":!0,className:`size-4`,strokeWidth:2})})]})]})}function j({onClose:e}){let{t}=o(`openhands`),{backends:n,removeBackend:r}=f(),i=y(n,{probeDisabledOnce:!0}),[s,l]=E.useState(null),[d,p]=E.useState(null),[b,S]=E.useState(!1);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m,{onClose:e,"aria-label":t(a.BACKEND$MANAGE_TITLE),children:(0,D.jsxs)(`div`,{"data-testid":`manage-backends-modal`,className:u(`relative flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border)] rounded-xl`,h(`lg`),g,`max-h-[70vh]`),children:[(0,D.jsx)(C,{onClose:e,testId:`close-manage-backends-modal`}),(0,D.jsx)(`div`,{className:`p-5 pr-12`,children:(0,D.jsx)(`h2`,{className:_,children:t(a.BACKEND$MANAGE_TITLE)})}),(0,D.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-5`,children:(0,D.jsx)(`div`,{className:`flex-1 overflow-auto rounded-md border border-[var(--oh-border)] bg-surface-raised custom-scrollbar-always`,"data-testid":`manage-backends-list`,children:n.length===0?(0,D.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-[var(--oh-text-secondary)]`,children:t(a.BACKEND$MANAGE_EMPTY)}):(0,D.jsx)(`ul`,{className:`divide-y divide-[var(--oh-border)]`,children:n.map(e=>(0,D.jsx)(A,{backend:e,health:i[e.id],onEdit:()=>p(e),onRemove:()=>l({id:e.id,name:e.name})},e.id))})})}),(0,D.jsxs)(`div`,{className:`flex justify-end gap-2 p-5`,children:[(0,D.jsx)(v,{type:`button`,variant:`secondary`,onClick:()=>S(!0),testId:`manage-backends-add`,startContent:(0,D.jsx)(c,{width:14,height:14}),children:t(a.BACKEND$ADD)}),(0,D.jsx)(v,{type:`button`,variant:`primary`,onClick:e,testId:`manage-backends-done`,children:t(a.HOME$DONE)})]})]})}),b?(0,D.jsx)(x,{mode:`add`,onClose:()=>S(!1)}):null,d?(0,D.jsx)(x,{mode:`edit`,backend:d,onClose:()=>p(null)}):null,s?(0,D.jsx)(w,{text:t(a.BACKEND$REMOVE_CONFIRMATION,{name:s.name}),onConfirm:()=>{s&&(r(s.id),l(null))},onCancel:()=>l(null)}):null]})}export{T as n,j as t};
1
+ import{a as e,r as t}from"./rolldown-runtime-BFRubm34.js";import{t as n}from"./react-CM_dJw1Z.js";import{t as r}from"./vendor~root~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-s~f2l2lr17-DYXOLEck.js";import{o as i,t as a}from"./declaration-CR6HMp29.js";import{t as o}from"./useTranslation-B6voJV4y.js";import{t as s}from"./pencil-Dr0b2jL1.js";import{t as c}from"./plus-DT-M0FA1.js";import{t as l}from"./trash-2-CbVljPko.js";import{t as u}from"./utils-DCVfKFRt.js";import{n as d}from"./agent-server-client-options-9agOSarV.js";import{r as f}from"./active-backend-context-BSPE-W72.js";import{t as p}from"./server-client-DYv_GHPl.js";import{t as m}from"./modal-backdrop-RfNCrSpK.js";import{r as h,t as g}from"./modal-body-aoa2fx5W.js";import{n as _}from"./modal-classes-6YqcqA6y.js";import{t as v}from"./brand-button-DJ_S16rO.js";import{a as y,i as b,n as x,r as S}from"./backend-form-modal-D3bDMO3C.js";import{t as C}from"./modal-close-button-CtWOUMmw.js";import{t as w}from"./confirmation-modal-B5Ca6qFE.js";var T=t({ManageBackendsModal:()=>j}),E=e(n(),1),D=i(),O=`inline-flex cursor-pointer items-center justify-center rounded-md p-1 text-muted transition-colors hover:bg-interactive-hover hover:text-white`;function k({backend:e}){let{t}=o(`openhands`),{data:n}=r({queryKey:[`backend-version`,e.host,e.apiKey],queryFn:async()=>(await new p(d({host:e.host,sessionApiKey:e.apiKey||null,timeout:5e3})).getServerInfo()).version??null,retry:!1,staleTime:6e4,enabled:e.kind===`local`});return n?(0,D.jsx)(`span`,{className:`inline-flex shrink-0 items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface)] px-1.5 py-0.5 text-[10px] font-medium leading-none text-[var(--oh-text-dim)]`,"data-testid":`manage-backends-version-${e.name}`,children:t(a.BACKEND$VERSION_LABEL,{version:n})}):null}function A({backend:e,health:t,onEdit:n,onRemove:r}){let{t:i}=o(`openhands`),c=b(t?.lastError),d,f=`text-[var(--oh-muted)]`;c?(d=i(a.AUTH$INVALID_KEY),f=`text-red-300`):t?.isConnected===!0?(d=i(a.ONBOARDING$BACKEND_STATUS_CONNECTED),f=`text-green-300`):t?.isConnected===!1?(d=i(a.ONBOARDING$BACKEND_STATUS_DISCONNECTED),f=`text-red-300`):d=i(a.ONBOARDING$BACKEND_STATUS_CHECKING);let p=c?!1:t?.isConnected??null;return(0,D.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-3`,"data-testid":`manage-backends-row-${e.name}`,children:[(0,D.jsx)(S,{isConnected:p}),(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`truncate text-sm text-white`,children:e.name}),(0,D.jsx)(k,{backend:e})]}),(0,D.jsx)(`span`,{className:`truncate text-xs text-[var(--oh-muted)]`,children:e.host}),(0,D.jsx)(`span`,{"data-testid":`manage-backends-status-${e.name}`,className:u(`truncate text-xs`,f),children:d})]}),(0,D.jsx)(`span`,{className:`px-2 py-1 rounded-full text-[11px] uppercase tracking-wide text-[var(--oh-text-tertiary)] bg-[var(--oh-surface)] border border-[var(--oh-border)]`,children:e.kind===`cloud`?i(a.BACKEND$KIND_CLOUD):i(a.BACKEND$KIND_LOCAL)}),(0,D.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:n,"aria-label":i(a.BACKEND$EDIT),"data-testid":`manage-backends-edit-${e.name}`,className:O,children:(0,D.jsx)(s,{"aria-hidden":!0,className:`size-4`,strokeWidth:2})}),(0,D.jsx)(`button`,{type:`button`,onClick:r,"aria-label":i(a.BACKEND$REMOVE),"data-testid":`manage-backends-remove-${e.name}`,className:O,children:(0,D.jsx)(l,{"aria-hidden":!0,className:`size-4`,strokeWidth:2})})]})]})}function j({onClose:e}){let{t}=o(`openhands`),{backends:n,removeBackend:r}=f(),i=y(n,{probeDisabledOnce:!0}),[s,l]=E.useState(null),[d,p]=E.useState(null),[b,S]=E.useState(!1);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m,{onClose:e,"aria-label":t(a.BACKEND$MANAGE_TITLE),children:(0,D.jsxs)(`div`,{"data-testid":`manage-backends-modal`,className:u(`relative flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border)] rounded-xl`,h(`lg`),g,`max-h-[70vh]`),children:[(0,D.jsx)(C,{onClose:e,testId:`close-manage-backends-modal`}),(0,D.jsx)(`div`,{className:`p-5 pr-12`,children:(0,D.jsx)(`h2`,{className:_,children:t(a.BACKEND$MANAGE_TITLE)})}),(0,D.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-5`,children:(0,D.jsx)(`div`,{className:`flex-1 overflow-auto rounded-md border border-[var(--oh-border)] bg-surface-raised custom-scrollbar-always`,"data-testid":`manage-backends-list`,children:n.length===0?(0,D.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-[var(--oh-text-secondary)]`,children:t(a.BACKEND$MANAGE_EMPTY)}):(0,D.jsx)(`ul`,{className:`divide-y divide-[var(--oh-border)]`,children:n.map(e=>(0,D.jsx)(A,{backend:e,health:i[e.id],onEdit:()=>p(e),onRemove:()=>l({id:e.id,name:e.name})},e.id))})})}),(0,D.jsxs)(`div`,{className:`flex justify-end gap-2 p-5`,children:[(0,D.jsx)(v,{type:`button`,variant:`secondary`,onClick:()=>S(!0),testId:`manage-backends-add`,startContent:(0,D.jsx)(c,{width:14,height:14}),children:t(a.BACKEND$ADD)}),(0,D.jsx)(v,{type:`button`,variant:`primary`,onClick:e,testId:`manage-backends-done`,children:t(a.HOME$DONE)})]})]})}),b?(0,D.jsx)(x,{mode:`add`,onClose:()=>S(!1)}):null,d?(0,D.jsx)(x,{mode:`edit`,backend:d,onClose:()=>p(null)}):null,s?(0,D.jsx)(w,{text:t(a.BACKEND$REMOVE_CONFIRMATION,{name:s.name}),onConfirm:()=>{s&&(r(s.id),l(null))},onCancel:()=>l(null)}):null]})}export{T as n,j as t};
@@ -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{t as r}from"./useMutation-GSSKKebK.js";import{i}from"./organization-service.api-DbnougaQ.js";import{o as a,t as o}from"./declaration-CR6HMp29.js";import{n as s}from"./QueryClientProvider-Cnr-Yl3j.js";import{t as c}from"./useTranslation-B6voJV4y.js";import{t as l}from"./utils-DCVfKFRt.js";import{n as u}from"./agent-server-client-options-HEOwGVIU.js";import{n as d}from"./active-backend-context-Beu-LZL-.js";import{a as f,d as p,u as m}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-hTzSytKK.js";import{r as h}from"./query-keys-tAsQcc_9.js";import{t as g}from"./modal-backdrop-RfNCrSpK.js";import{r as _,t as v}from"./modal-body-aoa2fx5W.js";import{r as y}from"./base-modal-C2oy2EBG.js";import{i as b}from"./modal-classes-6YqcqA6y.js";import{t as x}from"./brand-button-DJ_S16rO.js";import{t as S}from"./openhands-logo-CCo0wJZX.js";import{t as C}from"./confirmation-modal-B5Ca6qFE.js";import{t as w}from"./terminal-CPYWdo4j.js";import{t as T}from"./folder-D1T2W1cj.js";import{t as E}from"./chevron-left-small-_uvG7RVM.js";import{t as D}from"./close-BU5iTc66.js";var O=`m19.6 66.5 19.7-11 .3-1-.3-.5h-1l-3.3-.2-11.2-.3L14 53l-9.5-.5-2.4-.5L0 49l.2-1.5 2-1.3 2.9.2 6.3.5 9.5.6 6.9.4L38 49.1h1.6l.2-.7-.5-.4-.4-.4L29 41l-10.6-7-5.6-4.1-3-2-1.5-2-.6-4.2 2.7-3 3.7.3.9.2 3.7 2.9 8 6.1L37 36l1.5 1.2.6-.4.1-.3-.7-1.1L33 25l-6-10.4-2.7-4.3-.7-2.6c-.3-1-.4-2-.4-3l3-4.2L28 0l4.2.6L33.8 2l2.6 6 4.1 9.3L47 29.9l2 3.8 1 3.4.3 1h.7v-.5l.5-7.2 1-8.7 1-11.2.3-3.2 1.6-3.8 3-2L61 2.6l2 2.9-.3 1.8-1.1 7.7L59 27.1l-1.5 8.2h.9l1-1.1 4.1-5.4 6.9-8.6 3-3.5L77 13l2.3-1.8h4.3l3.1 4.7-1.4 4.9-4.4 5.6-3.7 4.7-5.3 7.1-3.2 5.7.3.4h.7l12-2.6 6.4-1.1 7.6-1.3 3.5 1.6.4 1.6-1.4 3.4-8.2 2-9.6 2-14.3 3.3-.2.1.2.3 6.4.6 2.8.2h6.8l12.6 1 3.3 2 1.9 2.7-.3 2-5.1 2.6-6.8-1.6-16-3.8-5.4-1.3h-.8v.4l4.6 4.5 8.3 7.5L89 80.1l.5 2.4-1.3 2-1.4-.2-9.2-7-3.6-3-8-6.8h-.5v.7l1.8 2.7 9.8 14.7.5 4.5-.7 1.4-2.6 1-2.7-.6-5.8-8-6-9-4.7-8.2-.5.4-2.9 30.2-1.3 1.5-3 1.2-2.5-2-1.4-3 1.4-6.2 1.6-8 1.3-6.4 1.2-7.9.7-2.6v-.2H49L43 72l-9 12.3-7.2 7.6-1.7.7-3-1.5.3-2.8L24 86l10-12.8 6-7.9 4-4.6-.1-.5h-.3L17.2 77.4l-4.7.6-2-2 .2-3 1-1 8-5.5Z`,k=`0 0 100 100`,A=`M4.04286 0.228393C4.52451 0.0304495 5.0488 -0.0409817 5.56586 0.0208928C6.23236 0.0973928 6.82636 0.380893 7.34786 0.870893C7.35488 0.877545 7.36344 0.882351 7.37278 0.884881C7.38212 0.887412 7.39194 0.887588 7.40136 0.885393C8.10536 0.712393 8.78236 0.773393 9.43186 1.06839L9.46336 1.08339L9.54036 1.12139C10.2189 1.47289 10.7054 2.00639 10.9994 2.72039C11.1384 3.05989 11.2084 3.41439 11.2099 3.78339C11.2197 4.05816 11.1893 4.33288 11.1199 4.59889C11.1164 4.61245 11.1165 4.62665 11.12 4.6402C11.1235 4.65374 11.1303 4.66618 11.1399 4.67639C11.5329 5.0749 11.8063 5.57572 11.9289 6.12189C12.1214 7.07239 11.9239 7.92939 11.3374 8.69189L11.2464 8.80189C10.8579 9.24669 10.3481 9.56836 9.77936 9.72739C9.76694 9.73097 9.75556 9.73747 9.74617 9.74634C9.73677 9.75521 9.72964 9.7662 9.72536 9.77839C9.59786 10.1464 9.46986 10.4604 9.23186 10.7744C8.63236 11.5654 7.75086 12.0054 6.75786 11.9999C5.96636 11.9959 5.26486 11.7064 4.65286 11.1319C4.64358 11.1234 4.63225 11.1174 4.61998 11.1146C4.6077 11.1118 4.59491 11.1123 4.58286 11.1159C4.32386 11.1994 4.06286 11.2114 3.78086 11.2084C3.33033 11.2048 2.88658 11.0984 2.48336 10.8974C2.0613 10.688 1.6939 10.3831 1.41036 10.0069C1.30886 9.87239 1.20836 9.74589 1.13486 9.59639C1.03349 9.39033 0.95066 9.17565 0.887357 8.95489C0.754446 8.45324 0.751521 7.92599 0.878857 7.42289C0.882974 7.41102 0.884341 7.39837 0.882857 7.38589C0.88038 7.37348 0.873877 7.36223 0.864357 7.35389C0.556147 7.04213 0.320543 6.66619 0.174357 6.25289C0.0775698 5.99842 0.0213841 5.73031 0.00785682 5.45839C-0.0163229 5.10033 0.0153902 4.74069 0.101857 4.39239C0.326857 3.65039 0.756357 3.06839 1.39036 2.64589C1.53136 2.55189 1.66536 2.47889 1.79136 2.42689C1.93436 2.36689 2.07786 2.31689 2.22186 2.27489C2.23216 2.27184 2.24153 2.26626 2.24913 2.25866C2.25672 2.25107 2.2623 2.24169 2.26536 2.23139C2.37455 1.83888 2.56235 1.47264 2.81736 1.15489C3.15736 0.731893 3.56586 0.422893 4.04286 0.228393ZM3.64086 4.15339C3.58503 4.05573 3.49269 3.98424 3.38415 3.95465C3.27562 3.92507 3.15977 3.93981 3.06211 3.99564C2.96444 4.05147 2.89295 4.14381 2.86337 4.25235C2.83378 4.36088 2.84853 4.47673 2.90436 4.57439L3.75136 6.05689L2.90736 7.48089C2.85561 7.57738 2.84315 7.69014 2.87257 7.7956C2.902 7.90106 2.97104 7.99108 3.06526 8.04684C3.15949 8.1026 3.27162 8.1198 3.37823 8.09484C3.48484 8.06988 3.57768 8.00469 3.63736 7.91289L4.60736 6.27689C4.64561 6.21237 4.66609 6.13887 4.66671 6.06386C4.66732 5.98886 4.64805 5.91503 4.61086 5.84989L3.64086 4.15339ZM6.36386 7.27339C6.25583 7.27982 6.15434 7.32727 6.08012 7.40603C6.00591 7.48479 5.96458 7.58892 5.96458 7.69714C5.96458 7.80536 6.00591 7.90949 6.08012 7.98826C6.15434 8.06702 6.25583 8.11446 6.36386 8.12089H8.78786C8.89675 8.1156 8.99943 8.06862 9.07462 7.98969C9.14982 7.91075 9.19176 7.80591 9.19176 7.69689C9.19176 7.58787 9.14982 7.48303 9.07462 7.4041C8.99943 7.32516 8.89675 7.27818 8.78786 7.27289H6.36386V7.27339Z`,j=`0 0 12 12`,M=`M12 0C12.904 6.056 17.944 11.096 24 12C17.944 12.904 12.904 17.944 12 24C11.096 17.944 6.056 12.904 0 12C6.056 11.096 11.096 6.056 12 0Z`,N=`0 0 24 24`,P=a(),F=3/2;function I({kind:e,size:t=12,className:n,"data-testid":r}){return e===`openhands`?(0,P.jsx)(S,{width:Math.round(t*F),height:t,className:l(`shrink-0 [&_path:not([fill=transparent])]:fill-current`,n),"data-testid":r??`agent-brand-icon-openhands`,"aria-hidden":!0}):e===`claude-code`?(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:k,width:t,height:t,className:l(`shrink-0`,n),"data-testid":r??`agent-brand-icon-claude-code`,"aria-hidden":!0,children:(0,P.jsx)(`path`,{fill:`currentColor`,d:O})}):e===`codex`?(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:j,width:t,height:t,className:l(`shrink-0`,n),"data-testid":r??`agent-brand-icon-codex`,"aria-hidden":!0,children:(0,P.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:A,fill:`currentColor`})}):e===`gemini`?(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:N,width:t,height:t,className:l(`shrink-0`,n),"data-testid":r??`agent-brand-icon-gemini`,"aria-hidden":!0,children:(0,P.jsx)(`path`,{fill:`currentColor`,d:M})}):(0,P.jsx)(w,{width:t,height:t,className:l(`shrink-0`,n),"data-testid":r??`agent-brand-icon-generic`,"aria-hidden":!0})}function L(){return new f(u())}function R(e){return{workspaces:e.workspaces.map(({parentPath:e,...t})=>({...t,...e?{parentPath:e}:{}})),workspaceParents:e.workspaceParents}}var z=class{static async listWorkspaces(){return R(await L().listWorkspaces())}static async addWorkspaces(e){return R(await L().addWorkspaces(e))}static async removeWorkspace(e){await L().deleteWorkspace(e)}static async addWorkspaceParents(e){return R(await L().addWorkspaceParents(e))}static async removeWorkspaceParent(e){await L().deleteWorkspaceParent(e)}};function B(){let e=s();return r({mutationFn:e=>z.addWorkspaces(e),onSuccess:()=>e.invalidateQueries({queryKey:h.all})})}function V(){let e=s();return r({mutationFn:e=>z.removeWorkspace(e),onSuccess:()=>e.invalidateQueries({queryKey:h.all})})}function H(){let e=s();return r({mutationFn:e=>z.addWorkspaceParents(e),onSuccess:()=>e.invalidateQueries({queryKey:h.all})})}function U(){let e=s();return r({mutationFn:e=>z.removeWorkspaceParent(e),onSuccess:()=>e.invalidateQueries({queryKey:h.all})})}var W=e(t(),1);function G({enabled:e=!0}={}){return n({queryKey:h.all,queryFn:()=>z.listWorkspaces(),enabled:e,retry:(e,t)=>!p(t)&&e<3,meta:{disableToast:!0},staleTime:6e4})}function K(){let{data:e,isLoading:t,isError:n,error:r}=G(),a=p(r),o=e?.workspaces??[],s=e?.workspaceParents??[],c=(0,W.useMemo)(()=>{let e=new Set(s.map(e=>e.path)),t=[].filter(t=>!e.has(t.path));return t.length===0?s:[...s,...t]},[s,a]),l=i({queries:a?[]:c.map(e=>({queryKey:[`file`,`search_subdirs`,e.path],queryFn:()=>new m(u()).searchSubdirectories(e.path),retry:!1,meta:{disableToast:!0}}))}),d=t||l.some(e=>e.isLoading),f=n||l.some(e=>e.isError);return{workspaces:(0,W.useMemo)(()=>{let e=new Map,t=new Map(c.map((e,t)=>[e.path,l[t]]));return c.forEach(n=>{(t.get(n.path)?.data?.items??[]).forEach(t=>{e.has(t.path)||e.set(t.path,{id:t.path,name:t.name,path:t.path,parentPath:n.path})})}),o.forEach(t=>{e.set(t.path,t)}),Array.from(e.values())},[o,c,l.map(e=>`${e.dataUpdatedAt??0}:${e.status}`).join(`|`)]),isLoading:d,isError:f,error:r}}function q(e,t){return p(e)?t(o.HOME$WORKSPACES_UNSUPPORTED_AGENT_SERVER,{actualVersion:e.actualVersion,requiredVersion:e.requiredVersion}):null}function J(){return new m(u())}var Y=e=>{let t=d();return n({queryKey:[`file`,`search_subdirs`,e,t.backend.id,t.orgId],queryFn:()=>J().searchSubdirectories(e),enabled:!!e,retry:!1,meta:{disableToast:!0}})},X=()=>{let e=d();return n({queryKey:[`file`,`home`,e.backend.id,e.orgId],queryFn:async()=>J().getHome(),retry:!1,meta:{disableToast:!0},staleTime:1/0})},Z=`/projects`;function Q({label:e,entries:t,currentPath:n,onPick:r}){return t.length===0?null:(0,P.jsxs)(`div`,{className:`px-2 pb-3`,children:[(0,P.jsx)(`div`,{className:`px-2 pb-1 text-[11px] uppercase tracking-wide text-[var(--oh-muted)] font-semibold`,children:e}),(0,P.jsx)(`ul`,{children:t.map(e=>{let t=n===e.path;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>r(e.path),"data-testid":`folder-browser-sidebar-${e.label.toLowerCase()}`,className:l(`flex items-center gap-2 w-full px-2 py-1 rounded text-sm cursor-pointer`,t?`bg-tertiary text-white`:`text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-surface-raised)]`),children:[(0,P.jsx)(T,{width:14,height:14,className:`shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.path)})})]})}function ee(e){let t=e.replace(/\/+$/,``);if(!t||t===`/`)return null;let n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function $(e){return e?.home===`/home/openhands`}function te({isOpen:e,onClose:t,onAdd:n,onAddParent:r}){let{t:i}=c(`openhands`),[a,s]=(0,W.useState)(null),u=d(),{data:f}=X();(0,W.useEffect)(()=>{e&&f?.home&&a===null&&s($(f)?Z:f.home),e||s(null)},[e,f?.home,a]),(0,W.useEffect)(()=>{s(null)},[u.backend.id,u.orgId]);let{data:p,isLoading:m,isError:h,error:S}=Y(e?a:null),C=(0,W.useMemo)(()=>{if(!f?.home)return[];let e=[{label:`Home`,path:f.home.replace(/[\\/]+$/,``)||f.home},...f.favorites??[]];return $(f)&&!e.some(e=>e.path===Z)&&e.push({label:Z,path:Z}),e},[f]),w=f?.locations??[];if(!e)return null;let D=p?.items??[],O=a?ee(a):null,k=f?.home===`/home/openhands`&&(f?.favorites?.length??0)===0&&a===f?.home&&!m&&!h&&D.length===0,A=e=>{let t=e.replace(/\/+$/,``);if(!t)return`/`;let n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1)||`/`:t};return(0,P.jsx)(g,{onClose:t,"aria-label":i(o.HOME$ADD_WORKSPACES_TITLE),children:(0,P.jsxs)(`div`,{"data-testid":`folder-browser-modal`,className:l(`flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-xl`,_(`xl`),v,`h-[480px]`),children:[(0,P.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-[var(--oh-border-input)]`,children:(0,P.jsx)(y,{className:b,title:i(o.HOME$ADD_WORKSPACES_TITLE)})}),(0,P.jsxs)(`div`,{className:`flex flex-1 min-h-0`,children:[(0,P.jsxs)(`aside`,{"data-testid":`folder-browser-sidebar`,className:`w-[180px] shrink-0 border-r border-[var(--oh-border-input)] bg-[var(--oh-surface)] py-3 overflow-y-auto`,children:[(0,P.jsx)(Q,{label:i(o.HOME$FAVORITES),entries:C,currentPath:a,onPick:s}),(0,P.jsx)(Q,{label:i(o.HOME$LOCATIONS),entries:w,currentPath:a,onPick:s})]}),(0,P.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-b border-[var(--oh-border-input)]`,children:[(0,P.jsx)(`button`,{type:`button`,"data-testid":`folder-browser-up`,onClick:()=>O&&s(O),disabled:!O,"aria-label":`Up`,className:`p-1 rounded hover:bg-[var(--oh-interactive-hover)] text-white disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,P.jsx)(E,{width:16,height:16})}),(0,P.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,"data-testid":`folder-browser-current-path`,children:a??``})]}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[1fr_120px] px-4 py-1 border-b border-[var(--oh-border-input)] text-xs text-[var(--oh-text-secondary)] font-semibold`,children:[(0,P.jsx)(`span`,{children:i(o.HOME$NAME)}),(0,P.jsx)(`span`,{children:i(o.HOME$KIND)})]}),(0,P.jsxs)(`ul`,{className:`flex-1 overflow-auto custom-scrollbar-always`,"data-testid":`folder-browser-list`,children:[m&&(0,P.jsx)(`li`,{className:`px-4 py-2 text-sm text-[var(--oh-text-secondary)]`,children:i(o.HOME$LOADING)}),h&&(0,P.jsx)(`li`,{className:`px-4 py-2 text-sm text-red-400`,"data-testid":`folder-browser-error`,children:S?.message??`Failed to load`}),!m&&!h&&D.length===0&&(0,P.jsx)(`li`,{className:`px-4 py-2 text-sm text-[var(--oh-text-secondary)]`,"data-testid":k?`folder-browser-host-home-hint`:`folder-browser-empty`,children:i(k?o.HOME$HOST_HOME_NOT_MOUNTED_HINT:o.HOME$NO_WORKSPACES)}),D.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>s(e.path),className:`grid grid-cols-[1fr_120px] items-center w-full text-left px-4 py-1.5 text-sm text-white hover:bg-[var(--oh-interactive-hover)] cursor-pointer`,"data-testid":`folder-browser-entry-${e.name}`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-2 min-w-0`,children:[(0,P.jsx)(T,{width:16,height:16,className:`shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,P.jsx)(`span`,{className:`text-[var(--oh-text-secondary)] text-xs`,children:i(o.HOME$FOLDER)})]})},e.path))]})]})]}),(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-5 py-3 border-t border-[var(--oh-border-input)]`,children:[(0,P.jsx)(x,{type:`button`,variant:`secondary`,onClick:t,testId:`folder-browser-cancel`,children:i(o.HOME$CANCEL)}),r&&(0,P.jsx)(x,{type:`button`,variant:`secondary`,onClick:()=>{!a||!r||(r([{id:a,name:A(a),path:a}]),t())},isDisabled:!a||m,testId:`folder-browser-add-all-subdirs`,children:i(o.HOME$ADD_ALL_SUBDIRECTORIES)}),(0,P.jsx)(x,{type:`button`,variant:`primary`,onClick:()=>{a&&(n([{id:a,name:A(a),path:a}]),t())},isDisabled:!a||m,testId:`folder-browser-use`,children:i(o.HOME$ADD_THIS_DIRECTORY)})]})]})})}function ne({isOpen:e,workspaces:t,workspaceParents:n=[],onClose:r,onRemove:i,onRemoveParent:a}){let{t:s}=c(`openhands`),[u,d]=W.useState(null);if(!e)return null;let f=t.filter(e=>!e.parentPath),p=new Map;t.forEach(e=>{if(!e.parentPath)return;let t=p.get(e.parentPath)??[];t.push(e),p.set(e.parentPath,t)});let m=f.length>0||n.length>0;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(g,{onClose:r,"aria-label":s(o.HOME$MANAGE_WORKSPACES),children:(0,P.jsxs)(`div`,{"data-testid":`manage-workspaces-modal`,className:l(`flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-xl`,_(`lg`),v,`max-h-[70vh]`),children:[(0,P.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-[var(--oh-border-input)]`,children:(0,P.jsx)(y,{className:b,title:s(o.HOME$MANAGE_WORKSPACES)})}),(0,P.jsxs)(`div`,{className:`flex-1 overflow-auto custom-scrollbar-always`,"data-testid":`manage-workspaces-list`,children:[!m&&(0,P.jsx)(`p`,{className:`px-5 py-6 text-sm text-[var(--oh-text-secondary)] text-center`,children:s(o.HOME$MANAGE_WORKSPACES_EMPTY)}),f.length>0&&(0,P.jsx)(`ul`,{children:f.map(e=>(0,P.jsxs)(`li`,{className:`flex items-center gap-3 px-5 py-2 border-b border-[var(--oh-border-subtle)] last:border-b-0`,"data-testid":`manage-workspaces-row-${e.name}`,children:[(0,P.jsx)(T,{width:16,height:16,className:`shrink-0`}),(0,P.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),(0,P.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,children:e.path})]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>d({type:`workspace`,path:e.path,text:s(o.HOME$REMOVE_WORKSPACE_CONFIRMATION,{name:e.name})}),"aria-label":s(o.HOME$REMOVE_WORKSPACE),"data-testid":`manage-workspaces-remove-${e.name}`,className:`flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-interactive-hover)] hover:text-white cursor-pointer`,children:[(0,P.jsx)(D,{width:12,height:12}),(0,P.jsx)(`span`,{children:s(o.HOME$REMOVE_WORKSPACE)})]})]},e.id))}),n.length>0&&(0,P.jsxs)(`div`,{"data-testid":`manage-workspaces-parents-section`,children:[(0,P.jsx)(`div`,{className:`px-5 pt-3 pb-1 text-[11px] uppercase tracking-wide text-[var(--oh-muted)] font-semibold`,children:s(o.HOME$WORKSPACE_PARENTS)}),(0,P.jsx)(`ul`,{children:n.map(e=>{let t=p.get(e.path)??[];return(0,P.jsxs)(`li`,{className:`border-b border-[var(--oh-border-subtle)] last:border-b-0`,"data-testid":`manage-workspaces-parent-row-${e.name}`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-2`,children:[(0,P.jsx)(T,{width:16,height:16,className:`shrink-0`}),(0,P.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),(0,P.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,children:e.path})]}),a&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>d({type:`parent`,path:e.path,text:s(o.HOME$REMOVE_WORKSPACE_PARENT_CONFIRMATION,{name:e.name,count:t.length})}),"aria-label":s(o.HOME$REMOVE_WORKSPACE_PARENT),"data-testid":`manage-workspaces-remove-parent-${e.name}`,className:`flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-interactive-hover)] hover:text-white cursor-pointer`,children:[(0,P.jsx)(D,{width:12,height:12}),(0,P.jsx)(`span`,{children:s(o.HOME$REMOVE_WORKSPACE_PARENT)})]})]}),t.length>0&&(0,P.jsx)(`ul`,{className:`pb-2`,children:t.map(e=>(0,P.jsxs)(`li`,{className:`flex items-center gap-3 px-5 pl-10 py-1 text-xs text-[var(--oh-text-secondary)]`,"data-testid":`manage-workspaces-child-${e.name}`,children:[(0,P.jsx)(T,{width:12,height:12,className:`shrink-0 opacity-70`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})]},e.id)})})]})]}),(0,P.jsx)(`div`,{className:`flex justify-end gap-2 px-5 py-3 border-t border-[var(--oh-border-input)]`,children:(0,P.jsx)(x,{type:`button`,variant:`primary`,onClick:r,testId:`manage-workspaces-done`,children:s(o.HOME$DONE)})})]})}),u&&(0,P.jsx)(C,{text:u.text,onConfirm:()=>{u&&(u.type===`workspace`?i(u.path):a?.(u.path),d(null))},onCancel:()=>d(null)})]})}export{G as a,V as c,K as i,U as l,te as n,H as o,q as r,B as s,ne as t,I as u};
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{t as r}from"./useMutation-GSSKKebK.js";import{i}from"./organization-service.api-BeuMC9QL.js";import{o as a,t as o}from"./declaration-CR6HMp29.js";import{n as s}from"./QueryClientProvider-Cnr-Yl3j.js";import{t as c}from"./useTranslation-B6voJV4y.js";import{t as l}from"./utils-DCVfKFRt.js";import{n as u}from"./agent-server-client-options-9agOSarV.js";import{n as d}from"./active-backend-context-BSPE-W72.js";import{a as f,d as p,u as m}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-D8soyAAx.js";import{r as h}from"./query-keys-tAsQcc_9.js";import{t as g}from"./modal-backdrop-RfNCrSpK.js";import{r as _,t as v}from"./modal-body-aoa2fx5W.js";import{r as y}from"./base-modal-C2oy2EBG.js";import{i as b}from"./modal-classes-6YqcqA6y.js";import{t as x}from"./brand-button-DJ_S16rO.js";import{t as S}from"./openhands-logo-CCo0wJZX.js";import{t as C}from"./confirmation-modal-B5Ca6qFE.js";import{t as w}from"./terminal-CPYWdo4j.js";import{t as T}from"./folder-D1T2W1cj.js";import{t as E}from"./chevron-left-small-_uvG7RVM.js";import{t as D}from"./close-BU5iTc66.js";var O=`m19.6 66.5 19.7-11 .3-1-.3-.5h-1l-3.3-.2-11.2-.3L14 53l-9.5-.5-2.4-.5L0 49l.2-1.5 2-1.3 2.9.2 6.3.5 9.5.6 6.9.4L38 49.1h1.6l.2-.7-.5-.4-.4-.4L29 41l-10.6-7-5.6-4.1-3-2-1.5-2-.6-4.2 2.7-3 3.7.3.9.2 3.7 2.9 8 6.1L37 36l1.5 1.2.6-.4.1-.3-.7-1.1L33 25l-6-10.4-2.7-4.3-.7-2.6c-.3-1-.4-2-.4-3l3-4.2L28 0l4.2.6L33.8 2l2.6 6 4.1 9.3L47 29.9l2 3.8 1 3.4.3 1h.7v-.5l.5-7.2 1-8.7 1-11.2.3-3.2 1.6-3.8 3-2L61 2.6l2 2.9-.3 1.8-1.1 7.7L59 27.1l-1.5 8.2h.9l1-1.1 4.1-5.4 6.9-8.6 3-3.5L77 13l2.3-1.8h4.3l3.1 4.7-1.4 4.9-4.4 5.6-3.7 4.7-5.3 7.1-3.2 5.7.3.4h.7l12-2.6 6.4-1.1 7.6-1.3 3.5 1.6.4 1.6-1.4 3.4-8.2 2-9.6 2-14.3 3.3-.2.1.2.3 6.4.6 2.8.2h6.8l12.6 1 3.3 2 1.9 2.7-.3 2-5.1 2.6-6.8-1.6-16-3.8-5.4-1.3h-.8v.4l4.6 4.5 8.3 7.5L89 80.1l.5 2.4-1.3 2-1.4-.2-9.2-7-3.6-3-8-6.8h-.5v.7l1.8 2.7 9.8 14.7.5 4.5-.7 1.4-2.6 1-2.7-.6-5.8-8-6-9-4.7-8.2-.5.4-2.9 30.2-1.3 1.5-3 1.2-2.5-2-1.4-3 1.4-6.2 1.6-8 1.3-6.4 1.2-7.9.7-2.6v-.2H49L43 72l-9 12.3-7.2 7.6-1.7.7-3-1.5.3-2.8L24 86l10-12.8 6-7.9 4-4.6-.1-.5h-.3L17.2 77.4l-4.7.6-2-2 .2-3 1-1 8-5.5Z`,k=`0 0 100 100`,A=`M4.04286 0.228393C4.52451 0.0304495 5.0488 -0.0409817 5.56586 0.0208928C6.23236 0.0973928 6.82636 0.380893 7.34786 0.870893C7.35488 0.877545 7.36344 0.882351 7.37278 0.884881C7.38212 0.887412 7.39194 0.887588 7.40136 0.885393C8.10536 0.712393 8.78236 0.773393 9.43186 1.06839L9.46336 1.08339L9.54036 1.12139C10.2189 1.47289 10.7054 2.00639 10.9994 2.72039C11.1384 3.05989 11.2084 3.41439 11.2099 3.78339C11.2197 4.05816 11.1893 4.33288 11.1199 4.59889C11.1164 4.61245 11.1165 4.62665 11.12 4.6402C11.1235 4.65374 11.1303 4.66618 11.1399 4.67639C11.5329 5.0749 11.8063 5.57572 11.9289 6.12189C12.1214 7.07239 11.9239 7.92939 11.3374 8.69189L11.2464 8.80189C10.8579 9.24669 10.3481 9.56836 9.77936 9.72739C9.76694 9.73097 9.75556 9.73747 9.74617 9.74634C9.73677 9.75521 9.72964 9.7662 9.72536 9.77839C9.59786 10.1464 9.46986 10.4604 9.23186 10.7744C8.63236 11.5654 7.75086 12.0054 6.75786 11.9999C5.96636 11.9959 5.26486 11.7064 4.65286 11.1319C4.64358 11.1234 4.63225 11.1174 4.61998 11.1146C4.6077 11.1118 4.59491 11.1123 4.58286 11.1159C4.32386 11.1994 4.06286 11.2114 3.78086 11.2084C3.33033 11.2048 2.88658 11.0984 2.48336 10.8974C2.0613 10.688 1.6939 10.3831 1.41036 10.0069C1.30886 9.87239 1.20836 9.74589 1.13486 9.59639C1.03349 9.39033 0.95066 9.17565 0.887357 8.95489C0.754446 8.45324 0.751521 7.92599 0.878857 7.42289C0.882974 7.41102 0.884341 7.39837 0.882857 7.38589C0.88038 7.37348 0.873877 7.36223 0.864357 7.35389C0.556147 7.04213 0.320543 6.66619 0.174357 6.25289C0.0775698 5.99842 0.0213841 5.73031 0.00785682 5.45839C-0.0163229 5.10033 0.0153902 4.74069 0.101857 4.39239C0.326857 3.65039 0.756357 3.06839 1.39036 2.64589C1.53136 2.55189 1.66536 2.47889 1.79136 2.42689C1.93436 2.36689 2.07786 2.31689 2.22186 2.27489C2.23216 2.27184 2.24153 2.26626 2.24913 2.25866C2.25672 2.25107 2.2623 2.24169 2.26536 2.23139C2.37455 1.83888 2.56235 1.47264 2.81736 1.15489C3.15736 0.731893 3.56586 0.422893 4.04286 0.228393ZM3.64086 4.15339C3.58503 4.05573 3.49269 3.98424 3.38415 3.95465C3.27562 3.92507 3.15977 3.93981 3.06211 3.99564C2.96444 4.05147 2.89295 4.14381 2.86337 4.25235C2.83378 4.36088 2.84853 4.47673 2.90436 4.57439L3.75136 6.05689L2.90736 7.48089C2.85561 7.57738 2.84315 7.69014 2.87257 7.7956C2.902 7.90106 2.97104 7.99108 3.06526 8.04684C3.15949 8.1026 3.27162 8.1198 3.37823 8.09484C3.48484 8.06988 3.57768 8.00469 3.63736 7.91289L4.60736 6.27689C4.64561 6.21237 4.66609 6.13887 4.66671 6.06386C4.66732 5.98886 4.64805 5.91503 4.61086 5.84989L3.64086 4.15339ZM6.36386 7.27339C6.25583 7.27982 6.15434 7.32727 6.08012 7.40603C6.00591 7.48479 5.96458 7.58892 5.96458 7.69714C5.96458 7.80536 6.00591 7.90949 6.08012 7.98826C6.15434 8.06702 6.25583 8.11446 6.36386 8.12089H8.78786C8.89675 8.1156 8.99943 8.06862 9.07462 7.98969C9.14982 7.91075 9.19176 7.80591 9.19176 7.69689C9.19176 7.58787 9.14982 7.48303 9.07462 7.4041C8.99943 7.32516 8.89675 7.27818 8.78786 7.27289H6.36386V7.27339Z`,j=`0 0 12 12`,M=`M12 0C12.904 6.056 17.944 11.096 24 12C17.944 12.904 12.904 17.944 12 24C11.096 17.944 6.056 12.904 0 12C6.056 11.096 11.096 6.056 12 0Z`,N=`0 0 24 24`,P=a(),F=3/2;function I({kind:e,size:t=12,className:n,"data-testid":r}){return e===`openhands`?(0,P.jsx)(S,{width:Math.round(t*F),height:t,className:l(`shrink-0 [&_path:not([fill=transparent])]:fill-current`,n),"data-testid":r??`agent-brand-icon-openhands`,"aria-hidden":!0}):e===`claude-code`?(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:k,width:t,height:t,className:l(`shrink-0`,n),"data-testid":r??`agent-brand-icon-claude-code`,"aria-hidden":!0,children:(0,P.jsx)(`path`,{fill:`currentColor`,d:O})}):e===`codex`?(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:j,width:t,height:t,className:l(`shrink-0`,n),"data-testid":r??`agent-brand-icon-codex`,"aria-hidden":!0,children:(0,P.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:A,fill:`currentColor`})}):e===`gemini`?(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:N,width:t,height:t,className:l(`shrink-0`,n),"data-testid":r??`agent-brand-icon-gemini`,"aria-hidden":!0,children:(0,P.jsx)(`path`,{fill:`currentColor`,d:M})}):(0,P.jsx)(w,{width:t,height:t,className:l(`shrink-0`,n),"data-testid":r??`agent-brand-icon-generic`,"aria-hidden":!0})}function L(){return new f(u())}function R(e){return{workspaces:e.workspaces.map(({parentPath:e,...t})=>({...t,...e?{parentPath:e}:{}})),workspaceParents:e.workspaceParents}}var z=class{static async listWorkspaces(){return R(await L().listWorkspaces())}static async addWorkspaces(e){return R(await L().addWorkspaces(e))}static async removeWorkspace(e){await L().deleteWorkspace(e)}static async addWorkspaceParents(e){return R(await L().addWorkspaceParents(e))}static async removeWorkspaceParent(e){await L().deleteWorkspaceParent(e)}};function B(){let e=s();return r({mutationFn:e=>z.addWorkspaces(e),onSuccess:()=>e.invalidateQueries({queryKey:h.all})})}function V(){let e=s();return r({mutationFn:e=>z.removeWorkspace(e),onSuccess:()=>e.invalidateQueries({queryKey:h.all})})}function H(){let e=s();return r({mutationFn:e=>z.addWorkspaceParents(e),onSuccess:()=>e.invalidateQueries({queryKey:h.all})})}function U(){let e=s();return r({mutationFn:e=>z.removeWorkspaceParent(e),onSuccess:()=>e.invalidateQueries({queryKey:h.all})})}var W=e(t(),1);function G({enabled:e=!0}={}){return n({queryKey:h.all,queryFn:()=>z.listWorkspaces(),enabled:e,retry:(e,t)=>!p(t)&&e<3,meta:{disableToast:!0},staleTime:6e4})}function K(){let{data:e,isLoading:t,isError:n,error:r}=G(),a=p(r),o=e?.workspaces??[],s=e?.workspaceParents??[],c=(0,W.useMemo)(()=>{let e=new Set(s.map(e=>e.path)),t=[].filter(t=>!e.has(t.path));return t.length===0?s:[...s,...t]},[s,a]),l=i({queries:a?[]:c.map(e=>({queryKey:[`file`,`search_subdirs`,e.path],queryFn:()=>new m(u()).searchSubdirectories(e.path),retry:!1,meta:{disableToast:!0}}))}),d=t||l.some(e=>e.isLoading),f=n||l.some(e=>e.isError);return{workspaces:(0,W.useMemo)(()=>{let e=new Map,t=new Map(c.map((e,t)=>[e.path,l[t]]));return c.forEach(n=>{(t.get(n.path)?.data?.items??[]).forEach(t=>{e.has(t.path)||e.set(t.path,{id:t.path,name:t.name,path:t.path,parentPath:n.path})})}),o.forEach(t=>{e.set(t.path,t)}),Array.from(e.values())},[o,c,l.map(e=>`${e.dataUpdatedAt??0}:${e.status}`).join(`|`)]),isLoading:d,isError:f,error:r}}function q(e,t){return p(e)?t(o.HOME$WORKSPACES_UNSUPPORTED_AGENT_SERVER,{actualVersion:e.actualVersion,requiredVersion:e.requiredVersion}):null}function J(){return new m(u())}var Y=e=>{let t=d();return n({queryKey:[`file`,`search_subdirs`,e,t.backend.id,t.orgId],queryFn:()=>J().searchSubdirectories(e),enabled:!!e,retry:!1,meta:{disableToast:!0}})},X=()=>{let e=d();return n({queryKey:[`file`,`home`,e.backend.id,e.orgId],queryFn:async()=>J().getHome(),retry:!1,meta:{disableToast:!0},staleTime:1/0})},Z=`/projects`;function Q({label:e,entries:t,currentPath:n,onPick:r}){return t.length===0?null:(0,P.jsxs)(`div`,{className:`px-2 pb-3`,children:[(0,P.jsx)(`div`,{className:`px-2 pb-1 text-[11px] uppercase tracking-wide text-[var(--oh-muted)] font-semibold`,children:e}),(0,P.jsx)(`ul`,{children:t.map(e=>{let t=n===e.path;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>r(e.path),"data-testid":`folder-browser-sidebar-${e.label.toLowerCase()}`,className:l(`flex items-center gap-2 w-full px-2 py-1 rounded text-sm cursor-pointer`,t?`bg-tertiary text-white`:`text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-surface-raised)]`),children:[(0,P.jsx)(T,{width:14,height:14,className:`shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.path)})})]})}function ee(e){let t=e.replace(/\/+$/,``);if(!t||t===`/`)return null;let n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function $(e){return e?.home===`/home/openhands`}function te({isOpen:e,onClose:t,onAdd:n,onAddParent:r}){let{t:i}=c(`openhands`),[a,s]=(0,W.useState)(null),u=d(),{data:f}=X();(0,W.useEffect)(()=>{e&&f?.home&&a===null&&s($(f)?Z:f.home),e||s(null)},[e,f?.home,a]),(0,W.useEffect)(()=>{s(null)},[u.backend.id,u.orgId]);let{data:p,isLoading:m,isError:h,error:S}=Y(e?a:null),C=(0,W.useMemo)(()=>{if(!f?.home)return[];let e=[{label:`Home`,path:f.home.replace(/[\\/]+$/,``)||f.home},...f.favorites??[]];return $(f)&&!e.some(e=>e.path===Z)&&e.push({label:Z,path:Z}),e},[f]),w=f?.locations??[];if(!e)return null;let D=p?.items??[],O=a?ee(a):null,k=f?.home===`/home/openhands`&&(f?.favorites?.length??0)===0&&a===f?.home&&!m&&!h&&D.length===0,A=e=>{let t=e.replace(/\/+$/,``);if(!t)return`/`;let n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1)||`/`:t};return(0,P.jsx)(g,{onClose:t,"aria-label":i(o.HOME$ADD_WORKSPACES_TITLE),children:(0,P.jsxs)(`div`,{"data-testid":`folder-browser-modal`,className:l(`flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-xl`,_(`xl`),v,`h-[480px]`),children:[(0,P.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-[var(--oh-border-input)]`,children:(0,P.jsx)(y,{className:b,title:i(o.HOME$ADD_WORKSPACES_TITLE)})}),(0,P.jsxs)(`div`,{className:`flex flex-1 min-h-0`,children:[(0,P.jsxs)(`aside`,{"data-testid":`folder-browser-sidebar`,className:`w-[180px] shrink-0 border-r border-[var(--oh-border-input)] bg-[var(--oh-surface)] py-3 overflow-y-auto`,children:[(0,P.jsx)(Q,{label:i(o.HOME$FAVORITES),entries:C,currentPath:a,onPick:s}),(0,P.jsx)(Q,{label:i(o.HOME$LOCATIONS),entries:w,currentPath:a,onPick:s})]}),(0,P.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-b border-[var(--oh-border-input)]`,children:[(0,P.jsx)(`button`,{type:`button`,"data-testid":`folder-browser-up`,onClick:()=>O&&s(O),disabled:!O,"aria-label":`Up`,className:`p-1 rounded hover:bg-[var(--oh-interactive-hover)] text-white disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,P.jsx)(E,{width:16,height:16})}),(0,P.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,"data-testid":`folder-browser-current-path`,children:a??``})]}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[1fr_120px] px-4 py-1 border-b border-[var(--oh-border-input)] text-xs text-[var(--oh-text-secondary)] font-semibold`,children:[(0,P.jsx)(`span`,{children:i(o.HOME$NAME)}),(0,P.jsx)(`span`,{children:i(o.HOME$KIND)})]}),(0,P.jsxs)(`ul`,{className:`flex-1 overflow-auto custom-scrollbar-always`,"data-testid":`folder-browser-list`,children:[m&&(0,P.jsx)(`li`,{className:`px-4 py-2 text-sm text-[var(--oh-text-secondary)]`,children:i(o.HOME$LOADING)}),h&&(0,P.jsx)(`li`,{className:`px-4 py-2 text-sm text-red-400`,"data-testid":`folder-browser-error`,children:S?.message??`Failed to load`}),!m&&!h&&D.length===0&&(0,P.jsx)(`li`,{className:`px-4 py-2 text-sm text-[var(--oh-text-secondary)]`,"data-testid":k?`folder-browser-host-home-hint`:`folder-browser-empty`,children:i(k?o.HOME$HOST_HOME_NOT_MOUNTED_HINT:o.HOME$NO_WORKSPACES)}),D.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>s(e.path),className:`grid grid-cols-[1fr_120px] items-center w-full text-left px-4 py-1.5 text-sm text-white hover:bg-[var(--oh-interactive-hover)] cursor-pointer`,"data-testid":`folder-browser-entry-${e.name}`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-2 min-w-0`,children:[(0,P.jsx)(T,{width:16,height:16,className:`shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,P.jsx)(`span`,{className:`text-[var(--oh-text-secondary)] text-xs`,children:i(o.HOME$FOLDER)})]})},e.path))]})]})]}),(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-5 py-3 border-t border-[var(--oh-border-input)]`,children:[(0,P.jsx)(x,{type:`button`,variant:`secondary`,onClick:t,testId:`folder-browser-cancel`,children:i(o.HOME$CANCEL)}),r&&(0,P.jsx)(x,{type:`button`,variant:`secondary`,onClick:()=>{!a||!r||(r([{id:a,name:A(a),path:a}]),t())},isDisabled:!a||m,testId:`folder-browser-add-all-subdirs`,children:i(o.HOME$ADD_ALL_SUBDIRECTORIES)}),(0,P.jsx)(x,{type:`button`,variant:`primary`,onClick:()=>{a&&(n([{id:a,name:A(a),path:a}]),t())},isDisabled:!a||m,testId:`folder-browser-use`,children:i(o.HOME$ADD_THIS_DIRECTORY)})]})]})})}function ne({isOpen:e,workspaces:t,workspaceParents:n=[],onClose:r,onRemove:i,onRemoveParent:a}){let{t:s}=c(`openhands`),[u,d]=W.useState(null);if(!e)return null;let f=t.filter(e=>!e.parentPath),p=new Map;t.forEach(e=>{if(!e.parentPath)return;let t=p.get(e.parentPath)??[];t.push(e),p.set(e.parentPath,t)});let m=f.length>0||n.length>0;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(g,{onClose:r,"aria-label":s(o.HOME$MANAGE_WORKSPACES),children:(0,P.jsxs)(`div`,{"data-testid":`manage-workspaces-modal`,className:l(`flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-xl`,_(`lg`),v,`max-h-[70vh]`),children:[(0,P.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-[var(--oh-border-input)]`,children:(0,P.jsx)(y,{className:b,title:s(o.HOME$MANAGE_WORKSPACES)})}),(0,P.jsxs)(`div`,{className:`flex-1 overflow-auto custom-scrollbar-always`,"data-testid":`manage-workspaces-list`,children:[!m&&(0,P.jsx)(`p`,{className:`px-5 py-6 text-sm text-[var(--oh-text-secondary)] text-center`,children:s(o.HOME$MANAGE_WORKSPACES_EMPTY)}),f.length>0&&(0,P.jsx)(`ul`,{children:f.map(e=>(0,P.jsxs)(`li`,{className:`flex items-center gap-3 px-5 py-2 border-b border-[var(--oh-border-subtle)] last:border-b-0`,"data-testid":`manage-workspaces-row-${e.name}`,children:[(0,P.jsx)(T,{width:16,height:16,className:`shrink-0`}),(0,P.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),(0,P.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,children:e.path})]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>d({type:`workspace`,path:e.path,text:s(o.HOME$REMOVE_WORKSPACE_CONFIRMATION,{name:e.name})}),"aria-label":s(o.HOME$REMOVE_WORKSPACE),"data-testid":`manage-workspaces-remove-${e.name}`,className:`flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-interactive-hover)] hover:text-white cursor-pointer`,children:[(0,P.jsx)(D,{width:12,height:12}),(0,P.jsx)(`span`,{children:s(o.HOME$REMOVE_WORKSPACE)})]})]},e.id))}),n.length>0&&(0,P.jsxs)(`div`,{"data-testid":`manage-workspaces-parents-section`,children:[(0,P.jsx)(`div`,{className:`px-5 pt-3 pb-1 text-[11px] uppercase tracking-wide text-[var(--oh-muted)] font-semibold`,children:s(o.HOME$WORKSPACE_PARENTS)}),(0,P.jsx)(`ul`,{children:n.map(e=>{let t=p.get(e.path)??[];return(0,P.jsxs)(`li`,{className:`border-b border-[var(--oh-border-subtle)] last:border-b-0`,"data-testid":`manage-workspaces-parent-row-${e.name}`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-2`,children:[(0,P.jsx)(T,{width:16,height:16,className:`shrink-0`}),(0,P.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),(0,P.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,children:e.path})]}),a&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>d({type:`parent`,path:e.path,text:s(o.HOME$REMOVE_WORKSPACE_PARENT_CONFIRMATION,{name:e.name,count:t.length})}),"aria-label":s(o.HOME$REMOVE_WORKSPACE_PARENT),"data-testid":`manage-workspaces-remove-parent-${e.name}`,className:`flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-interactive-hover)] hover:text-white cursor-pointer`,children:[(0,P.jsx)(D,{width:12,height:12}),(0,P.jsx)(`span`,{children:s(o.HOME$REMOVE_WORKSPACE_PARENT)})]})]}),t.length>0&&(0,P.jsx)(`ul`,{className:`pb-2`,children:t.map(e=>(0,P.jsxs)(`li`,{className:`flex items-center gap-3 px-5 pl-10 py-1 text-xs text-[var(--oh-text-secondary)]`,"data-testid":`manage-workspaces-child-${e.name}`,children:[(0,P.jsx)(T,{width:12,height:12,className:`shrink-0 opacity-70`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})]},e.id)})})]})]}),(0,P.jsx)(`div`,{className:`flex justify-end gap-2 px-5 py-3 border-t border-[var(--oh-border-input)]`,children:(0,P.jsx)(x,{type:`button`,variant:`primary`,onClick:r,testId:`manage-workspaces-done`,children:s(o.HOME$DONE)})})]})}),u&&(0,P.jsx)(C,{text:u.text,onConfirm:()=>{u&&(u.type===`workspace`?i(u.path):a?.(u.path),d(null))},onCancel:()=>d(null)})]})}export{G as a,V as c,K as i,U as l,te as n,H as o,q as r,B as s,ne as t,I as u};