cogpit 2.6.6 → 2.7.4
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 +16883 -10322
- package/dist/web/assets/{CommandPaletteHost-iiTEkWGR.js → CommandPaletteHost-ByD_7YRK.js} +1 -1
- package/dist/web/assets/ConfigBrowser-vXK8JNMg.js +1 -0
- package/dist/web/assets/{HighlightedEditor-7K1IXoMd.js → HighlightedEditor-BwET41dr.js} +1 -1
- package/dist/web/assets/{KeyboardShortcutsDialog-C7QHuM2e.js → KeyboardShortcutsDialog-DQuepxQo.js} +1 -1
- package/dist/web/assets/{MobileFileChanges-qnY-uxZ_.js → MobileFileChanges-B6rggNR6.js} +1 -1
- package/dist/web/assets/PluginsDialog-DTF9NnK7.js +1 -0
- package/dist/web/assets/{PreviewPanel-DBIaGXu0.js → PreviewPanel-BaXxki5D.js} +1 -1
- package/dist/web/assets/ProjectFilesPanel-CO6Znhgi.js +4 -0
- package/dist/web/assets/{ProjectSwitcherModal-BhevYH6F.js → ProjectSwitcherModal-Chi-U3vv.js} +1 -1
- package/dist/web/assets/{TerminalOutput-DnTT9ONj.js → TerminalOutput-CUmbXM9h.js} +1 -1
- package/dist/web/assets/{ThemeSelectorModal-GimQk0yY.js → ThemeSelectorModal-B2m42_1f.js} +1 -1
- package/dist/web/assets/WorkflowsPanel-CiYzHaQg.js +1 -0
- package/dist/web/assets/{WorktreePanel-DbSH2Fyv.js → WorktreePanel-CldMZY3n.js} +1 -1
- package/dist/web/assets/{index-7fgSFumo.js → index-BA1eUNuR.js} +4 -4
- package/dist/web/assets/{index-j1RyyaFQ.js → index-C-0I_ZqI.js} +1 -1
- package/dist/web/assets/index-C6wvrmo0.js +221 -0
- package/dist/web/assets/index-CYN2JttE.js +1 -0
- package/dist/web/assets/index-DYWsIgvZ.css +1 -0
- package/dist/web/assets/index-QH_v3Ygj.js +1 -0
- package/dist/web/assets/session-parser.worker-CnA52U1J.js +29 -0
- package/dist/web/assets/vendor-ui-ZKZkD5k3.js +887 -0
- package/dist/web/index.html +3 -3
- package/package.json +8 -2
- package/dist/web/assets/ConfigBrowser-CV_FDTPG.js +0 -1
- package/dist/web/assets/ProjectFilesPanel-DdllBXuv.js +0 -4
- package/dist/web/assets/WorkflowsPanel-BTeZdY1F.js +0 -1
- package/dist/web/assets/index-Bl7YHn3e.js +0 -1
- package/dist/web/assets/index-C640apmk.css +0 -1
- package/dist/web/assets/index-CVF75nuK.js +0 -153
- package/dist/web/assets/index-CmAiGDkv.js +0 -1
- package/dist/web/assets/session-parser.worker-DlF00ZHH.js +0 -29
- package/dist/web/assets/vendor-ui-C4lFQWec.js +0 -937
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m,j as e}from"./vendor-react-gGw_S5I_.js";import{a3 as Q,B as d,_ as A,l as V,E as Y,y as Z,z as _,G as ee,H as se,a4 as ne,a5 as te,a6 as ae,a7 as re,a8 as R,a9 as ie,aa as z,ab as E,ac as S,ad as oe,ae as U,af as F,ag as T,ah as $,ai as P,w as u,aj as c}from"./index-
|
|
1
|
+
import{r as m,j as e}from"./vendor-react-gGw_S5I_.js";import{a3 as Q,B as d,_ as A,l as V,E as Y,y as Z,z as _,G as ee,H as se,a4 as ne,a5 as te,a6 as ae,a7 as re,a8 as R,a9 as ie,aa as z,ab as E,ac as S,ad as oe,ae as U,af as F,ag as T,ah as $,ai as P,w as u,aj as c}from"./index-C6wvrmo0.js";import{G as O,h as le,b as ce,X as de,c as he,i as me,j as I,C as xe,k as ue}from"./vendor-ui-ZKZkD5k3.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const pe={M:"text-warning",A:"text-success",D:"text-destructive",R:"text-info"};function ye({worktrees:v,loading:p,dirName:r,onRefetch:g,onOpenSession:M,onClose:B}){const l=Q("hostFiles"),[G,y]=m.useState(null),[H,b]=m.useState(null),[J,x]=m.useState(!1),[n,h]=m.useState(null),[a,j]=m.useState(null),C=async s=>{if(!(!l||!r)){y(s.name);try{await u(`/api/worktrees/${encodeURIComponent(r)}/${encodeURIComponent(s.name)}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:s.isDirty})}),g()}catch(t){c.error(`Failed to delete worktree: ${t instanceof Error?t.message:"Unknown error"}`)}finally{y(null)}}},L=s=>{if(!(!l||!r)){if(s.isDirty){h({worktree:s,reason:"dirty"});return}if(s.commitsAhead>0){h({worktree:s,reason:"unpushed"});return}C(s)}},W=()=>{if(!n)return;const{worktree:s,reason:t}=n;if(t==="dirty"&&s.commitsAhead>0){h({worktree:s,reason:"unpushed"});return}h(null),C(s)},q=async s=>{if(!(!l||!r)){b(s.name);try{const t=await u(`/api/worktrees/${encodeURIComponent(r)}/create-pr`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeName:s.name,title:s.name.replace(/-/g," ")})});if(t.ok){const o=await t.json();o.url?window.open(o.url,"_blank","noopener,noreferrer"):c.warning("PR created but no URL was returned")}else{const o=await t.json().catch(()=>({error:"Unknown error"}));c.error(`Failed to create PR: ${o.error||"Unknown error"}`)}}catch(t){c.error(`Error creating PR: ${t instanceof Error?t.message:"Unknown error"}`)}finally{b(null)}}},X=async()=>{if(!(!l||!r)){x(!0);try{const s=await u(`/api/worktrees/${encodeURIComponent(r)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(s.ok){const{stale:t}=await s.json();t.length===0?c.info("No stale worktrees found"):j(t.map(o=>o.name))}}catch(s){c.error(`Cleanup failed: ${s instanceof Error?s.message:"Unknown error"}`)}finally{x(!1)}}},K=async()=>{if(!l||!r||!a)return;const s=a;j(null),x(!0);try{await u(`/api/worktrees/${encodeURIComponent(r)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0,names:s})}),g()}catch(t){c.error(`Cleanup failed: ${t instanceof Error?t.message:"Unknown error"}`)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{"aria-label":"Worktrees",className:"flex size-full min-h-0 flex-col bg-background",children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[e.jsx(O,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4 text-muted-foreground"}),e.jsx("h2",{className:"text-sm font-medium",children:"Worktrees"}),e.jsx("div",{className:"flex-1"}),l&&e.jsx(d,{variant:"ghost",size:"icon-sm",onClick:X,disabled:J,"aria-label":"Cleanup stale worktrees",children:e.jsx(le,{"data-icon":"inline-start"})}),e.jsx(d,{variant:"ghost",size:"icon-sm",onClick:g,disabled:p,"aria-label":"Refresh worktrees",children:e.jsx(ce,{"data-icon":"inline-start",className:A(p&&"animate-spin")})}),e.jsx(d,{variant:"ghost",size:"icon-sm",onClick:B,"aria-label":"Close worktrees",children:e.jsx(de,{"data-icon":"inline-start"})})]}),e.jsx(V,{}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[!r&&e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select a project to view worktrees"}),r&&v.length===0&&!p&&e.jsx(Y,{className:"border-0 py-16",children:e.jsxs(Z,{children:[e.jsx(_,{variant:"icon",children:e.jsx(O,{})}),e.jsx(ee,{children:"No worktrees"}),e.jsx(se,{children:"Create a new session with “Isolate in worktree” enabled"})]})}),v.map(s=>{var w,N,D;const t=((w=s.changedFiles)==null?void 0:w.reduce((i,k)=>i+k.additions,0))??0,o=((N=s.changedFiles)==null?void 0:N.reduce((i,k)=>i+k.deletions,0))??0,f=((D=s.changedFiles)==null?void 0:D.length)??0;return e.jsxs("div",{className:"rounded-lg border bg-card p-3 transition-colors hover:bg-accent/40",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.name}),s.isDirty&&e.jsx("span",{className:"flex size-2 shrink-0 rounded-full bg-warning",title:"Uncommitted changes"}),s.commitsAhead>0&&e.jsxs(ne,{variant:"outline",className:"h-5 shrink-0 px-1.5 text-xs",children:[s.commitsAhead," ahead"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[s.linkedSessions.length>0&&e.jsx(d,{variant:"ghost",size:"icon-xs",onClick:()=>M(s.linkedSessions[0]),"aria-label":"Open session",children:e.jsx(he,{"data-icon":"inline-start"})}),l&&e.jsxs(e.Fragment,{children:[e.jsx(d,{variant:"ghost",size:"icon-xs",onClick:()=>q(s),disabled:H===s.name||s.commitsAhead===0,"aria-label":"Create PR",children:e.jsx(me,{"data-icon":"inline-start"})}),e.jsx(d,{variant:"ghost",size:"icon-xs",onClick:()=>L(s),disabled:G===s.name,className:"text-destructive hover:bg-destructive/10 hover:text-destructive","aria-label":"Delete worktree",children:e.jsx(I,{"data-icon":"inline-start"})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"shrink-0 font-mono",children:s.head}),e.jsx("span",{className:"truncate",children:s.headMessage})]}),s.createdAt&&e.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:te(s.createdAt)}),f>0&&e.jsxs(ae,{className:"mt-2",children:[e.jsxs(re,{className:"group flex w-full items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(xe,{"data-icon":"inline-start",className:"size-3 transition-transform group-data-panel-open:rotate-90 motion-reduce:transition-none"}),e.jsx(ue,{"data-icon":"inline-start",className:"size-3"}),e.jsxs("span",{children:[f," file",f!==1?"s":""," changed"]}),e.jsx(R,{add:t,del:o,className:"ml-1"})]}),e.jsx(ie,{children:e.jsx("div",{className:"mt-1.5 flex flex-col gap-px rounded-md bg-muted/40 p-1.5",children:s.changedFiles.map(i=>e.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5 font-mono text-xs",children:[e.jsx("span",{className:A("shrink-0 w-3 text-center",pe[i.status]??"text-muted-foreground"),children:i.status}),e.jsx("span",{className:"truncate text-foreground/80",children:i.path}),e.jsx(R,{add:i.additions,del:i.deletions,className:"ml-auto text-muted-foreground"})]},i.path))})})]})]},s.name)})]})]}),e.jsx(z,{open:n!==null,onOpenChange:s=>{s||h(null)},children:e.jsxs(E,{size:"sm",children:[e.jsxs(S,{children:[e.jsx(oe,{className:"bg-destructive/10 text-destructive",children:e.jsx(I,{})}),e.jsx(U,{children:(n==null?void 0:n.reason)==="dirty"?"Delete worktree with uncommitted changes?":"Delete worktree with unpushed commits?"}),e.jsxs(F,{children:[(n==null?void 0:n.reason)==="dirty"?`"${n.worktree.name}" has uncommitted changes.`:`"${n==null?void 0:n.worktree.name}" has ${n==null?void 0:n.worktree.commitsAhead} unpushed commit(s).`," "," ","Deleting it cannot be undone."]})]}),e.jsxs(T,{children:[e.jsx($,{size:"sm",children:"Cancel"}),e.jsx(P,{variant:"destructive",size:"sm",onClick:W,children:(n==null?void 0:n.reason)==="dirty"&&n.worktree.commitsAhead>0?"Continue":"Delete worktree"})]})]})}),e.jsx(z,{open:a!==null,onOpenChange:s=>{s||j(null)},children:e.jsxs(E,{children:[e.jsxs(S,{children:[e.jsx(U,{children:"Remove stale worktrees?"}),e.jsxs(F,{children:[a==null?void 0:a.length," stale worktree",(a==null?void 0:a.length)===1?"":"s"," will be removed: ",a==null?void 0:a.join(", "),"."]})]}),e.jsxs(T,{children:[e.jsx($,{size:"sm",children:"Cancel"}),e.jsx(P,{variant:"destructive",size:"sm",onClick:()=>void K(),children:"Remove worktrees"})]})]})})]})}export{ye as WorktreePanel};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{c as le,j as t,r as fe}from"./vendor-react-gGw_S5I_.js";import{aG as Ne,_ as ke,aH as ge,aI as pe,aJ as je,aK as ve,B as
|
|
1
|
+
import{c as le,j as t,r as fe}from"./vendor-react-gGw_S5I_.js";import{aG as Ne,_ as ke,aH as ge,aI as pe,aJ as je,aK as ve,B as V,aL as ye,aM as Te,E as be,y as Ce,G as _e,H as Me,j as Be,k as we,a4 as $e,i as Ae,l as de,q as Ie,h as Se,D as Re}from"./index-C6wvrmo0.js";import{R as me,W as Ee,Y as De,C as ze}from"./vendor-ui-ZKZkD5k3.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function He(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(Le),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,I)=>t.jsxs("g",{children:[t.jsx("circle",{cx:n+(I+1)*r,cy:N,r:3.5,fill:"var(--background)",stroke:_,strokeWidth:1.5}),t.jsx("circle",{cx:n+(I+1)*r,cy:N,r:1.5,fill:A})]},I)),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 Le(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 Pe(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(Ge)})]}),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(
|
|
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(Ye)})]}),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(
|
|
5
|
-
`)).turns}catch{}r.push({kind:"archived",id:S.id,label:S.label,createdAt:S.createdAt,fullTurns:
|
|
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(Ge)})]}),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(V,{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 Ge(a){const e=Ne(a),s=Pe(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 Oe(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(Ye)})]}),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(V,{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 Ye(a,e){return t.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[a.type," ",a.filePath.split("/").pop()]},e)}function Ve(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 S of c){let U=null;if(S.jsonlLines.length>0)try{U=Te(S.jsonlLines.join(`
|
|
5
|
+
`)).turns}catch{}r.push({kind:"archived",id:S.id,label:S.label,createdAt:S.createdAt,fullTurns:U,archivedTurns:U?null:S.turns,graphTurnCount:U?U.length:S.turns.length,branch:S})}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 I;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(we,{children:"Compare alternate continuations and resume from an earlier point."}),e[21]=I):I=e[21];const ie=l<=1;let Z;e[22]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(De,{"data-icon":"inline-start"}),e[22]=Z):Z=e[22];let E;e[23]!==k||e[24]!==ie?(E=t.jsx(V,{variant:"ghost",size:"icon-sm",onClick:k,disabled:ie,"aria-label":"Previous branch",children:Z}),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 H;e[31]!==i.createdAt||e[32]!==v?(H=!v&&t.jsxs(t.Fragment,{children:[" · ",new Date(i.createdAt).toLocaleString()]}),e[31]=i.createdAt,e[32]=v,e[33]=H):H=e[33];let L;e[34]!==ae||e[35]!==H||e[36]!==l?(L=t.jsxs("div",{className:"text-xs text-muted-foreground",children:["Branch ",ae," of ",l,H]}),e[34]=ae,e[35]=H,e[36]=l,e[37]=L):L=e[37];let W;e[38]!==z||e[39]!==L?(W=t.jsxs("div",{className:"flex-1 text-center",children:[z,L]}),e[38]=z,e[39]=L,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 P;e[42]!==T||e[43]!==oe?(P=t.jsx(V,{variant:"ghost",size:"icon-sm",onClick:T,disabled:oe,"aria-label":"Next branch",children:ee}),e[42]=T,e[43]=oe,e[44]=P):P=e[44];let F;e[45]!==E||e[46]!==W||e[47]!==P?(F=t.jsxs("div",{className:"flex items-center gap-3 pt-3",children:[E,W,P]}),e[45]=E,e[46]=W,e[47]=P,e[48]=F):F=e[48];let G;e[49]!==R||e[50]!==F?(G=t.jsxs(Ae,{className:"shrink-0 p-5 pb-4 pr-14",children:[R,I,F]}),e[49]=R,e[50]=F,e[51]=G):G=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(He,{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 O;e[58]!==i.archivedTurns||e[59]!==i.fullTurns||e[60]!==i.id||e[61]!==v||e[62]!==y||e[63]!==C?(O=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(Oe,{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]=O):O=e[64];let Y;e[65]!==O?(Y=t.jsx(Ie,{className:"min-h-0 flex-1",children:t.jsx("div",{className:"flex flex-col gap-3 p-4",children:O})}),e[65]=O,e[66]=Y):Y=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 J;e[68]!==ce||e[69]!==C?(J=t.jsxs("span",{className:"text-xs text-muted-foreground",children:[C," turn",ce," in this branch"]}),e[68]=ce,e[69]=C,e[70]=J):J=e[70];let K;e[71]!==i.id||e[72]!==v||e[73]!==o?(K=!v&&t.jsxs(V,{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 X;e[75]!==J||e[76]!==K?(X=t.jsxs("div",{className:"flex shrink-0 items-center justify-between p-4",children:[J,K]}),e[75]=J,e[76]=K,e[77]=X):X=e[77];let Q;e[78]!==G||e[79]!==q||e[80]!==Y||e[81]!==X?(Q=t.jsxs(Se,{className:"flex max-h-[80dvh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl",children:[G,te,q,se,Y,ne,X]}),e[78]=G,e[79]=q,e[80]=Y,e[81]=X,e[82]=Q):Q=e[82];let re;return e[83]!==n||e[84]!==Q||e[85]!==_||e[86]!==A?(re=t.jsx(Re,{open:n,onOpenChange:_,onOpenChangeComplete:A,children:Q}),e[83]=n,e[84]=Q,e[85]=_,e[86]=A,e[87]=re):re=e[87],re}export{Ve as BranchModal};
|
|
@@ -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,aY as Ee,aZ as J,m as dt,n as ut,I as ft,W as Ct,X as _t,a_ as $t,B as ce,a$ as mt,w as Ie,b0 as ht,a6 as xt,a7 as pt,a9 as gt,b1 as nt,b2 as bt,a4 as et,b3 as At,aq as Et,ar as zt,b4 as jt,i as Tt,j as It,k as Dt,b5 as Pt,U as Lt,aF as Ft,h as Rt,D as Ut}from"./index-CVF75nuK.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,a2 as vt,C as wt,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-C4lFQWec.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}=$t();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:j}=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 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]!==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]!==j||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<j,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 ${j} 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<j&&t.jsxs(_t,{children:["Password must be at least ",j," characters (",i.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]=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 Nt(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: ${Nt(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),[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(bs).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,$,D,g;if(e[7]!==r||e[8]!==c||e[9]!==b||e[10]!==i||e[11]!==j||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]!==b||e[31]!==i||e[32]!==a.path||e[33]!==a.source?(te=(L,B,ae,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: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]=b,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?Nt(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=j,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]!==j?(R=j?t.jsx(vt,{className:"size-4 shrink-0"}):t.jsx(wt,{className:"size-4 shrink-0"}),e[41]=j,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")?($=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[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]=b,e[10]=i,e[11]=j,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]=$,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[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 A;e[54]!==P||e[55]!==H||e[56]!==re||e[57]!==Z?(A=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]=A):A=e[58];let G;e[59]!==S||e[60]!==A?(G=S("custom",Te.custom,A),e[59]=S,e[60]=A,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]!==$?(ee=t.jsxs(w,{children:[$,O,M]}),e[77]=w,e[78]=O,e[79]=M,e[80]=$,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 bs(s){return s.ok?s.json():null}function St(s){return s instanceof Error?s.message:String(s)}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 bt(e,`Request failed (${e.status})`)}}catch(e){return{status:"error",error:St(e)}}}function js(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 bt(o,`Request failed (${o.status})`)});return}l({kind:"switched",result:await o.json()}),n(await rt(s))}catch(o){l({kind:"failed",error:St(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 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]!==a.pct?(x=Math.round(a.pct),e[9]=a.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 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}=js(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(Ss)??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(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(vt,{className:"size-4 shrink-0"}):t.jsx(wt,{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 $;e[33]!==z||e[34]!==T||e[35]!==k?($=t.jsx(gt,{children:t.jsxs(le,{children:[z,T,k]})}),e[33]=z,e[34]=T,e[35]=k,e[36]=$):$=e[36];let D;return e[37]!==m||e[38]!==$||e[39]!==h?(D=t.jsxs(xt,{open:m,onOpenChange:j,className:"flex flex-col gap-2",children:[h,$]}),e[37]=m,e[38]=$,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:j,debouncedValidate:x,reset:b,save:y}=At();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,$]=v.useState(""),[D,g]=v.useState(""),[P,H]=v.useState(""),[re,Z]=v.useState(""),[A,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]!==b?(F=()=>{n&&(f(a),b(),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)||"";$(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(Ae=>q((Ae==null?void 0:Ae.devices)||[])).catch(Es):q([])}).catch(As))},R=[n,a,b,w],e[3]=a,e[4]=n,e[5]=b,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]!==A?(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:A,agentExecutable:E});d.success&&d.claudeDir&&(ee($s),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]=A,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]!==A?(oe=function(){var Ae;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||A!==O,Je=!Cs(E,V);if(!ie&&!Xe&&!qe&&!Ke&&!Je||E.source==="custom"&&!((Ae=E.path)!=null&&Ae.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]=A,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]!==j||e[50]!==m?(he=t.jsx("div",{"aria-live":"polite",children:t.jsx(_s,{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 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=>$(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]!==A?(ge=t.jsx(Pt,{id:"use-built-in-editor",checked:A,onCheckedChange:Oe,disabled:!p}),e[61]=A,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 be;e[64]!==ge?(be=t.jsxs(le,{orientation:"horizontal",children:[ge,Me]}),e[64]=ge,e[65]=be):be=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=A?"Not used while files open in Cogpit.":"Leave blank to use $VISUAL or automatic detection.";let je;e[67]!==Ze?(je=t.jsx(J,{children:Ze}),e[67]=Ze,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 Qe=!p||A;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]!==je||e[74]!==ve?(we=t.jsxs(le,{children:[Ve,je,ve]}),e[73]=je,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]!==be||e[90]!==we||e[91]!==Ne||e[92]!==Se?(ye=t.jsxs(Lt,{children:[xe,pe,be,we,Ne,Ge,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]!==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 $e;e[103]!==ye||e[104]!==_e?($e=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]=$e):$e=e[105];let We;return e[106]!==n||e[107]!==$e||e[108]!==ue?(We=t.jsx(Ut,{open:n,onOpenChange:ue,children:$e}),e[106]=n,e[107]=$e,e[108]=ue,e[109]=We):We=e[109],We}function $s(s){return s+1}function As(){}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,aY as Ee,aZ as J,m as dt,n as ut,I as ft,W as Ct,X as _t,a_ as $t,B as ce,a$ as mt,w as Ie,b0 as ht,a6 as xt,a7 as pt,a9 as gt,b1 as nt,b2 as jt,a4 as et,b3 as At,aq as Et,ar as zt,b4 as bt,i as Tt,j as It,k as Dt,b5 as Pt,U as Lt,aF as Ft,h as Rt,D as Ut}from"./index-C6wvrmo0.js";import{a8 as Bt,a9 as Ot,aa as Mt,ab as Vt,e as Ht,T as Gt,M as Wt,ac as Xt,ad as qt,ae as Kt,a3 as vt,C as wt,af as it,ag as Jt,F as Yt,y as Zt,ah as Qt,D as es,ai as ts,aj as ss}from"./vendor-ui-ZKZkD5k3.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}=$t();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 Nt(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: ${Nt(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,$,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?Nt(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(vt,{className:"size-4 shrink-0"}):t.jsx(wt,{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")?($=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[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]=$,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[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 A;e[54]!==P||e[55]!==H||e[56]!==re||e[57]!==Z?(A=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]=A):A=e[58];let G;e[59]!==S||e[60]!==A?(G=S("custom",Te.custom,A),e[59]=S,e[60]=A,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]!==$?(ee=t.jsxs(w,{children:[$,O,M]}),e[77]=w,e[78]=O,e[79]=M,e[80]=$,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 St(s){return s instanceof Error?s.message:String(s)}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 jt(e,`Request failed (${e.status})`)}}catch(e){return{status:"error",error:St(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 jt(o,`Request failed (${o.status})`)});return}l({kind:"switched",result:await o.json()}),n(await rt(s))}catch(o){l({kind:"failed",error:St(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(vt,{className:"size-4 shrink-0"}):t.jsx(wt,{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 $;e[33]!==z||e[34]!==T||e[35]!==k?($=t.jsx(gt,{children:t.jsxs(le,{children:[z,T,k]})}),e[33]=z,e[34]=T,e[35]=k,e[36]=$):$=e[36];let D;return e[37]!==m||e[38]!==$||e[39]!==h?(D=t.jsxs(xt,{open:m,onOpenChange:b,className:"flex flex-col gap-2",children:[h,$]}),e[37]=m,e[38]=$,e[39]=h,e[40]=D):D=e[40],D}function Ss(s){return s.active}const ys=bt().filter(s=>s.cli.bundledBySdk).map(s=>s.kind),ks=bt().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}=At();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,$]=v.useState(""),[D,g]=v.useState(""),[P,H]=v.useState(""),[re,Z]=v.useState(""),[A,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)||"";$(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(Ae=>q((Ae==null?void 0:Ae.devices)||[])).catch(Es):q([])}).catch(As))},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]!==A?(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:A,agentExecutable:E});d.success&&d.claudeDir&&(ee($s),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]=A,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]!==A?(oe=function(){var Ae;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||A!==O,Je=!Cs(E,V);if(!ie&&!Xe&&!qe&&!Ke&&!Je||E.source==="custom"&&!((Ae=E.path)!=null&&Ae.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]=A,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=>$(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]!==A?(ge=t.jsx(Pt,{id:"use-built-in-editor",checked:A,onCheckedChange:Oe,disabled:!p}),e[61]=A,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=A?"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||A;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 $e;e[103]!==ye||e[104]!==_e?($e=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]=$e):$e=e[105];let We;return e[106]!==n||e[107]!==$e||e[108]!==ue?(We=t.jsx(Ut,{open:n,onOpenChange:ue,children:$e}),e[106]=n,e[107]=$e,e[108]=ue,e[109]=We):We=e[109],We}function $s(s){return s+1}function As(){}function Es(){}function zs(s){return s.json()}function Ts(s){return s.json()}export{Rs as ConfigDialog};
|