@staff0rd/assist 0.1023.0 → 0.1024.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude/commands/devlog.md +15 -8
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +94 -61
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ Parse `$ARGUMENTS`: if `--all` is present, enable **catch-up mode** (described b
|
|
|
7
7
|
|
|
8
8
|
## Single-week mode (default)
|
|
9
9
|
|
|
10
|
-
Run `assist devlog next`. It prints the project `name`, the ISO `week` (e.g. `2026-W33`), its Monday–Sunday `range`, the `versions` range, and every commit in the week oldest first, each tagged with the version from `package.json` at that commit
|
|
10
|
+
Run `assist devlog next`. It prints the project `name`, the ISO `week` (e.g. `2026-W33`), its Monday–Sunday `range`, the `dates` of the first and last commits, the `versions` range, and every commit in the week oldest first, each tagged with the version from `package.json` at that commit. No versions are shown when the repo has no real version history (no tags and a version that never changes in the week). It only ever offers completed weeks; if it reports nothing to write, stop.
|
|
11
11
|
|
|
12
12
|
Decide whether the week is worth an entry:
|
|
13
13
|
|
|
@@ -22,6 +22,10 @@ Never write the entry file yourself. Write the entry as JSON to a scratch file a
|
|
|
22
22
|
{
|
|
23
23
|
"week": "<week id, e.g. 2026-W33>",
|
|
24
24
|
"title": "<one-line headline of the week's main themes>",
|
|
25
|
+
"dates": {
|
|
26
|
+
"first": "<first commit date in the week, YYYY-MM-DD>",
|
|
27
|
+
"last": "<last commit date in the week, YYYY-MM-DD>"
|
|
28
|
+
},
|
|
25
29
|
"versions": {
|
|
26
30
|
"first": "<earliest version in the week>",
|
|
27
31
|
"last": "<latest version in the week>"
|
|
@@ -29,29 +33,32 @@ Never write the entry file yourself. Write the entry as JSON to a scratch file a
|
|
|
29
33
|
"aiGenerated": "<model name, e.g. claude-opus-5>",
|
|
30
34
|
"added": [
|
|
31
35
|
{
|
|
32
|
-
"text": "<
|
|
36
|
+
"text": "<short phrase naming something new>",
|
|
33
37
|
"version": "<version of the commit(s) it came from>"
|
|
34
38
|
}
|
|
35
39
|
],
|
|
36
40
|
"changed": [
|
|
37
41
|
{
|
|
38
|
-
"text": "<
|
|
42
|
+
"text": "<short phrase naming a change to existing behaviour>",
|
|
39
43
|
"version": "<version>"
|
|
40
44
|
}
|
|
41
45
|
],
|
|
42
|
-
"fixed": [
|
|
46
|
+
"fixed": [
|
|
47
|
+
{ "text": "<short phrase naming what was broken>", "version": "<version>" }
|
|
48
|
+
],
|
|
43
49
|
"lede": "<1-2 sentence lede summarising what the week was about>"
|
|
44
50
|
}
|
|
45
51
|
```
|
|
46
52
|
|
|
47
53
|
- **title**: a terse headline naming the week's 2-3 main themes (e.g. `Comment previews, Windows config writes, collapsible sidebar`), not a sentence.
|
|
48
|
-
- **
|
|
54
|
+
- **dates**: the first and last commit dates reported as `dates` by `assist devlog next`.
|
|
55
|
+
- **versions**: the first and last versions reported by `assist devlog next`. Omit `versions` entirely when it reports none.
|
|
49
56
|
- **added / changed / fixed**: one line per user-visible change, newest version first within each list. Merge related commits into one line and drop release commits, refactors, tests and other internal-only work. Use `feat:` commits as a hint for **added** and `fix:` for **fixed**, but classify by what changed for the user. Omit a list that would be empty.
|
|
50
|
-
- **version** on each line: the version shown against the commit(s) the line came from (the latest one when several commits are merged). Omit `version` when
|
|
51
|
-
- Write each line as a short changelog
|
|
57
|
+
- **version** on each line: the version shown against the commit(s) the line came from (the latest one when several commits are merged). Omit `version` when `assist devlog next` reports no versions.
|
|
58
|
+
- Write each line as a short changelog phrase (at most 80 characters, which `assist devlog write` enforces), not a sentence: name the thing, drop the explanation. A fix names what was broken, e.g. "`assist backlog show` not printing comments", not "`assist backlog show` collected comments but never printed them". Wrap code symbols (commands, function names, file names, config keys) in backticks.
|
|
52
59
|
- **lede**: one or two sentences, conversational, saying what the week was mostly about and why it matters.
|
|
53
60
|
|
|
54
|
-
|
|
61
|
+
Match the style of `~/git/blog/src/content/dev/assist/2026-w33.md`. Older entries in `~/git/blog/src/content/dev/` predate the short-phrase style, so don't copy their item length.
|
|
55
62
|
|
|
56
63
|
## Catch-up mode (`--all`)
|
|
57
64
|
|
|
@@ -4058,7 +4058,7 @@ ${d.join(`
|
|
|
4058
4058
|
`,T3o=Bi`
|
|
4059
4059
|
0%, 100% { transform: scale(1); }
|
|
4060
4060
|
50% { transform: scale(1.08); }
|
|
4061
|
-
`,o$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:`${S3o} 1.8s linear infinite`},w3o={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${T3o} 1.6s ease-in-out infinite`,"&::before":{...o$r,inset:0,zIndex:-1},"&::after":{...o$r,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:zl.rainbowPill.text,textShadow:zl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function i$r({children:e}){return(0,OI.jsxs)(OI.Fragment,{children:[(0,OI.jsx)(P3,{styles:x3o}),(0,OI.jsx)(G,{component:"span","data-testid":"rainbow-pill",sx:w3o,children:e})]})}function a$r({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function s$r(e){if(e.length!==2)return!1;let[t,r]=e;return a$r(t)===a$r(r)}var Lw=k(P(),1);function c$r({rateLimits:e}){let t=x0(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=s$r(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:L_e(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,Lw.jsxs)(l$r.Fragment,{children:[a>0?(0,Lw.jsx)(G,{component:"span",sx:{color:xG,mr:.5},children:","}):null,(0,Lw.jsx)(n$r,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,Lw.jsx)(i$r,{children:o}):(0,Lw.jsx)(Lw.Fragment,{children:o})}var I5=k(P(),1);function d$r({groups:e}){return(0,I5.jsx)(I5.Fragment,{children:e.map((t,r)=>(0,I5.jsxs)(u$r.Fragment,{children:[(0,I5.jsx)(G,{component:"span",sx:{color:xG,ml:r>0?1:0,mr:.5},children:Dc(t.harness)}),(0,I5.jsx)(c$r,{rateLimits:t.rateLimits})]},t.harness))})}var f$r={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 C3o(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function k3o(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function _3o(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function m$r(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=Sit(t,r,n);if(o==null)return{kind:"unprojectable"};let i=cx(e,t,r,n),a=C3o(i),s=k3o(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:_3o(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function M_e(e){return t=>t.tokens.color.onAppBar.level[e]}function g$r(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${XW(e.at,t)}`}var M5=k(P(),1),y$r={display:"contents"};function Hit({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,M5.jsxs)(G,{component:"span",sx:y$r,children:[(0,M5.jsx)("span",{}),(0,M5.jsx)("span",{})]});let n=(0,M5.jsx)(G,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,M5.jsxs)(G,{component:"span",sx:{color:M_e(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,M5.jsxs)(G,{component:"span",sx:y$r,children:[r?o:n,r?n:o]})}var v$r={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 D5=k(P(),1);function b$r({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=v$r,a=cx(t,r,n,o),s=m$r(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,D5.jsxs)(G,{sx:i.row,children:[(0,D5.jsx)(G,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,D5.jsx)(Hit,{direction:"back",threshold:l?.recovery}),(0,D5.jsxs)(G,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:M_e(a)},children:[Math.round(t),"%"]}),(0,D5.jsx)(Hit,{direction:"forward",threshold:l?.worse}),(0,D5.jsx)(G,{component:"span",sx:i.note,children:l?l.recovery&&g$r(l.recovery,o):"no projection yet"})]})}function D_e(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 S$r=k(P(),1);function x$r({rateLimits:e,now:t}){return D_e(e).map(r=>(0,S$r.jsx)(b$r,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var BI=k(P(),1);function T$r({groups:e}){let t=x0(3e4),r=f$r;return(0,BI.jsxs)(G,{sx:r.root,children:[e.map(n=>(0,BI.jsxs)(G,{sx:r.group,children:[(0,BI.jsx)(G,{sx:r.heading,children:Dc(n.harness)}),(0,BI.jsx)(x$r,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,BI.jsx)(G,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var Wit=k(P(),1),E3o="Claude account usage (5h / 7d windows) \u2014 view history";function w$r(e){return e.length===0?{title:E3o,content:"Usage"}:{title:(0,Wit.jsx)(T$r,{groups:e}),content:(0,Wit.jsx)(d$r,{groups:e})}}var C$r={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}},k$r={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var Git=k(P(),1),R3o={};function _$r({rateLimits:e,harnessRateLimits:t=R3o}){let{title:r,content:n}=w$r(P_e(e,t));return(0,Git.jsx)(sr,{title:r,placement:"top-start",slotProps:k$r,children:(0,Git.jsx)(Kr,{component:ua,to:"/usage",underline:"none",color:"inherit",sx:C$r,children:n})})}var A$r=k(re(),1);var sh="0.1023.0";var N_e=k(re(),1),Vit=(0,N_e.createContext)(null);function O_e(){return(0,N_e.useContext)(Vit)}var qit=k(P(),1);function E$r(){let e=O_e();return!e||e===sh?null:(0,qit.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${sh}. Restart the daemon to match.`,children:(0,qit.jsx)(v_e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var R$r=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?Tx(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>Tx(t).hover,color:t=>Tx(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>Tx(t).dot,boxShadow:t=>`0 0 0 3px ${Tx(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>Tx(t).readyText}});var C0=k(P(),1);function P$r(){let{entries:e}=d5(),t=nn(),r=(0,A$r.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=fo("openUpdates");if(Xi(n,r),!sh)return null;let i=e.filter(h5).length;return(0,C0.jsxs)(C0.Fragment,{children:[(0,C0.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,C0.jsx)(Cd,{label:"Updates",chords:o}),children:(0,C0.jsxs)(ir,{component:ua,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:R$r(i>0),children:[i>0&&(0,C0.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,C0.jsxs)("span",{children:["v",sh]}),i>0&&(0,C0.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,C0.jsx)(E$r,{})]})}var Iw=k(P(),1);function L$r({socket:e}){return(0,Iw.jsx)(W9r,{start:(0,Iw.jsx)(_$r,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,Iw.jsxs)(Iw.Fragment,{children:[(0,Iw.jsx)(e$r,{}),(0,Iw.jsx)(P$r,{})]})})}var I$r=k(re(),1);var Mw=k(P(),1),A3o=2e4;function M$r(){let{entries:e,refresh:t}=d5(),[r,n]=(0,I$r.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,Mw.jsx)(Iu,{open:a,children:(0,Mw.jsxs)(ro,{severity:"info",variant:"filled",action:(0,Mw.jsxs)(Mw.Fragment,{children:[(0,Mw.jsx)(yt,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,A3o),children:"Install"}),(0,Mw.jsx)(yt,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var U_e=k(re(),1);var z_e=k(re(),1);function D$r(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 N5=k(P(),1),P3o={display:"flex",gap:1,alignItems:"center",minWidth:0},L3o={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},I3o={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},M3o={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function D3o(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function N$r({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,N5.jsx)(Km,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=D3o(o);return(0,N5.jsxs)(Qr,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:P3o,children:[(0,N5.jsx)(u2e,{path:o}),(0,N5.jsxs)(G,{sx:L3o,children:[(0,N5.jsx)(_e,{component:"span",sx:I3o,children:s}),(0,N5.jsx)(_e,{component:"span",color:"text.secondary",sx:M3o,children:a})]})]},o)})})}var B_e=k(P(),1),N3o={maxHeight:420,overflowY:"auto"},O3o={px:2,py:2,fontSize:13};function O$r({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,B_e.jsx)(G,{sx:N3o,children:e?(0,B_e.jsx)(_e,{color:"text.secondary",sx:O3o,children:e}):(0,B_e.jsx)(N$r,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var B$r=k(P(),1),B3o={mt:6,alignSelf:"flex-start"};function $_e({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,B$r.jsx)(Ac,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:B3o},transition:{onEntered:t}},children:n})}var F_e=k(re(),1);var $$r={files:[],loading:!1,error:!1};function F$r(e,t){let[r,n]=(0,F_e.useState)($$r),o=br();return(0,F_e.useEffect)(()=>{if(!e){n($$r);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await tr(Jr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Pr(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var $I=k(P(),1);function $3o(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function z$r({onClose:e}){let{worktreeNode:t}=eo();return(0,$I.jsx)(ec.Provider,{value:t,children:(0,$I.jsx)(F3o,{onClose:e})})}function F3o({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=eo(),[n,o]=(0,z_e.useState)(""),i=F$r(t,n),a=nn(),s=(0,z_e.useRef)(null),l=h=>a($3o(h,t,r)),{highlight:u,setHighlight:d,onKeyDown:f}=w5(i.files,n,l,e),p=h=>{l(h),e()};return(0,$I.jsxs)($_e,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,$I.jsx)(ak,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:f,placeholder:"Search files by name..."}),(0,$I.jsx)(O$r,{message:D$r(t,n,i),files:i.files,highlight:u,onHighlight:d,onSelect:p})]})}function U$r(e){Xi(fo("quickOpen").matches,e)}var W$r=k(P(),1);function H$r(){let[e,t]=(0,U_e.useState)(!1);return U$r((0,U_e.useCallback)(()=>t(!0),[])),e?(0,W$r.jsx)(z$r,{onClose:()=>t(!1)}):null}var H_e=k(P(),1);function G$r({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,H_e.jsx)(Iu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,H_e.jsx)(ro,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,H_e.jsx)(yt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var lne=k(re(),1);function SG(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var nFr=k(re(),1);var V$r=k(P(),1),q$r=nt((0,V$r.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 z3o={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function j$r(e){return e?z3o[e]:"success.main"}function Y$r(e){return e.split("-")[0].split(".").map(Number)}function K$r(e,t){if(!e||!t||e===t)return;let r=Y$r(e),n=Y$r(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 FI=k(P(),1),U3o={height:16,fontSize:10},H3o={opacity:.6,fontSize:"0.85em"};function W3o(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 ane({nodes:e,name:t,showVersion:r=!1}){let n=O_e()??sh,o=e.links.find(a=>a.name===t),i=K$r(o?.peerVersion,n);return(0,FI.jsx)(sr,{title:W3o(e,t),placement:"right",children:(0,FI.jsxs)(G,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,FI.jsx)(q$r,{sx:{fontSize:8,color:j$r(o?.state)}}),t,r&&o?.peerVersion&&(0,FI.jsxs)(G,{component:"span",sx:H3o,children:["v",o.peerVersion]}),i&&(0,FI.jsx)(Zn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:U3o})]})})}var zI=k(P(),1),G3o={opacity:.6},V3o={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function X$r({nodes:e,name:t,clone:r}){let n=(0,zI.jsx)(ane,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,zI.jsx)(G,{component:"span",sx:G3o,children:n}):(0,zI.jsx)(sr,{title:nG(t,r.cloneTarget),children:(0,zI.jsxs)(G,{component:"span",sx:V3o,children:[(0,zI.jsx)(rG,{sx:{fontSize:14}}),n]})})}var Q$r=k(P(),1),q3o={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 Z$r({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,Q$r.jsx)(ir,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:q3o,children:t})}var J$r={ArrowRight:1,ArrowLeft:-1};function j3o(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+J$r[e.key]+r)%r}function eFr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!J$r[o.key]){zT(o);return}let i=j3o(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var tFr=k(re(),1);function TG(e){return e?.querySelector('[aria-checked="true"]')}function rFr(e,t){(0,tFr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=TG(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var jit=k(P(),1),Y3o={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function W_e({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return rFr(i,r),(0,jit.jsx)(_t,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:eFr(t,r,n,l),sx:Y3o,children:t.map(u=>(0,jit.jsx)(Z$r,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var Yit=k(P(),1);function oFr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=Sl(),a=(0,nFr.useRef)(null);return!i||!n||!e?null:(0,Yit.jsx)(W_e,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,Yit.jsx)(X$r,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var G_e=k(P(),1);function iFr({prompt:e,children:t}){return(0,G_e.jsxs)(_t,{children:[e,(0,G_e.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var sFr=k(P(),1),K3o=".MuiOutlinedInput-notchedOutline",X3o={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${K3o}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function aFr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,sFr.jsx)(Gn,{sx:X3o,value:e,onChange:a=>t(a.target.value),onKeyDown:zT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var dFr=k(re(),1);var sv={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"}},lFr=Object.keys(sv);var Kit=k(P(),1);function cFr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,Kit.jsx)(_s,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,Kit.jsx)(Qr,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:Dc(i)},i))})}var UI=k(P(),1);function uFr(e){return t=>t==="prompt"&&e?(0,UI.jsxs)(UI.Fragment,{children:["prompt",(0,UI.jsx)(G,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Dc(e)}`}),(0,UI.jsx)(mp,{sx:{fontSize:18,mr:-.75}})]}):t}var HI=k(P(),1);function fFr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,dFr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(TG(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,HI.jsxs)(HI.Fragment,{children:[(0,HI.jsx)(W_e,{label:"Mode",options:lFr,value:e.mode,onChange:l,optionLabel:uFr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,HI.jsx)(cFr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var CFr=k(re(),1);var Xit=k(P(),1),Z3o={zIndex:e=>e.zIndex.modal+1};function pFr({open:e,anchor:t,children:r}){return(0,Xit.jsx)(mD,{open:e,anchorEl:t,placement:"bottom-start",sx:Z3o,children:(0,Xit.jsx)(dn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var hFr=k(P(),1),mFr=nt((0,hFr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var Zit=k(P(),1),Q3o={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},J3o={fontSize:16,color:"text.disabled"};function gFr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:Q3o,endAdornment:(0,Zit.jsx)(C3e,{position:"end",children:(0,Zit.jsx)(mFr,{sx:J3o})})}}}var yFr=k(eD(),1);function vFr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}zT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,yFr.flushSync)(()=>{r(t),n()}),zT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function V_e(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>px(n).toLowerCase().includes(r)):e}var Qit=k(re(),1);function bFr(){let[e,t]=(0,Qit.useState)(!1),[r,n]=(0,Qit.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var SFr=k(re(),1);var xFr=e=>e?px(e):"";function TFr(e){let[t,r]=(0,SFr.useState)(()=>xFr(e));return{text:t,setText:r,showRepo:n=>r(xFr(n))}}function wFr(e,t,r){let n=bFr(),o=TFr(t),i=V_e(e,n.query),a=d=>{r(d),o.showRepo(d)},s=w5(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:vFr({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 wG=k(P(),1);function kFr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=wFr(e,t,r),s=(0,CFr.useRef)(null);return(0,wG.jsxs)(G,{ref:s,sx:{flex:1,minWidth:0},children:[(0,wG.jsx)(Gn,{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:gFr(a.open)}),(0,wG.jsx)(pFr,{open:a.open,anchor:s.current,children:(0,wG.jsx)(f_e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var O5=k(P(),1);function _Fr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=eo();return(0,O5.jsxs)(iFr,{prompt:(0,O5.jsx)(aFr,{value:r.prompt,onChange:r.setPrompt,placeholder:sv[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,O5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,O5.jsx)(kFr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,O5.jsx)(fFr,{...t})]}),(0,O5.jsx)(oFr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var AFr=k(P(),1),EFr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function RFr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,AFr.jsx)(yt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var WI=k(P(),1),eRo=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"}),tRo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function PFr(e){return(0,WI.jsxs)(_t,{direction:"row",sx:eRo,children:[EFr.map(([t,r])=>(0,WI.jsxs)("span",{children:[(0,WI.jsx)(G,{component:"kbd",sx:tRo,children:t}),r]},t)),(0,WI.jsx)(G,{sx:{flex:1}}),(0,WI.jsx)(RFr,{...e})]})}var GI=k(re(),1);function LFr(e,t){let r=(0,GI.useRef)(e),n=(0,GI.useRef)(null),o=(0,GI.useRef)(null),i=(0,GI.useRef)(null),a=(0,GI.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:TG(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 rRo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:h_e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function IFr(e,t){let{names:r,visible:n}=Sl(),o=c_e(t,n?r:[void 0]);return{cloneState:o,target:rRo(t,e,o(e))}}function q_e({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}]:[];t_r(sv[e].sessionMode,n,(u,d)=>i.onCreateAssist(u,d,...l),()=>{},r)}function MFr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(t_e(r.prompt,n.onCreateAssist),!0):(q_e({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var j_e=k(re(),1);function DFr(e,t){let[r,n]=(0,j_e.useState)(!1);return(0,j_e.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function NFr(e,t,r,n,o){let i=DFr(e,()=>{MFr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var sne=k(re(),1);function OFr(e,t){let r=(0,sne.useRef)(e),n=(0,sne.useRef)(null);return(0,sne.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 $Fr=k(P(),1),nRo={border:0,margin:0,padding:0,minWidth:0};function BFr({loading:e,restoreFocus:t,children:r}){let n=OFr(e,t);return(0,$Fr.jsx)("fieldset",{disabled:e,style:nRo,onFocus:n,children:r})}var K_e=k(P(),1);function Y_e({error:e,onRetry:t}){return e?(0,K_e.jsxs)(ro,{severity:"error",sx:{mx:2,my:1},action:t&&(0,K_e.jsx)(yt,{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 B5=k(P(),1);function FFr({draft:e,launchers:t,onClose:r}){let n=LFr(e.focus,e.setFocus),o=SG(S0()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=IFr(e.node,e.cwd),l=NFr(e,i,a,t,r);return(0,B5.jsx)($_e,{onClose:r,onEntered:n.restore,centered:!0,children:(0,B5.jsx)("form",{onSubmit:l,children:(0,B5.jsxs)(BFr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,B5.jsx)(_Fr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,B5.jsx)(Y_e,{error:e.modeError,onRetry:e.retryMode}),(0,B5.jsx)(PFr,{submitLabel:a.kind==="clone"?"Clone":sv[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var VI=k(re(),1);async function oRo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await tr(`/api/new-session-defaults${t}`);if(!r.ok)return{error:`HTTP ${r.status}`};let n=await r.json();if(Object.hasOwn(sv,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Pr(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function X_e(e,t=0){let[r,n]=(0,VI.useState)(0),[o,i]=(0,VI.useState)(null),a=(0,VI.useCallback)(()=>n(l=>l+1),[]);if((0,VI.useEffect)(()=>{let l=!1;return oRo(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 Z_e(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function zFr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var $5=k(re(),1);var UFr={field:"prompt",selectionStart:0,selectionEnd:0};function HFr(){let[e,t]=hH("new-session"),[r,n]=(0,$5.useState)(),[o,i]=(0,$5.useState)(),[a,s]=(0,$5.useState)("claude"),[l,u]=(0,$5.useState)(),[d,f]=(0,$5.useState)(UFr),p=(0,$5.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),f(UFr)},[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 WFr(e,t=X_e){let{selectedCwd:r}=eo(),n=Sl(),o=HFr(),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:Z_e(o.mode,a),retryMode:a.retry,node:zFr(o.node,n)}:null}function GFr(e){Xi(fo("newSession").matches,e)}var VFr=k(re(),1);function qFr(e,t){let{selectedCwd:r}=eo(),[n,o]=nl(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,VFr.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 YFr=k(P(),1);function jFr({launchers:e}){let[t,r]=(0,lne.useState)(!1),[n,o]=(0,lne.useState)(0),i=WFr(n),a=(0,lne.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return GFr(a),qFr(i,a),!t||!i?null:(0,YFr.jsx)(FFr,{draft:i,launchers:e,onClose:()=>r(!1)})}var Q_e=k(P(),1);function KFr({reconnecting:e}){return(0,Q_e.jsx)(Iu,{open:e,children:(0,Q_e.jsx)(ro,{severity:"info",variant:"filled",icon:(0,Q_e.jsx)(Ao,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var lv=k(P(),1);function XFr({socket:e,onViewLaunchedSession:t}){return(0,lv.jsxs)(lv.Fragment,{children:[(0,lv.jsx)(H$r,{}),(0,lv.jsx)(jFr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,lv.jsx)(KFr,{reconnecting:e.reconnecting}),(0,lv.jsx)(M$r,{}),(0,lv.jsx)(Tl,{error:e.error,onClose:e.clearError}),(0,lv.jsx)(G$r,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var wx=k(re(),1);var iRo=6e4;function aRo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function J_e(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4061
|
+
`,o$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:`${S3o} 1.8s linear infinite`},w3o={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${T3o} 1.6s ease-in-out infinite`,"&::before":{...o$r,inset:0,zIndex:-1},"&::after":{...o$r,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:zl.rainbowPill.text,textShadow:zl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function i$r({children:e}){return(0,OI.jsxs)(OI.Fragment,{children:[(0,OI.jsx)(P3,{styles:x3o}),(0,OI.jsx)(G,{component:"span","data-testid":"rainbow-pill",sx:w3o,children:e})]})}function a$r({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function s$r(e){if(e.length!==2)return!1;let[t,r]=e;return a$r(t)===a$r(r)}var Lw=k(P(),1);function c$r({rateLimits:e}){let t=x0(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=s$r(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:L_e(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,Lw.jsxs)(l$r.Fragment,{children:[a>0?(0,Lw.jsx)(G,{component:"span",sx:{color:xG,mr:.5},children:","}):null,(0,Lw.jsx)(n$r,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,Lw.jsx)(i$r,{children:o}):(0,Lw.jsx)(Lw.Fragment,{children:o})}var I5=k(P(),1);function d$r({groups:e}){return(0,I5.jsx)(I5.Fragment,{children:e.map((t,r)=>(0,I5.jsxs)(u$r.Fragment,{children:[(0,I5.jsx)(G,{component:"span",sx:{color:xG,ml:r>0?1:0,mr:.5},children:Dc(t.harness)}),(0,I5.jsx)(c$r,{rateLimits:t.rateLimits})]},t.harness))})}var f$r={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 C3o(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function k3o(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function _3o(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function m$r(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=Sit(t,r,n);if(o==null)return{kind:"unprojectable"};let i=cx(e,t,r,n),a=C3o(i),s=k3o(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:_3o(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function M_e(e){return t=>t.tokens.color.onAppBar.level[e]}function g$r(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${XW(e.at,t)}`}var M5=k(P(),1),y$r={display:"contents"};function Hit({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,M5.jsxs)(G,{component:"span",sx:y$r,children:[(0,M5.jsx)("span",{}),(0,M5.jsx)("span",{})]});let n=(0,M5.jsx)(G,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,M5.jsxs)(G,{component:"span",sx:{color:M_e(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,M5.jsxs)(G,{component:"span",sx:y$r,children:[r?o:n,r?n:o]})}var v$r={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 D5=k(P(),1);function b$r({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=v$r,a=cx(t,r,n,o),s=m$r(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,D5.jsxs)(G,{sx:i.row,children:[(0,D5.jsx)(G,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,D5.jsx)(Hit,{direction:"back",threshold:l?.recovery}),(0,D5.jsxs)(G,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:M_e(a)},children:[Math.round(t),"%"]}),(0,D5.jsx)(Hit,{direction:"forward",threshold:l?.worse}),(0,D5.jsx)(G,{component:"span",sx:i.note,children:l?l.recovery&&g$r(l.recovery,o):"no projection yet"})]})}function D_e(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 S$r=k(P(),1);function x$r({rateLimits:e,now:t}){return D_e(e).map(r=>(0,S$r.jsx)(b$r,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var BI=k(P(),1);function T$r({groups:e}){let t=x0(3e4),r=f$r;return(0,BI.jsxs)(G,{sx:r.root,children:[e.map(n=>(0,BI.jsxs)(G,{sx:r.group,children:[(0,BI.jsx)(G,{sx:r.heading,children:Dc(n.harness)}),(0,BI.jsx)(x$r,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,BI.jsx)(G,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var Wit=k(P(),1),E3o="Claude account usage (5h / 7d windows) \u2014 view history";function w$r(e){return e.length===0?{title:E3o,content:"Usage"}:{title:(0,Wit.jsx)(T$r,{groups:e}),content:(0,Wit.jsx)(d$r,{groups:e})}}var C$r={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}},k$r={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var Git=k(P(),1),R3o={};function _$r({rateLimits:e,harnessRateLimits:t=R3o}){let{title:r,content:n}=w$r(P_e(e,t));return(0,Git.jsx)(sr,{title:r,placement:"top-start",slotProps:k$r,children:(0,Git.jsx)(Kr,{component:ua,to:"/usage",underline:"none",color:"inherit",sx:C$r,children:n})})}var A$r=k(re(),1);var sh="0.1024.0";var N_e=k(re(),1),Vit=(0,N_e.createContext)(null);function O_e(){return(0,N_e.useContext)(Vit)}var qit=k(P(),1);function E$r(){let e=O_e();return!e||e===sh?null:(0,qit.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${sh}. Restart the daemon to match.`,children:(0,qit.jsx)(v_e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var R$r=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?Tx(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>Tx(t).hover,color:t=>Tx(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>Tx(t).dot,boxShadow:t=>`0 0 0 3px ${Tx(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>Tx(t).readyText}});var C0=k(P(),1);function P$r(){let{entries:e}=d5(),t=nn(),r=(0,A$r.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=fo("openUpdates");if(Xi(n,r),!sh)return null;let i=e.filter(h5).length;return(0,C0.jsxs)(C0.Fragment,{children:[(0,C0.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,C0.jsx)(Cd,{label:"Updates",chords:o}),children:(0,C0.jsxs)(ir,{component:ua,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:R$r(i>0),children:[i>0&&(0,C0.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,C0.jsxs)("span",{children:["v",sh]}),i>0&&(0,C0.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,C0.jsx)(E$r,{})]})}var Iw=k(P(),1);function L$r({socket:e}){return(0,Iw.jsx)(W9r,{start:(0,Iw.jsx)(_$r,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,Iw.jsxs)(Iw.Fragment,{children:[(0,Iw.jsx)(e$r,{}),(0,Iw.jsx)(P$r,{})]})})}var I$r=k(re(),1);var Mw=k(P(),1),A3o=2e4;function M$r(){let{entries:e,refresh:t}=d5(),[r,n]=(0,I$r.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,Mw.jsx)(Iu,{open:a,children:(0,Mw.jsxs)(ro,{severity:"info",variant:"filled",action:(0,Mw.jsxs)(Mw.Fragment,{children:[(0,Mw.jsx)(yt,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,A3o),children:"Install"}),(0,Mw.jsx)(yt,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var U_e=k(re(),1);var z_e=k(re(),1);function D$r(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 N5=k(P(),1),P3o={display:"flex",gap:1,alignItems:"center",minWidth:0},L3o={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},I3o={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},M3o={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function D3o(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function N$r({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,N5.jsx)(Km,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=D3o(o);return(0,N5.jsxs)(Qr,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:P3o,children:[(0,N5.jsx)(u2e,{path:o}),(0,N5.jsxs)(G,{sx:L3o,children:[(0,N5.jsx)(_e,{component:"span",sx:I3o,children:s}),(0,N5.jsx)(_e,{component:"span",color:"text.secondary",sx:M3o,children:a})]})]},o)})})}var B_e=k(P(),1),N3o={maxHeight:420,overflowY:"auto"},O3o={px:2,py:2,fontSize:13};function O$r({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,B_e.jsx)(G,{sx:N3o,children:e?(0,B_e.jsx)(_e,{color:"text.secondary",sx:O3o,children:e}):(0,B_e.jsx)(N$r,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var B$r=k(P(),1),B3o={mt:6,alignSelf:"flex-start"};function $_e({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,B$r.jsx)(Ac,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:B3o},transition:{onEntered:t}},children:n})}var F_e=k(re(),1);var $$r={files:[],loading:!1,error:!1};function F$r(e,t){let[r,n]=(0,F_e.useState)($$r),o=br();return(0,F_e.useEffect)(()=>{if(!e){n($$r);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await tr(Jr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Pr(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var $I=k(P(),1);function $3o(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function z$r({onClose:e}){let{worktreeNode:t}=eo();return(0,$I.jsx)(ec.Provider,{value:t,children:(0,$I.jsx)(F3o,{onClose:e})})}function F3o({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=eo(),[n,o]=(0,z_e.useState)(""),i=F$r(t,n),a=nn(),s=(0,z_e.useRef)(null),l=h=>a($3o(h,t,r)),{highlight:u,setHighlight:d,onKeyDown:f}=w5(i.files,n,l,e),p=h=>{l(h),e()};return(0,$I.jsxs)($_e,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,$I.jsx)(ak,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:f,placeholder:"Search files by name..."}),(0,$I.jsx)(O$r,{message:D$r(t,n,i),files:i.files,highlight:u,onHighlight:d,onSelect:p})]})}function U$r(e){Xi(fo("quickOpen").matches,e)}var W$r=k(P(),1);function H$r(){let[e,t]=(0,U_e.useState)(!1);return U$r((0,U_e.useCallback)(()=>t(!0),[])),e?(0,W$r.jsx)(z$r,{onClose:()=>t(!1)}):null}var H_e=k(P(),1);function G$r({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,H_e.jsx)(Iu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,H_e.jsx)(ro,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,H_e.jsx)(yt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var lne=k(re(),1);function SG(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var nFr=k(re(),1);var V$r=k(P(),1),q$r=nt((0,V$r.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 z3o={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function j$r(e){return e?z3o[e]:"success.main"}function Y$r(e){return e.split("-")[0].split(".").map(Number)}function K$r(e,t){if(!e||!t||e===t)return;let r=Y$r(e),n=Y$r(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 FI=k(P(),1),U3o={height:16,fontSize:10},H3o={opacity:.6,fontSize:"0.85em"};function W3o(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 ane({nodes:e,name:t,showVersion:r=!1}){let n=O_e()??sh,o=e.links.find(a=>a.name===t),i=K$r(o?.peerVersion,n);return(0,FI.jsx)(sr,{title:W3o(e,t),placement:"right",children:(0,FI.jsxs)(G,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,FI.jsx)(q$r,{sx:{fontSize:8,color:j$r(o?.state)}}),t,r&&o?.peerVersion&&(0,FI.jsxs)(G,{component:"span",sx:H3o,children:["v",o.peerVersion]}),i&&(0,FI.jsx)(Zn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:U3o})]})})}var zI=k(P(),1),G3o={opacity:.6},V3o={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function X$r({nodes:e,name:t,clone:r}){let n=(0,zI.jsx)(ane,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,zI.jsx)(G,{component:"span",sx:G3o,children:n}):(0,zI.jsx)(sr,{title:nG(t,r.cloneTarget),children:(0,zI.jsxs)(G,{component:"span",sx:V3o,children:[(0,zI.jsx)(rG,{sx:{fontSize:14}}),n]})})}var Q$r=k(P(),1),q3o={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 Z$r({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,Q$r.jsx)(ir,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:q3o,children:t})}var J$r={ArrowRight:1,ArrowLeft:-1};function j3o(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+J$r[e.key]+r)%r}function eFr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!J$r[o.key]){zT(o);return}let i=j3o(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var tFr=k(re(),1);function TG(e){return e?.querySelector('[aria-checked="true"]')}function rFr(e,t){(0,tFr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=TG(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var jit=k(P(),1),Y3o={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function W_e({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return rFr(i,r),(0,jit.jsx)(_t,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:eFr(t,r,n,l),sx:Y3o,children:t.map(u=>(0,jit.jsx)(Z$r,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var Yit=k(P(),1);function oFr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=Sl(),a=(0,nFr.useRef)(null);return!i||!n||!e?null:(0,Yit.jsx)(W_e,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,Yit.jsx)(X$r,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var G_e=k(P(),1);function iFr({prompt:e,children:t}){return(0,G_e.jsxs)(_t,{children:[e,(0,G_e.jsx)(_t,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var sFr=k(P(),1),K3o=".MuiOutlinedInput-notchedOutline",X3o={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${K3o}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function aFr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,sFr.jsx)(Gn,{sx:X3o,value:e,onChange:a=>t(a.target.value),onKeyDown:zT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var dFr=k(re(),1);var sv={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"}},lFr=Object.keys(sv);var Kit=k(P(),1);function cFr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,Kit.jsx)(_s,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,Kit.jsx)(Qr,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:Dc(i)},i))})}var UI=k(P(),1);function uFr(e){return t=>t==="prompt"&&e?(0,UI.jsxs)(UI.Fragment,{children:["prompt",(0,UI.jsx)(G,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Dc(e)}`}),(0,UI.jsx)(mp,{sx:{fontSize:18,mr:-.75}})]}):t}var HI=k(P(),1);function fFr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,dFr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(TG(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,HI.jsxs)(HI.Fragment,{children:[(0,HI.jsx)(W_e,{label:"Mode",options:lFr,value:e.mode,onChange:l,optionLabel:uFr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,HI.jsx)(cFr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var CFr=k(re(),1);var Xit=k(P(),1),Z3o={zIndex:e=>e.zIndex.modal+1};function pFr({open:e,anchor:t,children:r}){return(0,Xit.jsx)(mD,{open:e,anchorEl:t,placement:"bottom-start",sx:Z3o,children:(0,Xit.jsx)(dn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var hFr=k(P(),1),mFr=nt((0,hFr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var Zit=k(P(),1),Q3o={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},J3o={fontSize:16,color:"text.disabled"};function gFr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:Q3o,endAdornment:(0,Zit.jsx)(C3e,{position:"end",children:(0,Zit.jsx)(mFr,{sx:J3o})})}}}var yFr=k(eD(),1);function vFr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}zT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,yFr.flushSync)(()=>{r(t),n()}),zT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function V_e(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>px(n).toLowerCase().includes(r)):e}var Qit=k(re(),1);function bFr(){let[e,t]=(0,Qit.useState)(!1),[r,n]=(0,Qit.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var SFr=k(re(),1);var xFr=e=>e?px(e):"";function TFr(e){let[t,r]=(0,SFr.useState)(()=>xFr(e));return{text:t,setText:r,showRepo:n=>r(xFr(n))}}function wFr(e,t,r){let n=bFr(),o=TFr(t),i=V_e(e,n.query),a=d=>{r(d),o.showRepo(d)},s=w5(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:vFr({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 wG=k(P(),1);function kFr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=wFr(e,t,r),s=(0,CFr.useRef)(null);return(0,wG.jsxs)(G,{ref:s,sx:{flex:1,minWidth:0},children:[(0,wG.jsx)(Gn,{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:gFr(a.open)}),(0,wG.jsx)(pFr,{open:a.open,anchor:s.current,children:(0,wG.jsx)(f_e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var O5=k(P(),1);function _Fr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=eo();return(0,O5.jsxs)(iFr,{prompt:(0,O5.jsx)(aFr,{value:r.prompt,onChange:r.setPrompt,placeholder:sv[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,O5.jsxs)(_t,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,O5.jsx)(kFr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,O5.jsx)(fFr,{...t})]}),(0,O5.jsx)(oFr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var AFr=k(P(),1),EFr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function RFr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,AFr.jsx)(yt,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var WI=k(P(),1),eRo=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"}),tRo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function PFr(e){return(0,WI.jsxs)(_t,{direction:"row",sx:eRo,children:[EFr.map(([t,r])=>(0,WI.jsxs)("span",{children:[(0,WI.jsx)(G,{component:"kbd",sx:tRo,children:t}),r]},t)),(0,WI.jsx)(G,{sx:{flex:1}}),(0,WI.jsx)(RFr,{...e})]})}var GI=k(re(),1);function LFr(e,t){let r=(0,GI.useRef)(e),n=(0,GI.useRef)(null),o=(0,GI.useRef)(null),i=(0,GI.useRef)(null),a=(0,GI.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:TG(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 rRo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:h_e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function IFr(e,t){let{names:r,visible:n}=Sl(),o=c_e(t,n?r:[void 0]);return{cloneState:o,target:rRo(t,e,o(e))}}function q_e({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}]:[];t_r(sv[e].sessionMode,n,(u,d)=>i.onCreateAssist(u,d,...l),()=>{},r)}function MFr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(t_e(r.prompt,n.onCreateAssist),!0):(q_e({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var j_e=k(re(),1);function DFr(e,t){let[r,n]=(0,j_e.useState)(!1);return(0,j_e.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function NFr(e,t,r,n,o){let i=DFr(e,()=>{MFr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var sne=k(re(),1);function OFr(e,t){let r=(0,sne.useRef)(e),n=(0,sne.useRef)(null);return(0,sne.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 $Fr=k(P(),1),nRo={border:0,margin:0,padding:0,minWidth:0};function BFr({loading:e,restoreFocus:t,children:r}){let n=OFr(e,t);return(0,$Fr.jsx)("fieldset",{disabled:e,style:nRo,onFocus:n,children:r})}var K_e=k(P(),1);function Y_e({error:e,onRetry:t}){return e?(0,K_e.jsxs)(ro,{severity:"error",sx:{mx:2,my:1},action:t&&(0,K_e.jsx)(yt,{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 B5=k(P(),1);function FFr({draft:e,launchers:t,onClose:r}){let n=LFr(e.focus,e.setFocus),o=SG(S0()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=IFr(e.node,e.cwd),l=NFr(e,i,a,t,r);return(0,B5.jsx)($_e,{onClose:r,onEntered:n.restore,centered:!0,children:(0,B5.jsx)("form",{onSubmit:l,children:(0,B5.jsxs)(BFr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,B5.jsx)(_Fr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,B5.jsx)(Y_e,{error:e.modeError,onRetry:e.retryMode}),(0,B5.jsx)(PFr,{submitLabel:a.kind==="clone"?"Clone":sv[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var VI=k(re(),1);async function oRo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await tr(`/api/new-session-defaults${t}`);if(!r.ok)return{error:`HTTP ${r.status}`};let n=await r.json();if(Object.hasOwn(sv,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Pr(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function X_e(e,t=0){let[r,n]=(0,VI.useState)(0),[o,i]=(0,VI.useState)(null),a=(0,VI.useCallback)(()=>n(l=>l+1),[]);if((0,VI.useEffect)(()=>{let l=!1;return oRo(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 Z_e(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function zFr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var $5=k(re(),1);var UFr={field:"prompt",selectionStart:0,selectionEnd:0};function HFr(){let[e,t]=hH("new-session"),[r,n]=(0,$5.useState)(),[o,i]=(0,$5.useState)(),[a,s]=(0,$5.useState)("claude"),[l,u]=(0,$5.useState)(),[d,f]=(0,$5.useState)(UFr),p=(0,$5.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),f(UFr)},[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 WFr(e,t=X_e){let{selectedCwd:r}=eo(),n=Sl(),o=HFr(),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:Z_e(o.mode,a),retryMode:a.retry,node:zFr(o.node,n)}:null}function GFr(e){Xi(fo("newSession").matches,e)}var VFr=k(re(),1);function qFr(e,t){let{selectedCwd:r}=eo(),[n,o]=nl(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,VFr.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 YFr=k(P(),1);function jFr({launchers:e}){let[t,r]=(0,lne.useState)(!1),[n,o]=(0,lne.useState)(0),i=WFr(n),a=(0,lne.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return GFr(a),qFr(i,a),!t||!i?null:(0,YFr.jsx)(FFr,{draft:i,launchers:e,onClose:()=>r(!1)})}var Q_e=k(P(),1);function KFr({reconnecting:e}){return(0,Q_e.jsx)(Iu,{open:e,children:(0,Q_e.jsx)(ro,{severity:"info",variant:"filled",icon:(0,Q_e.jsx)(Ao,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var lv=k(P(),1);function XFr({socket:e,onViewLaunchedSession:t}){return(0,lv.jsxs)(lv.Fragment,{children:[(0,lv.jsx)(H$r,{}),(0,lv.jsx)(jFr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,lv.jsx)(KFr,{reconnecting:e.reconnecting}),(0,lv.jsx)(M$r,{}),(0,lv.jsx)(Tl,{error:e.error,onClose:e.clearError}),(0,lv.jsx)(G$r,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var wx=k(re(),1);var iRo=6e4;function aRo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function J_e(e){let t=e.nodes?.local,r=e.names.join(`
|
|
4062
4062
|
`),[n,o]=(0,wx.useState)([]),i=(0,wx.useRef)(0),a=(0,wx.useCallback)(()=>{let l=r?r.split(`
|
|
4063
4063
|
`):[];if(l.length===0)return;let u=++i.current;o(d=>aRo(d,l,t));for(let d of l)Pke(d,d===t).then(f=>{u===i.current&&o(p=>p.map(h=>h.name===d?f:h))})},[r,t]);(0,wx.useEffect)(()=>{a();let l=setInterval(a,iRo);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,wx.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var F5=k(P(),1);function ZFr({shell:e,children:t}){let{socket:r,selection:n,launch:o,sidebarCollapse:i}=e,a=J_e(r.nodeSelection);return(0,F5.jsx)(fit.Provider,{value:a,children:(0,F5.jsx)(nLe.Provider,{value:i,children:(0,F5.jsx)(nY.Provider,{value:n,children:(0,F5.jsx)(N6e.Provider,{value:r.nodeSelection,children:(0,F5.jsx)(ec.Provider,{value:n.selectedNode,children:(0,F5.jsx)(QXe.Provider,{value:o,children:(0,F5.jsx)(J1t,{children:t})})})})})})})}var QFr=k(P(),1),JFr=nt((0,QFr.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 ezr=k(re(),1);var cv=k(P(),1),sRo={ml:1,textTransform:"none",fontSize:12};function tzr(){let{nodes:e,names:t,visible:r,selected:n,select:o}=Sl(),[i,a]=(0,ezr.useState)(null);return!r||!e||!n?null:(0,cv.jsxs)(cv.Fragment,{children:[(0,cv.jsx)(yt,{size:"small",color:"inherit",startIcon:(0,cv.jsx)(JFr,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:sRo,children:(0,cv.jsx)(ane,{nodes:e,name:n})}),(0,cv.jsx)(_s,{anchorEl:i,open:!!i,onClose:()=>a(null),children:t.map(s=>(0,cv.jsx)(Qr,{selected:s===n,onClick:()=>{o(s),a(null)},sx:{fontSize:13},children:(0,cv.jsx)(ane,{nodes:e,name:s,showVersion:!0})},s))})]})}var cne=k(re(),1);function rzr(e,t){return[...e[0].slice(0,-1),String(t+1)]}var qI=k(P(),1),lRo=[gi("secondary"),{ml:.75}];function nzr({index:e,label:t,count:r,...n}){let{chords:o}=fo("navTab");return(0,qI.jsx)(sr,{describeChild:!0,title:(0,qI.jsx)(Cd,{label:t,chords:[rzr(o,e)]}),children:(0,qI.jsx)(a2,{label:r?(0,qI.jsxs)("span",{children:[t,(0,qI.jsx)(G,{component:"span",sx:lRo,children:r})]}):t,...n})})}var ozr=k(re(),1);var cRo=6e4;function izr(){let e=T2e();return(0,ozr.useEffect)(()=>{Gs.refresh();let t=setInterval(()=>{Gs.refresh()},cRo);return()=>clearInterval(t)},[]),e?.length??0}var Jit=k(re(),1);function azr(e,t){let{bound:r}=fo("navTab"),n=e.length,o=(0,Jit.useCallback)(a=>(fY(a,r)??n)<n,[r,n]),i=(0,Jit.useCallback)(a=>{let s=e[fY(a,r)??-1];s&&t(s)},[e,t,r]);Xi(o,i)}var eEe=k(re(),1);function szr(){let[e,t]=(0,eEe.useState)(!1);return(0,eEe.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await tr("/api/news/nav")).json();r||t(o?.showInNav===!0)}catch(n){Pr(n,"news nav"),r||t(!1)}})(),()=>{r=!0}},[]),e}var tEe=k(re(),1);async function uRo(e,t){let r=await tr(Jr(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function lzr(e){let[t,r]=(0,tEe.useState)(null),n=br(),o=`${n??""}\0${e}`;return(0,tEe.useEffect)(()=>{if(!e)return;let i=!1;return uRo(e,n).catch(a=>{Pr(a,"releases configured")}).then(a=>{i||r({key:o,configured:a})}),()=>{i=!0}},[e,n,o]),t?.key===o?t.configured:void 0}var czr=k(re(),1);function uzr(e){let{pathname:t}=mi(),r=nn(),n=t==="/releases"||t.startsWith("/releases/");(0,czr.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var dRo={path:"/sessions",label:"Sessions"},fRo={path:"/backlog",label:"Backlog"},pRo={path:"/next",label:"Next"},hRo={path:"/releases",label:"Releases"},mRo={path:"/news",label:"News"},gRo={path:"/inbox",label:"Inbox"};function dzr(e,t){return[dRo,fRo,pRo,...e?[hRo]:[],...t?[mRo]:[],gRo]}var eat=k(P(),1),yRo={mx:"6px"};function fzr({cwd:e}){let t=mi(),r=nn(),n=lzr(e),o=szr(),i=izr();uzr(n);let a=n===!0,s=(0,cne.useMemo)(()=>dzr(a,o),[a,o]),l=(0,cne.useMemo)(()=>s.map(f=>f.path),[s]),u=s.findIndex(f=>t.pathname.startsWith(f.path)),d=(0,cne.useCallback)(f=>{t.pathname!==f&&r(f)},[t.pathname,r]);return azr(l,d),(0,eat.jsx)(sR,{sx:yRo,value:u===-1?!1:u,textColor:"inherit",indicatorColor:"secondary",children:s.map((f,p)=>(0,eat.jsx)(nzr,{index:p,label:f.label,count:f.path==="/inbox"?i:void 0,onClick:()=>d(f.path)},f.path))})}var une=k(P(),1),pzr=(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)"}}),vRo=e=>({ml:.75,...e.tokens.color.appBar?pzr("primary.main","primary.contrastText"):pzr("primary.contrastText","primary.main")});function hzr(){let[,e]=nl(),{label:t,chords:r}=fo("newSession");return(0,une.jsx)(sr,{title:(0,une.jsx)(Cd,{label:t,chords:r}),children:(0,une.jsx)(jt,{sx:vRo,"aria-label":"New session",onClick:()=>e(o=>(o.set("new",""),o),{replace:!0}),children:(0,une.jsx)(hp,{})})})}var rEe=k(re(),1);var dne=k(P(),1),bRo={strokeWidth:2};function mzr(e){return(0,dne.jsxs)(mSe,{viewBox:"0 0 24 24",sx:bRo,...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 fne=k(P(),1);function gzr({cwd:e}){let[t,r]=(0,rEe.useState)(null),n=br();return(0,rEe.useEffect)(()=>{if(!e){r(null);return}let o=!1;return(async()=>{try{let a=await(await tr(Jr(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();o||r(a?.url??null)}catch(i){Pr(i,"GitHub URL"),o||r(null)}})(),()=>{o=!0}},[e,n]),t?(0,fne.jsx)(sr,{title:"Open in GitHub",children:(0,fne.jsx)(G,{component:"span",sx:gSe,children:(0,fne.jsx)(jt,{onClick:()=>window.open(t,"_blank"),children:(0,fne.jsx)(mzr,{})})})}):null}var uv=k(P(),1),xRo={color:"inherit",mr:1.5};function yzr({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:o}=y5("webserver",e);return(0,uv.jsxs)(uv.Fragment,{children:[(0,uv.jsx)(sr,{title:"Restart web server",children:(0,uv.jsx)("span",{children:(0,uv.jsx)(jt,{sx:xRo,disabled:t,onClick:o,children:t?(0,uv.jsx)(Ao,{size:24}):(0,uv.jsx)(VU,{})})})}),(0,uv.jsx)(Tl,{error:r,onClose:n})]})}var xzr=k(re(),1);var vzr=k(re(),1);function bzr(e){let t=Rn().palette.primary.main;Xi(fo("focusRepoPicker").matches,(0,vzr.useCallback)(()=>Nc({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var pne=k(P(),1),SRo={width:240,ml:2};function Szr({repos:e,selected:t,onSelect:r}){let n=(0,xzr.useRef)(null);bzr(n);let{chords:o}=fo("focusRepoPicker");return(0,pne.jsx)(G,{ref:n,sx:SRo,children:(0,pne.jsx)(fSe,{label:t?px(t):"Select repo...",tooltip:(0,pne.jsx)(Cd,{label:"Repo",chords:o}),typeToOpen:!0,children:(i,a)=>(0,pne.jsx)(EOr,{repos:e,selected:t,onSelect:r,close:i,initialFilter:a})})})}var Lzr=k(re(),1);var hne=k(re(),1);function nEe(e){let[t,r]=(0,hne.useState)([]),[n,o]=(0,hne.useState)(!0),i=br();return(0,hne.useEffect)(()=>{if(!e){r([]),o(!1);return}let a=!1;return o(!0),tr(Jr(`/api/pr-list?cwd=${encodeURIComponent(e)}`,i)).then(s=>s.json()).then(s=>{a||(r(Array.isArray(s?.prs)?s.prs:[]),o(!1))}).catch(s=>{Pr(s,"open PRs"),!a&&(r([]),o(!1))}),()=>{a=!0}},[e,i]),{prs:t,loading:n}}var tat=k(P(),1);function rat({text:e}){return(0,tat.jsx)(G,{sx:{p:1.5},children:(0,tat.jsx)(_e,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var jI=k(P(),1);function Tzr({pr:e,highlighted:t,onHover:r,onPick:n}){let o=d_e(t);return(0,jI.jsx)(Qr,{ref:o,selected:t,onMouseDown:i=>i.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,jI.jsxs)(_t,{spacing:.25,sx:{minWidth:0},children:[(0,jI.jsxs)(_e,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,jI.jsx)(Zn,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,jI.jsxs)(_e,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",zo(e.createdAt)]})]})})}var nat=k(P(),1);function wzr({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,nat.jsx)(Km,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((o,i)=>(0,nat.jsx)(Tzr,{pr:o,highlighted:i===t,onHover:()=>r(i),onPick:n},o.number))})}var kzr=k(re(),1);function Czr(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 _zr(e,t,r){let[n,o]=(0,kzr.useState)(""),i=Czr(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=w5(i,n,t,r);return{filter:n,setFilter:o,filtered:i,highlight:a,setHighlight:s,onKeyDown:l,select:d=>{t(d),r()}}}var z5=k(P(),1),Ezr={...pH,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function Rzr({cwd:e,onPick:t,close:r}){let{prs:n,loading:o}=nEe(e),i=_zr(n,t,r);return o||n.length===0?(0,z5.jsx)(dn,{elevation:4,sx:Ezr,children:(0,z5.jsx)(rat,{text:o?"Loading open PRs\u2026":"No open PRs"})}):(0,z5.jsxs)(dn,{elevation:4,sx:Ezr,children:[(0,z5.jsx)(ak,{autoFocus:!0,value:i.filter,onChange:i.setFilter,onKeyDown:i.onKeyDown,placeholder:"Filter PRs..."}),i.filtered.length===0?(0,z5.jsx)(rat,{text:"No PRs match"}):(0,z5.jsx)(wzr,{prs:i.filtered,highlight:i.highlight,onHighlight:i.setHighlight,onPick:i.select})]})}var Pzr=k(P(),1);function Azr({cwd:e,onPick:t,close:r}){return(0,Pzr.jsx)(Rzr,{cwd:e,onPick:t,close:r})}var U5=k(P(),1);function Izr({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:o}=nEe(e),[i,a]=(0,Lzr.useState)(null);return o||n.length===0?null:(0,U5.jsxs)(U5.Fragment,{children:[(0,U5.jsx)(fSe,{label:"prs",disabled:t,children:s=>(0,U5.jsx)(Azr,{cwd:e,onPick:a,close:s})}),i&&(0,U5.jsx)(G2e,{pr:i,onSelect:s=>{r(i,s),a(null)},onCancel:()=>a(null)})]})}var Dzr=k(P(),1);function Mzr({onStartRun:e,cwd:t}){let r=cSe(t);return!t||r.length===0?null:(0,Dzr.jsx)(sSe,{runs:r,onSelect:n=>e(n,t)})}var mne=k(P(),1);function Nzr({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=eo();return(0,mne.jsxs)(_t,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:1.5}},children:[(0,mne.jsx)(Izr,{cwd:r,disabled:!r,onSelect:(o,i)=>e([...i,String(o.number)],r,{...l4(o),node:n})}),(0,mne.jsx)(Mzr,{onStartRun:(o,i)=>t(o,i,void 0,void 0,n),cwd:r})]})}var Rm=k(P(),1),TRo={minHeight:48,pl:1,pr:14};function Ozr({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=vk();return(0,Rm.jsxs)(aR,{variant:"dense",disableGutters:!0,sx:TRo,children:[r&&(0,Rm.jsx)(Fce,{collapsed:r,onToggleCollapsed:n}),(0,Rm.jsx)(yzr,{reconnecting:e.reconnecting}),(0,Rm.jsx)(fzr,{cwd:t.selectedCwd}),(0,Rm.jsx)(tzr,{}),(0,Rm.jsx)(Szr,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,Rm.jsxs)(G,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,Rm.jsx)(ySe,{cwd:t.selectedCwd}),(0,Rm.jsx)(gzr,{cwd:t.selectedCwd}),(0,Rm.jsx)(hzr,{})]}),(0,Rm.jsx)(Nzr,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun})]})}var oEe=k(re(),1);function Bzr(){let[e,t]=(0,oEe.useState)(null);return(0,oEe.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await tr("/api/health")).json();!r&&typeof o?.nodeName=="string"&&t(o.nodeName)}catch(n){Pr(n,"node name")}})(),()=>{r=!0}},[]),e}var Fzr=k(P(),1),wRo={lineHeight:"32px",bgcolor:"transparent"};function $zr(){let e=Bzr();return e?(0,Fzr.jsx)(t3e,{sx:wRo,children:e}):null}var zzr=k(P(),1),Uzr=nt((0,zzr.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 Hzr=k(P(),1),Wzr=nt((0,Hzr.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 Gzr=k(P(),1),Vzr=nt((0,Gzr.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 qzr=k(P(),1),jzr=nt((0,qzr.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 oat=k(P(),1);function Yzr({mode:e}){return e==="dark"?(0,oat.jsx)(jzr,{fontSize:"small"}):(0,oat.jsx)(Vzr,{fontSize:"small"})}var Kzr=k(P(),1),Xzr=nt((0,Kzr.jsx)("path",{d:"M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1m-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m4.5-4H7V4h9z"}),"PhoneIphone");var CG=k(P(),1);function Zzr({onClose:e}){let t=nn();return(0,CG.jsxs)(Qr,{onClick:()=>{e(),t("/connect-mobile")},children:[(0,CG.jsx)($v,{children:(0,CG.jsx)(Xzr,{fontSize:"small"})}),(0,CG.jsx)(np,{children:"Connect mobile"})]})}var Qzr=k(P(),1),Jzr=nt((0,Qzr.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 kG=k(P(),1);function eUr(){let e=Q2e();return(0,kG.jsxs)(Qr,{onClick:()=>q5t(!e),children:[(0,kG.jsx)($v,{children:(0,kG.jsx)(Jzr,{fontSize:"small"})}),(0,kG.jsx)(np,{children:e?"Hide render HUD":"Show render HUD"})]})}var fl=k(P(),1);function tUr({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onShowShortcuts:o,onConnectMobile:i,onRestart:a,onUpdate:s}){return[(0,fl.jsxs)(Qr,{onClick:n,children:[(0,fl.jsx)($v,{children:(0,fl.jsx)(Yzr,{mode:e})}),(0,fl.jsx)(np,{children:"Toggle dark mode"})]},"color-mode"),(0,fl.jsx)(eUr,{},"render-hud"),(0,fl.jsxs)(Qr,{onClick:o,children:[(0,fl.jsx)($v,{children:(0,fl.jsx)(Uzr,{fontSize:"small"})}),(0,fl.jsx)(np,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,fl.jsx)(Zzr,{onClose:i},"connect-mobile"),(0,fl.jsx)(ao,{},"restart-divider"),(0,fl.jsxs)(Qr,{onClick:a,children:[(0,fl.jsx)($v,{children:(0,fl.jsx)(p8,{fontSize:"small"})}),(0,fl.jsx)(np,{children:t})]},"restart"),(0,fl.jsxs)(Qr,{onClick:s,children:[(0,fl.jsx)($v,{children:(0,fl.jsx)(Wzr,{fontSize:"small"})}),(0,fl.jsx)(np,{children:r})]},"update")]}var rUr=k(re(),1);var oUr=k(P(),1);function nUr({peer:e,onRestart:t,onClose:r}){let[n,o]=(0,rUr.useState)(!1);return(0,oUr.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 iUr(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 CRo=Object.keys(a8);function aUr(){let e=s8();return iUr(CRo.map(t=>dk(t,e)))}var Am=k(P(),1),kRo={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},_Ro={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function sUr({onClose:e}){let t=aUr();return(0,Am.jsxs)(Ac,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,Am.jsxs)(gd,{id:"shortcuts-dialog-title",sx:kRo,children:["Keyboard shortcuts",(0,Am.jsx)(jt,{size:"small","aria-label":"Close",onClick:e,children:(0,Am.jsx)(Uo,{fontSize:"small"})})]}),(0,Am.jsx)(md,{dividers:!0,children:t.map(r=>(0,Am.jsxs)(G,{component:"section",sx:{mb:1.5},children:[(0,Am.jsx)(_e,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,Am.jsxs)(G,{sx:_Ro,children:[(0,Am.jsx)(_e,{variant:"body2",children:n.label}),(0,Am.jsx)(_t,{direction:"row",spacing:.5,children:(0,Am.jsx)(yce,{chords:n.chords})})]},n.label))]},r.name))})]})}var YI=k(P(),1);function lUr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:o,restart:i}=y5(VW.target,e);return(0,YI.jsxs)(YI.Fragment,{children:[(0,YI.jsx)(Ho,{title:VW.label,message:VW.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{i()},onCancel:t}),(0,YI.jsx)(Tl,{error:n,onClose:o})]})}var uUr=k(P(),1);function ERo(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 cUr({peer:e,onConfirm:t,onClose:r}){return(0,uUr.jsx)(Ho,{...ERo(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var dv=k(re(),1);async function RRo(e){try{let t=await tr(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch(t){return Pr(t,"node doctor"),null}}async function dUr(e,t){let r=await RRo(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var Dw=k(re(),1);function fUr(e){let{nodes:t}=Sl(),[r,n]=(0,Dw.useState)(null),o=(0,Dw.useRef)(!1),i=r?t?.links.find(l=>l.name===r.peer):void 0;(0,Dw.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,Dw.useCallback)((l,u)=>{o.current=!1,n({peer:l,describe:u})},[]),s=(0,Dw.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var ARo=9e4;function iEe(){let[e,t]=(0,dv.useState)(null),[r,n]=(0,dv.useState)(null),o=(0,dv.useRef)(void 0),i=(0,dv.useCallback)(d=>{clearTimeout(o.current),t(d)},[]),{watch:a,stop:s}=fUr(i);(0,dv.useEffect)(()=>()=>clearTimeout(o.current),[]);let l=(0,dv.useCallback)(async(d,f)=>{n(await dUr(d,f))},[]);return{requestThenAwait:(0,dv.useCallback)(async(d,f,p,h)=>{let m;try{m=await p()}catch(g){Pr(g,`${f} ${d}`)}return m?.ok?(a(d,h),clearTimeout(o.current),o.current=setTimeout(()=>{s(),l(d,`${d} did not come back`)},ARo),!0):(await l(d,`${f} failed (${await m5(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var PRo=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function pUr(){let{requestThenAwait:e,...t}=iEe();return{restart:n=>e(n,`Restart ${n}`,()=>g5("both",n),PRo),...t}}var gne=k(re(),1);function aEe(e){return tr(Jr("/api/self-update",e),{method:"POST",timeoutMs:66e4})}var fv=k(re(),1);function hUr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function sEe(e,t,r){let[n,o]=(0,fv.useState)(!1),[i,a]=(0,fv.useState)(!1),s=(0,fv.useRef)(!1),l=(0,fv.useRef)(e);l.current=e;let u=(0,fv.useRef)(new Set),d=(0,fv.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(hUr).map(f=>f.id)),o(!0)},[]);return(0,fv.useEffect)(()=>{if(!n||i)return;if(t){s.current=!0;return}if(!s.current)return;e.some(p=>hUr(p)&&p.node===r&&!u.current.has(p.id))&&a(!0)},[n,i,t,e,r]),{arm:d,completed:i}}var mUr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function gUr(e){let{nodes:t}=Sl(),{launchAssist:r}=Hl(),{requestThenAwait:n,...o}=iEe(),[i,a]=(0,gne.useState)(null),[s,l]=(0,gne.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:d,completed:f}=sEe(e,u(s)!=="connected",s);(0,gne.useEffect)(()=>{!f||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>g5("webserver",s),mUr))},[f,s,n]);let p=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>aEe(m),mUr),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 pv=k(P(),1);function yUr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:o}){let{launchAssist:i,armUpdateReload:a}=Hl(),s=pUr(),l=gUr(r);return(0,pv.jsxs)(pv.Fragment,{children:[e==="shortcuts"&&(0,pv.jsx)(sUr,{onClose:o}),e==="restart"&&t&&(0,pv.jsx)(nUr,{peer:t,onRestart:s.restart,onClose:o}),e==="restart"&&!t&&(0,pv.jsx)(lUr,{reconnecting:n,onClose:o}),e==="update"&&(0,pv.jsx)(cUr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),i(["update"])},onClose:o}),(0,pv.jsx)(Ere,{notices:s}),(0,pv.jsx)(Ere,{notices:l})]})}var vUr=k(P(),1),bUr=nt((0,vUr.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 lEe=k(P(),1),LRo="https://staffordwilliams.com/assist";function xUr(){return(0,lEe.jsx)(sr,{title:"Help",children:(0,lEe.jsx)(jt,{component:"a",href:LRo,target:"_blank",rel:"noopener noreferrer","aria-label":"Help",size:"small",sx:{color:"inherit"},children:(0,lEe.jsx)(bUr,{fontSize:"small"})})})}var SUr=k(P(),1),TUr=nt((0,SUr.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 wUr=k(re(),1);var yne=k(P(),1);function CUr(){let e=nn(),t=(0,wUr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=fo("openConfig");return Xi(r,t),(0,yne.jsx)(sr,{describeChild:!0,title:(0,yne.jsx)(Cd,{label:"Config",chords:n}),children:(0,yne.jsx)(jt,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,yne.jsx)(TUr,{fontSize:"small"})})})}var kUr=k(P(),1),_Ur=nt((0,kUr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var cEe=k(re(),1);var vne=k(P(),1);function EUr({open:e,onOpen:t}){let r=(0,cEe.useRef)(null),{matches:n,chords:o}=fo("openMenu");return Xi(n,(0,cEe.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,vne.jsx)(sr,{describeChild:!0,title:(0,vne.jsx)(Cd,{label:"Menu",chords:o}),children:(0,vne.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,vne.jsx)(_Ur,{fontSize:"small"})})})}var _G=k(P(),1);function RUr({open:e,onOpen:t}){return(0,_G.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,_G.jsx)(xUr,{}),(0,_G.jsx)(CUr,{}),(0,_G.jsx)(EUr,{open:e,onOpen:t})]})}var KI=k(re(),1);var PUr=k(re(),1);var AUr=!0,IRo=new Set(["openMenu","cycleCards"]),MRo=Object.keys(a8).filter(e=>!IRo.has(e));function LUr(e,t){let r=s8();(0,PUr.useEffect)(()=>{if(!e)return;let n=o=>{MRo.some(i=>dk(i,r).matches(o))&&t()};return globalThis.addEventListener("keydown",n,AUr),()=>globalThis.removeEventListener("keydown",n,AUr)},[e,t,r])}function IUr(){let[e,t]=(0,KI.useState)(null),[r,n]=(0,KI.useState)(!0),o=!!e,i=(0,KI.useCallback)(()=>t(null),[]),a=(0,KI.useCallback)(s=>{n(!0),t(s)},[]);return LUr(o,(0,KI.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:o,close:i,openAt:a,restoreFocus:r}}var bne=k(re(),1);function MUr(e){Xi(fo("shortcutsSheet").matches,e)}function DUr(){let[e,t]=(0,bne.useState)(null);MUr((0,bne.useCallback)(()=>t("shortcuts"),[]));let r=(0,bne.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function NUr(){let{nodes:e,selected:t}=Sl();return e&&t&&t!==e.local?t:void 0}function OUr(e){return{restartLabel:e?`Restart ${e}`:VW.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}var Nw=k(P(),1);function BUr({mode:e,toggle:t,sessions:r,reconnecting:n}){let{anchorEl:o,open:i,close:a,openAt:s,restoreFocus:l}=IUr(),{dialog:u,showDialog:d,closeDialog:f}=DUr(),p=NUr(),h=m=>()=>{a(),d(m)};return(0,Nw.jsxs)(Nw.Fragment,{children:[(0,Nw.jsx)(RUr,{open:i,onOpen:s}),(0,Nw.jsxs)(_s,{anchorEl:o,open:i,onClose:a,disableRestoreFocus:!l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,Nw.jsx)($zr,{}),tUr({mode:e,...OUr(p),onToggleColorMode:()=>{t(),a()},onShowShortcuts:h("shortcuts"),onConnectMobile:a,onRestart:h("restart"),onUpdate:h("update")})]}),(0,Nw.jsx)(yUr,{dialog:u,peer:p,sessions:r,reconnecting:n,onClose:f})]})}var zUr=k(re(),1);var FUr=k(P(),1);function $Ur({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:o,port:i,group:a}=e.existing,s=Xa(o),l=i?` on port ${i}`:"",u=s?` in ${s}`:"",d=a?`, holding the ${a} server slot`:"";return(0,FUr.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 uEe=k(P(),1);function UUr({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:o,stopSession:i,startRun:a,discardSession:s}=e,l=(0,zUr.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,uEe.jsxs)(K6e.Provider,{value:l,children:[t,r&&(0,uEe.jsx)($Ur,{conflict:r,onConfirm:u,onCancel:n})]})}var HUr=new Map;function WUr(e,t){if(!kde())return;let r=HUr.get(e);if(HUr.set(e,t),!!r)for(let[n,o]of Object.entries(t))Object.is(o,r[n])||c1(`\u0394 ${e}.${n}`)}var fEe=k(re(),1);function GUr(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||xl(o)!==t?null:n}function Cx(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function dEe(){let{pathname:e}=mi();return e.startsWith("/backlog")||e.startsWith("/usage")}function VUr({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:o,onSelect:i}){let a=Cx(t,r,n),s=a&&xl(a),l=!!(s&&s===e),u=GUr(o,e,r),d=(0,fEe.useRef)(t),f=dEe();(0,fEe.useEffect)(()=>{let p=d.current!==t&&!!s;d.current=t,!(f||p||l||!u)&&i(u)},[t,s,l,u,i,f])}var mEe=k(re(),1);function qUr(e,t,r,n){return Cx(e,t,r)?.cwd||n}function jUr(e,t,r,n){let o=qUr(e,t,r,n.cwd),i=Cx(e,t,r);return{cwd:o,node:i?.cwd?i.node:n.node}}var iat=k(re(),1);function YUr(e,t,r){let{cwd:n,node:o,origin:i}=r,a=(0,iat.useCallback)((l,u)=>{let d=ih(u,t),f=Zre(e,l);return f?f.clones[d]:d===(l===n?o:Xf)?l:void 0},[e,t,n,o]),s=(0,iat.useCallback)(l=>Zre(e,l)?.origin??(l===n?i:void 0),[e,n,i]);return{cloneOn:a,originOf:s}}var pEe=k(re(),1);function KUr(e,t,r,n){let o=(0,pEe.useRef)(e);(0,pEe.useEffect)(()=>{if(o.current===e)return;o.current=e;let i=Zre(t,r)?.clones[e];i&&n(i,e)},[e,t,r,n])}var EG=k(re(),1);function XUr(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(Xf)?Xf:[...n][0]}function ZUr(e,t,r,n){let[o,i]=(0,EG.useState)({cwd:e}),a=(0,EG.useCallback)((l,u,d)=>i({cwd:l,node:u,origin:d}),[]);(0,EG.useEffect)(()=>{e&&!o.cwd&&i({cwd:e})},[e,o.cwd]);let s=XUr(t,{cwd:o.cwd,node:o.node===void 0?void 0:ih(o.node,n)},r);return{selectedCwd:o.cwd,selectedNode:s||void 0,selectedPick:{cwd:o.cwd,node:s,origin:o.origin},setSelectedCwd:a}}var QUr=k(re(),1);function hEe(e,t,r){let n=Cx(e,t,r);return n&&xl(n)}function JUr(e,t,r,n){let o=hEe(e,t,r),i=Cx(e,t,r),a=i?.node??Xf,s=i?.repoGroup?.origin;(0,QUr.useEffect)(()=>{o&&n(o,a,s)},[o,a,s,n])}function eHr(e,t,r,n,o){let i=o.nodes?.local,a=ih(o.selected,i),s=(0,mEe.useMemo)(()=>k5(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:d,setSelectedCwd:f}=ZUr(e,s,a,i);JUr(r,n,t,f),KUr(a,s,l,f);let{cloneOn:p,originOf:h}=YUr(s,i,d),m=(0,mEe.useMemo)(()=>s.map(v=>lBr(v,a)),[s,a]),{cwd:g,node:y}=jUr(r,n,t,{cwd:l,node:u});return(0,mEe.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 yEe=k(re(),1);var H5=k(re(),1);var tHr=k(re(),1),gEe="assist:reloaded-after-update";function rHr(e){(0,tHr.useEffect)(()=>{globalThis.sessionStorage?.getItem(gEe)&&(globalThis.sessionStorage.removeItem(gEe),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function nHr(e,t,r,n){let{arm:o,completed:i}=sEe(e,t),a=(0,H5.useRef)(!1),s=(0,H5.useCallback)(()=>{globalThis.sessionStorage?.setItem(gEe,"1")},[]),{error:l,restart:u}=y5("webserver",t,s);return rHr(r),(0,H5.useEffect)(()=>{l&&n(l)},[l,n]),(0,H5.useEffect)(()=>{!i||a.current||(a.current=!0,u())},[i,u]),{armUpdateReload:(0,H5.useCallback)(()=>{a.current=!1,o()},[o])}}function oHr(e){let{armUpdateReload:t}=nHr(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=t1(e.selectSession),n=(0,yEe.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=nn(),i=(0,yEe.useCallback)(a=>{e.selectSession(a),o("/sessions"),e.clearSuccess()},[o,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:i}}var iHr=k(re(),1);function aHr(e,t,r,n){let o=hEe(e,t,r);(0,iHr.useEffect)(()=>{e&&o&&n({type:"set-active",cwd:o,sessionId:e})},[e,o,n])}var vEe=k(re(),1);function sHr(e,t){let r=(0,vEe.useRef)(new Map);(0,vEe.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 RG=k(re(),1),lHr="assist.sessions.node";function DRo(){try{return localStorage.getItem(lHr)}catch{return null}}function NRo(e){try{localStorage.setItem(lHr,e)}catch{}}function cHr(e){let[t,r]=(0,RG.useState)(DRo),n=(0,RG.useCallback)(o=>{r(o),NRo(o)},[]);return(0,RG.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 dHr=k(re(),1);function uHr(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 fHr(e,t){return(0,dHr.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let o=uHr(r);o&&t(o)},[e,t])}var k0=k(re(),1);function bEe(e,t,r,n,o){e({type:"create",prompt:r||void 0,cwd:n,...t,...o?{node:o}:{}})}function pHr(e){return(t,r,n)=>bEe(e,{design:!0},t,r,n)}function hHr(e){return(t,r,n,o)=>bEe(e,{harness:t},r,n,o)}function mHr(e){return(t,r,n)=>bEe(e,{auto:!0},t,r,n)}function gHr(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function yHr(e){return(t,r,n,o,i)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:o,node:i})}function vHr(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function bHr(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function xHr(e,t){return r=>{e({type:"dismiss",sessionId:r}),t.delete(r)}}function SHr(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function THr(e){return t=>e({type:"stop",sessionId:t})}function wHr(e){return(t,r,n)=>e({type:"transfer",sessionId:t,target:r,cwd:n})}function CHr(e){return t=>e({type:"cancel-transfer",sessionId:t})}function kHr(e){return(t,r,n,o,i)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:o,node:i})}function _Hr(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function EHr(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function RHr(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function AHr(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:bI})}function PHr(e){return(t,r,n,o)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:bI,claim:o==="claim",refresh:o==="refresh"})}function LHr(e){return(t,r,n,o)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...o})}var XI=k(re(),1);function IHr(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function MHr(e){return{createSession:(0,XI.useMemo)(()=>mHr(e),[e]),createSessionInStream:(0,XI.useMemo)(()=>IHr(e),[e]),createDesignSession:(0,XI.useMemo)(()=>pHr(e),[e]),createHarnessSession:(0,XI.useMemo)(()=>hHr(e),[e]),createAssistSession:(0,XI.useMemo)(()=>gHr(e),[e]),resumeSession:(0,XI.useMemo)(()=>yHr(e),[e])}}var xne=k(re(),1);function DHr(e,t){let r=(0,xne.useCallback)((a,s)=>{vHr(e,t.current)(a,s)},[e,t]),n=(0,xne.useCallback)(a=>{bHr(e,t.current)(a)},[e,t]),o=(0,xne.useCallback)(a=>{xHr(e,t.current)(a)},[e,t]),i=(0,xne.useCallback)(a=>{SHr(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:o,discardSession:i}}function NHr(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 OHr(e,t,r){let n={...MHr(e),sendInput:(0,k0.useMemo)(()=>AHr(e),[e]),sendResize:(0,k0.useMemo)(()=>PHr(e),[e]),sendPrDecision:(0,k0.useMemo)(()=>LHr(e),[e]),setAutoApprove:(0,k0.useMemo)(()=>_Hr(e),[e]),setAutoAdvance:(0,k0.useMemo)(()=>EHr(e),[e]),setStarred:(0,k0.useMemo)(()=>RHr(e),[e]),stopSession:(0,k0.useMemo)(()=>THr(e),[e]),startRun:(0,k0.useMemo)(()=>kHr(e),[e]),transferSession:(0,k0.useMemo)(()=>wHr(e),[e]),cancelTransfer:(0,k0.useMemo)(()=>CHr(e),[e])},o=(0,k0.useMemo)(()=>NHr(e,t.current,r.current),[e,t,r]);return{...n,...DHr(e,t),onOutput:o}}var Sne=k(re(),1);function BHr(e,t,r){let n=(0,Sne.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),o=(0,Sne.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),i=(0,Sne.useCallback)(()=>{r(null)},[r]),a=(0,Sne.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:o,clearTranscript:i,selectSession:a}}var wEe=k(re(),1);function $Hr(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 AG=k(re(),1);function FHr(){let[e,t]=(0,AG.useState)(null),r=(0,AG.useRef)(e);r.current=e;let n=(0,AG.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var UHr=k(re(),1);function zHr(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 HHr(e,t,r){let n=dEe();(0,UHr.useEffect)(()=>{if(n){t(null);return}t(o=>zHr(e,o,r))},[e,t,r,n])}var xEe=k(re(),1);function WHr(){let[e,t]=(0,xEe.useState)({}),[r,n]=(0,xEe.useState)(null),[o,i]=(0,xEe.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:o,setNodes:i}}var hv=k(re(),1);function GHr(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function VHr(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function qHr(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 jHr(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 YHr(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var ORo=1500;function KHr(){let[e,t]=(0,hv.useState)(new Set),r=(0,hv.useRef)(new Map),n=(0,hv.useRef)(new Map),o=(0,hv.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),i=(0,hv.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),o(u)},ORo))},[o]);(0,hv.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,hv.useCallback)(s=>{let l=VHr(r.current,s),u=[...jHr(r.current,s),...l],d=YHr(r.current,s);r.current=new Map(s.map(f=>[f.id,f.startedAt])),GHr(n.current,l),u.length&&t(f=>qHr(f,u)),i(d)},[i]);return{initialized:e,markInitialized:o,syncSessions:a}}var W5=k(re(),1);function XHr(){let[e,t]=(0,W5.useState)(null),[r,n]=(0,W5.useState)(null),[o,i]=(0,W5.useState)(null),a=(0,W5.useCallback)(()=>t(null),[]),s=(0,W5.useCallback)(()=>n(null),[]),l=(0,W5.useCallback)(()=>i(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:o,setServerConflict:i,clearServerConflict:l}}var kx=k(re(),1);function ZHr(e,t){return[...e,{...t,status:"launching"}]}function SEe(e){return e.find(t=>t.status==="launching")}function QHr(e){let t=SEe(e);return t?e.filter(r=>r.id!==t.id):e}function JHr(e,t){let r=SEe(e);return r?aat(e,r.id,t):e}function aat(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function eWr(e,t){return e.filter(r=>r.id!==t)}var tWr=k(re(),1);var BRo=6e4,$Ro="Launch timed out \u2014 the session did not start.";function rWr(e,t){(0,tWr.useEffect)(()=>{let r=e.filter(o=>o.status==="launching");if(r.length===0)return;let n=r.map(o=>setTimeout(()=>t(i=>aat(i,o.id,$Ro)),Math.max(0,BRo-(Date.now()-o.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function nWr(){let[e,t]=(0,kx.useState)([]),r=(0,kx.useRef)([]),n=(0,kx.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),o=(0,kx.useCallback)(l=>{n(u=>ZHr(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),i=(0,kx.useCallback)(()=>{let l=SEe(r.current);return n(QHr),l?.named?l.title:void 0},[n]),a=(0,kx.useCallback)(l=>n(u=>JHr(u,l)),[n]),s=(0,kx.useCallback)(l=>n(u=>eWr(u,l)),[n]);return rWr(e,n),{pendingLaunches:e,addPendingLaunch:o,resolvePendingLaunch:i,failPendingLaunch:a,dismissPendingLaunch:s}}var Tne=k(re(),1);function oWr(){let[e,t]=(0,Tne.useState)(null),[r,n]=(0,Tne.useState)({}),o=(0,Tne.useCallback)((i,a)=>{i!=="claude"&&n(s=>({...s,[i]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:o}}var iWr=k(re(),1);function aWr(e,t){return(0,iWr.useCallback)(r=>{e(r),t(r)},[e,t])}var sat=k(re(),1);function sWr(){let e=(0,sat.useRef)(new Map),t=(0,sat.useRef)(new Map);return{buffers:e,handlers:t}}var TEe=k(re(),1);function lWr(){let[e,t]=(0,TEe.useState)(null),[r,n]=(0,TEe.useState)(null),[o,i]=(0,TEe.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:o,setUserMessages:i}}var G5=k(re(),1);function cWr(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function uWr(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 dWr(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function fWr(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function pWr(e,t){t.setNodes({local:e.local,links:e.links??[]})}function hWr(e,t){t.setSuccess({message:e.message,sessionId:null})}function mWr(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 gWr(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function yWr(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function vWr(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var FRo={sessions:yWr,created:uWr,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:pWr,error:dWr,notice:hWr,inbox:()=>{Gs.refresh(),Gs.refreshStatus()},"inbox-activity":()=>{Gs.refreshStatus()},"run-conflict":gWr,limits:fWr,clear:cWr,output:mWr,snapshot:vWr};function bWr(e,t){FRo[e.type]?.(e,t)}function xWr(e,t={}){let r=new WebSocket(xbt("/ws"));return r.onopen=()=>{t.onOpen?.(),r.send(JSON.stringify({type:"hello"})),r.send(JSON.stringify({type:"history"}))},r.onmessage=n=>{bWr(JSON.parse(n.data),e)},r.onclose=()=>t.onClose?.(),r}function SWr(e,t,r,n){let o=!1,i,a=0,s=!1,l=()=>{o||t(xWr(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 TWr(e){let t=(0,G5.useRef)(null),[r,n]=(0,G5.useState)(!1),{handleSessions:o,markInitialized:i,buffers:a,handlers:s}=e;(0,G5.useEffect)(()=>{let u=()=>{a.current?.clear();let f=s.current;if(f)for(let p of f.values())p("\x1Bc")},d=SWr({...e,setSessions:o},f=>{t.current=f},u,n);return()=>{d(),t.current?.close()}},[o,i,a,s]);let l=(0,G5.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function wWr(){let[e,t]=(0,wEe.useState)([]),[r,n]=(0,wEe.useState)([]),{activeId:o,setActiveId:i,getActiveId:a}=FHr(),s=WHr(),l=lWr(),[u,d]=(0,wEe.useState)(""),f=XHr(),p=nWr(),h=oWr(),{initialized:m,markInitialized:g,syncSessions:y}=KHr(),v=sWr(),b=aWr(y,t),{wsRef:x,requestHistory:T,reconnecting:w}=TWr({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:i,...s,...l,setCurrentCwd:d,...f,...p,...h,markInitialized:g,...v});return HHr(e,i,$Hr(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 CEe(){let e=wWr(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:o,activeId:i,sessions:a}=e,s=cHr(e.nodes),l=fHr(t,o),u=OHr(l,r,n);aHr(i,a,e.history,l),sHr(a,l);let d=BHr(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...d,nodeSelection:s}}var PG=k(re(),1);var CWr="assist:sidebar-collapsed";function kWr(){let[e,t]=(0,PG.useState)(()=>Ul(CWr).length>0),r=(0,PG.useCallback)(()=>{t(n=>{let o=!n;return ru(CWr,o?[!0]:[]),o})},[]);return(0,PG.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var _Wr=k(re(),1);function EWr(){(0,_Wr.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await tr("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||$R.set(r)}catch(t){Pr(t,"hotkey bindings")}})(),()=>{e=!0}},[])}function RWr(){let e=CEe(),t=t2e(e),r=eHr(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);VUr({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:o}=oHr(e);EWr();let i=kWr();return WUr("shell",{...e,selection:r,launch:n,sidebarCollapse:i}),{socket:e,selection:r,launch:n,viewLaunchedSession:o,sidebarCollapse:i}}var Pm=k(P(),1),zRo={zIndex:e=>e.zIndex.drawer+1},URo={minHeight:48};function PWr({mode:e,toggle:t}){let r=RWr(),{socket:n,selection:o,viewLaunchedSession:i}=r,{nodes:a,transferSession:s,cancelTransfer:l}=n,u=(0,AWr.useMemo)(()=>({nodes:a,transfer:s,cancel:l}),[a,s,l]);return(0,Pm.jsx)(ZFr,{shell:r,children:(0,Pm.jsxs)(Vit.Provider,{value:n.daemonVersion,children:[(0,Pm.jsx)(BUr,{mode:e,toggle:t,sessions:n.sessions,reconnecting:n.reconnecting}),(0,Pm.jsx)(F5e,{position:"fixed",sx:zRo,"data-testid":"toolbar",children:(0,Pm.jsx)(Ozr,{socket:n,selection:o})}),(0,Pm.jsx)(aR,{variant:"dense",sx:URo}),(0,Pm.jsx)(g6e.Provider,{value:u,children:(0,Pm.jsx)(UUr,{socket:n,children:(0,Pm.jsx)(z9r,{socket:n})})}),(0,Pm.jsx)(L$r,{socket:n}),(0,Pm.jsx)(XFr,{socket:n,onViewLaunchedSession:i})]})})}function MWr(e){return e instanceof Error?e.message:String(e)}function HRo(e){return e.filename?` (${e.filename}:${e.lineno}:${e.colno})`:""}function LWr(e){Jj(e.error)||(MR(e.error),eY("error",`${e.message||MWr(e.error)}${HRo(e)}`))}function IWr(e){Jj(e.reason)||(MR(e.reason),eY("rejection",MWr(e.reason)))}function DWr(){return globalThis.addEventListener("error",LWr),globalThis.addEventListener("unhandledrejection",IWr),()=>{globalThis.removeEventListener("error",LWr),globalThis.removeEventListener("unhandledrejection",IWr)}}var NWr=k(re(),1);function OWr(){let[e,t]=(0,NWr.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 BWr({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 $Wr(e){let{color:t,radius:r,elevation:n,type:o}=e,i={border:`1px solid ${t.line}`};return{...BWr(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 FWr=({variant:e})=>e==="outlined"||e==="tonal",zWr=[{props:{size:"small"},style:{minHeight:26,padding:"4px 9px",fontSize:12}},{props:FWr,style:{padding:"5px 11px"}},{props:e=>FWr(e)&&e.size==="small",style:{padding:"3px 8px"}}];var kEe=["primary","secondary","success","warning","error","info","check"];function wne(e,t){return{backgroundColor:Hr(e,t),borderColor:Hr(e,.35),color:e}}function UWr({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}}},...kEe.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...wne(e[t].main,.16),"&:hover":wne(e[t].main,.24)}}))]}var HWr={"& > *:nth-of-type(1)":{fontSize:16}};function WWr(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,...HWr},endIcon:{marginLeft:6,marginRight:-2,...HWr}},variants:[...zWr,{props:{variant:"text",color:"primary"},style:{color:t.text.secondary,"&:hover":{backgroundColor:t.raised,color:t.text.primary}}},...UWr(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 lat({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}}},...kEe.map(r=>({props:{variant:t,color:r},style:{...wne(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 GWr(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:[...lat(e,"tonal"),...lat(e,"filled")]}}}function VWr(e){return{...WWr(e),MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},...GWr(e)}}var cat=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`,WRo={".MuiAppBar-root &":{color:"inherit","&:hover":{backgroundColor:cat(8)},"&.Mui-selected":{color:"inherit",backgroundColor:cat(12),boxShadow:`inset 0 0 0 1px ${cat(18)}`}}};function qWr({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&&WRo}}}}}var jWr=(e,t)=>({width:e,height:e,"& .MuiSvgIcon-root":{fontSize:t}});function YWr({color:e,radius:t,density:r}){let{side:n,icon:o,smallSide:i,smallIcon:a}=r.iconButton;return{MuiIconButton:{styleOverrides:{root:{...jWr(n,o),padding:0,borderRadius:t.sm,"&:hover":{backgroundColor:e.raised}}},variants:[{props:{size:"small"},style:jWr(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 KWr({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 _Ee=".MuiOutlinedInput-notchedOutline";function XWr({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,[`& ${_Ee}`]:{borderColor:e.line},[`&:hover ${_Ee}`]:{borderColor:e.text.disabled},[`&.Mui-focused ${_Ee}`]:{borderColor:e.primary.main,borderWidth:1},[`&.Mui-error ${_Ee}`]:{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 ZWr({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 QWr(e){let{appBar:t}=e.color;return{...$Wr(e),...VWr(e),...YWr(e),...KWr(e),...XWr(e),...ZWr(e),...qWr(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 mv="#0e1116",uat="#141820",EEe="#1b202a",REe="#e3e7ee",dat="#8a93a3",Cne="#8b9cff",AEe="#5fd0a0",PEe="#f2b45a",LEe="#f27a7a",JWr="#6cc8d8",eGr={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)"},IEe={dark:{color:{background:mv,surface:uat,raised:EEe,line:"#262c37",lineSoft:"#1d222b",text:{primary:REe,secondary:dat,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:mv,stripe:EEe,codeWash:"rgba(255, 255, 255, 0.08)",overlay:{background:EEe,text:REe},scrim:"rgba(0, 0, 0, 0.5)",appBar:{background:uat,text:REe},onAppBar:{...eGr,secondary:dat,level:{ok:AEe,warn:PEe,over:LEe}},statusBar:{background:uat,text:dat,hoverText:REe,secondary:"#5c6473",hover:EEe,active:"transparent",dot:Cne,dotRing:"rgba(139, 156, 255, 0.14)",readyText:Cne,level:{ok:AEe,warn:PEe,over:LEe}},primary:{main:Cne,contrastText:mv},secondary:{main:"#c99bff",contrastText:mv},success:{main:AEe,contrastText:mv},warning:{main:PEe,contrastText:mv},error:{main:LEe,contrastText:mv},info:{main:"#6cb6ff",contrastText:mv},check:{main:JWr,contrastText:mv}},terminal:{background:mv,foreground:"#d6dbe4",cursor:Cne,cursorAccent:mv,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:LEe,green:AEe,yellow:PEe,blue:Cne,magenta:"#c99bff",cyan:JWr,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:{...eGr,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 Ow=e=>`${e/16}rem`;function tGr({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:Ow(r.button)},caption:{fontSize:Ow(r.caption)},body2:{fontSize:Ow(r.body2)},body1:{fontSize:Ow(r.body1)},subtitle2:{fontSize:Ow(r.subtitle2)},subtitle1:{fontSize:Ow(r.subtitle1)},h6:{fontSize:Ow(r.h6)},h5:{fontSize:Ow(r.h5)},h4:{fontSize:Ow(r.h4)}}}function rGr(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}function GRo(e,t){let{dark:r,light:n,densities:o,...i}=IEe;return{...i,...e==="dark"?r:n,mode:e,density:o[t]}}function nGr(e,t="desktop"){let r=GRo(e,t),{color:n}=r;return Iv({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:tGr(r),shape:{borderRadius:r.radius.sm},spacing:r.spacing,components:{...rGr(r),...QWr(r)}})}function oGr(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=IEe;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var SVr=k(re(),1);var V5=k(P(),1);function iGr({status:e,onClose:t}){return(0,V5.jsxs)(V5.Fragment,{children:[(0,V5.jsx)(Iu,{open:e.kind==="probing",children:(0,V5.jsx)(ro,{severity:"info",variant:"filled",children:e.kind==="probing"?`Connecting to ${e.name}\u2026`:""})}),(0,V5.jsx)(Tl,{error:e.kind==="error"?e.message:null,onClose:t})]})}var DEe=k(re(),1);var VRo=/^\d+(\.\d+){3}$/;function ZI(e){try{let{hostname:t}=new URL(e);return VRo.test(t)?t:t.split(".")[0]}catch{return""}}var qRo=/^[a-z]+:[/]{2}/i;function MEe(e){let t=e.trim(),r=qRo.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 jRo(e){try{return new URL(e)}catch{return}}function YRo(e){return e.protocol==="assist:"&&e.hostname==="add-node"&&(e.pathname===""||e.pathname==="/")}function aGr(e){let t=jRo(e);if(!t||!YRo(t))return{ok:!1,error:`Not an assist add-node link: ${e}`};let r=t.searchParams.get("url"),n=r?MEe(r):void 0;return n?{ok:!0,node:{name:t.searchParams.get("name")?.trim()||ZI(n),url:n}}:{ok:!1,error:`The link has no valid node URL: ${r??"(missing)"}`}}var sGr=5e3,lGr="/api/health";async function KRo(e){let t=new AbortController,r=setTimeout(()=>t.abort(),sGr);try{let n=await fetch(`${e}${lGr}`,{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 ${sGr/1e3}s`}:{ok:!1,error:n instanceof Error?n.message:String(n)}}finally{clearTimeout(r)}}async function q5(e){let t=Date.now(),r=await KRo(e);return r.ok||X7({at:new Date(t).toISOString(),method:"GET",path:lGr,base:e,status:r.status,error:r.status===void 0?r.error:void 0,durationMs:Date.now()-t}),r}async function cGr(e,t){let r=aGr(e);if(!r.ok)return r;let{node:n}=r;t(n);let o=await q5(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}`}}QI();var gat=$w("App",{web:()=>Promise.resolve().then(()=>(mGr(),hGr)).then(e=>new e.AppWeb)});var IG=k(re(),1);var nAo=5e3;function gGr(e){let t=(0,IG.useRef)(e),r=(0,IG.useRef)(void 0);(0,IG.useEffect)(()=>{t.current=e},[e]),(0,IG.useEffect)(()=>{let n=i=>{let a=Date.now(),s=r.current?.url===i&&a-r.current.at<nAo;r.current={url:i,at:a},s||t.current(i)},o=gat.addListener("appUrlOpen",({url:i})=>n(i));return gat.getLaunchUrl().then(i=>{i?.url&&n(i.url)}).catch(i=>Pr(i,"launch url")),()=>{o.then(i=>i.remove())}},[])}function yGr(e){let[t,r]=(0,DEe.useState)({kind:"idle"});gGr(async o=>{let i=await cGr(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,DEe.useCallback)(()=>r({kind:"idle"}),[]);return{status:t,dismiss:n}}var Ene=k(P(),1);function vGr({name:e}){return(0,Ene.jsxs)(G,{sx:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,bgcolor:"background.default"},children:[(0,Ene.jsx)(Ao,{size:28}),(0,Ene.jsxs)(_e,{variant:"body2",color:"text.secondary",children:["Connecting to ",e??"home node","\u2026"]})]})}var NEe=k(re(),1),yat=(0,NEe.createContext)(null);function j5(){return(0,NEe.useContext)(yat)}var ws={top:"env(safe-area-inset-top, 0px)",bottom:"env(safe-area-inset-bottom, 0px)"};var xGr=k(P(),1);function bGr({value:e,error:t,onChange:r}){return(0,xGr.jsx)(Gn,{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 Rne=k(re(),1);function SGr(e,t){let[r,n]=(0,Rne.useState)(e?.url??""),[o,i]=(0,Rne.useState)(e?.name),[a,s]=(0,Rne.useState)(),[l,u]=(0,Rne.useState)(!1),d=MEe(r),f=o??(d?ZI(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()||ZI(d),url:d});u(!1),s(g)}}}var MG=k(P(),1);function OEe({initial:e,submitLabel:t,onSubmit:r,children:n}){let o=SGr(e,r);return(0,MG.jsxs)(_t,{component:"form",spacing:2,onSubmit:o.submit,children:[(0,MG.jsx)(bGr,{value:o.url,error:o.error,onChange:o.changeUrl}),(0,MG.jsx)(Gn,{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,MG.jsx)(yt,{type:"submit",variant:"contained",size:"large",disabled:!o.url.trim()||o.busy,children:o.busy?"Checking\u2026":t}),n]})}var Fw=k(P(),1),oAo={height:"100%",boxSizing:"border-box",overflowY:"auto",display:"flex",justifyContent:"center",pt:`calc(${ws.top} + 28px)`,pb:`calc(${ws.bottom} + 24px)`,px:2.5,bgcolor:"background.default"},iAo={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 TGr({onConnect:e}){return(0,Fw.jsx)(G,{sx:oAo,children:(0,Fw.jsxs)(_t,{spacing:2.5,sx:{width:"100%",maxWidth:420},children:[(0,Fw.jsx)(G,{sx:iAo,children:">_"}),(0,Fw.jsx)(_e,{variant:"h5",sx:{fontWeight:700},children:"Connect to a home node"}),(0,Fw.jsxs)(_e,{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,Fw.jsx)("code",{children:"assist sessions web"})," is running on that machine."]}),(0,Fw.jsx)(OEe,{submitLabel:"Connect",onSubmit:async r=>{let n=await q5(r.url);if(!n.ok)return`Can't reach ${r.url}: ${n.error}`;e(r,n.health)}})]})})}var sVr=k(re(),1);var gv=k(P(),1),aAo={flex:"none",pt:ws.top,bgcolor:"background.default"},sAo={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},lAo={height:e=>e.tokens.density.bar,display:"flex",alignItems:"center",gap:.5,px:.5},cAo={textAlign:"center",minWidth:0,maxWidth:220,fontSize:15,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},uAo={flex:1,minWidth:0,fontSize:15,fontWeight:600,lineHeight:1.25,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",overflowWrap:"anywhere"};function mu({left:e,title:t,right:r,leadingTitle:n}){return(0,gv.jsx)(G,{component:"header",sx:aAo,children:n?(0,gv.jsxs)(G,{sx:lAo,children:[(0,gv.jsx)(G,{sx:{flex:"none"},children:e}),(0,gv.jsx)(G,{component:"h1",sx:[uAo,{m:0}],children:t}),(0,gv.jsx)(G,{sx:{flex:"none",display:"flex"},children:r})]}):(0,gv.jsxs)(G,{sx:sAo,children:[(0,gv.jsx)(G,{sx:{justifySelf:"start",minWidth:0},children:e}),(0,gv.jsx)(G,{sx:cAo,children:t}),(0,gv.jsx)(G,{sx:{justifySelf:"end",display:"flex",gap:.25},children:r})]})})}var _x=e=>e.tokens.color.raised;var wGr=k(P(),1),dAo={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 _0({tone:e}){return(0,wGr.jsx)(G,{component:"span",sx:{width:8,height:8,flex:"none",borderRadius:"50%",bgcolor:dAo[e]}})}var Sc=e=>e.tokens.density.target;var DG=k(P(),1),fAo={display:"inline-flex",alignItems:"center",gap:.75,height:Sc,pl:1.125,pr:.75,borderRadius:"24px",border:1,borderColor:"divider",bgcolor:_x,color:"text.primary",fontFamily:"fontFamilyMono",fontSize:13,maxWidth:140,justifyContent:"flex-start"},pAo={minWidth:0,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"};function BEe({name:e,tone:t,onClick:r}){return(0,DG.jsxs)(ir,{sx:fAo,onClick:r,disabled:!r,"aria-label":"Nodes","data-testid":"phone-node-chip",children:[(0,DG.jsx)(_0,{tone:t}),(0,DG.jsx)(G,{component:"span",sx:pAo,children:e??"\u2026"}),r&&(0,DG.jsx)(ya,{sx:{fontSize:16,flex:"none"}})]})}var tVr=k(re(),1);var $Ee=k(P(),1);function CGr({homeNode:e,node:t,onDone:r}){let n=!!t&&t.url===e.home?.url;return(0,$Ee.jsx)(G,{sx:{px:2.5,pt:1},children:(0,$Ee.jsx)(OEe,{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,$Ee.jsx)(yt,{color:"error",size:"large",disabled:n,onClick:()=>{e.removeNode(t.url),r()},children:n?"Switch home node to delete this one":"Delete node"})})})}var kGr=k(P(),1),hAo={width:36,height:5,borderRadius:"3px",bgcolor:"text.disabled",opacity:.5,mx:"auto",mb:.75};function NG(){return(0,kGr.jsx)(G,{sx:hAo})}var zw=k(P(),1),mAo={display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,px:2,pt:.75,pb:1.25},gAo={color:"primary.main",fontSize:16,minHeight:Sc,px:.5,borderRadius:1};function OG({title:e,actionLabel:t,onAction:r}){return(0,zw.jsxs)(zw.Fragment,{children:[(0,zw.jsx)(NG,{}),(0,zw.jsxs)(G,{sx:mAo,children:[(0,zw.jsx)(G,{component:"b",sx:{fontSize:17,fontWeight:600},children:e}),(0,zw.jsx)(ir,{sx:gAo,onClick:r,children:t})]})]})}var JI=k(P(),1);function _Gr({homeNode:e,node:t,onDone:r}){return(0,JI.jsxs)(JI.Fragment,{children:[(0,JI.jsx)(OG,{title:t?"Edit node":"Add node",actionLabel:"Cancel",onAction:r}),(0,JI.jsx)(CGr,{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:Sc,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 EGr(e,t){return e.replace(/\/+$/,"")===t.replace(/\/+$/,"")}function BG(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 RGr(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?BG(e.peerVersion,r):0;return{text:o.filter(Boolean).join(" \xB7 "),drift:i<0?"behind":i>0?"ahead":void 0}}var FEe={connected:"ok",connecting:"warn",disconnected:"error","version-blocked":"error"};var vat=k(P(),1);function AGr({name:e,onSave:t}){return(0,vat.jsx)(jt,{"aria-label":`Save ${e} as a home node`,onClick:t,sx:{color:"primary.main",borderRadius:0},children:(0,vat.jsx)(hp,{fontSize:"small"})})}var Uw=k(P(),1),yAo={fontFamily:"fontFamilyMono",fontSize:12,px:.75,border:1,borderColor:"currentColor",borderRadius:"4px",color:"warning.main"};function PGr({links:e,sessions:t,homeVersion:r,isSaved:n,onSave:o}){return(0,Uw.jsx)(G,{sx:Or.group,children:e.map(i=>{let{text:a,drift:s}=RGr(i,t,r);return(0,Uw.jsxs)(G,{sx:[Or.item,{pr:0}],children:[(0,Uw.jsx)(_0,{tone:FEe[i.state]}),(0,Uw.jsxs)(G,{component:"span",sx:Or.grow,children:[i.name,(0,Uw.jsx)(G,{component:"span",sx:Or.detail,children:a})]}),s&&(0,Uw.jsx)(G,{component:"span",sx:yAo,children:s}),!n(i.url)&&(0,Uw.jsx)(AGr,{name:i.name,onSave:()=>o(i)})]},i.name)})})}var Ex=k(P(),1);function $G({title:e,rows:t}){return(0,Ex.jsxs)(Ex.Fragment,{children:[(0,Ex.jsx)(G,{sx:Or.label,children:e}),(0,Ex.jsx)(G,{sx:Or.group,children:t.map(r=>(0,Ex.jsxs)(G,{sx:Or.item,children:[(0,Ex.jsx)(G,{component:"span",sx:Or.grow,children:r.label}),(0,Ex.jsx)(G,{component:"span",sx:[Or.end,{fontFamily:"fontFamilyMono"},r.color?{color:r.color}:{}],children:r.value})]},r.key))})]})}var IGr=k(P(),1);function LGr({rateLimits:e,harnessRateLimits:t}){let r=x0(3e4),n=P_e(e,t).flatMap(o=>D_e(o.rateLimits).map(i=>({key:`${o.harness}-${i.label}`,label:`${Dc(o.harness)} \xB7 ${i.label}`,value:i.resetsAt!=null?`${Math.round(i.pct)}% \xB7 ${XW(i.resetsAt,r)}`:`${Math.round(i.pct)}%`,color:Uke(cx(i.pct,i.resetsAt,i.windowSeconds,r))})));return n.length===0?null:(0,IGr.jsx)($G,{title:"Rate limits",rows:n})}var Rx=k(P(),1);function MGr({status:e,homeVersion:t,homeNode:r}){let n=e.nodes?.links??[];return(0,Rx.jsxs)(Rx.Fragment,{children:[n.length>0&&(0,Rx.jsxs)(Rx.Fragment,{children:[(0,Rx.jsxs)(G,{sx:Or.label,children:["Linked through ",e.nodes?.local]}),(0,Rx.jsx)(PGr,{links:n,sessions:e.sessions,homeVersion:t,isSaved:o=>r.nodes.some(i=>EGr(i.url,o)),onSave:({name:o,url:i})=>r.saveNode("",{name:o,url:i})})]}),(0,Rx.jsx)(LGr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var vAo={ok:"ok",ready:"warn",diverged:"warn",retrying:"warn",paused:"off",off:"off",loading:"off",unavailable:"error"};function zEe(e,t){let r=v0(e),{status:n}=e,o=!!n&&!!t&&BG(t,n.built)>0,i=h5(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":vAo[r.kind],detail:[a,s].filter(Boolean).join(" \xB7 "),updateAvailable:o,restartPending:i}}var Lm=k(P(),1);function DGr({updates:e,onOpen:t}){let{entries:r,latest:n,notices:o}=e;return r.length===0?null:(0,Lm.jsxs)(Lm.Fragment,{children:[(0,Lm.jsx)(G,{sx:Or.label,children:"Updates"}),(0,Lm.jsx)(G,{sx:Or.group,children:r.map(i=>{let a=zEe(i,n),s=o.busy[i.name];return(0,Lm.jsxs)(ir,{sx:Or.item,onClick:()=>t(i.name),"data-testid":`phone-update-row-${i.name}`,children:[(0,Lm.jsx)(_0,{tone:a.tone}),(0,Lm.jsxs)(G,{component:"span",sx:Or.grow,children:[i.name,(0,Lm.jsx)(G,{component:"span",sx:Or.detail,children:a.detail})]}),(0,Lm.jsxs)(G,{component:"span",sx:Or.end,children:[s&&`${s}\u2026`,(0,Lm.jsx)(Wo,{})]})]},i.name)})})]})}var Ane=k(P(),1);function UEe({onAdd:e}){return(0,Ane.jsxs)(ir,{sx:Or.item,onClick:e,children:[(0,Ane.jsx)(hp,{sx:{color:"primary.main"}}),(0,Ane.jsx)(G,{component:"span",sx:{color:"primary.main"},children:"Add node URL"})]})}function Ax(e){try{return new URL(e).host}catch{return e}}function HEe(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 WEe=k(re(),1);var bAo=15e3;function GEe(e){let[t,r]=(0,WEe.useState)({}),n=e.join(`
|
|
4064
4064
|
`);return(0,WEe.useEffect)(()=>{if(!n)return;let o=!1,i=()=>{for(let s of n.split(`
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.1024.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -25701,6 +25701,13 @@ function getVersionAtCommit(hash) {
|
|
|
25701
25701
|
}
|
|
25702
25702
|
}
|
|
25703
25703
|
|
|
25704
|
+
// src/commands/devlog/next/repoHasTags.ts
|
|
25705
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
25706
|
+
function repoHasTags() {
|
|
25707
|
+
const output = execFileSync8("git", ["tag", "--list"], { encoding: "utf8" });
|
|
25708
|
+
return output.trim().length > 0;
|
|
25709
|
+
}
|
|
25710
|
+
|
|
25704
25711
|
// src/commands/devlog/stripToMinor.ts
|
|
25705
25712
|
import semver2 from "semver";
|
|
25706
25713
|
function stripToMinor(version2) {
|
|
@@ -25708,13 +25715,21 @@ function stripToMinor(version2) {
|
|
|
25708
25715
|
return parsed ? `v${parsed.major}.${parsed.minor}` : `v${version2}`;
|
|
25709
25716
|
}
|
|
25710
25717
|
|
|
25711
|
-
// src/commands/devlog/next/
|
|
25712
|
-
function withVersions(commits2) {
|
|
25713
|
-
|
|
25714
|
-
|
|
25715
|
-
|
|
25718
|
+
// src/commands/devlog/next/withVersions.ts
|
|
25719
|
+
function withVersions(commits2, versionAt, hasTags) {
|
|
25720
|
+
const raw = commits2.map((commit2) => versionAt(commit2.hash));
|
|
25721
|
+
const distinct = new Set(raw.filter((v) => v !== null));
|
|
25722
|
+
const unversioned = !hasTags && distinct.size <= 1;
|
|
25723
|
+
return commits2.map((commit2, i) => {
|
|
25724
|
+
const version2 = raw[i];
|
|
25725
|
+
return {
|
|
25726
|
+
...commit2,
|
|
25727
|
+
version: !unversioned && version2 ? stripToMinor(version2) : null
|
|
25728
|
+
};
|
|
25716
25729
|
});
|
|
25717
25730
|
}
|
|
25731
|
+
|
|
25732
|
+
// src/commands/devlog/next/displayNextEntry.ts
|
|
25718
25733
|
function versionRange(commits2) {
|
|
25719
25734
|
const versions = commits2.map((c) => c.version).filter((v) => v !== null);
|
|
25720
25735
|
if (versions.length === 0) return null;
|
|
@@ -25740,11 +25755,13 @@ function printCommits(commits2, ignore3, verbose) {
|
|
|
25740
25755
|
}
|
|
25741
25756
|
}
|
|
25742
25757
|
function displayNextEntry(ctx, week, commits2) {
|
|
25743
|
-
const versioned = withVersions(commits2);
|
|
25758
|
+
const versioned = withVersions(commits2, getVersionAtCommit, repoHasTags());
|
|
25744
25759
|
const { start: start2, end } = isoWeekRange(week);
|
|
25745
25760
|
printField("name", ctx.repoName);
|
|
25746
25761
|
printField("week", chalk161.bold.blue(week));
|
|
25747
25762
|
printField("range", `${start2} \u2013 ${end}`);
|
|
25763
|
+
const dates = commits2.map((c) => c.date).sort();
|
|
25764
|
+
if (dates.length > 0) printField("dates", `${dates[0]} \u2013 ${dates.at(-1)}`);
|
|
25748
25765
|
const versions = versionRange(versioned);
|
|
25749
25766
|
if (versions) printField("versions", versions);
|
|
25750
25767
|
printCommits(versioned, ctx.ignore, ctx.verbose);
|
|
@@ -25823,17 +25840,32 @@ import chalk163 from "chalk";
|
|
|
25823
25840
|
// src/commands/devlog/write/devEntryInputSchema.ts
|
|
25824
25841
|
import { z as z15 } from "zod";
|
|
25825
25842
|
var oneLine = z15.string().trim().min(1).refine((value) => !value.includes("\n"), "must be a single line");
|
|
25826
|
-
var
|
|
25843
|
+
var isoDate = z15.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be a date like 2026-08-10");
|
|
25844
|
+
var MAX_ITEM_LENGTH = 80;
|
|
25845
|
+
var itemText = oneLine.refine(
|
|
25846
|
+
(value) => value.length <= MAX_ITEM_LENGTH,
|
|
25847
|
+
`must be a short changelog phrase (at most ${MAX_ITEM_LENGTH} characters)`
|
|
25848
|
+
);
|
|
25849
|
+
var changeItems = z15.array(z15.object({ text: itemText, version: oneLine.optional() }).strict()).default([]);
|
|
25850
|
+
function datesWithinWeek(week, dates) {
|
|
25851
|
+
if (!isValidWeek(week)) return true;
|
|
25852
|
+
const { start: start2, end } = isoWeekRange(week);
|
|
25853
|
+
return start2 <= dates.first && dates.first <= dates.last && dates.last <= end;
|
|
25854
|
+
}
|
|
25827
25855
|
var devEntryInputSchema = z15.object({
|
|
25828
25856
|
week: z15.string().refine(isValidWeek, "must be an ISO week like 2026-W33"),
|
|
25829
25857
|
title: oneLine,
|
|
25858
|
+
dates: z15.object({ first: isoDate, last: isoDate }).strict(),
|
|
25830
25859
|
versions: z15.object({ first: oneLine, last: oneLine }).strict().optional(),
|
|
25831
25860
|
aiGenerated: oneLine,
|
|
25832
25861
|
added: changeItems,
|
|
25833
25862
|
changed: changeItems,
|
|
25834
25863
|
fixed: changeItems,
|
|
25835
25864
|
lede: z15.string().trim().min(1)
|
|
25836
|
-
}).strict()
|
|
25865
|
+
}).strict().refine((entry) => datesWithinWeek(entry.week, entry.dates), {
|
|
25866
|
+
message: "first and last must be in order and within the week",
|
|
25867
|
+
path: ["dates"]
|
|
25868
|
+
});
|
|
25837
25869
|
|
|
25838
25870
|
// src/commands/devlog/write/formatDevEntry.ts
|
|
25839
25871
|
import { parse as parseYaml4, stringify as stringifyYaml4 } from "yaml";
|
|
@@ -25841,7 +25873,8 @@ function buildFrontmatter(project, entry) {
|
|
|
25841
25873
|
const frontmatter2 = {
|
|
25842
25874
|
project,
|
|
25843
25875
|
week: entry.week,
|
|
25844
|
-
title: entry.title
|
|
25876
|
+
title: entry.title,
|
|
25877
|
+
dates: entry.dates
|
|
25845
25878
|
};
|
|
25846
25879
|
if (entry.versions) frontmatter2.versions = entry.versions;
|
|
25847
25880
|
frontmatter2["ai-generated"] = entry.aiGenerated;
|
|
@@ -28296,7 +28329,7 @@ Anything nested below the leaf level fails the run before a single write, naming
|
|
|
28296
28329
|
}
|
|
28297
28330
|
|
|
28298
28331
|
// src/commands/github/issue/commentIssue.ts
|
|
28299
|
-
import { execFileSync as
|
|
28332
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
28300
28333
|
|
|
28301
28334
|
// src/shared/validateProposedContent.ts
|
|
28302
28335
|
function validateProposedContent(labels, title, body) {
|
|
@@ -28357,7 +28390,7 @@ async function commentIssue(numberArg, options2) {
|
|
|
28357
28390
|
const args = ["issue", "comment", String(number), "--body", body];
|
|
28358
28391
|
if (options2.repo) args.push("--repo", options2.repo);
|
|
28359
28392
|
try {
|
|
28360
|
-
|
|
28393
|
+
execFileSync9("gh", args, { stdio: "inherit" });
|
|
28361
28394
|
} catch {
|
|
28362
28395
|
process.exit(1);
|
|
28363
28396
|
}
|
|
@@ -28869,7 +28902,7 @@ function attachArgs(attachments) {
|
|
|
28869
28902
|
}
|
|
28870
28903
|
|
|
28871
28904
|
// src/commands/prs/runGhWithAttachments.ts
|
|
28872
|
-
import { execFileSync as
|
|
28905
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
28873
28906
|
import { basename as basename18 } from "path";
|
|
28874
28907
|
|
|
28875
28908
|
// src/shared/removeStagedAttachments.ts
|
|
@@ -28897,7 +28930,7 @@ function reportPartialFailure(attachments, stderr) {
|
|
|
28897
28930
|
function runGhWithAttachments(args, attachments) {
|
|
28898
28931
|
const attaching = attachments.length > 0;
|
|
28899
28932
|
try {
|
|
28900
|
-
const stdout =
|
|
28933
|
+
const stdout = execFileSync10("gh", args, {
|
|
28901
28934
|
encoding: "utf8",
|
|
28902
28935
|
stdio: ["inherit", "pipe", attaching ? "pipe" : "inherit"]
|
|
28903
28936
|
});
|
|
@@ -29008,7 +29041,7 @@ The project scope is needed for --project: gh auth refresh -h github.com -s proj
|
|
|
29008
29041
|
}
|
|
29009
29042
|
|
|
29010
29043
|
// src/commands/github/issue/fetchIssue.ts
|
|
29011
|
-
import { execFileSync as
|
|
29044
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
29012
29045
|
function fetchIssue2(number, repo) {
|
|
29013
29046
|
const args = [
|
|
29014
29047
|
"issue",
|
|
@@ -29020,7 +29053,7 @@ function fetchIssue2(number, repo) {
|
|
|
29020
29053
|
if (repo) args.push("--repo", repo);
|
|
29021
29054
|
let raw;
|
|
29022
29055
|
try {
|
|
29023
|
-
raw =
|
|
29056
|
+
raw = execFileSync11("gh", args, { encoding: "utf8" });
|
|
29024
29057
|
} catch {
|
|
29025
29058
|
console.error(`Could not fetch issue #${number} with gh issue view`);
|
|
29026
29059
|
process.exit(1);
|
|
@@ -29130,12 +29163,12 @@ function prepareIssueEdit(number, repo, fresh, proposed) {
|
|
|
29130
29163
|
}
|
|
29131
29164
|
|
|
29132
29165
|
// src/commands/github/issue/pushIssueBody.ts
|
|
29133
|
-
import { execFileSync as
|
|
29166
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
29134
29167
|
function pushIssueBody(number, repo, bodyPath) {
|
|
29135
29168
|
const args = ["issue", "edit", String(number), "--body-file", bodyPath];
|
|
29136
29169
|
if (repo) args.push("--repo", repo);
|
|
29137
29170
|
try {
|
|
29138
|
-
|
|
29171
|
+
execFileSync12("gh", args, { stdio: "inherit" });
|
|
29139
29172
|
} catch {
|
|
29140
29173
|
process.exit(1);
|
|
29141
29174
|
}
|
|
@@ -29214,12 +29247,12 @@ function setIssueParent(number, repo, parentArg) {
|
|
|
29214
29247
|
}
|
|
29215
29248
|
|
|
29216
29249
|
// src/commands/github/issue/viewIssue.ts
|
|
29217
|
-
import { execFileSync as
|
|
29250
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
29218
29251
|
function viewIssue(number, repo) {
|
|
29219
29252
|
const args = ["issue", "view", String(number)];
|
|
29220
29253
|
if (repo) args.push("--repo", repo);
|
|
29221
29254
|
try {
|
|
29222
|
-
|
|
29255
|
+
execFileSync13("gh", args, { stdio: "inherit" });
|
|
29223
29256
|
} catch {
|
|
29224
29257
|
process.exit(1);
|
|
29225
29258
|
}
|
|
@@ -29273,7 +29306,7 @@ function registerEditIssue(issueCommand) {
|
|
|
29273
29306
|
}
|
|
29274
29307
|
|
|
29275
29308
|
// src/commands/github/issue/editIssueComment.ts
|
|
29276
|
-
import { execFileSync as
|
|
29309
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
29277
29310
|
var USAGE4 = "Usage: assist github issue edit-comment <comment-id> --body <body> [-R <owner>/<repo>]";
|
|
29278
29311
|
async function editIssueComment(commentIdArg, options2) {
|
|
29279
29312
|
const commentId = Number.parseInt(commentIdArg, 10);
|
|
@@ -29300,7 +29333,7 @@ async function editIssueComment(commentIdArg, options2) {
|
|
|
29300
29333
|
];
|
|
29301
29334
|
let raw;
|
|
29302
29335
|
try {
|
|
29303
|
-
raw =
|
|
29336
|
+
raw = execFileSync14("gh", args, {
|
|
29304
29337
|
input: JSON.stringify({ body }),
|
|
29305
29338
|
encoding: "utf8"
|
|
29306
29339
|
});
|
|
@@ -30178,7 +30211,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
30178
30211
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
30179
30212
|
|
|
30180
30213
|
// src/commands/review/checkoutPr.ts
|
|
30181
|
-
import { execFileSync as
|
|
30214
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
30182
30215
|
|
|
30183
30216
|
// src/commands/review/clearStalePrBranch.ts
|
|
30184
30217
|
var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
|
|
@@ -30777,13 +30810,13 @@ function prCliCommands(number, cwd) {
|
|
|
30777
30810
|
}
|
|
30778
30811
|
|
|
30779
30812
|
// src/commands/review/prHeadBranch.ts
|
|
30780
|
-
import { execFileSync as
|
|
30813
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
30781
30814
|
function prHeadBranch({
|
|
30782
30815
|
headBranch
|
|
30783
30816
|
}) {
|
|
30784
30817
|
try {
|
|
30785
30818
|
return headBranch.parse(
|
|
30786
|
-
|
|
30819
|
+
execFileSync15(headBranch.file, headBranch.args, {
|
|
30787
30820
|
encoding: "utf8",
|
|
30788
30821
|
stdio: ["ignore", "pipe", "pipe"]
|
|
30789
30822
|
})
|
|
@@ -30854,7 +30887,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
30854
30887
|
import chalk187 from "chalk";
|
|
30855
30888
|
|
|
30856
30889
|
// src/commands/review/azCliProblem.ts
|
|
30857
|
-
import { execFileSync as
|
|
30890
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
30858
30891
|
|
|
30859
30892
|
// src/commands/review/azFailureProblem.ts
|
|
30860
30893
|
var azProblems = {
|
|
@@ -30882,7 +30915,7 @@ function azFailureProblem(error) {
|
|
|
30882
30915
|
// src/commands/review/azCliProblem.ts
|
|
30883
30916
|
function runAz(args) {
|
|
30884
30917
|
try {
|
|
30885
|
-
|
|
30918
|
+
execFileSync16("az", args, { stdio: "ignore" });
|
|
30886
30919
|
return "ok";
|
|
30887
30920
|
} catch (error) {
|
|
30888
30921
|
return error.code === "ENOENT" ? "missing" : "failed";
|
|
@@ -30945,7 +30978,7 @@ async function checkoutPr(number) {
|
|
|
30945
30978
|
const from = branch2 === "HEAD" ? gitSyncOrNull(process.cwd(), ["rev-parse", "HEAD"]) : branch2;
|
|
30946
30979
|
const stale = headRef ? clearStalePrBranch(process.cwd(), headRef) : "absent";
|
|
30947
30980
|
try {
|
|
30948
|
-
|
|
30981
|
+
execFileSync17(commands.checkout.file, commands.checkout.args, {
|
|
30949
30982
|
stdio: "inherit"
|
|
30950
30983
|
});
|
|
30951
30984
|
} catch {
|
|
@@ -32975,9 +33008,9 @@ var azureDevopsThreadRequests = {
|
|
|
32975
33008
|
};
|
|
32976
33009
|
|
|
32977
33010
|
// src/commands/prs/azureDevops/currentAzureDevopsPr.ts
|
|
32978
|
-
import { execFileSync as
|
|
33011
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
32979
33012
|
function findPrForBranch(repo, branch2) {
|
|
32980
|
-
const stdout =
|
|
33013
|
+
const stdout = execFileSync18(
|
|
32981
33014
|
"az",
|
|
32982
33015
|
[
|
|
32983
33016
|
"repos",
|
|
@@ -33024,7 +33057,7 @@ function failAzureDevops(error) {
|
|
|
33024
33057
|
}
|
|
33025
33058
|
|
|
33026
33059
|
// src/commands/prs/azureDevops/invokeAzDevops.ts
|
|
33027
|
-
import { execFileSync as
|
|
33060
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
33028
33061
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync41 } from "fs";
|
|
33029
33062
|
import { tmpdir as tmpdir6 } from "os";
|
|
33030
33063
|
import { join as join86 } from "path";
|
|
@@ -33053,7 +33086,7 @@ function azDevopsInvokeArgs(request, inFile) {
|
|
|
33053
33086
|
];
|
|
33054
33087
|
}
|
|
33055
33088
|
function runAz2(args) {
|
|
33056
|
-
const stdout =
|
|
33089
|
+
const stdout = execFileSync19("az", args, {
|
|
33057
33090
|
encoding: "utf8",
|
|
33058
33091
|
stdio: ["ignore", "pipe", "pipe"],
|
|
33059
33092
|
windowsHide: true
|
|
@@ -33122,10 +33155,10 @@ function listAzureDevopsComments(repo) {
|
|
|
33122
33155
|
}
|
|
33123
33156
|
|
|
33124
33157
|
// src/commands/prs/fetchThreadIds.ts
|
|
33125
|
-
import { execFileSync as
|
|
33158
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
33126
33159
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
33127
33160
|
function fetchThreadIds(org, repo, prNumber) {
|
|
33128
|
-
const result =
|
|
33161
|
+
const result = execFileSync20(
|
|
33129
33162
|
"gh",
|
|
33130
33163
|
[
|
|
33131
33164
|
"api",
|
|
@@ -33406,7 +33439,7 @@ function printComments2(result) {
|
|
|
33406
33439
|
import { execSync as execSync42 } from "child_process";
|
|
33407
33440
|
|
|
33408
33441
|
// src/commands/prs/threadTarget.ts
|
|
33409
|
-
import { execFileSync as
|
|
33442
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
33410
33443
|
|
|
33411
33444
|
// src/commands/prs/azureDevops/azureDevopsThreadActions.ts
|
|
33412
33445
|
function attempt(run4) {
|
|
@@ -33454,7 +33487,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
33454
33487
|
// src/commands/prs/threadTarget.ts
|
|
33455
33488
|
function resolveThread(threadId) {
|
|
33456
33489
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
33457
|
-
|
|
33490
|
+
execFileSync21(
|
|
33458
33491
|
"gh",
|
|
33459
33492
|
["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
|
|
33460
33493
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
@@ -34094,7 +34127,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
34094
34127
|
}
|
|
34095
34128
|
|
|
34096
34129
|
// src/commands/prs/placePr.ts
|
|
34097
|
-
import { execFileSync as
|
|
34130
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
34098
34131
|
|
|
34099
34132
|
// src/commands/prs/buildCreateArgs.ts
|
|
34100
34133
|
function buildCreateArgs(title, body, options2, attachments = []) {
|
|
@@ -34180,7 +34213,7 @@ function buildEditArgs(number, title, body, attachments = []) {
|
|
|
34180
34213
|
// src/commands/prs/placePr.ts
|
|
34181
34214
|
function hasUpstream2() {
|
|
34182
34215
|
try {
|
|
34183
|
-
|
|
34216
|
+
execFileSync22(
|
|
34184
34217
|
"git",
|
|
34185
34218
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
34186
34219
|
{ stdio: "pipe" }
|
|
@@ -34192,7 +34225,7 @@ function hasUpstream2() {
|
|
|
34192
34225
|
}
|
|
34193
34226
|
function ensureBranchPushed() {
|
|
34194
34227
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
34195
|
-
|
|
34228
|
+
execFileSync22("git", args, { stdio: "inherit" });
|
|
34196
34229
|
}
|
|
34197
34230
|
async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
34198
34231
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
|
|
@@ -34263,10 +34296,10 @@ function warn(reason4) {
|
|
|
34263
34296
|
}
|
|
34264
34297
|
|
|
34265
34298
|
// src/commands/prs/enableAutoMerge.ts
|
|
34266
|
-
import { execFileSync as
|
|
34299
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
34267
34300
|
function enableAutoMerge() {
|
|
34268
34301
|
try {
|
|
34269
|
-
|
|
34302
|
+
execFileSync23(
|
|
34270
34303
|
"gh",
|
|
34271
34304
|
["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
|
|
34272
34305
|
{ stdio: "inherit" }
|
|
@@ -34524,10 +34557,10 @@ function prsSlackChannel() {
|
|
|
34524
34557
|
}
|
|
34525
34558
|
|
|
34526
34559
|
// src/commands/prs/status/fetchReviewThreads.ts
|
|
34527
|
-
import { execFileSync as
|
|
34560
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
34528
34561
|
var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
|
|
34529
34562
|
function fetchReviewThreads(org, repo, prNumber) {
|
|
34530
|
-
const output =
|
|
34563
|
+
const output = execFileSync24(
|
|
34531
34564
|
"gh",
|
|
34532
34565
|
[
|
|
34533
34566
|
"api",
|
|
@@ -38959,7 +38992,7 @@ function exitWith(message3) {
|
|
|
38959
38992
|
}
|
|
38960
38993
|
|
|
38961
38994
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
38962
|
-
import { execFileSync as
|
|
38995
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
38963
38996
|
import chalk249 from "chalk";
|
|
38964
38997
|
|
|
38965
38998
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
@@ -39008,7 +39041,7 @@ function readGlobs(value) {
|
|
|
39008
39041
|
}
|
|
39009
39042
|
|
|
39010
39043
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
39011
|
-
import { execFileSync as
|
|
39044
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
39012
39045
|
import { dirname as dirname41, extname as extname6 } from "path";
|
|
39013
39046
|
var MAX_DIRECTORIES = 200;
|
|
39014
39047
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
@@ -39024,7 +39057,7 @@ function summariseRepoTree(cwd = process.cwd()) {
|
|
|
39024
39057
|
}
|
|
39025
39058
|
function listTrackedFiles(cwd) {
|
|
39026
39059
|
try {
|
|
39027
|
-
return
|
|
39060
|
+
return execFileSync25("git", ["ls-files"], {
|
|
39028
39061
|
cwd,
|
|
39029
39062
|
encoding: "utf8",
|
|
39030
39063
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -39069,7 +39102,7 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
39069
39102
|
}
|
|
39070
39103
|
function askClaude(prompt, cwd) {
|
|
39071
39104
|
try {
|
|
39072
|
-
return
|
|
39105
|
+
return execFileSync26("claude", ["-p", "--model", "sonnet", prompt], {
|
|
39073
39106
|
cwd,
|
|
39074
39107
|
encoding: "utf8",
|
|
39075
39108
|
timeout: 12e4,
|
|
@@ -39705,11 +39738,11 @@ function evaluateHighLevelChecks(subject) {
|
|
|
39705
39738
|
}
|
|
39706
39739
|
|
|
39707
39740
|
// src/commands/review/highLevel/fetchFileAtSha.ts
|
|
39708
|
-
import { execFileSync as
|
|
39741
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
39709
39742
|
function fetchFileAtSha(repo, sha, path109) {
|
|
39710
39743
|
const encodedPath = path109.split("/").map(encodeURIComponent).join("/");
|
|
39711
39744
|
try {
|
|
39712
|
-
return
|
|
39745
|
+
return execFileSync27(
|
|
39713
39746
|
"gh",
|
|
39714
39747
|
[
|
|
39715
39748
|
"api",
|
|
@@ -39731,7 +39764,7 @@ function fetchFileAtSha(repo, sha, path109) {
|
|
|
39731
39764
|
}
|
|
39732
39765
|
|
|
39733
39766
|
// src/commands/review/highLevel/fetchHighLevelFiles.ts
|
|
39734
|
-
import { execFileSync as
|
|
39767
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
39735
39768
|
import { createHash as createHash4 } from "crypto";
|
|
39736
39769
|
var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
|
|
39737
39770
|
function toStatus(status2) {
|
|
@@ -39744,7 +39777,7 @@ function diffUrl(repo, prNumber, path109) {
|
|
|
39744
39777
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
39745
39778
|
}
|
|
39746
39779
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
39747
|
-
const out =
|
|
39780
|
+
const out = execFileSync28(
|
|
39748
39781
|
"gh",
|
|
39749
39782
|
["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
|
|
39750
39783
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
@@ -45694,13 +45727,13 @@ Total: ${violations.length} forbidden string(s).`);
|
|
|
45694
45727
|
}
|
|
45695
45728
|
|
|
45696
45729
|
// src/commands/verify/hardcodedColors.ts
|
|
45697
|
-
import { execFileSync as
|
|
45730
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
45698
45731
|
import { minimatch as minimatch11 } from "minimatch";
|
|
45699
45732
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
45700
45733
|
function hardcodedColors() {
|
|
45701
45734
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
45702
45735
|
try {
|
|
45703
|
-
const output =
|
|
45736
|
+
const output = execFileSync29("grep", ["-rEnH", "-f", "-", "src/"], {
|
|
45704
45737
|
encoding: "utf8",
|
|
45705
45738
|
input: `${pattern}
|
|
45706
45739
|
`
|
|
@@ -46567,11 +46600,11 @@ function consumeSimulatedDivergence(cwd) {
|
|
|
46567
46600
|
}
|
|
46568
46601
|
|
|
46569
46602
|
// src/commands/watch/fetchQuietly.ts
|
|
46570
|
-
import { execFileSync as
|
|
46603
|
+
import { execFileSync as execFileSync30 } from "child_process";
|
|
46571
46604
|
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
46572
46605
|
function fetchQuietly(cwd, intervalMs) {
|
|
46573
46606
|
try {
|
|
46574
|
-
|
|
46607
|
+
execFileSync30("git", ["fetch", "--quiet"], {
|
|
46575
46608
|
stdio: ["pipe", "pipe", "pipe"],
|
|
46576
46609
|
cwd,
|
|
46577
46610
|
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
@@ -46825,7 +46858,7 @@ function registerWatch(program) {
|
|
|
46825
46858
|
}
|
|
46826
46859
|
|
|
46827
46860
|
// src/commands/roam/postRoamActivity.ts
|
|
46828
|
-
import { execFileSync as
|
|
46861
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
46829
46862
|
import { readdirSync as readdirSync24, readFileSync as readFileSync69, statSync as statSync13 } from "fs";
|
|
46830
46863
|
import { join as join106 } from "path";
|
|
46831
46864
|
function findPortFile(roamDir) {
|
|
@@ -46864,7 +46897,7 @@ function postRoamActivity(app, event) {
|
|
|
46864
46897
|
const pid = PID_BY_APP[app] ?? 99999;
|
|
46865
46898
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
|
|
46866
46899
|
try {
|
|
46867
|
-
|
|
46900
|
+
execFileSync31("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
46868
46901
|
stdio: "ignore"
|
|
46869
46902
|
});
|
|
46870
46903
|
} catch {
|
|
@@ -47428,11 +47461,11 @@ function formatLink(link3) {
|
|
|
47428
47461
|
}
|
|
47429
47462
|
|
|
47430
47463
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
47431
|
-
import { execFileSync as
|
|
47464
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
47432
47465
|
function listDaemonPids() {
|
|
47433
47466
|
if (process.platform === "win32") return [];
|
|
47434
47467
|
try {
|
|
47435
|
-
const out =
|
|
47468
|
+
const out = execFileSync32("ps", ["-eo", "pid=,args="], {
|
|
47436
47469
|
encoding: "utf8"
|
|
47437
47470
|
});
|
|
47438
47471
|
return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
|
|
@@ -52381,7 +52414,7 @@ function releaseClient(client, clients, prPreview, verify) {
|
|
|
52381
52414
|
}
|
|
52382
52415
|
|
|
52383
52416
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
52384
|
-
import { execFileSync as
|
|
52417
|
+
import { execFileSync as execFileSync33 } from "child_process";
|
|
52385
52418
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
52386
52419
|
function findPortHolderPid(port) {
|
|
52387
52420
|
try {
|
|
@@ -52391,7 +52424,7 @@ function findPortHolderPid(port) {
|
|
|
52391
52424
|
}
|
|
52392
52425
|
}
|
|
52393
52426
|
function probe(command, args) {
|
|
52394
|
-
return
|
|
52427
|
+
return execFileSync33(command, args, {
|
|
52395
52428
|
encoding: "utf8",
|
|
52396
52429
|
timeout: PROBE_TIMEOUT_MS,
|
|
52397
52430
|
stdio: ["ignore", "pipe", "ignore"]
|