@openhands/agent-canvas 1.7.1 → 1.7.2

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 (107) hide show
  1. package/README.md +1 -1
  2. package/README.windows.md +2 -2
  3. package/build/assets/{active-backend-context-B9942JGX.js → active-backend-context-BlZPzZNU.js} +1 -1
  4. package/build/assets/{agent-context-settings-BwAakl29.js → agent-context-settings-CTaN-Iw9.js} +1 -1
  5. package/build/assets/{agent-profiles-settings-BYU6aWus.js → agent-profiles-settings-CR4VTqv_.js} +1 -1
  6. package/build/assets/{agent-server-conversation-service.api-D7qh9amG.js → agent-server-conversation-service.api-Btmi4q6d.js} +3 -3
  7. package/build/assets/{agent-settings-DEPFl5hR.js → agent-settings-BIOsUglV.js} +1 -1
  8. package/build/assets/agent-settings-KQs-occT.js +1 -0
  9. package/build/assets/{api-key-entry-screen-B2kVLRDQ.js → api-key-entry-screen-BhR24gkM.js} +1 -1
  10. package/build/assets/{app-settings-B92bjTei.js → app-settings-Bs4sY8WP.js} +1 -1
  11. package/build/assets/{automation-detail-DoVSHQLs.js → automation-detail-CwDnJbYR.js} +1 -1
  12. package/build/assets/{automation-export-Ca2ehC-k.js → automation-export-Bu-r-EzL.js} +1 -1
  13. package/build/assets/{automations-list-ZHQSW8qD.js → automations-list-CYw7_6FR.js} +1 -1
  14. package/build/assets/{backend-form-modal-C0CIsQvd.js → backend-form-modal-Ce-KRHOJ.js} +1 -1
  15. package/build/assets/{backend-synced-settings-badge-DdUfuSN8.js → backend-synced-settings-badge-BNpEylNP.js} +1 -1
  16. package/build/assets/{badge-B6q3sVom.js → badge-DwgrwohM.js} +1 -1
  17. package/build/assets/{browser-tab-Cir7KbAL.js → browser-tab-CEApjoEV.js} +1 -1
  18. package/build/assets/client-source-1v-kWLNU.js +1 -0
  19. package/build/assets/{cloud-funnel-analytics-CnCkPgQa.js → cloud-funnel-analytics-CasMM7EO.js} +1 -1
  20. package/build/assets/{condenser-settings-jNGOKFGz.js → condenser-settings-Czi8cKxV.js} +1 -1
  21. package/build/assets/conversation-C25pc2dT.js +1 -0
  22. package/build/assets/{conversation-DceG4LFS.js → conversation-CObLYSJd.js} +3 -3
  23. package/build/assets/conversation-panel-C25pc2dT.js +1 -0
  24. package/build/assets/{conversation-state-store-BORusMiV.js → conversation-state-store-DTq4hFoP.js} +1 -1
  25. package/build/assets/{entry.client-CCrlta8r.js → entry.client-DETaouwO.js} +1 -1
  26. package/build/assets/{extensions-hub-B2WudOET.js → extensions-hub-BKftOQ-X.js} +1 -1
  27. package/build/assets/{extensions-navigation-CYjIM65d.js → extensions-navigation-DF24q1H1.js} +1 -1
  28. package/build/assets/{files-tab-LSBijbEi.js → files-tab-SAiFCnS5.js} +1 -1
  29. package/build/assets/{git-provider-icon-DeQUgZVE.js → git-provider-icon-BREx-yUX.js} +1 -1
  30. package/build/assets/home-EPNFgzUh.js +1 -0
  31. package/build/assets/{home-BZclW6kd.js → home-sN90Xcxp.js} +1 -1
  32. package/build/assets/index-home-EPNFgzUh.js +1 -0
  33. package/build/assets/{install-server-modal-xCf76eim.js → install-server-modal-BI8yUfmr.js} +1 -1
  34. package/build/assets/{launch-Bik37u9Y.js → launch-Ccnhte5b.js} +1 -1
  35. package/build/assets/{llm-not-configured-banner-znJFsW_O.js → llm-not-configured-banner-DTWzISnk.js} +1 -1
  36. package/build/assets/llm-settings-BXk5_Pac.js +1 -0
  37. package/build/assets/{llm-settings-BYo9SN0I.js → llm-settings-C1vpgWam.js} +1 -1
  38. package/build/assets/{llm-subscription-service-_QUsVybQ.js → llm-subscription-service-W5BprsNA.js} +1 -1
  39. package/build/assets/{manage-backends-modal-n6PtHOER.js → manage-backends-modal-DhflyGTf.js} +1 -1
  40. package/build/assets/{manifest-e9bbad7b.js → manifest-8082e879.js} +1 -1
  41. package/build/assets/{markdown-renderer-Dkmjmx_d.js → markdown-renderer-CvOO0YIr.js} +1 -1
  42. package/build/assets/{mcp-BJUOnO6v.js → mcp-CxLPda-W.js} +1 -1
  43. package/build/assets/{messages-CYztjKLQ.js → messages-DINDkPNK.js} +1 -1
  44. package/build/assets/{onboarding-9pEMFGtN.js → onboarding-BegDrOKn.js} +1 -1
  45. package/build/assets/{onboarding-modal-dYsjXJwx.js → onboarding-modal-DdvE6rzw.js} +1 -1
  46. package/build/assets/{organization-service.api-HsxJhNCf.js → organization-service.api-CT2OQlLz.js} +1 -1
  47. package/build/assets/{planner-tab-Dr8B-ZBI.js → planner-tab-w6HT0N_A.js} +1 -1
  48. package/build/assets/{plugins-management-service-DEjBqDoT.js → plugins-management-service-DVkoM3eA.js} +1 -1
  49. package/build/assets/{profiles-service.api-BddMsEhq.js → profiles-service.api-CBafmAPO.js} +1 -1
  50. package/build/assets/{providers-BxJi3BMO.js → providers-9UzRB9mT.js} +1 -1
  51. package/build/assets/{proxy-CN3HaaOW.js → proxy-C79PCMjo.js} +1 -1
  52. package/build/assets/{recommended-automations-launcher-Dye8Li08.js → recommended-automations-launcher-BF2mtAKw.js} +1 -1
  53. package/build/assets/{root-D4hpCAq9.js → root-Sj7W28yE.js} +2 -2
  54. package/build/assets/{root-layout-a4-4sfbh.js → root-layout-DbhKVoc7.js} +3 -3
  55. package/build/assets/{schema-field-CZSs0hQP.js → schema-field-CV6bFnoL.js} +1 -1
  56. package/build/assets/{sdk-section-page-Di5mT86Y.js → sdk-section-page-BW-i45yr.js} +1 -1
  57. package/build/assets/{secrets-service-i4CCd-UN.js → secrets-service-BjK-bPN2.js} +1 -1
  58. package/build/assets/{secrets-settings-DPlA3moO.js → secrets-settings-D7U1ErCH.js} +1 -1
  59. package/build/assets/{settings-SHSt9Rq2.js → settings-Bj5Oo45A.js} +1 -1
  60. package/build/assets/{settings-index-D5dDKrDt.js → settings-index-COAdxm2Q.js} +1 -1
  61. package/build/assets/{settings-modal-DsJk2THd.js → settings-modal-CFnbQ8_4.js} +1 -1
  62. package/build/assets/{settings-service.api-i_HHIqJP.js → settings-service.api-DryhKdSr.js} +1 -1
  63. package/build/assets/{shared-conversation-DU1kwDTF.js → shared-conversation-CnMxy7p_.js} +1 -1
  64. package/build/assets/{sidebar-mobile-menu-toggle-BlmI8OrA.js → sidebar-mobile-menu-toggle-U78hQRJ1.js} +1 -1
  65. package/build/assets/{skills-plugins-YJSV6A0M.js → skills-plugins-BPhaNpfx.js} +1 -1
  66. package/build/assets/{skills-settings-BbREHv_-.js → skills-settings-CcwMtnnJ.js} +1 -1
  67. package/build/assets/{task-list-tab-Dzim5ftn.js → task-list-tab-BmaTwjaS.js} +1 -1
  68. package/build/assets/{telemetry-B-2fXtqV.js → telemetry-cmCL3o6Z.js} +1 -1
  69. package/build/assets/{terminal-CYFAMiXx.js → terminal-BRcoba5B.js} +1 -1
  70. package/build/assets/{use-acp-credential-form-CuBXKNvP.js → use-acp-credential-form-B0_pZ_uS.js} +1 -1
  71. package/build/assets/{use-activate-agent-profile-CXDcjVt8.js → use-activate-agent-profile-DH33MvVj.js} +1 -1
  72. package/build/assets/{use-agent-profiles-CliaHofi.js → use-agent-profiles-Dmd_4H8q.js} +1 -1
  73. package/build/assets/{use-can-manage-org-profiles-Uai-HHx2.js → use-can-manage-org-profiles-CrG1km7R.js} +1 -1
  74. package/build/assets/{use-cloud-current-user-id-BzamKpu-.js → use-cloud-current-user-id-B6DP3s47.js} +1 -1
  75. package/build/assets/{use-config-DPEYpfIj.js → use-config-Csy8EAP9.js} +1 -1
  76. package/build/assets/{use-create-conversation-DzcM79TE.js → use-create-conversation-Dsa4nzU9.js} +1 -1
  77. package/build/assets/{use-create-secret-2YLjoQw-.js → use-create-secret-BnxuAjDt.js} +1 -1
  78. package/build/assets/{use-llm-profiles-Ci3zAVzV.js → use-llm-profiles-BMQoc612.js} +1 -1
  79. package/build/assets/{use-onboarding-completion-STApsofr.js → use-onboarding-completion-B-2BTS-y.js} +1 -1
  80. package/build/assets/{use-plugins-marketplace-CzzdrUSK.js → use-plugins-marketplace-PBc_XNz_.js} +1 -1
  81. package/build/assets/{use-save-agent-profile-Q2M72WgR.js → use-save-agent-profile-2Mk9ZX37.js} +1 -1
  82. package/build/assets/{use-save-settings-BZK7zVsK.js → use-save-settings-BRh9p_fv.js} +1 -1
  83. package/build/assets/{use-settings-BKpkUS4y.js → use-settings-DBI44RnH.js} +1 -1
  84. package/build/assets/{use-settings-nav-items-BlXge_bf.js → use-settings-nav-items-Cva28C-c.js} +1 -1
  85. package/build/assets/{use-skills-BltA9XrV.js → use-skills-RQsCtdzN.js} +1 -1
  86. package/build/assets/{use-tracking-De7qByD4.js → use-tracking-CN1nIMnY.js} +1 -1
  87. package/build/assets/{use-user-conversation-43duhf7D.js → use-user-conversation-GnGhs_Ob.js} +1 -1
  88. package/build/assets/{verification-settings-B4DL3Tez.js → verification-settings-CaCzojbc.js} +1 -1
  89. package/build/index.html +4 -4
  90. package/config/defaults.json +1 -1
  91. package/dist/config/defaults.cjs +1 -1
  92. package/dist/config/defaults.cjs.map +1 -1
  93. package/dist/config/defaults.js +1 -1
  94. package/dist/config/defaults.js.map +1 -1
  95. package/dist/package.cjs +1 -1
  96. package/dist/package.cjs.map +1 -1
  97. package/dist/package.js +6 -1
  98. package/dist/package.js.map +1 -1
  99. package/package.json +6 -1
  100. package/scripts/stryker-diff.mjs +137 -0
  101. package/build/assets/agent-settings-BbNLRtoh.js +0 -1
  102. package/build/assets/client-source-D8jWKBfE.js +0 -1
  103. package/build/assets/conversation-Do2Vg7uo.js +0 -1
  104. package/build/assets/conversation-panel-Do2Vg7uo.js +0 -1
  105. package/build/assets/home-C_R5pEbs.js +0 -1
  106. package/build/assets/index-home-C_R5pEbs.js +0 -1
  107. package/build/assets/llm-settings-BaM0zJg5.js +0 -1
package/README.md CHANGED
@@ -96,7 +96,7 @@ docker run -it --rm \
96
96
  -p 8000:8000 \
97
97
  -v "$HOME/.openhands:/home/openhands/.openhands" \
98
98
  -v "${PROJECTS_PATH}:/projects" \
99
- ghcr.io/openhands/agent-canvas:1.7.1 # x-release-please-version
99
+ ghcr.io/openhands/agent-canvas:1.7.2 # x-release-please-version
100
100
  ```
101
101
 
102
102
  **Windows (PowerShell / Windows Terminal):** See [README.windows.md](./README.windows.md) for the equivalent commands.
package/README.windows.md CHANGED
@@ -12,7 +12,7 @@ For the main install options and overall context, see [README.md](./README.md).
12
12
  - A host directory for `PROJECTS_PATH` containing the project folders you want the agent to access (create it before starting the container)
13
13
 
14
14
  ```powershell
15
- docker pull ghcr.io/openhands/agent-canvas:1.7.1 # x-release-please-version
15
+ docker pull ghcr.io/openhands/agent-canvas:1.7.2 # x-release-please-version
16
16
 
17
17
  $env:PROJECTS_PATH = Join-Path $HOME "projects" # directory containing your project folders
18
18
  New-Item -ItemType Directory -Force -Path $env:PROJECTS_PATH, (Join-Path $env:USERPROFILE ".openhands") | Out-Null
@@ -21,7 +21,7 @@ docker run -it --rm `
21
21
  -p 8000:8000 `
22
22
  -v "$($env:USERPROFILE)\.openhands:/home/openhands/.openhands" `
23
23
  -v "$($env:PROJECTS_PATH):/projects" `
