cogpit 3.3.2 → 3.3.5

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.
Files changed (36) hide show
  1. package/dist/cli-runtime.js +1893 -710
  2. package/dist/instance-worker.js +383 -133
  3. package/dist/web/assets/{CogpitBlock-DslWkKoF.js → CogpitBlock-erlqla7o.js} +11 -11
  4. package/dist/web/assets/{CommandPaletteHost-DUZHK9Zh.js → CommandPaletteHost-CuOrr39_.js} +1 -1
  5. package/dist/web/assets/{ConfigBrowser-CWys9Rgj.js → ConfigBrowser-C2DsAcvc.js} +1 -1
  6. package/dist/web/assets/CrewPanel-DICdtFaE.js +1 -0
  7. package/dist/web/assets/{HighlightedEditor-BF3a6ok2.js → HighlightedEditor-CP5_qp0D.js} +1 -1
  8. package/dist/web/assets/{KeyboardShortcutsDialog-DHxjcyzu.js → KeyboardShortcutsDialog-DB1DgAfw.js} +1 -1
  9. package/dist/web/assets/MissionHome-D8vtj_X6.js +2 -0
  10. package/dist/web/assets/{MobileFileChanges-B0k6kNod.js → MobileFileChanges-B5ADNE1K.js} +1 -1
  11. package/dist/web/assets/{PluginsDialog-CuaR5Cs1.js → PluginsDialog-B_69f-f3.js} +1 -1
  12. package/dist/web/assets/{PreviewPanel-CV3itR4d.js → PreviewPanel-Dg9ZZMgz.js} +1 -1
  13. package/dist/web/assets/{ProjectFilesPanel-B7DRMwMm.js → ProjectFilesPanel-DkSythhf.js} +3 -3
  14. package/dist/web/assets/{ProjectSwitcherModal-DhWTU3Op.js → ProjectSwitcherModal-ztUOYaYv.js} +1 -1
  15. package/dist/web/assets/{TerminalOutput-CsysWxZc.js → TerminalOutput-LYCC1x6i.js} +1 -1
  16. package/dist/web/assets/{ThemeSelectorModal-DbCAl7RY.js → ThemeSelectorModal-C3Mbqa4u.js} +1 -1
  17. package/dist/web/assets/{WorkflowsPanel-BkDClgyj.js → WorkflowsPanel-BOmbzwo_.js} +1 -1
  18. package/dist/web/assets/WorktreePanel-CdYUr34j.js +1 -0
  19. package/dist/web/assets/{edition-ui-xOZzffb-.js → edition-ui-acJKBfUS.js} +1 -1
  20. package/dist/web/assets/index-CNaiQBmD.js +1 -0
  21. package/dist/web/assets/index-D1VvcJwM.css +1 -0
  22. package/dist/web/assets/index-DeMgVaXr.js +493 -0
  23. package/dist/web/assets/{index-CFF4usU2.js → index-DxwM8M7d.js} +4 -4
  24. package/dist/web/assets/{index-y28pnuxv.js → index-RkopwWeC.js} +1 -1
  25. package/dist/web/assets/session-parser.worker-BZQCzzKl.js +30 -0
  26. package/dist/web/assets/switch-BqBbmo4j.js +1 -0
  27. package/dist/web/assets/{vendor-ui-Dxtv9P3W.js → vendor-ui-Cj1G8Clp.js} +204 -184
  28. package/dist/web/index.html +3 -3
  29. package/package.json +1 -1
  30. package/dist/web/assets/CrewPanel-CWubmgOn.js +0 -1
  31. package/dist/web/assets/MissionHome-Ckt9lu1H.js +0 -1
  32. package/dist/web/assets/WorktreePanel-DyQpVHNe.js +0 -1
  33. package/dist/web/assets/index-D2Gn2VwC.js +0 -1
  34. package/dist/web/assets/index-D6mWk1bF.css +0 -1
  35. package/dist/web/assets/index-DUfVcKxj.js +0 -483
  36. package/dist/web/assets/session-parser.worker-D3SBmcaP.js +0 -30
