@openhands/agent-canvas 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.windows.md +2 -2
- package/build/assets/{active-backend-context-B9942JGX.js → active-backend-context-BlZPzZNU.js} +1 -1
- package/build/assets/{agent-context-settings-BwAakl29.js → agent-context-settings-CTaN-Iw9.js} +1 -1
- package/build/assets/{agent-profiles-settings-BYU6aWus.js → agent-profiles-settings-CR4VTqv_.js} +1 -1
- package/build/assets/{agent-server-conversation-service.api-D7qh9amG.js → agent-server-conversation-service.api-Btmi4q6d.js} +3 -3
- package/build/assets/{agent-settings-DEPFl5hR.js → agent-settings-BIOsUglV.js} +1 -1
- package/build/assets/agent-settings-KQs-occT.js +1 -0
- package/build/assets/{api-key-entry-screen-B2kVLRDQ.js → api-key-entry-screen-BhR24gkM.js} +1 -1
- package/build/assets/{app-settings-B92bjTei.js → app-settings-Bs4sY8WP.js} +1 -1
- package/build/assets/{automation-detail-DoVSHQLs.js → automation-detail-CwDnJbYR.js} +1 -1
- package/build/assets/{automation-export-Ca2ehC-k.js → automation-export-Bu-r-EzL.js} +1 -1
- package/build/assets/{automations-list-ZHQSW8qD.js → automations-list-CYw7_6FR.js} +1 -1
- package/build/assets/{backend-form-modal-C0CIsQvd.js → backend-form-modal-Ce-KRHOJ.js} +1 -1
- package/build/assets/{backend-synced-settings-badge-DdUfuSN8.js → backend-synced-settings-badge-BNpEylNP.js} +1 -1
- package/build/assets/{badge-B6q3sVom.js → badge-DwgrwohM.js} +1 -1
- package/build/assets/{browser-tab-Cir7KbAL.js → browser-tab-CEApjoEV.js} +1 -1
- package/build/assets/client-source-1v-kWLNU.js +1 -0
- package/build/assets/{cloud-funnel-analytics-CnCkPgQa.js → cloud-funnel-analytics-CasMM7EO.js} +1 -1
- package/build/assets/{condenser-settings-jNGOKFGz.js → condenser-settings-Czi8cKxV.js} +1 -1
- package/build/assets/conversation-C25pc2dT.js +1 -0
- package/build/assets/{conversation-DceG4LFS.js → conversation-CObLYSJd.js} +3 -3
- package/build/assets/conversation-panel-C25pc2dT.js +1 -0
- package/build/assets/{conversation-state-store-BORusMiV.js → conversation-state-store-DTq4hFoP.js} +1 -1
- package/build/assets/{entry.client-CCrlta8r.js → entry.client-DETaouwO.js} +1 -1
- package/build/assets/{extensions-hub-B2WudOET.js → extensions-hub-BKftOQ-X.js} +1 -1
- package/build/assets/{extensions-navigation-CYjIM65d.js → extensions-navigation-DF24q1H1.js} +1 -1
- package/build/assets/{files-tab-LSBijbEi.js → files-tab-SAiFCnS5.js} +1 -1
- package/build/assets/{git-provider-icon-DeQUgZVE.js → git-provider-icon-BREx-yUX.js} +1 -1
- package/build/assets/home-EPNFgzUh.js +1 -0
- package/build/assets/{home-BZclW6kd.js → home-sN90Xcxp.js} +1 -1
- package/build/assets/index-home-EPNFgzUh.js +1 -0
- package/build/assets/{install-server-modal-xCf76eim.js → install-server-modal-BI8yUfmr.js} +1 -1
- package/build/assets/{launch-Bik37u9Y.js → launch-Ccnhte5b.js} +1 -1
- package/build/assets/{llm-not-configured-banner-znJFsW_O.js → llm-not-configured-banner-DTWzISnk.js} +1 -1
- package/build/assets/llm-settings-BXk5_Pac.js +1 -0
- package/build/assets/{llm-settings-BYo9SN0I.js → llm-settings-C1vpgWam.js} +1 -1
- package/build/assets/{llm-subscription-service-_QUsVybQ.js → llm-subscription-service-W5BprsNA.js} +1 -1
- package/build/assets/{manage-backends-modal-n6PtHOER.js → manage-backends-modal-DhflyGTf.js} +1 -1
- package/build/assets/{manifest-e9bbad7b.js → manifest-8082e879.js} +1 -1
- package/build/assets/{markdown-renderer-Dkmjmx_d.js → markdown-renderer-CvOO0YIr.js} +1 -1
- package/build/assets/{mcp-BJUOnO6v.js → mcp-CxLPda-W.js} +1 -1
- package/build/assets/{messages-CYztjKLQ.js → messages-DINDkPNK.js} +1 -1
- package/build/assets/{onboarding-9pEMFGtN.js → onboarding-BegDrOKn.js} +1 -1
- package/build/assets/{onboarding-modal-dYsjXJwx.js → onboarding-modal-DdvE6rzw.js} +1 -1
- package/build/assets/{organization-service.api-HsxJhNCf.js → organization-service.api-CT2OQlLz.js} +1 -1
- package/build/assets/{planner-tab-Dr8B-ZBI.js → planner-tab-w6HT0N_A.js} +1 -1
- package/build/assets/{plugins-management-service-DEjBqDoT.js → plugins-management-service-DVkoM3eA.js} +1 -1
- package/build/assets/{profiles-service.api-BddMsEhq.js → profiles-service.api-CBafmAPO.js} +1 -1
- package/build/assets/{providers-BxJi3BMO.js → providers-9UzRB9mT.js} +1 -1
- package/build/assets/{proxy-CN3HaaOW.js → proxy-C79PCMjo.js} +1 -1
- package/build/assets/{recommended-automations-launcher-Dye8Li08.js → recommended-automations-launcher-BF2mtAKw.js} +1 -1
- package/build/assets/{root-D4hpCAq9.js → root-Sj7W28yE.js} +2 -2
- package/build/assets/{root-layout-a4-4sfbh.js → root-layout-DbhKVoc7.js} +3 -3
- package/build/assets/{schema-field-CZSs0hQP.js → schema-field-CV6bFnoL.js} +1 -1
- package/build/assets/{sdk-section-page-Di5mT86Y.js → sdk-section-page-BW-i45yr.js} +1 -1
- package/build/assets/{secrets-service-i4CCd-UN.js → secrets-service-BjK-bPN2.js} +1 -1
- package/build/assets/{secrets-settings-DPlA3moO.js → secrets-settings-D7U1ErCH.js} +1 -1
- package/build/assets/{settings-SHSt9Rq2.js → settings-Bj5Oo45A.js} +1 -1
- package/build/assets/{settings-index-D5dDKrDt.js → settings-index-COAdxm2Q.js} +1 -1
- package/build/assets/{settings-modal-DsJk2THd.js → settings-modal-CFnbQ8_4.js} +1 -1
- package/build/assets/{settings-service.api-i_HHIqJP.js → settings-service.api-DryhKdSr.js} +1 -1
- package/build/assets/{shared-conversation-DU1kwDTF.js → shared-conversation-CnMxy7p_.js} +1 -1
- package/build/assets/{sidebar-mobile-menu-toggle-BlmI8OrA.js → sidebar-mobile-menu-toggle-U78hQRJ1.js} +1 -1
- package/build/assets/{skills-plugins-YJSV6A0M.js → skills-plugins-BPhaNpfx.js} +1 -1
- package/build/assets/{skills-settings-BbREHv_-.js → skills-settings-CcwMtnnJ.js} +1 -1
- package/build/assets/{task-list-tab-Dzim5ftn.js → task-list-tab-BmaTwjaS.js} +1 -1
- package/build/assets/{telemetry-B-2fXtqV.js → telemetry-cmCL3o6Z.js} +1 -1
- package/build/assets/{terminal-CYFAMiXx.js → terminal-BRcoba5B.js} +1 -1
- package/build/assets/{use-acp-credential-form-CuBXKNvP.js → use-acp-credential-form-B0_pZ_uS.js} +1 -1
- package/build/assets/{use-activate-agent-profile-CXDcjVt8.js → use-activate-agent-profile-DH33MvVj.js} +1 -1
- package/build/assets/{use-agent-profiles-CliaHofi.js → use-agent-profiles-Dmd_4H8q.js} +1 -1
- package/build/assets/{use-can-manage-org-profiles-Uai-HHx2.js → use-can-manage-org-profiles-CrG1km7R.js} +1 -1
- package/build/assets/{use-cloud-current-user-id-BzamKpu-.js → use-cloud-current-user-id-B6DP3s47.js} +1 -1
- package/build/assets/{use-config-DPEYpfIj.js → use-config-Csy8EAP9.js} +1 -1
- package/build/assets/{use-create-conversation-DzcM79TE.js → use-create-conversation-Dsa4nzU9.js} +1 -1
- package/build/assets/{use-create-secret-2YLjoQw-.js → use-create-secret-BnxuAjDt.js} +1 -1
- package/build/assets/{use-llm-profiles-Ci3zAVzV.js → use-llm-profiles-BMQoc612.js} +1 -1
- package/build/assets/{use-onboarding-completion-STApsofr.js → use-onboarding-completion-B-2BTS-y.js} +1 -1
- package/build/assets/{use-plugins-marketplace-CzzdrUSK.js → use-plugins-marketplace-PBc_XNz_.js} +1 -1
- package/build/assets/{use-save-agent-profile-Q2M72WgR.js → use-save-agent-profile-2Mk9ZX37.js} +1 -1
- package/build/assets/{use-save-settings-BZK7zVsK.js → use-save-settings-BRh9p_fv.js} +1 -1
- package/build/assets/{use-settings-BKpkUS4y.js → use-settings-DBI44RnH.js} +1 -1
- package/build/assets/{use-settings-nav-items-BlXge_bf.js → use-settings-nav-items-Cva28C-c.js} +1 -1
- package/build/assets/{use-skills-BltA9XrV.js → use-skills-RQsCtdzN.js} +1 -1
- package/build/assets/{use-tracking-De7qByD4.js → use-tracking-CN1nIMnY.js} +1 -1
- package/build/assets/{use-user-conversation-43duhf7D.js → use-user-conversation-GnGhs_Ob.js} +1 -1
- package/build/assets/{verification-settings-B4DL3Tez.js → verification-settings-CaCzojbc.js} +1 -1
- package/build/index.html +4 -4
- package/config/defaults.json +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/package.cjs +1 -1
- package/dist/package.cjs.map +1 -1
- package/dist/package.js +6 -1
- package/dist/package.js.map +1 -1
- package/package.json +6 -1
- package/scripts/stryker-diff.mjs +137 -0
- package/build/assets/agent-settings-BbNLRtoh.js +0 -1
- package/build/assets/client-source-D8jWKBfE.js +0 -1
- package/build/assets/conversation-Do2Vg7uo.js +0 -1
- package/build/assets/conversation-panel-Do2Vg7uo.js +0 -1
- package/build/assets/home-C_R5pEbs.js +0 -1
- package/build/assets/index-home-C_R5pEbs.js +0 -1
- package/build/assets/llm-settings-BaM0zJg5.js +0 -1
|
@@ -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-Cyuzqnbw.js";import{$ as t,St as n,a as r,bt as i,gt as a,ht as o,m as s,xt as c,yt as l}from"./vendor-styling-Bcgpimp9.js";import{F as u,I as d,R as f,U as p}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{n as m}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js";import{t as h}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{E as g,T as _,w as v}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{t as y}from"./useMutation-DyQXZFEF.js";import{t as b}from"./useQuery-B38jBavx.js";import{t as x}from"./use-is-creating-conversation-CIAcnd8M.js";import{t as S}from"./Trans-DP5rcauH.js";import{I as C,gt as w,it as T,k as E,n as D,nt as ee,rt as O}from"./active-backend-context-B9942JGX.js";import{C as te,D as k,E as A,M as j,O as M,R as N,S as P,T as F,b as I,c as L,d as ne,h as re,i as ie,l as ae,o as oe,t as R,u as se,x as ce,z}from"./utils-qjs_KuS4.js";import{C as le,D as B,E as ue,O as de,S as fe,T as pe,_ as me,b as he,c as ge,d as _e,f as ve,g as ye,h as be,l as xe,m as Se,n as Ce,o as we,s as Te,t as Ee,v as De,w as Oe,x as ke,y as Ae}from"./messages-CYztjKLQ.js";import{t as je}from"./check-BMOG005H.js";import{n as Me,t as V}from"./vendor~root-layout~conversation-panel~conversation-DpA6fir3.js";import{t as Ne}from"./copy-B8Y5ufoR.js";import{t as Pe}from"./external-link-Cnnd6ikC.js";import{t as Fe}from"./list-todo-_BXQzOiB.js";import{t as Ie}from"./loader-circle-6zlEYCJw.js";import{t as Le}from"./x-EjvKGawc.js";import{t as Re}from"./proxy-CN3HaaOW.js";import{t as ze}from"./loading-spinner-CcpnCr_d.js";import{t as Be}from"./use-tracking-De7qByD4.js";import{n as Ve}from"./use-settings-BKpkUS4y.js";import{t as He}from"./modal-backdrop-X-vKo61e.js";import{n as Ue}from"./modal-body-DQhiw-AR.js";import{n as We,r as Ge}from"./base-modal-CSHhJTSr.js";import{t as Ke}from"./brand-button-CQO8oqVo.js";import{n as qe}from"./navigation-context-BOGzIng3.js";import{t as Je}from"./styled-tooltip-DsjDnR_W.js";import{r as Ye,u as Xe}from"./dropdown-classes-DQlj-MpS.js";import{c as Ze,g as Qe,m as $e,n as et,p as tt,v as nt}from"./git-provider-icon-DeQUgZVE.js";import{a as rt,c as it,f as at,t as H,u as ot}from"./conversation-store-C6hSXHw0.js";import{t as st}from"./modal-close-button-turIYn0t.js";import{t as ct}from"./v4-DDdyfk2q.js";import{l as lt,t as ut,u as dt}from"./agent-server-conversation-service.api-D7qh9amG.js";import{t as ft}from"./use-is-authed-BsS4XwSL.js";import{a as pt,c as mt,f as ht,g as gt,l as _t,m as vt,s as yt,t as bt}from"./conversation-state-store-BORusMiV.js";import{c as xt,d as St,f as Ct,i as wt,l as Tt,n as Et,r as Dt,s as Ot,t as kt,u as At}from"./sidebar-mobile-menu-toggle-BlmI8OrA.js";import{t as jt}from"./use-click-outside-element-DKqpqEEm.js";import{n as Mt}from"./use-create-conversation-DzcM79TE.js";import{n as Nt,t as U}from"./context-menu-list-item-BTHGFhIx.js";import{a as W,i as Pt,n as Ft}from"./use-can-manage-org-profiles-Uai-HHx2.js";import{t as It}from"./u-edit-809W9D9T.js";import{t as Lt}from"./skills-CYFLsN5U.js";import{t as Rt}from"./use-user-conversation-43duhf7D.js";import{t as zt}from"./copy-z7idLzWO.js";import{r as Bt}from"./typography-C6fuRTTT.js";import{A as Vt,B as Ht,C as Ut,D as Wt,E as Gt,F as Kt,G as qt,I as Jt,L as Yt,M as Xt,N as Zt,O as Qt,R as $t,S as en,T as tn,U as nn,V as rn,a as an,b as on,f as sn,g as cn,h as ln,i as un,k as dn,m as fn,n as pn,o as mn,p as hn,r as gn,t as _n,v as vn,w as yn,x as bn,y as xn}from"./llm-not-configured-banner-znJFsW_O.js";import{A as Sn,B as Cn,C as wn,D as Tn,E as En,F as Dn,G,I as On,J as kn,K,L as An,M as jn,N as Mn,O as Nn,P as Pn,S as Fn,V as In,W as Ln,a as Rn,b as zn,d as Bn,f as Vn,g as Hn,i as Un,k as Wn,l as Gn,m as Kn,p as qn,q,s as Jn,u as Yn,v as Xn,w as Zn,x as J,y as Y,z as Qn}from"./markdown-renderer-Dkmjmx_d.js";import{t as $n}from"./use-breakpoint-DA7JqsRN.js";import{t as er}from"./vendor~conversation-panel~conversation~alert-banner-BNzz5FuZ.js";var tr=g(`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`}]]),nr=g(`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`}]]),rr=g(`square-chevron-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m10 8 4 4-4 4`,key:`1wy4r4`}]]),ir=e=>!e.isLayoutDirty&&e.willUpdate(!1);function ar(){let e=new Set,t=new WeakMap,n=()=>e.forEach(ir);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=l(),Z=e(n(),1),or=(0,Z.createContext)(null);function sr(){let e=(0,Z.useRef)(!1);return o(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function cr(){let e=sr(),[n,r]=(0,Z.useState)(0),i=(0,Z.useCallback)(()=>{e.current&&r(n+1)},[n]);return[(0,Z.useCallback)(()=>t.postRender(i),[i]),n]}var lr=e=>e===!0,ur=e=>lr(e===!0)||e===`id`,dr=({children:e,id:t,inherit:n=!0})=>{let r=(0,Z.useContext)(a),i=(0,Z.useContext)(or),[o,s]=cr(),c=(0,Z.useRef)(null),l=r.id||i;c.current===null&&(ur(n)&&l&&(t=t?l+`-`+t:l),c.current={id:t,group:lr(n)&&r.group||ar()});let u=(0,Z.useMemo)(()=>({...c.current,forceRender:o}),[s]);return(0,X.jsx)(a.Provider,{value:u,children:e})},fr={curAgentState:F.LOADING},pr=at(e=>({...fr,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(fr)})),mr=`openhands-last-conversation-by-backend`;function hr(e,t){return t?`${e}::${t}`:e}function gr(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(mr);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 _r(e){if(!(typeof window>`u`))try{window.localStorage.setItem(mr,JSON.stringify(e))}catch{}}function vr(e,t,n){if(!n)return;let r=gr();r[hr(e,t)]=n,_r(r)}function yr(e,t){let n=gr(),r=hr(e,t);r in n&&(delete n[r],_r(n))}var br=e=>({action:B.CHANGE_AGENT_STATE,args:{agent_state:e}}),xr=e=>`error`in e,Sr=e=>`type`in e&&e.type===`error`,Cr=()=>{let{send:e}=ue(),t=J(e=>e.events);Z.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!(Sn(n)&&Wn(n))){if(xr(n)){if(n.error_code===401){O(`Session expired.`);return}typeof n.error==`string`?O(n.error):O(n.message);return}Sr(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(br(F.PAUSED))}},[t.length])},wr=()=>{let{curAgentState:e}=G();return{runtimeActive:!A.includes(e)}};function Tr({children:e}){return Cr(),wr(),e}var Er=`ACPAuthRequired`,Dr={ACPAuthRequired:z.ERROR$ACP_AUTH_REQUIRED_TITLE,ACPSpawnError:z.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPInitError:z.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPPromptError:z.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,UsagePolicyRefusal:z.CHAT_INTERFACE$AGENT_ERROR_MESSAGE};function Or(e){return e?Dr[e]??null:null}function kr(e){return e===Er}var Ar={entriesByConversation:{}},jr=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),Mr=at()(ot(e=>({...Ar,addPending:(t,n)=>{let r=ct();return e(e=>jr(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>jr(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>jr(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>jr(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function Nr({onClick:e}){let{t}=h(`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)(le,{className:`w-3.5 h-3.5 fill-success`}),(0,X.jsx)(`span`,{children:t(z.CHAT_INTERFACE$BTW_GOT_IT)})]})}function Pr({conversationId:e}){let{t}=h(`openhands`),n=Mr(e=>e.entriesByConversation),r=Mr(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)(Oe,{title:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`opacity-60`,children:t(z.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(z.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,X.jsx)(Nr,{onClick:()=>r(e,n.id)})},n.id)})})}function Fr({conversationId:e}){let t=Hn(e=>e.statusByConversation),n=e?t[e]:void 0;return n?.active?(0,X.jsx)(fe,{status:n}):null}var Ir=`${M} `,Lr=(e,t)=>{let n=Mr(e=>e.addPending),r=Mr(e=>e.resolve),i=Mr(e=>e.fail);return(0,Z.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(Ir);if(!e||!s){t(a);return}let c=o.slice(M.length).trim();if(!c)return;let l=n(e,c);mt(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])},Rr=`${j} `,zr=/^--max(?:=|\s+)(\d+)\s*/,Br=(e,t)=>{let{t:n}=h();return(0,Z.useCallback)(r=>{let i=r.trim(),a=i===`/goal`||i.startsWith(Rr);if(!e||!a){t(r);return}let o=i.slice(j.length).trim(),s,c=o.match(zr);c&&(s=parseInt(c[1],10),o=o.slice(c[0].length).trim());let l=o;if(!l){O(n(z.GOAL$OBJECTIVE_REQUIRED));return}let u={objective:l};s&&s>=1&&(u.max_iterations=s),vt(e,u).catch(e=>{let t=n(z.GOAL$START_FAILED);O(e instanceof Error&&e.message?e.message:t)})},[e,t,n])},Vr=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function Hr(e){return R(Vr,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 Ur(e){return e?`white`:`var(--oh-muted)`}var Wr=`font-normal text-sm leading-5 truncate`;function Gr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=h(`openhands`),{trackPullButtonClick:a}=Be(),o=n&&t&&r;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(L())},disabled:!o,className:R(Hr(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)(Qt,{width:12,height:12,color:Ur(o)})}),(0,X.jsx)(`div`,{className:R(Wr,`max-w-[76px]`),title:i(z.COMMON$PULL),children:i(z.COMMON$PULL)})]})}function Kr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=h(`openhands`),{trackPushButtonClick:o}=Be(),s=n&&t&&i;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(ae(r))},disabled:!s,className:R(Hr(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)(dn,{width:12,height:12,color:Ur(s)})}),(0,X.jsx)(`div`,{className:R(Wr,`max-w-[77px]`),title:a(z.COMMON$PUSH),children:a(z.COMMON$PUSH)})]})}function qr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=h(`openhands`),{trackCreatePrButtonClick:o}=Be(),s=n&&t&&i;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(oe(r))},disabled:!s,className:R(Hr(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)(Wt,{width:12,height:12,color:Ur(s)})}),(0,X.jsx)(`div`,{className:R(Wr,`max-w-[126px]`),title:a(z.COMMON$PULL_REQUEST),children:a(z.COMMON$PULL_REQUEST)})]})}var Jr=({allowAgentError:e=!1}={})=>{let{data:t}=K(),{curAgentState:n}=G(),r=e?k:A;return I(t?.execution_status)&&!r.includes(n)};function Yr(e){return e.kind===`BashCommand`}function Xr(e){return e.kind===`BashOutput`}function Zr(e){return e.kind===`BashError`}function Qr(e,t,n){let r=(0,Z.useRef)(null),i=(0,Z.useRef)(null),a=(0,Z.useRef)([]),o=(0,Z.useRef)([]),s=(0,Z.useRef)(new Map);return(0,Z.useEffect)(()=>{if(!n)return;let c=E(e),l=new WebSocket(c);r.current=l,i.current=null,l.onopen=()=>{Ln(l,t),i.current=l;for(let{command:e,cwd:t,timeout:n,resolve:r,reject:i}of a.current)o.current.push({resolve:r,reject:i}),l.send(JSON.stringify({command:e,cwd:t,timeout:n}));a.current=[]},l.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Yr(t)){let e=o.current.shift();e&&s.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Xr(t)&&t.command_id){let e=s.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(s.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else Zr(t)&&u(`Bash error: ${t.code}: ${t.detail}`)};function u(e){let t=Error(e);for(let{reject:e}of a.current)e(t);a.current=[];for(let e of o.current)e.reject(t);o.current=[];for(let e of s.current.values())e.reject(t);s.current.clear()}return l.onclose=()=>{r.current=null,i.current=null,u(`Bash WebSocket closed`)},l.onerror=()=>{r.current=null,i.current=null,u(`Bash WebSocket error`)},()=>{l.onclose=null,l.onerror=null,l.close(),r.current=null,i.current=null,u(`Bash WebSocket unmounted`)}},[n,e,t]),(0,Z.useCallback)((e,t,n)=>new Promise((s,c)=>{let l=r.current;if(!l||l.readyState===WebSocket.CLOSED||l.readyState===WebSocket.CLOSING){c(Error(`Bash WebSocket not available`));return}l.readyState!==WebSocket.OPEN||i.current!==l?a.current.push({command:e,cwd:t,timeout:n,resolve:s,reject:c}):(o.current.push({resolve:s,reject:c}),l.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var $r={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function ei(e){return e.replace(/\.git$/,``)}function ti(e){return e?$r[e.toLowerCase()]??null:null}function ni(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 ri(e,t,n){let r=ei(n.replace(/^\/+/,``)),i=ti(t);return{url:e,host:t,repository:(i===`azure_devops`?ni(r):r)||null,provider:i}}function ii(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return ri(t,e,n[2])}try{let e=new URL(t);return ri(t,e.hostname||null,e.pathname)}catch{return null}}var ai={repository:null,branch:null,provider:null,remoteUrl:null},oi=[`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-SAiFCnS5.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/vendor-styling-Bcgpimp9.js","assets/active-backend-context-BlZPzZNU.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js","assets/vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js","assets/utils-qjs_KuS4.js","assets/vendor~files-tab-vm3f67Pz.js","assets/iconBase-B2rQun3J.js","assets/vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-Bw4AuHN1.js","assets/vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js","assets/useQuery-B38jBavx.js","assets/messages-DINDkPNK.js","assets/vendor-markdown-BML7QbqS.js","assets/vendor~root-layout~index-home~home~conversation-panel~conversation~shared-conversation-DD_UNO02.js","assets/useMutation-DyQXZFEF.js","assets/Trans-DP5rcauH.js","assets/markdown-renderer-CvOO0YIr.js","assets/v4-DDdyfk2q.js","assets/conversation-store-C6hSXHw0.js","assets/agent-server-conversation-service.api-Btmi4q6d.js","assets/vendor~root-layout~index-home~home~conversation-panel~conversation~launch~skills-settings~a~eywn6ulz-BKxxr74w.js","assets/client-source-1v-kWLNU.js","assets/proxy-C79PCMjo.js","assets/profiles-service.api-CBafmAPO.js","assets/settings-service.api-DryhKdSr.js","assets/settings-Chfn5xTD.js","assets/llm-subscription-service-W5BprsNA.js","assets/llm-subscription-DTqtBCWz.js","assets/acp-providers-BHKZvEm5.js","assets/conversation-state-store-DTq4hFoP.js","assets/syntax-highlighter-B92AFGMy.js","assets/copy-to-clipboard-button-C4l3CMSd.js","assets/checkmark-CxdXtM3b.js","assets/copy-z7idLzWO.js","assets/navigation-context-BOGzIng3.js","assets/use-user-conversation-GnGhs_Ob.js","assets/telemetry-cmCL3o6Z.js","assets/chevron-down-CV1zZP_K.js","assets/loader-circle-6zlEYCJw.js","assets/vendor~root-layout~conversation-panel~conversation~shared-conversation-DRblkyXD.js","assets/use-config-Csy8EAP9.js","assets/styled-tooltip-DsjDnR_W.js","assets/use-settings-DBI44RnH.js","assets/close-CDAVqnTn.js","assets/skills-CYFLsN5U.js","assets/u-check-circle-DBEvndTS.js","assets/typography-C6fuRTTT.js","assets/dist-hOnv1nn2.js","assets/form-control-classes-CSPevi7c.js","assets/format-time-delta-DuhE50B-.js","assets/git-provider-icon-BREx-yUX.js","assets/use-tracking-CN1nIMnY.js","assets/use-is-authed-BsS4XwSL.js","assets/llm-not-configured-banner-DTWzISnk.js","assets/vendor~index-home~home~conversation-panel~conversation-kX4LrGQC.js","assets/use-is-creating-conversation-CIAcnd8M.js","assets/vendor~root-layout~index-home~home~conversation-panel~conversation-EShpjxey.js","assets/chat-send-button-D4614wUz.js","assets/check-BMOG005H.js","assets/circle-check-lvN_jFN5.js","assets/plus-vIbGD459.js","assets/refresh-cw-D7CYLy-d.js","assets/use-agent-profiles-Dmd_4H8q.js","assets/use-skills-RQsCtdzN.js","assets/context-menu-list-item-BTHGFhIx.js","assets/dropdown-classes-DQlj-MpS.js","assets/use-can-manage-org-profiles-CrG1km7R.js","assets/organization-service.api-CT2OQlLz.js","assets/merge-agent-profile-save-input-WcFmQVKK.js","assets/brand-button-CQO8oqVo.js","assets/base-modal-CSHhJTSr.js","assets/modal-body-DQhiw-AR.js","assets/modal-classes-YaEEa5eZ.js","assets/loading-spinner-CcpnCr_d.js","assets/modal-backdrop-X-vKo61e.js","assets/modal-close-button-turIYn0t.js","assets/navigation-link-Bxmn-pCs.js","assets/use-activate-agent-profile-DH33MvVj.js","assets/use-create-conversation-Dsa4nzU9.js","assets/plugins-management-service-DVkoM3eA.js","assets/use-llm-profiles-BMQoc612.js","assets/use-click-outside-element-DKqpqEEm.js","assets/link-external-BDBCz-_z.js","assets/settings-gear-TYXnELES.js","assets/u-robot-CJtSzy5X.js","assets/cloud-funnel-analytics-CasMM7EO.js","assets/combobox-caret-C8_eGdp2.js","assets/settings-utils-BL_Z9uIe.js","assets/map-provider-CXU6issd.js","assets/conversation-tab-empty-state-BCMHkGQk.js","assets/highlighted-source-view-suUKd5if.js","assets/folder-C86qXV7M.js","assets/segmented-toggle-DbbD3Tve.js","assets/browser-tab-CEApjoEV.js","assets/external-link-Cnnd6ikC.js","assets/vendor~browser-tab-_-VCXq8n.js","assets/planner-tab-w6HT0N_A.js","assets/list-todo-_BXQzOiB.js","assets/task-list-tab-BmaTwjaS.js","assets/terminal-BRcoba5B.js","assets/vendor~terminal-BVSbSr6V.js","assets/vendor~terminal-T4IDBjWs.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{$ as t,St as n,a as r,bt as i,gt as a,ht as o,m as s,xt as c,yt as l}from"./vendor-styling-Bcgpimp9.js";import{F as u,I as d,R as f,U as p}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{n as m}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js";import{t as h}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{E as g,T as _,w as v}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{t as y}from"./useMutation-DyQXZFEF.js";import{t as b}from"./useQuery-B38jBavx.js";import{t as x}from"./use-is-creating-conversation-CIAcnd8M.js";import{t as S}from"./Trans-DP5rcauH.js";import{I as C,gt as w,it as T,k as E,n as D,nt as ee,rt as O}from"./active-backend-context-BlZPzZNU.js";import{C as te,D as k,E as A,M as j,O as M,R as N,S as P,T as F,b as I,c as L,d as ne,h as re,i as ie,l as ae,o as oe,t as R,u as se,x as ce,z}from"./utils-qjs_KuS4.js";import{C as le,D as B,E as ue,O as de,S as fe,T as pe,_ as me,b as he,c as ge,d as _e,f as ve,g as ye,h as be,l as xe,m as Se,n as Ce,o as we,s as Te,t as Ee,v as De,w as Oe,x as ke,y as Ae}from"./messages-DINDkPNK.js";import{t as je}from"./check-BMOG005H.js";import{n as Me,t as V}from"./vendor~root-layout~conversation-panel~conversation-DpA6fir3.js";import{t as Ne}from"./copy-B8Y5ufoR.js";import{t as Pe}from"./external-link-Cnnd6ikC.js";import{t as Fe}from"./list-todo-_BXQzOiB.js";import{t as Ie}from"./loader-circle-6zlEYCJw.js";import{t as Le}from"./x-EjvKGawc.js";import{t as Re}from"./proxy-C79PCMjo.js";import{t as ze}from"./loading-spinner-CcpnCr_d.js";import{t as Be}from"./use-tracking-CN1nIMnY.js";import{n as Ve}from"./use-settings-DBI44RnH.js";import{t as He}from"./modal-backdrop-X-vKo61e.js";import{n as Ue}from"./modal-body-DQhiw-AR.js";import{n as We,r as Ge}from"./base-modal-CSHhJTSr.js";import{t as Ke}from"./brand-button-CQO8oqVo.js";import{n as qe}from"./navigation-context-BOGzIng3.js";import{t as Je}from"./styled-tooltip-DsjDnR_W.js";import{r as Ye,u as Xe}from"./dropdown-classes-DQlj-MpS.js";import{c as Ze,g as Qe,m as $e,n as et,p as tt,v as nt}from"./git-provider-icon-BREx-yUX.js";import{a as rt,c as it,f as at,t as H,u as ot}from"./conversation-store-C6hSXHw0.js";import{t as st}from"./modal-close-button-turIYn0t.js";import{t as ct}from"./v4-DDdyfk2q.js";import{l as lt,t as ut,u as dt}from"./agent-server-conversation-service.api-Btmi4q6d.js";import{t as ft}from"./use-is-authed-BsS4XwSL.js";import{a as pt,c as mt,f as ht,g as gt,l as _t,m as vt,s as yt,t as bt}from"./conversation-state-store-DTq4hFoP.js";import{c as xt,d as St,f as Ct,i as wt,l as Tt,n as Et,r as Dt,s as Ot,t as kt,u as At}from"./sidebar-mobile-menu-toggle-U78hQRJ1.js";import{t as jt}from"./use-click-outside-element-DKqpqEEm.js";import{n as Mt}from"./use-create-conversation-Dsa4nzU9.js";import{n as Nt,t as U}from"./context-menu-list-item-BTHGFhIx.js";import{a as W,i as Pt,n as Ft}from"./use-can-manage-org-profiles-CrG1km7R.js";import{t as It}from"./u-edit-809W9D9T.js";import{t as Lt}from"./skills-CYFLsN5U.js";import{t as Rt}from"./use-user-conversation-GnGhs_Ob.js";import{t as zt}from"./copy-z7idLzWO.js";import{r as Bt}from"./typography-C6fuRTTT.js";import{A as Vt,B as Ht,C as Ut,D as Wt,E as Gt,F as Kt,G as qt,I as Jt,L as Yt,M as Xt,N as Zt,O as Qt,R as $t,S as en,T as tn,U as nn,V as rn,a as an,b as on,f as sn,g as cn,h as ln,i as un,k as dn,m as fn,n as pn,o as mn,p as hn,r as gn,t as _n,v as vn,w as yn,x as bn,y as xn}from"./llm-not-configured-banner-DTWzISnk.js";import{A as Sn,B as Cn,C as wn,D as Tn,E as En,F as Dn,G,I as On,J as kn,K,L as An,M as jn,N as Mn,O as Nn,P as Pn,S as Fn,V as In,W as Ln,a as Rn,b as zn,d as Bn,f as Vn,g as Hn,i as Un,k as Wn,l as Gn,m as Kn,p as qn,q,s as Jn,u as Yn,v as Xn,w as Zn,x as J,y as Y,z as Qn}from"./markdown-renderer-CvOO0YIr.js";import{t as $n}from"./use-breakpoint-DA7JqsRN.js";import{t as er}from"./vendor~conversation-panel~conversation~alert-banner-BNzz5FuZ.js";var tr=g(`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`}]]),nr=g(`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`}]]),rr=g(`square-chevron-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m10 8 4 4-4 4`,key:`1wy4r4`}]]),ir=e=>!e.isLayoutDirty&&e.willUpdate(!1);function ar(){let e=new Set,t=new WeakMap,n=()=>e.forEach(ir);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=l(),Z=e(n(),1),or=(0,Z.createContext)(null);function sr(){let e=(0,Z.useRef)(!1);return o(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function cr(){let e=sr(),[n,r]=(0,Z.useState)(0),i=(0,Z.useCallback)(()=>{e.current&&r(n+1)},[n]);return[(0,Z.useCallback)(()=>t.postRender(i),[i]),n]}var lr=e=>e===!0,ur=e=>lr(e===!0)||e===`id`,dr=({children:e,id:t,inherit:n=!0})=>{let r=(0,Z.useContext)(a),i=(0,Z.useContext)(or),[o,s]=cr(),c=(0,Z.useRef)(null),l=r.id||i;c.current===null&&(ur(n)&&l&&(t=t?l+`-`+t:l),c.current={id:t,group:lr(n)&&r.group||ar()});let u=(0,Z.useMemo)(()=>({...c.current,forceRender:o}),[s]);return(0,X.jsx)(a.Provider,{value:u,children:e})},fr={curAgentState:F.LOADING},pr=at(e=>({...fr,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(fr)})),mr=`openhands-last-conversation-by-backend`;function hr(e,t){return t?`${e}::${t}`:e}function gr(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(mr);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 _r(e){if(!(typeof window>`u`))try{window.localStorage.setItem(mr,JSON.stringify(e))}catch{}}function vr(e,t,n){if(!n)return;let r=gr();r[hr(e,t)]=n,_r(r)}function yr(e,t){let n=gr(),r=hr(e,t);r in n&&(delete n[r],_r(n))}var br=e=>({action:B.CHANGE_AGENT_STATE,args:{agent_state:e}}),xr=e=>`error`in e,Sr=e=>`type`in e&&e.type===`error`,Cr=()=>{let{send:e}=ue(),t=J(e=>e.events);Z.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!(Sn(n)&&Wn(n))){if(xr(n)){if(n.error_code===401){O(`Session expired.`);return}typeof n.error==`string`?O(n.error):O(n.message);return}Sr(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(br(F.PAUSED))}},[t.length])},wr=()=>{let{curAgentState:e}=G();return{runtimeActive:!A.includes(e)}};function Tr({children:e}){return Cr(),wr(),e}var Er=`ACPAuthRequired`,Dr={ACPAuthRequired:z.ERROR$ACP_AUTH_REQUIRED_TITLE,ACPSpawnError:z.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPInitError:z.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPPromptError:z.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,UsagePolicyRefusal:z.CHAT_INTERFACE$AGENT_ERROR_MESSAGE};function Or(e){return e?Dr[e]??null:null}function kr(e){return e===Er}var Ar={entriesByConversation:{}},jr=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),Mr=at()(ot(e=>({...Ar,addPending:(t,n)=>{let r=ct();return e(e=>jr(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>jr(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>jr(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>jr(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function Nr({onClick:e}){let{t}=h(`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)(le,{className:`w-3.5 h-3.5 fill-success`}),(0,X.jsx)(`span`,{children:t(z.CHAT_INTERFACE$BTW_GOT_IT)})]})}function Pr({conversationId:e}){let{t}=h(`openhands`),n=Mr(e=>e.entriesByConversation),r=Mr(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)(Oe,{title:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`opacity-60`,children:t(z.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(z.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,X.jsx)(Nr,{onClick:()=>r(e,n.id)})},n.id)})})}function Fr({conversationId:e}){let t=Hn(e=>e.statusByConversation),n=e?t[e]:void 0;return n?.active?(0,X.jsx)(fe,{status:n}):null}var Ir=`${M} `,Lr=(e,t)=>{let n=Mr(e=>e.addPending),r=Mr(e=>e.resolve),i=Mr(e=>e.fail);return(0,Z.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(Ir);if(!e||!s){t(a);return}let c=o.slice(M.length).trim();if(!c)return;let l=n(e,c);mt(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])},Rr=`${j} `,zr=/^--max(?:=|\s+)(\d+)\s*/,Br=(e,t)=>{let{t:n}=h();return(0,Z.useCallback)(r=>{let i=r.trim(),a=i===`/goal`||i.startsWith(Rr);if(!e||!a){t(r);return}let o=i.slice(j.length).trim(),s,c=o.match(zr);c&&(s=parseInt(c[1],10),o=o.slice(c[0].length).trim());let l=o;if(!l){O(n(z.GOAL$OBJECTIVE_REQUIRED));return}let u={objective:l};s&&s>=1&&(u.max_iterations=s),vt(e,u).catch(e=>{let t=n(z.GOAL$START_FAILED);O(e instanceof Error&&e.message?e.message:t)})},[e,t,n])},Vr=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function Hr(e){return R(Vr,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 Ur(e){return e?`white`:`var(--oh-muted)`}var Wr=`font-normal text-sm leading-5 truncate`;function Gr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=h(`openhands`),{trackPullButtonClick:a}=Be(),o=n&&t&&r;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(L())},disabled:!o,className:R(Hr(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)(Qt,{width:12,height:12,color:Ur(o)})}),(0,X.jsx)(`div`,{className:R(Wr,`max-w-[76px]`),title:i(z.COMMON$PULL),children:i(z.COMMON$PULL)})]})}function Kr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=h(`openhands`),{trackPushButtonClick:o}=Be(),s=n&&t&&i;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(ae(r))},disabled:!s,className:R(Hr(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)(dn,{width:12,height:12,color:Ur(s)})}),(0,X.jsx)(`div`,{className:R(Wr,`max-w-[77px]`),title:a(z.COMMON$PUSH),children:a(z.COMMON$PUSH)})]})}function qr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=h(`openhands`),{trackCreatePrButtonClick:o}=Be(),s=n&&t&&i;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(oe(r))},disabled:!s,className:R(Hr(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)(Wt,{width:12,height:12,color:Ur(s)})}),(0,X.jsx)(`div`,{className:R(Wr,`max-w-[126px]`),title:a(z.COMMON$PULL_REQUEST),children:a(z.COMMON$PULL_REQUEST)})]})}var Jr=({allowAgentError:e=!1}={})=>{let{data:t}=K(),{curAgentState:n}=G(),r=e?k:A;return I(t?.execution_status)&&!r.includes(n)};function Yr(e){return e.kind===`BashCommand`}function Xr(e){return e.kind===`BashOutput`}function Zr(e){return e.kind===`BashError`}function Qr(e,t,n){let r=(0,Z.useRef)(null),i=(0,Z.useRef)(null),a=(0,Z.useRef)([]),o=(0,Z.useRef)([]),s=(0,Z.useRef)(new Map);return(0,Z.useEffect)(()=>{if(!n)return;let c=E(e),l=new WebSocket(c);r.current=l,i.current=null,l.onopen=()=>{Ln(l,t),i.current=l;for(let{command:e,cwd:t,timeout:n,resolve:r,reject:i}of a.current)o.current.push({resolve:r,reject:i}),l.send(JSON.stringify({command:e,cwd:t,timeout:n}));a.current=[]},l.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Yr(t)){let e=o.current.shift();e&&s.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Xr(t)&&t.command_id){let e=s.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(s.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else Zr(t)&&u(`Bash error: ${t.code}: ${t.detail}`)};function u(e){let t=Error(e);for(let{reject:e}of a.current)e(t);a.current=[];for(let e of o.current)e.reject(t);o.current=[];for(let e of s.current.values())e.reject(t);s.current.clear()}return l.onclose=()=>{r.current=null,i.current=null,u(`Bash WebSocket closed`)},l.onerror=()=>{r.current=null,i.current=null,u(`Bash WebSocket error`)},()=>{l.onclose=null,l.onerror=null,l.close(),r.current=null,i.current=null,u(`Bash WebSocket unmounted`)}},[n,e,t]),(0,Z.useCallback)((e,t,n)=>new Promise((s,c)=>{let l=r.current;if(!l||l.readyState===WebSocket.CLOSED||l.readyState===WebSocket.CLOSING){c(Error(`Bash WebSocket not available`));return}l.readyState!==WebSocket.OPEN||i.current!==l?a.current.push({command:e,cwd:t,timeout:n,resolve:s,reject:c}):(o.current.push({resolve:s,reject:c}),l.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var $r={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function ei(e){return e.replace(/\.git$/,``)}function ti(e){return e?$r[e.toLowerCase()]??null:null}function ni(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 ri(e,t,n){let r=ei(n.replace(/^\/+/,``)),i=ti(t);return{url:e,host:t,repository:(i===`azure_devops`?ni(r):r)||null,provider:i}}function ii(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return ri(t,e,n[2])}try{let e=new URL(t);return ri(t,e.hostname||null,e.pathname)}catch{return null}}var ai={repository:null,branch:null,provider:null,remoteUrl:null},oi=[`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 si(e,t){let n=await e(oi,t,10);if(n.exit_code!==0)return ai;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 ai;let s=ii(i);return{repository:s?.repository??null,provider:s?.provider??null,remoteUrl:i||null,branch:o}}var ci=()=>{let{data:e}=K(),t=Jr(),{backend:n}=D(),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=Qr(a,o,d),p=(0,Z.useRef)(f);return p.current=f,b({queryKey:[`local-git-info`,i,a,o,s],queryFn:async()=>si((e,t,n)=>p.current(e,t,n),s),enabled:d,retry:!1,staleTime:1e4,refetchInterval:1e4,gcTime:1e3*60*5,meta:{disableToast:!0}})},li=()=>{let e=m(),{t}=h(`openhands`);return y({mutationFn:e=>ut.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)}),O(t(z.CONVERSATION$FAILED_TO_UPDATE_REPOSITORY))},onSuccess:()=>{T(t(z.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 ui({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 di({isOpen:e,onClose:t,onLaunch:n,defaultProvider:r=`github`}){let{t:i}=h(`openhands`),{providers:a}=Ze(),[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)},[]),g=()=>{!c||!u||(n(c,u),l(null),d(null),t())},_=()=>{s(null),l(null),d(null),t()};if(!e)return null;let v=c?.git_provider||o||r,y=!!c&&!!u;return(0,X.jsx)(He,{onClose:_,children:(0,X.jsxs)(Ue,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,X.jsx)(st,{onClose:_,testId:`close-open-repository-modal`}),(0,X.jsx)(`div`,{className:`w-full pr-6`,children:(0,X.jsx)(Ge,{title:i(z.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(z.CONVERSATION$SELECT_OR_INSERT_LINK)}),a.length>1&&(0,X.jsx)(mn,{providers:a,value:o,onChange:f})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] w-full`,children:[(0,X.jsx)(un,{provider:v,value:c?.id||null,repositoryName:c?.full_name||null,onChange:p,className:`w-full`}),(0,X.jsx)(an,{repository:c?.full_name||null,provider:v,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)(Ke,{type:`button`,variant:`secondary`,onClick:_,children:i(z.BUTTON$CANCEL)}),(0,X.jsx)(Ke,{type:`button`,variant:`primary`,onClick:g,isDisabled:!y,children:i(z.BUTTON$LAUNCH)})]})]})})}function fi({onSuggestionsClick:e}){let{t}=h(`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}=D(),f=d.kind===`local`,{providers:p}=Ze(),m=f||p.length>0,{data:g}=K(),{repositoryInfo:_}=Jt(),{data:v}=ci(),y=nn(),b=Rn()?.isLoadingHistory??!1,x=(0,Z.useRef)(y);(0,Z.useEffect)(()=>{x.current=y},[y]);let{send:S}=ue(),C=(0,Z.useRef)(S);(0,Z.useEffect)(()=>{C.current=S},[S]);let w=Ae(),{mutate:T}=li(),{mutate:E,isPending:ee}=Mt(),te=g?.selected_repository||_?.selectedRepository,k=g?.git_provider||_?.gitProvider,A=g?.selected_branch||_?.selectedBranch,j=te||v?.repository||void 0,M=k||v?.provider,N=A||v?.branch||void 0,P=(g?.id?dt(g.id):null)?.selected_workspace??null,F=P&&P.replace(/\/+$/,``).split(`/`).pop()||null,I=!!j&&!!M,L=!!g&&y===`OPEN`&&!b;(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 ne=(e,r)=>{n&&(c(e),T({conversationId:n,repository:e.full_name,branch:r.name,gitProvider:e.git_provider},{onSuccess:()=>{if(x.current!==`OPEN`){O(t(z.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;w?.scrollDomToBottom(),Promise.resolve(C.current({action:`message`,args:{content:a,timestamp:new Date().toISOString()}})).catch(e=>{o&&u(o,e instanceof Error?e.message:t(z.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))})}}))},re=!f||!!j||!!F,ie=f&&!I;return re||N||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:[re?(0,X.jsx)(gn,{selectedRepository:j,gitProvider:M,workspaceName:F,onClick:()=>i(!0),disabled:!L||ie}):null,N?(0,X.jsx)(pn,{selectedBranch:N,selectedRepository:j,gitProvider:M}):null,I?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ui,{tooltipMessage:t(z.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pull-button-tooltip`,shouldShowTooltip:!I,children:(0,X.jsx)(Gr,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,isConversationReady:L})}),(0,X.jsx)(ui,{tooltipMessage:t(z.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-push-button-tooltip`,shouldShowTooltip:!I,children:(0,X.jsx)(Kr,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:M,isConversationReady:L})}),(0,X.jsx)(ui,{tooltipMessage:t(z.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pr-button-tooltip`,shouldShowTooltip:!I,children:(0,X.jsx)(qr,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:M,isConversationReady:L})})]}):null]}),(0,X.jsx)(di,{isOpen:r,onClose:()=>i(!1),onLaunch:ne,defaultProvider:M})]}):null}function pi({onSubmit:e,disabled:t=!1,hasStartedConversation:n}){let{images:r,files:i,imagesMarkedUploadAsFile:a,clearAllFiles:o,subConversationTaskId:s}=H(),{curAgentState:c}=G(),{data:l}=K(),{conversationId:u}=kn(),d=u??l?.id??null,{taskStatus:f}=Kt(s,l?.id||null),{handleUpload:p}=sn(),m=fn(d,Br(d,Lr(d,t=>{let{imagesToEmbed:n,imagesAsFiles:s}=qt(r,a);e(t,n,[...i,...s]),o()})));return(0,X.jsxs)(`div`,{"data-testid":`interactive-chat-box`,children:[(0,X.jsx)(ln,{disabled:t||c===F.AWAITING_USER_CONFIRMATION||re(f),isNewConversationPending:t,hasStartedConversation:n,onSubmit:m,onFilesPaste:p}),(0,X.jsx)(`div`,{className:`mt-3 pb-3`,children:(0,X.jsx)(fi,{onSuggestionsClick:e=>{m(e)}})})]})}function mi(){let e=J(e=>e.events),t=J(e=>e.uiEvents),n=Z.useMemo(()=>t.filter(Yn),[t]),r=Z.useMemo(()=>e,[e]),i=Z.useMemo(()=>n.length,[n]),a=Z.useMemo(()=>r.some(e=>e.source===`agent`&&!In(e)&&!jn(e)),[r]),o=Gn(r);return{storeEvents:e,uiEvents:t,renderableEvents:n,allConversationEvents:r,totalEvents:i,hasSubstantiveAgentActions:a,conversationUserEventsExist:o,userEventsExist:o}}var hi=e=>`timestamp`in e?e.timestamp:void 0,gi=e=>{let t=!!e&&rt(e),n=t?void 0:e,{data:r}=Rt(e??null),{data:i,isFetched:a}=Bn(n??void 0),o=J(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||rt(e)||d.current||!f.current||!r)return;let{events:t}=J.getState(),n=t[0];if(!n)return;let i=hi(n);if(!i){f.current=!1,u(!1);return}d.current=!0,c(!0);try{let t=await qn.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),Jn(e,J.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 _i(){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 vi({suggestion:e,onClick:t}){let{t:n}=h(`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)(Gt,{width:24,height:24,color:`#fff`});case`AUTO_MERGE_PRS`:return(0,X.jsx)(tn,{width:19,height:20,color:`#fff`});case`FIX_README`:return(0,X.jsx)(yn,{width:24,height:24,color:`#fff`});case`CLEAN_DEPENDENCIES`:return(0,X.jsx)(Ut,{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 yi({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)(vi,{suggestion:e,onClick:t},n))})}var bi=z.SUGGESTIONS$HACKER_NEWS,xi=`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.`,Si=z.SUGGESTIONS$HELLO_WORLD,Ci=`I want to create a Hello World app in Javascript that:
|
|
@@ -17,7 +17,7 @@ The script should only use tools that are widely available on unix systems, like
|
|
|
17
17
|
This should be a client-only app with no backend. The list should persist in localStorage.`,Ei={repo:en,"non-repo":{[bi]:xi,[Si]:Ci,[wi]:Ti}};function Di({onSuggestionsClick:e}){let{t}=h(`openhands`),{shouldHideSuggestions:n}=H();return(0,X.jsx)(s,{children:!n&&(0,X.jsxs)(V.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(z.LANDING$TITLE)})}),(0,X.jsx)(yi,{suggestions:Object.entries(Ei.repo).slice(0,4).map(([e,t])=>({label:e,value:t})),onSuggestionClick:e})]})})}var Oi={files:[],initialPrompt:null,selectedRepository:null,selectedRepositoryProvider:null,replayJson:null},ki=at(e=>({...Oi,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(()=>Oi)})),Ai=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 ji({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)(Ai,{width:15,height:15})})}var Mi=[{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 Ni({width:e,height:t}){return(0,X.jsx)(`div`,{className:R(`rounded-md bg-foreground/5 animate-pulse`,e,t)})}function Pi(){let{t:e}=h(`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(z.CHAT_INTERFACE$LOADING_CONVERSATION),children:Mi.map((e,t)=>(0,X.jsx)(`div`,{className:R(`flex w-full`,e.align),children:(0,X.jsx)(Ni,{width:e.width,height:e.height})},t))})}var Fi=220;function Ii({message:e,code:t,onDismiss:n,onRetry:r,onReauth:i}){let{t:a,i18n:o}=h(`openhands`),s=Or(t),[c,l]=Z.useState(!1),[u,d]=Z.useState(!1),[f,p]=Z.useState(!1),m=Z.useRef(null),g=o.exists(e,{ns:`openhands`}),v=g?String(a(e)):e,y=v.length>Fi,b=y&&!c;return Z.useEffect(()=>{if(!f)return;let e=setTimeout(()=>{p(!1)},2e3);return()=>clearTimeout(e)},[f]),Z.useEffect(()=>{p(!1)},[v]),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()},[v,b,c,e]),(0,X.jsxs)(`div`,{className:R(`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)(_,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:N},"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:R(`whitespace-pre-wrap break-words text-sm text-[var(--oh-muted)]`,b&&`line-clamp-3`),"data-testid":`error-message-banner-content`,children:g?(0,X.jsx)(S,{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(z.ERROR$ACP_UPDATE_CREDENTIALS)}),y&&(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?z.COMMON$VIEW_LESS:z.COMMON$VIEW_MORE)})]}),(0,X.jsxs)(`div`,{className:R(`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(z.CHAT_INTERFACE$MESSAGE_RETRY)}),(0,X.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(v),p(!0)}catch{O(a(z.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?z.BUTTON$COPIED:z.BUTTON$COPY),"data-testid":`error-message-banner-copy`,children:f?(0,X.jsx)(je,{className:`h-4 w-4`,"aria-hidden":!0}):(0,X.jsx)(Ne,{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(z.BUTTON$CLOSE),"data-testid":`error-message-banner-dismiss`,children:(0,X.jsx)(Le,{className:`h-4 w-4`,"aria-hidden":!0})})]})]})}var Li={dismissedEventIds:{}},Ri=at()(ot(e=>({...Li,dismiss:t=>e(e=>({dismissedEventIds:{...e.dismissedEventIds,...Object.fromEntries(t.map(e=>[e,!0]))}}))}),{name:`SkillInstallBannerStore`})),zi=/^✅ Successfully installed '([^']+)' to (.+)$/m;function Bi(e){let t=new Map;for(let n of e){if(!Mn(n))continue;let e=n.observation.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
18
18
|
`).match(zi);if(!e)continue;let r=e[1],i=e[2].replace(/\\/g,`/`).replace(/\/+$/,``),a=`/.agents/skills/${r}`;if(!i.endsWith(a))continue;let o=i.slice(0,-a.length);if(!o)continue;let s=`${o}::${r}`;t.delete(s),t.set(s,{eventId:n.id,skillName:r,workspacePath:o})}return[...t.values()]}var Vi=e=>{let t=J(e=>e.events),n=J(e=>e.loadedConversationId),r=Ri(e=>e.dismissedEventIds),i=Ri(e=>e.dismiss),a=(0,Z.useMemo)(()=>!e||e!==n?[]:Bi(t).filter(e=>!r[e.eventId]),[e,n,t,r]);return{installs:a,dismissAll:(0,Z.useCallback)(()=>i(a.map(e=>e.eventId)),[i,a])}};function Hi({conversationId:e}){let{t}=h(`openhands`),{installs:n,dismissAll:r}=Vi(e),{backend:i}=D(),{mutate:a,isPending:o}=Mt(),s=x(),{navigate:c}=qe(),{data:l}=K();if(i.kind!==`local`||n.length===0)return null;let u=n[n.length-1],d=n.filter(e=>e.workspacePath===u.workspacePath).map(e=>e.skillName);return(0,X.jsxs)(`div`,{className:`flex w-full items-start gap-2 rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface-raised)] p-2 text-[var(--oh-foreground)]`,"data-testid":`skill-install-restart-banner`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`text-sm text-[var(--oh-foreground)]`,children:t(z.SKILLS$INSTALL_BANNER_MESSAGE,{skills:d.join(`, `)})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>{o||s||a({workingDir:u.workspacePath,workspaceMode:`local_repo`,repository:l?.selected_repository&&l?.git_provider?{name:l.selected_repository,gitProvider:l.git_provider,branch:l.selected_branch??void 0}:void 0,entryPoint:`skill_install_restart_banner`},{onSuccess:e=>c(`/conversations/${e.conversation_id}`),onError:e=>O(e.message)})},disabled:o||s,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)] disabled:cursor-not-allowed disabled:opacity-50`,"data-testid":`skill-install-restart-action`,children:t(z.SKILLS$INSTALL_BANNER_ACTION)})]}),(0,X.jsx)(`button`,{type:`button`,onClick:r,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":t(z.BUTTON$CLOSE),"data-testid":`skill-install-restart-dismiss`,children:(0,X.jsx)(Le,{className:`h-4 w-4`,"aria-hidden":!0})})]})}function Ui(){let{t:e}=h(`openhands`),{conversationId:t}=kn(),n=Y(e=>e.pendingMessages),r=Y(e=>e.markPendingMessageError),i=Y(e=>e.markPendingMessageSending),a=Y(e=>e.removePendingMessage),o=H(e=>e.restoreMessageToInputIfEmpty),{send:s}=ue(),c=Z.useMemo(()=>t?n.filter(e=>$t(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(pe(n.text,n.imageUrls,n.fileUrls,n.timestamp))}catch(n){r(t,n instanceof Error?n.message:e(z.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)(be,{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)(ve,{size:`small`,images:e.imageUrls})},e.id))})}var Wi=()=>{let{data:e}=K();return y({mutationKey:[`unified-upload-files`],mutationFn:async t=>{let{conversationId:n,files:r}=t;return yt(n,r,e)},meta:{disableToast:!0}})},Gi=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 Ki(){let{t:e}=h(`openhands`),{data:t}=Ve();return t?.confirmation_mode?(0,X.jsx)(Je,{closeDelay:100,content:e(z.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)(Gi,{width:15,height:15})})}):null}var qi=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 Ji({status:e,statusColor:t}){return(0,X.jsx)(`div`,{"data-testid":`chat-status-indicator`,className:r(`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)(V.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)(qi,{className:`w-4 h-4`,color:t})},`dot-${e}`),(0,X.jsx)(V.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 Yi=()=>{let e=m(),{navigate:t}=qe(),{t:n}=h(`openhands`),{data:r}=K(),{trackConversationCreated:i}=Be();return y({mutationFn:async()=>{if(!r?.id)throw Error(`No active conversation`);let e=await ut.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:()=>{v.loading(n(z.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`}),v.dismiss(`clear-conversation`),T(n(z.CONVERSATION$CLEAR_SUCCESS)),t(`/conversations/${r.newConversationId}`),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`v1-batch-get-app-conversations`]})},onError:e=>{v.dismiss(`clear-conversation`);let t=n(z.CONVERSATION$CLEAR_UNKNOWN_ERROR);e instanceof Error?t=e.message:typeof e==`string`&&(t=e),O(n(z.CONVERSATION$CLEAR_FAILED,{error:t}))}})};function Xi(e,t){return e?`github`:t?`replay`:`direct`}function Zi(){let{trackInitialQuerySubmitted:e,trackUserMessageSent:t}=Be(),{setMessageToSend:n}=H(),{errorMessage:r,errorCode:i,removeErrorMessage:a,setErrorMessage:o}=zn(),s=f(),{isTask:c,taskStatus:l,taskDetail:u}=Jt(),d=c,p=Rn(),{send:m}=ue(),{renderableEvents:g,allConversationEvents:_,totalEvents:v,hasSubstantiveAgentActions:y,userEventsExist:b}=mi(),x=Y(e=>e.enqueuePendingMessage),S=Y(e=>e.markPendingMessageError),C=Y(e=>e.pendingMessages),{t:w}=h(`openhands`),T=Z.useRef(null),{scrollDomToBottom:E,onChatBodyScroll:D,hitBottom:ee,autoScroll:te,setAutoScroll:k,setHitBottom:A}=he(T),{mutate:j,isPending:M}=Yi(),{curAgentState:N}=G(),{handleBuildPlanClick:P}=me(),{data:I}=K(),L=I?.sandbox_status??null,re=on(),{isConfigured:ie,isLoading:ae}=hn(),oe=!ae&&!ie,R=N===F.RUNNING||N===F.LOADING;Z.useEffect(()=>{if(R)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),P(e),E())};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[R,P,E]);let{selectedRepository:ce,replayJson:le}=ki(),{conversationId:B}=kn(),de=Hn(e=>{let t=B?e.statusByConversation[B]:void 0;return t?.active?`${t.iteration}:${t.status}`:null}),{mutateAsync:fe}=Wi(),{isLoading:ge,hasMore:_e,loadOlder:ve}=gi(B),ye=Z.useRef(null),be=Z.useCallback(e=>{if(d||ge||!_e)return;let t=e.scrollTop<=80,n=e.scrollHeight<=e.clientHeight+80;!t&&!n||(ye.current={scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},ve().catch(e=>{ye.current=null,o(e instanceof Error&&e.message?e.message:w(z.ERROR$GENERIC))}))},[_e,ge,d,ve,o,w]),xe=Z.useCallback(e=>{e.deltaY<0&&e.currentTarget.scrollTop<=0&&be(e.currentTarget)},[be]),Se=Z.useMemo(()=>B?C.some(e=>$t(B,e.conversationId)):!1,[C,B]),Ce=Kn(e=>B?(e.entriesByConversation[B]?.length??0)>0:!1),we=Zt({isLoadingHistory:p?.isLoadingHistory===!0,hasUserEvents:b,hasPendingUserMessages:Se,hasSubstantiveAgentActions:y,hasModelEntries:Ce}),Te=_.length>0||Se||!p?.isLoadingHistory,Oe=!!B,Ae=!Te&&!c,je=async(r,i,a)=>{if(r.trim()===`/new`){if(!B){O(w(z.CONVERSATION$CLEAR_NO_ID));return}if(v===0){O(w(z.CONVERSATION$CLEAR_EMPTY));return}if(M)return;j();return}let o=[...i],s=[...a];v===0?e({entryPoint:Xi(ce!==null,le!==null),queryCharacterLength:r.length,replayJsonSize:le?.length}):t({sessionMessageCount:v,currentMessageLength:r.length});let c=Ht([...o,...s]);if(!c.isValid){O(`Error: ${c.errorMessage}`);return}let l=o.map(e=>rn(e)),u=await Promise.all(l),d=new Date().toISOString(),{skipped_files:f,uploaded_files:p}=s.length>0?await fe({conversationId:B,files:s}):{skipped_files:[],uploaded_files:[]};f.forEach(e=>O(e.reason));let h=`${w(z.CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE)}: ${p.join(`
|
|
19
19
|
|
|
20
|
-
`)}`,g=p.length>0?`${r}\n\n${h}`:r,_=x({conversationId:B,text:r,content:g,imageUrls:u,fileUrls:p,timestamp:d});E(),n(``);try{await m(pe(g,u,p,d))}catch(e){S(_,e instanceof Error?e.message:w(z.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}};Z.useEffect(()=>{if(ye.current&&T.current){let{scrollHeight:e,scrollTop:t}=ye.current,n=T.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),ye.current=null;return}te&&E()},[g.length,Se,de,E]);let Me=Z.useRef(be);Z.useEffect(()=>{Me.current=be}),Z.useEffect(()=>{let e=T.current;e&&Me.current(e)},[g.length,_e]);let V={scrollRef:T,autoScroll:te,setAutoScroll:k,scrollDomToBottom:E,hitBottom:ee,setHitBottom:A,onChatBodyScroll:D},Ne=N===F.LOADING||N===F.INIT,Pe=N===F.STOPPED,Fe=N===F.PAUSED,Ie=se({isPausing:Fe,isTask:c,taskStatus:l,isStartingStatus:Ne,isStopStatus:Pe,curAgentState:N}),Le=ne({isPausing:Fe,isTask:c,taskStatus:l,taskDetail:u,isStartingStatus:Ne,isStopStatus:Pe,curAgentState:N,errorMessage:r,t:w});return(0,X.jsx)(De,{value:V,children:(0,X.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!y&&!Se&&!b&&!Ce&&!Ae&&!d&&v===0&&!re&&!oe&&(0,X.jsx)(Di,{onSuggestionsClick:e=>n(e)}),(0,X.jsxs)(`div`,{ref:T,"data-testid":`chat-scroll-container`,onScroll:e=>{D(e.currentTarget),be(e.currentTarget)},onWheel:xe,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:[Ae&&Oe&&(0,X.jsx)(Pi,{}),Ae&&!Oe&&(0,X.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,X.jsx)(ze,{size:`small`})}),ge&&(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)(ze,{size:`small`}),(0,X.jsx)(`span`,{children:w(z.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,X.jsx)(ke,{conversationId:B,anchorEventId:null}),Te&&g.length>0&&(0,X.jsx)(Ee,{messages:g,allEvents:_}),(0,X.jsx)(Ui,{}),(0,X.jsx)(Fr,{conversationId:B})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px] pb-4`,children:[(0,X.jsx)(Hi,{conversationId:B}),(0,X.jsx)(Pr,{conversationId:B}),r&&(0,X.jsx)(Ii,{message:r,code:i,onDismiss:a,onRetry:r===`Unable to connect to server`?()=>p?.reconnect():void 0,onReauth:kr(i)?()=>s(`/settings/agents`):void 0}),oe&&!re&&(0,X.jsx)(_n,{}),re?(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:w(L===`ERROR`?z.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:z.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,X.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:w(L===`ERROR`?z.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:z.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)(Ki,{}),Ne&&(0,X.jsx)(Ji,{statusColor:Ie,status:Le})]}),ee?N===F.RUNNING&&(0,X.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,X.jsx)(_i,{})}):(0,X.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,X.jsx)(ji,{onClick:E})})]})}),(0,X.jsx)(pi,{onSubmit:je,disabled:M||oe,hasStartedConversation:we})]})]})]})})}function Qi({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)(Zi,{})})})}function $i({children:e}){return(0,X.jsx)(`div`,{className:`absolute inset-0`,children:e})}function ea({children:e}){return(0,X.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function ta({children:e}){return(0,X.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}function na({className:e}){let{t}=h(`openhands`);return(0,X.jsxs)(`div`,{className:R(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,X.jsx)(Ie,{className:`h-8 w-8 shrink-0 animate-spin text-tertiary-light`,"aria-hidden":!0}),(0,X.jsx)(ye,{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(z.HOME$LOADING)})]})}function ra({children:e,onReady:t}){return(0,Z.useLayoutEffect)(()=>{t()},[t]),e}function ia({onPending:e}){return(0,Z.useLayoutEffect)(()=>{e()},[e]),(0,X.jsx)(na,{})}var aa={duration:.35,ease:`easeInOut`};function oa({showAgentLoading:e,tabKey:t,children:n}){let r=de(),[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)(na,{}):(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(ia,{onPending:o}),children:(0,X.jsx)(ra,{onReady:c,children:n})})}):(0,X.jsxs)(`div`,{className:`relative h-full w-full overflow-hidden`,children:[(0,X.jsx)(V.div,{className:`absolute inset-0 h-full w-full`,initial:!1,animate:{opacity:+!l},transition:aa,"aria-hidden":l,children:(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(ia,{onPending:o}),children:(0,X.jsx)(ra,{onReady:c,children:n})})}),(0,X.jsx)(s,{children:l?(0,X.jsx)(V.div,{className:`absolute inset-0 z-10 h-full w-full`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:aa,children:(0,X.jsx)(na,{})},`conversation-tab-loading-overlay`):null})]})}var sa=(0,Z.lazy)(()=>c(()=>import(`./files-tab-LSBijbEi.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,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94]))),ca=(0,Z.lazy)(()=>c(()=>import(`./browser-tab-Cir7KbAL.js`),__vite__mapDeps([95,2,1,11,5,6,18,3,4,7,14,10,15,12,9,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,96,97,91]))),la=(0,Z.lazy)(()=>c(()=>import(`./planner-tab-Dr8B-ZBI.js`),__vite__mapDeps([98,1,2,11,5,6,13,3,4,7,14,15,12,9,16,17,18,10,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,99,55,56,57,58,59,60,61,62,63,64,52,53,54,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91]))),ua=(0,Z.lazy)(()=>c(()=>import(`./task-list-tab-Dzim5ftn.js`),__vite__mapDeps([100,1,2,11,5,6,13,3,4,7,14,15,12,9,16,17,18,10,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,91]))),da=(0,Z.lazy)(()=>c(()=>import(`./terminal-CYFAMiXx.js`),__vite__mapDeps([101,1,2,11,5,6,102,103,18,3,4,7,14,10,15,12,9,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,55,56,57,49,58,59,60,39,61,40,62,63,64,52,53,54,44,65,42,66,67,50,68,69,70,71,72,73,74,43,75,76,77,78,79,80,81,82,83,84,85,46,86,87,88,48,89,90,91]))),fa={tasklist:{component:ua},files:{component:sa},browser:{component:ca},terminal:{component:da},planner:{component:la}};function pa(){let{selectedTab:e,shouldShownAgentLoading:t}=H(),{conversationId:n}=q(),r=(0,Z.useMemo)(()=>fa[e]??fa.files,[e]).component,i=e===`terminal`?`${e}-${n}`:e??`files`;return(0,X.jsx)(ea,{children:(0,X.jsx)(ta,{children:(0,X.jsx)(oa,{showAgentLoading:t,tabKey:i,children:(0,X.jsx)($i,{children:(0,X.jsx)(r,{})},i)})})})}var ma=()=>{let e=m(),t=zn(e=>e.removeErrorMessage);return y({mutationKey:[`start-conversation`],mutationFn:async e=>ht(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)=>{_t(e,r.conversationId)},onSuccess:(n,r)=>{t(),gt(e,r.conversationId,te.RUNNING)}})},ha=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`})}),ga=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 _a({icon:e,text:t,onClick:n,testId:r}){return(0,X.jsx)(U,{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 va({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=G(),{isTask:i,taskStatus:a,taskDetail:o}=Jt(),{t:s}=h(`openhands`),{errorMessage:c}=zn(),l=r===F.LOADING||r===F.INIT,u=ce(t)||P(t),d=se({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=ne({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)(qi,{className:`w-6 h-6 shrink-0`,color:d}),(0,X.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function ya({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=h(`openhands`),c=jt(e),l=I(r),u=P(r),d=l||u;return(0,X.jsxs)(Nt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:R(`left-2 w-fit min-w-42`,a),children:[(0,X.jsx)(va,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nt,{inset:`menu`}),l&&t&&(0,X.jsx)(_a,{icon:(0,X.jsx)(ha,{width:18,height:18}),text:s(z.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,X.jsx)(_a,{icon:(0,X.jsx)(ga,{width:18,height:18}),text:s(z.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var ba=e(i(),1);function xa({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:R(`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:R(`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 Sa({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 g=$n(),{t:_}=h(`openhands`),{backend:v}=D(),{data:y}=K(),b=on(),x=jt(e),S=m?.current??null,[C,w]=Z.useState();Z.useLayoutEffect(()=>{if(!S)return;let e=()=>{let e=S.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,w(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[S,p]);let T=!!(a||o||s),E=!!i,ee=!!(r||n),O=v.kind===`cloud`?z.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:z.COMMON$STOP_CONVERSATION,te=v.kind===`cloud`&&!!c,k=y?.public||!1,A=!!S,j=(0,X.jsxs)(Nt,{ref:x,testId:`conversation-name-context-menu`,position:p,alignment:`left`,className:R(g?`right-0 translate-x-[34%] left-auto`:``,A?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,X.jsx)(U,{testId:`rename-button`,onClick:t,children:(0,X.jsx)(W,{icon:(0,X.jsx)(It,{width:16,height:16}),text:_(z.BUTTON$RENAME)})}),T&&(0,X.jsx)(nt,{testId:`separator-tools`,inset:`menu`}),o&&(0,X.jsx)(bn,{isDisabled:b,children:(0,X.jsx)(U,{testId:`show-skills-button`,onClick:o,isDisabled:b,children:(0,X.jsx)(W,{icon:(0,X.jsx)(Lt,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:_(z.CONVERSATION$SHOW_SKILLS)})})}),s&&(0,X.jsx)(bn,{isDisabled:b,children:(0,X.jsx)(U,{testId:`show-hooks-button`,onClick:s,isDisabled:b,children:(0,X.jsx)(W,{icon:(0,X.jsx)(Vt,{width:16,height:16,"aria-hidden":!0}),text:_(z.CONVERSATION$SHOW_HOOKS)})})}),a&&(0,X.jsx)(bn,{isDisabled:b,children:(0,X.jsx)(U,{testId:`show-agent-tools-button`,onClick:a,isDisabled:b,children:(0,X.jsx)(W,{icon:(0,X.jsx)($e,{width:16,height:16}),text:_(z.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})})}),u&&(0,X.jsx)(U,{testId:`export-transcript-button`,onClick:u,children:(0,X.jsx)(W,{icon:(0,X.jsx)(xt,{width:16,height:16}),text:_(z.BUTTON$EXPORT_TRANSCRIPT)})}),d&&(0,X.jsx)(U,{testId:`download-trajectory-button`,onClick:d,children:(0,X.jsx)(W,{icon:(0,X.jsx)(xt,{width:16,height:16}),text:_(z.BUTTON$DOWNLOAD_CONVERSATION_DATA)})}),(E||ee)&&(0,X.jsx)(nt,{testId:`separator-info-control`,inset:`menu`}),i&&(0,X.jsx)(U,{testId:`display-cost-button`,onClick:i,children:(0,X.jsx)(W,{icon:(0,X.jsx)(Ot,{width:16,height:16}),text:_(z.BUTTON$DISPLAY_COST)})}),te&&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)(nr,{size:16})}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:_(z.CONVERSATION$SHARE_PUBLICLY)}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[k&&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:_(z.BUTTON$COPY_TO_CLIPBOARD),children:(0,X.jsx)(zt,{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:_(z.BUTTON$OPEN_IN_NEW_TAB),children:(0,X.jsx)(Pe,{size:14,"aria-hidden":!0})})]}),(0,X.jsx)(xa,{isPublic:k,onToggle:c,ariaLabel:_(z.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,X.jsx)(bn,{isDisabled:b,children:(0,X.jsx)(U,{testId:`stop-button`,onClick:r,isDisabled:b,children:(0,X.jsx)(W,{icon:(0,X.jsx)(tt,{width:16,height:16}),text:_(O)})})}),n&&(0,X.jsx)(U,{testId:`delete-button`,onClick:n,children:(0,X.jsx)(W,{icon:(0,X.jsx)(Pt,{width:16,height:16}),text:_(z.COMMON$DELETE_CONVERSATION)})})]});return A?typeof document>`u`||!C?null:ba.createPortal((0,X.jsx)(`div`,{style:C,children:j}),document.body):j}function Ca({onClose:e}){let{t}=h(`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)(Ge,{title:t(z.CONVERSATION$METRICS_INFO)})})]})}function wa({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:R(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function Ta({currentCost:e,maxBudget:t}){let{t:n}=h(`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(z.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(z.CONVERSATION$USED)})})})}function Ea({cost:e,maxBudgetPerTask:t}){let{t:n}=h(`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)(wa,{currentCost:e,maxBudget:t}),(0,X.jsx)(Ta,{currentCost:e,maxBudget:t})]}):(0,X.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(z.CONVERSATION$NO_BUDGET_LIMIT)})})}function Da({cost:e,maxBudgetPerTask:t}){let{t:n}=h(`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(z.CONVERSATION$TOTAL_COST)}),(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,X.jsx)(Ea,{cost:e,maxBudgetPerTask:t})]})}function Oa({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 ka({usage:e}){let{t}=h(`openhands`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Oa,{label:t(z.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(z.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(z.CONVERSATION$CACHE_WRITE)}),(0,X.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,X.jsx)(Oa,{label:t(z.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,X.jsx)(Oa,{label:t(z.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function Aa({perTurnToken:e,contextWindow:t}){let{t:n}=h(`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(z.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(z.CONVERSATION$USED),`)`]})})]})}function ja(){let{t:e}=h(`openhands`);return(0,X.jsx)(`div`,{className:`text-center`,children:(0,X.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(z.CONVERSATION$NO_METRICS)})})}function Ma(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 Na=(e,t,n,r=!0)=>{let i=b({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return Ma(await ut.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 Pa({isOpen:e,onOpenChange:t}){let n=Vn(),{data:r}=K(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=Na(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)(He,{onClose:()=>t(!1),children:(0,X.jsxs)(Ue,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,X.jsx)(Ca,{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)(Da,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ka,{usage:c.usage}),(0,X.jsx)(Aa,{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)(ja,{})})]})]})}):null}var Fa=new Set([`BrowserClickAction`,`BrowserCloseTabAction`,`BrowserGetContentAction`,`BrowserGetStateAction`,`BrowserGoBackAction`,`BrowserListTabsAction`,`BrowserNavigateAction`,`BrowserScrollAction`,`BrowserSwitchTabAction`,`BrowserTypeAction`,`ExecuteBashAction`,`FileEditorAction`,`GlobAction`,`GrepAction`,`InvokeSkillAction`,`MCPToolAction`,`StrReplaceEditorAction`,`TaskAction`,`TaskTrackerAction`,`TerminalAction`,`ThinkAction`]),Ia=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(),La=(e,t=100)=>e.length>t?`${e.slice(0,t)}…`:e,Ra=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString()},$=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`),za=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`),Ba=e=>Q(e||w.t(z.TRANSCRIPT_EXPORT$DEFAULT_TITLE))||w.t(z.TRANSCRIPT_EXPORT$DEFAULT_TITLE),Va=(e,t)=>Q(w.t(e,t).replace(/<\/?(?:cmd|path)>/g,``)),Ha=e=>/^[a-z][a-z0-9_]*\s*:\s*[[{]/i.test(e),Ua=e=>e.replace(/(?:Action|Observation)$/,``).replace(/([a-z])([A-Z])/g,`$1 $2`).trim(),Wa=e=>{let t=Q(e.summary||``);return t&&!Ha(t)?t:Q(e.tool_name)||Ua(e.action.kind)},Ga=(e,t)=>t?Wa(t):Q(e.tool_name)||Ua(e.observation.kind),Ka=e=>e.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
20
|
+
`)}`,g=p.length>0?`${r}\n\n${h}`:r,_=x({conversationId:B,text:r,content:g,imageUrls:u,fileUrls:p,timestamp:d});E(),n(``);try{await m(pe(g,u,p,d))}catch(e){S(_,e instanceof Error?e.message:w(z.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}};Z.useEffect(()=>{if(ye.current&&T.current){let{scrollHeight:e,scrollTop:t}=ye.current,n=T.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),ye.current=null;return}te&&E()},[g.length,Se,de,E]);let Me=Z.useRef(be);Z.useEffect(()=>{Me.current=be}),Z.useEffect(()=>{let e=T.current;e&&Me.current(e)},[g.length,_e]);let V={scrollRef:T,autoScroll:te,setAutoScroll:k,scrollDomToBottom:E,hitBottom:ee,setHitBottom:A,onChatBodyScroll:D},Ne=N===F.LOADING||N===F.INIT,Pe=N===F.STOPPED,Fe=N===F.PAUSED,Ie=se({isPausing:Fe,isTask:c,taskStatus:l,isStartingStatus:Ne,isStopStatus:Pe,curAgentState:N}),Le=ne({isPausing:Fe,isTask:c,taskStatus:l,taskDetail:u,isStartingStatus:Ne,isStopStatus:Pe,curAgentState:N,errorMessage:r,t:w});return(0,X.jsx)(De,{value:V,children:(0,X.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!y&&!Se&&!b&&!Ce&&!Ae&&!d&&v===0&&!re&&!oe&&(0,X.jsx)(Di,{onSuggestionsClick:e=>n(e)}),(0,X.jsxs)(`div`,{ref:T,"data-testid":`chat-scroll-container`,onScroll:e=>{D(e.currentTarget),be(e.currentTarget)},onWheel:xe,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:[Ae&&Oe&&(0,X.jsx)(Pi,{}),Ae&&!Oe&&(0,X.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,X.jsx)(ze,{size:`small`})}),ge&&(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)(ze,{size:`small`}),(0,X.jsx)(`span`,{children:w(z.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,X.jsx)(ke,{conversationId:B,anchorEventId:null}),Te&&g.length>0&&(0,X.jsx)(Ee,{messages:g,allEvents:_}),(0,X.jsx)(Ui,{}),(0,X.jsx)(Fr,{conversationId:B})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px] pb-4`,children:[(0,X.jsx)(Hi,{conversationId:B}),(0,X.jsx)(Pr,{conversationId:B}),r&&(0,X.jsx)(Ii,{message:r,code:i,onDismiss:a,onRetry:r===`Unable to connect to server`?()=>p?.reconnect():void 0,onReauth:kr(i)?()=>s(`/settings/agents`):void 0}),oe&&!re&&(0,X.jsx)(_n,{}),re?(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:w(L===`ERROR`?z.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:z.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,X.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:w(L===`ERROR`?z.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:z.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)(Ki,{}),Ne&&(0,X.jsx)(Ji,{statusColor:Ie,status:Le})]}),ee?N===F.RUNNING&&(0,X.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,X.jsx)(_i,{})}):(0,X.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,X.jsx)(ji,{onClick:E})})]})}),(0,X.jsx)(pi,{onSubmit:je,disabled:M||oe,hasStartedConversation:we})]})]})]})})}function Qi({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)(Zi,{})})})}function $i({children:e}){return(0,X.jsx)(`div`,{className:`absolute inset-0`,children:e})}function ea({children:e}){return(0,X.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function ta({children:e}){return(0,X.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}function na({className:e}){let{t}=h(`openhands`);return(0,X.jsxs)(`div`,{className:R(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,X.jsx)(Ie,{className:`h-8 w-8 shrink-0 animate-spin text-tertiary-light`,"aria-hidden":!0}),(0,X.jsx)(ye,{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(z.HOME$LOADING)})]})}function ra({children:e,onReady:t}){return(0,Z.useLayoutEffect)(()=>{t()},[t]),e}function ia({onPending:e}){return(0,Z.useLayoutEffect)(()=>{e()},[e]),(0,X.jsx)(na,{})}var aa={duration:.35,ease:`easeInOut`};function oa({showAgentLoading:e,tabKey:t,children:n}){let r=de(),[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)(na,{}):(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(ia,{onPending:o}),children:(0,X.jsx)(ra,{onReady:c,children:n})})}):(0,X.jsxs)(`div`,{className:`relative h-full w-full overflow-hidden`,children:[(0,X.jsx)(V.div,{className:`absolute inset-0 h-full w-full`,initial:!1,animate:{opacity:+!l},transition:aa,"aria-hidden":l,children:(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(ia,{onPending:o}),children:(0,X.jsx)(ra,{onReady:c,children:n})})}),(0,X.jsx)(s,{children:l?(0,X.jsx)(V.div,{className:`absolute inset-0 z-10 h-full w-full`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:aa,children:(0,X.jsx)(na,{})},`conversation-tab-loading-overlay`):null})]})}var sa=(0,Z.lazy)(()=>c(()=>import(`./files-tab-SAiFCnS5.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,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94]))),ca=(0,Z.lazy)(()=>c(()=>import(`./browser-tab-CEApjoEV.js`),__vite__mapDeps([95,2,1,11,5,6,18,3,4,7,14,10,15,12,9,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,96,97,91]))),la=(0,Z.lazy)(()=>c(()=>import(`./planner-tab-w6HT0N_A.js`),__vite__mapDeps([98,1,2,11,5,6,13,3,4,7,14,15,12,9,16,17,18,10,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,99,55,56,57,58,59,60,61,62,63,64,52,53,54,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91]))),ua=(0,Z.lazy)(()=>c(()=>import(`./task-list-tab-BmaTwjaS.js`),__vite__mapDeps([100,1,2,11,5,6,13,3,4,7,14,15,12,9,16,17,18,10,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,91]))),da=(0,Z.lazy)(()=>c(()=>import(`./terminal-BRcoba5B.js`),__vite__mapDeps([101,1,2,11,5,6,102,103,18,3,4,7,14,10,15,12,9,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,55,56,57,49,58,59,60,39,61,40,62,63,64,52,53,54,44,65,42,66,67,50,68,69,70,71,72,73,74,43,75,76,77,78,79,80,81,82,83,84,85,46,86,87,88,48,89,90,91]))),fa={tasklist:{component:ua},files:{component:sa},browser:{component:ca},terminal:{component:da},planner:{component:la}};function pa(){let{selectedTab:e,shouldShownAgentLoading:t}=H(),{conversationId:n}=q(),r=(0,Z.useMemo)(()=>fa[e]??fa.files,[e]).component,i=e===`terminal`?`${e}-${n}`:e??`files`;return(0,X.jsx)(ea,{children:(0,X.jsx)(ta,{children:(0,X.jsx)(oa,{showAgentLoading:t,tabKey:i,children:(0,X.jsx)($i,{children:(0,X.jsx)(r,{})},i)})})})}var ma=()=>{let e=m(),t=zn(e=>e.removeErrorMessage);return y({mutationKey:[`start-conversation`],mutationFn:async e=>ht(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)=>{_t(e,r.conversationId)},onSuccess:(n,r)=>{t(),gt(e,r.conversationId,te.RUNNING)}})},ha=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`})}),ga=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 _a({icon:e,text:t,onClick:n,testId:r}){return(0,X.jsx)(U,{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 va({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=G(),{isTask:i,taskStatus:a,taskDetail:o}=Jt(),{t:s}=h(`openhands`),{errorMessage:c}=zn(),l=r===F.LOADING||r===F.INIT,u=ce(t)||P(t),d=se({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=ne({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)(qi,{className:`w-6 h-6 shrink-0`,color:d}),(0,X.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function ya({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=h(`openhands`),c=jt(e),l=I(r),u=P(r),d=l||u;return(0,X.jsxs)(Nt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:R(`left-2 w-fit min-w-42`,a),children:[(0,X.jsx)(va,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nt,{inset:`menu`}),l&&t&&(0,X.jsx)(_a,{icon:(0,X.jsx)(ha,{width:18,height:18}),text:s(z.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,X.jsx)(_a,{icon:(0,X.jsx)(ga,{width:18,height:18}),text:s(z.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var ba=e(i(),1);function xa({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:R(`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:R(`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 Sa({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 g=$n(),{t:_}=h(`openhands`),{backend:v}=D(),{data:y}=K(),b=on(),x=jt(e),S=m?.current??null,[C,w]=Z.useState();Z.useLayoutEffect(()=>{if(!S)return;let e=()=>{let e=S.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,w(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[S,p]);let T=!!(a||o||s),E=!!i,ee=!!(r||n),O=v.kind===`cloud`?z.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:z.COMMON$STOP_CONVERSATION,te=v.kind===`cloud`&&!!c,k=y?.public||!1,A=!!S,j=(0,X.jsxs)(Nt,{ref:x,testId:`conversation-name-context-menu`,position:p,alignment:`left`,className:R(g?`right-0 translate-x-[34%] left-auto`:``,A?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,X.jsx)(U,{testId:`rename-button`,onClick:t,children:(0,X.jsx)(W,{icon:(0,X.jsx)(It,{width:16,height:16}),text:_(z.BUTTON$RENAME)})}),T&&(0,X.jsx)(nt,{testId:`separator-tools`,inset:`menu`}),o&&(0,X.jsx)(bn,{isDisabled:b,children:(0,X.jsx)(U,{testId:`show-skills-button`,onClick:o,isDisabled:b,children:(0,X.jsx)(W,{icon:(0,X.jsx)(Lt,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:_(z.CONVERSATION$SHOW_SKILLS)})})}),s&&(0,X.jsx)(bn,{isDisabled:b,children:(0,X.jsx)(U,{testId:`show-hooks-button`,onClick:s,isDisabled:b,children:(0,X.jsx)(W,{icon:(0,X.jsx)(Vt,{width:16,height:16,"aria-hidden":!0}),text:_(z.CONVERSATION$SHOW_HOOKS)})})}),a&&(0,X.jsx)(bn,{isDisabled:b,children:(0,X.jsx)(U,{testId:`show-agent-tools-button`,onClick:a,isDisabled:b,children:(0,X.jsx)(W,{icon:(0,X.jsx)($e,{width:16,height:16}),text:_(z.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})})}),u&&(0,X.jsx)(U,{testId:`export-transcript-button`,onClick:u,children:(0,X.jsx)(W,{icon:(0,X.jsx)(xt,{width:16,height:16}),text:_(z.BUTTON$EXPORT_TRANSCRIPT)})}),d&&(0,X.jsx)(U,{testId:`download-trajectory-button`,onClick:d,children:(0,X.jsx)(W,{icon:(0,X.jsx)(xt,{width:16,height:16}),text:_(z.BUTTON$DOWNLOAD_CONVERSATION_DATA)})}),(E||ee)&&(0,X.jsx)(nt,{testId:`separator-info-control`,inset:`menu`}),i&&(0,X.jsx)(U,{testId:`display-cost-button`,onClick:i,children:(0,X.jsx)(W,{icon:(0,X.jsx)(Ot,{width:16,height:16}),text:_(z.BUTTON$DISPLAY_COST)})}),te&&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)(nr,{size:16})}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:_(z.CONVERSATION$SHARE_PUBLICLY)}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[k&&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:_(z.BUTTON$COPY_TO_CLIPBOARD),children:(0,X.jsx)(zt,{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:_(z.BUTTON$OPEN_IN_NEW_TAB),children:(0,X.jsx)(Pe,{size:14,"aria-hidden":!0})})]}),(0,X.jsx)(xa,{isPublic:k,onToggle:c,ariaLabel:_(z.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,X.jsx)(bn,{isDisabled:b,children:(0,X.jsx)(U,{testId:`stop-button`,onClick:r,isDisabled:b,children:(0,X.jsx)(W,{icon:(0,X.jsx)(tt,{width:16,height:16}),text:_(O)})})}),n&&(0,X.jsx)(U,{testId:`delete-button`,onClick:n,children:(0,X.jsx)(W,{icon:(0,X.jsx)(Pt,{width:16,height:16}),text:_(z.COMMON$DELETE_CONVERSATION)})})]});return A?typeof document>`u`||!C?null:ba.createPortal((0,X.jsx)(`div`,{style:C,children:j}),document.body):j}function Ca({onClose:e}){let{t}=h(`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)(Ge,{title:t(z.CONVERSATION$METRICS_INFO)})})]})}function wa({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:R(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function Ta({currentCost:e,maxBudget:t}){let{t:n}=h(`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(z.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(z.CONVERSATION$USED)})})})}function Ea({cost:e,maxBudgetPerTask:t}){let{t:n}=h(`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)(wa,{currentCost:e,maxBudget:t}),(0,X.jsx)(Ta,{currentCost:e,maxBudget:t})]}):(0,X.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(z.CONVERSATION$NO_BUDGET_LIMIT)})})}function Da({cost:e,maxBudgetPerTask:t}){let{t:n}=h(`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(z.CONVERSATION$TOTAL_COST)}),(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,X.jsx)(Ea,{cost:e,maxBudgetPerTask:t})]})}function Oa({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 ka({usage:e}){let{t}=h(`openhands`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Oa,{label:t(z.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(z.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(z.CONVERSATION$CACHE_WRITE)}),(0,X.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,X.jsx)(Oa,{label:t(z.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,X.jsx)(Oa,{label:t(z.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function Aa({perTurnToken:e,contextWindow:t}){let{t:n}=h(`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(z.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(z.CONVERSATION$USED),`)`]})})]})}function ja(){let{t:e}=h(`openhands`);return(0,X.jsx)(`div`,{className:`text-center`,children:(0,X.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(z.CONVERSATION$NO_METRICS)})})}function Ma(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 Na=(e,t,n,r=!0)=>{let i=b({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return Ma(await ut.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 Pa({isOpen:e,onOpenChange:t}){let n=Vn(),{data:r}=K(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=Na(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)(He,{onClose:()=>t(!1),children:(0,X.jsxs)(Ue,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,X.jsx)(Ca,{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)(Da,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ka,{usage:c.usage}),(0,X.jsx)(Aa,{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)(ja,{})})]})]})}):null}var Fa=new Set([`BrowserClickAction`,`BrowserCloseTabAction`,`BrowserGetContentAction`,`BrowserGetStateAction`,`BrowserGoBackAction`,`BrowserListTabsAction`,`BrowserNavigateAction`,`BrowserScrollAction`,`BrowserSwitchTabAction`,`BrowserTypeAction`,`ExecuteBashAction`,`FileEditorAction`,`GlobAction`,`GrepAction`,`InvokeSkillAction`,`MCPToolAction`,`StrReplaceEditorAction`,`TaskAction`,`TaskTrackerAction`,`TerminalAction`,`ThinkAction`]),Ia=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(),La=(e,t=100)=>e.length>t?`${e.slice(0,t)}…`:e,Ra=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString()},$=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`),za=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`),Ba=e=>Q(e||w.t(z.TRANSCRIPT_EXPORT$DEFAULT_TITLE))||w.t(z.TRANSCRIPT_EXPORT$DEFAULT_TITLE),Va=(e,t)=>Q(w.t(e,t).replace(/<\/?(?:cmd|path)>/g,``)),Ha=e=>/^[a-z][a-z0-9_]*\s*:\s*[[{]/i.test(e),Ua=e=>e.replace(/(?:Action|Observation)$/,``).replace(/([a-z])([A-Z])/g,`$1 $2`).trim(),Wa=e=>{let t=Q(e.summary||``);return t&&!Ha(t)?t:Q(e.tool_name)||Ua(e.action.kind)},Ga=(e,t)=>t?Wa(t):Q(e.tool_name)||Ua(e.observation.kind),Ka=e=>e.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
21
21
|
`),qa=e=>[`${w.t(z.TASK$SUBAGENT)}: ${e.subagent_type}`,`${w.t(z.TASK$QUERY)}:\n${e.prompt}`].join(`
|
|
22
22
|
|
|
23
23
|
`),Ja=(e,t)=>{let n=t?.action.kind===`TaskAction`?t.action:void 0;return[`${w.t(z.TASK$SUBAGENT)}: ${e.subagent}`,`${w.t(z.TASK$TASK_ID)}: ${e.task_id}`,n?`${w.t(z.TASK$QUERY)}:\n${n.prompt}`:``,`${w.t(z.TASK$RESULT)}:\n${Ka(e.content)}`].filter(Boolean).join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./conversation-CObLYSJd.js";export{e as default};
|
package/build/assets/{conversation-state-store-BORusMiV.js → conversation-state-store-DTq4hFoP.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-Cyuzqnbw.js";import{St as e,yt as t}from"./vendor-styling-Bcgpimp9.js";import{_ as n,c as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{D as i,I as a,K as o,O as s}from"./active-backend-context-
|
|
1
|
+
import"./rolldown-runtime-Cyuzqnbw.js";import{St as e,yt as t}from"./vendor-styling-Bcgpimp9.js";import{_ as n,c as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{D as i,I as a,K as o,O as s}from"./active-backend-context-BlZPzZNU.js";import{a as c,i as l}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-Bw4AuHN1.js";import{f as u}from"./conversation-store-C6hSXHw0.js";import{o as d,p as f,s as p,t as m,u as h}from"./agent-server-conversation-service.api-Btmi4q6d.js";var g=async e=>{let t=(await m.batchGetAppConversations([e]))[0];if(!t)throw Error(`V1 conversation not found: ${e}`);return{conversationUrl:t.conversation_url,sessionApiKey:t.session_api_key,sandboxId:t.sandbox_id}},_=async e=>{let{conversationUrl:t,sessionApiKey:r,sandboxId:o}=await g(e);if(a().backend.kind===`cloud`){if(!o)throw Error(`Cannot stop runtime: cloud conversation ${e} has no sandbox_id.`);return await p(o),{success:!0}}return new n(i({conversationUrl:t,sessionApiKey:r})).interruptConversation(e)},v=async(e,t)=>{let{conversationUrl:r,sessionApiKey:a}=await g(e);return new n(i({conversationUrl:r,sessionApiKey:a})).askAgent(e,t)},y=async(e,t)=>{let{conversationUrl:r,sessionApiKey:a}=await g(e);await new n(i({conversationUrl:r,sessionApiKey:a})).startGoal(e,t)},b=async e=>{let{conversationUrl:t,sessionApiKey:r}=await g(e);await new n(i({conversationUrl:t,sessionApiKey:r})).stopGoal(e)},x=async e=>{let{conversationUrl:t,sessionApiKey:r}=await g(e);await new n(i({conversationUrl:t,sessionApiKey:r})).resumeGoal(e)},S=async e=>{let{conversationUrl:t,sessionApiKey:r}=await g(e);return new n(i({conversationUrl:t,sessionApiKey:r})).runConversation(e)},C=(e,t,n)=>{e.setQueriesData({queryKey:[`user`,`conversation`,t]},e=>e&&{...e,...n}),e.setQueriesData({queryKey:[`user`,`conversations`]},e=>e&&{...e,pages:e.pages.map(e=>({...e,items:e.items.map(e=>e.id===t?{...e,...n}:e)}))})},w=(e,t,n)=>C(e,t,{execution_status:n}),T=(e,t,n)=>C(e,t,{llm_model:n}),E=(e,t)=>{e.invalidateQueries({queryKey:[`user`,`conversation`,t]}),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`v1-batch-get-app-conversations`]}),e.invalidateQueries({queryKey:[`unified`,`vscode_url`]})},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 O(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 k(e,t={}){return f(e,t)}async function A(e,t,n={}){let r=O(e);return`${(await k(t,n)).replace(/[/\\]+$/,``)}/${r}`}async function j(e,t){if(t?.id===e&&t.workspace?.working_dir?.trim())return t.workspace.working_dir.trim();let n=h(e);return n?.selected_workspace?.trim()?n.selected_workspace.trim():D.test(e)?m.resolveConversationWorkingDir(e):o()}var M=5;async function N(e,t){if(t?.id===e&&t.conversation_url?.trim()&&t.session_api_key?.trim())return{conversationUrl:t.conversation_url.trim(),sessionApiKey:t.session_api_key.trim()};if(a().backend.kind===`cloud`){let[t]=await d([e]);return{conversationUrl:t?.conversation_url?.trim()??null,sessionApiKey:t?.session_api_key?.trim()??null}}return{conversationUrl:null,sessionApiKey:null}}function P(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 F(e,t,n){let r=await j(e,n),i=await N(e,n),o=a().backend.kind===`cloud`,s=n?.id===e?n.session_api_key??i.sessionApiKey:i.sessionApiKey,c=n?.id===e?n.conversation_url??i.conversationUrl:i.conversationUrl;if(o){let e=P({conversationUrl:c,sessionApiKey:s});return I({files:t,workingDir:r,conversationUrl:e.conversationUrl,sessionApiKey:e.sessionApiKey})}return I({files:t,workingDir:r,conversationUrl:c,sessionApiKey:s})}async function I(e){let{files:t,workingDir:n,conversationUrl:r,sessionApiKey:a}=e,o=new l(i({conversationUrl:r,sessionApiKey:a,workingDir:n})),s=async e=>{try{let t=O(e.name),i=await A(e.name,n,{conversationUrl:r,sessionApiKey:a});return await o.fileUpload(e,i),{uploadedFile:t,skippedFile:null}}catch(t){return{uploadedFile:null,skippedFile:{name:e.name,reason:t instanceof Error?t.message:`Upload failed`}}}},c=[];for(let e=0;e<t.length;e+=M){let n=t.slice(e,e+M);c.push(...await Promise.all(n.map(s)))}return{uploaded_files:c.flatMap(e=>e.uploadedFile?[e.uploadedFile]:[]),skipped_files:c.flatMap(e=>e.skippedFile?[e.skippedFile]:[])}}var L=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(e){let t=this.currentConversation?.id===e?this.currentConversation?.workspace?.working_dir??o():o();return{vscode_url:await new r(i(this.getClientOverrides())).getUrl({baseUrl:typeof window<`u`?window.location.origin:void 0,workspaceDir:t})}}static async getTrajectory(e){return{trajectory:(await new c(s(this.getClientOverrides()),e).search({limit:1e4})).items??[]}}static async uploadFiles(e,t){return F(e,t,this.currentConversation)}};e();var R=t(),z=e=>(0,R.jsx)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,R.jsx)(`path`,{d:`M21.0004 6.00001C21.0016 5.43668 20.8441 4.88442 20.5459 4.40644C20.2478 3.92846 19.8212 3.54406 19.3148 3.29726C18.8084 3.05046 18.2428 2.95122 17.6826 3.0109C17.1224 3.07059 16.5904 3.28678 16.1474 3.63473C15.7044 3.98269 15.3683 4.44835 15.1776 4.97841C14.9869 5.50848 14.9493 6.08152 15.0691 6.63197C15.1888 7.18241 15.4612 7.688 15.8549 8.09088C16.2487 8.49375 16.7479 8.77762 17.2954 8.91001V10.5C17.2978 10.6372 17.261 10.7722 17.1892 10.8891C17.1175 11.006 17.0138 11.1 16.8904 11.16L12.7354 13.32L8.59544 11.22C8.46356 11.1544 8.35443 11.0507 8.28221 10.9223C8.21 10.7939 8.17802 10.6468 8.19044 10.5V8.91001C8.89743 8.72746 9.51358 8.29333 9.92339 7.689C10.3332 7.08467 10.5085 6.35161 10.4165 5.62725C10.3245 4.90289 9.97149 4.23695 9.42361 3.75426C8.87573 3.27157 8.17062 3.00527 7.44044 3.00527C6.71026 3.00527 6.00514 3.27157 5.45726 3.75426C4.90938 4.23695 4.55635 4.90289 4.46435 5.62725C4.37234 6.35161 4.54768 7.08467 4.95749 7.689C5.36729 8.29333 5.98344 8.72746 6.69044 8.91001V10.5C6.6913 10.9156 6.80651 11.323 7.02346 11.6776C7.24041 12.0321 7.55073 12.3201 7.92044 12.51L12.0004 14.61V16.59C11.2934 16.7726 10.6773 17.2067 10.2675 17.811C9.85768 18.4153 9.68234 19.1484 9.77435 19.8728C9.86635 20.5971 10.2194 21.2631 10.7673 21.7457C11.3151 22.2284 12.0203 22.4947 12.7504 22.4947C13.4806 22.4947 14.1857 22.2284 14.7336 21.7457C15.2815 21.2631 15.6345 20.5971 15.7265 19.8728C15.8185 19.1484 15.6432 18.4153 15.2334 17.811C14.8236 17.2067 14.2074 16.7726 13.5004 16.59V14.61L17.5504 12.57C17.9317 12.3784 18.2501 12.0816 18.468 11.7148C18.686 11.348 18.7944 10.9265 18.7804 10.5V8.88001C19.4147 8.70922 19.9755 8.33496 20.3765 7.81469C20.7776 7.29442 20.9967 6.6569 21.0004 6.00001ZM6.00044 6.00001C6.00044 5.60218 6.15847 5.22065 6.43978 4.93934C6.72108 4.65804 7.10261 4.5 7.50044 4.5C7.89826 4.5 8.27979 4.65804 8.5611 4.93934C8.8424 5.22065 9.00044 5.60218 9.00044 6.00001C9.00044 6.39783 8.8424 6.77936 8.5611 7.06067C8.27979 7.34197 7.89826 7.50001 7.50044 7.50001C7.10261 7.50001 6.72108 7.34197 6.43978 7.06067C6.15847 6.77936 6.00044 6.39783 6.00044 6.00001ZM14.2054 19.5C14.2054 19.8978 14.0474 20.2794 13.7661 20.5607C13.4848 20.842 13.1033 21 12.7054 21C12.3076 21 11.9261 20.842 11.6448 20.5607C11.3635 20.2794 11.2054 19.8978 11.2054 19.5C11.2054 19.1022 11.3635 18.7207 11.6448 18.4393C11.9261 18.158 12.3076 18 12.7054 18C13.1033 18 13.4848 18.158 13.7661 18.4393C14.0474 18.7207 14.2054 19.1022 14.2054 19.5ZM18.0004 7.50001C17.6026 7.50001 17.2211 7.34197 16.9398 7.06067C16.6585 6.77936 16.5004 6.39783 16.5004 6.00001C16.5004 5.60218 16.6585 5.22065 16.9398 4.93934C17.2211 4.65804 17.6026 4.5 18.0004 4.5C18.3983 4.5 18.7798 4.65804 19.0611 4.93934C19.3424 5.22065 19.5004 5.60218 19.5004 6.00001C19.5004 6.39783 19.3424 6.77936 19.0611 7.06067C18.7798 7.34197 18.3983 7.50001 18.0004 7.50001Z`,fill:`currentColor`})}),B=e=>{let t=e.match(/^\/workspace\/[^/]+\/(.*)$/);return t?t[1]:e},V=e=>{let t=e.trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);if(!n||/^[A-Za-z]:$/.test(n))return``;let r=Math.max(n.lastIndexOf(`/`),n.lastIndexOf(`\\`));return r>=0?n.slice(r+1):n},H=u(e=>({execution_status:null,setExecutionStatus:t=>e({execution_status:t}),reset:()=>e({execution_status:null})}));export{T as _,L as a,v as c,_ as d,S as f,w as g,b as h,z as i,E as l,y as m,V as n,N as o,x as p,B as r,F as s,H as t,C as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-BUDJnBg4.js","assets/vendor~browser-CIoZCqGs.js","assets/vendor~browser-jaN4ilxM.js","assets/llm-subscription-DTqtBCWz.js","assets/utils-qjs_KuS4.js","assets/vendor-styling-Bcgpimp9.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/settings-Chfn5xTD.js","assets/automation-BGP_I1RR.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,xt as n,yt as r}from"./vendor-styling-Bcgpimp9.js";import{n as i}from"./vendor~entry.client-BfviqoVc.js";import{t as a}from"./vendor~entry.client-Di4qO77Y.js";import{n as o,t as s}from"./providers-
|
|
2
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,xt as n,yt as r}from"./vendor-styling-Bcgpimp9.js";import{n as i}from"./vendor~entry.client-BfviqoVc.js";import{t as a}from"./vendor~entry.client-Di4qO77Y.js";import{n as o,t as s}from"./providers-9UzRB9mT.js";import{vt as c}from"./active-backend-context-BlZPzZNU.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-BUDJnBg4.js`);return{worker:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));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{yt as e}from"./vendor-styling-Bcgpimp9.js";import{U as t,p as n}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as r}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{r as i,z as a}from"./active-backend-context-
|
|
1
|
+
import{yt as e}from"./vendor-styling-Bcgpimp9.js";import{U as t,p as n}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f9xdmd0z-DLMP7bZx.js";import{t as r}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{r as i,z as a}from"./active-backend-context-BlZPzZNU.js";import{t as o,z as s}from"./utils-qjs_KuS4.js";import{t as c}from"./external-link-Cnnd6ikC.js";import{a as l,f as u,o as d,u as f}from"./sidebar-layout-DXHtbEj1.js";import{t as p}from"./sidebar-nav-link-pvUivfK2.js";import{r as m}from"./typography-C6fuRTTT.js";import{t as h}from"./use-breakpoint-DA7JqsRN.js";import{t as g}from"./backend-synced-settings-badge-BNpEylNP.js";import{t as _}from"./extensions-navigation-DF24q1H1.js";var v=e(),y=`/skills`,b=`/plugins`;function x(){let{t:e}=r(`openhands`),{active:t}=i(),{backend:n}=t,h=!a(n)&&n.kind===`cloud`;return(0,v.jsxs)(`div`,{"data-testid":`extensions-mobile-hub`,className:`flex flex-col gap-4 px-4 py-2 md:hidden`,children:[(0,v.jsx)(m.H2,{children:e(s.NAV$CUSTOMIZE)}),(0,v.jsx)(`nav`,{className:`flex flex-col gap-0.5`,children:_.filter(e=>!(e.to===b&&h)).map(t=>{if(t.to===y&&h){let r=`${n.host.replace(/\/+$/,``)}/settings/skills`;return(0,v.jsxs)(`a`,{"data-testid":`sidebar-extensions-${t.to}`,href:r,target:`_blank`,rel:`noopener noreferrer`,className:o(u({collapsed:!1}),d.idle),children:[(0,v.jsx)(`span`,{className:l,children:t.icon}),(0,v.jsx)(`span`,{className:o(f(!1),`flex-1`),children:e(s.SIDEBAR$SKILLS_AND_PLUGINS_CLOUD_LINK)}),(0,v.jsx)(c,{className:`size-4 shrink-0 text-[var(--oh-muted)]`,"aria-hidden":!0})]},t.to)}return(0,v.jsx)(p,{to:t.to,label:t.label,end:t.end,testId:`sidebar-extensions-${t.to}`,icon:t.icon,disabled:t.comingSoon},t.to)})}),(0,v.jsx)(`div`,{className:`pt-1`,children:(0,v.jsx)(g,{})})]})}var S=t(function(){return h(768)?(0,v.jsx)(x,{}):(0,v.jsx)(n,{to:`/skills`,replace:!0})});export{S as default};
|
package/build/assets/{extensions-navigation-CYjIM65d.js → extensions-navigation-DF24q1H1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-Cyuzqnbw.js";import{St as e,yt as t}from"./vendor-styling-Bcgpimp9.js";import{t as n}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{r,z as i}from"./active-backend-context-
|
|
1
|
+
import"./rolldown-runtime-Cyuzqnbw.js";import{St as e,yt as t}from"./vendor-styling-Bcgpimp9.js";import{t as n}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{r,z as i}from"./active-backend-context-BlZPzZNU.js";import{t as a,z as o}from"./utils-qjs_KuS4.js";import{t as s}from"./external-link-Cnnd6ikC.js";import{t as c}from"./navigation-link-Bxmn-pCs.js";import{f as l,o as u}from"./sidebar-layout-DXHtbEj1.js";import{t as d}from"./skills-CYFLsN5U.js";import{t as f}from"./backend-synced-settings-badge-BNpEylNP.js";e();var p=t(),m=e=>(0,p.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,p.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`})}),h=`/skills`,g=`/plugins`,_=[{to:`/skills`,label:`Skills`,icon:(0,p.jsx)(d,{width:16,height:16,"aria-hidden":`true`}),end:!0},{to:`/mcp`,label:`MCP Servers`,icon:(0,p.jsx)(m,{width:16,height:16}),end:!0},{to:`/plugins`,label:`Plugins`,icon:(0,p.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,p.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,p.jsx)(`path`,{d:`m3.3 7 8.7 5 8.7-5`}),(0,p.jsx)(`path`,{d:`M12 22V12`})]}),end:!0}];function v(){let{t:e}=n(`openhands`),{active:t}=r(),{backend:d}=t,m=!i(d)&&d.kind===`cloud`;return(0,p.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,p.jsx)(`span`,{className:`px-2 text-sm font-normal text-white`,children:e(o.NAV$CUSTOMIZE)}),(0,p.jsx)(`div`,{className:`flex flex-col gap-0.5 pt-0.5`,children:_.filter(e=>!(e.to===g&&m)).map(t=>{let n=t.to===h&&m,r=(0,p.jsx)(`span`,{className:`shrink-0 flex items-center justify-center`,children:t.icon}),i=(0,p.jsx)(`span`,{className:`truncate`,children:n?e(o.SIDEBAR$SKILLS_AND_PLUGINS_CLOUD_LINK):t.label}),f=t.comingSoon&&(0,p.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(o.NAV$COMING_SOON)});if(n){let e=`${d.host.replace(/\/+$/,``)}/settings/skills`;return(0,p.jsxs)(`a`,{"data-testid":`sidebar-extensions-${t.to}`,href:e,target:`_blank`,rel:`noopener noreferrer`,className:a(l(),`truncate`,u.idle),children:[r,i,(0,p.jsx)(s,{className:`ml-auto size-4 shrink-0 text-[var(--oh-muted)]`,"aria-hidden":!0})]},t.to)}return(0,p.jsxs)(c,{to:t.to,end:t.end,"data-testid":`sidebar-extensions-${t.to}`,className:({isActive:e})=>a(l(),`truncate`,e?u.active:u.idle),children:[r,i,f]},t.to)})}),(0,p.jsx)(`div`,{className:`px-2 pt-3`,children:(0,p.jsx)(f,{})})]})}export{v as n,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{n as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js";import{t as i}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{A as a,g as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{t as s}from"./useQuery-B38jBavx.js";import{A as c,C as l,D as u,I as d,V as f,n as p,st as m}from"./active-backend-context-B9942JGX.js";import{E as h,t as g,z as _}from"./utils-qjs_KuS4.js";import{r as v,u as y}from"./messages-CYztjKLQ.js";import{r as b}from"./conversation-DceG4LFS.js";import{a as x,c as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k}from"./vendor~files-tab-vm3f67Pz.js";import{n as A,t as j}from"./format-time-delta-DuhE50B-.js";import{i as M}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-Bw4AuHN1.js";import{t as N}from"./proxy-CN3HaaOW.js";import{s as P}from"./git-provider-icon-DeQUgZVE.js";import{c as ee,f as te}from"./conversation-store-C6hSXHw0.js";import{t as ne}from"./segmented-toggle-DbbD3Tve.js";import{c as re,u as ie}from"./agent-server-conversation-service.api-D7qh9amG.js";import{r as ae}from"./typography-C6fuRTTT.js";import{_ as F}from"./llm-not-configured-banner-znJFsW_O.js";import{G as oe,J as se,K as I,h as L,q as R,t as ce,x as le}from"./markdown-renderer-Dkmjmx_d.js";import{t as ue}from"./link-external-BDBCz-_z.js";import{n as de,t as fe}from"./highlighted-source-view-suUKd5if.js";import{t as z}from"./conversation-tab-empty-state-BCMHkGQk.js";var B=e(t(),1),V=n();function pe(){let{t:e}=i(`openhands`);return(0,V.jsx)(z,{className:`h-full`,icon:(0,V.jsx)(A,{"aria-hidden":!0,strokeWidth:2,className:`size-full`}),children:e(_.FILES$NO_FILE_SELECTED)})}var me=class{static async executeCommand(e,t,n,r,i=30){let a=d().backend;if(a.kind===`cloud`&&e){let o=await N({backend:a,method:`POST`,hostOverride:c(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 M(u({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=d().backend;return r.kind===`cloud`&&e?(await N({backend:r,method:`GET`,hostOverride:c(e),path:`/api/file/download?path=${encodeURIComponent(n)}`,authMode:`session-api-key`,sessionApiKey:t,responseType:`blob`})).arrayBuffer():new o(u({conversationUrl:e,sessionApiKey:t})).downloadFile(n)}};function H(e){return e.startsWith(`/`)?e:`/${e}`}async function U(e,t,n,r){let i=d().backend;if(i.kind===`cloud`&&e){let a=new URLSearchParams({...r,path:H(r.path)});return N({backend:i,method:`GET`,hostOverride:c(e),path:`${n}?${a.toString()}`,authMode:`session-api-key`,sessionApiKey:t??void 0})}return(await new M(u({conversationUrl:e,sessionApiKey:t})).client.get(n,{params:r})).data}function he(e){return l(e,404)||a(e)&&e.response?.status===404}var W=class{static async getGitChanges(e,t,n,r){let i=d().backend;if(i.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,H(r));let n=await N({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:P(String(e.status)),path:e.path}))}let a=await new M(u({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:P(String(e.status)),path:e.path}))}static async getGitCommits(e,t,n,r=50){try{let i=await U(e,t,`/api/git/commits`,{path:n,limit:String(r)});return{commits:(i?.commits??[]).map(e=>({sha:e.sha,shortSha:e.short_sha,subject:e.subject,author:e.author,timestamp:e.timestamp})),hasMore:!!i?.has_more}}catch(e){if(he(e))return null;throw e}}static async getCommitChanges(e,t,n,r){let i=await U(e,t,`/api/git/commits/${encodeURIComponent(r)}/changes`,{path:n});if(!Array.isArray(i))throw Error(`Invalid response from runtime - runtime may be unavailable`);return i.map(e=>({status:P(String(e.status)),path:e.path}))}static async getGitChangeDiff(e,t,n,r,i){if(i){let e=await U(t,n,`/api/git/diff`,{path:r,commit:i});return{modified:e?.modified??``,original:e?.original??``,...e?.diff?{diff:e.diff}:{}}}let a=d().backend;if(a.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,H(r));let n=await N({backend:a,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 o=await new M(u({conversationUrl:t,sessionApiKey:n})).gitDiff(r);return{modified:o.modified??``,original:o.original??``,...o.diff?{diff:o.diff}:{}}}};function G(e,t){let n=t?.trim();if(n)return n;if(!e)return f;let r=e.split(`/`);return`${f}/${r[r.length-1]}`}var K=()=>{let{conversationId:e}=R(),{data:t}=I(),[n,r]=B.useState([]),i=B.useRef(null),a=b(),o=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),d=B.useMemo(()=>G(l,u),[l,u]),f=s({queryKey:[`file_changes`,e,o,c,d],queryFn:async()=>{if(!e)throw Error(`No conversation ID`);return W.getGitChanges(e,o,c,d)},retry:!1,staleTime:1e3*60*5,gcTime:1e3*60*15,refetchOnMount:`always`,enabled:a&&!!e,meta:{disableToast:!0}});return B.useEffect(()=>{if(!f.isFetching&&f.isSuccess&&f.data){let e=f.data;if(e!==i.current)if(i.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}},q=2e3,ge=[`.git`,`node_modules`,`.venv`,`venv`,`__pycache__`,`dist`,`build`,`.next`,`.cache`,`.pytest_cache`,`.mypy_cache`,`.turbo`,`.parcel-cache`,`target`];function _e(){return`find . \\( ${ge.map(e=>`-name '${e}' -prune`).join(` -o `)} \\) -o -type f -print 2>/dev/null | sort | head -n ${q}`}function ve(e){return e.startsWith(`./`)?e.slice(2):e}function ye(e){let{data:t}=I(),n=b(),r=t?.id,i=t?.conversation_url,a=t?.session_api_key,o=t?.workspace?.working_dir?.trim(),c=s({queryKey:[`workspace-files`,r,i,a,o],queryFn:async()=>{let e=await me.executeCommand(i,a,_e(),o,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(ve);return Array.from(new Set(t)).slice(0,q)},enabled:e&&n&&!!r&&!!o,retry:!1,staleTime:1e3*30,gcTime:1e3*60*5,meta:{disableToast:!0}});return{data:c.data,isLoading:c.isLoading}}function be(e){let t=K(),n=(0,B.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,q)},[e,t.data]);return{data:e?n:void 0,isLoading:e?t.isLoading:!1}}function xe(){let{backend:e}=p(),t=e.kind===`cloud`,n=ye(!t),r=be(t);return t?r:n}function Se(){let{data:e}=I(),t=b(),n=e?.id,r=e?.conversation_url,i=e?.session_api_key,a=d().backend.kind===`local`,o=s({queryKey:[`workspace-session`,n,r,i],queryFn:async()=>({baseUrl:await new M(u({conversationUrl:r,sessionApiKey:i})).startWorkspaceSession(n)}),enabled:t&&!!n&&a,staleTime:1/0,gcTime:1/0,retry:!1});return{data:o.data??null,isLoading:o.isLoading,isError:o.isError,error:o.error??null}}function Ce(e,t){let n=(t??``).replace(/^\/+/,``);return n?`${e}${n.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`:e}var J=te(e=>({count:0,bump:()=>e(e=>({count:e.count+1}))}));function we(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 Y(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function De(e){switch(Y(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=Y(e);return Te.has(t)?`image`:Ee.has(t)?`pdf`:`text`}function ke(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 X(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 Ae(e){let{data:t}=I(),n=b(),{data:r}=Se(),i=J(e=>e.count),a=t?.id,o=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),f=r?.baseUrl,p=d().backend.kind===`cloud`,m=G(l,u),h=m.startsWith(`/`)?m:`/${m}`,g=e?`${h}/${e}`:null;return s({queryKey:[`workspace-file-content`,a,o,c,p?`cloud`:f,e,g,i],queryFn:async()=>{if(!e)throw Error(`No path`);let t=Oe(e),n=De(e);if(p){let r=await re(a,g);if(t===`text`){let t=new TextEncoder().encode(r);return ke(t.buffer)?{path:e,kind:`binary`,text:null,staticUrl:`data:application/octet-stream;base64,${X(t.buffer)}`,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:r,staticUrl:`data:${n};charset=utf-8;base64,${X(t.buffer)}`,mimeType:n}}return{path:e,kind:t,text:null,staticUrl:`data:${n};base64,${X(new TextEncoder().encode(r).buffer)}`,mimeType:n}}if(!f)throw Error(`No workspace session`);let r=Ce(f,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 o=await i.arrayBuffer();return ke(o)?{path:e,kind:`binary`,text:null,staticUrl:r,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:new TextDecoder(`utf-8`,{fatal:!1}).decode(o),staticUrl:r,mimeType:n}},enabled:n&&!!a&&!!e&&(p||!!f),retry:!1,staleTime:1e3*5,gcTime:1e3*60,meta:{disableToast:!0}})}function je(){let{data:e,isLoading:t}=I(),n=e?.id?ie(e.id):null;return{hasAttachedSource:!!e?.selected_repository||!!n?.selected_workspace,isLoading:t}}function Me(e){let{data:t}=I(),n=b(),{backend:r}=p(),i=r.kind===`local`,a=t?.id,o=t?.conversation_url,c=t?.session_api_key,l=t?.workspace?.working_dir?.trim(),u=(e?.enabled??!0)&&i&&n&&!!a&&!!l,d=s({queryKey:[`has-git-commits`,a,o,c,l],queryFn:async()=>(await me.executeCommand(o,c,`git rev-parse --verify HEAD`,l,10)).exit_code===0,enabled:u,retry:!1,staleTime:6e4,gcTime:5*6e4,meta:{disableToast:!0}});return{hasCommits:d.data??null,isLoading:d.isLoading}}var Ne=new Set([`FileEditorObservation`,`StrReplaceEditorObservation`,`PlanningFileEditorObservation`]),Pe=new Set([`view`]),Fe=new Set([`ExecuteBashObservation`,`TerminalObservation`]);function Ie(e){let t=e.observation;return!(!t||typeof t.kind!=`string`||!Ne.has(t.kind)||t.command&&Pe.has(t.command))}function Le(e){let t=e.observation;return!!t&&typeof t.kind==`string`&&Fe.has(t.kind)}function Re(){let e=r(),t=le(e=>e.events),n=J(e=>e.bump),i=(0,B.useRef)(new Set),a=(0,B.useRef)(new WeakSet);(0,B.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),Ie(e)?r=!0:Le(e)&&(o=!0))}!r&&!o||(e.invalidateQueries({queryKey:[`file_changes`]}),e.invalidateQueries({queryKey:[`file_diff`]}),e.invalidateQueries({queryKey:[`git_commits`]}),r&&(e.invalidateQueries({queryKey:[`workspace-files`]}),e.invalidateQueries({queryKey:[`workspace-file-content`]}),n()))},[t,e,n])}var ze=[`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`],Be=[`license`,`license.md`,`license.txt`,`changelog.md`,`agents.md`,`tsconfig.json`,`.env.sample`,`.env.example`];function Ve(e){let t=e.lastIndexOf(`/`);return(t===-1?e:e.slice(t+1)).toLowerCase()}function He(e){return e.split(`/`).filter(Boolean).length-1}function Ue(e){let t=Ve(e),n=ze.indexOf(t);if(n!==-1)return n;let r=Be.indexOf(t);return r===-1?1e4:1e3+r}function We(e){return[...e].sort((e,t)=>{let n=He(e)-He(t);if(n!==0)return n;let r=Ue(e)-Ue(t);return r===0?e.localeCompare(t):r})}function Ge({paths:e,selectedPath:t,onSelectFile:n,isTreeVisible:r,onToggleTree:a}){let{t:o}=i(`openhands`),s=(0,B.useMemo)(()=>We(e),[e]);return(0,V.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,V.jsx)(`button`,{type:`button`,onClick:a,"data-testid":`file-quick-row-tree-toggle`,"aria-pressed":r,"aria-label":o(r?_.FILES$HIDE_FILE_TREE:_.FILES$SHOW_FILE_TREE),title:o(r?_.FILES$HIDE_FILE_TREE:_.FILES$SHOW_FILE_TREE),className:g(`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,V.jsx)(w,{className:`w-3 h-3`,"aria-hidden":!0,strokeWidth:2})}),s.length>0&&(0,V.jsx)(`div`,{className:`flex flex-nowrap items-center gap-1.5 overflow-hidden flex-1 min-w-0`,children:s.map(e=>{let r=t===e;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:e,"data-testid":`file-quick-row-item-${e}`,className:g(`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)})})]})}var Ke=new Set([`html`,`htm`,`svg`]),qe=new Set([`md`,`markdown`,`mdx`]),Je={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}=i(`openhands`),n=Je[Z(e)];return(0,V.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(_.FILES$UNSUPPORTED_DOCUMENT,{type:n}):t(_.FILES$BINARY_FALLBACK)})}function Ye({path:e,viewMode:t}){let{t:n}=i(`openhands`),r=Ae(e),a=J(e=>e.count);if(r.isLoading)return(0,V.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,children:n(_.FILES$LOADING_FILES)});if(r.isError||!r.data)return(0,V.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(_.FILES$LOAD_ERROR)});let{kind:o,text:s,staticUrl:c,mimeType:l}=r.data,u=we(c,a);return t===`plain`?o===`text`&&s!==null?(0,V.jsx)(fe,{path:e,text:s,mimeType:l??void 0}):(0,V.jsx)(Q,{path:e}):o===`image`?(0,V.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,V.jsx)(`img`,{src:u,alt:e,className:`max-h-full max-w-full object-contain`})}):o===`pdf`?(0,V.jsx)(`iframe`,{title:e,src:u,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):o===`binary`?(0,V.jsx)(Q,{path:e}):l===`text/html`||Ke.has(Z(e))?(0,V.jsx)(`iframe`,{title:e,src:u,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):o===`text`&&qe.has(Z(e))?(0,V.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,V.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,V.jsx)(ce,{content:s??``,includeStandard:!0,includeHeadings:!0})})}):o===`text`&&s!==null?(0,V.jsx)(fe,{path:e,text:s,mimeType:l??void 0}):(0,V.jsx)(Q,{path:e})}var Xe=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 13 15`,fill:`none`,...e,children:(0,V.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`})}),Ze=()=>{let{conversationId:e}=R(),{data:t}=I(),n=b(),r=t?.conversation_url,i=t?.session_api_key,a=t?.selected_repository,o=t?.workspace?.working_dir?.trim(),c=B.useMemo(()=>G(a,o),[a,o]),l=s({queryKey:[`git_commits`,e,r,i,c],queryFn:async()=>{if(!e)throw Error(`No conversation ID`);return W.getGitCommits(r,i,c,50)},retry:!1,staleTime:1e3*60*5,gcTime:1e3*60*15,refetchOnMount:`always`,enabled:n&&!!e,meta:{disableToast:!0}});return{commits:l.data?.commits??[],hasMore:l.data?.hasMore??!1,isUnsupported:l.data===null,isLoading:l.isLoading,isFetching:l.isFetching,isSuccess:l.isSuccess,isError:l.isError}},Qe=e=>(0,V.jsx)(`svg`,{width:13,height:8,viewBox:`0 0 13 8`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,V.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`})}),$e=e=>{let{conversationId:t}=R(),{data:n}=I(),r=n?.conversation_url,i=n?.session_api_key,a=n?.selected_repository,o=n?.workspace?.working_dir?.trim(),c=B.useMemo(()=>`${G(a,o)}/${e.filePath}`,[a,e.filePath,o]),l=e.type===`D`;return s({queryKey:e.commit?[`commit_file_diff`,t,r,i,e.commit,c]:[`file_diff`,t,r,i,c],queryFn:async()=>{if(!t)throw Error(`No conversation ID`);return W.getGitChangeDiff(t,r,i,c,e.commit)},enabled:e.enabled&&(!l||!!e.commit),staleTime:e.commit?1/0:1e3*60*5,gcTime:1e3*60*15})};function et({className:e}){let{t}=i(`openhands`);return(0,V.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,V.jsx)(`div`,{className:g(`animate-spin rounded-full border-4 border-transparent border-t-white`,e),role:`status`,"aria-label":t(_.HOME$LOADING)})})}function tt({height:e,children:t}){return(0,V.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 nt=[{mode:`old`,icon:E},{mode:`diff`,icon:x},{mode:`new`,icon:k}],rt={renderValidationDecorations:`off`,readOnly:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},automaticLayout:!0,scrollbar:{alwaysConsumeMouseWheel:!1}},it={A:C,D,M:T,R:`Renamed`,U:`Untracked`},at=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 ot({path:e,type:t,commit:n}){let{t:r}=i(`openhands`),[a,o]=B.useState(!0),[s,c]=B.useState(400),[l,u]=B.useState(`diff`),d=B.useRef(null),f=B.useRef(null),p=t===`A`||t===`U`,m=t===`D`,h=B.useMemo(()=>{if(t===`R`){let t=e.split(/\s+/).slice(1);return t[t.length-1]}return e},[e,t]),{data:y,isLoading:b,isSuccess:x,isRefetching:C}=$e({filePath:h,type:t,enabled:!a,commit:n}),w=B.useCallback(()=>{if(!d.current)return;let e=d.current.getOriginalEditor(),t=d.current.getModifiedEditor();e&&t&&c(Math.max(e.getContentHeight(),t.getContentHeight())+20)},[]),T=B.useCallback(()=>{f.current&&c(f.current.getContentHeight()+20)},[]),E=e=>{d.current=e,w(),e.getOriginalEditor().onDidContentSizeChange(w),e.getModifiedEditor().onDidContentSizeChange(w)},D=e=>{f.current=e,T(),e.onDidContentSizeChange(T)},k=(t===`U`?it.A:it[t])||`?`,A=typeof k==`string`?(0,V.jsx)(ae.Text,{children:k}):B.createElement(k,{className:`w-5 h-5`}),j=b||C,M=v(h),N=M===`markdown`,P=l===`old`?y?.original??``:y?.modified??``;return(0,V.jsxs)(`div`,{"data-testid":`file-diff-viewer-outer`,className:`w-full flex flex-col`,children:[(0,V.jsx)(`div`,{className:`flex justify-between items-center px-3 py-2.5 border-b border-[var(--oh-border)] hover:cursor-pointer`,onClick:()=>o(e=>!e),children:(0,V.jsxs)(`span`,{className:`text-sm w-full text-content flex items-center gap-2`,children:[j?(0,V.jsx)(et,{className:`w-4 h-4`}):A,(0,V.jsx)(`strong`,{className:`w-full truncate font-medium`,children:h}),!a&&!m&&(0,V.jsx)(`span`,{className:`flex items-center gap-0.5 shrink-0`,onClick:e=>e.stopPropagation(),children:nt.map(({mode:e,icon:t})=>(0,V.jsx)(`button`,{"data-testid":`view-mode-${e}`,type:`button`,"aria-pressed":l===e,onClick:()=>u(e),className:g(`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,V.jsx)(t,{className:`w-4 h-4`})},e))}),(0,V.jsx)(`button`,{"data-testid":`collapse`,type:`button`,children:(0,V.jsx)(Qe,{className:g(`w-4 h-4 transition-transform`,a&&`transform rotate-180`)})})]})}),!a&&m&&!n&&(0,V.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:r(_.DIFF_VIEWER$FILE_DELETED)}),!a&&(!m||!!n)&&x&&(l===`diff`?(0,V.jsx)(tt,{height:s,children:(0,V.jsx)(S,{"data-testid":`file-diff-viewer`,className:`w-full h-full`,language:M,original:p?``:y?.original??``,modified:m?``:y?.modified??``,theme:`custom-diff-theme`,onMount:E,beforeMount:at,options:{...rt,renderSideBySide:!p&&!m,hideUnchangedRegions:{enabled:!0}}})}):N?(0,V.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,V.jsx)(ce,{content:P,includeStandard:!0,includeHeadings:!0})}):(0,V.jsx)(tt,{height:s,children:(0,V.jsx)(O,{"data-testid":`file-single-viewer`,className:`w-full h-full`,language:M,value:P,theme:`custom-diff-theme`,beforeMount:at,onMount:D,options:rt})}))]})}function $(){return(0,V.jsx)(T,{"aria-hidden":!0,className:`size-full`})}function st(){let{t:e}=i(`openhands`);return(0,V.jsx)(z,{icon:(0,V.jsx)($,{}),children:e(_.DIFF_VIEWER$NO_CHANGES)})}var ct=[{key:_.TIPS$CUSTOMIZE_MICROAGENT,link:`https://docs.all-hands.dev/usage/prompting/microagents-repo`},{key:_.TIPS$SETUP_SCRIPT,link:`https://docs.all-hands.dev/usage/prompting/repository#setup-script`},{key:_.TIPS$VSCODE_INSTANCE},{key:_.TIPS$SAVE_WORK},{key:_.TIPS$SPECIFY_FILES,link:`https://docs.all-hands.dev/usage/prompting/prompting-best-practices`},{key:_.TIPS$HEADLESS_MODE,link:`https://docs.all-hands.dev/usage/how-to/headless-mode`},{key:_.TIPS$CLI_MODE,link:`https://docs.all-hands.dev/usage/how-to/cli-mode`},{key:_.TIPS$GITHUB_HOOK,link:`https://docs.all-hands.dev/usage/cloud/github-installation#working-on-github-issues-and-pull-requests-using-openhands`},{key:_.TIPS$BLOG_SIGNUP,link:`https://www.all-hands.dev/blog`},{key:_.TIPS$API_USAGE,link:`https://docs.all-hands.dev/api-reference/health-check`}];function lt(){return ct[Math.floor(Math.random()*ct.length)]}function ut(){let{t:e}=i(`openhands`),[t,n]=B.useState(lt());return B.useEffect(()=>{n(lt())},[]),(0,V.jsx)(`div`,{className:`w-full bg-tertiary p-4 text-left`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(y,{className:`mt-0.5 h-4 w-4 shrink-0 fill-[var(--oh-muted)]`,"aria-hidden":!0}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-[var(--oh-text-tertiary)]`,children:e(_.TIPS$PROTIP)}),(0,V.jsxs)(`p`,{className:`text-sm font-normal leading-5 text-[var(--oh-muted)]`,children:[e(t.key),t.link?(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`a`,{href:t.link,target:`_blank`,rel:`noopener noreferrer`,className:`underline transition-colors hover:text-white`,children:e(_.TIPS$LEARN_MORE)})]}):null]})]})]})})}var dt=/not a git repository/i,ft=new Set([_.DIFF_VIEWER$WAITING_FOR_RUNTIME,_.DIFF_VIEWER$LOADING]);function pt({messages:e}){let{t}=i(`openhands`);return e.length===1&&ft.has(e[0])?(0,V.jsx)(F,{testId:`changes-tab-status`,messageKey:e[0]}):(0,V.jsx)(z,{icon:(0,V.jsx)($,{}),children:e.map(e=>(0,V.jsx)(`span`,{className:`block`,children:t(e)},e))})}function mt(){let{data:e,isSuccess:t,isError:n,error:r,isLoading:i}=K(),[a,o]=B.useState(null),{curAgentState:s}=oe(),c=!h.includes(s),l=r&&dt.test(m(r));return B.useEffect(()=>{if(!c)o([_.DIFF_VIEWER$WAITING_FOR_RUNTIME]);else if(r){let e=m(r);dt.test(e)?o([_.DIFF_VIEWER$NOT_A_GIT_REPO,_.DIFF_VIEWER$ASK_OH]):o([e])}else o(i?[_.DIFF_VIEWER$LOADING]:null)},[c,l,i,r,o]),(0,V.jsx)(`main`,{className:`h-full w-full flex flex-col items-stretch`,children:!t||!e.length?(0,V.jsxs)(`div`,{className:`flex flex-col h-full w-full`,children:[(0,V.jsxs)(`div`,{className:`flex-1 flex items-center justify-center`,children:[a&&(0,V.jsx)(pt,{messages:a}),!a&&t&&e.length===0&&(0,V.jsx)(st,{})]}),!n&&t&&e.length===0&&(0,V.jsx)(ut,{})]}):(0,V.jsx)(`div`,{className:`h-full overflow-y-auto flex flex-col items-stretch custom-scrollbar-always`,children:e.slice(0,100).map(e=>(0,V.jsx)(ot,{path:e.path,type:e.status},e.path))})})}var ht=(e,t)=>{let{conversationId:n}=R(),{data:r}=I(),i=b(),a=r?.conversation_url,o=r?.session_api_key,c=r?.selected_repository,l=r?.workspace?.working_dir?.trim(),u=B.useMemo(()=>G(c,l),[c,l]);return s({queryKey:[`commit_changes`,n,a,o,u,e],queryFn:async()=>{if(!n)throw Error(`No conversation ID`);return W.getCommitChanges(a,o,u,e)},staleTime:1/0,gcTime:1e3*60*15,retry:!1,enabled:t.enabled&&i&&!!n,meta:{disableToast:!0}})};function gt({commit:e,showAuthor:t,isExpanded:n,onToggle:r}){let{t:a}=i(`openhands`),{data:o,isLoading:s,isSuccess:c}=ht(e.sha,{enabled:n});return(0,V.jsxs)(`div`,{"data-testid":`commit-row`,className:`w-full flex flex-col`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,"data-testid":`commit-row-toggle`,className:`w-full flex items-center gap-2 px-3 py-2.5 border-b border-[var(--oh-border)] text-sm text-content text-left hover:cursor-pointer`,children:[(0,V.jsx)(`code`,{className:`font-mono text-xs text-[var(--oh-muted)] flex-shrink-0`,children:e.shortSha}),(0,V.jsx)(`strong`,{className:`flex-1 truncate font-medium`,children:e.subject}),t&&(0,V.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate max-w-32 flex-shrink-0`,children:e.author}),(0,V.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] flex-shrink-0`,children:`${j(e.timestamp)} ${a(_.CONVERSATION$AGO)}`}),(0,V.jsx)(Qe,{className:g(`w-4 h-4 transition-transform flex-shrink-0`,!n&&`transform rotate-180`)})]}),n&&(0,V.jsxs)(`div`,{"data-testid":`commit-row-content`,className:`w-full flex flex-col pl-6`,children:[s&&(0,V.jsx)(`div`,{className:`p-3`,children:(0,V.jsx)(et,{className:`w-4 h-4`})}),c&&o?.map(t=>(0,V.jsx)(ot,{path:t.path,type:t.status,commit:e.sha},t.path))]})]})}function _t({commits:e,hasMore:t}){let{t:n}=i(`openhands`),[r,a]=B.useState(null),o=new Set(e.map(e=>e.author)).size>1;return(0,V.jsxs)(`section`,{"data-testid":`commit-list`,className:`w-full flex flex-col`,children:[e.map(e=>(0,V.jsx)(gt,{commit:e,showAuthor:o,isExpanded:r===e.sha,onToggle:()=>a(t=>t===e.sha?null:e.sha)},e.sha)),t&&(0,V.jsx)(`div`,{"data-testid":`commit-list-cap-notice`,className:`px-3 py-2.5 text-xs text-[var(--oh-muted)]`,children:n(_.DIFF_VIEWER$COMMITS_CAP,{count:e.length})})]})}function vt(){let{t:e}=i(`openhands`),{conversationId:t}=R(),{commits:n,hasMore:r,isUnsupported:a,isLoading:o,isSuccess:s}=Ze(),{curAgentState:c}=oe(),l=!h.includes(c);return(0,V.jsx)(`main`,{className:`h-full w-full flex flex-col items-stretch`,children:s&&!a&&n.length>0?(0,V.jsx)(`div`,{className:`h-full overflow-y-auto flex flex-col items-stretch custom-scrollbar-always`,children:(0,V.jsx)(_t,{commits:n,hasMore:r},t)}):(0,V.jsxs)(`div`,{className:`flex-1 flex items-center justify-center`,children:[!l&&(0,V.jsx)(F,{testId:`commits-tab-status`,messageKey:_.DIFF_VIEWER$WAITING_FOR_RUNTIME}),l&&o&&(0,V.jsx)(F,{testId:`commits-tab-status`,messageKey:_.DIFF_VIEWER$LOADING}),l&&!o&&(0,V.jsx)(z,{icon:(0,V.jsx)($,{}),children:e(_.DIFF_VIEWER$NO_COMMITS)})]})})}function yt(){let{t:e}=i(`openhands`);Re();let{hasAttachedSource:t,isLoading:n}=je(),{hasCommits:a}=Me({enabled:t}),{conversationId:o}=se(),{state:s,setFilesTabDiffView:c,setFilesTabContentViewMode:l}=ee(o??``),u=(t||n)&&a!==!1,d=s.filesTabDiffView??u,f=s.filesTabContentViewMode,{isSuccess:p,isUnsupported:m}=Ze(),h=p&&!m,[g,v]=(0,B.useState)(!1),y=d?`on`:`off`;g&&h&&(y=`commits`);let[b,x]=(0,B.useState)(!1),S=xe(),C=(0,B.useMemo)(()=>S.data??[],[S.data]),w=L(e=>e.selectedPath),T=L(e=>e.selectedConversationId),E=L(e=>e.setSelectedPath),D=T===o?w:null,O=(0,B.useCallback)(e=>E(e,o),[o,E]),k=Ae(D),A=J(e=>e.count),j=we(k.data?.staticUrl??null,A);(0,B.useEffect)(()=>{T!==o&&E(null,o)},[T,o,E]),(0,B.useEffect)(()=>{if(D||C.length===0)return;let[e]=We(C);e&&E(e,o)},[C,D,o,E]);let M=r(),{refetch:N,isFetching:P}=K(),te=()=>{N(),M.invalidateQueries({queryKey:[`workspace-files`]}),M.invalidateQueries({queryKey:[`workspace-file-content`]}),M.invalidateQueries({queryKey:[`git_commits`]})};return(0,V.jsxs)(`main`,{className:`h-full w-full flex flex-col items-stretch`,"data-testid":`files-tab`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 border-b border-[var(--oh-border)]`,children:[(0,V.jsx)(ne,{ariaLabel:e(_.FILES$DIFF_VIEW),testId:`files-tab-diff-toggle`,value:y,options:[{value:`on`,label:e(_.FILES$DIFF_VIEW)},...h?[{value:`commits`,label:e(_.DIFF_VIEWER$COMMITS)}]:[],{value:`off`,label:e(_.COMMON$FILES)}],onChange:e=>{e===`commits`?v(!0):(v(!1),c(e===`on`))}}),y===`off`&&(0,V.jsx)(ne,{ariaLabel:e(_.FILES$RICH),testId:`files-tab-content-mode-toggle`,value:f,options:[{value:`rich`,label:e(_.FILES$RICH)},{value:`plain`,label:e(_.FILES$PLAIN)}],onChange:l}),(0,V.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[y===`off`&&j&&(0,V.jsx)(`a`,{href:j,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e(_.FILES$OPEN_IN_NEW_WINDOW),title:e(_.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,V.jsx)(ue,{width:14,height:14})}),(0,V.jsx)(`button`,{type:`button`,onClick:te,disabled:P,"aria-label":e(_.FILES$REFRESH),title:e(_.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,V.jsx)(Xe,{width:12.75,height:15,color:`#ffffff`,className:P?`animate-spin`:``})})]})]}),y===`on`&&(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(mt,{})}),y===`commits`&&(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(vt,{})}),y===`off`&&(0,V.jsx)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:S.isLoading?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-[var(--oh-muted)]`,children:e(_.FILES$LOADING_FILES)}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ge,{paths:C,selectedPath:D,onSelectFile:O,isTreeVisible:b,onToggleTree:()=>x(e=>!e)}),(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1`,children:[b&&(0,V.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,V.jsx)(de,{paths:C,selectedPath:D,onSelectFile:O})}),(0,V.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,"data-testid":`files-tab-content`,children:D?(0,V.jsx)(Ye,{path:D,viewMode:f}):(0,V.jsx)(pe,{})})]})]})})]})}export{yt as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{St as t,yt as n}from"./vendor-styling-Bcgpimp9.js";import{n as r}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~f1hl7voa-BrmgjeOw.js";import{t as i}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~hakxo2tj-ClV0p9g3.js";import{A as a,g as o}from"./vendor~entry.client~root~root-layout~index-home~home~conversation-panel~conversation~launch~g4xrpilz-CJ7amdtQ.js";import{t as s}from"./useQuery-B38jBavx.js";import{A as c,C as l,D as u,I as d,V as f,n as p,st as m}from"./active-backend-context-BlZPzZNU.js";import{E as h,t as g,z as _}from"./utils-qjs_KuS4.js";import{r as v,u as y}from"./messages-DINDkPNK.js";import{r as b}from"./conversation-CObLYSJd.js";import{a as x,c as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k}from"./vendor~files-tab-vm3f67Pz.js";import{n as A,t as j}from"./format-time-delta-DuhE50B-.js";import{i as M}from"./vendor~root~root-layout~index-home~home~conversation-panel~conversation~launch~extensions-h~bi2r7bko-Bw4AuHN1.js";import{t as N}from"./proxy-C79PCMjo.js";import{s as P}from"./git-provider-icon-BREx-yUX.js";import{c as ee,f as te}from"./conversation-store-C6hSXHw0.js";import{t as ne}from"./segmented-toggle-DbbD3Tve.js";import{c as re,u as ie}from"./agent-server-conversation-service.api-Btmi4q6d.js";import{r as ae}from"./typography-C6fuRTTT.js";import{_ as F}from"./llm-not-configured-banner-DTWzISnk.js";import{G as oe,J as se,K as I,h as L,q as R,t as ce,x as le}from"./markdown-renderer-CvOO0YIr.js";import{t as ue}from"./link-external-BDBCz-_z.js";import{n as de,t as fe}from"./highlighted-source-view-suUKd5if.js";import{t as z}from"./conversation-tab-empty-state-BCMHkGQk.js";var B=e(t(),1),V=n();function pe(){let{t:e}=i(`openhands`);return(0,V.jsx)(z,{className:`h-full`,icon:(0,V.jsx)(A,{"aria-hidden":!0,strokeWidth:2,className:`size-full`}),children:e(_.FILES$NO_FILE_SELECTED)})}var me=class{static async executeCommand(e,t,n,r,i=30){let a=d().backend;if(a.kind===`cloud`&&e){let o=await N({backend:a,method:`POST`,hostOverride:c(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 M(u({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=d().backend;return r.kind===`cloud`&&e?(await N({backend:r,method:`GET`,hostOverride:c(e),path:`/api/file/download?path=${encodeURIComponent(n)}`,authMode:`session-api-key`,sessionApiKey:t,responseType:`blob`})).arrayBuffer():new o(u({conversationUrl:e,sessionApiKey:t})).downloadFile(n)}};function H(e){return e.startsWith(`/`)?e:`/${e}`}async function U(e,t,n,r){let i=d().backend;if(i.kind===`cloud`&&e){let a=new URLSearchParams({...r,path:H(r.path)});return N({backend:i,method:`GET`,hostOverride:c(e),path:`${n}?${a.toString()}`,authMode:`session-api-key`,sessionApiKey:t??void 0})}return(await new M(u({conversationUrl:e,sessionApiKey:t})).client.get(n,{params:r})).data}function he(e){return l(e,404)||a(e)&&e.response?.status===404}var W=class{static async getGitChanges(e,t,n,r){let i=d().backend;if(i.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,H(r));let n=await N({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:P(String(e.status)),path:e.path}))}let a=await new M(u({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:P(String(e.status)),path:e.path}))}static async getGitCommits(e,t,n,r=50){try{let i=await U(e,t,`/api/git/commits`,{path:n,limit:String(r)});return{commits:(i?.commits??[]).map(e=>({sha:e.sha,shortSha:e.short_sha,subject:e.subject,author:e.author,timestamp:e.timestamp})),hasMore:!!i?.has_more}}catch(e){if(he(e))return null;throw e}}static async getCommitChanges(e,t,n,r){let i=await U(e,t,`/api/git/commits/${encodeURIComponent(r)}/changes`,{path:n});if(!Array.isArray(i))throw Error(`Invalid response from runtime - runtime may be unavailable`);return i.map(e=>({status:P(String(e.status)),path:e.path}))}static async getGitChangeDiff(e,t,n,r,i){if(i){let e=await U(t,n,`/api/git/diff`,{path:r,commit:i});return{modified:e?.modified??``,original:e?.original??``,...e?.diff?{diff:e.diff}:{}}}let a=d().backend;if(a.kind===`cloud`&&e){let t=new URLSearchParams;t.set(`path`,H(r));let n=await N({backend:a,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 o=await new M(u({conversationUrl:t,sessionApiKey:n})).gitDiff(r);return{modified:o.modified??``,original:o.original??``,...o.diff?{diff:o.diff}:{}}}};function G(e,t){let n=t?.trim();if(n)return n;if(!e)return f;let r=e.split(`/`);return`${f}/${r[r.length-1]}`}var K=()=>{let{conversationId:e}=R(),{data:t}=I(),[n,r]=B.useState([]),i=B.useRef(null),a=b(),o=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),d=B.useMemo(()=>G(l,u),[l,u]),f=s({queryKey:[`file_changes`,e,o,c,d],queryFn:async()=>{if(!e)throw Error(`No conversation ID`);return W.getGitChanges(e,o,c,d)},retry:!1,staleTime:1e3*60*5,gcTime:1e3*60*15,refetchOnMount:`always`,enabled:a&&!!e,meta:{disableToast:!0}});return B.useEffect(()=>{if(!f.isFetching&&f.isSuccess&&f.data){let e=f.data;if(e!==i.current)if(i.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}},q=2e3,ge=[`.git`,`node_modules`,`.venv`,`venv`,`__pycache__`,`dist`,`build`,`.next`,`.cache`,`.pytest_cache`,`.mypy_cache`,`.turbo`,`.parcel-cache`,`target`];function _e(){return`find . \\( ${ge.map(e=>`-name '${e}' -prune`).join(` -o `)} \\) -o -type f -print 2>/dev/null | sort | head -n ${q}`}function ve(e){return e.startsWith(`./`)?e.slice(2):e}function ye(e){let{data:t}=I(),n=b(),r=t?.id,i=t?.conversation_url,a=t?.session_api_key,o=t?.workspace?.working_dir?.trim(),c=s({queryKey:[`workspace-files`,r,i,a,o],queryFn:async()=>{let e=await me.executeCommand(i,a,_e(),o,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(ve);return Array.from(new Set(t)).slice(0,q)},enabled:e&&n&&!!r&&!!o,retry:!1,staleTime:1e3*30,gcTime:1e3*60*5,meta:{disableToast:!0}});return{data:c.data,isLoading:c.isLoading}}function be(e){let t=K(),n=(0,B.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,q)},[e,t.data]);return{data:e?n:void 0,isLoading:e?t.isLoading:!1}}function xe(){let{backend:e}=p(),t=e.kind===`cloud`,n=ye(!t),r=be(t);return t?r:n}function Se(){let{data:e}=I(),t=b(),n=e?.id,r=e?.conversation_url,i=e?.session_api_key,a=d().backend.kind===`local`,o=s({queryKey:[`workspace-session`,n,r,i],queryFn:async()=>({baseUrl:await new M(u({conversationUrl:r,sessionApiKey:i})).startWorkspaceSession(n)}),enabled:t&&!!n&&a,staleTime:1/0,gcTime:1/0,retry:!1});return{data:o.data??null,isLoading:o.isLoading,isError:o.isError,error:o.error??null}}function Ce(e,t){let n=(t??``).replace(/^\/+/,``);return n?`${e}${n.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`:e}var J=te(e=>({count:0,bump:()=>e(e=>({count:e.count+1}))}));function we(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 Y(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function De(e){switch(Y(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=Y(e);return Te.has(t)?`image`:Ee.has(t)?`pdf`:`text`}function ke(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 X(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 Ae(e){let{data:t}=I(),n=b(),{data:r}=Se(),i=J(e=>e.count),a=t?.id,o=t?.conversation_url,c=t?.session_api_key,l=t?.selected_repository,u=t?.workspace?.working_dir?.trim(),f=r?.baseUrl,p=d().backend.kind===`cloud`,m=G(l,u),h=m.startsWith(`/`)?m:`/${m}`,g=e?`${h}/${e}`:null;return s({queryKey:[`workspace-file-content`,a,o,c,p?`cloud`:f,e,g,i],queryFn:async()=>{if(!e)throw Error(`No path`);let t=Oe(e),n=De(e);if(p){let r=await re(a,g);if(t===`text`){let t=new TextEncoder().encode(r);return ke(t.buffer)?{path:e,kind:`binary`,text:null,staticUrl:`data:application/octet-stream;base64,${X(t.buffer)}`,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:r,staticUrl:`data:${n};charset=utf-8;base64,${X(t.buffer)}`,mimeType:n}}return{path:e,kind:t,text:null,staticUrl:`data:${n};base64,${X(new TextEncoder().encode(r).buffer)}`,mimeType:n}}if(!f)throw Error(`No workspace session`);let r=Ce(f,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 o=await i.arrayBuffer();return ke(o)?{path:e,kind:`binary`,text:null,staticUrl:r,mimeType:`application/octet-stream`}:{path:e,kind:`text`,text:new TextDecoder(`utf-8`,{fatal:!1}).decode(o),staticUrl:r,mimeType:n}},enabled:n&&!!a&&!!e&&(p||!!f),retry:!1,staleTime:1e3*5,gcTime:1e3*60,meta:{disableToast:!0}})}function je(){let{data:e,isLoading:t}=I(),n=e?.id?ie(e.id):null;return{hasAttachedSource:!!e?.selected_repository||!!n?.selected_workspace,isLoading:t}}function Me(e){let{data:t}=I(),n=b(),{backend:r}=p(),i=r.kind===`local`,a=t?.id,o=t?.conversation_url,c=t?.session_api_key,l=t?.workspace?.working_dir?.trim(),u=(e?.enabled??!0)&&i&&n&&!!a&&!!l,d=s({queryKey:[`has-git-commits`,a,o,c,l],queryFn:async()=>(await me.executeCommand(o,c,`git rev-parse --verify HEAD`,l,10)).exit_code===0,enabled:u,retry:!1,staleTime:6e4,gcTime:5*6e4,meta:{disableToast:!0}});return{hasCommits:d.data??null,isLoading:d.isLoading}}var Ne=new Set([`FileEditorObservation`,`StrReplaceEditorObservation`,`PlanningFileEditorObservation`]),Pe=new Set([`view`]),Fe=new Set([`ExecuteBashObservation`,`TerminalObservation`]);function Ie(e){let t=e.observation;return!(!t||typeof t.kind!=`string`||!Ne.has(t.kind)||t.command&&Pe.has(t.command))}function Le(e){let t=e.observation;return!!t&&typeof t.kind==`string`&&Fe.has(t.kind)}function Re(){let e=r(),t=le(e=>e.events),n=J(e=>e.bump),i=(0,B.useRef)(new Set),a=(0,B.useRef)(new WeakSet);(0,B.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),Ie(e)?r=!0:Le(e)&&(o=!0))}!r&&!o||(e.invalidateQueries({queryKey:[`file_changes`]}),e.invalidateQueries({queryKey:[`file_diff`]}),e.invalidateQueries({queryKey:[`git_commits`]}),r&&(e.invalidateQueries({queryKey:[`workspace-files`]}),e.invalidateQueries({queryKey:[`workspace-file-content`]}),n()))},[t,e,n])}var ze=[`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`],Be=[`license`,`license.md`,`license.txt`,`changelog.md`,`agents.md`,`tsconfig.json`,`.env.sample`,`.env.example`];function Ve(e){let t=e.lastIndexOf(`/`);return(t===-1?e:e.slice(t+1)).toLowerCase()}function He(e){return e.split(`/`).filter(Boolean).length-1}function Ue(e){let t=Ve(e),n=ze.indexOf(t);if(n!==-1)return n;let r=Be.indexOf(t);return r===-1?1e4:1e3+r}function We(e){return[...e].sort((e,t)=>{let n=He(e)-He(t);if(n!==0)return n;let r=Ue(e)-Ue(t);return r===0?e.localeCompare(t):r})}function Ge({paths:e,selectedPath:t,onSelectFile:n,isTreeVisible:r,onToggleTree:a}){let{t:o}=i(`openhands`),s=(0,B.useMemo)(()=>We(e),[e]);return(0,V.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,V.jsx)(`button`,{type:`button`,onClick:a,"data-testid":`file-quick-row-tree-toggle`,"aria-pressed":r,"aria-label":o(r?_.FILES$HIDE_FILE_TREE:_.FILES$SHOW_FILE_TREE),title:o(r?_.FILES$HIDE_FILE_TREE:_.FILES$SHOW_FILE_TREE),className:g(`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,V.jsx)(w,{className:`w-3 h-3`,"aria-hidden":!0,strokeWidth:2})}),s.length>0&&(0,V.jsx)(`div`,{className:`flex flex-nowrap items-center gap-1.5 overflow-hidden flex-1 min-w-0`,children:s.map(e=>{let r=t===e;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:e,"data-testid":`file-quick-row-item-${e}`,className:g(`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)})})]})}var Ke=new Set([`html`,`htm`,`svg`]),qe=new Set([`md`,`markdown`,`mdx`]),Je={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}=i(`openhands`),n=Je[Z(e)];return(0,V.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(_.FILES$UNSUPPORTED_DOCUMENT,{type:n}):t(_.FILES$BINARY_FALLBACK)})}function Ye({path:e,viewMode:t}){let{t:n}=i(`openhands`),r=Ae(e),a=J(e=>e.count);if(r.isLoading)return(0,V.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-sm text-[var(--oh-muted)]`,children:n(_.FILES$LOADING_FILES)});if(r.isError||!r.data)return(0,V.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(_.FILES$LOAD_ERROR)});let{kind:o,text:s,staticUrl:c,mimeType:l}=r.data,u=we(c,a);return t===`plain`?o===`text`&&s!==null?(0,V.jsx)(fe,{path:e,text:s,mimeType:l??void 0}):(0,V.jsx)(Q,{path:e}):o===`image`?(0,V.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,V.jsx)(`img`,{src:u,alt:e,className:`max-h-full max-w-full object-contain`})}):o===`pdf`?(0,V.jsx)(`iframe`,{title:e,src:u,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):o===`binary`?(0,V.jsx)(Q,{path:e}):l===`text/html`||Ke.has(Z(e))?(0,V.jsx)(`iframe`,{title:e,src:u,sandbox:`allow-same-origin`,"data-testid":`file-content-viewer-iframe`,className:`h-full w-full bg-white`}):o===`text`&&qe.has(Z(e))?(0,V.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,V.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,V.jsx)(ce,{content:s??``,includeStandard:!0,includeHeadings:!0})})}):o===`text`&&s!==null?(0,V.jsx)(fe,{path:e,text:s,mimeType:l??void 0}):(0,V.jsx)(Q,{path:e})}var Xe=e=>(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 13 15`,fill:`none`,...e,children:(0,V.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`})}),Ze=()=>{let{conversationId:e}=R(),{data:t}=I(),n=b(),r=t?.conversation_url,i=t?.session_api_key,a=t?.selected_repository,o=t?.workspace?.working_dir?.trim(),c=B.useMemo(()=>G(a,o),[a,o]),l=s({queryKey:[`git_commits`,e,r,i,c],queryFn:async()=>{if(!e)throw Error(`No conversation ID`);return W.getGitCommits(r,i,c,50)},retry:!1,staleTime:1e3*60*5,gcTime:1e3*60*15,refetchOnMount:`always`,enabled:n&&!!e,meta:{disableToast:!0}});return{commits:l.data?.commits??[],hasMore:l.data?.hasMore??!1,isUnsupported:l.data===null,isLoading:l.isLoading,isFetching:l.isFetching,isSuccess:l.isSuccess,isError:l.isError}},Qe=e=>(0,V.jsx)(`svg`,{width:13,height:8,viewBox:`0 0 13 8`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,V.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`})}),$e=e=>{let{conversationId:t}=R(),{data:n}=I(),r=n?.conversation_url,i=n?.session_api_key,a=n?.selected_repository,o=n?.workspace?.working_dir?.trim(),c=B.useMemo(()=>`${G(a,o)}/${e.filePath}`,[a,e.filePath,o]),l=e.type===`D`;return s({queryKey:e.commit?[`commit_file_diff`,t,r,i,e.commit,c]:[`file_diff`,t,r,i,c],queryFn:async()=>{if(!t)throw Error(`No conversation ID`);return W.getGitChangeDiff(t,r,i,c,e.commit)},enabled:e.enabled&&(!l||!!e.commit),staleTime:e.commit?1/0:1e3*60*5,gcTime:1e3*60*15})};function et({className:e}){let{t}=i(`openhands`);return(0,V.jsx)(`div`,{className:`flex items-center justify-center`,children:(0,V.jsx)(`div`,{className:g(`animate-spin rounded-full border-4 border-transparent border-t-white`,e),role:`status`,"aria-label":t(_.HOME$LOADING)})})}function tt({height:e,children:t}){return(0,V.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 nt=[{mode:`old`,icon:E},{mode:`diff`,icon:x},{mode:`new`,icon:k}],rt={renderValidationDecorations:`off`,readOnly:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},automaticLayout:!0,scrollbar:{alwaysConsumeMouseWheel:!1}},it={A:C,D,M:T,R:`Renamed`,U:`Untracked`},at=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 ot({path:e,type:t,commit:n}){let{t:r}=i(`openhands`),[a,o]=B.useState(!0),[s,c]=B.useState(400),[l,u]=B.useState(`diff`),d=B.useRef(null),f=B.useRef(null),p=t===`A`||t===`U`,m=t===`D`,h=B.useMemo(()=>{if(t===`R`){let t=e.split(/\s+/).slice(1);return t[t.length-1]}return e},[e,t]),{data:y,isLoading:b,isSuccess:x,isRefetching:C}=$e({filePath:h,type:t,enabled:!a,commit:n}),w=B.useCallback(()=>{if(!d.current)return;let e=d.current.getOriginalEditor(),t=d.current.getModifiedEditor();e&&t&&c(Math.max(e.getContentHeight(),t.getContentHeight())+20)},[]),T=B.useCallback(()=>{f.current&&c(f.current.getContentHeight()+20)},[]),E=e=>{d.current=e,w(),e.getOriginalEditor().onDidContentSizeChange(w),e.getModifiedEditor().onDidContentSizeChange(w)},D=e=>{f.current=e,T(),e.onDidContentSizeChange(T)},k=(t===`U`?it.A:it[t])||`?`,A=typeof k==`string`?(0,V.jsx)(ae.Text,{children:k}):B.createElement(k,{className:`w-5 h-5`}),j=b||C,M=v(h),N=M===`markdown`,P=l===`old`?y?.original??``:y?.modified??``;return(0,V.jsxs)(`div`,{"data-testid":`file-diff-viewer-outer`,className:`w-full flex flex-col`,children:[(0,V.jsx)(`div`,{className:`flex justify-between items-center px-3 py-2.5 border-b border-[var(--oh-border)] hover:cursor-pointer`,onClick:()=>o(e=>!e),children:(0,V.jsxs)(`span`,{className:`text-sm w-full text-content flex items-center gap-2`,children:[j?(0,V.jsx)(et,{className:`w-4 h-4`}):A,(0,V.jsx)(`strong`,{className:`w-full truncate font-medium`,children:h}),!a&&!m&&(0,V.jsx)(`span`,{className:`flex items-center gap-0.5 shrink-0`,onClick:e=>e.stopPropagation(),children:nt.map(({mode:e,icon:t})=>(0,V.jsx)(`button`,{"data-testid":`view-mode-${e}`,type:`button`,"aria-pressed":l===e,onClick:()=>u(e),className:g(`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,V.jsx)(t,{className:`w-4 h-4`})},e))}),(0,V.jsx)(`button`,{"data-testid":`collapse`,type:`button`,children:(0,V.jsx)(Qe,{className:g(`w-4 h-4 transition-transform`,a&&`transform rotate-180`)})})]})}),!a&&m&&!n&&(0,V.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:r(_.DIFF_VIEWER$FILE_DELETED)}),!a&&(!m||!!n)&&x&&(l===`diff`?(0,V.jsx)(tt,{height:s,children:(0,V.jsx)(S,{"data-testid":`file-diff-viewer`,className:`w-full h-full`,language:M,original:p?``:y?.original??``,modified:m?``:y?.modified??``,theme:`custom-diff-theme`,onMount:E,beforeMount:at,options:{...rt,renderSideBySide:!p&&!m,hideUnchangedRegions:{enabled:!0}}})}):N?(0,V.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,V.jsx)(ce,{content:P,includeStandard:!0,includeHeadings:!0})}):(0,V.jsx)(tt,{height:s,children:(0,V.jsx)(O,{"data-testid":`file-single-viewer`,className:`w-full h-full`,language:M,value:P,theme:`custom-diff-theme`,beforeMount:at,onMount:D,options:rt})}))]})}function $(){return(0,V.jsx)(T,{"aria-hidden":!0,className:`size-full`})}function st(){let{t:e}=i(`openhands`);return(0,V.jsx)(z,{icon:(0,V.jsx)($,{}),children:e(_.DIFF_VIEWER$NO_CHANGES)})}var ct=[{key:_.TIPS$CUSTOMIZE_MICROAGENT,link:`https://docs.all-hands.dev/usage/prompting/microagents-repo`},{key:_.TIPS$SETUP_SCRIPT,link:`https://docs.all-hands.dev/usage/prompting/repository#setup-script`},{key:_.TIPS$VSCODE_INSTANCE},{key:_.TIPS$SAVE_WORK},{key:_.TIPS$SPECIFY_FILES,link:`https://docs.all-hands.dev/usage/prompting/prompting-best-practices`},{key:_.TIPS$HEADLESS_MODE,link:`https://docs.all-hands.dev/usage/how-to/headless-mode`},{key:_.TIPS$CLI_MODE,link:`https://docs.all-hands.dev/usage/how-to/cli-mode`},{key:_.TIPS$GITHUB_HOOK,link:`https://docs.all-hands.dev/usage/cloud/github-installation#working-on-github-issues-and-pull-requests-using-openhands`},{key:_.TIPS$BLOG_SIGNUP,link:`https://www.all-hands.dev/blog`},{key:_.TIPS$API_USAGE,link:`https://docs.all-hands.dev/api-reference/health-check`}];function lt(){return ct[Math.floor(Math.random()*ct.length)]}function ut(){let{t:e}=i(`openhands`),[t,n]=B.useState(lt());return B.useEffect(()=>{n(lt())},[]),(0,V.jsx)(`div`,{className:`w-full bg-tertiary p-4 text-left`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(y,{className:`mt-0.5 h-4 w-4 shrink-0 fill-[var(--oh-muted)]`,"aria-hidden":!0}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-semibold text-[var(--oh-text-tertiary)]`,children:e(_.TIPS$PROTIP)}),(0,V.jsxs)(`p`,{className:`text-sm font-normal leading-5 text-[var(--oh-muted)]`,children:[e(t.key),t.link?(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`a`,{href:t.link,target:`_blank`,rel:`noopener noreferrer`,className:`underline transition-colors hover:text-white`,children:e(_.TIPS$LEARN_MORE)})]}):null]})]})]})})}var dt=/not a git repository/i,ft=new Set([_.DIFF_VIEWER$WAITING_FOR_RUNTIME,_.DIFF_VIEWER$LOADING]);function pt({messages:e}){let{t}=i(`openhands`);return e.length===1&&ft.has(e[0])?(0,V.jsx)(F,{testId:`changes-tab-status`,messageKey:e[0]}):(0,V.jsx)(z,{icon:(0,V.jsx)($,{}),children:e.map(e=>(0,V.jsx)(`span`,{className:`block`,children:t(e)},e))})}function mt(){let{data:e,isSuccess:t,isError:n,error:r,isLoading:i}=K(),[a,o]=B.useState(null),{curAgentState:s}=oe(),c=!h.includes(s),l=r&&dt.test(m(r));return B.useEffect(()=>{if(!c)o([_.DIFF_VIEWER$WAITING_FOR_RUNTIME]);else if(r){let e=m(r);dt.test(e)?o([_.DIFF_VIEWER$NOT_A_GIT_REPO,_.DIFF_VIEWER$ASK_OH]):o([e])}else o(i?[_.DIFF_VIEWER$LOADING]:null)},[c,l,i,r,o]),(0,V.jsx)(`main`,{className:`h-full w-full flex flex-col items-stretch`,children:!t||!e.length?(0,V.jsxs)(`div`,{className:`flex flex-col h-full w-full`,children:[(0,V.jsxs)(`div`,{className:`flex-1 flex items-center justify-center`,children:[a&&(0,V.jsx)(pt,{messages:a}),!a&&t&&e.length===0&&(0,V.jsx)(st,{})]}),!n&&t&&e.length===0&&(0,V.jsx)(ut,{})]}):(0,V.jsx)(`div`,{className:`h-full overflow-y-auto flex flex-col items-stretch custom-scrollbar-always`,children:e.slice(0,100).map(e=>(0,V.jsx)(ot,{path:e.path,type:e.status},e.path))})})}var ht=(e,t)=>{let{conversationId:n}=R(),{data:r}=I(),i=b(),a=r?.conversation_url,o=r?.session_api_key,c=r?.selected_repository,l=r?.workspace?.working_dir?.trim(),u=B.useMemo(()=>G(c,l),[c,l]);return s({queryKey:[`commit_changes`,n,a,o,u,e],queryFn:async()=>{if(!n)throw Error(`No conversation ID`);return W.getCommitChanges(a,o,u,e)},staleTime:1/0,gcTime:1e3*60*15,retry:!1,enabled:t.enabled&&i&&!!n,meta:{disableToast:!0}})};function gt({commit:e,showAuthor:t,isExpanded:n,onToggle:r}){let{t:a}=i(`openhands`),{data:o,isLoading:s,isSuccess:c}=ht(e.sha,{enabled:n});return(0,V.jsxs)(`div`,{"data-testid":`commit-row`,className:`w-full flex flex-col`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,"data-testid":`commit-row-toggle`,className:`w-full flex items-center gap-2 px-3 py-2.5 border-b border-[var(--oh-border)] text-sm text-content text-left hover:cursor-pointer`,children:[(0,V.jsx)(`code`,{className:`font-mono text-xs text-[var(--oh-muted)] flex-shrink-0`,children:e.shortSha}),(0,V.jsx)(`strong`,{className:`flex-1 truncate font-medium`,children:e.subject}),t&&(0,V.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] truncate max-w-32 flex-shrink-0`,children:e.author}),(0,V.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)] flex-shrink-0`,children:`${j(e.timestamp)} ${a(_.CONVERSATION$AGO)}`}),(0,V.jsx)(Qe,{className:g(`w-4 h-4 transition-transform flex-shrink-0`,!n&&`transform rotate-180`)})]}),n&&(0,V.jsxs)(`div`,{"data-testid":`commit-row-content`,className:`w-full flex flex-col pl-6`,children:[s&&(0,V.jsx)(`div`,{className:`p-3`,children:(0,V.jsx)(et,{className:`w-4 h-4`})}),c&&o?.map(t=>(0,V.jsx)(ot,{path:t.path,type:t.status,commit:e.sha},t.path))]})]})}function _t({commits:e,hasMore:t}){let{t:n}=i(`openhands`),[r,a]=B.useState(null),o=new Set(e.map(e=>e.author)).size>1;return(0,V.jsxs)(`section`,{"data-testid":`commit-list`,className:`w-full flex flex-col`,children:[e.map(e=>(0,V.jsx)(gt,{commit:e,showAuthor:o,isExpanded:r===e.sha,onToggle:()=>a(t=>t===e.sha?null:e.sha)},e.sha)),t&&(0,V.jsx)(`div`,{"data-testid":`commit-list-cap-notice`,className:`px-3 py-2.5 text-xs text-[var(--oh-muted)]`,children:n(_.DIFF_VIEWER$COMMITS_CAP,{count:e.length})})]})}function vt(){let{t:e}=i(`openhands`),{conversationId:t}=R(),{commits:n,hasMore:r,isUnsupported:a,isLoading:o,isSuccess:s}=Ze(),{curAgentState:c}=oe(),l=!h.includes(c);return(0,V.jsx)(`main`,{className:`h-full w-full flex flex-col items-stretch`,children:s&&!a&&n.length>0?(0,V.jsx)(`div`,{className:`h-full overflow-y-auto flex flex-col items-stretch custom-scrollbar-always`,children:(0,V.jsx)(_t,{commits:n,hasMore:r},t)}):(0,V.jsxs)(`div`,{className:`flex-1 flex items-center justify-center`,children:[!l&&(0,V.jsx)(F,{testId:`commits-tab-status`,messageKey:_.DIFF_VIEWER$WAITING_FOR_RUNTIME}),l&&o&&(0,V.jsx)(F,{testId:`commits-tab-status`,messageKey:_.DIFF_VIEWER$LOADING}),l&&!o&&(0,V.jsx)(z,{icon:(0,V.jsx)($,{}),children:e(_.DIFF_VIEWER$NO_COMMITS)})]})})}function yt(){let{t:e}=i(`openhands`);Re();let{hasAttachedSource:t,isLoading:n}=je(),{hasCommits:a}=Me({enabled:t}),{conversationId:o}=se(),{state:s,setFilesTabDiffView:c,setFilesTabContentViewMode:l}=ee(o??``),u=(t||n)&&a!==!1,d=s.filesTabDiffView??u,f=s.filesTabContentViewMode,{isSuccess:p,isUnsupported:m}=Ze(),h=p&&!m,[g,v]=(0,B.useState)(!1),y=d?`on`:`off`;g&&h&&(y=`commits`);let[b,x]=(0,B.useState)(!1),S=xe(),C=(0,B.useMemo)(()=>S.data??[],[S.data]),w=L(e=>e.selectedPath),T=L(e=>e.selectedConversationId),E=L(e=>e.setSelectedPath),D=T===o?w:null,O=(0,B.useCallback)(e=>E(e,o),[o,E]),k=Ae(D),A=J(e=>e.count),j=we(k.data?.staticUrl??null,A);(0,B.useEffect)(()=>{T!==o&&E(null,o)},[T,o,E]),(0,B.useEffect)(()=>{if(D||C.length===0)return;let[e]=We(C);e&&E(e,o)},[C,D,o,E]);let M=r(),{refetch:N,isFetching:P}=K(),te=()=>{N(),M.invalidateQueries({queryKey:[`workspace-files`]}),M.invalidateQueries({queryKey:[`workspace-file-content`]}),M.invalidateQueries({queryKey:[`git_commits`]})};return(0,V.jsxs)(`main`,{className:`h-full w-full flex flex-col items-stretch`,"data-testid":`files-tab`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1.5 border-b border-[var(--oh-border)]`,children:[(0,V.jsx)(ne,{ariaLabel:e(_.FILES$DIFF_VIEW),testId:`files-tab-diff-toggle`,value:y,options:[{value:`on`,label:e(_.FILES$DIFF_VIEW)},...h?[{value:`commits`,label:e(_.DIFF_VIEWER$COMMITS)}]:[],{value:`off`,label:e(_.COMMON$FILES)}],onChange:e=>{e===`commits`?v(!0):(v(!1),c(e===`on`))}}),y===`off`&&(0,V.jsx)(ne,{ariaLabel:e(_.FILES$RICH),testId:`files-tab-content-mode-toggle`,value:f,options:[{value:`rich`,label:e(_.FILES$RICH)},{value:`plain`,label:e(_.FILES$PLAIN)}],onChange:l}),(0,V.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[y===`off`&&j&&(0,V.jsx)(`a`,{href:j,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e(_.FILES$OPEN_IN_NEW_WINDOW),title:e(_.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,V.jsx)(ue,{width:14,height:14})}),(0,V.jsx)(`button`,{type:`button`,onClick:te,disabled:P,"aria-label":e(_.FILES$REFRESH),title:e(_.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,V.jsx)(Xe,{width:12.75,height:15,color:`#ffffff`,className:P?`animate-spin`:``})})]})]}),y===`on`&&(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(mt,{})}),y===`commits`&&(0,V.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,V.jsx)(vt,{})}),y===`off`&&(0,V.jsx)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:S.isLoading?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-[var(--oh-muted)]`,children:e(_.FILES$LOADING_FILES)}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ge,{paths:C,selectedPath:D,onSelectFile:O,isTreeVisible:b,onToggleTree:()=>x(e=>!e)}),(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1`,children:[b&&(0,V.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,V.jsx)(de,{paths:C,selectedPath:D,onSelectFile:O})}),(0,V.jsx)(`section`,{className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,"data-testid":`files-tab-content`,children:D?(0,V.jsx)(Ye,{path:D,viewMode:f}):(0,V.jsx)(pe,{})})]})]})})]})}export{yt as default};
|