cogpit 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +5287 -2601
- package/dist/web/assets/CommandPaletteHost-DfaMCzBW.js +1 -0
- package/dist/web/assets/{ConfigBrowser-BailHbYr.js → ConfigBrowser-CYyPu1XZ.js} +1 -1
- package/dist/web/assets/{HighlightedEditor-Kf1cQYyg.js → HighlightedEditor-D0E4fNIR.js} +1 -1
- package/dist/web/assets/{KeyboardShortcutsDialog-CHb_hQuK.js → KeyboardShortcutsDialog-Cmk72Wcu.js} +1 -1
- package/dist/web/assets/{MobileFileChanges-C9Xk9gfg.js → MobileFileChanges-B5e6WRrN.js} +1 -1
- package/dist/web/assets/{PreviewPanel-Djv1bZZJ.js → PreviewPanel-L5TxNJuc.js} +1 -1
- package/dist/web/assets/{ProjectFilesPanel-DuBqjGFA.js → ProjectFilesPanel-9mVexNJQ.js} +3 -3
- package/dist/web/assets/{ProjectSwitcherModal-CxQ6p2B4.js → ProjectSwitcherModal-D37bS3Y8.js} +1 -1
- package/dist/web/assets/{TerminalOutput-Cm-dLkUR.js → TerminalOutput-qo7CUaKh.js} +1 -1
- package/dist/web/assets/{ThemeSelectorModal-CTuOdp5Q.js → ThemeSelectorModal-DeKpqiLO.js} +1 -1
- package/dist/web/assets/WorkflowsPanel-Dvy1NPzW.js +1 -0
- package/dist/web/assets/{WorktreePanel-DcjYVMuA.js → WorktreePanel-DJdlsguj.js} +1 -1
- package/dist/web/assets/index-BnTYSkBh.css +1 -0
- package/dist/web/assets/{index-CVfvPIib.js → index-C1O8__7w.js} +4 -4
- package/dist/web/assets/{index-DFiPbdIb.js → index-CdXCbj1g.js} +85 -81
- package/dist/web/assets/{index-CEBq1nya.js → index-CyRmDc3P.js} +1 -1
- package/dist/web/assets/{index-D2LNKOXE.js → index-aYw7Kb2u.js} +1 -1
- package/dist/web/assets/index-vzYZixNy.js +1 -0
- package/dist/web/assets/{session-parser.worker-SrNyVFwl.js → session-parser.worker-CnmfpqaO.js} +1 -1
- package/dist/web/assets/{vendor-ui-DUTyrBOX.js → vendor-ui-CevbH8m5.js} +188 -163
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/dist/web/assets/CommandPaletteHost-D43icOGh.js +0 -1
- package/dist/web/assets/WorkflowsPanel-P7HtcaDf.js +0 -1
- package/dist/web/assets/index-CWj7TiFf.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as Y,j as t,r as v}from"./vendor-react-gGw_S5I_.js";import{_ as Ye,V as le,aW as Ee,aX as J,m as dt,n as ut,I as ft,W as Ct,X as _t,aY as At,B as ce,aZ as mt,w as Ie,a_ as ht,a6 as xt,a7 as pt,a8 as gt,a$ as nt,a4 as et,b0 as $t,ap as Et,aq as zt,b1 as jt,i as Tt,j as It,k as Dt,b2 as Pt,U as Lt,aF as Ft,h as Rt,D as Ut}from"./index-DFiPbdIb.js";import{a6 as Bt,a7 as Ot,a8 as Mt,a9 as Vt,e as Ht,T as Gt,M as Wt,aa as Xt,ab as qt,ac as Kt,a0 as bt,C as vt,ad as it,ae as Jt,F as Yt,x as Zt,af as Qt,B as es,ag as ts,ah as ss}from"./vendor-ui-DUTyrBOX.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function ns(s){const e=Y.c(11);let n,a,i;e[0]!==s?({className:n,size:i,...a}=s,e[0]=s,e[1]=n,e[2]=a,e[3]=i):(n=e[1],a=e[2],i=e[3]);const r=i===void 0?"default":i;let l;e[4]!==n?(l=Ye("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 dark:data-unchecked:bg-input/80 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(Ot,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background 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)] dark: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 dark:data-unchecked:bg-foreground"}),e[6]=f):f=e[6];let c;return e[7]!==a||e[8]!==r||e[9]!==l?(c=t.jsx(Bt,{"data-slot":"switch","data-size":r,className:l,...a,children:f}),e[7]=a,e[8]=r,e[9]=l,e[10]=c):c=e[10],c}function as(s){const e=Y.c(3),{name:n}=s,a=n.toLowerCase();if(a.includes("iphone")||a.includes("android")){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Ht,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=r):r=e[0],r}if(a.includes("ipad")||a.includes("tablet")){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Gt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[1]=r):r=e[1],r}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Wt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[2]=i):i=e[2],i}function at(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 a=Math.floor(n/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function is(s){const e=[`Shared ${at(s.createdAt)}`,s.lastAccessAt>0?`opened ${at(s.lastAccessAt)}`:"never opened"];return s.guests>0&&e.push(s.guests===1?"1 guest":`${s.guests} guests`),e.join(" · ")}function ls(){const s=Y.c(12),{shares:e,revoke:n,revokeAll:a}=At();let i;s[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("p",{className:"text-xs text-muted-foreground",children:"Shared sessions"}),s[0]=i):i=s[0];let r;s[1]!==a||s[2]!==e.length?(r=e.length>0&&t.jsx(ce,{variant:"ghost",size:"xs",className:"text-destructive hover:text-destructive",onClick:()=>void a(),children:"Revoke all"}),s[1]=a,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:[i,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:is(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 rs(s){const e=Y.c(30),{networkAccess:n,setNetworkAccess:a,networkPassword:i,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(qt,{"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]!==a?(C=_=>a(_),e[5]=a,e[6]=C):C=e[6];let w;e[7]!==n||e[8]!==C?(w=t.jsx(ns,{"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]!==i||e[17]!==r||e[18]!==f||e[19]!==l?(p=n&&t.jsxs(le,{"data-invalid":i.length>0&&i.length<b,children:[t.jsx(Ee,{htmlFor:"network-password",children:"Password"}),t.jsx(J,{children:c&&i.length===0?"A password is already set. Leave blank to keep it.":`Use at least ${b} characters.`}),t.jsxs(dt,{children:[t.jsx(ut,{id:"network-password",type:l?"text":"password",value:i,onChange:_=>r(_.target.value),placeholder:c?"Enter new password to change":"Set a password for remote access"}),t.jsx(ft,{align:"inline-end",children:t.jsx(Ct,{size:"icon-xs","aria-label":l?"Hide password":"Show password",onClick:()=>f(!l),children:l?t.jsx(Mt,{"data-icon":"inline-start"}):t.jsx(Vt,{"data-icon":"inline-start"})})})]}),i.length>0&&i.length<b&&t.jsxs(_t,{children:["Password must be at least ",b," characters (",i.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]=i,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(os)})]}),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(ls,{}),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 os(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:at(s.lastActivity)})]})]},`${s.ip}-${e}`)}const cs=["auto","path","npm","bundled","custom"],tt={source:"auto"},ds=["path","npm","bundled"];function us(s){return cs.includes(s)}function fs(s){if(!s||typeof s!="object")return;const{source:e,path:n}=s;if(!(!us(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 wt(s,e){return e?`v${e} · ${s}`:s}function ms(s,e){return s===null?"Checking installed binaries…":e?e.version===null?`${e.path} did not report a version — check the path.`:`Now running: ${wt(e.path,e.version)}`:"No launchable binary for the saved choice — sessions cannot start."}function hs(s){return s!==null&&s.version!==null}function xs(s){const e=Y.c(92),{kind:n,value:a,onChange:i,disabled:r,reportVersion:l}=s;let f;e[0]!==n?(f=mt(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(js).then(te=>{I||m(te)}).catch(gs),()=>{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]!==i||e[11]!==b||e[12]!==(o==null?void 0:o.active)||e[13]!==(o==null?void 0:o.candidates)||e[14]!==a.path||e[15]!==a.source){const I=new Map((o==null?void 0:o.candidates.map(ps))??[]);u=(o==null?void 0:o.active)??null;let te;e[29]!==r||e[30]!==j||e[31]!==i||e[32]!==a.path||e[33]!==a.source?(te=(L,B,ae,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:a.source===L,disabled:r||!lt,onChange:()=>i(L==="custom"?{source:L,path:a.path??""}:{source:L})}),t.jsxs(ht,{children:[t.jsx(Ee,{htmlFor:K,children:B}),t.jsx(J,{className:"break-all",children:ae})]})]},L)},e[29]=r,e[30]=j,e[31]=i,e[32]=a.path,e[33]=a.source,e[34]=te):te=e[34],S=te;const se=L=>{const B=I.get(L);return S(L,Te[L],B?wt(B.path,B.version):"Not found on this machine.",B!==void 0||a.source===L)},ze=u?`${Te[a.source]} · v${u.version??"?"}`:Te[a.source];p=xt,D=b,g=x,h="flex flex-col gap-2";let X;e[35]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(ce,{type:"button",variant:"ghost",className:"h-auto w-full justify-between px-0 font-medium hover:bg-transparent"}),e[35]=X):X=e[35];let ne;e[36]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(Kt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[36]=ne):ne=e[36];let q;e[37]!==c?(q=t.jsxs("span",{className:"flex items-center gap-2",children:[ne,c," executable"]}),e[37]=c,e[38]=q):q=e[38];let F;e[39]!==ze?(F=t.jsx("span",{className:"truncate",children:ze}),e[39]=ze,e[40]=F):F=e[40];let R;e[41]!==b?(R=b?t.jsx(bt,{className:"size-4 shrink-0"}):t.jsx(vt,{className:"size-4 shrink-0"}),e[41]=b,e[42]=R):R=e[42];let U;e[43]!==F||e[44]!==R?(U=t.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs font-normal text-muted-foreground",children:[F,R]}),e[43]=F,e[44]=R,e[45]=U):U=e[45],e[46]!==q||e[47]!==U?(_=t.jsxs(pt,{render:X,children:[q,U]}),e[46]=q,e[47]=U,e[48]=_):_=e[48],N=gt,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=ds.map(se),e[7]=r,e[8]=c,e[9]=j,e[10]=i,e[11]=b,e[12]=o==null?void 0:o.active,e[13]=o==null?void 0:o.candidates,e[14]=a.path,e[15]=a.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=a.source==="custom"?a.path??"":"",re=r||a.source!=="custom";let Z;e[52]!==i?(Z=I=>i({source:"custom",path:I.target.value}),e[52]=i,e[53]=Z):Z=e[53];let $;e[54]!==P||e[55]!==H||e[56]!==re||e[57]!==Z?($=t.jsx(nt,{"aria-label":P,value:H,placeholder:"/path/to/binary",disabled:re,onChange:Z,className:"mt-1"}),e[54]=P,e[55]=H,e[56]=re,e[57]=Z,e[58]=$):$=e[58];let G;e[59]!==S||e[60]!==$?(G=S("custom",Te.custom,$),e[59]=S,e[60]=$,e[61]=G):G=e[61];let O;e[62]!==G||e[63]!==z||e[64]!==T||e[65]!==k?(O=t.jsxs("div",{className:z,children:[T,k,G]}),e[62]=G,e[63]=z,e[64]=T,e[65]=k,e[66]=O):O=e[66];let Q;e[67]!==u?(Q=hs(u)?"text-muted-foreground":"text-destructive",e[67]=u,e[68]=Q):Q=e[68];let E;e[69]!==Q?(E=Ye("text-xs",Q),e[69]=Q,e[70]=E):E=e[70];let W;e[71]!==u||e[72]!==o?(W=ms(o,u),e[71]=u,e[72]=o,e[73]=W):W=e[73];let M;e[74]!==E||e[75]!==W?(M=t.jsx("p",{className:E,"aria-live":"polite",children:W}),e[74]=E,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 V;e[82]!==N||e[83]!==ee?(V=t.jsx(N,{children:ee}),e[82]=N,e[83]=ee,e[84]=V):V=e[84];let de;return e[85]!==p||e[86]!==h||e[87]!==_||e[88]!==V||e[89]!==D||e[90]!==g?(de=t.jsxs(p,{open:D,onOpenChange:g,className:h,children:[_,V]}),e[85]=p,e[86]=h,e[87]=_,e[88]=V,e[89]=D,e[90]=g,e[91]=de):de=e[91],de}function ps(s){return[s.source,s]}function gs(){}function js(s){return s.ok?s.json():null}function Nt(s){return s instanceof Error?s.message:String(s)}async function St(s){const e=await s.json().catch(()=>null);return typeof(e==null?void 0:e.error)=="string"?e.error:`Request failed (${s.status})`}async function rt(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 St(e)}}catch(e){return{status:"error",error:Nt(e)}}}function bs(s){const[e,n]=v.useState(null),[a,i]=v.useState(null),[r,l]=v.useState(null);v.useEffect(()=>{let c=!1;return rt(s).then(o=>{c||n(o)}),()=>{c=!0}},[s]);const f=v.useCallback(async c=>{i(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 St(o)});return}l({kind:"switched",result:await o.json()}),n(await rt(s))}catch(o){l({kind:"failed",error:Nt(o)})}finally{i(null)}},[s]);return{report:e,switchingSlot:a,outcome:r,switchTo:f}}const vs={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 ot(s){const e=Y.c(18),{label:n,window:a}=s;if(!a)return null;const i=a.pct>=80,r=a.resetsIn?`${n} window resets in ${a.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=i?"bg-destructive":"bg-primary";let c;e[2]!==f?(c=Ye("absolute inset-y-0 left-0 rounded-full",f),e[2]=f,e[3]=c):c=e[3];const o=`${a.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]!==a.pct?(x=Math.round(a.pct),e[9]=a.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 ct(s){return/[.!?]$/.test(s)?s:`${s}.`}function ws(s,e){if(s.kind==="failed")return`Switch failed: ${s.error}`;const{result:n}=s,a=[ct(n.message)];return n.switched&&a.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.`),[...a,...n.warnings.map(ct)].join(" ")}function Ns(s){const e=Y.c(41),{kind:n,disabled:a}=s;let i;e[0]!==n?(i=mt(n),e[0]=n,e[1]=i):i=e[1];const{displayName:r}=i,{report:l,switchingSlot:f,outcome:c,switchTo:o}=bs(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(Ss)??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(Jt,{"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(bt,{className:"size-4 shrink-0"}):t.jsx(vt,{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(pt,{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]!==a||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=vs[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(ot,{label:"5h",window:g.usage.fiveHour}),t.jsx(ot,{label:"7d",window:g.usage.sevenDay})]})]}),!a&&!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(it,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Switching…"]}):"Switch"})]},g.slot)})}),e[23]=x,e[24]=a,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:Ye("text-xs",c.kind==="failed"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",role:c.kind==="failed"?"alert":"status",children:ws(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(gt,{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(xt,{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 Ss(s){return s.active}const ys=jt().filter(s=>s.cli.bundledBySdk).map(s=>s.kind),ks=jt().filter(s=>s.capabilities.accountSwitching).map(s=>s.kind);function Cs(s,e){return s.source===e.source&&(s.source!=="custom"||s.path===e.path)}function _s(s){const e=Y.c(5),{status:n,error:a}=s;if(n==="validating"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(it,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Checking path..."]}),e[0]=i):i=e[0],i}if(n==="valid"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-success",children:[t.jsx(ts,{"data-icon":"inline-start",className:"size-3.5"}),"Valid .claude directory found"]}),e[1]=i):i=e[1],i}if(n==="invalid"&&a){let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(ss,{"data-icon":"inline-start",className:"size-3.5"}),e[2]=i):i=e[2];let r;return e[3]!==a?(r=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[i,a]}),e[3]=a,e[4]=r):r=e[4],r}return null}function Rs(s){const e=Y.c(110),{open:n,currentPath:a,onClose:i,onSaved:r}=s,[l,f]=v.useState(a),[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=Et(),e[0]=C):C=e[0];const w=C;let N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=zt("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,Z]=v.useState(""),[$,G]=v.useState(!1),[O,Q]=v.useState(!1),[E,W]=v.useState(tt),[M,ee]=v.useState(0),[V,de]=v.useState(tt),[I,te]=v.useState(!1),[se,ze]=v.useState(!1);let X;e[2]===Symbol.for("react.memo_cache_sentinel")?(X=[],e[2]=X):X=e[2];const[ne,q]=v.useState(X);let F,R;e[3]!==a||e[4]!==n||e[5]!==j?(F=()=>{n&&(f(a),j(),Ie("/api/config").then(Ts).then(d=>{const ie=(d==null?void 0:d.networkAccess)||!1;S(ie),te(ie),ze(!!(d!=null&&d.networkPassword)),_("");const Xe=(d==null?void 0:d.terminalApp)||"";A(Xe),g(Xe);const qe=(d==null?void 0:d.editorApp)||"";H(qe),Z(qe);const Ke=(d==null?void 0:d.useBuiltInEditor)===!0;G(Ke),Q(Ke);const Je=fs(d==null?void 0:d.agentExecutable)??tt;W(Je),de(Je),ie&&(d!=null&&d.networkPassword)&&!w?Ie("/api/connected-devices").then(zs).then($e=>q(($e==null?void 0:$e.devices)||[])).catch(Es):q([])}).catch($s))},R=[n,a,j,w],e[3]=a,e[4]=n,e[5]=j,e[6]=F,e[7]=R):(F=e[6],R=e[7]),v.useEffect(F,R);let U;e[8]!==x?(U=d=>{const ie=d.target.value;f(ie),x(ie)},e[8]=x,e[9]=U):U=e[9];const L=U;let B;e[10]!==E||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]!==$?(B=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:$,agentExecutable:E});d.success&&d.claudeDir&&(ee(As),r(d.claudeDir)),o(!1)},e[10]=E,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[20]=B):B=e[20];const ae=B;let oe;e[21]!==E||e[22]!==P||e[23]!==se||e[24]!==V||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]!==$?(oe=function(){var $e;if(m==="validating"||m==="invalid")return!1;const ie=m==="valid",Xe=!w&&(u!==I||u&&h.length>0),qe=k!==D,Ke=P!==re||$!==O,Je=!Cs(E,V);if(!ie&&!Xe&&!qe&&!Ke&&!Je||E.source==="custom"&&!(($e=E.path)!=null&&$e.trim()))return!1;if(!w&&u){const yt=h.length>0&&h.length<16,kt=!se&&h.length===0;if(yt||kt)return!1}return!0},e[21]=E,e[22]=P,e[23]=se,e[24]=V,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[34]=oe):oe=e[34];const K=oe();let ue;e[35]!==i?(ue=d=>{d||i()},e[35]=i,e[36]=ue):ue=e[36];let De;e[37]===Symbol.for("react.memo_cache_sentinel")?(De=t.jsxs(Tt,{children:[t.jsx(It,{className:"text-foreground",children:"Configuration"}),t.jsx(Dt,{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(Ee,{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 Fe;e[40]===Symbol.for("react.memo_cache_sentinel")?(Fe=t.jsx(ft,{children:t.jsx(Yt,{"data-icon":"inline-start"})}),e[40]=Fe):Fe=e[40];let fe;e[41]!==K||e[42]!==ae||e[43]!==c?(fe=d=>{d.key==="Enter"&&K&&!c&&ae()},e[41]=K,e[42]=ae,e[43]=c,e[44]=fe):fe=e[44];let me;e[45]!==L||e[46]!==l||e[47]!==fe?(me=t.jsxs(dt,{children:[Fe,t.jsx(ut,{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(_s,{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 Re,Ue;e[55]===Symbol.for("react.memo_cache_sentinel")?(Re=t.jsxs(Ee,{htmlFor:"terminal-application",children:[t.jsx(Zt,{"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]=Re,e[56]=Ue):(Re=e[55],Ue=e[56]);let Be;e[57]===Symbol.for("react.memo_cache_sentinel")?(Be=d=>A(d.target.value),e[57]=Be):Be=e[57];let pe;e[58]!==k?(pe=t.jsxs(le,{children:[Re,Ue,t.jsx(nt,{id:"terminal-application",value:k,onChange:Be,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=>G(d===!0),e[60]=Oe):Oe=e[60];let ge;e[61]!==$?(ge=t.jsx(Pt,{id:"use-built-in-editor",checked:$,onCheckedChange:Oe,disabled:!p}),e[61]=$,e[62]=ge):ge=e[62];let Me;e[63]===Symbol.for("react.memo_cache_sentinel")?(Me=t.jsxs(ht,{children:[t.jsxs(Ee,{htmlFor:"use-built-in-editor",children:[t.jsx(Qt,{"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 Ve;e[66]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsxs(Ee,{htmlFor:"editor-application",children:[t.jsx(es,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Editor application"]}),e[66]=Ve):Ve=e[66];const Ze=$?"Not used while files open in Cogpit.":"Leave blank to use $VISUAL or automatic detection.";let be;e[67]!==Ze?(be=t.jsx(J,{children:Ze}),e[67]=Ze,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 Qe=!p||$;let ve;e[70]!==P||e[71]!==Qe?(ve=t.jsx(nt,{id:"editor-application",value:P,onChange:He,placeholder:"cursor, code, zed, or /path/to/binary",disabled:Qe}),e[70]=P,e[71]=Qe,e[72]=ve):ve=e[72];let we;e[73]!==be||e[74]!==ve?(we=t.jsxs(le,{children:[Ve,be,ve]}),e[73]=be,e[74]=ve,e[75]=we):we=e[75];let Ne;e[76]!==E||e[77]!==M?(Ne=ys.map(d=>t.jsx(xs,{kind:d,value:E,onChange:W,disabled:!p,reportVersion:M},d)),e[76]=E,e[77]=M,e[78]=Ne):Ne=e[78];let Ge;e[79]===Symbol.for("react.memo_cache_sentinel")?(Ge=ks.map(d=>t.jsx(Ns,{kind:d,disabled:!p},d)),e[79]=Ge):Ge=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(rs,{networkAccess:u,setNetworkAccess:S,networkPassword:h,setNetworkPassword:_,showNetworkPassword:z,setShowNetworkPassword:T,hasExistingPassword:se,initialNetworkAccess:I,connectedDevices:ne,minPasswordLength:16}),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(Lt,{children:[xe,pe,je,we,Ne,Ge,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]!==i?(ke=t.jsx(ce,{variant:"outline",onClick:i,children:"Cancel"}),e[94]=i,e[95]=ke):ke=e[95];let Ce;e[96]!==K||e[97]!==ae||e[98]!==c?(Ce=p&&t.jsx(ce,{disabled:!K||c,onClick:ae,children:c?t.jsxs(t.Fragment,{children:[t.jsx(it,{"data-icon":"inline-start",className:"size-4 animate-spin"}),"Saving..."]}):"Save"}),e[96]=K,e[97]=ae,e[98]=c,e[99]=Ce):Ce=e[99];let _e;e[100]!==ke||e[101]!==Ce?(_e=t.jsxs(Ft,{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(Rt,{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(Ut,{open:n,onOpenChange:ue,children:Ae}),e[106]=n,e[107]=Ae,e[108]=ue,e[109]=We):We=e[109],We}function As(s){return s+1}function $s(){}function Es(){}function zs(s){return s.json()}function Ts(s){return s.json()}export{Rs as ConfigDialog};
|
|
1
|
+
import{c as Y,j as t,r as v}from"./vendor-react-gGw_S5I_.js";import{_ as Ye,V as le,aW as Ee,aX as J,m as dt,n as ut,I as ft,W as Ct,X as _t,aY as At,B as ce,aZ as mt,w as Ie,a_ as ht,a6 as xt,a7 as pt,a8 as gt,a$ as nt,a4 as et,b0 as $t,ap as Et,aq as zt,b1 as jt,i as Tt,j as It,k as Dt,b2 as Pt,U as Lt,aF as Ft,h as Rt,D as Ut}from"./index-CdXCbj1g.js";import{a7 as Bt,a8 as Ot,a9 as Mt,aa as Vt,e as Ht,T as Gt,M as Wt,ab as Xt,ac as qt,ad as Kt,a1 as bt,C as vt,ae as it,af as Jt,F as Yt,y as Zt,ag as Qt,D as es,ah as ts,ai as ss}from"./vendor-ui-CevbH8m5.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function ns(s){const e=Y.c(11);let n,a,i;e[0]!==s?({className:n,size:i,...a}=s,e[0]=s,e[1]=n,e[2]=a,e[3]=i):(n=e[1],a=e[2],i=e[3]);const r=i===void 0?"default":i;let l;e[4]!==n?(l=Ye("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 dark:data-unchecked:bg-input/80 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(Ot,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background 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)] dark: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 dark:data-unchecked:bg-foreground"}),e[6]=f):f=e[6];let c;return e[7]!==a||e[8]!==r||e[9]!==l?(c=t.jsx(Bt,{"data-slot":"switch","data-size":r,className:l,...a,children:f}),e[7]=a,e[8]=r,e[9]=l,e[10]=c):c=e[10],c}function as(s){const e=Y.c(3),{name:n}=s,a=n.toLowerCase();if(a.includes("iphone")||a.includes("android")){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Ht,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=r):r=e[0],r}if(a.includes("ipad")||a.includes("tablet")){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Gt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[1]=r):r=e[1],r}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Wt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[2]=i):i=e[2],i}function at(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 a=Math.floor(n/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function is(s){const e=[`Shared ${at(s.createdAt)}`,s.lastAccessAt>0?`opened ${at(s.lastAccessAt)}`:"never opened"];return s.guests>0&&e.push(s.guests===1?"1 guest":`${s.guests} guests`),e.join(" · ")}function ls(){const s=Y.c(12),{shares:e,revoke:n,revokeAll:a}=At();let i;s[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("p",{className:"text-xs text-muted-foreground",children:"Shared sessions"}),s[0]=i):i=s[0];let r;s[1]!==a||s[2]!==e.length?(r=e.length>0&&t.jsx(ce,{variant:"ghost",size:"xs",className:"text-destructive hover:text-destructive",onClick:()=>void a(),children:"Revoke all"}),s[1]=a,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:[i,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:is(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 rs(s){const e=Y.c(30),{networkAccess:n,setNetworkAccess:a,networkPassword:i,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(qt,{"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]!==a?(C=_=>a(_),e[5]=a,e[6]=C):C=e[6];let w;e[7]!==n||e[8]!==C?(w=t.jsx(ns,{"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]!==i||e[17]!==r||e[18]!==f||e[19]!==l?(p=n&&t.jsxs(le,{"data-invalid":i.length>0&&i.length<b,children:[t.jsx(Ee,{htmlFor:"network-password",children:"Password"}),t.jsx(J,{children:c&&i.length===0?"A password is already set. Leave blank to keep it.":`Use at least ${b} characters.`}),t.jsxs(dt,{children:[t.jsx(ut,{id:"network-password",type:l?"text":"password",value:i,onChange:_=>r(_.target.value),placeholder:c?"Enter new password to change":"Set a password for remote access"}),t.jsx(ft,{align:"inline-end",children:t.jsx(Ct,{size:"icon-xs","aria-label":l?"Hide password":"Show password",onClick:()=>f(!l),children:l?t.jsx(Mt,{"data-icon":"inline-start"}):t.jsx(Vt,{"data-icon":"inline-start"})})})]}),i.length>0&&i.length<b&&t.jsxs(_t,{children:["Password must be at least ",b," characters (",i.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]=i,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(os)})]}),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(ls,{}),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 os(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:at(s.lastActivity)})]})]},`${s.ip}-${e}`)}const cs=["auto","path","npm","bundled","custom"],tt={source:"auto"},ds=["path","npm","bundled"];function us(s){return cs.includes(s)}function fs(s){if(!s||typeof s!="object")return;const{source:e,path:n}=s;if(!(!us(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 wt(s,e){return e?`v${e} · ${s}`:s}function ms(s,e){return s===null?"Checking installed binaries…":e?e.version===null?`${e.path} did not report a version — check the path.`:`Now running: ${wt(e.path,e.version)}`:"No launchable binary for the saved choice — sessions cannot start."}function hs(s){return s!==null&&s.version!==null}function xs(s){const e=Y.c(92),{kind:n,value:a,onChange:i,disabled:r,reportVersion:l}=s;let f;e[0]!==n?(f=mt(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(js).then(te=>{I||m(te)}).catch(gs),()=>{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]!==i||e[11]!==b||e[12]!==(o==null?void 0:o.active)||e[13]!==(o==null?void 0:o.candidates)||e[14]!==a.path||e[15]!==a.source){const I=new Map((o==null?void 0:o.candidates.map(ps))??[]);u=(o==null?void 0:o.active)??null;let te;e[29]!==r||e[30]!==j||e[31]!==i||e[32]!==a.path||e[33]!==a.source?(te=(L,B,ae,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:a.source===L,disabled:r||!lt,onChange:()=>i(L==="custom"?{source:L,path:a.path??""}:{source:L})}),t.jsxs(ht,{children:[t.jsx(Ee,{htmlFor:K,children:B}),t.jsx(J,{className:"break-all",children:ae})]})]},L)},e[29]=r,e[30]=j,e[31]=i,e[32]=a.path,e[33]=a.source,e[34]=te):te=e[34],S=te;const se=L=>{const B=I.get(L);return S(L,Te[L],B?wt(B.path,B.version):"Not found on this machine.",B!==void 0||a.source===L)},ze=u?`${Te[a.source]} · v${u.version??"?"}`:Te[a.source];p=xt,D=b,g=x,h="flex flex-col gap-2";let X;e[35]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(ce,{type:"button",variant:"ghost",className:"h-auto w-full justify-between px-0 font-medium hover:bg-transparent"}),e[35]=X):X=e[35];let ne;e[36]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(Kt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[36]=ne):ne=e[36];let q;e[37]!==c?(q=t.jsxs("span",{className:"flex items-center gap-2",children:[ne,c," executable"]}),e[37]=c,e[38]=q):q=e[38];let F;e[39]!==ze?(F=t.jsx("span",{className:"truncate",children:ze}),e[39]=ze,e[40]=F):F=e[40];let R;e[41]!==b?(R=b?t.jsx(bt,{className:"size-4 shrink-0"}):t.jsx(vt,{className:"size-4 shrink-0"}),e[41]=b,e[42]=R):R=e[42];let U;e[43]!==F||e[44]!==R?(U=t.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs font-normal text-muted-foreground",children:[F,R]}),e[43]=F,e[44]=R,e[45]=U):U=e[45],e[46]!==q||e[47]!==U?(_=t.jsxs(pt,{render:X,children:[q,U]}),e[46]=q,e[47]=U,e[48]=_):_=e[48],N=gt,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=ds.map(se),e[7]=r,e[8]=c,e[9]=j,e[10]=i,e[11]=b,e[12]=o==null?void 0:o.active,e[13]=o==null?void 0:o.candidates,e[14]=a.path,e[15]=a.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=a.source==="custom"?a.path??"":"",re=r||a.source!=="custom";let Z;e[52]!==i?(Z=I=>i({source:"custom",path:I.target.value}),e[52]=i,e[53]=Z):Z=e[53];let $;e[54]!==P||e[55]!==H||e[56]!==re||e[57]!==Z?($=t.jsx(nt,{"aria-label":P,value:H,placeholder:"/path/to/binary",disabled:re,onChange:Z,className:"mt-1"}),e[54]=P,e[55]=H,e[56]=re,e[57]=Z,e[58]=$):$=e[58];let G;e[59]!==S||e[60]!==$?(G=S("custom",Te.custom,$),e[59]=S,e[60]=$,e[61]=G):G=e[61];let O;e[62]!==G||e[63]!==z||e[64]!==T||e[65]!==k?(O=t.jsxs("div",{className:z,children:[T,k,G]}),e[62]=G,e[63]=z,e[64]=T,e[65]=k,e[66]=O):O=e[66];let Q;e[67]!==u?(Q=hs(u)?"text-muted-foreground":"text-destructive",e[67]=u,e[68]=Q):Q=e[68];let E;e[69]!==Q?(E=Ye("text-xs",Q),e[69]=Q,e[70]=E):E=e[70];let W;e[71]!==u||e[72]!==o?(W=ms(o,u),e[71]=u,e[72]=o,e[73]=W):W=e[73];let M;e[74]!==E||e[75]!==W?(M=t.jsx("p",{className:E,"aria-live":"polite",children:W}),e[74]=E,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 V;e[82]!==N||e[83]!==ee?(V=t.jsx(N,{children:ee}),e[82]=N,e[83]=ee,e[84]=V):V=e[84];let de;return e[85]!==p||e[86]!==h||e[87]!==_||e[88]!==V||e[89]!==D||e[90]!==g?(de=t.jsxs(p,{open:D,onOpenChange:g,className:h,children:[_,V]}),e[85]=p,e[86]=h,e[87]=_,e[88]=V,e[89]=D,e[90]=g,e[91]=de):de=e[91],de}function ps(s){return[s.source,s]}function gs(){}function js(s){return s.ok?s.json():null}function Nt(s){return s instanceof Error?s.message:String(s)}async function St(s){const e=await s.json().catch(()=>null);return typeof(e==null?void 0:e.error)=="string"?e.error:`Request failed (${s.status})`}async function rt(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 St(e)}}catch(e){return{status:"error",error:Nt(e)}}}function bs(s){const[e,n]=v.useState(null),[a,i]=v.useState(null),[r,l]=v.useState(null);v.useEffect(()=>{let c=!1;return rt(s).then(o=>{c||n(o)}),()=>{c=!0}},[s]);const f=v.useCallback(async c=>{i(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 St(o)});return}l({kind:"switched",result:await o.json()}),n(await rt(s))}catch(o){l({kind:"failed",error:Nt(o)})}finally{i(null)}},[s]);return{report:e,switchingSlot:a,outcome:r,switchTo:f}}const vs={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 ot(s){const e=Y.c(18),{label:n,window:a}=s;if(!a)return null;const i=a.pct>=80,r=a.resetsIn?`${n} window resets in ${a.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=i?"bg-destructive":"bg-primary";let c;e[2]!==f?(c=Ye("absolute inset-y-0 left-0 rounded-full",f),e[2]=f,e[3]=c):c=e[3];const o=`${a.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]!==a.pct?(x=Math.round(a.pct),e[9]=a.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 ct(s){return/[.!?]$/.test(s)?s:`${s}.`}function ws(s,e){if(s.kind==="failed")return`Switch failed: ${s.error}`;const{result:n}=s,a=[ct(n.message)];return n.switched&&a.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.`),[...a,...n.warnings.map(ct)].join(" ")}function Ns(s){const e=Y.c(41),{kind:n,disabled:a}=s;let i;e[0]!==n?(i=mt(n),e[0]=n,e[1]=i):i=e[1];const{displayName:r}=i,{report:l,switchingSlot:f,outcome:c,switchTo:o}=bs(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(Ss)??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(Jt,{"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(bt,{className:"size-4 shrink-0"}):t.jsx(vt,{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(pt,{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]!==a||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=vs[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(ot,{label:"5h",window:g.usage.fiveHour}),t.jsx(ot,{label:"7d",window:g.usage.sevenDay})]})]}),!a&&!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(it,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Switching…"]}):"Switch"})]},g.slot)})}),e[23]=x,e[24]=a,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:Ye("text-xs",c.kind==="failed"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",role:c.kind==="failed"?"alert":"status",children:ws(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(gt,{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(xt,{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 Ss(s){return s.active}const ys=jt().filter(s=>s.cli.bundledBySdk).map(s=>s.kind),ks=jt().filter(s=>s.capabilities.accountSwitching).map(s=>s.kind);function Cs(s,e){return s.source===e.source&&(s.source!=="custom"||s.path===e.path)}function _s(s){const e=Y.c(5),{status:n,error:a}=s;if(n==="validating"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(it,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Checking path..."]}),e[0]=i):i=e[0],i}if(n==="valid"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-success",children:[t.jsx(ts,{"data-icon":"inline-start",className:"size-3.5"}),"Valid .claude directory found"]}),e[1]=i):i=e[1],i}if(n==="invalid"&&a){let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(ss,{"data-icon":"inline-start",className:"size-3.5"}),e[2]=i):i=e[2];let r;return e[3]!==a?(r=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[i,a]}),e[3]=a,e[4]=r):r=e[4],r}return null}function Rs(s){const e=Y.c(110),{open:n,currentPath:a,onClose:i,onSaved:r}=s,[l,f]=v.useState(a),[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=Et(),e[0]=C):C=e[0];const w=C;let N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=zt("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,Z]=v.useState(""),[$,G]=v.useState(!1),[O,Q]=v.useState(!1),[E,W]=v.useState(tt),[M,ee]=v.useState(0),[V,de]=v.useState(tt),[I,te]=v.useState(!1),[se,ze]=v.useState(!1);let X;e[2]===Symbol.for("react.memo_cache_sentinel")?(X=[],e[2]=X):X=e[2];const[ne,q]=v.useState(X);let F,R;e[3]!==a||e[4]!==n||e[5]!==j?(F=()=>{n&&(f(a),j(),Ie("/api/config").then(Ts).then(d=>{const ie=(d==null?void 0:d.networkAccess)||!1;S(ie),te(ie),ze(!!(d!=null&&d.networkPassword)),_("");const Xe=(d==null?void 0:d.terminalApp)||"";A(Xe),g(Xe);const qe=(d==null?void 0:d.editorApp)||"";H(qe),Z(qe);const Ke=(d==null?void 0:d.useBuiltInEditor)===!0;G(Ke),Q(Ke);const Je=fs(d==null?void 0:d.agentExecutable)??tt;W(Je),de(Je),ie&&(d!=null&&d.networkPassword)&&!w?Ie("/api/connected-devices").then(zs).then($e=>q(($e==null?void 0:$e.devices)||[])).catch(Es):q([])}).catch($s))},R=[n,a,j,w],e[3]=a,e[4]=n,e[5]=j,e[6]=F,e[7]=R):(F=e[6],R=e[7]),v.useEffect(F,R);let U;e[8]!==x?(U=d=>{const ie=d.target.value;f(ie),x(ie)},e[8]=x,e[9]=U):U=e[9];const L=U;let B;e[10]!==E||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]!==$?(B=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:$,agentExecutable:E});d.success&&d.claudeDir&&(ee(As),r(d.claudeDir)),o(!1)},e[10]=E,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[20]=B):B=e[20];const ae=B;let oe;e[21]!==E||e[22]!==P||e[23]!==se||e[24]!==V||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]!==$?(oe=function(){var $e;if(m==="validating"||m==="invalid")return!1;const ie=m==="valid",Xe=!w&&(u!==I||u&&h.length>0),qe=k!==D,Ke=P!==re||$!==O,Je=!Cs(E,V);if(!ie&&!Xe&&!qe&&!Ke&&!Je||E.source==="custom"&&!(($e=E.path)!=null&&$e.trim()))return!1;if(!w&&u){const yt=h.length>0&&h.length<16,kt=!se&&h.length===0;if(yt||kt)return!1}return!0},e[21]=E,e[22]=P,e[23]=se,e[24]=V,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[34]=oe):oe=e[34];const K=oe();let ue;e[35]!==i?(ue=d=>{d||i()},e[35]=i,e[36]=ue):ue=e[36];let De;e[37]===Symbol.for("react.memo_cache_sentinel")?(De=t.jsxs(Tt,{children:[t.jsx(It,{className:"text-foreground",children:"Configuration"}),t.jsx(Dt,{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(Ee,{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 Fe;e[40]===Symbol.for("react.memo_cache_sentinel")?(Fe=t.jsx(ft,{children:t.jsx(Yt,{"data-icon":"inline-start"})}),e[40]=Fe):Fe=e[40];let fe;e[41]!==K||e[42]!==ae||e[43]!==c?(fe=d=>{d.key==="Enter"&&K&&!c&&ae()},e[41]=K,e[42]=ae,e[43]=c,e[44]=fe):fe=e[44];let me;e[45]!==L||e[46]!==l||e[47]!==fe?(me=t.jsxs(dt,{children:[Fe,t.jsx(ut,{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(_s,{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 Re,Ue;e[55]===Symbol.for("react.memo_cache_sentinel")?(Re=t.jsxs(Ee,{htmlFor:"terminal-application",children:[t.jsx(Zt,{"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]=Re,e[56]=Ue):(Re=e[55],Ue=e[56]);let Be;e[57]===Symbol.for("react.memo_cache_sentinel")?(Be=d=>A(d.target.value),e[57]=Be):Be=e[57];let pe;e[58]!==k?(pe=t.jsxs(le,{children:[Re,Ue,t.jsx(nt,{id:"terminal-application",value:k,onChange:Be,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=>G(d===!0),e[60]=Oe):Oe=e[60];let ge;e[61]!==$?(ge=t.jsx(Pt,{id:"use-built-in-editor",checked:$,onCheckedChange:Oe,disabled:!p}),e[61]=$,e[62]=ge):ge=e[62];let Me;e[63]===Symbol.for("react.memo_cache_sentinel")?(Me=t.jsxs(ht,{children:[t.jsxs(Ee,{htmlFor:"use-built-in-editor",children:[t.jsx(Qt,{"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 Ve;e[66]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsxs(Ee,{htmlFor:"editor-application",children:[t.jsx(es,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Editor application"]}),e[66]=Ve):Ve=e[66];const Ze=$?"Not used while files open in Cogpit.":"Leave blank to use $VISUAL or automatic detection.";let be;e[67]!==Ze?(be=t.jsx(J,{children:Ze}),e[67]=Ze,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 Qe=!p||$;let ve;e[70]!==P||e[71]!==Qe?(ve=t.jsx(nt,{id:"editor-application",value:P,onChange:He,placeholder:"cursor, code, zed, or /path/to/binary",disabled:Qe}),e[70]=P,e[71]=Qe,e[72]=ve):ve=e[72];let we;e[73]!==be||e[74]!==ve?(we=t.jsxs(le,{children:[Ve,be,ve]}),e[73]=be,e[74]=ve,e[75]=we):we=e[75];let Ne;e[76]!==E||e[77]!==M?(Ne=ys.map(d=>t.jsx(xs,{kind:d,value:E,onChange:W,disabled:!p,reportVersion:M},d)),e[76]=E,e[77]=M,e[78]=Ne):Ne=e[78];let Ge;e[79]===Symbol.for("react.memo_cache_sentinel")?(Ge=ks.map(d=>t.jsx(Ns,{kind:d,disabled:!p},d)),e[79]=Ge):Ge=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(rs,{networkAccess:u,setNetworkAccess:S,networkPassword:h,setNetworkPassword:_,showNetworkPassword:z,setShowNetworkPassword:T,hasExistingPassword:se,initialNetworkAccess:I,connectedDevices:ne,minPasswordLength:16}),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(Lt,{children:[xe,pe,je,we,Ne,Ge,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]!==i?(ke=t.jsx(ce,{variant:"outline",onClick:i,children:"Cancel"}),e[94]=i,e[95]=ke):ke=e[95];let Ce;e[96]!==K||e[97]!==ae||e[98]!==c?(Ce=p&&t.jsx(ce,{disabled:!K||c,onClick:ae,children:c?t.jsxs(t.Fragment,{children:[t.jsx(it,{"data-icon":"inline-start",className:"size-4 animate-spin"}),"Saving..."]}):"Save"}),e[96]=K,e[97]=ae,e[98]=c,e[99]=Ce):Ce=e[99];let _e;e[100]!==ke||e[101]!==Ce?(_e=t.jsxs(Ft,{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(Rt,{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(Ut,{open:n,onOpenChange:ue,children:Ae}),e[106]=n,e[107]=Ae,e[108]=ue,e[109]=We):We=e[109],We}function As(s){return s+1}function $s(){}function Es(){}function zs(s){return s.json()}function Ts(s){return s.json()}export{Rs as ConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as V,a as Ge,c as B,j as s}from"./vendor-react-gGw_S5I_.js";import{w as He,B as U,a$ as Ke,aQ as _e,A as qe,b2 as We,bg as Le,Z as ke,Y as ze,a4 as Te,bh as Xe,b6 as Je,b5 as Ze,b4 as et,bi as tt,bj as st,bk as nt,bl as it,_ as ue,bm as lt,a5 as ot,aB as at,bn as rt,bo as ct,bp as dt,v as ut,$ as ft,bq as mt,E as xt,y as ht,z as gt,G as pt,H as bt,al as jt,p as wt,br as vt,bs as Nt,q as yt}from"./index-DFiPbdIb.js";import{c as St,ak as It,ar as Be,C as De,as as Se,ah as _t,at as qt,L as Ct,au as Tt,av as kt,b as At,J as Et}from"./vendor-ui-DUTyrBOX.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const Rt=4e3;function Mt(){const[l,e]=V.useState([]),[t,n]=V.useState(!1),[i,r]=V.useState(null),o=V.useRef(!1);V.useEffect(()=>(o.current=!1,()=>{o.current=!0}),[]);const c=V.useCallback(async()=>{try{const m=await He("/api/mission-control");if(o.current)return;if(!m.ok)throw new Error(`Mission Control request failed (${m.status})`);const x=await m.json();if(o.current)return;e(Array.isArray(x.summaries)?x.summaries:[]),r(null)}catch(m){if(o.current)return;r(m instanceof Error?m.message:"Failed to load Mission Control")}finally{o.current||n(!1)}},[]);V.useEffect(()=>{n(!0);const m=()=>{(typeof document>"u"||document.visibilityState==="visible")&&c()},x=()=>{document.visibilityState==="visible"&&c()};m();const j=setInterval(m,Rt);return document.addEventListener("visibilitychange",x),()=>{clearInterval(j),document.removeEventListener("visibilitychange",x)}},[c]);const d=V.useMemo(()=>{const m=new Map;for(const x of l)m.set(x.sessionId,x);return m},[l]),g=V.useCallback(()=>{c()},[c]);return{summaries:d,loading:t,error:i,refresh:g}}const Ae="data-view-transition-kind",Lt="(prefers-reduced-motion: reduce)";let de=null,Fe=null;function $t(l,e,t){t===null?l.removeAttribute(e):l.setAttribute(e,t)}function Dt(l,e){const t={root:l,kind:e,previousKind:l.getAttribute(Ae)};return l.setAttribute(Ae,e),Fe=t,t}function Ie(l){Fe===l&&(l.root.getAttribute(Ae)===l.kind&&$t(l.root,Ae,l.previousKind),Fe=null)}function Ft(){const l=de;if(l){de=null;try{l.transition.skipTransition()}catch{Ie(l.tag);return}Ie(l.tag)}}function zt(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia(Lt).matches}catch{return!1}}function Ot(l,{kind:e}){Ft();const t=typeof document>"u"?null:document,n=t==null?void 0:t.startViewTransition;if(!t||!(typeof n=="function")||zt())return l(),null;const r=Dt(t.documentElement,e);let o=!1,c=!1,d;const g=m=>{if(!o){o=!0;try{m?Ge.flushSync(l):l()}catch(x){throw c=!0,d=x,x}}};try{const m=n.call(t,()=>g(!0)),x={transition:m,tag:r};return de=x,m.ready.catch(()=>{}),m.updateCallbackDone.catch(()=>{}),m.finished.then(()=>{de===x&&(de=null),Ie(r)},()=>{de===x&&(de=null),Ie(r)}),m}catch{if(Ie(r),c)throw d;return g(!1),null}}function Vt(l){const e={};for(const t of l)t.type==="boolean"?e[t.name]=t.defaultValue===!0:t.defaultValue!==void 0?e[t.name]=String(t.defaultValue):e[t.name]="";return e}function Ut(l,e){const t={};for(const n of l){const i=e[n.name];if(typeof i=="boolean"){t[n.name]=i;continue}i!==""&&(t[n.name]=n.type==="number"||n.type==="integer"?Number(i):i)}return t}function Yt(l,e){return l.every(t=>{if(!t.required)return!0;const n=e[t.name];return typeof n=="boolean"?!0:n===""?!1:t.type==="number"||t.type==="integer"?Number.isFinite(Number(n)):!0})}function Bt(l){const e=B.c(64),{request:t,responding:n,onAnswer:i}=l;let r;e[0]!==t.fields?(r=()=>Vt(t.fields),e[0]=t.fields,e[1]=r):r=e[1];const[o,c]=V.useState(r);let d;e[2]!==t.fields||e[3]!==o?(d=Yt(t.fields,o),e[2]=t.fields,e[3]=o,e[4]=d):d=e[4];const g=d,m=t.displayName||t.title||t.serverName;let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=(q,S)=>{c(w=>({...w,[q]:S}))},e[5]=x):x=e[5];const j=x;let p;e[6]!==i||e[7]!==t.requestId?(p=()=>i(t.requestId,{action:"decline"}),e[6]=i,e[7]=t.requestId,e[8]=p):p=e[8];const u=p;if(t.mode==="url"&&t.url){const q=t.url;let S;e[9]!==t.message?(S=s.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:t.message}),e[9]=t.message,e[10]=S):S=e[10];let w;e[11]!==q?(w=s.jsx("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:q,children:q}),e[11]=q,e[12]=w):w=e[12];let I;e[13]!==i||e[14]!==t.requestId||e[15]!==q?(I=()=>{window.open(q,"_blank","noopener,noreferrer"),i(t.requestId,{action:"accept"})},e[13]=i,e[14]=t.requestId,e[15]=q,e[16]=I):I=e[16];let z;e[17]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(St,{"data-icon":"inline-end"}),e[17]=z):z=e[17];let L;e[18]!==n||e[19]!==I?(L=s.jsxs(U,{size:"sm",disabled:n,onClick:I,children:["Open link",z]}),e[18]=n,e[19]=I,e[20]=L):L=e[20];let k;e[21]!==u||e[22]!==n?(k=s.jsx(U,{variant:"ghost",size:"sm",disabled:n,onClick:u,children:"Decline"}),e[21]=u,e[22]=n,e[23]=k):k=e[23];let R;e[24]!==k||e[25]!==L?(R=s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[L,k]}),e[24]=k,e[25]=L,e[26]=R):R=e[26];let D;return e[27]!==m||e[28]!==R||e[29]!==S||e[30]!==w?(D=s.jsxs(Ve,{server:m,children:[S,w,R]}),e[27]=m,e[28]=R,e[29]=S,e[30]=w,e[31]=D):D=e[31],D}let a;e[32]!==t.message?(a=s.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:t.message}),e[32]=t.message,e[33]=a):a=e[33];let h;if(e[34]!==t.fields||e[35]!==t.requestId||e[36]!==n||e[37]!==o){let q;e[39]!==t.requestId||e[40]!==n||e[41]!==o?(q=S=>s.jsx(Pt,{id:`elicit-${t.requestId}-${S.name}`,field:S,value:o[S.name],disabled:n,onChange:w=>j(S.name,w)},S.name),e[39]=t.requestId,e[40]=n,e[41]=o,e[42]=q):q=e[42],h=t.fields.map(q),e[34]=t.fields,e[35]=t.requestId,e[36]=n,e[37]=o,e[38]=h}else h=e[38];let f;e[43]!==h?(f=s.jsx("div",{className:"mt-3 flex flex-col gap-3",children:h}),e[43]=h,e[44]=f):f=e[44];const y=n||!g;let v;e[45]!==i||e[46]!==t.fields||e[47]!==t.requestId||e[48]!==o?(v=()=>i(t.requestId,{action:"accept",content:Ut(t.fields,o)}),e[45]=i,e[46]=t.fields,e[47]=t.requestId,e[48]=o,e[49]=v):v=e[49];let _;e[50]!==y||e[51]!==v?(_=s.jsx(U,{size:"sm",disabled:y,onClick:v,children:"Send"}),e[50]=y,e[51]=v,e[52]=_):_=e[52];let T;e[53]!==u||e[54]!==n?(T=s.jsx(U,{variant:"ghost",size:"sm",disabled:n,onClick:u,children:"Decline"}),e[53]=u,e[54]=n,e[55]=T):T=e[55];let N;e[56]!==_||e[57]!==T?(N=s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[_,T]}),e[56]=_,e[57]=T,e[58]=N):N=e[58];let b;return e[59]!==m||e[60]!==N||e[61]!==a||e[62]!==f?(b=s.jsxs(Ve,{server:m,children:[a,f,N]}),e[59]=m,e[60]=N,e[61]=a,e[62]=f,e[63]=b):b=e[63],b}function Pt(l){const e=B.c(55),{id:t,field:n,value:i,disabled:r,onChange:o}=l;if(n.type==="boolean"){const u=i===!0;let a;e[0]!==o?(a=v=>o(v===!0),e[0]=o,e[1]=a):a=e[1];let h;e[2]!==r||e[3]!==t||e[4]!==u||e[5]!==a?(h=s.jsx(We,{id:t,checked:u,disabled:r,onCheckedChange:a}),e[2]=r,e[3]=t,e[4]=u,e[5]=a,e[6]=h):h=e[6];let f;e[7]!==n?(f=s.jsx($e,{field:n}),e[7]=n,e[8]=f):f=e[8];let y;return e[9]!==t||e[10]!==h||e[11]!==f?(y=s.jsxs(Le,{htmlFor:t,className:"items-start gap-2 font-normal",children:[h,f]}),e[9]=t,e[10]=h,e[11]=f,e[12]=y):y=e[12],y}if(n.type==="enum"){let u;e[13]!==n?(u=s.jsx($e,{field:n}),e[13]=n,e[14]=u):u=e[14];let a;e[15]!==t||e[16]!==u?(a=s.jsx(Le,{htmlFor:t,children:u}),e[15]=t,e[16]=u,e[17]=a):a=e[17];let h;e[18]!==i?(h=typeof i=="string"&&i?[i]:[],e[18]=i,e[19]=h):h=e[19];let f;e[20]!==o?(f=b=>{b[0]&&o(b[0])},e[20]=o,e[21]=f):f=e[21];const y=n.label;let v;e[22]!==n.options?(v=n.options??[],e[22]=n.options,e[23]=v):v=e[23];let _;if(e[24]!==r||e[25]!==v){let b;e[27]!==r?(b=q=>s.jsx(ke,{value:q.value,disabled:r,className:"w-full justify-start px-3",children:q.label},q.value),e[27]=r,e[28]=b):b=e[28],_=v.map(b),e[24]=r,e[25]=v,e[26]=_}else _=e[26];let T;e[29]!==n.label||e[30]!==t||e[31]!==h||e[32]!==f||e[33]!==_?(T=s.jsx(ze,{id:t,value:h,onValueChange:f,orientation:"vertical",variant:"outline",size:"sm",className:"w-full items-stretch","aria-label":y,children:_}),e[29]=n.label,e[30]=t,e[31]=h,e[32]=f,e[33]=_,e[34]=T):T=e[34];let N;return e[35]!==a||e[36]!==T?(N=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,T]}),e[35]=a,e[36]=T,e[37]=N):N=e[37],N}let c;e[38]!==n?(c=s.jsx($e,{field:n}),e[38]=n,e[39]=c):c=e[39];let d;e[40]!==t||e[41]!==c?(d=s.jsx(Le,{htmlFor:t,children:c}),e[40]=t,e[41]=c,e[42]=d):d=e[42];const g=n.type==="string"?"text":"number",m=typeof i=="string"?i:"";let x;e[43]!==o?(x=u=>o(u.target.value),e[43]=o,e[44]=x):x=e[44];let j;e[45]!==r||e[46]!==n.label||e[47]!==t||e[48]!==g||e[49]!==m||e[50]!==x?(j=s.jsx(Ke,{id:t,"aria-label":n.label,type:g,value:m,disabled:r,onChange:x}),e[45]=r,e[46]=n.label,e[47]=t,e[48]=g,e[49]=m,e[50]=x,e[51]=j):j=e[51];let p;return e[52]!==d||e[53]!==j?(p=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,j]}),e[52]=d,e[53]=j,e[54]=p):p=e[54],p}function $e(l){const e=B.c(8),{field:t}=l;let n;e[0]!==t.required?(n=t.required&&s.jsx("span",{className:"ml-0.5 text-warning",children:"*"}),e[0]=t.required,e[1]=n):n=e[1];let i;e[2]!==t.description?(i=t.description&&s.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:t.description}),e[2]=t.description,e[3]=i):i=e[3];let r;return e[4]!==t.label||e[5]!==n||e[6]!==i?(r=s.jsxs("span",{className:"min-w-0",children:[t.label,n,i]}),e[4]=t.label,e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function Ve(l){const e=B.c(8),{server:t,children:n}=l;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(It,{className:"text-info"}),e[0]=i):i=e[0];let r;e[1]!==t?(r=s.jsxs(_e,{children:[t," needs input"]}),e[1]=t,e[2]=r):r=e[2];let o;e[3]!==n?(o=s.jsx("div",{className:"col-start-2 mt-1 min-w-0",children:n}),e[3]=n,e[4]=o):o=e[4];let c;return e[5]!==r||e[6]!==o?(c=s.jsxs(qe,{className:"border-info/40 bg-info/5",children:[i,r,o]}),e[5]=r,e[6]=o,e[7]=c):c=e[7],c}const Qt=["allow","allow_always","deny"],Gt=[{decision:"allow",label:"Allow",variant:"default"},{decision:"deny",label:"Deny",variant:"destructive"},{decision:"allow_always",label:"Always",variant:"outline"}];function Ht(l,e){return(l.availableDecisions??Qt).includes(e)}function Kt(l){const e=B.c(22),{request:t,queued:n,responding:i,onRespond:r}=l;let o;if(e[0]!==r||e[1]!==n||e[2]!==t||e[3]!==i){let c;e[5]!==t?(c=y=>Ht(t,y.decision),e[5]=t,e[6]=c):c=e[6];const d=Gt.filter(c),g=d.some(Wt);let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Be,{className:"text-warning"}),e[7]=m):m=e[7];const x=t.title||`Allow ${t.toolName}?`;let j;e[8]!==x?(j=s.jsx("span",{className:"min-w-0 flex-1 truncate",children:x}),e[8]=x,e[9]=j):j=e[9];let p;e[10]!==n?(p=n>0&&s.jsxs("span",{className:"shrink-0 font-mono text-xs text-warning",children:["+",n]}),e[10]=n,e[11]=p):p=e[11];let u;e[12]!==j||e[13]!==p?(u=s.jsxs(_e,{className:"flex min-w-0 items-center gap-2",children:[j,p]}),e[12]=j,e[13]=p,e[14]=u):u=e[14];let a;e[15]!==t.toolName?(a=s.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:t.toolName}),e[15]=t.toolName,e[16]=a):a=e[16];let h;e[17]!==t.summary?(h=t.summary&&s.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:t.summary}),e[17]=t.summary,e[18]=h):h=e[18];let f;e[19]!==a||e[20]!==h?(f=s.jsxs("div",{className:"col-start-2 mt-2 flex min-w-0 items-center gap-2",children:[a,h]}),e[19]=a,e[20]=h,e[21]=f):f=e[21],o=s.jsxs(qe,{className:"border-warning/40 bg-warning/5",children:[m,u,f,g?s.jsx("div",{className:"col-start-2 mt-3 flex items-center gap-2",children:d.map(y=>{const{decision:v,label:_,variant:T}=y;return s.jsx(U,{size:"xs",variant:T,disabled:i,onClick:()=>r(t.requestId,v),children:_},v)})}):s.jsx("p",{className:"col-start-2 mt-2 text-xs text-warning",children:"Resolve this approval in its own provider"})]}),e[0]=r,e[1]=n,e[2]=t,e[3]=i,e[4]=o}else o=e[4];return o}function Wt(l){return l.decision!=="allow_always"}function Xt(l){return l.some(e=>e.options.length===0||e.options.some(t=>t.hasPreview))}function Jt(l){const e=B.c(63),{request:t,responding:n,gone:i,onAnswer:r,onOpenSession:o}=l,c=t.questions,[d,g]=V.useState(0);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={},e[0]=m):m=e[0];const x=V.useRef(m);let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j=new Set,e[1]=j):j=e[1];const[p,u]=V.useState(j);if(c.length===0)return null;if(Xt(c)){let E;e[2]!==c[0].question?(E=s.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:c[0].question}),e[2]=c[0].question,e[3]=E):E=e[3];let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(De,{"data-icon":"inline-end"}),e[4]=C):C=e[4];let $;e[5]!==o?($=s.jsxs(U,{variant:"outline",size:"sm",onClick:o,className:"mt-3",children:["Open full question",C]}),e[5]=o,e[6]=$):$=e[6];let O;return e[7]!==E||e[8]!==$?(O=s.jsxs(Ue,{children:[E,$]}),e[7]=E,e[8]=$,e[9]=O):O=e[9],O}const a=c[d];let h;e[10]!==a.question||e[11]!==d||e[12]!==r||e[13]!==c.length||e[14]!==t.toolUseId?(h=function(C){const $={...x.current,[a.question]:C};if(d+1<c.length){x.current=$,u(new Set),g(d+1);return}r(t.toolUseId,$)},e[10]=a.question,e[11]=d,e[12]=r,e[13]=c.length,e[14]=t.toolUseId,e[15]=h):h=e[15];const f=h;let y;e[16]!==a.header?(y=a.header&&s.jsx(Te,{variant:"outline",className:"border-info/40 text-info",children:a.header}),e[16]=a.header,e[17]=y):y=e[17];let v;e[18]!==d||e[19]!==c.length?(v=c.length>1&&s.jsxs("span",{className:"ml-auto shrink-0 font-mono text-xs text-muted-foreground",children:[d+1," of ",c.length]}),e[18]=d,e[19]=c.length,e[20]=v):v=e[20];let _;e[21]!==y||e[22]!==v?(_=s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[y,v]}),e[21]=y,e[22]=v,e[23]=_):_=e[23];let T;e[24]!==a.question?(T=s.jsx("p",{className:"mt-2 line-clamp-3 text-sm leading-relaxed text-foreground",title:a.question,children:a.question}),e[24]=a.question,e[25]=T):T=e[25];let N;e[26]!==p?(N=[...p],e[26]=p,e[27]=N):N=e[27];let b;e[28]!==f||e[29]!==a.multiSelect?(b=E=>{a.multiSelect?u(new Set(E)):E[0]&&f(E[0])},e[28]=f,e[29]=a.multiSelect,e[30]=b):b=e[30];const q=a.multiSelect,S=a.question;let w;if(e[31]!==a.options||e[32]!==n){let E;e[34]!==n?(E=C=>s.jsx(Zt,{option:C,disabled:n},C.label),e[34]=n,e[35]=E):E=e[35],w=a.options.map(E),e[31]=a.options,e[32]=n,e[33]=w}else w=e[33];let I;e[36]!==a.multiSelect||e[37]!==a.question||e[38]!==w||e[39]!==N||e[40]!==b?(I=s.jsx(ze,{value:N,onValueChange:b,multiple:q,orientation:"vertical",variant:"outline",size:"sm",className:"mt-3 w-full items-stretch","aria-label":S,children:w}),e[36]=a.multiSelect,e[37]=a.question,e[38]=w,e[39]=N,e[40]=b,e[41]=I):I=e[41];let z;e[42]!==f||e[43]!==a.multiSelect||e[44]!==d||e[45]!==c.length||e[46]!==n||e[47]!==p?(z=a.multiSelect&&s.jsx(U,{size:"sm",disabled:n||p.size===0,onClick:()=>f(Xe(p)),children:d+1<c.length?"Next":"Send"}),e[42]=f,e[43]=a.multiSelect,e[44]=d,e[45]=c.length,e[46]=n,e[47]=p,e[48]=z):z=e[48];let L;e[49]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(De,{"data-icon":"inline-end"}),e[49]=L):L=e[49];let k;e[50]!==o?(k=s.jsxs(U,{variant:"ghost",size:"sm",onClick:o,className:"ml-auto text-muted-foreground",children:["Open session",L]}),e[50]=o,e[51]=k):k=e[51];let R;e[52]!==z||e[53]!==k?(R=s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[z,k]}),e[52]=z,e[53]=k,e[54]=R):R=e[54];let D;e[55]!==i?(D=i&&s.jsx("p",{className:"mt-2 text-xs text-warning",children:"This question may already be answered. Open the session to check."}),e[55]=i,e[56]=D):D=e[56];let A;return e[57]!==I||e[58]!==R||e[59]!==D||e[60]!==_||e[61]!==T?(A=s.jsxs(Ue,{children:[_,T,I,R,D]}),e[57]=I,e[58]=R,e[59]=D,e[60]=_,e[61]=T,e[62]=A):A=e[62],A}function Zt(l){const e=B.c(17),{option:t,disabled:n}=l;let i;e[0]!==t.label?(i=s.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:t.label}),e[0]=t.label,e[1]=i):i=e[1];const r=i;if(!t.description){let m;return e[2]!==n||e[3]!==r||e[4]!==t.label?(m=s.jsx(ke,{value:t.label,disabled:n,className:"w-full justify-start px-3",children:r}),e[2]=n,e[3]=r,e[4]=t.label,e[5]=m):m=e[5],m}let o;e[6]!==n||e[7]!==t.label?(o=s.jsx(ke,{value:t.label,disabled:n,className:"w-full justify-start px-3"}),e[6]=n,e[7]=t.label,e[8]=o):o=e[8];let c;e[9]!==r||e[10]!==o?(c=s.jsx(Ze,{render:o,children:r}),e[9]=r,e[10]=o,e[11]=c):c=e[11];let d;e[12]!==t.description?(d=s.jsx(Je,{side:"right",className:"max-w-72 text-left",children:t.description}),e[12]=t.description,e[13]=d):d=e[13];let g;return e[14]!==c||e[15]!==d?(g=s.jsxs(et,{children:[c,d]}),e[14]=c,e[15]=d,e[16]=g):g=e[16],g}function Ue(l){const e=B.c(4),{children:t}=l;let n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Se,{className:"text-info"}),i=s.jsx(_e,{children:"Answer to continue"}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let r;return e[2]!==t?(r=s.jsxs(qe,{className:"border-info/40 bg-info/5",children:[n,i,s.jsx("div",{className:"col-start-2 mt-1 min-w-0",children:t})]}),e[2]=t,e[3]=r):r=e[3],r}function es(l){const e=B.c(33),{request:t,responding:n,onChoose:i}=l;let r,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Be,{className:"text-warning"}),o=s.jsx(_e,{children:"Claude declined this request"}),e[0]=r,e[1]=o):(r=e[0],o=e[1]);let c;e[2]!==t.originalModel?(c=s.jsxs("p",{className:"text-sm leading-relaxed text-foreground",children:[t.originalModel," would not answer. Retrying on a fallback model may work."]}),e[2]=t.originalModel,e[3]=c):c=e[3];let d;e[4]!==t.guidanceText?(d=t.guidanceText&&s.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:t.guidanceText}),e[4]=t.guidanceText,e[5]=d):d=e[5];let g;e[6]!==i||e[7]!==t.requestId?(g=()=>i(t.requestId,"retry_fallback"),e[6]=i,e[7]=t.requestId,e[8]=g):g=e[8];let m;e[9]!==t.fallbackModel||e[10]!==n||e[11]!==g?(m=s.jsxs(U,{size:"sm",disabled:n,onClick:g,children:["Retry on ",t.fallbackModel]}),e[9]=t.fallbackModel,e[10]=n,e[11]=g,e[12]=m):m=e[12];let x;e[13]!==i||e[14]!==t.requestId?(x=()=>i(t.requestId,"edit_prompt"),e[13]=i,e[14]=t.requestId,e[15]=x):x=e[15];let j;e[16]!==n||e[17]!==x?(j=s.jsx(U,{variant:"outline",size:"sm",disabled:n,onClick:x,children:"Edit prompt"}),e[16]=n,e[17]=x,e[18]=j):j=e[18];let p;e[19]!==i||e[20]!==t.requestId?(p=()=>i(t.requestId,"cancelled"),e[19]=i,e[20]=t.requestId,e[21]=p):p=e[21];let u;e[22]!==n||e[23]!==p?(u=s.jsx(U,{variant:"ghost",size:"sm",disabled:n,className:"ml-auto text-muted-foreground",onClick:p,children:"Dismiss"}),e[22]=n,e[23]=p,e[24]=u):u=e[24];let a;e[25]!==u||e[26]!==m||e[27]!==j?(a=s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[m,j,u]}),e[25]=u,e[26]=m,e[27]=j,e[28]=a):a=e[28];let h;return e[29]!==a||e[30]!==c||e[31]!==d?(h=s.jsxs(qe,{className:"border-warning/40 bg-warning/5",children:[r,o,s.jsxs("div",{className:"col-start-2 mt-1 min-w-0",children:[c,d,a]})]}),e[29]=a,e[30]=c,e[31]=d,e[32]=h):h=e[32],h}function Pe(l){return l==="awaiting_approval"||l==="awaiting_prompt"||l==="awaiting_question"||l==="awaiting_answer"}function Ee(l){return l==="done"||l==="failed"}const Ye={awaiting_approval:0,awaiting_prompt:1,awaiting_question:2,awaiting_answer:3,running:4,failed:5,done:6};function ts(l,e,t,n,i,r){return t?"awaiting_approval":n?"awaiting_prompt":i?"awaiting_question":r||l.agentStatus==="deferred"||l.agentStatus==="idle"&&e?"awaiting_answer":l.agentTerminalReason?"failed":e&&l.agentStatus&&nt.has(l.agentStatus)?"running":"done"}const ss=6;function ns({sessions:l,procBySession:e,summaries:t,permissionsBySession:n,questionsBySession:i,elicitationsBySession:r,dialogsBySession:o,awaitingPlan:c,newlyCompleted:d,finishedLimit:g=ss,now:m=Date.now()}){const x=[];for(const u of tt(l)){const a=n.get(u.sessionId)??[],h=i.get(u.sessionId)??[],f=r.get(u.sessionId)??[],y=o.get(u.sessionId)??[],v=c.has(u.sessionId),_=a.length+h.length+f.length+y.length+Number(v);u.teamName&&u.agentName&&_===0||x.push({session:u,state:ts(u,st(u,e,m),a.length>0,f.length>0||y.length>0,h.length>0,v),summary:t.get(u.sessionId)??null,permissions:a,questions:h,elicitations:f,dialogs:y})}const j=x.filter(u=>Ee(u.state)),p=[...j.filter(u=>d.has(u.session.sessionId)),...j.filter(u=>!d.has(u.session.sessionId))].slice(0,g);return[...x.filter(u=>!Ee(u.state)),...p].sort((u,a)=>Ye[u.state]-Ye[a.state])}function is(l,e){switch(e){case"running":return l.filter(t=>t.state==="running");case"needs-you":return l.filter(t=>Pe(t.state));case"finished":return l.filter(t=>Ee(t.state));default:return l}}function ls(l){const e={total:l.length,running:0,needsYou:0,finished:0,failed:0};for(const t of l)t.state==="running"&&e.running++,Pe(t.state)&&e.needsYou++,Ee(t.state)&&e.finished++,t.state==="failed"&&e.failed++;return e}function os(l){return l>=90?"text-destructive":l>=70?"text-warning":"text-muted-foreground"}const as={awaiting_approval:{label:"Waiting for approval",text:"text-warning",shell:"border-warning/40 bg-warning/5",icon:Se},awaiting_prompt:{label:"Waiting for your input",text:"text-info",shell:"border-info/40 bg-info/5",icon:Se},awaiting_question:{label:"Waiting for your answer",text:"text-info",shell:"border-info/40 bg-info/5",icon:Se},awaiting_answer:{label:"Waiting for your answer",text:"text-warning",shell:"border-warning/40 bg-warning/5",icon:Se},running:{label:"Running",text:"text-info",shell:"border-border",icon:null},done:{label:"Done",text:"text-success",shell:"border-border",icon:qt},failed:{label:"Failed",text:"text-destructive",shell:"border-destructive/40",icon:_t}};function rs(l){const e=B.c(3),{icon:t}=l;if(!t){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("span",{className:"size-2 shrink-0 rounded-full bg-info"}),e[0]=i):i=e[0],i}let n;return e[1]!==t?(n=s.jsx(t,{className:"size-3.5 shrink-0"}),e[1]=t,e[2]=n):n=e[2],n}const cs=V.memo(function(e){const t=B.c(88),{card:n,customName:i,projectLabel:r,responding:o,goneQuestions:c,compact:d,onOpen:g,onRespond:m,onAnswerQuestion:x,onAnswerElicitation:j,onChooseDialog:p}=e,u=d===void 0?!1:d,{session:a,state:h,summary:f,permissions:y,questions:v,elicitations:_,dialogs:T}=n,N=as[h],b=y[0],q=v[0],S=_[0],w=T[0],I=!!(b||q||S||w);let z;t[0]!==i||t[1]!==a?(z=it(a,i),t[0]=i,t[1]=a,t[2]=z):z=t[2];const L=z,k=u&&"gap-1.5 py-2";let R;t[3]!==N.shell||t[4]!==k?(R=ue("motion-card motion-list-item group flex min-w-0 flex-col gap-2 rounded-lg border bg-card p-3 text-left transition-colors hover:border-foreground/20",N.shell,k),t[3]=N.shell,t[4]=k,t[5]=R):R=t[5];const D=`Open session ${L}`;let A;t[6]!==r?(A=s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:r}),t[6]=r,t[7]=A):A=t[7];let E;t[8]!==f?(E=(f==null?void 0:f.model)&&s.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:lt(f.model)}),t[8]=f,t[9]=E):E=t[9];let C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(De,{"data-icon":"inline-end",className:"shrink-0 text-transparent transition-colors group-hover:text-muted-foreground"}),t[10]=C):C=t[10];let $;t[11]!==A||t[12]!==E?($=s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[A,E,C]}),t[11]=A,t[12]=E,t[13]=$):$=t[13];const O=u?"truncate":"line-clamp-2";let se;t[14]!==O?(se=ue("text-sm font-medium leading-snug text-foreground",O),t[14]=O,t[15]=se):se=t[15];let P;t[16]!==se||t[17]!==L?(P=s.jsx("span",{className:se,children:L}),t[16]=se,t[17]=L,t[18]=P):P=t[18];let ne;t[19]!==g||t[20]!==P||t[21]!==D||t[22]!==$?(ne=s.jsxs(U,{variant:"ghost",onClick:g,className:"-m-1 h-auto min-w-0 flex-col items-stretch justify-start gap-1 whitespace-normal p-1 text-left","aria-label":D,children:[$,P]}),t[19]=g,t[20]=P,t[21]=D,t[22]=$,t[23]=ne):ne=t[23];let ie;t[24]!==N.text?(ie=ue("flex items-center gap-1.5 text-xs font-medium",N.text),t[24]=N.text,t[25]=ie):ie=t[25];let le;t[26]!==N.icon?(le=s.jsx(rs,{icon:N.icon}),t[26]=N.icon,t[27]=le):le=t[27];let te;t[28]!==N.label?(te=s.jsx("span",{className:"truncate",children:N.label}),t[28]=N.label,t[29]=te):te=t[29];const ce=a.lastActivityAt||a.lastModified;let Q;t[30]!==ce?(Q=ot(ce),t[30]=ce,t[31]=Q):Q=t[31];let oe;t[32]!==Q?(oe=s.jsx("span",{className:"ml-auto shrink-0 font-mono text-xs font-normal text-muted-foreground",children:Q}),t[32]=Q,t[33]=oe):oe=t[33];let G;t[34]!==ie||t[35]!==le||t[36]!==te||t[37]!==oe?(G=s.jsxs("div",{className:ie,children:[le,te,oe]}),t[34]=ie,t[35]=le,t[36]=te,t[37]=oe,t[38]=G):G=t[38];let H;t[39]!==m||t[40]!==y.length||t[41]!==b||t[42]!==o||t[43]!==a.sessionId?(H=b&&s.jsx(Kt,{request:b,queued:y.length-1,responding:o.has(b.requestId),onRespond:(re,Y)=>m(a.sessionId,re,Y)}),t[39]=m,t[40]=y.length,t[41]=b,t[42]=o,t[43]=a.sessionId,t[44]=H):H=t[44];let K;t[45]!==w||t[46]!==p||t[47]!==b||t[48]!==o||t[49]!==a.sessionId?(K=!b&&w&&s.jsx(es,{request:w,responding:o.has(w.requestId),onChoose:(re,Y)=>p(a.sessionId,re,Y)},w.requestId),t[45]=w,t[46]=p,t[47]=b,t[48]=o,t[49]=a.sessionId,t[50]=K):K=t[50];let W;t[51]!==w||t[52]!==S||t[53]!==j||t[54]!==b||t[55]!==o||t[56]!==a.sessionId?(W=!b&&!w&&S&&s.jsx(Bt,{request:S,responding:o.has(S.requestId),onAnswer:(re,Y)=>j(a.sessionId,re,Y)},S.requestId),t[51]=w,t[52]=S,t[53]=j,t[54]=b,t[55]=o,t[56]=a.sessionId,t[57]=W):W=t[57];let X;t[58]!==w||t[59]!==S||t[60]!==c||t[61]!==x||t[62]!==g||t[63]!==q||t[64]!==b||t[65]!==o||t[66]!==a.sessionId?(X=!b&&!w&&!S&&q&&s.jsx(Jt,{request:q,responding:o.has(q.toolUseId),gone:c.has(q.toolUseId),onAnswer:(re,Y)=>x(a.sessionId,re,Y),onOpenSession:g},q.toolUseId),t[58]=w,t[59]=S,t[60]=c,t[61]=x,t[62]=g,t[63]=q,t[64]=b,t[65]=o,t[66]=a.sessionId,t[67]=X):X=t[67];let J;t[68]!==I||t[69]!==f?(J=!I&&(f==null?void 0:f.currentTool)&&s.jsx(ds,{tool:f.currentTool}),t[68]=I,t[69]=f,t[70]=J):J=t[70];let Z;t[71]!==I||t[72]!==u||t[73]!==f?(Z=!u&&!I&&(f==null?void 0:f.lastAssistantText)&&s.jsx("p",{className:"line-clamp-4 text-sm leading-relaxed text-muted-foreground",children:f.lastAssistantText}),t[71]=I,t[72]=u,t[73]=f,t[74]=Z):Z=t[74];let ee;t[75]!==f?(ee=f&&s.jsx(us,{summary:f}),t[75]=f,t[76]=ee):ee=t[76];let ae;return t[77]!==ne||t[78]!==G||t[79]!==H||t[80]!==K||t[81]!==W||t[82]!==X||t[83]!==J||t[84]!==Z||t[85]!==ee||t[86]!==R?(ae=s.jsxs("div",{className:R,children:[ne,G,H,K,W,X,J,Z,ee]}),t[77]=ne,t[78]=G,t[79]=H,t[80]=K,t[81]=W,t[82]=X,t[83]=J,t[84]=Z,t[85]=ee,t[86]=R,t[87]=ae):ae=t[87],ae});function ds(l){const e=B.c(7),{tool:t}=l;let n;e[0]!==t.name?(n=s.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:t.name}),e[0]=t.name,e[1]=n):n=e[1];let i;e[2]!==t.summary?(i=s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground/80",children:t.summary}),e[2]=t.summary,e[3]=i):i=e[3];let r;return e[4]!==n||e[5]!==i?(r=s.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md bg-muted/50 px-2.5 py-2",children:[n,i]}),e[4]=n,e[5]=i,e[6]=r):r=e[6],r}function us(l){const e=B.c(11),{summary:t}=l,n=t.filesTotal,i=t.context,r=n.count>0,o=i!==null&&i.used>0;if(!r&&!o)return null;let c;e[0]!==n.additions||e[1]!==n.count||e[2]!==n.deletions||e[3]!==r?(c=r&&s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsxs("span",{className:"truncate",children:[n.count," file",n.count===1?"":"s"]}),s.jsx(at,{add:n.additions,del:n.deletions})]}),e[0]=n.additions,e[1]=n.count,e[2]=n.deletions,e[3]=r,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==o?(d=o&&s.jsxs("span",{className:ue("ml-auto shrink-0",os(i.percent)),children:["ctx ",i.percent,"%"]}),e[5]=i,e[6]=o,e[7]=d):d=e[7];let g;return e[8]!==c||e[9]!==d?(g=s.jsxs("div",{className:"mt-auto flex items-center gap-2 border-t pt-2 font-mono text-xs text-muted-foreground",children:[c,d]}),e[8]=c,e[9]=d,e[10]=g):g=e[10],g}const fs=8e3,ms=12,xs="Start Claude Code, Codex, or Copilot and every session shows up here",hs=[{id:"all",label:"All"},{id:"running",label:"Running"},{id:"needs-you",label:"Needs you"},{id:"finished",label:"Finished"}],gs=[{id:"grid",label:"Grid layout",Icon:Ct},{id:"list",label:"List layout",Icon:Tt}];function Ns(l){const e=B.c(118),{onSelectSession:t}=l,{sessions:n,procBySession:i,newlyCompleted:r,refresh:o}=rt(),{summaries:c,loading:d,error:g,refresh:m}=Mt(),{permissionsBySession:x,questionsBySession:j,elicitationsBySession:p,dialogsBySession:u,awaitingPlan:a,responding:h,respond:f,answerQuestion:y,answerElicitation:v,answerDialog:_,refresh:T}=ct();let N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=new Set,e[0]=N):N=e[0];const[b,q]=V.useState(N),{names:S}=dt(),{names:w}=ut(),[I,z]=V.useState("all");let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=ft("mission-control-layout"),e[1]=L):L=e[1];const[k,R]=mt(L,"grid");let D;e[2]!==a||e[3]!==u||e[4]!==p||e[5]!==r||e[6]!==x||e[7]!==i||e[8]!==j||e[9]!==n||e[10]!==c?(D=ns({sessions:n,procBySession:i,summaries:c,permissionsBySession:x,questionsBySession:j,elicitationsBySession:p,dialogsBySession:u,awaitingPlan:a,newlyCompleted:r}),e[2]=a,e[3]=u,e[4]=p,e[5]=r,e[6]=x,e[7]=i,e[8]=j,e[9]=n,e[10]=c,e[11]=D):D=e[11];const A=D;let E;e[12]!==A?(E=ls(A),e[12]=A,e[13]=E):E=e[13];const C=E;let $;e[14]!==A||e[15]!==I?($=is(A,I),e[14]=A,e[15]=I,e[16]=$):$=e[16];const O=$;let se;e[17]!==T||e[18]!==o||e[19]!==m?(se=()=>{o(),m(),T()},e[17]=T,e[18]=o,e[19]=m,e[20]=se):se=e[20];const P=se;let ne,ie;e[21]!==o?(ne=()=>{const F=setInterval(()=>{document.visibilityState==="visible"&&o()},fs);return()=>clearInterval(F)},ie=[o],e[21]=o,e[22]=ne,e[23]=ie):(ne=e[22],ie=e[23]),V.useEffect(ne,ie);let le;e[24]!==y?(le=async(F,M,Me)=>{(await y(F,M,Me)).ok||q(Qe=>new Set(Qe).add(M))},e[24]=y,e[25]=le):le=e[25];const te=le;let ce;e[26]!==A.length?(ce=function(M){A.length<=ms?Ot(M,{kind:"fade"}):V.startTransition(M)},e[26]=A.length,e[27]=ce):ce=e[27];const Q=ce;let oe;e[28]===Symbol.for("react.memo_cache_sentinel")?(oe=s.jsx("h2",{className:"truncate text-sm font-semibold",children:"Mission Control"}),e[28]=oe):oe=e[28];let G;e[29]!==C.total?(G=s.jsx(Te,{variant:"secondary",children:C.total}),e[29]=C.total,e[30]=G):G=e[30];let H;e[31]!==C.needsYou?(H=C.needsYou>0&&s.jsxs(Te,{variant:"outline",className:"border-warning/40 text-warning",children:[C.needsYou," need you"]}),e[31]=C.needsYou,e[32]=H):H=e[32];let K;e[33]!==C.failed?(K=C.failed>0&&s.jsxs(Te,{variant:"destructive",children:[C.failed," failed"]}),e[33]=C.failed,e[34]=K):K=e[34];let W;e[35]!==G||e[36]!==H||e[37]!==K?(W=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[oe,G,H,K]}),e[35]=G,e[36]=H,e[37]=K,e[38]=W):W=e[38];let X;e[39]!==I?(X=[I],e[39]=I,e[40]=X):X=e[40];let J;e[41]!==I||e[42]!==Q?(J=F=>{const M=F.at(-1);M&&M!==I&&Q(()=>z(M))},e[41]=I,e[42]=Q,e[43]=J):J=e[43];let Z;e[44]!==C.needsYou?(Z=hs.map(F=>s.jsxs(ke,{value:F.id,"aria-label":`Show ${F.label.toLowerCase()} sessions`,children:[F.label,F.id==="needs-you"&&C.needsYou>0&&s.jsx("span",{className:"font-mono text-warning",children:C.needsYou})]},F.id)),e[44]=C.needsYou,e[45]=Z):Z=e[45];let ee;e[46]!==X||e[47]!==J||e[48]!==Z?(ee=s.jsx(ze,{value:X,onValueChange:J,variant:"outline",size:"sm",spacing:0,"aria-label":"Filter sessions",children:Z}),e[46]=X,e[47]=J,e[48]=Z,e[49]=ee):ee=e[49];let ae;e[50]!==k||e[51]!==R||e[52]!==Q?(ae=gs.map(F=>{const{id:M,label:Me,Icon:Oe}=F;return s.jsx(U,{variant:"ghost",size:"icon-xs","aria-label":Me,"aria-pressed":k===M,onClick:()=>{M!==k&&Q(()=>R(M))},className:ue(k===M&&"bg-accent text-accent-foreground"),children:s.jsx(Oe,{"data-icon":"inline-start"})},M)}),e[50]=k,e[51]=R,e[52]=Q,e[53]=ae):ae=e[53];const re=d&&"animate-spin";let Y;e[54]!==re?(Y=ue(re),e[54]=re,e[55]=Y):Y=e[55];let fe;e[56]!==Y?(fe=s.jsx(At,{"data-icon":"inline-start",className:Y}),e[56]=Y,e[57]=fe):fe=e[57];let me;e[58]!==P||e[59]!==fe?(me=s.jsx(U,{variant:"ghost",size:"icon-xs","aria-label":"Refresh Mission Control",onClick:P,children:fe}),e[58]=P,e[59]=fe,e[60]=me):me=e[60];let xe;e[61]!==ae||e[62]!==me?(xe=s.jsxs("div",{className:"flex items-center gap-1",children:[ae,me]}),e[61]=ae,e[62]=me,e[63]=xe):xe=e[63];let he;e[64]!==ee||e[65]!==xe?(he=s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[ee,xe]}),e[64]=ee,e[65]=xe,e[66]=he):he=e[66];let ge;e[67]!==W||e[68]!==he?(ge=s.jsxs("header",{className:"flex min-h-12 shrink-0 flex-wrap items-center gap-3 border-b px-4 py-2",children:[W,he]}),e[67]=W,e[68]=he,e[69]=ge):ge=e[69];let pe;e[70]!==g||e[71]!==P?(pe=g&&s.jsxs(qe,{variant:"destructive",className:"mb-4",children:[s.jsx(Et,{}),s.jsx(_e,{children:"Mission Control could not refresh"}),s.jsx(wt,{className:"truncate",children:g}),s.jsx(vt,{children:s.jsx(U,{variant:"outline",size:"xs",onClick:P,children:"Retry"})})]}),e[70]=g,e[71]=P,e[72]=pe):pe=e[72];let be;e[73]!==A.length||e[74]!==I||e[75]!==d||e[76]!==O.length?(be=O.length===0&&!d&&s.jsx(xt,{className:"min-h-64",children:s.jsxs(ht,{children:[s.jsx(gt,{variant:"icon",children:s.jsx(kt,{})}),s.jsx(pt,{children:A.length===0?"No live sessions":`Nothing matches "${I}"`}),s.jsx(bt,{children:A.length===0?xs:"Try a different filter."})]})}),e[73]=A.length,e[74]=I,e[75]=d,e[76]=O.length,e[77]=be):be=e[77];let je;e[78]!==A.length||e[79]!==d||e[80]!==O.length?(je=O.length===0&&d&&A.length===0&&s.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-sm text-muted-foreground",children:[s.jsx(jt,{}),"Loading sessions…"]}),e[78]=A.length,e[79]=d,e[80]=O.length,e[81]=je):je=e[81];const Re=k==="grid"&&"md:grid-cols-2 2xl:grid-cols-3";let we;e[82]!==Re?(we=ue("grid grid-cols-1 gap-3",Re),e[82]=Re,e[83]=we):we=e[83];let ve;if(e[84]!==_||e[85]!==v||e[86]!==b||e[87]!==te||e[88]!==k||e[89]!==t||e[90]!==w||e[91]!==f||e[92]!==h||e[93]!==S||e[94]!==O){let F;e[96]!==_||e[97]!==v||e[98]!==b||e[99]!==te||e[100]!==k||e[101]!==t||e[102]!==w||e[103]!==f||e[104]!==h||e[105]!==S?(F=M=>s.jsx(cs,{card:M,compact:k==="list",customName:S[M.session.sessionId],projectLabel:w[M.session.dirName]??Nt(M.session),responding:h,goneQuestions:b,onOpen:()=>t(M.session.dirName,M.session.fileName),onRespond:f,onAnswerQuestion:te,onAnswerElicitation:v,onChooseDialog:_},M.session.sessionId),e[96]=_,e[97]=v,e[98]=b,e[99]=te,e[100]=k,e[101]=t,e[102]=w,e[103]=f,e[104]=h,e[105]=S,e[106]=F):F=e[106],ve=O.map(F),e[84]=_,e[85]=v,e[86]=b,e[87]=te,e[88]=k,e[89]=t,e[90]=w,e[91]=f,e[92]=h,e[93]=S,e[94]=O,e[95]=ve}else ve=e[95];let Ne;e[107]!==we||e[108]!==ve?(Ne=s.jsx("div",{className:we,children:ve}),e[107]=we,e[108]=ve,e[109]=Ne):Ne=e[109];let ye;e[110]!==pe||e[111]!==be||e[112]!==je||e[113]!==Ne?(ye=s.jsx(yt,{className:"flex-1",children:s.jsxs("div",{className:"p-4",children:[pe,be,je,Ne]})}),e[110]=pe,e[111]=be,e[112]=je,e[113]=Ne,e[114]=ye):ye=e[114];let Ce;return e[115]!==ge||e[116]!==ye?(Ce=s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ge,ye]}),e[115]=ge,e[116]=ye,e[117]=Ce):Ce=e[117],Ce}export{Ns as MissionControl};
|
|
1
|
+
import{r as V,a as Ge,c as B,j as s}from"./vendor-react-gGw_S5I_.js";import{w as He,B as U,a$ as Ke,aQ as _e,A as qe,b2 as We,bg as Le,Z as ke,Y as ze,a4 as Te,bh as Xe,b6 as Ze,b5 as Je,b4 as et,bi as tt,bj as st,bk as nt,bl as it,_ as ue,bm as lt,a5 as ot,aB as at,bn as rt,bo as ct,bp as dt,v as ut,$ as ft,bq as mt,E as xt,y as ht,z as gt,G as pt,H as bt,al as jt,p as wt,br as vt,bs as Nt,q as yt}from"./index-CdXCbj1g.js";import{c as St,al as It,ar as Be,C as De,as as Se,ai as _t,at as qt,L as Ct,au as Tt,av as kt,b as At,N as Et}from"./vendor-ui-CevbH8m5.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const Rt=4e3;function Mt(){const[l,e]=V.useState([]),[t,n]=V.useState(!1),[i,r]=V.useState(null),o=V.useRef(!1);V.useEffect(()=>(o.current=!1,()=>{o.current=!0}),[]);const c=V.useCallback(async()=>{try{const m=await He("/api/mission-control");if(o.current)return;if(!m.ok)throw new Error(`Mission Control request failed (${m.status})`);const x=await m.json();if(o.current)return;e(Array.isArray(x.summaries)?x.summaries:[]),r(null)}catch(m){if(o.current)return;r(m instanceof Error?m.message:"Failed to load Mission Control")}finally{o.current||n(!1)}},[]);V.useEffect(()=>{n(!0);const m=()=>{(typeof document>"u"||document.visibilityState==="visible")&&c()},x=()=>{document.visibilityState==="visible"&&c()};m();const j=setInterval(m,Rt);return document.addEventListener("visibilitychange",x),()=>{clearInterval(j),document.removeEventListener("visibilitychange",x)}},[c]);const d=V.useMemo(()=>{const m=new Map;for(const x of l)m.set(x.sessionId,x);return m},[l]),g=V.useCallback(()=>{c()},[c]);return{summaries:d,loading:t,error:i,refresh:g}}const Ae="data-view-transition-kind",Lt="(prefers-reduced-motion: reduce)";let de=null,Fe=null;function $t(l,e,t){t===null?l.removeAttribute(e):l.setAttribute(e,t)}function Dt(l,e){const t={root:l,kind:e,previousKind:l.getAttribute(Ae)};return l.setAttribute(Ae,e),Fe=t,t}function Ie(l){Fe===l&&(l.root.getAttribute(Ae)===l.kind&&$t(l.root,Ae,l.previousKind),Fe=null)}function Ft(){const l=de;if(l){de=null;try{l.transition.skipTransition()}catch{Ie(l.tag);return}Ie(l.tag)}}function zt(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia(Lt).matches}catch{return!1}}function Ot(l,{kind:e}){Ft();const t=typeof document>"u"?null:document,n=t==null?void 0:t.startViewTransition;if(!t||!(typeof n=="function")||zt())return l(),null;const r=Dt(t.documentElement,e);let o=!1,c=!1,d;const g=m=>{if(!o){o=!0;try{m?Ge.flushSync(l):l()}catch(x){throw c=!0,d=x,x}}};try{const m=n.call(t,()=>g(!0)),x={transition:m,tag:r};return de=x,m.ready.catch(()=>{}),m.updateCallbackDone.catch(()=>{}),m.finished.then(()=>{de===x&&(de=null),Ie(r)},()=>{de===x&&(de=null),Ie(r)}),m}catch{if(Ie(r),c)throw d;return g(!1),null}}function Vt(l){const e={};for(const t of l)t.type==="boolean"?e[t.name]=t.defaultValue===!0:t.defaultValue!==void 0?e[t.name]=String(t.defaultValue):e[t.name]="";return e}function Ut(l,e){const t={};for(const n of l){const i=e[n.name];if(typeof i=="boolean"){t[n.name]=i;continue}i!==""&&(t[n.name]=n.type==="number"||n.type==="integer"?Number(i):i)}return t}function Yt(l,e){return l.every(t=>{if(!t.required)return!0;const n=e[t.name];return typeof n=="boolean"?!0:n===""?!1:t.type==="number"||t.type==="integer"?Number.isFinite(Number(n)):!0})}function Bt(l){const e=B.c(64),{request:t,responding:n,onAnswer:i}=l;let r;e[0]!==t.fields?(r=()=>Vt(t.fields),e[0]=t.fields,e[1]=r):r=e[1];const[o,c]=V.useState(r);let d;e[2]!==t.fields||e[3]!==o?(d=Yt(t.fields,o),e[2]=t.fields,e[3]=o,e[4]=d):d=e[4];const g=d,m=t.displayName||t.title||t.serverName;let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=(q,S)=>{c(w=>({...w,[q]:S}))},e[5]=x):x=e[5];const j=x;let p;e[6]!==i||e[7]!==t.requestId?(p=()=>i(t.requestId,{action:"decline"}),e[6]=i,e[7]=t.requestId,e[8]=p):p=e[8];const u=p;if(t.mode==="url"&&t.url){const q=t.url;let S;e[9]!==t.message?(S=s.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:t.message}),e[9]=t.message,e[10]=S):S=e[10];let w;e[11]!==q?(w=s.jsx("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:q,children:q}),e[11]=q,e[12]=w):w=e[12];let I;e[13]!==i||e[14]!==t.requestId||e[15]!==q?(I=()=>{window.open(q,"_blank","noopener,noreferrer"),i(t.requestId,{action:"accept"})},e[13]=i,e[14]=t.requestId,e[15]=q,e[16]=I):I=e[16];let z;e[17]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(St,{"data-icon":"inline-end"}),e[17]=z):z=e[17];let L;e[18]!==n||e[19]!==I?(L=s.jsxs(U,{size:"sm",disabled:n,onClick:I,children:["Open link",z]}),e[18]=n,e[19]=I,e[20]=L):L=e[20];let k;e[21]!==u||e[22]!==n?(k=s.jsx(U,{variant:"ghost",size:"sm",disabled:n,onClick:u,children:"Decline"}),e[21]=u,e[22]=n,e[23]=k):k=e[23];let R;e[24]!==k||e[25]!==L?(R=s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[L,k]}),e[24]=k,e[25]=L,e[26]=R):R=e[26];let D;return e[27]!==m||e[28]!==R||e[29]!==S||e[30]!==w?(D=s.jsxs(Ve,{server:m,children:[S,w,R]}),e[27]=m,e[28]=R,e[29]=S,e[30]=w,e[31]=D):D=e[31],D}let a;e[32]!==t.message?(a=s.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:t.message}),e[32]=t.message,e[33]=a):a=e[33];let h;if(e[34]!==t.fields||e[35]!==t.requestId||e[36]!==n||e[37]!==o){let q;e[39]!==t.requestId||e[40]!==n||e[41]!==o?(q=S=>s.jsx(Pt,{id:`elicit-${t.requestId}-${S.name}`,field:S,value:o[S.name],disabled:n,onChange:w=>j(S.name,w)},S.name),e[39]=t.requestId,e[40]=n,e[41]=o,e[42]=q):q=e[42],h=t.fields.map(q),e[34]=t.fields,e[35]=t.requestId,e[36]=n,e[37]=o,e[38]=h}else h=e[38];let f;e[43]!==h?(f=s.jsx("div",{className:"mt-3 flex flex-col gap-3",children:h}),e[43]=h,e[44]=f):f=e[44];const y=n||!g;let v;e[45]!==i||e[46]!==t.fields||e[47]!==t.requestId||e[48]!==o?(v=()=>i(t.requestId,{action:"accept",content:Ut(t.fields,o)}),e[45]=i,e[46]=t.fields,e[47]=t.requestId,e[48]=o,e[49]=v):v=e[49];let _;e[50]!==y||e[51]!==v?(_=s.jsx(U,{size:"sm",disabled:y,onClick:v,children:"Send"}),e[50]=y,e[51]=v,e[52]=_):_=e[52];let T;e[53]!==u||e[54]!==n?(T=s.jsx(U,{variant:"ghost",size:"sm",disabled:n,onClick:u,children:"Decline"}),e[53]=u,e[54]=n,e[55]=T):T=e[55];let N;e[56]!==_||e[57]!==T?(N=s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[_,T]}),e[56]=_,e[57]=T,e[58]=N):N=e[58];let b;return e[59]!==m||e[60]!==N||e[61]!==a||e[62]!==f?(b=s.jsxs(Ve,{server:m,children:[a,f,N]}),e[59]=m,e[60]=N,e[61]=a,e[62]=f,e[63]=b):b=e[63],b}function Pt(l){const e=B.c(55),{id:t,field:n,value:i,disabled:r,onChange:o}=l;if(n.type==="boolean"){const u=i===!0;let a;e[0]!==o?(a=v=>o(v===!0),e[0]=o,e[1]=a):a=e[1];let h;e[2]!==r||e[3]!==t||e[4]!==u||e[5]!==a?(h=s.jsx(We,{id:t,checked:u,disabled:r,onCheckedChange:a}),e[2]=r,e[3]=t,e[4]=u,e[5]=a,e[6]=h):h=e[6];let f;e[7]!==n?(f=s.jsx($e,{field:n}),e[7]=n,e[8]=f):f=e[8];let y;return e[9]!==t||e[10]!==h||e[11]!==f?(y=s.jsxs(Le,{htmlFor:t,className:"items-start gap-2 font-normal",children:[h,f]}),e[9]=t,e[10]=h,e[11]=f,e[12]=y):y=e[12],y}if(n.type==="enum"){let u;e[13]!==n?(u=s.jsx($e,{field:n}),e[13]=n,e[14]=u):u=e[14];let a;e[15]!==t||e[16]!==u?(a=s.jsx(Le,{htmlFor:t,children:u}),e[15]=t,e[16]=u,e[17]=a):a=e[17];let h;e[18]!==i?(h=typeof i=="string"&&i?[i]:[],e[18]=i,e[19]=h):h=e[19];let f;e[20]!==o?(f=b=>{b[0]&&o(b[0])},e[20]=o,e[21]=f):f=e[21];const y=n.label;let v;e[22]!==n.options?(v=n.options??[],e[22]=n.options,e[23]=v):v=e[23];let _;if(e[24]!==r||e[25]!==v){let b;e[27]!==r?(b=q=>s.jsx(ke,{value:q.value,disabled:r,className:"w-full justify-start px-3",children:q.label},q.value),e[27]=r,e[28]=b):b=e[28],_=v.map(b),e[24]=r,e[25]=v,e[26]=_}else _=e[26];let T;e[29]!==n.label||e[30]!==t||e[31]!==h||e[32]!==f||e[33]!==_?(T=s.jsx(ze,{id:t,value:h,onValueChange:f,orientation:"vertical",variant:"outline",size:"sm",className:"w-full items-stretch","aria-label":y,children:_}),e[29]=n.label,e[30]=t,e[31]=h,e[32]=f,e[33]=_,e[34]=T):T=e[34];let N;return e[35]!==a||e[36]!==T?(N=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,T]}),e[35]=a,e[36]=T,e[37]=N):N=e[37],N}let c;e[38]!==n?(c=s.jsx($e,{field:n}),e[38]=n,e[39]=c):c=e[39];let d;e[40]!==t||e[41]!==c?(d=s.jsx(Le,{htmlFor:t,children:c}),e[40]=t,e[41]=c,e[42]=d):d=e[42];const g=n.type==="string"?"text":"number",m=typeof i=="string"?i:"";let x;e[43]!==o?(x=u=>o(u.target.value),e[43]=o,e[44]=x):x=e[44];let j;e[45]!==r||e[46]!==n.label||e[47]!==t||e[48]!==g||e[49]!==m||e[50]!==x?(j=s.jsx(Ke,{id:t,"aria-label":n.label,type:g,value:m,disabled:r,onChange:x}),e[45]=r,e[46]=n.label,e[47]=t,e[48]=g,e[49]=m,e[50]=x,e[51]=j):j=e[51];let p;return e[52]!==d||e[53]!==j?(p=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,j]}),e[52]=d,e[53]=j,e[54]=p):p=e[54],p}function $e(l){const e=B.c(8),{field:t}=l;let n;e[0]!==t.required?(n=t.required&&s.jsx("span",{className:"ml-0.5 text-warning",children:"*"}),e[0]=t.required,e[1]=n):n=e[1];let i;e[2]!==t.description?(i=t.description&&s.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:t.description}),e[2]=t.description,e[3]=i):i=e[3];let r;return e[4]!==t.label||e[5]!==n||e[6]!==i?(r=s.jsxs("span",{className:"min-w-0",children:[t.label,n,i]}),e[4]=t.label,e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function Ve(l){const e=B.c(8),{server:t,children:n}=l;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(It,{className:"text-info"}),e[0]=i):i=e[0];let r;e[1]!==t?(r=s.jsxs(_e,{children:[t," needs input"]}),e[1]=t,e[2]=r):r=e[2];let o;e[3]!==n?(o=s.jsx("div",{className:"col-start-2 mt-1 min-w-0",children:n}),e[3]=n,e[4]=o):o=e[4];let c;return e[5]!==r||e[6]!==o?(c=s.jsxs(qe,{className:"border-info/40 bg-info/5",children:[i,r,o]}),e[5]=r,e[6]=o,e[7]=c):c=e[7],c}const Qt=["allow","allow_always","deny"],Gt=[{decision:"allow",label:"Allow",variant:"default"},{decision:"deny",label:"Deny",variant:"destructive"},{decision:"allow_always",label:"Always",variant:"outline"}];function Ht(l,e){return(l.availableDecisions??Qt).includes(e)}function Kt(l){const e=B.c(22),{request:t,queued:n,responding:i,onRespond:r}=l;let o;if(e[0]!==r||e[1]!==n||e[2]!==t||e[3]!==i){let c;e[5]!==t?(c=y=>Ht(t,y.decision),e[5]=t,e[6]=c):c=e[6];const d=Gt.filter(c),g=d.some(Wt);let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(Be,{className:"text-warning"}),e[7]=m):m=e[7];const x=t.title||`Allow ${t.toolName}?`;let j;e[8]!==x?(j=s.jsx("span",{className:"min-w-0 flex-1 truncate",children:x}),e[8]=x,e[9]=j):j=e[9];let p;e[10]!==n?(p=n>0&&s.jsxs("span",{className:"shrink-0 font-mono text-xs text-warning",children:["+",n]}),e[10]=n,e[11]=p):p=e[11];let u;e[12]!==j||e[13]!==p?(u=s.jsxs(_e,{className:"flex min-w-0 items-center gap-2",children:[j,p]}),e[12]=j,e[13]=p,e[14]=u):u=e[14];let a;e[15]!==t.toolName?(a=s.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:t.toolName}),e[15]=t.toolName,e[16]=a):a=e[16];let h;e[17]!==t.summary?(h=t.summary&&s.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:t.summary}),e[17]=t.summary,e[18]=h):h=e[18];let f;e[19]!==a||e[20]!==h?(f=s.jsxs("div",{className:"col-start-2 mt-2 flex min-w-0 items-center gap-2",children:[a,h]}),e[19]=a,e[20]=h,e[21]=f):f=e[21],o=s.jsxs(qe,{className:"border-warning/40 bg-warning/5",children:[m,u,f,g?s.jsx("div",{className:"col-start-2 mt-3 flex items-center gap-2",children:d.map(y=>{const{decision:v,label:_,variant:T}=y;return s.jsx(U,{size:"xs",variant:T,disabled:i,onClick:()=>r(t.requestId,v),children:_},v)})}):s.jsx("p",{className:"col-start-2 mt-2 text-xs text-warning",children:"Resolve this approval in its own provider"})]}),e[0]=r,e[1]=n,e[2]=t,e[3]=i,e[4]=o}else o=e[4];return o}function Wt(l){return l.decision!=="allow_always"}function Xt(l){return l.some(e=>e.options.length===0||e.options.some(t=>t.hasPreview))}function Zt(l){const e=B.c(63),{request:t,responding:n,gone:i,onAnswer:r,onOpenSession:o}=l,c=t.questions,[d,g]=V.useState(0);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={},e[0]=m):m=e[0];const x=V.useRef(m);let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j=new Set,e[1]=j):j=e[1];const[p,u]=V.useState(j);if(c.length===0)return null;if(Xt(c)){let E;e[2]!==c[0].question?(E=s.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:c[0].question}),e[2]=c[0].question,e[3]=E):E=e[3];let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(De,{"data-icon":"inline-end"}),e[4]=C):C=e[4];let $;e[5]!==o?($=s.jsxs(U,{variant:"outline",size:"sm",onClick:o,className:"mt-3",children:["Open full question",C]}),e[5]=o,e[6]=$):$=e[6];let O;return e[7]!==E||e[8]!==$?(O=s.jsxs(Ue,{children:[E,$]}),e[7]=E,e[8]=$,e[9]=O):O=e[9],O}const a=c[d];let h;e[10]!==a.question||e[11]!==d||e[12]!==r||e[13]!==c.length||e[14]!==t.toolUseId?(h=function(C){const $={...x.current,[a.question]:C};if(d+1<c.length){x.current=$,u(new Set),g(d+1);return}r(t.toolUseId,$)},e[10]=a.question,e[11]=d,e[12]=r,e[13]=c.length,e[14]=t.toolUseId,e[15]=h):h=e[15];const f=h;let y;e[16]!==a.header?(y=a.header&&s.jsx(Te,{variant:"outline",className:"border-info/40 text-info",children:a.header}),e[16]=a.header,e[17]=y):y=e[17];let v;e[18]!==d||e[19]!==c.length?(v=c.length>1&&s.jsxs("span",{className:"ml-auto shrink-0 font-mono text-xs text-muted-foreground",children:[d+1," of ",c.length]}),e[18]=d,e[19]=c.length,e[20]=v):v=e[20];let _;e[21]!==y||e[22]!==v?(_=s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[y,v]}),e[21]=y,e[22]=v,e[23]=_):_=e[23];let T;e[24]!==a.question?(T=s.jsx("p",{className:"mt-2 line-clamp-3 text-sm leading-relaxed text-foreground",title:a.question,children:a.question}),e[24]=a.question,e[25]=T):T=e[25];let N;e[26]!==p?(N=[...p],e[26]=p,e[27]=N):N=e[27];let b;e[28]!==f||e[29]!==a.multiSelect?(b=E=>{a.multiSelect?u(new Set(E)):E[0]&&f(E[0])},e[28]=f,e[29]=a.multiSelect,e[30]=b):b=e[30];const q=a.multiSelect,S=a.question;let w;if(e[31]!==a.options||e[32]!==n){let E;e[34]!==n?(E=C=>s.jsx(Jt,{option:C,disabled:n},C.label),e[34]=n,e[35]=E):E=e[35],w=a.options.map(E),e[31]=a.options,e[32]=n,e[33]=w}else w=e[33];let I;e[36]!==a.multiSelect||e[37]!==a.question||e[38]!==w||e[39]!==N||e[40]!==b?(I=s.jsx(ze,{value:N,onValueChange:b,multiple:q,orientation:"vertical",variant:"outline",size:"sm",className:"mt-3 w-full items-stretch","aria-label":S,children:w}),e[36]=a.multiSelect,e[37]=a.question,e[38]=w,e[39]=N,e[40]=b,e[41]=I):I=e[41];let z;e[42]!==f||e[43]!==a.multiSelect||e[44]!==d||e[45]!==c.length||e[46]!==n||e[47]!==p?(z=a.multiSelect&&s.jsx(U,{size:"sm",disabled:n||p.size===0,onClick:()=>f(Xe(p)),children:d+1<c.length?"Next":"Send"}),e[42]=f,e[43]=a.multiSelect,e[44]=d,e[45]=c.length,e[46]=n,e[47]=p,e[48]=z):z=e[48];let L;e[49]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(De,{"data-icon":"inline-end"}),e[49]=L):L=e[49];let k;e[50]!==o?(k=s.jsxs(U,{variant:"ghost",size:"sm",onClick:o,className:"ml-auto text-muted-foreground",children:["Open session",L]}),e[50]=o,e[51]=k):k=e[51];let R;e[52]!==z||e[53]!==k?(R=s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[z,k]}),e[52]=z,e[53]=k,e[54]=R):R=e[54];let D;e[55]!==i?(D=i&&s.jsx("p",{className:"mt-2 text-xs text-warning",children:"This question may already be answered. Open the session to check."}),e[55]=i,e[56]=D):D=e[56];let A;return e[57]!==I||e[58]!==R||e[59]!==D||e[60]!==_||e[61]!==T?(A=s.jsxs(Ue,{children:[_,T,I,R,D]}),e[57]=I,e[58]=R,e[59]=D,e[60]=_,e[61]=T,e[62]=A):A=e[62],A}function Jt(l){const e=B.c(17),{option:t,disabled:n}=l;let i;e[0]!==t.label?(i=s.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:t.label}),e[0]=t.label,e[1]=i):i=e[1];const r=i;if(!t.description){let m;return e[2]!==n||e[3]!==r||e[4]!==t.label?(m=s.jsx(ke,{value:t.label,disabled:n,className:"w-full justify-start px-3",children:r}),e[2]=n,e[3]=r,e[4]=t.label,e[5]=m):m=e[5],m}let o;e[6]!==n||e[7]!==t.label?(o=s.jsx(ke,{value:t.label,disabled:n,className:"w-full justify-start px-3"}),e[6]=n,e[7]=t.label,e[8]=o):o=e[8];let c;e[9]!==r||e[10]!==o?(c=s.jsx(Je,{render:o,children:r}),e[9]=r,e[10]=o,e[11]=c):c=e[11];let d;e[12]!==t.description?(d=s.jsx(Ze,{side:"right",className:"max-w-72 text-left",children:t.description}),e[12]=t.description,e[13]=d):d=e[13];let g;return e[14]!==c||e[15]!==d?(g=s.jsxs(et,{children:[c,d]}),e[14]=c,e[15]=d,e[16]=g):g=e[16],g}function Ue(l){const e=B.c(4),{children:t}=l;let n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Se,{className:"text-info"}),i=s.jsx(_e,{children:"Answer to continue"}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let r;return e[2]!==t?(r=s.jsxs(qe,{className:"border-info/40 bg-info/5",children:[n,i,s.jsx("div",{className:"col-start-2 mt-1 min-w-0",children:t})]}),e[2]=t,e[3]=r):r=e[3],r}function es(l){const e=B.c(33),{request:t,responding:n,onChoose:i}=l;let r,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Be,{className:"text-warning"}),o=s.jsx(_e,{children:"Claude declined this request"}),e[0]=r,e[1]=o):(r=e[0],o=e[1]);let c;e[2]!==t.originalModel?(c=s.jsxs("p",{className:"text-sm leading-relaxed text-foreground",children:[t.originalModel," would not answer. Retrying on a fallback model may work."]}),e[2]=t.originalModel,e[3]=c):c=e[3];let d;e[4]!==t.guidanceText?(d=t.guidanceText&&s.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:t.guidanceText}),e[4]=t.guidanceText,e[5]=d):d=e[5];let g;e[6]!==i||e[7]!==t.requestId?(g=()=>i(t.requestId,"retry_fallback"),e[6]=i,e[7]=t.requestId,e[8]=g):g=e[8];let m;e[9]!==t.fallbackModel||e[10]!==n||e[11]!==g?(m=s.jsxs(U,{size:"sm",disabled:n,onClick:g,children:["Retry on ",t.fallbackModel]}),e[9]=t.fallbackModel,e[10]=n,e[11]=g,e[12]=m):m=e[12];let x;e[13]!==i||e[14]!==t.requestId?(x=()=>i(t.requestId,"edit_prompt"),e[13]=i,e[14]=t.requestId,e[15]=x):x=e[15];let j;e[16]!==n||e[17]!==x?(j=s.jsx(U,{variant:"outline",size:"sm",disabled:n,onClick:x,children:"Edit prompt"}),e[16]=n,e[17]=x,e[18]=j):j=e[18];let p;e[19]!==i||e[20]!==t.requestId?(p=()=>i(t.requestId,"cancelled"),e[19]=i,e[20]=t.requestId,e[21]=p):p=e[21];let u;e[22]!==n||e[23]!==p?(u=s.jsx(U,{variant:"ghost",size:"sm",disabled:n,className:"ml-auto text-muted-foreground",onClick:p,children:"Dismiss"}),e[22]=n,e[23]=p,e[24]=u):u=e[24];let a;e[25]!==u||e[26]!==m||e[27]!==j?(a=s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[m,j,u]}),e[25]=u,e[26]=m,e[27]=j,e[28]=a):a=e[28];let h;return e[29]!==a||e[30]!==c||e[31]!==d?(h=s.jsxs(qe,{className:"border-warning/40 bg-warning/5",children:[r,o,s.jsxs("div",{className:"col-start-2 mt-1 min-w-0",children:[c,d,a]})]}),e[29]=a,e[30]=c,e[31]=d,e[32]=h):h=e[32],h}function Pe(l){return l==="awaiting_approval"||l==="awaiting_prompt"||l==="awaiting_question"||l==="awaiting_answer"}function Ee(l){return l==="done"||l==="failed"}const Ye={awaiting_approval:0,awaiting_prompt:1,awaiting_question:2,awaiting_answer:3,running:4,failed:5,done:6};function ts(l,e,t,n,i,r){return t?"awaiting_approval":n?"awaiting_prompt":i?"awaiting_question":r||l.agentStatus==="deferred"||l.agentStatus==="idle"&&e?"awaiting_answer":l.agentTerminalReason?"failed":e&&l.agentStatus&&nt.has(l.agentStatus)?"running":"done"}const ss=6;function ns({sessions:l,procBySession:e,summaries:t,permissionsBySession:n,questionsBySession:i,elicitationsBySession:r,dialogsBySession:o,awaitingPlan:c,newlyCompleted:d,finishedLimit:g=ss,now:m=Date.now()}){const x=[];for(const u of tt(l)){const a=n.get(u.sessionId)??[],h=i.get(u.sessionId)??[],f=r.get(u.sessionId)??[],y=o.get(u.sessionId)??[],v=c.has(u.sessionId),_=a.length+h.length+f.length+y.length+Number(v);u.teamName&&u.agentName&&_===0||x.push({session:u,state:ts(u,st(u,e,m),a.length>0,f.length>0||y.length>0,h.length>0,v),summary:t.get(u.sessionId)??null,permissions:a,questions:h,elicitations:f,dialogs:y})}const j=x.filter(u=>Ee(u.state)),p=[...j.filter(u=>d.has(u.session.sessionId)),...j.filter(u=>!d.has(u.session.sessionId))].slice(0,g);return[...x.filter(u=>!Ee(u.state)),...p].sort((u,a)=>Ye[u.state]-Ye[a.state])}function is(l,e){switch(e){case"running":return l.filter(t=>t.state==="running");case"needs-you":return l.filter(t=>Pe(t.state));case"finished":return l.filter(t=>Ee(t.state));default:return l}}function ls(l){const e={total:l.length,running:0,needsYou:0,finished:0,failed:0};for(const t of l)t.state==="running"&&e.running++,Pe(t.state)&&e.needsYou++,Ee(t.state)&&e.finished++,t.state==="failed"&&e.failed++;return e}function os(l){return l>=90?"text-destructive":l>=70?"text-warning":"text-muted-foreground"}const as={awaiting_approval:{label:"Waiting for approval",text:"text-warning",shell:"border-warning/40 bg-warning/5",icon:Se},awaiting_prompt:{label:"Waiting for your input",text:"text-info",shell:"border-info/40 bg-info/5",icon:Se},awaiting_question:{label:"Waiting for your answer",text:"text-info",shell:"border-info/40 bg-info/5",icon:Se},awaiting_answer:{label:"Waiting for your answer",text:"text-warning",shell:"border-warning/40 bg-warning/5",icon:Se},running:{label:"Running",text:"text-info",shell:"border-border",icon:null},done:{label:"Done",text:"text-success",shell:"border-border",icon:qt},failed:{label:"Failed",text:"text-destructive",shell:"border-destructive/40",icon:_t}};function rs(l){const e=B.c(3),{icon:t}=l;if(!t){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("span",{className:"size-2 shrink-0 rounded-full bg-info"}),e[0]=i):i=e[0],i}let n;return e[1]!==t?(n=s.jsx(t,{className:"size-3.5 shrink-0"}),e[1]=t,e[2]=n):n=e[2],n}const cs=V.memo(function(e){const t=B.c(88),{card:n,customName:i,projectLabel:r,responding:o,goneQuestions:c,compact:d,onOpen:g,onRespond:m,onAnswerQuestion:x,onAnswerElicitation:j,onChooseDialog:p}=e,u=d===void 0?!1:d,{session:a,state:h,summary:f,permissions:y,questions:v,elicitations:_,dialogs:T}=n,N=as[h],b=y[0],q=v[0],S=_[0],w=T[0],I=!!(b||q||S||w);let z;t[0]!==i||t[1]!==a?(z=it(a,i),t[0]=i,t[1]=a,t[2]=z):z=t[2];const L=z,k=u&&"gap-1.5 py-2";let R;t[3]!==N.shell||t[4]!==k?(R=ue("motion-card motion-list-item group flex min-w-0 flex-col gap-2 rounded-lg border bg-card p-3 text-left transition-colors hover:border-foreground/20",N.shell,k),t[3]=N.shell,t[4]=k,t[5]=R):R=t[5];const D=`Open session ${L}`;let A;t[6]!==r?(A=s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:r}),t[6]=r,t[7]=A):A=t[7];let E;t[8]!==f?(E=(f==null?void 0:f.model)&&s.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:lt(f.model)}),t[8]=f,t[9]=E):E=t[9];let C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(De,{"data-icon":"inline-end",className:"shrink-0 text-transparent transition-colors group-hover:text-muted-foreground"}),t[10]=C):C=t[10];let $;t[11]!==A||t[12]!==E?($=s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[A,E,C]}),t[11]=A,t[12]=E,t[13]=$):$=t[13];const O=u?"truncate":"line-clamp-2";let se;t[14]!==O?(se=ue("text-sm font-medium leading-snug text-foreground",O),t[14]=O,t[15]=se):se=t[15];let P;t[16]!==se||t[17]!==L?(P=s.jsx("span",{className:se,children:L}),t[16]=se,t[17]=L,t[18]=P):P=t[18];let ne;t[19]!==g||t[20]!==P||t[21]!==D||t[22]!==$?(ne=s.jsxs(U,{variant:"ghost",onClick:g,className:"-m-1 h-auto min-w-0 flex-col items-stretch justify-start gap-1 whitespace-normal p-1 text-left","aria-label":D,children:[$,P]}),t[19]=g,t[20]=P,t[21]=D,t[22]=$,t[23]=ne):ne=t[23];let ie;t[24]!==N.text?(ie=ue("flex items-center gap-1.5 text-xs font-medium",N.text),t[24]=N.text,t[25]=ie):ie=t[25];let le;t[26]!==N.icon?(le=s.jsx(rs,{icon:N.icon}),t[26]=N.icon,t[27]=le):le=t[27];let te;t[28]!==N.label?(te=s.jsx("span",{className:"truncate",children:N.label}),t[28]=N.label,t[29]=te):te=t[29];const ce=a.lastActivityAt||a.lastModified;let Q;t[30]!==ce?(Q=ot(ce),t[30]=ce,t[31]=Q):Q=t[31];let oe;t[32]!==Q?(oe=s.jsx("span",{className:"ml-auto shrink-0 font-mono text-xs font-normal text-muted-foreground",children:Q}),t[32]=Q,t[33]=oe):oe=t[33];let G;t[34]!==ie||t[35]!==le||t[36]!==te||t[37]!==oe?(G=s.jsxs("div",{className:ie,children:[le,te,oe]}),t[34]=ie,t[35]=le,t[36]=te,t[37]=oe,t[38]=G):G=t[38];let H;t[39]!==m||t[40]!==y.length||t[41]!==b||t[42]!==o||t[43]!==a.sessionId?(H=b&&s.jsx(Kt,{request:b,queued:y.length-1,responding:o.has(b.requestId),onRespond:(re,Y)=>m(a.sessionId,re,Y)}),t[39]=m,t[40]=y.length,t[41]=b,t[42]=o,t[43]=a.sessionId,t[44]=H):H=t[44];let K;t[45]!==w||t[46]!==p||t[47]!==b||t[48]!==o||t[49]!==a.sessionId?(K=!b&&w&&s.jsx(es,{request:w,responding:o.has(w.requestId),onChoose:(re,Y)=>p(a.sessionId,re,Y)},w.requestId),t[45]=w,t[46]=p,t[47]=b,t[48]=o,t[49]=a.sessionId,t[50]=K):K=t[50];let W;t[51]!==w||t[52]!==S||t[53]!==j||t[54]!==b||t[55]!==o||t[56]!==a.sessionId?(W=!b&&!w&&S&&s.jsx(Bt,{request:S,responding:o.has(S.requestId),onAnswer:(re,Y)=>j(a.sessionId,re,Y)},S.requestId),t[51]=w,t[52]=S,t[53]=j,t[54]=b,t[55]=o,t[56]=a.sessionId,t[57]=W):W=t[57];let X;t[58]!==w||t[59]!==S||t[60]!==c||t[61]!==x||t[62]!==g||t[63]!==q||t[64]!==b||t[65]!==o||t[66]!==a.sessionId?(X=!b&&!w&&!S&&q&&s.jsx(Zt,{request:q,responding:o.has(q.toolUseId),gone:c.has(q.toolUseId),onAnswer:(re,Y)=>x(a.sessionId,re,Y),onOpenSession:g},q.toolUseId),t[58]=w,t[59]=S,t[60]=c,t[61]=x,t[62]=g,t[63]=q,t[64]=b,t[65]=o,t[66]=a.sessionId,t[67]=X):X=t[67];let Z;t[68]!==I||t[69]!==f?(Z=!I&&(f==null?void 0:f.currentTool)&&s.jsx(ds,{tool:f.currentTool}),t[68]=I,t[69]=f,t[70]=Z):Z=t[70];let J;t[71]!==I||t[72]!==u||t[73]!==f?(J=!u&&!I&&(f==null?void 0:f.lastAssistantText)&&s.jsx("p",{className:"line-clamp-4 text-sm leading-relaxed text-muted-foreground",children:f.lastAssistantText}),t[71]=I,t[72]=u,t[73]=f,t[74]=J):J=t[74];let ee;t[75]!==f?(ee=f&&s.jsx(us,{summary:f}),t[75]=f,t[76]=ee):ee=t[76];let ae;return t[77]!==ne||t[78]!==G||t[79]!==H||t[80]!==K||t[81]!==W||t[82]!==X||t[83]!==Z||t[84]!==J||t[85]!==ee||t[86]!==R?(ae=s.jsxs("div",{className:R,children:[ne,G,H,K,W,X,Z,J,ee]}),t[77]=ne,t[78]=G,t[79]=H,t[80]=K,t[81]=W,t[82]=X,t[83]=Z,t[84]=J,t[85]=ee,t[86]=R,t[87]=ae):ae=t[87],ae});function ds(l){const e=B.c(7),{tool:t}=l;let n;e[0]!==t.name?(n=s.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:t.name}),e[0]=t.name,e[1]=n):n=e[1];let i;e[2]!==t.summary?(i=s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground/80",children:t.summary}),e[2]=t.summary,e[3]=i):i=e[3];let r;return e[4]!==n||e[5]!==i?(r=s.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md bg-muted/50 px-2.5 py-2",children:[n,i]}),e[4]=n,e[5]=i,e[6]=r):r=e[6],r}function us(l){const e=B.c(11),{summary:t}=l,n=t.filesTotal,i=t.context,r=n.count>0,o=i!==null&&i.used>0;if(!r&&!o)return null;let c;e[0]!==n.additions||e[1]!==n.count||e[2]!==n.deletions||e[3]!==r?(c=r&&s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsxs("span",{className:"truncate",children:[n.count," file",n.count===1?"":"s"]}),s.jsx(at,{add:n.additions,del:n.deletions})]}),e[0]=n.additions,e[1]=n.count,e[2]=n.deletions,e[3]=r,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==o?(d=o&&s.jsxs("span",{className:ue("ml-auto shrink-0",os(i.percent)),children:["ctx ",i.percent,"%"]}),e[5]=i,e[6]=o,e[7]=d):d=e[7];let g;return e[8]!==c||e[9]!==d?(g=s.jsxs("div",{className:"mt-auto flex items-center gap-2 border-t pt-2 font-mono text-xs text-muted-foreground",children:[c,d]}),e[8]=c,e[9]=d,e[10]=g):g=e[10],g}const fs=8e3,ms=12,xs="Start Claude Code, Codex, or Copilot and every session shows up here",hs=[{id:"all",label:"All"},{id:"running",label:"Running"},{id:"needs-you",label:"Needs you"},{id:"finished",label:"Finished"}],gs=[{id:"grid",label:"Grid layout",Icon:Ct},{id:"list",label:"List layout",Icon:Tt}];function Ns(l){const e=B.c(118),{onSelectSession:t}=l,{sessions:n,procBySession:i,newlyCompleted:r,refresh:o}=rt(),{summaries:c,loading:d,error:g,refresh:m}=Mt(),{permissionsBySession:x,questionsBySession:j,elicitationsBySession:p,dialogsBySession:u,awaitingPlan:a,responding:h,respond:f,answerQuestion:y,answerElicitation:v,answerDialog:_,refresh:T}=ct();let N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=new Set,e[0]=N):N=e[0];const[b,q]=V.useState(N),{names:S}=dt(),{names:w}=ut(),[I,z]=V.useState("all");let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=ft("mission-control-layout"),e[1]=L):L=e[1];const[k,R]=mt(L,"grid");let D;e[2]!==a||e[3]!==u||e[4]!==p||e[5]!==r||e[6]!==x||e[7]!==i||e[8]!==j||e[9]!==n||e[10]!==c?(D=ns({sessions:n,procBySession:i,summaries:c,permissionsBySession:x,questionsBySession:j,elicitationsBySession:p,dialogsBySession:u,awaitingPlan:a,newlyCompleted:r}),e[2]=a,e[3]=u,e[4]=p,e[5]=r,e[6]=x,e[7]=i,e[8]=j,e[9]=n,e[10]=c,e[11]=D):D=e[11];const A=D;let E;e[12]!==A?(E=ls(A),e[12]=A,e[13]=E):E=e[13];const C=E;let $;e[14]!==A||e[15]!==I?($=is(A,I),e[14]=A,e[15]=I,e[16]=$):$=e[16];const O=$;let se;e[17]!==T||e[18]!==o||e[19]!==m?(se=()=>{o(),m(),T()},e[17]=T,e[18]=o,e[19]=m,e[20]=se):se=e[20];const P=se;let ne,ie;e[21]!==o?(ne=()=>{const F=setInterval(()=>{document.visibilityState==="visible"&&o()},fs);return()=>clearInterval(F)},ie=[o],e[21]=o,e[22]=ne,e[23]=ie):(ne=e[22],ie=e[23]),V.useEffect(ne,ie);let le;e[24]!==y?(le=async(F,M,Me)=>{(await y(F,M,Me)).ok||q(Qe=>new Set(Qe).add(M))},e[24]=y,e[25]=le):le=e[25];const te=le;let ce;e[26]!==A.length?(ce=function(M){A.length<=ms?Ot(M,{kind:"fade"}):V.startTransition(M)},e[26]=A.length,e[27]=ce):ce=e[27];const Q=ce;let oe;e[28]===Symbol.for("react.memo_cache_sentinel")?(oe=s.jsx("h2",{className:"truncate text-sm font-semibold",children:"Mission Control"}),e[28]=oe):oe=e[28];let G;e[29]!==C.total?(G=s.jsx(Te,{variant:"secondary",children:C.total}),e[29]=C.total,e[30]=G):G=e[30];let H;e[31]!==C.needsYou?(H=C.needsYou>0&&s.jsxs(Te,{variant:"outline",className:"border-warning/40 text-warning",children:[C.needsYou," need you"]}),e[31]=C.needsYou,e[32]=H):H=e[32];let K;e[33]!==C.failed?(K=C.failed>0&&s.jsxs(Te,{variant:"destructive",children:[C.failed," failed"]}),e[33]=C.failed,e[34]=K):K=e[34];let W;e[35]!==G||e[36]!==H||e[37]!==K?(W=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[oe,G,H,K]}),e[35]=G,e[36]=H,e[37]=K,e[38]=W):W=e[38];let X;e[39]!==I?(X=[I],e[39]=I,e[40]=X):X=e[40];let Z;e[41]!==I||e[42]!==Q?(Z=F=>{const M=F.at(-1);M&&M!==I&&Q(()=>z(M))},e[41]=I,e[42]=Q,e[43]=Z):Z=e[43];let J;e[44]!==C.needsYou?(J=hs.map(F=>s.jsxs(ke,{value:F.id,"aria-label":`Show ${F.label.toLowerCase()} sessions`,children:[F.label,F.id==="needs-you"&&C.needsYou>0&&s.jsx("span",{className:"font-mono text-warning",children:C.needsYou})]},F.id)),e[44]=C.needsYou,e[45]=J):J=e[45];let ee;e[46]!==X||e[47]!==Z||e[48]!==J?(ee=s.jsx(ze,{value:X,onValueChange:Z,variant:"outline",size:"sm",spacing:0,"aria-label":"Filter sessions",children:J}),e[46]=X,e[47]=Z,e[48]=J,e[49]=ee):ee=e[49];let ae;e[50]!==k||e[51]!==R||e[52]!==Q?(ae=gs.map(F=>{const{id:M,label:Me,Icon:Oe}=F;return s.jsx(U,{variant:"ghost",size:"icon-xs","aria-label":Me,"aria-pressed":k===M,onClick:()=>{M!==k&&Q(()=>R(M))},className:ue(k===M&&"bg-accent text-accent-foreground"),children:s.jsx(Oe,{"data-icon":"inline-start"})},M)}),e[50]=k,e[51]=R,e[52]=Q,e[53]=ae):ae=e[53];const re=d&&"animate-spin";let Y;e[54]!==re?(Y=ue(re),e[54]=re,e[55]=Y):Y=e[55];let fe;e[56]!==Y?(fe=s.jsx(At,{"data-icon":"inline-start",className:Y}),e[56]=Y,e[57]=fe):fe=e[57];let me;e[58]!==P||e[59]!==fe?(me=s.jsx(U,{variant:"ghost",size:"icon-xs","aria-label":"Refresh Mission Control",onClick:P,children:fe}),e[58]=P,e[59]=fe,e[60]=me):me=e[60];let xe;e[61]!==ae||e[62]!==me?(xe=s.jsxs("div",{className:"flex items-center gap-1",children:[ae,me]}),e[61]=ae,e[62]=me,e[63]=xe):xe=e[63];let he;e[64]!==ee||e[65]!==xe?(he=s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[ee,xe]}),e[64]=ee,e[65]=xe,e[66]=he):he=e[66];let ge;e[67]!==W||e[68]!==he?(ge=s.jsxs("header",{className:"flex min-h-12 shrink-0 flex-wrap items-center gap-3 border-b px-4 py-2",children:[W,he]}),e[67]=W,e[68]=he,e[69]=ge):ge=e[69];let pe;e[70]!==g||e[71]!==P?(pe=g&&s.jsxs(qe,{variant:"destructive",className:"mb-4",children:[s.jsx(Et,{}),s.jsx(_e,{children:"Mission Control could not refresh"}),s.jsx(wt,{className:"truncate",children:g}),s.jsx(vt,{children:s.jsx(U,{variant:"outline",size:"xs",onClick:P,children:"Retry"})})]}),e[70]=g,e[71]=P,e[72]=pe):pe=e[72];let be;e[73]!==A.length||e[74]!==I||e[75]!==d||e[76]!==O.length?(be=O.length===0&&!d&&s.jsx(xt,{className:"min-h-64",children:s.jsxs(ht,{children:[s.jsx(gt,{variant:"icon",children:s.jsx(kt,{})}),s.jsx(pt,{children:A.length===0?"No live sessions":`Nothing matches "${I}"`}),s.jsx(bt,{children:A.length===0?xs:"Try a different filter."})]})}),e[73]=A.length,e[74]=I,e[75]=d,e[76]=O.length,e[77]=be):be=e[77];let je;e[78]!==A.length||e[79]!==d||e[80]!==O.length?(je=O.length===0&&d&&A.length===0&&s.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-sm text-muted-foreground",children:[s.jsx(jt,{}),"Loading sessions…"]}),e[78]=A.length,e[79]=d,e[80]=O.length,e[81]=je):je=e[81];const Re=k==="grid"&&"md:grid-cols-2 2xl:grid-cols-3";let we;e[82]!==Re?(we=ue("grid grid-cols-1 gap-3",Re),e[82]=Re,e[83]=we):we=e[83];let ve;if(e[84]!==_||e[85]!==v||e[86]!==b||e[87]!==te||e[88]!==k||e[89]!==t||e[90]!==w||e[91]!==f||e[92]!==h||e[93]!==S||e[94]!==O){let F;e[96]!==_||e[97]!==v||e[98]!==b||e[99]!==te||e[100]!==k||e[101]!==t||e[102]!==w||e[103]!==f||e[104]!==h||e[105]!==S?(F=M=>s.jsx(cs,{card:M,compact:k==="list",customName:S[M.session.sessionId],projectLabel:w[M.session.dirName]??Nt(M.session),responding:h,goneQuestions:b,onOpen:()=>t(M.session.dirName,M.session.fileName),onRespond:f,onAnswerQuestion:te,onAnswerElicitation:v,onChooseDialog:_},M.session.sessionId),e[96]=_,e[97]=v,e[98]=b,e[99]=te,e[100]=k,e[101]=t,e[102]=w,e[103]=f,e[104]=h,e[105]=S,e[106]=F):F=e[106],ve=O.map(F),e[84]=_,e[85]=v,e[86]=b,e[87]=te,e[88]=k,e[89]=t,e[90]=w,e[91]=f,e[92]=h,e[93]=S,e[94]=O,e[95]=ve}else ve=e[95];let Ne;e[107]!==we||e[108]!==ve?(Ne=s.jsx("div",{className:we,children:ve}),e[107]=we,e[108]=ve,e[109]=Ne):Ne=e[109];let ye;e[110]!==pe||e[111]!==be||e[112]!==je||e[113]!==Ne?(ye=s.jsx(yt,{className:"flex-1",children:s.jsxs("div",{className:"p-4",children:[pe,be,je,Ne]})}),e[110]=pe,e[111]=be,e[112]=je,e[113]=Ne,e[114]=ye):ye=e[114];let Ce;return e[115]!==ge||e[116]!==ye?(Ce=s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ge,ye]}),e[115]=ge,e[116]=ye,e[117]=Ce):Ce=e[117],Ce}export{Ns as MissionControl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as u,c as ye,j as n}from"./vendor-react-gGw_S5I_.js";import{w as nt,bt as st,bu as Zt,_ as He,E as ft,y as dt,H as et,z as mt,G as ht,au as Qt,B as ae,bv as Mt,a$ as it,n as en,I as tn,W as nn,m as sn,b5 as Bt,b6 as Ft,b4 as Pt,bw as Ve,bx as ln,by as rn,a4 as on,bz as an,bA as cn,bB as un,bC as fn,bD as dn,i as Ut,j as $t,k as zt,aW as gt,X as mn,V as bt,U as hn,bE as Kt,aF as Yt,h as Ht,D as Gt,a9 as xn,aa as pn,ab as gn,ac as bn,ad as wn,ae as yn,af as jn,ag as Sn,ah as kn,a5 as Nn,al as Xt,$ as wt,bq as yt,bF as Cn}from"./index-CdXCbj1g.js";import{a3 as En,o as Wt,J as Jt,A as Tn,h as xt,aw as _n,X as tt,ax as vn,ay as Dn,az as Rn,c as In,aA as On,j as jt,a1 as An,P as Ln,N as Vt,aB as Mn}from"./vendor-ui-CevbH8m5.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const Je="/api/browser",Bn=5e3,Fn="all";function qe(s,e=""){return`${Je}/sessions/${encodeURIComponent(s)}${e}`}function Ze(s){return{headers:{"content-type":"application/json"},body:JSON.stringify(s)}}function lt(s,e){return s instanceof Error&&s.message?s.message:e}async function ct(s){try{const e=await s.json();return e&&typeof e=="object"?e:null}catch{return null}}async function rt(s,e){const t=await ct(s);return typeof(t==null?void 0:t.error)=="string"&&t.error?t.error:e}function Pn(s){const[e,t]=u.useState(null),[l,a]=u.useState(!1),[i,o]=u.useState(null),f=u.useRef(!1),m=u.useRef(0),x=u.useRef(!1);u.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const w=u.useCallback(async()=>{const c=++m.current;x.current=!0,a(!0);try{const d=await nt(st(Je)),y=d.ok?await d.json():null;if(!f.current||c!==m.current)return;y?(t(h=>JSON.stringify(h)===JSON.stringify(y)?h:y),o(null)):o(await rt(d,`Could not read the browser list (${d.status})`))}catch(d){f.current&&c===m.current&&o(lt(d,"Could not read the browser list"))}finally{c===m.current&&(x.current=!1,f.current&&a(!1))}},[]);u.useEffect(()=>{if(!s)return;w();const c=setInterval(()=>{x.current||w()},Bn);return()=>clearInterval(c)},[s,w]);const C=u.useCallback(async(c,d,y)=>{let h;try{h=await nt(st(c),d)}catch(U){return{ok:!1,error:lt(U,y)}}if(!h.ok)return{ok:!1,error:await rt(h,y)};const X=await ct(h);return w(),{ok:!0,data:X}},[w]),j=u.useCallback(async(c,d,y)=>{const h=await C(c,d,y);return h.ok?{ok:!0}:h},[C]),k=u.useCallback((c,d)=>j(`${Je}/sessions`,{method:"POST",...Ze({name:c,note:d})},`Could not create ${c}`),[j]),_=u.useCallback(c=>j(qe(c),{method:"DELETE"},`Could not delete ${c}`),[j]),E=u.useCallback((c,d)=>j(qe(c,"/launch"),{method:"POST",...Ze(d?{url:d}:{})},`Could not open ${c}`),[j]),p=u.useCallback(c=>j(qe(c,"/stop"),{method:"POST"},`Could not stop ${c}`),[j]),R=u.useCallback((c,d)=>j(qe(c),{method:"PATCH",...Ze({note:d})},`Could not save the note for ${c}`),[j]),T=u.useCallback(async()=>{const c="Could not read where the browser skill is installed";let d;try{d=await nt(st(`${Je}/skill`))}catch(h){return{ok:!1,error:lt(h,c)}}if(!d.ok)return{ok:!1,error:await rt(d,c)};const y=await ct(d);return Array.isArray(y==null?void 0:y.targets)?{ok:!0,targets:y.targets}:{ok:!1,error:c}},[]),F=u.useCallback(async c=>{const d="Could not install the browser skill",y=await C(`${Je}/skill/install`,{method:"POST",...Ze({target:c})},d);if(!y.ok)return y;const{paths:h}=y.data??{};return Array.isArray(h)&&h.every(X=>typeof X=="string")?{ok:!0,paths:h}:{ok:!1,error:d}},[C]);return{status:e,loading:l,error:i,refresh:w,create:k,remove:_,launch:E,stop:p,setNote:R,readSkillTargets:T,installSkill:F}}const ot=4;new TextEncoder;const Un=new TextDecoder;function $n(s){if(s.byteLength<ot)throw new Error("Frame truncated before header length");const e=new DataView(s.buffer,s.byteOffset,s.byteLength).getUint32(0),t=ot+e;if(s.byteLength<t)throw new Error("Frame truncated inside header");return{header:zn(Un.decode(s.subarray(ot,t))),jpeg:s.subarray(t)}}function zn(s){let e;try{e=JSON.parse(s)}catch{throw new Error("Frame header is not valid JSON")}if(typeof e!="object"||e===null)throw new Error("Frame header is not an object");const{deviceWidth:t,deviceHeight:l,pageScaleFactor:a,offsetTop:i,scrollOffsetX:o,scrollOffsetY:f,targetId:m,ts:x}=e;if(typeof t!="number"||typeof l!="number"||typeof a!="number"||typeof i!="number"||typeof o!="number"||typeof f!="number"||typeof m!="string"||typeof x!="number")throw new Error("Frame header is missing fields");return{deviceWidth:t,deviceHeight:l,pageScaleFactor:a,offsetTop:i,scrollOffsetX:o,scrollOffsetY:f,targetId:m,ts:x}}const St=500,Kn=5e3,kt=[];function Yn(s){const e=window.location.protocol==="https:"?"wss:":"ws:",t=Zt();return`${e}//${window.location.host}${t}/__browser?session=${encodeURIComponent(s)}`}function Hn(s){try{return JSON.parse(s)}catch{return null}}function Gn(s,e){return s.state===e.state&&s.session===e.session&&s.message===e.message}function Xn(s,e){return s.targetId===e.targetId&&s.url===e.url&&s.title===e.title&&s.canGoBack===e.canGoBack&&s.canGoForward===e.canGoForward}function Wn(s,e){return s.length===e.length&&s.every((t,l)=>t.targetId===e[l].targetId&&t.url===e[l].url&&t.title===e[l].title)}function ut(s){var e;s&&((e=s.bitmap)==null||e.close(),s.blobUrl&&URL.revokeObjectURL(s.blobUrl))}function Jn(s){const e=ye.c(13),[t,l]=u.useState("idle"),[a,i]=u.useState(null),[o,f]=u.useState(null),[m,x]=u.useState(kt),[w,C]=u.useState(null),[j,k]=u.useState(null),[_,E]=u.useState(null),[p,R]=u.useState(null),T=u.useRef(null),F=u.useRef(null),c=u.useRef(null);let d,y;e[0]!==s?(d=()=>{if(i(null),f(null),x(kt),C(null),R(null),k(null),E(null),s===null){l("idle");return}const G=s,b={alive:!0,issued:0,applied:0};let B=St;const K=function(N,S){if(!b.alive||S<=b.applied){ut(N);return}b.applied=S,F.current=N,k(N),E(Date.now())},$=function(N){let S,v;try{const J=$n(new Uint8Array(N));S=J.header,v=new Blob([J.jpeg],{type:"image/jpeg"})}catch{return}const z=b.issued=b.issued+1;if(typeof createImageBitmap!="function"){K({bitmap:null,blobUrl:URL.createObjectURL(v),header:S},z);return}createImageBitmap(v).then(J=>K({bitmap:J,blobUrl:null,header:S},z),Vn)},M=function(N){const S=Hn(N);if(S)e:switch(S.type){case"status":{i(v=>v&&Gn(v,S)?v:S),R(null);break e}case"page":{f(v=>v&&Xn(v,S)?v:S);break e}case"tabs":{x(v=>Wn(v,S.tabs)?v:S.tabs),C(S.followed);break e}case"error":R(S.message)}};function A(){if(!b.alive)return;const O=T.current;if(O&&O.readyState!==WebSocket.CLOSED)return;l("connecting");const N=new WebSocket(Yn(G));N.binaryType="arraybuffer",T.current=N,N.onopen=()=>{if(!b.alive){N.close();return}B=St,l("connected")},N.onmessage=S=>{b.alive&&(typeof S.data=="string"?M(S.data):S.data instanceof ArrayBuffer&&$(S.data))},N.onclose=()=>{if(!b.alive)return;T.current=null,l("disconnected");const S=B;B=Math.min(B*2,Kn),c.current=setTimeout(A,S)}}return A(),()=>{b.alive=!1,c.current&&(clearTimeout(c.current),c.current=null);const O=T.current;T.current=null,O&&(O.onclose=null,O.close()),ut(F.current),F.current=null}},y=[s],e[0]=s,e[1]=d,e[2]=y):(d=e[1],y=e[2]),u.useEffect(d,y);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=G=>{const b=T.current;b&&b.readyState===WebSocket.OPEN&&b.send(JSON.stringify(G))},e[3]=h):h=e[3];const X=h;let U;return e[4]!==p||e[5]!==w||e[6]!==j||e[7]!==_||e[8]!==o||e[9]!==a||e[10]!==t||e[11]!==m?(U={status:t,state:a,page:o,tabs:m,followed:w,frame:j,lastFrameAt:_,error:p,send:X},e[4]=p,e[5]=w,e[6]=j,e[7]=_,e[8]=o,e[9]=a,e[10]=t,e[11]=m,e[12]=U):U=e[12],U}function Vn(){}const qn=6e3;function Zn(s){const e=ye.c(16),{activity:t}=s,[l,a]=u.useState(!0),i=t?`${t.toolCallId}:${t.done}`:null;let o,f;if(e[0]!==i?(o=()=>{if(i===null)return;a(!0);const p=setTimeout(()=>a(!1),qn);return()=>clearTimeout(p)},f=[i],e[0]=i,e[1]=o,e[2]=f):(o=e[1],f=e[2]),u.useEffect(o,f),!t)return null;const m=l?"opacity-100":"opacity-0";let x;e[3]!==m?(x=He("pointer-events-none absolute inset-x-0 bottom-0 flex justify-center px-2 pb-6 pt-8","bg-gradient-to-t from-transparent via-background/70 to-transparent","transition-opacity duration-700 motion-reduce:transition-none",m),e[3]=m,e[4]=x):x=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(En,{"aria-hidden":!0,className:"size-3.5 shrink-0 text-muted-foreground"}),e[5]=w):w=e[5];let C;e[6]!==t.command?(C=n.jsx("code",{className:"min-w-0 truncate font-mono text-[11px]",children:t.command}),e[6]=t.command,e[7]=C):C=e[7];const j=t.done?"ran":"running";let k;e[8]!==j?(k=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:j}),e[8]=j,e[9]=k):k=e[9];let _;e[10]!==C||e[11]!==k?(_=n.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-full bg-background/85 px-3 py-1 text-xs shadow-xs backdrop-blur-sm",children:[w,C,k]}),e[10]=C,e[11]=k,e[12]=_):_=e[12];let E;return e[13]!==x||e[14]!==_?(E=n.jsx("div",{className:x,children:_}),e[13]=x,e[14]=_,e[15]=E):E=e[15],E}const Nt="npm i -g agent-browser && agent-browser install",Qn=1500;function at(s){const e=ye.c(10);if(s.kind==="unsupported"){let l,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(mt,{variant:"icon",children:n.jsx(Wt,{})}),a=n.jsx(ht,{children:"Browser panel unavailable"}),e[0]=l,e[1]=a):(l=e[0],a=e[1]);let i;return e[2]!==s.message?(i=n.jsx(ft,{className:"size-full",children:n.jsxs(dt,{children:[l,a,n.jsx(et,{children:s.message})]})}),e[2]=s.message,e[3]=i):i=e[3],i}let t;return e[4]!==s.kind||e[5]!==s.lastUrl||e[6]!==s.name||e[7]!==s.onOpen||e[8]!==s.onOpenSkill?(t=s.kind==="not-installed"?n.jsx(es,{onOpenSkill:s.onOpenSkill}):n.jsx(ts,{name:s.name,lastUrl:s.lastUrl,onOpen:s.onOpen}),e[4]=s.kind,e[5]=s.lastUrl,e[6]=s.name,e[7]=s.onOpen,e[8]=s.onOpenSkill,e[9]=t):t=e[9],t}function es(s){const e=ye.c(20),{onOpenSkill:t}=s,[l,a]=u.useState(!1),i=u.useRef(null);let o,f;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>()=>{i.current&&clearTimeout(i.current)},f=[],e[0]=o,e[1]=f):(o=e[0],f=e[1]),u.useEffect(o,f);let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=async function(){await Qt(Nt)&&(a(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>a(!1),Qn))},e[2]=m):m=e[2];const x=m;let w,C;e[3]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(mt,{variant:"icon",children:n.jsx(Wt,{})}),C=n.jsx(ht,{children:"Nothing to show yet"}),e[3]=w,e[4]=C):(w=e[3],C=e[4]);let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsxs(dt,{children:[w,C,n.jsxs(et,{children:["This panel streams a real browser the agent drives. That takes the"," ",n.jsx("code",{className:"font-mono",children:"agent-browser"})," command, which is not on this machine yet."]})]}),e[5]=j):j=e[5];let k;e[6]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:Nt}),e[6]=k):k=e[6];const _=l?"Copied":"Copy install command";let E;e[7]===Symbol.for("react.memo_cache_sentinel")?(E=()=>void x(),e[7]=E):E=e[7];let p;e[8]!==l?(p=l?n.jsx(Jt,{"data-icon":"inline-start",className:"text-emerald-500"}):n.jsx(Tn,{"data-icon":"inline-start"}),e[8]=l,e[9]=p):p=e[9];let R;e[10]!==p||e[11]!==_?(R=n.jsxs("div",{className:"flex w-full items-center gap-1.5 rounded-md border bg-muted/40 py-1 pl-2.5 pr-1 text-left",children:[k,n.jsx(ae,{variant:"ghost",size:"icon-xs","aria-label":_,onClick:E,children:p})]}),e[10]=p,e[11]=_,e[12]=R):R=e[12];let T;e[13]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(xt,{"data-icon":"inline-start"}),e[13]=T):T=e[13];let F;e[14]!==t?(F=n.jsxs(ae,{variant:"outline",size:"sm",onClick:t,children:[T,"Install the agent skill…"]}),e[14]=t,e[15]=F):F=e[15];let c;e[16]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(et,{className:"text-xs",children:"The skill teaches the agent when to use a named browser and how this panel follows along. Installing writes it into your home directory, so it is never done for you."}),e[16]=c):c=e[16];let d;return e[17]!==R||e[18]!==F?(d=n.jsxs(ft,{className:"size-full",children:[j,n.jsxs(Mt,{children:[R,F,c]})]}),e[17]=R,e[18]=F,e[19]=d):d=e[19],d}function ts(s){const e=ye.c(23),{name:t,lastUrl:l,onOpen:a}=s,[i,o]=u.useState(null),f=i??l??"";let m;e[0]!==a||e[1]!==f?(m=function(y){y.preventDefault();const h=f.trim();h&&a(h)},e[0]=a,e[1]=f,e[2]=m):m=e[2];const x=m;let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(mt,{variant:"icon",children:n.jsx(_n,{})}),e[3]=w):w=e[3];let C;e[4]!==t?(C=n.jsxs(ht,{children:[t," isn’t running"]}),e[4]=t,e[5]=C):C=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(et,{children:"The agent opens it by itself the moment it browses. You can also open a page here and watch from the start."}),e[6]=j):j=e[6];let k;e[7]!==C?(k=n.jsxs(dt,{children:[w,C,j]}),e[7]=C,e[8]=k):k=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=d=>o(d.target.value),e[9]=_):_=e[9];let E;e[10]!==f?(E=n.jsx(it,{"aria-label":"Page to open",className:"h-8 text-sm",placeholder:"example.com",spellCheck:!1,autoComplete:"off",value:f,onChange:_}),e[10]=f,e[11]=E):E=e[11];let p;e[12]!==f?(p=f.trim(),e[12]=f,e[13]=p):p=e[13];const R=!p;let T;e[14]!==R?(T=n.jsx(ae,{type:"submit",size:"sm",disabled:R,children:"Open"}),e[14]=R,e[15]=T):T=e[15];let F;e[16]!==x||e[17]!==T||e[18]!==E?(F=n.jsx(Mt,{children:n.jsxs("form",{className:"flex w-full items-center gap-2",onSubmit:x,children:[E,T]})}),e[16]=x,e[17]=T,e[18]=E,e[19]=F):F=e[19];let c;return e[20]!==F||e[21]!==k?(c=n.jsxs(ft,{className:"size-full",children:[k,F]}),e[20]=F,e[21]=k,e[22]=c):c=e[22],c}function Ct(s){if(s.url==="about:blank"&&(!s.title.trim()||s.title==="about:blank"))return"New tab";if(s.title.trim())return s.title.trim();try{return new URL(s.url).hostname||s.url}catch{return s.url}}const ns={live:{label:"LIVE",hint:"Streaming the page as it changes",tone:"text-emerald-600 dark:text-emerald-400",dot:"bg-emerald-500"},idle:{label:"IDLE",hint:"The page has not changed for a few seconds",tone:"text-muted-foreground",dot:"ring-1 ring-muted-foreground/50 ring-inset"},offline:{label:"OFFLINE",hint:"The connection dropped — this is the last frame that arrived",tone:"text-amber-600 dark:text-amber-400",dot:"bg-amber-500"}};function ss(s){const e=ye.c(17),{status:t}=s,l=ns[t];let a;e[0]!==l.tone?(a=He("ml-1 flex shrink-0 cursor-default items-center gap-1 text-[10px] font-medium tracking-wide",l.tone),e[0]=l.tone,e[1]=a):a=e[1];let i;e[2]!==a?(i=n.jsx("span",{className:a}),e[2]=a,e[3]=i):i=e[3];let o;e[4]!==l.dot?(o=He("size-1.5 rounded-full",l.dot),e[4]=l.dot,e[5]=o):o=e[5];let f;e[6]!==o?(f=n.jsx("span",{"aria-hidden":"true",className:o}),e[6]=o,e[7]=f):f=e[7];let m;e[8]!==l.label||e[9]!==i||e[10]!==f?(m=n.jsxs(Bt,{render:i,children:[f,l.label]}),e[8]=l.label,e[9]=i,e[10]=f,e[11]=m):m=e[11];let x;e[12]!==l.hint?(x=n.jsx(Ft,{children:l.hint}),e[12]=l.hint,e[13]=x):x=e[13];let w;return e[14]!==m||e[15]!==x?(w=n.jsxs(Pt,{children:[m,x]}),e[14]=m,e[15]=x,e[16]=w):w=e[16],w}const ls=u.memo(function(e){const t=ye.c(49),{page:l,tabs:a,followed:i,status:o,onNavigate:f,onBack:m,onForward:x,onReload:w,onFollow:C,onCloseTab:j}=e,[k,_]=u.useState(null),E=(l==null?void 0:l.url)??"";let p;t[0]!==k||t[1]!==E||t[2]!==f?(p=function(V){V.preventDefault();const ie=(k??E).trim();_(null),ie&&f(ie)},t[0]=k,t[1]=E,t[2]=f,t[3]=p):p=t[3];const R=p;let T;t[4]===Symbol.for("react.memo_cache_sentinel")?(T=function(V){V.key==="Escape"&&(V.preventDefault(),_(null),V.currentTarget.blur())},t[4]=T):T=t[4];const F=T,c=!(l!=null&&l.canGoBack);let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(vn,{"data-icon":"inline-start"}),t[5]=d):d=t[5];let y;t[6]!==m||t[7]!==c?(y=n.jsx(ae,{variant:"ghost",size:"icon-sm","aria-label":"Back",disabled:c,onClick:m,children:d}),t[6]=m,t[7]=c,t[8]=y):y=t[8];const h=!(l!=null&&l.canGoForward);let X;t[9]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(Dn,{"data-icon":"inline-start"}),t[9]=X):X=t[9];let U;t[10]!==x||t[11]!==h?(U=n.jsx(ae,{variant:"ghost",size:"icon-sm","aria-label":"Forward",disabled:h,onClick:x,children:X}),t[10]=x,t[11]=h,t[12]=U):U=t[12];const G=!l;let b;t[13]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Rn,{"data-icon":"inline-start"}),t[13]=b):b=t[13];let B;t[14]!==w||t[15]!==G?(B=n.jsx(ae,{variant:"ghost",size:"icon-sm","aria-label":"Reload",disabled:G,onClick:w,children:b}),t[14]=w,t[15]=G,t[16]=B):B=t[16];const K=k??E;let $;t[17]===Symbol.for("react.memo_cache_sentinel")?($=Y=>_(Y.target.value),t[17]=$):$=t[17];let M;t[18]===Symbol.for("react.memo_cache_sentinel")?(M=()=>_(null),t[18]=M):M=t[18];let A;t[19]!==K?(A=n.jsx(en,{"aria-label":"Page URL",className:"text-xs",placeholder:"Enter a URL",spellCheck:!1,autoComplete:"off",value:K,onChange:$,onFocus:rs,onBlur:M,onKeyDown:F}),t[19]=K,t[20]=A):A=t[20];const O=!E;let N;t[21]!==E?(N=()=>window.open(E,"_blank","noopener,noreferrer"),t[21]=E,t[22]=N):N=t[22];let S;t[23]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(In,{"data-icon":"inline-start"}),t[23]=S):S=t[23];let v;t[24]!==O||t[25]!==N?(v=n.jsx(tn,{align:"inline-end",children:n.jsx(nn,{size:"icon-xs","aria-label":"Open in your browser",disabled:O,onClick:N,children:S})}),t[24]=O,t[25]=N,t[26]=v):v=t[26];let z;t[27]!==A||t[28]!==v?(z=n.jsxs(sn,{className:"h-7",children:[A,v]}),t[27]=A,t[28]=v,t[29]=z):z=t[29];let J;t[30]!==R||t[31]!==z?(J=n.jsx("form",{className:"ml-1 min-w-0 flex-1",onSubmit:R,children:z}),t[30]=R,t[31]=z,t[32]=J):J=t[32];let ne;t[33]!==o?(ne=o&&n.jsx(ss,{status:o}),t[33]=o,t[34]=ne):ne=t[34];let D;t[35]!==B||t[36]!==J||t[37]!==ne||t[38]!==y||t[39]!==U?(D=n.jsxs("div",{className:"flex items-center gap-0.5",children:[y,U,B,J,ne]}),t[35]=B,t[36]=J,t[37]=ne,t[38]=y,t[39]=U,t[40]=D):D=t[40];let ee;t[41]!==i||t[42]!==j||t[43]!==C||t[44]!==a?(ee=a.length>0&&n.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-0.5",children:a.map(Y=>n.jsxs("div",{className:He("flex max-w-48 shrink-0 items-center rounded-md",Y.targetId===i&&"bg-secondary"),children:[n.jsx(ae,{size:"xs",variant:"ghost",className:"min-w-0 shrink rounded-r-none","aria-current":Y.targetId===i?"page":void 0,title:Y.title||Y.url,onClick:()=>C(Y.targetId),onMouseDown:os,onAuxClick:V=>{V.button===1&&(V.preventDefault(),j(Y.targetId))},children:n.jsx("span",{className:"truncate",children:Ct(Y)})}),n.jsx(ae,{size:"icon-xs",variant:"ghost",className:"rounded-l-none","aria-label":`Close tab: ${Ct(Y)}`,title:"Close tab",onClick:()=>j(Y.targetId),children:n.jsx(tt,{"data-icon":"inline-start"})})]},Y.targetId))}),t[41]=i,t[42]=j,t[43]=C,t[44]=a,t[45]=ee):ee=t[45];let ue;return t[46]!==D||t[47]!==ee?(ue=n.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-b px-2 py-1.5",children:[D,ee]}),t[46]=D,t[47]=ee,t[48]=ue):ue=t[48],ue});function rs(s){return s.target.select()}function os(s){s.button===1&&s.preventDefault()}const Qe="default",as=/^[a-z0-9][a-z0-9_-]{0,39}$/,is="Lowercase letters, numbers, - and _, starting with a letter or number (40 max).",cs=10080*60*1e3;function us(s){if(!s)return null;const e=new Date(s).getTime();if(Number.isNaN(e))return null;if(Date.now()-e>=cs)return new Date(e).toLocaleDateString();const t=Nn(s);return t==="now"?"just now":`${t} ago`}function Et(s){const e=ye.c(5),{running:t,className:l}=s,a=t?"bg-emerald-500":"ring-1 ring-muted-foreground/50 ring-inset";let i;e[0]!==l||e[1]!==a?(i=He("size-2 shrink-0 rounded-full",a,l),e[0]=l,e[1]=a,e[2]=i):i=e[2];let o;return e[3]!==i?(o=n.jsx("span",{"aria-hidden":"true",className:i}),e[3]=i,e[4]=o):o=e[4],o}const fs=u.memo(function(e){const t=ye.c(126),{sessions:l,selected:a,currentSessionId:i,followAgent:o,busy:f,onSelect:m,onToggleFollow:x,onOpenSkill:w,onCreate:C,onRemove:j,onStop:k,onShowDefault:_,onClose:E}=e,p=f===void 0?!1:f,R=u.useId(),T=u.useId(),[F,c]=u.useState(!1),[d,y]=u.useState(""),[h,X]=u.useState(""),[U,G]=u.useState(null),[b,B]=u.useState(!1),[K,$]=u.useState(null),M=a===Qe;let A;t[0]!==a||t[1]!==l?(A=l.find(Q=>Q.name===a)??null,t[0]=a,t[1]=l,t[2]=A):A=t[2];const O=A;let N,S;t[3]!==d?(S=d.trim(),N=S.length>0&&!as.test(S),t[3]=d,t[4]=N,t[5]=S):(N=t[4],S=t[5]);const v=N,z=v?is:U,J=S.length>0&&!v&&!b;let ne;t[6]===Symbol.for("react.memo_cache_sentinel")?(ne=function(){y(""),X(""),G(null),B(!1),c(!0)},t[6]=ne):ne=t[6];const D=ne;let ee;t[7]!==J||t[8]!==h||t[9]!==C||t[10]!==m||t[11]!==S?(ee=async function(){if(!J)return;B(!0);const Me=await C(S,h.trim());if(B(!1),!Me.ok){G(Me.error);return}c(!1),m(S)},t[7]=J,t[8]=h,t[9]=C,t[10]=m,t[11]=S,t[12]=ee):ee=t[12];const ue=ee,Y=!M&&"border-amber-500/40 bg-amber-500/10";let V;t[13]!==Y?(V=He("@container/browser-bar flex h-10 shrink-0 items-center gap-2 border-b px-2",Y),t[13]=Y,t[14]=V):V=t[14];let ie;t[15]===Symbol.for("react.memo_cache_sentinel")?(ie=n.jsx(ae,{variant:"ghost",size:"xs","aria-label":"Switch browser",className:"max-w-40"}),t[15]=ie):ie=t[15];const Be=(O==null?void 0:O.running)??!1;let fe;t[16]!==Be?(fe=n.jsx(Et,{running:Be}),t[16]=Be,t[17]=fe):fe=t[17];let je;t[18]!==a?(je=n.jsx("span",{className:"truncate",children:a}),t[18]=a,t[19]=je):je=t[19];let Se;t[20]===Symbol.for("react.memo_cache_sentinel")?(Se=n.jsx(An,{"data-icon":"inline-end",className:"opacity-60"}),t[20]=Se):Se=t[20];let ke;t[21]!==fe||t[22]!==je?(ke=n.jsxs(ln,{render:ie,children:[fe,je,Se]}),t[21]=fe,t[22]=je,t[23]=ke):ke=t[23];let de;t[24]!==m?(de=Q=>m(Q),t[24]=m,t[25]=de):de=t[25];let Ne;if(t[26]!==i||t[27]!==l){let Q;t[29]!==i?(Q=Me=>{const pt=us(Me.lastUsedAt),qt=Me.driverSessionId!==null&&Me.driverSessionId!==i;return n.jsxs(rn,{value:Me.name,className:"items-start py-1.5",children:[n.jsx(Et,{running:Me.running,className:"mt-[0.4rem]"}),n.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n.jsx("span",{className:"truncate",children:Me.name}),n.jsx("span",{className:"sr-only",children:Me.running?"running":"stopped"}),Me.isDefault&&n.jsx(on,{variant:"secondary",className:"h-4 px-1.5 text-[0.65rem] font-normal",children:"Default"}),pt&&n.jsx("span",{className:"ml-auto shrink-0 text-xs text-muted-foreground",children:pt})]}),qt&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:"driven by another session"})]})]},Me.name)},t[29]=i,t[30]=Q):Q=t[30],Ne=l.map(Q),t[26]=i,t[27]=l,t[28]=Ne}else Ne=t[28];let me;t[31]!==a||t[32]!==de||t[33]!==Ne?(me=n.jsx(an,{value:a,onValueChange:de,children:Ne}),t[31]=a,t[32]=de,t[33]=Ne,t[34]=me):me=t[34];let Le;t[35]===Symbol.for("react.memo_cache_sentinel")?(Le=n.jsx(cn,{}),t[35]=Le):Le=t[35];let Ce;t[36]===Symbol.for("react.memo_cache_sentinel")?(Ce=n.jsx(Ln,{}),t[36]=Ce):Ce=t[36];let pe;t[37]!==p?(pe=n.jsxs(Ve,{disabled:p,onClick:D,children:[Ce,"New browser…"]}),t[37]=p,t[38]=pe):pe=t[38];let Ee;t[39]===Symbol.for("react.memo_cache_sentinel")?(Ee=n.jsx(xt,{}),t[39]=Ee):Ee=t[39];let ge;t[40]!==w?(ge=n.jsxs(Ve,{onClick:w,children:[Ee,"Agent skill…"]}),t[40]=w,t[41]=ge):ge=t[41];let he;t[42]!==p||t[43]!==M||t[44]!==k||t[45]!==a||t[46]!==(O==null?void 0:O.running)?(he=!M&&n.jsxs(n.Fragment,{children:[n.jsxs(Ve,{disabled:p||!(O!=null&&O.running),onClick:()=>k(a),children:[n.jsx(On,{}),"Stop"]}),n.jsxs(Ve,{variant:"destructive",disabled:p,onClick:()=>$(a),children:[n.jsx(jt,{}),"Delete…"]})]}),t[42]=p,t[43]=M,t[44]=k,t[45]=a,t[46]=O==null?void 0:O.running,t[47]=he):he=t[47];let se;t[48]!==me||t[49]!==pe||t[50]!==ge||t[51]!==he?(se=n.jsxs(un,{align:"start",sideOffset:6,className:"w-72",children:[me,Le,pe,ge,he]}),t[48]=me,t[49]=pe,t[50]=ge,t[51]=he,t[52]=se):se=t[52];let xe;t[53]!==ke||t[54]!==se?(xe=n.jsxs(fn,{children:[ke,se]}),t[53]=ke,t[54]=se,t[55]=xe):xe=t[55];let ve;t[56]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx("span",{className:"flex-1"}),t[56]=ve):ve=t[56];let le;t[57]!==M||t[58]!==_?(le=!M&&n.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[n.jsxs("span",{role:"status",className:"flex min-w-0 items-center gap-1.5 text-xs font-medium text-amber-700 dark:text-amber-300",children:[n.jsx(Vt,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),n.jsx("span",{className:"sr-only @sm/browser-bar:not-sr-only @sm/browser-bar:whitespace-nowrap",children:"Not the default browser"})]}),n.jsx(ae,{variant:"outline",size:"xs",onClick:_,children:"Show default"})]}),t[57]=M,t[58]=_,t[59]=le):le=t[59];let Te;t[60]!==x?(Te=Q=>x(Q),t[60]=x,t[61]=Te):Te=t[61];let ce;t[62]!==o||t[63]!==Te?(ce=n.jsx(dn,{size:"sm","aria-label":"Follow agent",pressed:o,onPressedChange:Te,className:"text-muted-foreground data-pressed:text-foreground"}),t[62]=o,t[63]=Te,t[64]=ce):ce=t[64];let _e,H;t[65]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx(Mn,{"data-icon":"inline-start"}),H=n.jsx("span",{className:"hidden @md/browser-bar:inline",children:"Follow"}),t[65]=_e,t[66]=H):(_e=t[65],H=t[66]);let q;t[67]!==ce?(q=n.jsxs(Bt,{render:ce,children:[_e,H]}),t[67]=ce,t[68]=q):q=t[68];let Z;t[69]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx(Ft,{children:"Switch to whichever browser this session’s agent uses"}),t[69]=Z):Z=t[69];let re;t[70]!==q?(re=n.jsxs(Pt,{children:[q,Z]}),t[70]=q,t[71]=re):re=t[71];let I;t[72]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(tt,{"data-icon":"inline-start"}),t[72]=I):I=t[72];let r;t[73]!==E?(r=n.jsx(ae,{variant:"ghost",size:"icon-sm","aria-label":"Close browser panel",onClick:E,children:I}),t[73]=E,t[74]=r):r=t[74];let g;t[75]!==ue?(g=Q=>{Q.preventDefault(),ue()},t[75]=ue,t[76]=g):g=t[76];let L;t[77]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsxs(Ut,{children:[n.jsx($t,{children:"New browser"}),n.jsx(zt,{children:"A named browser keeps its own cookies and logins, and stays out of the default one."})]}),t[77]=L):L=t[77];const te=!!z;let W;t[78]!==R?(W=n.jsx(gt,{htmlFor:R,children:"Name"}),t[78]=R,t[79]=W):W=t[79];const be=!!z;let we;t[80]===Symbol.for("react.memo_cache_sentinel")?(we=Q=>{y(Q.target.value),G(null)},t[80]=we):we=t[80];let oe;t[81]!==R||t[82]!==d||t[83]!==be?(oe=n.jsx(it,{id:R,autoFocus:!0,autoComplete:"off",spellCheck:!1,placeholder:"shop","aria-invalid":be,value:d,onChange:we}),t[81]=R,t[82]=d,t[83]=be,t[84]=oe):oe=t[84];let De;t[85]!==z?(De=n.jsx(mn,{children:z}),t[85]=z,t[86]=De):De=t[86];let Re;t[87]!==te||t[88]!==W||t[89]!==oe||t[90]!==De?(Re=n.jsxs(bt,{"data-invalid":te,children:[W,oe,De]}),t[87]=te,t[88]=W,t[89]=oe,t[90]=De,t[91]=Re):Re=t[91];let Fe;t[92]===Symbol.for("react.memo_cache_sentinel")?(Fe=n.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"}),t[92]=Fe):Fe=t[92];let Ie;t[93]!==T?(Ie=n.jsxs(gt,{htmlFor:T,children:["Note ",Fe]}),t[93]=T,t[94]=Ie):Ie=t[94];let Pe;t[95]===Symbol.for("react.memo_cache_sentinel")?(Pe=Q=>X(Q.target.value),t[95]=Pe):Pe=t[95];let Oe;t[96]!==h||t[97]!==T?(Oe=n.jsx(it,{id:T,autoComplete:"off",placeholder:"What this browser is signed in to",value:h,onChange:Pe}),t[96]=h,t[97]=T,t[98]=Oe):Oe=t[98];let Ae;t[99]!==Ie||t[100]!==Oe?(Ae=n.jsxs(bt,{children:[Ie,Oe]}),t[99]=Ie,t[100]=Oe,t[101]=Ae):Ae=t[101];let Ue;t[102]!==Re||t[103]!==Ae?(Ue=n.jsxs(hn,{className:"gap-4",children:[Re,Ae]}),t[102]=Re,t[103]=Ae,t[104]=Ue):Ue=t[104];let Ge;t[105]===Symbol.for("react.memo_cache_sentinel")?(Ge=n.jsx(Kt,{render:n.jsx(ae,{type:"button",variant:"outline"}),children:"Cancel"}),t[105]=Ge):Ge=t[105];const We=!J;let ze;t[106]!==We?(ze=n.jsxs(Yt,{children:[Ge,n.jsx(ae,{type:"submit",disabled:We,children:"Create browser"})]}),t[106]=We,t[107]=ze):ze=t[107];let Ke;t[108]!==g||t[109]!==Ue||t[110]!==ze?(Ke=n.jsx(Ht,{className:"sm:max-w-sm",children:n.jsxs("form",{className:"flex flex-col gap-4",onSubmit:g,children:[L,Ue,ze]})}),t[108]=g,t[109]=Ue,t[110]=ze,t[111]=Ke):Ke=t[111];let Ye;t[112]!==F||t[113]!==Ke?(Ye=n.jsx(Gt,{open:F,onOpenChange:c,children:Ke}),t[112]=F,t[113]=Ke,t[114]=Ye):Ye=t[114];let P;t[115]!==K||t[116]!==j?(P=K!==null&&n.jsx(xn,{open:!0,onOpenChange:Q=>{Q||$(null)},children:n.jsxs(pn,{size:"sm",children:[n.jsxs(gn,{children:[n.jsx(bn,{className:"bg-destructive/10 text-destructive",children:n.jsx(jt,{})}),n.jsxs(wn,{children:["Delete ",K,"?"]}),n.jsx(yn,{children:"Its profile goes with it, so everything signed in there is signed out. Other browsers are untouched."})]}),n.jsxs(jn,{children:[n.jsx(Sn,{size:"sm",children:"Cancel"}),n.jsx(kn,{variant:"destructive",size:"sm",onClick:()=>{j(K),$(null)},children:"Delete browser"})]})]})}),t[115]=K,t[116]=j,t[117]=P):P=t[117];let $e;return t[118]!==xe||t[119]!==le||t[120]!==re||t[121]!==r||t[122]!==Ye||t[123]!==P||t[124]!==V?($e=n.jsxs("div",{className:V,children:[xe,ve,le,re,r,Ye,P]}),t[118]=xe,t[119]=le,t[120]=re,t[121]=r,t[122]=Ye,t[123]=P,t[124]=V,t[125]=$e):$e=t[125],$e});function ds(s){const e=ye.c(36),{open:t,onOpenChange:l,readTargets:a,install:i}=s,[o,f]=u.useState(null),[m,x]=u.useState(null),[w,C]=u.useState(null);let j;e[0]!==a?(j=async()=>{const A=await a();A.ok?(f(A.targets),x(null)):x(A.error)},e[0]=a,e[1]=j):j=e[1];const k=j;let _,E;e[2]!==k||e[3]!==t?(_=()=>{t&&(x(null),k())},E=[t,k],e[2]=k,e[3]=t,e[4]=_,e[5]=E):(_=e[4],E=e[5]),u.useEffect(_,E);let p;e[6]!==i||e[7]!==k?(p=async function(O){C(O);const N=await i(O);C(null),N.ok?await k():x(N.error)},e[6]=i,e[7]=k,e[8]=p):p=e[8];const R=p;let T;e[9]!==o?(T=(o==null?void 0:o.some(ms))??!1,e[9]=o,e[10]=T):T=e[10];const F=T;let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx($t,{children:"Agent skill"}),e[11]=c):c=e[11];let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs(Ut,{children:[c,n.jsxs(zt,{children:["The skill teaches an agent how Cogpit’s browsers work: when to use a named one, when to keep to a throwaway, and that this panel is watching. Install it for agents you run outside Cogpit — it writes a"," ",n.jsx("code",{className:"font-mono",children:"SKILL.md"})," into that CLI’s configuration directory in your home folder."]})]}),e[12]=d):d=e[12];let y;e[13]!==m?(y=m&&n.jsx("p",{role:"alert",className:"text-sm text-destructive",children:m}),e[13]=m,e[14]=y):y=e[14];let h;e[15]!==w||e[16]!==R||e[17]!==o?(h=o===null?n.jsxs("div",{role:"status",className:"flex items-center gap-2 py-4 text-sm text-muted-foreground",children:[n.jsx(Xt,{}),"Reading where it is installed…"]}):n.jsx("ul",{className:"flex flex-col gap-2",children:o.map(A=>n.jsxs("li",{className:"flex items-center gap-3 rounded-md border p-2.5",children:[n.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsx("span",{className:"truncate text-sm font-medium",children:A.label}),n.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:A.configRoot}),A.automatic&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:"Already automatic in the sessions Cogpit starts"})]}),A.installed?n.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[n.jsx(Jt,{"aria-hidden":!0,className:"size-3.5 text-emerald-500"}),"Installed"]}):n.jsx(ae,{size:"xs",variant:"outline","aria-label":`Install for ${A.label}`,disabled:w!==null,onClick:()=>void R(A.kind),children:"Install"})]},A.kind))}),e[15]=w,e[16]=R,e[17]=o,e[18]=h):h=e[18];const X=!F||w!==null;let U;e[19]!==R?(U=()=>void R(Fn),e[19]=R,e[20]=U):U=e[20];let G;e[21]===Symbol.for("react.memo_cache_sentinel")?(G=n.jsx(xt,{"data-icon":"inline-start"}),e[21]=G):G=e[21];let b;e[22]!==X||e[23]!==U?(b=n.jsxs(ae,{variant:"outline",disabled:X,onClick:U,children:[G,"Install for all"]}),e[22]=X,e[23]=U,e[24]=b):b=e[24];let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx(Kt,{render:n.jsx(ae,{type:"button"}),children:"Done"}),e[25]=B):B=e[25];let K;e[26]!==b?(K=n.jsxs(Yt,{children:[b,B]}),e[26]=b,e[27]=K):K=e[27];let $;e[28]!==K||e[29]!==y||e[30]!==h?($=n.jsxs(Ht,{className:"sm:max-w-md",children:[d,y,h,K]}),e[28]=K,e[29]=y,e[30]=h,e[31]=$):$=e[31];let M;return e[32]!==l||e[33]!==t||e[34]!==$?(M=n.jsx(Gt,{open:t,onOpenChange:l,children:$}),e[32]=l,e[33]=t,e[34]=$,e[35]=M):M=e[35],M}function ms(s){return!s.installed}const hs={x:0,y:0,width:0,height:0,scale:0};function xs(s,e){if(s.width<=0||s.height<=0||e.width<=0||e.height<=0)return hs;const t=Math.min(1,s.width/e.width,s.height/e.height),l=e.width*t,a=e.height*t;return{x:Math.round((s.width-l)/2),y:Math.round((s.height-a)/2),width:l,height:a,scale:t}}function Tt(s,e,t,l,a={}){if(l.scale<=0||l.width<=0||l.height<=0)return null;const i=s-t.left-l.x,o=e-t.top-l.y;return!(i>=0&&o>=0&&i<=l.width&&o<=l.height)&&!a.clamp?null:{x:_t(i/l.scale,l.width/l.scale),y:_t(o/l.scale,l.height/l.scale)}}function _t(s,e){return Math.min(Math.max(s,0),e)}const ps=1,gs=2,bs=4,ws=8;function Xe(s){return(s.altKey?ps:0)|(s.ctrlKey?gs:0)|(s.metaKey?bs:0)|(s.shiftKey?ws:0)}const ys=["left","middle","right"];function vt(s){return ys[s]??"left"}const js=150,Dt=2,Ss=500,Rt=5,ks=1,Ns=2,Cs=16,Es="Keyboard captured · Esc to release",Ts=new Set(["F5","F11","F12"]),_s=new Set(["i","j","c"]);function It(s){return Ts.has(s.key)||s.metaKey?!0:s.ctrlKey&&s.shiftKey&&_s.has(s.key.toLowerCase())}function vs(s){if(!(s.ctrlKey||s.metaKey))return s.key.length===1?s.key:s.key==="Enter"?"\r":void 0}function Ot(s,e,t){return e===ks?s*Cs:e===Ns?s*t:s}function At(s,e,t){try{s.drawImage(e,t.x,t.y,t.width,t.height)}catch{}}function Ds(s){const e=ye.c(81),{frame:t,send:l,onSizeChange:a,className:i}=s,o=u.useRef(null),f=u.useRef(null),m=u.useRef(null),x=u.useRef(null),w=u.useRef(!1);let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C={count:0,at:0,x:0,y:0,button:-1},e[0]=C):C=e[0];const j=u.useRef(C);let k;e[1]===Symbol.for("react.memo_cache_sentinel")?(k=new Map,e[1]=k):k=e[1];const _=u.useRef(k);let E;e[2]===Symbol.for("react.memo_cache_sentinel")?(E={width:0,height:0,dpr:1},e[2]=E):E=e[2];const[p,R]=u.useState(E),[T,F]=u.useState(!1),c=t?t.header.deviceWidth:0,d=t?t.header.deviceHeight:0;let y;e[3]!==d||e[4]!==c||e[5]!==p?(y=xs(p,{width:c,height:d}),e[3]=d,e[4]=c,e[5]=p,e[6]=y):y=e[6];const h=y,X=u.useRef(a);let U,G;e[7]!==a?(U=()=>{X.current=a},G=[a],e[7]=a,e[8]=U,e[9]=G):(U=e[8],G=e[9]),u.useEffect(U,G);let b,B;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=()=>{const I=o.current;if(!I)return;let r=null;const g=()=>{const te=I.getBoundingClientRect(),W=Math.round(te.width),be=Math.round(te.height),we=window.devicePixelRatio||1;R(oe=>oe.width===W&&oe.height===be&&oe.dpr===we?oe:{width:W,height:be,dpr:we}),r&&clearTimeout(r),r=setTimeout(()=>{r=null,W>0&&be>0&&X.current(W,be,we)},js)};g();const L=new ResizeObserver(g);return L.observe(I),()=>{L.disconnect(),r&&clearTimeout(r)}},B=[],e[10]=b,e[11]=B):(b=e[10],B=e[11]),u.useEffect(b,B);let K,$;e[12]!==h||e[13]!==t||e[14]!==p?($=()=>{const I=f.current,r=I==null?void 0:I.getContext("2d");if(!I||!r)return;const g=Math.round(p.width*p.dpr),L=Math.round(p.height*p.dpr);if(I.width!==g&&(I.width=g),I.height!==L&&(I.height=L),r.setTransform(p.dpr,0,0,p.dpr,0,0),r.clearRect(0,0,p.width,p.height),!t||h.width<=0||h.height<=0)return;if(t.bitmap){At(r,t.bitmap,h);return}if(!t.blobUrl)return;let te=!1;const W=new Image;return W.onload=()=>{te||At(r,W,h)},W.src=t.blobUrl,()=>{te=!0}},K=[t,h,p],e[12]=h,e[13]=t,e[14]=p,e[15]=K,e[16]=$):(K=e[15],$=e[16]),u.useEffect($,K);let M,A;e[17]!==t?(M=()=>()=>ut(t),A=[t],e[17]=t,e[18]=M,e[19]=A):(M=e[18],A=e[19]),u.useEffect(M,A);let O;e[20]!==h?(O=function(r,g,L){const te=f.current;return te?Tt(r,g,te.getBoundingClientRect(),h,{clamp:L}):null},e[20]=h,e[21]=O):O=e[21];const N=O;let S;e[22]!==l?(S=function(r,g,L,te,W){l({type:"mouse",event:r,x:g.x,y:g.y,button:L,clickCount:te,modifiers:W})},e[22]=l,e[23]=S):S=e[23];const v=S;let z;e[24]===Symbol.for("react.memo_cache_sentinel")?(z=function(r){const g=j.current,L=Date.now(),te=r.button===g.button&&L-g.at<Ss&&Math.abs(r.clientX-g.x)<=Rt&&Math.abs(r.clientY-g.y)<=Rt;return j.current={count:te?g.count+1:1,at:L,x:r.clientX,y:r.clientY,button:r.button},j.current.count},e[24]=z):z=e[24];const J=z;let ne;e[25]!==N||e[26]!==v?(ne=function(){const r=m.current;if(m.current=null,!r)return;const g=N(r.clientX,r.clientY,w.current);g&&v("move",g,"none",0,r.modifiers)},e[25]=N,e[26]=v,e[27]=ne):ne=e[27];const D=ne;let ee;e[28]!==D?(ee=function(){x.current!==null&&(cancelAnimationFrame(x.current),x.current=null),D()},e[28]=D,e[29]=ee):ee=e[29];const ue=ee;let Y;e[30]!==N||e[31]!==v?(Y=function(r){if(r.currentTarget.focus(),r.button===Dt)return;const g=N(r.clientX,r.clientY,!1);g&&(r.currentTarget.setPointerCapture(r.pointerId),w.current=!0,v("down",g,vt(r.button),J(r),Xe(r)))},e[30]=N,e[31]=v,e[32]=Y):Y=e[32];const V=Y;let ie;e[33]!==D?(ie=function(r){m.current={clientX:r.clientX,clientY:r.clientY,modifiers:Xe(r)},x.current===null&&(x.current=requestAnimationFrame(()=>{x.current=null,D()}))},e[33]=D,e[34]=ie):ie=e[34];const Be=ie;let fe;e[35]!==ue||e[36]!==N||e[37]!==v?(fe=function(r){ue();const g=w.current;if(w.current=!1,r.currentTarget.hasPointerCapture(r.pointerId)&&r.currentTarget.releasePointerCapture(r.pointerId),r.button===Dt)return;const L=N(r.clientX,r.clientY,g);L&&v("up",L,vt(r.button),j.current.count,Xe(r))},e[35]=ue,e[36]=N,e[37]=v,e[38]=fe):fe=e[38];const je=fe;let Se;e[39]!==N||e[40]!==v?(Se=function(r){r.preventDefault();const g=N(r.clientX,r.clientY,!1);if(!g)return;const L=Xe(r);v("down",g,"right",1,L),v("up",g,"right",1,L)},e[39]=N,e[40]=v,e[41]=Se):Se=e[41];const ke=Se;let de;e[42]!==l?(de=function(r){if(r.key==="Escape"){r.currentTarget.blur();return}It(r)||r.preventDefault();const g={type:"key",event:"down",key:r.key,code:r.code,modifiers:Xe(r)},L=vs(r);L!==void 0&&(g.text=L),_.current.set(r.code,r.key),l(g)},e[42]=l,e[43]=de):de=e[43];const Ne=de;let me;e[44]!==l?(me=function(r){r.key!=="Escape"&&(It(r)||r.preventDefault(),_.current.delete(r.code),l({type:"key",event:"up",key:r.key,code:r.code,modifiers:Xe(r)}))},e[44]=l,e[45]=me):me=e[45];const Le=me;let Ce,pe;e[46]!==d||e[47]!==c||e[48]!==h||e[49]!==l?(Ce=()=>{const I=f.current;if(!I)return;const r=g=>{g.preventDefault();const L=Tt(g.clientX,g.clientY,I.getBoundingClientRect(),h);L&&l({type:"wheel",x:L.x,y:L.y,deltaX:Ot(g.deltaX,g.deltaMode,c),deltaY:Ot(g.deltaY,g.deltaMode,d),modifiers:Xe(g)})};return I.addEventListener("wheel",r,{passive:!1}),()=>I.removeEventListener("wheel",r)},pe=[l,h,c,d],e[46]=d,e[47]=c,e[48]=h,e[49]=l,e[50]=Ce,e[51]=pe):(Ce=e[50],pe=e[51]),u.useEffect(Ce,pe);let Ee,ge;e[52]===Symbol.for("react.memo_cache_sentinel")?(Ee=()=>()=>{x.current!==null&&cancelAnimationFrame(x.current)},ge=[],e[52]=Ee,e[53]=ge):(Ee=e[52],ge=e[53]),u.useEffect(Ee,ge);let he;e[54]!==l?(he=()=>{for(const[I,r]of _.current)l({type:"key",event:"up",key:r,code:I,modifiers:0});_.current.clear()},e[54]=l,e[55]=he):he=e[55];const se=he;let xe,ve;e[56]!==se?(xe=()=>se,ve=[se],e[56]=se,e[57]=xe,e[58]=ve):(xe=e[57],ve=e[58]),u.useEffect(xe,ve);let le;e[59]!==i?(le=He("relative min-h-0 min-w-0 overflow-hidden bg-muted/30",i),e[59]=i,e[60]=le):le=e[60];const Te=T&&"ring-2 ring-ring ring-inset";let ce;e[61]!==Te?(ce=He("block size-full cursor-default touch-none select-none outline-none",Te),e[61]=Te,e[62]=ce):ce=e[62];let _e;e[63]===Symbol.for("react.memo_cache_sentinel")?(_e=()=>F(!0),e[63]=_e):_e=e[63];let H;e[64]!==se?(H=()=>{F(!1),se()},e[64]=se,e[65]=H):H=e[65];let q;e[66]!==ke||e[67]!==Ne||e[68]!==Le||e[69]!==V||e[70]!==Be||e[71]!==je||e[72]!==ce||e[73]!==H?(q=n.jsx("canvas",{ref:f,role:"application","aria-label":"Browser viewport",tabIndex:0,className:ce,onFocus:_e,onBlur:H,onPointerDown:V,onPointerMove:Be,onPointerUp:je,onPointerCancel:je,onContextMenu:ke,onKeyDown:Ne,onKeyUp:Le}),e[66]=ke,e[67]=Ne,e[68]=Le,e[69]=V,e[70]=Be,e[71]=je,e[72]=ce,e[73]=H,e[74]=q):q=e[74];let Z;e[75]!==T?(Z=T&&n.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-2 flex justify-center",children:n.jsx("span",{className:"rounded-full bg-background/80 px-2 py-0.5 text-[10px] text-muted-foreground shadow-xs backdrop-blur-sm",children:Es})}),e[75]=T,e[76]=Z):Z=e[76];let re;return e[77]!==le||e[78]!==q||e[79]!==Z?(re=n.jsxs("div",{ref:o,className:le,children:[q,Z]}),e[77]=le,e[78]=q,e[79]=Z,e[80]=re):re=e[80],re}const Rs="browser-panel-session",Is="browser-panel-follow",Os=1e4,Lt=3e3,As=[];function Ys(s){var Ge,We,ze,Ke,Ye;const e=ye.c(119),{context:t,active:l,closePanel:a}=s;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=wt(Rs),e[0]=i):i=e[0];const[o,f]=yt(i,Qe);let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m=wt(Is),e[1]=m):m=e[1];const[x,w]=yt(m,!0),[C,j]=u.useState(!1),[k,_]=u.useState(null),[E,p]=u.useState(null),[R,T]=u.useState(!1),F=u.useRef(0),{status:c,error:d,create:y,remove:h,stop:X,readSkillTargets:U,installSkill:G}=Pn(l),b=Jn(l?o:null),B=(c==null?void 0:c.sessions)??As;let K;e[2]!==t.session?(K=Cn(t.session),e[2]=t.session,e[3]=K):K=e[3];const $=K,M=($==null?void 0:$.session)??null;let A;if(e[4]!==M||e[5]!==B){let P;e[7]!==M?(P=$e=>$e.name===M,e[7]=M,e[8]=P):P=e[8],A=B.some(P),e[4]=M,e[5]=B,e[6]=A}else A=e[6];const O=A;let N,S;e[9]!==M||e[10]!==O||e[11]!==x||e[12]!==o||e[13]!==f?(N=()=>{!x||M===null||M===o||!O||Date.now()-F.current<Os||f(M)},S=[x,M,O,o,f],e[9]=M,e[10]=O,e[11]=x,e[12]=o,e[13]=f,e[14]=N,e[15]=S):(N=e[14],S=e[15]),u.useEffect(N,S);let v;e[16]!==f?(v=P=>{F.current=Date.now(),f(P)},e[16]=f,e[17]=v):v=e[17];const z=v;let J;e[18]===Symbol.for("react.memo_cache_sentinel")?(J=async P=>{j(!0);const $e=await P();j(!1),$e.ok||_($e.error)},e[18]=J):J=e[18];const ne=J,{send:D}=b;let ee;e[19]!==D?(ee=(P,$e,Q)=>{D({type:"viewport",width:P,height:$e,dpr:Q})},e[19]=D,e[20]=ee):ee=e[20];const ue=ee;let Y;e[21]!==w?(Y=P=>{P&&(F.current=0),w(P)},e[21]=w,e[22]=Y):Y=e[22];const V=Y;let ie;e[23]!==z?(ie=()=>z(Qe),e[23]=z,e[24]=ie):ie=e[24];const Be=ie;let fe;e[25]===Symbol.for("react.memo_cache_sentinel")?(fe=()=>T(!0),e[25]=fe):fe=e[25];const je=fe;let Se;e[26]!==h||e[27]!==z?(Se=P=>{z(Qe),ne(()=>h(P))},e[26]=h,e[27]=z,e[28]=Se):Se=e[28];const ke=Se;let de;e[29]!==X?(de=P=>void ne(()=>X(P)),e[29]=X,e[30]=de):de=e[30];const Ne=de;let me;e[31]!==D?(me=P=>D({type:"navigate",url:P}),e[31]=D,e[32]=me):me=e[32];const Le=me;let Ce;e[33]!==D?(Ce=()=>D({type:"back"}),e[33]=D,e[34]=Ce):Ce=e[34];const pe=Ce;let Ee;e[35]!==D?(Ee=()=>D({type:"forward"}),e[35]=D,e[36]=Ee):Ee=e[36];const ge=Ee;let he;e[37]!==D?(he=()=>D({type:"reload"}),e[37]=D,e[38]=he):he=e[38];const se=he;let xe;e[39]!==D?(xe=P=>D({type:"follow",targetId:P}),e[39]=D,e[40]=xe):xe=e[40];const ve=xe;let le;e[41]!==D?(le=P=>D({type:"close-tab",targetId:P}),e[41]=D,e[42]=le):le=e[42];const Te=le,ce=Ls(b.lastFrameAt),_e=((Ge=b.state)==null?void 0:Ge.state)??null,H=(c==null?void 0:c.unsupportedReason)??(_e==="unsupported"?((We=b.state)==null?void 0:We.message)??"The Browser panel is unavailable on this host.":null),q=!H&&((c==null?void 0:c.installed)===!1||_e==="not-installed"),Z=!H&&!q&&_e==="live",re=!H&&!q&&_e==="stopped";let I;e[43]!==o||e[44]!==B?(I=B.find(P=>P.name===o)??null,e[43]=o,e[44]=B,e[45]=I):I=e[45];const r=I,g=Z&&(b.status==="disconnected"||b.status==="connecting"),L=b.error??k??d,te=L!==null&&L!==E?L:null;let W;e[46]!==a||e[47]!==H?(W=H&&n.jsx("div",{className:"flex justify-end border-b p-1",children:n.jsx(ae,{variant:"ghost",size:"icon-xs","aria-label":"Close browser panel",onClick:a,children:n.jsx(tt,{})})}),e[46]=a,e[47]=H,e[48]=W):W=e[48];let be;e[49]!==C||e[50]!==a||e[51]!==((ze=t.session)==null?void 0:ze.sessionId)||e[52]!==y||e[53]!==x||e[54]!==ke||e[55]!==Ne||e[56]!==z||e[57]!==o||e[58]!==B||e[59]!==Be||e[60]!==V||e[61]!==H?(be=!H&&n.jsx(fs,{sessions:B,selected:o,currentSessionId:((Ke=t.session)==null?void 0:Ke.sessionId)??null,followAgent:x,busy:C,onSelect:z,onToggleFollow:V,onOpenSkill:je,onCreate:y,onRemove:ke,onStop:Ne,onShowDefault:Be,onClose:a}),e[49]=C,e[50]=a,e[51]=(Ye=t.session)==null?void 0:Ye.sessionId,e[52]=y,e[53]=x,e[54]=ke,e[55]=Ne,e[56]=z,e[57]=o,e[58]=B,e[59]=Be,e[60]=V,e[61]=H,e[62]=be):be=e[62];let we;e[63]!==Te||e[64]!==ve||e[65]!==ce||e[66]!==pe||e[67]!==ge||e[68]!==Z||e[69]!==Le||e[70]!==g||e[71]!==se||e[72]!==b.followed||e[73]!==b.page||e[74]!==b.tabs?(we=Z&&n.jsx(ls,{page:b.page,tabs:b.tabs,followed:b.followed,status:g?"offline":ce,onNavigate:Le,onBack:pe,onForward:ge,onReload:se,onFollow:ve,onCloseTab:Te}),e[63]=Te,e[64]=ve,e[65]=ce,e[66]=pe,e[67]=ge,e[68]=Z,e[69]=Le,e[70]=g,e[71]=se,e[72]=b.followed,e[73]=b.page,e[74]=b.tabs,e[75]=we):we=e[75];let oe;e[76]!==L||e[77]!==te?(oe=te&&n.jsx(Fs,{message:te,onDismiss:()=>{_(null),p(L)}}),e[76]=L,e[77]=te,e[78]=oe):oe=e[78];let De;e[79]!==H?(De=H&&n.jsx(at,{kind:"unsupported",message:H}),e[79]=H,e[80]=De):De=e[80];let Re;e[81]!==q?(Re=q&&n.jsx(at,{kind:"not-installed",onOpenSkill:je}),e[81]=q,e[82]=Re):Re=e[82];let Fe;e[83]!==o||e[84]!==(r==null?void 0:r.lastUrl)||e[85]!==D||e[86]!==re?(Fe=re&&n.jsx(at,{kind:"stopped",name:o,lastUrl:(r==null?void 0:r.lastUrl)??null,onOpen:P=>D({type:"launch",url:P})}),e[83]=o,e[84]=r==null?void 0:r.lastUrl,e[85]=D,e[86]=re,e[87]=Fe):Fe=e[87];let Ie;e[88]!==$||e[89]!==ue||e[90]!==Z||e[91]!==g||e[92]!==o||e[93]!==D||e[94]!==b.frame?(Ie=Z&&n.jsxs(n.Fragment,{children:[n.jsx(Ds,{className:"flex-1",frame:b.frame,send:D,onSizeChange:ue}),g&&n.jsx(Bs,{}),n.jsx(Zn,{activity:$&&$.session===o?$:null})]}),e[88]=$,e[89]=ue,e[90]=Z,e[91]=g,e[92]=o,e[93]=D,e[94]=b.frame,e[95]=Ie):Ie=e[95];let Pe;e[96]!==Z||e[97]!==q||e[98]!==o||e[99]!==re||e[100]!==H?(Pe=!H&&!q&&!re&&!Z&&n.jsxs("div",{role:"status",className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[n.jsx(Xt,{}),"Connecting to ",o,"…"]}),e[96]=Z,e[97]=q,e[98]=o,e[99]=re,e[100]=H,e[101]=Pe):Pe=e[101];let Oe;e[102]!==De||e[103]!==Re||e[104]!==Fe||e[105]!==Ie||e[106]!==Pe?(Oe=n.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[De,Re,Fe,Ie,Pe]}),e[102]=De,e[103]=Re,e[104]=Fe,e[105]=Ie,e[106]=Pe,e[107]=Oe):Oe=e[107];let Ae;e[108]!==G||e[109]!==U||e[110]!==R?(Ae=n.jsx(ds,{open:R,onOpenChange:T,readTargets:U,install:G}),e[108]=G,e[109]=U,e[110]=R,e[111]=Ae):Ae=e[111];let Ue;return e[112]!==W||e[113]!==be||e[114]!==we||e[115]!==oe||e[116]!==Oe||e[117]!==Ae?(Ue=n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[W,be,we,oe,Oe,Ae]}),e[112]=W,e[113]=be,e[114]=we,e[115]=oe,e[116]=Oe,e[117]=Ae,e[118]=Ue):Ue=e[118],Ue}function Ls(s){const e=ye.c(5),[,t]=u.useState(0);let l;e[0]!==t||e[1]!==s?(l=()=>{if(s===null)return;const i=s+Lt-Date.now();if(i<=0)return;const o=setTimeout(()=>t(Ms),i);return()=>clearTimeout(o)},e[0]=t,e[1]=s,e[2]=l):l=e[2];let a;return e[3]!==s?(a=[s],e[3]=s,e[4]=a):a=e[4],u.useEffect(l,a),s===null?"idle":Date.now()-s<Lt?"live":"idle"}function Ms(s){return s+1}function Bs(){const s=ye.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 flex justify-center p-2",children:n.jsx("span",{role:"status",className:"rounded-full bg-background/85 px-2.5 py-0.5 text-[11px] text-muted-foreground shadow-xs backdrop-blur-sm",children:"Reconnecting…"})}),s[0]=e):e=s[0],e}function Fs(s){const e=ye.c(9),{message:t,onDismiss:l}=s;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Vt,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e[0]=a):a=e[0];let i;e[1]!==t?(i=n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),e[1]=t,e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(tt,{"data-icon":"inline-start"}),e[3]=o):o=e[3];let f;e[4]!==l?(f=n.jsx(ae,{variant:"ghost",size:"icon-xs","aria-label":"Dismiss",onClick:l,children:o}),e[4]=l,e[5]=f):f=e[5];let m;return e[6]!==i||e[7]!==f?(m=n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-2 py-1 text-xs text-destructive",children:[a,i,f]}),e[6]=i,e[7]=f,e[8]=m):m=e[8],m}export{Ys as BrowserPanel};
|
package/dist/web/assets/{session-parser.worker-SrNyVFwl.js → session-parser.worker-CnmfpqaO.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){"use strict";const ft=["codex","copilot","claude"],mt="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";function Ne(t,e){const n=new TextEncoder().encode(e);let s="";for(const i of n)s+=String.fromCharCode(i);const o=btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${t}${o}`}function ve(t,e){if(!e.startsWith(t))return null;try{const n=e.slice(t.length).replace(/-/g,"+").replace(/_/g,"/"),s=atob(n),o=Uint8Array.from(s,i=>i.charCodeAt(0));return new TextDecoder().decode(o)}catch{return null}}function At(t){return{lossy:!1,owns:e=>typeof e=="string"&&e.startsWith(t),encode:e=>Ne(t,e),decode:e=>ve(t,e)}}function St(t){const e=new RegExp(`(${mt})\\.jsonl$`,"i").exec(t);return e?e[1]:null}const wt={urlId:t=>t.replace(/\.jsonl$/,""),fileNameFromUrlId:t=>t.endsWith(".jsonl")?t:`${t}.jsonl`};function Mt(t){return`'${t.replace(/'/g,"'\\''")}'`}function H(t,e){return e?[t,e]:[]}function nt(t,e){var n;return((n=e.exec(t))==null?void 0:n[1])??null}const st="[0-9a-f-]{36}",Et="codex__",Nt="copilot__",Be=new Set(["default","plan","acceptEdits","dontAsk","auto"]),Re={kind:"claude",displayName:"Claude Code",binName:"claude",dirName:{lossy:!0,owns:t=>typeof t=="string"&&!t.startsWith(Et)&&!t.startsWith(Nt),encode:t=>(t.replace(/[\\/]+$/,"")||t).replace(/[^a-zA-Z0-9]/g,"-"),decode:t=>{const e=/^([A-Za-z])--(.*)$/.exec(t);return e?`${e[1]}:\\${e[2].replace(/-/g,"\\")}`:"/"+t.replace(/^-/,"").replace(/-/g,"/")}},sessionFile:{name:t=>`${t}.jsonl`,sessionId:St,...wt},metadataFromHead:!0,resume:{command:t=>`claude --resume ${t}`,args:t=>["--resume",t]},launchArgs:{permissions:t=>t!=null&&t.mode?t.mode==="bypassPermissions"?["--dangerously-skip-permissions"]:[...Be.has(t.mode)?["--permission-mode",t.mode]:[],...(t.allowedTools??[]).flatMap(e=>["--allowedTools",e]),...(t.disallowedTools??[]).flatMap(e=>["--disallowedTools",e])]:["--permission-mode","default"],model:t=>H("--model",t),effort:t=>H("--effort",t),fastTier:()=>[]},serviceTier:null,cli:{packageName:"@anthropic-ai/claude-code",homebrew:{name:"claude-code",cask:!1},wingetId:null,versionArgs:["--version"],selfUpdate:{args:["update"],matches:t=>t.endsWith("/.local/bin/claude")||t.endsWith("/.local/bin/claude.exe")||t.includes("/.local/share/claude/")},bundledBySdk:!0,homeDirName:".claude",homeEnvVar:null,installMarker:"projects",homeIsDiscoverable:!1,process:{by:"command",sessionIdFromCommand:t=>nt(t,new RegExp(`--resume(?:=|\\s+)(${st})`))??nt(t,new RegExp(`--session-id(?:=|\\s+)(${st})`))}},config:{rootDirName:".claude",instructions:[{in:"scope",path:"CLAUDE.md",scopes:["global","project"]},{in:"root",path:"CLAUDE.md",label:".claude/CLAUDE.md",scopes:["project"]}],settings:[{in:"root",path:"settings.json",scopes:["global"]},{in:"root",path:"settings.local.json",scopes:["project"]}],skillsDir:"skills",agentsDir:"agents",commandsDir:"commands",themesDir:"themes",pluginsDir:"plugins"},contextWindow:{defaultLimit:1e6,limits:[{match:"claude-haiku-4-5",limit:2e5},{match:"claude-haiku-4-1",limit:2e5},{match:"claude-sonnet-4-5",limit:2e5},{match:"claude-opus-4-5",limit:2e5},{match:"claude-opus-4-1",limit:2e5}],compactBuffer:33e3,extendedContext:{marker:"[1m]",limit:1e6}},capabilities:{worktrees:!0,mcp:!0,slashCommands:!0,workflows:!0,agentTeams:!0,subagentTranscripts:!0,nestedSubagents:!1,sharing:!0,goals:"transcript",undo:!0,redo:!0,nativeRewind:!1,fileCheckpoints:!0,reasoningEffort:!0,fastTier:!0,imageInput:!0,planMode:!0,midTurnSteering:!1,stopSession:!0,ultracode:!0,contextWindow:!0,externalProcesses:!1,accountSwitching:!0,modelFallbackNotices:!0,autoPermissionMode:"per-model",settingsApply:"live",turnLiveness:"transcript",tokenStreaming:!0,nativeFork:!1,namedSessions:!0}},vt={appServerValue:"priority",cliConfigValue:"fast"},Pe={kind:"codex",displayName:"Codex",binName:"codex",dirName:At(Et),sessionFile:{name:(t,e=new Date)=>{const n=String(e.getFullYear()),s=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0"),f=String(e.getSeconds()).padStart(2,"0");return`${n}/${s}/${o}/rollout-${n}-${s}-${o}T${i}-${l}-${f}-${t}.jsonl`},sessionId:St,...wt},metadataFromHead:!1,resume:{command:(t,e)=>e?`codex -C ${Mt(e)} resume ${t}`:`codex resume ${t}`,args:t=>["resume",t]},launchArgs:{permissions:t=>{const e=(t==null?void 0:t.mode)||"default";return e==="bypassPermissions"?["--dangerously-bypass-approvals-and-sandbox"]:["--sandbox",e==="plan"?"read-only":"workspace-write","-c",'approval_policy="never"']},model:t=>H("-m",t),effort:t=>t?["-c",`model_reasoning_effort=${JSON.stringify(t)}`]:[],fastTier:t=>t?["-c",`service_tier=${JSON.stringify(vt.cliConfigValue)}`,"--enable","fast_mode"]:[]},serviceTier:vt,cli:{packageName:"@openai/codex",homebrew:{name:"codex",cask:!1},wingetId:null,versionArgs:["--version"],selfUpdate:null,bundledBySdk:!1,homeDirName:".codex",homeEnvVar:"CODEX_HOME",installMarker:"",homeIsDiscoverable:!0,process:{by:"command",sessionIdFromCommand:t=>nt(t,new RegExp(`codex(?:\\s+\\S+)*\\s+exec\\s+resume\\s+(${st})`))}},config:{rootDirName:".codex",instructions:[{in:"scope",path:"AGENTS.md",scopes:["global","project"]}],settings:[{in:"root",path:"config.toml",scopes:["global","project"]}],skillsDir:"skills",agentsDir:"agents",commandsDir:"prompts",themesDir:null,pluginsDir:null},contextWindow:{defaultLimit:272e3,limits:[],compactBuffer:0,extendedContext:null},capabilities:{worktrees:!1,mcp:!1,slashCommands:!1,workflows:!1,agentTeams:!1,subagentTranscripts:!0,nestedSubagents:!0,sharing:!1,goals:"thread-api",undo:!0,redo:!0,nativeRewind:!1,fileCheckpoints:!1,reasoningEffort:!0,fastTier:!0,imageInput:!0,planMode:!0,midTurnSteering:!0,stopSession:!1,ultracode:!1,contextWindow:!1,externalProcesses:!1,accountSwitching:!1,modelFallbackNotices:!1,autoPermissionMode:"never",settingsApply:"next-turn",turnLiveness:"runtime",tokenStreaming:!0,nativeFork:!1,namedSessions:!1}},Fe={kind:"copilot",displayName:"GitHub Copilot CLI",binName:"copilot",dirName:At(Nt),sessionFile:{name:t=>`${t}/events.jsonl`,sessionId:t=>{const e=new RegExp(`^(${mt})/events\\.jsonl$`,"i").exec(t);return e?e[1]:null},urlId:t=>{const e=new RegExp(`^(${mt})/events\\.jsonl$`,"i").exec(t);return e?e[1]:t.replace(/\.jsonl$/,"")},fileNameFromUrlId:t=>t.endsWith(".jsonl")?t:`${t}/events.jsonl`},metadataFromHead:!0,resume:{command:(t,e)=>e?`copilot -C ${Mt(e)} --resume ${t}`:`copilot --resume ${t}`,args:t=>[`--resume=${t}`]},launchArgs:{permissions:t=>(t==null?void 0:t.mode)==="bypassPermissions"||(t==null?void 0:t.mode)==="auto"?["--allow-all"]:[],model:t=>H("--model",t),effort:t=>H("--reasoning-effort",t),fastTier:()=>[]},serviceTier:null,cli:{packageName:"@github/copilot",homebrew:{name:"copilot-cli",cask:!0},wingetId:"GitHub.Copilot",versionArgs:["--version"],selfUpdate:{args:["update"],matches:t=>t.endsWith("/.local/bin/copilot")||t==="/usr/local/bin/copilot"},bundledBySdk:!1,homeDirName:".copilot",homeEnvVar:"COPILOT_HOME",installMarker:"session-state",homeIsDiscoverable:!0,process:{by:"executable",sessionIdFromCommand:t=>nt(t,new RegExp(`--resume(?:=|\\s+)(${st})`))}},config:{rootDirName:".copilot",instructions:[{in:"scope",path:"AGENTS.md",scopes:["global","project"]}],settings:[{in:"root",path:"config.json",scopes:["global"]}],skillsDir:"skills",agentsDir:null,commandsDir:null,themesDir:null,pluginsDir:null},contextWindow:{defaultLimit:2e5,limits:[],compactBuffer:0,extendedContext:null},capabilities:{worktrees:!1,mcp:!1,slashCommands:!1,workflows:!1,agentTeams:!1,subagentTranscripts:!1,nestedSubagents:!1,sharing:!1,goals:!1,undo:!0,redo:!1,nativeRewind:!0,fileCheckpoints:!1,reasoningEffort:!1,fastTier:!1,imageInput:!1,planMode:!0,midTurnSteering:!0,stopSession:!0,ultracode:!1,contextWindow:!1,externalProcesses:!0,accountSwitching:!1,modelFallbackNotices:!1,autoPermissionMode:"always",settingsApply:"next-turn",turnLiveness:"runtime",tokenStreaming:!1,nativeFork:!0,namedSessions:!0}},$e=Object.freeze({claude:Re,codex:Pe,copilot:Fe});function gt(t){return $e[t]}function ht(t){return t.type==="user"}function _t(t){return t.type==="assistant"}function Bt(t){return t.type==="progress"}function Rt(t){return t.type==="system"}function Pt(t){return t.type==="summary"}function Ue(t){return t.type==="queue-operation"}function Ft(t){return t.type==="attachment"}function De(t){return t.type==="user"&&t.isCompactSummary===!0}function $t(t){return t.type==="system"&&t.subtype==="compact_boundary"}function Ut(t,e){let n=0;for(const s of t)e[s.name]=(e[s.name]??0)+1,s.isError&&n++;return n}function Dt(t,e){t.totalInputTokens+=e.input_tokens,t.totalOutputTokens+=e.output_tokens,t.totalCacheCreationTokens+=e.cache_creation_input_tokens??0,t.totalCacheReadTokens+=e.cache_read_input_tokens??0}function ot(t){return{totalInputTokens:0,totalOutputTokens:0,totalCacheCreationTokens:0,totalCacheReadTokens:0,toolCallCounts:{},errorCount:0,totalDurationMs:0,turnCount:t}}function it(t){const e=ot(t.length);for(const n of t){n.tokenUsage&&Dt(e,n.tokenUsage),n.durationMs&&(e.totalDurationMs+=n.durationMs),e.errorCount+=Ut(n.toolCalls,e.toolCallCounts);for(const s of n.subAgentActivity)e.errorCount+=Ut(s.toolCalls,e.toolCallCounts),s.tokenUsage&&Dt(e,s.tokenUsage)}return e}const Oe=/<(agent-message|teammate-message)([^>]*)>([\s\S]*?)<\/\1>/g,je=[/\bteammate_id=(?:"([^"]*)"|'([^']*)')/,/\bfrom=(?:"([^"]*)"|'([^']*)')/];function Le(t){for(const e of je){const n=t.match(e),s=(n==null?void 0:n[1])??(n==null?void 0:n[2]);if(s)return s}return null}function yt(t){let e=null,n=!1;const s=t.replace(Oe,(o,i,l,f)=>(n=!0,e===null&&(e=Le(l)),f.trim()));return{sender:e,matched:n,body:n?s.trim():t}}function rt(t){return typeof t=="string"?t:t.filter(e=>e.type==="text").map(e=>e.text).join(`
|
|
1
|
+
(function(){"use strict";const ft=["codex","copilot","claude"],mt="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";function Ne(t,e){const n=new TextEncoder().encode(e);let s="";for(const i of n)s+=String.fromCharCode(i);const o=btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${t}${o}`}function ve(t,e){if(!e.startsWith(t))return null;try{const n=e.slice(t.length).replace(/-/g,"+").replace(/_/g,"/"),s=atob(n),o=Uint8Array.from(s,i=>i.charCodeAt(0));return new TextDecoder().decode(o)}catch{return null}}function At(t){return{lossy:!1,owns:e=>typeof e=="string"&&e.startsWith(t),encode:e=>Ne(t,e),decode:e=>ve(t,e)}}function St(t){const e=new RegExp(`(${mt})\\.jsonl$`,"i").exec(t);return e?e[1]:null}const wt={urlId:t=>t.replace(/\.jsonl$/,""),fileNameFromUrlId:t=>t.endsWith(".jsonl")?t:`${t}.jsonl`};function Mt(t){return`'${t.replace(/'/g,"'\\''")}'`}function H(t,e){return e?[t,e]:[]}function nt(t,e){var n;return((n=e.exec(t))==null?void 0:n[1])??null}const st="[0-9a-f-]{36}",Et="codex__",Nt="copilot__",Be=new Set(["default","plan","acceptEdits","dontAsk","auto"]),Re={kind:"claude",displayName:"Claude Code",binName:"claude",dirName:{lossy:!0,owns:t=>typeof t=="string"&&!t.startsWith(Et)&&!t.startsWith(Nt),encode:t=>(t.replace(/[\\/]+$/,"")||t).replace(/[^a-zA-Z0-9]/g,"-"),decode:t=>{const e=/^([A-Za-z])--(.*)$/.exec(t);return e?`${e[1]}:\\${e[2].replace(/-/g,"\\")}`:"/"+t.replace(/^-/,"").replace(/-/g,"/")}},sessionFile:{name:t=>`${t}.jsonl`,sessionId:St,...wt},metadataFromHead:!0,resume:{command:t=>`claude --resume ${t}`,args:t=>["--resume",t]},launchArgs:{permissions:t=>t!=null&&t.mode?t.mode==="bypassPermissions"?["--dangerously-skip-permissions"]:[...Be.has(t.mode)?["--permission-mode",t.mode]:[],...(t.allowedTools??[]).flatMap(e=>["--allowedTools",e]),...(t.disallowedTools??[]).flatMap(e=>["--disallowedTools",e])]:["--permission-mode","default"],model:t=>H("--model",t),effort:t=>H("--effort",t),fastTier:()=>[]},serviceTier:null,cli:{packageName:"@anthropic-ai/claude-code",homebrew:{name:"claude-code",cask:!1},wingetId:null,versionArgs:["--version"],selfUpdate:{args:["update"],matches:t=>t.endsWith("/.local/bin/claude")||t.endsWith("/.local/bin/claude.exe")||t.includes("/.local/share/claude/")},bundledBySdk:!0,homeDirName:".claude",homeEnvVar:null,installMarker:"projects",homeIsDiscoverable:!1,process:{by:"command",sessionIdFromCommand:t=>nt(t,new RegExp(`--resume(?:=|\\s+)(${st})`))??nt(t,new RegExp(`--session-id(?:=|\\s+)(${st})`))}},config:{rootDirName:".claude",instructions:[{in:"scope",path:"CLAUDE.md",scopes:["global","project"]},{in:"root",path:"CLAUDE.md",label:".claude/CLAUDE.md",scopes:["project"]}],settings:[{in:"root",path:"settings.json",scopes:["global"]},{in:"root",path:"settings.local.json",scopes:["project"]}],skillsDir:"skills",agentsDir:"agents",commandsDir:"commands",themesDir:"themes",pluginsDir:"plugins",pluginManifestDir:".claude-plugin"},contextWindow:{defaultLimit:1e6,limits:[{match:"claude-haiku-4-5",limit:2e5},{match:"claude-haiku-4-1",limit:2e5},{match:"claude-sonnet-4-5",limit:2e5},{match:"claude-opus-4-5",limit:2e5},{match:"claude-opus-4-1",limit:2e5}],compactBuffer:33e3,extendedContext:{marker:"[1m]",limit:1e6}},capabilities:{worktrees:!0,mcp:!0,slashCommands:!0,workflows:!0,agentTeams:!0,subagentTranscripts:!0,nestedSubagents:!1,sharing:!0,goals:"transcript",undo:!0,redo:!0,nativeRewind:!1,fileCheckpoints:!0,reasoningEffort:!0,fastTier:!0,imageInput:!0,planMode:!0,midTurnSteering:!1,stopSession:!0,ultracode:!0,contextWindow:!0,externalProcesses:!1,accountSwitching:!0,modelFallbackNotices:!0,autoPermissionMode:"per-model",settingsApply:"live",turnLiveness:"transcript",tokenStreaming:!0,nativeFork:!1,namedSessions:!0}},vt={appServerValue:"priority",cliConfigValue:"fast"},Pe={kind:"codex",displayName:"Codex",binName:"codex",dirName:At(Et),sessionFile:{name:(t,e=new Date)=>{const n=String(e.getFullYear()),s=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0"),f=String(e.getSeconds()).padStart(2,"0");return`${n}/${s}/${o}/rollout-${n}-${s}-${o}T${i}-${l}-${f}-${t}.jsonl`},sessionId:St,...wt},metadataFromHead:!1,resume:{command:(t,e)=>e?`codex -C ${Mt(e)} resume ${t}`:`codex resume ${t}`,args:t=>["resume",t]},launchArgs:{permissions:t=>{const e=(t==null?void 0:t.mode)||"default";return e==="bypassPermissions"?["--dangerously-bypass-approvals-and-sandbox"]:["--sandbox",e==="plan"?"read-only":"workspace-write","-c",'approval_policy="never"']},model:t=>H("-m",t),effort:t=>t?["-c",`model_reasoning_effort=${JSON.stringify(t)}`]:[],fastTier:t=>t?["-c",`service_tier=${JSON.stringify(vt.cliConfigValue)}`,"--enable","fast_mode"]:[]},serviceTier:vt,cli:{packageName:"@openai/codex",homebrew:{name:"codex",cask:!1},wingetId:null,versionArgs:["--version"],selfUpdate:null,bundledBySdk:!1,homeDirName:".codex",homeEnvVar:"CODEX_HOME",installMarker:"",homeIsDiscoverable:!0,process:{by:"command",sessionIdFromCommand:t=>nt(t,new RegExp(`codex(?:\\s+\\S+)*\\s+exec\\s+resume\\s+(${st})`))}},config:{rootDirName:".codex",instructions:[{in:"scope",path:"AGENTS.md",scopes:["global","project"]}],settings:[{in:"root",path:"config.toml",scopes:["global","project"]}],skillsDir:"skills",agentsDir:"agents",commandsDir:"prompts",themesDir:null,pluginsDir:null,pluginManifestDir:null},contextWindow:{defaultLimit:272e3,limits:[],compactBuffer:0,extendedContext:null},capabilities:{worktrees:!1,mcp:!1,slashCommands:!1,workflows:!1,agentTeams:!1,subagentTranscripts:!0,nestedSubagents:!0,sharing:!1,goals:"thread-api",undo:!0,redo:!0,nativeRewind:!1,fileCheckpoints:!1,reasoningEffort:!0,fastTier:!0,imageInput:!0,planMode:!0,midTurnSteering:!0,stopSession:!1,ultracode:!1,contextWindow:!1,externalProcesses:!1,accountSwitching:!1,modelFallbackNotices:!1,autoPermissionMode:"never",settingsApply:"next-turn",turnLiveness:"runtime",tokenStreaming:!0,nativeFork:!1,namedSessions:!1}},Fe={kind:"copilot",displayName:"GitHub Copilot CLI",binName:"copilot",dirName:At(Nt),sessionFile:{name:t=>`${t}/events.jsonl`,sessionId:t=>{const e=new RegExp(`^(${mt})/events\\.jsonl$`,"i").exec(t);return e?e[1]:null},urlId:t=>{const e=new RegExp(`^(${mt})/events\\.jsonl$`,"i").exec(t);return e?e[1]:t.replace(/\.jsonl$/,"")},fileNameFromUrlId:t=>t.endsWith(".jsonl")?t:`${t}/events.jsonl`},metadataFromHead:!0,resume:{command:(t,e)=>e?`copilot -C ${Mt(e)} --resume ${t}`:`copilot --resume ${t}`,args:t=>[`--resume=${t}`]},launchArgs:{permissions:t=>(t==null?void 0:t.mode)==="bypassPermissions"||(t==null?void 0:t.mode)==="auto"?["--allow-all"]:[],model:t=>H("--model",t),effort:t=>H("--reasoning-effort",t),fastTier:()=>[]},serviceTier:null,cli:{packageName:"@github/copilot",homebrew:{name:"copilot-cli",cask:!0},wingetId:"GitHub.Copilot",versionArgs:["--version"],selfUpdate:{args:["update"],matches:t=>t.endsWith("/.local/bin/copilot")||t==="/usr/local/bin/copilot"},bundledBySdk:!1,homeDirName:".copilot",homeEnvVar:"COPILOT_HOME",installMarker:"session-state",homeIsDiscoverable:!0,process:{by:"executable",sessionIdFromCommand:t=>nt(t,new RegExp(`--resume(?:=|\\s+)(${st})`))}},config:{rootDirName:".copilot",instructions:[{in:"scope",path:"AGENTS.md",scopes:["global","project"]}],settings:[{in:"root",path:"config.json",scopes:["global"]}],skillsDir:"skills",agentsDir:null,commandsDir:null,themesDir:null,pluginsDir:null,pluginManifestDir:null},contextWindow:{defaultLimit:2e5,limits:[],compactBuffer:0,extendedContext:null},capabilities:{worktrees:!1,mcp:!1,slashCommands:!1,workflows:!1,agentTeams:!1,subagentTranscripts:!1,nestedSubagents:!1,sharing:!1,goals:!1,undo:!0,redo:!1,nativeRewind:!0,fileCheckpoints:!1,reasoningEffort:!1,fastTier:!1,imageInput:!1,planMode:!0,midTurnSteering:!0,stopSession:!0,ultracode:!1,contextWindow:!1,externalProcesses:!0,accountSwitching:!1,modelFallbackNotices:!1,autoPermissionMode:"always",settingsApply:"next-turn",turnLiveness:"runtime",tokenStreaming:!1,nativeFork:!0,namedSessions:!0}},$e=Object.freeze({claude:Re,codex:Pe,copilot:Fe});function gt(t){return $e[t]}function ht(t){return t.type==="user"}function _t(t){return t.type==="assistant"}function Bt(t){return t.type==="progress"}function Rt(t){return t.type==="system"}function Pt(t){return t.type==="summary"}function Ue(t){return t.type==="queue-operation"}function Ft(t){return t.type==="attachment"}function De(t){return t.type==="user"&&t.isCompactSummary===!0}function $t(t){return t.type==="system"&&t.subtype==="compact_boundary"}function Ut(t,e){let n=0;for(const s of t)e[s.name]=(e[s.name]??0)+1,s.isError&&n++;return n}function Dt(t,e){t.totalInputTokens+=e.input_tokens,t.totalOutputTokens+=e.output_tokens,t.totalCacheCreationTokens+=e.cache_creation_input_tokens??0,t.totalCacheReadTokens+=e.cache_read_input_tokens??0}function ot(t){return{totalInputTokens:0,totalOutputTokens:0,totalCacheCreationTokens:0,totalCacheReadTokens:0,toolCallCounts:{},errorCount:0,totalDurationMs:0,turnCount:t}}function it(t){const e=ot(t.length);for(const n of t){n.tokenUsage&&Dt(e,n.tokenUsage),n.durationMs&&(e.totalDurationMs+=n.durationMs),e.errorCount+=Ut(n.toolCalls,e.toolCallCounts);for(const s of n.subAgentActivity)e.errorCount+=Ut(s.toolCalls,e.toolCallCounts),s.tokenUsage&&Dt(e,s.tokenUsage)}return e}const Oe=/<(agent-message|teammate-message)([^>]*)>([\s\S]*?)<\/\1>/g,je=[/\bteammate_id=(?:"([^"]*)"|'([^']*)')/,/\bfrom=(?:"([^"]*)"|'([^']*)')/];function Le(t){for(const e of je){const n=t.match(e),s=(n==null?void 0:n[1])??(n==null?void 0:n[2]);if(s)return s}return null}function yt(t){let e=null,n=!1;const s=t.replace(Oe,(o,i,l,f)=>(n=!0,e===null&&(e=Le(l)),f.trim()));return{sender:e,matched:n,body:n?s.trim():t}}function rt(t){return typeof t=="string"?t:t.filter(e=>e.type==="text").map(e=>e.text).join(`
|
|
2
2
|
`)}function Ot(t){return t?typeof t=="string"?t:t.map(e=>e.type==="text"?e.text:"").filter(Boolean).join(`
|
|
3
3
|
`):""}function jt(t){if(!(t!=null&&t.trim()))return!1;const e=t.trimStart();return e.startsWith("<")?!e.includes("<task-notification>")&&!e.startsWith("<system-reminder>")&&!e.startsWith("<local-command-"):!0}const We=/<task-notification>[\s\S]*?<\/task-notification>/g,qe=/<[^>]*>/g;function ze(t){var n;if(((n=t.origin)==null?void 0:n.kind)==="task-notification")return!0;const e=rt(t.message.content);return e.includes("<task-notification>")?e.replace(We,"").replace(qe,"").trim()==="":!1}function Je(t){if(!Ft(t))return null;const e=t.attachment;if(!e||e.type!=="queued_command"||e.commandMode!=="prompt")return null;const n=e.prompt;if(n==null)return null;const s=typeof n=="string"?n:rt(n);if(!jt(s))return null;const o=e.origin;if((o==null?void 0:o.kind)==="peer"){const l=o.name??o.from??null;if(l)return{raw:s,sender:l,body:o.body??yt(s).body}}if((o==null?void 0:o.kind)==="human")return{raw:s,sender:null,body:s};const i=yt(s);return{raw:s,sender:i.sender,body:i.body}}const Ve=[["attributionAgent","agent"],["attributionSkill","skill"],["attributionPlugin","plugin"],["attributionMcpServer","mcpServer"],["attributionMcpTool","mcpTool"]];function Ke(t,e){let n=t;for(const[s,o]of Ve){const i=e[s];typeof i!="string"||!i||(n={...n,[o]:i})}return n}function Ge(t,e){var s,o;if(!t)return{...e};const n=(((s=t.output_tokens_details)==null?void 0:s.thinking_tokens)??0)+(((o=e.output_tokens_details)==null?void 0:o.thinking_tokens)??0);return{input_tokens:t.input_tokens+e.input_tokens,output_tokens:t.output_tokens+e.output_tokens,cache_creation_input_tokens:(t.cache_creation_input_tokens??0)+(e.cache_creation_input_tokens??0),cache_read_input_tokens:(t.cache_read_input_tokens??0)+(e.cache_read_input_tokens??0),speed:e.speed??t.speed,...t.output_tokens_details||e.output_tokens_details?{output_tokens_details:{thinking_tokens:n}}:{}}}const Qe=/^This session is being continued from a previous conversation[\s\S]*?\n\nSummary:\s*\n/,He=/\n+(?:If you need specific details from before compaction|(?:Please c|C)ontinue the conversation from where it left off)[\s\S]*$/;function Xe(t){return rt(t).trim().replace(Qe,"").replace(He,"").trim()}function Ze(t){if(t)return{trigger:t.trigger,preTokens:t.preTokens,postTokens:t.postTokens}}function at(t,e){return{id:t.uuid??crypto.randomUUID(),userMessage:e,contentBlocks:[],thinking:[],assistantText:[],toolCalls:[],subAgentActivity:[],timestamp:t.timestamp??"",durationMs:null,tokenUsage:null,model:null}}function Ye(t){const e=[];let n=0;for(;n<t.length;){const s=t[n];if(s.kind==="tool_calls"){const o=s.toolCalls.findIndex(i=>i.name==="EnterPlanMode");if(o!==-1){const i=s.toolCalls[o],l=String(i.input.plan??""),f=s.timestamp,h=s.toolCalls.slice(0,o);h.length>0&&e.push({kind:"tool_calls",toolCalls:h,timestamp:s.timestamp});const b=[],T=s.toolCalls.slice(o+1),_=T.findIndex(k=>k.name==="ExitPlanMode");if(_!==-1){b.push(...T.slice(0,_));const k=T[_],p=k.input.path?String(k.input.path):void 0;let N="pending";k.result!==null&&(N=k.isError?"rejected":"approved"),e.push({kind:"plan_mode",plan:l,planFilePath:p,status:N,toolCalls:b,timestamp:f});const E=T.slice(_+1);E.length>0&&e.push({kind:"tool_calls",toolCalls:E,timestamp:s.timestamp}),n++;continue}else{b.push(...T);let k,p,N="pending",E=n+1;const M=[];for(;E<t.length;){const v=t[E];if(v.kind==="tool_calls"){const R=v.toolCalls.findIndex(U=>U.name==="ExitPlanMode");if(R!==-1){b.push(...v.toolCalls.slice(0,R)),k=v.toolCalls[R],p=k.input.path?String(k.input.path):void 0,k.result!==null&&(N=k.isError?"rejected":"approved");const U=v.toolCalls.slice(R+1);e.push({kind:"plan_mode",plan:l,planFilePath:p,status:N,toolCalls:b,timestamp:f}),e.push(...M),U.length>0&&e.push({kind:"tool_calls",toolCalls:U,timestamp:v.timestamp}),n=E+1;break}else b.push(...v.toolCalls),E++}else if(v.kind==="hook_event"||v.kind==="text"||v.kind==="queued_prompt"||v.kind==="agent_message")M.push(v),E++;else break}k||(e.push({kind:"plan_mode",plan:l,planFilePath:void 0,status:"pending",toolCalls:b,timestamp:f}),e.push(...M),n=E);continue}}}e.push(s),n++}return e}function tn(t){return t.contentBlocks.some(e=>e.kind==="agent_message")?{...t,contentBlocks:t.contentBlocks.map(e=>{if(e.kind!=="agent_message")return e;const{reply:n,...s}=e;return s})}:t}function Lt(t){var s;const e=t.map(tn),n=new Map;for(const o of e)for(const i of o.contentBlocks){if(i.kind==="agent_message"){const l=n.get(i.sender);l?l.push(i):n.set(i.sender,[i]);continue}if(i.kind==="tool_calls")for(const l of i.toolCalls){if(l.name!=="SendMessage")continue;const f=l.input.to;if(typeof f!="string"||!f)continue;const h=(s=n.get(f))==null?void 0:s.shift();if(!h)continue;const b=l.input.summary;h.reply={summary:typeof b=="string"?b:"",timestamp:l.timestamp||i.timestamp||""}}}return e}function en(t){const e=[];let n=!1;for(let s=0;s<t.length;s++){const o=t[s];if(Pt(o)||$t(o)){n=!1;continue}if(ht(o)&&!o.isMeta){const i=o.message.content;if(n&&Array.isArray(i)&&i.some(f=>f.type==="tool_result"))continue;e.push(s),n=!0;continue}_t(o)&&!n&&(e.push(s),n=!0)}return e}function Wt(t){var D,S;const e=[],n=[];let s=null,o=0,i=null,l=null;function f(r){l&&(r.compactionSummary=l.summary,r.compactionMeta=l.meta,l=null)}let h=null;const b=new Map,T=new Set,_=new Map,k=new Map,p=new Set,N=new Map,E=[],M=new Map;function v(r,c){let m=M.get(r);m||(m=new Map,M.set(r,m)),m.set(c,(m.get(c)??0)+1)}function R(r,c){const m=M.get(r),d=m==null?void 0:m.get(c);return!m||!d?!1:(d===1?m.delete(c):m.set(c,d-1),!0)}function U(){for(const r of E)r.turn.contentBlocks.push(r.sender?{kind:"agent_message",sender:r.sender,body:r.body,timestamp:r.timestamp}:{kind:"queued_prompt",content:r.content,timestamp:r.timestamp});E.length=0}function j(r){if(!i)return;const c=_.get(r);if(!c||c.length===0)return;i.subAgentActivity.push(...c),_.delete(r);const m=p.has(r)?"background_agent":"sub_agent",d=k.get(r);if(d)d.messages.push(...c);else{const a={kind:m,messages:[...c]};i.contentBlocks.push(a),k.set(r,a)}}function L(){if(i){for(const r of i.toolCalls)j(r.id);for(const[r]of _)j(r);for(const r of i.contentBlocks)if(r.kind==="hook_event")for(const c of r.events){if(!(c.eventName==="PostToolUse"||c.eventName.startsWith("PostToolUse:"))||!c.toolUseId)continue;const d=i.toolCalls.find(a=>a.id===c.toolUseId);d&&(c.updatedToolOutput&&(d.outputReplacedByHook=!0),c.durationMs!==void 0&&(d.hookDurationMs=(d.hookDurationMs??0)+c.durationMs))}i.contentBlocks=Ye(i.contentBlocks),e.push(i),s!==null&&n.push(s),s=null,i=null,k.clear()}}for(o=0;o<t.length;o++){const r=t[o];if(Pt(r)){L(),l={summary:r.summary};continue}if($t(r)){L(),l={meta:Ze(r.compactMetadata)};continue}if(De(r)){L(),s=o,i=at(r,null),i.compactionSummary=Xe(r.message.content),i.compactionMeta=l==null?void 0:l.meta,l=null;continue}if(Rt(r)&&r.subtype==="away_summary"&&r.content){h={content:r.content,timestamp:r.timestamp};continue}if(Ue(r)){if(i&&r.operation==="enqueue"&&jt(r.content)){const c=yt(r.content);E.push({turn:i,content:r.content,timestamp:r.timestamp,sender:c.sender,body:c.body}),v(i,r.content)}continue}if(Ft(r)){const c=Je(r);i&&c!==null&&!R(i,c.raw)&&E.push({turn:i,content:c.raw,timestamp:((D=r.attachment)==null?void 0:D.timestamp)??r.timestamp,sender:c.sender,body:c.body});continue}if(E.length>0){const c=ht(r)&&!r.isMeta?r.message.content:null;if(typeof c=="string"){const m=E.findIndex(d=>d.content===c);if(m>=0){const[d]=E.splice(m,1);R(d.turn,d.content)}}U()}if(ht(r)&&!r.isMeta){const c=r.message.content;if(typeof c!="string"&&Array.isArray(c)&&c.some(d=>d.type==="tool_result")&&i){for(const a of c)if(a.type==="tool_result"){const y=b.get(a.tool_use_id);y&&(y.turn.toolCalls[y.index].result=Ot(a.content),y.turn.toolCalls[y.index].isError=a.is_error===!0,b.delete(a.tool_use_id))}const d=r.toolUseResult;if(d!=null&&d.agentId){const a=((S=c.find(I=>I.type==="tool_result"))==null?void 0:S.tool_use_id)??"",y=N.get(a),u=p.has(a),C=[];if(Array.isArray(d.content))for(const I of d.content)I.type==="text"&&C.push(I.text);const g={agentId:d.agentId,parentToolUseId:a||void 0,agentName:(y==null?void 0:y.name)??null,subagentType:(y==null?void 0:y.subagentType)??null,type:"assistant",content:d.content,toolCalls:[],thinking:[],text:C,timestamp:r.timestamp??"",tokenUsage:d.usage?{input_tokens:d.usage.input_tokens??0,output_tokens:d.usage.output_tokens??0,cache_creation_input_tokens:d.usage.cache_creation_input_tokens??0,cache_read_input_tokens:d.usage.cache_read_input_tokens??0}:null,model:null,isBackground:u,prompt:d.prompt,status:d.status,durationMs:d.totalDurationMs,toolUseCount:d.totalToolUseCount};if(!k.get(a)){i.subAgentActivity.push(g);const w={kind:u?"background_agent":"sub_agent",messages:[g]};i.contentBlocks.push(w),k.set(a,w)}}continue}if(ze(r)){const m={kind:"task_notification",content:rt(c),timestamp:r.timestamp};if(i){i.contentBlocks.push(m);continue}s=o,i=at(r,null),i.contentBlocks.push(m),f(i);continue}L(),s=o,i=at(r,r.message.content),f(i),h&&(i.contentBlocks.push({kind:"recap",content:h.content,timestamp:h.timestamp}),h=null);continue}if(_t(r)){let c=function(){u.length>0&&(C.contentBlocks.push({kind:"tool_calls",toolCalls:[...u],timestamp:a}),u.length=0)},m=function(){if(y.length>0){const g=C.contentBlocks[C.contentBlocks.length-1];g&&g.kind==="thinking"?g.blocks.push(...y):C.contentBlocks.push({kind:"thinking",blocks:[...y],timestamp:a}),y.length=0}};i||(s=o,i=at(r,null),f(i)),i.model=r.message.model,r.effort&&(i.effort=r.effort),i.attribution=Ke(i.attribution,r);const d=r.message.id;T.has(d)||(T.add(d),i.tokenUsage=Ge(i.tokenUsage,r.message.usage));const a=r.timestamp??"",y=[],u=[],C=i;for(const g of r.message.content)if(g.type==="thinking"){c();const x=g;if(!x.thinking)continue;i.thinking.push(x),y.push(x)}else if(g.type==="text"){c(),m();const x=/<thinking>([\s\S]*?)<\/thinking>/g;let I=g.text,w;for(;(w=x.exec(g.text))!==null;){const $=w[1].trim();if($){const B={type:"thinking",thinking:$,signature:""};i.thinking.push(B),i.contentBlocks.push({kind:"thinking",blocks:[B],timestamp:a})}I=I.replace(w[0],"")}if(I=I.trim(),I){i.assistantText.push(I);const $=i.contentBlocks[i.contentBlocks.length-1];$&&$.kind==="text"?$.text.push(I):i.contentBlocks.push({kind:"text",text:[I],timestamp:a})}}else if(g.type==="tool_use"){m();const x={id:g.id,name:g.name,input:g.input,result:null,isError:!1,timestamp:r.timestamp??""},I=i.toolCalls.length;if(i.toolCalls.push(x),u.push(x),b.set(g.id,{turn:i,index:I}),g.name==="Task"||g.name==="Agent"){const w=g.input;w.run_in_background===!0&&p.add(g.id),N.set(g.id,{name:w.name??null,subagentType:w.subagent_type??null})}}m(),c();continue}if(Bt(r)&&r.data.type==="agent_progress"){const c=r.data,m=r.parentToolUseID??"";let d=null;if(c.message.type==="assistant"){const g=c.message.message,x=g.id,I=g.usage;I&&x&&!T.has(x)&&(T.add(x),d={input_tokens:I.input_tokens??0,output_tokens:I.output_tokens??0,cache_creation_input_tokens:I.cache_creation_input_tokens??0,cache_read_input_tokens:I.cache_read_input_tokens??0})}const a=c.message.type==="assistant"?c.message.message.model??null:null,y=N.get(m),u={agentId:c.agentId,parentToolUseId:m||void 0,agentName:(y==null?void 0:y.name)??null,subagentType:(y==null?void 0:y.subagentType)??null,type:c.message.type,content:c.message.message.content,toolCalls:[],thinking:[],text:[],timestamp:c.message.timestamp??r.timestamp??"",tokenUsage:d,model:a,isBackground:p.has(m)};if(c.message.type==="assistant"){const g=c.message.message.content;if(Array.isArray(g))for(const x of g)x.type==="thinking"?u.thinking.push(x.thinking):x.type==="text"?u.text.push(x.text):x.type==="tool_use"&&u.toolCalls.push({id:x.id,name:x.name,input:x.input,result:null,isError:!1,timestamp:c.message.timestamp??r.timestamp??""})}else if(c.message.type==="user"){const g=c.message.message.content;if(Array.isArray(g)){for(const x of g)if(x.type==="tool_result"){const I=_.get(m);if(I)for(const w of I){const $=w.toolCalls.find(B=>B.id===x.tool_use_id);$&&($.result=Ot(x.content),$.isError=x.is_error===!0)}}}}let C=_.get(m);C||(C=[],_.set(m,C)),C.push(u),i&&j(m);continue}if(Bt(r)&&r.data.type==="hook_progress"){const c=r.data,m=String(c.hook_event_name??c.hookEvent??"unknown"),d=c.hookSpecificOutput,a={eventName:m,source:c.source!==void 0?String(c.source):void 0,toolName:c.tool_name!==void 0?String(c.tool_name):void 0,toolUseId:c.tool_use_id!==void 0?String(c.tool_use_id):void 0,command:c.command!==void 0?String(c.command):void 0,output:c.output!==void 0?String(c.output):void 0,stderr:c.stderr!==void 0?String(c.stderr):void 0,exitCode:c.exit_code!==void 0?Number(c.exit_code):void 0,decision:c.decision!==void 0?String(c.decision):void 0,durationMs:c.duration_ms!==void 0?Number(c.duration_ms):void 0,updatedToolOutput:(d==null?void 0:d.updatedToolOutput)!==void 0?String(d.updatedToolOutput):void 0,sessionTitle:(d==null?void 0:d.sessionTitle)!==void 0?String(d.sessionTitle):void 0,worktreePath:(d==null?void 0:d.worktreePath)!==void 0?String(d.worktreePath):void 0,timestamp:r.timestamp??""};if(i){const y=i.contentBlocks[i.contentBlocks.length-1];y&&y.kind==="hook_event"?y.events.push(a):i.contentBlocks.push({kind:"hook_event",events:[a],timestamp:r.timestamp})}continue}if(Rt(r)&&r.subtype==="turn_duration"&&i){r.durationMs!==void 0&&r.durationMs!==null&&(i.durationMs=(i.durationMs??0)+r.durationMs);continue}}return U(),L(),{turns:Lt(e),turnStartIndices:n}}function qt(t){return Wt(t).turns}function zt(){return!0}function Jt(t){const e=[];for(const n of t){const s=n.trim();if(s)try{e.push(JSON.parse(s))}catch{}}return e}function Vt(t){return Jt(t.split(`
|
|
4
4
|
`))}function Kt(t){const e={sessionId:"",version:"",gitBranch:"",cwd:"",slug:"",name:"",model:"",branchedFrom:void 0};for(const n of t)if(n.sessionId&&!e.sessionId&&(e.sessionId=n.sessionId),n.version&&!e.version&&(e.version=n.version),n.gitBranch&&!e.gitBranch&&(e.gitBranch=n.gitBranch),n.cwd&&!e.cwd&&(e.cwd=n.cwd),n.slug&&!e.slug&&(e.slug=n.slug),n.name&&!e.name&&(e.name=n.name),n.branchedFrom&&!e.branchedFrom&&(e.branchedFrom=n.branchedFrom),_t(n)&&n.message.model&&!e.model&&(e.model=n.message.model),e.sessionId&&e.version&&e.gitBranch&&e.cwd&&e.model)break;return e}function nn(t){return Kt(Jt(t))}function sn(t,e){const n=Vt(t),s=Kt(n),o=qt(n),i=e!=null&&e.skipStats?ot(o.length):it(o);return{...s,turns:o,stats:i,rawMessages:e!=null&&e.skipStats?[]:n,agentKind:"claude"}}function on(t,e){const n=Vt(e);if(n.length===0)return t;const s=t.rawMessages,o=[...s,...n],i=en(s),l=Math.max(0,t.turns.length-i.length);let f=Math.max(0,i.length-1);const h=new Set;for(const N of n)if(N.type==="progress"){const E=N.parentToolUseID;E&&h.add(E)}if(h.size>0)for(let N=f-1;N>=0;N--){const E=t.turns[l+N];if(E!=null&&E.toolCalls.some(M=>h.has(M.id))){f=N;break}}const b=i[f]??s.length,T=t.turns.slice(0,l+f),_=qt(o.slice(b)),k=Lt([...T,..._]),p=it(k);return{sessionId:t.sessionId,version:t.version,gitBranch:t.gitBranch,cwd:t.cwd,slug:t.slug,name:t.name,model:t.model||k.length>0&&k[k.length-1].model||"",turns:k,stats:p,rawMessages:o,branchedFrom:t.branchedFrom,agentKind:t.agentKind}}const Gt="<task-notification>",rn=/<task-id>([^<]+)<\/task-id>/g,an=/<tool-use-id>([^<]+)<\/tool-use-id>/g;function W(t){return typeof t=="object"&&t!==null}function ln(t){const e=W(t.message)?t.message:null,n=e==null?void 0:e.content;return typeof n=="string"?[n]:Array.isArray(n)?n.filter(s=>W(s)&&typeof s.text=="string").map(s=>s.text):[]}function cn(t){const e=[],n=new Set,s=new Set,o=new Set;function i(l,f){if(l.includes(Gt)){for(const h of l.matchAll(rn))n.add(h[1]),f==null||f.add(h[1]);for(const h of l.matchAll(an))n.add(h[1]),f==null||f.add(h[1])}}for(const l of t){if(l.type==="user"){const f=W(l.toolUseResult)?l.toolUseResult:null;if((f==null?void 0:f.status)==="async_launched"){const h=W(l.message)?l.message:null,T=(Array.isArray(h==null?void 0:h.content)?h.content:[]).filter(p=>W(p)&&p.type==="tool_result").map(p=>p.tool_use_id),_=[f.agentId,f.taskId,...T].filter(p=>typeof p=="string"&&p.length>0),k=[f.description,f.workflowName,f.summary].find(p=>typeof p=="string"&&p.length>0)??"";_.length>0&&e.push({ids:_,description:k})}for(const h of ln(l))i(h,o);continue}if(l.type==="assistant"){const f=W(l.message)?l.message:null,h=Array.isArray(f==null?void 0:f.content)?f.content:[];for(const b of h){if(!W(b)||b.type!=="tool_use"||b.name!=="TaskStop")continue;const T=W(b.input)?b.input:null,_=(T==null?void 0:T.task_id)??(T==null?void 0:T.shell_id);typeof _=="string"&&n.add(_)}continue}if(l.type==="attachment"){const f=W(l.attachment)?l.attachment:null;typeof(f==null?void 0:f.prompt)=="string"&&i(f.prompt,o);continue}if(l.type==="queue-operation"&&typeof l.content=="string"){const f=l.operation;i(l.content,f==="enqueue"?s:o)}}return{pendingDescriptions:e.filter(l=>!l.ids.some(f=>n.has(f))).map(l=>l.description),undeliveredNotifications:[...s].filter(l=>!o.has(l)).length}}function un(t,e){return{status:"awaiting_agents",pendingQueue:e,pendingAgents:t.length,pendingAgentDescriptions:t.filter(n=>n.length>0)}}function dn(t){var l,f;let e=0,n=null,s=!1;function o(h,b){const T={status:h,pendingQueue:Math.max(0,e)};return b&&(T.toolName=b),T}function i(){return n??(n=cn(t))}for(let h=t.length-1;h>=0;h--){const b=t[h];if(b.type!=="queue-operation"){if(b.type==="progress"){const T=b.data;if((T==null?void 0:T.type)==="hook_progress"&&(T.decision??((l=T.hookSpecificOutput)==null?void 0:l.permissionDecision))==="defer")return o("deferred");break}break}}for(let h=t.length-1;h>=0;h--){const b=t[h];if(b.type==="queue-operation"){if(typeof b.content=="string"&&b.content.includes(Gt))continue;const T=b.operation;T==="enqueue"?e++:(T==="dequeue"||T==="remove")&&e--;continue}if(b.type==="attachment"){const T=W(b.attachment)?b.attachment:null;(T==null?void 0:T.commandMode)==="task-notification"&&(s=!0);continue}if(b.type==="assistant"){const T=b.message,_=T==null?void 0:T.stop_reason;if(_==="end_turn"){const k=i();if(s||k.undeliveredNotifications>0)return o("processing");if(k.pendingDescriptions.length>0)return un(k.pendingDescriptions,Math.max(0,e));let p=!1;for(let N=h-1;N>=0;N--){const E=t[N];if(E.type==="user"&&!E.isMeta){p=!0;break}}return o(p?"completed":"idle")}if(_==="tool_use"){const k=T==null?void 0:T.content,p=(f=k==null?void 0:k.findLast)==null?void 0:f.call(k,N=>N.type==="tool_use");return o("tool_use",p==null?void 0:p.name)}return o("thinking")}if(b.type==="user"){if(b.isMeta)continue;return o("processing")}if(b.type==="system"&&b.subtype==="terminal_reason"){const T=b.reason;if(T)return{status:"completed",terminalReason:T,pendingQueue:Math.max(0,e)};continue}b.type!=="summary"&&b.type==="system"&&b.subtype}return{status:"idle"}}function pn(t,e,n){const s=typeof t.sessionId=="string"?t.sessionId:"";return{record:{...t,sessionId:e,branchedFrom:{sessionId:s,turnIndex:n}},originalId:s}}function fn(t){return Wt(t).turnStartIndices}function Qt(t,e,n){if(!e)return;t.assistantText.push(e);const s=t.contentBlocks[t.contentBlocks.length-1];if((s==null?void 0:s.kind)==="text"){s.text.push(e);return}t.contentBlocks.push({kind:"text",text:[e],timestamp:n})}const Ht={0:"\0",b:"\b",f:"\f",n:`
|