cogpit 2.0.0 → 2.1.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.
Files changed (29) hide show
  1. package/README.md +4 -4
  2. package/dist/cli.js +18606 -14058
  3. package/dist/web/assets/CommandPaletteHost-C-ParO8t.js +1 -0
  4. package/dist/web/assets/ConfigBrowser-Co4eu81Z.js +1 -0
  5. package/dist/web/assets/{HighlightedEditor-BPmH8BvC.js → HighlightedEditor-j81AHVZZ.js} +2 -2
  6. package/dist/web/assets/{KeyboardShortcutsDialog-CTbXz40Z.js → KeyboardShortcutsDialog-CluzMowK.js} +1 -1
  7. package/dist/web/assets/{MobileFileChanges-C5VoKbje.js → MobileFileChanges-DiOncgtO.js} +1 -1
  8. package/dist/web/assets/{PreviewPanel-DoAf1W2k.js → PreviewPanel-i4Yn68yV.js} +1 -1
  9. package/dist/web/assets/{ProjectFilesPanel-v_O7Awnm.js → ProjectFilesPanel-DPLFARWn.js} +3 -3
  10. package/dist/web/assets/ProjectSwitcherModal-BUXfKNzX.js +1 -0
  11. package/dist/web/assets/{TerminalOutput-SImEU6_6.js → TerminalOutput-DLRMV4_Y.js} +1 -1
  12. package/dist/web/assets/{ThemeSelectorModal-rjVBMgWC.js → ThemeSelectorModal-Cmx9maEq.js} +1 -1
  13. package/dist/web/assets/{WorkflowsPanel-JVqgKAzY.js → WorkflowsPanel-Cgm_kbHR.js} +1 -1
  14. package/dist/web/assets/WorktreePanel-h3DRRXek.js +1 -0
  15. package/dist/web/assets/{index-C5VcQtkE.js → index-Cgnw8FK8.js} +1 -1
  16. package/dist/web/assets/{index-S7UMnH_y.js → index-DUI5EaV5.js} +4 -4
  17. package/dist/web/assets/index-DocqIkvS.js +144 -0
  18. package/dist/web/assets/index-cjmnKg1q.js +1 -0
  19. package/dist/web/assets/session-parser.worker-DTq2tkdd.js +29 -0
  20. package/dist/web/assets/{vendor-ui-BmLOQ5Or.js → vendor-ui-CIBbYCBQ.js} +151 -146
  21. package/dist/web/index.html +3 -3
  22. package/package.json +3 -2
  23. package/dist/web/assets/CommandPaletteHost-ChH6w0Bx.js +0 -1
  24. package/dist/web/assets/ConfigBrowser-CPCH7_25.js +0 -1
  25. package/dist/web/assets/ProjectSwitcherModal-CSZrCd3X.js +0 -1
  26. package/dist/web/assets/WorktreePanel-D94-oAau.js +0 -1
  27. package/dist/web/assets/index-C00ZsBZl.js +0 -1
  28. package/dist/web/assets/index-CNV6e3p0.js +0 -138
  29. package/dist/web/assets/session-parser.worker-BhyaigCR.js +0 -22
@@ -8,16 +8,16 @@
8
8
  <meta name="apple-mobile-web-app-capable" content="yes" />
9
9
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
10
10
  <meta name="theme-color" content="#09090b" />
11
- <title>Cogpit - Claude Code Session Dashboard</title>
11
+ <title>Cogpit - Agent Session Dashboard</title>
12
12
  <script src="/theme-bootstrap.js"></script>
13
13
  <style>
14
14
  html, body, #root { height: 100%; height: 100dvh; margin: 0; overflow: hidden; }
