@openhands/agent-canvas 1.3.0 → 1.4.0
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 +1 -1
- package/README.windows.md +2 -2
- package/build/assets/{Trans-DY6toRDu.js → Trans-Ch-OVWEA.js} +1 -1
- package/build/assets/{acp-providers-Djl6vNn-.js → acp-providers-Sy2LKyMa.js} +1 -1
- package/build/assets/{active-backend-context-B3umL5R-.js → active-backend-context-hxq31W25.js} +1 -1
- package/build/assets/{add-backend-modal-DljoP9lc.js → add-backend-modal-Bgy8anoR.js} +1 -1
- package/build/assets/{agent-profiles-settings-BJMmTZgv.js → agent-profiles-settings-3mmXljZX.js} +1 -1
- package/build/assets/{agent-server-conversation-service.api-D_ZvtJjG.js → agent-server-conversation-service.api-CuSdr4Qb.js} +3 -3
- package/build/assets/{agent-settings-lUknCeaF.js → agent-settings-B-W10B4E.js} +1 -1
- package/build/assets/agent-settings-D_yOy8XB.js +1 -0
- package/build/assets/{api-key-entry-screen-CWEHcPJA.js → api-key-entry-screen-Dl0qVYi4.js} +1 -1
- package/build/assets/{app-settings-Dj90qosy.js → app-settings-yVizGXox.js} +1 -1
- package/build/assets/{automation-detail-CXJU0_gF.js → automation-detail-dvJfLs5u.js} +1 -1
- package/build/assets/{automation-export-FWY9LPsG.js → automation-export-BPcgLqPD.js} +1 -1
- package/build/assets/{automations-list-DDGBkWLC.js → automations-list-CUXogTe0.js} +1 -1
- package/build/assets/backend-form-modal-CQJGmItq.js +1 -0
- package/build/assets/{backend-synced-settings-badge-CanzmG12.js → backend-synced-settings-badge-D9hZx05w.js} +1 -1
- package/build/assets/{condenser-settings-30cX9SK6.js → condenser-settings-Ca8fYZ_Z.js} +1 -1
- package/build/assets/conversation-9NBSRoR9.js +1 -0
- package/build/assets/{conversation-BltULtFA.js → conversation-BXg6Oti2.js} +3 -3
- package/build/assets/conversation-panel-CZri9Rup.js +1 -0
- package/build/assets/{conversation-service.api-DQaKzIRj.js → conversation-service.api-DPBQvTKD.js} +1 -1
- package/build/assets/{device-verify-BsznkV-a.js → device-verify-Dj6I4Iqe.js} +1 -1
- package/build/assets/{entry.client-JixNvFrr.js → entry.client-2_3ePAm0.js} +1 -1
- package/build/assets/{extensions-hub-DfvgqzTc.js → extensions-hub-CLjmOGqS.js} +1 -1
- package/build/assets/{extensions-navigation-D9i0DL62.js → extensions-navigation-B5MeUiMq.js} +1 -1
- package/build/assets/{files-tab-DDtEJcGE.js → files-tab-UVoray88.js} +1 -1
- package/build/assets/{git-provider-icon-BjkecAuV.js → git-provider-icon-o6hdnJUB.js} +1 -1
- package/build/assets/{home-BCKWpKpf.js → home-D1IHvGTN.js} +1 -1
- package/build/assets/{install-server-modal-BIugLhVB.js → install-server-modal-BbuQaA2w.js} +1 -1
- package/build/assets/{launch-BgIlZLSX.js → launch-V_3Rp7WS.js} +1 -1
- package/build/assets/{lesson-plan-DgpP80mJ.js → lesson-plan-jC0HBoe6.js} +1 -1
- package/build/assets/{llm-not-configured-banner-BlX8NifC.js → llm-not-configured-banner-DoARbcdL.js} +1 -1
- package/build/assets/{llm-settings-kU5v0H1Z.js → llm-settings-4JMLV8mq.js} +1 -1
- package/build/assets/llm-settings-D91gMw3U.js +1 -0
- package/build/assets/{manage-backends-modal-C8FJQIZR.js → manage-backends-modal-DkWAMSle.js} +1 -1
- package/build/assets/{manifest-56d40d7c.js → manifest-aa5c29f6.js} +1 -1
- package/build/assets/{mcp-CHkklDMv.js → mcp-BQufNPZ6.js} +1 -1
- package/build/assets/{messages-B3RugH7P.js → messages-BnJCqnFf.js} +1 -1
- package/build/assets/{model-selector-BOj1wBlq.js → model-selector-BfqpMkSJ.js} +1 -1
- package/build/assets/{onboarding-DYhDxmI9.js → onboarding-Bu-HN1ze.js} +1 -1
- package/build/assets/{onboarding-modal-CP_WxDC9.js → onboarding-modal-CZgjs5Bx.js} +1 -1
- package/build/assets/{option-service.api-C0tYT4-r.js → option-service.api-BrZ5q87N.js} +1 -1
- package/build/assets/{organization-service.api-CnynNoT-.js → organization-service.api-Bk4pCGU1.js} +1 -1
- package/build/assets/{path-utils-DWcgCGen.js → path-utils-CSmuZoix.js} +1 -1
- package/build/assets/{planner-tab-CCqdXxkL.js → planner-tab-Dhyqcqmb.js} +1 -1
- package/build/assets/{plugins-management-service-BAp70KN7.js → plugins-management-service-BRBLxvUl.js} +1 -1
- package/build/assets/{profiles-service.api-CeYEmSM3.js → profiles-service.api-BMXQ9pZC.js} +1 -1
- package/build/assets/{providers-BxCuC9bZ.js → providers-BpO967xS.js} +1 -1
- package/build/assets/{proxy-CHmFkV16.js → proxy-BgJLtxu7.js} +1 -1
- package/build/assets/{recommended-automations-launcher-CVEF_1pc.js → recommended-automations-launcher-CTcGTl4d.js} +1 -1
- package/build/assets/root-BM5WgQ4_.js +2 -0
- package/build/assets/{root-layout-CttG_lQi.js → root-layout-BdoyoobY.js} +2 -2
- package/build/assets/{schema-field-xUr6rDd6.js → schema-field-BSHrUMme.js} +1 -1
- package/build/assets/{sdk-section-page-CbLrVUa3.js → sdk-section-page-t82gsOqa.js} +1 -1
- package/build/assets/{secrets-service-CZYjNxFw.js → secrets-service-B2GqPV0N.js} +1 -1
- package/build/assets/{secrets-settings-DxTx9HgU.js → secrets-settings-Cx6yJlyb.js} +1 -1
- package/build/assets/{settings-DnlfS09K.js → settings-DmPLkgq0.js} +1 -1
- package/build/assets/{settings-index-BjeuYFFa.js → settings-index-D6sxWSRk.js} +1 -1
- package/build/assets/{settings-modal-DfTcL-mV.js → settings-modal-CwrZKrTq.js} +1 -1
- package/build/assets/{settings-service.api-K4ncGlBv.js → settings-service.api-Ce-ub11I.js} +1 -1
- package/build/assets/{shared-conversation-DWtBkJv7.js → shared-conversation-BDREQPnE.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-CMmAYkh8.js → sidebar-mobile-menu-toggle-VvvX32iF.js} +1 -1
- package/build/assets/{skills-plugins-BJ040luO.js → skills-plugins-2Y44YHbO.js} +1 -1
- package/build/assets/{skills-settings-BYn4-AQQ.js → skills-settings-BUv04tSc.js} +1 -1
- package/build/assets/{suspense-X5dBsJzn.js → suspense-BO1Tl_Vf.js} +1 -1
- package/build/assets/{terminal-BsGcSpRS.js → terminal-B61WrJdS.js} +1 -1
- package/build/assets/{use-acp-credential-form-EtnbtYt0.js → use-acp-credential-form-MzZM6D7D.js} +1 -1
- package/build/assets/{use-activate-agent-profile-WaAZYz4E.js → use-activate-agent-profile-20v1xU0H.js} +1 -1
- package/build/assets/{use-active-agent-profile-CYY3vGar.js → use-active-agent-profile-BkJN7Xsy.js} +1 -1
- package/build/assets/{use-active-conversation-D-r929nx.js → use-active-conversation-DOZVSVtU.js} +1 -1
- package/build/assets/{use-agent-profiles-DEAMFp-W.js → use-agent-profiles-DwZxnwO5.js} +1 -1
- package/build/assets/{use-agent-state-DijdVAQ0.js → use-agent-state-DHZO1obC.js} +1 -1
- package/build/assets/{use-backends-health-DkC7tKkC.js → use-backends-health-CRHzuvxO.js} +1 -1
- package/build/assets/{use-can-manage-org-profiles-BEo0peGn.js → use-can-manage-org-profiles-C-OhWVBS.js} +1 -1
- package/build/assets/{use-cloud-current-user-id-Dm99wXp2.js → use-cloud-current-user-id-utFreJ0i.js} +1 -1
- package/build/assets/use-config-mJrtZHP1.js +1 -0
- package/build/assets/{use-create-conversation-CTsvZ96U.js → use-create-conversation-DdqsP78F.js} +1 -1
- package/build/assets/{use-create-secret-D5O5qdWC.js → use-create-secret-D0HCOZFu.js} +1 -1
- package/build/assets/{use-handle-plan-click-Mn_SNTCh.js → use-handle-plan-click-DyRASKMC.js} +1 -1
- package/build/assets/use-is-authed-B6M0mcGL.js +1 -0
- package/build/assets/use-llm-profiles-RC-PkpBl.js +1 -0
- package/build/assets/{use-plugins-marketplace-BGb-KgfD.js → use-plugins-marketplace-FHlbeQ4c.js} +1 -1
- package/build/assets/use-runtime-is-ready-RKj2WmEh.js +1 -0
- package/build/assets/use-save-agent-profile-tvDP15mh.js +1 -0
- package/build/assets/{use-save-settings-D1HoCDbn.js → use-save-settings-BGlSfuYn.js} +1 -1
- package/build/assets/{use-settings-BReAMxCG.js → use-settings-CH5LzXD8.js} +1 -1
- package/build/assets/{use-settings-nav-items-xe1YgLnE.js → use-settings-nav-items-Dwktv8wo.js} +1 -1
- package/build/assets/{use-skills-Dqo-pDDx.js → use-skills-CSzSL6HG.js} +1 -1
- package/build/assets/{use-tracking-2ZwQwpg_.js → use-tracking-BIXzagSI.js} +1 -1
- package/build/assets/{use-user-conversation-OAfenBRG.js → use-user-conversation-zpx7I18x.js} +1 -1
- package/build/assets/{useMutation-DCE9RcgK.js → useMutation-DrCAVg5w.js} +1 -1
- package/build/assets/{useMutationState-BUab8Kxr.js → useMutationState-D8QN0ZCy.js} +1 -1
- package/build/assets/{useQueries-CRzaAqzH.js → useQueries-DClgUTc7.js} +1 -1
- package/build/assets/{useQuery-CpjHYtZc.js → useQuery-CRBP8vIS.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nfpll1wp-BCpa95De.js} +1 -1
- package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~nn5zty47-Zl0G1QCy.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jewnulst-C57fm7C-.js} +1 -1
- package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-mMKDm94D.js → vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js} +1 -1
- package/build/assets/{verification-settings-DnXS6VWv.js → verification-settings-D576N2xa.js} +1 -1
- package/build/index.html +4 -4
- package/build/locales/en/openhands.json +1 -1
- package/config/defaults.json +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs +1 -1
- package/dist/components/features/backends/backend-form-modal.cjs.map +1 -1
- package/dist/components/features/backends/backend-form-modal.d.ts +3 -1
- package/dist/components/features/backends/backend-form-modal.js +17 -16
- package/dist/components/features/backends/backend-form-modal.js.map +1 -1
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.cjs.map +1 -1
- package/dist/config/defaults.js +1 -1
- package/dist/config/defaults.js.map +1 -1
- package/dist/i18n/translation.cjs +1 -1
- package/dist/i18n/translation.cjs.map +1 -1
- package/dist/i18n/translation.js +1 -1
- package/dist/i18n/translation.js.map +1 -1
- package/dist/locales/en/openhands.json +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +1 -1
- package/build/assets/agent-settings-BVVFzBWS.js +0 -1
- package/build/assets/backend-form-modal-DSbrafX2.js +0 -1
- package/build/assets/conversation-e0a0_X4S.js +0 -1
- package/build/assets/conversation-panel-Cr9_ZGI-.js +0 -1
- package/build/assets/llm-settings-DJmbryaE.js +0 -1
- package/build/assets/root-uJ2t9rCQ.js +0 -2
- package/build/assets/use-config-CHzNIHpv.js +0 -1
- package/build/assets/use-is-authed-_dhQ2Xuj.js +0 -1
- package/build/assets/use-llm-profiles-BMhPDlwQ.js +0 -1
- package/build/assets/use-runtime-is-ready-CC-KrLKe.js +0 -1
- package/build/assets/use-save-agent-profile-CLMmbx_X.js +0 -1
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js} +0 -0
- /package/build/assets/{vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~k6tszsdc-Bb-xMtbv.js → vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~ivvrgjsa-BlIZPCXX.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/files-tab-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,St as n,_t as r,bt as i,et as a,gt as o,h as s,o as c,xt as l}from"./vendor-styling-CI0PQ3ab.js";import{A as u,L as d,M as f,k as p}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as m}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js";import{a as h,c as g,f as _,i as v,u as y}from"./path-utils-DWcgCGen.js";import{n as b,r as x}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js";import{t as S}from"./useMutation-DCE9RcgK.js";import{t as C}from"./useQuery-CpjHYtZc.js";import{t as w}from"./Trans-DY6toRDu.js";import{t as T}from"./useTranslation-CDRCKC9-.js";import{t as E}from"./declaration-gq8V5eTU.js";import{A as D,U as O,j as k,k as ee,n as A}from"./active-backend-context-B3umL5R-.js";import{t as j}from"./createLucideIcon-CVAsW2Yo.js";import{S as M,_ as N,a as P,b as te,c as F,d as ne,f as re,g as I,h as ie,i as ae,l as L,m as oe,n as se,o as ce,p as le,r as ue,s as de,t as fe,u as pe,v as R,x as me,y as he}from"./messages-B3RugH7P.js";import{t as ge}from"./check-Bvi71siz.js";import{n as _e,t as z}from"./vendor~root-layout~conversation-panel~conversation-CpiTHpHl.js";import{t as ve}from"./copy-3JCw_XFB.js";import{t as B}from"./external-link-D2zJjE9G.js";import{t as V}from"./list-todo-BfH6yYUK.js";import{t as ye}from"./loader-circle-BEykUKYG.js";import{t as be}from"./square-chevron-right-Czw3FFWc.js";import{t as xe}from"./x-Cb0WAtak.js";import{A as Se,C as H,E as Ce,I as we,S as Te,T as Ee,b as De,c as Oe,d as ke,h as Ae,i as je,l as Me,o as Ne,t as U,u as Pe,w as Fe,x as Ie}from"./utils-D3U3rlqr.js";import{t as Le}from"./common-Dh7OqABE.js";import{c as Re,i as ze}from"./agent-server-client-options-DVLRd9sw.js";import{t as Be}from"./proxy-CHmFkV16.js";import{t as Ve}from"./modal-backdrop-zVwfOJZr.js";import{n as He}from"./modal-body-DouOE5KH.js";import{n as Ue,r as We}from"./base-modal-BuF2f0YL.js";import{t as Ge}from"./brand-button-vMVuyDXu.js";import{t as Ke}from"./loading-spinner-BLdswi6q.js";import{n as qe}from"./navigation-context-DPs2G0X8.js";import{t as Je}from"./styled-tooltip-CgX2oRaK.js";import{r as Ye,u as Xe}from"./dropdown-classes-DJSXeLqc.js";import{_ as Ze,f as Qe,h as $e,n as et,p as tt,s as nt}from"./git-provider-icon-BjkecAuV.js";import{t as rt}from"./react-DPDgL6du.js";import{n as it}from"./middleware-DYHYNAnP.js";import{i as at,s as ot}from"./conversation-local-storage-F6zVMM--.js";import{t as W}from"./conversation-store-LptbOvKa.js";import{t as st}from"./modal-close-button-B6CfxxJj.js";import{r as ct}from"./use-settings-BReAMxCG.js";import{t as lt}from"./use-tracking-2ZwQwpg_.js";import{t as ut}from"./v4-DbCkTSoU.js";import{a as dt,o as ft,t as pt}from"./agent-server-conversation-service.api-D_ZvtJjG.js";import{t as mt}from"./use-is-authed-_dhQ2Xuj.js";import{c as ht,d as gt,f as _t,i as vt,l as yt,n as bt,r as xt,s as St,t as Ct,u as wt}from"./sidebar-mobile-menu-toggle-CMmAYkh8.js";import{t as Tt}from"./use-click-outside-element-Bf4Omzot.js";import{t as Et}from"./use-create-conversation-CTsvZ96U.js";import{r as Dt,t as Ot}from"./conversation-service.api-DQaKzIRj.js";import{n as kt,t as G}from"./context-menu-list-item-BD5_EaKN.js";import{i as K,r as At,t as jt}from"./ellipsis-button-C5Z-tPFp.js";import{t as Mt}from"./u-edit-DJ90xc8Z.js";import{t as Nt}from"./skills-9cDZONKh.js";import{t as Pt}from"./use-user-conversation-OAfenBRG.js";import{t as Ft}from"./conversation-state-store-B2Bp32XI.js";import{t as It}from"./copy-BLmGeJcd.js";import{r as Lt}from"./typography-D8mHDeNG.js";import{C as Rt,D as zt,E as Bt,I as Vt,L as Ht,M as Ut,N as Wt,O as Gt,P as Kt,S as qt,T as Jt,V as Yt,_ as Xt,a as Zt,b as Qt,f as $t,g as en,h as tn,i as nn,j as rn,k as an,m as on,n as sn,o as cn,p as ln,r as un,t as dn,v as fn,w as pn,x as mn,y as hn,z as gn}from"./llm-not-configured-banner-BlX8NifC.js";import{n as q,r as _n,t as J}from"./use-active-conversation-D-r929nx.js";import{t as vn}from"./use-agent-state-DijdVAQ0.js";import{a as yn,c as bn,d as xn,f as Sn,h as Cn,l as wn,m as Y,n as Tn,p as En,r as Dn,s as On,u as kn}from"./lesson-plan-DgpP80mJ.js";import{C as An,D as jn,E as Mn,O as Nn,S as Pn,b as Fn,c as In,h as Ln,i as Rn,l as zn,n as Bn,o as Vn,r as Hn,s as Un,t as Wn,u as Gn,x as Kn}from"./use-event-store-DjgU4wfO.js";import{t as qn}from"./command-store-D8J5LMW1.js";import{t as Jn}from"./use-runtime-is-ready-CC-KrLKe.js";import{r as Yn}from"./plan-components-CcCBmCzW.js";import{t as Xn}from"./use-breakpoint-B-O0lQ84.js";import{t as Zn}from"./use-task-list-AVBLbbcR.js";import{t as Qn}from"./vendor~conversation-panel~conversation~alert-banner-DHDkknt5.js";var $n=j(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),er=j(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),tr=e=>!e.isLayoutDirty&&e.willUpdate(!1);function nr(){let e=new Set,t=new WeakMap,n=()=>e.forEach(tr);return{add:r=>{e.add(r),t.set(r,r.addEventListener(`willUpdate`,n))},remove:r=>{e.delete(r);let i=t.get(r);i&&(i(),t.delete(r)),n()},dirty:n}}var X=i(),Z=e(t(),1),rr=(0,Z.createContext)(null);function ir(){let e=(0,Z.useRef)(!1);return o(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ar(){let e=ir(),[t,n]=(0,Z.useState)(0),r=(0,Z.useCallback)(()=>{e.current&&n(t+1)},[t]);return[(0,Z.useCallback)(()=>a.postRender(r),[r]),t]}var or=e=>e===!0,sr=e=>or(e===!0)||e===`id`,cr=({children:e,id:t,inherit:n=!0})=>{let i=(0,Z.useContext)(r),a=(0,Z.useContext)(rr),[o,s]=ar(),c=(0,Z.useRef)(null),l=i.id||a;c.current===null&&(sr(n)&&l&&(t=t?l+`-`+t:l),c.current={id:t,group:or(n)&&i.group||nr()});let u=(0,Z.useMemo)(()=>({...c.current,forceRender:o}),[s]);return(0,X.jsx)(r.Provider,{value:u,children:e})},lr={curAgentState:H.LOADING},ur=rt(e=>({...lr,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(lr)})),dr=`openhands-last-conversation-by-backend`;function fr(e,t){return t?`${e}::${t}`:e}function pr(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(dr);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}catch{return{}}}function mr(e){if(!(typeof window>`u`))try{window.localStorage.setItem(dr,JSON.stringify(e))}catch{}}function hr(e,t,n){if(!n)return;let r=pr();r[fr(e,t)]=n,mr(r)}function gr(e,t){let n=pr(),r=fr(e,t);r in n&&(delete n[r],mr(n))}var _r=e=>({action:me.CHANGE_AGENT_STATE,args:{agent_state:e}}),vr=e=>`error`in e,yr=e=>`type`in e&&e.type===`error`,br=()=>{let{send:e}=te(),t=Wn(e=>e.events);Z.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!(Gn(n)&&zn(n))){if(vr(n)){if(n.error_code===401){D(`Session expired.`);return}typeof n.error==`string`?D(n.error):D(n.message);return}yr(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(_r(H.PAUSED))}},[t.length])},xr=()=>{let{curAgentState:e}=vn();return{runtimeActive:!Fe.includes(e)}};function Sr({children:e}){return br(),xr(),e}var Cr=`ACPAuthRequired`,wr={ACPAuthRequired:E.ERROR$ACP_AUTH_REQUIRED_TITLE,ACPSpawnError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPInitError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPPromptError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,UsagePolicyRefusal:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE};function Tr(e){return e?wr[e]??null:null}function Er(e){return e===Cr}var Dr={entriesByConversation:{}},Or=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),kr=rt()(it(e=>({...Dr,addPending:(t,n)=>{let r=ut();return e(e=>Or(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>Or(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>Or(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>Or(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function Ar({onClick:e}){let{t}=T(`openhands`);return(0,X.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-normal text-success bg-success/10 hover:bg-success/20 border border-success/30 transition-colors`,children:[(0,X.jsx)(N,{className:`w-3.5 h-3.5 fill-success`}),(0,X.jsx)(`span`,{children:t(E.CHAT_INTERFACE$BTW_GOT_IT)})]})}function jr({conversationId:e}){let{t}=T(`openhands`),n=kr(e=>e.entriesByConversation),r=kr(e=>e.dismiss),i=e?n[e]??[]:[];return!e||i.length===0?null:(0,X.jsx)(`div`,{"data-testid":`btw-messages`,className:`flex flex-col w-full`,children:i.map(n=>{let i=n.status===`pending`;return(0,X.jsx)(R,{title:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`opacity-60`,children:t(E.CHAT_INTERFACE$BTW_PREFIX)}),(0,X.jsx)(`span`,{children:n.question}),i&&(0,X.jsx)(`span`,{"data-testid":`btw-spinner`,className:`inline-block w-3.5 h-3.5 ml-2 rounded-full border-2 border-transparent border-t-[var(--oh-border-input)] animate-spin`})]}),details:i?t(E.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,X.jsx)(Ar,{onClick:()=>r(e,n.id)})},n.id)})})}function Mr({conversationId:e}){let t=En(e=>e.statusByConversation),n=e?t[e]:void 0;return n?.active?(0,X.jsx)(I,{status:n}):null}var Nr=`${Ce} `,Pr=(e,t)=>{let n=kr(e=>e.addPending),r=kr(e=>e.resolve),i=kr(e=>e.fail);return(0,Z.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(Nr);if(!e||!s){t(a);return}let c=o.slice(Ce.length).trim();if(!c)return;let l=n(e,c);v(e,c).then(({response:t})=>r(e,l,t)).catch(t=>i(e,l,t?.message??`Failed to ask agent`))},[e,t,n,r,i])},Fr=`${Se} `,Ir=/^--max(?:=|\s+)(\d+)\s*/,Lr=(e,t)=>{let{t:n}=T();return(0,Z.useCallback)(r=>{let i=r.trim(),a=i===`/goal`||i.startsWith(Fr);if(!e||!a){t(r);return}let o=i.slice(Se.length).trim(),s,c=o.match(Ir);c&&(s=parseInt(c[1],10),o=o.slice(c[0].length).trim());let l=o;if(!l){D(n(E.GOAL$OBJECTIVE_REQUIRED));return}let u={objective:l};s&&s>=1&&(u.max_iterations=s),y(e,u).catch(e=>{let t=n(E.GOAL$START_FAILED);D(e instanceof Error&&e.message?e.message:t)})},[e,t,n])},Rr=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function zr(e){return U(Rr,e?`bg-[var(--oh-surface)] hover:bg-tertiary cursor-pointer text-white`:`bg-[var(--oh-surface)] cursor-not-allowed opacity-50 text-[var(--oh-muted)]`)}function Br(e){return e?`white`:`var(--oh-muted)`}var Vr=`font-normal text-sm leading-5 truncate`;function Hr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=T(`openhands`),{trackPullButtonClick:a}=lt(),o=n&&t&&r;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(Oe())},disabled:!o,className:U(zr(o),`px-0.5 py-1 w-[76px] min-w-[76px]`),children:[(0,X.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,X.jsx)(zt,{width:12,height:12,color:Br(o)})}),(0,X.jsx)(`div`,{className:U(Vr,`max-w-[76px]`),title:i(E.COMMON$PULL),children:i(E.COMMON$PULL)})]})}function Ur({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackPushButtonClick:o}=lt(),s=n&&t&&i;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(Me(r))},disabled:!s,className:U(zr(s),`px-2 py-1 w-[77px] min-w-[77px]`),children:[(0,X.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,X.jsx)(Gt,{width:12,height:12,color:Br(s)})}),(0,X.jsx)(`div`,{className:U(Vr,`max-w-[77px]`),title:a(E.COMMON$PUSH),children:a(E.COMMON$PUSH)})]})}function Wr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackCreatePrButtonClick:o}=lt(),s=n&&t&&i;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(Ne(r))},disabled:!s,className:U(zr(s),`px-2 py-1 w-[126px] min-w-[126px] h-7`),children:[(0,X.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,X.jsx)(Bt,{width:12,height:12,color:Br(s)})}),(0,X.jsx)(`div`,{className:U(Vr,`max-w-[126px]`),title:a(E.COMMON$PULL_REQUEST),children:a(E.COMMON$PULL_REQUEST)})]})}function Gr(e){return e.kind===`BashCommand`}function Kr(e){return e.kind===`BashOutput`}function qr(e){return e.kind===`BashError`}function Jr(e,t,n){let r=(0,Z.useRef)(null),i=(0,Z.useRef)([]),a=(0,Z.useRef)([]),o=(0,Z.useRef)(new Map);return(0,Z.useEffect)(()=>{if(!n)return;let s=ze(e,t),c=new WebSocket(s);r.current=c,c.onopen=()=>{for(let{command:e,cwd:t,timeout:n,resolve:r,reject:o}of i.current)a.current.push({resolve:r,reject:o}),c.send(JSON.stringify({command:e,cwd:t,timeout:n}));i.current=[]},c.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Gr(t)){let e=a.current.shift();e&&o.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Kr(t)&&t.command_id){let e=o.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(o.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else qr(t)&&l(`Bash error: ${t.code}: ${t.detail}`)};function l(e){let t=Error(e);for(let{reject:e}of i.current)e(t);i.current=[];for(let e of a.current)e.reject(t);a.current=[];for(let e of o.current.values())e.reject(t);o.current.clear()}return c.onclose=()=>{r.current=null,l(`Bash WebSocket closed`)},c.onerror=()=>{r.current=null,l(`Bash WebSocket error`)},()=>{c.onclose=null,c.onerror=null,c.close(),r.current=null,l(`Bash WebSocket unmounted`)}},[n,e,t]),(0,Z.useCallback)((e,t,n)=>new Promise((o,s)=>{let c=r.current;if(!c||c.readyState===WebSocket.CLOSED||c.readyState===WebSocket.CLOSING){s(Error(`Bash WebSocket not available`));return}c.readyState===WebSocket.CONNECTING?i.current.push({command:e,cwd:t,timeout:n,resolve:o,reject:s}):(a.current.push({resolve:o,reject:s}),c.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var Yr={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function Xr(e){return e.replace(/\.git$/,``)}function Zr(e){return e?Yr[e.toLowerCase()]??null:null}function Qr(e){let t=e.split(`/`).filter(Boolean),n=t.indexOf(`_git`);return n===-1?t.join(`/`):[...t.slice(0,n),...t.slice(n+1)].join(`/`)}function $r(e,t,n){let r=Xr(n.replace(/^\/+/,``)),i=Zr(t);return{url:e,host:t,repository:(i===`azure_devops`?Qr(r):r)||null,provider:i}}function ei(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return $r(t,e,n[2])}try{let e=new URL(t);return $r(t,e.hostname||null,e.pathname)}catch{return null}}var ti={repository:null,branch:null,provider:null,remoteUrl:null},ni=[`r=$(git remote get-url origin 2>/dev/null)`,`b=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)`,`if [ -z "$r$b" ]; then`,`n=$(find . -mindepth 2 -maxdepth 4 -name .git 2>/dev/null | cut -c3- | sed 's|/.git$||' | sort -u)`,`c=$(printf '%s\\n' "$n" | grep -c '[^[:space:]]')`,`if [ "$c" = "1" ] && [ -n "$n" ]; then`,`r=$(git -C "$n" remote get-url origin 2>/dev/null)`,`b=$(git -C "$n" rev-parse --abbrev-ref HEAD 2>/dev/null)`,`fi`,`fi`,`printf '%s\\n%s' "$r" "$b"`].join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/files-tab-UVoray88.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor-styling-CI0PQ3ab.js","assets/active-backend-context-hxq31W25.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nfpll1wp-BCpa95De.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js","assets/createLucideIcon-CVAsW2Yo.js","assets/declaration-gq8V5eTU.js","assets/agent-server-client-options-DVLRd9sw.js","assets/utils-D3U3rlqr.js","assets/common-Dh7OqABE.js","assets/vendor~files-tab-B02k3xvx.js","assets/iconBase-DaTRRUjy.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js","assets/useQuery-CRBP8vIS.js","assets/suspense-BO1Tl_Vf.js","assets/mouse-pointer-click-PdEQPL6v.js","assets/useTranslation-CDRCKC9-.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-d8aETPbZ.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-9UMeuPV6.js","assets/objectWithoutPropertiesLoose-BgYIAs2y.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D7EUmQ8Y.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DTzw2x50.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CqXiHwjU.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BD0GaRGa.js","assets/react-DPDgL6du.js","assets/agent-server-conversation-service.api-CuSdr4Qb.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~automations-~ki5qnp0d-rV6d1Iv_.js","assets/v4-DbCkTSoU.js","assets/proxy-BgJLtxu7.js","assets/profiles-service.api-BMXQ9pZC.js","assets/settings-service.api-Ce-ub11I.js","assets/settings-mQUckT0g.js","assets/llm-subscription-service-CKyaV24y.js","assets/llm-subscription-DtsX5Lhg.js","assets/acp-providers-Sy2LKyMa.js","assets/use-event-store-DjgU4wfO.js","assets/runtime-waiting-state-BsXLElvN.js","assets/loading-spinner-BLdswi6q.js","assets/typography-D8mHDeNG.js","assets/dist-CodhvuAP.js","assets/conversation-tab-empty-state-B2dDYEwf.js","assets/segmented-toggle-DyQqPhoD.js","assets/markdown-renderer-DMT7Zkpd.js","assets/vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-CZM4hwUT.js","assets/copy-to-clipboard-button-CaR52OnA.js","assets/checkmark-h7udgXMM.js","assets/copy-BLmGeJcd.js","assets/use-active-conversation-DOZVSVtU.js","assets/conversation-service.api-DPBQvTKD.js","assets/navigation-context-DPs2G0X8.js","assets/use-user-conversation-zpx7I18x.js","assets/use-agent-state-DHZO1obC.js","assets/conversation-state-store-B2Bp32XI.js","assets/use-runtime-is-ready-RKj2WmEh.js","assets/files-tab-store-DJsPxYdg.js","assets/folder-mMWFvaw0.js","assets/get-language-from-path-CPNnuVhI.js","assets/link-external-DfKQroKX.js","assets/conversation-local-storage-F6zVMM--.js","assets/git-status-mapper-BI8FyUVp.js","assets/browser-tab-CkkqJnqw.js","assets/external-link-D2zJjE9G.js","assets/vendor~browser-tab-Di0kh5Zw.js","assets/browser-store-BI6uklCG.js","assets/planner-tab-Dhyqcqmb.js","assets/list-todo-BfH6yYUK.js","assets/plan-components-CcCBmCzW.js","assets/brand-button-vMVuyDXu.js","assets/form-control-classes-ChpNBe9n.js","assets/use-handle-plan-click-DyRASKMC.js","assets/use-create-conversation-DdqsP78F.js","assets/useMutation-DrCAVg5w.js","assets/use-agent-profiles-DwZxnwO5.js","assets/plugins-management-service-BRBLxvUl.js","assets/use-llm-profiles-RC-PkpBl.js","assets/use-tracking-BIXzagSI.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~jewnulst-C57fm7C-.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~ivvrgjsa-BlIZPCXX.js","assets/use-settings-CH5LzXD8.js","assets/conversation-store-LptbOvKa.js","assets/middleware-DYHYNAnP.js","assets/task-list-tab-0k9PhuqO.js","assets/use-task-list-AVBLbbcR.js","assets/u-check-circle-half-LiwZkuFe.js","assets/u-check-circle-BqoIxNz_.js","assets/terminal-B61WrJdS.js","assets/vendor~terminal-aeP3PnKf.js","assets/vendor~terminal-T4IDBjWs.css","assets/square-chevron-right-Czw3FFWc.js","assets/command-store-D8J5LMW1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,St as n,_t as r,bt as i,et as a,gt as o,h as s,o as c,xt as l}from"./vendor-styling-CI0PQ3ab.js";import{A as u,L as d,M as f,k as p}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as m}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";import{a as h,c as g,f as _,i as v,u as y}from"./path-utils-CSmuZoix.js";import{n as b,r as x}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~nfpll1wp-BCpa95De.js";import{t as S}from"./useMutation-DrCAVg5w.js";import{t as C}from"./useQuery-CRBP8vIS.js";import{t as w}from"./Trans-Ch-OVWEA.js";import{t as T}from"./useTranslation-CDRCKC9-.js";import{t as E}from"./declaration-gq8V5eTU.js";import{A as D,U as O,j as k,k as ee,n as A}from"./active-backend-context-hxq31W25.js";import{t as j}from"./createLucideIcon-CVAsW2Yo.js";import{S as M,_ as N,a as P,b as te,c as F,d as ne,f as re,g as I,h as ie,i as ae,l as L,m as oe,n as se,o as ce,p as le,r as ue,s as de,t as fe,u as pe,v as R,x as me,y as he}from"./messages-BnJCqnFf.js";import{t as ge}from"./check-Bvi71siz.js";import{n as _e,t as z}from"./vendor~root-layout~conversation-panel~conversation-CpiTHpHl.js";import{t as ve}from"./copy-3JCw_XFB.js";import{t as B}from"./external-link-D2zJjE9G.js";import{t as V}from"./list-todo-BfH6yYUK.js";import{t as ye}from"./loader-circle-BEykUKYG.js";import{t as be}from"./square-chevron-right-Czw3FFWc.js";import{t as xe}from"./x-Cb0WAtak.js";import{A as Se,C as H,E as Ce,I as we,S as Te,T as Ee,b as De,c as Oe,d as ke,h as Ae,i as je,l as Me,o as Ne,t as U,u as Pe,w as Fe,x as Ie}from"./utils-D3U3rlqr.js";import{t as Le}from"./common-Dh7OqABE.js";import{c as Re,i as ze}from"./agent-server-client-options-DVLRd9sw.js";import{t as Be}from"./proxy-BgJLtxu7.js";import{t as Ve}from"./modal-backdrop-zVwfOJZr.js";import{n as He}from"./modal-body-DouOE5KH.js";import{n as Ue,r as We}from"./base-modal-BuF2f0YL.js";import{t as Ge}from"./brand-button-vMVuyDXu.js";import{t as Ke}from"./loading-spinner-BLdswi6q.js";import{n as qe}from"./navigation-context-DPs2G0X8.js";import{t as Je}from"./styled-tooltip-CgX2oRaK.js";import{r as Ye,u as Xe}from"./dropdown-classes-DJSXeLqc.js";import{_ as Ze,f as Qe,h as $e,n as et,p as tt,s as nt}from"./git-provider-icon-o6hdnJUB.js";import{t as rt}from"./react-DPDgL6du.js";import{n as it}from"./middleware-DYHYNAnP.js";import{i as at,s as ot}from"./conversation-local-storage-F6zVMM--.js";import{t as W}from"./conversation-store-LptbOvKa.js";import{t as st}from"./modal-close-button-B6CfxxJj.js";import{r as ct}from"./use-settings-CH5LzXD8.js";import{t as lt}from"./use-tracking-BIXzagSI.js";import{t as ut}from"./v4-DbCkTSoU.js";import{a as dt,o as ft,t as pt}from"./agent-server-conversation-service.api-CuSdr4Qb.js";import{t as mt}from"./use-is-authed-B6M0mcGL.js";import{c as ht,d as gt,f as _t,i as vt,l as yt,n as bt,r as xt,s as St,t as Ct,u as wt}from"./sidebar-mobile-menu-toggle-VvvX32iF.js";import{t as Tt}from"./use-click-outside-element-Bf4Omzot.js";import{t as Et}from"./use-create-conversation-DdqsP78F.js";import{r as Dt,t as Ot}from"./conversation-service.api-DPBQvTKD.js";import{n as kt,t as G}from"./context-menu-list-item-BD5_EaKN.js";import{i as K,r as At,t as jt}from"./ellipsis-button-C5Z-tPFp.js";import{t as Mt}from"./u-edit-DJ90xc8Z.js";import{t as Nt}from"./skills-9cDZONKh.js";import{t as Pt}from"./use-user-conversation-zpx7I18x.js";import{t as Ft}from"./conversation-state-store-B2Bp32XI.js";import{t as It}from"./copy-BLmGeJcd.js";import{r as Lt}from"./typography-D8mHDeNG.js";import{C as Rt,D as zt,E as Bt,I as Vt,L as Ht,M as Ut,N as Wt,O as Gt,P as Kt,S as qt,T as Jt,V as Yt,_ as Xt,a as Zt,b as Qt,f as $t,g as en,h as tn,i as nn,j as rn,k as an,m as on,n as sn,o as cn,p as ln,r as un,t as dn,v as fn,w as pn,x as mn,y as hn,z as gn}from"./llm-not-configured-banner-DoARbcdL.js";import{n as q,r as _n,t as J}from"./use-active-conversation-DOZVSVtU.js";import{t as vn}from"./use-agent-state-DHZO1obC.js";import{a as yn,c as bn,d as xn,f as Sn,h as Cn,l as wn,m as Y,n as Tn,p as En,r as Dn,s as On,u as kn}from"./lesson-plan-jC0HBoe6.js";import{C as An,D as jn,E as Mn,O as Nn,S as Pn,b as Fn,c as In,h as Ln,i as Rn,l as zn,n as Bn,o as Vn,r as Hn,s as Un,t as Wn,u as Gn,x as Kn}from"./use-event-store-DjgU4wfO.js";import{t as qn}from"./command-store-D8J5LMW1.js";import{t as Jn}from"./use-runtime-is-ready-RKj2WmEh.js";import{r as Yn}from"./plan-components-CcCBmCzW.js";import{t as Xn}from"./use-breakpoint-B-O0lQ84.js";import{t as Zn}from"./use-task-list-AVBLbbcR.js";import{t as Qn}from"./vendor~conversation-panel~conversation~alert-banner-DHDkknt5.js";var $n=j(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),er=j(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),tr=e=>!e.isLayoutDirty&&e.willUpdate(!1);function nr(){let e=new Set,t=new WeakMap,n=()=>e.forEach(tr);return{add:r=>{e.add(r),t.set(r,r.addEventListener(`willUpdate`,n))},remove:r=>{e.delete(r);let i=t.get(r);i&&(i(),t.delete(r)),n()},dirty:n}}var X=i(),Z=e(t(),1),rr=(0,Z.createContext)(null);function ir(){let e=(0,Z.useRef)(!1);return o(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ar(){let e=ir(),[t,n]=(0,Z.useState)(0),r=(0,Z.useCallback)(()=>{e.current&&n(t+1)},[t]);return[(0,Z.useCallback)(()=>a.postRender(r),[r]),t]}var or=e=>e===!0,sr=e=>or(e===!0)||e===`id`,cr=({children:e,id:t,inherit:n=!0})=>{let i=(0,Z.useContext)(r),a=(0,Z.useContext)(rr),[o,s]=ar(),c=(0,Z.useRef)(null),l=i.id||a;c.current===null&&(sr(n)&&l&&(t=t?l+`-`+t:l),c.current={id:t,group:or(n)&&i.group||nr()});let u=(0,Z.useMemo)(()=>({...c.current,forceRender:o}),[s]);return(0,X.jsx)(r.Provider,{value:u,children:e})},lr={curAgentState:H.LOADING},ur=rt(e=>({...lr,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(lr)})),dr=`openhands-last-conversation-by-backend`;function fr(e,t){return t?`${e}::${t}`:e}function pr(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(dr);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}catch{return{}}}function mr(e){if(!(typeof window>`u`))try{window.localStorage.setItem(dr,JSON.stringify(e))}catch{}}function hr(e,t,n){if(!n)return;let r=pr();r[fr(e,t)]=n,mr(r)}function gr(e,t){let n=pr(),r=fr(e,t);r in n&&(delete n[r],mr(n))}var _r=e=>({action:me.CHANGE_AGENT_STATE,args:{agent_state:e}}),vr=e=>`error`in e,yr=e=>`type`in e&&e.type===`error`,br=()=>{let{send:e}=te(),t=Wn(e=>e.events);Z.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!(Gn(n)&&zn(n))){if(vr(n)){if(n.error_code===401){D(`Session expired.`);return}typeof n.error==`string`?D(n.error):D(n.message);return}yr(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(_r(H.PAUSED))}},[t.length])},xr=()=>{let{curAgentState:e}=vn();return{runtimeActive:!Fe.includes(e)}};function Sr({children:e}){return br(),xr(),e}var Cr=`ACPAuthRequired`,wr={ACPAuthRequired:E.ERROR$ACP_AUTH_REQUIRED_TITLE,ACPSpawnError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPInitError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPPromptError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,UsagePolicyRefusal:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE};function Tr(e){return e?wr[e]??null:null}function Er(e){return e===Cr}var Dr={entriesByConversation:{}},Or=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),kr=rt()(it(e=>({...Dr,addPending:(t,n)=>{let r=ut();return e(e=>Or(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>Or(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>Or(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>Or(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function Ar({onClick:e}){let{t}=T(`openhands`);return(0,X.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-normal text-success bg-success/10 hover:bg-success/20 border border-success/30 transition-colors`,children:[(0,X.jsx)(N,{className:`w-3.5 h-3.5 fill-success`}),(0,X.jsx)(`span`,{children:t(E.CHAT_INTERFACE$BTW_GOT_IT)})]})}function jr({conversationId:e}){let{t}=T(`openhands`),n=kr(e=>e.entriesByConversation),r=kr(e=>e.dismiss),i=e?n[e]??[]:[];return!e||i.length===0?null:(0,X.jsx)(`div`,{"data-testid":`btw-messages`,className:`flex flex-col w-full`,children:i.map(n=>{let i=n.status===`pending`;return(0,X.jsx)(R,{title:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`opacity-60`,children:t(E.CHAT_INTERFACE$BTW_PREFIX)}),(0,X.jsx)(`span`,{children:n.question}),i&&(0,X.jsx)(`span`,{"data-testid":`btw-spinner`,className:`inline-block w-3.5 h-3.5 ml-2 rounded-full border-2 border-transparent border-t-[var(--oh-border-input)] animate-spin`})]}),details:i?t(E.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,X.jsx)(Ar,{onClick:()=>r(e,n.id)})},n.id)})})}function Mr({conversationId:e}){let t=En(e=>e.statusByConversation),n=e?t[e]:void 0;return n?.active?(0,X.jsx)(I,{status:n}):null}var Nr=`${Ce} `,Pr=(e,t)=>{let n=kr(e=>e.addPending),r=kr(e=>e.resolve),i=kr(e=>e.fail);return(0,Z.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(Nr);if(!e||!s){t(a);return}let c=o.slice(Ce.length).trim();if(!c)return;let l=n(e,c);v(e,c).then(({response:t})=>r(e,l,t)).catch(t=>i(e,l,t?.message??`Failed to ask agent`))},[e,t,n,r,i])},Fr=`${Se} `,Ir=/^--max(?:=|\s+)(\d+)\s*/,Lr=(e,t)=>{let{t:n}=T();return(0,Z.useCallback)(r=>{let i=r.trim(),a=i===`/goal`||i.startsWith(Fr);if(!e||!a){t(r);return}let o=i.slice(Se.length).trim(),s,c=o.match(Ir);c&&(s=parseInt(c[1],10),o=o.slice(c[0].length).trim());let l=o;if(!l){D(n(E.GOAL$OBJECTIVE_REQUIRED));return}let u={objective:l};s&&s>=1&&(u.max_iterations=s),y(e,u).catch(e=>{let t=n(E.GOAL$START_FAILED);D(e instanceof Error&&e.message?e.message:t)})},[e,t,n])},Rr=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function zr(e){return U(Rr,e?`bg-[var(--oh-surface)] hover:bg-tertiary cursor-pointer text-white`:`bg-[var(--oh-surface)] cursor-not-allowed opacity-50 text-[var(--oh-muted)]`)}function Br(e){return e?`white`:`var(--oh-muted)`}var Vr=`font-normal text-sm leading-5 truncate`;function Hr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=T(`openhands`),{trackPullButtonClick:a}=lt(),o=n&&t&&r;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(Oe())},disabled:!o,className:U(zr(o),`px-0.5 py-1 w-[76px] min-w-[76px]`),children:[(0,X.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,X.jsx)(zt,{width:12,height:12,color:Br(o)})}),(0,X.jsx)(`div`,{className:U(Vr,`max-w-[76px]`),title:i(E.COMMON$PULL),children:i(E.COMMON$PULL)})]})}function Ur({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackPushButtonClick:o}=lt(),s=n&&t&&i;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(Me(r))},disabled:!s,className:U(zr(s),`px-2 py-1 w-[77px] min-w-[77px]`),children:[(0,X.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,X.jsx)(Gt,{width:12,height:12,color:Br(s)})}),(0,X.jsx)(`div`,{className:U(Vr,`max-w-[77px]`),title:a(E.COMMON$PUSH),children:a(E.COMMON$PUSH)})]})}function Wr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackCreatePrButtonClick:o}=lt(),s=n&&t&&i;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(Ne(r))},disabled:!s,className:U(zr(s),`px-2 py-1 w-[126px] min-w-[126px] h-7`),children:[(0,X.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,X.jsx)(Bt,{width:12,height:12,color:Br(s)})}),(0,X.jsx)(`div`,{className:U(Vr,`max-w-[126px]`),title:a(E.COMMON$PULL_REQUEST),children:a(E.COMMON$PULL_REQUEST)})]})}function Gr(e){return e.kind===`BashCommand`}function Kr(e){return e.kind===`BashOutput`}function qr(e){return e.kind===`BashError`}function Jr(e,t,n){let r=(0,Z.useRef)(null),i=(0,Z.useRef)([]),a=(0,Z.useRef)([]),o=(0,Z.useRef)(new Map);return(0,Z.useEffect)(()=>{if(!n)return;let s=ze(e,t),c=new WebSocket(s);r.current=c,c.onopen=()=>{for(let{command:e,cwd:t,timeout:n,resolve:r,reject:o}of i.current)a.current.push({resolve:r,reject:o}),c.send(JSON.stringify({command:e,cwd:t,timeout:n}));i.current=[]},c.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Gr(t)){let e=a.current.shift();e&&o.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Kr(t)&&t.command_id){let e=o.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(o.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else qr(t)&&l(`Bash error: ${t.code}: ${t.detail}`)};function l(e){let t=Error(e);for(let{reject:e}of i.current)e(t);i.current=[];for(let e of a.current)e.reject(t);a.current=[];for(let e of o.current.values())e.reject(t);o.current.clear()}return c.onclose=()=>{r.current=null,l(`Bash WebSocket closed`)},c.onerror=()=>{r.current=null,l(`Bash WebSocket error`)},()=>{c.onclose=null,c.onerror=null,c.close(),r.current=null,l(`Bash WebSocket unmounted`)}},[n,e,t]),(0,Z.useCallback)((e,t,n)=>new Promise((o,s)=>{let c=r.current;if(!c||c.readyState===WebSocket.CLOSED||c.readyState===WebSocket.CLOSING){s(Error(`Bash WebSocket not available`));return}c.readyState===WebSocket.CONNECTING?i.current.push({command:e,cwd:t,timeout:n,resolve:o,reject:s}):(a.current.push({resolve:o,reject:s}),c.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var Yr={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function Xr(e){return e.replace(/\.git$/,``)}function Zr(e){return e?Yr[e.toLowerCase()]??null:null}function Qr(e){let t=e.split(`/`).filter(Boolean),n=t.indexOf(`_git`);return n===-1?t.join(`/`):[...t.slice(0,n),...t.slice(n+1)].join(`/`)}function $r(e,t,n){let r=Xr(n.replace(/^\/+/,``)),i=Zr(t);return{url:e,host:t,repository:(i===`azure_devops`?Qr(r):r)||null,provider:i}}function ei(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return $r(t,e,n[2])}try{let e=new URL(t);return $r(t,e.hostname||null,e.pathname)}catch{return null}}var ti={repository:null,branch:null,provider:null,remoteUrl:null},ni=[`r=$(git remote get-url origin 2>/dev/null)`,`b=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)`,`if [ -z "$r$b" ]; then`,`n=$(find . -mindepth 2 -maxdepth 4 -name .git 2>/dev/null | cut -c3- | sed 's|/.git$||' | sort -u)`,`c=$(printf '%s\\n' "$n" | grep -c '[^[:space:]]')`,`if [ "$c" = "1" ] && [ -n "$n" ]; then`,`r=$(git -C "$n" remote get-url origin 2>/dev/null)`,`b=$(git -C "$n" rev-parse --abbrev-ref HEAD 2>/dev/null)`,`fi`,`fi`,`printf '%s\\n%s' "$r" "$b"`].join(`
|
|
3
3
|
`);async function ri(e,t){let n=await e(ni,t,10);if(n.exit_code!==0)return ti;let r=n.stdout.indexOf(`
|
|
4
4
|
`),i=(r>=0?n.stdout.slice(0,r):n.stdout).trim(),a=(r>=0?n.stdout.slice(r+1):``).trim(),o=a&&a!==`HEAD`?a:null;if(!i&&!o)return ti;let s=ei(i);return{repository:s?.repository??null,provider:s?.provider??null,remoteUrl:i||null,branch:o}}var ii=()=>{let{data:e}=J(),t=Jn(),{backend:n}=A(),r=n.kind===`local`,i=e?.id,a=e?.conversation_url,o=e?.session_api_key,s=e?.workspace?.working_dir?.trim(),c=!!e?.selected_repository,l=!!e?.git_provider,u=!!e?.selected_branch,d=r&&t&&!!i&&!!s&&(!c||!l||!u),f=Jr(a,o,d),p=(0,Z.useRef)(f);return p.current=f,C({queryKey:[`local-git-info`,i,a,o,s],queryFn:async()=>ri((e,t,n)=>p.current(e,t,n),s),enabled:d,retry:!1,staleTime:1e4,refetchInterval:1e4,gcTime:1e3*60*5,meta:{disableToast:!0}})},ai=()=>{let e=m(),{t}=T(`openhands`);return S({mutationFn:e=>pt.updateConversationRepository(e.conversationId,e.repository,e.branch,e.gitProvider),onMutate:async t=>{let n=[`user`,`conversation`,t.conversationId];await e.cancelQueries({queryKey:n});let r=e.getQueriesData({queryKey:n});return e.setQueriesData({queryKey:n},e=>e&&{...e,selected_repository:t.repository,selected_branch:t.branch??null,git_provider:t.gitProvider??null}),{previousEntries:r}},onError:(n,r,i)=>{i?.previousEntries.forEach(([t,n])=>{e.setQueryData(t,n)}),D(t(E.CONVERSATION$FAILED_TO_UPDATE_REPOSITORY))},onSuccess:()=>{k(t(E.CONVERSATION$REPOSITORY_UPDATED))},onSettled:(t,n,r)=>{e.invalidateQueries({queryKey:[`user`,`conversation`,r.conversationId]}),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`local-git-info`,r.conversationId]})}})};function oi({children:e,tooltipMessage:t,testId:n,shouldShowTooltip:r}){return r?(0,X.jsx)(Je,{content:t,placement:`top`,showArrow:!0,tooltipClassName:`bg-white text-black`,children:(0,X.jsx)(`span`,{"data-testid":n,className:`hover:opacity-100`,children:e})}):e}function si({isOpen:e,onClose:t,onLaunch:n,defaultProvider:r=`github`}){let{t:i}=T(`openhands`),{providers:a}=nt(),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{a.length===1&&!o?s(a[0]):a.length>1&&!o&&r&&a.includes(r)&&s(r)},[a,o,r]);let f=(0,Z.useCallback)(e=>{e!==o&&(s(e),l(null),d(null))},[o]),p=(0,Z.useCallback)(e=>{e?(l(e),d(null)):(l(null),d(null))},[]),m=(0,Z.useCallback)(e=>{d(e)},[]),h=()=>{!c||!u||(n(c,u),l(null),d(null),t())},g=()=>{s(null),l(null),d(null),t()};if(!e)return null;let _=c?.git_provider||o||r,v=!!c&&!!u;return(0,X.jsx)(Ve,{onClose:g,children:(0,X.jsxs)(He,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,X.jsx)(st,{onClose:g,testId:`close-open-repository-modal`}),(0,X.jsx)(`div`,{className:`w-full pr-6`,children:(0,X.jsx)(We,{title:i(E.CONVERSATION$OPEN_REPOSITORY)})}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 w-full`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`span`,{className:`text-sm text-white font-normal leading-[22px]`,children:i(E.CONVERSATION$SELECT_OR_INSERT_LINK)}),a.length>1&&(0,X.jsx)(cn,{providers:a,value:o,onChange:f})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] w-full`,children:[(0,X.jsx)(nn,{provider:_,value:c?.id||null,repositoryName:c?.full_name||null,onChange:p,className:`w-full`}),(0,X.jsx)(Zt,{repository:c?.full_name||null,provider:_,selectedBranch:u,onBranchSelect:m,defaultBranch:c?.main_branch||null,disabled:!c,className:`w-full`})]})]}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 w-full`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(Ge,{type:`button`,variant:`secondary`,onClick:g,children:i(E.BUTTON$CANCEL)}),(0,X.jsx)(Ge,{type:`button`,variant:`primary`,onClick:h,isDisabled:!v,children:i(E.BUTTON$LAUNCH)})]})]})})}function ci({onSuggestionsClick:e}){let{t}=T(`openhands`),{conversationId:n}=q(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(!1),s=(0,Z.useRef)(null),{addRecentRepository:c}=et(),l=Y(e=>e.enqueuePendingMessage),u=Y(e=>e.markPendingMessageError),{backend:d}=A(),f=d.kind===`local`,{providers:p}=nt(),m=f||p.length>0,{data:h}=J(),{repositoryInfo:g}=Wt(),{data:_}=ii(),v=gn(),y=Dn()?.isLoadingHistory??!1,b=(0,Z.useRef)(v);(0,Z.useEffect)(()=>{b.current=v},[v]);let{send:x}=te(),S=(0,Z.useRef)(x);(0,Z.useEffect)(()=>{S.current=x},[x]);let C=oe(),{mutate:w}=ai(),{mutate:O,isPending:k}=Et(),ee=h?.selected_repository||g?.selectedRepository,j=h?.git_provider||g?.gitProvider,M=h?.selected_branch||g?.selectedBranch,N=ee||_?.repository||void 0,P=j||_?.provider,F=M||_?.branch||void 0,ne=(h?.id?ft(h.id):null)?.selected_workspace??null,re=ne&&ne.replace(/\/+$/,``).split(`/`).pop()||null,I=!!N&&!!P,ie=!!h&&v===`OPEN`&&!y;(0,Z.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,Z.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&o(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let ae=(e,r)=>{n&&(c(e),w({conversationId:n,repository:e.full_name,branch:r.name,gitProvider:e.git_provider},{onSuccess:()=>{if(b.current!==`OPEN`){D(t(E.CONVERSATION$CLONE_COMMAND_FAILED_DISCONNECTED));return}let i=e.git_provider.charAt(0).toUpperCase()+e.git_provider.slice(1),a=`Clone ${e.full_name} from ${i} and checkout branch ${r.name}.`,o=n?l({conversationId:n,text:a}):null;C?.scrollDomToBottom(),Promise.resolve(S.current({action:`message`,args:{content:a,timestamp:new Date().toISOString()}})).catch(e=>{o&&u(o,e instanceof Error?e.message:t(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))})}}))},L=!f||!!N||!!re,se=f&&!I;return L||F||I?(0,X.jsxs)(`div`,{className:`flex flex-row items-center`,children:[(0,X.jsxs)(`div`,{className:`flex flex-row gap-2.5 items-center overflow-x-auto flex-nowrap relative scrollbar-hide`,children:[L?(0,X.jsx)(un,{selectedRepository:N,gitProvider:P,workspaceName:re,onClick:()=>i(!0),disabled:!ie||se}):null,F?(0,X.jsx)(sn,{selectedBranch:F,selectedRepository:N,gitProvider:P}):null,I?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oi,{tooltipMessage:t(E.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pull-button-tooltip`,shouldShowTooltip:!I,children:(0,X.jsx)(Hr,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,isConversationReady:ie})}),(0,X.jsx)(oi,{tooltipMessage:t(E.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-push-button-tooltip`,shouldShowTooltip:!I,children:(0,X.jsx)(Ur,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:P,isConversationReady:ie})}),(0,X.jsx)(oi,{tooltipMessage:t(E.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pr-button-tooltip`,shouldShowTooltip:!I,children:(0,X.jsx)(Wr,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:P,isConversationReady:ie})})]}):null]}),(0,X.jsx)(si,{isOpen:r,onClose:()=>i(!1),onLaunch:ae,defaultProvider:P})]}):null}function li({onSubmit:e,disabled:t=!1}){let{images:n,files:r,imagesMarkedUploadAsFile:i,clearAllFiles:a,subConversationTaskId:o}=W(),{curAgentState:s}=vn(),{data:c}=J(),{conversationId:l}=_n(),u=l??c?.id??null,{taskStatus:d}=Ut(o,c?.id||null),{handleUpload:f}=$t(),p=on(u,Lr(u,Pr(u,t=>{let{imagesToEmbed:o,imagesAsFiles:s}=Yt(n,i);e(t,o,[...r,...s]),a()})));return(0,X.jsxs)(`div`,{"data-testid":`interactive-chat-box`,children:[(0,X.jsx)(tn,{disabled:t||s===H.AWAITING_USER_CONFIRMATION||Ae(d),isNewConversationPending:t,onSubmit:p,onFilesPaste:f}),(0,X.jsx)(`div`,{className:`mt-3 pb-3`,children:(0,X.jsx)(ci,{onSuggestionsClick:e=>{p(e)}})})]})}function ui(){let e=Wn(e=>e.events),t=Wn(e=>e.uiEvents),n=Z.useMemo(()=>t.filter(bn),[t]),r=Z.useMemo(()=>e,[e]),i=Z.useMemo(()=>n.length,[n]),a=Z.useMemo(()=>r.some(e=>e.source===`agent`&&!Nn(e)&&!Ln(e)),[r]),o=On(r);return{storeEvents:e,uiEvents:t,renderableEvents:n,allConversationEvents:r,totalEvents:i,hasSubstantiveAgentActions:a,conversationUserEventsExist:o,userEventsExist:o}}var di=e=>`timestamp`in e?e.timestamp:void 0,fi=e=>{let t=!!e&&at(e),n=t?void 0:e,{data:r}=Pt(e??null),{data:i,isFetched:a}=wn(n??void 0),o=Wn(e=>e.addEvents),[s,c]=Z.useState(!1),[l,u]=Z.useState(!0),d=Z.useRef(!1),f=Z.useRef(!0);return Z.useEffect(()=>{if(d.current=!1,c(!1),t){f.current=!1,u(!1);return}f.current=!0,u(!0)},[e,t]),Z.useEffect(()=>{t||!a||!i||i.hasMore||(f.current=!1,u(!1))},[t,a,i?.hasMore,n]),{isLoading:s,hasMore:l,loadOlder:Z.useCallback(async()=>{if(!e||at(e)||d.current||!f.current||!r)return;let{events:t}=Wn.getState(),n=t[0];if(!n)return;let i=di(n);if(!i){f.current=!1,u(!1);return}d.current=!0,c(!0);try{let t=await xn.searchEvents(e,r?.conversation_url??null,r?.session_api_key??null,{limit:50,sortOrder:`TIMESTAMP_DESC`,timestampLt:i});if(!Array.isArray(t.items))throw Error(`Invalid older-events response: expected page.items to be an array.`);let n=[...t.items].reverse();n.length>0&&(o(n),yn(e,Wn.getState().uiEvents)),(!t.next_page_id||t.items.length<50)&&(f.current=!1,u(!1))}finally{d.current=!1,c(!1)}},[e,r,r?.conversation_url,r?.session_api_key,o])}};function pi(){return(0,X.jsxs)(`div`,{className:`flex items-center space-x-1.5 rounded-full bg-[var(--oh-surface)] px-3 py-1.5`,children:[(0,X.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:0ms]`}),(0,X.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:75ms]`}),(0,X.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:150ms]`})]})}function mi({suggestion:e,onClick:t}){let{t:n}=T(`openhands`);return(0,X.jsxs)(`button`,{type:`button`,className:`list-none border border-[var(--oh-border)] rounded-[15px] hover:bg-surface-raised hover:border-[var(--oh-interactive-hover)] transition-colors flex-1 flex items-center justify-center cursor-pointer gap-[10px] h-[55px] px-4`,onClick:()=>t(e.value),children:[(0,Z.useMemo)(()=>{switch(e.label){case`INCREASE_TEST_COVERAGE`:return(0,X.jsx)(Jt,{width:24,height:24,color:`#fff`});case`AUTO_MERGE_PRS`:return(0,X.jsx)(pn,{width:19,height:20,color:`#fff`});case`FIX_README`:return(0,X.jsx)(Rt,{width:24,height:24,color:`#fff`});case`CLEAN_DEPENDENCIES`:return(0,X.jsx)(qt,{width:24,height:24,color:`#fff`});default:return null}},[e]),(0,X.jsx)(`span`,{"data-testid":`suggestion`,className:`text-[15px] font-normal leading-5 text-white text-center cursor-pointer`,children:n(e.label)})]})}function hi({suggestions:e,onSuggestionClick:t}){return(0,X.jsx)(`div`,{"data-testid":`suggestions`,className:`grid grid-cols-2 gap-5 max-w-fit`,children:e.map((e,n)=>(0,X.jsx)(mi,{suggestion:e,onClick:t},n))})}var gi=E.SUGGESTIONS$HACKER_NEWS,_i=`Please write a bash script which displays the top story on Hacker News. It should show the title, the link, and the number of points.
|
|
5
5
|
The script should only use tools that are widely available on unix systems, like curl and grep.`,vi=E.SUGGESTIONS$HELLO_WORLD,yi=`I want to create a Hello World app in Javascript that:
|
|
@@ -16,7 +16,7 @@ The script should only use tools that are widely available on unix systems, like
|
|
|
16
16
|
|
|
17
17
|
This should be a client-only app with no backend. The list should persist in localStorage.`,Si={repo:mn,"non-repo":{[gi]:_i,[vi]:yi,[bi]:xi}};function Ci({onSuggestionsClick:e}){let{t}=T(`openhands`),{shouldHideSuggestions:n}=W();return(0,X.jsx)(s,{children:!n&&(0,X.jsxs)(z.div,{"data-testid":`chat-suggestions`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:`easeInOut`},className:`pointer-events-auto absolute inset-x-4 bottom-[151px] top-0 flex flex-col items-center justify-center md:inset-x-8`,children:[(0,X.jsx)(`div`,{className:`flex flex-col items-center p-4 rounded-xl w-full`,children:(0,X.jsx)(`span`,{className:`pb-6 text-[32px] font-medium leading-5 text-white`,children:t(E.LANDING$TITLE)})}),(0,X.jsx)(hi,{suggestions:Object.entries(Si.repo).slice(0,4).map(([e,t])=>({label:e,value:t})),onSuggestionClick:e})]})})}var wi={files:[],initialPrompt:null,selectedRepository:null,selectedRepositoryProvider:null,replayJson:null},Ti=rt(e=>({...wi,addFile:t=>e(e=>({files:[...e.files,t]})),removeFile:t=>e(e=>({files:e.files.filter((e,n)=>n!==t)})),clearFiles:()=>e(()=>({files:[]})),setInitialPrompt:t=>e(()=>({initialPrompt:t})),clearInitialPrompt:()=>e(()=>({initialPrompt:null})),setSelectedRepository:t=>e(()=>({selectedRepository:t})),clearSelectedRepository:()=>e(()=>({selectedRepository:null})),setSelectedRepositoryProvider:t=>e(()=>({selectedRepositoryProvider:t})),setReplayJson:t=>e(()=>({replayJson:t})),reset:()=>e(()=>wi)})),Ei=e=>(0,X.jsx)(`svg`,{width:12,height:17,viewBox:`0 0 12 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,X.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.5304 6.46978L10.4697 7.53044L6.75006 3.81077L6.75006 17.0001H5.25006L5.25006 3.81077L1.53039 7.53044L0.469727 6.46978L6.00006 0.939453L11.5304 6.46978Z`,fill:`currentColor`})});function Di({onClick:e}){return(0,X.jsx)(`button`,{type:`button`,onClick:e,"data-testid":`scroll-to-bottom`,className:`flex items-center justify-center size-8 rounded-full bg-[var(--oh-surface)] text-[var(--oh-muted)] hover:bg-tertiary hover:text-white rotate-180 cursor-pointer transition-colors`,children:(0,X.jsx)(Ei,{width:15,height:15})})}var Oi=[{width:`w-[25%]`,height:`h-4`,align:`justify-end`},{width:`w-[60%]`,height:`h-4`,align:`justify-start`},{width:`w-[45%]`,height:`h-4`,align:`justify-start`},{width:`w-[65%]`,height:`h-20`,align:`justify-start`},{width:`w-[35%]`,height:`h-4`,align:`justify-end`},{width:`w-[50%]`,height:`h-4`,align:`justify-start`},{width:`w-[30%]`,height:`h-4`,align:`justify-end`},{width:`w-[75%]`,height:`h-4`,align:`justify-start`},{width:`w-[55%]`,height:`h-4`,align:`justify-start`}];function ki({width:e,height:t}){return(0,X.jsx)(`div`,{className:U(`rounded-md bg-foreground/5 animate-pulse`,e,t)})}function Ai(){let{t:e}=T(`openhands`);return(0,X.jsx)(`div`,{className:`flex flex-col gap-6 p-4 w-full h-full overflow-hidden`,"data-testid":`chat-messages-skeleton`,"aria-label":e(E.CHAT_INTERFACE$LOADING_CONVERSATION),children:Oi.map((e,t)=>(0,X.jsx)(`div`,{className:U(`flex w-full`,e.align),children:(0,X.jsx)(ki,{width:e.width,height:e.height})},t))})}var ji=220;function Mi({message:e,code:t,onDismiss:n,onRetry:r,onReauth:i}){let{t:a,i18n:o}=T(`openhands`),s=Tr(t),[c,l]=Z.useState(!1),[u,d]=Z.useState(!1),[f,p]=Z.useState(!1),m=Z.useRef(null),h=o.exists(e,{ns:`openhands`}),g=h?String(a(e)):e,_=g.length>ji,v=_&&!c;return Z.useEffect(()=>{if(!f)return;let e=setTimeout(()=>{p(!1)},2e3);return()=>clearTimeout(e)},[f]),Z.useEffect(()=>{p(!1)},[g]),Z.useLayoutEffect(()=>{let e=m.current;if(!e)return;let t=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(t)||t<=0){d(!1);return}d(e.getBoundingClientRect().height>t*1.5)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[g,v,c,e]),(0,X.jsxs)(`div`,{className:U(`flex w-full gap-2 rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface-raised)] p-2 text-[var(--oh-foreground)]`,u?`items-start`:`items-center`),"data-testid":`error-message-banner`,children:[(0,X.jsx)(x,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:we},"data-testid":`error-message-banner-icon`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s&&(0,X.jsx)(`div`,{className:`text-sm font-medium text-[var(--oh-foreground)]`,"data-testid":`error-message-banner-header`,children:a(s)}),(0,X.jsx)(`div`,{ref:m,className:U(`whitespace-pre-wrap break-words text-sm text-[var(--oh-muted)]`,v&&`line-clamp-3`),"data-testid":`error-message-banner-content`,children:h?(0,X.jsx)(w,{ns:`openhands`,i18nKey:e}):e}),i&&(0,X.jsx)(`button`,{type:`button`,onClick:i,className:`mt-2 cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`error-message-banner-reauth`,children:a(E.ERROR$ACP_UPDATE_CREDENTIALS)}),_&&(0,X.jsx)(`button`,{type:`button`,className:`mt-1 cursor-pointer text-xs font-normal text-[var(--oh-foreground)] underline`,onClick:()=>l(e=>!e),"data-testid":`error-message-banner-toggle`,children:a(c?E.COMMON$VIEW_LESS:E.COMMON$VIEW_MORE)})]}),(0,X.jsxs)(`div`,{className:U(`flex shrink-0 gap-1`,u?`self-start`:`items-center`),children:[r&&(0,X.jsx)(`button`,{type:`button`,onClick:r,className:`cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`error-message-banner-retry`,children:a(E.CHAT_INTERFACE$MESSAGE_RETRY)}),(0,X.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(g),p(!0)}catch{D(a(E.CHAT_INTERFACE$CHAT_MESSAGE_COPY_FAILED))}},className:`shrink-0 cursor-pointer rounded-md p-1 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-[var(--oh-foreground)]`,"aria-label":a(f?E.BUTTON$COPIED:E.BUTTON$COPY),"data-testid":`error-message-banner-copy`,children:f?(0,X.jsx)(ge,{className:`h-4 w-4`,"aria-hidden":!0}):(0,X.jsx)(ve,{className:`h-4 w-4`,"aria-hidden":!0})}),n&&(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`shrink-0 cursor-pointer rounded-md p-1 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-[var(--oh-foreground)]`,"aria-label":a(E.BUTTON$CLOSE),"data-testid":`error-message-banner-dismiss`,children:(0,X.jsx)(xe,{className:`h-4 w-4`,"aria-hidden":!0})})]})]})}function Ni(){let{t:e}=T(`openhands`),{conversationId:t}=_n(),n=Y(e=>e.pendingMessages),r=Y(e=>e.markPendingMessageError),i=Y(e=>e.markPendingMessageSending),a=Y(e=>e.removePendingMessage),o=W(e=>e.restoreMessageToInputIfEmpty),{send:s}=te(),c=Z.useMemo(()=>t?n.filter(e=>Kt(t,e.conversationId)):[],[n,t]),l=Z.useCallback(async t=>{let n=Y.getState().pendingMessages.find(e=>e.id===t);if(n){i(t);try{await s(he(n.text,n.imageUrls,n.fileUrls,n.timestamp))}catch(n){r(t,n instanceof Error?n.message:e(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}}},[s,r,i,e]),u=Z.useCallback((e,t)=>{o(t),a(e)},[o,a]);return c.length===0?null:(0,X.jsx)(X.Fragment,{children:c.map(e=>(0,X.jsx)(pe,{type:`user`,message:e.text,pendingStatus:e.status,onRetry:e.status===`error`?()=>l(e.id):void 0,onStop:e.status===`sending`?()=>u(e.id,e.text):void 0,children:e.imageUrls.length>0&&(0,X.jsx)(F,{size:`small`,images:e.imageUrls})},e.id))})}var Pi=()=>{let{data:e}=J();return S({mutationKey:[`unified-upload-files`],mutationFn:async t=>{let{conversationId:n,files:r}=t;return Dt(n,r,e)},meta:{disableToast:!0}})},Fi=e=>(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,X.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3.25C9.92893 3.25 8.25 4.92893 8.25 7V10H7C6.44772 10 6 10.4477 6 11V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V11C18 10.4477 17.5523 10 17 10H15.75V7C15.75 4.92893 14.0711 3.25 12 3.25ZM14.25 10V7C14.25 5.75736 13.2426 4.75 12 4.75C10.7574 4.75 9.75 5.75736 9.75 7V10H14.25Z`,fill:`currentColor`})});function Ii(){let{t:e}=T(`openhands`),{data:t}=ct();return t?.confirmation_mode?(0,X.jsx)(Je,{closeDelay:100,content:e(E.COMMON$CONFIRMATION_MODE_ENABLED),tooltipClassName:`bg-white text-black hover:bg-transparent`,children:(0,X.jsx)(`div`,{className:`flex items-center justify-center w-[26px] h-[26px] rounded-lg bg-[var(--oh-surface)]`,children:(0,X.jsx)(Fi,{width:15,height:15})})}):null}var Li=e=>(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,X.jsx)(`path`,{d:`M15 12C15 12.7956 14.6839 13.5587 14.1213 14.1213C13.5587 14.6839 12.7956 15 12 15C11.2044 15 10.4413 14.6839 9.87868 14.1213C9.31607 13.5587 9 12.7956 9 12C9 11.2044 9.31607 10.4413 9.87868 9.87868C10.4413 9.31607 11.2044 9 12 9C12.7956 9 13.5587 9.31607 14.1213 9.87868C14.6839 10.4413 15 11.2044 15 12Z`,fill:`currentColor`})});function Ri({status:e,statusColor:t}){return(0,X.jsx)(`div`,{"data-testid":`chat-status-indicator`,className:c(`w-full max-w-full rounded-[100px] p-1 bg-[var(--oh-surface)] flex items-center gap-1`),children:(0,X.jsxs)(s,{mode:`wait`,children:[(0,X.jsx)(z.span,{className:`flex-shrink-0 animate-[pulse_1.2s_ease-in-out_infinite]`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},children:(0,X.jsx)(Li,{className:`w-4 h-4`,color:t})},`dot-${e}`),(0,X.jsx)(z.span,{initial:{opacity:0,y:-2},animate:{opacity:1,y:0},exit:{opacity:0,y:2},transition:{duration:.3},className:`pr-1.5 font-normal text-[11px] leading-[16px] normal-case break-words whitespace-normal`,children:e},`text-${e}`)]})})}var zi=()=>{let e=m(),{navigate:t}=qe(),{t:n}=T(`openhands`),{data:r}=J(),{trackConversationCreated:i}=lt();return S({mutationFn:async()=>{if(!r?.id)throw Error(`No active conversation`);let e=await pt.createConversation(void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,r.sandbox_id??void 0);if(e.status===`ERROR`)throw Error(e.detail||`Failed to create new conversation`);return{newConversationId:e.app_conversation_id?e.app_conversation_id:`task-${e.id}`,oldConversationId:r.id,taskId:e.id}},onMutate:()=>{b.loading(n(E.CONVERSATION$CLEARING),{...ee,id:`clear-conversation`})},onSuccess:r=>{i({conversationId:r.newConversationId,taskId:r.taskId,hasRepository:!1,hasWorkspace:!1,hasInitialQuery:!1,hasParentConversation:!1,entryPoint:`new_command`}),b.dismiss(`clear-conversation`),k(n(E.CONVERSATION$CLEAR_SUCCESS)),t(`/conversations/${r.newConversationId}`),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`v1-batch-get-app-conversations`]})},onError:e=>{b.dismiss(`clear-conversation`);let t=n(E.CONVERSATION$CLEAR_UNKNOWN_ERROR);e instanceof Error?t=e.message:typeof e==`string`&&(t=e),D(n(E.CONVERSATION$CLEAR_FAILED,{error:t}))}})};function Bi(e,t){return e?`github`:t?`replay`:`direct`}function Vi(){let{trackInitialQuerySubmitted:e,trackUserMessageSent:t}=lt(),{setMessageToSend:n}=W(),{errorMessage:r,errorCode:i,removeErrorMessage:a,setErrorMessage:o}=Cn(),s=f(),{isTask:c,taskStatus:l,taskDetail:u}=Wt(),d=c,p=Dn(),{send:m}=te(),{renderableEvents:h,allConversationEvents:g,totalEvents:_,hasSubstantiveAgentActions:v,userEventsExist:y}=ui(),b=Y(e=>e.enqueuePendingMessage),x=Y(e=>e.markPendingMessageError),S=Y(e=>e.pendingMessages),{t:C}=T(`openhands`),w=Z.useRef(null),{scrollDomToBottom:O,onChatBodyScroll:k,hitBottom:ee,autoScroll:A,setAutoScroll:j,setHitBottom:M}=Yn(w),{mutate:N,isPending:P}=zi(),{curAgentState:F}=vn(),{handleBuildPlanClick:ne}=re(),{data:I}=J(),ae=I?.sandbox_status??null,L=hn(),{isConfigured:oe,isLoading:se}=ln(),ce=!se&&!oe,ue=F===H.RUNNING||F===H.LOADING;Z.useEffect(()=>{if(ue)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),ne(e),O())};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[ue,ne,O]);let{selectedRepository:de,replayJson:pe}=Ti(),{conversationId:R}=_n(),me=En(e=>{let t=R?e.statusByConversation[R]:void 0;return t?.active?`${t.iteration}:${t.status}`:null}),{mutateAsync:ge}=Pi(),{isLoading:_e,hasMore:z,loadOlder:ve}=fi(R),B=Z.useRef(null),V=Z.useCallback(e=>{if(d||_e||!z)return;let t=e.scrollTop<=80,n=e.scrollHeight<=e.clientHeight+80;!t&&!n||(B.current={scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},ve().catch(e=>{B.current=null,o(e instanceof Error&&e.message?e.message:C(E.ERROR$GENERIC))}))},[z,_e,d,ve,o,C]),ye=Z.useCallback(e=>{e.deltaY<0&&e.currentTarget.scrollTop<=0&&V(e.currentTarget)},[V]),be=Z.useMemo(()=>R?S.some(e=>Kt(R,e.conversationId)):!1,[S,R]),xe=g.length>0||be||!p?.isLoadingHistory,Se=!!R,Ce=!xe&&!c,we=Sn(e=>R?(e.entriesByConversation[R]?.length??0)>0:!1),Te=async(r,i,a)=>{if(r.trim()===`/new`){if(!R){D(C(E.CONVERSATION$CLEAR_NO_ID));return}if(_===0){D(C(E.CONVERSATION$CLEAR_EMPTY));return}if(P)return;N();return}let o=[...i],s=[...a];_===0?e({entryPoint:Bi(de!==null,pe!==null),queryCharacterLength:r.length,replayJsonSize:pe?.length}):t({sessionMessageCount:_,currentMessageLength:r.length});let c=Vt([...o,...s]);if(!c.isValid){D(`Error: ${c.errorMessage}`);return}let l=o.map(e=>Ht(e)),u=await Promise.all(l),d=new Date().toISOString(),{skipped_files:f,uploaded_files:p}=s.length>0?await ge({conversationId:R,files:s}):{skipped_files:[],uploaded_files:[]};f.forEach(e=>D(e.reason));let h=`${C(E.CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE)}: ${p.join(`
|
|
18
18
|
|
|
19
|
-
`)}`,g=p.length>0?`${r}\n\n${h}`:r,v=b({conversationId:R,text:r,content:g,imageUrls:u,fileUrls:p,timestamp:d});O(),n(``);try{await m(he(g,u,p,d))}catch(e){x(v,e instanceof Error?e.message:C(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}};Z.useEffect(()=>{if(B.current&&w.current){let{scrollHeight:e,scrollTop:t}=B.current,n=w.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),B.current=null;return}A&&O()},[h.length,be,me,O]);let Ee=Z.useRef(V);Z.useEffect(()=>{Ee.current=V}),Z.useEffect(()=>{let e=w.current;e&&Ee.current(e)},[h.length,z]);let De={scrollRef:w,autoScroll:A,setAutoScroll:j,scrollDomToBottom:O,hitBottom:ee,setHitBottom:M,onChatBodyScroll:k},Oe=F===H.LOADING||F===H.INIT,Ae=F===H.STOPPED,je=F===H.PAUSED,Me=Pe({isPausing:je,isTask:c,taskStatus:l,isStartingStatus:Oe,isStopStatus:Ae,curAgentState:F}),Ne=ke({isPausing:je,isTask:c,taskStatus:l,taskDetail:u,isStartingStatus:Oe,isStopStatus:Ae,curAgentState:F,errorMessage:r,t:C});return(0,X.jsx)(le,{value:De,children:(0,X.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!v&&!be&&!y&&!we&&!Ce&&!d&&_===0&&!L&&!ce&&(0,X.jsx)(Ci,{onSuggestionsClick:e=>n(e)}),(0,X.jsxs)(`div`,{ref:w,"data-testid":`chat-scroll-container`,onScroll:e=>{k(e.currentTarget),V(e.currentTarget)},onWheel:ye,className:`custom-scrollbar-always flex min-h-0 grow flex-col gap-2 overflow-x-hidden overflow-y-auto px-0 pt-4 pb-8 md:px-4`,children:[Ce&&Se&&(0,X.jsx)(Ai,{}),Ce&&!Se&&(0,X.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,X.jsx)(Ke,{size:`small`})}),_e&&(0,X.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-3 text-sm text-neutral-400`,"data-testid":`loading-older-events`,children:[(0,X.jsx)(Ke,{size:`small`}),(0,X.jsx)(`span`,{children:C(E.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,X.jsx)(ie,{conversationId:R,anchorEventId:null}),xe&&h.length>0&&(0,X.jsx)(fe,{messages:h,allEvents:g}),(0,X.jsx)(Ni,{}),(0,X.jsx)(Mr,{conversationId:R})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px] pb-4`,children:[(0,X.jsx)(jr,{conversationId:R}),r&&(0,X.jsx)(Mi,{message:r,code:i,onDismiss:a,onRetry:r===`Unable to connect to server`?()=>p?.reconnect():void 0,onReauth:Er(i)?()=>s(`/settings/agents`):void 0}),ce&&!L&&(0,X.jsx)(dn,{}),L?(0,X.jsxs)(`div`,{"data-testid":`archived-conversation-banner`,className:`mx-1 px-4 py-3 rounded-lg bg-[var(--oh-surface)] border border-[var(--oh-border-subtle)]`,children:[(0,X.jsx)(`p`,{className:`text-xs font-semibold text-[var(--oh-foreground)]`,children:C(ae===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,X.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:C(ae===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_DESCRIPTION)})]}):(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full mb-1 z-20`,children:(0,X.jsxs)(`div`,{className:`flex justify-between relative`,children:[(0,X.jsxs)(`div`,{className:`flex items-end gap-1 pointer-events-auto`,children:[(0,X.jsx)(Ii,{}),Oe&&(0,X.jsx)(Ri,{statusColor:Me,status:Ne})]}),ee?F===H.RUNNING&&(0,X.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,X.jsx)(pi,{})}):(0,X.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,X.jsx)(Di,{onClick:O})})]})}),(0,X.jsx)(li,{onSubmit:Te,disabled:P||ce})]})]})]})})}function Hi({isRightPanelShown:e}){return(0,X.jsx)(`div`,{className:`flex justify-center w-full h-full`,children:(0,X.jsx)(`div`,{className:`w-full min-w-0 max-w-[800px] h-full flex flex-col min-h-0 transition-all duration-300 ease-in-out`,children:(0,X.jsx)(Vi,{})})})}function Ui({children:e}){return(0,X.jsx)(`div`,{className:`absolute inset-0`,children:e})}function Wi({children:e}){return(0,X.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function Gi({children:e}){return(0,X.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}function Ki({className:e}){let{t}=T(`openhands`);return(0,X.jsxs)(`div`,{className:U(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,X.jsx)(ye,{className:`h-8 w-8 shrink-0 animate-spin text-tertiary-light`,"aria-hidden":!0}),(0,X.jsx)(ne,{as:`p`,role:`status`,"aria-live":`polite`,className:`block w-full text-center text-base font-normal leading-5`,duration:1,spread:2,children:t(E.HOME$LOADING)})]})}function qi({children:e,onReady:t}){return(0,Z.useLayoutEffect)(()=>{t()},[t]),e}function Ji({onPending:e}){return(0,Z.useLayoutEffect)(()=>{e()},[e]),(0,X.jsx)(Ki,{})}var Yi={duration:.35,ease:`easeInOut`};function Xi({showAgentLoading:e,tabKey:t,children:n}){let r=M(),[i,a]=(0,Z.useState)(!1);(0,Z.useLayoutEffect)(()=>{a(!1)},[t]);let o=(0,Z.useCallback)(()=>{a(!0)},[]),c=(0,Z.useCallback)(()=>{a(!1)},[]),l=e||i;return r?(0,X.jsx)(`div`,{className:`relative h-full w-full overflow-hidden`,children:l?(0,X.jsx)(Ki,{}):(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(Ji,{onPending:o}),children:(0,X.jsx)(qi,{onReady:c,children:n})})}):(0,X.jsxs)(`div`,{className:`relative h-full w-full overflow-hidden`,children:[(0,X.jsx)(z.div,{className:`absolute inset-0 h-full w-full`,initial:!1,animate:{opacity:+!l},transition:Yi,"aria-hidden":l,children:(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(Ji,{onPending:o}),children:(0,X.jsx)(qi,{onReady:c,children:n})})}),(0,X.jsx)(s,{children:l?(0,X.jsx)(z.div,{className:`absolute inset-0 z-10 h-full w-full`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:Yi,children:(0,X.jsx)(Ki,{})},`conversation-tab-loading-overlay`):null})]})}var Zi=(0,Z.lazy)(()=>n(()=>import(`./files-tab-DDtEJcGE.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61]))),Qi=(0,Z.lazy)(()=>n(()=>import(`./browser-tab-CkkqJnqw.js`),__vite__mapDeps([62,2,1,63,7,8,18,64,13,42,10,11,65,26]))),$i=(0,Z.lazy)(()=>n(()=>import(`./planner-tab-CCqdXxkL.js`),__vite__mapDeps([66,1,2,67,7,8,18,42,10,11,44,22,20,21,23,24,45,13,19,25,46,47,48,68,69,70,71,3,4,5,6,9,72,73,74,15,16,30,27,28,14,29,31,32,33,34,35,36,75,76,77,78,79,80,49,50,51,52,81,82,26,60]))),ea=(0,Z.lazy)(()=>n(()=>import(`./task-list-tab-0k9PhuqO.js`),__vite__mapDeps([83,1,2,8,18,42,10,11,84,37,26,85,86,40,41]))),ta=(0,Z.lazy)(()=>n(()=>import(`./terminal-BsGcSpRS.js`),__vite__mapDeps([87,1,2,88,89,90,7,8,18,38,39,10,11,40,41,42,53,49,50,4,14,27,3,5,6,9,28,29,30,31,32,33,34,35,36,51,52,15,16,54,26,91]))),na={tasklist:{component:ea},files:{component:Zi},browser:{component:Qi},terminal:{component:ta},planner:{component:$i}};function ra(){let{selectedTab:e,shouldShownAgentLoading:t}=W(),{conversationId:n}=q(),r=(0,Z.useMemo)(()=>na[e]??na.files,[e]).component,i=e===`terminal`?`${e}-${n}`:e??`files`;return(0,X.jsx)(Wi,{children:(0,X.jsx)(Gi,{children:(0,X.jsx)(Xi,{showAgentLoading:t,tabKey:i,children:(0,X.jsx)(Ui,{children:(0,X.jsx)(r,{})},i)})})})}var ia=()=>{let e=m(),t=Cn(e=>e.removeErrorMessage);return S({mutationKey:[`start-conversation`],mutationFn:async e=>g(e.conversationId),onMutate:async()=>(await e.cancelQueries({queryKey:[`user`,`conversations`]}),{previousConversations:e.getQueryData([`user`,`conversations`])}),onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:(t,n,r)=>{h(e,r.conversationId)},onSuccess:(n,r)=>{t(),_(e,r.conversationId,Le.RUNNING)}})},aa=e=>(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,X.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM10 9H14A1 1 0 0 1 15 10V14A1 1 0 0 1 14 15H10A1 1 0 0 1 9 14V10A1 1 0 0 1 10 9Z`,fill:`currentColor`})}),oa=e=>(0,X.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.9 1.50004C15.3 1.65004 17.55 2.85004 19.2 4.50004C21.15 6.60004 22.2 9.15004 22.2 12.15C22.2 14.55 21.3 16.8 19.8 18.75C18.3 20.55 16.2 21.9 13.8 22.35C11.4 22.8 9 22.5 6.9 21.3C4.8 20.1 3.15 18.3 2.25 16.05C1.35 13.8 1.2 11.25 1.95 9.00004C2.7 6.60004 4.05 4.65004 6.15 3.30004C8.1 1.95004 10.5 1.35004 12.9 1.50004ZM13.65 20.85C15.6 20.4 17.4 19.35 18.75 17.7C19.95 16.05 20.7 14.1 20.55 12C20.55 9.60004 19.65 7.20004 18 5.55004C16.5 4.05004 14.7 3.15004 12.6 3.00004C10.65 2.85004 8.55 3.30004 6.9 4.50004C5.25 5.70004 4.05 7.35004 3.45 9.45004C2.85 11.4 2.85 13.5 3.75 15.45C4.65 17.4 6 18.9 7.8 19.95C9.6 21 11.7 21.3 13.65 20.85Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 7.49998L10.1655 6.87598L16.9155 11.376V12.624L10.1655 17.124L9 16.5V7.49998ZM10.5 8.90098V15.099L15.1485 12L10.5 8.90098Z`,fill:`currentColor`})]});function sa({icon:e,text:t,onClick:n,testId:r}){return(0,X.jsx)(G,{testId:r,onClick:n,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 w-full items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,X.jsx)(`span`,{className:Xe,"aria-hidden":!0,children:e})]})})}function ca({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=vn(),{isTask:i,taskStatus:a,taskDetail:o}=Wt(),{t:s}=T(`openhands`),{errorMessage:c}=Cn(),l=r===H.LOADING||r===H.INIT,u=Ie(t)||Te(t),d=Pe({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=ke({isPausing:n,isTask:i,taskStatus:a,taskDetail:o,isStartingStatus:l,isStopStatus:u,curAgentState:r,errorMessage:c,t:s});return(0,X.jsx)(`div`,{className:e,"data-testid":`server-status`,children:(0,X.jsxs)(`div`,{className:`flex items-center`,children:[(0,X.jsx)(Li,{className:`w-6 h-6 shrink-0`,color:d}),(0,X.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function la({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=T(`openhands`),c=Tt(e),l=De(r),u=Te(r),d=l||u;return(0,X.jsxs)(kt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:U(`left-2 w-fit min-w-42`,a),children:[(0,X.jsx)(ca,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ze,{inset:`menu`}),l&&t&&(0,X.jsx)(sa,{icon:(0,X.jsx)(aa,{width:18,height:18}),text:s(E.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,X.jsx)(sa,{icon:(0,X.jsx)(oa,{width:18,height:18}),text:s(E.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var ua=e(l(),1);function da({isPublic:e,onToggle:t,ariaLabel:n}){return(0,X.jsxs)(`label`,{className:`relative inline-flex shrink-0 cursor-pointer items-center`,children:[(0,X.jsx)(`input`,{hidden:!0,type:`checkbox`,"data-testid":`share-publicly-button`,checked:e,"aria-label":n,onChange:e=>t(e.target.checked)}),(0,X.jsx)(`span`,{"aria-hidden":!0,className:U(`inline-flex h-3.5 w-7 items-center rounded-full px-0.5 py-px transition-colors duration-200 ease-in-out`,e?`bg-white`:`bg-base-secondary`),children:(0,X.jsx)(`span`,{className:U(`block h-2 w-2 shrink-0 rounded-full transition-transform duration-200 ease-in-out`,e?`translate-x-[calc(1rem-1px)] bg-base-secondary`:`translate-x-px bg-tertiary-light`)})})]})}function fa({onClose:e,onRename:t,onDelete:n,onStop:r,onDisplayCost:i,onShowAgentTools:a,onShowSkills:o,onShowHooks:s,onTogglePublic:c,onCopyShareLink:l,onExportTranscript:u,onDownloadConversation:d,shareUrl:f,position:p=`bottom`,anchorRef:m}){let h=Xn(),{t:g}=T(`openhands`),{backend:_}=A(),{data:v}=J(),y=hn(),b=Tt(e),x=m?.current??null,[S,C]=Z.useState();Z.useLayoutEffect(()=>{if(!x)return;let e=()=>{let e=x.getBoundingClientRect();if(!e)return;let t={position:`fixed`,zIndex:9999};p===`top`?t.bottom=window.innerHeight-e.top+8:t.top=e.bottom+8,t.left=e.left,C(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[x,p]);let w=!!(a||o||s),D=!!i,O=!!(r||n),k=_.kind===`cloud`?E.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:E.COMMON$STOP_CONVERSATION,ee=_.kind===`cloud`&&!!c,j=v?.public||!1,M=!!x,N=(0,X.jsxs)(kt,{ref:b,testId:`conversation-name-context-menu`,position:p,alignment:`left`,className:U(h?`right-0 translate-x-[34%] left-auto`:``,M?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,X.jsx)(G,{testId:`rename-button`,onClick:t,children:(0,X.jsx)(K,{icon:(0,X.jsx)(Mt,{width:16,height:16}),text:g(E.BUTTON$RENAME)})}),w&&(0,X.jsx)(Ze,{testId:`separator-tools`,inset:`menu`}),o&&(0,X.jsx)(Qt,{isDisabled:y,children:(0,X.jsx)(G,{testId:`show-skills-button`,onClick:o,isDisabled:y,children:(0,X.jsx)(K,{icon:(0,X.jsx)(Nt,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:g(E.CONVERSATION$SHOW_SKILLS)})})}),s&&(0,X.jsx)(Qt,{isDisabled:y,children:(0,X.jsx)(G,{testId:`show-hooks-button`,onClick:s,isDisabled:y,children:(0,X.jsx)(K,{icon:(0,X.jsx)(an,{width:16,height:16,"aria-hidden":!0}),text:g(E.CONVERSATION$SHOW_HOOKS)})})}),a&&(0,X.jsx)(Qt,{isDisabled:y,children:(0,X.jsx)(G,{testId:`show-agent-tools-button`,onClick:a,isDisabled:y,children:(0,X.jsx)(K,{icon:(0,X.jsx)(tt,{width:16,height:16}),text:g(E.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})})}),u&&(0,X.jsx)(G,{testId:`export-transcript-button`,onClick:u,children:(0,X.jsx)(K,{icon:(0,X.jsx)(ht,{width:16,height:16}),text:g(E.BUTTON$EXPORT_TRANSCRIPT)})}),d&&(0,X.jsx)(G,{testId:`download-trajectory-button`,onClick:d,children:(0,X.jsx)(K,{icon:(0,X.jsx)(ht,{width:16,height:16}),text:g(E.BUTTON$DOWNLOAD_CONVERSATION_DATA)})}),(D||O)&&(0,X.jsx)(Ze,{testId:`separator-info-control`,inset:`menu`}),i&&(0,X.jsx)(G,{testId:`display-cost-button`,onClick:i,children:(0,X.jsx)(K,{icon:(0,X.jsx)(St,{width:16,height:16}),text:g(E.BUTTON$DISPLAY_COST)})}),ee&&c&&(0,X.jsxs)(`li`,{className:`flex w-full items-center gap-2 rounded px-2 py-2 hover:bg-[var(--oh-interactive-hover)]`,children:[(0,X.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)]`,"aria-hidden":!0,children:(0,X.jsx)(er,{size:16})}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:g(E.CONVERSATION$SHARE_PUBLICLY)}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[j&&f&&l&&(0,X.jsxs)(`div`,{className:`mr-2 flex items-center gap-0.5`,children:[(0,X.jsx)(`button`,{type:`button`,"data-testid":`copy-share-link-button`,onClick:l,className:`rounded p-0.5 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(E.BUTTON$COPY_TO_CLIPBOARD),children:(0,X.jsx)(It,{width:14,height:14})}),(0,X.jsx)(`a`,{"data-testid":`open-share-link-button`,href:f,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`rounded p-0.5 text-[var(--oh-muted)] no-underline visited:text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(E.BUTTON$OPEN_IN_NEW_TAB),children:(0,X.jsx)(B,{size:14,"aria-hidden":!0})})]}),(0,X.jsx)(da,{isPublic:j,onToggle:c,ariaLabel:g(E.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,X.jsx)(Qt,{isDisabled:y,children:(0,X.jsx)(G,{testId:`stop-button`,onClick:r,isDisabled:y,children:(0,X.jsx)(K,{icon:(0,X.jsx)(Qe,{width:16,height:16}),text:g(k)})})}),n&&(0,X.jsx)(G,{testId:`delete-button`,onClick:n,children:(0,X.jsx)(K,{icon:(0,X.jsx)(At,{width:16,height:16}),text:g(E.COMMON$DELETE_CONVERSATION)})})]});return M?typeof document>`u`||!S?null:ua.createPortal((0,X.jsx)(`div`,{style:S,children:N}),document.body):N}function pa({onClose:e}){let{t}=T(`openhands`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(st,{onClose:e,testId:`close-metrics-modal`}),(0,X.jsx)(`div`,{className:`w-full pr-6`,children:(0,X.jsx)(We,{title:t(E.CONVERSATION$METRICS_INFO)})})]})}function ma({currentCost:e,maxBudget:t}){let n=e/t*100;return(0,X.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden mt-1`,children:(0,X.jsx)(`div`,{className:U(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function ha({currentCost:e,maxBudget:t}){let{t:n}=T(`openhands`),r=e/t*100;return(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(E.CONVERSATION$USED)})})})}function ga({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,X.jsx)(`div`,{className:`border-b border-[var(--oh-border-subtle)]`,children:t!==null&&t>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ma,{currentCost:e,maxBudget:t}),(0,X.jsx)(ha,{currentCost:e,maxBudget:t})]}):(0,X.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$NO_BUDGET_LIMIT)})})}function _a({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex justify-between items-center pb-2`,children:[(0,X.jsx)(`span`,{className:`text-lg font-semibold`,children:n(E.CONVERSATION$TOTAL_COST)}),(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,X.jsx)(ga,{cost:e,maxBudgetPerTask:t})]})}function va({label:e,value:t,labelClassName:n=``,valueClassName:r=`font-semibold`}){return(0,X.jsxs)(`div`,{className:`flex justify-between items-center border-b border-[var(--oh-border-subtle)] pb-2`,children:[(0,X.jsx)(`span`,{className:n,children:e}),(0,X.jsx)(`span`,{className:r,children:t})]})}function ya({usage:e}){let{t}=T(`openhands`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(va,{label:t(E.CONVERSATION$INPUT),value:e.prompt_tokens.toLocaleString()}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pl-4 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_HIT)}),(0,X.jsx)(`span`,{className:`text-right`,children:e.cache_read_tokens.toLocaleString()}),(0,X.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_WRITE)}),(0,X.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,X.jsx)(va,{label:t(E.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,X.jsx)(va,{label:t(E.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function ba({perTurnToken:e,contextWindow:t}){let{t:n}=T(`openhands`),r=t>0?e/t*100:0,i=Math.min(100,r);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,X.jsx)(`span`,{className:`font-semibold`,children:n(E.CONVERSATION$CONTEXT_WINDOW)})}),(0,X.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden`,children:(0,X.jsx)(`div`,{className:`h-full bg-foreground transition-all duration-300`,style:{width:`${i}%`}})}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsxs)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` (`,r.toFixed(2),`% `,n(E.CONVERSATION$USED),`)`]})})]})}function xa(){let{t:e}=T(`openhands`);return(0,X.jsx)(`div`,{className:`text-center`,children:(0,X.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(E.CONVERSATION$NO_METRICS)})})}function Sa(e){let{stats:t}=e;if(!t?.usage_to_metrics)return{accumulated_cost:0,max_budget_per_task:null,accumulated_token_usage:null};let n=0,r=null,i=null;for(let e of Object.values(t.usage_to_metrics))n+=e.accumulated_cost,r===null&&e.max_budget_per_task!==null&&(r=e.max_budget_per_task),e.accumulated_token_usage&&(i=i===null?{...e.accumulated_token_usage}:{prompt_tokens:i.prompt_tokens+e.accumulated_token_usage.prompt_tokens,completion_tokens:i.completion_tokens+e.accumulated_token_usage.completion_tokens,cache_read_tokens:i.cache_read_tokens+e.accumulated_token_usage.cache_read_tokens,cache_write_tokens:i.cache_write_tokens+e.accumulated_token_usage.cache_write_tokens,context_window:Math.max(i.context_window,e.accumulated_token_usage.context_window),per_turn_token:Math.max(i.per_turn_token,e.accumulated_token_usage.per_turn_token)});return{accumulated_cost:n,max_budget_per_task:r,accumulated_token_usage:i}}var Ca=(e,t,n,r=!0)=>{let i=C({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return Sa(await pt.getRuntimeConversation(e,t,n))},enabled:r&&!!e&&!!t,staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,retry:!1});return{data:i.data,isLoading:i.isLoading,error:i.error}};function wa({isOpen:e,onOpenChange:t}){let n=kn(),{data:r}=J(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=Ca(i,a,o,e),c=(0,Z.useMemo)(()=>s?{cost:s.accumulated_cost,max_budget_per_task:s.max_budget_per_task,usage:s.accumulated_token_usage?{prompt_tokens:s.accumulated_token_usage.prompt_tokens??0,completion_tokens:s.accumulated_token_usage.completion_tokens??0,cache_read_tokens:s.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:s.accumulated_token_usage.cache_write_tokens??0,context_window:s.accumulated_token_usage.context_window??0,per_turn_token:s.accumulated_token_usage.per_turn_token??0}:null}:n,[s,n]);return e?(0,X.jsx)(Ve,{onClose:()=>t(!1),children:(0,X.jsxs)(He,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,X.jsx)(pa,{onClose:()=>t(!1)}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(c?.cost!==null||c?.usage!==null)&&(0,X.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,X.jsxs)(`div`,{className:`grid gap-3`,children:[(0,X.jsx)(_a,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ya,{usage:c.usage}),(0,X.jsx)(ba,{perTurnToken:c.usage.per_turn_token,contextWindow:c.usage.context_window})]})]})}),!c?.cost&&!c?.usage&&(0,X.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,X.jsx)(xa,{})})]})]})}):null}var Ta=new Set([`BrowserClickAction`,`BrowserCloseTabAction`,`BrowserGetContentAction`,`BrowserGetStateAction`,`BrowserGoBackAction`,`BrowserListTabsAction`,`BrowserNavigateAction`,`BrowserScrollAction`,`BrowserSwitchTabAction`,`BrowserTypeAction`,`ExecuteBashAction`,`FileEditorAction`,`GlobAction`,`GrepAction`,`InvokeSkillAction`,`MCPToolAction`,`StrReplaceEditorAction`,`TaskAction`,`TaskTrackerAction`,`TerminalAction`,`ThinkAction`]),Ea=new Set([`BrowserObservation`,`CanvasUIObservation`,`ExecuteBashObservation`,`FileEditorObservation`,`GlobObservation`,`GrepObservation`,`InvokeSkillObservation`,`MCPToolObservation`,`StrReplaceEditorObservation`,`SwitchLLMObservation`,`TaskTrackerObservation`,`TaskObservation`,`TerminalObservation`]),Q=e=>e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim(),Da=(e,t=100)=>e.length>t?`${e.slice(0,t)}…`:e,Oa=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString()},$=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`),ka=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replace(/(!?)\[([^\]]*)\]\(\s*((?:javascript|data|vbscript):[^)]*)\)/gi,`$1\\[$2\\]($3)`).replace(/^(\s{0,3})\[([^\]]+)\]:(\s*<?(?:javascript|data|vbscript):)/gim,`$1\\[$2\\]:$3`),Aa=e=>Q(e||O.t(E.TRANSCRIPT_EXPORT$DEFAULT_TITLE))||O.t(E.TRANSCRIPT_EXPORT$DEFAULT_TITLE),ja=(e,t)=>Q(O.t(e,t).replace(/<\/?(?:cmd|path)>/g,``)),Ma=e=>/^[a-z][a-z0-9_]*\s*:\s*[[{]/i.test(e),Na=e=>e.replace(/(?:Action|Observation)$/,``).replace(/([a-z])([A-Z])/g,`$1 $2`).trim(),Pa=e=>{let t=Q(e.summary||``);return t&&!Ma(t)?t:Q(e.tool_name)||Na(e.action.kind)},Fa=(e,t)=>t?Pa(t):Q(e.tool_name)||Na(e.observation.kind),Ia=e=>e.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
19
|
+
`)}`,g=p.length>0?`${r}\n\n${h}`:r,v=b({conversationId:R,text:r,content:g,imageUrls:u,fileUrls:p,timestamp:d});O(),n(``);try{await m(he(g,u,p,d))}catch(e){x(v,e instanceof Error?e.message:C(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}};Z.useEffect(()=>{if(B.current&&w.current){let{scrollHeight:e,scrollTop:t}=B.current,n=w.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),B.current=null;return}A&&O()},[h.length,be,me,O]);let Ee=Z.useRef(V);Z.useEffect(()=>{Ee.current=V}),Z.useEffect(()=>{let e=w.current;e&&Ee.current(e)},[h.length,z]);let De={scrollRef:w,autoScroll:A,setAutoScroll:j,scrollDomToBottom:O,hitBottom:ee,setHitBottom:M,onChatBodyScroll:k},Oe=F===H.LOADING||F===H.INIT,Ae=F===H.STOPPED,je=F===H.PAUSED,Me=Pe({isPausing:je,isTask:c,taskStatus:l,isStartingStatus:Oe,isStopStatus:Ae,curAgentState:F}),Ne=ke({isPausing:je,isTask:c,taskStatus:l,taskDetail:u,isStartingStatus:Oe,isStopStatus:Ae,curAgentState:F,errorMessage:r,t:C});return(0,X.jsx)(le,{value:De,children:(0,X.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!v&&!be&&!y&&!we&&!Ce&&!d&&_===0&&!L&&!ce&&(0,X.jsx)(Ci,{onSuggestionsClick:e=>n(e)}),(0,X.jsxs)(`div`,{ref:w,"data-testid":`chat-scroll-container`,onScroll:e=>{k(e.currentTarget),V(e.currentTarget)},onWheel:ye,className:`custom-scrollbar-always flex min-h-0 grow flex-col gap-2 overflow-x-hidden overflow-y-auto px-0 pt-4 pb-8 md:px-4`,children:[Ce&&Se&&(0,X.jsx)(Ai,{}),Ce&&!Se&&(0,X.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,X.jsx)(Ke,{size:`small`})}),_e&&(0,X.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-3 text-sm text-neutral-400`,"data-testid":`loading-older-events`,children:[(0,X.jsx)(Ke,{size:`small`}),(0,X.jsx)(`span`,{children:C(E.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,X.jsx)(ie,{conversationId:R,anchorEventId:null}),xe&&h.length>0&&(0,X.jsx)(fe,{messages:h,allEvents:g}),(0,X.jsx)(Ni,{}),(0,X.jsx)(Mr,{conversationId:R})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px] pb-4`,children:[(0,X.jsx)(jr,{conversationId:R}),r&&(0,X.jsx)(Mi,{message:r,code:i,onDismiss:a,onRetry:r===`Unable to connect to server`?()=>p?.reconnect():void 0,onReauth:Er(i)?()=>s(`/settings/agents`):void 0}),ce&&!L&&(0,X.jsx)(dn,{}),L?(0,X.jsxs)(`div`,{"data-testid":`archived-conversation-banner`,className:`mx-1 px-4 py-3 rounded-lg bg-[var(--oh-surface)] border border-[var(--oh-border-subtle)]`,children:[(0,X.jsx)(`p`,{className:`text-xs font-semibold text-[var(--oh-foreground)]`,children:C(ae===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,X.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:C(ae===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_DESCRIPTION)})]}):(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full mb-1 z-20`,children:(0,X.jsxs)(`div`,{className:`flex justify-between relative`,children:[(0,X.jsxs)(`div`,{className:`flex items-end gap-1 pointer-events-auto`,children:[(0,X.jsx)(Ii,{}),Oe&&(0,X.jsx)(Ri,{statusColor:Me,status:Ne})]}),ee?F===H.RUNNING&&(0,X.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,X.jsx)(pi,{})}):(0,X.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,X.jsx)(Di,{onClick:O})})]})}),(0,X.jsx)(li,{onSubmit:Te,disabled:P||ce})]})]})]})})}function Hi({isRightPanelShown:e}){return(0,X.jsx)(`div`,{className:`flex justify-center w-full h-full`,children:(0,X.jsx)(`div`,{className:`w-full min-w-0 max-w-[800px] h-full flex flex-col min-h-0 transition-all duration-300 ease-in-out`,children:(0,X.jsx)(Vi,{})})})}function Ui({children:e}){return(0,X.jsx)(`div`,{className:`absolute inset-0`,children:e})}function Wi({children:e}){return(0,X.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function Gi({children:e}){return(0,X.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}function Ki({className:e}){let{t}=T(`openhands`);return(0,X.jsxs)(`div`,{className:U(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,X.jsx)(ye,{className:`h-8 w-8 shrink-0 animate-spin text-tertiary-light`,"aria-hidden":!0}),(0,X.jsx)(ne,{as:`p`,role:`status`,"aria-live":`polite`,className:`block w-full text-center text-base font-normal leading-5`,duration:1,spread:2,children:t(E.HOME$LOADING)})]})}function qi({children:e,onReady:t}){return(0,Z.useLayoutEffect)(()=>{t()},[t]),e}function Ji({onPending:e}){return(0,Z.useLayoutEffect)(()=>{e()},[e]),(0,X.jsx)(Ki,{})}var Yi={duration:.35,ease:`easeInOut`};function Xi({showAgentLoading:e,tabKey:t,children:n}){let r=M(),[i,a]=(0,Z.useState)(!1);(0,Z.useLayoutEffect)(()=>{a(!1)},[t]);let o=(0,Z.useCallback)(()=>{a(!0)},[]),c=(0,Z.useCallback)(()=>{a(!1)},[]),l=e||i;return r?(0,X.jsx)(`div`,{className:`relative h-full w-full overflow-hidden`,children:l?(0,X.jsx)(Ki,{}):(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(Ji,{onPending:o}),children:(0,X.jsx)(qi,{onReady:c,children:n})})}):(0,X.jsxs)(`div`,{className:`relative h-full w-full overflow-hidden`,children:[(0,X.jsx)(z.div,{className:`absolute inset-0 h-full w-full`,initial:!1,animate:{opacity:+!l},transition:Yi,"aria-hidden":l,children:(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(Ji,{onPending:o}),children:(0,X.jsx)(qi,{onReady:c,children:n})})}),(0,X.jsx)(s,{children:l?(0,X.jsx)(z.div,{className:`absolute inset-0 z-10 h-full w-full`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:Yi,children:(0,X.jsx)(Ki,{})},`conversation-tab-loading-overlay`):null})]})}var Zi=(0,Z.lazy)(()=>n(()=>import(`./files-tab-UVoray88.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61]))),Qi=(0,Z.lazy)(()=>n(()=>import(`./browser-tab-CkkqJnqw.js`),__vite__mapDeps([62,2,1,63,7,8,18,64,13,42,10,11,65,26]))),$i=(0,Z.lazy)(()=>n(()=>import(`./planner-tab-Dhyqcqmb.js`),__vite__mapDeps([66,1,2,67,7,8,18,42,10,11,44,22,20,21,23,24,45,13,19,25,46,47,48,68,69,70,71,3,4,5,6,9,72,73,74,15,16,30,27,28,14,29,31,32,33,34,35,36,75,76,77,78,79,80,49,50,51,52,81,82,26,60]))),ea=(0,Z.lazy)(()=>n(()=>import(`./task-list-tab-0k9PhuqO.js`),__vite__mapDeps([83,1,2,8,18,42,10,11,84,37,26,85,86,40,41]))),ta=(0,Z.lazy)(()=>n(()=>import(`./terminal-B61WrJdS.js`),__vite__mapDeps([87,1,2,88,89,90,7,8,18,38,39,10,11,40,41,42,53,49,50,4,14,27,3,5,6,9,28,29,30,31,32,33,34,35,36,51,52,15,16,54,26,91]))),na={tasklist:{component:ea},files:{component:Zi},browser:{component:Qi},terminal:{component:ta},planner:{component:$i}};function ra(){let{selectedTab:e,shouldShownAgentLoading:t}=W(),{conversationId:n}=q(),r=(0,Z.useMemo)(()=>na[e]??na.files,[e]).component,i=e===`terminal`?`${e}-${n}`:e??`files`;return(0,X.jsx)(Wi,{children:(0,X.jsx)(Gi,{children:(0,X.jsx)(Xi,{showAgentLoading:t,tabKey:i,children:(0,X.jsx)(Ui,{children:(0,X.jsx)(r,{})},i)})})})}var ia=()=>{let e=m(),t=Cn(e=>e.removeErrorMessage);return S({mutationKey:[`start-conversation`],mutationFn:async e=>g(e.conversationId),onMutate:async()=>(await e.cancelQueries({queryKey:[`user`,`conversations`]}),{previousConversations:e.getQueryData([`user`,`conversations`])}),onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:(t,n,r)=>{h(e,r.conversationId)},onSuccess:(n,r)=>{t(),_(e,r.conversationId,Le.RUNNING)}})},aa=e=>(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,X.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM10 9H14A1 1 0 0 1 15 10V14A1 1 0 0 1 14 15H10A1 1 0 0 1 9 14V10A1 1 0 0 1 10 9Z`,fill:`currentColor`})}),oa=e=>(0,X.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,X.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.9 1.50004C15.3 1.65004 17.55 2.85004 19.2 4.50004C21.15 6.60004 22.2 9.15004 22.2 12.15C22.2 14.55 21.3 16.8 19.8 18.75C18.3 20.55 16.2 21.9 13.8 22.35C11.4 22.8 9 22.5 6.9 21.3C4.8 20.1 3.15 18.3 2.25 16.05C1.35 13.8 1.2 11.25 1.95 9.00004C2.7 6.60004 4.05 4.65004 6.15 3.30004C8.1 1.95004 10.5 1.35004 12.9 1.50004ZM13.65 20.85C15.6 20.4 17.4 19.35 18.75 17.7C19.95 16.05 20.7 14.1 20.55 12C20.55 9.60004 19.65 7.20004 18 5.55004C16.5 4.05004 14.7 3.15004 12.6 3.00004C10.65 2.85004 8.55 3.30004 6.9 4.50004C5.25 5.70004 4.05 7.35004 3.45 9.45004C2.85 11.4 2.85 13.5 3.75 15.45C4.65 17.4 6 18.9 7.8 19.95C9.6 21 11.7 21.3 13.65 20.85Z`,fill:`currentColor`}),(0,X.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 7.49998L10.1655 6.87598L16.9155 11.376V12.624L10.1655 17.124L9 16.5V7.49998ZM10.5 8.90098V15.099L15.1485 12L10.5 8.90098Z`,fill:`currentColor`})]});function sa({icon:e,text:t,onClick:n,testId:r}){return(0,X.jsx)(G,{testId:r,onClick:n,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 w-full items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,X.jsx)(`span`,{className:Xe,"aria-hidden":!0,children:e})]})})}function ca({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=vn(),{isTask:i,taskStatus:a,taskDetail:o}=Wt(),{t:s}=T(`openhands`),{errorMessage:c}=Cn(),l=r===H.LOADING||r===H.INIT,u=Ie(t)||Te(t),d=Pe({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=ke({isPausing:n,isTask:i,taskStatus:a,taskDetail:o,isStartingStatus:l,isStopStatus:u,curAgentState:r,errorMessage:c,t:s});return(0,X.jsx)(`div`,{className:e,"data-testid":`server-status`,children:(0,X.jsxs)(`div`,{className:`flex items-center`,children:[(0,X.jsx)(Li,{className:`w-6 h-6 shrink-0`,color:d}),(0,X.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function la({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=T(`openhands`),c=Tt(e),l=De(r),u=Te(r),d=l||u;return(0,X.jsxs)(kt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:U(`left-2 w-fit min-w-42`,a),children:[(0,X.jsx)(ca,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ze,{inset:`menu`}),l&&t&&(0,X.jsx)(sa,{icon:(0,X.jsx)(aa,{width:18,height:18}),text:s(E.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,X.jsx)(sa,{icon:(0,X.jsx)(oa,{width:18,height:18}),text:s(E.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var ua=e(l(),1);function da({isPublic:e,onToggle:t,ariaLabel:n}){return(0,X.jsxs)(`label`,{className:`relative inline-flex shrink-0 cursor-pointer items-center`,children:[(0,X.jsx)(`input`,{hidden:!0,type:`checkbox`,"data-testid":`share-publicly-button`,checked:e,"aria-label":n,onChange:e=>t(e.target.checked)}),(0,X.jsx)(`span`,{"aria-hidden":!0,className:U(`inline-flex h-3.5 w-7 items-center rounded-full px-0.5 py-px transition-colors duration-200 ease-in-out`,e?`bg-white`:`bg-base-secondary`),children:(0,X.jsx)(`span`,{className:U(`block h-2 w-2 shrink-0 rounded-full transition-transform duration-200 ease-in-out`,e?`translate-x-[calc(1rem-1px)] bg-base-secondary`:`translate-x-px bg-tertiary-light`)})})]})}function fa({onClose:e,onRename:t,onDelete:n,onStop:r,onDisplayCost:i,onShowAgentTools:a,onShowSkills:o,onShowHooks:s,onTogglePublic:c,onCopyShareLink:l,onExportTranscript:u,onDownloadConversation:d,shareUrl:f,position:p=`bottom`,anchorRef:m}){let h=Xn(),{t:g}=T(`openhands`),{backend:_}=A(),{data:v}=J(),y=hn(),b=Tt(e),x=m?.current??null,[S,C]=Z.useState();Z.useLayoutEffect(()=>{if(!x)return;let e=()=>{let e=x.getBoundingClientRect();if(!e)return;let t={position:`fixed`,zIndex:9999};p===`top`?t.bottom=window.innerHeight-e.top+8:t.top=e.bottom+8,t.left=e.left,C(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[x,p]);let w=!!(a||o||s),D=!!i,O=!!(r||n),k=_.kind===`cloud`?E.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:E.COMMON$STOP_CONVERSATION,ee=_.kind===`cloud`&&!!c,j=v?.public||!1,M=!!x,N=(0,X.jsxs)(kt,{ref:b,testId:`conversation-name-context-menu`,position:p,alignment:`left`,className:U(h?`right-0 translate-x-[34%] left-auto`:``,M?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,X.jsx)(G,{testId:`rename-button`,onClick:t,children:(0,X.jsx)(K,{icon:(0,X.jsx)(Mt,{width:16,height:16}),text:g(E.BUTTON$RENAME)})}),w&&(0,X.jsx)(Ze,{testId:`separator-tools`,inset:`menu`}),o&&(0,X.jsx)(Qt,{isDisabled:y,children:(0,X.jsx)(G,{testId:`show-skills-button`,onClick:o,isDisabled:y,children:(0,X.jsx)(K,{icon:(0,X.jsx)(Nt,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:g(E.CONVERSATION$SHOW_SKILLS)})})}),s&&(0,X.jsx)(Qt,{isDisabled:y,children:(0,X.jsx)(G,{testId:`show-hooks-button`,onClick:s,isDisabled:y,children:(0,X.jsx)(K,{icon:(0,X.jsx)(an,{width:16,height:16,"aria-hidden":!0}),text:g(E.CONVERSATION$SHOW_HOOKS)})})}),a&&(0,X.jsx)(Qt,{isDisabled:y,children:(0,X.jsx)(G,{testId:`show-agent-tools-button`,onClick:a,isDisabled:y,children:(0,X.jsx)(K,{icon:(0,X.jsx)(tt,{width:16,height:16}),text:g(E.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})})}),u&&(0,X.jsx)(G,{testId:`export-transcript-button`,onClick:u,children:(0,X.jsx)(K,{icon:(0,X.jsx)(ht,{width:16,height:16}),text:g(E.BUTTON$EXPORT_TRANSCRIPT)})}),d&&(0,X.jsx)(G,{testId:`download-trajectory-button`,onClick:d,children:(0,X.jsx)(K,{icon:(0,X.jsx)(ht,{width:16,height:16}),text:g(E.BUTTON$DOWNLOAD_CONVERSATION_DATA)})}),(D||O)&&(0,X.jsx)(Ze,{testId:`separator-info-control`,inset:`menu`}),i&&(0,X.jsx)(G,{testId:`display-cost-button`,onClick:i,children:(0,X.jsx)(K,{icon:(0,X.jsx)(St,{width:16,height:16}),text:g(E.BUTTON$DISPLAY_COST)})}),ee&&c&&(0,X.jsxs)(`li`,{className:`flex w-full items-center gap-2 rounded px-2 py-2 hover:bg-[var(--oh-interactive-hover)]`,children:[(0,X.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)]`,"aria-hidden":!0,children:(0,X.jsx)(er,{size:16})}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:g(E.CONVERSATION$SHARE_PUBLICLY)}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[j&&f&&l&&(0,X.jsxs)(`div`,{className:`mr-2 flex items-center gap-0.5`,children:[(0,X.jsx)(`button`,{type:`button`,"data-testid":`copy-share-link-button`,onClick:l,className:`rounded p-0.5 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(E.BUTTON$COPY_TO_CLIPBOARD),children:(0,X.jsx)(It,{width:14,height:14})}),(0,X.jsx)(`a`,{"data-testid":`open-share-link-button`,href:f,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`rounded p-0.5 text-[var(--oh-muted)] no-underline visited:text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:g(E.BUTTON$OPEN_IN_NEW_TAB),children:(0,X.jsx)(B,{size:14,"aria-hidden":!0})})]}),(0,X.jsx)(da,{isPublic:j,onToggle:c,ariaLabel:g(E.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,X.jsx)(Qt,{isDisabled:y,children:(0,X.jsx)(G,{testId:`stop-button`,onClick:r,isDisabled:y,children:(0,X.jsx)(K,{icon:(0,X.jsx)(Qe,{width:16,height:16}),text:g(k)})})}),n&&(0,X.jsx)(G,{testId:`delete-button`,onClick:n,children:(0,X.jsx)(K,{icon:(0,X.jsx)(At,{width:16,height:16}),text:g(E.COMMON$DELETE_CONVERSATION)})})]});return M?typeof document>`u`||!S?null:ua.createPortal((0,X.jsx)(`div`,{style:S,children:N}),document.body):N}function pa({onClose:e}){let{t}=T(`openhands`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(st,{onClose:e,testId:`close-metrics-modal`}),(0,X.jsx)(`div`,{className:`w-full pr-6`,children:(0,X.jsx)(We,{title:t(E.CONVERSATION$METRICS_INFO)})})]})}function ma({currentCost:e,maxBudget:t}){let n=e/t*100;return(0,X.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden mt-1`,children:(0,X.jsx)(`div`,{className:U(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function ha({currentCost:e,maxBudget:t}){let{t:n}=T(`openhands`),r=e/t*100;return(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(E.CONVERSATION$USED)})})})}function ga({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,X.jsx)(`div`,{className:`border-b border-[var(--oh-border-subtle)]`,children:t!==null&&t>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ma,{currentCost:e,maxBudget:t}),(0,X.jsx)(ha,{currentCost:e,maxBudget:t})]}):(0,X.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$NO_BUDGET_LIMIT)})})}function _a({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex justify-between items-center pb-2`,children:[(0,X.jsx)(`span`,{className:`text-lg font-semibold`,children:n(E.CONVERSATION$TOTAL_COST)}),(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,X.jsx)(ga,{cost:e,maxBudgetPerTask:t})]})}function va({label:e,value:t,labelClassName:n=``,valueClassName:r=`font-semibold`}){return(0,X.jsxs)(`div`,{className:`flex justify-between items-center border-b border-[var(--oh-border-subtle)] pb-2`,children:[(0,X.jsx)(`span`,{className:n,children:e}),(0,X.jsx)(`span`,{className:r,children:t})]})}function ya({usage:e}){let{t}=T(`openhands`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(va,{label:t(E.CONVERSATION$INPUT),value:e.prompt_tokens.toLocaleString()}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pl-4 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_HIT)}),(0,X.jsx)(`span`,{className:`text-right`,children:e.cache_read_tokens.toLocaleString()}),(0,X.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_WRITE)}),(0,X.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,X.jsx)(va,{label:t(E.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,X.jsx)(va,{label:t(E.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function ba({perTurnToken:e,contextWindow:t}){let{t:n}=T(`openhands`),r=t>0?e/t*100:0,i=Math.min(100,r);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,X.jsx)(`span`,{className:`font-semibold`,children:n(E.CONVERSATION$CONTEXT_WINDOW)})}),(0,X.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden`,children:(0,X.jsx)(`div`,{className:`h-full bg-foreground transition-all duration-300`,style:{width:`${i}%`}})}),(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsxs)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` (`,r.toFixed(2),`% `,n(E.CONVERSATION$USED),`)`]})})]})}function xa(){let{t:e}=T(`openhands`);return(0,X.jsx)(`div`,{className:`text-center`,children:(0,X.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(E.CONVERSATION$NO_METRICS)})})}function Sa(e){let{stats:t}=e;if(!t?.usage_to_metrics)return{accumulated_cost:0,max_budget_per_task:null,accumulated_token_usage:null};let n=0,r=null,i=null;for(let e of Object.values(t.usage_to_metrics))n+=e.accumulated_cost,r===null&&e.max_budget_per_task!==null&&(r=e.max_budget_per_task),e.accumulated_token_usage&&(i=i===null?{...e.accumulated_token_usage}:{prompt_tokens:i.prompt_tokens+e.accumulated_token_usage.prompt_tokens,completion_tokens:i.completion_tokens+e.accumulated_token_usage.completion_tokens,cache_read_tokens:i.cache_read_tokens+e.accumulated_token_usage.cache_read_tokens,cache_write_tokens:i.cache_write_tokens+e.accumulated_token_usage.cache_write_tokens,context_window:Math.max(i.context_window,e.accumulated_token_usage.context_window),per_turn_token:Math.max(i.per_turn_token,e.accumulated_token_usage.per_turn_token)});return{accumulated_cost:n,max_budget_per_task:r,accumulated_token_usage:i}}var Ca=(e,t,n,r=!0)=>{let i=C({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return Sa(await pt.getRuntimeConversation(e,t,n))},enabled:r&&!!e&&!!t,staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,retry:!1});return{data:i.data,isLoading:i.isLoading,error:i.error}};function wa({isOpen:e,onOpenChange:t}){let n=kn(),{data:r}=J(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=Ca(i,a,o,e),c=(0,Z.useMemo)(()=>s?{cost:s.accumulated_cost,max_budget_per_task:s.max_budget_per_task,usage:s.accumulated_token_usage?{prompt_tokens:s.accumulated_token_usage.prompt_tokens??0,completion_tokens:s.accumulated_token_usage.completion_tokens??0,cache_read_tokens:s.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:s.accumulated_token_usage.cache_write_tokens??0,context_window:s.accumulated_token_usage.context_window??0,per_turn_token:s.accumulated_token_usage.per_turn_token??0}:null}:n,[s,n]);return e?(0,X.jsx)(Ve,{onClose:()=>t(!1),children:(0,X.jsxs)(He,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,X.jsx)(pa,{onClose:()=>t(!1)}),(0,X.jsxs)(`div`,{className:`w-full`,children:[(c?.cost!==null||c?.usage!==null)&&(0,X.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,X.jsxs)(`div`,{className:`grid gap-3`,children:[(0,X.jsx)(_a,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ya,{usage:c.usage}),(0,X.jsx)(ba,{perTurnToken:c.usage.per_turn_token,contextWindow:c.usage.context_window})]})]})}),!c?.cost&&!c?.usage&&(0,X.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,X.jsx)(xa,{})})]})]})}):null}var Ta=new Set([`BrowserClickAction`,`BrowserCloseTabAction`,`BrowserGetContentAction`,`BrowserGetStateAction`,`BrowserGoBackAction`,`BrowserListTabsAction`,`BrowserNavigateAction`,`BrowserScrollAction`,`BrowserSwitchTabAction`,`BrowserTypeAction`,`ExecuteBashAction`,`FileEditorAction`,`GlobAction`,`GrepAction`,`InvokeSkillAction`,`MCPToolAction`,`StrReplaceEditorAction`,`TaskAction`,`TaskTrackerAction`,`TerminalAction`,`ThinkAction`]),Ea=new Set([`BrowserObservation`,`CanvasUIObservation`,`ExecuteBashObservation`,`FileEditorObservation`,`GlobObservation`,`GrepObservation`,`InvokeSkillObservation`,`MCPToolObservation`,`StrReplaceEditorObservation`,`SwitchLLMObservation`,`TaskTrackerObservation`,`TaskObservation`,`TerminalObservation`]),Q=e=>e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim(),Da=(e,t=100)=>e.length>t?`${e.slice(0,t)}…`:e,Oa=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString()},$=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`),ka=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replace(/(!?)\[([^\]]*)\]\(\s*((?:javascript|data|vbscript):[^)]*)\)/gi,`$1\\[$2\\]($3)`).replace(/^(\s{0,3})\[([^\]]+)\]:(\s*<?(?:javascript|data|vbscript):)/gim,`$1\\[$2\\]:$3`),Aa=e=>Q(e||O.t(E.TRANSCRIPT_EXPORT$DEFAULT_TITLE))||O.t(E.TRANSCRIPT_EXPORT$DEFAULT_TITLE),ja=(e,t)=>Q(O.t(e,t).replace(/<\/?(?:cmd|path)>/g,``)),Ma=e=>/^[a-z][a-z0-9_]*\s*:\s*[[{]/i.test(e),Na=e=>e.replace(/(?:Action|Observation)$/,``).replace(/([a-z])([A-Z])/g,`$1 $2`).trim(),Pa=e=>{let t=Q(e.summary||``);return t&&!Ma(t)?t:Q(e.tool_name)||Na(e.action.kind)},Fa=(e,t)=>t?Pa(t):Q(e.tool_name)||Na(e.observation.kind),Ia=e=>e.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
20
20
|
`),La=e=>[`${O.t(E.TASK$SUBAGENT)}: ${e.subagent_type}`,`${O.t(E.TASK$QUERY)}:\n${e.prompt}`].join(`
|
|
21
21
|
|
|
22
22
|
`),Ra=(e,t)=>{let n=t?.action.kind===`TaskAction`?t.action:void 0;return[`${O.t(E.TASK$SUBAGENT)}: ${e.subagent}`,`${O.t(E.TASK$TASK_ID)}: ${e.task_id}`,n?`${O.t(E.TASK$QUERY)}:\n${n.prompt}`:``,`${O.t(E.TASK$RESULT)}:\n${Ia(e.content)}`].filter(Boolean).join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./conversation-BXg6Oti2.js";export{e as default};
|
package/build/assets/{conversation-service.api-DQaKzIRj.js → conversation-service.api-DPBQvTKD.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~
|
|
1
|
+
import{r as e}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{c as t,n,r,w as i}from"./agent-server-client-options-DVLRd9sw.js";import{a,i as o}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js";import{c as s,n as c,o as l,t as u}from"./agent-server-conversation-service.api-CuSdr4Qb.js";var d=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function f(e){let t=e.split(/[\\/]+/).filter(Boolean),n=t[t.length-1];if(!n||n===`.`||n===`..`)throw Error(`Invalid file name`);return n}async function p(e,t={}){return s(e,t)}async function m(e,t,n={}){let r=f(e);return`${(await p(t,n)).replace(/[/\\]+$/,``)}/${r}`}async function h(e,t){if(t?.id===e&&t.workspace?.working_dir?.trim())return t.workspace.working_dir.trim();let n=l(e);return n?.selected_workspace?.trim()?n.selected_workspace.trim():d.test(e)?u.resolveConversationWorkingDir(e):i()}var g=5;async function _(e,n){if(n?.id===e&&n.conversation_url?.trim()&&n.session_api_key?.trim())return{conversationUrl:n.conversation_url.trim(),sessionApiKey:n.session_api_key.trim()};if(t().backend.kind===`cloud`){let[t]=await c([e]);return{conversationUrl:t?.conversation_url?.trim()??null,sessionApiKey:t?.session_api_key?.trim()??null}}return{conversationUrl:null,sessionApiKey:null}}function v(e){if(!e.conversationUrl||!e.sessionApiKey)throw Error(`Conversation sandbox is still starting. Wait for it to finish, then try again.`);return{conversationUrl:e.conversationUrl,sessionApiKey:e.sessionApiKey}}async function y(e,n,r){let i=await h(e,r),a=await _(e,r),o=t().backend.kind===`cloud`,s=r?.id===e?r.session_api_key??a.sessionApiKey:a.sessionApiKey,c=r?.id===e?r.conversation_url??a.conversationUrl:a.conversationUrl;if(o){let e=v({conversationUrl:c,sessionApiKey:s});return b({files:n,workingDir:i,conversationUrl:e.conversationUrl,sessionApiKey:e.sessionApiKey})}return b({files:n,workingDir:i,conversationUrl:c,sessionApiKey:s})}async function b(e){let{files:t,workingDir:r,conversationUrl:i,sessionApiKey:a}=e,s=new o(n({conversationUrl:i,sessionApiKey:a,workingDir:r})),c=async e=>{try{let t=f(e.name),n=await m(e.name,r,{conversationUrl:i,sessionApiKey:a});return await s.fileUpload(e,n),{uploadedFile:t,skippedFile:null}}catch(t){return{uploadedFile:null,skippedFile:{name:e.name,reason:t instanceof Error?t.message:`Upload failed`}}}},l=[];for(let e=0;e<t.length;e+=g){let n=t.slice(e,e+g);l.push(...await Promise.all(n.map(c)))}return{uploaded_files:l.flatMap(e=>e.uploadedFile?[e.uploadedFile]:[]),skipped_files:l.flatMap(e=>e.skippedFile?[e.skippedFile]:[])}}var x=class{static currentConversation=null;static setCurrentConversation(e){this.currentConversation=e}static getCurrentConversation(){return this.currentConversation}static getClientOverrides(){return{sessionApiKey:this.currentConversation?.session_api_key}}static async getVSCodeUrl(t){let r=this.currentConversation?.id===t?this.currentConversation?.workspace?.working_dir??i():i();return{vscode_url:await new e(n(this.getClientOverrides())).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:r})}}static async getTrajectory(e){return{trajectory:(await new a(r(this.getClientOverrides()),e).search({limit:1e4})).items??[]}}static async uploadFiles(e,t){return y(e,t,this.currentConversation)}};export{_ as n,y as r,x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{I as r,L as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as a}from"./useTranslation-CDRCKC9-.js";import{t as o}from"./declaration-gq8V5eTU.js";import{t as s}from"./utils-D3U3rlqr.js";import{t as c}from"./use-is-authed-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{I as r,L as i}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as a}from"./useTranslation-CDRCKC9-.js";import{t as o}from"./declaration-gq8V5eTU.js";import{t as s}from"./utils-D3U3rlqr.js";import{t as c}from"./use-is-authed-B6M0mcGL.js";import{t as l}from"./typography-D8mHDeNG.js";var u=e(t(),1),d=n(),f=i(function(){let{t:e}=a(`openhands`),[t]=r(),{data:n,isLoading:i}=c(),[f,p]=(0,u.useState)(null),[m,h]=(0,u.useState)(!1),g=t.get(`user_code`),_=async e=>{try{h(!0),(await fetch(`/oauth/device/verify-authenticated`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:`user_code=${encodeURIComponent(e)}`,credentials:`include`})).ok?p({success:!0,messageKey:o.DEVICE$SUCCESS_MESSAGE}):p({success:!1,messageKey:o.DEVICE$ERROR_FAILED})}catch{p({success:!1,messageKey:o.DEVICE$ERROR_OCCURRED})}finally{h(!1)}};return f?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsx)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:s(`mb-4`,f.success?`text-green-600`:`text-red-600`),children:f.success?(0,d.jsx)(`svg`,{className:`w-12 h-12 mx-auto`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,d.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 13l4 4L19 7`})}):(0,d.jsx)(`svg`,{className:`w-12 h-12 mx-auto`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,d.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M6 18L18 6M6 6l12 12`})})}),(0,d.jsx)(`h2`,{className:`text-xl font-medium mb-2`,children:f.success?e(o.DEVICE$SUCCESS_TITLE):e(o.DEVICE$ERROR_TITLE)}),(0,d.jsx)(`p`,{className:`text-muted-foreground mb-4`,children:e(f.messageKey)}),!f.success&&(0,d.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90`,children:e(o.DEVICE$TRY_AGAIN)})]})})}):m?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsx)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4`}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:e(o.DEVICE$PROCESSING)})]})})}):n&&g?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background p-4`,children:(0,d.jsx)(`div`,{className:`flex flex-col items-center gap-6 w-full max-w-md`,children:(0,d.jsxs)(`div`,{className:`flex-1 min-w-0 max-w-md w-full mx-auto p-6 bg-card rounded-2xl shadow-lg border border-[var(--oh-border-subtle)]`,children:[(0,d.jsx)(l,{className:`text-2xl mb-4 text-center`,children:e(o.DEVICE$AUTHORIZATION_REQUEST)}),(0,d.jsxs)(`div`,{className:`mb-6 p-4 bg-base rounded-lg border border-[var(--oh-border-subtle)]`,children:[(0,d.jsx)(`p`,{className:`text-xs text-[var(--oh-text-subtle)] mb-2 text-center uppercase tracking-wider`,children:e(o.DEVICE$CODE_LABEL)}),(0,d.jsx)(`p`,{className:`text-xl font-mono font-semibold text-center tracking-[0.3em]`,children:g})]}),(0,d.jsxs)(`div`,{className:`mb-6 p-4 bg-amber-950/50 border-l-2 border-amber-500 rounded-r-lg`,children:[(0,d.jsx)(`p`,{className:`text-sm font-medium text-amber-500 mb-1`,children:e(o.DEVICE$SECURITY_NOTICE)}),(0,d.jsx)(`p`,{className:`text-sm text-[var(--oh-muted)]`,children:e(o.DEVICE$SECURITY_WARNING)})]}),(0,d.jsx)(`p`,{className:`text-muted-foreground mb-6 text-center`,children:e(o.DEVICE$CONFIRM_PROMPT)}),(0,d.jsxs)(`div`,{className:`flex gap-3`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>window.close(),className:`flex-1 px-4 py-2 border border-[var(--oh-border)] rounded-md hover:bg-muted text-[var(--oh-text-tertiary)]`,children:e(o.DEVICE$CANCEL)}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>_(g),className:`flex-1 px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700`,children:e(o.DEVICE$AUTHORIZE)})]})]})})}):n&&!g?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg`,children:[(0,d.jsx)(l,{className:`text-2xl mb-4 text-center`,children:e(o.DEVICE$AUTHORIZATION_TITLE)}),(0,d.jsx)(`p`,{className:`text-muted-foreground mb-6 text-center`,children:e(o.DEVICE$ENTER_CODE_PROMPT)}),(0,d.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`user_code`);t&&n&&_(t)},children:[(0,d.jsxs)(`div`,{className:`mb-4`,children:[(0,d.jsx)(`label`,{htmlFor:`user_code`,className:`block text-sm font-medium mb-2`,children:e(o.DEVICE$CODE_INPUT_LABEL)}),(0,d.jsx)(`input`,{type:`text`,id:`user_code`,name:`user_code`,required:!0,className:`w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring`,placeholder:e(o.DEVICE$CODE_PLACEHOLDER)})]}),(0,d.jsx)(`button`,{type:`submit`,className:`w-full px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90`,children:e(o.DEVICE$CONTINUE)})]})]})}):i?(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`text-center`,children:[(0,d.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4`}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:e(o.DEVICE$PROCESSING)})]})}):(0,d.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,d.jsxs)(`div`,{className:`max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg text-center`,children:[(0,d.jsx)(l,{className:`text-2xl mb-4`,children:e(o.DEVICE$AUTH_REQUIRED)}),(0,d.jsx)(`p`,{className:`text-muted-foreground`,children:e(o.DEVICE$SIGN_IN_PROMPT)})]})})});export{f as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-BifzWIBd.js","assets/vendor~browser-Cvg7jXCP.js","assets/vendor~browser-Dqd33JyP.js","assets/llm-subscription-DtsX5Lhg.js","assets/settings-mQUckT0g.js","assets/common-Dh7OqABE.js","assets/automation-BU8zu-FP.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,St as n,bt as r}from"./vendor-styling-CI0PQ3ab.js";import{n as i}from"./vendor~entry.client-9tWQ_Ugw.js";import{t as a}from"./vendor~entry.client-D6BtSOtn.js";import{n as o,t as s}from"./providers-
|
|
2
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,St as n,bt as r}from"./vendor-styling-CI0PQ3ab.js";import{n as i}from"./vendor~entry.client-9tWQ_Ugw.js";import{t as a}from"./vendor~entry.client-D6BtSOtn.js";import{n as o,t as s}from"./providers-BpO967xS.js";import{G as c}from"./active-backend-context-hxq31W25.js";var l=e(t(),1),u=a();function d({mockApi:e=void 0,hasWindow:t=typeof window<`u`}={}){return t&&e===`true`}var f=r();async function p(){if(await c(),d()){let{worker:e}=await n(async()=>{let{worker:e}=await import(`./browser-BifzWIBd.js`);return{worker:e}},__vite__mapDeps([0,1,2,3,4,5,6]));await e.start({onUnhandledRequest:`bypass`})}}p().then(()=>(0,l.startTransition)(()=>{(0,u.hydrateRoot)(document,(0,f.jsx)(l.StrictMode,{children:(0,f.jsx)(s,{analytics:o,withStyleRoot:!1,children:(0,f.jsx)(i,{})})}))}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bt as e}from"./vendor-styling-CI0PQ3ab.js";import{L as t,s as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{t as a}from"./sidebar-nav-link-5AlTT5-j.js";import{r as o}from"./typography-D8mHDeNG.js";import{t as s}from"./use-breakpoint-B-O0lQ84.js";import{t as c}from"./backend-synced-settings-badge-
|
|
1
|
+
import{bt as e}from"./vendor-styling-CI0PQ3ab.js";import{L as t,s as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as r}from"./useTranslation-CDRCKC9-.js";import{t as i}from"./declaration-gq8V5eTU.js";import{t as a}from"./sidebar-nav-link-5AlTT5-j.js";import{r as o}from"./typography-D8mHDeNG.js";import{t as s}from"./use-breakpoint-B-O0lQ84.js";import{t as c}from"./backend-synced-settings-badge-D9hZx05w.js";import{t as l}from"./extensions-navigation-B5MeUiMq.js";var u=e();function d(){let{t:e}=r(`openhands`);return(0,u.jsxs)(`div`,{"data-testid":`extensions-mobile-hub`,className:`flex flex-col gap-4 px-4 py-2 md:hidden`,children:[(0,u.jsx)(o.H2,{children:e(i.NAV$CUSTOMIZE)}),(0,u.jsx)(`nav`,{className:`flex flex-col gap-0.5`,children:l.map(e=>(0,u.jsx)(a,{to:e.to,label:e.label,end:e.end,testId:`sidebar-extensions-${e.to}`,icon:e.icon,disabled:e.comingSoon},e.to))}),(0,u.jsx)(`div`,{className:`pt-1`,children:(0,u.jsx)(c,{})})]})}var f=t(function(){return s(768)?(0,u.jsx)(d,{}):(0,u.jsx)(n,{to:`/skills`,replace:!0})});export{f as default};
|
package/build/assets/{extensions-navigation-D9i0DL62.js → extensions-navigation-B5MeUiMq.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BFRubm34.js";import{Ct as e,bt as t}from"./vendor-styling-CI0PQ3ab.js";import{t as n}from"./useTranslation-CDRCKC9-.js";import{t as r}from"./declaration-gq8V5eTU.js";import{t as i}from"./utils-D3U3rlqr.js";import{t as a}from"./navigation-link-D8hfwvxI.js";import{f as o,o as s}from"./sidebar-layout-DuzJMMw-.js";import{t as c}from"./skills-9cDZONKh.js";import{t as l}from"./backend-synced-settings-badge-
|
|
1
|
+
import"./rolldown-runtime-BFRubm34.js";import{Ct as e,bt as t}from"./vendor-styling-CI0PQ3ab.js";import{t as n}from"./useTranslation-CDRCKC9-.js";import{t as r}from"./declaration-gq8V5eTU.js";import{t as i}from"./utils-D3U3rlqr.js";import{t as a}from"./navigation-link-D8hfwvxI.js";import{f as o,o as s}from"./sidebar-layout-DuzJMMw-.js";import{t as c}from"./skills-9cDZONKh.js";import{t as l}from"./backend-synced-settings-badge-D9hZx05w.js";e();var u=t(),d=[{to:`/skills`,label:`Skills`,icon:(0,u.jsx)(c,{width:16,height:16,"aria-hidden":`true`}),end:!0},{to:`/mcp`,label:`MCP Servers`,icon:(0,u.jsx)(e=>(0,u.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,u.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2.25 3H21.75L22.5 3.75V13.5H21V9H3V19.5H13.5V21H2.25L1.5 20.25V3.75L2.25 3ZM3 7.5H21V4.5H3V7.5ZM10.5 18V16.359C10.2451 16.2664 10.0074 16.132 9.7965 15.9615L8.379 16.77L7.629 15.48L9.0345 14.6595C8.98649 14.3881 8.98649 14.1104 9.0345 13.839L7.629 13.02L8.379 11.73L9.7965 12.54C10.023 12.36 10.2585 12.2265 10.5 12.141V10.5H12V12.141C12.2568 12.2293 12.4953 12.3641 12.7035 12.5385L14.121 11.73L14.871 13.02L13.4655 13.8405C13.5133 14.1114 13.5133 14.3886 13.4655 14.6595L14.871 15.48L14.121 16.77L12.7035 15.96C12.4903 16.1274 12.2531 16.2619 12 16.359V18H10.5ZM10.125 14.25C10.125 14.562 10.2345 14.8275 10.4535 15.0465C10.5568 15.1528 10.6807 15.2367 10.8177 15.2932C10.9547 15.3497 11.1018 15.3776 11.25 15.375C11.3982 15.3776 11.5453 15.3497 11.6823 15.2932C11.8193 15.2367 11.9432 15.1528 12.0465 15.0465C12.1528 14.9432 12.2367 14.8193 12.2932 14.6823C12.3497 14.5453 12.3776 14.3982 12.375 14.25C12.3776 14.1018 12.3497 13.9547 12.2932 13.8177C12.2367 13.6807 12.1528 13.5568 12.0465 13.4535C11.9432 13.3472 11.8193 13.2633 11.6823 13.2068C11.5453 13.1503 11.3982 13.1224 11.25 13.125C11.1018 13.1224 10.9547 13.1503 10.8177 13.2068C10.6807 13.2633 10.5568 13.3472 10.4535 13.4535C10.3472 13.5568 10.2633 13.6807 10.2068 13.8177C10.1503 13.9547 10.1224 14.1018 10.125 14.25ZM18.126 22.5V20.859C17.8711 20.7663 17.6334 20.632 17.4225 20.4615L16.005 21.27L15.255 19.98L16.662 19.1595C16.614 18.8881 16.614 18.6104 16.662 18.339L15.255 17.52L16.005 16.23L17.4225 17.04C17.649 16.86 17.8845 16.7265 18.1275 16.641V15H19.6275V16.641C19.8837 16.7297 20.1216 16.8644 20.3295 17.0385L21.747 16.23L22.497 17.52L21.0915 18.3405C21.1396 18.6114 21.1396 18.8886 21.0915 19.1595L22.497 19.98L21.747 21.27L20.3295 20.46C20.1163 20.6275 19.8791 20.762 19.626 20.859V22.5H18.126ZM17.751 18.75C17.751 19.062 17.8605 19.3275 18.0795 19.5465C18.1828 19.6528 18.3067 19.7367 18.4437 19.7932C18.5807 19.8497 18.7278 19.8776 18.876 19.875C19.0242 19.8776 19.1713 19.8497 19.3083 19.7932C19.4453 19.7367 19.5692 19.6528 19.6725 19.5465C19.779 19.4434 19.8633 19.3195 19.9201 19.1825C19.9768 19.0455 20.0049 18.8983 20.0025 18.75C20.0049 18.6017 19.9768 18.4545 19.9201 18.3175C19.8633 18.1805 19.779 18.0566 19.6725 17.9535C19.5694 17.8474 19.4457 17.7636 19.309 17.7071C19.1722 17.6506 19.0254 17.6226 18.8775 17.625C18.7291 17.6222 18.5817 17.65 18.4444 17.7065C18.3072 17.763 18.183 17.847 18.0795 17.9535C17.9732 18.0568 17.8893 18.1807 17.8328 18.3177C17.7763 18.4547 17.7484 18.6018 17.751 18.75Z`,fill:`currentColor`})}),{width:16,height:16}),end:!0},{to:`/plugins`,label:`Plugins`,icon:(0,u.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,width:16,height:16,"aria-hidden":`true`,children:[(0,u.jsx)(`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`}),(0,u.jsx)(`path`,{d:`m3.3 7 8.7 5 8.7-5`}),(0,u.jsx)(`path`,{d:`M12 22V12`})]}),end:!0}];function f(){let{t:e}=n(`openhands`);return(0,u.jsxs)(`aside`,{"data-testid":`extensions-navbar-desktop`,className:`hidden md:flex md:w-[260px] md:shrink-0 md:flex-col md:gap-2 md:sticky md:top-8 md:self-start`,children:[(0,u.jsx)(`span`,{className:`px-2 text-sm font-normal text-white`,children:e(r.NAV$CUSTOMIZE)}),(0,u.jsx)(`div`,{className:`flex flex-col gap-0.5 pt-0.5`,children:d.map(t=>{let n=(0,u.jsx)(`span`,{className:`shrink-0 flex items-center justify-center`,children:t.icon}),c=(0,u.jsx)(`span`,{className:`truncate`,children:t.label}),l=t.comingSoon&&(0,u.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-white/20 bg-white/5 px-1.5 py-0.5 text-[10px] font-medium text-[var(--oh-text-dim)]`,children:e(r.NAV$COMING_SOON)});return(0,u.jsxs)(a,{to:t.to,end:t.end,"data-testid":`sidebar-extensions-${t.to}`,className:({isActive:e})=>i(o(),`truncate`,e?s.active:s.idle),children:[n,c,l]},t.to)})}),(0,u.jsx)(`div`,{className:`px-2 pt-3`,children:(0,u.jsx)(l,{})})]})}export{f as n,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{n as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js";import{t as i}from"./useQuery-CpjHYtZc.js";import{t as a}from"./useTranslation-CDRCKC9-.js";import{t as o}from"./declaration-gq8V5eTU.js";import{d as s}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js";import{P as c,n as l}from"./active-backend-context-B3umL5R-.js";import{a as u,c as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v}from"./vendor~files-tab-B02k3xvx.js";import{t as y}from"./mouse-pointer-click-PdEQPL6v.js";import{t as b,w as x}from"./utils-D3U3rlqr.js";import{a as S,c as C,n as w,y as T}from"./agent-server-client-options-DVLRd9sw.js";import{t as E}from"./proxy-CHmFkV16.js";import{t as D}from"./react-DPDgL6du.js";import{s as O}from"./conversation-local-storage-F6zVMM--.js";import{t as k}from"./segmented-toggle-DyQqPhoD.js";import{i as A}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-mMKDm94D.js";import{i as j,o as M}from"./agent-server-conversation-service.api-D_ZvtJjG.js";import{t as ee}from"./folder-mMWFvaw0.js";import{t as N}from"./git-status-mapper-BI8FyUVp.js";import{r as te}from"./typography-D8mHDeNG.js";import{n as P,r as ne,t as F}from"./use-active-conversation-D-r929nx.js";import{n as re,t as I}from"./files-tab-store-DJsPxYdg.js";import{t as ie}from"./use-agent-state-DijdVAQ0.js";import{t as ae}from"./use-event-store-DjgU4wfO.js";import{ot as oe,st as se}from"./vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-d8aETPbZ.js";import{t as ce}from"./markdown-renderer-DMT7Zkpd.js";import{t as le}from"./runtime-waiting-state-BsXLElvN.js";import{t as ue}from"./link-external-DfKQroKX.js";import{t as L}from"./use-runtime-is-ready-CC-KrLKe.js";import{n as de,t as fe}from"./get-language-from-path-CPNnuVhI.js";import{t as R}from"./conversation-tab-empty-state-B2dDYEwf.js";var z=e(t(),1),B=n();function pe(){let{t:e}=a(`openhands`);return(0,B.jsx)(R,{className:`h-full`,icon:(0,B.jsx)(y,{"aria-hidden":!0,strokeWidth:2,className:`size-full`}),children:e(o.FILES$NO_FILE_SELECTED)})}var me=class{static async executeCommand(e,t,n,r,i=30){let a=C().backend;if(a.kind===`cloud`&&e){let o=await E({backend:a,method:`POST`,hostOverride:S(e),path:`/api/bash/execute_bash_command`,body:{command:n,...r?{cwd:r}:{},timeout:Math.floor(i)},authMode:`session-api-key`,sessionApiKey:t,timeoutSeconds:i+10});return{exit_code:o.exit_code??-1,stdout:o.stdout??``,stderr:o.stderr??``}}let o=await new A(w({conversationUrl:e,sessionApiKey:t})).executeCommand(n,r,i);return{exit_code:o.exit_code,stdout:o.stdout,stderr:o.stderr}}static async downloadFile(e,t,n){let r=C().backend;return r.kind===`cloud`&&e?(await E({backend:r,method:`GET`,hostOverride:S(e),path:`/api/file/download?path=${encodeURIComponent(n)}`,authMode:`session-api-key`,sessionApiKey:t,responseType:`blob`})).arrayBuffer():new s(w({conversationUrl:e,sessionApiKey:t})).downloadFile(n)}};function he(e){return e.startsWith(`/`)?e:`/${e}`}var ge=class{static async getGitChanges(e,t,n,r){let i=C().backend;if(i.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,he(r));let n=await E({backend:i,method:`GET`,path:`/api/v1/app-conversations/${e}/git/changes?${t.toString()}`});if(!Array.isArray(n))throw Error(`Invalid response from runtime - runtime may be unavailable`);return n.map(e=>({status:N(String(e.status)),path:e.path}))}let a=await new A(w({conversationUrl:t,sessionApiKey:n})).gitChanges(r);if(!Array.isArray(a))throw Error(`Invalid response from runtime - runtime may be unavailable`);return a.map(e=>({status:N(String(e.status)),path:e.path}))}static async getGitChangeDiff(e,t,n,r){let i=C().backend;if(i.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,he(r));let n=await E({backend:i,method:`GET`,path:`/api/v1/app-conversations/${e}/git/diff?${t.toString()}`});return{modified:n?.modified??``,original:n?.original??``,...n?.diff?{diff:n.diff}:{}}}let a=await new A(w({conversationUrl:t,sessionApiKey:n})).gitDiff(r);return{modified:a.modified??``,original:a.original??``,...a.diff?{diff:a.diff}:{}}}};function V(e,t){let n=t?.trim();if(n)return n;if(!e)return T;let r=e.split(`/`);return`${T}/${r[r.length-1]}`}var H=()=>{let{conversationId:e}=P(),{data:t}=F(),[n,r]=z.useState([]),a=z.useRef(null),o=L(),s=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),d=z.useMemo(()=>V(l,u),[l,u]),f=i({queryKey:[`file_changes`,e,s,c,d],queryFn:async()=>{if(!e)throw Error(`No conversation ID`);return ge.getGitChanges(e,s,c,d)},retry:!1,staleTime:1e3*60*5,gcTime:1e3*60*15,refetchOnMount:`always`,enabled:o&&!!e,meta:{disableToast:!0}});return z.useEffect(()=>{if(!f.isFetching&&f.isSuccess&&f.data){let e=f.data;if(e!==a.current)if(a.current=e,Array.isArray(e)){let t=new Set(e.map(e=>e.path)),i=new Set(n.map(e=>e.path)),a=e.filter(e=>!i.has(e.path)),o=n.filter(e=>t.has(e.path));r([...a,...o])}else r([e])}},[f.isFetching,f.isSuccess,f.data]),{data:n,isLoading:f.isLoading,isFetching:f.isFetching,isSuccess:f.isSuccess,isError:f.isError,error:f.error,refetch:f.refetch}},U=2e3,_e=[`.git`,`node_modules`,`.venv`,`venv`,`__pycache__`,`dist`,`build`,`.next`,`.cache`,`.pytest_cache`,`.mypy_cache`,`.turbo`,`.parcel-cache`,`target`];function ve(){return`find . \\( ${_e.map(e=>`-name '${e}' -prune`).join(` -o `)} \\) -o -type f -print 2>/dev/null | sort | head -n ${U}`}function ye(e){return e.startsWith(`./`)?e.slice(2):e}function be(e){let{data:t}=F(),n=L(),r=t?.id,a=t?.conversation_url,o=t?.session_api_key,s=t?.workspace?.working_dir?.trim(),c=i({queryKey:[`workspace-files`,r,a,o,s],queryFn:async()=>{let e=await me.executeCommand(a,o,ve(),s,30);if(e.exit_code!==0)throw Error(e.stderr?.trim()||`Failed to list workspace files`);let t=e.stdout.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(ye);return Array.from(new Set(t)).slice(0,U)},enabled:e&&n&&!!r&&!!s,retry:!1,staleTime:1e3*30,gcTime:1e3*60*5,meta:{disableToast:!0}});return{data:c.data,isLoading:c.isLoading}}function xe(e){let t=H(),n=(0,z.useMemo)(()=>{if(!e)return;let n=t.data.filter(e=>e.status!==`D`).map(e=>e.path);return Array.from(new Set(n)).slice(0,U)},[e,t.data]);return{data:e?n:void 0,isLoading:e?t.isLoading:!1}}function Se(){let{backend:e}=l(),t=e.kind===`cloud`,n=be(!t),r=xe(t);return t?r:n}function Ce(){let{data:e}=F(),t=L(),n=e?.id,r=e?.conversation_url,a=e?.session_api_key,o=C().backend.kind===`local`,s=i({queryKey:[`workspace-session`,n,r,a],queryFn:async()=>({baseUrl:await new A(w({conversationUrl:r,sessionApiKey:a})).startWorkspaceSession(n)}),enabled:t&&!!n&&o,staleTime:1/0,gcTime:1/0,retry:!1});return{data:s.data??null,isLoading:s.isLoading,isError:s.isError,error:s.error??null}}function we(e,t){let n=(t??``).replace(/^\/+/,``);return n?`${e}${n.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`:e}var W=D(e=>({count:0,bump:()=>e(e=>({count:e.count+1}))}));function G(e,t){return e===null?null:`${e}${e.includes(`?`)?`&`:`?`}v=${t}`}var Te=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`svg`,`avif`]),Ee=new Set([`pdf`]);function K(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function De(e){switch(K(e)){case`html`:case`htm`:return`text/html`;case`css`:return`text/css`;case`js`:case`mjs`:case`cjs`:return`text/javascript`;case`json`:return`application/json`;case`md`:case`markdown`:return`text/markdown`;case`svg`:return`image/svg+xml`;case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`gif`:return`image/gif`;case`webp`:return`image/webp`;case`bmp`:return`image/bmp`;case`ico`:return`image/x-icon`;case`avif`:return`image/avif`;case`pdf`:return`application/pdf`;default:return`text/plain`}}function Oe(e){let t=K(e);return Te.has(t)?`image`:Ee.has(t)?`pdf`:`text`}function q(e){let t=new Uint8Array(e,0,Math.min(e.byteLength,8e3));for(let e=0;e<t.length;e+=1)if(t[e]===0)return!0;return!1}function J(e){let t=new Uint8Array(e),n=32768,r=``;for(let e=0;e<t.length;e+=n)r+=String.fromCharCode.apply(null,t.subarray(e,e+n));return btoa(r)}function Y(e){let{data:t}=F(),n=L(),{data:r}=Ce(),a=W(e=>e.count),o=t?.id,s=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),d=r?.baseUrl,f=C().backend.kind===`cloud`,p=V(l,u),m=p.startsWith(`/`)?p:`/${p}`,h=e?`${m}/${e}`:null;return i({queryKey:[`workspace-file-content`,o,s,c,f?`cloud`:d,e,h,a],queryFn:async()=>{if(!e)throw Error(`No path`);let t=Oe(e),n=De(e);if(f){let r=await j(o,h);if(t===`text`){let t=new TextEncoder().encode(r);return q(t.buffer)?{path:e,kind:`binary`,text:null,staticUrl:`data:application/octet-stream;base64,${J(t.buffer)}`,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:r,staticUrl:`data:${n};charset=utf-8;base64,${J(t.buffer)}`,mimeType:n}}return{path:e,kind:t,text:null,staticUrl:`data:${n};base64,${J(new TextEncoder().encode(r).buffer)}`,mimeType:n}}if(!d)throw Error(`No workspace session`);let r=we(d,e);if(t!==`text`)return{path:e,kind:t,text:null,staticUrl:r,mimeType:n};let i=await fetch(r,{credentials:`include`});if(!i.ok)throw Error(`Failed to read ${e}: ${i.status}`);let a=await i.arrayBuffer();return q(a)?{path:e,kind:`binary`,text:null,staticUrl:r,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:new TextDecoder(`utf-8`,{fatal:!1}).decode(a),staticUrl:r,mimeType:n}},enabled:n&&!!o&&!!e&&(f||!!d),retry:!1,staleTime:1e3*5,gcTime:1e3*60,meta:{disableToast:!0}})}function ke(){let{data:e,isLoading:t}=F(),n=e?.id?M(e.id):null;return{hasAttachedSource:!!e?.selected_repository||!!n?.selected_workspace,isLoading:t}}function Ae(e){let{data:t}=F(),n=L(),{backend:r}=l(),a=r.kind===`local`,o=t?.id,s=t?.conversation_url,c=t?.session_api_key,u=t?.workspace?.working_dir?.trim(),d=(e?.enabled??!0)&&a&&n&&!!o&&!!u,f=i({queryKey:[`has-git-commits`,o,s,c,u],queryFn:async()=>(await me.executeCommand(s,c,`git rev-parse --verify HEAD`,u,10)).exit_code===0,enabled:d,retry:!1,staleTime:6e4,gcTime:5*6e4,meta:{disableToast:!0}});return{hasCommits:f.data??null,isLoading:f.isLoading}}var je=new Set([`FileEditorObservation`,`StrReplaceEditorObservation`,`PlanningFileEditorObservation`]),Me=new Set([`view`]),Ne=new Set([`ExecuteBashObservation`,`TerminalObservation`]);function Pe(e){let t=e.observation;return!(!t||typeof t.kind!=`string`||!je.has(t.kind)||t.command&&Me.has(t.command))}function Fe(e){let t=e.observation;return!!t&&typeof t.kind==`string`&&Ne.has(t.kind)}function Ie(){let e=r(),t=ae(e=>e.events),n=W(e=>e.bump),i=(0,z.useRef)(new Set),a=(0,z.useRef)(new WeakSet);(0,z.useEffect)(()=>{let r=!1,o=!1;for(let e of t){let t=`id`in e?e.id:void 0;(t===void 0?a.current.has(e):i.current.has(t))||(t===void 0?a.current.add(e):i.current.add(t),Pe(e)?r=!0:Fe(e)&&(o=!0))}!r&&!o||(e.invalidateQueries({queryKey:[`file_changes`]}),e.invalidateQueries({queryKey:[`file_diff`]}),r&&(e.invalidateQueries({queryKey:[`workspace-files`]}),e.invalidateQueries({queryKey:[`workspace-file-content`]}),n()))},[t,e,n])}var Le=[`index.html`,`index.htm`,`readme.md`,`readme`,`main.html`,`app.html`,`index.js`,`index.ts`,`index.tsx`,`index.jsx`,`main.py`,`app.py`,`main.go`,`main.rs`,`main.java`,`main.c`,`main.cpp`,`package.json`,`pyproject.toml`,`cargo.toml`,`go.mod`,`pom.xml`,`dockerfile`,`makefile`],Re=[`license`,`license.md`,`license.txt`,`changelog.md`,`agents.md`,`tsconfig.json`,`.env.sample`,`.env.example`];function ze(e){let t=e.lastIndexOf(`/`);return(t===-1?e:e.slice(t+1)).toLowerCase()}function X(e){return e.split(`/`).filter(Boolean).length-1}function Be(e){let t=ze(e),n=Le.indexOf(t);if(n!==-1)return n;let r=Re.indexOf(t);return r===-1?1e4:1e3+r}function Ve(e){return[...e].sort((e,t)=>{let n=X(e)-X(t);if(n!==0)return n;let r=Be(e)-Be(t);return r===0?e.localeCompare(t):r})}function He({paths:e,selectedPath:t,onSelectFile:n,isTreeVisible:r,onToggleTree:i}){let{t:s}=a(`openhands`),c=(0,z.useMemo)(()=>Ve(e),[e]);return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-[var(--oh-border)] px-2 py-1.5 min-h-[34px]`,"data-testid":`file-quick-row`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:i,"data-testid":`file-quick-row-tree-toggle`,"aria-pressed":r,"aria-label":s(r?o.FILES$HIDE_FILE_TREE:o.FILES$SHOW_FILE_TREE),title:s(r?o.FILES$HIDE_FILE_TREE:o.FILES$SHOW_FILE_TREE),className:b(`shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md cursor-pointer`,`text-[var(--oh-text-tertiary)] hover:bg-tertiary`,r&&`bg-[var(--oh-surface-raised)]`),children:(0,B.jsx)(p,{className:`w-3 h-3`,"aria-hidden":!0,strokeWidth:2})}),c.length>0&&(0,B.jsx)(`div`,{className:`flex flex-nowrap items-center gap-1.5 overflow-hidden flex-1 min-w-0`,children:c.map(e=>{let r=t===e;return(0,B.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:e,"data-testid":`file-quick-row-item-${e}`,className:b(`inline-flex items-center px-2 py-0.5 text-xs whitespace-nowrap rounded-md cursor-pointer`,r?`bg-[var(--oh-interactive-hover)] text-white`:`bg-[var(--oh-surface-raised)] text-[var(--oh-text-tertiary)] hover:bg-tertiary`),children:e},e)})})]})}function Ue(e){e.children.sort((e,t)=>e.isDirectory===t.isDirectory?e.name.localeCompare(t.name):e.isDirectory?-1:1);for(let t of e.children)t.isDirectory&&Ue(t)}function We(e,t,n,r,i){let a=t.get(e);a||(a=new Map,t.set(e,a));let o=a.get(n);if(o)return!i&&!o.isDirectory&&(o.isDirectory=!0),o;let s={name:n,path:r,isDirectory:!i,children:[]};return e.children.push(s),a.set(n,s),s}function Ge(e){let t={name:``,path:``,isDirectory:!0,children:[]},n=new Map;for(let r of e){let e=r.split(`/`).filter(Boolean);if(e.length>0){let r=t,i=``;for(let t=0;t<e.length;t+=1){let a=e[t];i=i?`${i}/${a}`:a;let o=t===e.length-1;r=We(r,n,a,i,o)}}}return Ue(t),t}function Ke({node:e,depth:t,selectedPath:n,onSelectFile:r}){let[i,a]=(0,z.useState)(!1),o=8+t*12;if(e.isDirectory)return(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-expanded":i,"data-testid":`file-tree-dir-${e.path}`,className:b(`flex w-full items-center gap-1.5 py-1 pr-2 text-left text-sm text-white`,`hover:bg-tertiary cursor-pointer`),style:{paddingLeft:`${o}px`},children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:b(`inline-block w-3 text-[10px] text-[var(--oh-muted)] transition-transform`,i?`rotate-90`:`rotate-0`),children:`▶`}),(0,B.jsx)(ee,{className:`w-3.5 h-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]}),i&&e.children.length>0&&(0,B.jsx)(`ul`,{children:e.children.map(e=>(0,B.jsx)(Ke,{node:e,depth:t+1,selectedPath:n,onSelectFile:r},e.path))})]});let s=n===e.path;return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(e.path),"data-testid":`file-tree-file-${e.path}`,className:b(`flex w-full items-center gap-1.5 py-1 pr-2 text-left text-sm`,`hover:bg-tertiary cursor-pointer`,s?`bg-[var(--oh-interactive-hover)] text-white`:`text-[var(--oh-text-tertiary)]`),style:{paddingLeft:`${o+16}px`},children:[(0,B.jsx)(re,{className:`w-3.5 h-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]})})}function qe({paths:e,selectedPath:t,onSelectFile:n}){let{t:r}=a(`openhands`),i=(0,z.useMemo)(()=>Ge(e),[e]);return i.children.length===0?(0,B.jsx)(`div`,{className:`px-3 py-4 text-sm text-[var(--oh-muted)]`,children:r(o.FILES$NO_FILES)}):(0,B.jsx)(`ul`,{className:`py-1 custom-scrollbar-always`,"data-testid":`file-tree-view`,children:i.children.map(e=>(0,B.jsx)(Ke,{node:e,depth:0,selectedPath:t,onSelectFile:n},e.path))})}var Je={js:`javascript`,jsx:`jsx`,mjs:`javascript`,cjs:`javascript`,ts:`typescript`,tsx:`tsx`,py:`python`,pyi:`python`,pyw:`python`,html:`markup`,htm:`markup`,svg:`markup`,xml:`markup`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,json:`json`,json5:`json5`,yaml:`yaml`,yml:`yaml`,toml:`toml`,ini:`ini`,cfg:`ini`,properties:`properties`,conf:`ini`,env:`bash`,md:`markdown`,markdown:`markdown`,mdx:`markdown`,sh:`bash`,bash:`bash`,zsh:`bash`,fish:`bash`,bat:`batch`,cmd:`batch`,ps1:`powershell`,ps:`powershell`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,cs:`csharp`,java:`java`,kt:`kotlin`,kts:`kotlin`,scala:`scala`,rs:`rust`,go:`go`,rb:`ruby`,php:`php`,swift:`swift`,m:`objectivec`,mm:`objectivec`,hs:`haskell`,ex:`elixir`,exs:`elixir`,erl:`erlang`,fs:`fsharp`,fsx:`fsharp`,ml:`ocaml`,mli:`ocaml`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,lua:`lua`,pl:`perl`,pm:`perl`,r:`r`,jl:`julia`,dart:`dart`,groovy:`groovy`,gradle:`groovy`,tf:`hcl`,hcl:`hcl`,dockerfile:`docker`,sql:`sql`,graphql:`graphql`,gql:`graphql`,proto:`protobuf`,diff:`diff`,patch:`diff`,nix:`nix`,sol:`solidity`},Ye={dockerfile:`docker`,makefile:`makefile`,gnumakefile:`makefile`,".bashrc":`bash`,".zshrc":`bash`,".profile":`bash`,".env":`bash`,".gitignore":`bash`,".dockerignore":`bash`};function Xe(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)),n=e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r+1).toLowerCase()}function Ze(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return e.slice(t+1).toLowerCase()}function Qe(e,t){let n=Ye[Ze(e)];if(n)return n;let r=Xe(e);if(r&&Je[r])return Je[r];if(t){if(t===`text/html`)return`markup`;if(t===`text/css`)return`css`;if(t===`application/json`)return`json`;if(t===`text/markdown`)return`markdown`;if(t===`application/javascript`||t===`text/javascript`)return`javascript`;if(t===`application/x-yaml`||t===`text/yaml`)return`yaml`}return null}function $e({path:e,text:t,mimeType:n}){let r=Qe(e,n);return r?(0,B.jsx)(`div`,{"data-testid":`file-content-viewer-highlighted`,"data-language":r,className:`h-full w-full overflow-auto bg-[var(--oh-surface)] custom-scrollbar-always`,children:(0,B.jsx)(oe,{language:r,style:se,showLineNumbers:!0,wrapLongLines:!1,customStyle:{margin:0,padding:`1rem`,background:`transparent`,fontSize:`0.75rem`,lineHeight:`1.25rem`,minHeight:`100%`},codeTagProps:{style:{background:`transparent`,fontFamily:`inherit`}},lineNumberStyle:{color:`var(--oh-border)`,minWidth:`2.5em`,paddingRight:`1em`,userSelect:`none`},children:t})}):(0,B.jsx)(`pre`,{"data-testid":`file-content-viewer-plain`,className:`h-full w-full overflow-auto whitespace-pre-wrap break-words bg-[var(--oh-surface)] p-4 text-xs leading-5 text-white custom-scrollbar-always`,children:t})}var et=new Set([`html`,`htm`,`svg`]),tt=new Set([`md`,`markdown`,`mdx`]),nt={pptx:`PowerPoint`,ppt:`PowerPoint`,docx:`Word`,doc:`Word`,xlsx:`Excel`,xls:`Excel`};function Z(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function Q({path:e}){let{t}=a(`openhands`),n=nt[Z(e)];return(0,B.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,"data-testid":n?`file-content-viewer-unsupported-document`:`file-content-viewer-binary-fallback`,children:n?t(o.FILES$UNSUPPORTED_DOCUMENT,{type:n}):t(o.FILES$BINARY_FALLBACK)})}function rt({path:e,viewMode:t}){let{t:n}=a(`openhands`),r=Y(e),i=W(e=>e.count);if(r.isLoading)return(0,B.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,children:n(o.FILES$LOADING_FILES)});if(r.isError||!r.data)return(0,B.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,"data-testid":`file-content-viewer-error`,children:r.error?.message??n(o.FILES$LOAD_ERROR)});let{kind:s,text:c,staticUrl:l,mimeType:u}=r.data,d=G(l,i);return t===`plain`?s===`text`&&c!==null?(0,B.jsx)($e,{path:e,text:c,mimeType:u??void 0}):(0,B.jsx)(Q,{path:e}):s===`image`?(0,B.jsx)(`div`,{className:`flex h-full w-full items-center justify-center bg-[var(--oh-surface)] p-4`,"data-testid":`file-content-viewer-image`,children:(0,B.jsx)(`img`,{src:d,alt:e,className:`max-h-full max-w-full object-contain`})}):s===`pdf`?(0,B.jsx)(`iframe`,{title:e,src:d,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):s===`binary`?(0,B.jsx)(Q,{path:e}):u===`text/html`||et.has(Z(e))?(0,B.jsx)(`iframe`,{title:e,src:d,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):s===`text`&&tt.has(Z(e))?(0,B.jsx)(`div`,{"data-testid":`file-content-viewer-markdown`,className:`h-full w-full overflow-auto bg-[var(--oh-surface)] text-white custom-scrollbar-always`,children:(0,B.jsx)(`div`,{className:`prose prose-sm prose-invert max-w-none p-6 [--tw-prose-body:#fff] [--tw-prose-bold:#fff] [--tw-prose-headings:#fff] [--tw-prose-lead:#fff] [--tw-prose-counters:#fff] [--tw-prose-quotes:#fff] [--tw-prose-quote-borders:var(--oh-border-subtle)] [--tw-prose-bullets:var(--oh-muted)] [--tw-prose-hr:var(--oh-border-subtle)] [--tw-prose-captions:var(--oh-muted)] [--tw-prose-kbd:#fff]`,children:(0,B.jsx)(ce,{content:c??``,includeStandard:!0,includeHeadings:!0})})}):s===`text`&&c!==null?(0,B.jsx)($e,{path:e,text:c,mimeType:u??void 0}):(0,B.jsx)(Q,{path:e})}var it=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 13 15`,fill:`none`,...e,children:(0,B.jsx)(`path`,{d:`M6.59467 0.21967C6.88756 -0.0732233 7.36244 -0.0732233 7.65533 0.21967L9.90533 2.46967C10.1982 2.76256 10.1982 3.23744 9.90533 3.53033L7.65533 5.78033C7.36244 6.07322 6.88756 6.07322 6.59467 5.78033C6.30178 5.48744 6.30178 5.01256 6.59467 4.71967L7.56434 3.75H6.375C3.71421 3.75 1.5 5.96421 1.5 8.625C1.5 11.2858 3.71421 13.5 6.375 13.5C9.03579 13.5 11.25 11.2858 11.25 8.625C11.25 8.21079 11.5858 7.875 12 7.875C12.4142 7.875 12.75 8.21079 12.75 8.625C12.75 12.1142 9.86421 15 6.375 15C2.88579 15 0 12.1142 0 8.625C0 5.13579 2.88579 2.25 6.375 2.25H7.56434L6.59467 1.28033C6.30178 0.987437 6.30178 0.512563 6.59467 0.21967Z`,fill:`currentColor`})}),at=e=>(0,B.jsx)(`svg`,{width:13,height:8,viewBox:`0 0 13 8`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,B.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M0.259766 6.17427L6.26425 0.715628L12.2688 6.17427L11.2597 7.28418L6.26425 2.74282L1.26878 7.28418L0.259766 6.17427Z`,fill:`currentColor`})}),ot=e=>{let{conversationId:t}=P(),{data:n}=F(),r=n?.conversation_url,a=n?.session_api_key,o=n?.selected_repository,s=n?.workspace?.working_dir?.trim(),c=z.useMemo(()=>`${V(o,s)}/${e.filePath}`,[o,e.filePath,s]),l=e.type===`D`;return i({queryKey:[`file_diff`,t,r,a,c],queryFn:async()=>{if(!t)throw Error(`No conversation ID`);return ge.getGitChangeDiff(t,r,a,c)},enabled:e.enabled&&!l,staleTime:1e3*60*5,gcTime:1e3*60*15})};function st({className:e}){let{t}=a(`openhands`);return(0,B.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,B.jsx)(`div`,{className:b(`animate-spin rounded-full border-4 border-transparent border-t-white`,e),role:`status`,"aria-label":t(o.HOME$LOADING)})})}function ct({height:e,children:t}){return(0,B.jsx)(`div`,{"data-testid":`editor-container`,className:`w-full border-b border-[var(--oh-border)] overflow-hidden h-[var(--editor-height)]`,style:{"--editor-height":`${e}px`},children:t})}var lt=[{mode:`old`,icon:h},{mode:`diff`,icon:u},{mode:`new`,icon:v}],$={renderValidationDecorations:`off`,readOnly:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},automaticLayout:!0,scrollbar:{alwaysConsumeMouseWheel:!1}},ut={A:f,D:g,M:m,R:`Renamed`,U:`Untracked`},dt=e=>{e.editor.defineTheme(`custom-diff-theme`,{base:`vs-dark`,inherit:!0,rules:[{token:`comment`,foreground:`6a9955`},{token:`keyword`,foreground:`569cd6`},{token:`string`,foreground:`ce9178`},{token:`number`,foreground:`b5cea8`}],colors:{"diffEditor.insertedTextBackground":`#014b01AA`,"diffEditor.removedTextBackground":`#750000AA`,"diffEditor.insertedLineBackground":`#003f00AA`,"diffEditor.removedLineBackground":`#5a0000AA`,"diffEditor.border":`var(--oh-border-subtle)`,"editorUnnecessaryCode.border":`#00000000`,"editorUnnecessaryCode.opacity":`rgba(0, 0, 0, 0.467)`}})};function ft({path:e,type:t}){let{t:n}=a(`openhands`),[r,i]=z.useState(!0),[s,c]=z.useState(400),[l,u]=z.useState(`diff`),f=z.useRef(null),p=z.useRef(null),m=t===`A`||t===`U`,h=t===`D`,g=z.useMemo(()=>{if(t===`R`){let t=e.split(/\s+/).slice(1);return t[t.length-1]}return e},[e,t]),{data:v,isLoading:y,isSuccess:x,isRefetching:S}=ot({filePath:g,type:t,enabled:!r}),C=z.useCallback(()=>{if(!f.current)return;let e=f.current.getOriginalEditor(),t=f.current.getModifiedEditor();e&&t&&c(Math.max(e.getContentHeight(),t.getContentHeight())+20)},[]),w=z.useCallback(()=>{p.current&&c(p.current.getContentHeight()+20)},[]),T=e=>{f.current=e,C(),e.getOriginalEditor().onDidContentSizeChange(C),e.getModifiedEditor().onDidContentSizeChange(C)},E=e=>{p.current=e,w(),e.onDidContentSizeChange(w)},D=(t===`U`?ut.A:ut[t])||`?`,O=typeof D==`string`?(0,B.jsx)(te.Text,{children:D}):z.createElement(D,{className:`w-5 h-5`}),k=y||S,A=fe(g),j=A===`markdown`,M=l===`old`?v?.original??``:v?.modified??``;return(0,B.jsxs)(`div`,{"data-testid":`file-diff-viewer-outer`,className:`w-full flex flex-col`,children:[(0,B.jsx)(`div`,{className:`flex justify-between items-center px-3 py-2.5 border-b border-[var(--oh-border)] hover:cursor-pointer`,onClick:()=>i(e=>!e),children:(0,B.jsxs)(`span`,{className:`text-sm w-full text-content flex items-center gap-2`,children:[k?(0,B.jsx)(st,{className:`w-4 h-4`}):O,(0,B.jsx)(`strong`,{className:`w-full truncate font-medium`,children:g}),!r&&!h&&(0,B.jsx)(`span`,{className:`flex items-center gap-0.5 shrink-0`,onClick:e=>e.stopPropagation(),children:lt.map(({mode:e,icon:t})=>(0,B.jsx)(`button`,{"data-testid":`view-mode-${e}`,type:`button`,"aria-pressed":l===e,onClick:()=>u(e),className:b(`p-1 rounded transition-colors cursor-pointer`,l===e?`bg-[var(--oh-interactive-hover)] text-white`:`text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-white`),children:(0,B.jsx)(t,{className:`w-4 h-4`})},e))}),(0,B.jsx)(`button`,{"data-testid":`collapse`,type:`button`,children:(0,B.jsx)(at,{className:b(`w-4 h-4 transition-transform`,r&&`transform rotate-180`)})})]})}),!r&&h&&(0,B.jsx)(`div`,{"data-testid":`file-deleted-message`,className:`w-full border-b border-[var(--oh-border)] p-4 bg-base text-[var(--oh-text-dim)] text-sm`,children:n(o.DIFF_VIEWER$FILE_DELETED)}),!r&&!h&&x&&(l===`diff`?(0,B.jsx)(ct,{height:s,children:(0,B.jsx)(d,{"data-testid":`file-diff-viewer`,className:`w-full h-full`,language:A,original:m?``:v?.original??``,modified:h?``:v?.modified??``,theme:`custom-diff-theme`,onMount:T,beforeMount:dt,options:{...$,renderSideBySide:!m&&!h,hideUnchangedRegions:{enabled:!0}}})}):j?(0,B.jsx)(`div`,{className:`w-full border-b border-[var(--oh-border)] overflow-auto p-4 bg-base prose prose-invert max-w-none`,"data-testid":`markdown-preview`,children:(0,B.jsx)(ce,{content:M,includeStandard:!0,includeHeadings:!0})}):(0,B.jsx)(ct,{height:s,children:(0,B.jsx)(_,{"data-testid":`file-single-viewer`,className:`w-full h-full`,language:A,value:M,theme:`custom-diff-theme`,beforeMount:dt,onMount:E,options:$})}))]})}function pt(){return(0,B.jsx)(m,{"aria-hidden":!0,className:`size-full`})}function mt(){let{t:e}=a(`openhands`);return(0,B.jsx)(R,{icon:(0,B.jsx)(pt,{}),children:e(o.DIFF_VIEWER$NO_CHANGES)})}var ht=[{key:o.TIPS$CUSTOMIZE_MICROAGENT,link:`https://docs.all-hands.dev/usage/prompting/microagents-repo`},{key:o.TIPS$SETUP_SCRIPT,link:`https://docs.all-hands.dev/usage/prompting/repository#setup-script`},{key:o.TIPS$VSCODE_INSTANCE},{key:o.TIPS$SAVE_WORK},{key:o.TIPS$SPECIFY_FILES,link:`https://docs.all-hands.dev/usage/prompting/prompting-best-practices`},{key:o.TIPS$HEADLESS_MODE,link:`https://docs.all-hands.dev/usage/how-to/headless-mode`},{key:o.TIPS$CLI_MODE,link:`https://docs.all-hands.dev/usage/how-to/cli-mode`},{key:o.TIPS$GITHUB_HOOK,link:`https://docs.all-hands.dev/usage/cloud/github-installation#working-on-github-issues-and-pull-requests-using-openhands`},{key:o.TIPS$BLOG_SIGNUP,link:`https://www.all-hands.dev/blog`},{key:o.TIPS$API_USAGE,link:`https://docs.all-hands.dev/api-reference/health-check`}];function gt(){return ht[Math.floor(Math.random()*ht.length)]}function _t(){let{t:e}=a(`openhands`),[t,n]=z.useState(gt());return z.useEffect(()=>{n(gt())},[]),(0,B.jsx)(`div`,{className:`w-full bg-tertiary p-4 text-left`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(de,{className:`mt-0.5 h-4 w-4 shrink-0 fill-[var(--oh-muted)]`,"aria-hidden":!0}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-[var(--oh-text-tertiary)]`,children:e(o.TIPS$PROTIP)}),(0,B.jsxs)(`p`,{className:`text-sm font-normal leading-5 text-[var(--oh-muted)]`,children:[e(t.key),t.link?(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsx)(`a`,{href:t.link,target:`_blank`,rel:`noopener noreferrer`,className:`underline transition-colors hover:text-white`,children:e(o.TIPS$LEARN_MORE)})]}):null]})]})]})})}var vt=/not a git repository/i,yt=new Set([o.DIFF_VIEWER$WAITING_FOR_RUNTIME,o.DIFF_VIEWER$LOADING]);function bt({messages:e}){let{t}=a(`openhands`);return e.length===1&&yt.has(e[0])?(0,B.jsx)(le,{testId:`changes-tab-status`,messageKey:e[0]}):(0,B.jsx)(R,{icon:(0,B.jsx)(pt,{}),children:e.map(e=>(0,B.jsx)(`span`,{className:`block`,children:t(e)},e))})}function xt(){let{data:e,isSuccess:t,isError:n,error:r,isLoading:i}=H(),[a,s]=z.useState(null),{curAgentState:l}=ie(),u=!x.includes(l),d=r&&vt.test(c(r));return z.useEffect(()=>{if(!u)s([o.DIFF_VIEWER$WAITING_FOR_RUNTIME]);else if(r){let e=c(r);vt.test(e)?s([o.DIFF_VIEWER$NOT_A_GIT_REPO,o.DIFF_VIEWER$ASK_OH]):s([e])}else s(i?[o.DIFF_VIEWER$LOADING]:null)},[u,d,i,r,s]),(0,B.jsx)(`main`,{className:`h-full w-full flex flex-col items-stretch`,children:!t||!e.length?(0,B.jsxs)(`div`,{className:`flex flex-col h-full w-full`,children:[(0,B.jsxs)(`div`,{className:`flex-1 flex items-center justify-center`,children:[a&&(0,B.jsx)(bt,{messages:a}),!a&&t&&e.length===0&&(0,B.jsx)(mt,{})]}),!n&&t&&e.length===0&&(0,B.jsx)(_t,{})]}):(0,B.jsx)(`div`,{className:`h-full overflow-y-auto flex flex-col items-stretch custom-scrollbar-always`,children:e.slice(0,100).map(e=>(0,B.jsx)(ft,{path:e.path,type:e.status},e.path))})})}function St(){let{t:e}=a(`openhands`);Ie();let{hasAttachedSource:t,isLoading:n}=ke(),{hasCommits:i}=Ae({enabled:t}),{conversationId:s}=ne(),{state:c,setFilesTabDiffView:l,setFilesTabContentViewMode:u}=O(s??``),d=(t||n)&&i!==!1,f=c.filesTabDiffView??d,p=c.filesTabContentViewMode,[m,h]=(0,z.useState)(!1),g=Se(),_=(0,z.useMemo)(()=>g.data??[],[g.data]),v=I(e=>e.selectedPath),y=I(e=>e.selectedConversationId),b=I(e=>e.setSelectedPath),x=y===s?v:null,S=(0,z.useCallback)(e=>b(e,s),[s,b]),C=Y(x),w=W(e=>e.count),T=G(C.data?.staticUrl??null,w);(0,z.useEffect)(()=>{y!==s&&b(null,s)},[y,s,b]),(0,z.useEffect)(()=>{if(x||_.length===0)return;let[e]=Ve(_);e&&b(e,s)},[_,x,s,b]);let E=r(),{refetch:D,isFetching:A}=H();return(0,B.jsxs)(`main`,{className:`h-full w-full flex flex-col items-stretch`,"data-testid":`files-tab`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 border-b border-[var(--oh-border)]`,children:[(0,B.jsx)(k,{ariaLabel:e(o.FILES$DIFF_VIEW),testId:`files-tab-diff-toggle`,value:f?`on`:`off`,options:[{value:`on`,label:e(o.FILES$DIFF_VIEW)},{value:`off`,label:e(o.COMMON$FILES)}],onChange:e=>l(e===`on`)}),!f&&(0,B.jsx)(k,{ariaLabel:e(o.FILES$RICH),testId:`files-tab-content-mode-toggle`,value:p,options:[{value:`rich`,label:e(o.FILES$RICH)},{value:`plain`,label:e(o.FILES$PLAIN)}],onChange:u}),(0,B.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[!f&&T&&(0,B.jsx)(`a`,{href:T,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e(o.FILES$OPEN_IN_NEW_WINDOW),title:e(o.FILES$OPEN_IN_NEW_WINDOW),"data-testid":`files-tab-open-in-new-window`,className:`flex items-center justify-center w-[26px] py-1 rounded-[7px] hover:bg-[var(--oh-interactive-hover)] cursor-pointer text-white`,children:(0,B.jsx)(ue,{width:14,height:14})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{D(),E.invalidateQueries({queryKey:[`workspace-files`]}),E.invalidateQueries({queryKey:[`workspace-file-content`]})},disabled:A,"aria-label":e(o.FILES$REFRESH),title:e(o.FILES$REFRESH),"data-testid":`files-tab-refresh`,className:`flex items-center justify-center w-[26px] py-1 rounded-[7px] hover:enabled:bg-[var(--oh-interactive-hover)] cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,B.jsx)(it,{width:12.75,height:15,color:`#ffffff`,className:A?`animate-spin`:``})})]})]}),f?(0,B.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,B.jsx)(xt,{})}):(0,B.jsx)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:g.isLoading?(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-[var(--oh-muted)]`,children:e(o.FILES$LOADING_FILES)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(He,{paths:_,selectedPath:x,onSelectFile:S,isTreeVisible:m,onToggleTree:()=>h(e=>!e)}),(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1`,children:[m&&(0,B.jsx)(`aside`,{className:`w-56 shrink-0 border-r border-[var(--oh-border)] overflow-y-auto custom-scrollbar-always`,"data-testid":`files-tab-tree`,children:(0,B.jsx)(qe,{paths:_,selectedPath:x,onSelectFile:S})}),(0,B.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,"data-testid":`files-tab-content`,children:x?(0,B.jsx)(rt,{path:x,viewMode:p}):(0,B.jsx)(pe,{})})]})]})})]})}export{St as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n}from"./vendor-styling-CI0PQ3ab.js";import{n as r}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~epa72zsm-B4rXs7Zd.js";import{t as i}from"./useQuery-CRBP8vIS.js";import{t as a}from"./useTranslation-CDRCKC9-.js";import{t as o}from"./declaration-gq8V5eTU.js";import{d as s}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~lf310vj7-CSVPGId3.js";import{P as c,n as l}from"./active-backend-context-hxq31W25.js";import{a as u,c as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v}from"./vendor~files-tab-B02k3xvx.js";import{t as y}from"./mouse-pointer-click-PdEQPL6v.js";import{t as b,w as x}from"./utils-D3U3rlqr.js";import{a as S,c as C,n as w,y as T}from"./agent-server-client-options-DVLRd9sw.js";import{t as E}from"./proxy-BgJLtxu7.js";import{t as D}from"./react-DPDgL6du.js";import{s as O}from"./conversation-local-storage-F6zVMM--.js";import{t as k}from"./segmented-toggle-DyQqPhoD.js";import{i as A}from"./vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-B0EIDu4M.js";import{i as j,o as M}from"./agent-server-conversation-service.api-CuSdr4Qb.js";import{t as ee}from"./folder-mMWFvaw0.js";import{t as N}from"./git-status-mapper-BI8FyUVp.js";import{r as te}from"./typography-D8mHDeNG.js";import{n as P,r as ne,t as F}from"./use-active-conversation-DOZVSVtU.js";import{n as re,t as I}from"./files-tab-store-DJsPxYdg.js";import{t as ie}from"./use-agent-state-DHZO1obC.js";import{t as ae}from"./use-event-store-DjgU4wfO.js";import{ot as oe,st as se}from"./vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-d8aETPbZ.js";import{t as ce}from"./markdown-renderer-DMT7Zkpd.js";import{t as le}from"./runtime-waiting-state-BsXLElvN.js";import{t as ue}from"./link-external-DfKQroKX.js";import{t as L}from"./use-runtime-is-ready-RKj2WmEh.js";import{n as de,t as fe}from"./get-language-from-path-CPNnuVhI.js";import{t as R}from"./conversation-tab-empty-state-B2dDYEwf.js";var z=e(t(),1),B=n();function pe(){let{t:e}=a(`openhands`);return(0,B.jsx)(R,{className:`h-full`,icon:(0,B.jsx)(y,{"aria-hidden":!0,strokeWidth:2,className:`size-full`}),children:e(o.FILES$NO_FILE_SELECTED)})}var me=class{static async executeCommand(e,t,n,r,i=30){let a=C().backend;if(a.kind===`cloud`&&e){let o=await E({backend:a,method:`POST`,hostOverride:S(e),path:`/api/bash/execute_bash_command`,body:{command:n,...r?{cwd:r}:{},timeout:Math.floor(i)},authMode:`session-api-key`,sessionApiKey:t,timeoutSeconds:i+10});return{exit_code:o.exit_code??-1,stdout:o.stdout??``,stderr:o.stderr??``}}let o=await new A(w({conversationUrl:e,sessionApiKey:t})).executeCommand(n,r,i);return{exit_code:o.exit_code,stdout:o.stdout,stderr:o.stderr}}static async downloadFile(e,t,n){let r=C().backend;return r.kind===`cloud`&&e?(await E({backend:r,method:`GET`,hostOverride:S(e),path:`/api/file/download?path=${encodeURIComponent(n)}`,authMode:`session-api-key`,sessionApiKey:t,responseType:`blob`})).arrayBuffer():new s(w({conversationUrl:e,sessionApiKey:t})).downloadFile(n)}};function he(e){return e.startsWith(`/`)?e:`/${e}`}var ge=class{static async getGitChanges(e,t,n,r){let i=C().backend;if(i.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,he(r));let n=await E({backend:i,method:`GET`,path:`/api/v1/app-conversations/${e}/git/changes?${t.toString()}`});if(!Array.isArray(n))throw Error(`Invalid response from runtime - runtime may be unavailable`);return n.map(e=>({status:N(String(e.status)),path:e.path}))}let a=await new A(w({conversationUrl:t,sessionApiKey:n})).gitChanges(r);if(!Array.isArray(a))throw Error(`Invalid response from runtime - runtime may be unavailable`);return a.map(e=>({status:N(String(e.status)),path:e.path}))}static async getGitChangeDiff(e,t,n,r){let i=C().backend;if(i.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,he(r));let n=await E({backend:i,method:`GET`,path:`/api/v1/app-conversations/${e}/git/diff?${t.toString()}`});return{modified:n?.modified??``,original:n?.original??``,...n?.diff?{diff:n.diff}:{}}}let a=await new A(w({conversationUrl:t,sessionApiKey:n})).gitDiff(r);return{modified:a.modified??``,original:a.original??``,...a.diff?{diff:a.diff}:{}}}};function V(e,t){let n=t?.trim();if(n)return n;if(!e)return T;let r=e.split(`/`);return`${T}/${r[r.length-1]}`}var H=()=>{let{conversationId:e}=P(),{data:t}=F(),[n,r]=z.useState([]),a=z.useRef(null),o=L(),s=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),d=z.useMemo(()=>V(l,u),[l,u]),f=i({queryKey:[`file_changes`,e,s,c,d],queryFn:async()=>{if(!e)throw Error(`No conversation ID`);return ge.getGitChanges(e,s,c,d)},retry:!1,staleTime:1e3*60*5,gcTime:1e3*60*15,refetchOnMount:`always`,enabled:o&&!!e,meta:{disableToast:!0}});return z.useEffect(()=>{if(!f.isFetching&&f.isSuccess&&f.data){let e=f.data;if(e!==a.current)if(a.current=e,Array.isArray(e)){let t=new Set(e.map(e=>e.path)),i=new Set(n.map(e=>e.path)),a=e.filter(e=>!i.has(e.path)),o=n.filter(e=>t.has(e.path));r([...a,...o])}else r([e])}},[f.isFetching,f.isSuccess,f.data]),{data:n,isLoading:f.isLoading,isFetching:f.isFetching,isSuccess:f.isSuccess,isError:f.isError,error:f.error,refetch:f.refetch}},U=2e3,_e=[`.git`,`node_modules`,`.venv`,`venv`,`__pycache__`,`dist`,`build`,`.next`,`.cache`,`.pytest_cache`,`.mypy_cache`,`.turbo`,`.parcel-cache`,`target`];function ve(){return`find . \\( ${_e.map(e=>`-name '${e}' -prune`).join(` -o `)} \\) -o -type f -print 2>/dev/null | sort | head -n ${U}`}function ye(e){return e.startsWith(`./`)?e.slice(2):e}function be(e){let{data:t}=F(),n=L(),r=t?.id,a=t?.conversation_url,o=t?.session_api_key,s=t?.workspace?.working_dir?.trim(),c=i({queryKey:[`workspace-files`,r,a,o,s],queryFn:async()=>{let e=await me.executeCommand(a,o,ve(),s,30);if(e.exit_code!==0)throw Error(e.stderr?.trim()||`Failed to list workspace files`);let t=e.stdout.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(ye);return Array.from(new Set(t)).slice(0,U)},enabled:e&&n&&!!r&&!!s,retry:!1,staleTime:1e3*30,gcTime:1e3*60*5,meta:{disableToast:!0}});return{data:c.data,isLoading:c.isLoading}}function xe(e){let t=H(),n=(0,z.useMemo)(()=>{if(!e)return;let n=t.data.filter(e=>e.status!==`D`).map(e=>e.path);return Array.from(new Set(n)).slice(0,U)},[e,t.data]);return{data:e?n:void 0,isLoading:e?t.isLoading:!1}}function Se(){let{backend:e}=l(),t=e.kind===`cloud`,n=be(!t),r=xe(t);return t?r:n}function Ce(){let{data:e}=F(),t=L(),n=e?.id,r=e?.conversation_url,a=e?.session_api_key,o=C().backend.kind===`local`,s=i({queryKey:[`workspace-session`,n,r,a],queryFn:async()=>({baseUrl:await new A(w({conversationUrl:r,sessionApiKey:a})).startWorkspaceSession(n)}),enabled:t&&!!n&&o,staleTime:1/0,gcTime:1/0,retry:!1});return{data:s.data??null,isLoading:s.isLoading,isError:s.isError,error:s.error??null}}function we(e,t){let n=(t??``).replace(/^\/+/,``);return n?`${e}${n.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`:e}var W=D(e=>({count:0,bump:()=>e(e=>({count:e.count+1}))}));function G(e,t){return e===null?null:`${e}${e.includes(`?`)?`&`:`?`}v=${t}`}var Te=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`svg`,`avif`]),Ee=new Set([`pdf`]);function K(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function De(e){switch(K(e)){case`html`:case`htm`:return`text/html`;case`css`:return`text/css`;case`js`:case`mjs`:case`cjs`:return`text/javascript`;case`json`:return`application/json`;case`md`:case`markdown`:return`text/markdown`;case`svg`:return`image/svg+xml`;case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`gif`:return`image/gif`;case`webp`:return`image/webp`;case`bmp`:return`image/bmp`;case`ico`:return`image/x-icon`;case`avif`:return`image/avif`;case`pdf`:return`application/pdf`;default:return`text/plain`}}function Oe(e){let t=K(e);return Te.has(t)?`image`:Ee.has(t)?`pdf`:`text`}function q(e){let t=new Uint8Array(e,0,Math.min(e.byteLength,8e3));for(let e=0;e<t.length;e+=1)if(t[e]===0)return!0;return!1}function J(e){let t=new Uint8Array(e),n=32768,r=``;for(let e=0;e<t.length;e+=n)r+=String.fromCharCode.apply(null,t.subarray(e,e+n));return btoa(r)}function Y(e){let{data:t}=F(),n=L(),{data:r}=Ce(),a=W(e=>e.count),o=t?.id,s=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),d=r?.baseUrl,f=C().backend.kind===`cloud`,p=V(l,u),m=p.startsWith(`/`)?p:`/${p}`,h=e?`${m}/${e}`:null;return i({queryKey:[`workspace-file-content`,o,s,c,f?`cloud`:d,e,h,a],queryFn:async()=>{if(!e)throw Error(`No path`);let t=Oe(e),n=De(e);if(f){let r=await j(o,h);if(t===`text`){let t=new TextEncoder().encode(r);return q(t.buffer)?{path:e,kind:`binary`,text:null,staticUrl:`data:application/octet-stream;base64,${J(t.buffer)}`,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:r,staticUrl:`data:${n};charset=utf-8;base64,${J(t.buffer)}`,mimeType:n}}return{path:e,kind:t,text:null,staticUrl:`data:${n};base64,${J(new TextEncoder().encode(r).buffer)}`,mimeType:n}}if(!d)throw Error(`No workspace session`);let r=we(d,e);if(t!==`text`)return{path:e,kind:t,text:null,staticUrl:r,mimeType:n};let i=await fetch(r,{credentials:`include`});if(!i.ok)throw Error(`Failed to read ${e}: ${i.status}`);let a=await i.arrayBuffer();return q(a)?{path:e,kind:`binary`,text:null,staticUrl:r,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:new TextDecoder(`utf-8`,{fatal:!1}).decode(a),staticUrl:r,mimeType:n}},enabled:n&&!!o&&!!e&&(f||!!d),retry:!1,staleTime:1e3*5,gcTime:1e3*60,meta:{disableToast:!0}})}function ke(){let{data:e,isLoading:t}=F(),n=e?.id?M(e.id):null;return{hasAttachedSource:!!e?.selected_repository||!!n?.selected_workspace,isLoading:t}}function Ae(e){let{data:t}=F(),n=L(),{backend:r}=l(),a=r.kind===`local`,o=t?.id,s=t?.conversation_url,c=t?.session_api_key,u=t?.workspace?.working_dir?.trim(),d=(e?.enabled??!0)&&a&&n&&!!o&&!!u,f=i({queryKey:[`has-git-commits`,o,s,c,u],queryFn:async()=>(await me.executeCommand(s,c,`git rev-parse --verify HEAD`,u,10)).exit_code===0,enabled:d,retry:!1,staleTime:6e4,gcTime:5*6e4,meta:{disableToast:!0}});return{hasCommits:f.data??null,isLoading:f.isLoading}}var je=new Set([`FileEditorObservation`,`StrReplaceEditorObservation`,`PlanningFileEditorObservation`]),Me=new Set([`view`]),Ne=new Set([`ExecuteBashObservation`,`TerminalObservation`]);function Pe(e){let t=e.observation;return!(!t||typeof t.kind!=`string`||!je.has(t.kind)||t.command&&Me.has(t.command))}function Fe(e){let t=e.observation;return!!t&&typeof t.kind==`string`&&Ne.has(t.kind)}function Ie(){let e=r(),t=ae(e=>e.events),n=W(e=>e.bump),i=(0,z.useRef)(new Set),a=(0,z.useRef)(new WeakSet);(0,z.useEffect)(()=>{let r=!1,o=!1;for(let e of t){let t=`id`in e?e.id:void 0;(t===void 0?a.current.has(e):i.current.has(t))||(t===void 0?a.current.add(e):i.current.add(t),Pe(e)?r=!0:Fe(e)&&(o=!0))}!r&&!o||(e.invalidateQueries({queryKey:[`file_changes`]}),e.invalidateQueries({queryKey:[`file_diff`]}),r&&(e.invalidateQueries({queryKey:[`workspace-files`]}),e.invalidateQueries({queryKey:[`workspace-file-content`]}),n()))},[t,e,n])}var Le=[`index.html`,`index.htm`,`readme.md`,`readme`,`main.html`,`app.html`,`index.js`,`index.ts`,`index.tsx`,`index.jsx`,`main.py`,`app.py`,`main.go`,`main.rs`,`main.java`,`main.c`,`main.cpp`,`package.json`,`pyproject.toml`,`cargo.toml`,`go.mod`,`pom.xml`,`dockerfile`,`makefile`],Re=[`license`,`license.md`,`license.txt`,`changelog.md`,`agents.md`,`tsconfig.json`,`.env.sample`,`.env.example`];function ze(e){let t=e.lastIndexOf(`/`);return(t===-1?e:e.slice(t+1)).toLowerCase()}function X(e){return e.split(`/`).filter(Boolean).length-1}function Be(e){let t=ze(e),n=Le.indexOf(t);if(n!==-1)return n;let r=Re.indexOf(t);return r===-1?1e4:1e3+r}function Ve(e){return[...e].sort((e,t)=>{let n=X(e)-X(t);if(n!==0)return n;let r=Be(e)-Be(t);return r===0?e.localeCompare(t):r})}function He({paths:e,selectedPath:t,onSelectFile:n,isTreeVisible:r,onToggleTree:i}){let{t:s}=a(`openhands`),c=(0,z.useMemo)(()=>Ve(e),[e]);return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-[var(--oh-border)] px-2 py-1.5 min-h-[34px]`,"data-testid":`file-quick-row`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:i,"data-testid":`file-quick-row-tree-toggle`,"aria-pressed":r,"aria-label":s(r?o.FILES$HIDE_FILE_TREE:o.FILES$SHOW_FILE_TREE),title:s(r?o.FILES$HIDE_FILE_TREE:o.FILES$SHOW_FILE_TREE),className:b(`shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-md cursor-pointer`,`text-[var(--oh-text-tertiary)] hover:bg-tertiary`,r&&`bg-[var(--oh-surface-raised)]`),children:(0,B.jsx)(p,{className:`w-3 h-3`,"aria-hidden":!0,strokeWidth:2})}),c.length>0&&(0,B.jsx)(`div`,{className:`flex flex-nowrap items-center gap-1.5 overflow-hidden flex-1 min-w-0`,children:c.map(e=>{let r=t===e;return(0,B.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:e,"data-testid":`file-quick-row-item-${e}`,className:b(`inline-flex items-center px-2 py-0.5 text-xs whitespace-nowrap rounded-md cursor-pointer`,r?`bg-[var(--oh-interactive-hover)] text-white`:`bg-[var(--oh-surface-raised)] text-[var(--oh-text-tertiary)] hover:bg-tertiary`),children:e},e)})})]})}function Ue(e){e.children.sort((e,t)=>e.isDirectory===t.isDirectory?e.name.localeCompare(t.name):e.isDirectory?-1:1);for(let t of e.children)t.isDirectory&&Ue(t)}function We(e,t,n,r,i){let a=t.get(e);a||(a=new Map,t.set(e,a));let o=a.get(n);if(o)return!i&&!o.isDirectory&&(o.isDirectory=!0),o;let s={name:n,path:r,isDirectory:!i,children:[]};return e.children.push(s),a.set(n,s),s}function Ge(e){let t={name:``,path:``,isDirectory:!0,children:[]},n=new Map;for(let r of e){let e=r.split(`/`).filter(Boolean);if(e.length>0){let r=t,i=``;for(let t=0;t<e.length;t+=1){let a=e[t];i=i?`${i}/${a}`:a;let o=t===e.length-1;r=We(r,n,a,i,o)}}}return Ue(t),t}function Ke({node:e,depth:t,selectedPath:n,onSelectFile:r}){let[i,a]=(0,z.useState)(!1),o=8+t*12;if(e.isDirectory)return(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-expanded":i,"data-testid":`file-tree-dir-${e.path}`,className:b(`flex w-full items-center gap-1.5 py-1 pr-2 text-left text-sm text-white`,`hover:bg-tertiary cursor-pointer`),style:{paddingLeft:`${o}px`},children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:b(`inline-block w-3 text-[10px] text-[var(--oh-muted)] transition-transform`,i?`rotate-90`:`rotate-0`),children:`▶`}),(0,B.jsx)(ee,{className:`w-3.5 h-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]}),i&&e.children.length>0&&(0,B.jsx)(`ul`,{children:e.children.map(e=>(0,B.jsx)(Ke,{node:e,depth:t+1,selectedPath:n,onSelectFile:r},e.path))})]});let s=n===e.path;return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(e.path),"data-testid":`file-tree-file-${e.path}`,className:b(`flex w-full items-center gap-1.5 py-1 pr-2 text-left text-sm`,`hover:bg-tertiary cursor-pointer`,s?`bg-[var(--oh-interactive-hover)] text-white`:`text-[var(--oh-text-tertiary)]`),style:{paddingLeft:`${o+16}px`},children:[(0,B.jsx)(re,{className:`w-3.5 h-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]})})}function qe({paths:e,selectedPath:t,onSelectFile:n}){let{t:r}=a(`openhands`),i=(0,z.useMemo)(()=>Ge(e),[e]);return i.children.length===0?(0,B.jsx)(`div`,{className:`px-3 py-4 text-sm text-[var(--oh-muted)]`,children:r(o.FILES$NO_FILES)}):(0,B.jsx)(`ul`,{className:`py-1 custom-scrollbar-always`,"data-testid":`file-tree-view`,children:i.children.map(e=>(0,B.jsx)(Ke,{node:e,depth:0,selectedPath:t,onSelectFile:n},e.path))})}var Je={js:`javascript`,jsx:`jsx`,mjs:`javascript`,cjs:`javascript`,ts:`typescript`,tsx:`tsx`,py:`python`,pyi:`python`,pyw:`python`,html:`markup`,htm:`markup`,svg:`markup`,xml:`markup`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,json:`json`,json5:`json5`,yaml:`yaml`,yml:`yaml`,toml:`toml`,ini:`ini`,cfg:`ini`,properties:`properties`,conf:`ini`,env:`bash`,md:`markdown`,markdown:`markdown`,mdx:`markdown`,sh:`bash`,bash:`bash`,zsh:`bash`,fish:`bash`,bat:`batch`,cmd:`batch`,ps1:`powershell`,ps:`powershell`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,cs:`csharp`,java:`java`,kt:`kotlin`,kts:`kotlin`,scala:`scala`,rs:`rust`,go:`go`,rb:`ruby`,php:`php`,swift:`swift`,m:`objectivec`,mm:`objectivec`,hs:`haskell`,ex:`elixir`,exs:`elixir`,erl:`erlang`,fs:`fsharp`,fsx:`fsharp`,ml:`ocaml`,mli:`ocaml`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,lua:`lua`,pl:`perl`,pm:`perl`,r:`r`,jl:`julia`,dart:`dart`,groovy:`groovy`,gradle:`groovy`,tf:`hcl`,hcl:`hcl`,dockerfile:`docker`,sql:`sql`,graphql:`graphql`,gql:`graphql`,proto:`protobuf`,diff:`diff`,patch:`diff`,nix:`nix`,sol:`solidity`},Ye={dockerfile:`docker`,makefile:`makefile`,gnumakefile:`makefile`,".bashrc":`bash`,".zshrc":`bash`,".profile":`bash`,".env":`bash`,".gitignore":`bash`,".dockerignore":`bash`};function Xe(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)),n=e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r+1).toLowerCase()}function Ze(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return e.slice(t+1).toLowerCase()}function Qe(e,t){let n=Ye[Ze(e)];if(n)return n;let r=Xe(e);if(r&&Je[r])return Je[r];if(t){if(t===`text/html`)return`markup`;if(t===`text/css`)return`css`;if(t===`application/json`)return`json`;if(t===`text/markdown`)return`markdown`;if(t===`application/javascript`||t===`text/javascript`)return`javascript`;if(t===`application/x-yaml`||t===`text/yaml`)return`yaml`}return null}function $e({path:e,text:t,mimeType:n}){let r=Qe(e,n);return r?(0,B.jsx)(`div`,{"data-testid":`file-content-viewer-highlighted`,"data-language":r,className:`h-full w-full overflow-auto bg-[var(--oh-surface)] custom-scrollbar-always`,children:(0,B.jsx)(oe,{language:r,style:se,showLineNumbers:!0,wrapLongLines:!1,customStyle:{margin:0,padding:`1rem`,background:`transparent`,fontSize:`0.75rem`,lineHeight:`1.25rem`,minHeight:`100%`},codeTagProps:{style:{background:`transparent`,fontFamily:`inherit`}},lineNumberStyle:{color:`var(--oh-border)`,minWidth:`2.5em`,paddingRight:`1em`,userSelect:`none`},children:t})}):(0,B.jsx)(`pre`,{"data-testid":`file-content-viewer-plain`,className:`h-full w-full overflow-auto whitespace-pre-wrap break-words bg-[var(--oh-surface)] p-4 text-xs leading-5 text-white custom-scrollbar-always`,children:t})}var et=new Set([`html`,`htm`,`svg`]),tt=new Set([`md`,`markdown`,`mdx`]),nt={pptx:`PowerPoint`,ppt:`PowerPoint`,docx:`Word`,doc:`Word`,xlsx:`Excel`,xls:`Excel`};function Z(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function Q({path:e}){let{t}=a(`openhands`),n=nt[Z(e)];return(0,B.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,"data-testid":n?`file-content-viewer-unsupported-document`:`file-content-viewer-binary-fallback`,children:n?t(o.FILES$UNSUPPORTED_DOCUMENT,{type:n}):t(o.FILES$BINARY_FALLBACK)})}function rt({path:e,viewMode:t}){let{t:n}=a(`openhands`),r=Y(e),i=W(e=>e.count);if(r.isLoading)return(0,B.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,children:n(o.FILES$LOADING_FILES)});if(r.isError||!r.data)return(0,B.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,"data-testid":`file-content-viewer-error`,children:r.error?.message??n(o.FILES$LOAD_ERROR)});let{kind:s,text:c,staticUrl:l,mimeType:u}=r.data,d=G(l,i);return t===`plain`?s===`text`&&c!==null?(0,B.jsx)($e,{path:e,text:c,mimeType:u??void 0}):(0,B.jsx)(Q,{path:e}):s===`image`?(0,B.jsx)(`div`,{className:`flex h-full w-full items-center justify-center bg-[var(--oh-surface)] p-4`,"data-testid":`file-content-viewer-image`,children:(0,B.jsx)(`img`,{src:d,alt:e,className:`max-h-full max-w-full object-contain`})}):s===`pdf`?(0,B.jsx)(`iframe`,{title:e,src:d,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):s===`binary`?(0,B.jsx)(Q,{path:e}):u===`text/html`||et.has(Z(e))?(0,B.jsx)(`iframe`,{title:e,src:d,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):s===`text`&&tt.has(Z(e))?(0,B.jsx)(`div`,{"data-testid":`file-content-viewer-markdown`,className:`h-full w-full overflow-auto bg-[var(--oh-surface)] text-white custom-scrollbar-always`,children:(0,B.jsx)(`div`,{className:`prose prose-sm prose-invert max-w-none p-6 [--tw-prose-body:#fff] [--tw-prose-bold:#fff] [--tw-prose-headings:#fff] [--tw-prose-lead:#fff] [--tw-prose-counters:#fff] [--tw-prose-quotes:#fff] [--tw-prose-quote-borders:var(--oh-border-subtle)] [--tw-prose-bullets:var(--oh-muted)] [--tw-prose-hr:var(--oh-border-subtle)] [--tw-prose-captions:var(--oh-muted)] [--tw-prose-kbd:#fff]`,children:(0,B.jsx)(ce,{content:c??``,includeStandard:!0,includeHeadings:!0})})}):s===`text`&&c!==null?(0,B.jsx)($e,{path:e,text:c,mimeType:u??void 0}):(0,B.jsx)(Q,{path:e})}var it=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 13 15`,fill:`none`,...e,children:(0,B.jsx)(`path`,{d:`M6.59467 0.21967C6.88756 -0.0732233 7.36244 -0.0732233 7.65533 0.21967L9.90533 2.46967C10.1982 2.76256 10.1982 3.23744 9.90533 3.53033L7.65533 5.78033C7.36244 6.07322 6.88756 6.07322 6.59467 5.78033C6.30178 5.48744 6.30178 5.01256 6.59467 4.71967L7.56434 3.75H6.375C3.71421 3.75 1.5 5.96421 1.5 8.625C1.5 11.2858 3.71421 13.5 6.375 13.5C9.03579 13.5 11.25 11.2858 11.25 8.625C11.25 8.21079 11.5858 7.875 12 7.875C12.4142 7.875 12.75 8.21079 12.75 8.625C12.75 12.1142 9.86421 15 6.375 15C2.88579 15 0 12.1142 0 8.625C0 5.13579 2.88579 2.25 6.375 2.25H7.56434L6.59467 1.28033C6.30178 0.987437 6.30178 0.512563 6.59467 0.21967Z`,fill:`currentColor`})}),at=e=>(0,B.jsx)(`svg`,{width:13,height:8,viewBox:`0 0 13 8`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,B.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M0.259766 6.17427L6.26425 0.715628L12.2688 6.17427L11.2597 7.28418L6.26425 2.74282L1.26878 7.28418L0.259766 6.17427Z`,fill:`currentColor`})}),ot=e=>{let{conversationId:t}=P(),{data:n}=F(),r=n?.conversation_url,a=n?.session_api_key,o=n?.selected_repository,s=n?.workspace?.working_dir?.trim(),c=z.useMemo(()=>`${V(o,s)}/${e.filePath}`,[o,e.filePath,s]),l=e.type===`D`;return i({queryKey:[`file_diff`,t,r,a,c],queryFn:async()=>{if(!t)throw Error(`No conversation ID`);return ge.getGitChangeDiff(t,r,a,c)},enabled:e.enabled&&!l,staleTime:1e3*60*5,gcTime:1e3*60*15})};function st({className:e}){let{t}=a(`openhands`);return(0,B.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,B.jsx)(`div`,{className:b(`animate-spin rounded-full border-4 border-transparent border-t-white`,e),role:`status`,"aria-label":t(o.HOME$LOADING)})})}function ct({height:e,children:t}){return(0,B.jsx)(`div`,{"data-testid":`editor-container`,className:`w-full border-b border-[var(--oh-border)] overflow-hidden h-[var(--editor-height)]`,style:{"--editor-height":`${e}px`},children:t})}var lt=[{mode:`old`,icon:h},{mode:`diff`,icon:u},{mode:`new`,icon:v}],$={renderValidationDecorations:`off`,readOnly:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},automaticLayout:!0,scrollbar:{alwaysConsumeMouseWheel:!1}},ut={A:f,D:g,M:m,R:`Renamed`,U:`Untracked`},dt=e=>{e.editor.defineTheme(`custom-diff-theme`,{base:`vs-dark`,inherit:!0,rules:[{token:`comment`,foreground:`6a9955`},{token:`keyword`,foreground:`569cd6`},{token:`string`,foreground:`ce9178`},{token:`number`,foreground:`b5cea8`}],colors:{"diffEditor.insertedTextBackground":`#014b01AA`,"diffEditor.removedTextBackground":`#750000AA`,"diffEditor.insertedLineBackground":`#003f00AA`,"diffEditor.removedLineBackground":`#5a0000AA`,"diffEditor.border":`var(--oh-border-subtle)`,"editorUnnecessaryCode.border":`#00000000`,"editorUnnecessaryCode.opacity":`rgba(0, 0, 0, 0.467)`}})};function ft({path:e,type:t}){let{t:n}=a(`openhands`),[r,i]=z.useState(!0),[s,c]=z.useState(400),[l,u]=z.useState(`diff`),f=z.useRef(null),p=z.useRef(null),m=t===`A`||t===`U`,h=t===`D`,g=z.useMemo(()=>{if(t===`R`){let t=e.split(/\s+/).slice(1);return t[t.length-1]}return e},[e,t]),{data:v,isLoading:y,isSuccess:x,isRefetching:S}=ot({filePath:g,type:t,enabled:!r}),C=z.useCallback(()=>{if(!f.current)return;let e=f.current.getOriginalEditor(),t=f.current.getModifiedEditor();e&&t&&c(Math.max(e.getContentHeight(),t.getContentHeight())+20)},[]),w=z.useCallback(()=>{p.current&&c(p.current.getContentHeight()+20)},[]),T=e=>{f.current=e,C(),e.getOriginalEditor().onDidContentSizeChange(C),e.getModifiedEditor().onDidContentSizeChange(C)},E=e=>{p.current=e,w(),e.onDidContentSizeChange(w)},D=(t===`U`?ut.A:ut[t])||`?`,O=typeof D==`string`?(0,B.jsx)(te.Text,{children:D}):z.createElement(D,{className:`w-5 h-5`}),k=y||S,A=fe(g),j=A===`markdown`,M=l===`old`?v?.original??``:v?.modified??``;return(0,B.jsxs)(`div`,{"data-testid":`file-diff-viewer-outer`,className:`w-full flex flex-col`,children:[(0,B.jsx)(`div`,{className:`flex justify-between items-center px-3 py-2.5 border-b border-[var(--oh-border)] hover:cursor-pointer`,onClick:()=>i(e=>!e),children:(0,B.jsxs)(`span`,{className:`text-sm w-full text-content flex items-center gap-2`,children:[k?(0,B.jsx)(st,{className:`w-4 h-4`}):O,(0,B.jsx)(`strong`,{className:`w-full truncate font-medium`,children:g}),!r&&!h&&(0,B.jsx)(`span`,{className:`flex items-center gap-0.5 shrink-0`,onClick:e=>e.stopPropagation(),children:lt.map(({mode:e,icon:t})=>(0,B.jsx)(`button`,{"data-testid":`view-mode-${e}`,type:`button`,"aria-pressed":l===e,onClick:()=>u(e),className:b(`p-1 rounded transition-colors cursor-pointer`,l===e?`bg-[var(--oh-interactive-hover)] text-white`:`text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-white`),children:(0,B.jsx)(t,{className:`w-4 h-4`})},e))}),(0,B.jsx)(`button`,{"data-testid":`collapse`,type:`button`,children:(0,B.jsx)(at,{className:b(`w-4 h-4 transition-transform`,r&&`transform rotate-180`)})})]})}),!r&&h&&(0,B.jsx)(`div`,{"data-testid":`file-deleted-message`,className:`w-full border-b border-[var(--oh-border)] p-4 bg-base text-[var(--oh-text-dim)] text-sm`,children:n(o.DIFF_VIEWER$FILE_DELETED)}),!r&&!h&&x&&(l===`diff`?(0,B.jsx)(ct,{height:s,children:(0,B.jsx)(d,{"data-testid":`file-diff-viewer`,className:`w-full h-full`,language:A,original:m?``:v?.original??``,modified:h?``:v?.modified??``,theme:`custom-diff-theme`,onMount:T,beforeMount:dt,options:{...$,renderSideBySide:!m&&!h,hideUnchangedRegions:{enabled:!0}}})}):j?(0,B.jsx)(`div`,{className:`w-full border-b border-[var(--oh-border)] overflow-auto p-4 bg-base prose prose-invert max-w-none`,"data-testid":`markdown-preview`,children:(0,B.jsx)(ce,{content:M,includeStandard:!0,includeHeadings:!0})}):(0,B.jsx)(ct,{height:s,children:(0,B.jsx)(_,{"data-testid":`file-single-viewer`,className:`w-full h-full`,language:A,value:M,theme:`custom-diff-theme`,beforeMount:dt,onMount:E,options:$})}))]})}function pt(){return(0,B.jsx)(m,{"aria-hidden":!0,className:`size-full`})}function mt(){let{t:e}=a(`openhands`);return(0,B.jsx)(R,{icon:(0,B.jsx)(pt,{}),children:e(o.DIFF_VIEWER$NO_CHANGES)})}var ht=[{key:o.TIPS$CUSTOMIZE_MICROAGENT,link:`https://docs.all-hands.dev/usage/prompting/microagents-repo`},{key:o.TIPS$SETUP_SCRIPT,link:`https://docs.all-hands.dev/usage/prompting/repository#setup-script`},{key:o.TIPS$VSCODE_INSTANCE},{key:o.TIPS$SAVE_WORK},{key:o.TIPS$SPECIFY_FILES,link:`https://docs.all-hands.dev/usage/prompting/prompting-best-practices`},{key:o.TIPS$HEADLESS_MODE,link:`https://docs.all-hands.dev/usage/how-to/headless-mode`},{key:o.TIPS$CLI_MODE,link:`https://docs.all-hands.dev/usage/how-to/cli-mode`},{key:o.TIPS$GITHUB_HOOK,link:`https://docs.all-hands.dev/usage/cloud/github-installation#working-on-github-issues-and-pull-requests-using-openhands`},{key:o.TIPS$BLOG_SIGNUP,link:`https://www.all-hands.dev/blog`},{key:o.TIPS$API_USAGE,link:`https://docs.all-hands.dev/api-reference/health-check`}];function gt(){return ht[Math.floor(Math.random()*ht.length)]}function _t(){let{t:e}=a(`openhands`),[t,n]=z.useState(gt());return z.useEffect(()=>{n(gt())},[]),(0,B.jsx)(`div`,{className:`w-full bg-tertiary p-4 text-left`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(de,{className:`mt-0.5 h-4 w-4 shrink-0 fill-[var(--oh-muted)]`,"aria-hidden":!0}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h4`,{className:`text-sm font-semibold text-[var(--oh-text-tertiary)]`,children:e(o.TIPS$PROTIP)}),(0,B.jsxs)(`p`,{className:`text-sm font-normal leading-5 text-[var(--oh-muted)]`,children:[e(t.key),t.link?(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsx)(`a`,{href:t.link,target:`_blank`,rel:`noopener noreferrer`,className:`underline transition-colors hover:text-white`,children:e(o.TIPS$LEARN_MORE)})]}):null]})]})]})})}var vt=/not a git repository/i,yt=new Set([o.DIFF_VIEWER$WAITING_FOR_RUNTIME,o.DIFF_VIEWER$LOADING]);function bt({messages:e}){let{t}=a(`openhands`);return e.length===1&&yt.has(e[0])?(0,B.jsx)(le,{testId:`changes-tab-status`,messageKey:e[0]}):(0,B.jsx)(R,{icon:(0,B.jsx)(pt,{}),children:e.map(e=>(0,B.jsx)(`span`,{className:`block`,children:t(e)},e))})}function xt(){let{data:e,isSuccess:t,isError:n,error:r,isLoading:i}=H(),[a,s]=z.useState(null),{curAgentState:l}=ie(),u=!x.includes(l),d=r&&vt.test(c(r));return z.useEffect(()=>{if(!u)s([o.DIFF_VIEWER$WAITING_FOR_RUNTIME]);else if(r){let e=c(r);vt.test(e)?s([o.DIFF_VIEWER$NOT_A_GIT_REPO,o.DIFF_VIEWER$ASK_OH]):s([e])}else s(i?[o.DIFF_VIEWER$LOADING]:null)},[u,d,i,r,s]),(0,B.jsx)(`main`,{className:`h-full w-full flex flex-col items-stretch`,children:!t||!e.length?(0,B.jsxs)(`div`,{className:`flex flex-col h-full w-full`,children:[(0,B.jsxs)(`div`,{className:`flex-1 flex items-center justify-center`,children:[a&&(0,B.jsx)(bt,{messages:a}),!a&&t&&e.length===0&&(0,B.jsx)(mt,{})]}),!n&&t&&e.length===0&&(0,B.jsx)(_t,{})]}):(0,B.jsx)(`div`,{className:`h-full overflow-y-auto flex flex-col items-stretch custom-scrollbar-always`,children:e.slice(0,100).map(e=>(0,B.jsx)(ft,{path:e.path,type:e.status},e.path))})})}function St(){let{t:e}=a(`openhands`);Ie();let{hasAttachedSource:t,isLoading:n}=ke(),{hasCommits:i}=Ae({enabled:t}),{conversationId:s}=ne(),{state:c,setFilesTabDiffView:l,setFilesTabContentViewMode:u}=O(s??``),d=(t||n)&&i!==!1,f=c.filesTabDiffView??d,p=c.filesTabContentViewMode,[m,h]=(0,z.useState)(!1),g=Se(),_=(0,z.useMemo)(()=>g.data??[],[g.data]),v=I(e=>e.selectedPath),y=I(e=>e.selectedConversationId),b=I(e=>e.setSelectedPath),x=y===s?v:null,S=(0,z.useCallback)(e=>b(e,s),[s,b]),C=Y(x),w=W(e=>e.count),T=G(C.data?.staticUrl??null,w);(0,z.useEffect)(()=>{y!==s&&b(null,s)},[y,s,b]),(0,z.useEffect)(()=>{if(x||_.length===0)return;let[e]=Ve(_);e&&b(e,s)},[_,x,s,b]);let E=r(),{refetch:D,isFetching:A}=H();return(0,B.jsxs)(`main`,{className:`h-full w-full flex flex-col items-stretch`,"data-testid":`files-tab`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 border-b border-[var(--oh-border)]`,children:[(0,B.jsx)(k,{ariaLabel:e(o.FILES$DIFF_VIEW),testId:`files-tab-diff-toggle`,value:f?`on`:`off`,options:[{value:`on`,label:e(o.FILES$DIFF_VIEW)},{value:`off`,label:e(o.COMMON$FILES)}],onChange:e=>l(e===`on`)}),!f&&(0,B.jsx)(k,{ariaLabel:e(o.FILES$RICH),testId:`files-tab-content-mode-toggle`,value:p,options:[{value:`rich`,label:e(o.FILES$RICH)},{value:`plain`,label:e(o.FILES$PLAIN)}],onChange:u}),(0,B.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[!f&&T&&(0,B.jsx)(`a`,{href:T,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e(o.FILES$OPEN_IN_NEW_WINDOW),title:e(o.FILES$OPEN_IN_NEW_WINDOW),"data-testid":`files-tab-open-in-new-window`,className:`flex items-center justify-center w-[26px] py-1 rounded-[7px] hover:bg-[var(--oh-interactive-hover)] cursor-pointer text-white`,children:(0,B.jsx)(ue,{width:14,height:14})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{D(),E.invalidateQueries({queryKey:[`workspace-files`]}),E.invalidateQueries({queryKey:[`workspace-file-content`]})},disabled:A,"aria-label":e(o.FILES$REFRESH),title:e(o.FILES$REFRESH),"data-testid":`files-tab-refresh`,className:`flex items-center justify-center w-[26px] py-1 rounded-[7px] hover:enabled:bg-[var(--oh-interactive-hover)] cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,children:(0,B.jsx)(it,{width:12.75,height:15,color:`#ffffff`,className:A?`animate-spin`:``})})]})]}),f?(0,B.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,B.jsx)(xt,{})}):(0,B.jsx)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:g.isLoading?(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-[var(--oh-muted)]`,children:e(o.FILES$LOADING_FILES)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(He,{paths:_,selectedPath:x,onSelectFile:S,isTreeVisible:m,onToggleTree:()=>h(e=>!e)}),(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1`,children:[m&&(0,B.jsx)(`aside`,{className:`w-56 shrink-0 border-r border-[var(--oh-border)] overflow-y-auto custom-scrollbar-always`,"data-testid":`files-tab-tree`,children:(0,B.jsx)(qe,{paths:_,selectedPath:x,onSelectFile:S})}),(0,B.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,"data-testid":`files-tab-content`,children:x?(0,B.jsx)(rt,{path:x,viewMode:p}):(0,B.jsx)(pe,{})})]})]})})]})}export{St as default};
|