@adhdev/daemon-standalone 0.5.16 → 0.5.18
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/package.json
CHANGED
|
@@ -196,4 +196,4 @@ ${I}`,_localId:`sys_approval_${Date.now()}`};le(Z=>{for(const fe of Object.keys(
|
|
|
196
196
|
}
|
|
197
197
|
`})]})}function GR(e){return e.split(":")[0]||""}function QR({renderHeaderActions:e}={}){var ce,Le,Se;const{id:t}=Ty(),r=Os(),n=hp(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=gi(),l=w.useMemo(()=>GR(t||""),[t]),a=w.useMemo(()=>i.find(ae=>ae.id===t),[i,t]),c=(a==null?void 0:a.type)||void 0,d=c?c.charAt(0).toUpperCase()+c.slice(1):"IDE",h=(a==null?void 0:a.activeChat)||null,f=(a==null?void 0:a.agentStreams)||[],p=n.isConnected??!0,m=s[l]||(p?"connected":"new"),g=w.useMemo(()=>i.find(ae=>ae.id===l||ae.daemonId===l),[i,l]),S=(g==null?void 0:g.machineNickname)||((ce=g==null?void 0:g.machine)==null?void 0:ce.hostname)||"",_=(a==null?void 0:a.workspace)||"",[y]=Ik(),b=typeof window<"u"&&window.innerWidth<=768,C=y.get("view")||(b?"chat":"split"),[P,E]=w.useState(C),[F,T]=w.useState("ide"),[V,N]=w.useState(""),[D,R]=w.useState(!1),[M,W]=w.useState(null),[O,A]=w.useState(null),[H,L]=w.useState([]),U=h==null?void 0:h.status,x=(((Se=(Le=h==null?void 0:h.activeModal)==null?void 0:Le.buttons)==null?void 0:Se.length)??0)>0,Q=U==="generating"||U==="loading"||U&&U.toLowerCase()==="thinking",k=x||U==="waiting_approval"?"waiting_approval":Q?"working":U||"idle",_e=w.useMemo(()=>{var ae,$;return{ideId:t||"",daemonId:l,agentName:Dd(c||""),agentType:c||"",status:k,title:(h==null?void 0:h.title)||"",messages:(h==null?void 0:h.messages)||[],ideType:c||"",workspaceName:(a==null?void 0:a.workspaceName)||"",displayPrimary:d,displaySecondary:(a==null?void 0:a.workspaceName)||"",cdpConnected:!0,modalButtons:(ae=h==null?void 0:h.activeModal)==null?void 0:ae.buttons,modalMessage:($=h==null?void 0:h.activeModal)==null?void 0:$.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,h,a,d,k]);w.useEffect(()=>l?dr.onScreenshot("ide-page",($,ne)=>{if($!==l)return;const we=new FileReader;we.onload=()=>W(we.result),we.readAsDataURL(ne)}):void 0,[l]),w.useEffect(()=>l?dr.onStatusEvent(($,ne)=>{if($!==l)return;let we="",Re="info";if(ne.event==="agent:generating_completed"?(we=`✅ Task completed${ne.duration?` (${ne.duration}s)`:""}`,Re="success"):(ne.event==="agent:waiting_approval"||ne.event==="agent:approval_requested")&&(we="⚡ Approval needed",Re="warning"),we){const Ie=Date.now();L(Ke=>[...Ke.slice(-4),{id:Ie,message:we,type:Re}]),setTimeout(()=>L(Ke=>Ke.filter(Oe=>Oe.id!==Ie)),Re==="warning"?1e4:5e3)}}):void 0,[l]),w.useEffect(()=>{const ae=l?dr.get(l):null;!ae||!(m==="connected")||(P!=="chat"?ae.startScreenshots(c):ae.stopScreenshots(c))},[P,m,c,l]);const K=w.useCallback(async(ae,$={})=>{if(!t)throw new Error("No IDE ID");const ne={...$};if(!ne._targetInstance&&t){const Re=t.split(":");Re.length>=3&&(Re[1]==="ide"||Re[1]==="cli")&&(ne._targetInstance=Re.slice(2).join(":"),ne._targetType=Re[1])}const we=l?dr.get(l):null;return we!=null&&we.hasCommandChannel?await we.sendCommand(ae,ne):we&&we.connectionState!=="failed"&&we.connectionState!=="closed"&&await new Promise(Ie=>{const Ge=Date.now(),Ke=()=>{if(we.hasCommandChannel)return Ie(!0);if(Date.now()-Ge>3e3)return Ie(!1);setTimeout(Ke,200)};Ke()})&&we.hasCommandChannel?await we.sendCommand(ae,ne):await o(t,ae,ne)},[t,l]),q=async()=>{const ae=V.trim();if(!(!ae||!t||D)){N(""),R(!0);try{await K("send_chat",{message:ae,waitForResponse:!0})}catch($){console.error("[IDE] Send failed:",$)}finally{R(!1)}}},J=async ae=>{if(t)try{const $=await o(t,"screenshot",{width:ae?Math.min(ae,1280):1280});$!=null&&$.success&&($!=null&&$.base64)&&A(`data:image/jpeg;base64,${$.base64}`)}catch($){console.error("[IDE] Screenshot failed:",$)}},me=f.length>0;return t?u.jsxs("div",{className:"ide-page",children:[u.jsxs("header",{className:"ide-header",children:[u.jsxs("div",{className:"ide-header-left",children:[u.jsxs("div",{className:"ide-title",children:[u.jsx(Xa,{size:16}),u.jsx("span",{className:"ide-name",children:d}),u.jsx("span",{className:"ide-name-mobile",children:"IDE"}),_&&u.jsx("span",{className:"ide-workspace",children:_}),u.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),u.jsxs("div",{className:"ide-status-pill",children:[u.jsx("span",{className:`ide-dot ${m==="connected"?"online":"connecting"}`}),u.jsx("span",{className:"ide-status-text",children:m==="connected"?"Connected":m==="connecting"?"Connecting":"WS"})]}),S&&u.jsx("span",{className:"ide-machine-label",children:S})]}),u.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(ae=>u.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:P===ae?"1px solid var(--accent-primary)":"none",background:P===ae?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:P===ae?"var(--accent-primary)":void 0},onClick:()=>E(ae),children:ae==="chat"?u.jsx(Xa,{size:14}):ae==="split"?"⊞":u.jsx(Mo,{size:14})},ae)),e&&e({daemonId:l,ideInstanceId:t||""}),u.jsxs("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs flex items-center justify-center shrink-0",onClick:()=>r(-1),children:["←",u.jsx("span",{className:"hidden md:inline ml-1",children:"Back"})]})]})]}),u.jsxs("div",{className:"ide-content",children:[u.jsxs("div",{className:`ide-chat-panel ${P==="chat"?"full":""} ${P==="remote"?"hidden":""}`,children:[me&&u.jsxs("div",{className:"ide-chat-tabs",children:[u.jsx("button",{className:`ide-chat-tab ${F==="ide"?"active":""}`,onClick:()=>T("ide"),children:d}),u.jsxs("button",{className:`ide-chat-tab ext ${F==="extensions"?"active":""}`,onClick:()=>T("extensions"),children:["Extensions ",u.jsx("span",{className:"ide-ext-badge",children:f.length})]})]}),F==="extensions"&&me?u.jsx(eP,{ideId:t,agentStreams:f,sendCommand:async(ae,$)=>{try{const ne=l?dr.get(l):null;if(ne&&m==="connected"){await Promise.race([ne.sendCommand(ae,$),new Promise((we,Re)=>setTimeout(()=>Re(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,ae,$)}}):u.jsx(B1,{activeConv:_e,ides:i,agentInput:V,setAgentInput:N,handleSendChat:q,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[],userName:n.userName})]}),u.jsx("div",{className:`ide-remote-panel ${P==="remote"?"full":""} ${P==="chat"?"hidden":""}`,children:u.jsx(xM,{screenshot:O,isCapturing:!1,onRefresh:J,addLog:()=>{},connState:m,connScreenshot:M,onAction:async(ae,$)=>{const ne=l?dr.get(l):null;if(ne&&m==="connected")try{return await ne.sendInput(ae,$)}catch(we){console.error("[Connection Input] Failed:",we)}return await o(t,"cdp_remote_action",{action:ae,params:$})}})})]}),H.length>0&&u.jsx("div",{className:"ide-toasts",children:H.map(ae=>u.jsx("div",{className:`ide-toast ${ae.type}`,onClick:()=>L($=>$.filter(ne=>ne.id!==ae.id)),children:ae.message},ae.id))})]}):u.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function JR(e){const t=Math.floor((Date.now()-e)/1e3);return t<45?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function ZR(){var mp,gp,_p,vp,xp,yp,wp,bp,Sp,kp;const{id:e}=Ty(),t=Os(),{sendCommand:r}=gi(),n=r,i=hp(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=w.useState([]),[c,d]=w.useState([]),[h,f]=w.useState(0),[p,m]=w.useState(!0),[g,S]=w.useState("debug"),[_,y]=w.useState(null),[b,C]=w.useState([]),[P,E]=w.useState(!1),[F,T]=w.useState(""),[V,N]=w.useState(""),[D,R]=w.useState(""),[M,W]=w.useState(""),[O,A]=w.useState(""),[H,L]=w.useState(""),[U,x]=w.useState(""),[Q,le]=w.useState("overview"),[k,_e]=w.useState([]),[K,q]=w.useState(!1),[J,me]=w.useState(!1),[ce,Le]=w.useState(""),[Se,ae]=w.useState([]),[$,ne]=w.useState(!1),[we,Re]=w.useState(null),[Ie,Ge]=w.useState("all"),[Ke,Oe]=w.useState(""),[We,Je]=w.useState(!1),[Qt,Jt]=w.useState({}),[gn,Y]=w.useState(null),[j,z]=w.useState(null),X=w.useRef(null),ee=w.useRef(!1);w.useEffect(()=>{if(!e||Q!=="logs"||!p)return;const v=async()=>{try{const se=await r(e,"get_logs",{count:200,minLevel:g,since:h}),ke=(se==null?void 0:se.result)||se;if(se!=null&&se.success&&Array.isArray(ke==null?void 0:ke.logs)&&ke.logs.length>0){d(yr=>[...yr,...ke.logs.map(Vr=>({timestamp:Vr.ts,level:Vr.level,message:`[${Vr.category}] ${Vr.message}`}))].slice(-300));const Ye=Math.max(...ke.logs.map(yr=>yr.ts));f(Ye)}}catch{}};v();const B=setInterval(v,3e3);return()=>clearInterval(B)},[e,Q,p,h,g]),w.useEffect(()=>{if(p&&c.length>0){const v=ee.current?"smooth":"instant";setTimeout(()=>{var B;(B=X.current)==null||B.scrollIntoView({behavior:v}),ee.current=!0},50)}},[c.length,l.length,p]),w.useEffect(()=>{Q!=="logs"&&(ee.current=!1)},[Q]),w.useEffect(()=>{if(!e||Q!=="ides")return;(async()=>{try{const B=await r(e,"get_ide_extensions",{}),se=(B==null?void 0:B.result)||B;se!=null&&se.success&&(se!=null&&se.ides)&&Jt(se.ides)}catch{}})()},[e,Q]);const de=async()=>{var v;if(e){ne(!0);try{const B=await r(e,"get_provider_settings",{}),se=(B==null?void 0:B.result)||B;if(B!=null&&B.success&&(se!=null&&se.settings)){const ke=[];for(const[Ye,yr]of Object.entries(se.settings)){const cr=te.find(Vr=>Vr.type===Ye);ke.push({type:Ye,displayName:(cr==null?void 0:cr.displayName)||Ye,icon:(cr==null?void 0:cr.icon)||"",category:(cr==null?void 0:cr.category)||"unknown",schema:yr,values:((v=se.values)==null?void 0:v[Ye])||{}})}ke.sort((Ye,yr)=>Ye.category.localeCompare(yr.category)||Ye.displayName.localeCompare(yr.displayName)),ae(ke)}}catch{}ne(!1)}};w.useEffect(()=>{Q==="providers"&&Se.length===0&&de()},[Q]);const De=async(v,B,se)=>{Re(`${v}.${B}`),ae(ke=>ke.map(Ye=>Ye.type===v?{...Ye,values:{...Ye.values,[B]:se}}:Ye));try{const ke=await r(e,"set_provider_setting",{providerType:v,key:B,value:se});ke!=null&&ke.success||de()}catch{de()}Re(null)},he=s.find(v=>v.id===e&&v.daemonMode),I=he?{id:he.id,hostname:((mp=he.machine)==null?void 0:mp.hostname)||he.id,platform:((gp=he.machine)==null?void 0:gp.platform)||"unknown",arch:((_p=he.machine)==null?void 0:_p.arch)||"",cpus:((vp=he.machine)==null?void 0:vp.cpus)||0,totalMem:((xp=he.machine)==null?void 0:xp.totalMem)||0,freeMem:((yp=he.machine)==null?void 0:yp.freeMem)||0,availableMem:(wp=he.machine)==null?void 0:wp.availableMem,loadavg:((bp=he.machine)==null?void 0:bp.loadavg)||[],uptime:((Sp=he.machine)==null?void 0:Sp.uptime)||0,release:((kp=he.machine)==null?void 0:kp.release)||"",cdpConnected:!!(he.ides||[]).some(v=>v.cdpConnected),machineNickname:he.machineNickname||null,p2p:he.p2p||{available:!1,state:"unavailable",peers:0,screenshotActive:!1},detectedIdes:he.detectedIdes||[],managedIdeIds:he.managedIdeIds||[],managedCliIds:he.managedCliIds||[],workspaces:he.workspaces||[],defaultWorkspaceId:he.defaultWorkspaceId??he.activeWorkspaceId??null,defaultWorkspacePath:he.defaultWorkspacePath??he.activeWorkspacePath??null,workspaceActivity:he.workspaceActivity||[]}:null,te=(he==null?void 0:he.availableProviders)||[],Z={};for(const v of te)Z[v.type]=v.icon;const fe=v=>Z[v]||"",Pe=te.filter(v=>v.category==="cli"),ze=te.filter(v=>v.category==="acp");w.useEffect(()=>{!D&&Pe.length>0&&R(Pe[0].type)},[D,Pe.length]),w.useEffect(()=>{!M&&ze.length>0&&W(ze[0].type)},[M,ze.length]);const st=s.filter(v=>v.daemonId===e&&!v.daemonMode).filter(v=>!F_(v)&&!W_(v)).map(v=>({id:v.id,type:v.type,version:v.version||"",instanceId:v.instanceId||"",status:v.status,workspace:v.workspace||null,terminals:v.terminals||0,aiAgents:EM(v.aiAgents||v.agents||[]),activeChat:v.activeChat||null,chats:v.chats||[],agentStreams:v.agentStreams||[],cdpConnected:v.cdpConnected||!1,daemonId:e})),be=s.filter(v=>v.daemonId===e&&F_(v)).map(v=>({id:v.id,type:v.type,cliName:v.cliName||v.type,status:v.status,workspace:v.workspace||"",activeChat:v.activeChat||null,daemonId:e})),Te=s.filter(v=>v.daemonId===e&&W_(v)).map(v=>({id:v.id,type:v.type,acpName:v.cliName||v.type,status:v.status,workspace:v.workspace||"",activeChat:v.activeChat||null,currentModel:v.currentModel,currentPlan:v.currentPlan,daemonId:e})),Ce=(I==null?void 0:I.detectedIdes)||[],xe=(v,B)=>{a(se=>[...se.slice(-100),{timestamp:Date.now(),level:v,message:B}]),setTimeout(()=>{var se;return(se=X.current)==null?void 0:se.scrollIntoView({behavior:"smooth"})},100)},Ue=async v=>{if(!(!e||_)){y(v),xe("info",`Launching ${jr(v)}...`);try{const B=await r(e,"launch_ide",{ideType:v,enableCdp:!0});xe(B!=null&&B.success?"info":"error",B!=null&&B.success?`${jr(v)} launched`:`Failed: ${B==null?void 0:B.error}`)}catch(B){xe("error",`Launch error: ${B.message}`)}finally{y(null)}}},ye=async v=>{if(!e)return;const{cliType:B,dir:se,workspaceId:ke,useDefaultWorkspace:Ye,useHome:yr,argsStr:cr,model:Vr}=v;if(!B){xe("warn","Select a CLI or ACP provider first");return}const lw=cr?cr.split(/\s+/).filter(Boolean):void 0,Cp=(se==null?void 0:se.trim())||(ke?"(saved id)":Ye?"(default workspace)":yr?"(home)":"");xe("info",`Launching ${B}${Cp?` in ${Cp}`:""}${Vr?` (model: ${Vr})`:""}...`);try{const xi={cliType:B,cliArgs:lw,initialModel:Vr||void 0};se!=null&&se.trim()?xi.dir=se.trim():ke?xi.workspaceId=ke:Ye?xi.useDefaultWorkspace=!0:yr&&(xi.useHome=!0);const wr=await r(e,"launch_cli",xi),_n=(wr==null?void 0:wr.result)||wr;wr!=null&&wr.success?(xe("info",`${B} launched`),(_n==null?void 0:_n.launchSource)==="home"?xe("info","📂 Running in home directory (explicit choice)"):(_n==null?void 0:_n.launchSource)==="defaultWorkspace"&&xe("info","📂 Using default workspace (explicit choice)")):(xe("error",`Failed: ${(wr==null?void 0:wr.error)||(_n==null?void 0:_n.error)}`),(wr==null?void 0:wr.code)==="WORKSPACE_LAUNCH_CONTEXT_REQUIRED"&&z({cliType:B,argsStr:cr,model:Vr}))}catch(xi){xe("error",`Launch error: ${xi.message}`)}},qe=(v,B,se,ke)=>{if(e){if(!v){xe("warn","Select a provider");return}if(!B.trim()){z({cliType:v,argsStr:se,model:ke});return}ye({cliType:v,dir:B,argsStr:se,model:ke})}},pt=async(v,B,se)=>{if(e&&window.confirm(`Stop ${v}?
|
|
198
198
|
This will terminate the process.`))try{const ke=await r(e,"stop_cli",{cliType:v,dir:B,_targetInstance:se});ke!=null&&ke.success?xe("info",`${v} stopped`):xe("error",`Stop failed: ${(ke==null?void 0:ke.error)||"Unknown error"}`)}catch(ke){xe("error",`Stop failed: ${ke.message}`)}},Ct=async v=>{try{await r(v.daemonId,"restart_ide",{ideType:v.type}),xe("info",`${jr(v.type)} restart initiated`)}catch(B){xe("error",`Restart failed: ${B.message}`)}},ar=async v=>{if(window.confirm(`Stop ${jr(v.type)}?
|
|
199
|
-
This will disconnect CDP and optionally kill the process.`))try{const B=await r(v.daemonId,"stop_ide",{ideType:v.type,killProcess:!0});B!=null&&B.success?xe("info",`${jr(v.type)} stopped`):xe("error",`Stop failed: ${(B==null?void 0:B.error)||"Unknown error"}`)}catch(B){xe("error",`Stop failed: ${B.message}`)}},Zt=async()=>{if(e)try{const v=await r(e,"detect_ides",{});xe("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){xe("error",`Detection failed: ${v.message}`)}},xr=async()=>{if(e){E(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&C(v.result)}catch(v){xe("error",`Failed: ${v.message}`)}finally{E(!1)}}},Ji=async()=>{if(!(!e||!Ke.trim())){Je(!0);try{const v=await r(e,"workspace_add",{path:Ke.trim()});v!=null&&v.success?(xe("info",`Workspace added: ${Ke.trim()}`),Oe("")):xe("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){xe("error",v.message)}finally{Je(!1)}}},Rc=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){Je(!0);try{const B=await r(e,"workspace_remove",{id:v});B!=null&&B.success?xe("info","Workspace removed"):xe("error",(B==null?void 0:B.error)||"workspace_remove failed")}catch(B){xe("error",B.message)}finally{Je(!1)}}},Ic=async v=>{if(e){Je(!0);try{const B=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(B!=null&&B.success){xe("info",v?"Default workspace updated":"Default workspace cleared");const se=typeof B.defaultWorkspacePath=="string"?B.defaultWorkspacePath:"";se&&(T(se),A(se))}else xe("error",(B==null?void 0:B.error)||"workspace_set_default failed")}catch(B){xe("error",B.message)}finally{Je(!1)}}},Dc=async v=>{if(!e||!v.trim())return;const B=v.trim();Je(!0);try{const se=await r(e,"workspace_set_default",{path:B});se!=null&&se.success?(xe("info","Default workspace set from history"),T(B),A(B)):xe("error",(se==null?void 0:se.error)||"Could not set default (path missing on disk?)")}catch(se){xe("error",se.message)}finally{Je(!1)}},On=w.useCallback(async()=>{var v;if(e){q(!0);try{let B=await r(e,"get_cli_history",{});B!=null&&B.success||(B=await n(e,"get_cli_history"));const se=(B==null?void 0:B.history)??((v=B==null?void 0:B.result)==null?void 0:v.history);B!=null&&B.success&&Array.isArray(se)&&_e(se)}catch{}q(!1)}},[e,r,n]);w.useEffect(()=>{Q==="overview"&&e&&On()},[Q,e,On]);const dp=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:ce}),xe("info",`Nickname set to "${ce||"(cleared)"}"`),me(!1)}catch(v){xe("error",`Failed: ${v.message}`)}};if(!I)return o?u.jsxs("div",{className:"p-10 text-center text-text-muted",children:[u.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),u.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):u.jsx("div",{className:"p-10 text-center text-text-muted",children:u.jsx("p",{children:"⏳ Loading machine..."})});const fp=I.availableMem??I.freeMem,nw=I.totalMem>0?Math.min(100,Math.max(0,Math.round((I.totalMem-fp)/I.totalMem*100))):0,pp=I.loadavg[0]||0,iw=I.machineNickname||I.hostname,sw=(v,B,se)=>{const ke=te.find(yr=>yr.type===v),Ye=(se||[]).join(" ");(ke==null?void 0:ke.category)==="acp"?(W(v),A(B),x(Ye),le("acps")):(R(v),T(B),N(Ye),le("clis"))},ow=[{id:"overview",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(UT,{size:14})," Overview"]})},{id:"ides",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," IDEs"]}),count:st.length},{id:"clis",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(H0,{size:14})," CLIs"]}),count:be.length},{id:"acps",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(qT,{size:14})," ACP Agents"]}),count:Te.length},{id:"providers",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(F0,{size:14})," Providers"]}),count:Se.length>0?Se.length:void 0},{id:"logs",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(OT,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"dashboard-header !flex-col !items-stretch",children:[u.jsx("div",{className:"flex items-center justify-between w-full",children:u.jsxs("div",{className:"flex items-center gap-2 md:gap-3.5 w-full min-w-0",children:[u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back flex shrink-0",children:"←"}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[J?u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsx("input",{autoFocus:!0,value:ce,onChange:v=>Le(v.target.value),onKeyDown:v=>{v.key==="Enter"&&dp(),v.key==="Escape"&&me(!1)},placeholder:"Machine nickname...",className:"px-2.5 py-1 rounded-md border border-violet-500/30 bg-bg-secondary text-text-primary text-sm font-semibold w-[140px] md:w-[200px]"}),u.jsx("button",{onClick:dp,className:"machine-btn text-green-500 border-green-500/30 shrink-0",children:"✓"}),u.jsx("button",{onClick:()=>me(!1),className:"machine-btn shrink-0",children:"✕"})]}):u.jsx("h1",{className:"header-title cursor-pointer truncate",onClick:()=>{me(!0),Le(I.machineNickname||"")},title:"Click to set nickname",children:iw}),u.jsx("span",{className:"status-dot-md online shrink-0"})]}),u.jsxs("div",{className:"header-subtitle mt-1 flex-wrap gap-1 md:gap-2 items-center display-none-mobile",children:[u.jsxs("span",{children:[I.platform," · ",I.arch," · ",I.cpus," cores"]}),I.p2p.available&&u.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:I.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:I.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",I.p2p.state==="connected"?`● ${I.p2p.peers}`:"○"]}),I.cdpConnected&&u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500 shrink-0",children:"CDP ●"}),I.machineNickname&&u.jsxs("span",{className:"text-text-muted opacity-80 shrink-0",children:["(",I.hostname,")"]})]})]})]})}),u.jsx("div",{className:"machine-tabs w-full overflow-x-auto overflow-y-hidden pb-1 -mb-1 mt-2",children:ow.map(v=>u.jsxs("button",{onClick:()=>le(v.id),className:`machine-tab shrink-0${Q===v.id?" active":""}`,children:[v.label,v.count!==void 0&&u.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),u.jsxs("div",{className:"page-content",children:[Q==="overview"&&u.jsxs("div",{children:[u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[u.jsx(O_,{icon:u.jsx(Wg,{size:16}),label:"Uptime",value:CM(I.uptime)}),u.jsx(O_,{icon:u.jsx(Mo,{size:16}),label:"IDEs",value:`${st.length}`,sub:`${be.length} CLIs`})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),u.jsxs("div",{className:"flex gap-6",children:[u.jsx(z_,{value:Math.min(Math.round(pp/I.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${pp.toFixed(2)} avg / ${I.cpus} cores`}),u.jsx(z_,{value:nw,max:100,label:"Memory",color:"#3b82f6",detail:`${$_(I.totalMem-fp)} / ${$_(I.totalMem)}${I.platform==="darwin"?" (approx.)":""}`})]})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[u.jsx(Ro,{size:14})," Workspaces"]})}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:["One list for IDE, CLI, and ACP: saved paths below, and a single ",u.jsx("strong",{className:"text-text-secondary font-medium",children:"default"}),'. The default opens in the IDE when you launch it, pre-fills CLI/ACP directories, and is what "Default" launch uses.']}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[u.jsx("span",{className:"text-[10px] text-text-muted",children:"Default:"}),u.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:We,value:I.defaultWorkspaceId||"",onChange:v=>{const B=v.target.value;Ic(B===""?null:B)},children:[u.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(I.workspaces||[]).map(v=>u.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),I.defaultWorkspacePath&&u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:I.defaultWorkspacePath,children:I.defaultWorkspacePath})]}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[u.jsx("input",{className:"flex-1 min-w-[200px] text-xs bg-bg-primary border border-border-subtle rounded-lg px-2.5 py-1.5",placeholder:"Absolute workspace path to add…",value:Ke,disabled:We,onChange:v=>Oe(v.target.value),onKeyDown:v=>v.key==="Enter"&&void Ji()}),u.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:We,onClick:()=>void Ji(),children:"Add"})]}),(I.workspaces||[]).length>0&&u.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(I.workspaces||[]).map(v=>u.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[u.jsx("span",{className:"font-mono truncate flex-1",title:v.path,children:v.path}),u.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:We,onClick:()=>void Rc(v.id),children:"Remove"})]},v.id))})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle border-violet-500/15",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1 flex items-center gap-1.5",children:[u.jsx(Wg,{size:14})," Pick up where you left off"]}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:"Same workspaces as above. Re-run CLI/ACP, or open CLIs/ACP tab with a path filled; IDE launch uses the default automatically when set."}),u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent CLI / ACP launches"}),k.length>0?u.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,B)=>{const se=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.dir||"?"}`;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsxs("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,240px)]",title:v.dir,children:[fe(v.cliType)," ",se]}),u.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.dir}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void ye({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>sw(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${B}`)})}):u.jsx("p",{className:"text-[11px] text-text-muted mb-4",children:"No launch history yet — start a CLI or ACP from the tabs below, then return here."}),(I.workspaceActivity||[]).length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent workspace paths"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:(I.workspaceActivity||[]).slice(0,12).map(v=>{const B=v.path.split("/").filter(Boolean).pop()||v.path,se=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ke=(v.kind==="cli"||v.kind==="acp")&&!!v.agentType;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,200px)]",title:v.path,children:B}),se&&u.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:se}),v.agentType&&u.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),u.jsx("span",{className:"text-[9px] text-text-muted",children:JR(v.lastUsedAt)}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ke&&u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void ye({cliType:v.agentType,dir:v.path}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{T(v.path),A(v.path),le("clis")},children:"CLIs tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{T(v.path),A(v.path),le("acps")},children:"ACP tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:We,onClick:()=>void Dc(v.path),children:"Set default"})]})]},`${v.path}-${v.lastUsedAt}`)})})]})]}),u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),u.jsx("button",{onClick:()=>le("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),st.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:st.map(v=>{var se;const B=(v.agentStreams||[]).some(ke=>ke.status==="generating"||ke.status==="streaming")||((se=v.activeChat)==null?void 0:se.status)==="generating";return u.jsxs("div",{onClick:()=>t(`/ide/${v.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${B?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[u.jsx("span",{children:fe(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:jr(v.type)}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace||""}),B&&u.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),u.jsx("span",{className:`${B?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:B?"#fb923c":"#22c55e",boxShadow:B?"0 0 8px rgba(249,115,22,0.4)":"none",animation:B?"pulse-dot 1.5s infinite":"none"}})]},v.id)})})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),u.jsx("button",{onClick:()=>le("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),be.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:be.map(v=>u.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[u.jsx("span",{children:fe(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace.split("/").pop()}),u.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),I.detectedIdes.length>0&&u.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),u.jsx("div",{className:"flex flex-wrap gap-1.5",children:I.detectedIdes.map(v=>u.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${v.running?"bg-green-500/[0.06] border border-green-500/[0.12] text-green-300":"bg-bg-glass border border-border-subtle text-text-muted"}`,children:[u.jsx("span",{children:fe(v.type)}),v.name||v.type,u.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),Q==="ides"&&u.jsxs("div",{children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",st.length,")"]}),st.length===0?u.jsx("div",{className:"py-10 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No IDEs currently running. Launch one below."}):u.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:st.map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-lg",children:fe(v.type)}),u.jsx("span",{className:"font-semibold text-sm text-text-primary",children:jr(v.type)}),v.version&&u.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.version]}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),u.jsxs("div",{className:"flex gap-1.5",children:[u.jsxs("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[u.jsx(Mo,{size:13})," Control"]}),u.jsx("button",{onClick:()=>Ct(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"}),u.jsx("button",{onClick:()=>ar(v),className:"machine-btn text-red-400 border-red-500/30",children:"■ Stop"})]})]}),u.jsxs("div",{className:"text-xs text-text-secondary mb-2",children:[u.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",v.workspace||"—"]}),v.aiAgents.length>0&&u.jsx("div",{className:"flex gap-1 mb-2 flex-wrap",children:v.aiAgents.map(B=>u.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${B.status==="generating"||B.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[B.name," · ",B.status]},B.id))}),(Qt[v.type]||[]).length>0&&u.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:[u.jsx("div",{className:"text-[10px] text-text-muted font-semibold uppercase tracking-wider mb-1.5",children:"Extensions"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:(Qt[v.type]||[]).map(B=>u.jsxs("button",{disabled:gn===`${v.type}.${B.type}`,onClick:async()=>{const se=`${v.type}.${B.type}`;Y(se);try{await r(e,"set_ide_extension",{ideType:v.type,extensionType:B.type,enabled:!B.enabled}),Jt(ke=>({...ke,[v.type]:(ke[v.type]||[]).map(Ye=>Ye.type===B.type?{...Ye,enabled:!Ye.enabled}:Ye)}))}catch(ke){console.error("Extension toggle failed:",ke)}finally{Y(null)}},className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-medium border transition-colors duration-150 cursor-pointer ${B.enabled?"bg-violet-500/[0.08] border-violet-500/20 text-violet-400":"bg-bg-glass border-border-subtle text-text-muted"}`,children:[u.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${B.enabled?"bg-violet-400 shadow-[0_0_4px_rgba(139,92,246,0.4)]":"bg-zinc-600"}`}),B.name,u.jsx("span",{className:"text-[9px] font-normal",children:B.enabled?"ON":"OFF"})]},B.type))})]})]},v.id))}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",Ce.length,")"]}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:[I.defaultWorkspacePath?`Opens in default workspace: ${I.defaultWorkspacePath.split("/").filter(Boolean).pop()||I.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."," ","Multi-window supported — running IDEs can be launched again as a new window."]}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[Ce.map(v=>{const B=v.running||st.some(se=>(se.type||"").toLowerCase()===(v.type||"").toLowerCase());return u.jsxs("button",{onClick:()=>Ue(v.type||v.id||""),disabled:!!_,className:`machine-btn-primary flex items-center gap-1.5 ${B?"!border-green-500/30":""}`,style:{opacity:_&&_!==v.type?.4:1},children:[u.jsx("span",{children:fe(v.type)}),B&&u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),_===v.type?"⏳ Launching...":`▶ ${v.name||jr(v.type)}`,B&&u.jsx("span",{className:"text-[9px] text-green-400 font-normal",children:"+ window"})]},v.type)}),Ce.length===0&&u.jsxs("div",{className:"text-xs text-text-muted italic",children:["No IDEs detected.",u.jsxs("button",{onClick:Zt,className:"machine-btn ml-2 flex items-center gap-1",children:[u.jsx(FT,{size:12})," Scan"]})]})]})]}),Q==="clis"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:D,onChange:v=>R(v.target.value),className:"machine-input",children:Pe.length>0?Pe.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:F,onChange:v=>T(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:V,onChange:v=>N(v.target.value),className:"machine-input min-w-[150px]"}),u.jsx("button",{onClick:()=>qe(D,F,V||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(I!=null&&I.defaultWorkspacePath),title:I!=null&&I.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void ye({cliType:D,useDefaultWorkspace:!0,argsStr:V||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void ye({cliType:D,useHome:!0,argsStr:V||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",be.length,")"]}),be.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:be.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:fe(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),u.jsx("div",{className:"text-[11px] text-text-muted",children:v.workspace})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),v.status==="stopped"?u.jsx("button",{onClick:()=>qe(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),u.jsx("button",{onClick:On,disabled:K,className:"machine-btn",children:K?"⏳":"↻ Load"})]}),k.length>0&&u.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,B)=>{var se,ke;return u.jsxs("div",{onClick:()=>{R(v.cliType),T(v.dir),N((v.cliArgs||[]).join(" "))},className:"flex justify-between items-center px-2.5 py-1.5 rounded-md cursor-pointer bg-bg-glass border border-border-subtle text-xs transition-[background] duration-150",onMouseEnter:Ye=>Ye.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:Ye=>Ye.currentTarget.style.background="var(--bg-glass)",children:[u.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[u.jsx("span",{children:fe(v.cliType)}),u.jsx("span",{children:((se=v.dir)==null?void 0:se.split("/").filter(Boolean).pop())||"root"}),((ke=v.cliArgs)==null?void 0:ke.length)>0&&u.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),u.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},B)})}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:P,className:"machine-btn",children:P?"⏳":"↻ Load"})]}),b.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map((v,B)=>u.jsx("button",{onClick:()=>T(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Ro,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),Q==="acps"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:M,onChange:v=>W(v.target.value),className:"machine-input",children:ze.length>0?ze.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:O,onChange:v=>A(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Model (default)",value:H,onChange:v=>L(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:U,onChange:v=>x(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("button",{onClick:()=>qe(M,O,U||void 0,H||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(I!=null&&I.defaultWorkspacePath),title:I!=null&&I.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void ye({cliType:M,useDefaultWorkspace:!0,argsStr:U||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void ye({cliType:M,useHome:!0,argsStr:U||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",Te.length,")"]}),Te.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No ACP agents running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:Te.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:fe(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),u.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[u.jsx("span",{children:v.workspace}),v.currentModel&&u.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&u.jsxs("span",{className:"text-amber-500",children:["📋 ",v.currentPlan]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":v.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),u.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:u.jsx(Xa,{size:14})}),v.status==="stopped"?u.jsx("button",{onClick:()=>qe(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:P,className:"machine-btn",children:P?"⏳":"↻ Load"})]}),b.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map((v,B)=>u.jsx("button",{onClick:()=>A(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Ro,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),Q==="providers"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-4",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(v=>u.jsx("button",{onClick:()=>Ge(v),className:`machine-btn text-[10px] px-2 py-0.5 ${Ie===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsx("button",{onClick:de,disabled:$,className:"machine-btn",children:$?"⏳ Loading...":"↻ Refresh"})]}),$&&Se.length===0?u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):u.jsx("div",{className:"flex flex-col gap-2",children:Se.filter(v=>Ie==="all"||v.category===Ie).map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-lg",children:v.icon}),u.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:v.category==="acp"?"rgba(139,92,246,0.08)":v.category==="cli"?"rgba(59,130,246,0.08)":v.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:v.category==="acp"?"#a78bfa":v.category==="cli"?"#60a5fa":v.category==="ide"?"#86efac":"#fbbf24"},children:v.category})]}),u.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(B=>u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[B.label||B.key,we===`${v.type}.${B.key}`&&u.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),B.description&&u.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:B.description})]}),u.jsx("div",{className:"shrink-0",children:B.type==="boolean"?u.jsx("button",{onClick:()=>De(v.type,B.key,!(v.values[B.key]??B.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[B.key]??B.default?"#8b5cf6":"var(--border-subtle)"},children:u.jsx("div",{className:"w-4 h-4 rounded-full bg-white absolute top-[3px] transition-[left] duration-200 shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{left:v.values[B.key]??B.default?21:3}})}):B.type==="number"?u.jsx("input",{type:"number",value:v.values[B.key]??B.default??0,min:B.min,max:B.max,onChange:se=>{const ke=parseInt(se.target.value)||0;B.min!==void 0&&ke<B.min||B.max!==void 0&&ke>B.max||De(v.type,B.key,ke)},className:"machine-input w-20 text-center text-[11px]"}):B.type==="select"&&B.options?u.jsx("select",{value:v.values[B.key]??B.default??"",onChange:se=>De(v.type,B.key,se.target.value),className:"machine-input text-[11px]",children:B.options.map(se=>u.jsx("option",{value:se,children:se},se))}):u.jsx("input",{type:"text",value:v.values[B.key]??B.default??"",onBlur:se=>De(v.type,B.key,se.target.value),className:"machine-input w-[120px] text-[11px]"})})]},B.key))})]},v.type))})]}),Q==="logs"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-3",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(v=>u.jsx("button",{onClick:()=>{S(v),d([]),f(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),u.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),u.jsx("button",{onClick:()=>{d([]),f(0)},className:"machine-btn",children:"Clear"})]})]}),u.jsxs("div",{className:"bg-bg-secondary border border-border-subtle rounded-xl p-3 min-h-[200px] max-h-[500px] overflow-y-auto font-mono text-[11px] leading-relaxed",children:[c.length===0&&u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,B)=>u.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[u.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),u.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#475569":"#8b5cf6"},children:v.level==="error"?"ERR":v.level==="warn"?"WRN":v.level==="debug"?"DBG":"INF"}),u.jsx("span",{children:v.message})]},B)),u.jsx("div",{ref:X})]})]})]}),j&&I&&u.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/55 backdrop-blur-[2px]",role:"dialog","aria-modal":"true","aria-labelledby":"launch-pick-title",children:u.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border-subtle bg-bg-secondary shadow-xl p-5",children:[u.jsx("h2",{id:"launch-pick-title",className:"text-sm font-semibold text-text-primary m-0 mb-1",children:"Where should this run?"}),u.jsx("p",{className:"text-[11px] text-text-muted m-0 mb-4",children:"Nothing is assumed. Pick a saved workspace, your default workspace, or home — or cancel and type a path."}),u.jsx("div",{className:"flex flex-col gap-2 mb-4 max-h-48 overflow-y-auto",children:(I.workspaces||[]).length===0?u.jsx("span",{className:"text-[11px] text-text-muted",children:"No saved workspaces yet. Add one in Overview or type a path above."}):(I.workspaces||[]).map(v=>u.jsxs("button",{type:"button",className:"text-left text-xs px-3 py-2 rounded-lg border border-border-subtle bg-bg-primary hover:bg-violet-500/[0.08] transition-colors",onClick:()=>{const B=j;z(null),ye({cliType:B.cliType,workspaceId:v.id,argsStr:B.argsStr,model:B.model})},children:[u.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.id))}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",disabled:!I.defaultWorkspacePath,onClick:()=>{const v=j;z(null),ye({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=j;z(null),ye({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>z(null),children:"Cancel"})]})]})})]})}function eI(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new URLSearchParams(window.location.search).get("token");return n?`${t}?token=${encodeURIComponent(n)}`:t}const Z_=eI(),ev=3e3,tI=3e4;let Sn=null,rI=0;const nc=new Map,Ad=new Set;let ki=null;async function xa(e,t,r){const n=Sn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++rI}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{nc.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);nc.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),n.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:r||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:r||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class nI{constructor(t){Hs(this,"daemonId");Hs(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN}get connectionState(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return xa(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId;return xa(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ki&&(clearInterval(ki),ki=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId,i=await xa(n,"screenshot",{width:1280});if(i!=null&&i.success&&(i!=null&&i.base64)){const s=await fetch(`data:image/jpeg;base64,${i.base64}`).then(o=>o.blob());Ad.forEach(o=>o(this.daemonId,s))}}catch{}};r(),ki=setInterval(r,2e3)}stopScreenshots(t){ki&&(clearInterval(ki),ki=null)}}let Ci=null;function iI(e){(!Ci||Ci.daemonId!==e)&&(Ci=new nI(e));const t=dr._originalGet||dr.get.bind(dr);dr._originalGet=t,dr.get=r=>r===e||r.startsWith("standalone")?Ci:t(r),dr.getState=r=>(r===e||r.startsWith("standalone"))&&(Ci==null?void 0:Ci.connectionState)||"disconnected",dr.onScreenshot=(r,n)=>(Ad.add(n),()=>{Ad.delete(n)})}function sI({children:e}){const t=w.useRef(Um()),r=Um();t.current=r;const{setUserName:n}=Zo(),i=w.useRef(n);i.current=n;const[,s]=w.useState("disconnected"),o=w.useRef(null),l=w.useRef(),a=w.useRef(ev),c=w.useRef(!0);return w.useEffect(()=>{c.current=!0;function d(){var p,m;if(!c.current||((p=o.current)==null?void 0:p.readyState)===WebSocket.OPEN||((m=o.current)==null?void 0:m.readyState)===WebSocket.CONNECTING)return;s("connecting"),console.log(`[Standalone WS] Connecting to ${Z_}...`);let f;try{f=new WebSocket(Z_)}catch(g){console.error("[Standalone WS] Failed to create WebSocket:",g),h();return}o.current=f,f.onopen=()=>{if(!c.current){f.close();return}s("connected"),a.current=ev,console.log("[Standalone WS] Connected")},Sn=f,f.onmessage=g=>{var S;try{const _=JSON.parse(g.data);if((_.type==="command_result"||_.type==="error")&&_.requestId){const y=nc.get(_.requestId);y&&(nc.delete(_.requestId),_.type==="error"?y.reject(new Error(((S=_.data)==null?void 0:S.message)||"Command failed")):y.resolve(_.data));return}if(_.type==="status"||_.type==="initial_state"){const y=_.data;if(!y)return;const{injectEntries:b,markLoaded:C}=t.current,P=y.id||"standalone";iI(P);const E=RM(y,{daemonId:P});E.length>0&&b(E),C(),y.userName&&i.current&&i.current(y.userName)}}catch(_){console.error("[Standalone WS] Parse error:",_)}},f.onclose=()=>{c.current&&(s("disconnected"),o.current=null,h())},f.onerror=g=>{console.warn("[Standalone WS] Error, will reconnect:",g)}}function h(){if(!c.current)return;clearTimeout(l.current);const f=a.current;console.log(`[Standalone WS] Reconnecting in ${f}ms...`),l.current=setTimeout(()=>{a.current=Math.min(a.current*1.5,tI),d()},f)}return d(),()=>{c.current=!1,clearTimeout(l.current),o.current&&(o.current.onclose=null,o.current.close(),o.current=null,Sn=null)}},[]),u.jsx(u.Fragment,{children:e})}function oI({children:e}){return u.jsx(jk,{children:u.jsx(sI,{children:e})})}const lI=[{id:"dashboard",path:"/dashboard",icon:u.jsx(AT,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:u.jsx(BT,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:u.jsx(F0,{}),label:"Settings"}];function aI({children:e}){const t=Os(),r=fl(),[n,i]=w.useState(!1),[s,o]=w.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=d=>{t(d),i(!1)},a=()=>{o(d=>{const h=!d;try{localStorage.setItem("sidebar-collapsed",h?"1":"0")}catch{}return h})},c=d=>`nav-item${r.pathname.startsWith(d)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return u.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"})]}),n&&u.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:d=>d.key==="Escape"&&i(!1)}),u.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[u.jsxs("div",{className:"sidebar-header",children:[u.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&u.jsx("span",{children:"ADHDev"})]}),u.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),u.jsx("nav",{className:"sidebar-nav",children:lI.map(d=>u.jsxs("div",{className:c(d.path),id:`nav-${d.id}`,onClick:()=>l(d.path),title:s?d.label:void 0,children:[u.jsx("span",{className:"nav-icon",children:d.icon}),!s&&d.label]},d.id))}),u.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[u.jsxs("div",{className:`nav-item cursor-pointer${r.pathname==="/about"?" active":""} ${s?"justify-center py-2.5 px-0":""}`,id:"nav-about",onClick:()=>t("/about"),title:s?"About":void 0,children:[u.jsx("span",{className:"nav-icon",children:u.jsx(zT,{})}),!s&&"About"]}),!s&&u.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.16"]}),u.jsx(LR,{collapsed:s}),u.jsxs("div",{className:`nav-item cursor-pointer ${s?"justify-center py-2.5 px-0":"mt-1"}`,onClick:a,title:s?"Expand sidebar":"Collapse sidebar",children:[u.jsx("span",{className:"nav-icon text-base",children:s?"›":"‹"}),!s&&u.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),u.jsx("main",{className:"main-content relative",children:u.jsx("div",{className:"main-content-inner",children:e})})]})}const cI=[{icon:"🏠",title:"Local-first",desc:"Everything runs on your machine. No data leaves your network. Full privacy by design."},{icon:"💬",title:"Agent chat relay",desc:"Read and respond to AI conversations in real-time across all connected IDEs."},{icon:"📸",title:"Live screenshots",desc:"View your IDE screens directly in the browser via local WebSocket streaming."},{icon:"🎛️",title:"Remote control",desc:"Click, type, and interact with your IDE from the dashboard — no window switching."},{icon:"🔌",title:"Multi-IDE support",desc:"Monitor and control multiple IDEs simultaneously — VS Code, Cursor, Windsurf, and more."},{icon:"⚡",title:"Extension agents",desc:"Manage extension-based agents like Cline and Roo Code alongside native IDE agents."}],uI=[{icon:"🌍",title:"Access from anywhere",desc:"Control your agents from any device, any network. No VPN or port forwarding needed."},{icon:"🔗",title:"WebRTC P2P streaming",desc:"End-to-end encrypted peer-to-peer connection for zero-latency remote screenshots and control."},{icon:"📱",title:"Mobile notifications",desc:"Get push notifications when agents need approval. Quick approve/reject from your phone."},{icon:"📡",title:"REST API access",desc:"Integrate with Slack, CI/CD pipelines, or custom tools. Scoped API keys with granular permissions."},{icon:"👥",title:"Team dashboard",desc:"Share a unified view across your team. See who's running what, where, in real time."},{icon:"🔐",title:"Enterprise security",desc:"SSO, RBAC, audit logs, and SLA guarantees for production teams."}],hI=[{feature:"Agent chat relay",selfhost:!0,cloud:!0},{feature:"Live IDE screenshots",selfhost:!0,cloud:!0},{feature:"Remote IDE control",selfhost:!0,cloud:!0},{feature:"Multi-IDE monitoring",selfhost:!0,cloud:!0},{feature:"Extension agent support",selfhost:!0,cloud:!0},{feature:"CLI agent support",selfhost:!0,cloud:!0},{feature:"Access from any network",selfhost:!1,cloud:!0},{feature:"WebRTC P2P streaming",selfhost:!1,cloud:!0},{feature:"Mobile push notifications",selfhost:!1,cloud:!0},{feature:"REST API & webhooks",selfhost:!1,cloud:!0},{feature:"Team collaboration",selfhost:!1,cloud:!0},{feature:"Multi-machine (Burrows)",selfhost:!1,cloud:!0},{feature:"SSO / RBAC / Audit logs",selfhost:!1,cloud:!0}],Hu={ides:["VS Code","Cursor","Antigravity","Windsurf","Trae","PearAI","Kiro","VSCodium","VS Code Insiders"],agents:["GitHub Copilot","Cline","Roo Code"],cli:["Gemini CLI","Claude Code","Codex CLI"]};function dI(){return u.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[u.jsxs("div",{className:"text-center mb-10",children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),u.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),u.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev — Self-hosted Edition"}),u.jsxs("div",{className:"inline-block mt-3 px-3 py-1 text-[11px] font-semibold tracking-wide rounded-full bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:["SELFHOST v","0.5.16"]})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"✅"})," What's included"]}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:cI.map(e=>u.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[u.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),u.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),u.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-5",children:[{label:"IDEs",items:Hu.ides},{label:"Extension agents",items:Hu.agents},{label:"CLI agents",items:Hu.cli}].map(e=>u.jsxs("div",{children:[u.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),u.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>u.jsx("div",{className:"text-[12px] px-2.5 py-1.5 bg-bg-glass rounded-md border border-border-subtle",children:t},t))})]},e.label))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"⚖️"})," Self-hosted vs Cloud"]}),u.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:u.jsxs("table",{className:"w-full text-[13px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"bg-bg-secondary",children:[u.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),u.jsx("tbody",{children:hI.map((e,t)=>u.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[u.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),u.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?u.jsx("span",{className:"text-emerald-500",children:"✓"}):u.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),u.jsx("td",{className:"text-center px-4 py-2",children:u.jsx("span",{className:"text-emerald-500",children:"✓"})})]},e.feature))})]})})]}),u.jsx("section",{className:"mb-10",children:u.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:u.jsxs("div",{className:"flex items-start gap-4",children:[u.jsx("div",{className:"text-3xl shrink-0",children:"🚀"}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),u.jsx("p",{className:"text-[13px] text-text-muted leading-relaxed mb-4",children:"Access your agents from anywhere — your phone, another laptop, or a coffee shop. Cloud adds WebRTC P2P streaming, mobile push notifications, REST API, team collaboration, and multi-machine support. Your local setup stays exactly the same."}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:uI.map(e=>u.jsxs("div",{className:"flex gap-2.5 items-start",children:[u.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),u.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),u.jsxs("div",{className:"flex gap-3 flex-wrap",children:[u.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Try ADHDev Cloud →"}),u.jsx("a",{href:"https://github.com/vilmire/adhdev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"GitHub"}),u.jsx("a",{href:"https://discord.gg/WJD3tCfBzk",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Discord"})]})]})]})})}),u.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[u.jsx("p",{children:"© 2026 ADHDev · Your AI sidekick otter 🦦"}),u.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition — all data stays on your machine"})]})]})}function fI(){const{ides:e}=Zo(),t=e.find(h=>h.type==="adhdev-daemon"),r=(t==null?void 0:t.detectedIdes)||[],{sendCommand:n}=gi(),{userName:i}=Zo(),[s,o]=w.useState(i||"");w.useEffect(()=>{i!==void 0&&o(i)},[i]);const l=h=>{const f=h.target.value.trim();t!=null&&t.id&&f!==i&&n(t.id,"set_user_name",{userName:f}).catch(console.error)},[a,c]=w.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),d=h=>{c(h);try{localStorage.setItem("adhdev_sound",h?"1":"0")}catch{}};return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(SR,{icon:"⚙️",title:"Settings",subtitle:"Local daemon configuration & preferences"}),u.jsxs("div",{className:"page-content",children:[u.jsx(ao,{title:"Daemon",className:"mb-4",children:u.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-x-4 gap-y-2.5 text-sm",children:[u.jsx("span",{className:"text-text-muted",children:"Version"}),u.jsxs("span",{className:"font-mono text-xs",children:["v","0.5.16"]}),u.jsx("span",{className:"text-text-muted",children:"Status"}),u.jsx("span",{className:t?"text-green-400":"text-yellow-400",children:t?"● Running":"○ Not connected"}),u.jsx("span",{className:"text-text-muted",children:"WebSocket"}),u.jsx("span",{className:"font-mono text-xs",children:"ws://localhost:19222"}),u.jsx("span",{className:"text-text-muted",children:"HTTP"}),u.jsx("span",{className:"font-mono text-xs",children:"http://localhost:19280"})]})}),u.jsx(ao,{title:"Detected IDEs",className:"mb-4",children:r.length===0?u.jsx("p",{className:"text-sm text-text-muted",children:"No IDEs detected. Start an IDE to see it here."}):u.jsx("div",{className:"flex flex-col gap-1.5",children:r.map(h=>u.jsxs("div",{className:"flex justify-between items-center bg-bg-glass rounded-lg px-3.5 py-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:`w-2 h-2 rounded-full ${h.running?"bg-green-400":"bg-text-muted/30"}`}),u.jsx("span",{className:"text-sm font-medium",children:h.name})]}),u.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:h.type})]},h.type))})}),u.jsx(ao,{title:"Machine",className:"mb-4",children:u.jsx(BR,{ides:e,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),u.jsx(ao,{title:"Notifications",className:"mb-4",children:u.jsx(AR,{})}),u.jsx(ao,{title:"Preferences",className:"mb-4",children:u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsxs("div",{className:"flex items-center justify-between px-3.5 py-4 bg-bg-glass rounded-xl border border-border-subtle hover:border-border-hover transition-colors",children:[u.jsxs("div",{className:"flex flex-col gap-1 pr-4 max-w-[500px]",children:[u.jsx("span",{className:"text-sm font-semibold flex items-center gap-2",children:"👤 Display Name"}),u.jsx("span",{className:"text-[12px] text-text-muted leading-relaxed",children:"Your name shown in chat threads and on the team dashboard."})]}),u.jsx("input",{type:"text",className:"bg-bg-primary border border-border-strong rounded-lg px-3 py-1.5 text-sm w-48 text-right focus:border-accent-primary focus:outline-none transition-colors",placeholder:"Anonymous",value:s,onChange:h=>o(h.target.value),onBlur:l,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}})]}),u.jsx(is,{label:"🔊 Sound Effects",description:"Play a sound when agent completes or needs approval",checked:a,onChange:d})]})})]})]})}function tv(){const{ides:e}=Zo(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?u.jsx(aa,{to:`/machines/${t.id}`,replace:!0}):e.length>0?u.jsx(aa,{to:`/machines/${e[0].id}`,replace:!0}):u.jsx(aa,{to:"/dashboard",replace:!0})}function pI(){return u.jsx(Rk,{children:u.jsx(oI,{children:u.jsx(zk,{value:{sendCommand:xa,sendData:()=>!1},children:u.jsx(aI,{children:u.jsxs(Tk,{children:[u.jsx(yn,{path:"/dashboard",element:u.jsx(XR,{})}),u.jsx(yn,{path:"/ide/:id",element:u.jsx(QR,{})}),u.jsx(yn,{path:"/machine",element:u.jsx(tv,{})}),u.jsx(yn,{path:"/machines/:id",element:u.jsx(ZR,{})}),u.jsx(yn,{path:"/machines",element:u.jsx(tv,{})}),u.jsx(yn,{path:"/about",element:u.jsx(dI,{})}),u.jsx(yn,{path:"/settings",element:u.jsx(fI,{})}),u.jsx(yn,{path:"*",element:u.jsx(aa,{to:"/dashboard",replace:!0})})]})})})})})}vy(document.getElementById("root")).render(u.jsx(w.StrictMode,{children:u.jsx(pI,{})}));
|
|
199
|
+
This will disconnect CDP and optionally kill the process.`))try{const B=await r(v.daemonId,"stop_ide",{ideType:v.type,killProcess:!0});B!=null&&B.success?xe("info",`${jr(v.type)} stopped`):xe("error",`Stop failed: ${(B==null?void 0:B.error)||"Unknown error"}`)}catch(B){xe("error",`Stop failed: ${B.message}`)}},Zt=async()=>{if(e)try{const v=await r(e,"detect_ides",{});xe("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){xe("error",`Detection failed: ${v.message}`)}},xr=async()=>{if(e){E(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&C(v.result)}catch(v){xe("error",`Failed: ${v.message}`)}finally{E(!1)}}},Ji=async()=>{if(!(!e||!Ke.trim())){Je(!0);try{const v=await r(e,"workspace_add",{path:Ke.trim()});v!=null&&v.success?(xe("info",`Workspace added: ${Ke.trim()}`),Oe("")):xe("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){xe("error",v.message)}finally{Je(!1)}}},Rc=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){Je(!0);try{const B=await r(e,"workspace_remove",{id:v});B!=null&&B.success?xe("info","Workspace removed"):xe("error",(B==null?void 0:B.error)||"workspace_remove failed")}catch(B){xe("error",B.message)}finally{Je(!1)}}},Ic=async v=>{if(e){Je(!0);try{const B=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(B!=null&&B.success){xe("info",v?"Default workspace updated":"Default workspace cleared");const se=typeof B.defaultWorkspacePath=="string"?B.defaultWorkspacePath:"";se&&(T(se),A(se))}else xe("error",(B==null?void 0:B.error)||"workspace_set_default failed")}catch(B){xe("error",B.message)}finally{Je(!1)}}},Dc=async v=>{if(!e||!v.trim())return;const B=v.trim();Je(!0);try{const se=await r(e,"workspace_set_default",{path:B});se!=null&&se.success?(xe("info","Default workspace set from history"),T(B),A(B)):xe("error",(se==null?void 0:se.error)||"Could not set default (path missing on disk?)")}catch(se){xe("error",se.message)}finally{Je(!1)}},On=w.useCallback(async()=>{var v;if(e){q(!0);try{let B=await r(e,"get_cli_history",{});B!=null&&B.success||(B=await n(e,"get_cli_history"));const se=(B==null?void 0:B.history)??((v=B==null?void 0:B.result)==null?void 0:v.history);B!=null&&B.success&&Array.isArray(se)&&_e(se)}catch{}q(!1)}},[e,r,n]);w.useEffect(()=>{Q==="overview"&&e&&On()},[Q,e,On]);const dp=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:ce}),xe("info",`Nickname set to "${ce||"(cleared)"}"`),me(!1)}catch(v){xe("error",`Failed: ${v.message}`)}};if(!I)return o?u.jsxs("div",{className:"p-10 text-center text-text-muted",children:[u.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),u.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):u.jsx("div",{className:"p-10 text-center text-text-muted",children:u.jsx("p",{children:"⏳ Loading machine..."})});const fp=I.availableMem??I.freeMem,nw=I.totalMem>0?Math.min(100,Math.max(0,Math.round((I.totalMem-fp)/I.totalMem*100))):0,pp=I.loadavg[0]||0,iw=I.machineNickname||I.hostname,sw=(v,B,se)=>{const ke=te.find(yr=>yr.type===v),Ye=(se||[]).join(" ");(ke==null?void 0:ke.category)==="acp"?(W(v),A(B),x(Ye),le("acps")):(R(v),T(B),N(Ye),le("clis"))},ow=[{id:"overview",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(UT,{size:14})," Overview"]})},{id:"ides",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," IDEs"]}),count:st.length},{id:"clis",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(H0,{size:14})," CLIs"]}),count:be.length},{id:"acps",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(qT,{size:14})," ACP Agents"]}),count:Te.length},{id:"providers",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(F0,{size:14})," Providers"]}),count:Se.length>0?Se.length:void 0},{id:"logs",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(OT,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"dashboard-header !flex-col !items-stretch",children:[u.jsx("div",{className:"flex items-center justify-between w-full",children:u.jsxs("div",{className:"flex items-center gap-2 md:gap-3.5 w-full min-w-0",children:[u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back flex shrink-0",children:"←"}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[J?u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsx("input",{autoFocus:!0,value:ce,onChange:v=>Le(v.target.value),onKeyDown:v=>{v.key==="Enter"&&dp(),v.key==="Escape"&&me(!1)},placeholder:"Machine nickname...",className:"px-2.5 py-1 rounded-md border border-violet-500/30 bg-bg-secondary text-text-primary text-sm font-semibold w-[140px] md:w-[200px]"}),u.jsx("button",{onClick:dp,className:"machine-btn text-green-500 border-green-500/30 shrink-0",children:"✓"}),u.jsx("button",{onClick:()=>me(!1),className:"machine-btn shrink-0",children:"✕"})]}):u.jsx("h1",{className:"header-title cursor-pointer truncate",onClick:()=>{me(!0),Le(I.machineNickname||"")},title:"Click to set nickname",children:iw}),u.jsx("span",{className:"status-dot-md online shrink-0"})]}),u.jsxs("div",{className:"header-subtitle mt-1 flex-wrap gap-1 md:gap-2 items-center display-none-mobile",children:[u.jsxs("span",{children:[I.platform," · ",I.arch," · ",I.cpus," cores"]}),I.p2p.available&&u.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:I.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:I.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",I.p2p.state==="connected"?`● ${I.p2p.peers}`:"○"]}),I.cdpConnected&&u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500 shrink-0",children:"CDP ●"}),I.machineNickname&&u.jsxs("span",{className:"text-text-muted opacity-80 shrink-0",children:["(",I.hostname,")"]})]})]})]})}),u.jsx("div",{className:"machine-tabs w-full overflow-x-auto overflow-y-hidden pb-1 -mb-1 mt-2",children:ow.map(v=>u.jsxs("button",{onClick:()=>le(v.id),className:`machine-tab shrink-0${Q===v.id?" active":""}`,children:[v.label,v.count!==void 0&&u.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),u.jsxs("div",{className:"page-content",children:[Q==="overview"&&u.jsxs("div",{children:[u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[u.jsx(O_,{icon:u.jsx(Wg,{size:16}),label:"Uptime",value:CM(I.uptime)}),u.jsx(O_,{icon:u.jsx(Mo,{size:16}),label:"IDEs",value:`${st.length}`,sub:`${be.length} CLIs`})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),u.jsxs("div",{className:"flex gap-6",children:[u.jsx(z_,{value:Math.min(Math.round(pp/I.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${pp.toFixed(2)} avg / ${I.cpus} cores`}),u.jsx(z_,{value:nw,max:100,label:"Memory",color:"#3b82f6",detail:`${$_(I.totalMem-fp)} / ${$_(I.totalMem)}${I.platform==="darwin"?" (approx.)":""}`})]})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[u.jsx(Ro,{size:14})," Workspaces"]})}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:["One list for IDE, CLI, and ACP: saved paths below, and a single ",u.jsx("strong",{className:"text-text-secondary font-medium",children:"default"}),'. The default opens in the IDE when you launch it, pre-fills CLI/ACP directories, and is what "Default" launch uses.']}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[u.jsx("span",{className:"text-[10px] text-text-muted",children:"Default:"}),u.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:We,value:I.defaultWorkspaceId||"",onChange:v=>{const B=v.target.value;Ic(B===""?null:B)},children:[u.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(I.workspaces||[]).map(v=>u.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),I.defaultWorkspacePath&&u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:I.defaultWorkspacePath,children:I.defaultWorkspacePath})]}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[u.jsx("input",{className:"flex-1 min-w-[200px] text-xs bg-bg-primary border border-border-subtle rounded-lg px-2.5 py-1.5",placeholder:"Absolute workspace path to add…",value:Ke,disabled:We,onChange:v=>Oe(v.target.value),onKeyDown:v=>v.key==="Enter"&&void Ji()}),u.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:We,onClick:()=>void Ji(),children:"Add"})]}),(I.workspaces||[]).length>0&&u.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(I.workspaces||[]).map(v=>u.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[u.jsx("span",{className:"font-mono truncate flex-1",title:v.path,children:v.path}),u.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:We,onClick:()=>void Rc(v.id),children:"Remove"})]},v.id))})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle border-violet-500/15",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1 flex items-center gap-1.5",children:[u.jsx(Wg,{size:14})," Pick up where you left off"]}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:"Same workspaces as above. Re-run CLI/ACP, or open CLIs/ACP tab with a path filled; IDE launch uses the default automatically when set."}),u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent CLI / ACP launches"}),k.length>0?u.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,B)=>{const se=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.dir||"?"}`;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsxs("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,240px)]",title:v.dir,children:[fe(v.cliType)," ",se]}),u.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.dir}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void ye({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>sw(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${B}`)})}):u.jsx("p",{className:"text-[11px] text-text-muted mb-4",children:"No launch history yet — start a CLI or ACP from the tabs below, then return here."}),(I.workspaceActivity||[]).length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent workspace paths"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:(I.workspaceActivity||[]).slice(0,12).map(v=>{const B=v.path.split("/").filter(Boolean).pop()||v.path,se=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ke=(v.kind==="cli"||v.kind==="acp")&&!!v.agentType;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,200px)]",title:v.path,children:B}),se&&u.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:se}),v.agentType&&u.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),u.jsx("span",{className:"text-[9px] text-text-muted",children:JR(v.lastUsedAt)}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ke&&u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void ye({cliType:v.agentType,dir:v.path}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{T(v.path),A(v.path),le("clis")},children:"CLIs tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{T(v.path),A(v.path),le("acps")},children:"ACP tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:We,onClick:()=>void Dc(v.path),children:"Set default"})]})]},`${v.path}-${v.lastUsedAt}`)})})]})]}),u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),u.jsx("button",{onClick:()=>le("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),st.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:st.map(v=>{var se;const B=(v.agentStreams||[]).some(ke=>ke.status==="generating"||ke.status==="streaming")||((se=v.activeChat)==null?void 0:se.status)==="generating";return u.jsxs("div",{onClick:()=>t(`/ide/${v.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${B?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[u.jsx("span",{children:fe(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:jr(v.type)}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace||""}),B&&u.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),u.jsx("span",{className:`${B?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:B?"#fb923c":"#22c55e",boxShadow:B?"0 0 8px rgba(249,115,22,0.4)":"none",animation:B?"pulse-dot 1.5s infinite":"none"}})]},v.id)})})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),u.jsx("button",{onClick:()=>le("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),be.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:be.map(v=>u.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[u.jsx("span",{children:fe(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace.split("/").pop()}),u.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),I.detectedIdes.length>0&&u.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),u.jsx("div",{className:"flex flex-wrap gap-1.5",children:I.detectedIdes.map(v=>u.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${v.running?"bg-green-500/[0.06] border border-green-500/[0.12] text-green-300":"bg-bg-glass border border-border-subtle text-text-muted"}`,children:[u.jsx("span",{children:fe(v.type)}),v.name||v.type,u.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),Q==="ides"&&u.jsxs("div",{children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",st.length,")"]}),st.length===0?u.jsx("div",{className:"py-10 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No IDEs currently running. Launch one below."}):u.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:st.map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-lg",children:fe(v.type)}),u.jsx("span",{className:"font-semibold text-sm text-text-primary",children:jr(v.type)}),v.version&&u.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.version]}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),u.jsxs("div",{className:"flex gap-1.5",children:[u.jsxs("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[u.jsx(Mo,{size:13})," Control"]}),u.jsx("button",{onClick:()=>Ct(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"}),u.jsx("button",{onClick:()=>ar(v),className:"machine-btn text-red-400 border-red-500/30",children:"■ Stop"})]})]}),u.jsxs("div",{className:"text-xs text-text-secondary mb-2",children:[u.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",v.workspace||"—"]}),v.aiAgents.length>0&&u.jsx("div",{className:"flex gap-1 mb-2 flex-wrap",children:v.aiAgents.map(B=>u.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${B.status==="generating"||B.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[B.name," · ",B.status]},B.id))}),(Qt[v.type]||[]).length>0&&u.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:[u.jsx("div",{className:"text-[10px] text-text-muted font-semibold uppercase tracking-wider mb-1.5",children:"Extensions"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:(Qt[v.type]||[]).map(B=>u.jsxs("button",{disabled:gn===`${v.type}.${B.type}`,onClick:async()=>{const se=`${v.type}.${B.type}`;Y(se);try{await r(e,"set_ide_extension",{ideType:v.type,extensionType:B.type,enabled:!B.enabled}),Jt(ke=>({...ke,[v.type]:(ke[v.type]||[]).map(Ye=>Ye.type===B.type?{...Ye,enabled:!Ye.enabled}:Ye)}))}catch(ke){console.error("Extension toggle failed:",ke)}finally{Y(null)}},className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-medium border transition-colors duration-150 cursor-pointer ${B.enabled?"bg-violet-500/[0.08] border-violet-500/20 text-violet-400":"bg-bg-glass border-border-subtle text-text-muted"}`,children:[u.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${B.enabled?"bg-violet-400 shadow-[0_0_4px_rgba(139,92,246,0.4)]":"bg-zinc-600"}`}),B.name,u.jsx("span",{className:"text-[9px] font-normal",children:B.enabled?"ON":"OFF"})]},B.type))})]})]},v.id))}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",Ce.length,")"]}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:[I.defaultWorkspacePath?`Opens in default workspace: ${I.defaultWorkspacePath.split("/").filter(Boolean).pop()||I.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."," ","Multi-window supported — running IDEs can be launched again as a new window."]}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[Ce.map(v=>{const B=v.running||st.some(se=>(se.type||"").toLowerCase()===(v.type||"").toLowerCase());return u.jsxs("button",{onClick:()=>Ue(v.type||v.id||""),disabled:!!_,className:`machine-btn-primary flex items-center gap-1.5 ${B?"!border-green-500/30":""}`,style:{opacity:_&&_!==v.type?.4:1},children:[u.jsx("span",{children:fe(v.type)}),B&&u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),_===v.type?"⏳ Launching...":`▶ ${v.name||jr(v.type)}`,B&&u.jsx("span",{className:"text-[9px] text-green-400 font-normal",children:"+ window"})]},v.type)}),Ce.length===0&&u.jsxs("div",{className:"text-xs text-text-muted italic",children:["No IDEs detected.",u.jsxs("button",{onClick:Zt,className:"machine-btn ml-2 flex items-center gap-1",children:[u.jsx(FT,{size:12})," Scan"]})]})]})]}),Q==="clis"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:D,onChange:v=>R(v.target.value),className:"machine-input",children:Pe.length>0?Pe.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:F,onChange:v=>T(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:V,onChange:v=>N(v.target.value),className:"machine-input min-w-[150px]"}),u.jsx("button",{onClick:()=>qe(D,F,V||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(I!=null&&I.defaultWorkspacePath),title:I!=null&&I.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void ye({cliType:D,useDefaultWorkspace:!0,argsStr:V||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void ye({cliType:D,useHome:!0,argsStr:V||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",be.length,")"]}),be.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:be.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:fe(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),u.jsx("div",{className:"text-[11px] text-text-muted",children:v.workspace})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),v.status==="stopped"?u.jsx("button",{onClick:()=>qe(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),u.jsx("button",{onClick:On,disabled:K,className:"machine-btn",children:K?"⏳":"↻ Load"})]}),k.length>0&&u.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,B)=>{var se,ke;return u.jsxs("div",{onClick:()=>{R(v.cliType),T(v.dir),N((v.cliArgs||[]).join(" "))},className:"flex justify-between items-center px-2.5 py-1.5 rounded-md cursor-pointer bg-bg-glass border border-border-subtle text-xs transition-[background] duration-150",onMouseEnter:Ye=>Ye.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:Ye=>Ye.currentTarget.style.background="var(--bg-glass)",children:[u.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[u.jsx("span",{children:fe(v.cliType)}),u.jsx("span",{children:((se=v.dir)==null?void 0:se.split("/").filter(Boolean).pop())||"root"}),((ke=v.cliArgs)==null?void 0:ke.length)>0&&u.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),u.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},B)})}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:P,className:"machine-btn",children:P?"⏳":"↻ Load"})]}),b.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map((v,B)=>u.jsx("button",{onClick:()=>T(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Ro,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),Q==="acps"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:M,onChange:v=>W(v.target.value),className:"machine-input",children:ze.length>0?ze.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:O,onChange:v=>A(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Model (default)",value:H,onChange:v=>L(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:U,onChange:v=>x(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("button",{onClick:()=>qe(M,O,U||void 0,H||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(I!=null&&I.defaultWorkspacePath),title:I!=null&&I.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void ye({cliType:M,useDefaultWorkspace:!0,argsStr:U||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void ye({cliType:M,useHome:!0,argsStr:U||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",Te.length,")"]}),Te.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No ACP agents running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:Te.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:fe(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),u.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[u.jsx("span",{children:v.workspace}),v.currentModel&&u.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&u.jsxs("span",{className:"text-amber-500",children:["📋 ",v.currentPlan]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":v.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),u.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:u.jsx(Xa,{size:14})}),v.status==="stopped"?u.jsx("button",{onClick:()=>qe(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:P,className:"machine-btn",children:P?"⏳":"↻ Load"})]}),b.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map((v,B)=>u.jsx("button",{onClick:()=>A(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Ro,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),Q==="providers"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-4",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(v=>u.jsx("button",{onClick:()=>Ge(v),className:`machine-btn text-[10px] px-2 py-0.5 ${Ie===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsx("button",{onClick:de,disabled:$,className:"machine-btn",children:$?"⏳ Loading...":"↻ Refresh"})]}),$&&Se.length===0?u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):u.jsx("div",{className:"flex flex-col gap-2",children:Se.filter(v=>Ie==="all"||v.category===Ie).map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-lg",children:v.icon}),u.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:v.category==="acp"?"rgba(139,92,246,0.08)":v.category==="cli"?"rgba(59,130,246,0.08)":v.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:v.category==="acp"?"#a78bfa":v.category==="cli"?"#60a5fa":v.category==="ide"?"#86efac":"#fbbf24"},children:v.category})]}),u.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(B=>u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[B.label||B.key,we===`${v.type}.${B.key}`&&u.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),B.description&&u.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:B.description})]}),u.jsx("div",{className:"shrink-0",children:B.type==="boolean"?u.jsx("button",{onClick:()=>De(v.type,B.key,!(v.values[B.key]??B.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[B.key]??B.default?"#8b5cf6":"var(--border-subtle)"},children:u.jsx("div",{className:"w-4 h-4 rounded-full bg-white absolute top-[3px] transition-[left] duration-200 shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{left:v.values[B.key]??B.default?21:3}})}):B.type==="number"?u.jsx("input",{type:"number",value:v.values[B.key]??B.default??0,min:B.min,max:B.max,onChange:se=>{const ke=parseInt(se.target.value)||0;B.min!==void 0&&ke<B.min||B.max!==void 0&&ke>B.max||De(v.type,B.key,ke)},className:"machine-input w-20 text-center text-[11px]"}):B.type==="select"&&B.options?u.jsx("select",{value:v.values[B.key]??B.default??"",onChange:se=>De(v.type,B.key,se.target.value),className:"machine-input text-[11px]",children:B.options.map(se=>u.jsx("option",{value:se,children:se},se))}):u.jsx("input",{type:"text",value:v.values[B.key]??B.default??"",onBlur:se=>De(v.type,B.key,se.target.value),className:"machine-input w-[120px] text-[11px]"})})]},B.key))})]},v.type))})]}),Q==="logs"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-3",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(v=>u.jsx("button",{onClick:()=>{S(v),d([]),f(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),u.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),u.jsx("button",{onClick:()=>{d([]),f(0)},className:"machine-btn",children:"Clear"})]})]}),u.jsxs("div",{className:"bg-bg-secondary border border-border-subtle rounded-xl p-3 min-h-[200px] max-h-[500px] overflow-y-auto font-mono text-[11px] leading-relaxed",children:[c.length===0&&u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,B)=>u.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[u.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),u.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#475569":"#8b5cf6"},children:v.level==="error"?"ERR":v.level==="warn"?"WRN":v.level==="debug"?"DBG":"INF"}),u.jsx("span",{children:v.message})]},B)),u.jsx("div",{ref:X})]})]})]}),j&&I&&u.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/55 backdrop-blur-[2px]",role:"dialog","aria-modal":"true","aria-labelledby":"launch-pick-title",children:u.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border-subtle bg-bg-secondary shadow-xl p-5",children:[u.jsx("h2",{id:"launch-pick-title",className:"text-sm font-semibold text-text-primary m-0 mb-1",children:"Where should this run?"}),u.jsx("p",{className:"text-[11px] text-text-muted m-0 mb-4",children:"Nothing is assumed. Pick a saved workspace, your default workspace, or home — or cancel and type a path."}),u.jsx("div",{className:"flex flex-col gap-2 mb-4 max-h-48 overflow-y-auto",children:(I.workspaces||[]).length===0?u.jsx("span",{className:"text-[11px] text-text-muted",children:"No saved workspaces yet. Add one in Overview or type a path above."}):(I.workspaces||[]).map(v=>u.jsxs("button",{type:"button",className:"text-left text-xs px-3 py-2 rounded-lg border border-border-subtle bg-bg-primary hover:bg-violet-500/[0.08] transition-colors",onClick:()=>{const B=j;z(null),ye({cliType:B.cliType,workspaceId:v.id,argsStr:B.argsStr,model:B.model})},children:[u.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.id))}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",disabled:!I.defaultWorkspacePath,onClick:()=>{const v=j;z(null),ye({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=j;z(null),ye({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>z(null),children:"Cancel"})]})]})})]})}function eI(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new URLSearchParams(window.location.search).get("token");return n?`${t}?token=${encodeURIComponent(n)}`:t}const Z_=eI(),ev=3e3,tI=3e4;let Sn=null,rI=0;const nc=new Map,Ad=new Set;let ki=null;async function xa(e,t,r){const n=Sn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++rI}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{nc.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);nc.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),n.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:r||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:r||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class nI{constructor(t){Hs(this,"daemonId");Hs(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN}get connectionState(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return xa(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId;return xa(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ki&&(clearInterval(ki),ki=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId,i=await xa(n,"screenshot",{width:1280});if(i!=null&&i.success&&(i!=null&&i.base64)){const s=await fetch(`data:image/jpeg;base64,${i.base64}`).then(o=>o.blob());Ad.forEach(o=>o(this.daemonId,s))}}catch{}};r(),ki=setInterval(r,2e3)}stopScreenshots(t){ki&&(clearInterval(ki),ki=null)}}let Ci=null;function iI(e){(!Ci||Ci.daemonId!==e)&&(Ci=new nI(e));const t=dr._originalGet||dr.get.bind(dr);dr._originalGet=t,dr.get=r=>r===e||r.startsWith("standalone")?Ci:t(r),dr.getState=r=>(r===e||r.startsWith("standalone"))&&(Ci==null?void 0:Ci.connectionState)||"disconnected",dr.onScreenshot=(r,n)=>(Ad.add(n),()=>{Ad.delete(n)})}function sI({children:e}){const t=w.useRef(Um()),r=Um();t.current=r;const{setUserName:n}=Zo(),i=w.useRef(n);i.current=n;const[,s]=w.useState("disconnected"),o=w.useRef(null),l=w.useRef(),a=w.useRef(ev),c=w.useRef(!0);return w.useEffect(()=>{c.current=!0;function d(){var p,m;if(!c.current||((p=o.current)==null?void 0:p.readyState)===WebSocket.OPEN||((m=o.current)==null?void 0:m.readyState)===WebSocket.CONNECTING)return;s("connecting"),console.log(`[Standalone WS] Connecting to ${Z_}...`);let f;try{f=new WebSocket(Z_)}catch(g){console.error("[Standalone WS] Failed to create WebSocket:",g),h();return}o.current=f,f.onopen=()=>{if(!c.current){f.close();return}s("connected"),a.current=ev,console.log("[Standalone WS] Connected")},Sn=f,f.onmessage=g=>{var S;try{const _=JSON.parse(g.data);if((_.type==="command_result"||_.type==="error")&&_.requestId){const y=nc.get(_.requestId);y&&(nc.delete(_.requestId),_.type==="error"?y.reject(new Error(((S=_.data)==null?void 0:S.message)||"Command failed")):y.resolve(_.data));return}if(_.type==="status"||_.type==="initial_state"){const y=_.data;if(!y)return;const{injectEntries:b,markLoaded:C}=t.current,P=y.id||"standalone";iI(P);const E=RM(y,{daemonId:P});E.length>0&&b(E),C(),y.userName&&i.current&&i.current(y.userName)}}catch(_){console.error("[Standalone WS] Parse error:",_)}},f.onclose=()=>{c.current&&(s("disconnected"),o.current=null,h())},f.onerror=g=>{console.warn("[Standalone WS] Error, will reconnect:",g)}}function h(){if(!c.current)return;clearTimeout(l.current);const f=a.current;console.log(`[Standalone WS] Reconnecting in ${f}ms...`),l.current=setTimeout(()=>{a.current=Math.min(a.current*1.5,tI),d()},f)}return d(),()=>{c.current=!1,clearTimeout(l.current),o.current&&(o.current.onclose=null,o.current.close(),o.current=null,Sn=null)}},[]),u.jsx(u.Fragment,{children:e})}function oI({children:e}){return u.jsx(jk,{children:u.jsx(sI,{children:e})})}const lI=[{id:"dashboard",path:"/dashboard",icon:u.jsx(AT,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:u.jsx(BT,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:u.jsx(F0,{}),label:"Settings"}];function aI({children:e}){const t=Os(),r=fl(),[n,i]=w.useState(!1),[s,o]=w.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=d=>{t(d),i(!1)},a=()=>{o(d=>{const h=!d;try{localStorage.setItem("sidebar-collapsed",h?"1":"0")}catch{}return h})},c=d=>`nav-item${r.pathname.startsWith(d)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return u.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"})]}),n&&u.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:d=>d.key==="Escape"&&i(!1)}),u.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[u.jsxs("div",{className:"sidebar-header",children:[u.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&u.jsx("span",{children:"ADHDev"})]}),u.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),u.jsx("nav",{className:"sidebar-nav",children:lI.map(d=>u.jsxs("div",{className:c(d.path),id:`nav-${d.id}`,onClick:()=>l(d.path),title:s?d.label:void 0,children:[u.jsx("span",{className:"nav-icon",children:d.icon}),!s&&d.label]},d.id))}),u.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[u.jsxs("div",{className:`nav-item cursor-pointer${r.pathname==="/about"?" active":""} ${s?"justify-center py-2.5 px-0":""}`,id:"nav-about",onClick:()=>t("/about"),title:s?"About":void 0,children:[u.jsx("span",{className:"nav-icon",children:u.jsx(zT,{})}),!s&&"About"]}),!s&&u.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.18"]}),u.jsx(LR,{collapsed:s}),u.jsxs("div",{className:`nav-item cursor-pointer ${s?"justify-center py-2.5 px-0":"mt-1"}`,onClick:a,title:s?"Expand sidebar":"Collapse sidebar",children:[u.jsx("span",{className:"nav-icon text-base",children:s?"›":"‹"}),!s&&u.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),u.jsx("main",{className:"main-content relative",children:u.jsx("div",{className:"main-content-inner",children:e})})]})}const cI=[{icon:"🏠",title:"Local-first",desc:"Everything runs on your machine. No data leaves your network. Full privacy by design."},{icon:"💬",title:"Agent chat relay",desc:"Read and respond to AI conversations in real-time across all connected IDEs."},{icon:"📸",title:"Live screenshots",desc:"View your IDE screens directly in the browser via local WebSocket streaming."},{icon:"🎛️",title:"Remote control",desc:"Click, type, and interact with your IDE from the dashboard — no window switching."},{icon:"🔌",title:"Multi-IDE support",desc:"Monitor and control multiple IDEs simultaneously — VS Code, Cursor, Windsurf, and more."},{icon:"⚡",title:"Extension agents",desc:"Manage extension-based agents like Cline and Roo Code alongside native IDE agents."}],uI=[{icon:"🌍",title:"Access from anywhere",desc:"Control your agents from any device, any network. No VPN or port forwarding needed."},{icon:"🔗",title:"WebRTC P2P streaming",desc:"End-to-end encrypted peer-to-peer connection for zero-latency remote screenshots and control."},{icon:"📱",title:"Mobile notifications",desc:"Get push notifications when agents need approval. Quick approve/reject from your phone."},{icon:"📡",title:"REST API access",desc:"Integrate with Slack, CI/CD pipelines, or custom tools. Scoped API keys with granular permissions."},{icon:"👥",title:"Team dashboard",desc:"Share a unified view across your team. See who's running what, where, in real time."},{icon:"🔐",title:"Enterprise security",desc:"SSO, RBAC, audit logs, and SLA guarantees for production teams."}],hI=[{feature:"Agent chat relay",selfhost:!0,cloud:!0},{feature:"Live IDE screenshots",selfhost:!0,cloud:!0},{feature:"Remote IDE control",selfhost:!0,cloud:!0},{feature:"Multi-IDE monitoring",selfhost:!0,cloud:!0},{feature:"Extension agent support",selfhost:!0,cloud:!0},{feature:"CLI agent support",selfhost:!0,cloud:!0},{feature:"Access from any network",selfhost:!1,cloud:!0},{feature:"WebRTC P2P streaming",selfhost:!1,cloud:!0},{feature:"Mobile push notifications",selfhost:!1,cloud:!0},{feature:"REST API & webhooks",selfhost:!1,cloud:!0},{feature:"Team collaboration",selfhost:!1,cloud:!0},{feature:"Multi-machine (Burrows)",selfhost:!1,cloud:!0},{feature:"SSO / RBAC / Audit logs",selfhost:!1,cloud:!0}],Hu={ides:["VS Code","Cursor","Antigravity","Windsurf","Trae","PearAI","Kiro","VSCodium","VS Code Insiders"],agents:["GitHub Copilot","Cline","Roo Code"],cli:["Gemini CLI","Claude Code","Codex CLI"]};function dI(){return u.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[u.jsxs("div",{className:"text-center mb-10",children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),u.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),u.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev — Self-hosted Edition"}),u.jsxs("div",{className:"inline-block mt-3 px-3 py-1 text-[11px] font-semibold tracking-wide rounded-full bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:["SELFHOST v","0.5.18"]})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"✅"})," What's included"]}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:cI.map(e=>u.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[u.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),u.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),u.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-5",children:[{label:"IDEs",items:Hu.ides},{label:"Extension agents",items:Hu.agents},{label:"CLI agents",items:Hu.cli}].map(e=>u.jsxs("div",{children:[u.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),u.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>u.jsx("div",{className:"text-[12px] px-2.5 py-1.5 bg-bg-glass rounded-md border border-border-subtle",children:t},t))})]},e.label))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"⚖️"})," Self-hosted vs Cloud"]}),u.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:u.jsxs("table",{className:"w-full text-[13px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"bg-bg-secondary",children:[u.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),u.jsx("tbody",{children:hI.map((e,t)=>u.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[u.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),u.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?u.jsx("span",{className:"text-emerald-500",children:"✓"}):u.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),u.jsx("td",{className:"text-center px-4 py-2",children:u.jsx("span",{className:"text-emerald-500",children:"✓"})})]},e.feature))})]})})]}),u.jsx("section",{className:"mb-10",children:u.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:u.jsxs("div",{className:"flex items-start gap-4",children:[u.jsx("div",{className:"text-3xl shrink-0",children:"🚀"}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),u.jsx("p",{className:"text-[13px] text-text-muted leading-relaxed mb-4",children:"Access your agents from anywhere — your phone, another laptop, or a coffee shop. Cloud adds WebRTC P2P streaming, mobile push notifications, REST API, team collaboration, and multi-machine support. Your local setup stays exactly the same."}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:uI.map(e=>u.jsxs("div",{className:"flex gap-2.5 items-start",children:[u.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),u.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),u.jsxs("div",{className:"flex gap-3 flex-wrap",children:[u.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Try ADHDev Cloud →"}),u.jsx("a",{href:"https://github.com/vilmire/adhdev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"GitHub"}),u.jsx("a",{href:"https://discord.gg/WJD3tCfBzk",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Discord"})]})]})]})})}),u.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[u.jsx("p",{children:"© 2026 ADHDev · Your AI sidekick otter 🦦"}),u.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition — all data stays on your machine"})]})]})}function fI(){const{ides:e}=Zo(),t=e.find(h=>h.type==="adhdev-daemon"),r=(t==null?void 0:t.detectedIdes)||[],{sendCommand:n}=gi(),{userName:i}=Zo(),[s,o]=w.useState(i||"");w.useEffect(()=>{i!==void 0&&o(i)},[i]);const l=h=>{const f=h.target.value.trim();t!=null&&t.id&&f!==i&&n(t.id,"set_user_name",{userName:f}).catch(console.error)},[a,c]=w.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),d=h=>{c(h);try{localStorage.setItem("adhdev_sound",h?"1":"0")}catch{}};return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(SR,{icon:"⚙️",title:"Settings",subtitle:"Local daemon configuration & preferences"}),u.jsxs("div",{className:"page-content",children:[u.jsx(ao,{title:"Daemon",className:"mb-4",children:u.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-x-4 gap-y-2.5 text-sm",children:[u.jsx("span",{className:"text-text-muted",children:"Version"}),u.jsxs("span",{className:"font-mono text-xs",children:["v","0.5.18"]}),u.jsx("span",{className:"text-text-muted",children:"Status"}),u.jsx("span",{className:t?"text-green-400":"text-yellow-400",children:t?"● Running":"○ Not connected"}),u.jsx("span",{className:"text-text-muted",children:"WebSocket"}),u.jsx("span",{className:"font-mono text-xs",children:"ws://localhost:19222"}),u.jsx("span",{className:"text-text-muted",children:"HTTP"}),u.jsx("span",{className:"font-mono text-xs",children:"http://localhost:19280"})]})}),u.jsx(ao,{title:"Detected IDEs",className:"mb-4",children:r.length===0?u.jsx("p",{className:"text-sm text-text-muted",children:"No IDEs detected. Start an IDE to see it here."}):u.jsx("div",{className:"flex flex-col gap-1.5",children:r.map(h=>u.jsxs("div",{className:"flex justify-between items-center bg-bg-glass rounded-lg px-3.5 py-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:`w-2 h-2 rounded-full ${h.running?"bg-green-400":"bg-text-muted/30"}`}),u.jsx("span",{className:"text-sm font-medium",children:h.name})]}),u.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:h.type})]},h.type))})}),u.jsx(ao,{title:"Machine",className:"mb-4",children:u.jsx(BR,{ides:e,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),u.jsx(ao,{title:"Notifications",className:"mb-4",children:u.jsx(AR,{})}),u.jsx(ao,{title:"Preferences",className:"mb-4",children:u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsxs("div",{className:"flex items-center justify-between px-3.5 py-4 bg-bg-glass rounded-xl border border-border-subtle hover:border-border-hover transition-colors",children:[u.jsxs("div",{className:"flex flex-col gap-1 pr-4 max-w-[500px]",children:[u.jsx("span",{className:"text-sm font-semibold flex items-center gap-2",children:"👤 Display Name"}),u.jsx("span",{className:"text-[12px] text-text-muted leading-relaxed",children:"Your name shown in chat threads and on the team dashboard."})]}),u.jsx("input",{type:"text",className:"bg-bg-primary border border-border-strong rounded-lg px-3 py-1.5 text-sm w-48 text-right focus:border-accent-primary focus:outline-none transition-colors",placeholder:"Anonymous",value:s,onChange:h=>o(h.target.value),onBlur:l,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}})]}),u.jsx(is,{label:"🔊 Sound Effects",description:"Play a sound when agent completes or needs approval",checked:a,onChange:d})]})})]})]})}function tv(){const{ides:e}=Zo(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?u.jsx(aa,{to:`/machines/${t.id}`,replace:!0}):e.length>0?u.jsx(aa,{to:`/machines/${e[0].id}`,replace:!0}):u.jsx(aa,{to:"/dashboard",replace:!0})}function pI(){return u.jsx(Rk,{children:u.jsx(oI,{children:u.jsx(zk,{value:{sendCommand:xa,sendData:()=>!1},children:u.jsx(aI,{children:u.jsxs(Tk,{children:[u.jsx(yn,{path:"/dashboard",element:u.jsx(XR,{})}),u.jsx(yn,{path:"/ide/:id",element:u.jsx(QR,{})}),u.jsx(yn,{path:"/machine",element:u.jsx(tv,{})}),u.jsx(yn,{path:"/machines/:id",element:u.jsx(ZR,{})}),u.jsx(yn,{path:"/machines",element:u.jsx(tv,{})}),u.jsx(yn,{path:"/about",element:u.jsx(dI,{})}),u.jsx(yn,{path:"/settings",element:u.jsx(fI,{})}),u.jsx(yn,{path:"*",element:u.jsx(aa,{to:"/dashboard",replace:!0})})]})})})})})}vy(document.getElementById("root")).render(u.jsx(w.StrictMode,{children:u.jsx(pI,{})}));
|
package/public/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="description" content="ADHDev self-hosted dashboard for controlling AI agents" />
|
|
8
8
|
<link rel="icon" href="/otter-logo.png" />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-ewlTi_lf.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-Da6wVb2J.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|