@openhands/agent-canvas 1.5.1 → 1.5.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 (120) hide show
  1. package/README.md +1 -1
  2. package/README.windows.md +2 -2
  3. package/build/assets/{active-backend-context-B8rMv0X9.js → active-backend-context-DHhm10VS.js} +1 -1
  4. package/build/assets/{add-backend-modal-CxC7BNEc.js → add-backend-modal-BoMkMyLB.js} +1 -1
  5. package/build/assets/{agent-profiles-settings-BJb8YXR1.js → agent-profiles-settings-CYPloKYK.js} +1 -1
  6. package/build/assets/{agent-server-compatibility-BWN-EIQn.js → agent-server-compatibility-C0MtTTwb.js} +1 -1
  7. package/build/assets/{agent-server-conversation-service.api-DSPIkMwJ.js → agent-server-conversation-service.api-lzc8dabY.js} +3 -3
  8. package/build/assets/{agent-settings-CgCnqaAA.js → agent-settings-GwiXe_6k.js} +1 -1
  9. package/build/assets/agent-settings-OdsyI2gX.js +1 -0
  10. package/build/assets/{api-key-entry-screen-iZc7n8AI.js → api-key-entry-screen-2gsoZAOK.js} +1 -1
  11. package/build/assets/{app-settings-B5zyipxJ.js → app-settings-CD9euh81.js} +1 -1
  12. package/build/assets/{automation-detail-CZsu2CoM.js → automation-detail-Bn8q0AG3.js} +1 -1
  13. package/build/assets/{automation-export-BwRX6H32.js → automation-export-Djc8Tf0M.js} +1 -1
  14. package/build/assets/{automations-list-lHAVzMoA.js → automations-list-Dtiolk1h.js} +1 -1
  15. package/build/assets/{backend-form-modal-RGcu909r.js → backend-form-modal-B8GtBA-J.js} +1 -1
  16. package/build/assets/{backend-synced-settings-badge-BSfN0AZA.js → backend-synced-settings-badge-yVh6Kf4E.js} +1 -1
  17. package/build/assets/{client-source-BZK8vRs2.js → client-source-CtQjJEy6.js} +1 -1
  18. package/build/assets/{cloud-funnel-analytics-Zcv57hfT.js → cloud-funnel-analytics-uzzLlLuj.js} +1 -1
  19. package/build/assets/{condenser-settings-BGlWn93P.js → condenser-settings-Q1rHh4Qe.js} +1 -1
  20. package/build/assets/conversation-B8d8_Upd.js +1 -0
  21. package/build/assets/{conversation-BoCYx8n2.js → conversation-Lmqm6VJC.js} +20 -20
  22. package/build/assets/conversation-panel-B8n40Swu.js +1 -0
  23. package/build/assets/{conversation-service.api-_f9GlIEi.js → conversation-service.api-D8QU-BiL.js} +1 -1
  24. package/build/assets/{entry.client-DNlPGxsu.js → entry.client-Dnnak-Hq.js} +1 -1
  25. package/build/assets/{extensions-hub-CCbLA7IM.js → extensions-hub-DqvwvpCi.js} +1 -1
  26. package/build/assets/{extensions-navigation-CPNjMNvR.js → extensions-navigation-BMc9Nluv.js} +1 -1
  27. package/build/assets/{files-tab-y4K7EXBO.js → files-tab-BAkaV4aO.js} +1 -1
  28. package/build/assets/{git-provider-icon-ITvsH4Ko.js → git-provider-icon-xvbukHaT.js} +1 -1
  29. package/build/assets/{home-BwbeOWwU.js → home-D01kSnmo.js} +1 -1
  30. package/build/assets/home-NZO2bF4N.js +1 -0
  31. package/build/assets/index-home-BsI6i0TC.js +1 -0
  32. package/build/assets/{install-server-modal-Qk1gwyI8.js → install-server-modal-BYjqoRyX.js} +1 -1
  33. package/build/assets/{launch-CAGavYl-.js → launch-DlXspDku.js} +1 -1
  34. package/build/assets/{lesson-plan-DMCPdtrf.js → lesson-plan-cNUjpdFx.js} +1 -1
  35. package/build/assets/{llm-not-configured-banner-C1ktyb3C.js → llm-not-configured-banner-DUPyoFIZ.js} +7 -7
  36. package/build/assets/{llm-settings-DFkJQr_w.js → llm-settings-Cs_iieFY.js} +1 -1
  37. package/build/assets/llm-settings-J2ke2foG.js +1 -0
  38. package/build/assets/{llm-subscription-service-Casyzgn1.js → llm-subscription-service-C0zN0-rH.js} +1 -1
  39. package/build/assets/{manage-backends-modal-CKQ46rvw.js → manage-backends-modal-nMoCZ2a0.js} +1 -1
  40. package/build/assets/{manifest-03478bbf.js → manifest-f1b46f62.js} +1 -1
  41. package/build/assets/{mcp-BapoJsDc.js → mcp-kZM-cAZw.js} +1 -1
  42. package/build/assets/{messages-CUBFMY5o.js → messages-CJAv5n4j.js} +1 -1
  43. package/build/assets/{model-selector-DJrMrFAr.js → model-selector-D51W2Q9b.js} +1 -1
  44. package/build/assets/{onboarding-6NMkdNxV.js → onboarding-Dx8n8HFr.js} +1 -1
  45. package/build/assets/{onboarding-modal-Q4AnpIdg.js → onboarding-modal-Bxuxpfdz.js} +1 -1
  46. package/build/assets/{organization-service.api-vrRNwOma.js → organization-service.api-Da2jiuBS.js} +1 -1
  47. package/build/assets/{path-utils-PNfCKQDV.js → path-utils-D53ZHUQU.js} +1 -1
  48. package/build/assets/{planner-tab-ByOw1he8.js → planner-tab-BM-pKx0z.js} +1 -1
  49. package/build/assets/{plugins-management-service-B75jyC56.js → plugins-management-service-DISfOL13.js} +1 -1
  50. package/build/assets/{profiles-service.api-BQTklD5D.js → profiles-service.api-DWetW2TL.js} +1 -1
  51. package/build/assets/{providers-DfTB2gPd.js → providers-C7lMslCi.js} +1 -1
  52. package/build/assets/{proxy-B3tCGf0X.js → proxy-G4ce0fnQ.js} +1 -1
  53. package/build/assets/{recommended-automations-launcher-Bj7PuHY1.js → recommended-automations-launcher-BWRRvMPE.js} +1 -1
  54. package/build/assets/{root-layout-DfYVlcRG.js → root-layout-ClEl-JlJ.js} +2 -2
  55. package/build/assets/{root-CDnuTToz.js → root-oT83qVlk.js} +2 -2
  56. package/build/assets/{schema-field-CUwk4wrQ.js → schema-field-CwdqUOnE.js} +1 -1
  57. package/build/assets/{sdk-section-page-DLLNrYjI.js → sdk-section-page-Cwj0T4gF.js} +1 -1
  58. package/build/assets/{secrets-service-CvyPWJhg.js → secrets-service-Ch7RH8eH.js} +1 -1
  59. package/build/assets/{secrets-settings-CHy72A5C.js → secrets-settings-Bc_pBX6F.js} +1 -1
  60. package/build/assets/{settings-index-BKDl2CQ-.js → settings-index-BzSIM1-N.js} +1 -1
  61. package/build/assets/{settings-modal-DeK11CyT.js → settings-modal-BnZ7mMu7.js} +1 -1
  62. package/build/assets/{settings-B9S8UVQr.js → settings-n9a395O0.js} +1 -1
  63. package/build/assets/{settings-service.api-DXk5TdeJ.js → settings-service.api-DPTFyRXL.js} +1 -1
  64. package/build/assets/{shared-conversation-9atDzTR4.js → shared-conversation-CIDDti9I.js} +1 -1
  65. package/build/assets/{sidebar-mobile-menu-toggle-giMMZctn.js → sidebar-mobile-menu-toggle-CTX7J4wM.js} +1 -1
  66. package/build/assets/{skills-plugins-Tropusio.js → skills-plugins-HZEbNDmX.js} +1 -1
  67. package/build/assets/{skills-settings-BvzBBCWk.js → skills-settings-BdqijFlC.js} +1 -1
  68. package/build/assets/{telemetry-C5JMEfqB.js → telemetry-SHxpVxk8.js} +1 -1
  69. package/build/assets/{terminal-DRXt2Lr4.js → terminal-BDTa1HEr.js} +1 -1
  70. package/build/assets/{use-acp-credential-form-Bm8qXdlc.js → use-acp-credential-form-DHd_Id-q.js} +1 -1
  71. package/build/assets/{use-activate-agent-profile-DlykqEfN.js → use-activate-agent-profile-BRDdSwQ0.js} +1 -1
  72. package/build/assets/{use-active-agent-profile-hI-x-UBa.js → use-active-agent-profile-BMDTXsay.js} +1 -1
  73. package/build/assets/{use-active-conversation-2qeez40F.js → use-active-conversation-BbeVgedA.js} +1 -1
  74. package/build/assets/{use-agent-profiles-0pr5bLS7.js → use-agent-profiles-Dn_S_Tkz.js} +1 -1
  75. package/build/assets/{use-agent-state-C6peDXUm.js → use-agent-state-5qM3X30V.js} +1 -1
  76. package/build/assets/{use-backends-health-CLHPitJM.js → use-backends-health-BagmAE_W.js} +1 -1
  77. package/build/assets/{use-can-manage-org-profiles-Ck_bsNbH.js → use-can-manage-org-profiles-CyYqfzeo.js} +1 -1
  78. package/build/assets/{use-cloud-current-user-id-DUCSxNjY.js → use-cloud-current-user-id-BwMX7jHW.js} +1 -1
  79. package/build/assets/{use-config-B5r8erYt.js → use-config-B39iHYFi.js} +1 -1
  80. package/build/assets/{use-create-conversation-r1JHfKO5.js → use-create-conversation-CkKUQVbP.js} +1 -1
  81. package/build/assets/{use-create-secret-Cf2N11d2.js → use-create-secret-DEgM0MXZ.js} +1 -1
  82. package/build/assets/{use-handle-plan-click-CsAW3FlH.js → use-handle-plan-click-BFcE0Xms.js} +1 -1
  83. package/build/assets/{use-llm-profiles-Dr5__SlZ.js → use-llm-profiles-CgRtnj74.js} +1 -1
  84. package/build/assets/{use-plugins-marketplace-BplU65ae.js → use-plugins-marketplace-DOJp9rlE.js} +1 -1
  85. package/build/assets/use-runtime-is-ready-ziHQvXZQ.js +1 -0
  86. package/build/assets/{use-save-agent-profile-RqUGqTv6.js → use-save-agent-profile-i4FcEP98.js} +1 -1
  87. package/build/assets/{use-save-settings-Chvzeu2s.js → use-save-settings-DiDEbIJw.js} +1 -1
  88. package/build/assets/{use-settings-CyxSlyTQ.js → use-settings-BeJap6YL.js} +1 -1
  89. package/build/assets/{use-settings-nav-items-zEkSO_Bf.js → use-settings-nav-items-D5JJjFHJ.js} +1 -1
  90. package/build/assets/{use-skills-xrVoKYrF.js → use-skills-Blpg2BqE.js} +1 -1
  91. package/build/assets/{use-tracking-D2Qg5Lpd.js → use-tracking-DFoPQUSU.js} +1 -1
  92. package/build/assets/{use-user-conversation-CnE4zhOA.js → use-user-conversation-BrN2xeQU.js} +1 -1
  93. package/build/assets/{verification-settings-CfkrXoSa.js → verification-settings-C8KzAdAX.js} +1 -1
  94. package/build/index.html +4 -4
  95. package/config/defaults.json +1 -1
  96. package/dist/config/defaults.cjs +1 -1
  97. package/dist/config/defaults.cjs.map +1 -1
  98. package/dist/config/defaults.js +1 -1
  99. package/dist/config/defaults.js.map +1 -1
  100. package/dist/hooks/query/use-task-polling.cjs +1 -1
  101. package/dist/hooks/query/use-task-polling.cjs.map +1 -1
  102. package/dist/hooks/query/use-task-polling.d.ts +19 -3
  103. package/dist/hooks/query/use-task-polling.js +36 -35
  104. package/dist/hooks/query/use-task-polling.js.map +1 -1
  105. package/dist/package.cjs +1 -1
  106. package/dist/package.cjs.map +1 -1
  107. package/dist/package.js +1 -1
  108. package/dist/package.js.map +1 -1
  109. package/dist/routes/conversation.cjs +1 -1
  110. package/dist/routes/conversation.cjs.map +1 -1
  111. package/dist/routes/conversation.js +1 -1
  112. package/dist/routes/conversation.js.map +1 -1
  113. package/package.json +1 -1
  114. package/build/assets/agent-settings-DDkSavD7.js +0 -1
  115. package/build/assets/conversation-DgHqMjnY.js +0 -1
  116. package/build/assets/conversation-panel-78Rxh_-I.js +0 -1
  117. package/build/assets/home-DKPGQ5P3.js +0 -1
  118. package/build/assets/index-home-Bko2Itv5.js +0 -1
  119. package/build/assets/llm-settings-BBsZFi9l.js +0 -1
  120. package/build/assets/use-runtime-is-ready-vCFOcLFa.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~jkpzbynd-CkpBIhVe.js";import{n as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{t as a}from"./useMutation-u8UgRgDK.js";import{t as o}from"./useTranslation-Cbf5AGg_.js";import{t as s}from"./declaration-BGsHjPEW.js";import{C as c,E as l,S as u,f as d,n as f}from"./active-backend-context-B8rMv0X9.js";import{t as p}from"./createLucideIcon-D4Tak8A1.js";import{t as m}from"./search-dIQ09UY2.js";import{t as h}from"./trash-2-BU6BlW4i.js";import{t as g}from"./x-ZE4iplpF.js";import{t as _}from"./utils-DB9LsAzA.js";import{t as v}from"./modal-backdrop-zVwfOJZr.js";import{n as y}from"./modal-classes-3qT9Ap7Q.js";import{l as b}from"./form-control-classes-CbdN5aO3.js";import{t as x}from"./brand-button-B1izLAdR.js";import{t as S}from"./modal-close-button-BcIBUdSq.js";import{n as C,t as w}from"./settings-input-BsgQWS5R.js";import{a as T,c as E,i as D,l as O,o as k,s as A,t as j,u as M}from"./settings-service.api-DXk5TdeJ.js";import{r as N}from"./use-settings-CyxSlyTQ.js";import{t as P}from"./confirmation-modal-DGBWM2Ls.js";import{t as F}from"./settings-dropdown-input-Dhx9ErGd.js";import{a as I,n as L,o as R,r as z,t as B}from"./extension-module-card-classes-9V3J9J_b.js";import{a as ee,f as V,h as H,i as U,l as W,m as G,n as K,o as q,p as J,r as Y,s as X,t as te,u as ne}from"./install-server-modal-Qk1gwyI8.js";import{t as Z}from"./vendor~root-layout~index-home~home~mcp~automations-list~onboarding-modal-C4-GDgiF.js";import{n as re}from"./circle-plus-check-toggle-DoFIjVE0.js";import{n as ie}from"./extensions-navigation-CPNjMNvR.js";import{t as ae}from"./enum-filter-dropdown-JLYv1t8L.js";import{n as oe}from"./settings-like-page-layout-classes-Cdl6jOe5.js";var se=p(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Q=e(t(),1);function ce(){let e=i(),{data:t}=N();return a({mutationFn:async e=>{let n=D(t?.agent_settings?.mcp_config),r={sse_servers:[...n.sse_servers],stdio_servers:[...n.stdio_servers],shttp_servers:[...n.shttp_servers]},i=e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`&&`url`in e){let t=e.url;return typeof t==`string`?t:void 0}};if(e.type===`sse`){if(!e.url)return;let t=r.sse_servers.findIndex(t=>i(t)===e.url);t>=0&&r.sse_servers.splice(t,1)}else if(e.type===`shttp`){if(!e.url)return;let t=r.shttp_servers.findIndex(t=>i(t)===e.url);t>=0&&r.shttp_servers.splice(t,1)}else if(e.type===`stdio`){if(!e.name||!e.command)return;let t=r.stdio_servers.findIndex(t=>t.name===e.name&&t.command===e.command&&JSON.stringify(t.args??[])===JSON.stringify(e.args??[]));t>=0&&r.stdio_servers.splice(t,1)}else return;await j.saveSettings({agent_settings_diff:{mcp_config:E(r)}})},onSuccess:()=>{e.invalidateQueries({queryKey:d.personal()})}})}function le(e){return e.name?.trim()||void 0}function ue(e,t){let n=le(e);return n&&n!==t?.id?n:t?.name?t.name:e.type===`stdio`?n??e.command??``:e.url??``}var $=n();function de(e){switch(e){case`sse`:return`SSE`;case`shttp`:return`HTTP`;case`stdio`:return`STDIO`;default:return e}}function fe(e){if(e.type===`stdio`){let t=e.args&&e.args.length>0?` ${e.args.join(` `)}`:``;return`${e.command??``}${t}`.trim()}return e.url??``}function pe({server:e,onEdit:t,onDelete:n}){let{t:r}=o(`openhands`),i=X(e,V(Z)),a=ue(e,i),c=fe(e),l=de(e.type);return(0,$.jsx)(`div`,{"data-testid":`mcp-server-item`,"data-server-id":e.id,role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},"aria-label":r(s.MCP$EDIT_SERVER_ARIA,{name:a}),className:_(`flex min-h-[132px] flex-col overflow-hidden p-4 text-left`,I,z),children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(q,{entry:i,fallback:(0,$.jsx)(se,{strokeWidth:2.25})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold`,title:a,children:a}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-tertiary-alt`,children:l})]}),(0,$.jsx)(re,{testId:`mcp-installed-toggle-${e.id}`,isSelected:!0,onToggle:e=>{e||n()},enableLabelKey:s.MCP$TOGGLE_ADD_SERVER,disableLabelKey:s.MCP$TOGGLE_REMOVE_SERVER})]}),i?.description?(0,$.jsx)(`p`,{"data-testid":`mcp-server-description-${e.id}`,className:`line-clamp-2 break-words text-xs leading-relaxed text-tertiary-light`,children:i.description}):null,c?(0,$.jsx)(`p`,{"data-testid":`mcp-server-detail-${e.id}`,className:`truncate text-xs text-tertiary-alt`,title:c,children:c}):null]})]})})}function me({servers:e,hasAnyInstalled:t,query:n=``,onEdit:r,onDelete:i}){let{t:a}=o(`openhands`);return e.length===0?t&&n.trim().length>0?(0,$.jsx)(`div`,{"data-testid":`mcp-installed-empty-search`,className:`rounded-xl border border-[var(--oh-border)] p-6 text-center`,children:(0,$.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:a(s.MCP$SEARCH_EMPTY)})}):(0,$.jsxs)(`div`,{"data-testid":`mcp-installed-empty`,className:R,children:[(0,$.jsx)(`p`,{className:`text-sm text-white`,children:a(s.MCP$INSTALLED_EMPTY_TITLE)}),(0,$.jsx)(`p`,{className:`text-xs text-tertiary-light mt-1`,children:a(s.MCP$INSTALLED_EMPTY_HINT)})]}):(0,$.jsx)(`div`,{className:L,children:(0,$.jsx)(`div`,{"data-testid":`mcp-installed-list`,className:B,children:e.map(e=>(0,$.jsx)(pe,{server:e,onEdit:()=>r(e),onDelete:()=>i(e.id)},e.id))})})}function he({entry:e,onClick:t,onAdd:n}){let r=W(e),i=(()=>{switch(r?.kind){case`stdio`:return`STDIO`;case`shttp`:return`HTTP`;case`sse`:return`SSE`;default:return``}})();return(0,$.jsx)(`div`,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},"data-testid":`mcp-marketplace-card-${e.id}`,className:_(`flex min-h-[132px] flex-col overflow-hidden p-4 text-left`,I,z),children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(q,{entry:e}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-tertiary-alt`,children:i})]}),(0,$.jsx)(re,{testId:`mcp-marketplace-toggle-${e.id}`,isSelected:!1,onToggle:e=>{e&&n()},enableLabelKey:s.MCP$TOGGLE_ADD_SERVER,disableLabelKey:s.MCP$TOGGLE_ADD_SERVER})]}),(0,$.jsx)(`p`,{className:`line-clamp-3 text-xs leading-relaxed text-tertiary-light`,children:e.description})]})]})})}function ge({onSelect:e,onAdd:t,query:n=``}){let{t:r}=o(`openhands`),i=ne(V(Z)).filter(e=>G(e,n));return(0,$.jsxs)(`section`,{"data-testid":`mcp-marketplace-section`,className:`flex flex-col gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-base font-medium text-foreground`,children:r(s.MCP$LIBRARY_TITLE)}),i.length===0?(0,$.jsx)(`div`,{"data-testid":`mcp-marketplace-empty`,className:`rounded-xl border border-dashed border-[var(--oh-border)] p-6 text-center`,children:(0,$.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:r(s.MCP$SEARCH_EMPTY)})}):(0,$.jsx)(`div`,{className:L,children:(0,$.jsx)(`div`,{"data-testid":`mcp-marketplace-grid`,className:B,children:i.map(n=>(0,$.jsx)(he,{entry:n,onClick:()=>e(n),onAdd:()=>t(n)},n.id))})})]})}function _e({mode:e,server:t,existingServers:n,onSubmit:r,onCancel:i,onDelete:a,isActionDisabled:c=!1,onTest:l,isTestPending:u=!1,testMessage:d=null}){let{t:f}=o(`openhands`),[p,m]=Q.useState(t?.type||`sse`),[g,v]=Q.useState(()=>t?.auth?.strategy===`oauth2`?`oauth2`:t?.auth?.strategy===`header`?`header`:t?.auth?.strategy===`bearer`||t?.auth?.strategy===`api_key`?`bearer`:`none`),[y,S]=Q.useState(()=>t?.auth?.strategy===`oauth2`?t.auth.authentication?.client_auth_method??`auto`:`auto`),[T,E]=Q.useState(null),D=Q.useRef(null),k=[{key:`sse`,label:f(s.SETTINGS$MCP_SERVER_TYPE_SSE)},{key:`stdio`,label:f(s.SETTINGS$MCP_SERVER_TYPE_STDIO)},{key:`shttp`,label:f(s.SETTINGS$MCP_SERVER_TYPE_SHTTP)}],A=[{key:`none`,label:f(s.SETTINGS$MCP_AUTH_MODE_NONE)},{key:`bearer`,label:f(s.SETTINGS$MCP_AUTH_MODE_BEARER)},{key:`header`,label:f(s.SETTINGS$MCP_AUTH_MODE_HEADER)},{key:`oauth2`,label:f(s.SETTINGS$MCP_AUTH_MODE_OAUTH)}],j=[{key:`auto`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_AUTO)},{key:`none`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_NONE)},{key:`client_secret_post`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_SECRET_POST)},{key:`client_secret_basic`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_SECRET_BASIC)},{key:`private_key_jwt`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_PRIVATE_KEY_JWT)}],N=e=>{if(!e)return f(s.SETTINGS$MCP_ERROR_URL_REQUIRED);try{let t=new URL(e);if(![`http:`,`https:`].includes(t.protocol))return f(s.SETTINGS$MCP_ERROR_URL_INVALID_PROTOCOL)}catch{return f(s.SETTINGS$MCP_ERROR_URL_INVALID)}return null},P=e=>e?M(e)?null:f(s.SETTINGS$MCP_ERROR_NAME_INVALID):f(s.SETTINGS$MCP_ERROR_NAME_REQUIRED),I=r=>!n||!(e===`add`||e===`edit`&&t?.name!==r)?null:n.filter(e=>e.type===`stdio`).map(e=>e.name).filter(Boolean).includes(r)?f(s.SETTINGS$MCP_ERROR_NAME_DUPLICATE):null,L=e=>e?e.includes(` `)?f(s.SETTINGS$MCP_ERROR_COMMAND_NO_SPACES):null:f(s.SETTINGS$MCP_ERROR_COMMAND_REQUIRED),R=r=>{if(!n)return null;let i=t?.url;return(e===`add`||e===`edit`&&i!==r)&&n.some(e=>(e.type===`sse`||e.type===`shttp`)&&e.url===r)?f(s.SETTINGS$MCP_ERROR_URL_DUPLICATE):null},z=e=>{if(!e.trim())return null;let t=e.split(`
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{L as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~jkpzbynd-CkpBIhVe.js";import{n as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{t as a}from"./useMutation-u8UgRgDK.js";import{t as o}from"./useTranslation-Cbf5AGg_.js";import{t as s}from"./declaration-BGsHjPEW.js";import{C as c,E as l,S as u,f as d,n as f}from"./active-backend-context-DHhm10VS.js";import{t as p}from"./createLucideIcon-D4Tak8A1.js";import{t as m}from"./search-dIQ09UY2.js";import{t as h}from"./trash-2-BU6BlW4i.js";import{t as g}from"./x-ZE4iplpF.js";import{t as _}from"./utils-DB9LsAzA.js";import{t as v}from"./modal-backdrop-zVwfOJZr.js";import{n as y}from"./modal-classes-3qT9Ap7Q.js";import{l as b}from"./form-control-classes-CbdN5aO3.js";import{t as x}from"./brand-button-B1izLAdR.js";import{t as S}from"./modal-close-button-BcIBUdSq.js";import{n as C,t as w}from"./settings-input-BsgQWS5R.js";import{a as T,c as E,i as D,l as O,o as k,s as A,t as j,u as M}from"./settings-service.api-DPTFyRXL.js";import{r as N}from"./use-settings-BeJap6YL.js";import{t as P}from"./confirmation-modal-DGBWM2Ls.js";import{t as F}from"./settings-dropdown-input-Dhx9ErGd.js";import{a as I,n as L,o as R,r as z,t as B}from"./extension-module-card-classes-9V3J9J_b.js";import{a as ee,f as V,h as H,i as U,l as W,m as G,n as K,o as q,p as J,r as Y,s as X,t as te,u as ne}from"./install-server-modal-BYjqoRyX.js";import{t as Z}from"./vendor~root-layout~index-home~home~mcp~automations-list~onboarding-modal-C4-GDgiF.js";import{n as re}from"./circle-plus-check-toggle-DoFIjVE0.js";import{n as ie}from"./extensions-navigation-BMc9Nluv.js";import{t as ae}from"./enum-filter-dropdown-JLYv1t8L.js";import{n as oe}from"./settings-like-page-layout-classes-Cdl6jOe5.js";var se=p(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Q=e(t(),1);function ce(){let e=i(),{data:t}=N();return a({mutationFn:async e=>{let n=D(t?.agent_settings?.mcp_config),r={sse_servers:[...n.sse_servers],stdio_servers:[...n.stdio_servers],shttp_servers:[...n.shttp_servers]},i=e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`&&`url`in e){let t=e.url;return typeof t==`string`?t:void 0}};if(e.type===`sse`){if(!e.url)return;let t=r.sse_servers.findIndex(t=>i(t)===e.url);t>=0&&r.sse_servers.splice(t,1)}else if(e.type===`shttp`){if(!e.url)return;let t=r.shttp_servers.findIndex(t=>i(t)===e.url);t>=0&&r.shttp_servers.splice(t,1)}else if(e.type===`stdio`){if(!e.name||!e.command)return;let t=r.stdio_servers.findIndex(t=>t.name===e.name&&t.command===e.command&&JSON.stringify(t.args??[])===JSON.stringify(e.args??[]));t>=0&&r.stdio_servers.splice(t,1)}else return;await j.saveSettings({agent_settings_diff:{mcp_config:E(r)}})},onSuccess:()=>{e.invalidateQueries({queryKey:d.personal()})}})}function le(e){return e.name?.trim()||void 0}function ue(e,t){let n=le(e);return n&&n!==t?.id?n:t?.name?t.name:e.type===`stdio`?n??e.command??``:e.url??``}var $=n();function de(e){switch(e){case`sse`:return`SSE`;case`shttp`:return`HTTP`;case`stdio`:return`STDIO`;default:return e}}function fe(e){if(e.type===`stdio`){let t=e.args&&e.args.length>0?` ${e.args.join(` `)}`:``;return`${e.command??``}${t}`.trim()}return e.url??``}function pe({server:e,onEdit:t,onDelete:n}){let{t:r}=o(`openhands`),i=X(e,V(Z)),a=ue(e,i),c=fe(e),l=de(e.type);return(0,$.jsx)(`div`,{"data-testid":`mcp-server-item`,"data-server-id":e.id,role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},"aria-label":r(s.MCP$EDIT_SERVER_ARIA,{name:a}),className:_(`flex min-h-[132px] flex-col overflow-hidden p-4 text-left`,I,z),children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(q,{entry:i,fallback:(0,$.jsx)(se,{strokeWidth:2.25})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold`,title:a,children:a}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-tertiary-alt`,children:l})]}),(0,$.jsx)(re,{testId:`mcp-installed-toggle-${e.id}`,isSelected:!0,onToggle:e=>{e||n()},enableLabelKey:s.MCP$TOGGLE_ADD_SERVER,disableLabelKey:s.MCP$TOGGLE_REMOVE_SERVER})]}),i?.description?(0,$.jsx)(`p`,{"data-testid":`mcp-server-description-${e.id}`,className:`line-clamp-2 break-words text-xs leading-relaxed text-tertiary-light`,children:i.description}):null,c?(0,$.jsx)(`p`,{"data-testid":`mcp-server-detail-${e.id}`,className:`truncate text-xs text-tertiary-alt`,title:c,children:c}):null]})]})})}function me({servers:e,hasAnyInstalled:t,query:n=``,onEdit:r,onDelete:i}){let{t:a}=o(`openhands`);return e.length===0?t&&n.trim().length>0?(0,$.jsx)(`div`,{"data-testid":`mcp-installed-empty-search`,className:`rounded-xl border border-[var(--oh-border)] p-6 text-center`,children:(0,$.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:a(s.MCP$SEARCH_EMPTY)})}):(0,$.jsxs)(`div`,{"data-testid":`mcp-installed-empty`,className:R,children:[(0,$.jsx)(`p`,{className:`text-sm text-white`,children:a(s.MCP$INSTALLED_EMPTY_TITLE)}),(0,$.jsx)(`p`,{className:`text-xs text-tertiary-light mt-1`,children:a(s.MCP$INSTALLED_EMPTY_HINT)})]}):(0,$.jsx)(`div`,{className:L,children:(0,$.jsx)(`div`,{"data-testid":`mcp-installed-list`,className:B,children:e.map(e=>(0,$.jsx)(pe,{server:e,onEdit:()=>r(e),onDelete:()=>i(e.id)},e.id))})})}function he({entry:e,onClick:t,onAdd:n}){let r=W(e),i=(()=>{switch(r?.kind){case`stdio`:return`STDIO`;case`shttp`:return`HTTP`;case`sse`:return`SSE`;default:return``}})();return(0,$.jsx)(`div`,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},"data-testid":`mcp-marketplace-card-${e.id}`,className:_(`flex min-h-[132px] flex-col overflow-hidden p-4 text-left`,I,z),children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(q,{entry:e}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-tertiary-alt`,children:i})]}),(0,$.jsx)(re,{testId:`mcp-marketplace-toggle-${e.id}`,isSelected:!1,onToggle:e=>{e&&n()},enableLabelKey:s.MCP$TOGGLE_ADD_SERVER,disableLabelKey:s.MCP$TOGGLE_ADD_SERVER})]}),(0,$.jsx)(`p`,{className:`line-clamp-3 text-xs leading-relaxed text-tertiary-light`,children:e.description})]})]})})}function ge({onSelect:e,onAdd:t,query:n=``}){let{t:r}=o(`openhands`),i=ne(V(Z)).filter(e=>G(e,n));return(0,$.jsxs)(`section`,{"data-testid":`mcp-marketplace-section`,className:`flex flex-col gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-base font-medium text-foreground`,children:r(s.MCP$LIBRARY_TITLE)}),i.length===0?(0,$.jsx)(`div`,{"data-testid":`mcp-marketplace-empty`,className:`rounded-xl border border-dashed border-[var(--oh-border)] p-6 text-center`,children:(0,$.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:r(s.MCP$SEARCH_EMPTY)})}):(0,$.jsx)(`div`,{className:L,children:(0,$.jsx)(`div`,{"data-testid":`mcp-marketplace-grid`,className:B,children:i.map(n=>(0,$.jsx)(he,{entry:n,onClick:()=>e(n),onAdd:()=>t(n)},n.id))})})]})}function _e({mode:e,server:t,existingServers:n,onSubmit:r,onCancel:i,onDelete:a,isActionDisabled:c=!1,onTest:l,isTestPending:u=!1,testMessage:d=null}){let{t:f}=o(`openhands`),[p,m]=Q.useState(t?.type||`sse`),[g,v]=Q.useState(()=>t?.auth?.strategy===`oauth2`?`oauth2`:t?.auth?.strategy===`header`?`header`:t?.auth?.strategy===`bearer`||t?.auth?.strategy===`api_key`?`bearer`:`none`),[y,S]=Q.useState(()=>t?.auth?.strategy===`oauth2`?t.auth.authentication?.client_auth_method??`auto`:`auto`),[T,E]=Q.useState(null),D=Q.useRef(null),k=[{key:`sse`,label:f(s.SETTINGS$MCP_SERVER_TYPE_SSE)},{key:`stdio`,label:f(s.SETTINGS$MCP_SERVER_TYPE_STDIO)},{key:`shttp`,label:f(s.SETTINGS$MCP_SERVER_TYPE_SHTTP)}],A=[{key:`none`,label:f(s.SETTINGS$MCP_AUTH_MODE_NONE)},{key:`bearer`,label:f(s.SETTINGS$MCP_AUTH_MODE_BEARER)},{key:`header`,label:f(s.SETTINGS$MCP_AUTH_MODE_HEADER)},{key:`oauth2`,label:f(s.SETTINGS$MCP_AUTH_MODE_OAUTH)}],j=[{key:`auto`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_AUTO)},{key:`none`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_NONE)},{key:`client_secret_post`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_SECRET_POST)},{key:`client_secret_basic`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_SECRET_BASIC)},{key:`private_key_jwt`,label:f(s.SETTINGS$MCP_OAUTH_CLIENT_AUTH_PRIVATE_KEY_JWT)}],N=e=>{if(!e)return f(s.SETTINGS$MCP_ERROR_URL_REQUIRED);try{let t=new URL(e);if(![`http:`,`https:`].includes(t.protocol))return f(s.SETTINGS$MCP_ERROR_URL_INVALID_PROTOCOL)}catch{return f(s.SETTINGS$MCP_ERROR_URL_INVALID)}return null},P=e=>e?M(e)?null:f(s.SETTINGS$MCP_ERROR_NAME_INVALID):f(s.SETTINGS$MCP_ERROR_NAME_REQUIRED),I=r=>!n||!(e===`add`||e===`edit`&&t?.name!==r)?null:n.filter(e=>e.type===`stdio`).map(e=>e.name).filter(Boolean).includes(r)?f(s.SETTINGS$MCP_ERROR_NAME_DUPLICATE):null,L=e=>e?e.includes(` `)?f(s.SETTINGS$MCP_ERROR_COMMAND_NO_SPACES):null:f(s.SETTINGS$MCP_ERROR_COMMAND_REQUIRED),R=r=>{if(!n)return null;let i=t?.url;return(e===`add`||e===`edit`&&i!==r)&&n.some(e=>(e.type===`sse`||e.type===`shttp`)&&e.url===r)?f(s.SETTINGS$MCP_ERROR_URL_DUPLICATE):null},z=e=>{if(!e.trim())return null;let t=e.split(`
2
2
  `);for(let e=0;e<t.length;e+=1){let n=t[e].trim();if(n){let e=n.indexOf(`=`);if(e===-1||!n.substring(0,e).trim())return f(s.SETTINGS$MCP_ERROR_ENV_INVALID_FORMAT)}}return null},B=e=>{if(g===`header`){let t=e.get(`headers`)?.toString()||``;return t.trim()?z(t):f(s.SETTINGS$MCP_ERROR_HEADER_REQUIRED)}if(g===`oauth2`){let t=e.get(`oauth_client_id`)?.toString().trim();if(e.get(`oauth_client_secret`)?.toString().trim()&&!t)return f(s.SETTINGS$MCP_ERROR_OAUTH_SECRET_REQUIRES_ID)}return null},ee=e=>{if(!e.trim())return null;let t=parseInt(e.trim(),10);return Number.isNaN(t)?f(s.SETTINGS$MCP_ERROR_TIMEOUT_INVALID_NUMBER):t<=0?f(s.SETTINGS$MCP_ERROR_TIMEOUT_POSITIVE):t>3600?f(s.SETTINGS$MCP_ERROR_TIMEOUT_MAX_EXCEEDED):null},V=e=>{let t=e.get(`name`)?.toString().trim()||``,n=e.get(`command`)?.toString().trim()||``,r=e.get(`env`)?.toString()||``;return P(t)||I(t)||L(n)||z(r)||null},H=e=>{if(p===`sse`||p===`shttp`){let t=e.get(`url`)?.toString().trim()||``,n=N(t);if(n)return n;let r=R(t);if(r)return r;let i=e.get(`name`)?.toString().trim()||``;if(i&&!M(i))return f(s.SETTINGS$MCP_ERROR_NAME_INVALID);if(p===`shttp`){let t=ee(e.get(`timeout`)?.toString()||``);if(t)return t}return B(e)}return p===`stdio`?V(e):null},U=e=>{let t={},n=e.trim();if(!n)return t;for(let e of n.split(`
3
3
  `)){let n=e.trim(),r=n.indexOf(`=`),i=r>=0?n.substring(0,r).trim():``;n&&r!==-1&&i&&(t[i]=n.substring(r+1).trim())}return t},W=e=>e?Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
4
4
  `):``,G=e=>e?.strategy===`bearer`||e?.strategy===`api_key`?e.value??``:``,K=e=>e?.strategy===`header`?W(e.headers):``,q=t?.auth?.strategy===`oauth2`?t.auth.authentication:void 0,J=t?.auth?.strategy===`oauth2`?t.auth.state:void 0,Y=e=>{if(g===`none`)return;if(g===`bearer`){let n=e.get(`api_key`)?.toString().trim();return n?t?.auth?.strategy===`api_key`?{...t.auth,value:n}:{strategy:`bearer`,value:n}:void 0}if(g===`header`)return{strategy:`header`,headers:U(e.get(`headers`)?.toString()||``)};let n=e.get(`oauth_scopes`)?.toString().trim(),r=e.get(`oauth_client_id`)?.toString().trim(),i=e.get(`oauth_client_secret`)?.toString().trim();return{strategy:`oauth2`,authentication:{type:`oauth`,...y!==`auto`&&{client_auth_method:y},...n&&{scopes:n},...r&&{client_id:r},...i&&{client_secret:i}},...J&&{state:J}}},X=e=>{let n={id:t?.id||`${p}-${Date.now()}`,type:p};if(p===`sse`||p===`shttp`){let t=e.get(`name`)?.toString().trim(),r=e.get(`url`)?.toString().trim(),i=e.get(`timeout`)?.toString().trim(),a=Y(e),o={...n,...t&&{name:t},url:r,...a&&{auth:a}};if(p===`shttp`&&i){let e=parseInt(i,10);Number.isNaN(e)||(o.timeout=e)}return o}let r=e.get(`name`)?.toString().trim(),i=e.get(`command`)?.toString().trim(),a=e.get(`args`)?.toString().trim(),o=e.get(`env`)?.toString().trim(),s=a?a.split(`
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,M as n,N as r,P as i,bt as a}from"./vendor-styling-CI0PQ3ab.js";import{n as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{d as s,l as c,m as l,r as u,s as d}from"./path-utils-PNfCKQDV.js";import{t as f}from"./useMutation-u8UgRgDK.js";import{t as p}from"./Trans-DqF_OEZB.js";import{t as m}from"./useTranslation-Cbf5AGg_.js";import{t as h}from"./declaration-BGsHjPEW.js";import{F as g,S as _,n as v}from"./active-backend-context-B8rMv0X9.js";import{t as y}from"./createLucideIcon-D4Tak8A1.js";import{t as b}from"./chevron-down-D7IvFMBM.js";import{t as x}from"./loader-circle-CsAsfLIs.js";import{C as S,M as C,t as w}from"./utils-DB9LsAzA.js";import{n as T}from"./common-CxbUL3nR.js";import{n as E,o as D}from"./form-control-classes-CbdN5aO3.js";import{t as ee}from"./use-config-B5r8erYt.js";import{n as te}from"./navigation-context-DPs2G0X8.js";import{t as ne}from"./styled-tooltip-B14i_Uac.js";import{t as re}from"./react-DPDgL6du.js";import{s as ie}from"./conversation-local-storage-F6zVMM--.js";import{t as O}from"./conversation-store-LptbOvKa.js";import{r as ae}from"./use-settings-CyxSlyTQ.js";import{t as oe}from"./agent-server-conversation-service.api-DSPIkMwJ.js";import{t as se}from"./canvas-ui-COgjltGz.js";import{t as ce}from"./conversation-service.api-_f9GlIEi.js";import{n as le}from"./vendor~root-layout~conversation-panel~conversation~shared-conversation-BrguKXCn.js";import{t as ue}from"./skills-EqzxYBvT.js";import{t as de}from"./close-DLFb5kfv.js";import{t as fe}from"./copy-to-clipboard-button-CFzH_NOX.js";import{r as k}from"./typography-CzfoD9DY.js";import{t as pe}from"./u-check-circle-BqoIxNz_.js";import{n as me,r as A,t as he}from"./use-active-conversation-2qeez40F.js";import{n as ge}from"./files-tab-store-DJsPxYdg.js";import{t as _e}from"./use-agent-state-C6peDXUm.js";import{d as ve,f as ye,m as be,p as xe,r as Se,t as Ce}from"./lesson-plan-DMCPdtrf.js";import{C as j,E as we,a as Te,b as Ee,c as M,h as De,i as Oe,k as ke,l as Ae,m as je,o as Me,s as Ne,t as Pe,w as Fe,x as Ie}from"./use-event-store-Bbaz51GR.js";import{ot as Le,st as Re}from"./vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DqZatR3B.js";import{n as ze,t as N}from"./markdown-renderer-B4V2OMFP.js";import{n as Be,r as Ve,t as He}from"./plan-components-BdZXPyZU.js";import{n as Ue,t as We}from"./get-language-from-path-DBqBsCWH.js";import{n as Ge,t as Ke}from"./u-check-circle-half-MsShT8Ec.js";var qe=y(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),P=e(t(),1);function Je(){!r.current&&n();let[e]=(0,P.useState)(i.current);return e}var F=a(),Ye=function(e){return e.INIT=`initialize`,e.MESSAGE=`message`,e.SYSTEM=`system`,e.READ=`read`,e.WRITE=`write`,e.RUN=`run`,e.RUN_IPYTHON=`run_ipython`,e.BROWSE=`browse`,e.BROWSE_INTERACTIVE=`browse_interactive`,e.DELEGATE=`delegate`,e.THINK=`think`,e.FINISH=`finish`,e.REJECT=`reject`,e.CHANGE_AGENT_STATE=`change_agent_state`,e.MCP=`call_tool_mcp`,e.TASK_TRACKING=`task_tracking`,e}(Ye||{});function Xe(){let{conversationId:e}=A(),t=Se();return{send:(0,P.useCallback)(async e=>{if(t){let{action:n,args:r}=e;if(n===`message`&&r?.content){let e=[{type:`text`,text:r.content}];return r.image_urls&&r.image_urls.length>0&&e.push({type:`image`,image_urls:r.image_urls}),await t.sendMessage({role:`user`,content:e})}return{queued:!1}}return{queued:!1}},[t,e])}}function Ze(e,t,n,r){return{action:Ye.MESSAGE,args:{content:e,image_urls:t,file_urls:n,timestamp:r}}}var I=e=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 448 512`,...e,children:(0,F.jsx)(`path`,{d:`M201.4 374.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 306.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z`})}),L=e=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 448 512`,...e,children:(0,F.jsx)(`path`,{d:`M201.4 137.4c12.5-12.5 32.8-12.5 45.3 0l160 160c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L224 205.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l160-160z`})});function Qe({status:e}){return(0,F.jsx)(`span`,{className:`flex-shrink-0`,children:e===`timeout`&&(0,F.jsx)(le,{"data-testid":`status-icon`,className:`h-4 w-4 ml-2 inline fill-yellow-500`})})}function R({title:e,details:t,success:n,initiallyExpanded:r=!1,chevronPosition:i=`after`,titleTrailing:a,titleIcon:o}){let{t:s}=m(`openhands`),[c,l]=P.useState(r),u=t?(0,F.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`cursor-pointer text-left`,"aria-label":s(c?h.BUTTON$COLLAPSE:h.BUTTON$EXPAND),children:c?(0,F.jsx)(L,{className:w(`h-4 w-4 inline fill-[var(--oh-muted)]`,i===`after`?`ml-2`:`mr-2`)}):(0,F.jsx)(I,{className:w(`h-4 w-4 inline fill-[var(--oh-muted)]`,i===`after`?`ml-2`:`mr-2`)})}):null;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5 my-1 py-1 text-sm w-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between font-normal text-[var(--oh-muted)]`,children:[(0,F.jsxs)(`div`,{className:`flex items-center`,children:[i===`before`&&u,o,(0,F.jsx)(`span`,{children:e}),i===`after`&&u]}),(0,F.jsxs)(`div`,{className:`flex items-center`,children:[a,n&&(0,F.jsx)(Qe,{status:n})]})]}),c&&(typeof t==`string`?(0,F.jsx)(N,{children:t}):t)]})}var $e=e=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,F.jsx)(`path`,{d:`M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z`})}),et=e=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,F.jsx)(`path`,{d:`M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z`})}),tt={running:h.GOAL$STATUS_RUNNING,complete:h.GOAL$STATUS_COMPLETE,capped:h.GOAL$STATUS_CAPPED,interrupted:h.GOAL$STATUS_INTERRUPTED};function nt({status:e}){let{t}=m(`openhands`),{conversationId:n}=A(),r=xe(e=>n?!!e.statusByConversation[n]?.active:!1),[i,a]=(0,P.useState)(!1),{active:o,objective:l,iteration:u,max_iterations:f,verdict:p}=e,g=p?Math.round(p.score*100):null,v=p?.missing?t(h.GOAL$MISSING,{missing:p.missing}):``,y=async(e,r)=>{if(!(!n||i)){a(!0);try{await e(n)}catch(e){_(e instanceof Error&&e.message?e.message:t(r))}finally{a(!1)}}},b=()=>y(async e=>{await s(e),await d(e)},h.GOAL$STOP_FAILED),x=()=>y(c,h.GOAL$RESUME_FAILED),S=null;return n&&o?S=(0,F.jsx)(`button`,{type:`button`,"data-testid":`goal-stop`,disabled:i,onClick:b,className:w(E,D),children:t(h.GOAL$STOP)}):n&&e.status===`interrupted`&&!r&&(S=(0,F.jsx)(`button`,{type:`button`,"data-testid":`goal-resume`,disabled:i,onClick:x,className:w(E,D),children:t(h.GOAL$RESUME)})),(0,F.jsx)(`div`,{"data-testid":`goal-status`,className:`flex flex-col w-full`,children:(0,F.jsx)(R,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`opacity-60`,children:t(h.GOAL$PREFIX)}),(0,F.jsx)(`span`,{children:l}),(0,F.jsx)(`span`,{className:`opacity-60`,children:t(h.GOAL$ROUND,{iteration:u,max:f})}),(0,F.jsx)(`span`,{children:t(tt[e.status])}),g!==null&&(0,F.jsx)(`span`,{className:`opacity-60`,children:t(h.GOAL$SCORE,{score:g})}),o?(0,F.jsx)(`span`,{"data-testid":`goal-spinner`,className:`inline-block w-3.5 h-3.5 ml-1 rounded-full border-2 border-transparent border-t-[var(--oh-border-input)] animate-spin`}):e.status===`complete`?(0,F.jsx)(`span`,{"data-testid":`goal-done`,className:`inline-flex ml-1`,children:(0,F.jsx)($e,{className:`w-3.5 h-3.5 fill-success`})}):(0,F.jsx)(`span`,{"data-testid":`goal-ended`,className:`inline-flex ml-1`,children:(0,F.jsx)(et,{className:`w-3.5 h-3.5 fill-[var(--oh-muted)]`})})]}),titleTrailing:S,details:v,initiallyExpanded:!o,chevronPosition:`before`})})}var rt=e=>(0,F.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:12,height:12,viewBox:`0 0 12 12`,fill:`none`,...e,children:[(0,F.jsxs)(`g`,{clipPath:`url(#clip0_17463_15006)`,children:[(0,F.jsx)(`path`,{d:`M6 11C8.76142 11 11 8.76142 11 6C11 3.23858 8.76142 1 6 1C3.23858 1 1 3.23858 1 6C1 8.76142 3.23858 11 6 11Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,F.jsx)(`path`,{d:`M6 8V6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,F.jsx)(`path`,{d:`M6 4H6.00667`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),(0,F.jsx)(`defs`,{children:(0,F.jsx)(`clipPath`,{id:`clip0_17463_15006`,children:(0,F.jsx)(`rect`,{width:12,height:12,fill:`white`})})})]});function it({profile:e}){let[t,n]=P.useState(!1);return(0,F.jsxs)(`div`,{className:`border border-neutral-700 rounded-md overflow-hidden`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,"aria-label":`Toggle details for ${e.name}`,className:`w-full py-1.5 px-2 text-left flex items-center gap-2 hover:bg-neutral-700 transition-colors cursor-pointer`,children:[(0,F.jsx)(`span`,{className:`text-neutral-300`,children:t?(0,F.jsx)(b,{size:14}):(0,F.jsx)(l,{size:14})}),(0,F.jsx)(`span`,{className:`font-normal text-neutral-200 text-sm`,children:e.name})]}),t&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`hr`,{className:`border-neutral-700`}),(0,F.jsx)(`div`,{className:`px-3 py-2 text-xs text-neutral-300 font-mono whitespace-pre-wrap`,children:`model: ${e.model??`—`}\nbase_url: ${e.base_url??`—`}\napi_key: ${e.api_key_set?`set`:`not set`}`})]})]})}function at({conversationId:e,anchorEventId:t}){let n=ye(e=>e.entriesByConversation),r=(e?n[e]??[]:[]).filter(e=>e.anchorEventId===t);return!e||r.length===0?null:(0,F.jsx)(`div`,{"data-testid":`model-messages`,className:`flex flex-col w-full`,children:r.map(e=>{if(e.switchedTo)return(0,F.jsx)(R,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(rt,{width:14,height:14,className:`shrink-0 text-neutral-400`,"aria-hidden":!0}),(0,F.jsx)(p,{i18nKey:h.MODEL$SWITCHED_TO_PROFILE,values:{name:e.switchedTo},components:{cmd:(0,F.jsx)(`span`,{className:`font-mono text-neutral-200 bg-neutral-800 px-1 rounded`})}})]}),details:``},e.id);let t=e.profiles.length===0;return(0,F.jsx)(R,{title:(0,F.jsx)(`span`,{children:t?(0,F.jsx)(p,{i18nKey:h.MODEL$NO_SAVED_PROFILES}):(0,F.jsx)(p,{i18nKey:h.MODEL$AVAILABLE_PROFILES,values:{count:e.profiles.length}})}),details:t?(0,F.jsx)(`span`,{className:`text-neutral-300 text-sm px-2 py-1 block`,children:(0,F.jsx)(p,{i18nKey:h.MODEL$NO_PROFILES_HINT})}):(0,F.jsx)(`div`,{className:`flex flex-col gap-1 mt-1`,children:e.profiles.map(e=>(0,F.jsx)(it,{profile:e},e.name))}),initiallyExpanded:t},e.id)})})}var ot=(0,P.createContext)(void 0);function st({children:e,value:t}){let n=Ve(P.useRef(null)),r=t||n;return(0,F.jsx)(ot.Provider,{value:r,children:e})}function ct(){let e=(0,P.useContext)(ot);if(e===void 0)throw Error(`useScrollContext must be used within a ScrollProvider`);return e}function lt(){return(0,P.useContext)(ot)}var ut=()=>{let{setConversationMode:e}=O(),{send:t}=Xe(),{conversationId:n}=A(),r=be(e=>e.enqueuePendingMessage),i=be(e=>e.markPendingMessageError);return{handleBuildPlanClick:(0,P.useCallback)(a=>{a?.preventDefault(),a?.stopPropagation(),e(`code`);let o=`Execute the plan based on the .agents_tmp/PLAN.md file.`,s=new Date().toISOString(),c=n?r({conversationId:n,text:o,timestamp:s}):null;t(Ze(o,[],[],s)).catch(e=>{c&&i(c,e instanceof Error?e.message:`Failed to send message`)})},[e,t,n,r,i])}},dt=`200%`,z=8,ft=z*2;function pt({children:e,as:t=`p`,className:n,duration:r=2,spread:i=2,style:a,...o}){let s=Je(),c=`oh-text-shimmer-${(0,P.useId)().replace(/:/g,``)}`,l=(0,P.useMemo)(()=>Math.min(z/2-1,1+i/2),[i]),u=(0,P.useMemo)(()=>{let e=z/2;return{...a,backgroundImage:`repeating-linear-gradient(90deg, var(--oh-muted) 0%, var(--oh-muted) ${e-l}%, var(--oh-foreground) ${e}%, var(--oh-muted) ${e+l}%, var(--oh-muted) ${z}%)`,backgroundSize:`${dt} 100%`,backgroundRepeat:`no-repeat`,WebkitBackgroundClip:`text`,backgroundClip:`text`,color:`transparent`,WebkitTextFillColor:`transparent`,animation:`${c} ${r}s linear infinite`}},[c,l,r,a]);return s?(0,F.jsx)(t,{className:w(`text-[var(--oh-muted)]`,n),style:a,...o,children:e}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`@keyframes ${c}{from{background-position:${ft}% center}to{background-position:0% center}}`}}),(0,F.jsx)(t,{className:w(`relative inline-block`,n),style:u,...o,children:e})]})}var mt=P.memo(pt);function ht({className:e}){return(0,F.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":!0,className:e,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,className:`fill-[var(--oh-foreground)] transition-colors duration-150 group-hover:fill-[var(--oh-text-secondary)]`}),(0,F.jsx)(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,className:`fill-[var(--oh-color-tertiary)]`})]})}var gt=5,_t=360,vt={p:({children:e})=>(0,F.jsx)(`p`,{className:`m-0 leading-6`,children:e})};function yt({message:e,isHovering:t,isExpanded:n,onTruncatableChange:r}){let{t:i}=m(`openhands`),a=P.useRef(null),[o,s]=P.useState(!1);P.useEffect(()=>{r(o)},[o,r]),P.useLayoutEffect(()=>{let t=a.current;if(!t||n){s(!1);return}let r=()=>{let n=Number.parseFloat(getComputedStyle(t).lineHeight),r=gt*(Number.isFinite(n)&&n>0?n:24),i=(e.match(/\n/g)??[]).length;s(t.scrollHeight>r+1||i>=gt||e.trim().length>_t)};r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e,n]);let c=o&&!n;return(0,F.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,F.jsx)(`div`,{ref:a,className:w(`text-sm leading-6 whitespace-normal [word-break:break-word]`,c&&`line-clamp-5`),children:(0,F.jsx)(N,{includeStandard:!0,includeHeadings:!0,allowHtml:!1,components:vt,children:e})}),c?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{"aria-hidden":!0,"data-testid":`chat-message-truncation-gradient`,className:`pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-tertiary to-transparent`}),(0,F.jsx)(`span`,{"data-testid":`chat-message-view-more`,className:w(`pointer-events-none absolute bottom-1 left-1/2 z-10 inline-flex -translate-x-1/2 items-center rounded-full border border-[var(--oh-border-subtle)] bg-[var(--oh-surface-raised)] px-2.5 py-0.5 text-xs font-normal text-[var(--oh-foreground)] transition-opacity duration-150`,t?`opacity-100`:`opacity-0`),children:i(h.COMMON$VIEW_MORE)})]}):null]})}function B({type:e,message:t,children:n,actions:r,isFromPlanningAgent:i=!1,pendingStatus:a,onRetry:o,onStop:s}){let{t:c}=m(`openhands`),[l,u]=P.useState(!1),[d,f]=P.useState(!1),[p,g]=P.useState(!1),[_,v]=P.useState(!1),[y,b]=P.useState(!0),x=P.useRef(null);P.useEffect(()=>{g(!1)},[t]);let S=async()=>{await navigator.clipboard.writeText(t),f(!0)};P.useEffect(()=>{let e;return d&&(e=setTimeout(()=>{f(!1)},2e3)),()=>{clearTimeout(e)}},[d]);let C=e===`user`&&(a===`error`||a===`sending`),T=a===`sending`&&s!=null,E=T&&l,D=e===`user`&&a==null,ee=D&&_&&!p,te=P.Children.count(n)>0;P.useLayoutEffect(()=>{if(!T||D)return;let e=x.current;if(!e)return;let t=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight),n=Number.isFinite(t)&&t>0?t:24;b(e.scrollHeight<=n+1)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[t,T,D]);let re=D?(0,F.jsx)(yt,{message:t,isHovering:l,isExpanded:p,onTruncatableChange:v}):(0,F.jsx)(`div`,{ref:x,className:`min-w-0 text-sm leading-6 whitespace-normal [word-break:break-word]`,children:(0,F.jsx)(N,{includeStandard:!0,includeHeadings:!0,allowHtml:e!==`user`,components:vt,children:t})}),ie=(0,F.jsxs)(`article`,{"data-testid":`${e}-message`,"data-pending-status":a,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),className:w(`rounded-xl relative w-fit max-w-full flex flex-col`,te&&`gap-2`,e===`user`&&`mt-6 bg-tertiary self-end px-4 py-2.5`,e===`agent`&&`mt-6 w-full max-w-full bg-transparent`,i&&e===`agent`&&`border border-[#597ff4] bg-tertiary p-4 mt-2`,a===`error`&&`border border-[var(--oh-status-error)]/40`,!C&&`last:mb-4`),children:[(0,F.jsxs)(`div`,{className:w(`absolute -top-2.5 -right-2.5 z-10`,!l||a===`sending`?`hidden`:`flex`,`items-center gap-1`),onClick:e=>e.stopPropagation(),children:[r?.map((e,t)=>e.tooltip?(0,F.jsx)(ne,{content:e.tooltip,placement:`top`,children:(0,F.jsx)(`button`,{type:`button`,onClick:e.onClick,className:`button-base p-1 cursor-pointer`,"aria-label":e.tooltip,children:e.icon})},t):(0,F.jsx)(`button`,{type:`button`,onClick:e.onClick,className:`button-base p-1 cursor-pointer`,"aria-label":`Action ${t+1}`,children:e.icon},t)),(0,F.jsx)(fe,{isHidden:!l,isDisabled:d,onClick:S,mode:d?`copied`:`copy`})]}),re,T?(0,F.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s?.()},"data-testid":`chat-message-stop`,"aria-label":c(h.BUTTON$STOP),"aria-hidden":!E,tabIndex:E?0:-1,className:w(`group absolute z-10 inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded-full bg-[var(--oh-color-tertiary)] text-[var(--oh-foreground)] transition-opacity duration-150`,y?`right-3 top-1/2 -translate-y-1/2`:`right-3 bottom-2.5`,E?`opacity-100`:`pointer-events-none opacity-0`),children:(0,F.jsx)(ht,{className:`block h-7 w-7 max-w-none`})}):null,ee?(0,F.jsx)(`button`,{type:`button`,"data-testid":`chat-message-expand`,"aria-expanded":!1,"aria-label":c(h.COMMON$VIEW_MORE),className:`absolute inset-0 z-[1] cursor-pointer rounded-xl border-0 bg-transparent p-0`,onClick:()=>g(!0)}):null,n]});return e===`user`&&a===`error`?(0,F.jsxs)(`div`,{className:`flex w-fit max-w-full flex-col items-end gap-1.5 self-end last:mb-4`,children:[ie,(0,F.jsxs)(`div`,{role:`alert`,"data-testid":`chat-message-error`,className:`flex items-center gap-2 text-xs text-[var(--oh-status-error)]`,children:[(0,F.jsx)(`span`,{children:c(h.CHAT_INTERFACE$MESSAGE_SEND_FAILED)}),o?(0,F.jsx)(`button`,{type:`button`,onClick:o,className:`cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`chat-message-retry`,children:c(h.CHAT_INTERFACE$MESSAGE_RETRY)}):null]})]}):e===`user`&&a===`sending`?(0,F.jsxs)(`div`,{className:`flex w-full max-w-full flex-col last:mb-4`,children:[ie,(0,F.jsx)(`div`,{className:`my-1 w-full py-1 text-sm`,children:(0,F.jsx)(mt,{as:`p`,role:`status`,"aria-live":`polite`,"data-testid":`chat-message-sending`,className:`block w-full text-sm font-normal`,duration:1,spread:2,children:c(h.CHAT_INTERFACE$MESSAGE_SENDING)})})]}):ie}function bt(){let{conversationId:e}=me(),{selectedTab:t,isRightPanelShown:n,setHasRightPanelToggled:r,setSelectedTab:i}=O(),{setSelectedTab:a}=ie(e),o=e=>{i(e),a(e)};return{selectTab:e=>{t===e&&n?r(!1):(o(e),n||r(!0))},navigateToTab:e=>{o(e),n||r(!0)},isTabActive:e=>n&&t===e,onTabChange:o,selectedTab:t,isRightPanelShown:n}}var xt=300,St=He(`shine-text`);function Ct({planContent:e,isStreaming:t,isBuildDisabled:n}){let{t:r}=m(`openhands`),{navigateToTab:i}=bt(),{handleBuildPlanClick:a}=ut(),{scrollDomToBottom:o}=ct(),s=()=>{i(`planner`)},c=(0,P.useCallback)(e=>{a(e),o()},[a,o]),l=(0,P.useMemo)(()=>e?e.length<=xt?e:`${e.slice(0,xt)}...`:``,[e]);return e?(0,F.jsxs)(`div`,{className:`bg-[var(--oh-surface)] border border-[#597FF4] rounded-[12px] w-full mt-2`,children:[(0,F.jsxs)(`div`,{className:`border-b border-[var(--oh-border)] flex h-[41px] items-center px-2 gap-1`,children:[(0,F.jsx)(Ce,{width:18,height:18,color:`var(--oh-muted)`}),(0,F.jsx)(k.Text,{className:`font-normal text-[11px] text-white tracking-[0.11px] leading-4`,children:r(h.COMMON$PLAN_MD)}),(0,F.jsx)(`div`,{className:`flex-1`}),(0,F.jsxs)(`button`,{type:`button`,onClick:s,className:`flex items-center gap-1 hover:opacity-80 transition-opacity cursor-pointer`,"data-testid":`plan-preview-view-button`,children:[(0,F.jsx)(k.Text,{className:`font-normal text-[11px] text-white tracking-[0.11px] leading-4`,children:r(h.COMMON$VIEW)}),(0,F.jsx)(qe,{className:`text-white`,size:18})]})]}),(0,F.jsx)(`div`,{"data-testid":`plan-preview-content`,className:`flex flex-col gap-[10px] p-4 text-[15px] text-white leading-[29px]`,children:l&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(N,{includeStandard:!0,components:t?St:Be,children:l}),e&&e.length>xt&&(0,F.jsx)(`button`,{type:`button`,onClick:s,className:`text-[#4a67bd] cursor-pointer hover:underline text-left`,"data-testid":`plan-preview-read-more-button`,children:r(h.COMMON$READ_MORE)})]})}),(0,F.jsx)(`div`,{className:`border-t border-[var(--oh-border)] flex h-[54px] items-center justify-start px-4`,children:(0,F.jsx)(`button`,{type:`button`,onClick:c,disabled:n,className:w(`bg-white flex items-center justify-center h-[26px] px-2 rounded-[4px] w-[93px] transition-opacity`,n?`opacity-50 cursor-not-allowed`:`hover:opacity-90 cursor-pointer`),"data-testid":`plan-preview-build-button`,children:(0,F.jsxs)(k.Text,{className:`font-normal text-[14px] text-black leading-5`,children:[r(h.COMMON$BUILD),` `,(0,F.jsx)(k.Text,{className:`font-normal text-black`,children:`⌘↩`})]})})})]}):null}function wt({errorId:e,defaultMessage:t}){let{t:n}=m(`openhands`),[r,i]=P.useState(!1);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 my-2 py-2 text-sm w-full`,children:[(0,F.jsxs)(`div`,{className:`font-bold text-danger`,children:[n(e&&g.exists(e)?e:`CHAT_INTERFACE$AGENT_ERROR_MESSAGE`),(0,F.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`cursor-pointer text-left`,children:r?(0,F.jsx)(L,{className:`h-4 w-4 ml-2 inline fill-danger`}):(0,F.jsx)(I,{className:`h-4 w-4 ml-2 inline fill-danger`})})]}),r&&(0,F.jsx)(N,{children:t})]})}function Tt({event:e}){return Ae(e)?(0,F.jsx)(wt,{errorId:e.id,defaultMessage:e.error}):null}function Et({width:e=20,height:t=20,active:n}){return(0,F.jsx)(`svg`,{width:e,height:t,viewBox:`0 0 ${e} ${t}`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,F.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.204 15.0037L6.65511 9.99993L11.204 4.99617L12.1289 5.83701L8.34444 9.99993L12.1289 14.1628L11.204 15.0037Z`,fill:n?`var(--oh-text-tertiary)`:`var(--oh-border)`})})}function Dt({width:e=20,height:t=20,active:n}){return(0,F.jsx)(`svg`,{width:e,height:t,viewBox:`0 0 ${e} ${t}`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,F.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.79602 4.99634L13.3449 10.0001L8.79602 15.0038L7.87109 14.163L11.6556 10.0001L7.87109 5.83718L8.79602 4.99634Z`,fill:n?`var(--oh-text-tertiary)`:`var(--oh-border)`})})}function Ot({onClick:e,className:t}){return(0,F.jsx)(`button`,{type:`button`,onClick:e,className:w(`bg-[var(--oh-muted)] rounded-full w-5 h-5 flex items-center justify-center cursor-pointer`,t),children:(0,F.jsx)(de,{width:18,height:18})})}function kt({src:e,size:t=`small`}){return(0,F.jsx)(`img`,{role:`img`,alt:``,src:e,className:w(`rounded-sm object-cover`,t===`small`&&`w-[62px] h-[62px]`,t===`large`&&`w-[100px] h-[100px]`)})}function At({src:e,onRemove:t,size:n=`small`}){return(0,F.jsxs)(`div`,{"data-testid":`image-preview`,className:`relative w-fit shrink-0 py-1`,children:[(0,F.jsx)(kt,{src:e,size:n}),t&&(0,F.jsx)(Ot,{onClick:t,className:`absolute right-[3px] top-[3px] cursor-pointer`})]})}function jt({size:e=`small`,images:t,onRemove:n}){let r=P.useRef(null),[i,a]=P.useState(!1),[o,s]=P.useState(!0),[c,l]=P.useState(!1);return P.useEffect(()=>{let e=r.current;e&&a(e.scrollWidth>e.clientWidth)},[t]),(0,F.jsxs)(`div`,{"data-testid":`image-carousel`,className:`relative`,children:[i&&(0,F.jsx)(`div`,{className:`absolute right-full transform top-1/2 -translate-y-1/2`,children:(0,F.jsx)(Et,{active:!o})}),(0,F.jsx)(`div`,{ref:r,onScroll:e=>{let t=e.currentTarget;s(t.scrollLeft===0),l(t.scrollLeft+t.clientWidth===t.scrollWidth)},className:w(`flex overflow-x-auto`,e===`small`&&`gap-2`,e===`large`&&`gap-4`),children:t.map((t,r)=>(0,F.jsx)(At,{size:e,src:t,onRemove:n?()=>n?.(r):void 0},r))}),i&&(0,F.jsx)(`div`,{className:`absolute left-full transform top-1/2 -translate-y-1/2`,children:(0,F.jsx)(Dt,{active:!c})})]})}function Mt({type:e,onClick:t}){let{t:n}=m(`openhands`),r=e===`confirm`,i=n(r?h.ACTION$CONFIRM:h.ACTION$REJECT),a=n(r?h.CHAT_INTERFACE$USER_CONFIRMED:h.CHAT_INTERFACE$USER_REJECTED),o=r?`${n(h.CHAT_INTERFACE$INPUT_CONTINUE_MESSAGE)} ⌘↩`:`${n(h.BUTTON$CANCEL)} ⇧⌘⌫`;return(0,F.jsx)(ne,{closeDelay:100,content:a,children:(0,F.jsx)(`button`,{"data-testid":`action-${e}-button`,type:`button`,"aria-label":i,className:w(`rounded px-2 h-6.5 text-sm font-normal leading-5 cursor-pointer hover:opacity-80`,e===`confirm`?`bg-tertiary text-white`:`bg-white text-base`),onClick:t,children:o})})}function Nt({className:e,content:t,icon:n,severity:r,title:i}){return r===`high`?(0,F.jsxs)(`div`,{className:w(`flex items-center gap-3.5 bg-[#4A0709] border border-[#FF0006] text-red-400 rounded-xl px-3.5 h-13 text-sm text-white`,e),children:[n&&(0,F.jsx)(`span`,{className:``,children:n}),(0,F.jsx)(`span`,{className:`font-bold`,children:i}),(0,F.jsx)(`span`,{className:`font-normal`,children:t})]}):null}var Pt=e=>(0,F.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,F.jsx)(`path`,{d:`M12 14C11.4477 14 11 13.5523 11 13V10C11 9.44772 11.4477 9 12 9C12.5523 9 13 9.44772 13 10V13C13 13.5523 12.5523 14 12 14Z`,fill:`currentColor`}),(0,F.jsx)(`path`,{d:`M10.5 16.5C10.5 15.6716 11.1716 15 12 15C12.8284 15 13.5 15.6716 13.5 16.5C13.5 17.3284 12.8284 18 12 18C11.1716 18 10.5 17.3284 10.5 16.5Z`,fill:`currentColor`}),(0,F.jsx)(`path`,{d:`M10.2301 3.2156C10.98 1.79093 13.02 1.79092 13.7698 3.2156L22.1135 19.0685C22.8144 20.4003 21.8486 22 20.3436 22H3.65635C2.15133 22 1.18556 20.4003 1.88651 19.0685L10.2301 3.2156ZM20.3436 20L12 4.1471L3.65635 20L20.3436 20Z`,fill:`currentColor`})]}),Ft=re(e=>({submittedEventIds:[],addSubmittedEventId:t=>e(e=>({submittedEventIds:[...e.submittedEventIds,t]})),removeSubmittedEventId:t=>e(e=>({submittedEventIds:e.submittedEventIds.filter(e=>e!==t)}))})),It=()=>f({mutationKey:[`respond-to-confirmation`],mutationFn:async({conversationId:e,conversationUrl:t,sessionApiKey:n,accept:r})=>{let i={accept:r};return ve.respondToConfirmation(e,t,i,n)}});function Lt(){let e=Ft(e=>e.submittedEventIds),t=Ft(e=>e.addSubmittedEventId),{t:n}=m(`openhands`),{data:r}=he(),{curAgentState:i}=_e(),{mutate:a}=It(),o=Pe(e=>e.events).slice().reverse().find(e=>e.source===`agent`?i===S.AWAITING_USER_CONFIRMATION:!1),s=(0,P.useCallback)(e=>{!o||!r||(t(o.id),a({conversationId:r.id,conversationUrl:r.conversation_url||``,sessionApiKey:r.session_api_key,accept:e}))},[o,r,t,a]);return(0,P.useEffect)(()=>{if(!o)return;let e=e=>{e.shiftKey&&e.metaKey&&e.key===`Backspace`&&(e.preventDefault(),s(!1))},t=e=>{e.metaKey&&e.key===`Enter`&&(e.preventDefault(),s(!0))},n=n=>{e(n),t(n)};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[o,s]),i!==S.AWAITING_USER_CONFIRMATION||!o||e.includes(o.id)?null:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(M(o)?o.security_risk:T.UNKNOWN)===T.HIGH&&(0,F.jsx)(Nt,{content:n(h.CHAT_INTERFACE$HIGH_RISK_WARNING),icon:(0,F.jsx)(Pt,{width:16,height:16,color:`#fff`}),severity:`high`,title:n(h.COMMON$HIGH_RISK)}),(0,F.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,F.jsx)(`p`,{className:`text-sm font-normal text-white`,children:n(h.CHAT_INTERFACE$USER_ASK_CONFIRMATION)}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(Mt,{type:`reject`,onClick:()=>s(!1)}),(0,F.jsx)(Mt,{type:`confirm`,onClick:()=>s(!0)})]})]})]})}var Rt=e=>{let t=e.llm_message;if(!t?.content)return``;let n=``;if(t.content&&(Array.isArray(t.content)?n=t.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,M as n,N as r,P as i,bt as a}from"./vendor-styling-CI0PQ3ab.js";import{n as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{d as s,l as c,m as l,r as u,s as d}from"./path-utils-D53ZHUQU.js";import{t as f}from"./useMutation-u8UgRgDK.js";import{t as p}from"./Trans-DqF_OEZB.js";import{t as m}from"./useTranslation-Cbf5AGg_.js";import{t as h}from"./declaration-BGsHjPEW.js";import{F as g,S as _,n as v}from"./active-backend-context-DHhm10VS.js";import{t as y}from"./createLucideIcon-D4Tak8A1.js";import{t as b}from"./chevron-down-D7IvFMBM.js";import{t as x}from"./loader-circle-CsAsfLIs.js";import{C as S,M as C,t as w}from"./utils-DB9LsAzA.js";import{n as T}from"./common-CxbUL3nR.js";import{n as E,o as D}from"./form-control-classes-CbdN5aO3.js";import{t as ee}from"./use-config-B39iHYFi.js";import{n as te}from"./navigation-context-DPs2G0X8.js";import{t as ne}from"./styled-tooltip-B14i_Uac.js";import{t as re}from"./react-DPDgL6du.js";import{s as ie}from"./conversation-local-storage-F6zVMM--.js";import{t as O}from"./conversation-store-LptbOvKa.js";import{r as ae}from"./use-settings-BeJap6YL.js";import{t as oe}from"./agent-server-conversation-service.api-lzc8dabY.js";import{t as se}from"./canvas-ui-COgjltGz.js";import{t as ce}from"./conversation-service.api-D8QU-BiL.js";import{n as le}from"./vendor~root-layout~conversation-panel~conversation~shared-conversation-BrguKXCn.js";import{t as ue}from"./skills-EqzxYBvT.js";import{t as de}from"./close-DLFb5kfv.js";import{t as fe}from"./copy-to-clipboard-button-CFzH_NOX.js";import{r as k}from"./typography-CzfoD9DY.js";import{t as pe}from"./u-check-circle-BqoIxNz_.js";import{n as me,r as A,t as he}from"./use-active-conversation-BbeVgedA.js";import{n as ge}from"./files-tab-store-DJsPxYdg.js";import{t as _e}from"./use-agent-state-5qM3X30V.js";import{d as ve,f as ye,m as be,p as xe,r as Se,t as Ce}from"./lesson-plan-cNUjpdFx.js";import{C as j,E as we,a as Te,b as Ee,c as M,h as De,i as Oe,k as ke,l as Ae,m as je,o as Me,s as Ne,t as Pe,w as Fe,x as Ie}from"./use-event-store-Bbaz51GR.js";import{ot as Le,st as Re}from"./vendor~index-home~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DqZatR3B.js";import{n as ze,t as N}from"./markdown-renderer-B4V2OMFP.js";import{n as Be,r as Ve,t as He}from"./plan-components-BdZXPyZU.js";import{n as Ue,t as We}from"./get-language-from-path-DBqBsCWH.js";import{n as Ge,t as Ke}from"./u-check-circle-half-MsShT8Ec.js";var qe=y(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),P=e(t(),1);function Je(){!r.current&&n();let[e]=(0,P.useState)(i.current);return e}var F=a(),Ye=function(e){return e.INIT=`initialize`,e.MESSAGE=`message`,e.SYSTEM=`system`,e.READ=`read`,e.WRITE=`write`,e.RUN=`run`,e.RUN_IPYTHON=`run_ipython`,e.BROWSE=`browse`,e.BROWSE_INTERACTIVE=`browse_interactive`,e.DELEGATE=`delegate`,e.THINK=`think`,e.FINISH=`finish`,e.REJECT=`reject`,e.CHANGE_AGENT_STATE=`change_agent_state`,e.MCP=`call_tool_mcp`,e.TASK_TRACKING=`task_tracking`,e}(Ye||{});function Xe(){let{conversationId:e}=A(),t=Se();return{send:(0,P.useCallback)(async e=>{if(t){let{action:n,args:r}=e;if(n===`message`&&r?.content){let e=[{type:`text`,text:r.content}];return r.image_urls&&r.image_urls.length>0&&e.push({type:`image`,image_urls:r.image_urls}),await t.sendMessage({role:`user`,content:e})}return{queued:!1}}return{queued:!1}},[t,e])}}function Ze(e,t,n,r){return{action:Ye.MESSAGE,args:{content:e,image_urls:t,file_urls:n,timestamp:r}}}var I=e=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 448 512`,...e,children:(0,F.jsx)(`path`,{d:`M201.4 374.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 306.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z`})}),L=e=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 448 512`,...e,children:(0,F.jsx)(`path`,{d:`M201.4 137.4c12.5-12.5 32.8-12.5 45.3 0l160 160c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L224 205.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l160-160z`})});function Qe({status:e}){return(0,F.jsx)(`span`,{className:`flex-shrink-0`,children:e===`timeout`&&(0,F.jsx)(le,{"data-testid":`status-icon`,className:`h-4 w-4 ml-2 inline fill-yellow-500`})})}function R({title:e,details:t,success:n,initiallyExpanded:r=!1,chevronPosition:i=`after`,titleTrailing:a,titleIcon:o}){let{t:s}=m(`openhands`),[c,l]=P.useState(r),u=t?(0,F.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`cursor-pointer text-left`,"aria-label":s(c?h.BUTTON$COLLAPSE:h.BUTTON$EXPAND),children:c?(0,F.jsx)(L,{className:w(`h-4 w-4 inline fill-[var(--oh-muted)]`,i===`after`?`ml-2`:`mr-2`)}):(0,F.jsx)(I,{className:w(`h-4 w-4 inline fill-[var(--oh-muted)]`,i===`after`?`ml-2`:`mr-2`)})}):null;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5 my-1 py-1 text-sm w-full`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between font-normal text-[var(--oh-muted)]`,children:[(0,F.jsxs)(`div`,{className:`flex items-center`,children:[i===`before`&&u,o,(0,F.jsx)(`span`,{children:e}),i===`after`&&u]}),(0,F.jsxs)(`div`,{className:`flex items-center`,children:[a,n&&(0,F.jsx)(Qe,{status:n})]})]}),c&&(typeof t==`string`?(0,F.jsx)(N,{children:t}):t)]})}var $e=e=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,F.jsx)(`path`,{d:`M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z`})}),et=e=>(0,F.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,...e,children:(0,F.jsx)(`path`,{d:`M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z`})}),tt={running:h.GOAL$STATUS_RUNNING,complete:h.GOAL$STATUS_COMPLETE,capped:h.GOAL$STATUS_CAPPED,interrupted:h.GOAL$STATUS_INTERRUPTED};function nt({status:e}){let{t}=m(`openhands`),{conversationId:n}=A(),r=xe(e=>n?!!e.statusByConversation[n]?.active:!1),[i,a]=(0,P.useState)(!1),{active:o,objective:l,iteration:u,max_iterations:f,verdict:p}=e,g=p?Math.round(p.score*100):null,v=p?.missing?t(h.GOAL$MISSING,{missing:p.missing}):``,y=async(e,r)=>{if(!(!n||i)){a(!0);try{await e(n)}catch(e){_(e instanceof Error&&e.message?e.message:t(r))}finally{a(!1)}}},b=()=>y(async e=>{await s(e),await d(e)},h.GOAL$STOP_FAILED),x=()=>y(c,h.GOAL$RESUME_FAILED),S=null;return n&&o?S=(0,F.jsx)(`button`,{type:`button`,"data-testid":`goal-stop`,disabled:i,onClick:b,className:w(E,D),children:t(h.GOAL$STOP)}):n&&e.status===`interrupted`&&!r&&(S=(0,F.jsx)(`button`,{type:`button`,"data-testid":`goal-resume`,disabled:i,onClick:x,className:w(E,D),children:t(h.GOAL$RESUME)})),(0,F.jsx)(`div`,{"data-testid":`goal-status`,className:`flex flex-col w-full`,children:(0,F.jsx)(R,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`opacity-60`,children:t(h.GOAL$PREFIX)}),(0,F.jsx)(`span`,{children:l}),(0,F.jsx)(`span`,{className:`opacity-60`,children:t(h.GOAL$ROUND,{iteration:u,max:f})}),(0,F.jsx)(`span`,{children:t(tt[e.status])}),g!==null&&(0,F.jsx)(`span`,{className:`opacity-60`,children:t(h.GOAL$SCORE,{score:g})}),o?(0,F.jsx)(`span`,{"data-testid":`goal-spinner`,className:`inline-block w-3.5 h-3.5 ml-1 rounded-full border-2 border-transparent border-t-[var(--oh-border-input)] animate-spin`}):e.status===`complete`?(0,F.jsx)(`span`,{"data-testid":`goal-done`,className:`inline-flex ml-1`,children:(0,F.jsx)($e,{className:`w-3.5 h-3.5 fill-success`})}):(0,F.jsx)(`span`,{"data-testid":`goal-ended`,className:`inline-flex ml-1`,children:(0,F.jsx)(et,{className:`w-3.5 h-3.5 fill-[var(--oh-muted)]`})})]}),titleTrailing:S,details:v,initiallyExpanded:!o,chevronPosition:`before`})})}var rt=e=>(0,F.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:12,height:12,viewBox:`0 0 12 12`,fill:`none`,...e,children:[(0,F.jsxs)(`g`,{clipPath:`url(#clip0_17463_15006)`,children:[(0,F.jsx)(`path`,{d:`M6 11C8.76142 11 11 8.76142 11 6C11 3.23858 8.76142 1 6 1C3.23858 1 1 3.23858 1 6C1 8.76142 3.23858 11 6 11Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,F.jsx)(`path`,{d:`M6 8V6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,F.jsx)(`path`,{d:`M6 4H6.00667`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),(0,F.jsx)(`defs`,{children:(0,F.jsx)(`clipPath`,{id:`clip0_17463_15006`,children:(0,F.jsx)(`rect`,{width:12,height:12,fill:`white`})})})]});function it({profile:e}){let[t,n]=P.useState(!1);return(0,F.jsxs)(`div`,{className:`border border-neutral-700 rounded-md overflow-hidden`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,"aria-label":`Toggle details for ${e.name}`,className:`w-full py-1.5 px-2 text-left flex items-center gap-2 hover:bg-neutral-700 transition-colors cursor-pointer`,children:[(0,F.jsx)(`span`,{className:`text-neutral-300`,children:t?(0,F.jsx)(b,{size:14}):(0,F.jsx)(l,{size:14})}),(0,F.jsx)(`span`,{className:`font-normal text-neutral-200 text-sm`,children:e.name})]}),t&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`hr`,{className:`border-neutral-700`}),(0,F.jsx)(`div`,{className:`px-3 py-2 text-xs text-neutral-300 font-mono whitespace-pre-wrap`,children:`model: ${e.model??`—`}\nbase_url: ${e.base_url??`—`}\napi_key: ${e.api_key_set?`set`:`not set`}`})]})]})}function at({conversationId:e,anchorEventId:t}){let n=ye(e=>e.entriesByConversation),r=(e?n[e]??[]:[]).filter(e=>e.anchorEventId===t);return!e||r.length===0?null:(0,F.jsx)(`div`,{"data-testid":`model-messages`,className:`flex flex-col w-full`,children:r.map(e=>{if(e.switchedTo)return(0,F.jsx)(R,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(rt,{width:14,height:14,className:`shrink-0 text-neutral-400`,"aria-hidden":!0}),(0,F.jsx)(p,{i18nKey:h.MODEL$SWITCHED_TO_PROFILE,values:{name:e.switchedTo},components:{cmd:(0,F.jsx)(`span`,{className:`font-mono text-neutral-200 bg-neutral-800 px-1 rounded`})}})]}),details:``},e.id);let t=e.profiles.length===0;return(0,F.jsx)(R,{title:(0,F.jsx)(`span`,{children:t?(0,F.jsx)(p,{i18nKey:h.MODEL$NO_SAVED_PROFILES}):(0,F.jsx)(p,{i18nKey:h.MODEL$AVAILABLE_PROFILES,values:{count:e.profiles.length}})}),details:t?(0,F.jsx)(`span`,{className:`text-neutral-300 text-sm px-2 py-1 block`,children:(0,F.jsx)(p,{i18nKey:h.MODEL$NO_PROFILES_HINT})}):(0,F.jsx)(`div`,{className:`flex flex-col gap-1 mt-1`,children:e.profiles.map(e=>(0,F.jsx)(it,{profile:e},e.name))}),initiallyExpanded:t},e.id)})})}var ot=(0,P.createContext)(void 0);function st({children:e,value:t}){let n=Ve(P.useRef(null)),r=t||n;return(0,F.jsx)(ot.Provider,{value:r,children:e})}function ct(){let e=(0,P.useContext)(ot);if(e===void 0)throw Error(`useScrollContext must be used within a ScrollProvider`);return e}function lt(){return(0,P.useContext)(ot)}var ut=()=>{let{setConversationMode:e}=O(),{send:t}=Xe(),{conversationId:n}=A(),r=be(e=>e.enqueuePendingMessage),i=be(e=>e.markPendingMessageError);return{handleBuildPlanClick:(0,P.useCallback)(a=>{a?.preventDefault(),a?.stopPropagation(),e(`code`);let o=`Execute the plan based on the .agents_tmp/PLAN.md file.`,s=new Date().toISOString(),c=n?r({conversationId:n,text:o,timestamp:s}):null;t(Ze(o,[],[],s)).catch(e=>{c&&i(c,e instanceof Error?e.message:`Failed to send message`)})},[e,t,n,r,i])}},dt=`200%`,z=8,ft=z*2;function pt({children:e,as:t=`p`,className:n,duration:r=2,spread:i=2,style:a,...o}){let s=Je(),c=`oh-text-shimmer-${(0,P.useId)().replace(/:/g,``)}`,l=(0,P.useMemo)(()=>Math.min(z/2-1,1+i/2),[i]),u=(0,P.useMemo)(()=>{let e=z/2;return{...a,backgroundImage:`repeating-linear-gradient(90deg, var(--oh-muted) 0%, var(--oh-muted) ${e-l}%, var(--oh-foreground) ${e}%, var(--oh-muted) ${e+l}%, var(--oh-muted) ${z}%)`,backgroundSize:`${dt} 100%`,backgroundRepeat:`no-repeat`,WebkitBackgroundClip:`text`,backgroundClip:`text`,color:`transparent`,WebkitTextFillColor:`transparent`,animation:`${c} ${r}s linear infinite`}},[c,l,r,a]);return s?(0,F.jsx)(t,{className:w(`text-[var(--oh-muted)]`,n),style:a,...o,children:e}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`@keyframes ${c}{from{background-position:${ft}% center}to{background-position:0% center}}`}}),(0,F.jsx)(t,{className:w(`relative inline-block`,n),style:u,...o,children:e})]})}var mt=P.memo(pt);function ht({className:e}){return(0,F.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":!0,className:e,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,className:`fill-[var(--oh-foreground)] transition-colors duration-150 group-hover:fill-[var(--oh-text-secondary)]`}),(0,F.jsx)(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,className:`fill-[var(--oh-color-tertiary)]`})]})}var gt=5,_t=360,vt={p:({children:e})=>(0,F.jsx)(`p`,{className:`m-0 leading-6`,children:e})};function yt({message:e,isHovering:t,isExpanded:n,onTruncatableChange:r}){let{t:i}=m(`openhands`),a=P.useRef(null),[o,s]=P.useState(!1);P.useEffect(()=>{r(o)},[o,r]),P.useLayoutEffect(()=>{let t=a.current;if(!t||n){s(!1);return}let r=()=>{let n=Number.parseFloat(getComputedStyle(t).lineHeight),r=gt*(Number.isFinite(n)&&n>0?n:24),i=(e.match(/\n/g)??[]).length;s(t.scrollHeight>r+1||i>=gt||e.trim().length>_t)};r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e,n]);let c=o&&!n;return(0,F.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,F.jsx)(`div`,{ref:a,className:w(`text-sm leading-6 whitespace-normal [word-break:break-word]`,c&&`line-clamp-5`),children:(0,F.jsx)(N,{includeStandard:!0,includeHeadings:!0,allowHtml:!1,components:vt,children:e})}),c?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{"aria-hidden":!0,"data-testid":`chat-message-truncation-gradient`,className:`pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-tertiary to-transparent`}),(0,F.jsx)(`span`,{"data-testid":`chat-message-view-more`,className:w(`pointer-events-none absolute bottom-1 left-1/2 z-10 inline-flex -translate-x-1/2 items-center rounded-full border border-[var(--oh-border-subtle)] bg-[var(--oh-surface-raised)] px-2.5 py-0.5 text-xs font-normal text-[var(--oh-foreground)] transition-opacity duration-150`,t?`opacity-100`:`opacity-0`),children:i(h.COMMON$VIEW_MORE)})]}):null]})}function B({type:e,message:t,children:n,actions:r,isFromPlanningAgent:i=!1,pendingStatus:a,onRetry:o,onStop:s}){let{t:c}=m(`openhands`),[l,u]=P.useState(!1),[d,f]=P.useState(!1),[p,g]=P.useState(!1),[_,v]=P.useState(!1),[y,b]=P.useState(!0),x=P.useRef(null);P.useEffect(()=>{g(!1)},[t]);let S=async()=>{await navigator.clipboard.writeText(t),f(!0)};P.useEffect(()=>{let e;return d&&(e=setTimeout(()=>{f(!1)},2e3)),()=>{clearTimeout(e)}},[d]);let C=e===`user`&&(a===`error`||a===`sending`),T=a===`sending`&&s!=null,E=T&&l,D=e===`user`&&a==null,ee=D&&_&&!p,te=P.Children.count(n)>0;P.useLayoutEffect(()=>{if(!T||D)return;let e=x.current;if(!e)return;let t=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight),n=Number.isFinite(t)&&t>0?t:24;b(e.scrollHeight<=n+1)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[t,T,D]);let re=D?(0,F.jsx)(yt,{message:t,isHovering:l,isExpanded:p,onTruncatableChange:v}):(0,F.jsx)(`div`,{ref:x,className:`min-w-0 text-sm leading-6 whitespace-normal [word-break:break-word]`,children:(0,F.jsx)(N,{includeStandard:!0,includeHeadings:!0,allowHtml:e!==`user`,components:vt,children:t})}),ie=(0,F.jsxs)(`article`,{"data-testid":`${e}-message`,"data-pending-status":a,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),className:w(`rounded-xl relative w-fit max-w-full flex flex-col`,te&&`gap-2`,e===`user`&&`mt-6 bg-tertiary self-end px-4 py-2.5`,e===`agent`&&`mt-6 w-full max-w-full bg-transparent`,i&&e===`agent`&&`border border-[#597ff4] bg-tertiary p-4 mt-2`,a===`error`&&`border border-[var(--oh-status-error)]/40`,!C&&`last:mb-4`),children:[(0,F.jsxs)(`div`,{className:w(`absolute -top-2.5 -right-2.5 z-10`,!l||a===`sending`?`hidden`:`flex`,`items-center gap-1`),onClick:e=>e.stopPropagation(),children:[r?.map((e,t)=>e.tooltip?(0,F.jsx)(ne,{content:e.tooltip,placement:`top`,children:(0,F.jsx)(`button`,{type:`button`,onClick:e.onClick,className:`button-base p-1 cursor-pointer`,"aria-label":e.tooltip,children:e.icon})},t):(0,F.jsx)(`button`,{type:`button`,onClick:e.onClick,className:`button-base p-1 cursor-pointer`,"aria-label":`Action ${t+1}`,children:e.icon},t)),(0,F.jsx)(fe,{isHidden:!l,isDisabled:d,onClick:S,mode:d?`copied`:`copy`})]}),re,T?(0,F.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s?.()},"data-testid":`chat-message-stop`,"aria-label":c(h.BUTTON$STOP),"aria-hidden":!E,tabIndex:E?0:-1,className:w(`group absolute z-10 inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded-full bg-[var(--oh-color-tertiary)] text-[var(--oh-foreground)] transition-opacity duration-150`,y?`right-3 top-1/2 -translate-y-1/2`:`right-3 bottom-2.5`,E?`opacity-100`:`pointer-events-none opacity-0`),children:(0,F.jsx)(ht,{className:`block h-7 w-7 max-w-none`})}):null,ee?(0,F.jsx)(`button`,{type:`button`,"data-testid":`chat-message-expand`,"aria-expanded":!1,"aria-label":c(h.COMMON$VIEW_MORE),className:`absolute inset-0 z-[1] cursor-pointer rounded-xl border-0 bg-transparent p-0`,onClick:()=>g(!0)}):null,n]});return e===`user`&&a===`error`?(0,F.jsxs)(`div`,{className:`flex w-fit max-w-full flex-col items-end gap-1.5 self-end last:mb-4`,children:[ie,(0,F.jsxs)(`div`,{role:`alert`,"data-testid":`chat-message-error`,className:`flex items-center gap-2 text-xs text-[var(--oh-status-error)]`,children:[(0,F.jsx)(`span`,{children:c(h.CHAT_INTERFACE$MESSAGE_SEND_FAILED)}),o?(0,F.jsx)(`button`,{type:`button`,onClick:o,className:`cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`chat-message-retry`,children:c(h.CHAT_INTERFACE$MESSAGE_RETRY)}):null]})]}):e===`user`&&a===`sending`?(0,F.jsxs)(`div`,{className:`flex w-full max-w-full flex-col last:mb-4`,children:[ie,(0,F.jsx)(`div`,{className:`my-1 w-full py-1 text-sm`,children:(0,F.jsx)(mt,{as:`p`,role:`status`,"aria-live":`polite`,"data-testid":`chat-message-sending`,className:`block w-full text-sm font-normal`,duration:1,spread:2,children:c(h.CHAT_INTERFACE$MESSAGE_SENDING)})})]}):ie}function bt(){let{conversationId:e}=me(),{selectedTab:t,isRightPanelShown:n,setHasRightPanelToggled:r,setSelectedTab:i}=O(),{setSelectedTab:a}=ie(e),o=e=>{i(e),a(e)};return{selectTab:e=>{t===e&&n?r(!1):(o(e),n||r(!0))},navigateToTab:e=>{o(e),n||r(!0)},isTabActive:e=>n&&t===e,onTabChange:o,selectedTab:t,isRightPanelShown:n}}var xt=300,St=He(`shine-text`);function Ct({planContent:e,isStreaming:t,isBuildDisabled:n}){let{t:r}=m(`openhands`),{navigateToTab:i}=bt(),{handleBuildPlanClick:a}=ut(),{scrollDomToBottom:o}=ct(),s=()=>{i(`planner`)},c=(0,P.useCallback)(e=>{a(e),o()},[a,o]),l=(0,P.useMemo)(()=>e?e.length<=xt?e:`${e.slice(0,xt)}...`:``,[e]);return e?(0,F.jsxs)(`div`,{className:`bg-[var(--oh-surface)] border border-[#597FF4] rounded-[12px] w-full mt-2`,children:[(0,F.jsxs)(`div`,{className:`border-b border-[var(--oh-border)] flex h-[41px] items-center px-2 gap-1`,children:[(0,F.jsx)(Ce,{width:18,height:18,color:`var(--oh-muted)`}),(0,F.jsx)(k.Text,{className:`font-normal text-[11px] text-white tracking-[0.11px] leading-4`,children:r(h.COMMON$PLAN_MD)}),(0,F.jsx)(`div`,{className:`flex-1`}),(0,F.jsxs)(`button`,{type:`button`,onClick:s,className:`flex items-center gap-1 hover:opacity-80 transition-opacity cursor-pointer`,"data-testid":`plan-preview-view-button`,children:[(0,F.jsx)(k.Text,{className:`font-normal text-[11px] text-white tracking-[0.11px] leading-4`,children:r(h.COMMON$VIEW)}),(0,F.jsx)(qe,{className:`text-white`,size:18})]})]}),(0,F.jsx)(`div`,{"data-testid":`plan-preview-content`,className:`flex flex-col gap-[10px] p-4 text-[15px] text-white leading-[29px]`,children:l&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(N,{includeStandard:!0,components:t?St:Be,children:l}),e&&e.length>xt&&(0,F.jsx)(`button`,{type:`button`,onClick:s,className:`text-[#4a67bd] cursor-pointer hover:underline text-left`,"data-testid":`plan-preview-read-more-button`,children:r(h.COMMON$READ_MORE)})]})}),(0,F.jsx)(`div`,{className:`border-t border-[var(--oh-border)] flex h-[54px] items-center justify-start px-4`,children:(0,F.jsx)(`button`,{type:`button`,onClick:c,disabled:n,className:w(`bg-white flex items-center justify-center h-[26px] px-2 rounded-[4px] w-[93px] transition-opacity`,n?`opacity-50 cursor-not-allowed`:`hover:opacity-90 cursor-pointer`),"data-testid":`plan-preview-build-button`,children:(0,F.jsxs)(k.Text,{className:`font-normal text-[14px] text-black leading-5`,children:[r(h.COMMON$BUILD),` `,(0,F.jsx)(k.Text,{className:`font-normal text-black`,children:`⌘↩`})]})})})]}):null}function wt({errorId:e,defaultMessage:t}){let{t:n}=m(`openhands`),[r,i]=P.useState(!1);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 my-2 py-2 text-sm w-full`,children:[(0,F.jsxs)(`div`,{className:`font-bold text-danger`,children:[n(e&&g.exists(e)?e:`CHAT_INTERFACE$AGENT_ERROR_MESSAGE`),(0,F.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`cursor-pointer text-left`,children:r?(0,F.jsx)(L,{className:`h-4 w-4 ml-2 inline fill-danger`}):(0,F.jsx)(I,{className:`h-4 w-4 ml-2 inline fill-danger`})})]}),r&&(0,F.jsx)(N,{children:t})]})}function Tt({event:e}){return Ae(e)?(0,F.jsx)(wt,{errorId:e.id,defaultMessage:e.error}):null}function Et({width:e=20,height:t=20,active:n}){return(0,F.jsx)(`svg`,{width:e,height:t,viewBox:`0 0 ${e} ${t}`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,F.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.204 15.0037L6.65511 9.99993L11.204 4.99617L12.1289 5.83701L8.34444 9.99993L12.1289 14.1628L11.204 15.0037Z`,fill:n?`var(--oh-text-tertiary)`:`var(--oh-border)`})})}function Dt({width:e=20,height:t=20,active:n}){return(0,F.jsx)(`svg`,{width:e,height:t,viewBox:`0 0 ${e} ${t}`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,F.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.79602 4.99634L13.3449 10.0001L8.79602 15.0038L7.87109 14.163L11.6556 10.0001L7.87109 5.83718L8.79602 4.99634Z`,fill:n?`var(--oh-text-tertiary)`:`var(--oh-border)`})})}function Ot({onClick:e,className:t}){return(0,F.jsx)(`button`,{type:`button`,onClick:e,className:w(`bg-[var(--oh-muted)] rounded-full w-5 h-5 flex items-center justify-center cursor-pointer`,t),children:(0,F.jsx)(de,{width:18,height:18})})}function kt({src:e,size:t=`small`}){return(0,F.jsx)(`img`,{role:`img`,alt:``,src:e,className:w(`rounded-sm object-cover`,t===`small`&&`w-[62px] h-[62px]`,t===`large`&&`w-[100px] h-[100px]`)})}function At({src:e,onRemove:t,size:n=`small`}){return(0,F.jsxs)(`div`,{"data-testid":`image-preview`,className:`relative w-fit shrink-0 py-1`,children:[(0,F.jsx)(kt,{src:e,size:n}),t&&(0,F.jsx)(Ot,{onClick:t,className:`absolute right-[3px] top-[3px] cursor-pointer`})]})}function jt({size:e=`small`,images:t,onRemove:n}){let r=P.useRef(null),[i,a]=P.useState(!1),[o,s]=P.useState(!0),[c,l]=P.useState(!1);return P.useEffect(()=>{let e=r.current;e&&a(e.scrollWidth>e.clientWidth)},[t]),(0,F.jsxs)(`div`,{"data-testid":`image-carousel`,className:`relative`,children:[i&&(0,F.jsx)(`div`,{className:`absolute right-full transform top-1/2 -translate-y-1/2`,children:(0,F.jsx)(Et,{active:!o})}),(0,F.jsx)(`div`,{ref:r,onScroll:e=>{let t=e.currentTarget;s(t.scrollLeft===0),l(t.scrollLeft+t.clientWidth===t.scrollWidth)},className:w(`flex overflow-x-auto`,e===`small`&&`gap-2`,e===`large`&&`gap-4`),children:t.map((t,r)=>(0,F.jsx)(At,{size:e,src:t,onRemove:n?()=>n?.(r):void 0},r))}),i&&(0,F.jsx)(`div`,{className:`absolute left-full transform top-1/2 -translate-y-1/2`,children:(0,F.jsx)(Dt,{active:!c})})]})}function Mt({type:e,onClick:t}){let{t:n}=m(`openhands`),r=e===`confirm`,i=n(r?h.ACTION$CONFIRM:h.ACTION$REJECT),a=n(r?h.CHAT_INTERFACE$USER_CONFIRMED:h.CHAT_INTERFACE$USER_REJECTED),o=r?`${n(h.CHAT_INTERFACE$INPUT_CONTINUE_MESSAGE)} ⌘↩`:`${n(h.BUTTON$CANCEL)} ⇧⌘⌫`;return(0,F.jsx)(ne,{closeDelay:100,content:a,children:(0,F.jsx)(`button`,{"data-testid":`action-${e}-button`,type:`button`,"aria-label":i,className:w(`rounded px-2 h-6.5 text-sm font-normal leading-5 cursor-pointer hover:opacity-80`,e===`confirm`?`bg-tertiary text-white`:`bg-white text-base`),onClick:t,children:o})})}function Nt({className:e,content:t,icon:n,severity:r,title:i}){return r===`high`?(0,F.jsxs)(`div`,{className:w(`flex items-center gap-3.5 bg-[#4A0709] border border-[#FF0006] text-red-400 rounded-xl px-3.5 h-13 text-sm text-white`,e),children:[n&&(0,F.jsx)(`span`,{className:``,children:n}),(0,F.jsx)(`span`,{className:`font-bold`,children:i}),(0,F.jsx)(`span`,{className:`font-normal`,children:t})]}):null}var Pt=e=>(0,F.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,F.jsx)(`path`,{d:`M12 14C11.4477 14 11 13.5523 11 13V10C11 9.44772 11.4477 9 12 9C12.5523 9 13 9.44772 13 10V13C13 13.5523 12.5523 14 12 14Z`,fill:`currentColor`}),(0,F.jsx)(`path`,{d:`M10.5 16.5C10.5 15.6716 11.1716 15 12 15C12.8284 15 13.5 15.6716 13.5 16.5C13.5 17.3284 12.8284 18 12 18C11.1716 18 10.5 17.3284 10.5 16.5Z`,fill:`currentColor`}),(0,F.jsx)(`path`,{d:`M10.2301 3.2156C10.98 1.79093 13.02 1.79092 13.7698 3.2156L22.1135 19.0685C22.8144 20.4003 21.8486 22 20.3436 22H3.65635C2.15133 22 1.18556 20.4003 1.88651 19.0685L10.2301 3.2156ZM20.3436 20L12 4.1471L3.65635 20L20.3436 20Z`,fill:`currentColor`})]}),Ft=re(e=>({submittedEventIds:[],addSubmittedEventId:t=>e(e=>({submittedEventIds:[...e.submittedEventIds,t]})),removeSubmittedEventId:t=>e(e=>({submittedEventIds:e.submittedEventIds.filter(e=>e!==t)}))})),It=()=>f({mutationKey:[`respond-to-confirmation`],mutationFn:async({conversationId:e,conversationUrl:t,sessionApiKey:n,accept:r})=>{let i={accept:r};return ve.respondToConfirmation(e,t,i,n)}});function Lt(){let e=Ft(e=>e.submittedEventIds),t=Ft(e=>e.addSubmittedEventId),{t:n}=m(`openhands`),{data:r}=he(),{curAgentState:i}=_e(),{mutate:a}=It(),o=Pe(e=>e.events).slice().reverse().find(e=>e.source===`agent`?i===S.AWAITING_USER_CONFIRMATION:!1),s=(0,P.useCallback)(e=>{!o||!r||(t(o.id),a({conversationId:r.id,conversationUrl:r.conversation_url||``,sessionApiKey:r.session_api_key,accept:e}))},[o,r,t,a]);return(0,P.useEffect)(()=>{if(!o)return;let e=e=>{e.shiftKey&&e.metaKey&&e.key===`Backspace`&&(e.preventDefault(),s(!1))},t=e=>{e.metaKey&&e.key===`Enter`&&(e.preventDefault(),s(!0))},n=n=>{e(n),t(n)};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[o,s]),i!==S.AWAITING_USER_CONFIRMATION||!o||e.includes(o.id)?null:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 pt-4`,children:[(M(o)?o.security_risk:T.UNKNOWN)===T.HIGH&&(0,F.jsx)(Nt,{content:n(h.CHAT_INTERFACE$HIGH_RISK_WARNING),icon:(0,F.jsx)(Pt,{width:16,height:16,color:`#fff`}),severity:`high`,title:n(h.COMMON$HIGH_RISK)}),(0,F.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,F.jsx)(`p`,{className:`text-sm font-normal text-white`,children:n(h.CHAT_INTERFACE$USER_ASK_CONFIRMATION)}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(Mt,{type:`reject`,onClick:()=>s(!1)}),(0,F.jsx)(Mt,{type:`confirm`,onClick:()=>s(!0)})]})]})]})}var Rt=e=>{let t=e.llm_message;if(!t?.content)return``;let n=``;if(t.content&&(Array.isArray(t.content)?n=t.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
2
2
  `):typeof t.content==`string`&&(n=t.content)),!(Array.isArray(t.content)&&t.content.some(e=>e.type===`image`)))return n;let r=g.t(h.CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE);return n.split(r)[0]};function zt(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function Bt(e){let t=Math.round(e*5);return{filled:t,empty:5-t}}function Vt(e){return e>=.6?`text-green-400`:e>=.4?`text-yellow-400`:`text-red-400`}function Ht(e){return e>=.7?`text-red-400 font-semibold`:e>=.5?`text-yellow-400`:`text-neutral-400`}function Ut(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wt(e){let t=e?.verification;if(!Ut(t))return null;let n=t.enable_iterative_refinement;return typeof n==`boolean`?n:null}function Gt({feature:e}){let t=Math.round(e.probability*100),n=Ht(e.probability);return(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`text-neutral-200`,children:e.display_name}),(0,F.jsxs)(`span`,{className:n,children:[`(`,t,`%)`]})]})}function V({label:e,features:t}){return!t||t.length===0?null:(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1 text-xs`,children:[(0,F.jsx)(`span`,{className:`font-semibold text-neutral-300`,children:e}),t.map((e,t)=>(0,F.jsxs)(P.Fragment,{children:[t>0&&(0,F.jsx)(`span`,{className:`text-neutral-500`,children:`·`}),(0,F.jsx)(Gt,{feature:e})]},e.name))]})}function Kt({categorized:e}){let{t}=m(),n=e.agent_behavioral_issues&&e.agent_behavioral_issues.length>0,r=e.user_followup_patterns&&e.user_followup_patterns.length>0,i=e.infrastructure_issues&&e.infrastructure_issues.length>0,a=e.other&&e.other.length>0;return!n&&!r&&!i&&!a?null:(0,F.jsxs)(`div`,{className:`flex flex-col gap-1 mt-1.5`,children:[n&&(0,F.jsx)(V,{label:t(h.CRITIC$POTENTIAL_ISSUES),features:e.agent_behavioral_issues}),i&&(0,F.jsx)(V,{label:t(h.CRITIC$INFRASTRUCTURE),features:e.infrastructure_issues}),r&&(0,F.jsx)(V,{label:t(h.CRITIC$LIKELY_FOLLOWUP),features:e.user_followup_patterns}),a&&(0,F.jsx)(V,{label:t(h.CRITIC$OTHER),features:e.other})]})}function qt({criticResult:e}){let{t}=m(),{data:n}=ae(),[r,i]=P.useState(!1),a=zt(e.score),{filled:o,empty:s}=Bt(a),c=Vt(a),l=(a*100).toFixed(1),u=Wt(n?.agent_settings)===!1,d=e.metadata?.categorized_features,f=d!=null&&((d.agent_behavioral_issues??[]).length>0||(d.user_followup_patterns??[]).length>0||(d.infrastructure_issues??[]).length>0||(d.other??[]).length>0);return(0,F.jsxs)(`div`,{className:`border-l-2 border-neutral-600 pl-2 my-2 py-1.5 text-sm`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`font-semibold text-neutral-300 text-xs`,children:t(h.CRITIC$SUCCESS_LIKELIHOOD_LABEL)}),(0,F.jsxs)(`span`,{className:`${c} text-xs tracking-wide`,"aria-label":`Score: ${l}%`,children:[`★`.repeat(o),`☆`.repeat(s)]}),(0,F.jsxs)(`span`,{className:`text-neutral-500 text-xs`,children:[`(`,l,`%)`]}),f&&(0,F.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`cursor-pointer ml-1`,"aria-label":t(r?h.BUTTON$COLLAPSE_DETAILS:h.BUTTON$EXPAND_DETAILS),children:r?(0,F.jsx)(L,{className:`h-3 w-3 inline fill-neutral-400`}):(0,F.jsx)(I,{className:`h-3 w-3 inline fill-neutral-400`})})]}),r&&f&&(0,F.jsx)(Kt,{categorized:d}),u&&(0,F.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-neutral-500`,"data-testid":`critic-iterative-refinement-hint`,children:t(h.CRITIC$ITERATIVE_REFINEMENT_HINT)})]})}function H({content:e}){let{t}=m(`openhands`),[n,r]=P.useState(!1);if(!e.trim())return null;let i=n?L:I;return(0,F.jsxs)(`div`,{className:`my-1 w-full py-1 text-sm`,"data-testid":`collapsible-thinking`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,"aria-label":t(n?h.THINKING$COLLAPSE:h.THINKING$EXPAND),"data-testid":`collapsible-thinking-toggle`,className:`w-full flex items-center gap-2 text-left cursor-pointer`,children:[(0,F.jsx)(i,{className:`h-4 w-4 fill-[var(--oh-muted)] flex-shrink-0`}),(0,F.jsx)(Ue,{className:`h-4 w-4 fill-[var(--oh-muted)] flex-shrink-0`}),(0,F.jsx)(`span`,{className:`font-normal text-[var(--oh-muted)]`,children:t(h.THINKING$TITLE)})]}),n&&(0,F.jsx)(`div`,{className:`mt-1.5 pl-6`,"data-testid":`collapsible-thinking-content`,children:(0,F.jsx)(N,{children:e})})]})}var Jt=()=>{let e=o();return f({mutationKey:[`fork-conversation`],mutationFn:async({sourceConversationId:e,eventId:t,editText:n,title:r})=>{let i=t,a=!1;if(n!=null){let n=await oe.getEventParentId(e,t);n&&(i=n,a=!0)}let o=await oe.forkConversation(e,i,r);return a&&o.leaf_event_id!==i&&(a=!1),{info:o,excluded:a}},onSuccess:()=>{e.invalidateQueries({queryKey:[`user`,`conversations`]})}})};function Yt({event:e,isLastMessage:t,isFromPlanningAgent:n}){let{t:r}=m(`openhands`),{navigate:i}=te(),{conversationId:a}=A(),o=v().backend.kind===`cloud`,{mutate:s,isPending:c}=Jt(),l=O(e=>e.setMessageToSend),d=P.useRef(!1),f=Rt(e),{reasoning:p,message:g}=e.source===`agent`?Me(f):{reasoning:``,message:f},y=[];Array.isArray(e.llm_message.content)&&e.llm_message.content.forEach(e=>{e.type===`image`&&y.push(...e.image_urls)});let b=!o&&a?[{icon:(0,F.jsx)(u,{width:15,height:15,"aria-hidden":!0}),onClick:()=>{if(!a||c||d.current)return;d.current=!0;let t=ce.getCurrentConversation(),n=t?.id===a?t.title:void 0,r=n?`${n} (branch)`:void 0,o=e.source===`user`&&g.length>0;s({sourceConversationId:a,eventId:e.id,...o?{editText:g}:{},...r?{title:r}:{}},{onSuccess:({info:e,excluded:t})=>{i(`/conversations/${e.id}`),t&&window.setTimeout(()=>l(g),0)},onError:e=>_(e instanceof Error?e.message:null),onSettled:()=>{d.current=!1}})},tooltip:r(h.CHAT_INTERFACE$BRANCH_FROM_HERE)}]:void 0;return(0,F.jsxs)(F.Fragment,{children:[p&&(0,F.jsx)(H,{content:p}),(0,F.jsxs)(B,{type:e.source,message:g,isFromPlanningAgent:n,actions:b,children:[y.length>0&&(0,F.jsx)(jt,{size:`small`,images:y}),t&&(0,F.jsx)(Lt,{})]}),e.source===`agent`&&e.critic_result!=null&&(0,F.jsx)(qt,{criticResult:e.critic_result})]})}var Xt=class{static isDevMode=!1;static message(e){this.isDevMode&&console.warn(JSON.stringify(JSON.parse(e.data.toString()),null,2))}static event(e,t){this.isDevMode&&console.warn(t||`EVENT`,e)}static warning(e){this.isDevMode&&console.warn(e)}static error(e){this.isDevMode&&console.error(e)}},Zt=e=>{let t=document.createElement(`textarea`);return t.innerHTML=e,t.value};function Qt(e){let{children:t}=e,n=e=>{try{return Zt(e)}catch(t){return Xt.error(String(t)),e}};return Array.isArray(t)?(0,F.jsx)(`strong`,{className:`font-mono`,children:t.map(e=>typeof e==`string`?n(e):e)}):typeof t==`string`?(0,F.jsx)(`strong`,{className:`font-mono`,children:n(t)}):(0,F.jsx)(`strong`,{className:`font-mono`,children:t})}var $t=e=>{let t=document.createElement(`textarea`);return t.innerHTML=e,t.value},en=e=>e?e.endsWith(`/`)||e.endsWith(`\\`)?!0:!(e.split(/[/\\]/).pop()||``).includes(`.`):!1,tn=e=>{if(!e)return``;let t=e.split(/[/\\]/),n=t[t.length-1];return en(e)&&!n.endsWith(`/`)?`${n}/`:n};function nn(e){let{children:t}=e,n=e=>{try{let t=$t(e);return(0,F.jsx)(`span`,{className:`font-mono`,title:t,children:tn(t)})}catch(t){return Xt.error(String(t)),(0,F.jsx)(`span`,{className:`font-mono`,children:e})}};return Array.isArray(t)?(0,F.jsx)(`strong`,{className:`font-mono`,children:t.map((e,t)=>typeof e==`string`?(0,F.jsx)(`span`,{children:n(e)},`${e}-${t}`):e)}):typeof t==`string`?(0,F.jsx)(`strong`,{children:n(t)}):(0,F.jsx)(`strong`,{className:`font-mono`,children:t})}var U=1e3,rn=e=>`\`\`\`json\n${JSON.stringify(e,null,2)}\n\`\`\``,an=e=>{switch(e){case T.LOW:return g.t(h.SECURITY$LOW_RISK);case T.MEDIUM:return g.t(h.SECURITY$MEDIUM_RISK);case T.HIGH:return g.t(h.SECURITY$HIGH_RISK);case T.UNKNOWN:default:return g.t(h.SECURITY$UNKNOWN_RISK)}},W=()=>``,on=e=>e.name?`**Skill:** \`${e.name}\``:W(),sn=e=>{let{action:t}=e,n=[];return t.pattern&&n.push(`**Pattern:** \`${t.pattern}\``),t.path&&n.push(`**Path:** \`${t.path}\``),`include`in t&&t.include&&n.push(`**Include:** \`${t.include}\``),n.length>0?n.join(`
3
3
  `):W()},cn=e=>{if(e.command!==`create`||!e.file_text)return W();let t=e.file_text;return t.length>1e3&&(t=`${t.slice(0,U)}...`),`${e.path}\n${t}`},ln=e=>{let t=`Command:\n\`${e.action.command}\``;return(e.security_risk===T.HIGH||e.security_risk===T.MEDIUM)&&(t+=`\n\n${an(e.security_risk)}`),t},un=e=>{let t=`**MCP Tool Call**
4
4
 
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n,i as r,n as i,r as a}from"./vendor-styling-CI0PQ3ab.js";import{t as o}from"./useQuery-D5pEZbY0.js";import{t as s}from"./useTranslation-Cbf5AGg_.js";import{t as c}from"./declaration-BGsHjPEW.js";import{P as l,t as u}from"./utils-DB9LsAzA.js";import{_ as d,d as f}from"./agent-server-compatibility-BWN-EIQn.js";import{m as p}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{t as m}from"./proxy-B3tCGf0X.js";import{f as h}from"./form-control-classes-CbdN5aO3.js";import{i as g}from"./combobox-caret-CxZpqoSR.js";import{n as _}from"./map-provider-BbIb12oh.js";import{g as v}from"./sdk-settings-schema-CLR01YIK.js";var y=e(t(),1),b=e=>{let[t,...n]=e.split(`/`);return!t||n.length===0?{provider:``,model:e,separator:``}:{provider:t,model:n.join(`/`),separator:`/`}};function x(e,t){if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(n))}function S(e,t){return t===void 0?e:e.filter(e=>e.verified===t)}function C(e,t){return!t||t<=0?e:e.slice(0,t)}function w(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}var T=class{static async searchModels(e={},t){let n=d();if(n.backend.kind===`cloud`){let t=w({page_id:e.page_id,limit:e.limit,query:e.query,verified__eq:e.verified__eq,provider__eq:e.provider__eq});return m({backend:n.backend,method:`GET`,path:`/api/v1/config/models/search${t}`})}let r=new p(f()),i=t===void 0?r.getVerifiedModels():Promise.resolve(t),[a,o]=await Promise.all([r.getModels(),i]),s=e.provider__eq??null,c=new Set(s?o?.[s]??[]:[]),l=[...c].map(e=>({provider:s,name:e,verified:!0})),u=s?(a??[]).filter(e=>e.startsWith(`${s}/`)).map(e=>e.slice(s.length+1)).filter(e=>e.length>0&&!c.has(e)).map(e=>({provider:s,name:e,verified:!1})):[];return{items:C(S(x([...l,...u],e.query),e.verified__eq),e.limit),next_page_id:null}}static async searchProviders(e={},t){let n=d();if(n.backend.kind===`cloud`){let t=w({page_id:e.page_id,limit:e.limit,query:e.query,verified__eq:e.verified__eq});return m({backend:n.backend,method:`GET`,path:`/api/v1/config/providers/search${t}`})}let r=new p(f()),i=t===void 0?r.getVerifiedModels():Promise.resolve(t),[a,o]=await Promise.all([r.getProviders(),i]),s=new Set(Object.keys(o??{}));return{items:C(S(x([...new Set([...s,...a??[]])].map(e=>({name:e,verified:s.has(e)})),e.query),e.verified__eq),e.limit),next_page_id:null}}},E=[`config`,`verified-models`],D=1e3*60*5,O=1e3*60*15;async function k(){return d().backend.kind===`cloud`?{}:await new p(f()).getVerifiedModels()??{}}var A=()=>o({queryKey:[`config`,`providers`],queryFn:async({client:e})=>{let t=await e.fetchQuery({queryKey:E,queryFn:k,staleTime:D});return(await T.searchProviders({limit:100},t)).items},staleTime:D,gcTime:O}),j=10;async function M(e,t,n,r=0){if(r>=j)throw Error(`Too many pagination requests for provider ${e}`);let i=await T.searchModels({provider__eq:e,limit:100,page_id:n},t);if(i.next_page_id){let n=await M(e,t,i.next_page_id,r+1);return[...i.items,...n]}return i.items}var N=e=>o({queryKey:[`config`,`models`,e],queryFn:async({client:t})=>M(e,await t.fetchQuery({queryKey:E,queryFn:k,staleTime:D})),enabled:!!e,staleTime:D,gcTime:O}),P=n();function F({isDisabled:e,currentModel:t,onChange:n,onDefaultValuesChanged:o,wrapperClassName:d,labelClassName:f}){let[,p]=y.useState(null),[m,x]=y.useState(null),[S,C]=y.useState(null),{data:w=[]}=A(),{data:T=[],isLoading:E,error:D}=N(m),O=y.useMemo(()=>w.filter(e=>e.verified),[w]),k=y.useMemo(()=>w.filter(e=>!e.verified),[w]),j=y.useMemo(()=>T.filter(e=>e.verified),[T]),M=y.useMemo(()=>T.filter(e=>!e.verified),[T]);y.useEffect(()=>{if(t){let{provider:e,model:n}=b(t);p(t),x(e||null),C(n),o?.(e||null,n)}},[t]);let F=e=>{x(e),C(null),p(`${e}/`),n?.(e,null)},I=e=>{let t=`${m}/${e}`;m===`openai`&&(t=e),p(t),C(e),n?.(m,e)},L=()=>{x(null),p(null)},{t:R}=s(`openhands`);return(0,P.jsxs)(`div`,{className:u(`flex flex-col md:flex-row w-full min-w-0 justify-between gap-4 md:gap-[46px]`,d),children:[(0,P.jsxs)(`fieldset`,{className:`flex flex-col gap-2.5 w-full`,children:[(0,P.jsx)(`label`,{className:u(`text-sm`,f),children:R(c.LLM$PROVIDER)}),(0,P.jsxs)(i,{"data-testid":`llm-provider-input`,isRequired:!0,isVirtualized:!1,name:`llm-provider-input`,isDisabled:e,"aria-label":R(c.LLM$PROVIDER),isClearable:!1,onSelectionChange:e=>{e?.toString()&&F(e.toString())},onInputChange:e=>!e&&L(),defaultSelectedKey:m??void 0,selectedKey:m,classNames:{popoverContent:`bg-content1 rounded-xl border border-[var(--oh-border)]`,selectorButton:g},selectorButtonProps:{disableRipple:!0},inputProps:{classNames:{inputWrapper:h}},children:[(0,P.jsx)(a,{title:R(c.MODEL_SELECTOR$VERIFIED),classNames:{heading:`text-[var(--oh-muted)]`},children:O.map(e=>(0,P.jsx)(r,{"data-testid":`provider-item-${e.name}`,children:_(e.name)},e.name))}),k.length>0?(0,P.jsx)(a,{title:R(c.MODEL_SELECTOR$OTHERS),classNames:{heading:`text-[var(--oh-muted)]`},children:k.map(e=>(0,P.jsx)(r,{children:_(e.name)},e.name))}):null]})]}),m===`openhands`&&(0,P.jsx)(v,{testId:`openhands-account-help`,text:R(c.SETTINGS$NEED_OPENHANDS_ACCOUNT),linkText:R(c.SETTINGS$CLICK_HERE),href:l.PRODUCTION,size:`settings`,linkColor:`white`}),(0,P.jsxs)(`fieldset`,{className:`flex flex-col gap-2.5 w-full`,children:[(0,P.jsx)(`label`,{className:u(`text-sm`,f),children:R(c.LLM$MODEL)}),(0,P.jsxs)(i,{"data-testid":`llm-model-input`,isRequired:!0,isVirtualized:!1,isLoading:E,name:`llm-model-input`,"aria-label":R(c.LLM$MODEL),isClearable:!1,onSelectionChange:e=>{e?.toString()&&I(e.toString())},isDisabled:e||!m,selectedKey:S,defaultSelectedKey:S??void 0,classNames:{popoverContent:`bg-content1 rounded-xl border border-[var(--oh-border)]`,selectorButton:g},selectorButtonProps:{disableRipple:!0},inputProps:{classNames:{inputWrapper:h}},children:[(0,P.jsx)(a,{title:R(c.MODEL_SELECTOR$VERIFIED),classNames:{heading:`text-[var(--oh-muted)]`},children:j.map(e=>(0,P.jsx)(r,{children:e.name},e.name))}),M.length>0?(0,P.jsx)(a,{title:R(c.MODEL_SELECTOR$OTHERS),classNames:{heading:`text-[var(--oh-muted)]`},children:M.map(e=>(0,P.jsx)(r,{"data-testid":`model-item-${e.name}`,children:e.name},e.name))}):null]}),D&&(0,P.jsx)(`p`,{"data-testid":`models-error`,className:`text-danger text-xs`,children:R(c.CONFIGURATION$ERROR_FETCH_MODELS)})]})]})}export{b as n,F as t};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n,i as r,n as i,r as a}from"./vendor-styling-CI0PQ3ab.js";import{t as o}from"./useQuery-D5pEZbY0.js";import{t as s}from"./useTranslation-Cbf5AGg_.js";import{t as c}from"./declaration-BGsHjPEW.js";import{P as l,t as u}from"./utils-DB9LsAzA.js";import{_ as d,d as f}from"./agent-server-compatibility-C0MtTTwb.js";import{m as p}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{t as m}from"./proxy-G4ce0fnQ.js";import{f as h}from"./form-control-classes-CbdN5aO3.js";import{i as g}from"./combobox-caret-CxZpqoSR.js";import{n as _}from"./map-provider-BbIb12oh.js";import{g as v}from"./sdk-settings-schema-CLR01YIK.js";var y=e(t(),1),b=e=>{let[t,...n]=e.split(`/`);return!t||n.length===0?{provider:``,model:e,separator:``}:{provider:t,model:n.join(`/`),separator:`/`}};function x(e,t){if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(n))}function S(e,t){return t===void 0?e:e.filter(e=>e.verified===t)}function C(e,t){return!t||t<=0?e:e.slice(0,t)}function w(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}var T=class{static async searchModels(e={},t){let n=d();if(n.backend.kind===`cloud`){let t=w({page_id:e.page_id,limit:e.limit,query:e.query,verified__eq:e.verified__eq,provider__eq:e.provider__eq});return m({backend:n.backend,method:`GET`,path:`/api/v1/config/models/search${t}`})}let r=new p(f()),i=t===void 0?r.getVerifiedModels():Promise.resolve(t),[a,o]=await Promise.all([r.getModels(),i]),s=e.provider__eq??null,c=new Set(s?o?.[s]??[]:[]),l=[...c].map(e=>({provider:s,name:e,verified:!0})),u=s?(a??[]).filter(e=>e.startsWith(`${s}/`)).map(e=>e.slice(s.length+1)).filter(e=>e.length>0&&!c.has(e)).map(e=>({provider:s,name:e,verified:!1})):[];return{items:C(S(x([...l,...u],e.query),e.verified__eq),e.limit),next_page_id:null}}static async searchProviders(e={},t){let n=d();if(n.backend.kind===`cloud`){let t=w({page_id:e.page_id,limit:e.limit,query:e.query,verified__eq:e.verified__eq});return m({backend:n.backend,method:`GET`,path:`/api/v1/config/providers/search${t}`})}let r=new p(f()),i=t===void 0?r.getVerifiedModels():Promise.resolve(t),[a,o]=await Promise.all([r.getProviders(),i]),s=new Set(Object.keys(o??{}));return{items:C(S(x([...new Set([...s,...a??[]])].map(e=>({name:e,verified:s.has(e)})),e.query),e.verified__eq),e.limit),next_page_id:null}}},E=[`config`,`verified-models`],D=1e3*60*5,O=1e3*60*15;async function k(){return d().backend.kind===`cloud`?{}:await new p(f()).getVerifiedModels()??{}}var A=()=>o({queryKey:[`config`,`providers`],queryFn:async({client:e})=>{let t=await e.fetchQuery({queryKey:E,queryFn:k,staleTime:D});return(await T.searchProviders({limit:100},t)).items},staleTime:D,gcTime:O}),j=10;async function M(e,t,n,r=0){if(r>=j)throw Error(`Too many pagination requests for provider ${e}`);let i=await T.searchModels({provider__eq:e,limit:100,page_id:n},t);if(i.next_page_id){let n=await M(e,t,i.next_page_id,r+1);return[...i.items,...n]}return i.items}var N=e=>o({queryKey:[`config`,`models`,e],queryFn:async({client:t})=>M(e,await t.fetchQuery({queryKey:E,queryFn:k,staleTime:D})),enabled:!!e,staleTime:D,gcTime:O}),P=n();function F({isDisabled:e,currentModel:t,onChange:n,onDefaultValuesChanged:o,wrapperClassName:d,labelClassName:f}){let[,p]=y.useState(null),[m,x]=y.useState(null),[S,C]=y.useState(null),{data:w=[]}=A(),{data:T=[],isLoading:E,error:D}=N(m),O=y.useMemo(()=>w.filter(e=>e.verified),[w]),k=y.useMemo(()=>w.filter(e=>!e.verified),[w]),j=y.useMemo(()=>T.filter(e=>e.verified),[T]),M=y.useMemo(()=>T.filter(e=>!e.verified),[T]);y.useEffect(()=>{if(t){let{provider:e,model:n}=b(t);p(t),x(e||null),C(n),o?.(e||null,n)}},[t]);let F=e=>{x(e),C(null),p(`${e}/`),n?.(e,null)},I=e=>{let t=`${m}/${e}`;m===`openai`&&(t=e),p(t),C(e),n?.(m,e)},L=()=>{x(null),p(null)},{t:R}=s(`openhands`);return(0,P.jsxs)(`div`,{className:u(`flex flex-col md:flex-row w-full min-w-0 justify-between gap-4 md:gap-[46px]`,d),children:[(0,P.jsxs)(`fieldset`,{className:`flex flex-col gap-2.5 w-full`,children:[(0,P.jsx)(`label`,{className:u(`text-sm`,f),children:R(c.LLM$PROVIDER)}),(0,P.jsxs)(i,{"data-testid":`llm-provider-input`,isRequired:!0,isVirtualized:!1,name:`llm-provider-input`,isDisabled:e,"aria-label":R(c.LLM$PROVIDER),isClearable:!1,onSelectionChange:e=>{e?.toString()&&F(e.toString())},onInputChange:e=>!e&&L(),defaultSelectedKey:m??void 0,selectedKey:m,classNames:{popoverContent:`bg-content1 rounded-xl border border-[var(--oh-border)]`,selectorButton:g},selectorButtonProps:{disableRipple:!0},inputProps:{classNames:{inputWrapper:h}},children:[(0,P.jsx)(a,{title:R(c.MODEL_SELECTOR$VERIFIED),classNames:{heading:`text-[var(--oh-muted)]`},children:O.map(e=>(0,P.jsx)(r,{"data-testid":`provider-item-${e.name}`,children:_(e.name)},e.name))}),k.length>0?(0,P.jsx)(a,{title:R(c.MODEL_SELECTOR$OTHERS),classNames:{heading:`text-[var(--oh-muted)]`},children:k.map(e=>(0,P.jsx)(r,{children:_(e.name)},e.name))}):null]})]}),m===`openhands`&&(0,P.jsx)(v,{testId:`openhands-account-help`,text:R(c.SETTINGS$NEED_OPENHANDS_ACCOUNT),linkText:R(c.SETTINGS$CLICK_HERE),href:l.PRODUCTION,size:`settings`,linkColor:`white`}),(0,P.jsxs)(`fieldset`,{className:`flex flex-col gap-2.5 w-full`,children:[(0,P.jsx)(`label`,{className:u(`text-sm`,f),children:R(c.LLM$MODEL)}),(0,P.jsxs)(i,{"data-testid":`llm-model-input`,isRequired:!0,isVirtualized:!1,isLoading:E,name:`llm-model-input`,"aria-label":R(c.LLM$MODEL),isClearable:!1,onSelectionChange:e=>{e?.toString()&&I(e.toString())},isDisabled:e||!m,selectedKey:S,defaultSelectedKey:S??void 0,classNames:{popoverContent:`bg-content1 rounded-xl border border-[var(--oh-border)]`,selectorButton:g},selectorButtonProps:{disableRipple:!0},inputProps:{classNames:{inputWrapper:h}},children:[(0,P.jsx)(a,{title:R(c.MODEL_SELECTOR$VERIFIED),classNames:{heading:`text-[var(--oh-muted)]`},children:j.map(e=>(0,P.jsx)(r,{children:e.name},e.name))}),M.length>0?(0,P.jsx)(a,{title:R(c.MODEL_SELECTOR$OTHERS),classNames:{heading:`text-[var(--oh-muted)]`},children:M.map(e=>(0,P.jsx)(r,{"data-testid":`model-item-${e.name}`,children:e.name},e.name))}):null]}),D&&(0,P.jsx)(`p`,{"data-testid":`models-error`,className:`text-danger text-xs`,children:R(c.CONFIGURATION$ERROR_FETCH_MODELS)})]})]})}export{b as n,F as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{k as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~jkpzbynd-CkpBIhVe.js";import{n as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{t as a}from"./useMutation-u8UgRgDK.js";import{t as o}from"./useQueries-BpIlT8Mt.js";import{t as s}from"./useQuery-D5pEZbY0.js";import{t as c}from"./useTranslation-Cbf5AGg_.js";import{t as l}from"./declaration-BGsHjPEW.js";import{l as u,n as d}from"./active-backend-context-B8rMv0X9.js";import{t as f}from"./createLucideIcon-D4Tak8A1.js";import{t as p}from"./onboarding-modal-Q4AnpIdg.js";import{t as m}from"./utils-DB9LsAzA.js";import{d as h}from"./agent-server-compatibility-BWN-EIQn.js";import{g,h as _,o as v}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{t as y}from"./modal-backdrop-zVwfOJZr.js";import{r as b,t as x}from"./modal-body-Cc2zp0xb.js";import{r as S}from"./base-modal-CIF_785P.js";import{i as C}from"./modal-classes-3qT9Ap7Q.js";import{t as w}from"./brand-button-B1izLAdR.js";import{t as T}from"./use-onboarding-completion-C_Swglzp.js";import{t as E}from"./confirmation-modal-DGBWM2Ls.js";import{t as D}from"./folder-Bk311brm.js";import{t as O}from"./close-DLFb5kfv.js";var k=f(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),A=f(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]);function j(){return new v(h())}function M(e){return{workspaces:e.workspaces.map(({parentPath:e,...t})=>({...t,...e?{parentPath:e}:{}})),workspaceParents:e.workspaceParents}}var N=class{static async listWorkspaces(){return M(await j().listWorkspaces())}static async addWorkspaces(e){return M(await j().addWorkspaces(e))}static async removeWorkspace(e){await j().deleteWorkspace(e)}static async addWorkspaceParents(e){return M(await j().addWorkspaceParents(e))}static async removeWorkspaceParent(e){await j().deleteWorkspaceParent(e)}};function P(){let e=i();return a({mutationFn:e=>N.addWorkspaces(e),onSuccess:()=>e.invalidateQueries({queryKey:u.all})})}function F(){let e=i();return a({mutationFn:e=>N.removeWorkspace(e),onSuccess:()=>e.invalidateQueries({queryKey:u.all})})}function I(){let e=i();return a({mutationFn:e=>N.addWorkspaceParents(e),onSuccess:()=>e.invalidateQueries({queryKey:u.all})})}function L(){let e=i();return a({mutationFn:e=>N.removeWorkspaceParent(e),onSuccess:()=>e.invalidateQueries({queryKey:u.all})})}var R=e(t(),1);function z({enabled:e=!0}={}){return s({queryKey:u.all,queryFn:()=>N.listWorkspaces(),enabled:e,retry:(e,t)=>!_(t)&&e<3,meta:{disableToast:!0},staleTime:6e4})}function B(){let{data:e,isLoading:t,isError:n,error:r}=z(),i=_(r),a=e?.workspaces??[],s=e?.workspaceParents??[],c=(0,R.useMemo)(()=>{let e=new Set(s.map(e=>e.path)),t=[].filter(t=>!e.has(t.path));return t.length===0?s:[...s,...t]},[s,i]),l=o({queries:i?[]:c.map(e=>({queryKey:[`file`,`search_subdirs`,e.path],queryFn:()=>new g(h()).searchSubdirectories(e.path),retry:!1,meta:{disableToast:!0}}))}),u=t||l.some(e=>e.isLoading),d=n||l.some(e=>e.isError);return{workspaces:(0,R.useMemo)(()=>{let e=new Map,t=new Map(c.map((e,t)=>[e.path,l[t]]));return c.forEach(n=>{(t.get(n.path)?.data?.items??[]).forEach(t=>{e.has(t.path)||e.set(t.path,{id:t.path,name:t.name,path:t.path,parentPath:n.path})})}),a.forEach(t=>{e.set(t.path,t)}),Array.from(e.values())},[a,c,l.map(e=>`${e.dataUpdatedAt??0}:${e.status}`).join(`|`)]),parents:c,isLoading:u,isError:d,error:r}}function V(e,t){return _(e)?t(l.HOME$WORKSPACES_UNSUPPORTED_AGENT_SERVER,{actualVersion:e.actualVersion,requiredVersion:e.requiredVersion}):null}function H(){return new g(h())}var ee=e=>{let t=d();return s({queryKey:[`file`,`search_subdirs`,e,t.backend.id,t.orgId],queryFn:()=>H().searchSubdirectories(e),enabled:!!e,retry:!1,meta:{disableToast:!0}})},te=()=>{let e=d();return s({queryKey:[`file`,`home`,e.backend.id,e.orgId],queryFn:async()=>H().getHome(),retry:!1,meta:{disableToast:!0},staleTime:1/0})},U=n(),W=e=>(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,U.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M13.8227 16.6549L10.4043 12.6668L13.8227 8.67871L14.9615 9.6549L12.3799 12.6668L14.9615 15.6787L13.8227 16.6549Z`,fill:`currentColor`})}),G=`/projects`;function K({label:e,entries:t,currentPath:n,onPick:r}){return t.length===0?null:(0,U.jsxs)(`div`,{className:`px-2 pb-3`,children:[(0,U.jsx)(`div`,{className:`px-2 pb-1 text-[11px] uppercase tracking-wide text-[var(--oh-muted)] font-semibold`,children:e}),(0,U.jsx)(`ul`,{children:t.map(e=>{let t=n===e.path;return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.path),"data-testid":`folder-browser-sidebar-${e.label.toLowerCase()}`,className:m(`flex items-center gap-2 w-full px-2 py-1 rounded text-sm cursor-pointer`,t?`bg-tertiary text-white`:`text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-surface-raised)]`),children:[(0,U.jsx)(D,{width:14,height:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.path)})})]})}function q(e){let t=Y(e);if(!t||t===`/`||J(t))return null;let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));if(n<0)return null;if(n===0)return`/`;let r=t.slice(0,n);return/^[A-Za-z]:$/.test(r)?`${r}${t[n]}`:r}function J(e){return/^[A-Za-z]:[\\/]?$/.test(e)}function Y(e){let t=e.replace(/[\\/]+$/,``);return/^[A-Za-z]:$/.test(t)?`${t}${e.includes(`/`)&&!e.includes(`\\`)?`/`:`\\`}`:t}function X(e){return e?.home===`/home/openhands`}function Z({isOpen:e,onClose:t,onAdd:n,onAddParent:r}){let{t:i}=c(`openhands`),[a,o]=(0,R.useState)(null),s=d(),{data:u}=te();(0,R.useEffect)(()=>{e&&u?.home&&a===null&&o(X(u)?G:u.home),e||o(null)},[e,u?.home,a]),(0,R.useEffect)(()=>{o(null)},[s.backend.id,s.orgId]);let{data:f,isLoading:p,isError:h,error:g}=ee(e?a:null),_=(0,R.useMemo)(()=>{if(!u?.home)return[];let e=[{label:`Home`,path:Y(u.home)||u.home},...u.favorites??[]];return X(u)&&!e.some(e=>e.path===G)&&e.push({label:G,path:G}),e},[u]),v=u?.locations??[];if(!e)return null;let T=f?.items??[],E=a?q(a):null,O=u?.home===`/home/openhands`&&(u?.favorites?.length??0)===0&&a===u?.home&&!p&&!h&&T.length===0,k=e=>{let t=Y(e);if(!t)return`/`;if(t===`/`||J(t))return t;let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n>=0&&t.slice(n+1)||t};return(0,U.jsx)(y,{onClose:t,"aria-label":i(l.HOME$ADD_WORKSPACES_TITLE),children:(0,U.jsxs)(`div`,{"data-testid":`folder-browser-modal`,className:m(`flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-xl`,b(`xl`),x,`h-[480px]`),children:[(0,U.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-[var(--oh-border-input)]`,children:(0,U.jsx)(S,{className:C,title:i(l.HOME$ADD_WORKSPACES_TITLE)})}),(0,U.jsxs)(`div`,{className:`flex flex-1 min-h-0`,children:[(0,U.jsxs)(`aside`,{"data-testid":`folder-browser-sidebar`,className:`w-[180px] shrink-0 border-r border-[var(--oh-border-input)] bg-[var(--oh-surface)] py-3 overflow-y-auto`,children:[(0,U.jsx)(K,{label:i(l.HOME$FAVORITES),entries:_,currentPath:a,onPick:o}),(0,U.jsx)(K,{label:i(l.HOME$LOCATIONS),entries:v,currentPath:a,onPick:o})]}),(0,U.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-b border-[var(--oh-border-input)]`,children:[(0,U.jsx)(`button`,{type:`button`,"data-testid":`folder-browser-up`,onClick:()=>E&&o(E),disabled:!E,"aria-label":i(l.COMMON$UP),className:`p-1 rounded hover:bg-[var(--oh-interactive-hover)] text-white disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,U.jsx)(W,{width:16,height:16})}),(0,U.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,"data-testid":`folder-browser-current-path`,children:a??``})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-[1fr_120px] px-4 py-1 border-b border-[var(--oh-border-input)] text-xs text-[var(--oh-text-secondary)] font-semibold`,children:[(0,U.jsx)(`span`,{children:i(l.HOME$NAME)}),(0,U.jsx)(`span`,{children:i(l.HOME$KIND)})]}),(0,U.jsxs)(`ul`,{className:`flex-1 overflow-auto custom-scrollbar-always`,"data-testid":`folder-browser-list`,children:[p&&(0,U.jsx)(`li`,{className:`px-4 py-2 text-sm text-[var(--oh-text-secondary)]`,children:i(l.HOME$LOADING)}),h&&(0,U.jsx)(`li`,{className:`px-4 py-2 text-sm text-red-400`,"data-testid":`folder-browser-error`,children:g?.message??i(l.COMMON$FAILED_TO_LOAD)}),!p&&!h&&T.length===0&&(0,U.jsx)(`li`,{className:`px-4 py-2 text-sm text-[var(--oh-text-secondary)]`,"data-testid":O?`folder-browser-host-home-hint`:`folder-browser-empty`,children:i(O?l.HOME$HOST_HOME_NOT_MOUNTED_HINT:l.HOME$NO_WORKSPACES)}),T.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:`grid grid-cols-[1fr_120px] items-center w-full text-left px-4 py-1.5 text-sm text-white hover:bg-[var(--oh-interactive-hover)] cursor-pointer`,"data-testid":`folder-browser-entry-${e.name}`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2 min-w-0`,children:[(0,U.jsx)(D,{width:16,height:16,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,U.jsx)(`span`,{className:`text-[var(--oh-text-secondary)] text-xs`,children:i(l.HOME$FOLDER)})]})},e.path))]})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-5 py-3 border-t border-[var(--oh-border-input)]`,children:[(0,U.jsx)(w,{type:`button`,variant:`secondary`,onClick:t,testId:`folder-browser-cancel`,children:i(l.HOME$CANCEL)}),r&&(0,U.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>{!a||!r||(r([{id:a,name:k(a),path:a}]),t())},isDisabled:!a||p,testId:`folder-browser-add-all-subdirs`,children:i(l.HOME$ADD_ALL_SUBDIRECTORIES)}),(0,U.jsx)(w,{type:`button`,variant:`primary`,onClick:()=>{a&&(n([{id:a,name:k(a),path:a}]),t())},isDisabled:!a||p,testId:`folder-browser-use`,children:i(l.HOME$ADD_THIS_DIRECTORY)})]})]})})}function ne({isOpen:e,workspaces:t,workspaceParents:n=[],onClose:r,onRemove:i,onRemoveParent:a}){let{t:o}=c(`openhands`),[s,u]=R.useState(null);if(!e)return null;let d=t.filter(e=>!e.parentPath),f=new Map;t.forEach(e=>{if(!e.parentPath)return;let t=f.get(e.parentPath)??[];t.push(e),f.set(e.parentPath,t)});let p=d.length>0||n.length>0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(y,{onClose:r,"aria-label":o(l.HOME$MANAGE_WORKSPACES),children:(0,U.jsxs)(`div`,{"data-testid":`manage-workspaces-modal`,className:m(`flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-xl`,b(`lg`),x,`max-h-[70vh]`),children:[(0,U.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-[var(--oh-border-input)]`,children:(0,U.jsx)(S,{className:C,title:o(l.HOME$MANAGE_WORKSPACES)})}),(0,U.jsxs)(`div`,{className:`flex-1 overflow-auto custom-scrollbar-always`,"data-testid":`manage-workspaces-list`,children:[!p&&(0,U.jsx)(`p`,{className:`px-5 py-6 text-sm text-[var(--oh-text-secondary)] text-center`,children:o(l.HOME$MANAGE_WORKSPACES_EMPTY)}),d.length>0&&(0,U.jsx)(`ul`,{children:d.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-3 px-5 py-2 border-b border-[var(--oh-border-subtle)] last:border-b-0`,"data-testid":`manage-workspaces-row-${e.name}`,children:[(0,U.jsx)(D,{width:16,height:16,className:`shrink-0`}),(0,U.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,children:e.path})]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>u({type:`workspace`,path:e.path,text:o(l.HOME$REMOVE_WORKSPACE_CONFIRMATION,{name:e.name})}),"aria-label":o(l.HOME$REMOVE_WORKSPACE),"data-testid":`manage-workspaces-remove-${e.name}`,className:`flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-interactive-hover)] hover:text-white cursor-pointer`,children:[(0,U.jsx)(O,{width:12,height:12}),(0,U.jsx)(`span`,{children:o(l.HOME$REMOVE_WORKSPACE)})]})]},e.id))}),n.length>0&&(0,U.jsxs)(`div`,{"data-testid":`manage-workspaces-parents-section`,children:[(0,U.jsx)(`div`,{className:`px-5 pt-3 pb-1 text-[11px] uppercase tracking-wide text-[var(--oh-muted)] font-semibold`,children:o(l.HOME$WORKSPACE_PARENTS)}),(0,U.jsx)(`ul`,{children:n.map(e=>{let t=f.get(e.path)??[];return(0,U.jsxs)(`li`,{className:`border-b border-[var(--oh-border-subtle)] last:border-b-0`,"data-testid":`manage-workspaces-parent-row-${e.name}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-2`,children:[(0,U.jsx)(D,{width:16,height:16,className:`shrink-0`}),(0,U.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,children:e.path})]}),a&&(0,U.jsxs)(`button`,{type:`button`,onClick:()=>u({type:`parent`,path:e.path,text:o(l.HOME$REMOVE_WORKSPACE_PARENT_CONFIRMATION,{name:e.name,count:t.length})}),"aria-label":o(l.HOME$REMOVE_WORKSPACE_PARENT),"data-testid":`manage-workspaces-remove-parent-${e.name}`,className:`flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-interactive-hover)] hover:text-white cursor-pointer`,children:[(0,U.jsx)(O,{width:12,height:12}),(0,U.jsx)(`span`,{children:o(l.HOME$REMOVE_WORKSPACE_PARENT)})]})]}),t.length>0&&(0,U.jsx)(`ul`,{className:`pb-2`,children:t.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-3 px-5 pl-10 py-1 text-xs text-[var(--oh-text-secondary)]`,"data-testid":`manage-workspaces-child-${e.name}`,children:[(0,U.jsx)(D,{width:12,height:12,className:`shrink-0 opacity-70`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})]},e.id)})})]})]}),(0,U.jsx)(`div`,{className:`flex justify-end gap-2 px-5 py-3 border-t border-[var(--oh-border-input)]`,children:(0,U.jsx)(w,{type:`button`,variant:`primary`,onClick:r,testId:`manage-workspaces-done`,children:o(l.HOME$DONE)})})]})}),s&&(0,U.jsx)(E,{text:s.text,onConfirm:()=>{s&&(s.type===`workspace`?i(s.path):a?.(s.path),u(null))},onCancel:()=>u(null)})]})}var re=`previewOnboardingStep`,ie=3;function Q(e=typeof window<`u`?window.location.search:``){let t=new URLSearchParams(e).get(re);if(t==null)return null;let n=Number.parseInt(t,10);return!Number.isFinite(n)||n<0||n>ie?null:n}function $(e=typeof window<`u`?window.location.search:``){return Q(e)!=null}function ae(){let e=r(),t=Q(e.search),n=$(e.search),{isCompleted:i,markCompleted:a}=T();return!n&&i?null:(0,U.jsx)(p,{onClose:()=>{n||a()},initialStep:t??0,isPreview:n})}export{V as a,I as c,L as d,A as f,Z as i,P as l,$ as n,B as o,k as p,ne as r,z as s,ae as t,F as u};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{k as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~jkpzbynd-CkpBIhVe.js";import{n as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{t as a}from"./useMutation-u8UgRgDK.js";import{t as o}from"./useQueries-BpIlT8Mt.js";import{t as s}from"./useQuery-D5pEZbY0.js";import{t as c}from"./useTranslation-Cbf5AGg_.js";import{t as l}from"./declaration-BGsHjPEW.js";import{l as u,n as d}from"./active-backend-context-DHhm10VS.js";import{t as f}from"./createLucideIcon-D4Tak8A1.js";import{t as p}from"./onboarding-modal-Bxuxpfdz.js";import{t as m}from"./utils-DB9LsAzA.js";import{d as h}from"./agent-server-compatibility-C0MtTTwb.js";import{g,h as _,o as v}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{t as y}from"./modal-backdrop-zVwfOJZr.js";import{r as b,t as x}from"./modal-body-Cc2zp0xb.js";import{r as S}from"./base-modal-CIF_785P.js";import{i as C}from"./modal-classes-3qT9Ap7Q.js";import{t as w}from"./brand-button-B1izLAdR.js";import{t as T}from"./use-onboarding-completion-C_Swglzp.js";import{t as E}from"./confirmation-modal-DGBWM2Ls.js";import{t as D}from"./folder-Bk311brm.js";import{t as O}from"./close-DLFb5kfv.js";var k=f(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),A=f(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]);function j(){return new v(h())}function M(e){return{workspaces:e.workspaces.map(({parentPath:e,...t})=>({...t,...e?{parentPath:e}:{}})),workspaceParents:e.workspaceParents}}var N=class{static async listWorkspaces(){return M(await j().listWorkspaces())}static async addWorkspaces(e){return M(await j().addWorkspaces(e))}static async removeWorkspace(e){await j().deleteWorkspace(e)}static async addWorkspaceParents(e){return M(await j().addWorkspaceParents(e))}static async removeWorkspaceParent(e){await j().deleteWorkspaceParent(e)}};function P(){let e=i();return a({mutationFn:e=>N.addWorkspaces(e),onSuccess:()=>e.invalidateQueries({queryKey:u.all})})}function F(){let e=i();return a({mutationFn:e=>N.removeWorkspace(e),onSuccess:()=>e.invalidateQueries({queryKey:u.all})})}function I(){let e=i();return a({mutationFn:e=>N.addWorkspaceParents(e),onSuccess:()=>e.invalidateQueries({queryKey:u.all})})}function L(){let e=i();return a({mutationFn:e=>N.removeWorkspaceParent(e),onSuccess:()=>e.invalidateQueries({queryKey:u.all})})}var R=e(t(),1);function z({enabled:e=!0}={}){return s({queryKey:u.all,queryFn:()=>N.listWorkspaces(),enabled:e,retry:(e,t)=>!_(t)&&e<3,meta:{disableToast:!0},staleTime:6e4})}function B(){let{data:e,isLoading:t,isError:n,error:r}=z(),i=_(r),a=e?.workspaces??[],s=e?.workspaceParents??[],c=(0,R.useMemo)(()=>{let e=new Set(s.map(e=>e.path)),t=[].filter(t=>!e.has(t.path));return t.length===0?s:[...s,...t]},[s,i]),l=o({queries:i?[]:c.map(e=>({queryKey:[`file`,`search_subdirs`,e.path],queryFn:()=>new g(h()).searchSubdirectories(e.path),retry:!1,meta:{disableToast:!0}}))}),u=t||l.some(e=>e.isLoading),d=n||l.some(e=>e.isError);return{workspaces:(0,R.useMemo)(()=>{let e=new Map,t=new Map(c.map((e,t)=>[e.path,l[t]]));return c.forEach(n=>{(t.get(n.path)?.data?.items??[]).forEach(t=>{e.has(t.path)||e.set(t.path,{id:t.path,name:t.name,path:t.path,parentPath:n.path})})}),a.forEach(t=>{e.set(t.path,t)}),Array.from(e.values())},[a,c,l.map(e=>`${e.dataUpdatedAt??0}:${e.status}`).join(`|`)]),parents:c,isLoading:u,isError:d,error:r}}function V(e,t){return _(e)?t(l.HOME$WORKSPACES_UNSUPPORTED_AGENT_SERVER,{actualVersion:e.actualVersion,requiredVersion:e.requiredVersion}):null}function H(){return new g(h())}var ee=e=>{let t=d();return s({queryKey:[`file`,`search_subdirs`,e,t.backend.id,t.orgId],queryFn:()=>H().searchSubdirectories(e),enabled:!!e,retry:!1,meta:{disableToast:!0}})},te=()=>{let e=d();return s({queryKey:[`file`,`home`,e.backend.id,e.orgId],queryFn:async()=>H().getHome(),retry:!1,meta:{disableToast:!0},staleTime:1/0})},U=n(),W=e=>(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,U.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M13.8227 16.6549L10.4043 12.6668L13.8227 8.67871L14.9615 9.6549L12.3799 12.6668L14.9615 15.6787L13.8227 16.6549Z`,fill:`currentColor`})}),G=`/projects`;function K({label:e,entries:t,currentPath:n,onPick:r}){return t.length===0?null:(0,U.jsxs)(`div`,{className:`px-2 pb-3`,children:[(0,U.jsx)(`div`,{className:`px-2 pb-1 text-[11px] uppercase tracking-wide text-[var(--oh-muted)] font-semibold`,children:e}),(0,U.jsx)(`ul`,{children:t.map(e=>{let t=n===e.path;return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.path),"data-testid":`folder-browser-sidebar-${e.label.toLowerCase()}`,className:m(`flex items-center gap-2 w-full px-2 py-1 rounded text-sm cursor-pointer`,t?`bg-tertiary text-white`:`text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-surface-raised)]`),children:[(0,U.jsx)(D,{width:14,height:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.path)})})]})}function q(e){let t=Y(e);if(!t||t===`/`||J(t))return null;let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));if(n<0)return null;if(n===0)return`/`;let r=t.slice(0,n);return/^[A-Za-z]:$/.test(r)?`${r}${t[n]}`:r}function J(e){return/^[A-Za-z]:[\\/]?$/.test(e)}function Y(e){let t=e.replace(/[\\/]+$/,``);return/^[A-Za-z]:$/.test(t)?`${t}${e.includes(`/`)&&!e.includes(`\\`)?`/`:`\\`}`:t}function X(e){return e?.home===`/home/openhands`}function Z({isOpen:e,onClose:t,onAdd:n,onAddParent:r}){let{t:i}=c(`openhands`),[a,o]=(0,R.useState)(null),s=d(),{data:u}=te();(0,R.useEffect)(()=>{e&&u?.home&&a===null&&o(X(u)?G:u.home),e||o(null)},[e,u?.home,a]),(0,R.useEffect)(()=>{o(null)},[s.backend.id,s.orgId]);let{data:f,isLoading:p,isError:h,error:g}=ee(e?a:null),_=(0,R.useMemo)(()=>{if(!u?.home)return[];let e=[{label:`Home`,path:Y(u.home)||u.home},...u.favorites??[]];return X(u)&&!e.some(e=>e.path===G)&&e.push({label:G,path:G}),e},[u]),v=u?.locations??[];if(!e)return null;let T=f?.items??[],E=a?q(a):null,O=u?.home===`/home/openhands`&&(u?.favorites?.length??0)===0&&a===u?.home&&!p&&!h&&T.length===0,k=e=>{let t=Y(e);if(!t)return`/`;if(t===`/`||J(t))return t;let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n>=0&&t.slice(n+1)||t};return(0,U.jsx)(y,{onClose:t,"aria-label":i(l.HOME$ADD_WORKSPACES_TITLE),children:(0,U.jsxs)(`div`,{"data-testid":`folder-browser-modal`,className:m(`flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-xl`,b(`xl`),x,`h-[480px]`),children:[(0,U.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-[var(--oh-border-input)]`,children:(0,U.jsx)(S,{className:C,title:i(l.HOME$ADD_WORKSPACES_TITLE)})}),(0,U.jsxs)(`div`,{className:`flex flex-1 min-h-0`,children:[(0,U.jsxs)(`aside`,{"data-testid":`folder-browser-sidebar`,className:`w-[180px] shrink-0 border-r border-[var(--oh-border-input)] bg-[var(--oh-surface)] py-3 overflow-y-auto`,children:[(0,U.jsx)(K,{label:i(l.HOME$FAVORITES),entries:_,currentPath:a,onPick:o}),(0,U.jsx)(K,{label:i(l.HOME$LOCATIONS),entries:v,currentPath:a,onPick:o})]}),(0,U.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-b border-[var(--oh-border-input)]`,children:[(0,U.jsx)(`button`,{type:`button`,"data-testid":`folder-browser-up`,onClick:()=>E&&o(E),disabled:!E,"aria-label":i(l.COMMON$UP),className:`p-1 rounded hover:bg-[var(--oh-interactive-hover)] text-white disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,U.jsx)(W,{width:16,height:16})}),(0,U.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,"data-testid":`folder-browser-current-path`,children:a??``})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-[1fr_120px] px-4 py-1 border-b border-[var(--oh-border-input)] text-xs text-[var(--oh-text-secondary)] font-semibold`,children:[(0,U.jsx)(`span`,{children:i(l.HOME$NAME)}),(0,U.jsx)(`span`,{children:i(l.HOME$KIND)})]}),(0,U.jsxs)(`ul`,{className:`flex-1 overflow-auto custom-scrollbar-always`,"data-testid":`folder-browser-list`,children:[p&&(0,U.jsx)(`li`,{className:`px-4 py-2 text-sm text-[var(--oh-text-secondary)]`,children:i(l.HOME$LOADING)}),h&&(0,U.jsx)(`li`,{className:`px-4 py-2 text-sm text-red-400`,"data-testid":`folder-browser-error`,children:g?.message??i(l.COMMON$FAILED_TO_LOAD)}),!p&&!h&&T.length===0&&(0,U.jsx)(`li`,{className:`px-4 py-2 text-sm text-[var(--oh-text-secondary)]`,"data-testid":O?`folder-browser-host-home-hint`:`folder-browser-empty`,children:i(O?l.HOME$HOST_HOME_NOT_MOUNTED_HINT:l.HOME$NO_WORKSPACES)}),T.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:`grid grid-cols-[1fr_120px] items-center w-full text-left px-4 py-1.5 text-sm text-white hover:bg-[var(--oh-interactive-hover)] cursor-pointer`,"data-testid":`folder-browser-entry-${e.name}`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2 min-w-0`,children:[(0,U.jsx)(D,{width:16,height:16,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,U.jsx)(`span`,{className:`text-[var(--oh-text-secondary)] text-xs`,children:i(l.HOME$FOLDER)})]})},e.path))]})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-5 py-3 border-t border-[var(--oh-border-input)]`,children:[(0,U.jsx)(w,{type:`button`,variant:`secondary`,onClick:t,testId:`folder-browser-cancel`,children:i(l.HOME$CANCEL)}),r&&(0,U.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>{!a||!r||(r([{id:a,name:k(a),path:a}]),t())},isDisabled:!a||p,testId:`folder-browser-add-all-subdirs`,children:i(l.HOME$ADD_ALL_SUBDIRECTORIES)}),(0,U.jsx)(w,{type:`button`,variant:`primary`,onClick:()=>{a&&(n([{id:a,name:k(a),path:a}]),t())},isDisabled:!a||p,testId:`folder-browser-use`,children:i(l.HOME$ADD_THIS_DIRECTORY)})]})]})})}function ne({isOpen:e,workspaces:t,workspaceParents:n=[],onClose:r,onRemove:i,onRemoveParent:a}){let{t:o}=c(`openhands`),[s,u]=R.useState(null);if(!e)return null;let d=t.filter(e=>!e.parentPath),f=new Map;t.forEach(e=>{if(!e.parentPath)return;let t=f.get(e.parentPath)??[];t.push(e),f.set(e.parentPath,t)});let p=d.length>0||n.length>0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(y,{onClose:r,"aria-label":o(l.HOME$MANAGE_WORKSPACES),children:(0,U.jsxs)(`div`,{"data-testid":`manage-workspaces-modal`,className:m(`flex flex-col bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-xl`,b(`lg`),x,`max-h-[70vh]`),children:[(0,U.jsx)(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-[var(--oh-border-input)]`,children:(0,U.jsx)(S,{className:C,title:o(l.HOME$MANAGE_WORKSPACES)})}),(0,U.jsxs)(`div`,{className:`flex-1 overflow-auto custom-scrollbar-always`,"data-testid":`manage-workspaces-list`,children:[!p&&(0,U.jsx)(`p`,{className:`px-5 py-6 text-sm text-[var(--oh-text-secondary)] text-center`,children:o(l.HOME$MANAGE_WORKSPACES_EMPTY)}),d.length>0&&(0,U.jsx)(`ul`,{children:d.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-3 px-5 py-2 border-b border-[var(--oh-border-subtle)] last:border-b-0`,"data-testid":`manage-workspaces-row-${e.name}`,children:[(0,U.jsx)(D,{width:16,height:16,className:`shrink-0`}),(0,U.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,children:e.path})]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>u({type:`workspace`,path:e.path,text:o(l.HOME$REMOVE_WORKSPACE_CONFIRMATION,{name:e.name})}),"aria-label":o(l.HOME$REMOVE_WORKSPACE),"data-testid":`manage-workspaces-remove-${e.name}`,className:`flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-interactive-hover)] hover:text-white cursor-pointer`,children:[(0,U.jsx)(O,{width:12,height:12}),(0,U.jsx)(`span`,{children:o(l.HOME$REMOVE_WORKSPACE)})]})]},e.id))}),n.length>0&&(0,U.jsxs)(`div`,{"data-testid":`manage-workspaces-parents-section`,children:[(0,U.jsx)(`div`,{className:`px-5 pt-3 pb-1 text-[11px] uppercase tracking-wide text-[var(--oh-muted)] font-semibold`,children:o(l.HOME$WORKSPACE_PARENTS)}),(0,U.jsx)(`ul`,{children:n.map(e=>{let t=f.get(e.path)??[];return(0,U.jsxs)(`li`,{className:`border-b border-[var(--oh-border-subtle)] last:border-b-0`,"data-testid":`manage-workspaces-parent-row-${e.name}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-2`,children:[(0,U.jsx)(D,{width:16,height:16,className:`shrink-0`}),(0,U.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`text-sm text-white truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate`,children:e.path})]}),a&&(0,U.jsxs)(`button`,{type:`button`,onClick:()=>u({type:`parent`,path:e.path,text:o(l.HOME$REMOVE_WORKSPACE_PARENT_CONFIRMATION,{name:e.name,count:t.length})}),"aria-label":o(l.HOME$REMOVE_WORKSPACE_PARENT),"data-testid":`manage-workspaces-remove-parent-${e.name}`,className:`flex items-center gap-1 px-2 py-1 rounded text-xs text-[var(--oh-text-tertiary)] hover:bg-[var(--oh-interactive-hover)] hover:text-white cursor-pointer`,children:[(0,U.jsx)(O,{width:12,height:12}),(0,U.jsx)(`span`,{children:o(l.HOME$REMOVE_WORKSPACE_PARENT)})]})]}),t.length>0&&(0,U.jsx)(`ul`,{className:`pb-2`,children:t.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-3 px-5 pl-10 py-1 text-xs text-[var(--oh-text-secondary)]`,"data-testid":`manage-workspaces-child-${e.name}`,children:[(0,U.jsx)(D,{width:12,height:12,className:`shrink-0 opacity-70`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))})]},e.id)})})]})]}),(0,U.jsx)(`div`,{className:`flex justify-end gap-2 px-5 py-3 border-t border-[var(--oh-border-input)]`,children:(0,U.jsx)(w,{type:`button`,variant:`primary`,onClick:r,testId:`manage-workspaces-done`,children:o(l.HOME$DONE)})})]})}),s&&(0,U.jsx)(E,{text:s.text,onConfirm:()=>{s&&(s.type===`workspace`?i(s.path):a?.(s.path),u(null))},onCancel:()=>u(null)})]})}var re=`previewOnboardingStep`,ie=3;function Q(e=typeof window<`u`?window.location.search:``){let t=new URLSearchParams(e).get(re);if(t==null)return null;let n=Number.parseInt(t,10);return!Number.isFinite(n)||n<0||n>ie?null:n}function $(e=typeof window<`u`?window.location.search:``){return Q(e)!=null}function ae(){let e=r(),t=Q(e.search),n=$(e.search),{isCompleted:i,markCompleted:a}=T();return!n&&i?null:(0,U.jsx)(p,{onClose:()=>{n||a()},initialStep:t??0,isPreview:n})}export{V as a,I as c,L as d,A as f,Z as i,P as l,$ as n,B as o,k as p,ne as r,z as s,ae as t,F as u};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./rolldown-runtime-BFRubm34.js";import{Ct as n,bt as r}from"./vendor-styling-CI0PQ3ab.js";import{t as i}from"./useTranslation-Cbf5AGg_.js";import{t as a}from"./declaration-BGsHjPEW.js";import{C as o,E as s,S as c,n as l,r as u}from"./active-backend-context-B8rMv0X9.js";import{t as d}from"./createLucideIcon-D4Tak8A1.js";import{n as f,t as p}from"./chat-send-button-BZHG2hAW.js";import{t as m}from"./check-TbOEtHKj.js";import{t as h}from"./loader-circle-CsAsfLIs.js";import{i as g,r as _,t as v}from"./llm-settings-DFkJQr_w.js";import{t as y}from"./utils-DB9LsAzA.js";import{E as b,F as x,I as S,R as C,S as w,j as T}from"./agent-server-compatibility-BWN-EIQn.js";import{r as E}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{a as D}from"./use-backends-health-CLHPitJM.js";import{t as O}from"./modal-backdrop-zVwfOJZr.js";import{r as k,t as A}from"./modal-body-Cc2zp0xb.js";import{t as j}from"./brand-button-B1izLAdR.js";import{n as M}from"./navigation-context-DPs2G0X8.js";import{t as N}from"./openhands-logo-bcNw5bkY.js";import{c as P,s as F,t as I}from"./backend-form-modal-RGcu909r.js";import{r as L}from"./use-settings-CyxSlyTQ.js";import{t as R}from"./use-tracking-D2Qg5Lpd.js";import"./cloud-funnel-analytics-Zcv57hfT.js";import{c as z,i as ee,n as B,o as V}from"./acp-providers-DerAmTyY.js";import{n as H,r as U}from"./use-agent-profiles-0pr5bLS7.js";import{n as W}from"./use-create-conversation-r1JHfKO5.js";import{r as G,t as te}from"./recommended-automations-launcher-Bj7PuHY1.js";import{t as ne}from"./terminal-Cgf___rK.js";import{t as re}from"./use-save-settings-Chvzeu2s.js";import{o as ie}from"./use-can-manage-org-profiles-Ck_bsNbH.js";import{t as ae}from"./use-save-agent-profile-RqUGqTv6.js";import{n as oe}from"./use-activate-agent-profile-DlykqEfN.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./use-acp-credential-form-Bm8qXdlc.js";var fe=d(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),K=e(n(),1),q=r(),pe=`m19.6 66.5 19.7-11 .3-1-.3-.5h-1l-3.3-.2-11.2-.3L14 53l-9.5-.5-2.4-.5L0 49l.2-1.5 2-1.3 2.9.2 6.3.5 9.5.6 6.9.4L38 49.1h1.6l.2-.7-.5-.4-.4-.4L29 41l-10.6-7-5.6-4.1-3-2-1.5-2-.6-4.2 2.7-3 3.7.3.9.2 3.7 2.9 8 6.1L37 36l1.5 1.2.6-.4.1-.3-.7-1.1L33 25l-6-10.4-2.7-4.3-.7-2.6c-.3-1-.4-2-.4-3l3-4.2L28 0l4.2.6L33.8 2l2.6 6 4.1 9.3L47 29.9l2 3.8 1 3.4.3 1h.7v-.5l.5-7.2 1-8.7 1-11.2.3-3.2 1.6-3.8 3-2L61 2.6l2 2.9-.3 1.8-1.1 7.7L59 27.1l-1.5 8.2h.9l1-1.1 4.1-5.4 6.9-8.6 3-3.5L77 13l2.3-1.8h4.3l3.1 4.7-1.4 4.9-4.4 5.6-3.7 4.7-5.3 7.1-3.2 5.7.3.4h.7l12-2.6 6.4-1.1 7.6-1.3 3.5 1.6.4 1.6-1.4 3.4-8.2 2-9.6 2-14.3 3.3-.2.1.2.3 6.4.6 2.8.2h6.8l12.6 1 3.3 2 1.9 2.7-.3 2-5.1 2.6-6.8-1.6-16-3.8-5.4-1.3h-.8v.4l4.6 4.5 8.3 7.5L89 80.1l.5 2.4-1.3 2-1.4-.2-9.2-7-3.6-3-8-6.8h-.5v.7l1.8 2.7 9.8 14.7.5 4.5-.7 1.4-2.6 1-2.7-.6-5.8-8-6-9-4.7-8.2-.5.4-2.9 30.2-1.3 1.5-3 1.2-2.5-2-1.4-3 1.4-6.2 1.6-8 1.3-6.4 1.2-7.9.7-2.6v-.2H49L43 72l-9 12.3-7.2 7.6-1.7.7-3-1.5.3-2.8L24 86l10-12.8 6-7.9 4-4.6-.1-.5h-.3L17.2 77.4l-4.7.6-2-2 .2-3 1-1 8-5.5Z`,me=`0 0 100 100`,he=`M4.04286 0.228393C4.52451 0.0304495 5.0488 -0.0409817 5.56586 0.0208928C6.23236 0.0973928 6.82636 0.380893 7.34786 0.870893C7.35488 0.877545 7.36344 0.882351 7.37278 0.884881C7.38212 0.887412 7.39194 0.887588 7.40136 0.885393C8.10536 0.712393 8.78236 0.773393 9.43186 1.06839L9.46336 1.08339L9.54036 1.12139C10.2189 1.47289 10.7054 2.00639 10.9994 2.72039C11.1384 3.05989 11.2084 3.41439 11.2099 3.78339C11.2197 4.05816 11.1893 4.33288 11.1199 4.59889C11.1164 4.61245 11.1165 4.62665 11.12 4.6402C11.1235 4.65374 11.1303 4.66618 11.1399 4.67639C11.5329 5.0749 11.8063 5.57572 11.9289 6.12189C12.1214 7.07239 11.9239 7.92939 11.3374 8.69189L11.2464 8.80189C10.8579 9.24669 10.3481 9.56836 9.77936 9.72739C9.76694 9.73097 9.75556 9.73747 9.74617 9.74634C9.73677 9.75521 9.72964 9.7662 9.72536 9.77839C9.59786 10.1464 9.46986 10.4604 9.23186 10.7744C8.63236 11.5654 7.75086 12.0054 6.75786 11.9999C5.96636 11.9959 5.26486 11.7064 4.65286 11.1319C4.64358 11.1234 4.63225 11.1174 4.61998 11.1146C4.6077 11.1118 4.59491 11.1123 4.58286 11.1159C4.32386 11.1994 4.06286 11.2114 3.78086 11.2084C3.33033 11.2048 2.88658 11.0984 2.48336 10.8974C2.0613 10.688 1.6939 10.3831 1.41036 10.0069C1.30886 9.87239 1.20836 9.74589 1.13486 9.59639C1.03349 9.39033 0.95066 9.17565 0.887357 8.95489C0.754446 8.45324 0.751521 7.92599 0.878857 7.42289C0.882974 7.41102 0.884341 7.39837 0.882857 7.38589C0.88038 7.37348 0.873877 7.36223 0.864357 7.35389C0.556147 7.04213 0.320543 6.66619 0.174357 6.25289C0.0775698 5.99842 0.0213841 5.73031 0.00785682 5.45839C-0.0163229 5.10033 0.0153902 4.74069 0.101857 4.39239C0.326857 3.65039 0.756357 3.06839 1.39036 2.64589C1.53136 2.55189 1.66536 2.47889 1.79136 2.42689C1.93436 2.36689 2.07786 2.31689 2.22186 2.27489C2.23216 2.27184 2.24153 2.26626 2.24913 2.25866C2.25672 2.25107 2.2623 2.24169 2.26536 2.23139C2.37455 1.83888 2.56235 1.47264 2.81736 1.15489C3.15736 0.731893 3.56586 0.422893 4.04286 0.228393ZM3.64086 4.15339C3.58503 4.05573 3.49269 3.98424 3.38415 3.95465C3.27562 3.92507 3.15977 3.93981 3.06211 3.99564C2.96444 4.05147 2.89295 4.14381 2.86337 4.25235C2.83378 4.36088 2.84853 4.47673 2.90436 4.57439L3.75136 6.05689L2.90736 7.48089C2.85561 7.57738 2.84315 7.69014 2.87257 7.7956C2.902 7.90106 2.97104 7.99108 3.06526 8.04684C3.15949 8.1026 3.27162 8.1198 3.37823 8.09484C3.48484 8.06988 3.57768 8.00469 3.63736 7.91289L4.60736 6.27689C4.64561 6.21237 4.66609 6.13887 4.66671 6.06386C4.66732 5.98886 4.64805 5.91503 4.61086 5.84989L3.64086 4.15339ZM6.36386 7.27339C6.25583 7.27982 6.15434 7.32727 6.08012 7.40603C6.00591 7.48479 5.96458 7.58892 5.96458 7.69714C5.96458 7.80536 6.00591 7.90949 6.08012 7.98826C6.15434 8.06702 6.25583 8.11446 6.36386 8.12089H8.78786C8.89675 8.1156 8.99943 8.06862 9.07462 7.98969C9.14982 7.91075 9.19176 7.80591 9.19176 7.69689C9.19176 7.58787 9.14982 7.48303 9.07462 7.4041C8.99943 7.32516 8.89675 7.27818 8.78786 7.27289H6.36386V7.27339Z`,ge=`0 0 12 12`,_e=`M12 0C12.904 6.056 17.944 11.096 24 12C17.944 12.904 12.904 17.944 12 24C11.096 17.944 6.056 12.904 0 12C6.056 11.096 11.096 6.056 12 0Z`,ve=`0 0 24 24`,ye=3/2;function J({kind:e,size:t=12,className:n,"data-testid":r}){return e===`openhands`?(0,q.jsx)(N,{width:Math.round(t*ye),height:t,className:y(`shrink-0 [&_path:not([fill=transparent])]:fill-current`,n),"data-testid":r??`agent-brand-icon-openhands`,"aria-hidden":!0}):e===`claude-code`?(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:me,width:t,height:t,className:y(`shrink-0`,n),"data-testid":r??`agent-brand-icon-claude-code`,"aria-hidden":!0,children:(0,q.jsx)(`path`,{fill:`currentColor`,d:pe})}):e===`codex`?(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:ge,width:t,height:t,className:y(`shrink-0`,n),"data-testid":r??`agent-brand-icon-codex`,"aria-hidden":!0,children:(0,q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:he,fill:`currentColor`})}):e===`gemini`?(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:ve,width:t,height:t,className:y(`shrink-0`,n),"data-testid":r??`agent-brand-icon-gemini`,"aria-hidden":!0,children:(0,q.jsx)(`path`,{fill:`currentColor`,d:_e})}):(0,q.jsx)(ne,{width:t,height:t,className:y(`shrink-0`,n),"data-testid":r??`agent-brand-icon-generic`,"aria-hidden":!0})}function be({currentStep:e,totalSteps:t,className:n}){return(0,q.jsx)(`div`,{role:`progressbar`,"aria-valuemin":1,"aria-valuemax":t,"aria-valuenow":e+1,"data-testid":`onboarding-progress-bar`,className:y(`flex w-full items-center gap-2`,n),children:Array.from({length:t},(t,n)=>{let r=n<e,i=n===e;return(0,q.jsx)(`div`,{"data-testid":`onboarding-progress-step-${n}`,"data-state":r?`completed`:i?`current`:`upcoming`,className:y(`h-1.5 flex-1 rounded-full transition-colors duration-300`,r||i?`bg-white`:`bg-white/15`)},n)})})}function xe(e){return e===`openhands`?`openhands`:B.find(({key:t})=>t===e)?.icon??`cli-generic`}function Se({id:e,muted:t}){let n=xe(e);return n===`openhands`?(0,q.jsx)(J,{kind:`openhands`,size:16,className:y(`text-white`,t&&`opacity-55`),"data-testid":`onboarding-agent-icon-openhands`}):(0,q.jsx)(J,{kind:n,size:18,className:t?`text-[var(--oh-muted)]`:`text-white`,"data-testid":`onboarding-agent-icon-${n}`})}function Ce(){return[{id:`openhands`,label:`OpenHands`,descriptionKey:a.ONBOARDING$AGENT_OPENHANDS_DESCRIPTION},...B.map(e=>({id:e.key,label:e.display_name,descriptionKey:e.description_key}))]}function we({selectedAgentId:e,onSelect:t,onBack:n,onNext:r}){let{t:l}=i(`openhands`),{mutate:u,isPending:d}=re();return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-choose-agent`,className:`flex flex-col gap-6`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:l(a.ONBOARDING$AGENT_TITLE)}),(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:l(a.ONBOARDING$AGENT_SUBTITLE)})]}),(0,q.jsx)(`div`,{role:`radiogroup`,"aria-label":l(a.ONBOARDING$AGENT_TITLE),className:`flex flex-col gap-3`,children:Ce().map(n=>{let r=n.id===e;return(0,q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-testid":`onboarding-agent-option-${n.id}`,"data-selected":r,onClick:()=>t(n.id),className:y(`flex items-start justify-between gap-4 rounded-xl border px-4 py-3 text-left transition-colors cursor-pointer`,r?`border-white/45 bg-white/[0.09] shadow-none hover:border-white/45 hover:bg-white/[0.09]`:`border-white/30 bg-white/5 hover:border-white/40 hover:bg-white/[0.08]`),children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Se,{id:n.id,muted:!1}),(0,q.jsx)(`span`,{className:`truncate text-base font-normal text-white`,children:n.label})]}),(0,q.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:l(n.descriptionKey)})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:r?(0,q.jsx)(m,{width:18,height:18,className:`mt-1 shrink-0 text-white`,"aria-hidden":!0}):null})]},n.id)})}),(0,q.jsxs)(`div`,{className:y(`sticky bottom-0 flex items-center gap-2 bg-base-secondary pt-4 pb-7`,n?`justify-between`:`justify-end`),children:[n?(0,q.jsx)(j,{testId:`onboarding-agent-back`,type:`button`,variant:`secondary`,onClick:n,isDisabled:d,children:l(a.ONBOARDING$BACK)}):null,(0,q.jsx)(j,{testId:`onboarding-agent-next`,type:`button`,variant:`primary`,isDisabled:d,onClick:()=>{let t=ee(e);if(!t){r();return}u({agent_settings_diff:t},{onError:e=>{c(s(e)||l(a.ERROR$GENERIC))},onSuccess:()=>{o(l(a.SETTINGS$SAVED)),r()}})},children:l(d?a.SETTINGS$SAVING:a.ONBOARDING$NEXT)})]})]})}function Te({backend:e,isConnected:t,lastError:n}){let{t:r}=i(`openhands`);if(t===!0)return(0,q.jsxs)(`div`,{role:`status`,"data-testid":`onboarding-backend-connected`,className:y(`flex items-start gap-3 rounded-xl border border-green-500/40 bg-green-500/10 px-4 py-3`),children:[(0,q.jsx)(f,{className:`mt-0.5 size-5 shrink-0 text-green-400`}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-green-200`,children:r(a.ONBOARDING$BACKEND_CONNECTED_TITLE)}),(0,q.jsx)(`span`,{className:`text-xs text-green-200/80`,children:r(a.ONBOARDING$BACKEND_CONNECTED_BODY)})]})]});if(t===!1){let i=F(r,e,{isConnected:t,lastError:n});return(0,q.jsxs)(`div`,{role:`alert`,"data-testid":`onboarding-backend-disconnected`,className:`flex items-start gap-3 rounded-xl border border-red-500/40 bg-red-500/10 px-4 py-3`,children:[(0,q.jsx)(fe,{className:`mt-0.5 size-5 shrink-0 text-red-400`}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-red-200`,children:i}),(0,q.jsx)(`span`,{className:`text-xs text-red-200/80`,children:r(a.ONBOARDING$BACKEND_DISCONNECTED_BODY)})]})]})}return(0,q.jsxs)(`div`,{role:`status`,"data-testid":`onboarding-backend-checking`,className:`flex items-start gap-3 rounded-xl border border-white/10 bg-white/5 px-4 py-3`,children:[(0,q.jsx)(h,{className:`mt-0.5 size-5 shrink-0 animate-spin text-[var(--oh-text-tertiary)]`}),(0,q.jsx)(`span`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:r(a.ONBOARDING$BACKEND_CHECKING)})]})}function Ee({onBack:e,onNext:t,onClose:n}){let{t:r}=i(`openhands`),{active:o,addBackend:s,setActive:c,updateBackend:l}=u(),{trackBackendAdded:d}=R(),{backend:f}=o,p=w(f),m=x(),h=m!==null&&!p&&!(f.kind===`cloud`&&C(f.host,m)),g=p||h,_=K.useMemo(()=>T(),[]),v=g?{id:`onboarding-local-backend-draft`,name:b,host:_.baseUrl,apiKey:_.sessionApiKey,kind:`local`}:f,O=D(p?[]:[f]),k=g?null:O[f.id]?.isConnected??null,A=g?null:O[f.id]?.lastError??null,[M,N]=K.useState(!1);K.useEffect(()=>{k===!0&&N(!1)},[k]);let F=k===!0&&!M,L=K.useCallback((e,r)=>{if(p)s(e);else{let t=e.host!==f.host;l(f.id,e),t&&o.orgId!==null&&c(f.id,null)}let i=E(e.host);d({backendKind:e.kind,connectionMethod:r,isOpenhandsCloud:i,isCustomHost:!i,hasApiKey:!!e.apiKey,source:`onboarding`}),m!==null&&e.kind===`cloud`&&n?n():t()},[o.orgId,s,f.host,f.id,m,p,n,t,c,d,l]),z=y(`sticky bottom-0 mt-2 flex items-center gap-2 bg-base-secondary pt-4 pb-7`,e?`justify-between`:`justify-end`);return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-check-backend`,className:`flex flex-col gap-6`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:r(g?m?a.ONBOARDING$LOGIN_TO_CLOUD_TITLE:a.BACKEND$ADD_TITLE:a.ONBOARDING$BACKEND_TITLE)}),g?null:(0,q.jsx)(`p`,{"data-testid":`onboarding-backend-subtitle`,className:`text-sm text-[var(--oh-muted)]`,children:r(a.ONBOARDING$BACKEND_SUBTITLE)})]}),g?null:(0,q.jsx)(Te,{backend:v,isConnected:k,lastError:A}),k===!0?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>N(e=>!e),"aria-expanded":M,"data-testid":`onboarding-backend-show-configuration`,className:`flex w-full cursor-pointer items-center justify-center gap-1 text-center text-xs text-[var(--oh-muted)] transition-colors hover:text-content-2`,children:[(0,q.jsx)(`span`,{children:r(M?a.ONBOARDING$BACKEND_HIDE_CONFIGURATION:a.ONBOARDING$BACKEND_SHOW_CONFIGURATION)}),(0,q.jsx)(P,{className:y(`h-4 w-4 shrink-0 text-muted transition-transform`,M&&`rotate-180`),"aria-hidden":!0})]}):null,(0,q.jsx)(`div`,{"data-testid":`onboarding-backend-configuration-fields`,children:F?null:(0,q.jsx)(I,{onConnected:L,testIdRoot:`onboarding-backend`,initialManualBackend:v,requireManualApiKey:S(),manualSubmitLabel:r(a.ONBOARDING$NEXT),manualSubmittingLabel:r(a.SETTINGS$SAVING),manualSubmitTestId:`onboarding-backend-next`,analyticsSource:`onboarding`})}),F?(0,q.jsxs)(`div`,{className:z,children:[e?(0,q.jsx)(j,{testId:`onboarding-backend-back`,type:`button`,variant:`secondary`,onClick:e,children:r(a.ONBOARDING$BACK)}):null,(0,q.jsx)(j,{testId:`onboarding-backend-next`,type:`button`,variant:`primary`,onClick:t,children:r(a.ONBOARDING$NEXT)})]}):null]})}var Y=U;function X(){let e=ae(),t=oe();return(0,K.useCallback)(async n=>{try{await e.mutateAsync({name:Y,profile:n});let r=(await H.getProfile(Y)).profile.id;r&&await t.mutateAsync(r)}catch(e){console.error(`Failed to configure onboarding agent profile:`,e)}},[e,t])}var De=`openai/gpt-5.5`;function Oe({onBack:e,onNext:t}){let{t:n}=i(`openhands`),{backend:r}=l(),o=r.kind===`local`,s=_(),c=g(),u=X(),[d,f]=K.useState(null),[p,m]=K.useState(!1),h=K.useCallback(async()=>{if(!o||!d)return null;let e=d.values,t=typeof e[`llm.model`]==`string`?e[`llm.model`]:``;if(!t)return null;let n=typeof e[`llm.api_key`]==`string`?e[`llm.api_key`]:``,r=typeof e[`llm.base_url`]==`string`?e[`llm.base_url`]:``,i=ie(t),a={model:t};n&&(a.api_key=n),r&&(a.base_url=r);try{return await s.mutateAsync({name:i,request:{llm:a,include_secrets:!0}}),await c.mutateAsync(i),i}catch(e){return console.error(`Failed to persist onboarding LLM as profile:`,e),null}},[o,d,s,c]),y=K.useCallback(async()=>{m(!0);try{let e=await h();e&&await u({agent_kind:`openhands`,llm_profile_ref:e})}finally{m(!1),t()}},[h,u,t]);return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-setup-llm`,className:`flex flex-col gap-6 max-h-[calc(90vh-7rem)]`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:n(a.ONBOARDING$LLM_TITLE)}),(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:n(a.ONBOARDING$LLM_SUBTITLE)})]}),(0,q.jsx)(`div`,{"data-testid":`onboarding-llm-settings`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto custom-scrollbar-always`,children:(0,q.jsx)(v,{embedded:!0,hideSaveButton:!0,suppressSuccessToast:!0,initialValueOverrides:{"llm.model":De},onSaveSuccess:y,onSaveControlChange:f})}),(0,q.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-between gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,q.jsx)(j,{testId:`onboarding-llm-back`,type:`button`,variant:`secondary`,onClick:e,children:n(a.ONBOARDING$BACK)}),(0,q.jsx)(j,{testId:`onboarding-llm-next`,type:`button`,variant:`primary`,isDisabled:(d?.isSaving??!1)||p,onClick:()=>{if(d?.isDirty){d.save();return}t()},children:n(a.ONBOARDING$NEXT)})]})]})}function ke({providerKey:e,isActive:t,onBack:n,onNext:r}){let{t:o}=i(`openhands`),s=l(),{status:c,isChecking:u}=le(e,{enabled:t}),{fields:d,values:f,setValue:p,secretExists:m,hasValueFor:h,conflicts:g,consumesFileCredentials:_,save:v,isSaving:y}=de(e),b=X(),x=z(e)??e,S=c===`authenticated`,C=Ae(s.backend.kind,c),w=S||d.some(e=>e.secret&&(!e.multiline||_)&&h(e.name)),T=C&&!w,E=y||T||u&&!w;return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-setup-acp-secrets`,className:`flex flex-col gap-6`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:o(a.ONBOARDING$ACP_SECRETS_TITLE)}),(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:o(a.ONBOARDING$ACP_SECRETS_SUBTITLE,{provider:x})}),C&&!S?(0,q.jsx)(`p`,{"data-testid":`onboarding-acp-secrets-required-note`,className:`text-sm text-[var(--oh-muted)]`,children:o(a.ONBOARDING$ACP_SECRETS_REQUIRED_NOTE,{provider:x})}):c!==`authenticated`&&(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:o(a.ONBOARDING$ACP_SECRETS_SUBSCRIPTION_NOTE)})]}),(0,q.jsx)(ce,{status:c,isChecking:u,providerName:x,testIdPrefix:`onboarding-acp-auth`}),(0,q.jsx)(`div`,{className:`flex flex-col gap-5`,children:d.map(e=>(0,q.jsx)(ue,{field:e,value:f[e.name]??``,onChange:t=>p(e.name,t),alreadySet:m(e.name),testId:`onboarding-acp-secret-${e.name}`,showOptionalTag:!0},e.name))}),(0,q.jsx)(se,{conflicts:g}),T?(0,q.jsx)(`p`,{"data-testid":`onboarding-acp-secrets-blocked`,className:`text-sm text-amber-300`,children:o(a.ONBOARDING$ACP_SECRETS_REQUIRED_BLOCKED)}):null,(0,q.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-between gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,q.jsx)(j,{testId:`onboarding-acp-secrets-back`,type:`button`,variant:`secondary`,onClick:n,isDisabled:y,children:o(a.ONBOARDING$BACK)}),(0,q.jsx)(j,{testId:`onboarding-acp-secrets-next`,type:`button`,variant:`primary`,isDisabled:E,onClick:async()=>{await v()&&(e!==`openhands`&&await b({agent_kind:`acp`,acp_server:e,acp_model:V(e)??void 0}),r())},children:o(y?a.SETTINGS$SAVING:a.ONBOARDING$NEXT)})]})]})}function Ae(e,t){return t===`authenticated`?!1:e===`cloud`?!0:t===`unauthenticated`}function je({onBack:e,onClose:t,onLaunched:n}){let{t:r}=i(`openhands`),{navigate:o}=M(),{backend:s}=l(),c=s.kind!==`cloud`,u=r(a.ONBOARDING$HELLO_DEFAULT_MESSAGE),[d,f]=K.useState(u),{mutate:m,isPending:h,isSuccess:g}=W(),_=G(),v=h||g||_,y=K.useRef(!1),b=d.trim().length>0&&!v&&!y.current,x=()=>{!b||y.current||(y.current=!0,m({query:d.trim(),entryPoint:`onboarding_say_hello`},{onSuccess:e=>{o(`/conversations/${e.conversation_id}`),n()},onError:()=>{y.current=!1}}))};return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-say-hello`,className:`flex max-h-[calc(90vh-7rem)] flex-col`,children:[(0,q.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:r(a.ONBOARDING$HELLO_TITLE)}),(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:r(a.ONBOARDING$HELLO_SUBTITLE)})]}),(0,q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),x()},"data-testid":`onboarding-hello-input-form`,className:`mt-6 box-border flex w-full shrink-0 flex-col items-start justify-center rounded-[15px] border border-[var(--oh-border)] bg-surface-raised p-4`,children:[(0,q.jsx)(`div`,{className:`relative w-full`,children:(0,q.jsx)(`div`,{className:`box-border flex w-full shrink-0 flex-row items-end justify-between gap-2 p-0 pb-[18px]`,children:(0,q.jsx)(`input`,{"data-testid":`onboarding-hello-input`,"aria-label":r(a.ONBOARDING$HELLO_TITLE),type:`text`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),x())},placeholder:u,disabled:v,className:`min-h-[20px] w-full flex-1 bg-transparent text-[16px] font-normal leading-[20px] text-white outline-none placeholder:text-[var(--oh-text-tertiary)] disabled:cursor-not-allowed disabled:opacity-50`})})}),(0,q.jsx)(`div`,{className:`flex w-full min-w-0 items-center justify-end gap-2`,children:(0,q.jsx)(p,{buttonClassName:``,handleSubmit:x,disabled:!b})})]}),c?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{"data-testid":`onboarding-hello-or-separator`,className:`mt-6 flex w-full items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-[var(--oh-border)]`}),(0,q.jsx)(`span`,{className:`text-xs uppercase text-[var(--oh-muted)]`,children:r(a.LANDING$OR)}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-[var(--oh-border)]`})]}),(0,q.jsx)(`div`,{"data-testid":`onboarding-recommended-automations`,className:`flex min-h-0 flex-1 flex-col`,children:(0,q.jsx)(te,{onLaunched:n,scrollableGrid:!0})})]}):null,(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 bg-base-secondary pt-7 pb-7`,children:[(0,q.jsx)(j,{testId:`onboarding-hello-back`,type:`button`,variant:`secondary`,onClick:e,isDisabled:v,children:r(a.ONBOARDING$BACK)}),(0,q.jsx)(j,{testId:`onboarding-hello-close`,type:`button`,variant:`secondary`,onClick:t,isDisabled:v,children:r(a.BUTTON$CLOSE)})]})]})}var Me=t({OnboardingModal:()=>$}),Z=[`backend`,`agent`,`setup`,`hello`],Ne=[`agent`,`setup`,`hello`],Pe=`openhands-onboarding-started`;function Q({index:e,currentStep:t,children:n}){let r=e===t,i=(e-t)*100;return(0,q.jsx)(`div`,{"data-testid":`onboarding-slide-${e}`,"data-active":r,"aria-hidden":!r,style:{transform:`translateX(${i}%)`},className:y(`w-full transition-transform duration-300 ease-out`,!r&&`pointer-events-none absolute inset-0`),children:n})}function $({onClose:e,initialStep:t=0,isPreview:n=!1}){let{t:r}=i(`openhands`),{data:o}=L(),s=o?.user_consents_to_analytics===!0,{trackOnboardingStarted:c,trackOnboardingStepViewed:l,trackOnboardingCompleted:d,trackOnboardingSkipped:f}=R(),{active:p}=u(),{backend:m}=p,h=w(m),g=D(h?[]:[m]),_=x(),v=_!==null&&m.kind===`cloud`&&C(m.host,_),b=!h&&g[m.id]?.isConnected===!0&&(_===null||v),S=b?Ne:Z,[T,E]=K.useState(()=>Z[Math.min(Math.max(t,0),Z.length-1)]),[j,M]=K.useState(`openhands`);K.useEffect(()=>{S.includes(T)||E(S[0])},[T,S]);let N=S.length,P=S.includes(T)?T:S[0],F=S.indexOf(P),I=h||g[m.id]?.isConnected!==void 0,z=j===`openhands`,ee=F===0&&x()!==null,B=K.useCallback(()=>{E(e=>{let t=S,n=t.indexOf(e);return t[Math.min((n===-1?0:n)+1,t.length-1)]})},[S]),V=K.useCallback(()=>{E(e=>{let t=S,n=t.indexOf(e);return t[Math.max((n===-1?0:n)-1,0)]})},[S]),H=K.useRef(!1);K.useEffect(()=>{n||!s||H.current||window.sessionStorage.getItem(Pe)||(H.current=!0,window.sessionStorage.setItem(Pe,`1`),c())},[n,s]);let U=K.useRef(null);K.useEffect(()=>{n||!s||!I||U.current!==P&&(U.current=P,l({step:P,stepIndex:F,totalSteps:N,agent:j}))},[n,s,I,P,F,N,j]);let W=()=>{d({agent:j}),e()},G=()=>{f({step:P,stepIndex:F,totalSteps:N,agent:j}),e()};return(0,q.jsx)(O,{"aria-label":r(a.ONBOARDING$TITLE),children:(0,q.jsxs)(`div`,{className:`relative flex flex-col items-center gap-4`,children:[(0,q.jsxs)(`section`,{"data-testid":`onboarding-modal`,"data-current-step":F,"data-preview":n?`true`:void 0,className:y(`flex flex-col gap-6 overflow-hidden rounded-2xl border border-white/10 bg-base-secondary shadow-2xl`,k(`lg`),A,`max-h-[90vh]`),children:[(0,q.jsx)(`header`,{className:`flex flex-col gap-3 px-7 pt-7 shrink-0`,children:(0,q.jsx)(be,{currentStep:F,totalSteps:N})}),(0,q.jsx)(`div`,{"data-testid":`onboarding-scroll-area`,className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar-always px-7`,children:(0,q.jsxs)(`div`,{"data-testid":`onboarding-slide-rail`,"data-current-step":F,className:`relative overflow-clip`,children:[b?null:(0,q.jsx)(Q,{index:S.indexOf(`backend`),currentStep:F,children:(0,q.jsx)(Ee,{onNext:B,onClose:e})}),(0,q.jsx)(Q,{index:S.indexOf(`agent`),currentStep:F,children:(0,q.jsx)(we,{selectedAgentId:j,onSelect:M,onBack:b?void 0:V,onNext:B})}),(0,q.jsx)(Q,{index:S.indexOf(`setup`),currentStep:F,children:z?(0,q.jsx)(Oe,{onBack:V,onNext:B}):(0,q.jsx)(ke,{providerKey:j,isActive:P===`setup`,onBack:V,onNext:B})}),(0,q.jsx)(Q,{index:S.indexOf(`hello`),currentStep:F,children:(0,q.jsx)(je,{onBack:V,onClose:G,onLaunched:W})})]})})]}),F<N-1&&!ee?(0,q.jsx)(`button`,{type:`button`,"data-testid":`onboarding-skip`,onClick:G,className:`rounded-md px-3 py-2 text-sm text-[var(--oh-muted)] transition-colors hover:bg-white/5 hover:text-white cursor-pointer`,children:r(a.ONBOARDING$SKIP)}):null]})})}export{Me as n,J as r,$ as t};
1
+ import{a as e,r as t}from"./rolldown-runtime-BFRubm34.js";import{Ct as n,bt as r}from"./vendor-styling-CI0PQ3ab.js";import{t as i}from"./useTranslation-Cbf5AGg_.js";import{t as a}from"./declaration-BGsHjPEW.js";import{C as o,E as s,S as c,n as l,r as u}from"./active-backend-context-DHhm10VS.js";import{t as d}from"./createLucideIcon-D4Tak8A1.js";import{n as f,t as p}from"./chat-send-button-BZHG2hAW.js";import{t as m}from"./check-TbOEtHKj.js";import{t as h}from"./loader-circle-CsAsfLIs.js";import{i as g,r as _,t as v}from"./llm-settings-Cs_iieFY.js";import{t as y}from"./utils-DB9LsAzA.js";import{E as b,F as x,I as S,R as C,S as w,j as T}from"./agent-server-compatibility-C0MtTTwb.js";import{r as E}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{a as D}from"./use-backends-health-BagmAE_W.js";import{t as O}from"./modal-backdrop-zVwfOJZr.js";import{r as k,t as A}from"./modal-body-Cc2zp0xb.js";import{t as j}from"./brand-button-B1izLAdR.js";import{n as M}from"./navigation-context-DPs2G0X8.js";import{t as N}from"./openhands-logo-bcNw5bkY.js";import{c as P,s as F,t as I}from"./backend-form-modal-B8GtBA-J.js";import{r as L}from"./use-settings-BeJap6YL.js";import{t as R}from"./use-tracking-DFoPQUSU.js";import"./cloud-funnel-analytics-uzzLlLuj.js";import{c as z,i as ee,n as B,o as V}from"./acp-providers-DerAmTyY.js";import{n as H,r as U}from"./use-agent-profiles-Dn_S_Tkz.js";import{n as W}from"./use-create-conversation-CkKUQVbP.js";import{r as G,t as te}from"./recommended-automations-launcher-BWRRvMPE.js";import{t as ne}from"./terminal-Cgf___rK.js";import{t as re}from"./use-save-settings-DiDEbIJw.js";import{o as ie}from"./use-can-manage-org-profiles-CyYqfzeo.js";import{t as ae}from"./use-save-agent-profile-i4FcEP98.js";import{n as oe}from"./use-activate-agent-profile-BRDdSwQ0.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./use-acp-credential-form-DHd_Id-q.js";var fe=d(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),K=e(n(),1),q=r(),pe=`m19.6 66.5 19.7-11 .3-1-.3-.5h-1l-3.3-.2-11.2-.3L14 53l-9.5-.5-2.4-.5L0 49l.2-1.5 2-1.3 2.9.2 6.3.5 9.5.6 6.9.4L38 49.1h1.6l.2-.7-.5-.4-.4-.4L29 41l-10.6-7-5.6-4.1-3-2-1.5-2-.6-4.2 2.7-3 3.7.3.9.2 3.7 2.9 8 6.1L37 36l1.5 1.2.6-.4.1-.3-.7-1.1L33 25l-6-10.4-2.7-4.3-.7-2.6c-.3-1-.4-2-.4-3l3-4.2L28 0l4.2.6L33.8 2l2.6 6 4.1 9.3L47 29.9l2 3.8 1 3.4.3 1h.7v-.5l.5-7.2 1-8.7 1-11.2.3-3.2 1.6-3.8 3-2L61 2.6l2 2.9-.3 1.8-1.1 7.7L59 27.1l-1.5 8.2h.9l1-1.1 4.1-5.4 6.9-8.6 3-3.5L77 13l2.3-1.8h4.3l3.1 4.7-1.4 4.9-4.4 5.6-3.7 4.7-5.3 7.1-3.2 5.7.3.4h.7l12-2.6 6.4-1.1 7.6-1.3 3.5 1.6.4 1.6-1.4 3.4-8.2 2-9.6 2-14.3 3.3-.2.1.2.3 6.4.6 2.8.2h6.8l12.6 1 3.3 2 1.9 2.7-.3 2-5.1 2.6-6.8-1.6-16-3.8-5.4-1.3h-.8v.4l4.6 4.5 8.3 7.5L89 80.1l.5 2.4-1.3 2-1.4-.2-9.2-7-3.6-3-8-6.8h-.5v.7l1.8 2.7 9.8 14.7.5 4.5-.7 1.4-2.6 1-2.7-.6-5.8-8-6-9-4.7-8.2-.5.4-2.9 30.2-1.3 1.5-3 1.2-2.5-2-1.4-3 1.4-6.2 1.6-8 1.3-6.4 1.2-7.9.7-2.6v-.2H49L43 72l-9 12.3-7.2 7.6-1.7.7-3-1.5.3-2.8L24 86l10-12.8 6-7.9 4-4.6-.1-.5h-.3L17.2 77.4l-4.7.6-2-2 .2-3 1-1 8-5.5Z`,me=`0 0 100 100`,he=`M4.04286 0.228393C4.52451 0.0304495 5.0488 -0.0409817 5.56586 0.0208928C6.23236 0.0973928 6.82636 0.380893 7.34786 0.870893C7.35488 0.877545 7.36344 0.882351 7.37278 0.884881C7.38212 0.887412 7.39194 0.887588 7.40136 0.885393C8.10536 0.712393 8.78236 0.773393 9.43186 1.06839L9.46336 1.08339L9.54036 1.12139C10.2189 1.47289 10.7054 2.00639 10.9994 2.72039C11.1384 3.05989 11.2084 3.41439 11.2099 3.78339C11.2197 4.05816 11.1893 4.33288 11.1199 4.59889C11.1164 4.61245 11.1165 4.62665 11.12 4.6402C11.1235 4.65374 11.1303 4.66618 11.1399 4.67639C11.5329 5.0749 11.8063 5.57572 11.9289 6.12189C12.1214 7.07239 11.9239 7.92939 11.3374 8.69189L11.2464 8.80189C10.8579 9.24669 10.3481 9.56836 9.77936 9.72739C9.76694 9.73097 9.75556 9.73747 9.74617 9.74634C9.73677 9.75521 9.72964 9.7662 9.72536 9.77839C9.59786 10.1464 9.46986 10.4604 9.23186 10.7744C8.63236 11.5654 7.75086 12.0054 6.75786 11.9999C5.96636 11.9959 5.26486 11.7064 4.65286 11.1319C4.64358 11.1234 4.63225 11.1174 4.61998 11.1146C4.6077 11.1118 4.59491 11.1123 4.58286 11.1159C4.32386 11.1994 4.06286 11.2114 3.78086 11.2084C3.33033 11.2048 2.88658 11.0984 2.48336 10.8974C2.0613 10.688 1.6939 10.3831 1.41036 10.0069C1.30886 9.87239 1.20836 9.74589 1.13486 9.59639C1.03349 9.39033 0.95066 9.17565 0.887357 8.95489C0.754446 8.45324 0.751521 7.92599 0.878857 7.42289C0.882974 7.41102 0.884341 7.39837 0.882857 7.38589C0.88038 7.37348 0.873877 7.36223 0.864357 7.35389C0.556147 7.04213 0.320543 6.66619 0.174357 6.25289C0.0775698 5.99842 0.0213841 5.73031 0.00785682 5.45839C-0.0163229 5.10033 0.0153902 4.74069 0.101857 4.39239C0.326857 3.65039 0.756357 3.06839 1.39036 2.64589C1.53136 2.55189 1.66536 2.47889 1.79136 2.42689C1.93436 2.36689 2.07786 2.31689 2.22186 2.27489C2.23216 2.27184 2.24153 2.26626 2.24913 2.25866C2.25672 2.25107 2.2623 2.24169 2.26536 2.23139C2.37455 1.83888 2.56235 1.47264 2.81736 1.15489C3.15736 0.731893 3.56586 0.422893 4.04286 0.228393ZM3.64086 4.15339C3.58503 4.05573 3.49269 3.98424 3.38415 3.95465C3.27562 3.92507 3.15977 3.93981 3.06211 3.99564C2.96444 4.05147 2.89295 4.14381 2.86337 4.25235C2.83378 4.36088 2.84853 4.47673 2.90436 4.57439L3.75136 6.05689L2.90736 7.48089C2.85561 7.57738 2.84315 7.69014 2.87257 7.7956C2.902 7.90106 2.97104 7.99108 3.06526 8.04684C3.15949 8.1026 3.27162 8.1198 3.37823 8.09484C3.48484 8.06988 3.57768 8.00469 3.63736 7.91289L4.60736 6.27689C4.64561 6.21237 4.66609 6.13887 4.66671 6.06386C4.66732 5.98886 4.64805 5.91503 4.61086 5.84989L3.64086 4.15339ZM6.36386 7.27339C6.25583 7.27982 6.15434 7.32727 6.08012 7.40603C6.00591 7.48479 5.96458 7.58892 5.96458 7.69714C5.96458 7.80536 6.00591 7.90949 6.08012 7.98826C6.15434 8.06702 6.25583 8.11446 6.36386 8.12089H8.78786C8.89675 8.1156 8.99943 8.06862 9.07462 7.98969C9.14982 7.91075 9.19176 7.80591 9.19176 7.69689C9.19176 7.58787 9.14982 7.48303 9.07462 7.4041C8.99943 7.32516 8.89675 7.27818 8.78786 7.27289H6.36386V7.27339Z`,ge=`0 0 12 12`,_e=`M12 0C12.904 6.056 17.944 11.096 24 12C17.944 12.904 12.904 17.944 12 24C11.096 17.944 6.056 12.904 0 12C6.056 11.096 11.096 6.056 12 0Z`,ve=`0 0 24 24`,ye=3/2;function J({kind:e,size:t=12,className:n,"data-testid":r}){return e===`openhands`?(0,q.jsx)(N,{width:Math.round(t*ye),height:t,className:y(`shrink-0 [&_path:not([fill=transparent])]:fill-current`,n),"data-testid":r??`agent-brand-icon-openhands`,"aria-hidden":!0}):e===`claude-code`?(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:me,width:t,height:t,className:y(`shrink-0`,n),"data-testid":r??`agent-brand-icon-claude-code`,"aria-hidden":!0,children:(0,q.jsx)(`path`,{fill:`currentColor`,d:pe})}):e===`codex`?(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:ge,width:t,height:t,className:y(`shrink-0`,n),"data-testid":r??`agent-brand-icon-codex`,"aria-hidden":!0,children:(0,q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:he,fill:`currentColor`})}):e===`gemini`?(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:ve,width:t,height:t,className:y(`shrink-0`,n),"data-testid":r??`agent-brand-icon-gemini`,"aria-hidden":!0,children:(0,q.jsx)(`path`,{fill:`currentColor`,d:_e})}):(0,q.jsx)(ne,{width:t,height:t,className:y(`shrink-0`,n),"data-testid":r??`agent-brand-icon-generic`,"aria-hidden":!0})}function be({currentStep:e,totalSteps:t,className:n}){return(0,q.jsx)(`div`,{role:`progressbar`,"aria-valuemin":1,"aria-valuemax":t,"aria-valuenow":e+1,"data-testid":`onboarding-progress-bar`,className:y(`flex w-full items-center gap-2`,n),children:Array.from({length:t},(t,n)=>{let r=n<e,i=n===e;return(0,q.jsx)(`div`,{"data-testid":`onboarding-progress-step-${n}`,"data-state":r?`completed`:i?`current`:`upcoming`,className:y(`h-1.5 flex-1 rounded-full transition-colors duration-300`,r||i?`bg-white`:`bg-white/15`)},n)})})}function xe(e){return e===`openhands`?`openhands`:B.find(({key:t})=>t===e)?.icon??`cli-generic`}function Se({id:e,muted:t}){let n=xe(e);return n===`openhands`?(0,q.jsx)(J,{kind:`openhands`,size:16,className:y(`text-white`,t&&`opacity-55`),"data-testid":`onboarding-agent-icon-openhands`}):(0,q.jsx)(J,{kind:n,size:18,className:t?`text-[var(--oh-muted)]`:`text-white`,"data-testid":`onboarding-agent-icon-${n}`})}function Ce(){return[{id:`openhands`,label:`OpenHands`,descriptionKey:a.ONBOARDING$AGENT_OPENHANDS_DESCRIPTION},...B.map(e=>({id:e.key,label:e.display_name,descriptionKey:e.description_key}))]}function we({selectedAgentId:e,onSelect:t,onBack:n,onNext:r}){let{t:l}=i(`openhands`),{mutate:u,isPending:d}=re();return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-choose-agent`,className:`flex flex-col gap-6`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:l(a.ONBOARDING$AGENT_TITLE)}),(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:l(a.ONBOARDING$AGENT_SUBTITLE)})]}),(0,q.jsx)(`div`,{role:`radiogroup`,"aria-label":l(a.ONBOARDING$AGENT_TITLE),className:`flex flex-col gap-3`,children:Ce().map(n=>{let r=n.id===e;return(0,q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-testid":`onboarding-agent-option-${n.id}`,"data-selected":r,onClick:()=>t(n.id),className:y(`flex items-start justify-between gap-4 rounded-xl border px-4 py-3 text-left transition-colors cursor-pointer`,r?`border-white/45 bg-white/[0.09] shadow-none hover:border-white/45 hover:bg-white/[0.09]`:`border-white/30 bg-white/5 hover:border-white/40 hover:bg-white/[0.08]`),children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Se,{id:n.id,muted:!1}),(0,q.jsx)(`span`,{className:`truncate text-base font-normal text-white`,children:n.label})]}),(0,q.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:l(n.descriptionKey)})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:r?(0,q.jsx)(m,{width:18,height:18,className:`mt-1 shrink-0 text-white`,"aria-hidden":!0}):null})]},n.id)})}),(0,q.jsxs)(`div`,{className:y(`sticky bottom-0 flex items-center gap-2 bg-base-secondary pt-4 pb-7`,n?`justify-between`:`justify-end`),children:[n?(0,q.jsx)(j,{testId:`onboarding-agent-back`,type:`button`,variant:`secondary`,onClick:n,isDisabled:d,children:l(a.ONBOARDING$BACK)}):null,(0,q.jsx)(j,{testId:`onboarding-agent-next`,type:`button`,variant:`primary`,isDisabled:d,onClick:()=>{let t=ee(e);if(!t){r();return}u({agent_settings_diff:t},{onError:e=>{c(s(e)||l(a.ERROR$GENERIC))},onSuccess:()=>{o(l(a.SETTINGS$SAVED)),r()}})},children:l(d?a.SETTINGS$SAVING:a.ONBOARDING$NEXT)})]})]})}function Te({backend:e,isConnected:t,lastError:n}){let{t:r}=i(`openhands`);if(t===!0)return(0,q.jsxs)(`div`,{role:`status`,"data-testid":`onboarding-backend-connected`,className:y(`flex items-start gap-3 rounded-xl border border-green-500/40 bg-green-500/10 px-4 py-3`),children:[(0,q.jsx)(f,{className:`mt-0.5 size-5 shrink-0 text-green-400`}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-green-200`,children:r(a.ONBOARDING$BACKEND_CONNECTED_TITLE)}),(0,q.jsx)(`span`,{className:`text-xs text-green-200/80`,children:r(a.ONBOARDING$BACKEND_CONNECTED_BODY)})]})]});if(t===!1){let i=F(r,e,{isConnected:t,lastError:n});return(0,q.jsxs)(`div`,{role:`alert`,"data-testid":`onboarding-backend-disconnected`,className:`flex items-start gap-3 rounded-xl border border-red-500/40 bg-red-500/10 px-4 py-3`,children:[(0,q.jsx)(fe,{className:`mt-0.5 size-5 shrink-0 text-red-400`}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium text-red-200`,children:i}),(0,q.jsx)(`span`,{className:`text-xs text-red-200/80`,children:r(a.ONBOARDING$BACKEND_DISCONNECTED_BODY)})]})]})}return(0,q.jsxs)(`div`,{role:`status`,"data-testid":`onboarding-backend-checking`,className:`flex items-start gap-3 rounded-xl border border-white/10 bg-white/5 px-4 py-3`,children:[(0,q.jsx)(h,{className:`mt-0.5 size-5 shrink-0 animate-spin text-[var(--oh-text-tertiary)]`}),(0,q.jsx)(`span`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:r(a.ONBOARDING$BACKEND_CHECKING)})]})}function Ee({onBack:e,onNext:t,onClose:n}){let{t:r}=i(`openhands`),{active:o,addBackend:s,setActive:c,updateBackend:l}=u(),{trackBackendAdded:d}=R(),{backend:f}=o,p=w(f),m=x(),h=m!==null&&!p&&!(f.kind===`cloud`&&C(f.host,m)),g=p||h,_=K.useMemo(()=>T(),[]),v=g?{id:`onboarding-local-backend-draft`,name:b,host:_.baseUrl,apiKey:_.sessionApiKey,kind:`local`}:f,O=D(p?[]:[f]),k=g?null:O[f.id]?.isConnected??null,A=g?null:O[f.id]?.lastError??null,[M,N]=K.useState(!1);K.useEffect(()=>{k===!0&&N(!1)},[k]);let F=k===!0&&!M,L=K.useCallback((e,r)=>{if(p)s(e);else{let t=e.host!==f.host;l(f.id,e),t&&o.orgId!==null&&c(f.id,null)}let i=E(e.host);d({backendKind:e.kind,connectionMethod:r,isOpenhandsCloud:i,isCustomHost:!i,hasApiKey:!!e.apiKey,source:`onboarding`}),m!==null&&e.kind===`cloud`&&n?n():t()},[o.orgId,s,f.host,f.id,m,p,n,t,c,d,l]),z=y(`sticky bottom-0 mt-2 flex items-center gap-2 bg-base-secondary pt-4 pb-7`,e?`justify-between`:`justify-end`);return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-check-backend`,className:`flex flex-col gap-6`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:r(g?m?a.ONBOARDING$LOGIN_TO_CLOUD_TITLE:a.BACKEND$ADD_TITLE:a.ONBOARDING$BACKEND_TITLE)}),g?null:(0,q.jsx)(`p`,{"data-testid":`onboarding-backend-subtitle`,className:`text-sm text-[var(--oh-muted)]`,children:r(a.ONBOARDING$BACKEND_SUBTITLE)})]}),g?null:(0,q.jsx)(Te,{backend:v,isConnected:k,lastError:A}),k===!0?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>N(e=>!e),"aria-expanded":M,"data-testid":`onboarding-backend-show-configuration`,className:`flex w-full cursor-pointer items-center justify-center gap-1 text-center text-xs text-[var(--oh-muted)] transition-colors hover:text-content-2`,children:[(0,q.jsx)(`span`,{children:r(M?a.ONBOARDING$BACKEND_HIDE_CONFIGURATION:a.ONBOARDING$BACKEND_SHOW_CONFIGURATION)}),(0,q.jsx)(P,{className:y(`h-4 w-4 shrink-0 text-muted transition-transform`,M&&`rotate-180`),"aria-hidden":!0})]}):null,(0,q.jsx)(`div`,{"data-testid":`onboarding-backend-configuration-fields`,children:F?null:(0,q.jsx)(I,{onConnected:L,testIdRoot:`onboarding-backend`,initialManualBackend:v,requireManualApiKey:S(),manualSubmitLabel:r(a.ONBOARDING$NEXT),manualSubmittingLabel:r(a.SETTINGS$SAVING),manualSubmitTestId:`onboarding-backend-next`,analyticsSource:`onboarding`})}),F?(0,q.jsxs)(`div`,{className:z,children:[e?(0,q.jsx)(j,{testId:`onboarding-backend-back`,type:`button`,variant:`secondary`,onClick:e,children:r(a.ONBOARDING$BACK)}):null,(0,q.jsx)(j,{testId:`onboarding-backend-next`,type:`button`,variant:`primary`,onClick:t,children:r(a.ONBOARDING$NEXT)})]}):null]})}var Y=U;function X(){let e=ae(),t=oe();return(0,K.useCallback)(async n=>{try{await e.mutateAsync({name:Y,profile:n});let r=(await H.getProfile(Y)).profile.id;r&&await t.mutateAsync(r)}catch(e){console.error(`Failed to configure onboarding agent profile:`,e)}},[e,t])}var De=`openai/gpt-5.5`;function Oe({onBack:e,onNext:t}){let{t:n}=i(`openhands`),{backend:r}=l(),o=r.kind===`local`,s=_(),c=g(),u=X(),[d,f]=K.useState(null),[p,m]=K.useState(!1),h=K.useCallback(async()=>{if(!o||!d)return null;let e=d.values,t=typeof e[`llm.model`]==`string`?e[`llm.model`]:``;if(!t)return null;let n=typeof e[`llm.api_key`]==`string`?e[`llm.api_key`]:``,r=typeof e[`llm.base_url`]==`string`?e[`llm.base_url`]:``,i=ie(t),a={model:t};n&&(a.api_key=n),r&&(a.base_url=r);try{return await s.mutateAsync({name:i,request:{llm:a,include_secrets:!0}}),await c.mutateAsync(i),i}catch(e){return console.error(`Failed to persist onboarding LLM as profile:`,e),null}},[o,d,s,c]),y=K.useCallback(async()=>{m(!0);try{let e=await h();e&&await u({agent_kind:`openhands`,llm_profile_ref:e})}finally{m(!1),t()}},[h,u,t]);return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-setup-llm`,className:`flex flex-col gap-6 max-h-[calc(90vh-7rem)]`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:n(a.ONBOARDING$LLM_TITLE)}),(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:n(a.ONBOARDING$LLM_SUBTITLE)})]}),(0,q.jsx)(`div`,{"data-testid":`onboarding-llm-settings`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto custom-scrollbar-always`,children:(0,q.jsx)(v,{embedded:!0,hideSaveButton:!0,suppressSuccessToast:!0,initialValueOverrides:{"llm.model":De},onSaveSuccess:y,onSaveControlChange:f})}),(0,q.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-between gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,q.jsx)(j,{testId:`onboarding-llm-back`,type:`button`,variant:`secondary`,onClick:e,children:n(a.ONBOARDING$BACK)}),(0,q.jsx)(j,{testId:`onboarding-llm-next`,type:`button`,variant:`primary`,isDisabled:(d?.isSaving??!1)||p,onClick:()=>{if(d?.isDirty){d.save();return}t()},children:n(a.ONBOARDING$NEXT)})]})]})}function ke({providerKey:e,isActive:t,onBack:n,onNext:r}){let{t:o}=i(`openhands`),s=l(),{status:c,isChecking:u}=le(e,{enabled:t}),{fields:d,values:f,setValue:p,secretExists:m,hasValueFor:h,conflicts:g,consumesFileCredentials:_,save:v,isSaving:y}=de(e),b=X(),x=z(e)??e,S=c===`authenticated`,C=Ae(s.backend.kind,c),w=S||d.some(e=>e.secret&&(!e.multiline||_)&&h(e.name)),T=C&&!w,E=y||T||u&&!w;return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-setup-acp-secrets`,className:`flex flex-col gap-6`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:o(a.ONBOARDING$ACP_SECRETS_TITLE)}),(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:o(a.ONBOARDING$ACP_SECRETS_SUBTITLE,{provider:x})}),C&&!S?(0,q.jsx)(`p`,{"data-testid":`onboarding-acp-secrets-required-note`,className:`text-sm text-[var(--oh-muted)]`,children:o(a.ONBOARDING$ACP_SECRETS_REQUIRED_NOTE,{provider:x})}):c!==`authenticated`&&(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:o(a.ONBOARDING$ACP_SECRETS_SUBSCRIPTION_NOTE)})]}),(0,q.jsx)(ce,{status:c,isChecking:u,providerName:x,testIdPrefix:`onboarding-acp-auth`}),(0,q.jsx)(`div`,{className:`flex flex-col gap-5`,children:d.map(e=>(0,q.jsx)(ue,{field:e,value:f[e.name]??``,onChange:t=>p(e.name,t),alreadySet:m(e.name),testId:`onboarding-acp-secret-${e.name}`,showOptionalTag:!0},e.name))}),(0,q.jsx)(se,{conflicts:g}),T?(0,q.jsx)(`p`,{"data-testid":`onboarding-acp-secrets-blocked`,className:`text-sm text-amber-300`,children:o(a.ONBOARDING$ACP_SECRETS_REQUIRED_BLOCKED)}):null,(0,q.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-between gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,q.jsx)(j,{testId:`onboarding-acp-secrets-back`,type:`button`,variant:`secondary`,onClick:n,isDisabled:y,children:o(a.ONBOARDING$BACK)}),(0,q.jsx)(j,{testId:`onboarding-acp-secrets-next`,type:`button`,variant:`primary`,isDisabled:E,onClick:async()=>{await v()&&(e!==`openhands`&&await b({agent_kind:`acp`,acp_server:e,acp_model:V(e)??void 0}),r())},children:o(y?a.SETTINGS$SAVING:a.ONBOARDING$NEXT)})]})]})}function Ae(e,t){return t===`authenticated`?!1:e===`cloud`?!0:t===`unauthenticated`}function je({onBack:e,onClose:t,onLaunched:n}){let{t:r}=i(`openhands`),{navigate:o}=M(),{backend:s}=l(),c=s.kind!==`cloud`,u=r(a.ONBOARDING$HELLO_DEFAULT_MESSAGE),[d,f]=K.useState(u),{mutate:m,isPending:h,isSuccess:g}=W(),_=G(),v=h||g||_,y=K.useRef(!1),b=d.trim().length>0&&!v&&!y.current,x=()=>{!b||y.current||(y.current=!0,m({query:d.trim(),entryPoint:`onboarding_say_hello`},{onSuccess:e=>{o(`/conversations/${e.conversation_id}`),n()},onError:()=>{y.current=!1}}))};return(0,q.jsxs)(`div`,{"data-testid":`onboarding-step-say-hello`,className:`flex max-h-[calc(90vh-7rem)] flex-col`,children:[(0,q.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2`,children:[(0,q.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:r(a.ONBOARDING$HELLO_TITLE)}),(0,q.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:r(a.ONBOARDING$HELLO_SUBTITLE)})]}),(0,q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),x()},"data-testid":`onboarding-hello-input-form`,className:`mt-6 box-border flex w-full shrink-0 flex-col items-start justify-center rounded-[15px] border border-[var(--oh-border)] bg-surface-raised p-4`,children:[(0,q.jsx)(`div`,{className:`relative w-full`,children:(0,q.jsx)(`div`,{className:`box-border flex w-full shrink-0 flex-row items-end justify-between gap-2 p-0 pb-[18px]`,children:(0,q.jsx)(`input`,{"data-testid":`onboarding-hello-input`,"aria-label":r(a.ONBOARDING$HELLO_TITLE),type:`text`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),x())},placeholder:u,disabled:v,className:`min-h-[20px] w-full flex-1 bg-transparent text-[16px] font-normal leading-[20px] text-white outline-none placeholder:text-[var(--oh-text-tertiary)] disabled:cursor-not-allowed disabled:opacity-50`})})}),(0,q.jsx)(`div`,{className:`flex w-full min-w-0 items-center justify-end gap-2`,children:(0,q.jsx)(p,{buttonClassName:``,handleSubmit:x,disabled:!b})})]}),c?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{"data-testid":`onboarding-hello-or-separator`,className:`mt-6 flex w-full items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`h-px flex-1 bg-[var(--oh-border)]`}),(0,q.jsx)(`span`,{className:`text-xs uppercase text-[var(--oh-muted)]`,children:r(a.LANDING$OR)}),(0,q.jsx)(`div`,{className:`h-px flex-1 bg-[var(--oh-border)]`})]}),(0,q.jsx)(`div`,{"data-testid":`onboarding-recommended-automations`,className:`flex min-h-0 flex-1 flex-col`,children:(0,q.jsx)(te,{onLaunched:n,scrollableGrid:!0})})]}):null,(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 bg-base-secondary pt-7 pb-7`,children:[(0,q.jsx)(j,{testId:`onboarding-hello-back`,type:`button`,variant:`secondary`,onClick:e,isDisabled:v,children:r(a.ONBOARDING$BACK)}),(0,q.jsx)(j,{testId:`onboarding-hello-close`,type:`button`,variant:`secondary`,onClick:t,isDisabled:v,children:r(a.BUTTON$CLOSE)})]})]})}var Me=t({OnboardingModal:()=>$}),Z=[`backend`,`agent`,`setup`,`hello`],Ne=[`agent`,`setup`,`hello`],Pe=`openhands-onboarding-started`;function Q({index:e,currentStep:t,children:n}){let r=e===t,i=(e-t)*100;return(0,q.jsx)(`div`,{"data-testid":`onboarding-slide-${e}`,"data-active":r,"aria-hidden":!r,style:{transform:`translateX(${i}%)`},className:y(`w-full transition-transform duration-300 ease-out`,!r&&`pointer-events-none absolute inset-0`),children:n})}function $({onClose:e,initialStep:t=0,isPreview:n=!1}){let{t:r}=i(`openhands`),{data:o}=L(),s=o?.user_consents_to_analytics===!0,{trackOnboardingStarted:c,trackOnboardingStepViewed:l,trackOnboardingCompleted:d,trackOnboardingSkipped:f}=R(),{active:p}=u(),{backend:m}=p,h=w(m),g=D(h?[]:[m]),_=x(),v=_!==null&&m.kind===`cloud`&&C(m.host,_),b=!h&&g[m.id]?.isConnected===!0&&(_===null||v),S=b?Ne:Z,[T,E]=K.useState(()=>Z[Math.min(Math.max(t,0),Z.length-1)]),[j,M]=K.useState(`openhands`);K.useEffect(()=>{S.includes(T)||E(S[0])},[T,S]);let N=S.length,P=S.includes(T)?T:S[0],F=S.indexOf(P),I=h||g[m.id]?.isConnected!==void 0,z=j===`openhands`,ee=F===0&&x()!==null,B=K.useCallback(()=>{E(e=>{let t=S,n=t.indexOf(e);return t[Math.min((n===-1?0:n)+1,t.length-1)]})},[S]),V=K.useCallback(()=>{E(e=>{let t=S,n=t.indexOf(e);return t[Math.max((n===-1?0:n)-1,0)]})},[S]),H=K.useRef(!1);K.useEffect(()=>{n||!s||H.current||window.sessionStorage.getItem(Pe)||(H.current=!0,window.sessionStorage.setItem(Pe,`1`),c())},[n,s]);let U=K.useRef(null);K.useEffect(()=>{n||!s||!I||U.current!==P&&(U.current=P,l({step:P,stepIndex:F,totalSteps:N,agent:j}))},[n,s,I,P,F,N,j]);let W=()=>{d({agent:j}),e()},G=()=>{f({step:P,stepIndex:F,totalSteps:N,agent:j}),e()};return(0,q.jsx)(O,{"aria-label":r(a.ONBOARDING$TITLE),children:(0,q.jsxs)(`div`,{className:`relative flex flex-col items-center gap-4`,children:[(0,q.jsxs)(`section`,{"data-testid":`onboarding-modal`,"data-current-step":F,"data-preview":n?`true`:void 0,className:y(`flex flex-col gap-6 overflow-hidden rounded-2xl border border-white/10 bg-base-secondary shadow-2xl`,k(`lg`),A,`max-h-[90vh]`),children:[(0,q.jsx)(`header`,{className:`flex flex-col gap-3 px-7 pt-7 shrink-0`,children:(0,q.jsx)(be,{currentStep:F,totalSteps:N})}),(0,q.jsx)(`div`,{"data-testid":`onboarding-scroll-area`,className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar-always px-7`,children:(0,q.jsxs)(`div`,{"data-testid":`onboarding-slide-rail`,"data-current-step":F,className:`relative overflow-clip`,children:[b?null:(0,q.jsx)(Q,{index:S.indexOf(`backend`),currentStep:F,children:(0,q.jsx)(Ee,{onNext:B,onClose:e})}),(0,q.jsx)(Q,{index:S.indexOf(`agent`),currentStep:F,children:(0,q.jsx)(we,{selectedAgentId:j,onSelect:M,onBack:b?void 0:V,onNext:B})}),(0,q.jsx)(Q,{index:S.indexOf(`setup`),currentStep:F,children:z?(0,q.jsx)(Oe,{onBack:V,onNext:B}):(0,q.jsx)(ke,{providerKey:j,isActive:P===`setup`,onBack:V,onNext:B})}),(0,q.jsx)(Q,{index:S.indexOf(`hello`),currentStep:F,children:(0,q.jsx)(je,{onBack:V,onClose:G,onLaunched:W})})]})})]}),F<N-1&&!ee?(0,q.jsx)(`button`,{type:`button`,"data-testid":`onboarding-skip`,onClick:G,className:`rounded-md px-3 py-2 text-sm text-[var(--oh-muted)] transition-colors hover:bg-white/5 hover:text-white cursor-pointer`,children:r(a.ONBOARDING$SKIP)}):null]})})}export{Me as n,J as r,$ as t};
@@ -1 +1 @@
1
- import{_ as e}from"./agent-server-compatibility-BWN-EIQn.js";import{S as t}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~ftka0fnu-cFNmfAE6.js";import{t as n}from"./proxy-B3tCGf0X.js";function r(e){return{items:e?.items??[],currentOrgId:e?.current_org_id??null}}function i(t){if(t)return t;let n=e().backend;if(n.kind!==`cloud`)throw Error(`Cloud organization calls require a cloud backend. Active backend is local.`);return n}async function a(e){return r(await n({backend:i(e),method:`GET`,path:`/api/organizations`}))}async function o(e){let r=i(e);try{return{orgId:(await n({backend:r,method:`GET`,path:`/api/keys/current`}))?.org_id??null,isLegacyKey:!1}}catch(e){if(e instanceof t&&e.status===400)return{orgId:null,isLegacyKey:!0};throw e}}async function s(e,t){let r=await n({backend:i(t),method:`GET`,path:`/api/organizations/${encodeURIComponent(e)}/me`});return{orgId:r?.org_id??e,userId:r?.user_id??``,role:r?.role??null,permissions:Array.isArray(r?.permissions)?r.permissions:null}}export{a as n,o as r,s as t};
1
+ import{_ as e}from"./agent-server-compatibility-C0MtTTwb.js";import{S as t}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~ftka0fnu-cFNmfAE6.js";import{t as n}from"./proxy-G4ce0fnQ.js";function r(e){return{items:e?.items??[],currentOrgId:e?.current_org_id??null}}function i(t){if(t)return t;let n=e().backend;if(n.kind!==`cloud`)throw Error(`Cloud organization calls require a cloud backend. Active backend is local.`);return n}async function a(e){return r(await n({backend:i(e),method:`GET`,path:`/api/organizations`}))}async function o(e){let r=i(e);try{return{orgId:(await n({backend:r,method:`GET`,path:`/api/keys/current`}))?.org_id??null,isLegacyKey:!1}}catch(e){if(e instanceof t&&e.status===400)return{orgId:null,isLegacyKey:!0};throw e}}async function s(e,t){let r=await n({backend:i(t),method:`GET`,path:`/api/organizations/${encodeURIComponent(e)}/me`});return{orgId:r?.org_id??e,userId:r?.user_id??``,role:r?.role??null,permissions:Array.isArray(r?.permissions)?r.permissions:null}}export{a as n,o as r,s as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-BFRubm34.js";import{Ct as e,bt as t}from"./vendor-styling-CI0PQ3ab.js";import{a as n,o as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{u as i}from"./suspense-DmZ3MSSh.js";import{n as a}from"./useQuery-D5pEZbY0.js";import{t as o}from"./createLucideIcon-D4Tak8A1.js";import{_ as s,d as c}from"./agent-server-compatibility-BWN-EIQn.js";import{_ as l}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{r as u,t as d}from"./agent-server-conversation-service.api-DSPIkMwJ.js";var f=class extends i{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:i}=e,a=super.createResult(e,t),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=i.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:n(t,i.data),hasPreviousPage:r(t,i.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function p(e,t){return a(e,f,t)}var m=o(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),h=async e=>{let t=(await d.batchGetAppConversations([e]))[0];if(!t)throw Error(`V1 conversation not found: ${e}`);return{conversationUrl:t.conversation_url,sessionApiKey:t.session_api_key,sandboxId:t.sandbox_id}},g=async e=>{let{conversationUrl:t,sessionApiKey:n,sandboxId:r}=await h(e);if(s().backend.kind===`cloud`){if(!r)throw Error(`Cannot stop runtime: cloud conversation ${e} has no sandbox_id.`);return await u(r),{success:!0}}return new l(c({conversationUrl:t,sessionApiKey:n})).interruptConversation(e)},_=async(e,t)=>{let{conversationUrl:n,sessionApiKey:r}=await h(e);return new l(c({conversationUrl:n,sessionApiKey:r})).askAgent(e,t)},v=async(e,t)=>{let{conversationUrl:n,sessionApiKey:r}=await h(e);await new l(c({conversationUrl:n,sessionApiKey:r})).startGoal(e,t)},y=async e=>{let{conversationUrl:t,sessionApiKey:n}=await h(e);await new l(c({conversationUrl:t,sessionApiKey:n})).stopGoal(e)},b=async e=>{let{conversationUrl:t,sessionApiKey:n}=await h(e);await new l(c({conversationUrl:t,sessionApiKey:n})).resumeGoal(e)},x=async e=>{let{conversationUrl:t,sessionApiKey:n}=await h(e);return new l(c({conversationUrl:t,sessionApiKey:n})).runConversation(e)},S=(e,t,n)=>{e.setQueriesData({queryKey:[`user`,`conversation`,t]},e=>e&&{...e,...n}),e.setQueriesData({queryKey:[`user`,`conversations`]},e=>e&&{...e,pages:e.pages.map(e=>({...e,items:e.items.map(e=>e.id===t?{...e,...n}:e)}))})},C=(e,t,n)=>S(e,t,{execution_status:n}),w=(e,t,n)=>S(e,t,{llm_model:n}),T=(e,t)=>{e.invalidateQueries({queryKey:[`user`,`conversation`,t]}),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`v1-batch-get-app-conversations`]}),e.invalidateQueries({queryKey:[`unified`,`vscode_url`]})};e();var E=t(),D=e=>(0,E.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,E.jsx)(`path`,{d:`M21.0004 6.00001C21.0016 5.43668 20.8441 4.88442 20.5459 4.40644C20.2478 3.92846 19.8212 3.54406 19.3148 3.29726C18.8084 3.05046 18.2428 2.95122 17.6826 3.0109C17.1224 3.07059 16.5904 3.28678 16.1474 3.63473C15.7044 3.98269 15.3683 4.44835 15.1776 4.97841C14.9869 5.50848 14.9493 6.08152 15.0691 6.63197C15.1888 7.18241 15.4612 7.688 15.8549 8.09088C16.2487 8.49375 16.7479 8.77762 17.2954 8.91001V10.5C17.2978 10.6372 17.261 10.7722 17.1892 10.8891C17.1175 11.006 17.0138 11.1 16.8904 11.16L12.7354 13.32L8.59544 11.22C8.46356 11.1544 8.35443 11.0507 8.28221 10.9223C8.21 10.7939 8.17802 10.6468 8.19044 10.5V8.91001C8.89743 8.72746 9.51358 8.29333 9.92339 7.689C10.3332 7.08467 10.5085 6.35161 10.4165 5.62725C10.3245 4.90289 9.97149 4.23695 9.42361 3.75426C8.87573 3.27157 8.17062 3.00527 7.44044 3.00527C6.71026 3.00527 6.00514 3.27157 5.45726 3.75426C4.90938 4.23695 4.55635 4.90289 4.46435 5.62725C4.37234 6.35161 4.54768 7.08467 4.95749 7.689C5.36729 8.29333 5.98344 8.72746 6.69044 8.91001V10.5C6.6913 10.9156 6.80651 11.323 7.02346 11.6776C7.24041 12.0321 7.55073 12.3201 7.92044 12.51L12.0004 14.61V16.59C11.2934 16.7726 10.6773 17.2067 10.2675 17.811C9.85768 18.4153 9.68234 19.1484 9.77435 19.8728C9.86635 20.5971 10.2194 21.2631 10.7673 21.7457C11.3151 22.2284 12.0203 22.4947 12.7504 22.4947C13.4806 22.4947 14.1857 22.2284 14.7336 21.7457C15.2815 21.2631 15.6345 20.5971 15.7265 19.8728C15.8185 19.1484 15.6432 18.4153 15.2334 17.811C14.8236 17.2067 14.2074 16.7726 13.5004 16.59V14.61L17.5504 12.57C17.9317 12.3784 18.2501 12.0816 18.468 11.7148C18.686 11.348 18.7944 10.9265 18.7804 10.5V8.88001C19.4147 8.70922 19.9755 8.33496 20.3765 7.81469C20.7776 7.29442 20.9967 6.6569 21.0004 6.00001ZM6.00044 6.00001C6.00044 5.60218 6.15847 5.22065 6.43978 4.93934C6.72108 4.65804 7.10261 4.5 7.50044 4.5C7.89826 4.5 8.27979 4.65804 8.5611 4.93934C8.8424 5.22065 9.00044 5.60218 9.00044 6.00001C9.00044 6.39783 8.8424 6.77936 8.5611 7.06067C8.27979 7.34197 7.89826 7.50001 7.50044 7.50001C7.10261 7.50001 6.72108 7.34197 6.43978 7.06067C6.15847 6.77936 6.00044 6.39783 6.00044 6.00001ZM14.2054 19.5C14.2054 19.8978 14.0474 20.2794 13.7661 20.5607C13.4848 20.842 13.1033 21 12.7054 21C12.3076 21 11.9261 20.842 11.6448 20.5607C11.3635 20.2794 11.2054 19.8978 11.2054 19.5C11.2054 19.1022 11.3635 18.7207 11.6448 18.4393C11.9261 18.158 12.3076 18 12.7054 18C13.1033 18 13.4848 18.158 13.7661 18.4393C14.0474 18.7207 14.2054 19.1022 14.2054 19.5ZM18.0004 7.50001C17.6026 7.50001 17.2211 7.34197 16.9398 7.06067C16.6585 6.77936 16.5004 6.39783 16.5004 6.00001C16.5004 5.60218 16.6585 5.22065 16.9398 4.93934C17.2211 4.65804 17.6026 4.5 18.0004 4.5C18.3983 4.5 18.7798 4.65804 19.0611 4.93934C19.3424 5.22065 19.5004 5.60218 19.5004 6.00001C19.5004 6.39783 19.3424 6.77936 19.0611 7.06067C18.7798 7.34197 18.3983 7.50001 18.0004 7.50001Z`,fill:`currentColor`})}),O=e=>{let t=e.match(/^\/workspace\/[^/]+\/(.*)$/);return t?t[1]:e},k=e=>{let t=e.trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);if(!n||/^[A-Za-z]:$/.test(n))return``;let r=Math.max(n.lastIndexOf(`/`),n.lastIndexOf(`\\`));return r>=0?n.slice(r+1):n};export{T as a,x as c,y as d,C as f,p as h,_ as i,b as l,m,O as n,S as o,w as p,D as r,g as s,k as t,v as u};
1
+ import"./rolldown-runtime-BFRubm34.js";import{Ct as e,bt as t}from"./vendor-styling-CI0PQ3ab.js";import{a as n,o as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{u as i}from"./suspense-DmZ3MSSh.js";import{n as a}from"./useQuery-D5pEZbY0.js";import{t as o}from"./createLucideIcon-D4Tak8A1.js";import{_ as s,d as c}from"./agent-server-compatibility-C0MtTTwb.js";import{_ as l}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{r as u,t as d}from"./agent-server-conversation-service.api-lzc8dabY.js";var f=class extends i{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:i}=e,a=super.createResult(e,t),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=i.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:n(t,i.data),hasPreviousPage:r(t,i.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function p(e,t){return a(e,f,t)}var m=o(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),h=async e=>{let t=(await d.batchGetAppConversations([e]))[0];if(!t)throw Error(`V1 conversation not found: ${e}`);return{conversationUrl:t.conversation_url,sessionApiKey:t.session_api_key,sandboxId:t.sandbox_id}},g=async e=>{let{conversationUrl:t,sessionApiKey:n,sandboxId:r}=await h(e);if(s().backend.kind===`cloud`){if(!r)throw Error(`Cannot stop runtime: cloud conversation ${e} has no sandbox_id.`);return await u(r),{success:!0}}return new l(c({conversationUrl:t,sessionApiKey:n})).interruptConversation(e)},_=async(e,t)=>{let{conversationUrl:n,sessionApiKey:r}=await h(e);return new l(c({conversationUrl:n,sessionApiKey:r})).askAgent(e,t)},v=async(e,t)=>{let{conversationUrl:n,sessionApiKey:r}=await h(e);await new l(c({conversationUrl:n,sessionApiKey:r})).startGoal(e,t)},y=async e=>{let{conversationUrl:t,sessionApiKey:n}=await h(e);await new l(c({conversationUrl:t,sessionApiKey:n})).stopGoal(e)},b=async e=>{let{conversationUrl:t,sessionApiKey:n}=await h(e);await new l(c({conversationUrl:t,sessionApiKey:n})).resumeGoal(e)},x=async e=>{let{conversationUrl:t,sessionApiKey:n}=await h(e);return new l(c({conversationUrl:t,sessionApiKey:n})).runConversation(e)},S=(e,t,n)=>{e.setQueriesData({queryKey:[`user`,`conversation`,t]},e=>e&&{...e,...n}),e.setQueriesData({queryKey:[`user`,`conversations`]},e=>e&&{...e,pages:e.pages.map(e=>({...e,items:e.items.map(e=>e.id===t?{...e,...n}:e)}))})},C=(e,t,n)=>S(e,t,{execution_status:n}),w=(e,t,n)=>S(e,t,{llm_model:n}),T=(e,t)=>{e.invalidateQueries({queryKey:[`user`,`conversation`,t]}),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`v1-batch-get-app-conversations`]}),e.invalidateQueries({queryKey:[`unified`,`vscode_url`]})};e();var E=t(),D=e=>(0,E.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,E.jsx)(`path`,{d:`M21.0004 6.00001C21.0016 5.43668 20.8441 4.88442 20.5459 4.40644C20.2478 3.92846 19.8212 3.54406 19.3148 3.29726C18.8084 3.05046 18.2428 2.95122 17.6826 3.0109C17.1224 3.07059 16.5904 3.28678 16.1474 3.63473C15.7044 3.98269 15.3683 4.44835 15.1776 4.97841C14.9869 5.50848 14.9493 6.08152 15.0691 6.63197C15.1888 7.18241 15.4612 7.688 15.8549 8.09088C16.2487 8.49375 16.7479 8.77762 17.2954 8.91001V10.5C17.2978 10.6372 17.261 10.7722 17.1892 10.8891C17.1175 11.006 17.0138 11.1 16.8904 11.16L12.7354 13.32L8.59544 11.22C8.46356 11.1544 8.35443 11.0507 8.28221 10.9223C8.21 10.7939 8.17802 10.6468 8.19044 10.5V8.91001C8.89743 8.72746 9.51358 8.29333 9.92339 7.689C10.3332 7.08467 10.5085 6.35161 10.4165 5.62725C10.3245 4.90289 9.97149 4.23695 9.42361 3.75426C8.87573 3.27157 8.17062 3.00527 7.44044 3.00527C6.71026 3.00527 6.00514 3.27157 5.45726 3.75426C4.90938 4.23695 4.55635 4.90289 4.46435 5.62725C4.37234 6.35161 4.54768 7.08467 4.95749 7.689C5.36729 8.29333 5.98344 8.72746 6.69044 8.91001V10.5C6.6913 10.9156 6.80651 11.323 7.02346 11.6776C7.24041 12.0321 7.55073 12.3201 7.92044 12.51L12.0004 14.61V16.59C11.2934 16.7726 10.6773 17.2067 10.2675 17.811C9.85768 18.4153 9.68234 19.1484 9.77435 19.8728C9.86635 20.5971 10.2194 21.2631 10.7673 21.7457C11.3151 22.2284 12.0203 22.4947 12.7504 22.4947C13.4806 22.4947 14.1857 22.2284 14.7336 21.7457C15.2815 21.2631 15.6345 20.5971 15.7265 19.8728C15.8185 19.1484 15.6432 18.4153 15.2334 17.811C14.8236 17.2067 14.2074 16.7726 13.5004 16.59V14.61L17.5504 12.57C17.9317 12.3784 18.2501 12.0816 18.468 11.7148C18.686 11.348 18.7944 10.9265 18.7804 10.5V8.88001C19.4147 8.70922 19.9755 8.33496 20.3765 7.81469C20.7776 7.29442 20.9967 6.6569 21.0004 6.00001ZM6.00044 6.00001C6.00044 5.60218 6.15847 5.22065 6.43978 4.93934C6.72108 4.65804 7.10261 4.5 7.50044 4.5C7.89826 4.5 8.27979 4.65804 8.5611 4.93934C8.8424 5.22065 9.00044 5.60218 9.00044 6.00001C9.00044 6.39783 8.8424 6.77936 8.5611 7.06067C8.27979 7.34197 7.89826 7.50001 7.50044 7.50001C7.10261 7.50001 6.72108 7.34197 6.43978 7.06067C6.15847 6.77936 6.00044 6.39783 6.00044 6.00001ZM14.2054 19.5C14.2054 19.8978 14.0474 20.2794 13.7661 20.5607C13.4848 20.842 13.1033 21 12.7054 21C12.3076 21 11.9261 20.842 11.6448 20.5607C11.3635 20.2794 11.2054 19.8978 11.2054 19.5C11.2054 19.1022 11.3635 18.7207 11.6448 18.4393C11.9261 18.158 12.3076 18 12.7054 18C13.1033 18 13.4848 18.158 13.7661 18.4393C14.0474 18.7207 14.2054 19.1022 14.2054 19.5ZM18.0004 7.50001C17.6026 7.50001 17.2211 7.34197 16.9398 7.06067C16.6585 6.77936 16.5004 6.39783 16.5004 6.00001C16.5004 5.60218 16.6585 5.22065 16.9398 4.93934C17.2211 4.65804 17.6026 4.5 18.0004 4.5C18.3983 4.5 18.7798 4.65804 19.0611 4.93934C19.3424 5.22065 19.5004 5.60218 19.5004 6.00001C19.5004 6.39783 19.3424 6.77936 19.0611 7.06067C18.7798 7.34197 18.3983 7.50001 18.0004 7.50001Z`,fill:`currentColor`})}),O=e=>{let t=e.match(/^\/workspace\/[^/]+\/(.*)$/);return t?t[1]:e},k=e=>{let t=e.trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);if(!n||/^[A-Za-z]:$/.test(n))return``;let r=Math.max(n.lastIndexOf(`/`),n.lastIndexOf(`\\`));return r>=0?n.slice(r+1):n};export{T as a,x as c,y as d,C as f,p as h,_ as i,b as l,m,O as n,S as o,w as p,D as r,g as s,k as t,v as u};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-Cbf5AGg_.js";import{t as i}from"./declaration-BGsHjPEW.js";import{t as a}from"./list-todo-CAtvkzcy.js";import{t as o}from"./brand-button-B1izLAdR.js";import{t as s}from"./conversation-store-LptbOvKa.js";import{t as c}from"./use-handle-plan-click-CsAW3FlH.js";import{t as l}from"./markdown-renderer-B4V2OMFP.js";import{n as u,r as d}from"./plan-components-BdZXPyZU.js";import{t as f}from"./conversation-tab-empty-state-CNUmIms2.js";var p=e(t(),1),m=n();function h(){let{t:e}=r(`openhands`),{scrollRef:t,onChatBodyScroll:n,autoScroll:h,scrollDomToBottom:g}=d(p.useRef(null)),{planContent:_,conversationMode:v}=s();p.useEffect(()=>{h&&g()},[_,h,g]);let y=v===`plan`,{handlePlanClick:b}=c();return _==null?(0,m.jsx)(f,{icon:(0,m.jsx)(a,{"aria-hidden":!0,strokeWidth:2,className:`size-full`}),action:(0,m.jsx)(o,{type:`button`,variant:`secondary`,onClick:b,isDisabled:y,className:`min-w-40 justify-center px-6`,children:e(i.COMMON$CREATE_A_PLAN)}),children:e(i.PLANNER$EMPTY_MESSAGE)}):(0,m.jsx)(`div`,{ref:t,onScroll:e=>n(e.currentTarget),className:`flex flex-col w-full h-full p-4 overflow-auto`,children:(0,m.jsx)(l,{includeStandard:!0,components:u,children:_})})}export{h as default};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./useTranslation-Cbf5AGg_.js";import{t as i}from"./declaration-BGsHjPEW.js";import{t as a}from"./list-todo-CAtvkzcy.js";import{t as o}from"./brand-button-B1izLAdR.js";import{t as s}from"./conversation-store-LptbOvKa.js";import{t as c}from"./use-handle-plan-click-BFcE0Xms.js";import{t as l}from"./markdown-renderer-B4V2OMFP.js";import{n as u,r as d}from"./plan-components-BdZXPyZU.js";import{t as f}from"./conversation-tab-empty-state-CNUmIms2.js";var p=e(t(),1),m=n();function h(){let{t:e}=r(`openhands`),{scrollRef:t,onChatBodyScroll:n,autoScroll:h,scrollDomToBottom:g}=d(p.useRef(null)),{planContent:_,conversationMode:v}=s();p.useEffect(()=>{h&&g()},[_,h,g]);let y=v===`plan`,{handlePlanClick:b}=c();return _==null?(0,m.jsx)(f,{icon:(0,m.jsx)(a,{"aria-hidden":!0,strokeWidth:2,className:`size-full`}),action:(0,m.jsx)(o,{type:`button`,variant:`secondary`,onClick:b,isDisabled:y,className:`min-w-40 justify-center px-6`,children:e(i.COMMON$CREATE_A_PLAN)}),children:e(i.PLANNER$EMPTY_MESSAGE)}):(0,m.jsx)(`div`,{ref:t,onScroll:e=>n(e.currentTarget),className:`flex flex-col w-full h-full p-4 overflow-auto`,children:(0,m.jsx)(l,{includeStandard:!0,components:u,children:_})})}export{h as default};
@@ -1 +1 @@
1
- import{_ as e,d as t}from"./agent-server-compatibility-BWN-EIQn.js";import{l as n}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";function r(){return e().backend.kind===`cloud`}function i(){return new n(t())}var a=class{static async listInstalledPlugins(){if(r())return[];try{return(await i().listInstalledPlugins()).plugins??[]}catch{return[]}}static async installPlugin(e){if(r())throw Error(`Installing plugins is only available on a local backend.`);return i().installPlugin(e)}static async setPluginEnabled(e,t){if(r())throw Error(`Enabling and disabling plugins is only available on a local backend.`);return i().setPluginEnabled(e,t)}static async uninstallPlugin(e){if(r())throw Error(`Uninstalling plugins is only available on a local backend.`);return i().uninstallPlugin(e)}static async refreshPlugin(e){if(r())throw Error(`Refreshing plugins is only available on a local backend.`);return i().refreshPlugin(e)}};export{a as t};
1
+ import{_ as e,d as t}from"./agent-server-compatibility-C0MtTTwb.js";import{l as n}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";function r(){return e().backend.kind===`cloud`}function i(){return new n(t())}var a=class{static async listInstalledPlugins(){if(r())return[];try{return(await i().listInstalledPlugins()).plugins??[]}catch{return[]}}static async installPlugin(e){if(r())throw Error(`Installing plugins is only available on a local backend.`);return i().installPlugin(e)}static async setPluginEnabled(e,t){if(r())throw Error(`Enabling and disabling plugins is only available on a local backend.`);return i().setPluginEnabled(e,t)}static async uninstallPlugin(e){if(r())throw Error(`Uninstalling plugins is only available on a local backend.`);return i().uninstallPlugin(e)}static async refreshPlugin(e){if(r())throw Error(`Refreshing plugins is only available on a local backend.`);return i().refreshPlugin(e)}};export{a as t};
@@ -1 +1 @@
1
- import{_ as e,d as t}from"./agent-server-compatibility-BWN-EIQn.js";import{f as n}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{t as r}from"./proxy-B3tCGf0X.js";var i=`/api/v1/settings/profiles`;function a(){let{backend:t,orgId:n}=e();if(t.kind!==`cloud`)throw Error(`Cloud profiles call requires a cloud backend.`);return{backend:t,base:n?`/api/organizations/${encodeURIComponent(n)}/profiles`:i}}async function o(){let{backend:e,base:t}=a();return r({backend:e,method:`GET`,path:t})}async function s(e){let{backend:t,base:n}=a(),i=await r({backend:t,method:`GET`,path:`${n}/${encodeURIComponent(e)}`});return{name:i.name,config:i.config??i.llm??{},api_key_set:i.api_key_set??!1}}async function c(e,t){let{backend:n,base:i}=a();return r({backend:n,method:`POST`,path:`${i}/${encodeURIComponent(e)}`,body:t})}async function l(e){let{backend:t,base:n}=a();return r({backend:t,method:`DELETE`,path:`${n}/${encodeURIComponent(e)}`})}async function u(e,t){let{backend:n,base:i}=a();return r({backend:n,method:`POST`,path:`${i}/${encodeURIComponent(e)}/rename`,body:{new_name:t}})}async function d(e){let{backend:t,base:n}=a(),i=await r({backend:t,method:`POST`,path:`${n}/${encodeURIComponent(e)}/activate`,body:{}});return{name:i.name,message:i.message,llm_applied:i.model!=null||i.llm!=null}}function f(){return e().backend.kind===`cloud`}var p=class{static async listProfiles(){return f()?o():new n(t()).listProfiles()}static async getProfile(e,r){if(f())return s(e);let i=r?{exposeSecrets:r}:{};return new n(t()).getProfile(e,i)}static async saveProfile(e,r){return f()?c(e,r):new n(t()).saveProfile(e,r)}static async deleteProfile(e){return f()?l(e):new n(t()).deleteProfile(e)}static async renameProfile(e,r){return f()?u(e,r):new n(t()).renameProfile(e,r)}static async activateProfile(e){return f()?d(e):new n(t()).activateProfile(e)}};export{p as t};
1
+ import{_ as e,d as t}from"./agent-server-compatibility-C0MtTTwb.js";import{f as n}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";import{t as r}from"./proxy-G4ce0fnQ.js";var i=`/api/v1/settings/profiles`;function a(){let{backend:t,orgId:n}=e();if(t.kind!==`cloud`)throw Error(`Cloud profiles call requires a cloud backend.`);return{backend:t,base:n?`/api/organizations/${encodeURIComponent(n)}/profiles`:i}}async function o(){let{backend:e,base:t}=a();return r({backend:e,method:`GET`,path:t})}async function s(e){let{backend:t,base:n}=a(),i=await r({backend:t,method:`GET`,path:`${n}/${encodeURIComponent(e)}`});return{name:i.name,config:i.config??i.llm??{},api_key_set:i.api_key_set??!1}}async function c(e,t){let{backend:n,base:i}=a();return r({backend:n,method:`POST`,path:`${i}/${encodeURIComponent(e)}`,body:t})}async function l(e){let{backend:t,base:n}=a();return r({backend:t,method:`DELETE`,path:`${n}/${encodeURIComponent(e)}`})}async function u(e,t){let{backend:n,base:i}=a();return r({backend:n,method:`POST`,path:`${i}/${encodeURIComponent(e)}/rename`,body:{new_name:t}})}async function d(e){let{backend:t,base:n}=a(),i=await r({backend:t,method:`POST`,path:`${n}/${encodeURIComponent(e)}/activate`,body:{}});return{name:i.name,message:i.message,llm_applied:i.model!=null||i.llm!=null}}function f(){return e().backend.kind===`cloud`}var p=class{static async listProfiles(){return f()?o():new n(t()).listProfiles()}static async getProfile(e,r){if(f())return s(e);let i=r?{exposeSecrets:r}:{};return new n(t()).getProfile(e,i)}static async saveProfile(e,r){return f()?c(e,r):new n(t()).saveProfile(e,r)}static async deleteProfile(e){return f()?l(e):new n(t()).deleteProfile(e)}static async renameProfile(e,r){return f()?u(e,r):new n(t()).renameProfile(e,r)}static async activateProfile(e){return f()?d(e):new n(t()).activateProfile(e)}};export{p as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{n as i}from"./declaration-BGsHjPEW.js";import{I as a,M as o,N as s,P as c,g as l,m as u,p as d,t as f}from"./active-backend-context-B8rMv0X9.js";import{t as p}from"./utils-DB9LsAzA.js";import{i as m,r as h,s as g}from"./telemetry-C5JMEfqB.js";import{n as _,t as v}from"./agent-server-ui-style-scope-qhnhZHBV.js";var y=e(t());function b({i18n:e,defaultNS:t,children:n}){let r=(0,y.useMemo)(()=>({i18n:e,defaultNS:t}),[e,t]);return(0,y.createElement)(i.Provider,{value:r},n)}var x=`posthog_bootstrap`;function S(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.distinctID==`string`&&typeof t.sessionID==`string`}function C(){if(typeof window>`u`||typeof sessionStorage>`u`)return;let e=new URLSearchParams(window.location.hash.slice(1)),t=e.get(`distinct_id`),n=e.get(`session_id`);if(t&&n){let e={distinctID:t,sessionID:n};try{sessionStorage.setItem(x,JSON.stringify(e))}catch{}try{window.history.replaceState(null,``,window.location.pathname+window.location.search)}catch{}return e}try{let e=sessionStorage.getItem(x);if(!e)return;sessionStorage.removeItem(x);let t=JSON.parse(e);return S(t)?t:void 0}catch{try{sessionStorage.removeItem(x)}catch{}return}}function w({children:e,config:t={}}){let n=y.useRef(!1),r=t!==!1,i=t===!1?void 0:t.apiKey,a=t===!1?void 0:t.apiHost,o=t===!1?void 0:t.uiHost;return y.useLayoutEffect(()=>{m(r?{apiKey:i,apiHost:a,uiHost:o}:!1),n.current||=(h(C()),!0)},[r,a,i,o]),y.useEffect(()=>{r&&g().catch(()=>{})},[r,a,i,o]),e}var T=n();function E({children:e,theme:t=_,className:n,style:r,styleOverrides:i,contentClassName:a,...o}){let s=y.useMemo(()=>({...v,...i,...r}),[r,i]);return(0,T.jsx)(`div`,{"data-agent-server-ui":``,...o,className:n,style:s,children:(0,T.jsx)(`div`,{className:p(t,a,`text-foreground`),"data-theme":t,children:e})})}var D={provider:`posthog`};function O({children:e,queryClient:t,analytics:n,i18n:i,className:p,contentClassName:m,style:h,styleOverrides:g,theme:_,withStyleRoot:v=!0}){let x=y.useMemo(()=>t??d(),[t]),S=y.useMemo(()=>i??s(),[i]),C=y.useRef(null);C.current||={queryClient:u(),i18n:c()},l(x),a(S),y.useEffect(()=>()=>{C.current&&(l(C.current.queryClient),a(C.current.i18n))},[]);let D=(0,T.jsx)(w,{config:n&&n.provider===`posthog`?{apiKey:n.apiKey,apiHost:n.apiHost,uiHost:n.uiHost}:!1,children:e});return(0,T.jsx)(b,{i18n:S,defaultNS:o,children:(0,T.jsx)(r,{client:x,children:(0,T.jsx)(f,{children:v?(0,T.jsx)(E,{className:p,contentClassName:m,style:h,styleOverrides:g,theme:_,children:D}):D})})})}export{D as n,E as r,O as t};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{t as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~e0djk9ee-Cw6LUe8p.js";import{n as i}from"./declaration-BGsHjPEW.js";import{I as a,M as o,N as s,P as c,g as l,m as u,p as d,t as f}from"./active-backend-context-DHhm10VS.js";import{t as p}from"./utils-DB9LsAzA.js";import{i as m,r as h,s as g}from"./telemetry-SHxpVxk8.js";import{n as _,t as v}from"./agent-server-ui-style-scope-qhnhZHBV.js";var y=e(t());function b({i18n:e,defaultNS:t,children:n}){let r=(0,y.useMemo)(()=>({i18n:e,defaultNS:t}),[e,t]);return(0,y.createElement)(i.Provider,{value:r},n)}var x=`posthog_bootstrap`;function S(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.distinctID==`string`&&typeof t.sessionID==`string`}function C(){if(typeof window>`u`||typeof sessionStorage>`u`)return;let e=new URLSearchParams(window.location.hash.slice(1)),t=e.get(`distinct_id`),n=e.get(`session_id`);if(t&&n){let e={distinctID:t,sessionID:n};try{sessionStorage.setItem(x,JSON.stringify(e))}catch{}try{window.history.replaceState(null,``,window.location.pathname+window.location.search)}catch{}return e}try{let e=sessionStorage.getItem(x);if(!e)return;sessionStorage.removeItem(x);let t=JSON.parse(e);return S(t)?t:void 0}catch{try{sessionStorage.removeItem(x)}catch{}return}}function w({children:e,config:t={}}){let n=y.useRef(!1),r=t!==!1,i=t===!1?void 0:t.apiKey,a=t===!1?void 0:t.apiHost,o=t===!1?void 0:t.uiHost;return y.useLayoutEffect(()=>{m(r?{apiKey:i,apiHost:a,uiHost:o}:!1),n.current||=(h(C()),!0)},[r,a,i,o]),y.useEffect(()=>{r&&g().catch(()=>{})},[r,a,i,o]),e}var T=n();function E({children:e,theme:t=_,className:n,style:r,styleOverrides:i,contentClassName:a,...o}){let s=y.useMemo(()=>({...v,...i,...r}),[r,i]);return(0,T.jsx)(`div`,{"data-agent-server-ui":``,...o,className:n,style:s,children:(0,T.jsx)(`div`,{className:p(t,a,`text-foreground`),"data-theme":t,children:e})})}var D={provider:`posthog`};function O({children:e,queryClient:t,analytics:n,i18n:i,className:p,contentClassName:m,style:h,styleOverrides:g,theme:_,withStyleRoot:v=!0}){let x=y.useMemo(()=>t??d(),[t]),S=y.useMemo(()=>i??s(),[i]),C=y.useRef(null);C.current||={queryClient:u(),i18n:c()},l(x),a(S),y.useEffect(()=>()=>{C.current&&(l(C.current.queryClient),a(C.current.i18n))},[]);let D=(0,T.jsx)(w,{config:n&&n.provider===`posthog`?{apiKey:n.apiKey,apiHost:n.apiHost,uiHost:n.uiHost}:!1,children:e});return(0,T.jsx)(b,{i18n:S,defaultNS:o,children:(0,T.jsx)(r,{client:x,children:(0,T.jsx)(f,{children:v?(0,T.jsx)(E,{className:p,contentClassName:m,style:h,styleOverrides:g,theme:_,children:D}):D})})})}export{D as n,E as r,O as t};
@@ -1 +1 @@
1
- import{A as e,M as t,_ as n,u as r}from"./agent-server-compatibility-BWN-EIQn.js";import{t as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";function a(e){if(e)return e;let t=n().backend;if(t.kind!==`cloud`)throw Error(`Cloud calls require a cloud backend.`);return t}function o(e){let t=n();return t.backend.id===e.id?t.orgId:null}function s(n){let r=a(n),s=e(),c=s?t():{};return new i({host:r.host,apiKey:r.apiKey,orgId:o(r),timeout:3e4,...s?{proxy:{host:s,headers:c}}:{}})}function c(e){let t=s(e);if(!t.proxy)throw new r;return t}async function l(e){return(e.hostOverride?c(e.backend):s(e.backend)).request({method:e.method,path:e.path,body:e.body,headers:e.headers,timeoutSeconds:e.timeoutSeconds,hostOverride:e.hostOverride,authMode:e.authMode===void 0||e.authMode===`bearer`?`bearer`:e.authMode,sessionApiKey:e.sessionApiKey,responseType:e.responseType})}export{l as t};
1
+ import{A as e,M as t,_ as n,u as r}from"./agent-server-compatibility-C0MtTTwb.js";import{t as i}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~dhilvkxv-eGLBu60s.js";function a(e){if(e)return e;let t=n().backend;if(t.kind!==`cloud`)throw Error(`Cloud calls require a cloud backend.`);return t}function o(e){let t=n();return t.backend.id===e.id?t.orgId:null}function s(n){let r=a(n),s=e(),c=s?t():{};return new i({host:r.host,apiKey:r.apiKey,orgId:o(r),timeout:3e4,...s?{proxy:{host:s,headers:c}}:{}})}function c(e){let t=s(e);if(!t.proxy)throw new r;return t}async function l(e){return(e.hostOverride?c(e.backend):s(e.backend)).request({method:e.method,path:e.path,body:e.body,headers:e.headers,timeoutSeconds:e.timeoutSeconds,hostOverride:e.hostOverride,authMode:e.authMode===void 0||e.authMode===`bearer`?`bearer`:e.authMode,sessionApiKey:e.sessionApiKey,responseType:e.responseType})}export{l as t};