@openhands/agent-canvas 1.0.0-beta.2 → 1.0.0-beta.4

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 (45) hide show
  1. package/build/assets/{agent-server-conversation-service.api-DFvqqEDo.js → agent-server-conversation-service.api-C2V5SlHu.js} +1 -1
  2. package/build/assets/{automation-detail-Di7EOIZD.js → automation-detail-DJvbVSYK.js} +1 -1
  3. package/build/assets/{automations-list-IsIWdDiw.js → automations-list-rMki-8au.js} +1 -1
  4. package/build/assets/{conversation-HlncOV7n.js → conversation-DVrKU0oz.js} +3 -3
  5. package/build/assets/conversation-Dlys-D5A.js +1 -0
  6. package/build/assets/conversation-panel-iF09WjZ4.js +1 -0
  7. package/build/assets/{conversation-service.api-nb5W1PqR.js → conversation-service.api-CCfztilW.js} +1 -1
  8. package/build/assets/{conversation-websocket-context-C8_PkGLi.js → conversation-websocket-context-DhJhqUna.js} +1 -1
  9. package/build/assets/{files-tab-BhnLgimi.js → files-tab-R5z0lLdY.js} +1 -1
  10. package/build/assets/{git-control-bar-branch-button-M34A5_vX.js → git-control-bar-branch-button-COdRAYHb.js} +1 -1
  11. package/build/assets/{git-provider-icon-D5dCNy-k.js → git-provider-icon-BzLbc0yC.js} +1 -1
  12. package/build/assets/{home-CYQv7yc_.js → home-XxBpNOVq.js} +1 -1
  13. package/build/assets/{launch-DHEUYn2A.js → launch-CshDse3e.js} +1 -1
  14. package/build/assets/{manifest-6b31008e.js → manifest-a1d22045.js} +1 -1
  15. package/build/assets/{messages-BMzyOW2V.js → messages-D0rWot7s.js} +1 -1
  16. package/build/assets/{path-utils-YohAYyMv.js → path-utils-C3bQf6lJ.js} +1 -1
  17. package/build/assets/{planner-tab-CFc-hV07.js → planner-tab-BlrCpv-7.js} +1 -1
  18. package/build/assets/{recommended-automations-launcher-sgvfU62c.js → recommended-automations-launcher-BQChv2rc.js} +2 -2
  19. package/build/assets/root-35yk2E_M.js +2 -0
  20. package/build/assets/{root-layout-DVepR4To.js → root-layout-Czo9Ma6Q.js} +1 -1
  21. package/build/assets/{shared-conversation-DChOdb0t.js → shared-conversation-AMyqXvpk.js} +1 -1
  22. package/build/assets/{sidebar-mobile-menu-toggle-BWuf4PRH.js → sidebar-mobile-menu-toggle-Do_aA9Zm.js} +1 -1
  23. package/build/assets/{terminal-CRf9S0Z2.js → terminal-DgQk1Ay6.js} +1 -1
  24. package/build/assets/{use-active-conversation-Db3IWSPK.js → use-active-conversation-BEFNwnFk.js} +1 -1
  25. package/build/assets/{use-agent-state-Bn8vS5sY.js → use-agent-state-Bkrd1FZq.js} +1 -1
  26. package/build/assets/{use-create-conversation-CKS3EAHu.js → use-create-conversation-CEgXpkfH.js} +1 -1
  27. package/build/assets/{use-handle-plan-click-C9zJpK8A.js → use-handle-plan-click-Ckkm5eIY.js} +1 -1
  28. package/build/assets/{use-runtime-is-ready-CQCE3xZC.js → use-runtime-is-ready-B7EF4BKU.js} +1 -1
  29. package/build/assets/{use-unified-vscode-url-sZt29HrC.js → use-unified-vscode-url-DdSRw-6P.js} +1 -1
  30. package/build/assets/{use-user-conversation-DfgEB6RW.js → use-user-conversation-C6hrMMtn.js} +1 -1
  31. package/build/assets/{vscode-tab-Zb-QbTuV.js → vscode-tab-DjNArCgY.js} +1 -1
  32. package/build/index.html +3 -3
  33. package/dist/api/agent-server-adapter.cjs +1 -1
  34. package/dist/api/agent-server-adapter.cjs.map +1 -1
  35. package/dist/api/agent-server-adapter.js +1 -1
  36. package/dist/api/agent-server-adapter.js.map +1 -1
  37. package/dist/package.cjs +1 -1
  38. package/dist/package.cjs.map +1 -1
  39. package/dist/package.js +2 -1
  40. package/dist/package.js.map +1 -1
  41. package/package.json +2 -1
  42. package/scripts/dev-safe.mjs +1 -1
  43. package/build/assets/conversation-MtnkpqA9.js +0 -1
  44. package/build/assets/conversation-panel-DxnM6tRe.js +0 -1
  45. package/build/assets/root-E6pcRIYp.js +0 -2
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as r,t as i}from"./declaration-BNMqORFE.js";import{n as a}from"./QueryClientProvider-CkGuhXg-.js";import{t as o}from"./use-is-creating-conversation-BZ5hB_Bg.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{t as c}from"./retrieve-axios-error-message-BY-yIkIq.js";import{t as l}from"./createLucideIcon-Ddu8jDOQ.js";import{s as u}from"./vendor~home~conversation-panel~conversation-PK1-gtXU.js";import{n as d}from"./git-branch-DQS2nMK4.js";import{t as f}from"./check-CYxAHs85.js";import{a as p,n as m,r as h,t as g}from"./custom-toast-handlers-C-SZFmto.js";import{d as _,m as v}from"./conversation-websocket-context-C8_PkGLi.js";import{a as y,i as b,r as x,t as S}from"./llm-settings-C_tal6Ds.js";import{t as C}from"./utils-i18rdUj2.js";import{n as w,r as T}from"./active-backend-context-cCM1vYYZ.js";import{t as E}from"./modal-backdrop-BAbgYsqB.js";import{n as D,r as O,t as k}from"./modal-body-BI6Ru2Qr.js";import{r as A}from"./base-modal-_dYTw1ri.js";import{d as j,l as M,n as N,r as ee,t as P}from"./brand-button-Br7f0kZJ.js";import{n as F}from"./navigation-context-D0YWpT8d.js";import{t as I}from"./vendor~root-layout~home~conversation-panel~conversation-DjAjXS5J.js";import{t as L}from"./styled-tooltip-CBzrri6o.js";import{c as te,d as R,n as ne,s as z}from"./git-provider-icon-D5dCNy-k.js";import{i as re,t as ie}from"./backend-form-modal-Dnk33xA_.js";import{t as ae}from"./conversation-store-Z5iMCRpc.js";import{t as B}from"./modal-close-button-t1Gh3qmL.js";import{t as oe}from"./settings-input-Bn7F5C75.js";import{i as se,n as V,o as ce,s as H}from"./acp-providers-CbiRekh9.js";import{t as U}from"./use-create-conversation-CKS3EAHu.js";import{a as W,c as le,i as ue,l as de,n as fe,o as pe,r as G,s as me,t as he,u as K}from"./manage-workspaces-modal-DhKF_8z3.js";import{t as ge}from"./folder-ZZJVGgd7.js";import{t as _e}from"./use-save-settings-VUrj_QNG.js";import{A as ve,F as ye,I as be,M as xe,N as Se,a as Ce,c as we,d as Te,f as Ee,i as De,l as Oe,n as ke,o as Ae,p as je,r as Me,s as Ne,t as Pe,u as Fe}from"./git-control-bar-branch-button-M34A5_vX.js";import{r as Ie}from"./typography-gpuWmrQO.js";import{n as Le,t as Re}from"./use-get-secrets-DuhdIA59.js";import{t as ze}from"./recommended-automations-launcher-sgvfU62c.js";var Be=l(`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`}]]),Ve=l(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),q=e(t(),1);async function J(e){let{imagesToEmbed:t}=be(e.images,e.imagesMarkedUploadAsFile),n=await Promise.all(t.map(e=>xe(e)));_.getState().enqueuePendingMessage({conversationId:e.conversationId,text:e.text,content:e.text,imageUrls:n,fileUrls:[]})}var Y=r();function He(){let{t:e}=s(`openhands`);return(0,Y.jsx)(`div`,{className:`flex min-h-[80px] w-full items-center justify-center py-2`,children:(0,Y.jsx)(Ie.H1,{className:`w-full text-center leading-normal`,children:e(`HOME$LETS_START_BUILDING`)})})}function Ue({kind:e,onClick:t,disabled:n=!1,disabledTooltip:r}){let{t:a}=s(`openhands`),o=e===`local`,c=a(o?i.HOME$OPEN_WORKSPACE:i.COMMON$OPEN_REPOSITORY),l=(0,Y.jsxs)(`button`,{type:`button`,"data-testid":o?`open-workspace-button`:`open-repository-button`,onClick:t,disabled:n,className:C(`flex flex-row items-center gap-2 rounded-full px-2.5 py-1 text-white`,N,M,j,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-raised`),children:[(0,Y.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:o?(0,Y.jsx)(d,{"aria-hidden":!0,className:`h-4 w-4`,strokeWidth:2}):(0,Y.jsx)(R,{width:16,height:16,className:`shrink-0`})}),(0,Y.jsx)(`span`,{className:`text-sm font-normal leading-5`,children:c})]});return r?(0,Y.jsx)(L,{content:r,placement:`top`,children:(0,Y.jsx)(`span`,{className:`inline-flex`,children:l})}):l}function We({workspaces:e,value:t,placeholder:n,className:r,disabled:a=!1,disabledTooltip:o,showManage:c,onChange:l,onAddClick:u,onManageClick:d}){let{t:f}=s(`openhands`),[p,m]=(0,q.useState)(t?.name??``),h=(0,q.useRef)(null),g=(0,q.useMemo)(()=>{let t=p.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,p]),_=(0,q.useCallback)(e=>{l(e),e&&m(e.name)},[l]),v=(0,q.useCallback)(()=>{_(null),m(``)},[_]),{isOpen:y,getToggleButtonProps:b,getMenuProps:x,getInputProps:S,highlightedIndex:w,getItemProps:T,selectedItem:E,closeMenu:D}=I({items:g,itemToString:e=>e?.name??``,selectedItem:t,onSelectedItemChange:({selectedItem:e})=>{_(e??null)},inputValue:p,stateReducer:(e,t)=>t.type===I.stateChangeTypes.InputClick&&e.isOpen?{...t.changes,isOpen:!0}:t.changes}),O=(e,t,n,r,i)=>(0,Y.jsx)(we,{item:e,index:t,isSelected:r?.id===e.id,getItemProps:i,getDisplayText:e=>e.name,getItemKey:e=>e.id},e.id),k=e=>(0,Y.jsx)(Ne,{inputValue:e,searchMessage:f(i.HOME$NO_WORKSPACES),emptyMessage:f(i.HOME$NO_WORKSPACES),testId:`workspace-dropdown-empty`}),A=(0,q.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`button`,{type:`button`,"data-testid":`add-workspaces-button`,className:`flex items-center w-full px-2 py-2 text-sm text-white hover:bg-[var(--oh-interactive-hover)] rounded-md transition-colors duration-150 font-normal`,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),D(),u()},children:f(i.HOME$ADD_WORKSPACES)}),(c??e.length>0)&&(0,Y.jsx)(`button`,{type:`button`,"data-testid":`manage-workspaces-button`,className:`flex items-center w-full px-2 py-2 text-sm text-white hover:bg-[var(--oh-interactive-hover)] rounded-md transition-colors duration-150 font-normal`,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),D(),d()},children:f(i.HOME$MANAGE_WORKSPACES)})]}),[u,d,f,D,e.length,c]),j=(0,Y.jsxs)(`div`,{className:C(`relative`,r),children:[(0,Y.jsxs)(`div`,{className:`group relative text-[var(--oh-muted)] hover:text-white`,children:[(0,Y.jsx)(`div`,{className:`absolute left-2 top-1/2 transform -translate-y-1/2 z-10`,children:(0,Y.jsx)(te,{width:16,height:16})}),(0,Y.jsx)(`input`,{...S({disabled:a,placeholder:n??f(i.HOME$WORKSPACE_PLACEHOLDER),className:C(ee,`text-inherit shadow-none pl-7 pr-16 text-sm font-normal leading-5`,`placeholder:text-[var(--oh-muted)]`,`disabled:cursor-not-allowed disabled:opacity-60`),onChange:e=>{m(e.target.value)}}),"data-testid":`workspace-dropdown`}),(0,Y.jsxs)(`div`,{className:`absolute right-1 top-1/2 transform -translate-y-1/2 flex items-center`,children:[t&&(0,Y.jsx)(Fe,{disabled:a,onClear:v}),(0,Y.jsx)(Oe,{isOpen:y,disabled:a,getToggleButtonProps:b})]})]}),(0,Y.jsx)(Ae,{isOpen:y,filteredItems:g,inputValue:p,highlightedIndex:w,selectedItem:E,getMenuProps:x,getItemProps:T,menuRef:h,renderItem:O,renderEmptyState:k,stickyFooterItem:A,testId:`workspace-dropdown-menu`,itemKey:e=>e.id})]});return o?(0,Y.jsx)(L,{content:o,placement:`top`,children:(0,Y.jsx)(`span`,{className:`block`,children:j})}):j}function Ge({isLoadingSettings:e=!1,onConfirm:t}){let{t:n}=s(`openhands`),{navigate:r}=F(),{data:a,error:c}=W(),l=a?.workspaceParents??[],{mutate:u}=me(),{mutate:d}=le(),{mutate:f}=pe(),{mutate:p}=de(),{workspaces:m,isLoading:h,isError:g,error:_}=ue(),v=G(c??_,n),[y,b]=q.useState(null),[x,S]=q.useState(!1),[C,w]=q.useState(!1),{mutate:T,isPending:E,isSuccess:D}=U(),O=o(),k=E||D||O,A=l.length>0||!!v,j=null;v?j=v:h?j=n(i.HOME$LOADING):g&&(j=n(i.HOME$WORKSPACE_SCAN_ERROR));let M=!!v||e||h&&m.length===0;return(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[!t&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-[10px] pb-4`,children:[(0,Y.jsx)(ge,{width:24,height:24}),(0,Y.jsx)(`span`,{className:`leading-5 font-bold text-base text-white`,children:n(i.HOME$WORKSPACES_TAB)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-[10px] pb-4`,children:[(0,Y.jsx)(We,{workspaces:m,value:y,placeholder:v?n(i.HOME$WORKSPACES_UNSUPPORTED_PLACEHOLDER):M?n(i.HOME$LOADING):void 0,disabled:M,disabledTooltip:v,showManage:m.length>0||l.length>0,onChange:b,onAddClick:()=>S(!0),onManageClick:()=>w(!0),className:`max-w-auto`}),A&&j&&(0,Y.jsx)(`p`,{className:`px-1 text-xs text-[var(--oh-text-secondary)]`,"data-testid":`workspace-status-message`,children:j})]}),(0,Y.jsx)(P,{testId:`workspace-launch-button`,variant:`primary`,type:`button`,isDisabled:!y||!t&&k||e,onClick:()=>{if(y){if(t){t(y);return}T({workingDir:y.path},{onSuccess:e=>r(`/conversations/${e.conversation_id}`)})}},className:t?`w-full`:`w-auto absolute bottom-5 left-5 right-5`,children:t?n(i.BUTTON$CONFIRM):k?n(i.HOME$LOADING):`Launch`}),(0,Y.jsx)(fe,{isOpen:x,onClose:()=>S(!1),onAdd:e=>u(e),onAddParent:e=>f(e)}),(0,Y.jsx)(he,{isOpen:C,workspaces:m,workspaceParents:l,onClose:()=>w(!1),onRemove:e=>{y?.path===e&&b(null),d(e)},onRemoveParent:e=>{y?.parentPath===e&&b(null),p(e)}})]})}function Ke({isOpen:e,onClose:t,onConfirm:n}){let{t:r}=s(`openhands`),{isLoadingSettings:a}=z();return e?(0,Y.jsx)(E,{onClose:t,children:(0,Y.jsxs)(D,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Y.jsx)(B,{onClose:t,testId:`close-open-workspace-dialog`}),(0,Y.jsx)(`div`,{className:`w-full pr-6`,children:(0,Y.jsx)(A,{title:r(i.HOME$OPEN_WORKSPACE)})}),(0,Y.jsx)(`div`,{className:`w-full`,"data-testid":`open-workspace-dialog-body`,children:(0,Y.jsx)(Ge,{isLoadingSettings:a,onConfirm:e=>{n(e),t()}})})]})}):null}function qe({onRepoSelection:e,isLoadingSettings:t=!1,onConfirm:n}){let{navigate:r}=F(),[a,c]=q.useState(null),[l,u]=q.useState(null),[d,f]=q.useState(null),{providers:p}=z(),{addRecentRepository:m,setLastSelectedProvider:h,getLastSelectedProvider:g}=ne(),{mutate:_,isPending:v,isSuccess:y}=U(),b=o(),{t:x}=s(`openhands`);q.useEffect(()=>{if(p.length!==0){if(p.length===1&&!d){f(p[0]);return}if(p.length>1&&!d){let e=g();e&&p.includes(e)&&f(e)}}},[p,d,g]);let S=v||y||b,C=t=>{t!==d&&(f(t),h(t),c(null),u(null),e?.(null))},w=q.useCallback(e=>{u(e)},[]);return(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[!n&&(0,Y.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-[10px] pb-4`,children:[(0,Y.jsx)(R,{width:24,height:24}),(0,Y.jsx)(`span`,{className:`leading-5 font-bold text-base text-white`,children:x(i.COMMON$OPEN_REPOSITORY)})]})}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-[10px] pb-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white font-normal leading-[22px]`,children:x(i.HOME$SELECT_OR_INSERT_URL)}),p.length<=1?null:(0,Y.jsx)(Ce,{providers:p,value:d,placeholder:`Select Provider`,className:`max-w-[500px]`,onChange:C,disabled:t})]}),(0,Y.jsx)(Me,{provider:d||p[0],value:a?.id||null,repositoryName:a?.full_name||null,placeholder:`user/repo`,disabled:!d||t,onChange:t=>{t?(e?.(t),c(t)):(e?.(null),c(null),u(null))},className:`max-w-auto`}),(()=>{let e=a?.main_branch||null;return(0,Y.jsx)(De,{repository:a?.full_name||null,provider:d||p[0],selectedBranch:l,onBranchSelect:w,defaultBranch:e,placeholder:`Select branch...`,className:`max-w-full`,disabled:!a||t})})()]}),(0,Y.jsx)(P,{testId:`repo-launch-button`,variant:`primary`,type:`button`,isDisabled:!a||!l||!n&&S||p.length>1&&!d||t,onClick:()=>{if(!(!a||!l)){if(m(a),n){n({repository:a,branch:l,provider:d});return}_({repository:{name:a.full_name||``,gitProvider:a.git_provider||`github`,branch:l.name||`main`}},{onSuccess:e=>r(`/conversations/${e.conversation_id}`)})}},className:`w-full`,children:n?x(i.BUTTON$CONFIRM):S?x(`HOME$LOADING`):`Launch`})]})}function Je({isOpen:e,onClose:t,onConfirm:n}){let{t:r}=s(`openhands`),{isLoadingSettings:a}=z();return e?(0,Y.jsx)(E,{onClose:t,children:(0,Y.jsxs)(D,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Y.jsx)(B,{onClose:t,testId:`close-open-repository-dialog`}),(0,Y.jsx)(`div`,{className:`w-full pr-6`,children:(0,Y.jsx)(A,{title:r(i.COMMON$OPEN_REPOSITORY)})}),(0,Y.jsx)(`div`,{className:`w-full`,"data-testid":`open-repository-dialog-body`,children:(0,Y.jsx)(qe,{isLoadingSettings:a,onConfirm:e=>{n(e),t()}})})]})}):null}function Ye({workspace:e,repository:t,branch:n,provider:r,onRepoClick:i}){let a=e?e.path.replace(/\/+$/,``).split(`/`).pop()||e.path:null;return(0,Y.jsxs)(`div`,{className:`flex flex-row gap-2.5 items-center flex-wrap`,"data-testid":`home-git-control-bar-preview`,children:[(0,Y.jsx)(ke,{selectedRepository:t?.full_name??null,gitProvider:r??null,workspaceName:a,onClick:i}),n?(0,Y.jsx)(Pe,{selectedBranch:n.name,selectedRepository:t?.full_name??null,gitProvider:r??null}):null]})}function Xe(){let{t:e}=s(`openhands`),{backend:t}=w(),{navigate:n}=F(),r=t.kind===`local`,[a,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),[h,_]=(0,q.useState)(null),[v,y]=(0,q.useState)(null),{mutate:b,isPending:x}=U(),S=o(),C=x||S,{images:T,files:E,imagesMarkedUploadAsFile:D,clearAllFiles:O}=ae(),{handleUpload:k}=Te(),{error:A}=W({enabled:r}),j=r?G(A,e):null,M=r?!!l:!!d&&!!h,N=Ee(null,t=>{let a=t.trim(),o=T.length>0||E.length>0;if(!a&&!o||C)return;let s={images:[...T],files:[...E]},c={query:o?void 0:a||void 0};r&&l?c={...c,workingDir:l.path}:!r&&d&&h&&(c={...c,repository:{name:d.full_name,gitProvider:d.git_provider,branch:h.name}});let u=p.loading(e(i.HOME$CREATING_CONVERSATION),g);b(c,{onSuccess:async t=>{p.dismiss(u);try{sessionStorage.removeItem(ye)}catch{}let i=t.conversation_id,c=i.startsWith(`task-`);if(o)if(!r||c){let e=t.task_id??(c?i.slice(5):null);if(!e){m(null);return}Se(e,{content:a,images:s.images,files:s.files,imagesMarkedUploadAsFile:[...D]}),O(),await J({conversationId:i,text:a,images:s.images,imagesMarkedUploadAsFile:D}),n(`/conversations/${i}`);return}else try{await ve({conversationId:i,content:a,images:s.images,files:s.files,imagesMarkedUploadAsFile:D,t:e}),O()}catch(e){m(e instanceof Error?e.message:null);return}c&&a&&await J({conversationId:i,text:a,images:[],imagesMarkedUploadAsFile:[]}),n(`/conversations/${i}`)},onError:e=>{p.dismiss(u),m(e instanceof Error?e.message:null)}})});return(0,Y.jsxs)(`div`,{"data-testid":`home-chat-launcher`,className:`flex w-full max-w-[800px] flex-col gap-4 md:px-4`,children:[(0,Y.jsx)(`div`,{className:`flex w-full justify-center`,children:(0,Y.jsx)(He,{})}),(0,Y.jsx)(`div`,{className:`w-full`,children:(0,Y.jsx)(je,{onSubmit:N,onFilesPaste:k,disabled:C})}),(0,Y.jsx)(`div`,{className:`flex justify-start`,children:M?(0,Y.jsx)(Ye,{workspace:l,repository:d,branch:h,provider:v,onRepoClick:()=>c(!0)}):(0,Y.jsx)(Ue,{kind:r?`local`:`cloud`,onClick:()=>c(!0),disabled:C||!!j,disabledTooltip:j})}),r?(0,Y.jsx)(Ke,{isOpen:a,onClose:()=>c(!1),onConfirm:e=>{u(e),f(null),_(null),y(null)}}):(0,Y.jsx)(Je,{isOpen:a,onClose:()=>c(!1),onConfirm:({repository:e,branch:t,provider:n})=>{f(e),_(t),y(n??e.git_provider),u(null)}})]})}function Ze({currentStep:e,totalSteps:t,className:n}){return(0,Y.jsx)(`div`,{role:`progressbar`,"aria-valuemin":1,"aria-valuemax":t,"aria-valuenow":e+1,"data-testid":`onboarding-progress-bar`,className:C(`flex w-full items-center gap-2`,n),children:Array.from({length:t},(t,n)=>{let r=n<e,i=n===e;return(0,Y.jsx)(`div`,{"data-testid":`onboarding-progress-step-${n}`,"data-state":r?`completed`:i?`current`:`upcoming`,className:C(`h-1.5 flex-1 rounded-full transition-colors duration-300`,r||i?`bg-white`:`bg-white/15`)},n)})})}function Qe(e){return e===`openhands`?`openhands`:V.find(({key:t})=>t===e)?.icon??`cli-generic`}function $e({id:e,muted:t}){let n=Qe(e);return n===`openhands`?(0,Y.jsx)(K,{kind:`openhands`,size:16,className:C(`text-white`,t&&`opacity-55`),"data-testid":`onboarding-agent-icon-openhands`}):(0,Y.jsx)(K,{kind:n,size:18,className:t?`text-[var(--oh-muted)]`:`text-white`,"data-testid":`onboarding-agent-icon-${n}`})}function et(){return[{id:`openhands`,label:`OpenHands`,descriptionKey:i.ONBOARDING$AGENT_OPENHANDS_DESCRIPTION},...V.map(e=>({id:e.key,label:e.display_name,descriptionKey:e.description_key}))]}function tt({selectedAgentId:e,onSelect:t,onNext:n}){let{t:r}=s(`openhands`),{mutate:a,isPending:o}=_e();return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-choose-agent`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:r(i.ONBOARDING$AGENT_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:r(i.ONBOARDING$AGENT_SUBTITLE)})]}),(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":r(i.ONBOARDING$AGENT_TITLE),className:`flex flex-col gap-3`,children:et().map(n=>{let i=n.id===e;return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":i,"data-testid":`onboarding-agent-option-${n.id}`,"data-selected":i,onClick:()=>t(n.id),className:C(`flex items-start justify-between gap-4 rounded-xl border px-4 py-3 text-left transition-colors cursor-pointer`,i?`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,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)($e,{id:n.id,muted:!1}),(0,Y.jsx)(`span`,{className:`truncate text-base font-normal text-white`,children:n.label})]}),(0,Y.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:r(n.descriptionKey)})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:i?(0,Y.jsx)(f,{width:18,height:18,className:`mt-1 shrink-0 text-white`,"aria-hidden":!0}):null})]},n.id)})}),(0,Y.jsx)(`div`,{className:`sticky bottom-0 flex justify-end bg-base-secondary pt-4 pb-7`,children:(0,Y.jsx)(P,{testId:`onboarding-agent-next`,type:`button`,variant:`primary`,isDisabled:o,onClick:()=>{let t=se(e);if(!t){n();return}a({agent_settings_diff:t},{onError:e=>{m(c(e)||r(i.ERROR$GENERIC))},onSuccess:()=>{h(r(i.SETTINGS$SAVED)),n()}})},children:r(o?i.SETTINGS$SAVING:i.ONBOARDING$NEXT)})})]})}function nt({isConnected:e}){let{t}=s(`openhands`);return e===!0?(0,Y.jsxs)(`div`,{role:`status`,"data-testid":`onboarding-backend-connected`,className:C(`flex items-start gap-3 rounded-xl border border-green-500/40 bg-green-500/10 px-4 py-3`),children:[(0,Y.jsx)(u,{className:`mt-0.5 size-5 shrink-0 text-green-400`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-green-200`,children:t(i.ONBOARDING$BACKEND_CONNECTED_TITLE)}),(0,Y.jsx)(`span`,{className:`text-xs text-green-200/80`,children:t(i.ONBOARDING$BACKEND_CONNECTED_BODY)})]})]}):e===!1?(0,Y.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,Y.jsx)(Be,{className:`mt-0.5 size-5 shrink-0 text-red-400`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-red-200`,children:t(i.ONBOARDING$BACKEND_DISCONNECTED_TITLE)}),(0,Y.jsx)(`span`,{className:`text-xs text-red-200/80`,children:t(i.ONBOARDING$BACKEND_DISCONNECTED_BODY)})]})]}):(0,Y.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,Y.jsx)(v,{className:`mt-0.5 size-5 shrink-0 animate-spin text-[var(--oh-text-tertiary)]`}),(0,Y.jsx)(`span`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:t(i.ONBOARDING$BACKEND_CHECKING)})]})}function rt({onBack:e,onNext:t}){let{t:n}=s(`openhands`),{active:r}=T(),{backend:a}=r,o=re([a])[a.id]?.isConnected??null;return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-check-backend`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:n(i.ONBOARDING$BACKEND_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:n(i.ONBOARDING$BACKEND_SUBTITLE)})]}),(0,Y.jsx)(nt,{isConnected:o}),(0,Y.jsx)(ie,{mode:`edit`,backend:a,onSubmitted:()=>{},testIdRoot:`onboarding-backend`,renderActions:({canSubmit:r,testIdRoot:a})=>(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-end gap-2 mt-2 bg-base-secondary pt-4 pb-7`,children:[(0,Y.jsx)(P,{testId:`onboarding-backend-back`,type:`button`,variant:`secondary`,onClick:e,children:n(i.ONBOARDING$BACK)}),(0,Y.jsx)(P,{testId:`${a}-submit`,type:`submit`,variant:`secondary`,isDisabled:!r,children:n(i.BACKEND$SAVE)}),(0,Y.jsx)(P,{testId:`onboarding-backend-next`,type:`button`,variant:`primary`,isDisabled:o!==!0,onClick:t,children:n(i.ONBOARDING$NEXT)})]})})]})}var it={"llm.model":`openhands/claude-opus-4-5-20251101`};function at({onBack:e,onNext:t}){let{t:n}=s(`openhands`),{backend:r}=w(),a=r.kind===`local`,o=x(),c=b(),[l,u]=q.useState(null),[d,f]=q.useState(!1),p=q.useCallback(async()=>{if(!a||!l)return;let e=l.values,t=typeof e[`llm.model`]==`string`?e[`llm.model`]:``;if(!t)return;let n=typeof e[`llm.api_key`]==`string`?e[`llm.api_key`]:``,r=typeof e[`llm.base_url`]==`string`?e[`llm.base_url`]:``,i=y(t),s={model:t};n&&(s.api_key=n),r&&(s.base_url=r);try{await o.mutateAsync({name:i,request:{llm:s,include_secrets:!0}}),await c.mutateAsync(i)}catch(e){console.error(`Failed to persist onboarding LLM as profile:`,e)}},[a,l,o,c]),m=q.useCallback(async()=>{f(!0);try{await p()}finally{f(!1),t()}},[p,t]);return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-setup-llm`,className:`flex flex-col gap-6 max-h-[calc(90vh-7rem)]`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:n(i.ONBOARDING$LLM_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:n(i.ONBOARDING$LLM_SUBTITLE)})]}),(0,Y.jsx)(`div`,{"data-testid":`onboarding-llm-settings`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto custom-scrollbar-always`,children:(0,Y.jsx)(S,{embedded:!0,hideSaveButton:!0,initialValueOverrides:it,onSaveSuccess:m,onSaveControlChange:u})}),(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-end gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,Y.jsx)(P,{testId:`onboarding-llm-back`,type:`button`,variant:`secondary`,onClick:e,children:n(i.ONBOARDING$BACK)}),(0,Y.jsx)(P,{testId:`onboarding-llm-next`,type:`button`,variant:`primary`,isDisabled:(l?.isSaving??!1)||d,onClick:()=>{if(l?.isDirty){l.save();return}t()},children:n(i.ONBOARDING$NEXT)})]})]})}function ot({providerKey:e,onBack:t,onNext:n}){let{t:r}=s(`openhands`),o=a(),{mutateAsync:l}=Le(),{data:u}=Re(),d=q.useMemo(()=>H(e),[e]),[f,p]=q.useState({}),[g,_]=q.useState(!1),v=ce(e)??e,y=q.useCallback(e=>(u??[]).some(t=>t.name===e),[u]);return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-setup-acp-secrets`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:r(i.ONBOARDING$ACP_SECRETS_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:r(i.ONBOARDING$ACP_SECRETS_SUBTITLE,{provider:v})})]}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-5`,children:d.map(e=>{let t=y(e.name);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(oe,{testId:`onboarding-acp-secret-${e.name}`,name:e.name,label:e.name,labelClassName:`font-mono`,type:e.secret?`password`:`text`,value:f[e.name]??``,onChange:t=>p(n=>({...n,[e.name]:t})),showOptionalTag:!0,placeholder:t?r(i.ONBOARDING$ACP_SECRET_ALREADY_SET):``}),(0,Y.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:r(e.hint_key)})]},e.name)})}),(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-between gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,Y.jsx)(P,{testId:`onboarding-acp-secrets-back`,type:`button`,variant:`secondary`,onClick:t,isDisabled:g,children:r(i.ONBOARDING$BACK)}),(0,Y.jsx)(P,{testId:`onboarding-acp-secrets-next`,type:`button`,variant:`primary`,isDisabled:g,onClick:async()=>{let e=d.map(e=>({name:e.name,value:f[e.name]?.trim()})).filter(e=>!!e.value);if(e.length===0){n();return}_(!0);try{for(let{name:t,value:n}of e)await l({name:t,value:n});await o.invalidateQueries({queryKey:[`secrets-search`]}),await o.invalidateQueries({queryKey:[`secrets`]}),h(r(i.SETTINGS$SAVED)),n()}catch(e){m(c(e)||r(i.ERROR$GENERIC))}finally{_(!1)}},children:r(g?i.SETTINGS$SAVING:i.ONBOARDING$NEXT)})]})]})}function st({onBack:e,onLaunched:t}){let{t:n}=s(`openhands`),{navigate:r}=F(),a=n(i.ONBOARDING$HELLO_DEFAULT_MESSAGE),[c,l]=q.useState(a),{mutate:u,isPending:d,isSuccess:f}=U(),p=o(),m=d||f||p,h=q.useRef(!1),g=c.trim().length>0&&!m&&!h.current,_=()=>{!g||h.current||(h.current=!0,u({query:c.trim()},{onSuccess:e=>{t(),r(`/conversations/${e.conversation_id}`)},onError:()=>{h.current=!1}}))};return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-say-hello`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:n(i.ONBOARDING$HELLO_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:n(i.ONBOARDING$HELLO_SUBTITLE)})]}),(0,Y.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_()},className:`contents`,children:(0,Y.jsx)(`input`,{"data-testid":`onboarding-hello-input`,"aria-label":n(i.ONBOARDING$HELLO_TITLE),type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:a,disabled:m,className:`w-full rounded-xl border border-white/10 bg-base-secondary px-4 py-3 text-base text-white placeholder:text-[var(--oh-text-subtle)] focus:border-primary focus:outline-none disabled:opacity-60`})}),(0,Y.jsx)(`div`,{"data-testid":`onboarding-recommended-automations`,children:(0,Y.jsx)(ze,{onLaunched:t})}),(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-between gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,Y.jsx)(P,{testId:`onboarding-hello-back`,type:`button`,variant:`secondary`,onClick:e,isDisabled:m,children:n(i.ONBOARDING$BACK)}),(0,Y.jsx)(P,{testId:`onboarding-hello-launch`,type:`button`,variant:`primary`,isDisabled:!g,onClick:_,startContent:(0,Y.jsx)(Ve,{className:`size-4`,"aria-hidden":!0}),children:n(m?i.ONBOARDING$HELLO_LAUNCHING:i.ONBOARDING$HELLO_LAUNCH)})]})]})}var X=4;function Z({index:e,currentStep:t,children:n}){let r=e===t,i=(e-t)*100;return(0,Y.jsx)(`div`,{"data-testid":`onboarding-slide-${e}`,"data-active":r,"aria-hidden":!r,style:{transform:`translateX(${i}%)`},className:C(`w-full transition-transform duration-300 ease-out`,!r&&`pointer-events-none absolute inset-0`),children:n})}function ct({onClose:e}){let{t}=s(`openhands`),[n,r]=q.useState(0),[a,o]=q.useState(`openhands`),c=a===`openhands`,l=H(a),u=!c&&l.length>0,d=!c&&!u,f=q.useCallback(()=>r(e=>Math.min(e+(d&&e===1?2:1),X-1)),[d]),p=q.useCallback(()=>r(e=>Math.max(e-(d&&e===3?2:1),0)),[d]),m=d?X-1:X,h=d&&n>1?n-1:n;return(0,Y.jsx)(E,{onClose:e,closeOnEscape:!1,"aria-label":t(i.ONBOARDING$TITLE),children:(0,Y.jsxs)(`div`,{className:`relative flex flex-col items-center gap-4`,children:[(0,Y.jsxs)(`section`,{"data-testid":`onboarding-modal`,"data-current-step":n,className:C(`flex flex-col gap-6 overflow-hidden rounded-2xl border border-white/10 bg-base-secondary shadow-2xl`,O(`lg`),k,`max-h-[90vh]`),children:[(0,Y.jsx)(`header`,{className:`flex flex-col gap-3 px-7 pt-7 shrink-0`,children:(0,Y.jsx)(Ze,{currentStep:h,totalSteps:m})}),(0,Y.jsx)(`div`,{"data-testid":`onboarding-scroll-area`,className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar-always px-7`,children:(0,Y.jsxs)(`div`,{"data-testid":`onboarding-slide-rail`,"data-current-step":n,className:`relative overflow-clip`,children:[(0,Y.jsx)(Z,{index:0,currentStep:n,children:(0,Y.jsx)(tt,{selectedAgentId:a,onSelect:o,onNext:f})}),(0,Y.jsx)(Z,{index:1,currentStep:n,children:(0,Y.jsx)(rt,{onBack:p,onNext:f})}),(0,Y.jsx)(Z,{index:2,currentStep:n,children:c?(0,Y.jsx)(at,{onBack:p,onNext:f}):u?(0,Y.jsx)(ot,{providerKey:a,onBack:p,onNext:f}):null}),(0,Y.jsx)(Z,{index:3,currentStep:n,children:(0,Y.jsx)(st,{onBack:p,onLaunched:e})})]})})]}),(0,Y.jsx)(`button`,{type:`button`,"data-testid":`onboarding-skip`,onClick:e,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:t(i.ONBOARDING$SKIP)})]})})}var Q=`openhands-onboarded`;function $(){if(typeof window>`u`)return!0;try{return window.localStorage.getItem(Q)!==null}catch{return!0}}function lt(){let[e,t]=q.useState(()=>$());return q.useEffect(()=>{let e=e=>{e.key===`openhands-onboarded`&&t($())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),{isCompleted:e,markCompleted:q.useCallback(()=>{try{window.localStorage.setItem(Q,`1`)}catch{}t(!0)},[])}}function ut(){let{isCompleted:e,markCompleted:t}=lt();return e?null:(0,Y.jsx)(ct,{onClose:t})}function dt(){return(0,Y.jsxs)(`div`,{"data-testid":`home-screen`,className:`custom-scrollbar-always flex h-full flex-col overflow-y-auto rounded-xl bg-transparent px-4 md:px-0 lg:px-[42px]`,children:[(0,Y.jsx)(`div`,{className:`flex flex-1 min-h-0 flex-col items-center justify-center`,children:(0,Y.jsx)(Xe,{})}),(0,Y.jsx)(ut,{})]})}var ft=n(dt);export{ft as default};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as r,t as i}from"./declaration-BNMqORFE.js";import{n as a}from"./QueryClientProvider-CkGuhXg-.js";import{t as o}from"./use-is-creating-conversation-BZ5hB_Bg.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{t as c}from"./retrieve-axios-error-message-BY-yIkIq.js";import{t as l}from"./createLucideIcon-Ddu8jDOQ.js";import{s as u}from"./vendor~home~conversation-panel~conversation-PK1-gtXU.js";import{n as d}from"./git-branch-DQS2nMK4.js";import{t as f}from"./check-CYxAHs85.js";import{a as p,n as m,r as h,t as g}from"./custom-toast-handlers-C-SZFmto.js";import{d as _,m as v}from"./conversation-websocket-context-DhJhqUna.js";import{a as y,i as b,r as x,t as S}from"./llm-settings-C_tal6Ds.js";import{t as C}from"./utils-i18rdUj2.js";import{n as w,r as T}from"./active-backend-context-cCM1vYYZ.js";import{t as E}from"./modal-backdrop-BAbgYsqB.js";import{n as D,r as O,t as k}from"./modal-body-BI6Ru2Qr.js";import{r as A}from"./base-modal-_dYTw1ri.js";import{d as j,l as M,n as N,r as ee,t as P}from"./brand-button-Br7f0kZJ.js";import{n as F}from"./navigation-context-D0YWpT8d.js";import{t as I}from"./vendor~root-layout~home~conversation-panel~conversation-DjAjXS5J.js";import{t as L}from"./styled-tooltip-CBzrri6o.js";import{c as te,d as R,n as ne,s as z}from"./git-provider-icon-BzLbc0yC.js";import{i as re,t as ie}from"./backend-form-modal-Dnk33xA_.js";import{t as ae}from"./conversation-store-Z5iMCRpc.js";import{t as B}from"./modal-close-button-t1Gh3qmL.js";import{t as oe}from"./settings-input-Bn7F5C75.js";import{i as se,n as V,o as ce,s as H}from"./acp-providers-CbiRekh9.js";import{t as U}from"./use-create-conversation-CEgXpkfH.js";import{a as W,c as le,i as ue,l as de,n as fe,o as pe,r as G,s as me,t as he,u as K}from"./manage-workspaces-modal-DhKF_8z3.js";import{t as ge}from"./folder-ZZJVGgd7.js";import{t as _e}from"./use-save-settings-VUrj_QNG.js";import{A as ve,F as ye,I as be,M as xe,N as Se,a as Ce,c as we,d as Te,f as Ee,i as De,l as Oe,n as ke,o as Ae,p as je,r as Me,s as Ne,t as Pe,u as Fe}from"./git-control-bar-branch-button-COdRAYHb.js";import{r as Ie}from"./typography-gpuWmrQO.js";import{n as Le,t as Re}from"./use-get-secrets-DuhdIA59.js";import{t as ze}from"./recommended-automations-launcher-BQChv2rc.js";var Be=l(`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`}]]),Ve=l(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),q=e(t(),1);async function J(e){let{imagesToEmbed:t}=be(e.images,e.imagesMarkedUploadAsFile),n=await Promise.all(t.map(e=>xe(e)));_.getState().enqueuePendingMessage({conversationId:e.conversationId,text:e.text,content:e.text,imageUrls:n,fileUrls:[]})}var Y=r();function He(){let{t:e}=s(`openhands`);return(0,Y.jsx)(`div`,{className:`flex min-h-[80px] w-full items-center justify-center py-2`,children:(0,Y.jsx)(Ie.H1,{className:`w-full text-center leading-normal`,children:e(`HOME$LETS_START_BUILDING`)})})}function Ue({kind:e,onClick:t,disabled:n=!1,disabledTooltip:r}){let{t:a}=s(`openhands`),o=e===`local`,c=a(o?i.HOME$OPEN_WORKSPACE:i.COMMON$OPEN_REPOSITORY),l=(0,Y.jsxs)(`button`,{type:`button`,"data-testid":o?`open-workspace-button`:`open-repository-button`,onClick:t,disabled:n,className:C(`flex flex-row items-center gap-2 rounded-full px-2.5 py-1 text-white`,N,M,j,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-raised`),children:[(0,Y.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:o?(0,Y.jsx)(d,{"aria-hidden":!0,className:`h-4 w-4`,strokeWidth:2}):(0,Y.jsx)(R,{width:16,height:16,className:`shrink-0`})}),(0,Y.jsx)(`span`,{className:`text-sm font-normal leading-5`,children:c})]});return r?(0,Y.jsx)(L,{content:r,placement:`top`,children:(0,Y.jsx)(`span`,{className:`inline-flex`,children:l})}):l}function We({workspaces:e,value:t,placeholder:n,className:r,disabled:a=!1,disabledTooltip:o,showManage:c,onChange:l,onAddClick:u,onManageClick:d}){let{t:f}=s(`openhands`),[p,m]=(0,q.useState)(t?.name??``),h=(0,q.useRef)(null),g=(0,q.useMemo)(()=>{let t=p.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,p]),_=(0,q.useCallback)(e=>{l(e),e&&m(e.name)},[l]),v=(0,q.useCallback)(()=>{_(null),m(``)},[_]),{isOpen:y,getToggleButtonProps:b,getMenuProps:x,getInputProps:S,highlightedIndex:w,getItemProps:T,selectedItem:E,closeMenu:D}=I({items:g,itemToString:e=>e?.name??``,selectedItem:t,onSelectedItemChange:({selectedItem:e})=>{_(e??null)},inputValue:p,stateReducer:(e,t)=>t.type===I.stateChangeTypes.InputClick&&e.isOpen?{...t.changes,isOpen:!0}:t.changes}),O=(e,t,n,r,i)=>(0,Y.jsx)(we,{item:e,index:t,isSelected:r?.id===e.id,getItemProps:i,getDisplayText:e=>e.name,getItemKey:e=>e.id},e.id),k=e=>(0,Y.jsx)(Ne,{inputValue:e,searchMessage:f(i.HOME$NO_WORKSPACES),emptyMessage:f(i.HOME$NO_WORKSPACES),testId:`workspace-dropdown-empty`}),A=(0,q.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`button`,{type:`button`,"data-testid":`add-workspaces-button`,className:`flex items-center w-full px-2 py-2 text-sm text-white hover:bg-[var(--oh-interactive-hover)] rounded-md transition-colors duration-150 font-normal`,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),D(),u()},children:f(i.HOME$ADD_WORKSPACES)}),(c??e.length>0)&&(0,Y.jsx)(`button`,{type:`button`,"data-testid":`manage-workspaces-button`,className:`flex items-center w-full px-2 py-2 text-sm text-white hover:bg-[var(--oh-interactive-hover)] rounded-md transition-colors duration-150 font-normal`,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),D(),d()},children:f(i.HOME$MANAGE_WORKSPACES)})]}),[u,d,f,D,e.length,c]),j=(0,Y.jsxs)(`div`,{className:C(`relative`,r),children:[(0,Y.jsxs)(`div`,{className:`group relative text-[var(--oh-muted)] hover:text-white`,children:[(0,Y.jsx)(`div`,{className:`absolute left-2 top-1/2 transform -translate-y-1/2 z-10`,children:(0,Y.jsx)(te,{width:16,height:16})}),(0,Y.jsx)(`input`,{...S({disabled:a,placeholder:n??f(i.HOME$WORKSPACE_PLACEHOLDER),className:C(ee,`text-inherit shadow-none pl-7 pr-16 text-sm font-normal leading-5`,`placeholder:text-[var(--oh-muted)]`,`disabled:cursor-not-allowed disabled:opacity-60`),onChange:e=>{m(e.target.value)}}),"data-testid":`workspace-dropdown`}),(0,Y.jsxs)(`div`,{className:`absolute right-1 top-1/2 transform -translate-y-1/2 flex items-center`,children:[t&&(0,Y.jsx)(Fe,{disabled:a,onClear:v}),(0,Y.jsx)(Oe,{isOpen:y,disabled:a,getToggleButtonProps:b})]})]}),(0,Y.jsx)(Ae,{isOpen:y,filteredItems:g,inputValue:p,highlightedIndex:w,selectedItem:E,getMenuProps:x,getItemProps:T,menuRef:h,renderItem:O,renderEmptyState:k,stickyFooterItem:A,testId:`workspace-dropdown-menu`,itemKey:e=>e.id})]});return o?(0,Y.jsx)(L,{content:o,placement:`top`,children:(0,Y.jsx)(`span`,{className:`block`,children:j})}):j}function Ge({isLoadingSettings:e=!1,onConfirm:t}){let{t:n}=s(`openhands`),{navigate:r}=F(),{data:a,error:c}=W(),l=a?.workspaceParents??[],{mutate:u}=me(),{mutate:d}=le(),{mutate:f}=pe(),{mutate:p}=de(),{workspaces:m,isLoading:h,isError:g,error:_}=ue(),v=G(c??_,n),[y,b]=q.useState(null),[x,S]=q.useState(!1),[C,w]=q.useState(!1),{mutate:T,isPending:E,isSuccess:D}=U(),O=o(),k=E||D||O,A=l.length>0||!!v,j=null;v?j=v:h?j=n(i.HOME$LOADING):g&&(j=n(i.HOME$WORKSPACE_SCAN_ERROR));let M=!!v||e||h&&m.length===0;return(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[!t&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-[10px] pb-4`,children:[(0,Y.jsx)(ge,{width:24,height:24}),(0,Y.jsx)(`span`,{className:`leading-5 font-bold text-base text-white`,children:n(i.HOME$WORKSPACES_TAB)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-[10px] pb-4`,children:[(0,Y.jsx)(We,{workspaces:m,value:y,placeholder:v?n(i.HOME$WORKSPACES_UNSUPPORTED_PLACEHOLDER):M?n(i.HOME$LOADING):void 0,disabled:M,disabledTooltip:v,showManage:m.length>0||l.length>0,onChange:b,onAddClick:()=>S(!0),onManageClick:()=>w(!0),className:`max-w-auto`}),A&&j&&(0,Y.jsx)(`p`,{className:`px-1 text-xs text-[var(--oh-text-secondary)]`,"data-testid":`workspace-status-message`,children:j})]}),(0,Y.jsx)(P,{testId:`workspace-launch-button`,variant:`primary`,type:`button`,isDisabled:!y||!t&&k||e,onClick:()=>{if(y){if(t){t(y);return}T({workingDir:y.path},{onSuccess:e=>r(`/conversations/${e.conversation_id}`)})}},className:t?`w-full`:`w-auto absolute bottom-5 left-5 right-5`,children:t?n(i.BUTTON$CONFIRM):k?n(i.HOME$LOADING):`Launch`}),(0,Y.jsx)(fe,{isOpen:x,onClose:()=>S(!1),onAdd:e=>u(e),onAddParent:e=>f(e)}),(0,Y.jsx)(he,{isOpen:C,workspaces:m,workspaceParents:l,onClose:()=>w(!1),onRemove:e=>{y?.path===e&&b(null),d(e)},onRemoveParent:e=>{y?.parentPath===e&&b(null),p(e)}})]})}function Ke({isOpen:e,onClose:t,onConfirm:n}){let{t:r}=s(`openhands`),{isLoadingSettings:a}=z();return e?(0,Y.jsx)(E,{onClose:t,children:(0,Y.jsxs)(D,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Y.jsx)(B,{onClose:t,testId:`close-open-workspace-dialog`}),(0,Y.jsx)(`div`,{className:`w-full pr-6`,children:(0,Y.jsx)(A,{title:r(i.HOME$OPEN_WORKSPACE)})}),(0,Y.jsx)(`div`,{className:`w-full`,"data-testid":`open-workspace-dialog-body`,children:(0,Y.jsx)(Ge,{isLoadingSettings:a,onConfirm:e=>{n(e),t()}})})]})}):null}function qe({onRepoSelection:e,isLoadingSettings:t=!1,onConfirm:n}){let{navigate:r}=F(),[a,c]=q.useState(null),[l,u]=q.useState(null),[d,f]=q.useState(null),{providers:p}=z(),{addRecentRepository:m,setLastSelectedProvider:h,getLastSelectedProvider:g}=ne(),{mutate:_,isPending:v,isSuccess:y}=U(),b=o(),{t:x}=s(`openhands`);q.useEffect(()=>{if(p.length!==0){if(p.length===1&&!d){f(p[0]);return}if(p.length>1&&!d){let e=g();e&&p.includes(e)&&f(e)}}},[p,d,g]);let S=v||y||b,C=t=>{t!==d&&(f(t),h(t),c(null),u(null),e?.(null))},w=q.useCallback(e=>{u(e)},[]);return(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[!n&&(0,Y.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-[10px] pb-4`,children:[(0,Y.jsx)(R,{width:24,height:24}),(0,Y.jsx)(`span`,{className:`leading-5 font-bold text-base text-white`,children:x(i.COMMON$OPEN_REPOSITORY)})]})}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-[10px] pb-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm text-white font-normal leading-[22px]`,children:x(i.HOME$SELECT_OR_INSERT_URL)}),p.length<=1?null:(0,Y.jsx)(Ce,{providers:p,value:d,placeholder:`Select Provider`,className:`max-w-[500px]`,onChange:C,disabled:t})]}),(0,Y.jsx)(Me,{provider:d||p[0],value:a?.id||null,repositoryName:a?.full_name||null,placeholder:`user/repo`,disabled:!d||t,onChange:t=>{t?(e?.(t),c(t)):(e?.(null),c(null),u(null))},className:`max-w-auto`}),(()=>{let e=a?.main_branch||null;return(0,Y.jsx)(De,{repository:a?.full_name||null,provider:d||p[0],selectedBranch:l,onBranchSelect:w,defaultBranch:e,placeholder:`Select branch...`,className:`max-w-full`,disabled:!a||t})})()]}),(0,Y.jsx)(P,{testId:`repo-launch-button`,variant:`primary`,type:`button`,isDisabled:!a||!l||!n&&S||p.length>1&&!d||t,onClick:()=>{if(!(!a||!l)){if(m(a),n){n({repository:a,branch:l,provider:d});return}_({repository:{name:a.full_name||``,gitProvider:a.git_provider||`github`,branch:l.name||`main`}},{onSuccess:e=>r(`/conversations/${e.conversation_id}`)})}},className:`w-full`,children:n?x(i.BUTTON$CONFIRM):S?x(`HOME$LOADING`):`Launch`})]})}function Je({isOpen:e,onClose:t,onConfirm:n}){let{t:r}=s(`openhands`),{isLoadingSettings:a}=z();return e?(0,Y.jsx)(E,{onClose:t,children:(0,Y.jsxs)(D,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Y.jsx)(B,{onClose:t,testId:`close-open-repository-dialog`}),(0,Y.jsx)(`div`,{className:`w-full pr-6`,children:(0,Y.jsx)(A,{title:r(i.COMMON$OPEN_REPOSITORY)})}),(0,Y.jsx)(`div`,{className:`w-full`,"data-testid":`open-repository-dialog-body`,children:(0,Y.jsx)(qe,{isLoadingSettings:a,onConfirm:e=>{n(e),t()}})})]})}):null}function Ye({workspace:e,repository:t,branch:n,provider:r,onRepoClick:i}){let a=e?e.path.replace(/\/+$/,``).split(`/`).pop()||e.path:null;return(0,Y.jsxs)(`div`,{className:`flex flex-row gap-2.5 items-center flex-wrap`,"data-testid":`home-git-control-bar-preview`,children:[(0,Y.jsx)(ke,{selectedRepository:t?.full_name??null,gitProvider:r??null,workspaceName:a,onClick:i}),n?(0,Y.jsx)(Pe,{selectedBranch:n.name,selectedRepository:t?.full_name??null,gitProvider:r??null}):null]})}function Xe(){let{t:e}=s(`openhands`),{backend:t}=w(),{navigate:n}=F(),r=t.kind===`local`,[a,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),[h,_]=(0,q.useState)(null),[v,y]=(0,q.useState)(null),{mutate:b,isPending:x}=U(),S=o(),C=x||S,{images:T,files:E,imagesMarkedUploadAsFile:D,clearAllFiles:O}=ae(),{handleUpload:k}=Te(),{error:A}=W({enabled:r}),j=r?G(A,e):null,M=r?!!l:!!d&&!!h,N=Ee(null,t=>{let a=t.trim(),o=T.length>0||E.length>0;if(!a&&!o||C)return;let s={images:[...T],files:[...E]},c={query:o?void 0:a||void 0};r&&l?c={...c,workingDir:l.path}:!r&&d&&h&&(c={...c,repository:{name:d.full_name,gitProvider:d.git_provider,branch:h.name}});let u=p.loading(e(i.HOME$CREATING_CONVERSATION),g);b(c,{onSuccess:async t=>{p.dismiss(u);try{sessionStorage.removeItem(ye)}catch{}let i=t.conversation_id,c=i.startsWith(`task-`);if(o)if(!r||c){let e=t.task_id??(c?i.slice(5):null);if(!e){m(null);return}Se(e,{content:a,images:s.images,files:s.files,imagesMarkedUploadAsFile:[...D]}),O(),await J({conversationId:i,text:a,images:s.images,imagesMarkedUploadAsFile:D}),n(`/conversations/${i}`);return}else try{await ve({conversationId:i,content:a,images:s.images,files:s.files,imagesMarkedUploadAsFile:D,t:e}),O()}catch(e){m(e instanceof Error?e.message:null);return}c&&a&&await J({conversationId:i,text:a,images:[],imagesMarkedUploadAsFile:[]}),n(`/conversations/${i}`)},onError:e=>{p.dismiss(u),m(e instanceof Error?e.message:null)}})});return(0,Y.jsxs)(`div`,{"data-testid":`home-chat-launcher`,className:`flex w-full max-w-[800px] flex-col gap-4 md:px-4`,children:[(0,Y.jsx)(`div`,{className:`flex w-full justify-center`,children:(0,Y.jsx)(He,{})}),(0,Y.jsx)(`div`,{className:`w-full`,children:(0,Y.jsx)(je,{onSubmit:N,onFilesPaste:k,disabled:C})}),(0,Y.jsx)(`div`,{className:`flex justify-start`,children:M?(0,Y.jsx)(Ye,{workspace:l,repository:d,branch:h,provider:v,onRepoClick:()=>c(!0)}):(0,Y.jsx)(Ue,{kind:r?`local`:`cloud`,onClick:()=>c(!0),disabled:C||!!j,disabledTooltip:j})}),r?(0,Y.jsx)(Ke,{isOpen:a,onClose:()=>c(!1),onConfirm:e=>{u(e),f(null),_(null),y(null)}}):(0,Y.jsx)(Je,{isOpen:a,onClose:()=>c(!1),onConfirm:({repository:e,branch:t,provider:n})=>{f(e),_(t),y(n??e.git_provider),u(null)}})]})}function Ze({currentStep:e,totalSteps:t,className:n}){return(0,Y.jsx)(`div`,{role:`progressbar`,"aria-valuemin":1,"aria-valuemax":t,"aria-valuenow":e+1,"data-testid":`onboarding-progress-bar`,className:C(`flex w-full items-center gap-2`,n),children:Array.from({length:t},(t,n)=>{let r=n<e,i=n===e;return(0,Y.jsx)(`div`,{"data-testid":`onboarding-progress-step-${n}`,"data-state":r?`completed`:i?`current`:`upcoming`,className:C(`h-1.5 flex-1 rounded-full transition-colors duration-300`,r||i?`bg-white`:`bg-white/15`)},n)})})}function Qe(e){return e===`openhands`?`openhands`:V.find(({key:t})=>t===e)?.icon??`cli-generic`}function $e({id:e,muted:t}){let n=Qe(e);return n===`openhands`?(0,Y.jsx)(K,{kind:`openhands`,size:16,className:C(`text-white`,t&&`opacity-55`),"data-testid":`onboarding-agent-icon-openhands`}):(0,Y.jsx)(K,{kind:n,size:18,className:t?`text-[var(--oh-muted)]`:`text-white`,"data-testid":`onboarding-agent-icon-${n}`})}function et(){return[{id:`openhands`,label:`OpenHands`,descriptionKey:i.ONBOARDING$AGENT_OPENHANDS_DESCRIPTION},...V.map(e=>({id:e.key,label:e.display_name,descriptionKey:e.description_key}))]}function tt({selectedAgentId:e,onSelect:t,onNext:n}){let{t:r}=s(`openhands`),{mutate:a,isPending:o}=_e();return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-choose-agent`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:r(i.ONBOARDING$AGENT_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:r(i.ONBOARDING$AGENT_SUBTITLE)})]}),(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":r(i.ONBOARDING$AGENT_TITLE),className:`flex flex-col gap-3`,children:et().map(n=>{let i=n.id===e;return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":i,"data-testid":`onboarding-agent-option-${n.id}`,"data-selected":i,onClick:()=>t(n.id),className:C(`flex items-start justify-between gap-4 rounded-xl border px-4 py-3 text-left transition-colors cursor-pointer`,i?`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,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)($e,{id:n.id,muted:!1}),(0,Y.jsx)(`span`,{className:`truncate text-base font-normal text-white`,children:n.label})]}),(0,Y.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:r(n.descriptionKey)})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:i?(0,Y.jsx)(f,{width:18,height:18,className:`mt-1 shrink-0 text-white`,"aria-hidden":!0}):null})]},n.id)})}),(0,Y.jsx)(`div`,{className:`sticky bottom-0 flex justify-end bg-base-secondary pt-4 pb-7`,children:(0,Y.jsx)(P,{testId:`onboarding-agent-next`,type:`button`,variant:`primary`,isDisabled:o,onClick:()=>{let t=se(e);if(!t){n();return}a({agent_settings_diff:t},{onError:e=>{m(c(e)||r(i.ERROR$GENERIC))},onSuccess:()=>{h(r(i.SETTINGS$SAVED)),n()}})},children:r(o?i.SETTINGS$SAVING:i.ONBOARDING$NEXT)})})]})}function nt({isConnected:e}){let{t}=s(`openhands`);return e===!0?(0,Y.jsxs)(`div`,{role:`status`,"data-testid":`onboarding-backend-connected`,className:C(`flex items-start gap-3 rounded-xl border border-green-500/40 bg-green-500/10 px-4 py-3`),children:[(0,Y.jsx)(u,{className:`mt-0.5 size-5 shrink-0 text-green-400`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-green-200`,children:t(i.ONBOARDING$BACKEND_CONNECTED_TITLE)}),(0,Y.jsx)(`span`,{className:`text-xs text-green-200/80`,children:t(i.ONBOARDING$BACKEND_CONNECTED_BODY)})]})]}):e===!1?(0,Y.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,Y.jsx)(Be,{className:`mt-0.5 size-5 shrink-0 text-red-400`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-red-200`,children:t(i.ONBOARDING$BACKEND_DISCONNECTED_TITLE)}),(0,Y.jsx)(`span`,{className:`text-xs text-red-200/80`,children:t(i.ONBOARDING$BACKEND_DISCONNECTED_BODY)})]})]}):(0,Y.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,Y.jsx)(v,{className:`mt-0.5 size-5 shrink-0 animate-spin text-[var(--oh-text-tertiary)]`}),(0,Y.jsx)(`span`,{className:`text-sm text-[var(--oh-text-tertiary)]`,children:t(i.ONBOARDING$BACKEND_CHECKING)})]})}function rt({onBack:e,onNext:t}){let{t:n}=s(`openhands`),{active:r}=T(),{backend:a}=r,o=re([a])[a.id]?.isConnected??null;return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-check-backend`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:n(i.ONBOARDING$BACKEND_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:n(i.ONBOARDING$BACKEND_SUBTITLE)})]}),(0,Y.jsx)(nt,{isConnected:o}),(0,Y.jsx)(ie,{mode:`edit`,backend:a,onSubmitted:()=>{},testIdRoot:`onboarding-backend`,renderActions:({canSubmit:r,testIdRoot:a})=>(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-end gap-2 mt-2 bg-base-secondary pt-4 pb-7`,children:[(0,Y.jsx)(P,{testId:`onboarding-backend-back`,type:`button`,variant:`secondary`,onClick:e,children:n(i.ONBOARDING$BACK)}),(0,Y.jsx)(P,{testId:`${a}-submit`,type:`submit`,variant:`secondary`,isDisabled:!r,children:n(i.BACKEND$SAVE)}),(0,Y.jsx)(P,{testId:`onboarding-backend-next`,type:`button`,variant:`primary`,isDisabled:o!==!0,onClick:t,children:n(i.ONBOARDING$NEXT)})]})})]})}var it={"llm.model":`openhands/claude-opus-4-5-20251101`};function at({onBack:e,onNext:t}){let{t:n}=s(`openhands`),{backend:r}=w(),a=r.kind===`local`,o=x(),c=b(),[l,u]=q.useState(null),[d,f]=q.useState(!1),p=q.useCallback(async()=>{if(!a||!l)return;let e=l.values,t=typeof e[`llm.model`]==`string`?e[`llm.model`]:``;if(!t)return;let n=typeof e[`llm.api_key`]==`string`?e[`llm.api_key`]:``,r=typeof e[`llm.base_url`]==`string`?e[`llm.base_url`]:``,i=y(t),s={model:t};n&&(s.api_key=n),r&&(s.base_url=r);try{await o.mutateAsync({name:i,request:{llm:s,include_secrets:!0}}),await c.mutateAsync(i)}catch(e){console.error(`Failed to persist onboarding LLM as profile:`,e)}},[a,l,o,c]),m=q.useCallback(async()=>{f(!0);try{await p()}finally{f(!1),t()}},[p,t]);return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-setup-llm`,className:`flex flex-col gap-6 max-h-[calc(90vh-7rem)]`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:n(i.ONBOARDING$LLM_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:n(i.ONBOARDING$LLM_SUBTITLE)})]}),(0,Y.jsx)(`div`,{"data-testid":`onboarding-llm-settings`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto custom-scrollbar-always`,children:(0,Y.jsx)(S,{embedded:!0,hideSaveButton:!0,initialValueOverrides:it,onSaveSuccess:m,onSaveControlChange:u})}),(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-end gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,Y.jsx)(P,{testId:`onboarding-llm-back`,type:`button`,variant:`secondary`,onClick:e,children:n(i.ONBOARDING$BACK)}),(0,Y.jsx)(P,{testId:`onboarding-llm-next`,type:`button`,variant:`primary`,isDisabled:(l?.isSaving??!1)||d,onClick:()=>{if(l?.isDirty){l.save();return}t()},children:n(i.ONBOARDING$NEXT)})]})]})}function ot({providerKey:e,onBack:t,onNext:n}){let{t:r}=s(`openhands`),o=a(),{mutateAsync:l}=Le(),{data:u}=Re(),d=q.useMemo(()=>H(e),[e]),[f,p]=q.useState({}),[g,_]=q.useState(!1),v=ce(e)??e,y=q.useCallback(e=>(u??[]).some(t=>t.name===e),[u]);return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-setup-acp-secrets`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:r(i.ONBOARDING$ACP_SECRETS_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:r(i.ONBOARDING$ACP_SECRETS_SUBTITLE,{provider:v})})]}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-5`,children:d.map(e=>{let t=y(e.name);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(oe,{testId:`onboarding-acp-secret-${e.name}`,name:e.name,label:e.name,labelClassName:`font-mono`,type:e.secret?`password`:`text`,value:f[e.name]??``,onChange:t=>p(n=>({...n,[e.name]:t})),showOptionalTag:!0,placeholder:t?r(i.ONBOARDING$ACP_SECRET_ALREADY_SET):``}),(0,Y.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:r(e.hint_key)})]},e.name)})}),(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-between gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,Y.jsx)(P,{testId:`onboarding-acp-secrets-back`,type:`button`,variant:`secondary`,onClick:t,isDisabled:g,children:r(i.ONBOARDING$BACK)}),(0,Y.jsx)(P,{testId:`onboarding-acp-secrets-next`,type:`button`,variant:`primary`,isDisabled:g,onClick:async()=>{let e=d.map(e=>({name:e.name,value:f[e.name]?.trim()})).filter(e=>!!e.value);if(e.length===0){n();return}_(!0);try{for(let{name:t,value:n}of e)await l({name:t,value:n});await o.invalidateQueries({queryKey:[`secrets-search`]}),await o.invalidateQueries({queryKey:[`secrets`]}),h(r(i.SETTINGS$SAVED)),n()}catch(e){m(c(e)||r(i.ERROR$GENERIC))}finally{_(!1)}},children:r(g?i.SETTINGS$SAVING:i.ONBOARDING$NEXT)})]})]})}function st({onBack:e,onLaunched:t}){let{t:n}=s(`openhands`),{navigate:r}=F(),a=n(i.ONBOARDING$HELLO_DEFAULT_MESSAGE),[c,l]=q.useState(a),{mutate:u,isPending:d,isSuccess:f}=U(),p=o(),m=d||f||p,h=q.useRef(!1),g=c.trim().length>0&&!m&&!h.current,_=()=>{!g||h.current||(h.current=!0,u({query:c.trim()},{onSuccess:e=>{t(),r(`/conversations/${e.conversation_id}`)},onError:()=>{h.current=!1}}))};return(0,Y.jsxs)(`div`,{"data-testid":`onboarding-step-say-hello`,className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-2xl font-medium text-white`,children:n(i.ONBOARDING$HELLO_TITLE)}),(0,Y.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:n(i.ONBOARDING$HELLO_SUBTITLE)})]}),(0,Y.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_()},className:`contents`,children:(0,Y.jsx)(`input`,{"data-testid":`onboarding-hello-input`,"aria-label":n(i.ONBOARDING$HELLO_TITLE),type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:a,disabled:m,className:`w-full rounded-xl border border-white/10 bg-base-secondary px-4 py-3 text-base text-white placeholder:text-[var(--oh-text-subtle)] focus:border-primary focus:outline-none disabled:opacity-60`})}),(0,Y.jsx)(`div`,{"data-testid":`onboarding-recommended-automations`,children:(0,Y.jsx)(ze,{onLaunched:t})}),(0,Y.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-between gap-2 bg-base-secondary pt-4 pb-7`,children:[(0,Y.jsx)(P,{testId:`onboarding-hello-back`,type:`button`,variant:`secondary`,onClick:e,isDisabled:m,children:n(i.ONBOARDING$BACK)}),(0,Y.jsx)(P,{testId:`onboarding-hello-launch`,type:`button`,variant:`primary`,isDisabled:!g,onClick:_,startContent:(0,Y.jsx)(Ve,{className:`size-4`,"aria-hidden":!0}),children:n(m?i.ONBOARDING$HELLO_LAUNCHING:i.ONBOARDING$HELLO_LAUNCH)})]})]})}var X=4;function Z({index:e,currentStep:t,children:n}){let r=e===t,i=(e-t)*100;return(0,Y.jsx)(`div`,{"data-testid":`onboarding-slide-${e}`,"data-active":r,"aria-hidden":!r,style:{transform:`translateX(${i}%)`},className:C(`w-full transition-transform duration-300 ease-out`,!r&&`pointer-events-none absolute inset-0`),children:n})}function ct({onClose:e}){let{t}=s(`openhands`),[n,r]=q.useState(0),[a,o]=q.useState(`openhands`),c=a===`openhands`,l=H(a),u=!c&&l.length>0,d=!c&&!u,f=q.useCallback(()=>r(e=>Math.min(e+(d&&e===1?2:1),X-1)),[d]),p=q.useCallback(()=>r(e=>Math.max(e-(d&&e===3?2:1),0)),[d]),m=d?X-1:X,h=d&&n>1?n-1:n;return(0,Y.jsx)(E,{onClose:e,closeOnEscape:!1,"aria-label":t(i.ONBOARDING$TITLE),children:(0,Y.jsxs)(`div`,{className:`relative flex flex-col items-center gap-4`,children:[(0,Y.jsxs)(`section`,{"data-testid":`onboarding-modal`,"data-current-step":n,className:C(`flex flex-col gap-6 overflow-hidden rounded-2xl border border-white/10 bg-base-secondary shadow-2xl`,O(`lg`),k,`max-h-[90vh]`),children:[(0,Y.jsx)(`header`,{className:`flex flex-col gap-3 px-7 pt-7 shrink-0`,children:(0,Y.jsx)(Ze,{currentStep:h,totalSteps:m})}),(0,Y.jsx)(`div`,{"data-testid":`onboarding-scroll-area`,className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar-always px-7`,children:(0,Y.jsxs)(`div`,{"data-testid":`onboarding-slide-rail`,"data-current-step":n,className:`relative overflow-clip`,children:[(0,Y.jsx)(Z,{index:0,currentStep:n,children:(0,Y.jsx)(tt,{selectedAgentId:a,onSelect:o,onNext:f})}),(0,Y.jsx)(Z,{index:1,currentStep:n,children:(0,Y.jsx)(rt,{onBack:p,onNext:f})}),(0,Y.jsx)(Z,{index:2,currentStep:n,children:c?(0,Y.jsx)(at,{onBack:p,onNext:f}):u?(0,Y.jsx)(ot,{providerKey:a,onBack:p,onNext:f}):null}),(0,Y.jsx)(Z,{index:3,currentStep:n,children:(0,Y.jsx)(st,{onBack:p,onLaunched:e})})]})})]}),(0,Y.jsx)(`button`,{type:`button`,"data-testid":`onboarding-skip`,onClick:e,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:t(i.ONBOARDING$SKIP)})]})})}var Q=`openhands-onboarded`;function $(){if(typeof window>`u`)return!0;try{return window.localStorage.getItem(Q)!==null}catch{return!0}}function lt(){let[e,t]=q.useState(()=>$());return q.useEffect(()=>{let e=e=>{e.key===`openhands-onboarded`&&t($())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),{isCompleted:e,markCompleted:q.useCallback(()=>{try{window.localStorage.setItem(Q,`1`)}catch{}t(!0)},[])}}function ut(){let{isCompleted:e,markCompleted:t}=lt();return e?null:(0,Y.jsx)(ct,{onClose:t})}function dt(){return(0,Y.jsxs)(`div`,{"data-testid":`home-screen`,className:`custom-scrollbar-always flex h-full flex-col overflow-y-auto rounded-xl bg-transparent px-4 md:px-0 lg:px-[42px]`,children:[(0,Y.jsx)(`div`,{className:`flex flex-1 min-h-0 flex-col items-center justify-center`,children:(0,Y.jsx)(Xe,{})}),(0,Y.jsx)(ut,{})]})}var ft=n(dt);export{ft as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{I as n,L as r,M as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as a,t as o}from"./declaration-BNMqORFE.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{t as c}from"./utils-i18rdUj2.js";import{t as l}from"./modal-backdrop-BAbgYsqB.js";import{r as u,t as d}from"./modal-body-BI6Ru2Qr.js";import{t as f}from"./brand-button-Br7f0kZJ.js";import{t as p}from"./modal-close-button-t1Gh3qmL.js";import{t as m}from"./settings-input-Bn7F5C75.js";import{t as h}from"./use-create-conversation-CKS3EAHu.js";import{r as g}from"./typography-gpuWmrQO.js";import{n as _,t as v}from"./vendor~launch-vdeRTWFu.js";var y=e(t(),1),b=a();function x({pluginIndex:e,paramKey:t,paramValue:n,onParameterChange:r}){let i=`plugin-${e}-param-${t}`;return typeof n==`boolean`?(0,b.jsxs)(`label`,{htmlFor:i,className:`flex w-full cursor-pointer items-center gap-2.5`,children:[(0,b.jsx)(`input`,{id:i,"data-testid":i,type:`checkbox`,checked:n,onChange:n=>r(e,t,n.target.checked),className:`h-4 w-4 shrink-0 rounded`}),(0,b.jsx)(`span`,{className:`text-sm`,children:t})]}):typeof n==`number`?(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`number`,label:t,value:String(n),className:`w-full`,onChange:n=>r(e,t,n===``?0:parseFloat(n)||0)}):(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`text`,label:t,value:String(n??``),className:`w-full`,onChange:n=>r(e,t,n)})}function S({plugin:e,originalIndex:t,isExpanded:n,onToggle:r,getPluginDisplayName:i,onParameterChange:a}){let{t:c}=s(`openhands`);return e.parameters&&Object.keys(e.parameters).length>0?(0,b.jsxs)(`div`,{className:`rounded-lg border border-[var(--oh-border)] bg-tertiary`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-between px-4 py-3 text-left hover:bg-base-tertiary rounded-t-lg cursor-pointer`,"data-testid":`plugin-section-${t}`,children:[(0,b.jsx)(g.Text,{className:`text-base font-normal`,children:i(e)}),n?(0,b.jsx)(v,{className:`h-5 w-5 text-white`}):(0,b.jsx)(_,{className:`h-5 w-5 text-white`})]}),n&&(0,b.jsxs)(`div`,{className:`border-t border-[var(--oh-border-subtle)] px-4 pb-3`,children:[e.ref&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[c(o.LAUNCH$PLUGIN_REF),` `,e.ref]}),e.repo_path&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[c(o.LAUNCH$PLUGIN_PATH),` `,e.repo_path]}),(0,b.jsx)(`div`,{className:`flex flex-col gap-4`,children:Object.entries(e.parameters||{}).map(([e,n])=>(0,b.jsx)(x,{pluginIndex:t,paramKey:e,paramValue:n,onParameterChange:a},e))})]})]}):null}function C({plugins:e,message:t,isLoading:n=!1,onStartConversation:r,onClose:i}){let{t:a}=s(`openhands`),[m,h]=y.useState(e),[_,v]=y.useState(()=>{let t={};return e.forEach((e,n)=>{e.parameters&&Object.keys(e.parameters).length>0&&(t[n]=!0)}),t}),[x,C]=y.useState(!1),w=m.filter(e=>e.parameters&&Object.keys(e.parameters).length>0),T=m.filter(e=>!e.parameters||Object.keys(e.parameters).length===0),E=e=>{v(t=>({...t,[e]:!t[e]}))},D=(e,t,n)=>{h(r=>{let i=[...r],a={...i[e]};return a.parameters={...a.parameters,[t]:n},i[e]=a,i})},O=e=>{let{source:t,repo_path:n}=e;if(n){let e=n.split(`/`);return e[e.length-1]}if(t.startsWith(`github:`))return t.replace(`github:`,``);if(t.includes(`/`)){let e=t.split(`/`);return e[e.length-1].replace(`.git`,``)}return t},k=e=>{let{source:t}=e;return t.startsWith(`github:`)?t.replace(`github:`,``):t.includes(`github.com/`)&&t.split(`github.com/`)[1]?.replace(`.git`,``)||t},A=()=>{let e=m.map(e=>k(e));return[...new Set(e)]},j=()=>{r(m,t)},M=m.length===1?O(m[0]):a(o.LAUNCH$MODAL_TITLE_GENERIC);return(0,b.jsx)(l,{onClose:i,children:(0,b.jsxs)(`div`,{"data-testid":`plugin-launch-modal`,className:c(`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)] max-h-[80vh]`,u(`md`),d),children:[(0,b.jsx)(p,{onClose:i,testId:`close-button`}),(0,b.jsxs)(g.H2,{className:`pr-6 text-content-2`,children:[a(o.LAUNCH$MODAL_TITLE),` `,M]}),t&&(0,b.jsx)(`p`,{className:`text-sm text-white`,children:t}),(0,b.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar`,children:[w.length>0&&(0,b.jsx)(`div`,{className:`space-y-3`,children:m.map((e,t)=>(0,b.jsx)(S,{plugin:e,originalIndex:t,isExpanded:!!_[t],onToggle:()=>E(t),getPluginDisplayName:O,onParameterChange:D},`plugin-${t}`))}),T.length>0&&(0,b.jsxs)(`div`,{className:c(w.length>0&&`mt-4`),children:[(0,b.jsx)(g.H3,{className:`mb-2 text-white`,children:w.length>0?a(o.LAUNCH$ADDITIONAL_PLUGINS):a(o.LAUNCH$PLUGINS)}),(0,b.jsx)(`div`,{className:`space-y-2`,children:T.map((e,t)=>(0,b.jsxs)(`div`,{className:`rounded-md bg-tertiary px-3 py-2 text-sm`,children:[(0,b.jsx)(`div`,{className:`font-medium`,children:O(e)}),(0,b.jsxs)(`div`,{className:`text-xs text-white mt-1`,children:[k(e),e.repo_path&&(0,b.jsxs)(`span`,{className:`ml-1`,children:[`/ `,e.repo_path]}),e.ref&&(0,b.jsxs)(`span`,{className:`ml-2`,children:[`@ `,e.ref]})]})]},`simple-plugin-${t}`))})]})]}),(0,b.jsxs)(`div`,{className:`pt-4 border-t border-[var(--oh-border-subtle)]`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,b.jsx)(`input`,{id:`trust-checkbox`,"data-testid":`trust-checkbox`,type:`checkbox`,checked:x,onChange:e=>C(e.target.checked),className:`mt-1 h-4 w-4 flex-shrink-0`}),(0,b.jsx)(`label`,{htmlFor:`trust-checkbox`,className:`text-sm text-white`,children:a(o.LAUNCH$TRUST_SKILL_CHECKBOX,{sources:A().join(`, `),interpolation:{escapeValue:!1}})})]}),(0,b.jsx)(`div`,{className:`flex w-full justify-end mt-8`,children:(0,b.jsx)(f,{testId:`start-conversation-button`,type:`button`,variant:`primary`,onClick:j,isDisabled:n||!x,className:`px-4`,children:a(n?o.LAUNCH$STARTING:o.LAUNCH$START_CONVERSATION)})})]})]})})}function w(e){if(e)return e.replace(/<[^>]*>/g,``).slice(0,500)||void 0}function T(e){let t=e.get(`plugins`);if(t)try{let n=atob(t),r=JSON.parse(n);if(!Array.isArray(r))return{plugins:[],error:`invalid_format`};let i=[];for(let e of r){if(typeof e!=`object`||!e||typeof e.source!=`string`)return{plugins:[],error:`invalid_format`};i.push({source:e.source,ref:e.ref??null,repo_path:e.repo_path??null,parameters:e.parameters??null})}return i.length===0?{plugins:[],error:`no_plugins`}:{plugins:i,message:w(e.get(`message`))}}catch{return{plugins:[],error:`invalid_format`}}let n=e.get(`plugin_source`);return n?{plugins:[{source:n,ref:e.get(`plugin_ref`)??null,repo_path:e.get(`plugin_repo_path`)??null,parameters:null}],message:w(e.get(`message`))}:{plugins:[],error:`no_plugins`}}function E({errorType:e,onGoHome:t,onTryAgain:n}){let{t:r}=s(`openhands`),i={no_plugins:r(o.LAUNCH$ERROR_NO_PLUGINS),invalid_format:r(o.LAUNCH$ERROR_INVALID_FORMAT),creation_failed:r(o.LAUNCH$ERROR_CREATION_FAILED)};return(0,b.jsx)(`div`,{className:`flex h-full items-center justify-center`,"data-testid":`launch-error`,children:(0,b.jsxs)(`div`,{className:`max-w-md rounded-lg bg-[var(--oh-surface)] p-6 text-center`,children:[(0,b.jsx)(`h2`,{className:`mb-4 text-xl font-medium text-red-400`,children:r(o.LAUNCH$ERROR_TITLE)}),(0,b.jsx)(`p`,{className:`mb-6 text-[var(--oh-text-tertiary)]`,children:i[e]}),(0,b.jsxs)(`div`,{className:`flex justify-center gap-3`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md bg-tertiary px-4 py-2 text-sm text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`go-home-button`,children:r(o.LAUNCH$GO_HOME)}),n&&(0,b.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md bg-blue-600 px-4 py-2 text-sm text-white hover:bg-blue-700`,"data-testid":`try-again-button`,children:r(o.LAUNCH$TRY_AGAIN)})]})]})})}var D=r(function(){let[e]=n(),t=i(),{t:r}=s(`openhands`),a=h(),[c,l]=y.useState(null),u=y.useMemo(()=>T(e),[e]),d=async(e,n)=>{l(null);try{t(`/conversations/${(await a.mutateAsync({plugins:e,query:n})).conversation_id}`)}catch{l(r(o.LAUNCH$ERROR_CREATION_UNKNOWN))}},f=()=>{t(`/conversations`)};return u.error?(0,b.jsx)(E,{errorType:u.error,onGoHome:f}):c?(0,b.jsx)(E,{errorType:`creation_failed`,onGoHome:f,onTryAgain:()=>{l(null),window.location.reload()}}):(0,b.jsx)(`div`,{className:`h-full`,"data-testid":`launch-route`,children:(0,b.jsx)(C,{plugins:u.plugins,message:u.message,isLoading:a.isPending,onStartConversation:d,onClose:f})})});export{D as default};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{I as n,L as r,M as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{o as a,t as o}from"./declaration-BNMqORFE.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{t as c}from"./utils-i18rdUj2.js";import{t as l}from"./modal-backdrop-BAbgYsqB.js";import{r as u,t as d}from"./modal-body-BI6Ru2Qr.js";import{t as f}from"./brand-button-Br7f0kZJ.js";import{t as p}from"./modal-close-button-t1Gh3qmL.js";import{t as m}from"./settings-input-Bn7F5C75.js";import{t as h}from"./use-create-conversation-CEgXpkfH.js";import{r as g}from"./typography-gpuWmrQO.js";import{n as _,t as v}from"./vendor~launch-vdeRTWFu.js";var y=e(t(),1),b=a();function x({pluginIndex:e,paramKey:t,paramValue:n,onParameterChange:r}){let i=`plugin-${e}-param-${t}`;return typeof n==`boolean`?(0,b.jsxs)(`label`,{htmlFor:i,className:`flex w-full cursor-pointer items-center gap-2.5`,children:[(0,b.jsx)(`input`,{id:i,"data-testid":i,type:`checkbox`,checked:n,onChange:n=>r(e,t,n.target.checked),className:`h-4 w-4 shrink-0 rounded`}),(0,b.jsx)(`span`,{className:`text-sm`,children:t})]}):typeof n==`number`?(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`number`,label:t,value:String(n),className:`w-full`,onChange:n=>r(e,t,n===``?0:parseFloat(n)||0)}):(0,b.jsx)(m,{testId:i,name:`plugin-${e}-param-${t}`,type:`text`,label:t,value:String(n??``),className:`w-full`,onChange:n=>r(e,t,n)})}function S({plugin:e,originalIndex:t,isExpanded:n,onToggle:r,getPluginDisplayName:i,onParameterChange:a}){let{t:c}=s(`openhands`);return e.parameters&&Object.keys(e.parameters).length>0?(0,b.jsxs)(`div`,{className:`rounded-lg border border-[var(--oh-border)] bg-tertiary`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-between px-4 py-3 text-left hover:bg-base-tertiary rounded-t-lg cursor-pointer`,"data-testid":`plugin-section-${t}`,children:[(0,b.jsx)(g.Text,{className:`text-base font-normal`,children:i(e)}),n?(0,b.jsx)(v,{className:`h-5 w-5 text-white`}):(0,b.jsx)(_,{className:`h-5 w-5 text-white`})]}),n&&(0,b.jsxs)(`div`,{className:`border-t border-[var(--oh-border-subtle)] px-4 pb-3`,children:[e.ref&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[c(o.LAUNCH$PLUGIN_REF),` `,e.ref]}),e.repo_path&&(0,b.jsxs)(`div`,{className:`mb-2 text-sm text-white`,children:[c(o.LAUNCH$PLUGIN_PATH),` `,e.repo_path]}),(0,b.jsx)(`div`,{className:`flex flex-col gap-4`,children:Object.entries(e.parameters||{}).map(([e,n])=>(0,b.jsx)(x,{pluginIndex:t,paramKey:e,paramValue:n,onParameterChange:a},e))})]})]}):null}function C({plugins:e,message:t,isLoading:n=!1,onStartConversation:r,onClose:i}){let{t:a}=s(`openhands`),[m,h]=y.useState(e),[_,v]=y.useState(()=>{let t={};return e.forEach((e,n)=>{e.parameters&&Object.keys(e.parameters).length>0&&(t[n]=!0)}),t}),[x,C]=y.useState(!1),w=m.filter(e=>e.parameters&&Object.keys(e.parameters).length>0),T=m.filter(e=>!e.parameters||Object.keys(e.parameters).length===0),E=e=>{v(t=>({...t,[e]:!t[e]}))},D=(e,t,n)=>{h(r=>{let i=[...r],a={...i[e]};return a.parameters={...a.parameters,[t]:n},i[e]=a,i})},O=e=>{let{source:t,repo_path:n}=e;if(n){let e=n.split(`/`);return e[e.length-1]}if(t.startsWith(`github:`))return t.replace(`github:`,``);if(t.includes(`/`)){let e=t.split(`/`);return e[e.length-1].replace(`.git`,``)}return t},k=e=>{let{source:t}=e;return t.startsWith(`github:`)?t.replace(`github:`,``):t.includes(`github.com/`)&&t.split(`github.com/`)[1]?.replace(`.git`,``)||t},A=()=>{let e=m.map(e=>k(e));return[...new Set(e)]},j=()=>{r(m,t)},M=m.length===1?O(m[0]):a(o.LAUNCH$MODAL_TITLE_GENERIC);return(0,b.jsx)(l,{onClose:i,children:(0,b.jsxs)(`div`,{"data-testid":`plugin-launch-modal`,className:c(`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)] max-h-[80vh]`,u(`md`),d),children:[(0,b.jsx)(p,{onClose:i,testId:`close-button`}),(0,b.jsxs)(g.H2,{className:`pr-6 text-content-2`,children:[a(o.LAUNCH$MODAL_TITLE),` `,M]}),t&&(0,b.jsx)(`p`,{className:`text-sm text-white`,children:t}),(0,b.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar`,children:[w.length>0&&(0,b.jsx)(`div`,{className:`space-y-3`,children:m.map((e,t)=>(0,b.jsx)(S,{plugin:e,originalIndex:t,isExpanded:!!_[t],onToggle:()=>E(t),getPluginDisplayName:O,onParameterChange:D},`plugin-${t}`))}),T.length>0&&(0,b.jsxs)(`div`,{className:c(w.length>0&&`mt-4`),children:[(0,b.jsx)(g.H3,{className:`mb-2 text-white`,children:w.length>0?a(o.LAUNCH$ADDITIONAL_PLUGINS):a(o.LAUNCH$PLUGINS)}),(0,b.jsx)(`div`,{className:`space-y-2`,children:T.map((e,t)=>(0,b.jsxs)(`div`,{className:`rounded-md bg-tertiary px-3 py-2 text-sm`,children:[(0,b.jsx)(`div`,{className:`font-medium`,children:O(e)}),(0,b.jsxs)(`div`,{className:`text-xs text-white mt-1`,children:[k(e),e.repo_path&&(0,b.jsxs)(`span`,{className:`ml-1`,children:[`/ `,e.repo_path]}),e.ref&&(0,b.jsxs)(`span`,{className:`ml-2`,children:[`@ `,e.ref]})]})]},`simple-plugin-${t}`))})]})]}),(0,b.jsxs)(`div`,{className:`pt-4 border-t border-[var(--oh-border-subtle)]`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,b.jsx)(`input`,{id:`trust-checkbox`,"data-testid":`trust-checkbox`,type:`checkbox`,checked:x,onChange:e=>C(e.target.checked),className:`mt-1 h-4 w-4 flex-shrink-0`}),(0,b.jsx)(`label`,{htmlFor:`trust-checkbox`,className:`text-sm text-white`,children:a(o.LAUNCH$TRUST_SKILL_CHECKBOX,{sources:A().join(`, `),interpolation:{escapeValue:!1}})})]}),(0,b.jsx)(`div`,{className:`flex w-full justify-end mt-8`,children:(0,b.jsx)(f,{testId:`start-conversation-button`,type:`button`,variant:`primary`,onClick:j,isDisabled:n||!x,className:`px-4`,children:a(n?o.LAUNCH$STARTING:o.LAUNCH$START_CONVERSATION)})})]})]})})}function w(e){if(e)return e.replace(/<[^>]*>/g,``).slice(0,500)||void 0}function T(e){let t=e.get(`plugins`);if(t)try{let n=atob(t),r=JSON.parse(n);if(!Array.isArray(r))return{plugins:[],error:`invalid_format`};let i=[];for(let e of r){if(typeof e!=`object`||!e||typeof e.source!=`string`)return{plugins:[],error:`invalid_format`};i.push({source:e.source,ref:e.ref??null,repo_path:e.repo_path??null,parameters:e.parameters??null})}return i.length===0?{plugins:[],error:`no_plugins`}:{plugins:i,message:w(e.get(`message`))}}catch{return{plugins:[],error:`invalid_format`}}let n=e.get(`plugin_source`);return n?{plugins:[{source:n,ref:e.get(`plugin_ref`)??null,repo_path:e.get(`plugin_repo_path`)??null,parameters:null}],message:w(e.get(`message`))}:{plugins:[],error:`no_plugins`}}function E({errorType:e,onGoHome:t,onTryAgain:n}){let{t:r}=s(`openhands`),i={no_plugins:r(o.LAUNCH$ERROR_NO_PLUGINS),invalid_format:r(o.LAUNCH$ERROR_INVALID_FORMAT),creation_failed:r(o.LAUNCH$ERROR_CREATION_FAILED)};return(0,b.jsx)(`div`,{className:`flex h-full items-center justify-center`,"data-testid":`launch-error`,children:(0,b.jsxs)(`div`,{className:`max-w-md rounded-lg bg-[var(--oh-surface)] p-6 text-center`,children:[(0,b.jsx)(`h2`,{className:`mb-4 text-xl font-medium text-red-400`,children:r(o.LAUNCH$ERROR_TITLE)}),(0,b.jsx)(`p`,{className:`mb-6 text-[var(--oh-text-tertiary)]`,children:i[e]}),(0,b.jsxs)(`div`,{className:`flex justify-center gap-3`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md bg-tertiary px-4 py-2 text-sm text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`go-home-button`,children:r(o.LAUNCH$GO_HOME)}),n&&(0,b.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md bg-blue-600 px-4 py-2 text-sm text-white hover:bg-blue-700`,"data-testid":`try-again-button`,children:r(o.LAUNCH$TRY_AGAIN)})]})]})})}var D=r(function(){let[e]=n(),t=i(),{t:r}=s(`openhands`),a=h(),[c,l]=y.useState(null),u=y.useMemo(()=>T(e),[e]),d=async(e,n)=>{l(null);try{t(`/conversations/${(await a.mutateAsync({plugins:e,query:n})).conversation_id}`)}catch{l(r(o.LAUNCH$ERROR_CREATION_UNKNOWN))}},f=()=>{t(`/conversations`)};return u.error?(0,b.jsx)(E,{errorType:u.error,onGoHome:f}):c?(0,b.jsx)(E,{errorType:`creation_failed`,onGoHome:f,onTryAgain:()=>{l(null),window.location.reload()}}):(0,b.jsx)(`div`,{className:`h-full`,"data-testid":`launch-route`,children:(0,b.jsx)(C,{plugins:u.plugins,message:u.message,isLoading:a.isPending,onStartConversation:d,onClose:f})})});export{D as default};