15
15
  .dark body { background: #09090b; color: #fafafa; }
16
16
  body { background: #fafafa; color: #09090b; }
17
17
  </style>
18
- <script type="module" crossorigin src="/assets/index-CNV6e3p0.js"></script>
18
+ <script type="module" crossorigin src="/assets/index-DocqIkvS.js"></script>
19
19
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-gGw_S5I_.js">
20
- <link rel="modulepreload" crossorigin href="/assets/vendor-ui-BmLOQ5Or.js">
20
+ <link rel="modulepreload" crossorigin href="/assets/vendor-ui-CIBbYCBQ.js">
21
21
  <link rel="modulepreload" crossorigin href="/assets/vendor-markdown-BE1gYnO9.js">
22
22
  <link rel="modulepreload" crossorigin href="/assets/vendor-shiki-DOn6sF-i.js">
23
23
  <link rel="stylesheet" crossorigin href="/assets/index-Bif4Kdtn.css">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cogpit",
3
- "version": "2.0.0",
4
- "description": "Run Cogpit's local Claude Code and Codex interface without installing it",
3
+ "version": "2.1.0",
4
+ "description": "Run Cogpit's local Claude Code, Codex, and GitHub Copilot CLI interface without installing it",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -13,6 +13,7 @@
13
13
  "keywords": [
14
14
  "claude-code",
15
15
  "codex",
16
+ "github-copilot",
16
17
  "agent",
17
18
  "cogpit"
18
19
  ],
@@ -1 +0,0 @@
1
- import{c as oe,j as u,r as M}from"./vendor-react-gGw_S5I_.js";import{aq as h,ar as Q,ah as le,N as ce,J as re,as as de,at as me,O as ue,C as he,M as ge,x as fe,au as ve,av as Y,aw as W,ax as we,ay as Ce,az as je,aA as Se,w as ye}from"./index-CNV6e3p0.js";import{S as xe,p as Z,q as be,P as Pe,L as Te,H as Oe,F as Ne,r as ke,g as ee,G as Fe,e as Ie,l as Ee,s as $e,t as Re,u as Ae,v as De,w as te,x as Le,y as Me,z as He,K as qe,f as Ke,A as ze,B as Be,D as ne,I as Ge,J as pe,N as Ue}from"./vendor-ui-BmLOQ5Or.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function a(t,e,s,c,i,m,d){return{id:t,label:e,icon:c,run:i,shortcut:m,description:d,value:`${e} ${s}`}}function _(...t){return t.filter(e=>e!==!1&&e!==void 0)}function We(t){const e=oe.c(40);let s,c,i,m,d,v,w,r,C,g,y,f,x,k,b;if(e[0]!==t){const $=_(a("home","Go to dashboard","home overview",Oe,t.onGoHome),a("mission-control",t.showMission?"Exit Mission Control":"Open Mission Control","live sessions blocked waiting answer everything at once",Te,t.onToggleMissionControl,h("missionControl")),a("new-session","Start a new session","project agent chat create",Pe,t.onNewSession,h("newSession")),t.onDuplicateSession&&a("duplicate-session","Duplicate this session","copy fork clone branch thread",be,t.onDuplicateSession),t.canFocusComposer&&a("focus-composer","Focus message composer","chat prompt input",Z,t.onFocusComposer,h("focusComposer")),t.onFindInConversation&&a("find-in-conversation","Find in conversation","search text transcript turns matches",xe,t.onFindInConversation,h("findInConversation"))),I=(t.projects??[]).slice(0,8).map(n=>a(`project-${n.dirName}`,n.shortName,`${n.path} ${n.dirName} project workspace`,Ne,()=>{var l;return(l=t.onOpenProject)==null?void 0:l.call(t,n.dirName)},void 0,`${n.path} · ${n.sessionCount} session${n.sessionCount===1?"":"s"}`)),o=(t.recentSessions??[]).slice(0,10).map(n=>{const j=(n.aiTitle||n.name||n.slug||n.lastUserMessage||n.firstUserMessage||n.sessionId).replace(/\s+/g," ").trim().slice(0,160)||n.sessionId,B=[n.projectShortName,n.gitBranch].filter(Boolean).join(" · ");return a(`session-${n.dirName}-${n.fileName}`,j,`${n.projectShortName} ${n.cwd??""} ${n.gitBranch??""} ${n.sessionId} recent thread conversation`,Z,()=>{var q;return(q=t.onOpenSession)==null?void 0:q.call(t,n.dirName,n.fileName)},void 0,B)}),E=t.devices??[],P=E.length>1&&t.onSwitchDevice?E.slice(0,Q.length).map((n,l)=>a(`device-${n.id}`,n.isActive?`${n.name} (current)`:`Switch to ${n.name}`,`device machine host remote ${n.id}`,n.isLocal?ke:ee,()=>{var j;return(j=t.onSwitchDevice)==null?void 0:j.call(t,n.id)},h(Q[l]))):[],R=_(a("toggle-sidebar",t.showSidebar?"Hide session sidebar":"Show session sidebar","projects navigation panel",Re,t.onToggleSidebar,h("toggleSidebar")),t.hasSession&&a("toggle-stats",t.showStats?"Hide session analytics":"Show session analytics","stats tokens usage panel",$e,t.onToggleStats,h("toggleStats")),t.onToggleProjectFiles&&a("project-files",t.showProjectFiles?"Close project files":"Open project files","browse edit save workspace source code",Ee,t.onToggleProjectFiles,h("projectFiles")),t.hasFileChanges&&a("toggle-file-changes",t.showFileChanges?"Hide file changes":"Show file changes","diff edits review panel",Ie,t.onToggleFileChanges),t.supportsWorktrees&&t.canOpenTerminal&&a("toggle-worktrees",t.showWorktrees?"Hide worktrees":"Show worktrees","git branches panel",Fe,t.onToggleWorktrees)),A=_(t.onOpenProjectInEditor&&a("open-project-editor","Open project in editor","code cursor vscode zed workspace",pe,t.onOpenProjectInEditor),t.onRevealProject&&a("reveal-project","Reveal project in file manager","finder explorer folder directory",Ge,t.onRevealProject),t.onCopyResumeCommand&&a("copy-resume-command","Copy resume command","cli claude codex terminal clipboard continue session",ne,t.onCopyResumeCommand),t.onCopyProjectPath&&a("copy-project-path","Copy project path","workspace directory clipboard",ne,t.onCopyProjectPath),t.onOpenIntegratedTerminal&&a("integrated-terminal","New integrated terminal","embedded shell command line process panel",Be,t.onOpenIntegratedTerminal,h("newIntegratedTerminal")),t.canOpenTerminal&&a("terminal","Open in system terminal","external shell command line app",ze,t.onOpenTerminal,h("systemTerminal")),t.onTogglePreview&&a("preview","Toggle development preview","browser localhost dev server website",Ke,t.onTogglePreview,h("preview")),t.onOpenKeyboardShortcuts&&a("keyboard-shortcuts","Customize keyboard shortcuts","keybindings hotkeys settings",qe,t.onOpenKeyboardShortcuts),t.onOpenConfig&&a("config",t.showConfig?"Close agent configuration":"Open agent configuration","skills commands claude settings files",He,t.onOpenConfig),a("settings","Open Cogpit settings","preferences network",Me,t.onOpenSettings),a("theme","Change theme & chat width","appearance light dark oled width narrow wide",Le,t.onOpenTheme,h("themeSelector")),a("expand","Expand all groups","conversation details",te,t.onExpandAll,h("expandAll")),a("expand-payloads","Expand all tool payloads","raw input result diff conversation details",te,t.onExpandToolPayloads,h("expandToolPayloads")),a("collapse","Collapse all","conversation groups payloads details",De,t.onCollapseAll),t.onKillAll&&a("kill-all","Kill all agent processes","stop terminate halt everything runaway",Ae,t.onKillAll),t.onOpenDevices&&a("manage-devices","Manage devices…","remote machines hub hosts edit rename remove switch",Ue,()=>{var n;return(n=t.onOpenDevices)==null?void 0:n.call(t,"manage")}),t.onOpenDevices&&a("add-device","Add device…","remote machine hub host connect pair new",ee,()=>{var n;return(n=t.onOpenDevices)==null?void 0:n.call(t,"add")})),D=[{value:"Navigation",items:$},...o.length>0?[{value:"Recent sessions",items:o}]:[],...I.length>0?[{value:"Projects",items:I}]:[],...P.length>0?[{value:"Devices",items:P}]:[],{value:"View",items:R},{value:"Tools",items:A}],F=function(l){t.onOpenChange(!1),l.run()};i=me,x=t.open,k=t.onOpenChange,b="Command palette",v="Search for a Cogpit action to run.",w="max-w-xl",c=ue,C="Search commands",g=!0,e[16]===Symbol.for("react.memo_cache_sentinel")?(y=u.jsx(he,{"aria-label":"Search commands",autoFocus:!0,placeholder:"Search commands..."}),e[16]=y):y=e[16],e[17]!==t.loadingNavigation?(f=t.loadingNavigation&&u.jsxs("div",{className:"motion-enter flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",role:"status",children:[u.jsx(le,{className:"size-3.5"}),"Loading projects and sessions..."]}),e[17]=t.loadingNavigation,e[18]=f):f=e[18],s=ge,m="max-h-[min(26rem,60vh)]",e[19]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(fe,{children:"No matching actions."}),e[19]=d):d=e[19],r=D.map(n=>u.jsx(ce,{heading:n.value,children:n.items.map(l=>{const j=l.icon;return u.jsxs(re,{value:l.value,onSelect:()=>F(l),children:[u.jsx(j,{"aria-hidden":"true"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate",children:l.label}),l.description&&u.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:l.description})]}),l.shortcut&&u.jsx(de,{children:l.shortcut})]},l.id)})},n.value)),e[0]=t,e[1]=s,e[2]=c,e[3]=i,e[4]=m,e[5]=d,e[6]=v,e[7]=w,e[8]=r,e[9]=C,e[10]=g,e[11]=y,e[12]=f,e[13]=x,e[14]=k,e[15]=b}else s=e[1],c=e[2],i=e[3],m=e[4],d=e[5],v=e[6],w=e[7],r=e[8],C=e[9],g=e[10],y=e[11],f=e[12],x=e[13],k=e[14],b=e[15];let T;e[20]!==s||e[21]!==m||e[22]!==d||e[23]!==r?(T=u.jsxs(s,{className:m,children:[d,r]}),e[20]=s,e[21]=m,e[22]=d,e[23]=r,e[24]=T):T=e[24];let O;e[25]!==c||e[26]!==T||e[27]!==C||e[28]!==g||e[29]!==y||e[30]!==f?(O=u.jsxs(c,{label:C,loop:g,children:[y,f,T]}),e[25]=c,e[26]=T,e[27]=C,e[28]=g,e[29]=y,e[30]=f,e[31]=O):O=e[31];let N;return e[32]!==i||e[33]!==v||e[34]!==w||e[35]!==O||e[36]!==x||e[37]!==k||e[38]!==b?(N=u.jsx(i,{open:x,onOpenChange:k,title:b,description:v,className:w,children:O}),e[32]=i,e[33]=v,e[34]=w,e[35]=O,e[36]=x,e[37]=k,e[38]=b,e[39]=N):N=e[39],N}async function ae(t,e){const s=await ye(t,{signal:e});if(!s.ok)throw new Error(`Request failed (${s.status})`);const c=await s.json();return Array.isArray(c)?c:[]}function Ye(t){var J;const e=oe.c(48);let s,c,i,m,d,v;e[0]!==t?({open:i,currentProjectDirName:s,projectCwd:d,onProcessStarted:c,launchTerminalRequest:v,...m}=t,e[0]=t,e[1]=s,e[2]=c,e[3]=i,e[4]=m,e[5]=d,e[6]=v):(s=e[1],c=e[2],i=e[3],m=e[4],d=e[5],v=e[6]);const w=v===void 0?0:v,r=ve();let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=[],e[7]=C):C=e[7];const[g,y]=M.useState(C);let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[8]=f):f=e[8];const[x,k]=M.useState(f),[b,T]=M.useState(!1),O=M.useRef(0);let N,$;e[9]!==i?(N=()=>{if(!i)return;const S=new AbortController;return T(!0),Promise.allSettled([ae("/api/projects",S.signal),ae("/api/active-sessions?limit=12&perProject=3",S.signal)]).then(H=>{const[V,X]=H;S.signal.aborted||(y(V.status==="fulfilled"?V.value:[]),k(X.status==="fulfilled"?X.value:[]),T(!1))}),()=>S.abort()},$=[i],e[9]=i,e[10]=N,e[11]=$):(N=e[10],$=e[11]),M.useEffect(N,$);let I;e:{if(d){I=d;break e}if(!s){I=null;break e}let S;e[12]!==s||e[13]!==g?(S=((J=g.find(H=>H.dirName===s))==null?void 0:J.path)??null,e[12]=s,e[13]=g,e[14]=S):S=e[14],I=S}const o=I;let E;e[15]!==c||e[16]!==r||e[17]!==o?(E=()=>{if(!o)return;const S=r.spawnTerminal({cwd:o}),H=o.replace(/\/+$/,"").split("/").at(-1)||"Terminal";c({id:S,name:H,type:"terminal",status:"running",source:o})},e[15]=c,e[16]=r,e[17]=o,e[18]=E):E=e[18];const P=E;let R,A;e[19]!==P||e[20]!==w||e[21]!==r.status||e[22]!==o?(R=()=>{w<=O.current||!o||r.status!=="connected"||(O.current=w,P())},A=[P,w,r.status,o],e[19]=P,e[20]=w,e[21]=r.status,e[22]=o,e[23]=R,e[24]=A):(R=e[23],A=e[24]),M.useEffect(R,A);let D;e[25]!==s||e[26]!==o?(D={path:o,dirName:s},e[25]=s,e[26]=o,e[27]=D):D=e[27];const F=D;let n;e[28]!==F?(n=()=>Ce(F),e[28]=F,e[29]=n):n=e[29];const l=n;let j;e[30]!==F?(j=()=>je(F),e[30]=F,e[31]=j):j=e[31];const B=j,q=!Y()&&W("hostFiles"),se=W("hostFiles")&&(!Y()||we());let K;e[32]!==o?(K=()=>{o&&Se(o)},e[32]=o,e[33]=K):K=e[33];const ie=K;let L;e[34]!==P||e[35]!==r.status||e[36]!==o?(L=o&&r.status==="connected"&&W("terminal")?P:void 0,e[34]=P,e[35]=r.status,e[36]=o,e[37]=L):L=e[37];const G=o&&se?l:void 0,p=o&&q?B:void 0,U=o?ie:void 0;let z;return e[38]!==b||e[39]!==i||e[40]!==m||e[41]!==g||e[42]!==x||e[43]!==L||e[44]!==G||e[45]!==p||e[46]!==U?(z=u.jsx(We,{...m,open:i,projects:g,recentSessions:x,loadingNavigation:b,onOpenIntegratedTerminal:L,onOpenProjectInEditor:G,onRevealProject:p,onCopyProjectPath:U}),e[38]=b,e[39]=i,e[40]=m,e[41]=g,e[42]=x,e[43]=L,e[44]=G,e[45]=p,e[46]=U,e[47]=z):z=e[47],z}export{Ye as CommandPaletteHost};
@@ -1 +0,0 @@
1
- import{c as G,j as t,r as o}from"./vendor-react-gGw_S5I_.js";import{T as P,a8 as je,a9 as W,aC as X,ac as be,ad as q,aG as se,B as z,w as A,a$ as ye,b0 as Ce,b1 as ke,b2 as ve,b3 as Ne,b4 as Se,b5 as V,b6 as we,b7 as Z,b8 as De,U as ee,Z as ae,b9 as Te,_ as le,$ as ie,a1 as re,a2 as oe,a3 as ce,a4 as de,a5 as ue,ah as Ee,E as Re,y as Ie,z as Oe,G as ze,H as Le,R as Ae,m as $e,I as te,n as Be,aa as Ge,q as Fe,ba as Me}from"./index-CNV6e3p0.js";import{af as Pe,B as Ue,b as _e,ab as Ve,ag as He,ah as Ke,ai as me,aj as xe,ak as Je,al as Qe,o as H,X as K,P as Ye,am as fe,an as We,T as Xe,a8 as qe,S as Ze}from"./vendor-ui-BmLOQ5Or.js";import{H as et}from"./HighlightedEditor-BPmH8BvC.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const tt={agent:"bg-muted text-muted-foreground",skill:"bg-muted text-muted-foreground",command:"bg-muted text-muted-foreground",instructions:"bg-muted text-muted-foreground",settings:"bg-muted text-muted-foreground"},nt={agents:{subdir:"agents",fileType:"agent"},skills:{subdir:"skills",fileType:"skill"},commands:{subdir:"commands",fileType:"command"}},ne=["instructions","agents","skills","commands","settings"],st={instructions:{label:"Instructions",icon:He,color:"text-muted-foreground"},agents:{label:"Agents",icon:Ve,color:"text-muted-foreground"},skills:{label:"Skills",icon:_e,color:"text-muted-foreground"},commands:{label:"Commands",icon:Ue,color:"text-muted-foreground"},settings:{label:"Settings",icon:Pe,color:"text-muted-foreground"}};function J(l,e,i){const n=[];for(const s of l)s.type==="directory"&&s.children?n.push(...J(s.children,e,i)):s.type==="file"&&n.push({name:s.name,path:s.path,fileType:s.fileType||"unknown",description:s.description||"",scope:e,pluginName:i,readOnly:s.readOnly??e==="plugin",cli:s.cli,linkTarget:s.linkTarget});return n}function at(l){const e={instructions:[],agents:[],skills:[],commands:[],settings:[]};for(const i of l){const n=J(i.items,i.scope,i.pluginName);for(const s of n)switch(s.fileType){case"instructions":e.instructions.push(s);break;case"agent":e.agents.push(s);break;case"skill":e.skills.push(s);break;case"command":e.commands.push(s);break;case"settings":default:e.settings.push(s)}}return e}function he(l){const e=G.c(5),{scope:i,pluginName:n}=l;if(i==="plugin"&&n){let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Ke,{"data-icon":"inline-start",className:"size-3"}),e[0]=r):r=e[0];let u;return e[1]!==n?(u=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r,n]}),e[1]=n,e[2]=u):u=e[2],u}if(i==="project"){let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(me,{"data-icon":"inline-start",className:"size-3"}),"project"]}),e[3]=r):r=e[3],r}let s;return e[4]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(xe,{"data-icon":"inline-start",className:"size-3"}),"global"]}),e[4]=s):s=e[4],s}const lt={claude:{letter:"C",label:"Loaded by Claude Code"},codex:{letter:"X",label:"Loaded by Codex CLI"}};function pe(l){const e=G.c(10),{cli:i,variant:n}=l,s=n===void 0?"compact":n;if(!i)return null;if(i.length===0){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Je,{"data-icon":"inline-start",className:"size-3"}),e[0]=m):m=e[0];const c=s==="full"&&"unlinked";let d;return e[1]!==c?(d=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-warning",title:"Present in the shared source directory but not linked into Claude or Codex",children:[m,c]}),e[1]=c,e[2]=d):d=e[2],d}let r;if(e[3]!==i||e[4]!==s){let m;e[6]!==s?(m=c=>{const d=lt[c];return t.jsx("span",{title:d.label,className:s==="full"?"flex h-5 items-center justify-center rounded border bg-muted px-1.5 text-xs font-medium text-muted-foreground":"flex size-5 items-center justify-center rounded border bg-muted text-xs font-medium text-muted-foreground",children:s==="full"?c:d.letter},c)},e[6]=s,e[7]=m):m=e[7],r=i.map(m),e[3]=i,e[4]=s,e[5]=r}else r=e[5];let u;return e[8]!==r?(u=t.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:r}),e[8]=r,e[9]=u):u=e[9],u}function ge(l){const e=G.c(10),{linkTarget:i,variant:n,className:s}=l,r=n===void 0?"compact":n;if(!i)return null;let u;e[0]!==s?(u=P("flex min-w-0 shrink-0 items-center gap-1 text-info",s),e[0]=s,e[1]=u):u=e[1];const m=`Symlink → ${i}`;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Qe,{"data-icon":"inline-start",className:"size-3 shrink-0"}),e[2]=c):c=e[2];let d;e[3]!==i||e[4]!==r?(d=r==="full"&&t.jsxs("span",{className:"truncate font-mono text-xs",children:["→ ",i]}),e[3]=i,e[4]=r,e[5]=d):d=e[5];let g;return e[6]!==u||e[7]!==m||e[8]!==d?(g=t.jsxs("span",{className:u,title:m,children:[c,d]}),e[6]=u,e[7]=m,e[8]=d,e[9]=g):g=e[9],g}function it({globalDir:l,projectDir:e,fileType:i,onCreated:n,onCancel:s}){const[r,u]=o.useState(""),[m,c]=o.useState(e?"project":"global"),[d,g]=o.useState(!1),N=o.useRef(null),k=o.useId();o.useEffect(()=>{var h;(h=N.current)==null||h.focus()},[]);const S=m==="project"&&e?e:l,f=!!l&&!!e;async function w(){if(!(!r.trim()||!S)){g(!0);try{const h=await A("/api/config-browser/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:S,fileType:i,name:r.trim()})});if(h.ok){const p=await h.json();n(p.path,i,m)}}finally{g(!1)}}}return t.jsxs(je,{className:"gap-3 px-3 py-2",children:[f&&t.jsxs(W,{children:[t.jsx(X,{children:"Scope"}),t.jsxs(be,{"aria-label":"File scope",value:[m],onValueChange:h=>{const p=h[0];(p==="global"||p==="project")&&c(p)},variant:"outline",size:"sm",spacing:0,className:"w-full",children:[t.jsxs(q,{value:"global",className:"flex-1",children:[t.jsx(xe,{"data-icon":"inline-start"}),"Global"]}),t.jsxs(q,{value:"project",className:"flex-1",children:[t.jsx(me,{"data-icon":"inline-start"}),"Project"]})]})]}),t.jsxs(W,{children:[t.jsxs(X,{htmlFor:k,children:[i.charAt(0).toUpperCase()+i.slice(1)," name"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(se,{id:k,ref:N,type:"text",value:r,onChange:h=>u(h.target.value),onKeyDown:h=>{h.key==="Enter"&&w(),h.key==="Escape"&&s()},placeholder:`${i} name...`,className:"h-7 min-w-0 flex-1 text-xs",disabled:d}),t.jsx(z,{variant:"ghost",size:"icon-xs","aria-label":`Create ${i}`,onClick:()=>void w(),disabled:d||!r.trim()||!S,children:t.jsx(H,{"data-icon":"inline-start"})}),t.jsx(z,{variant:"ghost",size:"icon-xs","aria-label":"Cancel create",onClick:s,children:t.jsx(K,{"data-icon":"inline-start"})})]})]})]})}function rt(l){const e=G.c(50),{category:i,items:n,selectedPath:s,onSelect:r,onNewFile:u,onDeleteItem:m,onRenameItem:c,renamingPath:d,renameValue:g,onRenameValueChange:N,onRenameSubmit:k,onRenameCancel:S,creatingInCategory:f,onCreated:w,onCancelCreate:h}=l,p=st[i],j=p.icon;if(n.length===0&&!u)return null;let D;e[0]!==p.color?(D=P("size-3.5",p.color),e[0]=p.color,e[1]=D):D=e[1];let T;e[2]!==j||e[3]!==D?(T=t.jsx(j,{"data-icon":"inline-start",className:D}),e[2]=j,e[3]=D,e[4]=T):T=e[4];let y;e[5]!==p.label?(y=t.jsx("span",{className:"flex-1 text-xs font-medium text-muted-foreground",children:p.label}),e[5]=p.label,e[6]=y):y=e[6];let R;e[7]!==n.length?(R=t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n.length}),e[7]=n.length,e[8]=R):R=e[8];let C;e[9]!==i||e[10]!==u?(C=u&&t.jsxs(ye,{children:[t.jsx(Ce,{render:t.jsx(z,{variant:"ghost",size:"icon-xs",className:"opacity-0 transition-opacity group-hover:opacity-100","aria-label":`New ${i.slice(0,-1)}`,onClick:u}),children:t.jsx(Ye,{"data-icon":"inline-start"})}),t.jsxs(ke,{children:["New ",i.slice(0,-1)]})]}),e[9]=i,e[10]=u,e[11]=C):C=e[11];let v;e[12]!==T||e[13]!==y||e[14]!==R||e[15]!==C?(v=t.jsxs("div",{className:"group flex h-8 items-center gap-1.5 px-3",children:[T,y,R,C]}),e[12]=T,e[13]=y,e[14]=R,e[15]=C,e[16]=v):v=e[16];let E;if(e[17]!==n||e[18]!==m||e[19]!==S||e[20]!==c||e[21]!==k||e[22]!==N||e[23]!==r||e[24]!==g||e[25]!==d||e[26]!==s){let B;e[28]!==m||e[29]!==S||e[30]!==c||e[31]!==k||e[32]!==N||e[33]!==r||e[34]!==g||e[35]!==d||e[36]!==s?(B=b=>{const U=s===b.path;if(d===b.path)return t.jsxs("div",{className:"flex items-center gap-1 border-l-2 border-foreground/30 bg-accent px-3 py-1",children:[t.jsx(se,{value:g,onChange:L=>N(L.target.value),onKeyDown:L=>{L.key==="Enter"&&k(),L.key==="Escape"&&S()},autoFocus:!0,className:"h-7 min-w-0 flex-1 text-xs"}),t.jsx(z,{variant:"ghost",size:"icon-xs","aria-label":"Save name",onClick:k,disabled:!g.trim(),children:t.jsx(H,{"data-icon":"inline-start"})}),t.jsx(z,{variant:"ghost",size:"icon-xs","aria-label":"Cancel rename",onClick:S,children:t.jsx(K,{"data-icon":"inline-start"})})]},b.path);const F=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"truncate text-sm",children:b.name}),t.jsx(ge,{linkTarget:b.linkTarget}),b.readOnly&&t.jsx(fe,{className:"size-2.5 shrink-0 text-muted-foreground/40"})]}),b.description&&t.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:b.description})]}),t.jsx(pe,{cli:b.cli}),t.jsx(he,{scope:b.scope,pluginName:b.pluginName})]}),M=P("flex w-full items-center gap-2 border-l-2 px-3 py-2 text-left text-sm transition-colors",U?"border-foreground/30 bg-accent text-accent-foreground":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground");return!m||!c?t.jsx("button",{type:"button",className:M,onClick:()=>r(b),children:F},b.path):t.jsxs(ve,{children:[t.jsx(Ne,{render:t.jsx("button",{type:"button",className:M,onClick:()=>r(b)}),children:F}),t.jsx(Se,{className:"min-w-36",children:b.readOnly?t.jsx(V,{children:t.jsx(we,{children:"Read-only file"})}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(Z,{onClick:()=>c(b),children:"Rename"})}),t.jsx(De,{}),t.jsx(V,{children:t.jsx(Z,{variant:"destructive",onClick:()=>m(b),children:"Delete"})})]})})]},b.path)},e[28]=m,e[29]=S,e[30]=c,e[31]=k,e[32]=N,e[33]=r,e[34]=g,e[35]=d,e[36]=s,e[37]=B):B=e[37],E=n.map(B),e[17]=n,e[18]=m,e[19]=S,e[20]=c,e[21]=k,e[22]=N,e[23]=r,e[24]=g,e[25]=d,e[26]=s,e[27]=E}else E=e[27];let I;e[38]!==f||e[39]!==n.length?(I=n.length===0&&!f&&t.jsx("p",{className:"px-3 py-1 text-xs text-muted-foreground",children:"None configured"}),e[38]=f,e[39]=n.length,e[40]=I):I=e[40];let O;e[41]!==f||e[42]!==h||e[43]!==w?(O=f&&t.jsx(it,{globalDir:f.globalDir,projectDir:f.projectDir,fileType:f.fileType,onCreated:w,onCancel:h}),e[41]=f,e[42]=h,e[43]=w,e[44]=O):O=e[44];let $;return e[45]!==v||e[46]!==E||e[47]!==I||e[48]!==O?($=t.jsxs("section",{children:[v,E,I,O]}),e[45]=v,e[46]=E,e[47]=I,e[48]=O,e[49]=$):$=e[49],$}function ot({file:l,onDeleted:e,readOnly:i=!1}){const[n,s]=o.useState(null),[r,u]=o.useState(null),[m,c]=o.useState(!0),[d,g]=o.useState(!1),[N,k]=o.useState(!1),[S,f]=o.useState(!1),[w,h]=o.useState(!1),p=n!==null&&n!==r,j=i||l.readOnly;o.useEffect(()=>{c(!0),s(null),u(null),k(!1),f(!1),A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`).then(C=>C.json()).then(C=>{s(C.content??""),u(C.content??"")}).catch(()=>{s(""),u("")}).finally(()=>c(!1))},[l.path]);const D=o.useCallback(async()=>{if(!(!p||j)){g(!0);try{(await A("/api/config-browser/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:l.path,content:n})})).ok&&(u(n),k(!0),setTimeout(()=>k(!1),2e3))}finally{g(!1)}}},[n,l.path,p,j]),T=o.useCallback(()=>{s(r)},[r]),y=o.useCallback(async()=>{if(!j){h(!0);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`,{method:"DELETE"})).ok&&(f(!1),e())}catch{}finally{h(!1)}}},[l.path,j,e]);o.useEffect(()=>{function C(v){!j&&(v.metaKey||v.ctrlKey)&&v.key==="s"&&(v.preventDefault(),D())}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[D,j]);function R(){return N?"Saved!":d?"Saving...":"Save"}return t.jsxs("div",{className:"flex flex-1 flex-col min-h-0 min-w-0",children:[t.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b bg-card px-4 py-2",children:[t.jsx(ee,{variant:"outline",className:P("h-5 text-xs",tt[l.fileType]||"bg-muted text-muted-foreground"),children:l.fileType}),t.jsx(he,{scope:l.scope,pluginName:l.pluginName}),t.jsx(pe,{cli:l.cli,variant:"full"}),j&&t.jsxs(ee,{variant:"outline",className:"h-5 bg-muted text-xs text-muted-foreground",children:[t.jsx(fe,{"data-icon":"inline-start",className:"size-3"})," read-only"]}),p&&t.jsx("span",{className:"size-2 shrink-0 rounded-full bg-warning",title:"Unsaved changes"}),t.jsxs("div",{className:"flex items-center gap-2 ml-auto min-w-0",children:[t.jsx(ge,{linkTarget:l.linkTarget,variant:"full"}),t.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",title:l.path,children:l.path})]})]}),m?t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:"Loading..."}):t.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:[t.jsx(et,{value:n??"",onChange:s,readOnly:j,filePath:l.path}),!j&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t bg-card px-4 py-2",children:[t.jsxs(z,{size:"xs",onClick:D,disabled:!p||d,children:[t.jsx(H,{"data-icon":"inline-start"}),R()]}),t.jsxs(z,{variant:"outline",size:"xs",onClick:T,disabled:!p,children:[t.jsx(We,{"data-icon":"inline-start"}),"Discard"]}),t.jsx("div",{className:"flex-1"}),t.jsxs(ae,{open:S,onOpenChange:f,children:[t.jsxs(Te,{render:t.jsx(z,{variant:"outline",size:"xs"}),children:[t.jsx(Xe,{"data-icon":"inline-start"}),"Delete"]}),t.jsxs(le,{size:"sm",children:[t.jsxs(ie,{children:[t.jsx(re,{children:"Delete configuration file?"}),t.jsxs(oe,{children:['Delete "',l.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(ce,{children:[t.jsx(de,{size:"sm",disabled:w,children:"Cancel"}),t.jsxs(ue,{variant:"destructive",size:"sm",disabled:w,onClick:()=>void y(),children:[w&&t.jsx(Ee,{"data-icon":"inline-start"}),w?"Deleting...":"Delete file"]})]})]})]})]})]})]})}function ct(){const l=G.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Re,{className:"border-0",children:t.jsxs(Ie,{children:[t.jsx(Oe,{variant:"icon",children:t.jsx(qe,{})}),t.jsx(ze,{children:"Select a configuration file"}),t.jsx(Le,{children:"Browse instructions, agents, skills, commands, and settings from the sidebar."})]})}),l[0]=e):e=l[0],e}function dt(l){return l.cli?l.cli.length>0?l.cli.join(" "):"unlinked":""}function ut(l,e){if(!e)return l;const i=e.toLowerCase();return l.filter(n=>[n.name,n.description,n.path,n.linkTarget??"",dt(n)].some(r=>r.toLowerCase().includes(i)))}const jt=o.memo(function({projectPath:e,initialFilePath:i}){var L,Y;const n=Ae("configWrite"),[s,r]=o.useState([]),[u,m]=o.useState(!0),[c,d]=o.useState(null),[g,N]=o.useState(null),[k,S]=o.useState(""),[f,w]=o.useState(null),[h,p]=o.useState(""),[j,D]=o.useState(null),T=o.useRef(!1),y=o.useCallback(async()=>{if(!n){r([]),d(null),m(!1);return}m(!0);try{const a=e?`/api/config-browser/tree?cwd=${encodeURIComponent(e)}`:"/api/config-browser/tree",x=await A(a);if(x.ok){const _=await x.json();r(_.sections||[])}}finally{m(!1)}},[n,e]);o.useEffect(()=>{y()},[y]),o.useEffect(()=>{if(!i||u||T.current)return;const a=s.flatMap(x=>J(x.items,x.scope,x.pluginName)).find(x=>x.path===i);a&&(d(a),T.current=!0)},[i,u,s]);const R=at(s),C=Object.fromEntries(ne.map(a=>[a,ut(R[a],k)])),v=(L=s.find(a=>a.scope==="global"))==null?void 0:L.baseDir,E=(Y=s.find(a=>a.scope==="project"))==null?void 0:Y.baseDir,I=o.useCallback(a=>{d(a),N(null)},[]),O=o.useCallback((a,x,_)=>{N(null),y(),d({path:a,name:a.split("/").pop()||"",fileType:x,readOnly:!1,scope:_,description:""})},[y]),$=o.useCallback(()=>{d(null),y()},[y]),B=o.useCallback(a=>{if(!n||!v&&!E)return;const x=nt[a];x&&N({category:a,globalDir:v?`${v}/${x.subdir}`:null,projectDir:E?`${E}/${x.subdir}`:null,fileType:x.fileType})},[n,v,E]),b=o.useCallback(a=>{!n||a.readOnly||D(a)},[n]),U=o.useCallback(async()=>{if(!n||!j||j.readOnly)return;const a=j;D(null);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(a.path)}`,{method:"DELETE"})).ok&&((c==null?void 0:c.path)===a.path&&d(null),y())}catch{}},[n,y,j,c]),Q=o.useCallback(a=>{if(!n||a.readOnly)return;const x=a.name==="SKILL.md"?a.path.split("/").slice(-2,-1)[0]||a.name:a.name.replace(/\.[^.]+$/,"");w(a),p(x)},[n]),F=o.useCallback(async()=>{if(!(!n||!f||!h.trim()))try{const a=await A("/api/config-browser/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:f.path,newName:h.trim()})});if(a.ok){const x=await a.json();w(null),p(""),await y(),x.newPath&&d({...f,path:x.newPath,name:x.newPath.split("/").pop()||f.name})}}catch{}},[n,f,h,y]),M=o.useCallback(()=>{w(null),p("")},[]);return n?t.jsxs("div",{className:"flex flex-1 min-h-0 min-w-0",children:[t.jsxs("div",{className:"flex min-h-0 w-80 shrink-0 flex-col border-r bg-sidebar",children:[t.jsxs("div",{className:"flex h-11 items-center gap-2 border-b px-3",children:[t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Configuration"}),e&&t.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",title:e,children:e.split("/").pop()})]}),t.jsx("div",{className:"border-b p-2",children:t.jsxs($e,{children:[t.jsx(te,{children:t.jsx(Ze,{"data-icon":"inline-start"})}),t.jsx(Be,{value:k,onChange:a=>S(a.target.value),placeholder:"Search configuration"}),k&&t.jsx(te,{align:"inline-end",children:t.jsx(Ge,{size:"icon-xs","aria-label":"Clear search",onClick:()=>S(""),children:t.jsx(K,{"data-icon":"inline-start"})})})]})}),t.jsx(Fe,{className:"flex-1",children:t.jsx("div",{className:"flex flex-col gap-1 py-2",children:u?t.jsx("div",{className:"flex flex-col gap-2 px-3 py-2","aria-label":"Loading configuration",children:Array.from({length:6},(a,x)=>t.jsx(Me,{className:"h-8 w-full"},x))}):ne.map(a=>{const x=a==="agents"||a==="skills"||a==="commands";return t.jsx(rt,{category:a,items:C[a],selectedPath:(c==null?void 0:c.path)??null,onSelect:I,onNewFile:n&&x?()=>B(a):void 0,onDeleteItem:n?b:void 0,onRenameItem:n?Q:void 0,renamingPath:(f==null?void 0:f.path)??null,renameValue:h,onRenameValueChange:p,onRenameSubmit:F,onRenameCancel:M,creatingInCategory:n&&(g==null?void 0:g.category)===a?g:null,onCreated:O,onCancelCreate:()=>N(null)},a)})})})]}),c?t.jsx(ot,{file:c,onDeleted:$,readOnly:!n}):t.jsx(ct,{}),t.jsx(ae,{open:j!==null,onOpenChange:a=>{a||D(null)},children:t.jsxs(le,{size:"sm",children:[t.jsxs(ie,{children:[t.jsx(re,{children:"Delete configuration file?"}),t.jsxs(oe,{children:['Delete "',j==null?void 0:j.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(ce,{children:[t.jsx(de,{size:"sm",children:"Cancel"}),t.jsx(ue,{variant:"destructive",size:"sm",onClick:()=>void U(),children:"Delete file"})]})]})})]}):t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Server configuration is available to administrators only."})});export{jt as ConfigBrowser};
@@ -1 +0,0 @@
1
- import{c as U,r as A,j as t}from"./vendor-react-gGw_S5I_.js";import{v as X,w as Y,i as Z,j as _,k as ee,C as te,x as se,E as ae,y as ne,z as oe,G as ie,H as le,J as q,L as J,M as re,N as de,h as ce,O as me,D as he,P as ue,Q as fe}from"./index-CNV6e3p0.js";import{F as Q,a as xe}from"./vendor-ui-BmLOQ5Or.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function ge(v){const e=U.c(56),{open:l,onClose:n,onNewSession:c,onNewFolder:H,defaultAgentKind:O,currentProjectDirName:u,currentProjectCwd:m}=v;let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=[],e[0]=S):S=e[0];const[i,R]=A.useState(S),[r,W]=A.useState("");let P,D;e[1]!==l?(P=()=>{l&&(W(""),Y("/api/projects").then(pe).then(s=>R(s)).catch(()=>R([])))},D=[l],e[1]=l,e[2]=P,e[3]=D):(P=e[2],D=e[3]),A.useEffect(P,D);let E,F;e[4]!==m||e[5]!==u||e[6]!==n||e[7]!==c||e[8]!==l||e[9]!==i?(E=()=>{if(!l)return;const s=function(h){var g;if(ue("newSession",h)&&u){h.preventDefault();const V=m?fe(i,m)??((g=i.find(B=>B.path===m))==null?void 0:g.dirName)??u:u;c(V,m??void 0),n()}};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},F=[l,i,u,m,c,n],e[4]=m,e[5]=u,e[6]=n,e[7]=c,e[8]=l,e[9]=i,e[10]=E,e[11]=F):(E=e[10],F=e[11]),A.useEffect(E,F);const{names:d}=X();let T;e:{if(!r){T=i;break e}let s;if(e[12]!==r||e[13]!==d||e[14]!==i){const a=r.toLowerCase();s=i.filter(h=>{var g;return h.path.toLowerCase().includes(a)||h.shortName.toLowerCase().includes(a)||h.dirName.toLowerCase().includes(a)||((g=d[h.dirName])==null?void 0:g.toLowerCase().includes(a))}),e[12]=r,e[13]=d,e[14]=i,e[15]=s}else s=e[15];T=s}const G=T;let o,f,b;e[16]!==r?(o=r.trim(),f=o.replace(/[\\/]+$/,"")||o,b=o.startsWith("/")||/^[a-z]:[\\/]/i.test(o)||o.startsWith("\\\\"),e[16]=r,e[17]=o,e[18]=f,e[19]=b):(o=e[17],f=e[18],b=e[19]);const I=b;let L;e[20]!==I||e[21]!==f||e[22]!==i?(L=I&&!i.some(s=>(s.path.replace(/[\\/]+$/,"")||s.path)===f),e[20]=I,e[21]=f,e[22]=i,e[23]=L):L=e[23];const K=L;let k;e[24]!==n||e[25]!==c?(k=s=>{c(s.dirName,s.path),n()},e[24]=n,e[25]=c,e[26]=k):k=e[26];const y=k;let x;e[27]!==n?(x=s=>{s||n()},e[27]=n,e[28]=x):x=e[28];let z;e[29]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsxs(Z,{className:"sr-only",children:[t.jsx(_,{children:"Start a session"}),t.jsx(ee,{children:"Choose a project or enter an absolute folder path."})]}),e[29]=z):z=e[29];let p;e[30]!==r?(p=t.jsx(te,{autoFocus:!0,placeholder:"Search projects or paste an absolute path...",value:r,onValueChange:W}),e[30]=r,e[31]=p):p=e[31];let M;e[32]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx(se,{className:"py-0",children:t.jsx(ae,{className:"border-0 py-8",children:t.jsxs(ne,{children:[t.jsx(oe,{variant:"icon",children:t.jsx(Q,{})}),t.jsx(ie,{children:"No projects found"}),t.jsx(le,{children:"Try another name or paste an absolute path."})]})})}),e[32]=M):M=e[32];let N;e[33]!==K||e[34]!==O||e[35]!==o||e[36]!==n||e[37]!==H?(N=K&&t.jsxs(q,{value:`folder:${o}`,className:"motion-list-item h-auto gap-3 px-3 py-2.5",onSelect:()=>{H(o),n()},children:[t.jsx(xe,{"data-icon":"inline-start",className:"size-4 shrink-0 text-foreground"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm font-medium",children:"Start in this folder"}),t.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[o," · ",O==="codex"?"Codex":"Claude"]})]})]}),e[33]=K,e[34]=O,e[35]=o,e[36]=n,e[37]=H,e[38]=N):N=e[38];let j;if(e[39]!==G||e[40]!==y||e[41]!==d){let s;e[43]!==y||e[44]!==d?(s=a=>t.jsxs(q,{value:`project:${a.dirName}`,className:"motion-list-item h-auto gap-3 px-3 py-2.5",onSelect:()=>y(a),children:[t.jsx(Q,{"data-icon":"inline-start",className:"size-4 shrink-0 text-muted-foreground"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"truncate text-sm font-medium",children:d[a.dirName]||J(a.path)}),t.jsxs("div",{className:"text-xs text-muted-foreground",children:[d[a.dirName]&&t.jsx("span",{className:"mr-1.5",children:J(a.path)}),a.sessionCount," session",a.sessionCount!==1?"s":"",a.lastModified&&t.jsxs(t.Fragment,{children:[" · ",new Date(a.lastModified).toLocaleDateString()]})]})]})]},a.dirName),e[43]=y,e[44]=d,e[45]=s):s=e[45],j=G.map(s),e[39]=G,e[40]=y,e[41]=d,e[42]=j}else j=e[42];let C;e[46]!==N||e[47]!==j?(C=t.jsxs(re,{className:"max-h-80 p-1",children:[M,t.jsxs(de,{className:"p-0",children:[N,j]})]}),e[46]=N,e[47]=j,e[48]=C):C=e[48];let w;e[49]!==p||e[50]!==C?(w=t.jsxs(ce,{className:"max-w-md gap-0 overflow-hidden p-0",children:[z,t.jsxs(me,{shouldFilter:!1,className:"rounded-none p-0",children:[p,C]})]}),e[49]=p,e[50]=C,e[51]=w):w=e[51];let $;return e[52]!==l||e[53]!==x||e[54]!==w?($=t.jsx(he,{open:l,onOpenChange:x,children:w}),e[52]=l,e[53]=x,e[54]=w,e[55]=$):$=e[55],$}function pe(v){return v.ok?v.json():[]}export{ge as ProjectSwitcherModal};
@@ -1 +0,0 @@
1
- import{r as h,j as e}from"./vendor-react-gGw_S5I_.js";import{R as Y,d as Z,c as K,S as Q,a as _,B as x,T as S,b as ee,E as se,y as te,z as ne,G as re,H as ae,U as ie,V as le,W as oe,X as ce,Y as de,Z as A,_ as R,$ as E,a0 as he,a1 as T,a2 as U,a3 as z,a4 as $,a5 as F,w as u,a6 as c}from"./index-CNV6e3p0.js";import{G as P,b as xe,c as me,E as ue,d as pe,T as O,C as je,e as ge}from"./vendor-ui-BmLOQ5Or.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const fe={M:"text-warning",A:"text-success",D:"text-destructive",R:"text-info"};function we({open:I,onOpenChange:H,worktrees:v,loading:p,dirName:a,onRefetch:j,onOpenSession:M}){const o=Y("hostFiles"),[B,y]=h.useState(null),[G,b]=h.useState(null),[J,m]=h.useState(!1),[t,d]=h.useState(null),[r,g]=h.useState(null),C=async s=>{if(!(!o||!a)){y(s.name);try{await u(`/api/worktrees/${encodeURIComponent(a)}/${encodeURIComponent(s.name)}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:s.isDirty})}),j()}catch(n){c.error(`Failed to delete worktree: ${n instanceof Error?n.message:"Unknown error"}`)}finally{y(null)}}},W=s=>{if(!(!o||!a)){if(s.isDirty){d({worktree:s,reason:"dirty"});return}if(s.commitsAhead>0){d({worktree:s,reason:"unpushed"});return}C(s)}},L=()=>{if(!t)return;const{worktree:s,reason:n}=t;if(n==="dirty"&&s.commitsAhead>0){d({worktree:s,reason:"unpushed"});return}d(null),C(s)},q=async s=>{if(!(!o||!a)){b(s.name);try{const n=await u(`/api/worktrees/${encodeURIComponent(a)}/create-pr`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeName:s.name,title:s.name.replace(/-/g," ")})});if(n.ok){const l=await n.json();l.url?window.open(l.url,"_blank","noopener,noreferrer"):c.warning("PR created but no URL was returned")}else{const l=await n.json().catch(()=>({error:"Unknown error"}));c.error(`Failed to create PR: ${l.error||"Unknown error"}`)}}catch(n){c.error(`Error creating PR: ${n instanceof Error?n.message:"Unknown error"}`)}finally{b(null)}}},V=async()=>{if(!(!o||!a)){m(!0);try{const s=await u(`/api/worktrees/${encodeURIComponent(a)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(s.ok){const{stale:n}=await s.json();n.length===0?c.info("No stale worktrees found"):g(n.map(l=>l.name))}}catch(s){c.error(`Cleanup failed: ${s instanceof Error?s.message:"Unknown error"}`)}finally{m(!1)}}},X=async()=>{if(!o||!a||!r)return;const s=r;g(null),m(!0);try{await u(`/api/worktrees/${encodeURIComponent(a)}/cleanup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0,names:s})}),j()}catch(n){c.error(`Cleanup failed: ${n instanceof Error?n.message:"Unknown error"}`)}finally{m(!1)}};return e.jsxs(Z,{open:I,onOpenChange:H,children:[e.jsxs(K,{children:[e.jsxs(Q,{children:[e.jsxs("div",{className:"flex items-center justify-between pr-8",children:[e.jsxs(_,{className:"flex items-center gap-2",children:[e.jsx(P,{"data-icon":"inline-start",className:"size-4"}),"Worktrees"]}),e.jsxs("div",{className:"flex items-center gap-1",children:[o&&e.jsx(x,{variant:"ghost",size:"icon-xs",onClick:V,disabled:J,"aria-label":"Cleanup stale worktrees",children:e.jsx(xe,{"data-icon":"inline-start"})}),e.jsx(x,{variant:"ghost",size:"icon-xs",onClick:j,disabled:p,"aria-label":"Refresh worktrees",children:e.jsx(me,{"data-icon":"inline-start",className:S(p&&"animate-spin")})})]})]}),e.jsx(ee,{children:"Review isolated branches and their file changes."})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2 overflow-y-auto p-3",children:[!a&&e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select a project to view worktrees"}),a&&v.length===0&&!p&&e.jsx(se,{className:"border-0 py-16",children:e.jsxs(te,{children:[e.jsx(ne,{variant:"icon",children:e.jsx(P,{})}),e.jsx(re,{children:"No worktrees"}),e.jsx(ae,{children:"Create a new session with “Isolate in worktree” enabled"})]})}),v.map(s=>{var w,N,D;const n=((w=s.changedFiles)==null?void 0:w.reduce((i,k)=>i+k.additions,0))??0,l=((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:"flex items-center justify-between mb-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-sm font-medium text-foreground truncate",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(ie,{variant:"outline",className:"h-5 shrink-0 px-1.5 text-xs",children:[s.commitsAhead," ahead"]})]}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[s.linkedSessions.length>0&&e.jsx(x,{variant:"ghost",size:"icon-xs",onClick:()=>M(s.linkedSessions[0]),"aria-label":"Open session",children:e.jsx(ue,{"data-icon":"inline-start"})}),o&&e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"ghost",size:"icon-xs",onClick:()=>q(s),disabled:G===s.name||s.commitsAhead===0,"aria-label":"Create PR",children:e.jsx(pe,{"data-icon":"inline-start"})}),e.jsx(x,{variant:"ghost",size:"icon-xs",onClick:()=>W(s),disabled:B===s.name,className:"text-destructive hover:bg-destructive/10 hover:text-destructive","aria-label":"Delete worktree",children:e.jsx(O,{"data-icon":"inline-start"})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-mono shrink-0",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:le(s.createdAt)}),f>0&&e.jsxs(oe,{className:"mt-2",children:[e.jsxs(ce,{className:"group flex w-full items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(je,{"data-icon":"inline-start",className:"size-3 transition-transform group-data-panel-open:rotate-90 motion-reduce:transition-none"}),e.jsx(ge,{"data-icon":"inline-start",className:"size-3"}),e.jsxs("span",{children:[f," file",f!==1?"s":""," changed"]}),e.jsxs("span",{className:"ml-1",children:[e.jsxs("span",{className:"text-success",children:["+",n]})," ",e.jsxs("span",{className:"text-destructive",children:["-",l]})]})]}),e.jsx(de,{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:S("shrink-0 w-3 text-center",fe[i.status]??"text-muted-foreground"),children:i.status}),e.jsx("span",{className:"truncate text-foreground/80",children:i.path}),e.jsxs("span",{className:"ml-auto shrink-0 text-muted-foreground",children:[e.jsxs("span",{className:"text-success",children:["+",i.additions]})," ",e.jsxs("span",{className:"text-destructive",children:["-",i.deletions]})]})]},i.path))})})]})]},s.name)})]})]}),e.jsx(A,{open:t!==null,onOpenChange:s=>{s||d(null)},children:e.jsxs(R,{size:"sm",children:[e.jsxs(E,{children:[e.jsx(he,{className:"bg-destructive/10 text-destructive",children:e.jsx(O,{})}),e.jsx(T,{children:(t==null?void 0:t.reason)==="dirty"?"Delete worktree with uncommitted changes?":"Delete worktree with unpushed commits?"}),e.jsxs(U,{children:[(t==null?void 0:t.reason)==="dirty"?`"${t.worktree.name}" has uncommitted changes.`:`"${t==null?void 0:t.worktree.name}" has ${t==null?void 0:t.worktree.commitsAhead} unpushed commit(s).`," "," ","Deleting it cannot be undone."]})]}),e.jsxs(z,{children:[e.jsx($,{size:"sm",children:"Cancel"}),e.jsx(F,{variant:"destructive",size:"sm",onClick:L,children:(t==null?void 0:t.reason)==="dirty"&&t.worktree.commitsAhead>0?"Continue":"Delete worktree"})]})]})}),e.jsx(A,{open:r!==null,onOpenChange:s=>{s||g(null)},children:e.jsxs(R,{children:[e.jsxs(E,{children:[e.jsx(T,{children:"Remove stale worktrees?"}),e.jsxs(U,{children:[r==null?void 0:r.length," stale worktree",(r==null?void 0:r.length)===1?"":"s"," will be removed: ",r==null?void 0:r.join(", "),"."]})]}),e.jsxs(z,{children:[e.jsx($,{size:"sm",children:"Cancel"}),e.jsx(F,{variant:"destructive",size:"sm",onClick:()=>void X(),children:"Remove worktrees"})]})]})})]})}export{we as WorktreePanel};
@@ -1 +0,0 @@
1
- import{r as z,a as Ge,c as B,j as s}from"./vendor-react-gGw_S5I_.js";import{w as Qe,B as V,aG as He,aV as Ie,A as qe,aH as Ke,bb as Me,ad as Ce,ac as Fe,U as Te,bc as We,b1 as Xe,b0 as Je,a$ as Ze,bd as et,be as tt,bf as st,bg as nt,T as ue,bh as it,V as lt,aj as ot,bi as at,bj as rt,bk as ct,v as dt,ae as ut,bl as ft,E as mt,y as xt,z as ht,G as gt,H as pt,ah as bt,p as jt,bm as wt,bn as vt,q as Nt}from"./index-CNV6e3p0.js";import{E as yt,ah as St,ao as Ye,C as De,ap as ye,a2 as It,aq as qt,L as _t,ar as Tt,as as Ct,c as kt,m as At}from"./vendor-ui-BmLOQ5Or.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const Et=4e3;function Rt(){const[l,e]=z.useState([]),[t,n]=z.useState(!1),[i,r]=z.useState(null),o=z.useRef(!1);z.useEffect(()=>(o.current=!1,()=>{o.current=!0}),[]);const c=z.useCallback(async()=>{try{const u=await Qe("/api/mission-control");if(o.current)return;if(!u.ok)throw new Error(`Mission Control request failed (${u.status})`);const x=await u.json();if(o.current)return;e(Array.isArray(x.summaries)?x.summaries:[]),r(null)}catch(u){if(o.current)return;r(u instanceof Error?u.message:"Failed to load Mission Control")}finally{o.current||n(!1)}},[]);z.useEffect(()=>{n(!0);const u=()=>{(typeof document>"u"||document.visibilityState==="visible")&&c()},x=()=>{document.visibilityState==="visible"&&c()};u();const j=setInterval(u,Et);return document.addEventListener("visibilitychange",x),()=>{clearInterval(j),document.removeEventListener("visibilitychange",x)}},[c]);const d=z.useMemo(()=>{const u=new Map;for(const x of l)u.set(x.sessionId,x);return u},[l]),p=z.useCallback(()=>{c()},[c]);return{summaries:d,loading:t,error:i,refresh:p}}const ke="data-view-transition-kind",Mt="(prefers-reduced-motion: reduce)";let de=null,$e=null;function Lt(l,e,t){t===null?l.removeAttribute(e):l.setAttribute(e,t)}function Dt(l,e){const t={root:l,kind:e,previousKind:l.getAttribute(ke)};return l.setAttribute(ke,e),$e=t,t}function Se(l){$e===l&&(l.root.getAttribute(ke)===l.kind&&Lt(l.root,ke,l.previousKind),$e=null)}function $t(){const l=de;if(l){de=null;try{l.transition.skipTransition()}catch{Se(l.tag);return}Se(l.tag)}}function Ft(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia(Mt).matches}catch{return!1}}function zt(l,{kind:e}){$t();const t=typeof document>"u"?null:document,n=t==null?void 0:t.startViewTransition;if(!t||!(typeof n=="function")||Ft())return l(),null;const r=Dt(t.documentElement,e);let o=!1,c=!1,d;const p=u=>{if(!o){o=!0;try{u?Ge.flushSync(l):l()}catch(x){throw c=!0,d=x,x}}};try{const u=n.call(t,()=>p(!0)),x={transition:u,tag:r};return de=x,u.ready.catch(()=>{}),u.updateCallbackDone.catch(()=>{}),u.finished.then(()=>{de===x&&(de=null),Se(r)},()=>{de===x&&(de=null),Se(r)}),u}catch{if(Se(r),c)throw d;return p(!1),null}}function Ot(l){const e={};for(const t of l)t.type==="boolean"?e[t.name]=t.defaultValue===!0:t.defaultValue!==void 0?e[t.name]=String(t.defaultValue):e[t.name]="";return e}function Vt(l,e){const t={};for(const n of l){const i=e[n.name];if(typeof i=="boolean"){t[n.name]=i;continue}i!==""&&(t[n.name]=n.type==="number"||n.type==="integer"?Number(i):i)}return t}function Ut(l,e){return l.every(t=>{if(!t.required)return!0;const n=e[t.name];return typeof n=="boolean"?!0:n===""?!1:t.type==="number"||t.type==="integer"?Number.isFinite(Number(n)):!0})}function Yt(l){const e=B.c(64),{request:t,responding:n,onAnswer:i}=l;let r;e[0]!==t.fields?(r=()=>Ot(t.fields),e[0]=t.fields,e[1]=r):r=e[1];const[o,c]=z.useState(r);let d;e[2]!==t.fields||e[3]!==o?(d=Ut(t.fields,o),e[2]=t.fields,e[3]=o,e[4]=d):d=e[4];const p=d,u=t.displayName||t.title||t.serverName;let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=(y,q)=>{c(b=>({...b,[y]:q}))},e[5]=x):x=e[5];const j=x;let m;e[6]!==i||e[7]!==t.requestId?(m=()=>i(t.requestId,{action:"decline"}),e[6]=i,e[7]=t.requestId,e[8]=m):m=e[8];const h=m;if(t.mode==="url"&&t.url){const y=t.url;let q;e[9]!==t.message?(q=s.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:t.message}),e[9]=t.message,e[10]=q):q=e[10];let b;e[11]!==y?(b=s.jsx("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:y,children:y}),e[11]=y,e[12]=b):b=e[12];let M;e[13]!==i||e[14]!==t.requestId||e[15]!==y?(M=()=>{window.open(y,"_blank","noopener,noreferrer"),i(t.requestId,{action:"accept"})},e[13]=i,e[14]=t.requestId,e[15]=y,e[16]=M):M=e[16];let L;e[17]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(yt,{"data-icon":"inline-end"}),e[17]=L):L=e[17];let k;e[18]!==n||e[19]!==M?(k=s.jsxs(V,{size:"sm",disabled:n,onClick:M,children:["Open link",L]}),e[18]=n,e[19]=M,e[20]=k):k=e[20];let D;e[21]!==h||e[22]!==n?(D=s.jsx(V,{variant:"ghost",size:"sm",disabled:n,onClick:h,children:"Decline"}),e[21]=h,e[22]=n,e[23]=D):D=e[23];let E;e[24]!==D||e[25]!==k?(E=s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[k,D]}),e[24]=D,e[25]=k,e[26]=E):E=e[26];let _;return e[27]!==u||e[28]!==E||e[29]!==q||e[30]!==b?(_=s.jsxs(Oe,{server:u,children:[q,b,E]}),e[27]=u,e[28]=E,e[29]=q,e[30]=b,e[31]=_):_=e[31],_}let a;e[32]!==t.message?(a=s.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:t.message}),e[32]=t.message,e[33]=a):a=e[33];let g;if(e[34]!==t.fields||e[35]!==t.requestId||e[36]!==n||e[37]!==o){let y;e[39]!==t.requestId||e[40]!==n||e[41]!==o?(y=q=>s.jsx(Bt,{id:`elicit-${t.requestId}-${q.name}`,field:q,value:o[q.name],disabled:n,onChange:b=>j(q.name,b)},q.name),e[39]=t.requestId,e[40]=n,e[41]=o,e[42]=y):y=e[42],g=t.fields.map(y),e[34]=t.fields,e[35]=t.requestId,e[36]=n,e[37]=o,e[38]=g}else g=e[38];let f;e[43]!==g?(f=s.jsx("div",{className:"mt-3 flex flex-col gap-3",children:g}),e[43]=g,e[44]=f):f=e[44];const S=n||!p;let I;e[45]!==i||e[46]!==t.fields||e[47]!==t.requestId||e[48]!==o?(I=()=>i(t.requestId,{action:"accept",content:Vt(t.fields,o)}),e[45]=i,e[46]=t.fields,e[47]=t.requestId,e[48]=o,e[49]=I):I=e[49];let C;e[50]!==S||e[51]!==I?(C=s.jsx(V,{size:"sm",disabled:S,onClick:I,children:"Send"}),e[50]=S,e[51]=I,e[52]=C):C=e[52];let T;e[53]!==h||e[54]!==n?(T=s.jsx(V,{variant:"ghost",size:"sm",disabled:n,onClick:h,children:"Decline"}),e[53]=h,e[54]=n,e[55]=T):T=e[55];let v;e[56]!==C||e[57]!==T?(v=s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[C,T]}),e[56]=C,e[57]=T,e[58]=v):v=e[58];let N;return e[59]!==u||e[60]!==v||e[61]!==a||e[62]!==f?(N=s.jsxs(Oe,{server:u,children:[a,f,v]}),e[59]=u,e[60]=v,e[61]=a,e[62]=f,e[63]=N):N=e[63],N}function Bt(l){const e=B.c(55),{id:t,field:n,value:i,disabled:r,onChange:o}=l;if(n.type==="boolean"){const h=i===!0;let a;e[0]!==o?(a=I=>o(I===!0),e[0]=o,e[1]=a):a=e[1];let g;e[2]!==r||e[3]!==t||e[4]!==h||e[5]!==a?(g=s.jsx(Ke,{id:t,checked:h,disabled:r,onCheckedChange:a}),e[2]=r,e[3]=t,e[4]=h,e[5]=a,e[6]=g):g=e[6];let f;e[7]!==n?(f=s.jsx(Le,{field:n}),e[7]=n,e[8]=f):f=e[8];let S;return e[9]!==t||e[10]!==g||e[11]!==f?(S=s.jsxs(Me,{htmlFor:t,className:"items-start gap-2 font-normal",children:[g,f]}),e[9]=t,e[10]=g,e[11]=f,e[12]=S):S=e[12],S}if(n.type==="enum"){let h;e[13]!==n?(h=s.jsx(Le,{field:n}),e[13]=n,e[14]=h):h=e[14];let a;e[15]!==t||e[16]!==h?(a=s.jsx(Me,{htmlFor:t,children:h}),e[15]=t,e[16]=h,e[17]=a):a=e[17];let g;e[18]!==i?(g=typeof i=="string"&&i?[i]:[],e[18]=i,e[19]=g):g=e[19];let f;e[20]!==o?(f=N=>{N[0]&&o(N[0])},e[20]=o,e[21]=f):f=e[21];const S=n.label;let I;e[22]!==n.options?(I=n.options??[],e[22]=n.options,e[23]=I):I=e[23];let C;if(e[24]!==r||e[25]!==I){let N;e[27]!==r?(N=y=>s.jsx(Ce,{value:y.value,disabled:r,className:"w-full justify-start px-3",children:y.label},y.value),e[27]=r,e[28]=N):N=e[28],C=I.map(N),e[24]=r,e[25]=I,e[26]=C}else C=e[26];let T;e[29]!==n.label||e[30]!==t||e[31]!==g||e[32]!==f||e[33]!==C?(T=s.jsx(Fe,{id:t,value:g,onValueChange:f,orientation:"vertical",variant:"outline",size:"sm",className:"w-full items-stretch","aria-label":S,children:C}),e[29]=n.label,e[30]=t,e[31]=g,e[32]=f,e[33]=C,e[34]=T):T=e[34];let v;return e[35]!==a||e[36]!==T?(v=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,T]}),e[35]=a,e[36]=T,e[37]=v):v=e[37],v}let c;e[38]!==n?(c=s.jsx(Le,{field:n}),e[38]=n,e[39]=c):c=e[39];let d;e[40]!==t||e[41]!==c?(d=s.jsx(Me,{htmlFor:t,children:c}),e[40]=t,e[41]=c,e[42]=d):d=e[42];const p=n.type==="string"?"text":"number",u=typeof i=="string"?i:"";let x;e[43]!==o?(x=h=>o(h.target.value),e[43]=o,e[44]=x):x=e[44];let j;e[45]!==r||e[46]!==n.label||e[47]!==t||e[48]!==p||e[49]!==u||e[50]!==x?(j=s.jsx(He,{id:t,"aria-label":n.label,type:p,value:u,disabled:r,onChange:x}),e[45]=r,e[46]=n.label,e[47]=t,e[48]=p,e[49]=u,e[50]=x,e[51]=j):j=e[51];let m;return e[52]!==d||e[53]!==j?(m=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,j]}),e[52]=d,e[53]=j,e[54]=m):m=e[54],m}function Le(l){const e=B.c(8),{field:t}=l;let n;e[0]!==t.required?(n=t.required&&s.jsx("span",{className:"ml-0.5 text-warning",children:"*"}),e[0]=t.required,e[1]=n):n=e[1];let i;e[2]!==t.description?(i=t.description&&s.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:t.description}),e[2]=t.description,e[3]=i):i=e[3];let r;return e[4]!==t.label||e[5]!==n||e[6]!==i?(r=s.jsxs("span",{className:"min-w-0",children:[t.label,n,i]}),e[4]=t.label,e[5]=n,e[6]=i,e[7]=r):r=e[7],r}function Oe(l){const e=B.c(8),{server:t,children:n}=l;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(St,{className:"text-info"}),e[0]=i):i=e[0];let r;e[1]!==t?(r=s.jsxs(Ie,{children:[t," needs input"]}),e[1]=t,e[2]=r):r=e[2];let o;e[3]!==n?(o=s.jsx("div",{className:"col-start-2 mt-1 min-w-0",children:n}),e[3]=n,e[4]=o):o=e[4];let c;return e[5]!==r||e[6]!==o?(c=s.jsxs(qe,{className:"border-info/40 bg-info/5",children:[i,r,o]}),e[5]=r,e[6]=o,e[7]=c):c=e[7],c}const Pt=["allow","allow_always","deny"],Gt=[{decision:"allow",label:"Allow",variant:"default"},{decision:"deny",label:"Deny",variant:"destructive"},{decision:"allow_always",label:"Always",variant:"outline"}];function Qt(l,e){return(l.availableDecisions??Pt).includes(e)}function Ht(l){const e=B.c(22),{request:t,queued:n,responding:i,onRespond:r}=l;let o;if(e[0]!==r||e[1]!==n||e[2]!==t||e[3]!==i){let c;e[5]!==t?(c=S=>Qt(t,S.decision),e[5]=t,e[6]=c):c=e[6];const d=Gt.filter(c),p=d.some(Kt);let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ye,{className:"text-warning"}),e[7]=u):u=e[7];const x=t.title||`Allow ${t.toolName}?`;let j;e[8]!==x?(j=s.jsx("span",{className:"min-w-0 flex-1 truncate",children:x}),e[8]=x,e[9]=j):j=e[9];let m;e[10]!==n?(m=n>0&&s.jsxs("span",{className:"shrink-0 font-mono text-xs text-warning",children:["+",n]}),e[10]=n,e[11]=m):m=e[11];let h;e[12]!==j||e[13]!==m?(h=s.jsxs(Ie,{className:"flex min-w-0 items-center gap-2",children:[j,m]}),e[12]=j,e[13]=m,e[14]=h):h=e[14];let a;e[15]!==t.toolName?(a=s.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:t.toolName}),e[15]=t.toolName,e[16]=a):a=e[16];let g;e[17]!==t.summary?(g=t.summary&&s.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:t.summary}),e[17]=t.summary,e[18]=g):g=e[18];let f;e[19]!==a||e[20]!==g?(f=s.jsxs("div",{className:"col-start-2 mt-2 flex min-w-0 items-center gap-2",children:[a,g]}),e[19]=a,e[20]=g,e[21]=f):f=e[21],o=s.jsxs(qe,{className:"border-warning/40 bg-warning/5",children:[u,h,f,p?s.jsx("div",{className:"col-start-2 mt-3 flex items-center gap-2",children:d.map(S=>{const{decision:I,label:C,variant:T}=S;return s.jsx(V,{size:"xs",variant:T,disabled:i,onClick:()=>r(t.requestId,I),children:C},I)})}):s.jsx("p",{className:"col-start-2 mt-2 text-xs text-warning",children:"Resolve this approval in its own provider"})]}),e[0]=r,e[1]=n,e[2]=t,e[3]=i,e[4]=o}else o=e[4];return o}function Kt(l){return l.decision!=="allow_always"}function Wt(l){return l.some(e=>e.options.length===0||e.options.some(t=>t.hasPreview))}function Xt(l){const e=B.c(63),{request:t,responding:n,gone:i,onAnswer:r,onOpenSession:o}=l,c=t.questions,[d,p]=z.useState(0);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={},e[0]=u):u=e[0];const x=z.useRef(u);let j;e[1]===Symbol.for("react.memo_cache_sentinel")?(j=new Set,e[1]=j):j=e[1];const[m,h]=z.useState(j);if(c.length===0)return null;if(Wt(c)){let w;e[2]!==c[0].question?(w=s.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:c[0].question}),e[2]=c[0].question,e[3]=w):w=e[3];let $;e[4]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(De,{"data-icon":"inline-end"}),e[4]=$):$=e[4];let A;e[5]!==o?(A=s.jsxs(V,{variant:"outline",size:"sm",onClick:o,className:"mt-3",children:["Open full question",$]}),e[5]=o,e[6]=A):A=e[6];let P;return e[7]!==w||e[8]!==A?(P=s.jsxs(Ve,{children:[w,A]}),e[7]=w,e[8]=A,e[9]=P):P=e[9],P}const a=c[d];let g;e[10]!==a.question||e[11]!==d||e[12]!==r||e[13]!==c.length||e[14]!==t.toolUseId?(g=function($){const A={...x.current,[a.question]:$};if(d+1<c.length){x.current=A,h(new Set),p(d+1);return}r(t.toolUseId,A)},e[10]=a.question,e[11]=d,e[12]=r,e[13]=c.length,e[14]=t.toolUseId,e[15]=g):g=e[15];const f=g;let S;e[16]!==a.header?(S=a.header&&s.jsx(Te,{variant:"outline",className:"border-info/40 text-info",children:a.header}),e[16]=a.header,e[17]=S):S=e[17];let I;e[18]!==d||e[19]!==c.length?(I=c.length>1&&s.jsxs("span",{className:"ml-auto shrink-0 font-mono text-xs text-muted-foreground",children:[d+1," of ",c.length]}),e[18]=d,e[19]=c.length,e[20]=I):I=e[20];let C;e[21]!==S||e[22]!==I?(C=s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[S,I]}),e[21]=S,e[22]=I,e[23]=C):C=e[23];let T;e[24]!==a.question?(T=s.jsx("p",{className:"mt-2 line-clamp-3 text-sm leading-relaxed text-foreground",title:a.question,children:a.question}),e[24]=a.question,e[25]=T):T=e[25];let v;e[26]!==m?(v=[...m],e[26]=m,e[27]=v):v=e[27];let N;e[28]!==f||e[29]!==a.multiSelect?(N=w=>{a.multiSelect?h(new Set(w)):w[0]&&f(w[0])},e[28]=f,e[29]=a.multiSelect,e[30]=N):N=e[30];const y=a.multiSelect,q=a.question;let b;if(e[31]!==a.options||e[32]!==n){let w;e[34]!==n?(w=$=>s.jsx(Jt,{option:$,disabled:n},$.label),e[34]=n,e[35]=w):w=e[35],b=a.options.map(w),e[31]=a.options,e[32]=n,e[33]=b}else b=e[33];let M;e[36]!==a.multiSelect||e[37]!==a.question||e[38]!==b||e[39]!==v||e[40]!==N?(M=s.jsx(Fe,{value:v,onValueChange:N,multiple:y,orientation:"vertical",variant:"outline",size:"sm",className:"mt-3 w-full items-stretch","aria-label":q,children:b}),e[36]=a.multiSelect,e[37]=a.question,e[38]=b,e[39]=v,e[40]=N,e[41]=M):M=e[41];let L;e[42]!==f||e[43]!==a.multiSelect||e[44]!==d||e[45]!==c.length||e[46]!==n||e[47]!==m?(L=a.multiSelect&&s.jsx(V,{size:"sm",disabled:n||m.size===0,onClick:()=>f(We(m)),children:d+1<c.length?"Next":"Send"}),e[42]=f,e[43]=a.multiSelect,e[44]=d,e[45]=c.length,e[46]=n,e[47]=m,e[48]=L):L=e[48];let k;e[49]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(De,{"data-icon":"inline-end"}),e[49]=k):k=e[49];let D;e[50]!==o?(D=s.jsxs(V,{variant:"ghost",size:"sm",onClick:o,className:"ml-auto text-muted-foreground",children:["Open session",k]}),e[50]=o,e[51]=D):D=e[51];let E;e[52]!==L||e[53]!==D?(E=s.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[L,D]}),e[52]=L,e[53]=D,e[54]=E):E=e[54];let _;e[55]!==i?(_=i&&s.jsx("p",{className:"mt-2 text-xs text-warning",children:"This question may already be answered. Open the session to check."}),e[55]=i,e[56]=_):_=e[56];let O;return e[57]!==M||e[58]!==E||e[59]!==_||e[60]!==C||e[61]!==T?(O=s.jsxs(Ve,{children:[C,T,M,E,_]}),e[57]=M,e[58]=E,e[59]=_,e[60]=C,e[61]=T,e[62]=O):O=e[62],O}function Jt(l){const e=B.c(17),{option:t,disabled:n}=l;let i;e[0]!==t.label?(i=s.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:t.label}),e[0]=t.label,e[1]=i):i=e[1];const r=i;if(!t.description){let u;return e[2]!==n||e[3]!==r||e[4]!==t.label?(u=s.jsx(Ce,{value:t.label,disabled:n,className:"w-full justify-start px-3",children:r}),e[2]=n,e[3]=r,e[4]=t.label,e[5]=u):u=e[5],u}let o;e[6]!==n||e[7]!==t.label?(o=s.jsx(Ce,{value:t.label,disabled:n,className:"w-full justify-start px-3"}),e[6]=n,e[7]=t.label,e[8]=o):o=e[8];let c;e[9]!==r||e[10]!==o?(c=s.jsx(Je,{render:o,children:r}),e[9]=r,e[10]=o,e[11]=c):c=e[11];let d;e[12]!==t.description?(d=s.jsx(Xe,{side:"right",className:"max-w-72 text-left",children:t.description}),e[12]=t.description,e[13]=d):d=e[13];let p;return e[14]!==c||e[15]!==d?(p=s.jsxs(Ze,{children:[c,d]}),e[14]=c,e[15]=d,e[16]=p):p=e[16],p}function Ve(l){const e=B.c(4),{children:t}=l;let n,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ye,{className:"text-info"}),i=s.jsx(Ie,{children:"Answer to continue"}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let r;return e[2]!==t?(r=s.jsxs(qe,{className:"border-info/40 bg-info/5",children:[n,i,s.jsx("div",{className:"col-start-2 mt-1 min-w-0",children:t})]}),e[2]=t,e[3]=r):r=e[3],r}function Zt(l){const e=B.c(33),{request:t,responding:n,onChoose:i}=l;let r,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ye,{className:"text-warning"}),o=s.jsx(Ie,{children:"Claude declined this request"}),e[0]=r,e[1]=o):(r=e[0],o=e[1]);let c;e[2]!==t.originalModel?(c=s.jsxs("p",{className:"text-sm leading-relaxed text-foreground",children:[t.originalModel," would not answer. Retrying on a fallback model may work."]}),e[2]=t.originalModel,e[3]=c):c=e[3];let d;e[4]!==t.guidanceText?(d=t.guidanceText&&s.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:t.guidanceText}),e[4]=t.guidanceText,e[5]=d):d=e[5];let p;e[6]!==i||e[7]!==t.requestId?(p=()=>i(t.requestId,"retry_fallback"),e[6]=i,e[7]=t.requestId,e[8]=p):p=e[8];let u;e[9]!==t.fallbackModel||e[10]!==n||e[11]!==p?(u=s.jsxs(V,{size:"sm",disabled:n,onClick:p,children:["Retry on ",t.fallbackModel]}),e[9]=t.fallbackModel,e[10]=n,e[11]=p,e[12]=u):u=e[12];let x;e[13]!==i||e[14]!==t.requestId?(x=()=>i(t.requestId,"edit_prompt"),e[13]=i,e[14]=t.requestId,e[15]=x):x=e[15];let j;e[16]!==n||e[17]!==x?(j=s.jsx(V,{variant:"outline",size:"sm",disabled:n,onClick:x,children:"Edit prompt"}),e[16]=n,e[17]=x,e[18]=j):j=e[18];let m;e[19]!==i||e[20]!==t.requestId?(m=()=>i(t.requestId,"cancelled"),e[19]=i,e[20]=t.requestId,e[21]=m):m=e[21];let h;e[22]!==n||e[23]!==m?(h=s.jsx(V,{variant:"ghost",size:"sm",disabled:n,className:"ml-auto text-muted-foreground",onClick:m,children:"Dismiss"}),e[22]=n,e[23]=m,e[24]=h):h=e[24];let a;e[25]!==h||e[26]!==u||e[27]!==j?(a=s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[u,j,h]}),e[25]=h,e[26]=u,e[27]=j,e[28]=a):a=e[28];let g;return e[29]!==a||e[30]!==c||e[31]!==d?(g=s.jsxs(qe,{className:"border-warning/40 bg-warning/5",children:[r,o,s.jsxs("div",{className:"col-start-2 mt-1 min-w-0",children:[c,d,a]})]}),e[29]=a,e[30]=c,e[31]=d,e[32]=g):g=e[32],g}function Be(l){return l==="awaiting_approval"||l==="awaiting_prompt"||l==="awaiting_question"||l==="awaiting_answer"}function Ae(l){return l==="done"||l==="failed"}const Ue={awaiting_approval:0,awaiting_prompt:1,awaiting_question:2,awaiting_answer:3,running:4,failed:5,done:6};function es(l,e,t,n,i){return t?"awaiting_approval":n?"awaiting_prompt":i?"awaiting_question":l.agentStatus==="deferred"||l.agentStatus==="idle"&&e?"awaiting_answer":l.agentTerminalReason?"failed":e&&l.agentStatus&&st.has(l.agentStatus)?"running":"done"}const ts=6;function ss({sessions:l,procBySession:e,summaries:t,permissionsBySession:n,questionsBySession:i,elicitationsBySession:r,dialogsBySession:o,newlyCompleted:c,finishedLimit:d=ts,now:p=Date.now()}){const u=[];for(const m of et(l)){const h=n.get(m.sessionId)??[],a=i.get(m.sessionId)??[],g=r.get(m.sessionId)??[],f=o.get(m.sessionId)??[],S=h.length+a.length+g.length+f.length;m.teamName&&m.agentName&&S===0||u.push({session:m,state:es(m,tt(m,e,p),h.length>0,g.length>0||f.length>0,a.length>0),summary:t.get(m.sessionId)??null,permissions:h,questions:a,elicitations:g,dialogs:f})}const x=u.filter(m=>Ae(m.state)),j=[...x.filter(m=>c.has(m.session.sessionId)),...x.filter(m=>!c.has(m.session.sessionId))].slice(0,d);return[...u.filter(m=>!Ae(m.state)),...j].sort((m,h)=>Ue[m.state]-Ue[h.state])}function ns(l,e){switch(e){case"running":return l.filter(t=>t.state==="running");case"needs-you":return l.filter(t=>Be(t.state));case"finished":return l.filter(t=>Ae(t.state));default:return l}}function is(l){const e={total:l.length,running:0,needsYou:0,finished:0,failed:0};for(const t of l)t.state==="running"&&e.running++,Be(t.state)&&e.needsYou++,Ae(t.state)&&e.finished++,t.state==="failed"&&e.failed++;return e}function ls(l){return l>=90?"text-destructive":l>=70?"text-warning":"text-muted-foreground"}const os={awaiting_approval:{label:"Waiting for approval",text:"text-warning",shell:"border-warning/40 bg-warning/5",icon:ye},awaiting_prompt:{label:"Waiting for your input",text:"text-info",shell:"border-info/40 bg-info/5",icon:ye},awaiting_question:{label:"Waiting for your answer",text:"text-info",shell:"border-info/40 bg-info/5",icon:ye},awaiting_answer:{label:"Waiting for your answer",text:"text-warning",shell:"border-warning/40 bg-warning/5",icon:ye},running:{label:"Running",text:"text-info",shell:"border-border",icon:null},done:{label:"Done",text:"text-success",shell:"border-border",icon:qt},failed:{label:"Failed",text:"text-destructive",shell:"border-destructive/40",icon:It}};function as(l){const e=B.c(3),{icon:t}=l;if(!t){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("span",{className:"size-2 shrink-0 rounded-full bg-info"}),e[0]=i):i=e[0],i}let n;return e[1]!==t?(n=s.jsx(t,{className:"size-3.5 shrink-0"}),e[1]=t,e[2]=n):n=e[2],n}const rs=z.memo(function(e){const t=B.c(88),{card:n,customName:i,projectLabel:r,responding:o,goneQuestions:c,compact:d,onOpen:p,onRespond:u,onAnswerQuestion:x,onAnswerElicitation:j,onChooseDialog:m}=e,h=d===void 0?!1:d,{session:a,state:g,summary:f,permissions:S,questions:I,elicitations:C,dialogs:T}=n,v=os[g],N=S[0],y=I[0],q=C[0],b=T[0],M=!!(N||y||q||b);let L;t[0]!==i||t[1]!==a?(L=nt(a,i),t[0]=i,t[1]=a,t[2]=L):L=t[2];const k=L,D=h&&"gap-1.5 py-2";let E;t[3]!==v.shell||t[4]!==D?(E=ue("motion-card motion-list-item group flex min-w-0 flex-col gap-2 rounded-lg border bg-card p-3 text-left transition-colors hover:border-foreground/20",v.shell,D),t[3]=v.shell,t[4]=D,t[5]=E):E=t[5];const _=`Open session ${k}`;let O;t[6]!==r?(O=s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:r}),t[6]=r,t[7]=O):O=t[7];let w;t[8]!==f?(w=(f==null?void 0:f.model)&&s.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:it(f.model)}),t[8]=f,t[9]=w):w=t[9];let $;t[10]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(De,{"data-icon":"inline-end",className:"shrink-0 text-transparent transition-colors group-hover:text-muted-foreground"}),t[10]=$):$=t[10];let A;t[11]!==O||t[12]!==w?(A=s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[O,w,$]}),t[11]=O,t[12]=w,t[13]=A):A=t[13];const P=h?"truncate":"line-clamp-2";let G;t[14]!==P?(G=ue("text-sm font-medium leading-snug text-foreground",P),t[14]=P,t[15]=G):G=t[15];let ne;t[16]!==G||t[17]!==k?(ne=s.jsx("span",{className:G,children:k}),t[16]=G,t[17]=k,t[18]=ne):ne=t[18];let ie;t[19]!==p||t[20]!==ne||t[21]!==_||t[22]!==A?(ie=s.jsxs(V,{variant:"ghost",onClick:p,className:"-m-1 h-auto min-w-0 flex-col items-stretch justify-start gap-1 whitespace-normal p-1 text-left","aria-label":_,children:[A,ne]}),t[19]=p,t[20]=ne,t[21]=_,t[22]=A,t[23]=ie):ie=t[23];let le;t[24]!==v.text?(le=ue("flex items-center gap-1.5 text-xs font-medium",v.text),t[24]=v.text,t[25]=le):le=t[25];let se;t[26]!==v.icon?(se=s.jsx(as,{icon:v.icon}),t[26]=v.icon,t[27]=se):se=t[27];let oe;t[28]!==v.label?(oe=s.jsx("span",{className:"truncate",children:v.label}),t[28]=v.label,t[29]=oe):oe=t[29];const re=a.lastActivityAt||a.lastModified;let ae;t[30]!==re?(ae=lt(re),t[30]=re,t[31]=ae):ae=t[31];let Q;t[32]!==ae?(Q=s.jsx("span",{className:"ml-auto shrink-0 font-mono text-xs font-normal text-muted-foreground",children:ae}),t[32]=ae,t[33]=Q):Q=t[33];let H;t[34]!==le||t[35]!==se||t[36]!==oe||t[37]!==Q?(H=s.jsxs("div",{className:le,children:[se,oe,Q]}),t[34]=le,t[35]=se,t[36]=oe,t[37]=Q,t[38]=H):H=t[38];let K;t[39]!==u||t[40]!==S.length||t[41]!==N||t[42]!==o||t[43]!==a.sessionId?(K=N&&s.jsx(Ht,{request:N,queued:S.length-1,responding:o.has(N.requestId),onRespond:(U,Y)=>u(a.sessionId,U,Y)}),t[39]=u,t[40]=S.length,t[41]=N,t[42]=o,t[43]=a.sessionId,t[44]=K):K=t[44];let W;t[45]!==b||t[46]!==m||t[47]!==N||t[48]!==o||t[49]!==a.sessionId?(W=!N&&b&&s.jsx(Zt,{request:b,responding:o.has(b.requestId),onChoose:(U,Y)=>m(a.sessionId,U,Y)},b.requestId),t[45]=b,t[46]=m,t[47]=N,t[48]=o,t[49]=a.sessionId,t[50]=W):W=t[50];let X;t[51]!==b||t[52]!==q||t[53]!==j||t[54]!==N||t[55]!==o||t[56]!==a.sessionId?(X=!N&&!b&&q&&s.jsx(Yt,{request:q,responding:o.has(q.requestId),onAnswer:(U,Y)=>j(a.sessionId,U,Y)},q.requestId),t[51]=b,t[52]=q,t[53]=j,t[54]=N,t[55]=o,t[56]=a.sessionId,t[57]=X):X=t[57];let J;t[58]!==b||t[59]!==q||t[60]!==c||t[61]!==x||t[62]!==p||t[63]!==y||t[64]!==N||t[65]!==o||t[66]!==a.sessionId?(J=!N&&!b&&!q&&y&&s.jsx(Xt,{request:y,responding:o.has(y.toolUseId),gone:c.has(y.toolUseId),onAnswer:(U,Y)=>x(a.sessionId,U,Y),onOpenSession:p},y.toolUseId),t[58]=b,t[59]=q,t[60]=c,t[61]=x,t[62]=p,t[63]=y,t[64]=N,t[65]=o,t[66]=a.sessionId,t[67]=J):J=t[67];let Z;t[68]!==M||t[69]!==f?(Z=!M&&(f==null?void 0:f.currentTool)&&s.jsx(cs,{tool:f.currentTool}),t[68]=M,t[69]=f,t[70]=Z):Z=t[70];let ee;t[71]!==M||t[72]!==h||t[73]!==f?(ee=!h&&!M&&(f==null?void 0:f.lastAssistantText)&&s.jsx("p",{className:"line-clamp-4 text-sm leading-relaxed text-muted-foreground",children:f.lastAssistantText}),t[71]=M,t[72]=h,t[73]=f,t[74]=ee):ee=t[74];let te;t[75]!==f?(te=f&&s.jsx(ds,{summary:f}),t[75]=f,t[76]=te):te=t[76];let ce;return t[77]!==ie||t[78]!==H||t[79]!==K||t[80]!==W||t[81]!==X||t[82]!==J||t[83]!==Z||t[84]!==ee||t[85]!==te||t[86]!==E?(ce=s.jsxs("div",{className:E,children:[ie,H,K,W,X,J,Z,ee,te]}),t[77]=ie,t[78]=H,t[79]=K,t[80]=W,t[81]=X,t[82]=J,t[83]=Z,t[84]=ee,t[85]=te,t[86]=E,t[87]=ce):ce=t[87],ce});function cs(l){const e=B.c(7),{tool:t}=l;let n;e[0]!==t.name?(n=s.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:t.name}),e[0]=t.name,e[1]=n):n=e[1];let i;e[2]!==t.summary?(i=s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground/80",children:t.summary}),e[2]=t.summary,e[3]=i):i=e[3];let r;return e[4]!==n||e[5]!==i?(r=s.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md bg-muted/50 px-2.5 py-2",children:[n,i]}),e[4]=n,e[5]=i,e[6]=r):r=e[6],r}function ds(l){const e=B.c(11),{summary:t}=l,n=t.filesTotal,i=t.context,r=n.count>0,o=i!==null&&i.used>0;if(!r&&!o)return null;let c;e[0]!==n.additions||e[1]!==n.count||e[2]!==n.deletions||e[3]!==r?(c=r&&s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsxs("span",{className:"truncate",children:[n.count," file",n.count===1?"":"s"]}),s.jsx(ot,{add:n.additions,del:n.deletions})]}),e[0]=n.additions,e[1]=n.count,e[2]=n.deletions,e[3]=r,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==o?(d=o&&s.jsxs("span",{className:ue("ml-auto shrink-0",ls(i.percent)),children:["ctx ",i.percent,"%"]}),e[5]=i,e[6]=o,e[7]=d):d=e[7];let p;return e[8]!==c||e[9]!==d?(p=s.jsxs("div",{className:"mt-auto flex items-center gap-2 border-t pt-2 font-mono text-xs text-muted-foreground",children:[c,d]}),e[8]=c,e[9]=d,e[10]=p):p=e[10],p}const us=8e3,fs=12,ms="Start Claude Code or Codex and every session shows up here",xs=[{id:"all",label:"All"},{id:"running",label:"Running"},{id:"needs-you",label:"Needs you"},{id:"finished",label:"Finished"}],hs=[{id:"grid",label:"Grid layout",Icon:_t},{id:"list",label:"List layout",Icon:Tt}];function vs(l){const e=B.c(117),{onSelectSession:t}=l,{sessions:n,procBySession:i,newlyCompleted:r,refresh:o}=at(),{summaries:c,loading:d,error:p,refresh:u}=Rt(),{permissionsBySession:x,questionsBySession:j,elicitationsBySession:m,dialogsBySession:h,responding:a,respond:g,answerQuestion:f,answerElicitation:S,answerDialog:I,refresh:C}=rt();let T;e[0]===Symbol.for("react.memo_cache_sentinel")?(T=new Set,e[0]=T):T=e[0];const[v,N]=z.useState(T),{names:y}=ct(),{names:q}=dt(),[b,M]=z.useState("all");let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=ut("mission-control-layout"),e[1]=L):L=e[1];const[k,D]=ft(L,"grid");let E;e[2]!==h||e[3]!==m||e[4]!==r||e[5]!==x||e[6]!==i||e[7]!==j||e[8]!==n||e[9]!==c?(E=ss({sessions:n,procBySession:i,summaries:c,permissionsBySession:x,questionsBySession:j,elicitationsBySession:m,dialogsBySession:h,newlyCompleted:r}),e[2]=h,e[3]=m,e[4]=r,e[5]=x,e[6]=i,e[7]=j,e[8]=n,e[9]=c,e[10]=E):E=e[10];const _=E;let O;e[11]!==_?(O=is(_),e[11]=_,e[12]=O):O=e[12];const w=O;let $;e[13]!==_||e[14]!==b?($=ns(_,b),e[13]=_,e[14]=b,e[15]=$):$=e[15];const A=$;let P;e[16]!==C||e[17]!==o||e[18]!==u?(P=()=>{o(),u(),C()},e[16]=C,e[17]=o,e[18]=u,e[19]=P):P=e[19];const G=P;let ne,ie;e[20]!==o?(ne=()=>{const F=setInterval(()=>{document.visibilityState==="visible"&&o()},us);return()=>clearInterval(F)},ie=[o],e[20]=o,e[21]=ne,e[22]=ie):(ne=e[21],ie=e[22]),z.useEffect(ne,ie);let le;e[23]!==f?(le=async(F,R,Re)=>{(await f(F,R,Re)).ok||N(Pe=>new Set(Pe).add(R))},e[23]=f,e[24]=le):le=e[24];const se=le;let oe;e[25]!==_.length?(oe=function(R){_.length<=fs?zt(R,{kind:"fade"}):z.startTransition(R)},e[25]=_.length,e[26]=oe):oe=e[26];const re=oe;let ae;e[27]===Symbol.for("react.memo_cache_sentinel")?(ae=s.jsx("h2",{className:"truncate text-sm font-semibold",children:"Mission Control"}),e[27]=ae):ae=e[27];let Q;e[28]!==w.total?(Q=s.jsx(Te,{variant:"secondary",children:w.total}),e[28]=w.total,e[29]=Q):Q=e[29];let H;e[30]!==w.needsYou?(H=w.needsYou>0&&s.jsxs(Te,{variant:"outline",className:"border-warning/40 text-warning",children:[w.needsYou," need you"]}),e[30]=w.needsYou,e[31]=H):H=e[31];let K;e[32]!==w.failed?(K=w.failed>0&&s.jsxs(Te,{variant:"destructive",children:[w.failed," failed"]}),e[32]=w.failed,e[33]=K):K=e[33];let W;e[34]!==Q||e[35]!==H||e[36]!==K?(W=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[ae,Q,H,K]}),e[34]=Q,e[35]=H,e[36]=K,e[37]=W):W=e[37];let X;e[38]!==b?(X=[b],e[38]=b,e[39]=X):X=e[39];let J;e[40]!==b||e[41]!==re?(J=F=>{const R=F.at(-1);R&&R!==b&&re(()=>M(R))},e[40]=b,e[41]=re,e[42]=J):J=e[42];let Z;e[43]!==w.needsYou?(Z=xs.map(F=>s.jsxs(Ce,{value:F.id,"aria-label":`Show ${F.label.toLowerCase()} sessions`,children:[F.label,F.id==="needs-you"&&w.needsYou>0&&s.jsx("span",{className:"font-mono text-warning",children:w.needsYou})]},F.id)),e[43]=w.needsYou,e[44]=Z):Z=e[44];let ee;e[45]!==X||e[46]!==J||e[47]!==Z?(ee=s.jsx(Fe,{value:X,onValueChange:J,variant:"outline",size:"sm",spacing:0,"aria-label":"Filter sessions",children:Z}),e[45]=X,e[46]=J,e[47]=Z,e[48]=ee):ee=e[48];let te;e[49]!==k||e[50]!==D||e[51]!==re?(te=hs.map(F=>{const{id:R,label:Re,Icon:ze}=F;return s.jsx(V,{variant:"ghost",size:"icon-xs","aria-label":Re,"aria-pressed":k===R,onClick:()=>{R!==k&&re(()=>D(R))},className:ue(k===R&&"bg-accent text-accent-foreground"),children:s.jsx(ze,{"data-icon":"inline-start"})},R)}),e[49]=k,e[50]=D,e[51]=re,e[52]=te):te=e[52];const ce=d&&"animate-spin";let U;e[53]!==ce?(U=ue(ce),e[53]=ce,e[54]=U):U=e[54];let Y;e[55]!==U?(Y=s.jsx(kt,{"data-icon":"inline-start",className:U}),e[55]=U,e[56]=Y):Y=e[56];let fe;e[57]!==G||e[58]!==Y?(fe=s.jsx(V,{variant:"ghost",size:"icon-xs","aria-label":"Refresh Mission Control",onClick:G,children:Y}),e[57]=G,e[58]=Y,e[59]=fe):fe=e[59];let me;e[60]!==te||e[61]!==fe?(me=s.jsxs("div",{className:"flex items-center gap-1",children:[te,fe]}),e[60]=te,e[61]=fe,e[62]=me):me=e[62];let xe;e[63]!==ee||e[64]!==me?(xe=s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[ee,me]}),e[63]=ee,e[64]=me,e[65]=xe):xe=e[65];let he;e[66]!==W||e[67]!==xe?(he=s.jsxs("header",{className:"flex min-h-12 shrink-0 flex-wrap items-center gap-3 border-b px-4 py-2",children:[W,xe]}),e[66]=W,e[67]=xe,e[68]=he):he=e[68];let ge;e[69]!==p||e[70]!==G?(ge=p&&s.jsxs(qe,{variant:"destructive",className:"mb-4",children:[s.jsx(At,{}),s.jsx(Ie,{children:"Mission Control could not refresh"}),s.jsx(jt,{className:"truncate",children:p}),s.jsx(wt,{children:s.jsx(V,{variant:"outline",size:"xs",onClick:G,children:"Retry"})})]}),e[69]=p,e[70]=G,e[71]=ge):ge=e[71];let pe;e[72]!==_.length||e[73]!==b||e[74]!==d||e[75]!==A.length?(pe=A.length===0&&!d&&s.jsx(mt,{className:"min-h-64",children:s.jsxs(xt,{children:[s.jsx(ht,{variant:"icon",children:s.jsx(Ct,{})}),s.jsx(gt,{children:_.length===0?"No live sessions":`Nothing matches "${b}"`}),s.jsx(pt,{children:_.length===0?ms:"Try a different filter."})]})}),e[72]=_.length,e[73]=b,e[74]=d,e[75]=A.length,e[76]=pe):pe=e[76];let be;e[77]!==_.length||e[78]!==d||e[79]!==A.length?(be=A.length===0&&d&&_.length===0&&s.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-sm text-muted-foreground",children:[s.jsx(bt,{}),"Loading sessions…"]}),e[77]=_.length,e[78]=d,e[79]=A.length,e[80]=be):be=e[80];const Ee=k==="grid"&&"md:grid-cols-2 2xl:grid-cols-3";let je;e[81]!==Ee?(je=ue("grid grid-cols-1 gap-3",Ee),e[81]=Ee,e[82]=je):je=e[82];let we;if(e[83]!==I||e[84]!==S||e[85]!==v||e[86]!==se||e[87]!==k||e[88]!==t||e[89]!==q||e[90]!==g||e[91]!==a||e[92]!==y||e[93]!==A){let F;e[95]!==I||e[96]!==S||e[97]!==v||e[98]!==se||e[99]!==k||e[100]!==t||e[101]!==q||e[102]!==g||e[103]!==a||e[104]!==y?(F=R=>s.jsx(rs,{card:R,compact:k==="list",customName:y[R.session.sessionId],projectLabel:q[R.session.dirName]??vt(R.session),responding:a,goneQuestions:v,onOpen:()=>t(R.session.dirName,R.session.fileName),onRespond:g,onAnswerQuestion:se,onAnswerElicitation:S,onChooseDialog:I},R.session.sessionId),e[95]=I,e[96]=S,e[97]=v,e[98]=se,e[99]=k,e[100]=t,e[101]=q,e[102]=g,e[103]=a,e[104]=y,e[105]=F):F=e[105],we=A.map(F),e[83]=I,e[84]=S,e[85]=v,e[86]=se,e[87]=k,e[88]=t,e[89]=q,e[90]=g,e[91]=a,e[92]=y,e[93]=A,e[94]=we}else we=e[94];let ve;e[106]!==je||e[107]!==we?(ve=s.jsx("div",{className:je,children:we}),e[106]=je,e[107]=we,e[108]=ve):ve=e[108];let Ne;e[109]!==ge||e[110]!==pe||e[111]!==be||e[112]!==ve?(Ne=s.jsx(Nt,{className:"flex-1",children:s.jsxs("div",{className:"p-4",children:[ge,pe,be,ve]})}),e[109]=ge,e[110]=pe,e[111]=be,e[112]=ve,e[113]=Ne):Ne=e[113];let _e;return e[114]!==he||e[115]!==Ne?(_e=s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[he,Ne]}),e[114]=he,e[115]=Ne,e[116]=_e):_e=e[116],_e}export{vs as MissionControl};