cogpit 3.5.2 → 3.5.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.
Files changed (37) hide show
  1. package/dist/cli-runtime.js +1917 -1515
  2. package/dist/instance-worker.js +21 -5
  3. package/dist/web/assets/{AutomationsPanel-B3zT5G5K.js → AutomationsPanel-DTiDsq54.js} +1 -1
  4. package/dist/web/assets/{CogpitBlock-d05YgSdQ.js → CogpitBlock-Hk57z10V.js} +16 -16
  5. package/dist/web/assets/{CommandPaletteHost-D8fk5Qkq.js → CommandPaletteHost-BYfieK7H.js} +1 -1
  6. package/dist/web/assets/{ConfigBrowser-BRsvua8m.js → ConfigBrowser-C77Ydij0.js} +1 -1
  7. package/dist/web/assets/CrewPanel-BzEJLKMd.js +1 -0
  8. package/dist/web/assets/{HighlightedEditor-clIIwmWB.js → HighlightedEditor-D1S-wotA.js} +2 -2
  9. package/dist/web/assets/{KeyboardShortcutsDialog-0VokzXOy.js → KeyboardShortcutsDialog-B_DSi5JO.js} +1 -1
  10. package/dist/web/assets/MissionHome-B3uYgylE.js +2 -0
  11. package/dist/web/assets/{MobileFileChanges-iLhOAdgx.js → MobileFileChanges-DovO__Ap.js} +1 -1
  12. package/dist/web/assets/PluginsDialog-o6ySRFLf.js +1 -0
  13. package/dist/web/assets/{PreviewPanel-DF4kUYpX.js → PreviewPanel-kD79kXYD.js} +1 -1
  14. package/dist/web/assets/{ProjectFilesPanel-D9_OzQi2.js → ProjectFilesPanel-CwEqOA2q.js} +4 -4
  15. package/dist/web/assets/{ProjectSwitcherModal-DMEEWm7Q.js → ProjectSwitcherModal-BnWbJWEX.js} +1 -1
  16. package/dist/web/assets/{TerminalOutput-CrGF3VWW.js → TerminalOutput-DsK-7nR8.js} +1 -1
  17. package/dist/web/assets/{ThemeSelectorModal-BLBet6sQ.js → ThemeSelectorModal-D5SBWDm5.js} +1 -1
  18. package/dist/web/assets/{WorkflowsPanel-DkXoYVsK.js → WorkflowsPanel-NU49178V.js} +1 -1
  19. package/dist/web/assets/WorktreePanel-DPk5b1Os.js +1 -0
  20. package/dist/web/assets/{edition-ui-CvFxsVfJ.js → edition-ui-7WkqSCbs.js} +1 -1
  21. package/dist/web/assets/index-Bg4A-xl7.js +510 -0
  22. package/dist/web/assets/index-BgZ8qUzM.js +3 -0
  23. package/dist/web/assets/{index-CAupRX51.js → index-C2tUYo8z.js} +1 -1
  24. package/dist/web/assets/{index-DueGSx7L.js → index-CevokSRq.js} +2 -2
  25. package/dist/web/assets/{index-DxZSG7e3.js → index-DIuobrPN.js} +2 -2
  26. package/dist/web/assets/index-DMO9bL9w.css +1 -0
  27. package/dist/web/assets/{session-parser.worker-Dv5Kch9n.js → session-parser.worker-DCsmYUeX.js} +22 -22
  28. package/dist/web/assets/{switch-BHG6oFbM.js → switch-DI9dp0Ya.js} +1 -1
  29. package/dist/web/assets/{vendor-ui-keo4oB2X.js → vendor-ui-Dc_kJXxz.js} +206 -196
  30. package/dist/web/index.html +3 -3
  31. package/package.json +1 -1
  32. package/dist/web/assets/CrewPanel-C1Yq8jMT.js +0 -1
  33. package/dist/web/assets/MissionHome-CNjhPZva.js +0 -2
  34. package/dist/web/assets/PluginsDialog-xM9uR8bB.js +0 -1
  35. package/dist/web/assets/WorktreePanel-DvFGKfAn.js +0 -1
  36. package/dist/web/assets/index-BvNyEUVG.js +0 -506
  37. package/dist/web/assets/index-D6HYPdiw.css +0 -1
