@adhdev/daemon-standalone 0.7.23 → 0.7.24
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
|
@@ -39,7 +39,7 @@ var un=Object.defineProperty;var xn=(t,s,n)=>s in t?un(t,s,{enumerable:!0,config
|
|
|
39
39
|
}
|
|
40
40
|
`})]})}function $s({activeConv:t,onModalButton:s}){const[n,r]=o.useState(null);if(o.useEffect(()=>{r(null)},[t.modalMessage,t.status]),t.status!=="waiting_approval"||!t.modalButtons)return null;const a=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:"text-white py-2.5 px-4 shrink-0 z-[5]",style:{background:"linear-gradient(135deg, var(--status-warning), color-mix(in srgb, var(--status-warning) 85%, #000))"},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(Ft,{size:14})," ",n?"PROCESSING...":"ACTION REQUIRED"]}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:t.modalButtons.map((c,u)=>{const l=i(c).toLowerCase(),x=/^(run|approve|accept|yes|allow|always)/.test(l),d=/^(reject|deny|delete|remove|abort)/.test(l),p=n===c,g=n!==null;return e.jsx("button",{onClick:()=>a(c),disabled:g,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${x?"bg-white font-extrabold":d?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${g&&!p?"opacity-40":"opacity-100"} ${g?"cursor-not-allowed":"cursor-pointer"}`,style:x?{color:"var(--status-warning)"}:void 0,children:p?"⏳ ...":i(c)},u)})})]})]})}const we=new Map;function nr({ideId:t,sessionId:s,ideType:n,providerType:r,displayLabel:a,serverModel:i,serverMode:c,acpConfigOptions:u,acpModes:l}){var oe;const{sendCommand:x}=Pe(),d=!!(u||l),p=`${t}:${s||r}`,g=we.get(p),[f,b]=o.useState(!1),[k,S]=o.useState(!1),[h,y]=o.useState((g==null?void 0:g.models)||[]),[N,T]=o.useState((g==null?void 0:g.modes)||[]),m=W=>W?typeof W=="string"?W:typeof W=="object"?W.name||W.id||JSON.stringify(W):String(W):"",[j,v]=o.useState(m(i)),[w,R]=o.useState(m(c)),[A,O]=o.useState(!1),[_,I]=o.useState(!1),P=o.useRef(0),K=W=>W.map($=>typeof $=="string"?$:($==null?void 0:$.name)||($==null?void 0:$.id)||String($));o.useEffect(()=>{if(u){const W=u.find($=>$.category==="model");if(W){const $=K(W.options.map(L=>L.value));y($),W.currentValue&&v(m(W.currentValue));const E=we.get(p)||{models:[],modes:[]};we.set(p,{...E,models:$})}}if(l&&l.length>0){const W=K(l.map(E=>E.id));T(W);const $=we.get(p)||{models:[],modes:[]};we.set(p,{...$,modes:W})}else if(u){const W=u.find($=>$.category!=="model");if(W){const $=K(W.options.map(L=>L.value));T($),W.currentValue&&R(m(W.currentValue));const E=we.get(p)||{models:[],modes:[]};we.set(p,{...E,modes:$})}}},[u,l,p]),o.useEffect(()=>{b(!1),S(!1),v(m(i)),R(m(c));const W=we.get(p);W?(y(W.models),T(W.modes)):(y([]),T([]))},[t,r,s]),o.useEffect(()=>{i&&Date.now()>P.current&&v(m(i))},[i]),o.useEffect(()=>{c&&Date.now()>P.current&&R(m(c))},[c]);const C=o.useCallback(async(W,$={})=>{const E={...$,...s&&{targetSessionId:s}};return await x(t,W,E)},[t,s,x]),F=async()=>{var W,$;if(h.length>0){b(!f);return}if(d){b(!0);return}O(!0);try{const E=await C("list_extension_models",{agentType:r,ideType:n}),L=(E==null?void 0:E.models)||((W=E==null?void 0:E.result)==null?void 0:W.models)||[],D=K(L);y(D),E!=null&&E.current&&v(m(E.current)),($=E==null?void 0:E.result)!=null&&$.current&&v(m(E.result.current));const U=we.get(p)||{models:[],modes:[]};we.set(p,{...U,models:D}),b(!0)}catch{}finally{O(!1)}},Q=async()=>{var W,$;if(N.length>0){S(!k);return}if(d){S(!0);return}I(!0);try{const E=await C("list_extension_modes",{agentType:r,ideType:n}),L=(E==null?void 0:E.modes)||((W=E==null?void 0:E.result)==null?void 0:W.modes)||[],D=K(L);T(D),E!=null&&E.current&&R(m(E.current)),($=E==null?void 0:E.result)!=null&&$.current&&R(m(E.result.current));const U=we.get(p)||{models:[],modes:[]};we.set(p,{...U,modes:D}),S(!0)}catch{}finally{I(!1)}},J=async W=>{b(!1),v(W),P.current=Date.now()+5e3;try{d?await C("change_model",{agentType:r,ideType:n,model:W}):await C("set_extension_model",{agentType:r,ideType:n,model:W})}catch{}},G=d&&!(l&&l.length>0)&&(u==null?void 0:u.some(W=>W.category!=="model")),se=G?(oe=u==null?void 0:u.find(W=>W.category!=="model"))==null?void 0:oe.configId:void 0,X=async W=>{S(!1),R(W),P.current=Date.now()+5e3;try{d&&G&&se?await C("set_thought_level",{agentType:r,ideType:n,configId:se,value:W}):d?await C("set_mode",{agentType:r,ideType:n,mode:W}):await C("set_extension_mode",{agentType:r,ideType:n,mode:W})}catch{}},ee={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[r]||"#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 opacity-70",style:{color:ee},children:a}),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:f?`${ee}55`:"transparent",border:"1px solid",color:j?"var(--text-primary)":"var(--text-muted)"},onClick:F,children:[e.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),A?"...":j||"Model",e.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),f&&h.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>b(!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"}),h.map(W=>e.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:W===j?`${ee}18`:"transparent",color:W===j?ee:"var(--text-secondary)",fontWeight:W===j?600:400,borderLeft:W===j?`2px solid ${ee}`:"2px solid transparent"},onMouseEnter:$=>{$.currentTarget.style.background=`${ee}12`},onMouseLeave:$=>{$.currentTarget.style.background=W===j?`${ee}18`:"transparent"},onClick:()=>J(W),children:W},W))]})]})]}),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:k?`${ee}55`:"transparent",border:"1px solid",color:w?"var(--text-primary)":"var(--text-muted)"},onClick:Q,children:[e.jsx("span",{className:"text-[9px] opacity-60",children:G?"🧠":"⚡"}),_?"...":w||(G?"Thinking":"Mode"),e.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),k&&N.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>S(!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"}),N.map(W=>e.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:W===w?`${ee}18`:"transparent",color:W===w?ee:"var(--text-secondary)",fontWeight:W===w?600:400,borderLeft:W===w?`2px solid ${ee}`:"2px solid transparent"},onMouseEnter:$=>{$.currentTarget.style.background=`${ee}12`},onMouseLeave:$=>{$.currentTarget.style.background=W===w?`${ee}18`:"transparent"},onClick:()=>X(W),children:W},W))]})]})]})]})}const rr=o.memo(function({contextKey:s,panelLabel:n,isSending:r,onSend:a}){const i=o.useRef(null),[c,u]=o.useState("");o.useEffect(()=>{u("")},[s]);const l=()=>{const x=c.trim();!x||r||(u(""),a(x))};return 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:i,type:"text",placeholder:`Send message to ${n}...`,value:c,onChange:x=>u(x.target.value),onPaste:x=>{const d=x.clipboardData.getData("text");d&&u(p=>p+d),x.preventDefault()},onKeyDown:x=>{if(x.key==="Enter"){if(x.nativeEvent.isComposing){x.preventDefault();return}x.preventDefault(),l()}},onBlur:x=>{if(window.innerWidth<768){const d=x.relatedTarget;if((d==null?void 0:d.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:l,disabled:!c.trim()||r,className:`w-10 h-10 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${c.trim()&&!r?"cursor-pointer":"bg-bg-secondary cursor-default"}`,style:c.trim()&&!r?{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:c.trim()?"text-white":"text-text-muted",children:e.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})}),ye=t=>t.transport==="pty",ge=t=>t.transport==="acp";var ar=new Set(["generating","streaming","loading","loading_reference","thinking","active"]);function or(t){var s;return(((s=t==null?void 0:t.buttons)==null?void 0:s.length)??0)>0}function me(t,s){if(or(s==null?void 0:s.activeModal))return"waiting_approval";const n=String(t||"idle").trim().toLowerCase();return n==="waiting_approval"?"waiting_approval":ar.has(n)?"generating":n==="error"?"error":n==="stopped"?"stopped":n==="starting"?"starting":n==="panel_hidden"?"panel_hidden":n==="not_monitored"?"not_monitored":n==="disconnected"?"disconnected":"idle"}function Ps(t){return me(t)==="generating"}function pe(t){return t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"IDE"}function ir(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 a=Math.floor(n/24),i=n%24;return`${a}d ${i}h`}function Qt(t){return t<1024*1024*1024?`${(t/(1024*1024)).toFixed(0)} MB`:`${(t/(1024*1024*1024)).toFixed(1)} GB`}function Bt(t,s){const n=typeof s=="string"?s.trim():"";if(n)return n;const r=typeof t=="string"?t.trim():"";if(!r)return"";const a=r.replace(/[\\/]+$/,""),i=a.split(/[\\/]/).filter(Boolean);return i[i.length-1]||a}function cr(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 lr(t){return cr(t.trim().replace(/\.local$/i,""))}function dr(t){const s=t.machineNickname??t.nickname;return typeof s!="string"?null:s.trim()||null}function Ds(t,s={}){var a,i;const n=[t.hostname,(a=t.machine)==null?void 0:a.hostname,(i=t.system)==null?void 0:i.hostname].find(c=>typeof c=="string"&&c.trim().length>0);if(n&&n!=="Unknown")return lr(n);const r=s.fallbackId||t.id;return r?`Machine-${r.substring(0,8)}`:s.fallbackLabel||"Machine"}function Xe(t,s={}){return dr(t)||Ds(t,s)}function es(t){return t.transport==="pty"}function ts(t){return t.transport==="acp"}function ss(t,s){return pe(t)}function ur(t,s,n){const r=(t||"").trim().toLowerCase();if(!r)return!0;const a=(s||"").trim().toLowerCase(),i=(n||"").trim().toLowerCase(),c=pe(n||"").trim().toLowerCase();return r===a||r===i||r===c}function xr(t){return me(t==null?void 0:t.status,{activeModal:t==null?void 0:t.activeModal})}function pr(t){if(!Array.isArray(t)||t.length<=1)return t;const s=new Map,n=["generating","waiting_approval","connected","idle","panel_hidden"];for(const r of t){const a=(r.name||r.id||"").toLowerCase().replace(/\s+/g,"-"),i=s.get(a),c=me(r.status);if(!i){s.set(a,{...r,status:c});continue}const u=n.indexOf(i.status||"idle"),l=n.indexOf(c||"idle");l>=0&&(u<0||l<u)&&s.set(a,{...r,status:c})}return Array.from(s.values())}const hr=60,mr=60;function Bs({activeConv:t,ideEntry:s,handleSendChat:n,isSendingChat:r=!1,handleFocusAgent:a,isFocusingAgent:i,actionLogs:c,userName:u}){const l=o.useRef(new Map),{sendCommand:x}=Pe();ct("ChatPane",{tabKey:t.tabKey,messageCount:t.messages.length,actionLogCount:c.length,isSendingChat:r});const d=o.useRef(new Map),p=o.useCallback(_=>(d.current.has(_)||d.current.set(_,{messages:[],offset:0,hasMore:!0,error:null,visibleLiveCount:hr}),d.current.get(_)),[]),g=o.useCallback((_,I)=>{const P=p(_);d.current.set(_,{...P,...I}),f(K=>K+1)},[p]),[,f]=o.useState(0),b=t.tabKey,k=p(b),S=k.messages,h=k.hasMore,y=k.error,N=Math.max(0,t.messages.length-k.visibleLiveCount),[T,m]=o.useState(!1),j=o.useCallback(async()=>{var P,K;if(T)return;const _=t.tabKey,I=p(_);if(t.messages.length>I.visibleLiveCount){g(_,{visibleLiveCount:Math.min(t.messages.length,I.visibleLiveCount+mr),error:null});return}m(!0),g(_,{error:null});try{const C=(s==null?void 0:s.daemonId)||((P=t.ideId)==null?void 0:P.split(":")[0])||"";if(!C){g(_,{hasMore:!1});return}const F=t.ideType||t.agentType||"",Q=await x(C,"chat_history",{agentType:F,offset:I.offset,limit:30,targetSessionId:t.sessionId}),J=(Q==null?void 0:Q.result)??Q;if(((K=J.messages)==null?void 0:K.length)>0){const G=p(_);g(_,{messages:[...J.messages,...G.messages],offset:G.offset+J.messages.length,hasMore:!!J.hasMore})}else g(_,{hasMore:!!J.hasMore})}catch(C){const F=(C==null?void 0:C.message)||"";F.includes("P2P not available")||F.includes("channel not open")||F.includes("P2P not connected")||F.includes("timeout")?g(_,{error:"Connection not ready — tap to retry"}):g(_,{hasMore:!1,error:"Failed to load history"})}finally{m(!1)}},[T,s,t,x,p,g]),{allMessages:v,receivedAtMap:w}=o.useMemo(()=>{const _=N>0?t.messages.slice(-k.visibleLiveCount):t.messages;if(S.length===0){const F={};return _.forEach((Q,J)=>{const G=`${t.tabKey}:${Ve(Q,J)}`;let se=Q.receivedAt||l.current.get(G)||0;se||(se=Date.now(),l.current.set(G,se)),F[Ve(Q,J)]=se}),{allMessages:_,receivedAtMap:F}}const I=new Set(_.map(F=>`${F.role}:${(F.content||"").slice(0,100)}`)),K=[...S.filter(F=>!I.has(`${F.role}:${(F.content||"").slice(0,100)}`)),..._],C={};return K.forEach((F,Q)=>{const J=`${t.tabKey}:${Ve(F,Q)}`;let G=F.receivedAt||l.current.get(J)||0;G||(G=Date.now(),l.current.set(J,G)),C[Ve(F,Q)]=G}),{allMessages:K,receivedAtMap:C}},[t.messages,t.tabKey,N,S,k.visibleLiveCount]),R=o.useMemo(()=>c.filter(_=>_.ideId===t.tabKey).sort((_,I)=>_.timestamp-I.timestamp),[c,t.tabKey]),A=t.displayPrimary||t.agentName||"Agent",O=o.useMemo(()=>{if(t.messages.length===0){if(t.connectionState==="connecting"||t.connectionState==="new")return 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"})]})]});if(t.status==="not_monitored")return 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(Ye,{size:28})}),e.jsx("div",{className:"text-[13px] opacity-50",children:"Agent not monitored"}),e.jsx("button",{onClick:a,disabled:i,className:"btn btn-primary",children:i?"⌛ Switching...":e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Pt,{size:14})," Open ",A," Panel"]})}),e.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Click to switch monitoring to this agent"})]});if(t.status==="panel_hidden")return 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(Ts,{size:28})}),e.jsx("div",{className:"text-[13px] opacity-50",children:"Agent panel is not visible yet"}),e.jsx("button",{onClick:a,disabled:i,className:"btn btn-primary",children:i?"⌛ Opening...":e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Pt,{size:14})," Open ",A," 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"})]});if(t.status==="idle"&&!T)return 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..."})]})}},[t.messages.length,t.connectionState,t.status,a,i,T,A]);return e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsx(Xn,{messages:v,actionLogs:R,agentName:t.agentName||t.displayPrimary||"Agent",userName:u,isCliMode:ye(t)||ge(t),isWorking:t.status==="generating",contextKey:t.tabKey,receivedAtMap:w,onLoadMore:j,isLoadingMore:T,hasMoreHistory:h,hiddenLiveCount:N,loadError:y??void 0,emptyState:O}),!ye(t)&&(()=>{const _=t.streamSource!=="agent-stream",I=_?t.ideType:t.agentType,P=_?s!=null&&s.type?pe(s.type):pe(t.ideType||""):t.agentName||pe(t.agentType||"");return e.jsx(nr,{ideId:t.ideId,sessionId:t.sessionId,ideType:t.ideType,providerType:I,displayLabel:P,serverModel:(s==null?void 0:s.currentModel)||void 0,serverMode:(s==null?void 0:s.currentPlan)||void 0,acpConfigOptions:ge(t)?s==null?void 0:s.acpConfigOptions:void 0,acpModes:ge(t)?s==null?void 0:s.acpModes:void 0})})(),e.jsx(rr,{contextKey:t.tabKey,panelLabel:A,isSending:r,onSend:n})]})}let Ws=ot;function It(){return Ws()}class fr{constructor(){ue(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(a=>a(...n))}}let Os=new fr;class gr{constructor(){ue(this,"ptyCallbacks",new Set)}sendPtyInput(s,n,r){return!1}sendPtyResize(s,n,r,a){return!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,r){this.ptyCallbacks.forEach(a=>a(s,n,r))}getRuntimeSnapshot(s){return Promise.resolve(null)}onRuntimeEvent(s,n){return()=>{}}}let xe=new gr;function br(t){t.dashboardWS&&(Os=t.dashboardWS),t.connectionManager&&(xe=t.connectionManager),t.useDaemonsHook&&(Ws=t.useDaemonsHook)}function yr({activeConv:t,clearToken:s=0,ptyBuffers:n,terminalRef:r,handleSendChat:a,isSendingChat:i=!1}){var m;const c=o.useRef(null),{sendCommand:u,sendData:l}=Pe(),[x,d]=o.useState(""),[p,g]=o.useState(!1),f=o.useRef(0),b=o.useRef(!1),k=t.tabKey,S=t.sessionId||"",h=t.daemonId||((m=t.ideId)==null?void 0:m.split(":")[0])||t.ideId||"",y=()=>{var j;f.current=0,b.current=!1,g(!1),(j=r.current)==null||j.clear()},N=()=>{var j;f.current=0,b.current=!1,g(!0),(j=r.current)==null||j.clear()},T=(j,v=0)=>{var w,R;b.current||f.current>=v&&f.current!==0||(f.current=v,g(!0),(w=r.current)==null||w.clear(),j&&((R=r.current)==null||R.write(j)))};return o.useEffect(()=>{y()},[S]),o.useEffect(()=>{var w,R;if(!S)return;let j=!1;(w=xe.getRuntimeSnapshot)==null||w.call(xe,S).then(A=>{j||!A||A.sessionId!==S||T(A.text||"",A.seq||0)}).catch(()=>{});const v=((R=xe.onRuntimeEvent)==null?void 0:R.call(xe,S,A=>{var O;if(!(!A||A.sessionId!==S)){if(A.type==="runtime_snapshot"){T(A.text||"",A.seq||0);return}if(A.type==="session_output"){b.current=!0,typeof A.seq=="number"&&(f.current=Math.max(f.current,A.seq)),g(!0),typeof A.data=="string"&&((O=r.current)==null||O.write(A.data));return}A.type==="session_cleared"&&N()}}))||(()=>{});return()=>{j=!0,v()}},[S,r]),o.useEffect(()=>{var v,w;if(!S)return;h&&((v=xe.getState)==null?void 0:v.call(xe,h))==="connected"&&g(!0);const j=(w=xe.onStateChange)==null?void 0:w.call(xe,(R,A)=>{R!==h||A!=="connected"||g(!0)});return()=>{j==null||j()}},[h,S,r]),o.useEffect(()=>{s&&(n.current.delete(k),y())},[s,k,n,r]),o.useEffect(()=>{d("")},[t.tabKey]),o.useEffect(()=>{const j=v=>{var R;const w=v.detail;w!=null&&w.sessionId&&w.sessionId!==S||p&&((R=r.current)==null||R.fit())};return window.addEventListener("adhdev:fit-cli-terminal",j),()=>{window.removeEventListener("adhdev:fit-cli-terminal",j)}},[p,S,r]),o.useEffect(()=>{if(!p)return;const j=requestAnimationFrame(()=>{var v;(v=r.current)==null||v.fit()});return()=>cancelAnimationFrame(j)},[p,S,r]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:[e.jsx(Ls,{ref:r,readOnly:!p,onInput:j=>{p&&(l!=null&&l(h,{type:"pty_input",targetSessionId:S,data:j})||u(h,"pty_input",{targetSessionId:S,data:j}).catch(console.error))},onResize:(j,v)=>{p&&(l!=null&&l(h,{type:"pty_resize",targetSessionId:S,cols:j,rows:v})||u(h,"pty_resize",{targetSessionId:S,cols:j,rows:v,force:!0}).catch(()=>{}))}},t.tabKey),!p&&e.jsx("div",{className:"absolute inset-x-2 top-2 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2 text-[11px] text-red-300 pointer-events-none",children:"Runtime terminal unavailable"})]}),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:x,onChange:j=>d(j.target.value),onPaste:j=>{const v=j.clipboardData.getData("text");v&&d(w=>w+v),j.preventDefault()},onKeyDown:j=>{if(j.key!=="Enter")return;if(j.nativeEvent.isComposing){j.preventDefault();return}j.preventDefault();const v=x.trim();!p||!v||i||(d(""),a(v))},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:()=>{const j=x.trim();!p||!j||i||(d(""),a(j))},disabled:!p||!x.trim()||i,className:`w-9 h-9 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${x.trim()&&!i?"cursor-pointer":"bg-bg-secondary cursor-default"}`,style:x.trim()&&!i?{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:x.trim()?"text-white":"text-text-muted",children:e.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function jr({wsStatus:t,showReconnected:s,loginUrl:n}){const r=t==="disconnected"||t==="reconnecting"||t==="offline"||t==="auth_failed",a=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)"},u={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[a],borderBottom:c[a],color:u[a]},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"]})]})}function vr({activeConv:t,agentCount:s,wsStatus:n,isConnected:r,onOpenHistory:a,onStopCli:i,onFitCli:c}){const u=it(),l=It(),x=l.p2pStates||{},d=l.ides||[],p=!!t&&ye(t)&&!ge(t),g=r?"#22c55e":n==="connected"?"#eab308":"#ef4444",f=r?"0 0 4px #22c55e80":n==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480",b=d.filter(T=>T.type==="adhdev-daemon"),k=Object.values(x),S=k.filter(T=>T==="connected").length,h=k.filter(T=>T==="connecting"||T==="new"||T==="checking").length,N=n!=="connected"||b.length===0?null:h>0&&S===0?"P2P connecting...":S>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(qe,{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:g,boxShadow:f}})})]}),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:g,boxShadow:f}}),N&&e.jsxs("span",{className:"text-[10px] text-text-muted animate-pulse ml-1",children:["· ",N]})]})]})}),e.jsxs("div",{className:"flex gap-2 items-center",children:[p&&i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:c,className:"btn btn-secondary btn-sm",title:"Fit terminal to current view",children:"Fit"}),e.jsx("button",{onClick:i,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&&!p&&!ge(t)&&e.jsxs("button",{onClick:()=>u(`/ide/${t.ideId}`),className:"btn btn-primary btn-sm",title:"IDE View",children:[e.jsx(Ut,{size:14})," IDE"]}),t&&!p&&!ge(t)&&e.jsx("button",{onClick:a,className:"btn btn-secondary btn-sm",title:"Chat History",children:e.jsx(Is,{size:16})}),t&&!p&&!ge(t)&&e.jsx("button",{onClick:()=>u(`/ide/${t.ideId}?view=remote`),className:"btn btn-secondary btn-sm",title:"Remote Control",children:e.jsx(Le,{size:16})})]})]})}function Ks({activeConv:t,ides:s,isCreatingChat:n,isRefreshingHistory:r,onClose:a,onNewChat:i,onSwitchSession:c,onRefreshHistory:u}){var p;const l=s.find(g=>g.id===t.ideId),x=(l==null?void 0:l.chats)||[],d=(p=l==null?void 0:l.activeChat)==null?void 0:p.id;return e.jsxs("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[e.jsx("div",{onClick:a,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," — ",pe(t.ideType)]})]}),e.jsx("button",{onClick:a,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"}),x.map(g=>e.jsxs("div",{onClick:()=>{c(t.ideId,g.id),a()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${d===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 ${d===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),"..."]}),d===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)),x.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(Wn,{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:u,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(Ms,{size:13})," Refresh History"]})})})]})]})}const ns={success:"rgba(16, 185, 129, 0.95)",warning:"color-mix(in srgb, var(--status-warning) 95%, transparent)",info:"rgba(99, 102, 241, 0.95)"};function zs({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:ns[r.type]||ns.info},onClick:()=>{var a;(a=r.actions)!=null&&a.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:a=>{a.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((a,i)=>e.jsx("button",{className:`text-xs px-3 py-1 rounded-md font-bold transition-all cursor-pointer ${a.variant==="primary"?"bg-white text-text-primary hover:bg-gray-100":a.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(),a.onClick(),s(r.id)},children:a.label},i))})]},r.id))})}const wr=t=>t.transport==="pty"||t.transport==="acp"||t.transport==="cdp-page"?!0:t.daemonId!==t.id;function Nr(t){const s=t.workspace||"";if(!s)return"";const n=s.split(/[/\\]/).filter(Boolean);return n.length>0?n[n.length-1]:s}function kr(t){return t.sessionId||t.instanceId||t.agentType}function xt(t){return typeof t=="string"?t.replace(/\s+/g," ").trim():Array.isArray(t)?t.map(s=>typeof s=="string"?s:s&&typeof s=="object"&&"text"in s?String(s.text||""):"").join(`
|
|
41
41
|
`).replace(/\s+/g," ").trim():t&&typeof t=="object"&&"text"in t?String(t.text||"").replace(/\s+/g," ").trim():String(t||"").replace(/\s+/g," ").trim()}function rs(t,s){const n=new Set,r=[];for(const a of s)if(a)for(const i of t[a]||[]){const c=i._localId||`${i.role}:${i.timestamp}:${i.content}`;n.has(c)||(n.add(c),r.push(i))}return r.sort((a,i)=>a.timestamp-i.timestamp)}function Hs(t=[]){const s={};for(const n of t){const r=n;(r.type==="adhdev-daemon"||r.daemonMode)&&(s[r.id]=Xe(r,{fallbackId:r.id}))}return s}function Fs(t,s,n={}){var f,b,k,S,h,y;const r=[],a=n.machineName,i=n.connectionState,c=Nr(t),u=pe(t.type),l=t.agentStreams,x=Array.isArray(l)?l.map(N=>({...N,activeModal:N.activeModal??void 0})):[],d=wr(t),p=t.activeChat||{title:""},g=p.title&&String(p.title).trim()?String(p.title).trim():"";if(d){const N=t.sessionId||t.instanceId,T=ss(t.type),m=(f=t.activeChat)==null?void 0:f.activeModal,j=m&&Array.isArray(m.buttons)&&m.buttons.length>0,v=me((b=t.activeChat)==null?void 0:b.status,{activeModal:(k=t.activeChat)==null?void 0:k.activeModal})||me((h=(S=t.agents)==null?void 0:S[0])==null?void 0:h.status)||"idle",w=t.activeChat||{title:"",messages:[]};let R=w.title&&String(w.title).trim()?String(w.title).trim():"";const A=(y=t.activeChat)==null?void 0:y.id,O=t.chats;if(A&&Array.isArray(O)&&O.length>0){const C=O.find(F=>F.id===A||F.id&&String(F.id)===String(A));C!=null&&C.title&&String(C.title).trim()&&(R=String(C.title).trim())}const _=w.messages||[],I=rs(s,[t.id,N]),P=new Map;_.filter(C=>C.role==="user").forEach(C=>{const F=xt(C.content);F&&P.set(F,(P.get(F)||0)+1)});const K=I.filter(C=>{const F=xt(C.content),Q=P.get(F)||0;return Q>0?(P.set(F,Q-1),!1):!0});r.push({ideId:t.id,sessionId:N,transport:t.transport,daemonId:t.daemonId||void 0,mode:ye(t)?t.mode||"terminal":"chat",agentName:T,agentType:(ye(t)||ge(t))&&(t.cliType||t.acpType)||t.type,status:v,title:R,messages:[..._,...K],terminalHistory:typeof w.terminalHistory=="string"?w.terminalHistory:"",resume:t.resume,ideType:t.cliType||t.acpType||t.type,workspaceName:c,displayPrimary:R||c||(ye(t)||ge(t)?"Terminal":T),displaySecondary:u,cdpConnected:t.cdpConnected,modalButtons:j?m.buttons:void 0,modalMessage:j?m.message:void 0,streamSource:"native",tabKey:t.id,machineName:a,connectionState:i})}if(d&&(ye(t)||ge(t)))return r;for(const N of x){const T=N.activeModal&&Array.isArray(N.activeModal.buttons)&&N.activeModal.buttons.length>0,m=xr(N),j=kr(N),v=`${t.id}:${j}`,w=N.title&&String(N.title).trim()||"",R=ur(w,N.agentName,N.agentType)?"":w,A=N.messages||[],O=rs(s,[v,N.sessionId,N.instanceId]),_=new Map;A.filter(P=>P.role==="user").forEach(P=>{const K=xt(P.content);K&&_.set(K,(_.get(K)||0)+1)});const I=O.filter(P=>{const K=xt(P.content),C=_.get(K)||0;return C>0?(_.set(K,C-1),!1):!0});r.push({ideId:t.id,sessionId:N.sessionId||N.instanceId,transport:N.transport||"cdp-webview",daemonId:t.daemonId||void 0,mode:"chat",agentName:N.agentName,agentType:N.agentType,status:m,title:R,messages:[...A,...I],ideType:N.agentType,workspaceName:c,displayPrimary:R||g||c||u,displaySecondary:`${u}·${N.agentName}`,cdpConnected:t.cdpConnected,modalButtons:T?N.activeModal.buttons:void 0,modalMessage:T?N.activeModal.message:void 0,streamSource:"agent-stream",tabKey:v,machineName:a,connectionState:i})}return r.length===0&&r.push({ideId:t.id,sessionId:t.sessionId||t.instanceId,transport:t.transport,daemonId:t.daemonId||void 0,mode:"chat",agentName:ss(t.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:t.type,workspaceName:c,displayPrimary:c||u,displaySecondary:u,cdpConnected:t.cdpConnected,streamSource:"native",tabKey:t.id,connectionState:i}),r}function Sr(t){const s=[],n=new Map;for(const r of t)if(r.parentId){const a=n.get(r.parentId)||[];a.push(r),n.set(r.parentId,a)}else s.push(r);return{topLevel:s,childrenByParent:n}}function Cr(t,s){var f,b,k,S,h,y,N,T;const n=[],{daemonId:r,existingDaemon:a,timestamp:i}=s,c=i||t.timestamp||Date.now(),u=t.sessions||[],{topLevel:l,childrenByParent:x}=Sr(u),d=l.filter(m=>m.kind==="workspace"&&m.transport==="cdp-page"),p=l.filter(m=>m.kind==="agent"&&m.transport==="pty"),g=l.filter(m=>m.kind==="agent"&&m.transport==="acp");n.push({...a||{},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},...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:d.some(m=>!!m.cdpConnected)});for(const m of d){const j=x.get(m.id)||[];n.push({id:`${r}:ide:${m.id}`,sessionId:m.id,parentSessionId:m.parentId,sessionKind:m.kind,transport:m.transport,sessionCapabilities:m.capabilities,type:m.providerType,ideType:m.providerType,status:m.cdpConnected?"online":"detected",daemonId:r,instanceId:m.id,workspace:m.workspace,terminals:0,agents:j.map(v=>({id:v.id,name:v.providerName,type:v.providerType,status:v.status})),activeChat:m.activeChat,chats:[],agentStreams:j.map(v=>{var w,R,A,O;return{sessionId:v.id,instanceId:v.id,parentSessionId:v.parentId,agentType:v.providerType,agentName:v.providerName,extensionId:v.providerType,transport:v.transport,status:me(v.status,{activeModal:(w=v.activeChat)==null?void 0:w.activeModal}),title:v.title,messages:((R=v.activeChat)==null?void 0:R.messages)||[],inputContent:((A=v.activeChat)==null?void 0:A.inputContent)||"",activeModal:((O=v.activeChat)==null?void 0:O.activeModal)||null,model:v.currentModel}}),cdpConnected:m.cdpConnected,currentModel:m.currentModel,currentPlan:m.currentPlan,currentAutoApprove:m.currentAutoApprove,timestamp:c})}for(const m of p){const j=m.runtime;n.push({id:`${r}:cli:${m.id}`,sessionId:m.id,parentSessionId:m.parentId,sessionKind:m.kind,transport:m.transport,sessionCapabilities:m.capabilities,type:m.providerType,ideType:m.providerType,agentType:m.providerType,status:m.status||"running",daemonId:r,instanceId:m.id,cliName:m.providerName,mode:"terminal",workspace:m.workspace||"",activeChat:m.activeChat,resume:m.resume,runtimeKey:m.runtimeKey??(j==null?void 0:j.runtimeKey),runtimeDisplayName:m.runtimeDisplayName??(j==null?void 0:j.displayName),runtimeWorkspaceLabel:m.runtimeWorkspaceLabel??(j==null?void 0:j.workspaceLabel),runtimeWriteOwner:m.runtimeWriteOwner??(j==null?void 0:j.writeOwner)??null,runtimeAttachedClients:m.runtimeAttachedClients??(j==null?void 0:j.attachedClients)??[],agentStreams:[{sessionId:m.id,instanceId:m.id,parentSessionId:m.parentId,agentType:m.providerType,agentName:m.providerName,extensionId:"cli-agent",transport:m.transport,status:me(m.status,{activeModal:(f=m.activeChat)==null?void 0:f.activeModal}),title:m.title,messages:((b=m.activeChat)==null?void 0:b.messages)||[],inputContent:((k=m.activeChat)==null?void 0:k.inputContent)||"",activeModal:(S=m.activeChat)==null?void 0:S.activeModal}],timestamp:c,_isCli:!0})}for(const m of g){const j=m.runtime;n.push({id:`${r}:acp:${m.id}`,sessionId:m.id,parentSessionId:m.parentId,sessionKind:m.kind,transport:m.transport,sessionCapabilities:m.capabilities,type:m.providerType,ideType:m.providerType,agentType:m.providerType,status:m.status||"running",daemonId:r,instanceId:m.id,cliName:m.providerName,mode:"chat",workspace:m.workspace||"",activeChat:m.activeChat,runtimeKey:m.runtimeKey??(j==null?void 0:j.runtimeKey),runtimeDisplayName:m.runtimeDisplayName??(j==null?void 0:j.displayName),runtimeWorkspaceLabel:m.runtimeWorkspaceLabel??(j==null?void 0:j.workspaceLabel),runtimeWriteOwner:m.runtimeWriteOwner??(j==null?void 0:j.writeOwner)??null,runtimeAttachedClients:m.runtimeAttachedClients??(j==null?void 0:j.attachedClients)??[],currentModel:m.currentModel,currentPlan:m.currentPlan,acpConfigOptions:m.acpConfigOptions,acpModes:m.acpModes,agentStreams:[{sessionId:m.id,instanceId:m.id,parentSessionId:m.parentId,agentType:m.providerType,agentName:m.providerName,extensionId:"acp-agent",transport:m.transport,status:me(m.status,{activeModal:(h=m.activeChat)==null?void 0:h.activeModal}),title:m.title,messages:((y=m.activeChat)==null?void 0:y.messages)||[],inputContent:((N=m.activeChat)==null?void 0:N.inputContent)||"",activeModal:(T=m.activeChat)==null?void 0:T.activeModal}],timestamp:c,_isAcp:!0})}return n}function Us(t){const s=t.split(":");return s.length>=3&&(s[1]==="ide"||s[1]==="cli"||s[1]==="acp")?{daemonId:s[0],targetSessionId:s.slice(2).join(":")||void 0}:{daemonId:t}}function Ir(t,s){const n=Us(t);return{daemonId:n.daemonId,payload:{...s,...n.targetSessionId&&!s.targetSessionId?{targetSessionId:n.targetSessionId}:{}}}}const Vs=[{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:"💚"}],qs=[{id:"claude-cli",name:"Claude Code",icon:"🟠"},{id:"gemini-cli",name:"Gemini CLI",icon:"✨"},{id:"codex-cli",name:"Codex CLI",icon:"📦"},{id:"aider-cli",name:"Aider",icon:"🛠️"},{id:"cursor-cli",name:"Cursor CLI",icon:"⚡"},{id:"github-copilot-cli",name:"GitHub Copilot CLI",icon:"🤖"},{id:"goose-cli",name:"Goose CLI",icon:"🪿"},{id:"opencode-cli",name:"OpenCode 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",as={globalEnabled:!0,disconnectAlert:!0,browserNotifications:!0,completionAlert:!0,approvalAlert:!0,chatTaskCompletionBubble:!1};function Mr(){try{const t=localStorage.getItem(Xs);if(t){const s=JSON.parse(t);return{...as,...s}}}catch{}return{...as}}function Tr(t){try{localStorage.setItem(Xs,JSON.stringify(t))}catch{}}let Te=Mr(),bt=[];function Er(){bt.forEach(t=>t())}function Ar(){return{...Te}}function Rr(t){Te={...Te,...t},Tr(Te),Er()}function _r(){const[,t]=o.useState(0);o.useEffect(()=>{const n=()=>t(r=>r+1);return bt.push(n),()=>{bt=bt.filter(r=>r!==n)}},[]);const s=o.useCallback(n=>{Rr(n)},[]);return[{...Te},s]}function nt(t){if(!Te.globalEnabled)return!1;switch(t){case"disconnect":return Te.disconnectAlert;case"completion":return Te.completionAlert;case"approval":return Te.approvalAlert;case"browser":return Te.browserNotifications;default:return!0}}const Lr={enabled:!0,onApproval:!0,onComplete:!0,onError:!0,throttleMs:5e3};async function $r(){return"Notification"in window?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"}function Gs(){return"Notification"in window&&Notification.permission==="granted"}let De=null;async function Pr(){if(De!==null)return De;try{if(!("serviceWorker"in navigator)||!("PushManager"in window))return De=!1,!1;const t=await navigator.serviceWorker.getRegistration();return t?(De=!!await t.pushManager.getSubscription(),De):(De=!1,!1)}catch{return De=!1,!1}}function Wt(t,s,n){if(Gs())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 Dr(t,s={}){const n={...Lr,...s},r=o.useRef(new Map),a=o.useRef(0),i=o.useRef(null);o.useEffect(()=>{Pr().then(u=>{i.current=u})},[]);const c=o.useCallback((u,l,x)=>{const d=Date.now();d-a.current<n.throttleMs||(a.current=d,Wt(u,l,x))},[n.throttleMs]);o.useEffect(()=>{var u;if(!(!n.enabled||!Gs())&&nt("browser")&&i.current!==!0){if(document.hasFocus()){for(const l of t)r.current.set(l.id,me(l.status,{activeModal:l.activeModal}));return}for(const l of t){const x=r.current.get(l.id),d=me(l.status,{activeModal:l.activeModal}),p=l.name||l.id;if(n.onApproval&&nt("approval")&&d==="waiting_approval"&&x!=="waiting_approval"){const g=((u=l.activeModal)==null?void 0:u.message)||"Action requires your approval";c(`🔔 ${p} — Approval needed`,g.slice(0,120),`approval-${l.id}`)}n.onComplete&&nt("completion")&&Ps(x)&&d==="idle"&&c(`✅ ${p} — Task complete`,"Agent has finished generating",`complete-${l.id}`),n.onError&&d==="error"&&x!=="error"&&c(`⚠️ ${p} — Error`,"Agent encountered an error",`error-${l.id}`),r.current.set(l.id,d)}}},[t,n.enabled,n.onApproval,n.onComplete,n.onError,c])}class Br{constructor(){ue(this,"dedupMap",new Map);ue(this,"DEDUP_WINDOW_MS",5e3);ue(this,"DEDUP_MAX_SIZE",50);ue(this,"DEDUP_CLEANUP_AGE_MS",1e4);ue(this,"toastCallbacks",[]);ue(this,"systemMessageCallbacks",[]);ue(this,"clearSystemMessageCallbacks",[]);ue(this,"resolveActionFn",null);ue(this,"viewRequestRespondFn",null);ue(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 a=(r==null?void 0:r.id)||Date.now();this.emitToast({id:a,message:s,type:n,timestamp:a,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[a,i]of this.dedupMap)n-i>this.DEDUP_CLEANUP_AGE_MS&&this.dedupMap.delete(a);return!1}resolveOwningDaemon(s){if(s.ideType==="adhdev-daemon"&&s.ideId){const a=this.ides.find(i=>i.id===s.ideId&&i.type==="adhdev-daemon");if(a)return a}let n;if(s.targetSessionId&&(n=this.findOwningSession(s.targetSessionId)||void 0),s.ideId&&(n=n||this.ides.find(a=>a.id===s.ideId)),!n&&s.instanceId&&(n=this.ides.find(a=>a.id.endsWith(`:ide:${s.instanceId}`)||a.id.endsWith(`:cli:${s.instanceId}`))),n){const a=n.daemonId;if(a){const i=this.ides.find(c=>c.id===a&&c.type==="adhdev-daemon");if(i)return i}}const r=this.ides.filter(a=>a.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}findOwningSession(s){for(const n of this.ides)if(n.id===s||n.sessionId===s||(Array.isArray(n.agentStreams)?n.agentStreams:[]).some(a=>(a==null?void 0:a.sessionId)===s))return n;return null}resolveActionRouteTarget(s){if(s.ideId){const n=s.agentType||s.ideType||"";return this.resolveRouteId(s.ideId,n)}if(s.targetSessionId){const n=this.findOwningSession(s.targetSessionId);return(n==null?void 0:n.id)||(n==null?void 0:n.daemonId)||null}return null}resolveConversationKey(s){return s.targetSessionId?s.targetSessionId:s.ideId?s.ideId:null}handleRawEvent(s,n){var d,p;if(!s.ideId&&s.instanceId){for(const g of this.ides)if(g.id.endsWith(`:ide:${s.instanceId}`)||g.id.endsWith(`:cli:${s.instanceId}`)){s.ideId=g.id;break}}const r=this.resolveConversationKey(s),i=`${r||s.instanceId||s.ideType||s.providerType||""}:${s.event}:${s.chatTitle||""}`;if(this.isDuplicate(i))return;let c=pe(s.ideType||"");const u=this.resolveOwningDaemon(s);if(u){const g=Xe(u,{fallbackId:u.id});g&&(c=s.ideType==="adhdev-daemon"?g:`${g}/${c}`)}let l="",x="info";if(s.event==="agent:generating_completed"){const g=s.duration?` (${s.duration}s)`:"";l=`✅ ${c} agent task completed${g}`,x="success";try{new Audio("data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAAB/f39/").play().catch(()=>{})}catch{}r&&Ar().chatTaskCompletionBubble&&this.emitSystemMessage(r,{role:"system",timestamp:Date.now(),content:`✅ Task completed${g}`,_localId:`sys_complete_${Date.now()}`})}else if(s.event==="agent:generating_started")r&&this.emitClearSystemMessage(r,"sys_complete_");else if(s.event==="agent:waiting_approval"){if(l=`⚡ ${c} approval needed`,x="warning",r){const g=s.modalMessage||"Approval requested",f=(d=s.modalButtons)!=null&&d.length?s.modalButtons.map(b=>`[${b}]`).join(" "):"[Approve] [Reject]";this.emitSystemMessage(r,{role:"system",timestamp:Date.now(),content:`⚡ Approval requested: ${g}
|
|
42
|
-
${f}`,_localId:`sys_approval_${Date.now()}`})}if((p=s.modalButtons)!=null&&p.length&&this.resolveActionFn){const g=this.resolveActionRouteTarget(s);if(!g)return;const f=s.agentType||s.ideType||"",b=s.ideType||"",k=s.modalButtons,S=m=>m.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim(),h=this.resolveActionFn,y=k.map((m,j)=>{const v=S(m).toLowerCase(),w=/^(run|approve|accept|yes|allow|always)/.test(v),R=/^(reject|deny|delete|remove|abort|cancel|no)/.test(v);return{label:S(m),variant:w?"primary":R?"danger":"default",onClick:()=>{const A=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(v);h(g,"resolve_action",{action:A?"approve":"reject",button:m,buttonIndex:j,agentType:f,ideType:b,...s.targetSessionId&&{targetSessionId:s.targetSessionId}})}}}),N=s.modalMessage?`⚡ ${c}: ${s.modalMessage.replace(/[\n\r]+/g," ").slice(0,80)}`:l,T=Date.now();this.emitToast({id:T,message:N,type:x,timestamp:T,targetKey:r||g,actions:y,duration:15e3}),l=""}}else if(s.event==="monitor:long_generating"){const g=s.elapsedSec?` (${Math.round(s.elapsedSec/60)}m)`:"";l=`⚠️ ${c} agent is taking a long time${g}`,x="warning",nt("browser")&&!document.hasFocus()&&Wt(`⚠️ ${c} — Long Running`,`Agent has been generating for over ${g.replace(/[()]/g,"")}`,`long-${s.ideId||s.agentType}`)}else if(s.event==="team:view_request"){const g=s.requesterName||"A team member",f=s.requestId,b=s.orgId;if(l=`👁️ ${g} wants to view your session`,x="warning",f&&b&&this.viewRequestRespondFn){const k=this.viewRequestRespondFn,S=Date.now(),h=[{label:"Approve",variant:"primary",onClick:()=>{k(b,f,"approve").catch(y=>console.error("[EventManager] approve view request failed:",y))}},{label:"Decline",variant:"danger",onClick:()=>{k(b,f,"reject").catch(y=>console.error("[EventManager] reject view request failed:",y))}}];this.emitToast({id:S,message:l,type:x,timestamp:S,actions:h,duration:3e4}),l=""}nt("browser")&&!document.hasFocus()&&Wt("👁️ View Request",`${g} wants to view your session`,`view-request-${f}`)}else s.event==="team:view_request_approved"?(l="✅ View request approved",x="success"):s.event==="team:view_request_rejected"&&(l=`❌ ${s.targetName||"Team member"} declined your view request`,x="warning");if(l){const g=Date.now();this.emitToast({id:g,message:l,type:x,timestamp:g,targetKey:r||s.ideId,duration:5e3})}}}const $e=new Br;function ze(...t){return mn(fn(t))}function Wr({icon:t,title:s,subtitle:n,badge:r,actions:a,className:i}){return e.jsxs("div",{className:ze("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})]}),a&&e.jsx("div",{className:"flex gap-2",children:a})]})}function Nt({icon:t,title:s,subtitle:n,badge:r,actions:a,widthClassName:i="max-w-6xl",contentClassName:c,children:u}){return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(Wr,{icon:t,title:s,subtitle:n,badge:r,actions:a}),e.jsx("div",{className:"page-content",children:e.jsx("div",{className:ze("mx-auto flex w-full flex-col gap-4",i,c),children:u})})]})}function fe({title:t,icon:s,description:n,accentColor:r,className:a,children:i}){return e.jsxs("div",{className:ze("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]",a),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 Vt({icon:t,title:s,description:n,action:r,className:a}){return e.jsxs("div",{className:ze("py-16 px-5 text-center bg-bg-glass border-2 border-dashed border-border-subtle rounded-2xl",a),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 Or={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"},Kr={error:"⚠️",warning:"🧪",success:"✅",info:"💡"};function zr({variant:t,children:s,onDismiss:n,className:r}){return e.jsxs("div",{className:ze("flex items-center justify-between gap-3 px-4 py-3 rounded-xl border text-[13px]",Or[t],r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:Kr[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 Hr={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"},Fr={online:"bg-green-500",idle:"bg-yellow-500",busy:"bg-orange-500",error:"bg-red-500",offline:"bg-gray-500"};function Ur({status:t,label:s,className:n}){const r=s||t;return e.jsxs("span",{className:ze("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",Hr[t],n),children:[e.jsx("span",{className:ze("w-2 h-2 rounded-full animate-[pulse-dot_2s_ease-in-out_infinite]",Fr[t])}),r]})}function Vr(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function Ot(){try{const t=localStorage.getItem("theme");if(t==="dark"||t==="light"||t==="system")return t}catch{}return"dark"}function yt(t){return t==="system"?Vr():t}function qr(){typeof document>"u"||document.documentElement.setAttribute("data-theme",yt(Ot()))}function Yr(){const[t,s]=o.useState(Ot),[n,r]=o.useState(()=>yt(Ot()));o.useEffect(()=>{document.documentElement.setAttribute("data-theme",n)},[n]),o.useEffect(()=>{const c=window.matchMedia("(prefers-color-scheme: light)"),u=l=>{t==="system"&&r(l.matches?"light":"dark")};return c.addEventListener("change",u),()=>c.removeEventListener("change",u)},[t]);const a=o.useCallback(c=>{s(c),r(yt(c));try{localStorage.setItem("theme",c)}catch{}},[]),i=o.useCallback(()=>{s(c=>{const u=c==="dark"?"light":c==="light"?"system":"dark";r(yt(u));try{localStorage.setItem("theme",u)}catch{}return u})},[]);return{theme:n,preference:t,setPreference:a,cycleTheme:i,isDark:n==="dark"}}function We({label:t,description:s,checked:n,disabled:r,onChange:a,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=>a(c.target.checked),className:"w-5 h-5 accent-accent"})]})]})}function Xr({onPrefChange:t}){const[s,n]=_r(),r=(a,i)=>{n({[a]:i}),t==null||t(a,i)};return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(_s,{size:15})," Notifications"]}),description:"Master toggle for all alerts",checked:s.globalEnabled,onChange:a=>r("globalEnabled",a)}),s.globalEnabled&&e.jsx("div",{className:"border-t border-border-subtle my-0.5"}),s.globalEnabled&&e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Le,{size:15})," Browser Notifications"]}),description:"Desktop alerts when tab is inactive",checked:s.browserNotifications,onChange:a=>r("browserNotifications",a)}),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(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(On,{size:15})," Completion Alerts"]}),description:"Notify when agent finishes a task",checked:s.completionAlert,onChange:a=>r("completionAlert",a)}),e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Kn,{size:15})," Approval Alerts"]}),description:"Notify when agent needs approval",checked:s.approvalAlert,onChange:a=>r("approvalAlert",a)}),e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ye,{size:15})," Connection Alerts"]}),description:"Alert when a daemon disconnects",checked:s.disconnectAlert,onChange:a=>r("disconnectAlert",a)})]}),s.globalEnabled&&e.jsx("div",{className:"border-t border-border-subtle my-2"}),s.globalEnabled&&e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(qe,{size:15})," Task Completion Bubble"]}),description:"Show a system message bubble in chat when an agent finishes a task",checked:s.chatTaskCompletionBubble,onChange:a=>r("chatTaskCompletionBubble",a)}),!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 Gr({ides:t,emptyMessage:s,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:a}){const i=t.filter(c=>c.type==="adhdev-daemon");return i.length===0?e.jsx(Vt,{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(Zr,{ide:c,allIdes:t,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:a},c.id))})}function os({title:t,message:s,confirmLabel:n,confirmColor:r,onConfirm:a,onCancel:i}){const c=r==="red"?"bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30":"";return gn.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:u=>u.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:a,className:`text-xs px-3 py-1.5 rounded-lg font-medium border transition-colors ${c}`,style:r==="amber"?{background:"color-mix(in srgb, var(--status-warning) 20%, transparent)",color:"var(--status-warning)",borderColor:"color-mix(in srgb, var(--status-warning) 30%, transparent)"}:void 0,children:n})]})]})}),document.body)}function Jr(t){const s=t.replace(/^ide-/,"").replace(/-provider$/,"").toLowerCase(),r=[...Vs,...qs,...Ys].find(a=>a.id===s||s.includes(a.id)||a.id.includes(s));return r?{icon:r.icon,name:r.name}:{icon:"📝",name:t}}function Zr({ide:t,allIdes:s,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:a}){var P,K;const[i,c]=o.useState("idle"),[u,l]=o.useState(""),[x,d]=o.useState(null),[p,g]=o.useState("idle"),[f,b]=o.useState(""),k=t,S=k.version||k.daemonVersion||null,h=((P=k.machine)==null?void 0:P.platform)||((K=k.system)==null?void 0:K.platform)||"",y=Xe(k,{fallbackId:t.id}),N=h==="win32"?"🪟":h==="darwin"?"🍎":"🐧",T=s.filter(C=>C.daemonId===t.id&&C.transport==="cdp-page"),m=s.filter(C=>C.daemonId===t.id&&C.transport==="pty"),j=s.filter(C=>C.daemonId===t.id&&C.transport==="acp"),v=k.p2p,w=async()=>{var C,F,Q;if(n){c("upgrading"),l("Installing latest version...");try{const J=await n(t.id,"daemon_upgrade",{});(C=J==null?void 0:J.result)!=null&&C.upgraded||(F=J==null?void 0:J.result)!=null&&F.success?(c("done"),l(`Upgraded to v${J.result.version||"latest"}. Daemon is restarting...`)):(c("error"),l(((Q=J==null?void 0:J.result)==null?void 0:Q.error)||"Upgrade failed"))}catch(J){c("error"),l((J==null?void 0:J.message)||"Connection lost during upgrade")}}},R=async()=>{if(d(null),!!r){g("loading");try{await r(t.id),g("done"),b("Machine disconnected.")}catch(C){g("error"),b((C==null?void 0:C.message)||"Failed to disconnect")}}},A=async()=>{if(d(null),!!a){g("loading");try{await a(t.id),g("done"),b('Token revoked. Machine must restart "adhdev-standalone" to reconnect.')}catch(C){g("error"),b((C==null?void 0:C.message)||"Failed to revoke token")}}},O="0.7.23",_=!S||S!==O,I=T.length+m.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:N}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:y}),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),"…"]}),S&&e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${_?"":"bg-bg-secondary"}`,style:_?{background:"color-mix(in srgb, var(--status-warning) 15%, transparent)",color:"var(--status-warning)"}:void 0,children:["v",S,!_&&" ✓"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&_&&e.jsx("button",{onClick:w,disabled:i==="upgrading"||i==="done",className:"btn btn-sm btn-primary disabled:opacity-50 disabled:cursor-not-allowed",title:`Update to v${O}`,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${O}`}`}),r&&e.jsx("button",{onClick:()=>d("disconnect"),disabled:p==="loading",className:"btn btn-sm btn-warning disabled:opacity-50 disabled:cursor-not-allowed",title:"Disconnect this machine",children:"Disconnect"}),a&&e.jsx("button",{onClick:()=>d("revoke"),disabled:p==="loading",className:"btn btn-sm btn-danger disabled:opacity-50 disabled:cursor-not-allowed",title:"Remove machine (requires re-setup)",children:"Remove"}),e.jsx(Ur,{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:[v&&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 ${v.state==="connected"?"bg-green-400":"bg-text-muted/30"} ${v.state==="connecting"||v.state==="new"?"animate-pulse":""}`,style:v.state==="connecting"||v.state==="new"?{background:"var(--status-warning)"}:void 0}),e.jsxs("span",{className:"text-text-muted",children:["P2P ",v.state==="connected"?"connected":v.state==="connecting"||v.state==="new"?"connecting...":v.state||"off"]}),v.peers!==void 0&&v.peers>0&&e.jsxs("span",{className:"text-text-muted/60",children:["(",v.peers," peer",v.peers!==1?"s":"",")"]})]}),v&&I>0&&e.jsx("span",{className:"text-border-subtle",children:"·"}),I>0?e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[T.map(C=>{const F=Jr(C.type),Q=C.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:F.icon}),e.jsx("span",{children:F.name}),Q!==void 0&&e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Q?"bg-green-400":"animate-pulse"}`,style:Q?void 0:{background:"var(--status-warning)"},title:Q?"CDP connected":"CDP connecting..."})]},C.id)}),m.map(C=>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:C.cliName||"CLI"})]},C.id)),j.map(C=>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:C.cliName||"ACP"})]},C.id))]}):e.jsx("span",{className:"text-[11px] text-text-muted/60 italic",children:"No IDEs connected"})]}),(u||f)&&e.jsx("div",{className:`text-xs mt-2 px-1 ${i==="error"||p==="error"?"text-red-400":i==="done"||p==="done"?"text-green-400":"text-text-muted"}`,children:f||u})]}),x==="disconnect"&&e.jsx(os,{title:"🔌 Disconnect Machine",message:`Disconnect "${y}" from ADHDev?
|
|
42
|
+
${f}`,_localId:`sys_approval_${Date.now()}`})}if((p=s.modalButtons)!=null&&p.length&&this.resolveActionFn){const g=this.resolveActionRouteTarget(s);if(!g)return;const f=s.agentType||s.ideType||"",b=s.ideType||"",k=s.modalButtons,S=m=>m.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim(),h=this.resolveActionFn,y=k.map((m,j)=>{const v=S(m).toLowerCase(),w=/^(run|approve|accept|yes|allow|always)/.test(v),R=/^(reject|deny|delete|remove|abort|cancel|no)/.test(v);return{label:S(m),variant:w?"primary":R?"danger":"default",onClick:()=>{const A=/^(run|approve|accept|yes|allow|always|proceed|save)/.test(v);h(g,"resolve_action",{action:A?"approve":"reject",button:m,buttonIndex:j,agentType:f,ideType:b,...s.targetSessionId&&{targetSessionId:s.targetSessionId}})}}}),N=s.modalMessage?`⚡ ${c}: ${s.modalMessage.replace(/[\n\r]+/g," ").slice(0,80)}`:l,T=Date.now();this.emitToast({id:T,message:N,type:x,timestamp:T,targetKey:r||g,actions:y,duration:15e3}),l=""}}else if(s.event==="monitor:long_generating"){const g=s.elapsedSec?` (${Math.round(s.elapsedSec/60)}m)`:"";l=`⚠️ ${c} agent is taking a long time${g}`,x="warning",nt("browser")&&!document.hasFocus()&&Wt(`⚠️ ${c} — Long Running`,`Agent has been generating for over ${g.replace(/[()]/g,"")}`,`long-${s.ideId||s.agentType}`)}else if(s.event==="team:view_request"){const g=s.requesterName||"A team member",f=s.requestId,b=s.orgId;if(l=`👁️ ${g} wants to view your session`,x="warning",f&&b&&this.viewRequestRespondFn){const k=this.viewRequestRespondFn,S=Date.now(),h=[{label:"Approve",variant:"primary",onClick:()=>{k(b,f,"approve").catch(y=>console.error("[EventManager] approve view request failed:",y))}},{label:"Decline",variant:"danger",onClick:()=>{k(b,f,"reject").catch(y=>console.error("[EventManager] reject view request failed:",y))}}];this.emitToast({id:S,message:l,type:x,timestamp:S,actions:h,duration:3e4}),l=""}nt("browser")&&!document.hasFocus()&&Wt("👁️ View Request",`${g} wants to view your session`,`view-request-${f}`)}else s.event==="team:view_request_approved"?(l="✅ View request approved",x="success"):s.event==="team:view_request_rejected"&&(l=`❌ ${s.targetName||"Team member"} declined your view request`,x="warning");if(l){const g=Date.now();this.emitToast({id:g,message:l,type:x,timestamp:g,targetKey:r||s.ideId,duration:5e3})}}}const $e=new Br;function ze(...t){return mn(fn(t))}function Wr({icon:t,title:s,subtitle:n,badge:r,actions:a,className:i}){return e.jsxs("div",{className:ze("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})]}),a&&e.jsx("div",{className:"flex gap-2",children:a})]})}function Nt({icon:t,title:s,subtitle:n,badge:r,actions:a,widthClassName:i="max-w-6xl",contentClassName:c,children:u}){return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(Wr,{icon:t,title:s,subtitle:n,badge:r,actions:a}),e.jsx("div",{className:"page-content",children:e.jsx("div",{className:ze("mx-auto flex w-full flex-col gap-4",i,c),children:u})})]})}function fe({title:t,icon:s,description:n,accentColor:r,className:a,children:i}){return e.jsxs("div",{className:ze("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]",a),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 Vt({icon:t,title:s,description:n,action:r,className:a}){return e.jsxs("div",{className:ze("py-16 px-5 text-center bg-bg-glass border-2 border-dashed border-border-subtle rounded-2xl",a),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 Or={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"},Kr={error:"⚠️",warning:"🧪",success:"✅",info:"💡"};function zr({variant:t,children:s,onDismiss:n,className:r}){return e.jsxs("div",{className:ze("flex items-center justify-between gap-3 px-4 py-3 rounded-xl border text-[13px]",Or[t],r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:Kr[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 Hr={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"},Fr={online:"bg-green-500",idle:"bg-yellow-500",busy:"bg-orange-500",error:"bg-red-500",offline:"bg-gray-500"};function Ur({status:t,label:s,className:n}){const r=s||t;return e.jsxs("span",{className:ze("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",Hr[t],n),children:[e.jsx("span",{className:ze("w-2 h-2 rounded-full animate-[pulse-dot_2s_ease-in-out_infinite]",Fr[t])}),r]})}function Vr(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function Ot(){try{const t=localStorage.getItem("theme");if(t==="dark"||t==="light"||t==="system")return t}catch{}return"dark"}function yt(t){return t==="system"?Vr():t}function qr(){typeof document>"u"||document.documentElement.setAttribute("data-theme",yt(Ot()))}function Yr(){const[t,s]=o.useState(Ot),[n,r]=o.useState(()=>yt(Ot()));o.useEffect(()=>{document.documentElement.setAttribute("data-theme",n)},[n]),o.useEffect(()=>{const c=window.matchMedia("(prefers-color-scheme: light)"),u=l=>{t==="system"&&r(l.matches?"light":"dark")};return c.addEventListener("change",u),()=>c.removeEventListener("change",u)},[t]);const a=o.useCallback(c=>{s(c),r(yt(c));try{localStorage.setItem("theme",c)}catch{}},[]),i=o.useCallback(()=>{s(c=>{const u=c==="dark"?"light":c==="light"?"system":"dark";r(yt(u));try{localStorage.setItem("theme",u)}catch{}return u})},[]);return{theme:n,preference:t,setPreference:a,cycleTheme:i,isDark:n==="dark"}}function We({label:t,description:s,checked:n,disabled:r,onChange:a,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=>a(c.target.checked),className:"w-5 h-5 accent-accent"})]})]})}function Xr({onPrefChange:t}){const[s,n]=_r(),r=(a,i)=>{n({[a]:i}),t==null||t(a,i)};return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(_s,{size:15})," Notifications"]}),description:"Master toggle for all alerts",checked:s.globalEnabled,onChange:a=>r("globalEnabled",a)}),s.globalEnabled&&e.jsx("div",{className:"border-t border-border-subtle my-0.5"}),s.globalEnabled&&e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Le,{size:15})," Browser Notifications"]}),description:"Desktop alerts when tab is inactive",checked:s.browserNotifications,onChange:a=>r("browserNotifications",a)}),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(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(On,{size:15})," Completion Alerts"]}),description:"Notify when agent finishes a task",checked:s.completionAlert,onChange:a=>r("completionAlert",a)}),e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Kn,{size:15})," Approval Alerts"]}),description:"Notify when agent needs approval",checked:s.approvalAlert,onChange:a=>r("approvalAlert",a)}),e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ye,{size:15})," Connection Alerts"]}),description:"Alert when a daemon disconnects",checked:s.disconnectAlert,onChange:a=>r("disconnectAlert",a)})]}),s.globalEnabled&&e.jsx("div",{className:"border-t border-border-subtle my-2"}),s.globalEnabled&&e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(qe,{size:15})," Task Completion Bubble"]}),description:"Show a system message bubble in chat when an agent finishes a task",checked:s.chatTaskCompletionBubble,onChange:a=>r("chatTaskCompletionBubble",a)}),!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 Gr({ides:t,emptyMessage:s,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:a}){const i=t.filter(c=>c.type==="adhdev-daemon");return i.length===0?e.jsx(Vt,{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(Zr,{ide:c,allIdes:t,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:a},c.id))})}function os({title:t,message:s,confirmLabel:n,confirmColor:r,onConfirm:a,onCancel:i}){const c=r==="red"?"bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30":"";return gn.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:u=>u.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:a,className:`text-xs px-3 py-1.5 rounded-lg font-medium border transition-colors ${c}`,style:r==="amber"?{background:"color-mix(in srgb, var(--status-warning) 20%, transparent)",color:"var(--status-warning)",borderColor:"color-mix(in srgb, var(--status-warning) 30%, transparent)"}:void 0,children:n})]})]})}),document.body)}function Jr(t){const s=t.replace(/^ide-/,"").replace(/-provider$/,"").toLowerCase(),r=[...Vs,...qs,...Ys].find(a=>a.id===s||s.includes(a.id)||a.id.includes(s));return r?{icon:r.icon,name:r.name}:{icon:"📝",name:t}}function Zr({ide:t,allIdes:s,sendDaemonCommand:n,onDisconnect:r,onRevokeToken:a}){var P,K;const[i,c]=o.useState("idle"),[u,l]=o.useState(""),[x,d]=o.useState(null),[p,g]=o.useState("idle"),[f,b]=o.useState(""),k=t,S=k.version||k.daemonVersion||null,h=((P=k.machine)==null?void 0:P.platform)||((K=k.system)==null?void 0:K.platform)||"",y=Xe(k,{fallbackId:t.id}),N=h==="win32"?"🪟":h==="darwin"?"🍎":"🐧",T=s.filter(C=>C.daemonId===t.id&&C.transport==="cdp-page"),m=s.filter(C=>C.daemonId===t.id&&C.transport==="pty"),j=s.filter(C=>C.daemonId===t.id&&C.transport==="acp"),v=k.p2p,w=async()=>{var C,F,Q;if(n){c("upgrading"),l("Installing latest version...");try{const J=await n(t.id,"daemon_upgrade",{});(C=J==null?void 0:J.result)!=null&&C.upgraded||(F=J==null?void 0:J.result)!=null&&F.success?(c("done"),l(`Upgraded to v${J.result.version||"latest"}. Daemon is restarting...`)):(c("error"),l(((Q=J==null?void 0:J.result)==null?void 0:Q.error)||"Upgrade failed"))}catch(J){c("error"),l((J==null?void 0:J.message)||"Connection lost during upgrade")}}},R=async()=>{if(d(null),!!r){g("loading");try{await r(t.id),g("done"),b("Machine disconnected.")}catch(C){g("error"),b((C==null?void 0:C.message)||"Failed to disconnect")}}},A=async()=>{if(d(null),!!a){g("loading");try{await a(t.id),g("done"),b('Token revoked. Machine must restart "adhdev-standalone" to reconnect.')}catch(C){g("error"),b((C==null?void 0:C.message)||"Failed to revoke token")}}},O="0.7.24",_=!S||S!==O,I=T.length+m.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:N}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:y}),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),"…"]}),S&&e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${_?"":"bg-bg-secondary"}`,style:_?{background:"color-mix(in srgb, var(--status-warning) 15%, transparent)",color:"var(--status-warning)"}:void 0,children:["v",S,!_&&" ✓"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&_&&e.jsx("button",{onClick:w,disabled:i==="upgrading"||i==="done",className:"btn btn-sm btn-primary disabled:opacity-50 disabled:cursor-not-allowed",title:`Update to v${O}`,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${O}`}`}),r&&e.jsx("button",{onClick:()=>d("disconnect"),disabled:p==="loading",className:"btn btn-sm btn-warning disabled:opacity-50 disabled:cursor-not-allowed",title:"Disconnect this machine",children:"Disconnect"}),a&&e.jsx("button",{onClick:()=>d("revoke"),disabled:p==="loading",className:"btn btn-sm btn-danger disabled:opacity-50 disabled:cursor-not-allowed",title:"Remove machine (requires re-setup)",children:"Remove"}),e.jsx(Ur,{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:[v&&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 ${v.state==="connected"?"bg-green-400":"bg-text-muted/30"} ${v.state==="connecting"||v.state==="new"?"animate-pulse":""}`,style:v.state==="connecting"||v.state==="new"?{background:"var(--status-warning)"}:void 0}),e.jsxs("span",{className:"text-text-muted",children:["P2P ",v.state==="connected"?"connected":v.state==="connecting"||v.state==="new"?"connecting...":v.state||"off"]}),v.peers!==void 0&&v.peers>0&&e.jsxs("span",{className:"text-text-muted/60",children:["(",v.peers," peer",v.peers!==1?"s":"",")"]})]}),v&&I>0&&e.jsx("span",{className:"text-border-subtle",children:"·"}),I>0?e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[T.map(C=>{const F=Jr(C.type),Q=C.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:F.icon}),e.jsx("span",{children:F.name}),Q!==void 0&&e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Q?"bg-green-400":"animate-pulse"}`,style:Q?void 0:{background:"var(--status-warning)"},title:Q?"CDP connected":"CDP connecting..."})]},C.id)}),m.map(C=>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:C.cliName||"CLI"})]},C.id)),j.map(C=>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:C.cliName||"ACP"})]},C.id))]}):e.jsx("span",{className:"text-[11px] text-text-muted/60 italic",children:"No IDEs connected"})]}),(u||f)&&e.jsx("div",{className:`text-xs mt-2 px-1 ${i==="error"||p==="error"?"text-red-400":i==="done"||p==="done"?"text-green-400":"text-text-muted"}`,children:f||u})]}),x==="disconnect"&&e.jsx(os,{title:"🔌 Disconnect Machine",message:`Disconnect "${y}" from ADHDev?
|
|
43
43
|
|
|
44
44
|
This will close the server connection. The daemon process will continue running on the machine and will automatically reconnect.
|
|
45
45
|
|
|
@@ -65,4 +65,4 @@ This will disconnect CDP and optionally kill the process.`))try{const L=await n(
|
|
|
65
65
|
from { opacity: 0; transform: translateX(40px); }
|
|
66
66
|
to { opacity: 1; transform: translateX(0); }
|
|
67
67
|
}
|
|
68
|
-
`})]})}function mo(){const[t,s]=o.useState({ide:[],cli:[],ext:[],acp:[]}),[n,r]=o.useState(!0);o.useEffect(()=>{fetch("https://raw.githubusercontent.com/vilmire/adhdev-providers/main/registry.json").then(c=>c.json()).then(c=>{const u=[],l=[],x=[],d=[];Object.values(c.providers||{}).forEach(g=>{const f={name:g.name||"Unknown",status:g.status||"Stable",details:g.details||"Community Provider"};g.category==="ide"?u.push(f):g.category==="cli"?l.push(f):g.category==="extension"?x.push(f):g.category==="acp"&&d.push(f)});const p=(g,f)=>{const b={Stable:1,Beta:2,WIP:3},k=b[g.status]||99,S=b[f.status]||99;return k!==S?k-S:g.name.localeCompare(f.name)};s({ide:u.sort(p),cli:l.sort(p),ext:x.sort(p),acp:d.sort(p)})}).catch(c=>console.error("Failed to load capabilities:",c)).finally(()=>r(!1))},[]);const a=c=>c==="Stable"?e.jsxs("div",{className:"flex items-center gap-1.5 text-success",children:[e.jsx(Cs,{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(Ft,{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(Es,{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((u,l)=>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:u.name}),e.jsx("td",{className:"py-3 px-4",children:a(u.status)}),e.jsx("td",{className:"py-3 px-4 text-text-muted",children:u.details})]},l))})]})});return n?e.jsx(Nt,{title:"Capabilities",subtitle:"Provider registry coverage for IDEs, CLI agents, extensions, and ACPs",icon:e.jsx(wt,{}),widthClassName:"max-w-5xl",children:e.jsx(Vt,{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(Nt,{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(fe,{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(fe,{title:"IDE support",icon:e.jsx(Le,{className:"w-4 h-4"}),description:"Desktop editors and IDE surfaces with registry-backed providers.",children:i(t.ide)}),e.jsx(fe,{title:"Standalone CLI agents",icon:e.jsx(Ut,{className:"w-4 h-4"}),description:"CLI-first agents that can participate in the standalone dashboard.",children:i(t.cli)}),e.jsx(fe,{title:"AI extensions",icon:e.jsx(Ye,{className:"w-4 h-4"}),description:"IDE extensions and companion integrations available in the registry.",children:i(t.ext)}),e.jsx(fe,{title:`ACP agents (${t.acp.length} loaded)`,icon:e.jsx(Ye,{className:"w-4 h-4"}),description:"ACP-backed providers discovered through the same shared registry.",children:i(t.acp)})]})}class fo{constructor(){ue(this,"adapters",new Map);ue(this,"states",new Map);ue(this,"ptyCallbacks",new Set);ue(this,"runtimeListeners",new Map);ue(this,"runtimeBuffers",new Map);ue(this,"runtimeSeqs",new Map);ue(this,"screenshotCallbacks",new Map);ue(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,a){return!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,r){if(r!=null&&r.scrollback){const a=(this.runtimeSeqs.get(s)||0)+1;this.runtimeBuffers.set(s,typeof n=="string"?n:""),this.runtimeSeqs.set(s,a),this.emitRuntimeEvent(s,{type:"runtime_snapshot",sessionId:s,seq:a,text:typeof n=="string"?n:"",truncated:!1})}else if(typeof n=="string"&&n){const i=(this.runtimeBuffers.get(s)||"")+n,c=i.length>64*1024?i.slice(-65536):i,u=(this.runtimeSeqs.get(s)||0)+1;this.runtimeBuffers.set(s,c),this.runtimeSeqs.set(s,u),this.emitRuntimeEvent(s,{type:"session_output",sessionId:s,seq:u,data:n})}this.ptyCallbacks.forEach(a=>a(s,n,r))}emitRuntimeSnapshot(s,n,r=0,a=!1){this.runtimeBuffers.set(s,n),this.runtimeSeqs.set(s,r),this.emitRuntimeEvent(s,{type:"runtime_snapshot",sessionId:s,seq:r,text:n,truncated:a})}getRuntimeSnapshot(s){return Promise.resolve({sessionId:s,seq:this.runtimeSeqs.get(s)||0,text:this.runtimeBuffers.get(s)||"",truncated:!1})}onRuntimeEvent(s,n){const r=this.runtimeListeners.get(s)||new Set;return r.add(n),this.runtimeListeners.set(s,r),()=>{const a=this.runtimeListeners.get(s);a&&(a.delete(n),a.size===0&&this.runtimeListeners.delete(s))}}emitRuntimeEvent(s,n){var r;(r=this.runtimeListeners.get(s))==null||r.forEach(a=>a(n))}}const Ae=new fo;function go(){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 xs=go(),ps=3e3,bo=3e4;let Re=null,yo=0;const Ct=new Map;let Be=null,at=null;function jo(t){return t==="connected"?"connected":t}async function vt(t,s,n){const r=Ir(t,n||{}),a=Re;if(a&&a.readyState===WebSocket.OPEN){const c=`req_${++yo}_${Date.now()}`;return new Promise((u,l)=>{const x=setTimeout(()=>{Ct.delete(c),l(new Error(`WS command timeout: ${s}`))},3e4);Ct.set(c,{resolve:d=>{clearTimeout(x),u(d)},reject:d=>{clearTimeout(x),l(d)}}),a.send(JSON.stringify({type:"command",requestId:c,data:{type:s,payload:r.payload}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s,payload:r.payload})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class vo{constructor(s){ue(this,"daemonId");ue(this,"screenshotIdeType",null);this.daemonId=s}get hasCommandChannel(){return(Re==null?void 0:Re.readyState)===WebSocket.OPEN}get connectionState(){return(Re==null?void 0:Re.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(s,n){return vt(this.daemonId,s,n)}async sendInput(s,n){return vt(this.daemonId,"cdp_remote_action",{action:s,params:n,...this.screenshotIdeType&&{targetSessionId:this.screenshotIdeType}})}startScreenshots(s){this.screenshotIdeType=s||null,Be&&(clearInterval(Be),Be=null);const n=async()=>{if(this.hasCommandChannel)try{const r=await vt(this.daemonId,"screenshot",{width:1280,...this.screenshotIdeType&&{targetSessionId:this.screenshotIdeType}});if(r!=null&&r.success&&(r!=null&&r.base64)){const a=await fetch(`data:image/jpeg;base64,${r.base64}`).then(i=>i.blob());Ae.emitScreenshot(this.daemonId,a)}}catch{}};n(),Be=setInterval(n,2e3)}stopScreenshots(s){Be&&(clearInterval(Be),Be=null)}}let ke=null;function wo(t){return(!ke||ke.daemonId!==t)&&(ke=new vo(t)),ke}function No({children:t}){const s=o.useRef(Xt()),n=Xt();s.current=n;const{setUserName:r}=ot(),a=o.useRef(r);a.current=r;const[,i]=o.useState("disconnected"),c=o.useCallback((g,f)=>{i(g),at==null||at(g,f)},[]),u=o.useRef(null),l=o.useRef(),x=o.useRef(ps),d=o.useRef(!0),p=o.useRef(!1);return o.useEffect(()=>{d.current=!0,p.current=!1;function g(){var k,S;if(!d.current||((k=u.current)==null?void 0:k.readyState)===WebSocket.OPEN||((S=u.current)==null?void 0:S.readyState)===WebSocket.CONNECTING)return;c("connecting"),console.log(`[Standalone WS] Connecting to ${xs}...`);let b;try{b=new WebSocket(xs)}catch(h){console.error("[Standalone WS] Failed to create WebSocket:",h),f();return}u.current=b,b.onopen=()=>{if(!d.current){b.close();return}c("connected"),x.current=ps,console.log("[Standalone WS] Connected")},Re=b,b.onmessage=h=>{var y;try{const N=JSON.parse(h.data);if((N.type==="command_result"||N.type==="error")&&N.requestId){const T=Ct.get(N.requestId);T&&(Ct.delete(N.requestId),N.type==="error"?T.reject(new Error(((y=N.data)==null?void 0:y.message)||"Command failed")):T.resolve(N.data));return}if(N.type==="pty_output"){Ae.emitPtyOutput(N.cliId,N.data);return}if(N.type==="runtime_snapshot"){Ae.emitRuntimeSnapshot(N.sessionId,typeof N.text=="string"?N.text:"",typeof N.seq=="number"?N.seq:0,!!N.truncated);return}if(N.type==="status"||N.type==="initial_state"){const T=N.data;if(!T)return;const{injectEntries:m,markLoaded:j}=s.current,v=T.id||"standalone",w=wo(v);Ae.register(v,w),Ae.setState(v,"connected"),c("connected",v),Ae.emitStatus(v,T);const R=Cr(T,{daemonId:v});R.length>0&&m(R),j(),T.userName&&a.current&&a.current(T.userName)}}catch(N){console.error("[Standalone WS] Parse error:",N)}},b.onclose=()=>{d.current&&(ke==null||ke.stopScreenshots(),ke&&Ae.setState(ke.daemonId,"disconnected"),c("disconnected"),u.current=null,f())},b.onerror=h=>{p.current||!d.current||console.warn("[Standalone WS] Error, will reconnect:",h)}}function f(){if(!d.current)return;clearTimeout(l.current);const b=x.current;console.log(`[Standalone WS] Reconnecting in ${b}ms...`),l.current=setTimeout(()=>{x.current=Math.min(x.current*1.5,bo),g()},b)}return g(),()=>{d.current=!1,p.current=!0,clearTimeout(l.current),u.current&&(u.current.onerror=null,u.current.onclose=null,u.current.close(),u.current=null,Re=null),ke&&(ke.stopScreenshots(),Ae.unregister(ke.daemonId))}},[]),e.jsx(e.Fragment,{children:t})}function ko({children:t}){const[s,n]=o.useState("disconnected"),[r,a]=o.useState(null);o.useEffect(()=>(at=(c,u)=>{n(c),u&&a(u)},()=>{at=null}),[]);const i=o.useMemo(()=>{const c=s==="connected",u=jo(s),l={};return r&&(l[r]=u),l.standalone=u,{wsStatus:s,isConnected:c,connectionStates:l}},[s,r]);return e.jsx(Cn,{connectionOverrides:i,children:e.jsx(No,{children:t})})}const So=[{id:"dashboard",path:"/dashboard",icon:e.jsx(Ns,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:e.jsx(ks,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:e.jsx(Ht,{}),label:"Settings"}];function Co({children:t}){const s=it(),n=yn(),[r,a]=o.useState(!1),[i,c]=o.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),u=d=>{s(d),a(!1)},l=()=>{c(d=>{const p=!d;try{localStorage.setItem("sidebar-collapsed",p?"1":"0")}catch{}return p})},x=d=>`nav-item${n.pathname.startsWith(d)?" 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:()=>a(!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:()=>a(!1),onKeyDown:d=>d.key==="Escape"&&a(!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:()=>a(!1),children:"✕"})]}),e.jsx("nav",{className:"sidebar-nav",children:So.map(d=>e.jsxs("div",{className:x(d.path),id:`nav-${d.id}`,onClick:()=>u(d.path),title:i?d.label:void 0,children:[e.jsx("span",{className:"nav-icon",children:d.icon}),!i&&d.label]},d.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(Ss,{})}),!i&&"About"]}),!i&&e.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.7.23"]}),e.jsxs("div",{className:`nav-item cursor-pointer ${i?"justify-center py-2.5 px-0":"mt-1"}`,onClick:l,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 Io=[{icon:e.jsx(ks,{size:16}),title:"Local-first runtime",desc:"Everything stays on your machine and the browser only connects over localhost."},{icon:e.jsx(qe,{size:16}),title:"Agent chat relay",desc:"Read and respond to AI conversations in real time across connected IDEs."},{icon:e.jsx(Ts,{size:16}),title:"Live screenshots",desc:"View your IDE directly in the browser through the local screenshot stream."},{icon:e.jsx(Le,{size:16}),title:"Remote control",desc:"Click, type, and steer your IDE sessions without switching windows."},{icon:e.jsx(Ye,{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."}],Mo=[{icon:e.jsx(As,{size:16}),title:"Access from anywhere",desc:"Reach your burrows from another laptop or phone without opening local ports."},{icon:e.jsx(Ns,{size:16}),title:"Low-latency P2P stream",desc:"Cloud adds the WebRTC path for faster screenshots and remote control."},{icon:e.jsx(_s,{size:16}),title:"Mobile notifications",desc:"Get approval prompts and activity updates when you are away from your desk."},{icon:e.jsx(Ln,{size:16}),title:"REST API access",desc:"Integrate with Slack, CI, or internal tools using API keys and service routes."},{icon:e.jsx(Rn,{size:16}),title:"Team workspace",desc:"Share burrows, activity views, and policies across a team workspace."},{icon:e.jsx(Cs,{size:16}),title:"Enterprise controls",desc:"SSO, RBAC, audit logs, and managed policy features for production teams."}],To=[{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 Eo(){return e.jsxs(Nt,{icon:e.jsx(Ss,{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.7.23"]}),children:[e.jsx(fe,{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(fe,{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:Io.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(fe,{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:Vs.map(t=>`${t.icon} ${t.name}`)},{label:"Extensions",items:Ys.map(t=>`${t.icon} ${t.name}`)},{label:"CLI agents",items:qs.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(fe,{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:Mo.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(fe,{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:To.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(Vt,{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(Hn,{size:14,className:"mr-1"}),"Discord ↗"]})]})})]})}function Ao(){const{ides:t}=ot(),s=t.find(p=>p.type==="adhdev-daemon"),n=(s==null?void 0:s.detectedIdes)||[],{sendCommand:r}=Pe(),{userName:a}=ot(),[i,c]=o.useState(a||"");o.useEffect(()=>{a!==void 0&&c(a)},[a]);const u=p=>{const g=p.target.value.trim();s!=null&&s.id&&g!==a&&r(s.id,"set_user_name",{userName:g}).catch(console.error)},[l,x]=o.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),d=p=>{x(p);try{localStorage.setItem("adhdev_sound",p?"1":"0")}catch{}};return e.jsxs(Nt,{icon:e.jsx(Ht,{className:"text-text-primary"}),title:"Settings",subtitle:"Local daemon configuration, appearance, and on-device preferences",widthClassName:"max-w-5xl",children:[e.jsx(zr,{variant:"info",children:"Standalone settings stay on this machine. The browser only talks to your local daemon over localhost."}),e.jsx(fe,{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.7.23"]}),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(fe,{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(p=>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 ${p.running?"bg-green-400":"bg-text-muted/30"}`}),e.jsx("span",{className:"text-sm font-medium",children:p.name})]}),e.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:p.type})]},p.type))})}),e.jsx(fe,{title:"Machine",description:"The local burrow exposed by your standalone daemon.",children:e.jsx(Gr,{ides:t,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),e.jsx(fe,{title:"Appearance",description:"Match the rest of the dashboard with a single place for mode and theme.",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(ea,{})]}),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, accent, and chat palette for the standalone UI."}),e.jsx(oa,{})]})]})}),e.jsx(fe,{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(Xr,{}),e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(zn,{size:15})," Sound Effects"]}),description:"Play a sound when agent completes or needs approval",checked:l,onChange:d})]})}),e.jsx(fe,{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(_n,{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:p=>c(p.target.value),onBlur:u,onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})]})})})]})}qr();ra();const Ro=vs({baseUrl:""});function hs(){const{ides:t}=ot(),s=t.find(n=>{var r;return n.daemonMode||((r=n.id)==null?void 0:r.startsWith("standalone"))});return s?e.jsx(gt,{to:`/machines/${s.id}`,replace:!0}):t.length>0?e.jsx(gt,{to:`/machines/${t[0].id}`,replace:!0}):e.jsx(gt,{to:"/dashboard",replace:!0})}function _o(){return e.jsx(jn,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:e.jsx(Tn,{client:Ro,children:e.jsx(ko,{children:e.jsx(An,{value:{sendCommand:vt,sendData:()=>!1},children:e.jsx(Co,{children:e.jsxs(vn,{children:[e.jsx(Ee,{path:"/dashboard",element:e.jsx(qa,{})}),e.jsx(Ee,{path:"/ide/:id",element:e.jsx(to,{})}),e.jsx(Ee,{path:"/machine",element:e.jsx(hs,{})}),e.jsx(Ee,{path:"/machines/:id",element:e.jsx(ho,{})}),e.jsx(Ee,{path:"/machines",element:e.jsx(hs,{})}),e.jsx(Ee,{path:"/capabilities",element:e.jsx(mo,{})}),e.jsx(Ee,{path:"/about",element:e.jsx(Eo,{})}),e.jsx(Ee,{path:"/settings",element:e.jsx(Ao,{})}),e.jsx(Ee,{path:"*",element:e.jsx(gt,{to:"/dashboard",replace:!0})})]})})})})})})}br({connectionManager:Ae});wn(document.getElementById("root")).render(e.jsx(o.StrictMode,{children:e.jsx(_o,{})}));
|
|
68
|
+
`})]})}function mo(){const[t,s]=o.useState({ide:[],cli:[],ext:[],acp:[]}),[n,r]=o.useState(!0);o.useEffect(()=>{fetch("https://raw.githubusercontent.com/vilmire/adhdev-providers/main/registry.json").then(c=>c.json()).then(c=>{const u=[],l=[],x=[],d=[];Object.values(c.providers||{}).forEach(g=>{const f={name:g.name||"Unknown",status:g.status||"Stable",details:g.details||"Community Provider"};g.category==="ide"?u.push(f):g.category==="cli"?l.push(f):g.category==="extension"?x.push(f):g.category==="acp"&&d.push(f)});const p=(g,f)=>{const b={Stable:1,Beta:2,WIP:3},k=b[g.status]||99,S=b[f.status]||99;return k!==S?k-S:g.name.localeCompare(f.name)};s({ide:u.sort(p),cli:l.sort(p),ext:x.sort(p),acp:d.sort(p)})}).catch(c=>console.error("Failed to load capabilities:",c)).finally(()=>r(!1))},[]);const a=c=>c==="Stable"?e.jsxs("div",{className:"flex items-center gap-1.5 text-success",children:[e.jsx(Cs,{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(Ft,{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(Es,{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((u,l)=>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:u.name}),e.jsx("td",{className:"py-3 px-4",children:a(u.status)}),e.jsx("td",{className:"py-3 px-4 text-text-muted",children:u.details})]},l))})]})});return n?e.jsx(Nt,{title:"Capabilities",subtitle:"Provider registry coverage for IDEs, CLI agents, extensions, and ACPs",icon:e.jsx(wt,{}),widthClassName:"max-w-5xl",children:e.jsx(Vt,{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(Nt,{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(fe,{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(fe,{title:"IDE support",icon:e.jsx(Le,{className:"w-4 h-4"}),description:"Desktop editors and IDE surfaces with registry-backed providers.",children:i(t.ide)}),e.jsx(fe,{title:"Standalone CLI agents",icon:e.jsx(Ut,{className:"w-4 h-4"}),description:"CLI-first agents that can participate in the standalone dashboard.",children:i(t.cli)}),e.jsx(fe,{title:"AI extensions",icon:e.jsx(Ye,{className:"w-4 h-4"}),description:"IDE extensions and companion integrations available in the registry.",children:i(t.ext)}),e.jsx(fe,{title:`ACP agents (${t.acp.length} loaded)`,icon:e.jsx(Ye,{className:"w-4 h-4"}),description:"ACP-backed providers discovered through the same shared registry.",children:i(t.acp)})]})}class fo{constructor(){ue(this,"adapters",new Map);ue(this,"states",new Map);ue(this,"ptyCallbacks",new Set);ue(this,"runtimeListeners",new Map);ue(this,"runtimeBuffers",new Map);ue(this,"runtimeSeqs",new Map);ue(this,"screenshotCallbacks",new Map);ue(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,a){return!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,r){if(r!=null&&r.scrollback){const a=(this.runtimeSeqs.get(s)||0)+1;this.runtimeBuffers.set(s,typeof n=="string"?n:""),this.runtimeSeqs.set(s,a),this.emitRuntimeEvent(s,{type:"runtime_snapshot",sessionId:s,seq:a,text:typeof n=="string"?n:"",truncated:!1})}else if(typeof n=="string"&&n){const i=(this.runtimeBuffers.get(s)||"")+n,c=i.length>64*1024?i.slice(-65536):i,u=(this.runtimeSeqs.get(s)||0)+1;this.runtimeBuffers.set(s,c),this.runtimeSeqs.set(s,u),this.emitRuntimeEvent(s,{type:"session_output",sessionId:s,seq:u,data:n})}this.ptyCallbacks.forEach(a=>a(s,n,r))}emitRuntimeSnapshot(s,n,r=0,a=!1){this.runtimeBuffers.set(s,n),this.runtimeSeqs.set(s,r),this.emitRuntimeEvent(s,{type:"runtime_snapshot",sessionId:s,seq:r,text:n,truncated:a})}getRuntimeSnapshot(s){return Promise.resolve({sessionId:s,seq:this.runtimeSeqs.get(s)||0,text:this.runtimeBuffers.get(s)||"",truncated:!1})}onRuntimeEvent(s,n){const r=this.runtimeListeners.get(s)||new Set;return r.add(n),this.runtimeListeners.set(s,r),()=>{const a=this.runtimeListeners.get(s);a&&(a.delete(n),a.size===0&&this.runtimeListeners.delete(s))}}emitRuntimeEvent(s,n){var r;(r=this.runtimeListeners.get(s))==null||r.forEach(a=>a(n))}}const Ae=new fo;function go(){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 xs=go(),ps=3e3,bo=3e4;let Re=null,yo=0;const Ct=new Map;let Be=null,at=null;function jo(t){return t==="connected"?"connected":t}async function vt(t,s,n){const r=Ir(t,n||{}),a=Re;if(a&&a.readyState===WebSocket.OPEN){const c=`req_${++yo}_${Date.now()}`;return new Promise((u,l)=>{const x=setTimeout(()=>{Ct.delete(c),l(new Error(`WS command timeout: ${s}`))},3e4);Ct.set(c,{resolve:d=>{clearTimeout(x),u(d)},reject:d=>{clearTimeout(x),l(d)}}),a.send(JSON.stringify({type:"command",requestId:c,data:{type:s,payload:r.payload}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s,payload:r.payload})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class vo{constructor(s){ue(this,"daemonId");ue(this,"screenshotIdeType",null);this.daemonId=s}get hasCommandChannel(){return(Re==null?void 0:Re.readyState)===WebSocket.OPEN}get connectionState(){return(Re==null?void 0:Re.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(s,n){return vt(this.daemonId,s,n)}async sendInput(s,n){return vt(this.daemonId,"cdp_remote_action",{action:s,params:n,...this.screenshotIdeType&&{targetSessionId:this.screenshotIdeType}})}startScreenshots(s){this.screenshotIdeType=s||null,Be&&(clearInterval(Be),Be=null);const n=async()=>{if(this.hasCommandChannel)try{const r=await vt(this.daemonId,"screenshot",{width:1280,...this.screenshotIdeType&&{targetSessionId:this.screenshotIdeType}});if(r!=null&&r.success&&(r!=null&&r.base64)){const a=await fetch(`data:image/jpeg;base64,${r.base64}`).then(i=>i.blob());Ae.emitScreenshot(this.daemonId,a)}}catch{}};n(),Be=setInterval(n,2e3)}stopScreenshots(s){Be&&(clearInterval(Be),Be=null)}}let ke=null;function wo(t){return(!ke||ke.daemonId!==t)&&(ke=new vo(t)),ke}function No({children:t}){const s=o.useRef(Xt()),n=Xt();s.current=n;const{setUserName:r}=ot(),a=o.useRef(r);a.current=r;const[,i]=o.useState("disconnected"),c=o.useCallback((g,f)=>{i(g),at==null||at(g,f)},[]),u=o.useRef(null),l=o.useRef(),x=o.useRef(ps),d=o.useRef(!0),p=o.useRef(!1);return o.useEffect(()=>{d.current=!0,p.current=!1;function g(){var k,S;if(!d.current||((k=u.current)==null?void 0:k.readyState)===WebSocket.OPEN||((S=u.current)==null?void 0:S.readyState)===WebSocket.CONNECTING)return;c("connecting"),console.log(`[Standalone WS] Connecting to ${xs}...`);let b;try{b=new WebSocket(xs)}catch(h){console.error("[Standalone WS] Failed to create WebSocket:",h),f();return}u.current=b,b.onopen=()=>{if(!d.current){b.close();return}c("connected"),x.current=ps,console.log("[Standalone WS] Connected")},Re=b,b.onmessage=h=>{var y;try{const N=JSON.parse(h.data);if((N.type==="command_result"||N.type==="error")&&N.requestId){const T=Ct.get(N.requestId);T&&(Ct.delete(N.requestId),N.type==="error"?T.reject(new Error(((y=N.data)==null?void 0:y.message)||"Command failed")):T.resolve(N.data));return}if(N.type==="pty_output"){Ae.emitPtyOutput(N.cliId,N.data);return}if(N.type==="runtime_snapshot"){Ae.emitRuntimeSnapshot(N.sessionId,typeof N.text=="string"?N.text:"",typeof N.seq=="number"?N.seq:0,!!N.truncated);return}if(N.type==="status"||N.type==="initial_state"){const T=N.data;if(!T)return;const{injectEntries:m,markLoaded:j}=s.current,v=T.id||"standalone",w=wo(v);Ae.register(v,w),Ae.setState(v,"connected"),c("connected",v),Ae.emitStatus(v,T);const R=Cr(T,{daemonId:v});R.length>0&&m(R),j(),T.userName&&a.current&&a.current(T.userName)}}catch(N){console.error("[Standalone WS] Parse error:",N)}},b.onclose=()=>{d.current&&(ke==null||ke.stopScreenshots(),ke&&Ae.setState(ke.daemonId,"disconnected"),c("disconnected"),u.current=null,f())},b.onerror=h=>{p.current||!d.current||console.warn("[Standalone WS] Error, will reconnect:",h)}}function f(){if(!d.current)return;clearTimeout(l.current);const b=x.current;console.log(`[Standalone WS] Reconnecting in ${b}ms...`),l.current=setTimeout(()=>{x.current=Math.min(x.current*1.5,bo),g()},b)}return g(),()=>{d.current=!1,p.current=!0,clearTimeout(l.current),u.current&&(u.current.onerror=null,u.current.onclose=null,u.current.close(),u.current=null,Re=null),ke&&(ke.stopScreenshots(),Ae.unregister(ke.daemonId))}},[]),e.jsx(e.Fragment,{children:t})}function ko({children:t}){const[s,n]=o.useState("disconnected"),[r,a]=o.useState(null);o.useEffect(()=>(at=(c,u)=>{n(c),u&&a(u)},()=>{at=null}),[]);const i=o.useMemo(()=>{const c=s==="connected",u=jo(s),l={};return r&&(l[r]=u),l.standalone=u,{wsStatus:s,isConnected:c,connectionStates:l}},[s,r]);return e.jsx(Cn,{connectionOverrides:i,children:e.jsx(No,{children:t})})}const So=[{id:"dashboard",path:"/dashboard",icon:e.jsx(Ns,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:e.jsx(ks,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:e.jsx(Ht,{}),label:"Settings"}];function Co({children:t}){const s=it(),n=yn(),[r,a]=o.useState(!1),[i,c]=o.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),u=d=>{s(d),a(!1)},l=()=>{c(d=>{const p=!d;try{localStorage.setItem("sidebar-collapsed",p?"1":"0")}catch{}return p})},x=d=>`nav-item${n.pathname.startsWith(d)?" 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:()=>a(!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:()=>a(!1),onKeyDown:d=>d.key==="Escape"&&a(!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:()=>a(!1),children:"✕"})]}),e.jsx("nav",{className:"sidebar-nav",children:So.map(d=>e.jsxs("div",{className:x(d.path),id:`nav-${d.id}`,onClick:()=>u(d.path),title:i?d.label:void 0,children:[e.jsx("span",{className:"nav-icon",children:d.icon}),!i&&d.label]},d.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(Ss,{})}),!i&&"About"]}),!i&&e.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.7.24"]}),e.jsxs("div",{className:`nav-item cursor-pointer ${i?"justify-center py-2.5 px-0":"mt-1"}`,onClick:l,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 Io=[{icon:e.jsx(ks,{size:16}),title:"Local-first runtime",desc:"Everything stays on your machine and the browser only connects over localhost."},{icon:e.jsx(qe,{size:16}),title:"Agent chat relay",desc:"Read and respond to AI conversations in real time across connected IDEs."},{icon:e.jsx(Ts,{size:16}),title:"Live screenshots",desc:"View your IDE directly in the browser through the local screenshot stream."},{icon:e.jsx(Le,{size:16}),title:"Remote control",desc:"Click, type, and steer your IDE sessions without switching windows."},{icon:e.jsx(Ye,{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."}],Mo=[{icon:e.jsx(As,{size:16}),title:"Access from anywhere",desc:"Reach your burrows from another laptop or phone without opening local ports."},{icon:e.jsx(Ns,{size:16}),title:"Low-latency P2P stream",desc:"Cloud adds the WebRTC path for faster screenshots and remote control."},{icon:e.jsx(_s,{size:16}),title:"Mobile notifications",desc:"Get approval prompts and activity updates when you are away from your desk."},{icon:e.jsx(Ln,{size:16}),title:"REST API access",desc:"Integrate with Slack, CI, or internal tools using API keys and service routes."},{icon:e.jsx(Rn,{size:16}),title:"Team workspace",desc:"Share burrows, activity views, and policies across a team workspace."},{icon:e.jsx(Cs,{size:16}),title:"Enterprise controls",desc:"SSO, RBAC, audit logs, and managed policy features for production teams."}],To=[{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 Eo(){return e.jsxs(Nt,{icon:e.jsx(Ss,{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.7.24"]}),children:[e.jsx(fe,{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(fe,{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:Io.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(fe,{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:Vs.map(t=>`${t.icon} ${t.name}`)},{label:"Extensions",items:Ys.map(t=>`${t.icon} ${t.name}`)},{label:"CLI agents",items:qs.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(fe,{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:Mo.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(fe,{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:To.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(Vt,{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(Hn,{size:14,className:"mr-1"}),"Discord ↗"]})]})})]})}function Ao(){const{ides:t}=ot(),s=t.find(p=>p.type==="adhdev-daemon"),n=(s==null?void 0:s.detectedIdes)||[],{sendCommand:r}=Pe(),{userName:a}=ot(),[i,c]=o.useState(a||"");o.useEffect(()=>{a!==void 0&&c(a)},[a]);const u=p=>{const g=p.target.value.trim();s!=null&&s.id&&g!==a&&r(s.id,"set_user_name",{userName:g}).catch(console.error)},[l,x]=o.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),d=p=>{x(p);try{localStorage.setItem("adhdev_sound",p?"1":"0")}catch{}};return e.jsxs(Nt,{icon:e.jsx(Ht,{className:"text-text-primary"}),title:"Settings",subtitle:"Local daemon configuration, appearance, and on-device preferences",widthClassName:"max-w-5xl",children:[e.jsx(zr,{variant:"info",children:"Standalone settings stay on this machine. The browser only talks to your local daemon over localhost."}),e.jsx(fe,{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.7.24"]}),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(fe,{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(p=>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 ${p.running?"bg-green-400":"bg-text-muted/30"}`}),e.jsx("span",{className:"text-sm font-medium",children:p.name})]}),e.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:p.type})]},p.type))})}),e.jsx(fe,{title:"Machine",description:"The local burrow exposed by your standalone daemon.",children:e.jsx(Gr,{ides:t,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),e.jsx(fe,{title:"Appearance",description:"Match the rest of the dashboard with a single place for mode and theme.",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(ea,{})]}),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, accent, and chat palette for the standalone UI."}),e.jsx(oa,{})]})]})}),e.jsx(fe,{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(Xr,{}),e.jsx(We,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(zn,{size:15})," Sound Effects"]}),description:"Play a sound when agent completes or needs approval",checked:l,onChange:d})]})}),e.jsx(fe,{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(_n,{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:p=>c(p.target.value),onBlur:u,onKeyDown:p=>{p.key==="Enter"&&p.currentTarget.blur()}})]})})})]})}qr();ra();const Ro=vs({baseUrl:""});function hs(){const{ides:t}=ot(),s=t.find(n=>{var r;return n.daemonMode||((r=n.id)==null?void 0:r.startsWith("standalone"))});return s?e.jsx(gt,{to:`/machines/${s.id}`,replace:!0}):t.length>0?e.jsx(gt,{to:`/machines/${t[0].id}`,replace:!0}):e.jsx(gt,{to:"/dashboard",replace:!0})}function _o(){return e.jsx(jn,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:e.jsx(Tn,{client:Ro,children:e.jsx(ko,{children:e.jsx(An,{value:{sendCommand:vt,sendData:()=>!1},children:e.jsx(Co,{children:e.jsxs(vn,{children:[e.jsx(Ee,{path:"/dashboard",element:e.jsx(qa,{})}),e.jsx(Ee,{path:"/ide/:id",element:e.jsx(to,{})}),e.jsx(Ee,{path:"/machine",element:e.jsx(hs,{})}),e.jsx(Ee,{path:"/machines/:id",element:e.jsx(ho,{})}),e.jsx(Ee,{path:"/machines",element:e.jsx(hs,{})}),e.jsx(Ee,{path:"/capabilities",element:e.jsx(mo,{})}),e.jsx(Ee,{path:"/about",element:e.jsx(Eo,{})}),e.jsx(Ee,{path:"/settings",element:e.jsx(Ao,{})}),e.jsx(Ee,{path:"*",element:e.jsx(gt,{to:"/dashboard",replace:!0})})]})})})})})})}br({connectionManager:Ae});wn(document.getElementById("root")).render(e.jsx(o.StrictMode,{children:e.jsx(_o,{})}));
|
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-BZTlzuth.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tc3018Wt.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/terminal-5UKRXqR3.js">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/assets/index-BOtTH62O.css">
|