@adhdev/daemon-standalone 0.6.74 → 0.6.75
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
|
@@ -36,7 +36,7 @@ var en=Object.defineProperty;var tn=(t,s,n)=>s in t?en(t,s,{enumerable:!0,config
|
|
|
36
36
|
100% { transform: translateY(0px); }
|
|
37
37
|
}
|
|
38
38
|
`})]})}function Wn({activeConv:t,onModalButton:s}){const[n,r]=a.useState(null);if(a.useEffect(()=>{r(null)},[t.modalMessage,t.status]),t.status!=="waiting_approval"||!t.modalButtons)return null;const o=c=>{n||(r(c),s(c))},i=c=>c.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim();return e.jsxs("div",{className:"bg-gradient-to-br from-amber-600 to-amber-700 text-white py-2.5 px-4 shrink-0 z-[5]",children:[t.modalMessage&&e.jsx("div",{className:"text-[11px] opacity-85 mb-1.5 whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:t.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"font-black text-xs flex items-center gap-2",children:[e.jsx(Jt,{size:14})," ",n?"PROCESSING...":"ACTION REQUIRED"]}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:t.modalButtons.map((c,d)=>{const u=i(c).toLowerCase(),h=/^(run|approve|accept|yes|allow|always)/.test(u),x=/^(reject|deny|delete|remove|abort)/.test(u),l=n===c,g=n!==null;return e.jsx("button",{onClick:()=>o(c),disabled:g,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${h?"bg-white text-amber-700 font-extrabold":x?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${g&&!l?"opacity-40":"opacity-100"} ${g?"cursor-not-allowed":"cursor-pointer"}`,children:l?"⏳ ...":i(c)},d)})})]})]})}const Fe=new Map;function On({ideId:t,ideType:s,agentType:n,agentName:r,serverModel:o,serverMode:i,acpConfigOptions:c,acpModes:d}){var je;const{sendCommand:u}=rt(),h=!!(c||d),x=`${t}:${n}`,l=Fe.get(x),[g,f]=a.useState(!1),[m,C]=a.useState(!1),[L,v]=a.useState((l==null?void 0:l.models)||[]),[w,W]=a.useState((l==null?void 0:l.modes)||[]),z=K=>K?typeof K=="string"?K:typeof K=="object"?K.name||K.id||JSON.stringify(K):String(K):"",[R,j]=a.useState(z(o)),[O,M]=a.useState(z(i)),[P,se]=a.useState(!1),[y,F]=a.useState(!1),U=a.useRef(0),b=K=>K.map(S=>typeof S=="string"?S:(S==null?void 0:S.name)||(S==null?void 0:S.id)||String(S));a.useEffect(()=>{if(c){const K=c.find(S=>S.category==="model");if(K){const S=b(K.options.map($=>$.value));v(S),K.currentValue&&j(z(K.currentValue));const p=Fe.get(x)||{models:[],modes:[]};Fe.set(x,{...p,models:S})}}if(d&&d.length>0){const K=b(d.map(p=>p.id));W(K);const S=Fe.get(x)||{models:[],modes:[]};Fe.set(x,{...S,modes:K})}else if(c){const K=c.find(S=>S.category!=="model");if(K){const S=b(K.options.map($=>$.value));W(S),K.currentValue&&M(z(K.currentValue));const p=Fe.get(x)||{models:[],modes:[]};Fe.set(x,{...p,modes:S})}}},[c,d,x]),a.useEffect(()=>{f(!1),C(!1),j(z(o)),M(z(i));const K=Fe.get(x);K?(v(K.models),W(K.modes)):(v([]),W([]))},[t,n]),a.useEffect(()=>{o&&Date.now()>U.current&&j(z(o))},[o]),a.useEffect(()=>{i&&Date.now()>U.current&&M(z(i))},[i]);const ee=a.useCallback(async(K,S={})=>{const p={...S},$=t.split(":");return $.length>=3&&($[1]==="ide"||$[1]==="cli"||$[1]==="acp")&&(p._targetInstance=$.slice(2).join(":"),p._targetType=$[1]),await u(t,K,p)},[t]),q=async()=>{var K,S;if(L.length>0){f(!g);return}if(h){f(!0);return}se(!0);try{const p=await ee("list_extension_models",{agentType:n,ideType:s}),$=(p==null?void 0:p.models)||((K=p==null?void 0:p.result)==null?void 0:K.models)||[],A=b($);v(A),p!=null&&p.current&&j(z(p.current)),(S=p==null?void 0:p.result)!=null&&S.current&&j(z(p.result.current));const J=Fe.get(x)||{models:[],modes:[]};Fe.set(x,{...J,models:A}),f(!0)}catch{}finally{se(!1)}},H=async()=>{var K,S;if(w.length>0){C(!m);return}if(h){C(!0);return}F(!0);try{const p=await ee("list_extension_modes",{agentType:n,ideType:s}),$=(p==null?void 0:p.modes)||((K=p==null?void 0:p.result)==null?void 0:K.modes)||[],A=b($);W(A),p!=null&&p.current&&M(z(p.current)),(S=p==null?void 0:p.result)!=null&&S.current&&M(z(p.result.current));const J=Fe.get(x)||{models:[],modes:[]};Fe.set(x,{...J,modes:A}),C(!0)}catch{}finally{F(!1)}},Y=async K=>{f(!1),j(K),U.current=Date.now()+5e3;try{h?await ee("change_model",{agentType:n,ideType:s,model:K}):await ee("set_extension_model",{agentType:n,ideType:s,model:K})}catch{}},G=h&&!(d&&d.length>0)&&(c==null?void 0:c.some(K=>K.category!=="model")),oe=G?(je=c==null?void 0:c.find(K=>K.category!=="model"))==null?void 0:je.configId:void 0,ne=async K=>{C(!1),M(K),U.current=Date.now()+5e3;try{h&&G&&oe?await ee("set_thought_level",{agentType:n,ideType:s,configId:oe,value:K}):h?await ee("set_mode",{agentType:n,ideType:s,mode:K}):await ee("set_extension_mode",{agentType:n,ideType:s,mode:K})}catch{}},xe={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[n]||"#94a3b8";return e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 flex-wrap text-[10px] border-t border-border-subtle bg-[var(--surface-primary)]",children:[e.jsx("span",{className:"text-[9px] font-bold tracking-wide uppercase opacity-70",style:{color:xe},children:r}),e.jsx("span",{className:"text-border-subtle text-[10px]",children:"│"}),e.jsxs("div",{className:"relative",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:g?`${xe}55`:"transparent",border:"1px solid",color:R?"var(--text-primary)":"var(--text-muted)"},onClick:q,children:[e.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),P?"...":R||"Model",e.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),g&&L.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>f(!1)}),e.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[e.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:"SELECT MODEL"}),L.map(K=>e.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:K===R?`${xe}18`:"transparent",color:K===R?xe:"var(--text-secondary)",fontWeight:K===R?600:400,borderLeft:K===R?`2px solid ${xe}`:"2px solid transparent"},onMouseEnter:S=>{S.currentTarget.style.background=`${xe}12`},onMouseLeave:S=>{S.currentTarget.style.background=K===R?`${xe}18`:"transparent"},onClick:()=>Y(K),children:K},K))]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:m?`${xe}55`:"transparent",border:"1px solid",color:O?"var(--text-primary)":"var(--text-muted)"},onClick:H,children:[e.jsx("span",{className:"text-[9px] opacity-60",children:G?"🧠":"⚡"}),y?"...":O||(G?"Thinking":"Mode"),e.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),m&&w.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>C(!1)}),e.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[e.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:G?"SELECT THINKING LEVEL":"SELECT MODE"}),w.map(K=>e.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:K===O?`${xe}18`:"transparent",color:K===O?xe:"var(--text-secondary)",fontWeight:K===O?600:400,borderLeft:K===O?`2px solid ${xe}`:"2px solid transparent"},onMouseEnter:S=>{S.currentTarget.style.background=`${xe}12`},onMouseLeave:S=>{S.currentTarget.style.background=K===O?`${xe}18`:"transparent"},onClick:()=>ne(K),children:K},K))]})]})]})]})}const Oe=t=>(t.ideId||t.tabKey||t.id||"").includes(":cli:"),Re=t=>(t.ideId||t.tabKey||t.id||"").includes(":acp:");function Bs({activeConv:t,ides:s,agentInput:n,setAgentInput:r,handleSendChat:o,handleFocusAgent:i,isFocusingAgent:c,messageReceivedAt:d,actionLogs:u,userName:h}){const x=a.useRef(null),{sendCommand:l}=rt(),g=a.useRef(new Map),f=a.useCallback(P=>(g.current.has(P)||g.current.set(P,{messages:[],offset:0,hasMore:!0,error:null}),g.current.get(P)),[]),m=a.useCallback((P,se)=>{const y=f(P);g.current.set(P,{...y,...se}),C(F=>F+1)},[f]),[,C]=a.useState(0),L=t.tabKey,v=f(L),w=v.messages,W=v.hasMore,z=v.error,[R,j]=a.useState(!1),O=a.useCallback(async()=>{var y,F;if(R)return;const P=t.tabKey,se=f(P);j(!0),m(P,{error:null});try{const U=s.find(oe=>oe.id===t.ideId),b=(U==null?void 0:U.daemonId)||((y=t.ideId)==null?void 0:y.split(":")[0])||"";if(!b){m(P,{hasMore:!1});return}const ee=t.ideType||t.agentType||"",q=(t.ideId||"").split(":"),H=q.length>=3?q.slice(2).join(":"):void 0,Y=await l(b,"chat_history",{agentType:ee,offset:se.offset,limit:30,instanceId:H}),G=(Y==null?void 0:Y.result)??Y;if(((F=G.messages)==null?void 0:F.length)>0){const oe=f(P);m(P,{messages:[...G.messages,...oe.messages],offset:oe.offset+G.messages.length,hasMore:!!G.hasMore})}else m(P,{hasMore:!!G.hasMore})}catch(U){const b=(U==null?void 0:U.message)||"";b.includes("P2P not available")||b.includes("channel not open")||b.includes("P2P not connected")||b.includes("timeout")?m(P,{error:"Connection not ready — tap to retry"}):m(P,{hasMore:!1,error:"Failed to load history"})}finally{j(!1)}},[R,s,t,l,f,m]),M=(()=>{const P=t.messages.map((F,U)=>{const b=`${t.ideId}-${F.id??`i-${U}`}`;return{...F,receivedAt:F.receivedAt||d[b]||0}});if(w.length===0)return P;const se=new Set(P.map(F=>`${F.role}:${(F.content||"").slice(0,100)}`));return[...w.filter(F=>!se.has(`${F.role}:${(F.content||"").slice(0,100)}`)),...P]})();return e.jsxs(e.Fragment,{children:[e.jsx(Ln,{messages:M,actionLogs:u.filter(P=>P.ideId===t.tabKey).sort((P,se)=>P.timestamp-se.timestamp),agentName:t.agentName||t.displayPrimary||"Agent",userName:h,isCliMode:Oe(t)||Re(t),isWorking:t.status==="working",contextKey:t.tabKey,onLoadMore:O,isLoadingMore:R,hasMoreHistory:W,loadError:z??void 0,emptyState:t.messages.length===0?t.connectionState==="connecting"||t.connectionState==="new"?e.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-4",children:[e.jsx("div",{className:"connecting-logo-float",children:e.jsx("div",{style:{width:64,height:64,borderRadius:"50%",background:"radial-gradient(circle, rgba(96,165,250,0.12), transparent 70%)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 0 40px rgba(96,165,250,0.08)"},children:e.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",style:{width:40,height:40,borderRadius:"50%",opacity:.85}})})}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[e.jsxs("div",{className:"text-[13px] text-blue-400 font-medium",children:["Connecting to your machine",e.jsx("span",{className:"connecting-dots"})]}),e.jsx("div",{className:"text-[11px] opacity-35",children:"Establishing P2P connection"})]})]}):t.status==="not_monitored"?e.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[e.jsx("div",{className:"text-3xl opacity-60",children:e.jsx(xt,{size:28})}),e.jsx("div",{className:"text-[13px] opacity-50",children:"Agent not monitored"}),e.jsx("button",{onClick:i,disabled:c,className:"btn btn-primary",children:c?"⌛ Switching...":e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ft,{size:14})," Open ",t.displayPrimary," Panel"]})}),e.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Click to switch monitoring to this agent"})]}):t.status==="panel_hidden"?e.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[e.jsx("div",{className:"text-3xl opacity-60",children:e.jsx($s,{size:28})}),e.jsx("div",{className:"text-[13px] opacity-50",children:"Agent panel is not visible yet"}),e.jsx("button",{onClick:i,disabled:c,className:"btn btn-primary",children:c?"⌛ Opening...":e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ft,{size:14})," Open ",t.displayPrimary," Panel"]})}),e.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Open the agent panel or chat view in the app you are using to start viewing messages"})]}):t.status==="idle"&&!R?e.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[e.jsx("div",{className:"text-2xl opacity-40 animate-pulse",children:"💬"}),e.jsx("div",{className:"text-[13px] opacity-40",children:"Loading chat..."})]}):void 0:void 0}),!Oe(t)&&(()=>{var se,y,F,U;const P=s.find(b=>b.id===t.ideId);return e.jsx(On,{ideId:t.ideId,ideType:t.ideType,agentType:t.streamSource==="agent-stream"?t.agentType:((y=(se=P==null?void 0:P.agents)==null?void 0:se[0])==null?void 0:y.type)||t.ideType,agentName:t.streamSource==="agent-stream"?t.agentName:((U=(F=P==null?void 0:P.agents)==null?void 0:F[0])==null?void 0:U.name)||t.agentName,serverModel:(P==null?void 0:P.currentModel)||void 0,serverMode:(P==null?void 0:P.currentPlan)||void 0,acpConfigOptions:Re(t)?P==null?void 0:P.acpConfigOptions:void 0,acpModes:Re(t)?P==null?void 0:P.acpModes:void 0})})(),e.jsx("div",{className:"dashboard-input-area px-3 py-2.5 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:e.jsxs("div",{className:"flex gap-2.5 items-center",children:[e.jsx("div",{className:"flex-1 relative",children:e.jsx("input",{ref:x,type:"text",placeholder:`Send message to ${t.displayPrimary}...`,value:n,onChange:P=>r(P.target.value),onPaste:P=>{const se=P.clipboardData.getData("text");se&&r(y=>y+se),P.preventDefault()},onKeyDown:P=>{if(P.key==="Enter"){if(P.nativeEvent.isComposing){P.preventDefault();return}P.preventDefault(),o()}},onBlur:P=>{if(window.innerWidth<768){const se=P.relatedTarget;if((se==null?void 0:se.tagName)==="BUTTON")return;setTimeout(()=>{document.documentElement.scrollTop=0},300)}},className:"w-full h-10 rounded-[20px] px-4 bg-bg-secondary text-sm text-text-primary",style:{border:"1px solid var(--chat-input-border, var(--border-subtle))"}})}),e.jsx("button",{onClick:o,disabled:!n.trim(),className:`w-10 h-10 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${n.trim()?"cursor-pointer":"bg-bg-secondary cursor-default"}`,style:n.trim()?{background:"var(--chat-send-bg, var(--accent-primary))"}:void 0,children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:n.trim()?"text-white":"text-text-muted",children:e.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}const Bt=new Set,Ws={emit(t,s){for(const n of Bt)n(t,s)},on(t){return Bt.add(t),()=>{Bt.delete(t)}}};function zn({activeConv:t,ptyBuffers:s,terminalRef:n,agentInput:r,setAgentInput:o,handleSendChat:i}){var g;const c=a.useRef(null),{sendCommand:d,sendData:u}=rt(),h=(g=t.ideId)!=null&&g.includes(":cli:")?t.ideId.split(":cli:")[1]:"",x=t.tabKey,l=t.ideType||t.agentType||"";return a.useEffect(()=>{const f=s.current.get(x);if(f&&f.length>0){const m=setTimeout(()=>{var C;for(const L of f)(C=n.current)==null||C.write(L);requestAnimationFrame(()=>{var L;(L=n.current)==null||L.bumpResize()})},100);return()=>clearTimeout(m)}},[x]),a.useEffect(()=>{const f=Ws.on((m,C)=>{var v;if(!C)return;(m===h||m===l||m===t.ideId||m===t.tabKey)&&((v=n.current)==null||v.write(C))});return()=>{f()}},[h,l]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:e.jsx(Ds,{ref:n,onInput:f=>{var L;const m=t.ideId||t.daemonId||"",C=(L=t.ideId)!=null&&L.includes(":cli:")?t.ideId.split(":cli:")[1]:t.ideType||t.agentType||"";u!=null&&u(m,{type:"pty_input",cliType:C,data:f})||d(m,"pty_input",{cliType:C,data:f}).catch(console.error)},onResize:(f,m)=>{var v;const C=t.ideId||t.daemonId||"",L=(v=t.ideId)!=null&&v.includes(":cli:")?t.ideId.split(":cli:")[1]:t.ideType||t.agentType||"";u!=null&&u(C,{type:"pty_resize",cliType:L,cols:f,rows:m})||d(C,"pty_resize",{cliType:L,cols:f,rows:m,force:!0}).catch(()=>{})}},t.tabKey)}),e.jsx("div",{className:"px-3 py-2 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:e.jsxs("div",{className:"flex gap-2.5 items-center",children:[e.jsx("div",{className:"flex-1 relative",children:e.jsx("input",{ref:c,type:"text",placeholder:`Send message to ${t.displayPrimary}...`,value:r,onChange:f=>o(f.target.value),onPaste:f=>{const m=f.clipboardData.getData("text");m&&o(C=>C+m),f.preventDefault()},onKeyDown:f=>{if(f.key==="Enter"){if(f.nativeEvent.isComposing){f.preventDefault();return}f.preventDefault(),i()}},className:"w-full h-9 rounded-[18px] px-4 bg-bg-secondary text-[13px] text-text-primary",style:{border:"1px solid var(--chat-input-border, var(--border-subtle))"}})}),e.jsx("button",{onClick:i,disabled:!r.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${r.trim()?"cursor-pointer":"bg-bg-secondary cursor-default"}`,style:r.trim()?{background:"var(--chat-send-bg, var(--accent-primary))"}:void 0,children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:r.trim()?"text-white":"text-text-muted",children:e.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function Kn({wsStatus:t,showReconnected:s,loginUrl:n}){const r=t==="disconnected"||t==="reconnecting"||t==="offline"||t==="auth_failed",o=t==="auth_failed"?"red":t==="offline"?"orange":"violet",i={red:"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))",orange:"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))",violet:"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))"},c={red:"1px solid rgba(239,68,68,0.2)",orange:"1px solid rgba(255,107,53,0.2)",violet:"1px solid rgba(139,92,246,0.2)"},d={red:"#ef4444",orange:"#ff6b35",violet:"#a78bfa"};return e.jsxs(e.Fragment,{children:[r&&e.jsxs("div",{className:"py-2.5 px-5 text-[13px] font-semibold flex items-center gap-2.5 justify-center",style:{background:i[o],borderBottom:c[o],color:d[o]},children:[e.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-5 h-5",style:{opacity:t==="auth_failed"?.6:1,animation:t==="auth_failed"?void 0:"pulse 2s ease-in-out infinite",filter:t==="auth_failed"?"grayscale(1)":void 0}}),t==="offline"&&"Network offline — waiting for connection...",t==="disconnected"&&"Reconnecting to server...",t==="reconnecting"&&"Reconnecting to server...",t==="auth_failed"&&(n?e.jsxs(e.Fragment,{children:["Session expired."," ",e.jsx("a",{href:n,className:"text-inherit underline",children:"Log in again"})]}):"Connection failed — please restart the server.")]}),s&&t==="connected"&&e.jsxs("div",{className:"py-2 px-4 text-xs font-semibold flex items-center gap-2 justify-center bg-gradient-to-r from-green-500/[0.12] to-green-500/[0.04] text-green-400 border-b border-green-500/15 animate-[fadeIn_0.3s_ease]",children:[e.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-4 h-4"}),"Connected"]})]})}let Os=vt;function Pt(){return Os()}class Fn{constructor(){Ee(this,"listeners",new Map)}send(s){}isConnected(){return!1}on(s,n){return this.listeners.has(s)||this.listeners.set(s,new Set),this.listeners.get(s).add(n),()=>{var r;(r=this.listeners.get(s))==null||r.delete(n)}}emit(s,...n){var r;(r=this.listeners.get(s))==null||r.forEach(o=>o(...n))}}let zs=new Fn;class Hn{constructor(){Ee(this,"ptyCallbacks",new Set)}sendPtyInput(s,n,r){return!1}sendPtyResize(s,n,r,o){return!1}async requestChatHistory(s,n,r,o,i){return{messages:[],hasMore:!1}}retryConnection(s){}getState(s){return"disconnected"}sendData(s,n){return!1}get(s){}onScreenshot(s,n){return()=>{}}onPtyOutput(s){return this.ptyCallbacks.add(s),()=>{this.ptyCallbacks.delete(s)}}emitPtyOutput(s,n){this.ptyCallbacks.forEach(r=>r(s,n))}}let tt=new Hn,Ht=tt;function Un(t){t.dashboardWS&&(zs=t.dashboardWS),t.connectionManager&&(tt=t.connectionManager,Ht=t.connectionManager),t.p2pManager&&(Ht=t.p2pManager),t.useDaemonsHook&&(Os=t.useDaemonsHook)}function Yn({activeConv:t,agentCount:s,wsStatus:n,isConnected:r,onOpenHistory:o,cliViewMode:i,onSetCliViewMode:c,onStopCli:d}){const u=kt(),h=Pt(),x=h.p2pStates||{},l=h.ides||[],g=!!t&&Oe(t)&&!Re(t),f=r?"#22c55e":n==="connected"?"#eab308":"#ef4444",m=r?"0 0 4px #22c55e80":n==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480",C=l.filter(R=>R.type==="adhdev-daemon"),L=Object.values(x),v=L.filter(R=>R==="connected").length,w=L.filter(R=>R==="connecting"||R==="new"||R==="checking").length,z=n!=="connected"||C.length===0?null:w>0&&v===0?"P2P connecting...":v>0&&s===0?"Waiting for IDE...":null;return e.jsxs("div",{className:"dashboard-header",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"leading-tight",children:[e.jsxs("h1",{className:"header-title m-0 flex items-center gap-1.5",children:[e.jsx(ut,{size:18}),e.jsx("span",{className:"header-title-desktop",children:"Dashboard"}),e.jsx("span",{className:"header-title-mobile",children:(t==null?void 0:t.displayPrimary)||"Dashboard"}),e.jsx("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:e.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full align-middle",style:{background:f,boxShadow:m}})})]}),e.jsxs("div",{className:"header-subtitle text-xs items-center gap-1",children:[s," agent",s!==1?"s":""," active",e.jsx("span",{title:r?"Connected":n==="connected"?"Partial":"Disconnected",className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{background:f,boxShadow:m}}),z&&e.jsxs("span",{className:"text-[10px] text-text-muted animate-pulse ml-1",children:["· ",z]})]})]})}),e.jsxs("div",{className:"flex gap-2 items-center",children:[g&&i&&c&&e.jsxs("div",{className:"flex items-center rounded-lg border border-border-subtle bg-bg-secondary p-0.5",children:[e.jsx("button",{onClick:()=>c("chat"),className:`px-2.5 py-1 text-[11px] font-medium rounded-md transition-colors ${i==="chat"?"bg-bg-primary text-text-primary shadow-sm":"text-text-muted hover:text-text-primary"}`,title:"Chat mode",children:"Chat"}),e.jsx("button",{onClick:()=>c("terminal"),className:`px-2.5 py-1 text-[11px] font-medium rounded-md transition-colors ${i==="terminal"?"bg-bg-primary text-text-primary shadow-sm":"text-text-muted hover:text-text-primary"}`,title:"Terminal mode",children:"Terminal"})]}),g&&d&&e.jsx("button",{onClick:d,className:"btn btn-secondary btn-sm text-red-400 border-red-500/25 hover:bg-red-500/10",title:"Stop CLI process",children:"Stop"}),t&&!g&&!Re(t)&&e.jsxs("button",{onClick:()=>u(`/ide/${t.ideId}`),className:"btn btn-primary btn-sm",title:"IDE View",children:[e.jsx(Zt,{size:14})," IDE"]}),t&&!g&&!Re(t)&&e.jsx("button",{onClick:o,className:"btn btn-secondary btn-sm",title:"Chat History",children:e.jsx(Cn,{size:16})}),t&&!g&&!Re(t)&&e.jsx("button",{onClick:()=>u(`/ide/${t.ideId}?view=remote`),className:"btn btn-secondary btn-sm",title:"Remote Control",children:e.jsx(at,{size:16})})]})]})}function He(t){return t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"IDE"}function Xn(t){if(t<60)return`${Math.round(t)}s`;const s=Math.floor(t/60);if(s<60)return`${s}m`;const n=Math.floor(s/60),r=s%60;if(n<24)return r>0?`${n}h ${r}m`:`${n}h`;const o=Math.floor(n/24),i=n%24;return`${o}d ${i}h`}function os(t){return t<1024*1024*1024?`${(t/(1024*1024)).toFixed(0)} MB`:`${(t/(1024*1024*1024)).toFixed(1)} GB`}function Vn(t){if(t.length>16&&/^[a-f0-9]+$/i.test(t))return`Machine-${t.substring(0,8)}`;if(t.includes("_")){const s=t.split("_"),n=s[s.length-1];return n.length>12?`Machine-${n.substring(0,8)}`:n}return t}function qn(t){return Vn(t.trim().replace(/\.local$/i,""))}function Gn(t){const s=t.machineNickname??t.nickname;return typeof s!="string"?null:s.trim()||null}function Ks(t,s={}){var o,i;const n=[t.hostname,(o=t.machine)==null?void 0:o.hostname,(i=t.system)==null?void 0:i.hostname].find(c=>typeof c=="string"&&c.trim().length>0);if(n&&n!=="Unknown")return qn(n);const r=s.fallbackId||t.id;return r?`Machine-${r.substring(0,8)}`:s.fallbackLabel||"Machine"}function pt(t,s={}){return Gn(t)||Ks(t,s)}function is(t){return(t.id||"").includes(":cli:")}function cs(t){return(t.id||"").includes(":acp:")}function Ut(t,s){return He(t)}function Jn(t){if(!Array.isArray(t)||t.length<=1)return t;const s=new Map,n=["generating","streaming","active","connected","idle","panel_hidden"];for(const r of t){const o=(r.name||r.id||"").toLowerCase().replace(/\s+/g,"-"),i=s.get(o);if(!i){s.set(o,r);continue}const c=n.indexOf(i.status||"idle"),d=n.indexOf(r.status||"idle");d>=0&&(c<0||d<c)&&s.set(o,r)}return Array.from(s.values())}function Zn({activeConv:t,ides:s,isCreatingChat:n,isRefreshingHistory:r,onClose:o,onNewChat:i,onSwitchSession:c,onRefreshHistory:d}){var l;const u=s.find(g=>g.id===t.ideId),h=(u==null?void 0:u.chats)||[],x=(l=u==null?void 0:u.activeChat)==null?void 0:l.id;return e.jsxs("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[e.jsx("div",{onClick:o,className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),e.jsxs("div",{className:"card fade-in relative w-[90%] max-w-[500px] max-h-[80vh] flex flex-col p-0 overflow-hidden shadow-[0_20px_40px_rgba(0,0,0,0.4)] rounded-[20px]",children:[e.jsxs("div",{className:"px-6 py-5 border-b border-border-subtle flex justify-between items-center bg-[var(--surface-primary)]",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"m-0 text-lg font-extrabold",children:"Chat History"}),e.jsxs("div",{className:"text-xs text-text-muted mt-0.5",children:[t.displayPrimary," — ",He(t.ideType)]})]}),e.jsx("button",{onClick:o,className:"bg-transparent border-none text-xl text-text-muted cursor-pointer",children:"✕"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 bg-bg-primary",children:[e.jsx("button",{onClick:i,disabled:n,className:"w-full p-3.5 rounded-xl mb-3 bg-indigo-500/10 border border-dashed border-accent text-accent font-bold text-sm cursor-pointer",children:n?"⌛ Creating...":"+ Start New Chat Session"}),h.map(g=>e.jsxs("div",{onClick:()=>{c(t.ideId,g.id),o()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${x===g.id?"bg-[var(--bg-glass-hover)] border-accent":"bg-[var(--surface-secondary)] border-border-subtle"}`,children:[e.jsx("div",{className:`font-bold text-sm mb-1 ${x===g.id?"text-[var(--accent-primary-light)]":"text-text-primary"}`,children:g.title||"Untitled Session"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"text-[11px] text-text-muted font-mono",children:[g.id.substring(0,12),"..."]}),x===g.id&&e.jsx("span",{className:"text-[10px] bg-accent text-white px-2 py-0.5 rounded-[10px] font-extrabold",children:"ACTIVE"})]})]},g.id)),h.length===0&&e.jsxs("div",{className:"py-10 px-5 text-center text-text-muted",children:[e.jsx("div",{className:"text-3xl mb-3 opacity-60",children:e.jsx(En,{size:32})}),e.jsx("div",{className:"text-[13px]",children:"No recent chat sessions found."})]})]}),e.jsx("div",{className:"px-5 py-4 bg-[var(--surface-tertiary)] border-t border-border-subtle text-right",children:e.jsx("button",{onClick:d,disabled:r,className:"btn btn-secondary btn-sm rounded-[10px]",children:r?"⌛ Refreshing...":e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(As,{size:13})," Refresh History"]})})})]})]})}const ls={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function Fs({toasts:t,onDismiss:s,onClickToast:n}){return e.jsx("div",{className:"fixed right-4 z-[9999] flex flex-col gap-2 pointer-events-none",style:{top:"calc(env(safe-area-inset-top, 0px) + 16px)"},children:t.map(r=>e.jsxs("div",{className:"fade-in text-white px-5 py-3 rounded-xl text-[13px] font-semibold shadow-[0_8px_32px_rgba(0,0,0,0.3)] backdrop-blur-lg pointer-events-auto cursor-pointer animate-[toast-in_0.3s_ease-out] max-w-[360px] relative group",style:{background:ls[r.type]||ls.info},onClick:()=>{var o;(o=r.actions)!=null&&o.length||(n&&n(r),s(r.id))},children:[e.jsx("button",{className:"absolute top-1.5 right-1.5 w-5 h-5 rounded-full flex items-center justify-center text-white/50 hover:text-white hover:bg-white/20 transition-all text-[11px] leading-none opacity-0 group-hover:opacity-100 cursor-pointer",onClick:o=>{o.stopPropagation(),s(r.id)},"aria-label":"Dismiss",children:"×"}),e.jsx("div",{className:"pr-4",children:r.message}),r.actions&&r.actions.length>0&&e.jsx("div",{className:"flex gap-2 mt-2",children:r.actions.map((o,i)=>e.jsx("button",{className:`text-xs px-3 py-1 rounded-md font-bold transition-all cursor-pointer ${o.variant==="primary"?"bg-white text-amber-700 hover:bg-gray-100":o.variant==="danger"?"bg-red-500/30 text-white hover:bg-red-500/50":"bg-white/20 text-white hover:bg-white/30"}`,onClick:c=>{c.stopPropagation(),o.onClick(),s(r.id)},children:o.label},i))})]},r.id))})}const Qn=t=>(t.id||"").includes(":cli:")||(t.id||"").includes(":acp:")||(t.id||"").includes(":ide:")?!0:t.daemonId!==t.id;function er(t){const s=t.workspace||"";if(!s)return"";const n=s.split(/[/\\]/).filter(Boolean);return n.length>0?n[n.length-1]:s}function tr(t,s,n,r){const o={};if(n)for(const i of n){const c=i;(c.type==="adhdev-daemon"||c.daemonMode)&&(o[c.id]=pt(c,{fallbackId:c.id}))}return t.flatMap(i=>{var v,w,W,z,R;const c=[],d=i.daemonId&&o[i.daemonId]||void 0,u=i.daemonId||((v=i.id)==null?void 0:v.split(":")[0])||i.id,h=r?r[u]||"new":void 0,x=er(i),l=He(i.type),g=i.agentStreams,f=Array.isArray(g)?g.map(j=>({...j,activeModal:j.activeModal??void 0})):[],m=Qn(i),C=i.activeChat||{title:""},L=C.title&&String(C.title).trim()?String(C.title).trim():"";if(m){const j=Ut(i.type),O=(w=i.agents)==null?void 0:w[0],M=(W=i.activeChat)==null?void 0:W.activeModal,P=M&&Array.isArray(M.buttons)&&M.buttons.length>0,se=(z=i.activeChat)==null?void 0:z.status,y=se==="generating"||se==="loading"||se&&se.toLowerCase()==="thinking",U=P||se==="waiting_approval"?"waiting_approval":y?"working":(O==null?void 0:O.status)||"idle",b=i.activeChat||{title:"",messages:[]};let ee=b.title&&String(b.title).trim()?String(b.title).trim():"";const q=(R=i.activeChat)==null?void 0:R.id,H=i.chats;if(q&&Array.isArray(H)&&H.length>0){const ce=H.find(xe=>xe.id===q||xe.id&&String(xe.id)===String(q));ce!=null&&ce.title&&String(ce.title).trim()&&(ee=String(ce.title).trim())}const Y=b.messages||[],G=s[i.id]||[],oe=new Map;Y.filter(ce=>ce.role==="user").forEach(ce=>{oe.set(ce.content,(oe.get(ce.content)||0)+1)});const ne=G.filter(ce=>{const xe=oe.get(ce.content)||0;return xe>0?(oe.set(ce.content,xe-1),!1):!0});c.push({ideId:i.id,daemonId:i.daemonId||void 0,mode:Oe(i)?i.mode||"terminal":"chat",agentName:j,agentType:Oe(i)||Re(i)?i.cliType||i.acpType||i.type:(O==null?void 0:O.type)||"ide-native",status:U,title:ee,messages:[...Y,...ne],ideType:i.cliType||i.acpType||i.type,workspaceName:x,displayPrimary:ee||x||(Oe(i)||Re(i)?"Terminal":j),displaySecondary:l,cdpConnected:i.cdpConnected,modalButtons:P?M.buttons:void 0,modalMessage:P?M.message:void 0,streamSource:"native",tabKey:i.id,machineName:d,connectionState:h})}if(m&&(Oe(i)||Re(i)))return c;for(const j of f){const O=j.activeModal&&Array.isArray(j.activeModal.buttons)&&j.activeModal.buttons.length>0,M=O?"waiting_approval":j.status==="streaming"?"working":j.status,P=`${i.id}:${j.agentType}`,se=j.messages||[],y=s[P]||[],F=new Map;se.filter(b=>b.role==="user").forEach(b=>{F.set(b.content,(F.get(b.content)||0)+1)});const U=y.filter(b=>{const ee=F.get(b.content)||0;return ee>0?(F.set(b.content,ee-1),!1):!0});c.push({ideId:i.id,daemonId:i.daemonId||void 0,mode:"chat",agentName:j.agentName,agentType:j.agentType,status:M,title:"",messages:[...se,...U],ideType:j.agentType,workspaceName:x,displayPrimary:L||x||j.agentName,displaySecondary:`${l}·${j.agentName}`,cdpConnected:i.cdpConnected,modalButtons:O?j.activeModal.buttons:void 0,modalMessage:O?j.activeModal.message:void 0,streamSource:"agent-stream",tabKey:P,machineName:d,connectionState:h})}return c.length===0&&c.push({ideId:i.id,daemonId:i.daemonId||void 0,mode:"chat",agentName:Ut(i.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:i.type,workspaceName:x,displayPrimary:x||l,displaySecondary:l,cdpConnected:i.cdpConnected,streamSource:"native",tabKey:i.id,connectionState:h}),c})}function sr(t,s){var d,u,h,x;const n=[],{daemonId:r,existingDaemon:o,timestamp:i}=s,c=i||t.timestamp||Date.now();n.push({...o||{},id:r,type:"adhdev-daemon",status:"online",daemonMode:!0,timestamp:c,...t.version&&{version:t.version},...t.machine&&{machine:t.machine,platform:t.machine.platform},...t.instanceId&&{instanceId:t.instanceId},...t.machineNickname!==void 0&&{machineNickname:t.machineNickname},...t.p2p&&{p2p:t.p2p},..."system"in t&&{system:t.system},..."hostname"in t&&{hostname:t.hostname},...t.workspaces&&{workspaces:t.workspaces},...t.defaultWorkspaceId!==void 0&&{defaultWorkspaceId:t.defaultWorkspaceId},...t.defaultWorkspacePath!==void 0&&{defaultWorkspacePath:t.defaultWorkspacePath},...t.workspaceActivity&&{workspaceActivity:t.workspaceActivity},...t.detectedIdes&&{detectedIdes:t.detectedIdes},..."availableProviders"in t&&{availableProviders:t.availableProviders},cdpConnected:t.managedIdes.some(l=>l.cdpConnected),managedIdeIds:t.managedIdes.map(l=>`${r}:ide:${l.instanceId}`),managedCliIds:t.managedClis.map(l=>l.id?`${r}:cli:${l.id}`:`${r}:cli:${l.cliType}`),managedAcpIds:t.managedAcps.map(l=>l.id?`${r}:acp:${l.id}`:`${r}:acp:${l.acpType}`)});for(const l of t.managedIdes)n.push({id:`${r}:ide:${l.instanceId}`,type:l.ideType,ideType:l.ideType,version:l.ideVersion,status:l.cdpConnected?"online":"detected",daemonId:r,instanceId:l.instanceId,workspace:l.workspace,terminals:l.terminals,agents:l.aiAgents,activeChat:l.activeChat,chats:l.chats,agentStreams:l.agentStreams,cdpConnected:l.cdpConnected,currentModel:l.currentModel,currentPlan:l.currentPlan,currentAutoApprove:l.currentAutoApprove,timestamp:c});for(const l of t.managedClis){const g=l.id?`${r}:cli:${l.id}`:`${r}:cli:${l.cliType}`;n.push({id:g,type:l.cliType,ideType:l.cliType,agentType:l.cliType,status:l.status||"running",daemonId:r,instanceId:l.id,cliName:l.cliName,mode:l.mode||"terminal",workspace:l.workspace,activeChat:l.activeChat,agentStreams:[{agentType:l.cliType,agentName:l.cliName,extensionId:"cli-agent",status:l.status==="generating"?"streaming":l.status==="waiting_approval"?"waiting_approval":"idle",messages:((d=l.activeChat)==null?void 0:d.messages)||[],inputContent:"",activeModal:(u=l.activeChat)==null?void 0:u.activeModal}],timestamp:c,_isCli:!0})}for(const l of t.managedAcps){const g=l.id?`${r}:acp:${l.id}`:`${r}:acp:${l.acpType}`;n.push({id:g,type:l.acpType,ideType:l.acpType,agentType:l.acpType,status:l.status||"running",daemonId:r,instanceId:l.id,cliName:l.acpName,mode:"chat",workspace:l.workspace,activeChat:l.activeChat,currentModel:l.currentModel,currentPlan:l.currentPlan,acpConfigOptions:l.acpConfigOptions,acpModes:l.acpModes,agentStreams:[{agentType:l.acpType,agentName:l.acpName,extensionId:"acp-agent",status:l.status==="generating"?"streaming":l.status==="waiting_approval"?"waiting_approval":"idle",messages:((h=l.activeChat)==null?void 0:h.messages)||[],inputContent:"",activeModal:(x=l.activeChat)==null?void 0:x.activeModal}],timestamp:c,_isAcp:!0})}return n}const Hs=[{id:"vscode",name:"VS Code",icon:"💙"},{id:"cursor",name:"Cursor",icon:"⚡"},{id:"windsurf",name:"Windsurf",icon:"🏄"},{id:"antigravity",name:"Antigravity",icon:"🌀"},{id:"trae",name:"Trae",icon:"🔮"},{id:"kiro",name:"Kiro",icon:"🎯"},{id:"pearai",name:"PearAI",icon:"🍐"},{id:"vscodium",name:"VSCodium",icon:"💚"}],Us=[{id:"claude-cli",name:"Claude Code",icon:"🟠"},{id:"gemini-cli",name:"Gemini CLI",icon:"✨"},{id:"codex-cli",name:"Codex CLI",icon:"📦"}],Ys=[{id:"copilot",name:"GitHub Copilot",icon:"🤖"},{id:"cline",name:"Cline",icon:"🧠"},{id:"roo-code",name:"Roo Code",icon:"🦘"},{id:"continue",name:"Continue",icon:"▶️"}],Xs="adhdev_notification_prefs",ds={globalEnabled:!0,disconnectAlert:!0,browserNotifications:!0,completionAlert:!0,approvalAlert:!0,chatTaskCompletionBubble:!1};function nr(){try{const t=localStorage.getItem(Xs);if(t){const s=JSON.parse(t);return{...ds,...s}}}catch{}return{...ds}}function rr(t){try{localStorage.setItem(Xs,JSON.stringify(t))}catch{}}let Ve=nr(),Tt=[];function ar(){Tt.forEach(t=>t())}function or(){return{...Ve}}function ir(t){Ve={...Ve,...t},rr(Ve),ar()}function cr(){const[,t]=a.useState(0);a.useEffect(()=>{const n=()=>t(r=>r+1);return Tt.push(n),()=>{Tt=Tt.filter(r=>r!==n)}},[]);const s=a.useCallback(n=>{ir(n)},[]);return[{...Ve},s]}function bt(t){if(!Ve.globalEnabled)return!1;switch(t){case"disconnect":return Ve.disconnectAlert;case"completion":return Ve.completionAlert;case"approval":return Ve.approvalAlert;case"browser":return Ve.browserNotifications;default:return!0}}const lr={enabled:!0,onApproval:!0,onComplete:!0,onError:!0,throttleMs:5e3};async function dr(){return"Notification"in window?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"}function Vs(){return"Notification"in window&&Notification.permission==="granted"}let ot=null;async function ur(){if(ot!==null)return ot;try{if(!("serviceWorker"in navigator)||!("PushManager"in window))return ot=!1,!1;const t=await navigator.serviceWorker.getRegistration();return t?(ot=!!await t.pushManager.getSubscription(),ot):(ot=!1,!1)}catch{return ot=!1,!1}}function Yt(t,s,n){if(Vs())try{const r=new Notification(t,{body:s,icon:"/otter-logo.png",tag:n||`adhdev-${Date.now()}`,silent:!1});setTimeout(()=>r.close(),8e3),r.onclick=()=>{window.focus(),r.close()}}catch{}}function xr(t,s={}){const n={...lr,...s},r=a.useRef(new Map),o=a.useRef(0),i=a.useRef(null);a.useEffect(()=>{ur().then(d=>{i.current=d})},[]);const c=a.useCallback((d,u,h)=>{const x=Date.now();x-o.current<n.throttleMs||(o.current=x,Yt(d,u,h))},[n.throttleMs]);a.useEffect(()=>{var d;if(!(!n.enabled||!Vs())&&bt("browser")&&i.current!==!0){if(document.hasFocus()){for(const u of t)r.current.set(u.id,u.status||"idle");return}for(const u of t){const h=r.current.get(u.id),x=u.status||"idle",l=u.name||u.id;if(n.onApproval&&bt("approval")&&x==="waiting_approval"&&h!=="waiting_approval"){const g=((d=u.activeModal)==null?void 0:d.message)||"Action requires your approval";c(`🔔 ${l} — Approval needed`,g.slice(0,120),`approval-${u.id}`)}n.onComplete&&bt("completion")&&h==="generating"&&x==="idle"&&c(`✅ ${l} — Task complete`,"Agent has finished working",`complete-${u.id}`),n.onError&&x==="error"&&h!=="error"&&c(`⚠️ ${l} — Error`,"Agent encountered an error",`error-${u.id}`),r.current.set(u.id,x)}}},[t,n.enabled,n.onApproval,n.onComplete,n.onError,c])}class pr{constructor(){Ee(this,"dedupMap",new Map);Ee(this,"DEDUP_WINDOW_MS",5e3);Ee(this,"DEDUP_MAX_SIZE",50);Ee(this,"DEDUP_CLEANUP_AGE_MS",1e4);Ee(this,"toastCallbacks",[]);Ee(this,"systemMessageCallbacks",[]);Ee(this,"clearSystemMessageCallbacks",[]);Ee(this,"resolveActionFn",null);Ee(this,"viewRequestRespondFn",null);Ee(this,"ides",[])}onToast(s){return this.toastCallbacks.push(s),()=>{this.toastCallbacks=this.toastCallbacks.filter(n=>n!==s)}}onSystemMessage(s){return this.systemMessageCallbacks.push(s),()=>{this.systemMessageCallbacks=this.systemMessageCallbacks.filter(n=>n!==s)}}onClearSystemMessage(s){return this.clearSystemMessageCallbacks.push(s),()=>{this.clearSystemMessageCallbacks=this.clearSystemMessageCallbacks.filter(n=>n!==s)}}setResolveAction(s){this.resolveActionFn=s}setIdes(s){this.ides=s}setViewRequestRespond(s){this.viewRequestRespondFn=s}emitToast(s){for(const n of this.toastCallbacks)n(s)}showToast(s,n="info",r){const o=(r==null?void 0:r.id)||Date.now();this.emitToast({id:o,message:s,type:n,timestamp:o,duration:5e3,...r})}emitSystemMessage(s,n){for(const r of this.systemMessageCallbacks)r(s,n)}emitClearSystemMessage(s,n){for(const r of this.clearSystemMessageCallbacks)r(s,n)}isDuplicate(s){const n=Date.now(),r=this.dedupMap.get(s)||0;if(n-r<this.DEDUP_WINDOW_MS)return!0;if(this.dedupMap.set(s,n),this.dedupMap.size>this.DEDUP_MAX_SIZE)for(const[o,i]of this.dedupMap)n-i>this.DEDUP_CLEANUP_AGE_MS&&this.dedupMap.delete(o);return!1}resolveOwningDaemon(s){if(s.ideType==="adhdev-daemon"&&s.ideId){const o=this.ides.find(i=>i.id===s.ideId&&i.type==="adhdev-daemon");if(o)return o}let n;if(s.ideId&&(n=this.ides.find(o=>o.id===s.ideId)),!n&&s.instanceId&&(n=this.ides.find(o=>o.id.endsWith(`:ide:${s.instanceId}`)||o.id.endsWith(`:cli:${s.instanceId}`))),n){const o=n.daemonId;if(o){const i=this.ides.find(c=>c.id===o&&c.type==="adhdev-daemon");if(i)return i}}const r=this.ides.filter(o=>o.type==="adhdev-daemon");return r.length===1?r[0]:null}resolveRouteId(s,n){for(const r of this.ides)if(r.id.startsWith(s)&&(!n||n===r.type))return r.id;return s}handleRawEvent(s,n){var u,h;const r=`${s.ideType||s.providerType||""}:${s.event}:${s.chatTitle||""}`;if(this.isDuplicate(r))return;if(!s.ideId&&s.instanceId){for(const x of this.ides)if(x.id.endsWith(`:ide:${s.instanceId}`)||x.id.endsWith(`:cli:${s.instanceId}`)){s.ideId=x.id;break}}let o=He(s.ideType||"");const i=this.resolveOwningDaemon(s);if(i){const x=pt(i,{fallbackId:i.id});x&&(o=s.ideType==="adhdev-daemon"?x:`${x}/${o}`)}let c="",d="info";if(s.event==="agent:generating_completed"){const x=s.duration?` (${s.duration}s)`:"";c=`✅ ${o} agent task completed${x}`,d="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}s.ideId&&or().chatTaskCompletionBubble&&this.emitSystemMessage(s.ideId,{role:"system",timestamp:Date.now(),content:`✅ Task completed${x}`,_localId:`sys_complete_${Date.now()}`})}else if(s.event==="agent:generating_started")s.ideId&&this.emitClearSystemMessage(s.ideId,"sys_complete_");else if(s.event==="agent:waiting_approval"){if(c=`⚡ ${o} approval needed`,d="warning",s.ideId){const x=s.modalMessage||"Approval requested",l=(u=s.modalButtons)!=null&&u.length?s.modalButtons.map(g=>`[${g}]`).join(" "):"[Approve] [Reject]";this.emitSystemMessage(s.ideId,{role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${x}
|
|
39
|
-
${l}`,_localId:`sys_approval_${Date.now()}`})}if(s.ideId&&((h=s.modalButtons)!=null&&h.length)&&this.resolveActionFn){const x=s.ideId,l=s.agentType||s.ideType||"",g=s.ideType||"",f=s.modalButtons,m=W=>W.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim(),C=this.resolveActionFn,L=f.map((W,z)=>{const R=m(W).toLowerCase(),j=/^(run|approve|accept|yes|allow|always)/.test(R),O=/^(reject|deny|delete|remove|abort|cancel|no)/.test(R);return{label:m(W),variant:j?"primary":O?"danger":"default",onClick:()=>{const M=this.resolveRouteId(x,l),P=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(R);C(M,"resolve_action",{action:P?"approve":"reject",button:W,buttonIndex:z,agentType:l,ideType:g})}}}),v=s.modalMessage?`⚡ ${o}: ${s.modalMessage.replace(/[\n\r]+/g," ").slice(0,80)}`:c,w=Date.now();this.emitToast({id:w,message:v,type:d,timestamp:w,ideId:x,actions:L,duration:15e3}),c=""}}else if(s.event==="monitor:long_generating"){const x=s.elapsedSec?` (${Math.round(s.elapsedSec/60)}m)`:"";c=`⚠️ ${o} agent is taking a long time${x}`,d="warning",bt("browser")&&!document.hasFocus()&&Yt(`⚠️ ${o} — Long Running`,`Agent has been generating for over ${x.replace(/[()]/g,"")}`,`long-${s.ideId||s.agentType}`)}else if(s.event==="team:view_request"){const x=s.requesterName||"A team member",l=s.requestId,g=s.orgId;if(c=`👁️ ${x} wants to view your session`,d="warning",l&&g&&this.viewRequestRespondFn){const f=this.viewRequestRespondFn,m=Date.now(),C=[{label:"Approve",variant:"primary",onClick:()=>{f(g,l,"approve").catch(L=>console.error("[EventManager] approve view request failed:",L))}},{label:"Decline",variant:"danger",onClick:()=>{f(g,l,"reject").catch(L=>console.error("[EventManager] reject view request failed:",L))}}];this.emitToast({id:m,message:c,type:d,timestamp:m,actions:C,duration:3e4}),c=""}bt("browser")&&!document.hasFocus()&&Yt("👁️ View Request",`${x} wants to view your session`,`view-request-${l}`)}else s.event==="team:view_request_approved"?(c="✅ View request approved",d="success"):s.event==="team:view_request_rejected"&&(c=`❌ ${s.targetName||"Team member"} declined your view request`,d="warning");if(c){const x=Date.now();this.emitToast({id:x,message:c,type:d,timestamp:x,ideId:s.ideId,duration:5e3})}}}const st=new pr;function dt(...t){return rn(an(t))}function mr({icon:t,title:s,subtitle:n,badge:r,actions:o,className:i}){return e.jsxs("div",{className:dt("dashboard-header",i),children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"header-title flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center text-lg",children:t})," ",s,r&&e.jsxs("span",{className:"text-[10px] font-semibold px-1.5 py-px rounded-full bg-accent/10 text-accent-light",children:[r.count!==void 0?r.count:""," ",r.text]})]}),n&&e.jsx("div",{className:"header-subtitle mt-1 text-xs text-text-muted",children:n})]}),o&&e.jsx("div",{className:"flex gap-2",children:o})]})}function _t({icon:t,title:s,subtitle:n,badge:r,actions:o,widthClassName:i="max-w-6xl",contentClassName:c,children:d}){return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(mr,{icon:t,title:s,subtitle:n,badge:r,actions:o}),e.jsx("div",{className:"page-content",children:e.jsx("div",{className:dt("mx-auto flex w-full flex-col gap-4",i,c),children:d})})]})}function De({title:t,icon:s,description:n,accentColor:r,className:o,children:i}){return e.jsxs("div",{className:dt("bg-bg-card border border-border-subtle rounded-2xl p-5 backdrop-blur-xl transition-all","hover:border-border-default hover:shadow-glow",r&&"border-l-[3px]",o),style:r?{borderLeftColor:r}:void 0,children:[(t||n)&&e.jsxs("div",{className:"mb-4",children:[t&&e.jsxs("h3",{className:"text-base font-semibold text-text-primary",children:[s&&e.jsx("span",{className:"mr-1.5",children:s}),t]}),n&&e.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:n})]}),i]})}function Qt({icon:t,title:s,description:n,action:r,className:o}){return e.jsxs("div",{className:dt("py-16 px-5 text-center bg-bg-glass border-2 border-dashed border-border-subtle rounded-2xl",o),children:[e.jsx("div",{className:"text-5xl mb-4 opacity-50",children:t}),e.jsx("h3",{className:"text-lg font-bold text-text-secondary mb-2",children:s}),e.jsx("p",{className:"text-sm text-text-muted max-w-sm mx-auto mb-5 leading-relaxed",children:n}),r]})}const hr={error:"bg-red-500/10 border-red-500/30 text-red-400",warning:"bg-yellow-500/10 border-yellow-500/30 text-yellow-400",success:"bg-green-500/10 border-green-500/30 text-green-400",info:"bg-indigo-500/10 border-indigo-500/30 text-indigo-400"},fr={error:"⚠️",warning:"🧪",success:"✅",info:"💡"};function gr({variant:t,children:s,onDismiss:n,className:r}){return e.jsxs("div",{className:dt("flex items-center justify-between gap-3 px-4 py-3 rounded-xl border text-[13px]",hr[t],r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:fr[t]}),e.jsx("span",{children:s})]}),n&&e.jsx("button",{onClick:n,className:"cursor-pointer border-none bg-transparent text-current text-base opacity-70 hover:opacity-100 transition-opacity",children:"✕"})]})}const br={online:"bg-green-500/10 text-green-400 border-green-500/30",idle:"bg-yellow-500/10 text-yellow-400 border-yellow-500/30",busy:"bg-orange-500/10 text-orange-400 border-orange-500/30",error:"bg-red-500/10 text-red-400 border-red-500/30",offline:"bg-gray-500/10 text-text-secondary border-gray-500/30"},yr={online:"bg-green-500",idle:"bg-yellow-500",busy:"bg-orange-500",error:"bg-red-500",offline:"bg-gray-500"};function jr({status:t,label:s,className:n}){const r=s||t;return e.jsxs("span",{className:dt("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",br[t],n),children:[e.jsx("span",{className:dt("w-2 h-2 rounded-full animate-[pulse-dot_2s_ease-in-out_infinite]",yr[t])}),r]})}function vr(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function us(){try{const t=localStorage.getItem("theme");if(t==="dark"||t==="light"||t==="system")return t}catch{}return"system"}function Wt(t){return t==="system"?vr():t}function wr(){const[t,s]=a.useState(us),[n,r]=a.useState(()=>Wt(us()));a.useEffect(()=>{document.documentElement.setAttribute("data-theme",n)},[n]),a.useEffect(()=>{const c=window.matchMedia("(prefers-color-scheme: light)"),d=u=>{t==="system"&&r(u.matches?"light":"dark")};return c.addEventListener("change",d),()=>c.removeEventListener("change",d)},[t]);const o=a.useCallback(c=>{s(c),r(Wt(c));try{localStorage.setItem("theme",c)}catch{}},[]),i=a.useCallback(()=>{s(c=>{const d=c==="dark"?"light":c==="light"?"system":"dark";r(Wt(d));try{localStorage.setItem("theme",d)}catch{}return d})},[]);return{theme:n,preference:t,setPreference:o,cycleTheme:i,isDark:n==="dark"}}function ct({label:t,description:s,checked:n,disabled:r,onChange:o,extra:i}){return e.jsxs("label",{className:"flex justify-between items-center cursor-pointer",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:t}),e.jsx("div",{className:"text-[11px] text-text-muted",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i,e.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:c=>o(c.target.checked),className:"w-5 h-5 accent-accent"})]})]})}function Nr({onPrefChange:t}){const[s,n]=cr(),r=(o,i)=>{n({[o]:i}),t==null||t(o,i)};return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ls,{size:15})," Notifications"]}),description:"Master toggle for all alerts",checked:s.globalEnabled,onChange:o=>r("globalEnabled",o)}),s.globalEnabled&&e.jsx("div",{className:"border-t border-border-subtle my-0.5"}),s.globalEnabled&&e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(at,{size:15})," Browser Notifications"]}),description:"Desktop alerts when tab is inactive",checked:s.browserNotifications,onChange:o=>r("browserNotifications",o)}),s.globalEnabled&&s.browserNotifications&&e.jsxs("div",{className:"ml-5 pl-3 border-l-2 border-border-subtle flex flex-col gap-2",children:[e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(An,{size:15})," Completion Alerts"]}),description:"Notify when agent finishes a task",checked:s.completionAlert,onChange:o=>r("completionAlert",o)}),e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx($n,{size:15})," Approval Alerts"]}),description:"Notify when agent needs approval",checked:s.approvalAlert,onChange:o=>r("approvalAlert",o)}),e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(xt,{size:15})," Connection Alerts"]}),description:"Alert when a daemon disconnects",checked:s.disconnectAlert,onChange:o=>r("disconnectAlert",o)})]}),s.globalEnabled&&e.jsx("div",{className:"border-t border-border-subtle my-2"}),s.globalEnabled&&e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ut,{size:15})," Task Completion Bubble"]}),description:"Show a system message bubble in chat when an agent finishes a task",checked:s.chatTaskCompletionBubble,onChange:o=>r("chatTaskCompletionBubble",o)}),!s.globalEnabled&&e.jsx("p",{className:"text-[11px] text-text-muted italic",children:"All notifications are disabled. Enable the master toggle to configure individual alerts."})]})}function kr({ides:t,emptyMessage:s,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:o}){const i=t.filter(c=>c.type==="adhdev-daemon");return i.length===0?e.jsx(Qt,{icon:e.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-12 h-12 object-contain mx-auto opacity-90"}),title:"No machines connected",description:s||"Run 'adhdev-standalone' to connect a local daemon instance."}):e.jsx("div",{className:"flex flex-col gap-2",children:i.map(c=>e.jsx(Cr,{ide:c,allIdes:t,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:o},c.id))})}function xs({title:t,message:s,confirmLabel:n,confirmColor:r,onConfirm:o,onCancel:i}){const c=r==="red"?"bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30 hover:bg-amber-500/30";return on.createPortal(e.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",style:{zIndex:9999},onClick:i,children:e.jsxs("div",{className:"bg-bg-primary border border-border-subtle rounded-xl p-5 max-w-sm w-full mx-4 shadow-2xl",onClick:d=>d.stopPropagation(),children:[e.jsx("div",{className:"font-semibold text-sm mb-3",children:t}),e.jsx("div",{className:"text-xs text-text-muted leading-relaxed mb-5 whitespace-pre-line",children:s}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:i,className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-bg-secondary text-text-secondary border border-border-subtle hover:bg-bg-glass transition-colors",children:"Cancel"}),e.jsx("button",{onClick:o,className:`text-xs px-3 py-1.5 rounded-lg font-medium border transition-colors ${c}`,children:n})]})]})}),document.body)}function Sr(t){const s=t.replace(/^ide-/,"").replace(/-provider$/,"").toLowerCase(),r=[...Hs,...Us,...Ys].find(o=>o.id===s||s.includes(o.id)||o.id.includes(s));return r?{icon:r.icon,name:r.name}:{icon:"📝",name:t}}function Cr({ide:t,allIdes:s,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:o}){var b,ee;const[i,c]=a.useState("idle"),[d,u]=a.useState(""),[h,x]=a.useState(null),[l,g]=a.useState("idle"),[f,m]=a.useState(""),C=t,L=C.version||C.daemonVersion||null,v=((b=C.machine)==null?void 0:b.platform)||((ee=C.system)==null?void 0:ee.platform)||"",w=pt(C,{fallbackId:t.id}),W=v==="win32"?"🪟":v==="darwin"?"🍎":"🐧",z=s.filter(q=>q.daemonId===t.id&&q.id.includes(":ide:")),R=s.filter(q=>q.daemonId===t.id&&q.id.includes(":cli:")),j=s.filter(q=>q.daemonId===t.id&&q.id.includes(":acp:")),O=C.p2p,M=async()=>{var q,H,Y;if(n){c("upgrading"),u("Installing latest version...");try{const G=await n(t.id,"daemon_upgrade",{});(q=G==null?void 0:G.result)!=null&&q.upgraded||(H=G==null?void 0:G.result)!=null&&H.success?(c("done"),u(`Upgraded to v${G.result.version||"latest"}. Daemon is restarting...`)):(c("error"),u(((Y=G==null?void 0:G.result)==null?void 0:Y.error)||"Upgrade failed"))}catch(G){c("error"),u((G==null?void 0:G.message)||"Connection lost during upgrade")}}},P=async()=>{if(x(null),!!r){g("loading");try{await r(t.id),g("done"),m("Machine disconnected.")}catch(q){g("error"),m((q==null?void 0:q.message)||"Failed to disconnect")}}},se=async()=>{if(x(null),!!o){g("loading");try{await o(t.id),g("done"),m('Token revoked. Machine must restart "adhdev-standalone" to reconnect.')}catch(q){g("error"),m((q==null?void 0:q.message)||"Failed to revoke token")}}},y="0.6.74",F=!L||L!==y,U=z.length+R.length+j.length;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-bg-glass rounded-lg px-4 py-3 border border-border-subtle",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xl",children:W}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:w}),e.jsxs("div",{className:"text-xs text-text-muted font-mono flex items-center gap-2",children:[e.jsxs("span",{children:[t.id.substring(0,12),"…"]}),L&&e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${F?"bg-amber-500/15 text-amber-400":"bg-bg-secondary"}`,children:["v",L,!F&&" ✓"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&F&&e.jsx("button",{onClick:M,disabled:i==="upgrading"||i==="done",className:"btn btn-sm btn-primary disabled:opacity-50 disabled:cursor-not-allowed",title:`Update to v${y}`,children:i==="upgrading"?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"animate-spin",children:"⟳"})," Upgrading..."]}):i==="done"?"✓ Updated":`↑ Update${` to v${y}`}`}),r&&e.jsx("button",{onClick:()=>x("disconnect"),disabled:l==="loading",className:"btn btn-sm btn-warning disabled:opacity-50 disabled:cursor-not-allowed",title:"Disconnect this machine",children:"Disconnect"}),o&&e.jsx("button",{onClick:()=>x("revoke"),disabled:l==="loading",className:"btn btn-sm btn-danger disabled:opacity-50 disabled:cursor-not-allowed",title:"Remove machine (requires re-setup)",children:"Remove"}),e.jsx(jr,{status:t.status==="online"?"online":"error"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-2.5 pt-2.5 border-t border-border-subtle/50",children:[O&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${O.state==="connected"?"bg-green-400":O.state==="connecting"||O.state==="new"?"bg-amber-400 animate-pulse":"bg-text-muted/30"}`}),e.jsxs("span",{className:"text-text-muted",children:["P2P ",O.state==="connected"?"connected":O.state==="connecting"||O.state==="new"?"connecting...":O.state||"off"]}),O.peers!==void 0&&O.peers>0&&e.jsxs("span",{className:"text-text-muted/60",children:["(",O.peers," peer",O.peers!==1?"s":"",")"]})]}),O&&U>0&&e.jsx("span",{className:"text-border-subtle",children:"·"}),U>0?e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[z.map(q=>{const H=Sr(q.type),Y=q.cdpConnected;return e.jsxs("span",{className:"flex items-center gap-1 bg-bg-secondary px-1.5 py-0.5 rounded",children:[e.jsx("span",{children:H.icon}),e.jsx("span",{children:H.name}),Y!==void 0&&e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Y?"bg-green-400":"bg-amber-400 animate-pulse"}`,title:Y?"CDP connected":"CDP connecting..."})]},q.id)}),R.map(q=>e.jsxs("span",{className:"flex items-center gap-1 bg-bg-secondary px-1.5 py-0.5 rounded",children:[e.jsx("span",{children:"⌨️"}),e.jsx("span",{children:q.cliName||"CLI"})]},q.id)),j.map(q=>e.jsxs("span",{className:"flex items-center gap-1 bg-bg-secondary px-1.5 py-0.5 rounded",children:[e.jsx("span",{children:"🔗"}),e.jsx("span",{children:q.cliName||"ACP"})]},q.id))]}):e.jsx("span",{className:"text-[11px] text-text-muted/60 italic",children:"No IDEs connected"})]}),(d||f)&&e.jsx("div",{className:`text-xs mt-2 px-1 ${i==="error"||l==="error"?"text-red-400":i==="done"||l==="done"?"text-green-400":"text-text-muted"}`,children:f||d})]}),h==="disconnect"&&e.jsx(xs,{title:"🔌 Disconnect Machine",message:`Disconnect "${w}" from ADHDev?
|
|
39
|
+
${l}`,_localId:`sys_approval_${Date.now()}`})}if(s.ideId&&((h=s.modalButtons)!=null&&h.length)&&this.resolveActionFn){const x=s.ideId,l=s.agentType||s.ideType||"",g=s.ideType||"",f=s.modalButtons,m=W=>W.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim(),C=this.resolveActionFn,L=f.map((W,z)=>{const R=m(W).toLowerCase(),j=/^(run|approve|accept|yes|allow|always)/.test(R),O=/^(reject|deny|delete|remove|abort|cancel|no)/.test(R);return{label:m(W),variant:j?"primary":O?"danger":"default",onClick:()=>{const M=this.resolveRouteId(x,l),P=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(R);C(M,"resolve_action",{action:P?"approve":"reject",button:W,buttonIndex:z,agentType:l,ideType:g})}}}),v=s.modalMessage?`⚡ ${o}: ${s.modalMessage.replace(/[\n\r]+/g," ").slice(0,80)}`:c,w=Date.now();this.emitToast({id:w,message:v,type:d,timestamp:w,ideId:x,actions:L,duration:15e3}),c=""}}else if(s.event==="monitor:long_generating"){const x=s.elapsedSec?` (${Math.round(s.elapsedSec/60)}m)`:"";c=`⚠️ ${o} agent is taking a long time${x}`,d="warning",bt("browser")&&!document.hasFocus()&&Yt(`⚠️ ${o} — Long Running`,`Agent has been generating for over ${x.replace(/[()]/g,"")}`,`long-${s.ideId||s.agentType}`)}else if(s.event==="team:view_request"){const x=s.requesterName||"A team member",l=s.requestId,g=s.orgId;if(c=`👁️ ${x} wants to view your session`,d="warning",l&&g&&this.viewRequestRespondFn){const f=this.viewRequestRespondFn,m=Date.now(),C=[{label:"Approve",variant:"primary",onClick:()=>{f(g,l,"approve").catch(L=>console.error("[EventManager] approve view request failed:",L))}},{label:"Decline",variant:"danger",onClick:()=>{f(g,l,"reject").catch(L=>console.error("[EventManager] reject view request failed:",L))}}];this.emitToast({id:m,message:c,type:d,timestamp:m,actions:C,duration:3e4}),c=""}bt("browser")&&!document.hasFocus()&&Yt("👁️ View Request",`${x} wants to view your session`,`view-request-${l}`)}else s.event==="team:view_request_approved"?(c="✅ View request approved",d="success"):s.event==="team:view_request_rejected"&&(c=`❌ ${s.targetName||"Team member"} declined your view request`,d="warning");if(c){const x=Date.now();this.emitToast({id:x,message:c,type:d,timestamp:x,ideId:s.ideId,duration:5e3})}}}const st=new pr;function dt(...t){return rn(an(t))}function mr({icon:t,title:s,subtitle:n,badge:r,actions:o,className:i}){return e.jsxs("div",{className:dt("dashboard-header",i),children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"header-title flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center text-lg",children:t})," ",s,r&&e.jsxs("span",{className:"text-[10px] font-semibold px-1.5 py-px rounded-full bg-accent/10 text-accent-light",children:[r.count!==void 0?r.count:""," ",r.text]})]}),n&&e.jsx("div",{className:"header-subtitle mt-1 text-xs text-text-muted",children:n})]}),o&&e.jsx("div",{className:"flex gap-2",children:o})]})}function _t({icon:t,title:s,subtitle:n,badge:r,actions:o,widthClassName:i="max-w-6xl",contentClassName:c,children:d}){return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(mr,{icon:t,title:s,subtitle:n,badge:r,actions:o}),e.jsx("div",{className:"page-content",children:e.jsx("div",{className:dt("mx-auto flex w-full flex-col gap-4",i,c),children:d})})]})}function De({title:t,icon:s,description:n,accentColor:r,className:o,children:i}){return e.jsxs("div",{className:dt("bg-bg-card border border-border-subtle rounded-2xl p-5 backdrop-blur-xl transition-all","hover:border-border-default hover:shadow-glow",r&&"border-l-[3px]",o),style:r?{borderLeftColor:r}:void 0,children:[(t||n)&&e.jsxs("div",{className:"mb-4",children:[t&&e.jsxs("h3",{className:"text-base font-semibold text-text-primary",children:[s&&e.jsx("span",{className:"mr-1.5",children:s}),t]}),n&&e.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:n})]}),i]})}function Qt({icon:t,title:s,description:n,action:r,className:o}){return e.jsxs("div",{className:dt("py-16 px-5 text-center bg-bg-glass border-2 border-dashed border-border-subtle rounded-2xl",o),children:[e.jsx("div",{className:"text-5xl mb-4 opacity-50",children:t}),e.jsx("h3",{className:"text-lg font-bold text-text-secondary mb-2",children:s}),e.jsx("p",{className:"text-sm text-text-muted max-w-sm mx-auto mb-5 leading-relaxed",children:n}),r]})}const hr={error:"bg-red-500/10 border-red-500/30 text-red-400",warning:"bg-yellow-500/10 border-yellow-500/30 text-yellow-400",success:"bg-green-500/10 border-green-500/30 text-green-400",info:"bg-indigo-500/10 border-indigo-500/30 text-indigo-400"},fr={error:"⚠️",warning:"🧪",success:"✅",info:"💡"};function gr({variant:t,children:s,onDismiss:n,className:r}){return e.jsxs("div",{className:dt("flex items-center justify-between gap-3 px-4 py-3 rounded-xl border text-[13px]",hr[t],r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:fr[t]}),e.jsx("span",{children:s})]}),n&&e.jsx("button",{onClick:n,className:"cursor-pointer border-none bg-transparent text-current text-base opacity-70 hover:opacity-100 transition-opacity",children:"✕"})]})}const br={online:"bg-green-500/10 text-green-400 border-green-500/30",idle:"bg-yellow-500/10 text-yellow-400 border-yellow-500/30",busy:"bg-orange-500/10 text-orange-400 border-orange-500/30",error:"bg-red-500/10 text-red-400 border-red-500/30",offline:"bg-gray-500/10 text-text-secondary border-gray-500/30"},yr={online:"bg-green-500",idle:"bg-yellow-500",busy:"bg-orange-500",error:"bg-red-500",offline:"bg-gray-500"};function jr({status:t,label:s,className:n}){const r=s||t;return e.jsxs("span",{className:dt("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",br[t],n),children:[e.jsx("span",{className:dt("w-2 h-2 rounded-full animate-[pulse-dot_2s_ease-in-out_infinite]",yr[t])}),r]})}function vr(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function us(){try{const t=localStorage.getItem("theme");if(t==="dark"||t==="light"||t==="system")return t}catch{}return"system"}function Wt(t){return t==="system"?vr():t}function wr(){const[t,s]=a.useState(us),[n,r]=a.useState(()=>Wt(us()));a.useEffect(()=>{document.documentElement.setAttribute("data-theme",n)},[n]),a.useEffect(()=>{const c=window.matchMedia("(prefers-color-scheme: light)"),d=u=>{t==="system"&&r(u.matches?"light":"dark")};return c.addEventListener("change",d),()=>c.removeEventListener("change",d)},[t]);const o=a.useCallback(c=>{s(c),r(Wt(c));try{localStorage.setItem("theme",c)}catch{}},[]),i=a.useCallback(()=>{s(c=>{const d=c==="dark"?"light":c==="light"?"system":"dark";r(Wt(d));try{localStorage.setItem("theme",d)}catch{}return d})},[]);return{theme:n,preference:t,setPreference:o,cycleTheme:i,isDark:n==="dark"}}function ct({label:t,description:s,checked:n,disabled:r,onChange:o,extra:i}){return e.jsxs("label",{className:"flex justify-between items-center cursor-pointer",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:t}),e.jsx("div",{className:"text-[11px] text-text-muted",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i,e.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:c=>o(c.target.checked),className:"w-5 h-5 accent-accent"})]})]})}function Nr({onPrefChange:t}){const[s,n]=cr(),r=(o,i)=>{n({[o]:i}),t==null||t(o,i)};return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ls,{size:15})," Notifications"]}),description:"Master toggle for all alerts",checked:s.globalEnabled,onChange:o=>r("globalEnabled",o)}),s.globalEnabled&&e.jsx("div",{className:"border-t border-border-subtle my-0.5"}),s.globalEnabled&&e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(at,{size:15})," Browser Notifications"]}),description:"Desktop alerts when tab is inactive",checked:s.browserNotifications,onChange:o=>r("browserNotifications",o)}),s.globalEnabled&&s.browserNotifications&&e.jsxs("div",{className:"ml-5 pl-3 border-l-2 border-border-subtle flex flex-col gap-2",children:[e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(An,{size:15})," Completion Alerts"]}),description:"Notify when agent finishes a task",checked:s.completionAlert,onChange:o=>r("completionAlert",o)}),e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx($n,{size:15})," Approval Alerts"]}),description:"Notify when agent needs approval",checked:s.approvalAlert,onChange:o=>r("approvalAlert",o)}),e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(xt,{size:15})," Connection Alerts"]}),description:"Alert when a daemon disconnects",checked:s.disconnectAlert,onChange:o=>r("disconnectAlert",o)})]}),s.globalEnabled&&e.jsx("div",{className:"border-t border-border-subtle my-2"}),s.globalEnabled&&e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ut,{size:15})," Task Completion Bubble"]}),description:"Show a system message bubble in chat when an agent finishes a task",checked:s.chatTaskCompletionBubble,onChange:o=>r("chatTaskCompletionBubble",o)}),!s.globalEnabled&&e.jsx("p",{className:"text-[11px] text-text-muted italic",children:"All notifications are disabled. Enable the master toggle to configure individual alerts."})]})}function kr({ides:t,emptyMessage:s,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:o}){const i=t.filter(c=>c.type==="adhdev-daemon");return i.length===0?e.jsx(Qt,{icon:e.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-12 h-12 object-contain mx-auto opacity-90"}),title:"No machines connected",description:s||"Run 'adhdev-standalone' to connect a local daemon instance."}):e.jsx("div",{className:"flex flex-col gap-2",children:i.map(c=>e.jsx(Cr,{ide:c,allIdes:t,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:o},c.id))})}function xs({title:t,message:s,confirmLabel:n,confirmColor:r,onConfirm:o,onCancel:i}){const c=r==="red"?"bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30 hover:bg-amber-500/30";return on.createPortal(e.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",style:{zIndex:9999},onClick:i,children:e.jsxs("div",{className:"bg-bg-primary border border-border-subtle rounded-xl p-5 max-w-sm w-full mx-4 shadow-2xl",onClick:d=>d.stopPropagation(),children:[e.jsx("div",{className:"font-semibold text-sm mb-3",children:t}),e.jsx("div",{className:"text-xs text-text-muted leading-relaxed mb-5 whitespace-pre-line",children:s}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:i,className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-bg-secondary text-text-secondary border border-border-subtle hover:bg-bg-glass transition-colors",children:"Cancel"}),e.jsx("button",{onClick:o,className:`text-xs px-3 py-1.5 rounded-lg font-medium border transition-colors ${c}`,children:n})]})]})}),document.body)}function Sr(t){const s=t.replace(/^ide-/,"").replace(/-provider$/,"").toLowerCase(),r=[...Hs,...Us,...Ys].find(o=>o.id===s||s.includes(o.id)||o.id.includes(s));return r?{icon:r.icon,name:r.name}:{icon:"📝",name:t}}function Cr({ide:t,allIdes:s,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:o}){var b,ee;const[i,c]=a.useState("idle"),[d,u]=a.useState(""),[h,x]=a.useState(null),[l,g]=a.useState("idle"),[f,m]=a.useState(""),C=t,L=C.version||C.daemonVersion||null,v=((b=C.machine)==null?void 0:b.platform)||((ee=C.system)==null?void 0:ee.platform)||"",w=pt(C,{fallbackId:t.id}),W=v==="win32"?"🪟":v==="darwin"?"🍎":"🐧",z=s.filter(q=>q.daemonId===t.id&&q.id.includes(":ide:")),R=s.filter(q=>q.daemonId===t.id&&q.id.includes(":cli:")),j=s.filter(q=>q.daemonId===t.id&&q.id.includes(":acp:")),O=C.p2p,M=async()=>{var q,H,Y;if(n){c("upgrading"),u("Installing latest version...");try{const G=await n(t.id,"daemon_upgrade",{});(q=G==null?void 0:G.result)!=null&&q.upgraded||(H=G==null?void 0:G.result)!=null&&H.success?(c("done"),u(`Upgraded to v${G.result.version||"latest"}. Daemon is restarting...`)):(c("error"),u(((Y=G==null?void 0:G.result)==null?void 0:Y.error)||"Upgrade failed"))}catch(G){c("error"),u((G==null?void 0:G.message)||"Connection lost during upgrade")}}},P=async()=>{if(x(null),!!r){g("loading");try{await r(t.id),g("done"),m("Machine disconnected.")}catch(q){g("error"),m((q==null?void 0:q.message)||"Failed to disconnect")}}},se=async()=>{if(x(null),!!o){g("loading");try{await o(t.id),g("done"),m('Token revoked. Machine must restart "adhdev-standalone" to reconnect.')}catch(q){g("error"),m((q==null?void 0:q.message)||"Failed to revoke token")}}},y="0.6.75",F=!L||L!==y,U=z.length+R.length+j.length;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-bg-glass rounded-lg px-4 py-3 border border-border-subtle",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xl",children:W}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:w}),e.jsxs("div",{className:"text-xs text-text-muted font-mono flex items-center gap-2",children:[e.jsxs("span",{children:[t.id.substring(0,12),"…"]}),L&&e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${F?"bg-amber-500/15 text-amber-400":"bg-bg-secondary"}`,children:["v",L,!F&&" ✓"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&F&&e.jsx("button",{onClick:M,disabled:i==="upgrading"||i==="done",className:"btn btn-sm btn-primary disabled:opacity-50 disabled:cursor-not-allowed",title:`Update to v${y}`,children:i==="upgrading"?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"animate-spin",children:"⟳"})," Upgrading..."]}):i==="done"?"✓ Updated":`↑ Update${` to v${y}`}`}),r&&e.jsx("button",{onClick:()=>x("disconnect"),disabled:l==="loading",className:"btn btn-sm btn-warning disabled:opacity-50 disabled:cursor-not-allowed",title:"Disconnect this machine",children:"Disconnect"}),o&&e.jsx("button",{onClick:()=>x("revoke"),disabled:l==="loading",className:"btn btn-sm btn-danger disabled:opacity-50 disabled:cursor-not-allowed",title:"Remove machine (requires re-setup)",children:"Remove"}),e.jsx(jr,{status:t.status==="online"?"online":"error"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-2.5 pt-2.5 border-t border-border-subtle/50",children:[O&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${O.state==="connected"?"bg-green-400":O.state==="connecting"||O.state==="new"?"bg-amber-400 animate-pulse":"bg-text-muted/30"}`}),e.jsxs("span",{className:"text-text-muted",children:["P2P ",O.state==="connected"?"connected":O.state==="connecting"||O.state==="new"?"connecting...":O.state||"off"]}),O.peers!==void 0&&O.peers>0&&e.jsxs("span",{className:"text-text-muted/60",children:["(",O.peers," peer",O.peers!==1?"s":"",")"]})]}),O&&U>0&&e.jsx("span",{className:"text-border-subtle",children:"·"}),U>0?e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[z.map(q=>{const H=Sr(q.type),Y=q.cdpConnected;return e.jsxs("span",{className:"flex items-center gap-1 bg-bg-secondary px-1.5 py-0.5 rounded",children:[e.jsx("span",{children:H.icon}),e.jsx("span",{children:H.name}),Y!==void 0&&e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Y?"bg-green-400":"bg-amber-400 animate-pulse"}`,title:Y?"CDP connected":"CDP connecting..."})]},q.id)}),R.map(q=>e.jsxs("span",{className:"flex items-center gap-1 bg-bg-secondary px-1.5 py-0.5 rounded",children:[e.jsx("span",{children:"⌨️"}),e.jsx("span",{children:q.cliName||"CLI"})]},q.id)),j.map(q=>e.jsxs("span",{className:"flex items-center gap-1 bg-bg-secondary px-1.5 py-0.5 rounded",children:[e.jsx("span",{children:"🔗"}),e.jsx("span",{children:q.cliName||"ACP"})]},q.id))]}):e.jsx("span",{className:"text-[11px] text-text-muted/60 italic",children:"No IDEs connected"})]}),(d||f)&&e.jsx("div",{className:`text-xs mt-2 px-1 ${i==="error"||l==="error"?"text-red-400":i==="done"||l==="done"?"text-green-400":"text-text-muted"}`,children:f||d})]}),h==="disconnect"&&e.jsx(xs,{title:"🔌 Disconnect Machine",message:`Disconnect "${w}" from ADHDev?
|
|
40
40
|
|
|
41
41
|
This will close the server connection. The daemon process will continue running on the machine and will automatically reconnect.
|
|
42
42
|
|
|
@@ -73,4 +73,4 @@ This will disconnect CDP and optionally kill the process.`))try{const p=await n(
|
|
|
73
73
|
from { opacity: 0; transform: translateX(40px); }
|
|
74
74
|
to { opacity: 1; transform: translateX(0); }
|
|
75
75
|
}
|
|
76
|
-
`})]})}function da(){const[t,s]=a.useState({ide:[],cli:[],ext:[],acp:[]}),[n,r]=a.useState(!0);a.useEffect(()=>{fetch("https://raw.githubusercontent.com/vilmire/adhdev-providers/main/registry.json").then(c=>c.json()).then(c=>{const d=[],u=[],h=[],x=[];Object.values(c.providers||{}).forEach(g=>{const f={name:g.name||"Unknown",status:g.status||"Stable",details:g.details||"Community Provider"};g.category==="ide"?d.push(f):g.category==="cli"?u.push(f):g.category==="extension"?h.push(f):g.category==="acp"&&x.push(f)});const l=(g,f)=>{const m={Stable:1,Beta:2,WIP:3},C=m[g.status]||99,L=m[f.status]||99;return C!==L?C-L:g.name.localeCompare(f.name)};s({ide:d.sort(l),cli:u.sort(l),ext:h.sort(l),acp:x.sort(l)})}).catch(c=>console.error("Failed to load capabilities:",c)).finally(()=>r(!1))},[]);const o=c=>c==="Stable"?e.jsxs("div",{className:"flex items-center gap-1.5 text-success",children:[e.jsx(Es,{className:"w-4 h-4"})," ",e.jsx("span",{children:"Stable"})]}):c==="Beta"?e.jsxs("div",{className:"flex items-center gap-1.5 text-warning",children:[e.jsx(Jt,{className:"w-4 h-4"})," ",e.jsx("span",{children:"Beta"})]}):e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted",children:[e.jsx(_s,{className:"w-4 h-4"})," ",e.jsx("span",{children:c})]}),i=c=>e.jsx("div",{className:"bg-bg-card border border-border-subtle rounded-xl overflow-hidden",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-bg-secondary border-b border-border-subtle text-xs uppercase text-text-muted font-medium tracking-wider",children:[e.jsx("th",{className:"py-3 px-4 w-1/3",children:"Target"}),e.jsx("th",{className:"py-3 px-4 w-1/4",children:"Status"}),e.jsx("th",{className:"py-3 px-4",children:"Details"})]})}),e.jsx("tbody",{className:"divide-y divide-border-subtle text-sm",children:c.map((d,u)=>e.jsxs("tr",{className:"hover:bg-bg-subtle/50 transition-colors",children:[e.jsx("td",{className:"py-3 px-4 font-medium text-text-main",children:d.name}),e.jsx("td",{className:"py-3 px-4",children:o(d.status)}),e.jsx("td",{className:"py-3 px-4 text-text-muted",children:d.details})]},u))})]})});return n?e.jsx(_t,{title:"Capabilities",subtitle:"Provider registry coverage for IDEs, CLI agents, extensions, and ACPs",icon:e.jsx(wt,{}),widthClassName:"max-w-5xl",children:e.jsx(Qt,{icon:e.jsx("div",{className:"w-8 h-8 border-4 border-accent border-t-transparent rounded-full animate-spin mx-auto"}),title:"Loading provider registry",description:"Fetching the latest support matrix from the shared provider registry."})}):e.jsxs(_t,{title:"Capabilities",subtitle:"Provider registry coverage for IDEs, CLI agents, extensions, and ACPs",icon:e.jsx(wt,{}),widthClassName:"max-w-5xl",contentClassName:"animate-fade-in",children:[e.jsx(De,{title:"Registry overview",description:"Support status is loaded from the shared provider registry used across OSS and cloud surfaces.",children:e.jsxs("div",{className:"grid gap-3 md:grid-cols-4",children:[e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted mb-1",children:"IDEs"}),e.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:t.ide.length})]}),e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted mb-1",children:"CLI"}),e.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:t.cli.length})]}),e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted mb-1",children:"Extensions"}),e.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:t.ext.length})]}),e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted mb-1",children:"ACP"}),e.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:t.acp.length})]})]})}),e.jsx(De,{title:"IDE support",icon:e.jsx(at,{className:"w-4 h-4"}),description:"Desktop editors and IDE surfaces with registry-backed providers.",children:i(t.ide)}),e.jsx(De,{title:"Standalone CLI agents",icon:e.jsx(Zt,{className:"w-4 h-4"}),description:"CLI-first agents that can participate in the standalone dashboard.",children:i(t.cli)}),e.jsx(De,{title:"AI extensions",icon:e.jsx(xt,{className:"w-4 h-4"}),description:"IDE extensions and companion integrations available in the registry.",children:i(t.ext)}),e.jsx(De,{title:`ACP agents (${t.acp.length} loaded)`,icon:e.jsx(xt,{className:"w-4 h-4"}),description:"ACP-backed providers discovered through the same shared registry.",children:i(t.acp)})]})}class ua{constructor(){Ee(this,"adapters",new Map);Ee(this,"states",new Map);Ee(this,"ptyCallbacks",new Set);Ee(this,"screenshotCallbacks",new Map);Ee(this,"statusCallbacks",new Set)}resolveDaemonId(s){if(this.adapters.has(s))return s;if(s.startsWith("standalone")){for(const n of this.adapters.keys())if(n.startsWith("standalone"))return n}return null}register(s,n){this.adapters.set(s,n),this.states.set(s,n.connectionState)}unregister(s){this.adapters.delete(s),this.states.delete(s)}setState(s,n){this.states.set(s,n)}retryConnection(s){}get(s){const n=this.resolveDaemonId(s);return n?this.adapters.get(n):void 0}getState(s){const n=this.resolveDaemonId(s);return n&&this.states.get(n)||"disconnected"}sendData(s,n){return!1}sendPtyInput(s,n,r){return!1}sendPtyResize(s,n,r,o){return!1}async requestChatHistory(s,n,r,o,i){return{messages:[],hasMore:!1}}onScreenshot(s,n){return this.screenshotCallbacks.set(s,n),()=>{this.screenshotCallbacks.delete(s)}}emitScreenshot(s,n){this.screenshotCallbacks.forEach(r=>r(s,n))}onStatus(s){return this.statusCallbacks.add(s),()=>{this.statusCallbacks.delete(s)}}emitStatus(s,n){this.statusCallbacks.forEach(r=>r(s,n))}onPtyOutput(s){return this.ptyCallbacks.add(s),()=>{this.ptyCallbacks.delete(s)}}emitPtyOutput(s,n){this.ptyCallbacks.forEach(r=>r(s,n))}}const Ze=new ua;function xa(){if(typeof window>"u")return"ws://localhost:3847/ws";const s=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,r=new URLSearchParams(window.location.search).get("token");return r?`${s}?token=${encodeURIComponent(r)}`:s}const ys=xa(),js=3e3,pa=3e4;let Qe=null,ma=0;const Rt=new Map;let it=null,jt=null;async function $t(t,s,n){const r=Qe;if(r&&r.readyState===WebSocket.OPEN){const i=`req_${++ma}_${Date.now()}`;return new Promise((c,d)=>{const u=setTimeout(()=>{Rt.delete(i),d(new Error(`WS command timeout: ${s}`))},3e4);Rt.set(i,{resolve:h=>{clearTimeout(u),c(h)},reject:h=>{clearTimeout(u),d(h)}}),r.send(JSON.stringify({type:"command",requestId:i,data:{type:s,payload:n||{},target:t}}))})}const o=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s,payload:n||{},target:t})});if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.json()}class ha{constructor(s){Ee(this,"daemonId");Ee(this,"screenshotIdeType",null);this.daemonId=s}get hasCommandChannel(){return(Qe==null?void 0:Qe.readyState)===WebSocket.OPEN}get connectionState(){return(Qe==null?void 0:Qe.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(s,n){return $t(this.daemonId,s,n)}async sendInput(s,n){const r=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId;return $t(r,"cdp_remote_action",{action:s,params:n})}startScreenshots(s){this.screenshotIdeType=s||null,it&&(clearInterval(it),it=null);const n=async()=>{if(this.hasCommandChannel)try{const r=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId,o=await $t(r,"screenshot",{width:1280});if(o!=null&&o.success&&(o!=null&&o.base64)){const i=await fetch(`data:image/jpeg;base64,${o.base64}`).then(c=>c.blob());Ze.emitScreenshot(this.daemonId,i)}}catch{}};n(),it=setInterval(n,2e3)}stopScreenshots(s){it&&(clearInterval(it),it=null)}}let nt=null;function fa(t){return(!nt||nt.daemonId!==t)&&(nt=new ha(t)),nt}function ga({children:t}){const s=a.useRef(ns()),n=ns();s.current=n;const{setUserName:r}=vt(),o=a.useRef(r);o.current=r;const[,i]=a.useState("disconnected"),c=a.useCallback((l,g)=>{i(l),jt==null||jt(l,g)},[]),d=a.useRef(null),u=a.useRef(),h=a.useRef(js),x=a.useRef(!0);return a.useEffect(()=>{x.current=!0;function l(){var m,C;if(!x.current||((m=d.current)==null?void 0:m.readyState)===WebSocket.OPEN||((C=d.current)==null?void 0:C.readyState)===WebSocket.CONNECTING)return;c("connecting"),console.log(`[Standalone WS] Connecting to ${ys}...`);let f;try{f=new WebSocket(ys)}catch(L){console.error("[Standalone WS] Failed to create WebSocket:",L),g();return}d.current=f,f.onopen=()=>{if(!x.current){f.close();return}c("connected"),h.current=js,console.log("[Standalone WS] Connected")},Qe=f,f.onmessage=L=>{var v;try{const w=JSON.parse(L.data);if((w.type==="command_result"||w.type==="error")&&w.requestId){const W=Rt.get(w.requestId);W&&(Rt.delete(w.requestId),w.type==="error"?W.reject(new Error(((v=w.data)==null?void 0:v.message)||"Command failed")):W.resolve(w.data));return}if(w.type==="pty_output"){Ze.emitPtyOutput(w.cliId,w.data);return}if(w.type==="status"||w.type==="initial_state"){const W=w.data;if(!W)return;const{injectEntries:z,markLoaded:R}=s.current,j=W.id||"standalone",O=fa(j);Ze.register(j,O),Ze.setState(j,"connected"),c("connected",j),Ze.emitStatus(j,W);const M=sr(W,{daemonId:j});M.length>0&&z(M),R(),W.userName&&o.current&&o.current(W.userName)}}catch(w){console.error("[Standalone WS] Parse error:",w)}},f.onclose=()=>{x.current&&(nt&&Ze.setState(nt.daemonId,"disconnected"),c("disconnected"),d.current=null,g())},f.onerror=L=>{console.warn("[Standalone WS] Error, will reconnect:",L)}}function g(){if(!x.current)return;clearTimeout(u.current);const f=h.current;console.log(`[Standalone WS] Reconnecting in ${f}ms...`),u.current=setTimeout(()=>{h.current=Math.min(h.current*1.5,pa),l()},f)}return l(),()=>{x.current=!1,clearTimeout(u.current),d.current&&(d.current.onclose=null,d.current.close(),d.current=null,Qe=null),nt&&Ze.unregister(nt.daemonId)}},[]),e.jsx(e.Fragment,{children:t})}function ba({children:t}){const[s,n]=a.useState("disconnected"),[r,o]=a.useState(null);a.useEffect(()=>(jt=(c,d)=>{n(c),d&&o(d)},()=>{jt=null}),[]);const i=a.useMemo(()=>{const c=s==="connected",d={};return r&&(d[r]=c?"connected":"connecting"),d.standalone=c?"connected":"connecting",{wsStatus:s,isConnected:c,connectionStates:d}},[s,r]);return e.jsx(gn,{connectionOverrides:i,children:e.jsx(ga,{children:t})})}const ya=[{id:"dashboard",path:"/dashboard",icon:e.jsx(Is,{}),label:"Dashboard"},{id:"capabilities",path:"/capabilities",icon:e.jsx(wt,{}),label:"Capabilities"},{id:"machine",path:"/machines",icon:e.jsx(Ms,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:e.jsx(Gt,{}),label:"Settings"}];function ja({children:t}){const s=kt(),n=ln(),[r,o]=a.useState(!1),[i,c]=a.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),d=x=>{s(x),o(!1)},u=()=>{c(x=>{const l=!x;try{localStorage.setItem("sidebar-collapsed",l?"1":"0")}catch{}return l})},h=x=>`nav-item${n.pathname.startsWith(x)?" active":""} cursor-pointer ${i?"justify-center py-2.5 px-0":""}`;return e.jsxs("div",{className:`app-layout${r?" mobile-menu-open":""}${i?" sidebar-collapsed":""}`,children:[e.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>o(!0),children:[e.jsx("span",{className:"mobile-menu-icon"}),e.jsx("span",{className:"mobile-menu-icon"}),e.jsx("span",{className:"mobile-menu-icon"})]}),r&&e.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>o(!1),onKeyDown:x=>x.key==="Escape"&&o(!1)}),e.jsxs("aside",{className:`sidebar ${r?"sidebar-open":""}`,children:[e.jsxs("div",{className:"sidebar-header",children:[e.jsxs("div",{className:`sidebar-logo ${i?"justify-center gap-0":""}`,children:[e.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!i&&e.jsx("span",{children:"ADHDev"})]}),e.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>o(!1),children:"✕"})]}),e.jsx("nav",{className:"sidebar-nav",children:ya.map(x=>e.jsxs("div",{className:h(x.path),id:`nav-${x.id}`,onClick:()=>d(x.path),title:i?x.label:void 0,children:[e.jsx("span",{className:"nav-icon",children:x.icon}),!i&&x.label]},x.id))}),e.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[e.jsxs("div",{className:`nav-item cursor-pointer ${i?"justify-center py-2.5 px-0":""}`,id:"nav-docs",onClick:()=>window.open("https://docs.adhf.dev","_blank"),title:i?"Docs":void 0,children:[e.jsx("span",{className:"nav-icon",children:e.jsx(wt,{})}),!i&&e.jsxs(e.Fragment,{children:["Docs",e.jsx("span",{className:"ml-auto text-[9px] text-text-muted",children:"↗"})]})]}),e.jsxs("div",{className:`nav-item cursor-pointer${n.pathname==="/about"?" active":""} ${i?"justify-center py-2.5 px-0":""}`,id:"nav-about",onClick:()=>s("/about"),title:i?"About":void 0,children:[e.jsx("span",{className:"nav-icon",children:e.jsx(Ts,{})}),!i&&"About"]}),!i&&e.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.6.74"]}),e.jsxs("div",{className:`nav-item cursor-pointer ${i?"justify-center py-2.5 px-0":"mt-1"}`,onClick:u,title:i?"Expand sidebar":"Collapse sidebar",children:[e.jsx("span",{className:"nav-icon text-base",children:i?"›":"‹"}),!i&&e.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),e.jsx("main",{className:"main-content relative",children:e.jsx("div",{className:"main-content-inner",children:t})})]})}const va=[{icon:e.jsx(Ms,{size:16}),title:"Local-first runtime",desc:"Everything stays on your machine and the browser only connects over localhost."},{icon:e.jsx(ut,{size:16}),title:"Agent chat relay",desc:"Read and respond to AI conversations in real time across connected IDEs."},{icon:e.jsx($s,{size:16}),title:"Live screenshots",desc:"View your IDE directly in the browser through the local screenshot stream."},{icon:e.jsx(at,{size:16}),title:"Remote control",desc:"Click, type, and steer your IDE sessions without switching windows."},{icon:e.jsx(xt,{size:16}),title:"Multi-IDE support",desc:"Monitor VS Code, Cursor, Windsurf, and extension-based agents in one place."},{icon:e.jsx(wt,{size:16}),title:"CLI and ACP coverage",desc:"Track standalone CLI agents and ACP-backed workflows alongside IDE sessions."}],wa=[{icon:e.jsx(Rs,{size:16}),title:"Access from anywhere",desc:"Reach your burrows from another laptop or phone without opening local ports."},{icon:e.jsx(Is,{size:16}),title:"Low-latency P2P stream",desc:"Cloud adds the WebRTC path for faster screenshots and remote control."},{icon:e.jsx(Ls,{size:16}),title:"Mobile notifications",desc:"Get approval prompts and activity updates when you are away from your desk."},{icon:e.jsx(kn,{size:16}),title:"REST API access",desc:"Integrate with Slack, CI, or internal tools using API keys and service routes."},{icon:e.jsx(wn,{size:16}),title:"Team workspace",desc:"Share burrows, activity views, and policies across a team workspace."},{icon:e.jsx(Es,{size:16}),title:"Enterprise controls",desc:"SSO, RBAC, audit logs, and managed policy features for production teams."}],Na=[{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 and CLI agents",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 and 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}];function ka(){return e.jsxs(_t,{icon:e.jsx(Ts,{className:"text-text-primary"}),title:"About",subtitle:"Self-hosted ADHDev overview, supported surfaces, and what changes in Cloud",widthClassName:"max-w-5xl",actions:e.jsxs("div",{className:"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.6.74"]}),children:[e.jsx(De,{children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"max-w-2xl",children:[e.jsx("div",{className:"text-[11px] font-semibold tracking-[0.18em] uppercase text-emerald-400 mb-2",children:"Self-hosted edition"}),e.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-text-primary mb-2",children:"Keep the same dashboard experience, with the runtime fully on-device."}),e.jsx("p",{className:"text-sm text-text-muted leading-relaxed",children:"Standalone keeps the browser, daemon, screenshots, and control path on your own machine. It is the same core product shape as cloud, just without the remote networking and team layers."})]}),e.jsxs("div",{className:"grid gap-2 min-w-[220px]",children:[e.jsx("a",{href:"https://docs.adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex justify-center no-underline",children:"Docs ↗"}),e.jsx("a",{href:"https://github.com/vilmire/adhdev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex justify-center no-underline",children:"GitHub ↗"}),e.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm inline-flex justify-center no-underline",children:"Try Cloud ↗"})]})]})}),e.jsx(De,{title:"Included in standalone",description:"The local-first feature set available without the cloud control plane.",children:e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:va.map(t=>e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-4 transition-colors hover:border-border-default",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-text-primary mb-2",children:[e.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-accent/10 text-accent-light",children:t.icon}),t.title]}),e.jsx("p",{className:"text-[13px] leading-relaxed text-text-muted",children:t.desc})]},t.title))})}),e.jsx(De,{title:"Compatible with",description:"Supported editors and agent surfaces exposed in the standalone dashboard.",children:e.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:[{label:"IDEs",items:Hs.map(t=>`${t.icon} ${t.name}`)},{label:"Extensions",items:Ys.map(t=>`${t.icon} ${t.name}`)},{label:"CLI agents",items:Us.map(t=>`${t.icon} ${t.name}`)}].map(t=>e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-4",children:[e.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-3 uppercase",children:t.label}),e.jsx("div",{className:"flex flex-col gap-1.5",children:t.items.map(s=>e.jsx("div",{className:"rounded-md border border-border-subtle bg-bg-card px-2.5 py-1.5 text-[12px] text-text-secondary",children:s},s))})]},t.label))})}),e.jsx(De,{title:"Cloud-only extras",description:"Capabilities that need the hosted control plane or team infrastructure.",children:e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:wa.map(t=>e.jsxs("div",{className:"rounded-xl border border-violet-500/20 bg-violet-500/[0.04] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-text-primary mb-2",children:[e.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-violet-500/10 text-violet-400",children:t.icon}),t.title]}),e.jsx("p",{className:"text-[13px] leading-relaxed text-text-muted",children:t.desc})]},t.title))})}),e.jsx(De,{title:"Self-hosted vs Cloud",description:"The product split at a glance.",children:e.jsx("div",{className:"overflow-x-auto rounded-xl border border-border-subtle",children:e.jsxs("table",{className:"w-full text-[13px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-bg-secondary",children:[e.jsx("th",{className:"text-left px-4 py-3 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),e.jsx("th",{className:"text-center px-4 py-3 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[110px]",children:"Selfhost"}),e.jsx("th",{className:"text-center px-4 py-3 font-semibold text-violet-400 text-[11px] uppercase tracking-wider w-[110px]",children:"Cloud"})]})}),e.jsx("tbody",{children:Na.map((t,s)=>e.jsxs("tr",{className:s%2===0?"bg-bg-glass":"bg-transparent",children:[e.jsx("td",{className:"px-4 py-2.5 text-text-secondary",children:t.feature}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:t.selfhost?e.jsx("span",{className:"text-emerald-500",children:"✓"}):e.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("span",{className:"text-emerald-500",children:"✓"})})]},t.feature))})]})})}),e.jsx(Qt,{icon:e.jsx("img",{src:"/otter-logo.png",alt:"",className:"mx-auto h-12 w-12 opacity-80"}),title:"Cloud is optional, not required",description:"You can stay fully local in standalone, and move to cloud later without changing how you use the dashboard.",action:e.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[e.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm no-underline",children:"Compare Cloud ↗"}),e.jsxs("a",{href:"https://discord.gg/WJD3tCfBzk",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm no-underline",children:[e.jsx(Rn,{size:14,className:"mr-1"}),"Discord ↗"]})]})})]})}function Sa(){const{ides:t}=vt(),s=t.find(l=>l.type==="adhdev-daemon"),n=(s==null?void 0:s.detectedIdes)||[],{sendCommand:r}=rt(),{userName:o}=vt(),[i,c]=a.useState(o||"");a.useEffect(()=>{o!==void 0&&c(o)},[o]);const d=l=>{const g=l.target.value.trim();s!=null&&s.id&&g!==o&&r(s.id,"set_user_name",{userName:g}).catch(console.error)},[u,h]=a.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),x=l=>{h(l);try{localStorage.setItem("adhdev_sound",l?"1":"0")}catch{}};return e.jsxs(_t,{icon:e.jsx(Gt,{className:"text-text-primary"}),title:"Settings",subtitle:"Local daemon configuration, appearance, and on-device preferences",widthClassName:"max-w-5xl",children:[e.jsx(gr,{variant:"info",children:"Standalone settings stay on this machine. The browser only talks to your local daemon over localhost."}),e.jsx(De,{title:"Daemon",description:"Connection health and local endpoints for the self-hosted runtime.",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-x-4 gap-y-2.5 text-sm",children:[e.jsx("span",{className:"text-text-muted",children:"Version"}),e.jsxs("span",{className:"font-mono text-xs",children:["v","0.6.74"]}),e.jsx("span",{className:"text-text-muted",children:"Status"}),e.jsx("span",{className:s?"text-green-400":"text-yellow-400",children:s?"● Running":"○ Not connected"}),e.jsx("span",{className:"text-text-muted",children:"WebSocket"}),e.jsx("span",{className:"font-mono text-xs",children:"ws://localhost:19222"}),e.jsx("span",{className:"text-text-muted",children:"HTTP"}),e.jsx("span",{className:"font-mono text-xs",children:"http://localhost:19280"})]})}),e.jsx(De,{title:"Detected IDEs",description:"Editors discovered by the local daemon on this machine.",children:n.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:"No IDEs detected. Start an IDE to see it here."}):e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(l=>e.jsxs("div",{className:"flex justify-between items-center bg-bg-glass rounded-lg px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${l.running?"bg-green-400":"bg-text-muted/30"}`}),e.jsx("span",{className:"text-sm font-medium",children:l.name})]}),e.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:l.type})]},l.type))})}),e.jsx(De,{title:"Machine",description:"The local burrow exposed by your standalone daemon.",children:e.jsx(kr,{ides:t,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),e.jsx(De,{title:"Appearance",description:"Match the rest of the dashboard with a single place for mode, theme, and accent.",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-text-muted mb-2 font-medium",children:"Mode"}),e.jsx(Mr,{})]}),e.jsxs("div",{className:"border-t border-border-subtle pt-4",children:[e.jsx("div",{className:"text-xs text-text-muted mb-1 font-medium",children:"Theme"}),e.jsx("p",{className:"text-[11px] text-text-muted mb-3",children:"Choose a preset or create a custom surface and chat palette for the standalone UI."}),e.jsx(Rr,{})]}),e.jsxs("div",{className:"border-t border-border-subtle pt-4",children:[e.jsx("div",{className:"text-xs text-text-muted mb-1 font-medium",children:"Accent color override"}),e.jsx("p",{className:"text-[11px] text-text-muted mb-3",children:"Override preset accents without changing your full theme definition."}),e.jsx(Or,{})]})]})}),e.jsx(De,{title:"Notifications",description:"Browser prompts and local sound cues for agent activity.",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Nr,{}),e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(_n,{size:15})," Sound Effects"]}),description:"Play a sound when agent completes or needs approval",checked:u,onChange:x})]})}),e.jsx(De,{title:"Profile",description:"How your name appears in local chat threads and dashboard views.",children:e.jsx("div",{className:"flex flex-col gap-3",children:e.jsxs("div",{className:"flex items-center justify-between px-3.5 py-4 bg-bg-glass rounded-xl border border-border-subtle hover:border-border-default transition-colors",children:[e.jsxs("div",{className:"flex flex-col gap-1 pr-4 max-w-[500px]",children:[e.jsxs("span",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Nn,{size:16,className:"text-text-secondary"})," Display Name"]}),e.jsx("span",{className:"text-[12px] text-text-muted leading-relaxed",children:"Your name shown in chat threads and on the team dashboard."})]}),e.jsx("input",{type:"text",className:"bg-bg-primary border border-border-strong rounded-lg px-3 py-1.5 text-sm w-48 text-right focus:border-accent focus:outline-none transition-colors",placeholder:"Anonymous",value:i,onChange:l=>c(l.target.value),onBlur:d,onKeyDown:l=>{l.key==="Enter"&&l.currentTarget.blur()}})]})})})]})}$r();function vs(){const{ides:t}=vt(),s=t.find(n=>{var r;return n.daemonMode||((r=n.id)==null?void 0:r.startsWith("standalone"))});return s?e.jsx(Mt,{to:`/machines/${s.id}`,replace:!0}):t.length>0?e.jsx(Mt,{to:`/machines/${t[0].id}`,replace:!0}):e.jsx(Mt,{to:"/dashboard",replace:!0})}function Ca(){return e.jsx(dn,{children:e.jsx(ba,{children:e.jsx(vn,{value:{sendCommand:$t,sendData:()=>!1},children:e.jsx(ja,{children:e.jsxs(un,{children:[e.jsx(Ge,{path:"/dashboard",element:e.jsx(Jr,{})}),e.jsx(Ge,{path:"/ide/:id",element:e.jsx(Qr,{})}),e.jsx(Ge,{path:"/machine",element:e.jsx(vs,{})}),e.jsx(Ge,{path:"/machines/:id",element:e.jsx(la,{})}),e.jsx(Ge,{path:"/machines",element:e.jsx(vs,{})}),e.jsx(Ge,{path:"/capabilities",element:e.jsx(da,{})}),e.jsx(Ge,{path:"/about",element:e.jsx(ka,{})}),e.jsx(Ge,{path:"/settings",element:e.jsx(Sa,{})}),e.jsx(Ge,{path:"*",element:e.jsx(Mt,{to:"/dashboard",replace:!0})})]})})})})})}Un({connectionManager:Ze,p2pManager:Ze});xn(document.getElementById("root")).render(e.jsx(a.StrictMode,{children:e.jsx(Ca,{})}));
|
|
76
|
+
`})]})}function da(){const[t,s]=a.useState({ide:[],cli:[],ext:[],acp:[]}),[n,r]=a.useState(!0);a.useEffect(()=>{fetch("https://raw.githubusercontent.com/vilmire/adhdev-providers/main/registry.json").then(c=>c.json()).then(c=>{const d=[],u=[],h=[],x=[];Object.values(c.providers||{}).forEach(g=>{const f={name:g.name||"Unknown",status:g.status||"Stable",details:g.details||"Community Provider"};g.category==="ide"?d.push(f):g.category==="cli"?u.push(f):g.category==="extension"?h.push(f):g.category==="acp"&&x.push(f)});const l=(g,f)=>{const m={Stable:1,Beta:2,WIP:3},C=m[g.status]||99,L=m[f.status]||99;return C!==L?C-L:g.name.localeCompare(f.name)};s({ide:d.sort(l),cli:u.sort(l),ext:h.sort(l),acp:x.sort(l)})}).catch(c=>console.error("Failed to load capabilities:",c)).finally(()=>r(!1))},[]);const o=c=>c==="Stable"?e.jsxs("div",{className:"flex items-center gap-1.5 text-success",children:[e.jsx(Es,{className:"w-4 h-4"})," ",e.jsx("span",{children:"Stable"})]}):c==="Beta"?e.jsxs("div",{className:"flex items-center gap-1.5 text-warning",children:[e.jsx(Jt,{className:"w-4 h-4"})," ",e.jsx("span",{children:"Beta"})]}):e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted",children:[e.jsx(_s,{className:"w-4 h-4"})," ",e.jsx("span",{children:c})]}),i=c=>e.jsx("div",{className:"bg-bg-card border border-border-subtle rounded-xl overflow-hidden",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-bg-secondary border-b border-border-subtle text-xs uppercase text-text-muted font-medium tracking-wider",children:[e.jsx("th",{className:"py-3 px-4 w-1/3",children:"Target"}),e.jsx("th",{className:"py-3 px-4 w-1/4",children:"Status"}),e.jsx("th",{className:"py-3 px-4",children:"Details"})]})}),e.jsx("tbody",{className:"divide-y divide-border-subtle text-sm",children:c.map((d,u)=>e.jsxs("tr",{className:"hover:bg-bg-subtle/50 transition-colors",children:[e.jsx("td",{className:"py-3 px-4 font-medium text-text-main",children:d.name}),e.jsx("td",{className:"py-3 px-4",children:o(d.status)}),e.jsx("td",{className:"py-3 px-4 text-text-muted",children:d.details})]},u))})]})});return n?e.jsx(_t,{title:"Capabilities",subtitle:"Provider registry coverage for IDEs, CLI agents, extensions, and ACPs",icon:e.jsx(wt,{}),widthClassName:"max-w-5xl",children:e.jsx(Qt,{icon:e.jsx("div",{className:"w-8 h-8 border-4 border-accent border-t-transparent rounded-full animate-spin mx-auto"}),title:"Loading provider registry",description:"Fetching the latest support matrix from the shared provider registry."})}):e.jsxs(_t,{title:"Capabilities",subtitle:"Provider registry coverage for IDEs, CLI agents, extensions, and ACPs",icon:e.jsx(wt,{}),widthClassName:"max-w-5xl",contentClassName:"animate-fade-in",children:[e.jsx(De,{title:"Registry overview",description:"Support status is loaded from the shared provider registry used across OSS and cloud surfaces.",children:e.jsxs("div",{className:"grid gap-3 md:grid-cols-4",children:[e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted mb-1",children:"IDEs"}),e.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:t.ide.length})]}),e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted mb-1",children:"CLI"}),e.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:t.cli.length})]}),e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted mb-1",children:"Extensions"}),e.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:t.ext.length})]}),e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-text-muted mb-1",children:"ACP"}),e.jsx("div",{className:"text-2xl font-semibold text-text-primary",children:t.acp.length})]})]})}),e.jsx(De,{title:"IDE support",icon:e.jsx(at,{className:"w-4 h-4"}),description:"Desktop editors and IDE surfaces with registry-backed providers.",children:i(t.ide)}),e.jsx(De,{title:"Standalone CLI agents",icon:e.jsx(Zt,{className:"w-4 h-4"}),description:"CLI-first agents that can participate in the standalone dashboard.",children:i(t.cli)}),e.jsx(De,{title:"AI extensions",icon:e.jsx(xt,{className:"w-4 h-4"}),description:"IDE extensions and companion integrations available in the registry.",children:i(t.ext)}),e.jsx(De,{title:`ACP agents (${t.acp.length} loaded)`,icon:e.jsx(xt,{className:"w-4 h-4"}),description:"ACP-backed providers discovered through the same shared registry.",children:i(t.acp)})]})}class ua{constructor(){Ee(this,"adapters",new Map);Ee(this,"states",new Map);Ee(this,"ptyCallbacks",new Set);Ee(this,"screenshotCallbacks",new Map);Ee(this,"statusCallbacks",new Set)}resolveDaemonId(s){if(this.adapters.has(s))return s;if(s.startsWith("standalone")){for(const n of this.adapters.keys())if(n.startsWith("standalone"))return n}return null}register(s,n){this.adapters.set(s,n),this.states.set(s,n.connectionState)}unregister(s){this.adapters.delete(s),this.states.delete(s)}setState(s,n){this.states.set(s,n)}retryConnection(s){}get(s){const n=this.resolveDaemonId(s);return n?this.adapters.get(n):void 0}getState(s){const n=this.resolveDaemonId(s);return n&&this.states.get(n)||"disconnected"}sendData(s,n){return!1}sendPtyInput(s,n,r){return!1}sendPtyResize(s,n,r,o){return!1}async requestChatHistory(s,n,r,o,i){return{messages:[],hasMore:!1}}onScreenshot(s,n){return this.screenshotCallbacks.set(s,n),()=>{this.screenshotCallbacks.delete(s)}}emitScreenshot(s,n){this.screenshotCallbacks.forEach(r=>r(s,n))}onStatus(s){return this.statusCallbacks.add(s),()=>{this.statusCallbacks.delete(s)}}emitStatus(s,n){this.statusCallbacks.forEach(r=>r(s,n))}onPtyOutput(s){return this.ptyCallbacks.add(s),()=>{this.ptyCallbacks.delete(s)}}emitPtyOutput(s,n){this.ptyCallbacks.forEach(r=>r(s,n))}}const Ze=new ua;function xa(){if(typeof window>"u")return"ws://localhost:3847/ws";const s=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,r=new URLSearchParams(window.location.search).get("token");return r?`${s}?token=${encodeURIComponent(r)}`:s}const ys=xa(),js=3e3,pa=3e4;let Qe=null,ma=0;const Rt=new Map;let it=null,jt=null;async function $t(t,s,n){const r=Qe;if(r&&r.readyState===WebSocket.OPEN){const i=`req_${++ma}_${Date.now()}`;return new Promise((c,d)=>{const u=setTimeout(()=>{Rt.delete(i),d(new Error(`WS command timeout: ${s}`))},3e4);Rt.set(i,{resolve:h=>{clearTimeout(u),c(h)},reject:h=>{clearTimeout(u),d(h)}}),r.send(JSON.stringify({type:"command",requestId:i,data:{type:s,payload:n||{},target:t}}))})}const o=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s,payload:n||{},target:t})});if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.json()}class ha{constructor(s){Ee(this,"daemonId");Ee(this,"screenshotIdeType",null);this.daemonId=s}get hasCommandChannel(){return(Qe==null?void 0:Qe.readyState)===WebSocket.OPEN}get connectionState(){return(Qe==null?void 0:Qe.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(s,n){return $t(this.daemonId,s,n)}async sendInput(s,n){const r=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId;return $t(r,"cdp_remote_action",{action:s,params:n})}startScreenshots(s){this.screenshotIdeType=s||null,it&&(clearInterval(it),it=null);const n=async()=>{if(this.hasCommandChannel)try{const r=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId,o=await $t(r,"screenshot",{width:1280});if(o!=null&&o.success&&(o!=null&&o.base64)){const i=await fetch(`data:image/jpeg;base64,${o.base64}`).then(c=>c.blob());Ze.emitScreenshot(this.daemonId,i)}}catch{}};n(),it=setInterval(n,2e3)}stopScreenshots(s){it&&(clearInterval(it),it=null)}}let nt=null;function fa(t){return(!nt||nt.daemonId!==t)&&(nt=new ha(t)),nt}function ga({children:t}){const s=a.useRef(ns()),n=ns();s.current=n;const{setUserName:r}=vt(),o=a.useRef(r);o.current=r;const[,i]=a.useState("disconnected"),c=a.useCallback((l,g)=>{i(l),jt==null||jt(l,g)},[]),d=a.useRef(null),u=a.useRef(),h=a.useRef(js),x=a.useRef(!0);return a.useEffect(()=>{x.current=!0;function l(){var m,C;if(!x.current||((m=d.current)==null?void 0:m.readyState)===WebSocket.OPEN||((C=d.current)==null?void 0:C.readyState)===WebSocket.CONNECTING)return;c("connecting"),console.log(`[Standalone WS] Connecting to ${ys}...`);let f;try{f=new WebSocket(ys)}catch(L){console.error("[Standalone WS] Failed to create WebSocket:",L),g();return}d.current=f,f.onopen=()=>{if(!x.current){f.close();return}c("connected"),h.current=js,console.log("[Standalone WS] Connected")},Qe=f,f.onmessage=L=>{var v;try{const w=JSON.parse(L.data);if((w.type==="command_result"||w.type==="error")&&w.requestId){const W=Rt.get(w.requestId);W&&(Rt.delete(w.requestId),w.type==="error"?W.reject(new Error(((v=w.data)==null?void 0:v.message)||"Command failed")):W.resolve(w.data));return}if(w.type==="pty_output"){Ze.emitPtyOutput(w.cliId,w.data);return}if(w.type==="status"||w.type==="initial_state"){const W=w.data;if(!W)return;const{injectEntries:z,markLoaded:R}=s.current,j=W.id||"standalone",O=fa(j);Ze.register(j,O),Ze.setState(j,"connected"),c("connected",j),Ze.emitStatus(j,W);const M=sr(W,{daemonId:j});M.length>0&&z(M),R(),W.userName&&o.current&&o.current(W.userName)}}catch(w){console.error("[Standalone WS] Parse error:",w)}},f.onclose=()=>{x.current&&(nt&&Ze.setState(nt.daemonId,"disconnected"),c("disconnected"),d.current=null,g())},f.onerror=L=>{console.warn("[Standalone WS] Error, will reconnect:",L)}}function g(){if(!x.current)return;clearTimeout(u.current);const f=h.current;console.log(`[Standalone WS] Reconnecting in ${f}ms...`),u.current=setTimeout(()=>{h.current=Math.min(h.current*1.5,pa),l()},f)}return l(),()=>{x.current=!1,clearTimeout(u.current),d.current&&(d.current.onclose=null,d.current.close(),d.current=null,Qe=null),nt&&Ze.unregister(nt.daemonId)}},[]),e.jsx(e.Fragment,{children:t})}function ba({children:t}){const[s,n]=a.useState("disconnected"),[r,o]=a.useState(null);a.useEffect(()=>(jt=(c,d)=>{n(c),d&&o(d)},()=>{jt=null}),[]);const i=a.useMemo(()=>{const c=s==="connected",d={};return r&&(d[r]=c?"connected":"connecting"),d.standalone=c?"connected":"connecting",{wsStatus:s,isConnected:c,connectionStates:d}},[s,r]);return e.jsx(gn,{connectionOverrides:i,children:e.jsx(ga,{children:t})})}const ya=[{id:"dashboard",path:"/dashboard",icon:e.jsx(Is,{}),label:"Dashboard"},{id:"capabilities",path:"/capabilities",icon:e.jsx(wt,{}),label:"Capabilities"},{id:"machine",path:"/machines",icon:e.jsx(Ms,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:e.jsx(Gt,{}),label:"Settings"}];function ja({children:t}){const s=kt(),n=ln(),[r,o]=a.useState(!1),[i,c]=a.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),d=x=>{s(x),o(!1)},u=()=>{c(x=>{const l=!x;try{localStorage.setItem("sidebar-collapsed",l?"1":"0")}catch{}return l})},h=x=>`nav-item${n.pathname.startsWith(x)?" active":""} cursor-pointer ${i?"justify-center py-2.5 px-0":""}`;return e.jsxs("div",{className:`app-layout${r?" mobile-menu-open":""}${i?" sidebar-collapsed":""}`,children:[e.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>o(!0),children:[e.jsx("span",{className:"mobile-menu-icon"}),e.jsx("span",{className:"mobile-menu-icon"}),e.jsx("span",{className:"mobile-menu-icon"})]}),r&&e.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>o(!1),onKeyDown:x=>x.key==="Escape"&&o(!1)}),e.jsxs("aside",{className:`sidebar ${r?"sidebar-open":""}`,children:[e.jsxs("div",{className:"sidebar-header",children:[e.jsxs("div",{className:`sidebar-logo ${i?"justify-center gap-0":""}`,children:[e.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!i&&e.jsx("span",{children:"ADHDev"})]}),e.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>o(!1),children:"✕"})]}),e.jsx("nav",{className:"sidebar-nav",children:ya.map(x=>e.jsxs("div",{className:h(x.path),id:`nav-${x.id}`,onClick:()=>d(x.path),title:i?x.label:void 0,children:[e.jsx("span",{className:"nav-icon",children:x.icon}),!i&&x.label]},x.id))}),e.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[e.jsxs("div",{className:`nav-item cursor-pointer ${i?"justify-center py-2.5 px-0":""}`,id:"nav-docs",onClick:()=>window.open("https://docs.adhf.dev","_blank"),title:i?"Docs":void 0,children:[e.jsx("span",{className:"nav-icon",children:e.jsx(wt,{})}),!i&&e.jsxs(e.Fragment,{children:["Docs",e.jsx("span",{className:"ml-auto text-[9px] text-text-muted",children:"↗"})]})]}),e.jsxs("div",{className:`nav-item cursor-pointer${n.pathname==="/about"?" active":""} ${i?"justify-center py-2.5 px-0":""}`,id:"nav-about",onClick:()=>s("/about"),title:i?"About":void 0,children:[e.jsx("span",{className:"nav-icon",children:e.jsx(Ts,{})}),!i&&"About"]}),!i&&e.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.6.75"]}),e.jsxs("div",{className:`nav-item cursor-pointer ${i?"justify-center py-2.5 px-0":"mt-1"}`,onClick:u,title:i?"Expand sidebar":"Collapse sidebar",children:[e.jsx("span",{className:"nav-icon text-base",children:i?"›":"‹"}),!i&&e.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),e.jsx("main",{className:"main-content relative",children:e.jsx("div",{className:"main-content-inner",children:t})})]})}const va=[{icon:e.jsx(Ms,{size:16}),title:"Local-first runtime",desc:"Everything stays on your machine and the browser only connects over localhost."},{icon:e.jsx(ut,{size:16}),title:"Agent chat relay",desc:"Read and respond to AI conversations in real time across connected IDEs."},{icon:e.jsx($s,{size:16}),title:"Live screenshots",desc:"View your IDE directly in the browser through the local screenshot stream."},{icon:e.jsx(at,{size:16}),title:"Remote control",desc:"Click, type, and steer your IDE sessions without switching windows."},{icon:e.jsx(xt,{size:16}),title:"Multi-IDE support",desc:"Monitor VS Code, Cursor, Windsurf, and extension-based agents in one place."},{icon:e.jsx(wt,{size:16}),title:"CLI and ACP coverage",desc:"Track standalone CLI agents and ACP-backed workflows alongside IDE sessions."}],wa=[{icon:e.jsx(Rs,{size:16}),title:"Access from anywhere",desc:"Reach your burrows from another laptop or phone without opening local ports."},{icon:e.jsx(Is,{size:16}),title:"Low-latency P2P stream",desc:"Cloud adds the WebRTC path for faster screenshots and remote control."},{icon:e.jsx(Ls,{size:16}),title:"Mobile notifications",desc:"Get approval prompts and activity updates when you are away from your desk."},{icon:e.jsx(kn,{size:16}),title:"REST API access",desc:"Integrate with Slack, CI, or internal tools using API keys and service routes."},{icon:e.jsx(wn,{size:16}),title:"Team workspace",desc:"Share burrows, activity views, and policies across a team workspace."},{icon:e.jsx(Es,{size:16}),title:"Enterprise controls",desc:"SSO, RBAC, audit logs, and managed policy features for production teams."}],Na=[{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 and CLI agents",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 and 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}];function ka(){return e.jsxs(_t,{icon:e.jsx(Ts,{className:"text-text-primary"}),title:"About",subtitle:"Self-hosted ADHDev overview, supported surfaces, and what changes in Cloud",widthClassName:"max-w-5xl",actions:e.jsxs("div",{className:"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.6.75"]}),children:[e.jsx(De,{children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"max-w-2xl",children:[e.jsx("div",{className:"text-[11px] font-semibold tracking-[0.18em] uppercase text-emerald-400 mb-2",children:"Self-hosted edition"}),e.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-text-primary mb-2",children:"Keep the same dashboard experience, with the runtime fully on-device."}),e.jsx("p",{className:"text-sm text-text-muted leading-relaxed",children:"Standalone keeps the browser, daemon, screenshots, and control path on your own machine. It is the same core product shape as cloud, just without the remote networking and team layers."})]}),e.jsxs("div",{className:"grid gap-2 min-w-[220px]",children:[e.jsx("a",{href:"https://docs.adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex justify-center no-underline",children:"Docs ↗"}),e.jsx("a",{href:"https://github.com/vilmire/adhdev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex justify-center no-underline",children:"GitHub ↗"}),e.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm inline-flex justify-center no-underline",children:"Try Cloud ↗"})]})]})}),e.jsx(De,{title:"Included in standalone",description:"The local-first feature set available without the cloud control plane.",children:e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:va.map(t=>e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-4 transition-colors hover:border-border-default",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-text-primary mb-2",children:[e.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-accent/10 text-accent-light",children:t.icon}),t.title]}),e.jsx("p",{className:"text-[13px] leading-relaxed text-text-muted",children:t.desc})]},t.title))})}),e.jsx(De,{title:"Compatible with",description:"Supported editors and agent surfaces exposed in the standalone dashboard.",children:e.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:[{label:"IDEs",items:Hs.map(t=>`${t.icon} ${t.name}`)},{label:"Extensions",items:Ys.map(t=>`${t.icon} ${t.name}`)},{label:"CLI agents",items:Us.map(t=>`${t.icon} ${t.name}`)}].map(t=>e.jsxs("div",{className:"rounded-xl border border-border-subtle bg-bg-glass px-4 py-4",children:[e.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-3 uppercase",children:t.label}),e.jsx("div",{className:"flex flex-col gap-1.5",children:t.items.map(s=>e.jsx("div",{className:"rounded-md border border-border-subtle bg-bg-card px-2.5 py-1.5 text-[12px] text-text-secondary",children:s},s))})]},t.label))})}),e.jsx(De,{title:"Cloud-only extras",description:"Capabilities that need the hosted control plane or team infrastructure.",children:e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:wa.map(t=>e.jsxs("div",{className:"rounded-xl border border-violet-500/20 bg-violet-500/[0.04] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-text-primary mb-2",children:[e.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-violet-500/10 text-violet-400",children:t.icon}),t.title]}),e.jsx("p",{className:"text-[13px] leading-relaxed text-text-muted",children:t.desc})]},t.title))})}),e.jsx(De,{title:"Self-hosted vs Cloud",description:"The product split at a glance.",children:e.jsx("div",{className:"overflow-x-auto rounded-xl border border-border-subtle",children:e.jsxs("table",{className:"w-full text-[13px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-bg-secondary",children:[e.jsx("th",{className:"text-left px-4 py-3 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),e.jsx("th",{className:"text-center px-4 py-3 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[110px]",children:"Selfhost"}),e.jsx("th",{className:"text-center px-4 py-3 font-semibold text-violet-400 text-[11px] uppercase tracking-wider w-[110px]",children:"Cloud"})]})}),e.jsx("tbody",{children:Na.map((t,s)=>e.jsxs("tr",{className:s%2===0?"bg-bg-glass":"bg-transparent",children:[e.jsx("td",{className:"px-4 py-2.5 text-text-secondary",children:t.feature}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:t.selfhost?e.jsx("span",{className:"text-emerald-500",children:"✓"}):e.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("span",{className:"text-emerald-500",children:"✓"})})]},t.feature))})]})})}),e.jsx(Qt,{icon:e.jsx("img",{src:"/otter-logo.png",alt:"",className:"mx-auto h-12 w-12 opacity-80"}),title:"Cloud is optional, not required",description:"You can stay fully local in standalone, and move to cloud later without changing how you use the dashboard.",action:e.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[e.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm no-underline",children:"Compare Cloud ↗"}),e.jsxs("a",{href:"https://discord.gg/WJD3tCfBzk",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm no-underline",children:[e.jsx(Rn,{size:14,className:"mr-1"}),"Discord ↗"]})]})})]})}function Sa(){const{ides:t}=vt(),s=t.find(l=>l.type==="adhdev-daemon"),n=(s==null?void 0:s.detectedIdes)||[],{sendCommand:r}=rt(),{userName:o}=vt(),[i,c]=a.useState(o||"");a.useEffect(()=>{o!==void 0&&c(o)},[o]);const d=l=>{const g=l.target.value.trim();s!=null&&s.id&&g!==o&&r(s.id,"set_user_name",{userName:g}).catch(console.error)},[u,h]=a.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),x=l=>{h(l);try{localStorage.setItem("adhdev_sound",l?"1":"0")}catch{}};return e.jsxs(_t,{icon:e.jsx(Gt,{className:"text-text-primary"}),title:"Settings",subtitle:"Local daemon configuration, appearance, and on-device preferences",widthClassName:"max-w-5xl",children:[e.jsx(gr,{variant:"info",children:"Standalone settings stay on this machine. The browser only talks to your local daemon over localhost."}),e.jsx(De,{title:"Daemon",description:"Connection health and local endpoints for the self-hosted runtime.",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-x-4 gap-y-2.5 text-sm",children:[e.jsx("span",{className:"text-text-muted",children:"Version"}),e.jsxs("span",{className:"font-mono text-xs",children:["v","0.6.75"]}),e.jsx("span",{className:"text-text-muted",children:"Status"}),e.jsx("span",{className:s?"text-green-400":"text-yellow-400",children:s?"● Running":"○ Not connected"}),e.jsx("span",{className:"text-text-muted",children:"WebSocket"}),e.jsx("span",{className:"font-mono text-xs",children:"ws://localhost:19222"}),e.jsx("span",{className:"text-text-muted",children:"HTTP"}),e.jsx("span",{className:"font-mono text-xs",children:"http://localhost:19280"})]})}),e.jsx(De,{title:"Detected IDEs",description:"Editors discovered by the local daemon on this machine.",children:n.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:"No IDEs detected. Start an IDE to see it here."}):e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(l=>e.jsxs("div",{className:"flex justify-between items-center bg-bg-glass rounded-lg px-3.5 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${l.running?"bg-green-400":"bg-text-muted/30"}`}),e.jsx("span",{className:"text-sm font-medium",children:l.name})]}),e.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:l.type})]},l.type))})}),e.jsx(De,{title:"Machine",description:"The local burrow exposed by your standalone daemon.",children:e.jsx(kr,{ides:t,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),e.jsx(De,{title:"Appearance",description:"Match the rest of the dashboard with a single place for mode, theme, and accent.",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-text-muted mb-2 font-medium",children:"Mode"}),e.jsx(Mr,{})]}),e.jsxs("div",{className:"border-t border-border-subtle pt-4",children:[e.jsx("div",{className:"text-xs text-text-muted mb-1 font-medium",children:"Theme"}),e.jsx("p",{className:"text-[11px] text-text-muted mb-3",children:"Choose a preset or create a custom surface and chat palette for the standalone UI."}),e.jsx(Rr,{})]}),e.jsxs("div",{className:"border-t border-border-subtle pt-4",children:[e.jsx("div",{className:"text-xs text-text-muted mb-1 font-medium",children:"Accent color override"}),e.jsx("p",{className:"text-[11px] text-text-muted mb-3",children:"Override preset accents without changing your full theme definition."}),e.jsx(Or,{})]})]})}),e.jsx(De,{title:"Notifications",description:"Browser prompts and local sound cues for agent activity.",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Nr,{}),e.jsx(ct,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(_n,{size:15})," Sound Effects"]}),description:"Play a sound when agent completes or needs approval",checked:u,onChange:x})]})}),e.jsx(De,{title:"Profile",description:"How your name appears in local chat threads and dashboard views.",children:e.jsx("div",{className:"flex flex-col gap-3",children:e.jsxs("div",{className:"flex items-center justify-between px-3.5 py-4 bg-bg-glass rounded-xl border border-border-subtle hover:border-border-default transition-colors",children:[e.jsxs("div",{className:"flex flex-col gap-1 pr-4 max-w-[500px]",children:[e.jsxs("span",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Nn,{size:16,className:"text-text-secondary"})," Display Name"]}),e.jsx("span",{className:"text-[12px] text-text-muted leading-relaxed",children:"Your name shown in chat threads and on the team dashboard."})]}),e.jsx("input",{type:"text",className:"bg-bg-primary border border-border-strong rounded-lg px-3 py-1.5 text-sm w-48 text-right focus:border-accent focus:outline-none transition-colors",placeholder:"Anonymous",value:i,onChange:l=>c(l.target.value),onBlur:d,onKeyDown:l=>{l.key==="Enter"&&l.currentTarget.blur()}})]})})})]})}$r();function vs(){const{ides:t}=vt(),s=t.find(n=>{var r;return n.daemonMode||((r=n.id)==null?void 0:r.startsWith("standalone"))});return s?e.jsx(Mt,{to:`/machines/${s.id}`,replace:!0}):t.length>0?e.jsx(Mt,{to:`/machines/${t[0].id}`,replace:!0}):e.jsx(Mt,{to:"/dashboard",replace:!0})}function Ca(){return e.jsx(dn,{children:e.jsx(ba,{children:e.jsx(vn,{value:{sendCommand:$t,sendData:()=>!1},children:e.jsx(ja,{children:e.jsxs(un,{children:[e.jsx(Ge,{path:"/dashboard",element:e.jsx(Jr,{})}),e.jsx(Ge,{path:"/ide/:id",element:e.jsx(Qr,{})}),e.jsx(Ge,{path:"/machine",element:e.jsx(vs,{})}),e.jsx(Ge,{path:"/machines/:id",element:e.jsx(la,{})}),e.jsx(Ge,{path:"/machines",element:e.jsx(vs,{})}),e.jsx(Ge,{path:"/capabilities",element:e.jsx(da,{})}),e.jsx(Ge,{path:"/about",element:e.jsx(ka,{})}),e.jsx(Ge,{path:"/settings",element:e.jsx(Sa,{})}),e.jsx(Ge,{path:"*",element:e.jsx(Mt,{to:"/dashboard",replace:!0})})]})})})})})}Un({connectionManager:Ze,p2pManager:Ze});xn(document.getElementById("root")).render(e.jsx(a.StrictMode,{children:e.jsx(Ca,{})}));
|
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-Df91C6X-.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tc3018Wt.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/terminal-Dm9LBRva.js">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/assets/terminal-6GBZ9nXN.css">
|