@@ -1 +1 @@
1
- import{c as ie,j as u,r as M}from"./vendor-react-gGw_S5I_.js";import{bb as h,bc as Z,x as ue,bd as he,be as ge,bf as fe,bg as ve,bh as we,bi as be,bj as Ce,bk as Se,W as je,bl as ye,bm as xe,aH as ee,aY as p,bn as Pe,a$ as Te,bo as Oe,bp as ke,bq as Ne,br as Fe,bs as $e,F as Ee}from"./index-BvNyEUVG.js";import{bi as Ie,dc as Re,bU as te,ak as Ae,cR as De,cN as Le,bn as He,cm as Me,b7 as ne,a7 as Be,c1 as qe,aB as Ge,cF as Ke,cx as Ue,dd as We,cu as ze,bQ as _e,c7 as ae,de as pe,cz as Ve,cS as Qe,df as Xe,dg as Ye,aH as Je,a3 as Ze,aV as oe,cp as et,c2 as tt,aa as nt}from"./vendor-ui-keo4oB2X.js";import"./vendor-markdown-BEJ8yVzA.js";function a(t,e,s,c,l,m,d){return{id:t,label:e,icon:c,run:l,shortcut:m,description:d,value:`${e} ${s}`}}function V(...t){return t.filter(e=>e!==!1&&e!==void 0)}function at(t){const e=ie.c(40);let s,c,l,m,d,w,b,r,C,g,j,f,y,N,x;if(e[0]!==t){const I=V(a("home","Go to Mission Control","home overview dashboard",Le,t.onGoHome),a("mission-control",t.showMission?"Exit Mission Control":"Open Mission Control","live sessions blocked waiting answer everything at once",De,t.onToggleMissionControl,h("missionControl")),...(t.extraActions??[]).map(ot),a("new-session","Start a new session","project agent chat create",Ie,t.onNewSession,h("newSession")),t.onDuplicateSession&&a("duplicate-session","Duplicate this session","copy fork clone branch thread",Re,t.onDuplicateSession),t.canFocusComposer&&a("focus-composer","Focus message composer","chat prompt input",te,t.onFocusComposer,h("focusComposer")),t.onFindInConversation&&a("find-in-conversation","Find in conversation","search text transcript turns matches",Ae,t.onFindInConversation,h("findInConversation"))),F=(t.projects??[]).slice(0,8).map(n=>a(`project-${n.dirName}`,n.shortName,`${n.path} ${n.dirName} project workspace`,He,()=>{var i;return(i=t.onOpenProject)==null?void 0:i.call(t,n.dirName)},void 0,`${n.path} · ${n.sessionCount} session${n.sessionCount===1?"":"s"}`)),$=(t.recentSessions??[]).slice(0,10).map(n=>{const v=(n.aiTitle||n.name||n.slug||n.lastUserMessage||n.firstUserMessage||n.sessionId).replace(/\s+/g," ").trim().slice(0,160)||n.sessionId,L=[n.projectShortName,n.gitBranch].filter(Boolean).join(" · ");return a(`session-${n.dirName}-${n.fileName}`,v,`${n.projectShortName} ${n.cwd??""} ${n.gitBranch??""} ${n.sessionId} recent thread conversation`,te,()=>{var q;return(q=t.onOpenSession)==null?void 0:q.call(t,n.dirName,n.fileName)},void 0,L)}),R=t.devices??[],E=R.length>1&&t.onSwitchDevice?R.slice(0,Z.length).map((n,i)=>a(`device-${n.id}`,n.isActive?`${n.name} (current)`:`Switch to ${n.name}`,`device machine host remote ${n.id}`,n.isLocal?Me:ne,()=>{var v;return(v=t.onSwitchDevice)==null?void 0:v.call(t,n.id)},h(Z[i]))):[],o=V(a("toggle-sidebar",t.showSidebar?"Hide session sidebar":"Show session sidebar","projects navigation panel",We,t.onToggleSidebar,h("toggleSidebar")),t.hasSession&&a("toggle-stats",t.showStats?"Hide session details":"Show session details","stats tokens usage panel",Ue,t.onToggleStats,h("toggleStats")),t.onToggleProjectFiles&&a("project-files",t.showProjectFiles?"Close project files":"Open project files","browse edit save workspace source code",Ke,t.onToggleProjectFiles,h("projectFiles")),t.onToggleBrowser&&a("toggle-browser",t.showBrowser?"Hide browser":"Show browser","web page live view browse panel",Ge,t.onToggleBrowser),t.hasFileChanges&&a("toggle-file-changes",t.showFileChanges?"Hide file changes":"Show file changes","diff edits review panel",qe,t.onToggleFileChanges),t.supportsWorktrees&&t.canOpenTerminal&&a("toggle-worktrees",t.showWorktrees?"Hide worktrees":"Show worktrees","git branches panel",Be,t.onToggleWorktrees)),A=V(t.onOpenProjectInEditor&&a("open-project-editor","Open project in editor","code cursor vscode zed workspace",tt,t.onOpenProjectInEditor),t.onRevealProject&&a("reveal-project","Reveal project in file manager","finder explorer folder directory",et,t.onRevealProject),t.onCopyResumeCommand&&a("copy-resume-command","Copy resume command","cli claude codex copilot terminal clipboard continue session",oe,t.onCopyResumeCommand),t.onCopyProjectPath&&a("copy-project-path","Copy project path","workspace directory clipboard",oe,t.onCopyProjectPath),t.onOpenIntegratedTerminal&&a("integrated-terminal","New integrated terminal","embedded shell command line process panel",Ze,t.onOpenIntegratedTerminal,h("newIntegratedTerminal")),t.canOpenTerminal&&a("terminal","Open in system terminal","external shell command line app",Je,t.onOpenTerminal,h("systemTerminal")),t.onTogglePreview&&a("preview","Toggle development preview","browser localhost dev server website",Ye,t.onTogglePreview,h("preview")),t.onOpenKeyboardShortcuts&&a("keyboard-shortcuts","Customize keyboard shortcuts","keybindings hotkeys settings",Xe,t.onOpenKeyboardShortcuts),t.onOpenConfig&&a("config",t.showConfig?"Close agent configuration":"Open agent configuration","skills commands claude settings files",Qe,t.onOpenConfig),a("settings","Open Cogpit settings","preferences network",Ve,t.onOpenSettings),a("theme","Change theme & chat width","appearance light dark oled width narrow wide",pe,t.onOpenTheme,h("themeSelector")),a("expand","Expand all groups","conversation details",ae,t.onExpandAll,h("expandAll")),a("expand-payloads","Expand all tool payloads","raw input result diff conversation details",ae,t.onExpandToolPayloads,h("expandToolPayloads")),a("collapse","Collapse all","conversation groups payloads details",_e,t.onCollapseAll),t.onKillAll&&a("kill-all","Kill all agent processes","stop terminate halt everything runaway",ze,t.onKillAll),t.onOpenDevices&&a("manage-devices","Manage devices…","remote machines hub hosts edit rename remove switch",nt,()=>{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",ne,()=>{var n;return(n=t.onOpenDevices)==null?void 0:n.call(t,"add")})),k=[{value:"Navigation",items:I},...$.length>0?[{value:"Recent sessions",items:$}]:[],...F.length>0?[{value:"Projects",items:F}]:[],...E.length>0?[{value:"Devices",items:E}]:[],{value:"View",items:o},{value:"Tools",items:A}],D=function(i){t.onOpenChange(!1),i.run()};l=ve,y=t.open,N=t.onOpenChange,x="Command palette",w="Search for a Cogpit action to run.",b="max-w-xl",c=we,C="Search commands",g=!0,e[16]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(be,{"aria-label":"Search commands",autoFocus:!0,placeholder:"Search commands..."}),e[16]=j):j=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(ue,{className:"size-3.5"}),"Loading projects and sessions..."]}),e[17]=t.loadingNavigation,e[18]=f):f=e[18],s=Ce,m="max-h-[min(26rem,60vh)]",e[19]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Se,{children:"No matching actions."}),e[19]=d):d=e[19],r=k.map(n=>u.jsx(he,{heading:n.value,children:n.items.map(i=>{const v=i.icon;return u.jsxs(ge,{value:i.value,onSelect:()=>D(i),children:[u.jsx(v,{"aria-hidden":"true"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate",children:i.label}),i.description&&u.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:i.description})]}),i.shortcut&&u.jsx(fe,{children:i.shortcut})]},i.id)})},n.value)),e[0]=t,e[1]=s,e[2]=c,e[3]=l,e[4]=m,e[5]=d,e[6]=w,e[7]=b,e[8]=r,e[9]=C,e[10]=g,e[11]=j,e[12]=f,e[13]=y,e[14]=N,e[15]=x}else s=e[1],c=e[2],l=e[3],m=e[4],d=e[5],w=e[6],b=e[7],r=e[8],C=e[9],g=e[10],j=e[11],f=e[12],y=e[13],N=e[14],x=e[15];let P;e[20]!==s||e[21]!==m||e[22]!==d||e[23]!==r?(P=u.jsxs(s,{className:m,children:[d,r]}),e[20]=s,e[21]=m,e[22]=d,e[23]=r,e[24]=P):P=e[24];let T;e[25]!==c||e[26]!==P||e[27]!==C||e[28]!==g||e[29]!==j||e[30]!==f?(T=u.jsxs(c,{label:C,loop:g,children:[j,f,P]}),e[25]=c,e[26]=P,e[27]=C,e[28]=g,e[29]=j,e[30]=f,e[31]=T):T=e[31];let O;return e[32]!==l||e[33]!==w||e[34]!==b||e[35]!==T||e[36]!==y||e[37]!==N||e[38]!==x?(O=u.jsx(l,{open:y,onOpenChange:N,title:x,description:w,className:b,children:T}),e[32]=l,e[33]=w,e[34]=b,e[35]=T,e[36]=y,e[37]=N,e[38]=x,e[39]=O):O=e[39],O}function ot(t){return a(t.id,t.label,t.keywords,t.icon,t.onSelect)}async function se(t,e){const s=await Ee(t,{signal:e});if(!s.ok)throw new Error(`Request failed (${s.status})`);const c=await s.json();return Array.isArray(c)?c:[]}function rt(t){var Q;const e=ie.c(51);let s,c,l,m,d,w;e[0]!==t?({open:l,currentProjectDirName:s,projectCwd:d,onProcessStarted:c,launchTerminalRequest:w,...m}=t,e[0]=t,e[1]=s,e[2]=c,e[3]=l,e[4]=m,e[5]=d,e[6]=w):(s=e[1],c=e[2],l=e[3],m=e[4],d=e[5],w=e[6]);const b=w===void 0?0:w,r=je();let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=[],e[7]=C):C=e[7];const[g,j]=M.useState(C);let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[8]=f):f=e[8];const[y,N]=M.useState(f),[x,P]=M.useState(!1),T=M.useRef(0),O=ye();let I,F;e[9]!==O||e[10]!==l?(I=()=>{if(!l)return;const S=new AbortController,B=Te();return P(!0),Promise.allSettled([se("/api/projects",S.signal),se(Oe({limit:"12",perProject:"3"},O),S.signal)]).then(me=>{const[X,Y]=me;if(S.signal.aborted)return;const J=Y.status==="fulfilled"?Y.value:[];ke(J,B),j(X.status==="fulfilled"?X.value:[]),N(J),P(!1)}),()=>S.abort()},F=[l,O],e[9]=O,e[10]=l,e[11]=I,e[12]=F):(I=e[11],F=e[12]),M.useEffect(I,F);let $;e[13]!==g?($=xe(g),e[13]=g,e[14]=$):$=e[14];const R=$;let E;e:{if(d){E=d;break e}if(!s){E=null;break e}let S;e[15]!==s||e[16]!==g?(S=((Q=g.find(B=>B.dirName===s))==null?void 0:Q.path)??null,e[15]=s,e[16]=g,e[17]=S):S=e[17],E=S}const o=E;let A;e[18]!==c||e[19]!==r||e[20]!==o?(A=()=>{if(!o)return;const S=r.spawnTerminal({cwd:o}),B=o.replace(/\/+$/,"").split("/").at(-1)||"Terminal";c({id:S,name:B,type:"terminal",status:"running",source:o})},e[18]=c,e[19]=r,e[20]=o,e[21]=A):A=e[21];const k=A;let D,n;e[22]!==k||e[23]!==b||e[24]!==r.status||e[25]!==o?(n=()=>{b<=T.current||!o||r.status!=="connected"||(T.current=b,k())},D=[k,b,r.status,o],e[22]=k,e[23]=b,e[24]=r.status,e[25]=o,e[26]=D,e[27]=n):(D=e[26],n=e[27]),M.useEffect(n,D);let i;e[28]!==s||e[29]!==o?(i={path:o,dirName:s},e[28]=s,e[29]=o,e[30]=i):i=e[30];const v=i;let L;e[31]!==v?(L=()=>Ne(v),e[31]=v,e[32]=L):L=e[32];const q=L;let G;e[33]!==v?(G=()=>Fe(v),e[33]=v,e[34]=G):G=e[34];const le=G,ce=!ee()&&p("hostFiles"),re=p("hostFiles")&&(!ee()||Pe());let K;e[35]!==o?(K=()=>{o&&$e(o)},e[35]=o,e[36]=K):K=e[36];const de=K;let H;e[37]!==k||e[38]!==r.status||e[39]!==o?(H=o&&r.status==="connected"&&p("terminal")?k:void 0,e[37]=k,e[38]=r.status,e[39]=o,e[40]=H):H=e[40];const W=o&&re?q:void 0,z=o&&ce?le:void 0,_=o?de:void 0;let U;return e[41]!==x||e[42]!==l||e[43]!==m||e[44]!==y||e[45]!==R||e[46]!==H||e[47]!==W||e[48]!==z||e[49]!==_?(U=u.jsx(at,{...m,open:l,projects:R,recentSessions:y,loadingNavigation:x,onOpenIntegratedTerminal:H,onOpenProjectInEditor:W,onRevealProject:z,onCopyProjectPath:_}),e[41]=x,e[42]=l,e[43]=m,e[44]=y,e[45]=R,e[46]=H,e[47]=W,e[48]=z,e[49]=_,e[50]=U):U=e[50],U}export{rt as CommandPaletteHost};
1
+ import{c as ie,j as u,r as M}from"./vendor-react-gGw_S5I_.js";import{bb as h,bc as Z,x as ue,bd as he,be as ge,bf as fe,bg as ve,bh as we,bi as be,bj as Ce,bk as Se,W as je,bl as ye,bm as xe,aH as ee,aY as p,bn as Te,a$ as Pe,bo as Oe,bp as ke,bq as Ne,br as Fe,bs as $e,F as Ee}from"./index-Bg4A-xl7.js";import{bg as Ie,dd as Re,bT as te,ak as Ae,cS as De,cO as Le,bl as He,cl as Me,b5 as ne,a7 as Be,c1 as qe,aB as Ge,cF as Ke,cx as We,de as ze,cu as Ue,bP as _e,c7 as ae,df as pe,cz as Ve,cT as Xe,dg as Ye,dh as Je,aF as Qe,a3 as Ze,aT as oe,co as et,c2 as tt,aa as nt}from"./vendor-ui-Dc_kJXxz.js";import"./vendor-markdown-BEJ8yVzA.js";function a(t,e,s,c,l,m,d){return{id:t,label:e,icon:c,run:l,shortcut:m,description:d,value:`${e} ${s}`}}function V(...t){return t.filter(e=>e!==!1&&e!==void 0)}function at(t){const e=ie.c(40);let s,c,l,m,d,w,b,r,C,g,j,f,y,N,x;if(e[0]!==t){const I=V(a("home","Go to Mission Control","home overview dashboard",Le,t.onGoHome),a("mission-control",t.showMission?"Exit Mission Control":"Open Mission Control","live sessions blocked waiting answer everything at once",De,t.onToggleMissionControl,h("missionControl")),...(t.extraActions??[]).map(ot),a("new-session","Start a new session","project agent chat create",Ie,t.onNewSession,h("newSession")),t.onDuplicateSession&&a("duplicate-session","Duplicate this session","copy fork clone branch thread",Re,t.onDuplicateSession),t.canFocusComposer&&a("focus-composer","Focus message composer","chat prompt input",te,t.onFocusComposer,h("focusComposer")),t.onFindInConversation&&a("find-in-conversation","Find in conversation","search text transcript turns matches",Ae,t.onFindInConversation,h("findInConversation"))),F=(t.projects??[]).slice(0,8).map(n=>a(`project-${n.dirName}`,n.shortName,`${n.path} ${n.dirName} project workspace`,He,()=>{var i;return(i=t.onOpenProject)==null?void 0:i.call(t,n.dirName)},void 0,`${n.path} · ${n.sessionCount} session${n.sessionCount===1?"":"s"}`)),$=(t.recentSessions??[]).slice(0,10).map(n=>{const v=(n.aiTitle||n.name||n.slug||n.lastUserMessage||n.firstUserMessage||n.sessionId).replace(/\s+/g," ").trim().slice(0,160)||n.sessionId,L=[n.projectShortName,n.gitBranch].filter(Boolean).join(" · ");return a(`session-${n.dirName}-${n.fileName}`,v,`${n.projectShortName} ${n.cwd??""} ${n.gitBranch??""} ${n.sessionId} recent thread conversation`,te,()=>{var q;return(q=t.onOpenSession)==null?void 0:q.call(t,n.dirName,n.fileName)},void 0,L)}),R=t.devices??[],E=R.length>1&&t.onSwitchDevice?R.slice(0,Z.length).map((n,i)=>a(`device-${n.id}`,n.isActive?`${n.name} (current)`:`Switch to ${n.name}`,`device machine host remote ${n.id}`,n.isLocal?Me:ne,()=>{var v;return(v=t.onSwitchDevice)==null?void 0:v.call(t,n.id)},h(Z[i]))):[],o=V(a("toggle-sidebar",t.showSidebar?"Hide session sidebar":"Show session sidebar","projects navigation panel",ze,t.onToggleSidebar,h("toggleSidebar")),t.hasSession&&a("toggle-stats",t.showStats?"Hide session details":"Show session details","stats tokens usage panel",We,t.onToggleStats,h("toggleStats")),t.onToggleProjectFiles&&a("project-files",t.showProjectFiles?"Close project files":"Open project files","browse edit save workspace source code",Ke,t.onToggleProjectFiles,h("projectFiles")),t.onToggleBrowser&&a("toggle-browser",t.showBrowser?"Hide browser":"Show browser","web page live view browse panel",Ge,t.onToggleBrowser),t.hasFileChanges&&a("toggle-file-changes",t.showFileChanges?"Hide file changes":"Show file changes","diff edits review panel",qe,t.onToggleFileChanges),t.supportsWorktrees&&t.canOpenTerminal&&a("toggle-worktrees",t.showWorktrees?"Hide worktrees":"Show worktrees","git branches panel",Be,t.onToggleWorktrees)),A=V(t.onOpenProjectInEditor&&a("open-project-editor","Open project in editor","code cursor vscode zed workspace",tt,t.onOpenProjectInEditor),t.onRevealProject&&a("reveal-project","Reveal project in file manager","finder explorer folder directory",et,t.onRevealProject),t.onCopyResumeCommand&&a("copy-resume-command","Copy resume command","cli claude codex copilot terminal clipboard continue session",oe,t.onCopyResumeCommand),t.onCopyProjectPath&&a("copy-project-path","Copy project path","workspace directory clipboard",oe,t.onCopyProjectPath),t.onOpenIntegratedTerminal&&a("integrated-terminal","New integrated terminal","embedded shell command line process panel",Ze,t.onOpenIntegratedTerminal,h("newIntegratedTerminal")),t.canOpenTerminal&&a("terminal","Open in system terminal","external shell command line app",Qe,t.onOpenTerminal,h("systemTerminal")),t.onTogglePreview&&a("preview","Toggle development preview","browser localhost dev server website",Je,t.onTogglePreview,h("preview")),t.onOpenKeyboardShortcuts&&a("keyboard-shortcuts","Customize keyboard shortcuts","keybindings hotkeys settings",Ye,t.onOpenKeyboardShortcuts),t.onOpenConfig&&a("config",t.showConfig?"Close agent configuration":"Open agent configuration","skills commands claude settings files",Xe,t.onOpenConfig),a("settings","Open Cogpit settings","preferences network",Ve,t.onOpenSettings),a("theme","Change theme & chat width","appearance light dark oled width narrow wide",pe,t.onOpenTheme,h("themeSelector")),a("expand","Expand all groups","conversation details",ae,t.onExpandAll,h("expandAll")),a("expand-payloads","Expand all tool payloads","raw input result diff conversation details",ae,t.onExpandToolPayloads,h("expandToolPayloads")),a("collapse","Collapse all","conversation groups payloads details",_e,t.onCollapseAll),t.onKillAll&&a("kill-all","Kill all agent processes","stop terminate halt everything runaway",Ue,t.onKillAll),t.onOpenDevices&&a("manage-devices","Manage devices…","remote machines hub hosts edit rename remove switch",nt,()=>{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",ne,()=>{var n;return(n=t.onOpenDevices)==null?void 0:n.call(t,"add")})),k=[{value:"Navigation",items:I},...$.length>0?[{value:"Recent sessions",items:$}]:[],...F.length>0?[{value:"Projects",items:F}]:[],...E.length>0?[{value:"Devices",items:E}]:[],{value:"View",items:o},{value:"Tools",items:A}],D=function(i){t.onOpenChange(!1),i.run()};l=ve,y=t.open,N=t.onOpenChange,x="Command palette",w="Search for a Cogpit action to run.",b="max-w-xl",c=we,C="Search commands",g=!0,e[16]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(be,{"aria-label":"Search commands",autoFocus:!0,placeholder:"Search commands..."}),e[16]=j):j=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(ue,{className:"size-3.5"}),"Loading projects and sessions..."]}),e[17]=t.loadingNavigation,e[18]=f):f=e[18],s=Ce,m="max-h-[min(26rem,60vh)]",e[19]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Se,{children:"No matching actions."}),e[19]=d):d=e[19],r=k.map(n=>u.jsx(he,{heading:n.value,children:n.items.map(i=>{const v=i.icon;return u.jsxs(ge,{value:i.value,onSelect:()=>D(i),children:[u.jsx(v,{"aria-hidden":"true"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate",children:i.label}),i.description&&u.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:i.description})]}),i.shortcut&&u.jsx(fe,{children:i.shortcut})]},i.id)})},n.value)),e[0]=t,e[1]=s,e[2]=c,e[3]=l,e[4]=m,e[5]=d,e[6]=w,e[7]=b,e[8]=r,e[9]=C,e[10]=g,e[11]=j,e[12]=f,e[13]=y,e[14]=N,e[15]=x}else s=e[1],c=e[2],l=e[3],m=e[4],d=e[5],w=e[6],b=e[7],r=e[8],C=e[9],g=e[10],j=e[11],f=e[12],y=e[13],N=e[14],x=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 P;e[25]!==c||e[26]!==T||e[27]!==C||e[28]!==g||e[29]!==j||e[30]!==f?(P=u.jsxs(c,{label:C,loop:g,children:[j,f,T]}),e[25]=c,e[26]=T,e[27]=C,e[28]=g,e[29]=j,e[30]=f,e[31]=P):P=e[31];let O;return e[32]!==l||e[33]!==w||e[34]!==b||e[35]!==P||e[36]!==y||e[37]!==N||e[38]!==x?(O=u.jsx(l,{open:y,onOpenChange:N,title:x,description:w,className:b,children:P}),e[32]=l,e[33]=w,e[34]=b,e[35]=P,e[36]=y,e[37]=N,e[38]=x,e[39]=O):O=e[39],O}function ot(t){return a(t.id,t.label,t.keywords,t.icon,t.onSelect)}async function se(t,e){const s=await Ee(t,{signal:e});if(!s.ok)throw new Error(`Request failed (${s.status})`);const c=await s.json();return Array.isArray(c)?c:[]}function rt(t){var X;const e=ie.c(51);let s,c,l,m,d,w;e[0]!==t?({open:l,currentProjectDirName:s,projectCwd:d,onProcessStarted:c,launchTerminalRequest:w,...m}=t,e[0]=t,e[1]=s,e[2]=c,e[3]=l,e[4]=m,e[5]=d,e[6]=w):(s=e[1],c=e[2],l=e[3],m=e[4],d=e[5],w=e[6]);const b=w===void 0?0:w,r=je();let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=[],e[7]=C):C=e[7];const[g,j]=M.useState(C);let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[8]=f):f=e[8];const[y,N]=M.useState(f),[x,T]=M.useState(!1),P=M.useRef(0),O=ye();let I,F;e[9]!==O||e[10]!==l?(I=()=>{if(!l)return;const S=new AbortController,B=Pe();return T(!0),Promise.allSettled([se("/api/projects",S.signal),se(Oe({limit:"12",perProject:"3"},O),S.signal)]).then(me=>{const[Y,J]=me;if(S.signal.aborted)return;const Q=J.status==="fulfilled"?J.value:[];ke(Q,B),j(Y.status==="fulfilled"?Y.value:[]),N(Q),T(!1)}),()=>S.abort()},F=[l,O],e[9]=O,e[10]=l,e[11]=I,e[12]=F):(I=e[11],F=e[12]),M.useEffect(I,F);let $;e[13]!==g?($=xe(g),e[13]=g,e[14]=$):$=e[14];const R=$;let E;e:{if(d){E=d;break e}if(!s){E=null;break e}let S;e[15]!==s||e[16]!==g?(S=((X=g.find(B=>B.dirName===s))==null?void 0:X.path)??null,e[15]=s,e[16]=g,e[17]=S):S=e[17],E=S}const o=E;let A;e[18]!==c||e[19]!==r||e[20]!==o?(A=()=>{if(!o)return;const S=r.spawnTerminal({cwd:o}),B=o.replace(/\/+$/,"").split("/").at(-1)||"Terminal";c({id:S,name:B,type:"terminal",status:"running",source:o})},e[18]=c,e[19]=r,e[20]=o,e[21]=A):A=e[21];const k=A;let D,n;e[22]!==k||e[23]!==b||e[24]!==r.status||e[25]!==o?(n=()=>{b<=P.current||!o||r.status!=="connected"||(P.current=b,k())},D=[k,b,r.status,o],e[22]=k,e[23]=b,e[24]=r.status,e[25]=o,e[26]=D,e[27]=n):(D=e[26],n=e[27]),M.useEffect(n,D);let i;e[28]!==s||e[29]!==o?(i={path:o,dirName:s},e[28]=s,e[29]=o,e[30]=i):i=e[30];const v=i;let L;e[31]!==v?(L=()=>Ne(v),e[31]=v,e[32]=L):L=e[32];const q=L;let G;e[33]!==v?(G=()=>Fe(v),e[33]=v,e[34]=G):G=e[34];const le=G,ce=!ee()&&p("hostFiles"),re=p("hostFiles")&&(!ee()||Te());let K;e[35]!==o?(K=()=>{o&&$e(o)},e[35]=o,e[36]=K):K=e[36];const de=K;let H;e[37]!==k||e[38]!==r.status||e[39]!==o?(H=o&&r.status==="connected"&&p("terminal")?k:void 0,e[37]=k,e[38]=r.status,e[39]=o,e[40]=H):H=e[40];const z=o&&re?q:void 0,U=o&&ce?le:void 0,_=o?de:void 0;let W;return e[41]!==x||e[42]!==l||e[43]!==m||e[44]!==y||e[45]!==R||e[46]!==H||e[47]!==z||e[48]!==U||e[49]!==_?(W=u.jsx(at,{...m,open:l,projects:R,recentSessions:y,loadingNavigation:x,onOpenIntegratedTerminal:H,onOpenProjectInEditor:z,onRevealProject:U,onCopyProjectPath:_}),e[41]=x,e[42]=l,e[43]=m,e[44]=y,e[45]=R,e[46]=H,e[47]=z,e[48]=U,e[49]=_,e[50]=W):W=e[50],W}export{rt as CommandPaletteHost};
@@ -1 +1 @@
1
- import{c as G,j as t,r as o}from"./vendor-react-gGw_S5I_.js";import{by as ye,bN as Ce,c as F,aC as ke,ae as X,ac as q,aB as ve,aA as Z,au as ae,B as I,F as A,bO as Ne,bP as Se,bQ as we,bR as De,bS as Te,bT as Ee,bU as V,bV as Re,bW as ee,bX as Oe,k as te,aa as le,bY as Ie,a9 as ie,a5 as re,a3 as oe,a4 as ce,a7 as de,a6 as ue,a8 as me,x as ze,E as Ae,f as Le,U as Be,h as $e,i as Fe,b7 as Ge,az as Me,ax as ne,aw as Pe,ay as Ue,m as _e,bZ as Ve}from"./index-BvNyEUVG.js";import{c0 as Ke,a3 as He,a5 as Qe,bz as Ye,dm as Je,U as We,dn as xe,aB as fe,dp as Xe,dq as qe,aE as K,X as H,bi as Ze,cU as he,dr as et,b2 as tt,bR as nt,ak as st,cM as at}from"./vendor-ui-keo4oB2X.js";import{H as lt}from"./HighlightedEditor-clIIwmWB.js";import"./vendor-markdown-BEJ8yVzA.js";const it={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"},rt={agents:{subdir:"agents",fileType:"agent"},skills:{subdir:"skills",fileType:"skill"},commands:{subdir:"commands",fileType:"command"}},se=["instructions","agents","skills","commands","settings"],ot={instructions:{label:"Instructions",icon:Je,color:"text-muted-foreground"},agents:{label:"Agents",icon:Ye,color:"text-muted-foreground"},skills:{label:"Skills",icon:Qe,color:"text-muted-foreground"},commands:{label:"Commands",icon:He,color:"text-muted-foreground"},settings:{label:"Settings",icon:Ke,color:"text-muted-foreground"}};function Q(l,e,i){const n=[];for(const s of l)s.type==="directory"&&s.children?n.push(...Q(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 ct(l){const e={instructions:[],agents:[],skills:[],commands:[],settings:[]};for(const i of l){const n=Q(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 ge(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(We,{"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(xe,{"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(fe,{"data-icon":"inline-start",className:"size-3"}),"global"]}),e[4]=s):s=e[4],s}const dt=Object.fromEntries(ye().map(l=>[l.kind,Ce(l.kind)]));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(Xe,{"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 any CLI",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=dt[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 je(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=F("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 p;return e[6]!==u||e[7]!==m||e[8]!==d?(p=t.jsxs("span",{className:u,title:m,children:[c,d]}),e[6]=u,e[7]=m,e[8]=d,e[9]=p):p=e[9],p}function ut({globalDir:l,projectDir:e,fileType:i,onCreated:n,onCancel:s}){const[r,u]=o.useState(""),[m,c]=o.useState(e?"project":"global"),[d,p]=o.useState(!1),w=o.useRef(null),y=o.useId();o.useEffect(()=>{var x;(x=w.current)==null||x.focus()},[]);const k=m==="project"&&e?e:l,b=!!l&&!!e;async function S(){if(!(!r.trim()||!k)){p(!0);try{const x=await A("/api/config-browser/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:k,fileType:i,name:r.trim()})});if(x.ok){const g=await x.json();n(g.path,i,m)}}finally{p(!1)}}}return t.jsxs(ke,{className:"gap-3 px-3 py-2",children:[b&&t.jsxs(X,{children:[t.jsx(q,{children:"Scope"}),t.jsxs(ve,{"aria-label":"File scope",value:[m],onValueChange:x=>{const g=x[0];(g==="global"||g==="project")&&c(g)},variant:"outline",size:"sm",spacing:0,className:"w-full",children:[t.jsxs(Z,{value:"global",className:"flex-1",children:[t.jsx(fe,{"data-icon":"inline-start"}),"Global"]}),t.jsxs(Z,{value:"project",className:"flex-1",children:[t.jsx(xe,{"data-icon":"inline-start"}),"Project"]})]})]}),t.jsxs(X,{children:[t.jsxs(q,{htmlFor:y,children:[i.charAt(0).toUpperCase()+i.slice(1)," name"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ae,{id:y,ref:w,type:"text",value:r,onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="Enter"&&S(),x.key==="Escape"&&s()},placeholder:`${i} name...`,className:"h-7 min-w-0 flex-1 text-xs",disabled:d}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":`Create ${i}`,onClick:()=>void S(),disabled:d||!r.trim()||!k,children:t.jsx(K,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel create",onClick:s,children:t.jsx(H,{"data-icon":"inline-start"})})]})]})]})}function mt(l){const e=G.c(50),{category:i,items:n,selectedPath:s,onSelect:r,onNewFile:u,onDeleteItem:m,onRenameItem:c,renamingPath:d,renameValue:p,onRenameValueChange:w,onRenameSubmit:y,onRenameCancel:k,creatingInCategory:b,onCreated:S,onCancelCreate:x}=l,g=ot[i],C=g.icon;if(n.length===0&&!u)return null;let N;e[0]!==g.color?(N=F("size-3.5",g.color),e[0]=g.color,e[1]=N):N=e[1];let v;e[2]!==C||e[3]!==N?(v=t.jsx(C,{"data-icon":"inline-start",className:N}),e[2]=C,e[3]=N,e[4]=v):v=e[4];let T;e[5]!==g.label?(T=t.jsx("span",{className:"flex-1 text-xs font-medium text-muted-foreground",children:g.label}),e[5]=g.label,e[6]=T):T=e[6];let E;e[7]!==n.length?(E=t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n.length}),e[7]=n.length,e[8]=E):E=e[8];let f;e[9]!==i||e[10]!==u?(f=u&&t.jsxs(Ne,{children:[t.jsx(Se,{render:t.jsx(I,{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(Ze,{"data-icon":"inline-start"})}),t.jsxs(we,{children:["New ",i.slice(0,-1)]})]}),e[9]=i,e[10]=u,e[11]=f):f=e[11];let D;e[12]!==v||e[13]!==T||e[14]!==E||e[15]!==f?(D=t.jsxs("div",{className:"group flex h-8 items-center gap-1.5 px-3",children:[v,T,E,f]}),e[12]=v,e[13]=T,e[14]=E,e[15]=f,e[16]=D):D=e[16];let z;if(e[17]!==n||e[18]!==m||e[19]!==k||e[20]!==c||e[21]!==y||e[22]!==w||e[23]!==r||e[24]!==p||e[25]!==d||e[26]!==s){let B;e[28]!==m||e[29]!==k||e[30]!==c||e[31]!==y||e[32]!==w||e[33]!==r||e[34]!==p||e[35]!==d||e[36]!==s?(B=j=>{const U=s===j.path;if(d===j.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(ae,{value:p,onChange:$=>w($.target.value),onKeyDown:$=>{$.key==="Enter"&&y(),$.key==="Escape"&&k()},autoFocus:!0,className:"h-7 min-w-0 flex-1 text-xs"}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Save name",onClick:y,disabled:!p.trim(),children:t.jsx(K,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel rename",onClick:k,children:t.jsx(H,{"data-icon":"inline-start"})})]},j.path);const M=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:j.name}),t.jsx(je,{linkTarget:j.linkTarget}),j.readOnly&&t.jsx(he,{className:"size-2.5 shrink-0 text-muted-foreground/40"})]}),j.description&&t.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:j.description})]}),t.jsx(pe,{cli:j.cli}),t.jsx(ge,{scope:j.scope,pluginName:j.pluginName})]}),P=F("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:P,onClick:()=>r(j),children:M},j.path):t.jsxs(De,{children:[t.jsx(Te,{render:t.jsx("button",{type:"button",className:P,onClick:()=>r(j)}),children:M}),t.jsx(Ee,{className:"min-w-36",children:j.readOnly?t.jsx(V,{children:t.jsx(Re,{children:"Read-only file"})}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(ee,{onClick:()=>c(j),children:"Rename"})}),t.jsx(Oe,{}),t.jsx(V,{children:t.jsx(ee,{variant:"destructive",onClick:()=>m(j),children:"Delete"})})]})})]},j.path)},e[28]=m,e[29]=k,e[30]=c,e[31]=y,e[32]=w,e[33]=r,e[34]=p,e[35]=d,e[36]=s,e[37]=B):B=e[37],z=n.map(B),e[17]=n,e[18]=m,e[19]=k,e[20]=c,e[21]=y,e[22]=w,e[23]=r,e[24]=p,e[25]=d,e[26]=s,e[27]=z}else z=e[27];let R;e[38]!==b||e[39]!==n.length?(R=n.length===0&&!b&&t.jsx("p",{className:"px-3 py-1 text-xs text-muted-foreground",children:"None configured"}),e[38]=b,e[39]=n.length,e[40]=R):R=e[40];let O;e[41]!==b||e[42]!==x||e[43]!==S?(O=b&&t.jsx(ut,{globalDir:b.globalDir,projectDir:b.projectDir,fileType:b.fileType,onCreated:S,onCancel:x}),e[41]=b,e[42]=x,e[43]=S,e[44]=O):O=e[44];let L;return e[45]!==D||e[46]!==z||e[47]!==R||e[48]!==O?(L=t.jsxs("section",{children:[D,z,R,O]}),e[45]=D,e[46]=z,e[47]=R,e[48]=O,e[49]=L):L=e[49],L}function xt({file:l,onDeleted:e,readOnly:i=!1}){const[n,s]=o.useState(null),[r,u]=o.useState(null),[m,c]=o.useState(!0),[d,p]=o.useState(!1),[w,y]=o.useState(!1),[k,b]=o.useState(!1),[S,x]=o.useState(!1),g=n!==null&&n!==r,C=i||l.readOnly;o.useEffect(()=>{c(!0),s(null),u(null),y(!1),b(!1),A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`).then(f=>f.json()).then(f=>{s(f.content??""),u(f.content??"")}).catch(()=>{s(""),u("")}).finally(()=>c(!1))},[l.path]);const N=o.useCallback(async()=>{if(!(!g||C)){p(!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),y(!0),setTimeout(()=>y(!1),2e3))}finally{p(!1)}}},[n,l.path,g,C]),v=o.useCallback(()=>{s(r)},[r]),T=o.useCallback(async()=>{if(!C){x(!0);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`,{method:"DELETE"})).ok&&(b(!1),e())}catch{}finally{x(!1)}}},[l.path,C,e]);o.useEffect(()=>{function f(D){!C&&(D.metaKey||D.ctrlKey)&&D.key==="s"&&(D.preventDefault(),N())}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[N,C]);function E(){return w?"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(te,{variant:"outline",className:F("h-5 text-xs",it[l.fileType]||"bg-muted text-muted-foreground"),children:l.fileType}),t.jsx(ge,{scope:l.scope,pluginName:l.pluginName}),t.jsx(pe,{cli:l.cli,variant:"full"}),C&&t.jsxs(te,{variant:"outline",className:"h-5 bg-muted text-xs text-muted-foreground",children:[t.jsx(he,{"data-icon":"inline-start",className:"size-3"})," read-only"]}),g&&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(je,{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(lt,{value:n??"",onChange:s,readOnly:C,filePath:l.path}),!C&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t bg-card px-4 py-2",children:[t.jsxs(I,{size:"xs",onClick:N,disabled:!g||d,children:[t.jsx(K,{"data-icon":"inline-start"}),E()]}),t.jsxs(I,{variant:"outline",size:"xs",onClick:v,disabled:!g,children:[t.jsx(et,{"data-icon":"inline-start"}),"Discard"]}),t.jsx("div",{className:"flex-1"}),t.jsxs(le,{open:k,onOpenChange:b,children:[t.jsxs(Ie,{render:t.jsx(I,{variant:"outline",size:"xs"}),children:[t.jsx(tt,{"data-icon":"inline-start"}),"Delete"]}),t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',l.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",disabled:S,children:"Cancel"}),t.jsxs(me,{variant:"destructive",size:"sm",disabled:S,onClick:()=>void T(),children:[S&&t.jsx(ze,{"data-icon":"inline-start"}),S?"Deleting...":"Delete file"]})]})]})]})]})]})]})}function ft(){const l=G.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ae,{className:"border-0",children:t.jsxs(Le,{children:[t.jsx(Be,{variant:"icon",children:t.jsx(nt,{})}),t.jsx($e,{children:"Select a configuration file"}),t.jsx(Fe,{children:"Browse instructions, agents, skills, commands, and settings from the sidebar."})]})}),l[0]=e):e=l[0],e}function ht(l){return l.cli?l.cli.length>0?l.cli.join(" "):"unlinked":""}function gt(l,e){if(!e)return l;const i=e.toLowerCase();return l.filter(n=>[n.name,n.description,n.path,n.linkTarget??"",ht(n)].some(r=>r.toLowerCase().includes(i)))}const kt=o.memo(function({projectPath:e,initialFilePath:i}){var J,W;const n=Ge("configWrite"),[s,r]=o.useState([]),[u,m]=o.useState(!0),[c,d]=o.useState(null),[p,w]=o.useState(!1),[y,k]=o.useState(null),[b,S]=o.useState(""),[x,g]=o.useState(null),[C,N]=o.useState(""),[v,T]=o.useState(null),E=o.useRef(!1),f=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",h=await A(a);if(h.ok){const _=await h.json();r(_.sections||[])}}finally{m(!1)}},[n,e]);o.useEffect(()=>{f()},[f]),o.useEffect(()=>{if(!i||u||E.current)return;const a=s.flatMap(h=>Q(h.items,h.scope,h.pluginName)).find(h=>h.path===i);a&&(d(a),E.current=!0)},[i,u,s]);const D=ct(s),z=Object.fromEntries(se.map(a=>[a,gt(D[a],b)])),R=(J=s.find(a=>a.scope==="global"))==null?void 0:J.baseDir,O=(W=s.find(a=>a.scope==="project"))==null?void 0:W.baseDir,L=o.useCallback(a=>{d(a),w(!1),k(null)},[]),B=o.useCallback((a,h,_)=>{k(null),f(),d({path:a,name:a.split("/").pop()||"",fileType:h,readOnly:!1,scope:_,description:""})},[f]),j=o.useCallback(()=>{d(null),f()},[f]),U=o.useCallback(a=>{if(!n||!R&&!O)return;const h=rt[a];h&&k({category:a,globalDir:R?`${R}/${h.subdir}`:null,projectDir:O?`${O}/${h.subdir}`:null,fileType:h.fileType})},[n,R,O]),Y=o.useCallback(a=>{!n||a.readOnly||T(a)},[n]),M=o.useCallback(async()=>{if(!n||!v||v.readOnly)return;const a=v;T(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),f())}catch{}},[n,f,v,c]),P=o.useCallback(a=>{if(!n||a.readOnly)return;const h=a.name==="SKILL.md"?a.path.split("/").slice(-2,-1)[0]||a.name:a.name.replace(/\.[^.]+$/,"");g(a),N(h)},[n]),$=o.useCallback(async()=>{if(!(!n||!x||!C.trim()))try{const a=await A("/api/config-browser/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:x.path,newName:C.trim()})});if(a.ok){const h=await a.json();g(null),N(""),await f(),h.newPath&&d({...x,path:h.newPath,name:h.newPath.split("/").pop()||x.name})}}catch{}},[n,x,C,f]),be=o.useCallback(()=>{g(null),N("")},[]);return n?t.jsxs("div",{className:"flex flex-1 min-h-0 min-w-0",children:[t.jsxs("div",{className:F("min-h-0 shrink-0 flex-col border-r bg-sidebar md:flex md:w-80",c&&!p?"hidden":"flex w-full"),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(Me,{children:[t.jsx(ne,{children:t.jsx(st,{"data-icon":"inline-start"})}),t.jsx(Pe,{value:b,onChange:a=>S(a.target.value),placeholder:"Search configuration"}),b&&t.jsx(ne,{align:"inline-end",children:t.jsx(Ue,{size:"icon-xs","aria-label":"Clear search",onClick:()=>S(""),children:t.jsx(H,{"data-icon":"inline-start"})})})]})}),t.jsx(_e,{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,h)=>t.jsx(Ve,{className:"h-8 w-full"},h))}):se.map(a=>{const h=a==="agents"||a==="skills"||a==="commands";return t.jsx(mt,{category:a,items:z[a],selectedPath:(c==null?void 0:c.path)??null,onSelect:L,onNewFile:n&&h?()=>U(a):void 0,onDeleteItem:n?Y:void 0,onRenameItem:n?P:void 0,renamingPath:(x==null?void 0:x.path)??null,renameValue:C,onRenameValueChange:N,onRenameSubmit:$,onRenameCancel:be,creatingInCategory:n&&(y==null?void 0:y.category)===a?y:null,onCreated:B,onCancelCreate:()=>k(null)},a)})})})]}),t.jsx("div",{className:F("min-h-0 min-w-0 flex-1 flex-col md:flex",c&&!p?"flex":"hidden"),children:c?t.jsxs(t.Fragment,{children:[t.jsxs(I,{variant:"ghost",className:"min-h-11 shrink-0 justify-start md:hidden",onClick:()=>w(!0),children:[t.jsx(at,{"data-icon":"inline-start"}),"All configuration files"]}),t.jsx(xt,{file:c,onDeleted:j,readOnly:!n})]}):t.jsx(ft,{})}),t.jsx(le,{open:v!==null,onOpenChange:a=>{a||T(null)},children:t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',v==null?void 0:v.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",children:"Cancel"}),t.jsx(me,{variant:"destructive",size:"sm",onClick:()=>void M(),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{kt as ConfigBrowser};
1
+ import{c as G,j as t,r as o}from"./vendor-react-gGw_S5I_.js";import{by as ye,bN as Ce,c as F,aC as ke,ae as X,ac as q,aB as ve,aA as Z,au as ae,B as I,F as A,bO as Ne,bP as Se,bQ as we,bR as De,bS as Te,bT as Ee,bU as _,bV as Re,bW as ee,bX as Oe,k as te,aa as le,bY as Ie,a9 as ie,a5 as re,a3 as oe,a4 as ce,a7 as de,a6 as ue,a8 as me,x as ze,E as Ae,f as Le,U as Be,h as $e,i as Fe,b7 as Ge,az as Me,ax as ne,aw as Pe,ay as Ue,m as Ve,bZ as _e}from"./index-Bg4A-xl7.js";import{c0 as Ke,a3 as Qe,a5 as He,bt as Ye,dn as Je,U as We,dp as xe,aB as fe,dq as Xe,dr as qe,ds as K,X as Q,bg as Ze,cV as he,dt as et,b0 as tt,bQ as nt,ak as st,cN as at}from"./vendor-ui-Dc_kJXxz.js";import{H as lt}from"./HighlightedEditor-D1S-wotA.js";import"./vendor-markdown-BEJ8yVzA.js";const it={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"},rt={agents:{subdir:"agents",fileType:"agent"},skills:{subdir:"skills",fileType:"skill"},commands:{subdir:"commands",fileType:"command"}},se=["instructions","agents","skills","commands","settings"],ot={instructions:{label:"Instructions",icon:Je,color:"text-muted-foreground"},agents:{label:"Agents",icon:Ye,color:"text-muted-foreground"},skills:{label:"Skills",icon:He,color:"text-muted-foreground"},commands:{label:"Commands",icon:Qe,color:"text-muted-foreground"},settings:{label:"Settings",icon:Ke,color:"text-muted-foreground"}};function H(l,e,i){const n=[];for(const s of l)s.type==="directory"&&s.children?n.push(...H(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 ct(l){const e={instructions:[],agents:[],skills:[],commands:[],settings:[]};for(const i of l){const n=H(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 ge(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(We,{"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(xe,{"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(fe,{"data-icon":"inline-start",className:"size-3"}),"global"]}),e[4]=s):s=e[4],s}const dt=Object.fromEntries(ye().map(l=>[l.kind,Ce(l.kind)]));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(Xe,{"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 any CLI",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=dt[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 je(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=F("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 p;return e[6]!==u||e[7]!==m||e[8]!==d?(p=t.jsxs("span",{className:u,title:m,children:[c,d]}),e[6]=u,e[7]=m,e[8]=d,e[9]=p):p=e[9],p}function ut({globalDir:l,projectDir:e,fileType:i,onCreated:n,onCancel:s}){const[r,u]=o.useState(""),[m,c]=o.useState(e?"project":"global"),[d,p]=o.useState(!1),w=o.useRef(null),y=o.useId();o.useEffect(()=>{var x;(x=w.current)==null||x.focus()},[]);const k=m==="project"&&e?e:l,b=!!l&&!!e;async function S(){if(!(!r.trim()||!k)){p(!0);try{const x=await A("/api/config-browser/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:k,fileType:i,name:r.trim()})});if(x.ok){const g=await x.json();n(g.path,i,m)}}finally{p(!1)}}}return t.jsxs(ke,{className:"gap-3 px-3 py-2",children:[b&&t.jsxs(X,{children:[t.jsx(q,{children:"Scope"}),t.jsxs(ve,{"aria-label":"File scope",value:[m],onValueChange:x=>{const g=x[0];(g==="global"||g==="project")&&c(g)},variant:"outline",size:"sm",spacing:0,className:"w-full",children:[t.jsxs(Z,{value:"global",className:"flex-1",children:[t.jsx(fe,{"data-icon":"inline-start"}),"Global"]}),t.jsxs(Z,{value:"project",className:"flex-1",children:[t.jsx(xe,{"data-icon":"inline-start"}),"Project"]})]})]}),t.jsxs(X,{children:[t.jsxs(q,{htmlFor:y,children:[i.charAt(0).toUpperCase()+i.slice(1)," name"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ae,{id:y,ref:w,type:"text",value:r,onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="Enter"&&S(),x.key==="Escape"&&s()},placeholder:`${i} name...`,className:"h-7 min-w-0 flex-1 text-xs",disabled:d}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":`Create ${i}`,onClick:()=>void S(),disabled:d||!r.trim()||!k,children:t.jsx(K,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel create",onClick:s,children:t.jsx(Q,{"data-icon":"inline-start"})})]})]})]})}function mt(l){const e=G.c(50),{category:i,items:n,selectedPath:s,onSelect:r,onNewFile:u,onDeleteItem:m,onRenameItem:c,renamingPath:d,renameValue:p,onRenameValueChange:w,onRenameSubmit:y,onRenameCancel:k,creatingInCategory:b,onCreated:S,onCancelCreate:x}=l,g=ot[i],C=g.icon;if(n.length===0&&!u)return null;let N;e[0]!==g.color?(N=F("size-3.5",g.color),e[0]=g.color,e[1]=N):N=e[1];let v;e[2]!==C||e[3]!==N?(v=t.jsx(C,{"data-icon":"inline-start",className:N}),e[2]=C,e[3]=N,e[4]=v):v=e[4];let T;e[5]!==g.label?(T=t.jsx("span",{className:"flex-1 text-xs font-medium text-muted-foreground",children:g.label}),e[5]=g.label,e[6]=T):T=e[6];let E;e[7]!==n.length?(E=t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n.length}),e[7]=n.length,e[8]=E):E=e[8];let f;e[9]!==i||e[10]!==u?(f=u&&t.jsxs(Ne,{children:[t.jsx(Se,{render:t.jsx(I,{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(Ze,{"data-icon":"inline-start"})}),t.jsxs(we,{children:["New ",i.slice(0,-1)]})]}),e[9]=i,e[10]=u,e[11]=f):f=e[11];let D;e[12]!==v||e[13]!==T||e[14]!==E||e[15]!==f?(D=t.jsxs("div",{className:"group flex h-8 items-center gap-1.5 px-3",children:[v,T,E,f]}),e[12]=v,e[13]=T,e[14]=E,e[15]=f,e[16]=D):D=e[16];let z;if(e[17]!==n||e[18]!==m||e[19]!==k||e[20]!==c||e[21]!==y||e[22]!==w||e[23]!==r||e[24]!==p||e[25]!==d||e[26]!==s){let B;e[28]!==m||e[29]!==k||e[30]!==c||e[31]!==y||e[32]!==w||e[33]!==r||e[34]!==p||e[35]!==d||e[36]!==s?(B=j=>{const U=s===j.path;if(d===j.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(ae,{value:p,onChange:$=>w($.target.value),onKeyDown:$=>{$.key==="Enter"&&y(),$.key==="Escape"&&k()},autoFocus:!0,className:"h-7 min-w-0 flex-1 text-xs"}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Save name",onClick:y,disabled:!p.trim(),children:t.jsx(K,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel rename",onClick:k,children:t.jsx(Q,{"data-icon":"inline-start"})})]},j.path);const M=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:j.name}),t.jsx(je,{linkTarget:j.linkTarget}),j.readOnly&&t.jsx(he,{className:"size-2.5 shrink-0 text-muted-foreground/40"})]}),j.description&&t.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:j.description})]}),t.jsx(pe,{cli:j.cli}),t.jsx(ge,{scope:j.scope,pluginName:j.pluginName})]}),P=F("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:P,onClick:()=>r(j),children:M},j.path):t.jsxs(De,{children:[t.jsx(Te,{render:t.jsx("button",{type:"button",className:P,onClick:()=>r(j)}),children:M}),t.jsx(Ee,{className:"min-w-36",children:j.readOnly?t.jsx(_,{children:t.jsx(Re,{children:"Read-only file"})}):t.jsxs(t.Fragment,{children:[t.jsx(_,{children:t.jsx(ee,{onClick:()=>c(j),children:"Rename"})}),t.jsx(Oe,{}),t.jsx(_,{children:t.jsx(ee,{variant:"destructive",onClick:()=>m(j),children:"Delete"})})]})})]},j.path)},e[28]=m,e[29]=k,e[30]=c,e[31]=y,e[32]=w,e[33]=r,e[34]=p,e[35]=d,e[36]=s,e[37]=B):B=e[37],z=n.map(B),e[17]=n,e[18]=m,e[19]=k,e[20]=c,e[21]=y,e[22]=w,e[23]=r,e[24]=p,e[25]=d,e[26]=s,e[27]=z}else z=e[27];let R;e[38]!==b||e[39]!==n.length?(R=n.length===0&&!b&&t.jsx("p",{className:"px-3 py-1 text-xs text-muted-foreground",children:"None configured"}),e[38]=b,e[39]=n.length,e[40]=R):R=e[40];let O;e[41]!==b||e[42]!==x||e[43]!==S?(O=b&&t.jsx(ut,{globalDir:b.globalDir,projectDir:b.projectDir,fileType:b.fileType,onCreated:S,onCancel:x}),e[41]=b,e[42]=x,e[43]=S,e[44]=O):O=e[44];let L;return e[45]!==D||e[46]!==z||e[47]!==R||e[48]!==O?(L=t.jsxs("section",{children:[D,z,R,O]}),e[45]=D,e[46]=z,e[47]=R,e[48]=O,e[49]=L):L=e[49],L}function xt({file:l,onDeleted:e,readOnly:i=!1}){const[n,s]=o.useState(null),[r,u]=o.useState(null),[m,c]=o.useState(!0),[d,p]=o.useState(!1),[w,y]=o.useState(!1),[k,b]=o.useState(!1),[S,x]=o.useState(!1),g=n!==null&&n!==r,C=i||l.readOnly;o.useEffect(()=>{c(!0),s(null),u(null),y(!1),b(!1),A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`).then(f=>f.json()).then(f=>{s(f.content??""),u(f.content??"")}).catch(()=>{s(""),u("")}).finally(()=>c(!1))},[l.path]);const N=o.useCallback(async()=>{if(!(!g||C)){p(!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),y(!0),setTimeout(()=>y(!1),2e3))}finally{p(!1)}}},[n,l.path,g,C]),v=o.useCallback(()=>{s(r)},[r]),T=o.useCallback(async()=>{if(!C){x(!0);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`,{method:"DELETE"})).ok&&(b(!1),e())}catch{}finally{x(!1)}}},[l.path,C,e]);o.useEffect(()=>{function f(D){!C&&(D.metaKey||D.ctrlKey)&&D.key==="s"&&(D.preventDefault(),N())}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[N,C]);function E(){return w?"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(te,{variant:"outline",className:F("h-5 text-xs",it[l.fileType]||"bg-muted text-muted-foreground"),children:l.fileType}),t.jsx(ge,{scope:l.scope,pluginName:l.pluginName}),t.jsx(pe,{cli:l.cli,variant:"full"}),C&&t.jsxs(te,{variant:"outline",className:"h-5 bg-muted text-xs text-muted-foreground",children:[t.jsx(he,{"data-icon":"inline-start",className:"size-3"})," read-only"]}),g&&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(je,{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(lt,{value:n??"",onChange:s,readOnly:C,filePath:l.path}),!C&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t bg-card px-4 py-2",children:[t.jsxs(I,{size:"xs",onClick:N,disabled:!g||d,children:[t.jsx(K,{"data-icon":"inline-start"}),E()]}),t.jsxs(I,{variant:"outline",size:"xs",onClick:v,disabled:!g,children:[t.jsx(et,{"data-icon":"inline-start"}),"Discard"]}),t.jsx("div",{className:"flex-1"}),t.jsxs(le,{open:k,onOpenChange:b,children:[t.jsxs(Ie,{render:t.jsx(I,{variant:"outline",size:"xs"}),children:[t.jsx(tt,{"data-icon":"inline-start"}),"Delete"]}),t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',l.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",disabled:S,children:"Cancel"}),t.jsxs(me,{variant:"destructive",size:"sm",disabled:S,onClick:()=>void T(),children:[S&&t.jsx(ze,{"data-icon":"inline-start"}),S?"Deleting...":"Delete file"]})]})]})]})]})]})]})}function ft(){const l=G.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ae,{className:"border-0",children:t.jsxs(Le,{children:[t.jsx(Be,{variant:"icon",children:t.jsx(nt,{})}),t.jsx($e,{children:"Select a configuration file"}),t.jsx(Fe,{children:"Browse instructions, agents, skills, commands, and settings from the sidebar."})]})}),l[0]=e):e=l[0],e}function ht(l){return l.cli?l.cli.length>0?l.cli.join(" "):"unlinked":""}function gt(l,e){if(!e)return l;const i=e.toLowerCase();return l.filter(n=>[n.name,n.description,n.path,n.linkTarget??"",ht(n)].some(r=>r.toLowerCase().includes(i)))}const kt=o.memo(function({projectPath:e,initialFilePath:i}){var J,W;const n=Ge("configWrite"),[s,r]=o.useState([]),[u,m]=o.useState(!0),[c,d]=o.useState(null),[p,w]=o.useState(!1),[y,k]=o.useState(null),[b,S]=o.useState(""),[x,g]=o.useState(null),[C,N]=o.useState(""),[v,T]=o.useState(null),E=o.useRef(!1),f=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",h=await A(a);if(h.ok){const V=await h.json();r(V.sections||[])}}finally{m(!1)}},[n,e]);o.useEffect(()=>{f()},[f]),o.useEffect(()=>{if(!i||u||E.current)return;const a=s.flatMap(h=>H(h.items,h.scope,h.pluginName)).find(h=>h.path===i);a&&(d(a),E.current=!0)},[i,u,s]);const D=ct(s),z=Object.fromEntries(se.map(a=>[a,gt(D[a],b)])),R=(J=s.find(a=>a.scope==="global"))==null?void 0:J.baseDir,O=(W=s.find(a=>a.scope==="project"))==null?void 0:W.baseDir,L=o.useCallback(a=>{d(a),w(!1),k(null)},[]),B=o.useCallback((a,h,V)=>{k(null),f(),d({path:a,name:a.split("/").pop()||"",fileType:h,readOnly:!1,scope:V,description:""})},[f]),j=o.useCallback(()=>{d(null),f()},[f]),U=o.useCallback(a=>{if(!n||!R&&!O)return;const h=rt[a];h&&k({category:a,globalDir:R?`${R}/${h.subdir}`:null,projectDir:O?`${O}/${h.subdir}`:null,fileType:h.fileType})},[n,R,O]),Y=o.useCallback(a=>{!n||a.readOnly||T(a)},[n]),M=o.useCallback(async()=>{if(!n||!v||v.readOnly)return;const a=v;T(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),f())}catch{}},[n,f,v,c]),P=o.useCallback(a=>{if(!n||a.readOnly)return;const h=a.name==="SKILL.md"?a.path.split("/").slice(-2,-1)[0]||a.name:a.name.replace(/\.[^.]+$/,"");g(a),N(h)},[n]),$=o.useCallback(async()=>{if(!(!n||!x||!C.trim()))try{const a=await A("/api/config-browser/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:x.path,newName:C.trim()})});if(a.ok){const h=await a.json();g(null),N(""),await f(),h.newPath&&d({...x,path:h.newPath,name:h.newPath.split("/").pop()||x.name})}}catch{}},[n,x,C,f]),be=o.useCallback(()=>{g(null),N("")},[]);return n?t.jsxs("div",{className:"flex flex-1 min-h-0 min-w-0",children:[t.jsxs("div",{className:F("min-h-0 shrink-0 flex-col border-r bg-sidebar md:flex md:w-80",c&&!p?"hidden":"flex w-full"),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(Me,{children:[t.jsx(ne,{children:t.jsx(st,{"data-icon":"inline-start"})}),t.jsx(Pe,{value:b,onChange:a=>S(a.target.value),placeholder:"Search configuration"}),b&&t.jsx(ne,{align:"inline-end",children:t.jsx(Ue,{size:"icon-xs","aria-label":"Clear search",onClick:()=>S(""),children:t.jsx(Q,{"data-icon":"inline-start"})})})]})}),t.jsx(Ve,{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,h)=>t.jsx(_e,{className:"h-8 w-full"},h))}):se.map(a=>{const h=a==="agents"||a==="skills"||a==="commands";return t.jsx(mt,{category:a,items:z[a],selectedPath:(c==null?void 0:c.path)??null,onSelect:L,onNewFile:n&&h?()=>U(a):void 0,onDeleteItem:n?Y:void 0,onRenameItem:n?P:void 0,renamingPath:(x==null?void 0:x.path)??null,renameValue:C,onRenameValueChange:N,onRenameSubmit:$,onRenameCancel:be,creatingInCategory:n&&(y==null?void 0:y.category)===a?y:null,onCreated:B,onCancelCreate:()=>k(null)},a)})})})]}),t.jsx("div",{className:F("min-h-0 min-w-0 flex-1 flex-col md:flex",c&&!p?"flex":"hidden"),children:c?t.jsxs(t.Fragment,{children:[t.jsxs(I,{variant:"ghost",className:"min-h-11 shrink-0 justify-start md:hidden",onClick:()=>w(!0),children:[t.jsx(at,{"data-icon":"inline-start"}),"All configuration files"]}),t.jsx(xt,{file:c,onDeleted:j,readOnly:!n})]}):t.jsx(ft,{})}),t.jsx(le,{open:v!==null,onOpenChange:a=>{a||T(null)},children:t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',v==null?void 0:v.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",children:"Cancel"}),t.jsx(me,{variant:"destructive",size:"sm",onClick:()=>void M(),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{kt as ConfigBrowser};
@@ -0,0 +1 @@
1
+ import{r as k,c as ue,j as n}from"./vendor-react-gGw_S5I_.js";import{F as _e,da as it,a0 as je,db as jt,dc as yt,dd as Nt,B as J,E as rt,f as ct,U as It,h as dt,i as ut,ae as Je,de as kt,ac as Qe,aC as et,df as Ct,dg as St,m as ft,ad as Mt,dh as $t,av as Rt,cB as Tt,di as At,c_ as Ot,aZ as Et,o as Lt,n as _t,D as zt,j as Dt,c as oe,dj as Ft,bP as Pt,bQ as Yt,bO as qt,dk as Ye,V as qe,dl as Wt,cz as Ht,c9 as Bt,ca as Ut,cb as Te,cc as Ae,al as Gt,k as Kt,dm as Vt,dn as Xt,dp as Zt,b8 as Jt}from"./index-Bg4A-xl7.js";import{S as Qt}from"./switch-DI9dp0Ya.js";import{bT as es,dy as ts,aP as ss,bq as ns,N as ht,bo as mt,bg as as,bt as os,bp as ls,A as ze,dz as is,aO as rs,X as cs}from"./vendor-ui-Dc_kJXxz.js";import"./vendor-markdown-BEJ8yVzA.js";async function ke(t){if(t.ok)return t;const e=await t.json().catch(()=>null);throw new Error((e==null?void 0:e.error)||"Couldn't update crew chat.")}function Oe(t,e){return[...new Map([...t,...e].map(s=>[s.sequence,s])).values()].sort((s,i)=>s.sequence-i.sequence)}function ds(t){const[e,s]=k.useState(null),[i,l]=k.useState([]),[o,c]=k.useState(null),[a,f]=k.useState(!1),[g,h]=k.useState(!1),[r,w]=k.useState(!1),[u,x]=k.useState(new Set),d=k.useRef(0),p=k.useRef(null),N=k.useRef(!1),C=k.useRef(!1),b=k.useRef(new Set),S=k.useRef(!1),y=k.useRef(null),M=k.useCallback(async v=>{const _=++d.current;try{const I=y.current,R=await(await ke(await _e(`/api/crew-chat/${encodeURIComponent(t)}${I===null?"":`?after=${I}&limit=100`}`))).json();if(!v()||_!==d.current)return;s(T=>T&&JSON.stringify(T.members)===JSON.stringify(R.members)?{...R,members:T.members}:R),l(T=>Oe(T,R.messages)),y.current=R.nextCursor,S.current||(S.current=!0,w(R.hasMore)),c(null)}catch(I){v()&&_===d.current&&c(I instanceof Error?I.message:"Couldn't load crew chat.")}},[t]);it(M,2e3);const L=k.useCallback(async v=>{var _;if(N.current)return!1;N.current=!0,f(!0),((_=p.current)==null?void 0:_.text)!==v&&(p.current={text:v,id:crypto.randomUUID()});try{const E=await(await ke(await je(`/api/crew-chat/${encodeURIComponent(t)}`,{text:v,commandId:p.current.id}))).json();return d.current++,l(R=>Oe(R,[E.message])),p.current=null,c(E.pending.length?"Message saved. Some members are unavailable; delivery will retry.":null),!0}catch(I){return c(I instanceof Error?I.message:"Couldn't send the message."),!1}finally{N.current=!1,f(!1)}},[t]),A=k.useCallback(async(v,_)=>{if(!b.current.has(v)){b.current.add(v),x(I=>new Set(I).add(v));try{await ke(await je(`/api/crew-chat/${encodeURIComponent(t)}`,{sessionId:v,listening:_},{method:"PATCH"})),d.current++,s(I=>I&&{...I,members:I.members.map(E=>E.sessionId===v?{...E,listening:_}:E)}),c(null)}catch(I){c(I instanceof Error?I.message:"Couldn't change listening.")}finally{b.current.delete(v),x(I=>{const E=new Set(I);return E.delete(v),E})}}},[t]),O=k.useCallback(async()=>{if(!(!i.length||C.current)){C.current=!0,h(!0);try{const _=await(await ke(await _e(`/api/crew-chat/${encodeURIComponent(t)}?before=${i[0].sequence}`))).json();l(I=>Oe(I,_.messages)),w(_.hasMore)}catch(v){c(v instanceof Error?v.message:"Couldn't load older messages.")}finally{C.current=!1,h(!1)}}},[i,t]);return{page:e,messages:i,error:o,posting:a,busyMembers:u,hasOlder:r,loadingOlder:g,post:L,setListening:A,older:O}}const us=[],fs=new Map;function hs(t){var He,Be,Ue,Ge,Ke,Ve,Xe;const e=ue.c(111),{rootId:s,kinds:i,active:l}=t,o=i===void 0?fs:i,c=l===void 0?!0:l,a=ds(s),[f,g]=k.useState(""),h=k.useRef(null),r=k.useRef(!0);let w;e[0]!==a.messages?(w=(He=a.messages.at(-1))==null?void 0:He.sequence,e[0]=a.messages,e[1]=w):w=e[1];const u=w,x=((Be=a.page)==null?void 0:Be.members)??us;let d;e[2]!==x?(d=jt(x),e[2]=x,e[3]=d):d=e[3];const p=d;let N;e[4]!==x||e[5]!==s?(N=yt(x,s),e[4]=x,e[5]=s,e[6]=N):N=e[6];const C=N;let b;e[7]!==x?(b=new Map(x.map(ps)),e[7]=x,e[8]=b):b=e[8];const S=b;let y;e[9]!==a.messages||e[10]!==s?(y=Nt(a.messages,s),e[9]=a.messages,e[10]=s,e[11]=y):y=e[11];const M=y;let L;e[12]!==c?(L=()=>{var U,H;c&&r.current&&((H=(U=h.current)==null?void 0:U.scrollIntoView)==null||H.call(U,{block:"end"}))},e[12]=c,e[13]=L):L=e[13];let A;e[14]!==c||e[15]!==u?(A=[c,u],e[14]=c,e[15]=u,e[16]=A):A=e[16],k.useEffect(L,A);let O;e[17]!==a||e[18]!==f?(O=async()=>{const U=f.trim();!U||a.posting||await a.post(U)&&(g(H=>H.trim()===U?"":H),r.current=!0)},e[17]=a,e[18]=f,e[19]=O):O=e[19];const v=O;let _;e[20]!==a.page||e[21]!==x?(_=a.page?`${x.filter(ms).length} listening · Members & mentions`:"Loading chat…",e[20]=a.page,e[21]=x,e[22]=_):_=e[22];let I;e[23]!==_?(I=n.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground",children:_}),e[23]=_,e[24]=I):I=e[24];let E;if(e[25]!==a||e[26]!==o||e[27]!==x||e[28]!==s||e[29]!==C){let U;e[31]!==a||e[32]!==o||e[33]!==s||e[34]!==C?(U=H=>{var Ze;return n.jsxs(Je,{orientation:"horizontal",className:"items-center gap-2",children:[n.jsx(kt,{role:H.sessionId===s?"lead":"agent",sessionId:H.sessionId,kinds:o,tints:C,className:"size-5"}),n.jsxs(Qe,{className:"min-w-0 flex-1 items-baseline gap-1.5",htmlFor:`listen-${H.sessionId}`,"aria-label":`Listen for ${H.name}`,children:[n.jsx("span",{className:"truncate",children:H.name}),n.jsxs("span",{className:"truncate text-xs font-normal text-muted-foreground",children:["@",H.handle]})]}),n.jsx(J,{variant:"ghost",size:"icon-xs",disabled:!((Ze=a.page)!=null&&Ze.canPost)||!H.canInteract,onClick:()=>g(ye=>`${ye}${ye&&!/\s$/.test(ye)?" ":""}@${H.handle} `),"aria-label":`Mention ${H.name}`,title:`Mention @${H.handle}`,className:"text-muted-foreground",children:n.jsx(ts,{"data-icon":"inline-start"})}),n.jsx(Qt,{id:`listen-${H.sessionId}`,size:"sm",checked:H.listening,disabled:!H.canInteract||a.busyMembers.has(H.sessionId),onCheckedChange:ye=>void a.setListening(H.sessionId,ye)})]},H.sessionId)},e[31]=a,e[32]=o,e[33]=s,e[34]=C,e[35]=U):U=e[35],E=x.map(U),e[25]=a,e[26]=o,e[27]=x,e[28]=s,e[29]=C,e[30]=E}else E=e[30];let R;e[36]!==E?(R=n.jsx(et,{className:"max-h-48 gap-2 overflow-y-auto py-2",children:E}),e[36]=E,e[37]=R):R=e[37];let T;e[38]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx("p",{className:"pb-1 text-xs text-muted-foreground",children:"Listening sends short notices while an agent works. @mentions send the full message, even when listening is off."}),e[38]=T):T=e[38];let z;e[39]!==I||e[40]!==R?(z=n.jsxs("details",{className:"shrink-0 border-b px-3 py-2",children:[I,R,T]}),e[39]=I,e[40]=R,e[41]=z):z=e[41];let D;e[42]===Symbol.for("react.memo_cache_sentinel")?(D=U=>{const H=U.target;r.current=H.scrollHeight-H.scrollTop-H.clientHeight<80},e[42]=D):D=e[42];let Y;e[43]!==a?(Y=a.hasOlder&&n.jsx("div",{className:"flex justify-center py-2",children:n.jsx(J,{variant:"ghost",size:"xs",disabled:a.loadingOlder,onClick:()=>void a.older(),children:a.loadingOlder?"Loading…":"Load earlier messages"})}),e[43]=a,e[44]=Y):Y=e[44];let F;e[45]!==a.messages.length||e[46]!==a.page?(F=a.page&&a.messages.length===0&&n.jsx(rt,{children:n.jsxs(ct,{children:[n.jsx(It,{variant:"icon",children:n.jsx(es,{})}),n.jsx(dt,{children:"Talk to the crew"}),n.jsx(ut,{children:"Share a discovery, ask a question, or tag someone for their input."})]})}),e[45]=a.messages.length,e[46]=a.page,e[47]=F):F=e[47];let q;if(e[48]!==S||e[49]!==p||e[50]!==o||e[51]!==s||e[52]!==M||e[53]!==C){let U;e[55]!==S||e[56]!==p||e[57]!==o||e[58]!==s||e[59]!==C?(U=H=>n.jsxs(k.Fragment,{children:[H.day!==void 0&&n.jsx(Ct,{day:H.day}),n.jsx(St,{run:H,members:S,handles:p,kinds:o,tints:C,rootId:s})]},H.messages[0].sequence),e[55]=S,e[56]=p,e[57]=o,e[58]=s,e[59]=C,e[60]=U):U=e[60],q=M.map(U),e[48]=S,e[49]=p,e[50]=o,e[51]=s,e[52]=M,e[53]=C,e[54]=q}else q=e[54];let P;e[61]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx("div",{ref:h}),e[61]=P):P=e[61];let W;e[62]!==q?(W=n.jsxs("div",{role:"log","aria-label":"Shared messages","aria-live":"polite","aria-relevant":"additions",className:"flex flex-col gap-4 px-3 py-3",children:[q,P]}),e[62]=q,e[63]=W):W=e[63];let B;e[64]!==Y||e[65]!==F||e[66]!==W?(B=n.jsxs(ft,{className:"min-h-0 flex-1",onScrollCapture:D,children:[Y,F,W]}),e[64]=Y,e[65]=F,e[66]=W,e[67]=B):B=e[67];let G;e[68]!==v?(G=U=>{U.preventDefault(),v()},e[68]=v,e[69]=G):G=e[69];const K=!!a.error,X=`crew-chat-${s}`;let m;e[70]!==X?(m=n.jsx(Qe,{htmlFor:X,className:"sr-only",children:"Message the crew"}),e[70]=X,e[71]=m):m=e[71];const j=`crew-chat-${s}`,$=!((Ue=a.page)!=null&&Ue.canPost),V=!!a.error;let ae;e[72]===Symbol.for("react.memo_cache_sentinel")?(ae=U=>g(U.target.value),e[72]=ae):ae=e[72];let Q;e[73]!==v?(Q=U=>{U.key==="Enter"&&(U.metaKey||U.ctrlKey)&&!U.nativeEvent.isComposing&&(U.preventDefault(),v())},e[73]=v,e[74]=Q):Q=e[74];let ee;e[75]!==f||e[76]!==j||e[77]!==$||e[78]!==V||e[79]!==Q?(ee=n.jsx(Mt,{id:j,value:f,rows:3,maxLength:$t,placeholder:"Message the crew… use @ to tag an agent",disabled:$,"aria-invalid":V,onChange:ae,onKeyDown:Q}),e[75]=f,e[76]=j,e[77]=$,e[78]=V,e[79]=Q,e[80]=ee):ee=e[80];let te;e[81]!==a.error?(te=a.error&&n.jsx("p",{role:"alert",className:"text-xs text-destructive",children:a.error}),e[81]=a.error,e[82]=te):te=e[82];let se;e[83]!==K||e[84]!==m||e[85]!==ee||e[86]!==te?(se=n.jsxs(Je,{"data-invalid":K,children:[m,ee,te]}),e[83]=K,e[84]=m,e[85]=ee,e[86]=te,e[87]=se):se=e[87];const re=((Ge=a.page)==null?void 0:Ge.canPost)===!1?"You have read access to this crew.":"⌘ / Ctrl + Enter to send";let Z;e[88]!==re?(Z=n.jsx(Rt,{className:"flex-1",children:re}),e[88]=re,e[89]=Z):Z=e[89];let ce;e[90]!==((Ke=a.page)==null?void 0:Ke.canPost)||e[91]!==a.posting||e[92]!==f?(ce=!((Ve=a.page)!=null&&Ve.canPost)||!f.trim()||a.posting,e[90]=(Xe=a.page)==null?void 0:Xe.canPost,e[91]=a.posting,e[92]=f,e[93]=ce):ce=e[93];let me;e[94]===Symbol.for("react.memo_cache_sentinel")?(me=n.jsx(ss,{"data-icon":"inline-start"}),e[94]=me):me=e[94];const Re=a.posting?"Sending…":"Send";let ge;e[95]!==ce||e[96]!==Re?(ge=n.jsxs(J,{type:"submit",size:"sm",disabled:ce,children:[me,Re]}),e[95]=ce,e[96]=Re,e[97]=ge):ge=e[97];let xe;e[98]!==Z||e[99]!==ge?(xe=n.jsxs("div",{className:"flex items-center gap-2",children:[Z,ge]}),e[98]=Z,e[99]=ge,e[100]=xe):xe=e[100];let we;e[101]!==se||e[102]!==xe?(we=n.jsxs(et,{className:"gap-2",children:[se,xe]}),e[101]=se,e[102]=xe,e[103]=we):we=e[103];let be;e[104]!==G||e[105]!==we?(be=n.jsx("form",{className:"shrink-0 border-t p-3",onSubmit:G,children:we}),e[104]=G,e[105]=we,e[106]=be):be=e[106];let Ie;return e[107]!==z||e[108]!==B||e[109]!==be?(Ie=n.jsxs("section",{"aria-label":"Crew chat",className:"flex h-full min-h-0 flex-col",children:[z,B,be]}),e[107]=z,e[108]=B,e[109]=be,e[110]=Ie):Ie=e[110],Ie}function ms(t){return t.listening}function ps(t){return[t.sessionId,t]}const fe={working:"bg-success ring-2 ring-success/30","needs-you":"bg-warning",done:"bg-muted-foreground/50",failed:"bg-destructive",unreachable:"border border-muted-foreground/60"};function pt(t){const e=new Date(t),s=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return e.toDateString()===new Date().toDateString()?s:`${e.toLocaleDateString([],{month:"short",day:"numeric"})}, ${s}`}function he(t){if(t.status==="deferred")return"needs-you";switch(t.outcome){case"needs_input":return"needs-you";case"running":return"working";case"error":return"failed";case"unreachable":case"not_found":return"unreachable";default:return"done"}}function tt(t,e){var s,i;return{sessionId:t.sessionId,dirName:((s=t.address)==null?void 0:s.dirName)??"",fileName:((i=t.address)==null?void 0:i.fileName)??"",projectShortName:"",lastModified:t.lastActivityAt??"",lastActivityAt:t.lastActivityAt,size:0,cwd:t.cwd,customTitle:t.customTitle,aiTitle:t.aiTitle,firstUserMessage:t.firstUserMessage,...t.parentId&&{crew:{rootId:e,parentId:t.parentId,startedAt:t.startedAt??0,...t.name&&{name:t.name}}}}}function gs(t,e,s){var a;const i=((a=[...e.values()].find(f=>f.parentId===null))==null?void 0:a.sessionId)??t.sessionId,l=s[t.sessionId],o=tt(t,i);if(!t.parentId)return Tt(o,l);const c=e.get(t.parentId);return At(o,{customName:l,parent:c&&tt(c,i)})}function xs(t){const e=new Map;for(const o of t.members){if(!o.parentId)continue;const c=e.get(o.parentId);c?c.push(o):e.set(o.parentId,[o])}const s=[],i=new Set,l=(o,c)=>{var f;const a=[...e.get(o)??[]].sort((g,h)=>(g.startedAt??0)-(h.startedAt??0));for(const g of a)i.has(g.sessionId)||(i.add(g.sessionId),s.push({member:g,depth:c,children:((f=e.get(g.sessionId))==null?void 0:f.length)??0}),l(g.sessionId,c+1))};l(t.rootId,0);for(const o of t.members)o.parentId&&!i.has(o.sessionId)&&(i.add(o.sessionId),s.push({member:o,depth:0,children:0}));return s}function ws(t){const e=({member:s,pending:i})=>i.askedAt??(Date.parse(s.lastActivityAt??"")||0);return t.members.flatMap(s=>s.waiting.map(i=>({member:s,pending:i}))).sort((s,i)=>e(s)-e(i))}function bs(t){const e={size:0,working:0,needsYou:0,done:0,failed:0,unreachable:0,unreadResults:0};for(const s of t.members){if(!s.parentId)continue;e.size++;const i=he(s);i==="working"?e.working++:i==="needs-you"?e.needsYou++:i==="failed"?e.failed++:i==="unreachable"?e.unreachable++:e.done++,$e(s)&&e.unreadResults++}return e}function $e(t){return!!(t.result&&t.result.state!=="running"&&!t.result.acknowledged)}function We(t){const[e]=t.waiting;switch(he(t)){case"needs-you":return(e==null?void 0:e.kind)==="permission"?`Waiting on a permission · ${e.toolName}`:(e==null?void 0:e.kind)==="question"?"Asked a question":!e&&t.status==="deferred"?"Awaiting permission review":"Plan to review";case"working":return t.status==="tool_use"&&t.toolName?t.toolName:t.status==="thinking"?"Thinking":t.status==="compacting"?"Compacting":t.status==="awaiting_agents"?"Waiting on its agents":"Working";case"failed":return t.error?`Failed · ${t.error}`:"Failed";case"unreachable":return t.device?`${t.device.name} is not answering`:"Not found";default:return $e(t)?"Finished · result unread":"Finished"}}const le=196,ne=86,de=40,ve=12,vs=28,Se=6,st=8,pe=10,js=6,Me=28,De=36;function gt(t){const e=he(t);return e==="working"||e==="needs-you"}function ys(t){const e={all:t.members.length,active:0,working:0,needsYou:0};for(const s of t.members){const i=he(s);i==="working"?e.working++:i==="needs-you"&&e.needsYou++}return e.active=e.working+e.needsYou,e}const nt=(t,e)=>(t.startedAt??0)-(e.startedAt??0)||t.sessionId.localeCompare(e.sessionId);function xt(t){const e=new Map(t.members.map(l=>[l.sessionId,l])),s=new Map,i=[];for(const l of t.members){const o=l.parentId&&l.sessionId!==t.rootId?e.get(l.parentId):void 0;if(!o){i.push(l);continue}const c=s.get(o.sessionId);c?c.push(l):s.set(o.sessionId,[l])}for(const l of s.values())l.sort(nt);return i.sort((l,o)=>+(o.sessionId===t.rootId)-+(l.sessionId===t.rootId)||nt(l,o)),{roots:i,childrenOf:s}}function Ns(t,e){if(e==="all")return new Set(t.members.map(l=>l.sessionId));const s=new Map(t.members.map(l=>[l.sessionId,l])),i=new Set;for(const l of t.members){if(!gt(l))continue;let o=l;for(;o&&!i.has(o.sessionId);)i.add(o.sessionId),o=o.sessionId===t.rootId||!o.parentId?void 0:s.get(o.parentId)}return i}function Is(t){const{roots:e,childrenOf:s}=xt(t),i=new Set;let l=0;const o=e.map(c=>({member:c,depth:0}));for(;o.length>0;){const{member:c,depth:a}=o.pop();if(!i.has(c.sessionId)){i.add(c.sessionId),l=Math.max(l,a);for(const f of s.get(c.sessionId)??[])o.push({member:f,depth:a+1})}}return l}function ks(t){return(t+1)*le+t*de}function Cs(t,e,s,{group:i=!1,stacked:l}={}){const{roots:o,childrenOf:c}=xt(t),a=Ns(t,e),f=y=>(c.get(y)??[]).filter(M=>a.has(M.sessionId)),g=(l==null?void 0:l.cardWidth)??le,h=[],r=[],w=[],u=new Set;let x=0,d=0;const p=y=>{const M={count:0,working:0,needsYou:0},L=new Set(u),A=[...f(y)];for(;A.length>0;){const O=A.pop();if(L.has(O.sessionId))continue;L.add(O.sessionId),M.count++;const v=he(O);v==="working"?M.working++:v==="needs-you"&&M.needsYou++,A.push(...f(O.sessionId))}return M},N=y=>f(y).filter(M=>!u.has(M.sessionId)),C=y=>N(y.sessionId).length===0||s.has(y.sessionId),b=(y,M,L)=>{u.add(y.sessionId);const A=N(y.sessionId),O=A.length>0&&s.has(y.sessionId),v=O?[]:A,_=i&&!l&&v.length>=st?v.filter(C):[],I=_.length>=st?_:[],E=new Set(I),R=v.filter(D=>!E.has(D)),T={member:y,depth:M,x:(L==null?void 0:L.x)??M*(l?Me:le+de),y:(L==null?void 0:L.y)??x+(R.length===0&&I.length>0?pe:0),childCount:A.length,collapsed:O,hidden:O?p(y.sessionId):{count:0,working:0,needsYou:0},context:e==="active"&&!gt(y),grouped:!!L};if(h.push(T),d=Math.max(d,T.x+g+(l&&A.length>0?De:0)),l){x+=ne+ve;const D=v.map(Y=>b(Y,M+1));return D.length>0&&r.push({parentId:y.sessionId,path:Ms(T.x,T.y,D)}),T.y}if(O){const D=T.y+ne/2;r.push({parentId:y.sessionId,path:`M${T.x+le} ${D}H${T.x+le+de/2}`})}if(L)return T.y;if(v.length===0)return x+=ne+ve,T.y;const z=R.map(D=>b(D,M+1));return I.length>0&&z.push(S(y.sessionId,I,M+1)+pe),r.push({parentId:y.sessionId,path:Ss(T.x+le,T.y,z)}),T.y},S=(y,M,L)=>{const A=Math.min(js,Math.max(2,Math.ceil(Math.sqrt(M.length/1.5)))),O=Math.ceil(M.length/A),v={parentId:y,x:L*(le+de),y:x,width:A*le+(A-1)*de+2*pe,height:O*ne+(O-1)*ve+2*pe};return w.push(v),M.forEach((_,I)=>b(_,L,{x:v.x+pe+I%A*(le+de),y:v.y+pe+Math.floor(I/A)*(ne+ve)})),d=Math.max(d,v.x+v.width),x+=v.height+ve,v.y};for(const y of o)!a.has(y.sessionId)||u.has(y.sessionId)||(h.length>0&&(x+=vs),b(y,0));return{orientation:l?"stacked":"across",cardWidth:g,nodes:h,edges:r,groups:w,width:d,height:Math.max(0,x-ve)}}function Ss(t,e,s){const i=e+ne/2,l=[`M${t} ${i}H${t+de}`];for(const o of s)o!==e&&l.push(wt(t,i,o+ne/2));return l.join("")}function wt(t,e,s){const i=t+de/2;return`M${i} ${e}V${s-Se}Q${i} ${s} ${i+Se} ${s}H${t+de}`}function Ms(t,e,s){return s.map(i=>bt(t,e,i)).join("")}function bt(t,e,s){const i=t+Me/2,l=s+ne/2;return`M${i} ${e+ne}V${l-Se}Q${i} ${l} ${i+Se} ${l}H${t+Me}`}function $s(t,e){const s=new Map(t.nodes.map(c=>[c.member.sessionId,c])),i=new Map(t.groups.map(c=>[c.parentId,c]));let l=e?s.get(e):void 0;const o=[];for(;l!=null&&l.member.parentId;){const c=l.member.parentId,a=s.get(c);if(!a||a.depth!==l.depth-1)break;if(t.orientation==="stacked"){o.unshift(bt(a.x,a.y,l.y)),l=a;continue}const f=a.x+le,g=a.y+ne/2,h=l.grouped?i.get(c):void 0,r=(h?h.y+pe:l.y)+ne/2;o.unshift(r===g?`M${f} ${g}H${f+de}`:`M${f} ${g}H${f+de/2}${wt(f,g,r)}`),l=a}return o.length>0?o.join(""):null}const ie=14,Fe=.25,at=1.5,Rs=.7,Ce=1.2,Ts=56,As=900,Os=.85,Es=320,Ee={all:new Set,active:new Set};function Ls(t){const[e,s]=Ot(Et("crew-map-filter"),"all"),i=e==="active"?"active":"all",[l,o]=k.useState({rootId:t,folds:Ee}),c=k.useRef(new Map),a=l.rootId===t?l.folds:Ee,f=k.useCallback(h=>o(r=>{const w=r.rootId===t?r.folds:Ee,u=new Set(w[i]);return u.delete(h)||u.add(h),{rootId:t,folds:{...w,[i]:u}}}),[i,t]),g=k.useMemo(()=>({get current(){return c.current.get(t)??null},set current(h){c.current.set(t,h)}}),[t]);return{filter:i,setFilter:s,collapsed:a[i],toggle:f,viewport:g}}function _s(t){const e=ue.c(86),{crew:s,hereId:i,controls:l,kinds:o,nameOf:c,onOpen:a}=t,[f,g]=k.useState(!1),{filter:h,collapsed:r,toggle:w}=l;let u,x,d,p,N,C,b,S,y,M,L,A,O,v,_,I;if(e[0]!==r||e[1]!==l||e[2]!==s||e[3]!==f||e[4]!==h||e[5]!==i||e[6]!==o||e[7]!==c||e[8]!==a||e[9]!==w){let W;e[26]!==s.rootId?(W=j=>j.sessionId===s.rootId,e[26]=s.rootId,e[27]=W):W=e[27];const B=s.members.find(W);let G;e[28]!==r||e[29]!==l||e[30]!==s||e[31]!==h||e[32]!==i||e[33]!==o||e[34]!==c||e[35]!==w?(G=(j,$)=>n.jsx(Ps,{crew:s,collapsed:r,groups:!j,filter:h,hereId:i,kinds:o,nameOf:c,memory:j,onOpen:$,onToggle:w,onShowAll:()=>l.setFilter("all")}),e[28]=r,e[29]=l,e[30]=s,e[31]=h,e[32]=i,e[33]=o,e[34]=c,e[35]=w,e[36]=G):G=e[36],d=G,C="flex h-full min-h-0 flex-col";let K;e[37]!==l||e[38]!==s?(K=n.jsx(ot,{crew:s,controls:l}),e[37]=l,e[38]=s,e[39]=K):K=e[39];let X;e[40]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx("span",{className:"flex-1"}),e[40]=X):X=e[40];let m;e[41]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(J,{variant:"ghost",size:"icon-xs","aria-label":"Expand the map",title:"Expand the map",onClick:()=>g(!0),children:n.jsx(ns,{"data-icon":"inline-start"})}),e[41]=m):m=e[41],e[42]!==K?(b=n.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-3 pb-2",children:[K,X,m]}),e[42]=K,e[43]=b):b=e[43],e[44]!==d||e[45]!==l.viewport||e[46]!==a?(S=d(l.viewport,a),e[44]=d,e[45]=l.viewport,e[46]=a,e[47]=S):S=e[47],x=Lt,I=f,N=g,u=_t,A=!0,O="flex h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] max-w-none flex-col gap-0 overflow-hidden p-0 sm:h-[calc(100dvh-4rem)] sm:w-[calc(100vw-4rem)] sm:max-w-none",e[48]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(zt,{className:"sr-only",children:"Crew map"}),_=n.jsx(Dt,{className:"sr-only",children:"Every session in this crew, from the one that started it."}),e[48]=v,e[49]=_):(v=e[48],_=e[49]),M="flex h-12 shrink-0 items-center gap-3 pl-4 pr-14",e[50]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(ht,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"}),e[50]=L):L=e[50],p="min-w-0 truncate text-sm font-medium",y=B?c(B):"Crew",e[0]=r,e[1]=l,e[2]=s,e[3]=f,e[4]=h,e[5]=i,e[6]=o,e[7]=c,e[8]=a,e[9]=w,e[10]=u,e[11]=x,e[12]=d,e[13]=p,e[14]=N,e[15]=C,e[16]=b,e[17]=S,e[18]=y,e[19]=M,e[20]=L,e[21]=A,e[22]=O,e[23]=v,e[24]=_,e[25]=I}else u=e[10],x=e[11],d=e[12],p=e[13],N=e[14],C=e[15],b=e[16],S=e[17],y=e[18],M=e[19],L=e[20],A=e[21],O=e[22],v=e[23],_=e[24],I=e[25];let E;e[51]!==p||e[52]!==y?(E=n.jsx("span",{className:p,children:y}),e[51]=p,e[52]=y,e[53]=E):E=e[53];let R;e[54]===Symbol.for("react.memo_cache_sentinel")?(R=n.jsx("span",{className:"flex-1"}),e[54]=R):R=e[54];let T;e[55]!==l||e[56]!==s?(T=n.jsx(ot,{crew:s,controls:l}),e[55]=l,e[56]=s,e[57]=T):T=e[57];let z;e[58]!==E||e[59]!==T||e[60]!==M||e[61]!==L?(z=n.jsxs("header",{className:M,children:[L,E,R,T]}),e[58]=E,e[59]=T,e[60]=M,e[61]=L,e[62]=z):z=e[62];let D;e[63]!==a?(D=W=>{g(!1),a(W)},e[63]=a,e[64]=D):D=e[64];let Y;e[65]!==d||e[66]!==D?(Y=d(null,D),e[65]=d,e[66]=D,e[67]=Y):Y=e[67];let F;e[68]!==u||e[69]!==z||e[70]!==Y||e[71]!==A||e[72]!==O||e[73]!==v||e[74]!==_?(F=n.jsxs(u,{showCloseButton:A,className:O,children:[v,_,z,Y]}),e[68]=u,e[69]=z,e[70]=Y,e[71]=A,e[72]=O,e[73]=v,e[74]=_,e[75]=F):F=e[75];let q;e[76]!==x||e[77]!==N||e[78]!==F||e[79]!==I?(q=n.jsx(x,{open:I,onOpenChange:N,children:F}),e[76]=x,e[77]=N,e[78]=F,e[79]=I,e[80]=q):q=e[80];let P;return e[81]!==C||e[82]!==b||e[83]!==S||e[84]!==q?(P=n.jsxs("div",{className:C,children:[b,S,q]}),e[81]=C,e[82]=b,e[83]=S,e[84]=q,e[85]=P):P=e[85],P}function ot(t){const e=ue.c(3),{crew:s,controls:i}=t;let l;if(e[0]!==i||e[1]!==s){const o=ys(s),c=[{id:"all",label:"All",count:o.all,hint:"Every session in the crew"},{id:"active",label:"Active",count:o.active,hint:"Sessions working or waiting on you, and the sessions that started them"}];l=n.jsx("div",{role:"radiogroup","aria-label":"Show on the map",className:"flex shrink-0 gap-0.5 rounded-full border bg-background p-0.5",children:c.map(a=>{const{id:f,label:g,count:h,hint:r}=a;return n.jsxs("button",{type:"button",role:"radio","aria-checked":i.filter===f,"aria-label":`${g}, ${vt(h)}`,title:r,onClick:()=>i.setFilter(f),className:oe("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",i.filter===f&&"bg-accent text-foreground"),children:[g,n.jsx("span",{className:"tabular-nums text-muted-foreground",children:h})]},f)})}),e[0]=i,e[1]=s,e[2]=l}else l=e[2];return l}function vt(t){return`${t} ${t===1?"session":"sessions"}`}function Le(t,e,s){return t.orientation==="stacked"?{scale:e,left:ie,top:ie}:{scale:e,left:Math.max(ie,(s.width-t.width*e)/2),top:Math.max(ie,Math.min((s.height-t.height*e)/2,s.height*.12))}}function zs(t,e,s){return{width:Math.max(s.width,e.left+t.width*e.scale+ie),height:Math.max(s.height,e.top+t.height*e.scale+Ts)}}function lt(t,e,{widthOnly:s=!1}={}){if(t.width===0||e.width===0)return 1;const i=(e.width-2*ie)/t.width,l=s?i:Math.min(i,(e.height-2*ie)/t.height);return Pe(l,Fe,1)}const Pe=(t,e,s)=>Math.min(s,Math.max(e,t));function Ds(t,e,s,i,l){var w;const o=new Map(e.layout.nodes.map(u=>[u.member.sessionId,u])),c=new Map(s.nodes.map(u=>[u.member.sessionId,u]));if(e.frame===i&&o.size===c.size&&s.nodes.every(u=>{const x=o.get(u.member.sessionId);return x!==void 0&&x.x===u.x&&x.y===u.y}))return null;const f=u=>({x:e.frame.left+u.x*e.frame.scale-t.left,y:e.frame.top+u.y*e.frame.scale-t.top}),g=l&&o.has(l)&&c.has(l)?l:(w=e.layout.nodes.filter(u=>c.has(u.member.sessionId)).map(u=>({node:u,screen:f(u)})).filter(({screen:u})=>u.y+ne*e.frame.scale>0&&u.x+e.layout.cardWidth*e.frame.scale>0).sort((u,x)=>u.screen.y-x.screen.y||u.screen.x-x.screen.x)[0])==null?void 0:w.node.member.sessionId;if(!g)return null;const h=f(o.get(g)),r=c.get(g);return{left:i.left+r.x*i.scale-h.x,top:i.top+r.y*i.scale-h.y}}function Fs(t,e,s,i){const l=new Map(t.nodes.map(x=>[x.member.sessionId,x])),o=e?l.get(e):void 0;if(!o)return{left:0,top:0};const{scale:c}=s,a=s.left+o.x*c,f=s.top+o.y*c,g=a+t.cardWidth*c,h=f+ne*c;if(g<=i.clientWidth&&h<=i.clientHeight)return{left:0,top:0};const r=o.member.parentId&&l.get(o.member.parentId)||o;let w=s.left+Math.min(r.x,o.x)*c-ie,u=s.top+Math.min(r.y,o.y)*c-ie;return g-w>i.clientWidth&&(w=a-ie),h-u>i.clientHeight&&(u=f-i.clientHeight/3),{left:Math.max(0,w),top:Math.max(0,u)}}function Ps({crew:t,collapsed:e,groups:s,filter:i,hereId:l,kinds:o,nameOf:c,memory:a,onOpen:f,onToggle:g,onShowAll:h}){const r=k.useRef(null),[w,u]=k.useState({width:0,height:0}),x=s&&w.width>=As,d=k.useMemo(()=>Is(t),[t]),p=w.width-2*ie,N=!s&&w.width>0&&ks(d)*Os>p,C=N?Pe(p-d*Me-De,le,Es):le,b=k.useMemo(()=>Cs(t,i,e,{group:x,...N&&{stacked:{cardWidth:C}}}),[t,i,e,x,N,C]),[S,y]=k.useState(()=>{var m;return((m=a==null?void 0:a.current)==null?void 0:m.frame)??{scale:1,left:ie,top:ie}}),[M,L]=k.useState(!1),A=k.useRef(null),O=k.useRef(null),v=k.useRef({left:0,top:0}),_=k.useRef(null),I=k.useRef(null),E=zs(b,S,w),{scale:R}=S;k.useLayoutEffect(()=>{const m=r.current;if(!m)return;const j=()=>u(V=>V.width===m.clientWidth&&V.height===m.clientHeight?V:{width:m.clientWidth,height:m.clientHeight});j();const $=new ResizeObserver(j);return $.observe(m),()=>$.disconnect()},[]);const T=k.useCallback(m=>{const j=r.current;a&&j&&(a.current={frame:m,left:j.scrollLeft,top:j.scrollTop})},[a]),z=k.useCallback((m,j)=>{A.current={frame:m,scroll:j},y(m)},[]),D=k.useCallback(m=>{const j=Le(m,Math.max(lt(m,w,{widthOnly:!0}),Rs),w);z(j,()=>{const $=r.current;return $?Fs(m,l,j,$):{left:0,top:0}})},[z,l,w]);k.useLayoutEffect(()=>{const m=r.current;if(w.width===0||!m)return;const j=_.current;if(j){if(j.filter!==i||j.layout.orientation!==b.orientation)D(b);else if(j.layout!==b){const $=Ds(v.current,j,b,S,O.current);$&&(m.scrollLeft=$.left,m.scrollTop=$.top,v.current={left:m.scrollLeft,top:m.scrollTop})}}else{const $=a==null?void 0:a.current;$?z($.frame,()=>({left:$.left,top:$.top})):D(b)}O.current=null,_.current={layout:b,filter:i,frame:S}}),k.useLayoutEffect(()=>{const m=A.current,j=r.current;if(!m||!j||m.frame!==S)return;A.current=null;const{left:$,top:V}=m.scroll();j.scrollLeft=$,j.scrollTop=V,v.current={left:j.scrollLeft,top:j.scrollTop},T(S)});const Y=k.useRef(l);k.useEffect(()=>{var m,j;Y.current!==l&&(Y.current=l,l&&((j=(m=r.current)==null?void 0:m.querySelector(`[data-crew-map-card="${CSS.escape(l)}"]`))==null||j.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})))},[l]);const F=k.useCallback((m,j)=>{var ce;const $=r.current,V=((ce=A.current)==null?void 0:ce.frame.scale)??R,ae=Pe(V*m,Fe,at);if(!$||ae===V)return;const Q=$.getBoundingClientRect(),ee=j?j.clientX-Q.left:$.clientWidth/2,te=j?j.clientY-Q.top:$.clientHeight/2,se=($.scrollLeft+ee-S.left)/R,re=($.scrollTop+te-S.top)/R,Z=Le(b,ae,w);z(Z,()=>({left:Z.left+se*Z.scale-ee,top:Z.top+re*Z.scale-te}))},[z,S.left,S.top,b,R,w]),q=k.useRef(F);k.useLayoutEffect(()=>{q.current=F}),k.useEffect(()=>{const m=r.current;if(!m)return;const j=$=>{!$.ctrlKey&&!$.metaKey||($.preventDefault(),q.current(Math.exp(-$.deltaY*.01),$))};return m.addEventListener("wheel",j,{passive:!1}),()=>m.removeEventListener("wheel",j)},[]);const P=m=>{const j=r.current;!j||m.pointerType!=="mouse"||m.button!==0||m.target.closest("button")||(I.current={pointerId:m.pointerId,x:m.clientX,y:m.clientY,left:j.scrollLeft,top:j.scrollTop},j.setPointerCapture(m.pointerId),L(!0))},W=m=>{const j=I.current,$=r.current;!j||!$||j.pointerId!==m.pointerId||($.scrollLeft=j.left-(m.clientX-j.x),$.scrollTop=j.top-(m.clientY-j.y))},B=m=>{var j,$;((j=I.current)==null?void 0:j.pointerId)===m.pointerId&&(I.current=null,($=r.current)==null||$.releasePointerCapture(m.pointerId),L(!1))},G=k.useMemo(()=>$s(b,l),[b,l]),K=b.nodes.length===0,X=b.orientation==="stacked"?b.cardWidth+De/2:le+de/2;return n.jsxs("div",{className:"relative min-h-0 flex-1 border-t",children:[n.jsx("div",{ref:r,role:"region","aria-label":"Crew map","data-crew-map-layout":b.orientation,onScroll:m=>{v.current={left:m.currentTarget.scrollLeft,top:m.currentTarget.scrollTop},A.current||T(S)},onPointerDown:P,onPointerMove:W,onPointerUp:B,onPointerCancel:B,onKeyDown:m=>{m.target===m.currentTarget&&(m.key==="+"||m.key==="="?F(Ce):m.key==="-"&&F(1/Ce))},tabIndex:-1,className:oe("absolute inset-0 overflow-auto overscroll-contain outline-none [touch-action:pan-x_pan-y]","bg-muted/30 bg-local bg-[radial-gradient(circle,var(--border)_1px,transparent_1px)] bg-size-[18px_18px]",M?"cursor-grabbing select-none":"cursor-grab"),children:K?n.jsxs(rt,{className:"h-full",children:[n.jsxs(ct,{children:[n.jsx(dt,{children:"Nothing is active"}),n.jsx(ut,{className:"text-xs",children:"No session in this crew is working or waiting on you."})]}),n.jsx(J,{variant:"outline",size:"xs",onClick:h,children:"Show all sessions"})]}):n.jsx("div",{className:"relative",style:{width:E.width,height:E.height},children:n.jsxs("div",{className:"absolute origin-top-left",style:{left:S.left,top:S.top,width:b.width,height:b.height,transform:`scale(${R})`},children:[b.groups.map(m=>n.jsx("div",{"aria-hidden":"true",className:"absolute rounded-xl border border-dashed border-muted-foreground/25 bg-muted/25",style:{left:m.x,top:m.y,width:m.width,height:m.height}},m.parentId)),n.jsxs("svg",{"aria-hidden":"true",width:b.width,height:b.height,className:"pointer-events-none absolute inset-0 overflow-visible",fill:"none",children:[b.edges.map(m=>n.jsx("path",{d:m.path,className:"stroke-muted-foreground/35",strokeWidth:1.25},m.parentId)),G&&n.jsx("path",{d:G,className:"stroke-foreground/55",strokeWidth:1.5})]}),n.jsx("ul",{"aria-label":"Sessions",className:"absolute inset-0",children:b.nodes.map(m=>n.jsx(Hs,{node:m,width:b.cardWidth,toggleLeft:X,here:m.member.sessionId===l,kind:o.get(m.member.sessionId),name:c(m.member),onOpen:f,onToggle:j=>{O.current=j,g(j)}},m.member.sessionId))})]})})}),!K&&n.jsxs("div",{className:"absolute bottom-2.5 right-2.5 flex items-center gap-0.5 rounded-lg border bg-popover p-0.5 shadow-sm",children:[n.jsx(J,{variant:"ghost",size:"icon-xs","aria-label":"Zoom out",title:"Zoom out",disabled:R<=Fe,onClick:()=>F(1/Ce),children:n.jsx(mt,{"data-icon":"inline-start"})}),n.jsxs(J,{variant:"ghost",size:"xs","aria-label":"Actual size",title:"Actual size",className:"min-w-11 px-1 tabular-nums text-muted-foreground",onClick:()=>F(1/R),children:[Math.round(R*100),"%"]}),n.jsx(J,{variant:"ghost",size:"icon-xs","aria-label":"Zoom in",title:"Zoom in",disabled:R>=at,onClick:()=>F(Ce),children:n.jsx(as,{"data-icon":"inline-start"})}),n.jsx("span",{className:"mx-0.5 h-4 w-px bg-border","aria-hidden":"true"}),n.jsx(J,{variant:"ghost",size:"xs",title:"Fit the whole crew on screen",className:"px-1.5 text-muted-foreground",onClick:()=>z(Le(b,lt(b,w),w),()=>({left:0,top:0})),children:"Fit"})]})]})}const Ys={"needs-you":"border-warning/60 bg-[color-mix(in_oklch,var(--warning)_7%,var(--card))]",failed:"border-destructive/45",unreachable:"border-dashed"},qs={"needs-you":"text-warning",failed:"text-destructive"};function Ws(t){var s,i;const e=(s=t.pullRequests)==null?void 0:s.at(-1);return[t.model&&Ye(t.model),(i=t.device)==null?void 0:i.name,e&&`#${e.number}`,t.lastActivityAt&&qe(t.lastActivityAt)].filter(Boolean).join(" · ")}function Hs(t){const e=ue.c(75),{node:s,width:i,toggleLeft:l,here:o,kind:c,name:a,onOpen:f,onToggle:g}=t,{member:h}=s;let r;e[0]!==h?(r=he(h),e[0]=h,e[1]=r):r=e[1];const w=r;let u;e[2]!==h?(u=We(h),e[2]=h,e[3]=u):u=e[3];const x=u;let d;e[4]!==c?(d=c?Ft(c):os,e[4]=c,e[5]=d):d=e[5];const p=d;let N;e[6]!==h?(N=Ws(h),e[6]=h,e[7]=N):N=e[7];const C=N,b=s.context&&"shown because a session it started is active";let S;e[8]!==x||e[9]!==a||e[10]!==b?(S=[a,x,b].filter(Boolean),e[8]=x,e[9]=a,e[10]=b,e[11]=S):S=e[11];const y=S.join(", ");let M;e[12]!==s.x||e[13]!==s.y||e[14]!==i?(M={left:s.x,top:s.y,width:i,height:ne},e[12]=s.x,e[13]=s.y,e[14]=i,e[15]=M):M=e[15];const L=h.sessionId,A=o?"true":void 0;let O;e[16]!==h||e[17]!==f?(O=()=>f(h),e[16]=h,e[17]=f,e[18]=O):O=e[18];const v=Ys[w],_=o&&"outline-solid outline-[1.5px] outline-offset-2 outline-foreground/70",I=s.context&&"opacity-60 hover:opacity-100 focus-visible:opacity-100";let E;e[19]!==v||e[20]!==_||e[21]!==I?(E=oe("flex size-full cursor-pointer flex-col justify-center gap-1 rounded-lg border bg-card px-2.5 py-2 text-left shadow-xs outline-none","transition-[border-color,opacity,box-shadow] hover:border-foreground/25 hover:shadow-sm focus-visible:ring-2 focus-visible:ring-ring",v,_,I),e[19]=v,e[20]=_,e[21]=I,e[22]=E):E=e[22];let R;e[23]!==y||e[24]!==h.sessionId||e[25]!==w||e[26]!==O||e[27]!==E||e[28]!==A?(R=n.jsx("button",{type:"button","data-crew-map-card":L,"data-crew-map-state":w,"aria-current":A,"aria-label":y,onClick:O,className:E}),e[23]=y,e[24]=h.sessionId,e[25]=w,e[26]=O,e[27]=E,e[28]=A,e[29]=R):R=e[29];let T;e[30]!==p?(T=n.jsx(p,{"aria-hidden":"true",className:"mt-[3px] size-3.5 shrink-0 text-muted-foreground"}),e[30]=p,e[31]=T):T=e[31];let z;e[32]!==a?(z=n.jsx("span",{className:"line-clamp-2 min-w-0 flex-1 text-[13px]/[18px] font-medium",children:a}),e[32]=a,e[33]=z):z=e[33];let D;e[34]!==T||e[35]!==z?(D=n.jsxs("span",{className:"flex min-w-0 items-start gap-1.5",children:[T,z]}),e[34]=T,e[35]=z,e[36]=D):D=e[36];const Y=fe[w];let F;e[37]!==Y?(F=oe("size-1.5 shrink-0 rounded-full",Y),e[37]=Y,e[38]=F):F=e[38];let q;e[39]!==F?(q=n.jsx("span",{className:F,"aria-hidden":"true"}),e[39]=F,e[40]=q):q=e[40];let P;e[41]!==h||e[42]!==w?(P=$e(h)?"text-warning":qs[w],e[41]=h,e[42]=w,e[43]=P):P=e[43];let W;e[44]!==P?(W=oe("min-w-0 truncate text-muted-foreground",P),e[44]=P,e[45]=W):W=e[45];let B;e[46]!==x||e[47]!==W?(B=n.jsx("span",{className:W,children:x}),e[46]=x,e[47]=W,e[48]=B):B=e[48];let G;e[49]!==q||e[50]!==B?(G=n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-xs",children:[q,B]}),e[49]=q,e[50]=B,e[51]=G):G=e[51];let K;e[52]!==o||e[53]!==C?(K=(C||o)&&n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[11.5px] tabular-nums text-muted-foreground/75",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:C}),o&&n.jsx("span",{className:"shrink-0 font-medium text-foreground/70",children:"You are here"})]}),e[52]=o,e[53]=C,e[54]=K):K=e[54];let X;e[55]!==R||e[56]!==D||e[57]!==G||e[58]!==K?(X=n.jsxs(Pt,{delay:700,render:R,children:[D,G,K]}),e[55]=R,e[56]=D,e[57]=G,e[58]=K,e[59]=X):X=e[59];let m;e[60]!==h||e[61]!==a?(m=n.jsx(Yt,{side:"left",align:"start",className:"max-w-72",children:n.jsx(Us,{member:h,name:a})}),e[60]=h,e[61]=a,e[62]=m):m=e[62];let j;e[63]!==X||e[64]!==m?(j=n.jsxs(qt,{children:[X,m]}),e[63]=X,e[64]=m,e[65]=j):j=e[65];let $;e[66]!==a||e[67]!==s||e[68]!==g||e[69]!==l?($=s.childCount>0&&n.jsx(Bs,{node:s,name:a,left:l,onToggle:g}),e[66]=a,e[67]=s,e[68]=g,e[69]=l,e[70]=$):$=e[70];let V;return e[71]!==j||e[72]!==$||e[73]!==M?(V=n.jsxs("li",{className:"group/node absolute",style:M,children:[j,$]}),e[71]=j,e[72]=$,e[73]=M,e[74]=V):V=e[74],V}function Bs(t){const e=ue.c(25),{node:s,name:i,left:l,onToggle:o}=t,{collapsed:c,hidden:a}=s;let f=null;a.needsYou>0?f="needs-you":a.working>0&&(f="working");let g;e[0]!==c||e[1]!==a.count||e[2]!==a.needsYou||e[3]!==a.working||e[4]!==i?(g=c?[`Show the ${vt(a.count)} under ${i}`,a.needsYou>0&&`${a.needsYou} waiting on you`,a.working>0&&`${a.working} working`].filter(Boolean).join(", "):`Fold the sessions under ${i}`,e[0]=c,e[1]=a.count,e[2]=a.needsYou,e[3]=a.working,e[4]=i,e[5]=g):g=e[5];const h=g,r=!c,w=c?void 0:"Fold";let u;e[6]!==s.member.sessionId||e[7]!==o?(u=()=>o(s.member.sessionId),e[6]=s.member.sessionId,e[7]=o,e[8]=u):u=e[8];const x=!c&&"opacity-0 group-hover/node:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100";let d;e[9]!==x?(d=oe("absolute z-10 flex h-5 min-w-5 -translate-x-1/2 -translate-y-1/2 cursor-pointer items-center justify-center gap-1 rounded-full border bg-card px-1.5 text-[11px] font-medium tabular-nums text-muted-foreground shadow-xs outline-none","transition-opacity hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",x),e[9]=x,e[10]=d):d=e[10];let p;e[11]!==l?(p={left:l,top:ne/2},e[11]=l,e[12]=p):p=e[12];let N;e[13]!==f||e[14]!==c||e[15]!==a.count?(N=c?n.jsxs(n.Fragment,{children:[f&&n.jsx("span",{className:oe("size-1.5 rounded-full",fe[f]),"aria-hidden":"true"}),"+",a.count]}):n.jsx(mt,{"aria-hidden":"true",className:"size-3"}),e[13]=f,e[14]=c,e[15]=a.count,e[16]=N):N=e[16];let C;return e[17]!==h||e[18]!==r||e[19]!==w||e[20]!==u||e[21]!==d||e[22]!==p||e[23]!==N?(C=n.jsx("button",{type:"button","aria-expanded":r,"aria-label":h,title:w,onClick:u,className:d,style:p,children:N}),e[17]=h,e[18]=r,e[19]=w,e[20]=u,e[21]=d,e[22]=p,e[23]=N,e[24]=C):C=e[24],C}function Us(t){var u,x;const e=ue.c(35),{member:s,name:i}=t;let l;e[0]!==s.firstUserMessage?(l=(u=s.firstUserMessage)==null?void 0:u.replace(/\s+/g," ").trim(),e[0]=s.firstUserMessage,e[1]=l):l=e[1];const o=l;let c;e[2]!==s.cwd?(c=(x=s.cwd)==null?void 0:x.split(/[\\/]/).filter(Boolean).at(-1),e[2]=s.cwd,e[3]=c):c=e[3];const a=c;let f;if(e[4]!==a||e[5]!==s.device||e[6]!==s.model||e[7]!==s.startedAt||e[8]!==s.turnCount){if(f=[],s.model){let d;e[10]!==s.model?(d=Ye(s.model),e[10]=s.model,e[11]=d):d=e[11];let p;e[12]!==d?(p=["Model",d],e[12]=d,e[13]=p):p=e[13],f.push(p)}if(s.device){let d;e[14]!==s.device.name?(d=["Device",s.device.name],e[14]=s.device.name,e[15]=d):d=e[15],f.push(d)}if(a){let d;e[16]!==a?(d=["Folder",a],e[16]=a,e[17]=d):d=e[17],f.push(d)}if(s.startedAt){let d;e[18]!==s.startedAt?(d=pt(s.startedAt),e[18]=s.startedAt,e[19]=d):d=e[19];let p;e[20]!==d?(p=["Started",d],e[20]=d,e[21]=p):p=e[21],f.push(p)}if(s.turnCount){const d=String(s.turnCount);let p;e[22]!==d?(p=["Turns",d],e[22]=d,e[23]=p):p=e[23],f.push(p)}e[4]=a,e[5]=s.device,e[6]=s.model,e[7]=s.startedAt,e[8]=s.turnCount,e[9]=f}else f=e[9];let g;e[24]!==i?(g=n.jsx("p",{className:"font-medium",children:i}),e[24]=i,e[25]=g):g=e[25];let h;e[26]!==i||e[27]!==o?(h=o&&o!==i&&n.jsx("p",{className:"line-clamp-3 text-muted-foreground",children:o}),e[26]=i,e[27]=o,e[28]=h):h=e[28];let r;e[29]!==f?(r=f.length>0&&n.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5",children:f.map(Gs)}),e[29]=f,e[30]=r):r=e[30];let w;return e[31]!==g||e[32]!==h||e[33]!==r?(w=n.jsxs("div",{className:"flex flex-col gap-1.5 py-0.5",children:[g,h,r]}),e[31]=g,e[32]=h,e[33]=r,e[34]=w):w=e[34],w}function Gs(t){const[e,s]=t;return n.jsxs("div",{className:"contents",children:[n.jsx("dt",{className:"text-muted-foreground",children:e}),n.jsx("dd",{className:"truncate tabular-nums",children:s})]},e)}const Ks=4e3;function Vs(t){var d;const[e,s]=k.useState(null),[i,l]=k.useState(null),[o,c]=k.useState(new Set),a=(d=Wt())==null?void 0:d.refresh,f=k.useRef(t),g=k.useRef(new Set);k.useLayoutEffect(()=>(f.current=t,()=>{f.current=null}),[t]);const h=k.useCallback(async p=>{if(t)try{const N=await _e(`/api/session-crew/${encodeURIComponent(t)}`);if(!p())return;if(!N.ok){l(N.status===404?"This session is no longer available.":"Couldn't load the crew.");return}const C=await N.json();if(!p())return;s(b=>JSON.stringify(b)===JSON.stringify(C)?b:C),l(null)}catch{p()&&l("Couldn't load the crew.")}},[t]);it(t?h:null,Ks),k.useEffect(()=>{s(p=>p!=null&&p.members.some(N=>N.sessionId===t)?p:null),l(null),c(new Set)},[t]);const r=k.useCallback(async(p,N,C)=>{const b=`${t}:${p}`;if(g.current.has(b))return;const S=()=>f.current===t;g.current.add(b),c(y=>new Set(y).add(p));try{const y=await N();if(!S())return;if(!y.ok&&y.status!==404){l(C);return}a==null||a(),await h(S)}catch{S()&&l(C)}finally{g.current.delete(b),S()&&c(y=>{const M=new Set(y);return M.delete(p),M})}},[h,a,t]),w=k.useCallback((p,N,C)=>r(N,()=>je("/api/session-respond",{sessionId:p,requestId:N,...C}),"Couldn't send the answer."),[r]),u=k.useCallback((p,N)=>r(N,()=>je("/api/delegated-tasks",{sessionId:p,taskId:N,action:"ack"}),"Couldn't mark the result read."),[r]),x=k.useCallback(p=>r(p.sessionId,()=>{var N;return((N=p.result)==null?void 0:N.state)==="running"&&p.parentId?je("/api/delegated-tasks",{sessionId:p.parentId,taskId:p.result.taskId,action:"cancel"}):je("/api/stop-session",{sessionId:p.sessionId,cancelQueued:!0})},"Couldn't stop the session."),[r]);return{crew:e,error:i,busy:o,respond:w,markRead:u,stop:x}}const Xs=[{id:"all",label:"All"},{id:"working",label:"Working"},{id:"needs-you",label:"Need you"},{id:"done",label:"Done"}];function dn(t){var q;const e=ue.c(37),{context:s,closePanel:i}=t,l=((q=s.session)==null?void 0:q.sessionId)??null,{crew:o,error:c,busy:a,respond:f,markRead:g,stop:h}=Vs(l),{names:r}=Ht(),[w,u]=k.useState("overview");let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=new Set,e[0]=x):x=e[0];const[d,p]=k.useState(x),N=Ls((o==null?void 0:o.rootId)??"");let C;e[1]!==(o==null?void 0:o.members)?(C=new Map(((o==null?void 0:o.members)??[]).map(Js)),e[1]=o==null?void 0:o.members,e[2]=C):C=e[2];const b=C;let S;e[3]!==(o==null?void 0:o.members)?(S=new Map(((o==null?void 0:o.members)??[]).flatMap(Zs)),e[3]=o==null?void 0:o.members,e[4]=S):S=e[4];const y=S;let M;e[5]!==b||e[6]!==r?(M=P=>gs(P,b,r),e[5]=b,e[6]=r,e[7]=M):M=e[7];const L=M;let A;e[8]!==s?(A=P=>{P.address&&P.device?Xt(Zt(P.address.dirName,P.address.fileName,P.device.id)):P.address&&s.openSession?s.openSession(P.address.dirName,P.address.fileName):Jt(P.sessionId)},e[8]=s,e[9]=A):A=e[9];const O=A;let v;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=P=>p(W=>{const B=new Set(W);return B.delete(P)||B.add(P),B}),e[10]=v):v=e[10];const _=v;let I,E,R;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(ht,{"aria-hidden":"true",className:"size-4 text-muted-foreground"}),E=n.jsx("h2",{className:"text-sm font-medium",children:"Crew"}),R=n.jsx("div",{className:"flex-1"}),e[11]=I,e[12]=E,e[13]=R):(I=e[11],E=e[12],R=e[13]);let T;e[14]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(cs,{"data-icon":"inline-start"}),e[14]=T):T=e[14];let z;e[15]!==i?(z=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[I,E,R,n.jsx(J,{variant:"ghost",size:"icon-sm",onClick:i,"aria-label":"Close crew",children:T})]}),e[15]=i,e[16]=z):z=e[16];let D;e[17]!==c?(D=c&&n.jsx("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive",children:c}),e[17]=c,e[18]=D):D=e[18];let Y;e[19]!==a||e[20]!==d||e[21]!==o||e[22]!==c||e[23]!==y||e[24]!==N||e[25]!==g||e[26]!==L||e[27]!==O||e[28]!==f||e[29]!==l||e[30]!==h||e[31]!==w?(Y=o?n.jsxs(Bt,{value:w,onValueChange:u,className:"min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)]",children:[n.jsxs(Ut,{variant:"line",className:"mx-3 mb-1",children:[n.jsx(Te,{value:"overview",children:"Overview"}),n.jsx(Te,{value:"map",children:"Map"}),n.jsx(Te,{value:"chat",children:"Chat"})]}),n.jsx(Ae,{value:"overview",className:"min-h-0",children:n.jsxs(ft,{className:"h-full min-h-0",children:[n.jsx(Qs,{crew:o,hereId:l,nameOf:L,onOpen:O}),n.jsx(tn,{crew:o,busy:a,nameOf:L,onOpen:O,onRespond:f}),n.jsx(sn,{crew:o,hereId:l,busy:a,nameOf:L,onOpen:O,onMarkRead:g,onStop:h,collapsed:d,onToggle:_})]})}),n.jsx(Ae,{value:"map",className:"min-h-0",children:n.jsx(_s,{crew:o,hereId:l,controls:N,kinds:y,nameOf:L,onOpen:O})}),n.jsx(Ae,{value:"chat",keepMounted:!0,className:"min-h-0",children:n.jsx(hs,{rootId:o.rootId,kinds:y,active:w==="chat"},o.rootId)})]}):!c&&n.jsx("p",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Loading the crew…"}),e[19]=a,e[20]=d,e[21]=o,e[22]=c,e[23]=y,e[24]=N,e[25]=g,e[26]=L,e[27]=O,e[28]=f,e[29]=l,e[30]=h,e[31]=w,e[32]=Y):Y=e[32];let F;return e[33]!==z||e[34]!==D||e[35]!==Y?(F=n.jsxs("aside",{"aria-label":"Crew",className:"flex size-full min-h-0 flex-col bg-canvas",children:[z,D,Y]}),e[33]=z,e[34]=D,e[35]=Y,e[36]=F):F=e[36],F}function Zs(t){return t.address?[[t.sessionId,Gt(t.address.dirName)]]:[]}function Js(t){return[t.sessionId,t]}function Qs(t){var v;const e=ue.c(52),{crew:s,hereId:i,nameOf:l,onOpen:o}=t;let c,a,f,g,h,r,w,u,x,d;if(e[0]!==s||e[1]!==i||e[2]!==l||e[3]!==o){let _;e[14]!==s.rootId?(_=T=>T.sessionId===s.rootId,e[14]=s.rootId,e[15]=_):_=e[15];const I=s.members.find(_);let E;e[16]!==s?(E=bs(s),e[16]=s,e[17]=E):E=e[17],d=E;const R=(v=s.members.find(en))==null?void 0:v.startedAt;u="Crew summary",x="border-b px-3 pb-3 pt-1",r="flex items-baseline gap-2",w=I&&n.jsx("button",{type:"button",onClick:()=>o(I),"aria-current":I.sessionId===i?"true":void 0,className:"min-w-0 flex-1 truncate rounded-sm text-left text-sm font-medium outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:l(I)}),c="shrink-0 text-xs tabular-nums text-muted-foreground",a=d.size,f=" ",g=d.size===1?"session":"sessions",h=R?` · since ${pt(R)}`:"",e[0]=s,e[1]=i,e[2]=l,e[3]=o,e[4]=c,e[5]=a,e[6]=f,e[7]=g,e[8]=h,e[9]=r,e[10]=w,e[11]=u,e[12]=x,e[13]=d}else c=e[4],a=e[5],f=e[6],g=e[7],h=e[8],r=e[9],w=e[10],u=e[11],x=e[12],d=e[13];let p;e[18]!==c||e[19]!==a||e[20]!==f||e[21]!==g||e[22]!==h?(p=n.jsxs("span",{className:c,children:[a,f,g,h]}),e[18]=c,e[19]=a,e[20]=f,e[21]=g,e[22]=h,e[23]=p):p=e[23];let N;e[24]!==p||e[25]!==r||e[26]!==w?(N=n.jsxs("div",{className:r,children:[w,p]}),e[24]=p,e[25]=r,e[26]=w,e[27]=N):N=e[27];let C;e[28]!==d.working?(C=d.working>0&&n.jsx(Ne,{dot:fe.working,value:d.working,label:"working"}),e[28]=d.working,e[29]=C):C=e[29];let b;e[30]!==d.needsYou?(b=d.needsYou>0&&n.jsx(Ne,{dot:fe["needs-you"],value:d.needsYou,label:d.needsYou===1?"needs you":"need you"}),e[30]=d.needsYou,e[31]=b):b=e[31];let S;e[32]!==d.done?(S=d.done>0&&n.jsx(Ne,{dot:fe.done,value:d.done,label:"done"}),e[32]=d.done,e[33]=S):S=e[33];let y;e[34]!==d.failed?(y=d.failed>0&&n.jsx(Ne,{dot:fe.failed,value:d.failed,label:"failed"}),e[34]=d.failed,e[35]=y):y=e[35];let M;e[36]!==d.unreachable?(M=d.unreachable>0&&n.jsx(Ne,{dot:fe.unreachable,value:d.unreachable,label:"away"}),e[36]=d.unreachable,e[37]=M):M=e[37];let L;e[38]!==d.unreadResults?(L=d.unreadResults>0&&n.jsxs("span",{className:"ml-auto text-warning",children:[n.jsx("span",{className:"font-medium tabular-nums",children:d.unreadResults})," ",d.unreadResults===1?"result":"results"," unread"]}),e[38]=d.unreadResults,e[39]=L):L=e[39];let A;e[40]!==C||e[41]!==b||e[42]!==S||e[43]!==y||e[44]!==M||e[45]!==L?(A=n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3.5 gap-y-1 text-xs text-muted-foreground",children:[C,b,S,y,M,L]}),e[40]=C,e[41]=b,e[42]=S,e[43]=y,e[44]=M,e[45]=L,e[46]=A):A=e[46];let O;return e[47]!==N||e[48]!==A||e[49]!==u||e[50]!==x?(O=n.jsxs("section",{"aria-label":u,className:x,children:[N,A]}),e[47]=N,e[48]=A,e[49]=u,e[50]=x,e[51]=O):O=e[51],O}function en(t){return t.parentId!==null}function Ne(t){const e=ue.c(10),{dot:s,value:i,label:l}=t;let o;e[0]!==s?(o=oe("size-1.5 rounded-full",s),e[0]=s,e[1]=o):o=e[1];let c;e[2]!==o?(c=n.jsx("span",{className:o,"aria-hidden":"true"}),e[2]=o,e[3]=c):c=e[3];let a;e[4]!==i?(a=n.jsx("span",{className:"font-medium tabular-nums text-foreground",children:i}),e[4]=i,e[5]=a):a=e[5];let f;return e[6]!==l||e[7]!==c||e[8]!==a?(f=n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c,a," ",l]}),e[6]=l,e[7]=c,e[8]=a,e[9]=f):f=e[9],f}function tn(t){const e=ue.c(6),{crew:s,busy:i,nameOf:l,onOpen:o,onRespond:c}=t,a=ws(s),[f,g]=k.useState(0);if(a.length===0)return null;const h=Math.min(f,a.length-1),{member:r,pending:w}=a[h],u=a[h+1];let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Needs you"}),e[0]=x):x=e[0];let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("span",{className:"flex-1"}),e[1]=d):d=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("span",{className:oe("size-1.5 shrink-0 rounded-full",fe["needs-you"]),"aria-hidden":"true"}),e[2]=p):p=e[2];const N=w.askedAt?`waiting ${qe(new Date(w.askedAt).toISOString())}`:"waiting";let C;e[3]!==N?(C=n.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-warning",children:N}),e[3]=N,e[4]=C):C=e[4];let b;return e[5]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(ze,{"data-icon":"inline-end"}),e[5]=b):b=e[5],n.jsxs("section",{"aria-label":"Needs you",className:"border-b px-3 py-2.5",children:[n.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs text-muted-foreground",children:[x,n.jsx("span",{className:"tabular-nums",children:a.length}),d,a.length>1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"tabular-nums",children:[h+1," of ",a.length]}),n.jsx(J,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:h===0,onClick:()=>g(h-1),children:n.jsx(ls,{"data-icon":"inline-start"})}),n.jsx(J,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:h===a.length-1,onClick:()=>g(h+1),children:n.jsx(ze,{"data-icon":"inline-start"})})]})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2 px-0.5 text-xs",children:[p,n.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:l(r)}),r.device&&n.jsx(Kt,{variant:"outline",children:r.device.name}),C]}),n.jsx(Vt,{sessionId:r.sessionId,pending:w,queued:0,responding:i.has(w.requestId),onRespond:(S,y)=>void c(r.sessionId,S,y),onOpen:()=>o(r)},w.requestId),n.jsxs(J,{variant:"ghost",size:"xs",className:"self-end text-muted-foreground",onClick:()=>o(r),children:["Open session",b]})]}),u&&n.jsxs("p",{className:"mt-2 truncate text-xs text-muted-foreground",children:["Next: ",n.jsx("span",{className:"font-medium text-foreground",children:l(u.member)})," ",We(u.member).toLowerCase()]})]})}function sn({crew:t,hereId:e,busy:s,nameOf:i,onOpen:l,onMarkRead:o,onStop:c,collapsed:a,onToggle:f}){const[g,h]=k.useState("working");let r=null;const w=xs(t).filter(({member:u,depth:x})=>{if(g!=="all"){const d=he(u);return g==="done"?d!=="working"&&d!=="needs-you":d===g}return r!==null&&x>r?!1:(r=a.has(u.sessionId)?x:null,!0)});return n.jsxs("section",{"aria-label":"Sessions",className:"px-1.5 py-2.5",children:[n.jsxs("div",{className:"mb-1.5 flex items-center gap-2 px-1.5",children:[n.jsx("h3",{className:"text-sm font-medium",children:"Sessions"}),n.jsx("span",{className:"flex-1"}),n.jsx("div",{role:"radiogroup","aria-label":"Show sessions",className:"flex gap-0.5",children:Xs.map(({id:u,label:x})=>n.jsx("button",{type:"button",role:"radio","aria-checked":g===u,onClick:()=>h(u),className:oe("rounded-full px-2 py-0.5 text-[11px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",g===u&&"bg-accent text-foreground"),children:x},u))})]}),w.length===0?n.jsxs("div",{className:"flex flex-col items-center gap-1 px-1.5 py-4 text-xs text-muted-foreground",children:[n.jsx("p",{children:g==="working"?"Nothing is working right now.":"No sessions here."}),g!=="all"&&n.jsx(J,{variant:"ghost",size:"xs",onClick:()=>h("all"),children:"Show all"})]}):n.jsx("ul",{className:"flex flex-col",children:w.map(u=>n.jsx(nn,{row:u,here:u.member.sessionId===e,busy:s,name:i(u.member),onOpen:l,onMarkRead:o,onStop:c,collapsed:g==="all"?a.has(u.member.sessionId):void 0,onToggle:()=>f(u.member.sessionId)},u.member.sessionId))})]})}function nn(t){var ce,me;const e=ue.c(81),{row:s,here:i,busy:l,name:o,onOpen:c,onMarkRead:a,onStop:f,collapsed:g,onToggle:h}=t,{member:r,depth:w,children:u}=s;let x;e[0]!==r?(x=he(r),e[0]=r,e[1]=x):x=e[1];const d=x;let p;e[2]!==r?(p=We(r),e[2]=r,e[3]=p):p=e[3];const N=p;let C;e[4]!==r.pullRequests?(C=(ce=r.pullRequests)==null?void 0:ce.at(-1),e[4]=r.pullRequests,e[5]=C):C=e[5];const b=C;let S;e[6]!==r?(S=$e(r)&&r.result&&r.parentId,e[6]=r,e[7]=S):S=e[7];const y=S,M=(d==="working"||d==="needs-you")&&(!r.device||((me=r.result)==null?void 0:me.state)==="running"&&r.parentId!==null),L=r.sessionId,A=i?"bg-accent":"hover:bg-accent/60",O=w>0&&"border-l border-border/70";let v;e[8]!==A||e[9]!==O?(v=oe("group/crew relative flex items-start rounded-md",A,O),e[8]=A,e[9]=O,e[10]=v):v=e[10];const _=w>0?6+(w-1)*14:0;let I;e[11]!==_?(I={marginLeft:_},e[11]=_,e[12]=I):I=e[12];let E;e[13]!==u||e[14]!==g||e[15]!==o||e[16]!==h?(E=u>0&&g!==void 0&&n.jsx(J,{variant:"ghost",size:"icon-xs","aria-label":`${g?"Expand":"Collapse"} ${o}'s child sessions`,"aria-expanded":!g,onClick:h,children:n.jsx(ze,{"data-icon":"inline-start",className:oe("transition-transform",!g&&"rotate-90")})}),e[13]=u,e[14]=g,e[15]=o,e[16]=h,e[17]=E):E=e[17];let R;e[18]!==E?(R=n.jsx("span",{className:"mt-1.5 flex w-6 shrink-0 justify-center",children:E}),e[18]=E,e[19]=R):R=e[19];let T;e[20]!==r||e[21]!==c?(T=()=>c(r),e[20]=r,e[21]=c,e[22]=T):T=e[22];const z=i?"true":void 0,D=`${o}, ${N}`,Y=fe[d];let F;e[23]!==Y?(F=oe("size-1.5 justify-self-center rounded-full",Y),e[23]=Y,e[24]=F):F=e[24];let q;e[25]!==F?(q=n.jsx("span",{className:F,"aria-hidden":"true"}),e[25]=F,e[26]=q):q=e[26];let P;e[27]!==o?(P=n.jsx("span",{className:"truncate",children:o}),e[27]=o,e[28]=P):P=e[28];let W;e[29]!==i?(W=i&&n.jsx("span",{className:"shrink-0 rounded-full border px-1.5 text-[10.5px] font-normal text-muted-foreground",children:"you are here"}),e[29]=i,e[30]=W):W=e[30];let B;e[31]!==P||e[32]!==W?(B=n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12.5px] font-medium",children:[P,W]}),e[31]=P,e[32]=W,e[33]=B):B=e[33];let G;e[34]!==r.lastActivityAt?(G=r.lastActivityAt?qe(r.lastActivityAt):"",e[34]=r.lastActivityAt,e[35]=G):G=e[35];let K;e[36]!==G?(K=n.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:G}),e[36]=G,e[37]=K):K=e[37];const X=(d==="needs-you"||y)&&"text-warning",m=d==="failed"&&"text-destructive";let j;e[38]!==X||e[39]!==m?(j=oe("min-w-0 flex-1 truncate",X,m),e[38]=X,e[39]=m,e[40]=j):j=e[40];let $;e[41]!==N||e[42]!==j?($=n.jsx("span",{className:j,children:N}),e[41]=N,e[42]=j,e[43]=$):$=e[43];let V;e[44]!==b?(V=b&&n.jsxs("span",{className:"shrink-0 rounded-full border px-1.5 text-[11px]",children:["#",b.number]}),e[44]=b,e[45]=V):V=e[45];let ae;e[46]!==r.device?(ae=r.device&&n.jsx("span",{className:"shrink-0",children:r.device.name}),e[46]=r.device,e[47]=ae):ae=e[47];let Q;e[48]!==u?(Q=u>0&&n.jsxs("span",{className:"shrink-0",children:[u," ",u===1?"session":"sessions"]}),e[48]=u,e[49]=Q):Q=e[49];let ee;e[50]!==r.model?(ee=r.model&&n.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:Ye(r.model)}),e[50]=r.model,e[51]=ee):ee=e[51];let te;e[52]!==$||e[53]!==V||e[54]!==ae||e[55]!==Q||e[56]!==ee?(te=n.jsxs("span",{className:"col-start-2 col-end-4 flex min-w-0 items-center gap-2 text-[11.5px] text-muted-foreground",children:[$,V,ae,Q,ee]}),e[52]=$,e[53]=V,e[54]=ae,e[55]=Q,e[56]=ee,e[57]=te):te=e[57];let se;e[58]!==T||e[59]!==z||e[60]!==D||e[61]!==q||e[62]!==B||e[63]!==K||e[64]!==te?(se=n.jsxs("button",{type:"button",onClick:T,"aria-current":z,"aria-label":D,className:"grid min-w-0 flex-1 grid-cols-[14px_minmax(0,1fr)_auto] items-center gap-x-2 gap-y-0.5 rounded-md px-2 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[q,B,K,te]}),e[58]=T,e[59]=z,e[60]=D,e[61]=q,e[62]=B,e[63]=K,e[64]=te,e[65]=se):se=e[65];let re;e[66]!==l||e[67]!==M||e[68]!==r||e[69]!==o||e[70]!==a||e[71]!==f||e[72]!==y?(re=(y||M)&&n.jsxs("div",{className:"absolute right-1.5 top-1 hidden gap-1 group-focus-within/crew:flex group-hover/crew:flex",children:[y&&r.result&&r.parentId&&n.jsx(J,{variant:"outline",size:"icon-xs",className:"bg-popover","aria-label":`Mark ${o}'s result read`,title:"Mark the result read",disabled:l.has(r.result.taskId),onClick:()=>void a(r.parentId,r.result.taskId),children:n.jsx(is,{"data-icon":"inline-start"})}),M&&n.jsx(J,{variant:"outline",size:"icon-xs",className:"bg-popover text-destructive","aria-label":`Stop ${o}`,title:"Stop this session",disabled:l.has(r.sessionId),onClick:()=>void f(r),children:n.jsx(rs,{"data-icon":"inline-start"})})]}),e[66]=l,e[67]=M,e[68]=r,e[69]=o,e[70]=a,e[71]=f,e[72]=y,e[73]=re):re=e[73];let Z;return e[74]!==r.sessionId||e[75]!==I||e[76]!==R||e[77]!==se||e[78]!==re||e[79]!==v?(Z=n.jsxs("li",{"data-crew-row":L,className:v,style:I,children:[R,se,re]}),e[74]=r.sessionId,e[75]=I,e[76]=R,e[77]=se,e[78]=re,e[79]=v,e[80]=Z):Z=e[80],Z}export{dn as CrewPanel};
@@ -1,2 +1,2 @@
1
- import{c as T,r as L,j as c}from"./vendor-react-gGw_S5I_.js";import{cL as _,cM as C,cN as D,c as H}from"./index-BvNyEUVG.js";function K(r){const e=T.c(26),{value:t,onChange:j,readOnly:i,filePath:k,ariaLabel:R,textareaRef:f,onKeyDown:v,onSelect:w}=r,N=_(),u=L.useRef(null),p=L.useRef(null);let d;e[0]!==k?(d=C(k),e[0]=k,e[1]=d):d=e[1];const h=D(t,d,N,80);let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{u.current&&p.current&&(p.current.scrollTop=u.current.scrollTop,p.current.scrollLeft=u.current.scrollLeft)},e[2]=m):m=e[2];const S=m;let x;e[3]!==f?(x=b=>{u.current=b,f&&(f.current=b)},e[3]=f,e[4]=x):x=e[4];const y=x;let l;e[5]!==h||e[6]!==t?(l=h?h.map(M):c.jsx("code",{className:"text-foreground",children:t}),e[5]=h,e[6]=t,e[7]=l):l=e[7];let n;e[8]!==l?(n=c.jsx("pre",{ref:p,"aria-hidden":!0,className:"absolute inset-0 overflow-hidden font-mono text-[13px] leading-relaxed p-4 m-0 pointer-events-none whitespace-pre-wrap break-words",children:l}),e[8]=l,e[9]=n):n=e[9];let s;e[10]!==j?(s=b=>j(b.target.value),e[10]=j,e[11]=s):s=e[11];const E=i&&"cursor-default";let a;e[12]!==E?(a=H("absolute inset-0 w-full h-full resize-none bg-transparent font-mono text-[13px] leading-relaxed p-4 outline-none","text-transparent caret-foreground selection:bg-selection","scrollbar-thin scrollbar-track-transparent scrollbar-thumb-border",E),e[12]=E,e[13]=a):a=e[13];let o;e[14]!==R||e[15]!==y||e[16]!==v||e[17]!==w||e[18]!==i||e[19]!==s||e[20]!==a||e[21]!==t?(o=c.jsx("textarea",{ref:y,"aria-label":R,value:t,onChange:s,onScroll:S,onKeyDown:v,onSelect:w,readOnly:i,spellCheck:!1,className:a,placeholder:"Empty file"}),e[14]=R,e[15]=y,e[16]=v,e[17]=w,e[18]=i,e[19]=s,e[20]=a,e[21]=t,e[22]=o):o=e[22];let g;return e[23]!==n||e[24]!==o?(g=c.jsxs("div",{className:"relative min-h-0 flex-1 bg-background",children:[n,o]}),e[23]=n,e[24]=o,e[25]=g):g=e[25],g}function M(r,e){return c.jsxs("span",{children:[r.map(P),`
2
- `]},e)}function P(r,e){return c.jsx("span",{style:{color:r.color},children:r.content},e)}export{K as H};
1
+ import{c as T,r as L,j as c}from"./vendor-react-gGw_S5I_.js";import{d5 as _,d6 as C,d7 as D,c as H}from"./index-Bg4A-xl7.js";function M(r){const e=T.c(26),{value:t,onChange:j,readOnly:i,filePath:k,ariaLabel:R,textareaRef:f,onKeyDown:v,onSelect:w}=r,N=_(),u=L.useRef(null),p=L.useRef(null);let d;e[0]!==k?(d=C(k),e[0]=k,e[1]=d):d=e[1];const h=D(t,d,N,80);let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{u.current&&p.current&&(p.current.scrollTop=u.current.scrollTop,p.current.scrollLeft=u.current.scrollLeft)},e[2]=m):m=e[2];const S=m;let x;e[3]!==f?(x=b=>{u.current=b,f&&(f.current=b)},e[3]=f,e[4]=x):x=e[4];const y=x;let l;e[5]!==h||e[6]!==t?(l=h?h.map(P):c.jsx("code",{className:"text-foreground",children:t}),e[5]=h,e[6]=t,e[7]=l):l=e[7];let n;e[8]!==l?(n=c.jsx("pre",{ref:p,"aria-hidden":!0,className:"absolute inset-0 overflow-hidden font-mono text-[13px] leading-relaxed p-4 m-0 pointer-events-none whitespace-pre-wrap break-words",children:l}),e[8]=l,e[9]=n):n=e[9];let s;e[10]!==j?(s=b=>j(b.target.value),e[10]=j,e[11]=s):s=e[11];const E=i&&"cursor-default";let a;e[12]!==E?(a=H("absolute inset-0 w-full h-full resize-none bg-transparent font-mono text-[13px] leading-relaxed p-4 outline-none","text-transparent caret-foreground selection:bg-selection","scrollbar-thin scrollbar-track-transparent scrollbar-thumb-border",E),e[12]=E,e[13]=a):a=e[13];let o;e[14]!==R||e[15]!==y||e[16]!==v||e[17]!==w||e[18]!==i||e[19]!==s||e[20]!==a||e[21]!==t?(o=c.jsx("textarea",{ref:y,"aria-label":R,value:t,onChange:s,onScroll:S,onKeyDown:v,onSelect:w,readOnly:i,spellCheck:!1,className:a,placeholder:"Empty file"}),e[14]=R,e[15]=y,e[16]=v,e[17]=w,e[18]=i,e[19]=s,e[20]=a,e[21]=t,e[22]=o):o=e[22];let g;return e[23]!==n||e[24]!==o?(g=c.jsxs("div",{className:"relative min-h-0 flex-1 bg-background",children:[n,o]}),e[23]=n,e[24]=o,e[25]=g):g=e[25],g}function P(r,e){return c.jsxs("span",{children:[r.map(z),`
2
+ `]},e)}function z(r,e){return c.jsx("span",{style:{color:r.color},children:r.content},e)}export{M as H};
@@ -1 +1 @@
1
- import{c as O,j as t,r as E}from"./vendor-react-gGw_S5I_.js";import{o as H,bB as $,bC as T,bD as Q,B as P,bE as Y,bF as _,n as q,l as J,D as M,j as U,S as V,ax as W,az as X,aw as Z,bG as ee,G as te,I as se,m as ae,bH as le,bI as ne,bJ as re}from"./index-BvNyEUVG.js";import{bK as F,df as oe,ak as ce}from"./vendor-ui-keo4oB2X.js";import"./vendor-markdown-BEJ8yVzA.js";const ie=new Set(["Alt","Control","Meta","Shift"]);function pe(e){const s=O.c(6),{open:f,onOpenChange:l}=e,x=f?"open":"closed";let a;s[0]!==x?(a=t.jsx(de,{},x),s[0]=x,s[1]=a):a=s[1];let r;return s[2]!==l||s[3]!==f||s[4]!==a?(r=t.jsx(H,{open:f,onOpenChange:l,children:a}),s[2]=l,s[3]=f,s[4]=a,s[5]=r):r=s[5],r}function de(){const e=O.c(45),[s,f]=E.useState(""),[l,x]=E.useState(null),[a,r]=E.useState(null),[A,B]=E.useState($);let I,k;e[0]!==l?(I=()=>{if(!l)return;const v=l,G=function(n){if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),x(null),r(null);return}if(ie.has(n.key))return;n.preventDefault(),n.stopPropagation();const c=le(n),p=ne(c,v);if(p){r(`Already assigned to “${p.label}”.`);return}re(v,c),B($()),x(null),r(null)};return window.addEventListener("keydown",G,!0),()=>window.removeEventListener("keydown",G,!0)},k=[l],e[0]=l,e[1]=I,e[2]=k):(I=e[1],k=e[2]),E.useEffect(I,k);let b,g,d,j,y,N,S,w,m,u,h;if(e[3]!==A||e[4]!==a||e[5]!==s||e[6]!==l){const v=s.trim().toLowerCase(),G=v?T.filter(i=>`${i.label} ${i.description} ${i.group}`.toLowerCase().includes(v)):T;g=q,S="max-w-2xl gap-0 overflow-hidden p-0",w=!1,e[18]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(J,{className:"p-4 pb-3",children:[t.jsxs(M,{className:"flex items-center gap-2",children:[t.jsx(oe,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4"}),"Keyboard shortcuts"]}),t.jsx(U,{children:"Click a shortcut, then press a new key combination. Changes are saved on this device."})]}),u=t.jsx(V,{}),e[18]=m,e[19]=u):(m=e[18],u=e[19]);let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(W,{children:t.jsx(ce,{"data-icon":"inline-start","aria-hidden":"true"})}),e[20]=K):K=e[20];let n;e[21]===Symbol.for("react.memo_cache_sentinel")?(n=i=>f(i.target.value),e[21]=n):n=e[21];let c;e[22]!==s?(c=t.jsxs(X,{className:"flex-1",children:[K,t.jsx(Z,{"aria-label":"Search keyboard shortcuts",value:s,onChange:n,placeholder:"Search shortcuts…"})]}),e[22]=s,e[23]=c):c=e[23];let p;e[24]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(P,{variant:"outline",size:"sm",onClick:()=>{ee(),B($()),r(null)},children:[t.jsx(F,{"data-icon":"inline-start"}),"Reset all"]}),e[24]=p):p=e[24],e[25]!==c?(h=t.jsxs("div",{className:"flex items-center gap-2 p-3",children:[c,p]}),e[25]=c,e[26]=h):h=e[26],e[27]!==a?(d=a&&t.jsx(te,{variant:"destructive",className:"mx-3 mb-2 w-auto",children:t.jsxs(se,{children:[a," Press another shortcut or Esc to cancel."]})}),e[27]=a,e[28]=d):d=e[28],b=ae,N="h-[min(28rem,60vh)]",j="flex flex-col gap-4 px-3 pb-4",y=Q.map(i=>{const L=G.filter(o=>o.group===i);return L.length===0?null:t.jsxs("section",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:i}),L.map(o=>{const z=l===o.command;return t.jsxs("div",{className:"flex min-h-12 items-center gap-3 rounded-md px-2 py-1.5 hover:bg-accent",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm",children:o.label}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.description})]}),t.jsx(P,{variant:z?"secondary":"outline",size:"sm",className:"min-w-28 font-mono text-xs",onClick:()=>{r(null),x(z?null:o.command)},"aria-label":`Change shortcut for ${o.label}`,children:z?"Press keys…":Y(A[o.command])}),t.jsx(P,{variant:"ghost",size:"icon-sm",onClick:()=>{_(o.command),B($()),r(null)},"aria-label":`Reset shortcut for ${o.label}`,children:t.jsx(F,{"data-icon":"inline-start"})})]},o.command)})]},i)}),e[3]=A,e[4]=a,e[5]=s,e[6]=l,e[7]=b,e[8]=g,e[9]=d,e[10]=j,e[11]=y,e[12]=N,e[13]=S,e[14]=w,e[15]=m,e[16]=u,e[17]=h}else b=e[7],g=e[8],d=e[9],j=e[10],y=e[11],N=e[12],S=e[13],w=e[14],m=e[15],u=e[16],h=e[17];let C;e[29]!==j||e[30]!==y?(C=t.jsx("div",{className:j,children:y}),e[29]=j,e[30]=y,e[31]=C):C=e[31];let D;e[32]!==b||e[33]!==C||e[34]!==N?(D=t.jsx(b,{className:N,children:C}),e[32]=b,e[33]=C,e[34]=N,e[35]=D):D=e[35];let R;return e[36]!==g||e[37]!==d||e[38]!==D||e[39]!==S||e[40]!==w||e[41]!==m||e[42]!==u||e[43]!==h?(R=t.jsxs(g,{className:S,showCloseButton:w,children:[m,u,h,d,D]}),e[36]=g,e[37]=d,e[38]=D,e[39]=S,e[40]=w,e[41]=m,e[42]=u,e[43]=h,e[44]=R):R=e[44],R}export{pe as KeyboardShortcutsDialog};
1
+ import{c as O,j as t,r as E}from"./vendor-react-gGw_S5I_.js";import{o as H,bB as $,bC as T,bD as J,B as P,bE as Q,bF as Y,n as _,l as q,D as M,j as U,S as V,ax as W,az as X,aw as Z,bG as ee,G as te,I as se,m as ae,bH as le,bI as ne,bJ as re}from"./index-Bg4A-xl7.js";import{bJ as F,dg as oe,ak as ce}from"./vendor-ui-Dc_kJXxz.js";import"./vendor-markdown-BEJ8yVzA.js";const ie=new Set(["Alt","Control","Meta","Shift"]);function pe(e){const s=O.c(6),{open:f,onOpenChange:l}=e,x=f?"open":"closed";let a;s[0]!==x?(a=t.jsx(de,{},x),s[0]=x,s[1]=a):a=s[1];let r;return s[2]!==l||s[3]!==f||s[4]!==a?(r=t.jsx(H,{open:f,onOpenChange:l,children:a}),s[2]=l,s[3]=f,s[4]=a,s[5]=r):r=s[5],r}function de(){const e=O.c(45),[s,f]=E.useState(""),[l,x]=E.useState(null),[a,r]=E.useState(null),[A,B]=E.useState($);let I,k;e[0]!==l?(I=()=>{if(!l)return;const v=l,G=function(n){if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),x(null),r(null);return}if(ie.has(n.key))return;n.preventDefault(),n.stopPropagation();const c=le(n),p=ne(c,v);if(p){r(`Already assigned to “${p.label}”.`);return}re(v,c),B($()),x(null),r(null)};return window.addEventListener("keydown",G,!0),()=>window.removeEventListener("keydown",G,!0)},k=[l],e[0]=l,e[1]=I,e[2]=k):(I=e[1],k=e[2]),E.useEffect(I,k);let b,g,d,j,y,N,S,w,m,u,h;if(e[3]!==A||e[4]!==a||e[5]!==s||e[6]!==l){const v=s.trim().toLowerCase(),G=v?T.filter(i=>`${i.label} ${i.description} ${i.group}`.toLowerCase().includes(v)):T;g=_,S="max-w-2xl gap-0 overflow-hidden p-0",w=!1,e[18]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(q,{className:"p-4 pb-3",children:[t.jsxs(M,{className:"flex items-center gap-2",children:[t.jsx(oe,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4"}),"Keyboard shortcuts"]}),t.jsx(U,{children:"Click a shortcut, then press a new key combination. Changes are saved on this device."})]}),u=t.jsx(V,{}),e[18]=m,e[19]=u):(m=e[18],u=e[19]);let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(W,{children:t.jsx(ce,{"data-icon":"inline-start","aria-hidden":"true"})}),e[20]=K):K=e[20];let n;e[21]===Symbol.for("react.memo_cache_sentinel")?(n=i=>f(i.target.value),e[21]=n):n=e[21];let c;e[22]!==s?(c=t.jsxs(X,{className:"flex-1",children:[K,t.jsx(Z,{"aria-label":"Search keyboard shortcuts",value:s,onChange:n,placeholder:"Search shortcuts…"})]}),e[22]=s,e[23]=c):c=e[23];let p;e[24]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(P,{variant:"outline",size:"sm",onClick:()=>{ee(),B($()),r(null)},children:[t.jsx(F,{"data-icon":"inline-start"}),"Reset all"]}),e[24]=p):p=e[24],e[25]!==c?(h=t.jsxs("div",{className:"flex items-center gap-2 p-3",children:[c,p]}),e[25]=c,e[26]=h):h=e[26],e[27]!==a?(d=a&&t.jsx(te,{variant:"destructive",className:"mx-3 mb-2 w-auto",children:t.jsxs(se,{children:[a," Press another shortcut or Esc to cancel."]})}),e[27]=a,e[28]=d):d=e[28],b=ae,N="h-[min(28rem,60vh)]",j="flex flex-col gap-4 px-3 pb-4",y=J.map(i=>{const L=G.filter(o=>o.group===i);return L.length===0?null:t.jsxs("section",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:i}),L.map(o=>{const z=l===o.command;return t.jsxs("div",{className:"flex min-h-12 items-center gap-3 rounded-md px-2 py-1.5 hover:bg-accent",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm",children:o.label}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.description})]}),t.jsx(P,{variant:z?"secondary":"outline",size:"sm",className:"min-w-28 font-mono text-xs",onClick:()=>{r(null),x(z?null:o.command)},"aria-label":`Change shortcut for ${o.label}`,children:z?"Press keys…":Q(A[o.command])}),t.jsx(P,{variant:"ghost",size:"icon-sm",onClick:()=>{Y(o.command),B($()),r(null)},"aria-label":`Reset shortcut for ${o.label}`,children:t.jsx(F,{"data-icon":"inline-start"})})]},o.command)})]},i)}),e[3]=A,e[4]=a,e[5]=s,e[6]=l,e[7]=b,e[8]=g,e[9]=d,e[10]=j,e[11]=y,e[12]=N,e[13]=S,e[14]=w,e[15]=m,e[16]=u,e[17]=h}else b=e[7],g=e[8],d=e[9],j=e[10],y=e[11],N=e[12],S=e[13],w=e[14],m=e[15],u=e[16],h=e[17];let C;e[29]!==j||e[30]!==y?(C=t.jsx("div",{className:j,children:y}),e[29]=j,e[30]=y,e[31]=C):C=e[31];let D;e[32]!==b||e[33]!==C||e[34]!==N?(D=t.jsx(b,{className:N,children:C}),e[32]=b,e[33]=C,e[34]=N,e[35]=D):D=e[35];let R;return e[36]!==g||e[37]!==d||e[38]!==D||e[39]!==S||e[40]!==w||e[41]!==m||e[42]!==u||e[43]!==h?(R=t.jsxs(g,{className:S,showCloseButton:w,children:[m,u,h,d,D]}),e[36]=g,e[37]=d,e[38]=D,e[39]=S,e[40]=w,e[41]=m,e[42]=u,e[43]=h,e[44]=R):R=e[44],R}export{pe as KeyboardShortcutsDialog};
@@ -0,0 +1,2 @@
1
+ import{c as Q,r as G,j as t}from"./vendor-react-gGw_S5I_.js";import{al as Le,cd as Qe,ce as Ve,cf as Ye,cg as Ge,c as te,ch as Xe,ag as We,ci as Fe,cj as Ae,ck as Je,cl as Ze,cm as es,ad as ss,B as U,cn as ts,co as ns,bK as is,cp as ls,au as Ee,H as Pe,G as _e,bA as os,cq as qe,aA as rs,aB as as,cr as cs,cs as ds,ct as us,cu as fs,cv as ms,cw as De,cx as xs,cy as gs,cz as ps,ah as hs,cA as bs,V as je,E as ws,f as js,i as Ns,cB as ys,k as vs,cC as ve,cD as Is,cE as ks,cF as qs,b8 as Ss,cG as Cs}from"./index-Bg4A-xl7.js";import{bl as Me,aP as As,bN as Ds,U as Es,b1 as Ps,b4 as _s,dw as Ms,A as Ue,bp as Os,ak as Rs,X as Ts,al as Ks,C as $s}from"./vendor-ui-Dc_kJXxz.js";import"./vendor-markdown-BEJ8yVzA.js";const zs=6;function Bs(c){const e=Q.c(87),{recent:s,start:n}=c,[l,o]=G.useState(null),[i,x]=G.useState(""),a=l??s[0]??null,d=(l&&!s.some(E=>Oe(E,l))?[l,...s]:[...s]).slice(0,zs);let p;e[0]!==i?(p=i.trim(),e[0]=i,e[1]=p):p=e[1];const u=p;let f;e[2]!==a||e[3]!==n.defaultAgentKind?(f=a?Le(a.dirName):n.defaultAgentKind,e[2]=a,e[3]=n.defaultAgentKind,e[4]=f):f=e[4];const r=f,g=n.model.selectedModel,m=a==null?void 0:a.dirName;let h;e[5]!==m?(h=Qe(m),e[5]=m,e[6]=h):h=e[6];const{imageInput:b}=Ve(r,g,h.instanceId),{images:w,uploading:I,isDragOver:j,imageError:N,hasUnsupportedAttachments:y,dismissImageError:v,removeImage:k,clearImages:D,handleDragOver:A,handleDragLeave:q,handleDrop:S,handlePaste:_}=Ye(b),O=!!(a&&(u||w.length>0))&&!I&&!y;let M;e[7]===Symbol.for("react.memo_cache_sentinel")?(M=(E,ae)=>{o({dirName:E,cwd:ae,name:ae?Fe(ae):E})},e[7]=M):M=e[7];const P=M;let z;e[8]!==P||e[9]!==n.defaultAgentKind?(z=E=>P(Ae(n.defaultAgentKind,E),E),e[8]=P,e[9]=n.defaultAgentKind,e[10]=z):z=e[10];const H=z,L=a==null?void 0:a.cwd;let F;e[11]!==L||e[12]!==a?(F=a&&L?E=>o({...a,dirName:Ae(E,L)}):void 0,e[11]=L,e[12]=a,e[13]=F):F=e[13];const V=F;let C;e[14]!==l||e[15]!==a?(C=()=>{!l&&a&&o(a)},e[14]=l,e[15]=a,e[16]=C):C=e[16];const $=C;let Y;e[17]!==O||e[18]!==D||e[19]!==w||e[20]!==u||e[21]!==a||e[22]!==n?(Y=E=>{E==null||E.preventDefault(),!(!a||!O)&&(n.onStart(a.dirName,a.cwd,u,w.length>0?w.map(Ls):void 0),x(""),D())},e[17]=O,e[18]=D,e[19]=w,e[20]=u,e[21]=a,e[22]=n,e[23]=Y):Y=e[23];const B=Y;let X;e[24]!==B?(X=E=>{E.key==="Enter"&&!E.shiftKey&&!E.nativeEvent.isComposing&&(E.preventDefault(),B())},e[24]=B,e[25]=X):X=e[25];const J=X,ne="Start a session",ie="flex min-w-0 flex-col gap-3",be="flex flex-wrap items-center gap-1.5",le="group",oe="Projects",Z=d.map(E=>{const ae=a!==null&&Oe(E,a);return t.jsxs("button",{type:"button","aria-pressed":ae,title:E.cwd??E.name,onClick:()=>o(E),className:te("flex max-w-48 items-center gap-1.5 rounded-full border py-1 pl-1.5 pr-3 text-xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",ae?"border-foreground/80 bg-foreground text-background":"border-border/70 text-muted-foreground hover:border-foreground/40 hover:text-foreground"),children:[t.jsx(Ge,{projectPath:E.cwd??null,fallback:t.jsx(Me,{className:"size-3.5","aria-hidden":"true"}),className:"size-4"}),t.jsx("span",{className:"truncate",children:E.name})]},E.cwd??E.dirName)}),ee=d.length>0;let W;e[26]!==P||e[27]!==H||e[28]!==n.defaultAgentKind||e[29]!==ee?(W=t.jsx(Fs,{defaultAgentKind:n.defaultAgentKind,onChoose:P,onChooseFolder:H,anyListed:ee}),e[26]=P,e[27]=H,e[28]=n.defaultAgentKind,e[29]=ee,e[30]=W):W=e[30];let T;e[31]!==Z||e[32]!==W?(T=t.jsxs("div",{className:be,role:le,"aria-label":oe,children:[Z,W]}),e[31]=Z,e[32]=W,e[33]=T):T=e[33];let R;e[34]!==S||e[35]!==$?(R=E=>{$(),S(E)},e[34]=S,e[35]=$,e[36]=R):R=e[36];let K;e[37]!==j?(K=j&&t.jsx(Je,{}),e[37]=j,e[38]=K):K=e[38];let se;e[39]!==k?(se=(E,ae)=>k(ae),e[39]=k,e[40]=se):se=e[40];let re;e[41]!==w||e[42]!==se?(re=t.jsx(Ze,{images:w,onRemove:se}),e[41]=w,e[42]=se,e[43]=re):re=e[43];const we=y?void 0:v;let ce;e[44]!==N||e[45]!==we?(ce=t.jsx(es,{message:N,onDismiss:we}),e[44]=N,e[45]=we,e[46]=ce):ce=e[46];let de;e[47]!==$?(de=E=>{$(),x(E.target.value)},e[47]=$,e[48]=de):de=e[48];let ue;e[49]!==_||e[50]!==$?(ue=E=>{$(),_(E)},e[49]=_,e[50]=$,e[51]=ue):ue=e[51];const Ie=a?`Describe the task for ${a.name}`:"Pick a project, then describe the task";let fe;e[52]!==J||e[53]!==de||e[54]!==ue||e[55]!==Ie||e[56]!==i?(fe=t.jsx(ss,{"aria-label":"First message",value:i,onChange:de,onPaste:ue,onKeyDown:J,placeholder:Ie,rows:1,className:"max-h-48 min-h-9 flex-1 resize-none rounded-none border-0 bg-transparent px-0 py-2 shadow-none focus-visible:border-transparent focus-visible:ring-0"}),e[52]=J,e[53]=de,e[54]=ue,e[55]=Ie,e[56]=i,e[57]=fe):fe=e[57];let me;e[58]!==r||e[59]!==a||e[60]!==n.model.onEffortChange||e[61]!==n.model.onModelChange||e[62]!==n.model.selectedEffort||e[63]!==n.model.selectedModel||e[64]!==V?(me=a&&t.jsx(Xe,{isNewSession:!0,agentKind:r,onAgentKindChange:V,selectedModel:n.model.selectedModel,onModelChange:n.model.onModelChange,selectedEffort:n.model.selectedEffort,onEffortChange:n.model.onEffortChange}),e[58]=r,e[59]=a,e[60]=n.model.onEffortChange,e[61]=n.model.onModelChange,e[62]=n.model.selectedEffort,e[63]=n.model.selectedModel,e[64]=V,e[65]=me):me=e[65];const ke=!O;let Ne;e[66]===Symbol.for("react.memo_cache_sentinel")?(Ne=t.jsx(As,{"data-icon":"icon"}),e[66]=Ne):Ne=e[66];let xe;e[67]!==ke?(xe=t.jsx(U,{type:"submit",size:"icon-xs",disabled:ke,"aria-label":"Start session",title:"Start session (Enter)",children:Ne}),e[67]=ke,e[68]=xe):xe=e[68];let ge;e[69]!==me||e[70]!==xe?(ge=t.jsxs("div",{className:"flex shrink-0 items-center gap-1 pb-0.5",children:[me,xe]}),e[69]=me,e[70]=xe,e[71]=ge):ge=e[71];let pe;e[72]!==fe||e[73]!==ge?(pe=t.jsxs("div",{className:"flex items-end gap-2 rounded-xl border bg-popover py-2 pl-4 pr-2 shadow-lg shadow-black/5 transition-[border-color,box-shadow] duration-150 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50",children:[fe,ge]}),e[72]=fe,e[73]=ge,e[74]=pe):pe=e[74];let he;e[75]!==q||e[76]!==A||e[77]!==B||e[78]!==R||e[79]!==K||e[80]!==re||e[81]!==ce||e[82]!==pe?(he=t.jsxs("form",{onSubmit:B,onDragOver:A,onDragLeave:q,onDrop:R,className:"relative min-w-0",children:[K,re,ce,pe]}),e[75]=q,e[76]=A,e[77]=B,e[78]=R,e[79]=K,e[80]=re,e[81]=ce,e[82]=pe,e[83]=he):he=e[83];let ye;return e[84]!==T||e[85]!==he?(ye=t.jsxs("section",{"aria-label":ne,className:ie,children:[T,he]}),e[84]=T,e[85]=he,e[86]=ye):ye=e[86],ye}function Ls(c){const{data:e,mediaType:s}=c;return{data:e,mediaType:s}}function Oe(c,e){return c.cwd&&e.cwd?c.cwd===e.cwd:c.dirName===e.dirName}function Fs(c){const e=Q.c(19),{defaultAgentKind:s,onChoose:n,onChooseFolder:l,anyListed:o}=c,[i,x]=G.useState(!1),a=We(i),d=o?"ghost":"outline";let p;e[0]!==d?(p=t.jsx(U,{variant:d,size:"xs",className:"rounded-full text-muted-foreground"}),e[0]=d,e[1]=p):p=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Me,{"data-icon":"inline-start"}),e[2]=u):u=e[2];const f=o?"Other project":"Choose a project";let r;e[3]!==p||e[4]!==f?(r=t.jsxs(ts,{render:p,children:[u,f]}),e[3]=p,e[4]=f,e[5]=r):r=e[5];let g;e[6]!==n?(g=(w,I)=>{x(!1),n(w,I)},e[6]=n,e[7]=g):g=e[7];let m;e[8]!==l?(m=w=>{x(!1),l(w)},e[8]=l,e[9]=m):m=e[9];let h;e[10]!==s||e[11]!==a||e[12]!==g||e[13]!==m?(h=t.jsx(ns,{align:"start",className:"w-96 max-w-[calc(100vw-2rem)] p-0",children:t.jsx(is,{projects:a,defaultAgentKind:s,onNewSession:g,onNewFolder:m})}),e[10]=s,e[11]=a,e[12]=g,e[13]=m,e[14]=h):h=e[14];let b;return e[15]!==i||e[16]!==r||e[17]!==h?(b=t.jsxs(ls,{open:i,onOpenChange:x,children:[r,h]}),e[15]=i,e[16]=r,e[17]=h,e[18]=b):b=e[18],b}function Us(c){const e={};for(const s of c)s.type==="boolean"?e[s.name]=s.defaultValue===!0:s.defaultValue!==void 0?e[s.name]=String(s.defaultValue):e[s.name]="";return e}function Hs(c,e){const s={};for(const n of c){const l=e[n.name];if(typeof l=="boolean"){s[n.name]=l;continue}l!==""&&(s[n.name]=n.type==="number"||n.type==="integer"?Number(l):l)}return s}function Qs(c,e){return c.every(s=>{if(!s.required)return!0;const n=e[s.name];return typeof n=="boolean"?!0:n===""?!1:s.type==="number"||s.type==="integer"?Number.isFinite(Number(n)):!0})}function Vs(c){const e=Q.c(52),{request:s,responding:n,onAnswer:l}=c;let o;e[0]!==s.fields?(o=()=>Us(s.fields),e[0]=s.fields,e[1]=o):o=e[1];const[i,x]=G.useState(o);let a;e[2]!==s.fields||e[3]!==i?(a=Qs(s.fields,i),e[2]=s.fields,e[3]=i,e[4]=a):a=e[4];const d=a,p=s.displayName||s.title||s.serverName;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(j,N)=>{x(y=>({...y,[j]:N}))},e[5]=u):u=e[5];const f=u;let r;e[6]!==l||e[7]!==s.requestId?(r=()=>l==null?void 0:l(s.requestId,{action:"decline"}),e[6]=l,e[7]=s.requestId,e[8]=r):r=e[8];const g=r;if(s.mode==="url"&&s.url){const j=s.url;let N;e[9]!==s.message?(N=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[9]=s.message,e[10]=N):N=e[10];let y;e[11]!==j?(y=t.jsx("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:j,children:j}),e[11]=j,e[12]=y):y=e[12];let v;e[13]!==g||e[14]!==l||e[15]!==s.requestId||e[16]!==n||e[17]!==j?(v=l&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsxs(U,{size:"sm",disabled:n,onClick:()=>{window.open(j,"_blank","noopener,noreferrer"),l(s.requestId,{action:"accept"})},children:["Open link",t.jsx(Ds,{"data-icon":"inline-end"})]}),t.jsx(U,{variant:"ghost",size:"sm",disabled:n,onClick:g,children:"Decline"})]}),e[13]=g,e[14]=l,e[15]=s.requestId,e[16]=n,e[17]=j,e[18]=v):v=e[18];let k;return e[19]!==p||e[20]!==N||e[21]!==y||e[22]!==v?(k=t.jsxs(Re,{server:p,children:[N,y,v]}),e[19]=p,e[20]=N,e[21]=y,e[22]=v,e[23]=k):k=e[23],k}let m;e[24]!==s.message?(m=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[24]=s.message,e[25]=m):m=e[25];let h;if(e[26]!==l||e[27]!==s.fields||e[28]!==s.requestId||e[29]!==n||e[30]!==i){let j;e[32]!==l||e[33]!==s.requestId||e[34]!==n||e[35]!==i?(j=N=>t.jsx(Ys,{id:`elicit-${s.requestId}-${N.name}`,field:N,value:i[N.name],disabled:n||!l,onChange:y=>f(N.name,y)},N.name),e[32]=l,e[33]=s.requestId,e[34]=n,e[35]=i,e[36]=j):j=e[36],h=s.fields.map(j),e[26]=l,e[27]=s.fields,e[28]=s.requestId,e[29]=n,e[30]=i,e[31]=h}else h=e[31];let b;e[37]!==h?(b=t.jsx("div",{className:"mt-3 flex flex-col gap-3",children:h}),e[37]=h,e[38]=b):b=e[38];let w;e[39]!==d||e[40]!==g||e[41]!==l||e[42]!==s.fields||e[43]!==s.requestId||e[44]!==n||e[45]!==i?(w=l&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx(U,{size:"sm",disabled:n||!d,onClick:()=>l(s.requestId,{action:"accept",content:Hs(s.fields,i)}),children:"Send"}),t.jsx(U,{variant:"ghost",size:"sm",disabled:n,onClick:g,children:"Decline"})]}),e[39]=d,e[40]=g,e[41]=l,e[42]=s.fields,e[43]=s.requestId,e[44]=n,e[45]=i,e[46]=w):w=e[46];let I;return e[47]!==p||e[48]!==m||e[49]!==b||e[50]!==w?(I=t.jsxs(Re,{server:p,children:[m,b,w]}),e[47]=p,e[48]=m,e[49]=b,e[50]=w,e[51]=I):I=e[51],I}function Ys(c){const e=Q.c(55),{id:s,field:n,value:l,disabled:o,onChange:i}=c;if(n.type==="boolean"){const g=l===!0;let m;e[0]!==i?(m=I=>i(I===!0),e[0]=i,e[1]=m):m=e[1];let h;e[2]!==o||e[3]!==s||e[4]!==g||e[5]!==m?(h=t.jsx(os,{id:s,checked:g,disabled:o,onCheckedChange:m}),e[2]=o,e[3]=s,e[4]=g,e[5]=m,e[6]=h):h=e[6];let b;e[7]!==n?(b=t.jsx(Se,{field:n}),e[7]=n,e[8]=b):b=e[8];let w;return e[9]!==s||e[10]!==h||e[11]!==b?(w=t.jsxs(qe,{htmlFor:s,className:"items-start gap-2 font-normal",children:[h,b]}),e[9]=s,e[10]=h,e[11]=b,e[12]=w):w=e[12],w}if(n.type==="enum"){let g;e[13]!==n?(g=t.jsx(Se,{field:n}),e[13]=n,e[14]=g):g=e[14];let m;e[15]!==s||e[16]!==g?(m=t.jsx(qe,{htmlFor:s,children:g}),e[15]=s,e[16]=g,e[17]=m):m=e[17];let h;e[18]!==l?(h=typeof l=="string"&&l?[l]:[],e[18]=l,e[19]=h):h=e[19];let b;e[20]!==i?(b=v=>{v[0]&&i(v[0])},e[20]=i,e[21]=b):b=e[21];const w=n.label;let I;e[22]!==n.options?(I=n.options??[],e[22]=n.options,e[23]=I):I=e[23];let j;if(e[24]!==o||e[25]!==I){let v;e[27]!==o?(v=k=>t.jsx(rs,{value:k.value,disabled:o,className:"w-full justify-start px-3",children:k.label},k.value),e[27]=o,e[28]=v):v=e[28],j=I.map(v),e[24]=o,e[25]=I,e[26]=j}else j=e[26];let N;e[29]!==n.label||e[30]!==s||e[31]!==h||e[32]!==b||e[33]!==j?(N=t.jsx(as,{id:s,value:h,onValueChange:b,orientation:"vertical",variant:"outline",size:"sm",className:"w-full items-stretch","aria-label":w,children:j}),e[29]=n.label,e[30]=s,e[31]=h,e[32]=b,e[33]=j,e[34]=N):N=e[34];let y;return e[35]!==m||e[36]!==N?(y=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,N]}),e[35]=m,e[36]=N,e[37]=y):y=e[37],y}let x;e[38]!==n?(x=t.jsx(Se,{field:n}),e[38]=n,e[39]=x):x=e[39];let a;e[40]!==s||e[41]!==x?(a=t.jsx(qe,{htmlFor:s,children:x}),e[40]=s,e[41]=x,e[42]=a):a=e[42];const d=n.type==="string"?"text":"number",p=typeof l=="string"?l:"";let u;e[43]!==i?(u=g=>i(g.target.value),e[43]=i,e[44]=u):u=e[44];let f;e[45]!==o||e[46]!==n.label||e[47]!==s||e[48]!==d||e[49]!==p||e[50]!==u?(f=t.jsx(Ee,{id:s,"aria-label":n.label,type:d,value:p,disabled:o,onChange:u}),e[45]=o,e[46]=n.label,e[47]=s,e[48]=d,e[49]=p,e[50]=u,e[51]=f):f=e[51];let r;return e[52]!==a||e[53]!==f?(r=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,f]}),e[52]=a,e[53]=f,e[54]=r):r=e[54],r}function Se(c){const e=Q.c(8),{field:s}=c;let n;e[0]!==s.required?(n=s.required&&t.jsx("span",{className:"ml-0.5 text-warning",children:"*"}),e[0]=s.required,e[1]=n):n=e[1];let l;e[2]!==s.description?(l=s.description&&t.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:s.description}),e[2]=s.description,e[3]=l):l=e[3];let o;return e[4]!==s.label||e[5]!==n||e[6]!==l?(o=t.jsxs("span",{className:"min-w-0",children:[s.label,n,l]}),e[4]=s.label,e[5]=n,e[6]=l,e[7]=o):o=e[7],o}function Re(c){const e=Q.c(8),{server:s,children:n}=c;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Es,{className:"text-info"}),e[0]=l):l=e[0];let o;e[1]!==s?(o=t.jsxs(Pe,{children:[s," needs input"]}),e[1]=s,e[2]=o):o=e[2];let i;e[3]!==n?(i=t.jsx("div",{className:"col-start-2 mt-1 min-w-0",children:n}),e[3]=n,e[4]=i):i=e[4];let x;return e[5]!==o||e[6]!==i?(x=t.jsxs(_e,{className:"border-info/40 bg-info/5",children:[l,o,i]}),e[5]=o,e[6]=i,e[7]=x):x=e[7],x}function Gs(c){const e=Q.c(15),{request:s,responding:n,onChoose:l}=c;let o,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Ps,{className:"text-warning"}),i=t.jsx(Pe,{children:"The agent declined this request"}),e[0]=o,e[1]=i):(o=e[0],i=e[1]);let x;e[2]!==s.originalModel?(x=t.jsxs("p",{className:"text-sm leading-relaxed text-foreground",children:[s.originalModel," would not answer. Retrying on a fallback model may work."]}),e[2]=s.originalModel,e[3]=x):x=e[3];let a;e[4]!==s.guidanceText?(a=s.guidanceText&&t.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:s.guidanceText}),e[4]=s.guidanceText,e[5]=a):a=e[5];let d;e[6]!==l||e[7]!==s.fallbackModel||e[8]!==s.requestId||e[9]!==n?(d=l&&t.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t.jsxs(U,{size:"sm",disabled:n,onClick:()=>l(s.requestId,"retry_fallback"),children:["Retry on ",s.fallbackModel]}),t.jsx(U,{variant:"outline",size:"sm",disabled:n,onClick:()=>l(s.requestId,"edit_prompt"),children:"Edit prompt"}),t.jsx(U,{variant:"ghost",size:"sm",disabled:n,className:"ml-auto text-muted-foreground",onClick:()=>l(s.requestId,"cancelled"),children:"Dismiss"})]}),e[6]=l,e[7]=s.fallbackModel,e[8]=s.requestId,e[9]=n,e[10]=d):d=e[10];let p;return e[11]!==x||e[12]!==a||e[13]!==d?(p=t.jsxs(_e,{className:"border-warning/40 bg-warning/5",children:[o,i,t.jsxs("div",{className:"col-start-2 mt-1 min-w-0",children:[x,a,d]})]}),e[11]=x,e[12]=a,e[13]=d,e[14]=p):p=e[14],p}function Xs(c){const e=Q.c(64),{request:s,input:n,canAnswer:l,onOpen:o}=c;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];const[x,a]=G.useState(i),{sessionId:d}=s;switch(s.kind){case"permission":{const p=s.request;let u;e[1]!==n.responding||e[2]!==s.request.requestId?(u=n.responding.has(s.request.requestId),e[1]=n.responding,e[2]=s.request.requestId,e[3]=u):u=e[3];let f;e[4]!==l||e[5]!==n||e[6]!==d?(f=l?(g,m)=>void n.respond(d,g,m):void 0,e[4]=l,e[5]=n,e[6]=d,e[7]=f):f=e[7];let r;return e[8]!==s.request||e[9]!==u||e[10]!==f?(r=t.jsx(ds,{request:p,queued:0,responding:u,onRespond:f}),e[8]=s.request,e[9]=u,e[10]=f,e[11]=r):r=e[11],r}case"question":{const p=s.request;let u;e[12]!==n.responding||e[13]!==s.request.toolUseId?(u=n.responding.has(s.request.toolUseId),e[12]=n.responding,e[13]=s.request.toolUseId,e[14]=u):u=e[14];let f;e[15]!==x||e[16]!==s.request.toolUseId?(f=x.has(s.request.toolUseId),e[15]=x,e[16]=s.request.toolUseId,e[17]=f):f=e[17];let r;e[18]!==l||e[19]!==n||e[20]!==d?(r=l?async(m,h)=>{(await n.answerQuestion(d,m,h)).gone&&a(w=>new Set(w).add(m))}:void 0,e[18]=l,e[19]=n,e[20]=d,e[21]=r):r=e[21];let g;return e[22]!==o||e[23]!==s.request||e[24]!==u||e[25]!==f||e[26]!==r?(g=t.jsx(cs,{request:p,responding:u,gone:f,onAnswer:r,onOpenSession:o}),e[22]=o,e[23]=s.request,e[24]=u,e[25]=f,e[26]=r,e[27]=g):g=e[27],g}case"elicitation":{const p=s.request;let u;e[28]!==n.responding||e[29]!==s.request.requestId?(u=n.responding.has(s.request.requestId),e[28]=n.responding,e[29]=s.request.requestId,e[30]=u):u=e[30];let f;e[31]!==l||e[32]!==n||e[33]!==d?(f=l?(g,m)=>void n.answerElicitation(d,g,m):void 0,e[31]=l,e[32]=n,e[33]=d,e[34]=f):f=e[34];let r;return e[35]!==s.request||e[36]!==u||e[37]!==f?(r=t.jsx(Vs,{request:p,responding:u,onAnswer:f}),e[35]=s.request,e[36]=u,e[37]=f,e[38]=r):r=e[38],r}case"dialog":{const p=s.request;let u;e[39]!==n.responding||e[40]!==s.request.requestId?(u=n.responding.has(s.request.requestId),e[39]=n.responding,e[40]=s.request.requestId,e[41]=u):u=e[41];let f;e[42]!==l||e[43]!==n||e[44]!==d?(f=l?(g,m)=>void n.answerDialog(d,g,m):void 0,e[42]=l,e[43]=n,e[44]=d,e[45]=f):f=e[45];let r;return e[46]!==s.request||e[47]!==u||e[48]!==f?(r=t.jsx(Gs,{request:p,responding:u,onChoose:f}),e[46]=s.request,e[47]=u,e[48]=f,e[49]=r):r=e[49],r}case"plan":case"deferred":{let p;e[50]!==s.kind?(p=s.kind==="plan"?t.jsx(_s,{className:"text-warning"}):t.jsx(Ms,{className:"text-warning"}),e[50]=s.kind,e[51]=p):p=e[51];const u=s.kind==="plan"?"A plan is waiting for review":"A permission was deferred";let f;e[52]!==u?(f=t.jsx(Pe,{children:u}),e[52]=u,e[53]=f):f=e[53];const r=s.kind==="plan"?"Review it in its session.":"Open the session and resume it to answer.";let g;e[54]!==r?(g=t.jsx("p",{className:"col-start-2 mt-1 text-sm text-muted-foreground",children:r}),e[54]=r,e[55]=g):g=e[55];let m;e[56]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ue,{"data-icon":"inline-end"}),e[56]=m):m=e[56];let h;e[57]!==o?(h=t.jsx("div",{className:"col-start-2 mt-2",children:t.jsxs(U,{size:"xs",onClick:o,children:["Open session",m]})}),e[57]=o,e[58]=h):h=e[58];let b;return e[59]!==p||e[60]!==f||e[61]!==g||e[62]!==h?(b=t.jsxs(_e,{className:"border-warning/40 bg-warning/5",children:[p,f,g,h]}),e[59]=p,e[60]=f,e[61]=g,e[62]=h,e[63]=b):b=e[63],b}}}function Ws(c,e,s=()=>!0){const n=new Map(e.map(i=>[i.sessionId,i])),l=i=>{const x=n.get(i);return x?De(x):Date.now()},o=[];for(const[i,x]of c.permissionsBySession)for(const a of x)o.push({kind:"permission",sessionId:i,since:a.timestamp,request:a});for(const[i,x]of c.questionsBySession)for(const a of x)o.push({kind:"question",sessionId:i,since:a.askedAt,request:a});for(const[i,x]of c.elicitationsBySession)for(const a of x)o.push({kind:"elicitation",sessionId:i,since:a.askedAt,request:a});for(const[i,x]of c.dialogsBySession)for(const a of x)o.push({kind:"dialog",sessionId:i,since:a.askedAt,request:a});for(const i of c.awaitingPlan)o.push({kind:"plan",sessionId:i,since:l(i)});for(const i of e)i.agentStatus==="deferred"&&!i.archived&&o.push({kind:"deferred",sessionId:i.sessionId,since:l(i.sessionId)});return o.filter(i=>s(i.sessionId)).sort((i,x)=>i.since-x.since)}function Te(c){switch(c.kind){case"permission":return c.request.requestId;case"question":return c.request.toolUseId;case"elicitation":case"dialog":return c.request.requestId;default:return`${c.kind}:${c.sessionId}`}}const Js=7*864e5,Ke=3,Zs=30,et=50,$e={"needs-you":0,working:1,done:2};function st(c,e){const s=c.filter(o=>!o.archived&&!(o.teamName&&o.agentName)),{topLevel:n,crewOf:l}=us(s);return n.map(o=>{const i=l.get(o.sessionId)??[],x=i.length?fs(o,i):o.lastActivityAt||o.lastModified,a=[o,...i].flatMap(d=>(d.pullRequests??[]).map(p=>({pullRequest:p,by:d}))).sort((d,p)=>Date.parse(p.pullRequest.timestamp)-Date.parse(d.pullRequest.timestamp))[0];return{session:o,state:e(o).state,crew:i.map(d=>({member:d,state:e(d).state})).sort((d,p)=>$e[d.state]-$e[p.state]||De(p.member)-De(d.member)),counts:i.length?ms(i,e):null,activityAt:x,...a&&{landed:{number:a.pullRequest.number,title:a.pullRequest.title,url:a.pullRequest.url,by:a.by}}}}).sort((o,i)=>Date.parse(i.activityAt)-Date.parse(o.activityAt))}function tt(c,e=Date.now()){const s=c.filter(n=>e-Date.parse(n.activityAt)<Js);return(s.length>=Ke?s:c.slice(0,Ke)).slice(0,Zs)}function nt(c,e,s=6){const n=[],l=new Set;for(const o of c){const i=e(o.session);if(!(!i.cwd||l.has(i.cwd))&&(l.add(i.cwd),n.push(i),n.length===s))break}return n}function it(c,e,s){const n=e.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?[]:c.filter(l=>{const o=s(l).filter(Boolean).join(`
2
+ `).toLowerCase();return n.every(i=>o.includes(i))}).slice(0,et)}const ze={"needs-you":ve.attention,working:ve.working,done:"bg-muted-foreground/40"},lt={"needs-you":"needs you",working:"working",done:"done"},ot=3;function rt(c,e){const s=c.cwd?Cs(c.cwd):null,n=(s==null?void 0:s.parentPath)??c.cwd,l=s?Ae(Le(c.dirName),s.parentPath):c.dirName;return{dirName:l,cwd:n,name:e[l]??(n?Fe(n):c.projectShortName)}}function at(c){const e=c.target instanceof HTMLElement&&c.target.closest("input,textarea,select,[contenteditable=true]");return!c.metaKey&&!c.ctrlKey&&!c.altKey&&!e}function vt(c){const e=Q.c(81),{onOpenSession:s,onBrowseProjects:n,start:l}=c,o=xs(),i=gs(),{names:x,rename:a}=ps(),{names:d}=hs(),p=bs(),[u,f]=G.useState(""),r=G.useRef(null);let g;e[0]!==o.sessions?(g=o.sessions.filter(ut),e[0]=o.sessions,e[1]=g):g=e[1];const m=g;let h;e[2]!==m?(h=new Map(m.map(dt)),e[2]=m,e[3]=h):h=e[3];const b=h;let w;e[4]!==i.awaitingDialog||e[5]!==i.awaitingElicitation?(w=new Set([...i.awaitingElicitation,...i.awaitingDialog]),e[4]=i.awaitingDialog,e[5]=i.awaitingElicitation,e[6]=w):w=e[6];let I;e[7]!==i.awaitingPermission||e[8]!==i.awaitingPlan||e[9]!==i.awaitingQuestion||e[10]!==w?(I={awaitingPermission:i.awaitingPermission,awaitingQuestion:i.awaitingQuestion,awaitingPrompt:w,awaitingPlan:i.awaitingPlan},e[7]=i.awaitingPermission,e[8]=i.awaitingPlan,e[9]=i.awaitingQuestion,e[10]=w,e[11]=I):I=e[11];const j=I;let N;e[12]!==o.procBySession||e[13]!==j?(N=T=>Is(T,o.procBySession,j),e[12]=o.procBySession,e[13]=j,e[14]=N):N=e[14];const y=N;let v;e[15]!==b||e[16]!==p?(v=T=>{const R=b.get(T);return p(R==null?void 0:R.access).canInteract},e[15]=b,e[16]=p,e[17]=v):v=e[17];const k=v;let D;e[18]!==k||e[19]!==i||e[20]!==m?(D=Ws(i,m,k),e[18]=k,e[19]=i,e[20]=m,e[21]=D):D=e[21];const A=D;let q;e[22]!==b||e[23]!==x?(q=T=>ks(T,b,x),e[22]=b,e[23]=x,e[24]=q):q=e[24];const S=q;let _;e[25]!==d?(_=T=>d[T.dirName]??qs(T),e[25]=d,e[26]=_):_=e[26];const O=_;let M,P,z;if(e[27]!==S||e[28]!==O||e[29]!==d||e[30]!==u||e[31]!==m||e[32]!==y){M=st(m,y),z=u.trim().length>0?it(M,u,K=>{var se;return[S(K.session.sessionId),O(K.session),K.session.gitBranch,K.session.cwd,K.session.lastUserMessage,K.session.firstUserMessage,(se=K.landed)==null?void 0:se.title,K.landed&&`#${K.landed.number}`,...K.crew.map(re=>{const{member:we}=re;return S(we.sessionId)})]}):tt(M);let R;e[36]!==d?(R=K=>rt(K,d),e[36]=d,e[37]=R):R=e[37],P=nt(M,R),e[27]=S,e[28]=O,e[29]=d,e[30]=u,e[31]=m,e[32]=y,e[33]=M,e[34]=P,e[35]=z}else M=e[33],P=e[34],z=e[35];const H=P;let L;e[38]!==b||e[39]!==s?(L=T=>{const R=b.get(T);R?s(R.dirName,R.fileName):Ss(T)},e[38]=b,e[39]=s,e[40]=L):L=e[40];const F=L;let V;e[41]!==o.processes?(V=o.processes.filter(ct),e[41]=o.processes,e[42]=V):V=e[42];const C=V.length;let $,Y;e[43]===Symbol.for("react.memo_cache_sentinel")?($=()=>{const T=R=>{var K;R.key==="/"&&at(R)&&(R.preventDefault(),(K=r.current)==null||K.focus())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},Y=[],e[43]=$,e[44]=Y):($=e[43],Y=e[44]),G.useEffect($,Y);let B;e[45]===Symbol.for("react.memo_cache_sentinel")?(B=t.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Mission Control"}),e[45]=B):B=e[45];let X;e[46]!==C?(X=C>0&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[C," ",C===1?"agent":"agents"," running on this machine"]}),e[46]=C,e[47]=X):X=e[47];let J;e[48]!==X?(J=t.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1",children:[B,X]}),e[48]=X,e[49]=J):J=e[49];let ne;e[50]!==H||e[51]!==l?(ne=l&&t.jsx(Bs,{recent:H,start:l}),e[50]=H,e[51]=l,e[52]=ne):ne=e[52];let ie;e[53]!==J||e[54]!==ne?(ie=t.jsxs("div",{className:"mx-auto flex w-full max-w-6xl shrink-0 flex-col gap-8 px-6 pt-16 lg:px-10",children:[J,ne]}),e[53]=J,e[54]=ne,e[55]=ie):ie=e[55];const be=A.length>0&&"lg:grid lg:grid-cols-[minmax(0,380px)_minmax(0,1fr)] lg:grid-rows-[minmax(0,1fr)]";let le;e[56]!==be?(le=te("mx-auto flex w-full max-w-6xl flex-col gap-8 px-6 pb-10 pt-10 lg:h-full lg:px-10",be),e[56]=be,e[57]=le):le=e[57];let oe;e[58]!==b||e[59]!==k||e[60]!==i||e[61]!==S||e[62]!==F||e[63]!==A?(oe=A.length>0?t.jsx(ft,{queue:A,input:i,byId:b,nameOf:S,onOpen:F,canAnswer:k}):t.jsxs("p",{className:"flex shrink-0 items-center gap-2 text-xs text-muted-foreground",children:[t.jsx("span",{className:"size-1.5 rounded-full bg-success/40","aria-hidden":"true"}),"Nothing is waiting on you."]}),e[58]=b,e[59]=k,e[60]=i,e[61]=S,e[62]=F,e[63]=A,e[64]=oe):oe=e[64];let Z;e[65]!==S||e[66]!==n||e[67]!==F||e[68]!==O||e[69]!==u||e[70]!==a||e[71]!==M.length||e[72]!==z?(Z=t.jsx(xt,{sessions:z,total:M.length,query:u,onQueryChange:f,searchRef:r,nameOf:S,projectLabel:O,onOpen:F,onRename:a,onBrowseProjects:n}),e[65]=S,e[66]=n,e[67]=F,e[68]=O,e[69]=u,e[70]=a,e[71]=M.length,e[72]=z,e[73]=Z):Z=e[73];let ee;e[74]!==le||e[75]!==oe||e[76]!==Z?(ee=t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto lg:overflow-hidden",children:t.jsxs("div",{className:le,children:[oe,Z]})}),e[74]=le,e[75]=oe,e[76]=Z,e[77]=ee):ee=e[77];let W;return e[78]!==ie||e[79]!==ee?(W=t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ie,ee]}),e[78]=ie,e[79]=ee,e[80]=W):W=e[80],W}function ct(c){return c.sessionId}function dt(c){return[c.sessionId,c]}function ut(c){return!c.archived}function He(c){const e=Q.c(9),{title:s,count:n,children:l}=c;let o;e[0]!==s?(o=t.jsx("h2",{className:"text-sm font-medium",children:s}),e[0]=s,e[1]=o):o=e[1];let i;e[2]!==n?(i=n!==void 0&&t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n}),e[2]=n,e[3]=i):i=e[3];let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("span",{className:"flex-1"}),e[4]=x):x=e[4];let a;return e[5]!==l||e[6]!==o||e[7]!==i?(a=t.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[o,i,x,l]}),e[5]=l,e[6]=o,e[7]=i,e[8]=a):a=e[8],a}function Ce(c,e){const s=c==null?void 0:c.crew;return s?e(s.rootId)??s.rootTitle??null:null}const Be={permission:"asked a permission",question:"asked a question",elicitation:"asked for input",dialog:"needs a choice",plan:"has a plan to review",deferred:"has a deferred permission"};function ft(c){const e=Q.c(71),{queue:s,input:n,byId:l,nameOf:o,onOpen:i,canAnswer:x}=c,[a,d]=G.useState(0);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];const u=G.useRef(p),f=Math.min(a,s.length-1),r=s[f];let g;if(e[1]!==l||e[2]!==o||e[3]!==r.sessionId){const C=l.get(r.sessionId);g=Ce(C,o),e[1]=l,e[2]=o,e[3]=r.sessionId,e[4]=g}else g=e[4];const m=g;let h;e[5]!==f||e[6]!==x||e[7]!==n||e[8]!==i||e[9]!==s.length||e[10]!==r.kind||e[11]!==r.request||e[12]!==r.sessionId?(h=C=>{const $=C.target;if(!($.closest("input,textarea,select,[contenteditable=true]")||C.metaKey||C.ctrlKey||C.altKey)&&((C.key==="j"||C.key==="n"||C.key==="ArrowDown")&&(C.preventDefault(),d(Math.min(s.length-1,f+1))),(C.key==="k"||C.key==="ArrowUp")&&(C.preventDefault(),d(Math.max(0,f-1))),C.key==="o"&&(C.preventDefault(),i(r.sessionId)),(C.key==="Enter"||C.key==="d")&&$===C.currentTarget&&x(r.sessionId))){if(r.kind!=="permission")return;const Y=C.key==="d"||r.request.defaultToNo?"deny":"allow",B=r.request.requestId;if(r.request.availableDecisions&&!r.request.availableDecisions.includes(Y)||(C.preventDefault(),u.current.has(B)||n.responding.has(B)))return;u.current.add(B),n.respond(r.sessionId,B,Y).finally(()=>u.current.delete(B))}},e[5]=f,e[6]=x,e[7]=n,e[8]=i,e[9]=s.length,e[10]=r.kind,e[11]=r.request,e[12]=r.sessionId,e[13]=h):h=e[13];const b=h;let w;e[14]!==f||e[15]!==s.length?(w=s.length>1&&t.jsxs("span",{className:"flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[f+1," of ",s.length,t.jsx(U,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:f===0,onClick:()=>d(f-1),children:t.jsx(Os,{"data-icon":"inline-start"})}),t.jsx(U,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:f===s.length-1,onClick:()=>d(f+1),children:t.jsx(Ue,{"data-icon":"inline-start"})})]}),e[14]=f,e[15]=s.length,e[16]=w):w=e[16];let I;e[17]!==s.length||e[18]!==w?(I=t.jsx(He,{title:"Needs you",count:s.length,children:w}),e[17]=s.length,e[18]=w,e[19]=I):I=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-warning","aria-hidden":"true"}),e[20]=j):j=e[20];let N;e[21]!==i||e[22]!==r.sessionId?(N=()=>i(r.sessionId),e[21]=i,e[22]=r.sessionId,e[23]=N):N=e[23];let y;e[24]!==o||e[25]!==r.sessionId?(y=o(r.sessionId)??"A session",e[24]=o,e[25]=r.sessionId,e[26]=y):y=e[26];let v;e[27]!==N||e[28]!==y?(v=t.jsx("button",{type:"button",onClick:N,className:"min-w-0 truncate rounded-sm font-medium outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:y}),e[27]=N,e[28]=y,e[29]=v):v=e[29];let k;e[30]!==m?(k=m&&t.jsxs("span",{className:"min-w-0 truncate text-muted-foreground",children:["· ",m]}),e[30]=m,e[31]=k):k=e[31];let D;e[32]!==r.since?(D=je(new Date(r.since).toISOString()),e[32]=r.since,e[33]=D):D=e[33];let A;e[34]!==D?(A=t.jsxs("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-warning",children:["waiting ",D]}),e[34]=D,e[35]=A):A=e[35];let q;e[36]!==k||e[37]!==A||e[38]!==v?(q=t.jsxs("div",{className:"flex items-center gap-2 px-0.5 text-[13px]",children:[j,v,k,A]}),e[36]=k,e[37]=A,e[38]=v,e[39]=q):q=e[39];const S=Be[r.kind];let _;e[40]!==S?(_=t.jsx("p",{className:"px-0.5 text-xs text-muted-foreground",children:S}),e[40]=S,e[41]=_):_=e[41];let O;e[42]!==r?(O=Te(r),e[42]=r,e[43]=O):O=e[43];let M;e[44]!==x||e[45]!==r.sessionId?(M=x(r.sessionId),e[44]=x,e[45]=r.sessionId,e[46]=M):M=e[46];let P;e[47]!==i||e[48]!==r.sessionId?(P=()=>i(r.sessionId),e[47]=i,e[48]=r.sessionId,e[49]=P):P=e[49];let z;e[50]!==n||e[51]!==r||e[52]!==O||e[53]!==M||e[54]!==P?(z=t.jsx(Xs,{request:r,input:n,canAnswer:M,onOpen:P},O),e[50]=n,e[51]=r,e[52]=O,e[53]=M,e[54]=P,e[55]=z):z=e[55];let H;e[56]!==q||e[57]!==_||e[58]!==z?(H=t.jsxs("div",{className:"flex flex-col gap-2",children:[q,_,z]}),e[56]=q,e[57]=_,e[58]=z,e[59]=H):H=e[59];let L;e[60]!==f||e[61]!==l||e[62]!==o||e[63]!==s?(L=s.length>1&&t.jsx("ol",{className:"mt-3 flex flex-col","aria-label":"Also waiting",children:s.map((C,$)=>$===f?null:t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>d($),className:"grid w-full grid-cols-[18px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-lg px-2 py-2 text-left text-[12.5px] outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsx("span",{className:"text-right text-[11px] tabular-nums text-muted-foreground/80",children:$+1}),t.jsxs("span",{className:"flex min-w-0 flex-col",children:[t.jsxs("span",{className:"truncate font-medium",children:[o(C.sessionId)??"A session",Ce(l.get(C.sessionId),o)&&t.jsxs("span",{className:"font-normal text-muted-foreground",children:[" · ",Ce(l.get(C.sessionId),o)]})]}),t.jsx("span",{className:"truncate text-[11.5px] text-muted-foreground",children:Be[C.kind]})]}),t.jsx("span",{className:"text-[11px] tabular-nums text-warning",children:je(new Date(C.since).toISOString())})]})},Te(C)))}),e[60]=f,e[61]=l,e[62]=o,e[63]=s,e[64]=L):L=e[64];let F;e[65]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx("p",{className:"mt-2 px-0.5 text-[11px] text-muted-foreground/80",children:"J / K move · Enter answers · D denies · O opens"}),e[65]=F):F=e[65];let V;return e[66]!==b||e[67]!==H||e[68]!==L||e[69]!==I?(V=t.jsxs("section",{"aria-label":"Needs you",tabIndex:0,onKeyDown:b,className:"min-w-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring lg:min-h-0 lg:overflow-y-auto",children:[I,H,L,F]}),e[66]=b,e[67]=H,e[68]=L,e[69]=I,e[70]=V):V=e[70],V}function mt(c){var e,s;return c.state==="needs-you"||(((e=c.counts)==null?void 0:e.needsYou)??0)>0?ve.attention:c.state==="working"||(((s=c.counts)==null?void 0:s.working)??0)>0?ve.working:null}function xt(c){const e=Q.c(39),{sessions:s,total:n,query:l,onQueryChange:o,searchRef:i,nameOf:x,projectLabel:a,onOpen:d,onRename:p,onBrowseProjects:u}=c;let f;e[0]!==l?(f=l.trim(),e[0]=l,e[1]=f):f=e[1];const r=f.length>0;let g;e[2]!==o||e[3]!==i?(g=()=>{var q;o(""),(q=i.current)==null||q.focus()},e[2]=o,e[3]=i,e[4]=g):g=e[4];const m=g,h=r?s.length:n;let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Rs,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground","aria-hidden":"true"}),e[5]=b):b=e[5];let w;e[6]!==o?(w=q=>o(q.target.value),e[6]=o,e[7]=w):w=e[7];let I;e[8]!==m||e[9]!==i?(I=q=>{var S;q.key==="Escape"&&(q.preventDefault(),m(),(S=i.current)==null||S.blur())},e[8]=m,e[9]=i,e[10]=I):I=e[10];let j;e[11]!==l||e[12]!==i||e[13]!==w||e[14]!==I?(j=t.jsx(Ee,{ref:i,type:"search","aria-label":"Search sessions",placeholder:"Search sessions",value:l,onChange:w,onKeyDown:I,className:"h-7 pl-8 pr-7 text-xs [&::-webkit-search-cancel-button]:hidden"}),e[11]=l,e[12]=i,e[13]=w,e[14]=I,e[15]=j):j=e[15];let N;e[16]!==m||e[17]!==r?(N=r?t.jsx("button",{type:"button","aria-label":"Clear search",onClick:m,className:"absolute right-1.5 top-1/2 flex size-4 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:t.jsx(Ts,{className:"size-3"})}):t.jsx("kbd",{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 font-mono text-[10px] text-muted-foreground/70","aria-hidden":"true",children:"/"}),e[16]=m,e[17]=r,e[18]=N):N=e[18];let y;e[19]!==j||e[20]!==N?(y=t.jsxs("div",{className:"relative w-full max-w-64",children:[b,j,N]}),e[19]=j,e[20]=N,e[21]=y):y=e[21];let v;e[22]!==u?(v=u&&t.jsxs(U,{variant:"ghost",size:"xs",className:"text-muted-foreground",onClick:u,children:[t.jsx(Me,{"data-icon":"inline-start"}),"All projects"]}),e[22]=u,e[23]=v):v=e[23];let k;e[24]!==v||e[25]!==h||e[26]!==y?(k=t.jsxs(He,{title:"Your sessions",count:h,children:[y,v]}),e[24]=v,e[25]=h,e[26]=y,e[27]=k):k=e[27];let D;e[28]!==x||e[29]!==d||e[30]!==p||e[31]!==a||e[32]!==l||e[33]!==r||e[34]!==s?(D=s.length===0?t.jsx(ws,{children:t.jsx(js,{children:t.jsx(Ns,{children:r?`No session matches “${l.trim()}”.`:"Start a session and it shows up here, with every session it starts."})})}):t.jsx("ul",{className:"flex flex-col lg:min-h-0 lg:flex-1 lg:overflow-y-auto",children:s.map(q=>t.jsx(gt,{entry:q,nameOf:x,projectLabel:a,onOpen:d,onRename:p},q.session.sessionId))}),e[28]=x,e[29]=d,e[30]=p,e[31]=a,e[32]=l,e[33]=r,e[34]=s,e[35]=D):D=e[35];let A;return e[36]!==k||e[37]!==D?(A=t.jsxs("section",{"aria-label":"Your sessions",className:"flex min-w-0 flex-col lg:min-h-0 lg:flex-1",children:[k,D]}),e[36]=k,e[37]=D,e[38]=A):A=e[38],A}function gt(c){const e=Q.c(60),{entry:s,nameOf:n,projectLabel:l,onOpen:o,onRename:i}=c,[x,a]=G.useState(null),{session:d}=s;let p;e[0]!==n||e[1]!==d.sessionId?(p=n(d.sessionId)??"Untitled session",e[0]=n,e[1]=d.sessionId,e[2]=p):p=e[2];const u=p;let f;e[3]!==d?(f=ys(d),e[3]=d,e[4]=f):f=e[4];const r=f;let g,m;if(e[5]!==x||e[6]!==s||e[7]!==n||e[8]!==o||e[9]!==i||e[10]!==r||e[11]!==l||e[12]!==d||e[13]!==u){const I=mt(s);let j;e[16]!==x||e[17]!==i||e[18]!==r||e[19]!==d.sessionId||e[20]!==u?(j=()=>{if(x===null)return;const P=x.trim();a(null),P!==u&&i(d.sessionId,P===r?"":P)},e[16]=x,e[17]=i,e[18]=r,e[19]=d.sessionId,e[20]=u,e[21]=j):j=e[21];const N=j;let y;e[22]!==s.counts||e[23]!==d.isActive?(y=s.counts?t.jsxs(t.Fragment,{children:[s.counts.working>0&&t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:s.counts.working})," working"]}),s.counts.needsYou>0&&t.jsxs("span",{className:"text-warning",children:[t.jsx("span",{className:"font-medium tabular-nums",children:s.counts.needsYou})," need you"]}),t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:s.counts.size})," in crew"]})]}):d.isActive&&t.jsx("span",{children:"working"}),e[22]=s.counts,e[23]=d.isActive,e[24]=y):y=e[24];let v;e[25]!==y?(v=t.jsx("span",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:y}),e[25]=y,e[26]=v):v=e[26];let k;e[27]!==s.landed?(k=s.landed&&t.jsxs(vs,{variant:"outline",className:"shrink-0",children:["#",s.landed.number]}),e[27]=s.landed,e[28]=k):k=e[28];let D;e[29]!==s.landed||e[30]!==n||e[31]!==d.lastUserMessage?(D=s.landed?`${s.landed.title??"Pull request"} · ${n(s.landed.by.sessionId)??""}`:d.lastUserMessage??"",e[29]=s.landed,e[30]=n,e[31]=d.lastUserMessage,e[32]=D):D=e[32];let A;e[33]!==D?(A=t.jsx("span",{className:"truncate",children:D}),e[33]=D,e[34]=A):A=e[34];let q;e[35]!==A||e[36]!==k?(q=t.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[k,A]}),e[35]=A,e[36]=k,e[37]=q):q=e[37];let S;e[38]!==s.activityAt||e[39]!==s.counts?(S=s.counts?`crew active ${je(s.activityAt)}`:je(s.activityAt),e[38]=s.activityAt,e[39]=s.counts,e[40]=S):S=e[40];let _;e[41]!==S?(_=t.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:S}),e[41]=S,e[42]=_):_=e[42];let O;e[43]!==q||e[44]!==_||e[45]!==v?(O=t.jsxs(t.Fragment,{children:[v,q,_]}),e[43]=q,e[44]=_,e[45]=v,e[46]=O):O=e[46];const M=O;g="group/row relative border-t border-border/70 first:border-t-0",m=x===null?t.jsxs("button",{type:"button",onClick:()=>o(d.sessionId),className:te("grid w-full grid-cols-1 items-center gap-x-4 gap-y-1 rounded-lg py-3 pl-3 pr-10 text-left xl:grid-cols-[minmax(0,1fr)_auto]","outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring"),children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[I&&t.jsx("span",{className:te("size-1.5 shrink-0 rounded-full",I),"aria-hidden":"true"}),t.jsx("span",{className:"truncate text-[13.5px] font-medium",children:u}),t.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground sm:inline",children:l(d)})]}),M]}):t.jsxs("div",{className:"grid w-full grid-cols-1 items-center gap-x-4 gap-y-1 rounded-lg py-3 pl-3 pr-10 text-left xl:grid-cols-[minmax(0,1fr)_auto]",children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[I&&t.jsx("span",{className:te("size-1.5 shrink-0 rounded-full",I),"aria-hidden":"true"}),t.jsx(Ee,{autoFocus:!0,"aria-label":"Session name",value:x,placeholder:r,onChange:P=>a(P.target.value),onFocus:pt,onBlur:N,onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),N()),P.key==="Escape"&&(P.preventDefault(),a(null))},className:"h-7 max-w-md text-[13.5px] font-medium"}),t.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground sm:inline",children:l(d)})]}),M]}),e[5]=x,e[6]=s,e[7]=n,e[8]=o,e[9]=i,e[10]=r,e[11]=l,e[12]=d,e[13]=u,e[14]=g,e[15]=m}else g=e[14],m=e[15];let h;e[47]!==s||e[48]!==n||e[49]!==o||e[50]!==u?(h=s.crew.length>0&&t.jsx(ht,{entry:s,title:u,nameOf:n,onOpen:o}),e[47]=s,e[48]=n,e[49]=o,e[50]=u,e[51]=h):h=e[51];let b;e[52]!==x||e[53]!==u?(b=x===null&&t.jsx(U,{variant:"ghost",size:"icon-xs","aria-label":`Rename ${u}`,title:"Rename",onClick:()=>a(u),className:"absolute right-2 top-2.5 text-muted-foreground opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100",children:t.jsx(Ks,{"data-icon":"icon"})}),e[52]=x,e[53]=u,e[54]=b):b=e[54];let w;return e[55]!==g||e[56]!==m||e[57]!==h||e[58]!==b?(w=t.jsxs("li",{className:g,children:[m,h,b]}),e[55]=g,e[56]=m,e[57]=h,e[58]=b,e[59]=w):w=e[59],w}function pt(c){return c.target.select()}function ht(c){const e=Q.c(50),{entry:s,title:n,nameOf:l,onOpen:o}=c,[i,x]=G.useState(!1);let a,d,p,u,f,r,g,m;if(e[0]!==s.crew||e[1]!==s.session||e[2]!==i||e[3]!==l||e[4]!==o||e[5]!==n){a=s.crew.filter(bt),d=a.slice(0,ot);let A;e[14]!==s.session||e[15]!==l?(A=q=>{var _;const S=(_=q.crew)==null?void 0:_.parentId;return S&&S!==s.session.sessionId?l(S):void 0},e[14]=s.session,e[15]=l,e[16]=A):A=e[16],m=A,g="-mt-1.5 flex flex-col gap-1.5 px-3 pb-3",p="group",u=`${n} crew`,f="flex min-w-0 flex-wrap items-center gap-1.5",r=!i&&d.map(q=>{const{member:S,state:_}=q;return t.jsxs("button",{type:"button","aria-label":`Open ${l(S.sessionId)??"crew member"}`,onClick:()=>o(S.sessionId),className:"flex max-w-56 items-center gap-1.5 rounded-md border border-border/70 px-2 py-0.5 text-xs outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsx("span",{className:te("size-1.5 shrink-0 rounded-full",ze[_]),"aria-hidden":"true"}),t.jsx("span",{className:"truncate",children:l(S.sessionId)??"Crew member"})]},S.sessionId)}),e[0]=s.crew,e[1]=s.session,e[2]=i,e[3]=l,e[4]=o,e[5]=n,e[6]=a,e[7]=d,e[8]=p,e[9]=u,e[10]=f,e[11]=r,e[12]=g,e[13]=m}else a=e[6],d=e[7],p=e[8],u=e[9],f=e[10],r=e[11],g=e[12],m=e[13];let h;e[17]!==i||e[18]!==a||e[19]!==d?(h=!i&&a.length>d.length&&t.jsxs("span",{className:"text-xs tabular-nums text-muted-foreground",children:["+",a.length-d.length," more"]}),e[17]=i,e[18]=a,e[19]=d,e[20]=h):h=e[20];let b;e[21]!==i?(b=()=>x(!i),e[21]=i,e[22]=b):b=e[22];const w=i&&"rotate-180";let I;e[23]!==w?(I=te("transition-transform",w),e[23]=w,e[24]=I):I=e[24];let j;e[25]!==I?(j=t.jsx($s,{"data-icon":"inline-start",className:I}),e[25]=I,e[26]=j):j=e[26];const N=i?"Hide crew":`Show crew (${s.crew.length})`;let y;e[27]!==i||e[28]!==j||e[29]!==N||e[30]!==b?(y=t.jsxs(U,{variant:"ghost",size:"xs","aria-expanded":i,onClick:b,className:"text-muted-foreground",children:[j,N]}),e[27]=i,e[28]=j,e[29]=N,e[30]=b,e[31]=y):y=e[31];let v;e[32]!==p||e[33]!==y||e[34]!==u||e[35]!==f||e[36]!==r||e[37]!==h?(v=t.jsxs("div",{role:p,"aria-label":u,className:f,children:[r,h,y]}),e[32]=p,e[33]=y,e[34]=u,e[35]=f,e[36]=r,e[37]=h,e[38]=v):v=e[38];let k;e[39]!==s.crew||e[40]!==i||e[41]!==l||e[42]!==o||e[43]!==n||e[44]!==m?(k=i&&t.jsx("ul",{"aria-label":`${n} crew members`,className:"flex max-h-72 flex-col overflow-y-auto rounded-md border border-border/70",children:s.crew.map(A=>{const{member:q,state:S}=A;return t.jsx("li",{children:t.jsxs("button",{type:"button","aria-label":`Open ${l(q.sessionId)??"crew member"}`,onClick:()=>o(q.sessionId),className:"grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 px-2.5 py-1.5 text-left text-xs outline-none hover:bg-accent focus-visible:bg-accent",children:[t.jsx("span",{className:te("size-1.5 rounded-full",ze[S]),"aria-hidden":"true"}),t.jsxs("span",{className:"truncate",children:[l(q.sessionId)??"Crew member",m(q)&&t.jsxs("span",{className:"text-muted-foreground",children:[" · via ",m(q)]})]}),t.jsx("span",{className:te("tabular-nums text-muted-foreground",S==="needs-you"&&"text-warning"),children:S==="done"?je(q.lastActivityAt||q.lastModified):lt[S]})]})},q.sessionId)})}),e[39]=s.crew,e[40]=i,e[41]=l,e[42]=o,e[43]=n,e[44]=m,e[45]=k):k=e[45];let D;return e[46]!==v||e[47]!==k||e[48]!==g?(D=t.jsxs("div",{className:g,children:[v,k]}),e[46]=v,e[47]=k,e[48]=g,e[49]=D):D=e[49],D}function bt(c){const{state:e}=c;return e!=="done"}export{vt as MissionHome};
@@ -1 +1 @@
1
- import{r as x,c as d,j as s}from"./vendor-react-gGw_S5I_.js";import{O as p,Q as f,T as j,N as g,Y as C,M as S}from"./index-BvNyEUVG.js";import"./vendor-ui-keo4oB2X.js";import"./vendor-markdown-BEJ8yVzA.js";const F=x.memo(function(c){const e=d.c(10),{open:l,onClose:a,session:r,sessionChangeKey:h}=c;let i;e[0]!==a?(i=m=>{m||a()},e[0]=a,e[1]=i):i=e[1];let t;e[2]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs(p,{className:"shrink-0 px-4 py-3",children:[s.jsx(f,{children:"File changes"}),s.jsx(j,{className:"sr-only",children:"Review files changed in this session."})]}),e[2]=t):t=e[2];let n;e[3]!==r||e[4]!==h?(n=s.jsxs(g,{side:"bottom",className:"h-[72svh] max-h-[92svh] rounded-t-xl",children:[t,s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(C,{session:r,sessionChangeKey:h})})]}),e[3]=r,e[4]=h,e[5]=n):n=e[5];let o;return e[6]!==l||e[7]!==i||e[8]!==n?(o=s.jsx(S,{open:l,onOpenChange:i,children:n}),e[6]=l,e[7]=i,e[8]=n,e[9]=o):o=e[9],o});export{F as MobileFileChanges};
1
+ import{r as x,c as d,j as s}from"./vendor-react-gGw_S5I_.js";import{O as p,Q as f,T as j,N as g,Y as C,M as S}from"./index-Bg4A-xl7.js";import"./vendor-ui-Dc_kJXxz.js";import"./vendor-markdown-BEJ8yVzA.js";const F=x.memo(function(c){const e=d.c(10),{open:l,onClose:a,session:r,sessionChangeKey:h}=c;let i;e[0]!==a?(i=m=>{m||a()},e[0]=a,e[1]=i):i=e[1];let t;e[2]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs(p,{className:"shrink-0 px-4 py-3",children:[s.jsx(f,{children:"File changes"}),s.jsx(j,{className:"sr-only",children:"Review files changed in this session."})]}),e[2]=t):t=e[2];let n;e[3]!==r||e[4]!==h?(n=s.jsxs(g,{side:"bottom",className:"h-[72svh] max-h-[92svh] rounded-t-xl",children:[t,s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(C,{session:r,sessionChangeKey:h})})]}),e[3]=r,e[4]=h,e[5]=n):n=e[5];let o;return e[6]!==l||e[7]!==i||e[8]!==n?(o=s.jsx(S,{open:l,onOpenChange:i,children:n}),e[6]=l,e[7]=i,e[8]=n,e[9]=o):o=e[9],o});export{F as MobileFileChanges};