@staff0rd/assist 0.972.0 → 0.973.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +118 -93
- package/package.json +1 -1
|
@@ -4019,7 +4019,7 @@ ${f.join(`
|
|
|
4019
4019
|
`,ofi=bo`
|
|
4020
4020
|
0%, 100% { transform: scale(1); }
|
|
4021
4021
|
50% { transform: scale(1.08); }
|
|
4022
|
-
`,wEr={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:`${ifi} 1.8s linear infinite`},afi={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${ofi} 1.6s ease-in-out infinite`,"&::before":{...wEr,inset:0,zIndex:-1},"&::after":{...wEr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:pl.rainbowPill.text,textShadow:pl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function kEr({children:e}){return(0,dP.jsxs)(dP.Fragment,{children:[(0,dP.jsx)(xE,{styles:nfi}),(0,dP.jsx)(q,{component:"span","data-testid":"rainbow-pill",sx:afi,children:e})]})}function _Er({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function EEr(e){if(e.length!==2)return!1;let[t,r]=e;return _Er(t)===_Er(r)}var sT=k(N(),1);function AEr({rateLimits:e}){let t=_g(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(o=>o.window?.used_percentage!=null),n=EEr(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:Fxe(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,sT.jsxs)(REr.Fragment,{children:[a>0?(0,sT.jsx)(q,{component:"span",sx:{color:iH,mr:.5},children:","}):null,(0,sT.jsx)(CEr,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,sT.jsx)(kEr,{children:i}):(0,sT.jsx)(sT.Fragment,{children:i})}var D5=k(N(),1);function LEr({groups:e}){return(0,D5.jsx)(D5.Fragment,{children:e.map((t,r)=>(0,D5.jsxs)(PEr.Fragment,{children:[(0,D5.jsx)(q,{component:"span",sx:{color:iH,ml:r>0?1:0,mr:.5},children:oc(t.harness)}),(0,D5.jsx)(AEr,{rateLimits:t.rateLimits})]},t.harness))})}var MEr={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 sfi(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function lfi(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function cfi(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function NEr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=cje(t,r,n);if(i==null)return{kind:"unprojectable"};let o=b5(e,t,r,n),a=sfi(o),s=lfi(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:cfi(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function zxe(e){return t=>t.tokens.color.onAppBar.level[e]}function OEr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${Bz(e.at,t)}`}var N5=k(N(),1),BEr={display:"contents"};function Lje({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,N5.jsxs)(q,{component:"span",sx:BEr,children:[(0,N5.jsx)("span",{}),(0,N5.jsx)("span",{})]});let n=(0,N5.jsx)(q,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),i=(0,N5.jsxs)(q,{component:"span",sx:{color:zxe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,N5.jsxs)(q,{component:"span",sx:BEr,children:[r?i:n,r?n:i]})}var FEr={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 O5=k(N(),1);function $Er({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=FEr,a=b5(t,r,n,i),s=NEr(t,r,n,i),l=s.kind==="projected"?s:void 0;return(0,O5.jsxs)(q,{sx:o.row,children:[(0,O5.jsx)(q,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,O5.jsx)(Lje,{direction:"back",threshold:l?.recovery}),(0,O5.jsxs)(q,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:o.pctWeight,color:zxe(a)},children:[Math.round(t),"%"]}),(0,O5.jsx)(Lje,{direction:"forward",threshold:l?.worse}),(0,O5.jsx)(q,{component:"span",sx:o.note,children:l?l.recovery&&OEr(l.recovery,i):"no projection yet"})]})}function Hxe(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 HEr=k(N(),1);function zEr({rateLimits:e,now:t}){return Hxe(e).map(r=>(0,HEr.jsx)($Er,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var hP=k(N(),1);function UEr({groups:e}){let t=_g(3e4),r=MEr;return(0,hP.jsxs)(q,{sx:r.root,children:[e.map(n=>(0,hP.jsxs)(q,{sx:r.group,children:[(0,hP.jsx)(q,{sx:r.heading,children:oc(n.harness)}),(0,hP.jsx)(zEr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,hP.jsx)(q,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var Mje=k(N(),1),ufi="Claude account usage (5h / 7d windows) \u2014 view history";function WEr(e){return e.length===0?{title:ufi,content:"Usage"}:{title:(0,Mje.jsx)(UEr,{groups:e}),content:(0,Mje.jsx)(LEr,{groups:e})}}var GEr={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}},VEr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var Ije=k(N(),1),ffi={};function qEr({rateLimits:e,harnessRateLimits:t=ffi}){let{title:r,content:n}=WEr(Bxe(e,t));return(0,Ije.jsx)(sr,{title:r,placement:"top-start",slotProps:VEr,children:(0,Ije.jsx)(Vr,{component:qa,to:"/usage",underline:"none",color:"inherit",sx:GEr,children:n})})}var KEr=k(oe(),1);var vh="0.972.0";var Uxe=k(oe(),1),Dje=(0,Uxe.createContext)(null);function Wxe(){return(0,Uxe.useContext)(Dje)}var Nje=k(N(),1);function jEr(){let e=Wxe();return!e||e===vh?null:(0,Nje.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${vh}. Restart the daemon to match.`,children:(0,Nje.jsx)(Exe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var YEr=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?rb(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>rb(t).hover,color:t=>rb(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>rb(t).dot,boxShadow:t=>`0 0 0 3px ${rb(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>rb(t).readyText}});var Ag=k(N(),1);function XEr(){let{entries:e}=Tz(),t=jn(),r=(0,KEr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:i}=Qn("openUpdates");if(Mo(n,r),!vh)return null;let o=e.filter(Az).length;return(0,Ag.jsxs)(Ag.Fragment,{children:[(0,Ag.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,Ag.jsx)(Wu,{label:"Updates",chords:i}),children:(0,Ag.jsxs)(vr,{component:qa,to:"/updates","aria-label":o?`Updates: ${o} node${o>1?"s have":" has"} an update ready`:"Updates",sx:YEr(o>0),children:[o>0&&(0,Ag.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,Ag.jsxs)("span",{children:["v",vh]}),o>0&&(0,Ag.jsxs)("span",{className:"ready-count",children:[o," ready"]})]})}),(0,Ag.jsx)(jEr,{})]})}var Gxe=k(N(),1);function ZEr({socket:e}){return(0,Gxe.jsx)(xEr,{start:(0,Gxe.jsx)(qEr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,Gxe.jsx)(XEr,{})})}var Kxe=k(oe(),1);var Yxe=k(oe(),1);function QEr(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 B5=k(N(),1),dfi={display:"flex",gap:1,alignItems:"center",minWidth:0},hfi={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},pfi={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},mfi={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function gfi(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function JEr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,B5.jsx)(im,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=gfi(i);return(0,B5.jsxs)(mn,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:dfi,children:[(0,B5.jsx)(Iye,{path:i}),(0,B5.jsxs)(q,{sx:hfi,children:[(0,B5.jsx)(Le,{component:"span",sx:pfi,children:s}),(0,B5.jsx)(Le,{component:"span",color:"text.secondary",sx:mfi,children:a})]})]},i)})})}var Vxe=k(N(),1),yfi={maxHeight:420,overflowY:"auto"},vfi={px:2,py:2,fontSize:13};function e4r({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,Vxe.jsx)(q,{sx:yfi,children:e?(0,Vxe.jsx)(Le,{color:"text.secondary",sx:vfi,children:e}):(0,Vxe.jsx)(JEr,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var t4r=k(N(),1),bfi={mt:6,alignSelf:"flex-start"};function qxe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,t4r.jsx)(ec,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:bfi},transition:{onEntered:t}},children:n})}var jxe=k(oe(),1);var r4r={files:[],loading:!1,error:!1};function n4r(e,t){let[r,n]=(0,jxe.useState)(r4r),i=gr();return(0,jxe.useEffect)(()=>{if(!e){n(r4r);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await fr(Xr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,i));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(o)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch{o||n({files:[],loading:!1,error:!0})}})(),()=>{o=!0}},[e,t,i]),r}var pP=k(N(),1);function xfi(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function i4r({onClose:e}){let{worktreeNode:t}=Un();return(0,pP.jsx)(tu.Provider,{value:t,children:(0,pP.jsx)(Sfi,{onClose:e})})}function Sfi({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=Un(),[n,i]=(0,Yxe.useState)(""),o=n4r(t,n),a=jn(),s=(0,Yxe.useRef)(null),l=p=>a(xfi(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=k5(o.files,n,l,e),h=p=>{l(p),e()};return(0,pP.jsxs)(qxe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,pP.jsx)(PC,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,pP.jsx)(e4r,{message:QEr(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function o4r(e){Mo(Qn("quickOpen").matches,e)}var s4r=k(N(),1);function a4r(){let[e,t]=(0,Kxe.useState)(!1);return o4r((0,Kxe.useCallback)(()=>t(!0),[])),e?(0,s4r.jsx)(i4r,{onClose:()=>t(!1)}):null}var Xxe=k(N(),1);function l4r({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,Xxe.jsx)(qh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,Xxe.jsx)(_i,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,Xxe.jsx)(Rt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var GQ=k(oe(),1);function Zxe(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var S4r=k(oe(),1);var c4r=k(N(),1),u4r=nt((0,c4r.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 Tfi={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function f4r(e){return e?Tfi[e]:"success.main"}function d4r(e){return e.split("-")[0].split(".").map(Number)}function h4r(e,t){if(!e||!t||e===t)return;let r=d4r(e),n=d4r(t);for(let i=0;i<Math.max(r.length,n.length);i++){let o=(r[i]??0)-(n[i]??0);if(Number.isNaN(o))return;if(o!==0)return o<0?"behind":"ahead"}}var mP=k(N(),1),Cfi={height:16,fontSize:10},wfi={opacity:.6,fontSize:"0.85em"};function kfi(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 UQ({nodes:e,name:t,showVersion:r=!1}){let n=Wxe()??vh,i=e.links.find(a=>a.name===t),o=h4r(i?.peerVersion,n);return(0,mP.jsx)(sr,{title:kfi(e,t),placement:"right",children:(0,mP.jsxs)(q,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,mP.jsx)(u4r,{sx:{fontSize:8,color:f4r(i?.state)}}),t,r&&i?.peerVersion&&(0,mP.jsxs)(q,{component:"span",sx:wfi,children:["v",i.peerVersion]}),o&&(0,mP.jsx)(Gn,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:Cfi})]})})}var gP=k(N(),1),_fi={opacity:.6},Efi={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function p4r({nodes:e,name:t,clone:r}){let n=(0,gP.jsx)(UQ,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,gP.jsx)(q,{component:"span",sx:_fi,children:n}):(0,gP.jsx)(sr,{title:Wz(t,r.cloneTarget),children:(0,gP.jsxs)(q,{component:"span",sx:Efi,children:[(0,gP.jsx)(Uz,{sx:{fontSize:14}}),n]})})}var g4r=k(N(),1),Rfi={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 m4r({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,g4r.jsx)(vr,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:Rfi,children:t})}var y4r={ArrowRight:1,ArrowLeft:-1};function Afi(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+y4r[e.key]+r)%r}function v4r(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!y4r[i.key]){CS(i);return}let o=Afi(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var b4r=k(oe(),1);function oH(e){return e?.querySelector('[aria-checked="true"]')}function x4r(e,t){(0,b4r.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=oH(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var Oje=k(N(),1),Pfi={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function Qxe({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return x4r(o,r),(0,Oje.jsx)(_t,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:v4r(t,r,n,l),sx:Pfi,children:t.map(u=>(0,Oje.jsx)(m4r,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var Bje=k(N(),1);function T4r({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=Ks(),a=(0,S4r.useRef)(null);return!o||!n||!e?null:(0,Bje.jsx)(Qxe,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,Bje.jsx)(p4r,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var Jxe=k(N(),1);function C4r({prompt:e,children:t}){return(0,Jxe.jsxs)(_t,{children:[e,(0,Jxe.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var k4r=k(N(),1),Lfi=".MuiOutlinedInput-notchedOutline",Mfi={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${Lfi}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function w4r({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,k4r.jsx)($n,{sx:Mfi,value:e,onChange:a=>t(a.target.value),onKeyDown:CS,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var A4r=k(oe(),1);var sy={draft:{placeholder:"Describe the backlog item to draft...",submitLabel:"Start draft",sessionMode:"assist-draft"},bug:{placeholder:"Describe the bug: what happened, what you expected...",submitLabel:"File bug",sessionMode:"assist-bug"},prompt:{placeholder:E1e,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},_4r=Object.keys(sy);var Fje=k(N(),1);function E4r({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,Fje.jsx)(Gs,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,Fje.jsx)(mn,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:oc(o)},o))})}var yP=k(N(),1);function R4r(e){return t=>t==="prompt"&&e?(0,yP.jsxs)(yP.Fragment,{children:["prompt",(0,yP.jsx)(q,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${oc(e)}`}),(0,yP.jsx)(Ad,{sx:{fontSize:18,mr:-.75}})]}):t}var vP=k(N(),1);function P4r({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,A4r.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(oH(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,vP.jsxs)(vP.Fragment,{children:[(0,vP.jsx)(Qxe,{label:"Mode",options:_4r,value:e.mode,onChange:l,optionLabel:R4r(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,vP.jsx)(E4r,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var U4r=k(oe(),1);var $je=k(N(),1),Ifi={zIndex:e=>e.zIndex.modal+1};function L4r({open:e,anchor:t,children:r}){return(0,$je.jsx)(BL,{open:e,anchorEl:t,placement:"bottom-start",sx:Ifi,children:(0,$je.jsx)(Jr,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var M4r=k(N(),1),I4r=nt((0,M4r.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var zje=k(N(),1),Dfi={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},Nfi={fontSize:16,color:"text.disabled"};function D4r(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:Dfi,endAdornment:(0,zje.jsx)(TCe,{position:"end",children:(0,zje.jsx)(I4r,{sx:Nfi})})}}}var N4r=k(SL(),1);function O4r({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}CS(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,N4r.flushSync)(()=>{r(t),n()}),CS(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function e2e(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Yv(n).toLowerCase().includes(r)):e}var Hje=k(oe(),1);function B4r(){let[e,t]=(0,Hje.useState)(!1),[r,n]=(0,Hje.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var $4r=k(oe(),1);var F4r=e=>e?Yv(e):"";function z4r(e){let[t,r]=(0,$4r.useState)(()=>F4r(e));return{text:t,setText:r,showRepo:n=>r(F4r(n))}}function H4r(e,t,r){let n=B4r(),i=z4r(t),o=e2e(e,n.query),a=f=>{r(f),i.showRepo(f)},s=k5(o,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:i.text,filtered:o,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:O4r({open:n.open,highlighted:o[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:f=>{i.setText(f),n.filterBy(f)},onFocus:l,onBlur:()=>{n.close(),i.showRepo(t)},pick:f=>{a(f),n.close()}}}var aH=k(N(),1);function W4r({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=H4r(e,t,r),s=(0,U4r.useRef)(null);return(0,aH.jsxs)(q,{ref:s,sx:{flex:1,minWidth:0},children:[(0,aH.jsx)($n,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),o()},inputRef:n,autoFocus:i,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:D4r(a.open)}),(0,aH.jsx)(L4r,{open:a.open,anchor:s.current,children:(0,aH.jsx)(Txe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var F5=k(N(),1);function G4r({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=Un();return(0,F5.jsxs)(C4r,{prompt:(0,F5.jsx)(w4r,{value:r.prompt,onChange:r.setPrompt,placeholder:sy[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,F5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,F5.jsx)(W4r,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,F5.jsx)(P4r,{...t})]}),(0,F5.jsx)(T4r,{value:r.node,onChange:r.setNode,cloneState:e})]})}var j4r=k(N(),1),V4r=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function q4r({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,j4r.jsx)(Rt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var bP=k(N(),1),Ofi=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"}),Bfi=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function Y4r(e){return(0,bP.jsxs)(_t,{direction:"row",sx:Ofi,children:[V4r.map(([t,r])=>(0,bP.jsxs)("span",{children:[(0,bP.jsx)(q,{component:"kbd",sx:Bfi,children:t}),r]},t)),(0,bP.jsx)(q,{sx:{flex:1}}),(0,bP.jsx)(q4r,{...e})]})}var xP=k(oe(),1);function K4r(e,t){let r=(0,xP.useRef)(e),n=(0,xP.useRef)(null),i=(0,xP.useRef)(null),o=(0,xP.useRef)(null),a=(0,xP.useCallback)(u=>{n.current=u;let{field:f,selectionStart:d,selectionEnd:h}=r.current;u&&f==="prompt"&&u.setSelectionRange(d,h)},[]),s=u=>{let f=u.target;t({field:"prompt",selectionStart:f.selectionStart,selectionEnd:f.selectionEnd})},l=()=>{if(o.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:i.current,mode:oH(o.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:i,modeRef:o,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function Ffi(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:wxe(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function X4r(e,t){let{names:r,visible:n}=Ks(),i=bxe(t,n?r:[void 0]);return{cloneState:i,target:Ffi(t,e,i(e))}}function t2e({mode:e,harness:t,prompt:r,cwd:n,node:i},o){let a=n||void 0,s=i?[i]:[];if(e==="prompt"){t==="claude"?o.onCreate(r,a,...s):o.onCreateHarness(t,r,a,...s);return}if(e==="design"){o.onCreateDesign(r,a,...s);return}let l=i?[{node:i}]:[];Omr(sy[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function Z4r(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(dxe(r.prompt,n.onCreateAssist),!0):(t2e({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var r2e=k(oe(),1);function Q4r(e,t){let[r,n]=(0,r2e.useState)(!1);return(0,r2e.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function J4r(e,t,r,n,i){let o=Q4r(e,()=>{Z4r(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var WQ=k(oe(),1);function e3r(e,t){let r=(0,WQ.useRef)(e),n=(0,WQ.useRef)(null);return(0,WQ.useEffect)(()=>{if(r.current&&!e){let i=n.current;i?.isConnected?i.focus():t()}r.current=e},[e,t]),i=>{n.current=i.target}}var r3r=k(N(),1),$fi={border:0,margin:0,padding:0,minWidth:0};function t3r({loading:e,restoreFocus:t,children:r}){let n=e3r(e,t);return(0,r3r.jsx)("fieldset",{disabled:e,style:$fi,onFocus:n,children:r})}var SP=k(N(),1);function n3r({draft:e,launchers:t,onClose:r}){let n=K4r(e.focus,e.setFocus),i=Zxe(Gv()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=X4r(e.node,e.cwd),l=J4r(e,o,a,t,r);return(0,SP.jsx)(qxe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,SP.jsx)("form",{onSubmit:l,children:(0,SP.jsxs)(t3r,{loading:e.modePending,restoreFocus:n.restore,children:[(0,SP.jsx)(G4r,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,SP.jsx)(Y4r,{submitLabel:a.kind==="clone"?"Clone":sy[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var n2e=k(oe(),1);var zfi=1e3;async function Hfi(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await fr(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(sy,n?.mode)?n.mode:null}catch{return null}}function i2e(e,t=0){let[r,n]=(0,n2e.useState)(null);return(0,n2e.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await Hfi(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,zfi))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function i3r(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var lT=k(oe(),1),o3r={field:"prompt",selectionStart:0,selectionEnd:0};function a3r(){let[e,t]=(0,lT.useState)(""),[r,n]=(0,lT.useState)(),[i,o]=(0,lT.useState)(),[a,s]=(0,lT.useState)("claude"),[l,u]=(0,lT.useState)(),[f,d]=(0,lT.useState)(o3r),h=(0,lT.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(o3r)},[]);return{prompt:e,cwd:r,mode:i,harness:a,node:l,focus:f,setPrompt:t,setNode:u,setCwd:n,setMode:o,setHarness:s,setFocus:d,clear:h}}function s3r(e,t=i2e){let{selectedCwd:r}=Un(),n=Ks(),i=a3r(),o=i.cwd??r,a=t(o,e);return a?{...i,cwd:o,mode:i.mode??a.mode,modePending:i.mode===void 0&&a.pending,node:i3r(i.node,n)}:null}function l3r(e){Mo(Qn("newSession").matches,e)}var c3r=k(oe(),1);function u3r(e,t){let{selectedCwd:r}=Un(),[n,i]=Jc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,c3r.useEffect)(()=>{o===null||!s||!l||!u||(o&&(s(o),l(a),u({field:"prompt",selectionStart:o.length,selectionEnd:o.length})),t(),i(f=>(f.delete("new"),f.delete("newCwd"),f),{replace:!0}))},[o,a,s,l,u,t,i])}var d3r=k(N(),1);function f3r({launchers:e}){let[t,r]=(0,GQ.useState)(!1),[n,i]=(0,GQ.useState)(0),o=s3r(n),a=(0,GQ.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return l3r(a),u3r(o,a),!t||!o?null:(0,d3r.jsx)(n3r,{draft:o,launchers:e,onClose:()=>r(!1)})}var o2e=k(N(),1);function h3r({reconnecting:e}){return(0,o2e.jsx)(qh,{open:e,children:(0,o2e.jsx)(_i,{severity:"info",variant:"filled",icon:(0,o2e.jsx)(hi,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var nb=k(N(),1);function p3r({socket:e,onViewLaunchedSession:t}){return(0,nb.jsxs)(nb.Fragment,{children:[(0,nb.jsx)(a4r,{}),(0,nb.jsx)(f3r,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,nb.jsx)(h3r,{reconnecting:e.reconnecting}),(0,nb.jsx)(lc,{error:e.error,onClose:e.clearError}),(0,nb.jsx)(l4r,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var ib=k(oe(),1);var Ufi=6e4;function Wfi(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function m3r(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4022
|
+
`,wEr={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:`${ifi} 1.8s linear infinite`},afi={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${ofi} 1.6s ease-in-out infinite`,"&::before":{...wEr,inset:0,zIndex:-1},"&::after":{...wEr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:pl.rainbowPill.text,textShadow:pl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function kEr({children:e}){return(0,dP.jsxs)(dP.Fragment,{children:[(0,dP.jsx)(xE,{styles:nfi}),(0,dP.jsx)(q,{component:"span","data-testid":"rainbow-pill",sx:afi,children:e})]})}function _Er({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function EEr(e){if(e.length!==2)return!1;let[t,r]=e;return _Er(t)===_Er(r)}var sT=k(N(),1);function AEr({rateLimits:e}){let t=_g(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(o=>o.window?.used_percentage!=null),n=EEr(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:Fxe(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,sT.jsxs)(REr.Fragment,{children:[a>0?(0,sT.jsx)(q,{component:"span",sx:{color:iH,mr:.5},children:","}):null,(0,sT.jsx)(CEr,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,sT.jsx)(kEr,{children:i}):(0,sT.jsx)(sT.Fragment,{children:i})}var D5=k(N(),1);function LEr({groups:e}){return(0,D5.jsx)(D5.Fragment,{children:e.map((t,r)=>(0,D5.jsxs)(PEr.Fragment,{children:[(0,D5.jsx)(q,{component:"span",sx:{color:iH,ml:r>0?1:0,mr:.5},children:oc(t.harness)}),(0,D5.jsx)(AEr,{rateLimits:t.rateLimits})]},t.harness))})}var MEr={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 sfi(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function lfi(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function cfi(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function NEr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=cje(t,r,n);if(i==null)return{kind:"unprojectable"};let o=b5(e,t,r,n),a=sfi(o),s=lfi(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:cfi(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function zxe(e){return t=>t.tokens.color.onAppBar.level[e]}function OEr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${Bz(e.at,t)}`}var N5=k(N(),1),BEr={display:"contents"};function Lje({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,N5.jsxs)(q,{component:"span",sx:BEr,children:[(0,N5.jsx)("span",{}),(0,N5.jsx)("span",{})]});let n=(0,N5.jsx)(q,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),i=(0,N5.jsxs)(q,{component:"span",sx:{color:zxe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,N5.jsxs)(q,{component:"span",sx:BEr,children:[r?i:n,r?n:i]})}var FEr={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 O5=k(N(),1);function $Er({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=FEr,a=b5(t,r,n,i),s=NEr(t,r,n,i),l=s.kind==="projected"?s:void 0;return(0,O5.jsxs)(q,{sx:o.row,children:[(0,O5.jsx)(q,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,O5.jsx)(Lje,{direction:"back",threshold:l?.recovery}),(0,O5.jsxs)(q,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:o.pctWeight,color:zxe(a)},children:[Math.round(t),"%"]}),(0,O5.jsx)(Lje,{direction:"forward",threshold:l?.worse}),(0,O5.jsx)(q,{component:"span",sx:o.note,children:l?l.recovery&&OEr(l.recovery,i):"no projection yet"})]})}function Hxe(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 HEr=k(N(),1);function zEr({rateLimits:e,now:t}){return Hxe(e).map(r=>(0,HEr.jsx)($Er,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var hP=k(N(),1);function UEr({groups:e}){let t=_g(3e4),r=MEr;return(0,hP.jsxs)(q,{sx:r.root,children:[e.map(n=>(0,hP.jsxs)(q,{sx:r.group,children:[(0,hP.jsx)(q,{sx:r.heading,children:oc(n.harness)}),(0,hP.jsx)(zEr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,hP.jsx)(q,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var Mje=k(N(),1),ufi="Claude account usage (5h / 7d windows) \u2014 view history";function WEr(e){return e.length===0?{title:ufi,content:"Usage"}:{title:(0,Mje.jsx)(UEr,{groups:e}),content:(0,Mje.jsx)(LEr,{groups:e})}}var GEr={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}},VEr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var Ije=k(N(),1),ffi={};function qEr({rateLimits:e,harnessRateLimits:t=ffi}){let{title:r,content:n}=WEr(Bxe(e,t));return(0,Ije.jsx)(sr,{title:r,placement:"top-start",slotProps:VEr,children:(0,Ije.jsx)(Vr,{component:qa,to:"/usage",underline:"none",color:"inherit",sx:GEr,children:n})})}var KEr=k(oe(),1);var vh="0.973.0";var Uxe=k(oe(),1),Dje=(0,Uxe.createContext)(null);function Wxe(){return(0,Uxe.useContext)(Dje)}var Nje=k(N(),1);function jEr(){let e=Wxe();return!e||e===vh?null:(0,Nje.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${vh}. Restart the daemon to match.`,children:(0,Nje.jsx)(Exe,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var YEr=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?rb(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>rb(t).hover,color:t=>rb(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>rb(t).dot,boxShadow:t=>`0 0 0 3px ${rb(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>rb(t).readyText}});var Ag=k(N(),1);function XEr(){let{entries:e}=Tz(),t=jn(),r=(0,KEr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:i}=Qn("openUpdates");if(Mo(n,r),!vh)return null;let o=e.filter(Az).length;return(0,Ag.jsxs)(Ag.Fragment,{children:[(0,Ag.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,Ag.jsx)(Wu,{label:"Updates",chords:i}),children:(0,Ag.jsxs)(vr,{component:qa,to:"/updates","aria-label":o?`Updates: ${o} node${o>1?"s have":" has"} an update ready`:"Updates",sx:YEr(o>0),children:[o>0&&(0,Ag.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,Ag.jsxs)("span",{children:["v",vh]}),o>0&&(0,Ag.jsxs)("span",{className:"ready-count",children:[o," ready"]})]})}),(0,Ag.jsx)(jEr,{})]})}var Gxe=k(N(),1);function ZEr({socket:e}){return(0,Gxe.jsx)(xEr,{start:(0,Gxe.jsx)(qEr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,Gxe.jsx)(XEr,{})})}var Kxe=k(oe(),1);var Yxe=k(oe(),1);function QEr(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 B5=k(N(),1),dfi={display:"flex",gap:1,alignItems:"center",minWidth:0},hfi={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},pfi={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},mfi={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function gfi(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function JEr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,B5.jsx)(im,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=gfi(i);return(0,B5.jsxs)(mn,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:dfi,children:[(0,B5.jsx)(Iye,{path:i}),(0,B5.jsxs)(q,{sx:hfi,children:[(0,B5.jsx)(Le,{component:"span",sx:pfi,children:s}),(0,B5.jsx)(Le,{component:"span",color:"text.secondary",sx:mfi,children:a})]})]},i)})})}var Vxe=k(N(),1),yfi={maxHeight:420,overflowY:"auto"},vfi={px:2,py:2,fontSize:13};function e4r({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,Vxe.jsx)(q,{sx:yfi,children:e?(0,Vxe.jsx)(Le,{color:"text.secondary",sx:vfi,children:e}):(0,Vxe.jsx)(JEr,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var t4r=k(N(),1),bfi={mt:6,alignSelf:"flex-start"};function qxe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,t4r.jsx)(ec,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:bfi},transition:{onEntered:t}},children:n})}var jxe=k(oe(),1);var r4r={files:[],loading:!1,error:!1};function n4r(e,t){let[r,n]=(0,jxe.useState)(r4r),i=gr();return(0,jxe.useEffect)(()=>{if(!e){n(r4r);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await fr(Xr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,i));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(o)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch{o||n({files:[],loading:!1,error:!0})}})(),()=>{o=!0}},[e,t,i]),r}var pP=k(N(),1);function xfi(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function i4r({onClose:e}){let{worktreeNode:t}=Un();return(0,pP.jsx)(tu.Provider,{value:t,children:(0,pP.jsx)(Sfi,{onClose:e})})}function Sfi({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=Un(),[n,i]=(0,Yxe.useState)(""),o=n4r(t,n),a=jn(),s=(0,Yxe.useRef)(null),l=p=>a(xfi(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=k5(o.files,n,l,e),h=p=>{l(p),e()};return(0,pP.jsxs)(qxe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,pP.jsx)(PC,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,pP.jsx)(e4r,{message:QEr(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function o4r(e){Mo(Qn("quickOpen").matches,e)}var s4r=k(N(),1);function a4r(){let[e,t]=(0,Kxe.useState)(!1);return o4r((0,Kxe.useCallback)(()=>t(!0),[])),e?(0,s4r.jsx)(i4r,{onClose:()=>t(!1)}):null}var Xxe=k(N(),1);function l4r({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,Xxe.jsx)(qh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,Xxe.jsx)(_i,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,Xxe.jsx)(Rt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var GQ=k(oe(),1);function Zxe(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var S4r=k(oe(),1);var c4r=k(N(),1),u4r=nt((0,c4r.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 Tfi={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function f4r(e){return e?Tfi[e]:"success.main"}function d4r(e){return e.split("-")[0].split(".").map(Number)}function h4r(e,t){if(!e||!t||e===t)return;let r=d4r(e),n=d4r(t);for(let i=0;i<Math.max(r.length,n.length);i++){let o=(r[i]??0)-(n[i]??0);if(Number.isNaN(o))return;if(o!==0)return o<0?"behind":"ahead"}}var mP=k(N(),1),Cfi={height:16,fontSize:10},wfi={opacity:.6,fontSize:"0.85em"};function kfi(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 UQ({nodes:e,name:t,showVersion:r=!1}){let n=Wxe()??vh,i=e.links.find(a=>a.name===t),o=h4r(i?.peerVersion,n);return(0,mP.jsx)(sr,{title:kfi(e,t),placement:"right",children:(0,mP.jsxs)(q,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,mP.jsx)(u4r,{sx:{fontSize:8,color:f4r(i?.state)}}),t,r&&i?.peerVersion&&(0,mP.jsxs)(q,{component:"span",sx:wfi,children:["v",i.peerVersion]}),o&&(0,mP.jsx)(Gn,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:Cfi})]})})}var gP=k(N(),1),_fi={opacity:.6},Efi={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function p4r({nodes:e,name:t,clone:r}){let n=(0,gP.jsx)(UQ,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,gP.jsx)(q,{component:"span",sx:_fi,children:n}):(0,gP.jsx)(sr,{title:Wz(t,r.cloneTarget),children:(0,gP.jsxs)(q,{component:"span",sx:Efi,children:[(0,gP.jsx)(Uz,{sx:{fontSize:14}}),n]})})}var g4r=k(N(),1),Rfi={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 m4r({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,g4r.jsx)(vr,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:Rfi,children:t})}var y4r={ArrowRight:1,ArrowLeft:-1};function Afi(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+y4r[e.key]+r)%r}function v4r(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!y4r[i.key]){CS(i);return}let o=Afi(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var b4r=k(oe(),1);function oH(e){return e?.querySelector('[aria-checked="true"]')}function x4r(e,t){(0,b4r.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=oH(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var Oje=k(N(),1),Pfi={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function Qxe({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return x4r(o,r),(0,Oje.jsx)(_t,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:v4r(t,r,n,l),sx:Pfi,children:t.map(u=>(0,Oje.jsx)(m4r,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var Bje=k(N(),1);function T4r({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=Ks(),a=(0,S4r.useRef)(null);return!o||!n||!e?null:(0,Bje.jsx)(Qxe,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,Bje.jsx)(p4r,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var Jxe=k(N(),1);function C4r({prompt:e,children:t}){return(0,Jxe.jsxs)(_t,{children:[e,(0,Jxe.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var k4r=k(N(),1),Lfi=".MuiOutlinedInput-notchedOutline",Mfi={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${Lfi}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function w4r({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,k4r.jsx)($n,{sx:Mfi,value:e,onChange:a=>t(a.target.value),onKeyDown:CS,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var A4r=k(oe(),1);var sy={draft:{placeholder:"Describe the backlog item to draft...",submitLabel:"Start draft",sessionMode:"assist-draft"},bug:{placeholder:"Describe the bug: what happened, what you expected...",submitLabel:"File bug",sessionMode:"assist-bug"},prompt:{placeholder:E1e,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},_4r=Object.keys(sy);var Fje=k(N(),1);function E4r({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,Fje.jsx)(Gs,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,Fje.jsx)(mn,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:oc(o)},o))})}var yP=k(N(),1);function R4r(e){return t=>t==="prompt"&&e?(0,yP.jsxs)(yP.Fragment,{children:["prompt",(0,yP.jsx)(q,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${oc(e)}`}),(0,yP.jsx)(Ad,{sx:{fontSize:18,mr:-.75}})]}):t}var vP=k(N(),1);function P4r({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,A4r.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(oH(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,vP.jsxs)(vP.Fragment,{children:[(0,vP.jsx)(Qxe,{label:"Mode",options:_4r,value:e.mode,onChange:l,optionLabel:R4r(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,vP.jsx)(E4r,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var U4r=k(oe(),1);var $je=k(N(),1),Ifi={zIndex:e=>e.zIndex.modal+1};function L4r({open:e,anchor:t,children:r}){return(0,$je.jsx)(BL,{open:e,anchorEl:t,placement:"bottom-start",sx:Ifi,children:(0,$je.jsx)(Jr,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var M4r=k(N(),1),I4r=nt((0,M4r.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var zje=k(N(),1),Dfi={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},Nfi={fontSize:16,color:"text.disabled"};function D4r(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:Dfi,endAdornment:(0,zje.jsx)(TCe,{position:"end",children:(0,zje.jsx)(I4r,{sx:Nfi})})}}}var N4r=k(SL(),1);function O4r({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}CS(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,N4r.flushSync)(()=>{r(t),n()}),CS(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function e2e(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Yv(n).toLowerCase().includes(r)):e}var Hje=k(oe(),1);function B4r(){let[e,t]=(0,Hje.useState)(!1),[r,n]=(0,Hje.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var $4r=k(oe(),1);var F4r=e=>e?Yv(e):"";function z4r(e){let[t,r]=(0,$4r.useState)(()=>F4r(e));return{text:t,setText:r,showRepo:n=>r(F4r(n))}}function H4r(e,t,r){let n=B4r(),i=z4r(t),o=e2e(e,n.query),a=f=>{r(f),i.showRepo(f)},s=k5(o,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:i.text,filtered:o,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:O4r({open:n.open,highlighted:o[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:f=>{i.setText(f),n.filterBy(f)},onFocus:l,onBlur:()=>{n.close(),i.showRepo(t)},pick:f=>{a(f),n.close()}}}var aH=k(N(),1);function W4r({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=H4r(e,t,r),s=(0,U4r.useRef)(null);return(0,aH.jsxs)(q,{ref:s,sx:{flex:1,minWidth:0},children:[(0,aH.jsx)($n,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),o()},inputRef:n,autoFocus:i,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:D4r(a.open)}),(0,aH.jsx)(L4r,{open:a.open,anchor:s.current,children:(0,aH.jsx)(Txe,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var F5=k(N(),1);function G4r({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=Un();return(0,F5.jsxs)(C4r,{prompt:(0,F5.jsx)(w4r,{value:r.prompt,onChange:r.setPrompt,placeholder:sy[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,F5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,F5.jsx)(W4r,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,F5.jsx)(P4r,{...t})]}),(0,F5.jsx)(T4r,{value:r.node,onChange:r.setNode,cloneState:e})]})}var j4r=k(N(),1),V4r=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function q4r({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,j4r.jsx)(Rt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var bP=k(N(),1),Ofi=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"}),Bfi=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function Y4r(e){return(0,bP.jsxs)(_t,{direction:"row",sx:Ofi,children:[V4r.map(([t,r])=>(0,bP.jsxs)("span",{children:[(0,bP.jsx)(q,{component:"kbd",sx:Bfi,children:t}),r]},t)),(0,bP.jsx)(q,{sx:{flex:1}}),(0,bP.jsx)(q4r,{...e})]})}var xP=k(oe(),1);function K4r(e,t){let r=(0,xP.useRef)(e),n=(0,xP.useRef)(null),i=(0,xP.useRef)(null),o=(0,xP.useRef)(null),a=(0,xP.useCallback)(u=>{n.current=u;let{field:f,selectionStart:d,selectionEnd:h}=r.current;u&&f==="prompt"&&u.setSelectionRange(d,h)},[]),s=u=>{let f=u.target;t({field:"prompt",selectionStart:f.selectionStart,selectionEnd:f.selectionEnd})},l=()=>{if(o.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:i.current,mode:oH(o.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:i,modeRef:o,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function Ffi(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:wxe(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function X4r(e,t){let{names:r,visible:n}=Ks(),i=bxe(t,n?r:[void 0]);return{cloneState:i,target:Ffi(t,e,i(e))}}function t2e({mode:e,harness:t,prompt:r,cwd:n,node:i},o){let a=n||void 0,s=i?[i]:[];if(e==="prompt"){t==="claude"?o.onCreate(r,a,...s):o.onCreateHarness(t,r,a,...s);return}if(e==="design"){o.onCreateDesign(r,a,...s);return}let l=i?[{node:i}]:[];Omr(sy[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function Z4r(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(dxe(r.prompt,n.onCreateAssist),!0):(t2e({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var r2e=k(oe(),1);function Q4r(e,t){let[r,n]=(0,r2e.useState)(!1);return(0,r2e.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function J4r(e,t,r,n,i){let o=Q4r(e,()=>{Z4r(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var WQ=k(oe(),1);function e3r(e,t){let r=(0,WQ.useRef)(e),n=(0,WQ.useRef)(null);return(0,WQ.useEffect)(()=>{if(r.current&&!e){let i=n.current;i?.isConnected?i.focus():t()}r.current=e},[e,t]),i=>{n.current=i.target}}var r3r=k(N(),1),$fi={border:0,margin:0,padding:0,minWidth:0};function t3r({loading:e,restoreFocus:t,children:r}){let n=e3r(e,t);return(0,r3r.jsx)("fieldset",{disabled:e,style:$fi,onFocus:n,children:r})}var SP=k(N(),1);function n3r({draft:e,launchers:t,onClose:r}){let n=K4r(e.focus,e.setFocus),i=Zxe(Gv()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=X4r(e.node,e.cwd),l=J4r(e,o,a,t,r);return(0,SP.jsx)(qxe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,SP.jsx)("form",{onSubmit:l,children:(0,SP.jsxs)(t3r,{loading:e.modePending,restoreFocus:n.restore,children:[(0,SP.jsx)(G4r,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,SP.jsx)(Y4r,{submitLabel:a.kind==="clone"?"Clone":sy[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var n2e=k(oe(),1);var zfi=1e3;async function Hfi(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await fr(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(sy,n?.mode)?n.mode:null}catch{return null}}function i2e(e,t=0){let[r,n]=(0,n2e.useState)(null);return(0,n2e.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await Hfi(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,zfi))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function i3r(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var lT=k(oe(),1),o3r={field:"prompt",selectionStart:0,selectionEnd:0};function a3r(){let[e,t]=(0,lT.useState)(""),[r,n]=(0,lT.useState)(),[i,o]=(0,lT.useState)(),[a,s]=(0,lT.useState)("claude"),[l,u]=(0,lT.useState)(),[f,d]=(0,lT.useState)(o3r),h=(0,lT.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(o3r)},[]);return{prompt:e,cwd:r,mode:i,harness:a,node:l,focus:f,setPrompt:t,setNode:u,setCwd:n,setMode:o,setHarness:s,setFocus:d,clear:h}}function s3r(e,t=i2e){let{selectedCwd:r}=Un(),n=Ks(),i=a3r(),o=i.cwd??r,a=t(o,e);return a?{...i,cwd:o,mode:i.mode??a.mode,modePending:i.mode===void 0&&a.pending,node:i3r(i.node,n)}:null}function l3r(e){Mo(Qn("newSession").matches,e)}var c3r=k(oe(),1);function u3r(e,t){let{selectedCwd:r}=Un(),[n,i]=Jc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,c3r.useEffect)(()=>{o===null||!s||!l||!u||(o&&(s(o),l(a),u({field:"prompt",selectionStart:o.length,selectionEnd:o.length})),t(),i(f=>(f.delete("new"),f.delete("newCwd"),f),{replace:!0}))},[o,a,s,l,u,t,i])}var d3r=k(N(),1);function f3r({launchers:e}){let[t,r]=(0,GQ.useState)(!1),[n,i]=(0,GQ.useState)(0),o=s3r(n),a=(0,GQ.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return l3r(a),u3r(o,a),!t||!o?null:(0,d3r.jsx)(n3r,{draft:o,launchers:e,onClose:()=>r(!1)})}var o2e=k(N(),1);function h3r({reconnecting:e}){return(0,o2e.jsx)(qh,{open:e,children:(0,o2e.jsx)(_i,{severity:"info",variant:"filled",icon:(0,o2e.jsx)(hi,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var nb=k(N(),1);function p3r({socket:e,onViewLaunchedSession:t}){return(0,nb.jsxs)(nb.Fragment,{children:[(0,nb.jsx)(a4r,{}),(0,nb.jsx)(f3r,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,nb.jsx)(h3r,{reconnecting:e.reconnecting}),(0,nb.jsx)(lc,{error:e.error,onClose:e.clearError}),(0,nb.jsx)(l4r,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var ib=k(oe(),1);var Ufi=6e4;function Wfi(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function m3r(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4023
4023
|
`),[n,i]=(0,ib.useState)([]),o=(0,ib.useRef)(0),a=(0,ib.useCallback)(()=>{let l=r?r.split(`
|
|
4024
4024
|
`):[];if(l.length===0)return;let u=++o.current;i(f=>Wfi(f,l,t));for(let f of l)Gbe(f,f===t).then(d=>{u===o.current&&i(h=>h.map(p=>p.name===f?d:p))})},[r,t]);(0,ib.useEffect)(()=>{a();let l=setInterval(a,Ufi);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,ib.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var $5=k(N(),1);function g3r({shell:e,children:t}){let{socket:r,selection:n,launch:i,sidebarCollapse:o}=e,a=m3r(r.nodeSelection);return(0,$5.jsx)(eje.Provider,{value:a,children:(0,$5.jsx)(Y5e.Provider,{value:o,children:(0,$5.jsx)(xG.Provider,{value:n,children:(0,$5.jsx)(_5e.Provider,{value:r.nodeSelection,children:(0,$5.jsx)(tu.Provider,{value:n.selectedNode,children:(0,$5.jsx)(FWe.Provider,{value:i,children:(0,$5.jsx)(wlt,{children:t})})})})})})})}var y3r=k(N(),1),v3r=nt((0,y3r.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 b3r=k(oe(),1);var ly=k(N(),1),Gfi={ml:1,textTransform:"none",fontSize:12};function x3r(){let{nodes:e,names:t,visible:r,selected:n,select:i}=Ks(),[o,a]=(0,b3r.useState)(null);return!r||!e||!n?null:(0,ly.jsxs)(ly.Fragment,{children:[(0,ly.jsx)(Rt,{size:"small",color:"inherit",startIcon:(0,ly.jsx)(v3r,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:Gfi,children:(0,ly.jsx)(UQ,{nodes:e,name:n})}),(0,ly.jsx)(Gs,{anchorEl:o,open:!!o,onClose:()=>a(null),children:t.map(s=>(0,ly.jsx)(mn,{selected:s===n,onClick:()=>{i(s),a(null)},sx:{fontSize:13},children:(0,ly.jsx)(UQ,{nodes:e,name:s,showVersion:!0})},s))})]})}var VQ=k(oe(),1);function S3r(e,t){return[...e[0].slice(0,-1),String(t+1)]}var TP=k(N(),1),Vfi=[ja("secondary"),{ml:.75}];function T3r({index:e,label:t,count:r,...n}){let{chords:i}=Qn("navTab");return(0,TP.jsx)(sr,{describeChild:!0,title:(0,TP.jsx)(Wu,{label:t,chords:[S3r(i,e)]}),children:(0,TP.jsx)(Ub,{label:r?(0,TP.jsxs)("span",{children:[t,(0,TP.jsx)(q,{component:"span",sx:Vfi,children:r})]}):t,...n})})}var C3r=k(oe(),1);var qfi=6e4;function w3r(){let e=Fye();return(0,C3r.useEffect)(()=>{_c.refresh();let t=setInterval(()=>{_c.refresh()},qfi);return()=>clearInterval(t)},[]),e?.length??0}var Uje=k(oe(),1);function k3r(e,t){let{bound:r}=Qn("navTab"),n=e.length,i=(0,Uje.useCallback)(a=>(PG(a,r)??n)<n,[r,n]),o=(0,Uje.useCallback)(a=>{let s=e[PG(a,r)??-1];s&&t(s)},[e,t,r]);Mo(i,o)}var a2e=k(oe(),1);function _3r(){let[e,t]=(0,a2e.useState)(!1);return(0,a2e.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await fr("/api/news/nav")).json();r||t(i?.showInNav===!0)}catch{r||t(!1)}})(),()=>{r=!0}},[]),e}var s2e=k(oe(),1);async function jfi(e,t){let r=await fr(Xr(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function E3r(e){let[t,r]=(0,s2e.useState)(null),n=gr(),i=`${n??""}\0${e}`;return(0,s2e.useEffect)(()=>{if(!e)return;let o=!1;return jfi(e,n).catch(()=>{}).then(a=>{o||r({key:i,configured:a})}),()=>{o=!0}},[e,n,i]),t?.key===i?t.configured:void 0}var R3r=k(oe(),1);function A3r(e){let{pathname:t}=Wo(),r=jn(),n=t==="/releases"||t.startsWith("/releases/");(0,R3r.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var Yfi={path:"/sessions",label:"Sessions"},Kfi={path:"/backlog",label:"Backlog"},Xfi={path:"/next",label:"Next"},Zfi={path:"/releases",label:"Releases"},Qfi={path:"/news",label:"News"},Jfi={path:"/inbox",label:"Inbox"};function P3r(e,t){return[Yfi,Kfi,Xfi,...e?[Zfi]:[],...t?[Qfi]:[],Jfi]}var Wje=k(N(),1),edi={mx:"6px"};function L3r({cwd:e}){let t=Wo(),r=jn(),n=E3r(e),i=_3r(),o=w3r();A3r(n);let a=n===!0,s=(0,VQ.useMemo)(()=>P3r(a,i),[a,i]),l=(0,VQ.useMemo)(()=>s.map(d=>d.path),[s]),u=s.findIndex(d=>t.pathname.startsWith(d.path)),f=(0,VQ.useCallback)(d=>{t.pathname!==d&&r(d)},[t.pathname,r]);return k3r(l,f),(0,Wje.jsx)(JE,{sx:edi,value:u===-1?!1:u,textColor:"inherit",indicatorColor:"secondary",children:s.map((d,h)=>(0,Wje.jsx)(T3r,{index:h,label:d.label,count:d.path==="/inbox"?o:void 0,onClick:()=>f(d.path)},d.path))})}var qQ=k(N(),1),M3r=(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)"}}),tdi=e=>({ml:.75,...e.tokens.color.appBar?M3r("primary.main","primary.contrastText"):M3r("primary.contrastText","primary.main")});function I3r(){let[,e]=Jc(),{label:t,chords:r}=Qn("newSession");return(0,qQ.jsx)(sr,{title:(0,qQ.jsx)(Wu,{label:t,chords:r}),children:(0,qQ.jsx)(jt,{sx:tdi,"aria-label":"New session",onClick:()=>e(i=>(i.set("new",""),i),{replace:!0}),children:(0,qQ.jsx)(wm,{})})})}var l2e=k(oe(),1);var jQ=k(N(),1),rdi={strokeWidth:2};function D3r(e){return(0,jQ.jsxs)(P1e,{viewBox:"0 0 24 24",sx:rdi,...e,children:[(0,jQ.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,jQ.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}var YQ=k(N(),1);function N3r({cwd:e}){let[t,r]=(0,l2e.useState)(null),n=gr();return(0,l2e.useEffect)(()=>{if(!e){r(null);return}let i=!1;return(async()=>{try{let a=await(await fr(Xr(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();i||r(a?.url??null)}catch{i||r(null)}})(),()=>{i=!0}},[e,n]),t?(0,YQ.jsx)(sr,{title:"Open in GitHub",children:(0,YQ.jsx)(q,{component:"span",sx:L1e,children:(0,YQ.jsx)(jt,{onClick:()=>window.open(t,"_blank"),children:(0,YQ.jsx)(D3r,{})})})}):null}var cy=k(N(),1),ndi={color:"inherit",mr:1.5};function O3r({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:i}=v5("webserver",e);return(0,cy.jsxs)(cy.Fragment,{children:[(0,cy.jsx)(sr,{title:"Restart web server",children:(0,cy.jsx)("span",{children:(0,cy.jsx)(jt,{sx:ndi,disabled:t,onClick:i,children:t?(0,cy.jsx)(hi,{size:24}):(0,cy.jsx)(l$,{})})})}),(0,cy.jsx)(lc,{error:r,onClose:n})]})}var $3r=k(oe(),1);var B3r=k(oe(),1);function F3r(e){let t=Pn().palette.primary.main;Mo(Qn("focusRepoPicker").matches,(0,B3r.useCallback)(()=>ac({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var KQ=k(N(),1),idi={width:240,ml:2};function z3r({repos:e,selected:t,onSelect:r}){let n=(0,$3r.useRef)(null);F3r(n);let{chords:i}=Qn("focusRepoPicker");return(0,KQ.jsx)(q,{ref:n,sx:idi,children:(0,KQ.jsx)(R1e,{label:t?Yv(t):"Select repo...",tooltip:(0,KQ.jsx)(Wu,{label:"Repo",chords:i}),typeToOpen:!0,children:(o,a)=>(0,KQ.jsx)(d_r,{repos:e,selected:t,onSelect:r,close:o,initialFilter:a})})})}var X3r=k(oe(),1);var XQ=k(oe(),1);function c2e(e){let[t,r]=(0,XQ.useState)([]),[n,i]=(0,XQ.useState)(!0),o=gr();return(0,XQ.useEffect)(()=>{if(!e){r([]),i(!1);return}let a=!1;return i(!0),fr(Xr(`/api/pr-list?cwd=${encodeURIComponent(e)}`,o)).then(s=>s.json()).then(s=>{a||(r(Array.isArray(s?.prs)?s.prs:[]),i(!1))}).catch(()=>{a||(r([]),i(!1))}),()=>{a=!0}},[e,o]),{prs:t,loading:n}}var Gje=k(N(),1);function Vje({text:e}){return(0,Gje.jsx)(q,{sx:{p:1.5},children:(0,Gje.jsx)(Le,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var CP=k(N(),1);function H3r({pr:e,highlighted:t,onHover:r,onPick:n}){let i=Sxe(t);return(0,CP.jsx)(mn,{ref:i,selected:t,onMouseDown:o=>o.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,CP.jsxs)(_t,{spacing:.25,sx:{minWidth:0},children:[(0,CP.jsxs)(Le,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,CP.jsx)(Gn,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,CP.jsxs)(Le,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",Ei(e.createdAt)]})]})})}var qje=k(N(),1);function U3r({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,qje.jsx)(im,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((i,o)=>(0,qje.jsx)(H3r,{pr:i,highlighted:o===t,onHover:()=>r(o),onPick:n},i.number))})}var G3r=k(oe(),1);function W3r(e,t){let r=t.trim().toLowerCase();if(!r)return e;let n=r.replace(/^#/,"");return e.filter(i=>i.title.toLowerCase().includes(r)||i.author.toLowerCase().includes(r)||n!==""&&String(i.number).includes(n))}function V3r(e,t,r){let[n,i]=(0,G3r.useState)(""),o=W3r(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=k5(o,n,t,r);return{filter:n,setFilter:i,filtered:o,highlight:a,setHighlight:s,onKeyDown:l,select:f=>{t(f),r()}}}var z5=k(N(),1),q3r={...P$,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function j3r({cwd:e,onPick:t,close:r}){let{prs:n,loading:i}=c2e(e),o=V3r(n,t,r);return i||n.length===0?(0,z5.jsx)(Jr,{elevation:4,sx:q3r,children:(0,z5.jsx)(Vje,{text:i?"Loading open PRs\u2026":"No open PRs"})}):(0,z5.jsxs)(Jr,{elevation:4,sx:q3r,children:[(0,z5.jsx)(PC,{autoFocus:!0,value:o.filter,onChange:o.setFilter,onKeyDown:o.onKeyDown,placeholder:"Filter PRs..."}),o.filtered.length===0?(0,z5.jsx)(Vje,{text:"No PRs match"}):(0,z5.jsx)(U3r,{prs:o.filtered,highlight:o.highlight,onHighlight:o.setHighlight,onPick:o.select})]})}var K3r=k(N(),1);function Y3r({cwd:e,onPick:t,close:r}){return(0,K3r.jsx)(j3r,{cwd:e,onPick:t,close:r})}var H5=k(N(),1);function Z3r({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:i}=c2e(e),[o,a]=(0,X3r.useState)(null);return i||n.length===0?null:(0,H5.jsxs)(H5.Fragment,{children:[(0,H5.jsx)(R1e,{label:"prs",disabled:t,children:s=>(0,H5.jsx)(Y3r,{cwd:e,onPick:a,close:s})}),o&&(0,H5.jsx)(a1e,{pr:o,onSelect:s=>{r(o,s),a(null)},onCancel:()=>a(null)})]})}var J3r=k(N(),1);function Q3r({onStartRun:e,cwd:t}){let r=k1e(t);return!t||r.length===0?null:(0,J3r.jsx)(C1e,{runs:r,onSelect:n=>e(n,t)})}var ZQ=k(N(),1);function eRr({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=Un();return(0,ZQ.jsxs)(_t,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:1.5}},children:[(0,ZQ.jsx)(Z3r,{cwd:r,disabled:!r,onSelect:(i,o)=>e([...o,String(i.number)],r,{...k_(i),node:n})}),(0,ZQ.jsx)(Q3r,{onStartRun:(i,o)=>t(i,o,void 0,void 0,n),cwd:r})]})}var Bp=k(N(),1),odi={minHeight:48,pl:1,pr:14};function tRr({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=zC();return(0,Bp.jsxs)(QE,{variant:"dense",disableGutters:!0,sx:odi,children:[r&&(0,Bp.jsx)(doe,{collapsed:r,onToggleCollapsed:n}),(0,Bp.jsx)(O3r,{reconnecting:e.reconnecting}),(0,Bp.jsx)(L3r,{cwd:t.selectedCwd}),(0,Bp.jsx)(x3r,{}),(0,Bp.jsx)(z3r,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,Bp.jsxs)(q,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,Bp.jsx)(M1e,{cwd:t.selectedCwd}),(0,Bp.jsx)(N3r,{cwd:t.selectedCwd}),(0,Bp.jsx)(I3r,{})]}),(0,Bp.jsx)(eRr,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun})]})}var u2e=k(oe(),1);function rRr(){let[e,t]=(0,u2e.useState)(null);return(0,u2e.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await fr("/api/health")).json();!r&&typeof i?.nodeName=="string"&&t(i.nodeName)}catch{}})(),()=>{r=!0}},[]),e}var iRr=k(N(),1),adi={lineHeight:"32px",bgcolor:"transparent"};function nRr(){let e=rRr();return e?(0,iRr.jsx)(JTe,{sx:adi,children:e}):null}var oRr=k(N(),1),aRr=nt((0,oRr.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 sRr=k(N(),1),lRr=nt((0,sRr.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 cRr=k(N(),1),uRr=nt((0,cRr.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 fRr=k(N(),1),dRr=nt((0,fRr.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 jje=k(N(),1);function hRr({mode:e}){return e==="dark"?(0,jje.jsx)(dRr,{fontSize:"small"}):(0,jje.jsx)(uRr,{fontSize:"small"})}var pRr=k(N(),1),mRr=nt((0,pRr.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 sH=k(N(),1);function gRr(){let e=p1e();return(0,sH.jsxs)(mn,{onClick:()=>j1t(!e),children:[(0,sH.jsx)(YT,{children:(0,sH.jsx)(mRr,{fontSize:"small"})}),(0,sH.jsx)(nm,{children:e?"Hide render HUD":"Show render HUD"})]})}var xl=k(N(),1);function yRr({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onShowShortcuts:i,onRestart:o,onUpdate:a}){return[(0,xl.jsxs)(mn,{onClick:n,children:[(0,xl.jsx)(YT,{children:(0,xl.jsx)(hRr,{mode:e})}),(0,xl.jsx)(nm,{children:"Toggle dark mode"})]},"color-mode"),(0,xl.jsx)(gRr,{},"render-hud"),(0,xl.jsxs)(mn,{onClick:i,children:[(0,xl.jsx)(YT,{children:(0,xl.jsx)(aRr,{fontSize:"small"})}),(0,xl.jsx)(nm,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,xl.jsx)(oi,{},"restart-divider"),(0,xl.jsxs)(mn,{onClick:o,children:[(0,xl.jsx)(YT,{children:(0,xl.jsx)(L8,{fontSize:"small"})}),(0,xl.jsx)(nm,{children:t})]},"restart"),(0,xl.jsxs)(mn,{onClick:a,children:[(0,xl.jsx)(YT,{children:(0,xl.jsx)(lRr,{fontSize:"small"})}),(0,xl.jsx)(nm,{children:r})]},"update")]}var vRr=k(oe(),1);var xRr=k(N(),1);function bRr({peer:e,onRestart:t,onClose:r}){let[n,i]=(0,vRr.useState)(!1);return(0,xRr.jsx)(Ai,{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:()=>{i(!0),t(e).finally(r)},onCancel:r})}function SRr(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 sdi=Object.keys(w8);function TRr(){let e=k8();return SRr(sdi.map(t=>NC(t,e)))}var Fp=k(N(),1),ldi={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},cdi={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function CRr({onClose:e}){let t=TRr();return(0,Fp.jsxs)(ec,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,Fp.jsxs)(Bu,{id:"shortcuts-dialog-title",sx:ldi,children:["Keyboard shortcuts",(0,Fp.jsx)(jt,{size:"small","aria-label":"Close",onClick:e,children:(0,Fp.jsx)(Ri,{fontSize:"small"})})]}),(0,Fp.jsx)(Ou,{dividers:!0,children:t.map(r=>(0,Fp.jsxs)(q,{component:"section",sx:{mb:1.5},children:[(0,Fp.jsx)(Le,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,Fp.jsxs)(q,{sx:cdi,children:[(0,Fp.jsx)(Le,{variant:"body2",children:n.label}),(0,Fp.jsx)(_t,{direction:"row",spacing:.5,children:(0,Fp.jsx)(Vie,{chords:n.chords})})]},n.label))]},r.name))})]})}var wP=k(N(),1);function wRr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:i,restart:o}=v5(Mz.target,e);return(0,wP.jsxs)(wP.Fragment,{children:[(0,wP.jsx)(Ai,{title:Mz.label,message:Mz.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{o()},onCancel:t}),(0,wP.jsx)(lc,{error:n,onClose:i})]})}var _Rr=k(N(),1);function udi(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 kRr({peer:e,onConfirm:t,onClose:r}){return(0,_Rr.jsx)(Ai,{...udi(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var uy=k(oe(),1);async function fdi(e){try{let t=await fr(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch{return null}}async function ERr(e,t){let r=await fdi(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var cT=k(oe(),1);function RRr(e){let{nodes:t}=Ks(),[r,n]=(0,cT.useState)(null),i=(0,cT.useRef)(!1),o=r?t?.links.find(l=>l.name===r.peer):void 0;(0,cT.useEffect)(()=>{if(!(!r||!o)){if(o.state!=="connected"){i.current=!0;return}i.current&&(n(null),e(r.describe(r.peer,o.peerVersion)))}},[r,o,e]);let a=(0,cT.useCallback)((l,u)=>{i.current=!1,n({peer:l,describe:u})},[]),s=(0,cT.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var ddi=9e4;function f2e(){let[e,t]=(0,uy.useState)(null),[r,n]=(0,uy.useState)(null),i=(0,uy.useRef)(void 0),o=(0,uy.useCallback)(f=>{clearTimeout(i.current),t(f)},[]),{watch:a,stop:s}=RRr(o);(0,uy.useEffect)(()=>()=>clearTimeout(i.current),[]);let l=(0,uy.useCallback)(async(f,d)=>{n(await ERr(f,d))},[]);return{requestThenAwait:(0,uy.useCallback)(async(f,d,h,p)=>{let m;try{m=await h()}catch{}return m?.ok?(a(f,p),clearTimeout(i.current),i.current=setTimeout(()=>{s(),l(f,`${f} did not come back`)},ddi),!0):(await l(f,`${d} failed (${await Lz(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var hdi=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function ARr(){let{requestThenAwait:e,...t}=f2e();return{restart:n=>e(n,`Restart ${n}`,()=>y5("both",n),hdi),...t}}var QQ=k(oe(),1);var fy=k(oe(),1);function PRr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function d2e(e,t,r){let[n,i]=(0,fy.useState)(!1),[o,a]=(0,fy.useState)(!1),s=(0,fy.useRef)(!1),l=(0,fy.useRef)(e);l.current=e;let u=(0,fy.useRef)(new Set),f=(0,fy.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(PRr).map(d=>d.id)),i(!0)},[]);return(0,fy.useEffect)(()=>{if(!n||o)return;if(t){s.current=!0;return}if(!s.current)return;e.some(h=>PRr(h)&&h.node===r&&!u.current.has(h.id))&&a(!0)},[n,o,t,e,r]),{arm:f,completed:o}}var LRr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function pdi(e){return fr(`/api/self-update?node=${encodeURIComponent(e)}`,{method:"POST"})}function MRr(e){let{nodes:t}=Ks(),{launchAssist:r}=ml(),{requestThenAwait:n,...i}=f2e(),[o,a]=(0,QQ.useState)(null),[s,l]=(0,QQ.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:f,completed:d}=d2e(e,u(s)!=="connected",s);(0,QQ.useEffect)(()=>{!d||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>y5("webserver",s),LRr))},[d,s,n]);let h=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>pdi(m),LRr),a(null)};return{update:m=>{if(u(m)!=="connected"){h(m);return}l(m),f(),r(["update"],void 0,{node:m})},progress:o,...i}}var dy=k(N(),1);function IRr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:i}){let{launchAssist:o,armUpdateReload:a}=ml(),s=ARr(),l=MRr(r);return(0,dy.jsxs)(dy.Fragment,{children:[e==="shortcuts"&&(0,dy.jsx)(CRr,{onClose:i}),e==="restart"&&t&&(0,dy.jsx)(bRr,{peer:t,onRestart:s.restart,onClose:i}),e==="restart"&&!t&&(0,dy.jsx)(wRr,{reconnecting:n,onClose:i}),e==="update"&&(0,dy.jsx)(kRr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),o(["update"])},onClose:i}),(0,dy.jsx)(fQ,{notices:s}),(0,dy.jsx)(fQ,{notices:l})]})}var DRr=k(N(),1),NRr=nt((0,DRr.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 h2e=k(N(),1),mdi="https://staffordwilliams.com/assist";function ORr(){return(0,h2e.jsx)(sr,{title:"Help",children:(0,h2e.jsx)(jt,{component:"a",href:mdi,target:"_blank",rel:"noopener noreferrer","aria-label":"Help",size:"small",sx:{color:"inherit"},children:(0,h2e.jsx)(NRr,{fontSize:"small"})})})}var BRr=k(N(),1),FRr=nt((0,BRr.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 $Rr=k(oe(),1);var JQ=k(N(),1);function zRr(){let e=jn(),t=(0,$Rr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=Qn("openConfig");return Mo(r,t),(0,JQ.jsx)(sr,{describeChild:!0,title:(0,JQ.jsx)(Wu,{label:"Config",chords:n}),children:(0,JQ.jsx)(jt,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,JQ.jsx)(FRr,{fontSize:"small"})})})}var HRr=k(N(),1),URr=nt((0,HRr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var p2e=k(oe(),1);var eJ=k(N(),1);function WRr({open:e,onOpen:t}){let r=(0,p2e.useRef)(null),{matches:n,chords:i}=Qn("openMenu");return Mo(n,(0,p2e.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,eJ.jsx)(sr,{describeChild:!0,title:(0,eJ.jsx)(Wu,{label:"Menu",chords:i}),children:(0,eJ.jsx)(jt,{ref:r,onClick:o=>t(o.currentTarget),size:"small",sx:{color:"inherit"},"aria-label":"Open menu","aria-haspopup":"true","aria-expanded":e?"true":void 0,children:(0,eJ.jsx)(URr,{fontSize:"small"})})})}var lH=k(N(),1);function GRr({open:e,onOpen:t}){return(0,lH.jsxs)(q,{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,lH.jsx)(ORr,{}),(0,lH.jsx)(zRr,{}),(0,lH.jsx)(WRr,{open:e,onOpen:t})]})}var kP=k(oe(),1);var qRr=k(oe(),1);var VRr=!0,gdi=new Set(["openMenu","cycleCards"]),ydi=Object.keys(w8).filter(e=>!gdi.has(e));function jRr(e,t){let r=k8();(0,qRr.useEffect)(()=>{if(!e)return;let n=i=>{ydi.some(o=>NC(o,r).matches(i))&&t()};return globalThis.addEventListener("keydown",n,VRr),()=>globalThis.removeEventListener("keydown",n,VRr)},[e,t,r])}function YRr(){let[e,t]=(0,kP.useState)(null),[r,n]=(0,kP.useState)(!0),i=!!e,o=(0,kP.useCallback)(()=>t(null),[]),a=(0,kP.useCallback)(s=>{n(!0),t(s)},[]);return jRr(i,(0,kP.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:i,close:o,openAt:a,restoreFocus:r}}var tJ=k(oe(),1);function KRr(e){Mo(Qn("shortcutsSheet").matches,e)}function XRr(){let[e,t]=(0,tJ.useState)(null);KRr((0,tJ.useCallback)(()=>t("shortcuts"),[]));let r=(0,tJ.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function ZRr(){let{nodes:e,selected:t}=Ks();return e&&t&&t!==e.local?t:void 0}function QRr(e){return{restartLabel:e?`Restart ${e}`:Mz.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}var uT=k(N(),1);function JRr({mode:e,toggle:t,sessions:r,reconnecting:n}){let{anchorEl:i,open:o,close:a,openAt:s,restoreFocus:l}=YRr(),{dialog:u,showDialog:f,closeDialog:d}=XRr(),h=ZRr(),p=m=>()=>{a(),f(m)};return(0,uT.jsxs)(uT.Fragment,{children:[(0,uT.jsx)(GRr,{open:o,onOpen:s}),(0,uT.jsxs)(Gs,{anchorEl:i,open:o,onClose:a,disableRestoreFocus:!l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,uT.jsx)(nRr,{}),yRr({mode:e,...QRr(h),onToggleColorMode:()=>{t(),a()},onShowShortcuts:p("shortcuts"),onRestart:p("restart"),onUpdate:p("update")})]}),(0,uT.jsx)(IRr,{dialog:u,peer:h,sessions:r,reconnecting:n,onClose:d})]})}var rAr=k(oe(),1);var tAr=k(N(),1);function eAr({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:i,port:o,group:a}=e.existing,s=Ea(i),l=o?` on port ${o}`:"",u=s?` in ${s}`:"",f=a?`, holding the ${a} server slot`:"";return(0,tAr.jsx)(Ai,{title:a?`Replace the ${a} server?`:"Replace running server?",message:`"${n}" is already serving${l}${u}${f}. Replace it \u2014 stop the running server and start this one?`,confirmLabel:"Replace",confirmColor:"error",onConfirm:t,onCancel:r})}var m2e=k(N(),1);function nAr({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:i,stopSession:o,startRun:a,discardSession:s}=e,l=(0,rAr.useMemo)(()=>({onStop:o,onStart:a,onDiscard:s}),[o,a,s]),u=()=>{r&&(r.runName?a(r.runName,r.cwd,!0,r.launchedFrom,r.node):r.sessionId&&i(r.sessionId,!0),n())};return(0,m2e.jsxs)(z5e.Provider,{value:l,children:[t,r&&(0,m2e.jsx)(eAr,{conflict:r,onConfirm:u,onCancel:n})]})}var iAr=new Map;function oAr(e,t){if(!Kae())return;let r=iAr.get(e);if(iAr.set(e,t),!!r)for(let[n,i]of Object.entries(t))Object.is(i,r[n])||Zy(`\u0394 ${e}.${n}`)}var y2e=k(oe(),1);function aAr(e,t,r){if(!t)return null;let n=e[t];if(!n)return null;let i=r.find(o=>o.id===n);return!i||xm(i)!==t?null:n}function ob(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function g2e(){let{pathname:e}=Wo();return e.startsWith("/backlog")||e.startsWith("/usage")}function sAr({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:i,onSelect:o}){let a=ob(t,r,n),s=a&&xm(a),l=!!(s&&s===e),u=aAr(i,e,r),f=(0,y2e.useRef)(t),d=g2e();(0,y2e.useEffect)(()=>{let h=f.current!==t&&!!s;f.current=t,!(d||h||l||!u)&&o(u)},[t,s,l,u,o,d])}var x2e=k(oe(),1);function lAr(e,t,r,n){return ob(e,t,r)?.cwd||n}function cAr(e,t,r,n){let i=lAr(e,t,r,n.cwd),o=ob(e,t,r);return{cwd:i,node:o?.cwd?o.node:n.node}}var Yje=k(oe(),1);function uAr(e,t,r){let{cwd:n,node:i,origin:o}=r,a=(0,Yje.useCallback)((l,u)=>{let f=oy(u,t),d=IQ(e,l);return d?d.clones[f]:f===(l===n?i:Op)?l:void 0},[e,t,n,i]),s=(0,Yje.useCallback)(l=>IQ(e,l)?.origin??(l===n?o:void 0),[e,n,o]);return{cloneOn:a,originOf:s}}var v2e=k(oe(),1);function fAr(e,t,r,n){let i=(0,v2e.useRef)(e);(0,v2e.useEffect)(()=>{if(i.current===e)return;i.current=e;let o=IQ(t,r)?.clones[e];o&&n(o,e)},[e,t,r,n])}var cH=k(oe(),1);function dAr(e,t,r){if(t.node!==void 0)return t.node;let n=new Set(e.flatMap(i=>Object.entries(i.clones).filter(([,o])=>o===t.cwd).map(([o])=>o)));return n.has(r)?r:n.size===0||n.has(Op)?Op:[...n][0]}function hAr(e,t,r,n){let[i,o]=(0,cH.useState)({cwd:e}),a=(0,cH.useCallback)((l,u,f)=>o({cwd:l,node:u,origin:f}),[]);(0,cH.useEffect)(()=>{e&&!i.cwd&&o({cwd:e})},[e,i.cwd]);let s=dAr(t,{cwd:i.cwd,node:i.node===void 0?void 0:oy(i.node,n)},r);return{selectedCwd:i.cwd,selectedNode:s||void 0,selectedPick:{cwd:i.cwd,node:s,origin:i.origin},setSelectedCwd:a}}var pAr=k(oe(),1);function b2e(e,t,r){let n=ob(e,t,r);return n&&xm(n)}function mAr(e,t,r,n){let i=b2e(e,t,r),o=ob(e,t,r),a=o?.node??Op,s=o?.repoGroup?.origin;(0,pAr.useEffect)(()=>{i&&n(i,a,s)},[i,a,s,n])}function gAr(e,t,r,n,i){let o=i.nodes?.local,a=oy(i.selected,o),s=(0,x2e.useMemo)(()=>Pxe(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:f,setSelectedCwd:d}=hAr(e,s,a,o);mAr(r,n,t,d),fAr(a,s,l,d);let{cloneOn:h,originOf:p}=uAr(s,o,f),m=(0,x2e.useMemo)(()=>s.map(v=>B_r(v,a)),[s,a]),{cwd:g,node:y}=cAr(r,n,t,{cwd:l,node:u});return(0,x2e.useMemo)(()=>({repos:m,selectedCwd:l,selectedNode:u,worktreeCwd:g,worktreeNode:y,setSelectedCwd:d,cloneOn:h,originOf:p}),[m,l,u,g,y,d,h,p])}var T2e=k(oe(),1);var U5=k(oe(),1);var yAr=k(oe(),1),S2e="assist:reloaded-after-update";function vAr(e){(0,yAr.useEffect)(()=>{globalThis.sessionStorage?.getItem(S2e)&&(globalThis.sessionStorage.removeItem(S2e),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function bAr(e,t,r,n){let{arm:i,completed:o}=d2e(e,t),a=(0,U5.useRef)(!1),s=(0,U5.useCallback)(()=>{globalThis.sessionStorage?.setItem(S2e,"1")},[]),{error:l,restart:u}=v5("webserver",t,s);return vAr(r),(0,U5.useEffect)(()=>{l&&n(l)},[l,n]),(0,U5.useEffect)(()=>{!o||a.current||(a.current=!0,u())},[o,u]),{armUpdateReload:(0,U5.useCallback)(()=>{a.current=!1,i()},[i])}}function xAr(e){let{armUpdateReload:t}=bAr(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=Wy(e.selectSession),n=(0,T2e.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]),i=jn(),o=(0,T2e.useCallback)(a=>{e.selectSession(a),i("/sessions"),e.clearSuccess()},[i,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:o}}var SAr=k(oe(),1);function TAr(e,t,r,n){let i=b2e(e,t,r);(0,SAr.useEffect)(()=>{e&&i&&n({type:"set-active",cwd:i,sessionId:e})},[e,i,n])}var C2e=k(oe(),1);function CAr(e,t){let r=(0,C2e.useRef)(new Map);(0,C2e.useEffect)(()=>{let n=new Set;for(let{id:i,status:o}of e)n.add(i),r.current.get(i)!==o&&(r.current.set(i,o),console.debug(`[sessions] render session ${i} status=${o}`),t({type:"ui-status",sessionId:i,status:o}));for(let i of r.current.keys())n.has(i)||r.current.delete(i)},[e,t])}var uH=k(oe(),1),wAr="assist.sessions.node";function vdi(){try{return localStorage.getItem(wAr)}catch{return null}}function bdi(e){try{localStorage.setItem(wAr,e)}catch{}}function kAr(e){let[t,r]=(0,uH.useState)(vdi),n=(0,uH.useCallback)(i=>{r(i),bdi(i)},[]);return(0,uH.useMemo)(()=>{let i=e?[e.local,...e.links.map(o=>o.name)]:[];return{nodes:e,names:i,visible:i.length>1,selected:t&&i.includes(t)?t:e?.local,select:n}},[e,t,n])}var EAr=k(oe(),1);function _Ar(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 RAr(e,t){return(0,EAr.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let i=_Ar(r);i&&t(i)},[e,t])}var ab=k(oe(),1);function w2e(e,t,r,n,i){e({type:"create",prompt:r||void 0,cwd:n,...t,...i?{node:i}:{}})}function AAr(e){return(t,r,n)=>w2e(e,{design:!0},t,r,n)}function PAr(e){return(t,r,n,i)=>w2e(e,{harness:t},r,n,i)}function LAr(e){return(t,r,n)=>w2e(e,{auto:!0},t,r,n)}function MAr(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function IAr(e){return(t,r,n,i,o)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:i,node:o})}function DAr(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function NAr(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function OAr(e,t){return r=>{e({type:"dismiss",sessionId:r}),t.delete(r)}}function BAr(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function FAr(e){return t=>e({type:"stop",sessionId:t})}function $Ar(e){return(t,r,n,i,o)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:i,node:o})}function zAr(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function HAr(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function UAr(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function WAr(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:X6})}function GAr(e){return(t,r,n,i)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:X6,claim:i==="claim",refresh:i==="refresh"})}function VAr(e){return(t,r,n,i)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...i})}var _P=k(oe(),1);function qAr(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function jAr(e){return{createSession:(0,_P.useMemo)(()=>LAr(e),[e]),createSessionInStream:(0,_P.useMemo)(()=>qAr(e),[e]),createDesignSession:(0,_P.useMemo)(()=>AAr(e),[e]),createHarnessSession:(0,_P.useMemo)(()=>PAr(e),[e]),createAssistSession:(0,_P.useMemo)(()=>MAr(e),[e]),resumeSession:(0,_P.useMemo)(()=>IAr(e),[e])}}var rJ=k(oe(),1);function YAr(e,t){let r=(0,rJ.useCallback)((a,s)=>{DAr(e,t.current)(a,s)},[e,t]),n=(0,rJ.useCallback)(a=>{NAr(e,t.current)(a)},[e,t]),i=(0,rJ.useCallback)(a=>{OAr(e,t.current)(a)},[e,t]),o=(0,rJ.useCallback)(a=>{BAr(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:i,discardSession:o}}function KAr(e,t,r){return(n,i)=>{let o=t.get(n);return o&&(i(o),e({type:"snapshot",sessionId:n})),r.set(n,i),()=>r.delete(n)}}function XAr(e,t,r){let n={...jAr(e),sendInput:(0,ab.useMemo)(()=>WAr(e),[e]),sendResize:(0,ab.useMemo)(()=>GAr(e),[e]),sendPrDecision:(0,ab.useMemo)(()=>VAr(e),[e]),setAutoApprove:(0,ab.useMemo)(()=>zAr(e),[e]),setAutoAdvance:(0,ab.useMemo)(()=>HAr(e),[e]),setStarred:(0,ab.useMemo)(()=>UAr(e),[e]),stopSession:(0,ab.useMemo)(()=>FAr(e),[e]),startRun:(0,ab.useMemo)(()=>$Ar(e),[e])},i=(0,ab.useMemo)(()=>KAr(e,t.current,r.current),[e,t,r]);return{...n,...YAr(e,t),onOutput:i}}var nJ=k(oe(),1);function ZAr(e,t,r){let n=(0,nJ.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),i=(0,nJ.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),o=(0,nJ.useCallback)(()=>{r(null)},[r]),a=(0,nJ.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:i,clearTranscript:o,selectSession:a}}var R2e=k(oe(),1);function QAr(e,t){let r=new Set(t.map(i=>i.id)),n=null;for(let i of Object.values(e))r.has(i)&&(n=i);return n}var fH=k(oe(),1);function JAr(){let[e,t]=(0,fH.useState)(null),r=(0,fH.useRef)(e);r.current=e;let n=(0,fH.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var t6r=k(oe(),1);function e6r(e,t,r=null){return t!==null?e.some(n=>n.id===t)?t:e[0]?.id??null:r&&e.some(n=>n.id===r)?r:e[0]?.id??null}function r6r(e,t,r){let n=g2e();(0,t6r.useEffect)(()=>{if(n){t(null);return}t(i=>e6r(e,i,r))},[e,t,r,n])}var k2e=k(oe(),1);function n6r(){let[e,t]=(0,k2e.useState)({}),[r,n]=(0,k2e.useState)(null),[i,o]=(0,k2e.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:i,setNodes:o}}var hy=k(oe(),1);function i6r(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function o6r(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function a6r(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 s6r(e,t){let r=[];for(let n of t){let i=e.get(n.id);i!==void 0&&i!==n.startedAt&&r.push(n.id)}return r}function l6r(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var xdi=1500;function c6r(){let[e,t]=(0,hy.useState)(new Set),r=(0,hy.useRef)(new Map),n=(0,hy.useRef)(new Map),i=(0,hy.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),o=(0,hy.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),i(u)},xdi))},[i]);(0,hy.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,hy.useCallback)(s=>{let l=o6r(r.current,s),u=[...s6r(r.current,s),...l],f=l6r(r.current,s);r.current=new Map(s.map(d=>[d.id,d.startedAt])),i6r(n.current,l),u.length&&t(d=>a6r(d,u)),o(f)},[o]);return{initialized:e,markInitialized:i,syncSessions:a}}var W5=k(oe(),1);function u6r(){let[e,t]=(0,W5.useState)(null),[r,n]=(0,W5.useState)(null),[i,o]=(0,W5.useState)(null),a=(0,W5.useCallback)(()=>t(null),[]),s=(0,W5.useCallback)(()=>n(null),[]),l=(0,W5.useCallback)(()=>o(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:i,setServerConflict:o,clearServerConflict:l}}var sb=k(oe(),1);function f6r(e,t){return[...e,{...t,status:"launching"}]}function _2e(e){return e.find(t=>t.status==="launching")}function d6r(e){let t=_2e(e);return t?e.filter(r=>r.id!==t.id):e}function h6r(e,t){let r=_2e(e);return r?Kje(e,r.id,t):e}function Kje(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function p6r(e,t){return e.filter(r=>r.id!==t)}var m6r=k(oe(),1);var Sdi=6e4,Tdi="Launch timed out \u2014 the session did not start.";function g6r(e,t){(0,m6r.useEffect)(()=>{let r=e.filter(i=>i.status==="launching");if(r.length===0)return;let n=r.map(i=>setTimeout(()=>t(o=>Kje(o,i.id,Tdi)),Math.max(0,Sdi-(Date.now()-i.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function y6r(){let[e,t]=(0,sb.useState)([]),r=(0,sb.useRef)([]),n=(0,sb.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),i=(0,sb.useCallback)(l=>{n(u=>f6r(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),o=(0,sb.useCallback)(()=>{let l=_2e(r.current);return n(d6r),l?.named?l.title:void 0},[n]),a=(0,sb.useCallback)(l=>n(u=>h6r(u,l)),[n]),s=(0,sb.useCallback)(l=>n(u=>p6r(u,l)),[n]);return g6r(e,n),{pendingLaunches:e,addPendingLaunch:i,resolvePendingLaunch:o,failPendingLaunch:a,dismissPendingLaunch:s}}var iJ=k(oe(),1);function v6r(){let[e,t]=(0,iJ.useState)(null),[r,n]=(0,iJ.useState)({}),i=(0,iJ.useCallback)((o,a)=>{o!=="claude"&&n(s=>({...s,[o]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:i}}var b6r=k(oe(),1);function x6r(e,t){return(0,b6r.useCallback)(r=>{e(r),t(r)},[e,t])}var Xje=k(oe(),1);function S6r(){let e=(0,Xje.useRef)(new Map),t=(0,Xje.useRef)(new Map);return{buffers:e,handlers:t}}var E2e=k(oe(),1);function T6r(){let[e,t]=(0,E2e.useState)(null),[r,n]=(0,E2e.useState)(null),[i,o]=(0,E2e.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:i,setUserMessages:o}}var G5=k(oe(),1);function C6r(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function w6r(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 k6r(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function _6r(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function E6r(e,t){t.setNodes({local:e.local,links:e.links??[]})}function R6r(e,t){t.setSuccess({message:e.message,sessionId:null})}function A6r(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 P6r(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function L6r(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function M6r(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var Cdi={sessions:L6r,created:w6r,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:E6r,error:k6r,notice:R6r,inbox:()=>{_c.refresh(),_c.refreshStatus()},"run-conflict":P6r,limits:_6r,clear:C6r,output:A6r,snapshot:M6r};function I6r(e,t){Cdi[e.type]?.(e,t)}function D6r(e,t={}){let r=new WebSocket(Vlt("/ws"));return r.onopen=()=>{t.onOpen?.(),r.send(JSON.stringify({type:"hello"})),r.send(JSON.stringify({type:"history"}))},r.onmessage=n=>{I6r(JSON.parse(n.data),e)},r.onclose=()=>t.onClose?.(),r}function N6r(e,t,r,n){let i=!1,o,a=0,s=!1,l=()=>{i||t(D6r(e,{onOpen:()=>{s&&r(),s=!1,n(!1),a=0},onClose:()=>{if(i)return;s=!0,n(!0);let u=Math.min(300*2**a,2e3);a+=1,o=setTimeout(l,u)}}))};return l(),()=>{i=!0,o&&clearTimeout(o)}}function O6r(e){let t=(0,G5.useRef)(null),[r,n]=(0,G5.useState)(!1),{handleSessions:i,markInitialized:o,buffers:a,handlers:s}=e;(0,G5.useEffect)(()=>{let u=()=>{a.current?.clear();let d=s.current;if(d)for(let h of d.values())h("\x1Bc")},f=N6r({...e,setSessions:i},d=>{t.current=d},u,n);return()=>{f(),t.current?.close()}},[i,o,a,s]);let l=(0,G5.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function B6r(){let[e,t]=(0,R2e.useState)([]),[r,n]=(0,R2e.useState)([]),{activeId:i,setActiveId:o,getActiveId:a}=JAr(),s=n6r(),l=T6r(),[u,f]=(0,R2e.useState)(""),d=u6r(),h=y6r(),p=v6r(),{initialized:m,markInitialized:g,syncSessions:y}=c6r(),v=S6r(),b=x6r(y,t),{wsRef:x,requestHistory:C,reconnecting:T}=O6r({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:o,...s,...l,setCurrentCwd:f,...d,...h,...p,markInitialized:g,...v});return r6r(e,o,QAr(s.activeByRepo,e)),{sessions:e,history:r,activeId:i,setActiveId:o,...s,...l,currentCwd:u,...d,...h,...p,initialized:m,wsRef:x,...v,requestHistory:C,reconnecting:T}}function A2e(){let e=B6r(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:i,activeId:o,sessions:a}=e,s=kAr(e.nodes),l=RAr(t,i),u=XAr(l,r,n);TAr(o,a,e.history,l),CAr(a,l);let f=ZAr(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...f,nodeSelection:s}}var dH=k(oe(),1);var F6r="assist:sidebar-collapsed";function $6r(){let[e,t]=(0,dH.useState)(()=>lf(F6r).length>0),r=(0,dH.useCallback)(()=>{t(n=>{let i=!n;return cf(F6r,i?[!0]:[]),i})},[]);return(0,dH.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var z6r=k(oe(),1);function H6r(){(0,z6r.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fr("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||A4.set(r)}catch{}})(),()=>{e=!0}},[])}function U6r(){let e=A2e(),t=wye(e),r=gAr(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);sAr({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:i}=xAr(e);H6r();let o=$6r();return oAr("shell",{...e,selection:r,launch:n,sidebarCollapse:o}),{socket:e,selection:r,launch:n,viewLaunchedSession:i,sidebarCollapse:o}}var Pg=k(N(),1),wdi={zIndex:e=>e.zIndex.drawer+1},kdi={minHeight:48};function W6r({mode:e,toggle:t}){let r=U6r(),{socket:n,selection:i,viewLaunchedSession:o}=r;return(0,Pg.jsx)(g3r,{shell:r,children:(0,Pg.jsxs)(Dje.Provider,{value:n.daemonVersion,children:[(0,Pg.jsx)(JRr,{mode:e,toggle:t,sessions:n.sessions,reconnecting:n.reconnecting}),(0,Pg.jsx)(BTe,{position:"fixed",sx:wdi,"data-testid":"toolbar",children:(0,Pg.jsx)(tRr,{socket:n,selection:i})}),(0,Pg.jsx)(QE,{variant:"dense",sx:kdi}),(0,Pg.jsx)(nAr,{socket:n,children:(0,Pg.jsx)(yEr,{socket:n})}),(0,Pg.jsx)(ZEr,{socket:n}),(0,Pg.jsx)(p3r,{socket:n,onViewLaunchedSession:o})]})})}var G6r=k(oe(),1);function V6r(){let[e,t]=(0,G6r.useState)(()=>{try{return localStorage.getItem("theme-mode")??"dark"}catch{return"dark"}});return{mode:e,toggle:()=>t(n=>{let i=n==="dark"?"light":"dark";try{localStorage.setItem("theme-mode",i)}catch{}return i})}}function q6r({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 j6r(e){let{color:t,radius:r,elevation:n,type:i}=e,o={border:`1px solid ${t.line}`};return{...q6r(e),MuiTooltip:{styleOverrides:{tooltip:{...o,backgroundColor:t.overlay.background,color:t.overlay.text,borderRadius:r.md,boxShadow:n.overlay,fontSize:`${i.scale.caption/16}rem`,padding:"6px 10px"},arrow:{color:t.overlay.background}}},MuiPopover:{styleOverrides:{paper:{...o,boxShadow:n.overlay}}},MuiBackdrop:{styleOverrides:{root:{"&:not(.MuiBackdrop-invisible)":{backgroundColor:t.scrim,backdropFilter:"blur(2px)"}}}},MuiDialog:{styleOverrides:{paper:{...o,backgroundColor:t.surface,borderRadius:r.md+4,boxShadow:n.dialog}}}}}var Y6r=({variant:e})=>e==="outlined"||e==="tonal",K6r=[{props:{size:"small"},style:{minHeight:26,padding:"4px 9px",fontSize:12}},{props:Y6r,style:{padding:"5px 11px"}},{props:e=>Y6r(e)&&e.size==="small",style:{padding:"3px 8px"}}];var P2e=["primary","secondary","success","warning","error","info"];function oJ(e,t){return{backgroundColor:Nr(e,t),borderColor:Nr(e,.35),color:e}}function X6r({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}}},...P2e.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...oJ(e[t].main,.16),"&:hover":oJ(e[t].main,.24)}}))]}var Z6r={"& > *:nth-of-type(1)":{fontSize:16}};function Q6r(e){let{color:t,radius:r}=e;return{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:30,padding:"6px 12px",borderRadius:r.sm,fontSize:13,fontWeight:600,lineHeight:"18px"},startIcon:{marginLeft:-2,marginRight:6,...Z6r},endIcon:{marginLeft:6,marginRight:-2,...Z6r}},variants:[...K6r,{props:{variant:"text",color:"primary"},style:{color:t.text.secondary,"&:hover":{backgroundColor:t.raised,color:t.text.primary}}},...X6r(e),{props:{variant:"outlined",color:"error"},style:{borderColor:Nr(t.error.main,.35),"&:hover":{borderColor:t.error.main,backgroundColor:Nr(t.error.main,.1)}}}]}}}function Zje({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}}},...P2e.map(r=>({props:{variant:t,color:r},style:{...oJ(e[r].main,.14),borderColor:"transparent","& .MuiChip-deleteIcon":{color:Nr(e[r].main,.7),"&:hover, &:active":{color:e[r].main}},"&.MuiChip-clickable:hover":{backgroundColor:Nr(e[r].main,.22)}}}))]}function J6r(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:[...Zje(e,"tonal"),...Zje(e,"filled")]}}}function ePr(e){return{...Q6r(e),MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},...J6r(e)}}var Qje=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`,_di={".MuiAppBar-root &":{color:"inherit","&:hover":{backgroundColor:Qje(8)},"&.Mui-selected":{color:"inherit",backgroundColor:Qje(12),boxShadow:`inset 0 0 0 1px ${Qje(18)}`}}};function tPr({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&&_di}}}}}var rPr=(e,t)=>({width:e,height:e,"& .MuiSvgIcon-root":{fontSize:t}});function nPr({color:e,radius:t}){return{MuiIconButton:{styleOverrides:{root:{...rPr(30,18),padding:0,borderRadius:t.sm,"&:hover":{backgroundColor:e.raised}}},variants:[{props:{size:"small"},style:rPr(26,16)},{props:{color:"default"},style:{color:e.text.secondary,"&:hover":{color:e.text.primary},...!e.appBar&&{".MuiAppBar-root &, .MuiAppBar-root &:hover":{color:"inherit"}}}}]}}}function iPr({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 L2e=".MuiOutlinedInput-notchedOutline";function oPr({color:e,radius:t}){return{MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:e.background,borderRadius:t.sm,fontSize:13,color:e.text.primary,[`& ${L2e}`]:{borderColor:e.line},[`&:hover ${L2e}`]:{borderColor:e.text.disabled},[`&.Mui-focused ${L2e}`]:{borderColor:e.primary.main,borderWidth:1},[`&.Mui-error ${L2e}`]:{borderColor:e.error.main}}}},MuiInputLabel:{styleOverrides:{root:{fontSize:13,color:e.text.secondary,"&.Mui-focused":{color:e.primary.main}}}},MuiSelect:{styleOverrides:{icon:{color:e.text.disabled}}}}}function aPr({color:e}){return{MuiSwitch:{styleOverrides:{root:{width:34,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:2,color:e.text.secondary,"&.Mui-checked":{transform:"translateX(14px)",color:e.primary.contrastText},"&.Mui-checked + .MuiSwitch-track":{backgroundColor:e.primary.main,opacity:1}},"& .MuiSwitch-thumb":{width:16,height:16,boxShadow:"none"},"& .MuiSwitch-track":{borderRadius:10,backgroundColor:e.line,opacity:1}}}},MuiFormControlLabel:{styleOverrides:{root:{"&:has(.MuiSwitch-root)":{marginLeft:0,gap:8}}}}}}function sPr(e){let{appBar:t}=e.color;return{...j6r(e),...ePr(e),...nPr(e),...iPr(e),...oPr(e),...aPr(e),...tPr(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 lb="#0e1116",Jje="#141820",M2e="#1b202a",I2e="#e3e7ee",eYe="#8a93a3",aJ="#8b9cff",D2e="#5fd0a0",N2e="#f2b45a",O2e="#f27a7a",lPr={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)"},B2e={dark:{color:{background:lb,surface:Jje,raised:M2e,line:"#262c37",lineSoft:"#1d222b",text:{primary:I2e,secondary:eYe,disabled:"#5c6473"},selected:"rgba(139, 156, 255, 0.14)",wash:{warning:"rgba(242, 180, 90, 0.09)",error:"rgba(242, 122, 122, 0.09)"},well:lb,stripe:M2e,codeWash:"rgba(255, 255, 255, 0.08)",overlay:{background:M2e,text:I2e},scrim:"rgba(0, 0, 0, 0.5)",appBar:{background:Jje,text:I2e},onAppBar:{...lPr,secondary:eYe,level:{ok:D2e,warn:N2e,over:O2e}},statusBar:{background:Jje,text:eYe,hoverText:I2e,secondary:"#5c6473",hover:M2e,active:"transparent",dot:aJ,dotRing:"rgba(139, 156, 255, 0.14)",readyText:aJ,level:{ok:D2e,warn:N2e,over:O2e}},primary:{main:aJ,contrastText:lb},secondary:{main:"#c99bff",contrastText:lb},success:{main:D2e,contrastText:lb},warning:{main:N2e,contrastText:lb},error:{main:O2e,contrastText:lb},info:{main:"#6cb6ff",contrastText:lb}},terminal:{background:lb,foreground:"#d6dbe4",cursor:aJ,cursorAccent:lb,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:O2e,green:D2e,yellow:N2e,blue:aJ,magenta:"#c99bff",cyan:"#6cc8d8",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)"},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:{...lPr,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"},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},spacing:8};var fT=e=>`${e/16}rem`;function cPr({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:fT(r.button)},caption:{fontSize:fT(r.caption)},body2:{fontSize:fT(r.body2)},body1:{fontSize:fT(r.body1)},subtitle2:{fontSize:fT(r.subtitle2)},subtitle1:{fontSize:fT(r.subtitle1)},h6:{fontSize:fT(r.h6)},h5:{fontSize:fT(r.h5)},h4:{fontSize:fT(r.h4)}}}function uPr(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}function Edi(e){let{dark:t,light:r,...n}=B2e;return{...n,...e==="dark"?t:r,mode:e}}function fPr(e){let t=Edi(e),{color:r}=t;return Sy({tokens:t,palette:{mode:e,background:{default:r.background,paper:r.surface},primary:r.primary,secondary:r.secondary,success:r.success,warning:r.warning,error:r.error,info:r.info,text:r.text,divider:r.line,action:{hover:r.raised,selected:r.selected}},typography:cPr(t),shape:{borderRadius:t.radius.sm},spacing:t.spacing,components:{...uPr(t),...sPr(t)}})}function dPr(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=B2e;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var aLr=k(oe(),1);var sJ=k(N(),1);function hPr({name:e}){return(0,sJ.jsxs)(q,{sx:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,bgcolor:"background.default"},children:[(0,sJ.jsx)(hi,{size:28}),(0,sJ.jsxs)(Le,{variant:"body2",color:"text.secondary",children:["Connecting to ",e??"home node","\u2026"]})]})}var F2e=k(oe(),1),tYe=(0,F2e.createContext)(null);function V5(){return(0,F2e.useContext)(tYe)}var Lu={top:"env(safe-area-inset-top, 0px)",bottom:"env(safe-area-inset-bottom, 0px)"};var mPr=k(N(),1);function pPr({value:e,error:t,onChange:r}){return(0,mPr.jsx)($n,{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 cJ=k(oe(),1);var Rdi=/^\d+(\.\d+){3}$/;function lJ(e){try{let{hostname:t}=new URL(e);return Rdi.test(t)?t:t.split(".")[0]}catch{return""}}var Adi=/^[a-z]+:[/]{2}/i;function gPr(e){let t=e.trim(),r=Adi.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 yPr(e,t){let[r,n]=(0,cJ.useState)(e?.url??""),[i,o]=(0,cJ.useState)(e?.name),[a,s]=(0,cJ.useState)(),[l,u]=(0,cJ.useState)(!1),f=gPr(r),d=i??(f?lJ(f):"");return{url:r,changeUrl:m=>{n(m),s(void 0)},name:d,setName:o,error:a,busy:l,submit:async m=>{if(m.preventDefault(),!f){s("Enter an http(s) URL, e.g. https://mac.tail1234.ts.net:3100");return}u(!0);let g=await t({name:d.trim()||lJ(f),url:f});u(!1),s(g)}}}var hH=k(N(),1);function $2e({initial:e,submitLabel:t,onSubmit:r,children:n}){let i=yPr(e,r);return(0,hH.jsxs)(_t,{component:"form",spacing:2,onSubmit:i.submit,children:[(0,hH.jsx)(pPr,{value:i.url,error:i.error,onChange:i.changeUrl}),(0,hH.jsx)($n,{label:"Name",value:i.name,onChange:o=>i.setName(o.target.value),helperText:"Filled in from the host name. Shown on the node chip.",slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off"}}}),(0,hH.jsx)(Rt,{type:"submit",variant:"contained",size:"large",disabled:!i.url.trim()||i.busy,children:i.busy?"Checking\u2026":t}),n]})}async function pH(e){let t=new AbortController,r=setTimeout(()=>t.abort(),5e3);try{let n=await fetch(`${e}/api/health`,{signal:t.signal,cache:"no-store"});return n.ok?{ok:!0,health:await n.json()}:{ok:!1,error:`HTTP ${n.status}`}}catch(n){return t.signal.aborted?{ok:!1,error:`timed out after ${5e3/1e3}s`}:{ok:!1,error:n instanceof Error?n.message:String(n)}}finally{clearTimeout(r)}}var dT=k(N(),1),Pdi={height:"100%",boxSizing:"border-box",overflowY:"auto",display:"flex",justifyContent:"center",pt:`calc(${Lu.top} + 28px)`,pb:`calc(${Lu.bottom} + 24px)`,px:2.5,bgcolor:"background.default"},Ldi={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 vPr({onConnect:e}){return(0,dT.jsx)(q,{sx:Pdi,children:(0,dT.jsxs)(_t,{spacing:2.5,sx:{width:"100%",maxWidth:420},children:[(0,dT.jsx)(q,{sx:Ldi,children:">_"}),(0,dT.jsx)(Le,{variant:"h5",sx:{fontWeight:700},children:"Connect to a home node"}),(0,dT.jsxs)(Le,{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,dT.jsx)("code",{children:"assist sessions web"})," is running on that machine."]}),(0,dT.jsx)($2e,{submitLabel:"Connect",onSubmit:async r=>{let n=await pH(r.url);if(!n.ok)return`Can't reach ${r.url}: ${n.error}`;e(r,n.health)}})]})})}var GPr=k(oe(),1);var hT=k(N(),1),Mdi={flex:"none",pt:Lu.top,bgcolor:"background.default"},Idi={height:44,display:"grid",gridTemplateColumns:"minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)",columnGap:1,alignItems:"center",px:1},Ddi={textAlign:"center",minWidth:0,maxWidth:220},Ndi={fontSize:15,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Odi={fontSize:12,color:"text.secondary",fontFamily:"fontFamilyMono",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function Lg({left:e,title:t,subtitle:r,right:n}){return(0,hT.jsx)(q,{component:"header",sx:Mdi,children:(0,hT.jsxs)(q,{sx:Idi,children:[(0,hT.jsx)(q,{sx:{justifySelf:"start",minWidth:0},children:e}),(0,hT.jsxs)(q,{sx:Ddi,children:[(0,hT.jsx)(q,{sx:Ndi,children:t}),r&&(0,hT.jsx)(q,{sx:Odi,children:r})]}),(0,hT.jsx)(q,{sx:{justifySelf:"end",display:"flex",gap:.25},children:n})]})})}var cb=e=>e.tokens.color.raised;var bPr=k(N(),1),Bdi={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 ub({tone:e}){return(0,bPr.jsx)(q,{component:"span",sx:{width:8,height:8,flex:"none",borderRadius:"50%",bgcolor:Bdi[e]}})}var mH=k(N(),1),Fdi={display:"inline-flex",alignItems:"center",gap:.75,height:32,pl:1.125,pr:.75,borderRadius:"16px",border:1,borderColor:"divider",bgcolor:cb,color:"text.primary",fontFamily:"fontFamilyMono",fontSize:13,maxWidth:140,justifyContent:"flex-start"},$di={minWidth:0,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"};function z2e({name:e,tone:t,onClick:r}){return(0,mH.jsxs)(vr,{sx:Fdi,onClick:r,disabled:!r,"aria-label":"Nodes","data-testid":"phone-node-chip",children:[(0,mH.jsx)(ub,{tone:t}),(0,mH.jsx)(q,{component:"span",sx:$di,children:e??"\u2026"}),r&&(0,mH.jsx)(Ra,{sx:{fontSize:16,flex:"none"}})]})}var FPr=k(oe(),1);var H2e=k(N(),1);function xPr({homeNode:e,node:t,onDone:r}){let n=!!t&&t.url===e.home?.url;return(0,H2e.jsx)(q,{sx:{px:2.5,pt:1},children:(0,H2e.jsx)($2e,{initial:t,submitLabel:t?"Save":"Add node",onSubmit:async o=>{if(e.nodes.some(s=>s.url===o.url&&s.url!==t?.url))return"That URL is already saved";e.saveNode(t?.url??o.url,o),r()},children:t&&(0,H2e.jsx)(Rt,{color:"error",size:"large",disabled:n,onClick:()=>{e.removeNode(t.url),r()},children:n?"Switch home node to delete this one":"Delete node"})})})}var SPr=k(N(),1),zdi={width:36,height:5,borderRadius:"3px",bgcolor:"text.disabled",opacity:.5,mx:"auto",mb:.75};function gH(){return(0,SPr.jsx)(q,{sx:zdi})}var pT=k(N(),1),Hdi={display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,px:2,pt:.75,pb:1.25},Udi={color:"primary.main",fontSize:16,minHeight:44,px:.5,borderRadius:1};function U2e({title:e,actionLabel:t,onAction:r}){return(0,pT.jsxs)(pT.Fragment,{children:[(0,pT.jsx)(gH,{}),(0,pT.jsxs)(q,{sx:Hdi,children:[(0,pT.jsx)(q,{component:"b",sx:{fontSize:17,fontWeight:600},children:e}),(0,pT.jsx)(vr,{sx:Udi,onClick:r,children:t})]})]})}var EP=k(N(),1);function TPr({homeNode:e,node:t,onDone:r}){return(0,EP.jsxs)(EP.Fragment,{children:[(0,EP.jsx)(U2e,{title:t?"Edit node":"Add node",actionLabel:"Cancel",onAction:r}),(0,EP.jsx)(xPr,{homeNode:e,node:t,onDone:r},t?.url??"add")]})}var on={group:{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:48,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 CPr(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let i=0;i<Math.max(r.length,n.length);i++){let o=(r[i]||0)-(n[i]||0);if(o!==0)return Math.sign(o)}return 0}function wPr(e,t,r){let n=t.filter(a=>a.node===e.name).length,i=[e.state,`${n} session${n===1?"":"s"}`,e.peerVersion&&`v${e.peerVersion}`,e.state!=="connected"&&e.error],o=e.peerVersion&&r?CPr(e.peerVersion,r):0;return{text:i.filter(Boolean).join(" \xB7 "),drift:o<0?"behind":o>0?"ahead":void 0}}var W2e={connected:"ok",connecting:"warn",disconnected:"error","version-blocked":"error"};var q5=k(N(),1),Wdi={fontFamily:"fontFamilyMono",fontSize:12,px:.75,border:1,borderColor:"currentColor",borderRadius:"4px",color:"warning.main"};function kPr({links:e,sessions:t,homeVersion:r}){return(0,q5.jsx)(q,{sx:on.group,children:e.map(n=>{let{text:i,drift:o}=wPr(n,t,r);return(0,q5.jsxs)(q,{sx:on.item,children:[(0,q5.jsx)(ub,{tone:W2e[n.state]}),(0,q5.jsxs)(q,{component:"span",sx:on.grow,children:[n.name,(0,q5.jsx)(q,{component:"span",sx:on.detail,children:i})]}),o&&(0,q5.jsx)(q,{component:"span",sx:Wdi,children:o})]},n.name)})})}var fb=k(N(),1);function G2e({title:e,rows:t}){return(0,fb.jsxs)(fb.Fragment,{children:[(0,fb.jsx)(q,{sx:on.label,children:e}),(0,fb.jsx)(q,{sx:on.group,children:t.map(r=>(0,fb.jsxs)(q,{sx:on.item,children:[(0,fb.jsx)(q,{component:"span",sx:on.grow,children:r.label}),(0,fb.jsx)(q,{component:"span",sx:[on.end,{fontFamily:"fontFamilyMono"}],children:r.value})]},r.key))})]})}var EPr=k(N(),1);function _Pr({rateLimits:e,harnessRateLimits:t}){let r=_g(3e4),n=Bxe(e,t).flatMap(i=>Hxe(i.rateLimits).map(o=>({key:`${i.harness}-${o.label}`,label:`${oc(i.harness)} \xB7 ${o.label}`,value:o.resetsAt!=null?`${Math.round(o.pct)}% \xB7 ${Bz(o.resetsAt,r)}`:`${Math.round(o.pct)}%`})));return n.length===0?null:(0,EPr.jsx)(G2e,{title:"Rate limits",rows:n})}var db=k(N(),1);function RPr({status:e,homeVersion:t}){let r=e.nodes?.links??[];return(0,db.jsxs)(db.Fragment,{children:[r.length>0&&(0,db.jsxs)(db.Fragment,{children:[(0,db.jsxs)(q,{sx:on.label,children:["Linked through ",e.nodes?.local]}),(0,db.jsx)(kPr,{links:r,sessions:e.sessions,homeVersion:t})]}),(0,db.jsx)(_Pr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var uJ=k(N(),1);function V2e({onAdd:e}){return(0,uJ.jsxs)(vr,{sx:on.item,onClick:e,children:[(0,uJ.jsx)(wm,{sx:{color:"primary.main"}}),(0,uJ.jsx)(q,{component:"span",sx:{color:"primary.main"},children:"Add node URL"})]})}function hb(e){try{return new URL(e).host}catch{return e}}function q2e(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 j2e=k(oe(),1);var Gdi=15e3;function Y2e(e){let[t,r]=(0,j2e.useState)({}),n=e.join(`
|
|
4025
4025
|
`);return(0,j2e.useEffect)(()=>{if(!n)return;let i=!1,o=()=>{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.
|
|
9
|
+
version: "0.973.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -22262,7 +22262,7 @@ function registerCodexHook(program) {
|
|
|
22262
22262
|
}
|
|
22263
22263
|
|
|
22264
22264
|
// src/commands/commit.ts
|
|
22265
|
-
import { execSync as
|
|
22265
|
+
import { execSync as execSync31 } from "child_process";
|
|
22266
22266
|
|
|
22267
22267
|
// src/commands/commit/buildCommitMessage.ts
|
|
22268
22268
|
function buildCommitMessage(subject, refs) {
|
|
@@ -22495,18 +22495,41 @@ function shouldPull(config) {
|
|
|
22495
22495
|
return false;
|
|
22496
22496
|
}
|
|
22497
22497
|
|
|
22498
|
-
// src/commands/commit/
|
|
22498
|
+
// src/commands/commit/refuseLockedDocs.ts
|
|
22499
22499
|
import { execSync as execSync28 } from "child_process";
|
|
22500
|
+
function findStagedDocs() {
|
|
22501
|
+
return execSync28("git diff --cached --name-only --relative", {
|
|
22502
|
+
cwd: getProjectRoot(),
|
|
22503
|
+
encoding: "utf8"
|
|
22504
|
+
}).split("\n").filter((path108) => path108.startsWith("docs/"));
|
|
22505
|
+
}
|
|
22506
|
+
async function refuseLockedDocs() {
|
|
22507
|
+
const staged = findStagedDocs();
|
|
22508
|
+
if (staged.length === 0 || !await isDocsLocked()) return;
|
|
22509
|
+
console.error(
|
|
22510
|
+
`Error: refusing to commit \u2014 staged changes touch docs: ${staged.join(", ")}`
|
|
22511
|
+
);
|
|
22512
|
+
console.error(DOCS_LOCK_REASON);
|
|
22513
|
+
console.error(
|
|
22514
|
+
"Unstage them with `git restore --staged docs/`, then re-run the commit. Nothing was committed or pushed."
|
|
22515
|
+
);
|
|
22516
|
+
process.exit(1);
|
|
22517
|
+
}
|
|
22518
|
+
|
|
22519
|
+
// src/commands/commit/commitStaged.ts
|
|
22520
|
+
import { execSync as execSync29 } from "child_process";
|
|
22500
22521
|
function commitStaged(message3) {
|
|
22501
|
-
|
|
22502
|
-
return
|
|
22522
|
+
execSync29(`git commit -m ${shellQuote(message3)}`, { stdio: "inherit" });
|
|
22523
|
+
return execSync29("git rev-parse --short=7 HEAD", {
|
|
22503
22524
|
encoding: "utf8"
|
|
22504
22525
|
}).trim();
|
|
22505
22526
|
}
|
|
22506
|
-
|
|
22527
|
+
|
|
22528
|
+
// src/commands/commit/stageFiles.ts
|
|
22529
|
+
import { execSync as execSync30 } from "child_process";
|
|
22530
|
+
function stageFiles(files) {
|
|
22507
22531
|
const escaped = files.map(shellQuote).join(" ");
|
|
22508
|
-
|
|
22509
|
-
return commitStaged(message3);
|
|
22532
|
+
execSync30(`git add ${escaped}`, { stdio: "inherit" });
|
|
22510
22533
|
}
|
|
22511
22534
|
|
|
22512
22535
|
// src/commands/commit/execCommit.ts
|
|
@@ -22518,7 +22541,9 @@ async function execCommit(files, message3, config) {
|
|
|
22518
22541
|
pullKeepingIndex();
|
|
22519
22542
|
}
|
|
22520
22543
|
abortOnConflicts(files, pulled);
|
|
22521
|
-
|
|
22544
|
+
if (files.length > 0) stageFiles(files);
|
|
22545
|
+
await refuseLockedDocs();
|
|
22546
|
+
const sha = commitStaged(message3);
|
|
22522
22547
|
console.log(`Committed: ${sha}`);
|
|
22523
22548
|
if (config.commit?.push) {
|
|
22524
22549
|
pushCommit(config.worktree?.trunk === true);
|
|
@@ -22652,7 +22677,7 @@ function validateMessage(message3, config) {
|
|
|
22652
22677
|
// src/commands/commit.ts
|
|
22653
22678
|
async function commit(args, options2 = {}) {
|
|
22654
22679
|
if (args[0] === "status") {
|
|
22655
|
-
|
|
22680
|
+
execSync31("git status && echo '---DIFF---' && git diff", {
|
|
22656
22681
|
stdio: "inherit"
|
|
22657
22682
|
});
|
|
22658
22683
|
return;
|
|
@@ -23118,10 +23143,10 @@ function formatResultLine(entry, failing) {
|
|
|
23118
23143
|
}
|
|
23119
23144
|
|
|
23120
23145
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
23121
|
-
import { execSync as
|
|
23146
|
+
import { execSync as execSync32 } from "child_process";
|
|
23122
23147
|
import path33 from "path";
|
|
23123
23148
|
function git4(command) {
|
|
23124
|
-
return
|
|
23149
|
+
return execSync32(command, { encoding: "utf8" });
|
|
23125
23150
|
}
|
|
23126
23151
|
function toAbsolute(root2, repoRelative) {
|
|
23127
23152
|
return path33.resolve(root2, repoRelative);
|
|
@@ -24601,7 +24626,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
24601
24626
|
}
|
|
24602
24627
|
|
|
24603
24628
|
// src/commands/devlog/shared.ts
|
|
24604
|
-
import { execSync as
|
|
24629
|
+
import { execSync as execSync33 } from "child_process";
|
|
24605
24630
|
import chalk154 from "chalk";
|
|
24606
24631
|
|
|
24607
24632
|
// src/shared/getRepoName.ts
|
|
@@ -24693,7 +24718,7 @@ function loadAllDevlogLatestDates() {
|
|
|
24693
24718
|
// src/commands/devlog/shared.ts
|
|
24694
24719
|
function getCommitFiles(hash) {
|
|
24695
24720
|
try {
|
|
24696
|
-
const output =
|
|
24721
|
+
const output = execSync33(`git show --name-only --format="" ${hash}`, {
|
|
24697
24722
|
encoding: "utf8"
|
|
24698
24723
|
});
|
|
24699
24724
|
return output.trim().split("\n").filter(Boolean);
|
|
@@ -24789,11 +24814,11 @@ function list2(options2) {
|
|
|
24789
24814
|
}
|
|
24790
24815
|
|
|
24791
24816
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
24792
|
-
import { execFileSync as execFileSync8, execSync as
|
|
24817
|
+
import { execFileSync as execFileSync8, execSync as execSync34 } from "child_process";
|
|
24793
24818
|
import semver from "semver";
|
|
24794
24819
|
function getVersionAtCommit(hash) {
|
|
24795
24820
|
try {
|
|
24796
|
-
const content =
|
|
24821
|
+
const content = execSync34(`git show ${hash}:package.json`, {
|
|
24797
24822
|
encoding: "utf8"
|
|
24798
24823
|
});
|
|
24799
24824
|
const pkg = JSON.parse(content);
|
|
@@ -24966,7 +24991,7 @@ function next2(options2) {
|
|
|
24966
24991
|
}
|
|
24967
24992
|
|
|
24968
24993
|
// src/commands/devlog/repos.ts
|
|
24969
|
-
import { execSync as
|
|
24994
|
+
import { execSync as execSync35 } from "child_process";
|
|
24970
24995
|
|
|
24971
24996
|
// src/commands/devlog/repos/printReposTable.ts
|
|
24972
24997
|
import chalk158 from "chalk";
|
|
@@ -25001,7 +25026,7 @@ function getStatus(lastPush, lastDevlog) {
|
|
|
25001
25026
|
return lastDevlog < lastPush ? "outdated" : "ok";
|
|
25002
25027
|
}
|
|
25003
25028
|
function fetchRepos(days, all) {
|
|
25004
|
-
const json =
|
|
25029
|
+
const json = execSync35(
|
|
25005
25030
|
"gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
|
|
25006
25031
|
{ encoding: "utf8" }
|
|
25007
25032
|
);
|
|
@@ -25346,7 +25371,7 @@ async function deps(csprojPath, options2) {
|
|
|
25346
25371
|
}
|
|
25347
25372
|
|
|
25348
25373
|
// src/commands/dotnet/getChangedCsFiles.ts
|
|
25349
|
-
import { execSync as
|
|
25374
|
+
import { execSync as execSync36 } from "child_process";
|
|
25350
25375
|
var SCOPE_ALL = "all";
|
|
25351
25376
|
var SCOPE_BASE = "base:";
|
|
25352
25377
|
var SCOPE_COMMIT = "commit:";
|
|
@@ -25370,7 +25395,7 @@ function getChangedCsFiles(scope) {
|
|
|
25370
25395
|
} else {
|
|
25371
25396
|
cmd = "git diff --name-only HEAD";
|
|
25372
25397
|
}
|
|
25373
|
-
const output =
|
|
25398
|
+
const output = execSync36(cmd, { encoding: "utf8" }).trim();
|
|
25374
25399
|
if (output === "") return [];
|
|
25375
25400
|
return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
|
|
25376
25401
|
}
|
|
@@ -25568,14 +25593,14 @@ function parseInspectReport(json) {
|
|
|
25568
25593
|
}
|
|
25569
25594
|
|
|
25570
25595
|
// src/commands/dotnet/runInspectCode.ts
|
|
25571
|
-
import { execSync as
|
|
25596
|
+
import { execSync as execSync37 } from "child_process";
|
|
25572
25597
|
import { existsSync as existsSync57, readFileSync as readFileSync39, unlinkSync as unlinkSync10 } from "fs";
|
|
25573
25598
|
import { tmpdir as tmpdir4 } from "os";
|
|
25574
25599
|
import path39 from "path";
|
|
25575
25600
|
import chalk168 from "chalk";
|
|
25576
25601
|
function assertJbInstalled() {
|
|
25577
25602
|
try {
|
|
25578
|
-
|
|
25603
|
+
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
25579
25604
|
} catch {
|
|
25580
25605
|
console.error(chalk168.red("jb is not installed. Install with:"));
|
|
25581
25606
|
console.error(
|
|
@@ -25589,7 +25614,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25589
25614
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
25590
25615
|
const sweaFlag = swea ? " --swea" : "";
|
|
25591
25616
|
try {
|
|
25592
|
-
|
|
25617
|
+
execSync37(
|
|
25593
25618
|
`jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
|
|
25594
25619
|
{ stdio: "pipe" }
|
|
25595
25620
|
);
|
|
@@ -25610,7 +25635,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25610
25635
|
}
|
|
25611
25636
|
|
|
25612
25637
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
25613
|
-
import { execSync as
|
|
25638
|
+
import { execSync as execSync38 } from "child_process";
|
|
25614
25639
|
import chalk169 from "chalk";
|
|
25615
25640
|
function resolveMsbuildPath() {
|
|
25616
25641
|
const { run: run4 } = loadConfig();
|
|
@@ -25621,7 +25646,7 @@ function resolveMsbuildPath() {
|
|
|
25621
25646
|
function assertMsbuildInstalled() {
|
|
25622
25647
|
const msbuild = resolveMsbuildPath();
|
|
25623
25648
|
try {
|
|
25624
|
-
|
|
25649
|
+
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
25625
25650
|
} catch {
|
|
25626
25651
|
console.error(chalk169.red(`msbuild not found at: ${msbuild}`));
|
|
25627
25652
|
console.error(
|
|
@@ -25647,7 +25672,7 @@ function runRoslynInspect(slnPath) {
|
|
|
25647
25672
|
const msbuild = resolveMsbuildPath();
|
|
25648
25673
|
let output;
|
|
25649
25674
|
try {
|
|
25650
|
-
output =
|
|
25675
|
+
output = execSync38(
|
|
25651
25676
|
`"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
|
|
25652
25677
|
{ encoding: "utf8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
|
|
25653
25678
|
);
|
|
@@ -27616,7 +27641,7 @@ function resolveIssueMilestone(target, wanted) {
|
|
|
27616
27641
|
}
|
|
27617
27642
|
|
|
27618
27643
|
// src/commands/prs/shared.ts
|
|
27619
|
-
import { execSync as
|
|
27644
|
+
import { execSync as execSync39 } from "child_process";
|
|
27620
27645
|
|
|
27621
27646
|
// src/commands/prs/pinCurrentPr.ts
|
|
27622
27647
|
var pinnedPr;
|
|
@@ -27639,19 +27664,19 @@ function getRepoInfo() {
|
|
|
27639
27664
|
const preferred = getPreferredRemoteRepo();
|
|
27640
27665
|
if (preferred) return preferred;
|
|
27641
27666
|
const repoInfo = JSON.parse(
|
|
27642
|
-
|
|
27667
|
+
execSync39("gh repo view --json owner,name", { encoding: "utf8" })
|
|
27643
27668
|
);
|
|
27644
27669
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
27645
27670
|
}
|
|
27646
27671
|
function getCurrentBranch2() {
|
|
27647
|
-
return
|
|
27672
|
+
return execSync39("git rev-parse --abbrev-ref HEAD", {
|
|
27648
27673
|
encoding: "utf8"
|
|
27649
27674
|
}).trim();
|
|
27650
27675
|
}
|
|
27651
27676
|
function viewCurrentPr(fields) {
|
|
27652
27677
|
const { org, repo } = getRepoInfo();
|
|
27653
27678
|
return JSON.parse(
|
|
27654
|
-
|
|
27679
|
+
execSync39(
|
|
27655
27680
|
`gh pr view ${currentPrSelector(getCurrentBranch2)} --json ${fields} -R ${org}/${repo}`,
|
|
27656
27681
|
{
|
|
27657
27682
|
encoding: "utf8"
|
|
@@ -28788,7 +28813,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
28788
28813
|
}
|
|
28789
28814
|
|
|
28790
28815
|
// src/commands/jira/jiraAuth.ts
|
|
28791
|
-
import { execSync as
|
|
28816
|
+
import { execSync as execSync40 } from "child_process";
|
|
28792
28817
|
|
|
28793
28818
|
// src/shared/promptInput.ts
|
|
28794
28819
|
import Enquirer from "enquirer";
|
|
@@ -28823,7 +28848,7 @@ async function jiraAuth() {
|
|
|
28823
28848
|
console.error("All fields are required.");
|
|
28824
28849
|
process.exit(1);
|
|
28825
28850
|
}
|
|
28826
|
-
|
|
28851
|
+
execSync40(`acli jira auth login --site ${site} --email "${email}" --token`, {
|
|
28827
28852
|
encoding: "utf8",
|
|
28828
28853
|
input: token,
|
|
28829
28854
|
stdio: ["pipe", "inherit", "inherit"]
|
|
@@ -31371,7 +31396,7 @@ function registerPrompts(program) {
|
|
|
31371
31396
|
}
|
|
31372
31397
|
|
|
31373
31398
|
// src/commands/prs/prs.ts
|
|
31374
|
-
import { execSync as
|
|
31399
|
+
import { execSync as execSync41 } from "child_process";
|
|
31375
31400
|
|
|
31376
31401
|
// src/commands/prs/prs/displayPaginated.ts
|
|
31377
31402
|
import enquirer9 from "enquirer";
|
|
@@ -31478,7 +31503,7 @@ async function prs(options2) {
|
|
|
31478
31503
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
31479
31504
|
try {
|
|
31480
31505
|
const { org, repo } = getRepoInfo();
|
|
31481
|
-
const result =
|
|
31506
|
+
const result = execSync41(
|
|
31482
31507
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
31483
31508
|
{ encoding: "utf8" }
|
|
31484
31509
|
);
|
|
@@ -31872,9 +31897,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
31872
31897
|
}
|
|
31873
31898
|
|
|
31874
31899
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
31875
|
-
import { execSync as
|
|
31900
|
+
import { execSync as execSync42 } from "child_process";
|
|
31876
31901
|
function fetchJson(endpoint) {
|
|
31877
|
-
const result =
|
|
31902
|
+
const result = execSync42(`gh api --paginate ${endpoint}`, {
|
|
31878
31903
|
encoding: "utf8"
|
|
31879
31904
|
});
|
|
31880
31905
|
if (!result.trim()) return [];
|
|
@@ -32119,7 +32144,7 @@ function printComments2(result) {
|
|
|
32119
32144
|
}
|
|
32120
32145
|
|
|
32121
32146
|
// src/commands/prs/fixed.ts
|
|
32122
|
-
import { execSync as
|
|
32147
|
+
import { execSync as execSync43 } from "child_process";
|
|
32123
32148
|
|
|
32124
32149
|
// src/commands/prs/threadTarget.ts
|
|
32125
32150
|
import { execFileSync as execFileSync22 } from "child_process";
|
|
@@ -32244,7 +32269,7 @@ function resolveCommentWithReply(commentId, message3, status2) {
|
|
|
32244
32269
|
// src/commands/prs/fixed.ts
|
|
32245
32270
|
function verifySha(sha) {
|
|
32246
32271
|
try {
|
|
32247
|
-
return
|
|
32272
|
+
return execSync43(`git rev-parse --verify ${sha}`, {
|
|
32248
32273
|
encoding: "utf8"
|
|
32249
32274
|
}).trim();
|
|
32250
32275
|
} catch {
|
|
@@ -32308,7 +32333,7 @@ async function reply(commentId, body) {
|
|
|
32308
32333
|
}
|
|
32309
32334
|
|
|
32310
32335
|
// src/commands/prs/wontfix.ts
|
|
32311
|
-
import { execSync as
|
|
32336
|
+
import { execSync as execSync44 } from "child_process";
|
|
32312
32337
|
function validateReason(reason4) {
|
|
32313
32338
|
const lowerReason = reason4.toLowerCase();
|
|
32314
32339
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -32325,7 +32350,7 @@ function validateShaReferences(reason4) {
|
|
|
32325
32350
|
const invalidShas = [];
|
|
32326
32351
|
for (const sha of shas) {
|
|
32327
32352
|
try {
|
|
32328
|
-
|
|
32353
|
+
execSync44(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
32329
32354
|
} catch {
|
|
32330
32355
|
invalidShas.push(sha);
|
|
32331
32356
|
}
|
|
@@ -32847,16 +32872,16 @@ function buildCreateArgs(title, body, options2, attachments = []) {
|
|
|
32847
32872
|
}
|
|
32848
32873
|
|
|
32849
32874
|
// src/commands/prs/readSessionPrRef.ts
|
|
32850
|
-
import { execSync as
|
|
32875
|
+
import { execSync as execSync45 } from "child_process";
|
|
32851
32876
|
function readSessionPrRef() {
|
|
32852
32877
|
try {
|
|
32853
|
-
const branch2 =
|
|
32878
|
+
const branch2 = execSync45("git rev-parse --abbrev-ref HEAD", {
|
|
32854
32879
|
encoding: "utf8",
|
|
32855
32880
|
stdio: ["pipe", "pipe", "pipe"]
|
|
32856
32881
|
}).trim();
|
|
32857
32882
|
if (!branch2 || branch2 === "HEAD") return null;
|
|
32858
32883
|
const pr = JSON.parse(
|
|
32859
|
-
|
|
32884
|
+
execSync45(`gh pr view ${branch2} --json number,title,url,state`, {
|
|
32860
32885
|
encoding: "utf8",
|
|
32861
32886
|
stdio: ["pipe", "pipe", "pipe"]
|
|
32862
32887
|
})
|
|
@@ -33301,10 +33326,10 @@ function describeFetchError(error) {
|
|
|
33301
33326
|
}
|
|
33302
33327
|
|
|
33303
33328
|
// src/commands/prs/status/fetchRepoPullRequests.ts
|
|
33304
|
-
import { execSync as
|
|
33329
|
+
import { execSync as execSync46 } from "child_process";
|
|
33305
33330
|
var FIELDS2 = "number,title,url,author,isDraft,createdAt,updatedAt,reviewDecision,latestReviews,statusCheckRollup,mergeable";
|
|
33306
33331
|
function fetchRepoPullRequests(org, repo) {
|
|
33307
|
-
const output =
|
|
33332
|
+
const output = execSync46(
|
|
33308
33333
|
`gh pr list --state open --json ${FIELDS2} --limit 100 -R ${org}/${repo}`,
|
|
33309
33334
|
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
|
|
33310
33335
|
);
|
|
@@ -33653,7 +33678,7 @@ function resolveReadTimeTarget(target) {
|
|
|
33653
33678
|
}
|
|
33654
33679
|
|
|
33655
33680
|
// src/commands/prs/fetchPrBody.ts
|
|
33656
|
-
import { execSync as
|
|
33681
|
+
import { execSync as execSync47 } from "child_process";
|
|
33657
33682
|
function exitGhNotInstalled() {
|
|
33658
33683
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
33659
33684
|
console.error("Install it from https://cli.github.com/");
|
|
@@ -33674,7 +33699,7 @@ function currentRepo() {
|
|
|
33674
33699
|
function fetchPrBody(number, repo) {
|
|
33675
33700
|
const { org, repo: name } = repo ?? currentRepo();
|
|
33676
33701
|
try {
|
|
33677
|
-
const raw =
|
|
33702
|
+
const raw = execSync47(`gh pr view ${number} --json body -R ${org}/${name}`, {
|
|
33678
33703
|
encoding: "utf8",
|
|
33679
33704
|
stdio: ["pipe", "pipe", "pipe"]
|
|
33680
33705
|
});
|
|
@@ -33830,10 +33855,10 @@ import chalk201 from "chalk";
|
|
|
33830
33855
|
import Enquirer2 from "enquirer";
|
|
33831
33856
|
|
|
33832
33857
|
// src/commands/ravendb/searchItems.ts
|
|
33833
|
-
import { execSync as
|
|
33858
|
+
import { execSync as execSync48 } from "child_process";
|
|
33834
33859
|
import chalk200 from "chalk";
|
|
33835
33860
|
function opExec(args) {
|
|
33836
|
-
return
|
|
33861
|
+
return execSync48(`op ${args}`, {
|
|
33837
33862
|
encoding: "utf8",
|
|
33838
33863
|
stdio: ["pipe", "pipe", "pipe"]
|
|
33839
33864
|
}).trim();
|
|
@@ -33985,7 +34010,7 @@ ${errorText}`
|
|
|
33985
34010
|
}
|
|
33986
34011
|
|
|
33987
34012
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
33988
|
-
import { execSync as
|
|
34013
|
+
import { execSync as execSync49 } from "child_process";
|
|
33989
34014
|
import chalk205 from "chalk";
|
|
33990
34015
|
function resolveOpSecret(reference) {
|
|
33991
34016
|
if (!reference.startsWith("op://")) {
|
|
@@ -33993,7 +34018,7 @@ function resolveOpSecret(reference) {
|
|
|
33993
34018
|
process.exit(1);
|
|
33994
34019
|
}
|
|
33995
34020
|
try {
|
|
33996
|
-
return
|
|
34021
|
+
return execSync49(`op read "${reference}"`, {
|
|
33997
34022
|
encoding: "utf8",
|
|
33998
34023
|
stdio: ["pipe", "pipe", "pipe"]
|
|
33999
34024
|
}).trim();
|
|
@@ -34447,9 +34472,9 @@ function registerReleases(parent) {
|
|
|
34447
34472
|
}
|
|
34448
34473
|
|
|
34449
34474
|
// src/commands/coverage.ts
|
|
34450
|
-
import { execSync as
|
|
34475
|
+
import { execSync as execSync50 } from "child_process";
|
|
34451
34476
|
function coverage() {
|
|
34452
|
-
const output =
|
|
34477
|
+
const output = execSync50(
|
|
34453
34478
|
"npx vitest run --coverage --coverage.include='src/**/*.ts' --coverage.all --coverage.reporter=text 2>&1",
|
|
34454
34479
|
{ encoding: "utf8", timeout: 12e4 }
|
|
34455
34480
|
);
|
|
@@ -34812,7 +34837,7 @@ async function notify() {
|
|
|
34812
34837
|
}
|
|
34813
34838
|
|
|
34814
34839
|
// src/commands/screenshot.ts
|
|
34815
|
-
import { execSync as
|
|
34840
|
+
import { execSync as execSync51 } from "child_process";
|
|
34816
34841
|
import { existsSync as existsSync65, mkdirSync as mkdirSync24, unlinkSync as unlinkSync15, writeFileSync as writeFileSync39 } from "fs";
|
|
34817
34842
|
import { tmpdir as tmpdir7 } from "os";
|
|
34818
34843
|
import { join as join83, resolve as resolve25 } from "path";
|
|
@@ -34955,7 +34980,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
34955
34980
|
const scriptPath = join83(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
34956
34981
|
writeFileSync39(scriptPath, captureWindowPs1, "utf8");
|
|
34957
34982
|
try {
|
|
34958
|
-
|
|
34983
|
+
execSync51(
|
|
34959
34984
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
34960
34985
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
34961
34986
|
);
|
|
@@ -35167,7 +35192,7 @@ async function statusLine() {
|
|
|
35167
35192
|
}
|
|
35168
35193
|
|
|
35169
35194
|
// src/commands/update.ts
|
|
35170
|
-
import { execSync as
|
|
35195
|
+
import { execSync as execSync52 } from "child_process";
|
|
35171
35196
|
import * as path46 from "path";
|
|
35172
35197
|
|
|
35173
35198
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
@@ -35191,7 +35216,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
35191
35216
|
if (resolved.split(path46.sep).includes("node_modules")) {
|
|
35192
35217
|
return true;
|
|
35193
35218
|
}
|
|
35194
|
-
const globalPrefix =
|
|
35219
|
+
const globalPrefix = execSync52("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
35195
35220
|
return resolved.toLowerCase().startsWith(path46.resolve(globalPrefix).toLowerCase());
|
|
35196
35221
|
} catch {
|
|
35197
35222
|
return false;
|
|
@@ -35202,18 +35227,18 @@ async function update2() {
|
|
|
35202
35227
|
console.log(`Assist is installed at: ${installDir}`);
|
|
35203
35228
|
if (isGitRepo(installDir)) {
|
|
35204
35229
|
console.log("Detected git repo installation, pulling latest...");
|
|
35205
|
-
|
|
35230
|
+
execSync52("git pull", { cwd: installDir, stdio: "inherit" });
|
|
35206
35231
|
console.log("Installing dependencies...");
|
|
35207
|
-
|
|
35232
|
+
execSync52("npm i", { cwd: installDir, stdio: "inherit" });
|
|
35208
35233
|
console.log("Building...");
|
|
35209
|
-
|
|
35234
|
+
execSync52("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
35210
35235
|
console.log("Syncing commands...");
|
|
35211
|
-
|
|
35236
|
+
execSync52("assist sync", { stdio: "inherit" });
|
|
35212
35237
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
35213
35238
|
console.log("Detected global npm installation, updating...");
|
|
35214
|
-
|
|
35239
|
+
execSync52("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
35215
35240
|
console.log("Syncing commands...");
|
|
35216
|
-
|
|
35241
|
+
execSync52("assist sync", { stdio: "inherit" });
|
|
35217
35242
|
} else {
|
|
35218
35243
|
console.error(
|
|
35219
35244
|
"Could not determine installation method. Expected a git repo or global npm install."
|
|
@@ -35316,7 +35341,7 @@ Refactor check failed:
|
|
|
35316
35341
|
}
|
|
35317
35342
|
|
|
35318
35343
|
// src/commands/refactor/check/getViolations.ts
|
|
35319
|
-
import { execSync as
|
|
35344
|
+
import { execSync as execSync53 } from "child_process";
|
|
35320
35345
|
import fs29 from "fs";
|
|
35321
35346
|
import { minimatch as minimatch3 } from "minimatch";
|
|
35322
35347
|
|
|
@@ -35366,7 +35391,7 @@ function getGitFiles(options2) {
|
|
|
35366
35391
|
}
|
|
35367
35392
|
const files = /* @__PURE__ */ new Set();
|
|
35368
35393
|
if (options2.staged || options2.modified) {
|
|
35369
|
-
const staged =
|
|
35394
|
+
const staged = execSync53("git diff --cached --name-only", {
|
|
35370
35395
|
encoding: "utf8"
|
|
35371
35396
|
});
|
|
35372
35397
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -35374,7 +35399,7 @@ function getGitFiles(options2) {
|
|
|
35374
35399
|
}
|
|
35375
35400
|
}
|
|
35376
35401
|
if (options2.unstaged || options2.modified) {
|
|
35377
|
-
const unstaged =
|
|
35402
|
+
const unstaged = execSync53("git diff --name-only", { encoding: "utf8" });
|
|
35378
35403
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
35379
35404
|
files.add(file);
|
|
35380
35405
|
}
|
|
@@ -38379,7 +38404,7 @@ function fetchHighLevelFiles(prNumber, repo) {
|
|
|
38379
38404
|
}
|
|
38380
38405
|
|
|
38381
38406
|
// src/commands/review/highLevel/fetchHighLevelPr.ts
|
|
38382
|
-
import { execSync as
|
|
38407
|
+
import { execSync as execSync54 } from "child_process";
|
|
38383
38408
|
|
|
38384
38409
|
// src/commands/review/highLevel/waitForMergeable.ts
|
|
38385
38410
|
var MAX_ATTEMPTS = 5;
|
|
@@ -38398,7 +38423,7 @@ function waitForMergeable(initial, refetch, delayMs = DELAY_MS) {
|
|
|
38398
38423
|
|
|
38399
38424
|
// src/commands/review/highLevel/fetchHighLevelPr.ts
|
|
38400
38425
|
function ghPrView(prNumber, repo, fields) {
|
|
38401
|
-
const raw =
|
|
38426
|
+
const raw = execSync54(
|
|
38402
38427
|
`gh pr view ${prNumber} --json ${fields} -R ${repo.org}/${repo.repo}`,
|
|
38403
38428
|
{ encoding: "utf8" }
|
|
38404
38429
|
);
|
|
@@ -39296,11 +39321,11 @@ function buildDiffLineIndex(diff3) {
|
|
|
39296
39321
|
}
|
|
39297
39322
|
|
|
39298
39323
|
// src/commands/review/fetchPrDiff.ts
|
|
39299
|
-
import { execSync as
|
|
39324
|
+
import { execSync as execSync55 } from "child_process";
|
|
39300
39325
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
39301
39326
|
const { org, repo } = getRepoInfo();
|
|
39302
39327
|
try {
|
|
39303
|
-
return
|
|
39328
|
+
return execSync55(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
39304
39329
|
encoding: "utf8",
|
|
39305
39330
|
maxBuffer: 256 * 1024 * 1024,
|
|
39306
39331
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -39315,10 +39340,10 @@ function isDiffTooLarge(error) {
|
|
|
39315
39340
|
}
|
|
39316
39341
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
39317
39342
|
try {
|
|
39318
|
-
|
|
39343
|
+
execSync55(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
39319
39344
|
} catch {
|
|
39320
39345
|
}
|
|
39321
|
-
return
|
|
39346
|
+
return execSync55(`git diff ${baseSha}...${headSha}`, {
|
|
39322
39347
|
encoding: "utf8",
|
|
39323
39348
|
maxBuffer: 256 * 1024 * 1024
|
|
39324
39349
|
});
|
|
@@ -40848,9 +40873,9 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
40848
40873
|
}
|
|
40849
40874
|
|
|
40850
40875
|
// src/commands/review/fetchExistingComments.ts
|
|
40851
|
-
import { execSync as
|
|
40876
|
+
import { execSync as execSync56 } from "child_process";
|
|
40852
40877
|
function fetchRawComments(org, repo, prNumber) {
|
|
40853
|
-
const out =
|
|
40878
|
+
const out = execSync56(
|
|
40854
40879
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
40855
40880
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
40856
40881
|
);
|
|
@@ -40911,18 +40936,18 @@ function logPriorComments(count10) {
|
|
|
40911
40936
|
}
|
|
40912
40937
|
|
|
40913
40938
|
// src/commands/review/gatherContext.ts
|
|
40914
|
-
import { execSync as
|
|
40939
|
+
import { execSync as execSync58 } from "child_process";
|
|
40915
40940
|
|
|
40916
40941
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
40917
|
-
import { execSync as
|
|
40942
|
+
import { execSync as execSync57 } from "child_process";
|
|
40918
40943
|
function getCurrentBranch3() {
|
|
40919
|
-
return
|
|
40944
|
+
return execSync57("git rev-parse --abbrev-ref HEAD", {
|
|
40920
40945
|
encoding: "utf8"
|
|
40921
40946
|
}).trim();
|
|
40922
40947
|
}
|
|
40923
40948
|
var FIELDS3 = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
40924
40949
|
function runGh2(command) {
|
|
40925
|
-
return
|
|
40950
|
+
return execSync57(command, {
|
|
40926
40951
|
encoding: "utf8",
|
|
40927
40952
|
stdio: ["ignore", "pipe", "pipe"]
|
|
40928
40953
|
});
|
|
@@ -40960,7 +40985,7 @@ function fetchPrDiffInfo() {
|
|
|
40960
40985
|
}
|
|
40961
40986
|
function fetchPrChangedFiles(prNumber) {
|
|
40962
40987
|
const { org, repo } = getRepoInfo();
|
|
40963
|
-
const out =
|
|
40988
|
+
const out = execSync57(
|
|
40964
40989
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
40965
40990
|
{
|
|
40966
40991
|
encoding: "utf8",
|
|
@@ -40972,11 +40997,11 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
40972
40997
|
|
|
40973
40998
|
// src/commands/review/gatherContext.ts
|
|
40974
40999
|
function gatherContext() {
|
|
40975
|
-
const branch2 =
|
|
41000
|
+
const branch2 = execSync58("git rev-parse --abbrev-ref HEAD", {
|
|
40976
41001
|
encoding: "utf8"
|
|
40977
41002
|
}).trim();
|
|
40978
|
-
const sha =
|
|
40979
|
-
const shortSha =
|
|
41003
|
+
const sha = execSync58("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
41004
|
+
const shortSha = execSync58("git rev-parse --short=7 HEAD", {
|
|
40980
41005
|
encoding: "utf8"
|
|
40981
41006
|
}).trim();
|
|
40982
41007
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -43861,7 +43886,7 @@ function adviceFragments() {
|
|
|
43861
43886
|
}
|
|
43862
43887
|
|
|
43863
43888
|
// src/commands/verify/blockCodeComments/findComments.ts
|
|
43864
|
-
import { execSync as
|
|
43889
|
+
import { execSync as execSync59 } from "child_process";
|
|
43865
43890
|
import fs48 from "fs";
|
|
43866
43891
|
import { minimatch as minimatch9 } from "minimatch";
|
|
43867
43892
|
import { Project as Project5 } from "ts-morph";
|
|
@@ -44100,7 +44125,7 @@ function shouldScan(file, ignoreGlobs) {
|
|
|
44100
44125
|
return fs48.existsSync(file);
|
|
44101
44126
|
}
|
|
44102
44127
|
function findComments(options2) {
|
|
44103
|
-
const diff3 =
|
|
44128
|
+
const diff3 = execSync59("git diff HEAD", {
|
|
44104
44129
|
encoding: "utf8",
|
|
44105
44130
|
maxBuffer: 64 * 1024 * 1024
|
|
44106
44131
|
});
|
|
@@ -44381,14 +44406,14 @@ function listMigrationFiles(dir) {
|
|
|
44381
44406
|
}
|
|
44382
44407
|
|
|
44383
44408
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
44384
|
-
import { execSync as
|
|
44409
|
+
import { execSync as execSync60 } from "child_process";
|
|
44385
44410
|
import { basename as basename31 } from "path";
|
|
44386
44411
|
var MIGRATION_FILE3 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
44387
44412
|
function readBaselineMigrations(repoRelativeDir, ref) {
|
|
44388
44413
|
const baseline = /* @__PURE__ */ new Map();
|
|
44389
44414
|
let listing;
|
|
44390
44415
|
try {
|
|
44391
|
-
listing =
|
|
44416
|
+
listing = execSync60(
|
|
44392
44417
|
`git ls-tree -r --name-only "${ref}" -- "${repoRelativeDir}"`,
|
|
44393
44418
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }
|
|
44394
44419
|
);
|
|
@@ -44398,7 +44423,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
44398
44423
|
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path108) => MIGRATION_FILE3.test(basename31(path108)));
|
|
44399
44424
|
for (const path108 of paths) {
|
|
44400
44425
|
try {
|
|
44401
|
-
const content =
|
|
44426
|
+
const content = execSync60(`git show "${ref}:${path108}"`, {
|
|
44402
44427
|
encoding: "utf8",
|
|
44403
44428
|
maxBuffer: 16 * 1024 * 1024,
|
|
44404
44429
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -44411,10 +44436,10 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
44411
44436
|
}
|
|
44412
44437
|
|
|
44413
44438
|
// src/commands/verify/migrations/resolveBaselineRef.ts
|
|
44414
|
-
import { execSync as
|
|
44439
|
+
import { execSync as execSync61 } from "child_process";
|
|
44415
44440
|
function refExists2(ref) {
|
|
44416
44441
|
try {
|
|
44417
|
-
|
|
44442
|
+
execSync61(`git rev-parse --verify --quiet "${ref}"`, {
|
|
44418
44443
|
stdio: ["pipe", "pipe", "pipe"]
|
|
44419
44444
|
});
|
|
44420
44445
|
return true;
|
|
@@ -44490,10 +44515,10 @@ Total: ${problems.length} violation(s).`);
|
|
|
44490
44515
|
}
|
|
44491
44516
|
|
|
44492
44517
|
// src/commands/verify/noVenv.ts
|
|
44493
|
-
import { execSync as
|
|
44518
|
+
import { execSync as execSync62 } from "child_process";
|
|
44494
44519
|
function noVenv() {
|
|
44495
44520
|
try {
|
|
44496
|
-
const output =
|
|
44521
|
+
const output = execSync62(
|
|
44497
44522
|
"find . -type d -name venv -not -path '*/node_modules/*'",
|
|
44498
44523
|
{
|
|
44499
44524
|
encoding: "utf8"
|
|
@@ -44930,7 +44955,7 @@ function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
|
44930
44955
|
}
|
|
44931
44956
|
|
|
44932
44957
|
// src/commands/run/runPreCommands.ts
|
|
44933
|
-
import { execSync as
|
|
44958
|
+
import { execSync as execSync63 } from "child_process";
|
|
44934
44959
|
function writeCapturedOutput(error) {
|
|
44935
44960
|
for (const stream of ["stdout", "stderr"]) {
|
|
44936
44961
|
const output = error[stream];
|
|
@@ -44940,7 +44965,7 @@ function writeCapturedOutput(error) {
|
|
|
44940
44965
|
function runPreCommands(pre, cwd, quiet) {
|
|
44941
44966
|
for (const cmd of pre) {
|
|
44942
44967
|
try {
|
|
44943
|
-
|
|
44968
|
+
execSync63(cmd, { stdio: quiet ? "pipe" : "inherit", cwd });
|
|
44944
44969
|
} catch (error) {
|
|
44945
44970
|
if (quiet && error && typeof error === "object")
|
|
44946
44971
|
writeCapturedOutput(error);
|