@staff0rd/assist 0.1062.0 → 0.1062.1
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/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +22 -17
- package/package.json +1 -1
package/dist/built-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1062.
|
|
1
|
+
0.1062.1
|
|
@@ -4064,7 +4064,7 @@ ${d.join(`
|
|
|
4064
4064
|
`,DLo=Bi`
|
|
4065
4065
|
0%, 100% { transform: scale(1); }
|
|
4066
4066
|
50% { transform: scale(1.08); }
|
|
4067
|
-
`,qHr={content:'""',position:"absolute",borderRadius:"inherit",background:"conic-gradient(from calc(var(--rainbow-pill-h) * 1deg) in oklch longer hue, oklch(66% 0.21 0), oklch(66% 0.21 0))",animation:`${ILo} 1.8s linear infinite`},MLo={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${DLo} 1.6s ease-in-out infinite`,"&::before":{...qHr,inset:0,zIndex:-1},"&::after":{...qHr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gl.rainbowPill.text,textShadow:Gl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function jHr({children:e}){return(0,sD.jsxs)(sD.Fragment,{children:[(0,sD.jsx)(Q3,{styles:LLo}),(0,sD.jsx)(V,{component:"span","data-testid":"rainbow-pill",sx:MLo,children:e})]})}function YHr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function KHr(e){if(e.length!==2)return!1;let[t,r]=e;return YHr(t)===YHr(r)}var Jw=T(R(),1);function ZHr({rateLimits:e}){let t=E0(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(i=>i.window?.used_percentage!=null),n=KHr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:t4e(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,Jw.jsxs)(XHr.Fragment,{children:[a>0?(0,Jw.jsx)(V,{component:"span",sx:{color:iG,mr:.5},children:","}):null,(0,Jw.jsx)(GHr,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,Jw.jsx)(jHr,{children:o}):(0,Jw.jsx)(Jw.Fragment,{children:o})}var t3=T(R(),1);function JHr({groups:e}){return(0,t3.jsx)(t3.Fragment,{children:e.map((t,r)=>(0,t3.jsxs)(QHr.Fragment,{children:[(0,t3.jsx)(V,{component:"span",sx:{color:iG,ml:r>0?1:0,mr:.5},children:Fc(t.harness)}),(0,t3.jsx)(ZHr,{rateLimits:t.rateLimits})]},t.harness))})}var eUr={root:{fontFamily:"fontFamilyMono",fontSize:12,display:"grid",gap:1},group:{display:"grid",gap:"2px"},heading:{color:e=>e.tokens.color.onAppBar.secondary},foot:{pt:.75,opacity:.6,borderTop:"1px solid color-mix(in srgb, currentColor 18%, transparent)"}};function NLo(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function OLo(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function BLo(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function nUr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=yst(t,r,n);if(o==null)return{kind:"unprojectable"};let i=kx(e,t,r,n),a=NLo(i),s=OLo(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:BLo(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function n4e(e){return t=>t.tokens.color.onAppBar.level[e]}function oUr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${MV(e.at,t)}`}var r3=T(R(),1),iUr={display:"contents"};function Fst({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,r3.jsxs)(V,{component:"span",sx:iUr,children:[(0,r3.jsx)("span",{}),(0,r3.jsx)("span",{})]});let n=(0,r3.jsx)(V,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,r3.jsxs)(V,{component:"span",sx:{color:n4e(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,r3.jsxs)(V,{component:"span",sx:iUr,children:[r?o:n,r?n:o]})}var aUr={row:{display:"grid",gridTemplateColumns:"2.5ch 4ch 1ch 4ch 1ch 4ch auto",alignItems:"baseline",gap:.75,fontVariantNumeric:"tabular-nums"},pctWeight:500,note:{pl:.75,color:e=>e.tokens.color.onAppBar.secondary}};var n3=T(R(),1);function sUr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=aUr,a=kx(t,r,n,o),s=nUr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,n3.jsxs)(V,{sx:i.row,children:[(0,n3.jsx)(V,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,n3.jsx)(Fst,{direction:"back",threshold:l?.recovery}),(0,n3.jsxs)(V,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:n4e(a)},children:[Math.round(t),"%"]}),(0,n3.jsx)(Fst,{direction:"forward",threshold:l?.worse}),(0,n3.jsx)(V,{component:"span",sx:i.note,children:l?l.recovery&&oUr(l.recovery,o):"no projection yet"})]})}function o4e(e){return[{label:"5h",window:e.five_hour,windowSeconds:18e3},{label:"7d",window:e.seven_day,windowSeconds:604800}].flatMap(t=>t.window?.used_percentage==null?[]:[{label:t.label,pct:t.window.used_percentage,resetsAt:t.window.resets_at,windowSeconds:t.windowSeconds}])}var cUr=T(R(),1);function lUr({rateLimits:e,now:t}){return o4e(e).map(r=>(0,cUr.jsx)(sUr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var lD=T(R(),1);function uUr({groups:e}){let t=E0(3e4),r=eUr;return(0,lD.jsxs)(V,{sx:r.root,children:[e.map(n=>(0,lD.jsxs)(V,{sx:r.group,children:[(0,lD.jsx)(V,{sx:r.heading,children:Fc(n.harness)}),(0,lD.jsx)(lUr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,lD.jsx)(V,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var zst=T(R(),1),$Lo="Claude account usage (5h / 7d windows) \u2014 view history";function dUr(e){return e.length===0?{title:$Lo,content:"Usage"}:{title:(0,zst.jsx)(uUr,{groups:e}),content:(0,zst.jsx)(JHr,{groups:e})}}var fUr={display:"flex",alignItems:"center",height:22,px:1,borderRadius:1,fontSize:"inherit","&:hover, &:focus-visible":{bgcolor:e=>e.tokens.color.statusBar.hover,color:e=>e.tokens.color.statusBar.hoverText}},pUr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var Hst=T(R(),1),FLo={};function hUr({rateLimits:e,harnessRateLimits:t=FLo}){let{title:r,content:n}=dUr(e4e(e,t));return(0,Hst.jsx)(sr,{title:r,placement:"top-start",slotProps:pUr,children:(0,Hst.jsx)(Yr,{component:da,to:"/usage",underline:"none",color:"inherit",sx:fUr,children:n})})}var yUr=T(ee(),1);var ch="0.1062.0";var i4e=T(ee(),1),Ust=(0,i4e.createContext)(null);function a4e(){return(0,i4e.useContext)(Ust)}var Wst=T(R(),1);function mUr(){let e=a4e();return!e||e===ch?null:(0,Wst.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${ch}. Restart the daemon to match.`,children:(0,Wst.jsx)(HEe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var gUr=e=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:0,height:22,borderRadius:1,fontSize:"inherit",lineHeight:1.5,color:"inherit",opacity:1,bgcolor:t=>e?$x(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>$x(t).hover,color:t=>$x(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>$x(t).dot,boxShadow:t=>`0 0 0 3px ${$x(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>$x(t).readyText}});var L0=T(R(),1);function vUr(){let{entries:e}=Tx(),t=an(),r=(0,yUr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=fo("openUpdates");if(Zi(n,r),!ch)return null;let i=e.filter(F5).length;return(0,L0.jsxs)(L0.Fragment,{children:[(0,L0.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,L0.jsx)(Pd,{label:"Updates",chords:o}),children:(0,L0.jsxs)(Jt,{component:da,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:gUr(i>0),children:[i>0&&(0,L0.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,L0.jsxs)("span",{children:["v",ch]}),i>0&&(0,L0.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,L0.jsx)(mUr,{})]})}var eC=T(R(),1);function bUr({socket:e}){return(0,eC.jsx)(LHr,{start:(0,eC.jsx)(hUr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,eC.jsxs)(eC.Fragment,{children:[(0,eC.jsx)(UHr,{}),(0,eC.jsx)(vUr,{})]})})}var xUr=T(ee(),1);var tC=T(R(),1),zLo=2e4;function SUr(){let{entries:e,refresh:t}=Tx(),[r,n]=(0,xUr.useState)(),o=e.find(l=>l.local)?.status?.extension,i=o?.behind&&o.updateLink&&o.latest?o:void 0,a=i!==void 0&&r!==i.latest,s=()=>n(i?.latest);return(0,tC.jsx)(Ou,{open:a,children:(0,tC.jsxs)(no,{severity:"info",variant:"filled",action:(0,tC.jsxs)(tC.Fragment,{children:[(0,tC.jsx)(dt,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,zLo),children:"Install"}),(0,tC.jsx)(dt,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var d4e=T(ee(),1);var u4e=T(ee(),1);function TUr(e,t,r){if(!e)return"Select a repo to search files.";if(r.error)return"Couldn't search files in this repo.";if(!(r.files.length>0||r.loading))return t?"No matching files.":"No files in this repo."}var o3=T(R(),1),HLo={display:"flex",gap:1,alignItems:"center",minWidth:0},ULo={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},WLo={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},VLo={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function GLo(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function wUr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,o3.jsx)(tg,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=GLo(o);return(0,o3.jsxs)(qr,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:HLo,children:[(0,o3.jsx)(gSe,{path:o}),(0,o3.jsxs)(V,{sx:ULo,children:[(0,o3.jsx)(Te,{component:"span",sx:WLo,children:s}),(0,o3.jsx)(Te,{component:"span",color:"text.secondary",sx:VLo,children:a})]})]},o)})})}var s4e=T(R(),1),qLo={maxHeight:420,overflowY:"auto"},jLo={px:2,py:2,fontSize:13};function CUr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,s4e.jsx)(V,{sx:qLo,children:e?(0,s4e.jsx)(Te,{color:"text.secondary",sx:jLo,children:e}):(0,s4e.jsx)(wUr,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var kUr=T(R(),1),YLo={mt:6,alignSelf:"flex-start"};function l4e({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,kUr.jsx)(bl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:YLo},transition:{onEntered:t}},children:n})}var c4e=T(ee(),1);var _Ur={files:[],loading:!1,error:!1};function EUr(e,t){let[r,n]=(0,c4e.useState)(_Ur),o=yr();return(0,c4e.useEffect)(()=>{if(!e){n(_Ur);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await er(tn(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Pr(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var cD=T(R(),1);function KLo(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function RUr({onClose:e}){let{worktreeNode:t}=to();return(0,cD.jsx)(ac.Provider,{value:t,children:(0,cD.jsx)(XLo,{onClose:e})})}function XLo({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=to(),[n,o]=(0,u4e.useState)(""),i=EUr(t,n),a=an(),s=(0,u4e.useRef)(null),l=h=>a(KLo(h,t,r)),{highlight:u,setHighlight:d,onKeyDown:f}=q5(i.files,n,l,e),p=h=>{l(h),e()};return(0,cD.jsxs)(l4e,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,cD.jsx)(Lk,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:f,placeholder:"Search files by name..."}),(0,cD.jsx)(CUr,{message:TUr(t,n,i),files:i.files,highlight:u,onHighlight:d,onSelect:p})]})}function PUr(e){Zi(fo("quickOpen").matches,e)}var LUr=T(R(),1);function AUr(){let[e,t]=(0,d4e.useState)(!1);return PUr((0,d4e.useCallback)(()=>t(!0),[])),e?(0,LUr.jsx)(RUr,{onClose:()=>t(!1)}):null}var f4e=T(R(),1);function IUr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,f4e.jsx)(Ou,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,f4e.jsx)(no,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,f4e.jsx)(dt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var uoe=T(ee(),1);function aG(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var GUr=T(ee(),1);var DUr=T(R(),1),MUr=nt((0,DUr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var ZLo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function NUr(e){return e?ZLo[e]:"success.main"}function OUr(e){return e.split("-")[0].split(".").map(Number)}function BUr(e,t){if(!e||!t||e===t)return;let r=OUr(e),n=OUr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var uD=T(R(),1),QLo={height:16,fontSize:10},JLo={opacity:.6,fontSize:"0.85em"};function eIo(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function loe({nodes:e,name:t,showVersion:r=!1}){let n=a4e()??ch,o=e.links.find(a=>a.name===t),i=BUr(o?.peerVersion,n);return(0,uD.jsx)(sr,{title:eIo(e,t),placement:"right",children:(0,uD.jsxs)(V,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,uD.jsx)(MUr,{sx:{fontSize:8,color:NUr(o?.state)}}),t,r&&o?.peerVersion&&(0,uD.jsxs)(V,{component:"span",sx:JLo,children:["v",o.peerVersion]}),i&&(0,uD.jsx)($n,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:QLo})]})})}var dD=T(R(),1),tIo={opacity:.6},rIo={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function $Ur({nodes:e,name:t,clone:r}){let n=(0,dD.jsx)(loe,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,dD.jsx)(V,{component:"span",sx:tIo,children:n}):(0,dD.jsx)(sr,{title:UV(t,r.cloneTarget),children:(0,dD.jsxs)(V,{component:"span",sx:rIo,children:[(0,dD.jsx)(HV,{sx:{fontSize:14}}),n]})})}var zUr=T(R(),1),nIo={px:1.5,borderRadius:.75,fontSize:12,fontWeight:600,color:"text.secondary","&:hover":{color:"text.primary",bgcolor:"action.hover"},"&[aria-checked='true']":{color:"primary.main",bgcolor:"action.selected"},"&.Mui-focusVisible":{outline:2,outlineColor:"primary.main"}};function FUr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,zUr.jsx)(Jt,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:nIo,children:t})}var HUr={ArrowRight:1,ArrowLeft:-1};function oIo(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+HUr[e.key]+r)%r}function UUr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!HUr[o.key]){nw(o);return}let i=oIo(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var WUr=T(ee(),1);function sG(e){return e?.querySelector('[aria-checked="true"]')}function VUr(e,t){(0,WUr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=sG(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var Vst=T(R(),1),iIo={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function p4e({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return VUr(i,r),(0,Vst.jsx)(kt,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:UUr(t,r,n,l),sx:iIo,children:t.map(u=>(0,Vst.jsx)(FUr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var Gst=T(R(),1);function qUr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=kl(),a=(0,GUr.useRef)(null);return!i||!n||!e?null:(0,Gst.jsx)(p4e,{label:"Node",options:o,value:e,onChange:t,optionLabel:s=>(0,Gst.jsx)($Ur,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var h4e=T(R(),1);function jUr({prompt:e,children:t}){return(0,h4e.jsxs)(kt,{children:[e,(0,h4e.jsx)(kt,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var KUr=T(R(),1),aIo=".MuiOutlinedInput-notchedOutline",sIo={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${aIo}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function YUr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,KUr.jsx)(Fn,{sx:sIo,value:e,onChange:a=>t(a.target.value),onKeyDown:nw,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var JUr=T(ee(),1);var I0={draft:{placeholder:"Describe the backlog item to draft...",submitLabel:"Start draft",autoStartLabel:"Start draft + auto start",sessionMode:"assist-draft"},bug:{placeholder:"Describe the bug: what happened, what you expected...",submitLabel:"File bug",autoStartLabel:"File bug + auto start",sessionMode:"assist-bug"},prompt:{placeholder:yTe,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}};function m4e(e){let t=I0[e];return"autoStartLabel"in t?t.autoStartLabel:void 0}var XUr=Object.keys(I0);var qst=T(R(),1);function ZUr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,qst.jsx)(Ka,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,qst.jsx)(qr,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:Fc(i)},i))})}var fD=T(R(),1);function QUr(e){return t=>t==="prompt"&&e?(0,fD.jsxs)(fD.Fragment,{children:["prompt",(0,fD.jsx)(V,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Fc(e)}`}),(0,fD.jsx)(Hc,{sx:{fontSize:18,mr:-.75}})]}):t}var pD=T(R(),1);function eWr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,JUr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(sG(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,pD.jsxs)(pD.Fragment,{children:[(0,pD.jsx)(p4e,{label:"Mode",options:XUr,value:e.mode,onChange:l,optionLabel:QUr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,pD.jsx)(ZUr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var fWr=T(ee(),1);var jst=T(R(),1),lIo={zIndex:e=>e.zIndex.modal+1};function tWr({open:e,anchor:t,children:r}){return(0,jst.jsx)(UM,{open:e,anchorEl:t,placement:"bottom-start",sx:lIo,children:(0,jst.jsx)(Qr,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var rWr=T(R(),1),nWr=nt((0,rWr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var Yst=T(R(),1),cIo={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},uIo={fontSize:16,color:"text.disabled"};function oWr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:cIo,endAdornment:(0,Yst.jsx)(iPe,{position:"end",children:(0,Yst.jsx)(nWr,{sx:uIo})})}}}var iWr=T(EM(),1);function aWr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}nw(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,iWr.flushSync)(()=>{r(t),n()}),nw(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function g4e(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Ax(n).toLowerCase().includes(r)):e}var Kst=T(ee(),1);function sWr(){let[e,t]=(0,Kst.useState)(!1),[r,n]=(0,Kst.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var cWr=T(ee(),1);var lWr=e=>e?Ax(e):"";function uWr(e){let[t,r]=(0,cWr.useState)(()=>lWr(e));return{text:t,setText:r,showRepo:n=>r(lWr(n))}}function dWr(e,t,r){let n=sWr(),o=uWr(t),i=g4e(e,n.query),a=d=>{r(d),o.showRepo(d)},s=q5(i,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:o.text,filtered:i,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:aWr({open:n.open,highlighted:i[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:d=>{o.setText(d),n.filterBy(d)},onFocus:l,onBlur:()=>{n.close(),o.showRepo(t)},pick:d=>{a(d),n.close()}}}var lG=T(R(),1);function pWr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=dWr(e,t,r),s=(0,fWr.useRef)(null);return(0,lG.jsxs)(V,{ref:s,sx:{flex:1,minWidth:0},children:[(0,lG.jsx)(Fn,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),i()},inputRef:n,autoFocus:o,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:oWr(a.open)}),(0,lG.jsx)(tWr,{open:a.open,anchor:s.current,children:(0,lG.jsx)(NEe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var i3=T(R(),1);function hWr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=to();return(0,i3.jsxs)(jUr,{prompt:(0,i3.jsx)(YUr,{value:r.prompt,onChange:r.setPrompt,placeholder:I0[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,i3.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,i3.jsx)(pWr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,i3.jsx)(eWr,{...t})]}),(0,i3.jsx)(qUr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var yWr=T(R(),1),mWr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function gWr({submitLabel:e,disabled:t=!1,loading:r=!1,onClick:n}){return(0,yWr.jsx)(dt,{type:"submit",onClick:n,variant:"contained",disabled:t,loading:r,children:e})}var hD=T(R(),1),dIo=e=>({alignItems:"center",flexWrap:"wrap",gap:"14px",py:"10px",pl:"18px",pr:1.5,borderTop:1,borderColor:e.tokens.color.lineSoft,bgcolor:"background.default",fontSize:12,color:"text.secondary"}),fIo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function vWr(e){return(0,hD.jsxs)(kt,{direction:"row",sx:dIo,children:[mWr.map(([t,r])=>(0,hD.jsxs)("span",{children:[(0,hD.jsx)(V,{component:"kbd",sx:fIo,children:t}),r]},t)),(0,hD.jsx)(V,{sx:{flex:1}}),(0,hD.jsx)(gWr,{...e})]})}var y4e=T(ee(),1);function bWr(){let[e,t]=(0,y4e.useState)(!1);return(0,y4e.useEffect)(()=>{let r=o=>t(o.shiftKey),n=()=>t(!1);return globalThis.addEventListener("keydown",r),globalThis.addEventListener("keyup",r),globalThis.addEventListener("blur",n),()=>{globalThis.removeEventListener("keydown",r),globalThis.removeEventListener("keyup",r),globalThis.removeEventListener("blur",n)}},[]),e}function xWr(e,t){let r=bWr();return e==="clone"?"Clone":(r?m4e(t):void 0)??I0[t].submitLabel}var TWr=T(R(),1);function SWr({draft:e,targetKind:t,onClick:r}){return(0,TWr.jsx)(vWr,{submitLabel:xWr(t,e.mode),onClick:r,disabled:t==="blocked",loading:e.modePending})}var mD=T(ee(),1);function wWr(e,t){let r=(0,mD.useRef)(e),n=(0,mD.useRef)(null),o=(0,mD.useRef)(null),i=(0,mD.useRef)(null),a=(0,mD.useCallback)(u=>{n.current=u;let{field:d,selectionStart:f,selectionEnd:p}=r.current;u&&d==="prompt"&&u.setSelectionRange(f,p)},[]),s=u=>{let d=u.target;t({field:"prompt",selectionStart:d.selectionStart,selectionEnd:d.selectionEnd})},l=()=>{if(i.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:o.current,mode:sG(i.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:o,modeRef:i,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function pIo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:BEe(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function CWr(e,t){let{names:r,visible:n}=kl(),o=IEe(t,n?r:[void 0]);return{cloneState:o,target:pIo(t,e,o(e))}}var EWr=T(ee(),1);function hIo(e,t,r){let n=r===!0&&m4e(e)!==void 0;return!t&&!n?[]:[{...t&&{node:t},...n&&{autoApprove:!0}}]}function v4e({mode:e,harness:t,prompt:r,cwd:n,node:o,autoApprove:i},a){let s=n||void 0,l=o?[o]:[];if(e==="prompt"){t==="claude"?a.onCreate(r,s,...l):a.onCreateHarness(t,r,s,...l);return}if(e==="design"){a.onCreateDesign(r,s,...l);return}let u=hIo(e,o,i);o4r(I0[e].sessionMode,n,(d,f)=>a.onCreateAssist(d,f,...u),()=>{},r)}function kWr(e,t,r,n,o=!1){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(CEe(r.prompt,n.onCreateAssist),!0):(v4e({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node,autoApprove:o},n),e.clear(),!0)}var b4e=T(ee(),1);function _Wr(e,t){let[r,n]=(0,b4e.useState)(null);return(0,b4e.useEffect)(()=>{!r||e.modePending||(n(null),e.modeError||t(r.autoApprove))},[r,e.modePending,e.modeError,t]),o=>{e.modePending?n({autoApprove:o}):t(o)}}function RWr(e,t,r,n,o){let i=(0,EWr.useRef)(!1),a=_Wr(e,s=>{kWr(e,t,r,n,s)&&o()});return{onSubmit:s=>{s.preventDefault();let l=i.current;i.current=!1,a(l)},onSubmitClick:s=>{i.current=s.shiftKey}}}var coe=T(ee(),1);function PWr(e,t){let r=(0,coe.useRef)(e),n=(0,coe.useRef)(null);return(0,coe.useEffect)(()=>{if(r.current&&!e){let o=n.current;o?.isConnected?o.focus():t()}r.current=e},[e,t]),o=>{n.current=o.target}}var LWr=T(R(),1),mIo={border:0,margin:0,padding:0,minWidth:0};function AWr({loading:e,restoreFocus:t,children:r}){let n=PWr(e,t);return(0,LWr.jsx)("fieldset",{disabled:e,style:mIo,onFocus:n,children:r})}var S4e=T(R(),1);function x4e({error:e,onRetry:t}){return e?(0,S4e.jsxs)(no,{severity:"error",sx:{mx:2,my:1},action:t&&(0,S4e.jsx)(dt,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:["Couldn't load this repo's default mode (",e,"). Pick a mode or retry."]}):null}var a3=T(R(),1);function IWr({draft:e,launchers:t,onClose:r}){let n=wWr(e.focus,e.setFocus),o=aG(R0()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=CWr(e.node,e.cwd),{onSubmit:l,onSubmitClick:u}=RWr(e,i,a,t,r);return(0,a3.jsx)(l4e,{onClose:r,onEntered:n.restore,centered:!0,children:(0,a3.jsx)("form",{onSubmit:l,children:(0,a3.jsxs)(AWr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,a3.jsx)(hWr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,a3.jsx)(x4e,{error:e.modeError,onRetry:e.retryMode}),(0,a3.jsx)(SWr,{draft:e,targetKind:a.kind,onClick:u})]})})})}var gD=T(ee(),1);async function gIo(e){let t=`HTTP ${e.status}`,r=await e.json().catch(()=>null);return typeof r?.error=="string"?`${t}: ${r.error}`:t}async function yIo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await er(`/api/new-session-defaults${t}`);if(!r.ok)return{error:await gIo(r)};let n=await r.json();if(Object.hasOwn(I0,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Pr(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function T4e(e,t=0){let[r,n]=(0,gD.useState)(0),[o,i]=(0,gD.useState)(null),a=(0,gD.useCallback)(()=>n(l=>l+1),[]);if((0,gD.useEffect)(()=>{let l=!1;return yIo(e).then(u=>{l||i({cwd:e,opens:t,attempt:r,outcome:u})}),()=>{l=!0}},[e,t,r]),!o)return null;let{outcome:s}=o;return{mode:"mode"in s?s.mode:"prompt",pending:o.cwd!==e||o.opens!==t||o.attempt!==r,error:"error"in s?s.error:void 0,retry:a}}function w4e(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function DWr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var s3=T(ee(),1);var MWr={field:"prompt",selectionStart:0,selectionEnd:0};function NWr(){let[e,t]=UU("new-session"),[r,n]=(0,s3.useState)(),[o,i]=(0,s3.useState)(),[a,s]=(0,s3.useState)("claude"),[l,u]=(0,s3.useState)(),[d,f]=(0,s3.useState)(MWr),p=(0,s3.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),f(MWr)},[t]);return{prompt:e,cwd:r,mode:o,harness:a,node:l,focus:d,setPrompt:t,setNode:u,setCwd:n,setMode:i,setHarness:s,setFocus:f,clear:p}}function OWr(e,t=T4e){let{selectedCwd:r}=to(),n=kl(),o=NWr(),i=o.cwd??r,a=t(i,e);return a?{...o,cwd:i,mode:o.mode??a.mode,modePending:o.mode===void 0&&a.pending,modeError:w4e(o.mode,a),retryMode:a.retry,node:DWr(o.node,n)}:null}function BWr(e){Zi(fo("newSession").matches,e)}var $Wr=T(ee(),1);function FWr(e,t){let{selectedCwd:r}=to(),[n,o]=sl(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,$Wr.useEffect)(()=>{i===null||!s||!l||!u||(i&&(s(i),l(a),u({field:"prompt",selectionStart:i.length,selectionEnd:i.length})),t(),o(d=>(d.delete("new"),d.delete("newCwd"),d),{replace:!0}))},[i,a,s,l,u,t,o])}var HWr=T(R(),1);function zWr({launchers:e}){let[t,r]=(0,uoe.useState)(!1),[n,o]=(0,uoe.useState)(0),i=OWr(n),a=(0,uoe.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return BWr(a),FWr(i,a),!t||!i?null:(0,HWr.jsx)(IWr,{draft:i,launchers:e,onClose:()=>r(!1)})}var C4e=T(R(),1);function UWr({reconnecting:e}){return(0,C4e.jsx)(Ou,{open:e,children:(0,C4e.jsx)(no,{severity:"info",variant:"filled",icon:(0,C4e.jsx)(Ao,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var yv=T(R(),1);function WWr({socket:e,onViewLaunchedSession:t}){return(0,yv.jsxs)(yv.Fragment,{children:[(0,yv.jsx)(AUr,{}),(0,yv.jsx)(zWr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,yv.jsx)(UWr,{reconnecting:e.reconnecting}),(0,yv.jsx)(SUr,{}),(0,yv.jsx)(_l,{error:e.error,onClose:e.clearError}),(0,yv.jsx)(IUr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Fx=T(ee(),1);var vIo=6e4;function bIo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function k4e(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4067
|
+
`,qHr={content:'""',position:"absolute",borderRadius:"inherit",background:"conic-gradient(from calc(var(--rainbow-pill-h) * 1deg) in oklch longer hue, oklch(66% 0.21 0), oklch(66% 0.21 0))",animation:`${ILo} 1.8s linear infinite`},MLo={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${DLo} 1.6s ease-in-out infinite`,"&::before":{...qHr,inset:0,zIndex:-1},"&::after":{...qHr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gl.rainbowPill.text,textShadow:Gl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function jHr({children:e}){return(0,sD.jsxs)(sD.Fragment,{children:[(0,sD.jsx)(Q3,{styles:LLo}),(0,sD.jsx)(V,{component:"span","data-testid":"rainbow-pill",sx:MLo,children:e})]})}function YHr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function KHr(e){if(e.length!==2)return!1;let[t,r]=e;return YHr(t)===YHr(r)}var Jw=T(R(),1);function ZHr({rateLimits:e}){let t=E0(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(i=>i.window?.used_percentage!=null),n=KHr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:t4e(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,Jw.jsxs)(XHr.Fragment,{children:[a>0?(0,Jw.jsx)(V,{component:"span",sx:{color:iG,mr:.5},children:","}):null,(0,Jw.jsx)(GHr,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,Jw.jsx)(jHr,{children:o}):(0,Jw.jsx)(Jw.Fragment,{children:o})}var t3=T(R(),1);function JHr({groups:e}){return(0,t3.jsx)(t3.Fragment,{children:e.map((t,r)=>(0,t3.jsxs)(QHr.Fragment,{children:[(0,t3.jsx)(V,{component:"span",sx:{color:iG,ml:r>0?1:0,mr:.5},children:Fc(t.harness)}),(0,t3.jsx)(ZHr,{rateLimits:t.rateLimits})]},t.harness))})}var eUr={root:{fontFamily:"fontFamilyMono",fontSize:12,display:"grid",gap:1},group:{display:"grid",gap:"2px"},heading:{color:e=>e.tokens.color.onAppBar.secondary},foot:{pt:.75,opacity:.6,borderTop:"1px solid color-mix(in srgb, currentColor 18%, transparent)"}};function NLo(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function OLo(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function BLo(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function nUr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=yst(t,r,n);if(o==null)return{kind:"unprojectable"};let i=kx(e,t,r,n),a=NLo(i),s=OLo(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:BLo(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function n4e(e){return t=>t.tokens.color.onAppBar.level[e]}function oUr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${MV(e.at,t)}`}var r3=T(R(),1),iUr={display:"contents"};function Fst({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,r3.jsxs)(V,{component:"span",sx:iUr,children:[(0,r3.jsx)("span",{}),(0,r3.jsx)("span",{})]});let n=(0,r3.jsx)(V,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,r3.jsxs)(V,{component:"span",sx:{color:n4e(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,r3.jsxs)(V,{component:"span",sx:iUr,children:[r?o:n,r?n:o]})}var aUr={row:{display:"grid",gridTemplateColumns:"2.5ch 4ch 1ch 4ch 1ch 4ch auto",alignItems:"baseline",gap:.75,fontVariantNumeric:"tabular-nums"},pctWeight:500,note:{pl:.75,color:e=>e.tokens.color.onAppBar.secondary}};var n3=T(R(),1);function sUr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=aUr,a=kx(t,r,n,o),s=nUr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,n3.jsxs)(V,{sx:i.row,children:[(0,n3.jsx)(V,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,n3.jsx)(Fst,{direction:"back",threshold:l?.recovery}),(0,n3.jsxs)(V,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:n4e(a)},children:[Math.round(t),"%"]}),(0,n3.jsx)(Fst,{direction:"forward",threshold:l?.worse}),(0,n3.jsx)(V,{component:"span",sx:i.note,children:l?l.recovery&&oUr(l.recovery,o):"no projection yet"})]})}function o4e(e){return[{label:"5h",window:e.five_hour,windowSeconds:18e3},{label:"7d",window:e.seven_day,windowSeconds:604800}].flatMap(t=>t.window?.used_percentage==null?[]:[{label:t.label,pct:t.window.used_percentage,resetsAt:t.window.resets_at,windowSeconds:t.windowSeconds}])}var cUr=T(R(),1);function lUr({rateLimits:e,now:t}){return o4e(e).map(r=>(0,cUr.jsx)(sUr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var lD=T(R(),1);function uUr({groups:e}){let t=E0(3e4),r=eUr;return(0,lD.jsxs)(V,{sx:r.root,children:[e.map(n=>(0,lD.jsxs)(V,{sx:r.group,children:[(0,lD.jsx)(V,{sx:r.heading,children:Fc(n.harness)}),(0,lD.jsx)(lUr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,lD.jsx)(V,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var zst=T(R(),1),$Lo="Claude account usage (5h / 7d windows) \u2014 view history";function dUr(e){return e.length===0?{title:$Lo,content:"Usage"}:{title:(0,zst.jsx)(uUr,{groups:e}),content:(0,zst.jsx)(JHr,{groups:e})}}var fUr={display:"flex",alignItems:"center",height:22,px:1,borderRadius:1,fontSize:"inherit","&:hover, &:focus-visible":{bgcolor:e=>e.tokens.color.statusBar.hover,color:e=>e.tokens.color.statusBar.hoverText}},pUr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var Hst=T(R(),1),FLo={};function hUr({rateLimits:e,harnessRateLimits:t=FLo}){let{title:r,content:n}=dUr(e4e(e,t));return(0,Hst.jsx)(sr,{title:r,placement:"top-start",slotProps:pUr,children:(0,Hst.jsx)(Yr,{component:da,to:"/usage",underline:"none",color:"inherit",sx:fUr,children:n})})}var yUr=T(ee(),1);var ch="0.1062.1";var i4e=T(ee(),1),Ust=(0,i4e.createContext)(null);function a4e(){return(0,i4e.useContext)(Ust)}var Wst=T(R(),1);function mUr(){let e=a4e();return!e||e===ch?null:(0,Wst.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${ch}. Restart the daemon to match.`,children:(0,Wst.jsx)(HEe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var gUr=e=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:0,height:22,borderRadius:1,fontSize:"inherit",lineHeight:1.5,color:"inherit",opacity:1,bgcolor:t=>e?$x(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>$x(t).hover,color:t=>$x(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>$x(t).dot,boxShadow:t=>`0 0 0 3px ${$x(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>$x(t).readyText}});var L0=T(R(),1);function vUr(){let{entries:e}=Tx(),t=an(),r=(0,yUr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=fo("openUpdates");if(Zi(n,r),!ch)return null;let i=e.filter(F5).length;return(0,L0.jsxs)(L0.Fragment,{children:[(0,L0.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,L0.jsx)(Pd,{label:"Updates",chords:o}),children:(0,L0.jsxs)(Jt,{component:da,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:gUr(i>0),children:[i>0&&(0,L0.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,L0.jsxs)("span",{children:["v",ch]}),i>0&&(0,L0.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,L0.jsx)(mUr,{})]})}var eC=T(R(),1);function bUr({socket:e}){return(0,eC.jsx)(LHr,{start:(0,eC.jsx)(hUr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,eC.jsxs)(eC.Fragment,{children:[(0,eC.jsx)(UHr,{}),(0,eC.jsx)(vUr,{})]})})}var xUr=T(ee(),1);var tC=T(R(),1),zLo=2e4;function SUr(){let{entries:e,refresh:t}=Tx(),[r,n]=(0,xUr.useState)(),o=e.find(l=>l.local)?.status?.extension,i=o?.behind&&o.updateLink&&o.latest?o:void 0,a=i!==void 0&&r!==i.latest,s=()=>n(i?.latest);return(0,tC.jsx)(Ou,{open:a,children:(0,tC.jsxs)(no,{severity:"info",variant:"filled",action:(0,tC.jsxs)(tC.Fragment,{children:[(0,tC.jsx)(dt,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,zLo),children:"Install"}),(0,tC.jsx)(dt,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var d4e=T(ee(),1);var u4e=T(ee(),1);function TUr(e,t,r){if(!e)return"Select a repo to search files.";if(r.error)return"Couldn't search files in this repo.";if(!(r.files.length>0||r.loading))return t?"No matching files.":"No files in this repo."}var o3=T(R(),1),HLo={display:"flex",gap:1,alignItems:"center",minWidth:0},ULo={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},WLo={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},VLo={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function GLo(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function wUr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,o3.jsx)(tg,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=GLo(o);return(0,o3.jsxs)(qr,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:HLo,children:[(0,o3.jsx)(gSe,{path:o}),(0,o3.jsxs)(V,{sx:ULo,children:[(0,o3.jsx)(Te,{component:"span",sx:WLo,children:s}),(0,o3.jsx)(Te,{component:"span",color:"text.secondary",sx:VLo,children:a})]})]},o)})})}var s4e=T(R(),1),qLo={maxHeight:420,overflowY:"auto"},jLo={px:2,py:2,fontSize:13};function CUr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,s4e.jsx)(V,{sx:qLo,children:e?(0,s4e.jsx)(Te,{color:"text.secondary",sx:jLo,children:e}):(0,s4e.jsx)(wUr,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var kUr=T(R(),1),YLo={mt:6,alignSelf:"flex-start"};function l4e({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,kUr.jsx)(bl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:YLo},transition:{onEntered:t}},children:n})}var c4e=T(ee(),1);var _Ur={files:[],loading:!1,error:!1};function EUr(e,t){let[r,n]=(0,c4e.useState)(_Ur),o=yr();return(0,c4e.useEffect)(()=>{if(!e){n(_Ur);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await er(tn(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Pr(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var cD=T(R(),1);function KLo(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function RUr({onClose:e}){let{worktreeNode:t}=to();return(0,cD.jsx)(ac.Provider,{value:t,children:(0,cD.jsx)(XLo,{onClose:e})})}function XLo({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=to(),[n,o]=(0,u4e.useState)(""),i=EUr(t,n),a=an(),s=(0,u4e.useRef)(null),l=h=>a(KLo(h,t,r)),{highlight:u,setHighlight:d,onKeyDown:f}=q5(i.files,n,l,e),p=h=>{l(h),e()};return(0,cD.jsxs)(l4e,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,cD.jsx)(Lk,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:f,placeholder:"Search files by name..."}),(0,cD.jsx)(CUr,{message:TUr(t,n,i),files:i.files,highlight:u,onHighlight:d,onSelect:p})]})}function PUr(e){Zi(fo("quickOpen").matches,e)}var LUr=T(R(),1);function AUr(){let[e,t]=(0,d4e.useState)(!1);return PUr((0,d4e.useCallback)(()=>t(!0),[])),e?(0,LUr.jsx)(RUr,{onClose:()=>t(!1)}):null}var f4e=T(R(),1);function IUr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,f4e.jsx)(Ou,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,f4e.jsx)(no,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,f4e.jsx)(dt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var uoe=T(ee(),1);function aG(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var GUr=T(ee(),1);var DUr=T(R(),1),MUr=nt((0,DUr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var ZLo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function NUr(e){return e?ZLo[e]:"success.main"}function OUr(e){return e.split("-")[0].split(".").map(Number)}function BUr(e,t){if(!e||!t||e===t)return;let r=OUr(e),n=OUr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var uD=T(R(),1),QLo={height:16,fontSize:10},JLo={opacity:.6,fontSize:"0.85em"};function eIo(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function loe({nodes:e,name:t,showVersion:r=!1}){let n=a4e()??ch,o=e.links.find(a=>a.name===t),i=BUr(o?.peerVersion,n);return(0,uD.jsx)(sr,{title:eIo(e,t),placement:"right",children:(0,uD.jsxs)(V,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,uD.jsx)(MUr,{sx:{fontSize:8,color:NUr(o?.state)}}),t,r&&o?.peerVersion&&(0,uD.jsxs)(V,{component:"span",sx:JLo,children:["v",o.peerVersion]}),i&&(0,uD.jsx)($n,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:QLo})]})})}var dD=T(R(),1),tIo={opacity:.6},rIo={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function $Ur({nodes:e,name:t,clone:r}){let n=(0,dD.jsx)(loe,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,dD.jsx)(V,{component:"span",sx:tIo,children:n}):(0,dD.jsx)(sr,{title:UV(t,r.cloneTarget),children:(0,dD.jsxs)(V,{component:"span",sx:rIo,children:[(0,dD.jsx)(HV,{sx:{fontSize:14}}),n]})})}var zUr=T(R(),1),nIo={px:1.5,borderRadius:.75,fontSize:12,fontWeight:600,color:"text.secondary","&:hover":{color:"text.primary",bgcolor:"action.hover"},"&[aria-checked='true']":{color:"primary.main",bgcolor:"action.selected"},"&.Mui-focusVisible":{outline:2,outlineColor:"primary.main"}};function FUr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,zUr.jsx)(Jt,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:nIo,children:t})}var HUr={ArrowRight:1,ArrowLeft:-1};function oIo(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+HUr[e.key]+r)%r}function UUr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!HUr[o.key]){nw(o);return}let i=oIo(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var WUr=T(ee(),1);function sG(e){return e?.querySelector('[aria-checked="true"]')}function VUr(e,t){(0,WUr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=sG(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var Vst=T(R(),1),iIo={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function p4e({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return VUr(i,r),(0,Vst.jsx)(kt,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:UUr(t,r,n,l),sx:iIo,children:t.map(u=>(0,Vst.jsx)(FUr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var Gst=T(R(),1);function qUr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=kl(),a=(0,GUr.useRef)(null);return!i||!n||!e?null:(0,Gst.jsx)(p4e,{label:"Node",options:o,value:e,onChange:t,optionLabel:s=>(0,Gst.jsx)($Ur,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var h4e=T(R(),1);function jUr({prompt:e,children:t}){return(0,h4e.jsxs)(kt,{children:[e,(0,h4e.jsx)(kt,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var KUr=T(R(),1),aIo=".MuiOutlinedInput-notchedOutline",sIo={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${aIo}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function YUr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,KUr.jsx)(Fn,{sx:sIo,value:e,onChange:a=>t(a.target.value),onKeyDown:nw,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var JUr=T(ee(),1);var I0={draft:{placeholder:"Describe the backlog item to draft...",submitLabel:"Start draft",autoStartLabel:"Start draft + auto start",sessionMode:"assist-draft"},bug:{placeholder:"Describe the bug: what happened, what you expected...",submitLabel:"File bug",autoStartLabel:"File bug + auto start",sessionMode:"assist-bug"},prompt:{placeholder:yTe,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}};function m4e(e){let t=I0[e];return"autoStartLabel"in t?t.autoStartLabel:void 0}var XUr=Object.keys(I0);var qst=T(R(),1);function ZUr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,qst.jsx)(Ka,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,qst.jsx)(qr,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:Fc(i)},i))})}var fD=T(R(),1);function QUr(e){return t=>t==="prompt"&&e?(0,fD.jsxs)(fD.Fragment,{children:["prompt",(0,fD.jsx)(V,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Fc(e)}`}),(0,fD.jsx)(Hc,{sx:{fontSize:18,mr:-.75}})]}):t}var pD=T(R(),1);function eWr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,JUr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(sG(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,pD.jsxs)(pD.Fragment,{children:[(0,pD.jsx)(p4e,{label:"Mode",options:XUr,value:e.mode,onChange:l,optionLabel:QUr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,pD.jsx)(ZUr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var fWr=T(ee(),1);var jst=T(R(),1),lIo={zIndex:e=>e.zIndex.modal+1};function tWr({open:e,anchor:t,children:r}){return(0,jst.jsx)(UM,{open:e,anchorEl:t,placement:"bottom-start",sx:lIo,children:(0,jst.jsx)(Qr,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var rWr=T(R(),1),nWr=nt((0,rWr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var Yst=T(R(),1),cIo={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},uIo={fontSize:16,color:"text.disabled"};function oWr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:cIo,endAdornment:(0,Yst.jsx)(iPe,{position:"end",children:(0,Yst.jsx)(nWr,{sx:uIo})})}}}var iWr=T(EM(),1);function aWr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}nw(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,iWr.flushSync)(()=>{r(t),n()}),nw(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function g4e(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Ax(n).toLowerCase().includes(r)):e}var Kst=T(ee(),1);function sWr(){let[e,t]=(0,Kst.useState)(!1),[r,n]=(0,Kst.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var cWr=T(ee(),1);var lWr=e=>e?Ax(e):"";function uWr(e){let[t,r]=(0,cWr.useState)(()=>lWr(e));return{text:t,setText:r,showRepo:n=>r(lWr(n))}}function dWr(e,t,r){let n=sWr(),o=uWr(t),i=g4e(e,n.query),a=d=>{r(d),o.showRepo(d)},s=q5(i,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:o.text,filtered:i,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:aWr({open:n.open,highlighted:i[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:d=>{o.setText(d),n.filterBy(d)},onFocus:l,onBlur:()=>{n.close(),o.showRepo(t)},pick:d=>{a(d),n.close()}}}var lG=T(R(),1);function pWr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=dWr(e,t,r),s=(0,fWr.useRef)(null);return(0,lG.jsxs)(V,{ref:s,sx:{flex:1,minWidth:0},children:[(0,lG.jsx)(Fn,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),i()},inputRef:n,autoFocus:o,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:oWr(a.open)}),(0,lG.jsx)(tWr,{open:a.open,anchor:s.current,children:(0,lG.jsx)(NEe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var i3=T(R(),1);function hWr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=to();return(0,i3.jsxs)(jUr,{prompt:(0,i3.jsx)(YUr,{value:r.prompt,onChange:r.setPrompt,placeholder:I0[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,i3.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,i3.jsx)(pWr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,i3.jsx)(eWr,{...t})]}),(0,i3.jsx)(qUr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var yWr=T(R(),1),mWr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function gWr({submitLabel:e,disabled:t=!1,loading:r=!1,onClick:n}){return(0,yWr.jsx)(dt,{type:"submit",onClick:n,variant:"contained",disabled:t,loading:r,children:e})}var hD=T(R(),1),dIo=e=>({alignItems:"center",flexWrap:"wrap",gap:"14px",py:"10px",pl:"18px",pr:1.5,borderTop:1,borderColor:e.tokens.color.lineSoft,bgcolor:"background.default",fontSize:12,color:"text.secondary"}),fIo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function vWr(e){return(0,hD.jsxs)(kt,{direction:"row",sx:dIo,children:[mWr.map(([t,r])=>(0,hD.jsxs)("span",{children:[(0,hD.jsx)(V,{component:"kbd",sx:fIo,children:t}),r]},t)),(0,hD.jsx)(V,{sx:{flex:1}}),(0,hD.jsx)(gWr,{...e})]})}var y4e=T(ee(),1);function bWr(){let[e,t]=(0,y4e.useState)(!1);return(0,y4e.useEffect)(()=>{let r=o=>t(o.shiftKey),n=()=>t(!1);return globalThis.addEventListener("keydown",r),globalThis.addEventListener("keyup",r),globalThis.addEventListener("blur",n),()=>{globalThis.removeEventListener("keydown",r),globalThis.removeEventListener("keyup",r),globalThis.removeEventListener("blur",n)}},[]),e}function xWr(e,t){let r=bWr();return e==="clone"?"Clone":(r?m4e(t):void 0)??I0[t].submitLabel}var TWr=T(R(),1);function SWr({draft:e,targetKind:t,onClick:r}){return(0,TWr.jsx)(vWr,{submitLabel:xWr(t,e.mode),onClick:r,disabled:t==="blocked",loading:e.modePending})}var mD=T(ee(),1);function wWr(e,t){let r=(0,mD.useRef)(e),n=(0,mD.useRef)(null),o=(0,mD.useRef)(null),i=(0,mD.useRef)(null),a=(0,mD.useCallback)(u=>{n.current=u;let{field:d,selectionStart:f,selectionEnd:p}=r.current;u&&d==="prompt"&&u.setSelectionRange(f,p)},[]),s=u=>{let d=u.target;t({field:"prompt",selectionStart:d.selectionStart,selectionEnd:d.selectionEnd})},l=()=>{if(i.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:o.current,mode:sG(i.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:o,modeRef:i,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function pIo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:BEe(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function CWr(e,t){let{names:r,visible:n}=kl(),o=IEe(t,n?r:[void 0]);return{cloneState:o,target:pIo(t,e,o(e))}}var EWr=T(ee(),1);function hIo(e,t,r){let n=r===!0&&m4e(e)!==void 0;return!t&&!n?[]:[{...t&&{node:t},...n&&{autoApprove:!0}}]}function v4e({mode:e,harness:t,prompt:r,cwd:n,node:o,autoApprove:i},a){let s=n||void 0,l=o?[o]:[];if(e==="prompt"){t==="claude"?a.onCreate(r,s,...l):a.onCreateHarness(t,r,s,...l);return}if(e==="design"){a.onCreateDesign(r,s,...l);return}let u=hIo(e,o,i);o4r(I0[e].sessionMode,n,(d,f)=>a.onCreateAssist(d,f,...u),()=>{},r)}function kWr(e,t,r,n,o=!1){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(CEe(r.prompt,n.onCreateAssist),!0):(v4e({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node,autoApprove:o},n),e.clear(),!0)}var b4e=T(ee(),1);function _Wr(e,t){let[r,n]=(0,b4e.useState)(null);return(0,b4e.useEffect)(()=>{!r||e.modePending||(n(null),e.modeError||t(r.autoApprove))},[r,e.modePending,e.modeError,t]),o=>{e.modePending?n({autoApprove:o}):t(o)}}function RWr(e,t,r,n,o){let i=(0,EWr.useRef)(!1),a=_Wr(e,s=>{kWr(e,t,r,n,s)&&o()});return{onSubmit:s=>{s.preventDefault();let l=i.current;i.current=!1,a(l)},onSubmitClick:s=>{i.current=s.shiftKey}}}var coe=T(ee(),1);function PWr(e,t){let r=(0,coe.useRef)(e),n=(0,coe.useRef)(null);return(0,coe.useEffect)(()=>{if(r.current&&!e){let o=n.current;o?.isConnected?o.focus():t()}r.current=e},[e,t]),o=>{n.current=o.target}}var LWr=T(R(),1),mIo={border:0,margin:0,padding:0,minWidth:0};function AWr({loading:e,restoreFocus:t,children:r}){let n=PWr(e,t);return(0,LWr.jsx)("fieldset",{disabled:e,style:mIo,onFocus:n,children:r})}var S4e=T(R(),1);function x4e({error:e,onRetry:t}){return e?(0,S4e.jsxs)(no,{severity:"error",sx:{mx:2,my:1},action:t&&(0,S4e.jsx)(dt,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:["Couldn't load this repo's default mode (",e,"). Pick a mode or retry."]}):null}var a3=T(R(),1);function IWr({draft:e,launchers:t,onClose:r}){let n=wWr(e.focus,e.setFocus),o=aG(R0()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=CWr(e.node,e.cwd),{onSubmit:l,onSubmitClick:u}=RWr(e,i,a,t,r);return(0,a3.jsx)(l4e,{onClose:r,onEntered:n.restore,centered:!0,children:(0,a3.jsx)("form",{onSubmit:l,children:(0,a3.jsxs)(AWr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,a3.jsx)(hWr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,a3.jsx)(x4e,{error:e.modeError,onRetry:e.retryMode}),(0,a3.jsx)(SWr,{draft:e,targetKind:a.kind,onClick:u})]})})})}var gD=T(ee(),1);async function gIo(e){let t=`HTTP ${e.status}`,r=await e.json().catch(()=>null);return typeof r?.error=="string"?`${t}: ${r.error}`:t}async function yIo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await er(`/api/new-session-defaults${t}`);if(!r.ok)return{error:await gIo(r)};let n=await r.json();if(Object.hasOwn(I0,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Pr(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function T4e(e,t=0){let[r,n]=(0,gD.useState)(0),[o,i]=(0,gD.useState)(null),a=(0,gD.useCallback)(()=>n(l=>l+1),[]);if((0,gD.useEffect)(()=>{let l=!1;return yIo(e).then(u=>{l||i({cwd:e,opens:t,attempt:r,outcome:u})}),()=>{l=!0}},[e,t,r]),!o)return null;let{outcome:s}=o;return{mode:"mode"in s?s.mode:"prompt",pending:o.cwd!==e||o.opens!==t||o.attempt!==r,error:"error"in s?s.error:void 0,retry:a}}function w4e(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function DWr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var s3=T(ee(),1);var MWr={field:"prompt",selectionStart:0,selectionEnd:0};function NWr(){let[e,t]=UU("new-session"),[r,n]=(0,s3.useState)(),[o,i]=(0,s3.useState)(),[a,s]=(0,s3.useState)("claude"),[l,u]=(0,s3.useState)(),[d,f]=(0,s3.useState)(MWr),p=(0,s3.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),f(MWr)},[t]);return{prompt:e,cwd:r,mode:o,harness:a,node:l,focus:d,setPrompt:t,setNode:u,setCwd:n,setMode:i,setHarness:s,setFocus:f,clear:p}}function OWr(e,t=T4e){let{selectedCwd:r}=to(),n=kl(),o=NWr(),i=o.cwd??r,a=t(i,e);return a?{...o,cwd:i,mode:o.mode??a.mode,modePending:o.mode===void 0&&a.pending,modeError:w4e(o.mode,a),retryMode:a.retry,node:DWr(o.node,n)}:null}function BWr(e){Zi(fo("newSession").matches,e)}var $Wr=T(ee(),1);function FWr(e,t){let{selectedCwd:r}=to(),[n,o]=sl(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,$Wr.useEffect)(()=>{i===null||!s||!l||!u||(i&&(s(i),l(a),u({field:"prompt",selectionStart:i.length,selectionEnd:i.length})),t(),o(d=>(d.delete("new"),d.delete("newCwd"),d),{replace:!0}))},[i,a,s,l,u,t,o])}var HWr=T(R(),1);function zWr({launchers:e}){let[t,r]=(0,uoe.useState)(!1),[n,o]=(0,uoe.useState)(0),i=OWr(n),a=(0,uoe.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return BWr(a),FWr(i,a),!t||!i?null:(0,HWr.jsx)(IWr,{draft:i,launchers:e,onClose:()=>r(!1)})}var C4e=T(R(),1);function UWr({reconnecting:e}){return(0,C4e.jsx)(Ou,{open:e,children:(0,C4e.jsx)(no,{severity:"info",variant:"filled",icon:(0,C4e.jsx)(Ao,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var yv=T(R(),1);function WWr({socket:e,onViewLaunchedSession:t}){return(0,yv.jsxs)(yv.Fragment,{children:[(0,yv.jsx)(AUr,{}),(0,yv.jsx)(zWr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,yv.jsx)(UWr,{reconnecting:e.reconnecting}),(0,yv.jsx)(SUr,{}),(0,yv.jsx)(_l,{error:e.error,onClose:e.clearError}),(0,yv.jsx)(IUr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Fx=T(ee(),1);var vIo=6e4;function bIo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function k4e(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4068
4068
|
`),[n,o]=(0,Fx.useState)([]),i=(0,Fx.useRef)(0),a=(0,Fx.useCallback)(()=>{let l=r?r.split(`
|
|
4069
4069
|
`):[];if(l.length===0)return;let u=++i.current;o(d=>bIo(d,l,t));for(let d of l)J_e(d,d===t).then(f=>{u===i.current&&o(p=>p.map(h=>h.name===d?f:h))})},[r,t]);(0,Fx.useEffect)(()=>{a();let l=setInterval(a,vIo);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,Fx.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var Lm=T(ee(),1);var rC=T(ee(),1);var xIo=300,SIo=2,TIo="/api/health";async function wIo(){try{return(await er(TIo,{cache:"no-store",capture:!1})).ok}catch{return!1}}async function VWr(e){let t=0;for(;!e();){if(t=await wIo()?t+1:0,t>=SIo)return!e();await new Promise(r=>setTimeout(r,xIo))}return!1}function CIo(){return{sawDisconnect:!1,waiting:!1,abandoned:!0}}function GWr(e,t,r){let n=(0,rC.useRef)(CIo()),o=(0,rC.useRef)(r);o.current=r,(0,rC.useEffect)(()=>{let s=n.current;if(!(!e||s.abandoned)){if(t){s.sawDisconnect=!0;return}!s.sawDisconnect||s.waiting||(s.waiting=!0,VWr(()=>s.abandoned).then(l=>{l&&o.current()}))}},[e,t]);let i=(0,rC.useCallback)(()=>{n.current.abandoned=!0},[]),a=(0,rC.useCallback)(()=>{n.current.abandoned=!0,n.current={sawDisconnect:!1,waiting:!1,abandoned:!1}},[]);return(0,rC.useEffect)(()=>i,[i]),{arm:a,abandon:i}}var kIo=15e3;function zx(e,t,r){let[n,o]=(0,Lm.useState)(!1),[i,a]=(0,Lm.useState)(null),s=(0,Lm.useRef)(void 0),{arm:l,abandon:u}=GWr(n,t,()=>{clearTimeout(s.current),r?.(),globalThis.location.reload()});(0,Lm.useEffect)(()=>()=>clearTimeout(s.current),[]);let d=(0,Lm.useCallback)(async h=>{o(!0),l(),s.current=setTimeout(()=>{u(),o(!1),a("Web server did not come back")},kIo);try{if(!(await H5(h)).ok)throw new Error("restart failed")}catch(m){Pr(m,"web server restart"),u(),clearTimeout(s.current),o(!1),a("Failed to restart web server")}},[l,u]),f=(0,Lm.useCallback)(()=>d(e),[d,e]),p=(0,Lm.useCallback)(()=>a(null),[]);return(0,Lm.useMemo)(()=>({pending:n,error:i,clearError:p,restart:f,restartTo:d}),[n,i,p,f,d])}var nC=T(R(),1);function qWr({shell:e,children:t}){let{socket:r,selection:n,launch:o,sidebarCollapse:i}=e,a=k4e(r.nodeSelection),s=zx("webserver",r.reconnecting);return(0,nC.jsx)(nst.Provider,{value:a,children:(0,nC.jsx)(lst.Provider,{value:s,children:(0,nC.jsx)(FIe.Provider,{value:i,children:(0,nC.jsx)(qY.Provider,{value:n,children:(0,nC.jsx)(yIe.Provider,{value:r.nodeSelection,children:(0,nC.jsx)(ac.Provider,{value:n.selectedNode,children:(0,nC.jsx)(MQe.Provider,{value:o,children:(0,nC.jsx)(e2t,{children:t})})})})})})})})}var jWr=T(R(),1),YWr=nt((0,jWr.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var KWr=T(ee(),1);var vv=T(R(),1),_Io={ml:1,textTransform:"none",fontSize:12};function XWr(){let{nodes:e,names:t,visible:r,selected:n,select:o}=kl(),[i,a]=(0,KWr.useState)(null);return!r||!e||!n?null:(0,vv.jsxs)(vv.Fragment,{children:[(0,vv.jsx)(dt,{size:"small",color:"inherit",startIcon:(0,vv.jsx)(YWr,{fontSize:"small"}),"aria-label":"Node","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:_Io,children:(0,vv.jsx)(loe,{nodes:e,name:n})}),(0,vv.jsx)(Ka,{anchorEl:i,open:!!i,onClose:()=>a(null),children:t.map(s=>(0,vv.jsx)(qr,{selected:s===n,onClick:()=>{o(s),a(null)},sx:{fontSize:13},children:(0,vv.jsx)(loe,{nodes:e,name:s,showVersion:!0})},s))})]})}var doe=T(ee(),1);function ZWr(e,t){return[...e[0].slice(0,-1),String(t+1)]}var yD=T(R(),1),EIo=[gi("secondary"),{ml:.75}];function QWr({index:e,label:t,count:r,...n}){let{chords:o}=fo("navTab");return(0,yD.jsx)(sr,{describeChild:!0,title:(0,yD.jsx)(Pd,{label:t,chords:[ZWr(o,e)]}),children:(0,yD.jsx)(Kv,{label:r?(0,yD.jsxs)("span",{children:[t,(0,yD.jsx)(V,{component:"span",sx:EIo,children:r})]}):t,...n})})}var JWr=T(ee(),1);var RIo=6e4;function eVr(){let e=RSe();return(0,JWr.useEffect)(()=>{js.refresh();let t=setInterval(()=>{js.refresh()},RIo);return()=>clearInterval(t)},[]),e?.length??0}var Xst=T(ee(),1);function tVr(e,t){let{bound:r}=fo("navTab"),n=e.length,o=(0,Xst.useCallback)(a=>(tK(a,r)??n)<n,[r,n]),i=(0,Xst.useCallback)(a=>{let s=e[tK(a,r)??-1];s&&t(s)},[e,t,r]);Zi(o,i)}var _4e=T(ee(),1);function rVr(){let[e,t]=(0,_4e.useState)(!1);return(0,_4e.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await er("/api/news/nav")).json();r||t(o?.showInNav===!0)}catch(n){Pr(n,"news nav"),r||t(!1)}})(),()=>{r=!0}},[]),e}var E4e=T(ee(),1);async function PIo(e,t){let r=await er(tn(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function nVr(e){let[t,r]=(0,E4e.useState)(null),n=yr(),o=`${n??""}\0${e}`;return(0,E4e.useEffect)(()=>{if(!e)return;let i=!1;return PIo(e,n).catch(a=>{Pr(a,"releases configured")}).then(a=>{i||r({key:o,configured:a})}),()=>{i=!0}},[e,n,o]),t?.key===o?t.configured:void 0}var oVr=T(ee(),1);function iVr(e){let{pathname:t}=mi(),r=an(),n=t==="/releases"||t.startsWith("/releases/");(0,oVr.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var AIo={path:"/sessions",label:"Sessions"},LIo={path:"/backlog",label:"Backlog"},IIo={path:"/next",label:"Next"},DIo={path:"/releases",label:"Releases"},MIo={path:"/news",label:"News"},NIo={path:"/inbox",label:"Inbox"};function aVr(e,t){return[AIo,LIo,IIo,...e?[DIo]:[],...t?[MIo]:[],NIo]}var Zst=T(R(),1),OIo={mx:"6px"};function sVr({cwd:e}){let t=mi(),r=an(),n=nVr(e),o=rVr(),i=eVr();iVr(n);let a=n===!0,s=(0,doe.useMemo)(()=>aVr(a,o),[a,o]),l=(0,doe.useMemo)(()=>s.map(f=>f.path),[s]),u=s.findIndex(f=>t.pathname.startsWith(f.path)),d=(0,doe.useCallback)(f=>{t.pathname!==f&&r(f)},[t.pathname,r]);return tVr(l,d),(0,Zst.jsx)(_R,{sx:OIo,value:u===-1?!1:u,textColor:"inherit",indicatorColor:"secondary",children:s.map((f,p)=>(0,Zst.jsx)(QWr,{index:p,label:f.label,count:f.path==="/inbox"?i:void 0,onClick:()=>d(f.path)},f.path))})}var foe=T(R(),1),lVr=(e,t)=>({bgcolor:e,color:t,"& .MuiSvgIcon-root":{color:t},transition:"filter 0.2s ease, transform 0.2s ease","&:hover":{bgcolor:e,color:t,filter:"brightness(1.08)"},"&:active":{transform:"translateY(1px)"}}),BIo=e=>({ml:.75,...e.tokens.color.appBar?lVr("primary.main","primary.contrastText"):lVr("primary.contrastText","primary.main")});function cVr(){let[,e]=sl(),{label:t,chords:r}=fo("newSession");return(0,foe.jsx)(sr,{title:(0,foe.jsx)(Pd,{label:t,chords:r}),children:(0,foe.jsx)(jt,{sx:BIo,"aria-label":"New session",onClick:()=>e(o=>(o.set("new",""),o),{replace:!0}),children:(0,foe.jsx)(gp,{})})})}var R4e=T(ee(),1);var poe=T(R(),1),$Io={strokeWidth:2};function uVr(e){return(0,poe.jsxs)(STe,{viewBox:"0 0 24 24",sx:$Io,...e,children:[(0,poe.jsx)("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 3.5c-.3 1.15-.3 2.35 0 3.5A5.4 5.4 0 0 0 4 10.5c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),(0,poe.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}var hoe=T(R(),1);function dVr({cwd:e}){let[t,r]=(0,R4e.useState)(null),n=yr();return(0,R4e.useEffect)(()=>{if(!e){r(null);return}let o=!1;return(async()=>{try{let a=await(await er(tn(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();o||r(a?.url??null)}catch(i){Pr(i,"GitHub URL"),o||r(null)}})(),()=>{o=!0}},[e,n]),t?(0,hoe.jsx)(sr,{title:"Open in GitHub",children:(0,hoe.jsx)(V,{component:"span",sx:TTe,children:(0,hoe.jsx)(jt,{onClick:()=>window.open(t,"_blank"),children:(0,hoe.jsx)(uVr,{})})})}):null}var bv=T(R(),1),FIo={color:"inherit",mr:1.5};function fVr({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:o}=zx("webserver",e);return(0,bv.jsxs)(bv.Fragment,{children:[(0,bv.jsx)(sr,{title:"Restart web server",children:(0,bv.jsx)("span",{children:(0,bv.jsx)(jt,{sx:FIo,disabled:t,onClick:o,children:t?(0,bv.jsx)(Ao,{size:24}):(0,bv.jsx)(bU,{})})})}),(0,bv.jsx)(_l,{error:r,onClose:n})]})}var mVr=T(ee(),1);var pVr=T(ee(),1);function hVr(e){let t=Pn().palette.primary.main;Zi(fo("focusRepoPicker").matches,(0,pVr.useCallback)(()=>zc({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var moe=T(R(),1),zIo={width:240,ml:2};function gVr({repos:e,selected:t,onSelect:r}){let n=(0,mVr.useRef)(null);hVr(n);let{chords:o}=fo("focusRepoPicker");return(0,moe.jsx)(V,{ref:n,sx:zIo,children:(0,moe.jsx)(vTe,{label:t?Ax(t):"Select repo...",tooltip:(0,moe.jsx)(Pd,{label:"Repo",chords:o}),typeToOpen:!0,children:(i,a)=>(0,moe.jsx)(pFr,{repos:e,selected:t,onSelect:r,close:i,initialFilter:a})})})}var _Vr=T(ee(),1);var goe=T(ee(),1);function P4e(e){let[t,r]=(0,goe.useState)([]),[n,o]=(0,goe.useState)(!0),i=yr();return(0,goe.useEffect)(()=>{if(!e){r([]),o(!1);return}let a=!1;return o(!0),er(tn(`/api/pr-list?cwd=${encodeURIComponent(e)}`,i)).then(s=>s.json()).then(s=>{a||(r(Array.isArray(s?.prs)?s.prs:[]),o(!1))}).catch(s=>{Pr(s,"open PRs"),!a&&(r([]),o(!1))}),()=>{a=!0}},[e,i]),{prs:t,loading:n}}var Qst=T(R(),1);function Jst({text:e}){return(0,Qst.jsx)(V,{sx:{p:1.5},children:(0,Qst.jsx)(Te,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var vD=T(R(),1);function yVr({pr:e,highlighted:t,onHover:r,onPick:n}){let o=MEe(t);return(0,vD.jsx)(qr,{ref:o,selected:t,onMouseDown:i=>i.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,vD.jsxs)(kt,{spacing:.25,sx:{minWidth:0},children:[(0,vD.jsxs)(Te,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,vD.jsx)($n,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,vD.jsxs)(Te,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",xo(e.createdAt)]})]})})}var elt=T(R(),1);function vVr({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,elt.jsx)(tg,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((o,i)=>(0,elt.jsx)(yVr,{pr:o,highlighted:i===t,onHover:()=>r(i),onPick:n},o.number))})}var xVr=T(ee(),1);function bVr(e,t){let r=t.trim().toLowerCase();if(!r)return e;let n=r.replace(/^#/,"");return e.filter(o=>o.title.toLowerCase().includes(r)||o.author.toLowerCase().includes(r)||n!==""&&String(o.number).includes(n))}function SVr(e,t,r){let[n,o]=(0,xVr.useState)(""),i=bVr(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=q5(i,n,t,r);return{filter:n,setFilter:o,filtered:i,highlight:a,setHighlight:s,onKeyDown:l,select:d=>{t(d),r()}}}var l3=T(R(),1),TVr={...HU,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function wVr({cwd:e,onPick:t,close:r}){let{prs:n,loading:o}=P4e(e),i=SVr(n,t,r);return o||n.length===0?(0,l3.jsx)(Qr,{elevation:4,sx:TVr,children:(0,l3.jsx)(Jst,{text:o?"Loading open PRs\u2026":"No open PRs"})}):(0,l3.jsxs)(Qr,{elevation:4,sx:TVr,children:[(0,l3.jsx)(Lk,{autoFocus:!0,value:i.filter,onChange:i.setFilter,onKeyDown:i.onKeyDown,placeholder:"Filter PRs..."}),i.filtered.length===0?(0,l3.jsx)(Jst,{text:"No PRs match"}):(0,l3.jsx)(vVr,{prs:i.filtered,highlight:i.highlight,onHighlight:i.setHighlight,onPick:i.select})]})}var kVr=T(R(),1);function CVr({cwd:e,onPick:t,close:r}){return(0,kVr.jsx)(wVr,{cwd:e,onPick:t,close:r})}var c3=T(R(),1);function EVr({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:o}=P4e(e),[i,a]=(0,_Vr.useState)(null);return o||n.length===0?null:(0,c3.jsxs)(c3.Fragment,{children:[(0,c3.jsx)(vTe,{label:"prs",disabled:t,children:s=>(0,c3.jsx)(CVr,{cwd:e,onPick:a,close:s})}),i&&(0,c3.jsx)(XSe,{pr:i,onSelect:s=>{r(i,s),a(null)},onCancel:()=>a(null)})]})}var PVr=T(R(),1);function RVr({onStartRun:e,cwd:t}){let r=mTe(t);return!t||r.length===0?null:(0,PVr.jsx)(pTe,{runs:r,onSelect:(n,o)=>e(n,t,o)})}var yoe=T(R(),1);function AVr({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=to();return(0,yoe.jsxs)(kt,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:1.5}},children:[(0,yoe.jsx)(EVr,{cwd:r,disabled:!r,onSelect:(o,i)=>e([...i,String(o.number)],r,{...I4(o),node:n})}),(0,yoe.jsx)(RVr,{onStartRun:(o,i,a)=>t(o,i,a,void 0,n),cwd:r})]})}var Im=T(R(),1),HIo={minHeight:48,pl:1,pr:14};function LVr({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=Vk();return(0,Im.jsxs)(CR,{variant:"dense",disableGutters:!0,sx:HIo,children:[r&&(0,Im.jsx)(Wue,{collapsed:r,onToggleCollapsed:n}),(0,Im.jsx)(fVr,{reconnecting:e.reconnecting}),(0,Im.jsx)(sVr,{cwd:t.selectedCwd}),(0,Im.jsx)(XWr,{}),(0,Im.jsx)(gVr,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,Im.jsxs)(V,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,Im.jsx)(wTe,{cwd:t.selectedCwd}),(0,Im.jsx)(dVr,{cwd:t.selectedCwd}),(0,Im.jsx)(cVr,{})]}),(0,Im.jsx)(AVr,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun})]})}var A4e=T(ee(),1);function IVr(){let[e,t]=(0,A4e.useState)(null);return(0,A4e.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await er("/api/health")).json();!r&&typeof o?.nodeName=="string"&&t(o.nodeName)}catch(n){Pr(n,"node name")}})(),()=>{r=!0}},[]),e}var MVr=T(R(),1),UIo={lineHeight:"32px",bgcolor:"transparent"};function DVr(){let e=IVr();return e?(0,MVr.jsx)(ORe,{sx:UIo,children:e}):null}var NVr=T(R(),1),OVr=nt((0,NVr.jsx)("path",{d:"M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-1 2H5v-2h2zm0-3H5V8h2zm9 7H8v-2h8zm0-4h-2v-2h2zm0-3h-2V8h2zm3 3h-2v-2h2zm0-3h-2V8h2z"}),"Keyboard");var BVr=T(R(),1),$Vr=nt((0,BVr.jsx)("path",{d:"m12 16.5 4-4h-3v-9h-2v9H8zm9-13h-6v1.99h6v14.03H3V5.49h6V3.5H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2"}),"SystemUpdateAlt");var FVr=T(R(),1),zVr=nt((0,FVr.jsx)("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6"}),"Brightness4");var HVr=T(R(),1),UVr=nt((0,HVr.jsx)("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m0-10c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4"}),"Brightness7");var tlt=T(R(),1);function WVr({mode:e}){return e==="dark"?(0,tlt.jsx)(UVr,{fontSize:"small"}):(0,tlt.jsx)(zVr,{fontSize:"small"})}var VVr=T(R(),1),GVr=nt((0,VVr.jsx)("path",{d:"M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1m-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m4.5-4H7V4h9z"}),"PhoneIphone");var cG=T(R(),1);function qVr({onClose:e}){let t=an();return(0,cG.jsxs)(qr,{onClick:()=>{e(),t("/connect-mobile")},children:[(0,cG.jsx)(eg,{children:(0,cG.jsx)(GVr,{fontSize:"small"})}),(0,cG.jsx)(Td,{children:"Connect mobile"})]})}var jVr=T(R(),1),YVr=nt((0,jVr.jsx)("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11"}),"Extension");var uG=T(R(),1);function WIo(e){return e?.installLink?`${e.connected?`v${e.connected} installed`:"not connected"} \xB7 v${e.latest} latest`:"unavailable"}function KVr({onClose:e}){let{entries:t}=Tx(),r=t.find(o=>o.local)?.status?.extension,n=r?.installLink;return(0,uG.jsxs)(qr,{component:"a",href:n,disabled:!n,onClick:e,children:[(0,uG.jsx)(eg,{children:(0,uG.jsx)(YVr,{fontSize:"small"})}),(0,uG.jsx)(Td,{primary:"Firefox extension",secondary:WIo(r)})]})}var XVr=T(R(),1),ZVr=nt((0,XVr.jsx)("path",{d:"m20.38 8.57-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44zm-9.79 6.84a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83"}),"Speed");var dG=T(R(),1);function QVr(){let e=oTe();return(0,dG.jsxs)(qr,{onClick:()=>YRt(!e),children:[(0,dG.jsx)(eg,{children:(0,dG.jsx)(ZVr,{fontSize:"small"})}),(0,dG.jsx)(Td,{children:e?"Hide render HUD":"Show render HUD"})]})}var Js=T(R(),1);function JVr({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onShowShortcuts:o,onConnectMobile:i,onFirefoxExtension:a,onRestart:s,onUpdate:l}){return[(0,Js.jsxs)(qr,{onClick:n,children:[(0,Js.jsx)(eg,{children:(0,Js.jsx)(WVr,{mode:e})}),(0,Js.jsx)(Td,{children:"Toggle dark mode"})]},"color-mode"),(0,Js.jsx)(QVr,{},"render-hud"),(0,Js.jsxs)(qr,{onClick:o,children:[(0,Js.jsx)(eg,{children:(0,Js.jsx)(OVr,{fontSize:"small"})}),(0,Js.jsx)(Td,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,Js.jsx)(qVr,{onClose:i},"connect-mobile"),(0,Js.jsx)(KVr,{onClose:a},"firefox-extension"),(0,Js.jsx)(eo,{},"restart-divider"),(0,Js.jsxs)(qr,{onClick:s,children:[(0,Js.jsx)(eg,{children:(0,Js.jsx)(F8,{fontSize:"small"})}),(0,Js.jsx)(Td,{children:t})]},"restart"),(0,Js.jsxs)(qr,{onClick:l,children:[(0,Js.jsx)(eg,{children:(0,Js.jsx)($Vr,{fontSize:"small"})}),(0,Js.jsx)(Td,{children:r})]},"update")]}var eGr=T(ee(),1);var rGr=T(R(),1);function tGr({peer:e,onRestart:t,onClose:r}){let[n,o]=(0,eGr.useState)(!1);return(0,rGr.jsx)(Uo,{title:`Restart ${e}?`,message:`Restarts the sessions daemon and web server on ${e}. Its sessions resume when the daemon is back. This page stays open.`,confirmLabel:"Restart",busy:n,autoFocusConfirm:!0,onConfirm:()=>{o(!0),t(e).finally(r)},onCancel:r})}function nGr(e){let t=new Map;for(let r of e){let n=t.get(r.group)??[];n.push(r),t.set(r.group,n)}return[...t].map(([r,n])=>({name:r,shortcuts:n}))}var VIo=Object.keys(I8);function oGr(){let e=D8();return nGr(VIo.map(t=>Ok(t,e)))}var Dm=T(R(),1),GIo={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},qIo={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function iGr({onClose:e}){let t=oGr();return(0,Dm.jsxs)(bl,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,Dm.jsxs)(xd,{id:"shortcuts-dialog-title",sx:GIo,children:["Keyboard shortcuts",(0,Dm.jsx)(jt,{size:"small","aria-label":"Close",onClick:e,children:(0,Dm.jsx)(Ho,{fontSize:"small"})})]}),(0,Dm.jsx)(bd,{dividers:!0,children:t.map(r=>(0,Dm.jsxs)(V,{component:"section",sx:{mb:1.5},children:[(0,Dm.jsx)(Te,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,Dm.jsxs)(V,{sx:qIo,children:[(0,Dm.jsx)(Te,{variant:"body2",children:n.label}),(0,Dm.jsx)(kt,{direction:"row",spacing:.5,children:(0,Dm.jsx)(vue,{chords:n.chords})})]},n.label))]},r.name))})]})}var bD=T(R(),1);function aGr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:o,restart:i}=zx(kV.target,e);return(0,bD.jsxs)(bD.Fragment,{children:[(0,bD.jsx)(Uo,{title:kV.label,message:kV.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{i()},onCancel:t}),(0,bD.jsx)(_l,{error:n,onClose:o})]})}var lGr=T(R(),1);function jIo(e){return e?{title:`Update assist on ${e}?`,message:`This runs 'assist update' on ${e} as a new session, then restarts its web server. This page stays open.`}:{title:"Update assist",message:"This starts a new session running 'assist update'. Its output will appear in the terminal."}}function sGr({peer:e,onConfirm:t,onClose:r}){return(0,lGr.jsx)(Uo,{...jIo(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var xv=T(ee(),1);async function YIo(e){try{let t=await er(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch(t){return Pr(t,"node doctor"),null}}async function cGr(e,t){let r=await YIo(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var oC=T(ee(),1);function uGr(e){let{nodes:t}=kl(),[r,n]=(0,oC.useState)(null),o=(0,oC.useRef)(!1),i=r?t?.links.find(l=>l.name===r.peer):void 0;(0,oC.useEffect)(()=>{if(!(!r||!i)){if(i.state!=="connected"){o.current=!0;return}o.current&&(n(null),e(r.describe(r.peer,i.peerVersion)))}},[r,i,e]);let a=(0,oC.useCallback)((l,u)=>{o.current=!1,n({peer:l,describe:u})},[]),s=(0,oC.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var KIo=9e4;function L4e(){let[e,t]=(0,xv.useState)(null),[r,n]=(0,xv.useState)(null),o=(0,xv.useRef)(void 0),i=(0,xv.useCallback)(d=>{clearTimeout(o.current),t(d)},[]),{watch:a,stop:s}=uGr(i);(0,xv.useEffect)(()=>()=>clearTimeout(o.current),[]);let l=(0,xv.useCallback)(async(d,f)=>{n(await cGr(d,f))},[]);return{requestThenAwait:(0,xv.useCallback)(async(d,f,p,h)=>{let m;try{m=await p()}catch(g){Pr(g,`${f} ${d}`)}return m?.ok?(a(d,h),clearTimeout(o.current),o.current=setTimeout(()=>{s(),l(d,`${d} did not come back`)},KIo),!0):(await l(d,`${f} failed (${await z5(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var XIo=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function dGr(){let{requestThenAwait:e,...t}=L4e();return{restart:n=>e(n,`Restart ${n}`,()=>H5("both",n),XIo),...t}}var voe=T(ee(),1);function I4e(e){return er(tn("/api/self-update",e),{method:"POST",timeoutMs:66e4})}var Sv=T(ee(),1);function fGr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function D4e(e,t,r){let[n,o]=(0,Sv.useState)(!1),[i,a]=(0,Sv.useState)(!1),s=(0,Sv.useRef)(!1),l=(0,Sv.useRef)(e);l.current=e;let u=(0,Sv.useRef)(new Set),d=(0,Sv.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(fGr).map(f=>f.id)),o(!0)},[]);return(0,Sv.useEffect)(()=>{if(!n||i)return;if(t){s.current=!0;return}if(!s.current)return;e.some(p=>fGr(p)&&p.node===r&&!u.current.has(p.id))&&a(!0)},[n,i,t,e,r]),{arm:d,completed:i}}var pGr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function hGr(e){let{nodes:t}=kl(),{launchAssist:r}=jl(),{requestThenAwait:n,...o}=L4e(),[i,a]=(0,voe.useState)(null),[s,l]=(0,voe.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:d,completed:f}=D4e(e,u(s)!=="connected",s);(0,voe.useEffect)(()=>{!f||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>H5("webserver",s),pGr))},[f,s,n]);let p=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>I4e(m),pGr),a(null)};return{update:m=>{if(u(m)!=="connected"){p(m);return}l(m),d(),r(["update"],void 0,{node:m})},progress:i,...o}}var Tv=T(R(),1);function mGr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:o}){let{launchAssist:i,armUpdateReload:a}=jl(),s=dGr(),l=hGr(r);return(0,Tv.jsxs)(Tv.Fragment,{children:[e==="shortcuts"&&(0,Tv.jsx)(iGr,{onClose:o}),e==="restart"&&t&&(0,Tv.jsx)(tGr,{peer:t,onRestart:s.restart,onClose:o}),e==="restart"&&!t&&(0,Tv.jsx)(aGr,{reconnecting:n,onClose:o}),e==="update"&&(0,Tv.jsx)(sGr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),i(["update"])},onClose:o}),(0,Tv.jsx)(Ene,{notices:s}),(0,Tv.jsx)(Ene,{notices:l})]})}var gGr=T(R(),1),yGr=nt((0,gGr.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");var M4e=T(R(),1),ZIo="https://staffordwilliams.com/assist";function vGr(){return(0,M4e.jsx)(sr,{title:"Help",children:(0,M4e.jsx)(jt,{component:"a",href:ZIo,target:"_blank",rel:"noopener noreferrer","aria-label":"Help",size:"small",sx:{color:"inherit"},children:(0,M4e.jsx)(yGr,{fontSize:"small"})})})}var bGr=T(R(),1),xGr=nt((0,bGr.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");var SGr=T(ee(),1);var boe=T(R(),1);function TGr(){let e=an(),t=(0,SGr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=fo("openConfig");return Zi(r,t),(0,boe.jsx)(sr,{describeChild:!0,title:(0,boe.jsx)(Pd,{label:"Config",chords:n}),children:(0,boe.jsx)(jt,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,boe.jsx)(xGr,{fontSize:"small"})})})}var wGr=T(R(),1),CGr=nt((0,wGr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var N4e=T(ee(),1);var xoe=T(R(),1);function kGr({open:e,onOpen:t}){let r=(0,N4e.useRef)(null),{matches:n,chords:o}=fo("openMenu");return Zi(n,(0,N4e.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,xoe.jsx)(sr,{describeChild:!0,title:(0,xoe.jsx)(Pd,{label:"Menu",chords:o}),children:(0,xoe.jsx)(jt,{ref:r,onClick:i=>t(i.currentTarget),size:"small",sx:{color:"inherit"},"aria-label":"Open menu","aria-haspopup":"true","aria-expanded":e?"true":void 0,children:(0,xoe.jsx)(CGr,{fontSize:"small"})})})}var fG=T(R(),1);function _Gr({open:e,onOpen:t}){return(0,fG.jsxs)(V,{sx:{position:"fixed",top:8,right:16,zIndex:r=>r.zIndex.drawer+2,display:"flex",alignItems:"center",gap:.5,color:r=>r.tokens.color.appBar?.text??r.palette.primary.contrastText},children:[(0,fG.jsx)(vGr,{}),(0,fG.jsx)(TGr,{}),(0,fG.jsx)(kGr,{open:e,onOpen:t})]})}var xD=T(ee(),1);var RGr=T(ee(),1);var EGr=!0,QIo=new Set(["openMenu","cycleCards"]),JIo=Object.keys(I8).filter(e=>!QIo.has(e));function PGr(e,t){let r=D8();(0,RGr.useEffect)(()=>{if(!e)return;let n=o=>{JIo.some(i=>Ok(i,r).matches(o))&&t()};return globalThis.addEventListener("keydown",n,EGr),()=>globalThis.removeEventListener("keydown",n,EGr)},[e,t,r])}function AGr(){let[e,t]=(0,xD.useState)(null),[r,n]=(0,xD.useState)(!0),o=!!e,i=(0,xD.useCallback)(()=>t(null),[]),a=(0,xD.useCallback)(s=>{n(!0),t(s)},[]);return PGr(o,(0,xD.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:o,close:i,openAt:a,restoreFocus:r}}var Soe=T(ee(),1);function LGr(e){Zi(fo("shortcutsSheet").matches,e)}function IGr(){let[e,t]=(0,Soe.useState)(null);LGr((0,Soe.useCallback)(()=>t("shortcuts"),[]));let r=(0,Soe.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function DGr(){let{nodes:e,selected:t}=kl();return e&&t&&t!==e.local?t:void 0}function MGr(e){return{restartLabel:e?`Restart ${e}`:kV.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}var iC=T(R(),1);function NGr({mode:e,toggle:t,sessions:r,reconnecting:n}){let{anchorEl:o,open:i,close:a,openAt:s,restoreFocus:l}=AGr(),{dialog:u,showDialog:d,closeDialog:f}=IGr(),p=DGr(),h=m=>()=>{a(),d(m)};return(0,iC.jsxs)(iC.Fragment,{children:[(0,iC.jsx)(_Gr,{open:i,onOpen:s}),(0,iC.jsxs)(Ka,{anchorEl:o,open:i,onClose:a,disableRestoreFocus:!l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,iC.jsx)(DVr,{}),JVr({mode:e,...MGr(p),onToggleColorMode:()=>{t(),a()},onShowShortcuts:h("shortcuts"),onConnectMobile:a,onFirefoxExtension:a,onRestart:h("restart"),onUpdate:h("update")})]}),(0,iC.jsx)(mGr,{dialog:u,peer:p,sessions:r,reconnecting:n,onClose:f})]})}var $Gr=T(ee(),1);var BGr=T(R(),1);function OGr({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:o,port:i,group:a}=e.existing,s=Ja(o),l=i?` on port ${i}`:"",u=s?` in ${s}`:"",d=a?`, holding the ${a} server slot`:"";return(0,BGr.jsx)(Uo,{title:a?`Replace the ${a} server?`:"Replace running server?",message:`"${n}" is already serving${l}${u}${d}. Replace it \u2014 stop the running server and start this one? Shift+click skips this dialog next time.`,confirmLabel:"Replace",confirmColor:"error",onConfirm:t,onCancel:r})}var O4e=T(R(),1);function FGr({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:o,stopSession:i,startRun:a,discardSession:s}=e,l=(0,$Gr.useMemo)(()=>({onStop:i,onStart:a,onDiscard:s}),[i,a,s]),u=()=>{r&&(r.runName?a(r.runName,r.cwd,!0,r.launchedFrom,r.node):r.sessionId&&o(r.sessionId,!0),n())};return(0,O4e.jsxs)(LIe.Provider,{value:l,children:[t,r&&(0,O4e.jsx)(OGr,{conflict:r,onConfirm:u,onCancel:n})]})}var zGr=new Map;function HGr(e,t){if(!Afe())return;let r=zGr.get(e);if(zGr.set(e,t),!!r)for(let[n,o]of Object.entries(t))Object.is(o,r[n])||b1(`\u0394 ${e}.${n}`)}var $4e=T(ee(),1);function UGr(e,t,r){if(!t)return null;let n=e[t];if(!n)return null;let o=r.find(i=>i.id===n);return!o||Cl(o)!==t?null:n}function Hx(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function B4e(){let{pathname:e}=mi();return e.startsWith("/backlog")||e.startsWith("/usage")}function WGr({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:o,onSelect:i}){let a=Hx(t,r,n),s=a&&Cl(a),l=!!(s&&s===e),u=UGr(o,e,r),d=(0,$4e.useRef)(t),f=B4e();(0,$4e.useEffect)(()=>{let p=d.current!==t&&!!s;d.current=t,!(f||p||l||!u)&&i(u)},[t,s,l,u,i,f])}var H4e=T(ee(),1);function VGr(e,t,r,n){return Hx(e,t,r)?.cwd||n}function GGr(e,t,r,n){let o=VGr(e,t,r,n.cwd),i=Hx(e,t,r);return{cwd:o,node:i?.cwd?i.node:n.node}}var rlt=T(ee(),1);function qGr(e,t,r){let{cwd:n,node:o,origin:i}=r,a=(0,rlt.useCallback)((l,u)=>{let d=sh(u,t),f=Jne(e,l);return f?f.clones[d]:d===(l===n?o:Jf)?l:void 0},[e,t,n,o]),s=(0,rlt.useCallback)(l=>Jne(e,l)?.origin??(l===n?i:void 0),[e,n,i]);return{cloneOn:a,originOf:s}}var F4e=T(ee(),1);function jGr(e,t,r,n){let o=(0,F4e.useRef)(e);(0,F4e.useEffect)(()=>{if(o.current===e)return;o.current=e;let i=Jne(t,r)?.clones[e];i&&n(i,e)},[e,t,r,n])}var pG=T(ee(),1);function YGr(e,t,r){if(t.node!==void 0)return t.node;let n=new Set(e.flatMap(o=>Object.entries(o.clones).filter(([,i])=>i===t.cwd).map(([i])=>i)));return n.has(r)?r:n.size===0||n.has(Jf)?Jf:[...n][0]}function KGr(e,t,r,n){let[o,i]=(0,pG.useState)({cwd:e}),a=(0,pG.useCallback)((l,u,d)=>i({cwd:l,node:u,origin:d}),[]);(0,pG.useEffect)(()=>{e&&!o.cwd&&i({cwd:e})},[e,o.cwd]);let s=YGr(t,{cwd:o.cwd,node:o.node===void 0?void 0:sh(o.node,n)},r);return{selectedCwd:o.cwd,selectedNode:s||void 0,selectedPick:{cwd:o.cwd,node:s,origin:o.origin},setSelectedCwd:a}}var XGr=T(ee(),1);function z4e(e,t,r){let n=Hx(e,t,r);return n&&Cl(n)}function ZGr(e,t,r,n){let o=z4e(e,t,r),i=Hx(e,t,r),a=i?.node??Jf,s=i?.repoGroup?.origin;(0,XGr.useEffect)(()=>{o&&n(o,a,s)},[o,a,s,n])}function QGr(e,t,r,n,o){let i=o.nodes?.local,a=sh(o.selected,i),s=(0,H4e.useMemo)(()=>Y5(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:d,setSelectedCwd:f}=KGr(e,s,a,i);ZGr(r,n,t,f),jGr(a,s,l,f);let{cloneOn:p,originOf:h}=qGr(s,i,d),m=(0,H4e.useMemo)(()=>s.map(v=>KFr(v,a)),[s,a]),{cwd:g,node:y}=GGr(r,n,t,{cwd:l,node:u});return(0,H4e.useMemo)(()=>({repos:m,selectedCwd:l,selectedNode:u,worktreeCwd:g,worktreeNode:y,setSelectedCwd:f,cloneOn:p,originOf:h}),[m,l,u,g,y,f,p,h])}var W4e=T(ee(),1);var u3=T(ee(),1);var JGr=T(ee(),1),U4e="assist:reloaded-after-update";function eqr(e){(0,JGr.useEffect)(()=>{globalThis.sessionStorage?.getItem(U4e)&&(globalThis.sessionStorage.removeItem(U4e),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function tqr(e,t,r,n){let{arm:o,completed:i}=D4e(e,t),a=(0,u3.useRef)(!1),s=(0,u3.useCallback)(()=>{globalThis.sessionStorage?.setItem(U4e,"1")},[]),{error:l,restart:u}=zx("webserver",t,s);return eqr(r),(0,u3.useEffect)(()=>{l&&n(l)},[l,n]),(0,u3.useEffect)(()=>{!i||a.current||(a.current=!0,u())},[i,u]),{armUpdateReload:(0,u3.useCallback)(()=>{a.current=!1,o()},[o])}}function rqr(e){let{armUpdateReload:t}=tqr(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=d1(e.selectSession),n=(0,W4e.useMemo)(()=>({launchAssist:e.createAssistSession,launchAgentInStream:e.createSessionInStream,resumeSession:e.resumeSession,armUpdateReload:t,activateSession:r,sendInput:e.sendInput}),[e.createAssistSession,e.createSessionInStream,e.resumeSession,t,r,e.sendInput]),o=an(),i=(0,W4e.useCallback)(a=>{e.selectSession(a),o("/sessions"),e.clearSuccess()},[o,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:i}}var nqr=T(ee(),1);function oqr(e,t,r,n){let o=z4e(e,t,r);(0,nqr.useEffect)(()=>{e&&o&&n({type:"set-active",cwd:o,sessionId:e})},[e,o,n])}var V4e=T(ee(),1);function iqr(e,t){let r=(0,V4e.useRef)(new Map);(0,V4e.useEffect)(()=>{let n=new Set;for(let{id:o,status:i}of e)n.add(o),r.current.get(o)!==i&&(r.current.set(o,i),console.debug(`[sessions] render session ${o} status=${i}`),t({type:"ui-status",sessionId:o,status:i}));for(let o of r.current.keys())n.has(o)||r.current.delete(o)},[e,t])}var hG=T(ee(),1),aqr="assist.sessions.node";function eDo(){try{return localStorage.getItem(aqr)}catch{return null}}function tDo(e){try{localStorage.setItem(aqr,e)}catch{}}function sqr(e){let[t,r]=(0,hG.useState)(eDo),n=(0,hG.useCallback)(o=>{r(o),tDo(o)},[]);return(0,hG.useMemo)(()=>{let o=e?[e.local,...e.links.map(i=>i.name)]:[];return{nodes:e,names:o,visible:o.length>1,selected:t&&o.includes(t)?t:e?.local,select:n}},[e,t,n])}var cqr=T(ee(),1);function lqr(e){let t=e;if(t.type==="create")return{cwd:t.cwd,title:t.prompt?.trim()||(t.design?"New design session":"New session"),node:t.node};if(t.type==="create-assist"){let r=t.title?.trim();return{cwd:t.cwd,title:r||"New session",named:!!r,node:t.node}}return null}function uqr(e,t){return(0,cqr.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let o=lqr(r);o&&t(o)},[e,t])}var D0=T(ee(),1);function G4e(e,t,r,n,o){e({type:"create",prompt:r||void 0,cwd:n,...t,...o?{node:o}:{}})}function dqr(e){return(t,r,n)=>G4e(e,{design:!0},t,r,n)}function fqr(e){return(t,r,n,o)=>G4e(e,{harness:t},r,n,o)}function pqr(e){return(t,r,n)=>G4e(e,{auto:!0},t,r,n)}function hqr(e){return(t,r,n,o,i)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:o,node:i})}function mqr(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function gqr(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function yqr(e,t){return(r,n)=>{e({type:"dismiss",sessionId:r,...n}),t.delete(r)}}function vqr(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function bqr(e){return t=>e({type:"stop",sessionId:t})}function xqr(e){return(t,r,n)=>e({type:"transfer",sessionId:t,target:r,cwd:n})}function Sqr(e){return t=>e({type:"cancel-transfer",sessionId:t})}function Tqr(e){return(t,r,n,o,i)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:o,node:i})}function wqr(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function Cqr(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function kqr(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function _qr(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:WI})}function Eqr(e){return(t,r,n,o)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:WI,claim:o==="claim",refresh:o==="refresh"})}function Rqr(e){return(t,r,n,o)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...o})}var SD=T(ee(),1);function Pqr(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function Aqr(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function Lqr(e){return{createSession:(0,SD.useMemo)(()=>pqr(e),[e]),createSessionInStream:(0,SD.useMemo)(()=>Pqr(e),[e]),createDesignSession:(0,SD.useMemo)(()=>dqr(e),[e]),createHarnessSession:(0,SD.useMemo)(()=>fqr(e),[e]),createAssistSession:(0,SD.useMemo)(()=>Aqr(e),[e]),resumeSession:(0,SD.useMemo)(()=>hqr(e),[e])}}var Toe=T(ee(),1);function Iqr(e,t){let r=(0,Toe.useCallback)((a,s)=>{mqr(e,t.current)(a,s)},[e,t]),n=(0,Toe.useCallback)(a=>{gqr(e,t.current)(a)},[e,t]),o=(0,Toe.useCallback)((a,s)=>{yqr(e,t.current)(a,s)},[e,t]),i=(0,Toe.useCallback)(a=>{vqr(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:o,discardSession:i}}function Dqr(e,t,r){return(n,o)=>{let i=t.get(n);return i&&(o(i),e({type:"snapshot",sessionId:n})),r.set(n,o),()=>r.delete(n)}}function Mqr(e,t,r){let n={...Lqr(e),sendInput:(0,D0.useMemo)(()=>_qr(e),[e]),sendResize:(0,D0.useMemo)(()=>Eqr(e),[e]),sendPrDecision:(0,D0.useMemo)(()=>Rqr(e),[e]),setAutoApprove:(0,D0.useMemo)(()=>wqr(e),[e]),setAutoAdvance:(0,D0.useMemo)(()=>Cqr(e),[e]),setStarred:(0,D0.useMemo)(()=>kqr(e),[e]),stopSession:(0,D0.useMemo)(()=>bqr(e),[e]),startRun:(0,D0.useMemo)(()=>Tqr(e),[e]),transferSession:(0,D0.useMemo)(()=>xqr(e),[e]),cancelTransfer:(0,D0.useMemo)(()=>Sqr(e),[e])},o=(0,D0.useMemo)(()=>Dqr(e,t.current,r.current),[e,t,r]);return{...n,...Iqr(e,t),onOutput:o}}var woe=T(ee(),1);function Nqr(e,t,r){let n=(0,woe.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),o=(0,woe.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),i=(0,woe.useCallback)(()=>{r(null)},[r]),a=(0,woe.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:o,clearTranscript:i,selectSession:a}}var X4e=T(ee(),1);function Oqr(e,t){let r=new Set(t.map(o=>o.id)),n=null;for(let o of Object.values(e))r.has(o)&&(n=o);return n}var mG=T(ee(),1);function Bqr(){let[e,t]=(0,mG.useState)(null),r=(0,mG.useRef)(e);r.current=e;let n=(0,mG.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var q4e=T(ee(),1);function $qr(e,t,r){let n=t.find(d=>d.id===r),o=n&&Q2(n);if(!o)return null;let i=t.filter(d=>Q2(d)===o),a=i.findIndex(d=>d.id===r),s=new Set(e.map(d=>d.id)),l=i.slice(a+1).find(d=>s.has(d.id)),u=i.slice(0,a).reverse().find(d=>s.has(d.id));return(l??u)?.id??null}function Fqr(e,t,r=null,n=[]){return t!==null?e.some(o=>o.id===t)?t:$qr(e,n,t)??e[0]?.id??null:r&&e.some(o=>o.id===r)?r:e[0]?.id??null}function zqr(e,t,r){let n=B4e(),o=(0,q4e.useRef)([]);(0,q4e.useEffect)(()=>{let i=o.current;if(o.current=e,n){t(null);return}t(a=>Fqr(e,a,r,i))},[e,t,r,n])}var j4e=T(ee(),1);function Hqr(){let[e,t]=(0,j4e.useState)({}),[r,n]=(0,j4e.useState)(null),[o,i]=(0,j4e.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:o,setNodes:i}}var wv=T(ee(),1);function Uqr(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function Wqr(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function Vqr(e,t){if(!t.some(n=>e.has(n)))return e;let r=new Set(e);for(let n of t)r.delete(n);return r}function Gqr(e,t){let r=[];for(let n of t){let o=e.get(n.id);o!==void 0&&o!==n.startedAt&&r.push(n.id)}return r}function qqr(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var rDo=1500;function jqr(){let[e,t]=(0,wv.useState)(new Set),r=(0,wv.useRef)(new Map),n=(0,wv.useRef)(new Map),o=(0,wv.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),i=(0,wv.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),o(u)},rDo))},[o]);(0,wv.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,wv.useCallback)(s=>{let l=Wqr(r.current,s),u=[...Gqr(r.current,s),...l],d=qqr(r.current,s);r.current=new Map(s.map(f=>[f.id,f.startedAt])),Uqr(n.current,l),u.length&&t(f=>Vqr(f,u)),i(d)},[i]);return{initialized:e,markInitialized:o,syncSessions:a}}var d3=T(ee(),1);function Yqr(){let[e,t]=(0,d3.useState)(null),[r,n]=(0,d3.useState)(null),[o,i]=(0,d3.useState)(null),a=(0,d3.useCallback)(()=>t(null),[]),s=(0,d3.useCallback)(()=>n(null),[]),l=(0,d3.useCallback)(()=>i(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:o,setServerConflict:i,clearServerConflict:l}}var Ux=T(ee(),1);function Kqr(e,t){return[...e,{...t,status:"launching"}]}function Y4e(e){return e.find(t=>t.status==="launching")}function Xqr(e){let t=Y4e(e);return t?e.filter(r=>r.id!==t.id):e}function Zqr(e,t){let r=Y4e(e);return r?nlt(e,r.id,t):e}function nlt(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function Qqr(e,t){return e.filter(r=>r.id!==t)}var Jqr=T(ee(),1);var nDo=6e4,oDo="Launch timed out \u2014 the session did not start.";function ejr(e,t){(0,Jqr.useEffect)(()=>{let r=e.filter(o=>o.status==="launching");if(r.length===0)return;let n=r.map(o=>setTimeout(()=>t(i=>nlt(i,o.id,oDo)),Math.max(0,nDo-(Date.now()-o.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function tjr(){let[e,t]=(0,Ux.useState)([]),r=(0,Ux.useRef)([]),n=(0,Ux.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),o=(0,Ux.useCallback)(l=>{n(u=>Kqr(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),i=(0,Ux.useCallback)(()=>{let l=Y4e(r.current);return n(Xqr),l?.named?l.title:void 0},[n]),a=(0,Ux.useCallback)(l=>n(u=>Zqr(u,l)),[n]),s=(0,Ux.useCallback)(l=>n(u=>Qqr(u,l)),[n]);return ejr(e,n),{pendingLaunches:e,addPendingLaunch:o,resolvePendingLaunch:i,failPendingLaunch:a,dismissPendingLaunch:s}}var Coe=T(ee(),1);function rjr(){let[e,t]=(0,Coe.useState)(null),[r,n]=(0,Coe.useState)({}),o=(0,Coe.useCallback)((i,a)=>{i!=="claude"&&n(s=>({...s,[i]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:o}}var njr=T(ee(),1);function ojr(e,t){return(0,njr.useCallback)(r=>{e(r),t(r)},[e,t])}var olt=T(ee(),1);function ijr(){let e=(0,olt.useRef)(new Map),t=(0,olt.useRef)(new Map);return{buffers:e,handlers:t}}var K4e=T(ee(),1);function ajr(){let[e,t]=(0,K4e.useState)(null),[r,n]=(0,K4e.useState)(null),[o,i]=(0,K4e.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:o,setUserMessages:i}}var f3=T(ee(),1);function sjr(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function ljr(e,t){let r=e.sessionId,n=t.resolvePendingLaunch();e.isNew&&t.getActiveId()!==null||(t.setViewingTranscriptSessionId(null),t.setActiveId(r)),e.isNew&&t.setSuccess({message:n?`Started ${n}`:"New session started",sessionId:r})}function cjr(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function ujr(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function djr(e,t){t.setNodes({local:e.local,links:e.links??[]})}function fjr(e,t){t.setSuccess({message:e.message,sessionId:null})}function pjr(e,t){let r=e.sessionId,n=t.buffers.current?.get(r)??"";t.buffers.current?.set(r,n+e.data),t.handlers.current?.get(r)?.(e.data),t.markInitialized(r)}function hjr(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function mjr(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function gjr(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var iDo={sessions:mjr,created:ljr,history:(e,t)=>t.setHistory(e.sessions),transcript:(e,t)=>t.setTranscript({sessionId:e.sessionId,messages:e.messages}),"user-messages":(e,t)=>t.setUserMessages({sessionId:e.sessionId,messages:e.messages}),hello:(e,t)=>t.setDaemonVersion(e.version),nodes:djr,error:cjr,notice:fjr,inbox:()=>{js.refresh(),js.refreshStatus()},"inbox-activity":()=>{js.refreshStatus()},"run-conflict":hjr,limits:ujr,clear:sjr,output:pjr,snapshot:gjr};function yjr(e,t){iDo[e.type]?.(e,t)}function vjr(e,t={}){let r=new WebSocket(S2t("/ws"));return r.onopen=()=>{t.onOpen?.(),r.send(JSON.stringify({type:"hello"})),r.send(JSON.stringify({type:"history"}))},r.onmessage=n=>{yjr(JSON.parse(n.data),e)},r.onclose=()=>t.onClose?.(),r}function bjr(e,t,r,n){let o=!1,i,a=0,s=!1,l=()=>{o||t(vjr(e,{onOpen:()=>{s&&r(),s=!1,n(!1),a=0},onClose:()=>{if(o)return;s=!0,n(!0);let u=Math.min(300*2**a,2e3);a+=1,i=setTimeout(l,u)}}))};return l(),()=>{o=!0,i&&clearTimeout(i)}}function xjr(e){let t=(0,f3.useRef)(null),[r,n]=(0,f3.useState)(!1),{handleSessions:o,markInitialized:i,buffers:a,handlers:s}=e;(0,f3.useEffect)(()=>{let u=()=>{a.current?.clear();let f=s.current;if(f)for(let p of f.values())p("\x1Bc")},d=bjr({...e,setSessions:o},f=>{t.current=f},u,n);return()=>{d(),t.current?.close()}},[o,i,a,s]);let l=(0,f3.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function Sjr(){let[e,t]=(0,X4e.useState)([]),[r,n]=(0,X4e.useState)([]),{activeId:o,setActiveId:i,getActiveId:a}=Bqr(),s=Hqr(),l=ajr(),[u,d]=(0,X4e.useState)(""),f=Yqr(),p=tjr(),h=rjr(),{initialized:m,markInitialized:g,syncSessions:y}=jqr(),v=ijr(),b=ojr(y,t),{wsRef:x,requestHistory:w,reconnecting:C}=xjr({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:i,...s,...l,setCurrentCwd:d,...f,...p,...h,markInitialized:g,...v});return zqr(e,i,Oqr(s.activeByRepo,e)),{sessions:e,history:r,activeId:o,setActiveId:i,...s,...l,currentCwd:u,...f,...p,...h,initialized:m,wsRef:x,...v,requestHistory:w,reconnecting:C}}function Z4e(){let e=Sjr(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:o,activeId:i,sessions:a}=e,s=sqr(e.nodes),l=uqr(t,o),u=Mqr(l,r,n);oqr(i,a,e.history,l),iqr(a,l);let d=Nqr(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...d,nodeSelection:s}}var gG=T(ee(),1);var Tjr="assist:sidebar-collapsed";function wjr(){let[e,t]=(0,gG.useState)(()=>Cs(Tjr).length>0),r=(0,gG.useCallback)(()=>{t(n=>{let o=!n;return ql(Tjr,o?[!0]:[]),o})},[]);return(0,gG.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var Cjr=T(ee(),1);function kjr(){(0,Cjr.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await er("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||oP.set(r)}catch(t){Pr(t,"hotkey bindings")}})(),()=>{e=!0}},[])}function _jr(){let e=Z4e(),t=sSe(e),r=QGr(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);WGr({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:o}=rqr(e);kjr();let i=wjr();return HGr("shell",{...e,selection:r,launch:n,sidebarCollapse:i}),{socket:e,selection:r,launch:n,viewLaunchedSession:o,sidebarCollapse:i}}var Mm=T(R(),1),aDo={zIndex:e=>e.zIndex.drawer+1},sDo={minHeight:48};function Rjr({mode:e,toggle:t}){let r=_jr(),{socket:n,selection:o,viewLaunchedSession:i}=r,{nodes:a,transferSession:s,cancelTransfer:l}=n,u=(0,Ejr.useMemo)(()=>({nodes:a,transfer:s,cancel:l}),[a,s,l]);return(0,Mm.jsx)(qWr,{shell:r,children:(0,Mm.jsxs)(Ust.Provider,{value:n.daemonVersion,children:[(0,Mm.jsx)(NGr,{mode:e,toggle:t,sessions:n.sessions,reconnecting:n.reconnecting}),(0,Mm.jsx)(xRe,{position:"fixed",sx:aDo,"data-testid":"toolbar",children:(0,Mm.jsx)(LVr,{socket:n,selection:o})}),(0,Mm.jsx)(CR,{variant:"dense",sx:sDo}),(0,Mm.jsx)(ZLe.Provider,{value:u,children:(0,Mm.jsx)(FGr,{socket:n,children:(0,Mm.jsx)(RHr,{socket:n})})}),(0,Mm.jsx)(bUr,{socket:n}),(0,Mm.jsx)(WWr,{socket:n,onViewLaunchedSession:i})]})})}function Ljr(e){return e instanceof Error?e.message:String(e)}function lDo(e){return e.filename?` (${e.filename}:${e.lineno}:${e.colno})`:""}function Pjr(e){UY(e.error)||(QR(e.error),WY("error",`${e.message||Ljr(e.error)}${lDo(e)}`))}function Ajr(e){UY(e.reason)||(QR(e.reason),WY("rejection",Ljr(e.reason)))}function Ijr(){return globalThis.addEventListener("error",Pjr),globalThis.addEventListener("unhandledrejection",Ajr),()=>{globalThis.removeEventListener("error",Pjr),globalThis.removeEventListener("unhandledrejection",Ajr)}}var Djr=T(ee(),1);function Mjr(){let[e,t]=(0,Djr.useState)(()=>{try{return localStorage.getItem("theme-mode")??"dark"}catch{return"dark"}});return{mode:e,toggle:()=>t(n=>{let o=n==="dark"?"light":"dark";try{localStorage.setItem("theme-mode",o)}catch{}return o})}}function Njr({color:e,radius:t}){return{MuiMenu:{styleOverrides:{paper:{borderRadius:t.md},list:{padding:4}}},MuiMenuItem:{styleOverrides:{root:{minHeight:30,padding:"5px 10px",borderRadius:4,fontSize:13,"&:hover":{backgroundColor:e.raised},"& .MuiListItemIcon-root":{minWidth:28},"& .MuiSvgIcon-root":{fontSize:16},"& .MuiListItemText-primary":{fontSize:13}}}}}}function Ojr(e){let{color:t,radius:r,elevation:n,type:o}=e,i={border:`1px solid ${t.line}`};return{...Njr(e),MuiTooltip:{styleOverrides:{tooltip:{...i,backgroundColor:t.overlay.background,color:t.overlay.text,borderRadius:r.md,boxShadow:n.overlay,fontSize:`${o.scale.caption/16}rem`,padding:"6px 10px"},arrow:{color:t.overlay.background}}},MuiPopover:{styleOverrides:{paper:{...i,boxShadow:n.overlay}}},MuiBackdrop:{styleOverrides:{root:{"&:not(.MuiBackdrop-invisible)":{backgroundColor:t.scrim,backdropFilter:"blur(2px)"}}}},MuiDialog:{styleOverrides:{paper:{...i,backgroundColor:t.surface,borderRadius:r.md+4,boxShadow:n.dialog}}}}}var Bjr=({variant:e})=>e==="outlined"||e==="tonal",$jr=[{props:{size:"small"},style:{minHeight:26,padding:"4px 9px",fontSize:12}},{props:Bjr,style:{padding:"5px 11px"}},{props:e=>Bjr(e)&&e.size==="small",style:{padding:"3px 8px"}}];var Q4e=["primary","secondary","success","warning","error","info","check"];function koe(e,t){return{backgroundColor:Ur(e,t),borderColor:Ur(e,.35),color:e}}function Fjr({color:e}){return[{props:{variant:"tonal"},style:{backgroundColor:e.raised,border:`1px solid ${e.line}`,color:e.text.primary,"&:hover":{backgroundColor:e.raised,borderColor:e.text.disabled}}},...Q4e.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...koe(e[t].main,.16),"&:hover":koe(e[t].main,.24)}}))]}var zjr={"& > *:nth-of-type(1)":{fontSize:16}};function Hjr(e){let{color:t,radius:r,density:n}=e,{minHeight:o,fontSize:i,paddingX:a}=n.button;return{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:o,padding:`6px ${a}px`,borderRadius:r.sm,fontSize:i,fontWeight:600,lineHeight:"18px"},startIcon:{marginLeft:-2,marginRight:6,...zjr},endIcon:{marginLeft:6,marginRight:-2,...zjr}},variants:[...$jr,{props:{variant:"text",color:"primary"},style:{color:t.text.secondary,"&:hover":{backgroundColor:t.raised,color:t.text.primary}}},...Fjr(e),{props:{variant:"outlined",color:"error"},style:{borderColor:Ur(t.error.main,.35),"&:hover":{borderColor:t.error.main,backgroundColor:Ur(t.error.main,.1)}}}]}}}function ilt({color:e},t){return[{props:{variant:t,color:"default"},style:{backgroundColor:"transparent",border:`1px solid ${e.line}`,color:e.text.secondary,"&.MuiChip-clickable:hover":{backgroundColor:e.raised}}},...Q4e.map(r=>({props:{variant:t,color:r},style:{...koe(e[r].main,.14),borderColor:"transparent","& .MuiChip-deleteIcon":{color:Ur(e[r].main,.7),"&:hover, &:active":{color:e[r].main}},"&.MuiChip-clickable:hover":{backgroundColor:Ur(e[r].main,.22)}}}))]}function Ujr(e){return{MuiChip:{styleOverrides:{root:{height:20,fontSize:11,fontWeight:600,borderRadius:999},sizeSmall:{height:20,"& .MuiChip-label":{padding:"0 7px"}},label:{padding:"0 8px"},icon:{fontSize:14,marginLeft:6,marginRight:-2},deleteIcon:{fontSize:14,marginLeft:-2,marginRight:4},outlined:{borderColor:e.color.line}},variants:[...ilt(e,"tonal"),...ilt(e,"filled")]}}}function Wjr(e){return{...Hjr(e),MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},...Ujr(e)}}var alt=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`,cDo={".MuiAppBar-root &":{color:"inherit","&:hover":{backgroundColor:alt(8)},"&.Mui-selected":{color:"inherit",backgroundColor:alt(12),boxShadow:`inset 0 0 0 1px ${alt(18)}`}}};function Vjr({color:e,radius:t}){return{MuiTabs:{styleOverrides:{root:{minHeight:40,alignItems:"center"},list:{gap:2},indicator:{display:"none"}}},MuiTab:{styleOverrides:{root:{minHeight:30,padding:"6px 10px",borderRadius:t.sm,textTransform:"none",fontSize:13,fontWeight:500,opacity:1,color:e.text.secondary,"&:hover":{backgroundColor:e.raised,color:e.text.primary},"&.Mui-selected":{color:e.text.primary,backgroundColor:e.raised,boxShadow:`inset 0 0 0 1px ${e.line}`},...!e.appBar&&cDo}}}}}var Gjr=(e,t)=>({width:e,height:e,"& .MuiSvgIcon-root":{fontSize:t}});function qjr({color:e,radius:t,density:r}){let{side:n,icon:o,smallSide:i,smallIcon:a}=r.iconButton;return{MuiIconButton:{styleOverrides:{root:{...Gjr(n,o),padding:0,borderRadius:t.sm,"&:hover":{backgroundColor:e.raised}}},variants:[{props:{size:"small"},style:Gjr(i,a)},{props:{color:"default"},style:{color:e.text.secondary,"&:hover":{color:e.text.primary},...!e.appBar&&{".MuiAppBar-root &, .MuiAppBar-root &:hover":{color:"inherit"}}}}]}}}function jjr({color:e,radius:t}){return{MuiToggleButtonGroup:{styleOverrides:{root:{padding:2,gap:2,border:`1px solid ${e.line}`,borderRadius:t.sm,backgroundColor:e.background},grouped:{margin:0,border:0,borderRadius:4}}},MuiToggleButton:{styleOverrides:{root:{padding:"3px 8px",border:0,borderRadius:4,fontSize:13,fontWeight:500,lineHeight:"18px",textTransform:"none",color:e.text.secondary,"& .MuiSvgIcon-root":{fontSize:16},"&:hover":{backgroundColor:"transparent",color:e.text.primary},"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:e.raised,color:e.text.primary}}}}}}var J4e=".MuiOutlinedInput-notchedOutline";function Yjr({color:e,radius:t,density:r}){let n=r.inputFontSize;return{MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:e.background,borderRadius:t.sm,fontSize:n,color:e.text.primary,[`& ${J4e}`]:{borderColor:e.line},[`&:hover ${J4e}`]:{borderColor:e.text.disabled},[`&.Mui-focused ${J4e}`]:{borderColor:e.primary.main,borderWidth:1},[`&.Mui-error ${J4e}`]:{borderColor:e.error.main}}}},MuiInputLabel:{styleOverrides:{root:{fontSize:n,color:e.text.secondary,"&.Mui-focused":{color:e.primary.main}}}},MuiSelect:{styleOverrides:{icon:{color:e.text.disabled}}}}}function Kjr({color:e,density:t}){let{width:r,height:n,thumb:o}=t.switch;return{MuiSwitch:{styleOverrides:{root:{width:r,height:n,padding:0,"& .MuiSwitch-switchBase":{padding:2,color:e.text.secondary,"&.Mui-checked":{transform:`translateX(${r-n}px)`,color:e.primary.contrastText},"&.Mui-checked + .MuiSwitch-track":{backgroundColor:e.primary.main,opacity:1}},"& .MuiSwitch-thumb":{width:o,height:o,boxShadow:"none"},"& .MuiSwitch-track":{borderRadius:n/2,backgroundColor:e.line,opacity:1}}}},MuiFormControlLabel:{styleOverrides:{root:{"&:has(.MuiSwitch-root)":{marginLeft:0,gap:8}}}}}}function Xjr(e){let{appBar:t}=e.color;return{...Ojr(e),...Wjr(e),...qjr(e),...jjr(e),...Yjr(e),...Kjr(e),...Vjr(e),MuiPaper:{styleOverrides:{root:{backgroundImage:"none"},outlined:{borderColor:e.color.line}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar},styleOverrides:{root:t&&{backgroundColor:t.background,color:t.text,borderBottom:`1px solid ${e.color.line}`}}}}}var Cv="#0e1116",slt="#141820",e5e="#1b202a",t5e="#e3e7ee",llt="#8a93a3",_oe="#8b9cff",r5e="#5fd0a0",n5e="#f2b45a",o5e="#f27a7a",Zjr="#6cc8d8",Qjr={secondary:"rgba(255, 255, 255, 0.7)",hover:"rgba(255, 255, 255, 0.12)",active:"rgba(255, 255, 255, 0.16)",dot:"#ffb74d",dotRing:"rgba(0, 0, 0, 0.15)"},i5e={dark:{color:{background:Cv,surface:slt,raised:e5e,line:"#262c37",lineSoft:"#1d222b",text:{primary:t5e,secondary:llt,disabled:"#5c6473"},selected:"rgba(139, 156, 255, 0.14)",wash:{warning:"rgba(242, 180, 90, 0.09)",error:"rgba(242, 122, 122, 0.09)",accent:"rgba(139, 156, 255, 0.1)",check:"rgba(108, 200, 216, 0.09)"},well:Cv,stripe:e5e,codeWash:"rgba(255, 255, 255, 0.08)",overlay:{background:e5e,text:t5e},scrim:"rgba(0, 0, 0, 0.5)",appBar:{background:slt,text:t5e},onAppBar:{...Qjr,secondary:llt,level:{ok:r5e,warn:n5e,over:o5e}},statusBar:{background:slt,text:llt,hoverText:t5e,secondary:"#5c6473",hover:e5e,active:"transparent",dot:_oe,dotRing:"rgba(139, 156, 255, 0.14)",readyText:_oe,level:{ok:r5e,warn:n5e,over:o5e}},primary:{main:_oe,contrastText:Cv},secondary:{main:"#c99bff",contrastText:Cv},success:{main:r5e,contrastText:Cv},warning:{main:n5e,contrastText:Cv},error:{main:o5e,contrastText:Cv},info:{main:"#6cb6ff",contrastText:Cv},check:{main:Zjr,contrastText:Cv}},terminal:{background:Cv,foreground:"#d6dbe4",cursor:_oe,cursorAccent:Cv,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:o5e,green:r5e,yellow:n5e,blue:_oe,magenta:"#c99bff",cyan:Zjr,white:"#c3c9d4",brightBlack:"#5c6473",brightRed:"#ff9a9a",brightGreen:"#82e0b6",brightYellow:"#ffc97a",brightBlue:"#a9b6ff",brightMagenta:"#dcb8ff",brightCyan:"#8fdbe8",brightWhite:"#eef1f6"},elevation:{appBar:0,overlay:"0 14px 34px rgba(0, 0, 0, 0.45)",dialog:"0 30px 60px rgba(0, 0, 0, 0.5)",stuckHeader:"0 8px 8px -9px rgba(0, 0, 0, 0.8)"}},light:{color:{background:"#fff",surface:"#fff",raised:"rgba(0, 0, 0, 0.04)",line:"rgba(0, 0, 0, 0.12)",lineSoft:"rgba(0, 0, 0, 0.12)",text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},selected:"rgba(0, 0, 0, 0.08)",wash:{warning:"rgba(255, 167, 38, 0.09)",error:"rgba(244, 67, 54, 0.09)",accent:"rgba(25, 118, 210, 0.08)",check:"rgba(0, 131, 143, 0.08)"},well:"#f3f4f6",stripe:"rgba(0, 0, 0, 0.1)",codeWash:"rgba(0, 0, 0, 0.06)",overlay:{background:"rgba(97, 97, 97, 0.92)",text:"#fff"},onAppBar:{...Qjr,level:{ok:"#b9f6ca",warn:"#ffe57f",over:"#ffcdd2"}},primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0",contrastText:"#fff"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2",contrastText:"#fff"},success:{main:"#2e7d32",light:"#4caf50",dark:"#1b5e20",contrastText:"#fff"},warning:{main:"#ed6c02",light:"#ff9800",dark:"#e65100",contrastText:"#fff"},error:{main:"#d32f2f",light:"#ef5350",dark:"#c62828",contrastText:"#fff"},info:{main:"#0288d1",light:"#03a9f4",dark:"#01579b",contrastText:"#fff"},check:{main:"#00838f",light:"#4fb3bf",dark:"#005662",contrastText:"#fff"},scrim:"rgba(15, 23, 42, 0.32)",statusBar:{background:"#f3f4f6",text:"rgba(0, 0, 0, 0.6)",hoverText:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.38)",hover:"rgba(0, 0, 0, 0.06)",active:"transparent",dot:"#1976d2",dotRing:"rgba(25, 118, 210, 0.16)",readyText:"#1976d2",level:{ok:"#2e7d32",warn:"#ed6c02",over:"#d32f2f"}}},terminal:{background:"#ffffff",foreground:"#333333",cursor:"#333333",cursorAccent:"#ffffff",selectionBackground:"#add6ff",black:"#000000",red:"#cd3131",green:"#107c10",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#14ce14",brightYellow:"#b5ba00",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#a5a5a5"},elevation:{appBar:0,overlay:"0 8px 24px rgba(15, 23, 42, 0.12)",dialog:"0 24px 48px rgba(15, 23, 42, 0.18)",stuckHeader:"0 6px 6px -7px rgba(0, 0, 0, 0.2)"}},font:{ui:'"Geist Variable", "Segoe UI", system-ui, sans-serif',mono:'"Geist Mono Variable", ui-monospace, Menlo, Consolas, monospace',terminal:'"Geist Mono Variable", ui-monospace, Menlo, Consolas, monospace'},type:{fontSize:14,terminalFontSize:13,scale:{caption:12,body2:14,body1:15,subtitle2:14,subtitle1:15,h6:16,h5:18,h4:24,button:14},button:{textTransform:"none",fontWeight:600}},radius:{sm:6,md:8},selection:{ringWidth:2,titleWeight:500},spacing:8,densities:{desktop:{target:30,bar:40,iconButton:{side:30,icon:18,smallSide:26,smallIcon:16},button:{minHeight:30,fontSize:13,paddingX:12},switch:{width:34,height:20,thumb:16},inputFontSize:13,filterSelectMinWidth:160,tabBar:{height:44,icon:20,label:10,badge:16,insetTrim:0}},touch:{target:48,bar:60,iconButton:{side:48,icon:30,smallSide:40,smallIcon:24},button:{minHeight:48,fontSize:17,paddingX:20},switch:{width:51,height:31,thumb:27},inputFontSize:16,filterSelectMinWidth:200,tabBar:{height:49,icon:26,label:11,badge:18,insetTrim:12}}}};var aC=e=>`${e/16}rem`;function Jjr({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:aC(r.button)},caption:{fontSize:aC(r.caption)},body2:{fontSize:aC(r.body2)},body1:{fontSize:aC(r.body1)},subtitle2:{fontSize:aC(r.subtitle2)},subtitle1:{fontSize:aC(r.subtitle1)},h6:{fontSize:aC(r.h6)},h5:{fontSize:aC(r.h5)},h4:{fontSize:aC(r.h4)}}}function eYr(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}function uDo(e,t){let{dark:r,light:n,densities:o,...i}=i5e;return{...i,...e==="dark"?r:n,mode:e,density:o[t]}}function tYr(e,t="desktop"){let r=uDo(e,t),{color:n}=r;return Hv({tokens:r,palette:{mode:e,background:{default:n.background,paper:n.surface},primary:n.primary,secondary:n.secondary,success:n.success,warning:n.warning,error:n.error,info:n.info,check:n.check,text:n.text,divider:n.line,action:{hover:n.raised,selected:n.selected}},typography:Jjr(r),shape:{borderRadius:r.radius.sm},spacing:r.spacing,components:{...eYr(r),...Xjr(r)}})}function rYr(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=i5e;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var bKr=T(ee(),1);var p3=T(R(),1);function nYr({status:e,onClose:t}){return(0,p3.jsxs)(p3.Fragment,{children:[(0,p3.jsx)(Ou,{open:e.kind==="probing",children:(0,p3.jsx)(no,{severity:"info",variant:"filled",children:e.kind==="probing"?`Connecting to ${e.name}\u2026`:""})}),(0,p3.jsx)(_l,{error:e.kind==="error"?e.message:null,onClose:t})]})}var s5e=T(ee(),1);var dDo=/^\d+(\.\d+){3}$/;function TD(e){try{let{hostname:t}=new URL(e);return dDo.test(t)?t:t.split(".")[0]}catch{return""}}var fDo=/^[a-z]+:[/]{2}/i;function a5e(e){let t=e.trim(),r=fDo.test(t)?t:`https://${t}`;try{let n=new URL(r);return n.protocol!=="https:"&&n.protocol!=="http:"?void 0:n.origin}catch{return}}function pDo(e){try{return new URL(e)}catch{return}}function hDo(e){return e.protocol==="assist:"&&e.hostname==="add-node"&&(e.pathname===""||e.pathname==="/")}function oYr(e){let t=pDo(e);if(!t||!hDo(t))return{ok:!1,error:`Not an assist add-node link: ${e}`};let r=t.searchParams.get("url"),n=r?a5e(r):void 0;return n?{ok:!0,node:{name:t.searchParams.get("name")?.trim()||TD(n),url:n}}:{ok:!1,error:`The link has no valid node URL: ${r??"(missing)"}`}}var iYr=5e3,aYr="/api/health";async function mDo(e){let t=new AbortController,r=setTimeout(()=>t.abort(),iYr);try{let n=await fetch(`${e}${aYr}`,{signal:t.signal,cache:"no-store"});return n.ok?{ok:!0,health:await n.json()}:{ok:!1,error:`HTTP ${n.status}`,status:n.status}}catch(n){return t.signal.aborted?{ok:!1,error:`timed out after ${iYr/1e3}s`}:{ok:!1,error:n instanceof Error?n.message:String(n)}}finally{clearTimeout(r)}}async function h3(e){let t=Date.now(),r=await mDo(e);return r.ok||T8({at:new Date(t).toISOString(),method:"GET",path:aYr,base:e,status:r.status,error:r.status===void 0?r.error:void 0,durationMs:Date.now()-t}),r}async function sYr(e,t){let r=oYr(e);if(!r.ok)return r;let{node:n}=r;t(n);let o=await h3(n.url);return o.ok?{ok:!0,node:n,health:o.health}:{ok:!1,error:`Can't reach ${n.name} at ${n.url}: ${o.error}`}}wD();var plt=lC("App",{web:()=>Promise.resolve().then(()=>(pYr(),fYr)).then(e=>new e.AppWeb)});var vG=T(ee(),1);var wDo=5e3;function hYr(e){let t=(0,vG.useRef)(e),r=(0,vG.useRef)(void 0);(0,vG.useEffect)(()=>{t.current=e},[e]),(0,vG.useEffect)(()=>{let n=i=>{let a=Date.now(),s=r.current?.url===i&&a-r.current.at<wDo;r.current={url:i,at:a},s||t.current(i)},o=plt.addListener("appUrlOpen",({url:i})=>n(i));return plt.getLaunchUrl().then(i=>{i?.url&&n(i.url)}).catch(i=>Pr(i,"launch url")),()=>{o.then(i=>i.remove())}},[])}function mYr(e){let[t,r]=(0,s5e.useState)({kind:"idle"});hYr(async o=>{let i=await sYr(o,a=>r({kind:"probing",name:a.name}));if(!i.ok){r({kind:"error",message:i.error});return}e(i.node,i.health),r({kind:"idle"})});let n=(0,s5e.useCallback)(()=>r({kind:"idle"}),[]);return{status:t,dismiss:n}}var Poe=T(R(),1);function gYr({name:e}){return(0,Poe.jsxs)(V,{sx:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,bgcolor:"background.default"},children:[(0,Poe.jsx)(Ao,{size:28}),(0,Poe.jsxs)(Te,{variant:"body2",color:"text.secondary",children:["Connecting to ",e??"home node","\u2026"]})]})}var l5e=T(ee(),1),hlt=(0,l5e.createContext)(null);function m3(){return(0,l5e.useContext)(hlt)}var ya={top:"env(safe-area-inset-top, 0px)",bottom:"env(safe-area-inset-bottom, 0px)"};var vYr=T(R(),1);function yYr({value:e,error:t,onChange:r}){return(0,vYr.jsx)(Fn,{autoFocus:!0,label:"Web server URL",placeholder:"https://mac.tail1234.ts.net:3100",value:e,onChange:n=>r(n.target.value),error:!!t,helperText:t??"The address where you open the sessions page in a browser.",slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off",inputMode:"url"}}})}var Aoe=T(ee(),1);function bYr(e,t){let[r,n]=(0,Aoe.useState)(e?.url??""),[o,i]=(0,Aoe.useState)(e?.name),[a,s]=(0,Aoe.useState)(),[l,u]=(0,Aoe.useState)(!1),d=a5e(r),f=o??(d?TD(d):"");return{url:r,changeUrl:m=>{n(m),s(void 0)},name:f,setName:i,error:a,busy:l,submit:async m=>{if(m.preventDefault(),!d){s("Enter an http(s) URL, e.g. https://mac.tail1234.ts.net:3100");return}u(!0);let g=await t({name:f.trim()||TD(d),url:d});u(!1),s(g)}}}var bG=T(R(),1);function c5e({initial:e,submitLabel:t,onSubmit:r,children:n}){let o=bYr(e,r);return(0,bG.jsxs)(kt,{component:"form",spacing:2,onSubmit:o.submit,children:[(0,bG.jsx)(yYr,{value:o.url,error:o.error,onChange:o.changeUrl}),(0,bG.jsx)(Fn,{label:"Name",value:o.name,onChange:i=>o.setName(i.target.value),helperText:"Filled in from the host name. Shown on the node chip.",slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off"}}}),(0,bG.jsx)(dt,{type:"submit",variant:"contained",size:"large",disabled:!o.url.trim()||o.busy,children:o.busy?"Checking\u2026":t}),n]})}var cC=T(R(),1),CDo={height:"100%",boxSizing:"border-box",overflowY:"auto",display:"flex",justifyContent:"center",pt:`calc(${ya.top} + 28px)`,pb:`calc(${ya.bottom} + 24px)`,px:2.5,bgcolor:"background.default"},kDo={width:56,height:56,borderRadius:"14px",bgcolor:"action.hover",border:1,borderColor:"divider",display:"grid",placeItems:"center",fontFamily:"fontFamilyMono",fontSize:22,fontWeight:600,color:"primary.main"};function xYr({onConnect:e}){return(0,cC.jsx)(V,{sx:CDo,children:(0,cC.jsxs)(kt,{spacing:2.5,sx:{width:"100%",maxWidth:420},children:[(0,cC.jsx)(V,{sx:kDo,children:">_"}),(0,cC.jsx)(Te,{variant:"h5",sx:{fontWeight:700},children:"Connect to a home node"}),(0,cC.jsxs)(Te,{variant:"body2",color:"text.secondary",children:["The phone connects to one assist web server over Tailscale. You'll see its sessions and the sessions of every node it links to. Make sure Tailscale is connected on this phone and"," ",(0,cC.jsx)("code",{children:"assist sessions web"})," is running on that machine."]}),(0,cC.jsx)(c5e,{submitLabel:"Connect",onSubmit:async r=>{let n=await h3(r.url);if(!n.ok)return`Can't reach ${r.url}: ${n.error}`;e(r,n.health)}})]})})}var iKr=T(ee(),1);var kv=T(R(),1),_Do={flex:"none",pt:ya.top,bgcolor:"background.default"},EDo={height:e=>e.tokens.density.bar,display:"grid",gridTemplateColumns:"minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)",columnGap:1,alignItems:"center",px:1.5},RDo={height:e=>e.tokens.density.bar,display:"flex",alignItems:"center",gap:.5,px:.5},PDo={textAlign:"center",minWidth:0,maxWidth:220,fontSize:15,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},ADo={flex:1,minWidth:0,fontSize:15,fontWeight:600,lineHeight:1.25,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",overflowWrap:"anywhere"};function vu({left:e,title:t,right:r,leadingTitle:n}){return(0,kv.jsx)(V,{component:"header",sx:_Do,children:n?(0,kv.jsxs)(V,{sx:RDo,children:[(0,kv.jsx)(V,{sx:{flex:"none"},children:e}),(0,kv.jsx)(V,{component:"h1",sx:[ADo,{m:0}],children:t}),(0,kv.jsx)(V,{sx:{flex:"none",display:"flex"},children:r})]}):(0,kv.jsxs)(V,{sx:EDo,children:[(0,kv.jsx)(V,{sx:{justifySelf:"start",minWidth:0},children:e}),(0,kv.jsx)(V,{sx:PDo,children:t}),(0,kv.jsx)(V,{sx:{justifySelf:"end",display:"flex",gap:.25},children:r})]})})}var Wx=e=>e.tokens.color.raised;var SYr=T(R(),1),LDo={ok:e=>e.palette.success.main,warn:e=>e.palette.warning.main,error:e=>e.palette.error.main,off:e=>e.palette.text.disabled};function M0({tone:e}){return(0,SYr.jsx)(V,{component:"span",sx:{width:8,height:8,flex:"none",borderRadius:"50%",bgcolor:LDo[e]}})}var Es=e=>e.tokens.density.target;var xG=T(R(),1),IDo={display:"inline-flex",alignItems:"center",gap:.75,height:Es,pl:1.125,pr:.75,borderRadius:"24px",border:1,borderColor:"divider",bgcolor:Wx,color:"text.primary",fontFamily:"fontFamilyMono",fontSize:13,maxWidth:140,justifyContent:"flex-start"},DDo={minWidth:0,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"};function u5e({name:e,tone:t,onClick:r}){return(0,xG.jsxs)(Jt,{sx:IDo,onClick:r,disabled:!r,"aria-label":"Nodes","data-testid":"phone-node-chip",children:[(0,xG.jsx)(M0,{tone:t}),(0,xG.jsx)(V,{component:"span",sx:DDo,children:e??"\u2026"}),r&&(0,xG.jsx)(xa,{sx:{fontSize:16,flex:"none"}})]})}var JYr=T(ee(),1);var d5e=T(R(),1);function TYr({homeNode:e,node:t,onDone:r}){let n=!!t&&t.url===e.home?.url;return(0,d5e.jsx)(V,{sx:{px:2.5,pt:1},children:(0,d5e.jsx)(c5e,{initial:t,submitLabel:t?"Save":"Add node",onSubmit:async i=>{if(e.nodes.some(s=>s.url===i.url&&s.url!==t?.url))return"That URL is already saved";e.saveNode(t?.url??i.url,i),r()},children:t&&(0,d5e.jsx)(dt,{color:"error",size:"large",disabled:n,onClick:()=>{e.removeNode(t.url),r()},children:n?"Switch home node to delete this one":"Delete node"})})})}var wYr=T(R(),1),MDo={width:36,height:5,borderRadius:"3px",bgcolor:"text.disabled",opacity:.5,mx:"auto",mb:.75};function SG(){return(0,wYr.jsx)(V,{sx:MDo})}var uC=T(R(),1),NDo={display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,px:2,pt:.75,pb:1.25},ODo={color:"primary.main",fontSize:16,minHeight:Es,px:.5,borderRadius:1};function TG({title:e,actionLabel:t,onAction:r}){return(0,uC.jsxs)(uC.Fragment,{children:[(0,uC.jsx)(SG,{}),(0,uC.jsxs)(V,{sx:NDo,children:[(0,uC.jsx)(V,{component:"b",sx:{fontSize:17,fontWeight:600},children:e}),(0,uC.jsx)(Jt,{sx:ODo,onClick:r,children:t})]})]})}var CD=T(R(),1);function CYr({homeNode:e,node:t,onDone:r}){return(0,CD.jsxs)(CD.Fragment,{children:[(0,CD.jsx)(TG,{title:t?"Edit node":"Add node",actionLabel:"Cancel",onAction:r}),(0,CD.jsx)(TYr,{homeNode:e,node:t,onDone:r},t?.url??"add")]})}var Or={group:{flexShrink:0,mx:2,my:.75,borderRadius:"12px",bgcolor:"background.default",border:1,borderColor:"divider",overflow:"hidden","& > *:not(:last-child)":{borderBottom:1,borderColor:e=>e.tokens.color.lineSoft}},item:{width:"100%",minHeight:Es,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1.5,px:1.75,py:1,textAlign:"left",fontSize:16},grow:{flex:1,minWidth:0},detail:{display:"block",fontSize:13,color:"text.secondary",fontFamily:"fontFamilyMono",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},end:{display:"flex",alignItems:"center",gap:.75,color:"text.secondary",fontSize:14},label:{px:4,pt:1.75,pb:.25,fontSize:13,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"text.secondary"}};function kYr(e,t){return e.replace(/\/+$/,"")===t.replace(/\/+$/,"")}function wG(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]||0)-(n[o]||0);if(i!==0)return Math.sign(i)}return 0}function _Yr(e,t,r){let n=t.filter(a=>a.node===e.name).length,o=[e.state,`${n} session${n===1?"":"s"}`,e.peerVersion&&`v${e.peerVersion}`,e.state!=="connected"&&e.error],i=e.peerVersion&&r?wG(e.peerVersion,r):0;return{text:o.filter(Boolean).join(" \xB7 "),drift:i<0?"behind":i>0?"ahead":void 0}}var f5e={connected:"ok",connecting:"warn",disconnected:"error","version-blocked":"error"};var mlt=T(R(),1);function EYr({name:e,onSave:t}){return(0,mlt.jsx)(jt,{"aria-label":`Save ${e} as a home node`,onClick:t,sx:{color:"primary.main",borderRadius:0},children:(0,mlt.jsx)(gp,{fontSize:"small"})})}var dC=T(R(),1),BDo={fontFamily:"fontFamilyMono",fontSize:12,px:.75,border:1,borderColor:"currentColor",borderRadius:"4px",color:"warning.main"};function RYr({links:e,sessions:t,homeVersion:r,isSaved:n,onSave:o}){return(0,dC.jsx)(V,{sx:Or.group,children:e.map(i=>{let{text:a,drift:s}=_Yr(i,t,r);return(0,dC.jsxs)(V,{sx:[Or.item,{pr:0}],children:[(0,dC.jsx)(M0,{tone:f5e[i.state]}),(0,dC.jsxs)(V,{component:"span",sx:Or.grow,children:[i.name,(0,dC.jsx)(V,{component:"span",sx:Or.detail,children:a})]}),s&&(0,dC.jsx)(V,{component:"span",sx:BDo,children:s}),!n(i.url)&&(0,dC.jsx)(EYr,{name:i.name,onSave:()=>o(i)})]},i.name)})})}var Vx=T(R(),1);function CG({title:e,rows:t}){return(0,Vx.jsxs)(Vx.Fragment,{children:[(0,Vx.jsx)(V,{sx:Or.label,children:e}),(0,Vx.jsx)(V,{sx:Or.group,children:t.map(r=>(0,Vx.jsxs)(V,{sx:Or.item,children:[(0,Vx.jsx)(V,{component:"span",sx:Or.grow,children:r.label}),(0,Vx.jsx)(V,{component:"span",sx:[Or.end,{fontFamily:"fontFamilyMono"},r.color?{color:r.color}:{}],children:r.value})]},r.key))})]})}var AYr=T(R(),1);function PYr({rateLimits:e,harnessRateLimits:t}){let r=E0(3e4),n=e4e(e,t).flatMap(o=>o4e(o.rateLimits).map(i=>({key:`${o.harness}-${i.label}`,label:`${Fc(o.harness)} \xB7 ${i.label}`,value:i.resetsAt!=null?`${Math.round(i.pct)}% \xB7 ${MV(i.resetsAt,r)}`:`${Math.round(i.pct)}%`,color:dEe(kx(i.pct,i.resetsAt,i.windowSeconds,r))})));return n.length===0?null:(0,AYr.jsx)(CG,{title:"Rate limits",rows:n})}var Gx=T(R(),1);function LYr({status:e,homeVersion:t,homeNode:r}){let n=e.nodes?.links??[];return(0,Gx.jsxs)(Gx.Fragment,{children:[n.length>0&&(0,Gx.jsxs)(Gx.Fragment,{children:[(0,Gx.jsxs)(V,{sx:Or.label,children:["Linked through ",e.nodes?.local]}),(0,Gx.jsx)(RYr,{links:n,sessions:e.sessions,homeVersion:t,isSaved:o=>r.nodes.some(i=>kYr(i.url,o)),onSave:({name:o,url:i})=>r.saveNode("",{name:o,url:i})})]}),(0,Gx.jsx)(PYr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var $Do={ok:"ok",ready:"warn",diverged:"warn",retrying:"warn",paused:"off",off:"off",loading:"off",unavailable:"error"};function p5e(e,t){let r=C0(e),{status:n}=e,o=!!n&&!!t&&wG(t,n.built)>0,i=F5(e),a=n&&(n.running===n.built?`v${n.running}`:`v${n.running} \u2192 v${n.built}`),s=o?`v${t} available`:i?"restart pending":r.label.toLowerCase();return{tone:o?"warn":$Do[r.kind],detail:[a,s].filter(Boolean).join(" \xB7 "),updateAvailable:o,restartPending:i}}var Nm=T(R(),1);function IYr({updates:e,onOpen:t}){let{entries:r,latest:n,notices:o}=e;return r.length===0?null:(0,Nm.jsxs)(Nm.Fragment,{children:[(0,Nm.jsx)(V,{sx:Or.label,children:"Updates"}),(0,Nm.jsx)(V,{sx:Or.group,children:r.map(i=>{let a=p5e(i,n),s=o.busy[i.name];return(0,Nm.jsxs)(Jt,{sx:Or.item,onClick:()=>t(i.name),"data-testid":`phone-update-row-${i.name}`,children:[(0,Nm.jsx)(M0,{tone:a.tone}),(0,Nm.jsxs)(V,{component:"span",sx:Or.grow,children:[i.name,(0,Nm.jsx)(V,{component:"span",sx:Or.detail,children:a.detail})]}),(0,Nm.jsxs)(V,{component:"span",sx:Or.end,children:[s&&`${s}\u2026`,(0,Nm.jsx)(Wo,{})]})]},i.name)})})]})}var Loe=T(R(),1);function h5e({onAdd:e}){return(0,Loe.jsxs)(Jt,{sx:Or.item,onClick:e,children:[(0,Loe.jsx)(gp,{sx:{color:"primary.main"}}),(0,Loe.jsx)(V,{component:"span",sx:{color:"primary.main"},children:"Add node URL"})]})}function qx(e){try{return new URL(e).host}catch{return e}}function m5e(e){if(!e)return{tone:"off",text:"checking\u2026"};if(!e.ok)return{tone:"error",text:"unreachable"};let t=e.health.version;return{tone:"ok",text:t?`reachable \xB7 v${t}`:"reachable"}}var g5e=T(ee(),1);var FDo=15e3;function y5e(e){let[t,r]=(0,g5e.useState)({}),n=e.join(`
|
|
4070
4070
|
`);return(0,g5e.useEffect)(()=>{if(!n)return;let o=!1,i=()=>{for(let s of n.split(`
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.1062.
|
|
9
|
+
version: "0.1062.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -55091,10 +55091,14 @@ function serverConflictInfo(session) {
|
|
|
55091
55091
|
}
|
|
55092
55092
|
|
|
55093
55093
|
// src/commands/sessions/daemon/liveServerRun.ts
|
|
55094
|
-
function
|
|
55094
|
+
function holdsSlot(s, meta) {
|
|
55095
|
+
if (meta.port !== void 0 && s.serverPort === meta.port) return true;
|
|
55096
|
+
return meta.origin !== void 0 && meta.group !== void 0 && s.serverOrigin === meta.origin && s.serverGroup === meta.group;
|
|
55097
|
+
}
|
|
55098
|
+
function liveServerRun(sessions, meta, excludeId) {
|
|
55095
55099
|
for (const s of sessions.values()) {
|
|
55096
55100
|
if (s.id === excludeId || !s.server) continue;
|
|
55097
|
-
if (s
|
|
55101
|
+
if (!holdsSlot(s, meta)) continue;
|
|
55098
55102
|
if (s.status !== "done" && s.status !== "error") return s;
|
|
55099
55103
|
}
|
|
55100
55104
|
return void 0;
|
|
@@ -55116,13 +55120,8 @@ function tagServerSession(session, meta) {
|
|
|
55116
55120
|
}
|
|
55117
55121
|
function findRetryConflict(sessions, session, replace, dismiss) {
|
|
55118
55122
|
const meta = serverRunMeta(session.runName ?? "", session.cwd);
|
|
55119
|
-
if (meta.server
|
|
55120
|
-
const existing = liveServerRun(
|
|
55121
|
-
sessions,
|
|
55122
|
-
meta.origin,
|
|
55123
|
-
meta.group,
|
|
55124
|
-
session.id
|
|
55125
|
-
);
|
|
55123
|
+
if (meta.server) {
|
|
55124
|
+
const existing = liveServerRun(sessions, meta, session.id);
|
|
55126
55125
|
if (existing && !replace) return serverConflictInfo(existing);
|
|
55127
55126
|
if (existing) dismiss(existing.id);
|
|
55128
55127
|
}
|
|
@@ -56373,8 +56372,8 @@ var SessionManager = class {
|
|
|
56373
56372
|
spawnRun(request, context) {
|
|
56374
56373
|
return this.spawnWith((id) => createRunSession(id, request), context);
|
|
56375
56374
|
}
|
|
56376
|
-
liveServerRun(
|
|
56377
|
-
return liveServerRun(this.sessions,
|
|
56375
|
+
liveServerRun(meta, excludeId) {
|
|
56376
|
+
return liveServerRun(this.sessions, meta, excludeId);
|
|
56378
56377
|
}
|
|
56379
56378
|
spawnAssist(assistArgs, cwd, meta, context) {
|
|
56380
56379
|
return spawnAssistInTree(this.treeCtx(), assistArgs, cwd, meta, context);
|
|
@@ -56955,6 +56954,12 @@ var handleCodexUsage = (client, m, d) => {
|
|
|
56955
56954
|
);
|
|
56956
56955
|
};
|
|
56957
56956
|
|
|
56957
|
+
// src/commands/sessions/daemon/serverSlotLabel.ts
|
|
56958
|
+
function serverSlotLabel(meta) {
|
|
56959
|
+
const slot = `${meta.origin ?? "?"} (${meta.group})`;
|
|
56960
|
+
return meta.port === void 0 ? slot : `${slot} port ${meta.port}`;
|
|
56961
|
+
}
|
|
56962
|
+
|
|
56958
56963
|
// src/commands/sessions/daemon/spawnContextFrom.ts
|
|
56959
56964
|
function spawnContextFrom(d) {
|
|
56960
56965
|
return {
|
|
@@ -56970,11 +56975,11 @@ function handleCreateRun(client, m, d) {
|
|
|
56970
56975
|
const runArgs = d.runArgs ?? [];
|
|
56971
56976
|
const context = spawnContextFrom(d);
|
|
56972
56977
|
const meta = serverRunMeta(runName, cwd);
|
|
56973
|
-
if (meta.server
|
|
56974
|
-
const existing = m.liveServerRun(meta
|
|
56978
|
+
if (meta.server) {
|
|
56979
|
+
const existing = m.liveServerRun(meta);
|
|
56975
56980
|
if (existing && d.replace !== true) {
|
|
56976
56981
|
daemonLog(
|
|
56977
|
-
`create-run ${runName} rejected: server ${existing.id} already live for ${
|
|
56982
|
+
`create-run ${runName} rejected: server ${existing.id} already live for ${serverSlotLabel(meta)}`
|
|
56978
56983
|
);
|
|
56979
56984
|
sendTo(client, {
|
|
56980
56985
|
type: "run-conflict",
|
|
@@ -56987,7 +56992,7 @@ function handleCreateRun(client, m, d) {
|
|
|
56987
56992
|
}
|
|
56988
56993
|
if (existing) {
|
|
56989
56994
|
daemonLog(
|
|
56990
|
-
`create-run ${runName} replacing live server ${existing.id} for ${
|
|
56995
|
+
`create-run ${runName} replacing live server ${existing.id} for ${serverSlotLabel(meta)}`
|
|
56991
56996
|
);
|
|
56992
56997
|
m.dismissSession(existing.id);
|
|
56993
56998
|
}
|
|
@@ -57017,7 +57022,7 @@ var handleDismiss = routed((_client, m, d) => {
|
|
|
57017
57022
|
|
|
57018
57023
|
// src/commands/sessions/daemon/latestServerRun.ts
|
|
57019
57024
|
function latestServerRun(sessions, origin, group) {
|
|
57020
|
-
const live = liveServerRun(sessions, origin, group);
|
|
57025
|
+
const live = liveServerRun(sessions, { server: true, origin, group });
|
|
57021
57026
|
if (live) return live;
|
|
57022
57027
|
let latest2;
|
|
57023
57028
|
for (const s of sessions.values()) {
|