cogpit 3.2.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-runtime.js +5 -4
- package/dist/instance-worker.js +1 -1
- package/dist/web/assets/{CogpitBlock-L2yaEovX.js → CogpitBlock-DslWkKoF.js} +1 -1
- package/dist/web/assets/{CommandPaletteHost-CwInMsCp.js → CommandPaletteHost-DUZHK9Zh.js} +1 -1
- package/dist/web/assets/{ConfigBrowser-9ySKSxnx.js → ConfigBrowser-CWys9Rgj.js} +1 -1
- package/dist/web/assets/{CrewPanel-9nMm5pVI.js → CrewPanel-CWubmgOn.js} +1 -1
- package/dist/web/assets/{HighlightedEditor-CHdo4vxt.js → HighlightedEditor-BF3a6ok2.js} +1 -1
- package/dist/web/assets/{KeyboardShortcutsDialog-CRuTSHwt.js → KeyboardShortcutsDialog-DHxjcyzu.js} +1 -1
- package/dist/web/assets/{MissionHome-LPTXsRcd.js → MissionHome-Ckt9lu1H.js} +1 -1
- package/dist/web/assets/{MobileFileChanges-Ie2O9iTa.js → MobileFileChanges-B0k6kNod.js} +1 -1
- package/dist/web/assets/{PluginsDialog-84zjmDAJ.js → PluginsDialog-CuaR5Cs1.js} +1 -1
- package/dist/web/assets/{PreviewPanel-US9z-vcE.js → PreviewPanel-CV3itR4d.js} +1 -1
- package/dist/web/assets/{ProjectFilesPanel-BelqVoKU.js → ProjectFilesPanel-B7DRMwMm.js} +1 -1
- package/dist/web/assets/{ProjectSwitcherModal-BgzjVxf6.js → ProjectSwitcherModal-DhWTU3Op.js} +1 -1
- package/dist/web/assets/{TerminalOutput-D2nGNnds.js → TerminalOutput-CsysWxZc.js} +1 -1
- package/dist/web/assets/{ThemeSelectorModal-DT9ZVWtN.js → ThemeSelectorModal-DbCAl7RY.js} +1 -1
- package/dist/web/assets/{WorkflowsPanel-C1fYtY5J.js → WorkflowsPanel-BkDClgyj.js} +1 -1
- package/dist/web/assets/{WorktreePanel-CVZp_AIL.js → WorktreePanel-DyQpVHNe.js} +1 -1
- package/dist/web/assets/{edition-ui-hI8w0jpR.js → edition-ui-xOZzffb-.js} +1 -1
- package/dist/web/assets/{index-D9cBiMbf.js → index-CFF4usU2.js} +1 -1
- package/dist/web/assets/{index-IUqOcQ_C.js → index-D2Gn2VwC.js} +1 -1
- package/dist/web/assets/{index-NgN68ZoJ.js → index-DUfVcKxj.js} +10 -10
- package/dist/web/assets/{index-BbEO6jPZ.js → index-y28pnuxv.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
package/dist/instance-worker.js
CHANGED
|
@@ -15229,7 +15229,7 @@ import { createInterface as createInterface2 } from "node:readline";
|
|
|
15229
15229
|
var package_default = {
|
|
15230
15230
|
name: "cogpit",
|
|
15231
15231
|
private: true,
|
|
15232
|
-
version: "3.2
|
|
15232
|
+
version: "3.3.2",
|
|
15233
15233
|
description: "Control center for Claude Code, OpenAI Codex, and GitHub Copilot CLI sessions",
|
|
15234
15234
|
license: "MIT",
|
|
15235
15235
|
author: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as qe,j as O,r as ge}from"./vendor-react-gGw_S5I_.js";import{aL as si,aM as fi,aN as ai,aO as pi,R as di,J as xe,B as Ue}from"./index-
|
|
1
|
+
import{c as qe,j as O,r as ge}from"./vendor-react-gGw_S5I_.js";import{aL as si,aM as fi,aN as ai,aO as pi,R as di,J as xe,B as Ue}from"./index-DUfVcKxj.js";import{I as Kn,V as hi}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function mi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var U={},Fe={},te={},gn;function ke(){if(gn)return te;gn=1;function t(s){return typeof s>"u"||s===null}function i(s){return typeof s=="object"&&s!==null}function m(s){return Array.isArray(s)?s:t(s)?[]:[s]}function y(s,c){if(c){const A=Object.keys(c);for(let r=0,f=A.length;r<f;r+=1){const C=A[r];s[C]=c[C]}}return s}function p(s,c){let A="";for(let r=0;r<c;r+=1)A+=s;return A}function h(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return te.isNothing=t,te.isObject=i,te.toArray=m,te.repeat=p,te.isNegativeZero=h,te.extend=y,te}var $e,xn;function Ee(){if(xn)return $e;xn=1;function t(m,y){let p="";const h=m.reason||"(unknown reason)";return m.mark?(m.mark.name&&(p+='in "'+m.mark.name+'" '),p+="("+(m.mark.line+1)+":"+(m.mark.column+1)+")",!y&&m.mark.snippet&&(p+=`
|
|
2
2
|
|
|
3
3
|
`+m.mark.snippet),h+" "+p):h}function i(m,y){Error.call(this),this.name="YAMLException",this.reason=m,this.mark=y,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(y){return this.name+": "+t(this,y)},$e=i,$e}var Ge,An;function gi(){if(An)return Ge;An=1;const t=ke();function i(p,h,s,c,A){let r="",f="";const C=Math.floor(A/2)-1;return c-h>C&&(r=" ... ",h=c-C+r.length),s-c>C&&(f=" ...",s=c+C-f.length),{str:r+p.slice(h,s).replace(/\t/g,"→")+f,pos:c-h+r.length}}function m(p,h){return t.repeat(" ",h-p.length)+p}function y(p,h){if(h=Object.create(h||null),!p.buffer)return null;h.maxLength||(h.maxLength=79),typeof h.indent!="number"&&(h.indent=1),typeof h.linesBefore!="number"&&(h.linesBefore=3),typeof h.linesAfter!="number"&&(h.linesAfter=2);const s=/\r?\n|\r|\0/g,c=[0],A=[];let r,f=-1;for(;r=s.exec(p.buffer);)A.push(r.index),c.push(r.index+r[0].length),p.position<=r.index&&f<0&&(f=c.length-2);f<0&&(f=c.length-1);let C="";const L=Math.min(p.line+h.linesAfter,A.length).toString().length,R=h.maxLength-(h.indent+L+3);for(let F=1;F<=h.linesBefore&&!(f-F<0);F++){const H=i(p.buffer,c[f-F],A[f-F],p.position-(c[f]-c[f-F]),R);C=t.repeat(" ",h.indent)+m((p.line-F+1).toString(),L)+" | "+H.str+`
|
|
4
4
|
`+C}const z=i(p.buffer,c[f],A[f],p.position,R);C+=t.repeat(" ",h.indent)+m((p.line+1).toString(),L)+" | "+z.str+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as ie,j as u,r as M}from"./vendor-react-gGw_S5I_.js";import{ae as h,af as Z,ag as ue,ah as he,ai as ge,aj as fe,ak as ve,al as we,am as Ce,an as je,ao as Se,ap as be,aq as ye,ar as xe,as as ee,at as _,au as Pe,av as Te,aw as Oe,ax as ke,ay as Ne,az as Fe,aA as Ee,U as Ie}from"./index-NgN68ZoJ.js";import{P as $e,j as Ae,k as te,S as Re,L as De,H as Le,l as He,m as Me,c as ne,G as Be,F as qe,n as Ge,o as Ke,p as ze,q as Ue,r as We,s as pe,t as ae,u as _e,v as Ve,w as Xe,K as Je,E as Qe,x as Ye,y as Ze,z as oe,A as et,B as tt,D as nt}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.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,C,r,j,g,b,f,y,N,x;if(e[0]!==t){const $=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",$e,t.onNewSession,h("newSession")),t.onDuplicateSession&&a("duplicate-session","Duplicate this session","copy fork clone branch thread",Ae,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",Re,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"}`)),E=(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)}),A=t.devices??[],I=A.length>1&&t.onSwitchDevice?A.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",Ue,t.onToggleSidebar,h("toggleSidebar")),t.hasSession&&a("toggle-stats",t.showStats?"Hide session details":"Show session details","stats tokens usage panel",ze,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)),R=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",Ye,t.onOpenTerminal,h("systemTerminal")),t.onTogglePreview&&a("preview","Toggle development preview","browser localhost dev server website",Qe,t.onTogglePreview,h("preview")),t.onOpenKeyboardShortcuts&&a("keyboard-shortcuts","Customize keyboard shortcuts","keybindings hotkeys settings",Je,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",_e,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",pe,t.onCollapseAll),t.onKillAll&&a("kill-all","Kill all agent processes","stop terminate halt everything runaway",We,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:$},...E.length>0?[{value:"Recent sessions",items:E}]:[],...F.length>0?[{value:"Projects",items:F}]:[],...I.length>0?[{value:"Devices",items:I}]:[],{value:"View",items:o},{value:"Tools",items:R}],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.",C="max-w-xl",c=we,j="Search commands",g=!0,e[16]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Ce,{"aria-label":"Search commands",autoFocus:!0,placeholder:"Search commands..."}),e[16]=b):b=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=je,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]=C,e[8]=r,e[9]=j,e[10]=g,e[11]=b,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],C=e[7],r=e[8],j=e[9],g=e[10],b=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]!==j||e[28]!==g||e[29]!==b||e[30]!==f?(T=u.jsxs(c,{label:j,loop:g,children:[b,f,P]}),e[25]=c,e[26]=P,e[27]=j,e[28]=g,e[29]=b,e[30]=f,e[31]=T):T=e[31];let O;return e[32]!==l||e[33]!==w||e[34]!==C||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:C,children:T}),e[32]=l,e[33]=w,e[34]=C,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 Ie(t,{signal:e});if(!s.ok)throw new Error(`Request failed (${s.status})`);const c=await s.json();return Array.isArray(c)?c:[]}function dt(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 C=w===void 0?0:w,r=be();let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[7]=j):j=e[7];const[g,b]=M.useState(j);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 $,F;e[9]!==O||e[10]!==l?($=()=>{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[J,Q]=me;if(S.signal.aborted)return;const Y=Q.status==="fulfilled"?Q.value:[];ke(Y,B),b(J.status==="fulfilled"?J.value:[]),N(Y),P(!1)}),()=>S.abort()},F=[l,O],e[9]=O,e[10]=l,e[11]=$,e[12]=F):($=e[11],F=e[12]),M.useEffect($,F);let E;e[13]!==g?(E=xe(g),e[13]=g,e[14]=E):E=e[14];const A=E;let I;e:{if(d){I=d;break e}if(!s){I=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],I=S}const o=I;let R;e[18]!==c||e[19]!==r||e[20]!==o?(R=()=>{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]=R):R=e[21];const k=R;let D,n;e[22]!==k||e[23]!==C||e[24]!==r.status||e[25]!==o?(n=()=>{C<=T.current||!o||r.status!=="connected"||(T.current=C,k())},D=[k,C,r.status,o],e[22]=k,e[23]=C,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()&&_("hostFiles"),re=_("hostFiles")&&(!ee()||Pe());let K;e[35]!==o?(K=()=>{o&&Ee(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"&&_("terminal")?k:void 0,e[37]=k,e[38]=r.status,e[39]=o,e[40]=H):H=e[40];const U=o&&re?q:void 0,W=o&&ce?le:void 0,p=o?de:void 0;let z;return e[41]!==x||e[42]!==l||e[43]!==m||e[44]!==y||e[45]!==A||e[46]!==H||e[47]!==U||e[48]!==W||e[49]!==p?(z=u.jsx(at,{...m,open:l,projects:A,recentSessions:y,loadingNavigation:x,onOpenIntegratedTerminal:H,onOpenProjectInEditor:U,onRevealProject:W,onCopyProjectPath:p}),e[41]=x,e[42]=l,e[43]=m,e[44]=y,e[45]=A,e[46]=H,e[47]=U,e[48]=W,e[49]=p,e[50]=z):z=e[50],z}export{dt as CommandPaletteHost};
|
|
1
|
+
import{c as ie,j as u,r as M}from"./vendor-react-gGw_S5I_.js";import{ae as h,af as Z,ag as ue,ah as he,ai as ge,aj as fe,ak as ve,al as we,am as Ce,an as je,ao as Se,ap as be,aq as ye,ar as xe,as as ee,at as _,au as Pe,av as Te,aw as Oe,ax as ke,ay as Ne,az as Fe,aA as Ee,U as Ie}from"./index-DUfVcKxj.js";import{P as $e,j as Ae,k as te,S as Re,L as De,H as Le,l as He,m as Me,c as ne,G as Be,F as qe,n as Ge,o as Ke,p as ze,q as Ue,r as We,s as pe,t as ae,u as _e,v as Ve,w as Xe,K as Je,E as Qe,x as Ye,y as Ze,z as oe,A as et,B as tt,D as nt}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.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,C,r,j,g,b,f,y,N,x;if(e[0]!==t){const $=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",$e,t.onNewSession,h("newSession")),t.onDuplicateSession&&a("duplicate-session","Duplicate this session","copy fork clone branch thread",Ae,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",Re,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"}`)),E=(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)}),A=t.devices??[],I=A.length>1&&t.onSwitchDevice?A.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",Ue,t.onToggleSidebar,h("toggleSidebar")),t.hasSession&&a("toggle-stats",t.showStats?"Hide session details":"Show session details","stats tokens usage panel",ze,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)),R=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",Ye,t.onOpenTerminal,h("systemTerminal")),t.onTogglePreview&&a("preview","Toggle development preview","browser localhost dev server website",Qe,t.onTogglePreview,h("preview")),t.onOpenKeyboardShortcuts&&a("keyboard-shortcuts","Customize keyboard shortcuts","keybindings hotkeys settings",Je,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",_e,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",pe,t.onCollapseAll),t.onKillAll&&a("kill-all","Kill all agent processes","stop terminate halt everything runaway",We,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:$},...E.length>0?[{value:"Recent sessions",items:E}]:[],...F.length>0?[{value:"Projects",items:F}]:[],...I.length>0?[{value:"Devices",items:I}]:[],{value:"View",items:o},{value:"Tools",items:R}],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.",C="max-w-xl",c=we,j="Search commands",g=!0,e[16]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(Ce,{"aria-label":"Search commands",autoFocus:!0,placeholder:"Search commands..."}),e[16]=b):b=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=je,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]=C,e[8]=r,e[9]=j,e[10]=g,e[11]=b,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],C=e[7],r=e[8],j=e[9],g=e[10],b=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]!==j||e[28]!==g||e[29]!==b||e[30]!==f?(T=u.jsxs(c,{label:j,loop:g,children:[b,f,P]}),e[25]=c,e[26]=P,e[27]=j,e[28]=g,e[29]=b,e[30]=f,e[31]=T):T=e[31];let O;return e[32]!==l||e[33]!==w||e[34]!==C||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:C,children:T}),e[32]=l,e[33]=w,e[34]=C,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 Ie(t,{signal:e});if(!s.ok)throw new Error(`Request failed (${s.status})`);const c=await s.json();return Array.isArray(c)?c:[]}function dt(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 C=w===void 0?0:w,r=be();let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[7]=j):j=e[7];const[g,b]=M.useState(j);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 $,F;e[9]!==O||e[10]!==l?($=()=>{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[J,Q]=me;if(S.signal.aborted)return;const Y=Q.status==="fulfilled"?Q.value:[];ke(Y,B),b(J.status==="fulfilled"?J.value:[]),N(Y),P(!1)}),()=>S.abort()},F=[l,O],e[9]=O,e[10]=l,e[11]=$,e[12]=F):($=e[11],F=e[12]),M.useEffect($,F);let E;e[13]!==g?(E=xe(g),e[13]=g,e[14]=E):E=e[14];const A=E;let I;e:{if(d){I=d;break e}if(!s){I=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],I=S}const o=I;let R;e[18]!==c||e[19]!==r||e[20]!==o?(R=()=>{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]=R):R=e[21];const k=R;let D,n;e[22]!==k||e[23]!==C||e[24]!==r.status||e[25]!==o?(n=()=>{C<=T.current||!o||r.status!=="connected"||(T.current=C,k())},D=[k,C,r.status,o],e[22]=k,e[23]=C,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()&&_("hostFiles"),re=_("hostFiles")&&(!ee()||Pe());let K;e[35]!==o?(K=()=>{o&&Ee(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"&&_("terminal")?k:void 0,e[37]=k,e[38]=r.status,e[39]=o,e[40]=H):H=e[40];const U=o&&re?q:void 0,W=o&&ce?le:void 0,p=o?de:void 0;let z;return e[41]!==x||e[42]!==l||e[43]!==m||e[44]!==y||e[45]!==A||e[46]!==H||e[47]!==U||e[48]!==W||e[49]!==p?(z=u.jsx(at,{...m,open:l,projects:A,recentSessions:y,loadingNavigation:x,onOpenIntegratedTerminal:H,onOpenProjectInEditor:U,onRevealProject:W,onCopyProjectPath:p}),e[41]=x,e[42]=l,e[43]=m,e[44]=y,e[45]=A,e[46]=H,e[47]=U,e[48]=W,e[49]=p,e[50]=z):z=e[50],z}export{dt as CommandPaletteHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as G,j as t,r as o}from"./vendor-react-gGw_S5I_.js";import{bD as ye,bX as Ce,J as F,z as ke,C as X,bw as Z,T as ve,H as q,b5 as ae,B as I,U as A,bY as Ne,bZ as Se,b_ as we,b$ as De,c0 as Te,c1 as Ee,c2 as V,c3 as Re,c4 as ee,c5 as Oe,Z as te,a4 as le,c6 as Ie,a5 as ie,a6 as re,a8 as oe,a9 as ce,aa as de,ab as ue,ac as me,ag as ze,L as Ae,M as Le,N as Be,O as $e,Q as Fe,Y as Ge,m as Me,I as ne,n as Pe,E as Ue,q as _e,c7 as Ve}from"./index-NgN68ZoJ.js";import{as as He,y as Ke,g as Ye,ac as Je,at as Qe,a2 as We,au as xe,n as fe,av as Xe,aw as Ze,U as H,X as K,P as qe,ax as he,ay as et,i as tt,a9 as nt,S as st,O as at}from"./vendor-ui-Dxtv9P3W.js";import{H as lt}from"./HighlightedEditor-CHdo4vxt.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.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:Qe,color:"text-muted-foreground"},agents:{label:"Agents",icon:Je,color:"text-muted-foreground"},skills:{label:"Skills",icon:Ye,color:"text-muted-foreground"},commands:{label:"Commands",icon:Ke,color:"text-muted-foreground"},settings:{label:"Settings",icon:He,color:"text-muted-foreground"}};function Y(l,e,i){const n=[];for(const s of l)s.type==="directory"&&s.children?n.push(...Y(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=Y(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(Ze,{"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(Z,{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(q,{value:"global",className:"flex-1",children:[t.jsx(fe,{"data-icon":"inline-start"}),"Global"]}),t.jsxs(q,{value:"project",className:"flex-1",children:[t.jsx(xe,{"data-icon":"inline-start"}),"Project"]})]})]}),t.jsxs(X,{children:[t.jsxs(Z,{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(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel create",onClick:s,children:t.jsx(K,{"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(qe,{"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(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel rename",onClick:k,children:t.jsx(K,{"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(H,{"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 vt=o.memo(function({projectPath:e,initialFilePath:i}){var Q,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=>Y(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=(Q=s.find(a=>a.scope==="global"))==null?void 0:Q.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]),J=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(K,{"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?J: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{vt as ConfigBrowser};
|
|
1
|
+
import{c as G,j as t,r as o}from"./vendor-react-gGw_S5I_.js";import{bD as ye,bX as Ce,J as F,z as ke,C as X,bw as Z,T as ve,H as q,b5 as ae,B as I,U as A,bY as Ne,bZ as Se,b_ as we,b$ as De,c0 as Te,c1 as Ee,c2 as V,c3 as Re,c4 as ee,c5 as Oe,Z as te,a4 as le,c6 as Ie,a5 as ie,a6 as re,a8 as oe,a9 as ce,aa as de,ab as ue,ac as me,ag as ze,L as Ae,M as Le,N as Be,O as $e,Q as Fe,Y as Ge,m as Me,I as ne,n as Pe,E as Ue,q as _e,c7 as Ve}from"./index-DUfVcKxj.js";import{as as He,y as Ke,g as Ye,ac as Je,at as Qe,a2 as We,au as xe,n as fe,av as Xe,aw as Ze,U as H,X as K,P as qe,ax as he,ay as et,i as tt,a9 as nt,S as st,O as at}from"./vendor-ui-Dxtv9P3W.js";import{H as lt}from"./HighlightedEditor-BF3a6ok2.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.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:Qe,color:"text-muted-foreground"},agents:{label:"Agents",icon:Je,color:"text-muted-foreground"},skills:{label:"Skills",icon:Ye,color:"text-muted-foreground"},commands:{label:"Commands",icon:Ke,color:"text-muted-foreground"},settings:{label:"Settings",icon:He,color:"text-muted-foreground"}};function Y(l,e,i){const n=[];for(const s of l)s.type==="directory"&&s.children?n.push(...Y(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=Y(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(Ze,{"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(Z,{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(q,{value:"global",className:"flex-1",children:[t.jsx(fe,{"data-icon":"inline-start"}),"Global"]}),t.jsxs(q,{value:"project",className:"flex-1",children:[t.jsx(xe,{"data-icon":"inline-start"}),"Project"]})]})]}),t.jsxs(X,{children:[t.jsxs(Z,{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(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel create",onClick:s,children:t.jsx(K,{"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(qe,{"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(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel rename",onClick:k,children:t.jsx(K,{"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(H,{"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 vt=o.memo(function({projectPath:e,initialFilePath:i}){var Q,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=>Y(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=(Q=s.find(a=>a.scope==="global"))==null?void 0:Q.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]),J=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(K,{"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?J: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{vt as ConfigBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as R,c as G,j as n}from"./vendor-react-gGw_S5I_.js";import{aP as fe,U as xe,aQ as pe,aR as te,aS as me,aT as he,aU as ge,aV as we,aW as be,aX as Ne,B as Q,q as je,J as M,$ as ue,Z as ve,aY as ye,aZ as ke}from"./index-NgN68ZoJ.js";import{W as Ie,X as Se,Y as Ce,C as de,_ as Re,$ as Ae}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const $e=4e3;function Oe(t){var g;const[e,l]=R.useState(null),[r,f]=R.useState(null),[a,c]=R.useState(new Set),d=(g=fe())==null?void 0:g.refresh,x=R.useRef(t),s=R.useRef(new Set);R.useLayoutEffect(()=>(x.current=t,()=>{x.current=null}),[t]);const i=R.useCallback(async o=>{if(t)try{const u=await xe(`/api/session-crew/${encodeURIComponent(t)}`);if(!o())return;if(!u.ok){f(u.status===404?"This session is no longer available.":"Couldn't load the crew.");return}const m=await u.json();if(!o())return;l(h=>JSON.stringify(h)===JSON.stringify(m)?h:m),f(null)}catch{o()&&f("Couldn't load the crew.")}},[t]);pe(t?i:null,$e),R.useEffect(()=>{l(o=>o!=null&&o.members.some(u=>u.sessionId===t)?o:null),f(null),c(new Set)},[t]);const p=R.useCallback(async(o,u,m)=>{const h=`${t}:${o}`;if(s.current.has(h))return;const N=()=>x.current===t;s.current.add(h),c(y=>new Set(y).add(o));try{const y=await u();if(!N())return;if(!y.ok&&y.status!==404){f(m);return}d==null||d(),await i(N)}catch{N()&&f(m)}finally{s.current.delete(h),N()&&c(y=>{const k=new Set(y);return k.delete(o),k})}},[i,d,t]),w=R.useCallback((o,u,m)=>p(u,()=>te("/api/session-respond",{sessionId:o,requestId:u,...m}),"Couldn't send the answer."),[p]),j=R.useCallback((o,u)=>p(u,()=>te("/api/delegated-tasks",{sessionId:o,taskId:u,action:"ack"}),"Couldn't mark the result read."),[p]),b=R.useCallback(o=>p(o.sessionId,()=>{var u;return((u=o.result)==null?void 0:u.state)==="running"&&o.parentId?te("/api/delegated-tasks",{sessionId:o.parentId,taskId:o.result.taskId,action:"cancel"}):te("/api/stop-session",{sessionId:o.sessionId})},"Couldn't stop the session."),[p]);return{crew:e,error:r,busy:a,respond:w,markRead:j,stop:b}}function ee(t){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 ce(t,e){var l,r;return{sessionId:t.sessionId,dirName:((l=t.address)==null?void 0:l.dirName)??"",fileName:((r=t.address)==null?void 0:r.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 ze(t,e,l){var d;const r=((d=[...e.values()].find(x=>x.parentId===null))==null?void 0:d.sessionId)??t.sessionId,f=l[t.sessionId],a=ce(t,r);if(!t.parentId)return me(a,f);const c=e.get(t.parentId);return he(a,{customName:f,parent:c&&ce(c,r)})}function qe(t){const e=new Map;for(const a of t.members){if(!a.parentId)continue;const c=e.get(a.parentId);c?c.push(a):e.set(a.parentId,[a])}const l=[],r=new Set,f=(a,c)=>{var x;const d=[...e.get(a)??[]].sort((s,i)=>(s.startedAt??0)-(i.startedAt??0));for(const s of d)r.has(s.sessionId)||(r.add(s.sessionId),l.push({member:s,depth:c,children:((x=e.get(s.sessionId))==null?void 0:x.length)??0}),f(s.sessionId,c+1))};f(t.rootId,0);for(const a of t.members)a.parentId&&!r.has(a.sessionId)&&(r.add(a.sessionId),l.push({member:a,depth:0,children:0}));return l}function Me(t){const e=({member:l,pending:r})=>r.askedAt??(Date.parse(l.lastActivityAt??"")||0);return t.members.flatMap(l=>l.waiting.map(r=>({member:l,pending:r}))).sort((l,r)=>e(l)-e(r))}function Te(t){const e={size:0,working:0,needsYou:0,done:0,failed:0,unreachable:0,unreadResults:0};for(const l of t.members){if(!l.parentId)continue;e.size++;const r=ee(l);r==="working"?e.working++:r==="needs-you"?e.needsYou++:r==="failed"?e.failed++:r==="unreachable"?e.unreachable++:e.done++,le(l)&&e.unreadResults++}return e}function le(t){return!!(t.result&&t.result.state!=="running"&&!t.result.acknowledged)}function ne(t){const[e]=t.waiting;switch(ee(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":"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 le(t)?"Finished · result unread":"Finished"}}const Le=[{id:"all",label:"All"},{id:"working",label:"Working"},{id:"needs-you",label:"Need you"},{id:"done",label:"Done"}],Pe={working:"bg-success shadow-[0_0_0_2px_color-mix(in_oklch,var(--success)_25%,transparent)]","needs-you":"bg-warning",done:"bg-muted-foreground/40",failed:"bg-destructive",unreachable:"border border-muted-foreground/50"},q={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 Ke(t){var A;const e=G.c(29),{context:l,closePanel:r}=t,f=((A=l.session)==null?void 0:A.sessionId)??null,{crew:a,error:c,busy:d,respond:x,markRead:s,stop:i}=Oe(f),{names:p}=ge();let w;e[0]!==(a==null?void 0:a.members)?(w=new Map(((a==null?void 0:a.members)??[]).map(Fe)),e[0]=a==null?void 0:a.members,e[1]=w):w=e[1];const j=w;let b;e[2]!==j||e[3]!==p?(b=v=>ze(v,j,p),e[2]=j,e[3]=p,e[4]=b):b=e[4];const g=b;let o;e[5]!==l?(o=v=>{v.address&&v.device?we(be(v.address.dirName,v.address.fileName,v.device.id)):v.address&&l.openSession?l.openSession(v.address.dirName,v.address.fileName):Ne(v.sessionId)},e[5]=l,e[6]=o):o=e[6];const u=o;let m,h,N;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ie,{"aria-hidden":"true",className:"size-4 text-muted-foreground"}),h=n.jsx("h2",{className:"text-sm font-medium",children:"Crew"}),N=n.jsx("div",{className:"flex-1"}),e[7]=m,e[8]=h,e[9]=N):(m=e[7],h=e[8],N=e[9]);let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Se,{"data-icon":"inline-start"}),e[10]=y):y=e[10];let k;e[11]!==r?(k=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[m,h,N,n.jsx(Q,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":"Close crew",children:y})]}),e[11]=r,e[12]=k):k=e[12];let S;e[13]!==c?(S=c&&n.jsx("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive",children:c}),e[13]=c,e[14]=S):S=e[14];let I;e[15]!==d||e[16]!==a||e[17]!==c||e[18]!==s||e[19]!==g||e[20]!==u||e[21]!==x||e[22]!==f||e[23]!==i?(I=a?n.jsxs(je,{className:"min-h-0 flex-1",children:[n.jsx(Ye,{crew:a,hereId:f,nameOf:g,onOpen:u}),n.jsx(Be,{crew:a,busy:d,nameOf:g,onOpen:u,onRespond:x}),n.jsx(Ue,{crew:a,hereId:f,busy:d,nameOf:g,onOpen:u,onMarkRead:s,onStop:i})]}):!c&&n.jsx("p",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Loading the crew…"}),e[15]=d,e[16]=a,e[17]=c,e[18]=s,e[19]=g,e[20]=u,e[21]=x,e[22]=f,e[23]=i,e[24]=I):I=e[24];let $;return e[25]!==I||e[26]!==k||e[27]!==S?($=n.jsxs("aside",{"aria-label":"Crew",className:"flex size-full min-h-0 flex-col bg-canvas",children:[k,S,I]}),e[25]=I,e[26]=k,e[27]=S,e[28]=$):$=e[28],$}function Fe(t){return[t.sessionId,t]}function Ye(t){var h;const e=G.c(45),{crew:l,hereId:r,nameOf:f,onOpen:a}=t;let c,d,x,s,i;if(e[0]!==l||e[1]!==r||e[2]!==f||e[3]!==a){let N;e[9]!==l.rootId?(N=C=>C.sessionId===l.rootId,e[9]=l.rootId,e[10]=N):N=e[10];const y=l.members.find(N),k=l.members.filter(De);let S;e[11]!==l?(S=Te(l),e[11]=l,e[12]=S):S=e[12],i=S;const I=(h=k[0])==null?void 0:h.startedAt;c="Crew summary",d="border-b px-3 pb-3 pt-1";const $=y&&n.jsx("button",{type:"button",onClick:()=>a(y),"aria-current":y.sessionId===r?"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:f(y)}),A=i.size===1?"session":"sessions",v=I?` · since ${Ee(I)}`:"";let O;e[13]!==A||e[14]!==v||e[15]!==i.size?(O=n.jsxs("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[i.size," ",A,v]}),e[13]=A,e[14]=v,e[15]=i.size,e[16]=O):O=e[16],e[17]!==O||e[18]!==$?(x=n.jsxs("div",{className:"flex items-baseline gap-2",children:[$,O]}),e[17]=O,e[18]=$,e[19]=x):x=e[19],s=k.length>0&&n.jsx("div",{"data-crew-strip":!0,className:"mt-2.5 flex gap-[3px]",role:"list","aria-label":"One cell per session, in the order they were started",children:k.map(C=>{const T=ee(C);return n.jsx("button",{type:"button",role:"listitem","data-crew-cell":T,title:`${f(C)}: ${ne(C)}`,"aria-label":`${f(C)}: ${ne(C)}`,onClick:()=>{var z;return(z=document.querySelector(`[data-crew-row="${C.sessionId}"]`))==null?void 0:z.scrollIntoView({block:"nearest",behavior:"smooth"})},className:M("h-2.5 min-w-[3px] flex-1 rounded-[2px] outline-none focus-visible:ring-2 focus-visible:ring-ring",Pe[T],C.sessionId===r&&"outline outline-[1.5px] outline-offset-2 outline-foreground")},C.sessionId)})}),e[0]=l,e[1]=r,e[2]=f,e[3]=a,e[4]=c,e[5]=d,e[6]=x,e[7]=s,e[8]=i}else c=e[4],d=e[5],x=e[6],s=e[7],i=e[8];let p;e[20]!==i.working?(p=i.working>0&&n.jsx(H,{dot:q.working,value:i.working,label:"working"}),e[20]=i.working,e[21]=p):p=e[21];let w;e[22]!==i.needsYou?(w=i.needsYou>0&&n.jsx(H,{dot:q["needs-you"],value:i.needsYou,label:i.needsYou===1?"needs you":"need you"}),e[22]=i.needsYou,e[23]=w):w=e[23];let j;e[24]!==i.done?(j=i.done>0&&n.jsx(H,{dot:q.done,value:i.done,label:"done"}),e[24]=i.done,e[25]=j):j=e[25];let b;e[26]!==i.failed?(b=i.failed>0&&n.jsx(H,{dot:q.failed,value:i.failed,label:"failed"}),e[26]=i.failed,e[27]=b):b=e[27];let g;e[28]!==i.unreachable?(g=i.unreachable>0&&n.jsx(H,{dot:q.unreachable,value:i.unreachable,label:"away"}),e[28]=i.unreachable,e[29]=g):g=e[29];let o;e[30]!==i.unreadResults?(o=i.unreadResults>0&&n.jsxs("span",{className:"ml-auto text-warning",children:[n.jsx("span",{className:"font-medium tabular-nums",children:i.unreadResults})," ",i.unreadResults===1?"result":"results"," unread"]}),e[30]=i.unreadResults,e[31]=o):o=e[31];let u;e[32]!==o||e[33]!==p||e[34]!==w||e[35]!==j||e[36]!==b||e[37]!==g?(u=n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3.5 gap-y-1 text-xs text-muted-foreground",children:[p,w,j,b,g,o]}),e[32]=o,e[33]=p,e[34]=w,e[35]=j,e[36]=b,e[37]=g,e[38]=u):u=e[38];let m;return e[39]!==c||e[40]!==u||e[41]!==d||e[42]!==x||e[43]!==s?(m=n.jsxs("section",{"aria-label":c,className:d,children:[x,s,u]}),e[39]=c,e[40]=u,e[41]=d,e[42]=x,e[43]=s,e[44]=m):m=e[44],m}function De(t){return t.parentId!==null}function Ee(t){const e=new Date(t),l=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return e.toDateString()===new Date().toDateString()?l:`${e.toLocaleDateString([],{month:"short",day:"numeric"})}, ${l}`}function H(t){const e=G.c(10),{dot:l,value:r,label:f}=t;let a;e[0]!==l?(a=M("size-1.5 rounded-full",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=n.jsx("span",{className:a,"aria-hidden":"true"}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==r?(d=n.jsx("span",{className:"font-medium tabular-nums text-foreground",children:r}),e[4]=r,e[5]=d):d=e[5];let x;return e[6]!==f||e[7]!==c||e[8]!==d?(x=n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c,d," ",f]}),e[6]=f,e[7]=c,e[8]=d,e[9]=x):x=e[9],x}function Be(t){const e=G.c(6),{crew:l,busy:r,nameOf:f,onOpen:a,onRespond:c}=t,d=Me(l),[x,s]=R.useState(0);if(d.length===0)return null;const i=Math.min(x,d.length-1),{member:p,pending:w}=d[i],j=d[i+1];let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Needs you"}),e[0]=b):b=e[0];let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("span",{className:"flex-1"}),e[1]=g):g=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:M("size-1.5 shrink-0 rounded-full",q["needs-you"]),"aria-hidden":"true"}),e[2]=o):o=e[2];const u=w.askedAt?`waiting ${ue(new Date(w.askedAt).toISOString())}`:"waiting";let m;e[3]!==u?(m=n.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-warning",children:u}),e[3]=u,e[4]=m):m=e[4];let h;return e[5]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(de,{"data-icon":"inline-end"}),e[5]=h):h=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:[b,n.jsx("span",{className:"tabular-nums",children:d.length}),g,d.length>1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"tabular-nums",children:[i+1," of ",d.length]}),n.jsx(Q,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:i===0,onClick:()=>s(i-1),children:n.jsx(Ce,{"data-icon":"inline-start"})}),n.jsx(Q,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:i===d.length-1,onClick:()=>s(i+1),children:n.jsx(de,{"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:[o,n.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:f(p)}),p.device&&n.jsx(ve,{variant:"outline",children:p.device.name}),m]}),n.jsx(ye,{sessionId:p.sessionId,pending:w,queued:0,responding:r.has(w.requestId),onRespond:(N,y)=>void c(p.sessionId,N,y),onOpen:()=>a(p)},w.requestId),n.jsxs(Q,{variant:"ghost",size:"xs",className:"self-end text-muted-foreground",onClick:()=>a(p),children:["Open session",h]})]}),j&&n.jsxs("p",{className:"mt-2 truncate text-xs text-muted-foreground",children:["Next: ",n.jsx("span",{className:"font-medium text-foreground",children:f(j.member)})," ",ne(j.member).toLowerCase()]})]})}function Ue(t){const e=G.c(17),{crew:l,hereId:r,busy:f,nameOf:a,onOpen:c,onMarkRead:d,onStop:x}=t,[s,i]=R.useState("all");let p;if(e[0]!==f||e[1]!==l||e[2]!==s||e[3]!==r||e[4]!==a||e[5]!==d||e[6]!==c||e[7]!==x){let w;e[9]!==s?(w=m=>{const{member:h}=m;if(s==="all")return!0;const N=ee(h);return s==="done"?N!=="working"&&N!=="needs-you":N===s},e[9]=s,e[10]=w):w=e[10];const j=qe(l).filter(w);let b,g;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("h3",{className:"text-sm font-medium",children:"Sessions"}),g=n.jsx("span",{className:"flex-1"}),e[11]=b,e[12]=g):(b=e[11],g=e[12]);let o;e[13]!==s?(o=Le.map(m=>{const{id:h,label:N}=m;return n.jsx("button",{type:"button",role:"radio","aria-checked":s===h,onClick:()=>i(h),className:M("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",s===h&&"bg-accent text-foreground"),children:N},h)}),e[13]=s,e[14]=o):o=e[14];let u;e[15]!==o?(u=n.jsxs("div",{className:"mb-1.5 flex items-center gap-2 px-1.5",children:[b,g,n.jsx("div",{role:"radiogroup","aria-label":"Show sessions",className:"flex gap-0.5",children:o})]}),e[15]=o,e[16]=u):u=e[16],p=n.jsxs("section",{"aria-label":"Sessions",className:"px-1.5 py-2.5",children:[u,j.length===0?n.jsx("p",{className:"px-1.5 py-4 text-center text-xs text-muted-foreground",children:"No sessions here."}):n.jsx("ul",{className:"flex flex-col",children:j.map(m=>n.jsx(We,{row:m,here:m.member.sessionId===r,busy:f,name:a(m.member),onOpen:c,onMarkRead:d,onStop:x},m.member.sessionId))})]}),e[0]=f,e[1]=l,e[2]=s,e[3]=r,e[4]=a,e[5]=d,e[6]=c,e[7]=x,e[8]=p}else p=e[8];return p}function We(t){var oe,re;const e=G.c(73),{row:l,here:r,busy:f,name:a,onOpen:c,onMarkRead:d,onStop:x}=t,{member:s,depth:i,children:p}=l;let w;e[0]!==s?(w=ee(s),e[0]=s,e[1]=w):w=e[1];const j=w;let b;e[2]!==s?(b=ne(s),e[2]=s,e[3]=b):b=e[3];const g=b;let o;e[4]!==s.pullRequests?(o=(oe=s.pullRequests)==null?void 0:oe.at(-1),e[4]=s.pullRequests,e[5]=o):o=e[5];const u=o;let m;e[6]!==s?(m=le(s)&&s.result&&s.parentId,e[6]=s,e[7]=m):m=e[7];const h=m,N=(j==="working"||j==="needs-you")&&(!s.device||((re=s.result)==null?void 0:re.state)==="running"&&s.parentId!==null),y=s.sessionId,k=r?"bg-accent":"hover:bg-accent/60",S=i>0&&"border-l border-border/70";let I;e[8]!==k||e[9]!==S?(I=M("group/crew relative rounded-md",k,S),e[8]=k,e[9]=S,e[10]=I):I=e[10];const $=i>0?6+(i-1)*14:0;let A;e[11]!==$?(A={marginLeft:$},e[11]=$,e[12]=A):A=e[12];let v;e[13]!==s||e[14]!==c?(v=()=>c(s),e[13]=s,e[14]=c,e[15]=v):v=e[15];const O=r?"true":void 0,C=`${a}, ${g}`,T=q[j];let z;e[16]!==T?(z=M("size-1.5 justify-self-center rounded-full",T),e[16]=T,e[17]=z):z=e[17];let L;e[18]!==z?(L=n.jsx("span",{className:z,"aria-hidden":"true"}),e[18]=z,e[19]=L):L=e[19];let P;e[20]!==a?(P=n.jsx("span",{className:"truncate",children:a}),e[20]=a,e[21]=P):P=e[21];let F;e[22]!==r?(F=r&&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[22]=r,e[23]=F):F=e[23];let Y;e[24]!==P||e[25]!==F?(Y=n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12.5px] font-medium",children:[P,F]}),e[24]=P,e[25]=F,e[26]=Y):Y=e[26];let D;e[27]!==s.lastActivityAt?(D=s.lastActivityAt?ue(s.lastActivityAt):"",e[27]=s.lastActivityAt,e[28]=D):D=e[28];let E;e[29]!==D?(E=n.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:D}),e[29]=D,e[30]=E):E=e[30];const ae=(j==="needs-you"||h)&&"text-warning",ie=j==="failed"&&"text-destructive";let B;e[31]!==ae||e[32]!==ie?(B=M("min-w-0 flex-1 truncate",ae,ie),e[31]=ae,e[32]=ie,e[33]=B):B=e[33];let U;e[34]!==g||e[35]!==B?(U=n.jsx("span",{className:B,children:g}),e[34]=g,e[35]=B,e[36]=U):U=e[36];let W;e[37]!==u?(W=u&&n.jsxs("span",{className:"shrink-0 rounded-full border px-1.5 text-[11px]",children:["#",u.number]}),e[37]=u,e[38]=W):W=e[38];let _;e[39]!==s.device?(_=s.device&&n.jsx("span",{className:"shrink-0",children:s.device.name}),e[39]=s.device,e[40]=_):_=e[40];let V;e[41]!==p?(V=p>0&&n.jsxs("span",{className:"shrink-0",children:[p," ",p===1?"session":"sessions"]}),e[41]=p,e[42]=V):V=e[42];let J;e[43]!==s.model?(J=s.model&&n.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:ke(s.model)}),e[43]=s.model,e[44]=J):J=e[44];let X;e[45]!==U||e[46]!==W||e[47]!==_||e[48]!==V||e[49]!==J?(X=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:[U,W,_,V,J]}),e[45]=U,e[46]=W,e[47]=_,e[48]=V,e[49]=J,e[50]=X):X=e[50];let Z;e[51]!==v||e[52]!==O||e[53]!==C||e[54]!==L||e[55]!==Y||e[56]!==E||e[57]!==X?(Z=n.jsxs("button",{type:"button",onClick:v,"aria-current":O,"aria-label":C,className:"grid w-full 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:[L,Y,E,X]}),e[51]=v,e[52]=O,e[53]=C,e[54]=L,e[55]=Y,e[56]=E,e[57]=X,e[58]=Z):Z=e[58];let K;e[59]!==f||e[60]!==N||e[61]!==s||e[62]!==a||e[63]!==d||e[64]!==x||e[65]!==h?(K=(h||N)&&n.jsxs("div",{className:"absolute right-1.5 top-1 hidden gap-1 group-focus-within/crew:flex group-hover/crew:flex",children:[h&&s.result&&s.parentId&&n.jsx(Q,{variant:"outline",size:"icon-xs",className:"bg-popover","aria-label":`Mark ${a}'s result read`,title:"Mark the result read",disabled:f.has(s.result.taskId),onClick:()=>void d(s.parentId,s.result.taskId),children:n.jsx(Re,{"data-icon":"inline-start"})}),N&&n.jsx(Q,{variant:"outline",size:"icon-xs",className:"bg-popover text-destructive","aria-label":`Stop ${a}`,title:"Stop this session",disabled:f.has(s.sessionId),onClick:()=>void x(s),children:n.jsx(Ae,{"data-icon":"inline-start"})})]}),e[59]=f,e[60]=N,e[61]=s,e[62]=a,e[63]=d,e[64]=x,e[65]=h,e[66]=K):K=e[66];let se;return e[67]!==s.sessionId||e[68]!==A||e[69]!==Z||e[70]!==K||e[71]!==I?(se=n.jsxs("li",{"data-crew-row":y,className:I,style:A,children:[Z,K]}),e[67]=s.sessionId,e[68]=A,e[69]=Z,e[70]=K,e[71]=I,e[72]=se):se=e[72],se}export{Ke as CrewPanel};
|
|
1
|
+
import{r as R,c as G,j as n}from"./vendor-react-gGw_S5I_.js";import{aP as fe,U as xe,aQ as pe,aR as te,aS as me,aT as he,aU as ge,aV as we,aW as be,aX as Ne,B as Q,q as je,J as M,$ as ue,Z as ve,aY as ye,aZ as ke}from"./index-DUfVcKxj.js";import{W as Ie,X as Se,Y as Ce,C as de,_ as Re,$ as Ae}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const $e=4e3;function Oe(t){var g;const[e,l]=R.useState(null),[r,f]=R.useState(null),[a,c]=R.useState(new Set),d=(g=fe())==null?void 0:g.refresh,x=R.useRef(t),s=R.useRef(new Set);R.useLayoutEffect(()=>(x.current=t,()=>{x.current=null}),[t]);const i=R.useCallback(async o=>{if(t)try{const u=await xe(`/api/session-crew/${encodeURIComponent(t)}`);if(!o())return;if(!u.ok){f(u.status===404?"This session is no longer available.":"Couldn't load the crew.");return}const m=await u.json();if(!o())return;l(h=>JSON.stringify(h)===JSON.stringify(m)?h:m),f(null)}catch{o()&&f("Couldn't load the crew.")}},[t]);pe(t?i:null,$e),R.useEffect(()=>{l(o=>o!=null&&o.members.some(u=>u.sessionId===t)?o:null),f(null),c(new Set)},[t]);const p=R.useCallback(async(o,u,m)=>{const h=`${t}:${o}`;if(s.current.has(h))return;const N=()=>x.current===t;s.current.add(h),c(y=>new Set(y).add(o));try{const y=await u();if(!N())return;if(!y.ok&&y.status!==404){f(m);return}d==null||d(),await i(N)}catch{N()&&f(m)}finally{s.current.delete(h),N()&&c(y=>{const k=new Set(y);return k.delete(o),k})}},[i,d,t]),w=R.useCallback((o,u,m)=>p(u,()=>te("/api/session-respond",{sessionId:o,requestId:u,...m}),"Couldn't send the answer."),[p]),j=R.useCallback((o,u)=>p(u,()=>te("/api/delegated-tasks",{sessionId:o,taskId:u,action:"ack"}),"Couldn't mark the result read."),[p]),b=R.useCallback(o=>p(o.sessionId,()=>{var u;return((u=o.result)==null?void 0:u.state)==="running"&&o.parentId?te("/api/delegated-tasks",{sessionId:o.parentId,taskId:o.result.taskId,action:"cancel"}):te("/api/stop-session",{sessionId:o.sessionId})},"Couldn't stop the session."),[p]);return{crew:e,error:r,busy:a,respond:w,markRead:j,stop:b}}function ee(t){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 ce(t,e){var l,r;return{sessionId:t.sessionId,dirName:((l=t.address)==null?void 0:l.dirName)??"",fileName:((r=t.address)==null?void 0:r.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 ze(t,e,l){var d;const r=((d=[...e.values()].find(x=>x.parentId===null))==null?void 0:d.sessionId)??t.sessionId,f=l[t.sessionId],a=ce(t,r);if(!t.parentId)return me(a,f);const c=e.get(t.parentId);return he(a,{customName:f,parent:c&&ce(c,r)})}function qe(t){const e=new Map;for(const a of t.members){if(!a.parentId)continue;const c=e.get(a.parentId);c?c.push(a):e.set(a.parentId,[a])}const l=[],r=new Set,f=(a,c)=>{var x;const d=[...e.get(a)??[]].sort((s,i)=>(s.startedAt??0)-(i.startedAt??0));for(const s of d)r.has(s.sessionId)||(r.add(s.sessionId),l.push({member:s,depth:c,children:((x=e.get(s.sessionId))==null?void 0:x.length)??0}),f(s.sessionId,c+1))};f(t.rootId,0);for(const a of t.members)a.parentId&&!r.has(a.sessionId)&&(r.add(a.sessionId),l.push({member:a,depth:0,children:0}));return l}function Me(t){const e=({member:l,pending:r})=>r.askedAt??(Date.parse(l.lastActivityAt??"")||0);return t.members.flatMap(l=>l.waiting.map(r=>({member:l,pending:r}))).sort((l,r)=>e(l)-e(r))}function Te(t){const e={size:0,working:0,needsYou:0,done:0,failed:0,unreachable:0,unreadResults:0};for(const l of t.members){if(!l.parentId)continue;e.size++;const r=ee(l);r==="working"?e.working++:r==="needs-you"?e.needsYou++:r==="failed"?e.failed++:r==="unreachable"?e.unreachable++:e.done++,le(l)&&e.unreadResults++}return e}function le(t){return!!(t.result&&t.result.state!=="running"&&!t.result.acknowledged)}function ne(t){const[e]=t.waiting;switch(ee(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":"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 le(t)?"Finished · result unread":"Finished"}}const Le=[{id:"all",label:"All"},{id:"working",label:"Working"},{id:"needs-you",label:"Need you"},{id:"done",label:"Done"}],Pe={working:"bg-success shadow-[0_0_0_2px_color-mix(in_oklch,var(--success)_25%,transparent)]","needs-you":"bg-warning",done:"bg-muted-foreground/40",failed:"bg-destructive",unreachable:"border border-muted-foreground/50"},q={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 Ke(t){var A;const e=G.c(29),{context:l,closePanel:r}=t,f=((A=l.session)==null?void 0:A.sessionId)??null,{crew:a,error:c,busy:d,respond:x,markRead:s,stop:i}=Oe(f),{names:p}=ge();let w;e[0]!==(a==null?void 0:a.members)?(w=new Map(((a==null?void 0:a.members)??[]).map(Fe)),e[0]=a==null?void 0:a.members,e[1]=w):w=e[1];const j=w;let b;e[2]!==j||e[3]!==p?(b=v=>ze(v,j,p),e[2]=j,e[3]=p,e[4]=b):b=e[4];const g=b;let o;e[5]!==l?(o=v=>{v.address&&v.device?we(be(v.address.dirName,v.address.fileName,v.device.id)):v.address&&l.openSession?l.openSession(v.address.dirName,v.address.fileName):Ne(v.sessionId)},e[5]=l,e[6]=o):o=e[6];const u=o;let m,h,N;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ie,{"aria-hidden":"true",className:"size-4 text-muted-foreground"}),h=n.jsx("h2",{className:"text-sm font-medium",children:"Crew"}),N=n.jsx("div",{className:"flex-1"}),e[7]=m,e[8]=h,e[9]=N):(m=e[7],h=e[8],N=e[9]);let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Se,{"data-icon":"inline-start"}),e[10]=y):y=e[10];let k;e[11]!==r?(k=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[m,h,N,n.jsx(Q,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":"Close crew",children:y})]}),e[11]=r,e[12]=k):k=e[12];let S;e[13]!==c?(S=c&&n.jsx("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive",children:c}),e[13]=c,e[14]=S):S=e[14];let I;e[15]!==d||e[16]!==a||e[17]!==c||e[18]!==s||e[19]!==g||e[20]!==u||e[21]!==x||e[22]!==f||e[23]!==i?(I=a?n.jsxs(je,{className:"min-h-0 flex-1",children:[n.jsx(Ye,{crew:a,hereId:f,nameOf:g,onOpen:u}),n.jsx(Be,{crew:a,busy:d,nameOf:g,onOpen:u,onRespond:x}),n.jsx(Ue,{crew:a,hereId:f,busy:d,nameOf:g,onOpen:u,onMarkRead:s,onStop:i})]}):!c&&n.jsx("p",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Loading the crew…"}),e[15]=d,e[16]=a,e[17]=c,e[18]=s,e[19]=g,e[20]=u,e[21]=x,e[22]=f,e[23]=i,e[24]=I):I=e[24];let $;return e[25]!==I||e[26]!==k||e[27]!==S?($=n.jsxs("aside",{"aria-label":"Crew",className:"flex size-full min-h-0 flex-col bg-canvas",children:[k,S,I]}),e[25]=I,e[26]=k,e[27]=S,e[28]=$):$=e[28],$}function Fe(t){return[t.sessionId,t]}function Ye(t){var h;const e=G.c(45),{crew:l,hereId:r,nameOf:f,onOpen:a}=t;let c,d,x,s,i;if(e[0]!==l||e[1]!==r||e[2]!==f||e[3]!==a){let N;e[9]!==l.rootId?(N=C=>C.sessionId===l.rootId,e[9]=l.rootId,e[10]=N):N=e[10];const y=l.members.find(N),k=l.members.filter(De);let S;e[11]!==l?(S=Te(l),e[11]=l,e[12]=S):S=e[12],i=S;const I=(h=k[0])==null?void 0:h.startedAt;c="Crew summary",d="border-b px-3 pb-3 pt-1";const $=y&&n.jsx("button",{type:"button",onClick:()=>a(y),"aria-current":y.sessionId===r?"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:f(y)}),A=i.size===1?"session":"sessions",v=I?` · since ${Ee(I)}`:"";let O;e[13]!==A||e[14]!==v||e[15]!==i.size?(O=n.jsxs("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[i.size," ",A,v]}),e[13]=A,e[14]=v,e[15]=i.size,e[16]=O):O=e[16],e[17]!==O||e[18]!==$?(x=n.jsxs("div",{className:"flex items-baseline gap-2",children:[$,O]}),e[17]=O,e[18]=$,e[19]=x):x=e[19],s=k.length>0&&n.jsx("div",{"data-crew-strip":!0,className:"mt-2.5 flex gap-[3px]",role:"list","aria-label":"One cell per session, in the order they were started",children:k.map(C=>{const T=ee(C);return n.jsx("button",{type:"button",role:"listitem","data-crew-cell":T,title:`${f(C)}: ${ne(C)}`,"aria-label":`${f(C)}: ${ne(C)}`,onClick:()=>{var z;return(z=document.querySelector(`[data-crew-row="${C.sessionId}"]`))==null?void 0:z.scrollIntoView({block:"nearest",behavior:"smooth"})},className:M("h-2.5 min-w-[3px] flex-1 rounded-[2px] outline-none focus-visible:ring-2 focus-visible:ring-ring",Pe[T],C.sessionId===r&&"outline outline-[1.5px] outline-offset-2 outline-foreground")},C.sessionId)})}),e[0]=l,e[1]=r,e[2]=f,e[3]=a,e[4]=c,e[5]=d,e[6]=x,e[7]=s,e[8]=i}else c=e[4],d=e[5],x=e[6],s=e[7],i=e[8];let p;e[20]!==i.working?(p=i.working>0&&n.jsx(H,{dot:q.working,value:i.working,label:"working"}),e[20]=i.working,e[21]=p):p=e[21];let w;e[22]!==i.needsYou?(w=i.needsYou>0&&n.jsx(H,{dot:q["needs-you"],value:i.needsYou,label:i.needsYou===1?"needs you":"need you"}),e[22]=i.needsYou,e[23]=w):w=e[23];let j;e[24]!==i.done?(j=i.done>0&&n.jsx(H,{dot:q.done,value:i.done,label:"done"}),e[24]=i.done,e[25]=j):j=e[25];let b;e[26]!==i.failed?(b=i.failed>0&&n.jsx(H,{dot:q.failed,value:i.failed,label:"failed"}),e[26]=i.failed,e[27]=b):b=e[27];let g;e[28]!==i.unreachable?(g=i.unreachable>0&&n.jsx(H,{dot:q.unreachable,value:i.unreachable,label:"away"}),e[28]=i.unreachable,e[29]=g):g=e[29];let o;e[30]!==i.unreadResults?(o=i.unreadResults>0&&n.jsxs("span",{className:"ml-auto text-warning",children:[n.jsx("span",{className:"font-medium tabular-nums",children:i.unreadResults})," ",i.unreadResults===1?"result":"results"," unread"]}),e[30]=i.unreadResults,e[31]=o):o=e[31];let u;e[32]!==o||e[33]!==p||e[34]!==w||e[35]!==j||e[36]!==b||e[37]!==g?(u=n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3.5 gap-y-1 text-xs text-muted-foreground",children:[p,w,j,b,g,o]}),e[32]=o,e[33]=p,e[34]=w,e[35]=j,e[36]=b,e[37]=g,e[38]=u):u=e[38];let m;return e[39]!==c||e[40]!==u||e[41]!==d||e[42]!==x||e[43]!==s?(m=n.jsxs("section",{"aria-label":c,className:d,children:[x,s,u]}),e[39]=c,e[40]=u,e[41]=d,e[42]=x,e[43]=s,e[44]=m):m=e[44],m}function De(t){return t.parentId!==null}function Ee(t){const e=new Date(t),l=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return e.toDateString()===new Date().toDateString()?l:`${e.toLocaleDateString([],{month:"short",day:"numeric"})}, ${l}`}function H(t){const e=G.c(10),{dot:l,value:r,label:f}=t;let a;e[0]!==l?(a=M("size-1.5 rounded-full",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=n.jsx("span",{className:a,"aria-hidden":"true"}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==r?(d=n.jsx("span",{className:"font-medium tabular-nums text-foreground",children:r}),e[4]=r,e[5]=d):d=e[5];let x;return e[6]!==f||e[7]!==c||e[8]!==d?(x=n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[c,d," ",f]}),e[6]=f,e[7]=c,e[8]=d,e[9]=x):x=e[9],x}function Be(t){const e=G.c(6),{crew:l,busy:r,nameOf:f,onOpen:a,onRespond:c}=t,d=Me(l),[x,s]=R.useState(0);if(d.length===0)return null;const i=Math.min(x,d.length-1),{member:p,pending:w}=d[i],j=d[i+1];let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Needs you"}),e[0]=b):b=e[0];let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("span",{className:"flex-1"}),e[1]=g):g=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:M("size-1.5 shrink-0 rounded-full",q["needs-you"]),"aria-hidden":"true"}),e[2]=o):o=e[2];const u=w.askedAt?`waiting ${ue(new Date(w.askedAt).toISOString())}`:"waiting";let m;e[3]!==u?(m=n.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-warning",children:u}),e[3]=u,e[4]=m):m=e[4];let h;return e[5]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(de,{"data-icon":"inline-end"}),e[5]=h):h=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:[b,n.jsx("span",{className:"tabular-nums",children:d.length}),g,d.length>1&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"tabular-nums",children:[i+1," of ",d.length]}),n.jsx(Q,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:i===0,onClick:()=>s(i-1),children:n.jsx(Ce,{"data-icon":"inline-start"})}),n.jsx(Q,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:i===d.length-1,onClick:()=>s(i+1),children:n.jsx(de,{"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:[o,n.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:f(p)}),p.device&&n.jsx(ve,{variant:"outline",children:p.device.name}),m]}),n.jsx(ye,{sessionId:p.sessionId,pending:w,queued:0,responding:r.has(w.requestId),onRespond:(N,y)=>void c(p.sessionId,N,y),onOpen:()=>a(p)},w.requestId),n.jsxs(Q,{variant:"ghost",size:"xs",className:"self-end text-muted-foreground",onClick:()=>a(p),children:["Open session",h]})]}),j&&n.jsxs("p",{className:"mt-2 truncate text-xs text-muted-foreground",children:["Next: ",n.jsx("span",{className:"font-medium text-foreground",children:f(j.member)})," ",ne(j.member).toLowerCase()]})]})}function Ue(t){const e=G.c(17),{crew:l,hereId:r,busy:f,nameOf:a,onOpen:c,onMarkRead:d,onStop:x}=t,[s,i]=R.useState("all");let p;if(e[0]!==f||e[1]!==l||e[2]!==s||e[3]!==r||e[4]!==a||e[5]!==d||e[6]!==c||e[7]!==x){let w;e[9]!==s?(w=m=>{const{member:h}=m;if(s==="all")return!0;const N=ee(h);return s==="done"?N!=="working"&&N!=="needs-you":N===s},e[9]=s,e[10]=w):w=e[10];const j=qe(l).filter(w);let b,g;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("h3",{className:"text-sm font-medium",children:"Sessions"}),g=n.jsx("span",{className:"flex-1"}),e[11]=b,e[12]=g):(b=e[11],g=e[12]);let o;e[13]!==s?(o=Le.map(m=>{const{id:h,label:N}=m;return n.jsx("button",{type:"button",role:"radio","aria-checked":s===h,onClick:()=>i(h),className:M("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",s===h&&"bg-accent text-foreground"),children:N},h)}),e[13]=s,e[14]=o):o=e[14];let u;e[15]!==o?(u=n.jsxs("div",{className:"mb-1.5 flex items-center gap-2 px-1.5",children:[b,g,n.jsx("div",{role:"radiogroup","aria-label":"Show sessions",className:"flex gap-0.5",children:o})]}),e[15]=o,e[16]=u):u=e[16],p=n.jsxs("section",{"aria-label":"Sessions",className:"px-1.5 py-2.5",children:[u,j.length===0?n.jsx("p",{className:"px-1.5 py-4 text-center text-xs text-muted-foreground",children:"No sessions here."}):n.jsx("ul",{className:"flex flex-col",children:j.map(m=>n.jsx(We,{row:m,here:m.member.sessionId===r,busy:f,name:a(m.member),onOpen:c,onMarkRead:d,onStop:x},m.member.sessionId))})]}),e[0]=f,e[1]=l,e[2]=s,e[3]=r,e[4]=a,e[5]=d,e[6]=c,e[7]=x,e[8]=p}else p=e[8];return p}function We(t){var oe,re;const e=G.c(73),{row:l,here:r,busy:f,name:a,onOpen:c,onMarkRead:d,onStop:x}=t,{member:s,depth:i,children:p}=l;let w;e[0]!==s?(w=ee(s),e[0]=s,e[1]=w):w=e[1];const j=w;let b;e[2]!==s?(b=ne(s),e[2]=s,e[3]=b):b=e[3];const g=b;let o;e[4]!==s.pullRequests?(o=(oe=s.pullRequests)==null?void 0:oe.at(-1),e[4]=s.pullRequests,e[5]=o):o=e[5];const u=o;let m;e[6]!==s?(m=le(s)&&s.result&&s.parentId,e[6]=s,e[7]=m):m=e[7];const h=m,N=(j==="working"||j==="needs-you")&&(!s.device||((re=s.result)==null?void 0:re.state)==="running"&&s.parentId!==null),y=s.sessionId,k=r?"bg-accent":"hover:bg-accent/60",S=i>0&&"border-l border-border/70";let I;e[8]!==k||e[9]!==S?(I=M("group/crew relative rounded-md",k,S),e[8]=k,e[9]=S,e[10]=I):I=e[10];const $=i>0?6+(i-1)*14:0;let A;e[11]!==$?(A={marginLeft:$},e[11]=$,e[12]=A):A=e[12];let v;e[13]!==s||e[14]!==c?(v=()=>c(s),e[13]=s,e[14]=c,e[15]=v):v=e[15];const O=r?"true":void 0,C=`${a}, ${g}`,T=q[j];let z;e[16]!==T?(z=M("size-1.5 justify-self-center rounded-full",T),e[16]=T,e[17]=z):z=e[17];let L;e[18]!==z?(L=n.jsx("span",{className:z,"aria-hidden":"true"}),e[18]=z,e[19]=L):L=e[19];let P;e[20]!==a?(P=n.jsx("span",{className:"truncate",children:a}),e[20]=a,e[21]=P):P=e[21];let F;e[22]!==r?(F=r&&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[22]=r,e[23]=F):F=e[23];let Y;e[24]!==P||e[25]!==F?(Y=n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12.5px] font-medium",children:[P,F]}),e[24]=P,e[25]=F,e[26]=Y):Y=e[26];let D;e[27]!==s.lastActivityAt?(D=s.lastActivityAt?ue(s.lastActivityAt):"",e[27]=s.lastActivityAt,e[28]=D):D=e[28];let E;e[29]!==D?(E=n.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:D}),e[29]=D,e[30]=E):E=e[30];const ae=(j==="needs-you"||h)&&"text-warning",ie=j==="failed"&&"text-destructive";let B;e[31]!==ae||e[32]!==ie?(B=M("min-w-0 flex-1 truncate",ae,ie),e[31]=ae,e[32]=ie,e[33]=B):B=e[33];let U;e[34]!==g||e[35]!==B?(U=n.jsx("span",{className:B,children:g}),e[34]=g,e[35]=B,e[36]=U):U=e[36];let W;e[37]!==u?(W=u&&n.jsxs("span",{className:"shrink-0 rounded-full border px-1.5 text-[11px]",children:["#",u.number]}),e[37]=u,e[38]=W):W=e[38];let _;e[39]!==s.device?(_=s.device&&n.jsx("span",{className:"shrink-0",children:s.device.name}),e[39]=s.device,e[40]=_):_=e[40];let V;e[41]!==p?(V=p>0&&n.jsxs("span",{className:"shrink-0",children:[p," ",p===1?"session":"sessions"]}),e[41]=p,e[42]=V):V=e[42];let J;e[43]!==s.model?(J=s.model&&n.jsx("span",{className:"shrink-0 text-muted-foreground/70",children:ke(s.model)}),e[43]=s.model,e[44]=J):J=e[44];let X;e[45]!==U||e[46]!==W||e[47]!==_||e[48]!==V||e[49]!==J?(X=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:[U,W,_,V,J]}),e[45]=U,e[46]=W,e[47]=_,e[48]=V,e[49]=J,e[50]=X):X=e[50];let Z;e[51]!==v||e[52]!==O||e[53]!==C||e[54]!==L||e[55]!==Y||e[56]!==E||e[57]!==X?(Z=n.jsxs("button",{type:"button",onClick:v,"aria-current":O,"aria-label":C,className:"grid w-full 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:[L,Y,E,X]}),e[51]=v,e[52]=O,e[53]=C,e[54]=L,e[55]=Y,e[56]=E,e[57]=X,e[58]=Z):Z=e[58];let K;e[59]!==f||e[60]!==N||e[61]!==s||e[62]!==a||e[63]!==d||e[64]!==x||e[65]!==h?(K=(h||N)&&n.jsxs("div",{className:"absolute right-1.5 top-1 hidden gap-1 group-focus-within/crew:flex group-hover/crew:flex",children:[h&&s.result&&s.parentId&&n.jsx(Q,{variant:"outline",size:"icon-xs",className:"bg-popover","aria-label":`Mark ${a}'s result read`,title:"Mark the result read",disabled:f.has(s.result.taskId),onClick:()=>void d(s.parentId,s.result.taskId),children:n.jsx(Re,{"data-icon":"inline-start"})}),N&&n.jsx(Q,{variant:"outline",size:"icon-xs",className:"bg-popover text-destructive","aria-label":`Stop ${a}`,title:"Stop this session",disabled:f.has(s.sessionId),onClick:()=>void x(s),children:n.jsx(Ae,{"data-icon":"inline-start"})})]}),e[59]=f,e[60]=N,e[61]=s,e[62]=a,e[63]=d,e[64]=x,e[65]=h,e[66]=K):K=e[66];let se;return e[67]!==s.sessionId||e[68]!==A||e[69]!==Z||e[70]!==K||e[71]!==I?(se=n.jsxs("li",{"data-crew-row":y,className:I,style:A,children:[Z,K]}),e[67]=s.sessionId,e[68]=A,e[69]=Z,e[70]=K,e[71]=I,e[72]=se):se=e[72],se}export{Ke as CrewPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as G,r as H,j as i}from"./vendor-react-gGw_S5I_.js";import{V as M,W as P,J as X,X as z}from"./index-
|
|
1
|
+
import{c as G,r as H,j as i}from"./vendor-react-gGw_S5I_.js";import{V as M,W as P,J as X,X as z}from"./index-DUfVcKxj.js";const F=2e5;function W(l){const e=G.c(32),{value:t,onChange:v,readOnly:f,filePath:E,ariaLabel:L,textareaRef:u,onKeyDown:S,onSelect:_}=l,p=M(),[h,N]=H.useState(null),d=H.useRef(null),m=H.useRef(null);let x;e[0]!==E?(x=P(E)??"markdown",e[0]=E,e[1]=x):x=e[1];const g=x,b=t.length>F;let j,k;e[2]!==p||e[3]!==g||e[4]!==b||e[5]!==t?(j=()=>{if(b){N(null);return}let r=!1;const I=setTimeout(()=>{z(t,g,p).then(A=>{r||N(A)})},80);return()=>{r=!0,clearTimeout(I)}},k=[t,g,p,b],e[2]=p,e[3]=g,e[4]=b,e[5]=t,e[6]=j,e[7]=k):(j=e[6],k=e[7]),H.useEffect(j,k);let R;e[8]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{d.current&&m.current&&(m.current.scrollTop=d.current.scrollTop,m.current.scrollLeft=d.current.scrollLeft)},e[8]=R):R=e[8];const D=R;let T;e[9]!==u?(T=r=>{d.current=r,u&&(u.current=r)},e[9]=u,e[10]=T):T=e[10];const y=T;let n;e[11]!==h||e[12]!==t?(n=h?h.map(J):i.jsx("code",{className:"text-foreground",children:t}),e[11]=h,e[12]=t,e[13]=n):n=e[13];let s;e[14]!==n?(s=i.jsx("pre",{ref:m,"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:n}),e[14]=n,e[15]=s):s=e[15];let o;e[16]!==v?(o=r=>v(r.target.value),e[16]=v,e[17]=o):o=e[17];const C=f&&"cursor-default";let a;e[18]!==C?(a=X("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",C),e[18]=C,e[19]=a):a=e[19];let c;e[20]!==L||e[21]!==y||e[22]!==S||e[23]!==_||e[24]!==f||e[25]!==a||e[26]!==o||e[27]!==t?(c=i.jsx("textarea",{ref:y,"aria-label":L,value:t,onChange:o,onScroll:D,onKeyDown:S,onSelect:_,readOnly:f,spellCheck:!1,className:a,placeholder:"Empty file"}),e[20]=L,e[21]=y,e[22]=S,e[23]=_,e[24]=f,e[25]=a,e[26]=o,e[27]=t,e[28]=c):c=e[28];let w;return e[29]!==c||e[30]!==s?(w=i.jsxs("div",{className:"relative min-h-0 flex-1 bg-background",children:[s,c]}),e[29]=c,e[30]=s,e[31]=w):w=e[31],w}function J(l,e){return i.jsxs("span",{children:[l.map(K),`
|
|
2
2
|
`]},e)}function K(l,e){return i.jsx("span",{style:{color:l.color},children:l.content},e)}export{W as H};
|
package/dist/web/assets/{KeyboardShortcutsDialog-CRuTSHwt.js → KeyboardShortcutsDialog-DHxjcyzu.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as q,j as t,r as k}from"./vendor-react-gGw_S5I_.js";import{D as F,g as $,K as T,e as Q,B as P,f as Y,r as _,h as H,i as M,j as U,k as J,l as V,I as W,m as X,n as Z,o as ee,A as te,p as se,q as ae,s as le,t as ne,u as re}from"./index-
|
|
1
|
+
import{c as q,j as t,r as k}from"./vendor-react-gGw_S5I_.js";import{D as F,g as $,K as T,e as Q,B as P,f as Y,r as _,h as H,i as M,j as U,k as J,l as V,I as W,m as X,n as Z,o as ee,A as te,p as se,q as ae,s as le,t as ne,u as re}from"./index-DUfVcKxj.js";import{R as O,K as oe,S as ce}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const ie=new Set(["Alt","Control","Meta","Shift"]);function fe(e){const s=q.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(F,{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=q.c(45),[s,f]=k.useState(""),[l,x]=k.useState(null),[a,r]=k.useState(null),[B,G]=k.useState($);let E,I;e[0]!==l?(E=()=>{if(!l)return;const D=l,A=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,D);if(p){r(`Already assigned to “${p.label}”.`);return}re(D,c),G($()),x(null),r(null)};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},I=[l],e[0]=l,e[1]=E,e[2]=I):(E=e[1],I=e[2]),k.useEffect(E,I);let g,j,d,y,b,N,S,w,m,u,h;if(e[3]!==B||e[4]!==a||e[5]!==s||e[6]!==l){const D=s.trim().toLowerCase(),A=D?T.filter(i=>`${i.label} ${i.description} ${i.group}`.toLowerCase().includes(D)):T;j=H,S="max-w-2xl gap-0 overflow-hidden p-0",w=!1,e[18]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(M,{className:"p-4 pb-3",children:[t.jsxs(U,{className:"flex items-center gap-2",children:[t.jsx(oe,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4"}),"Keyboard shortcuts"]}),t.jsx(J,{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(),G($()),r(null)},children:[t.jsx(O,{"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],g=ae,N="h-[min(28rem,60vh)]",y="flex flex-col gap-4 px-3 pb-4",b=Q.map(i=>{const L=A.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(B[o.command])}),t.jsx(P,{variant:"ghost",size:"icon-sm",onClick:()=>{_(o.command),G($()),r(null)},"aria-label":`Reset shortcut for ${o.label}`,children:t.jsx(O,{"data-icon":"inline-start"})})]},o.command)})]},i)}),e[3]=B,e[4]=a,e[5]=s,e[6]=l,e[7]=g,e[8]=j,e[9]=d,e[10]=y,e[11]=b,e[12]=N,e[13]=S,e[14]=w,e[15]=m,e[16]=u,e[17]=h}else g=e[7],j=e[8],d=e[9],y=e[10],b=e[11],N=e[12],S=e[13],w=e[14],m=e[15],u=e[16],h=e[17];let C;e[29]!==y||e[30]!==b?(C=t.jsx("div",{className:y,children:b}),e[29]=y,e[30]=b,e[31]=C):C=e[31];let v;e[32]!==g||e[33]!==C||e[34]!==N?(v=t.jsx(g,{className:N,children:C}),e[32]=g,e[33]=C,e[34]=N,e[35]=v):v=e[35];let R;return e[36]!==j||e[37]!==d||e[38]!==v||e[39]!==S||e[40]!==w||e[41]!==m||e[42]!==u||e[43]!==h?(R=t.jsxs(j,{className:S,showCloseButton:w,children:[m,u,h,d,v]}),e[36]=j,e[37]=d,e[38]=v,e[39]=S,e[40]=w,e[41]=m,e[42]=u,e[43]=h,e[44]=R):R=e[44],R}export{fe as KeyboardShortcutsDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as B,r as V,j as t}from"./vendor-react-gGw_S5I_.js";import{B as M,b5 as me,b6 as ee,A as se,b7 as fe,b8 as J,H as xe,T as pe,b9 as ge,ba as he,bb as be,bc as je,bd as we,be as ae,bf as Ne,bg as Ie,aU as qe,bh as ke,bi as ye,bj as ve,bk as Se,aX as _e,bl as Ae,q as Ce,$ as G,L as oe,M as re,Q as ce,J as De,Z as de}from"./index-NgN68ZoJ.js";import{b as $e,a2 as Me,a3 as Pe,a4 as Oe,a5 as Re,C as ue,Y as Ee,l as Te,P as Le}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function ze(m){const e={};for(const s of m)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 Be(m,e){const s={};for(const n of m){const a=e[n.name];if(typeof a=="boolean"){s[n.name]=a;continue}a!==""&&(s[n.name]=n.type==="number"||n.type==="integer"?Number(a):a)}return s}function Qe(m,e){return m.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 Fe(m){const e=B.c(52),{request:s,responding:n,onAnswer:a}=m;let r;e[0]!==s.fields?(r=()=>ze(s.fields),e[0]=s.fields,e[1]=r):r=e[1];const[i,o]=V.useState(r);let d;e[2]!==s.fields||e[3]!==i?(d=Qe(s.fields,i),e[2]=s.fields,e[3]=i,e[4]=d):d=e[4];const u=d,p=s.displayName||s.title||s.serverName;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(N,j)=>{o(k=>({...k,[N]:j}))},e[5]=f):f=e[5];const c=f;let l;e[6]!==a||e[7]!==s.requestId?(l=()=>a==null?void 0:a(s.requestId,{action:"decline"}),e[6]=a,e[7]=s.requestId,e[8]=l):l=e[8];const x=l;if(s.mode==="url"&&s.url){const N=s.url;let j;e[9]!==s.message?(j=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[9]=s.message,e[10]=j):j=e[10];let k;e[11]!==N?(k=t.jsx("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:N,children:N}),e[11]=N,e[12]=k):k=e[12];let y;e[13]!==x||e[14]!==a||e[15]!==s.requestId||e[16]!==n||e[17]!==N?(y=a&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsxs(M,{size:"sm",disabled:n,onClick:()=>{window.open(N,"_blank","noopener,noreferrer"),a(s.requestId,{action:"accept"})},children:["Open link",t.jsx($e,{"data-icon":"inline-end"})]}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,onClick:x,children:"Decline"})]}),e[13]=x,e[14]=a,e[15]=s.requestId,e[16]=n,e[17]=N,e[18]=y):y=e[18];let v;return e[19]!==p||e[20]!==j||e[21]!==k||e[22]!==y?(v=t.jsxs(te,{server:p,children:[j,k,y]}),e[19]=p,e[20]=j,e[21]=k,e[22]=y,e[23]=v):v=e[23],v}let g;e[24]!==s.message?(g=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[24]=s.message,e[25]=g):g=e[25];let h;if(e[26]!==a||e[27]!==s.fields||e[28]!==s.requestId||e[29]!==n||e[30]!==i){let N;e[32]!==a||e[33]!==s.requestId||e[34]!==n||e[35]!==i?(N=j=>t.jsx(Ue,{id:`elicit-${s.requestId}-${j.name}`,field:j,value:i[j.name],disabled:n||!a,onChange:k=>c(j.name,k)},j.name),e[32]=a,e[33]=s.requestId,e[34]=n,e[35]=i,e[36]=N):N=e[36],h=s.fields.map(N),e[26]=a,e[27]=s.fields,e[28]=s.requestId,e[29]=n,e[30]=i,e[31]=h}else h=e[31];let w;e[37]!==h?(w=t.jsx("div",{className:"mt-3 flex flex-col gap-3",children:h}),e[37]=h,e[38]=w):w=e[38];let I;e[39]!==u||e[40]!==x||e[41]!==a||e[42]!==s.fields||e[43]!==s.requestId||e[44]!==n||e[45]!==i?(I=a&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx(M,{size:"sm",disabled:n||!u,onClick:()=>a(s.requestId,{action:"accept",content:Be(s.fields,i)}),children:"Send"}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,onClick:x,children:"Decline"})]}),e[39]=u,e[40]=x,e[41]=a,e[42]=s.fields,e[43]=s.requestId,e[44]=n,e[45]=i,e[46]=I):I=e[46];let q;return e[47]!==p||e[48]!==g||e[49]!==w||e[50]!==I?(q=t.jsxs(te,{server:p,children:[g,w,I]}),e[47]=p,e[48]=g,e[49]=w,e[50]=I,e[51]=q):q=e[51],q}function Ue(m){const e=B.c(55),{id:s,field:n,value:a,disabled:r,onChange:i}=m;if(n.type==="boolean"){const x=a===!0;let g;e[0]!==i?(g=q=>i(q===!0),e[0]=i,e[1]=g):g=e[1];let h;e[2]!==r||e[3]!==s||e[4]!==x||e[5]!==g?(h=t.jsx(fe,{id:s,checked:x,disabled:r,onCheckedChange:g}),e[2]=r,e[3]=s,e[4]=x,e[5]=g,e[6]=h):h=e[6];let w;e[7]!==n?(w=t.jsx(Z,{field:n}),e[7]=n,e[8]=w):w=e[8];let I;return e[9]!==s||e[10]!==h||e[11]!==w?(I=t.jsxs(J,{htmlFor:s,className:"items-start gap-2 font-normal",children:[h,w]}),e[9]=s,e[10]=h,e[11]=w,e[12]=I):I=e[12],I}if(n.type==="enum"){let x;e[13]!==n?(x=t.jsx(Z,{field:n}),e[13]=n,e[14]=x):x=e[14];let g;e[15]!==s||e[16]!==x?(g=t.jsx(J,{htmlFor:s,children:x}),e[15]=s,e[16]=x,e[17]=g):g=e[17];let h;e[18]!==a?(h=typeof a=="string"&&a?[a]:[],e[18]=a,e[19]=h):h=e[19];let w;e[20]!==i?(w=y=>{y[0]&&i(y[0])},e[20]=i,e[21]=w):w=e[21];const I=n.label;let q;e[22]!==n.options?(q=n.options??[],e[22]=n.options,e[23]=q):q=e[23];let N;if(e[24]!==r||e[25]!==q){let y;e[27]!==r?(y=v=>t.jsx(xe,{value:v.value,disabled:r,className:"w-full justify-start px-3",children:v.label},v.value),e[27]=r,e[28]=y):y=e[28],N=q.map(y),e[24]=r,e[25]=q,e[26]=N}else N=e[26];let j;e[29]!==n.label||e[30]!==s||e[31]!==h||e[32]!==w||e[33]!==N?(j=t.jsx(pe,{id:s,value:h,onValueChange:w,orientation:"vertical",variant:"outline",size:"sm",className:"w-full items-stretch","aria-label":I,children:N}),e[29]=n.label,e[30]=s,e[31]=h,e[32]=w,e[33]=N,e[34]=j):j=e[34];let k;return e[35]!==g||e[36]!==j?(k=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[g,j]}),e[35]=g,e[36]=j,e[37]=k):k=e[37],k}let o;e[38]!==n?(o=t.jsx(Z,{field:n}),e[38]=n,e[39]=o):o=e[39];let d;e[40]!==s||e[41]!==o?(d=t.jsx(J,{htmlFor:s,children:o}),e[40]=s,e[41]=o,e[42]=d):d=e[42];const u=n.type==="string"?"text":"number",p=typeof a=="string"?a:"";let f;e[43]!==i?(f=x=>i(x.target.value),e[43]=i,e[44]=f):f=e[44];let c;e[45]!==r||e[46]!==n.label||e[47]!==s||e[48]!==u||e[49]!==p||e[50]!==f?(c=t.jsx(me,{id:s,"aria-label":n.label,type:u,value:p,disabled:r,onChange:f}),e[45]=r,e[46]=n.label,e[47]=s,e[48]=u,e[49]=p,e[50]=f,e[51]=c):c=e[51];let l;return e[52]!==d||e[53]!==c?(l=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,c]}),e[52]=d,e[53]=c,e[54]=l):l=e[54],l}function Z(m){const e=B.c(8),{field:s}=m;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 a;e[2]!==s.description?(a=s.description&&t.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:s.description}),e[2]=s.description,e[3]=a):a=e[3];let r;return e[4]!==s.label||e[5]!==n||e[6]!==a?(r=t.jsxs("span",{className:"min-w-0",children:[s.label,n,a]}),e[4]=s.label,e[5]=n,e[6]=a,e[7]=r):r=e[7],r}function te(m){const e=B.c(8),{server:s,children:n}=m;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Me,{className:"text-info"}),e[0]=a):a=e[0];let r;e[1]!==s?(r=t.jsxs(ee,{children:[s," needs input"]}),e[1]=s,e[2]=r):r=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 o;return e[5]!==r||e[6]!==i?(o=t.jsxs(se,{className:"border-info/40 bg-info/5",children:[a,r,i]}),e[5]=r,e[6]=i,e[7]=o):o=e[7],o}function Ye(m){const e=B.c(15),{request:s,responding:n,onChoose:a}=m;let r,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Pe,{className:"text-warning"}),i=t.jsx(ee,{children:"The agent declined this request"}),e[0]=r,e[1]=i):(r=e[0],i=e[1]);let o;e[2]!==s.originalModel?(o=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]=o):o=e[3];let d;e[4]!==s.guidanceText?(d=s.guidanceText&&t.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:s.guidanceText}),e[4]=s.guidanceText,e[5]=d):d=e[5];let u;e[6]!==a||e[7]!==s.fallbackModel||e[8]!==s.requestId||e[9]!==n?(u=a&&t.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t.jsxs(M,{size:"sm",disabled:n,onClick:()=>a(s.requestId,"retry_fallback"),children:["Retry on ",s.fallbackModel]}),t.jsx(M,{variant:"outline",size:"sm",disabled:n,onClick:()=>a(s.requestId,"edit_prompt"),children:"Edit prompt"}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,className:"ml-auto text-muted-foreground",onClick:()=>a(s.requestId,"cancelled"),children:"Dismiss"})]}),e[6]=a,e[7]=s.fallbackModel,e[8]=s.requestId,e[9]=n,e[10]=u):u=e[10];let p;return e[11]!==o||e[12]!==d||e[13]!==u?(p=t.jsxs(se,{className:"border-warning/40 bg-warning/5",children:[r,i,t.jsxs("div",{className:"col-start-2 mt-1 min-w-0",children:[o,d,u]})]}),e[11]=o,e[12]=d,e[13]=u,e[14]=p):p=e[14],p}function He(m){const e=B.c(64),{request:s,input:n,canAnswer:a,onOpen:r}=m;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];const[o,d]=V.useState(i),{sessionId:u}=s;switch(s.kind){case"permission":{const p=s.request;let f;e[1]!==n.responding||e[2]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[1]=n.responding,e[2]=s.request.requestId,e[3]=f):f=e[3];let c;e[4]!==a||e[5]!==n||e[6]!==u?(c=a?(x,g)=>void n.respond(u,x,g):void 0,e[4]=a,e[5]=n,e[6]=u,e[7]=c):c=e[7];let l;return e[8]!==s.request||e[9]!==f||e[10]!==c?(l=t.jsx(he,{request:p,queued:0,responding:f,onRespond:c}),e[8]=s.request,e[9]=f,e[10]=c,e[11]=l):l=e[11],l}case"question":{const p=s.request;let f;e[12]!==n.responding||e[13]!==s.request.toolUseId?(f=n.responding.has(s.request.toolUseId),e[12]=n.responding,e[13]=s.request.toolUseId,e[14]=f):f=e[14];let c;e[15]!==o||e[16]!==s.request.toolUseId?(c=o.has(s.request.toolUseId),e[15]=o,e[16]=s.request.toolUseId,e[17]=c):c=e[17];let l;e[18]!==a||e[19]!==n||e[20]!==u?(l=a?async(g,h)=>{(await n.answerQuestion(u,g,h)).gone&&d(I=>new Set(I).add(g))}:void 0,e[18]=a,e[19]=n,e[20]=u,e[21]=l):l=e[21];let x;return e[22]!==r||e[23]!==s.request||e[24]!==f||e[25]!==c||e[26]!==l?(x=t.jsx(ge,{request:p,responding:f,gone:c,onAnswer:l,onOpenSession:r}),e[22]=r,e[23]=s.request,e[24]=f,e[25]=c,e[26]=l,e[27]=x):x=e[27],x}case"elicitation":{const p=s.request;let f;e[28]!==n.responding||e[29]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[28]=n.responding,e[29]=s.request.requestId,e[30]=f):f=e[30];let c;e[31]!==a||e[32]!==n||e[33]!==u?(c=a?(x,g)=>void n.answerElicitation(u,x,g):void 0,e[31]=a,e[32]=n,e[33]=u,e[34]=c):c=e[34];let l;return e[35]!==s.request||e[36]!==f||e[37]!==c?(l=t.jsx(Fe,{request:p,responding:f,onAnswer:c}),e[35]=s.request,e[36]=f,e[37]=c,e[38]=l):l=e[38],l}case"dialog":{const p=s.request;let f;e[39]!==n.responding||e[40]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[39]=n.responding,e[40]=s.request.requestId,e[41]=f):f=e[41];let c;e[42]!==a||e[43]!==n||e[44]!==u?(c=a?(x,g)=>void n.answerDialog(u,x,g):void 0,e[42]=a,e[43]=n,e[44]=u,e[45]=c):c=e[45];let l;return e[46]!==s.request||e[47]!==f||e[48]!==c?(l=t.jsx(Ye,{request:p,responding:f,onChoose:c}),e[46]=s.request,e[47]=f,e[48]=c,e[49]=l):l=e[49],l}case"plan":case"deferred":{let p;e[50]!==s.kind?(p=s.kind==="plan"?t.jsx(Oe,{className:"text-warning"}):t.jsx(Re,{className:"text-warning"}),e[50]=s.kind,e[51]=p):p=e[51];const f=s.kind==="plan"?"A plan is waiting for review":"A permission was deferred";let c;e[52]!==f?(c=t.jsx(ee,{children:f}),e[52]=f,e[53]=c):c=e[53];const l=s.kind==="plan"?"Review it in its session.":"Open the session and resume it to answer.";let x;e[54]!==l?(x=t.jsx("p",{className:"col-start-2 mt-1 text-sm text-muted-foreground",children:l}),e[54]=l,e[55]=x):x=e[55];let g;e[56]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(ue,{"data-icon":"inline-end"}),e[56]=g):g=e[56];let h;e[57]!==r?(h=t.jsx("div",{className:"col-start-2 mt-2",children:t.jsxs(M,{size:"xs",onClick:r,children:["Open session",g]})}),e[57]=r,e[58]=h):h=e[58];let w;return e[59]!==p||e[60]!==c||e[61]!==x||e[62]!==h?(w=t.jsxs(se,{className:"border-warning/40 bg-warning/5",children:[p,c,x,h]}),e[59]=p,e[60]=c,e[61]=x,e[62]=h,e[63]=w):w=e[63],w}}}function Ke(m,e,s=()=>!0){const n=new Map(e.map(i=>[i.sessionId,i])),a=i=>{const o=n.get(i);return o?ae(o):Date.now()},r=[];for(const[i,o]of m.permissionsBySession)for(const d of o)r.push({kind:"permission",sessionId:i,since:d.timestamp,request:d});for(const[i,o]of m.questionsBySession)for(const d of o)r.push({kind:"question",sessionId:i,since:d.askedAt,request:d});for(const[i,o]of m.elicitationsBySession)for(const d of o)r.push({kind:"elicitation",sessionId:i,since:d.askedAt,request:d});for(const[i,o]of m.dialogsBySession)for(const d of o)r.push({kind:"dialog",sessionId:i,since:d.askedAt,request:d});for(const i of m.awaitingPlan)r.push({kind:"plan",sessionId:i,since:a(i)});for(const i of e)i.agentStatus==="deferred"&&!i.archived&&r.push({kind:"deferred",sessionId:i.sessionId,since:a(i.sessionId)});return r.filter(i=>s(i.sessionId)).sort((i,o)=>i.since-o.since)}function ne(m){switch(m.kind){case"permission":return m.request.requestId;case"question":return m.request.toolUseId;case"elicitation":case"dialog":return m.request.requestId;default:return`${m.kind}:${m.sessionId}`}}const Ve=864e5,ie=3,Ge=8;function Xe(m,e,s=Date.now()){const n=m.filter(d=>!d.archived&&!(d.teamName&&d.agentName)),{topLevel:a,crewOf:r}=be(n),i=a.map(d=>{const u=r.get(d.sessionId)??[],p=u.length?je(d,u):d.lastActivityAt||d.lastModified,f=[d,...u].flatMap(c=>(c.pullRequests??[]).map(l=>({pullRequest:l,by:c}))).sort((c,l)=>Date.parse(l.pullRequest.timestamp)-Date.parse(c.pullRequest.timestamp))[0];return{session:d,members:u,cells:u.map(c=>e(c).state),counts:u.length?we(u,e):null,activityAt:p,...f&&{landed:{number:f.pullRequest.number,title:f.pullRequest.title,url:f.pullRequest.url,by:f.by}}}}).sort((d,u)=>Date.parse(u.activityAt)-Date.parse(d.activityAt)),o=i.filter(d=>s-Date.parse(d.activityAt)<Ve);return(o.length>=ie?o:i.slice(0,ie)).slice(0,Ge)}function Je(m){const e=new Date(m);return e.setHours(0,0,0,0),e.getTime()}const Ze=10;function We(m,e,s=Date.now()){const n=Je(s),a=[],r=new Map;for(const i of m){if(i.archived)continue;for(const d of i.pullRequests??[]){const u=Date.parse(d.timestamp);u>=n&&a.push({kind:"pr",at:u,session:i,number:d.number,title:d.title,url:d.url})}if(!i.crew)continue;const o=ae(i);if(o>=n&&e(i).state==="done"&&a.push({kind:"finished",at:o,session:i}),i.crew.startedAt>=n){const d=`${i.crew.parentId}:${Math.floor(i.crew.startedAt/6e4)}`,u=r.get(d);u?u.push(i):r.set(d,[i])}}for(const i of r.values())a.push({kind:"started",at:Math.min(...i.map(o=>o.crew.startedAt)),parentId:i[0].crew.parentId,sessions:i});return a.sort((i,o)=>o.at-i.at).slice(0,Ze)}const es={working:"bg-success shadow-[0_0_0_1.5px_color-mix(in_oklch,var(--success)_25%,transparent)]","needs-you":"bg-warning",done:"bg-muted-foreground/40"};function fs(m){const e=B.c(69),{onOpenSession:s,onNewSession:n,onBrowseProjects:a,newSessionControl:r}=m,i=Ne(),o=Ie(),{names:d}=qe(),{names:u}=ke(),p=ye();let f;e[0]!==i.sessions?(f=i.sessions.filter(ns),e[0]=i.sessions,e[1]=f):f=e[1];const c=f;let l;e[2]!==c?(l=new Map(c.map(ts)),e[2]=c,e[3]=l):l=e[3];const x=l;let g;e[4]!==o.awaitingDialog||e[5]!==o.awaitingElicitation?(g=new Set([...o.awaitingElicitation,...o.awaitingDialog]),e[4]=o.awaitingDialog,e[5]=o.awaitingElicitation,e[6]=g):g=e[6];let h;e[7]!==o.awaitingPermission||e[8]!==o.awaitingPlan||e[9]!==o.awaitingQuestion||e[10]!==g?(h={awaitingPermission:o.awaitingPermission,awaitingQuestion:o.awaitingQuestion,awaitingPrompt:g,awaitingPlan:o.awaitingPlan},e[7]=o.awaitingPermission,e[8]=o.awaitingPlan,e[9]=o.awaitingQuestion,e[10]=g,e[11]=h):h=e[11];const w=h;let I;e[12]!==i.procBySession||e[13]!==w?(I=z=>ve(z,i.procBySession,w),e[12]=i.procBySession,e[13]=w,e[14]=I):I=e[14];const q=I;let N;e[15]!==x||e[16]!==p?(N=z=>{const H=x.get(z);return p(H==null?void 0:H.access).canInteract},e[15]=x,e[16]=p,e[17]=N):N=e[17];const j=N;let k;e[18]!==j||e[19]!==o||e[20]!==c?(k=Ke(o,c,j),e[18]=j,e[19]=o,e[20]=c,e[21]=k):k=e[21];const y=k;let v;e[22]!==c||e[23]!==q?(v=Xe(c,q),e[22]=c,e[23]=q,e[24]=v):v=e[24];const Q=v;let P;e[25]!==c||e[26]!==q?(P=We(c,q),e[25]=c,e[26]=q,e[27]=P):P=e[27];const F=P;let Y;e[28]!==x||e[29]!==d?(Y=z=>Se(z,x,d),e[28]=x,e[29]=d,e[30]=Y):Y=e[30];const _=Y;let O;e[31]!==x||e[32]!==s?(O=z=>{const H=x.get(z);H?s(H.dirName,H.fileName):_e(z)},e[31]=x,e[32]=s,e[33]=O):O=e[33];const A=O;let R;e[34]!==i.processes?(R=i.processes.filter(ss),e[34]=i.processes,e[35]=R):R=e[35];const D=R.length;let E;e[36]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Mission Control"}),e[36]=E):E=e[36];let C;e[37]!==x||e[38]!==j||e[39]!==o||e[40]!==_||e[41]!==A||e[42]!==y?(C=t.jsx(is,{queue:y,input:o,byId:x,nameOf:_,onOpen:A,canAnswer:j}),e[37]=x,e[38]=j,e[39]=o,e[40]=_,e[41]=A,e[42]=y,e[43]=C):C=e[43];let T;e[44]!==u?(T=z=>u[z.dirName]??Ae(z),e[44]=u,e[45]=T):T=e[45];let L;e[46]!==_||e[47]!==a||e[48]!==n||e[49]!==A||e[50]!==T||e[51]!==Q?(L=t.jsx(ls,{sessions:Q,nameOf:_,projectLabel:T,onOpen:A,onNewSession:n,onBrowseProjects:a}),e[46]=_,e[47]=a,e[48]=n,e[49]=A,e[50]=T,e[51]=Q,e[52]=L):L=e[52];let b;e[53]!==F||e[54]!==_||e[55]!==A?(b=t.jsx(as,{events:F,nameOf:_,onOpen:A}),e[53]=F,e[54]=_,e[55]=A,e[56]=b):b=e[56];let S;e[57]!==L||e[58]!==b?(S=t.jsxs("div",{className:"flex min-w-0 flex-col gap-8",children:[L,b]}),e[57]=L,e[58]=b,e[59]=S):S=e[59];let U;e[60]!==C||e[61]!==S?(U=t.jsxs("div",{className:"grid gap-8 lg:grid-cols-[minmax(0,380px)_minmax(0,1fr)]",children:[C,S]}),e[60]=C,e[61]=S,e[62]=U):U=e[62];let $;e[63]!==D?($=D>0&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[D," ",D===1?"agent":"agents"," running on this machine."]}),e[63]=D,e[64]=$):$=e[64];let K;return e[65]!==r||e[66]!==U||e[67]!==$?(K=t.jsx(Ce,{className:"h-full",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-8 px-6 pb-10 pt-16 lg:px-10",children:[E,U,$,r]})}),e[65]=r,e[66]=U,e[67]=$,e[68]=K):K=e[68],K}function ss(m){return m.sessionId}function ts(m){return[m.sessionId,m]}function ns(m){return!m.archived}function X(m){const e=B.c(9),{title:s,count:n,children:a}=m;let r;e[0]!==s?(r=t.jsx("h2",{className:"text-sm font-medium",children:s}),e[0]=s,e[1]=r):r=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 o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("span",{className:"flex-1"}),e[4]=o):o=e[4];let d;return e[5]!==a||e[6]!==r||e[7]!==i?(d=t.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[r,i,o,a]}),e[5]=a,e[6]=r,e[7]=i,e[8]=d):d=e[8],d}function W(m,e){const s=m==null?void 0:m.crew;return s?e(s.rootId)??s.rootTitle??null:null}const le={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 is(m){const e=B.c(73),{queue:s,input:n,byId:a,nameOf:r,onOpen:i,canAnswer:o}=m,[d,u]=V.useState(0);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];const f=V.useRef(p);if(s.length===0){let b;e[1]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(X,{title:"Needs you",count:0}),e[1]=b):b=e[1];let S;return e[2]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsxs("section",{"aria-label":"Needs you",className:"min-w-0",children:[b,t.jsx(oe,{children:t.jsx(re,{children:t.jsx(ce,{children:"Nothing is waiting on you."})})})]}),e[2]=S):S=e[2],S}const c=Math.min(d,s.length-1),l=s[c];let x;if(e[3]!==a||e[4]!==r||e[5]!==l.sessionId){const b=a.get(l.sessionId);x=W(b,r),e[3]=a,e[4]=r,e[5]=l.sessionId,e[6]=x}else x=e[6];const g=x;let h;e[7]!==c||e[8]!==o||e[9]!==n||e[10]!==i||e[11]!==s.length||e[12]!==l.kind||e[13]!==l.request||e[14]!==l.sessionId?(h=b=>{const S=b.target;if(!(S.closest("input,textarea,select,[contenteditable=true]")||b.metaKey||b.ctrlKey||b.altKey)&&((b.key==="j"||b.key==="n"||b.key==="ArrowDown")&&(b.preventDefault(),u(Math.min(s.length-1,c+1))),(b.key==="k"||b.key==="ArrowUp")&&(b.preventDefault(),u(Math.max(0,c-1))),b.key==="o"&&(b.preventDefault(),i(l.sessionId)),(b.key==="Enter"||b.key==="d")&&S===b.currentTarget&&o(l.sessionId))){if(l.kind!=="permission")return;const U=b.key==="d"||l.request.defaultToNo?"deny":"allow",$=l.request.requestId;if(l.request.availableDecisions&&!l.request.availableDecisions.includes(U)||(b.preventDefault(),f.current.has($)||n.responding.has($)))return;f.current.add($),n.respond(l.sessionId,$,U).finally(()=>f.current.delete($))}},e[7]=c,e[8]=o,e[9]=n,e[10]=i,e[11]=s.length,e[12]=l.kind,e[13]=l.request,e[14]=l.sessionId,e[15]=h):h=e[15];const w=h;let I;e[16]!==c||e[17]!==s.length?(I=s.length>1&&t.jsxs("span",{className:"flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[c+1," of ",s.length,t.jsx(M,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:c===0,onClick:()=>u(c-1),children:t.jsx(Ee,{"data-icon":"inline-start"})}),t.jsx(M,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:c===s.length-1,onClick:()=>u(c+1),children:t.jsx(ue,{"data-icon":"inline-start"})})]}),e[16]=c,e[17]=s.length,e[18]=I):I=e[18];let q;e[19]!==s.length||e[20]!==I?(q=t.jsx(X,{title:"Needs you",count:s.length,children:I}),e[19]=s.length,e[20]=I,e[21]=q):q=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-warning","aria-hidden":"true"}),e[22]=N):N=e[22];let j;e[23]!==i||e[24]!==l.sessionId?(j=()=>i(l.sessionId),e[23]=i,e[24]=l.sessionId,e[25]=j):j=e[25];let k;e[26]!==r||e[27]!==l.sessionId?(k=r(l.sessionId)??"A session",e[26]=r,e[27]=l.sessionId,e[28]=k):k=e[28];let y;e[29]!==j||e[30]!==k?(y=t.jsx("button",{type:"button",onClick:j,className:"min-w-0 truncate rounded-sm font-medium outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:k}),e[29]=j,e[30]=k,e[31]=y):y=e[31];let v;e[32]!==g?(v=g&&t.jsxs("span",{className:"min-w-0 truncate text-muted-foreground",children:["· ",g]}),e[32]=g,e[33]=v):v=e[33];let Q;e[34]!==l.since?(Q=G(new Date(l.since).toISOString()),e[34]=l.since,e[35]=Q):Q=e[35];let P;e[36]!==Q?(P=t.jsxs("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-warning",children:["waiting ",Q]}),e[36]=Q,e[37]=P):P=e[37];let F;e[38]!==v||e[39]!==P||e[40]!==y?(F=t.jsxs("div",{className:"flex items-center gap-2 px-0.5 text-[13px]",children:[N,y,v,P]}),e[38]=v,e[39]=P,e[40]=y,e[41]=F):F=e[41];const Y=le[l.kind];let _;e[42]!==Y?(_=t.jsx("p",{className:"px-0.5 text-xs text-muted-foreground",children:Y}),e[42]=Y,e[43]=_):_=e[43];let O;e[44]!==l?(O=ne(l),e[44]=l,e[45]=O):O=e[45];let A;e[46]!==o||e[47]!==l.sessionId?(A=o(l.sessionId),e[46]=o,e[47]=l.sessionId,e[48]=A):A=e[48];let R;e[49]!==i||e[50]!==l.sessionId?(R=()=>i(l.sessionId),e[49]=i,e[50]=l.sessionId,e[51]=R):R=e[51];let D;e[52]!==n||e[53]!==l||e[54]!==O||e[55]!==A||e[56]!==R?(D=t.jsx(He,{request:l,input:n,canAnswer:A,onOpen:R},O),e[52]=n,e[53]=l,e[54]=O,e[55]=A,e[56]=R,e[57]=D):D=e[57];let E;e[58]!==F||e[59]!==_||e[60]!==D?(E=t.jsxs("div",{className:"flex flex-col gap-2",children:[F,_,D]}),e[58]=F,e[59]=_,e[60]=D,e[61]=E):E=e[61];let C;e[62]!==c||e[63]!==a||e[64]!==r||e[65]!==s?(C=s.length>1&&t.jsx("ol",{className:"mt-3 flex flex-col","aria-label":"Also waiting",children:s.map((b,S)=>S===c?null:t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>u(S),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:S+1}),t.jsxs("span",{className:"flex min-w-0 flex-col",children:[t.jsxs("span",{className:"truncate font-medium",children:[r(b.sessionId)??"A session",W(a.get(b.sessionId),r)&&t.jsxs("span",{className:"font-normal text-muted-foreground",children:[" · ",W(a.get(b.sessionId),r)]})]}),t.jsx("span",{className:"truncate text-[11.5px] text-muted-foreground",children:le[b.kind]})]}),t.jsx("span",{className:"text-[11px] tabular-nums text-warning",children:G(new Date(b.since).toISOString())})]})},ne(b)))}),e[62]=c,e[63]=a,e[64]=r,e[65]=s,e[66]=C):C=e[66];let T;e[67]===Symbol.for("react.memo_cache_sentinel")?(T=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[67]=T):T=e[67];let L;return e[68]!==w||e[69]!==E||e[70]!==C||e[71]!==q?(L=t.jsxs("section",{"aria-label":"Needs you",tabIndex:0,onKeyDown:w,className:"min-w-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[q,E,C,T]}),e[68]=w,e[69]=E,e[70]=C,e[71]=q,e[72]=L):L=e[72],L}function ls(m){const e=B.c(16),{sessions:s,nameOf:n,projectLabel:a,onOpen:r,onNewSession:i,onBrowseProjects:o}=m;let d;e[0]!==o?(d=o&&t.jsxs(M,{variant:"ghost",size:"xs",className:"text-muted-foreground",onClick:o,children:[t.jsx(Te,{"data-icon":"inline-start"}),"All projects"]}),e[0]=o,e[1]=d):d=e[1];let u;e[2]!==i?(u=i&&t.jsxs(M,{variant:"outline",size:"xs",onClick:i,children:[t.jsx(Le,{"data-icon":"inline-start"}),"New session"]}),e[2]=i,e[3]=u):u=e[3];let p;e[4]!==s.length||e[5]!==d||e[6]!==u?(p=t.jsxs(X,{title:"Your sessions",count:s.length,children:[d,u]}),e[4]=s.length,e[5]=d,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==n||e[9]!==r||e[10]!==a||e[11]!==s?(f=s.length===0?t.jsx(oe,{children:t.jsx(re,{children:t.jsx(ce,{children:"Start a session and it shows up here, with every session it starts."})})}):t.jsx("ul",{className:"flex flex-col",children:s.map(l=>t.jsxs("li",{className:"border-t border-border/70 first:border-t-0",children:[l.members.length>0&&t.jsx("div",{role:"group","aria-label":`${n(l.session.sessionId)} crew`,className:"flex flex-wrap gap-1 px-3 pt-3",children:l.members.map((x,g)=>t.jsx("button",{type:"button","aria-label":`Open ${n(x.sessionId)??"crew member"}`,title:`${n(x.sessionId)}: ${l.cells[g]}`,onClick:()=>r(x.sessionId),className:"flex size-5 items-center justify-center rounded-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:t.jsx("span",{className:De("size-2 rounded-[2px]",es[l.cells[g]])})},x.sessionId))}),t.jsxs("button",{type:"button",onClick:()=>r(l.session.sessionId),className:"grid w-full grid-cols-1 items-center gap-x-4 gap-y-1 rounded-lg px-3 py-3 text-left outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring xl:grid-cols-[minmax(0,1fr)_auto]",children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[t.jsx("span",{className:"truncate text-[13.5px] font-medium",children:n(l.session.sessionId)??"Untitled session"}),t.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground sm:inline",children:a(l.session)})]}),t.jsx("span",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:l.counts?t.jsxs(t.Fragment,{children:[l.counts.working>0&&t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:l.counts.working})," working"]}),l.counts.needsYou>0&&t.jsxs("span",{className:"text-warning",children:[t.jsx("span",{className:"font-medium tabular-nums",children:l.counts.needsYou})," need you"]}),t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:l.counts.size})," in crew"]})]}):l.session.isActive&&t.jsx("span",{children:"working"})}),t.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[l.landed&&t.jsxs(de,{variant:"outline",className:"shrink-0",children:["#",l.landed.number]}),t.jsx("span",{className:"truncate",children:l.landed?`${l.landed.title??"Pull request"} · ${n(l.landed.by.sessionId)??""}`:l.session.lastUserMessage??""})]}),t.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:l.counts?`crew active ${G(l.activityAt)}`:G(l.activityAt)})]})]},l.session.sessionId))}),e[8]=n,e[9]=r,e[10]=a,e[11]=s,e[12]=f):f=e[12];let c;return e[13]!==p||e[14]!==f?(c=t.jsxs("section",{"aria-label":"Your sessions",className:"min-w-0",children:[p,f]}),e[13]=p,e[14]=f,e[15]=c):c=e[15],c}function as(m){const e=B.c(10),{events:s,nameOf:n,onOpen:a}=m;if(s.length===0)return null;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(X,{title:"Landed today"}),e[0]=r):r=e[0];let i;if(e[1]!==s||e[2]!==n||e[3]!==a){let d;e[5]!==n||e[6]!==a?(d=u=>{const p=u.kind==="started"?u.parentId:u.session.sessionId,f=new Date(u.at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>a(p),className:"grid w-full grid-cols-[48px_minmax(0,1fr)] items-baseline gap-2.5 rounded-md px-3 py-1.5 text-left text-[12.5px] outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:f}),t.jsx("span",{className:"min-w-0 truncate",children:os(u,n)})]})},`${u.kind}:${p}:${u.at}`)},e[5]=n,e[6]=a,e[7]=d):d=e[7],i=s.map(d),e[1]=s,e[2]=n,e[3]=a,e[4]=i}else i=e[4];let o;return e[8]!==i?(o=t.jsxs("section",{"aria-label":"Landed today",className:"min-w-0",children:[r,t.jsx("ol",{className:"flex flex-col",children:i})]}),e[8]=i,e[9]=o):o=e[9],o}function os(m,e){switch(m.kind){case"pr":return t.jsxs(t.Fragment,{children:[t.jsxs(de,{variant:"outline",className:"mr-2 text-success",children:["#",m.number]}),t.jsx("span",{className:"font-medium",children:e(m.session.sessionId)??"A session"}),t.jsxs("span",{className:"text-muted-foreground",children:[" · ",m.title??"opened a pull request"]})]});case"finished":return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium",children:e(m.session.sessionId)??"A session"}),t.jsx("span",{className:"text-muted-foreground",children:" finished"})]});case"started":return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium",children:m.sessions.length===1?e(m.sessions[0].sessionId)??"A session":`${m.sessions.length} sessions`}),t.jsxs("span",{className:"text-muted-foreground",children:[" started · ",e(m.parentId)??"by another session"]})]})}}export{fs as MissionHome};
|
|
1
|
+
import{c as B,r as V,j as t}from"./vendor-react-gGw_S5I_.js";import{B as M,b5 as me,b6 as ee,A as se,b7 as fe,b8 as J,H as xe,T as pe,b9 as ge,ba as he,bb as be,bc as je,bd as we,be as ae,bf as Ne,bg as Ie,aU as qe,bh as ke,bi as ye,bj as ve,bk as Se,aX as _e,bl as Ae,q as Ce,$ as G,L as oe,M as re,Q as ce,J as De,Z as de}from"./index-DUfVcKxj.js";import{b as $e,a2 as Me,a3 as Pe,a4 as Oe,a5 as Re,C as ue,Y as Ee,l as Te,P as Le}from"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function ze(m){const e={};for(const s of m)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 Be(m,e){const s={};for(const n of m){const a=e[n.name];if(typeof a=="boolean"){s[n.name]=a;continue}a!==""&&(s[n.name]=n.type==="number"||n.type==="integer"?Number(a):a)}return s}function Qe(m,e){return m.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 Fe(m){const e=B.c(52),{request:s,responding:n,onAnswer:a}=m;let r;e[0]!==s.fields?(r=()=>ze(s.fields),e[0]=s.fields,e[1]=r):r=e[1];const[i,o]=V.useState(r);let d;e[2]!==s.fields||e[3]!==i?(d=Qe(s.fields,i),e[2]=s.fields,e[3]=i,e[4]=d):d=e[4];const u=d,p=s.displayName||s.title||s.serverName;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(N,j)=>{o(k=>({...k,[N]:j}))},e[5]=f):f=e[5];const c=f;let l;e[6]!==a||e[7]!==s.requestId?(l=()=>a==null?void 0:a(s.requestId,{action:"decline"}),e[6]=a,e[7]=s.requestId,e[8]=l):l=e[8];const x=l;if(s.mode==="url"&&s.url){const N=s.url;let j;e[9]!==s.message?(j=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[9]=s.message,e[10]=j):j=e[10];let k;e[11]!==N?(k=t.jsx("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:N,children:N}),e[11]=N,e[12]=k):k=e[12];let y;e[13]!==x||e[14]!==a||e[15]!==s.requestId||e[16]!==n||e[17]!==N?(y=a&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsxs(M,{size:"sm",disabled:n,onClick:()=>{window.open(N,"_blank","noopener,noreferrer"),a(s.requestId,{action:"accept"})},children:["Open link",t.jsx($e,{"data-icon":"inline-end"})]}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,onClick:x,children:"Decline"})]}),e[13]=x,e[14]=a,e[15]=s.requestId,e[16]=n,e[17]=N,e[18]=y):y=e[18];let v;return e[19]!==p||e[20]!==j||e[21]!==k||e[22]!==y?(v=t.jsxs(te,{server:p,children:[j,k,y]}),e[19]=p,e[20]=j,e[21]=k,e[22]=y,e[23]=v):v=e[23],v}let g;e[24]!==s.message?(g=t.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:s.message}),e[24]=s.message,e[25]=g):g=e[25];let h;if(e[26]!==a||e[27]!==s.fields||e[28]!==s.requestId||e[29]!==n||e[30]!==i){let N;e[32]!==a||e[33]!==s.requestId||e[34]!==n||e[35]!==i?(N=j=>t.jsx(Ue,{id:`elicit-${s.requestId}-${j.name}`,field:j,value:i[j.name],disabled:n||!a,onChange:k=>c(j.name,k)},j.name),e[32]=a,e[33]=s.requestId,e[34]=n,e[35]=i,e[36]=N):N=e[36],h=s.fields.map(N),e[26]=a,e[27]=s.fields,e[28]=s.requestId,e[29]=n,e[30]=i,e[31]=h}else h=e[31];let w;e[37]!==h?(w=t.jsx("div",{className:"mt-3 flex flex-col gap-3",children:h}),e[37]=h,e[38]=w):w=e[38];let I;e[39]!==u||e[40]!==x||e[41]!==a||e[42]!==s.fields||e[43]!==s.requestId||e[44]!==n||e[45]!==i?(I=a&&t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx(M,{size:"sm",disabled:n||!u,onClick:()=>a(s.requestId,{action:"accept",content:Be(s.fields,i)}),children:"Send"}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,onClick:x,children:"Decline"})]}),e[39]=u,e[40]=x,e[41]=a,e[42]=s.fields,e[43]=s.requestId,e[44]=n,e[45]=i,e[46]=I):I=e[46];let q;return e[47]!==p||e[48]!==g||e[49]!==w||e[50]!==I?(q=t.jsxs(te,{server:p,children:[g,w,I]}),e[47]=p,e[48]=g,e[49]=w,e[50]=I,e[51]=q):q=e[51],q}function Ue(m){const e=B.c(55),{id:s,field:n,value:a,disabled:r,onChange:i}=m;if(n.type==="boolean"){const x=a===!0;let g;e[0]!==i?(g=q=>i(q===!0),e[0]=i,e[1]=g):g=e[1];let h;e[2]!==r||e[3]!==s||e[4]!==x||e[5]!==g?(h=t.jsx(fe,{id:s,checked:x,disabled:r,onCheckedChange:g}),e[2]=r,e[3]=s,e[4]=x,e[5]=g,e[6]=h):h=e[6];let w;e[7]!==n?(w=t.jsx(Z,{field:n}),e[7]=n,e[8]=w):w=e[8];let I;return e[9]!==s||e[10]!==h||e[11]!==w?(I=t.jsxs(J,{htmlFor:s,className:"items-start gap-2 font-normal",children:[h,w]}),e[9]=s,e[10]=h,e[11]=w,e[12]=I):I=e[12],I}if(n.type==="enum"){let x;e[13]!==n?(x=t.jsx(Z,{field:n}),e[13]=n,e[14]=x):x=e[14];let g;e[15]!==s||e[16]!==x?(g=t.jsx(J,{htmlFor:s,children:x}),e[15]=s,e[16]=x,e[17]=g):g=e[17];let h;e[18]!==a?(h=typeof a=="string"&&a?[a]:[],e[18]=a,e[19]=h):h=e[19];let w;e[20]!==i?(w=y=>{y[0]&&i(y[0])},e[20]=i,e[21]=w):w=e[21];const I=n.label;let q;e[22]!==n.options?(q=n.options??[],e[22]=n.options,e[23]=q):q=e[23];let N;if(e[24]!==r||e[25]!==q){let y;e[27]!==r?(y=v=>t.jsx(xe,{value:v.value,disabled:r,className:"w-full justify-start px-3",children:v.label},v.value),e[27]=r,e[28]=y):y=e[28],N=q.map(y),e[24]=r,e[25]=q,e[26]=N}else N=e[26];let j;e[29]!==n.label||e[30]!==s||e[31]!==h||e[32]!==w||e[33]!==N?(j=t.jsx(pe,{id:s,value:h,onValueChange:w,orientation:"vertical",variant:"outline",size:"sm",className:"w-full items-stretch","aria-label":I,children:N}),e[29]=n.label,e[30]=s,e[31]=h,e[32]=w,e[33]=N,e[34]=j):j=e[34];let k;return e[35]!==g||e[36]!==j?(k=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[g,j]}),e[35]=g,e[36]=j,e[37]=k):k=e[37],k}let o;e[38]!==n?(o=t.jsx(Z,{field:n}),e[38]=n,e[39]=o):o=e[39];let d;e[40]!==s||e[41]!==o?(d=t.jsx(J,{htmlFor:s,children:o}),e[40]=s,e[41]=o,e[42]=d):d=e[42];const u=n.type==="string"?"text":"number",p=typeof a=="string"?a:"";let f;e[43]!==i?(f=x=>i(x.target.value),e[43]=i,e[44]=f):f=e[44];let c;e[45]!==r||e[46]!==n.label||e[47]!==s||e[48]!==u||e[49]!==p||e[50]!==f?(c=t.jsx(me,{id:s,"aria-label":n.label,type:u,value:p,disabled:r,onChange:f}),e[45]=r,e[46]=n.label,e[47]=s,e[48]=u,e[49]=p,e[50]=f,e[51]=c):c=e[51];let l;return e[52]!==d||e[53]!==c?(l=t.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,c]}),e[52]=d,e[53]=c,e[54]=l):l=e[54],l}function Z(m){const e=B.c(8),{field:s}=m;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 a;e[2]!==s.description?(a=s.description&&t.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:s.description}),e[2]=s.description,e[3]=a):a=e[3];let r;return e[4]!==s.label||e[5]!==n||e[6]!==a?(r=t.jsxs("span",{className:"min-w-0",children:[s.label,n,a]}),e[4]=s.label,e[5]=n,e[6]=a,e[7]=r):r=e[7],r}function te(m){const e=B.c(8),{server:s,children:n}=m;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Me,{className:"text-info"}),e[0]=a):a=e[0];let r;e[1]!==s?(r=t.jsxs(ee,{children:[s," needs input"]}),e[1]=s,e[2]=r):r=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 o;return e[5]!==r||e[6]!==i?(o=t.jsxs(se,{className:"border-info/40 bg-info/5",children:[a,r,i]}),e[5]=r,e[6]=i,e[7]=o):o=e[7],o}function Ye(m){const e=B.c(15),{request:s,responding:n,onChoose:a}=m;let r,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Pe,{className:"text-warning"}),i=t.jsx(ee,{children:"The agent declined this request"}),e[0]=r,e[1]=i):(r=e[0],i=e[1]);let o;e[2]!==s.originalModel?(o=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]=o):o=e[3];let d;e[4]!==s.guidanceText?(d=s.guidanceText&&t.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:s.guidanceText}),e[4]=s.guidanceText,e[5]=d):d=e[5];let u;e[6]!==a||e[7]!==s.fallbackModel||e[8]!==s.requestId||e[9]!==n?(u=a&&t.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t.jsxs(M,{size:"sm",disabled:n,onClick:()=>a(s.requestId,"retry_fallback"),children:["Retry on ",s.fallbackModel]}),t.jsx(M,{variant:"outline",size:"sm",disabled:n,onClick:()=>a(s.requestId,"edit_prompt"),children:"Edit prompt"}),t.jsx(M,{variant:"ghost",size:"sm",disabled:n,className:"ml-auto text-muted-foreground",onClick:()=>a(s.requestId,"cancelled"),children:"Dismiss"})]}),e[6]=a,e[7]=s.fallbackModel,e[8]=s.requestId,e[9]=n,e[10]=u):u=e[10];let p;return e[11]!==o||e[12]!==d||e[13]!==u?(p=t.jsxs(se,{className:"border-warning/40 bg-warning/5",children:[r,i,t.jsxs("div",{className:"col-start-2 mt-1 min-w-0",children:[o,d,u]})]}),e[11]=o,e[12]=d,e[13]=u,e[14]=p):p=e[14],p}function He(m){const e=B.c(64),{request:s,input:n,canAnswer:a,onOpen:r}=m;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];const[o,d]=V.useState(i),{sessionId:u}=s;switch(s.kind){case"permission":{const p=s.request;let f;e[1]!==n.responding||e[2]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[1]=n.responding,e[2]=s.request.requestId,e[3]=f):f=e[3];let c;e[4]!==a||e[5]!==n||e[6]!==u?(c=a?(x,g)=>void n.respond(u,x,g):void 0,e[4]=a,e[5]=n,e[6]=u,e[7]=c):c=e[7];let l;return e[8]!==s.request||e[9]!==f||e[10]!==c?(l=t.jsx(he,{request:p,queued:0,responding:f,onRespond:c}),e[8]=s.request,e[9]=f,e[10]=c,e[11]=l):l=e[11],l}case"question":{const p=s.request;let f;e[12]!==n.responding||e[13]!==s.request.toolUseId?(f=n.responding.has(s.request.toolUseId),e[12]=n.responding,e[13]=s.request.toolUseId,e[14]=f):f=e[14];let c;e[15]!==o||e[16]!==s.request.toolUseId?(c=o.has(s.request.toolUseId),e[15]=o,e[16]=s.request.toolUseId,e[17]=c):c=e[17];let l;e[18]!==a||e[19]!==n||e[20]!==u?(l=a?async(g,h)=>{(await n.answerQuestion(u,g,h)).gone&&d(I=>new Set(I).add(g))}:void 0,e[18]=a,e[19]=n,e[20]=u,e[21]=l):l=e[21];let x;return e[22]!==r||e[23]!==s.request||e[24]!==f||e[25]!==c||e[26]!==l?(x=t.jsx(ge,{request:p,responding:f,gone:c,onAnswer:l,onOpenSession:r}),e[22]=r,e[23]=s.request,e[24]=f,e[25]=c,e[26]=l,e[27]=x):x=e[27],x}case"elicitation":{const p=s.request;let f;e[28]!==n.responding||e[29]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[28]=n.responding,e[29]=s.request.requestId,e[30]=f):f=e[30];let c;e[31]!==a||e[32]!==n||e[33]!==u?(c=a?(x,g)=>void n.answerElicitation(u,x,g):void 0,e[31]=a,e[32]=n,e[33]=u,e[34]=c):c=e[34];let l;return e[35]!==s.request||e[36]!==f||e[37]!==c?(l=t.jsx(Fe,{request:p,responding:f,onAnswer:c}),e[35]=s.request,e[36]=f,e[37]=c,e[38]=l):l=e[38],l}case"dialog":{const p=s.request;let f;e[39]!==n.responding||e[40]!==s.request.requestId?(f=n.responding.has(s.request.requestId),e[39]=n.responding,e[40]=s.request.requestId,e[41]=f):f=e[41];let c;e[42]!==a||e[43]!==n||e[44]!==u?(c=a?(x,g)=>void n.answerDialog(u,x,g):void 0,e[42]=a,e[43]=n,e[44]=u,e[45]=c):c=e[45];let l;return e[46]!==s.request||e[47]!==f||e[48]!==c?(l=t.jsx(Ye,{request:p,responding:f,onChoose:c}),e[46]=s.request,e[47]=f,e[48]=c,e[49]=l):l=e[49],l}case"plan":case"deferred":{let p;e[50]!==s.kind?(p=s.kind==="plan"?t.jsx(Oe,{className:"text-warning"}):t.jsx(Re,{className:"text-warning"}),e[50]=s.kind,e[51]=p):p=e[51];const f=s.kind==="plan"?"A plan is waiting for review":"A permission was deferred";let c;e[52]!==f?(c=t.jsx(ee,{children:f}),e[52]=f,e[53]=c):c=e[53];const l=s.kind==="plan"?"Review it in its session.":"Open the session and resume it to answer.";let x;e[54]!==l?(x=t.jsx("p",{className:"col-start-2 mt-1 text-sm text-muted-foreground",children:l}),e[54]=l,e[55]=x):x=e[55];let g;e[56]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(ue,{"data-icon":"inline-end"}),e[56]=g):g=e[56];let h;e[57]!==r?(h=t.jsx("div",{className:"col-start-2 mt-2",children:t.jsxs(M,{size:"xs",onClick:r,children:["Open session",g]})}),e[57]=r,e[58]=h):h=e[58];let w;return e[59]!==p||e[60]!==c||e[61]!==x||e[62]!==h?(w=t.jsxs(se,{className:"border-warning/40 bg-warning/5",children:[p,c,x,h]}),e[59]=p,e[60]=c,e[61]=x,e[62]=h,e[63]=w):w=e[63],w}}}function Ke(m,e,s=()=>!0){const n=new Map(e.map(i=>[i.sessionId,i])),a=i=>{const o=n.get(i);return o?ae(o):Date.now()},r=[];for(const[i,o]of m.permissionsBySession)for(const d of o)r.push({kind:"permission",sessionId:i,since:d.timestamp,request:d});for(const[i,o]of m.questionsBySession)for(const d of o)r.push({kind:"question",sessionId:i,since:d.askedAt,request:d});for(const[i,o]of m.elicitationsBySession)for(const d of o)r.push({kind:"elicitation",sessionId:i,since:d.askedAt,request:d});for(const[i,o]of m.dialogsBySession)for(const d of o)r.push({kind:"dialog",sessionId:i,since:d.askedAt,request:d});for(const i of m.awaitingPlan)r.push({kind:"plan",sessionId:i,since:a(i)});for(const i of e)i.agentStatus==="deferred"&&!i.archived&&r.push({kind:"deferred",sessionId:i.sessionId,since:a(i.sessionId)});return r.filter(i=>s(i.sessionId)).sort((i,o)=>i.since-o.since)}function ne(m){switch(m.kind){case"permission":return m.request.requestId;case"question":return m.request.toolUseId;case"elicitation":case"dialog":return m.request.requestId;default:return`${m.kind}:${m.sessionId}`}}const Ve=864e5,ie=3,Ge=8;function Xe(m,e,s=Date.now()){const n=m.filter(d=>!d.archived&&!(d.teamName&&d.agentName)),{topLevel:a,crewOf:r}=be(n),i=a.map(d=>{const u=r.get(d.sessionId)??[],p=u.length?je(d,u):d.lastActivityAt||d.lastModified,f=[d,...u].flatMap(c=>(c.pullRequests??[]).map(l=>({pullRequest:l,by:c}))).sort((c,l)=>Date.parse(l.pullRequest.timestamp)-Date.parse(c.pullRequest.timestamp))[0];return{session:d,members:u,cells:u.map(c=>e(c).state),counts:u.length?we(u,e):null,activityAt:p,...f&&{landed:{number:f.pullRequest.number,title:f.pullRequest.title,url:f.pullRequest.url,by:f.by}}}}).sort((d,u)=>Date.parse(u.activityAt)-Date.parse(d.activityAt)),o=i.filter(d=>s-Date.parse(d.activityAt)<Ve);return(o.length>=ie?o:i.slice(0,ie)).slice(0,Ge)}function Je(m){const e=new Date(m);return e.setHours(0,0,0,0),e.getTime()}const Ze=10;function We(m,e,s=Date.now()){const n=Je(s),a=[],r=new Map;for(const i of m){if(i.archived)continue;for(const d of i.pullRequests??[]){const u=Date.parse(d.timestamp);u>=n&&a.push({kind:"pr",at:u,session:i,number:d.number,title:d.title,url:d.url})}if(!i.crew)continue;const o=ae(i);if(o>=n&&e(i).state==="done"&&a.push({kind:"finished",at:o,session:i}),i.crew.startedAt>=n){const d=`${i.crew.parentId}:${Math.floor(i.crew.startedAt/6e4)}`,u=r.get(d);u?u.push(i):r.set(d,[i])}}for(const i of r.values())a.push({kind:"started",at:Math.min(...i.map(o=>o.crew.startedAt)),parentId:i[0].crew.parentId,sessions:i});return a.sort((i,o)=>o.at-i.at).slice(0,Ze)}const es={working:"bg-success shadow-[0_0_0_1.5px_color-mix(in_oklch,var(--success)_25%,transparent)]","needs-you":"bg-warning",done:"bg-muted-foreground/40"};function fs(m){const e=B.c(69),{onOpenSession:s,onNewSession:n,onBrowseProjects:a,newSessionControl:r}=m,i=Ne(),o=Ie(),{names:d}=qe(),{names:u}=ke(),p=ye();let f;e[0]!==i.sessions?(f=i.sessions.filter(ns),e[0]=i.sessions,e[1]=f):f=e[1];const c=f;let l;e[2]!==c?(l=new Map(c.map(ts)),e[2]=c,e[3]=l):l=e[3];const x=l;let g;e[4]!==o.awaitingDialog||e[5]!==o.awaitingElicitation?(g=new Set([...o.awaitingElicitation,...o.awaitingDialog]),e[4]=o.awaitingDialog,e[5]=o.awaitingElicitation,e[6]=g):g=e[6];let h;e[7]!==o.awaitingPermission||e[8]!==o.awaitingPlan||e[9]!==o.awaitingQuestion||e[10]!==g?(h={awaitingPermission:o.awaitingPermission,awaitingQuestion:o.awaitingQuestion,awaitingPrompt:g,awaitingPlan:o.awaitingPlan},e[7]=o.awaitingPermission,e[8]=o.awaitingPlan,e[9]=o.awaitingQuestion,e[10]=g,e[11]=h):h=e[11];const w=h;let I;e[12]!==i.procBySession||e[13]!==w?(I=z=>ve(z,i.procBySession,w),e[12]=i.procBySession,e[13]=w,e[14]=I):I=e[14];const q=I;let N;e[15]!==x||e[16]!==p?(N=z=>{const H=x.get(z);return p(H==null?void 0:H.access).canInteract},e[15]=x,e[16]=p,e[17]=N):N=e[17];const j=N;let k;e[18]!==j||e[19]!==o||e[20]!==c?(k=Ke(o,c,j),e[18]=j,e[19]=o,e[20]=c,e[21]=k):k=e[21];const y=k;let v;e[22]!==c||e[23]!==q?(v=Xe(c,q),e[22]=c,e[23]=q,e[24]=v):v=e[24];const Q=v;let P;e[25]!==c||e[26]!==q?(P=We(c,q),e[25]=c,e[26]=q,e[27]=P):P=e[27];const F=P;let Y;e[28]!==x||e[29]!==d?(Y=z=>Se(z,x,d),e[28]=x,e[29]=d,e[30]=Y):Y=e[30];const _=Y;let O;e[31]!==x||e[32]!==s?(O=z=>{const H=x.get(z);H?s(H.dirName,H.fileName):_e(z)},e[31]=x,e[32]=s,e[33]=O):O=e[33];const A=O;let R;e[34]!==i.processes?(R=i.processes.filter(ss),e[34]=i.processes,e[35]=R):R=e[35];const D=R.length;let E;e[36]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Mission Control"}),e[36]=E):E=e[36];let C;e[37]!==x||e[38]!==j||e[39]!==o||e[40]!==_||e[41]!==A||e[42]!==y?(C=t.jsx(is,{queue:y,input:o,byId:x,nameOf:_,onOpen:A,canAnswer:j}),e[37]=x,e[38]=j,e[39]=o,e[40]=_,e[41]=A,e[42]=y,e[43]=C):C=e[43];let T;e[44]!==u?(T=z=>u[z.dirName]??Ae(z),e[44]=u,e[45]=T):T=e[45];let L;e[46]!==_||e[47]!==a||e[48]!==n||e[49]!==A||e[50]!==T||e[51]!==Q?(L=t.jsx(ls,{sessions:Q,nameOf:_,projectLabel:T,onOpen:A,onNewSession:n,onBrowseProjects:a}),e[46]=_,e[47]=a,e[48]=n,e[49]=A,e[50]=T,e[51]=Q,e[52]=L):L=e[52];let b;e[53]!==F||e[54]!==_||e[55]!==A?(b=t.jsx(as,{events:F,nameOf:_,onOpen:A}),e[53]=F,e[54]=_,e[55]=A,e[56]=b):b=e[56];let S;e[57]!==L||e[58]!==b?(S=t.jsxs("div",{className:"flex min-w-0 flex-col gap-8",children:[L,b]}),e[57]=L,e[58]=b,e[59]=S):S=e[59];let U;e[60]!==C||e[61]!==S?(U=t.jsxs("div",{className:"grid gap-8 lg:grid-cols-[minmax(0,380px)_minmax(0,1fr)]",children:[C,S]}),e[60]=C,e[61]=S,e[62]=U):U=e[62];let $;e[63]!==D?($=D>0&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[D," ",D===1?"agent":"agents"," running on this machine."]}),e[63]=D,e[64]=$):$=e[64];let K;return e[65]!==r||e[66]!==U||e[67]!==$?(K=t.jsx(Ce,{className:"h-full",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-8 px-6 pb-10 pt-16 lg:px-10",children:[E,U,$,r]})}),e[65]=r,e[66]=U,e[67]=$,e[68]=K):K=e[68],K}function ss(m){return m.sessionId}function ts(m){return[m.sessionId,m]}function ns(m){return!m.archived}function X(m){const e=B.c(9),{title:s,count:n,children:a}=m;let r;e[0]!==s?(r=t.jsx("h2",{className:"text-sm font-medium",children:s}),e[0]=s,e[1]=r):r=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 o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("span",{className:"flex-1"}),e[4]=o):o=e[4];let d;return e[5]!==a||e[6]!==r||e[7]!==i?(d=t.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[r,i,o,a]}),e[5]=a,e[6]=r,e[7]=i,e[8]=d):d=e[8],d}function W(m,e){const s=m==null?void 0:m.crew;return s?e(s.rootId)??s.rootTitle??null:null}const le={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 is(m){const e=B.c(73),{queue:s,input:n,byId:a,nameOf:r,onOpen:i,canAnswer:o}=m,[d,u]=V.useState(0);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new Set,e[0]=p):p=e[0];const f=V.useRef(p);if(s.length===0){let b;e[1]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(X,{title:"Needs you",count:0}),e[1]=b):b=e[1];let S;return e[2]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsxs("section",{"aria-label":"Needs you",className:"min-w-0",children:[b,t.jsx(oe,{children:t.jsx(re,{children:t.jsx(ce,{children:"Nothing is waiting on you."})})})]}),e[2]=S):S=e[2],S}const c=Math.min(d,s.length-1),l=s[c];let x;if(e[3]!==a||e[4]!==r||e[5]!==l.sessionId){const b=a.get(l.sessionId);x=W(b,r),e[3]=a,e[4]=r,e[5]=l.sessionId,e[6]=x}else x=e[6];const g=x;let h;e[7]!==c||e[8]!==o||e[9]!==n||e[10]!==i||e[11]!==s.length||e[12]!==l.kind||e[13]!==l.request||e[14]!==l.sessionId?(h=b=>{const S=b.target;if(!(S.closest("input,textarea,select,[contenteditable=true]")||b.metaKey||b.ctrlKey||b.altKey)&&((b.key==="j"||b.key==="n"||b.key==="ArrowDown")&&(b.preventDefault(),u(Math.min(s.length-1,c+1))),(b.key==="k"||b.key==="ArrowUp")&&(b.preventDefault(),u(Math.max(0,c-1))),b.key==="o"&&(b.preventDefault(),i(l.sessionId)),(b.key==="Enter"||b.key==="d")&&S===b.currentTarget&&o(l.sessionId))){if(l.kind!=="permission")return;const U=b.key==="d"||l.request.defaultToNo?"deny":"allow",$=l.request.requestId;if(l.request.availableDecisions&&!l.request.availableDecisions.includes(U)||(b.preventDefault(),f.current.has($)||n.responding.has($)))return;f.current.add($),n.respond(l.sessionId,$,U).finally(()=>f.current.delete($))}},e[7]=c,e[8]=o,e[9]=n,e[10]=i,e[11]=s.length,e[12]=l.kind,e[13]=l.request,e[14]=l.sessionId,e[15]=h):h=e[15];const w=h;let I;e[16]!==c||e[17]!==s.length?(I=s.length>1&&t.jsxs("span",{className:"flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[c+1," of ",s.length,t.jsx(M,{variant:"ghost",size:"icon-xs","aria-label":"Previous request",disabled:c===0,onClick:()=>u(c-1),children:t.jsx(Ee,{"data-icon":"inline-start"})}),t.jsx(M,{variant:"ghost",size:"icon-xs","aria-label":"Next request",disabled:c===s.length-1,onClick:()=>u(c+1),children:t.jsx(ue,{"data-icon":"inline-start"})})]}),e[16]=c,e[17]=s.length,e[18]=I):I=e[18];let q;e[19]!==s.length||e[20]!==I?(q=t.jsx(X,{title:"Needs you",count:s.length,children:I}),e[19]=s.length,e[20]=I,e[21]=q):q=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-warning","aria-hidden":"true"}),e[22]=N):N=e[22];let j;e[23]!==i||e[24]!==l.sessionId?(j=()=>i(l.sessionId),e[23]=i,e[24]=l.sessionId,e[25]=j):j=e[25];let k;e[26]!==r||e[27]!==l.sessionId?(k=r(l.sessionId)??"A session",e[26]=r,e[27]=l.sessionId,e[28]=k):k=e[28];let y;e[29]!==j||e[30]!==k?(y=t.jsx("button",{type:"button",onClick:j,className:"min-w-0 truncate rounded-sm font-medium outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:k}),e[29]=j,e[30]=k,e[31]=y):y=e[31];let v;e[32]!==g?(v=g&&t.jsxs("span",{className:"min-w-0 truncate text-muted-foreground",children:["· ",g]}),e[32]=g,e[33]=v):v=e[33];let Q;e[34]!==l.since?(Q=G(new Date(l.since).toISOString()),e[34]=l.since,e[35]=Q):Q=e[35];let P;e[36]!==Q?(P=t.jsxs("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-warning",children:["waiting ",Q]}),e[36]=Q,e[37]=P):P=e[37];let F;e[38]!==v||e[39]!==P||e[40]!==y?(F=t.jsxs("div",{className:"flex items-center gap-2 px-0.5 text-[13px]",children:[N,y,v,P]}),e[38]=v,e[39]=P,e[40]=y,e[41]=F):F=e[41];const Y=le[l.kind];let _;e[42]!==Y?(_=t.jsx("p",{className:"px-0.5 text-xs text-muted-foreground",children:Y}),e[42]=Y,e[43]=_):_=e[43];let O;e[44]!==l?(O=ne(l),e[44]=l,e[45]=O):O=e[45];let A;e[46]!==o||e[47]!==l.sessionId?(A=o(l.sessionId),e[46]=o,e[47]=l.sessionId,e[48]=A):A=e[48];let R;e[49]!==i||e[50]!==l.sessionId?(R=()=>i(l.sessionId),e[49]=i,e[50]=l.sessionId,e[51]=R):R=e[51];let D;e[52]!==n||e[53]!==l||e[54]!==O||e[55]!==A||e[56]!==R?(D=t.jsx(He,{request:l,input:n,canAnswer:A,onOpen:R},O),e[52]=n,e[53]=l,e[54]=O,e[55]=A,e[56]=R,e[57]=D):D=e[57];let E;e[58]!==F||e[59]!==_||e[60]!==D?(E=t.jsxs("div",{className:"flex flex-col gap-2",children:[F,_,D]}),e[58]=F,e[59]=_,e[60]=D,e[61]=E):E=e[61];let C;e[62]!==c||e[63]!==a||e[64]!==r||e[65]!==s?(C=s.length>1&&t.jsx("ol",{className:"mt-3 flex flex-col","aria-label":"Also waiting",children:s.map((b,S)=>S===c?null:t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>u(S),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:S+1}),t.jsxs("span",{className:"flex min-w-0 flex-col",children:[t.jsxs("span",{className:"truncate font-medium",children:[r(b.sessionId)??"A session",W(a.get(b.sessionId),r)&&t.jsxs("span",{className:"font-normal text-muted-foreground",children:[" · ",W(a.get(b.sessionId),r)]})]}),t.jsx("span",{className:"truncate text-[11.5px] text-muted-foreground",children:le[b.kind]})]}),t.jsx("span",{className:"text-[11px] tabular-nums text-warning",children:G(new Date(b.since).toISOString())})]})},ne(b)))}),e[62]=c,e[63]=a,e[64]=r,e[65]=s,e[66]=C):C=e[66];let T;e[67]===Symbol.for("react.memo_cache_sentinel")?(T=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[67]=T):T=e[67];let L;return e[68]!==w||e[69]!==E||e[70]!==C||e[71]!==q?(L=t.jsxs("section",{"aria-label":"Needs you",tabIndex:0,onKeyDown:w,className:"min-w-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[q,E,C,T]}),e[68]=w,e[69]=E,e[70]=C,e[71]=q,e[72]=L):L=e[72],L}function ls(m){const e=B.c(16),{sessions:s,nameOf:n,projectLabel:a,onOpen:r,onNewSession:i,onBrowseProjects:o}=m;let d;e[0]!==o?(d=o&&t.jsxs(M,{variant:"ghost",size:"xs",className:"text-muted-foreground",onClick:o,children:[t.jsx(Te,{"data-icon":"inline-start"}),"All projects"]}),e[0]=o,e[1]=d):d=e[1];let u;e[2]!==i?(u=i&&t.jsxs(M,{variant:"outline",size:"xs",onClick:i,children:[t.jsx(Le,{"data-icon":"inline-start"}),"New session"]}),e[2]=i,e[3]=u):u=e[3];let p;e[4]!==s.length||e[5]!==d||e[6]!==u?(p=t.jsxs(X,{title:"Your sessions",count:s.length,children:[d,u]}),e[4]=s.length,e[5]=d,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==n||e[9]!==r||e[10]!==a||e[11]!==s?(f=s.length===0?t.jsx(oe,{children:t.jsx(re,{children:t.jsx(ce,{children:"Start a session and it shows up here, with every session it starts."})})}):t.jsx("ul",{className:"flex flex-col",children:s.map(l=>t.jsxs("li",{className:"border-t border-border/70 first:border-t-0",children:[l.members.length>0&&t.jsx("div",{role:"group","aria-label":`${n(l.session.sessionId)} crew`,className:"flex flex-wrap gap-1 px-3 pt-3",children:l.members.map((x,g)=>t.jsx("button",{type:"button","aria-label":`Open ${n(x.sessionId)??"crew member"}`,title:`${n(x.sessionId)}: ${l.cells[g]}`,onClick:()=>r(x.sessionId),className:"flex size-5 items-center justify-center rounded-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:t.jsx("span",{className:De("size-2 rounded-[2px]",es[l.cells[g]])})},x.sessionId))}),t.jsxs("button",{type:"button",onClick:()=>r(l.session.sessionId),className:"grid w-full grid-cols-1 items-center gap-x-4 gap-y-1 rounded-lg px-3 py-3 text-left outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring xl:grid-cols-[minmax(0,1fr)_auto]",children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[t.jsx("span",{className:"truncate text-[13.5px] font-medium",children:n(l.session.sessionId)??"Untitled session"}),t.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground sm:inline",children:a(l.session)})]}),t.jsx("span",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:l.counts?t.jsxs(t.Fragment,{children:[l.counts.working>0&&t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:l.counts.working})," working"]}),l.counts.needsYou>0&&t.jsxs("span",{className:"text-warning",children:[t.jsx("span",{className:"font-medium tabular-nums",children:l.counts.needsYou})," need you"]}),t.jsxs("span",{children:[t.jsx("span",{className:"font-medium text-foreground tabular-nums",children:l.counts.size})," in crew"]})]}):l.session.isActive&&t.jsx("span",{children:"working"})}),t.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[l.landed&&t.jsxs(de,{variant:"outline",className:"shrink-0",children:["#",l.landed.number]}),t.jsx("span",{className:"truncate",children:l.landed?`${l.landed.title??"Pull request"} · ${n(l.landed.by.sessionId)??""}`:l.session.lastUserMessage??""})]}),t.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:l.counts?`crew active ${G(l.activityAt)}`:G(l.activityAt)})]})]},l.session.sessionId))}),e[8]=n,e[9]=r,e[10]=a,e[11]=s,e[12]=f):f=e[12];let c;return e[13]!==p||e[14]!==f?(c=t.jsxs("section",{"aria-label":"Your sessions",className:"min-w-0",children:[p,f]}),e[13]=p,e[14]=f,e[15]=c):c=e[15],c}function as(m){const e=B.c(10),{events:s,nameOf:n,onOpen:a}=m;if(s.length===0)return null;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(X,{title:"Landed today"}),e[0]=r):r=e[0];let i;if(e[1]!==s||e[2]!==n||e[3]!==a){let d;e[5]!==n||e[6]!==a?(d=u=>{const p=u.kind==="started"?u.parentId:u.session.sessionId,f=new Date(u.at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>a(p),className:"grid w-full grid-cols-[48px_minmax(0,1fr)] items-baseline gap-2.5 rounded-md px-3 py-1.5 text-left text-[12.5px] outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground/80",children:f}),t.jsx("span",{className:"min-w-0 truncate",children:os(u,n)})]})},`${u.kind}:${p}:${u.at}`)},e[5]=n,e[6]=a,e[7]=d):d=e[7],i=s.map(d),e[1]=s,e[2]=n,e[3]=a,e[4]=i}else i=e[4];let o;return e[8]!==i?(o=t.jsxs("section",{"aria-label":"Landed today",className:"min-w-0",children:[r,t.jsx("ol",{className:"flex flex-col",children:i})]}),e[8]=i,e[9]=o):o=e[9],o}function os(m,e){switch(m.kind){case"pr":return t.jsxs(t.Fragment,{children:[t.jsxs(de,{variant:"outline",className:"mr-2 text-success",children:["#",m.number]}),t.jsx("span",{className:"font-medium",children:e(m.session.sessionId)??"A session"}),t.jsxs("span",{className:"text-muted-foreground",children:[" · ",m.title??"opened a pull request"]})]});case"finished":return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium",children:e(m.session.sessionId)??"A session"}),t.jsx("span",{className:"text-muted-foreground",children:" finished"})]});case"started":return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium",children:m.sessions.length===1?e(m.sessions[0].sessionId)??"A session":`${m.sessions.length} sessions`}),t.jsxs("span",{className:"text-muted-foreground",children:[" started · ",e(m.parentId)??"by another session"]})]})}}export{fs as MissionHome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,c as d,j as s}from"./vendor-react-gGw_S5I_.js";import{S as p,a as f,b as j,c as g,F as C,d as S}from"./index-
|
|
1
|
+
import{r as x,c as d,j as s}from"./vendor-react-gGw_S5I_.js";import{S as p,a as f,b as j,c as g,F as C,d as S}from"./index-DUfVcKxj.js";import"./vendor-ui-Dxtv9P3W.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const E=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{E as MobileFileChanges};
|