@staff0rd/assist 0.1032.0 → 0.1032.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/claude/commands/bug.md
CHANGED
|
@@ -21,9 +21,15 @@ Before asking the user about existing functionality — how a feature currently
|
|
|
21
21
|
|
|
22
22
|
Skip questions the user has already answered. Stop asking as soon as you have enough to write a clear bug report — don't over-interrogate.
|
|
23
23
|
|
|
24
|
-
## Step 3:
|
|
24
|
+
## Step 3: Design the UI change
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Read the **Designing a new backlog item's UI change** section of `/design` (`~/.claude/skills/design/SKILL.md`) and follow its Decide and Design and review steps for the fix. If it decides the fix's UI change is not substantial, skip this step silently. Otherwise its link step applies in Step 4 and its attach step in Step 5.
|
|
27
|
+
|
|
28
|
+
## Step 4: Compose the bug report
|
|
29
|
+
|
|
30
|
+
Compose the bug report's content, but do not show it to the user yet and do not work out where the review should happen — `propose` decides that in Step 5 and tells you what to do next.
|
|
31
|
+
|
|
32
|
+
If Step 3 produced a design, link it from the description as `/design` describes.
|
|
27
33
|
|
|
28
34
|
**Name:** (concise title)
|
|
29
35
|
**Type:** bug
|
|
@@ -53,7 +59,7 @@ The description renders as markdown in both the terminal (`assist backlog show`)
|
|
|
53
59
|
**Actual:** what happens instead.
|
|
54
60
|
```
|
|
55
61
|
|
|
56
|
-
## Step
|
|
62
|
+
## Step 5: Propose the item
|
|
57
63
|
|
|
58
64
|
Propose the item and capture the id it prints. Use `propose`, not `assist backlog add` — `propose` is the reviewed path for an agent-authored item:
|
|
59
65
|
|
|
@@ -108,9 +114,13 @@ assist backlog add-activity a<id> slack "<permalink>" --url "<permalink>" --titl
|
|
|
108
114
|
|
|
109
115
|
Use the same permalink verbatim for both the ref and `--url`, and the item's name for `--title`. If no Slack thread was referenced, skip this step.
|
|
110
116
|
|
|
117
|
+
### Attach the design
|
|
118
|
+
|
|
119
|
+
If Step 3 published a design artifact, attach it to the created item as `/design` describes. If Step 3 was skipped, skip this step.
|
|
120
|
+
|
|
111
121
|
Then show the user the item was created. If `propose` printed `Started a backlog run session for a<id>.`, the user chose **Approve & start** and implementation is already running — say so, and do not suggest running it. Otherwise suggest they can run `assist backlog run a<id>` to start implementation.
|
|
112
122
|
|
|
113
|
-
If the conversation established that more items still need to be filed (e.g. a follow-up item, or one in another repo), do not signal yet — create each remaining item now, repeating Steps 3
|
|
123
|
+
If the conversation established that more items still need to be filed (e.g. a follow-up item, or one in another repo), do not signal yet — create each remaining item now, repeating Steps 3 to 5 for it.
|
|
114
124
|
|
|
115
125
|
Finally, once the last item is created, signal that the bug-filing task is complete, passing every item id created in this session (a-prefixed, e.g. `a555 a556`):
|
|
116
126
|
|
|
@@ -28,3 +28,40 @@ Follow the workflow the system prompt lays out — ask clarifying questions firs
|
|
|
28
28
|
The design system prompt is written for a filesystem-based project, so it talks about saving HTML files. In Claude Code the file is the intermediate, not the deliverable: **publish the finished design as an artifact** so the user gets a URL they can open and share. Do not deliver a scratchpad path.
|
|
29
29
|
|
|
30
30
|
Load the `artifact-design` skill before writing the page, write the HTML to a file, then publish that file with the `Artifact` tool. When iterating, edit the same file and publish again so the URL stays stable. Keep a design on disk only as a working intermediate, or when the user asks for a file specifically.
|
|
31
|
+
|
|
32
|
+
## Designing a new backlog item's UI change
|
|
33
|
+
|
|
34
|
+
`/draft` and `/bug` follow this section while creating an item. It is the single source of the design step for both.
|
|
35
|
+
|
|
36
|
+
### Decide
|
|
37
|
+
|
|
38
|
+
From what the user described and answered, decide whether the item involves a **substantial UI change** — a new screen, panel, view or component, or a reworked layout or interaction flow. A trivial UI change (a label, a button, a tweak to an existing control) or no UI change at all is not substantial: skip this section entirely and do not mention it.
|
|
39
|
+
|
|
40
|
+
### Design and review
|
|
41
|
+
|
|
42
|
+
If it is substantial, do not ask whether to design it — follow Steps 1-4 above for the item's UI, applying them to what the user described and answered in place of `$ARGUMENTS`. Publish the design as an artifact, then raise each review round with `ask-design` instead of iterating in chat. Write a short markdown summary of the design (what it shows and the choices to weigh in on) to a scratch file and run, as a background task, doing no other work until it returns:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
assist ask-design --url '<artifact-url>' --title '<design title>' --body - < <summary-file>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- **Approved** (exit 0) — fold every printed comment into the design, republishing to the same URL, then move on.
|
|
49
|
+
- **Rejected** (non-zero, printing the reason and comments) — revise the design to address each one, republish to the same artifact URL, and re-run `ask-design` for the next round. Repeat until approved.
|
|
50
|
+
- To revise while a round is still pending, re-run `ask-design` directly; the earlier task exits 0 as superseded — ignore its result.
|
|
51
|
+
- If it prints the design link and exits 0 without `Approved.` (not in an assist web session), ask the user in chat instead and iterate there — editing the same file and republishing to the same URL — until they say they are happy with it.
|
|
52
|
+
|
|
53
|
+
Keep the artifact's URL and name for the two steps below.
|
|
54
|
+
|
|
55
|
+
### Link it from the description
|
|
56
|
+
|
|
57
|
+
When composing the item, add a `## Design` section to its description with the artifact URL, so the implementer builds against it.
|
|
58
|
+
|
|
59
|
+
### Attach it to the created item
|
|
60
|
+
|
|
61
|
+
Once `propose` has created the item, attach the artifact so it renders as a linked design row in the Activity section:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
assist backlog add-activity a<id> design "<artifact-url>" --url "<artifact-url>" --title "<artifact name>" 2>&1
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Use the artifact URL verbatim for both the ref and `--url`, and the artifact's name for `--title`.
|
package/claude/commands/draft.md
CHANGED
|
@@ -26,26 +26,13 @@ If the harness provides a structured question tool, ask each question with it
|
|
|
26
26
|
|
|
27
27
|
## Step 3: Design the UI change
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
If it is substantial, do not ask whether to design it — follow `/design` (`~/.claude/skills/design/SKILL.md`) for the story's UI, applying it to what the user described and answered. Publish the design as an artifact, then raise each review round with `ask-design` instead of iterating in chat. Write a short markdown summary of the design (what it shows and the choices to weigh in on) to a scratch file and run, as a background task, doing no other work until it returns:
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
assist ask-design --url '<artifact-url>' --title '<design title>' --body - < <summary-file>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
- **Approved** (exit 0) — fold every printed comment into the design, republishing to the same URL, then move on.
|
|
38
|
-
- **Rejected** (non-zero, printing the reason and comments) — revise the design to address each one, republish to the same artifact URL, and re-run `ask-design` for the next round. Repeat until approved.
|
|
39
|
-
- To revise while a round is still pending, re-run `ask-design` directly; the earlier task exits 0 as superseded — ignore its result.
|
|
40
|
-
- If it prints the design link and exits 0 without `Approved.` (not in an assist web session), ask the user in chat instead and iterate there — editing the same file and republishing to the same URL — until they say they are happy with it.
|
|
41
|
-
|
|
42
|
-
Keep the artifact's URL and name: the item's description references the design (Step 4), and the artifact is attached to the item once it is created (Step 5).
|
|
29
|
+
Read the **Designing a new backlog item's UI change** section of `/design` (`~/.claude/skills/design/SKILL.md`) and follow its Decide and Design and review steps for the story. If it decides the change is not substantial, skip this step silently. Otherwise its link step applies in Step 4 and its attach step in Step 5.
|
|
43
30
|
|
|
44
31
|
## Step 4: Compose the item
|
|
45
32
|
|
|
46
33
|
Compose the item's content, but do not show it to the user yet and do not work out where the review should happen — `propose` decides that in Step 5 and tells you what to do next.
|
|
47
34
|
|
|
48
|
-
If Step 3 produced a design,
|
|
35
|
+
If Step 3 produced a design, link it from the description as `/design` describes.
|
|
49
36
|
|
|
50
37
|
**Name:** (concise title)
|
|
51
38
|
**Type:** story or bug
|
|
@@ -174,13 +161,7 @@ Use the same permalink verbatim for both the ref and `--url`, and the item's nam
|
|
|
174
161
|
|
|
175
162
|
### Attach the design
|
|
176
163
|
|
|
177
|
-
If Step 3 published a design artifact, attach it to the created item
|
|
178
|
-
|
|
179
|
-
```
|
|
180
|
-
assist backlog add-activity a<id> design "<artifact-url>" --url "<artifact-url>" --title "<artifact name>" 2>&1
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Use the artifact URL verbatim for both the ref and `--url`, and the artifact's name for `--title`. If Step 3 was skipped, skip this step.
|
|
164
|
+
If Step 3 published a design artifact, attach it to the created item as `/design` describes. If Step 3 was skipped, skip this step.
|
|
184
165
|
|
|
185
166
|
Then show the user the item was created. If `propose` printed `Started a backlog run session for a<id>.`, the user chose **Approve & start** and implementation is already running — say so, and do not suggest running it. Otherwise suggest they can run `assist backlog run a<id>` to start implementation.
|
|
186
167
|
|
|
@@ -4058,7 +4058,7 @@ ${d.join(`
|
|
|
4058
4058
|
`,tPo=Bi`
|
|
4059
4059
|
0%, 100% { transform: scale(1); }
|
|
4060
4060
|
50% { transform: scale(1.08); }
|
|
4061
|
-
`,Q$r={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:`${ePo} 1.8s linear infinite`},rPo={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${tPo} 1.6s ease-in-out infinite`,"&::before":{...Q$r,inset:0,zIndex:-1},"&::after":{...Q$r,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gl.rainbowPill.text,textShadow:Gl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function J$r({children:e}){return(0,qI.jsxs)(qI.Fragment,{children:[(0,qI.jsx)(z3,{styles:JRo}),(0,qI.jsx)(G,{component:"span","data-testid":"rainbow-pill",sx:rPo,children:e})]})}function eFr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function tFr(e){if(e.length!==2)return!1;let[t,r]=e;return eFr(t)===eFr(r)}var zw=C(P(),1);function nFr({rateLimits:e}){let t=C0(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(i=>i.window?.used_percentage!=null),n=tFr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:rEe(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,zw.jsxs)(rFr.Fragment,{children:[a>0?(0,zw.jsx)(G,{component:"span",sx:{color:$G,mr:.5},children:","}):null,(0,zw.jsx)(Z$r,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,zw.jsx)(J$r,{children:o}):(0,zw.jsx)(zw.Fragment,{children:o})}var H5=C(P(),1);function iFr({groups:e}){return(0,H5.jsx)(H5.Fragment,{children:e.map((t,r)=>(0,H5.jsxs)(oFr.Fragment,{children:[(0,H5.jsx)(G,{component:"span",sx:{color:$G,ml:r>0?1:0,mr:.5},children:$c(t.harness)}),(0,H5.jsx)(nFr,{rateLimits:t.rateLimits})]},t.harness))})}var aFr={root:{fontFamily:"fontFamilyMono",fontSize:12,display:"grid",gap:1},group:{display:"grid",gap:"2px"},heading:{color:e=>e.tokens.color.onAppBar.secondary},foot:{pt:.75,opacity:.6,borderTop:"1px solid color-mix(in srgb, currentColor 18%, transparent)"}};function nPo(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function oPo(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function iPo(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function cFr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=rat(t,r,n);if(o==null)return{kind:"unprojectable"};let i=yx(e,t,r,n),a=nPo(i),s=oPo(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:iPo(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function oEe(e){return t=>t.tokens.color.onAppBar.level[e]}function uFr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${pG(e.at,t)}`}var W5=C(P(),1),dFr={display:"contents"};function wat({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,W5.jsxs)(G,{component:"span",sx:dFr,children:[(0,W5.jsx)("span",{}),(0,W5.jsx)("span",{})]});let n=(0,W5.jsx)(G,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,W5.jsxs)(G,{component:"span",sx:{color:oEe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,W5.jsxs)(G,{component:"span",sx:dFr,children:[r?o:n,r?n:o]})}var fFr={row:{display:"grid",gridTemplateColumns:"2.5ch 4ch 1ch 4ch 1ch 4ch auto",alignItems:"baseline",gap:.75,fontVariantNumeric:"tabular-nums"},pctWeight:500,note:{pl:.75,color:e=>e.tokens.color.onAppBar.secondary}};var G5=C(P(),1);function pFr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=fFr,a=yx(t,r,n,o),s=cFr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,G5.jsxs)(G,{sx:i.row,children:[(0,G5.jsx)(G,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,G5.jsx)(wat,{direction:"back",threshold:l?.recovery}),(0,G5.jsxs)(G,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:oEe(a)},children:[Math.round(t),"%"]}),(0,G5.jsx)(wat,{direction:"forward",threshold:l?.worse}),(0,G5.jsx)(G,{component:"span",sx:i.note,children:l?l.recovery&&uFr(l.recovery,o):"no projection yet"})]})}function iEe(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 mFr=C(P(),1);function hFr({rateLimits:e,now:t}){return iEe(e).map(r=>(0,mFr.jsx)(pFr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var jI=C(P(),1);function gFr({groups:e}){let t=C0(3e4),r=aFr;return(0,jI.jsxs)(G,{sx:r.root,children:[e.map(n=>(0,jI.jsxs)(G,{sx:r.group,children:[(0,jI.jsx)(G,{sx:r.heading,children:$c(n.harness)}),(0,jI.jsx)(hFr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,jI.jsx)(G,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var Cat=C(P(),1),aPo="Claude account usage (5h / 7d windows) \u2014 view history";function yFr(e){return e.length===0?{title:aPo,content:"Usage"}:{title:(0,Cat.jsx)(gFr,{groups:e}),content:(0,Cat.jsx)(iFr,{groups:e})}}var vFr={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}},bFr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var kat=C(P(),1),sPo={};function xFr({rateLimits:e,harnessRateLimits:t=sPo}){let{title:r,content:n}=yFr(tEe(e,t));return(0,kat.jsx)(sr,{title:r,placement:"top-start",slotProps:bFr,children:(0,kat.jsx)(Qr,{component:da,to:"/usage",underline:"none",color:"inherit",sx:vFr,children:n})})}var wFr=C(ee(),1);var ch="0.1032.0";var aEe=C(ee(),1),_at=(0,aEe.createContext)(null);function sEe(){return(0,aEe.useContext)(_at)}var Eat=C(P(),1);function SFr(){let e=sEe();return!e||e===ch?null:(0,Eat.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${ch}. Restart the daemon to match.`,children:(0,Eat.jsx)(W_e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var TFr=e=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:0,height:22,borderRadius:1,fontSize:"inherit",lineHeight:1.5,color:"inherit",opacity:1,bgcolor:t=>e?Lx(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>Lx(t).hover,color:t=>Lx(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>Lx(t).dot,boxShadow:t=>`0 0 0 3px ${Lx(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>Lx(t).readyText}});var R0=C(P(),1);function CFr(){let{entries:e}=S5(),t=an(),r=(0,wFr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=fo("openUpdates");if(Zi(n,r),!ch)return null;let i=e.filter(C5).length;return(0,R0.jsxs)(R0.Fragment,{children:[(0,R0.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,R0.jsx)(_d,{label:"Updates",chords:o}),children:(0,R0.jsxs)(nr,{component:da,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:TFr(i>0),children:[i>0&&(0,R0.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,R0.jsxs)("span",{children:["v",ch]}),i>0&&(0,R0.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,R0.jsx)(SFr,{})]})}var Uw=C(P(),1);function kFr({socket:e}){return(0,Uw.jsx)(B$r,{start:(0,Uw.jsx)(xFr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,Uw.jsxs)(Uw.Fragment,{children:[(0,Uw.jsx)(Y$r,{}),(0,Uw.jsx)(CFr,{})]})})}var _Fr=C(ee(),1);var Hw=C(P(),1),lPo=2e4;function EFr(){let{entries:e,refresh:t}=S5(),[r,n]=(0,_Fr.useState)(),o=e.find(l=>l.local)?.status?.extension,i=o?.behind&&o.updateLink&&o.latest?o:void 0,a=i!==void 0&&r!==i.latest,s=()=>n(i?.latest);return(0,Hw.jsx)(Mu,{open:a,children:(0,Hw.jsxs)(no,{severity:"info",variant:"filled",action:(0,Hw.jsxs)(Hw.Fragment,{children:[(0,Hw.jsx)(ht,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,lPo),children:"Install"}),(0,Hw.jsx)(ht,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var fEe=C(ee(),1);var dEe=C(ee(),1);function RFr(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 V5=C(P(),1),cPo={display:"flex",gap:1,alignItems:"center",minWidth:0},uPo={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},dPo={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},fPo={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function pPo(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function PFr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,V5.jsx)(Jm,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=pPo(o);return(0,V5.jsxs)(Kr,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:cPo,children:[(0,V5.jsx)(I2e,{path:o}),(0,V5.jsxs)(G,{sx:uPo,children:[(0,V5.jsx)(Ce,{component:"span",sx:dPo,children:s}),(0,V5.jsx)(Ce,{component:"span",color:"text.secondary",sx:fPo,children:a})]})]},o)})})}var lEe=C(P(),1),hPo={maxHeight:420,overflowY:"auto"},mPo={px:2,py:2,fontSize:13};function AFr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,lEe.jsx)(G,{sx:hPo,children:e?(0,lEe.jsx)(Ce,{color:"text.secondary",sx:mPo,children:e}):(0,lEe.jsx)(PFr,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var LFr=C(P(),1),gPo={mt:6,alignSelf:"flex-start"};function cEe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,LFr.jsx)(vl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:gPo},transition:{onEntered:t}},children:n})}var uEe=C(ee(),1);var IFr={files:[],loading:!1,error:!1};function DFr(e,t){let[r,n]=(0,uEe.useState)(IFr),o=br();return(0,uEe.useEffect)(()=>{if(!e){n(IFr);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await Jt(tn(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Ar(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var YI=C(P(),1);function yPo(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function MFr({onClose:e}){let{worktreeNode:t}=to();return(0,YI.jsx)(ic.Provider,{value:t,children:(0,YI.jsx)(vPo,{onClose:e})})}function vPo({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=to(),[n,o]=(0,dEe.useState)(""),i=DFr(t,n),a=an(),s=(0,dEe.useRef)(null),l=h=>a(yPo(h,t,r)),{highlight:u,setHighlight:d,onKeyDown:f}=D5(i.files,n,l,e),p=h=>{l(h),e()};return(0,YI.jsxs)(cEe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,YI.jsx)(yk,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:f,placeholder:"Search files by name..."}),(0,YI.jsx)(AFr,{message:RFr(t,n,i),files:i.files,highlight:u,onHighlight:d,onSelect:p})]})}function NFr(e){Zi(fo("quickOpen").matches,e)}var BFr=C(P(),1);function OFr(){let[e,t]=(0,fEe.useState)(!1);return NFr((0,fEe.useCallback)(()=>t(!0),[])),e?(0,BFr.jsx)(MFr,{onClose:()=>t(!1)}):null}var pEe=C(P(),1);function $Fr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,pEe.jsx)(Mu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,pEe.jsx)(no,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,pEe.jsx)(ht,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var Ane=C(ee(),1);function FG(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var ZFr=C(ee(),1);var FFr=C(P(),1),zFr=nt((0,FFr.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 bPo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function UFr(e){return e?bPo[e]:"success.main"}function HFr(e){return e.split("-")[0].split(".").map(Number)}function WFr(e,t){if(!e||!t||e===t)return;let r=HFr(e),n=HFr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var KI=C(P(),1),xPo={height:16,fontSize:10},SPo={opacity:.6,fontSize:"0.85em"};function TPo(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 Rne({nodes:e,name:t,showVersion:r=!1}){let n=sEe()??ch,o=e.links.find(a=>a.name===t),i=WFr(o?.peerVersion,n);return(0,KI.jsx)(sr,{title:TPo(e,t),placement:"right",children:(0,KI.jsxs)(G,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,KI.jsx)(zFr,{sx:{fontSize:8,color:UFr(o?.state)}}),t,r&&o?.peerVersion&&(0,KI.jsxs)(G,{component:"span",sx:SPo,children:["v",o.peerVersion]}),i&&(0,KI.jsx)(Vn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:xPo})]})})}var XI=C(P(),1),wPo={opacity:.6},CPo={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function GFr({nodes:e,name:t,clone:r}){let n=(0,XI.jsx)(Rne,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,XI.jsx)(G,{component:"span",sx:wPo,children:n}):(0,XI.jsx)(sr,{title:SG(t,r.cloneTarget),children:(0,XI.jsxs)(G,{component:"span",sx:CPo,children:[(0,XI.jsx)(xG,{sx:{fontSize:14}}),n]})})}var qFr=C(P(),1),kPo={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 VFr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,qFr.jsx)(nr,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:kPo,children:t})}var jFr={ArrowRight:1,ArrowLeft:-1};function _Po(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+jFr[e.key]+r)%r}function YFr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!jFr[o.key]){jT(o);return}let i=_Po(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var KFr=C(ee(),1);function zG(e){return e?.querySelector('[aria-checked="true"]')}function XFr(e,t){(0,KFr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=zG(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var Rat=C(P(),1),EPo={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function hEe({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return XFr(i,r),(0,Rat.jsx)(kt,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:YFr(t,r,n,l),sx:EPo,children:t.map(u=>(0,Rat.jsx)(VFr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var Pat=C(P(),1);function QFr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=Cl(),a=(0,ZFr.useRef)(null);return!i||!n||!e?null:(0,Pat.jsx)(hEe,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,Pat.jsx)(GFr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var mEe=C(P(),1);function JFr({prompt:e,children:t}){return(0,mEe.jsxs)(kt,{children:[e,(0,mEe.jsx)(kt,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var tzr=C(P(),1),RPo=".MuiOutlinedInput-notchedOutline",PPo={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${RPo}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function ezr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,tzr.jsx)($n,{sx:PPo,value:e,onChange:a=>t(a.target.value),onKeyDown:jT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var izr=C(ee(),1);var pv={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:DSe,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},rzr=Object.keys(pv);var Aat=C(P(),1);function nzr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,Aat.jsx)(Rs,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,Aat.jsx)(Kr,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:$c(i)},i))})}var ZI=C(P(),1);function ozr(e){return t=>t==="prompt"&&e?(0,ZI.jsxs)(ZI.Fragment,{children:["prompt",(0,ZI.jsx)(G,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${$c(e)}`}),(0,ZI.jsx)(gp,{sx:{fontSize:18,mr:-.75}})]}):t}var QI=C(P(),1);function azr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,izr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(zG(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,QI.jsxs)(QI.Fragment,{children:[(0,QI.jsx)(hEe,{label:"Mode",options:rzr,value:e.mode,onChange:l,optionLabel:ozr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,QI.jsx)(nzr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var vzr=C(ee(),1);var Lat=C(P(),1),APo={zIndex:e=>e.zIndex.modal+1};function szr({open:e,anchor:t,children:r}){return(0,Lat.jsx)(EM,{open:e,anchorEl:t,placement:"bottom-start",sx:APo,children:(0,Lat.jsx)(Zr,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var lzr=C(P(),1),czr=nt((0,lzr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var Iat=C(P(),1),LPo={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},IPo={fontSize:16,color:"text.disabled"};function uzr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:LPo,endAdornment:(0,Iat.jsx)(rRe,{position:"end",children:(0,Iat.jsx)(czr,{sx:IPo})})}}}var dzr=C(fM(),1);function fzr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}jT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,dzr.flushSync)(()=>{r(t),n()}),jT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function gEe(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Tx(n).toLowerCase().includes(r)):e}var Dat=C(ee(),1);function pzr(){let[e,t]=(0,Dat.useState)(!1),[r,n]=(0,Dat.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var mzr=C(ee(),1);var hzr=e=>e?Tx(e):"";function gzr(e){let[t,r]=(0,mzr.useState)(()=>hzr(e));return{text:t,setText:r,showRepo:n=>r(hzr(n))}}function yzr(e,t,r){let n=pzr(),o=gzr(t),i=gEe(e,n.query),a=d=>{r(d),o.showRepo(d)},s=D5(i,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:o.text,filtered:i,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:fzr({open:n.open,highlighted:i[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:d=>{o.setText(d),n.filterBy(d)},onFocus:l,onBlur:()=>{n.close(),o.showRepo(t)},pick:d=>{a(d),n.close()}}}var UG=C(P(),1);function bzr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=yzr(e,t,r),s=(0,vzr.useRef)(null);return(0,UG.jsxs)(G,{ref:s,sx:{flex:1,minWidth:0},children:[(0,UG.jsx)($n,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),i()},inputRef:n,autoFocus:o,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:uzr(a.open)}),(0,UG.jsx)(szr,{open:a.open,anchor:s.current,children:(0,UG.jsx)(B_e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var q5=C(P(),1);function xzr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=to();return(0,q5.jsxs)(JFr,{prompt:(0,q5.jsx)(ezr,{value:r.prompt,onChange:r.setPrompt,placeholder:pv[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,q5.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,q5.jsx)(bzr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,q5.jsx)(azr,{...t})]}),(0,q5.jsx)(QFr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var wzr=C(P(),1),Szr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function Tzr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,wzr.jsx)(ht,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var JI=C(P(),1),DPo=e=>({alignItems:"center",flexWrap:"wrap",gap:"14px",py:"10px",pl:"18px",pr:1.5,borderTop:1,borderColor:e.tokens.color.lineSoft,bgcolor:"background.default",fontSize:12,color:"text.secondary"}),MPo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function Czr(e){return(0,JI.jsxs)(kt,{direction:"row",sx:DPo,children:[Szr.map(([t,r])=>(0,JI.jsxs)("span",{children:[(0,JI.jsx)(G,{component:"kbd",sx:MPo,children:t}),r]},t)),(0,JI.jsx)(G,{sx:{flex:1}}),(0,JI.jsx)(Tzr,{...e})]})}var eD=C(ee(),1);function kzr(e,t){let r=(0,eD.useRef)(e),n=(0,eD.useRef)(null),o=(0,eD.useRef)(null),i=(0,eD.useRef)(null),a=(0,eD.useCallback)(u=>{n.current=u;let{field:d,selectionStart:f,selectionEnd:p}=r.current;u&&d==="prompt"&&u.setSelectionRange(f,p)},[]),s=u=>{let d=u.target;t({field:"prompt",selectionStart:d.selectionStart,selectionEnd:d.selectionEnd})},l=()=>{if(i.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:o.current,mode:zG(i.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:o,modeRef:i,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function NPo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:F_e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function _zr(e,t){let{names:r,visible:n}=Cl(),o=M_e(t,n?r:[void 0]);return{cloneState:o,target:NPo(t,e,o(e))}}function yEe({mode:e,harness:t,prompt:r,cwd:n,node:o},i){let a=n||void 0,s=o?[o]:[];if(e==="prompt"){t==="claude"?i.onCreate(r,a,...s):i.onCreateHarness(t,r,a,...s);return}if(e==="design"){i.onCreateDesign(r,a,...s);return}let l=o?[{node:o}]:[];z_r(pv[e].sessionMode,n,(u,d)=>i.onCreateAssist(u,d,...l),()=>{},r)}function Ezr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(__e(r.prompt,n.onCreateAssist),!0):(yEe({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var vEe=C(ee(),1);function Rzr(e,t){let[r,n]=(0,vEe.useState)(!1);return(0,vEe.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function Pzr(e,t,r,n,o){let i=Rzr(e,()=>{Ezr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var Pne=C(ee(),1);function Azr(e,t){let r=(0,Pne.useRef)(e),n=(0,Pne.useRef)(null);return(0,Pne.useEffect)(()=>{if(r.current&&!e){let o=n.current;o?.isConnected?o.focus():t()}r.current=e},[e,t]),o=>{n.current=o.target}}var Izr=C(P(),1),OPo={border:0,margin:0,padding:0,minWidth:0};function Lzr({loading:e,restoreFocus:t,children:r}){let n=Azr(e,t);return(0,Izr.jsx)("fieldset",{disabled:e,style:OPo,onFocus:n,children:r})}var xEe=C(P(),1);function bEe({error:e,onRetry:t}){return e?(0,xEe.jsxs)(no,{severity:"error",sx:{mx:2,my:1},action:t&&(0,xEe.jsx)(ht,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:["Couldn't load this repo's default mode (",e,"). Pick a mode or retry."]}):null}var j5=C(P(),1);function Dzr({draft:e,launchers:t,onClose:r}){let n=kzr(e.focus,e.setFocus),o=FG(k0()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=_zr(e.node,e.cwd),l=Pzr(e,i,a,t,r);return(0,j5.jsx)(cEe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,j5.jsx)("form",{onSubmit:l,children:(0,j5.jsxs)(Lzr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,j5.jsx)(xzr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,j5.jsx)(bEe,{error:e.modeError,onRetry:e.retryMode}),(0,j5.jsx)(Czr,{submitLabel:a.kind==="clone"?"Clone":pv[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var tD=C(ee(),1);async function BPo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await Jt(`/api/new-session-defaults${t}`);if(!r.ok)return{error:`HTTP ${r.status}`};let n=await r.json();if(Object.hasOwn(pv,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Ar(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function SEe(e,t=0){let[r,n]=(0,tD.useState)(0),[o,i]=(0,tD.useState)(null),a=(0,tD.useCallback)(()=>n(l=>l+1),[]);if((0,tD.useEffect)(()=>{let l=!1;return BPo(e).then(u=>{l||i({cwd:e,opens:t,attempt:r,outcome:u})}),()=>{l=!0}},[e,t,r]),!o)return null;let{outcome:s}=o;return{mode:"mode"in s?s.mode:"prompt",pending:o.cwd!==e||o.opens!==t||o.attempt!==r,error:"error"in s?s.error:void 0,retry:a}}function TEe(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function Mzr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var Y5=C(ee(),1);var Nzr={field:"prompt",selectionStart:0,selectionEnd:0};function Ozr(){let[e,t]=_H("new-session"),[r,n]=(0,Y5.useState)(),[o,i]=(0,Y5.useState)(),[a,s]=(0,Y5.useState)("claude"),[l,u]=(0,Y5.useState)(),[d,f]=(0,Y5.useState)(Nzr),p=(0,Y5.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),f(Nzr)},[t]);return{prompt:e,cwd:r,mode:o,harness:a,node:l,focus:d,setPrompt:t,setNode:u,setCwd:n,setMode:i,setHarness:s,setFocus:f,clear:p}}function Bzr(e,t=SEe){let{selectedCwd:r}=to(),n=Cl(),o=Ozr(),i=o.cwd??r,a=t(i,e);return a?{...o,cwd:i,mode:o.mode??a.mode,modePending:o.mode===void 0&&a.pending,modeError:TEe(o.mode,a),retryMode:a.retry,node:Mzr(o.node,n)}:null}function $zr(e){Zi(fo("newSession").matches,e)}var Fzr=C(ee(),1);function zzr(e,t){let{selectedCwd:r}=to(),[n,o]=il(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,Fzr.useEffect)(()=>{i===null||!s||!l||!u||(i&&(s(i),l(a),u({field:"prompt",selectionStart:i.length,selectionEnd:i.length})),t(),o(d=>(d.delete("new"),d.delete("newCwd"),d),{replace:!0}))},[i,a,s,l,u,t,o])}var Hzr=C(P(),1);function Uzr({launchers:e}){let[t,r]=(0,Ane.useState)(!1),[n,o]=(0,Ane.useState)(0),i=Bzr(n),a=(0,Ane.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return $zr(a),zzr(i,a),!t||!i?null:(0,Hzr.jsx)(Dzr,{draft:i,launchers:e,onClose:()=>r(!1)})}var wEe=C(P(),1);function Wzr({reconnecting:e}){return(0,wEe.jsx)(Mu,{open:e,children:(0,wEe.jsx)(no,{severity:"info",variant:"filled",icon:(0,wEe.jsx)(Ao,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var hv=C(P(),1);function Gzr({socket:e,onViewLaunchedSession:t}){return(0,hv.jsxs)(hv.Fragment,{children:[(0,hv.jsx)(OFr,{}),(0,hv.jsx)(Uzr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,hv.jsx)(Wzr,{reconnecting:e.reconnecting}),(0,hv.jsx)(EFr,{}),(0,hv.jsx)(kl,{error:e.error,onClose:e.clearError}),(0,hv.jsx)($Fr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Ix=C(ee(),1);var $Po=6e4;function FPo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function CEe(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4061
|
+
`,Q$r={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:`${ePo} 1.8s linear infinite`},rPo={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${tPo} 1.6s ease-in-out infinite`,"&::before":{...Q$r,inset:0,zIndex:-1},"&::after":{...Q$r,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gl.rainbowPill.text,textShadow:Gl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function J$r({children:e}){return(0,qI.jsxs)(qI.Fragment,{children:[(0,qI.jsx)(z3,{styles:JRo}),(0,qI.jsx)(G,{component:"span","data-testid":"rainbow-pill",sx:rPo,children:e})]})}function eFr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function tFr(e){if(e.length!==2)return!1;let[t,r]=e;return eFr(t)===eFr(r)}var zw=C(P(),1);function nFr({rateLimits:e}){let t=C0(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(i=>i.window?.used_percentage!=null),n=tFr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:rEe(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,zw.jsxs)(rFr.Fragment,{children:[a>0?(0,zw.jsx)(G,{component:"span",sx:{color:$G,mr:.5},children:","}):null,(0,zw.jsx)(Z$r,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,zw.jsx)(J$r,{children:o}):(0,zw.jsx)(zw.Fragment,{children:o})}var H5=C(P(),1);function iFr({groups:e}){return(0,H5.jsx)(H5.Fragment,{children:e.map((t,r)=>(0,H5.jsxs)(oFr.Fragment,{children:[(0,H5.jsx)(G,{component:"span",sx:{color:$G,ml:r>0?1:0,mr:.5},children:$c(t.harness)}),(0,H5.jsx)(nFr,{rateLimits:t.rateLimits})]},t.harness))})}var aFr={root:{fontFamily:"fontFamilyMono",fontSize:12,display:"grid",gap:1},group:{display:"grid",gap:"2px"},heading:{color:e=>e.tokens.color.onAppBar.secondary},foot:{pt:.75,opacity:.6,borderTop:"1px solid color-mix(in srgb, currentColor 18%, transparent)"}};function nPo(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function oPo(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function iPo(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function cFr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=rat(t,r,n);if(o==null)return{kind:"unprojectable"};let i=yx(e,t,r,n),a=nPo(i),s=oPo(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:iPo(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function oEe(e){return t=>t.tokens.color.onAppBar.level[e]}function uFr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${pG(e.at,t)}`}var W5=C(P(),1),dFr={display:"contents"};function wat({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,W5.jsxs)(G,{component:"span",sx:dFr,children:[(0,W5.jsx)("span",{}),(0,W5.jsx)("span",{})]});let n=(0,W5.jsx)(G,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,W5.jsxs)(G,{component:"span",sx:{color:oEe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,W5.jsxs)(G,{component:"span",sx:dFr,children:[r?o:n,r?n:o]})}var fFr={row:{display:"grid",gridTemplateColumns:"2.5ch 4ch 1ch 4ch 1ch 4ch auto",alignItems:"baseline",gap:.75,fontVariantNumeric:"tabular-nums"},pctWeight:500,note:{pl:.75,color:e=>e.tokens.color.onAppBar.secondary}};var G5=C(P(),1);function pFr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=fFr,a=yx(t,r,n,o),s=cFr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,G5.jsxs)(G,{sx:i.row,children:[(0,G5.jsx)(G,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,G5.jsx)(wat,{direction:"back",threshold:l?.recovery}),(0,G5.jsxs)(G,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:oEe(a)},children:[Math.round(t),"%"]}),(0,G5.jsx)(wat,{direction:"forward",threshold:l?.worse}),(0,G5.jsx)(G,{component:"span",sx:i.note,children:l?l.recovery&&uFr(l.recovery,o):"no projection yet"})]})}function iEe(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 mFr=C(P(),1);function hFr({rateLimits:e,now:t}){return iEe(e).map(r=>(0,mFr.jsx)(pFr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var jI=C(P(),1);function gFr({groups:e}){let t=C0(3e4),r=aFr;return(0,jI.jsxs)(G,{sx:r.root,children:[e.map(n=>(0,jI.jsxs)(G,{sx:r.group,children:[(0,jI.jsx)(G,{sx:r.heading,children:$c(n.harness)}),(0,jI.jsx)(hFr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,jI.jsx)(G,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var Cat=C(P(),1),aPo="Claude account usage (5h / 7d windows) \u2014 view history";function yFr(e){return e.length===0?{title:aPo,content:"Usage"}:{title:(0,Cat.jsx)(gFr,{groups:e}),content:(0,Cat.jsx)(iFr,{groups:e})}}var vFr={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}},bFr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var kat=C(P(),1),sPo={};function xFr({rateLimits:e,harnessRateLimits:t=sPo}){let{title:r,content:n}=yFr(tEe(e,t));return(0,kat.jsx)(sr,{title:r,placement:"top-start",slotProps:bFr,children:(0,kat.jsx)(Qr,{component:da,to:"/usage",underline:"none",color:"inherit",sx:vFr,children:n})})}var wFr=C(ee(),1);var ch="0.1032.1";var aEe=C(ee(),1),_at=(0,aEe.createContext)(null);function sEe(){return(0,aEe.useContext)(_at)}var Eat=C(P(),1);function SFr(){let e=sEe();return!e||e===ch?null:(0,Eat.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${ch}. Restart the daemon to match.`,children:(0,Eat.jsx)(W_e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var TFr=e=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:0,height:22,borderRadius:1,fontSize:"inherit",lineHeight:1.5,color:"inherit",opacity:1,bgcolor:t=>e?Lx(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>Lx(t).hover,color:t=>Lx(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>Lx(t).dot,boxShadow:t=>`0 0 0 3px ${Lx(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>Lx(t).readyText}});var R0=C(P(),1);function CFr(){let{entries:e}=S5(),t=an(),r=(0,wFr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=fo("openUpdates");if(Zi(n,r),!ch)return null;let i=e.filter(C5).length;return(0,R0.jsxs)(R0.Fragment,{children:[(0,R0.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,R0.jsx)(_d,{label:"Updates",chords:o}),children:(0,R0.jsxs)(nr,{component:da,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:TFr(i>0),children:[i>0&&(0,R0.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,R0.jsxs)("span",{children:["v",ch]}),i>0&&(0,R0.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,R0.jsx)(SFr,{})]})}var Uw=C(P(),1);function kFr({socket:e}){return(0,Uw.jsx)(B$r,{start:(0,Uw.jsx)(xFr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,Uw.jsxs)(Uw.Fragment,{children:[(0,Uw.jsx)(Y$r,{}),(0,Uw.jsx)(CFr,{})]})})}var _Fr=C(ee(),1);var Hw=C(P(),1),lPo=2e4;function EFr(){let{entries:e,refresh:t}=S5(),[r,n]=(0,_Fr.useState)(),o=e.find(l=>l.local)?.status?.extension,i=o?.behind&&o.updateLink&&o.latest?o:void 0,a=i!==void 0&&r!==i.latest,s=()=>n(i?.latest);return(0,Hw.jsx)(Mu,{open:a,children:(0,Hw.jsxs)(no,{severity:"info",variant:"filled",action:(0,Hw.jsxs)(Hw.Fragment,{children:[(0,Hw.jsx)(ht,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,lPo),children:"Install"}),(0,Hw.jsx)(ht,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var fEe=C(ee(),1);var dEe=C(ee(),1);function RFr(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 V5=C(P(),1),cPo={display:"flex",gap:1,alignItems:"center",minWidth:0},uPo={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},dPo={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},fPo={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function pPo(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function PFr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,V5.jsx)(Jm,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=pPo(o);return(0,V5.jsxs)(Kr,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:cPo,children:[(0,V5.jsx)(I2e,{path:o}),(0,V5.jsxs)(G,{sx:uPo,children:[(0,V5.jsx)(Ce,{component:"span",sx:dPo,children:s}),(0,V5.jsx)(Ce,{component:"span",color:"text.secondary",sx:fPo,children:a})]})]},o)})})}var lEe=C(P(),1),hPo={maxHeight:420,overflowY:"auto"},mPo={px:2,py:2,fontSize:13};function AFr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,lEe.jsx)(G,{sx:hPo,children:e?(0,lEe.jsx)(Ce,{color:"text.secondary",sx:mPo,children:e}):(0,lEe.jsx)(PFr,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var LFr=C(P(),1),gPo={mt:6,alignSelf:"flex-start"};function cEe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,LFr.jsx)(vl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:gPo},transition:{onEntered:t}},children:n})}var uEe=C(ee(),1);var IFr={files:[],loading:!1,error:!1};function DFr(e,t){let[r,n]=(0,uEe.useState)(IFr),o=br();return(0,uEe.useEffect)(()=>{if(!e){n(IFr);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await Jt(tn(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Ar(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var YI=C(P(),1);function yPo(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function MFr({onClose:e}){let{worktreeNode:t}=to();return(0,YI.jsx)(ic.Provider,{value:t,children:(0,YI.jsx)(vPo,{onClose:e})})}function vPo({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=to(),[n,o]=(0,dEe.useState)(""),i=DFr(t,n),a=an(),s=(0,dEe.useRef)(null),l=h=>a(yPo(h,t,r)),{highlight:u,setHighlight:d,onKeyDown:f}=D5(i.files,n,l,e),p=h=>{l(h),e()};return(0,YI.jsxs)(cEe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,YI.jsx)(yk,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:f,placeholder:"Search files by name..."}),(0,YI.jsx)(AFr,{message:RFr(t,n,i),files:i.files,highlight:u,onHighlight:d,onSelect:p})]})}function NFr(e){Zi(fo("quickOpen").matches,e)}var BFr=C(P(),1);function OFr(){let[e,t]=(0,fEe.useState)(!1);return NFr((0,fEe.useCallback)(()=>t(!0),[])),e?(0,BFr.jsx)(MFr,{onClose:()=>t(!1)}):null}var pEe=C(P(),1);function $Fr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,pEe.jsx)(Mu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,pEe.jsx)(no,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,pEe.jsx)(ht,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var Ane=C(ee(),1);function FG(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var ZFr=C(ee(),1);var FFr=C(P(),1),zFr=nt((0,FFr.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 bPo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function UFr(e){return e?bPo[e]:"success.main"}function HFr(e){return e.split("-")[0].split(".").map(Number)}function WFr(e,t){if(!e||!t||e===t)return;let r=HFr(e),n=HFr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var KI=C(P(),1),xPo={height:16,fontSize:10},SPo={opacity:.6,fontSize:"0.85em"};function TPo(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 Rne({nodes:e,name:t,showVersion:r=!1}){let n=sEe()??ch,o=e.links.find(a=>a.name===t),i=WFr(o?.peerVersion,n);return(0,KI.jsx)(sr,{title:TPo(e,t),placement:"right",children:(0,KI.jsxs)(G,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,KI.jsx)(zFr,{sx:{fontSize:8,color:UFr(o?.state)}}),t,r&&o?.peerVersion&&(0,KI.jsxs)(G,{component:"span",sx:SPo,children:["v",o.peerVersion]}),i&&(0,KI.jsx)(Vn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:xPo})]})})}var XI=C(P(),1),wPo={opacity:.6},CPo={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function GFr({nodes:e,name:t,clone:r}){let n=(0,XI.jsx)(Rne,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,XI.jsx)(G,{component:"span",sx:wPo,children:n}):(0,XI.jsx)(sr,{title:SG(t,r.cloneTarget),children:(0,XI.jsxs)(G,{component:"span",sx:CPo,children:[(0,XI.jsx)(xG,{sx:{fontSize:14}}),n]})})}var qFr=C(P(),1),kPo={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 VFr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,qFr.jsx)(nr,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:kPo,children:t})}var jFr={ArrowRight:1,ArrowLeft:-1};function _Po(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+jFr[e.key]+r)%r}function YFr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!jFr[o.key]){jT(o);return}let i=_Po(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var KFr=C(ee(),1);function zG(e){return e?.querySelector('[aria-checked="true"]')}function XFr(e,t){(0,KFr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=zG(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var Rat=C(P(),1),EPo={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function hEe({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return XFr(i,r),(0,Rat.jsx)(kt,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:YFr(t,r,n,l),sx:EPo,children:t.map(u=>(0,Rat.jsx)(VFr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var Pat=C(P(),1);function QFr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=Cl(),a=(0,ZFr.useRef)(null);return!i||!n||!e?null:(0,Pat.jsx)(hEe,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,Pat.jsx)(GFr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var mEe=C(P(),1);function JFr({prompt:e,children:t}){return(0,mEe.jsxs)(kt,{children:[e,(0,mEe.jsx)(kt,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var tzr=C(P(),1),RPo=".MuiOutlinedInput-notchedOutline",PPo={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${RPo}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function ezr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,tzr.jsx)($n,{sx:PPo,value:e,onChange:a=>t(a.target.value),onKeyDown:jT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var izr=C(ee(),1);var pv={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:DSe,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},rzr=Object.keys(pv);var Aat=C(P(),1);function nzr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,Aat.jsx)(Rs,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,Aat.jsx)(Kr,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:$c(i)},i))})}var ZI=C(P(),1);function ozr(e){return t=>t==="prompt"&&e?(0,ZI.jsxs)(ZI.Fragment,{children:["prompt",(0,ZI.jsx)(G,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${$c(e)}`}),(0,ZI.jsx)(gp,{sx:{fontSize:18,mr:-.75}})]}):t}var QI=C(P(),1);function azr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,izr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(zG(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,QI.jsxs)(QI.Fragment,{children:[(0,QI.jsx)(hEe,{label:"Mode",options:rzr,value:e.mode,onChange:l,optionLabel:ozr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,QI.jsx)(nzr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var vzr=C(ee(),1);var Lat=C(P(),1),APo={zIndex:e=>e.zIndex.modal+1};function szr({open:e,anchor:t,children:r}){return(0,Lat.jsx)(EM,{open:e,anchorEl:t,placement:"bottom-start",sx:APo,children:(0,Lat.jsx)(Zr,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var lzr=C(P(),1),czr=nt((0,lzr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var Iat=C(P(),1),LPo={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},IPo={fontSize:16,color:"text.disabled"};function uzr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:LPo,endAdornment:(0,Iat.jsx)(rRe,{position:"end",children:(0,Iat.jsx)(czr,{sx:IPo})})}}}var dzr=C(fM(),1);function fzr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}jT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,dzr.flushSync)(()=>{r(t),n()}),jT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function gEe(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Tx(n).toLowerCase().includes(r)):e}var Dat=C(ee(),1);function pzr(){let[e,t]=(0,Dat.useState)(!1),[r,n]=(0,Dat.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var mzr=C(ee(),1);var hzr=e=>e?Tx(e):"";function gzr(e){let[t,r]=(0,mzr.useState)(()=>hzr(e));return{text:t,setText:r,showRepo:n=>r(hzr(n))}}function yzr(e,t,r){let n=pzr(),o=gzr(t),i=gEe(e,n.query),a=d=>{r(d),o.showRepo(d)},s=D5(i,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:o.text,filtered:i,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:fzr({open:n.open,highlighted:i[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:d=>{o.setText(d),n.filterBy(d)},onFocus:l,onBlur:()=>{n.close(),o.showRepo(t)},pick:d=>{a(d),n.close()}}}var UG=C(P(),1);function bzr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=yzr(e,t,r),s=(0,vzr.useRef)(null);return(0,UG.jsxs)(G,{ref:s,sx:{flex:1,minWidth:0},children:[(0,UG.jsx)($n,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),i()},inputRef:n,autoFocus:o,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:uzr(a.open)}),(0,UG.jsx)(szr,{open:a.open,anchor:s.current,children:(0,UG.jsx)(B_e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var q5=C(P(),1);function xzr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=to();return(0,q5.jsxs)(JFr,{prompt:(0,q5.jsx)(ezr,{value:r.prompt,onChange:r.setPrompt,placeholder:pv[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,q5.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,q5.jsx)(bzr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,q5.jsx)(azr,{...t})]}),(0,q5.jsx)(QFr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var wzr=C(P(),1),Szr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function Tzr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,wzr.jsx)(ht,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var JI=C(P(),1),DPo=e=>({alignItems:"center",flexWrap:"wrap",gap:"14px",py:"10px",pl:"18px",pr:1.5,borderTop:1,borderColor:e.tokens.color.lineSoft,bgcolor:"background.default",fontSize:12,color:"text.secondary"}),MPo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function Czr(e){return(0,JI.jsxs)(kt,{direction:"row",sx:DPo,children:[Szr.map(([t,r])=>(0,JI.jsxs)("span",{children:[(0,JI.jsx)(G,{component:"kbd",sx:MPo,children:t}),r]},t)),(0,JI.jsx)(G,{sx:{flex:1}}),(0,JI.jsx)(Tzr,{...e})]})}var eD=C(ee(),1);function kzr(e,t){let r=(0,eD.useRef)(e),n=(0,eD.useRef)(null),o=(0,eD.useRef)(null),i=(0,eD.useRef)(null),a=(0,eD.useCallback)(u=>{n.current=u;let{field:d,selectionStart:f,selectionEnd:p}=r.current;u&&d==="prompt"&&u.setSelectionRange(f,p)},[]),s=u=>{let d=u.target;t({field:"prompt",selectionStart:d.selectionStart,selectionEnd:d.selectionEnd})},l=()=>{if(i.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:o.current,mode:zG(i.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:o,modeRef:i,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function NPo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:F_e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function _zr(e,t){let{names:r,visible:n}=Cl(),o=M_e(t,n?r:[void 0]);return{cloneState:o,target:NPo(t,e,o(e))}}function yEe({mode:e,harness:t,prompt:r,cwd:n,node:o},i){let a=n||void 0,s=o?[o]:[];if(e==="prompt"){t==="claude"?i.onCreate(r,a,...s):i.onCreateHarness(t,r,a,...s);return}if(e==="design"){i.onCreateDesign(r,a,...s);return}let l=o?[{node:o}]:[];z_r(pv[e].sessionMode,n,(u,d)=>i.onCreateAssist(u,d,...l),()=>{},r)}function Ezr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(__e(r.prompt,n.onCreateAssist),!0):(yEe({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var vEe=C(ee(),1);function Rzr(e,t){let[r,n]=(0,vEe.useState)(!1);return(0,vEe.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function Pzr(e,t,r,n,o){let i=Rzr(e,()=>{Ezr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var Pne=C(ee(),1);function Azr(e,t){let r=(0,Pne.useRef)(e),n=(0,Pne.useRef)(null);return(0,Pne.useEffect)(()=>{if(r.current&&!e){let o=n.current;o?.isConnected?o.focus():t()}r.current=e},[e,t]),o=>{n.current=o.target}}var Izr=C(P(),1),OPo={border:0,margin:0,padding:0,minWidth:0};function Lzr({loading:e,restoreFocus:t,children:r}){let n=Azr(e,t);return(0,Izr.jsx)("fieldset",{disabled:e,style:OPo,onFocus:n,children:r})}var xEe=C(P(),1);function bEe({error:e,onRetry:t}){return e?(0,xEe.jsxs)(no,{severity:"error",sx:{mx:2,my:1},action:t&&(0,xEe.jsx)(ht,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:["Couldn't load this repo's default mode (",e,"). Pick a mode or retry."]}):null}var j5=C(P(),1);function Dzr({draft:e,launchers:t,onClose:r}){let n=kzr(e.focus,e.setFocus),o=FG(k0()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=_zr(e.node,e.cwd),l=Pzr(e,i,a,t,r);return(0,j5.jsx)(cEe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,j5.jsx)("form",{onSubmit:l,children:(0,j5.jsxs)(Lzr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,j5.jsx)(xzr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,j5.jsx)(bEe,{error:e.modeError,onRetry:e.retryMode}),(0,j5.jsx)(Czr,{submitLabel:a.kind==="clone"?"Clone":pv[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var tD=C(ee(),1);async function BPo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await Jt(`/api/new-session-defaults${t}`);if(!r.ok)return{error:`HTTP ${r.status}`};let n=await r.json();if(Object.hasOwn(pv,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Ar(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function SEe(e,t=0){let[r,n]=(0,tD.useState)(0),[o,i]=(0,tD.useState)(null),a=(0,tD.useCallback)(()=>n(l=>l+1),[]);if((0,tD.useEffect)(()=>{let l=!1;return BPo(e).then(u=>{l||i({cwd:e,opens:t,attempt:r,outcome:u})}),()=>{l=!0}},[e,t,r]),!o)return null;let{outcome:s}=o;return{mode:"mode"in s?s.mode:"prompt",pending:o.cwd!==e||o.opens!==t||o.attempt!==r,error:"error"in s?s.error:void 0,retry:a}}function TEe(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function Mzr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var Y5=C(ee(),1);var Nzr={field:"prompt",selectionStart:0,selectionEnd:0};function Ozr(){let[e,t]=_H("new-session"),[r,n]=(0,Y5.useState)(),[o,i]=(0,Y5.useState)(),[a,s]=(0,Y5.useState)("claude"),[l,u]=(0,Y5.useState)(),[d,f]=(0,Y5.useState)(Nzr),p=(0,Y5.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),f(Nzr)},[t]);return{prompt:e,cwd:r,mode:o,harness:a,node:l,focus:d,setPrompt:t,setNode:u,setCwd:n,setMode:i,setHarness:s,setFocus:f,clear:p}}function Bzr(e,t=SEe){let{selectedCwd:r}=to(),n=Cl(),o=Ozr(),i=o.cwd??r,a=t(i,e);return a?{...o,cwd:i,mode:o.mode??a.mode,modePending:o.mode===void 0&&a.pending,modeError:TEe(o.mode,a),retryMode:a.retry,node:Mzr(o.node,n)}:null}function $zr(e){Zi(fo("newSession").matches,e)}var Fzr=C(ee(),1);function zzr(e,t){let{selectedCwd:r}=to(),[n,o]=il(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,Fzr.useEffect)(()=>{i===null||!s||!l||!u||(i&&(s(i),l(a),u({field:"prompt",selectionStart:i.length,selectionEnd:i.length})),t(),o(d=>(d.delete("new"),d.delete("newCwd"),d),{replace:!0}))},[i,a,s,l,u,t,o])}var Hzr=C(P(),1);function Uzr({launchers:e}){let[t,r]=(0,Ane.useState)(!1),[n,o]=(0,Ane.useState)(0),i=Bzr(n),a=(0,Ane.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return $zr(a),zzr(i,a),!t||!i?null:(0,Hzr.jsx)(Dzr,{draft:i,launchers:e,onClose:()=>r(!1)})}var wEe=C(P(),1);function Wzr({reconnecting:e}){return(0,wEe.jsx)(Mu,{open:e,children:(0,wEe.jsx)(no,{severity:"info",variant:"filled",icon:(0,wEe.jsx)(Ao,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var hv=C(P(),1);function Gzr({socket:e,onViewLaunchedSession:t}){return(0,hv.jsxs)(hv.Fragment,{children:[(0,hv.jsx)(OFr,{}),(0,hv.jsx)(Uzr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,hv.jsx)(Wzr,{reconnecting:e.reconnecting}),(0,hv.jsx)(EFr,{}),(0,hv.jsx)(kl,{error:e.error,onClose:e.clearError}),(0,hv.jsx)($Fr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Ix=C(ee(),1);var $Po=6e4;function FPo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function CEe(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4062
4062
|
`),[n,o]=(0,Ix.useState)([]),i=(0,Ix.useRef)(0),a=(0,Ix.useCallback)(()=>{let l=r?r.split(`
|
|
4063
4063
|
`):[];if(l.length===0)return;let u=++i.current;o(d=>FPo(d,l,t));for(let d of l)t_e(d,d===t).then(f=>{u===i.current&&o(p=>p.map(h=>h.name===d?f:h))})},[r,t]);(0,Ix.useEffect)(()=>{a();let l=setInterval(a,$Po);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,Ix.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var K5=C(P(),1);function Vzr({shell:e,children:t}){let{socket:r,selection:n,launch:o,sidebarCollapse:i}=e,a=CEe(r.nodeSelection);return(0,K5.jsx)(Vit.Provider,{value:a,children:(0,K5.jsx)(NLe.Provider,{value:i,children:(0,K5.jsx)(wY.Provider,{value:n,children:(0,K5.jsx)(pLe.Provider,{value:r.nodeSelection,children:(0,K5.jsx)(ic.Provider,{value:n.selectedNode,children:(0,K5.jsx)(AZe.Provider,{value:o,children:(0,K5.jsx)($bt,{children:t})})})})})})})}var qzr=C(P(),1),jzr=nt((0,qzr.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 Yzr=C(ee(),1);var mv=C(P(),1),zPo={ml:1,textTransform:"none",fontSize:12};function Kzr(){let{nodes:e,names:t,visible:r,selected:n,select:o}=Cl(),[i,a]=(0,Yzr.useState)(null);return!r||!e||!n?null:(0,mv.jsxs)(mv.Fragment,{children:[(0,mv.jsx)(ht,{size:"small",color:"inherit",startIcon:(0,mv.jsx)(jzr,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:zPo,children:(0,mv.jsx)(Rne,{nodes:e,name:n})}),(0,mv.jsx)(Rs,{anchorEl:i,open:!!i,onClose:()=>a(null),children:t.map(s=>(0,mv.jsx)(Kr,{selected:s===n,onClick:()=>{o(s),a(null)},sx:{fontSize:13},children:(0,mv.jsx)(Rne,{nodes:e,name:s,showVersion:!0})},s))})]})}var Lne=C(ee(),1);function Xzr(e,t){return[...e[0].slice(0,-1),String(t+1)]}var rD=C(P(),1),UPo=[gi("secondary"),{ml:.75}];function Zzr({index:e,label:t,count:r,...n}){let{chords:o}=fo("navTab");return(0,rD.jsx)(sr,{describeChild:!0,title:(0,rD.jsx)(_d,{label:t,chords:[Xzr(o,e)]}),children:(0,rD.jsx)(Vv,{label:r?(0,rD.jsxs)("span",{children:[t,(0,rD.jsx)(G,{component:"span",sx:UPo,children:r})]}):t,...n})})}var Qzr=C(ee(),1);var HPo=6e4;function Jzr(){let e=G2e();return(0,Qzr.useEffect)(()=>{qs.refresh();let t=setInterval(()=>{qs.refresh()},HPo);return()=>clearInterval(t)},[]),e?.length??0}var Mat=C(ee(),1);function eUr(e,t){let{bound:r}=fo("navTab"),n=e.length,o=(0,Mat.useCallback)(a=>(IY(a,r)??n)<n,[r,n]),i=(0,Mat.useCallback)(a=>{let s=e[IY(a,r)??-1];s&&t(s)},[e,t,r]);Zi(o,i)}var kEe=C(ee(),1);function tUr(){let[e,t]=(0,kEe.useState)(!1);return(0,kEe.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await Jt("/api/news/nav")).json();r||t(o?.showInNav===!0)}catch(n){Ar(n,"news nav"),r||t(!1)}})(),()=>{r=!0}},[]),e}var _Ee=C(ee(),1);async function WPo(e,t){let r=await Jt(tn(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function rUr(e){let[t,r]=(0,_Ee.useState)(null),n=br(),o=`${n??""}\0${e}`;return(0,_Ee.useEffect)(()=>{if(!e)return;let i=!1;return WPo(e,n).catch(a=>{Ar(a,"releases configured")}).then(a=>{i||r({key:o,configured:a})}),()=>{i=!0}},[e,n,o]),t?.key===o?t.configured:void 0}var nUr=C(ee(),1);function oUr(e){let{pathname:t}=mi(),r=an(),n=t==="/releases"||t.startsWith("/releases/");(0,nUr.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var GPo={path:"/sessions",label:"Sessions"},VPo={path:"/backlog",label:"Backlog"},qPo={path:"/next",label:"Next"},jPo={path:"/releases",label:"Releases"},YPo={path:"/news",label:"News"},KPo={path:"/inbox",label:"Inbox"};function iUr(e,t){return[GPo,VPo,qPo,...e?[jPo]:[],...t?[YPo]:[],KPo]}var Nat=C(P(),1),XPo={mx:"6px"};function aUr({cwd:e}){let t=mi(),r=an(),n=rUr(e),o=tUr(),i=Jzr();oUr(n);let a=n===!0,s=(0,Lne.useMemo)(()=>iUr(a,o),[a,o]),l=(0,Lne.useMemo)(()=>s.map(f=>f.path),[s]),u=s.findIndex(f=>t.pathname.startsWith(f.path)),d=(0,Lne.useCallback)(f=>{t.pathname!==f&&r(f)},[t.pathname,r]);return eUr(l,d),(0,Nat.jsx)(gR,{sx:XPo,value:u===-1?!1:u,textColor:"inherit",indicatorColor:"secondary",children:s.map((f,p)=>(0,Nat.jsx)(Zzr,{index:p,label:f.label,count:f.path==="/inbox"?i:void 0,onClick:()=>d(f.path)},f.path))})}var Ine=C(P(),1),sUr=(e,t)=>({bgcolor:e,color:t,"& .MuiSvgIcon-root":{color:t},transition:"filter 0.2s ease, transform 0.2s ease","&:hover":{bgcolor:e,color:t,filter:"brightness(1.08)"},"&:active":{transform:"translateY(1px)"}}),ZPo=e=>({ml:.75,...e.tokens.color.appBar?sUr("primary.main","primary.contrastText"):sUr("primary.contrastText","primary.main")});function lUr(){let[,e]=il(),{label:t,chords:r}=fo("newSession");return(0,Ine.jsx)(sr,{title:(0,Ine.jsx)(_d,{label:t,chords:r}),children:(0,Ine.jsx)(jt,{sx:ZPo,"aria-label":"New session",onClick:()=>e(o=>(o.set("new",""),o),{replace:!0}),children:(0,Ine.jsx)(mp,{})})})}var EEe=C(ee(),1);var Dne=C(P(),1),QPo={strokeWidth:2};function cUr(e){return(0,Dne.jsxs)(BSe,{viewBox:"0 0 24 24",sx:QPo,...e,children:[(0,Dne.jsx)("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 3.5c-.3 1.15-.3 2.35 0 3.5A5.4 5.4 0 0 0 4 10.5c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),(0,Dne.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}var Mne=C(P(),1);function uUr({cwd:e}){let[t,r]=(0,EEe.useState)(null),n=br();return(0,EEe.useEffect)(()=>{if(!e){r(null);return}let o=!1;return(async()=>{try{let a=await(await Jt(tn(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();o||r(a?.url??null)}catch(i){Ar(i,"GitHub URL"),o||r(null)}})(),()=>{o=!0}},[e,n]),t?(0,Mne.jsx)(sr,{title:"Open in GitHub",children:(0,Mne.jsx)(G,{component:"span",sx:$Se,children:(0,Mne.jsx)(jt,{onClick:()=>window.open(t,"_blank"),children:(0,Mne.jsx)(cUr,{})})})}):null}var gv=C(P(),1),JPo={color:"inherit",mr:1.5};function dUr({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:o}=E5("webserver",e);return(0,gv.jsxs)(gv.Fragment,{children:[(0,gv.jsx)(sr,{title:"Restart web server",children:(0,gv.jsx)("span",{children:(0,gv.jsx)(jt,{sx:JPo,disabled:t,onClick:o,children:t?(0,gv.jsx)(Ao,{size:24}):(0,gv.jsx)(nH,{})})})}),(0,gv.jsx)(kl,{error:r,onClose:n})]})}var hUr=C(ee(),1);var fUr=C(ee(),1);function pUr(e){let t=Pn().palette.primary.main;Zi(fo("focusRepoPicker").matches,(0,fUr.useCallback)(()=>Fc({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var Nne=C(P(),1),eAo={width:240,ml:2};function mUr({repos:e,selected:t,onSelect:r}){let n=(0,hUr.useRef)(null);pUr(n);let{chords:o}=fo("focusRepoPicker");return(0,Nne.jsx)(G,{ref:n,sx:eAo,children:(0,Nne.jsx)(MSe,{label:t?Tx(t):"Select repo...",tooltip:(0,Nne.jsx)(_d,{label:"Repo",chords:o}),typeToOpen:!0,children:(i,a)=>(0,Nne.jsx)(SBr,{repos:e,selected:t,onSelect:r,close:i,initialFilter:a})})})}var kUr=C(ee(),1);var One=C(ee(),1);function REe(e){let[t,r]=(0,One.useState)([]),[n,o]=(0,One.useState)(!0),i=br();return(0,One.useEffect)(()=>{if(!e){r([]),o(!1);return}let a=!1;return o(!0),Jt(tn(`/api/pr-list?cwd=${encodeURIComponent(e)}`,i)).then(s=>s.json()).then(s=>{a||(r(Array.isArray(s?.prs)?s.prs:[]),o(!1))}).catch(s=>{Ar(s,"open PRs"),!a&&(r([]),o(!1))}),()=>{a=!0}},[e,i]),{prs:t,loading:n}}var Oat=C(P(),1);function Bat({text:e}){return(0,Oat.jsx)(G,{sx:{p:1.5},children:(0,Oat.jsx)(Ce,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var nD=C(P(),1);function gUr({pr:e,highlighted:t,onHover:r,onPick:n}){let o=O_e(t);return(0,nD.jsx)(Kr,{ref:o,selected:t,onMouseDown:i=>i.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,nD.jsxs)(kt,{spacing:.25,sx:{minWidth:0},children:[(0,nD.jsxs)(Ce,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,nD.jsx)(Vn,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,nD.jsxs)(Ce,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",xo(e.createdAt)]})]})})}var $at=C(P(),1);function yUr({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,$at.jsx)(Jm,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((o,i)=>(0,$at.jsx)(gUr,{pr:o,highlighted:i===t,onHover:()=>r(i),onPick:n},o.number))})}var bUr=C(ee(),1);function vUr(e,t){let r=t.trim().toLowerCase();if(!r)return e;let n=r.replace(/^#/,"");return e.filter(o=>o.title.toLowerCase().includes(r)||o.author.toLowerCase().includes(r)||n!==""&&String(o.number).includes(n))}function xUr(e,t,r){let[n,o]=(0,bUr.useState)(""),i=vUr(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=D5(i,n,t,r);return{filter:n,setFilter:o,filtered:i,highlight:a,setHighlight:s,onKeyDown:l,select:d=>{t(d),r()}}}var X5=C(P(),1),SUr={...kH,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function TUr({cwd:e,onPick:t,close:r}){let{prs:n,loading:o}=REe(e),i=xUr(n,t,r);return o||n.length===0?(0,X5.jsx)(Zr,{elevation:4,sx:SUr,children:(0,X5.jsx)(Bat,{text:o?"Loading open PRs\u2026":"No open PRs"})}):(0,X5.jsxs)(Zr,{elevation:4,sx:SUr,children:[(0,X5.jsx)(yk,{autoFocus:!0,value:i.filter,onChange:i.setFilter,onKeyDown:i.onKeyDown,placeholder:"Filter PRs..."}),i.filtered.length===0?(0,X5.jsx)(Bat,{text:"No PRs match"}):(0,X5.jsx)(yUr,{prs:i.filtered,highlight:i.highlight,onHighlight:i.setHighlight,onPick:i.select})]})}var CUr=C(P(),1);function wUr({cwd:e,onPick:t,close:r}){return(0,CUr.jsx)(TUr,{cwd:e,onPick:t,close:r})}var Z5=C(P(),1);function _Ur({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:o}=REe(e),[i,a]=(0,kUr.useState)(null);return o||n.length===0?null:(0,Z5.jsxs)(Z5.Fragment,{children:[(0,Z5.jsx)(MSe,{label:"prs",disabled:t,children:s=>(0,Z5.jsx)(wUr,{cwd:e,onPick:a,close:s})}),i&&(0,Z5.jsx)(fSe,{pr:i,onSelect:s=>{r(i,s),a(null)},onCancel:()=>a(null)})]})}var RUr=C(P(),1);function EUr({onStartRun:e,cwd:t}){let r=LSe(t);return!t||r.length===0?null:(0,RUr.jsx)(PSe,{runs:r,onSelect:n=>e(n,t)})}var Bne=C(P(),1);function PUr({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=to();return(0,Bne.jsxs)(kt,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:1.5}},children:[(0,Bne.jsx)(_Ur,{cwd:r,disabled:!r,onSelect:(o,i)=>e([...i,String(o.number)],r,{...v4(o),node:n})}),(0,Bne.jsx)(EUr,{onStartRun:(o,i)=>t(o,i,void 0,void 0,n),cwd:r})]})}var Lm=C(P(),1),tAo={minHeight:48,pl:1,pr:14};function AUr({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=Pk();return(0,Lm.jsxs)(hR,{variant:"dense",disableGutters:!0,sx:tAo,children:[r&&(0,Lm.jsx)(sue,{collapsed:r,onToggleCollapsed:n}),(0,Lm.jsx)(dUr,{reconnecting:e.reconnecting}),(0,Lm.jsx)(aUr,{cwd:t.selectedCwd}),(0,Lm.jsx)(Kzr,{}),(0,Lm.jsx)(mUr,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,Lm.jsxs)(G,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,Lm.jsx)(FSe,{cwd:t.selectedCwd}),(0,Lm.jsx)(uUr,{cwd:t.selectedCwd}),(0,Lm.jsx)(lUr,{})]}),(0,Lm.jsx)(PUr,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun})]})}var PEe=C(ee(),1);function LUr(){let[e,t]=(0,PEe.useState)(null);return(0,PEe.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await Jt("/api/health")).json();!r&&typeof o?.nodeName=="string"&&t(o.nodeName)}catch(n){Ar(n,"node name")}})(),()=>{r=!0}},[]),e}var DUr=C(P(),1),rAo={lineHeight:"32px",bgcolor:"transparent"};function IUr(){let e=LUr();return e?(0,DUr.jsx)(D3e,{sx:rAo,children:e}):null}var MUr=C(P(),1),NUr=nt((0,MUr.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 OUr=C(P(),1),BUr=nt((0,OUr.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 $Ur=C(P(),1),FUr=nt((0,$Ur.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 zUr=C(P(),1),UUr=nt((0,zUr.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 Fat=C(P(),1);function HUr({mode:e}){return e==="dark"?(0,Fat.jsx)(UUr,{fontSize:"small"}):(0,Fat.jsx)(FUr,{fontSize:"small"})}var WUr=C(P(),1),GUr=nt((0,WUr.jsx)("path",{d:"M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1m-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m4.5-4H7V4h9z"}),"PhoneIphone");var HG=C(P(),1);function VUr({onClose:e}){let t=an();return(0,HG.jsxs)(Kr,{onClick:()=>{e(),t("/connect-mobile")},children:[(0,HG.jsx)(Gv,{children:(0,HG.jsx)(GUr,{fontSize:"small"})}),(0,HG.jsx)(op,{children:"Connect mobile"})]})}var qUr=C(P(),1),jUr=nt((0,qUr.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 WG=C(P(),1);function YUr(){let e=xSe();return(0,WG.jsxs)(Kr,{onClick:()=>L3t(!e),children:[(0,WG.jsx)(Gv,{children:(0,WG.jsx)(jUr,{fontSize:"small"})}),(0,WG.jsx)(op,{children:e?"Hide render HUD":"Show render HUD"})]})}var hl=C(P(),1);function KUr({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onShowShortcuts:o,onConnectMobile:i,onRestart:a,onUpdate:s}){return[(0,hl.jsxs)(Kr,{onClick:n,children:[(0,hl.jsx)(Gv,{children:(0,hl.jsx)(HUr,{mode:e})}),(0,hl.jsx)(op,{children:"Toggle dark mode"})]},"color-mode"),(0,hl.jsx)(YUr,{},"render-hud"),(0,hl.jsxs)(Kr,{onClick:o,children:[(0,hl.jsx)(Gv,{children:(0,hl.jsx)(NUr,{fontSize:"small"})}),(0,hl.jsx)(op,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,hl.jsx)(VUr,{onClose:i},"connect-mobile"),(0,hl.jsx)(eo,{},"restart-divider"),(0,hl.jsxs)(Kr,{onClick:a,children:[(0,hl.jsx)(Gv,{children:(0,hl.jsx)(k8,{fontSize:"small"})}),(0,hl.jsx)(op,{children:t})]},"restart"),(0,hl.jsxs)(Kr,{onClick:s,children:[(0,hl.jsx)(Gv,{children:(0,hl.jsx)(BUr,{fontSize:"small"})}),(0,hl.jsx)(op,{children:r})]},"update")]}var XUr=C(ee(),1);var QUr=C(P(),1);function ZUr({peer:e,onRestart:t,onClose:r}){let[n,o]=(0,XUr.useState)(!1);return(0,QUr.jsx)(Ho,{title:`Restart ${e}?`,message:`Restarts the sessions daemon and web server on ${e}. Its sessions resume when the daemon is back. This page stays open.`,confirmLabel:"Restart",busy:n,autoFocusConfirm:!0,onConfirm:()=>{o(!0),t(e).finally(r)},onCancel:r})}function JUr(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 nAo=Object.keys(v8);function eHr(){let e=b8();return JUr(nAo.map(t=>Tk(t,e)))}var Im=C(P(),1),oAo={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},iAo={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function tHr({onClose:e}){let t=eHr();return(0,Im.jsxs)(vl,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,Im.jsxs)(vd,{id:"shortcuts-dialog-title",sx:oAo,children:["Keyboard shortcuts",(0,Im.jsx)(jt,{size:"small","aria-label":"Close",onClick:e,children:(0,Im.jsx)(Uo,{fontSize:"small"})})]}),(0,Im.jsx)(yd,{dividers:!0,children:t.map(r=>(0,Im.jsxs)(G,{component:"section",sx:{mb:1.5},children:[(0,Im.jsx)(Ce,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,Im.jsxs)(G,{sx:iAo,children:[(0,Im.jsx)(Ce,{variant:"body2",children:n.label}),(0,Im.jsx)(kt,{direction:"row",spacing:.5,children:(0,Im.jsx)(Fce,{chords:n.chords})})]},n.label))]},r.name))})]})}var oD=C(P(),1);function rHr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:o,restart:i}=E5(iG.target,e);return(0,oD.jsxs)(oD.Fragment,{children:[(0,oD.jsx)(Ho,{title:iG.label,message:iG.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{i()},onCancel:t}),(0,oD.jsx)(kl,{error:n,onClose:o})]})}var oHr=C(P(),1);function aAo(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 nHr({peer:e,onConfirm:t,onClose:r}){return(0,oHr.jsx)(Ho,{...aAo(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var yv=C(ee(),1);async function sAo(e){try{let t=await Jt(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch(t){return Ar(t,"node doctor"),null}}async function iHr(e,t){let r=await sAo(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var Ww=C(ee(),1);function aHr(e){let{nodes:t}=Cl(),[r,n]=(0,Ww.useState)(null),o=(0,Ww.useRef)(!1),i=r?t?.links.find(l=>l.name===r.peer):void 0;(0,Ww.useEffect)(()=>{if(!(!r||!i)){if(i.state!=="connected"){o.current=!0;return}o.current&&(n(null),e(r.describe(r.peer,i.peerVersion)))}},[r,i,e]);let a=(0,Ww.useCallback)((l,u)=>{o.current=!1,n({peer:l,describe:u})},[]),s=(0,Ww.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var lAo=9e4;function AEe(){let[e,t]=(0,yv.useState)(null),[r,n]=(0,yv.useState)(null),o=(0,yv.useRef)(void 0),i=(0,yv.useCallback)(d=>{clearTimeout(o.current),t(d)},[]),{watch:a,stop:s}=aHr(i);(0,yv.useEffect)(()=>()=>clearTimeout(o.current),[]);let l=(0,yv.useCallback)(async(d,f)=>{n(await iHr(d,f))},[]);return{requestThenAwait:(0,yv.useCallback)(async(d,f,p,h)=>{let m;try{m=await p()}catch(g){Ar(g,`${f} ${d}`)}return m?.ok?(a(d,h),clearTimeout(o.current),o.current=setTimeout(()=>{s(),l(d,`${d} did not come back`)},lAo),!0):(await l(d,`${f} failed (${await k5(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var cAo=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function sHr(){let{requestThenAwait:e,...t}=AEe();return{restart:n=>e(n,`Restart ${n}`,()=>_5("both",n),cAo),...t}}var $ne=C(ee(),1);function LEe(e){return Jt(tn("/api/self-update",e),{method:"POST",timeoutMs:66e4})}var vv=C(ee(),1);function lHr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function IEe(e,t,r){let[n,o]=(0,vv.useState)(!1),[i,a]=(0,vv.useState)(!1),s=(0,vv.useRef)(!1),l=(0,vv.useRef)(e);l.current=e;let u=(0,vv.useRef)(new Set),d=(0,vv.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(lHr).map(f=>f.id)),o(!0)},[]);return(0,vv.useEffect)(()=>{if(!n||i)return;if(t){s.current=!0;return}if(!s.current)return;e.some(p=>lHr(p)&&p.node===r&&!u.current.has(p.id))&&a(!0)},[n,i,t,e,r]),{arm:d,completed:i}}var cHr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function uHr(e){let{nodes:t}=Cl(),{launchAssist:r}=ql(),{requestThenAwait:n,...o}=AEe(),[i,a]=(0,$ne.useState)(null),[s,l]=(0,$ne.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:d,completed:f}=IEe(e,u(s)!=="connected",s);(0,$ne.useEffect)(()=>{!f||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>_5("webserver",s),cHr))},[f,s,n]);let p=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>LEe(m),cHr),a(null)};return{update:m=>{if(u(m)!=="connected"){p(m);return}l(m),d(),r(["update"],void 0,{node:m})},progress:i,...o}}var bv=C(P(),1);function dHr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:o}){let{launchAssist:i,armUpdateReload:a}=ql(),s=sHr(),l=uHr(r);return(0,bv.jsxs)(bv.Fragment,{children:[e==="shortcuts"&&(0,bv.jsx)(tHr,{onClose:o}),e==="restart"&&t&&(0,bv.jsx)(ZUr,{peer:t,onRestart:s.restart,onClose:o}),e==="restart"&&!t&&(0,bv.jsx)(rHr,{reconnecting:n,onClose:o}),e==="update"&&(0,bv.jsx)(nHr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),i(["update"])},onClose:o}),(0,bv.jsx)(jre,{notices:s}),(0,bv.jsx)(jre,{notices:l})]})}var fHr=C(P(),1),pHr=nt((0,fHr.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");var DEe=C(P(),1),uAo="https://staffordwilliams.com/assist";function hHr(){return(0,DEe.jsx)(sr,{title:"Help",children:(0,DEe.jsx)(jt,{component:"a",href:uAo,target:"_blank",rel:"noopener noreferrer","aria-label":"Help",size:"small",sx:{color:"inherit"},children:(0,DEe.jsx)(pHr,{fontSize:"small"})})})}var mHr=C(P(),1),gHr=nt((0,mHr.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 yHr=C(ee(),1);var Fne=C(P(),1);function vHr(){let e=an(),t=(0,yHr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=fo("openConfig");return Zi(r,t),(0,Fne.jsx)(sr,{describeChild:!0,title:(0,Fne.jsx)(_d,{label:"Config",chords:n}),children:(0,Fne.jsx)(jt,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,Fne.jsx)(gHr,{fontSize:"small"})})})}var bHr=C(P(),1),xHr=nt((0,bHr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var MEe=C(ee(),1);var zne=C(P(),1);function SHr({open:e,onOpen:t}){let r=(0,MEe.useRef)(null),{matches:n,chords:o}=fo("openMenu");return Zi(n,(0,MEe.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,zne.jsx)(sr,{describeChild:!0,title:(0,zne.jsx)(_d,{label:"Menu",chords:o}),children:(0,zne.jsx)(jt,{ref:r,onClick:i=>t(i.currentTarget),size:"small",sx:{color:"inherit"},"aria-label":"Open menu","aria-haspopup":"true","aria-expanded":e?"true":void 0,children:(0,zne.jsx)(xHr,{fontSize:"small"})})})}var GG=C(P(),1);function THr({open:e,onOpen:t}){return(0,GG.jsxs)(G,{sx:{position:"fixed",top:8,right:16,zIndex:r=>r.zIndex.drawer+2,display:"flex",alignItems:"center",gap:.5,color:r=>r.tokens.color.appBar?.text??r.palette.primary.contrastText},children:[(0,GG.jsx)(hHr,{}),(0,GG.jsx)(vHr,{}),(0,GG.jsx)(SHr,{open:e,onOpen:t})]})}var iD=C(ee(),1);var CHr=C(ee(),1);var wHr=!0,dAo=new Set(["openMenu","cycleCards"]),fAo=Object.keys(v8).filter(e=>!dAo.has(e));function kHr(e,t){let r=b8();(0,CHr.useEffect)(()=>{if(!e)return;let n=o=>{fAo.some(i=>Tk(i,r).matches(o))&&t()};return globalThis.addEventListener("keydown",n,wHr),()=>globalThis.removeEventListener("keydown",n,wHr)},[e,t,r])}function _Hr(){let[e,t]=(0,iD.useState)(null),[r,n]=(0,iD.useState)(!0),o=!!e,i=(0,iD.useCallback)(()=>t(null),[]),a=(0,iD.useCallback)(s=>{n(!0),t(s)},[]);return kHr(o,(0,iD.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:o,close:i,openAt:a,restoreFocus:r}}var Une=C(ee(),1);function EHr(e){Zi(fo("shortcutsSheet").matches,e)}function RHr(){let[e,t]=(0,Une.useState)(null);EHr((0,Une.useCallback)(()=>t("shortcuts"),[]));let r=(0,Une.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function PHr(){let{nodes:e,selected:t}=Cl();return e&&t&&t!==e.local?t:void 0}function AHr(e){return{restartLabel:e?`Restart ${e}`:iG.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}var Gw=C(P(),1);function LHr({mode:e,toggle:t,sessions:r,reconnecting:n}){let{anchorEl:o,open:i,close:a,openAt:s,restoreFocus:l}=_Hr(),{dialog:u,showDialog:d,closeDialog:f}=RHr(),p=PHr(),h=m=>()=>{a(),d(m)};return(0,Gw.jsxs)(Gw.Fragment,{children:[(0,Gw.jsx)(THr,{open:i,onOpen:s}),(0,Gw.jsxs)(Rs,{anchorEl:o,open:i,onClose:a,disableRestoreFocus:!l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,Gw.jsx)(IUr,{}),KUr({mode:e,...AHr(p),onToggleColorMode:()=>{t(),a()},onShowShortcuts:h("shortcuts"),onConnectMobile:a,onRestart:h("restart"),onUpdate:h("update")})]}),(0,Gw.jsx)(dHr,{dialog:u,peer:p,sessions:r,reconnecting:n,onClose:f})]})}var MHr=C(ee(),1);var DHr=C(P(),1);function IHr({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:o,port:i,group:a}=e.existing,s=Qa(o),l=i?` on port ${i}`:"",u=s?` in ${s}`:"",d=a?`, holding the ${a} server slot`:"";return(0,DHr.jsx)(Ho,{title:a?`Replace the ${a} server?`:"Replace running server?",message:`"${n}" is already serving${l}${u}${d}. Replace it \u2014 stop the running server and start this one?`,confirmLabel:"Replace",confirmColor:"error",onConfirm:t,onCancel:r})}var NEe=C(P(),1);function NHr({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:o,stopSession:i,startRun:a,discardSession:s}=e,l=(0,MHr.useMemo)(()=>({onStop:i,onStart:a,onDiscard:s}),[i,a,s]),u=()=>{r&&(r.runName?a(r.runName,r.cwd,!0,r.launchedFrom,r.node):r.sessionId&&o(r.sessionId,!0),n())};return(0,NEe.jsxs)(ELe.Provider,{value:l,children:[t,r&&(0,NEe.jsx)(IHr,{conflict:r,onConfirm:u,onCancel:n})]})}var OHr=new Map;function BHr(e,t){if(!jde())return;let r=OHr.get(e);if(OHr.set(e,t),!!r)for(let[n,o]of Object.entries(t))Object.is(o,r[n])||g1(`\u0394 ${e}.${n}`)}var BEe=C(ee(),1);function $Hr(e,t,r){if(!t)return null;let n=e[t];if(!n)return null;let o=r.find(i=>i.id===n);return!o||wl(o)!==t?null:n}function Dx(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function OEe(){let{pathname:e}=mi();return e.startsWith("/backlog")||e.startsWith("/usage")}function FHr({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:o,onSelect:i}){let a=Dx(t,r,n),s=a&&wl(a),l=!!(s&&s===e),u=$Hr(o,e,r),d=(0,BEe.useRef)(t),f=OEe();(0,BEe.useEffect)(()=>{let p=d.current!==t&&!!s;d.current=t,!(f||p||l||!u)&&i(u)},[t,s,l,u,i,f])}var zEe=C(ee(),1);function zHr(e,t,r,n){return Dx(e,t,r)?.cwd||n}function UHr(e,t,r,n){let o=zHr(e,t,r,n.cwd),i=Dx(e,t,r);return{cwd:o,node:i?.cwd?i.node:n.node}}var zat=C(ee(),1);function HHr(e,t,r){let{cwd:n,node:o,origin:i}=r,a=(0,zat.useCallback)((l,u)=>{let d=sh(u,t),f=bne(e,l);return f?f.clones[d]:d===(l===n?o:Zf)?l:void 0},[e,t,n,o]),s=(0,zat.useCallback)(l=>bne(e,l)?.origin??(l===n?i:void 0),[e,n,i]);return{cloneOn:a,originOf:s}}var $Ee=C(ee(),1);function WHr(e,t,r,n){let o=(0,$Ee.useRef)(e);(0,$Ee.useEffect)(()=>{if(o.current===e)return;o.current=e;let i=bne(t,r)?.clones[e];i&&n(i,e)},[e,t,r,n])}var VG=C(ee(),1);function GHr(e,t,r){if(t.node!==void 0)return t.node;let n=new Set(e.flatMap(o=>Object.entries(o.clones).filter(([,i])=>i===t.cwd).map(([i])=>i)));return n.has(r)?r:n.size===0||n.has(Zf)?Zf:[...n][0]}function VHr(e,t,r,n){let[o,i]=(0,VG.useState)({cwd:e}),a=(0,VG.useCallback)((l,u,d)=>i({cwd:l,node:u,origin:d}),[]);(0,VG.useEffect)(()=>{e&&!o.cwd&&i({cwd:e})},[e,o.cwd]);let s=GHr(t,{cwd:o.cwd,node:o.node===void 0?void 0:sh(o.node,n)},r);return{selectedCwd:o.cwd,selectedNode:s||void 0,selectedPick:{cwd:o.cwd,node:s,origin:o.origin},setSelectedCwd:a}}var qHr=C(ee(),1);function FEe(e,t,r){let n=Dx(e,t,r);return n&&wl(n)}function jHr(e,t,r,n){let o=FEe(e,t,r),i=Dx(e,t,r),a=i?.node??Zf,s=i?.repoGroup?.origin;(0,qHr.useEffect)(()=>{o&&n(o,a,s)},[o,a,s,n])}function YHr(e,t,r,n,o){let i=o.nodes?.local,a=sh(o.selected,i),s=(0,zEe.useMemo)(()=>N5(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:d,setSelectedCwd:f}=VHr(e,s,a,i);jHr(r,n,t,f),WHr(a,s,l,f);let{cloneOn:p,originOf:h}=HHr(s,i,d),m=(0,zEe.useMemo)(()=>s.map(v=>r9r(v,a)),[s,a]),{cwd:g,node:y}=UHr(r,n,t,{cwd:l,node:u});return(0,zEe.useMemo)(()=>({repos:m,selectedCwd:l,selectedNode:u,worktreeCwd:g,worktreeNode:y,setSelectedCwd:f,cloneOn:p,originOf:h}),[m,l,u,g,y,f,p,h])}var HEe=C(ee(),1);var Q5=C(ee(),1);var KHr=C(ee(),1),UEe="assist:reloaded-after-update";function XHr(e){(0,KHr.useEffect)(()=>{globalThis.sessionStorage?.getItem(UEe)&&(globalThis.sessionStorage.removeItem(UEe),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function ZHr(e,t,r,n){let{arm:o,completed:i}=IEe(e,t),a=(0,Q5.useRef)(!1),s=(0,Q5.useCallback)(()=>{globalThis.sessionStorage?.setItem(UEe,"1")},[]),{error:l,restart:u}=E5("webserver",t,s);return XHr(r),(0,Q5.useEffect)(()=>{l&&n(l)},[l,n]),(0,Q5.useEffect)(()=>{!i||a.current||(a.current=!0,u())},[i,u]),{armUpdateReload:(0,Q5.useCallback)(()=>{a.current=!1,o()},[o])}}function QHr(e){let{armUpdateReload:t}=ZHr(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=l1(e.selectSession),n=(0,HEe.useMemo)(()=>({launchAssist:e.createAssistSession,launchAgentInStream:e.createSessionInStream,resumeSession:e.resumeSession,armUpdateReload:t,activateSession:r,sendInput:e.sendInput}),[e.createAssistSession,e.createSessionInStream,e.resumeSession,t,r,e.sendInput]),o=an(),i=(0,HEe.useCallback)(a=>{e.selectSession(a),o("/sessions"),e.clearSuccess()},[o,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:i}}var JHr=C(ee(),1);function eWr(e,t,r,n){let o=FEe(e,t,r);(0,JHr.useEffect)(()=>{e&&o&&n({type:"set-active",cwd:o,sessionId:e})},[e,o,n])}var WEe=C(ee(),1);function tWr(e,t){let r=(0,WEe.useRef)(new Map);(0,WEe.useEffect)(()=>{let n=new Set;for(let{id:o,status:i}of e)n.add(o),r.current.get(o)!==i&&(r.current.set(o,i),console.debug(`[sessions] render session ${o} status=${i}`),t({type:"ui-status",sessionId:o,status:i}));for(let o of r.current.keys())n.has(o)||r.current.delete(o)},[e,t])}var qG=C(ee(),1),rWr="assist.sessions.node";function pAo(){try{return localStorage.getItem(rWr)}catch{return null}}function hAo(e){try{localStorage.setItem(rWr,e)}catch{}}function nWr(e){let[t,r]=(0,qG.useState)(pAo),n=(0,qG.useCallback)(o=>{r(o),hAo(o)},[]);return(0,qG.useMemo)(()=>{let o=e?[e.local,...e.links.map(i=>i.name)]:[];return{nodes:e,names:o,visible:o.length>1,selected:t&&o.includes(t)?t:e?.local,select:n}},[e,t,n])}var iWr=C(ee(),1);function oWr(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 aWr(e,t){return(0,iWr.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let o=oWr(r);o&&t(o)},[e,t])}var P0=C(ee(),1);function GEe(e,t,r,n,o){e({type:"create",prompt:r||void 0,cwd:n,...t,...o?{node:o}:{}})}function sWr(e){return(t,r,n)=>GEe(e,{design:!0},t,r,n)}function lWr(e){return(t,r,n,o)=>GEe(e,{harness:t},r,n,o)}function cWr(e){return(t,r,n)=>GEe(e,{auto:!0},t,r,n)}function uWr(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function dWr(e){return(t,r,n,o,i)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:o,node:i})}function fWr(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function pWr(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function hWr(e,t){return(r,n)=>{e({type:"dismiss",sessionId:r,...n}),t.delete(r)}}function mWr(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function gWr(e){return t=>e({type:"stop",sessionId:t})}function yWr(e){return(t,r,n)=>e({type:"transfer",sessionId:t,target:r,cwd:n})}function vWr(e){return t=>e({type:"cancel-transfer",sessionId:t})}function bWr(e){return(t,r,n,o,i)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:o,node:i})}function xWr(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function SWr(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function TWr(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function wWr(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:RI})}function CWr(e){return(t,r,n,o)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:RI,claim:o==="claim",refresh:o==="refresh"})}function kWr(e){return(t,r,n,o)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...o})}var aD=C(ee(),1);function _Wr(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function EWr(e){return{createSession:(0,aD.useMemo)(()=>cWr(e),[e]),createSessionInStream:(0,aD.useMemo)(()=>_Wr(e),[e]),createDesignSession:(0,aD.useMemo)(()=>sWr(e),[e]),createHarnessSession:(0,aD.useMemo)(()=>lWr(e),[e]),createAssistSession:(0,aD.useMemo)(()=>uWr(e),[e]),resumeSession:(0,aD.useMemo)(()=>dWr(e),[e])}}var Hne=C(ee(),1);function RWr(e,t){let r=(0,Hne.useCallback)((a,s)=>{fWr(e,t.current)(a,s)},[e,t]),n=(0,Hne.useCallback)(a=>{pWr(e,t.current)(a)},[e,t]),o=(0,Hne.useCallback)((a,s)=>{hWr(e,t.current)(a,s)},[e,t]),i=(0,Hne.useCallback)(a=>{mWr(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:o,discardSession:i}}function PWr(e,t,r){return(n,o)=>{let i=t.get(n);return i&&(o(i),e({type:"snapshot",sessionId:n})),r.set(n,o),()=>r.delete(n)}}function AWr(e,t,r){let n={...EWr(e),sendInput:(0,P0.useMemo)(()=>wWr(e),[e]),sendResize:(0,P0.useMemo)(()=>CWr(e),[e]),sendPrDecision:(0,P0.useMemo)(()=>kWr(e),[e]),setAutoApprove:(0,P0.useMemo)(()=>xWr(e),[e]),setAutoAdvance:(0,P0.useMemo)(()=>SWr(e),[e]),setStarred:(0,P0.useMemo)(()=>TWr(e),[e]),stopSession:(0,P0.useMemo)(()=>gWr(e),[e]),startRun:(0,P0.useMemo)(()=>bWr(e),[e]),transferSession:(0,P0.useMemo)(()=>yWr(e),[e]),cancelTransfer:(0,P0.useMemo)(()=>vWr(e),[e])},o=(0,P0.useMemo)(()=>PWr(e,t.current,r.current),[e,t,r]);return{...n,...RWr(e,t),onOutput:o}}var Wne=C(ee(),1);function LWr(e,t,r){let n=(0,Wne.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),o=(0,Wne.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),i=(0,Wne.useCallback)(()=>{r(null)},[r]),a=(0,Wne.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:o,clearTranscript:i,selectSession:a}}var YEe=C(ee(),1);function IWr(e,t){let r=new Set(t.map(o=>o.id)),n=null;for(let o of Object.values(e))r.has(o)&&(n=o);return n}var jG=C(ee(),1);function DWr(){let[e,t]=(0,jG.useState)(null),r=(0,jG.useRef)(e);r.current=e;let n=(0,jG.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var NWr=C(ee(),1);function MWr(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 OWr(e,t,r){let n=OEe();(0,NWr.useEffect)(()=>{if(n){t(null);return}t(o=>MWr(e,o,r))},[e,t,r,n])}var VEe=C(ee(),1);function BWr(){let[e,t]=(0,VEe.useState)({}),[r,n]=(0,VEe.useState)(null),[o,i]=(0,VEe.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:o,setNodes:i}}var xv=C(ee(),1);function $Wr(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function FWr(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function zWr(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 UWr(e,t){let r=[];for(let n of t){let o=e.get(n.id);o!==void 0&&o!==n.startedAt&&r.push(n.id)}return r}function HWr(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var mAo=1500;function WWr(){let[e,t]=(0,xv.useState)(new Set),r=(0,xv.useRef)(new Map),n=(0,xv.useRef)(new Map),o=(0,xv.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),i=(0,xv.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),o(u)},mAo))},[o]);(0,xv.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,xv.useCallback)(s=>{let l=FWr(r.current,s),u=[...UWr(r.current,s),...l],d=HWr(r.current,s);r.current=new Map(s.map(f=>[f.id,f.startedAt])),$Wr(n.current,l),u.length&&t(f=>zWr(f,u)),i(d)},[i]);return{initialized:e,markInitialized:o,syncSessions:a}}var J5=C(ee(),1);function GWr(){let[e,t]=(0,J5.useState)(null),[r,n]=(0,J5.useState)(null),[o,i]=(0,J5.useState)(null),a=(0,J5.useCallback)(()=>t(null),[]),s=(0,J5.useCallback)(()=>n(null),[]),l=(0,J5.useCallback)(()=>i(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:o,setServerConflict:i,clearServerConflict:l}}var Mx=C(ee(),1);function VWr(e,t){return[...e,{...t,status:"launching"}]}function qEe(e){return e.find(t=>t.status==="launching")}function qWr(e){let t=qEe(e);return t?e.filter(r=>r.id!==t.id):e}function jWr(e,t){let r=qEe(e);return r?Uat(e,r.id,t):e}function Uat(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function YWr(e,t){return e.filter(r=>r.id!==t)}var KWr=C(ee(),1);var gAo=6e4,yAo="Launch timed out \u2014 the session did not start.";function XWr(e,t){(0,KWr.useEffect)(()=>{let r=e.filter(o=>o.status==="launching");if(r.length===0)return;let n=r.map(o=>setTimeout(()=>t(i=>Uat(i,o.id,yAo)),Math.max(0,gAo-(Date.now()-o.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function ZWr(){let[e,t]=(0,Mx.useState)([]),r=(0,Mx.useRef)([]),n=(0,Mx.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),o=(0,Mx.useCallback)(l=>{n(u=>VWr(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),i=(0,Mx.useCallback)(()=>{let l=qEe(r.current);return n(qWr),l?.named?l.title:void 0},[n]),a=(0,Mx.useCallback)(l=>n(u=>jWr(u,l)),[n]),s=(0,Mx.useCallback)(l=>n(u=>YWr(u,l)),[n]);return XWr(e,n),{pendingLaunches:e,addPendingLaunch:o,resolvePendingLaunch:i,failPendingLaunch:a,dismissPendingLaunch:s}}var Gne=C(ee(),1);function QWr(){let[e,t]=(0,Gne.useState)(null),[r,n]=(0,Gne.useState)({}),o=(0,Gne.useCallback)((i,a)=>{i!=="claude"&&n(s=>({...s,[i]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:o}}var JWr=C(ee(),1);function eGr(e,t){return(0,JWr.useCallback)(r=>{e(r),t(r)},[e,t])}var Hat=C(ee(),1);function tGr(){let e=(0,Hat.useRef)(new Map),t=(0,Hat.useRef)(new Map);return{buffers:e,handlers:t}}var jEe=C(ee(),1);function rGr(){let[e,t]=(0,jEe.useState)(null),[r,n]=(0,jEe.useState)(null),[o,i]=(0,jEe.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:o,setUserMessages:i}}var e3=C(ee(),1);function nGr(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function oGr(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 iGr(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function aGr(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function sGr(e,t){t.setNodes({local:e.local,links:e.links??[]})}function lGr(e,t){t.setSuccess({message:e.message,sessionId:null})}function cGr(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 uGr(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function dGr(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function fGr(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var vAo={sessions:dGr,created:oGr,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:sGr,error:iGr,notice:lGr,inbox:()=>{qs.refresh(),qs.refreshStatus()},"inbox-activity":()=>{qs.refreshStatus()},"run-conflict":uGr,limits:aGr,clear:nGr,output:cGr,snapshot:fGr};function pGr(e,t){vAo[e.type]?.(e,t)}function hGr(e,t={}){let r=new WebSocket(ixt("/ws"));return r.onopen=()=>{t.onOpen?.(),r.send(JSON.stringify({type:"hello"})),r.send(JSON.stringify({type:"history"}))},r.onmessage=n=>{pGr(JSON.parse(n.data),e)},r.onclose=()=>t.onClose?.(),r}function mGr(e,t,r,n){let o=!1,i,a=0,s=!1,l=()=>{o||t(hGr(e,{onOpen:()=>{s&&r(),s=!1,n(!1),a=0},onClose:()=>{if(o)return;s=!0,n(!0);let u=Math.min(300*2**a,2e3);a+=1,i=setTimeout(l,u)}}))};return l(),()=>{o=!0,i&&clearTimeout(i)}}function gGr(e){let t=(0,e3.useRef)(null),[r,n]=(0,e3.useState)(!1),{handleSessions:o,markInitialized:i,buffers:a,handlers:s}=e;(0,e3.useEffect)(()=>{let u=()=>{a.current?.clear();let f=s.current;if(f)for(let p of f.values())p("\x1Bc")},d=mGr({...e,setSessions:o},f=>{t.current=f},u,n);return()=>{d(),t.current?.close()}},[o,i,a,s]);let l=(0,e3.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function yGr(){let[e,t]=(0,YEe.useState)([]),[r,n]=(0,YEe.useState)([]),{activeId:o,setActiveId:i,getActiveId:a}=DWr(),s=BWr(),l=rGr(),[u,d]=(0,YEe.useState)(""),f=GWr(),p=ZWr(),h=QWr(),{initialized:m,markInitialized:g,syncSessions:y}=WWr(),v=tGr(),b=eGr(y,t),{wsRef:x,requestHistory:T,reconnecting:w}=gGr({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:i,...s,...l,setCurrentCwd:d,...f,...p,...h,markInitialized:g,...v});return OWr(e,i,IWr(s.activeByRepo,e)),{sessions:e,history:r,activeId:o,setActiveId:i,...s,...l,currentCwd:u,...f,...p,...h,initialized:m,wsRef:x,...v,requestHistory:T,reconnecting:w}}function KEe(){let e=yGr(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:o,activeId:i,sessions:a}=e,s=nWr(e.nodes),l=aWr(t,o),u=AWr(l,r,n);eWr(i,a,e.history,l),tWr(a,l);let d=LWr(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...d,nodeSelection:s}}var YG=C(ee(),1);var vGr="assist:sidebar-collapsed";function bGr(){let[e,t]=(0,YG.useState)(()=>Vl(vGr).length>0),r=(0,YG.useCallback)(()=>{t(n=>{let o=!n;return iu(vGr,o?[!0]:[]),o})},[]);return(0,YG.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var xGr=C(ee(),1);function SGr(){(0,xGr.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await Jt("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||jR.set(r)}catch(t){Ar(t,"hotkey bindings")}})(),()=>{e=!0}},[])}function TGr(){let e=KEe(),t=w2e(e),r=YHr(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);FHr({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:o}=QHr(e);SGr();let i=bGr();return BHr("shell",{...e,selection:r,launch:n,sidebarCollapse:i}),{socket:e,selection:r,launch:n,viewLaunchedSession:o,sidebarCollapse:i}}var Dm=C(P(),1),bAo={zIndex:e=>e.zIndex.drawer+1},xAo={minHeight:48};function CGr({mode:e,toggle:t}){let r=TGr(),{socket:n,selection:o,viewLaunchedSession:i}=r,{nodes:a,transferSession:s,cancelTransfer:l}=n,u=(0,wGr.useMemo)(()=>({nodes:a,transfer:s,cancel:l}),[a,s,l]);return(0,Dm.jsx)(Vzr,{shell:r,children:(0,Dm.jsxs)(_at.Provider,{value:n.daemonVersion,children:[(0,Dm.jsx)(LHr,{mode:e,toggle:t,sessions:n.sessions,reconnecting:n.reconnecting}),(0,Dm.jsx)(y3e,{position:"fixed",sx:bAo,"data-testid":"toolbar",children:(0,Dm.jsx)(AUr,{socket:n,selection:o})}),(0,Dm.jsx)(hR,{variant:"dense",sx:xAo}),(0,Dm.jsx)(Y6e.Provider,{value:u,children:(0,Dm.jsx)(NHr,{socket:n,children:(0,Dm.jsx)(M$r,{socket:n})})}),(0,Dm.jsx)(kFr,{socket:n}),(0,Dm.jsx)(Gzr,{socket:n,onViewLaunchedSession:i})]})})}function EGr(e){return e instanceof Error?e.message:String(e)}function SAo(e){return e.filename?` (${e.filename}:${e.lineno}:${e.colno})`:""}function kGr(e){bY(e.error)||(HR(e.error),xY("error",`${e.message||EGr(e.error)}${SAo(e)}`))}function _Gr(e){bY(e.reason)||(HR(e.reason),xY("rejection",EGr(e.reason)))}function RGr(){return globalThis.addEventListener("error",kGr),globalThis.addEventListener("unhandledrejection",_Gr),()=>{globalThis.removeEventListener("error",kGr),globalThis.removeEventListener("unhandledrejection",_Gr)}}var PGr=C(ee(),1);function AGr(){let[e,t]=(0,PGr.useState)(()=>{try{return localStorage.getItem("theme-mode")??"dark"}catch{return"dark"}});return{mode:e,toggle:()=>t(n=>{let o=n==="dark"?"light":"dark";try{localStorage.setItem("theme-mode",o)}catch{}return o})}}function LGr({color:e,radius:t}){return{MuiMenu:{styleOverrides:{paper:{borderRadius:t.md},list:{padding:4}}},MuiMenuItem:{styleOverrides:{root:{minHeight:30,padding:"5px 10px",borderRadius:4,fontSize:13,"&:hover":{backgroundColor:e.raised},"& .MuiListItemIcon-root":{minWidth:28},"& .MuiSvgIcon-root":{fontSize:16},"& .MuiListItemText-primary":{fontSize:13}}}}}}function IGr(e){let{color:t,radius:r,elevation:n,type:o}=e,i={border:`1px solid ${t.line}`};return{...LGr(e),MuiTooltip:{styleOverrides:{tooltip:{...i,backgroundColor:t.overlay.background,color:t.overlay.text,borderRadius:r.md,boxShadow:n.overlay,fontSize:`${o.scale.caption/16}rem`,padding:"6px 10px"},arrow:{color:t.overlay.background}}},MuiPopover:{styleOverrides:{paper:{...i,boxShadow:n.overlay}}},MuiBackdrop:{styleOverrides:{root:{"&:not(.MuiBackdrop-invisible)":{backgroundColor:t.scrim,backdropFilter:"blur(2px)"}}}},MuiDialog:{styleOverrides:{paper:{...i,backgroundColor:t.surface,borderRadius:r.md+4,boxShadow:n.dialog}}}}}var DGr=({variant:e})=>e==="outlined"||e==="tonal",MGr=[{props:{size:"small"},style:{minHeight:26,padding:"4px 9px",fontSize:12}},{props:DGr,style:{padding:"5px 11px"}},{props:e=>DGr(e)&&e.size==="small",style:{padding:"3px 8px"}}];var XEe=["primary","secondary","success","warning","error","info","check"];function Vne(e,t){return{backgroundColor:Hr(e,t),borderColor:Hr(e,.35),color:e}}function NGr({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}}},...XEe.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...Vne(e[t].main,.16),"&:hover":Vne(e[t].main,.24)}}))]}var OGr={"& > *:nth-of-type(1)":{fontSize:16}};function BGr(e){let{color:t,radius:r,density:n}=e,{minHeight:o,fontSize:i,paddingX:a}=n.button;return{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:o,padding:`6px ${a}px`,borderRadius:r.sm,fontSize:i,fontWeight:600,lineHeight:"18px"},startIcon:{marginLeft:-2,marginRight:6,...OGr},endIcon:{marginLeft:6,marginRight:-2,...OGr}},variants:[...MGr,{props:{variant:"text",color:"primary"},style:{color:t.text.secondary,"&:hover":{backgroundColor:t.raised,color:t.text.primary}}},...NGr(e),{props:{variant:"outlined",color:"error"},style:{borderColor:Hr(t.error.main,.35),"&:hover":{borderColor:t.error.main,backgroundColor:Hr(t.error.main,.1)}}}]}}}function Wat({color:e},t){return[{props:{variant:t,color:"default"},style:{backgroundColor:"transparent",border:`1px solid ${e.line}`,color:e.text.secondary,"&.MuiChip-clickable:hover":{backgroundColor:e.raised}}},...XEe.map(r=>({props:{variant:t,color:r},style:{...Vne(e[r].main,.14),borderColor:"transparent","& .MuiChip-deleteIcon":{color:Hr(e[r].main,.7),"&:hover, &:active":{color:e[r].main}},"&.MuiChip-clickable:hover":{backgroundColor:Hr(e[r].main,.22)}}}))]}function $Gr(e){return{MuiChip:{styleOverrides:{root:{height:20,fontSize:11,fontWeight:600,borderRadius:999},sizeSmall:{height:20,"& .MuiChip-label":{padding:"0 7px"}},label:{padding:"0 8px"},icon:{fontSize:14,marginLeft:6,marginRight:-2},deleteIcon:{fontSize:14,marginLeft:-2,marginRight:4},outlined:{borderColor:e.color.line}},variants:[...Wat(e,"tonal"),...Wat(e,"filled")]}}}function FGr(e){return{...BGr(e),MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},...$Gr(e)}}var Gat=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`,TAo={".MuiAppBar-root &":{color:"inherit","&:hover":{backgroundColor:Gat(8)},"&.Mui-selected":{color:"inherit",backgroundColor:Gat(12),boxShadow:`inset 0 0 0 1px ${Gat(18)}`}}};function zGr({color:e,radius:t}){return{MuiTabs:{styleOverrides:{root:{minHeight:40,alignItems:"center"},list:{gap:2},indicator:{display:"none"}}},MuiTab:{styleOverrides:{root:{minHeight:30,padding:"6px 10px",borderRadius:t.sm,textTransform:"none",fontSize:13,fontWeight:500,opacity:1,color:e.text.secondary,"&:hover":{backgroundColor:e.raised,color:e.text.primary},"&.Mui-selected":{color:e.text.primary,backgroundColor:e.raised,boxShadow:`inset 0 0 0 1px ${e.line}`},...!e.appBar&&TAo}}}}}var UGr=(e,t)=>({width:e,height:e,"& .MuiSvgIcon-root":{fontSize:t}});function HGr({color:e,radius:t,density:r}){let{side:n,icon:o,smallSide:i,smallIcon:a}=r.iconButton;return{MuiIconButton:{styleOverrides:{root:{...UGr(n,o),padding:0,borderRadius:t.sm,"&:hover":{backgroundColor:e.raised}}},variants:[{props:{size:"small"},style:UGr(i,a)},{props:{color:"default"},style:{color:e.text.secondary,"&:hover":{color:e.text.primary},...!e.appBar&&{".MuiAppBar-root &, .MuiAppBar-root &:hover":{color:"inherit"}}}}]}}}function WGr({color:e,radius:t}){return{MuiToggleButtonGroup:{styleOverrides:{root:{padding:2,gap:2,border:`1px solid ${e.line}`,borderRadius:t.sm,backgroundColor:e.background},grouped:{margin:0,border:0,borderRadius:4}}},MuiToggleButton:{styleOverrides:{root:{padding:"3px 8px",border:0,borderRadius:4,fontSize:13,fontWeight:500,lineHeight:"18px",textTransform:"none",color:e.text.secondary,"& .MuiSvgIcon-root":{fontSize:16},"&:hover":{backgroundColor:"transparent",color:e.text.primary},"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:e.raised,color:e.text.primary}}}}}}var ZEe=".MuiOutlinedInput-notchedOutline";function GGr({color:e,radius:t,density:r}){let n=r.inputFontSize;return{MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:e.background,borderRadius:t.sm,fontSize:n,color:e.text.primary,[`& ${ZEe}`]:{borderColor:e.line},[`&:hover ${ZEe}`]:{borderColor:e.text.disabled},[`&.Mui-focused ${ZEe}`]:{borderColor:e.primary.main,borderWidth:1},[`&.Mui-error ${ZEe}`]:{borderColor:e.error.main}}}},MuiInputLabel:{styleOverrides:{root:{fontSize:n,color:e.text.secondary,"&.Mui-focused":{color:e.primary.main}}}},MuiSelect:{styleOverrides:{icon:{color:e.text.disabled}}}}}function VGr({color:e,density:t}){let{width:r,height:n,thumb:o}=t.switch;return{MuiSwitch:{styleOverrides:{root:{width:r,height:n,padding:0,"& .MuiSwitch-switchBase":{padding:2,color:e.text.secondary,"&.Mui-checked":{transform:`translateX(${r-n}px)`,color:e.primary.contrastText},"&.Mui-checked + .MuiSwitch-track":{backgroundColor:e.primary.main,opacity:1}},"& .MuiSwitch-thumb":{width:o,height:o,boxShadow:"none"},"& .MuiSwitch-track":{borderRadius:n/2,backgroundColor:e.line,opacity:1}}}},MuiFormControlLabel:{styleOverrides:{root:{"&:has(.MuiSwitch-root)":{marginLeft:0,gap:8}}}}}}function qGr(e){let{appBar:t}=e.color;return{...IGr(e),...FGr(e),...HGr(e),...WGr(e),...GGr(e),...VGr(e),...zGr(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 Sv="#0e1116",Vat="#141820",QEe="#1b202a",JEe="#e3e7ee",qat="#8a93a3",qne="#8b9cff",e4e="#5fd0a0",t4e="#f2b45a",r4e="#f27a7a",jGr="#6cc8d8",YGr={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)"},n4e={dark:{color:{background:Sv,surface:Vat,raised:QEe,line:"#262c37",lineSoft:"#1d222b",text:{primary:JEe,secondary:qat,disabled:"#5c6473"},selected:"rgba(139, 156, 255, 0.14)",wash:{warning:"rgba(242, 180, 90, 0.09)",error:"rgba(242, 122, 122, 0.09)",accent:"rgba(139, 156, 255, 0.1)",check:"rgba(108, 200, 216, 0.09)"},well:Sv,stripe:QEe,codeWash:"rgba(255, 255, 255, 0.08)",overlay:{background:QEe,text:JEe},scrim:"rgba(0, 0, 0, 0.5)",appBar:{background:Vat,text:JEe},onAppBar:{...YGr,secondary:qat,level:{ok:e4e,warn:t4e,over:r4e}},statusBar:{background:Vat,text:qat,hoverText:JEe,secondary:"#5c6473",hover:QEe,active:"transparent",dot:qne,dotRing:"rgba(139, 156, 255, 0.14)",readyText:qne,level:{ok:e4e,warn:t4e,over:r4e}},primary:{main:qne,contrastText:Sv},secondary:{main:"#c99bff",contrastText:Sv},success:{main:e4e,contrastText:Sv},warning:{main:t4e,contrastText:Sv},error:{main:r4e,contrastText:Sv},info:{main:"#6cb6ff",contrastText:Sv},check:{main:jGr,contrastText:Sv}},terminal:{background:Sv,foreground:"#d6dbe4",cursor:qne,cursorAccent:Sv,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:r4e,green:e4e,yellow:t4e,blue:qne,magenta:"#c99bff",cyan:jGr,white:"#c3c9d4",brightBlack:"#5c6473",brightRed:"#ff9a9a",brightGreen:"#82e0b6",brightYellow:"#ffc97a",brightBlue:"#a9b6ff",brightMagenta:"#dcb8ff",brightCyan:"#8fdbe8",brightWhite:"#eef1f6"},elevation:{appBar:0,overlay:"0 14px 34px rgba(0, 0, 0, 0.45)",dialog:"0 30px 60px rgba(0, 0, 0, 0.5)",stuckHeader:"0 8px 8px -9px rgba(0, 0, 0, 0.8)"}},light:{color:{background:"#fff",surface:"#fff",raised:"rgba(0, 0, 0, 0.04)",line:"rgba(0, 0, 0, 0.12)",lineSoft:"rgba(0, 0, 0, 0.12)",text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},selected:"rgba(0, 0, 0, 0.08)",wash:{warning:"rgba(255, 167, 38, 0.09)",error:"rgba(244, 67, 54, 0.09)",accent:"rgba(25, 118, 210, 0.08)",check:"rgba(0, 131, 143, 0.08)"},well:"#f3f4f6",stripe:"rgba(0, 0, 0, 0.1)",codeWash:"rgba(0, 0, 0, 0.06)",overlay:{background:"rgba(97, 97, 97, 0.92)",text:"#fff"},onAppBar:{...YGr,level:{ok:"#b9f6ca",warn:"#ffe57f",over:"#ffcdd2"}},primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0",contrastText:"#fff"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2",contrastText:"#fff"},success:{main:"#2e7d32",light:"#4caf50",dark:"#1b5e20",contrastText:"#fff"},warning:{main:"#ed6c02",light:"#ff9800",dark:"#e65100",contrastText:"#fff"},error:{main:"#d32f2f",light:"#ef5350",dark:"#c62828",contrastText:"#fff"},info:{main:"#0288d1",light:"#03a9f4",dark:"#01579b",contrastText:"#fff"},check:{main:"#00838f",light:"#4fb3bf",dark:"#005662",contrastText:"#fff"},scrim:"rgba(15, 23, 42, 0.32)",statusBar:{background:"#f3f4f6",text:"rgba(0, 0, 0, 0.6)",hoverText:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.38)",hover:"rgba(0, 0, 0, 0.06)",active:"transparent",dot:"#1976d2",dotRing:"rgba(25, 118, 210, 0.16)",readyText:"#1976d2",level:{ok:"#2e7d32",warn:"#ed6c02",over:"#d32f2f"}}},terminal:{background:"#ffffff",foreground:"#333333",cursor:"#333333",cursorAccent:"#ffffff",selectionBackground:"#add6ff",black:"#000000",red:"#cd3131",green:"#107c10",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#14ce14",brightYellow:"#b5ba00",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#a5a5a5"},elevation:{appBar:0,overlay:"0 8px 24px rgba(15, 23, 42, 0.12)",dialog:"0 24px 48px rgba(15, 23, 42, 0.18)",stuckHeader:"0 6px 6px -7px rgba(0, 0, 0, 0.2)"}},font:{ui:'"Geist Variable", "Segoe UI", system-ui, sans-serif',mono:'"Geist Mono Variable", ui-monospace, Menlo, Consolas, monospace',terminal:'"Geist Mono Variable", ui-monospace, Menlo, Consolas, monospace'},type:{fontSize:14,terminalFontSize:13,scale:{caption:12,body2:14,body1:15,subtitle2:14,subtitle1:15,h6:16,h5:18,h4:24,button:14},button:{textTransform:"none",fontWeight:600}},radius:{sm:6,md:8},spacing:8,densities:{desktop:{target:30,bar:40,iconButton:{side:30,icon:18,smallSide:26,smallIcon:16},button:{minHeight:30,fontSize:13,paddingX:12},switch:{width:34,height:20,thumb:16},inputFontSize:13,tabBar:{height:44,icon:20,label:10,badge:16,insetTrim:0}},touch:{target:48,bar:60,iconButton:{side:48,icon:30,smallSide:40,smallIcon:24},button:{minHeight:48,fontSize:17,paddingX:20},switch:{width:51,height:31,thumb:27},inputFontSize:16,tabBar:{height:49,icon:26,label:11,badge:18,insetTrim:12}}}};var Vw=e=>`${e/16}rem`;function KGr({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:Vw(r.button)},caption:{fontSize:Vw(r.caption)},body2:{fontSize:Vw(r.body2)},body1:{fontSize:Vw(r.body1)},subtitle2:{fontSize:Vw(r.subtitle2)},subtitle1:{fontSize:Vw(r.subtitle1)},h6:{fontSize:Vw(r.h6)},h5:{fontSize:Vw(r.h5)},h4:{fontSize:Vw(r.h4)}}}function XGr(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}function wAo(e,t){let{dark:r,light:n,densities:o,...i}=n4e;return{...i,...e==="dark"?r:n,mode:e,density:o[t]}}function ZGr(e,t="desktop"){let r=wAo(e,t),{color:n}=r;return $v({tokens:r,palette:{mode:e,background:{default:n.background,paper:n.surface},primary:n.primary,secondary:n.secondary,success:n.success,warning:n.warning,error:n.error,info:n.info,check:n.check,text:n.text,divider:n.line,action:{hover:n.raised,selected:n.selected}},typography:KGr(r),shape:{borderRadius:r.radius.sm},spacing:r.spacing,components:{...XGr(r),...qGr(r)}})}function QGr(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=n4e;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var mqr=C(ee(),1);var t3=C(P(),1);function JGr({status:e,onClose:t}){return(0,t3.jsxs)(t3.Fragment,{children:[(0,t3.jsx)(Mu,{open:e.kind==="probing",children:(0,t3.jsx)(no,{severity:"info",variant:"filled",children:e.kind==="probing"?`Connecting to ${e.name}\u2026`:""})}),(0,t3.jsx)(kl,{error:e.kind==="error"?e.message:null,onClose:t})]})}var i4e=C(ee(),1);var CAo=/^\d+(\.\d+){3}$/;function sD(e){try{let{hostname:t}=new URL(e);return CAo.test(t)?t:t.split(".")[0]}catch{return""}}var kAo=/^[a-z]+:[/]{2}/i;function o4e(e){let t=e.trim(),r=kAo.test(t)?t:`https://${t}`;try{let n=new URL(r);return n.protocol!=="https:"&&n.protocol!=="http:"?void 0:n.origin}catch{return}}function _Ao(e){try{return new URL(e)}catch{return}}function EAo(e){return e.protocol==="assist:"&&e.hostname==="add-node"&&(e.pathname===""||e.pathname==="/")}function eVr(e){let t=_Ao(e);if(!t||!EAo(t))return{ok:!1,error:`Not an assist add-node link: ${e}`};let r=t.searchParams.get("url"),n=r?o4e(r):void 0;return n?{ok:!0,node:{name:t.searchParams.get("name")?.trim()||sD(n),url:n}}:{ok:!1,error:`The link has no valid node URL: ${r??"(missing)"}`}}var tVr=5e3,rVr="/api/health";async function RAo(e){let t=new AbortController,r=setTimeout(()=>t.abort(),tVr);try{let n=await fetch(`${e}${rVr}`,{signal:t.signal,cache:"no-store"});return n.ok?{ok:!0,health:await n.json()}:{ok:!1,error:`HTTP ${n.status}`,status:n.status}}catch(n){return t.signal.aborted?{ok:!1,error:`timed out after ${tVr/1e3}s`}:{ok:!1,error:n instanceof Error?n.message:String(n)}}finally{clearTimeout(r)}}async function r3(e){let t=Date.now(),r=await RAo(e);return r.ok||l8({at:new Date(t).toISOString(),method:"GET",path:rVr,base:e,status:r.status,error:r.status===void 0?r.error:void 0,durationMs:Date.now()-t}),r}async function nVr(e,t){let r=eVr(e);if(!r.ok)return r;let{node:n}=r;t(n);let o=await r3(n.url);return o.ok?{ok:!0,node:n,health:o.health}:{ok:!1,error:`Can't reach ${n.name} at ${n.url}: ${o.error}`}}lD();var Zat=jw("App",{web:()=>Promise.resolve().then(()=>(cVr(),lVr)).then(e=>new e.AppWeb)});var XG=C(ee(),1);var OAo=5e3;function uVr(e){let t=(0,XG.useRef)(e),r=(0,XG.useRef)(void 0);(0,XG.useEffect)(()=>{t.current=e},[e]),(0,XG.useEffect)(()=>{let n=i=>{let a=Date.now(),s=r.current?.url===i&&a-r.current.at<OAo;r.current={url:i,at:a},s||t.current(i)},o=Zat.addListener("appUrlOpen",({url:i})=>n(i));return Zat.getLaunchUrl().then(i=>{i?.url&&n(i.url)}).catch(i=>Ar(i,"launch url")),()=>{o.then(i=>i.remove())}},[])}function dVr(e){let[t,r]=(0,i4e.useState)({kind:"idle"});uVr(async o=>{let i=await nVr(o,a=>r({kind:"probing",name:a.name}));if(!i.ok){r({kind:"error",message:i.error});return}e(i.node,i.health),r({kind:"idle"})});let n=(0,i4e.useCallback)(()=>r({kind:"idle"}),[]);return{status:t,dismiss:n}}var Kne=C(P(),1);function fVr({name:e}){return(0,Kne.jsxs)(G,{sx:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,bgcolor:"background.default"},children:[(0,Kne.jsx)(Ao,{size:28}),(0,Kne.jsxs)(Ce,{variant:"body2",color:"text.secondary",children:["Connecting to ",e??"home node","\u2026"]})]})}var a4e=C(ee(),1),Qat=(0,a4e.createContext)(null);function n3(){return(0,a4e.useContext)(Qat)}var ya={top:"env(safe-area-inset-top, 0px)",bottom:"env(safe-area-inset-bottom, 0px)"};var hVr=C(P(),1);function pVr({value:e,error:t,onChange:r}){return(0,hVr.jsx)($n,{autoFocus:!0,label:"Web server URL",placeholder:"https://mac.tail1234.ts.net:3100",value:e,onChange:n=>r(n.target.value),error:!!t,helperText:t??"The address where you open the sessions page in a browser.",slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off",inputMode:"url"}}})}var Xne=C(ee(),1);function mVr(e,t){let[r,n]=(0,Xne.useState)(e?.url??""),[o,i]=(0,Xne.useState)(e?.name),[a,s]=(0,Xne.useState)(),[l,u]=(0,Xne.useState)(!1),d=o4e(r),f=o??(d?sD(d):"");return{url:r,changeUrl:m=>{n(m),s(void 0)},name:f,setName:i,error:a,busy:l,submit:async m=>{if(m.preventDefault(),!d){s("Enter an http(s) URL, e.g. https://mac.tail1234.ts.net:3100");return}u(!0);let g=await t({name:f.trim()||sD(d),url:d});u(!1),s(g)}}}var ZG=C(P(),1);function s4e({initial:e,submitLabel:t,onSubmit:r,children:n}){let o=mVr(e,r);return(0,ZG.jsxs)(kt,{component:"form",spacing:2,onSubmit:o.submit,children:[(0,ZG.jsx)(pVr,{value:o.url,error:o.error,onChange:o.changeUrl}),(0,ZG.jsx)($n,{label:"Name",value:o.name,onChange:i=>o.setName(i.target.value),helperText:"Filled in from the host name. Shown on the node chip.",slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off"}}}),(0,ZG.jsx)(ht,{type:"submit",variant:"contained",size:"large",disabled:!o.url.trim()||o.busy,children:o.busy?"Checking\u2026":t}),n]})}var Yw=C(P(),1),BAo={height:"100%",boxSizing:"border-box",overflowY:"auto",display:"flex",justifyContent:"center",pt:`calc(${ya.top} + 28px)`,pb:`calc(${ya.bottom} + 24px)`,px:2.5,bgcolor:"background.default"},$Ao={width:56,height:56,borderRadius:"14px",bgcolor:"action.hover",border:1,borderColor:"divider",display:"grid",placeItems:"center",fontFamily:"fontFamilyMono",fontSize:22,fontWeight:600,color:"primary.main"};function gVr({onConnect:e}){return(0,Yw.jsx)(G,{sx:BAo,children:(0,Yw.jsxs)(kt,{spacing:2.5,sx:{width:"100%",maxWidth:420},children:[(0,Yw.jsx)(G,{sx:$Ao,children:">_"}),(0,Yw.jsx)(Ce,{variant:"h5",sx:{fontWeight:700},children:"Connect to a home node"}),(0,Yw.jsxs)(Ce,{variant:"body2",color:"text.secondary",children:["The phone connects to one assist web server over Tailscale. You'll see its sessions and the sessions of every node it links to. Make sure Tailscale is connected on this phone and"," ",(0,Yw.jsx)("code",{children:"assist sessions web"})," is running on that machine."]}),(0,Yw.jsx)(s4e,{submitLabel:"Connect",onSubmit:async r=>{let n=await r3(r.url);if(!n.ok)return`Can't reach ${r.url}: ${n.error}`;e(r,n.health)}})]})})}var tqr=C(ee(),1);var Tv=C(P(),1),FAo={flex:"none",pt:ya.top,bgcolor:"background.default"},zAo={height:e=>e.tokens.density.bar,display:"grid",gridTemplateColumns:"minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)",columnGap:1,alignItems:"center",px:1.5},UAo={height:e=>e.tokens.density.bar,display:"flex",alignItems:"center",gap:.5,px:.5},HAo={textAlign:"center",minWidth:0,maxWidth:220,fontSize:15,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},WAo={flex:1,minWidth:0,fontSize:15,fontWeight:600,lineHeight:1.25,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",overflowWrap:"anywhere"};function yu({left:e,title:t,right:r,leadingTitle:n}){return(0,Tv.jsx)(G,{component:"header",sx:FAo,children:n?(0,Tv.jsxs)(G,{sx:UAo,children:[(0,Tv.jsx)(G,{sx:{flex:"none"},children:e}),(0,Tv.jsx)(G,{component:"h1",sx:[WAo,{m:0}],children:t}),(0,Tv.jsx)(G,{sx:{flex:"none",display:"flex"},children:r})]}):(0,Tv.jsxs)(G,{sx:zAo,children:[(0,Tv.jsx)(G,{sx:{justifySelf:"start",minWidth:0},children:e}),(0,Tv.jsx)(G,{sx:HAo,children:t}),(0,Tv.jsx)(G,{sx:{justifySelf:"end",display:"flex",gap:.25},children:r})]})})}var Nx=e=>e.tokens.color.raised;var yVr=C(P(),1),GAo={ok:e=>e.palette.success.main,warn:e=>e.palette.warning.main,error:e=>e.palette.error.main,off:e=>e.palette.text.disabled};function A0({tone:e}){return(0,yVr.jsx)(G,{component:"span",sx:{width:8,height:8,flex:"none",borderRadius:"50%",bgcolor:GAo[e]}})}var ks=e=>e.tokens.density.target;var QG=C(P(),1),VAo={display:"inline-flex",alignItems:"center",gap:.75,height:ks,pl:1.125,pr:.75,borderRadius:"24px",border:1,borderColor:"divider",bgcolor:Nx,color:"text.primary",fontFamily:"fontFamilyMono",fontSize:13,maxWidth:140,justifyContent:"flex-start"},qAo={minWidth:0,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"};function l4e({name:e,tone:t,onClick:r}){return(0,QG.jsxs)(nr,{sx:VAo,onClick:r,disabled:!r,"aria-label":"Nodes","data-testid":"phone-node-chip",children:[(0,QG.jsx)(A0,{tone:t}),(0,QG.jsx)(G,{component:"span",sx:qAo,children:e??"\u2026"}),r&&(0,QG.jsx)(ba,{sx:{fontSize:16,flex:"none"}})]})}var KVr=C(ee(),1);var c4e=C(P(),1);function vVr({homeNode:e,node:t,onDone:r}){let n=!!t&&t.url===e.home?.url;return(0,c4e.jsx)(G,{sx:{px:2.5,pt:1},children:(0,c4e.jsx)(s4e,{initial:t,submitLabel:t?"Save":"Add node",onSubmit:async i=>{if(e.nodes.some(s=>s.url===i.url&&s.url!==t?.url))return"That URL is already saved";e.saveNode(t?.url??i.url,i),r()},children:t&&(0,c4e.jsx)(ht,{color:"error",size:"large",disabled:n,onClick:()=>{e.removeNode(t.url),r()},children:n?"Switch home node to delete this one":"Delete node"})})})}var bVr=C(P(),1),jAo={width:36,height:5,borderRadius:"3px",bgcolor:"text.disabled",opacity:.5,mx:"auto",mb:.75};function JG(){return(0,bVr.jsx)(G,{sx:jAo})}var Kw=C(P(),1),YAo={display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,px:2,pt:.75,pb:1.25},KAo={color:"primary.main",fontSize:16,minHeight:ks,px:.5,borderRadius:1};function eV({title:e,actionLabel:t,onAction:r}){return(0,Kw.jsxs)(Kw.Fragment,{children:[(0,Kw.jsx)(JG,{}),(0,Kw.jsxs)(G,{sx:YAo,children:[(0,Kw.jsx)(G,{component:"b",sx:{fontSize:17,fontWeight:600},children:e}),(0,Kw.jsx)(nr,{sx:KAo,onClick:r,children:t})]})]})}var cD=C(P(),1);function xVr({homeNode:e,node:t,onDone:r}){return(0,cD.jsxs)(cD.Fragment,{children:[(0,cD.jsx)(eV,{title:t?"Edit node":"Add node",actionLabel:"Cancel",onAction:r}),(0,cD.jsx)(vVr,{homeNode:e,node:t,onDone:r},t?.url??"add")]})}var Or={group:{flexShrink:0,mx:2,my:.75,borderRadius:"12px",bgcolor:"background.default",border:1,borderColor:"divider",overflow:"hidden","& > *:not(:last-child)":{borderBottom:1,borderColor:e=>e.tokens.color.lineSoft}},item:{width:"100%",minHeight:ks,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1.5,px:1.75,py:1,textAlign:"left",fontSize:16},grow:{flex:1,minWidth:0},detail:{display:"block",fontSize:13,color:"text.secondary",fontFamily:"fontFamilyMono",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},end:{display:"flex",alignItems:"center",gap:.75,color:"text.secondary",fontSize:14},label:{px:4,pt:1.75,pb:.25,fontSize:13,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"text.secondary"}};function SVr(e,t){return e.replace(/\/+$/,"")===t.replace(/\/+$/,"")}function tV(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]||0)-(n[o]||0);if(i!==0)return Math.sign(i)}return 0}function TVr(e,t,r){let n=t.filter(a=>a.node===e.name).length,o=[e.state,`${n} session${n===1?"":"s"}`,e.peerVersion&&`v${e.peerVersion}`,e.state!=="connected"&&e.error],i=e.peerVersion&&r?tV(e.peerVersion,r):0;return{text:o.filter(Boolean).join(" \xB7 "),drift:i<0?"behind":i>0?"ahead":void 0}}var u4e={connected:"ok",connecting:"warn",disconnected:"error","version-blocked":"error"};var Jat=C(P(),1);function wVr({name:e,onSave:t}){return(0,Jat.jsx)(jt,{"aria-label":`Save ${e} as a home node`,onClick:t,sx:{color:"primary.main",borderRadius:0},children:(0,Jat.jsx)(mp,{fontSize:"small"})})}var Xw=C(P(),1),XAo={fontFamily:"fontFamilyMono",fontSize:12,px:.75,border:1,borderColor:"currentColor",borderRadius:"4px",color:"warning.main"};function CVr({links:e,sessions:t,homeVersion:r,isSaved:n,onSave:o}){return(0,Xw.jsx)(G,{sx:Or.group,children:e.map(i=>{let{text:a,drift:s}=TVr(i,t,r);return(0,Xw.jsxs)(G,{sx:[Or.item,{pr:0}],children:[(0,Xw.jsx)(A0,{tone:u4e[i.state]}),(0,Xw.jsxs)(G,{component:"span",sx:Or.grow,children:[i.name,(0,Xw.jsx)(G,{component:"span",sx:Or.detail,children:a})]}),s&&(0,Xw.jsx)(G,{component:"span",sx:XAo,children:s}),!n(i.url)&&(0,Xw.jsx)(wVr,{name:i.name,onSave:()=>o(i)})]},i.name)})})}var Ox=C(P(),1);function rV({title:e,rows:t}){return(0,Ox.jsxs)(Ox.Fragment,{children:[(0,Ox.jsx)(G,{sx:Or.label,children:e}),(0,Ox.jsx)(G,{sx:Or.group,children:t.map(r=>(0,Ox.jsxs)(G,{sx:Or.item,children:[(0,Ox.jsx)(G,{component:"span",sx:Or.grow,children:r.label}),(0,Ox.jsx)(G,{component:"span",sx:[Or.end,{fontFamily:"fontFamilyMono"},r.color?{color:r.color}:{}],children:r.value})]},r.key))})]})}var _Vr=C(P(),1);function kVr({rateLimits:e,harnessRateLimits:t}){let r=C0(3e4),n=tEe(e,t).flatMap(o=>iEe(o.rateLimits).map(i=>({key:`${o.harness}-${i.label}`,label:`${$c(o.harness)} \xB7 ${i.label}`,value:i.resetsAt!=null?`${Math.round(i.pct)}% \xB7 ${pG(i.resetsAt,r)}`:`${Math.round(i.pct)}%`,color:p_e(yx(i.pct,i.resetsAt,i.windowSeconds,r))})));return n.length===0?null:(0,_Vr.jsx)(rV,{title:"Rate limits",rows:n})}var Bx=C(P(),1);function EVr({status:e,homeVersion:t,homeNode:r}){let n=e.nodes?.links??[];return(0,Bx.jsxs)(Bx.Fragment,{children:[n.length>0&&(0,Bx.jsxs)(Bx.Fragment,{children:[(0,Bx.jsxs)(G,{sx:Or.label,children:["Linked through ",e.nodes?.local]}),(0,Bx.jsx)(CVr,{links:n,sessions:e.sessions,homeVersion:t,isSaved:o=>r.nodes.some(i=>SVr(i.url,o)),onSave:({name:o,url:i})=>r.saveNode("",{name:o,url:i})})]}),(0,Bx.jsx)(kVr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var ZAo={ok:"ok",ready:"warn",diverged:"warn",retrying:"warn",paused:"off",off:"off",loading:"off",unavailable:"error"};function d4e(e,t){let r=S0(e),{status:n}=e,o=!!n&&!!t&&tV(t,n.built)>0,i=C5(e),a=n&&(n.running===n.built?`v${n.running}`:`v${n.running} \u2192 v${n.built}`),s=o?`v${t} available`:i?"restart pending":r.label.toLowerCase();return{tone:o?"warn":ZAo[r.kind],detail:[a,s].filter(Boolean).join(" \xB7 "),updateAvailable:o,restartPending:i}}var Mm=C(P(),1);function RVr({updates:e,onOpen:t}){let{entries:r,latest:n,notices:o}=e;return r.length===0?null:(0,Mm.jsxs)(Mm.Fragment,{children:[(0,Mm.jsx)(G,{sx:Or.label,children:"Updates"}),(0,Mm.jsx)(G,{sx:Or.group,children:r.map(i=>{let a=d4e(i,n),s=o.busy[i.name];return(0,Mm.jsxs)(nr,{sx:Or.item,onClick:()=>t(i.name),"data-testid":`phone-update-row-${i.name}`,children:[(0,Mm.jsx)(A0,{tone:a.tone}),(0,Mm.jsxs)(G,{component:"span",sx:Or.grow,children:[i.name,(0,Mm.jsx)(G,{component:"span",sx:Or.detail,children:a.detail})]}),(0,Mm.jsxs)(G,{component:"span",sx:Or.end,children:[s&&`${s}\u2026`,(0,Mm.jsx)(Wo,{})]})]},i.name)})})]})}var Zne=C(P(),1);function f4e({onAdd:e}){return(0,Zne.jsxs)(nr,{sx:Or.item,onClick:e,children:[(0,Zne.jsx)(mp,{sx:{color:"primary.main"}}),(0,Zne.jsx)(G,{component:"span",sx:{color:"primary.main"},children:"Add node URL"})]})}function $x(e){try{return new URL(e).host}catch{return e}}function p4e(e){if(!e)return{tone:"off",text:"checking\u2026"};if(!e.ok)return{tone:"error",text:"unreachable"};let t=e.health.version;return{tone:"ok",text:t?`reachable \xB7 v${t}`:"reachable"}}var h4e=C(ee(),1);var QAo=15e3;function m4e(e){let[t,r]=(0,h4e.useState)({}),n=e.join(`
|
|
4064
4064
|
`);return(0,h4e.useEffect)(()=>{if(!n)return;let o=!1,i=()=>{for(let s of n.split(`
|
package/dist/index.js
CHANGED