24
- ghcr.io/openhands/agent-canvas:1.7.1 # x-release-please-version
24
+ ghcr.io/openhands/agent-canvas:1.7.2 # x-release-please-version
25
25
  ```
26
26
 
27
27
  Open [http://localhost:8000/canvas](http://localhost:8000/canvas) in your browser.
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{D as i,F as a,I as o,M as s,O as ee,P as te,T as ne,d as re,k as ie,w as c,y as ae}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{R as oe,t as se,z as l}from"./utils-qjs_KuS4.js";var u=e(t(),1),ce=`__AGENT_CANVAS_BASE_PATH__`;function le(e){let t=e?.trim();return!t||t===`/`?``:(t.startsWith(`/`)?t:`/${t}`).replace(/\/+$/,``)}function ue(){let e=le(void 0);if(e)return e;if(typeof window<`u`){let e=window[ce];if(typeof e==`string`)return le(e)}return``}function de(e){let t=ue();return t?`${t}${e.startsWith(`/`)?e:`/${e}`}`:e.startsWith(`/`)?e:`/${e}`}var d=`openhands`,fe=[{label:`English`,value:`en`},{label:`日本語`,value:`ja`},{label:`简体中文`,value:`zh-CN`},{label:`繁體中文`,value:`zh-TW`},{label:`한국어`,value:`ko-KR`},{label:`Norsk`,value:`no`},{label:`Arabic`,value:`ar`},{label:`Deutsch`,value:`de`},{label:`Français`,value:`fr`},{label:`Italiano`,value:`it`},{label:`Português`,value:`pt`},{label:`Español`,value:`es`},{label:`Català`,value:`ca`},{label:`Türkçe`,value:`tr`},{label:`Українська`,value:`uk`}],f=new WeakMap,pe=e=>{if(!f.has(e)){let t=e.use(ee).use(i).use(r).init({fallbackLng:`en`,debug:!1,supportedLngs:fe.map(e=>e.value),nonExplicitSupportedLngs:!1,ns:[d],defaultNS:d,fallbackNS:d,backend:{loadPath:de(`/locales/{{lng}}/{{ns}}.json`)},interpolation:{escapeValue:!1}});f.set(e,t)}return e},me=()=>pe(s()),he=null,p=null,m=()=>(he||=me(),he),ge=()=>p??m(),_e=e=>(p=e??m(),p),ve=async(e=m())=>(await f.get(e),e),ye=e=>e?typeof e==`object`&&!Array.isArray(e)?{ns:d,...e}:e:{ns:d},h=new Proxy({},{get:(e,t)=>{let n=ge();if(t===`t`)return(e,t)=>n.t(e,ye(t));if(t===`exists`)return(e,t)=>n.exists(e,ye(t));let r=Reflect.get(n,t,n);return typeof r==`function`?r.bind(n):r},set:(e,t,n)=>{let r=ge();return Reflect.set(r,t,n,r)}}),be=e=>typeof e.response?.data==`object`&&e.response?.data!==null&&`error`in e.response.data&&typeof e.response?.data?.error==`string`,xe=e=>typeof e.response?.data==`object`&&e.response?.data!==null&&`message`in e.response.data&&typeof e.response?.data?.message==`string`,Se=`Disconnected (check URL or network). Check that the backend URL is correct and the backend server is reachable. If the backend is on another origin, check that it allows this frontend origin.`,Ce=`Disconnected (request timed out). Check that the backend URL is correct and reachable.`,we=4;function Te(e){return typeof e==`object`&&!!e}function Ee(e){let t=[],n=new Set,r=e,i=0;for(;r!=null&&i<we&&!n.has(r);){if(n.add(r),r instanceof Error)r.message&&t.push(r.message),r=r.cause;else if(typeof r==`string`){r&&t.push(r);break}else if(Te(r)){let e=r.message;typeof e==`string`&&e&&t.push(e),r=r.cause}else break;i+=1}return t}function g(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`disconnected (check cors or network)`)||t.includes(`disconnected (check url or network)`)||t.includes(`blocked by cors`)||t.includes(`failed to fetch`)||t.includes(`network error`)||t.includes(`load failed`)||t.includes(`networkerror when attempting to fetch resource`)||t.includes(`cors`)&&t.includes(`blocked`)}function De(e){return Ee(e).some(g)}function _(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`request timeout`)||t.includes(`timeout after`)||t.includes(`backend request timed out`)}function v(e){let t=Ee(e);return t.some(g)?Se:t.some(_)?Ce:t[0]??null}function Oe(e){return typeof e==`object`&&!!e&&`isAxiosError`in e&&e.isAxiosError===!0}var y=e=>{let t=null,n=!1;return Oe(e)?(n=!0,t=be(e)&&e.response?.data.error?e.response?.data.error:xe(e)&&e.response?.data.message?e.response?.data.message:e.message):t=e instanceof Error?e.message:typeof e==`string`?e:null,v(n?t??e:e)??t??``},b=(e,t=5e3,n=1e4)=>{if(!e)return t;let r=e.length/(1e3/60)*1e3*1.5;return Math.min(Math.max(r,t),n)},x=n(),ke={background:`var(--oh-color-tertiary)`,border:`1px solid var(--oh-border-input)`,color:`#fff`,borderRadius:`var(--oh-radius)`,maxWidth:`400px`,wordBreak:`break-word`,overflowWrap:`anywhere`,whiteSpace:`pre-wrap`},S={position:`top-right`,style:ke},Ae={...ke,color:`var(--oh-muted)`};function je({message:e}){let t=u.useRef(null),[n,r]=u.useState(!1);return u.useLayoutEffect(()=>{let e=t.current;if(!e)return;let n=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(t)||t<=0){r(!1);return}r(e.getBoundingClientRect().height>t*1.5)};n();let i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[e]),(0,x.jsxs)(`div`,{className:se(`flex min-w-0 gap-2`,n?`items-start`:`items-center`),children:[(0,x.jsx)(ne,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:oe}}),(0,x.jsx)(`span`,{ref:t,className:`min-w-0 flex-1 text-sm leading-5 [word-break:break-word] [overflow-wrap:anywhere]`,children:e})]})}var Me={...S,icon:null,style:Ae},Ne=e=>{let t=e||h.t(l.STATUS$ERROR);g(t)?t=h.t(l.ERROR$CORS_OR_NETWORK):_(t)&&(t=h.t(l.ERROR$BACKEND_REQUEST_TIMEOUT));let n=b(t,4e3);c((0,x.jsx)(je,{message:t}),{...Me,duration:n})},Pe=e=>{let t=b(e,5e3);c.success((0,x.jsx)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:e}),{...S,duration:t})},Fe=(e,t,n)=>{let r=b(`${e} ${t}`,5e3);c.success((0,x.jsxs)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:[e,` `,(0,x.jsx)(`a`,{className:`underline hover:no-underline`,href:n,children:t})]}),{...S,duration:r})},Ie=e=>{let t=b(e,6e3);c((0,x.jsx)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:e}),{...S,icon:`⚠️`,duration:t})},Le=`openhands-backend-health`,Re=500;function ze(e){if(typeof e!=`object`||!e)return!1;let t=e;return Number.isInteger(t.consecutiveFailures)&&t.consecutiveFailures>=0&&t.consecutiveFailures<=5&&(t.lastError===null||typeof t.lastError==`string`)&&(t.lastFailureAt===null||typeof t.lastFailureAt==`number`)&&typeof t.disabled==`boolean`}function Be(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(Le);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&e.length>0&&ze(r)&&(n[e]=r);return n}catch{return{}}}function Ve(e){if(!(typeof window>`u`))try{if(Object.keys(e).length===0){window.localStorage.removeItem(Le);return}window.localStorage.setItem(Le,JSON.stringify(e))}catch{}}function He(e){let t=v(e)??`Unknown error`;return t.length>Re?`${t.slice(0,Re)}…`:t}var C=Be(),Ue=new Set;function We(){Ue.forEach(e=>e())}function w(e){C=e,Ve(e),We()}function Ge(){return C}function Ke(e){return C[e]??null}function qe(e){return Ue.add(e),()=>{Ue.delete(e)}}function Je(e,t){let n=C[e],r=Math.min((n?.consecutiveFailures??0)+1,5),i=n?.disabled===!0||r>=5,a={consecutiveFailures:r,lastError:He(t),lastFailureAt:Date.now(),disabled:i};w({...C,[e]:a})}function Ye(e){if(!(e in C))return;let{[e]:t,...n}=C;w(n)}function Xe(e){if(!(e in C))return;let{[e]:t,...n}=C;w(n)}function Ze(e){if(!(e in C))return;let{[e]:t,...n}=C;w(n)}var Qe=`workspace/project`,$e=`__AGENT_CANVAS_LOCK_TO_CLOUD__`,T=`all-hands.dev`,E=`openhands.dev`,et=`app.${T}`,tt=E,nt=`app.${E}`;function rt(e){return e?.trim()||null}function it(e){if(!e)return null;let t=e.trim().replace(/\/$/,``);return t?/^https?:\/\//i.test(t)?t:typeof window<`u`?`${window.location.protocol}//${t}`:`http://${t}`:null}function D(e){if(!e)return null;let t=e.trim().replace(/\/+$/,``);return t?/^https?:\/\//i.test(t)?t:`https://${t}`:null}function at(e){let t=e.toLowerCase();return t===et||t===nt?tt:t===T?E:t.endsWith(`.${T}`)?`${t.slice(0,-13)}${E}`:t}function ot(e){let t=D(e);if(!t)return null;try{let e=new URL(t),n=e.port?`:${e.port}`:``;return`${e.protocol}//${at(e.hostname)}${n}`}catch{return t.toLowerCase()}}function st(){let e=O();return!e||typeof window>`u`||!dt(window.location.origin,e)?null:window.location.origin}function ct(){return it(void 0)}function lt(){let e=rt(void 0);if(e)return e;if(typeof window<`u`){let e=window.__AGENT_CANVAS_SESSION_API_KEY__;if(typeof e==`string`)return rt(e)}return null}function ut(){return{baseUrl:k()??``,sessionApiKey:A()??``}}function O(){let e=D(void 0);if(e)return e;if(typeof window<`u`){let e=window[$e];if(typeof e==`string`)return D(e)}return null}function dt(e,t){let n=ot(e),r=ot(t);return!n||!r?!1:n===r}function ft(){return st()?`cookie`:`api-key`}function k(){return ct()||(typeof window<`u`?window.location.origin:null)}function A(){return lt()}function j(){return Qe}function pt(e){return`${j().replace(/\/+$/,``)}/${e.replace(/-/g,``)}`}function mt(){let e=A();return e?{"X-Session-API-Key":e}:{}}function M(){return typeof window<`u`&&window.__AGENT_CANVAS_AUTH_REQUIRED__===!0}function ht(){return M()?!A():!1}var gt=`default-local`,_t=`Local`,vt=`locked-cloud`,yt=`OpenHands Cloud`;function bt(){if(!O())return null;let e=st();return e?{id:vt,name:yt,host:e,apiKey:``,kind:`cloud`,authMode:`cookie`}:null}function N(){if(O())return null;let e=k(),t=A();return!e||!t?null:{id:gt,name:_t,host:e,apiKey:t,kind:`local`}}var xt=`openhands-backends`,P=`openhands-active-backend`;function St(e){return e===`local`||e===`cloud`}function Ct(e){return e===void 0||e===`api-key`||e===`cookie`}function wt(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.name==`string`&&typeof t.host==`string`&&typeof t.apiKey==`string`&&St(t.kind)&&Ct(t.authMode)}function Tt(e){try{let{hostname:t}=new URL(e);return t===`localhost`||t===`127.0.0.1`||t===`::1`||t===`[::1]`}catch{return!1}}function Et(e,t){return e.id!==`default-local`||e.kind!==`local`?!1:e.host===t.host||Tt(e.host)&&Tt(t.host)}function Dt(e){let t=N();if(!t)return e;let n=!1,r=e.map(e=>!Et(e,t)||e.apiKey===t.apiKey?e:(n=!0,{...e,apiKey:t.apiKey}));return n?(F(r),r):e}function F(e){if(!(typeof window>`u`))try{window.localStorage.setItem(xt,JSON.stringify(e))}catch{}}function Ot(){if(typeof window>`u`)return[];try{let e=bt();if(e)return F([e]),Nt()?.backendId!==e.id&&I({backendId:e.id}),[e];let t=window.localStorage.getItem(xt);if(t===null){let e=N();return e?(F([e]),[e]):[]}let n=JSON.parse(t);if(!Array.isArray(n))return[];let r=n.filter(wt);if(r.length===0){let e=N();return e?(F([e]),[e]):[]}return Dt(r)}catch{return[]}}function kt(e){if(!e)return null;try{let t=JSON.parse(e);if(typeof t!=`object`||!t||typeof t.backendId!=`string`)return null;let n=t.orgId;return{backendId:t.backendId,orgId:typeof n==`string`&&n.length>0?n:null}}catch{return null}}function At(e,t){try{return e?.getItem(t)??null}catch{return null}}function jt(e,t,n){try{e?.setItem(t,n)}catch{}}function Mt(e,t){try{e?.removeItem(t)}catch{}}function Nt(){return typeof window>`u`?null:kt(At(window.sessionStorage,P))||kt(At(window.localStorage,P))}function I(e){if(typeof window>`u`)return;if(!e){Mt(window.sessionStorage,P),Mt(window.localStorage,P);return}let t=JSON.stringify({backendId:e.backendId,orgId:e.orgId??null});jt(window.sessionStorage,P,t),jt(window.localStorage,P,t)}var Pt=`no-backend`,Ft={id:Pt,name:`No Backend Available`,host:``,apiKey:``,kind:`local`};function L(e){return e.id===Pt}function It(e){return e.find(e=>e.kind===`local`&&Ke(e.id)?.disabled!==!0)||(e.find(e=>e.kind===`local`)??e[0]??Ft)}function R(e,t){let n=null,r=null;if(t){let i=e.find(e=>e.id===t.backendId);i&&(n=i,r=t.orgId??null)}return n||(n=It(e),r=null),{backends:e,selection:t,active:{backend:n,orgId:r}}}var z=R(Ot(),Nt()),B=new Set;function Lt(){B.forEach(e=>e())}function V(){return z.active}function H(){let e=z.active.backend;return e.kind===`local`&&!L(e)?e:null}function U(){return z.backends}function W(){return z.selection}function Rt(){return z}function zt(e){I(e),z=R(z.backends,e),Lt()}function G(e){F(e);let t=z.selection;t&&!e.some(e=>e.id===t.backendId)&&(t=null,I(null)),z=R(e,t),Lt()}function Bt(e){return B.add(e),()=>{B.delete(e)}}var Vt=(e,t)=>{(e?.response?.status===401||e?.status===401)&&t.invalidateQueries({queryKey:[`user`,`authenticated`]})},Ht=e=>{if(!(e instanceof ie)||e.response?.status!==401&&e.status!==401)return!1;let t=V().backend;if(t.kind!==`cloud`)return!1;let n=e.config?.url;return!n||n.startsWith(t.host.replace(/\/+$/,``))},K=new Set,Ut=()=>{let e=new te({queryCache:new a({onSuccess:(e,t)=>{let n=t.meta?.backendId??t.options.meta?.backendId;typeof n==`string`&&Ye(n)},onError:(t,n)=>{if(n.queryKey[0]===`user`&&n.queryKey[1]===`authenticated`||Vt(t,e),!(n.meta?.disableToast??n.options.meta?.disableToast)&&!Ht(t)){let e=y(t);K.has(e||``)||(Ne(e||h.t(l.ERROR$GENERIC)),K.add(e||``),setTimeout(()=>{K.delete(e||``)},3e3))}}}),mutationCache:new o({onError:(t,n,r,i)=>{Vt(t,e),!(i?.meta?.disableToast??i?.options.meta?.disableToast)&&!Ht(t)&&Ne(y(t)||h.t(l.ERROR$GENERIC))}})});return e},Wt=null,Gt=null,Kt=()=>(Wt||=Ut(),Wt),qt=()=>Gt??Kt(),Jt=e=>(Gt=e??Kt(),Gt),Yt=new Proxy({},{get:(e,t)=>{let n=qt(),r=Reflect.get(n,t,n);return typeof r==`function`?r.bind(n):r},set:(e,t,n)=>{let r=qt();return Reflect.set(r,t,n,r)}});function Xt(e){if(e&&!e.startsWith(`/`))try{let t=new URL(e),n=t.hostname,r=window.location.hostname??window.location.host?.split(`:`)[0];return r&&(n===`localhost`||n===`127.0.0.1`)&&r!==`localhost`&&r!==`127.0.0.1`?`${r}:${t.port}`:t.host}catch{return window.location.host}return window.location.host}function Zt(e){if(e&&!e.startsWith(`/`))try{return(new URL(e).pathname.split(`/api/conversations`)[0]||``).replace(/\/$/,``)}catch{return``}return``}function Qt(e){let t=Xt(e),n=Zt(e),r=window.location.protocol===`https:`,i=$t(e)===`https:`;return`${r||i?`https:`:`http:`}//${t}${n}`}function $t(e){if(!e||e.startsWith(`/`))return null;try{return new URL(e).protocol}catch{return null}}function en(e){let t=Xt(e),n=Zt(e),r=window.location.protocol===`https:`,i=$t(e)===`https:`;return`${r||i?`wss:`:`ws:`}//${t}${n}/sockets/bash-events`}function tn(e,t){if(!e)return null;let n=Xt(t),r=Zt(t),i=window.location.protocol===`https:`,a=$t(t)===`https:`;return`${i||a?`wss:`:`ws:`}//${n}${r}/sockets/events/${e}`}var nn=class extends Error{constructor(){super(`No backend is configured.`),this.name=`NoBackendAvailableError`}};function rn(e){return e.replace(/\/+$/,``)}function an(e,t){return e.host?rn(e.host):e.conversationUrl?rn(Qt(e.conversationUrl)):rn(t?.host??``)}function q(e={}){let t=H();if(!t&&!e.host&&!e.conversationUrl)throw new nn;let n=e.sessionApiKey??e.apiKey??t?.apiKey??void 0;return{host:an(e,t),...n?{apiKey:n}:{},workingDir:e.workingDir??j(),...e.timeout===void 0?{}:{timeout:e.timeout}}}function on(e){let{host:t,apiKey:n,timeout:r}=q(e);return{baseUrl:t,...n?{apiKey:n}:{},timeout:r??6e4}}var sn={_comment:`Single source of truth for version pins, ports, paths, and defaults shared across the npm and Docker install paths. Read by scripts/dev-safe.mjs, scripts/dev-with-automation.mjs, docker/entrypoint.sh (via generated defaults.env), and .github/workflows/docker.yml.`,versions:{agentServer:`1.38.0`,agentCanvas:`1.7.1`,automation:`1.4.1`},compatibility:{minimumAgentServer:`1.28.0`},constraints:{_comment:`Temporary upper bound on the agent-client-protocol (acp) transitive dependency. openhands-sdk 1.35.0 requires agent-client-protocol>=0.10.1 with no upper bound, but acp 0.11.0 reordered the ACP prompt() arguments and breaks the SDK's ACP client (a PromptRequest validation error surfaces as 'ACP error: 2 validation errors for PromptRequest'). Pin acp <0.11 until a fixed openhands-sdk ships. Consumed by scripts/dev-safe.mjs (agent-server uvx install) and .github/workflows/mock-llm-e2e.yml (mock ACP server venv).`,agentClientProtocol:`agent-client-protocol<0.11`},images:{agentServer:`ghcr.io/openhands/agent-server`,agentCanvas:`ghcr.io/openhands/agent-canvas`},ports:{agentServer:18e3,automation:18001,proxy:8e3},paths:{stateSubdir:`agent-canvas`,conversations:`agent-canvas/conversations`,bashEvents:`agent-canvas/bash_events`,automationDb:`automation/automations.db`,canvasBasePath:`/canvas`},packages:{agentServer:`openhands-agent-server`,automation:`openhands-automation`,tools:`openhands-tools`,workspace:`openhands-workspace`},telemetry:{posthogApiKey:`phc_kBtz5nKmxVRRQ7HtPwr2QX9eMC5j65zE86QKocVNwb4U`,posthogHost:`https://us.i.posthog.com`}},cn=5e3,ln=`unknown`,J=sn.compatibility.minimumAgentServer,un=`AGENT_SERVER_UNSUPPORTED_VERSION`,dn=`AGENT_SERVER_UNKNOWN_VERSION`,Y=null,fn=e=>Array.isArray(e?.usable_tools)?e.usable_tools:null,X=class extends Error{details;noBackendConfigured;constructor(e,t){let n=t?.noBackendConfigured??!1;super(n?`No agent server backend is configured yet. Add a backend to get started.`:`Could not connect to the configured agent server. Make sure it is running and reachable, then reload the page.`),this.name=`AgentServerUnavailableError`,this.details=e??null,this.noBackendConfigured=n}},pn=e=>e instanceof X||typeof e==`object`&&!!e&&`name`in e&&e.name===`AgentServerUnavailableError`,mn=class extends X{code=un;actualVersion;requiredVersion=J;constructor(e){let t=`Agent Canvas requires agent-server ${J} or newer; this backend is running ${e}. Please upgrade the agent-server backend.`;super(t),this.name=`AgentServerUnsupportedVersionError`,this.message=t,this.actualVersion=e}},hn=class extends X{code=dn;actualVersion;requiredVersion=J;constructor(e){let t=`Could not determine this backend's agent-server version.${e?` It reported "${e}".`:``} Agent Canvas requires agent-server ${J} or newer, but this backend did not return a valid version from /server_info. Restart or rebuild the agent-server backend, then try again.`;super(t),this.name=`AgentServerUnknownVersionError`,this.message=t,this.actualVersion=e}},gn=e=>M()&&Q(e,401);function Z(){Y=null}function _n(e){let t=fn(Y);return Array.isArray(t)?t.includes(e):!0}function vn(e){return e instanceof Error&&e.name===`HttpError`&&`status`in e&&typeof e.status==`number`}function Q(e,t){return vn(e)&&e.status===t}function yn(e){return typeof e==`string`&&e.trim()||null}function bn(e){return yn(e.sdk_version)}function xn(e){return yn(e.version)??bn(e)}function Sn(e){let t=xn(e);return!t||t.toLowerCase()===ln?null:t}function Cn(e){let t=Sn(e);return!t||!En(t)?null:t}function wn(e){return!Y||e&&H()?.host!==e?null:Cn(Y)}function Tn(e,t){let n=En(e),r=En(t);if(!n||!r)return null;for(let e of[`major`,`minor`,`patch`]){if(n[e]>r[e])return 1;if(n[e]<r[e])return-1}return n.prerelease&&!r.prerelease?-1:!n.prerelease&&r.prerelease?1:n.prerelease&&r.prerelease?n.prerelease.localeCompare(r.prerelease):0}function En(e){let[t]=e.trim().replace(/^v/,``).split(`+`),[n,r]=t.split(`-`,2),i=n.split(`.`);if(i.length!==3)return null;let[a,o,s]=i.map(e=>Number(e));return[a,o,s].every(e=>Number.isInteger(e)&&e>=0)?{major:a,minor:o,patch:s,prerelease:r}:null}function Dn(e){let t=Sn(e);if(!t)throw Z(),new hn(xn(e));let n=Tn(t,J);if(n===null)throw Z(),new hn(t);if(n<0)throw Z(),new mn(t)}async function On(){let e=H();if(!e){if(Z(),L(V().backend))throw new X(`No backend configured`,{noBackendConfigured:!0});return null}let t=q({host:e.host,sessionApiKey:e.apiKey||null,timeout:cn}),n;try{n=await new ae(t).getServerInfo()}catch(e){throw Z(),Q(e,401)?e:new X(e instanceof Error?e.message:null)}if(Dn(n),M())try{await new re(t).getSettings()}catch(e){if(Q(e,401))throw e;console.warn(`[agent-server] getSettings() probe failed (non-401):`,e)}return Y=n,n}var kn={WEB_CLIENT_CONFIG:[`web-client-config`],MAIN_APP_COOKIE_AUTH:[`main-app-cookie-auth`]},An={all:[`settings`],byScope:e=>[`settings`,e],personal:()=>[`settings`,`personal`]},jn={all:[`llm-profiles`]},Mn={all:[`agent-profiles`]},Nn={retry:!1},Pn={all:[`llm-subscription`],openaiStatus:[`llm-subscription`,`openai`,`status`],openaiModels:[`llm-subscription`,`openai`,`models`]},Fn={all:[`local-workspaces`]},In={marketplace:[`plugins-marketplace`],installed:[`plugins-installed`],local:[`plugins-local`]},Ln={latestVersion:[`agent-canvas-latest-version`]},Rn={staleTime:1e3*60*5,gcTime:1e3*60*15},$=u.createContext(null);function zn(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`backend-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Bn({children:e}){let t=u.useSyncExternalStore(Bt,Rt,Rt),n=u.useCallback(()=>{Z(),Yt.invalidateQueries({queryKey:kn.WEB_CLIENT_CONFIG})},[]),r=u.useCallback((e,t)=>{let r=W()?.backendId??null,i=W()?.orgId??null,a=t??null;e===r&&a===i||(zt({backendId:e,orgId:a}),n())},[n]),i=u.useCallback(e=>{let t={...e,id:zn()};return G([...U(),t]),zt({backendId:t.id}),n(),t},[n]),a=u.useCallback((e,t)=>{let r=U().find(t=>t.id===e),i=W()?.backendId??null;G(U().map(n=>n.id===e?{...n,...t}:n));let a=t.host!==void 0&&r!==void 0&&t.host!==r.host,o=t.apiKey!==void 0&&r!==void 0&&t.apiKey!==r.apiKey;(a||o)&&(Xe(e),i===e&&n())},[n]),o=u.useCallback(e=>{G(U().filter(t=>t.id!==e)),Ze(e),n()},[n]),s=u.useMemo(()=>({backends:t.backends,active:t.active,setActive:r,addBackend:i,updateBackend:a,removeBackend:o}),[t,r,i,a,o]);return(0,x.jsx)($.Provider,{value:s,children:e})}function Vn(){let e=u.useContext($);if(!e)throw Error(`useActiveBackendContext must be used inside <ActiveBackendProvider>`);return e}function Hn(){let e=u.useContext($);return e?e.active:{backend:N()??Ft,orgId:null}}export{Je as $,Qt as A,_t as B,Q as C,q as D,nn as E,Jt as F,mt as G,pt as H,V as I,O as J,j as K,H as L,Kt as M,qt as N,on as O,Yt as P,Ge as Q,U as R,vn as S,sn as T,k as U,Qe as V,ut as W,ht as X,M as Y,dt as Z,wn as _,_e as _t,Nn as a,Fe as at,_n as b,jn as c,v as ct,In as d,g as dt,Ye as et,kn as f,fe as ft,Tn as g,h as gt,Z as h,ge as ht,Mn as i,Pe as it,tn as j,en as k,Pn as l,_ as lt,Dn as m,m as mt,Hn as n,S as nt,Ln as o,Ie as ot,An as p,d as pt,ft as q,Vn as r,Ne as rt,Rn as s,y as st,Bn as t,qe as tt,Fn as u,De as ut,Cn as v,ve as vt,On as w,pn as x,gn as y,de as yt,L as z};
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{D as i,F as a,I as o,M as s,O as ee,P as te,T as ne,d as re,k as ie,w as c,y as ae}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{R as oe,t as se,z as l}from"./utils-qjs_KuS4.js";var u=e(t(),1),ce=`__AGENT_CANVAS_BASE_PATH__`;function le(e){let t=e?.trim();return!t||t===`/`?``:(t.startsWith(`/`)?t:`/${t}`).replace(/\/+$/,``)}function ue(){let e=le(void 0);if(e)return e;if(typeof window<`u`){let e=window[ce];if(typeof e==`string`)return le(e)}return``}function de(e){let t=ue();return t?`${t}${e.startsWith(`/`)?e:`/${e}`}`:e.startsWith(`/`)?e:`/${e}`}var d=`openhands`,fe=[{label:`English`,value:`en`},{label:`日本語`,value:`ja`},{label:`简体中文`,value:`zh-CN`},{label:`繁體中文`,value:`zh-TW`},{label:`한국어`,value:`ko-KR`},{label:`Norsk`,value:`no`},{label:`Arabic`,value:`ar`},{label:`Deutsch`,value:`de`},{label:`Français`,value:`fr`},{label:`Italiano`,value:`it`},{label:`Português`,value:`pt`},{label:`Español`,value:`es`},{label:`Català`,value:`ca`},{label:`Türkçe`,value:`tr`},{label:`Українська`,value:`uk`}],f=new WeakMap,pe=e=>{if(!f.has(e)){let t=e.use(ee).use(i).use(r).init({fallbackLng:`en`,debug:!1,supportedLngs:fe.map(e=>e.value),nonExplicitSupportedLngs:!1,ns:[d],defaultNS:d,fallbackNS:d,backend:{loadPath:de(`/locales/{{lng}}/{{ns}}.json`)},interpolation:{escapeValue:!1}});f.set(e,t)}return e},me=()=>pe(s()),he=null,p=null,m=()=>(he||=me(),he),ge=()=>p??m(),_e=e=>(p=e??m(),p),ve=async(e=m())=>(await f.get(e),e),ye=e=>e?typeof e==`object`&&!Array.isArray(e)?{ns:d,...e}:e:{ns:d},h=new Proxy({},{get:(e,t)=>{let n=ge();if(t===`t`)return(e,t)=>n.t(e,ye(t));if(t===`exists`)return(e,t)=>n.exists(e,ye(t));let r=Reflect.get(n,t,n);return typeof r==`function`?r.bind(n):r},set:(e,t,n)=>{let r=ge();return Reflect.set(r,t,n,r)}}),be=e=>typeof e.response?.data==`object`&&e.response?.data!==null&&`error`in e.response.data&&typeof e.response?.data?.error==`string`,xe=e=>typeof e.response?.data==`object`&&e.response?.data!==null&&`message`in e.response.data&&typeof e.response?.data?.message==`string`,Se=`Disconnected (check URL or network). Check that the backend URL is correct and the backend server is reachable. If the backend is on another origin, check that it allows this frontend origin.`,Ce=`Disconnected (request timed out). Check that the backend URL is correct and reachable.`,we=4;function Te(e){return typeof e==`object`&&!!e}function Ee(e){let t=[],n=new Set,r=e,i=0;for(;r!=null&&i<we&&!n.has(r);){if(n.add(r),r instanceof Error)r.message&&t.push(r.message),r=r.cause;else if(typeof r==`string`){r&&t.push(r);break}else if(Te(r)){let e=r.message;typeof e==`string`&&e&&t.push(e),r=r.cause}else break;i+=1}return t}function g(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`disconnected (check cors or network)`)||t.includes(`disconnected (check url or network)`)||t.includes(`blocked by cors`)||t.includes(`failed to fetch`)||t.includes(`network error`)||t.includes(`load failed`)||t.includes(`networkerror when attempting to fetch resource`)||t.includes(`cors`)&&t.includes(`blocked`)}function De(e){return Ee(e).some(g)}function _(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`request timeout`)||t.includes(`timeout after`)||t.includes(`backend request timed out`)}function v(e){let t=Ee(e);return t.some(g)?Se:t.some(_)?Ce:t[0]??null}function Oe(e){return typeof e==`object`&&!!e&&`isAxiosError`in e&&e.isAxiosError===!0}var y=e=>{let t=null,n=!1;return Oe(e)?(n=!0,t=be(e)&&e.response?.data.error?e.response?.data.error:xe(e)&&e.response?.data.message?e.response?.data.message:e.message):t=e instanceof Error?e.message:typeof e==`string`?e:null,v(n?t??e:e)??t??``},b=(e,t=5e3,n=1e4)=>{if(!e)return t;let r=e.length/(1e3/60)*1e3*1.5;return Math.min(Math.max(r,t),n)},x=n(),ke={background:`var(--oh-color-tertiary)`,border:`1px solid var(--oh-border-input)`,color:`#fff`,borderRadius:`var(--oh-radius)`,maxWidth:`400px`,wordBreak:`break-word`,overflowWrap:`anywhere`,whiteSpace:`pre-wrap`},S={position:`top-right`,style:ke},Ae={...ke,color:`var(--oh-muted)`};function je({message:e}){let t=u.useRef(null),[n,r]=u.useState(!1);return u.useLayoutEffect(()=>{let e=t.current;if(!e)return;let n=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(t)||t<=0){r(!1);return}r(e.getBoundingClientRect().height>t*1.5)};n();let i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[e]),(0,x.jsxs)(`div`,{className:se(`flex min-w-0 gap-2`,n?`items-start`:`items-center`),children:[(0,x.jsx)(ne,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:oe}}),(0,x.jsx)(`span`,{ref:t,className:`min-w-0 flex-1 text-sm leading-5 [word-break:break-word] [overflow-wrap:anywhere]`,children:e})]})}var Me={...S,icon:null,style:Ae},Ne=e=>{let t=e||h.t(l.STATUS$ERROR);g(t)?t=h.t(l.ERROR$CORS_OR_NETWORK):_(t)&&(t=h.t(l.ERROR$BACKEND_REQUEST_TIMEOUT));let n=b(t,4e3);c((0,x.jsx)(je,{message:t}),{...Me,duration:n})},Pe=e=>{let t=b(e,5e3);c.success((0,x.jsx)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:e}),{...S,duration:t})},Fe=(e,t,n)=>{let r=b(`${e} ${t}`,5e3);c.success((0,x.jsxs)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:[e,` `,(0,x.jsx)(`a`,{className:`underline hover:no-underline`,href:n,children:t})]}),{...S,duration:r})},Ie=e=>{let t=b(e,6e3);c((0,x.jsx)(`span`,{className:`[word-break:break-word] [overflow-wrap:anywhere]`,children:e}),{...S,icon:`⚠️`,duration:t})},Le=`openhands-backend-health`,Re=500;function ze(e){if(typeof e!=`object`||!e)return!1;let t=e;return Number.isInteger(t.consecutiveFailures)&&t.consecutiveFailures>=0&&t.consecutiveFailures<=5&&(t.lastError===null||typeof t.lastError==`string`)&&(t.lastFailureAt===null||typeof t.lastFailureAt==`number`)&&typeof t.disabled==`boolean`}function Be(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(Le);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&e.length>0&&ze(r)&&(n[e]=r);return n}catch{return{}}}function Ve(e){if(!(typeof window>`u`))try{if(Object.keys(e).length===0){window.localStorage.removeItem(Le);return}window.localStorage.setItem(Le,JSON.stringify(e))}catch{}}function He(e){let t=v(e)??`Unknown error`;return t.length>Re?`${t.slice(0,Re)}…`:t}var C=Be(),Ue=new Set;function We(){Ue.forEach(e=>e())}function w(e){C=e,Ve(e),We()}function Ge(){return C}function Ke(e){return C[e]??null}function qe(e){return Ue.add(e),()=>{Ue.delete(e)}}function Je(e,t){let n=C[e],r=Math.min((n?.consecutiveFailures??0)+1,5),i=n?.disabled===!0||r>=5,a={consecutiveFailures:r,lastError:He(t),lastFailureAt:Date.now(),disabled:i};w({...C,[e]:a})}function Ye(e){if(!(e in C))return;let{[e]:t,...n}=C;w(n)}function Xe(e){if(!(e in C))return;let{[e]:t,...n}=C;w(n)}function Ze(e){if(!(e in C))return;let{[e]:t,...n}=C;w(n)}var Qe=`workspace/project`,$e=`__AGENT_CANVAS_LOCK_TO_CLOUD__`,T=`all-hands.dev`,E=`openhands.dev`,et=`app.${T}`,tt=E,nt=`app.${E}`;function rt(e){return e?.trim()||null}function it(e){if(!e)return null;let t=e.trim().replace(/\/$/,``);return t?/^https?:\/\//i.test(t)?t:typeof window<`u`?`${window.location.protocol}//${t}`:`http://${t}`:null}function D(e){if(!e)return null;let t=e.trim().replace(/\/+$/,``);return t?/^https?:\/\//i.test(t)?t:`https://${t}`:null}function at(e){let t=e.toLowerCase();return t===et||t===nt?tt:t===T?E:t.endsWith(`.${T}`)?`${t.slice(0,-13)}${E}`:t}function ot(e){let t=D(e);if(!t)return null;try{let e=new URL(t),n=e.port?`:${e.port}`:``;return`${e.protocol}//${at(e.hostname)}${n}`}catch{return t.toLowerCase()}}function st(){let e=O();return!e||typeof window>`u`||!dt(window.location.origin,e)?null:window.location.origin}function ct(){return it(void 0)}function lt(){let e=rt(void 0);if(e)return e;if(typeof window<`u`){let e=window.__AGENT_CANVAS_SESSION_API_KEY__;if(typeof e==`string`)return rt(e)}return null}function ut(){return{baseUrl:k()??``,sessionApiKey:A()??``}}function O(){let e=D(void 0);if(e)return e;if(typeof window<`u`){let e=window[$e];if(typeof e==`string`)return D(e)}return null}function dt(e,t){let n=ot(e),r=ot(t);return!n||!r?!1:n===r}function ft(){return st()?`cookie`:`api-key`}function k(){return ct()||(typeof window<`u`?window.location.origin:null)}function A(){return lt()}function j(){return Qe}function pt(e){return`${j().replace(/\/+$/,``)}/${e.replace(/-/g,``)}`}function mt(){let e=A();return e?{"X-Session-API-Key":e}:{}}function M(){return typeof window<`u`&&window.__AGENT_CANVAS_AUTH_REQUIRED__===!0}function ht(){return M()?!A():!1}var gt=`default-local`,_t=`Local`,vt=`locked-cloud`,yt=`OpenHands Cloud`;function bt(){if(!O())return null;let e=st();return e?{id:vt,name:yt,host:e,apiKey:``,kind:`cloud`,authMode:`cookie`}:null}function N(){if(O())return null;let e=k(),t=A();return!e||!t?null:{id:gt,name:_t,host:e,apiKey:t,kind:`local`}}var xt=`openhands-backends`,P=`openhands-active-backend`;function St(e){return e===`local`||e===`cloud`}function Ct(e){return e===void 0||e===`api-key`||e===`cookie`}function wt(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.name==`string`&&typeof t.host==`string`&&typeof t.apiKey==`string`&&St(t.kind)&&Ct(t.authMode)}function Tt(e){try{let{hostname:t}=new URL(e);return t===`localhost`||t===`127.0.0.1`||t===`::1`||t===`[::1]`}catch{return!1}}function Et(e,t){return e.id!==`default-local`||e.kind!==`local`?!1:e.host===t.host||Tt(e.host)&&Tt(t.host)}function Dt(e){let t=N();if(!t)return e;let n=!1,r=e.map(e=>!Et(e,t)||e.apiKey===t.apiKey?e:(n=!0,{...e,apiKey:t.apiKey}));return n?(F(r),r):e}function F(e){if(!(typeof window>`u`))try{window.localStorage.setItem(xt,JSON.stringify(e))}catch{}}function Ot(){if(typeof window>`u`)return[];try{let e=bt();if(e)return F([e]),Nt()?.backendId!==e.id&&I({backendId:e.id}),[e];let t=window.localStorage.getItem(xt);if(t===null){let e=N();return e?(F([e]),[e]):[]}let n=JSON.parse(t);if(!Array.isArray(n))return[];let r=n.filter(wt);if(r.length===0){let e=N();return e?(F([e]),[e]):[]}return Dt(r)}catch{return[]}}function kt(e){if(!e)return null;try{let t=JSON.parse(e);if(typeof t!=`object`||!t||typeof t.backendId!=`string`)return null;let n=t.orgId;return{backendId:t.backendId,orgId:typeof n==`string`&&n.length>0?n:null}}catch{return null}}function At(e,t){try{return e?.getItem(t)??null}catch{return null}}function jt(e,t,n){try{e?.setItem(t,n)}catch{}}function Mt(e,t){try{e?.removeItem(t)}catch{}}function Nt(){return typeof window>`u`?null:kt(At(window.sessionStorage,P))||kt(At(window.localStorage,P))}function I(e){if(typeof window>`u`)return;if(!e){Mt(window.sessionStorage,P),Mt(window.localStorage,P);return}let t=JSON.stringify({backendId:e.backendId,orgId:e.orgId??null});jt(window.sessionStorage,P,t),jt(window.localStorage,P,t)}var Pt=`no-backend`,Ft={id:Pt,name:`No Backend Available`,host:``,apiKey:``,kind:`local`};function L(e){return e.id===Pt}function It(e){return e.find(e=>e.kind===`local`&&Ke(e.id)?.disabled!==!0)||(e.find(e=>e.kind===`local`)??e[0]??Ft)}function R(e,t){let n=null,r=null;if(t){let i=e.find(e=>e.id===t.backendId);i&&(n=i,r=t.orgId??null)}return n||(n=It(e),r=null),{backends:e,selection:t,active:{backend:n,orgId:r}}}var z=R(Ot(),Nt()),B=new Set;function Lt(){B.forEach(e=>e())}function V(){return z.active}function H(){let e=z.active.backend;return e.kind===`local`&&!L(e)?e:null}function U(){return z.backends}function W(){return z.selection}function Rt(){return z}function zt(e){I(e),z=R(z.backends,e),Lt()}function G(e){F(e);let t=z.selection;t&&!e.some(e=>e.id===t.backendId)&&(t=null,I(null)),z=R(e,t),Lt()}function Bt(e){return B.add(e),()=>{B.delete(e)}}var Vt=(e,t)=>{(e?.response?.status===401||e?.status===401)&&t.invalidateQueries({queryKey:[`user`,`authenticated`]})},Ht=e=>{if(!(e instanceof ie)||e.response?.status!==401&&e.status!==401)return!1;let t=V().backend;if(t.kind!==`cloud`)return!1;let n=e.config?.url;return!n||n.startsWith(t.host.replace(/\/+$/,``))},K=new Set,Ut=()=>{let e=new te({queryCache:new a({onSuccess:(e,t)=>{let n=t.meta?.backendId??t.options.meta?.backendId;typeof n==`string`&&Ye(n)},onError:(t,n)=>{if(n.queryKey[0]===`user`&&n.queryKey[1]===`authenticated`||Vt(t,e),!(n.meta?.disableToast??n.options.meta?.disableToast)&&!Ht(t)){let e=y(t);K.has(e||``)||(Ne(e||h.t(l.ERROR$GENERIC)),K.add(e||``),setTimeout(()=>{K.delete(e||``)},3e3))}}}),mutationCache:new o({onError:(t,n,r,i)=>{Vt(t,e),!(i?.meta?.disableToast??i?.options.meta?.disableToast)&&!Ht(t)&&Ne(y(t)||h.t(l.ERROR$GENERIC))}})});return e},Wt=null,Gt=null,Kt=()=>(Wt||=Ut(),Wt),qt=()=>Gt??Kt(),Jt=e=>(Gt=e??Kt(),Gt),Yt=new Proxy({},{get:(e,t)=>{let n=qt(),r=Reflect.get(n,t,n);return typeof r==`function`?r.bind(n):r},set:(e,t,n)=>{let r=qt();return Reflect.set(r,t,n,r)}});function Xt(e){if(e&&!e.startsWith(`/`))try{let t=new URL(e),n=t.hostname,r=window.location.hostname??window.location.host?.split(`:`)[0];return r&&(n===`localhost`||n===`127.0.0.1`)&&r!==`localhost`&&r!==`127.0.0.1`?`${r}:${t.port}`:t.host}catch{return window.location.host}return window.location.host}function Zt(e){if(e&&!e.startsWith(`/`))try{return(new URL(e).pathname.split(`/api/conversations`)[0]||``).replace(/\/$/,``)}catch{return``}return``}function Qt(e){let t=Xt(e),n=Zt(e),r=window.location.protocol===`https:`,i=$t(e)===`https:`;return`${r||i?`https:`:`http:`}//${t}${n}`}function $t(e){if(!e||e.startsWith(`/`))return null;try{return new URL(e).protocol}catch{return null}}function en(e){let t=Xt(e),n=Zt(e),r=window.location.protocol===`https:`,i=$t(e)===`https:`;return`${r||i?`wss:`:`ws:`}//${t}${n}/sockets/bash-events`}function tn(e,t){if(!e)return null;let n=Xt(t),r=Zt(t),i=window.location.protocol===`https:`,a=$t(t)===`https:`;return`${i||a?`wss:`:`ws:`}//${n}${r}/sockets/events/${e}`}var nn=class extends Error{constructor(){super(`No backend is configured.`),this.name=`NoBackendAvailableError`}};function rn(e){return e.replace(/\/+$/,``)}function an(e,t){return e.host?rn(e.host):e.conversationUrl?rn(Qt(e.conversationUrl)):rn(t?.host??``)}function q(e={}){let t=H();if(!t&&!e.host&&!e.conversationUrl)throw new nn;let n=e.sessionApiKey??e.apiKey??t?.apiKey??void 0;return{host:an(e,t),...n?{apiKey:n}:{},workingDir:e.workingDir??j(),...e.timeout===void 0?{}:{timeout:e.timeout}}}function on(e){let{host:t,apiKey:n,timeout:r}=q(e);return{baseUrl:t,...n?{apiKey:n}:{},timeout:r??6e4}}var sn={_comment:`Single source of truth for version pins, ports, paths, and defaults shared across the npm and Docker install paths. Read by scripts/dev-safe.mjs, scripts/dev-with-automation.mjs, docker/entrypoint.sh (via generated defaults.env), and .github/workflows/docker.yml.`,versions:{agentServer:`1.38.0`,agentCanvas:`1.7.2`,automation:`1.4.1`},compatibility:{minimumAgentServer:`1.28.0`},constraints:{_comment:`Temporary upper bound on the agent-client-protocol (acp) transitive dependency. openhands-sdk 1.35.0 requires agent-client-protocol>=0.10.1 with no upper bound, but acp 0.11.0 reordered the ACP prompt() arguments and breaks the SDK's ACP client (a PromptRequest validation error surfaces as 'ACP error: 2 validation errors for PromptRequest'). Pin acp <0.11 until a fixed openhands-sdk ships. Consumed by scripts/dev-safe.mjs (agent-server uvx install) and .github/workflows/mock-llm-e2e.yml (mock ACP server venv).`,agentClientProtocol:`agent-client-protocol<0.11`},images:{agentServer:`ghcr.io/openhands/agent-server`,agentCanvas:`ghcr.io/openhands/agent-canvas`},ports:{agentServer:18e3,automation:18001,proxy:8e3},paths:{stateSubdir:`agent-canvas`,conversations:`agent-canvas/conversations`,bashEvents:`agent-canvas/bash_events`,automationDb:`automation/automations.db`,canvasBasePath:`/canvas`},packages:{agentServer:`openhands-agent-server`,automation:`openhands-automation`,tools:`openhands-tools`,workspace:`openhands-workspace`},telemetry:{posthogApiKey:`phc_kBtz5nKmxVRRQ7HtPwr2QX9eMC5j65zE86QKocVNwb4U`,posthogHost:`https://us.i.posthog.com`}},cn=5e3,ln=`unknown`,J=sn.compatibility.minimumAgentServer,un=`AGENT_SERVER_UNSUPPORTED_VERSION`,dn=`AGENT_SERVER_UNKNOWN_VERSION`,Y=null,fn=e=>Array.isArray(e?.usable_tools)?e.usable_tools:null,X=class extends Error{details;noBackendConfigured;constructor(e,t){let n=t?.noBackendConfigured??!1;super(n?`No agent server backend is configured yet. Add a backend to get started.`:`Could not connect to the configured agent server. Make sure it is running and reachable, then reload the page.`),this.name=`AgentServerUnavailableError`,this.details=e??null,this.noBackendConfigured=n}},pn=e=>e instanceof X||typeof e==`object`&&!!e&&`name`in e&&e.name===`AgentServerUnavailableError`,mn=class extends X{code=un;actualVersion;requiredVersion=J;constructor(e){let t=`Agent Canvas requires agent-server ${J} or newer; this backend is running ${e}. Please upgrade the agent-server backend.`;super(t),this.name=`AgentServerUnsupportedVersionError`,this.message=t,this.actualVersion=e}},hn=class extends X{code=dn;actualVersion;requiredVersion=J;constructor(e){let t=`Could not determine this backend's agent-server version.${e?` It reported "${e}".`:``} Agent Canvas requires agent-server ${J} or newer, but this backend did not return a valid version from /server_info. Restart or rebuild the agent-server backend, then try again.`;super(t),this.name=`AgentServerUnknownVersionError`,this.message=t,this.actualVersion=e}},gn=e=>M()&&Q(e,401);function Z(){Y=null}function _n(e){let t=fn(Y);return Array.isArray(t)?t.includes(e):!0}function vn(e){return e instanceof Error&&e.name===`HttpError`&&`status`in e&&typeof e.status==`number`}function Q(e,t){return vn(e)&&e.status===t}function yn(e){return typeof e==`string`&&e.trim()||null}function bn(e){return yn(e.sdk_version)}function xn(e){return yn(e.version)??bn(e)}function Sn(e){let t=xn(e);return!t||t.toLowerCase()===ln?null:t}function Cn(e){let t=Sn(e);return!t||!En(t)?null:t}function wn(e){return!Y||e&&H()?.host!==e?null:Cn(Y)}function Tn(e,t){let n=En(e),r=En(t);if(!n||!r)return null;for(let e of[`major`,`minor`,`patch`]){if(n[e]>r[e])return 1;if(n[e]<r[e])return-1}return n.prerelease&&!r.prerelease?-1:!n.prerelease&&r.prerelease?1:n.prerelease&&r.prerelease?n.prerelease.localeCompare(r.prerelease):0}function En(e){let[t]=e.trim().replace(/^v/,``).split(`+`),[n,r]=t.split(`-`,2),i=n.split(`.`);if(i.length!==3)return null;let[a,o,s]=i.map(e=>Number(e));return[a,o,s].every(e=>Number.isInteger(e)&&e>=0)?{major:a,minor:o,patch:s,prerelease:r}:null}function Dn(e){let t=Sn(e);if(!t)throw Z(),new hn(xn(e));let n=Tn(t,J);if(n===null)throw Z(),new hn(t);if(n<0)throw Z(),new mn(t)}async function On(){let e=H();if(!e){if(Z(),L(V().backend))throw new X(`No backend configured`,{noBackendConfigured:!0});return null}let t=q({host:e.host,sessionApiKey:e.apiKey||null,timeout:cn}),n;try{n=await new ae(t).getServerInfo()}catch(e){throw Z(),Q(e,401)?e:new X(e instanceof Error?e.message:null)}if(Dn(n),M())try{await new re(t).getSettings()}catch(e){if(Q(e,401))throw e;console.warn(`[agent-server] getSettings() probe failed (non-401):`,e)}return Y=n,n}var kn={WEB_CLIENT_CONFIG:[`web-client-config`],MAIN_APP_COOKIE_AUTH:[`main-app-cookie-auth`]},An={all:[`settings`],byScope:e=>[`settings`,e],personal:()=>[`settings`,`personal`]},jn={all:[`llm-profiles`]},Mn={all:[`agent-profiles`]},Nn={retry:!1},Pn={all:[`llm-subscription`],openaiStatus:[`llm-subscription`,`openai`,`status`],openaiModels:[`llm-subscription`,`openai`,`models`]},Fn={all:[`local-workspaces`]},In={marketplace:[`plugins-marketplace`],installed:[`plugins-installed`],local:[`plugins-local`]},Ln={latestVersion:[`agent-canvas-latest-version`]},Rn={staleTime:1e3*60*5,gcTime:1e3*60*15},$=u.createContext(null);function zn(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`backend-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Bn({children:e}){let t=u.useSyncExternalStore(Bt,Rt,Rt),n=u.useCallback(()=>{Z(),Yt.invalidateQueries({queryKey:kn.WEB_CLIENT_CONFIG})},[]),r=u.useCallback((e,t)=>{let r=W()?.backendId??null,i=W()?.orgId??null,a=t??null;e===r&&a===i||(zt({backendId:e,orgId:a}),n())},[n]),i=u.useCallback(e=>{let t={...e,id:zn()};return G([...U(),t]),zt({backendId:t.id}),n(),t},[n]),a=u.useCallback((e,t)=>{let r=U().find(t=>t.id===e),i=W()?.backendId??null;G(U().map(n=>n.id===e?{...n,...t}:n));let a=t.host!==void 0&&r!==void 0&&t.host!==r.host,o=t.apiKey!==void 0&&r!==void 0&&t.apiKey!==r.apiKey;(a||o)&&(Xe(e),i===e&&n())},[n]),o=u.useCallback(e=>{G(U().filter(t=>t.id!==e)),Ze(e),n()},[n]),s=u.useMemo(()=>({backends:t.backends,active:t.active,setActive:r,addBackend:i,updateBackend:a,removeBackend:o}),[t,r,i,a,o]);return(0,x.jsx)($.Provider,{value:s,children:e})}function Vn(){let e=u.useContext($);if(!e)throw Error(`useActiveBackendContext must be used inside <ActiveBackendProvider>`);return e}function Hn(){let e=u.useContext($);return e?e.active:{backend:N()??Ft,orgId:null}}export{Je as $,Qt as A,_t as B,Q as C,q as D,nn as E,Jt as F,mt as G,pt as H,V as I,O as J,j as K,H as L,Kt as M,qt as N,on as O,Yt as P,Ge as Q,U as R,vn as S,sn as T,k as U,Qe as V,ut as W,ht as X,M as Y,dt as Z,wn as _,_e as _t,Nn as a,Fe as at,_n as b,jn as c,v as ct,In as d,g as dt,Ye as et,kn as f,fe as ft,Tn as g,h as gt,Z as h,ge as ht,Mn as i,Pe as it,tn as j,en as k,Pn as l,_ as lt,Dn as m,m as mt,Hn as n,S as nt,Ln as o,Ie as ot,An as p,d as pt,ft as q,Vn as r,Ne as rt,Rn as s,y as st,Bn as t,qe as tt,Fn as u,De as ut,Cn as v,ve as vt,On as w,pn as x,gn as y,de as yt,L as z};
@@ -1 +1 @@
1
- import{yt as e}from"./vendor-styling-Bcgpimp9.js";import{U as t}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as n}from"./sdk-section-page-Di5mT86Y.js";var r=e();function i(){return(0,r.jsx)(n,{settingsSources:[{settingsSource:`agent_settings`,sectionKeys:[`agent_context`]}],testId:`agent-context-settings-screen`})}var a=t(i);export{a as default};
1
+ import{yt as e}from"./vendor-styling-Bcgpimp9.js";import{U as t}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as n}from"./sdk-section-page-BW-i45yr.js";var r=e();function i(){return(0,r.jsx)(n,{settingsSources:[{settingsSource:`agent_settings`,sectionKeys:[`agent_context`]}],testId:`agent-context-settings-screen`})}var a=t(i);export{a as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,bt as n,yt as r}from"./vendor-styling-Bcgpimp9.js";import{U as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{n as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js";import{t as o}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{t as s}from"./useMutation-DyQXZFEF.js";import{i as c,it as l,rt as u,st as d}from"./active-backend-context-B9942JGX.js";import{t as f,z as p}from"./utils-qjs_KuS4.js";import{t as m}from"./back-nav-button-Be_L157B.js";import{t as h}from"./loading-spinner-CcpnCr_d.js";import{t as g}from"./brand-button-CQO8oqVo.js";import{i as _}from"./dropdown-classes-DQlj-MpS.js";import{t as v}from"./use-llm-profiles-Ci3zAVzV.js";import{n as y,t as b}from"./use-agent-profiles-CliaHofi.js";import{i as x,n as S,t as C}from"./use-can-manage-org-profiles-Uai-HHx2.js";import{t as w}from"./u-edit-809W9D9T.js";import{t as T}from"./settings-dropdown-input-Dx6vlkgf.js";import{r as E}from"./typography-C6fuRTTT.js";import{o as D}from"./extension-module-card-classes-Bo43vY5V.js";import{i as O,n as k,o as A,r as j,t as M}from"./badge-B6q3sVom.js";import{t as N}from"./u-check-circle-DBEvndTS.js";import{i as P,n as F,r as I,t as L}from"./settings-list-classes-gQdBahdt.js";import{n as R}from"./settings-section-header-context-CnIIQAUn.js";import{t as z}from"./use-save-agent-profile-Q2M72WgR.js";import{n as B}from"./use-activate-agent-profile-CXDcjVt8.js";import{t as V}from"./merge-agent-profile-save-input-WcFmQVKK.js";import{i as H,t as U}from"./agent-settings-DEPFl5hR.js";var W=e(t(),1),G=e(n(),1),K=r();function q({onEdit:e,onSetActive:t,onDelete:n,isActive:r,isActivating:i,onClose:a,anchorRef:s}){let{t:c}=o(`openhands`),l=(0,W.useRef)(null),u=(0,W.useRef)([]),d=s?.current??null,[m,h]=(0,W.useState)();(0,W.useLayoutEffect)(()=>{if(!d)return;let e=()=>{let e=d.getBoundingClientRect();e&&h({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)}},[d]),(0,W.useEffect)(()=>{u.current[0]?.focus()},[]),(0,W.useEffect)(()=>{let e=e=>{let t=e.target;l.current&&!l.current.contains(t)&&a()},t=e=>{e.key===`Escape`&&a()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[a]);let g=e=>{e(),a()},v=(0,W.useCallback)((e,t)=>{if(e.key===`Tab`){a();return}let n=u.current.filter(Boolean).length;if(e.key===`ArrowDown`){e.preventDefault();let r=(t+1)%n;u.current[r]?.focus()}else if(e.key===`ArrowUp`){e.preventDefault();let r=(t-1+n)%n;u.current[r]?.focus()}},[a]),y=r||i,b=!!d,S=(0,K.jsxs)(`div`,{ref:l,className:f(`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`,_,b&&`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`),role:`menu`,"aria-orientation":`vertical`,"data-testid":`agent-profile-actions-menu`,children:[(0,K.jsx)(k,{index:0,icon:(0,K.jsx)(w,{width:16,height:16}),label:c(p.SETTINGS$PROFILE_EDIT),onClick:()=>g(e),onKeyDown:v,menuItemsRef:u,testId:`agent-profile-edit`}),(0,K.jsx)(k,{index:1,icon:(0,K.jsx)(N,{width:16,height:16}),label:c(p.SETTINGS$PROFILE_SET_ACTIVE),onClick:()=>g(t),onKeyDown:v,menuItemsRef:u,disabled:y,testId:`agent-profile-set-active`}),(0,K.jsx)(k,{index:2,icon:(0,K.jsx)(x,{width:16,height:16}),label:c(p.BUTTON$DELETE),onClick:()=>g(n),onKeyDown:v,menuItemsRef:u,testId:`agent-profile-delete`})]});return b?typeof document>`u`||!m?null:G.createPortal((0,K.jsx)(`div`,{style:m,children:S}),document.body):S}function J({profile:e,isActive:t,canManage:n,onActivate:r,onEdit:i,onDelete:a,isActivating:s}){let{t:c}=o(`openhands`),[l,u]=(0,W.useState)(!1),d=(0,W.useRef)(null),m=e.agent_kind===`openhands`?e.llm_profile_ref:c(p.SETTINGS$AGENT_TYPE_ACP);return(0,K.jsxs)(`div`,{"data-testid":`agent-profile-row`,className:f(P,`justify-between gap-3`),children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm font-medium text-white`,title:e.name,children:e.name}),m?(0,K.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm text-[var(--oh-muted)]`,title:m,children:m}):null,t&&(0,K.jsx)(M,{className:`shrink-0 whitespace-nowrap px-2.5 py-1 text-xs`,"data-testid":`agent-profile-active-badge`,children:c(p.SETTINGS$PROFILE_ACTIVE)})]}),n&&(0,K.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,K.jsx)(S,{ref:d,onClick:()=>u(e=>!e),ariaLabel:c(p.SETTINGS$PROFILE_MENU),testId:`agent-profile-menu-trigger`,className:I}),l&&(0,K.jsx)(q,{anchorRef:d,onEdit:()=>i(e),onSetActive:()=>r(e),onDelete:()=>a(e),isActive:t,isActivating:s,onClose:()=>u(!1)})]})]})}function Y({isLoading:e,loadError:t,profiles:n,activeId:r,canManage:i,onActivate:a,onEdit:s,onDelete:c,isActivating:l}){let{t:u}=o(`openhands`);return e?(0,K.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,K.jsx)(h,{size:`large`})}):t?(0,K.jsx)(`div`,{"data-testid":`agent-profiles-load-error`,className:D,children:(0,K.jsx)(`p`,{className:`text-sm text-red-400`,children:u(p.SETTINGS$PROFILES_LOAD_ERROR)})}):n.length===0?(0,K.jsx)(`div`,{"data-testid":`agent-profiles-empty`,className:D,children:(0,K.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:u(p.SETTINGS$PROFILES_EMPTY)})}):(0,K.jsx)(`div`,{className:f(L,F),children:n.map(e=>(0,K.jsx)(J,{profile:e,isActive:!!e.id&&e.id===r,canManage:i,onActivate:a,onEdit:s,onDelete:c,isActivating:l},e.name))})}function X(){let e=a();return s({mutationFn:e=>y.deleteProfile(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:c.all})},meta:{disableToast:!0}})}function Z({profile:e,onClose:t}){let{t:n}=o(`openhands`),r=X(),i=(0,W.useRef)(null);if(!e)return null;let a=async()=>{try{await r.mutateAsync(e.name),l(n(p.SETTINGS$PROFILE_DELETED,{name:e.name})),t()}catch(e){u(e instanceof Error?e.message:n(p.ERROR$GENERIC))}},s=()=>{r.isPending||t()},c=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(g,{ref:i,type:`button`,variant:`tertiary`,onClick:s,isDisabled:r.isPending,children:n(p.BUTTON$CANCEL)}),(0,K.jsx)(g,{testId:`delete-agent-profile-confirm`,type:`button`,variant:`danger`,onClick:a,isDisabled:r.isPending,"aria-busy":r.isPending,children:r.isPending?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(h,{size:`small`}),(0,K.jsx)(`span`,{className:`sr-only`,children:n(p.BUTTON$DELETE)})]}):n(p.BUTTON$DELETE)})]});return(0,K.jsx)(j,{isOpen:!0,title:n(p.SETTINGS$PROFILE_DELETE_TITLE),footer:c,onClose:s,initialFocusRef:i,children:(0,K.jsx)(`p`,{className:`text-sm break-all`,children:n(p.SETTINGS$PROFILE_DELETE_CONFIRMATION,{name:e.name})})})}function Q({onAddProfile:e,onEditProfile:t}){let{t:n}=o(`openhands`),{data:r,isLoading:i,error:a}=b(),s=B(),c=C(),[u,d]=(0,W.useState)(null),f=r?.profiles??[],m=r?.active_agent_profile_id??null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsx)(`h2`,{className:`text-base font-medium text-white`,children:n(p.SETTINGS$AVAILABLE_PROFILES)}),e&&c?(0,K.jsx)(g,{testId:`add-agent-profile`,type:`button`,variant:`secondary`,className:`ml-auto`,onClick:e,children:n(p.SETTINGS$ADD_AGENT_PROFILE)}):null]}),(0,K.jsx)(Y,{isLoading:i,loadError:a??null,profiles:f,activeId:m,canManage:c,onActivate:async e=>{if(e.id)try{await s.mutateAsync(e.id),l(n(p.SETTINGS$PROFILE_ACTIVATED,{name:e.name}))}catch(e){console.error(`Failed to activate agent profile:`,e)}},onEdit:e=>t?.(e),onDelete:d,isActivating:s.isPending})]}),(0,K.jsx)(Z,{profile:u,onClose:()=>d(null)})]})}function $(){let e=a();return s({mutationFn:({name:e,newName:t})=>y.renameProfile(e,t),onSuccess:async()=>{await e.invalidateQueries({queryKey:c.all})},meta:{disableToast:!0}})}function ee(e){return e.agent_kind===`acp`?{agent_kind:`acp`,acp_server:e.acp_server,acp_command:e.acp_command?H(e.acp_command):[],acp_args:e.acp_args??[],acp_model:e.acp_model??``}:{agent_kind:`openhands`,enable_sub_agents:e.enable_sub_agents,tool_concurrency_limit:e.tool_concurrency_limit}}function te(){let{t:e}=o(`openhands`),{setHideSectionHeader:t}=R(),n=z(),r=$(),{data:i}=b(),{data:a,isLoading:s}=v(),[c,f]=(0,W.useState)(`list`),[h,_]=(0,W.useState)(``),[x,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(null),[D,k]=(0,W.useState)(``),[j,M]=(0,W.useState)(null),[N,P]=(0,W.useState)(!1);(0,W.useEffect)(()=>(t(c!==`list`),()=>t(!1)),[c,t]);let F=a?.profiles??[],I=a?.active_profile??F[0]?.name??``,L=(0,W.useMemo)(()=>new Set(i?.profiles?.map(e=>e.name)??[]),[i]),B=(0,W.useMemo)(()=>!(!A(h,{isRequired:!0})||c===`create`&&L.has(h)||c===`edit`&&h!==x?.name&&L.has(h)),[h,c,L,x?.name]),H=(0,W.useCallback)(()=>{_(``),S(null),w({agent_kind:`openhands`}),k(I),M(null),f(`create`)},[I]),G=(0,W.useCallback)(async t=>{try{let e=(await y.getProfile(t.name,`encrypted`)).profile;S(e),w(ee(e)),e.agent_kind===`openhands`?k(s||F.some(t=>t.name===e.llm_profile_ref)?e.llm_profile_ref:I):k(``),_(e.name),M(null),f(`edit`)}catch(t){console.error(`Failed to fetch agent profile:`,t),u(e(p.ERROR$GENERIC))}},[e,F,s,I]),q=(0,W.useCallback)(()=>{f(`list`),S(null),_(``),w(null),M(null)},[]),J=(0,W.useCallback)(async()=>{if(!j||!B)return;let t;try{let n=j.buildAgentProfileFields();if(n.agent_kind===`openhands`){if(!D){u(e(p.SETTINGS$AGENT_PROFILE_LLM_REQUIRED));return}t={...n,llm_profile_ref:D}}else t=n}catch(t){u(t instanceof Error?t.message:e(p.ERROR$GENERIC));return}let i=h.trim(),a=x?.name,o=c===`edit`&&a&&a!==i;P(!0);try{if(j.credentials.isDirty){if(!await j.credentials.save({silent:!0}))return;j.credentials.reset()}o&&await r.mutateAsync({name:a,newName:i});let s=V(c===`edit`?x:null,t);await n.mutateAsync({name:i,profile:s}),l(e(c===`create`?p.SETTINGS$PROFILE_CREATED:p.SETTINGS$PROFILE_UPDATED,{name:i})),q()}catch(t){u(d(t)||e(p.ERROR$GENERIC))}finally{P(!1)}},[j,B,D,h,c,x,n,r,e,q]);if(c===`list`)return(0,K.jsx)(Q,{onAddProfile:H,onEditProfile:G});let Y=e(c===`edit`?p.SETTINGS$EDIT_AGENT_PROFILE:p.SETTINGS$ADD_AGENT_PROFILE),X=c===`edit`&&x?e(p.SETTINGS$PROFILE_LOADED,{name:x.name}):e(p.SETTINGS$PROFILE_SAVE_HINT),Z=j?.agentType!==`acp`;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(m,{testId:`back-to-agent-profiles`,onClick:q,children:e(p.BUTTON$BACK)}),(0,K.jsx)(E.H2,{testId:`agent-profile-editor-title`,children:Y}),(0,K.jsx)(`p`,{"data-testid":`agent-profile-editor-description`,className:`text-sm leading-5 text-tertiary-light`,children:X})]}),(0,K.jsx)(O,{testId:`agent-profile-name-input`,value:h,onChange:_,isRequired:!0}),(0,K.jsx)(U,{embedded:!0,agentSettingsOverride:C,onSaveControlChange:M},c===`edit`?`edit-${x?.id}`:`new-profile`),Z&&(F.length>0?(0,K.jsx)(T,{testId:`agent-profile-llm-selector`,name:`agent-profile-llm`,label:e(p.SETTINGS$AGENT_PROFILE_LLM_LABEL),items:F.map(e=>({key:e.name,label:e.model?`${e.name} (${e.model})`:e.name})),selectedKey:D,onSelectionChange:e=>e&&k(String(e))}):(0,K.jsx)(`p`,{"data-testid":`agent-profile-no-llm`,className:`text-sm text-red-400`,children:e(p.SETTINGS$AGENT_PROFILE_NO_LLM)})),(0,K.jsxs)(`div`,{className:`flex justify-start gap-3 pt-4`,children:[(0,K.jsx)(g,{testId:`cancel-agent-profile-btn`,type:`button`,variant:`secondary`,onClick:q,children:e(p.BUTTON$CANCEL)}),(0,K.jsx)(g,{testId:`save-agent-profile-btn`,type:`button`,variant:`primary`,onClick:J,isDisabled:!B||N||!j?.isValid,"aria-busy":N,children:e(N?p.SETTINGS$SAVING:p.BUTTON$SAVE)})]})]})}var ne={hideTitle:!1},re=i(function(){return(0,K.jsx)(te,{})});export{re as default,ne as handle};
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,bt as n,yt as r}from"./vendor-styling-Bcgpimp9.js";import{U as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{n as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js";import{t as o}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{t as s}from"./useMutation-DyQXZFEF.js";import{i as c,it as l,rt as u,st as d}from"./active-backend-context-BlZPzZNU.js";import{t as f,z as p}from"./utils-qjs_KuS4.js";import{t as m}from"./back-nav-button-Be_L157B.js";import{t as h}from"./loading-spinner-CcpnCr_d.js";import{t as g}from"./brand-button-CQO8oqVo.js";import{i as _}from"./dropdown-classes-DQlj-MpS.js";import{t as v}from"./use-llm-profiles-BMQoc612.js";import{n as y,t as b}from"./use-agent-profiles-Dmd_4H8q.js";import{i as x,n as S,t as C}from"./use-can-manage-org-profiles-CrG1km7R.js";import{t as w}from"./u-edit-809W9D9T.js";import{t as T}from"./settings-dropdown-input-Dx6vlkgf.js";import{r as E}from"./typography-C6fuRTTT.js";import{o as D}from"./extension-module-card-classes-Bo43vY5V.js";import{i as O,n as k,o as A,r as j,t as M}from"./badge-DwgrwohM.js";import{t as N}from"./u-check-circle-DBEvndTS.js";import{i as P,n as F,r as I,t as L}from"./settings-list-classes-gQdBahdt.js";import{n as R}from"./settings-section-header-context-CnIIQAUn.js";import{t as z}from"./use-save-agent-profile-2Mk9ZX37.js";import{n as B}from"./use-activate-agent-profile-DH33MvVj.js";import{t as V}from"./merge-agent-profile-save-input-WcFmQVKK.js";import{i as H,t as U}from"./agent-settings-BIOsUglV.js";var W=e(t(),1),G=e(n(),1),K=r();function q({onEdit:e,onSetActive:t,onDelete:n,isActive:r,isActivating:i,onClose:a,anchorRef:s}){let{t:c}=o(`openhands`),l=(0,W.useRef)(null),u=(0,W.useRef)([]),d=s?.current??null,[m,h]=(0,W.useState)();(0,W.useLayoutEffect)(()=>{if(!d)return;let e=()=>{let e=d.getBoundingClientRect();e&&h({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)}},[d]),(0,W.useEffect)(()=>{u.current[0]?.focus()},[]),(0,W.useEffect)(()=>{let e=e=>{let t=e.target;l.current&&!l.current.contains(t)&&a()},t=e=>{e.key===`Escape`&&a()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[a]);let g=e=>{e(),a()},v=(0,W.useCallback)((e,t)=>{if(e.key===`Tab`){a();return}let n=u.current.filter(Boolean).length;if(e.key===`ArrowDown`){e.preventDefault();let r=(t+1)%n;u.current[r]?.focus()}else if(e.key===`ArrowUp`){e.preventDefault();let r=(t-1+n)%n;u.current[r]?.focus()}},[a]),y=r||i,b=!!d,S=(0,K.jsxs)(`div`,{ref:l,className:f(`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`,_,b&&`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`),role:`menu`,"aria-orientation":`vertical`,"data-testid":`agent-profile-actions-menu`,children:[(0,K.jsx)(k,{index:0,icon:(0,K.jsx)(w,{width:16,height:16}),label:c(p.SETTINGS$PROFILE_EDIT),onClick:()=>g(e),onKeyDown:v,menuItemsRef:u,testId:`agent-profile-edit`}),(0,K.jsx)(k,{index:1,icon:(0,K.jsx)(N,{width:16,height:16}),label:c(p.SETTINGS$PROFILE_SET_ACTIVE),onClick:()=>g(t),onKeyDown:v,menuItemsRef:u,disabled:y,testId:`agent-profile-set-active`}),(0,K.jsx)(k,{index:2,icon:(0,K.jsx)(x,{width:16,height:16}),label:c(p.BUTTON$DELETE),onClick:()=>g(n),onKeyDown:v,menuItemsRef:u,testId:`agent-profile-delete`})]});return b?typeof document>`u`||!m?null:G.createPortal((0,K.jsx)(`div`,{style:m,children:S}),document.body):S}function J({profile:e,isActive:t,canManage:n,onActivate:r,onEdit:i,onDelete:a,isActivating:s}){let{t:c}=o(`openhands`),[l,u]=(0,W.useState)(!1),d=(0,W.useRef)(null),m=e.agent_kind===`openhands`?e.llm_profile_ref:c(p.SETTINGS$AGENT_TYPE_ACP);return(0,K.jsxs)(`div`,{"data-testid":`agent-profile-row`,className:f(P,`justify-between gap-3`),children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm font-medium text-white`,title:e.name,children:e.name}),m?(0,K.jsx)(`span`,{className:`min-w-0 max-w-full truncate text-sm text-[var(--oh-muted)]`,title:m,children:m}):null,t&&(0,K.jsx)(M,{className:`shrink-0 whitespace-nowrap px-2.5 py-1 text-xs`,"data-testid":`agent-profile-active-badge`,children:c(p.SETTINGS$PROFILE_ACTIVE)})]}),n&&(0,K.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,K.jsx)(S,{ref:d,onClick:()=>u(e=>!e),ariaLabel:c(p.SETTINGS$PROFILE_MENU),testId:`agent-profile-menu-trigger`,className:I}),l&&(0,K.jsx)(q,{anchorRef:d,onEdit:()=>i(e),onSetActive:()=>r(e),onDelete:()=>a(e),isActive:t,isActivating:s,onClose:()=>u(!1)})]})]})}function Y({isLoading:e,loadError:t,profiles:n,activeId:r,canManage:i,onActivate:a,onEdit:s,onDelete:c,isActivating:l}){let{t:u}=o(`openhands`);return e?(0,K.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,K.jsx)(h,{size:`large`})}):t?(0,K.jsx)(`div`,{"data-testid":`agent-profiles-load-error`,className:D,children:(0,K.jsx)(`p`,{className:`text-sm text-red-400`,children:u(p.SETTINGS$PROFILES_LOAD_ERROR)})}):n.length===0?(0,K.jsx)(`div`,{"data-testid":`agent-profiles-empty`,className:D,children:(0,K.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:u(p.SETTINGS$PROFILES_EMPTY)})}):(0,K.jsx)(`div`,{className:f(L,F),children:n.map(e=>(0,K.jsx)(J,{profile:e,isActive:!!e.id&&e.id===r,canManage:i,onActivate:a,onEdit:s,onDelete:c,isActivating:l},e.name))})}function X(){let e=a();return s({mutationFn:e=>y.deleteProfile(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:c.all})},meta:{disableToast:!0}})}function Z({profile:e,onClose:t}){let{t:n}=o(`openhands`),r=X(),i=(0,W.useRef)(null);if(!e)return null;let a=async()=>{try{await r.mutateAsync(e.name),l(n(p.SETTINGS$PROFILE_DELETED,{name:e.name})),t()}catch(e){u(e instanceof Error?e.message:n(p.ERROR$GENERIC))}},s=()=>{r.isPending||t()},c=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(g,{ref:i,type:`button`,variant:`tertiary`,onClick:s,isDisabled:r.isPending,children:n(p.BUTTON$CANCEL)}),(0,K.jsx)(g,{testId:`delete-agent-profile-confirm`,type:`button`,variant:`danger`,onClick:a,isDisabled:r.isPending,"aria-busy":r.isPending,children:r.isPending?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(h,{size:`small`}),(0,K.jsx)(`span`,{className:`sr-only`,children:n(p.BUTTON$DELETE)})]}):n(p.BUTTON$DELETE)})]});return(0,K.jsx)(j,{isOpen:!0,title:n(p.SETTINGS$PROFILE_DELETE_TITLE),footer:c,onClose:s,initialFocusRef:i,children:(0,K.jsx)(`p`,{className:`text-sm break-all`,children:n(p.SETTINGS$PROFILE_DELETE_CONFIRMATION,{name:e.name})})})}function Q({onAddProfile:e,onEditProfile:t}){let{t:n}=o(`openhands`),{data:r,isLoading:i,error:a}=b(),s=B(),c=C(),[u,d]=(0,W.useState)(null),f=r?.profiles??[],m=r?.active_agent_profile_id??null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsx)(`h2`,{className:`text-base font-medium text-white`,children:n(p.SETTINGS$AVAILABLE_PROFILES)}),e&&c?(0,K.jsx)(g,{testId:`add-agent-profile`,type:`button`,variant:`secondary`,className:`ml-auto`,onClick:e,children:n(p.SETTINGS$ADD_AGENT_PROFILE)}):null]}),(0,K.jsx)(Y,{isLoading:i,loadError:a??null,profiles:f,activeId:m,canManage:c,onActivate:async e=>{if(e.id)try{await s.mutateAsync(e.id),l(n(p.SETTINGS$PROFILE_ACTIVATED,{name:e.name}))}catch(e){console.error(`Failed to activate agent profile:`,e)}},onEdit:e=>t?.(e),onDelete:d,isActivating:s.isPending})]}),(0,K.jsx)(Z,{profile:u,onClose:()=>d(null)})]})}function $(){let e=a();return s({mutationFn:({name:e,newName:t})=>y.renameProfile(e,t),onSuccess:async()=>{await e.invalidateQueries({queryKey:c.all})},meta:{disableToast:!0}})}function ee(e){return e.agent_kind===`acp`?{agent_kind:`acp`,acp_server:e.acp_server,acp_command:e.acp_command?H(e.acp_command):[],acp_args:e.acp_args??[],acp_model:e.acp_model??``}:{agent_kind:`openhands`,enable_sub_agents:e.enable_sub_agents,tool_concurrency_limit:e.tool_concurrency_limit}}function te(){let{t:e}=o(`openhands`),{setHideSectionHeader:t}=R(),n=z(),r=$(),{data:i}=b(),{data:a,isLoading:s}=v(),[c,f]=(0,W.useState)(`list`),[h,_]=(0,W.useState)(``),[x,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(null),[D,k]=(0,W.useState)(``),[j,M]=(0,W.useState)(null),[N,P]=(0,W.useState)(!1);(0,W.useEffect)(()=>(t(c!==`list`),()=>t(!1)),[c,t]);let F=a?.profiles??[],I=a?.active_profile??F[0]?.name??``,L=(0,W.useMemo)(()=>new Set(i?.profiles?.map(e=>e.name)??[]),[i]),B=(0,W.useMemo)(()=>!(!A(h,{isRequired:!0})||c===`create`&&L.has(h)||c===`edit`&&h!==x?.name&&L.has(h)),[h,c,L,x?.name]),H=(0,W.useCallback)(()=>{_(``),S(null),w({agent_kind:`openhands`}),k(I),M(null),f(`create`)},[I]),G=(0,W.useCallback)(async t=>{try{let e=(await y.getProfile(t.name,`encrypted`)).profile;S(e),w(ee(e)),e.agent_kind===`openhands`?k(s||F.some(t=>t.name===e.llm_profile_ref)?e.llm_profile_ref:I):k(``),_(e.name),M(null),f(`edit`)}catch(t){console.error(`Failed to fetch agent profile:`,t),u(e(p.ERROR$GENERIC))}},[e,F,s,I]),q=(0,W.useCallback)(()=>{f(`list`),S(null),_(``),w(null),M(null)},[]),J=(0,W.useCallback)(async()=>{if(!j||!B)return;let t;try{let n=j.buildAgentProfileFields();if(n.agent_kind===`openhands`){if(!D){u(e(p.SETTINGS$AGENT_PROFILE_LLM_REQUIRED));return}t={...n,llm_profile_ref:D}}else t=n}catch(t){u(t instanceof Error?t.message:e(p.ERROR$GENERIC));return}let i=h.trim(),a=x?.name,o=c===`edit`&&a&&a!==i;P(!0);try{if(j.credentials.isDirty){if(!await j.credentials.save({silent:!0}))return;j.credentials.reset()}o&&await r.mutateAsync({name:a,newName:i});let s=V(c===`edit`?x:null,t);await n.mutateAsync({name:i,profile:s}),l(e(c===`create`?p.SETTINGS$PROFILE_CREATED:p.SETTINGS$PROFILE_UPDATED,{name:i})),q()}catch(t){u(d(t)||e(p.ERROR$GENERIC))}finally{P(!1)}},[j,B,D,h,c,x,n,r,e,q]);if(c===`list`)return(0,K.jsx)(Q,{onAddProfile:H,onEditProfile:G});let Y=e(c===`edit`?p.SETTINGS$EDIT_AGENT_PROFILE:p.SETTINGS$ADD_AGENT_PROFILE),X=c===`edit`&&x?e(p.SETTINGS$PROFILE_LOADED,{name:x.name}):e(p.SETTINGS$PROFILE_SAVE_HINT),Z=j?.agentType!==`acp`;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(m,{testId:`back-to-agent-profiles`,onClick:q,children:e(p.BUTTON$BACK)}),(0,K.jsx)(E.H2,{testId:`agent-profile-editor-title`,children:Y}),(0,K.jsx)(`p`,{"data-testid":`agent-profile-editor-description`,className:`text-sm leading-5 text-tertiary-light`,children:X})]}),(0,K.jsx)(O,{testId:`agent-profile-name-input`,value:h,onChange:_,isRequired:!0}),(0,K.jsx)(U,{embedded:!0,agentSettingsOverride:C,onSaveControlChange:M},c===`edit`?`edit-${x?.id}`:`new-profile`),Z&&(F.length>0?(0,K.jsx)(T,{testId:`agent-profile-llm-selector`,name:`agent-profile-llm`,label:e(p.SETTINGS$AGENT_PROFILE_LLM_LABEL),items:F.map(e=>({key:e.name,label:e.model?`${e.name} (${e.model})`:e.name})),selectedKey:D,onSelectionChange:e=>e&&k(String(e))}):(0,K.jsx)(`p`,{"data-testid":`agent-profile-no-llm`,className:`text-sm text-red-400`,children:e(p.SETTINGS$AGENT_PROFILE_NO_LLM)})),(0,K.jsxs)(`div`,{className:`flex justify-start gap-3 pt-4`,children:[(0,K.jsx)(g,{testId:`cancel-agent-profile-btn`,type:`button`,variant:`secondary`,onClick:q,children:e(p.BUTTON$CANCEL)}),(0,K.jsx)(g,{testId:`save-agent-profile-btn`,type:`button`,variant:`primary`,onClick:J,isDisabled:!B||N||!j?.isValid,"aria-busy":N,children:e(N?p.SETTINGS$SAVING:p.BUTTON$SAVE)})]})]})}var ne={hideTitle:!1},re=i(function(){return(0,K.jsx)(te,{})});export{re as default,ne as handle};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secrets-service-i4CCd-UN.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/active-backend-context-B9942JGX.js","assets/vendor-styling-Bcgpimp9.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js","assets/utils-qjs_KuS4.js","assets/proxy-CN3HaaOW.js"])))=>i.map(i=>d[i]);
2
- import{xt as e}from"./vendor-styling-Bcgpimp9.js";import{_ as t,c as n,f as r,g as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{A as a,D as o,E as s,H as c,I as l,K as u,L as d,b as f}from"./active-backend-context-B9942JGX.js";import{C as ee}from"./utils-qjs_KuS4.js";import{t as p}from"./client-source-D8jWKBfE.js";import{r as m,t as h}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-Bw4AuHN1.js";import{t as g}from"./proxy-CN3HaaOW.js";import{t as _}from"./settings-Chfn5xTD.js";import{t as v}from"./settings-service.api-i_HHIqJP.js";import{t as y}from"./v4-DDdyfk2q.js";import{t as te}from"./profiles-service.api-BddMsEhq.js";import{t as ne}from"./vendor~root-layout~index-home~home~conversation-panel~conversation~launch~skills-settings~a~eywn6ulz-BKxxr74w.js";import{f as b,o as x,s as S}from"./acp-providers-BHKZvEm5.js";import{d as C,f as w,r as T}from"./llm-subscription-DTqtBCWz.js";import{t as re}from"./llm-subscription-service-_QUsVybQ.js";var E=new Map;function ie(e){return/^([/\\]|[a-zA-Z]:[/\\])/.test(e)}function ae(e,t){return`${e.replace(/[/\\]+$/,``)}/${t.replace(/^[/\\]+/,``)}`}async function oe(e={}){let t=o(e),n=t.host,r=E.get(n);if(r)return r;let a=(async()=>{let{home:e}=await new i(t).getHome();if(!e||typeof e!=`string`)throw Error(`Agent server returned an empty home directory`);return e.replace(/[/\\]+$/,``)})();E.set(n,a);try{return await a}catch(e){throw E.delete(n),e}}async function se(e,t={}){let n=e.replace(/[/\\]+$/,``);return n?ie(n)?n:ae(await oe(t),n):oe(t)}var D=`openhands-agent-server-conversation-metadata`,ce=e=>({source:e.source,ref:e.ref??null,repo_path:e.repo_path??null}),O=()=>{if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(D);if(!e)return{};let t=JSON.parse(e);return!t||typeof t!=`object`?{}:t}catch{return{}}},le=e=>{if(!(typeof window>`u`)){if(Object.keys(e).length===0){window.localStorage.removeItem(D);return}window.localStorage.setItem(D,JSON.stringify(e))}},k=e=>O()[e]??null,A=(e,t)=>{let n=O();n[e]=t,le(n)},j=e=>{let t=O();e in t&&(delete t[e],le(t))};function M(e){if(!e?.id)return e;let t=k(e.id);return t?{...e,selected_repository:e.selected_repository??t.selected_repository??null,selected_branch:e.selected_branch??t.selected_branch??null,git_provider:e.git_provider??t.git_provider??null,selected_workspace:e.selected_workspace??t.selected_workspace??null}:e}function N(){let e=l().backend;if(e.kind!==`cloud`)throw Error(`Cloud conversations call requires a cloud backend.`);return e}async function ue(e=20,t){let n=N(),r=new URLSearchParams;r.set(`limit`,String(e)),t&&r.set(`page_id`,t),r.set(`sort_order`,`UPDATED_AT_DESC`);let i=await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/search?${r.toString()}`});return{items:(i?.items??[]).map(e=>M(e)),next_page_id:i?.next_page_id??null}}async function P(e){if(e.length===0)return[];let t=N(),n=new URLSearchParams;for(let t of e)n.append(`ids`,t);return(await g({backend:t,method:`GET`,path:`/api/v1/app-conversations?${n.toString()}`})??[]).map(M)}async function de(e){return await g({backend:N(),method:`POST`,path:`/api/v1/app-conversations`,body:e,headers:p})}async function fe(e){return g({backend:N(),method:`GET`,path:`/api/v1/app-conversations/${e}/download`,responseType:`blob`})}async function pe(e){await g({backend:N(),method:`DELETE`,path:`/api/v1/app-conversations/${e}`})}async function me(e,t){return await g({backend:N(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{public:t}})}async function he(e){await g({backend:N(),method:`POST`,path:`/api/v1/sandboxes/${e}/pause`})}async function ge(e){await g({backend:N(),method:`POST`,path:`/api/v1/sandboxes/${e}/resume`})}async function F(e,t){let n=N(),r=new URLSearchParams;return r.append(`file_path`,t),await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/file?${r.toString()}`})??``}async function _e(e){let t=N(),n=new URLSearchParams;return n.set(`ids`,e),(await g({backend:t,method:`GET`,path:`/api/v1/app-conversations/start-tasks?${n.toString()}`}))?.[0]??null}function ve(e){return e.kind===`cloud`&&e.authMode===`cookie`||!e.apiKey?{}:e.kind===`cloud`?{Authorization:`Bearer ${e.apiKey}`}:{"X-Session-API-Key":e.apiKey}}var I=`canvas_ui`,L=`canvas_ui_control`,ye=`ClientAction_${L}`,be={name:L,description:`The user is interacting with you inside Agent Canvas — a web UI with a chat panel on the left and a tabbed right-side panel (files, terminal, browser, vscode, planner, tasklist). This tool lets you drive that right-side panel so the user sees what you just produced.
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secrets-service-BjK-bPN2.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/active-backend-context-BlZPzZNU.js","assets/vendor-styling-Bcgpimp9.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js","assets/utils-qjs_KuS4.js","assets/proxy-C79PCMjo.js"])))=>i.map(i=>d[i]);
2
+ import{xt as e}from"./vendor-styling-Bcgpimp9.js";import{_ as t,c as n,f as r,g as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{A as a,D as o,E as s,H as c,I as l,K as u,L as d,b as f}from"./active-backend-context-BlZPzZNU.js";import{C as ee}from"./utils-qjs_KuS4.js";import{t as p}from"./client-source-1v-kWLNU.js";import{r as m,t as h}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-Bw4AuHN1.js";import{t as g}from"./proxy-C79PCMjo.js";import{t as _}from"./settings-Chfn5xTD.js";import{t as v}from"./settings-service.api-DryhKdSr.js";import{t as y}from"./v4-DDdyfk2q.js";import{t as te}from"./profiles-service.api-CBafmAPO.js";import{t as ne}from"./vendor~root-layout~index-home~home~conversation-panel~conversation~launch~skills-settings~a~eywn6ulz-BKxxr74w.js";import{f as b,o as x,s as S}from"./acp-providers-BHKZvEm5.js";import{d as C,f as w,r as T}from"./llm-subscription-DTqtBCWz.js";import{t as re}from"./llm-subscription-service-W5BprsNA.js";var E=new Map;function ie(e){return/^([/\\]|[a-zA-Z]:[/\\])/.test(e)}function ae(e,t){return`${e.replace(/[/\\]+$/,``)}/${t.replace(/^[/\\]+/,``)}`}async function oe(e={}){let t=o(e),n=t.host,r=E.get(n);if(r)return r;let a=(async()=>{let{home:e}=await new i(t).getHome();if(!e||typeof e!=`string`)throw Error(`Agent server returned an empty home directory`);return e.replace(/[/\\]+$/,``)})();E.set(n,a);try{return await a}catch(e){throw E.delete(n),e}}async function se(e,t={}){let n=e.replace(/[/\\]+$/,``);return n?ie(n)?n:ae(await oe(t),n):oe(t)}var D=`openhands-agent-server-conversation-metadata`,ce=e=>({source:e.source,ref:e.ref??null,repo_path:e.repo_path??null}),O=()=>{if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(D);if(!e)return{};let t=JSON.parse(e);return!t||typeof t!=`object`?{}:t}catch{return{}}},le=e=>{if(!(typeof window>`u`)){if(Object.keys(e).length===0){window.localStorage.removeItem(D);return}window.localStorage.setItem(D,JSON.stringify(e))}},k=e=>O()[e]??null,A=(e,t)=>{let n=O();n[e]=t,le(n)},j=e=>{let t=O();e in t&&(delete t[e],le(t))};function M(e){if(!e?.id)return e;let t=k(e.id);return t?{...e,selected_repository:e.selected_repository??t.selected_repository??null,selected_branch:e.selected_branch??t.selected_branch??null,git_provider:e.git_provider??t.git_provider??null,selected_workspace:e.selected_workspace??t.selected_workspace??null}:e}function N(){let e=l().backend;if(e.kind!==`cloud`)throw Error(`Cloud conversations call requires a cloud backend.`);return e}async function ue(e=20,t){let n=N(),r=new URLSearchParams;r.set(`limit`,String(e)),t&&r.set(`page_id`,t),r.set(`sort_order`,`UPDATED_AT_DESC`);let i=await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/search?${r.toString()}`});return{items:(i?.items??[]).map(e=>M(e)),next_page_id:i?.next_page_id??null}}async function P(e){if(e.length===0)return[];let t=N(),n=new URLSearchParams;for(let t of e)n.append(`ids`,t);return(await g({backend:t,method:`GET`,path:`/api/v1/app-conversations?${n.toString()}`})??[]).map(M)}async function de(e){return await g({backend:N(),method:`POST`,path:`/api/v1/app-conversations`,body:e,headers:p})}async function fe(e){return g({backend:N(),method:`GET`,path:`/api/v1/app-conversations/${e}/download`,responseType:`blob`})}async function pe(e){await g({backend:N(),method:`DELETE`,path:`/api/v1/app-conversations/${e}`})}async function me(e,t){return await g({backend:N(),method:`PATCH`,path:`/api/v1/app-conversations/${e}`,body:{public:t}})}async function he(e){await g({backend:N(),method:`POST`,path:`/api/v1/sandboxes/${e}/pause`})}async function ge(e){await g({backend:N(),method:`POST`,path:`/api/v1/sandboxes/${e}/resume`})}async function F(e,t){let n=N(),r=new URLSearchParams;return r.append(`file_path`,t),await g({backend:n,method:`GET`,path:`/api/v1/app-conversations/${e}/file?${r.toString()}`})??``}async function _e(e){let t=N(),n=new URLSearchParams;return n.set(`ids`,e),(await g({backend:t,method:`GET`,path:`/api/v1/app-conversations/start-tasks?${n.toString()}`}))?.[0]??null}function ve(e){return e.kind===`cloud`&&e.authMode===`cookie`||!e.apiKey?{}:e.kind===`cloud`?{Authorization:`Bearer ${e.apiKey}`}:{"X-Session-API-Key":e.apiKey}}var I=`canvas_ui`,L=`canvas_ui_control`,ye=`ClientAction_${L}`,be={name:L,description:`The user is interacting with you inside Agent Canvas — a web UI with a chat panel on the left and a tabbed right-side panel (files, terminal, browser, vscode, planner, tasklist). This tool lets you drive that right-side panel so the user sees what you just produced.
3
3
 
4
4
  They will NOT see the files you wrote, the terminal output, or the browser
5
5
  unless you call this tool to switch the right-side panel to the relevant
@@ -38,4 +38,4 @@ call per logical step is enough — don't repeat it for the same file or tab in
38
38
  the same turn.`,parameters:{type:`object`,additionalProperties:!1,properties:{command:{type:`string`,enum:[`navigate_to_file`,`open_tab`,`show_preview`],description:`UI command to dispatch.`},path:{type:`string`,description:`Workspace-relative file path. Required for navigate_to_file and show_preview; ignored otherwise.`},tab:{type:`string`,enum:[`files`,`browser`,`vscode`,`terminal`,`planner`,`tasklist`],description:`Tab to open. Required for open_tab; ignored otherwise.`}},required:[`command`]},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},xe=[`terminal`,`file_editor`,`task_tracker`],R=`browser_tool_set`,z=`task_tool_set`;function Se(){return!0}function Ce(){if(typeof window<`u`){let e=window.__AGENT_CANVAS_RUNTIME_SERVICES_INFO__;if(typeof e==`string`)return e.trim()||null}return null}function we(){let e=Ce();if(!e)return null;try{let t=JSON.parse(e);return!t||typeof t!=`object`?null:t}catch{return null}}function Te(){let e=we();if(!e?.services)return;let t=[];t.push(`<RUNTIME_SERVICES>`),e.mode?t.push(`You are running inside an agent-canvas dev stack started in '${e.mode}' mode.`):t.push(`You are running inside an agent-canvas dev stack.`),t.push(`The following services are reachable from your sandbox. URLs are written`,`from your point of view (i.e., as you should curl/fetch them).`,``);let{agent_server:n,ingress:r,automation:i}=e.services,{frontend:a}=e.services;n?.url_from_agent&&t.push(`* Agent Server (you): ${n.url_from_agent}`,` ${n.description??`The agent-server hosting your tool calls.`}`),r?.url_from_agent&&t.push(`* Ingress: ${r.url_from_agent}`,` ${r.description??`Unified entry point for browser-facing traffic.`}`),a?.url_from_agent&&t.push(`* Frontend: ${a.url_from_agent}`,` ${a.description??`Frontend dev server.`}`),i?.url_from_agent?(t.push(`* Automation backend: ${i.url_from_agent}`,` ${i.description??`OpenHands Automations service.`}`),i.docs_url&&t.push(` Docs: ${i.docs_url}`),i.openapi_url&&t.push(` OpenAPI: ${i.openapi_url}`),i.auth_env_var&&t.push(` Auth: header 'X-Session-API-Key: $${i.auth_env_var}'`)):t.push(`* Automation backend: not running in this dev mode (skip /api/automation calls).`);let o=n?.url_from_agent;return t.push(``,`Trust this block over guessing: do not assume any other URLs are running.`),o&&t.push(`In particular, ${o} inside your sandbox is the Agent Server`,`you are running inside of — NOT the automation backend.`),t.push(`</RUNTIME_SERVICES>`),t.join(`
39
39
  `)}function Ee(e){let{host:t}=o();return`${t}/api/conversations/${e}`}function B(e){return`Conversation ${e.slice(0,5)}`}function V(e){let t=k(e.id),n=e.agent?.kind===`ACPAgent`,r=n?e.tags?.acpserver??e.agent?.acp_server??null:null;return{id:e.id,created_by_user_id:null,selected_repository:t?.selected_repository??null,selected_branch:t?.selected_branch??null,git_provider:t?.git_provider??null,selected_workspace:t?.selected_workspace??null,active_profile:t?.active_profile??null,title:e.title?.trim()?e.title:B(e.id),trigger:null,pr_number:[],agent_kind:n?`acp`:`openhands`,acp_server:r,tags:e.tags??null,launched_agent_profile:e.launched_agent_profile??null,llm_model:n?b({runtimeName:e.current_model_name,runtimeId:e.current_model_id,configured:e.agent?.acp_model,sdkLlm:e.agent?.llm?.model}):e.agent?.llm?.model??_.llm_model,metrics:e.metrics?{accumulated_cost:e.metrics.accumulated_cost??null,max_budget_per_task:e.metrics.max_budget_per_task??null,accumulated_token_usage:e.metrics.accumulated_token_usage?{prompt_tokens:e.metrics.accumulated_token_usage.prompt_tokens??0,completion_tokens:e.metrics.accumulated_token_usage.completion_tokens??0,cache_read_tokens:e.metrics.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:e.metrics.accumulated_token_usage.cache_write_tokens??0,context_window:e.metrics.accumulated_token_usage.context_window??0,per_turn_token:e.metrics.accumulated_token_usage.per_turn_token??0}:null}:null,created_at:e.created_at,updated_at:e.updated_at,execution_status:e.execution_status??ee.IDLE,sandbox_status:e.sandbox_status??null,conversation_url:Ee(e.id),session_api_key:o().apiKey??null,sandbox_id:null,workspace:{working_dir:e.workspace?.working_dir??u()},public:!1,sub_conversation_ids:[]}}function De(e){return{items:e.items.map(V),next_page_id:e.next_page_id??null}}var H=`acpserver`,Oe=new Set([H]);function ke(e){return e?Object.entries(e).filter(([e])=>!Oe.has(e)).sort(([e],[t])=>e.localeCompare(t)):[]}var Ae=`gAAAAA`,je=new Set([`schema_version`,`agent_settings`,`workspace`,`conversation_id`,`initial_message`,`plugins`]);function U(e){return!e||typeof e!=`object`||Array.isArray(e)?{}:structuredClone(e)}function W(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function G(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function K(e){return typeof e==`string`?e.startsWith(Ae):Array.isArray(e)?e.some(K):G(e)?Object.values(e).some(K):!1}function Me(e){return G(e)?Object.values(e).some(K):!1}function Ne(e){return e.confirmation_mode===!0?e.security_analyzer===`llm`?{kind:`ConfirmRisky`,threshold:`HIGH`,confirm_unknown:!0}:{kind:`AlwaysConfirm`}:{kind:`NeverConfirm`}}function Pe(e){switch(e.security_analyzer){case`llm`:return{kind:`LLMSecurityAnalyzer`};case`pattern`:return{kind:`PatternSecurityAnalyzer`};case`policy_rail`:return{kind:`PolicyRailSecurityAnalyzer`};default:return}}function Fe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&typeof e.name==`string`}function q(e,t){return e===R?Se()&&f(e):e===z?t.enable_sub_agents===!0&&f(e):!0}function Ie(e){let t=new Map;for(let n of xe)q(n,e)&&t.set(n,{name:n,params:{}});for(let n of[R,z])q(n,e)&&t.set(n,{name:n,params:{}});let n=e.tools;if(Array.isArray(n)&&n.every(e=>Fe(e)))for(let r of n)q(r.name,e)&&t.set(r.name,{name:r.name,params:U(r.params)});return Array.from(t.values())}function Le(e,t){let n=[e?.trim(),t?.trim()].filter(Boolean);return n.length===0?null:{role:`user`,content:[{type:`text`,text:n.join(`
40
40
 
41
- `)}],run:!0}}function Re(){return ne.map(e=>{let t=e.triggers?.length>0?{type:`keyword`,keywords:e.triggers}:null,n=`/home/runner/work/OpenHands/OpenHands/node_modules/@openhands/extensions/skills/${e.name}/SKILL.md`;return{name:e.name,content:e.content,trigger:t,source:n,description:e.description??null,is_agentskills_format:!0,...e.license?{license:e.license}:{},...e.compatibility?{compatibility:e.compatibility}:{}}})}function ze(e){let t=Te(),n=U(e.agent_context),r=[...Array.isArray(n.skills)?n.skills:[],...Re()];return{...n,skills:r,load_public_skills:!1,load_user_skills:!0,load_project_skills:!0,...t?{system_message_suffix:t}:{}}}function Be(e){return U(e.agent_settings).agent_kind===`acp`}function Ve(e){let t=U(e.agent_settings).acp_server;return typeof t==`string`&&t.length>0?t:void 0}function He(e){let t=e.acp_command;if(!(Array.isArray(t)&&t.length===0)&&t!==void 0)return t;let n=S(typeof e.acp_server==`string`?e.acp_server:void 0);return n?[...n.default_command]:t}function Ue(e){let t=U(e.agent_settings),n={agent_kind:`acp`,agent_context:ze(t)};for(let e of h){if(e===`acp_model`||e===`acp_env`)continue;let r=e===`acp_command`?He(t):t[e];r!=null&&(n[e]=r)}let r=U(t.mcp_config);Object.keys(r).length>0&&(n.mcp_config=r);let i=typeof t.acp_server==`string`?t.acp_server:void 0,a=b({configured:t.acp_model,providerDefault:x(i)});return a&&(n.acp_model=a),n}function We(e){let t=U(e.agent_settings),n=U(t.llm);n.model=typeof n.model==`string`&&n.model.trim().length>0?n.model:_.llm_model,n.stream=!0;let r=W(n.api_key);r?n.api_key=r:delete n.api_key;let i=W(n.base_url);i?n.base_url=i:delete n.base_url,w(n)?(n.auth_type=T,n.subscription_vendor=C,delete n.api_key,delete n.base_url):(delete n.auth_type,delete n.subscription_vendor);let a=U(t.mcp_config);Object.keys(a).length===0&&delete t.mcp_config,delete t.acp_server;for(let e of h)delete t[e];return delete t.acp_env,{...t,llm:n,agent_context:ze(t),tools:Ie(t)}}function Ge(e){return Be(e)?Ue(e):We(e)}function Ke(e){let{settings:t,query:n,conversationInstructions:r,plugins:i,workingDir:a}=e,o=U(t.conversation_settings),s=Le(n,r);return je.forEach(e=>delete o[e]),{...o,workspace:{kind:`LocalWorkspace`,working_dir:a??u()},...s?{initial_message:s}:{},...i?.length?{plugins:i.map(e=>({source:e.source,...e.ref?{ref:e.ref}:{},...e.repo_path?{repo_path:e.repo_path}:{}}))}:{}}}function qe(e){let t=e.encryptedAgentSettings?{...e.settings,agent_settings:e.encryptedAgentSettings}:e.settings,n=Be(t),r=e.agentProfileId?e.agentProfileKind:n?`acp`:`openhands`,i=Ge(t),a=n?Ve(t):void 0,o=Ke(e.encryptedConversationSettings?{...e,settings:{...e.settings,conversation_settings:e.encryptedConversationSettings}}:e),s={...e.agentProfileId?{agent_profile_id:e.agentProfileId}:{agent_settings:i},workspace:o.workspace,client_tools:r===`openhands`?[be]:[],confirmation_policy:Ne(o),max_iterations:typeof o.max_iterations==`number`?o.max_iterations:500,stuck_detection:!0,autotitle:!0,...e.titleLlmProfile?{title_llm_profile:e.titleLlmProfile}:{},worktree:e.worktree??!0};!e.agentProfileId&&a&&(s.tags={[H]:a}),!e.agentProfileId&&e.secretsEncrypted&&(!n||Me(i.mcp_config))&&(s.secrets_encrypted=!0),e.conversationId&&(s.conversation_id=e.conversationId);let c=Pe(o);c&&(s.security_analyzer=c),o.initial_message&&(s.initial_message=o.initial_message),o.plugins&&(s.plugins=o.plugins),o.hook_config&&(s.hook_config=o.hook_config);let l={...o.tool_module_qualnames??{}};if(delete l[I],delete l[L],Object.keys(l).length>0&&(s.tool_module_qualnames=l),o.agent_definitions&&(s.agent_definitions=o.agent_definitions),e.customSecrets&&e.customSecrets.length>0){let t=d(),n=t?ve(t):{},r={};for(let t of e.customSecrets){let e={kind:`LookupSecret`,url:`/api/settings/secrets/${encodeURIComponent(t.name)}`,description:t.description};Object.keys(n).length>0&&(e.headers=n),r[t.name]=e}s.secrets=r}return s}var Je=`Connect your ChatGPT subscription before starting a conversation with this LLM profile.`;async function Ye(e){if(w(U(e.llm))&&!(await re.getOpenAIStatus()).connected)throw Error(Je)}async function Xe(t){let{SecretsService:n}=await e(async()=>{let{SecretsService:e}=await import(`./secrets-service-i4CCd-UN.js`).then(e=>e.n);return{SecretsService:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),[r,i]=await Promise.all([v.getSettingsForConversation(),n.getSecrets()]),{agentSettings:a,conversationSettings:o,secretsEncrypted:s}=r;return t.agentProfileId||await Ye(a),qe({...t,encryptedAgentSettings:a,encryptedConversationSettings:o,secretsEncrypted:s,customSecrets:i})}function Ze(){return{hooks:[]}}function Qe(e,t){if(!t)return;let n=new Set(t.profiles.map(e=>e.name));if(e&&n.has(e))return e;if(t.active_profile&&n.has(t.active_profile))return t.active_profile}var $e=`1970-01-01T00:00:00.000Z`,et=300*1e3,tt=`Unable to load conversations because the selected agent server returned data this UI does not understand. Check the backend URL/session key and update the agent server if needed.`;function J(){return Error(tt)}function Y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nt(e){return typeof e==`number`?e:null}function X(e){return typeof e==`number`?e:0}function Z(e){return typeof e==`string`?e:null}function Q(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:$e}function rt(e){return Y(e)?{prompt_tokens:X(e.prompt_tokens),completion_tokens:X(e.completion_tokens),cache_read_tokens:X(e.cache_read_tokens),cache_write_tokens:X(e.cache_write_tokens),context_window:X(e.context_window),per_turn_token:X(e.per_turn_token)}:null}function it(e){return Y(e)?{accumulated_cost:nt(e.accumulated_cost),max_budget_per_task:nt(e.max_budget_per_task),accumulated_token_usage:rt(e.accumulated_token_usage)}:null}function at(e){if(!Y(e))return null;let t=Y(e.llm)?{model:Z(e.llm.model)}:null;return{kind:Z(e.kind),acp_server:Z(e.acp_server),acp_model:Z(e.acp_model),llm:t}}function ot(e){return Y(e)?{working_dir:Z(e.working_dir)}:null}function st(e){if(!Y(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function ct(e){if(!Y(e))return null;let{agent_profile_id:t,revision:n}=e;return typeof t!=`string`||typeof n!=`number`?null:{agent_profile_id:t,revision:n}}function lt(e){if(!e.startsWith(`/`))return null;let t=[];for(let n of e.split(`/`))if(n&&n!==`.`)if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n);return`/${t.join(`/`)}`}function ut(e,t){let n=lt(e),r=lt(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function dt(e){if(!Y(e)||typeof e.id!=`string`||!e.id.trim())throw J();return{id:e.id.trim(),title:Z(e.title),created_at:Q(e,`created_at`,`createdAt`),updated_at:Q(e,`updated_at`,`updatedAt`),execution_status:Z(e.execution_status),sandbox_status:Z(e.sandbox_status),metrics:it(e.metrics),agent:at(e.agent),workspace:ot(e.workspace),tags:st(e.tags),launched_agent_profile:ct(e.launched_agent_profile),current_model_id:Z(e.current_model_id),current_model_name:Z(e.current_model_name)}}function $(e){if(!Array.isArray(e))throw J();return e.map(dt)}function ft(e){if(Array.isArray(e))return{items:$(e),next_page_id:null};if(!Y(e))throw J();return{items:$(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var pt=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function mt(e){let t=e??`idle`;return pt.has(t)?t:`idle`}function ht(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var gt=class{static async sendMessage(e,n,r){let i=l().backend,s=r?.conversationUrl??null,c=r?.sessionApiKey??null;if(i.kind===`cloud`){if(!s||!c){let[t]=await P([e]);s=t?.conversation_url?.trim()??null,c=t?.session_api_key?.trim()??null}if(!s||!c)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return await g({backend:i,method:`POST`,hostOverride:a(s),path:`/api/conversations/${e}/events`,body:{...n,run:!0},authMode:`session-api-key`,sessionApiKey:c}),n}return await new t(o({conversationUrl:s,sessionApiKey:c})).sendEvent(e,n,{run:!0}),n}static async createConversation(e,n,r,i,a,u,f,ee,p,m,h){if(l().backend.kind===`cloud`)return de({initial_message:e?{role:`user`,content:[{type:`text`,text:e}]}:null,title:n??null,selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,plugins:r??null,parent_conversation_id:f??null,agent_type:ee,sandbox_id:p??null,agent_profile_id:m??null});let[g,_]=await Promise.all([v.getSettings(),te.listProfiles().catch(()=>void 0)]),ne=Qe(g.title_llm_profile,_),b=y(),x=await se(a??c(b)),S=u??(a?`local_repo`:`new_worktree`),C=await Xe({settings:g,query:e,conversationInstructions:n,plugins:r,conversationId:b,workingDir:x,worktree:S===`new_worktree`,agentProfileId:m,agentProfileKind:h,titleLlmProfile:ne}),w=await new t(o({timeout:et})).createConversation(C),T=d();if(!T)throw new s;return(i?.selected_repository||a)&&A(w.id,{selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,selected_workspace:a??null,workspace_mode:S}),{id:w.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:w.id,agent_server_url:T.host,request:{initial_message:C.initial_message,plugins:r??null},created_at:w.created_at,updated_at:w.updated_at}}static async getStartTask(e){return l().backend.kind===`cloud`?_e(e):null}static async getVSCodeUrl(e,t,r){let i=await this.resolveConversationWorkingDir(e);return{vscode_url:await new n(o({conversationUrl:t,sessionApiKey:r})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:i})}}static async resolveConversationWorkingDir(e){let[t]=await this.batchGetAppConversations([e]);return t?.workspace?.working_dir??u()}static async batchGetAppConversations(e){return e.length===0?[]:l().backend.kind===`cloud`?P(e):$(await new t(o()).getConversations(e)).map(e=>V(e))}static async updateConversationPublicFlag(e,t){if(l().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return me(e,t)}static async updateConversationRepository(e,t,n,r){t?A(e,{...k(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):j(e);let[i]=await this.batchGetAppConversations([e]);return ht(i,e)}static async readConversationFile(e,t){if(l().backend.kind===`cloud`)return F(e,ut(t??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let n=await this.resolveConversationWorkingDir(e),r=ut(t??`${n}/.agents_tmp/PLAN.md`,n);return new i(o()).downloadTextFile(r)}static async downloadConversation(e){return l().backend.kind===`cloud`?fe(e):new i(o()).downloadTrajectory(e)}static async getHooks(e){return Ze()}static async getRuntimeConversation(e,n,r){let i=l().backend,s=i.kind===`cloud`&&n?await g({backend:i,method:`GET`,hostOverride:a(n),path:`/api/conversations/${e}`,authMode:`session-api-key`,sessionApiKey:r}):await new t(o({conversationUrl:n,sessionApiKey:r})).getConversation(e),c=dt(s),u=Y(s)?s.stats:null;return{id:c.id,title:c.title?.trim()?c.title:B(c.id),metrics:it(c.metrics),created_at:c.created_at,updated_at:c.updated_at,status:mt(c.execution_status),stats:Y(u)?u:{usage_to_metrics:{}}}}static async searchConversations(e=20,n){return l().backend.kind===`cloud`?ue(e,n):De(ft(await new t(o()).searchConversations({limit:e,page_id:n,sort_order:m.UPDATED_AT_DESC})))}static async deleteConversation(e){l().backend.kind===`cloud`?await pe(e):await new t(o()).deleteConversation(e),j(e)}static async updateConversationTitle(e,n){await new t(o()).updateConversation(e,{title:n});let[r]=await this.batchGetAppConversations([e]);return ht(r,e)}static async forkConversation(e,n,r){if(l().backend.kind===`cloud`)throw Error(`Branching a conversation isn't supported on the cloud backend yet.`);let i=await new t(o()).forkConversation(e,{from_event_id:n,...r?{title:r}:{}}),a=k(e);return a&&A(i.id,a),i}static async getEventParentId(e,n){return(await new t(o()).getEvent(e,n)).parent_id??void 0}static async switchProfile(e,n){let{backend:i}=l();if(i.kind===`cloud`){if(!e){await te.activateProfile(n);return}await g({backend:i,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_profile`,body:{profile_name:n}});return}if(!e){await new r(o()).activateProfile(n);return}let a=o(),s=new t(a),c=await new r(a).getProfile(n,{exposeSecrets:`encrypted`}),u=typeof c.config.model==`string`?c.config.model:``;if(!u)throw Error(`Profile '${n}' has no model.`);await Ye({llm:c.config}),await s.switchLLM(e,{...c.config,model:u,stream:!0,usage_id:`profile:${n}:${y()}`})}static async switchAcpModel(e,n){let{backend:r}=l();if(r.kind===`cloud`){await g({backend:r,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_acp_model`,body:{model:n}});return}await new t(o()).switchAcpModel(e,n)}};export{I as a,F as c,A as d,ce as f,L as i,ge as l,ke as n,P as o,se as p,ye as r,he as s,gt as t,k as u};
41
+ `)}],run:!0}}function Re(){return ne.map(e=>{let t=e.triggers?.length>0?{type:`keyword`,keywords:e.triggers}:null,n=`/home/runner/work/OpenHands/OpenHands/node_modules/@openhands/extensions/skills/${e.name}/SKILL.md`;return{name:e.name,content:e.content,trigger:t,source:n,description:e.description??null,is_agentskills_format:!0,...e.license?{license:e.license}:{},...e.compatibility?{compatibility:e.compatibility}:{}}})}function ze(e){let t=Te(),n=U(e.agent_context),r=[...Array.isArray(n.skills)?n.skills:[],...Re()];return{...n,skills:r,load_public_skills:!1,load_user_skills:!0,load_project_skills:!0,...t?{system_message_suffix:t}:{}}}function Be(e){return U(e.agent_settings).agent_kind===`acp`}function Ve(e){let t=U(e.agent_settings).acp_server;return typeof t==`string`&&t.length>0?t:void 0}function He(e){let t=e.acp_command;if(!(Array.isArray(t)&&t.length===0)&&t!==void 0)return t;let n=S(typeof e.acp_server==`string`?e.acp_server:void 0);return n?[...n.default_command]:t}function Ue(e){let t=U(e.agent_settings),n={agent_kind:`acp`,agent_context:ze(t)};for(let e of h){if(e===`acp_model`||e===`acp_env`)continue;let r=e===`acp_command`?He(t):t[e];r!=null&&(n[e]=r)}let r=U(t.mcp_config);Object.keys(r).length>0&&(n.mcp_config=r);let i=typeof t.acp_server==`string`?t.acp_server:void 0,a=b({configured:t.acp_model,providerDefault:x(i)});return a&&(n.acp_model=a),n}function We(e){let t=U(e.agent_settings),n=U(t.llm);n.model=typeof n.model==`string`&&n.model.trim().length>0?n.model:_.llm_model,n.stream=!0;let r=W(n.api_key);r?n.api_key=r:delete n.api_key;let i=W(n.base_url);i?n.base_url=i:delete n.base_url,w(n)?(n.auth_type=T,n.subscription_vendor=C,delete n.api_key,delete n.base_url):(delete n.auth_type,delete n.subscription_vendor);let a=U(t.mcp_config);Object.keys(a).length===0&&delete t.mcp_config,delete t.acp_server;for(let e of h)delete t[e];return delete t.acp_env,{...t,llm:n,agent_context:ze(t),tools:Ie(t)}}function Ge(e){return Be(e)?Ue(e):We(e)}function Ke(e){let{settings:t,query:n,conversationInstructions:r,plugins:i,workingDir:a}=e,o=U(t.conversation_settings),s=Le(n,r);return je.forEach(e=>delete o[e]),{...o,workspace:{kind:`LocalWorkspace`,working_dir:a??u()},...s?{initial_message:s}:{},...i?.length?{plugins:i.map(e=>({source:e.source,...e.ref?{ref:e.ref}:{},...e.repo_path?{repo_path:e.repo_path}:{}}))}:{}}}function qe(e){let t=e.encryptedAgentSettings?{...e.settings,agent_settings:e.encryptedAgentSettings}:e.settings,n=Be(t),r=e.agentProfileId?e.agentProfileKind:n?`acp`:`openhands`,i=Ge(t),a=n?Ve(t):void 0,o=Ke(e.encryptedConversationSettings?{...e,settings:{...e.settings,conversation_settings:e.encryptedConversationSettings}}:e),s={...e.agentProfileId?{agent_profile_id:e.agentProfileId}:{agent_settings:i},workspace:o.workspace,client_tools:r===`openhands`?[be]:[],confirmation_policy:Ne(o),max_iterations:typeof o.max_iterations==`number`?o.max_iterations:500,stuck_detection:!0,autotitle:!0,...e.titleLlmProfile?{title_llm_profile:e.titleLlmProfile}:{},worktree:e.worktree??!0};!e.agentProfileId&&a&&(s.tags={[H]:a}),!e.agentProfileId&&e.secretsEncrypted&&(!n||Me(i.mcp_config))&&(s.secrets_encrypted=!0),e.conversationId&&(s.conversation_id=e.conversationId);let c=Pe(o);c&&(s.security_analyzer=c),o.initial_message&&(s.initial_message=o.initial_message),o.plugins&&(s.plugins=o.plugins),o.hook_config&&(s.hook_config=o.hook_config);let l={...o.tool_module_qualnames??{}};if(delete l[I],delete l[L],Object.keys(l).length>0&&(s.tool_module_qualnames=l),o.agent_definitions&&(s.agent_definitions=o.agent_definitions),e.customSecrets&&e.customSecrets.length>0){let t=d(),n=t?ve(t):{},r={};for(let t of e.customSecrets){let e={kind:`LookupSecret`,url:`/api/settings/secrets/${encodeURIComponent(t.name)}`,description:t.description};Object.keys(n).length>0&&(e.headers=n),r[t.name]=e}s.secrets=r}return s}var Je=`Connect your ChatGPT subscription before starting a conversation with this LLM profile.`;async function Ye(e){if(w(U(e.llm))&&!(await re.getOpenAIStatus()).connected)throw Error(Je)}async function Xe(t){let{SecretsService:n}=await e(async()=>{let{SecretsService:e}=await import(`./secrets-service-BjK-bPN2.js`).then(e=>e.n);return{SecretsService:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),[r,i]=await Promise.all([v.getSettingsForConversation(),n.getSecrets()]),{agentSettings:a,conversationSettings:o,secretsEncrypted:s}=r;return t.agentProfileId||await Ye(a),qe({...t,encryptedAgentSettings:a,encryptedConversationSettings:o,secretsEncrypted:s,customSecrets:i})}function Ze(){return{hooks:[]}}function Qe(e,t){if(!t)return;let n=new Set(t.profiles.map(e=>e.name));if(e&&n.has(e))return e;if(t.active_profile&&n.has(t.active_profile))return t.active_profile}var $e=`1970-01-01T00:00:00.000Z`,et=300*1e3,tt=`Unable to load conversations because the selected agent server returned data this UI does not understand. Check the backend URL/session key and update the agent server if needed.`;function J(){return Error(tt)}function Y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nt(e){return typeof e==`number`?e:null}function X(e){return typeof e==`number`?e:0}function Z(e){return typeof e==`string`?e:null}function Q(e,t,n){let r=e[t]??e[n];return typeof r==`string`&&r.trim()?r:$e}function rt(e){return Y(e)?{prompt_tokens:X(e.prompt_tokens),completion_tokens:X(e.completion_tokens),cache_read_tokens:X(e.cache_read_tokens),cache_write_tokens:X(e.cache_write_tokens),context_window:X(e.context_window),per_turn_token:X(e.per_turn_token)}:null}function it(e){return Y(e)?{accumulated_cost:nt(e.accumulated_cost),max_budget_per_task:nt(e.max_budget_per_task),accumulated_token_usage:rt(e.accumulated_token_usage)}:null}function at(e){if(!Y(e))return null;let t=Y(e.llm)?{model:Z(e.llm.model)}:null;return{kind:Z(e.kind),acp_server:Z(e.acp_server),acp_model:Z(e.acp_model),llm:t}}function ot(e){return Y(e)?{working_dir:Z(e.working_dir)}:null}function st(e){if(!Y(e))return null;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function ct(e){if(!Y(e))return null;let{agent_profile_id:t,revision:n}=e;return typeof t!=`string`||typeof n!=`number`?null:{agent_profile_id:t,revision:n}}function lt(e){if(!e.startsWith(`/`))return null;let t=[];for(let n of e.split(`/`))if(n&&n!==`.`)if(n===`..`){if(!t.length)return null;t.pop()}else t.push(n);return`/${t.join(`/`)}`}function ut(e,t){let n=lt(e),r=lt(t);if(!n||!r||n!==r&&!n.startsWith(`${r}/`))throw Error(`Conversation file path must stay inside the workspace`);return n}function dt(e){if(!Y(e)||typeof e.id!=`string`||!e.id.trim())throw J();return{id:e.id.trim(),title:Z(e.title),created_at:Q(e,`created_at`,`createdAt`),updated_at:Q(e,`updated_at`,`updatedAt`),execution_status:Z(e.execution_status),sandbox_status:Z(e.sandbox_status),metrics:it(e.metrics),agent:at(e.agent),workspace:ot(e.workspace),tags:st(e.tags),launched_agent_profile:ct(e.launched_agent_profile),current_model_id:Z(e.current_model_id),current_model_name:Z(e.current_model_name)}}function $(e){if(!Array.isArray(e))throw J();return e.map(dt)}function ft(e){if(Array.isArray(e))return{items:$(e),next_page_id:null};if(!Y(e))throw J();return{items:$(e.items),next_page_id:typeof e.next_page_id==`string`?e.next_page_id:null}}var pt=new Set([`idle`,`running`,`paused`,`waiting_for_confirmation`,`finished`,`error`,`stuck`]);function mt(e){let t=e??`idle`;return pt.has(t)?t:`idle`}function ht(e,t){if(!e)throw Error(`Conversation ${t} was not found`);return e}var gt=class{static async sendMessage(e,n,r){let i=l().backend,s=r?.conversationUrl??null,c=r?.sessionApiKey??null;if(i.kind===`cloud`){if(!s||!c){let[t]=await P([e]);s=t?.conversation_url?.trim()??null,c=t?.session_api_key?.trim()??null}if(!s||!c)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return await g({backend:i,method:`POST`,hostOverride:a(s),path:`/api/conversations/${e}/events`,body:{...n,run:!0},authMode:`session-api-key`,sessionApiKey:c}),n}return await new t(o({conversationUrl:s,sessionApiKey:c})).sendEvent(e,n,{run:!0}),n}static async createConversation(e,n,r,i,a,u,f,ee,p,m,h){if(l().backend.kind===`cloud`)return de({initial_message:e?{role:`user`,content:[{type:`text`,text:e}]}:null,title:n??null,selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,plugins:r??null,parent_conversation_id:f??null,agent_type:ee,sandbox_id:p??null,agent_profile_id:m??null});let[g,_]=await Promise.all([v.getSettings(),te.listProfiles().catch(()=>void 0)]),ne=Qe(g.title_llm_profile,_),b=y(),x=await se(a??c(b)),S=u??(a?`local_repo`:`new_worktree`),C=await Xe({settings:g,query:e,conversationInstructions:n,plugins:r,conversationId:b,workingDir:x,worktree:S===`new_worktree`,agentProfileId:m,agentProfileKind:h,titleLlmProfile:ne}),w=await new t(o({timeout:et})).createConversation(C),T=d();if(!T)throw new s;return(i?.selected_repository||a)&&A(w.id,{selected_repository:i?.selected_repository??null,selected_branch:i?.selected_branch??null,git_provider:i?.git_provider??null,selected_workspace:a??null,workspace_mode:S}),{id:w.id,created_by_user_id:null,status:`READY`,detail:null,app_conversation_id:w.id,agent_server_url:T.host,request:{initial_message:C.initial_message,plugins:r??null},created_at:w.created_at,updated_at:w.updated_at}}static async getStartTask(e){return l().backend.kind===`cloud`?_e(e):null}static async getVSCodeUrl(e,t,r){let i=await this.resolveConversationWorkingDir(e);return{vscode_url:await new n(o({conversationUrl:t,sessionApiKey:r})).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:i})}}static async resolveConversationWorkingDir(e){let[t]=await this.batchGetAppConversations([e]);return t?.workspace?.working_dir??u()}static async batchGetAppConversations(e){return e.length===0?[]:l().backend.kind===`cloud`?P(e):$(await new t(o()).getConversations(e)).map(e=>V(e))}static async updateConversationPublicFlag(e,t){if(l().backend.kind!==`cloud`)throw Error(`Public sharing requires a cloud backend.`);return me(e,t)}static async updateConversationRepository(e,t,n,r){t?A(e,{...k(e)??{},selected_repository:t,selected_branch:n??null,git_provider:r??null}):j(e);let[i]=await this.batchGetAppConversations([e]);return ht(i,e)}static async readConversationFile(e,t){if(l().backend.kind===`cloud`)return F(e,ut(t??`/workspace/project/.agents_tmp/PLAN.md`,`/workspace/project`));let n=await this.resolveConversationWorkingDir(e),r=ut(t??`${n}/.agents_tmp/PLAN.md`,n);return new i(o()).downloadTextFile(r)}static async downloadConversation(e){return l().backend.kind===`cloud`?fe(e):new i(o()).downloadTrajectory(e)}static async getHooks(e){return Ze()}static async getRuntimeConversation(e,n,r){let i=l().backend,s=i.kind===`cloud`&&n?await g({backend:i,method:`GET`,hostOverride:a(n),path:`/api/conversations/${e}`,authMode:`session-api-key`,sessionApiKey:r}):await new t(o({conversationUrl:n,sessionApiKey:r})).getConversation(e),c=dt(s),u=Y(s)?s.stats:null;return{id:c.id,title:c.title?.trim()?c.title:B(c.id),metrics:it(c.metrics),created_at:c.created_at,updated_at:c.updated_at,status:mt(c.execution_status),stats:Y(u)?u:{usage_to_metrics:{}}}}static async searchConversations(e=20,n){return l().backend.kind===`cloud`?ue(e,n):De(ft(await new t(o()).searchConversations({limit:e,page_id:n,sort_order:m.UPDATED_AT_DESC})))}static async deleteConversation(e){l().backend.kind===`cloud`?await pe(e):await new t(o()).deleteConversation(e),j(e)}static async updateConversationTitle(e,n){await new t(o()).updateConversation(e,{title:n});let[r]=await this.batchGetAppConversations([e]);return ht(r,e)}static async forkConversation(e,n,r){if(l().backend.kind===`cloud`)throw Error(`Branching a conversation isn't supported on the cloud backend yet.`);let i=await new t(o()).forkConversation(e,{from_event_id:n,...r?{title:r}:{}}),a=k(e);return a&&A(i.id,a),i}static async getEventParentId(e,n){return(await new t(o()).getEvent(e,n)).parent_id??void 0}static async switchProfile(e,n){let{backend:i}=l();if(i.kind===`cloud`){if(!e){await te.activateProfile(n);return}await g({backend:i,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_profile`,body:{profile_name:n}});return}if(!e){await new r(o()).activateProfile(n);return}let a=o(),s=new t(a),c=await new r(a).getProfile(n,{exposeSecrets:`encrypted`}),u=typeof c.config.model==`string`?c.config.model:``;if(!u)throw Error(`Profile '${n}' has no model.`);await Ye({llm:c.config}),await s.switchLLM(e,{...c.config,model:u,stream:!0,usage_id:`profile:${n}:${y()}`})}static async switchAcpModel(e,n){let{backend:r}=l();if(r.kind===`cloud`){await g({backend:r,method:`POST`,path:`/api/v1/app-conversations/${e}/switch_acp_model`,body:{model:n}});return}await new t(o()).switchAcpModel(e,n)}};export{I as a,F as c,A as d,ce as f,L as i,ge as l,ke as n,P as o,se as p,ye as r,he as s,gt as t,k as u};
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./rolldown-runtime-Cyuzqnbw.js";import{St as n,yt as r}from"./vendor-styling-Bcgpimp9.js";import{U as i,p as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as o}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{it as s,rt as c,st as l}from"./active-backend-context-B9942JGX.js";import{t as u,z as d}from"./utils-qjs_KuS4.js";import{n as f}from"./use-settings-BKpkUS4y.js";import{t as p}from"./use-save-settings-BZK7zVsK.js";import"./form-control-classes-CSPevi7c.js";import{t as m}from"./brand-button-CQO8oqVo.js";import{t as h}from"./settings-input-BjW_zyTN.js";import{c as g,i as _,n as v,o as y,s as ee,t as te}from"./acp-providers-BHKZvEm5.js";import{_ as ne,g as re,h as ie,m as ae,n as oe,o as se}from"./schema-field-CZSs0hQP.js";import{t as b}from"./settings-dropdown-input-Dx6vlkgf.js";import{r as x}from"./typography-C6fuRTTT.js";import{t as ce}from"./settings-switch-UNSf8K8I.js";import{a as S,i as le,n as C,r as w,t as ue}from"./use-acp-credential-form-CuBXKNvP.js";var T=e(n(),1),E=r();function de({form:e,providerKey:t}){let{t:n}=o(`openhands`),{fields:r,values:i,setValue:a,secretExists:s,conflicts:c}=e,{status:l,isChecking:u}=C(t),f=g(t)??t;return r.length===0?null:(0,E.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,E.jsx)(x.Text,{className:`text-sm font-medium text-white`,children:n(d.SETTINGS$ACP_CREDENTIALS_TITLE)}),(0,E.jsx)(x.Text,{className:`text-xs text-[#717888]`,children:n(d.SETTINGS$ACP_CREDENTIALS_DESCRIPTION)})]}),(0,E.jsx)(le,{status:l,isChecking:u,providerName:f,testIdPrefix:`settings-acp-auth`}),(0,E.jsx)(`div`,{className:`flex flex-col gap-5`,children:r.map(e=>(0,E.jsx)(w,{field:e,value:i[e.name]??``,onChange:t=>a(e.name,t),alreadySet:s(e.name),testId:`settings-acp-secret-${e.name}`,showOptionalTag:!0},e.name))}),(0,E.jsx)(S,{conflicts:c})]})}var D=t(((e,t)=>{var n=[`||`,`&&`,`;;`,`|&`,`<(`,`<<<`,`>>`,`>&`,`<&`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|]/g;t.exports=function(e){return e.map(function(e){if(e===``)return`''`;if(e&&typeof e==`object`){if(`op`in e&&e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(i,`\\$&`)}if(`op`in e&&typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(`comment`in e&&typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,`$1\\$2`)}).join(` `)}})),O=t(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`"((\\\\"|[^"])*?)"`,o=`'((\\\\'|[^'])*?)'`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function _(e,t,d){d||={};var f=d.escape||`\\`,p=`(\\`+f+`['"`+i+`]|[^\\s'"`+i+`])+`,m=h(e,new RegExp([`(`+n+`)`,`(`+p+`|`+a+`|`+o+`)+`].join(`|`),`g`));if(m.length===0)return[];t||={};var _=!1;return m.map(function(n){var i=n[0];if(!i||_)return;if(r.test(i))return{op:i};var a=!1,o=!1,d=``,p=!1,m;function h(){m+=1;var e,n,r=i.charAt(m);if(r===`{`){if(m+=1,i.charAt(m)===`}`)throw Error(`Bad substitution: `+i.slice(m-2,m+1));if(e=i.indexOf(`}`,m),e<0)throw Error(`Bad substitution: `+i.slice(m));n=i.slice(m,e),m=e}else if(/[*@#?$!_-]/.test(r))n=r,m+=1;else{var a=i.slice(m);e=a.match(/[^\w\d_]/),e?(n=a.slice(0,e.index),m+=e.index-1):(n=a,m=i.length)}return g(t,``,n)}for(m=0;m<i.length;m++){var v=i.charAt(m);if(p||=!a&&(v===`*`||v===`?`),o)d+=v,o=!1;else if(a)v===a?a=!1:a==c?d+=v:v===f?(m+=1,v=i.charAt(m),v===l||v===f||v===u?d+=v:d+=f+v):v===u?d+=h():d+=v;else if(v===l||v===c)a=v;else if(r.test(v))return{op:i};else if(s.test(v)){_=!0;var y={comment:e.slice(n.index+m+1)};return d.length?[d,y]:[y]}else v===f?o=!0:v===u?d+=h():d+=v}return p?{op:`glob`,pattern:d}:d}).reduce(function(e,t){return t===void 0||[].concat(t).forEach(function(t){e[e.length]=t}),e},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e[e.length]=t,e;var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?(e[e.length]=n[0],e):(n.filter(Boolean).forEach(function(t){e[e.length]=m.test(t)?JSON.parse(t.split(d)[1]):t}),e)},[]):r}})),{quote:k}=e(t((e=>{e.quote=D(),e.parse=O()}))(),1);function A(e){let t=[],n=0,r=``,i=!1;for(;n<e.length;){let a=e[n];if(a===` `||a===` `||a===`
1
+ import{a as e,t}from"./rolldown-runtime-Cyuzqnbw.js";import{St as n,yt as r}from"./vendor-styling-Bcgpimp9.js";import{U as i,p as a}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as o}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{it as s,rt as c,st as l}from"./active-backend-context-BlZPzZNU.js";import{t as u,z as d}from"./utils-qjs_KuS4.js";import{n as f}from"./use-settings-DBI44RnH.js";import{t as p}from"./use-save-settings-BRh9p_fv.js";import"./form-control-classes-CSPevi7c.js";import{t as m}from"./brand-button-CQO8oqVo.js";import{t as h}from"./settings-input-BjW_zyTN.js";import{c as g,i as _,n as v,o as y,s as ee,t as te}from"./acp-providers-BHKZvEm5.js";import{_ as ne,g as re,h as ie,m as ae,n as oe,o as se}from"./schema-field-CV6bFnoL.js";import{t as b}from"./settings-dropdown-input-Dx6vlkgf.js";import{r as x}from"./typography-C6fuRTTT.js";import{t as ce}from"./settings-switch-UNSf8K8I.js";import{a as S,i as le,n as C,r as w,t as ue}from"./use-acp-credential-form-B0_pZ_uS.js";var T=e(n(),1),E=r();function de({form:e,providerKey:t}){let{t:n}=o(`openhands`),{fields:r,values:i,setValue:a,secretExists:s,conflicts:c}=e,{status:l,isChecking:u}=C(t),f=g(t)??t;return r.length===0?null:(0,E.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,E.jsx)(x.Text,{className:`text-sm font-medium text-white`,children:n(d.SETTINGS$ACP_CREDENTIALS_TITLE)}),(0,E.jsx)(x.Text,{className:`text-xs text-[#717888]`,children:n(d.SETTINGS$ACP_CREDENTIALS_DESCRIPTION)})]}),(0,E.jsx)(le,{status:l,isChecking:u,providerName:f,testIdPrefix:`settings-acp-auth`}),(0,E.jsx)(`div`,{className:`flex flex-col gap-5`,children:r.map(e=>(0,E.jsx)(w,{field:e,value:i[e.name]??``,onChange:t=>a(e.name,t),alreadySet:s(e.name),testId:`settings-acp-secret-${e.name}`,showOptionalTag:!0},e.name))}),(0,E.jsx)(S,{conflicts:c})]})}var D=t(((e,t)=>{var n=[`||`,`&&`,`;;`,`|&`,`<(`,`<<<`,`>>`,`>&`,`<&`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|]/g;t.exports=function(e){return e.map(function(e){if(e===``)return`''`;if(e&&typeof e==`object`){if(`op`in e&&e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(i,`\\$&`)}if(`op`in e&&typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(`comment`in e&&typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,`$1\\$2`)}).join(` `)}})),O=t(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`"((\\\\"|[^"])*?)"`,o=`'((\\\\'|[^'])*?)'`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function _(e,t,d){d||={};var f=d.escape||`\\`,p=`(\\`+f+`['"`+i+`]|[^\\s'"`+i+`])+`,m=h(e,new RegExp([`(`+n+`)`,`(`+p+`|`+a+`|`+o+`)+`].join(`|`),`g`));if(m.length===0)return[];t||={};var _=!1;return m.map(function(n){var i=n[0];if(!i||_)return;if(r.test(i))return{op:i};var a=!1,o=!1,d=``,p=!1,m;function h(){m+=1;var e,n,r=i.charAt(m);if(r===`{`){if(m+=1,i.charAt(m)===`}`)throw Error(`Bad substitution: `+i.slice(m-2,m+1));if(e=i.indexOf(`}`,m),e<0)throw Error(`Bad substitution: `+i.slice(m));n=i.slice(m,e),m=e}else if(/[*@#?$!_-]/.test(r))n=r,m+=1;else{var a=i.slice(m);e=a.match(/[^\w\d_]/),e?(n=a.slice(0,e.index),m+=e.index-1):(n=a,m=i.length)}return g(t,``,n)}for(m=0;m<i.length;m++){var v=i.charAt(m);if(p||=!a&&(v===`*`||v===`?`),o)d+=v,o=!1;else if(a)v===a?a=!1:a==c?d+=v:v===f?(m+=1,v=i.charAt(m),v===l||v===f||v===u?d+=v:d+=f+v):v===u?d+=h():d+=v;else if(v===l||v===c)a=v;else if(r.test(v))return{op:i};else if(s.test(v)){_=!0;var y={comment:e.slice(n.index+m+1)};return d.length?[d,y]:[y]}else v===f?o=!0:v===u?d+=h():d+=v}return p?{op:`glob`,pattern:d}:d}).reduce(function(e,t){return t===void 0||[].concat(t).forEach(function(t){e[e.length]=t}),e},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e[e.length]=t,e;var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?(e[e.length]=n[0],e):(n.filter(Boolean).forEach(function(t){e[e.length]=m.test(t)?JSON.parse(t.split(d)[1]):t}),e)},[]):r}})),{quote:k}=e(t((e=>{e.quote=D(),e.parse=O()}))(),1);function A(e){let t=[],n=0,r=``,i=!1;for(;n<e.length;){let a=e[n];if(a===` `||a===` `||a===`
2
2
  `||a===`\r`){i&&=(t.push(r),r=``,!1),n+=1;continue}if(a===`'`){for(i=!0,n+=1;n<e.length&&e[n]!==`'`;)r+=e[n],n+=1;n<e.length&&(n+=1);continue}if(a===`"`){for(i=!0,n+=1;n<e.length&&e[n]!==`"`;){if(e[n]===`\\`&&n+1<e.length){let t=e[n+1];if(t===`"`||t===`\\`){r+=t,n+=2;continue}}r+=e[n],n+=1}n<e.length&&(n+=1);continue}if(a===`\\`&&n+1<e.length){i=!0,r+=e[n+1],n+=2;continue}i=!0,r+=a,n+=1}return i&&t.push(r),t}var fe=/[\s"'\\$`&|;<>(){}*?#!~[\]]/;function j(e){return e.map(e=>fe.test(e)||e===``?k([e]):e).join(` `)}var M={hideTitle:!0},pe=`enable_sub_agents`,me=`tool_concurrency_limit`,he=`npx -y <package-name>`,N=`__custom_model__`;function ge(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function P(e,t){let n=A(e).join(` `);for(let e of t)if(n===e.default_command.join(` `))return e.key;return te}function _e(e){return e?.find(e=>e.key===pe)}function ve(e,t){return typeof e==`boolean`?e:t?.default===!0}function ye(e,t){return e?.available_models?.some(({id:e})=>e===t.trim())??!1}function be(e){let{isAcp:t,selectedPreset:n,isDefaultProviderCommand:r,commandTokens:i,acpModel:a,subAgentsEnabled:o,toolConcurrencyField:s,toolConcurrency:c}=e;if(t){let e=r&&n!==`custom`;return{agent_kind:`acp`,acp_server:n,acp_model:a.trim()||null,acp_command:e?null:j(i)||null,acp_args:null}}let l={agent_kind:`openhands`,enable_sub_agents:o};if(s){let e=se(s,c),t=typeof s.default==`number`?s.default:1;l.tool_concurrency_limit=e==null?t:Number(e)}return l}function F({embedded:e=!1,agentSettingsOverride:t=null,onSaveControlChange:n}={}){let{t:r}=o(`openhands`),{data:i,isLoading:a}=f(),g=t??i?.agent_settings??null,{mutate:S,isPending:le}=p(),{data:C}=ne(i?.agent_settings_schema),w=T.useMemo(()=>C?.sections.flatMap(e=>e.fields),[C]),D=_e(w),O=T.useMemo(()=>ve(g?.[pe],D),[D,g]),[k,fe]=(0,T.useState)(O),M=w?.find(e=>e.key===me),F=T.useMemo(()=>{if(!M)return``;let e=g?.[me];return ae(M,e)},[M,g]),[I,xe]=(0,T.useState)(F),[L,R]=(0,T.useState)(`openhands`),[z,B]=(0,T.useState)(``),[V,H]=(0,T.useState)(``),[Se,U]=(0,T.useState)(!1),[Ce,W]=(0,T.useState)(!1),G=L===`acp`?P(z,v):null,K=ue(G&&G!==`custom`?G:null),we=(0,T.useRef)(null),q=(0,T.useRef)(null),J=(0,T.useRef)(``);(0,T.useEffect)(()=>{let e=t??i?.agent_settings??null;if(!e&&!i)return;let n=t??i;if(we.current!==n){if(we.current=n,e?.agent_kind===`acp`){R(`acp`);let t=e?.acp_server,n=typeof t==`string`?t:void 0,r=ee(n),i=ge(e?.acp_command),a=[...i.length>0?i:r?.default_command??[],...ge(e?.acp_args)],o=a.length>0?j(a):``;B(o),q.current=n??null,J.current=o;let s=e?.acp_model,c=typeof s==`string`?s.trim():``;H(c||y(n)||``),U(!!c&&(!r||!ye(r,c)))}else R(`openhands`),B(``),H(``),q.current=null,J.current=``,U(!1);W(!1)}},[i,t]),(0,T.useEffect)(()=>{fe(O)},[O]),(0,T.useEffect)(()=>{xe(F)},[F]);let Te=(0,T.useRef)(()=>({agent_kind:`openhands`,enable_sub_agents:!1})),Ee=(0,T.useCallback)(()=>Te.current(),[]),Y=(0,T.useRef)(K);Y.current=K;let De=(0,T.useCallback)(e=>Y.current.save(e),[]),Oe=(0,T.useCallback)(()=>Y.current.reset(),[]),ke=L===`acp`&&A(z).length===0,Ae=K.isDirty;if((0,T.useEffect)(()=>{!e||!n||n({agentType:L,isValid:!ke,buildAgentProfileFields:Ee,credentials:{isDirty:Ae,save:De,reset:Oe}})},[e,n,L,ke,Ae,Ee,De,Oe]),a)return null;let X=L===`acp`,Z=A(z),je=X&&Z.length===0,Q=P(z,v),$=ee(Q),Me=$?.available_models??[],Ne=Me.length>0,Pe=ye($,V),Fe=Se||!Pe?N:V,Ie=!!$&&Z.join(` `)===$.default_command.join(` `),Le=j(v[0]?.default_command??[])||he;Te.current=()=>be({isAcp:X,selectedPreset:Q,isDefaultProviderCommand:Ie,commandTokens:Z,acpModel:V,subAgentsEnabled:k,toolConcurrencyField:M,toolConcurrency:I});let Re=Ce||!X&&(k!==O||I!==F),ze=K.isDirty,Be=Re||ze,Ve=le||K.isSaving,He=async()=>{if(K.isDirty){if(!await K.save({silent:Re}))return;K.reset()}if(Re)if(X){let e=!!($&&Ie),t=q.current,n=z===J.current,i=!!t&&t!==`custom`&&!v.some(e=>e.key===t),a=X&&n&&i,o=_(a?t:$&&Ie?$.key:te,{command:e?[]:Z,model:V.trim()||void 0,allowUnknownServer:a});if(!o)return;S({agent_settings_diff:o},{onError:e=>{c(l(e)||r(d.ERROR$GENERIC))},onSuccess:()=>{s(r(d.SETTINGS$SAVED)),W(!1)}})}else{let e={agent_kind:`openhands`,enable_sub_agents:k};if(M){let t;try{t=se(M,I)}catch(e){c(e instanceof Error?e.message:r(d.ERROR$GENERIC));return}t!=null&&(e[me]=t)}S({agent_settings_diff:e},{onError:e=>{c(l(e)||r(d.ERROR$GENERIC))},onSuccess:()=>{s(r(d.SETTINGS$SAVED)),W(!1)}})}},Ue=D?re(r,D.key,D.label):r(d.SCHEMA$ENABLE_SUB_AGENTS$LABEL),We=D?ie(r,D.key,D.description):r(d.SCHEMA$ENABLE_SUB_AGENTS$DESCRIPTION);return(0,E.jsxs)(`div`,{"data-testid":`agent-settings-screen`,className:`flex flex-col gap-6 pb-8 max-w-2xl`,children:[!e&&(0,E.jsxs)(`div`,{children:[(0,E.jsx)(x.H2,{className:`mb-2`,children:r(d.SETTINGS$NAV_AGENT)}),(0,E.jsx)(x.Paragraph,{className:`text-sm text-[#A3A3A3]`,children:r(d.SETTINGS$AGENT_PAGE_DESCRIPTION)})]}),(0,E.jsx)(b,{testId:`agent-type-selector`,name:`agent-type`,label:r(d.SETTINGS$NAV_AGENT),items:[{key:`openhands`,label:r(d.SETTINGS$AGENT_TYPE_OPENHANDS)},{key:`acp`,label:r(d.SETTINGS$AGENT_TYPE_ACP)}],selectedKey:L,onSelectionChange:e=>{if(!e)return;let t=e;if(R(t),t===`acp`&&!z){let e=v[0];e&&(B(j(e.default_command)),H(y(e.key)??``),U(!1))}else t===`openhands`&&U(!1);W(!0)}}),!X&&(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(ce,{testId:`agent-settings-enable-sub-agents`,isToggled:k,onToggle:e=>{fe(e)},children:Ue}),We?(0,E.jsx)(x.Paragraph,{className:u(`pl-12`,`text-tertiary-alt text-xs leading-5`),children:We}):null]}),!X&&M?(0,E.jsx)(oe,{field:M,value:I,isDisabled:Ve,onChange:xe}):null,X&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(b,{testId:`agent-preset-selector`,name:`agent-preset`,label:r(d.SETTINGS$AGENT_PRESET),items:[...v.map(e=>({key:e.key,label:e.display_name})),{key:`custom`,label:r(d.SETTINGS$AGENT_PRESET_CUSTOM)}],selectedKey:Q,onSelectionChange:e=>{if(!e)return;let t=String(e),n=ee(t);n?(B(j(n.default_command)),H(y(t)??``),U(!1)):t===`custom`&&(B(``),H(``),U(!0)),W(!0)}}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,E.jsx)(x.Text,{className:`text-sm`,children:r(d.SETTINGS$AGENT_COMMAND)}),(0,E.jsx)(`textarea`,{"data-testid":`agent-command-input`,className:`bg-tertiary border border-[#717888] rounded-sm p-2 text-sm font-mono text-white placeholder:text-[#717888] min-h-[60px] resize-y focus:outline-none focus:border-white`,value:z,placeholder:Le,onChange:e=>{let t=e.target.value,n=P(z,v),r=P(t,v);r!==n&&(H(y(r)??``),U(!1)),B(t),W(!0)}}),(0,E.jsx)(x.Text,{className:`text-xs text-[#717888]`,children:r(d.SETTINGS$AGENT_COMMAND_HINT)})]}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[Ne&&(0,E.jsx)(b,{testId:`agent-model-selector`,name:`agent-model`,label:r(d.SETTINGS$AGENT_MODEL),items:[...Me.map(e=>({key:e.id,label:e.label})),{key:N,label:r(d.SETTINGS$AGENT_PRESET_CUSTOM)}],selectedKey:Fe,onSelectionChange:e=>{if(!e)return;let t=String(e);t===N?(U(!0),H(``)):(U(!1),H(t)),W(!0)}}),Fe===N&&(0,E.jsx)(h,{testId:`agent-model-input`,label:r(Ne?d.SETTINGS$AGENT_CUSTOM_MODEL:d.SETTINGS$AGENT_MODEL),type:`text`,className:`w-full`,value:V,showOptionalTag:!0,onChange:e=>{H(e),W(!0)}}),(0,E.jsx)(x.Text,{className:`text-xs text-[#717888]`,children:r(d.SETTINGS$AGENT_MODEL_HINT)})]})]}),X&&Q!==`custom`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`hr`,{className:`border-[#3D4046]`}),(0,E.jsx)(de,{form:K,providerKey:Q})]}),!e&&(0,E.jsx)(`div`,{children:(0,E.jsx)(m,{testId:`agent-save-button`,type:`button`,variant:`primary`,isDisabled:Ve||!Be||je,onClick:He,children:r(Ve?d.SETTINGS$SAVING:d.SETTINGS$SAVE_CHANGES)})})]})}var I=i(function(){return(0,E.jsx)(a,{to:`/settings/agents`,replace:!0})});export{A as i,I as n,M as r,F as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t}from"./agent-settings-BIOsUglV.js";export{e as default,t as handle};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{t as r}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{d as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{C as a,D as o,r as s,z as c}from"./active-backend-context-B9942JGX.js";import{t as l,z as u}from"./utils-qjs_KuS4.js";import{r as d,t as f}from"./modal-body-DQhiw-AR.js";import{t as p}from"./brand-button-CQO8oqVo.js";import{n as m,o as h}from"./backend-form-modal-C0CIsQvd.js";var g=e(t(),1),_=n();function v(){let{t:e}=r(`openhands`),{active:t,addBackend:n,updateBackend:v}=s(),y=window.location.origin,[b,x]=g.useState(!1),[S,C]=g.useState(`idle`),[w,T]=g.useState(null),E=g.useCallback(async r=>{x(!0),C(`idle`),T(null);try{await new i(o({host:r.host,sessionApiKey:r.apiKey,timeout:5e3})).getSettings(),C(`success`),c(t.backend)?n(r):v(t.backend.id,r),window.location.reload()}catch(t){if(C(`error`),a(t,401))T(e(u.AUTH$INVALID_KEY));else{let n=t instanceof Error?t.message:String(t);T(`${e(u.AUTH$CONNECTION_FAILED)}${n?`: ${n}`:``}`)}x(!1)}},[t.backend,n,v,e]);return(0,_.jsx)(`div`,{"data-testid":`api-key-entry-screen`,className:`flex min-h-screen items-center justify-center bg-base px-6`,children:(0,_.jsxs)(`div`,{className:l(`relative rounded-xl border border-[var(--oh-border)] bg-base-secondary`,d(`md`),f),children:[(0,_.jsx)(`div`,{className:`px-6 pt-6 pb-2 pr-12`,children:(0,_.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(u.BACKEND$ADD_TITLE)})}),(0,_.jsx)(`div`,{className:`px-6 pb-6 pt-2`,children:(0,_.jsx)(m,{mode:`add`,backend:{...t.backend,host:y,apiKey:``,name:``},onSubmitted:()=>{},testIdRoot:`api-key-entry`,hostReadOnly:!0,requireApiKey:!0,onSubmitOverride:E,renderActions:({canSubmit:t,testIdRoot:n})=>(0,_.jsxs)(_.Fragment,{children:[S!==`idle`&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,_.jsx)(h,{isConnected:S===`success`}),(0,_.jsx)(`span`,{"data-testid":`${n}-status`,className:S===`error`?`text-red-400`:`text-green-400`,children:S===`error`?w:e(u.ONBOARDING$BACKEND_STATUS_CONNECTED)})]}),(0,_.jsx)(p,{type:`submit`,variant:`secondary`,isDisabled:!t||b,testId:`${n}-submit`,className:`w-full text-center`,children:e(b?u.ONBOARDING$BACKEND_STATUS_CHECKING:u.BACKEND$CONNECT)})]})})})]})})}export{v as default};
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{t as r}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{d as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{C as a,D as o,r as s,z as c}from"./active-backend-context-BlZPzZNU.js";import{t as l,z as u}from"./utils-qjs_KuS4.js";import{r as d,t as f}from"./modal-body-DQhiw-AR.js";import{t as p}from"./brand-button-CQO8oqVo.js";import{n as m,o as h}from"./backend-form-modal-Ce-KRHOJ.js";var g=e(t(),1),_=n();function v(){let{t:e}=r(`openhands`),{active:t,addBackend:n,updateBackend:v}=s(),y=window.location.origin,[b,x]=g.useState(!1),[S,C]=g.useState(`idle`),[w,T]=g.useState(null),E=g.useCallback(async r=>{x(!0),C(`idle`),T(null);try{await new i(o({host:r.host,sessionApiKey:r.apiKey,timeout:5e3})).getSettings(),C(`success`),c(t.backend)?n(r):v(t.backend.id,r),window.location.reload()}catch(t){if(C(`error`),a(t,401))T(e(u.AUTH$INVALID_KEY));else{let n=t instanceof Error?t.message:String(t);T(`${e(u.AUTH$CONNECTION_FAILED)}${n?`: ${n}`:``}`)}x(!1)}},[t.backend,n,v,e]);return(0,_.jsx)(`div`,{"data-testid":`api-key-entry-screen`,className:`flex min-h-screen items-center justify-center bg-base px-6`,children:(0,_.jsxs)(`div`,{className:l(`relative rounded-xl border border-[var(--oh-border)] bg-base-secondary`,d(`md`),f),children:[(0,_.jsx)(`div`,{className:`px-6 pt-6 pb-2 pr-12`,children:(0,_.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(u.BACKEND$ADD_TITLE)})}),(0,_.jsx)(`div`,{className:`px-6 pb-6 pt-2`,children:(0,_.jsx)(m,{mode:`add`,backend:{...t.backend,host:y,apiKey:``,name:``},onSubmitted:()=>{},testIdRoot:`api-key-entry`,hostReadOnly:!0,requireApiKey:!0,onSubmitOverride:E,renderActions:({canSubmit:t,testIdRoot:n})=>(0,_.jsxs)(_.Fragment,{children:[S!==`idle`&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,_.jsx)(h,{isConnected:S===`success`}),(0,_.jsx)(`span`,{"data-testid":`${n}-status`,className:S===`error`?`text-red-400`:`text-green-400`,children:S===`error`?w:e(u.ONBOARDING$BACKEND_STATUS_CONNECTED)})]}),(0,_.jsx)(p,{type:`submit`,variant:`secondary`,isDisabled:!t||b,testId:`${n}-submit`,className:`w-full text-center`,children:e(b?u.ONBOARDING$BACKEND_STATUS_CHECKING:u.BACKEND$CONNECT)})]})})})]})})}export{v as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{U as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as i}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{ft as a,it as o,n as s,rt as c,st as l}from"./active-backend-context-B9942JGX.js";import{z as u}from"./utils-qjs_KuS4.js";import{f as d}from"./telemetry-B-2fXtqV.js";import{t as f}from"./settings-Chfn5xTD.js";import{n as p}from"./use-settings-BKpkUS4y.js";import{t as m}from"./use-save-settings-BZK7zVsK.js";import{t as h}from"./brand-button-CQO8oqVo.js";import{i as g,n as _,r as v,t as y}from"./color-themes-DTj5Ylbr.js";import{t as b}from"./navigation-link-Bxmn-pCs.js";import{t as x}from"./settings-input-BjW_zyTN.js";import{t as S}from"./use-llm-profiles-Ci3zAVzV.js";import{t as C}from"./settings-dropdown-input-Dx6vlkgf.js";import{n as w,t as T}from"./switch-skeleton-BQoOhQTB.js";import{t as E}from"./settings-switch-UNSf8K8I.js";var D=e(t(),1),O=n();function k({defaultKey:e,onChange:t,name:n}){let{t:r}=i(`openhands`);return(0,O.jsx)(C,{testId:n,name:n,onInputChange:t,label:r(u.SETTINGS$LANGUAGE),items:a.map(e=>({key:e.value,label:e.label})),defaultSelectedKey:e,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function A(){let{t:e}=i(`openhands`),t=D.useCallback(e=>{if(!e)return;let t=e;_(t),v(t)},[]);return(0,O.jsx)(C,{testId:`color-theme-input`,name:`color-theme-input`,label:e(u.SETTINGS$COLOR_THEME),items:y.map(e=>({key:e.key,label:e.label})),defaultSelectedKey:g(),onSelectionChange:t,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function j(){return(0,O.jsxs)(`div`,{"data-testid":`app-settings-skeleton`,className:`px-11 py-9 flex flex-col gap-6`,children:[(0,O.jsx)(w,{}),(0,O.jsx)(T,{}),(0,O.jsx)(T,{})]})}var M=`__automatic__`;function N(){let{t:e}=i(`openhands`),{mutate:t,isPending:n}=m(),{data:r,isLoading:g}=p(),_=s().backend.kind===`cloud`,{data:v,isLoading:y}=S(),[w,T]=D.useState(!1),[N,P]=D.useState(!1),[F,I]=D.useState(!1),[L,R]=D.useState(!1),[z,B]=D.useState(!1),[V,H]=D.useState(void 0),U=D.useMemo(()=>{let e=r?.title_llm_profile??null;return!e||!v||v.profiles.some(t=>t.name===e)?e:null},[v,r?.title_llm_profile]),W=V===void 0?U:V,G=D.useMemo(()=>[{key:M,label:e(u.SETTINGS$TITLE_GENERATION_AUTOMATIC)},...v?.profiles.map(t=>({key:t.name,label:t.model?e(u.SETTINGS$TITLE_GENERATION_PROFILE_OPTION,{name:t.name,model:t.model}):t.name}))??[]],[v?.profiles,e]),K=n=>{let r=n.get(`language-input`)?.toString(),i=a.find(({label:e})=>e===r)?.value||f.language,s=_?!0:n.get(`enable-analytics-switch`)?.toString()===`on`,p=n.get(`enable-sound-notifications-switch`)?.toString()===`on`,m=n.get(`git-user-name-input`)?.toString()||f.git_user_name,h=n.get(`git-user-email-input`)?.toString()||f.git_user_email;t({language:i,...!_&&{user_consents_to_analytics:s},enable_sound_notifications:p,git_user_name:m,git_user_email:h,title_llm_profile:W},{onSuccess:()=>{d(s?`granted`:`denied`),o(e(u.SETTINGS$SAVED))},onError:t=>{c(l(t)||e(u.ERROR$GENERIC))},onSettled:()=>{T(!1),P(!1),I(!1),R(!1),B(!1),H(void 0)}})},q=e=>{let t=a.find(({label:t})=>t===e)?.label,n=a.find(({value:e})=>e===r?.language)?.label;T(t!==n)},J=e=>{P(e!==(r?.user_consents_to_analytics??!0))},Y=e=>{I(e!==!!r?.enable_sound_notifications)},X=e=>{let t=r?.git_user_name;R(e!==t)},Z=e=>{let t=r?.git_user_email;B(e!==t)},Q=!w&&!N&&!F&&W===U&&!L&&!z,$=!r||g||y||n;return(0,O.jsxs)(`form`,{"data-testid":`app-settings-screen`,action:K,className:`flex flex-col gap-6`,children:[$&&(0,O.jsx)(j,{}),!$&&(0,O.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,O.jsx)(k,{name:`language-input`,defaultKey:r.language,onChange:q}),(0,O.jsx)(A,{}),(0,O.jsx)(E,{testId:`enable-analytics-switch`,name:_?void 0:`enable-analytics-switch`,defaultIsToggled:_?!0:r.user_consents_to_analytics??!0,isToggled:_?!0:void 0,isDisabled:_,onToggle:_?void 0:J,children:e(u.ANALYTICS$SEND_ANONYMOUS_DATA)}),(0,O.jsx)(E,{testId:`enable-sound-notifications-switch`,name:`enable-sound-notifications-switch`,defaultIsToggled:!!r.enable_sound_notifications,onToggle:Y,children:e(u.SETTINGS$SOUND_NOTIFICATIONS)}),(0,O.jsxs)(`div`,{className:`border-t border-[var(--oh-border)] pt-6 mt-2`,children:[(0,O.jsx)(`h3`,{className:`text-lg font-medium mb-2`,children:e(u.SETTINGS$CONVERSATION_TITLES)}),(0,O.jsx)(`p`,{className:`mb-4 text-sm leading-5 text-tertiary-light`,children:e(u.SETTINGS$TITLE_GENERATION_DESCRIPTION)}),(0,O.jsx)(C,{testId:`title-llm-profile-input`,name:`title-llm-profile-input`,label:e(u.SETTINGS$TITLE_GENERATION_MODEL),items:G,selectedKey:W??M,onSelectionChange:e=>{let t=e?.toString();H(!t||t===M?null:t)}}),(0,O.jsx)(b,{to:`/settings/llm`,className:`mt-3 inline-block text-sm text-primary hover:underline`,children:e(u.SETTINGS$MANAGE_LLM_PROFILES)})]}),(0,O.jsxs)(`div`,{className:`border-t border-[var(--oh-border)] pt-6 mt-2`,children:[(0,O.jsx)(`h3`,{className:`text-lg font-medium mb-2`,children:e(u.SETTINGS$GIT_SETTINGS)}),(0,O.jsx)(`p`,{className:`mb-4 text-sm leading-5 text-tertiary-light`,children:e(u.SETTINGS$GIT_SETTINGS_DESCRIPTION)}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,O.jsx)(x,{testId:`git-user-name-input`,name:`git-user-name-input`,type:`text`,label:e(u.SETTINGS$GIT_USERNAME),defaultValue:r.git_user_name||``,onChange:X,placeholder:e(u.SETTINGS$GIT_USERNAME_PLACEHOLDER),className:`w-full min-w-0`}),(0,O.jsx)(x,{testId:`git-user-email-input`,name:`git-user-email-input`,type:`email`,label:e(u.SETTINGS$GIT_EMAIL),defaultValue:r.git_user_email||``,onChange:Z,placeholder:e(u.SETTINGS$GIT_EMAIL_PLACEHOLDER),className:`w-full min-w-0`})]}),(0,O.jsx)(`div`,{className:`flex justify-start pt-4`,children:(0,O.jsxs)(h,{testId:`submit-button`,variant:`primary`,type:`submit`,isDisabled:n||Q,children:[!n&&e(u.SETTINGS$SAVE_CHANGES),n&&e(u.SETTINGS$SAVING)]})})]})]})]})}var P=r(N);export{P as default};
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{U as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as i}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{ft as a,it as o,n as s,rt as c,st as l}from"./active-backend-context-BlZPzZNU.js";import{z as u}from"./utils-qjs_KuS4.js";import{f as d}from"./telemetry-cmCL3o6Z.js";import{t as f}from"./settings-Chfn5xTD.js";import{n as p}from"./use-settings-DBI44RnH.js";import{t as m}from"./use-save-settings-BRh9p_fv.js";import{t as h}from"./brand-button-CQO8oqVo.js";import{i as g,n as _,r as v,t as y}from"./color-themes-DTj5Ylbr.js";import{t as b}from"./navigation-link-Bxmn-pCs.js";import{t as x}from"./settings-input-BjW_zyTN.js";import{t as S}from"./use-llm-profiles-BMQoc612.js";import{t as C}from"./settings-dropdown-input-Dx6vlkgf.js";import{n as w,t as T}from"./switch-skeleton-BQoOhQTB.js";import{t as E}from"./settings-switch-UNSf8K8I.js";var D=e(t(),1),O=n();function k({defaultKey:e,onChange:t,name:n}){let{t:r}=i(`openhands`);return(0,O.jsx)(C,{testId:n,name:n,onInputChange:t,label:r(u.SETTINGS$LANGUAGE),items:a.map(e=>({key:e.value,label:e.label})),defaultSelectedKey:e,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function A(){let{t:e}=i(`openhands`),t=D.useCallback(e=>{if(!e)return;let t=e;_(t),v(t)},[]);return(0,O.jsx)(C,{testId:`color-theme-input`,name:`color-theme-input`,label:e(u.SETTINGS$COLOR_THEME),items:y.map(e=>({key:e.key,label:e.label})),defaultSelectedKey:g(),onSelectionChange:t,isClearable:!1,wrapperClassName:`w-full min-w-0`})}function j(){return(0,O.jsxs)(`div`,{"data-testid":`app-settings-skeleton`,className:`px-11 py-9 flex flex-col gap-6`,children:[(0,O.jsx)(w,{}),(0,O.jsx)(T,{}),(0,O.jsx)(T,{})]})}var M=`__automatic__`;function N(){let{t:e}=i(`openhands`),{mutate:t,isPending:n}=m(),{data:r,isLoading:g}=p(),_=s().backend.kind===`cloud`,{data:v,isLoading:y}=S(),[w,T]=D.useState(!1),[N,P]=D.useState(!1),[F,I]=D.useState(!1),[L,R]=D.useState(!1),[z,B]=D.useState(!1),[V,H]=D.useState(void 0),U=D.useMemo(()=>{let e=r?.title_llm_profile??null;return!e||!v||v.profiles.some(t=>t.name===e)?e:null},[v,r?.title_llm_profile]),W=V===void 0?U:V,G=D.useMemo(()=>[{key:M,label:e(u.SETTINGS$TITLE_GENERATION_AUTOMATIC)},...v?.profiles.map(t=>({key:t.name,label:t.model?e(u.SETTINGS$TITLE_GENERATION_PROFILE_OPTION,{name:t.name,model:t.model}):t.name}))??[]],[v?.profiles,e]),K=n=>{let r=n.get(`language-input`)?.toString(),i=a.find(({label:e})=>e===r)?.value||f.language,s=_?!0:n.get(`enable-analytics-switch`)?.toString()===`on`,p=n.get(`enable-sound-notifications-switch`)?.toString()===`on`,m=n.get(`git-user-name-input`)?.toString()||f.git_user_name,h=n.get(`git-user-email-input`)?.toString()||f.git_user_email;t({language:i,...!_&&{user_consents_to_analytics:s},enable_sound_notifications:p,git_user_name:m,git_user_email:h,title_llm_profile:W},{onSuccess:()=>{d(s?`granted`:`denied`),o(e(u.SETTINGS$SAVED))},onError:t=>{c(l(t)||e(u.ERROR$GENERIC))},onSettled:()=>{T(!1),P(!1),I(!1),R(!1),B(!1),H(void 0)}})},q=e=>{let t=a.find(({label:t})=>t===e)?.label,n=a.find(({value:e})=>e===r?.language)?.label;T(t!==n)},J=e=>{P(e!==(r?.user_consents_to_analytics??!0))},Y=e=>{I(e!==!!r?.enable_sound_notifications)},X=e=>{let t=r?.git_user_name;R(e!==t)},Z=e=>{let t=r?.git_user_email;B(e!==t)},Q=!w&&!N&&!F&&W===U&&!L&&!z,$=!r||g||y||n;return(0,O.jsxs)(`form`,{"data-testid":`app-settings-screen`,action:K,className:`flex flex-col gap-6`,children:[$&&(0,O.jsx)(j,{}),!$&&(0,O.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,O.jsx)(k,{name:`language-input`,defaultKey:r.language,onChange:q}),(0,O.jsx)(A,{}),(0,O.jsx)(E,{testId:`enable-analytics-switch`,name:_?void 0:`enable-analytics-switch`,defaultIsToggled:_?!0:r.user_consents_to_analytics??!0,isToggled:_?!0:void 0,isDisabled:_,onToggle:_?void 0:J,children:e(u.ANALYTICS$SEND_ANONYMOUS_DATA)}),(0,O.jsx)(E,{testId:`enable-sound-notifications-switch`,name:`enable-sound-notifications-switch`,defaultIsToggled:!!r.enable_sound_notifications,onToggle:Y,children:e(u.SETTINGS$SOUND_NOTIFICATIONS)}),(0,O.jsxs)(`div`,{className:`border-t border-[var(--oh-border)] pt-6 mt-2`,children:[(0,O.jsx)(`h3`,{className:`text-lg font-medium mb-2`,children:e(u.SETTINGS$CONVERSATION_TITLES)}),(0,O.jsx)(`p`,{className:`mb-4 text-sm leading-5 text-tertiary-light`,children:e(u.SETTINGS$TITLE_GENERATION_DESCRIPTION)}),(0,O.jsx)(C,{testId:`title-llm-profile-input`,name:`title-llm-profile-input`,label:e(u.SETTINGS$TITLE_GENERATION_MODEL),items:G,selectedKey:W??M,onSelectionChange:e=>{let t=e?.toString();H(!t||t===M?null:t)}}),(0,O.jsx)(b,{to:`/settings/llm`,className:`mt-3 inline-block text-sm text-primary hover:underline`,children:e(u.SETTINGS$MANAGE_LLM_PROFILES)})]}),(0,O.jsxs)(`div`,{className:`border-t border-[var(--oh-border)] pt-6 mt-2`,children:[(0,O.jsx)(`h3`,{className:`text-lg font-medium mb-2`,children:e(u.SETTINGS$GIT_SETTINGS)}),(0,O.jsx)(`p`,{className:`mb-4 text-sm leading-5 text-tertiary-light`,children:e(u.SETTINGS$GIT_SETTINGS_DESCRIPTION)}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,O.jsx)(x,{testId:`git-user-name-input`,name:`git-user-name-input`,type:`text`,label:e(u.SETTINGS$GIT_USERNAME),defaultValue:r.git_user_name||``,onChange:X,placeholder:e(u.SETTINGS$GIT_USERNAME_PLACEHOLDER),className:`w-full min-w-0`}),(0,O.jsx)(x,{testId:`git-user-email-input`,name:`git-user-email-input`,type:`email`,label:e(u.SETTINGS$GIT_EMAIL),defaultValue:r.git_user_email||``,onChange:Z,placeholder:e(u.SETTINGS$GIT_EMAIL_PLACEHOLDER),className:`w-full min-w-0`})]}),(0,O.jsx)(`div`,{className:`flex justify-start pt-4`,children:(0,O.jsxs)(h,{testId:`submit-button`,variant:`primary`,type:`submit`,isDisabled:n||Q,children:[!n&&e(u.SETTINGS$SAVE_CHANGES),n&&e(u.SETTINGS$SAVING)]})})]})]})]})}var P=r(N);export{P as default};
@@ -1,2 +1,2 @@
1
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{B as r,U as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as a}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{j as o,v as s}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{t as c}from"./useQuery-B38jBavx.js";import{A as l,D as u,I as d,S as f,it as p,n as m,rt as h}from"./active-backend-context-B9942JGX.js";import{i as g,t as _,z as v}from"./utils-qjs_KuS4.js";import{t as y}from"./back-nav-button-Be_L157B.js";import{t as b}from"./proxy-CN3HaaOW.js";import{n as x,t as S}from"./use-tracking-De7qByD4.js";import{t as C}from"./use-settings-BKpkUS4y.js";import{r as w}from"./modal-classes-YaEEa5eZ.js";import{t as T}from"./brand-button-CQO8oqVo.js";import{n as E}from"./navigation-context-BOGzIng3.js";import{n as D}from"./use-create-conversation-DzcM79TE.js";import{t as O}from"./u-edit-809W9D9T.js";import{t as k}from"./terminal-cMS3RgVE.js";import{t as A}from"./use-user-conversation-43duhf7D.js";import{t as ee}from"./toggle-switch-BptY3XRG.js";import{t as j}from"./x-mark-jcTkPiOB.js";import{n as M,t as N}from"./link-external-BDBCz-_z.js";import{C as te,D as P,E as ne,O as re,S as ie,T as ae,_ as F,a as oe,b as se,c as I,d as L,f as R,g as ce,h as le,i as ue,l as de,m as z,o as fe,p as pe,r as me,s as he,t as ge,u as _e}from"./automation-export-Ca2ehC-k.js";import{t as B}from"./automation-BGP_I1RR.js";var V=e(t()),H=n();function U(){let{t:e}=a(`openhands`);return(0,H.jsx)(y,{to:`/automations`,children:e(v.AUTOMATIONS$DETAIL$BACK_TO_LIST)})}var W=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function ve({active:e}){let{t}=a(`openhands`);return(0,H.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:_(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e?`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`:`bg-surface-raised text-muted`),children:t(e?v.AUTOMATIONS$DETAIL$ACTIVE:v.AUTOMATIONS$DETAIL$INACTIVE)})}function ye({automation:e,onToggle:t,onEdit:n,onDelete:r,onExport:i,onDownloadTarball:o,onRunNow:s,isRunningNow:c=!1}){let{t:l}=a(`openhands`),u=ce(`manage_automations`),d=[...n?[{label:l(v.AUTOMATIONS$EDIT),icon:(0,H.jsx)(O,{className:`size-4`}),onClick:n}]:[],{label:e.enabled?l(v.AUTOMATIONS$TURN_OFF):l(v.AUTOMATIONS$TURN_ON),icon:(0,H.jsx)(_e,{className:`size-4`}),onClick:t},{label:l(v.AUTOMATIONS$EXPORT),icon:(0,H.jsx)(W,{className:`size-4`}),onClick:i},{label:l(v.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,H.jsx)(W,{className:`size-4`}),onClick:o},{label:l(v.AUTOMATIONS$DELETE),icon:(0,H.jsx)(de,{className:`size-4`}),onClick:r}];return(0,H.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,H.jsx)(ve,{active:e.enabled})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&s&&(0,H.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:c||!e.enabled,onClick:s,children:[(0,H.jsx)(le,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),l(c?v.AUTOMATIONS$STARTING:v.AUTOMATIONS$RUN_NOW)]}),u&&(0,H.jsx)(ee,{enabled:e.enabled,label:e.enabled?l(v.AUTOMATIONS$TURN_OFF):l(v.AUTOMATIONS$TURN_ON),onToggle:t}),u&&(0,H.jsx)(F,{items:d})]})]})})}function G({icon:e,title:t,children:n}){return(0,H.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,H.jsx)(`span`,{className:`size-4 text-muted`,children:e}),(0,H.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t})]}),(0,H.jsx)(`div`,{className:`px-5 py-5`,children:n})]})}var be=240,xe=`max-h-60`;function Se({prompt:e}){let{t}=a(`openhands`),[n,r]=V.useState(!1),[i,o]=V.useState(!1),s=V.useRef(null),c=i&&!n;return V.useLayoutEffect(()=>{let e=s.current;if(!e)return;let t=()=>{o(e.scrollHeight>be)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,H.jsx)(G,{icon:(0,H.jsx)(k,{className:`size-4`}),title:t(v.AUTOMATIONS$DETAIL$PROMPT),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`p`,{ref:s,className:_(`whitespace-pre-wrap text-sm leading-6 text-content`,c&&_(xe,`overflow-hidden`)),"data-testid":`automation-prompt-content`,children:e}),c?(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-[var(--oh-surface)] to-transparent`,"aria-hidden":!0,"data-testid":`automation-prompt-fade`}):null]}),i?(0,H.jsx)(`button`,{type:`button`,className:`self-start cursor-pointer text-sm font-normal text-[var(--oh-muted)] hover:text-white`,onClick:()=>r(e=>!e),"data-testid":`automation-prompt-toggle`,children:t(n?v.COMMON$VIEW_LESS:v.COMMON$VIEW_MORE)}):null]})})}var Ce=e=>(0,H.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.204-.107-.397.165-.71.505-.78.929l-.15.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z`}),(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`})]}),we=e=>(0,H.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 3v12m0 0a3 3 0 1 0 3 3M6 15a3 3 0 0 1 3-3h6a3 3 0 0 0 3-3V3m0 0a3 3 0 1 0 0 0`}),(0,H.jsx)(`circle`,{cx:6,cy:3,r:2}),(0,H.jsx)(`circle`,{cx:18,cy:3,r:2}),(0,H.jsx)(`circle`,{cx:9,cy:18,r:2})]}),K=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),q=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),Te=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function J({icon:e,label:t,children:n}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`size-3.5 text-muted`,children:e}),(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:t})]}),(0,H.jsx)(`div`,{className:`text-sm text-content`,children:n})]})}function Ee({branch:e}){return(0,H.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}var Y=60;function De({filter:e}){let{t}=a(`openhands`),[n,r]=(0,V.useState)(!1),i=e.length>Y;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`font-mono break-all`,children:i&&!n?`${e.slice(0,Y)}…`:e}),i&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`text-xs text-muted hover:text-content self-start`,children:t(n?v.SETTINGS$SKILLS_SHOW_LESS:v.SETTINGS$SKILLS_SHOW_MORE)})]})}function Oe({automation:e}){let{t}=a(`openhands`),n=e.trigger.type===`event`,r=e.trigger.schedule??``;e.trigger.schedule_human&&(r=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let i=t(n?v.AUTOMATIONS$DETAIL$TRIGGER_EVENT:v.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);return(0,H.jsx)(G,{icon:(0,H.jsx)(Ce,{className:`size-4`}),title:t(v.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,H.jsx)(J,{icon:(0,H.jsx)(we,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,H.jsx)(Ee,{branch:e.branch})]})}),(0,H.jsx)(J,{icon:(0,H.jsx)(K,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$TRIGGER),children:i}),!n&&(0,H.jsx)(J,{icon:(0,H.jsx)(q,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$SCHEDULE),children:r}),n&&e.trigger.source&&(0,H.jsx)(J,{icon:(0,H.jsx)(pe,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$EVENT_SOURCE),children:e.trigger.source}),n&&e.trigger.on&&(0,H.jsx)(J,{icon:(0,H.jsx)(N,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$EVENT_TYPE),children:L(e.trigger.on)}),n&&e.trigger.filter&&(0,H.jsx)(J,{icon:(0,H.jsx)(M,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$EVENT_FILTER),children:(0,H.jsx)(De,{filter:e.trigger.filter})}),(0,H.jsx)(J,{icon:(0,H.jsx)(R,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$MODEL),children:e.model??t(v.COMMON$ACTIVE_PROFILE)}),e.notification&&(0,H.jsx)(J,{icon:(0,H.jsx)(Te,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var ke=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function Ae({name:e}){return(0,H.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function je({plugins:e}){let{t}=a(`openhands`);return(0,H.jsx)(G,{icon:(0,H.jsx)(ke,{className:`size-4`}),title:t(v.AUTOMATIONS$DETAIL$PLUGINS),children:(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,H.jsx)(Ae,{name:e},e))})})}var X=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function Z(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function Me(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);return i<1?n(v.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(v.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):a<24?n(v.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:a}):o===1?n(v.AUTOMATIONS$DETAIL$TIME_YESTERDAY):o<7?n(v.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:o}):Z(e,t)}function Ne({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=a(`openhands`),i=r.language;return(0,H.jsx)(G,{icon:(0,H.jsx)(X,{className:`size-4`}),title:n(v.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,H.jsx)(J,{icon:(0,H.jsx)(q,{className:`size-3.5`}),label:n(v.AUTOMATIONS$DETAIL$CREATED),children:Z(e,i)}),(0,H.jsx)(J,{icon:(0,H.jsx)(z,{className:`size-3.5`}),label:n(v.AUTOMATIONS$DETAIL$LAST_RUN),children:t?Me(t,i,n):n(v.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var Pe=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),Fe={[B.COMPLETED]:{label:v.AUTOMATIONS$DETAIL$SUCCESSFUL,style:`border-[var(--oh-success)]/50 bg-[var(--oh-success)]/10 text-[var(--oh-success)]`},[B.FAILED]:{label:v.AUTOMATIONS$DETAIL$FAILED,style:`border-[var(--oh-danger)]/50 bg-[var(--oh-danger)]/10 text-danger`},[B.PENDING]:{label:v.AUTOMATIONS$DETAIL$PENDING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`},[B.RUNNING]:{label:v.AUTOMATIONS$DETAIL$RUNNING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`}};function Ie({status:e}){switch(e){case B.COMPLETED:return(0,H.jsx)(K,{"data-testid":`run-status-icon-completed`,className:`size-3.5`});case B.FAILED:return(0,H.jsx)(Pe,{"data-testid":`run-status-icon-failed`,className:`size-3.5`});default:return(0,H.jsx)(z,{"data-testid":`run-status-icon-pending`,className:`size-3.5`})}}function Le({status:e}){let{t}=a(`openhands`),n=Fe[e];return(0,H.jsxs)(`span`,{className:_(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium`,n.style),children:[(0,H.jsx)(Ie,{status:e}),t(n.label)]})}var Re=20;function ze(e){return e.kind===`BashOutput`}var Be=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<Re;o+=1){let o=await e.searchEvents(t,n,{kind__eq:`BashOutput`,command_id__eq:r,sort_order:`TIMESTAMP`,...a?{page_id:a}:{}});if(o.items.forEach(e=>{ze(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=d().backend;if(r.kind===`cloud`){if(!e)throw Error(`BashService.listOutputs requires a conversation URL on cloud backends`);let i=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{t!=null&&i.set(e,String(t))}),b({backend:r,method:`GET`,hostOverride:l(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new s(u({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},Ve=[`bash-command-logs`];function He(e){switch(e){case`MISSING`:return`missing`;case`PAUSED`:return`paused`;case`STARTING`:return`starting`;case`ERROR`:return`errored`;case`RUNNING`:case null:case void 0:default:return null}}function Ue(e){let t=o.isAxiosError(e)?e.response?.status:f(e)?e.status:void 0;if(t!==void 0)return t===404||t>=500?`unreachable`:null;if(o.isAxiosError(e)||e instanceof TypeError)return`unreachable`;if(e instanceof Error){let t=e.cause instanceof Error?e.cause.name:null;if(e.name===`AbortError`||e.name===`TimeoutError`||t===`AbortError`||t===`TimeoutError`)return`unreachable`}return null}function We(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,i=m(),a=A(r?t??null:null),o=a.data,s=o?.conversation_url??null,l=o?.session_api_key??null,u=i.backend.kind===`cloud`,d=a.isFetched,f=null,p=!1;u&&d&&(o?f=He(o.sandbox_status)??(o.conversation_url?null:`missing`):p=!0);let h=r&&!!n&&(u?!!s:!0)&&!f&&!p,g=c({queryKey:[...Ve,n,s,l,i.backend.id,i.orgId],queryFn:()=>Be.listOutputs(s,l,n),enabled:h,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?Ue(g.error):null,v=f??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&a.isPending,conversationMissing:p,sandboxIssue:v}}var Ge=4e3;function Ke(e,t){return e.length<=t?e:`…(truncated)…\n${e.slice(e.length-t)}`}function qe({automationName:e,automationPrompt:t,errorDetail:n,stderr:r,runId:i}){let a=r?.trim()||n?.trim()||``,o=a?Ke(a,Ge):`No error output was captured for this run.`,s=e?.trim(),c=[`${s?`The scheduled automation "${s}" failed during a run.`:`A scheduled automation failed during a run.`} Please investigate the error and fix the root cause.`],l=t?.trim();return l&&c.push(``,`What the automation was set up to do:`,l),c.push(``,`Error output from the failed run (run ${i}):`,o,``,`Please diagnose why it failed and propose or implement a fix.`),c.join(`
1
+ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{B as r,U as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as a}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{j as o,v as s}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{t as c}from"./useQuery-B38jBavx.js";import{A as l,D as u,I as d,S as f,it as p,n as m,rt as h}from"./active-backend-context-BlZPzZNU.js";import{i as g,t as _,z as v}from"./utils-qjs_KuS4.js";import{t as y}from"./back-nav-button-Be_L157B.js";import{t as b}from"./proxy-C79PCMjo.js";import{n as x,t as S}from"./use-tracking-CN1nIMnY.js";import{t as C}from"./use-settings-DBI44RnH.js";import{r as w}from"./modal-classes-YaEEa5eZ.js";import{t as T}from"./brand-button-CQO8oqVo.js";import{n as E}from"./navigation-context-BOGzIng3.js";import{n as D}from"./use-create-conversation-Dsa4nzU9.js";import{t as O}from"./u-edit-809W9D9T.js";import{t as k}from"./terminal-cMS3RgVE.js";import{t as A}from"./use-user-conversation-GnGhs_Ob.js";import{t as ee}from"./toggle-switch-BptY3XRG.js";import{t as j}from"./x-mark-jcTkPiOB.js";import{n as M,t as N}from"./link-external-BDBCz-_z.js";import{C as te,D as P,E as ne,O as re,S as ie,T as ae,_ as F,a as oe,b as se,c as I,d as L,f as R,g as ce,h as le,i as ue,l as de,m as z,o as fe,p as pe,r as me,s as he,t as ge,u as _e}from"./automation-export-Bu-r-EzL.js";import{t as B}from"./automation-BGP_I1RR.js";var V=e(t()),H=n();function U(){let{t:e}=a(`openhands`);return(0,H.jsx)(y,{to:`/automations`,children:e(v.AUTOMATIONS$DETAIL$BACK_TO_LIST)})}var W=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3`})});function ve({active:e}){let{t}=a(`openhands`);return(0,H.jsx)(`span`,{"data-testid":e?`active-status-badge-active`:`active-status-badge-inactive`,className:_(`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium`,e?`bg-[var(--oh-success)]/15 text-[var(--oh-success)]`:`bg-surface-raised text-muted`),children:t(e?v.AUTOMATIONS$DETAIL$ACTIVE:v.AUTOMATIONS$DETAIL$INACTIVE)})}function ye({automation:e,onToggle:t,onEdit:n,onDelete:r,onExport:i,onDownloadTarball:o,onRunNow:s,isRunningNow:c=!1}){let{t:l}=a(`openhands`),u=ce(`manage_automations`),d=[...n?[{label:l(v.AUTOMATIONS$EDIT),icon:(0,H.jsx)(O,{className:`size-4`}),onClick:n}]:[],{label:e.enabled?l(v.AUTOMATIONS$TURN_OFF):l(v.AUTOMATIONS$TURN_ON),icon:(0,H.jsx)(_e,{className:`size-4`}),onClick:t},{label:l(v.AUTOMATIONS$EXPORT),icon:(0,H.jsx)(W,{className:`size-4`}),onClick:i},{label:l(v.AUTOMATIONS$DOWNLOAD_TARBALL),icon:(0,H.jsx)(W,{className:`size-4`}),onClick:o},{label:l(v.AUTOMATIONS$DELETE),icon:(0,H.jsx)(de,{className:`size-4`}),onClick:r}];return(0,H.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e.name}),(0,H.jsx)(ve,{active:e.enabled})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&s&&(0,H.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--oh-border)] px-3 py-1.5 text-sm font-medium text-content transition-colors hover:bg-surface-raised disabled:cursor-not-allowed disabled:opacity-60`,disabled:c||!e.enabled,onClick:s,children:[(0,H.jsx)(le,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),l(c?v.AUTOMATIONS$STARTING:v.AUTOMATIONS$RUN_NOW)]}),u&&(0,H.jsx)(ee,{enabled:e.enabled,label:e.enabled?l(v.AUTOMATIONS$TURN_OFF):l(v.AUTOMATIONS$TURN_ON),onToggle:t}),u&&(0,H.jsx)(F,{items:d})]})]})})}function G({icon:e,title:t,children:n}){return(0,H.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,H.jsx)(`span`,{className:`size-4 text-muted`,children:e}),(0,H.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t})]}),(0,H.jsx)(`div`,{className:`px-5 py-5`,children:n})]})}var be=240,xe=`max-h-60`;function Se({prompt:e}){let{t}=a(`openhands`),[n,r]=V.useState(!1),[i,o]=V.useState(!1),s=V.useRef(null),c=i&&!n;return V.useLayoutEffect(()=>{let e=s.current;if(!e)return;let t=()=>{o(e.scrollHeight>be)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,H.jsx)(G,{icon:(0,H.jsx)(k,{className:`size-4`}),title:t(v.AUTOMATIONS$DETAIL$PROMPT),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`p`,{ref:s,className:_(`whitespace-pre-wrap text-sm leading-6 text-content`,c&&_(xe,`overflow-hidden`)),"data-testid":`automation-prompt-content`,children:e}),c?(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-[var(--oh-surface)] to-transparent`,"aria-hidden":!0,"data-testid":`automation-prompt-fade`}):null]}),i?(0,H.jsx)(`button`,{type:`button`,className:`self-start cursor-pointer text-sm font-normal text-[var(--oh-muted)] hover:text-white`,onClick:()=>r(e=>!e),"data-testid":`automation-prompt-toggle`,children:t(n?v.COMMON$VIEW_LESS:v.COMMON$VIEW_MORE)}):null]})})}var Ce=e=>(0,H.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.204-.107-.397.165-.71.505-.78.929l-.15.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z`}),(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z`})]}),we=e=>(0,H.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:[(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 3v12m0 0a3 3 0 1 0 3 3M6 15a3 3 0 0 1 3-3h6a3 3 0 0 0 3-3V3m0 0a3 3 0 1 0 0 0`}),(0,H.jsx)(`circle`,{cx:6,cy:3,r:2}),(0,H.jsx)(`circle`,{cx:18,cy:3,r:2}),(0,H.jsx)(`circle`,{cx:9,cy:18,r:2})]}),K=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),q=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5`})}),Te=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0`})});function J({icon:e,label:t,children:n}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`size-3.5 text-muted`,children:e}),(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:t})]}),(0,H.jsx)(`div`,{className:`text-sm text-content`,children:n})]})}function Ee({branch:e}){return(0,H.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-surface-raised px-2.5 py-0.5 text-xs text-muted`,children:e})}var Y=60;function De({filter:e}){let{t}=a(`openhands`),[n,r]=(0,V.useState)(!1),i=e.length>Y;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`font-mono break-all`,children:i&&!n?`${e.slice(0,Y)}…`:e}),i&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`text-xs text-muted hover:text-content self-start`,children:t(n?v.SETTINGS$SKILLS_SHOW_LESS:v.SETTINGS$SKILLS_SHOW_MORE)})]})}function Oe({automation:e}){let{t}=a(`openhands`),n=e.trigger.type===`event`,r=e.trigger.schedule??``;e.trigger.schedule_human&&(r=e.timezone?`${e.trigger.schedule_human} (${e.timezone})`:e.trigger.schedule_human);let i=t(n?v.AUTOMATIONS$DETAIL$TRIGGER_EVENT:v.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);return(0,H.jsx)(G,{icon:(0,H.jsx)(Ce,{className:`size-4`}),title:t(v.AUTOMATIONS$DETAIL$CONFIGURATION),children:(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-5`,children:[e.repository&&(0,H.jsx)(J,{icon:(0,H.jsx)(we,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$REPOSITORIES),children:(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.repository,e.branch&&(0,H.jsx)(Ee,{branch:e.branch})]})}),(0,H.jsx)(J,{icon:(0,H.jsx)(K,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$TRIGGER),children:i}),!n&&(0,H.jsx)(J,{icon:(0,H.jsx)(q,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$SCHEDULE),children:r}),n&&e.trigger.source&&(0,H.jsx)(J,{icon:(0,H.jsx)(pe,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$EVENT_SOURCE),children:e.trigger.source}),n&&e.trigger.on&&(0,H.jsx)(J,{icon:(0,H.jsx)(N,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$EVENT_TYPE),children:L(e.trigger.on)}),n&&e.trigger.filter&&(0,H.jsx)(J,{icon:(0,H.jsx)(M,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$EVENT_FILTER),children:(0,H.jsx)(De,{filter:e.trigger.filter})}),(0,H.jsx)(J,{icon:(0,H.jsx)(R,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$MODEL),children:e.model??t(v.COMMON$ACTIVE_PROFILE)}),e.notification&&(0,H.jsx)(J,{icon:(0,H.jsx)(Te,{className:`size-3.5`}),label:t(v.AUTOMATIONS$DETAIL$NOTIFICATION),children:e.notification})]})})}var ke=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z`})});function Ae({name:e}){return(0,H.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-[var(--oh-border)] bg-[var(--oh-surface-deep)] px-3.5 py-1.5 text-sm text-content`,children:e})}function je({plugins:e}){let{t}=a(`openhands`);return(0,H.jsx)(G,{icon:(0,H.jsx)(ke,{className:`size-4`}),title:t(v.AUTOMATIONS$DETAIL$PLUGINS),children:(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map(e=>(0,H.jsx)(Ae,{name:e},e))})})}var X=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182`})});function Z(e,t){return new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`})}function Me(e,t,n){let r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);return i<1?n(v.AUTOMATIONS$DETAIL$TIME_JUST_NOW):i<60?n(v.AUTOMATIONS$DETAIL$TIME_MINUTES_AGO,{count:i}):a<24?n(v.AUTOMATIONS$DETAIL$TIME_HOURS_AGO,{count:a}):o===1?n(v.AUTOMATIONS$DETAIL$TIME_YESTERDAY):o<7?n(v.AUTOMATIONS$DETAIL$TIME_DAYS_AGO,{count:o}):Z(e,t)}function Ne({createdAt:e,lastRunAt:t}){let{t:n,i18n:r}=a(`openhands`),i=r.language;return(0,H.jsx)(G,{icon:(0,H.jsx)(X,{className:`size-4`}),title:n(v.AUTOMATIONS$DETAIL$ACTIVITY),children:(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4`,children:[(0,H.jsx)(J,{icon:(0,H.jsx)(q,{className:`size-3.5`}),label:n(v.AUTOMATIONS$DETAIL$CREATED),children:Z(e,i)}),(0,H.jsx)(J,{icon:(0,H.jsx)(z,{className:`size-3.5`}),label:n(v.AUTOMATIONS$DETAIL$LAST_RUN),children:t?Me(t,i,n):n(v.AUTOMATIONS$DETAIL$TIME_NEVER)})]})})}var Pe=e=>(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z`})}),Fe={[B.COMPLETED]:{label:v.AUTOMATIONS$DETAIL$SUCCESSFUL,style:`border-[var(--oh-success)]/50 bg-[var(--oh-success)]/10 text-[var(--oh-success)]`},[B.FAILED]:{label:v.AUTOMATIONS$DETAIL$FAILED,style:`border-[var(--oh-danger)]/50 bg-[var(--oh-danger)]/10 text-danger`},[B.PENDING]:{label:v.AUTOMATIONS$DETAIL$PENDING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`},[B.RUNNING]:{label:v.AUTOMATIONS$DETAIL$RUNNING,style:`border-[var(--oh-border)] bg-surface-raised text-muted`}};function Ie({status:e}){switch(e){case B.COMPLETED:return(0,H.jsx)(K,{"data-testid":`run-status-icon-completed`,className:`size-3.5`});case B.FAILED:return(0,H.jsx)(Pe,{"data-testid":`run-status-icon-failed`,className:`size-3.5`});default:return(0,H.jsx)(z,{"data-testid":`run-status-icon-pending`,className:`size-3.5`})}}function Le({status:e}){let{t}=a(`openhands`),n=Fe[e];return(0,H.jsxs)(`span`,{className:_(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium`,n.style),children:[(0,H.jsx)(Ie,{status:e}),t(n.label)]})}var Re=20;function ze(e){return e.kind===`BashOutput`}var Be=class e{static async listOutputs(t,n,r){let i=[],a;for(let o=0;o<Re;o+=1){let o=await e.searchEvents(t,n,{kind__eq:`BashOutput`,command_id__eq:r,sort_order:`TIMESTAMP`,...a?{page_id:a}:{}});if(o.items.forEach(e=>{ze(e)&&i.push(e)}),!o.next_page_id)break;a=o.next_page_id}return i}static async searchEvents(e,t,n){let r=d().backend;if(r.kind===`cloud`){if(!e)throw Error(`BashService.listOutputs requires a conversation URL on cloud backends`);let i=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{t!=null&&i.set(e,String(t))}),b({backend:r,method:`GET`,hostOverride:l(e),path:`/api/bash/bash_events/search?${i.toString()}`,authMode:`session-api-key`,sessionApiKey:t})}return new s(u({...e?{conversationUrl:e}:{},sessionApiKey:t})).searchEvents(n)}},Ve=[`bash-command-logs`];function He(e){switch(e){case`MISSING`:return`missing`;case`PAUSED`:return`paused`;case`STARTING`:return`starting`;case`ERROR`:return`errored`;case`RUNNING`:case null:case void 0:default:return null}}function Ue(e){let t=o.isAxiosError(e)?e.response?.status:f(e)?e.status:void 0;if(t!==void 0)return t===404||t>=500?`unreachable`:null;if(o.isAxiosError(e)||e instanceof TypeError)return`unreachable`;if(e instanceof Error){let t=e.cause instanceof Error?e.cause.name:null;if(e.name===`AbortError`||e.name===`TimeoutError`||t===`AbortError`||t===`TimeoutError`)return`unreachable`}return null}function We(e){let{conversationId:t,bashCommandId:n,enabled:r=!0}=e,i=m(),a=A(r?t??null:null),o=a.data,s=o?.conversation_url??null,l=o?.session_api_key??null,u=i.backend.kind===`cloud`,d=a.isFetched,f=null,p=!1;u&&d&&(o?f=He(o.sandbox_status)??(o.conversation_url?null:`missing`):p=!0);let h=r&&!!n&&(u?!!s:!0)&&!f&&!p,g=c({queryKey:[...Ve,n,s,l,i.backend.id,i.orgId],queryFn:()=>Be.listOutputs(s,l,n),enabled:h,staleTime:60*1e3,gcTime:300*1e3,retry:!1}),_=u?Ue(g.error):null,v=f??_;return{data:g.data,error:_?null:g.error,isFetching:g.isFetching,isPending:g.isPending,isResolvingConversation:u&&a.isPending,conversationMissing:p,sandboxIssue:v}}var Ge=4e3;function Ke(e,t){return e.length<=t?e:`…(truncated)…\n${e.slice(e.length-t)}`}function qe({automationName:e,automationPrompt:t,errorDetail:n,stderr:r,runId:i}){let a=r?.trim()||n?.trim()||``,o=a?Ke(a,Ge):`No error output was captured for this run.`,s=e?.trim(),c=[`${s?`The scheduled automation "${s}" failed during a run.`:`A scheduled automation failed during a run.`} Please investigate the error and fix the root cause.`],l=t?.trim();return l&&c.push(``,`What the automation was set up to do:`,l),c.push(``,`Error output from the failed run (run ${i}):`,o,``,`Please diagnose why it failed and propose or implement a fix.`),c.join(`
2
2
  `)}function Je({run:e,automation:t,stderr:n}){let{t:r}=a(`openhands`),{navigate:i}=E(),o=D();return(0,H.jsx)(T,{testId:`debug-automation-button`,type:`button`,variant:`primary`,onClick:()=>{if(o.isPending)return;let r=qe({automationName:t?.name,automationPrompt:t?.prompt,errorDetail:e.error_detail,stderr:n,runId:e.id});o.mutate({query:r},{onSuccess:e=>{i(`/conversations/${e.conversation_id}`)}})},isDisabled:o.isPending,"aria-busy":o.isPending,children:r(v.AUTOMATIONS$DETAIL$DEBUG_WITH_OPENHANDS)})}var Ye={missing:v.AUTOMATIONS$DETAIL$LOGS_SANDBOX_MISSING,paused:v.AUTOMATIONS$DETAIL$LOGS_SANDBOX_PAUSED,starting:v.AUTOMATIONS$DETAIL$LOGS_SANDBOX_STARTING,errored:v.AUTOMATIONS$DETAIL$LOGS_SANDBOX_ERROR,unreachable:v.AUTOMATIONS$DETAIL$LOGS_SANDBOX_UNREACHABLE};function Q(e,t){return[...e].sort((e,t)=>{let n=e.timestamp.localeCompare(t.timestamp);return n===0?(e.order??0)-(t.order??0):n}).map(e=>e[t]??``).join(``)}function Xe({conversationId:e,bashCommandId:t,isOpen:n,onClose:r,run:i,automation:o}){let{t:s}=a(`openhands`),[c,l]=(0,V.useState)(`stdout`),{data:u,isFetching:d,isResolvingConversation:f,sandboxIssue:p,conversationMissing:m,error:h}=We({conversationId:e,bashCommandId:t,enabled:n});(0,V.useEffect)(()=>{n&&l(`stdout`)},[n,t]),(0,V.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,r]);let{stdout:g,stderr:y}=(0,V.useMemo)(()=>u?{stdout:Q(u,`stdout`),stderr:Q(u,`stderr`)}:{stdout:``,stderr:``},[u]);if(!n)return null;let b=f||d&&!u,x=!t,S=c===`stdout`?g:y,C=`border-b-2 px-3 py-2 text-sm font-normal transition-colors focus:outline-none`,T=`border-[var(--oh-primary)] text-white`,E=`border-transparent text-muted hover:text-content`;return(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":s(v.AUTOMATIONS$DETAIL$LOGS_TITLE),children:[(0,H.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,H.jsxs)(`div`,{className:`relative flex max-h-[80vh] w-full max-w-3xl flex-col rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":s(v.AUTOMATIONS$CANCEL),children:(0,H.jsx)(j,{className:`size-5`})}),(0,H.jsx)(`h2`,{className:_(`pr-8`,w),children:s(v.AUTOMATIONS$DETAIL$LOGS_TITLE)}),(0,H.jsxs)(`div`,{role:`tablist`,"aria-label":s(v.AUTOMATIONS$DETAIL$LOGS_TITLE),className:`mt-4 flex gap-1 border-b border-[var(--oh-border)]`,children:[(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":c===`stdout`,"aria-controls":`run-logs-panel-stdout`,id:`run-logs-tab-stdout`,tabIndex:c===`stdout`?0:-1,onClick:()=>l(`stdout`),className:`${C} ${c===`stdout`?T:E}`,children:s(v.AUTOMATIONS$DETAIL$LOGS_TAB_OUTPUT)}),(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":c===`stderr`,"aria-controls":`run-logs-panel-stderr`,id:`run-logs-tab-stderr`,tabIndex:c===`stderr`?0:-1,onClick:()=>l(`stderr`),className:`${C} ${c===`stderr`?T:E}`,children:s(v.AUTOMATIONS$DETAIL$LOGS_TAB_ERROR)})]}),(0,H.jsxs)(`div`,{role:`tabpanel`,id:`run-logs-panel-${c}`,"aria-labelledby":`run-logs-tab-${c}`,className:`mt-3 min-h-[12rem] flex-1 overflow-auto rounded-lg border border-[var(--oh-border)] bg-black/40 p-4 font-mono text-xs`,children:[x&&(0,H.jsx)(`p`,{className:`text-muted italic`,children:s(v.AUTOMATIONS$DETAIL$LOGS_NO_COMMAND)}),!x&&m&&(0,H.jsx)(`p`,{className:`text-muted italic`,children:s(v.AUTOMATIONS$DETAIL$LOGS_CONVERSATION_MISSING)}),!x&&!m&&p&&(0,H.jsx)(`p`,{"data-testid":`run-logs-sandbox-issue-${p}`,className:`text-muted italic`,children:s(Ye[p])}),!x&&!m&&!p&&b&&(0,H.jsx)(`p`,{className:`text-muted italic`,children:s(v.AUTOMATIONS$DETAIL$LOGS_LOADING)}),!x&&!m&&!p&&!b&&h&&!u&&(0,H.jsxs)(`p`,{className:`text-danger`,children:[s(v.AUTOMATIONS$DETAIL$LOGS_ERROR),`: `,String(h)]}),!b&&!p&&u&&(0,H.jsx)(`pre`,{"data-testid":`run-logs-output-${c}`,className:`whitespace-pre-wrap break-words ${c===`stderr`?`text-danger`:`text-content`}`,children:S.length>0?S:(0,H.jsx)(`span`,{className:`text-muted italic`,children:s(v.AUTOMATIONS$DETAIL$LOGS_EMPTY)})})]}),i?.status===B.FAILED&&(0,H.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,H.jsx)(Je,{run:i,automation:o,stderr:y})})]})]})}function Ze(e,t){return new Date(e).toLocaleDateString(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Qe(e){if(!e)return!0;let t=new Date(e).getTime();return Number.isNaN(t)||t===0}function $e(e){return`/conversations/${e}`}function et({run:e,automation:t}){let{t:n,i18n:r}=a(`openhands`),i=!!e.conversation_id,o=!!e.bash_command_id,s=e.status===B.COMPLETED||e.status===B.FAILED,c=!i&&s,[l,u]=(0,V.useState)(!1),[d]=(0,V.useState)(()=>new Date().toISOString()),f=Ze(Qe(e.started_at)?d:e.started_at,r.language),p=o?(0,H.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),e.preventDefault(),u(!0)},className:`rounded-md p-1 text-muted hover:bg-surface-raised hover:text-foreground focus:bg-surface-raised focus:outline-none`,"aria-label":n(v.AUTOMATIONS$DETAIL$LOGS_VIEW,{timestamp:f}),title:n(v.AUTOMATIONS$DETAIL$LOGS_VIEW_SHORT),children:(0,H.jsx)(k,{className:`size-4`})}):null,m=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`text-sm text-content`,children:f}),c&&(0,H.jsxs)(`span`,{className:`text-xs text-muted italic`,children:[`(`,n(v.AUTOMATIONS$DETAIL$NO_CONVERSATION),`)`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,(0,H.jsx)(Le,{status:e.status})]})]});return(0,H.jsxs)(H.Fragment,{children:[i&&e.conversation_id?(0,H.jsx)(`a`,{href:$e(e.conversation_id),className:`flex items-center justify-between px-5 py-3 transition-colors cursor-pointer hover:bg-surface-raised focus:bg-surface-raised focus:outline-none`,"aria-label":`View conversation for run at ${f}`,children:m}):(0,H.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 cursor-default`,children:m}),o&&(0,H.jsx)(Xe,{conversationId:e.conversation_id,bashCommandId:e.bash_command_id,isOpen:l,onClose:()=>u(!1),run:e,automation:t})]})}var tt=20;function nt({automation:e}){let{t}=a(`openhands`),[n,r]=(0,V.useState)(tt),{data:i,isLoading:o}=P({id:e.id,limit:n,offset:0}),s=i?i.total>i.runs.length:!1;return(0,H.jsxs)(`div`,{className:`rounded-2xl border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--oh-border)] px-5 py-3`,children:[(0,H.jsx)(`span`,{className:`size-4 text-muted`,children:(0,H.jsx)(X,{className:`size-4`})}),(0,H.jsx)(`h3`,{className:`text-sm font-medium text-content`,children:t(v.AUTOMATIONS$DETAIL$ACTIVITY_LOG)})]}),o&&(0,H.jsx)(`div`,{className:`space-y-1 p-5`,children:Array.from({length:3}).map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,H.jsx)(`div`,{className:`h-5 w-64 animate-pulse rounded bg-surface-raised`}),(0,H.jsx)(`div`,{className:`h-6 w-24 animate-pulse rounded-full bg-surface-raised`})]},`skeleton-${t}`))}),!o&&i?.runs.length===0&&(0,H.jsx)(`p`,{className:`px-5 py-8 text-center text-sm text-muted`,children:t(v.AUTOMATIONS$DETAIL$NO_RUNS)}),!o&&i&&i.runs.length>0&&(0,H.jsxs)(`div`,{children:[i.runs.map((t,n)=>(0,H.jsx)(`div`,{className:n>0?`border-t border-[var(--oh-border)]`:``,children:(0,H.jsx)(et,{run:t,automation:e})},t.id)),s&&(0,H.jsx)(`div`,{className:`border-t border-[var(--oh-border)] px-5 py-3`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(e=>e+tt),className:`text-sm text-muted hover:text-foreground`,children:t(v.AUTOMATIONS$DETAIL$LOAD_MORE_RUNS)})})]})]})}function $({className:e}){return(0,H.jsx)(`div`,{className:_(`animate-pulse rounded bg-surface-raised`,e)})}function rt(){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-testid":`detail-skeleton`,children:[(0,H.jsx)($,{className:`h-5 w-40`}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)($,{className:`h-6 w-48`}),(0,H.jsx)($,{className:`h-6 w-16 rounded-full`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)($,{className:`h-6 w-11 rounded-full`}),(0,H.jsx)($,{className:`h-8 w-8`})]})]}),(0,H.jsx)($,{className:`h-5 w-96`}),(0,H.jsx)($,{className:`h-36 w-full rounded-2xl`}),(0,H.jsx)($,{className:`h-72 w-full rounded-2xl`}),(0,H.jsx)($,{className:`h-32 w-full rounded-2xl`}),(0,H.jsx)($,{className:`h-40 w-full rounded-2xl`})]})}function it(){let{t:e}=a(`openhands`);return(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,H.jsx)(I,{className:`size-12 text-muted`}),(0,H.jsx)(`p`,{className:`mt-4 text-sm font-medium text-content`,children:e(v.AUTOMATIONS$DETAIL$NOT_FOUND_TITLE)}),(0,H.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:e(v.AUTOMATIONS$DETAIL$NOT_FOUND_MESSAGE)}),(0,H.jsx)(`div`,{className:`mt-6`,children:(0,H.jsx)(U,{})})]})}var at=i(function(){let{t:e}=a(`openhands`),{automationId:t}=r(),{navigate:n}=E(),[i,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!1),{data:l,isLoading:u,refetch:d}=se(),f=l?.status===`ok`,_=m(),y=(0,V.useRef)(_.backend.id).current!==_.backend.id,{data:b,isLoading:w,isError:T,error:D,refetch:O}=ne({id:t??``,enabled:f&&!y}),{trackPrebuiltAutomationEnabled:k,trackAutomationExported:A}=S(),ee=ae(),j=ie(),M=te(),N=T&&C(D)===404;if(u)return(0,H.jsx)(`div`,{className:`min-h-full`,children:(0,H.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,H.jsx)(rt,{})})});if(!f)return(0,H.jsx)(`div`,{className:`min-h-full`,children:(0,H.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,H.jsx)(fe,{onRetry:d})})});if(w)return(0,H.jsx)(`div`,{className:`min-h-full`,children:(0,H.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,H.jsx)(rt,{})})});if(N)return(0,H.jsx)(`div`,{className:`min-h-full`,children:(0,H.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,H.jsx)(it,{})})});if(T||!b)return(0,H.jsx)(`div`,{className:`min-h-full`,children:(0,H.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,H.jsx)(he,{onRetry:()=>O()})})});let P=()=>{let e=!b.enabled;ee.mutate({id:b.id,enabled:e}),e&&k({automationId:b.id,automationName:b.name})},F=()=>{j.mutate(b.id,{onSuccess:()=>{n?.(`/automations`)}})},I=()=>{M.mutate(b.id,{onSuccess:()=>{p(e(v.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{h(re(t,e(v.AUTOMATIONS$RUN_NOW_ERROR)))}})},L=()=>{let e=`${JSON.stringify(me(b),null,2)}\n`;g(new Blob([e],{type:`application/json`}),ge(b)),A({backendKind:_.backend.kind})},R=_.backend.kind===`local`;return(0,H.jsx)(`div`,{className:`min-h-full`,children:(0,H.jsx)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(U,{}),(0,H.jsx)(ye,{automation:b,onToggle:P,onEdit:R?()=>c(!0):void 0,onDelete:()=>o(!0),onExport:L,onDownloadTarball:()=>x.downloadTarball(b.id,b.name),onRunNow:I,isRunningNow:M.isPending}),b.prompt&&(0,H.jsx)(Se,{prompt:b.prompt}),(0,H.jsx)(Oe,{automation:b}),b.plugins&&b.plugins.length>0&&(0,H.jsx)(je,{plugins:b.plugins}),(0,H.jsx)(Ne,{createdAt:b.created_at,lastRunAt:b.last_triggered_at}),(0,H.jsx)(nt,{automation:b}),(0,H.jsx)(oe,{automationName:b.name,isOpen:i,onConfirm:F,onCancel:()=>o(!1)}),R&&(0,H.jsx)(ue,{automation:b,isOpen:s,onClose:()=>c(!1)})]})})})});export{at as default};