@@ -14,12 +14,12 @@
14
14
  .dark body { background: var(--canvas, #09090b); color: var(--foreground, #fafafa); }
15
15
  body { background: var(--canvas, #fafafa); color: var(--foreground, #09090b); }
16
16
  </style>
17
- <script type="module" crossorigin src="/assets/index-DUfVcKxj.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-DeMgVaXr.js"></script>
18
18
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-gGw_S5I_.js">
19
- <link rel="modulepreload" crossorigin href="/assets/vendor-ui-Dxtv9P3W.js">
19
+ <link rel="modulepreload" crossorigin href="/assets/vendor-ui-Cj1G8Clp.js">
20
20
  <link rel="modulepreload" crossorigin href="/assets/vendor-markdown-BE1gYnO9.js">
21
21
  <link rel="modulepreload" crossorigin href="/assets/vendor-shiki-DOn6sF-i.js">
22
- <link rel="stylesheet" crossorigin href="/assets/index-D6mWk1bF.css">
22
+ <link rel="stylesheet" crossorigin href="/assets/index-D1VvcJwM.css">
23
23
  <script src="/theme-bootstrap.js"></script>
24
24
  </head>
25
25
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cogpit",
3
- "version": "3.3.2",
3
+ "version": "3.3.5",
4
4
  "description": "Run Cogpit's local Claude Code, Codex, and GitHub Copilot CLI interface without installing it",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{r as R,c as G,j as n}from"./vendor-react-gGw_S5I_.js";import{aP as fe,U as xe,aQ as pe,aR as te,aS as me,aT as he,aU as ge,aV as we,aW as be,aX as Ne,B as Q,q as je,J as M,$ as ue,Z as ve,aY as ye,aZ as ke}from"./index-DUfVcKxj.js";import{W as Ie,X as Se,Y as Ce,C as de,_ as Re,$ as Ae}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const $e=4e3;function Oe(t){var g;const[e,l]=R.useState(null),[r,f]=R.useState(null),[a,c]=R.useState(new Set),d=(g=fe())==null?void 0:g.refresh,x=R.useRef(t),s=R.useRef(new Set);R.useLayoutEffect(()=>(x.current=t,()=>{x.current=null}),[t]);const i=R.useCallback(async o=>{if(t)try{const u=await xe(`/api/session-crew/${encodeURIComponent(t)}`);if(!o())return;if(!u.ok){f(u.status===404?"This session is no longer available.":"Couldn't load the crew.");return}const m=await u.json();if(!o())return;l(h=>JSON.stringify(h)===JSON.stringify(m)?h:m),f(null)}catch{o()&&f("Couldn't load the crew.")}},[t]);pe(t?i:null,$e),R.useEffect(()=>{l(o=>o!=null&&o.members.some(u=>u.sessionId===t)?o:null),f(null),c(new Set)},[t]);const p=R.useCallback(async(o,u,m)=>{const h=`${t}:${o}`;if(s.current.has(h))return;const N=()=>x.current===t;s.current.add(h),c(y=>new Set(y).add(o));try{const y=await u();if(!N())return;if(!y.ok&&y.status!==404){f(m);return}d==null||d(),await i(N)}catch{N()&&f(m)}finally{s.current.delete(h),N()&&c(y=>{const k=new Set(y);return k.delete(o),k})}},[i,d,t]),w=R.useCallback((o,u,m)=>p(u,()=>te("/api/session-respond",{sessionId:o,requestId:u,...m}),"Couldn't send the answer."),[p]),j=R.useCallback((o,u)=>p(u,()=>te("/api/delegated-tasks",{sessionId:o,taskId:u,action:"ack"}),"Couldn't mark the result read."),[p]),b=R.useCallback(o=>p(o.sessionId,()=>{var u;return((u=o.result)==null?void 0:u.state)==="running"&&o.parentId?te("/api/delegated-tasks",{sessionId:o.parentId,taskId:o.result.taskId,action:"cancel"}):te("/api/stop-session",{sessionId:o.sessionId})},"Couldn't stop the session."),[p]);return{crew:e,error:r,busy:a,respond:w,markRead:j,stop:b}}function ee(t){switch(t.outcome){case"needs_input":return"needs-you";case"running":return"working";case"error":return"failed";case"unreachable":case"not_found":return"unreachable";default:return"done"}}function ce(t,e){var l,r;return{sessionId:t.sessionId,dirName:((l=t.address)==null?void 0:l.dirName)??"",fileName:((r=t.address)==null?void 0:r.fileName)??"",projectShortName:"",lastModified:t.lastActivityAt??"",lastActivityAt:t.lastActivityAt,size:0,cwd:t.cwd,customTitle:t.customTitle,aiTitle:t.aiTitle,firstUserMessage:t.firstUserMessage,...t.parentId&&{crew:{rootId:e,parentId:t.parentId,startedAt:t.startedAt??0,...t.name&&{name:t.name}}}}}function ze(t,e,l){var d;const r=((d=[...e.values()].find(x=>x.parentId===null))==null?void 0:d.sessionId)??t.sessionId,f=l[t.sessionId],a=ce(t,r);if(!t.parentId)return me(a,f);const c=e.get(t.parentId);return he(a,{customName:f,parent:c&&ce(c,r)})}function qe(t){const e=new Map;for(const a of t.members){if(!a.parentId)continue;const c=e.get(a.parentId);c?c.push(a):e.set(a.parentId,[a])}const l=[],r=new Set,f=(a,c)=>{var x;const d=[...e.get(a)??[]].sort((s,i)=>(s.startedAt??0)-(i.startedAt??0));for(const s of d)r.has(s.sessionId)||(r.add(s.sessionId),l.push({member:s,depth:c,children:((x=e.get(s.sessionId))==null?void 0:x.length)??0}),f(s.sessionId,c+1))};f(t.rootId,0);for(const a of t.members)a.parentId&&!r.has(a.sessionId)&&(r.add(a.sessionId),l.push({member:a,depth:0,children:0}));return l}function Me(t){const e=({member:l,pending:r})=>r.askedAt??(Date.parse(l.lastActivityAt??"")||0);return t.members.flatMap(l=>l.waiting.map(r=>({member:l,pending:r}))).sort((l,r)=>e(l)-e(r))}function Te(t){const e={size:0,working:0,needsYou:0,done:0,failed:0,unreachable:0,unreadResults:0};for(const l of t.members){if(!l.parentId)continue;e.size++;const r=ee(l);r==="working"?e.working++:r==="needs-you"?e.needsYou++:r==="failed"?e.failed++:r==="unreachable"?e.unreachable++:e.done++,le(l)&&e.unreadResults++}return e}function le(t){return!!(t.result&&t.result.state!=="running"&&!t.result.acknowledged)}function ne(t){const[e]=t.waiting;switch(ee(t)){case"needs-you":return(e==null?void 0:e.kind)==="permission"?`Waiting on a permission · ${e.toolName}`:(e==null?void 0:e.kind)==="question"?"Asked a question":"Plan to review";case"working":return t.status==="tool_use"&&t.toolName?t.toolName:t.status==="thinking"?"Thinking":t.status==="compacting"?"Compacting":t.status==="awaiting_agents"?"Waiting on its agents":"Working";case"failed":return t.error?`Failed · ${t.error}`:"Failed";case"unreachable":return t.device?`${t.device.name} is not answering`:"Not found";default:return le(t)?"Finished · result unread":"Finished"}}const Le=[{id:"all",label:"All"},{id:"working",label:"Working"},{id:"needs-you",label:"Need you"},{id:"done",label:"Done"}],Pe={working:"bg-success shadow-[0_0_0_2px_color-mix(in_oklch,var(--success)_25%,transparent)]","needs-you":"bg-warning",done:"bg-muted-foreground/40",failed:"bg-destructive",unreachable:"border border-muted-foreground/50"},q={working:"bg-success ring-2 ring-success/30","needs-you":"bg-warning",done:"bg-muted-foreground/50",failed:"bg-destructive",unreachable:"border border-muted-foreground/60"};function Ke(t){var A;const e=G.c(29),{context:l,closePanel:r}=t,f=((A=l.session)==null?void 0:A.sessionId)??null,{crew:a,error:c,busy:d,respond:x,markRead:s,stop:i}=Oe(f),{names:p}=ge();let w;e[0]!==(a==null?void 0:a.members)?(w=new Map(((a==null?void 0:a.members)??[]).map(Fe)),e[0]=a==null?void 0:a.members,e[1]=w):w=e[1];const j=w;let b;e[2]!==j||e[3]!==p?(b=v=>ze(v,j,p),e[2]=j,e[3]=p,e[4]=b):b=e[4];const g=b;let o;e[5]!==l?(o=v=>{v.address&&v.device?we(be(v.address.dirName,v.address.fileName,v.device.id)):v.address&&l.openSession?l.openSession(v.address.dirName,v.address.fileName):Ne(v.sessionId)},e[5]=l,e[6]=o):o=e[6];const u=o;let m,h,N;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ie,{"aria-hidden":"true",className:"size-4 text-muted-foreground"}),h=n.jsx("h2",{className:"text-sm font-medium",children:"Crew"}),N=n.jsx("div",{className:"flex-1"}),e[7]=m,e[8]=h,e[9]=N):(m=e[7],h=e[8],N=e[9]);let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Se,{"data-icon":"inline-start"}),e[10]=y):y=e[10];let k;e[11]!==r?(k=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[m,h,N,n.jsx(Q,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":"Close crew",children:y})]}),e[11]=r,e[12]=k):k=e[12];let S;e[13]!==c?(S=c&&n.jsx("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive",children:c}),e[13]=c,e[14]=S):S=e[14];let I;e[15]!==d||e[16]!==a||e[17]!==c||e[18]!==s||e[19]!==g||e[20]!==u||e[21]!==x||e[22]!==f||e[23]!==i?(I=a?n.jsxs(je,{className:"min-h-0 flex-1",children:[n.jsx(Ye,{crew:a,hereId:f,nameOf:g,onOpen:u}),n.jsx(Be,{crew:a,busy:d,nameOf:g,onOpen:u,onRespond:x}),n.jsx(Ue,{crew:a,hereId:f,busy:d,nameOf:g,onOpen:u,onMarkRead:s,onStop:i})]}):!c&&n.jsx("p",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Loading the crew…"}),e[15]=d,e[16]=a,e[17]=c,e[18]=s,e[19]=g,e[20]=u,e[21]=x,e[22]=f,e[23]=i,e[24]=I):I=e[24];let $;return e[25]!==I||e[26]!==k||e[27]!==S?($=n.jsxs("aside",{"aria-label":"Crew",className:"flex size-full min-h-0 flex-col bg-canvas",children:[k,S,I]}),e[25]=I,e[26]=k,e[27]=S,e[28]=$):$=e[28],$}function Fe(t){return[t.sessionId,t]}function Ye(t){var h;const e=G.c(45),{crew:l,hereId:r,nameOf:f,onOpen:a}=t;let c,d,x,s,i;if(e[0]!==l||e[1]!==r||e[2]!==f||e[3]!==a){let N;e[9]!==l.rootId?(N=C=>C.sessionId===l.rootId,e[9]=l.rootId,e[10]=N):N=e[10];const y=l.members.find(N),k=l.members.filter(De);let S;e[11]!==l?(S=Te(l),e[11]=l,e[12]=S):S=e[12],i=S;const I=(h=k[0])==null?void 0:h.startedAt;c="Crew summary",d="border-b px-3 pb-3 pt-1";const $=y&&n.jsx("button",{type:"button",onClick:()=>a(y),"aria-current":y.sessionId===r?"true":void 0,className:"min-w-0 flex-1 truncate rounded-sm text-left text-sm font-medium outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:f(y)}),A=i.size===1?"session":"sessions",v=I?` · since ${Ee(I)}`:"";let O;e[13]!==A||e[14]!==v||e[15]!==i.size?(O=n.jsxs("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[i.size," ",A,v]}),e[13]=A,e[14]=v,e[15]=i.size,e[16]=O):O=e[16],e[17]!==O||e[18]!==$?(x=n.jsxs("div",{className:"flex items-baseline gap-2",children:[$,O]}),e[17]=O,e[18]=$,e[19]=x):x=e[19],s=k.length>0&&n.jsx("div",{"data-crew-strip":!0,className:"mt-2.5 flex gap-[3px]",role:"list","aria-label":"One cell per session, in the order they were started",children:k.map(C=>{const T=ee(C);return n.jsx("button",{type:"button",role:"listitem","data-crew-cell":T,title:`${f(C)}: ${ne(C)}`,"aria-label":`${f(C)}: ${ne(C)}`,onClick:()=>{var z;return(z=document.querySelector(`[data-crew-row="${C.sessionId}"]`))==null?void 0:z.scrollIntoView({block:"nearest",behavior:"smooth"})},className:M("h-2.5 min-w-[3px] flex-1 rounded-[2px] outline-none focus-visible:ring-2 focus-visible:ring-ring",Pe[T],C.sessionId===r&&"outline outline-[1.5px] outline-offset-2 outline-foreground")},C.sessionId)})}),e[0]=l,e[1]=r,e[2]=f,e[3]=a,e[4]=c,e[5]=d,e[6]=x,e[7]=s,e[8]=i}else c=e[4],d=e[5],x=e[6],s=e[7],i=e[8];let p;e[20]!==i.working?(p=i.working>0&&n.jsx(H,{dot:q.working,value:i.working,label:"working"}),e[20]=i.working,e[21]=p):p=e[21];let w;e[22]!==i.needsYou?(w=i.needsYou>0&&n.jsx(H,{dot:q["needs-you"],value:i.needsYou,label:i.needsYou===1?"needs you":"need you"}),e[22]=i.needsYou,e[23]=w):w=e[23];let j;e[24]!==i.done?(j=i.done>0&&n.jsx(H,{dot:q.done,value:i.done,label:"done"}),e[24]=i.done,e[25]=j):j=e[25];let b;e[26]!==i.failed?(b=i.failed>0&&n.jsx(H,{dot:q.failed,value:i.failed,label:"failed"}),e[26]=i.failed,e[27]=b):b=e[27];let g;e[28]!==i.unreachable?(g=i.unreachable>0&&n.jsx(H,{dot:q.unreachable,value:i.unreachable,label:"away"}),e[28]=i.unreachable,e[29]=g):g=e[29];let o;e[30]!==i.unreadResults?(o=i.unreadResults>0&&n.jsxs("span",{className:"ml-auto text-warning",children:[n.jsx("span",{className:"font-medium tabular-nums",children:i.unreadResults})," ",i.unreadResults===1?"result":"results"," unread"]}),e[30]=i.unreadResults,e[31]=o):o=e[31];let u;e[32]!==o||e[33]!==p||e[34]!==w||e[35]!==j||e[36]!==b||e[37]!==g?(u=n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3.5 gap-y-1 text-xs text-muted-foreground",children:[p,w,j,b,g,o]}),e[32]=o,e[33]=p,e[34]=w,e[35]=j,e[36]=b,e[37]=g,e[38]=u):u=e[38];let m;return e[39]!==c||e[40]!==u||e[41]!==d||e[42]!==x||e[43]!==s?(m=n.jsxs("section",{"aria-label":c,className:d,children:[x,s,u]}),e[39]=c,e[40]=u,e[41]=d,e[42]=x,e[43]=s,e[44]=m):m=e[44],m}function De(t){return t.parentId!==null}function Ee(t){const e=new Date(t),l=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return e.toDateString()===new Date().toDateString()?l:`${e.toLocaleDateString([],{month:"short",day:"numeric"})}, ${l}`}function H(t){const e=G.c(10),{dot:l,value:r,label:f}=t;let a;e[0]!==l?(a=M("size-1.5 rounded-full",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=n.jsx("span",{className:a,"aria-hidden":"true"}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==r?(d=n.jsx("span",{className:"font-medium tabular-nums text-foreground",children:r}),e[4]=r,e[5]=d):d=e[5];let x;return e[6]!==f||e[7]!==c||e[8]!==d?(x=n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c,d," ",f]}),e[6]=f,e[7]=c,e[8]=d,e[9]=x):x=e[9],x}function Be(t){const e=G.c(6),{crew:l,busy:r,nameOf:f,onOpen:a,onRespond:c}=t,d=Me(l),[x,s]=R.useState(0);if(d.length===0)return null;const i=Math.min(x,d.length-1),{member:p,pending:w}=d[i],j=d[i+1];let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Needs you"}),e[0]=b):b=e[0];let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("span",{className:"flex-1"}),e[1]=g):g=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:M("size-1.5 shrink-0 rounded-full",q["needs-you"]),"aria-hidden":"true"}),e[2]=o):o=e[2];const u=w.askedAt?`waiting ${ue(new Date(w.askedAt).toISOString())}`:"waiting";let m;e[3]!==u?(m=n.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-warning",children:u}),e[3]=u,e[4]=m):m=e[4];let h;return e[5]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(de,{"data-icon":"inline-end"}),e[5]=h):h=e[5],n.jsxs("section",{"aria-label":"Needs you",className:"border-b px-3 py-2.5",children:[n.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs text-muted-foreground",children:[b,n.jsx("span",{className:"tabular-nums",children:d.length}),g,d.length>1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"tabular-nums",children:[i+1," of ",d.length]}),n.jsx(Q,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:i===0,onClick:()=>s(i-1),children:n.jsx(Ce,{"data-icon":"inline-start"})}),n.jsx(Q,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:i===d.length-1,onClick:()=>s(i+1),children:n.jsx(de,{"data-icon":"inline-start"})})]})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2 px-0.5 text-xs",children:[o,n.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:f(p)}),p.device&&n.jsx(ve,{variant:"outline",children:p.device.name}),m]}),n.jsx(ye,{sessionId:p.sessionId,pending:w,queued:0,responding:r.has(w.requestId),onRespond:(N,y)=>void c(p.sessionId,N,y),onOpen:()=>a(p)},w.requestId),n.jsxs(Q,{variant:"ghost",size:"xs",className:"self-end text-muted-foreground",onClick:()=>a(p),children:["Open session",h]})]}),j&&n.jsxs("p",{className:"mt-2 truncate text-xs text-muted-foreground",children:["Next: ",n.jsx("span",{className:"font-medium text-foreground",children:f(j.member)})," ",ne(j.member).toLowerCase()]})]})}function Ue(t){const e=G.c(17),{crew:l,hereId:r,busy:f,nameOf:a,onOpen:c,onMarkRead:d,onStop:x}=t,[s,i]=R.useState("all");let p;if(e[0]!==f||e[1]!==l||e[2]!==s||e[3]!==r||e[4]!==a||e[5]!==d||e[6]!==c||e[7]!==x){let w;e[9]!==s?(w=m=>{const{member:h}=m;if(s==="all")return!0;const N=ee(h);return s==="done"?N!=="working"&&N!=="needs-you":N===s},e[9]=s,e[10]=w):w=e[10];const j=qe(l).filter(w);let b,g;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("h3",{className:"text-sm font-medium",children:"Sessions"}),g=n.jsx("span",{className:"flex-1"}),e[11]=b,e[12]=g):(b=e[11],g=e[12]);let o;e[13]!==s?(o=Le.map(m=>{const{id:h,label:N}=m;return n.jsx("button",{type:"button",role:"radio","aria-checked":s===h,onClick:()=>i(h),className:M("rounded-full px-2 py-0.5 text-[11px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",s===h&&"bg-accent text-foreground"),children:N},h)}),e[13]=s,e[14]=o):o=e[14];let u;e[15]!==o?(u=n.jsxs("div",{className:"mb-1.5 flex items-center gap-2 px-1.5",children:[b,g,n.jsx("div",{role:"radiogroup","aria-label":"Show sessions",className:"flex gap-0.5",children:o})]}),e[15]=o,e[16]=u):u=e[16],p=n.jsxs("section",{"aria-label":"Sessions",className:"px-1.5 py-2.5",children:[u,j.length===0?n.jsx("p",{className:"px-1.5 py-4 text-center text-xs text-muted-foreground",children:"No sessions here."}):n.jsx("ul",{className:"flex flex-col",children:j.map(m=>n.jsx(We,{row:m,here:m.member.sessionId===r,busy:f,name:a(m.member),onOpen:c,onMarkRead:d,onStop:x},m.member.sessionId))})]}),e[0]=f,e[1]=l,e[2]=s,e[3]=r,e[4]=a,e[5]=d,e[6]=c,e[7]=x,e[8]=p}else p=e[8];return p}function We(t){var oe,re;const e=G.c(73),{row:l,here:r,busy:f,name:a,onOpen:c,onMarkRead:d,onStop:x}=t,{member:s,depth:i,children:p}=l;let w;e[0]!==s?(w=ee(s),e[0]=s,e[1]=w):w=e[1];const j=w;let b;e[2]!==s?(b=ne(s),e[2]=s,e[3]=b):b=e[3];const g=b;let o;e[4]!==s.pullRequests?(o=(oe=s.pullRequests)==null?void 0:oe.at(-1),e[4]=s.pullRequests,e[5]=o):o=e[5];const u=o;let m;e[6]!==s?(m=le(s)&&s.result&&s.parentId,e[6]=s,e[7]=m):m=e[7];const h=m,N=(j==="working"||j==="needs-you")&&(!s.device||((re=s.result)==null?void 0:re.state)==="running"&&s.parentId!==null),y=s.sessionId,k=r?"bg-accent":"hover:bg-accent/60",S=i>0&&"border-l border-border/70";let I;e[8]!==k||e[9]!==S?(I=M("group/crew relative rounded-md",k,S),e[8]=k,e[9]=S,e[10]=I):I=e[10];const $=i>0?6+(i-1)*14:0;let A;e[11]!==$?(A={marginLeft:$},e[11]=$,e[12]=A):A=e[12];let v;e[13]!==s||e[14]!==c?(v=()=>c(s),e[13]=s,e[14]=c,e[15]=v):v=e[15];const O=r?"true":void 0,C=`${a}, ${g}`,T=q[j];let z;e[16]!==T?(z=M("size-1.5 justify-self-center rounded-full",T),e[16]=T,e[17]=z):z=e[17];let L;e[18]!==z?(L=n.jsx("span",{className:z,"aria-hidden":"true"}),e[18]=z,e[19]=L):L=e[19];let P;e[20]!==a?(P=n.jsx("span",{className:"truncate",children:a}),e[20]=a,e[21]=P):P=e[21];let F;e[22]!==r?(F=r&&n.jsx("span",{className:"shrink-0 rounded-full border px-1.5 text-[10.5px] font-normal text-muted-foreground",children:"you are here"}),e[22]=r,e[23]=F):F=e[23];let Y;e[24]!==P||e[25]!==F?(Y=n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12.5px] font-medium",children:[P,F]}),e[24]=P,e[25]=F,e[26]=Y):Y=e[26];let D;e[27]!==s.lastActivityAt?(D=s.lastActivityAt?ue(s.lastActivityAt):"",e[27]=s.lastActivityAt,e[28]=D):D=e[28];let E;e[29]!==D?(E=n.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:D}),e[29]=D,e[30]=E):E=e[30];const ae=(j==="needs-you"||h)&&"text-warning",ie=j==="failed"&&"text-destructive";let B;e[31]!==ae||e[32]!==ie?(B=M("min-w-0 flex-1 truncate",ae,ie),e[31]=ae,e[32]=ie,e[33]=B):B=e[33];let U;e[34]!==g||e[35]!==B?(U=n.jsx("span",{className:B,children:g}),e[34]=g,e[35]=B,e[36]=U):U=e[36];let W;e[37]!==u?(W=u&&n.jsxs("span",{className:"shrink-0 rounded-full border px-1.5 text-[11px]",children:["#",u.number]}),e[37]=u,e[38]=W):W=e[38];let _;e[39]!==s.device?(_=s.device&&n.jsx("span",{className:"shrink-0",children:s.device.name}),e[39]=s.device,e[40]=_):_=e[40];let V;e[41]!==p?(V=p>0&&n.jsxs("span",{className:"shrink-0",children:[p," ",p===1?"session":"sessions"]}),e[41]=p,e[42]=V):V=e[42];let J;e[43]!==s.model?(J=s.model&&n.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:ke(s.model)}),e[43]=s.model,e[44]=J):J=e[44];let X;e[45]!==U||e[46]!==W||e[47]!==_||e[48]!==V||e[49]!==J?(X=n.jsxs("span",{className:"col-start-2 col-end-4 flex min-w-0 items-center gap-2 text-[11.5px] text-muted-foreground",children:[U,W,_,V,J]}),e[45]=U,e[46]=W,e[47]=_,e[48]=V,e[49]=J,e[50]=X):X=e[50];let Z;e[51]!==v||e[52]!==O||e[53]!==C||e[54]!==L||e[55]!==Y||e[56]!==E||e[57]!==X?(Z=n.jsxs("button",{type:"button",onClick:v,"aria-current":O,"aria-label":C,className:"grid w-full grid-cols-[14px_minmax(0,1fr)_auto] items-center gap-x-2 gap-y-0.5 rounded-md px-2 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[L,Y,E,X]}),e[51]=v,e[52]=O,e[53]=C,e[54]=L,e[55]=Y,e[56]=E,e[57]=X,e[58]=Z):Z=e[58];let K;e[59]!==f||e[60]!==N||e[61]!==s||e[62]!==a||e[63]!==d||e[64]!==x||e[65]!==h?(K=(h||N)&&n.jsxs("div",{className:"absolute right-1.5 top-1 hidden gap-1 group-focus-within/crew:flex group-hover/crew:flex",children:[h&&s.result&&s.parentId&&n.jsx(Q,{variant:"outline",size:"icon-xs",className:"bg-popover","aria-label":`Mark ${a}'s result read`,title:"Mark the result read",disabled:f.has(s.result.taskId),onClick:()=>void d(s.parentId,s.result.taskId),children:n.jsx(Re,{"data-icon":"inline-start"})}),N&&n.jsx(Q,{variant:"outline",size:"icon-xs",className:"bg-popover text-destructive","aria-label":`Stop ${a}`,title:"Stop this session",disabled:f.has(s.sessionId),onClick:()=>void x(s),children:n.jsx(Ae,{"data-icon":"inline-start"})})]}),e[59]=f,e[60]=N,e[61]=s,e[62]=a,e[63]=d,e[64]=x,e[65]=h,e[66]=K):K=e[66];let se;return e[67]!==s.sessionId||e[68]!==A||e[69]!==Z||e[70]!==K||e[71]!==I?(se=n.jsxs("li",{"data-crew-row":y,className:I,style:A,children:[Z,K]}),e[67]=s.sessionId,e[68]=A,e[69]=Z,e[70]=K,e[71]=I,e[72]=se):se=e[72],se}export{Ke as CrewPanel};
@@ -1 +0,0 @@
1
- import{c as B,r as V,j as t}from"./vendor-react-gGw_S5I_.js";import{B as M,b5 as me,b6 as ee,A as se,b7 as fe,b8 as J,H as xe,T as pe,b9 as ge,ba as he,bb as be,bc as je,bd as we,be as ae,bf as Ne,bg as Ie,aU as qe,bh as ke,bi as ye,bj as ve,bk as Se,aX as _e,bl as Ae,q as Ce,$ as G,L as oe,M as re,Q as ce,J as De,Z as de}from"./index-DUfVcKxj.js";import{b as $e,a2 as Me,a3 as Pe,a4 as Oe,a5 as Re,C as ue,Y as Ee,l as Te,P as Le}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function ze(m){const e={};for(const s of m)s.type==="boolean"?e[s.name]=s.defaultValue===!0:s.defaultValue!==void 0?e[s.name]=String(s.defaultValue):e[s.name]="";return e}function Be(m,e){const s={};for(const n of m){const a=e[n.name];if(typeof a=="boolean"){s[n.name]=a;continue}a!==""&&(s[n.name]=n.type==="number"||n.type==="integer"?Number(a):a)}return s}function Qe(m,e){return m.every(s=>{if(!s.required)return!0;const n=e[s.name];return typeof n=="boolean"?!0:n===""?!1:s.type==="number"||s.type==="integer"?Number.isFinite(Number(n)):!0})}function Fe(m){const e=B.c(52),{request:s,responding:n,onAnswer:a}=m;let r;e[0]!==s.fields?(r=()=>ze(s.fields),e[0]=s.fields,e[1]=r):r=e[1];const[i,o]=V.useState(r);let d;e[2]!==s.fields||e[3]!==i?(d=Qe(s.fields,i),e[2]=s.fields,e[3]=i,e[4]=d):d=e[4];const u=d,p=s.displayName||s.title||s.serverName;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(N,j)=>{o(k=>({...k,[N]:j}))},e[5]=f):f=e[5];const c=f;let l;e[6]!==a||e[7]!==s.requestId?(l=()=>a==null?void 0:a(s.requestId,{action:"decline"}),e[6]=a,e[7]=s.requestId,e[8]=l):l=e[8];const x=l;if(s.mode==="url"&&s.url){const N=s.url;let j;e[9]!==s.message?(j=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[9]=s.message,e[10]=j):j=e[10];let k;e[11]!==N?(k=t.jsx("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:N,children:N}),e[11]=N,e[12]=k):k=e[12];let y;e[13]!==x||e[14]!==a||e[15]!==s.requestId||e[16]!==n||e[17]!==N?(y=a&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsxs(M,{size:"sm",disabled:n,onClick:()=>{window.open(N,"_blank","noopener,noreferrer"),a(s.requestId,{action:"accept"})},children:["Open link",t.jsx($e,{"data-icon":"inline-end"})]}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,onClick:x,children:"Decline"})]}),e[13]=x,e[14]=a,e[15]=s.requestId,e[16]=n,e[17]=N,e[18]=y):y=e[18];let v;return e[19]!==p||e[20]!==j||e[21]!==k||e[22]!==y?(v=t.jsxs(te,{server:p,children:[j,k,y]}),e[19]=p,e[20]=j,e[21]=k,e[22]=y,e[23]=v):v=e[23],v}let g;e[24]!==s.message?(g=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[24]=s.message,e[25]=g):g=e[25];let h;if(e[26]!==a||e[27]!==s.fields||e[28]!==s.requestId||e[29]!==n||e[30]!==i){let N;e[32]!==a||e[33]!==s.requestId||e[34]!==n||e[35]!==i?(N=j=>t.jsx(Ue,{id:`elicit-${s.requestId}-${j.name}`,field:j,value:i[j.name],disabled:n||!a,onChange:k=>c(j.name,k)},j.name),e[32]=a,e[33]=s.requestId,e[34]=n,e[35]=i,e[36]=N):N=e[36],h=s.fields.map(N),e[26]=a,e[27]=s.fields,e[28]=s.requestId,e[29]=n,e[30]=i,e[31]=h}else h=e[31];let w;e[37]!==h?(w=t.jsx("div",{className:"mt-3 flex flex-col gap-3",children:h}),e[37]=h,e[38]=w):w=e[38];let I;e[39]!==u||e[40]!==x||e[41]!==a||e[42]!==s.fields||e[43]!==s.requestId||e[44]!==n||e[45]!==i?(I=a&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx(M,{size:"sm",disabled:n||!u,onClick:()=>a(s.requestId,{action:"accept",content:Be(s.fields,i)}),children:"Send"}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,onClick:x,children:"Decline"})]}),e[39]=u,e[40]=x,e[41]=a,e[42]=s.fields,e[43]=s.requestId,e[44]=n,e[45]=i,e[46]=I):I=e[46];let q;return e[47]!==p||e[48]!==g||e[49]!==w||e[50]!==I?(q=t.jsxs(te,{server:p,children:[g,w,I]}),e[47]=p,e[48]=g,e[49]=w,e[50]=I,e[51]=q):q=e[51],q}function Ue(m){const e=B.c(55),{id:s,field:n,value:a,disabled:r,onChange:i}=m;if(n.type==="boolean"){const x=a===!0;let g;e[0]!==i?(g=q=>i(q===!0),e[0]=i,e[1]=g):g=e[1];let h;e[2]!==r||e[3]!==s||e[4]!==x||e[5]!==g?(h=t.jsx(fe,{id:s,checked:x,disabled:r,onCheckedChange:g}),e[2]=r,e[3]=s,e[4]=x,e[5]=g,e[6]=h):h=e[6];let w;e[7]!==n?(w=t.jsx(Z,{field:n}),e[7]=n,e[8]=w):w=e[8];let I;return e[9]!==s||e[10]!==h||e[11]!==w?(I=t.jsxs(J,{htmlFor:s,className:"items-start gap-2 font-normal",children:[h,w]}),e[9]=s,e[10]=h,e[11]=w,e[12]=I):I=e[12],I}if(n.type==="enum"){let x;e[13]!==n?(x=t.jsx(Z,{field:n}),e[13]=n,e[14]=x):x=e[14];let g;e[15]!==s||e[16]!==x?(g=t.jsx(J,{htmlFor:s,children:x}),e[15]=s,e[16]=x,e[17]=g):g=e[17];let h;e[18]!==a?(h=typeof a=="string"&&a?[a]:[],e[18]=a,e[19]=h):h=e[19];let w;e[20]!==i?(w=y=>{y[0]&&i(y[0])},e[20]=i,e[21]=w):w=e[21];const I=n.label;let q;e[22]!==n.options?(q=n.options??[],e[22]=n.options,e[23]=q):q=e[23];let N;if(e[24]!==r||e[25]!==q){let y;e[27]!==r?(y=v=>t.jsx(xe,{value:v.value,disabled:r,className:"w-full justify-start px-3",children:v.label},v.value),e[27]=r,e[28]=y):y=e[28],N=q.map(y),e[24]=r,e[25]=q,e[26]=N}else N=e[26];let j;e[29]!==n.label||e[30]!==s||e[31]!==h||e[32]!==w||e[33]!==N?(j=t.jsx(pe,{id:s,value:h,onValueChange:w,orientation:"vertical",variant:"outline",size:"sm",className:"w-full items-stretch","aria-label":I,children:N}),e[29]=n.label,e[30]=s,e[31]=h,e[32]=w,e[33]=N,e[34]=j):j=e[34];let k;return e[35]!==g||e[36]!==j?(k=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[g,j]}),e[35]=g,e[36]=j,e[37]=k):k=e[37],k}let o;e[38]!==n?(o=t.jsx(Z,{field:n}),e[38]=n,e[39]=o):o=e[39];let d;e[40]!==s||e[41]!==o?(d=t.jsx(J,{htmlFor:s,children:o}),e[40]=s,e[41]=o,e[42]=d):d=e[42];const u=n.type==="string"?"text":"number",p=typeof a=="string"?a:"";let f;e[43]!==i?(f=x=>i(x.target.value),e[43]=i,e[44]=f):f=e[44];let c;e[45]!==r||e[46]!==n.label||e[47]!==s||e[48]!==u||e[49]!==p||e[50]!==f?(c=t.jsx(me,{id:s,"aria-label":n.label,type:u,value:p,disabled:r,onChange:f}),e[45]=r,e[46]=n.label,e[47]=s,e[48]=u,e[49]=p,e[50]=f,e[51]=c):c=e[51];let l;return e[52]!==d||e[53]!==c?(l=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,c]}),e[52]=d,e[53]=c,e[54]=l):l=e[54],l}function Z(m){const e=B.c(8),{field:s}=m;let n;e[0]!==s.required?(n=s.required&&t.jsx("span",{className:"ml-0.5 text-warning",children:"*"}),e[0]=s.required,e[1]=n):n=e[1];let a;e[2]!==s.description?(a=s.description&&t.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:s.description}),e[2]=s.description,e[3]=a):a=e[3];let r;return e[4]!==s.label||e[5]!==n||e[6]!==a?(r=t.jsxs("span",{className:"min-w-0",children:[s.label,n,a]}),e[4]=s.label,e[5]=n,e[6]=a,e[7]=r):r=e[7],r}function te(m){const e=B.c(8),{server:s,children:n}=m;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Me,{className:"text-info"}),e[0]=a):a=e[0];let r;e[1]!==s?(r=t.jsxs(ee,{children:[s," needs input"]}),e[1]=s,e[2]=r):r=e[2];let i;e[3]!==n?(i=t.jsx("div",{className:"col-start-2 mt-1 min-w-0",children:n}),e[3]=n,e[4]=i):i=e[4];let o;return e[5]!==r||e[6]!==i?(o=t.jsxs(se,{className:"border-info/40 bg-info/5",children:[a,r,i]}),e[5]=r,e[6]=i,e[7]=o):o=e[7],o}function Ye(m){const e=B.c(15),{request:s,responding:n,onChoose:a}=m;let r,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Pe,{className:"text-warning"}),i=t.jsx(ee,{children:"The agent declined this request"}),e[0]=r,e[1]=i):(r=e[0],i=e[1]);let o;e[2]!==s.originalModel?(o=t.jsxs("p",{className:"text-sm leading-relaxed text-foreground",children:[s.originalModel," would not answer. Retrying on a fallback model may work."]}),e[2]=s.originalModel,e[3]=o):o=e[3];let d;e[4]!==s.guidanceText?(d=s.guidanceText&&t.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:s.guidanceText}),e[4]=s.guidanceText,e[5]=d):d=e[5];let u;e[6]!==a||e[7]!==s.fallbackModel||e[8]!==s.requestId||e[9]!==n?(u=a&&t.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t.jsxs(M,{size:"sm",disabled:n,onClick:()=>a(s.requestId,"retry_fallback"),children:["Retry on ",s.fallbackModel]}),t.jsx(M,{variant:"outline",size:"sm",disabled:n,onClick:()=>a(s.requestId,"edit_prompt"),children:"Edit prompt"}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,className:"ml-auto text-muted-foreground",onClick:()=>a(s.requestId,"cancelled"),children:"Dismiss"})]}),e[6]=a,e[7]=s.fallbackModel,e[8]=s.requestId,e[9]=n,e[10]=u):u=e[10];let p;return e[11]!==o||e[12]!==d||e[13]!==u?(p=t.jsxs(se,{className:"border-warning/40 bg-warning/5",children:[r,i,t.jsxs("div",{className:"col-start-2 mt-1 min-w-0",children:[o,d,u]})]}),e[11]=o,e[12]=d,e[13]=u,e[14]=p):p=e[14],p}function He(m){const e=B.c(64),{request:s,input:n,canAnswer:a,onOpen:r}=m;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];const[o,d]=V.useState(i),{sessionId:u}=s;switch(s.kind){case"permission":{const p=s.request;let f;e[1]!==n.responding||e[2]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[1]=n.responding,e[2]=s.request.requestId,e[3]=f):f=e[3];let c;e[4]!==a||e[5]!==n||e[6]!==u?(c=a?(x,g)=>void n.respond(u,x,g):void 0,e[4]=a,e[5]=n,e[6]=u,e[7]=c):c=e[7];let l;return e[8]!==s.request||e[9]!==f||e[10]!==c?(l=t.jsx(he,{request:p,queued:0,responding:f,onRespond:c}),e[8]=s.request,e[9]=f,e[10]=c,e[11]=l):l=e[11],l}case"question":{const p=s.request;let f;e[12]!==n.responding||e[13]!==s.request.toolUseId?(f=n.responding.has(s.request.toolUseId),e[12]=n.responding,e[13]=s.request.toolUseId,e[14]=f):f=e[14];let c;e[15]!==o||e[16]!==s.request.toolUseId?(c=o.has(s.request.toolUseId),e[15]=o,e[16]=s.request.toolUseId,e[17]=c):c=e[17];let l;e[18]!==a||e[19]!==n||e[20]!==u?(l=a?async(g,h)=>{(await n.answerQuestion(u,g,h)).gone&&d(I=>new Set(I).add(g))}:void 0,e[18]=a,e[19]=n,e[20]=u,e[21]=l):l=e[21];let x;return e[22]!==r||e[23]!==s.request||e[24]!==f||e[25]!==c||e[26]!==l?(x=t.jsx(ge,{request:p,responding:f,gone:c,onAnswer:l,onOpenSession:r}),e[22]=r,e[23]=s.request,e[24]=f,e[25]=c,e[26]=l,e[27]=x):x=e[27],x}case"elicitation":{const p=s.request;let f;e[28]!==n.responding||e[29]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[28]=n.responding,e[29]=s.request.requestId,e[30]=f):f=e[30];let c;e[31]!==a||e[32]!==n||e[33]!==u?(c=a?(x,g)=>void n.answerElicitation(u,x,g):void 0,e[31]=a,e[32]=n,e[33]=u,e[34]=c):c=e[34];let l;return e[35]!==s.request||e[36]!==f||e[37]!==c?(l=t.jsx(Fe,{request:p,responding:f,onAnswer:c}),e[35]=s.request,e[36]=f,e[37]=c,e[38]=l):l=e[38],l}case"dialog":{const p=s.request;let f;e[39]!==n.responding||e[40]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[39]=n.responding,e[40]=s.request.requestId,e[41]=f):f=e[41];let c;e[42]!==a||e[43]!==n||e[44]!==u?(c=a?(x,g)=>void n.answerDialog(u,x,g):void 0,e[42]=a,e[43]=n,e[44]=u,e[45]=c):c=e[45];let l;return e[46]!==s.request||e[47]!==f||e[48]!==c?(l=t.jsx(Ye,{request:p,responding:f,onChoose:c}),e[46]=s.request,e[47]=f,e[48]=c,e[49]=l):l=e[49],l}case"plan":case"deferred":{let p;e[50]!==s.kind?(p=s.kind==="plan"?t.jsx(Oe,{className:"text-warning"}):t.jsx(Re,{className:"text-warning"}),e[50]=s.kind,e[51]=p):p=e[51];const f=s.kind==="plan"?"A plan is waiting for review":"A permission was deferred";let c;e[52]!==f?(c=t.jsx(ee,{children:f}),e[52]=f,e[53]=c):c=e[53];const l=s.kind==="plan"?"Review it in its session.":"Open the session and resume it to answer.";let x;e[54]!==l?(x=t.jsx("p",{className:"col-start-2 mt-1 text-sm text-muted-foreground",children:l}),e[54]=l,e[55]=x):x=e[55];let g;e[56]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(ue,{"data-icon":"inline-end"}),e[56]=g):g=e[56];let h;e[57]!==r?(h=t.jsx("div",{className:"col-start-2 mt-2",children:t.jsxs(M,{size:"xs",onClick:r,children:["Open session",g]})}),e[57]=r,e[58]=h):h=e[58];let w;return e[59]!==p||e[60]!==c||e[61]!==x||e[62]!==h?(w=t.jsxs(se,{className:"border-warning/40 bg-warning/5",children:[p,c,x,h]}),e[59]=p,e[60]=c,e[61]=x,e[62]=h,e[63]=w):w=e[63],w}}}function Ke(m,e,s=()=>!0){const n=new Map(e.map(i=>[i.sessionId,i])),a=i=>{const o=n.get(i);return o?ae(o):Date.now()},r=[];for(const[i,o]of m.permissionsBySession)for(const d of o)r.push({kind:"permission",sessionId:i,since:d.timestamp,request:d});for(const[i,o]of m.questionsBySession)for(const d of o)r.push({kind:"question",sessionId:i,since:d.askedAt,request:d});for(const[i,o]of m.elicitationsBySession)for(const d of o)r.push({kind:"elicitation",sessionId:i,since:d.askedAt,request:d});for(const[i,o]of m.dialogsBySession)for(const d of o)r.push({kind:"dialog",sessionId:i,since:d.askedAt,request:d});for(const i of m.awaitingPlan)r.push({kind:"plan",sessionId:i,since:a(i)});for(const i of e)i.agentStatus==="deferred"&&!i.archived&&r.push({kind:"deferred",sessionId:i.sessionId,since:a(i.sessionId)});return r.filter(i=>s(i.sessionId)).sort((i,o)=>i.since-o.since)}function ne(m){switch(m.kind){case"permission":return m.request.requestId;case"question":return m.request.toolUseId;case"elicitation":case"dialog":return m.request.requestId;default:return`${m.kind}:${m.sessionId}`}}const Ve=864e5,ie=3,Ge=8;function Xe(m,e,s=Date.now()){const n=m.filter(d=>!d.archived&&!(d.teamName&&d.agentName)),{topLevel:a,crewOf:r}=be(n),i=a.map(d=>{const u=r.get(d.sessionId)??[],p=u.length?je(d,u):d.lastActivityAt||d.lastModified,f=[d,...u].flatMap(c=>(c.pullRequests??[]).map(l=>({pullRequest:l,by:c}))).sort((c,l)=>Date.parse(l.pullRequest.timestamp)-Date.parse(c.pullRequest.timestamp))[0];return{session:d,members:u,cells:u.map(c=>e(c).state),counts:u.length?we(u,e):null,activityAt:p,...f&&{landed:{number:f.pullRequest.number,title:f.pullRequest.title,url:f.pullRequest.url,by:f.by}}}}).sort((d,u)=>Date.parse(u.activityAt)-Date.parse(d.activityAt)),o=i.filter(d=>s-Date.parse(d.activityAt)<Ve);return(o.length>=ie?o:i.slice(0,ie)).slice(0,Ge)}function Je(m){const e=new Date(m);return e.setHours(0,0,0,0),e.getTime()}const Ze=10;function We(m,e,s=Date.now()){const n=Je(s),a=[],r=new Map;for(const i of m){if(i.archived)continue;for(const d of i.pullRequests??[]){const u=Date.parse(d.timestamp);u>=n&&a.push({kind:"pr",at:u,session:i,number:d.number,title:d.title,url:d.url})}if(!i.crew)continue;const o=ae(i);if(o>=n&&e(i).state==="done"&&a.push({kind:"finished",at:o,session:i}),i.crew.startedAt>=n){const d=`${i.crew.parentId}:${Math.floor(i.crew.startedAt/6e4)}`,u=r.get(d);u?u.push(i):r.set(d,[i])}}for(const i of r.values())a.push({kind:"started",at:Math.min(...i.map(o=>o.crew.startedAt)),parentId:i[0].crew.parentId,sessions:i});return a.sort((i,o)=>o.at-i.at).slice(0,Ze)}const es={working:"bg-success shadow-[0_0_0_1.5px_color-mix(in_oklch,var(--success)_25%,transparent)]","needs-you":"bg-warning",done:"bg-muted-foreground/40"};function fs(m){const e=B.c(69),{onOpenSession:s,onNewSession:n,onBrowseProjects:a,newSessionControl:r}=m,i=Ne(),o=Ie(),{names:d}=qe(),{names:u}=ke(),p=ye();let f;e[0]!==i.sessions?(f=i.sessions.filter(ns),e[0]=i.sessions,e[1]=f):f=e[1];const c=f;let l;e[2]!==c?(l=new Map(c.map(ts)),e[2]=c,e[3]=l):l=e[3];const x=l;let g;e[4]!==o.awaitingDialog||e[5]!==o.awaitingElicitation?(g=new Set([...o.awaitingElicitation,...o.awaitingDialog]),e[4]=o.awaitingDialog,e[5]=o.awaitingElicitation,e[6]=g):g=e[6];let h;e[7]!==o.awaitingPermission||e[8]!==o.awaitingPlan||e[9]!==o.awaitingQuestion||e[10]!==g?(h={awaitingPermission:o.awaitingPermission,awaitingQuestion:o.awaitingQuestion,awaitingPrompt:g,awaitingPlan:o.awaitingPlan},e[7]=o.awaitingPermission,e[8]=o.awaitingPlan,e[9]=o.awaitingQuestion,e[10]=g,e[11]=h):h=e[11];const w=h;let I;e[12]!==i.procBySession||e[13]!==w?(I=z=>ve(z,i.procBySession,w),e[12]=i.procBySession,e[13]=w,e[14]=I):I=e[14];const q=I;let N;e[15]!==x||e[16]!==p?(N=z=>{const H=x.get(z);return p(H==null?void 0:H.access).canInteract},e[15]=x,e[16]=p,e[17]=N):N=e[17];const j=N;let k;e[18]!==j||e[19]!==o||e[20]!==c?(k=Ke(o,c,j),e[18]=j,e[19]=o,e[20]=c,e[21]=k):k=e[21];const y=k;let v;e[22]!==c||e[23]!==q?(v=Xe(c,q),e[22]=c,e[23]=q,e[24]=v):v=e[24];const Q=v;let P;e[25]!==c||e[26]!==q?(P=We(c,q),e[25]=c,e[26]=q,e[27]=P):P=e[27];const F=P;let Y;e[28]!==x||e[29]!==d?(Y=z=>Se(z,x,d),e[28]=x,e[29]=d,e[30]=Y):Y=e[30];const _=Y;let O;e[31]!==x||e[32]!==s?(O=z=>{const H=x.get(z);H?s(H.dirName,H.fileName):_e(z)},e[31]=x,e[32]=s,e[33]=O):O=e[33];const A=O;let R;e[34]!==i.processes?(R=i.processes.filter(ss),e[34]=i.processes,e[35]=R):R=e[35];const D=R.length;let E;e[36]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Mission Control"}),e[36]=E):E=e[36];let C;e[37]!==x||e[38]!==j||e[39]!==o||e[40]!==_||e[41]!==A||e[42]!==y?(C=t.jsx(is,{queue:y,input:o,byId:x,nameOf:_,onOpen:A,canAnswer:j}),e[37]=x,e[38]=j,e[39]=o,e[40]=_,e[41]=A,e[42]=y,e[43]=C):C=e[43];let T;e[44]!==u?(T=z=>u[z.dirName]??Ae(z),e[44]=u,e[45]=T):T=e[45];let L;e[46]!==_||e[47]!==a||e[48]!==n||e[49]!==A||e[50]!==T||e[51]!==Q?(L=t.jsx(ls,{sessions:Q,nameOf:_,projectLabel:T,onOpen:A,onNewSession:n,onBrowseProjects:a}),e[46]=_,e[47]=a,e[48]=n,e[49]=A,e[50]=T,e[51]=Q,e[52]=L):L=e[52];let b;e[53]!==F||e[54]!==_||e[55]!==A?(b=t.jsx(as,{events:F,nameOf:_,onOpen:A}),e[53]=F,e[54]=_,e[55]=A,e[56]=b):b=e[56];let S;e[57]!==L||e[58]!==b?(S=t.jsxs("div",{className:"flex min-w-0 flex-col gap-8",children:[L,b]}),e[57]=L,e[58]=b,e[59]=S):S=e[59];let U;e[60]!==C||e[61]!==S?(U=t.jsxs("div",{className:"grid gap-8 lg:grid-cols-[minmax(0,380px)_minmax(0,1fr)]",children:[C,S]}),e[60]=C,e[61]=S,e[62]=U):U=e[62];let $;e[63]!==D?($=D>0&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[D," ",D===1?"agent":"agents"," running on this machine."]}),e[63]=D,e[64]=$):$=e[64];let K;return e[65]!==r||e[66]!==U||e[67]!==$?(K=t.jsx(Ce,{className:"h-full",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-8 px-6 pb-10 pt-16 lg:px-10",children:[E,U,$,r]})}),e[65]=r,e[66]=U,e[67]=$,e[68]=K):K=e[68],K}function ss(m){return m.sessionId}function ts(m){return[m.sessionId,m]}function ns(m){return!m.archived}function X(m){const e=B.c(9),{title:s,count:n,children:a}=m;let r;e[0]!==s?(r=t.jsx("h2",{className:"text-sm font-medium",children:s}),e[0]=s,e[1]=r):r=e[1];let i;e[2]!==n?(i=n!==void 0&&t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n}),e[2]=n,e[3]=i):i=e[3];let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("span",{className:"flex-1"}),e[4]=o):o=e[4];let d;return e[5]!==a||e[6]!==r||e[7]!==i?(d=t.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[r,i,o,a]}),e[5]=a,e[6]=r,e[7]=i,e[8]=d):d=e[8],d}function W(m,e){const s=m==null?void 0:m.crew;return s?e(s.rootId)??s.rootTitle??null:null}const le={permission:"asked a permission",question:"asked a question",elicitation:"asked for input",dialog:"needs a choice",plan:"has a plan to review",deferred:"has a deferred permission"};function is(m){const e=B.c(73),{queue:s,input:n,byId:a,nameOf:r,onOpen:i,canAnswer:o}=m,[d,u]=V.useState(0);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];const f=V.useRef(p);if(s.length===0){let b;e[1]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(X,{title:"Needs you",count:0}),e[1]=b):b=e[1];let S;return e[2]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsxs("section",{"aria-label":"Needs you",className:"min-w-0",children:[b,t.jsx(oe,{children:t.jsx(re,{children:t.jsx(ce,{children:"Nothing is waiting on you."})})})]}),e[2]=S):S=e[2],S}const c=Math.min(d,s.length-1),l=s[c];let x;if(e[3]!==a||e[4]!==r||e[5]!==l.sessionId){const b=a.get(l.sessionId);x=W(b,r),e[3]=a,e[4]=r,e[5]=l.sessionId,e[6]=x}else x=e[6];const g=x;let h;e[7]!==c||e[8]!==o||e[9]!==n||e[10]!==i||e[11]!==s.length||e[12]!==l.kind||e[13]!==l.request||e[14]!==l.sessionId?(h=b=>{const S=b.target;if(!(S.closest("input,textarea,select,[contenteditable=true]")||b.metaKey||b.ctrlKey||b.altKey)&&((b.key==="j"||b.key==="n"||b.key==="ArrowDown")&&(b.preventDefault(),u(Math.min(s.length-1,c+1))),(b.key==="k"||b.key==="ArrowUp")&&(b.preventDefault(),u(Math.max(0,c-1))),b.key==="o"&&(b.preventDefault(),i(l.sessionId)),(b.key==="Enter"||b.key==="d")&&S===b.currentTarget&&o(l.sessionId))){if(l.kind!=="permission")return;const U=b.key==="d"||l.request.defaultToNo?"deny":"allow",$=l.request.requestId;if(l.request.availableDecisions&&!l.request.availableDecisions.includes(U)||(b.preventDefault(),f.current.has($)||n.responding.has($)))return;f.current.add($),n.respond(l.sessionId,$,U).finally(()=>f.current.delete($))}},e[7]=c,e[8]=o,e[9]=n,e[10]=i,e[11]=s.length,e[12]=l.kind,e[13]=l.request,e[14]=l.sessionId,e[15]=h):h=e[15];const w=h;let I;e[16]!==c||e[17]!==s.length?(I=s.length>1&&t.jsxs("span",{className:"flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[c+1," of ",s.length,t.jsx(M,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:c===0,onClick:()=>u(c-1),children:t.jsx(Ee,{"data-icon":"inline-start"})}),t.jsx(M,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:c===s.length-1,onClick:()=>u(c+1),children:t.jsx(ue,{"data-icon":"inline-start"})})]}),e[16]=c,e[17]=s.length,e[18]=I):I=e[18];let q;e[19]!==s.length||e[20]!==I?(q=t.jsx(X,{title:"Needs you",count:s.length,children:I}),e[19]=s.length,e[20]=I,e[21]=q):q=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-warning","aria-hidden":"true"}),e[22]=N):N=e[22];let j;e[23]!==i||e[24]!==l.sessionId?(j=()=>i(l.sessionId),e[23]=i,e[24]=l.sessionId,e[25]=j):j=e[25];let k;e[26]!==r||e[27]!==l.sessionId?(k=r(l.sessionId)??"A session",e[26]=r,e[27]=l.sessionId,e[28]=k):k=e[28];let y;e[29]!==j||e[30]!==k?(y=t.jsx("button",{type:"button",onClick:j,className:"min-w-0 truncate rounded-sm font-medium outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:k}),e[29]=j,e[30]=k,e[31]=y):y=e[31];let v;e[32]!==g?(v=g&&t.jsxs("span",{className:"min-w-0 truncate text-muted-foreground",children:["· ",g]}),e[32]=g,e[33]=v):v=e[33];let Q;e[34]!==l.since?(Q=G(new Date(l.since).toISOString()),e[34]=l.since,e[35]=Q):Q=e[35];let P;e[36]!==Q?(P=t.jsxs("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-warning",children:["waiting ",Q]}),e[36]=Q,e[37]=P):P=e[37];let F;e[38]!==v||e[39]!==P||e[40]!==y?(F=t.jsxs("div",{className:"flex items-center gap-2 px-0.5 text-[13px]",children:[N,y,v,P]}),e[38]=v,e[39]=P,e[40]=y,e[41]=F):F=e[41];const Y=le[l.kind];let _;e[42]!==Y?(_=t.jsx("p",{className:"px-0.5 text-xs text-muted-foreground",children:Y}),e[42]=Y,e[43]=_):_=e[43];let O;e[44]!==l?(O=ne(l),e[44]=l,e[45]=O):O=e[45];let A;e[46]!==o||e[47]!==l.sessionId?(A=o(l.sessionId),e[46]=o,e[47]=l.sessionId,e[48]=A):A=e[48];let R;e[49]!==i||e[50]!==l.sessionId?(R=()=>i(l.sessionId),e[49]=i,e[50]=l.sessionId,e[51]=R):R=e[51];let D;e[52]!==n||e[53]!==l||e[54]!==O||e[55]!==A||e[56]!==R?(D=t.jsx(He,{request:l,input:n,canAnswer:A,onOpen:R},O),e[52]=n,e[53]=l,e[54]=O,e[55]=A,e[56]=R,e[57]=D):D=e[57];let E;e[58]!==F||e[59]!==_||e[60]!==D?(E=t.jsxs("div",{className:"flex flex-col gap-2",children:[F,_,D]}),e[58]=F,e[59]=_,e[60]=D,e[61]=E):E=e[61];let C;e[62]!==c||e[63]!==a||e[64]!==r||e[65]!==s?(C=s.length>1&&t.jsx("ol",{className:"mt-3 flex flex-col","aria-label":"Also waiting",children:s.map((b,S)=>S===c?null:t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>u(S),className:"grid w-full grid-cols-[18px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-lg px-2 py-2 text-left text-[12.5px] outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsx("span",{className:"text-right text-[11px] tabular-nums text-muted-foreground/80",children:S+1}),t.jsxs("span",{className:"flex min-w-0 flex-col",children:[t.jsxs("span",{className:"truncate font-medium",children:[r(b.sessionId)??"A session",W(a.get(b.sessionId),r)&&t.jsxs("span",{className:"font-normal text-muted-foreground",children:[" · ",W(a.get(b.sessionId),r)]})]}),t.jsx("span",{className:"truncate text-[11.5px] text-muted-foreground",children:le[b.kind]})]}),t.jsx("span",{className:"text-[11px] tabular-nums text-warning",children:G(new Date(b.since).toISOString())})]})},ne(b)))}),e[62]=c,e[63]=a,e[64]=r,e[65]=s,e[66]=C):C=e[66];let T;e[67]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("p",{className:"mt-2 px-0.5 text-[11px] text-muted-foreground/80",children:"J / K move · Enter answers · D denies · O opens"}),e[67]=T):T=e[67];let L;return e[68]!==w||e[69]!==E||e[70]!==C||e[71]!==q?(L=t.jsxs("section",{"aria-label":"Needs you",tabIndex:0,onKeyDown:w,className:"min-w-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[q,E,C,T]}),e[68]=w,e[69]=E,e[70]=C,e[71]=q,e[72]=L):L=e[72],L}function ls(m){const e=B.c(16),{sessions:s,nameOf:n,projectLabel:a,onOpen:r,onNewSession:i,onBrowseProjects:o}=m;let d;e[0]!==o?(d=o&&t.jsxs(M,{variant:"ghost",size:"xs",className:"text-muted-foreground",onClick:o,children:[t.jsx(Te,{"data-icon":"inline-start"}),"All projects"]}),e[0]=o,e[1]=d):d=e[1];let u;e[2]!==i?(u=i&&t.jsxs(M,{variant:"outline",size:"xs",onClick:i,children:[t.jsx(Le,{"data-icon":"inline-start"}),"New session"]}),e[2]=i,e[3]=u):u=e[3];let p;e[4]!==s.length||e[5]!==d||e[6]!==u?(p=t.jsxs(X,{title:"Your sessions",count:s.length,children:[d,u]}),e[4]=s.length,e[5]=d,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==n||e[9]!==r||e[10]!==a||e[11]!==s?(f=s.length===0?t.jsx(oe,{children:t.jsx(re,{children:t.jsx(ce,{children:"Start a session and it shows up here, with every session it starts."})})}):t.jsx("ul",{className:"flex flex-col",children:s.map(l=>t.jsxs("li",{className:"border-t border-border/70 first:border-t-0",children:[l.members.length>0&&t.jsx("div",{role:"group","aria-label":`${n(l.session.sessionId)} crew`,className:"flex flex-wrap gap-1 px-3 pt-3",children:l.members.map((x,g)=>t.jsx("button",{type:"button","aria-label":`Open ${n(x.sessionId)??"crew member"}`,title:`${n(x.sessionId)}: ${l.cells[g]}`,onClick:()=>r(x.sessionId),className:"flex size-5 items-center justify-center rounded-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:t.jsx("span",{className:De("size-2 rounded-[2px]",es[l.cells[g]])})},x.sessionId))}),t.jsxs("button",{type:"button",onClick:()=>r(l.session.sessionId),className:"grid w-full grid-cols-1 items-center gap-x-4 gap-y-1 rounded-lg px-3 py-3 text-left outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring xl:grid-cols-[minmax(0,1fr)_auto]",children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[t.jsx("span",{className:"truncate text-[13.5px] font-medium",children:n(l.session.sessionId)??"Untitled session"}),t.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground sm:inline",children:a(l.session)})]}),t.jsx("span",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:l.counts?t.jsxs(t.Fragment,{children:[l.counts.working>0&&t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:l.counts.working})," working"]}),l.counts.needsYou>0&&t.jsxs("span",{className:"text-warning",children:[t.jsx("span",{className:"font-medium tabular-nums",children:l.counts.needsYou})," need you"]}),t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:l.counts.size})," in crew"]})]}):l.session.isActive&&t.jsx("span",{children:"working"})}),t.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[l.landed&&t.jsxs(de,{variant:"outline",className:"shrink-0",children:["#",l.landed.number]}),t.jsx("span",{className:"truncate",children:l.landed?`${l.landed.title??"Pull request"} · ${n(l.landed.by.sessionId)??""}`:l.session.lastUserMessage??""})]}),t.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:l.counts?`crew active ${G(l.activityAt)}`:G(l.activityAt)})]})]},l.session.sessionId))}),e[8]=n,e[9]=r,e[10]=a,e[11]=s,e[12]=f):f=e[12];let c;return e[13]!==p||e[14]!==f?(c=t.jsxs("section",{"aria-label":"Your sessions",className:"min-w-0",children:[p,f]}),e[13]=p,e[14]=f,e[15]=c):c=e[15],c}function as(m){const e=B.c(10),{events:s,nameOf:n,onOpen:a}=m;if(s.length===0)return null;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(X,{title:"Landed today"}),e[0]=r):r=e[0];let i;if(e[1]!==s||e[2]!==n||e[3]!==a){let d;e[5]!==n||e[6]!==a?(d=u=>{const p=u.kind==="started"?u.parentId:u.session.sessionId,f=new Date(u.at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>a(p),className:"grid w-full grid-cols-[48px_minmax(0,1fr)] items-baseline gap-2.5 rounded-md px-3 py-1.5 text-left text-[12.5px] outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:f}),t.jsx("span",{className:"min-w-0 truncate",children:os(u,n)})]})},`${u.kind}:${p}:${u.at}`)},e[5]=n,e[6]=a,e[7]=d):d=e[7],i=s.map(d),e[1]=s,e[2]=n,e[3]=a,e[4]=i}else i=e[4];let o;return e[8]!==i?(o=t.jsxs("section",{"aria-label":"Landed today",className:"min-w-0",children:[r,t.jsx("ol",{className:"flex flex-col",children:i})]}),e[8]=i,e[9]=o):o=e[9],o}function os(m,e){switch(m.kind){case"pr":return t.jsxs(t.Fragment,{children:[t.jsxs(de,{variant:"outline",className:"mr-2 text-success",children:["#",m.number]}),t.jsx("span",{className:"font-medium",children:e(m.session.sessionId)??"A session"}),t.jsxs("span",{className:"text-muted-foreground",children:[" · ",m.title??"opened a pull request"]})]});case"finished":return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium",children:e(m.session.sessionId)??"A session"}),t.jsx("span",{className:"text-muted-foreground",children:" finished"})]});case"started":return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium",children:m.sessions.length===1?e(m.sessions[0].sessionId)??"A session":`${m.sessions.length} sessions`}),t.jsxs("span",{className:"text-muted-foreground",children:[" started · ",e(m.parentId)??"by another session"]})]})}}export{fs as MissionHome};
@@ -1 +0,0 @@
1
- import{r as x,j as e}from"./vendor-react-gGw_S5I_.js";import{Y as K,B as h,J as E,l as V,L as _,M as ee,N as se,O as ne,Q as ae,Z as re,_ as C,$ as te,a0 as ie,a1 as oe,a2 as S,a3 as le,a4 as U,a5 as T,a6 as $,a7 as ce,a8 as F,a9 as P,aa as O,ab as I,ac as M,U as p,ad as d}from"./index-DUfVcKxj.js";import{G as y,g as de,a as he,X as me,b as xe,h as ue,i as B,C as pe,F as ge}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function b(l){return l.commitsAhead>0&&(!l.branch||C(l.name,l.branch))}const je={M:"text-warning",A:"text-success",D:"text-destructive",R:"text-info"};function Ce({worktrees:l,loading:g,dirName:t,onRefetch:j,onOpenSession:J,onClose:L}){const c=K("hostFiles"),[W,N]=x.useState(null),[G,w]=x.useState(null),[H,u]=x.useState(!1),[a,m]=x.useState(null),[r,f]=x.useState(null),D=async s=>{if(!(!c||!t)){N(s.name);try{const n=await p(`/api/worktrees/${encodeURIComponent(t)}/${encodeURIComponent(s.name)}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:s.isDirty})});if(!n.ok){const{error:i}=await n.json().catch(()=>({error:void 0}));throw new Error(i??`HTTP ${n.status}`)}j()}catch(n){d.error(`Failed to delete worktree: ${n instanceof Error?n.message:"Unknown error"}`)}finally{N(null)}}},q=s=>{if(!(!c||!t)){if(s.isDirty){m({worktree:s,reason:"dirty"});return}if(b(s)){m({worktree:s,reason:"unpushed"});return}D(s)}},Q=()=>{if(!a)return;const{worktree:s,reason:n}=a;if(n==="dirty"&&b(s)){m({worktree:s,reason:"unpushed"});return}m(null),D(s)},X=async s=>{if(!(!c||!t)){w(s.name);try{const n=await p(`/api/worktrees/${encodeURIComponent(t)}/create-pr`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeName:s.name,title:s.name.replace(/-/g," ")})});if(n.ok){const i=await n.json();i.url?window.open(i.url,"_blank","noopener,noreferrer"):d.warning("PR created but no URL was returned")}else{const i=await n.json().catch(()=>({error:"Unknown error"}));d.error(`Failed to create PR: ${i.error||"Unknown error"}`)}}catch(n){d.error(`Error creating PR: ${n instanceof Error?n.message:"Unknown error"}`)}finally{w(null)}}},Y=async()=>{if(!(!c||!t)){u(!0);try{const s=await p(`/api/worktrees/${encodeURIComponent(t)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(s.ok){const{stale:n}=await s.json();n.length===0?d.info("No stale worktrees found"):f(n.map(i=>i.name))}}catch(s){d.error(`Cleanup failed: ${s instanceof Error?s.message:"Unknown error"}`)}finally{u(!1)}}},Z=async()=>{if(!c||!t||!r)return;const s=r;f(null),u(!0);try{await p(`/api/worktrees/${encodeURIComponent(t)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0,names:s})}),j()}catch(n){d.error(`Cleanup failed: ${n instanceof Error?n.message:"Unknown error"}`)}finally{u(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{"aria-label":"Worktrees",className:"flex size-full min-h-0 flex-col bg-canvas",children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[e.jsx(y,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Worktrees"}),e.jsx("div",{className:"flex-1"}),c&&e.jsx(h,{variant:"ghost",size:"icon-sm",onClick:Y,disabled:H,"aria-label":"Cleanup stale worktrees",children:e.jsx(de,{"data-icon":"inline-start"})}),e.jsx(h,{variant:"ghost",size:"icon-sm",onClick:j,disabled:g,"aria-label":"Refresh worktrees",children:e.jsx(he,{"data-icon":"inline-start",className:E(g&&"animate-spin")})}),e.jsx(h,{variant:"ghost",size:"icon-sm",onClick:L,"aria-label":"Close worktrees",children:e.jsx(me,{"data-icon":"inline-start"})})]}),e.jsx(V,{}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[!t&&e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select a project to view worktrees"}),t&&l.length===0&&!g&&e.jsx(_,{className:"border-0 py-16",children:e.jsxs(ee,{children:[e.jsx(se,{variant:"icon",children:e.jsx(y,{})}),e.jsx(ne,{children:"No worktrees"}),e.jsx(ae,{children:"Create a new session with “Isolate in worktree” enabled"})]})}),l.map(s=>{var A,R,z;const n=((A=s.changedFiles)==null?void 0:A.reduce((o,v)=>o+v.additions,0))??0,i=((R=s.changedFiles)==null?void 0:R.reduce((o,v)=>o+v.deletions,0))??0,k=((z=s.changedFiles)==null?void 0:z.length)??0;return e.jsxs("div",{className:"rounded-lg border bg-card p-3 transition-colors hover:bg-accent/40",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.name}),s.isDirty&&e.jsx("span",{className:"flex size-2 shrink-0 rounded-full bg-warning",title:"Uncommitted changes"}),s.commitsAhead>0&&e.jsxs(re,{variant:"outline",className:"h-5 shrink-0 px-1.5 text-xs",children:[s.commitsAhead," ahead"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[s.linkedSessions.length>0&&e.jsx(h,{variant:"ghost",size:"icon-xs",onClick:()=>J(s.linkedSessions[0]),"aria-label":"Open session",children:e.jsx(xe,{"data-icon":"inline-start"})}),c&&e.jsxs(e.Fragment,{children:[e.jsx(h,{variant:"ghost",size:"icon-xs",onClick:()=>X(s),disabled:G===s.name||s.commitsAhead===0,"aria-label":"Create PR",children:e.jsx(ue,{"data-icon":"inline-start"})}),e.jsx(h,{variant:"ghost",size:"icon-xs",onClick:()=>q(s),disabled:W===s.name,className:"text-destructive hover:bg-destructive/10 hover:text-destructive","aria-label":"Delete worktree",children:e.jsx(B,{"data-icon":"inline-start"})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"shrink-0 font-mono",children:s.head}),e.jsx("span",{className:"truncate",children:s.headMessage})]}),(s.createdAt||!C(s.name,s.branch))&&e.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[!C(s.name,s.branch)&&e.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(y,{className:"size-3 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:s.branch||"detached"})]}),s.createdAt&&e.jsx("span",{className:"shrink-0",children:te(s.createdAt)})]}),k>0&&e.jsxs(ie,{className:"mt-2",children:[e.jsxs(oe,{className:"group flex w-full items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(pe,{"data-icon":"inline-start",className:"size-3 transition-transform group-data-panel-open:rotate-90 motion-reduce:transition-none"}),e.jsx(ge,{"data-icon":"inline-start",className:"size-3"}),e.jsxs("span",{children:[k," file",k!==1?"s":""," changed"]}),e.jsx(S,{add:n,del:i,className:"ml-1"})]}),e.jsx(le,{children:e.jsx("div",{className:"mt-1.5 flex flex-col gap-px rounded-md bg-muted/40 p-1.5",children:s.changedFiles.map(o=>e.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5 font-mono text-xs",children:[e.jsx("span",{className:E("shrink-0 w-3 text-center",je[o.status]??"text-muted-foreground"),children:o.status}),e.jsx("span",{className:"truncate text-foreground/80",children:o.path}),e.jsx(S,{add:o.additions,del:o.deletions,className:"ml-auto text-muted-foreground"})]},o.path))})})]})]},s.name)})]})]}),e.jsx(U,{open:a!==null,onOpenChange:s=>{s||m(null)},children:e.jsxs(T,{size:"sm",children:[e.jsxs($,{children:[e.jsx(ce,{className:"bg-destructive/10 text-destructive",children:e.jsx(B,{})}),e.jsx(F,{children:(a==null?void 0:a.reason)==="dirty"?"Delete worktree with uncommitted changes?":"Delete worktree with unpushed commits?"}),e.jsxs(P,{children:[(a==null?void 0:a.reason)==="dirty"?`"${a.worktree.name}" has uncommitted changes.`:`"${a==null?void 0:a.worktree.name}" has ${a==null?void 0:a.worktree.commitsAhead} unpushed commit(s).`," "," ","Deleting it cannot be undone."]})]}),e.jsxs(O,{children:[e.jsx(I,{size:"sm",children:"Cancel"}),e.jsx(M,{variant:"destructive",size:"sm",onClick:Q,children:(a==null?void 0:a.reason)==="dirty"&&b(a.worktree)?"Continue":"Delete worktree"})]})]})}),e.jsx(U,{open:r!==null,onOpenChange:s=>{s||f(null)},children:e.jsxs(T,{children:[e.jsxs($,{children:[e.jsx(F,{children:"Remove stale worktrees?"}),e.jsxs(P,{children:[r==null?void 0:r.length," stale worktree",(r==null?void 0:r.length)===1?"":"s"," will be removed: ",r==null?void 0:r.join(", "),"."]})]}),e.jsxs(O,{children:[e.jsx(I,{size:"sm",children:"Cancel"}),e.jsx(M,{variant:"destructive",size:"sm",onClick:()=>void Z(),children:"Remove worktrees"})]})]})})]})}export{Ce as WorktreePanel};
@@ -1 +0,0 @@
1
- import{c as Z,j as t,r as v}from"./vendor-react-gGw_S5I_.js";import{J as Ze,C as le,bw as $e,bx as J,m as ut,n as ft,I as mt,E as _t,G as At,by as Et,B as ce,bz as ht,U as Ie,bA as xt,a0 as pt,a1 as gt,a3 as jt,b5 as nt,bB as bt,Z as et,bC as $t,as as zt,at as Tt,bD as vt,i as It,j as Dt,k as Pt,b7 as Lt,z as Rt,aK as Bt,h as Ut,D as Ft}from"./index-DUfVcKxj.js";import{af as Ot,ag as Mt,ah as Gt,ai as Ht,d as Vt,T as Wt,M as qt,aj as Xt,ak as Kt,al as Jt,aa as wt,C as Nt,am as at,an as Zt,l as Qt,x as Yt,ao as es,B as ts,ap as ss,aq as ns}from"./vendor-ui-Dxtv9P3W.js";import{P as rt}from"./password-BV9mqUzz.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function is(s){const e=Z.c(11);let n,i,a;e[0]!==s?({className:n,size:a,...i}=s,e[0]=s,e[1]=n,e[2]=i,e[3]=a):(n=e[1],i=e[2],a=e[3]);const r=a===void 0?"default":a;let l;e[4]!==n?(l=Ze("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-50",n),e[4]=n,e[5]=l):l=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(Mt,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-foreground ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"}),e[6]=f):f=e[6];let c;return e[7]!==i||e[8]!==r||e[9]!==l?(c=t.jsx(Ot,{"data-slot":"switch","data-size":r,className:l,...i,children:f}),e[7]=i,e[8]=r,e[9]=l,e[10]=c):c=e[10],c}function as(s){const e=Z.c(3),{name:n}=s,i=n.toLowerCase();if(i.includes("iphone")||i.includes("android")){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Vt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=r):r=e[0],r}if(i.includes("ipad")||i.includes("tablet")){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Wt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[1]=r):r=e[1],r}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(qt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[2]=a):a=e[2],a}function it(s){const e=Math.floor((Date.now()-s)/1e3);if(e<60)return"just now";const n=Math.floor(e/60);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ls(s){const e=[`Shared ${it(s.createdAt)}`,s.lastAccessAt>0?`opened ${it(s.lastAccessAt)}`:"never opened"];return s.guests>0&&e.push(s.guests===1?"1 guest":`${s.guests} guests`),e.join(" · ")}function rs(){const s=Z.c(12),{shares:e,revoke:n,revokeAll:i}=Et();let a;s[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("p",{className:"text-xs text-muted-foreground",children:"Shared sessions"}),s[0]=a):a=s[0];let r;s[1]!==i||s[2]!==e.length?(r=e.length>0&&t.jsx(ce,{variant:"ghost",size:"xs",className:"text-destructive hover:text-destructive",onClick:()=>void i(),children:"Revoke all"}),s[1]=i,s[2]=e.length,s[3]=r):r=s[3];let l;s[4]!==r?(l=t.jsxs("div",{className:"flex h-6 items-center justify-between",children:[a,r]}),s[4]=r,s[5]=l):l=s[5];let f;s[6]!==n||s[7]!==e?(f=e.length===0?t.jsx("p",{className:"text-xs text-muted-foreground",children:"No sessions are shared."}):t.jsx("div",{className:"flex flex-col gap-1.5",children:e.map(o=>{const m=o.title||o.sessionId;return t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border px-3 py-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm text-foreground",children:m}),t.jsx("p",{className:"text-xs text-muted-foreground",children:ls(o)})]}),t.jsx(ce,{variant:"ghost",size:"xs","aria-label":`Revoke share of ${m}`,className:"text-destructive hover:text-destructive",onClick:()=>void n(o.sessionId),children:"Revoke"})]},o.sessionId)})}),s[6]=n,s[7]=e,s[8]=f):f=s[8];let c;return s[9]!==l||s[10]!==f?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[l,f]}),s[9]=l,s[10]=f,s[11]=c):c=s[11],c}function os(s){const e=Z.c(30),{networkAccess:n,setNetworkAccess:i,networkPassword:a,setNetworkPassword:r,showNetworkPassword:l,setShowNetworkPassword:f,hasExistingPassword:c,initialNetworkAccess:o,connectedDevices:m,minPasswordLength:b}=s;let x;e[0]!==n?(x=n?t.jsx(Xt,{"data-icon":"inline-start",className:"size-4 text-success"}):t.jsx(Kt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=n,e[1]=x):x=e[1];let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Network Access"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow other devices to connect"})]}),e[2]=j):j=e[2];let y;e[3]!==x?(y=t.jsxs("div",{className:"flex items-center gap-2",children:[x,j]}),e[3]=x,e[4]=y):y=e[4];let C;e[5]!==i?(C=_=>i(_),e[5]=i,e[6]=C):C=e[6];let w;e[7]!==n||e[8]!==C?(w=t.jsx(is,{"aria-label":"Network Access",checked:n,onCheckedChange:C}),e[7]=n,e[8]=C,e[9]=w):w=e[9];let N;e[10]!==y||e[11]!==w?(N=t.jsxs("div",{className:"flex items-center justify-between",children:[y,w]}),e[10]=y,e[11]=w,e[12]=N):N=e[12];let p;e[13]!==c||e[14]!==b||e[15]!==n||e[16]!==a||e[17]!==r||e[18]!==f||e[19]!==l?(p=n&&t.jsxs(le,{"data-invalid":a.length>0&&a.length<b,children:[t.jsx($e,{htmlFor:"network-password",children:"Password"}),t.jsx(J,{children:c&&a.length===0?"A password is already set. Leave blank to keep it.":`Use at least ${b} characters.`}),t.jsxs(ut,{children:[t.jsx(ft,{id:"network-password",type:l?"text":"password",value:a,onChange:_=>r(_.target.value),placeholder:c?"Enter new password to change":"Set a password for remote access"}),t.jsx(mt,{align:"inline-end",children:t.jsx(_t,{size:"icon-xs","aria-label":l?"Hide password":"Show password",onClick:()=>f(!l),children:l?t.jsx(Gt,{"data-icon":"inline-start"}):t.jsx(Ht,{"data-icon":"inline-start"})})})]}),a.length>0&&a.length<b&&t.jsxs(At,{children:["Password must be at least ",b," characters (",a.length,"/",b,")"]}),t.jsx(J,{children:"Requires app restart. Remote browsers need an HTTPS reverse proxy; port 19384 remains available to Cogpit hubs and device clients."})]}),e[13]=c,e[14]=b,e[15]=n,e[16]=a,e[17]=r,e[18]=f,e[19]=l,e[20]=p):p=e[20];let u;e[21]!==m||e[22]!==o||e[23]!==n?(u=n&&o&&m.length>0&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected devices"}),t.jsx("div",{className:"flex flex-col gap-1.5",children:m.map(cs)})]}),e[21]=m,e[22]=o,e[23]=n,e[24]=u):u=e[24];let S;e[25]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(rs,{}),e[25]=S):S=e[25];let h;return e[26]!==N||e[27]!==p||e[28]!==u?(h=t.jsxs("div",{className:"flex flex-col gap-4 border-t pt-5",children:[N,p,u,S]}),e[26]=N,e[27]=p,e[28]=u,e[29]=h):h=e[29],h}function cs(s,e){return t.jsxs("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(as,{name:s.deviceName}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-foreground",children:s.deviceName}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s.ip})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"size-1.5 rounded-full bg-success"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:it(s.lastActivity)})]})]},`${s.ip}-${e}`)}const ds=["auto","path","npm","bundled","custom"],tt={source:"auto"},us=["path","npm","bundled"];function fs(s){return ds.includes(s)}function ms(s){if(!s||typeof s!="object")return;const{source:e,path:n}=s;if(!(!fs(e)||e==="auto"))return e==="custom"?typeof n=="string"&&n.trim()?{source:e,path:n.trim()}:void 0:{source:e}}const Te={auto:"Automatic",path:"Installed on PATH",npm:"Global npm install",bundled:"Bundled with Cogpit",custom:"Custom path"};function St(s,e){return e?`v${e} · ${s}`:s}function hs(s,e){return s===null?"Checking installed binaries…":e?e.version===null?`${e.path} did not report a version — check the path.`:`Now running: ${St(e.path,e.version)}`:"No launchable binary for the saved choice — sessions cannot start."}function xs(s){return s!==null&&s.version!==null}function ps(s){const e=Z.c(92),{kind:n,value:i,onChange:a,disabled:r,reportVersion:l}=s;let f;e[0]!==n?(f=ht(n),e[0]=n,e[1]=f):f=e[1];const{displayName:c}=f,[o,m]=v.useState(null),[b,x]=v.useState(!1),j=`agent-executable-${n}`;let y;e[2]!==n?(y=()=>{let I=!1;return Ie(`/api/agent-executable/${n}`).then(bs).then(te=>{I||m(te)}).catch(js),()=>{I=!0}},e[2]=n,e[3]=y):y=e[3];let C;e[4]!==n||e[5]!==l?(C=[n,l],e[4]=n,e[5]=l,e[6]=C):C=e[6],v.useEffect(y,C);let w,N,p,u,S,h,_,z,T,k,A,D,g;if(e[7]!==r||e[8]!==c||e[9]!==j||e[10]!==a||e[11]!==b||e[12]!==(o==null?void 0:o.active)||e[13]!==(o==null?void 0:o.candidates)||e[14]!==i.path||e[15]!==i.source){const I=new Map((o==null?void 0:o.candidates.map(gs))??[]);u=(o==null?void 0:o.active)??null;let te;e[29]!==r||e[30]!==j||e[31]!==a||e[32]!==i.path||e[33]!==i.source?(te=(L,F,ie,oe)=>{const lt=oe===void 0?!0:oe,K=`${j}-${L}`;return t.jsxs(le,{orientation:"horizontal",children:[t.jsx("input",{type:"radio",id:K,name:j,className:"mt-1 size-4 shrink-0 accent-primary",checked:i.source===L,disabled:r||!lt,onChange:()=>a(L==="custom"?{source:L,path:i.path??""}:{source:L})}),t.jsxs(xt,{children:[t.jsx($e,{htmlFor:K,children:F}),t.jsx(J,{className:"break-all",children:ie})]})]},L)},e[29]=r,e[30]=j,e[31]=a,e[32]=i.path,e[33]=i.source,e[34]=te):te=e[34],S=te;const se=L=>{const F=I.get(L);return S(L,Te[L],F?St(F.path,F.version):"Not found on this machine.",F!==void 0||i.source===L)},ze=u?`${Te[i.source]} · v${u.version??"?"}`:Te[i.source];p=pt,D=b,g=x,h="flex flex-col gap-2";let q;e[35]===Symbol.for("react.memo_cache_sentinel")?(q=t.jsx(ce,{type:"button",variant:"ghost",className:"h-auto w-full justify-between px-0 font-medium hover:bg-transparent"}),e[35]=q):q=e[35];let ne;e[36]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(Jt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[36]=ne):ne=e[36];let X;e[37]!==c?(X=t.jsxs("span",{className:"flex items-center gap-2",children:[ne,c," executable"]}),e[37]=c,e[38]=X):X=e[38];let R;e[39]!==ze?(R=t.jsx("span",{className:"truncate",children:ze}),e[39]=ze,e[40]=R):R=e[40];let B;e[41]!==b?(B=b?t.jsx(wt,{className:"size-4 shrink-0"}):t.jsx(Nt,{className:"size-4 shrink-0"}),e[41]=b,e[42]=B):B=e[42];let U;e[43]!==R||e[44]!==B?(U=t.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs font-normal text-muted-foreground",children:[R,B]}),e[43]=R,e[44]=B,e[45]=U):U=e[45],e[46]!==X||e[47]!==U?(_=t.jsxs(gt,{render:q,children:[X,U]}),e[46]=X,e[47]=U,e[48]=_):_=e[48],N=jt,w=le,e[49]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(J,{children:"Which binary new sessions run. Automatic uses your installed CLI unless it is older than the copy bundled with Cogpit."}),e[49]=A):A=e[49],z="flex flex-col gap-2 pl-1",e[50]!==S?(T=S("auto",Te.auto,"Recommended."),e[50]=S,e[51]=T):T=e[51],k=us.map(se),e[7]=r,e[8]=c,e[9]=j,e[10]=a,e[11]=b,e[12]=o==null?void 0:o.active,e[13]=o==null?void 0:o.candidates,e[14]=i.path,e[15]=i.source,e[16]=w,e[17]=N,e[18]=p,e[19]=u,e[20]=S,e[21]=h,e[22]=_,e[23]=z,e[24]=T,e[25]=k,e[26]=A,e[27]=D,e[28]=g}else w=e[16],N=e[17],p=e[18],u=e[19],S=e[20],h=e[21],_=e[22],z=e[23],T=e[24],k=e[25],A=e[26],D=e[27],g=e[28];const P=`${c} executable path`,H=i.source==="custom"?i.path??"":"",re=r||i.source!=="custom";let Q;e[52]!==a?(Q=I=>a({source:"custom",path:I.target.value}),e[52]=a,e[53]=Q):Q=e[53];let E;e[54]!==P||e[55]!==H||e[56]!==re||e[57]!==Q?(E=t.jsx(nt,{"aria-label":P,value:H,placeholder:"/path/to/binary",disabled:re,onChange:Q,className:"mt-1"}),e[54]=P,e[55]=H,e[56]=re,e[57]=Q,e[58]=E):E=e[58];let V;e[59]!==S||e[60]!==E?(V=S("custom",Te.custom,E),e[59]=S,e[60]=E,e[61]=V):V=e[61];let O;e[62]!==V||e[63]!==z||e[64]!==T||e[65]!==k?(O=t.jsxs("div",{className:z,children:[T,k,V]}),e[62]=V,e[63]=z,e[64]=T,e[65]=k,e[66]=O):O=e[66];let Y;e[67]!==u?(Y=xs(u)?"text-muted-foreground":"text-destructive",e[67]=u,e[68]=Y):Y=e[68];let $;e[69]!==Y?($=Ze("text-xs",Y),e[69]=Y,e[70]=$):$=e[70];let W;e[71]!==u||e[72]!==o?(W=hs(o,u),e[71]=u,e[72]=o,e[73]=W):W=e[73];let M;e[74]!==$||e[75]!==W?(M=t.jsx("p",{className:$,"aria-live":"polite",children:W}),e[74]=$,e[75]=W,e[76]=M):M=e[76];let ee;e[77]!==w||e[78]!==O||e[79]!==M||e[80]!==A?(ee=t.jsxs(w,{children:[A,O,M]}),e[77]=w,e[78]=O,e[79]=M,e[80]=A,e[81]=ee):ee=e[81];let G;e[82]!==N||e[83]!==ee?(G=t.jsx(N,{children:ee}),e[82]=N,e[83]=ee,e[84]=G):G=e[84];let de;return e[85]!==p||e[86]!==h||e[87]!==_||e[88]!==G||e[89]!==D||e[90]!==g?(de=t.jsxs(p,{open:D,onOpenChange:g,className:h,children:[_,G]}),e[85]=p,e[86]=h,e[87]=_,e[88]=G,e[89]=D,e[90]=g,e[91]=de):de=e[91],de}function gs(s){return[s.source,s]}function js(){}function bs(s){return s.ok?s.json():null}function yt(s){return s instanceof Error?s.message:String(s)}async function ot(s){try{const e=await Ie(`/api/agent-accounts/${s}`);return e.status===404?{status:"missing"}:e.ok?await e.json():{status:"error",error:await bt(e,`Request failed (${e.status})`)}}catch(e){return{status:"error",error:yt(e)}}}function vs(s){const[e,n]=v.useState(null),[i,a]=v.useState(null),[r,l]=v.useState(null);v.useEffect(()=>{let c=!1;return ot(s).then(o=>{c||n(o)}),()=>{c=!0}},[s]);const f=v.useCallback(async c=>{a(c),l(null);try{const o=await Ie(`/api/agent-accounts/${s}/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slot:c})});if(!o.ok){l({kind:"failed",error:await bt(o,`Request failed (${o.status})`)});return}l({kind:"switched",result:await o.json()}),n(await ot(s))}catch(o){l({kind:"failed",error:yt(o)})}finally{a(null)}},[s]);return{report:e,switchingSlot:i,outcome:r,switchTo:f}}const ws={token_expired:"Token expired",relogin_required:"Login needed",no_credentials:"No credentials",keychain_unavailable:"Keychain locked",foreign_credential:"Credential mismatch",api_key:"API key",unavailable:"Usage unavailable"};function st(s){return s.alias??s.email}function ct(s){const e=Z.c(18),{label:n,window:i}=s;if(!i)return null;const a=i.pct>=80,r=i.resetsIn?`${n} window resets in ${i.resetsIn}`:void 0;let l;e[0]!==n?(l=t.jsx("span",{className:"w-5",children:n}),e[0]=n,e[1]=l):l=e[1];const f=a?"bg-destructive":"bg-primary";let c;e[2]!==f?(c=Ze("absolute inset-y-0 left-0 rounded-full",f),e[2]=f,e[3]=c):c=e[3];const o=`${i.pct}%`;let m;e[4]!==o?(m={width:o},e[4]=o,e[5]=m):m=e[5];let b;e[6]!==c||e[7]!==m?(b=t.jsx("span",{className:"relative h-1 w-16 overflow-hidden rounded-full bg-muted",children:t.jsx("span",{className:c,style:m})}),e[6]=c,e[7]=m,e[8]=b):b=e[8];let x;e[9]!==i.pct?(x=Math.round(i.pct),e[9]=i.pct,e[10]=x):x=e[10];let j;e[11]!==x?(j=t.jsxs("span",{className:"tabular-nums",children:[x,"%"]}),e[11]=x,e[12]=j):j=e[12];let y;return e[13]!==r||e[14]!==l||e[15]!==b||e[16]!==j?(y=t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",title:r,children:[l,b,j]}),e[13]=r,e[14]=l,e[15]=b,e[16]=j,e[17]=y):y=e[17],y}function dt(s){return/[.!?]$/.test(s)?s:`${s}.`}function Ns(s,e){if(s.kind==="failed")return`Switch failed: ${s.error}`;const{result:n}=s,i=[dt(n.message)];return n.switched&&i.push(n.credentialStore==="keychain"?`Running ${e} sessions pick it up within about 30 seconds; restart one to apply it immediately.`:`New messages in ${e} use it from now on.`),[...i,...n.warnings.map(dt)].join(" ")}function Ss(s){const e=Z.c(41),{kind:n,disabled:i}=s;let a;e[0]!==n?(a=ht(n),e[0]=n,e[1]=a):a=e[1];const{displayName:r}=a,{report:l,switchingSlot:f,outcome:c,switchTo:o}=vs(n),[m,b]=v.useState(!1);if(l===null||l.status==="missing")return null;let x,j;if(e[2]!==l.accounts||e[3]!==l.status){x=l.status==="ok"?l.accounts:[];const g=x.find(ys)??null;j=l.status==="error"?"Unavailable":g?`${st(g)} · ${x.length} account${x.length===1?"":"s"}`:`${x.length} account${x.length===1?"":"s"}`,e[2]=l.accounts,e[3]=l.status,e[4]=x,e[5]=j}else x=e[4],j=e[5];const y=j;let C;e[6]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(ce,{type:"button",variant:"ghost",className:"h-auto w-full justify-between px-0 font-medium hover:bg-transparent"}),e[6]=C):C=e[6];let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(Zt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[7]=w):w=e[7];let N;e[8]!==r?(N=t.jsxs("span",{className:"flex items-center gap-2",children:[w,r," accounts"]}),e[8]=r,e[9]=N):N=e[9];let p;e[10]!==y?(p=t.jsx("span",{className:"truncate",children:y}),e[10]=y,e[11]=p):p=e[11];let u;e[12]!==m?(u=m?t.jsx(wt,{className:"size-4 shrink-0"}):t.jsx(Nt,{className:"size-4 shrink-0"}),e[12]=m,e[13]=u):u=e[13];let S;e[14]!==p||e[15]!==u?(S=t.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs font-normal text-muted-foreground",children:[p,u]}),e[14]=p,e[15]=u,e[16]=S):S=e[16];let h;e[17]!==N||e[18]!==S?(h=t.jsxs(gt,{render:C,children:[N,S]}),e[17]=N,e[18]=S,e[19]=h):h=e[19];const _=l.status==="ok"&&`Logins managed by ${l.tool}${l.version?` ${l.version}`:""}. `;let z;e[20]!==r||e[21]!==_?(z=t.jsxs(J,{children:[_,"Switching changes which login ",r," sessions authenticate with."]}),e[20]=r,e[21]=_,e[22]=z):z=e[22];let T;e[23]!==x||e[24]!==i||e[25]!==l.error||e[26]!==l.status||e[27]!==o||e[28]!==f?(T=l.status==="error"?t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:l.error}):t.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border",children:x.map(g=>{const P=f===g.slot,H=ws[g.usageStatus];return t.jsxs("li",{className:"flex items-center gap-3 px-3 py-2",children:[t.jsx("span",{className:"w-5 shrink-0 text-xs tabular-nums text-muted-foreground",children:g.slot}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[t.jsx("span",{className:"truncate text-sm font-medium",children:st(g)}),g.alias&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:g.email}),g.active&&t.jsx(et,{children:"Active"}),g.disabled&&t.jsx(et,{variant:"outline",children:"Disabled"}),H&&t.jsx(et,{variant:"destructive",children:H})]}),g.organization&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:g.organization}),g.usage&&t.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:[t.jsx(ct,{label:"5h",window:g.usage.fiveHour}),t.jsx(ct,{label:"7d",window:g.usage.sevenDay})]})]}),!i&&!g.active&&t.jsx(ce,{type:"button",size:"sm",variant:"outline",disabled:f!==null,onClick:()=>o(g.slot),"aria-label":`Switch to ${st(g)}`,children:P?t.jsxs(t.Fragment,{children:[t.jsx(at,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Switching…"]}):"Switch"})]},g.slot)})}),e[23]=x,e[24]=i,e[25]=l.error,e[26]=l.status,e[27]=o,e[28]=f,e[29]=T):T=e[29];let k;e[30]!==r||e[31]!==c?(k=c&&t.jsx("p",{className:Ze("text-xs",c.kind==="failed"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",role:c.kind==="failed"?"alert":"status",children:Ns(c,r)}),e[30]=r,e[31]=c,e[32]=k):k=e[32];let A;e[33]!==z||e[34]!==T||e[35]!==k?(A=t.jsx(jt,{children:t.jsxs(le,{children:[z,T,k]})}),e[33]=z,e[34]=T,e[35]=k,e[36]=A):A=e[36];let D;return e[37]!==m||e[38]!==A||e[39]!==h?(D=t.jsxs(pt,{open:m,onOpenChange:b,className:"flex flex-col gap-2",children:[h,A]}),e[37]=m,e[38]=A,e[39]=h,e[40]=D):D=e[40],D}function ys(s){return s.active}const ks=vt().filter(s=>s.cli.bundledBySdk).map(s=>s.kind),Cs=vt().filter(s=>s.capabilities.accountSwitching).map(s=>s.kind);function _s(s,e){return s.source===e.source&&(s.source!=="custom"||s.path===e.path)}function As(s){const e=Z.c(5),{status:n,error:i}=s;if(n==="validating"){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(at,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Checking path..."]}),e[0]=a):a=e[0],a}if(n==="valid"){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-success",children:[t.jsx(ss,{"data-icon":"inline-start",className:"size-3.5"}),"Valid .claude directory found"]}),e[1]=a):a=e[1],a}if(n==="invalid"&&i){let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(ns,{"data-icon":"inline-start",className:"size-3.5"}),e[2]=a):a=e[2];let r;return e[3]!==i?(r=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[a,i]}),e[3]=i,e[4]=r):r=e[4],r}return null}function Fs(s){const e=Z.c(110),{open:n,currentPath:i,onClose:a,onSaved:r}=s,[l,f]=v.useState(i),[c,o]=v.useState(!1),{status:m,error:b,debouncedValidate:x,reset:j,save:y}=$t();let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=zt(),e[0]=C):C=e[0];const w=C;let N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=Tt("configWrite"),e[1]=N):N=e[1];const p=N,[u,S]=v.useState(!1),[h,_]=v.useState(""),[z,T]=v.useState(!1),[k,A]=v.useState(""),[D,g]=v.useState(""),[P,H]=v.useState(""),[re,Q]=v.useState(""),[E,V]=v.useState(!1),[O,Y]=v.useState(!1),[$,W]=v.useState(tt),[M,ee]=v.useState(0),[G,de]=v.useState(tt),[I,te]=v.useState(!1),[se,ze]=v.useState(!1);let q;e[2]===Symbol.for("react.memo_cache_sentinel")?(q=[],e[2]=q):q=e[2];const[ne,X]=v.useState(q);let R,B;e[3]!==i||e[4]!==n||e[5]!==j?(R=()=>{n&&(f(i),j(),Ie("/api/config").then(Is).then(d=>{const ae=(d==null?void 0:d.networkAccess)||!1;S(ae),te(ae),ze(!!(d!=null&&d.networkPassword)),_("");const qe=(d==null?void 0:d.terminalApp)||"";A(qe),g(qe);const Xe=(d==null?void 0:d.editorApp)||"";H(Xe),Q(Xe);const Ke=(d==null?void 0:d.useBuiltInEditor)===!0;V(Ke),Y(Ke);const Je=ms(d==null?void 0:d.agentExecutable)??tt;W(Je),de(Je),ae&&(d!=null&&d.networkPassword)&&!w?Ie("/api/connected-devices").then(Ts).then(Ee=>X((Ee==null?void 0:Ee.devices)||[])).catch(zs):X([])}).catch($s))},B=[n,i,j,w],e[3]=i,e[4]=n,e[5]=j,e[6]=R,e[7]=B):(R=e[6],B=e[7]),v.useEffect(R,B);let U;e[8]!==x?(U=d=>{const ae=d.target.value;f(ae),x(ae)},e[8]=x,e[9]=U):U=e[9];const L=U;let F;e[10]!==$||e[11]!==P||e[12]!==I||e[13]!==u||e[14]!==h||e[15]!==r||e[16]!==l||e[17]!==y||e[18]!==k||e[19]!==E?(F=async()=>{o(!0);const d=await y(l,{networkAccess:w?I:u,networkPassword:!w&&u&&h.length>0?h:void 0,terminalApp:k.trim()||void 0,editorApp:P.trim()||void 0,useBuiltInEditor:E,agentExecutable:$});d.success&&d.claudeDir&&(ee(Es),r(d.claudeDir)),o(!1)},e[10]=$,e[11]=P,e[12]=I,e[13]=u,e[14]=h,e[15]=r,e[16]=l,e[17]=y,e[18]=k,e[19]=E,e[20]=F):F=e[20];const ie=F;let oe;e[21]!==$||e[22]!==P||e[23]!==se||e[24]!==G||e[25]!==re||e[26]!==I||e[27]!==D||e[28]!==O||e[29]!==u||e[30]!==h||e[31]!==m||e[32]!==k||e[33]!==E?(oe=function(){var Ee;if(m==="validating"||m==="invalid")return!1;const ae=m==="valid",qe=!w&&(u!==I||u&&h.length>0),Xe=k!==D,Ke=P!==re||E!==O,Je=!_s($,G);if(!ae&&!qe&&!Xe&&!Ke&&!Je||$.source==="custom"&&!((Ee=$.path)!=null&&Ee.trim()))return!1;if(!w&&u){const kt=h.length>0&&h.length<rt,Ct=!se&&h.length===0;if(kt||Ct)return!1}return!0},e[21]=$,e[22]=P,e[23]=se,e[24]=G,e[25]=re,e[26]=I,e[27]=D,e[28]=O,e[29]=u,e[30]=h,e[31]=m,e[32]=k,e[33]=E,e[34]=oe):oe=e[34];const K=oe();let ue;e[35]!==a?(ue=d=>{d||a()},e[35]=a,e[36]=ue):ue=e[36];let De;e[37]===Symbol.for("react.memo_cache_sentinel")?(De=t.jsxs(It,{children:[t.jsx(Dt,{className:"text-foreground",children:"Configuration"}),t.jsx(Pt,{className:"text-muted-foreground",children:"Manage local paths, preferred apps, and remote access."})]}),e[37]=De):De=e[37];let Pe,Le;e[38]===Symbol.for("react.memo_cache_sentinel")?(Pe=t.jsx($e,{htmlFor:"claude-directory",children:"Claude directory"}),Le=t.jsx(J,{children:"The directory containing your Claude configuration."}),e[38]=Pe,e[39]=Le):(Pe=e[38],Le=e[39]);let Re;e[40]===Symbol.for("react.memo_cache_sentinel")?(Re=t.jsx(mt,{children:t.jsx(Qt,{"data-icon":"inline-start"})}),e[40]=Re):Re=e[40];let fe;e[41]!==K||e[42]!==ie||e[43]!==c?(fe=d=>{d.key==="Enter"&&K&&!c&&ie()},e[41]=K,e[42]=ie,e[43]=c,e[44]=fe):fe=e[44];let me;e[45]!==L||e[46]!==l||e[47]!==fe?(me=t.jsxs(ut,{children:[Re,t.jsx(ft,{id:"claude-directory",value:l,onChange:L,placeholder:"/Users/you/.claude",disabled:!p,onKeyDown:fe})]}),e[45]=L,e[46]=l,e[47]=fe,e[48]=me):me=e[48];let he;e[49]!==b||e[50]!==m?(he=t.jsx("div",{"aria-live":"polite",children:t.jsx(As,{status:m,error:b})}),e[49]=b,e[50]=m,e[51]=he):he=e[51];let xe;e[52]!==me||e[53]!==he?(xe=t.jsxs(le,{children:[Pe,Le,me,he]}),e[52]=me,e[53]=he,e[54]=xe):xe=e[54];let Be,Ue;e[55]===Symbol.for("react.memo_cache_sentinel")?(Be=t.jsxs($e,{htmlFor:"terminal-application",children:[t.jsx(Yt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Terminal application"]}),Ue=t.jsx(J,{children:"Leave blank to use the system default for Ctrl+Cmd+T."}),e[55]=Be,e[56]=Ue):(Be=e[55],Ue=e[56]);let Fe;e[57]===Symbol.for("react.memo_cache_sentinel")?(Fe=d=>A(d.target.value),e[57]=Fe):Fe=e[57];let pe;e[58]!==k?(pe=t.jsxs(le,{children:[Be,Ue,t.jsx(nt,{id:"terminal-application",value:k,onChange:Fe,placeholder:"Ghostty, iTerm, or /path/to/binary",disabled:!p})]}),e[58]=k,e[59]=pe):pe=e[59];let Oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(Oe=d=>V(d===!0),e[60]=Oe):Oe=e[60];let ge;e[61]!==E?(ge=t.jsx(Lt,{id:"use-built-in-editor",checked:E,onCheckedChange:Oe,disabled:!p}),e[61]=E,e[62]=ge):ge=e[62];let Me;e[63]===Symbol.for("react.memo_cache_sentinel")?(Me=t.jsxs(xt,{children:[t.jsxs($e,{htmlFor:"use-built-in-editor",children:[t.jsx(es,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Open files in Cogpit"]}),t.jsx(J,{children:"Files and diffs open in Cogpit’s file workspace instead of launching an external editor."})]}),e[63]=Me):Me=e[63];let je;e[64]!==ge?(je=t.jsxs(le,{orientation:"horizontal",children:[ge,Me]}),e[64]=ge,e[65]=je):je=e[65];let Ge;e[66]===Symbol.for("react.memo_cache_sentinel")?(Ge=t.jsxs($e,{htmlFor:"editor-application",children:[t.jsx(ts,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Editor application"]}),e[66]=Ge):Ge=e[66];const Qe=E?"Not used while files open in Cogpit.":"Leave blank to use $VISUAL or automatic detection.";let be;e[67]!==Qe?(be=t.jsx(J,{children:Qe}),e[67]=Qe,e[68]=be):be=e[68];let He;e[69]===Symbol.for("react.memo_cache_sentinel")?(He=d=>H(d.target.value),e[69]=He):He=e[69];const Ye=!p||E;let ve;e[70]!==P||e[71]!==Ye?(ve=t.jsx(nt,{id:"editor-application",value:P,onChange:He,placeholder:"cursor, code, zed, or /path/to/binary",disabled:Ye}),e[70]=P,e[71]=Ye,e[72]=ve):ve=e[72];let we;e[73]!==be||e[74]!==ve?(we=t.jsxs(le,{children:[Ge,be,ve]}),e[73]=be,e[74]=ve,e[75]=we):we=e[75];let Ne;e[76]!==$||e[77]!==M?(Ne=ks.map(d=>t.jsx(ps,{kind:d,value:$,onChange:W,disabled:!p,reportVersion:M},d)),e[76]=$,e[77]=M,e[78]=Ne):Ne=e[78];let Ve;e[79]===Symbol.for("react.memo_cache_sentinel")?(Ve=Cs.map(d=>t.jsx(Ss,{kind:d,disabled:!p},d)),e[79]=Ve):Ve=e[79];let Se;e[80]!==ne||e[81]!==se||e[82]!==I||e[83]!==u||e[84]!==h||e[85]!==z?(Se=!w&&p&&t.jsx(os,{networkAccess:u,setNetworkAccess:S,networkPassword:h,setNetworkPassword:_,showNetworkPassword:z,setShowNetworkPassword:T,hasExistingPassword:se,initialNetworkAccess:I,connectedDevices:ne,minPasswordLength:rt}),e[80]=ne,e[81]=se,e[82]=I,e[83]=u,e[84]=h,e[85]=z,e[86]=Se):Se=e[86];let ye;e[87]!==xe||e[88]!==pe||e[89]!==je||e[90]!==we||e[91]!==Ne||e[92]!==Se?(ye=t.jsxs(Rt,{children:[xe,pe,je,we,Ne,Ve,Se]}),e[87]=xe,e[88]=pe,e[89]=je,e[90]=we,e[91]=Ne,e[92]=Se,e[93]=ye):ye=e[93];let ke;e[94]!==a?(ke=t.jsx(ce,{variant:"outline",onClick:a,children:"Cancel"}),e[94]=a,e[95]=ke):ke=e[95];let Ce;e[96]!==K||e[97]!==ie||e[98]!==c?(Ce=p&&t.jsx(ce,{disabled:!K||c,onClick:ie,children:c?t.jsxs(t.Fragment,{children:[t.jsx(at,{"data-icon":"inline-start",className:"size-4 animate-spin"}),"Saving..."]}):"Save"}),e[96]=K,e[97]=ie,e[98]=c,e[99]=Ce):Ce=e[99];let _e;e[100]!==ke||e[101]!==Ce?(_e=t.jsxs(Bt,{children:[ke,Ce]}),e[100]=ke,e[101]=Ce,e[102]=_e):_e=e[102];let Ae;e[103]!==ye||e[104]!==_e?(Ae=t.jsxs(Ut,{className:"max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-lg",children:[De,ye,_e]}),e[103]=ye,e[104]=_e,e[105]=Ae):Ae=e[105];let We;return e[106]!==n||e[107]!==Ae||e[108]!==ue?(We=t.jsx(Ft,{open:n,onOpenChange:ue,children:Ae}),e[106]=n,e[107]=Ae,e[108]=ue,e[109]=We):We=e[109],We}function Es(s){return s+1}function $s(){}function zs(){}function Ts(s){return s.json()}function Is(s){return s.json()}export{Fs as ConfigDialog};