cogpit 2.7.4 → 3.0.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 +5524 -3838
- package/dist/web/assets/CommandPaletteHost-fa5vgo7-.js +1 -0
- package/dist/web/assets/ConfigBrowser-CXvr5BFb.js +1 -0
- package/dist/web/assets/HighlightedEditor-DWc-xoSc.js +2 -0
- package/dist/web/assets/{KeyboardShortcutsDialog-DQuepxQo.js → KeyboardShortcutsDialog-C1of2PBc.js} +1 -1
- package/dist/web/assets/{MobileFileChanges-B6rggNR6.js → MobileFileChanges-BAEIKapA.js} +1 -1
- package/dist/web/assets/PluginsDialog-BgnTB0-z.js +1 -0
- package/dist/web/assets/PreviewPanel-DgbgRibz.js +1 -0
- package/dist/web/assets/ProjectFilesPanel-BGpyS_aw.js +4 -0
- package/dist/web/assets/ProjectSwitcherModal-CEypvUNm.js +1 -0
- package/dist/web/assets/{TerminalOutput-CUmbXM9h.js → TerminalOutput-Dq6QP83Y.js} +13 -13
- package/dist/web/assets/ThemeSelectorModal-DeYABHF9.js +1 -0
- package/dist/web/assets/WorkflowsPanel-CNxUSC9Q.js +1 -0
- package/dist/web/assets/WorktreePanel-DJYEUobs.js +1 -0
- package/dist/web/assets/edition-ui-CFlDe2_U.js +2 -0
- package/dist/web/assets/index-Bm91RnFy.js +1 -0
- package/dist/web/assets/index-Ch-IpPaH.js +1 -0
- package/dist/web/assets/index-DVp2Xjmx.js +1 -0
- package/dist/web/assets/{index-BA1eUNuR.js → index-DYugSKH5.js} +4 -4
- package/dist/web/assets/index-DsnL-sXV.js +472 -0
- package/dist/web/assets/index-TCQKag8a.css +1 -0
- package/dist/web/assets/password-BV9mqUzz.js +1 -0
- package/dist/web/assets/{session-parser.worker-CnA52U1J.js → session-parser.worker-CXlsiJzz.js} +24 -24
- package/dist/web/assets/{vendor-ui-ZKZkD5k3.js → vendor-ui-Br3ZTAXZ.js} +237 -167
- package/dist/web/index.html +6 -6
- package/dist/web/theme-bootstrap.js +1 -25
- package/package.json +1 -1
- package/dist/web/assets/CommandPaletteHost-ByD_7YRK.js +0 -1
- package/dist/web/assets/ConfigBrowser-vXK8JNMg.js +0 -1
- package/dist/web/assets/HighlightedEditor-BwET41dr.js +0 -2
- package/dist/web/assets/PluginsDialog-DTF9NnK7.js +0 -1
- package/dist/web/assets/PreviewPanel-BaXxki5D.js +0 -1
- package/dist/web/assets/ProjectFilesPanel-CO6Znhgi.js +0 -4
- package/dist/web/assets/ProjectSwitcherModal-Chi-U3vv.js +0 -1
- package/dist/web/assets/TerminalOutput-6GBZ9nXN.css +0 -32
- package/dist/web/assets/ThemeSelectorModal-B2m42_1f.js +0 -1
- package/dist/web/assets/WorkflowsPanel-CiYzHaQg.js +0 -1
- package/dist/web/assets/WorktreePanel-CldMZY3n.js +0 -1
- package/dist/web/assets/index-C-0I_ZqI.js +0 -1
- package/dist/web/assets/index-C6wvrmo0.js +0 -221
- package/dist/web/assets/index-CYN2JttE.js +0 -1
- package/dist/web/assets/index-DYWsIgvZ.css +0 -1
- package/dist/web/assets/index-QH_v3Ygj.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as Z,j as t,r as v}from"./vendor-react-gGw_S5I_.js";import{J as Ze,C as le,a$ as Ae,b0 as J,m as ut,n as ft,I as mt,E as _t,G as Et,b1 as $t,B as ce,b2 as ht,U as Ie,b3 as xt,$ as pt,a0 as gt,a2 as bt,b4 as nt,b5 as jt,Z as et,b6 as At,aq as zt,ar as Tt,b7 as vt,i as It,j as Dt,k as Pt,b8 as Lt,z as Rt,aI as Ut,h as Bt,D as Ft}from"./index-DsnL-sXV.js";import{a7 as Ot,a8 as Mt,a9 as Gt,aa as Ht,d as Vt,T as Wt,M as qt,ab as Xt,ac as Kt,ad as Jt,a2 as wt,C as Nt,ae as at,af as Zt,l as Qt,x as Yt,ag as es,B as ts,ah as ss,ai as ns}from"./vendor-ui-Br3ZTAXZ.js";import{P as rt}from"./password-BV9mqUzz.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function is(s){const e=Z.c(11);let n,i,a;e[0]!==s?({className:n,size:a,...i}=s,e[0]=s,e[1]=n,e[2]=i,e[3]=a):(n=e[1],i=e[2],a=e[3]);const r=a===void 0?"default":a;let l;e[4]!==n?(l=Ze("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-50",n),e[4]=n,e[5]=l):l=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(Mt,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-foreground ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"}),e[6]=f):f=e[6];let c;return e[7]!==i||e[8]!==r||e[9]!==l?(c=t.jsx(Ot,{"data-slot":"switch","data-size":r,className:l,...i,children:f}),e[7]=i,e[8]=r,e[9]=l,e[10]=c):c=e[10],c}function as(s){const e=Z.c(3),{name:n}=s,i=n.toLowerCase();if(i.includes("iphone")||i.includes("android")){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Vt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=r):r=e[0],r}if(i.includes("ipad")||i.includes("tablet")){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Wt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[1]=r):r=e[1],r}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(qt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[2]=a):a=e[2],a}function it(s){const e=Math.floor((Date.now()-s)/1e3);if(e<60)return"just now";const n=Math.floor(e/60);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ls(s){const e=[`Shared ${it(s.createdAt)}`,s.lastAccessAt>0?`opened ${it(s.lastAccessAt)}`:"never opened"];return s.guests>0&&e.push(s.guests===1?"1 guest":`${s.guests} guests`),e.join(" · ")}function rs(){const s=Z.c(12),{shares:e,revoke:n,revokeAll:i}=$t();let a;s[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("p",{className:"text-xs text-muted-foreground",children:"Shared sessions"}),s[0]=a):a=s[0];let r;s[1]!==i||s[2]!==e.length?(r=e.length>0&&t.jsx(ce,{variant:"ghost",size:"xs",className:"text-destructive hover:text-destructive",onClick:()=>void i(),children:"Revoke all"}),s[1]=i,s[2]=e.length,s[3]=r):r=s[3];let l;s[4]!==r?(l=t.jsxs("div",{className:"flex h-6 items-center justify-between",children:[a,r]}),s[4]=r,s[5]=l):l=s[5];let f;s[6]!==n||s[7]!==e?(f=e.length===0?t.jsx("p",{className:"text-xs text-muted-foreground",children:"No sessions are shared."}):t.jsx("div",{className:"flex flex-col gap-1.5",children:e.map(o=>{const m=o.title||o.sessionId;return t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border px-3 py-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm text-foreground",children:m}),t.jsx("p",{className:"text-xs text-muted-foreground",children:ls(o)})]}),t.jsx(ce,{variant:"ghost",size:"xs","aria-label":`Revoke share of ${m}`,className:"text-destructive hover:text-destructive",onClick:()=>void n(o.sessionId),children:"Revoke"})]},o.sessionId)})}),s[6]=n,s[7]=e,s[8]=f):f=s[8];let c;return s[9]!==l||s[10]!==f?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[l,f]}),s[9]=l,s[10]=f,s[11]=c):c=s[11],c}function os(s){const e=Z.c(30),{networkAccess:n,setNetworkAccess:i,networkPassword:a,setNetworkPassword:r,showNetworkPassword:l,setShowNetworkPassword:f,hasExistingPassword:c,initialNetworkAccess:o,connectedDevices:m,minPasswordLength:j}=s;let x;e[0]!==n?(x=n?t.jsx(Xt,{"data-icon":"inline-start",className:"size-4 text-success"}):t.jsx(Kt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=n,e[1]=x):x=e[1];let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=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]=b):b=e[2];let y;e[3]!==x?(y=t.jsxs("div",{className:"flex items-center gap-2",children:[x,b]}),e[3]=x,e[4]=y):y=e[4];let C;e[5]!==i?(C=_=>i(_),e[5]=i,e[6]=C):C=e[6];let w;e[7]!==n||e[8]!==C?(w=t.jsx(is,{"aria-label":"Network Access",checked:n,onCheckedChange:C}),e[7]=n,e[8]=C,e[9]=w):w=e[9];let N;e[10]!==y||e[11]!==w?(N=t.jsxs("div",{className:"flex items-center justify-between",children:[y,w]}),e[10]=y,e[11]=w,e[12]=N):N=e[12];let p;e[13]!==c||e[14]!==j||e[15]!==n||e[16]!==a||e[17]!==r||e[18]!==f||e[19]!==l?(p=n&&t.jsxs(le,{"data-invalid":a.length>0&&a.length<j,children:[t.jsx(Ae,{htmlFor:"network-password",children:"Password"}),t.jsx(J,{children:c&&a.length===0?"A password is already set. Leave blank to keep it.":`Use at least ${j} characters.`}),t.jsxs(ut,{children:[t.jsx(ft,{id:"network-password",type:l?"text":"password",value:a,onChange:_=>r(_.target.value),placeholder:c?"Enter new password to change":"Set a password for remote access"}),t.jsx(mt,{align:"inline-end",children:t.jsx(_t,{size:"icon-xs","aria-label":l?"Hide password":"Show password",onClick:()=>f(!l),children:l?t.jsx(Gt,{"data-icon":"inline-start"}):t.jsx(Ht,{"data-icon":"inline-start"})})})]}),a.length>0&&a.length<j&&t.jsxs(Et,{children:["Password must be at least ",j," characters (",a.length,"/",j,")"]}),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]=j,e[15]=n,e[16]=a,e[17]=r,e[18]=f,e[19]=l,e[20]=p):p=e[20];let u;e[21]!==m||e[22]!==o||e[23]!==n?(u=n&&o&&m.length>0&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected devices"}),t.jsx("div",{className:"flex flex-col gap-1.5",children:m.map(cs)})]}),e[21]=m,e[22]=o,e[23]=n,e[24]=u):u=e[24];let S;e[25]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(rs,{}),e[25]=S):S=e[25];let h;return e[26]!==N||e[27]!==p||e[28]!==u?(h=t.jsxs("div",{className:"flex flex-col gap-4 border-t pt-5",children:[N,p,u,S]}),e[26]=N,e[27]=p,e[28]=u,e[29]=h):h=e[29],h}function cs(s,e){return t.jsxs("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(as,{name:s.deviceName}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-foreground",children:s.deviceName}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s.ip})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"size-1.5 rounded-full bg-success"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:it(s.lastActivity)})]})]},`${s.ip}-${e}`)}const ds=["auto","path","npm","bundled","custom"],tt={source:"auto"},us=["path","npm","bundled"];function fs(s){return ds.includes(s)}function ms(s){if(!s||typeof s!="object")return;const{source:e,path:n}=s;if(!(!fs(e)||e==="auto"))return e==="custom"?typeof n=="string"&&n.trim()?{source:e,path:n.trim()}:void 0:{source:e}}const Te={auto:"Automatic",path:"Installed on PATH",npm:"Global npm install",bundled:"Bundled with Cogpit",custom:"Custom path"};function St(s,e){return e?`v${e} · ${s}`:s}function hs(s,e){return s===null?"Checking installed binaries…":e?e.version===null?`${e.path} did not report a version — check the path.`:`Now running: ${St(e.path,e.version)}`:"No launchable binary for the saved choice — sessions cannot start."}function xs(s){return s!==null&&s.version!==null}function ps(s){const e=Z.c(92),{kind:n,value:i,onChange:a,disabled:r,reportVersion:l}=s;let f;e[0]!==n?(f=ht(n),e[0]=n,e[1]=f):f=e[1];const{displayName:c}=f,[o,m]=v.useState(null),[j,x]=v.useState(!1),b=`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(bs),()=>{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,E,D,g;if(e[7]!==r||e[8]!==c||e[9]!==b||e[10]!==a||e[11]!==j||e[12]!==(o==null?void 0:o.active)||e[13]!==(o==null?void 0:o.candidates)||e[14]!==i.path||e[15]!==i.source){const I=new Map((o==null?void 0:o.candidates.map(gs))??[]);u=(o==null?void 0:o.active)??null;let te;e[29]!==r||e[30]!==b||e[31]!==a||e[32]!==i.path||e[33]!==i.source?(te=(L,F,ie,oe)=>{const lt=oe===void 0?!0:oe,K=`${b}-${L}`;return t.jsxs(le,{orientation:"horizontal",children:[t.jsx("input",{type:"radio",id:K,name:b,className:"mt-1 size-4 shrink-0 accent-primary",checked:i.source===L,disabled:r||!lt,onChange:()=>a(L==="custom"?{source:L,path:i.path??""}:{source:L})}),t.jsxs(xt,{children:[t.jsx(Ae,{htmlFor:K,children:F}),t.jsx(J,{className:"break-all",children:ie})]})]},L)},e[29]=r,e[30]=b,e[31]=a,e[32]=i.path,e[33]=i.source,e[34]=te):te=e[34],S=te;const se=L=>{const F=I.get(L);return S(L,Te[L],F?St(F.path,F.version):"Not found on this machine.",F!==void 0||i.source===L)},ze=u?`${Te[i.source]} · v${u.version??"?"}`:Te[i.source];p=pt,D=j,g=x,h="flex flex-col gap-2";let q;e[35]===Symbol.for("react.memo_cache_sentinel")?(q=t.jsx(ce,{type:"button",variant:"ghost",className:"h-auto w-full justify-between px-0 font-medium hover:bg-transparent"}),e[35]=q):q=e[35];let ne;e[36]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(Jt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[36]=ne):ne=e[36];let X;e[37]!==c?(X=t.jsxs("span",{className:"flex items-center gap-2",children:[ne,c," executable"]}),e[37]=c,e[38]=X):X=e[38];let R;e[39]!==ze?(R=t.jsx("span",{className:"truncate",children:ze}),e[39]=ze,e[40]=R):R=e[40];let U;e[41]!==j?(U=j?t.jsx(wt,{className:"size-4 shrink-0"}):t.jsx(Nt,{className:"size-4 shrink-0"}),e[41]=j,e[42]=U):U=e[42];let B;e[43]!==R||e[44]!==U?(B=t.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs font-normal text-muted-foreground",children:[R,U]}),e[43]=R,e[44]=U,e[45]=B):B=e[45],e[46]!==X||e[47]!==B?(_=t.jsxs(gt,{render:q,children:[X,B]}),e[46]=X,e[47]=B,e[48]=_):_=e[48],N=bt,w=le,e[49]===Symbol.for("react.memo_cache_sentinel")?(E=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]=E):E=e[49],z="flex flex-col gap-2 pl-1",e[50]!==S?(T=S("auto",Te.auto,"Recommended."),e[50]=S,e[51]=T):T=e[51],k=us.map(se),e[7]=r,e[8]=c,e[9]=b,e[10]=a,e[11]=j,e[12]=o==null?void 0:o.active,e[13]=o==null?void 0:o.candidates,e[14]=i.path,e[15]=i.source,e[16]=w,e[17]=N,e[18]=p,e[19]=u,e[20]=S,e[21]=h,e[22]=_,e[23]=z,e[24]=T,e[25]=k,e[26]=E,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],E=e[26],D=e[27],g=e[28];const P=`${c} executable path`,H=i.source==="custom"?i.path??"":"",re=r||i.source!=="custom";let Q;e[52]!==a?(Q=I=>a({source:"custom",path:I.target.value}),e[52]=a,e[53]=Q):Q=e[53];let $;e[54]!==P||e[55]!==H||e[56]!==re||e[57]!==Q?($=t.jsx(nt,{"aria-label":P,value:H,placeholder:"/path/to/binary",disabled:re,onChange:Q,className:"mt-1"}),e[54]=P,e[55]=H,e[56]=re,e[57]=Q,e[58]=$):$=e[58];let V;e[59]!==S||e[60]!==$?(V=S("custom",Te.custom,$),e[59]=S,e[60]=$,e[61]=V):V=e[61];let O;e[62]!==V||e[63]!==z||e[64]!==T||e[65]!==k?(O=t.jsxs("div",{className:z,children:[T,k,V]}),e[62]=V,e[63]=z,e[64]=T,e[65]=k,e[66]=O):O=e[66];let Y;e[67]!==u?(Y=xs(u)?"text-muted-foreground":"text-destructive",e[67]=u,e[68]=Y):Y=e[68];let A;e[69]!==Y?(A=Ze("text-xs",Y),e[69]=Y,e[70]=A):A=e[70];let W;e[71]!==u||e[72]!==o?(W=hs(o,u),e[71]=u,e[72]=o,e[73]=W):W=e[73];let M;e[74]!==A||e[75]!==W?(M=t.jsx("p",{className:A,"aria-live":"polite",children:W}),e[74]=A,e[75]=W,e[76]=M):M=e[76];let ee;e[77]!==w||e[78]!==O||e[79]!==M||e[80]!==E?(ee=t.jsxs(w,{children:[E,O,M]}),e[77]=w,e[78]=O,e[79]=M,e[80]=E,e[81]=ee):ee=e[81];let G;e[82]!==N||e[83]!==ee?(G=t.jsx(N,{children:ee}),e[82]=N,e[83]=ee,e[84]=G):G=e[84];let de;return e[85]!==p||e[86]!==h||e[87]!==_||e[88]!==G||e[89]!==D||e[90]!==g?(de=t.jsxs(p,{open:D,onOpenChange:g,className:h,children:[_,G]}),e[85]=p,e[86]=h,e[87]=_,e[88]=G,e[89]=D,e[90]=g,e[91]=de):de=e[91],de}function gs(s){return[s.source,s]}function bs(){}function js(s){return s.ok?s.json():null}function yt(s){return s instanceof Error?s.message:String(s)}async function ot(s){try{const e=await Ie(`/api/agent-accounts/${s}`);return e.status===404?{status:"missing"}:e.ok?await e.json():{status:"error",error:await jt(e,`Request failed (${e.status})`)}}catch(e){return{status:"error",error:yt(e)}}}function vs(s){const[e,n]=v.useState(null),[i,a]=v.useState(null),[r,l]=v.useState(null);v.useEffect(()=>{let c=!1;return ot(s).then(o=>{c||n(o)}),()=>{c=!0}},[s]);const f=v.useCallback(async c=>{a(c),l(null);try{const o=await Ie(`/api/agent-accounts/${s}/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slot:c})});if(!o.ok){l({kind:"failed",error:await jt(o,`Request failed (${o.status})`)});return}l({kind:"switched",result:await o.json()}),n(await ot(s))}catch(o){l({kind:"failed",error:yt(o)})}finally{a(null)}},[s]);return{report:e,switchingSlot:i,outcome:r,switchTo:f}}const ws={token_expired:"Token expired",relogin_required:"Login needed",no_credentials:"No credentials",keychain_unavailable:"Keychain locked",foreign_credential:"Credential mismatch",api_key:"API key",unavailable:"Usage unavailable"};function st(s){return s.alias??s.email}function ct(s){const e=Z.c(18),{label:n,window:i}=s;if(!i)return null;const a=i.pct>=80,r=i.resetsIn?`${n} window resets in ${i.resetsIn}`:void 0;let l;e[0]!==n?(l=t.jsx("span",{className:"w-5",children:n}),e[0]=n,e[1]=l):l=e[1];const f=a?"bg-destructive":"bg-primary";let c;e[2]!==f?(c=Ze("absolute inset-y-0 left-0 rounded-full",f),e[2]=f,e[3]=c):c=e[3];const o=`${i.pct}%`;let m;e[4]!==o?(m={width:o},e[4]=o,e[5]=m):m=e[5];let j;e[6]!==c||e[7]!==m?(j=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]=j):j=e[8];let x;e[9]!==i.pct?(x=Math.round(i.pct),e[9]=i.pct,e[10]=x):x=e[10];let b;e[11]!==x?(b=t.jsxs("span",{className:"tabular-nums",children:[x,"%"]}),e[11]=x,e[12]=b):b=e[12];let y;return e[13]!==r||e[14]!==l||e[15]!==j||e[16]!==b?(y=t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",title:r,children:[l,j,b]}),e[13]=r,e[14]=l,e[15]=j,e[16]=b,e[17]=y):y=e[17],y}function dt(s){return/[.!?]$/.test(s)?s:`${s}.`}function Ns(s,e){if(s.kind==="failed")return`Switch failed: ${s.error}`;const{result:n}=s,i=[dt(n.message)];return n.switched&&i.push(n.credentialStore==="keychain"?`Running ${e} sessions pick it up within about 30 seconds; restart one to apply it immediately.`:`New messages in ${e} use it from now on.`),[...i,...n.warnings.map(dt)].join(" ")}function Ss(s){const e=Z.c(41),{kind:n,disabled:i}=s;let a;e[0]!==n?(a=ht(n),e[0]=n,e[1]=a):a=e[1];const{displayName:r}=a,{report:l,switchingSlot:f,outcome:c,switchTo:o}=vs(n),[m,j]=v.useState(!1);if(l===null||l.status==="missing")return null;let x,b;if(e[2]!==l.accounts||e[3]!==l.status){x=l.status==="ok"?l.accounts:[];const g=x.find(ys)??null;b=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]=b}else x=e[4],b=e[5];const y=b;let C;e[6]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(ce,{type:"button",variant:"ghost",className:"h-auto w-full justify-between px-0 font-medium hover:bg-transparent"}),e[6]=C):C=e[6];let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(Zt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[7]=w):w=e[7];let N;e[8]!==r?(N=t.jsxs("span",{className:"flex items-center gap-2",children:[w,r," accounts"]}),e[8]=r,e[9]=N):N=e[9];let p;e[10]!==y?(p=t.jsx("span",{className:"truncate",children:y}),e[10]=y,e[11]=p):p=e[11];let u;e[12]!==m?(u=m?t.jsx(wt,{className:"size-4 shrink-0"}):t.jsx(Nt,{className:"size-4 shrink-0"}),e[12]=m,e[13]=u):u=e[13];let S;e[14]!==p||e[15]!==u?(S=t.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs font-normal text-muted-foreground",children:[p,u]}),e[14]=p,e[15]=u,e[16]=S):S=e[16];let h;e[17]!==N||e[18]!==S?(h=t.jsxs(gt,{render:C,children:[N,S]}),e[17]=N,e[18]=S,e[19]=h):h=e[19];const _=l.status==="ok"&&`Logins managed by ${l.tool}${l.version?` ${l.version}`:""}. `;let z;e[20]!==r||e[21]!==_?(z=t.jsxs(J,{children:[_,"Switching changes which login ",r," sessions authenticate with."]}),e[20]=r,e[21]=_,e[22]=z):z=e[22];let T;e[23]!==x||e[24]!==i||e[25]!==l.error||e[26]!==l.status||e[27]!==o||e[28]!==f?(T=l.status==="error"?t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:l.error}):t.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border",children:x.map(g=>{const P=f===g.slot,H=ws[g.usageStatus];return t.jsxs("li",{className:"flex items-center gap-3 px-3 py-2",children:[t.jsx("span",{className:"w-5 shrink-0 text-xs tabular-nums text-muted-foreground",children:g.slot}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[t.jsx("span",{className:"truncate text-sm font-medium",children:st(g)}),g.alias&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:g.email}),g.active&&t.jsx(et,{children:"Active"}),g.disabled&&t.jsx(et,{variant:"outline",children:"Disabled"}),H&&t.jsx(et,{variant:"destructive",children:H})]}),g.organization&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:g.organization}),g.usage&&t.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:[t.jsx(ct,{label:"5h",window:g.usage.fiveHour}),t.jsx(ct,{label:"7d",window:g.usage.sevenDay})]})]}),!i&&!g.active&&t.jsx(ce,{type:"button",size:"sm",variant:"outline",disabled:f!==null,onClick:()=>o(g.slot),"aria-label":`Switch to ${st(g)}`,children:P?t.jsxs(t.Fragment,{children:[t.jsx(at,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Switching…"]}):"Switch"})]},g.slot)})}),e[23]=x,e[24]=i,e[25]=l.error,e[26]=l.status,e[27]=o,e[28]=f,e[29]=T):T=e[29];let k;e[30]!==r||e[31]!==c?(k=c&&t.jsx("p",{className:Ze("text-xs",c.kind==="failed"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",role:c.kind==="failed"?"alert":"status",children:Ns(c,r)}),e[30]=r,e[31]=c,e[32]=k):k=e[32];let E;e[33]!==z||e[34]!==T||e[35]!==k?(E=t.jsx(bt,{children:t.jsxs(le,{children:[z,T,k]})}),e[33]=z,e[34]=T,e[35]=k,e[36]=E):E=e[36];let D;return e[37]!==m||e[38]!==E||e[39]!==h?(D=t.jsxs(pt,{open:m,onOpenChange:j,className:"flex flex-col gap-2",children:[h,E]}),e[37]=m,e[38]=E,e[39]=h,e[40]=D):D=e[40],D}function ys(s){return s.active}const ks=vt().filter(s=>s.cli.bundledBySdk).map(s=>s.kind),Cs=vt().filter(s=>s.capabilities.accountSwitching).map(s=>s.kind);function _s(s,e){return s.source===e.source&&(s.source!=="custom"||s.path===e.path)}function Es(s){const e=Z.c(5),{status:n,error:i}=s;if(n==="validating"){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(at,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Checking path..."]}),e[0]=a):a=e[0],a}if(n==="valid"){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-success",children:[t.jsx(ss,{"data-icon":"inline-start",className:"size-3.5"}),"Valid .claude directory found"]}),e[1]=a):a=e[1],a}if(n==="invalid"&&i){let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(ns,{"data-icon":"inline-start",className:"size-3.5"}),e[2]=a):a=e[2];let r;return e[3]!==i?(r=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[a,i]}),e[3]=i,e[4]=r):r=e[4],r}return null}function Fs(s){const e=Z.c(110),{open:n,currentPath:i,onClose:a,onSaved:r}=s,[l,f]=v.useState(i),[c,o]=v.useState(!1),{status:m,error:j,debouncedValidate:x,reset:b,save:y}=At();let C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=zt(),e[0]=C):C=e[0];const w=C;let N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=Tt("configWrite"),e[1]=N):N=e[1];const p=N,[u,S]=v.useState(!1),[h,_]=v.useState(""),[z,T]=v.useState(!1),[k,E]=v.useState(""),[D,g]=v.useState(""),[P,H]=v.useState(""),[re,Q]=v.useState(""),[$,V]=v.useState(!1),[O,Y]=v.useState(!1),[A,W]=v.useState(tt),[M,ee]=v.useState(0),[G,de]=v.useState(tt),[I,te]=v.useState(!1),[se,ze]=v.useState(!1);let q;e[2]===Symbol.for("react.memo_cache_sentinel")?(q=[],e[2]=q):q=e[2];const[ne,X]=v.useState(q);let R,U;e[3]!==i||e[4]!==n||e[5]!==b?(R=()=>{n&&(f(i),b(),Ie("/api/config").then(Is).then(d=>{const ae=(d==null?void 0:d.networkAccess)||!1;S(ae),te(ae),ze(!!(d!=null&&d.networkPassword)),_("");const qe=(d==null?void 0:d.terminalApp)||"";E(qe),g(qe);const Xe=(d==null?void 0:d.editorApp)||"";H(Xe),Q(Xe);const Ke=(d==null?void 0:d.useBuiltInEditor)===!0;V(Ke),Y(Ke);const Je=ms(d==null?void 0:d.agentExecutable)??tt;W(Je),de(Je),ae&&(d!=null&&d.networkPassword)&&!w?Ie("/api/connected-devices").then(Ts).then($e=>X(($e==null?void 0:$e.devices)||[])).catch(zs):X([])}).catch(As))},U=[n,i,b,w],e[3]=i,e[4]=n,e[5]=b,e[6]=R,e[7]=U):(R=e[6],U=e[7]),v.useEffect(R,U);let B;e[8]!==x?(B=d=>{const ae=d.target.value;f(ae),x(ae)},e[8]=x,e[9]=B):B=e[9];const L=B;let F;e[10]!==A||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]!==$?(F=async()=>{o(!0);const d=await y(l,{networkAccess:w?I:u,networkPassword:!w&&u&&h.length>0?h:void 0,terminalApp:k.trim()||void 0,editorApp:P.trim()||void 0,useBuiltInEditor:$,agentExecutable:A});d.success&&d.claudeDir&&(ee($s),r(d.claudeDir)),o(!1)},e[10]=A,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]=F):F=e[20];const ie=F;let oe;e[21]!==A||e[22]!==P||e[23]!==se||e[24]!==G||e[25]!==re||e[26]!==I||e[27]!==D||e[28]!==O||e[29]!==u||e[30]!==h||e[31]!==m||e[32]!==k||e[33]!==$?(oe=function(){var $e;if(m==="validating"||m==="invalid")return!1;const ae=m==="valid",qe=!w&&(u!==I||u&&h.length>0),Xe=k!==D,Ke=P!==re||$!==O,Je=!_s(A,G);if(!ae&&!qe&&!Xe&&!Ke&&!Je||A.source==="custom"&&!(($e=A.path)!=null&&$e.trim()))return!1;if(!w&&u){const kt=h.length>0&&h.length<rt,Ct=!se&&h.length===0;if(kt||Ct)return!1}return!0},e[21]=A,e[22]=P,e[23]=se,e[24]=G,e[25]=re,e[26]=I,e[27]=D,e[28]=O,e[29]=u,e[30]=h,e[31]=m,e[32]=k,e[33]=$,e[34]=oe):oe=e[34];const K=oe();let ue;e[35]!==a?(ue=d=>{d||a()},e[35]=a,e[36]=ue):ue=e[36];let De;e[37]===Symbol.for("react.memo_cache_sentinel")?(De=t.jsxs(It,{children:[t.jsx(Dt,{className:"text-foreground",children:"Configuration"}),t.jsx(Pt,{className:"text-muted-foreground",children:"Manage local paths, preferred apps, and remote access."})]}),e[37]=De):De=e[37];let Pe,Le;e[38]===Symbol.for("react.memo_cache_sentinel")?(Pe=t.jsx(Ae,{htmlFor:"claude-directory",children:"Claude directory"}),Le=t.jsx(J,{children:"The directory containing your Claude configuration."}),e[38]=Pe,e[39]=Le):(Pe=e[38],Le=e[39]);let Re;e[40]===Symbol.for("react.memo_cache_sentinel")?(Re=t.jsx(mt,{children:t.jsx(Qt,{"data-icon":"inline-start"})}),e[40]=Re):Re=e[40];let fe;e[41]!==K||e[42]!==ie||e[43]!==c?(fe=d=>{d.key==="Enter"&&K&&!c&&ie()},e[41]=K,e[42]=ie,e[43]=c,e[44]=fe):fe=e[44];let me;e[45]!==L||e[46]!==l||e[47]!==fe?(me=t.jsxs(ut,{children:[Re,t.jsx(ft,{id:"claude-directory",value:l,onChange:L,placeholder:"/Users/you/.claude",disabled:!p,onKeyDown:fe})]}),e[45]=L,e[46]=l,e[47]=fe,e[48]=me):me=e[48];let he;e[49]!==j||e[50]!==m?(he=t.jsx("div",{"aria-live":"polite",children:t.jsx(Es,{status:m,error:j})}),e[49]=j,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 Ue,Be;e[55]===Symbol.for("react.memo_cache_sentinel")?(Ue=t.jsxs(Ae,{htmlFor:"terminal-application",children:[t.jsx(Yt,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Terminal application"]}),Be=t.jsx(J,{children:"Leave blank to use the system default for Ctrl+Cmd+T."}),e[55]=Ue,e[56]=Be):(Ue=e[55],Be=e[56]);let Fe;e[57]===Symbol.for("react.memo_cache_sentinel")?(Fe=d=>E(d.target.value),e[57]=Fe):Fe=e[57];let pe;e[58]!==k?(pe=t.jsxs(le,{children:[Ue,Be,t.jsx(nt,{id:"terminal-application",value:k,onChange:Fe,placeholder:"Ghostty, iTerm, or /path/to/binary",disabled:!p})]}),e[58]=k,e[59]=pe):pe=e[59];let Oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(Oe=d=>V(d===!0),e[60]=Oe):Oe=e[60];let ge;e[61]!==$?(ge=t.jsx(Lt,{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(xt,{children:[t.jsxs(Ae,{htmlFor:"use-built-in-editor",children:[t.jsx(es,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Open files in Cogpit"]}),t.jsx(J,{children:"Files and diffs open in Cogpit’s file workspace instead of launching an external editor."})]}),e[63]=Me):Me=e[63];let be;e[64]!==ge?(be=t.jsxs(le,{orientation:"horizontal",children:[ge,Me]}),e[64]=ge,e[65]=be):be=e[65];let Ge;e[66]===Symbol.for("react.memo_cache_sentinel")?(Ge=t.jsxs(Ae,{htmlFor:"editor-application",children:[t.jsx(ts,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Editor application"]}),e[66]=Ge):Ge=e[66];const Qe=$?"Not used while files open in Cogpit.":"Leave blank to use $VISUAL or automatic detection.";let je;e[67]!==Qe?(je=t.jsx(J,{children:Qe}),e[67]=Qe,e[68]=je):je=e[68];let He;e[69]===Symbol.for("react.memo_cache_sentinel")?(He=d=>H(d.target.value),e[69]=He):He=e[69];const Ye=!p||$;let ve;e[70]!==P||e[71]!==Ye?(ve=t.jsx(nt,{id:"editor-application",value:P,onChange:He,placeholder:"cursor, code, zed, or /path/to/binary",disabled:Ye}),e[70]=P,e[71]=Ye,e[72]=ve):ve=e[72];let we;e[73]!==je||e[74]!==ve?(we=t.jsxs(le,{children:[Ge,je,ve]}),e[73]=je,e[74]=ve,e[75]=we):we=e[75];let Ne;e[76]!==A||e[77]!==M?(Ne=ks.map(d=>t.jsx(ps,{kind:d,value:A,onChange:W,disabled:!p,reportVersion:M},d)),e[76]=A,e[77]=M,e[78]=Ne):Ne=e[78];let Ve;e[79]===Symbol.for("react.memo_cache_sentinel")?(Ve=Cs.map(d=>t.jsx(Ss,{kind:d,disabled:!p},d)),e[79]=Ve):Ve=e[79];let Se;e[80]!==ne||e[81]!==se||e[82]!==I||e[83]!==u||e[84]!==h||e[85]!==z?(Se=!w&&p&&t.jsx(os,{networkAccess:u,setNetworkAccess:S,networkPassword:h,setNetworkPassword:_,showNetworkPassword:z,setShowNetworkPassword:T,hasExistingPassword:se,initialNetworkAccess:I,connectedDevices:ne,minPasswordLength:rt}),e[80]=ne,e[81]=se,e[82]=I,e[83]=u,e[84]=h,e[85]=z,e[86]=Se):Se=e[86];let ye;e[87]!==xe||e[88]!==pe||e[89]!==be||e[90]!==we||e[91]!==Ne||e[92]!==Se?(ye=t.jsxs(Rt,{children:[xe,pe,be,we,Ne,Ve,Se]}),e[87]=xe,e[88]=pe,e[89]=be,e[90]=we,e[91]=Ne,e[92]=Se,e[93]=ye):ye=e[93];let ke;e[94]!==a?(ke=t.jsx(ce,{variant:"outline",onClick:a,children:"Cancel"}),e[94]=a,e[95]=ke):ke=e[95];let Ce;e[96]!==K||e[97]!==ie||e[98]!==c?(Ce=p&&t.jsx(ce,{disabled:!K||c,onClick:ie,children:c?t.jsxs(t.Fragment,{children:[t.jsx(at,{"data-icon":"inline-start",className:"size-4 animate-spin"}),"Saving..."]}):"Save"}),e[96]=K,e[97]=ie,e[98]=c,e[99]=Ce):Ce=e[99];let _e;e[100]!==ke||e[101]!==Ce?(_e=t.jsxs(Ut,{children:[ke,Ce]}),e[100]=ke,e[101]=Ce,e[102]=_e):_e=e[102];let Ee;e[103]!==ye||e[104]!==_e?(Ee=t.jsxs(Bt,{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]=Ee):Ee=e[105];let We;return e[106]!==n||e[107]!==Ee||e[108]!==ue?(We=t.jsx(Ft,{open:n,onOpenChange:ue,children:Ee}),e[106]=n,e[107]=Ee,e[108]=ue,e[109]=We):We=e[109],We}function $s(s){return s+1}function As(){}function zs(){}function Ts(s){return s.json()}function Is(s){return s.json()}export{Fs as ConfigDialog};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{c as le,j as t,r as fe}from"./vendor-react-gGw_S5I_.js";import{
|
|
1
|
+
import{c as le,j as t,r as fe}from"./vendor-react-gGw_S5I_.js";import{aJ as Ne,J as ke,aK as ge,aL as pe,aM as je,aN as ve,B as Z,aO as ye,aP as Te,L as be,M as Ce,O as _e,Q as Me,j as Be,k as we,Z as $e,i as Ae,l as de,q as Se,h as Ie,D as Re}from"./index-DsnL-sXV.js";import{R as me,V as Ee,W as De,C as ze}from"./vendor-ui-Br3ZTAXZ.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function Le(a){const e=le.c(29),{branches:s,activeBranchIdx:c,branchPointTurnIndex:f}=a,g=s.length;if(g===0)return null;const j=Math.min(f+1,5);let h;e[0]!==s?(h=Math.max(...s.map(We),1),e[0]=s,e[1]=h):h=e[1];const o=Math.min(h,6),n=20+j*25,r=Math.min(32,Math.max(20,(300-n)/(o+1))),d=18+(g-1)*27+15,m=`0 0 340 ${d}`,p=`${g} branches from turn ${f+1}`;let l;e[2]!==n?(l=t.jsx("line",{x1:20,y1:18,x2:n,y2:18,stroke:"var(--muted-foreground)",strokeWidth:2}),e[2]=n,e[3]=l):l=e[3];let u;e[4]!==j?(u=Array.from({length:j}).map(Pe),e[4]=j,e[5]=u):u=e[5];let k,b;e[6]!==n?(k=t.jsx("circle",{cx:n,cy:18,r:5,fill:"var(--background)",stroke:"var(--foreground)",strokeWidth:2}),b=t.jsx("circle",{cx:n,cy:18,r:2,fill:"var(--foreground)"}),e[6]=n,e[7]=k,e[8]=b):(k=e[7],b=e[8]);let T;if(e[9]!==c||e[10]!==n||e[11]!==s||e[12]!==o||e[13]!==r){let w;e[15]!==c||e[16]!==n||e[17]!==o||e[18]!==r?(w=(i,C)=>{const v=C===c,_=v?"var(--foreground)":"var(--border)",A=v?"var(--foreground)":"var(--border)",N=18+C*27,$=Math.min(i.graphTurnCount,o);return t.jsxs("g",{style:{opacity:v?1:.3},children:[C===0?t.jsx("line",{x1:n,y1:N,x2:n+$*r,y2:N,stroke:_,strokeWidth:2}):t.jsxs(t.Fragment,{children:[t.jsx("path",{d:`M ${n} 18 C ${n+10} ${N-5}, ${n+20} ${N}, ${n+r} ${N}`,fill:"none",stroke:_,strokeWidth:2}),$>1&&t.jsx("line",{x1:n+r,y1:N,x2:n+$*r,y2:N,stroke:_,strokeWidth:2})]}),Array.from({length:$}).map((R,S)=>t.jsxs("g",{children:[t.jsx("circle",{cx:n+(S+1)*r,cy:N,r:3.5,fill:"var(--background)",stroke:_,strokeWidth:1.5}),t.jsx("circle",{cx:n+(S+1)*r,cy:N,r:1.5,fill:A})]},S)),i.graphTurnCount>o&&t.jsxs("text",{x:n+($+.4)*r,y:N+3,fill:v?"var(--foreground)":"var(--border)",fontSize:"8",fontFamily:"monospace",children:["+",i.graphTurnCount-o]})]},i.id)},e[15]=c,e[16]=n,e[17]=o,e[18]=r,e[19]=w):w=e[19],T=s.map(w),e[9]=c,e[10]=n,e[11]=s,e[12]=o,e[13]=r,e[14]=T}else T=e[14];let B;return e[20]!==d||e[21]!==m||e[22]!==p||e[23]!==l||e[24]!==u||e[25]!==k||e[26]!==b||e[27]!==T?(B=t.jsx("div",{className:"rounded-lg border bg-muted/20 px-3 py-2",children:t.jsxs("svg",{width:"100%",height:d,viewBox:m,role:"img","aria-label":p,children:[l,u,k,b,T]})}),e[20]=d,e[21]=m,e[22]=p,e[23]=l,e[24]=u,e[25]=k,e[26]=b,e[27]=T,e[28]=B):B=e[28],B}function Pe(a,e){return t.jsxs("g",{children:[t.jsx("circle",{cx:20+e*25,cy:18,r:3.5,fill:"var(--background)",stroke:"var(--muted-foreground)",strokeWidth:1.5}),t.jsx("circle",{cx:20+e*25,cy:18,r:1.5,fill:"var(--muted-foreground)"})]},`s-${e}`)}function We(a){return a.graphTurnCount}function He(a){const e=a.input.file_path??a.input.path??"";if(e)return e.split("/").pop()||e;const s=a.input.command;if(s)return s.length>40?s.slice(0,37)+"...":s;const c=a.input.pattern;if(c)return c.length>30?c.slice(0,27)+"...":c;const f=a.input.query;return f?f.length>30?f.slice(0,27)+"...":f:""}function Fe(a){const e=le.c(26),{turn:s,archiveIndex:c,branchId:f,onRedoToHere:g}=a;let j;e[0]!==s.userMessage?(j=typeof s.userMessage=="string"?s.userMessage:Array.isArray(s.userMessage)?s.userMessage.flatMap(qe).join(`
|
|
2
2
|
`):null,e[0]=s.userMessage,e[1]=j):j=e[1];const h=j,y=c+1;let o;e[2]!==y?(o=t.jsx(ge,{className:"border-b py-2",children:t.jsxs(pe,{children:["Turn ",y]})}),e[2]=y,e[3]=o):o=e[3];let n;e[4]!==h?(n=h&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"You"}),t.jsx("div",{className:"text-sm text-foreground",children:h})]}),e[4]=h,e[5]=n):n=e[5];let r;e[6]!==s.thinking[0]||e[7]!==s.thinking.length?(r=s.thinking.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Thinking"}),t.jsxs("div",{className:"text-xs text-muted-foreground italic",children:[s.thinking[0].thinking.slice(0,300),s.thinking[0].thinking.length>300?"...":""]})]}),e[6]=s.thinking[0],e[7]=s.thinking.length,e[8]=r):r=e[8];let d;e[9]!==s.assistantText?(d=s.assistantText.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-success",children:"Assistant"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:s.assistantText.join(`
|
|
3
|
-
`)})]}),e[9]=s.assistantText,e[10]=d):d=e[10];let m;e[11]!==s.toolCalls?(m=s.toolCalls.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Tools"}),t.jsx("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:s.toolCalls.map(
|
|
4
|
-
`)})]}),e[7]=s.assistantText,e[8]=n):n=e[8];let r;e[9]!==s.toolCalls?(r=s.toolCalls.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Tools"}),t.jsx("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:s.toolCalls.map(
|
|
5
|
-
`)).turns}catch{}r.push({kind:"archived",id:
|
|
3
|
+
`)})]}),e[9]=s.assistantText,e[10]=d):d=e[10];let m;e[11]!==s.toolCalls?(m=s.toolCalls.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Tools"}),t.jsx("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:s.toolCalls.map(Oe)})]}),e[11]=s.toolCalls,e[12]=m):m=e[12];let p;e[13]!==n||e[14]!==r||e[15]!==d||e[16]!==m?(p=t.jsxs(je,{className:"flex flex-col gap-3 py-3",children:[n,r,d,m]}),e[13]=n,e[14]=r,e[15]=d,e[16]=m,e[17]=p):p=e[17];let l;e[18]!==c||e[19]!==f||e[20]!==g?(l=g&&t.jsx(ve,{className:"justify-end py-2",children:t.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>g(f,c),children:[t.jsx(me,{"data-icon":"inline-start",className:"scale-x-[-1]"}),"Redo to here"]})}),e[18]=c,e[19]=f,e[20]=g,e[21]=l):l=e[21];let u;return e[22]!==o||e[23]!==p||e[24]!==l?(u=t.jsxs(ye,{size:"sm",className:"motion-list-item gap-0 py-0",children:[o,p,l]}),e[22]=o,e[23]=p,e[24]=l,e[25]=u):u=e[25],u}function Oe(a){const e=Ne(a),s=He(a)||e.summary;return t.jsxs("span",{className:ke("font-mono text-xs text-muted-foreground",a.isError&&"text-destructive"),children:[e.label,s?` ${s}`:""]},a.id)}function qe(a){return a.type==="text"?[a.text]:[]}function Ge(a){const e=le.c(27),{turn:s,archiveIndex:c,branchId:f,onRedoToHere:g}=a,j=c+1;let h;e[0]!==j?(h=t.jsx(ge,{className:"border-b py-2",children:t.jsxs(pe,{children:["Turn ",j]})}),e[0]=j,e[1]=h):h=e[1];let y;e[2]!==s.userMessage?(y=s.userMessage&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"You"}),t.jsx("div",{className:"text-sm text-foreground",children:s.userMessage})]}),e[2]=s.userMessage,e[3]=y):y=e[3];let o;e[4]!==s.thinkingBlocks[0]||e[5]!==s.thinkingBlocks.length?(o=s.thinkingBlocks.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Thinking"}),t.jsxs("div",{className:"text-xs text-muted-foreground italic",children:[s.thinkingBlocks[0].slice(0,300),"..."]})]}),e[4]=s.thinkingBlocks[0],e[5]=s.thinkingBlocks.length,e[6]=o):o=e[6];let n;e[7]!==s.assistantText?(n=s.assistantText.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-success",children:"Assistant"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:s.assistantText.join(`
|
|
4
|
+
`)})]}),e[7]=s.assistantText,e[8]=n):n=e[8];let r;e[9]!==s.toolCalls?(r=s.toolCalls.length>0&&t.jsxs("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-start gap-3",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Tools"}),t.jsx("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:s.toolCalls.map(Je)})]}),e[9]=s.toolCalls,e[10]=r):r=e[10];let d;e[11]!==y||e[12]!==o||e[13]!==n||e[14]!==r?(d=t.jsxs(je,{className:"flex flex-col gap-3 py-3",children:[y,o,n,r]}),e[11]=y,e[12]=o,e[13]=n,e[14]=r,e[15]=d):d=e[15];let m;e[16]!==c||e[17]!==f||e[18]!==g?(m=()=>g(f,c),e[16]=c,e[17]=f,e[18]=g,e[19]=m):m=e[19];let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(me,{"data-icon":"inline-start",className:"scale-x-[-1]"}),e[20]=p):p=e[20];let l;e[21]!==m?(l=t.jsx(ve,{className:"justify-end py-2",children:t.jsxs(Z,{variant:"ghost",size:"sm",onClick:m,children:[p,"Redo to here"]})}),e[21]=m,e[22]=l):l=e[22];let u;return e[23]!==l||e[24]!==h||e[25]!==d?(u=t.jsxs(ye,{size:"sm",className:"motion-list-item gap-0 py-0",children:[h,d,l]}),e[23]=l,e[24]=h,e[25]=d,e[26]=u):u=e[26],u}function Je(a,e){return t.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[a.type," ",a.filePath.split("/").pop()]},e)}function Ze(a){var xe,he,ue;const e=le.c(88),{open:s,branches:c,branchPointTurnIndex:f,currentTurns:g,onClose:j,onCloseComplete:h,onRedoToTurn:y,onRedoEntireBranch:o}=a,n=s===void 0?!0:s;let r;if(e[0]!==c||e[1]!==g){r=[];let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=new Date().toISOString(),e[3]=x):x=e[3];let M;e[4]!==g?(M={kind:"current",id:"__current__",label:"Current branch",createdAt:x,fullTurns:g,archivedTurns:null,graphTurnCount:g.length,branch:null},e[4]=g,e[5]=M):M=e[5],r.push(M);for(const I of c){let X=null;if(I.jsonlLines.length>0)try{X=Te(I.jsonlLines.join(`
|
|
5
|
+
`)).turns}catch{}r.push({kind:"archived",id:I.id,label:I.label,createdAt:I.createdAt,fullTurns:X,archivedTurns:X?null:I.turns,graphTurnCount:X?X.length:I.turns.length,branch:I})}e[0]=c,e[1]=g,e[2]=r}else r=e[2];const d=r,[m,p]=fe.useState(0),l=d.length;let u;e[6]!==l?(u=()=>{p(x=>x>0?x-1:l-1)},e[6]=l,e[7]=u):u=e[7];const k=u;let b;e[8]!==l?(b=()=>{p(x=>x<l-1?x+1:0)},e[8]=l,e[9]=b):b=e[9];const T=b;let B,w;e[10]!==T||e[11]!==k?(B=()=>{const x=M=>{M.key==="ArrowLeft"?k():M.key==="ArrowRight"&&T()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},w=[k,T],e[10]=T,e[11]=k,e[12]=B,e[13]=w):(B=e[12],w=e[13]),fe.useEffect(B,w);const i=d[m];if(!i)return null;const C=((xe=i.fullTurns)==null?void 0:xe.length)??((he=i.archivedTurns)==null?void 0:he.length)??0,v=i.kind==="current";let _;e[14]!==j?(_=x=>{x||j()},e[14]=j,e[15]=_):_=e[15];let A;e[16]!==h?(A=x=>{x||h==null||h()},e[16]=h,e[17]=A):A=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Ee,{className:"size-4"}),e[18]=N):N=e[18];const $=f+1;let R;e[19]!==$?(R=t.jsx("div",{className:"flex items-center justify-between gap-3",children:t.jsxs(Be,{className:"flex items-center gap-2",children:[N,"Branches from Turn ",$]})}),e[19]=$,e[20]=R):R=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(we,{children:"Compare alternate continuations and resume from an earlier point."}),e[21]=S):S=e[21];const ie=l<=1;let U;e[22]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx(De,{"data-icon":"inline-start"}),e[22]=U):U=e[22];let E;e[23]!==k||e[24]!==ie?(E=t.jsx(Z,{variant:"ghost",size:"icon-sm",onClick:k,disabled:ie,"aria-label":"Previous branch",children:U}),e[23]=k,e[24]=ie,e[25]=E):E=e[25];let D;e[26]!==v?(D=v&&t.jsx($e,{variant:"secondary",className:"ml-2",children:"Active"}),e[26]=v,e[27]=D):D=e[27];let z;e[28]!==i.label||e[29]!==D?(z=t.jsxs("div",{className:"truncate text-sm font-medium",children:[i.label,D]}),e[28]=i.label,e[29]=D,e[30]=z):z=e[30];const ae=m+1;let L;e[31]!==i.createdAt||e[32]!==v?(L=!v&&t.jsxs(t.Fragment,{children:[" · ",new Date(i.createdAt).toLocaleString()]}),e[31]=i.createdAt,e[32]=v,e[33]=L):L=e[33];let P;e[34]!==ae||e[35]!==L||e[36]!==l?(P=t.jsxs("div",{className:"text-xs text-muted-foreground",children:["Branch ",ae," of ",l,L]}),e[34]=ae,e[35]=L,e[36]=l,e[37]=P):P=e[37];let W;e[38]!==z||e[39]!==P?(W=t.jsxs("div",{className:"flex-1 text-center",children:[z,P]}),e[38]=z,e[39]=P,e[40]=W):W=e[40];const oe=l<=1;let ee;e[41]===Symbol.for("react.memo_cache_sentinel")?(ee=t.jsx(ze,{"data-icon":"inline-start"}),e[41]=ee):ee=e[41];let H;e[42]!==T||e[43]!==oe?(H=t.jsx(Z,{variant:"ghost",size:"icon-sm",onClick:T,disabled:oe,"aria-label":"Next branch",children:ee}),e[42]=T,e[43]=oe,e[44]=H):H=e[44];let F;e[45]!==E||e[46]!==W||e[47]!==H?(F=t.jsxs("div",{className:"flex items-center gap-3 pt-3",children:[E,W,H]}),e[45]=E,e[46]=W,e[47]=H,e[48]=F):F=e[48];let O;e[49]!==R||e[50]!==F?(O=t.jsxs(Ae,{className:"shrink-0 p-5 pb-4 pr-14",children:[R,S,F]}),e[49]=R,e[50]=F,e[51]=O):O=e[51];let te;e[52]===Symbol.for("react.memo_cache_sentinel")?(te=t.jsx(de,{}),e[52]=te):te=e[52];let q;e[53]!==f||e[54]!==m||e[55]!==d?(q=t.jsx("div",{className:"shrink-0 px-5 py-4",children:t.jsx(Le,{branches:d,activeBranchIdx:m,branchPointTurnIndex:f})}),e[53]=f,e[54]=m,e[55]=d,e[56]=q):q=e[56];let se;e[57]===Symbol.for("react.memo_cache_sentinel")?(se=t.jsx(de,{}),e[57]=se):se=e[57];let G;e[58]!==i.archivedTurns||e[59]!==i.fullTurns||e[60]!==i.id||e[61]!==v||e[62]!==y||e[63]!==C?(G=C===0?t.jsx(be,{className:"min-h-40",children:t.jsxs(Ce,{children:[t.jsx(_e,{children:"No turns in this branch"}),t.jsx(Me,{children:"This continuation has no saved turns."})]})}):i.fullTurns?i.fullTurns.map((x,M)=>t.jsx(Fe,{turn:x,archiveIndex:M,branchId:i.id,onRedoToHere:v?void 0:y},x.id)):(ue=i.archivedTurns)==null?void 0:ue.map((x,M)=>t.jsx(Ge,{turn:x,archiveIndex:M,branchId:i.id,onRedoToHere:y},x.index)),e[58]=i.archivedTurns,e[59]=i.fullTurns,e[60]=i.id,e[61]=v,e[62]=y,e[63]=C,e[64]=G):G=e[64];let J;e[65]!==G?(J=t.jsx(Se,{className:"min-h-0 flex-1",children:t.jsx("div",{className:"flex flex-col gap-3 p-4",children:G})}),e[65]=G,e[66]=J):J=e[66];let ne;e[67]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx(de,{}),e[67]=ne):ne=e[67];const ce=C!==1?"s":"";let Y;e[68]!==ce||e[69]!==C?(Y=t.jsxs("span",{className:"text-xs text-muted-foreground",children:[C," turn",ce," in this branch"]}),e[68]=ce,e[69]=C,e[70]=Y):Y=e[70];let K;e[71]!==i.id||e[72]!==v||e[73]!==o?(K=!v&&t.jsxs(Z,{size:"sm",onClick:()=>o(i.id),children:[t.jsx(me,{"data-icon":"inline-start",className:"scale-x-[-1]"}),"Redo entire branch"]}),e[71]=i.id,e[72]=v,e[73]=o,e[74]=K):K=e[74];let Q;e[75]!==Y||e[76]!==K?(Q=t.jsxs("div",{className:"flex shrink-0 items-center justify-between p-4",children:[Y,K]}),e[75]=Y,e[76]=K,e[77]=Q):Q=e[77];let V;e[78]!==O||e[79]!==q||e[80]!==J||e[81]!==Q?(V=t.jsxs(Ie,{className:"flex max-h-[80dvh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl",children:[O,te,q,se,J,ne,Q]}),e[78]=O,e[79]=q,e[80]=J,e[81]=Q,e[82]=V):V=e[82];let re;return e[83]!==n||e[84]!==V||e[85]!==_||e[86]!==A?(re=t.jsx(Re,{open:n,onOpenChange:_,onOpenChangeComplete:A,children:V}),e[83]=n,e[84]=V,e[85]=_,e[86]=A,e[87]=re):re=e[87],re}export{Ze as BranchModal};
|