@staff0rd/assist 0.937.0 → 0.938.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/README.md +2 -1
- package/claude/commands/add-rule.md +12 -3
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +138 -96
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -272,6 +272,7 @@ Rules are `- **<code>** — **<title>** — <text>` bullets, the title optional,
|
|
|
272
272
|
|
|
273
273
|
- `assist rules list [path] [--full]` - List the rules in scope for a path (default: cwd); `--full` adds each rule's description
|
|
274
274
|
- `assist rules add <text> [--title <title>] [--scope <path>]` - Add a rule to the `## Rules` section of the `CLAUDE.md` nearest `--scope` (default cwd)
|
|
275
|
+
- `assist rules add <text> --title <title> --global` - Append a `{ title, text }` entry to `advice.rules` in `~/.assist.yml` instead, for rules about agent conduct that hold in every repo; it takes no R-code and can't be combined with `--scope`. Global rules are per machine (WSL and Windows each have their own `~/.assist.yml`)
|
|
275
276
|
- `assist rules index` - Record the directories that carry their own `## Rules` in the repo root's `CLAUDE.md`; run it after hand-editing a `## Rules` section
|
|
276
277
|
|
|
277
278
|
### Devlog
|
|
@@ -297,7 +298,7 @@ Rules are `- **<code>** — **<title>** — <text>` bullets, the title optional,
|
|
|
297
298
|
- `assist code-comment confirm <pin>` - Insert the pinned comment at its file/line
|
|
298
299
|
- `assist db-migration unlock` - Ask a human to approve creating the next migration module
|
|
299
300
|
- `assist db-migration confirm <pin>` - Confirm a pin from `db-migration unlock`, letting that migration's file be written once
|
|
300
|
-
- `assist advise [--hook] [--explain]` - Print the advice fragments that apply to the current repo; `--hook` runs it as a SessionStart hook and `--explain` shows why each fragment was or wasn't included. `advice.sections` forces a fragment in or out by name, `advice.verify` replaces the verify fragment's text
|
|
301
|
+
- `assist advise [--hook] [--explain]` - Print the advice fragments that apply to the current repo; `--hook` runs it as a SessionStart hook and `--explain` shows why each fragment was or wasn't included. `advice.sections` forces a fragment in or out by name, `advice.verify` replaces the verify fragment's text, `advice.extra` appends repo notes and `advice.rules` (`{ title, text }` entries, global and repo lists concatenated, global first) adds a "Your rules" section
|
|
301
302
|
- `assist notify` - Show desktop notification from JSON stdin (macOS, Windows, WSL)
|
|
302
303
|
- `assist status-line` - Format Claude Code status line from JSON stdin
|
|
303
304
|
|
|
@@ -25,8 +25,9 @@ Ask the user a clarifying question only when the note is genuinely too vague to
|
|
|
25
25
|
|
|
26
26
|
## Step 3: Work out the scope
|
|
27
27
|
|
|
28
|
-
The scope is the directory whose `CLAUDE.md` gets the rule. Infer it — do not ask by default:
|
|
28
|
+
The scope is the directory whose `CLAUDE.md` gets the rule, or global. Infer it — do not ask by default:
|
|
29
29
|
|
|
30
|
+
- If the rule is about agent conduct that holds in every repo rather than about this repo's code or docs (e.g. "give the URL, not a nav path", "don't ask for sign-off in chat"), the scope is **global**: it goes to `advice.rules` in `~/.assist.yml` and reaches every session on this machine. A rule that only makes sense for this repo's files, conventions or tooling is never global.
|
|
30
31
|
- With a file path, the default is the nearest `CLAUDE.md` walking up from that file's directory to the repo root. `assist rules list <path>` shows what is already in scope there, which tells you where sibling rules live.
|
|
31
32
|
- If the note is clearly about a kind of document that lives in one directory (and the file sits in it), that directory's `CLAUDE.md` is the scope — pass `--scope <dir>/CLAUDE.md` to create it there when it does not exist yet.
|
|
32
33
|
- If the rule plainly applies repo-wide, use the root `CLAUDE.md`.
|
|
@@ -42,12 +43,20 @@ assist rules add '<rule text>' --title '<title>' --scope <path> 2>&1
|
|
|
42
43
|
|
|
43
44
|
`--scope` takes a file, a directory, or a `CLAUDE.md` path directly. A file or directory resolves to the nearest existing `CLAUDE.md` at or above it; a `CLAUDE.md` path is written to as given, created if absent. The command allocates the next repo-wide code, creates the `## Rules` section when the file has none, and records the directories that carry their own `## Rules` in the root `CLAUDE.md`.
|
|
44
45
|
|
|
46
|
+
For a global rule, pass `--global` instead of `--scope` (the two can't be combined); `--title` is required:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
assist rules add '<rule text>' --title '<title>' --global 2>&1
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
It appends the rule to `advice.rules` in `~/.assist.yml` with no R-code. Global rules are per machine, so on a setup with both WSL and Windows nodes tell the user it only reaches this one.
|
|
53
|
+
|
|
45
54
|
Use single quotes around the rule text to avoid shell escaping issues.
|
|
46
55
|
|
|
47
|
-
Show the command output — it names the allocated code and the file — then tell the user in one line which rule was added and where.
|
|
56
|
+
Show the command output — it names the allocated code (or, for a global rule, the title) and the file — then tell the user in one line which rule was added and where.
|
|
48
57
|
|
|
49
58
|
## Step 5: Fix what broke it
|
|
50
59
|
|
|
51
|
-
The rule exists because something broke it, so the quoted text is now a live violation. Rectify it in the same pass, without being asked: edit the quoted text in the file the `File:` line named, so it follows the rule you just wrote. Where there was no `File:` line, fix the draft or the text the quote came from.
|
|
60
|
+
The rule exists because something broke it, so the quoted text is now a live violation. Rectify it in the same pass, without being asked: edit the quoted text in the file the `File:` line named, so it follows the rule you just wrote. Where there was no `File:` line, fix the draft or the text the quote came from. A global rule is no exception: the quoted violation still gets fixed, even though the rule went to `~/.assist.yml` rather than a file in this repo.
|
|
52
61
|
|
|
53
62
|
Fix the instance you were given. Do not sweep the rest of the repo for other violations of the new rule unless the user asks for that.
|
|
@@ -4019,7 +4019,7 @@ ${f.join(`
|
|
|
4019
4019
|
`,Nti=po`
|
|
4020
4020
|
0%, 100% { transform: scale(1); }
|
|
4021
4021
|
50% { transform: scale(1.08); }
|
|
4022
|
-
`,VSr={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:`${Dti} 1.8s linear infinite`},Oti={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${Nti} 1.6s ease-in-out infinite`,"&::before":{...VSr,inset:0,zIndex:-1},"&::after":{...VSr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gs.rainbowPill.text,textShadow:Gs.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function qSr({children:e}){return(0,zA.jsxs)(zA.Fragment,{children:[(0,zA.jsx)(J_,{styles:Iti}),(0,zA.jsx)(ne,{component:"span","data-testid":"rainbow-pill",sx:Oti,children:e})]})}function jSr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function YSr(e){if(e.length!==2)return!1;let[t,r]=e;return jSr(t)===jSr(r)}var fT=E($(),1);function V1e({rateLimits:e}){let t=c_(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=YSr(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:W1e(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,fT.jsxs)(KSr.Fragment,{children:[a>0?(0,fT.jsx)(ne,{component:"span",sx:{color:o$,mr:.5},children:","}):null,(0,fT.jsx)(GSr,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,fT.jsx)(qSr,{children:i}):(0,fT.jsx)(fT.Fragment,{children:i})}var k_=E($(),1);function ZSr({groups:e}){return(0,k_.jsx)(k_.Fragment,{children:e.map((t,r)=>(0,k_.jsxs)(XSr.Fragment,{children:[(0,k_.jsx)(ne,{component:"span",sx:{color:o$,ml:r>0?1:0,mr:.5},children:Mu(t.harness)}),(0,k_.jsx)(V1e,{rateLimits:t.rateLimits})]},t.harness))})}function Bti(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function Fti(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function $ti(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function eCr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=xWe(t,r,n);if(i==null)return{kind:"unprojectable"};let o=l_(e,t,r,n),a=Bti(o),s=Fti(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:$ti(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function q1e(e){return t=>t.tokens.color.onAppBar.level[e]}function tCr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${i1e(e.at,t)}`}var N0=E($(),1);function UWe({direction:e,threshold:t}){let r=e==="back",n={display:"inline-flex",gap:.5,minWidth:"6ch",justifyContent:r?"flex-end":"flex-start"};if(!t)return(0,N0.jsx)(ne,{component:"span",sx:n});let i=(0,N0.jsx)(ne,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,N0.jsxs)(ne,{component:"span",sx:{color:q1e(t.level)},children:[Math.round(t.pct),"%"]});return(0,N0.jsx)(ne,{component:"span",sx:n,children:r?(0,N0.jsxs)(N0.Fragment,{children:[o,i]}):(0,N0.jsxs)(N0.Fragment,{children:[i,o]})})}var __=E($(),1);function rCr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=l_(t,r,n,i),a=eCr(t,r,n,i),s=a.kind==="projected"?a:void 0;return(0,__.jsxs)(ne,{sx:{display:"flex",alignItems:"baseline",gap:.75},children:[(0,__.jsx)(ne,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,__.jsx)(UWe,{direction:"back",threshold:s?.recovery}),(0,__.jsxs)(ne,{component:"span",sx:{minWidth:"4ch",textAlign:"right",color:q1e(o)},children:[Math.round(t),"%"]}),(0,__.jsx)(UWe,{direction:"forward",threshold:s?.worse}),(0,__.jsx)(ne,{component:"span",sx:{opacity:.6},children:s?s.recovery&&tCr(s.recovery,i):"no projection yet"})]})}function nCr(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 iCr=E($(),1);function j1e({rateLimits:e,now:t}){return nCr(e).map(r=>(0,iCr.jsx)(rCr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var HA=E($(),1);function oCr({groups:e}){let t=c_(3e4);return(0,HA.jsxs)(ne,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[e.map(r=>(0,HA.jsxs)(ne,{sx:{mb:.5},children:[(0,HA.jsx)(ne,{sx:{opacity:.8},children:Mu(r.harness)}),(0,HA.jsx)(j1e,{rateLimits:r.rateLimits,now:t})]},r.harness)),(0,HA.jsx)(ne,{sx:{mt:.5,opacity:.6},children:"Account usage per harness \u2014 view history"})]})}function aCr(e){return e?.five_hour?.used_percentage!=null||e?.seven_day?.used_percentage!=null}function sCr(e,t){let r=[];aCr(e)&&r.push({harness:"claude",rateLimits:e});for(let[n,i]of Object.entries(t))aCr(i)&&r.push({harness:n,rateLimits:i});return r}var zti={display:"flex",alignItems:"center",ml:2,fontFamily:"fontFamilyMono",fontSize:13},Hti={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}},lCr=e=>e?Hti:zti;var TX=E($(),1),WWe="Claude account usage (5h / 7d windows) \u2014 view history";function cCr({rateLimits:e}){let t=c_(3e4);return(0,TX.jsxs)(ne,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[(0,TX.jsx)(j1e,{rateLimits:e,now:t}),(0,TX.jsx)(ne,{sx:{mt:.5,opacity:.6},children:WWe})]})}var UA=E($(),1),Uti={};function Y1e({rateLimits:e,harnessRateLimits:t=Uti,onStatusBar:r=!1}){let n=sCr(e,t),i=n.every(l=>l.harness==="claude"),o=e,a=WWe,s="Usage";return n.length>0&&i?(a=(0,UA.jsx)(cCr,{rateLimits:o}),s=(0,UA.jsx)(V1e,{rateLimits:o})):n.length>0&&(a=(0,UA.jsx)(oCr,{groups:n}),s=(0,UA.jsx)(ZSr,{groups:n})),(0,UA.jsx)(lr,{title:a,placement:r?"top-start":"bottom",children:(0,UA.jsx)(Xr,{component:ws,to:"/usage",underline:r?"none":"hover",color:"inherit",sx:lCr(r),children:s})})}var dCr=E(fe(),1);var E_="0.937.0";var K1e=E(fe(),1),GWe=(0,K1e.createContext)(null);function X1e(){return(0,K1e.useContext)(GWe)}var VWe=E($(),1);function uCr(){let e=X1e();return!e||e===E_?null:(0,VWe.jsx)(lr,{title:`Daemon is running v${e}, but this page was served by v${E_}. Restart the daemon to match.`,children:(0,VWe.jsx)(D1e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var qWe=e=>e.tokens.color.statusBar,Wti={height:22,py:0,borderRadius:1,fontSize:"inherit",opacity:1,"&:hover, &:focus-visible":{bgcolor:e=>qWe(e)?.hover,color:e=>qWe(e)?.hoverText},"& .ready-count":{fontWeight:500,color:e=>qWe(e)?.readyText}},fCr=(e,t=!1)=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:.25,borderRadius:999,fontSize:12,lineHeight:1.5,color:"inherit",opacity:e?1:.55,bgcolor:r=>e?w_(r).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{opacity:1,bgcolor:r=>w_(r).hover},"& .ready-dot":{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:r=>w_(r).dot,boxShadow:r=>`0 0 0 ${t?3:2}px ${w_(r).dotRing}`},"& .ready-count":{fontWeight:500},...t&&Wti});var sg=E($(),1);function Z1e({onStatusBar:e=!1}){let{entries:t}=kF(),r=Oi(),n=(0,dCr.useCallback)(()=>r("/updates"),[r]),{matches:i,chords:o}=Yn("openUpdates");if(Eo(i,n),!E_)return null;let a=t.filter(MF).length;return(0,sg.jsxs)(sg.Fragment,{children:[(0,sg.jsx)(lr,{describeChild:!0,placement:e?"top-end":"bottom",title:(0,sg.jsx)(Iu,{label:"Updates",chords:o}),children:(0,sg.jsxs)(mn,{component:ws,to:"/updates","aria-label":a?`Updates: ${a} node${a>1?"s have":" has"} an update ready`:"Updates",sx:fCr(a>0,e),children:[a>0&&(0,sg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,sg.jsxs)("span",{children:["v",E_]}),a>0&&(0,sg.jsxs)("span",{className:"ready-count",children:[a," ready"]})]})}),(0,sg.jsx)(uCr,{})]})}var Q1e=E($(),1);function hCr({socket:e}){return(0,Q1e.jsx)(USr,{start:(0,Q1e.jsx)(Y1e,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits,onStatusBar:!0}),end:(0,Q1e.jsx)(Z1e,{onStatusBar:!0})})}var nve=E(fe(),1);var rve=E(fe(),1);function pCr(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 R_=E($(),1),Gti={display:"flex",gap:1,alignItems:"center",minWidth:0},Vti={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},qti={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},jti={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Yti(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function mCr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,R_.jsx)(Hp,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=Yti(i);return(0,R_.jsxs)(ln,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:Gti,children:[(0,R_.jsx)(dB,{path:i}),(0,R_.jsxs)(ne,{sx:Vti,children:[(0,R_.jsx)(Le,{component:"span",sx:qti,children:s}),(0,R_.jsx)(Le,{component:"span",color:"text.secondary",sx:jti,children:a})]})]},i)})})}var J1e=E($(),1),Kti={maxHeight:420,overflowY:"auto"},Xti={px:2,py:2,fontSize:13};function gCr({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,J1e.jsx)(ne,{sx:Kti,children:e?(0,J1e.jsx)(Le,{color:"text.secondary",sx:Xti,children:e}):(0,J1e.jsx)(mCr,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var yCr=E($(),1),Zti={mt:6,alignSelf:"flex-start"};function eve({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,yCr.jsx)(Wl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:Zti},transition:{onEntered:t}},children:n})}var tve=E(fe(),1);var vCr={files:[],loading:!1,error:!1};function bCr(e,t){let[r,n]=(0,tve.useState)(vCr),i=yr();return(0,tve.useEffect)(()=>{if(!e){n(vCr);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await fetch(jr(`/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 WA=E($(),1);function Qti(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function xCr({onClose:e}){let{worktreeNode:t}=zn();return(0,WA.jsx)(mf.Provider,{value:t,children:(0,WA.jsx)(Jti,{onClose:e})})}function Jti({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=zn(),[n,i]=(0,rve.useState)(""),o=bCr(t,n),a=Oi(),s=(0,rve.useRef)(null),l=p=>a(Qti(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=g_(o.files,n,l,e),h=p=>{l(p),e()};return(0,WA.jsxs)(eve,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,WA.jsx)(gS,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,WA.jsx)(gCr,{message:pCr(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function TCr(e){Eo(Yn("quickOpen").matches,e)}var CCr=E($(),1);function SCr(){let[e,t]=(0,nve.useState)(!1);return TCr((0,nve.useCallback)(()=>t(!0),[])),e?(0,CCr.jsx)(xCr,{onClose:()=>t(!1)}):null}var ive=E($(),1);function wCr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,ive.jsx)(Bh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,ive.jsx)(yi,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,ive.jsx)(Dt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var wX=E(fe(),1);function kCr(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var FCr=E(fe(),1);var _Cr=E($(),1),ECr=st((0,_Cr.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 eri={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function RCr(e){return e?eri[e]:"success.main"}function ACr(e){return e.split("-")[0].split(".").map(Number)}function PCr(e,t){if(!e||!t||e===t)return;let r=ACr(e),n=ACr(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 GA=E($(),1),tri={height:16,fontSize:10},rri={opacity:.6,fontSize:"0.85em"};function nri(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 SX({nodes:e,name:t,showVersion:r=!1}){let n=X1e()??E_,i=e.links.find(a=>a.name===t),o=PCr(i?.peerVersion,n);return(0,GA.jsx)(lr,{title:nri(e,t),placement:"right",children:(0,GA.jsxs)(ne,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,GA.jsx)(ECr,{sx:{fontSize:8,color:RCr(i?.state)}}),t,r&&i?.peerVersion&&(0,GA.jsxs)(ne,{component:"span",sx:rri,children:["v",i.peerVersion]}),o&&(0,GA.jsx)(dn,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:tri})]})})}var VA=E($(),1),iri={opacity:.6},ori={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function LCr({nodes:e,name:t,clone:r}){let n=(0,VA.jsx)(SX,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,VA.jsx)(ne,{component:"span",sx:iri,children:n}):(0,VA.jsx)(lr,{title:VF(t,r.cloneTarget),children:(0,VA.jsxs)(ne,{component:"span",sx:ori,children:[(0,VA.jsx)(GF,{sx:{fontSize:14}}),n]})})}var ICr=E($(),1),ari={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 MCr({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,ICr.jsx)(mn,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:ari,children:t})}var DCr={ArrowRight:1,ArrowLeft:-1};function sri(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+DCr[e.key]+r)%r}function NCr(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!DCr[i.key]){A2(i);return}let o=sri(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var OCr=E(fe(),1);function a$(e){return e?.querySelector('[aria-checked="true"]')}function BCr(e,t){(0,OCr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=a$(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var jWe=E($(),1),lri={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function ove({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return BCr(o,r),(0,jWe.jsx)(Rt,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:NCr(t,r,n,l),sx:lri,children:t.map(u=>(0,jWe.jsx)(MCr,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var YWe=E($(),1);function $Cr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=_c(),a=(0,FCr.useRef)(null);return!o||!n||!e?null:(0,YWe.jsx)(ove,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,YWe.jsx)(LCr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var HCr=E($(),1);function zCr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,HCr.jsx)(ei,{value:e,onChange:a=>t(a.target.value),onKeyDown:A2,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"},input:{sx:{fontSize:14}}}})}var VCr=E(fe(),1);var dT={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:$ge,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},UCr=Object.keys(dT);var KWe=E($(),1);function WCr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,KWe.jsx)(Bs,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,KWe.jsx)(ln,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:Mu(o)},o))})}var qA=E($(),1);function GCr(e){return t=>t==="prompt"&&e?(0,qA.jsxs)(qA.Fragment,{children:["prompt",(0,qA.jsx)(ne,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Mu(e)}`}),(0,qA.jsx)(bd,{sx:{fontSize:18,mr:-.75}})]}):t}var jA=E($(),1);function qCr({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,VCr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(a$(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,jA.jsxs)(jA.Fragment,{children:[(0,jA.jsx)(ove,{label:"Mode",options:UCr,value:e.mode,onChange:l,optionLabel:GCr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,jA.jsx)(WCr,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var nwr=E(fe(),1);var XWe=E($(),1),cri={zIndex:e=>e.zIndex.modal+1};function jCr({open:e,anchor:t,children:r}){return(0,XWe.jsx)(J6,{open:e,anchorEl:t,placement:"bottom-start",sx:cri,children:(0,XWe.jsx)(rn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}function YCr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:{fontSize:13,height:40}}}}var KCr=E(F6(),1);function XCr({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}A2(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,KCr.flushSync)(()=>{r(t),n()}),A2(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function ZCr(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Tv(n).toLowerCase().includes(r)):e}var ZWe=E(fe(),1);function QCr(){let[e,t]=(0,ZWe.useState)(!1),[r,n]=(0,ZWe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var ewr=E(fe(),1);var JCr=e=>e?Tv(e):"";function twr(e){let[t,r]=(0,ewr.useState)(()=>JCr(e));return{text:t,setText:r,showRepo:n=>r(JCr(n))}}function rwr(e,t,r){let n=QCr(),i=twr(t),o=ZCr(e,n.query),a=f=>{r(f),i.showRepo(f)},s=g_(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:XCr({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 s$=E($(),1);function iwr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=rwr(e,t,r),s=(0,nwr.useRef)(null);return(0,s$.jsxs)(ne,{ref:s,sx:{flex:1,minWidth:0},children:[(0,s$.jsx)(ei,{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:YCr(a.open)}),(0,s$.jsx)(jCr,{open:a.open,anchor:s.current,children:(0,s$.jsx)(A1e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var A_=E($(),1);function owr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=zn();return(0,A_.jsxs)(Rt,{spacing:1,sx:{p:1},children:[(0,A_.jsx)(zCr,{value:r.prompt,onChange:r.setPrompt,placeholder:dT[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),(0,A_.jsxs)(Rt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,A_.jsx)(iwr,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,A_.jsx)(qCr,{...t})]}),(0,A_.jsx)($Cr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var l$=E($(),1),uri=["Enter start","Shift+Enter newline","Esc close"],fri={alignItems:"center",px:1.5,py:1,borderTop:1,borderColor:"divider",bgcolor:"action.hover"};function awr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,l$.jsxs)(Rt,{direction:"row",spacing:1.5,sx:fri,children:[(0,l$.jsx)(Rt,{direction:"row",spacing:1.5,sx:{mr:"auto"},children:uri.map(n=>(0,l$.jsx)(Le,{variant:"caption",color:"text.secondary",children:n},n))}),(0,l$.jsx)(Dt,{type:"submit",variant:"contained",size:"small",disabled:t,loading:r,children:e})]})}var YA=E(fe(),1);function swr(e,t){let r=(0,YA.useRef)(e),n=(0,YA.useRef)(null),i=(0,YA.useRef)(null),o=(0,YA.useRef)(null),a=(0,YA.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:a$(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 dri(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:L1e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function lwr(e,t){let{names:r,visible:n}=_c(),i=_1e(t,n?r:[void 0]);return{cloneState:i,target:dri(t,e,i(e))}}function cwr({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}]:[];Pur(dT[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function uwr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(v1e(r.prompt,n.onCreateAssist),!0):(cwr({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var ave=E(fe(),1);function fwr(e,t){let[r,n]=(0,ave.useState)(!1);return(0,ave.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function dwr(e,t,r,n,i){let o=fwr(e,()=>{uwr(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var CX=E(fe(),1);function hwr(e,t){let r=(0,CX.useRef)(e),n=(0,CX.useRef)(null);return(0,CX.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 mwr=E($(),1),hri={border:0,margin:0,padding:0,minWidth:0};function pwr({loading:e,restoreFocus:t,children:r}){let n=hwr(e,t);return(0,mwr.jsx)("fieldset",{disabled:e,style:hri,onFocus:n,children:r})}var KA=E($(),1);function gwr({draft:e,launchers:t,onClose:r}){let n=swr(e.focus,e.setFocus),i=kCr(f_()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=lwr(e.node,e.cwd),l=dwr(e,o,a,t,r);return(0,KA.jsx)(eve,{onClose:r,onEntered:n.restore,centered:!0,children:(0,KA.jsx)("form",{onSubmit:l,children:(0,KA.jsxs)(pwr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,KA.jsx)(owr,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,KA.jsx)(awr,{submitLabel:a.kind==="clone"?"Clone":dT[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var sve=E(fe(),1);var pri=1e3;async function mri(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await fetch(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(dT,n?.mode)?n.mode:null}catch{return null}}function ywr(e,t=0){let[r,n]=(0,sve.useState)(null);return(0,sve.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await mri(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,pri))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function vwr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var hT=E(fe(),1),bwr={field:"prompt",selectionStart:0,selectionEnd:0};function xwr(){let[e,t]=(0,hT.useState)(""),[r,n]=(0,hT.useState)(),[i,o]=(0,hT.useState)(),[a,s]=(0,hT.useState)("claude"),[l,u]=(0,hT.useState)(),[f,d]=(0,hT.useState)(bwr),h=(0,hT.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(bwr)},[]);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 Twr(e,t=ywr){let{selectedCwd:r}=zn(),n=_c(),i=xwr(),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:vwr(i.node,n)}:null}function Swr(e){Eo(Yn("newSession").matches,e)}var Cwr=E(fe(),1);function wwr(e,t){let{selectedCwd:r}=zn(),[n,i]=Uc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,Cwr.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 _wr=E($(),1);function kwr({launchers:e}){let[t,r]=(0,wX.useState)(!1),[n,i]=(0,wX.useState)(0),o=Twr(n),a=(0,wX.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return Swr(a),wwr(o,a),!t||!o?null:(0,_wr.jsx)(gwr,{draft:o,launchers:e,onClose:()=>r(!1)})}var lve=E($(),1);function Ewr({reconnecting:e}){return(0,lve.jsx)(Bh,{open:e,children:(0,lve.jsx)(yi,{severity:"info",variant:"filled",icon:(0,lve.jsx)(oo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Rv=E($(),1);function Rwr({socket:e,onViewLaunchedSession:t}){return(0,Rv.jsxs)(Rv.Fragment,{children:[(0,Rv.jsx)(SCr,{}),(0,Rv.jsx)(kwr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Rv.jsx)(Ewr,{reconnecting:e.reconnecting}),(0,Rv.jsx)(Xl,{error:e.error,onClose:e.clearError}),(0,Rv.jsx)(wCr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Av=E(fe(),1);var gri=6e4;function yri(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function Awr(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4022
|
+
`,VSr={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:`${Dti} 1.8s linear infinite`},Oti={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${Nti} 1.6s ease-in-out infinite`,"&::before":{...VSr,inset:0,zIndex:-1},"&::after":{...VSr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gs.rainbowPill.text,textShadow:Gs.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function qSr({children:e}){return(0,zA.jsxs)(zA.Fragment,{children:[(0,zA.jsx)(J_,{styles:Iti}),(0,zA.jsx)(ne,{component:"span","data-testid":"rainbow-pill",sx:Oti,children:e})]})}function jSr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function YSr(e){if(e.length!==2)return!1;let[t,r]=e;return jSr(t)===jSr(r)}var fT=E($(),1);function V1e({rateLimits:e}){let t=c_(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=YSr(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:W1e(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,fT.jsxs)(KSr.Fragment,{children:[a>0?(0,fT.jsx)(ne,{component:"span",sx:{color:o$,mr:.5},children:","}):null,(0,fT.jsx)(GSr,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,fT.jsx)(qSr,{children:i}):(0,fT.jsx)(fT.Fragment,{children:i})}var k_=E($(),1);function ZSr({groups:e}){return(0,k_.jsx)(k_.Fragment,{children:e.map((t,r)=>(0,k_.jsxs)(XSr.Fragment,{children:[(0,k_.jsx)(ne,{component:"span",sx:{color:o$,ml:r>0?1:0,mr:.5},children:Mu(t.harness)}),(0,k_.jsx)(V1e,{rateLimits:t.rateLimits})]},t.harness))})}function Bti(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function Fti(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function $ti(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function eCr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=xWe(t,r,n);if(i==null)return{kind:"unprojectable"};let o=l_(e,t,r,n),a=Bti(o),s=Fti(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:$ti(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function q1e(e){return t=>t.tokens.color.onAppBar.level[e]}function tCr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${i1e(e.at,t)}`}var N0=E($(),1);function UWe({direction:e,threshold:t}){let r=e==="back",n={display:"inline-flex",gap:.5,minWidth:"6ch",justifyContent:r?"flex-end":"flex-start"};if(!t)return(0,N0.jsx)(ne,{component:"span",sx:n});let i=(0,N0.jsx)(ne,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,N0.jsxs)(ne,{component:"span",sx:{color:q1e(t.level)},children:[Math.round(t.pct),"%"]});return(0,N0.jsx)(ne,{component:"span",sx:n,children:r?(0,N0.jsxs)(N0.Fragment,{children:[o,i]}):(0,N0.jsxs)(N0.Fragment,{children:[i,o]})})}var __=E($(),1);function rCr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=l_(t,r,n,i),a=eCr(t,r,n,i),s=a.kind==="projected"?a:void 0;return(0,__.jsxs)(ne,{sx:{display:"flex",alignItems:"baseline",gap:.75},children:[(0,__.jsx)(ne,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,__.jsx)(UWe,{direction:"back",threshold:s?.recovery}),(0,__.jsxs)(ne,{component:"span",sx:{minWidth:"4ch",textAlign:"right",color:q1e(o)},children:[Math.round(t),"%"]}),(0,__.jsx)(UWe,{direction:"forward",threshold:s?.worse}),(0,__.jsx)(ne,{component:"span",sx:{opacity:.6},children:s?s.recovery&&tCr(s.recovery,i):"no projection yet"})]})}function nCr(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 iCr=E($(),1);function j1e({rateLimits:e,now:t}){return nCr(e).map(r=>(0,iCr.jsx)(rCr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var HA=E($(),1);function oCr({groups:e}){let t=c_(3e4);return(0,HA.jsxs)(ne,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[e.map(r=>(0,HA.jsxs)(ne,{sx:{mb:.5},children:[(0,HA.jsx)(ne,{sx:{opacity:.8},children:Mu(r.harness)}),(0,HA.jsx)(j1e,{rateLimits:r.rateLimits,now:t})]},r.harness)),(0,HA.jsx)(ne,{sx:{mt:.5,opacity:.6},children:"Account usage per harness \u2014 view history"})]})}function aCr(e){return e?.five_hour?.used_percentage!=null||e?.seven_day?.used_percentage!=null}function sCr(e,t){let r=[];aCr(e)&&r.push({harness:"claude",rateLimits:e});for(let[n,i]of Object.entries(t))aCr(i)&&r.push({harness:n,rateLimits:i});return r}var zti={display:"flex",alignItems:"center",ml:2,fontFamily:"fontFamilyMono",fontSize:13},Hti={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}},lCr=e=>e?Hti:zti;var TX=E($(),1),WWe="Claude account usage (5h / 7d windows) \u2014 view history";function cCr({rateLimits:e}){let t=c_(3e4);return(0,TX.jsxs)(ne,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[(0,TX.jsx)(j1e,{rateLimits:e,now:t}),(0,TX.jsx)(ne,{sx:{mt:.5,opacity:.6},children:WWe})]})}var UA=E($(),1),Uti={};function Y1e({rateLimits:e,harnessRateLimits:t=Uti,onStatusBar:r=!1}){let n=sCr(e,t),i=n.every(l=>l.harness==="claude"),o=e,a=WWe,s="Usage";return n.length>0&&i?(a=(0,UA.jsx)(cCr,{rateLimits:o}),s=(0,UA.jsx)(V1e,{rateLimits:o})):n.length>0&&(a=(0,UA.jsx)(oCr,{groups:n}),s=(0,UA.jsx)(ZSr,{groups:n})),(0,UA.jsx)(lr,{title:a,placement:r?"top-start":"bottom",children:(0,UA.jsx)(Xr,{component:ws,to:"/usage",underline:r?"none":"hover",color:"inherit",sx:lCr(r),children:s})})}var dCr=E(fe(),1);var E_="0.938.0";var K1e=E(fe(),1),GWe=(0,K1e.createContext)(null);function X1e(){return(0,K1e.useContext)(GWe)}var VWe=E($(),1);function uCr(){let e=X1e();return!e||e===E_?null:(0,VWe.jsx)(lr,{title:`Daemon is running v${e}, but this page was served by v${E_}. Restart the daemon to match.`,children:(0,VWe.jsx)(D1e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var qWe=e=>e.tokens.color.statusBar,Wti={height:22,py:0,borderRadius:1,fontSize:"inherit",opacity:1,"&:hover, &:focus-visible":{bgcolor:e=>qWe(e)?.hover,color:e=>qWe(e)?.hoverText},"& .ready-count":{fontWeight:500,color:e=>qWe(e)?.readyText}},fCr=(e,t=!1)=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:.25,borderRadius:999,fontSize:12,lineHeight:1.5,color:"inherit",opacity:e?1:.55,bgcolor:r=>e?w_(r).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{opacity:1,bgcolor:r=>w_(r).hover},"& .ready-dot":{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:r=>w_(r).dot,boxShadow:r=>`0 0 0 ${t?3:2}px ${w_(r).dotRing}`},"& .ready-count":{fontWeight:500},...t&&Wti});var sg=E($(),1);function Z1e({onStatusBar:e=!1}){let{entries:t}=kF(),r=Oi(),n=(0,dCr.useCallback)(()=>r("/updates"),[r]),{matches:i,chords:o}=Yn("openUpdates");if(Eo(i,n),!E_)return null;let a=t.filter(MF).length;return(0,sg.jsxs)(sg.Fragment,{children:[(0,sg.jsx)(lr,{describeChild:!0,placement:e?"top-end":"bottom",title:(0,sg.jsx)(Iu,{label:"Updates",chords:o}),children:(0,sg.jsxs)(mn,{component:ws,to:"/updates","aria-label":a?`Updates: ${a} node${a>1?"s have":" has"} an update ready`:"Updates",sx:fCr(a>0,e),children:[a>0&&(0,sg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,sg.jsxs)("span",{children:["v",E_]}),a>0&&(0,sg.jsxs)("span",{className:"ready-count",children:[a," ready"]})]})}),(0,sg.jsx)(uCr,{})]})}var Q1e=E($(),1);function hCr({socket:e}){return(0,Q1e.jsx)(USr,{start:(0,Q1e.jsx)(Y1e,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits,onStatusBar:!0}),end:(0,Q1e.jsx)(Z1e,{onStatusBar:!0})})}var nve=E(fe(),1);var rve=E(fe(),1);function pCr(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 R_=E($(),1),Gti={display:"flex",gap:1,alignItems:"center",minWidth:0},Vti={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},qti={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},jti={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Yti(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function mCr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,R_.jsx)(Hp,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=Yti(i);return(0,R_.jsxs)(ln,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:Gti,children:[(0,R_.jsx)(dB,{path:i}),(0,R_.jsxs)(ne,{sx:Vti,children:[(0,R_.jsx)(Le,{component:"span",sx:qti,children:s}),(0,R_.jsx)(Le,{component:"span",color:"text.secondary",sx:jti,children:a})]})]},i)})})}var J1e=E($(),1),Kti={maxHeight:420,overflowY:"auto"},Xti={px:2,py:2,fontSize:13};function gCr({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,J1e.jsx)(ne,{sx:Kti,children:e?(0,J1e.jsx)(Le,{color:"text.secondary",sx:Xti,children:e}):(0,J1e.jsx)(mCr,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var yCr=E($(),1),Zti={mt:6,alignSelf:"flex-start"};function eve({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,yCr.jsx)(Wl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:Zti},transition:{onEntered:t}},children:n})}var tve=E(fe(),1);var vCr={files:[],loading:!1,error:!1};function bCr(e,t){let[r,n]=(0,tve.useState)(vCr),i=yr();return(0,tve.useEffect)(()=>{if(!e){n(vCr);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await fetch(jr(`/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 WA=E($(),1);function Qti(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function xCr({onClose:e}){let{worktreeNode:t}=zn();return(0,WA.jsx)(mf.Provider,{value:t,children:(0,WA.jsx)(Jti,{onClose:e})})}function Jti({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=zn(),[n,i]=(0,rve.useState)(""),o=bCr(t,n),a=Oi(),s=(0,rve.useRef)(null),l=p=>a(Qti(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=g_(o.files,n,l,e),h=p=>{l(p),e()};return(0,WA.jsxs)(eve,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,WA.jsx)(gS,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,WA.jsx)(gCr,{message:pCr(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function TCr(e){Eo(Yn("quickOpen").matches,e)}var CCr=E($(),1);function SCr(){let[e,t]=(0,nve.useState)(!1);return TCr((0,nve.useCallback)(()=>t(!0),[])),e?(0,CCr.jsx)(xCr,{onClose:()=>t(!1)}):null}var ive=E($(),1);function wCr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,ive.jsx)(Bh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,ive.jsx)(yi,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,ive.jsx)(Dt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var wX=E(fe(),1);function kCr(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var FCr=E(fe(),1);var _Cr=E($(),1),ECr=st((0,_Cr.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 eri={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function RCr(e){return e?eri[e]:"success.main"}function ACr(e){return e.split("-")[0].split(".").map(Number)}function PCr(e,t){if(!e||!t||e===t)return;let r=ACr(e),n=ACr(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 GA=E($(),1),tri={height:16,fontSize:10},rri={opacity:.6,fontSize:"0.85em"};function nri(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 SX({nodes:e,name:t,showVersion:r=!1}){let n=X1e()??E_,i=e.links.find(a=>a.name===t),o=PCr(i?.peerVersion,n);return(0,GA.jsx)(lr,{title:nri(e,t),placement:"right",children:(0,GA.jsxs)(ne,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,GA.jsx)(ECr,{sx:{fontSize:8,color:RCr(i?.state)}}),t,r&&i?.peerVersion&&(0,GA.jsxs)(ne,{component:"span",sx:rri,children:["v",i.peerVersion]}),o&&(0,GA.jsx)(dn,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:tri})]})})}var VA=E($(),1),iri={opacity:.6},ori={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function LCr({nodes:e,name:t,clone:r}){let n=(0,VA.jsx)(SX,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,VA.jsx)(ne,{component:"span",sx:iri,children:n}):(0,VA.jsx)(lr,{title:VF(t,r.cloneTarget),children:(0,VA.jsxs)(ne,{component:"span",sx:ori,children:[(0,VA.jsx)(GF,{sx:{fontSize:14}}),n]})})}var ICr=E($(),1),ari={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 MCr({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,ICr.jsx)(mn,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:ari,children:t})}var DCr={ArrowRight:1,ArrowLeft:-1};function sri(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+DCr[e.key]+r)%r}function NCr(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!DCr[i.key]){A2(i);return}let o=sri(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var OCr=E(fe(),1);function a$(e){return e?.querySelector('[aria-checked="true"]')}function BCr(e,t){(0,OCr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=a$(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var jWe=E($(),1),lri={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function ove({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return BCr(o,r),(0,jWe.jsx)(Rt,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:NCr(t,r,n,l),sx:lri,children:t.map(u=>(0,jWe.jsx)(MCr,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var YWe=E($(),1);function $Cr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=_c(),a=(0,FCr.useRef)(null);return!o||!n||!e?null:(0,YWe.jsx)(ove,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,YWe.jsx)(LCr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var HCr=E($(),1);function zCr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,HCr.jsx)(ei,{value:e,onChange:a=>t(a.target.value),onKeyDown:A2,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"},input:{sx:{fontSize:14}}}})}var VCr=E(fe(),1);var dT={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:$ge,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},UCr=Object.keys(dT);var KWe=E($(),1);function WCr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,KWe.jsx)(Bs,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,KWe.jsx)(ln,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:Mu(o)},o))})}var qA=E($(),1);function GCr(e){return t=>t==="prompt"&&e?(0,qA.jsxs)(qA.Fragment,{children:["prompt",(0,qA.jsx)(ne,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Mu(e)}`}),(0,qA.jsx)(bd,{sx:{fontSize:18,mr:-.75}})]}):t}var jA=E($(),1);function qCr({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,VCr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(a$(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,jA.jsxs)(jA.Fragment,{children:[(0,jA.jsx)(ove,{label:"Mode",options:UCr,value:e.mode,onChange:l,optionLabel:GCr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,jA.jsx)(WCr,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var nwr=E(fe(),1);var XWe=E($(),1),cri={zIndex:e=>e.zIndex.modal+1};function jCr({open:e,anchor:t,children:r}){return(0,XWe.jsx)(J6,{open:e,anchorEl:t,placement:"bottom-start",sx:cri,children:(0,XWe.jsx)(rn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}function YCr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:{fontSize:13,height:40}}}}var KCr=E(F6(),1);function XCr({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}A2(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,KCr.flushSync)(()=>{r(t),n()}),A2(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function ZCr(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Tv(n).toLowerCase().includes(r)):e}var ZWe=E(fe(),1);function QCr(){let[e,t]=(0,ZWe.useState)(!1),[r,n]=(0,ZWe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var ewr=E(fe(),1);var JCr=e=>e?Tv(e):"";function twr(e){let[t,r]=(0,ewr.useState)(()=>JCr(e));return{text:t,setText:r,showRepo:n=>r(JCr(n))}}function rwr(e,t,r){let n=QCr(),i=twr(t),o=ZCr(e,n.query),a=f=>{r(f),i.showRepo(f)},s=g_(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:XCr({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 s$=E($(),1);function iwr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=rwr(e,t,r),s=(0,nwr.useRef)(null);return(0,s$.jsxs)(ne,{ref:s,sx:{flex:1,minWidth:0},children:[(0,s$.jsx)(ei,{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:YCr(a.open)}),(0,s$.jsx)(jCr,{open:a.open,anchor:s.current,children:(0,s$.jsx)(A1e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var A_=E($(),1);function owr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=zn();return(0,A_.jsxs)(Rt,{spacing:1,sx:{p:1},children:[(0,A_.jsx)(zCr,{value:r.prompt,onChange:r.setPrompt,placeholder:dT[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),(0,A_.jsxs)(Rt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,A_.jsx)(iwr,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,A_.jsx)(qCr,{...t})]}),(0,A_.jsx)($Cr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var l$=E($(),1),uri=["Enter start","Shift+Enter newline","Esc close"],fri={alignItems:"center",px:1.5,py:1,borderTop:1,borderColor:"divider",bgcolor:"action.hover"};function awr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,l$.jsxs)(Rt,{direction:"row",spacing:1.5,sx:fri,children:[(0,l$.jsx)(Rt,{direction:"row",spacing:1.5,sx:{mr:"auto"},children:uri.map(n=>(0,l$.jsx)(Le,{variant:"caption",color:"text.secondary",children:n},n))}),(0,l$.jsx)(Dt,{type:"submit",variant:"contained",size:"small",disabled:t,loading:r,children:e})]})}var YA=E(fe(),1);function swr(e,t){let r=(0,YA.useRef)(e),n=(0,YA.useRef)(null),i=(0,YA.useRef)(null),o=(0,YA.useRef)(null),a=(0,YA.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:a$(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 dri(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:L1e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function lwr(e,t){let{names:r,visible:n}=_c(),i=_1e(t,n?r:[void 0]);return{cloneState:i,target:dri(t,e,i(e))}}function cwr({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}]:[];Pur(dT[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function uwr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(v1e(r.prompt,n.onCreateAssist),!0):(cwr({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var ave=E(fe(),1);function fwr(e,t){let[r,n]=(0,ave.useState)(!1);return(0,ave.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function dwr(e,t,r,n,i){let o=fwr(e,()=>{uwr(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var CX=E(fe(),1);function hwr(e,t){let r=(0,CX.useRef)(e),n=(0,CX.useRef)(null);return(0,CX.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 mwr=E($(),1),hri={border:0,margin:0,padding:0,minWidth:0};function pwr({loading:e,restoreFocus:t,children:r}){let n=hwr(e,t);return(0,mwr.jsx)("fieldset",{disabled:e,style:hri,onFocus:n,children:r})}var KA=E($(),1);function gwr({draft:e,launchers:t,onClose:r}){let n=swr(e.focus,e.setFocus),i=kCr(f_()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=lwr(e.node,e.cwd),l=dwr(e,o,a,t,r);return(0,KA.jsx)(eve,{onClose:r,onEntered:n.restore,centered:!0,children:(0,KA.jsx)("form",{onSubmit:l,children:(0,KA.jsxs)(pwr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,KA.jsx)(owr,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,KA.jsx)(awr,{submitLabel:a.kind==="clone"?"Clone":dT[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var sve=E(fe(),1);var pri=1e3;async function mri(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await fetch(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(dT,n?.mode)?n.mode:null}catch{return null}}function ywr(e,t=0){let[r,n]=(0,sve.useState)(null);return(0,sve.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await mri(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,pri))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function vwr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var hT=E(fe(),1),bwr={field:"prompt",selectionStart:0,selectionEnd:0};function xwr(){let[e,t]=(0,hT.useState)(""),[r,n]=(0,hT.useState)(),[i,o]=(0,hT.useState)(),[a,s]=(0,hT.useState)("claude"),[l,u]=(0,hT.useState)(),[f,d]=(0,hT.useState)(bwr),h=(0,hT.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(bwr)},[]);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 Twr(e,t=ywr){let{selectedCwd:r}=zn(),n=_c(),i=xwr(),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:vwr(i.node,n)}:null}function Swr(e){Eo(Yn("newSession").matches,e)}var Cwr=E(fe(),1);function wwr(e,t){let{selectedCwd:r}=zn(),[n,i]=Uc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,Cwr.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 _wr=E($(),1);function kwr({launchers:e}){let[t,r]=(0,wX.useState)(!1),[n,i]=(0,wX.useState)(0),o=Twr(n),a=(0,wX.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return Swr(a),wwr(o,a),!t||!o?null:(0,_wr.jsx)(gwr,{draft:o,launchers:e,onClose:()=>r(!1)})}var lve=E($(),1);function Ewr({reconnecting:e}){return(0,lve.jsx)(Bh,{open:e,children:(0,lve.jsx)(yi,{severity:"info",variant:"filled",icon:(0,lve.jsx)(oo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Rv=E($(),1);function Rwr({socket:e,onViewLaunchedSession:t}){return(0,Rv.jsxs)(Rv.Fragment,{children:[(0,Rv.jsx)(SCr,{}),(0,Rv.jsx)(kwr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Rv.jsx)(Ewr,{reconnecting:e.reconnecting}),(0,Rv.jsx)(Xl,{error:e.error,onClose:e.clearError}),(0,Rv.jsx)(wCr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Av=E(fe(),1);var gri=6e4;function yri(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function Awr(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4023
4023
|
`),[n,i]=(0,Av.useState)([]),o=(0,Av.useRef)(0),a=(0,Av.useCallback)(()=>{let l=r?r.split(`
|
|
4024
4024
|
`):[];if(l.length===0)return;let u=++o.current;i(f=>yri(f,l,t));for(let f of l)Xye(f,f===t).then(d=>{u===o.current&&i(h=>h.map(p=>p.name===f?d:p))})},[r,t]);(0,Av.useEffect)(()=>{a();let l=setInterval(a,gri);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,Av.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var P_=E($(),1);function Pwr({shell:e,children:t}){let{socket:r,selection:n,launch:i,sidebarCollapse:o}=e,a=Awr(r.nodeSelection);return(0,P_.jsx)(fWe.Provider,{value:a,children:(0,P_.jsx)(dwe.Provider,{value:o,children:(0,P_.jsx)(sU.Provider,{value:n,children:(0,P_.jsx)(PWe.Provider,{value:r.nodeSelection,children:(0,P_.jsx)(mf.Provider,{value:n.selectedNode,children:(0,P_.jsx)(J$e.Provider,{value:i,children:(0,P_.jsx)(eit,{children:t})})})})})})})}var Lwr=E($(),1),Mwr=st((0,Lwr.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 Iwr=E(fe(),1);var O0=E($(),1),vri={ml:1,textTransform:"none",fontSize:12};function Dwr(){let{nodes:e,names:t,visible:r,selected:n,select:i}=_c(),[o,a]=(0,Iwr.useState)(null);return!r||!e||!n?null:(0,O0.jsxs)(O0.Fragment,{children:[(0,O0.jsx)(Dt,{size:"small",color:"inherit",startIcon:(0,O0.jsx)(Mwr,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:vri,children:(0,O0.jsx)(SX,{nodes:e,name:n})}),(0,O0.jsx)(Bs,{anchorEl:o,open:!!o,onClose:()=>a(null),children:t.map(s=>(0,O0.jsx)(ln,{selected:s===n,onClick:()=>{i(s),a(null)},sx:{fontSize:13},children:(0,O0.jsx)(SX,{nodes:e,name:s,showVersion:!0})},s))})]})}var kX=E(fe(),1);function Nwr(e,t){return[...e[0].slice(0,-1),String(t+1)]}var cve=E($(),1);function Owr({index:e,label:t,...r}){let{chords:n}=Yn("navTab");return(0,cve.jsx)(lr,{describeChild:!0,title:(0,cve.jsx)(Iu,{label:t,chords:[Nwr(n,e)]}),children:(0,cve.jsx)(tb,{label:t,...r})})}var QWe=E(fe(),1);function Bwr(e,t){let{bound:r}=Yn("navTab"),n=e.length,i=(0,QWe.useCallback)(a=>(gU(a,r)??n)<n,[r,n]),o=(0,QWe.useCallback)(a=>{let s=e[gU(a,r)??-1];s&&t(s)},[e,t,r]);Eo(i,o)}var uve=E(fe(),1);function Fwr(){let[e,t]=(0,uve.useState)(!1);return(0,uve.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await fetch("/api/news/nav")).json();r||t(i?.showInNav===!0)}catch{r||t(!1)}})(),()=>{r=!0}},[]),e}var fve=E(fe(),1);async function bri(e,t){let r=await fetch(jr(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function $wr(e){let[t,r]=(0,fve.useState)(null),n=yr(),i=`${n??""}\0${e}`;return(0,fve.useEffect)(()=>{if(!e)return;let o=!1;return bri(e,n).catch(()=>{}).then(a=>{o||r({key:i,configured:a})}),()=>{o=!0}},[e,n,i]),t?.key===i?t.configured:void 0}var zwr=E(fe(),1);function Hwr(e){let{pathname:t}=Uo(),r=Oi(),n=t==="/releases"||t.startsWith("/releases/");(0,zwr.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var xri={path:"/sessions",label:"Sessions"},Tri={path:"/backlog",label:"Backlog"},Sri={path:"/next",label:"Next"},Cri={path:"/releases",label:"Releases"},wri={path:"/news",label:"News"};function Uwr(e,t){return[xri,Tri,Sri,...e?[Cri]:[],...t?[wri]:[]]}var JWe=E($(),1);function Wwr({cwd:e}){let t=Uo(),r=Oi(),n=$wr(e),i=Fwr();Hwr(n);let o=n===!0,a=(0,kX.useMemo)(()=>Uwr(o,i),[o,i]),s=(0,kX.useMemo)(()=>a.map(f=>f.path),[a]),l=a.findIndex(f=>t.pathname.startsWith(f.path)),u=(0,kX.useCallback)(f=>{t.pathname!==f&&r(f)},[t.pathname,r]);return Bwr(s,u),(0,JWe.jsx)(A5,{value:l===-1?!1:l,textColor:"inherit",indicatorColor:"secondary",children:a.map((f,d)=>(0,JWe.jsx)(Owr,{index:d,label:f.label,onClick:()=>u(f.path)},f.path))})}var Gwr=E($(),1),Vwr=st((0,Gwr.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m5 11h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddCircle");var _X=E($(),1),kri={color:"success.light"};function qwr(){let[,e]=Uc(),{label:t,chords:r}=Yn("newSession");return(0,_X.jsx)(lr,{title:(0,_X.jsx)(Iu,{label:t,chords:r}),children:(0,_X.jsx)(ir,{size:"small",sx:kri,"aria-label":"New session",onClick:()=>e(i=>(i.set("new",""),i),{replace:!0}),children:(0,_X.jsx)(Vwr,{})})})}var hve=E(fe(),1);var dve=E($(),1),_ri={color:"inherit"};function jwr({cwd:e}){let[t,r]=(0,hve.useState)(null),n=yr();return(0,hve.useEffect)(()=>{if(!e){r(null);return}let i=!1;return(async()=>{try{let a=await(await fetch(jr(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();i||r(a?.url??null)}catch{i||r(null)}})(),()=>{i=!0}},[e,n]),t?(0,dve.jsx)(lr,{title:"Open in GitHub",children:(0,dve.jsx)(ir,{sx:_ri,onClick:()=>window.open(t,"_blank"),children:(0,dve.jsx)(SL,{})})}):null}var B0=E($(),1),Eri={color:"inherit",mr:1.5};function Ywr({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:i}=s_("webserver",e);return(0,B0.jsxs)(B0.Fragment,{children:[(0,B0.jsx)(lr,{title:"Restart web server",children:(0,B0.jsx)("span",{children:(0,B0.jsx)(ir,{sx:Eri,disabled:t,onClick:i,children:t?(0,B0.jsx)(oo,{size:24}):(0,B0.jsx)(Yye,{})})})}),(0,B0.jsx)(Xl,{error:r,onClose:n})]})}var Zwr=E(fe(),1);var Kwr=E(fe(),1);function Xwr(e){let t=Nr().palette.primary.main;Eo(Yn("focusRepoPicker").matches,(0,Kwr.useCallback)(()=>jl({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var EX=E($(),1),Rri={width:240,ml:2};function Qwr({repos:e,selected:t,onSelect:r}){let n=(0,Zwr.useRef)(null);Xwr(n);let{chords:i}=Yn("focusRepoPicker");return(0,EX.jsx)(ne,{ref:n,sx:Rri,children:(0,EX.jsx)(zge,{label:t?Tv(t):"Select repo...",tooltip:(0,EX.jsx)(Iu,{label:"Repo",chords:i}),typeToOpen:!0,children:(o,a)=>(0,EX.jsx)($2r,{repos:e,selected:t,onSelect:r,close:o,initialFilter:a})})})}var lkr=E(fe(),1);var RX=E(fe(),1);function pve(e){let[t,r]=(0,RX.useState)([]),[n,i]=(0,RX.useState)(!0),o=yr();return(0,RX.useEffect)(()=>{if(!e){r([]),i(!1);return}let a=!1;return i(!0),fetch(jr(`/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 eGe=E($(),1);function tGe({text:e}){return(0,eGe.jsx)(ne,{sx:{p:1.5},children:(0,eGe.jsx)(Le,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var XA=E($(),1);function Jwr({pr:e,highlighted:t,onHover:r,onPick:n}){let i=R1e(t);return(0,XA.jsx)(ln,{ref:i,selected:t,onMouseDown:o=>o.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,XA.jsxs)(Rt,{spacing:.25,sx:{minWidth:0},children:[(0,XA.jsxs)(Le,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,XA.jsx)(dn,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,XA.jsxs)(Le,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",_o(e.createdAt)]})]})})}var rGe=E($(),1);function ekr({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,rGe.jsx)(Hp,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((i,o)=>(0,rGe.jsx)(Jwr,{pr:i,highlighted:o===t,onHover:()=>r(o),onPick:n},i.number))})}var rkr=E(fe(),1);function tkr(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 nkr(e,t,r){let[n,i]=(0,rkr.useState)(""),o=tkr(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=g_(o,n,t,r);return{filter:n,setFilter:i,filtered:o,highlight:a,setHighlight:s,onKeyDown:l,select:f=>{t(f),r()}}}var L_=E($(),1),ikr={...OB,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function okr({cwd:e,onPick:t,close:r}){let{prs:n,loading:i}=pve(e),o=nkr(n,t,r);return i||n.length===0?(0,L_.jsx)(rn,{elevation:4,sx:ikr,children:(0,L_.jsx)(tGe,{text:i?"Loading open PRs\u2026":"No open PRs"})}):(0,L_.jsxs)(rn,{elevation:4,sx:ikr,children:[(0,L_.jsx)(gS,{autoFocus:!0,value:o.filter,onChange:o.setFilter,onKeyDown:o.onKeyDown,placeholder:"Filter PRs..."}),o.filtered.length===0?(0,L_.jsx)(tGe,{text:"No PRs match"}):(0,L_.jsx)(ekr,{prs:o.filtered,highlight:o.highlight,onHighlight:o.setHighlight,onPick:o.select})]})}var skr=E($(),1);function akr({cwd:e,onPick:t,close:r}){return(0,skr.jsx)(okr,{cwd:e,onPick:t,close:r})}var M_=E($(),1);function ckr({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:i}=pve(e),[o,a]=(0,lkr.useState)(null);return i||n.length===0?null:(0,M_.jsxs)(M_.Fragment,{children:[(0,M_.jsx)(zge,{label:"prs",disabled:t,children:s=>(0,M_.jsx)(akr,{cwd:e,onPick:a,close:s})}),o&&(0,M_.jsx)(yge,{pr:o,onSelect:s=>{r(o,s),a(null)},onCancel:()=>a(null)})]})}var fkr=E($(),1);function ukr({onStartRun:e,cwd:t}){let r=Nge(t);return!t||r.length===0?null:(0,fkr.jsx)(Ige,{runs:r,onSelect:n=>e(n,t)})}var AX=E($(),1);function dkr({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=zn();return(0,AX.jsxs)(Rt,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:2}},children:[(0,AX.jsx)(ckr,{cwd:r,disabled:!r,onSelect:(i,o)=>e([...o,String(i.number)],r,{...xB(i),node:n})}),(0,AX.jsx)(ukr,{onStartRun:(i,o)=>t(i,o,void 0,void 0,n),cwd:r})]})}var ch=E($(),1),Ari={minHeight:48,pl:1,pr:14};function hkr({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=RS(),{design:i}=Nr();return(0,ch.jsxs)(R5,{variant:"dense",disableGutters:!0,sx:Ari,children:[r&&(0,ch.jsx)(wre,{collapsed:r,onToggleCollapsed:n}),(0,ch.jsx)(Ywr,{reconnecting:e.reconnecting}),(0,ch.jsx)(Wwr,{cwd:t.selectedCwd}),(0,ch.jsx)(Dwr,{}),(0,ch.jsx)(Qwr,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,ch.jsxs)(ne,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,ch.jsx)(Uge,{cwd:t.selectedCwd}),(0,ch.jsx)(jwr,{cwd:t.selectedCwd}),(0,ch.jsx)(qwr,{})]}),(0,ch.jsx)(dkr,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun}),i!=="slate"&&(0,ch.jsx)(Y1e,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var mve=E(fe(),1);function pkr(){let[e,t]=(0,mve.useState)(null);return(0,mve.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await fetch("/api/health")).json();!r&&typeof i?.nodeName=="string"&&t(i.nodeName)}catch{}})(),()=>{r=!0}},[]),e}var gkr=E($(),1),Pri={lineHeight:"32px",bgcolor:"transparent"};function mkr(){let e=pkr();return e?(0,gkr.jsx)(_xe,{sx:Pri,children:e}):null}var ykr=E($(),1),vkr=st((0,ykr.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 bkr=E($(),1),xkr=st((0,bkr.jsx)("path",{d:"M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10c1.38 0 2.5-1.12 2.5-2.5 0-.61-.23-1.2-.64-1.67-.08-.1-.13-.21-.13-.33 0-.28.22-.5.5-.5H16c3.31 0 6-2.69 6-6 0-4.96-4.49-9-10-9m5.5 11c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m-3-4c-.83 0-1.5-.67-1.5-1.5S13.67 6 14.5 6s1.5.67 1.5 1.5S15.33 9 14.5 9M5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S7.33 13 6.5 13 5 12.33 5 11.5m6-4c0 .83-.67 1.5-1.5 1.5S8 8.33 8 7.5 8.67 6 9.5 6s1.5.67 1.5 1.5"}),"Palette");var Tkr=E($(),1),Skr=st((0,Tkr.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 Ckr=E($(),1),wkr=st((0,Ckr.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 kkr=E($(),1),_kr=st((0,kkr.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 nGe=E($(),1);function Ekr({mode:e}){return e==="dark"?(0,nGe.jsx)(_kr,{fontSize:"small"}):(0,nGe.jsx)(wkr,{fontSize:"small"})}var Rkr=E($(),1),Akr=st((0,Rkr.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 c$=E($(),1);function Pkr(){let e=kge();return(0,c$.jsxs)(ln,{onClick:()=>dmt(!e),children:[(0,c$.jsx)(Xv,{children:(0,c$.jsx)(Akr,{fontSize:"small"})}),(0,c$.jsx)(Th,{children:e?"Hide render HUD":"Show render HUD"})]})}var La=E($(),1);function Lkr({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onToggleDesign:i,onShowShortcuts:o,onRestart:a,onUpdate:s}){return[(0,La.jsxs)(ln,{onClick:n,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(Ekr,{mode:e})}),(0,La.jsx)(Th,{children:"Toggle dark mode"})]},"color-mode"),(0,La.jsxs)(ln,{onClick:i,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(xkr,{fontSize:"small"})}),(0,La.jsx)(Th,{children:"Toggle Slate design"})]},"design"),(0,La.jsx)(Pkr,{},"render-hud"),(0,La.jsxs)(ln,{onClick:o,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(vkr,{fontSize:"small"})}),(0,La.jsx)(Th,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,La.jsx)(Ci,{},"restart-divider"),(0,La.jsxs)(ln,{onClick:a,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(WL,{fontSize:"small"})}),(0,La.jsx)(Th,{children:t})]},"restart"),(0,La.jsxs)(ln,{onClick:s,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(Skr,{fontSize:"small"})}),(0,La.jsx)(Th,{children:r})]},"update")]}var Mkr=E(fe(),1);var Dkr=E($(),1);function Ikr({peer:e,onRestart:t,onClose:r}){let[n,i]=(0,Mkr.useState)(!1);return(0,Dkr.jsx)(bi,{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 Nkr(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 Lri=Object.keys(FL);function Okr(){let e=$L();return Nkr(Lri.map(t=>SS(t,e)))}var Rp=E($(),1),Mri={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},Iri={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function Bkr({onClose:e}){let t=Okr();return(0,Rp.jsxs)(Wl,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,Rp.jsxs)(ku,{id:"shortcuts-dialog-title",sx:Mri,children:["Keyboard shortcuts",(0,Rp.jsx)(ir,{size:"small","aria-label":"Close",onClick:e,children:(0,Rp.jsx)(Wo,{fontSize:"small"})})]}),(0,Rp.jsx)(wu,{dividers:!0,children:t.map(r=>(0,Rp.jsxs)(ne,{component:"section",sx:{mb:1.5},children:[(0,Rp.jsx)(Le,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,Rp.jsxs)(ne,{sx:Iri,children:[(0,Rp.jsx)(Le,{variant:"body2",children:n.label}),(0,Rp.jsx)(Rt,{direction:"row",spacing:.5,children:(0,Rp.jsx)(tre,{chords:n.chords})})]},n.label))]},r.name))})]})}var ZA=E($(),1);function Fkr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:i,restart:o}=s_(NF.target,e);return(0,ZA.jsxs)(ZA.Fragment,{children:[(0,ZA.jsx)(bi,{title:NF.label,message:NF.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{o()},onCancel:t}),(0,ZA.jsx)(Xl,{error:n,onClose:i})]})}var zkr=E($(),1);function Dri(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 $kr({peer:e,onConfirm:t,onClose:r}){return(0,zkr.jsx)(bi,{...Dri(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var F0=E(fe(),1);async function Nri(e){try{let t=await fetch(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch{return null}}async function Hkr(e,t){let r=await Nri(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var pT=E(fe(),1);function Ukr(e){let{nodes:t}=_c(),[r,n]=(0,pT.useState)(null),i=(0,pT.useRef)(!1),o=r?t?.links.find(l=>l.name===r.peer):void 0;(0,pT.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,pT.useCallback)((l,u)=>{i.current=!1,n({peer:l,describe:u})},[]),s=(0,pT.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var Ori=9e4;function gve(){let[e,t]=(0,F0.useState)(null),[r,n]=(0,F0.useState)(null),i=(0,F0.useRef)(void 0),o=(0,F0.useCallback)(f=>{clearTimeout(i.current),t(f)},[]),{watch:a,stop:s}=Ukr(o);(0,F0.useEffect)(()=>()=>clearTimeout(i.current),[]);let l=(0,F0.useCallback)(async(f,d)=>{n(await Hkr(f,d))},[]);return{requestThenAwait:(0,F0.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`)},Ori),!0):(await l(f,`${d} failed (${await DF(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var Bri=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function Wkr(){let{requestThenAwait:e,...t}=gve();return{restart:n=>e(n,`Restart ${n}`,()=>a_("both",n),Bri),...t}}var PX=E(fe(),1);var $0=E(fe(),1);function Gkr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function yve(e,t,r){let[n,i]=(0,$0.useState)(!1),[o,a]=(0,$0.useState)(!1),s=(0,$0.useRef)(!1),l=(0,$0.useRef)(e);l.current=e;let u=(0,$0.useRef)(new Set),f=(0,$0.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(Gkr).map(d=>d.id)),i(!0)},[]);return(0,$0.useEffect)(()=>{if(!n||o)return;if(t){s.current=!0;return}if(!s.current)return;e.some(h=>Gkr(h)&&h.node===r&&!u.current.has(h.id))&&a(!0)},[n,o,t,e,r]),{arm:f,completed:o}}var Vkr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function Fri(e){return fetch(`/api/self-update?node=${encodeURIComponent(e)}`,{method:"POST"})}function qkr(e){let{nodes:t}=_c(),{launchAssist:r}=al(),{requestThenAwait:n,...i}=gve(),[o,a]=(0,PX.useState)(null),[s,l]=(0,PX.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:f,completed:d}=yve(e,u(s)!=="connected",s);(0,PX.useEffect)(()=>{!d||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>a_("webserver",s),Vkr))},[d,s,n]);let h=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>Fri(m),Vkr),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 z0=E($(),1);function jkr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:i}){let{launchAssist:o,armUpdateReload:a}=al(),s=Wkr(),l=qkr(r);return(0,z0.jsxs)(z0.Fragment,{children:[e==="shortcuts"&&(0,z0.jsx)(Bkr,{onClose:i}),e==="restart"&&t&&(0,z0.jsx)(Ikr,{peer:t,onRestart:s.restart,onClose:i}),e==="restart"&&!t&&(0,z0.jsx)(Fkr,{reconnecting:n,onClose:i}),e==="update"&&(0,z0.jsx)($kr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),o(["update"])},onClose:i}),(0,z0.jsx)(jK,{notices:s}),(0,z0.jsx)(jK,{notices:l})]})}var Ykr=E($(),1),Kkr=st((0,Ykr.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 Xkr=E(fe(),1);var LX=E($(),1);function Zkr(){let e=Oi(),t=(0,Xkr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=Yn("openConfig");return Eo(r,t),(0,LX.jsx)(lr,{describeChild:!0,title:(0,LX.jsx)(Iu,{label:"Config",chords:n}),children:(0,LX.jsx)(ir,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,LX.jsx)(Kkr,{fontSize:"small"})})})}var Qkr=E($(),1),Jkr=st((0,Qkr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var vve=E(fe(),1);var MX=E($(),1);function e_r({open:e,onOpen:t}){let r=(0,vve.useRef)(null),{matches:n,chords:i}=Yn("openMenu");return Eo(n,(0,vve.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,MX.jsx)(lr,{describeChild:!0,title:(0,MX.jsx)(Iu,{label:"Menu",chords:i}),children:(0,MX.jsx)(ir,{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,MX.jsx)(Jkr,{fontSize:"small"})})})}var u$=E($(),1);function t_r({open:e,onOpen:t}){let{design:r}=Nr();return(0,u$.jsxs)(ne,{sx:{position:"fixed",top:8,right:16,zIndex:n=>n.zIndex.drawer+2,display:"flex",alignItems:"center",gap:.5,color:"inherit"},children:[r!=="slate"&&(0,u$.jsx)(Z1e,{}),(0,u$.jsx)(Zkr,{}),(0,u$.jsx)(e_r,{open:e,onOpen:t})]})}var QA=E(fe(),1);var n_r=E(fe(),1);var r_r=!0,$ri=new Set(["openMenu","cycleCards"]),zri=Object.keys(FL).filter(e=>!$ri.has(e));function i_r(e,t){let r=$L();(0,n_r.useEffect)(()=>{if(!e)return;let n=i=>{zri.some(o=>SS(o,r).matches(i))&&t()};return globalThis.addEventListener("keydown",n,r_r),()=>globalThis.removeEventListener("keydown",n,r_r)},[e,t,r])}function o_r(){let[e,t]=(0,QA.useState)(null),[r,n]=(0,QA.useState)(!0),i=!!e,o=(0,QA.useCallback)(()=>t(null),[]),a=(0,QA.useCallback)(s=>{n(!0),t(s)},[]);return i_r(i,(0,QA.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:i,close:o,openAt:a,restoreFocus:r}}var IX=E(fe(),1);function a_r(e){Eo(Yn("shortcutsSheet").matches,e)}function s_r(){let[e,t]=(0,IX.useState)(null);a_r((0,IX.useCallback)(()=>t("shortcuts"),[]));let r=(0,IX.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function l_r(){let{nodes:e,selected:t}=_c();return e&&t&&t!==e.local?t:void 0}function c_r(e){return{restartLabel:e?`Restart ${e}`:NF.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}function u_r(e,t,r){let n=i=>()=>{i(),e()};return{onToggleColorMode:n(t),onToggleDesign:n(r)}}var mT=E($(),1);function f_r({mode:e,toggle:t,toggleDesign:r,sessions:n,reconnecting:i}){let{anchorEl:o,open:a,close:s,openAt:l,restoreFocus:u}=o_r(),{dialog:f,showDialog:d,closeDialog:h}=s_r(),p=l_r(),m=g=>()=>{s(),d(g)};return(0,mT.jsxs)(mT.Fragment,{children:[(0,mT.jsx)(t_r,{open:a,onOpen:l}),(0,mT.jsxs)(Bs,{anchorEl:o,open:a,onClose:s,disableRestoreFocus:!u,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,mT.jsx)(mkr,{}),Lkr({mode:e,...c_r(p),...u_r(s,t,r),onShowShortcuts:m("shortcuts"),onRestart:m("restart"),onUpdate:m("update")})]}),(0,mT.jsx)(jkr,{dialog:f,peer:p,sessions:n,reconnecting:i,onClose:h})]})}var p_r=E(fe(),1);var h_r=E($(),1);function d_r({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:i,port:o,group:a}=e.existing,s=nm(i),l=o?` on port ${o}`:"",u=s?` in ${s}`:"",f=a?`, holding the ${a} server slot`:"";return(0,h_r.jsx)(bi,{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 bve=E($(),1);function m_r({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:i,stopSession:o,startRun:a,discardSession:s}=e,l=(0,p_r.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,bve.jsxs)(iwe.Provider,{value:l,children:[t,r&&(0,bve.jsx)(d_r,{conflict:r,onConfirm:u,onCancel:n})]})}var g_r=new Map;function y_r(e,t){if(!fie())return;let r=g_r.get(e);if(g_r.set(e,t),!!r)for(let[n,i]of Object.entries(t))Object.is(i,r[n])||ky(`\u0394 ${e}.${n}`)}var Tve=E(fe(),1);function v_r(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||im(i)!==t?null:n}function Pv(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function xve(){let{pathname:e}=Uo();return e.startsWith("/backlog")||e.startsWith("/usage")}function b_r({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:i,onSelect:o}){let a=Pv(t,r,n),s=a&&im(a),l=!!(s&&s===e),u=v_r(i,e,r),f=(0,Tve.useRef)(t),d=xve();(0,Tve.useEffect)(()=>{let h=f.current!==t&&!!s;f.current=t,!(d||h||l||!u)&&o(u)},[t,s,l,u,o,d])}var wve=E(fe(),1);function x_r(e,t,r,n){return Pv(e,t,r)?.cwd||n}function T_r(e,t,r,n){let i=x_r(e,t,r,n.cwd),o=Pv(e,t,r);return{cwd:i,node:o?.cwd?o.node:n.node}}var iGe=E(fe(),1);function S_r(e,t,r){let{cwd:n,node:i,origin:o}=r,a=(0,iGe.useCallback)((l,u)=>{let f=lT(u,t),d=pX(e,l);return d?d.clones[f]:f===(l===n?i:Ep)?l:void 0},[e,t,n,i]),s=(0,iGe.useCallback)(l=>pX(e,l)?.origin??(l===n?o:void 0),[e,n,o]);return{cloneOn:a,originOf:s}}var Sve=E(fe(),1);function C_r(e,t,r,n){let i=(0,Sve.useRef)(e);(0,Sve.useEffect)(()=>{if(i.current===e)return;i.current=e;let o=pX(t,r)?.clones[e];o&&n(o,e)},[e,t,r,n])}var f$=E(fe(),1);function w_r(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(Ep)?Ep:[...n][0]}function k_r(e,t,r,n){let[i,o]=(0,f$.useState)({cwd:e}),a=(0,f$.useCallback)((l,u,f)=>o({cwd:l,node:u,origin:f}),[]);(0,f$.useEffect)(()=>{e&&!i.cwd&&o({cwd:e})},[e,i.cwd]);let s=w_r(t,{cwd:i.cwd,node:i.node===void 0?void 0:lT(i.node,n)},r);return{selectedCwd:i.cwd,selectedNode:s||void 0,selectedPick:{cwd:i.cwd,node:s,origin:i.origin},setSelectedCwd:a}}var __r=E(fe(),1);function Cve(e,t,r){let n=Pv(e,t,r);return n&&im(n)}function E_r(e,t,r,n){let i=Cve(e,t,r),o=Pv(e,t,r),a=o?.node??Ep,s=o?.repoGroup?.origin;(0,__r.useEffect)(()=>{i&&n(i,a,s)},[i,a,s,n])}function R_r(e,t,r,n,i){let o=i.nodes?.local,a=lT(i.selected,o),s=(0,wve.useMemo)(()=>fTr(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:f,setSelectedCwd:d}=k_r(e,s,a,o);E_r(r,n,t,d),C_r(a,s,l,d);let{cloneOn:h,originOf:p}=S_r(s,o,f),m=(0,wve.useMemo)(()=>s.map(v=>dTr(v,a)),[s,a]),{cwd:g,node:y}=T_r(r,n,t,{cwd:l,node:u});return(0,wve.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 _ve=E(fe(),1);var I_=E(fe(),1);var A_r=E(fe(),1),kve="assist:reloaded-after-update";function P_r(e){(0,A_r.useEffect)(()=>{globalThis.sessionStorage?.getItem(kve)&&(globalThis.sessionStorage.removeItem(kve),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function L_r(e,t,r,n){let{arm:i,completed:o}=yve(e,t),a=(0,I_.useRef)(!1),s=(0,I_.useCallback)(()=>{globalThis.sessionStorage?.setItem(kve,"1")},[]),{error:l,restart:u}=s_("webserver",t,s);return P_r(r),(0,I_.useEffect)(()=>{l&&n(l)},[l,n]),(0,I_.useEffect)(()=>{!o||a.current||(a.current=!0,u())},[o,u]),{armUpdateReload:(0,I_.useCallback)(()=>{a.current=!1,i()},[i])}}function M_r(e){let{armUpdateReload:t}=L_r(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=yy(e.selectSession),n=(0,_ve.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=Oi(),o=(0,_ve.useCallback)(a=>{e.selectSession(a),i("/sessions"),e.clearSuccess()},[i,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:o}}var I_r=E(fe(),1);function D_r(e,t,r,n){let i=Cve(e,t,r);(0,I_r.useEffect)(()=>{e&&i&&n({type:"set-active",cwd:i,sessionId:e})},[e,i,n])}var Eve=E(fe(),1);function N_r(e,t){let r=(0,Eve.useRef)(new Map);(0,Eve.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 d$=E(fe(),1),O_r="assist.sessions.node";function Hri(){try{return localStorage.getItem(O_r)}catch{return null}}function Uri(e){try{localStorage.setItem(O_r,e)}catch{}}function B_r(e){let[t,r]=(0,d$.useState)(Hri),n=(0,d$.useCallback)(i=>{r(i),Uri(i)},[]);return(0,d$.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 $_r=E(fe(),1);function F_r(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 z_r(e,t){return(0,$_r.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let i=F_r(r);i&&t(i)},[e,t])}var Lv=E(fe(),1);function Rve(e,t,r,n,i){e({type:"create",prompt:r||void 0,cwd:n,...t,...i?{node:i}:{}})}function H_r(e){return(t,r,n)=>Rve(e,{design:!0},t,r,n)}function U_r(e){return(t,r,n,i)=>Rve(e,{harness:t},r,n,i)}function W_r(e){return(t,r,n)=>Rve(e,{auto:!0},t,r,n)}function G_r(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function V_r(e){return(t,r,n,i,o)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:i,node:o})}function q_r(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function j_r(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function Y_r(e,t){return r=>{e({type:"dismiss",sessionId:r}),t.delete(r)}}function K_r(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function X_r(e){return t=>e({type:"stop",sessionId:t})}function Z_r(e){return(t,r,n,i,o)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:i,node:o})}function Q_r(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function J_r(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function e5r(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function t5r(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:qK})}function r5r(e){return(t,r,n,i)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:qK,claim:i==="claim",refresh:i==="refresh"})}function n5r(e){return(t,r,n,i)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...i})}var JA=E(fe(),1);function i5r(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function o5r(e){return{createSession:(0,JA.useMemo)(()=>W_r(e),[e]),createSessionInStream:(0,JA.useMemo)(()=>i5r(e),[e]),createDesignSession:(0,JA.useMemo)(()=>H_r(e),[e]),createHarnessSession:(0,JA.useMemo)(()=>U_r(e),[e]),createAssistSession:(0,JA.useMemo)(()=>G_r(e),[e]),resumeSession:(0,JA.useMemo)(()=>V_r(e),[e])}}var DX=E(fe(),1);function a5r(e,t){let r=(0,DX.useCallback)((a,s)=>{q_r(e,t.current)(a,s)},[e,t]),n=(0,DX.useCallback)(a=>{j_r(e,t.current)(a)},[e,t]),i=(0,DX.useCallback)(a=>{Y_r(e,t.current)(a)},[e,t]),o=(0,DX.useCallback)(a=>{K_r(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:i,discardSession:o}}function s5r(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 l5r(e,t,r){let n={...o5r(e),sendInput:(0,Lv.useMemo)(()=>t5r(e),[e]),sendResize:(0,Lv.useMemo)(()=>r5r(e),[e]),sendPrDecision:(0,Lv.useMemo)(()=>n5r(e),[e]),setAutoApprove:(0,Lv.useMemo)(()=>Q_r(e),[e]),setAutoAdvance:(0,Lv.useMemo)(()=>J_r(e),[e]),setStarred:(0,Lv.useMemo)(()=>e5r(e),[e]),stopSession:(0,Lv.useMemo)(()=>X_r(e),[e]),startRun:(0,Lv.useMemo)(()=>Z_r(e),[e])},i=(0,Lv.useMemo)(()=>s5r(e,t.current,r.current),[e,t,r]);return{...n,...a5r(e,t),onOutput:i}}var NX=E(fe(),1);function c5r(e,t,r){let n=(0,NX.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),i=(0,NX.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),o=(0,NX.useCallback)(()=>{r(null)},[r]),a=(0,NX.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:i,clearTranscript:o,selectSession:a}}var Mve=E(fe(),1);function u5r(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 h$=E(fe(),1);function f5r(){let[e,t]=(0,h$.useState)(null),r=(0,h$.useRef)(e);r.current=e;let n=(0,h$.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var h5r=E(fe(),1);function d5r(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 p5r(e,t,r){let n=xve();(0,h5r.useEffect)(()=>{if(n){t(null);return}t(i=>d5r(e,i,r))},[e,t,r,n])}var Ave=E(fe(),1);function m5r(){let[e,t]=(0,Ave.useState)({}),[r,n]=(0,Ave.useState)(null),[i,o]=(0,Ave.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:i,setNodes:o}}var H0=E(fe(),1);function g5r(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function y5r(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function v5r(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 b5r(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 x5r(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var Wri=1500;function T5r(){let[e,t]=(0,H0.useState)(new Set),r=(0,H0.useRef)(new Map),n=(0,H0.useRef)(new Map),i=(0,H0.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),o=(0,H0.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),i(u)},Wri))},[i]);(0,H0.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,H0.useCallback)(s=>{let l=y5r(r.current,s),u=[...b5r(r.current,s),...l],f=x5r(r.current,s);r.current=new Map(s.map(d=>[d.id,d.startedAt])),g5r(n.current,l),u.length&&t(d=>v5r(d,u)),o(f)},[o]);return{initialized:e,markInitialized:i,syncSessions:a}}var D_=E(fe(),1);function S5r(){let[e,t]=(0,D_.useState)(null),[r,n]=(0,D_.useState)(null),[i,o]=(0,D_.useState)(null),a=(0,D_.useCallback)(()=>t(null),[]),s=(0,D_.useCallback)(()=>n(null),[]),l=(0,D_.useCallback)(()=>o(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:i,setServerConflict:o,clearServerConflict:l}}var Mv=E(fe(),1);function C5r(e,t){return[...e,{...t,status:"launching"}]}function Pve(e){return e.find(t=>t.status==="launching")}function w5r(e){let t=Pve(e);return t?e.filter(r=>r.id!==t.id):e}function k5r(e,t){let r=Pve(e);return r?oGe(e,r.id,t):e}function oGe(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function _5r(e,t){return e.filter(r=>r.id!==t)}var E5r=E(fe(),1);var Gri=6e4,Vri="Launch timed out \u2014 the session did not start.";function R5r(e,t){(0,E5r.useEffect)(()=>{let r=e.filter(i=>i.status==="launching");if(r.length===0)return;let n=r.map(i=>setTimeout(()=>t(o=>oGe(o,i.id,Vri)),Math.max(0,Gri-(Date.now()-i.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function A5r(){let[e,t]=(0,Mv.useState)([]),r=(0,Mv.useRef)([]),n=(0,Mv.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),i=(0,Mv.useCallback)(l=>{n(u=>C5r(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),o=(0,Mv.useCallback)(()=>{let l=Pve(r.current);return n(w5r),l?.named?l.title:void 0},[n]),a=(0,Mv.useCallback)(l=>n(u=>k5r(u,l)),[n]),s=(0,Mv.useCallback)(l=>n(u=>_5r(u,l)),[n]);return R5r(e,n),{pendingLaunches:e,addPendingLaunch:i,resolvePendingLaunch:o,failPendingLaunch:a,dismissPendingLaunch:s}}var OX=E(fe(),1);function P5r(){let[e,t]=(0,OX.useState)(null),[r,n]=(0,OX.useState)({}),i=(0,OX.useCallback)((o,a)=>{o!=="claude"&&n(s=>({...s,[o]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:i}}var L5r=E(fe(),1);function M5r(e,t){return(0,L5r.useCallback)(r=>{e(r),t(r)},[e,t])}var aGe=E(fe(),1);function I5r(){let e=(0,aGe.useRef)(new Map),t=(0,aGe.useRef)(new Map);return{buffers:e,handlers:t}}var Lve=E(fe(),1);function D5r(){let[e,t]=(0,Lve.useState)(null),[r,n]=(0,Lve.useState)(null),[i,o]=(0,Lve.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:i,setUserMessages:o}}var N_=E(fe(),1);function N5r(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function O5r(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 B5r(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function F5r(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function $5r(e,t){t.setNodes({local:e.local,links:e.links??[]})}function z5r(e,t){t.setSuccess({message:e.message,sessionId:null})}function H5r(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 U5r(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function W5r(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function G5r(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var qri={sessions:W5r,created:O5r,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:$5r,error:B5r,notice:z5r,"run-conflict":U5r,limits:F5r,clear:N5r,output:H5r,snapshot:G5r};function V5r(e,t){qri[e.type]?.(e,t)}function q5r(e,t={}){let r=location.protocol==="https:"?"wss:":"ws:",n=new WebSocket(`${r}//${location.host}/ws`);return n.onopen=()=>{t.onOpen?.(),n.send(JSON.stringify({type:"hello"})),n.send(JSON.stringify({type:"history"}))},n.onmessage=i=>{V5r(JSON.parse(i.data),e)},n.onclose=()=>t.onClose?.(),n}function j5r(e,t,r,n){let i=!1,o,a=0,s=!1,l=()=>{i||t(q5r(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 Y5r(e){let t=(0,N_.useRef)(null),[r,n]=(0,N_.useState)(!1),{handleSessions:i,markInitialized:o,buffers:a,handlers:s}=e;(0,N_.useEffect)(()=>{let u=()=>{a.current?.clear();let d=s.current;if(d)for(let h of d.values())h("\x1Bc")},f=j5r({...e,setSessions:i},d=>{t.current=d},u,n);return()=>{f(),t.current?.close()}},[i,o,a,s]);let l=(0,N_.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function K5r(){let[e,t]=(0,Mve.useState)([]),[r,n]=(0,Mve.useState)([]),{activeId:i,setActiveId:o,getActiveId:a}=f5r(),s=m5r(),l=D5r(),[u,f]=(0,Mve.useState)(""),d=S5r(),h=A5r(),p=P5r(),{initialized:m,markInitialized:g,syncSessions:y}=T5r(),v=I5r(),b=M5r(y,t),{wsRef:x,requestHistory:C,reconnecting:S}=Y5r({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:o,...s,...l,setCurrentCwd:f,...d,...h,...p,markInitialized:g,...v});return p5r(e,o,u5r(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:S}}function X5r(){let e=K5r(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:i,activeId:o,sessions:a}=e,s=B_r(e.nodes),l=z_r(t,i),u=l5r(l,r,n);D_r(o,a,e.history,l),N_r(a,l);let f=c5r(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...f,nodeSelection:s}}var p$=E(fe(),1);var Z5r="assist:sidebar-collapsed";function Q5r(){let[e,t]=(0,p$.useState)(()=>Xu(Z5r).length>0),r=(0,p$.useCallback)(()=>{t(n=>{let i=!n;return Zu(Z5r,i?[!0]:[]),i})},[]);return(0,p$.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var J5r=E(fe(),1);function eEr(){(0,J5r.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||sE.set(r)}catch{}})(),()=>{e=!0}},[])}function tEr(){let e=X5r(),t=qme(e),r=R_r(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);b_r({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:i}=M_r(e);eEr();let o=Q5r();return y_r("shell",{...e,selection:r,launch:n,sidebarCollapse:o}),{socket:e,selection:r,launch:n,viewLaunchedSession:i,sidebarCollapse:o}}var lg=E($(),1),jri={zIndex:e=>e.zIndex.drawer+1},Yri={minHeight:48};function rEr({mode:e,toggle:t,toggleDesign:r}){let n=tEr(),{socket:i,selection:o,viewLaunchedSession:a}=n,{design:s}=Nr();return(0,lg.jsx)(Pwr,{shell:n,children:(0,lg.jsxs)(GWe.Provider,{value:i.daemonVersion,children:[(0,lg.jsx)(f_r,{mode:e,toggle:t,toggleDesign:r,sessions:i.sessions,reconnecting:i.reconnecting}),(0,lg.jsx)(uxe,{position:"fixed",sx:jri,"data-testid":"toolbar",children:(0,lg.jsx)(hkr,{socket:i,selection:o})}),(0,lg.jsx)(R5,{variant:"dense",sx:Yri}),(0,lg.jsx)(m_r,{socket:i,children:(0,lg.jsx)($Sr,{socket:i})}),s==="slate"&&(0,lg.jsx)(hCr,{socket:i}),(0,lg.jsx)(Rwr,{socket:i,onViewLaunchedSession:a})]})})}var nEr=E(fe(),1);function iEr(){let[e,t]=(0,nEr.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})}}var Kri={black:"#2e3436",red:"#cc0000",green:"#4e9a06",yellow:"#c4a000",blue:"#3465a4",magenta:"#75507b",cyan:"#06989a",white:"#d3d7cf",brightBlack:"#555753",brightRed:"#ef2929",brightGreen:"#8ae234",brightYellow:"#fce94f",brightBlue:"#729fcf",brightMagenta:"#ad7fa8",brightCyan:"#34e2e2",brightWhite:"#eeeeec"},BX="rgba(0, 0, 0, 0.87)",oEr={background:"rgba(97, 97, 97, 0.92)",text:"#fff"},aEr={warning:"rgba(255, 167, 38, 0.09)",error:"rgba(244, 67, 54, 0.09)"},sEr={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)"},m$={name:"classic",dark:{color:{background:"#1e1e1e",surface:"#252526",raised:"rgba(255, 255, 255, 0.08)",line:"rgba(255, 255, 255, 0.12)",lineSoft:"rgba(255, 255, 255, 0.12)",text:{primary:"#fff",secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)"},selected:"rgba(255, 255, 255, 0.16)",wash:aEr,well:"#1b1b1c",stripe:"rgba(255, 255, 255, 0.1)",overlay:oEr,onAppBar:{...sEr,level:{ok:"#66bb6a",warn:"#ffa726",over:"#f44336"}},primary:{main:"#90caf9",light:"#e3f2fd",dark:"#42a5f5",contrastText:BX},secondary:{main:"#ce93d8",light:"#f3e5f5",dark:"#ab47bc",contrastText:BX},success:{main:"#66bb6a",light:"#81c784",dark:"#388e3c",contrastText:BX},warning:{main:"#ffa726",light:"#ffb74d",dark:"#f57c00",contrastText:BX},error:{main:"#f44336",light:"#e57373",dark:"#d32f2f",contrastText:"#fff"},info:{main:"#29b6f6",light:"#4fc3f7",dark:"#0288d1",contrastText:BX}},terminal:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selectionBackground:"rgba(255, 255, 255, 0.3)",...Kri},elevation:{appBar:1}},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:aEr,well:"#f3f4f6",stripe:"rgba(0, 0, 0, 0.1)",overlay:oEr,onAppBar:{...sEr,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"}},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:1}},font:{ui:'"Roboto", "Helvetica", "Arial", sans-serif',mono:"monospace",terminal:"'Cascadia Code', 'Fira Code', Consolas, monospace"},type:{fontSize:14,terminalFontSize:14,scale:{caption:12,body2:14,body1:16,subtitle2:14,subtitle1:16,h6:20,h5:24,h4:34,button:14},button:{textTransform:"uppercase",fontWeight:500}},radius:{sm:4,md:4},spacing:8};function lEr({color:e,radius:t,elevation:r,type:n}){let i={border:`1px solid ${e.line}`};return{MuiTooltip:{styleOverrides:{tooltip:{...i,backgroundColor:e.overlay.background,color:e.overlay.text,borderRadius:t.md,boxShadow:r.overlay,fontSize:`${n.scale.caption/16}rem`,padding:"6px 10px"},arrow:{color:e.overlay.background}}},MuiPopover:{styleOverrides:{paper:{...i,boxShadow:r.overlay}}},MuiDialog:{styleOverrides:{paper:{...i,backgroundColor:e.surface,borderRadius:t.md+4,boxShadow:r.dialog}}}}}var Ive=["primary","secondary","success","warning","error","info"];function FX(e,t){return{backgroundColor:Mn(e,t),borderColor:Mn(e,.35),color:e}}function cEr({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}}},...Ive.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...FX(e[t].main,.16),"&:hover":FX(e[t].main,.24)}}))]}function uEr({color:e}){return[{props:{variant:"tonal"},style:{backgroundColor:"transparent",border:`1px solid ${e.line}`,color:e.text.secondary}},...Ive.map(t=>({props:{variant:"tonal",color:t},style:{...FX(e[t].main,.14),borderColor:"transparent"}}))]}function fEr(e){let{color:t,radius:r}=e;return{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{borderRadius:r.sm}},variants:[...cEr(e),{props:{variant:"outlined",color:"error"},style:{borderColor:Mn(t.error.main,.35),"&:hover":{borderColor:t.error.main,backgroundColor:Mn(t.error.main,.1)}}}]},MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},MuiChip:{styleOverrides:{root:{fontWeight:600,borderRadius:999},sizeSmall:{height:22},outlined:{borderColor:t.line}},variants:uEr(e)}}}var sGe=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`;function dEr({radius:e}){return{MuiTabs:{styleOverrides:{root:{minHeight:40,alignItems:"center"},list:{gap:2},indicator:{display:"none"}}},MuiTab:{styleOverrides:{root:{minHeight:30,padding:"6px 10px",borderRadius:e.sm,textTransform:"none",fontWeight:500,"&:hover":{backgroundColor:sGe(8)},"&.Mui-selected":{backgroundColor:sGe(12),boxShadow:`inset 0 0 0 1px ${sGe(18)}`}}}}}}function hEr(e){let{appBar:t}=e.color;return{...lEr(e),...fEr(e),...dEr(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 Iv="#0e1116",lGe="#141820",Dve="#1b202a",Nve="#e3e7ee",cGe="#8a93a3",$X="#8b9cff",Ove="#5fd0a0",Bve="#f2b45a",Fve="#f27a7a",$ve={name:"slate",dark:{color:{background:Iv,surface:lGe,raised:Dve,line:"#262c37",lineSoft:"#1d222b",text:{primary:Nve,secondary:cGe,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:Iv,stripe:Dve,overlay:{background:Dve,text:Nve},appBar:{background:lGe,text:Nve},onAppBar:{...m$.dark.color.onAppBar,secondary:cGe,level:{ok:Ove,warn:Bve,over:Fve}},statusBar:{background:lGe,text:cGe,hoverText:Nve,secondary:"#5c6473",hover:Dve,active:"transparent",dot:$X,dotRing:"rgba(139, 156, 255, 0.14)",readyText:$X,level:{ok:Ove,warn:Bve,over:Fve}},primary:{main:$X,contrastText:Iv},secondary:{main:"#c99bff",contrastText:Iv},success:{main:Ove,contrastText:Iv},warning:{main:Bve,contrastText:Iv},error:{main:Fve,contrastText:Iv},info:{main:"#6cb6ff",contrastText:Iv}},terminal:{background:Iv,foreground:"#d6dbe4",cursor:$X,cursorAccent:Iv,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:Fve,green:Ove,yellow:Bve,blue:$X,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)"}},light:{...m$.light,color:{...m$.light.color,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"}}},elevation:{appBar:0,overlay:"0 8px 24px rgba(15, 23, 42, 0.12)",dialog:"0 24px 48px rgba(15, 23, 42, 0.18)"}},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 gT=e=>`${e/16}rem`;function pEr({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:gT(r.button)},caption:{fontSize:gT(r.caption)},body2:{fontSize:gT(r.body2)},body1:{fontSize:gT(r.body1)},subtitle2:{fontSize:gT(r.subtitle2)},subtitle1:{fontSize:gT(r.subtitle1)},h6:{fontSize:gT(r.h6)},h5:{fontSize:gT(r.h5)},h4:{fontSize:gT(r.h4)}}}function mEr(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}var Xri={classic:m$,slate:$ve};function Zri(e,t){let{dark:r,light:n,...i}=Xri[e];return{...i,...t==="dark"?r:n,mode:t}}function gEr(e,t){let r=Zri(e,t),{color:n}=r;return Y0({design:e,tokens:r,palette:{mode:t,background:{default:n.background,paper:n.surface},primary:n.primary,secondary:n.secondary,success:n.success,warning:n.warning,error:n.error,info:n.info,text:n.text,divider:n.line,action:{hover:n.raised,selected:n.selected}},typography:pEr(r),shape:{borderRadius:r.radius.sm},spacing:r.spacing,components:{...mEr(r),...e==="slate"&&hEr(r)}})}function yEr(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=$ve;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var vEr=E(fe(),1),bEr="design";function Qri(){try{return localStorage.getItem(bEr)==="slate"?"slate":"classic"}catch{return"classic"}}function xEr(){let[e,t]=(0,vEr.useState)(Qri);return{design:e,toggleDesign:()=>t(n=>{let i=n==="slate"?"classic":"slate";try{localStorage.setItem(bEr,i)}catch{}return i})}}var TEr=E(fe(),1);var zve=E($(),1),Jri=5;function SEr({children:e}){let[t,r]=(0,TEr.useState)(null);return(0,zve.jsxs)(Pwe.Provider,{value:t,children:[e,(0,zve.jsx)(ne,{ref:r,"data-testid":"toast-stack",sx:{position:"fixed",zIndex:"snackbar",bottom:{xs:1,sm:3},left:{xs:1,sm:"50%"},right:{xs:1,sm:"auto"},transform:{sm:"translateX(-50%)"},display:"flex",flexDirection:"column",alignItems:{xs:"stretch",sm:"center"},gap:1,pointerEvents:"none","& > *":{pointerEvents:"auto"},[`& > :nth-last-of-type(n+${Jri+1})`]:{display:"none"}}})]})}var yT=E($(),1);function eni(){let{mode:e,toggle:t}=iEr(),{design:r,toggleDesign:n}=xEr(),i=(0,wEr.useMemo)(()=>gEr(r,e),[r,e]);return(0,yT.jsxs)(jZ,{theme:i,children:[(0,yT.jsx)(DQ,{}),(0,yT.jsx)(SEr,{children:(0,yT.jsx)(rEr,{mode:e,toggle:t,toggleDesign:n})})]})}var tni=DCe([{path:"*",element:(0,yT.jsx)(eni,{})}]);function rni(){return(0,yT.jsx)(_Ce,{router:tni})}var CEr=document.getElementById("app");CEr&&yEr().then(()=>{(0,kEr.createRoot)(CEr).render((0,yT.jsx)(rni,{}))});})();
|
|
4025
4025
|
/*! Bundled license information:
|
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.938.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -6211,7 +6211,7 @@ var adviceConfigHelp = [
|
|
|
6211
6211
|
},
|
|
6212
6212
|
{
|
|
6213
6213
|
key: "advice.rules",
|
|
6214
|
-
setter: "
|
|
6214
|
+
setter: "assist rules add '<text>' --title '<title>' --global",
|
|
6215
6215
|
note: 'listed under "Your rules"; global and repo entries are concatenated, global first'
|
|
6216
6216
|
}
|
|
6217
6217
|
];
|
|
@@ -40224,10 +40224,49 @@ function registerReview(program) {
|
|
|
40224
40224
|
);
|
|
40225
40225
|
}
|
|
40226
40226
|
|
|
40227
|
+
// src/commands/rules/addGlobalRule.ts
|
|
40228
|
+
import chalk244 from "chalk";
|
|
40229
|
+
function fail8(message3) {
|
|
40230
|
+
console.error(chalk244.red(message3));
|
|
40231
|
+
process.exitCode = 1;
|
|
40232
|
+
}
|
|
40233
|
+
function existingRules(globalConfigPath) {
|
|
40234
|
+
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
40235
|
+
return Array.isArray(advice?.rules) ? advice.rules : [];
|
|
40236
|
+
}
|
|
40237
|
+
function addGlobalRule(text17, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
40238
|
+
if (options2.scope !== void 0) {
|
|
40239
|
+
fail8(
|
|
40240
|
+
"--global writes to ~/.assist.yml and cannot be combined with --scope"
|
|
40241
|
+
);
|
|
40242
|
+
return;
|
|
40243
|
+
}
|
|
40244
|
+
const rule = text17.trim();
|
|
40245
|
+
const title = options2.title?.trim() ?? "";
|
|
40246
|
+
if (rule === "" || title === "") {
|
|
40247
|
+
fail8("Global rules need both rule text and --title");
|
|
40248
|
+
return;
|
|
40249
|
+
}
|
|
40250
|
+
const result = applyConfigSet(
|
|
40251
|
+
"advice.rules",
|
|
40252
|
+
[...existingRules(globalConfigPath), { title, text: rule }],
|
|
40253
|
+
true,
|
|
40254
|
+
process.cwd(),
|
|
40255
|
+
globalConfigPath
|
|
40256
|
+
);
|
|
40257
|
+
if (!result.ok) {
|
|
40258
|
+
fail8(result.errors.join("\n"));
|
|
40259
|
+
return;
|
|
40260
|
+
}
|
|
40261
|
+
console.log(
|
|
40262
|
+
`Added ${chalk244.cyan(title)} to advice.rules in ${globalConfigFileLabel(globalConfigPath)}`
|
|
40263
|
+
);
|
|
40264
|
+
}
|
|
40265
|
+
|
|
40227
40266
|
// src/commands/rules/addRule.ts
|
|
40228
40267
|
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync44 } from "fs";
|
|
40229
40268
|
import path87 from "path";
|
|
40230
|
-
import
|
|
40269
|
+
import chalk245 from "chalk";
|
|
40231
40270
|
|
|
40232
40271
|
// src/commands/rules/insertRuleBullet.ts
|
|
40233
40272
|
function ruleBullet({ code, title, text: text17 }) {
|
|
@@ -40363,7 +40402,7 @@ function read2(file) {
|
|
|
40363
40402
|
function addRule(text17, options2) {
|
|
40364
40403
|
const rule = text17.trim();
|
|
40365
40404
|
if (rule === "") {
|
|
40366
|
-
console.error(
|
|
40405
|
+
console.error(chalk245.red("Rule text is required"));
|
|
40367
40406
|
process.exitCode = 1;
|
|
40368
40407
|
return;
|
|
40369
40408
|
}
|
|
@@ -40381,13 +40420,13 @@ function addRule(text17, options2) {
|
|
|
40381
40420
|
);
|
|
40382
40421
|
updateScopedRulesIndex(root2);
|
|
40383
40422
|
console.log(
|
|
40384
|
-
`Added ${
|
|
40423
|
+
`Added ${chalk245.cyan(code)} to ${path87.relative(process.cwd(), target) || target}`
|
|
40385
40424
|
);
|
|
40386
40425
|
}
|
|
40387
40426
|
|
|
40388
40427
|
// src/commands/rules/indexRules.ts
|
|
40389
40428
|
import path88 from "path";
|
|
40390
|
-
import
|
|
40429
|
+
import chalk246 from "chalk";
|
|
40391
40430
|
function indexRules() {
|
|
40392
40431
|
const startDir = scopeDirectory(process.cwd());
|
|
40393
40432
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
@@ -40395,24 +40434,24 @@ function indexRules() {
|
|
|
40395
40434
|
const rootFile = path88.relative(process.cwd(), path88.join(root2, "CLAUDE.md"));
|
|
40396
40435
|
if (directories.length === 0) {
|
|
40397
40436
|
console.log(
|
|
40398
|
-
|
|
40437
|
+
chalk246.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
40399
40438
|
);
|
|
40400
40439
|
return;
|
|
40401
40440
|
}
|
|
40402
40441
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
40403
40442
|
for (const directory of directories)
|
|
40404
|
-
console.log(` ${
|
|
40443
|
+
console.log(` ${chalk246.cyan(directory)}`);
|
|
40405
40444
|
}
|
|
40406
40445
|
|
|
40407
40446
|
// src/commands/rules/listRules.ts
|
|
40408
40447
|
import path89 from "path";
|
|
40409
|
-
import
|
|
40448
|
+
import chalk247 from "chalk";
|
|
40410
40449
|
function listRules(target, options2 = {}) {
|
|
40411
40450
|
const resolved = path89.resolve(target ?? process.cwd());
|
|
40412
40451
|
const rules2 = readScopedRules(resolved);
|
|
40413
40452
|
if (rules2.length === 0) {
|
|
40414
40453
|
const label = path89.relative(process.cwd(), resolved) || ".";
|
|
40415
|
-
console.log(
|
|
40454
|
+
console.log(chalk247.gray(`No rules in scope for ${label}`));
|
|
40416
40455
|
return;
|
|
40417
40456
|
}
|
|
40418
40457
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -40422,14 +40461,14 @@ function listRules(target, options2 = {}) {
|
|
|
40422
40461
|
if (rule.source !== shown) {
|
|
40423
40462
|
shown = rule.source;
|
|
40424
40463
|
console.log(
|
|
40425
|
-
|
|
40464
|
+
chalk247.dim(base ? path89.relative(base, rule.source) : rule.source)
|
|
40426
40465
|
);
|
|
40427
40466
|
}
|
|
40428
40467
|
console.log(
|
|
40429
|
-
` ${
|
|
40468
|
+
` ${chalk247.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
40430
40469
|
);
|
|
40431
40470
|
if (options2.full && rule.title)
|
|
40432
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
40471
|
+
console.log(` ${" ".repeat(width2)} ${chalk247.dim(rule.text)}`);
|
|
40433
40472
|
}
|
|
40434
40473
|
}
|
|
40435
40474
|
|
|
@@ -40450,8 +40489,11 @@ function registerRules(program) {
|
|
|
40450
40489
|
).option(
|
|
40451
40490
|
"--scope <path>",
|
|
40452
40491
|
"File or directory whose nearest CLAUDE.md receives the rule, or a CLAUDE.md path to write to directly (default: cwd)"
|
|
40492
|
+
).option(
|
|
40493
|
+
"--global",
|
|
40494
|
+
"Append the rule to advice.rules in ~/.assist.yml instead of a CLAUDE.md, for rules about agent conduct that hold in every repo. Needs --title; takes no R-code and cannot be combined with --scope"
|
|
40453
40495
|
).action(
|
|
40454
|
-
(text17, options2) => addRule(text17, options2)
|
|
40496
|
+
(text17, options2) => options2.global ? addGlobalRule(text17, options2) : addRule(text17, options2)
|
|
40455
40497
|
),
|
|
40456
40498
|
"/add-rule and /fix-rules"
|
|
40457
40499
|
);
|
|
@@ -40464,7 +40506,7 @@ function registerRules(program) {
|
|
|
40464
40506
|
}
|
|
40465
40507
|
|
|
40466
40508
|
// src/commands/seq/seqAuth.ts
|
|
40467
|
-
import
|
|
40509
|
+
import chalk249 from "chalk";
|
|
40468
40510
|
|
|
40469
40511
|
// src/commands/seq/loadConnections.ts
|
|
40470
40512
|
function loadConnections2() {
|
|
@@ -40493,10 +40535,10 @@ function setDefaultConnection(name) {
|
|
|
40493
40535
|
}
|
|
40494
40536
|
|
|
40495
40537
|
// src/shared/assertUniqueName.ts
|
|
40496
|
-
import
|
|
40538
|
+
import chalk248 from "chalk";
|
|
40497
40539
|
function assertUniqueName(existingNames, name) {
|
|
40498
40540
|
if (existingNames.includes(name)) {
|
|
40499
|
-
console.error(
|
|
40541
|
+
console.error(chalk248.red(`Connection "${name}" already exists.`));
|
|
40500
40542
|
process.exit(1);
|
|
40501
40543
|
}
|
|
40502
40544
|
}
|
|
@@ -40514,16 +40556,16 @@ async function promptConnection2(existingNames) {
|
|
|
40514
40556
|
var seqAuth = createConnectionAuth({
|
|
40515
40557
|
load: loadConnections2,
|
|
40516
40558
|
save: saveConnections2,
|
|
40517
|
-
format: (c) => `${
|
|
40559
|
+
format: (c) => `${chalk249.bold(c.name)} ${c.url}`,
|
|
40518
40560
|
promptNew: promptConnection2,
|
|
40519
40561
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
40520
40562
|
});
|
|
40521
40563
|
|
|
40522
40564
|
// src/commands/seq/seqQuery.ts
|
|
40523
|
-
import
|
|
40565
|
+
import chalk253 from "chalk";
|
|
40524
40566
|
|
|
40525
40567
|
// src/commands/seq/fetchSeq.ts
|
|
40526
|
-
import
|
|
40568
|
+
import chalk250 from "chalk";
|
|
40527
40569
|
async function fetchSeq(conn, path108, params) {
|
|
40528
40570
|
const url = `${conn.url}${path108}?${params}`;
|
|
40529
40571
|
const response = await fetch(url, {
|
|
@@ -40534,7 +40576,7 @@ async function fetchSeq(conn, path108, params) {
|
|
|
40534
40576
|
});
|
|
40535
40577
|
if (!response.ok) {
|
|
40536
40578
|
const body = await response.text();
|
|
40537
|
-
console.error(
|
|
40579
|
+
console.error(chalk250.red(`Seq returned ${response.status}: ${body}`));
|
|
40538
40580
|
process.exit(1);
|
|
40539
40581
|
}
|
|
40540
40582
|
return response;
|
|
@@ -40593,23 +40635,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
40593
40635
|
}
|
|
40594
40636
|
|
|
40595
40637
|
// src/commands/seq/formatEvent.ts
|
|
40596
|
-
import
|
|
40638
|
+
import chalk251 from "chalk";
|
|
40597
40639
|
function levelColor(level) {
|
|
40598
40640
|
switch (level) {
|
|
40599
40641
|
case "Fatal":
|
|
40600
|
-
return
|
|
40642
|
+
return chalk251.bgRed.white;
|
|
40601
40643
|
case "Error":
|
|
40602
|
-
return
|
|
40644
|
+
return chalk251.red;
|
|
40603
40645
|
case "Warning":
|
|
40604
|
-
return
|
|
40646
|
+
return chalk251.yellow;
|
|
40605
40647
|
case "Information":
|
|
40606
|
-
return
|
|
40648
|
+
return chalk251.cyan;
|
|
40607
40649
|
case "Debug":
|
|
40608
|
-
return
|
|
40650
|
+
return chalk251.gray;
|
|
40609
40651
|
case "Verbose":
|
|
40610
|
-
return
|
|
40652
|
+
return chalk251.dim;
|
|
40611
40653
|
default:
|
|
40612
|
-
return
|
|
40654
|
+
return chalk251.white;
|
|
40613
40655
|
}
|
|
40614
40656
|
}
|
|
40615
40657
|
function levelAbbrev(level) {
|
|
@@ -40650,12 +40692,12 @@ function formatTimestamp(iso) {
|
|
|
40650
40692
|
function formatEvent(event) {
|
|
40651
40693
|
const color = levelColor(event.Level);
|
|
40652
40694
|
const abbrev = levelAbbrev(event.Level);
|
|
40653
|
-
const ts10 =
|
|
40695
|
+
const ts10 = chalk251.dim(formatTimestamp(event.Timestamp));
|
|
40654
40696
|
const msg = renderMessage(event);
|
|
40655
40697
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
40656
40698
|
if (event.Exception) {
|
|
40657
40699
|
for (const line of event.Exception.split("\n")) {
|
|
40658
|
-
lines2.push(
|
|
40700
|
+
lines2.push(chalk251.red(` ${line}`));
|
|
40659
40701
|
}
|
|
40660
40702
|
}
|
|
40661
40703
|
return lines2.join("\n");
|
|
@@ -40688,11 +40730,11 @@ function rejectTimestampFilter(filter) {
|
|
|
40688
40730
|
}
|
|
40689
40731
|
|
|
40690
40732
|
// src/shared/resolveNamedConnection.ts
|
|
40691
|
-
import
|
|
40733
|
+
import chalk252 from "chalk";
|
|
40692
40734
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
40693
40735
|
if (connections.length === 0) {
|
|
40694
40736
|
console.error(
|
|
40695
|
-
|
|
40737
|
+
chalk252.red(
|
|
40696
40738
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
40697
40739
|
)
|
|
40698
40740
|
);
|
|
@@ -40701,7 +40743,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
40701
40743
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
40702
40744
|
const connection = connections.find((c) => c.name === target);
|
|
40703
40745
|
if (!connection) {
|
|
40704
|
-
console.error(
|
|
40746
|
+
console.error(chalk252.red(`${kind} connection "${target}" not found.`));
|
|
40705
40747
|
process.exit(1);
|
|
40706
40748
|
}
|
|
40707
40749
|
return connection;
|
|
@@ -40730,7 +40772,7 @@ async function seqQuery(filter, options2) {
|
|
|
40730
40772
|
new URLSearchParams({ filter, count: String(count10) })
|
|
40731
40773
|
);
|
|
40732
40774
|
if (events.length === 0) {
|
|
40733
|
-
console.log(
|
|
40775
|
+
console.log(chalk253.yellow("No events found."));
|
|
40734
40776
|
return;
|
|
40735
40777
|
}
|
|
40736
40778
|
if (options2.json) {
|
|
@@ -40741,11 +40783,11 @@ async function seqQuery(filter, options2) {
|
|
|
40741
40783
|
for (const event of chronological) {
|
|
40742
40784
|
console.log(formatEvent(event));
|
|
40743
40785
|
}
|
|
40744
|
-
console.log(
|
|
40786
|
+
console.log(chalk253.dim(`
|
|
40745
40787
|
${events.length} events`));
|
|
40746
40788
|
if (events.length >= count10) {
|
|
40747
40789
|
console.log(
|
|
40748
|
-
|
|
40790
|
+
chalk253.yellow(
|
|
40749
40791
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
40750
40792
|
)
|
|
40751
40793
|
);
|
|
@@ -40753,10 +40795,10 @@ ${events.length} events`));
|
|
|
40753
40795
|
}
|
|
40754
40796
|
|
|
40755
40797
|
// src/shared/setNamedDefaultConnection.ts
|
|
40756
|
-
import
|
|
40798
|
+
import chalk254 from "chalk";
|
|
40757
40799
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
40758
40800
|
if (!connections.find((c) => c.name === name)) {
|
|
40759
|
-
console.error(
|
|
40801
|
+
console.error(chalk254.red(`Connection "${name}" not found.`));
|
|
40760
40802
|
process.exit(1);
|
|
40761
40803
|
}
|
|
40762
40804
|
setDefault(name);
|
|
@@ -41058,7 +41100,7 @@ function registerSlack(program) {
|
|
|
41058
41100
|
}
|
|
41059
41101
|
|
|
41060
41102
|
// src/commands/sql/sqlAuth.ts
|
|
41061
|
-
import
|
|
41103
|
+
import chalk256 from "chalk";
|
|
41062
41104
|
|
|
41063
41105
|
// src/commands/sql/loadConnections.ts
|
|
41064
41106
|
function loadConnections3() {
|
|
@@ -41087,7 +41129,7 @@ function setDefaultConnection2(name) {
|
|
|
41087
41129
|
}
|
|
41088
41130
|
|
|
41089
41131
|
// src/commands/sql/promptConnection.ts
|
|
41090
|
-
import
|
|
41132
|
+
import chalk255 from "chalk";
|
|
41091
41133
|
async function promptConnection3(existingNames) {
|
|
41092
41134
|
const name = await promptInput("name", "Connection name:", "default");
|
|
41093
41135
|
assertUniqueName(existingNames, name);
|
|
@@ -41095,7 +41137,7 @@ async function promptConnection3(existingNames) {
|
|
|
41095
41137
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
41096
41138
|
const port = Number.parseInt(portStr, 10);
|
|
41097
41139
|
if (!Number.isFinite(port)) {
|
|
41098
|
-
console.error(
|
|
41140
|
+
console.error(chalk255.red(`Invalid port "${portStr}".`));
|
|
41099
41141
|
process.exit(1);
|
|
41100
41142
|
}
|
|
41101
41143
|
const user = await promptInput("user", "User:");
|
|
@@ -41108,13 +41150,13 @@ async function promptConnection3(existingNames) {
|
|
|
41108
41150
|
var sqlAuth = createConnectionAuth({
|
|
41109
41151
|
load: loadConnections3,
|
|
41110
41152
|
save: saveConnections3,
|
|
41111
|
-
format: (c) => `${
|
|
41153
|
+
format: (c) => `${chalk256.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
41112
41154
|
promptNew: promptConnection3,
|
|
41113
41155
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
41114
41156
|
});
|
|
41115
41157
|
|
|
41116
41158
|
// src/commands/sql/printTable.ts
|
|
41117
|
-
import
|
|
41159
|
+
import chalk257 from "chalk";
|
|
41118
41160
|
function formatCell(value) {
|
|
41119
41161
|
if (value === null || value === void 0) return "";
|
|
41120
41162
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -41123,7 +41165,7 @@ function formatCell(value) {
|
|
|
41123
41165
|
}
|
|
41124
41166
|
function printTable(rows) {
|
|
41125
41167
|
if (rows.length === 0) {
|
|
41126
|
-
console.log(
|
|
41168
|
+
console.log(chalk257.yellow("(no rows)"));
|
|
41127
41169
|
return;
|
|
41128
41170
|
}
|
|
41129
41171
|
const columns = Object.keys(rows[0]);
|
|
@@ -41131,13 +41173,13 @@ function printTable(rows) {
|
|
|
41131
41173
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
41132
41174
|
);
|
|
41133
41175
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
41134
|
-
console.log(
|
|
41135
|
-
console.log(
|
|
41176
|
+
console.log(chalk257.dim(header));
|
|
41177
|
+
console.log(chalk257.dim("-".repeat(header.length)));
|
|
41136
41178
|
for (const row3 of rows) {
|
|
41137
41179
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
41138
41180
|
console.log(line);
|
|
41139
41181
|
}
|
|
41140
|
-
console.log(
|
|
41182
|
+
console.log(chalk257.dim(`
|
|
41141
41183
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
41142
41184
|
}
|
|
41143
41185
|
|
|
@@ -41197,7 +41239,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
41197
41239
|
}
|
|
41198
41240
|
|
|
41199
41241
|
// src/commands/sql/sqlMutate.ts
|
|
41200
|
-
import
|
|
41242
|
+
import chalk258 from "chalk";
|
|
41201
41243
|
|
|
41202
41244
|
// src/commands/sql/isMutation.ts
|
|
41203
41245
|
var MUTATION_KEYWORDS = [
|
|
@@ -41231,7 +41273,7 @@ function isMutation(sql27) {
|
|
|
41231
41273
|
async function sqlMutate(query, connectionName) {
|
|
41232
41274
|
if (!isMutation(query)) {
|
|
41233
41275
|
console.error(
|
|
41234
|
-
|
|
41276
|
+
chalk258.red(
|
|
41235
41277
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
41236
41278
|
)
|
|
41237
41279
|
);
|
|
@@ -41241,18 +41283,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
41241
41283
|
const pool = await sqlConnect(conn);
|
|
41242
41284
|
try {
|
|
41243
41285
|
const result = await pool.request().query(query);
|
|
41244
|
-
console.log(
|
|
41286
|
+
console.log(chalk258.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
41245
41287
|
} finally {
|
|
41246
41288
|
await pool.close();
|
|
41247
41289
|
}
|
|
41248
41290
|
}
|
|
41249
41291
|
|
|
41250
41292
|
// src/commands/sql/sqlQuery.ts
|
|
41251
|
-
import
|
|
41293
|
+
import chalk259 from "chalk";
|
|
41252
41294
|
async function sqlQuery(query, connectionName) {
|
|
41253
41295
|
if (isMutation(query)) {
|
|
41254
41296
|
console.error(
|
|
41255
|
-
|
|
41297
|
+
chalk259.red(
|
|
41256
41298
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
41257
41299
|
)
|
|
41258
41300
|
);
|
|
@@ -41267,7 +41309,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
41267
41309
|
printTable(rows);
|
|
41268
41310
|
} else {
|
|
41269
41311
|
console.log(
|
|
41270
|
-
|
|
41312
|
+
chalk259.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
41271
41313
|
);
|
|
41272
41314
|
}
|
|
41273
41315
|
} finally {
|
|
@@ -41682,7 +41724,7 @@ function syncPi(claudeDir, options2) {
|
|
|
41682
41724
|
// src/commands/sync/syncSettings.ts
|
|
41683
41725
|
import * as fs46 from "fs";
|
|
41684
41726
|
import * as path100 from "path";
|
|
41685
|
-
import
|
|
41727
|
+
import chalk260 from "chalk";
|
|
41686
41728
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
41687
41729
|
const source = path100.join(claudeDir, "settings.json");
|
|
41688
41730
|
const target = path100.join(targetBase, "settings.json");
|
|
@@ -41701,7 +41743,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41701
41743
|
if (mergedContent !== normalizedTarget) {
|
|
41702
41744
|
if (!options2?.yes) {
|
|
41703
41745
|
console.log(
|
|
41704
|
-
|
|
41746
|
+
chalk260.yellow(
|
|
41705
41747
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
41706
41748
|
)
|
|
41707
41749
|
);
|
|
@@ -41709,7 +41751,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41709
41751
|
printDiff(targetContent, mergedContent);
|
|
41710
41752
|
printAutoConfirmHint();
|
|
41711
41753
|
const confirm = await promptConfirm(
|
|
41712
|
-
|
|
41754
|
+
chalk260.red("Overwrite existing settings.json?"),
|
|
41713
41755
|
false
|
|
41714
41756
|
);
|
|
41715
41757
|
if (!confirm) {
|
|
@@ -44257,7 +44299,7 @@ function parseEnvPairs(pairs) {
|
|
|
44257
44299
|
}
|
|
44258
44300
|
|
|
44259
44301
|
// src/commands/run/parseParamSpecs.ts
|
|
44260
|
-
function
|
|
44302
|
+
function fail9(spec) {
|
|
44261
44303
|
console.error(
|
|
44262
44304
|
`--param must be <name>, <name>! or <name>=<default>, got "${spec}"`
|
|
44263
44305
|
);
|
|
@@ -44267,14 +44309,14 @@ function parseParamSpec(spec) {
|
|
|
44267
44309
|
const eq46 = spec.indexOf("=");
|
|
44268
44310
|
const name = eq46 === -1 ? spec : spec.slice(0, eq46);
|
|
44269
44311
|
if (eq46 !== -1) {
|
|
44270
|
-
if (eq46 === 0 || name.endsWith("!"))
|
|
44312
|
+
if (eq46 === 0 || name.endsWith("!")) fail9(spec);
|
|
44271
44313
|
return { name, default: spec.slice(eq46 + 1) };
|
|
44272
44314
|
}
|
|
44273
44315
|
if (name.endsWith("!")) {
|
|
44274
|
-
if (name.length === 1)
|
|
44316
|
+
if (name.length === 1) fail9(spec);
|
|
44275
44317
|
return { name: name.slice(0, -1), required: true };
|
|
44276
44318
|
}
|
|
44277
|
-
if (name.length === 0)
|
|
44319
|
+
if (name.length === 0) fail9(spec);
|
|
44278
44320
|
return { name };
|
|
44279
44321
|
}
|
|
44280
44322
|
function parseParamSpecs(specs) {
|
|
@@ -44533,18 +44575,18 @@ function registerRun(program) {
|
|
|
44533
44575
|
}
|
|
44534
44576
|
|
|
44535
44577
|
// src/commands/sessions/nodes/formatLink.ts
|
|
44536
|
-
import
|
|
44578
|
+
import chalk261 from "chalk";
|
|
44537
44579
|
var STATE_COLOURS = {
|
|
44538
|
-
connected:
|
|
44539
|
-
connecting:
|
|
44540
|
-
disconnected:
|
|
44541
|
-
"version-blocked":
|
|
44580
|
+
connected: chalk261.green,
|
|
44581
|
+
connecting: chalk261.yellow,
|
|
44582
|
+
disconnected: chalk261.red,
|
|
44583
|
+
"version-blocked": chalk261.red
|
|
44542
44584
|
};
|
|
44543
44585
|
function formatLink(link3) {
|
|
44544
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
44586
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk261.white;
|
|
44545
44587
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
44546
44588
|
const error = link3.error ? `
|
|
44547
|
-
${
|
|
44589
|
+
${chalk261.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
44548
44590
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
44549
44591
|
}
|
|
44550
44592
|
|
|
@@ -52304,7 +52346,7 @@ async function closeSession() {
|
|
|
52304
52346
|
}
|
|
52305
52347
|
|
|
52306
52348
|
// src/commands/sessions/nodes/listNodes.ts
|
|
52307
|
-
import
|
|
52349
|
+
import chalk262 from "chalk";
|
|
52308
52350
|
async function nodesReport() {
|
|
52309
52351
|
const live = await queryNodes();
|
|
52310
52352
|
if (live)
|
|
@@ -52321,10 +52363,10 @@ async function listNodes(options2) {
|
|
|
52321
52363
|
console.log(JSON.stringify(report, null, 2));
|
|
52322
52364
|
return;
|
|
52323
52365
|
}
|
|
52324
|
-
console.log(`${report.local} ${
|
|
52366
|
+
console.log(`${report.local} ${chalk262.dim("(this node)")}`);
|
|
52325
52367
|
if (!report.daemonRunning)
|
|
52326
|
-
console.log(
|
|
52327
|
-
if (report.links.length === 0) console.log(
|
|
52368
|
+
console.log(chalk262.dim(" daemon not running; showing configured links"));
|
|
52369
|
+
if (report.links.length === 0) console.log(chalk262.dim(" no links"));
|
|
52328
52370
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
52329
52371
|
}
|
|
52330
52372
|
|
|
@@ -52346,7 +52388,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
52346
52388
|
}
|
|
52347
52389
|
|
|
52348
52390
|
// src/commands/sessions/nodes/printReport.ts
|
|
52349
|
-
import
|
|
52391
|
+
import chalk263 from "chalk";
|
|
52350
52392
|
function printReport(report) {
|
|
52351
52393
|
if (report.links.length === 0) {
|
|
52352
52394
|
console.log(`${report.local} has no links`);
|
|
@@ -52360,11 +52402,11 @@ function printReport(report) {
|
|
|
52360
52402
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
52361
52403
|
}
|
|
52362
52404
|
function printDiagnosis(diagnosis) {
|
|
52363
|
-
console.log(`${
|
|
52405
|
+
console.log(`${chalk263.bold(diagnosis.name)} ${chalk263.dim(diagnosis.url)}`);
|
|
52364
52406
|
for (const hop of diagnosis.hops) {
|
|
52365
|
-
const mark = hop.ok ?
|
|
52407
|
+
const mark = hop.ok ? chalk263.green("\u2713") : chalk263.red("\u2717");
|
|
52366
52408
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
52367
|
-
if (hop.remediation) console.log(` ${
|
|
52409
|
+
if (hop.remediation) console.log(` ${chalk263.yellow(hop.remediation)}`);
|
|
52368
52410
|
}
|
|
52369
52411
|
}
|
|
52370
52412
|
|
|
@@ -52436,14 +52478,14 @@ function registerDiagnoseCommands(nodes, calledBy4) {
|
|
|
52436
52478
|
}
|
|
52437
52479
|
|
|
52438
52480
|
// src/commands/sessions/nodes/linkNode.ts
|
|
52439
|
-
import
|
|
52481
|
+
import chalk266 from "chalk";
|
|
52440
52482
|
|
|
52441
52483
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
52442
|
-
import
|
|
52484
|
+
import chalk264 from "chalk";
|
|
52443
52485
|
async function notifyDaemonLinks() {
|
|
52444
52486
|
if (!await isDaemonRunning()) {
|
|
52445
52487
|
console.log(
|
|
52446
|
-
|
|
52488
|
+
chalk264.yellow(
|
|
52447
52489
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
52448
52490
|
)
|
|
52449
52491
|
);
|
|
@@ -52451,11 +52493,11 @@ async function notifyDaemonLinks() {
|
|
|
52451
52493
|
}
|
|
52452
52494
|
try {
|
|
52453
52495
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
52454
|
-
console.log(
|
|
52496
|
+
console.log(chalk264.dim("The sessions daemon reloaded its links."));
|
|
52455
52497
|
} catch (error) {
|
|
52456
52498
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
52457
52499
|
console.log(
|
|
52458
|
-
|
|
52500
|
+
chalk264.yellow(
|
|
52459
52501
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
52460
52502
|
)
|
|
52461
52503
|
);
|
|
@@ -52463,7 +52505,7 @@ async function notifyDaemonLinks() {
|
|
|
52463
52505
|
}
|
|
52464
52506
|
|
|
52465
52507
|
// src/commands/sessions/nodes/readLinks.ts
|
|
52466
|
-
import
|
|
52508
|
+
import chalk265 from "chalk";
|
|
52467
52509
|
|
|
52468
52510
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
52469
52511
|
async function writeLinks(links2) {
|
|
@@ -52486,7 +52528,7 @@ async function readLinks() {
|
|
|
52486
52528
|
await writeLinks(links2);
|
|
52487
52529
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
52488
52530
|
console.log(
|
|
52489
|
-
|
|
52531
|
+
chalk265.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
52490
52532
|
);
|
|
52491
52533
|
return links2;
|
|
52492
52534
|
}
|
|
@@ -52542,7 +52584,7 @@ async function linkNode(name, url, options2) {
|
|
|
52542
52584
|
throw new Error(`${name} is this node; link to a different node`);
|
|
52543
52585
|
const link3 = await buildLink(name, url, options2);
|
|
52544
52586
|
await writeLinks([...others, link3]);
|
|
52545
|
-
console.log(
|
|
52587
|
+
console.log(chalk266.green(`Linked ${name} (${link3.url})`));
|
|
52546
52588
|
await notifyDaemonLinks();
|
|
52547
52589
|
}
|
|
52548
52590
|
|
|
@@ -52607,14 +52649,14 @@ function startPeerAction(name, action) {
|
|
|
52607
52649
|
const line = `nodes ${action} ${name} trace=${traceId}`;
|
|
52608
52650
|
console.log(line);
|
|
52609
52651
|
appendDaemonLog(line);
|
|
52610
|
-
const
|
|
52652
|
+
const fail11 = async (summary, error) => new Error(await describeFailure(name, summary, error));
|
|
52611
52653
|
return {
|
|
52612
52654
|
spec,
|
|
52613
52655
|
traceId,
|
|
52614
|
-
fail:
|
|
52656
|
+
fail: fail11,
|
|
52615
52657
|
async awaitReturn(sawDown, timeoutMs = RETURN_TIMEOUT_MS) {
|
|
52616
52658
|
const link3 = await awaitLinkReturn(name, { sawDown, timeoutMs });
|
|
52617
|
-
if (!link3) throw await
|
|
52659
|
+
if (!link3) throw await fail11(`${name} did not come back`);
|
|
52618
52660
|
return link3;
|
|
52619
52661
|
}
|
|
52620
52662
|
};
|
|
@@ -52725,16 +52767,16 @@ function registerPeerActionCommands(nodes, calledBy4) {
|
|
|
52725
52767
|
}
|
|
52726
52768
|
|
|
52727
52769
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
52728
|
-
import
|
|
52770
|
+
import chalk267 from "chalk";
|
|
52729
52771
|
async function unlinkNode(name) {
|
|
52730
52772
|
const links2 = await readLinks();
|
|
52731
52773
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
52732
52774
|
if (remaining.length === links2.length) {
|
|
52733
|
-
console.log(
|
|
52775
|
+
console.log(chalk267.yellow(`No link named ${name}`));
|
|
52734
52776
|
return;
|
|
52735
52777
|
}
|
|
52736
52778
|
await writeLinks(remaining);
|
|
52737
|
-
console.log(
|
|
52779
|
+
console.log(chalk267.green(`Unlinked ${name}`));
|
|
52738
52780
|
await notifyDaemonLinks();
|
|
52739
52781
|
}
|
|
52740
52782
|
|
|
@@ -52808,17 +52850,17 @@ function resolveTarget3(sessionId, server) {
|
|
|
52808
52850
|
async function sessionOutput(sessionId, options2) {
|
|
52809
52851
|
const count10 = Number.parseInt(options2.lines, 10);
|
|
52810
52852
|
if (!Number.isInteger(count10) || count10 < 1)
|
|
52811
|
-
return
|
|
52853
|
+
return fail10(`-n must be a positive integer, got ${options2.lines}`);
|
|
52812
52854
|
const target = resolveTarget3(sessionId, options2.server);
|
|
52813
|
-
if (typeof target === "string") return
|
|
52855
|
+
if (typeof target === "string") return fail10(target);
|
|
52814
52856
|
try {
|
|
52815
52857
|
const scrollback = await requestSessionOutput(target);
|
|
52816
52858
|
for (const line of lastLines(scrollback, count10)) console.log(line);
|
|
52817
52859
|
} catch (error) {
|
|
52818
|
-
|
|
52860
|
+
fail10(error instanceof Error ? error.message : String(error));
|
|
52819
52861
|
}
|
|
52820
52862
|
}
|
|
52821
|
-
function
|
|
52863
|
+
function fail10(message3) {
|
|
52822
52864
|
console.error(message3);
|
|
52823
52865
|
process.exitCode = 1;
|
|
52824
52866
|
}
|
|
@@ -52969,10 +53011,10 @@ function createProgram() {
|
|
|
52969
53011
|
}
|
|
52970
53012
|
|
|
52971
53013
|
// src/reportCliError.ts
|
|
52972
|
-
import
|
|
53014
|
+
import chalk268 from "chalk";
|
|
52973
53015
|
function reportCliError(error) {
|
|
52974
53016
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
52975
|
-
console.error(
|
|
53017
|
+
console.error(chalk268.red(error.message));
|
|
52976
53018
|
} else {
|
|
52977
53019
|
console.error(error);
|
|
52978
53020
|
}
|