@openhands/agent-canvas 1.0.0-beta.4 → 1.0.0-beta.6
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.
- package/README.md +2 -2
- package/build/assets/{automations-list-rMki-8au.js → automations-list-6FDbI5dc.js} +1 -1
- package/build/assets/{home-XxBpNOVq.js → home-e-egNUXZ.js} +1 -1
- package/build/assets/install-server-modal-DHlbgqVH.js +1 -0
- package/build/assets/{manifest-a1d22045.js → manifest-3bf30d69.js} +1 -1
- package/build/assets/{mcp-D2onbwVk.js → mcp-ByeBfdfU.js} +1 -1
- package/build/assets/{recommended-automations-launcher-BQChv2rc.js → recommended-automations-launcher-CgV8FyPK.js} +1 -1
- package/build/assets/{root-35yk2E_M.js → root-dNntxffj.js} +1 -1
- package/build/assets/vendor~home~mcp~automations-list-Cs-TO3fK.js +1 -0
- package/build/index.html +3 -3
- package/dist/components/features/mcp-page/install-server-modal.cjs +1 -1
- package/dist/components/features/mcp-page/install-server-modal.cjs.map +1 -1
- package/dist/components/features/mcp-page/install-server-modal.js +92 -81
- package/dist/components/features/mcp-page/install-server-modal.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/airtable.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/airtable.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/airtable.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/airtable.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/apify.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/apify.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/apify.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/apify.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/brave-search.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/brave-search.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/brave-search.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/brave-search.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/clickhouse.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/clickhouse.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/clickhouse.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/clickhouse.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/elevenlabs.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/elevenlabs.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/elevenlabs.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/elevenlabs.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/exa.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/exa.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/exa.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/exa.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/figma.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/figma.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/figma.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/figma.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/firecrawl.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/firecrawl.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/firecrawl.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/firecrawl.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/github.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/github.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/github.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/github.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/kagi.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/kagi.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/kagi.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/kagi.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/mongodb.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/mongodb.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/mongodb.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/mongodb.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/neon.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/neon.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/neon.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/neon.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/notion.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/notion.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/notion.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/notion.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/obsidian.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/obsidian.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/obsidian.js +2 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/obsidian.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/redis.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/redis.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/redis.js +2 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/redis.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/resend.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/resend.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/resend.js +3 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/resend.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/slack.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/slack.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/slack.js +8 -7
- package/dist/node_modules/@openhands/extensions/integrations/catalog/slack.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/supabase.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/supabase.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/supabase.js +2 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/supabase.js.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/tavily.cjs +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/tavily.cjs.map +1 -1
- package/dist/node_modules/@openhands/extensions/integrations/catalog/tavily.js +4 -2
- package/dist/node_modules/@openhands/extensions/integrations/catalog/tavily.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/package.json +2 -2
- package/build/assets/install-server-modal-f31_CLrW.js +0 -1
- package/build/assets/vendor~home~mcp~automations-list-Ccy2I0KU.js +0 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ agent-canvas
|
|
|
61
61
|
### Option 2: With a Docker Sandbox
|
|
62
62
|
|
|
63
63
|
```sh
|
|
64
|
-
docker pull ghcr.io/openhands/agent-canvas:1.0.0-beta.
|
|
64
|
+
docker pull ghcr.io/openhands/agent-canvas:1.0.0-beta.6
|
|
65
65
|
|
|
66
66
|
export PROJECTS_PATH=~/projects # directory containing your project folders
|
|
67
67
|
|
|
@@ -69,7 +69,7 @@ docker run -it --rm \
|
|
|
69
69
|
-p 8000:8000 \
|
|
70
70
|
-v ~/.openhands:/home/openhands/.openhands \
|
|
71
71
|
-v ${PROJECTS_PATH}:/projects \
|
|
72
|
-
ghcr.io/openhands/agent-canvas:1.0.0-beta.
|
|
72
|
+
ghcr.io/openhands/agent-canvas:1.0.0-beta.6
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
The agent will be able to access any project under `PROJECTS_PATH`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{L as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~cnj3raoq-DTEXlLSB.js";import{t as r}from"./react-dom-hVBnwgwZ.js";import{o as i,t as a}from"./declaration-BNMqORFE.js";import{t as o}from"./Trans-Cvm_-SMi.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{t as c}from"./createLucideIcon-Ddu8jDOQ.js";import{t as l}from"./check-CYxAHs85.js";import{n as u,r as d}from"./custom-toast-handlers-C-SZFmto.js";import{a as f,c as p,i as m,o as h,r as g,s as _}from"./circle-plus-check-toggle-P7ZZToV4.js";import{t as v}from"./utils-i18rdUj2.js";import{n as ee}from"./active-backend-context-cCM1vYYZ.js";import{t as y}from"./modal-backdrop-BAbgYsqB.js";import{t as b}from"./brand-button-Br7f0kZJ.js";import{n as x}from"./navigation-context-D0YWpT8d.js";import{t as S}from"./styled-tooltip-CBzrri6o.js";import{n as te}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-D9P8e98a.js";import{t as C}from"./modal-close-button-t1Gh3qmL.js";import{n as w,t as T}from"./context-menu-list-item-CWNFpuiC.js";import{t as E}from"./u-edit-CFvXHqZk.js";import{t as D}from"./folder-ZZJVGgd7.js";import{t as O}from"./search-27Owlc3A.js";import{n as k,t as ne}from"./recommended-automations-launcher-BQChv2rc.js";import{n as A}from"./skill-card-pill-row-DF1axQCG.js";import{t as j}from"./clock-BRjCgHTc.js";import{n as M,t as N}from"./use-launch-skill-in-chat-fNN_xGZG.js";import{_ as re,c as P,d as F,f as I,g as ie,h as ae,i as oe,l as L,m as se,n as ce,o as R,p as le,r as ue,s as z,t as de,u as B}from"./edit-automation-modal-BGzR3nfZ.js";var fe=c(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),V=c(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),pe=c(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),H=e(t()),U=i();function me({value:e,onChange:t,className:n}){let{t:r}=s(`openhands`);return(0,U.jsxs)(`div`,{className:v(`relative flex min-w-0 flex-1 items-center`,`h-9 rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`,n),children:[(0,U.jsx)(O,{className:`ml-3 size-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,U.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),"aria-label":r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),className:`min-w-0 flex-1 border-0 bg-transparent px-3 text-sm text-white outline-none placeholder:text-tertiary-alt`})]})}var W=e=>(0,U.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,U.jsx)(`g`,{clipPath:`url(#clip0_8467_30872)`,children:(0,U.jsx)(`path`,{d:`M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z`,fill:`currentColor`,stroke:`currentColor`})}),(0,U.jsx)(`defs`,{children:(0,U.jsx)(`clipPath`,{id:`clip0_8467_30872`,children:(0,U.jsx)(`rect`,{width:24,height:24,fill:`white`})})})]});function G(e,t){let n=[];return e.repository&&n.push({id:`repository`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(D,{className:`size-3 shrink-0`}),e.repository]})}),n.push({id:`schedule`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(j,{className:`size-3 shrink-0`}),t]})}),e.model&&n.push({id:`model`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(P,{className:`size-3 shrink-0`}),e.model]})}),n}function K({automation:e,t,canManage:n,onRunNow:r,isRunPending:i,onView:o,onEdit:s,onToggle:c,onDelete:l}){return[...n?[{label:t(a.AUTOMATIONS$RUN_NOW),icon:(0,U.jsx)(W,{className:`size-4`}),onClick:()=>r(e.id),disabled:i||!e.enabled}]:[],{label:t(a.COMMON$VIEW),icon:(0,U.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),onClick:o},...n&&s?[{label:t(a.AUTOMATIONS$EDIT),icon:(0,U.jsx)(E,{className:`size-4`}),onClick:()=>s(e.id)}]:[],...n?[{label:e.enabled?t(a.AUTOMATIONS$TURN_OFF):t(a.AUTOMATIONS$TURN_ON),icon:(0,U.jsx)(z,{className:`size-4`}),onClick:()=>c(e.id,e.enabled)},{label:t(a.AUTOMATIONS$DELETE),icon:(0,U.jsx)(R,{className:`size-4`}),onClick:()=>l(e.id)}]:[]]}function he({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:c}=x(),{t:l}=s(`openhands`),u=L(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,p=(0,H.useMemo)(()=>G(e,d),[e,d]),m=()=>{c?.(`/automations/${e.id}`)},h=K({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:m,onEdit:o,onToggle:t,onDelete:i}),g=()=>{m()};return(0,U.jsxs)(`div`,{role:`link`,tabIndex:0,"data-testid":`automation-card-${e.id}`,onClick:g,onKeyDown:e=>{e.key===`Enter`&&g()},className:v(`flex min-w-0 flex-col gap-3 overflow-hidden p-4 text-left`,_,f),children:[(0,U.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-white`,children:e.name}),e.prompt?(0,U.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-tertiary-light`,children:e.prompt}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[u?(0,U.jsxs)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:I,children:[(0,U.jsx)(W,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),l(a.AUTOMATIONS$RUN_NOW)]}):null,(0,U.jsx)(B,{items:h})]})]}),p.length>0?(0,U.jsx)(A,{pills:p,testId:`automation-pills-${e.id}`}):null]})}var ge=`overflow-hidden rounded-md border border-[var(--oh-border)] bg-base-secondary`,q=[`h-11`,`border-t border-[var(--oh-border)] transition-colors`].join(` `),_e=`hover:bg-interactive-hover-low outline-none focus:outline-none focus-visible:outline-none focus-visible:bg-interactive-hover-low`,J=`px-3 align-middle`,ve=[q,_e,`cursor-pointer`].join(` `),ye=`openhands-automations-view`;function be(){return typeof window>`u`?`grid`:window.localStorage.getItem(`openhands-automations-view`)===`list`?`list`:`grid`}function xe(e){window.localStorage.setItem(ye,e)}function Se({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:c}=x(),{t:l}=s(`openhands`),u=L(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,H.useMemo)(()=>G(e,d),[e,d]),p=()=>{c?.(`/automations/${e.id}`)},m=K({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:o,onToggle:t,onDelete:i}),h=()=>{p()};return(0,U.jsxs)(`tr`,{"data-testid":`automation-list-row-${e.id}`,onClick:h,onKeyDown:e=>{e.key===`Enter`&&h()},tabIndex:0,className:v(ve,`cursor-pointer`),children:[(0,U.jsx)(`td`,{className:J,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-sm font-medium text-white`,title:e.name,children:e.name}),f.length>0?(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(A,{pills:f,testId:`automation-pills-${e.id}`})}):null]})}),(0,U.jsx)(`td`,{className:v(`w-0 whitespace-nowrap`,J),children:(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[u?(0,U.jsx)(S,{content:l(a.AUTOMATIONS$RUN_NOW),placement:`top`,children:(0,U.jsx)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-label":l(a.AUTOMATIONS$RUN_NOW),"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:F,children:(0,U.jsx)(W,{className:`size-4 shrink-0`,"aria-hidden":!0})})}):null,(0,U.jsx)(B,{items:m})]})})]})}function Y({title:e,count:t,automations:n,view:r,onToggle:i,onRunNow:a,runPendingId:o=null,onDelete:s,onEdit:c}){return n.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e}),(0,U.jsx)(k,{count:t})]}),r===`grid`?(0,U.jsx)(`div`,{className:v(`mt-3`,m),children:(0,U.jsx)(`div`,{className:g,children:n.map(e=>(0,U.jsx)(he,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})}):(0,U.jsx)(`div`,{className:v(ge,`mt-3`),children:(0,U.jsx)(`table`,{className:`w-full min-w-full [&>tbody>tr:first-child]:border-t-0`,children:(0,U.jsx)(`tbody`,{children:n.map(e=>(0,U.jsx)(Se,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})})})]})}var Ce=e(r(),1),X=[{value:`grid`,icon:V,labelKey:a.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:pe,labelKey:a.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function we({icon:e,label:t,isSelected:n}){return(0,U.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)] transition-colors group-hover:text-[var(--oh-foreground)] group-focus-visible:text-[var(--oh-foreground)] [&_svg]:size-4 [&_svg]:text-current`,"aria-hidden":!0,children:(0,U.jsx)(e,{})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,U.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}function Te({view:e,onChange:t,disabled:n=!1}){let{t:r}=s(`openhands`),[i,o]=(0,H.useState)(!1),[c,l]=(0,H.useState)(),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(X.find(t=>t.value===e)??X[0]).icon;(0,H.useLayoutEffect)(()=>{if(!i||!u.current)return;let e=()=>{let e=u.current?.getBoundingClientRect();e&&l({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[i]),(0,H.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;u.current?.contains(t)||d.current?.contains(t)||o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let p=i&&c?(0,U.jsx)(w,{ref:d,theme:`popover`,className:`min-w-[10rem]`,children:X.map(n=>(0,U.jsx)(`li`,{children:(0,U.jsx)(T,{testId:n.testId,onClick:()=>{t(n.value),o(!1)},className:`group`,children:(0,U.jsx)(we,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{ref:u,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(a.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||o(e=>!e)},className:v(`inline-flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-[var(--oh-border)] bg-base-secondary text-white transition-colors hover:bg-[var(--oh-interactive-hover)] focus-visible:border-white/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-base-secondary`),children:(0,U.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),i&&c&&typeof document<`u`?Ce.createPortal((0,U.jsx)(`div`,{style:c,children:p}),document.body):null]})}function Z(){return(0,U.jsxs)(`div`,{"data-testid":`automation-card-skeleton`,className:`${_} border border-transparent p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,U.jsx)(`div`,{className:`h-5 w-40 animate-pulse rounded bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-5 w-10 animate-pulse rounded-full bg-surface-raised`})]}),(0,U.jsx)(`div`,{className:`mt-2 h-4 w-72 animate-pulse rounded bg-surface-raised`}),(0,U.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,U.jsx)(`div`,{className:`h-7 w-32 animate-pulse rounded-full bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-7 w-28 animate-pulse rounded-full bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-7 w-24 animate-pulse rounded-full bg-surface-raised`})]})]})}var Ee=e=>(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,U.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m19.5 8.25-7.5 7.5-7.5-7.5`})}),De=`https://docs.openhands.dev/openhands/usage/automations/overview`;function Oe({children:e}){return(0,U.jsx)(`span`,{className:`whitespace-nowrap`,children:e})}function ke({children:e}){return(0,U.jsx)(`code`,{"data-testid":`automations-create-instructions-example`,className:v(`mx-0.5 inline-block rounded-sm border border-[var(--oh-border-subtle)]`,`bg-[var(--oh-surface-raised)] px-1.5 py-0.5 align-baseline font-mono text-[11px] text-white`),children:e})}function Ae({children:e}){return(0,U.jsx)(U.Fragment,{children:e})}var je={example:(0,U.jsx)(Oe,{}),cmd:(0,U.jsx)(ke,{}),punct:(0,U.jsx)(Ae,{})};function Q({onLaunch:e}={}){let{t}=s(`openhands`),n=N();return(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[(0,U.jsx)(o,{ns:`openhands`,i18nKey:a.AUTOMATIONS$EMPTY_OPTION_CONVERSATION_DESC,components:je}),` `,t(a.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsx)(`a`,{href:De,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted underline transition-colors hover:text-foreground`,children:t(a.AUTOMATIONS$EMPTY_LEARN_MORE)}),(0,U.jsx)(b,{type:`button`,variant:`primary`,testId:`automations-create-automation`,onClick:()=>{n(t(a.AUTOMATIONS$CREATE_AUTOMATION_PROMPT),e)},startContent:(0,U.jsx)(M,{className:`size-4`,"aria-hidden":!0}),children:t(a.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})]})]})}function Me({collapsible:e=!1}){let{t}=s(`openhands`),[n,r]=(0,H.useState)(!e);return e?(0,U.jsxs)(`div`,{className:`w-full rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`flex w-full items-center justify-between rounded-lg p-4 text-left transition-colors hover:bg-surface-raised`,children:[(0,U.jsx)(`span`,{className:`text-sm font-normal text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,U.jsx)(Ee,{className:v(`size-5 text-muted transition-transform`,n&&`rotate-180`)})]}),n?(0,U.jsx)(`div`,{className:`px-4 pb-4`,children:(0,U.jsx)(Q,{})}):null]}):(0,U.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[(0,U.jsx)(`h3`,{className:`text-center text-sm font-medium text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,U.jsx)(`div`,{className:`mt-4`,children:(0,U.jsx)(Q,{})})]})}function Ne(){let{t:e}=s(`openhands`);return(0,U.jsxs)(`div`,{"data-testid":`automations-empty`,className:p,children:[(0,U.jsx)(`p`,{className:`text-sm text-white`,children:e(a.AUTOMATIONS$EMPTY)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-tertiary-light`,children:e(a.AUTOMATIONS$EMPTY_HINT)}),(0,U.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,U.jsx)(Me,{})})]})}function Pe({isOpen:e,onClose:t}){let{t:n}=s(`openhands`);return e?(0,U.jsx)(y,{onClose:t,"aria-label":n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE),children:(0,U.jsxs)(`div`,{"data-testid":`add-automation-modal`,className:`relative flex w-full max-w-lg flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,U.jsx)(C,{onClose:t,testId:`add-automation-modal-close`}),(0,U.jsx)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:(0,U.jsx)(`h2`,{id:`add-automation-modal-title`,className:`pr-6 text-lg font-semibold`,children:n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)})}),(0,U.jsx)(`div`,{className:`px-6 pb-6`,children:(0,U.jsx)(Q,{onLaunch:t})})]})}):null}var $=50,Fe=n(function(){let{t:e}=s(`openhands`),[t,n]=(0,H.useState)(``),[r,i]=(0,H.useState)(()=>be()),[o,c]=(0,H.useState)($),[l,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(!1),_=ee().backend.kind===`local`,{data:v,isLoading:y,refetch:x}=le(),S=v?.status===`ok`,{data:C,isLoading:w,isError:T,refetch:E}=se({limit:o,offset:0,enabled:S}),D=re(),O=ae(),k=ie(),A=(0,H.useMemo)(()=>{if(!C?.automations)return[];let e=t.toLowerCase();return e?C.automations.filter(t=>t.name.toLowerCase().includes(e)||(t.prompt??``).toLowerCase().includes(e)||t.repository?.toLowerCase().includes(e)||t.model?.toLowerCase().includes(e)):C.automations},[C?.automations,t]),j=(0,H.useMemo)(()=>A.filter(e=>e.enabled),[A]),M=(0,H.useMemo)(()=>A.filter(e=>!e.enabled),[A]),N=(e,t)=>{D.mutate({id:e,enabled:!t})},P=t=>{k.mutate(t,{onSuccess:()=>{d(e(a.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{u(te(t)?t.response?.data?.message||t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR))}})},F=e=>{let t=C?.automations.find(t=>t.id===e);t&&f({id:e,name:t.name})},I=e=>{let t=C?.automations.find(t=>t.id===e);t&&m(t)},L=()=>{l&&(O.mutate(l.id),f(null))},R=(0,H.useCallback)(e=>{i(e),xe(e)},[]),z=C?C.total>C.automations.length:!1,B=!w&&!T&&C?.automations.length===0;return y?(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,U.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,U.jsx)(Z,{},`skeleton-${String(t)}`))})]})}):S?(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)})]}),(0,U.jsx)(b,{type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`shrink-0 whitespace-nowrap`,onClick:()=>g(!0),children:e(a.AUTOMATIONS$ADD_AUTOMATION)})]}),(0,U.jsxs)(`div`,{className:`mt-6 flex items-stretch gap-2`,children:[(0,U.jsx)(me,{value:t,onChange:n}),(0,U.jsx)(Te,{view:r,onChange:R,disabled:B})]}),(0,U.jsxs)(`div`,{className:`mt-6 flex flex-col gap-6`,children:[w&&(0,U.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,U.jsx)(Z,{},`skeleton-${String(t)}`))}),T&&!w&&(0,U.jsx)(oe,{onRetry:E}),B&&(0,U.jsx)(Ne,{}),!w&&!T&&C&&C.automations.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{title:e(a.AUTOMATIONS$ACTIVE),count:j.length,automations:j,view:r,onToggle:N,onRunNow:P,runPendingId:k.isPending?k.variables??null:null,onDelete:F,onEdit:_?I:void 0}),(0,U.jsx)(Y,{title:e(a.AUTOMATIONS$INACTIVE),count:M.length,automations:M,view:r,onToggle:N,onRunNow:P,runPendingId:k.isPending?k.variables??null:null,onDelete:F,onEdit:_?I:void 0}),z&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>c(e=>e+$),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(a.AUTOMATIONS$LOAD_MORE)})]})]}),(0,U.jsx)(`div`,{className:`mt-6`,children:(0,U.jsx)(ne,{query:t})}),(0,U.jsx)(ce,{automationName:l?.name??``,isOpen:l!==null,onConfirm:L,onCancel:()=>f(null)}),p&&(0,U.jsx)(de,{automation:p,isOpen:p!==null,onClose:()=>m(null)}),(0,U.jsx)(Pe,{isOpen:h,onClose:()=>g(!1)})]})}):(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,U.jsx)(ue,{onRetry:x})]})})});export{Fe 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{t as r}from"./react-dom-hVBnwgwZ.js";import{o as i,t as a}from"./declaration-BNMqORFE.js";import{t as o}from"./Trans-Cvm_-SMi.js";import{t as s}from"./useTranslation-DCOdSSMl.js";import{t as c}from"./createLucideIcon-Ddu8jDOQ.js";import{t as l}from"./check-CYxAHs85.js";import{n as u,r as d}from"./custom-toast-handlers-C-SZFmto.js";import{a as f,c as p,i as m,o as h,r as g,s as _}from"./circle-plus-check-toggle-P7ZZToV4.js";import{t as v}from"./utils-i18rdUj2.js";import{n as ee}from"./active-backend-context-cCM1vYYZ.js";import{t as y}from"./modal-backdrop-BAbgYsqB.js";import{t as b}from"./brand-button-Br7f0kZJ.js";import{n as x}from"./navigation-context-D0YWpT8d.js";import{t as S}from"./styled-tooltip-CBzrri6o.js";import{n as te}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~ninslayh-D9P8e98a.js";import{t as C}from"./modal-close-button-t1Gh3qmL.js";import{n as w,t as T}from"./context-menu-list-item-CWNFpuiC.js";import{t as E}from"./u-edit-CFvXHqZk.js";import{t as D}from"./folder-ZZJVGgd7.js";import{t as O}from"./search-27Owlc3A.js";import{n as k,t as ne}from"./recommended-automations-launcher-CgV8FyPK.js";import{n as A}from"./skill-card-pill-row-DF1axQCG.js";import{t as j}from"./clock-BRjCgHTc.js";import{n as M,t as N}from"./use-launch-skill-in-chat-fNN_xGZG.js";import{_ as re,c as P,d as F,f as I,g as ie,h as ae,i as oe,l as L,m as se,n as ce,o as R,p as le,r as ue,s as z,t as de,u as B}from"./edit-automation-modal-BGzR3nfZ.js";var fe=c(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),V=c(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),pe=c(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),H=e(t()),U=i();function me({value:e,onChange:t,className:n}){let{t:r}=s(`openhands`);return(0,U.jsxs)(`div`,{className:v(`relative flex min-w-0 flex-1 items-center`,`h-9 rounded-lg border border-[var(--oh-border)] bg-base-secondary`,`focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20`,`transition-colors`,n),children:[(0,U.jsx)(O,{className:`ml-3 size-4 shrink-0 text-tertiary-alt`,"aria-hidden":!0}),(0,U.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),"aria-label":r(a.AUTOMATIONS$SEARCH_PLACEHOLDER),className:`min-w-0 flex-1 border-0 bg-transparent px-3 text-sm text-white outline-none placeholder:text-tertiary-alt`})]})}var W=e=>(0,U.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,U.jsx)(`g`,{clipPath:`url(#clip0_8467_30872)`,children:(0,U.jsx)(`path`,{d:`M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z`,fill:`currentColor`,stroke:`currentColor`})}),(0,U.jsx)(`defs`,{children:(0,U.jsx)(`clipPath`,{id:`clip0_8467_30872`,children:(0,U.jsx)(`rect`,{width:24,height:24,fill:`white`})})})]});function G(e,t){let n=[];return e.repository&&n.push({id:`repository`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(D,{className:`size-3 shrink-0`}),e.repository]})}),n.push({id:`schedule`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(j,{className:`size-3 shrink-0`}),t]})}),e.model&&n.push({id:`model`,node:(0,U.jsxs)(`span`,{className:v(h,`gap-1`),children:[(0,U.jsx)(P,{className:`size-3 shrink-0`}),e.model]})}),n}function K({automation:e,t,canManage:n,onRunNow:r,isRunPending:i,onView:o,onEdit:s,onToggle:c,onDelete:l}){return[...n?[{label:t(a.AUTOMATIONS$RUN_NOW),icon:(0,U.jsx)(W,{className:`size-4`}),onClick:()=>r(e.id),disabled:i||!e.enabled}]:[],{label:t(a.COMMON$VIEW),icon:(0,U.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),onClick:o},...n&&s?[{label:t(a.AUTOMATIONS$EDIT),icon:(0,U.jsx)(E,{className:`size-4`}),onClick:()=>s(e.id)}]:[],...n?[{label:e.enabled?t(a.AUTOMATIONS$TURN_OFF):t(a.AUTOMATIONS$TURN_ON),icon:(0,U.jsx)(z,{className:`size-4`}),onClick:()=>c(e.id,e.enabled)},{label:t(a.AUTOMATIONS$DELETE),icon:(0,U.jsx)(R,{className:`size-4`}),onClick:()=>l(e.id)}]:[]]}function he({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:c}=x(),{t:l}=s(`openhands`),u=L(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,p=(0,H.useMemo)(()=>G(e,d),[e,d]),m=()=>{c?.(`/automations/${e.id}`)},h=K({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:m,onEdit:o,onToggle:t,onDelete:i}),g=()=>{m()};return(0,U.jsxs)(`div`,{role:`link`,tabIndex:0,"data-testid":`automation-card-${e.id}`,onClick:g,onKeyDown:e=>{e.key===`Enter`&&g()},className:v(`flex min-w-0 flex-col gap-3 overflow-hidden p-4 text-left`,_,f),children:[(0,U.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-white`,children:e.name}),e.prompt?(0,U.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-tertiary-light`,children:e.prompt}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[u?(0,U.jsxs)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:I,children:[(0,U.jsx)(W,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),l(a.AUTOMATIONS$RUN_NOW)]}):null,(0,U.jsx)(B,{items:h})]})]}),p.length>0?(0,U.jsx)(A,{pills:p,testId:`automation-pills-${e.id}`}):null]})}var ge=`overflow-hidden rounded-md border border-[var(--oh-border)] bg-base-secondary`,q=[`h-11`,`border-t border-[var(--oh-border)] transition-colors`].join(` `),_e=`hover:bg-interactive-hover-low outline-none focus:outline-none focus-visible:outline-none focus-visible:bg-interactive-hover-low`,J=`px-3 align-middle`,ve=[q,_e,`cursor-pointer`].join(` `),ye=`openhands-automations-view`;function be(){return typeof window>`u`?`grid`:window.localStorage.getItem(`openhands-automations-view`)===`list`?`list`:`grid`}function xe(e){window.localStorage.setItem(ye,e)}function Se({automation:e,onToggle:t,onRunNow:n,isRunPending:r=!1,onDelete:i,onEdit:o}){let{navigate:c}=x(),{t:l}=s(`openhands`),u=L(`manage_automations`),d=e.trigger.schedule_human||e.trigger.type,f=(0,H.useMemo)(()=>G(e,d),[e,d]),p=()=>{c?.(`/automations/${e.id}`)},m=K({automation:e,t:l,canManage:u,onRunNow:n,isRunPending:r,onView:p,onEdit:o,onToggle:t,onDelete:i}),h=()=>{p()};return(0,U.jsxs)(`tr`,{"data-testid":`automation-list-row-${e.id}`,onClick:h,onKeyDown:e=>{e.key===`Enter`&&h()},tabIndex:0,className:v(ve,`cursor-pointer`),children:[(0,U.jsx)(`td`,{className:J,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-sm font-medium text-white`,title:e.name,children:e.name}),f.length>0?(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(A,{pills:f,testId:`automation-pills-${e.id}`})}):null]})}),(0,U.jsx)(`td`,{className:v(`w-0 whitespace-nowrap`,J),children:(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[u?(0,U.jsx)(S,{content:l(a.AUTOMATIONS$RUN_NOW),placement:`top`,children:(0,U.jsx)(`button`,{type:`button`,"data-testid":`automation-run-now-${e.id}`,"aria-label":l(a.AUTOMATIONS$RUN_NOW),"aria-busy":r,disabled:r||!e.enabled,onClick:t=>{t.stopPropagation(),n(e.id)},className:F,children:(0,U.jsx)(W,{className:`size-4 shrink-0`,"aria-hidden":!0})})}):null,(0,U.jsx)(B,{items:m})]})})]})}function Y({title:e,count:t,automations:n,view:r,onToggle:i,onRunNow:a,runPendingId:o=null,onDelete:s,onEdit:c}){return n.length===0?null:(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e}),(0,U.jsx)(k,{count:t})]}),r===`grid`?(0,U.jsx)(`div`,{className:v(`mt-3`,m),children:(0,U.jsx)(`div`,{className:g,children:n.map(e=>(0,U.jsx)(he,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})}):(0,U.jsx)(`div`,{className:v(ge,`mt-3`),children:(0,U.jsx)(`table`,{className:`w-full min-w-full [&>tbody>tr:first-child]:border-t-0`,children:(0,U.jsx)(`tbody`,{children:n.map(e=>(0,U.jsx)(Se,{automation:e,onToggle:i,onRunNow:a,isRunPending:o===e.id,onDelete:s,onEdit:c},e.id))})})})]})}var Ce=e(r(),1),X=[{value:`grid`,icon:V,labelKey:a.AUTOMATIONS$VIEW_GRID,testId:`automations-view-toggle-grid`},{value:`list`,icon:pe,labelKey:a.AUTOMATIONS$VIEW_LIST,testId:`automations-view-toggle-list`}];function we({icon:e,label:t,isSelected:n}){return(0,U.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)] transition-colors group-hover:text-[var(--oh-foreground)] group-focus-visible:text-[var(--oh-foreground)] [&_svg]:size-4 [&_svg]:text-current`,"aria-hidden":!0,children:(0,U.jsx)(e,{})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),n?(0,U.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]})}function Te({view:e,onChange:t,disabled:n=!1}){let{t:r}=s(`openhands`),[i,o]=(0,H.useState)(!1),[c,l]=(0,H.useState)(),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(X.find(t=>t.value===e)??X[0]).icon;(0,H.useLayoutEffect)(()=>{if(!i||!u.current)return;let e=()=>{let e=u.current?.getBoundingClientRect();e&&l({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[i]),(0,H.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;u.current?.contains(t)||d.current?.contains(t)||o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let p=i&&c?(0,U.jsx)(w,{ref:d,theme:`popover`,className:`min-w-[10rem]`,children:X.map(n=>(0,U.jsx)(`li`,{children:(0,U.jsx)(T,{testId:n.testId,onClick:()=>{t(n.value),o(!1)},className:`group`,children:(0,U.jsx)(we,{icon:n.icon,label:r(n.labelKey),isSelected:e===n.value})})},n.value))}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{ref:u,type:`button`,"data-testid":`automations-view-toggle`,"aria-label":r(a.AUTOMATIONS$VIEW_MODE),"aria-haspopup":`menu`,"aria-expanded":i,"aria-disabled":n,disabled:n,onClick:()=>{n||o(e=>!e)},className:v(`inline-flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-[var(--oh-border)] bg-base-secondary text-white transition-colors hover:bg-[var(--oh-interactive-hover)] focus-visible:border-white/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/20`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-base-secondary`),children:(0,U.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),i&&c&&typeof document<`u`?Ce.createPortal((0,U.jsx)(`div`,{style:c,children:p}),document.body):null]})}function Z(){return(0,U.jsxs)(`div`,{"data-testid":`automation-card-skeleton`,className:`${_} border border-transparent p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,U.jsx)(`div`,{className:`h-5 w-40 animate-pulse rounded bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-5 w-10 animate-pulse rounded-full bg-surface-raised`})]}),(0,U.jsx)(`div`,{className:`mt-2 h-4 w-72 animate-pulse rounded bg-surface-raised`}),(0,U.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,U.jsx)(`div`,{className:`h-7 w-32 animate-pulse rounded-full bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-7 w-28 animate-pulse rounded-full bg-surface-raised`}),(0,U.jsx)(`div`,{className:`h-7 w-24 animate-pulse rounded-full bg-surface-raised`})]})]})}var Ee=e=>(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:2,stroke:`currentColor`,...e,children:(0,U.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`m19.5 8.25-7.5 7.5-7.5-7.5`})}),De=`https://docs.openhands.dev/openhands/usage/automations/overview`;function Oe({children:e}){return(0,U.jsx)(`span`,{className:`whitespace-nowrap`,children:e})}function ke({children:e}){return(0,U.jsx)(`code`,{"data-testid":`automations-create-instructions-example`,className:v(`mx-0.5 inline-block rounded-sm border border-[var(--oh-border-subtle)]`,`bg-[var(--oh-surface-raised)] px-1.5 py-0.5 align-baseline font-mono text-[11px] text-white`),children:e})}function Ae({children:e}){return(0,U.jsx)(U.Fragment,{children:e})}var je={example:(0,U.jsx)(Oe,{}),cmd:(0,U.jsx)(ke,{}),punct:(0,U.jsx)(Ae,{})};function Q({onLaunch:e}={}){let{t}=s(`openhands`),n=N();return(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed text-tertiary-light`,children:[(0,U.jsx)(o,{ns:`openhands`,i18nKey:a.AUTOMATIONS$EMPTY_OPTION_CONVERSATION_DESC,components:je}),` `,t(a.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsx)(`a`,{href:De,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-muted underline transition-colors hover:text-foreground`,children:t(a.AUTOMATIONS$EMPTY_LEARN_MORE)}),(0,U.jsx)(b,{type:`button`,variant:`primary`,testId:`automations-create-automation`,onClick:()=>{n(t(a.AUTOMATIONS$CREATE_AUTOMATION_PROMPT),e)},startContent:(0,U.jsx)(M,{className:`size-4`,"aria-hidden":!0}),children:t(a.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)})]})]})}function Me({collapsible:e=!1}){let{t}=s(`openhands`),[n,r]=(0,H.useState)(!e);return e?(0,U.jsxs)(`div`,{className:`w-full rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface)]`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),"aria-expanded":n,className:`flex w-full items-center justify-between rounded-lg p-4 text-left transition-colors hover:bg-surface-raised`,children:[(0,U.jsx)(`span`,{className:`text-sm font-normal text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,U.jsx)(Ee,{className:v(`size-5 text-muted transition-transform`,n&&`rotate-180`)})]}),n?(0,U.jsx)(`div`,{className:`px-4 pb-4`,children:(0,U.jsx)(Q,{})}):null]}):(0,U.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[(0,U.jsx)(`h3`,{className:`text-center text-sm font-medium text-content`,children:t(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}),(0,U.jsx)(`div`,{className:`mt-4`,children:(0,U.jsx)(Q,{})})]})}function Ne(){let{t:e}=s(`openhands`);return(0,U.jsxs)(`div`,{"data-testid":`automations-empty`,className:p,children:[(0,U.jsx)(`p`,{className:`text-sm text-white`,children:e(a.AUTOMATIONS$EMPTY)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-tertiary-light`,children:e(a.AUTOMATIONS$EMPTY_HINT)}),(0,U.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,U.jsx)(Me,{})})]})}function Pe({isOpen:e,onClose:t}){let{t:n}=s(`openhands`);return e?(0,U.jsx)(y,{onClose:t,"aria-label":n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE),children:(0,U.jsxs)(`div`,{"data-testid":`add-automation-modal`,className:`relative flex w-full max-w-lg flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary`,children:[(0,U.jsx)(C,{onClose:t,testId:`add-automation-modal-close`}),(0,U.jsx)(`header`,{className:`flex-shrink-0 px-6 pb-4 pt-6`,children:(0,U.jsx)(`h2`,{id:`add-automation-modal-title`,className:`pr-6 text-lg font-semibold`,children:n(a.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)})}),(0,U.jsx)(`div`,{className:`px-6 pb-6`,children:(0,U.jsx)(Q,{onLaunch:t})})]})}):null}var $=50,Fe=n(function(){let{t:e}=s(`openhands`),[t,n]=(0,H.useState)(``),[r,i]=(0,H.useState)(()=>be()),[o,c]=(0,H.useState)($),[l,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(!1),_=ee().backend.kind===`local`,{data:v,isLoading:y,refetch:x}=le(),S=v?.status===`ok`,{data:C,isLoading:w,isError:T,refetch:E}=se({limit:o,offset:0,enabled:S}),D=re(),O=ae(),k=ie(),A=(0,H.useMemo)(()=>{if(!C?.automations)return[];let e=t.toLowerCase();return e?C.automations.filter(t=>t.name.toLowerCase().includes(e)||(t.prompt??``).toLowerCase().includes(e)||t.repository?.toLowerCase().includes(e)||t.model?.toLowerCase().includes(e)):C.automations},[C?.automations,t]),j=(0,H.useMemo)(()=>A.filter(e=>e.enabled),[A]),M=(0,H.useMemo)(()=>A.filter(e=>!e.enabled),[A]),N=(e,t)=>{D.mutate({id:e,enabled:!t})},P=t=>{k.mutate(t,{onSuccess:()=>{d(e(a.AUTOMATIONS$RUN_NOW_SUCCESS))},onError:t=>{u(te(t)?t.response?.data?.message||t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR):t.message||e(a.AUTOMATIONS$RUN_NOW_ERROR))}})},F=e=>{let t=C?.automations.find(t=>t.id===e);t&&f({id:e,name:t.name})},I=e=>{let t=C?.automations.find(t=>t.id===e);t&&m(t)},L=()=>{l&&(O.mutate(l.id),f(null))},R=(0,H.useCallback)(e=>{i(e),xe(e)},[]),z=C?C.total>C.automations.length:!1,B=!w&&!T&&C?.automations.length===0;return y?(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,U.jsx)(`div`,{className:`mt-6 flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,U.jsx)(Z,{},`skeleton-${String(t)}`))})]})}):S?(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-semibold text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)})]}),(0,U.jsx)(b,{type:`button`,variant:`secondary`,testId:`automations-add-automation`,className:`shrink-0 whitespace-nowrap`,onClick:()=>g(!0),children:e(a.AUTOMATIONS$ADD_AUTOMATION)})]}),(0,U.jsxs)(`div`,{className:`mt-6 flex items-stretch gap-2`,children:[(0,U.jsx)(me,{value:t,onChange:n}),(0,U.jsx)(Te,{view:r,onChange:R,disabled:B})]}),(0,U.jsxs)(`div`,{className:`mt-6 flex flex-col gap-6`,children:[w&&(0,U.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:3}).map((e,t)=>(0,U.jsx)(Z,{},`skeleton-${String(t)}`))}),T&&!w&&(0,U.jsx)(oe,{onRetry:E}),B&&(0,U.jsx)(Ne,{}),!w&&!T&&C&&C.automations.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{title:e(a.AUTOMATIONS$ACTIVE),count:j.length,automations:j,view:r,onToggle:N,onRunNow:P,runPendingId:k.isPending?k.variables??null:null,onDelete:F,onEdit:_?I:void 0}),(0,U.jsx)(Y,{title:e(a.AUTOMATIONS$INACTIVE),count:M.length,automations:M,view:r,onToggle:N,onRunNow:P,runPendingId:k.isPending?k.variables??null:null,onDelete:F,onEdit:_?I:void 0}),z&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>c(e=>e+$),className:`self-center rounded-lg border border-[var(--oh-border)] px-6 py-2 text-sm text-white hover:bg-surface-raised`,children:e(a.AUTOMATIONS$LOAD_MORE)})]})]}),(0,U.jsx)(`div`,{className:`mt-6`,children:(0,U.jsx)(ne,{query:t})}),(0,U.jsx)(ce,{automationName:l?.name??``,isOpen:l!==null,onConfirm:L,onCancel:()=>f(null)}),p&&(0,U.jsx)(de,{automation:p,isOpen:p!==null,onClose:()=>m(null)}),(0,U.jsx)(Pe,{isOpen:h,onClose:()=>g(!1)})]})}):(0,U.jsx)(`div`,{className:`min-h-full`,children:(0,U.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-medium text-content`,children:e(a.AUTOMATIONS$TITLE)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:e(a.AUTOMATIONS$SUBTITLE)}),(0,U.jsx)(ue,{onRetry:x})]})})});export{Fe as default};
|
|
@@ -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-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
|
+
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-CgV8FyPK.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{t}from"./react-CM_dJw1Z.js";import{t as n}from"./useMutation-DqrumCWD.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"./useTranslation-DCOdSSMl.js";import{t as s}from"./retrieve-axios-error-message-BY-yIkIq.js";import{n as c,t as l}from"./vendor~home~mcp~automations-list-Cs-TO3fK.js";import{r as u}from"./custom-toast-handlers-C-SZFmto.js";import{t as d}from"./utils-i18rdUj2.js";import{t as f}from"./agent-server-client-options-Bc5ZorQZ.js";import{l as p}from"./vendor~root-layout~home~conversation-panel~conversation~launch~extensions-hub~skills-settin~dp08i1qy-DTwbEEcX.js";import{a as m}from"./query-keys-tAsQcc_9.js";import{t as h}from"./modal-backdrop-BAbgYsqB.js";import{t as g}from"./brand-button-Br7f0kZJ.js";import{t as _}from"./modal-close-button-t1Gh3qmL.js";import{t as v}from"./settings-input-Bn7F5C75.js";import{t as y}from"./v4-CNn21NXa.js";import{t as b}from"./settings-service.api-CZ3uWx4v.js";import{a as x,i as S,r as C}from"./use-settings-DQIZmIov.js";function w(e){return[...e.sse_servers.map((e,t)=>({id:`sse-${t}`,type:`sse`,url:typeof e==`string`?e:e.url,api_key:typeof e==`object`?e.api_key:void 0})),...e.stdio_servers.map((e,t)=>({id:`stdio-${t}`,type:`stdio`,name:e.name,command:e.command,args:e.args,env:e.env})),...e.shttp_servers.map((e,t)=>({id:`shttp-${t}`,type:`shttp`,url:typeof e==`string`?e:e.url,api_key:typeof e==`object`?e.api_key:void 0,timeout:typeof e==`object`?e.timeout:void 0}))]}var T=e(t(),1),E=r();function D(e){return e.connectionOptions.filter(e=>e.provider===`mcp`&&!!e.transport)}function O(e){let t=D(e);return t.find(t=>t.id===e.defaultConnectionOptionId)??t[0]}function k(e){return e.auth.strategy!==`oauth2`}function A(e){let t=D(e),n=t.find(t=>t.id===e.defaultConnectionOptionId);return n&&k(n)?n:t.find(k)}function j(e){return O(e)?.transport}function M(e){return e.filter(e=>!!O(e))}var N=e=>{try{return new URL(e)}catch{return null}};function P(e,t){let n=typeof e==`string`?e:``,r=typeof t==`string`?t:``;if(!n||!r)return!1;let i=N(n),a=N(r);return!i||!a?n.replace(/\/+$/,``)===r.replace(/\/+$/,``):i.protocol===a.protocol&&i.host===a.host&&i.pathname.replace(/\/+$/,``)===a.pathname.replace(/\/+$/,``)}function F(e,t){return t.find(t=>L(e,t))??null}function I(e,t){for(let n of D(e)){let e=F(n.transport,t);if(e)return e}return null}function L(e,t){if(e.kind===`shttp`){let n=e.url;return t.type===`shttp`&&!!t.url&&P(t.url,n)}if(e.kind===`sse`){let n=e.url;return t.type===`sse`&&!!t.url&&P(t.url,n)}return t.type===`stdio`&&t.name===e.serverName}function R(e,t){return!e.runtimeAvailability||e.runtimeAvailability===`all`?!0:e.runtimeAvailability===t}function z(e){return e.trim().toLowerCase()}function B(e){return e.map((e,t)=>({entry:e,index:t})).sort((e,t)=>(t.entry.popularityRank??0)-(e.entry.popularityRank??0)||e.index-t.index).map(({entry:e})=>e)}function V(e,t){return t.find(t=>t.id===e)}function H(e,t){let n=z(t);return n?[e.name,e.description,e.id,...e.keywords??[]].join(` `).toLowerCase().includes(n):!0}function U(e,t,n){let r=z(n);return r?[e.type,`name`in e?e.name:void 0,`command`in e?e.command:void 0,`args`in e?e.args?.join(` `):void 0,`url`in e?e.url:void 0,t?.name,t?.description,t?.id,...t?.keywords??[]].filter(Boolean).join(` `).toLowerCase().includes(r):!0}function W(e,t){return t.find(t=>D(t).some(t=>L(t.transport,e)))}var G={xs:`h-4 w-4 rounded [&>svg]:h-2.5 [&>svg]:w-2.5`,sm:`h-5 w-5 rounded-md [&>svg]:h-3 [&>svg]:w-3`,md:`h-10 w-10 rounded-lg [&>svg]:h-5 [&>svg]:w-5`};function K({entry:e,size:t=`md`,className:n,fallback:r,testId:i}){return(0,E.jsx)(`span`,{"aria-hidden":`true`,title:e?.name,"data-testid":i,className:d(`inline-flex shrink-0 items-center justify-center overflow-hidden`,`border border-white/10 shadow-[inset_0_1px_0_rgba(255,255,255,0.18)]`,G[t],n),style:{backgroundColor:e?.iconBg??`var(--oh-color-tertiary)`,color:e?.iconColor??`#FFFFFF`},children:e?c[e.id]??r??l:r??l})}function q(){let e=a(),{data:t}=C();return n({mutationFn:async e=>{if(!t)return;let n=S(t.agent_settings?.mcp_config),r={sse_servers:[...n.sse_servers],stdio_servers:[...n.stdio_servers],shttp_servers:[...n.shttp_servers]};if(e.type===`sse`){let t={url:e.url,...e.api_key&&{api_key:e.api_key}};r.sse_servers.push(t)}else if(e.type===`stdio`){let t={name:e.name,command:e.command,...e.args&&{args:e.args},...e.env&&{env:e.env}};r.stdio_servers.push(t)}else if(e.type===`shttp`){let t={url:e.url,...e.api_key&&{api_key:e.api_key},...e.timeout!==void 0&&{timeout:e.timeout}};r.shttp_servers.push(t)}await b.saveSettings({agent_settings_diff:{mcp_config:x(r)}})},onSuccess:()=>{e.invalidateQueries({queryKey:m.personal()})}})}function J(e){return e.type===`stdio`?{type:`stdio`,command:e.command,...e.args?.length&&{args:e.args},...e.env&&Object.keys(e.env).length>0&&{env:e.env}}:{type:e.type,url:e.url,...e.api_key?{api_key:e.api_key}:{}}}var Y=class{static async testServer(e){let{host:t,apiKey:n}=f(),r=new p({host:t,...n?{apiKey:n}:{}});try{return await r.testServer({server:J(e),...e.name?{name:e.name}:{},...e.timeout?{timeout:e.timeout}:{}})}finally{r.close()}}};function X(){return n({mutationFn:e=>Y.testServer(e)})}function Z(e){let t=/\[([^\]]+)\]\(([^)]+)\)/g,n=[],r=0;for(let i of e.matchAll(t))i.index>r&&n.push(e.slice(r,i.index)),n.push((0,E.jsx)(`a`,{href:/^https?:\/\//i.test(i[2])?i[2]:`#`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-white transition-colors`,children:i[1]},i.index)),r=i.index+i[0].length;return r<e.length&&n.push(e.slice(r)),n}function Q(e){return e?.transport.kind!==`shttp`&&e?.transport.kind!==`sse`?!1:[`api_key`,`bearer`,`basic`].includes(e.auth.strategy)}function $(e){return e.transport.kind===`stdio`?e.auth.apiKeyOptional??!1:e.auth.apiKeyOptional??e.transport.apiKeyOptional??!1}function ee(e){let t={},n=A(e),r=n?.transport;if(r?.kind===`stdio`){for(let e of r.envFields??[])t[e.key]=``;for(let e of r.argFields??[])t[e.key]=``}else Q(n)&&(t.api_key=``);return{values:t,errors:{}}}function te({entry:e,onClose:t,onSuccess:n}){let{t:r}=o(`openhands`),{mutate:a,isPending:c}=q(),{mutate:l,isPending:d}=X(),[f,p]=T.useState(()=>ee(e)),[m,b]=T.useState(null),x=A(e),S=x?.transport,C=d||c,w=(e,t)=>{p(n=>({values:{...n.values,[e]:t},errors:{...n.errors,[e]:null}})),b(null)},D=e=>{switch(e.error_kind){case`timeout`:return r(i.MCP$TEST_ERROR_TIMEOUT);case`connection`:return r(i.MCP$TEST_ERROR_CONNECTION);default:return r(i.MCP$TEST_ERROR_UNKNOWN,{error:e.error})}},O=o=>{l(o,{onSuccess:c=>{if(!c.ok){b(D(c));return}a(o,{onSuccess:()=>{u(r(i.MCP$INSTALL_SUCCESS)),n?.(e),t()},onError:e=>{b(s(e)||r(i.ERROR$GENERIC))}})},onError:e=>{b(s(e)||r(i.ERROR$GENERIC))}})},k=()=>{if(S?.kind!==`shttp`&&S?.kind!==`sse`||!x)return;let e=f.values.api_key?.trim()??``,t=Q(x);if(t&&!$(x)&&!e){p(e=>({...e,errors:{api_key:r(i.MCP$ERROR_FIELD_REQUIRED)}}));return}O({id:`${S.kind}-${y()}`,type:S.kind,url:S.url,...t&&e&&{api_key:e}})},j=()=>{if(S?.kind!==`stdio`)return;let e=S,t={};for(let n of e.envFields??[])n.required&&!(f.values[n.key]??``).trim()&&(t[n.key]=r(i.MCP$ERROR_FIELD_REQUIRED));for(let n of e.argFields??[])n.required&&!(f.values[n.key]??``).trim()&&(t[n.key]=r(i.MCP$ERROR_FIELD_REQUIRED));if(Object.values(t).some(Boolean)){p(e=>({...e,errors:t}));return}let n={};for(let t of e.envFields??[]){let e=f.values[t.key]?.trim();e&&(n[t.key]=e)}let a=[];for(let t of e.argFields??[]){let e=f.values[t.key]?.trim();if(e)for(let t of e.split(/\s+/))t&&a.push(t)}O({id:`stdio-${y()}`,type:`stdio`,name:e.serverName,command:e.command,args:[...e.args,...a],...Object.keys(n).length>0&&{env:n}})};return(0,E.jsx)(h,{onClose:t,"aria-label":e.name,children:(0,E.jsxs)(`form`,{"data-testid":`mcp-install-modal`,"data-marketplace-id":e.id,onSubmit:e=>(e.preventDefault(),b(null),S?.kind===`shttp`||S?.kind===`sse`?k():j()),className:`relative bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-[var(--oh-border)] w-[520px] max-w-[90vw] max-h-[85vh] overflow-y-auto custom-scrollbar`,children:[(0,E.jsx)(_,{onClose:t,testId:`mcp-install-modal-close`,disabled:C}),(0,E.jsxs)(`div`,{className:`flex items-start gap-3 pr-6`,children:[(0,E.jsx)(K,{entry:e}),(0,E.jsxs)(`div`,{className:`flex flex-col flex-1`,children:[(0,E.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.name}),(0,E.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:e.description})]})]}),e.installHint&&(0,E.jsx)(`p`,{className:`text-xs text-tertiary-light`,children:e.installHint}),e.docsUrl&&(0,E.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-xs text-[var(--oh-muted)] hover:text-white hover:underline self-start transition-colors`,children:r(i.MCP$VIEW_DOCS)}),(0,E.jsx)(`div`,{className:`flex flex-col gap-3`,children:(()=>{if(S?.kind===`shttp`||S?.kind===`sse`){let e=Q(x),t=x?$(x):!1;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v,{testId:`mcp-install-field-url`,name:`url`,type:`url`,label:r(i.SETTINGS$MCP_URL),value:S.url,onChange:()=>{},isDisabled:!0,className:`w-full`}),e?(0,E.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,E.jsx)(v,{testId:`mcp-install-field-api_key`,name:`api_key`,type:`password`,label:r(i.SETTINGS$MCP_API_KEY),value:f.values.api_key??``,onChange:e=>w(`api_key`,e),placeholder:r(i.SETTINGS$MCP_API_KEY_PLACEHOLDER),showOptionalTag:t,required:!t,className:`w-full`}),f.errors.api_key&&(0,E.jsx)(`p`,{className:`text-xs text-red-500`,children:f.errors.api_key})]}):null]})}if(S?.kind!==`stdio`)return null;let e=S;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(v,{testId:`mcp-install-field-command-readonly`,name:`command-readonly`,type:`text`,label:r(i.MCP$COMMAND_LABEL),value:`${e.command} ${e.args.join(` `)}`.trim(),onChange:()=>{},isDisabled:!0,className:`w-full`}),(e.envFields??[]).map(e=>(0,E.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,E.jsx)(v,{testId:`mcp-install-field-${e.key}`,name:e.key,type:e.type===`password`?`password`:`text`,label:e.label,value:f.values[e.key]??``,onChange:t=>w(e.key,t),placeholder:e.placeholder,required:e.required,showOptionalTag:!e.required,className:`w-full`}),e.helperText&&(0,E.jsx)(`p`,{className:`text-xs text-tertiary-alt`,children:Z(e.helperText)}),f.errors[e.key]&&(0,E.jsx)(`p`,{className:`text-xs text-red-500`,children:f.errors[e.key]})]},e.key)),(e.argFields??[]).map(e=>(0,E.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,E.jsx)(v,{testId:`mcp-install-field-${e.key}`,name:e.key,type:e.type===`password`?`password`:`text`,label:e.label,value:f.values[e.key]??``,onChange:t=>w(e.key,t),placeholder:e.placeholder,required:e.required,showOptionalTag:!e.required,className:`w-full`}),e.helperText&&(0,E.jsx)(`p`,{className:`text-xs text-tertiary-alt`,children:Z(e.helperText)}),f.errors[e.key]&&(0,E.jsx)(`p`,{className:`text-xs text-red-500`,children:f.errors[e.key]})]},e.key))]})})()}),m&&(0,E.jsx)(`p`,{"data-testid":`mcp-install-modal-error`,className:`text-sm text-red-500 whitespace-pre-wrap`,children:m}),(0,E.jsxs)(`div`,{className:`flex justify-end gap-2 mt-2`,children:[(0,E.jsx)(g,{type:`button`,variant:`secondary`,onClick:t,testId:`mcp-install-cancel`,children:r(i.BUTTON$CANCEL)}),(0,E.jsx)(g,{type:`submit`,variant:`primary`,isDisabled:C,testId:`mcp-install-submit`,children:r(d?i.MCP$VERIFYING:c?i.SETTINGS$SAVING:i.MCP$INSTALL_BUTTON)})]})]})})}export{W as a,B as c,U as d,R as f,K as i,V as l,w as m,X as n,I as o,H as p,q as r,j as s,te as t,M as u};
|