@adhdev/daemon-standalone 0.5.6 → 0.5.7
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
|
@@ -183,4 +183,4 @@ ${ie}`,_localId:`sys_approval_${Date.now()}`};V(we=>{for(const Le of Object.keys
|
|
|
183
183
|
to { opacity: 1; transform: translateX(0); }
|
|
184
184
|
}
|
|
185
185
|
`})]})}function q4(e){return e.split(":")[0]||""}function Y4({renderHeaderActions:e}={}){var ye,G,Z;const{id:t}=W0(),r=gs(),n=Df(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=Li(),l=w.useMemo(()=>q4(t||""),[t]),a=w.useMemo(()=>i.find(X=>X.id===t),[i,t]),c=(a==null?void 0:a.type)||void 0,d=c?c.charAt(0).toUpperCase()+c.slice(1):"IDE",u=(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(X=>X.id===l||X.daemonId===l),[i,l]),S=(g==null?void 0:g.machineNickname)||((ye=g==null?void 0:g.machine)==null?void 0:ye.hostname)||"",_=((Z=(G=a==null?void 0:a.workspaceFolders)==null?void 0:G[0])==null?void 0:Z.name)||"",[y]=Rb(),x=typeof window<"u"&&window.innerWidth<=768,N=y.get("view")||(x?"chat":"split"),[T,C]=w.useState(N),[M,F]=w.useState("ide"),[$,E]=w.useState(""),[U,j]=w.useState(!1),[A,V]=w.useState(null),[D,O]=w.useState(null),[K,I]=w.useState([]),H=w.useMemo(()=>{var X,ce;return{ideId:t||"",daemonId:l,agentName:rd(c||""),agentType:c||"",status:(u==null?void 0:u.status)||"idle",title:(u==null?void 0:u.title)||"",messages:(u==null?void 0:u.messages)||[],ideType:c||"",workspaceName:(a==null?void 0:a.workspaceName)||"",displayPrimary:d,displaySecondary:(a==null?void 0:a.workspaceName)||"",cdpConnected:!0,modalButtons:(X=u==null?void 0:u.activeModal)==null?void 0:X.buttons,modalMessage:(ce=u==null?void 0:u.activeModal)==null?void 0:ce.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,u,a,d]);w.useEffect(()=>l?Xt.onScreenshot("ide-page",(ce,me)=>{if(ce!==l)return;const fe=new FileReader;fe.onload=()=>V(fe.result),fe.readAsDataURL(me)}):void 0,[l]),w.useEffect(()=>l?Xt.onStatusEvent((ce,me)=>{if(ce!==l)return;let fe="",xe="info";if(me.event==="agent:generating_completed"?(fe=`✅ Task completed${me.duration?` (${me.duration}s)`:""}`,xe="success"):(me.event==="agent:waiting_approval"||me.event==="agent:approval_requested")&&(fe="⚡ Approval needed",xe="warning"),fe){const B=Date.now();I(Qe=>[...Qe.slice(-4),{id:B,message:fe,type:xe}]),setTimeout(()=>I(Qe=>Qe.filter(pt=>pt.id!==B)),xe==="warning"?1e4:5e3)}}):void 0,[l]),w.useEffect(()=>{const X=l?Xt.get(l):null;!X||!(m==="connected")||(T!=="chat"?X.startScreenshots(c):X.stopScreenshots(c))},[T,m,c,l]);const b=w.useCallback(async(X,ce={})=>{if(!t)throw new Error("No IDE ID");const me={...ce};if(!me._targetInstance&&t){const xe=t.split(":");xe.length>=3&&(xe[1]==="ide"||xe[1]==="cli")&&(me._targetInstance=xe.slice(2).join(":"),me._targetType=xe[1])}const fe=l?Xt.get(l):null;return fe!=null&&fe.hasCommandChannel?await fe.sendCommand(X,me):fe&&fe.connectionState!=="failed"&&fe.connectionState!=="closed"&&await new Promise(B=>{const Ce=Date.now(),Qe=()=>{if(fe.hasCommandChannel)return B(!0);if(Date.now()-Ce>3e3)return B(!1);setTimeout(Qe,200)};Qe()})&&fe.hasCommandChannel?await fe.sendCommand(X,me):await o(t,X,me)},[t,l]),te=async()=>{const X=$.trim();if(!(!X||!t||U)){E(""),j(!0);try{await b("send_chat",{message:X,waitForResponse:!0})}catch(ce){console.error("[IDE] Send failed:",ce)}finally{j(!1)}}},ae=async X=>{if(t)try{const ce=await o(t,"screenshot",{width:X?Math.min(X,1280):1280});ce!=null&&ce.success&&(ce!=null&&ce.base64)&&O(`data:image/jpeg;base64,${ce.base64}`)}catch(ce){console.error("[IDE] Screenshot failed:",ce)}},k=f.length>0;return t?h.jsxs("div",{className:"ide-page",children:[h.jsxs("header",{className:"ide-header",children:[h.jsxs("div",{className:"ide-header-left",children:[h.jsxs("div",{className:"ide-title",children:[h.jsx("span",{className:"ide-name",children:d}),_&&h.jsx("span",{className:"ide-workspace",children:_}),h.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),h.jsxs("div",{className:"ide-status-pill",children:[h.jsx("span",{className:`ide-dot ${m==="connected"?"online":"connecting"}`}),h.jsx("span",{className:"ide-status-text",children:m==="connected"?"Connected":m==="connecting"?"Connecting":"WS"})]}),S&&h.jsx("span",{className:"ide-machine-label",children:S})]}),h.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(X=>h.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:T===X?"1px solid var(--accent-primary)":"none",background:T===X?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:T===X?"var(--accent-primary)":void 0},onClick:()=>C(X),children:X==="chat"?h.jsx(xf,{size:14}):X==="split"?"⊞":h.jsx(oo,{size:14})},X)),e&&e({daemonId:l,ideInstanceId:t||""}),h.jsx("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs",onClick:()=>r("/dashboard"),children:"← Back"})]})]}),h.jsxs("div",{className:"ide-content",children:[h.jsxs("div",{className:`ide-chat-panel ${T==="chat"?"full":""} ${T==="remote"?"hidden":""}`,children:[k&&h.jsxs("div",{className:"ide-chat-tabs",children:[h.jsx("button",{className:`ide-chat-tab ${M==="ide"?"active":""}`,onClick:()=>F("ide"),children:d}),h.jsxs("button",{className:`ide-chat-tab ext ${M==="extensions"?"active":""}`,onClick:()=>F("extensions"),children:["Extensions ",h.jsx("span",{className:"ide-ext-badge",children:f.length})]})]}),M==="extensions"&&k?h.jsx(t3,{ideId:t,agentStreams:f,sendCommand:async(X,ce)=>{try{const me=l?Xt.get(l):null;if(me&&m==="connected"){await Promise.race([me.sendCommand(X,ce),new Promise((fe,xe)=>setTimeout(()=>xe(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,X,ce)}}):h.jsx(Qx,{activeConv:H,ides:i,agentInput:$,setAgentInput:E,handleSendChat:te,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[]})]}),h.jsx("div",{className:`ide-remote-panel ${T==="remote"?"full":""} ${T==="chat"?"hidden":""}`,children:h.jsx(x4,{screenshot:D,isCapturing:!1,onRefresh:ae,addLog:()=>{},connState:m,connScreenshot:A,onAction:async(X,ce)=>{const me=l?Xt.get(l):null;if(me&&m==="connected")try{return await me.sendInput(X,ce)}catch(fe){console.error("[Connection Input] Failed:",fe)}return await o(t,"cdp_remote_action",{action:X,params:ce})}})})]}),K.length>0&&h.jsx("div",{className:"ide-toasts",children:K.map(X=>h.jsx("div",{className:`ide-toast ${X.type}`,onClick:()=>I(ce=>ce.filter(me=>me.id!==X.id)),children:X.message},X.id))})]}):h.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function X4(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 G4(){var jf,Bf,Of,zf,Ff,$f,Wf,Hf,Uf,Vf;const{id:e}=W0(),t=gs(),{sendCommand:r}=Li(),n=r,i=Df(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=w.useState([]),[c,d]=w.useState([]),[u,f]=w.useState(0),[p,m]=w.useState(!0),[g,S]=w.useState("debug"),[_,y]=w.useState(null),[x,N]=w.useState([]),[T,C]=w.useState(!1),[M,F]=w.useState(""),[$,E]=w.useState(""),[U,j]=w.useState(""),[A,V]=w.useState(""),[D,O]=w.useState(""),[K,I]=w.useState(""),[H,b]=w.useState(""),[te,ae]=w.useState("overview"),[k,ye]=w.useState([]),[G,Z]=w.useState(!1),[X,ce]=w.useState(!1),[me,fe]=w.useState(""),[xe,B]=w.useState([]),[Ce,Qe]=w.useState(!1),[pt,mr]=w.useState(null),[gr,Dr]=w.useState("all"),[_r,nn]=w.useState(""),[rr,kt]=w.useState(!1),[mt,ee]=w.useState(null),ge=w.useRef(null),R=w.useRef(!1);w.useEffect(()=>{if(!e||te!=="logs"||!p)return;const v=async()=>{try{const oe=await r(e,"get_logs",{count:200,minLevel:g,since:u}),ve=(oe==null?void 0:oe.result)||oe;if(oe!=null&&oe.success&&Array.isArray(ve==null?void 0:ve.logs)&&ve.logs.length>0){d(Pt=>[...Pt,...ve.logs.map(Ir=>({timestamp:Ir.ts,level:Ir.level,message:`[${Ir.category}] ${Ir.message}`}))].slice(-300));const je=Math.max(...ve.logs.map(Pt=>Pt.ts));f(je)}}catch{}};v();const z=setInterval(v,3e3);return()=>clearInterval(z)},[e,te,p,u,g]),w.useEffect(()=>{if(p&&c.length>0){const v=R.current?"smooth":"instant";setTimeout(()=>{var z;(z=ge.current)==null||z.scrollIntoView({behavior:v}),R.current=!0},50)}},[c.length,l.length,p]),w.useEffect(()=>{te!=="logs"&&(R.current=!1)},[te]);const q=async()=>{var v;if(e){Qe(!0);try{const z=await r(e,"get_provider_settings",{}),oe=(z==null?void 0:z.result)||z;if(z!=null&&z.success&&(oe!=null&&oe.settings)){const ve=[];for(const[je,Pt]of Object.entries(oe.settings)){const Kt=W.find(Ir=>Ir.type===je);ve.push({type:je,displayName:(Kt==null?void 0:Kt.displayName)||je,icon:(Kt==null?void 0:Kt.icon)||"",category:(Kt==null?void 0:Kt.category)||"unknown",schema:Pt,values:((v=oe.values)==null?void 0:v[je])||{}})}ve.sort((je,Pt)=>je.category.localeCompare(Pt.category)||je.displayName.localeCompare(Pt.displayName)),B(ve)}}catch{}Qe(!1)}};w.useEffect(()=>{te==="providers"&&xe.length===0&&q()},[te]);const de=async(v,z,oe)=>{mr(`${v}.${z}`),B(ve=>ve.map(je=>je.type===v?{...je,values:{...je.values,[z]:oe}}:je));try{const ve=await r(e,"set_provider_setting",{providerType:v,key:z,value:oe});ve!=null&&ve.success||q()}catch{q()}mr(null)},P=s.find(v=>v.id===e&&v.daemonMode),L=P?{id:P.id,hostname:((jf=P.machine)==null?void 0:jf.hostname)||P.id,platform:((Bf=P.machine)==null?void 0:Bf.platform)||"unknown",arch:((Of=P.machine)==null?void 0:Of.arch)||"",cpus:((zf=P.machine)==null?void 0:zf.cpus)||0,totalMem:((Ff=P.machine)==null?void 0:Ff.totalMem)||0,freeMem:(($f=P.machine)==null?void 0:$f.freeMem)||0,availableMem:(Wf=P.machine)==null?void 0:Wf.availableMem,loadavg:((Hf=P.machine)==null?void 0:Hf.loadavg)||[],uptime:((Uf=P.machine)==null?void 0:Uf.uptime)||0,release:((Vf=P.machine)==null?void 0:Vf.release)||"",cdpconnected:P.cdpconnected||!1,machineNickname:P.machineNickname||null,p2p:P.p2p||{available:!1,state:"unavailable",peers:0,screenshotActive:!1},detectedIdes:P.detectedIdes||[],managedIdeIds:P.managedIdeIds||[],managedCliIds:P.managedCliIds||[],workspaces:P.workspaces||[],defaultWorkspaceId:P.defaultWorkspaceId??P.activeWorkspaceId??null,defaultWorkspacePath:P.defaultWorkspacePath??P.activeWorkspacePath??null,workspaceActivity:P.workspaceActivity||[]}:null,W=(P==null?void 0:P.availableProviders)||[],Q={};for(const v of W)Q[v.type]=v.icon;const J=v=>Q[v]||"",le=W.filter(v=>v.category==="cli"),ue=W.filter(v=>v.category==="acp");w.useEffect(()=>{!U&&le.length>0&&j(le[0].type)},[U,le.length]),w.useEffect(()=>{!A&&ue.length>0&&V(ue[0].type)},[A,ue.length]);const ie=s.filter(v=>v.daemonId===e&&!v.daemonMode).filter(v=>!a_(v)&&!c_(v)).map(v=>({id:v.id,type:v.type,version:v.version||"",instanceId:v.instanceId||"",status:v.status,workspaceFolders:v.workspaceFolders||[],activeFile:v.activeFile||null,terminals:v.terminals||0,aiAgents:N4(v.aiAgents||v.agents||[]),activeChat:v.activeChat||null,chats:v.chats||[],agentStreams:v.agentStreams||[],cdpconnected:v.cdpconnected||!1,daemonId:e})),_e=s.filter(v=>v.daemonId===e&&a_(v)).map(v=>{var z,oe;return{id:v.id,type:v.type,cliName:v.cliName||v.type,status:v.status,workingDir:v.workingDir||((oe=(z=v.workspaceFolders)==null?void 0:z[0])==null?void 0:oe.path)||"",activeChat:v.activeChat||null,daemonId:e}}),we=s.filter(v=>v.daemonId===e&&c_(v)).map(v=>{var z,oe;return{id:v.id,type:v.type,acpName:v.cliName||v.type,status:v.status,workingDir:v.workingDir||((oe=(z=v.workspaceFolders)==null?void 0:z[0])==null?void 0:oe.path)||"",activeChat:v.activeChat||null,currentModel:v.currentModel,currentPlan:v.currentPlan,daemonId:e}}),Le=((L==null?void 0:L.detectedIdes)||[]).filter(v=>!v.running&&!ie.some(z=>(z.type||"").toLowerCase()===(v.type||"").toLowerCase())),be=(v,z)=>{a(oe=>[...oe.slice(-100),{timestamp:Date.now(),level:v,message:z}]),setTimeout(()=>{var oe;return(oe=ge.current)==null?void 0:oe.scrollIntoView({behavior:"smooth"})},100)},nt=async v=>{if(!(!e||_)){y(v),be("info",`Launching ${Xr(v)}...`);try{const z=await r(e,"launch_ide",{ideType:v,enableCdp:!0});be(z!=null&&z.success?"info":"error",z!=null&&z.success?`${Xr(v)} launched`:`Failed: ${z==null?void 0:z.error}`)}catch(z){be("error",`Launch error: ${z.message}`)}finally{y(null)}}},gt=async v=>{if(!e)return;const{cliType:z,dir:oe,workspaceId:ve,useDefaultWorkspace:je,useHome:Pt,argsStr:Kt,model:Ir}=v;if(!z){be("warn","Select a CLI or ACP provider first");return}const o1=Kt?Kt.split(/\s+/).filter(Boolean):void 0,Kf=(oe==null?void 0:oe.trim())||(ve?"(saved id)":je?"(default workspace)":Pt?"(home)":"");be("info",`Launching ${z}${Kf?` in ${Kf}`:""}${Ir?` (model: ${Ir})`:""}...`);try{const ei={cliType:z,cliArgs:o1,initialModel:Ir||void 0};oe!=null&&oe.trim()?ei.dir=oe.trim():ve?ei.workspaceId=ve:je?ei.useDefaultWorkspace=!0:Pt&&(ei.useHome=!0);const nr=await r(e,"launch_cli",ei),sn=(nr==null?void 0:nr.result)||nr;nr!=null&&nr.success?(be("info",`${z} launched`),(sn==null?void 0:sn.launchSource)==="home"?be("info","📂 Running in home directory (explicit choice)"):(sn==null?void 0:sn.launchSource)==="defaultWorkspace"&&be("info","📂 Using default workspace (explicit choice)")):(be("error",`Failed: ${(nr==null?void 0:nr.error)||(sn==null?void 0:sn.error)}`),(nr==null?void 0:nr.code)==="WORKSPACE_LAUNCH_CONTEXT_REQUIRED"&&ee({cliType:z,argsStr:Kt,model:Ir}))}catch(ei){be("error",`Launch error: ${ei.message}`)}},vr=(v,z,oe,ve)=>{if(e){if(!v){be("warn","Select a provider");return}if(!z.trim()){ee({cliType:v,argsStr:oe,model:ve});return}gt({cliType:v,dir:z,argsStr:oe,model:ve})}},Xo=async(v,z,oe)=>{if(e&&window.confirm(`Stop ${v}?
|
|
186
|
-
This will terminate the process.`))try{const ve=await r(e,"stop_cli",{cliType:v,dir:z,_targetInstance:oe});ve!=null&&ve.success?be("info",`${v} stopped`):be("error",`Stop failed: ${(ve==null?void 0:ve.error)||"Unknown error"}`)}catch(ve){be("error",`Stop failed: ${ve.message}`)}},rc=async v=>{try{await r(v.id,"restart_session",{ideType:v.type}),be("info",`${Xr(v.type)} restart initiated`)}catch(z){be("error",`Restart failed: ${z.message}`)}},nc=async()=>{if(e)try{const v=await r(e,"detect_ides",{});be("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){be("error",`Detection failed: ${v.message}`)}},Jn=async()=>{if(e){C(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&N(v.result)}catch(v){be("error",`Failed: ${v.message}`)}finally{C(!1)}}},If=async()=>{if(!(!e||!_r.trim())){kt(!0);try{const v=await r(e,"workspace_add",{path:_r.trim()});v!=null&&v.success?(be("info",`Workspace added: ${_r.trim()}`),nn("")):be("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){be("error",v.message)}finally{kt(!1)}}},Jx=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){kt(!0);try{const z=await r(e,"workspace_remove",{id:v});z!=null&&z.success?be("info","Workspace removed"):be("error",(z==null?void 0:z.error)||"workspace_remove failed")}catch(z){be("error",z.message)}finally{kt(!1)}}},e1=async v=>{if(e){kt(!0);try{const z=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(z!=null&&z.success){be("info",v?"Default workspace updated":"Default workspace cleared");const oe=typeof z.defaultWorkspacePath=="string"?z.defaultWorkspacePath:"";oe&&(F(oe),O(oe))}else be("error",(z==null?void 0:z.error)||"workspace_set_default failed")}catch(z){be("error",z.message)}finally{kt(!1)}}},t1=async v=>{if(!e||!v.trim())return;const z=v.trim();kt(!0);try{const oe=await r(e,"workspace_set_default",{path:z});oe!=null&&oe.success?(be("info","Default workspace set from history"),F(z),O(z)):be("error",(oe==null?void 0:oe.error)||"Could not set default (path missing on disk?)")}catch(oe){be("error",oe.message)}finally{kt(!1)}},ic=w.useCallback(async()=>{var v;if(e){Z(!0);try{let z=await r(e,"get_cli_history",{});z!=null&&z.success||(z=await n(e,"get_cli_history"));const oe=(z==null?void 0:z.history)??((v=z==null?void 0:z.result)==null?void 0:v.history);z!=null&&z.success&&Array.isArray(oe)&&ye(oe)}catch{}Z(!1)}},[e,r,n]);w.useEffect(()=>{te==="overview"&&e&&ic()},[te,e,ic]);const Rf=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:me}),be("info",`Nickname set to "${me||"(cleared)"}"`),ce(!1)}catch(v){be("error",`Failed: ${v.message}`)}};if(!L)return o?h.jsxs("div",{className:"p-10 text-center text-text-muted",children:[h.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),h.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),h.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):h.jsx("div",{className:"p-10 text-center text-text-muted",children:h.jsx("p",{children:"⏳ Loading machine..."})});const Mf=L.availableMem??L.freeMem,r1=L.totalMem>0?Math.min(100,Math.max(0,Math.round((L.totalMem-Mf)/L.totalMem*100))):0,Af=L.loadavg[0]||0,n1=L.machineNickname||L.hostname,i1=(v,z,oe)=>{const ve=W.find(Pt=>Pt.type===v),je=(oe||[]).join(" ");(ve==null?void 0:ve.category)==="acp"?(V(v),O(z),b(je),ae("acps")):(j(v),F(z),E(je),ae("clis"))},s1=[{id:"overview",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(VT,{size:14})," Overview"]})},{id:"ides",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(oo,{size:14})," IDEs"]}),count:ie.length},{id:"clis",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(nx,{size:14})," CLIs"]}),count:_e.length},{id:"acps",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(YT,{size:14})," ACP Agents"]}),count:we.length},{id:"providers",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(zT,{size:14})," Providers"]}),count:xe.length>0?xe.length:void 0},{id:"logs",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(OT,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"dashboard-header flex-col !items-stretch !p-0",children:[h.jsx("div",{className:"flex items-center justify-between px-6 py-4 w-full",children:h.jsxs("div",{className:"flex items-center gap-3.5",children:[h.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"←"}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[X?h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsx("input",{autoFocus:!0,value:me,onChange:v=>fe(v.target.value),onKeyDown:v=>{v.key==="Enter"&&Rf(),v.key==="Escape"&&ce(!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-[200px]"}),h.jsx("button",{onClick:Rf,className:"machine-btn text-green-500 border-green-500/30",children:"✓"}),h.jsx("button",{onClick:()=>ce(!1),className:"machine-btn",children:"✕"})]}):h.jsx("h1",{className:"header-title cursor-pointer",onClick:()=>{ce(!0),fe(L.machineNickname||"")},title:"Click to set nickname",children:n1}),h.jsx("span",{className:"status-dot-md online"})]}),h.jsxs("div",{className:"header-subtitle mt-1 flex gap-2 items-center",children:[h.jsxs("span",{children:[L.platform," · ",L.arch," · ",L.cpus," cores"]}),L.p2p.available&&h.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:L.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:L.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",L.p2p.state==="connected"?`● ${L.p2p.peers}`:"○"]}),L.cdpconnected&&h.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500",children:"CDP ●"}),L.machineNickname&&h.jsxs("span",{className:"text-text-muted opacity-80",children:["(",L.hostname,")"]})]})]})]})}),h.jsx("div",{className:"machine-tabs px-6",children:s1.map(v=>h.jsxs("button",{onClick:()=>ae(v.id),className:`machine-tab${te===v.id?" active":""}`,children:[v.label,v.count!==void 0&&h.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),h.jsxs("div",{className:"page-content",children:[te==="overview"&&h.jsxs("div",{children:[h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[h.jsx(s_,{icon:h.jsx(cg,{size:16}),label:"Uptime",value:E4(L.uptime)}),h.jsx(s_,{icon:h.jsx(oo,{size:16}),label:"IDEs",value:`${ie.length}`,sub:`${_e.length} CLIs`})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),h.jsxs("div",{className:"flex gap-6",children:[h.jsx(o_,{value:Math.min(Math.round(Af/L.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${Af.toFixed(2)} avg / ${L.cpus} cores`}),h.jsx(o_,{value:r1,max:100,label:"Memory",color:"#3b82f6",detail:`${l_(L.totalMem-Mf)} / ${l_(L.totalMem)}${L.platform==="darwin"?" (approx.)":""}`})]})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[h.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[h.jsx(lo,{size:14})," Workspaces"]})}),h.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 ",h.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.']}),h.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[h.jsx("span",{className:"text-[10px] text-text-muted",children:"Default:"}),h.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:rr,value:L.defaultWorkspaceId||"",onChange:v=>{const z=v.target.value;e1(z===""?null:z)},children:[h.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(L.workspaces||[]).map(v=>h.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),L.defaultWorkspacePath&&h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:L.defaultWorkspacePath,children:L.defaultWorkspacePath})]}),h.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[h.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:_r,disabled:rr,onChange:v=>nn(v.target.value),onKeyDown:v=>v.key==="Enter"&&void If()}),h.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:rr,onClick:()=>void If(),children:"Add"})]}),(L.workspaces||[]).length>0&&h.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(L.workspaces||[]).map(v=>h.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[h.jsx("span",{className:"font-mono truncate flex-1",title:v.path,children:v.path}),h.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:rr,onClick:()=>void Jx(v.id),children:"Remove"})]},v.id))})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle border-violet-500/15",children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1 flex items-center gap-1.5",children:[h.jsx(cg,{size:14})," Pick up where you left off"]}),h.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."}),h.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent CLI / ACP launches"}),k.length>0?h.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,z)=>{const oe=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.dir||"?"}`;return h.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:[h.jsxs("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,240px)]",title:v.dir,children:[J(v.cliType)," ",oe]}),h.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.dir}),h.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void gt({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>i1(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${z}`)})}):h.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."}),(L.workspaceActivity||[]).length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent workspace paths"}),h.jsx("div",{className:"flex flex-col gap-1.5",children:(L.workspaceActivity||[]).slice(0,12).map(v=>{const z=v.path.split("/").filter(Boolean).pop()||v.path,oe=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ve=(v.kind==="cli"||v.kind==="acp")&&!!v.agentType;return h.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:[h.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,200px)]",title:v.path,children:z}),oe&&h.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:oe}),v.agentType&&h.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),h.jsx("span",{className:"text-[9px] text-text-muted",children:X4(v.lastUsedAt)}),h.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ve&&h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void gt({cliType:v.agentType,dir:v.path}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{F(v.path),O(v.path),ae("clis")},children:"CLIs tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{F(v.path),O(v.path),ae("acps")},children:"ACP tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:rr,onClick:()=>void t1(v.path),children:"Set default"})]})]},`${v.path}-${v.lastUsedAt}`)})})]})]}),h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),h.jsx("button",{onClick:()=>ae("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),ie.length===0?h.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):h.jsx("div",{className:"flex flex-col gap-1.5",children:ie.map(v=>{var oe,ve,je;const z=(v.agentStreams||[]).some(Pt=>Pt.status==="generating"||Pt.status==="streaming")||((oe=v.activeChat)==null?void 0:oe.status)==="generating";return h.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 ${z?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[h.jsx("span",{children:J(v.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:Xr(v.type)}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:((je=(ve=v.workspaceFolders)==null?void 0:ve[0])==null?void 0:je.name)||""}),z&&h.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),h.jsx("span",{className:`${z?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:z?"#fb923c":"#22c55e",boxShadow:z?"0 0 8px rgba(249,115,22,0.4)":"none",animation:z?"pulse-dot 1.5s infinite":"none"}})]},v.id)})})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),h.jsx("button",{onClick:()=>ae("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),_e.length===0?h.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):h.jsx("div",{className:"flex flex-col gap-1.5",children:_e.map(v=>h.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[h.jsx("span",{children:J(v.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workingDir.split("/").pop()}),h.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),L.detectedIdes.length>0&&h.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:L.detectedIdes.map(v=>h.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:[h.jsx("span",{children:J(v.type)}),v.name||v.type,h.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),te==="ides"&&h.jsxs("div",{children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ie.length,")"]}),ie.length===0?h.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."}):h.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:ie.map(v=>{var z,oe;return h.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-lg",children:J(v.type)}),h.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Xr(v.type)}),v.version&&h.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.version]}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[h.jsx(oo,{size:13})," Control"]}),h.jsx("button",{onClick:()=>rc(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"})]})]}),h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(130px,1fr))] gap-1.5 text-xs text-text-secondary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",((z=v.workspaceFolders)==null?void 0:z.map(ve=>ve.name).join(", "))||"—"]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"File:"})," ",((oe=v.activeFile)==null?void 0:oe.split("/").pop())||"—"]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"Terminals:"})," ",v.terminals]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"CDP:"})," ",v.cdpconnected?"● connected":"○ Off"]})]}),v.aiAgents.length>0&&h.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:v.aiAgents.map(ve=>h.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${ve.status==="generating"||ve.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[ve.name," · ",ve.status]},ve.id))})]},v.id)})}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",Le.length,")"]}),h.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:L.defaultWorkspacePath?`Opens in default workspace: ${L.defaultWorkspacePath.split("/").filter(Boolean).pop()||L.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."}),h.jsxs("div",{className:"flex flex-wrap gap-2",children:[Le.map(v=>h.jsxs("button",{onClick:()=>nt(v.type||v.id||""),disabled:!!_,className:"machine-btn-primary flex items-center gap-1.5",style:{opacity:_&&_!==v.type?.4:1},children:[h.jsx("span",{children:J(v.type)}),_===v.type?"⏳ Launching...":`▶ ${v.name||Xr(v.type)}`]},v.type)),Le.length===0&&h.jsxs("div",{className:"text-xs text-text-muted italic",children:["All detected IDEs are running, or none detected.",h.jsxs("button",{onClick:nc,className:"machine-btn ml-2 flex items-center gap-1",children:[h.jsx(WT,{size:12})," Scan"]})]})]})]}),te==="clis"&&h.jsxs("div",{children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),h.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."}),h.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[h.jsx("select",{value:U,onChange:v=>j(v.target.value),className:"machine-input",children:le.length>0?le.map(v=>h.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):h.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),h.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:M,onChange:v=>F(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),h.jsx("input",{type:"text",placeholder:"Args (optional)",value:$,onChange:v=>E(v.target.value),className:"machine-input min-w-[150px]"}),h.jsx("button",{onClick:()=>vr(U,M,$||void 0),className:"machine-btn-primary",children:"▶ Launch"}),h.jsx("button",{type:"button",disabled:!(L!=null&&L.defaultWorkspacePath),title:L!=null&&L.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void gt({cliType:U,useDefaultWorkspace:!0,argsStr:$||void 0}),className:"machine-btn text-[10px]",children:"Default"}),h.jsx("button",{type:"button",onClick:()=>void gt({cliType:U,useHome:!0,argsStr:$||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",_e.length,")"]}),_e.length===0?h.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"}):h.jsx("div",{className:"flex flex-col gap-2 mb-5",children:_e.map(v=>h.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx("span",{className:"text-lg",children:J(v.type)}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),h.jsx("div",{className:"text-[11px] text-text-muted",children:v.workingDir})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.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"?h.jsx("button",{onClick:()=>vr(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):h.jsx("button",{onClick:()=>Xo(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),h.jsx("button",{onClick:ic,disabled:G,className:"machine-btn",children:G?"⏳":"↻ Load"})]}),k.length>0&&h.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,z)=>{var oe,ve;return h.jsxs("div",{onClick:()=>{j(v.cliType),F(v.dir),E((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:je=>je.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:je=>je.currentTarget.style.background="var(--bg-glass)",children:[h.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[h.jsx("span",{children:J(v.cliType)}),h.jsx("span",{children:((oe=v.dir)==null?void 0:oe.split("/").filter(Boolean).pop())||"root"}),((ve=v.cliArgs)==null?void 0:ve.length)>0&&h.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),h.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},z)})}),h.jsxs("div",{className:"mt-5",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),h.jsx("button",{onClick:Jn,disabled:T,className:"machine-btn",children:T?"⏳":"↻ Load"})]}),x.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,z)=>h.jsx("button",{onClick:()=>F(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(lo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},z))})]})]}),te==="acps"&&h.jsxs("div",{children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),h.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."}),h.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[h.jsx("select",{value:A,onChange:v=>V(v.target.value),className:"machine-input",children:ue.length>0?ue.map(v=>h.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):h.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),h.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:D,onChange:v=>O(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),h.jsx("input",{type:"text",placeholder:"Model (default)",value:K,onChange:v=>I(v.target.value),className:"machine-input min-w-[120px]"}),h.jsx("input",{type:"text",placeholder:"Args (optional)",value:H,onChange:v=>b(v.target.value),className:"machine-input min-w-[120px]"}),h.jsx("button",{onClick:()=>vr(A,D,H||void 0,K||void 0),className:"machine-btn-primary",children:"▶ Launch"}),h.jsx("button",{type:"button",disabled:!(L!=null&&L.defaultWorkspacePath),title:L!=null&&L.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void gt({cliType:A,useDefaultWorkspace:!0,argsStr:H||void 0,model:K||void 0}),className:"machine-btn text-[10px]",children:"Default"}),h.jsx("button",{type:"button",onClick:()=>void gt({cliType:A,useHome:!0,argsStr:H||void 0,model:K||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",we.length,")"]}),we.length===0?h.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"}):h.jsx("div",{className:"flex flex-col gap-2 mb-5",children:we.map(v=>h.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx("span",{className:"text-lg",children:J(v.type)}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),h.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[h.jsx("span",{children:v.workingDir}),v.currentModel&&h.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&h.jsxs("span",{className:"text-amber-500",children:["📋 ",v.currentPlan]})]})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.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}),h.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:h.jsx(xf,{size:14})}),v.status==="stopped"?h.jsx("button",{onClick:()=>vr(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):h.jsx("button",{onClick:()=>Xo(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),h.jsxs("div",{className:"mt-5",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),h.jsx("button",{onClick:Jn,disabled:T,className:"machine-btn",children:T?"⏳":"↻ Load"})]}),x.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,z)=>h.jsx("button",{onClick:()=>O(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(lo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},z))})]})]}),te==="providers"&&h.jsxs("div",{children:[h.jsxs("div",{className:"flex justify-between items-center mb-4",children:[h.jsxs("div",{className:"flex gap-1 items-center",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(v=>h.jsx("button",{onClick:()=>Dr(v),className:`machine-btn text-[10px] px-2 py-0.5 ${gr===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),h.jsx("button",{onClick:q,disabled:Ce,className:"machine-btn",children:Ce?"⏳ Loading...":"↻ Refresh"})]}),Ce&&xe.length===0?h.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):h.jsx("div",{className:"flex flex-col gap-2",children:xe.filter(v=>gr==="all"||v.category===gr).map(v=>h.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-lg",children:v.icon}),h.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),h.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})]}),h.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(z=>h.jsxs("div",{className:"flex items-center justify-between gap-3",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[z.label||z.key,pt===`${v.type}.${z.key}`&&h.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),z.description&&h.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:z.description})]}),h.jsx("div",{className:"shrink-0",children:z.type==="boolean"?h.jsx("button",{onClick:()=>de(v.type,z.key,!(v.values[z.key]??z.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[z.key]??z.default?"#8b5cf6":"var(--border-subtle)"},children:h.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[z.key]??z.default?21:3}})}):z.type==="number"?h.jsx("input",{type:"number",value:v.values[z.key]??z.default??0,min:z.min,max:z.max,onChange:oe=>{const ve=parseInt(oe.target.value)||0;z.min!==void 0&&ve<z.min||z.max!==void 0&&ve>z.max||de(v.type,z.key,ve)},className:"machine-input w-20 text-center text-[11px]"}):z.type==="select"&&z.options?h.jsx("select",{value:v.values[z.key]??z.default??"",onChange:oe=>de(v.type,z.key,oe.target.value),className:"machine-input text-[11px]",children:z.options.map(oe=>h.jsx("option",{value:oe,children:oe},oe))}):h.jsx("input",{type:"text",value:v.values[z.key]??z.default??"",onBlur:oe=>de(v.type,z.key,oe.target.value),className:"machine-input w-[120px] text-[11px]"})})]},z.key))})]},v.type))})]}),te==="logs"&&h.jsxs("div",{children:[h.jsxs("div",{className:"flex justify-between items-center mb-3",children:[h.jsxs("div",{className:"flex gap-1 items-center",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(v=>h.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))]}),h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),h.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),h.jsx("button",{onClick:()=>{d([]),f(0)},className:"machine-btn",children:"Clear"})]})]}),h.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&&h.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,z)=>h.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[h.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),h.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"}),h.jsx("span",{children:v.message})]},z)),h.jsx("div",{ref:ge})]})]})]}),mt&&L&&h.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:h.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border-subtle bg-bg-secondary shadow-xl p-5",children:[h.jsx("h2",{id:"launch-pick-title",className:"text-sm font-semibold text-text-primary m-0 mb-1",children:"Where should this run?"}),h.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."}),h.jsx("div",{className:"flex flex-col gap-2 mb-4 max-h-48 overflow-y-auto",children:(L.workspaces||[]).length===0?h.jsx("span",{className:"text-[11px] text-text-muted",children:"No saved workspaces yet. Add one in Overview or type a path above."}):(L.workspaces||[]).map(v=>h.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 z=mt;ee(null),gt({cliType:z.cliType,workspaceId:v.id,argsStr:z.argsStr,model:z.model})},children:[h.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.id))}),h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",disabled:!L.defaultWorkspacePath,onClick:()=>{const v=mt;ee(null),gt({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=mt;ee(null),gt({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>ee(null),children:"Cancel"})]})]})})]})}function Q4(){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 p_=Q4(),m_=3e3,Z4=3e4;let cn=null,J4=0;const Na=new Map,nd=new Set;let ii=null;async function Vl(e,t,r){const n=cn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++J4}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{Na.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);Na.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 eD{constructor(t){ws(this,"daemonId");ws(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(cn==null?void 0:cn.readyState)===WebSocket.OPEN}get connectionState(){return(cn==null?void 0:cn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return Vl(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId;return Vl(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ii&&(clearInterval(ii),ii=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId,i=await Vl(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());nd.forEach(o=>o("standalone",s))}}catch{}};r(),ii=setInterval(r,2e3)}stopScreenshots(t){ii&&(clearInterval(ii),ii=null)}}let si=null;function tD(e){(!si||si.daemonId!==e)&&(si=new eD(e));const t=Xt._originalGet||Xt.get.bind(Xt);Xt._originalGet=t,Xt.get=r=>r===e||r.startsWith("standalone")?si:t(r),Xt.getState=r=>(r===e||r.startsWith("standalone"))&&(si==null?void 0:si.connectionState)||"disconnected",Xt.onScreenshot=(r,n)=>(nd.add(n),()=>{nd.delete(n)})}function rD({children:e}){const t=w.useRef(hm()),r=hm();t.current=r;const[,n]=w.useState("disconnected"),i=w.useRef(null),s=w.useRef(),o=w.useRef(m_),l=w.useRef(!0);return w.useEffect(()=>{l.current=!0;function a(){var u,f;if(!l.current||((u=i.current)==null?void 0:u.readyState)===WebSocket.OPEN||((f=i.current)==null?void 0:f.readyState)===WebSocket.CONNECTING)return;n("connecting"),console.log(`[Standalone WS] Connecting to ${p_}...`);let d;try{d=new WebSocket(p_)}catch(p){console.error("[Standalone WS] Failed to create WebSocket:",p),c();return}i.current=d,d.onopen=()=>{if(!l.current){d.close();return}n("connected"),o.current=m_,console.log("[Standalone WS] Connected")},cn=d,d.onmessage=p=>{var m;try{const g=JSON.parse(p.data);if((g.type==="command_result"||g.type==="error")&&g.requestId){const S=Na.get(g.requestId);S&&(Na.delete(g.requestId),g.type==="error"?S.reject(new Error(((m=g.data)==null?void 0:m.message)||"Command failed")):S.resolve(g.data));return}if(g.type==="status"||g.type==="initial_state"){const S=g.data;if(!S)return;const{injectEntries:_,markLoaded:y}=t.current,x=[],N=S.id||"standalone";tD(N),x.push({id:N,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:S.hostname,platform:S.platform,...S.system||{}},system:S.system||null,timestamp:S.timestamp,cdpConnected:S.cdpConnected,detectedIdes:S.detectedIdes||[],availableProviders:S.availableProviders||[],workspaces:S.workspaces,defaultWorkspaceId:S.defaultWorkspaceId??S.activeWorkspaceId,defaultWorkspacePath:S.defaultWorkspacePath??S.activeWorkspacePath,workspaceActivity:S.workspaceActivity,managedIdeIds:(S.ides||[]).map(T=>T.id),managedCliIds:(S.clis||[]).map(T=>T.id)});for(const T of S.ides||[])x.push({...T,daemonId:S.id||"standalone",status:T.cdpConnected?"online":"detected"});for(const T of S.clis||[])x.push({...T,daemonId:S.id||"standalone",status:T.isRunning?"running":"stopped"});x.length>0&&_(x),y()}}catch(g){console.error("[Standalone WS] Parse error:",g)}},d.onclose=()=>{l.current&&(n("disconnected"),i.current=null,c())},d.onerror=p=>{console.warn("[Standalone WS] Error, will reconnect:",p)}}function c(){if(!l.current)return;clearTimeout(s.current);const d=o.current;console.log(`[Standalone WS] Reconnecting in ${d}ms...`),s.current=setTimeout(()=>{o.current=Math.min(o.current*1.5,Z4),a()},d)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,cn=null)}},[]),h.jsx(h.Fragment,{children:e})}function nD({children:e}){return h.jsx(Ab,{children:h.jsx(rD,{children:e})})}const iD=[{id:"dashboard",path:"/dashboard",icon:h.jsx(jT,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:h.jsx(BT,{}),label:"Burrow"}];function sD({children:e}){const t=gs(),r=$o(),[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 u=!d;try{localStorage.setItem("sidebar-collapsed",u?"1":"0")}catch{}return u})},c=d=>`nav-item${r.pathname.startsWith(d)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return h.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[h.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[h.jsx("span",{className:"mobile-menu-icon"}),h.jsx("span",{className:"mobile-menu-icon"}),h.jsx("span",{className:"mobile-menu-icon"})]}),n&&h.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:d=>d.key==="Escape"&&i(!1)}),h.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[h.jsxs("div",{className:"sidebar-header",children:[h.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[h.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&h.jsx("span",{children:"ADHDev"})]}),h.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),h.jsx("nav",{className:"sidebar-nav",children:iD.map(d=>h.jsxs("div",{className:c(d.path),id:`nav-${d.id}`,onClick:()=>l(d.path),title:s?d.label:void 0,children:[h.jsx("span",{className:"nav-icon",children:d.icon}),!s&&d.label]},d.id))}),h.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[h.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:[h.jsx("span",{className:"nav-icon",children:h.jsx(FT,{})}),!s&&"About"]}),!s&&h.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.6"]}),h.jsx(j4,{collapsed:s}),h.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:[h.jsx("span",{className:"nav-icon text-base",children:s?"›":"‹"}),!s&&h.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),h.jsx("main",{className:"main-content relative",children:h.jsx("div",{className:"main-content-inner",children:e})})]})}const oD=[{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."}],lD=[{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."}],aD=[{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 cD(){return h.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[h.jsxs("div",{className:"text-center mb-10",children:[h.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),h.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),h.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev — Self-hosted Edition"}),h.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.6"]})]}),h.jsxs("section",{className:"mb-10",children:[h.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[h.jsx("span",{className:"text-base",children:"✅"})," What's included"]}),h.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:oD.map(e=>h.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[h.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),h.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),h.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),h.jsxs("section",{className:"mb-10",children:[h.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),h.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=>h.jsxs("div",{children:[h.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),h.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>h.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))})]}),h.jsxs("section",{className:"mb-10",children:[h.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[h.jsx("span",{className:"text-base",children:"⚖️"})," Self-hosted vs Cloud"]}),h.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:h.jsxs("table",{className:"w-full text-[13px]",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"bg-bg-secondary",children:[h.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),h.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),h.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),h.jsx("tbody",{children:aD.map((e,t)=>h.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[h.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),h.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?h.jsx("span",{className:"text-emerald-500",children:"✓"}):h.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),h.jsx("td",{className:"text-center px-4 py-2",children:h.jsx("span",{className:"text-emerald-500",children:"✓"})})]},e.feature))})]})})]}),h.jsx("section",{className:"mb-10",children:h.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:h.jsxs("div",{className:"flex items-start gap-4",children:[h.jsx("div",{className:"text-3xl shrink-0",children:"🚀"}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),h.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."}),h.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:lD.map(e=>h.jsxs("div",{className:"flex gap-2.5 items-start",children:[h.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),h.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),h.jsxs("div",{className:"flex gap-3 flex-wrap",children:[h.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 →"}),h.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"}),h.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"})]})]})]})})}),h.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[h.jsx("p",{children:"© 2026 ADHDev · Your AI sidekick otter 🦦"}),h.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition — all data stays on your machine"})]})]})}function g_(){const{ides:e}=Y0(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?h.jsx(Al,{to:`/machines/${t.id}`,replace:!0}):e.length>0?h.jsx(Al,{to:`/machines/${e[0].id}`,replace:!0}):h.jsx(Al,{to:"/dashboard",replace:!0})}function uD(){return h.jsx(Ib,{children:h.jsx(nD,{children:h.jsx(zb,{value:{sendCommand:Vl,sendData:()=>!1},children:h.jsx(sD,{children:h.jsxs(Tb,{children:[h.jsx(Nn,{path:"/dashboard",element:h.jsx(K4,{})}),h.jsx(Nn,{path:"/ide/:id",element:h.jsx(Y4,{})}),h.jsx(Nn,{path:"/machine",element:h.jsx(g_,{})}),h.jsx(Nn,{path:"/machines/:id",element:h.jsx(G4,{})}),h.jsx(Nn,{path:"/machines",element:h.jsx(g_,{})}),h.jsx(Nn,{path:"/about",element:h.jsx(cD,{})}),h.jsx(Nn,{path:"*",element:h.jsx(Al,{to:"/dashboard",replace:!0})})]})})})})})}I0(document.getElementById("root")).render(h.jsx(w.StrictMode,{children:h.jsx(uD,{})}));
|
|
186
|
+
This will terminate the process.`))try{const ve=await r(e,"stop_cli",{cliType:v,dir:z,_targetInstance:oe});ve!=null&&ve.success?be("info",`${v} stopped`):be("error",`Stop failed: ${(ve==null?void 0:ve.error)||"Unknown error"}`)}catch(ve){be("error",`Stop failed: ${ve.message}`)}},rc=async v=>{try{await r(v.id,"restart_session",{ideType:v.type}),be("info",`${Xr(v.type)} restart initiated`)}catch(z){be("error",`Restart failed: ${z.message}`)}},nc=async()=>{if(e)try{const v=await r(e,"detect_ides",{});be("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){be("error",`Detection failed: ${v.message}`)}},Jn=async()=>{if(e){C(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&N(v.result)}catch(v){be("error",`Failed: ${v.message}`)}finally{C(!1)}}},If=async()=>{if(!(!e||!_r.trim())){kt(!0);try{const v=await r(e,"workspace_add",{path:_r.trim()});v!=null&&v.success?(be("info",`Workspace added: ${_r.trim()}`),nn("")):be("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){be("error",v.message)}finally{kt(!1)}}},Jx=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){kt(!0);try{const z=await r(e,"workspace_remove",{id:v});z!=null&&z.success?be("info","Workspace removed"):be("error",(z==null?void 0:z.error)||"workspace_remove failed")}catch(z){be("error",z.message)}finally{kt(!1)}}},e1=async v=>{if(e){kt(!0);try{const z=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(z!=null&&z.success){be("info",v?"Default workspace updated":"Default workspace cleared");const oe=typeof z.defaultWorkspacePath=="string"?z.defaultWorkspacePath:"";oe&&(F(oe),O(oe))}else be("error",(z==null?void 0:z.error)||"workspace_set_default failed")}catch(z){be("error",z.message)}finally{kt(!1)}}},t1=async v=>{if(!e||!v.trim())return;const z=v.trim();kt(!0);try{const oe=await r(e,"workspace_set_default",{path:z});oe!=null&&oe.success?(be("info","Default workspace set from history"),F(z),O(z)):be("error",(oe==null?void 0:oe.error)||"Could not set default (path missing on disk?)")}catch(oe){be("error",oe.message)}finally{kt(!1)}},ic=w.useCallback(async()=>{var v;if(e){Z(!0);try{let z=await r(e,"get_cli_history",{});z!=null&&z.success||(z=await n(e,"get_cli_history"));const oe=(z==null?void 0:z.history)??((v=z==null?void 0:z.result)==null?void 0:v.history);z!=null&&z.success&&Array.isArray(oe)&&ye(oe)}catch{}Z(!1)}},[e,r,n]);w.useEffect(()=>{te==="overview"&&e&&ic()},[te,e,ic]);const Rf=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:me}),be("info",`Nickname set to "${me||"(cleared)"}"`),ce(!1)}catch(v){be("error",`Failed: ${v.message}`)}};if(!L)return o?h.jsxs("div",{className:"p-10 text-center text-text-muted",children:[h.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),h.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),h.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):h.jsx("div",{className:"p-10 text-center text-text-muted",children:h.jsx("p",{children:"⏳ Loading machine..."})});const Mf=L.availableMem??L.freeMem,r1=L.totalMem>0?Math.min(100,Math.max(0,Math.round((L.totalMem-Mf)/L.totalMem*100))):0,Af=L.loadavg[0]||0,n1=L.machineNickname||L.hostname,i1=(v,z,oe)=>{const ve=W.find(Pt=>Pt.type===v),je=(oe||[]).join(" ");(ve==null?void 0:ve.category)==="acp"?(V(v),O(z),b(je),ae("acps")):(j(v),F(z),E(je),ae("clis"))},s1=[{id:"overview",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(VT,{size:14})," Overview"]})},{id:"ides",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(oo,{size:14})," IDEs"]}),count:ie.length},{id:"clis",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(nx,{size:14})," CLIs"]}),count:_e.length},{id:"acps",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(YT,{size:14})," ACP Agents"]}),count:we.length},{id:"providers",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(zT,{size:14})," Providers"]}),count:xe.length>0?xe.length:void 0},{id:"logs",label:h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(OT,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"dashboard-header flex-col !items-stretch !p-0",children:[h.jsx("div",{className:"flex items-center justify-between px-6 py-4 w-full",children:h.jsxs("div",{className:"flex items-center gap-3.5",children:[h.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"←"}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[X?h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsx("input",{autoFocus:!0,value:me,onChange:v=>fe(v.target.value),onKeyDown:v=>{v.key==="Enter"&&Rf(),v.key==="Escape"&&ce(!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-[200px]"}),h.jsx("button",{onClick:Rf,className:"machine-btn text-green-500 border-green-500/30",children:"✓"}),h.jsx("button",{onClick:()=>ce(!1),className:"machine-btn",children:"✕"})]}):h.jsx("h1",{className:"header-title cursor-pointer",onClick:()=>{ce(!0),fe(L.machineNickname||"")},title:"Click to set nickname",children:n1}),h.jsx("span",{className:"status-dot-md online"})]}),h.jsxs("div",{className:"header-subtitle mt-1 flex gap-2 items-center",children:[h.jsxs("span",{children:[L.platform," · ",L.arch," · ",L.cpus," cores"]}),L.p2p.available&&h.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:L.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:L.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",L.p2p.state==="connected"?`● ${L.p2p.peers}`:"○"]}),L.cdpconnected&&h.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500",children:"CDP ●"}),L.machineNickname&&h.jsxs("span",{className:"text-text-muted opacity-80",children:["(",L.hostname,")"]})]})]})]})}),h.jsx("div",{className:"machine-tabs px-6",children:s1.map(v=>h.jsxs("button",{onClick:()=>ae(v.id),className:`machine-tab${te===v.id?" active":""}`,children:[v.label,v.count!==void 0&&h.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),h.jsxs("div",{className:"page-content",children:[te==="overview"&&h.jsxs("div",{children:[h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[h.jsx(s_,{icon:h.jsx(cg,{size:16}),label:"Uptime",value:E4(L.uptime)}),h.jsx(s_,{icon:h.jsx(oo,{size:16}),label:"IDEs",value:`${ie.length}`,sub:`${_e.length} CLIs`})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),h.jsxs("div",{className:"flex gap-6",children:[h.jsx(o_,{value:Math.min(Math.round(Af/L.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${Af.toFixed(2)} avg / ${L.cpus} cores`}),h.jsx(o_,{value:r1,max:100,label:"Memory",color:"#3b82f6",detail:`${l_(L.totalMem-Mf)} / ${l_(L.totalMem)}${L.platform==="darwin"?" (approx.)":""}`})]})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[h.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[h.jsx(lo,{size:14})," Workspaces"]})}),h.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 ",h.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.']}),h.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[h.jsx("span",{className:"text-[10px] text-text-muted",children:"Default:"}),h.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:rr,value:L.defaultWorkspaceId||"",onChange:v=>{const z=v.target.value;e1(z===""?null:z)},children:[h.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(L.workspaces||[]).map(v=>h.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),L.defaultWorkspacePath&&h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:L.defaultWorkspacePath,children:L.defaultWorkspacePath})]}),h.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[h.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:_r,disabled:rr,onChange:v=>nn(v.target.value),onKeyDown:v=>v.key==="Enter"&&void If()}),h.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:rr,onClick:()=>void If(),children:"Add"})]}),(L.workspaces||[]).length>0&&h.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(L.workspaces||[]).map(v=>h.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[h.jsx("span",{className:"font-mono truncate flex-1",title:v.path,children:v.path}),h.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:rr,onClick:()=>void Jx(v.id),children:"Remove"})]},v.id))})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle border-violet-500/15",children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1 flex items-center gap-1.5",children:[h.jsx(cg,{size:14})," Pick up where you left off"]}),h.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."}),h.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent CLI / ACP launches"}),k.length>0?h.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,z)=>{const oe=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.dir||"?"}`;return h.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:[h.jsxs("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,240px)]",title:v.dir,children:[J(v.cliType)," ",oe]}),h.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.dir}),h.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void gt({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>i1(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${z}`)})}):h.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."}),(L.workspaceActivity||[]).length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent workspace paths"}),h.jsx("div",{className:"flex flex-col gap-1.5",children:(L.workspaceActivity||[]).slice(0,12).map(v=>{const z=v.path.split("/").filter(Boolean).pop()||v.path,oe=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ve=(v.kind==="cli"||v.kind==="acp")&&!!v.agentType;return h.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:[h.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,200px)]",title:v.path,children:z}),oe&&h.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:oe}),v.agentType&&h.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),h.jsx("span",{className:"text-[9px] text-text-muted",children:X4(v.lastUsedAt)}),h.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ve&&h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void gt({cliType:v.agentType,dir:v.path}),children:"Run again"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{F(v.path),O(v.path),ae("clis")},children:"CLIs tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{F(v.path),O(v.path),ae("acps")},children:"ACP tab"}),h.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:rr,onClick:()=>void t1(v.path),children:"Set default"})]})]},`${v.path}-${v.lastUsedAt}`)})})]})]}),h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),h.jsx("button",{onClick:()=>ae("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),ie.length===0?h.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):h.jsx("div",{className:"flex flex-col gap-1.5",children:ie.map(v=>{var oe,ve,je;const z=(v.agentStreams||[]).some(Pt=>Pt.status==="generating"||Pt.status==="streaming")||((oe=v.activeChat)==null?void 0:oe.status)==="generating";return h.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 ${z?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[h.jsx("span",{children:J(v.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:Xr(v.type)}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:((je=(ve=v.workspaceFolders)==null?void 0:ve[0])==null?void 0:je.name)||""}),z&&h.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),h.jsx("span",{className:`${z?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:z?"#fb923c":"#22c55e",boxShadow:z?"0 0 8px rgba(249,115,22,0.4)":"none",animation:z?"pulse-dot 1.5s infinite":"none"}})]},v.id)})})]}),h.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),h.jsx("button",{onClick:()=>ae("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),_e.length===0?h.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):h.jsx("div",{className:"flex flex-col gap-1.5",children:_e.map(v=>h.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[h.jsx("span",{children:J(v.type)}),h.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),h.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workingDir.split("/").pop()}),h.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),L.detectedIdes.length>0&&h.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:L.detectedIdes.map(v=>h.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:[h.jsx("span",{children:J(v.type)}),v.name||v.type,h.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),te==="ides"&&h.jsxs("div",{children:[h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ie.length,")"]}),ie.length===0?h.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."}):h.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:ie.map(v=>{var z,oe;return h.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-lg",children:J(v.type)}),h.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Xr(v.type)}),v.version&&h.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.version]}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[h.jsx(oo,{size:13})," Control"]}),h.jsx("button",{onClick:()=>rc(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"})]})]}),h.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(130px,1fr))] gap-1.5 text-xs text-text-secondary",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",((z=v.workspaceFolders)==null?void 0:z.map(ve=>ve.name).join(", "))||"—"]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"File:"})," ",((oe=v.activeFile)==null?void 0:oe.split("/").pop())||"—"]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"Terminals:"})," ",v.terminals]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-text-muted",children:"CDP:"})," ",v.cdpconnected?"● connected":"○ Off"]})]}),v.aiAgents.length>0&&h.jsx("div",{className:"flex gap-1 mt-2 flex-wrap",children:v.aiAgents.map(ve=>h.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${ve.status==="generating"||ve.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[ve.name," · ",ve.status]},ve.id))})]},v.id)})}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",Le.length,")"]}),h.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:L.defaultWorkspacePath?`Opens in default workspace: ${L.defaultWorkspacePath.split("/").filter(Boolean).pop()||L.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."}),h.jsxs("div",{className:"flex flex-wrap gap-2",children:[Le.map(v=>h.jsxs("button",{onClick:()=>nt(v.type||v.id||""),disabled:!!_,className:"machine-btn-primary flex items-center gap-1.5",style:{opacity:_&&_!==v.type?.4:1},children:[h.jsx("span",{children:J(v.type)}),_===v.type?"⏳ Launching...":`▶ ${v.name||Xr(v.type)}`]},v.type)),Le.length===0&&h.jsxs("div",{className:"text-xs text-text-muted italic",children:["All detected IDEs are running, or none detected.",h.jsxs("button",{onClick:nc,className:"machine-btn ml-2 flex items-center gap-1",children:[h.jsx(WT,{size:12})," Scan"]})]})]})]}),te==="clis"&&h.jsxs("div",{children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),h.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."}),h.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[h.jsx("select",{value:U,onChange:v=>j(v.target.value),className:"machine-input",children:le.length>0?le.map(v=>h.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):h.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),h.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:M,onChange:v=>F(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),h.jsx("input",{type:"text",placeholder:"Args (optional)",value:$,onChange:v=>E(v.target.value),className:"machine-input min-w-[150px]"}),h.jsx("button",{onClick:()=>vr(U,M,$||void 0),className:"machine-btn-primary",children:"▶ Launch"}),h.jsx("button",{type:"button",disabled:!(L!=null&&L.defaultWorkspacePath),title:L!=null&&L.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void gt({cliType:U,useDefaultWorkspace:!0,argsStr:$||void 0}),className:"machine-btn text-[10px]",children:"Default"}),h.jsx("button",{type:"button",onClick:()=>void gt({cliType:U,useHome:!0,argsStr:$||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",_e.length,")"]}),_e.length===0?h.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"}):h.jsx("div",{className:"flex flex-col gap-2 mb-5",children:_e.map(v=>h.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx("span",{className:"text-lg",children:J(v.type)}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),h.jsx("div",{className:"text-[11px] text-text-muted",children:v.workingDir})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.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"?h.jsx("button",{onClick:()=>vr(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):h.jsx("button",{onClick:()=>Xo(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),h.jsx("button",{onClick:ic,disabled:G,className:"machine-btn",children:G?"⏳":"↻ Load"})]}),k.length>0&&h.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,z)=>{var oe,ve;return h.jsxs("div",{onClick:()=>{j(v.cliType),F(v.dir),E((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:je=>je.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:je=>je.currentTarget.style.background="var(--bg-glass)",children:[h.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[h.jsx("span",{children:J(v.cliType)}),h.jsx("span",{children:((oe=v.dir)==null?void 0:oe.split("/").filter(Boolean).pop())||"root"}),((ve=v.cliArgs)==null?void 0:ve.length)>0&&h.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),h.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},z)})}),h.jsxs("div",{className:"mt-5",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),h.jsx("button",{onClick:Jn,disabled:T,className:"machine-btn",children:T?"⏳":"↻ Load"})]}),x.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,z)=>h.jsx("button",{onClick:()=>F(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(lo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},z))})]})]}),te==="acps"&&h.jsxs("div",{children:[h.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[h.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),h.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."}),h.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[h.jsx("select",{value:A,onChange:v=>V(v.target.value),className:"machine-input",children:ue.length>0?ue.map(v=>h.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):h.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),h.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:D,onChange:v=>O(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),h.jsx("input",{type:"text",placeholder:"Model (default)",value:K,onChange:v=>I(v.target.value),className:"machine-input min-w-[120px]"}),h.jsx("input",{type:"text",placeholder:"Args (optional)",value:H,onChange:v=>b(v.target.value),className:"machine-input min-w-[120px]"}),h.jsx("button",{onClick:()=>vr(A,D,H||void 0,K||void 0),className:"machine-btn-primary",children:"▶ Launch"}),h.jsx("button",{type:"button",disabled:!(L!=null&&L.defaultWorkspacePath),title:L!=null&&L.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void gt({cliType:A,useDefaultWorkspace:!0,argsStr:H||void 0,model:K||void 0}),className:"machine-btn text-[10px]",children:"Default"}),h.jsx("button",{type:"button",onClick:()=>void gt({cliType:A,useHome:!0,argsStr:H||void 0,model:K||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),h.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",we.length,")"]}),we.length===0?h.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"}):h.jsx("div",{className:"flex flex-col gap-2 mb-5",children:we.map(v=>h.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx("span",{className:"text-lg",children:J(v.type)}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),h.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[h.jsx("span",{children:v.workingDir}),v.currentModel&&h.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&h.jsxs("span",{className:"text-amber-500",children:["📋 ",v.currentPlan]})]})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.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}),h.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:h.jsx(xf,{size:14})}),v.status==="stopped"?h.jsx("button",{onClick:()=>vr(v.type,v.workingDir),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):h.jsx("button",{onClick:()=>Xo(v.type,v.workingDir,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),h.jsxs("div",{className:"mt-5",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),h.jsx("button",{onClick:Jn,disabled:T,className:"machine-btn",children:T?"⏳":"↻ Load"})]}),x.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map((v,z)=>h.jsx("button",{onClick:()=>O(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(lo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},z))})]})]}),te==="providers"&&h.jsxs("div",{children:[h.jsxs("div",{className:"flex justify-between items-center mb-4",children:[h.jsxs("div",{className:"flex gap-1 items-center",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(v=>h.jsx("button",{onClick:()=>Dr(v),className:`machine-btn text-[10px] px-2 py-0.5 ${gr===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),h.jsx("button",{onClick:q,disabled:Ce,className:"machine-btn",children:Ce?"⏳ Loading...":"↻ Refresh"})]}),Ce&&xe.length===0?h.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):h.jsx("div",{className:"flex flex-col gap-2",children:xe.filter(v=>gr==="all"||v.category===gr).map(v=>h.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[h.jsx("span",{className:"text-lg",children:v.icon}),h.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),h.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})]}),h.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(z=>h.jsxs("div",{className:"flex items-center justify-between gap-3",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[z.label||z.key,pt===`${v.type}.${z.key}`&&h.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),z.description&&h.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:z.description})]}),h.jsx("div",{className:"shrink-0",children:z.type==="boolean"?h.jsx("button",{onClick:()=>de(v.type,z.key,!(v.values[z.key]??z.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[z.key]??z.default?"#8b5cf6":"var(--border-subtle)"},children:h.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[z.key]??z.default?21:3}})}):z.type==="number"?h.jsx("input",{type:"number",value:v.values[z.key]??z.default??0,min:z.min,max:z.max,onChange:oe=>{const ve=parseInt(oe.target.value)||0;z.min!==void 0&&ve<z.min||z.max!==void 0&&ve>z.max||de(v.type,z.key,ve)},className:"machine-input w-20 text-center text-[11px]"}):z.type==="select"&&z.options?h.jsx("select",{value:v.values[z.key]??z.default??"",onChange:oe=>de(v.type,z.key,oe.target.value),className:"machine-input text-[11px]",children:z.options.map(oe=>h.jsx("option",{value:oe,children:oe},oe))}):h.jsx("input",{type:"text",value:v.values[z.key]??z.default??"",onBlur:oe=>de(v.type,z.key,oe.target.value),className:"machine-input w-[120px] text-[11px]"})})]},z.key))})]},v.type))})]}),te==="logs"&&h.jsxs("div",{children:[h.jsxs("div",{className:"flex justify-between items-center mb-3",children:[h.jsxs("div",{className:"flex gap-1 items-center",children:[h.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(v=>h.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))]}),h.jsxs("div",{className:"flex gap-1.5 items-center",children:[h.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),h.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),h.jsx("button",{onClick:()=>{d([]),f(0)},className:"machine-btn",children:"Clear"})]})]}),h.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&&h.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,z)=>h.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[h.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),h.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"}),h.jsx("span",{children:v.message})]},z)),h.jsx("div",{ref:ge})]})]})]}),mt&&L&&h.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:h.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border-subtle bg-bg-secondary shadow-xl p-5",children:[h.jsx("h2",{id:"launch-pick-title",className:"text-sm font-semibold text-text-primary m-0 mb-1",children:"Where should this run?"}),h.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."}),h.jsx("div",{className:"flex flex-col gap-2 mb-4 max-h-48 overflow-y-auto",children:(L.workspaces||[]).length===0?h.jsx("span",{className:"text-[11px] text-text-muted",children:"No saved workspaces yet. Add one in Overview or type a path above."}):(L.workspaces||[]).map(v=>h.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 z=mt;ee(null),gt({cliType:z.cliType,workspaceId:v.id,argsStr:z.argsStr,model:z.model})},children:[h.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),h.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.id))}),h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",disabled:!L.defaultWorkspacePath,onClick:()=>{const v=mt;ee(null),gt({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=mt;ee(null),gt({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),h.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>ee(null),children:"Cancel"})]})]})})]})}function Q4(){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 p_=Q4(),m_=3e3,Z4=3e4;let cn=null,J4=0;const Na=new Map,nd=new Set;let ii=null;async function Vl(e,t,r){const n=cn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++J4}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{Na.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);Na.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 eD{constructor(t){ws(this,"daemonId");ws(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(cn==null?void 0:cn.readyState)===WebSocket.OPEN}get connectionState(){return(cn==null?void 0:cn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return Vl(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId;return Vl(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ii&&(clearInterval(ii),ii=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`standalone:ide:${this.screenshotIdeType}`:this.daemonId,i=await Vl(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());nd.forEach(o=>o("standalone",s))}}catch{}};r(),ii=setInterval(r,2e3)}stopScreenshots(t){ii&&(clearInterval(ii),ii=null)}}let si=null;function tD(e){(!si||si.daemonId!==e)&&(si=new eD(e));const t=Xt._originalGet||Xt.get.bind(Xt);Xt._originalGet=t,Xt.get=r=>r===e||r.startsWith("standalone")?si:t(r),Xt.getState=r=>(r===e||r.startsWith("standalone"))&&(si==null?void 0:si.connectionState)||"disconnected",Xt.onScreenshot=(r,n)=>(nd.add(n),()=>{nd.delete(n)})}function rD({children:e}){const t=w.useRef(hm()),r=hm();t.current=r;const[,n]=w.useState("disconnected"),i=w.useRef(null),s=w.useRef(),o=w.useRef(m_),l=w.useRef(!0);return w.useEffect(()=>{l.current=!0;function a(){var u,f;if(!l.current||((u=i.current)==null?void 0:u.readyState)===WebSocket.OPEN||((f=i.current)==null?void 0:f.readyState)===WebSocket.CONNECTING)return;n("connecting"),console.log(`[Standalone WS] Connecting to ${p_}...`);let d;try{d=new WebSocket(p_)}catch(p){console.error("[Standalone WS] Failed to create WebSocket:",p),c();return}i.current=d,d.onopen=()=>{if(!l.current){d.close();return}n("connected"),o.current=m_,console.log("[Standalone WS] Connected")},cn=d,d.onmessage=p=>{var m;try{const g=JSON.parse(p.data);if((g.type==="command_result"||g.type==="error")&&g.requestId){const S=Na.get(g.requestId);S&&(Na.delete(g.requestId),g.type==="error"?S.reject(new Error(((m=g.data)==null?void 0:m.message)||"Command failed")):S.resolve(g.data));return}if(g.type==="status"||g.type==="initial_state"){const S=g.data;if(!S)return;const{injectEntries:_,markLoaded:y}=t.current,x=[],N=S.id||"standalone";tD(N),x.push({id:N,type:"adhdev-daemon",status:"online",daemonMode:!0,machine:{hostname:S.hostname,platform:S.platform,...S.system||{}},system:S.system||null,timestamp:S.timestamp,cdpConnected:S.cdpConnected,detectedIdes:S.detectedIdes||[],availableProviders:S.availableProviders||[],workspaces:S.workspaces,defaultWorkspaceId:S.defaultWorkspaceId??S.activeWorkspaceId,defaultWorkspacePath:S.defaultWorkspacePath??S.activeWorkspacePath,workspaceActivity:S.workspaceActivity,managedIdeIds:(S.ides||[]).map(T=>T.id),managedCliIds:(S.clis||[]).map(T=>T.id)});for(const T of S.ides||[])x.push({...T,daemonId:S.id||"standalone",status:T.cdpConnected?"online":"detected"});for(const T of S.clis||[])x.push({...T,daemonId:S.id||"standalone",status:T.isRunning?"running":"stopped"});x.length>0&&_(x),y()}}catch(g){console.error("[Standalone WS] Parse error:",g)}},d.onclose=()=>{l.current&&(n("disconnected"),i.current=null,c())},d.onerror=p=>{console.warn("[Standalone WS] Error, will reconnect:",p)}}function c(){if(!l.current)return;clearTimeout(s.current);const d=o.current;console.log(`[Standalone WS] Reconnecting in ${d}ms...`),s.current=setTimeout(()=>{o.current=Math.min(o.current*1.5,Z4),a()},d)}return a(),()=>{l.current=!1,clearTimeout(s.current),i.current&&(i.current.onclose=null,i.current.close(),i.current=null,cn=null)}},[]),h.jsx(h.Fragment,{children:e})}function nD({children:e}){return h.jsx(Ab,{children:h.jsx(rD,{children:e})})}const iD=[{id:"dashboard",path:"/dashboard",icon:h.jsx(jT,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:h.jsx(BT,{}),label:"Burrow"}];function sD({children:e}){const t=gs(),r=$o(),[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 u=!d;try{localStorage.setItem("sidebar-collapsed",u?"1":"0")}catch{}return u})},c=d=>`nav-item${r.pathname.startsWith(d)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return h.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[h.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[h.jsx("span",{className:"mobile-menu-icon"}),h.jsx("span",{className:"mobile-menu-icon"}),h.jsx("span",{className:"mobile-menu-icon"})]}),n&&h.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:d=>d.key==="Escape"&&i(!1)}),h.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[h.jsxs("div",{className:"sidebar-header",children:[h.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[h.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&h.jsx("span",{children:"ADHDev"})]}),h.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),h.jsx("nav",{className:"sidebar-nav",children:iD.map(d=>h.jsxs("div",{className:c(d.path),id:`nav-${d.id}`,onClick:()=>l(d.path),title:s?d.label:void 0,children:[h.jsx("span",{className:"nav-icon",children:d.icon}),!s&&d.label]},d.id))}),h.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[h.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:[h.jsx("span",{className:"nav-icon",children:h.jsx(FT,{})}),!s&&"About"]}),!s&&h.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.7"]}),h.jsx(j4,{collapsed:s}),h.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:[h.jsx("span",{className:"nav-icon text-base",children:s?"›":"‹"}),!s&&h.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),h.jsx("main",{className:"main-content relative",children:h.jsx("div",{className:"main-content-inner",children:e})})]})}const oD=[{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."}],lD=[{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."}],aD=[{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 cD(){return h.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[h.jsxs("div",{className:"text-center mb-10",children:[h.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),h.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),h.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev — Self-hosted Edition"}),h.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.7"]})]}),h.jsxs("section",{className:"mb-10",children:[h.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[h.jsx("span",{className:"text-base",children:"✅"})," What's included"]}),h.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:oD.map(e=>h.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[h.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),h.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),h.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),h.jsxs("section",{className:"mb-10",children:[h.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),h.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=>h.jsxs("div",{children:[h.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),h.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>h.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))})]}),h.jsxs("section",{className:"mb-10",children:[h.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[h.jsx("span",{className:"text-base",children:"⚖️"})," Self-hosted vs Cloud"]}),h.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:h.jsxs("table",{className:"w-full text-[13px]",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"bg-bg-secondary",children:[h.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),h.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),h.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),h.jsx("tbody",{children:aD.map((e,t)=>h.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[h.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),h.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?h.jsx("span",{className:"text-emerald-500",children:"✓"}):h.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),h.jsx("td",{className:"text-center px-4 py-2",children:h.jsx("span",{className:"text-emerald-500",children:"✓"})})]},e.feature))})]})})]}),h.jsx("section",{className:"mb-10",children:h.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:h.jsxs("div",{className:"flex items-start gap-4",children:[h.jsx("div",{className:"text-3xl shrink-0",children:"🚀"}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),h.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."}),h.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:lD.map(e=>h.jsxs("div",{className:"flex gap-2.5 items-start",children:[h.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),h.jsxs("div",{children:[h.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),h.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),h.jsxs("div",{className:"flex gap-3 flex-wrap",children:[h.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 →"}),h.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"}),h.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"})]})]})]})})}),h.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[h.jsx("p",{children:"© 2026 ADHDev · Your AI sidekick otter 🦦"}),h.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition — all data stays on your machine"})]})]})}function g_(){const{ides:e}=Y0(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?h.jsx(Al,{to:`/machines/${t.id}`,replace:!0}):e.length>0?h.jsx(Al,{to:`/machines/${e[0].id}`,replace:!0}):h.jsx(Al,{to:"/dashboard",replace:!0})}function uD(){return h.jsx(Ib,{children:h.jsx(nD,{children:h.jsx(zb,{value:{sendCommand:Vl,sendData:()=>!1},children:h.jsx(sD,{children:h.jsxs(Tb,{children:[h.jsx(Nn,{path:"/dashboard",element:h.jsx(K4,{})}),h.jsx(Nn,{path:"/ide/:id",element:h.jsx(Y4,{})}),h.jsx(Nn,{path:"/machine",element:h.jsx(g_,{})}),h.jsx(Nn,{path:"/machines/:id",element:h.jsx(G4,{})}),h.jsx(Nn,{path:"/machines",element:h.jsx(g_,{})}),h.jsx(Nn,{path:"/about",element:h.jsx(cD,{})}),h.jsx(Nn,{path:"*",element:h.jsx(Al,{to:"/dashboard",replace:!0})})]})})})})})}I0(document.getElementById("root")).render(h.jsx(w.StrictMode,{children:h.jsx(uD,{})}));
|
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-DNJTxmxT.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-_4zVo_k_.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|