PageSourceSearch

https://platform.unago.ai/assets/ComputerStatus-CqY_khQJ.js

js unago.ai collected 2026-10-05 13:13:17 UTC 7,081 bytes, 1 lines download raw bytes

1import{o as M,r as T}from"./rolldown-runtime-ChpBd9eV.js";import{a as $,n as q}from"./vendor-react-DcWoBPJp.js";import{Kr as G,Ur as C,_i as O,_t as H,na as V,si as W}from"./vendor-ui-hcrcJjHJ.js";import{h as S}from"./feedback-B_rujiCb.js";import{w as K}from"./AuthContext-CWrypuf9.js";import{t as u}from"./utils-BYBzgThh.js";import{m as N}from"./index-CL2aAkkR.js";import"./design-system-r4WSOo7r.js";import{f as x}from"./useToolDescriptions-CigA4JE-.js";import{t as Q}from"./VMScreenViewer-Cn7YYn3b.js";import{a as U,n as X,o as Z,r as J,t as Y}from"./dialog-FavpecDN.js";import{a as ee,o as te}from"./MCPUIContext-Bbsgp6Lp.js";var ye=T({ComputerStatus:()=>E,ComputerViewerDialog:()=>F}),i=M($(),1),e=q(),re="min(95vw, 1280px)",ae={stopped:{bg:"bg-gray-100 dark:bg-gray-800",text:"text-gray-600 dark:text-gray-400",label:"Computer",iconColor:"text-gray-400 dark:text-gray-500"},starting:{bg:"bg-yellow-100 dark:bg-yellow-900/50",text:"text-yellow-700 dark:text-yellow-300",label:"Starting...",iconColor:"text-yellow-500"},running:{bg:"bg-green-100 dark:bg-green-900/50",text:"text-green-700 dark:text-green-300",label:"Computer",iconColor:"text-green-500"},paused:{bg:"bg-orange-100 dark:bg-orange-900/50",text:"text-orange-700 dark:text-orange-300",label:"Paused",iconColor:"text-orange-500"},hibernated:{bg:"bg-blue-100 dark:bg-blue-900/50",text:"text-blue-700 dark:text-blue-300",label:"Hibernated",iconColor:"text-blue-500"}};function se(s,a){if(s)return s;const r=a[a.length-1];return r?.streamSessionId?r.streamSessionId:r?.sessionId?r.sessionId:null}function oe({state:s,isMutating:a,iconColor:r}){return a||s==="starting"?(0,e.jsx)(O,{className:"h-5 w-5 animate-spin"}):s==="running"?(0,e.jsx)(C,{className:u("h-5 w-5",r)}):(0,e.jsx)(C,{className:u("h-5 w-5",r)})}function E({className:s,disabled:a=!1,enabled:r=!0,variant:o="default"}){const{state:n,status:d,isLoading:g,isMutating:t,start:l,startAsync:p}=te({enabled:r}),I=K(),k=ee(m=>m.open),[f,v]=(0,i.useState)(!1),[L,b]=(0,i.useState)(null),h=n==="running",j=n==="stopped"||n==="paused"||n==="hibernated",w=n==="starting",R=I.length>0,B=ae[n],c=h||R?se(d?.vmId,I):null;(0,i.useEffect)(()=>{f&&c&&b(c)},[f,c]);const z=(0,i.useCallback)(()=>{t||(h?k():j&&(k(),l()))},[t,h,j,k,l]),P=(0,i.useCallback)(async m=>{if(m.stopPropagation(),!(t||w)){if(c){b(c),v(!0);return}try{const y=await p(),D=y?.vmId||y?.sessionId||null;D&&b(D),v(!0)}catch(y){console.error("[ComputerStatus] Failed to start browser session:",y)}}},[t,w,c,p]),A=(0,i.useCallback)(()=>{v(!1),b(null)},[]);if(g){const m=o==="task"?S:N;return(0,e.jsxs)("div",{className:u("inline-flex items-center gap-1",s),"aria-label":"Loading computer status","data-testid":"computer-status","data-loading":"true",children:[(0,e.jsx)(m,{type:"button",disabled:!0,variant:"outline",size:"icon",className:o==="task"?x:`${x} rounded-xl text-gray-400 opacity-60 dark:text-gray-500`,"aria-label":"Computer status is loading",children:(0,e.jsx)(C,{className:"h-5 w-5","aria-hidden":"true"})}),(0,e.jsx)(m,{type:"button",disabled:!0,variant:"outline",size:"icon",className:o==="task"?x:`${x} rounded-xl text-gray-400 opacity-60 dark:text-gray-500`,"aria-label":"Browser status is loading",children:(0,e.jsx)(V,{className:"h-5 w-5","aria-hidden":"true"})})]})}const _=L||c;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"inline-flex items-center gap-1","data-testid":"computer-status","data-loading":"false",children:[(0,e.jsx)(ne,{config:B,state:n,isMutating:t,isStarting:w,isRunning:h,isStopped:j,onClick:z,className:s,disabled:a,variant:o}),(0,e.jsx)(le,{onClick:P,isBusy:t||w,disabled:a,variant:o})]}),f&&_&&(0,e.jsx)(F,{streamSessionId:_,isOpen:f,onClose:A})]})}E.displayName="ComputerStatus";function ne({config:s,state:a,isMutating:r,isStarting:o,isRunning:n,isStopped:d,onClick:g,className:t,disabled:l=!1,variant:p}){return(0,e.jsx)(p==="task"?S:N,{type:"button",onClick:g,disabled:l||r||o,variant:"outline",size:"icon",className:u(x,p==="default"&&"rounded-xl text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300",!r&&!o&&"cursor-pointer",(r||o)&&"cursor-wait opacity-70",t),"aria-label":`Computer: ${s.label}. ${n||d?"Click to manage":""}`,title:n?"Open computer manager":d?"Open manager and start computer":s.label,children:(0,e.jsx)(oe,{state:a,isMutating:r,iconColor:s.iconColor})})}function le({onClick:s,isBusy:a,disabled:r=!1,variant:o}){return(0,e.jsx)(o==="task"?S:N,{type:"button",onClick:s,disabled:r||a,variant:"outline",size:"icon",className:u(x,o==="default"&&"rounded-xl text-gray-400 hover:text-blue-600 dar
1k:text-gray-500 dark:hover:text-blue-400",!a&&!r&&"cursor-pointer",a&&"cursor-wait opacity-70",r&&"cursor-not-allowed opacity-50"),"aria-label":"View browser screen",title:a?"Starting browser":"View browser",children:a?(0,e.jsx)(O,{className:"h-5 w-5 animate-spin"}):(0,e.jsx)(V,{className:"h-5 w-5"})})}function F({streamSessionId:s,isOpen:a,onClose:r}){const[o,n]=(0,i.useState)(!1),d=(0,i.useCallback)(t=>{if(!t)return;const l=()=>n(document.fullscreenElement===t);return document.addEventListener("fullscreenchange",l),()=>document.removeEventListener("fullscreenchange",l)},[]),g=(0,i.useCallback)(async()=>{const t=document.querySelector("[data-viewer-dialog]");if(t)try{document.fullscreenElement?await document.exitFullscreen():await t.requestFullscreen()}catch(l){console.error("[ViewerDialog] Fullscreen error:",l)}},[]);return(0,e.jsx)(Y,{open:a,onOpenChange:t=>{t||r()},children:(0,e.jsxs)(X,{className:"!max-w-none max-h-[95vh] flex flex-col p-0 gap-0 overflow-hidden [&>button[class*='absolute']]:hidden",style:{width:re},onEscapeKeyDown:t=>t.preventDefault(),onPointerDownOutside:t=>t.preventDefault(),onInteractOutside:t=>t.preventDefault(),ref:d,"data-viewer-dialog":!0,children:[(0,e.jsxs)(U,{className:"px-3 py-2 border-b border-gray-200 dark:border-gray-700 flex flex-row items-center justify-between space-y-0",children:[(0,e.jsxs)(Z,{className:"flex items-center gap-2 text-sm font-medium",children:[(0,e.jsx)(C,{className:"h-4 w-4 text-blue-500"}),"Computer Browser"]}),(0,e.jsx)(J,{className:"sr-only",children:"Live view of the VM browser session"}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("button",{type:"button",onClick:g,title:o?"Exit fullscreen":"Enter fullscreen",className:u("p-1.5 rounded-md transition-colors","text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700"),children:o?(0,e.jsx)(G,{className:"h-4 w-4"}):(0,e.jsx)(W,{className:"h-4 w-4"})}),(0,e.jsx)("button",{type:"button",onClick:r,title:"Close viewer",className:u("p-1.5 rounded-md transition-colors","text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-400","hover:bg-red-100 dark:hover:bg-red-900/30"),children:(0,e.jsx)(H,{className:"h-4 w-4"})})]})]}),(0,e.jsx)("div",{className:"relative flex flex-col min-h-0",style:{aspectRatio:"16 / 9"},children:(0,e.jsx)(Q,{sessionId:s,vmResolution:{width:1280,height:720},className:"h-full min-h-0",autoStart:!0})})]})})}export{ye as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.