waterplane 0.1.15 → 0.1.16
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/CHANGELOG.md +17 -0
- package/README.md +2 -0
- package/node_modules/@waterplane/shared/dist/exposure.js +1 -0
- package/node_modules/@waterplane/shared/dist/exposure.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/working.d.ts +18 -0
- package/node_modules/@waterplane/shared/dist/working.js +80 -9
- package/node_modules/@waterplane/shared/dist/working.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/yamlfront.d.ts +8 -0
- package/node_modules/@waterplane/shared/dist/yamlfront.js +23 -5
- package/node_modules/@waterplane/shared/dist/yamlfront.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/packages/host/dist/context.js +15 -5
- package/packages/host/dist/context.js.map +1 -1
- package/packages/web/dist/assets/{demo-TmjAByxC.js → demo-DkCtg-SJ.js} +1 -1
- package/packages/web/dist/assets/{index-CVkUvHP9.js → index-EYc28CfH.js} +1 -1
- package/packages/web/dist/assets/{shared-PjlyyA4P.js → shared-DjRRLGfw.js} +4 -4
- package/packages/web/dist/assets/{sheets-DqpgjB8i.js → sheets-ByWNPa9p.js} +4 -4
- package/packages/web/dist/build-id.txt +1 -1
- package/packages/web/dist/buildstamp.json +1 -1
- package/packages/web/dist/index.html +4 -4
- package/packages/web/dist/sw.js +2 -2
- package/release.json +3 -3
- package/tools/repohealth/lang/typescript-resolve.mjs +4 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Aa as e,As as t,Bi as n,Bl as r,Bn as i,Bs as a,Cs as o,Ct as s,Dt as c,Et as l,F as u,Fl as d,Fs as f,Go as p,Gs as m,Hs as h,I as g,Ii as _,Is as v,Jo as y,Js as b,Jt as x,Ko as S,L as C,Ls as w,Ma as T,Ms as E,N as D,Na as O,Ns as k,O as ee,Oa as A,Os as te,P as j,Pa as ne,Pl as M,Ps as N,Qa as P,Rl as re,Rs as F,Sl as I,Ss as L,St as ie,Tl as R,Ts as ae,Uo as z,Vn as B,Vo as oe,Ws as se,Xi as ce,Xn as le,Xo as V,Y as H,Yi as ue,Yt as de,ac as fe,at as pe,bi as me,bs as he,bt as ge,ca as _e,cc as ve,cr as ye,du as be,er as xe,eu as Se,f as Ce,ft as we,gr as Te,ht as Ee,j as De,ja as Oe,js as ke,k as Ae,ka as je,ks as Me,l as Ne,la as Pe,lc as Fe,ls as Ie,mi as Le,mo as Re,mt as ze,ot as Be,qa as Ve,qi as He,qo as Ue,qs as We,ru as Ge,sc as Ke,ss as qe,to as Je,uc as Ye,uu as Xe,vc as Ze,vs as Qe,ws as $e,wu as et,xc as tt,xs as nt,xt as rt,ys as it,yt as at,yu as ot,zl as st,zs as ct}from"./shared-PjlyyA4P.js";import{C as lt,S as ut,T as dt,a as ft,b as pt,f as mt,l as ht,m as U,n as gt,p as _t,t as vt,u as yt,v as bt,w as xt,x as St,y as Ct}from"./demo-TmjAByxC.js";import{$ as wt,$a as Tt,$c as W,$d as Et,$i as Dt,$l as Ot,$n as kt,$o as At,$r as jt,$s as Mt,$t as Nt,$u as Pt,A as Ft,Aa as It,Ac as Lt,Ad as Rt,Ai as zt,Al as Bt,An as Vt,Ao as Ht,Ar as Ut,As as Wt,At as Gt,Au as Kt,B as qt,Ba as Jt,Bc as Yt,Bd as Xt,Bi as Zt,Bl as Qt,Bn as $t,Bo as en,Br as tn,Bs as nn,Bt as rn,Bu as an,C as on,Ca as sn,Cc as cn,Cd as ln,Ci as un,Cl as G,Cn as dn,Co as fn,Cr as pn,Cs as mn,Ct as hn,Cu as gn,D as _n,Da as vn,Dc as yn,Dd as bn,Di as xn,Dl as Sn,Dn as Cn,Do as wn,Dr as Tn,Ds as En,Dt as Dn,Du as On,E as kn,Ea as An,Ec as jn,Ed as Mn,Ei as Nn,El as Pn,En as Fn,Eo as In,Er as Ln,Es as Rn,Et as zn,Eu as Bn,F as Vn,Fa as Hn,Fc as Un,Fd as Wn,Fi as Gn,Fl as Kn,Fn as qn,Fo as Jn,Fr as Yn,Fs as Xn,Ft as Zn,Fu as Qn,G as $n,Ga as er,Gc as K,Gd as tr,Gi as nr,Gl as rr,Gn as ir,Go as ar,Gs as or,Gt as sr,Gu as cr,H as lr,Ha as ur,Hc as dr,Hd as fr,Hi as pr,Hl as mr,Hn as hr,Ho as gr,Hr as _r,Hs as vr,Ht as yr,Hu as br,I as xr,Ia as Sr,Ic as Cr,Id as wr,Ii as Tr,Il as Er,In as Dr,Io as Or,Ir as kr,Is as Ar,It as jr,Iu as Mr,J as Nr,Jc as Pr,Jd as Fr,Ji as Ir,Jl as Lr,Jn as Rr,Jo as zr,Js as Br,Jt as Vr,Ju as Hr,K as Ur,Ka as Wr,Kc as q,Kd as Gr,Ki as Kr,Kl as qr,Kn as Jr,Ko as Yr,Kr as Xr,Ks as Zr,Kt as Qr,Ku as $r,L as ei,La as ti,Lc as ni,Ld as ri,Li as ii,Ll as ai,Ln as oi,Lo as si,Lr as ci,Ls as li,Lt as ui,Lu as di,M as fi,Ma as pi,Mc as mi,Md as hi,Mi as gi,Ml as _i,Mn as vi,Mo as yi,Mr as bi,Ms as xi,Mt as Si,Mu as Ci,N as wi,Na as Ti,Nc as Ei,Nd as Di,Ni as Oi,Nl as ki,Nn as Ai,No as ji,Nr as Mi,Ns as Ni,Nt as Pi,Nu as Fi,O as Ii,Oa as Li,Oc as Ri,Od as zi,Oi as Bi,Ol as Vi,On as Hi,Oo as Ui,Or as Wi,Os as Gi,Ot as Ki,Ou as qi,P as Ji,Pa as Yi,Pc as Xi,Pd as Zi,Pi as Qi,Pl as $i,Pn as ea,Po as ta,Pr as na,Ps as ra,Pt as ia,Pu as aa,Q as oa,Qa as sa,Qc as ca,Qd as la,Qi as ua,Ql as da,Qn as fa,Qo as pa,Qr as ma,Qs as ha,Qt as ga,Qu as _a,R as va,Ra as ya,Rc as ba,Rd as xa,Ri as Sa,Rl as Ca,Rn as wa,Ro as Ta,Rr as Ea,Rs as Da,Rt as Oa,Ru as ka,S as Aa,Sa as ja,Sc as Ma,Sd as Na,Si as Pa,Sl as Fa,Sn as Ia,So as La,Sr as Ra,Ss as za,St as Ba,Su as Va,T as Ha,Ta as Ua,Tc as Wa,Td as Ga,Ti as Ka,Tl as qa,Tn as Ja,To as Ya,Tr as Xa,Ts as Za,Tt as Qa,Tu as $a,U as eo,Ua as to,Uc as no,Ud as ro,Ui as io,Ul as ao,Un as oo,Uo as so,Ur as co,Us as lo,Ut as uo,Uu as fo,V as po,Va as mo,Vc as ho,Vd as go,Vi as _o,Vl as vo,Vn as yo,Vo as bo,Vr as xo,Vs as So,Vt as Co,Vu as wo,W as To,Wa as Eo,Wc as Do,Wd as Oo,Wi as ko,Wl as Ao,Wn as jo,Wo as Mo,Wr as No,Ws as Po,Wt as Fo,Wu as Io,X as Lo,Xa as Ro,Xc as zo,Xd as Bo,Xi as Vo,Xl as Ho,Xn as Uo,Xo as Wo,Xr as Go,Xs as Ko,Xt as qo,Xu as Jo,Y as Yo,Ya as Xo,Yc as Zo,Yd as Qo,Yi as $o,Yl as es,Yn as ts,Yo as ns,Yr as rs,Ys as is,Yt as as,Yu as os,Z as ss,Za as cs,Zc as ls,Zd as us,Zi as ds,Zl as fs,Zn as ps,Zo as ms,Zr as hs,Zs as gs,Zt as _s,Zu as vs,_ as ys,_a as bs,_c as xs,_d as Ss,_i as Cs,_l as ws,_n as Ts,_o as Es,_r as Ds,_s as Os,_t as ks,_u as As,a as js,aa as Ms,ac as Ns,ad as Ps,af as Fs,ai as Is,al as Ls,an as Rs,ao as zs,ar as Bs,as as Vs,at as Hs,au as Us,b as Ws,ba as Gs,bc as Ks,bd as qs,bi as Js,bl as Ys,bn as Xs,bo as Zs,br as Qs,bs as $s,bt as ec,bu as tc,c as nc,ca as rc,cc as ic,cd as ac,cf as oc,ci as sc,cl as cc,cn as lc,co as uc,cr as dc,cs as fc,ct as pc,cu as mc,d as hc,da as gc,dc as _c,dd as vc,di as yc,dl as bc,dn as xc,do as Sc,dr as Cc,ds as wc,dt as Tc,du as Ec,ea as Dc,ec as Oc,ed as kc,ef as Ac,ei as jc,el as Mc,en as Nc,eo as Pc,er as Fc,es as Ic,et as Lc,eu as Rc,f as zc,fa as Bc,fc as Vc,fd as Hc,fi as Uc,fl as Wc,fn as Gc,fo as Kc,fr as qc,fs as Jc,ft as Yc,fu as Xc,g as Zc,ga as Qc,gc as $c,gd as el,gi as tl,gl as nl,gn as rl,go as il,gr as al,gs as ol,gt as sl,gu as cl,h as ll,ha as ul,hc as dl,hd as fl,hi as pl,hl as ml,hn as hl,ho as gl,hr as _l,hs as vl,ht as yl,hu as bl,i as xl,ia as Sl,ic as J,id as Cl,if as wl,ii as Tl,il as El,in as Dl,io as Ol,ir as kl,it as Al,iu as jl,j as Ml,ja as Nl,jc as Pl,jd as Fl,ji as Il,jl as Ll,jn as Rl,jo as zl,jr as Bl,js as Vl,jt as Hl,ju as Ul,k as Wl,ka as Gl,kc as Kl,kd as ql,ki as Jl,kl as Yl,kn as Xl,ko as Zl,kr as Ql,ks as $l,kt as eu,ku as tu,l as nu,la as ru,lc as iu,ld as au,lf as ou,li as su,ll as cu,ln as lu,lo as uu,lr as du,ls as fu,lt as pu,lu as mu,m as hu,ma as gu,mc as _u,md as vu,mi as yu,ml as bu,mn as xu,mo as Su,mr as Cu,ms as wu,mt as Tu,mu as Eu,n as Du,na as Ou,nc as ku,nd as Au,nf as ju,ni as Mu,nl as Nu,nn as Pu,no as Fu,nr as Iu,ns as Lu,nt as Ru,nu as zu,o as Bu,oa as Vu,oc as Hu,od as Uu,of as Wu,oi as Gu,ol as Ku,on as qu,oo as Ju,or as Yu,os as Xu,ot as Zu,ou as Qu,p as $u,pa as ed,pc as td,pd as nd,pi as rd,pl as id,pn as ad,po as od,pr as sd,ps as cd,pt as ld,pu as ud,q as dd,qa as fd,qc as pd,qd as md,qi as hd,ql as gd,qn as _d,qo as Y,qr as vd,qs as yd,qt as bd,qu as xd,r as Sd,ra as Cd,rc as wd,rd as Td,rf as Ed,ri as Dd,rl as Od,rn as kd,ro as Ad,rr as jd,rs as Md,rt as Nd,ru as Pd,s as Fd,sa as Id,sc as Ld,sd as Rd,sf as zd,si as Bd,sl as Vd,sn as Hd,so as Ud,sr as Wd,ss as Gd,st as Kd,su as qd,t as Jd,ta as Yd,tc as Xd,td as Zd,tf as Qd,ti as $d,tl as ef,tn as tf,to as nf,tr as rf,ts as af,tt as of,tu as sf,u as cf,ua as lf,uc as uf,ud as df,uf as ff,ui as pf,ul as mf,un as hf,uo as gf,ur as _f,us as vf,ut as yf,uu as bf,v as xf,va as Sf,vc as Cf,vd as wf,vi as Tf,vl as Ef,vn as Df,vo as Of,vr as kf,vs as Af,vt as jf,vu as Mf,w as Nf,wa as Pf,wc as Ff,wd as If,wi as Lf,wl as Rf,wn as zf,wo as Bf,wr as Vf,ws as Hf,wt as Uf,wu as Wf,x as Gf,xa as Kf,xc as qf,xd as Jf,xi as Yf,xl as Xf,xn as Zf,xo as Qf,xr as $f,xs as ep,xt as tp,xu as np,y as rp,ya as ip,yc as ap,yd as op,yi as sp,yl as cp,yn as lp,yo as up,yr as dp,ys as fp,yt as pp,yu as mp,z as hp,za as gp,zc as _p,zd as vp,zi as yp,zl as bp,zn as xp,zo as Sp,zr as Cp,zs as wp,zt as Tp,zu as Ep}from"./sheets-DqpgjB8i.js";import{i as Dp,n as Op,r as kp,t as Ap}from"./react-CoSyT_xY.js";import{$i as jp,$r as Mp,A as Np,Ar as Pp,At as Fp,B as Ip,Ci as Lp,Cn as Rp,Cr as zp,Ct as Bp,D as Vp,Fr as Hp,Gn as Up,Gr as Wp,Gt as Gp,Hi as Kp,Hr as qp,Ht as Jp,In as Yp,It as Xp,J as Zp,Jr as Qp,K as $p,Ki as em,Kn as tm,L as nm,Li as rm,Lt as im,M as am,Mi as om,Mn as sm,Mr as cm,Nn as lm,Nr as um,O as dm,Or as fm,Ot as pm,P as mm,Pi as hm,Pr as gm,Pt as _m,Qi as vm,Qt as ym,R as bm,Rr as xm,Rt as Sm,S as Cm,Si as wm,St as Tm,Ti as Em,Tn as Dm,Ui as Om,Un as km,Ur as Am,Ut as jm,Vn as Mm,W as Nm,Wn as Pm,X as Fm,Xi as Im,Xt as Lm,Y as Rm,Yi as zm,Yr as Bm,Yt as Vm,Z as Hm,Zi as Um,Zr as Wm,_ as Gm,b as Km,bi as qm,bn as Jm,bt as Ym,c as Xm,cr as Zm,di as Qm,dr as $m,en as eh,er as th,et as nh,fi as rh,fn as ih,g as ah,gi as oh,gn as sh,gt as ch,h as lh,hi as uh,hn as dh,i as X,in as fh,it as ph,jn as mh,jr as hh,k as gh,ki as _h,kn as vh,kr as yh,kt as bh,ln as xh,m as Sh,mi as Ch,mn as wh,mt as Th,ni as Eh,nn as Dh,on as Oh,or as kh,ot as Ah,pn as jh,pr as Mh,qi as Nh,qr as Ph,r as Fh,ra as Ih,ri as Lh,rt as Rh,s as zh,si as Bh,ta as Vh,ti as Hh,tr as Uh,u as Wh,ui as Gh,ut as Kh,vi as qh,vn as Jh,wi as Yh,wn as Xh,xn as Zh,xt as Qh,yi as $h,yn as eg,z as tg,zi as ng,zn as rg,zt as ig}from"./icons-B48F-4nA.js";import{n as ag,t as og}from"./xterm-C8zLTNGk.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),ft(Ac())||ff(),Ac()&&Fs(Wu());var Z=Dp(),sg=Op();async function cg(e,t){let[n,r]=await Promise.all([el.artifacts(e,`outbox`,void 0,{signal:t}).then(e=>e.files).catch(()=>[]),el.inbox(e,t).catch(()=>[])]);return[...n,...r].map(e=>e.relPath).filter(Boolean)}function lg(e,t){return tc(e??``,t=>cg(e,t),{enabled:t&&!!e}).data??void 0}var ug={fresh:0,warm:1,heavy:2,steep:3},dg=60;function fg(e,t,n){if((ug[n[e]]??0)>=ug[t])return{notice:!1,next:n};let r={...n,[e]:t},i=Object.keys(r);if(i.length>dg)for(let e of i.slice(0,i.length-dg))delete r[e];return{notice:!0,next:r}}function pg(e,t,n){if(t==null){if(!(e in n))return{notice:!1,next:n};let t={...n};return delete t[e],{notice:!1,next:t}}if(n[e]===t)return{notice:!1,next:n};let r={...n,[e]:t},i=Object.keys(r);if(i.length>dg)for(let e of i.slice(0,i.length-dg))delete r[e];return{notice:!0,next:r}}var mg={warn:1,high:2};function hg(e,t,n){if(!t||(mg[n[e]]??0)>=mg[t])return{notice:!1,next:n};let r={...n,[e]:t},i=Object.keys(r);if(i.length>dg)for(let e of i.slice(0,i.length-dg))delete r[e];return{notice:!0,next:r}}function gg(){let e=q(`spendWarn`),t=dl();return n=>n?T(n.contextSpark?.costUsd,t,e):null}function _g(e){let t=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!e||!e.running)return;let n=I(e.contextSpark,{lastTurnAt:e.lastTurnAt,turnActive:e.turnActive,now:Date.now()});if(!n||n.level===`fresh`)return;let r=t.current??=St(U.costNoticed,{}),{notice:i,next:a}=fg(e.id,n.level,r);i&&(t.current=a,dt(U.costNoticed,a),G(n.advice?`${n.note} ${n.advice}`:n.note))},[e]);let n=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!e)return;let t=e.contextSpark,r=e.running?R(t?.liveAgentTok,t?.liveAgentAt,Date.now(),Yt()):null,i=n.current??=St(U.agentNoticed,{}),{notice:a,next:o}=pg(e.id,r?t?.liveAgentId??`agent`:null,i);o!==i&&(n.current=o,dt(U.agentNoticed,o)),a&&r&&G(r)},[e]);let r=(0,Z.useRef)(null),i=gg()(e);(0,Z.useEffect)(()=>{if(!e||!i)return;let t=r.current??=St(U.spendNoticed,{}),{notice:n,next:a}=hg(e.id,i.level,t);n&&(r.current=a,dt(U.spendNoticed,a),G(`${i.text} Marks are set in Settings › Sessions › spend marks. Nothing was stopped.`))},[e,i]);let a=(0,Z.useRef)(new Set);(0,Z.useEffect)(()=>{if(!e)return;let t=e.budget,{notice:n,next:r}=up(e.id,t?.verdict.state===`over`,a.current);a.current=r,n&&t&&G(Of(e.title,t))},[e])}function vg(e,t){let[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{if(e){i.current=!0,r(!1);return}if(!i.current)return;i.current=!1,r(!0);let n=window.setTimeout(()=>r(!1),t);return()=>window.clearTimeout(n)},[e,t]),n}var yg=6e3,bg=2e4,xg=9e4,Sg=1500,Cg=5e3,wg=45e3,Tg=`pending:`,Eg=e=>!!e?.startsWith(Tg),Dg=e=>`${Tg}${e}`,Og=`${Tg}later:`,kg=e=>!!e?.startsWith(Og),Ag=e=>`${Og}${e}`,jg=(e,t)=>Eg(e)&&t?`create:${t}`:e;function Mg(e,t){let n=e.attempts??0,r=1+Math.min(3,n);return e.mode===`op`?(t==null?bg:Math.max(bg,Math.min(12e4,t*6)))*r:e.mode===`backlog`||e.mode===`upload`?yg*r:xg}function Ng(e,t,n=Date.now()){let r=(e.tries??0)+1;return{...e,status:`queued`,attempts:t?Math.max(0,(e.attempts??1)-1):e.attempts,tries:r,retryAt:n+F(r)}}function Pg(e){return e.pendingCreate&&e.holdUntilIdle?!0:void 0}function Fg(e,t,n){let r=new Set;for(let i of e)i.status!==`queued`||i.pendingCreate||(i.mode??`input`)===`input`&&(!t.has(i.sessionId)||n.has(i.sessionId))&&r.add(i.sessionId);return[...r]}function Ig(e,t){if(e.mode===`op`){let t=e.cwd.split(`/`).filter(Boolean).pop()??``;return e.op?.t===`schedule.run`?`Scheduled run, by hand`:e.sessionId===`fanout`?`Fan-out`:e.sessionId.startsWith(`fu:`)?`Fan-out follow-up`:e.sessionId.startsWith(`build:`)?`${t||`repo`} · builds`:`${t||`repo`} · new session`}let n=t.find(t=>t.id===e.sessionId);return n?`${n.title}${e.mode===`backlog`?` · backlog`:``}`:`${e.cwd.split(`/`).filter(Boolean).pop()??e.cwd}${e.mode===`backlog`?` · backlog`:` · session gone`}`}function Lg(e,t=Date.now()){let n=e.map(e=>e.sentAt??e.ts),r=n.length?Math.min(...n):t,i=Math.max(0,Math.round((t-r)/1e3)),a=e.length>1?` (${e.length})`:``,o=e.some(e=>e.mode===`upload`)?`Uploading`:`Sending`,s=e.filter(e=>e.status===`queued`&&e.retryAt!=null).map(e=>e.retryAt);if(s.length===e.length&&s.length){let n=Math.max(1e3,Math.min(...s)-t),r=n<6e4?`${Math.round(n/1e3)}s`:`${Math.round(n/6e4)} min`,i=e.length===1&&e[0].waitReason?` — ${e[0].waitReason}`:``;return`${o}${a}…${i?`${i};`:``} retrying in ${r}`}return`${o}${a}… ${i}s${i>=20?` — no receipt yet, will retry`:``}`}function Rg(e){let t=Gn(e).trim().replace(/\s+/g,` `);return t?t.length>64?`${t.slice(0,64)}…`:t:e.mode===`upload`?`a file`:`an action`}function zg(e){return new Set(e.filter(Ze).map(e=>e.id))}function Bg(e,t){for(let n of e)if(!t.has(n))return!0;return!1}function Vg(e,t){return{...e,status:`pending`,attempts:(e.attempts??0)+1,sentAt:t,firstTryAt:e.firstTryAt??t,waitReason:void 0}}function Hg(e){let t=e.firstTryAt;return e.mode===`upload`?null:e.mode===`op`?e.op?t==null?e.op:A(e.op,t):null:e.mode===`backlog`?{t:`backlog.add`,text:e.text,repoDir:e.cwd,label:e.label??e.text.slice(0,40),fire:e.fire,targetSessionId:e.targetSessionId,autoFire:e.autoFire,ackId:e.ackId,firstSentAt:t,steps:e.steps,resume:e.resume,...typeof e.closeWhenDone==`boolean`?{closeWhenDone:e.closeWhenDone}:{},...e.flagWhenDone?{flagWhenDone:!0}:{},...e.budget?{budget:e.budget}:{},...e.launch?{launch:e.launch}:{},...e.pastBudget?{pastBudget:!0}:{}}:e.answer?{t:`session.input`,id:e.sessionId,data:e.text,ackId:e.ackId,firstSentAt:t,expectPrompt:e.answer.fingerprint,promptSubmit:e.answer.submitBox,promptChoice:e.answer.choice,...e.answer.text===void 0?{}:{promptText:e.answer.text}}:{t:`session.input`,id:e.sessionId,data:e.text,ackId:e.ackId,firstSentAt:t,submit:!0,cwd:e.cwd,view:e.view}}function Ug(e){return`sending “${e}”…`}var Wg=`pending:`;function Gg(e){let t=e.remembered;if(t?.startsWith(Wg)){let n=t.slice(8);if(e.pendingAlive(n))return{do:`enter`,ack:n}}else if(t){let n=e.sessions.find(e=>e.id===t);if(n&&n.running)return{do:`attach`,id:n.id}}let n=e.sessions.find(t=>t.running&&!t.companionOf&&t.cwd===e.cwd&&e.isShell(t.backend));return n?{do:`attach`,id:n.id}:{do:`open`}}function Kg(e,t,n){return e===`${Wg}${t}`?n:e}function qg(e,t,n){let r=!1,i={};for(let[a,o]of Object.entries(e)){let e=Kg(o,t,n);e!==o&&(r=!0),i[a]=e}return r?i:e}function Jg(e){return`back to ${e}`}function Yg(e,t){return!!e&&!!t&&e.sessionId===t}var Xg=Xc({}),Zg=Xc(null);function Qg(e,t,n){Xg.set(n=>n[e]===t?n:{...n,[e]:t}),n&&Zg.set(()=>({sessionId:t,to:n}))}function $g(e,t){Xg.set(n=>qg(n,e,t)),Zg.set(n=>{if(!n)return n;let r=Kg(n.sessionId,e,t);return r===n.sessionId?n:{...n,sessionId:r}})}function e_(){Zg.set(null)}var t_=3e4;function n_(e){return e?.adoptedAt&&Date.now()-e.adoptedAt>t_?void 0:e}function r_(e,t,n){let r=(0,Z.useRef)(new Map),i=(0,Z.useMemo)(()=>{if(!Eg(e))return null;let n=e.slice(Tg.length);return t.find(e=>e.ackId===n&&qi(e))??null},[t,e]);return{pendingKept:r,pendingEntry:i,pendingSession:(0,Z.useMemo)(()=>{if(e&&!Eg(e)){if(n.some(t=>t.id===e))return null;let t=n_(r.current.get(e));return t?.adoptedAt?{id:e,cwd:t.cwd,title:t.title,remoteControl:!1,running:!0,createdAt:t.ts}:null}if(!Eg(e))return null;if(kg(e)){let t=e.slice(Og.length);return{id:e,cwd:t,title:Td(t)||`new session`,remoteControl:!1,running:!0,createdAt:Date.now()}}let t=i,a=n_(r.current.get(e.slice(Tg.length)));if(!t&&!a)return null;let o=t?.op,s=t?.cwd||a?.cwd||``;return{id:e,cwd:s,title:o?.title||a?.title||Td(s)||`new session`,remoteControl:!1,running:!0,createdAt:t?.ts??a?.ts??Date.now(),model:o?.launch?.model,effort:o?.launch?.effort,permissionMode:o?.launch?.permissionMode,remoteControlled:o?.launch?.remoteControlled}},[i,e,n])}}function i_(e){let{outboxRef:n,pendingKept:r,activeIdRef:i,connRef:a,wantNavRef:o,buffers:s,pendingEntry:c}=e,l=t=>e.writeOutbox(t),u=(t,n)=>e.addOutbox(t,n),d=(t,n,r,i)=>e.queueOp(t,n,r,i),f=e.setOverlay,p=e.setActiveId,m=e.setLastVisitedId;function h(e){let t=n.current.find(t=>qi(t)&&t.cwd===e&&t.status!==`failed`);t&&_(t.ackId)}function g(e){o.current=!1,f(null),p(Ag(e))}function _(e){let t=n.current.find(t=>t.ackId===e),i=t?.op;for(t&&r.current.set(e,{cwd:t.cwd,title:i?.title||Td(t.cwd),ts:t.ts});r.current.size>8;)r.current.delete(r.current.keys().next().value);o.current=!1,f(null),p(Dg(e))}function v(){let e=c,t=e?.op;if(!e||e.status!==`failed`||t?.t!==`session.create`)return;W(`action:session.pending.retry`);let r=n.current.filter(t=>t.mode===`input`&&t.createAck===e.ackId&&t.status===`failed`).sort((e,t)=>e.ts-t.ts),i=new Set([e.ackId,...r.map(e=>e.ackId)]);l(n.current.filter(e=>!i.has(e.ackId)));let o=Mr(),{ackId:s,...u}=t;d(u,e.sessionId,e.text,{cwd:e.cwd,focus:!0,ackId:o});for(let e of r)b(e.cwd,e.text,o,e.kind===`command`?`command`:`prompt`);_(o),G(a.current.status===`open`?`trying again…`:`queued — it opens when the link is back`)}function y(e,t){let n=Dg(e),a=r.current.get(e);if(a){let n={...a,adoptedAt:Date.now()};r.current.set(e,n),r.current.set(t,n)}if($g(e,t),i.current!==n)return;let o=Ul(n);o&&wo(t,o),wo(n,``),s.current.has(t)||s.current.set(t,[]),p(t),m(t)}function b(e,t,n,r=`prompt`){u({ackId:Mr(),sessionId:`create:${e}`,cwd:e,text:t,ts:Date.now(),status:`queued`,attempts:0,kind:r,mode:`input`,pendingCreate:!0,holdUntilIdle:!0,createAck:n,armed:!0})}function x(e,r){let i=new Set(t(n.current,e,r).map(e=>e.ackId));l(n.current.map(e=>i.has(e.ackId)?{...e,noTtl:!0}:e))}function S(e,r,i){let a=new Set(t(n.current,e,i).map(e=>e.ackId));l(n.current.map(e=>a.has(e.ackId)?(Mn(),{...e,status:`failed`,reason:r,failedAt:Date.now()}):e))}function C(e,t){let r=e.upload?.relPath;if(!r)return;let i=e=>e.text.includes(r)||e.mode===`op`&&JSON.stringify(e.op??``).includes(r);l(n.current.map(n=>n.ackId!==e.ackId&&n.status===`queued`&&n.sessionId===e.sessionId&&i(n)?(Mn(),{...n,status:`failed`,reason:t,failedAt:Date.now()}):n))}return{enterPending:_,enterOldestPending:h,enterLater:g,retryPendingCreate:v,adoptPendingSession:y,queueSessionPrompt:b,holdForLaunch:x,failPendingCreates:S,failDependentUploads:C}}function a_(e){let{connRef:t,sessionsRef:r,backendsRef:i,exitedRef:s,outboxRef:c,ackTimers:l,uploadsInFlight:u,uploadAborts:d,busyLanesRef:f,budgetHeldLanesRef:p,busySerialRef:m,serialWatchRef:h,budgetRef:g,autoSendRef:_,holdQueueRef:y,flushIdleReason:b,queueBlockedRef:x,readModeRef:S,serialSessionsRef:C,sessions:T}=e,{inflightRef:E,upBytesRef:D}=e.up,O=()=>e.up.refreshUploadLabel(),k=t=>e.writeOutbox(t),ee=(t,n)=>e.addOutbox(t,n),A=t=>e.addOutboxFirstInLane(t),j=(t,n,r)=>e.failOutbox(t,n,r),ne=t=>e.holdWall(t),M=(t,n,r,i)=>e.queueSessionPrompt(t,n,r,i);async function P(e,t=!0){if(e.mode!==`upload`)return;let n=e.upload?await Ei(`uploads`,e.ackId):null;n&&e.upload&&await Yn(e.upload.relPath,n),t&&await mi(`uploads`,e.ackId)}function re(e){return Mg(e,zi())}function F(e){let t=Date.now();k(c.current.map(n=>{if(n.ackId!==e||n.status===`failed`)return n;let r=(n.round??0)+1,i=ct(r);return{...n,status:`queued`,attempts:0,round:r,retryAt:t+i,waitReason:`the desktop hasn't answered yet`}}));let n=c.current.find(t=>t.ackId===e);n&&(n.round??0)===1&&G(`still sending — the desktop hasn't confirmed yet. Retrying in ${Math.round(ct(1)/6e4)} min; your text is safe.`)}function I(e,n=yg){let r=window.setTimeout(()=>{l.current.delete(e);let n=c.current,r=t.current.status!==`open`;n.some(t=>t.ackId===e&&t.status===`pending`)&&(qs(),k(n.map(t=>t.ackId===e?Ng(t,r):t))),R()},n);l.current.set(e,r)}function ie(){if(t.current.status!==`open`||kc().pending.includes(`sessions`))return[];let e=new Set(r.current.filter(e=>e.running).map(e=>e.id));return Fg(c.current,e,s.current)}function R(n=!1){if(n&&(y.current=!1,k(c.current.map(e=>e.status===`queued`?{...e,armed:!0,retryAt:void 0,waitReason:void 0,holdUntilIdle:e.holdUntilIdle&&(e.pendingCreate||ne(e.sessionId))?!0:void 0}:e))),t.current.status!==`open`)return b.current=L([],{online:!1,queued:1}),0;let a=ie(),s=ke(c.current,{now:Date.now(),inflight:[...l.current.keys(),...u.current],maxAttempts:8,minTryMs:w,busyLanes:f.current,busySerial:(()=>{let e=o(Pa(r.current,i.current),h.current,Date.now());return m.current=e.busy,h.current=e.watches,e.busy})(),budgetBlocked:g.current?.verdict.blocked??!1,goneLanes:a,budgetHeldLanes:p.current});s.release.length&&k(te(c.current,s.release));for(let e of s.expire)Ga(),F(e.ackId);let d={autoSend:_.current,hold:y.current},v=0,S=[...s.blocked];for(let e of s.send){if(!$e(e,d)){S.push({ackId:e.ackId,sessionId:e.sessionId,reason:`gate`});continue}let n=Date.now(),r=Vg(e,n);if(k(c.current.map(t=>t.ackId===e.ackId?Vg(t,n):t)),e.mode===`upload`){ue(e),v++;continue}let i=Hg(r);i&&t.current.send(i),I(e.ackId,re(e)),v++}let C=new Map(S.map(e=>[e.ackId,e.reason]));return x.current=C,e.setQueueBlocked(C),b.current=v?null:L(S,{online:!0,queued:c.current.filter(e=>e.status===`queued`).length,serialText:(()=>{let e=S.find(e=>e.reason===`serial`),t=e&&c.current.find(t=>t.ackId===e.ackId);return t?.serial?un(t.serial,r.current,i.current):void 0})()}),v}function z(e=`nothing queued`){return b.current??e}function B(){window.setTimeout(()=>{R()},450)}function oe(e){let t=v(c.current,e)[0],n=t?{relPath:t,reason:`it never uploaded`}:Bn(e);return n?`${n.relPath.split(`/`).pop()} — ${n.reason}. Re-attach it before sending.`:null}function se(e,t){let n=oe(e);if(n)return G(n),!1;let r=N(c.current,e,t);return r.some((e,t)=>e!==c.current[t])&&k(r),!0}function ce(e){let t=oe(e.join(`
|
|
1
|
+
import{Aa as e,As as t,Bi as n,Bl as r,Bn as i,Bs as a,Cs as o,Ct as s,Dt as c,Et as l,F as u,Fl as d,Fs as f,Go as p,Gs as m,Hs as h,I as g,Ii as _,Is as v,Jo as y,Js as b,Jt as x,Ko as S,L as C,Ls as w,Ma as T,Ms as E,N as D,Na as O,Ns as k,O as ee,Oa as A,Os as te,P as j,Pa as ne,Pl as M,Ps as N,Qa as P,Rl as re,Rs as F,Sl as I,Ss as L,St as ie,Tl as R,Ts as ae,Uo as z,Vn as B,Vo as oe,Ws as se,Xi as ce,Xn as le,Xo as V,Y as H,Yi as ue,Yt as de,ac as fe,at as pe,bi as me,bs as he,bt as ge,ca as _e,cc as ve,cr as ye,du as be,er as xe,eu as Se,f as Ce,ft as we,gr as Te,ht as Ee,j as De,ja as Oe,js as ke,k as Ae,ka as je,ks as Me,l as Ne,la as Pe,lc as Fe,ls as Ie,mi as Le,mo as Re,mt as ze,ot as Be,qa as Ve,qi as He,qo as Ue,qs as We,ru as Ge,sc as Ke,ss as qe,to as Je,uc as Ye,uu as Xe,vc as Ze,vs as Qe,ws as $e,wu as et,xc as tt,xs as nt,xt as rt,ys as it,yt as at,yu as ot,zl as st,zs as ct}from"./shared-DjRRLGfw.js";import{C as lt,S as ut,T as dt,a as ft,b as pt,f as mt,l as ht,m as U,n as gt,p as _t,t as vt,u as yt,v as bt,w as xt,x as St,y as Ct}from"./demo-DkCtg-SJ.js";import{$ as wt,$a as Tt,$c as W,$d as Et,$i as Dt,$l as Ot,$n as kt,$o as At,$r as jt,$s as Mt,$t as Nt,$u as Pt,A as Ft,Aa as It,Ac as Lt,Ad as Rt,Ai as zt,Al as Bt,An as Vt,Ao as Ht,Ar as Ut,As as Wt,At as Gt,Au as Kt,B as qt,Ba as Jt,Bc as Yt,Bd as Xt,Bi as Zt,Bl as Qt,Bn as $t,Bo as en,Br as tn,Bs as nn,Bt as rn,Bu as an,C as on,Ca as sn,Cc as cn,Cd as ln,Ci as un,Cl as G,Cn as dn,Co as fn,Cr as pn,Cs as mn,Ct as hn,Cu as gn,D as _n,Da as vn,Dc as yn,Dd as bn,Di as xn,Dl as Sn,Dn as Cn,Do as wn,Dr as Tn,Ds as En,Dt as Dn,Du as On,E as kn,Ea as An,Ec as jn,Ed as Mn,Ei as Nn,El as Pn,En as Fn,Eo as In,Er as Ln,Es as Rn,Et as zn,Eu as Bn,F as Vn,Fa as Hn,Fc as Un,Fd as Wn,Fi as Gn,Fl as Kn,Fn as qn,Fo as Jn,Fr as Yn,Fs as Xn,Ft as Zn,Fu as Qn,G as $n,Ga as er,Gc as K,Gd as tr,Gi as nr,Gl as rr,Gn as ir,Go as ar,Gs as or,Gt as sr,Gu as cr,H as lr,Ha as ur,Hc as dr,Hd as fr,Hi as pr,Hl as mr,Hn as hr,Ho as gr,Hr as _r,Hs as vr,Ht as yr,Hu as br,I as xr,Ia as Sr,Ic as Cr,Id as wr,Ii as Tr,Il as Er,In as Dr,Io as Or,Ir as kr,Is as Ar,It as jr,Iu as Mr,J as Nr,Jc as Pr,Jd as Fr,Ji as Ir,Jl as Lr,Jn as Rr,Jo as zr,Js as Br,Jt as Vr,Ju as Hr,K as Ur,Ka as Wr,Kc as q,Kd as Gr,Ki as Kr,Kl as qr,Kn as Jr,Ko as Yr,Kr as Xr,Ks as Zr,Kt as Qr,Ku as $r,L as ei,La as ti,Lc as ni,Ld as ri,Li as ii,Ll as ai,Ln as oi,Lo as si,Lr as ci,Ls as li,Lt as ui,Lu as di,M as fi,Ma as pi,Mc as mi,Md as hi,Mi as gi,Ml as _i,Mn as vi,Mo as yi,Mr as bi,Ms as xi,Mt as Si,Mu as Ci,N as wi,Na as Ti,Nc as Ei,Nd as Di,Ni as Oi,Nl as ki,Nn as Ai,No as ji,Nr as Mi,Ns as Ni,Nt as Pi,Nu as Fi,O as Ii,Oa as Li,Oc as Ri,Od as zi,Oi as Bi,Ol as Vi,On as Hi,Oo as Ui,Or as Wi,Os as Gi,Ot as Ki,Ou as qi,P as Ji,Pa as Yi,Pc as Xi,Pd as Zi,Pi as Qi,Pl as $i,Pn as ea,Po as ta,Pr as na,Ps as ra,Pt as ia,Pu as aa,Q as oa,Qa as sa,Qc as ca,Qd as la,Qi as ua,Ql as da,Qn as fa,Qo as pa,Qr as ma,Qs as ha,Qt as ga,Qu as _a,R as va,Ra as ya,Rc as ba,Rd as xa,Ri as Sa,Rl as Ca,Rn as wa,Ro as Ta,Rr as Ea,Rs as Da,Rt as Oa,Ru as ka,S as Aa,Sa as ja,Sc as Ma,Sd as Na,Si as Pa,Sl as Fa,Sn as Ia,So as La,Sr as Ra,Ss as za,St as Ba,Su as Va,T as Ha,Ta as Ua,Tc as Wa,Td as Ga,Ti as Ka,Tl as qa,Tn as Ja,To as Ya,Tr as Xa,Ts as Za,Tt as Qa,Tu as $a,U as eo,Ua as to,Uc as no,Ud as ro,Ui as io,Ul as ao,Un as oo,Uo as so,Ur as co,Us as lo,Ut as uo,Uu as fo,V as po,Va as mo,Vc as ho,Vd as go,Vi as _o,Vl as vo,Vn as yo,Vo as bo,Vr as xo,Vs as So,Vt as Co,Vu as wo,W as To,Wa as Eo,Wc as Do,Wd as Oo,Wi as ko,Wl as Ao,Wn as jo,Wo as Mo,Wr as No,Ws as Po,Wt as Fo,Wu as Io,X as Lo,Xa as Ro,Xc as zo,Xd as Bo,Xi as Vo,Xl as Ho,Xn as Uo,Xo as Wo,Xr as Go,Xs as Ko,Xt as qo,Xu as Jo,Y as Yo,Ya as Xo,Yc as Zo,Yd as Qo,Yi as $o,Yl as es,Yn as ts,Yo as ns,Yr as rs,Ys as is,Yt as as,Yu as os,Z as ss,Za as cs,Zc as ls,Zd as us,Zi as ds,Zl as fs,Zn as ps,Zo as ms,Zr as hs,Zs as gs,Zt as _s,Zu as vs,_ as ys,_a as bs,_c as xs,_d as Ss,_i as Cs,_l as ws,_n as Ts,_o as Es,_r as Ds,_s as Os,_t as ks,_u as As,a as js,aa as Ms,ac as Ns,ad as Ps,af as Fs,ai as Is,al as Ls,an as Rs,ao as zs,ar as Bs,as as Vs,at as Hs,au as Us,b as Ws,ba as Gs,bc as Ks,bd as qs,bi as Js,bl as Ys,bn as Xs,bo as Zs,br as Qs,bs as $s,bt as ec,bu as tc,c as nc,ca as rc,cc as ic,cd as ac,cf as oc,ci as sc,cl as cc,cn as lc,co as uc,cr as dc,cs as fc,ct as pc,cu as mc,d as hc,da as gc,dc as _c,dd as vc,di as yc,dl as bc,dn as xc,do as Sc,dr as Cc,ds as wc,dt as Tc,du as Ec,ea as Dc,ec as Oc,ed as kc,ef as Ac,ei as jc,el as Mc,en as Nc,eo as Pc,er as Fc,es as Ic,et as Lc,eu as Rc,f as zc,fa as Bc,fc as Vc,fd as Hc,fi as Uc,fl as Wc,fn as Gc,fo as Kc,fr as qc,fs as Jc,ft as Yc,fu as Xc,g as Zc,ga as Qc,gc as $c,gd as el,gi as tl,gl as nl,gn as rl,go as il,gr as al,gs as ol,gt as sl,gu as cl,h as ll,ha as ul,hc as dl,hd as fl,hi as pl,hl as ml,hn as hl,ho as gl,hr as _l,hs as vl,ht as yl,hu as bl,i as xl,ia as Sl,ic as J,id as Cl,if as wl,ii as Tl,il as El,in as Dl,io as Ol,ir as kl,it as Al,iu as jl,j as Ml,ja as Nl,jc as Pl,jd as Fl,ji as Il,jl as Ll,jn as Rl,jo as zl,jr as Bl,js as Vl,jt as Hl,ju as Ul,k as Wl,ka as Gl,kc as Kl,kd as ql,ki as Jl,kl as Yl,kn as Xl,ko as Zl,kr as Ql,ks as $l,kt as eu,ku as tu,l as nu,la as ru,lc as iu,ld as au,lf as ou,li as su,ll as cu,ln as lu,lo as uu,lr as du,ls as fu,lt as pu,lu as mu,m as hu,ma as gu,mc as _u,md as vu,mi as yu,ml as bu,mn as xu,mo as Su,mr as Cu,ms as wu,mt as Tu,mu as Eu,n as Du,na as Ou,nc as ku,nd as Au,nf as ju,ni as Mu,nl as Nu,nn as Pu,no as Fu,nr as Iu,ns as Lu,nt as Ru,nu as zu,o as Bu,oa as Vu,oc as Hu,od as Uu,of as Wu,oi as Gu,ol as Ku,on as qu,oo as Ju,or as Yu,os as Xu,ot as Zu,ou as Qu,p as $u,pa as ed,pc as td,pd as nd,pi as rd,pl as id,pn as ad,po as od,pr as sd,ps as cd,pt as ld,pu as ud,q as dd,qa as fd,qc as pd,qd as md,qi as hd,ql as gd,qn as _d,qo as Y,qr as vd,qs as yd,qt as bd,qu as xd,r as Sd,ra as Cd,rc as wd,rd as Td,rf as Ed,ri as Dd,rl as Od,rn as kd,ro as Ad,rr as jd,rs as Md,rt as Nd,ru as Pd,s as Fd,sa as Id,sc as Ld,sd as Rd,sf as zd,si as Bd,sl as Vd,sn as Hd,so as Ud,sr as Wd,ss as Gd,st as Kd,su as qd,t as Jd,ta as Yd,tc as Xd,td as Zd,tf as Qd,ti as $d,tl as ef,tn as tf,to as nf,tr as rf,ts as af,tt as of,tu as sf,u as cf,ua as lf,uc as uf,ud as df,uf as ff,ui as pf,ul as mf,un as hf,uo as gf,ur as _f,us as vf,ut as yf,uu as bf,v as xf,va as Sf,vc as Cf,vd as wf,vi as Tf,vl as Ef,vn as Df,vo as Of,vr as kf,vs as Af,vt as jf,vu as Mf,w as Nf,wa as Pf,wc as Ff,wd as If,wi as Lf,wl as Rf,wn as zf,wo as Bf,wr as Vf,ws as Hf,wt as Uf,wu as Wf,x as Gf,xa as Kf,xc as qf,xd as Jf,xi as Yf,xl as Xf,xn as Zf,xo as Qf,xr as $f,xs as ep,xt as tp,xu as np,y as rp,ya as ip,yc as ap,yd as op,yi as sp,yl as cp,yn as lp,yo as up,yr as dp,ys as fp,yt as pp,yu as mp,z as hp,za as gp,zc as _p,zd as vp,zi as yp,zl as bp,zn as xp,zo as Sp,zr as Cp,zs as wp,zt as Tp,zu as Ep}from"./sheets-ByWNPa9p.js";import{i as Dp,n as Op,r as kp,t as Ap}from"./react-CoSyT_xY.js";import{$i as jp,$r as Mp,A as Np,Ar as Pp,At as Fp,B as Ip,Ci as Lp,Cn as Rp,Cr as zp,Ct as Bp,D as Vp,Fr as Hp,Gn as Up,Gr as Wp,Gt as Gp,Hi as Kp,Hr as qp,Ht as Jp,In as Yp,It as Xp,J as Zp,Jr as Qp,K as $p,Ki as em,Kn as tm,L as nm,Li as rm,Lt as im,M as am,Mi as om,Mn as sm,Mr as cm,Nn as lm,Nr as um,O as dm,Or as fm,Ot as pm,P as mm,Pi as hm,Pr as gm,Pt as _m,Qi as vm,Qt as ym,R as bm,Rr as xm,Rt as Sm,S as Cm,Si as wm,St as Tm,Ti as Em,Tn as Dm,Ui as Om,Un as km,Ur as Am,Ut as jm,Vn as Mm,W as Nm,Wn as Pm,X as Fm,Xi as Im,Xt as Lm,Y as Rm,Yi as zm,Yr as Bm,Yt as Vm,Z as Hm,Zi as Um,Zr as Wm,_ as Gm,b as Km,bi as qm,bn as Jm,bt as Ym,c as Xm,cr as Zm,di as Qm,dr as $m,en as eh,er as th,et as nh,fi as rh,fn as ih,g as ah,gi as oh,gn as sh,gt as ch,h as lh,hi as uh,hn as dh,i as X,in as fh,it as ph,jn as mh,jr as hh,k as gh,ki as _h,kn as vh,kr as yh,kt as bh,ln as xh,m as Sh,mi as Ch,mn as wh,mt as Th,ni as Eh,nn as Dh,on as Oh,or as kh,ot as Ah,pn as jh,pr as Mh,qi as Nh,qr as Ph,r as Fh,ra as Ih,ri as Lh,rt as Rh,s as zh,si as Bh,ta as Vh,ti as Hh,tr as Uh,u as Wh,ui as Gh,ut as Kh,vi as qh,vn as Jh,wi as Yh,wn as Xh,xn as Zh,xt as Qh,yi as $h,yn as eg,z as tg,zi as ng,zn as rg,zt as ig}from"./icons-B48F-4nA.js";import{n as ag,t as og}from"./xterm-C8zLTNGk.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),ft(Ac())||ff(),Ac()&&Fs(Wu());var Z=Dp(),sg=Op();async function cg(e,t){let[n,r]=await Promise.all([el.artifacts(e,`outbox`,void 0,{signal:t}).then(e=>e.files).catch(()=>[]),el.inbox(e,t).catch(()=>[])]);return[...n,...r].map(e=>e.relPath).filter(Boolean)}function lg(e,t){return tc(e??``,t=>cg(e,t),{enabled:t&&!!e}).data??void 0}var ug={fresh:0,warm:1,heavy:2,steep:3},dg=60;function fg(e,t,n){if((ug[n[e]]??0)>=ug[t])return{notice:!1,next:n};let r={...n,[e]:t},i=Object.keys(r);if(i.length>dg)for(let e of i.slice(0,i.length-dg))delete r[e];return{notice:!0,next:r}}function pg(e,t,n){if(t==null){if(!(e in n))return{notice:!1,next:n};let t={...n};return delete t[e],{notice:!1,next:t}}if(n[e]===t)return{notice:!1,next:n};let r={...n,[e]:t},i=Object.keys(r);if(i.length>dg)for(let e of i.slice(0,i.length-dg))delete r[e];return{notice:!0,next:r}}var mg={warn:1,high:2};function hg(e,t,n){if(!t||(mg[n[e]]??0)>=mg[t])return{notice:!1,next:n};let r={...n,[e]:t},i=Object.keys(r);if(i.length>dg)for(let e of i.slice(0,i.length-dg))delete r[e];return{notice:!0,next:r}}function gg(){let e=q(`spendWarn`),t=dl();return n=>n?T(n.contextSpark?.costUsd,t,e):null}function _g(e){let t=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!e||!e.running)return;let n=I(e.contextSpark,{lastTurnAt:e.lastTurnAt,turnActive:e.turnActive,now:Date.now()});if(!n||n.level===`fresh`)return;let r=t.current??=St(U.costNoticed,{}),{notice:i,next:a}=fg(e.id,n.level,r);i&&(t.current=a,dt(U.costNoticed,a),G(n.advice?`${n.note} ${n.advice}`:n.note))},[e]);let n=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!e)return;let t=e.contextSpark,r=e.running?R(t?.liveAgentTok,t?.liveAgentAt,Date.now(),Yt()):null,i=n.current??=St(U.agentNoticed,{}),{notice:a,next:o}=pg(e.id,r?t?.liveAgentId??`agent`:null,i);o!==i&&(n.current=o,dt(U.agentNoticed,o)),a&&r&&G(r)},[e]);let r=(0,Z.useRef)(null),i=gg()(e);(0,Z.useEffect)(()=>{if(!e||!i)return;let t=r.current??=St(U.spendNoticed,{}),{notice:n,next:a}=hg(e.id,i.level,t);n&&(r.current=a,dt(U.spendNoticed,a),G(`${i.text} Marks are set in Settings › Sessions › spend marks. Nothing was stopped.`))},[e,i]);let a=(0,Z.useRef)(new Set);(0,Z.useEffect)(()=>{if(!e)return;let t=e.budget,{notice:n,next:r}=up(e.id,t?.verdict.state===`over`,a.current);a.current=r,n&&t&&G(Of(e.title,t))},[e])}function vg(e,t){let[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{if(e){i.current=!0,r(!1);return}if(!i.current)return;i.current=!1,r(!0);let n=window.setTimeout(()=>r(!1),t);return()=>window.clearTimeout(n)},[e,t]),n}var yg=6e3,bg=2e4,xg=9e4,Sg=1500,Cg=5e3,wg=45e3,Tg=`pending:`,Eg=e=>!!e?.startsWith(Tg),Dg=e=>`${Tg}${e}`,Og=`${Tg}later:`,kg=e=>!!e?.startsWith(Og),Ag=e=>`${Og}${e}`,jg=(e,t)=>Eg(e)&&t?`create:${t}`:e;function Mg(e,t){let n=e.attempts??0,r=1+Math.min(3,n);return e.mode===`op`?(t==null?bg:Math.max(bg,Math.min(12e4,t*6)))*r:e.mode===`backlog`||e.mode===`upload`?yg*r:xg}function Ng(e,t,n=Date.now()){let r=(e.tries??0)+1;return{...e,status:`queued`,attempts:t?Math.max(0,(e.attempts??1)-1):e.attempts,tries:r,retryAt:n+F(r)}}function Pg(e){return e.pendingCreate&&e.holdUntilIdle?!0:void 0}function Fg(e,t,n){let r=new Set;for(let i of e)i.status!==`queued`||i.pendingCreate||(i.mode??`input`)===`input`&&(!t.has(i.sessionId)||n.has(i.sessionId))&&r.add(i.sessionId);return[...r]}function Ig(e,t){if(e.mode===`op`){let t=e.cwd.split(`/`).filter(Boolean).pop()??``;return e.op?.t===`schedule.run`?`Scheduled run, by hand`:e.sessionId===`fanout`?`Fan-out`:e.sessionId.startsWith(`fu:`)?`Fan-out follow-up`:e.sessionId.startsWith(`build:`)?`${t||`repo`} · builds`:`${t||`repo`} · new session`}let n=t.find(t=>t.id===e.sessionId);return n?`${n.title}${e.mode===`backlog`?` · backlog`:``}`:`${e.cwd.split(`/`).filter(Boolean).pop()??e.cwd}${e.mode===`backlog`?` · backlog`:` · session gone`}`}function Lg(e,t=Date.now()){let n=e.map(e=>e.sentAt??e.ts),r=n.length?Math.min(...n):t,i=Math.max(0,Math.round((t-r)/1e3)),a=e.length>1?` (${e.length})`:``,o=e.some(e=>e.mode===`upload`)?`Uploading`:`Sending`,s=e.filter(e=>e.status===`queued`&&e.retryAt!=null).map(e=>e.retryAt);if(s.length===e.length&&s.length){let n=Math.max(1e3,Math.min(...s)-t),r=n<6e4?`${Math.round(n/1e3)}s`:`${Math.round(n/6e4)} min`,i=e.length===1&&e[0].waitReason?` — ${e[0].waitReason}`:``;return`${o}${a}…${i?`${i};`:``} retrying in ${r}`}return`${o}${a}… ${i}s${i>=20?` — no receipt yet, will retry`:``}`}function Rg(e){let t=Gn(e).trim().replace(/\s+/g,` `);return t?t.length>64?`${t.slice(0,64)}…`:t:e.mode===`upload`?`a file`:`an action`}function zg(e){return new Set(e.filter(Ze).map(e=>e.id))}function Bg(e,t){for(let n of e)if(!t.has(n))return!0;return!1}function Vg(e,t){return{...e,status:`pending`,attempts:(e.attempts??0)+1,sentAt:t,firstTryAt:e.firstTryAt??t,waitReason:void 0}}function Hg(e){let t=e.firstTryAt;return e.mode===`upload`?null:e.mode===`op`?e.op?t==null?e.op:A(e.op,t):null:e.mode===`backlog`?{t:`backlog.add`,text:e.text,repoDir:e.cwd,label:e.label??e.text.slice(0,40),fire:e.fire,targetSessionId:e.targetSessionId,autoFire:e.autoFire,ackId:e.ackId,firstSentAt:t,steps:e.steps,resume:e.resume,...typeof e.closeWhenDone==`boolean`?{closeWhenDone:e.closeWhenDone}:{},...e.flagWhenDone?{flagWhenDone:!0}:{},...e.budget?{budget:e.budget}:{},...e.launch?{launch:e.launch}:{},...e.pastBudget?{pastBudget:!0}:{}}:e.answer?{t:`session.input`,id:e.sessionId,data:e.text,ackId:e.ackId,firstSentAt:t,expectPrompt:e.answer.fingerprint,promptSubmit:e.answer.submitBox,promptChoice:e.answer.choice,...e.answer.text===void 0?{}:{promptText:e.answer.text}}:{t:`session.input`,id:e.sessionId,data:e.text,ackId:e.ackId,firstSentAt:t,submit:!0,cwd:e.cwd,view:e.view}}function Ug(e){return`sending “${e}”…`}var Wg=`pending:`;function Gg(e){let t=e.remembered;if(t?.startsWith(Wg)){let n=t.slice(8);if(e.pendingAlive(n))return{do:`enter`,ack:n}}else if(t){let n=e.sessions.find(e=>e.id===t);if(n&&n.running)return{do:`attach`,id:n.id}}let n=e.sessions.find(t=>t.running&&!t.companionOf&&t.cwd===e.cwd&&e.isShell(t.backend));return n?{do:`attach`,id:n.id}:{do:`open`}}function Kg(e,t,n){return e===`${Wg}${t}`?n:e}function qg(e,t,n){let r=!1,i={};for(let[a,o]of Object.entries(e)){let e=Kg(o,t,n);e!==o&&(r=!0),i[a]=e}return r?i:e}function Jg(e){return`back to ${e}`}function Yg(e,t){return!!e&&!!t&&e.sessionId===t}var Xg=Xc({}),Zg=Xc(null);function Qg(e,t,n){Xg.set(n=>n[e]===t?n:{...n,[e]:t}),n&&Zg.set(()=>({sessionId:t,to:n}))}function $g(e,t){Xg.set(n=>qg(n,e,t)),Zg.set(n=>{if(!n)return n;let r=Kg(n.sessionId,e,t);return r===n.sessionId?n:{...n,sessionId:r}})}function e_(){Zg.set(null)}var t_=3e4;function n_(e){return e?.adoptedAt&&Date.now()-e.adoptedAt>t_?void 0:e}function r_(e,t,n){let r=(0,Z.useRef)(new Map),i=(0,Z.useMemo)(()=>{if(!Eg(e))return null;let n=e.slice(Tg.length);return t.find(e=>e.ackId===n&&qi(e))??null},[t,e]);return{pendingKept:r,pendingEntry:i,pendingSession:(0,Z.useMemo)(()=>{if(e&&!Eg(e)){if(n.some(t=>t.id===e))return null;let t=n_(r.current.get(e));return t?.adoptedAt?{id:e,cwd:t.cwd,title:t.title,remoteControl:!1,running:!0,createdAt:t.ts}:null}if(!Eg(e))return null;if(kg(e)){let t=e.slice(Og.length);return{id:e,cwd:t,title:Td(t)||`new session`,remoteControl:!1,running:!0,createdAt:Date.now()}}let t=i,a=n_(r.current.get(e.slice(Tg.length)));if(!t&&!a)return null;let o=t?.op,s=t?.cwd||a?.cwd||``;return{id:e,cwd:s,title:o?.title||a?.title||Td(s)||`new session`,remoteControl:!1,running:!0,createdAt:t?.ts??a?.ts??Date.now(),model:o?.launch?.model,effort:o?.launch?.effort,permissionMode:o?.launch?.permissionMode,remoteControlled:o?.launch?.remoteControlled}},[i,e,n])}}function i_(e){let{outboxRef:n,pendingKept:r,activeIdRef:i,connRef:a,wantNavRef:o,buffers:s,pendingEntry:c}=e,l=t=>e.writeOutbox(t),u=(t,n)=>e.addOutbox(t,n),d=(t,n,r,i)=>e.queueOp(t,n,r,i),f=e.setOverlay,p=e.setActiveId,m=e.setLastVisitedId;function h(e){let t=n.current.find(t=>qi(t)&&t.cwd===e&&t.status!==`failed`);t&&_(t.ackId)}function g(e){o.current=!1,f(null),p(Ag(e))}function _(e){let t=n.current.find(t=>t.ackId===e),i=t?.op;for(t&&r.current.set(e,{cwd:t.cwd,title:i?.title||Td(t.cwd),ts:t.ts});r.current.size>8;)r.current.delete(r.current.keys().next().value);o.current=!1,f(null),p(Dg(e))}function v(){let e=c,t=e?.op;if(!e||e.status!==`failed`||t?.t!==`session.create`)return;W(`action:session.pending.retry`);let r=n.current.filter(t=>t.mode===`input`&&t.createAck===e.ackId&&t.status===`failed`).sort((e,t)=>e.ts-t.ts),i=new Set([e.ackId,...r.map(e=>e.ackId)]);l(n.current.filter(e=>!i.has(e.ackId)));let o=Mr(),{ackId:s,...u}=t;d(u,e.sessionId,e.text,{cwd:e.cwd,focus:!0,ackId:o});for(let e of r)b(e.cwd,e.text,o,e.kind===`command`?`command`:`prompt`);_(o),G(a.current.status===`open`?`trying again…`:`queued — it opens when the link is back`)}function y(e,t){let n=Dg(e),a=r.current.get(e);if(a){let n={...a,adoptedAt:Date.now()};r.current.set(e,n),r.current.set(t,n)}if($g(e,t),i.current!==n)return;let o=Ul(n);o&&wo(t,o),wo(n,``),s.current.has(t)||s.current.set(t,[]),p(t),m(t)}function b(e,t,n,r=`prompt`){u({ackId:Mr(),sessionId:`create:${e}`,cwd:e,text:t,ts:Date.now(),status:`queued`,attempts:0,kind:r,mode:`input`,pendingCreate:!0,holdUntilIdle:!0,createAck:n,armed:!0})}function x(e,r){let i=new Set(t(n.current,e,r).map(e=>e.ackId));l(n.current.map(e=>i.has(e.ackId)?{...e,noTtl:!0}:e))}function S(e,r,i){let a=new Set(t(n.current,e,i).map(e=>e.ackId));l(n.current.map(e=>a.has(e.ackId)?(Mn(),{...e,status:`failed`,reason:r,failedAt:Date.now()}):e))}function C(e,t){let r=e.upload?.relPath;if(!r)return;let i=e=>e.text.includes(r)||e.mode===`op`&&JSON.stringify(e.op??``).includes(r);l(n.current.map(n=>n.ackId!==e.ackId&&n.status===`queued`&&n.sessionId===e.sessionId&&i(n)?(Mn(),{...n,status:`failed`,reason:t,failedAt:Date.now()}):n))}return{enterPending:_,enterOldestPending:h,enterLater:g,retryPendingCreate:v,adoptPendingSession:y,queueSessionPrompt:b,holdForLaunch:x,failPendingCreates:S,failDependentUploads:C}}function a_(e){let{connRef:t,sessionsRef:r,backendsRef:i,exitedRef:s,outboxRef:c,ackTimers:l,uploadsInFlight:u,uploadAborts:d,busyLanesRef:f,budgetHeldLanesRef:p,busySerialRef:m,serialWatchRef:h,budgetRef:g,autoSendRef:_,holdQueueRef:y,flushIdleReason:b,queueBlockedRef:x,readModeRef:S,serialSessionsRef:C,sessions:T}=e,{inflightRef:E,upBytesRef:D}=e.up,O=()=>e.up.refreshUploadLabel(),k=t=>e.writeOutbox(t),ee=(t,n)=>e.addOutbox(t,n),A=t=>e.addOutboxFirstInLane(t),j=(t,n,r)=>e.failOutbox(t,n,r),ne=t=>e.holdWall(t),M=(t,n,r,i)=>e.queueSessionPrompt(t,n,r,i);async function P(e,t=!0){if(e.mode!==`upload`)return;let n=e.upload?await Ei(`uploads`,e.ackId):null;n&&e.upload&&await Yn(e.upload.relPath,n),t&&await mi(`uploads`,e.ackId)}function re(e){return Mg(e,zi())}function F(e){let t=Date.now();k(c.current.map(n=>{if(n.ackId!==e||n.status===`failed`)return n;let r=(n.round??0)+1,i=ct(r);return{...n,status:`queued`,attempts:0,round:r,retryAt:t+i,waitReason:`the desktop hasn't answered yet`}}));let n=c.current.find(t=>t.ackId===e);n&&(n.round??0)===1&&G(`still sending — the desktop hasn't confirmed yet. Retrying in ${Math.round(ct(1)/6e4)} min; your text is safe.`)}function I(e,n=yg){let r=window.setTimeout(()=>{l.current.delete(e);let n=c.current,r=t.current.status!==`open`;n.some(t=>t.ackId===e&&t.status===`pending`)&&(qs(),k(n.map(t=>t.ackId===e?Ng(t,r):t))),R()},n);l.current.set(e,r)}function ie(){if(t.current.status!==`open`||kc().pending.includes(`sessions`))return[];let e=new Set(r.current.filter(e=>e.running).map(e=>e.id));return Fg(c.current,e,s.current)}function R(n=!1){if(n&&(y.current=!1,k(c.current.map(e=>e.status===`queued`?{...e,armed:!0,retryAt:void 0,waitReason:void 0,holdUntilIdle:e.holdUntilIdle&&(e.pendingCreate||ne(e.sessionId))?!0:void 0}:e))),t.current.status!==`open`)return b.current=L([],{online:!1,queued:1}),0;let a=ie(),s=ke(c.current,{now:Date.now(),inflight:[...l.current.keys(),...u.current],maxAttempts:8,minTryMs:w,busyLanes:f.current,busySerial:(()=>{let e=o(Pa(r.current,i.current),h.current,Date.now());return m.current=e.busy,h.current=e.watches,e.busy})(),budgetBlocked:g.current?.verdict.blocked??!1,goneLanes:a,budgetHeldLanes:p.current});s.release.length&&k(te(c.current,s.release));for(let e of s.expire)Ga(),F(e.ackId);let d={autoSend:_.current,hold:y.current},v=0,S=[...s.blocked];for(let e of s.send){if(!$e(e,d)){S.push({ackId:e.ackId,sessionId:e.sessionId,reason:`gate`});continue}let n=Date.now(),r=Vg(e,n);if(k(c.current.map(t=>t.ackId===e.ackId?Vg(t,n):t)),e.mode===`upload`){ue(e),v++;continue}let i=Hg(r);i&&t.current.send(i),I(e.ackId,re(e)),v++}let C=new Map(S.map(e=>[e.ackId,e.reason]));return x.current=C,e.setQueueBlocked(C),b.current=v?null:L(S,{online:!0,queued:c.current.filter(e=>e.status===`queued`).length,serialText:(()=>{let e=S.find(e=>e.reason===`serial`),t=e&&c.current.find(t=>t.ackId===e.ackId);return t?.serial?un(t.serial,r.current,i.current):void 0})()}),v}function z(e=`nothing queued`){return b.current??e}function B(){window.setTimeout(()=>{R()},450)}function oe(e){let t=v(c.current,e)[0],n=t?{relPath:t,reason:`it never uploaded`}:Bn(e);return n?`${n.relPath.split(`/`).pop()} — ${n.reason}. Re-attach it before sending.`:null}function se(e,t){let n=oe(e);if(n)return G(n),!1;let r=N(c.current,e,t);return r.some((e,t)=>e!==c.current[t])&&k(r),!0}function ce(e){let t=oe(e.join(`
|
|
2
2
|
`));return!t||(G(t),!1)}function le(e,n,r,i,a=!1){if(!a&&de(r)){let t=T.find(t=>t.id===e);t&&(t.hooked?t.turnActive:t.running&&!t.idle)&&(a=!0,G(`${r.trim().split(/\s+/)[0]} opens a view — held until this turn ends`))}if(!se(r,jg(e,n)))return!1;if(kg(e))return G(`this session starts only when its backlog item runs — write it in the box and Send`),!1;if(Eg(e))return M(n,r,e.slice(Tg.length),i),R(),!0;let o=Mr(),s=t.current.status!==`open`;return ee({ackId:o,sessionId:e,cwd:n,text:r,ts:Date.now(),status:`queued`,attempts:0,kind:i,mode:`input`,offline:s,armed:!s,holdUntilIdle:a||void 0,view:S.current?`read`:`term`}),s||pe(e),R(),!0}function V(e,n,r,i){let a=i?.ackId??Mr(),o=t.current.status!==`open`,s=i?.cwd??``,c=(i?.serial??C.current)&&e.t===`session.create`&&e.prompt&&s?ae(s):void 0;return ee({ackId:a,sessionId:n,cwd:s,text:r,ts:Date.now(),status:`queued`,attempts:0,mode:`op`,serial:c,op:{...e,ackId:a},focus:i?.focus&&!o?!0:void 0,offline:o,armed:!o},i?.frontOfLane),i?.track&&Sc(a),o||pe(n),R(),o}async function H(e,t,n,r,i){r=jg(r,i);let a=Mr(),{name:o,relPath:s}=Ep(n);return await Un(`uploads`,a,t),await Ei(`uploads`,a)?(ee({ackId:a,sessionId:r,cwd:i,text:`file · ${o}`,ts:Date.now(),status:`queued`,attempts:0,mode:`upload`,upload:{repoId:e,name:o,relPath:s,size:t.size,type:t.type||`application/octet-stream`},armed:!0}),R(),{relPath:s,ackId:a}):null}async function ue(e){let n=e.upload;if(!n){j(e.ackId,`not an image`),B();return}u.current.add(e.ackId);let r=new AbortController;d.current.set(e.ackId,r),E.current++,D.current.startedAt||(D.current.startedAt=Date.now()),D.current.total+=n.size,O();let i=0,o=Date.now(),s=!1,l=0,f=()=>{window.clearTimeout(l),l=window.setTimeout(()=>{s=!0,r.abort(new me(`upload`,wg))},wg)};f();try{let t=await Ei(`uploads`,e.ackId);if(!t){j(e.ackId,`the file's bytes are no longer on this device`);return}let a=await el.uploadInbox(n.repoId,t,n.name,r.signal,e=>{D.current.sent+=Math.max(0,e-i),i=e,f(),O()},!0),s=a.saved?.[0]?.relPath;if(!s){j(e.ackId,a.skipped?.[0]?.error||`the host refused the file`);return}Fu(n.repoId,s,a.saved[0].mtime),io(n.size,Date.now()-o),mi(`uploads`,e.ackId),s!==n.relPath&&fe(n.relPath,s),k(c.current.filter(t=>t.ackId!==e.ackId))}catch(n){if(n?.permanent){j(e.ackId,n.message);return}let r=a({responded:n?.responded,stalled:s,socketOpen:t.current.status===`open`});k(c.current.map(t=>t.ackId===e.ackId&&t.status===`pending`?Ng(t,r):t))}finally{window.clearTimeout(l),D.current.sent+=Math.max(0,n.size-i),E.current=Math.max(0,E.current-1),O(),d.current.delete(e.ackId),u.current.delete(e.ackId),B()}}function fe(t,n){k(c.current.map(e=>{if(!e.text.includes(t))return e;let r=e.text.split(t).join(n);if(e.mode===`op`&&e.op){let i={...e.op};return typeof i.text==`string`&&(i.text=i.text.split(t).join(n)),typeof i.prompt==`string`&&(i.prompt=i.prompt.split(t).join(n)),{...e,text:r,op:i}}return{...e,text:r,label:e.mode===`backlog`?r.slice(0,40):e.label}})),e.setCompose(e=>e.includes(t)?e.split(t).join(n):e)}function pe(e){let t=c.current.filter(t=>t.sessionId===e&&t.status===`queued`&&!t.armed);t.length&&(k(c.current.map(t=>t.sessionId===e&&t.status===`queued`?{...t,armed:!0}:t)),G(`sending ${t.length} earlier queued message${t.length>1?`s`:``} first`))}function he(e){if(!se(e.text,e.targetSessionId??e.repoDir))return null;let n=Mr(),r=t.current.status!==`open`;return ee({ackId:n,sessionId:e.targetSessionId??e.repoDir,cwd:e.repoDir,text:e.text,ts:Date.now(),status:`queued`,attempts:0,mode:`backlog`,label:e.label,fire:e.fire,autoFire:e.autoFire,targetSessionId:e.targetSessionId,steps:e.steps&&e.steps.length>1?e.steps:void 0,resume:e.resume||void 0,closeWhenDone:typeof e.closeWhenDone==`boolean`?e.closeWhenDone:void 0,flagWhenDone:e.flagWhenDone===!0||void 0,budget:e.budget,launch:e.launch,pastBudget:e.pastBudget||void 0,offline:r,armed:!r}),r||pe(e.targetSessionId??e.repoDir),R(),r}function ge(e,r,i,a,o,s){let c=e.prompt;if(!c)return;let l=t.current.status!==`open`;A({ackId:Mr(),sessionId:e.id,cwd:e.cwd,text:r,ts:Date.now(),status:`queued`,attempts:0,mode:`input`,answer:{fingerprint:n(c),question:c.question,label:i,...a?{submitBox:!0}:{},...o==null?{}:{choice:o},...s===void 0?{}:{text:s}},offline:l,armed:!0}),G(l?`answer saved — “${i}” goes out when the link is back`:Ug(i)),R()}return{retainUploadBytes:P,ackWindowFor:re,nextRound:F,armAckTimeout:I,goneLanes:ie,flushOutbox:R,idleReason:z,releaseLane:B,uploadRefusal:oe,guardUploadRefs:se,guardChain:ce,submitInput:le,queueOp:V,queueImageUpload:H,runUpload:ue,rewriteQueuedPath:fe,armLane:pe,queueBacklog:he,answerPrompt:ge}}function o_(e){let{outboxRef:t,outbox:n,pendingKept:r,activeIdRef:i,connRef:a,sessions:o,activeId:s}=e,c=t=>e.writeOutbox(t),l=t=>e.flushOutbox(t),u=t=>e.idleReason(t),d=t=>e.holdWall(t),f=(t,n)=>e.retainUploadBytes(t,n),p=(t,n,r)=>e.failPendingCreates(t,n,r),m=(t,n,r)=>e.queueSessionPrompt(t,n,r),h=e.openSend,g=e.sendTargetFor,_=e.setActiveId,v=e.setCompose;function y(){let e=yp(n);if(!e){G(ii(n)?`those are files, not text — open the message that names one and re-attach it there`:`nothing to put back — the failed items are actions, not text`);return}let t=n.filter(e=>e.status===`failed`&&e.mode!==`op`).length-1;h({prompts:[Gn(e)],target:g(e.sessionId,e.cwd),cwdHint:e.cwd,repoId:ne(e),ackId:e.ackId,repair:!0,openAfter:!0,origin:t>0?`This one never went — ${t} more under Manage`:`This one never went`})}function b(){for(let e of t.current)e.status===`failed`&&e.mode===`upload`&&f(e);c(t.current.filter(e=>e.status!==`failed`))}function x(e,n){c(t.current.map(t=>{if(t.ackId!==e||t.status!==`queued`)return t;if(t.mode===`op`){let e=t.op;return e?.t===`session.create`?{...t,text:n,op:{...e,prompt:n}}:!e||e.t!==`fanout.run`&&e.t!==`fanout.followup`?t:{...t,text:n,op:{...e,text:n}}}return{...t,text:n,label:t.mode===`backlog`?n.slice(0,40):t.label}}))}function S(e,n){let r=t.current,i=r.find(t=>t.ackId===e);return i?Qe(i)?(W(`action:queue.retarget`),c(he(r,e,{...n,ackId:Mr()})),G(n.mode===`backlog`?`moved to that repo's backlog`:`moved to that session`),!0):(G(i.mode===`op`?`an action can't be re-aimed`:`already on its way`),!1):!1}function C(e){let n=t.current,r=n.find(t=>t.ackId===e);if(!r)return;if(!Qe(r)){G(`already on its way`);return}if(de(r.text??``)){r.holdUntilIdle||w(e),G(Is(`idle`,{online:a.current.status===`open`,holder:`phone`,phoneHold:`opens-a-view`}));return}W(`action:queue.handtodesktop`);let i=Mr();c(he(n,e,{sessionId:r.sessionId,cwd:r.cwd,ackId:i,mode:`backlog`,targetSessionId:r.sessionId}).map(e=>e.ackId===i?{...e,autoFire:!0,holdUntilIdle:void 0,kind:void 0}:e)),l(),G(Is(`idle`,{online:a.current.status===`open`,holder:`desktop`}))}function w(e){W(`action:queue.hold`),c(t.current.map(t=>t.ackId===e&&t.status===`queued`?{...t,holdUntilIdle:!t.holdUntilIdle||void 0}:t)),l()}function T(e){W(`action:queue.serial`),c(t.current.map(t=>t.ackId===e&&t.status===`queued`&&Kt(t)?{...t,serial:t.serial?void 0:ae(t.cwd)}:t)),l()}function E(e){return t.current.filter(t=>t.mode!==`op`||t.status===`pending`?!1:t.op?.t===`schedule.run`?t.op.id===e:t.op?.t===`schedule.save`&&t.op.entry?.id===e)}function D(e){if(!e.length)return;let n=new Set(e.map(e=>e.ackId));c(t.current.filter(e=>!n.has(e.ackId)))}function O(e){let n=t.current.find(t=>t.ackId===e);r.current.delete(e),i.current===Dg(e)&&_(null),n?f(n):mi(`uploads`,e),n?.mode===`upload`&&n.upload&&di(n.upload.relPath,`the upload was canceled`),c(t.current.filter(t=>t.ackId!==e)),n&&qi(n)&&p(n.sessionId,`the session it was queued for was discarded`,n.ackId)}function k(e,n){let r=t.current.find(t=>t.ackId===e);!r||!qi(r)||r.status!==`queued`?G(`that session is already on its way`):(W(`action:queue.addprompt`),m(r.cwd,n,r.ackId),G(`queued — it runs after the one before it finishes`))}function ee(e,n){c(it(t.current,e,n))}function A(e){let n=t.current,r=n.find(t=>t.ackId===e);if(!r)return;if(r.status===`failed`){if(!xn(r)){G(Nn(r)?`it may already be in that session — open it and look, or rewrite it to send a fresh copy`:`the desktop remembers refusing this exact message — rewrite it to send it as a new one`);return}r.mode===`upload`&&r.upload&&(Wf(r.upload.relPath),na(r.upload.relPath)),n=c(n.map(t=>t.ackId===e?{...t,status:`queued`,attempts:0,tries:0,round:void 0,retryAt:void 0,waitReason:void 0,ts:Date.now(),reason:void 0,armed:!0}:t))}let i=n.find(t=>t.ackId===e);if(!i)return;let a=n.indexOf(i),o=n.filter((e,t)=>t<a&&e.sessionId===i.sessionId&&e.status===`queued`&&!e.armed),s=i.holdUntilIdle&&!i.pendingCreate?d(i.sessionId):null;s?G(s):(c(n.map((t,n)=>t.ackId===e?{...t,armed:!0,retryAt:void 0,waitReason:void 0,serial:void 0,holdUntilIdle:Pg(t)}:n<a&&t.sessionId===i.sessionId&&t.status===`queued`?{...t,armed:!0,retryAt:void 0,waitReason:void 0,holdUntilIdle:Pg(t)}:t)),l()?o.length&&G(`${o.length} earlier message${o.length>1?`s`:``} in this session go first`):G(u(`nothing left to send`)))}function te(){let e=t.current.filter(xn);if(!e.length){G(`nothing to try again`);return}for(let t of e)t.mode===`upload`&&t.upload&&(Wf(t.upload.relPath),na(t.upload.relPath));let n=new Set(e.map(e=>e.ackId));c(t.current.map(e=>n.has(e.ackId)?{...e,status:`queued`,attempts:0,tries:0,round:void 0,retryAt:void 0,waitReason:void 0,ts:Date.now(),reason:void 0,failState:void 0,failedAt:void 0,armed:!0}:e));let r=l();G(r?`${e.length} back in the queue — sending…`:`${e.length} back in the queue — ${u(`waiting`)}`)}function j(e){let n=t.current.find(t=>t.ackId===e);if(!n)return;if(n.mode===`op`){G(`that's an action — discard it instead`);return}if(n.pendingCreate){O(e),v(e=>e?`${e}\n${n.text}`:n.text),G(`moved into the message box`);return}O(e);let r=o.find(e=>e.id===n.sessionId);if(!r){v(e=>e?`${e}\n${n.text}`:n.text),G(`moved into the message box`);return}let i=Ul(r.id),a=i?`${i}\n${n.text}`:n.text;wo(r.id,a),s===r.id&&v(a),G(`moved into ${r.title}'s message box`)}function ne(t){return e.repoForCwd(t.cwd)?.id??null}return{restoreOutbox:y,dismissOutbox:b,editQueued:x,retargetQueued:S,handToDesktop:C,toggleHoldQueued:w,toggleSerialQueued:T,scheduleQueueRows:E,dropScheduleQueue:D,removeQueued:O,addPromptToQueuedCreate:k,moveQueued:ee,sendQueuedNow:A,retryFailedQueued:te,restoreQueued:j,repoIdOfEntry:ne}}function s_(){let[e,t]=(0,Z.useState)(null),[n,r]=(0,Z.useState)(0),[i,a]=(0,Z.useState)(null),o=(0,Z.useRef)(0),s=(0,Z.useRef)(0),c=(0,Z.useRef)({sent:0,total:0,startedAt:0,fullAt:0}),l=(0,Z.useRef)(new Set),u=(0,Z.useRef)(null);function d(){let e=o.current;if(r(s.current),e<=0){c.current={sent:0,total:0,startedAt:0,fullAt:0},t(null),a(null);return}let n=Date.now(),{sent:i,total:l,startedAt:u}=c.current,d=u?n-u:0,f=d>700&&i>4e4?i/1024/(d/1e3):null,p=l>0&&i>=l;p?c.current.fullAt||(c.current.fullAt=n):c.current.fullAt=0;let m=c.current.fullAt?Math.round((n-c.current.fullAt)/1e3):0,h=l>0?p?100:Math.min(99,Math.round(i/l*100)):0,g=l>i?pr(l-i,f):null;t(l<=0?`Uploading ${e}…`:p?`Sent ${Uu(l)} · waiting for the host${m>2?` · ${m}s`:``}`:`Uploading ${e} · ${h}% · ${Uu(i)}/${Uu(l)}${f?` · ${Math.round(f)} kB/s`:``}${g?` · ${g}`:``}`),a({sent:i,total:l,pct:h,kbps:f,waiting:p})}let f=e!=null,p=vg(f,900);return(0,Z.useEffect)(()=>{if(!f)return;let e=window.setInterval(()=>d(),1e3);return()=>window.clearInterval(e)},[f]),{uploading:e,parking:n,upProg:i,setUploading:t,setUpProg:a,inflightRef:o,parkingRef:s,upBytesRef:c,allBufsRef:l,uploadBufRef:u,refreshUploadLabel:d,uploadPending:f,uploadRowLinger:p}}function c_(e){let{inflightRef:t,parkingRef:n,upBytesRef:r,allBufsRef:i,uploadBufRef:a,setUploading:o,setUpProg:s}=e.up,c=()=>e.up.refreshUploadLabel(),{uploadsInFlight:l,uploadAborts:u,sessionsRef:d,activeIdRef:f,composeTextRef:p,connRef:m,repos:h}=e,g=e.getActive,_=(t,n,r,i,a)=>e.queueImageUpload(t,n,r,i,a),v=t=>e.removeQueued(t),y=t=>e.queueBacklog(t),b=(t,n,r,i,a)=>e.submitInput(t,n,r,i,a),x=t=>e.pushHistory(t),S=e.setCompose;function C(e){let t=a.current;if(t&&!t.closed&&t.repoId===e)return t;let n=g(),r=n?{id:n.id,cwd:n.cwd}:void 0,o={repoId:e,slots:[],started:0,done:0,closed:!1,submit:!1,queue:!1,ctrl:new AbortController,ackIds:[],target:r};return i.current.add(o),a.current=o}function w(e,r,i,a,o){let s=e.started++;e.slots[s]=null,t.current++,n.current++,c(),(async()=>{let l=null,u=h.find(t=>t.id===e.repoId)?.worktreePath??e.repoId,d=e.target?.id??`create:${u}`;try{let t=r instanceof Blob?r:await r,{width:n}=_o(),s=await ko(t,i,n),c=await _(e.repoId,s.blob,s.name,d,e.target?.cwd??u);if(!c)e.fail??=`this browser can't hold files offline — reconnect and re-attach`,G(e.fail);else{e.ackIds.push(c.ackId);let t=await Promise.resolve(a),n=s.width&&s.height?{w:s.width,h:s.height}:o??null,r=t?kt(t,n):``;l=r?`${c.relPath} (marked: ${r})`:c.relPath}}catch{e.fail??=`couldn't read that image`}t.current=Math.max(0,t.current-1),n.current=Math.max(0,n.current-1),e.ctrl.signal.aborted?c():(e.slots[s]=l,e.done++,c(),E(e))})()}function T(){let e=new Set(l.current);for(let t of i.current){t.ctrl.abort();for(let n of t.ackIds)e.add(n)}if(a.current){a.current.ctrl.abort();for(let t of a.current.ackIds)e.add(t)}if(i.current.clear(),a.current=null,e.size||t.current){for(let t of e)u.current.get(t)?.abort(),v(t);t.current=0,n.current=0,r.current={sent:0,total:0,startedAt:0,fullAt:0},o(null),s(null),G(`Uploads canceled`)}}function E(t){if(t.finalized||t.done<t.started||!t.closed)return;t.finalized=!0,i.current.delete(t),a.current===t&&(a.current=null);let n=t.slots.filter(e=>!!e);if(!n.length){G(t.fail??`Upload failed`);return}let r=n.join(` `);Ss(r);let o=t.target?d.current.find(e=>e.id===t.target.id&&e.running):null,s=!t.target||f.current===t.target.id,c=p.current,l=c?`${c}${c.endsWith(` `)?``:` `}${r}`:r;if(t.queue&&t.target){let i=(s?l:r).trim();if(y({text:i,repoDir:t.target.cwd,label:i.slice(0,40),targetSessionId:o?t.target.id:void 0,autoFire:!0})===null)return;x(i),s&&S(``),s&&kg(t.target.id)&&e.setActiveId(null),G(o?`Attached ${n.length} · ${Is(`idle`,{online:m.current.status===`open`,holder:`desktop`})}`:`Attached ${n.length} · waiting in this repo's backlog — it opens a session of its own when it runs`)}else if(t.submit&&o){let e=s?l:r;if(!b(o.id,o.cwd,e,e.trimStart().startsWith(`/`)?`command`:`prompt`))return;x(e),s&&S(``),G(`Attached ${n.length} · submitted`)}else s?(S(l),G(t.submit&&!kg(t.target?.id)?`Attached ${n.length} · session gone, in box`:`Attached ${n.length} · ready`)):G(`Attached ${n.length} · copied (switched away)`)}return{ensureUploadBuf:C,queueUpload:w,cancelUploads:T,settleUploads:E}}function l_(e){let{ackTimers:t,outboxRef:n,serialWatchRef:r}=e,i=e,a=t=>e.writeOutbox(t),o=t=>e.flushOutbox(t),s=(t,n,r)=>e.failOutbox(t,n,r),c=()=>e.releaseLane(),l=e.applyDeliverySettled,u=(t,n,r)=>e.failPendingCreates(t,n,r),d=(t,n)=>e.adoptPendingSession(t,n),f=(t,n)=>e.holdForLaunch(t,n);function p(e){let r=t.current.get(e.ackId);r!=null&&(clearTimeout(r),t.current.delete(e.ackId)),e.ok?a(n.current.filter(t=>t.ackId!==e.ackId)):s(e.ackId,e.reason||`could not queue`),c()}function m(e){let o=t.current.get(e.ackId);o!=null&&(clearTimeout(o),t.current.delete(e.ackId));let l=n.current.find(t=>t.ackId===e.ackId);gf(e.ackId,e.ok,e.runId,e.reason),l?.op?.t===`signin.continue`&&G(e.reason||(e.ok?`continuing after the sign-in`:`nothing was continued`)),e.ok?(a(n.current.filter(t=>t.ackId!==e.ackId)),l&&qi(l)&&(l.serial&&e.sessionId&&(r.current=[...r.current.filter(e=>e.group!==l.serial),{group:l.serial,sessionId:e.sessionId,at:Date.now()}]),e.sessionId?(a(Me(n.current,l.sessionId,e.sessionId,Date.now(),l.ackId)),d(l.ackId,e.sessionId)):e.launchId?f(l.sessionId,l.ackId):u(l.sessionId,`the session was never named — re-aim these or discard them`,l.ackId)),l?.focus&&e.sessionId&&i.focusSession(e.sessionId)):(s(e.ackId,e.reason||`could not start`,`refused`),l?.op?.t===`intent.requeue`&&G(e.reason||`it was not put back — the desktop refused it`)),c()}function h(e){let r=t.current.get(e.ackId);r!=null&&(clearTimeout(r),t.current.delete(e.ackId));let i=n.current.find(t=>t.ackId===e.ackId);if(e.ok)e.state===`forked`?G(e.reason||`forked into a new session`):i&&If(Date.now()-i.ts),i?.answer&&Fa(Ug(i.answer.label)),a(n.current.filter(t=>t.ackId!==e.ackId)),c();else if(e.retryable)a(n.current.map(t=>t.ackId===e.ackId&&t.status===`pending`?{...Ng(t,!1),waitReason:e.reason||void 0}:t)),c();else if(e.state===`rescued`)a(n.current.filter(t=>t.ackId!==e.ackId)),G(e.reason||`that session is gone — the words are a backlog item now`),c();else{if(s(e.ackId,e.reason||`session gone`,e.state===`unconfirmed`||e.state===`unsubmitted`||e.state===`stale`?e.state:`other`),e.state===`stale`){let e=i?.answer;G(e?`“${e.label}” wasn't sent — that question is gone: ${e.question.slice(0,60)}`:`answer not sent — that question is gone`)}else e.state===`unsubmitted`&&G(`prompt is in the composer but Return didn't take — open the session and press Return`);c()}}function g(e){for(let t of e.items)l(t)}function _(e){l(e.item)}function v(e){i.setLaunches(e.launches);for(let t of e.launches)(t.state===`failed`||t.state===`canceled`)&&u(`create:${t.cwd}`,t.reason||`the session never opened`,t.id)}function y(e){a(Me(n.current,`create:${e.cwd}`,e.sessionId,Date.now(),e.id)),d(e.id,e.sessionId),o()}function b(e){let t={budget:e.budget,verdict:e.verdict,...e.periods?{periods:e.periods}:{}};i.setBudget(t),i.budgetRef.current=t,e.verdict.blocked||o()}return{onBacklogAck:p,onOpAck:m,onInputAck:h,onDeliveryList:g,onDeliverySettled:_,onLaunchList:v,onLaunchOpened:y,onBudget:b}}function u_(e,t,n){if(!Array.isArray(e)||!e.length)return{doc:t,n:0};let r=new Set(t.notes.map(e=>e.id)),i=new Map(t.tombs.map(e=>[e.id,e.gone])),a=new Map,o=t;for(let t of e){if(!t||typeof t!=`object`)continue;let e=t;if(typeof e.id!=`string`||!e.id||typeof e.text!=`string`||!e.text.trim()||r.has(e.id))continue;let s=typeof e.ts==`number`&&Number.isFinite(e.ts)?e.ts:n,c=i.get(e.id);if(c!==void 0&&c>=s)continue;let l=a.get(e.id);if(l!==void 0&&l>=s)continue;let u={id:e.id,text:e.text,ts:s},d=Array.isArray(e.steps)?e.steps.filter(e=>typeof e==`string`&&!!e.trim()):[];d.length&&(u.steps=d),typeof e.cwd==`string`&&e.cwd&&(u.cwd=e.cwd),o=xe(o,u),a.set(e.id,s)}return{doc:o,n:a.size}}function d_(){if(pt(U.padRescueMigrated))return 0;let e=()=>lt(U.padRescueMigrated,String(Date.now())),{doc:t,n}=u_(St(U.padRescue,[]),aa(),Date.now());return n?Io(t)?(e(),n):0:(e(),0)}function f_(e){if(pt(U.giveupsMigrated))return e;let t=St(U.giveups,[]);if(lt(U.giveupsMigrated,String(Date.now())),!Array.isArray(t)||!t.length)return e;let n=new Set(e.map(e=>e.ackId)),r=new Map(Fi().map(e=>[e.id,e])),i=[];for(let e of t){if(!e||e.retriedAt||e.ackId&&n.has(e.ackId)||e.bytes||e.kind===`file`||e.kind===`answer`)continue;let t=e.padId?r.get(e.padId):void 0,a=(t?[t.text,...t.steps??[]].join(`
|
|
3
3
|
|
|
4
4
|
`):e.text??``).trim();if(!a)continue;let o=e.cwd??``;i.push({ackId:Mr(),sessionId:o||`unknown`,cwd:o,text:a,ts:e.ts??Date.now(),status:`failed`,mode:`backlog`,label:a.slice(0,40),failedAt:e.ts??Date.now(),failState:e.failState,reason:e.reason?`${e.reason}${t?``:e.clipped?` (only the shortened copy was kept)`:``}`:`this one never reached a session`})}return i.length?[...e,...i.sort((e,t)=>e.ts-t.ts)]:e}function p_(e){Ec(Ci);let t=ud(bf),n=ud(mu),{conn:r,...i}=e,{status:a,connRef:s,reconnectAsk:c,setReconnectAsk:l}=r,{sessions:u}=i,d=mc(u),p=mc(i.backends),m=mc(i.activeId),h=no(`confirmQueue`),[g,v]=(0,Z.useState)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)([]),S=mc(b),[,C]=(0,Z.useState)(0),w=t.some(e=>e.status===`pending`||e.status===`queued`&&e.retryAt!=null);(0,Z.useEffect)(()=>{if(!w)return;let e=window.setInterval(()=>C(e=>e+1),1e3);return()=>window.clearInterval(e)},[w]);let T=vg(t.some(e=>e.status!==`failed`),Sg),D=(0,Z.useRef)(t),O=(0,Z.useRef)(new Map),ee=(0,Z.useRef)(new Set),A=(0,Z.useRef)(new Map),te=(0,Z.useRef)(new Set),j=(0,Z.useRef)(new Set),ne=(0,Z.useRef)(new Set),M=(0,Z.useRef)([]),N=(0,Z.useRef)(new Map),P=(0,Z.useRef)(!1),re=(0,Z.useRef)(null),F=(0,Z.useRef)(new Map),{pendingKept:I,pendingEntry:L,pendingSession:ie}=r_(i.activeId,t,u),R=s_(),ae={...i,connRef:s,status:a,reconnectAsk:c,setReconnectAsk:l,sessionsRef:d,backendsRef:p,activeIdRef:m,getActive:()=>u.find(e=>e.id===i.activeId)??ie,budgetRef:y,setBudget:v,launchesRef:S,setLaunches:x,serialSessionsRef:no(`serialSessions`),confirmQueueRef:h,autoSendRef:no(`autoSend`)},z=ae,B={...ae,outbox:t,outboxRef:D,ackTimers:O,uploadsInFlight:ee,uploadAborts:A,busyLanesRef:te,budgetHeldLanesRef:j,busySerialRef:ne,serialWatchRef:M,holdQueueRef:P,flushIdleReason:re,queueBlockedRef:F,setQueueBlocked:e=>mu.set(e),pendingKept:I,pendingEntry:L,up:R},oe=e=>B.writeOutbox(e),se=e=>B.flushOutbox(e),ce=(e,t)=>B.retainUploadBytes(e,t),V=(e,t,n)=>B.failPendingCreates(e,t,n),H=(e,t)=>B.failDependentUploads(e,t);function ue(e){let t=d.current.find(t=>t.id===e);if(!t)return null;let n=k({...Yf(t,p.current),turnActive:void 0});return n===`limit`?`blocked on a usage limit — it goes out at the reset`:n===`auth`?`that session is signed out — it goes out once you sign in there`:n===`net`?`the desktop is retrying that session's last turn after a network error — it goes out once that gets through`:n===`awaitingAnswer`?t.awaitingInput?`a dialog is open in that session — answer it first`:`a question is on screen in that session — answer it first`:null}function de(e){return br(e),D.current=e,bf.set(e),ts(e.filter(e=>e.status!==`failed`).length),e}function pe(e,t=!1){let n=D.current,r=t?f(n,e.sessionId):n.length,i=[...n.slice(0,r),e,...n.slice(r)];if(i.length>500){let e=i.length-500,t=new Set(i.filter(e=>e.status!==`failed`).slice(0,e).map(e=>e.ackId));t.size&&(i=i.map(e=>t.has(e.ackId)?(Mn(),{...e,status:`failed`,reason:`queue full — older messages were pushed out`,failedAt:Date.now()}):e),G(`queue full — ${t.size} older message${t.size>1?`s`:``} stopped; their words are in ${fd.activity}`))}if(i.length>1e3){let e=i.filter(e=>e.status===`failed`),t=new Set(e.slice(0,i.length-np).map(e=>e.ackId));t.size&&(i=i.filter(e=>!t.has(e.ackId)),G(`${t.size} of the oldest failed sends had to be dropped — this device is out of room for them`))}oe(i)}function me(e){pe(e,!0)}function he(e,t,n){let r=D.current,i=r.find(t=>t.ackId===e&&t.status!==`failed`);if(i&&(Mn(),G(Lf(n,t,z.overlayRef.current===`queue`)),oe(r.map(r=>r.ackId===e?{...r,status:`failed`,reason:t,failState:n??`other`,failedAt:Date.now()}:r)),qi(i)&&V(i.sessionId,`the session never opened — ${t}`,i.ackId),i.mode===`upload`&&i.upload)){di(i.upload.relPath,`it never uploaded — ${t}`),ce(i,!1),H(i,`the image it refers to never uploaded — ${t}`);for(let e of z.launchesRef.current)e.state===`waiting`&&e.needs.includes(i.upload.relPath)&&s.current.send({t:`launch.cancel`,id:e.id})}}function ge(e){if(!e.ackId||e.verdict===`open`)return;let t=D.current.find(t=>t.ackId===e.ackId&&t.status===`failed`);if(!t)return;if(e.verdict===`landed`){oe(D.current.filter(e=>e.ackId!==t.ackId)),G(`“${t.text.slice(0,40)}${t.text.length>40?`…`:``}” did run after all — cleared from the queue`);return}let n=e.verdict===`composer`?`still in that session's composer — open it and press Return`:e.reason??(e.verdict===`absent`?`checked — it never landed`:`still unreadable — the desktop could not tell`);oe(D.current.map(e=>e.ackId===t.ackId?{...e,reason:n,hostSettled:!0}:e))}Object.assign(B,{writeOutbox:de,addOutbox:pe,addOutboxFirstInLane:me,failOutbox:he,applyDeliverySettled:ge,holdWall:ue}),Object.assign(B,a_(B)),Object.assign(B,i_(B)),Object.assign(B,o_(B)),Object.assign(B,c_(B));let _e=l_(B);(0,Z.useEffect)(()=>{if(a!==`open`)return;let e=D.current.filter(e=>e.status===`queued`&&e.offline&&!e.armed);if(h.current&&e.length>0){P.current=!0,l(!0),se();return}P.current=!1;let t=se();if(t>0){let e=D.current.filter(e=>e.status!==`failed`).length;G(e>t?`sending ${e} queued messages…`:`sent ${t} queued message${t>1?`s`:``}`)}},[a]);let ve=t.filter(e=>e.status===`queued`&&e.offline&&!e.armed);(0,Z.useEffect)(()=>{c&&!ve.length&&(P.current=!1,l(!1))},[c,ve.length]),(0,Z.useEffect)(()=>{if(a===`open`)return;let e=D.current.filter(e=>e.status===`pending`&&e.mode!==`upload`);if(!e.length)return;for(let t of e){let e=O.current.get(t.ackId);e!=null&&(clearTimeout(e),O.current.delete(t.ackId))}let t=new Set(e.map(e=>e.ackId));oe(D.current.map(e=>t.has(e.ackId)?{...e,status:`queued`,attempts:Math.max(0,(e.attempts??1)-1),retryAt:void 0,waitReason:void 0}:e))},[a]),(0,Z.useEffect)(()=>{let e=window.setInterval(()=>{se()},Cg);return()=>window.clearInterval(e)},[]);let ye=t.filter(e=>e.status===`queued`).length,be=(0,Z.useRef)(ye);be.current=ye,(0,Z.useEffect)(()=>{let e=`queue`,t=()=>navigator.serviceWorker?.getRegistration?.(),n=()=>{try{t()?.then(t=>t?.getNotifications({tag:e}).then(e=>e.forEach(e=>e.close())).catch(()=>{})).catch(()=>{})}catch{}},r=()=>{let r=be.current;if(r<=0)n();else if(`Notification`in window&&Notification.permission===`granted`)try{t()?.then(t=>t?.showNotification(`Messages still queued`,{body:`${r} message${r>1?`s`:``} waiting to go out. Open ${fe.name} to send ${r>1?`them`:`it`}.`,tag:e,silent:!0})).catch(()=>{})}catch{}},i=()=>{document.visibilityState===`hidden`?r():n()};return window.addEventListener(`pagehide`,r),document.addEventListener(`visibilitychange`,i),()=>{window.removeEventListener(`pagehide`,r),document.removeEventListener(`visibilitychange`,i)}},[]),(0,Z.useEffect)(()=>{if(!(ye>0))try{navigator.serviceWorker?.getRegistration?.()?.then(e=>e?.getNotifications({tag:`queue`}).then(e=>e.forEach(e=>e.close())).catch(()=>{})).catch(()=>{})}catch{}},[ye]),(0,Z.useEffect)(()=>{let e=e=>E(Yf(e,p.current));te.current=new Set(u.filter(e).map(e=>e.id));let t=zg(u),n=Bg(j.current,t);j.current=t;{let e=o(Pa(u,p.current),M.current,Date.now());ne.current=e.busy,M.current=e.watches}let r=!1,i=N.current;for(let t of u){let n=e(t);i.get(t.id)&&!n&&(r=!0),i.set(t.id,n)}let a=new Set(u.map(e=>e.id));for(let e of i.keys())a.has(e)||i.delete(e);(r||n)&&se()},[u,i.backends]);let[xe,Se]=(0,Z.useState)(0);(0,Z.useEffect)(()=>ri(()=>Se(e=>e+1)),[]),(0,Z.useEffect)(()=>{let e=t.filter(e=>e.status===`queued`||e.status===`pending`).length;Jf(e+wr(_))},[t,xe]),(0,Z.useEffect)(()=>{let e=D.current.map(e=>e.status===`pending`?{...e,status:`queued`,retryAt:void 0,waitReason:void 0}:e),t=new Set(e.filter(qi).map(e=>e.sessionId)),n=new Set(e.filter(qi).map(e=>e.ackId)),r=e=>e.pendingCreate&&(e.createAck?!n.has(e.createAck):!t.has(e.sessionId));e=e.map(e=>r(e)?(Mn(),{...e,pendingCreate:void 0,status:`failed`,reason:`the session it was queued for is gone`,failedAt:Date.now()}):e),oe(f_(e));let i=d_();i&&G(le(i))},[]);let Ce=B,we=(...e)=>Object.fromEntries(e.map(e=>[e,Ce[e]]));return{...we(`writeOutbox`,`addOutbox`,`addOutboxFirstInLane`,`failOutbox`,`applyDeliverySettled`,`holdWall`),...we(`retainUploadBytes`,`ackWindowFor`,`nextRound`,`armAckTimeout`,`goneLanes`,`flushOutbox`,`idleReason`,`releaseLane`,`uploadRefusal`,`guardUploadRefs`,`guardChain`,`submitInput`,`queueOp`,`queueImageUpload`,`runUpload`,`rewriteQueuedPath`,`armLane`,`queueBacklog`,`answerPrompt`),...we(`enterPending`,`enterOldestPending`,`enterLater`,`retryPendingCreate`,`adoptPendingSession`,`queueSessionPrompt`,`holdForLaunch`,`failPendingCreates`,`failDependentUploads`),...we(`restoreOutbox`,`dismissOutbox`,`editQueued`,`retargetQueued`,`handToDesktop`,`toggleHoldQueued`,`toggleSerialQueued`,`scheduleQueueRows`,`dropScheduleQueue`,`removeQueued`,`addPromptToQueuedCreate`,`moveQueued`,`sendQueuedNow`,`retryFailedQueued`,`restoreQueued`,`repoIdOfEntry`),..._e,entries:t,outboxRef:D,blocked:n,holdQueueRef:P,flushIdleReason:re,parkedSends:ve,sendSettled:T,budget:g,launches:b,laneLabel:e=>Ig(e,u),PENDING_PREFIX:Tg,isPendingId:Eg,pendingLaneId:Dg,laneFor:jg,pendingEntry:L,pendingSession:ie,uploads:{uploading:R.uploading,parking:R.parking,upProg:R.upProg,current:()=>R.uploadBufRef.current,ensureUploadBuf:Ce.ensureUploadBuf,queueUpload:Ce.queueUpload,settleUploads:Ce.settleUploads,cancelUploads:Ce.cancelUploads,parkingRef:R.parkingRef,uploadBufRef:R.uploadBufRef,allBufsRef:R.allBufsRef,uploadPending:R.uploadPending,uploadRowLinger:R.uploadRowLinger}}}function m_(e,t,n){if(n?.v===1)return!1;let r=t?.model;if(!r)return!1;let i=fu(e,t?.backend)?.models.where;return i?i[r]===`hosted`:!1}function h_(){let e=St(U.hostedAck,null);return e&&typeof e.v==`number`?e:null}function g_(e=Date.now()){let t={at:e,v:1};return dt(U.hostedAck,t),t}function __(){Ct(U.hostedAck)}var Q=Ap();function v_({primary:e,targets:t,onOpen:n,onClose:r}){let[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(``),u=tc(e.id,()=>el.gitBranches(e.id)),d=u.data;function f(n){if(e.branch===n)return e.worktreePath;let r=t.find(t=>t.repoName===e.repoName&&t.branch===n);return r?r.worktreePath:null}async function p(t){s(null);let r=f(t);if(r){n(r,`${e.repoName} · ${t}`);return}a(t);let i=await el.newWorktree(e.id,t);a(null),i.path?n(i.path,`${e.repoName} · ${i.branch??t}`):s(i.error||`could not create worktree`)}return(0,Q.jsxs)(`div`,{className:`sheet`,children:[(0,Q.jsx)(pa,{title:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(th,{size:16}),` `,e.repoName,` · branch`]}),onClose:r}),(0,Q.jsxs)(`div`,{className:`form`,children:[(0,Q.jsx)(`input`,{className:`search`,placeholder:`Filter, or type a new branch name…`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c.trim()&&p(c.trim())}}),c.trim()&&!d?.some(e=>e.name===c.trim())&&(0,Q.jsxs)(`button`,{className:`send`,disabled:!!i,onClick:()=>p(c.trim()),children:[(0,Q.jsx)(pm,{size:16}),` Create & open “`,c.trim(),`”`]})]}),o&&(0,Q.jsx)(`div`,{className:`err`,children:o}),(0,Q.jsxs)(`div`,{className:`list`,children:[(0,Q.jsx)(ar,{res:u,empty:!d?.length,thing:`branches`,noun:`branch list`,children:`No local branches.`}),d?.filter(e=>e.name.toLowerCase().includes(c.trim().toLowerCase())).map(e=>{let t=!!f(e.name);return(0,Q.jsxs)(Yr,{as:`button`,disabled:i===e.name,onClick:()=>p(e.name),children:[(0,Q.jsx)(`span`,{className:`gstat ${e.current?`g-added`:``}`,children:e.current?`●`:`○`}),(0,Q.jsx)(zr,{className:`mono`,children:e.name}),(0,Q.jsx)(Y,{children:i===e.name?`creating…`:e.current?`primary`:t?`worktree`:`new worktree`})]},e.name)})]})]})}function y_({cur:e,backends:t,modelInput:n,setModelInput:r,submitInput:i,relaunch:a,sessionCan:o,sessionCant:s,onClose:c}){let l=Rn(t,e.backend),u=o(e,`slash`),d=ol(t,e.backend),f=t=>{i(e.id,e.cwd,`/model ${t}`,`command`),c(),G(`/model ${t}`)},p=t=>a(e,t),m=e=>u?f(e):p({model:e}),h=Hf(t,e.backend,u),g=t=>{h?(i(e.id,e.cwd,`/effort ${t}`,`command`),c(),G(`/effort ${t}`)):p({effort:t})};return(0,Q.jsxs)(`div`,{className:`sheet`,children:[(0,Q.jsx)(pa,{title:`Switch model`,onClose:c}),(0,Q.jsxs)(Wo,{children:[`Current: `,Vt(e.model)||`default`,e.effort?` · ${e.effort}`:``,`.`,` `,u?(0,Q.jsxs)(Q.Fragment,{children:[`Picking a model sends `,(0,Q.jsx)(`span`,{className:`mono`,children:`/model`}),` to this session.`]}):`Picking a model is a launch flag here — it kills and relaunches this session.`]}),(0,Q.jsxs)(`div`,{className:`list`,children:[l.aliases.length>0&&(0,Q.jsx)(`div`,{className:`section`,children:`Aliases`}),l.aliases.map(t=>(0,Q.jsxs)(Yr,{as:`button`,onClick:()=>m(t),children:[(0,Q.jsx)(zr,{className:`mono`,children:t}),e.model===t&&(0,Q.jsx)(ns,{tone:`ok`,children:`current`})]},t)),l.ids.length>0&&(0,Q.jsx)(`div`,{className:`section`,children:`Versions`}),l.ids.map(t=>(0,Q.jsxs)(Yr,{as:`button`,onClick:()=>m(t),children:[(0,Q.jsx)(zr,{className:`mono`,children:t}),e.model===t&&(0,Q.jsx)(ns,{tone:`ok`,children:`current`})]},t)),(0,Q.jsx)(`div`,{className:`section`,children:`Custom`}),l.freeText&&(0,Q.jsx)(Wo,{children:Os(t,e.backend)}),(0,Q.jsxs)(`div`,{className:`form`,children:[(0,Q.jsx)(`input`,{className:`search mono`,placeholder:l.ids[0]?`e.g. ${l.ids[0]}`:`model id`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&n.trim()&&(m(n.trim()),r(``))}}),(0,Q.jsx)(`button`,{className:`send`,onClick:()=>{n.trim()?(m(n.trim()),r(``)):G(`type a model id first`)},children:u?`Send /model`:`Relaunch on it`})]}),u?(0,Q.jsx)(Yr,{as:`button`,onClick:()=>{i(e.id,e.cwd,`/model`,`command`),c()},children:(0,Q.jsx)(zr,{children:`Open the model picker…`})}):(0,Q.jsx)(so,{cants:[{label:`the CLI’s own model picker`,reason:s(e,`slash`)}]})]}),d.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Wo,{children:h?(0,Q.jsxs)(Q.Fragment,{children:[`Picking an effort sends `,(0,Q.jsx)(`span`,{className:`mono`,children:`/effort`}),` to this session.`]}):`Effort is a launch flag here — picking it kills + relaunches this session.`}),(0,Q.jsx)(`div`,{className:`form`,children:(0,Q.jsx)(`div`,{className:`annot-tools`,children:d.map(t=>(0,Q.jsx)(J,{className:e.effort===t?`active`:``,onClick:()=>g(t),children:t},t))})})]}):(0,Q.jsx)(so,{cants:[{label:`effort`,reason:s(e,`effort`)??`this session has no effort setting`}]})]})}function b_(e){let{backends:t,launch:n,setOverlay:r}=e;return{branches:()=>e.branchPick?(0,Q.jsx)(v_,{primary:e.branchPick,targets:e.repos,onClose:()=>{r(null),e.setBranchPick(null)},onOpen:(t,n)=>{r(null),e.setBranchPick(null),e.openCwd(t,n)}}):null,new:()=>(0,Q.jsx)(Xs,{root:e.root,repos:e.repos,onClose:()=>r(null),onChanged:e.refreshRepos,onOpen:e.openCwd,backends:Xn(t)?[...Vs(t)]:void 0,backend:n.backend,onBackend:e.pickBackend,onBuildApp:lu}),launchask:()=>{if(!e.launchAskFor)return null;let i=e.launchAskFor;return(0,Q.jsx)(xc,{title:i.title,backends:t,defaults:n,budget:i.budget,onRecheck:e.recheckBackends,onStart:(t,n)=>{e.setLaunchAskFor(null),r(null),i.run(t,n)},onClose:()=>{e.setLaunchAskFor(null),r(null),i.onCancel?.()}})},hostedack:()=>{if(!e.hostedAskFor)return null;let n=e.hostedAskFor;return(0,Q.jsx)(hf,{title:n.title,backends:t,launch:n.launch,onAccept:()=>{g_(),e.setHostedAskFor(null),r(null),n.run(n.launch,n.budget)},onClose:()=>{e.setHostedAskFor(null),r(null),n.onCancel?.()}})},model:()=>e.active?(0,Q.jsx)(y_,{cur:e.active,backends:t,modelInput:e.modelInput,setModelInput:e.setModelInput,submitInput:e.submitInput,relaunch:e.relaunch,sessionCan:e.sessionCan,sessionCant:e.sessionCant,onClose:()=>r(null)}):null}}var x_=`This desktop can’t open a shell — it needs an update.`,S_=1200;function C_(e){let{backends:t,setOverlay:n,geomRef:r,setRepos:i,setReposAt:a,setReposFailAt:o}=e,s=no(`launchAsk`),{queueOp:c,enterPending:l,queueSessionPrompt:u}=e.queue,d=e.repoForCwd,[f,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(yi),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(``),C=(0,Z.useRef)(t);C.current=t;function w(){el.repos().then(e=>{i(e),Ta(e),a(Date.now()),Pt(`repos`)}).catch(()=>{o(Date.now())})}function T(e){v(t=>{let n={...t,...e};return Object.keys(n).forEach(e=>{n[e]||delete n[e]}),dt(U.launch,n),n})}let E=e=>ep(e,C.current);function D(e){let{launch:t,...n}=e,i=t?mn(t,C.current):null;return i&&G(i),{t:`session.create`,...n,cols:r.current.cols,rows:r.current.rows,...t?{launch:E(t)}:null}}function O(e,t,r){let i=Jc(C.current,t.launch?.backend);return i&&!ra(s.current,!!t.resume,!!t.override)?(G(`Not started — ${i}`),t.onCancel?.(),!0):ra(s.current,!!t.resume,!!t.override)?(m({title:e,run:(n,i)=>{k(e,n,r,t.onCancel,i)||r(n,i)},onCancel:t.onCancel,budget:t.budget}),n(`launchask`),!0):!t.resume&&k(e,t.launch,r,t.onCancel,void 0)}function k(e,t,r,i,a){return!t||!m_(C.current,t,h_())?!1:(W(`overlay:hostedack`),g({title:e,launch:t,run:r,onCancel:i,budget:a}),n(`hostedack`),!0)}let ee=(e,n)=>Af(t,e?fc(e):void 0,n),A=(e,n)=>cd(t,e?fc(e):void 0,n),te=e=>{if(e.unadopted)return(0,Z.createElement)(gr,null,e.unadopted);if($s(t,e.launch?.backend)||Hi(e))return null;let n=cd(t,e.launch?.backend,`resumePick`);return n?(0,Z.createElement)(gr,null,n):null},j=e=>T({backend:e,model:void 0,effort:void 0});function ne(t){let n=e.openingCwds().get(t.worktreePath);n&&G(n.status===`pending`?`${n.n>1?`${n.n} already opening`:`one already opening`} in ${t.repoName} — this is another`:`${n.n>1?`${n.n} already queued`:`one already queued`} in ${t.repoName} — this is another`),!O(p(t),{launch:_},(e,n)=>M(t,e,n??void 0))&&M(t,_)}function M(e,t,n){let r=Mr();c(D({cwd:e.worktreePath,title:p(e),launch:t,...n?{budget:n}:{}}),`create:${e.worktreePath}`,`open ${p(e)}`,{cwd:e.worktreePath,focus:!0,ackId:r})&&W(`action:repo.new.offline`),l(r)}function N(e){let t=xi(C.current);return t?(W(`action:shell.new`),I(e.worktreePath,`shell · ${p(e)}`,!1,void 0,{backend:t.id})):(G(x_),null)}function P(e){let t=xi(C.current);return t?(W(`action:shell.companion`),I(e.cwd,`shell · ${e.title}`,!1,void 0,{backend:t.id},void 0,void 0,e.id)):(G(x_),null)}function re(){return xi(C.current)?null:x_}function F(t,n={}){let r=xi(C.current);if(!r)return G(x_),null;let i=bl(),a=n.cwd||e.root,o=Gg({remembered:Xg.get()[t]??null,sessions:i.world.sessions,cwd:a,isShell:e=>$s(C.current,e),pendingAlive:e=>i.queue.entries.some(t=>t.ackId===e&&t.status!==`failed`)}),s=null;if(o.do===`attach`){let e=i.world.sessions.find(e=>e.id===o.id);W(`action:shell.focus`),i.nav.attach(e),s=e.id}else o.do===`enter`?(l(o.ack),s=Dg(o.ack)):(W(`action:shell.new`),s=I(a,n.title||`shell · ${Td(a)}`,!1,void 0,{backend:r.id}));return s?(Qg(t,s,n.back),s):null}function I(e,t,n=!1,r,i,a,o,s){if(n&&$s(C.current,i?.backend)&&(n=!1,r=void 0,a=void 0),O(t,{resume:n,override:!!i,launch:i??_},(i,c)=>{I(e,t,n,r,i,a,c===void 0?o:c??void 0,s)}))return null;W(n?`action:session.resume`:`action:session.new`);let u=Mr();return c(D({cwd:e,title:t,resume:n,resumeMode:r,resumeSessionId:a,launch:i??_,...o?{budget:o}:{},...s?{companionOf:s}:{}}),`create:${e}`,`${n?`resume`:`open`} ${t}`,{cwd:e,focus:!0,ackId:u}),l(u),Dg(u)}async function L(e){let t=d(e)?.id;if(!t)return null;try{let e=await Promise.race([el.gitStatus(t),new Promise(e=>setTimeout(()=>e(null),S_))]),n=e?.files.length??0;return!e||e.clean||n===0?null:`The worktree has ${n} uncommitted change${n===1?``:`s`} — those edits stay exactly as they are, but the reopened session won't remember making them.`}catch{return null}}async function ie(e,t){let n=t.sourceId||Hi(e);if(!n){G(`This session's conversation is not identified yet, so it cannot be cut here.`);return}let r={...t,sourceId:n};if(r.mode===`reset`){let t=await L(e.cwd),n=[`This session reopens holding the conversation up to just before turn #${r.n}. #${r.n} and everything after it are left behind.`,...e.turnActive?[`A turn is running right now — it will be interrupted.`]:[],`Nothing is deleted: the later turns stay on disk under this conversation and stay listed in the archive. Deleting one is a separate act.`,`No file in the repo is touched — only the conversation is rewound.`,...t?[t]:[]];if(!await So({title:`Reset to before #${r.n}?`,lines:n,confirmLabel:`Reset`}))return}let i=r.mode===`fork`?`${e.title} (before #${r.n})`:e.title,a={model:e.model,effort:e.effort,permissionMode:e.permissionMode,remoteControlled:e.remoteControlled,backend:e.backend},o=c(D({cwd:e.cwd,title:i,launch:a,resumeMode:`fork`,resumeSessionId:r.sourceId,forkAtTurn:r.turnId,...r.mode===`reset`?{replaceSessionId:e.id}:null}),`create:${e.cwd}`,r.mode===`fork`?`fork ${e.title} before #${r.n}`:`reset ${e.title} to before #${r.n}`,{cwd:e.cwd,focus:!0});G(o?`queued — the link dropped; it runs when it is back`:r.mode===`fork`?`forking before #${r.n} — a new session opens here`:`resetting to before #${r.n}…`)}function R(r,i,a){let o={model:r.model,effort:r.effort,permissionMode:r.permissionMode,remoteControlled:r.remoteControlled,backend:r.backend},s=E({...o,...i}),l=Hi(r),u=a?.prompt?.trim()||void 0,d=u?w_(u):[];c(D({cwd:r.cwd,title:r.title,launch:s,replaceSessionId:r.id,...u?{prompt:u}:{},...d.length?{needs:d}:{},...l?{resumeMode:`continue`,resumeSessionId:l}:{}}),`create:${r.cwd}`,`relaunch ${r.title} · ${Ja(s,vf(t,s.backend),t)}`,{cwd:r.cwd,focus:!a?.quiet||e.active?.id===r.id,frontOfLane:d.length>0}),!a?.quiet&&(n(null),G(`relaunch · ${Ja(s,vf(t,s.backend),t)}`))}function ae(e,t,n,r,i,a,o,s){if(O(t,{override:!!i,launch:i??_,onCancel:o,budget:s},(i,c)=>ae(e,t,n,r,i,a,o,c===void 0?s:c??void 0)))return;let d=i??_;W(`action:session.newprompt`);let f=n.map(e=>e.trim()).filter(Boolean),[p,...m]=f,h=w_(p??``),g=Mr(),v=c(D({cwd:e,title:t,prompt:p,launch:d,needs:h.length?h:void 0,...s?{budget:s}:{},...a?{resume:!0,resumeMode:`continue`}:{}}),`create:${e}`,p??`open ${t}`,{cwd:e,focus:!0,frontOfLane:h.length>0,ackId:g,serial:r});for(let t of m)u(e,t,g);l(g);let y=m.length>0;G(v?y?`queued — the session opens and runs ${f.length} prompts when the link is back`:`queued — the session opens and runs this when the link is back`:y?`starting… ${m.length} more queued behind it`:`starting…`)}return{launch:_,setLaunch:v,setLaunchOpt:T,pickBackend:j,wireLaunch:E,sessionCan:ee,sessionCant:A,reopenCant:te,refreshRepos:w,openRepo:ne,openShell:N,openCompanionShell:P,focusShell:F,shellCant:re,openCwd:I,runForkRequest:ie,startSessionWithPrompt:ae,relaunch:R,setBranchPick:b,sheets:b_({backends:t,launch:_,root:e.root,repos:e.repos,active:e.active,launchAskFor:f,setLaunchAskFor:m,hostedAskFor:h,setHostedAskFor:g,branchPick:y,setBranchPick:b,modelInput:x,setModelInput:S,setOverlay:n,submitInput:e.queue.submitInput,refreshRepos:w,openCwd:I,pickBackend:j,relaunch:R,sessionCan:ee,sessionCant:A,recheckBackends:()=>{bl().conn.send({t:`backends.recheck`})}})}}function w_(e){let t=new Set;for(let n of e.matchAll(/\.claude\/inbox\/[A-Za-z0-9._-]+/g))t.add(n[0]);return[...t]}var T_=e=>e.preventDefault();function E_(e){let{q:t,status:n,reconnectAsk:r,setReconnectAsk:i,autoSend:a,confirmQueue:o,pullRecords:s,setOverlay:c,stripSessionId:l}=e,{entries:u,parkedSends:d,sendSettled:f,holdQueueRef:p,flushIdleReason:m,flushOutbox:h,idleReason:g,restoreOutbox:_,dismissOutbox:v,laneLabel:y}=t,b=Date.now(),x=u.filter(e=>Bi(e,b)===`confirming`),S=u.filter(e=>Ka(Bi(e,b))),C=e=>Bi(e,b)===`retrying`,w=u.filter(e=>e.status===`queued`&&!C(e)),T=l&&n===`open`&&!p.current&&w.length>0&&w.every(e=>e.sessionId===l)?[]:w,E=u.filter(e=>e.status===`pending`||C(e)),D=E.length>0,O=r&&d.length>0,k=(0,Q.jsx)(Kr,{records:s,onRemove:e=>{W(`action:pull.strip.remove`);for(let t of e)Lt.remove(t.item.id);let t=e.filter(e=>!e.local).map(e=>({t:`pull.dismiss`,id:e.item.id})),n=`removed ${e.length===1?e[0].item.name:`${e.length} stopped downloads`}`;t.length?bl().conn.liveSendAll(t,n,`${n} here — the desktop's queue still lists ${t.length===1?`it`:`them`} until the link is back`):G(n)},onOpen:()=>{W(`overlay:pull`),c(`pull`)}}),ee=Pl(s,Cr()).length>0;return!O&&!S.length&&!x.length&&!T.length&&!D&&!ee&&!f?null:(0,Q.jsxs)(Q.Fragment,{children:[k,(0,Q.jsx)(hd,{records:s}),r&&d.length>0&&(0,Q.jsxs)(`div`,{className:`outbox-recover ask`,children:[(0,Q.jsx)(Qh,{size:14}),(0,Q.jsxs)(`span`,{children:[`Back online — send `,d.length,` message`,d.length>1?`s`:``,` you queued while offline?`]}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:()=>{W(`action:queue.confirm.send`);let e=h(!0);i(!1),G(e?`sending queued messages…`:g(`nothing left to send`))},children:[(0,Q.jsx)(Rh,{size:14}),` Send`]}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:()=>{W(`action:queue.confirm.review`),c(`queue`)},children:[(0,Q.jsx)(Xh,{size:14}),` Review`]}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:()=>{W(`action:queue.confirm.hold`),i(!1)},title:`keep them queued — nothing is sent until you release it`,children:[(0,Q.jsx)(X,{size:14}),` Hold`]})]}),S.length===0&&x.length===0&&w.length===0&&!D&&f&&(0,Q.jsxs)(`div`,{className:`outbox-recover sending`,children:[(0,Q.jsx)(wm,{size:14}),(0,Q.jsx)(`span`,{children:`sent`})]}),(S.length>0||x.length>0||T.length>0||D)&&(0,Q.jsx)(`div`,{className:`outbox-recover ${S.length?`failed`:x.length?`confirming`:T.length?`queued`:`sending`}`,children:S.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gm,{size:14}),(0,Q.jsxs)(`span`,{children:[S.length,` message`,S.length>1?`s`:``,` not delivered`,S.length===1&&S[0].reason?` — ${S[0].reason}`:``]}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:_,children:[(0,Q.jsx)(Th,{size:14}),` Restore`]}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:()=>{W(`action:queue.manage`),Ql(S,`the messages that were not delivered`)},children:[(0,Q.jsx)(Xh,{size:14}),` Manage`]}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:v,children:[(0,Q.jsx)(X,{size:14}),` Dismiss`]}),S.length>1?(0,Q.jsxs)(`div`,{className:`outbox-which`,children:[S.slice(0,3).map(e=>(0,Q.jsxs)(`button`,{className:`outbox-which-row`,onPointerDown:T_,title:`open this one in ${fd.activity}`,onClick:()=>{W(`action:queue.which`),Ql([e],`the message you tapped`)},children:[(0,Q.jsx)(`span`,{className:`outbox-which-where`,children:y(e)}),(0,Q.jsx)(`span`,{className:`outbox-which-text`,children:Rg(e)})]},e.ackId)),S.length>3?(0,Q.jsxs)(`button`,{className:`outbox-which-row more`,onPointerDown:T_,onClick:()=>{W(`action:queue.which.more`),Ql(S,`the messages that were not delivered`)},children:[S.length-3,` more — open the list`]}):null]}):null]}):x.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rg,{size:14}),(0,Q.jsx)(`span`,{children:Jl(x.length)}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:()=>{W(`action:queue.confirming`),Ql(x,`the messages the desktop is still confirming`)},children:[(0,Q.jsx)(Xh,{size:14}),` Which`]})]}):T.length>0?(0,Q.jsxs)(Q.Fragment,{children:[n===`open`?p.current?(0,Q.jsx)(Xp,{size:14}):(0,Q.jsx)(rg,{size:14}):(0,Q.jsx)(Bm,{size:14}),(0,Q.jsxs)(`span`,{children:[T.length,` queued`,p.current?` — held until you send them`:n===`open`?D?` — going out one per session`:m.current?` — ${m.current}`:` — going out one per session`:` — will send when the connection is back`]}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:()=>{W(`action:outbox.retry`),h(!0)||G(g(`nothing left to send`))},children:[(0,Q.jsx)(Th,{size:14}),` Send now`]}),(n!==`open`||p.current||!(a&&!o))&&(0,Q.jsxs)(J,{className:a&&!o?`active`:``,onPointerDown:T_,title:a&&!o?`queued messages go out by themselves as soon as the connection is back — tap to hold them instead`:`send everything queued the moment the connection is back, without asking`,onClick:()=>{let e=!(a&&!o);W(`action:outbox.auto`),K(`autoSend`,e),K(`confirmQueue`,!e),e&&(p.current=!1,i(!1),h()),G(e?`auto-send on — the queue goes out as soon as the link is back`:`auto-send off — the queue waits for “Send now”`)},children:[(0,Q.jsx)(Fh,{size:14}),` auto `,a&&!o?`on`:`off`]}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:()=>{W(`action:queue.manage`),Ql(T,`the messages still waiting to go out`)},children:[(0,Q.jsx)(Xh,{size:14}),` Manage`]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Jh,{size:14,className:`spin`}),(0,Q.jsx)(`span`,{children:Lg(E)}),(0,Q.jsxs)(J,{onPointerDown:T_,onClick:()=>{W(`action:queue.manage`),Ql(E,`the messages going out now`)},children:[(0,Q.jsx)(Xh,{size:14}),` Manage`]})]})})]})}function D_(e,t){if(!e||e.kind===`after`)return null;if(e.kind===`at`){if(e.rule.kind===`once`&&!(typeof e.rule.at==`number`&&e.rule.at>t))return null;let{name:n,...r}=e;return r}return e}function O_(e){return e===`now`||e===`idle`?e:null}function k_(e){return e===`this`||e===`new`?e:null}function A_(e,t,n,r,i=40){if(!t)return e;let a={...e[t],at:r};if(n.mode!==void 0){let e=O_(n.mode);e?a.mode=e:delete a.mode}if(n.when!==void 0){let e=D_(n.when,r);e?a.when=e:delete a.when}if(n.where!==void 0){let e=k_(n.where);e?a.where=e:delete a.where}let o={...e,[t]:a},s=Object.keys(o);if(s.length<=i)return o;s.sort((e,t)=>(o[e].at??0)-(o[t].at??0));for(let e of s.slice(0,s.length-i))delete o[e];return o}function j_(e,t){return t?O_(e[t]?.mode)??`now`:`now`}function M_(e,t){return t?k_(e[t]?.where)??`this`:`this`}function N_(e,t,n){return t?D_(e[t]?.when,n):null}function P_(e){return`When is set the way you last sent to ${e} — open When to change it`}function F_(e){let{connRef:t,liveSend:n,liveSendAll:r,queue:a,sessions:o,getVisibleRepos:s,intents:c,usage:l,launch:u,wireLaunch:d,geomRef:f,repoForCwd:m,startSessionWithPrompt:g,setOverlay:_,attach:v}=e,{pendingSession:y,budget:b}=a,{guardChain:x,guardUploadRefs:S,queueOp:C,submitInput:w,queueBacklog:T,writeOutbox:E,outboxRef:D,addOutbox:O,flushOutbox:k,queueImageUpload:ee}=a,A=a.entries,te=bs(),[j,ne]=(0,Z.useState)(null),M=(0,Z.useRef)(null);M.current=j;let N=(0,Z.useRef)(null),P=(0,Z.useRef)(St(U.sendMemory,{}));function re(e,t){let n=A_(P.current,e,t,Date.now());n!==P.current&&(P.current=n,dt(U.sendMemory,n))}function F(e,t){let n=t.kind===`at`?{kind:`at`,rule:t.rule,graceMin:t.graceMin}:t.kind===`after`?{kind:`after`,id:t.id,onlyIfOk:t.onlyIfOk,title:t.title}:{kind:t.kind},i=t.kind===`at`?Xe(t.rule):t.kind===`now`?Jt:se(t,Wr(t,l??void 0)),a=[...new Set(e.flatMap(e=>{let t=c.find(t=>t.id===e)?.cwd,n=t?m(t):null,r=n?V(n):t?Td(t):``;return r?[r]:[]}))],o=b?.verdict.blocked&&mo(e,c).length>0?b.verdict.resumeAt?h(b.verdict.resumeAt):`it clears`:null,s=t.kind===`at`?sp(e.length,i):Tf(e.length,i,a,o),u=t.kind===`at`?c.find(t=>t.id===e[0])?.cwd:void 0;return u&&yc(e[0],u),r(e.map(e=>({t:`intent.update`,id:e,patch:{trigger:n,...t.kind===`at`?{holdForHost:!!t.waitUntilFree}:{}}})),s,Js)}let I=(e,n)=>{let i=c.find(t=>t.id===e[0]),a=i?.trigger.kind===`at`?{kind:`at`,rule:i.trigger.rule,graceMin:i.trigger.graceMin,...i.holdForHost?{waitUntilFree:!0}:{}}:sa(36e5),u=!1;return(0,Q.jsx)(Hd,{seed:{retime:{ids:e},when:a,draftKey:`send.retime`},sessions:o,repos:s(),outbox:A,online:t.current.status===`open`,usage:l,intents:c,buildName:te,onAttach:async()=>[],onAnnotate:()=>{},onSend:t=>(u=F(e,t.when),u),onClose:()=>u?n.onSent():n.onCancel(),budgetHeld:b?.verdict.blocked?{note:Ge(b.verdict),resumeAt:b.verdict.resumeAt,ids:mo(e,c)}:null,onPastBudget:e=>{r(e.map(e=>({t:`intent.waive`,id:e,rung:`budget`,on:!0})),Eo(e.length),`no connection — the backlog lives on the desktop, so nothing here changed. Adding still queues.`)&&n.onSent()}})};function L(e,t){let n=e?o.find(t=>t.id===e&&t.running):void 0;return n?{kind:`session`,sessionId:n.id,cwd:n.cwd}:t?{kind:`repo`,cwd:t}:void 0}function ie(e){let t=e.target.kind===`repos`,n=e.payload.kind===`prompt`?e.payload.steps:[],r=n[0]??``;return{prompts:n.length?[...n]:[r],target:t&&e.target.kind===`repos`?{kind:`repos`,dirs:e.target.dirs,...e.budget?{budget:e.budget}:{},...e.launch?{launch:e.launch}:{},...e.flagWhenDone?{flagWhenDone:!0}:{}}:{kind:`repo`,cwd:e.cwd,...typeof e.closeWhenDone==`boolean`?{closeWhenDone:e.closeWhenDone}:{},...e.flagWhenDone?{flagWhenDone:!0}:{},...e.budget?{budget:e.budget}:{},...e.launch?{launch:e.launch}:{}},when:e.trigger.kind===`at`?{kind:`at`,rule:e.trigger.rule,graceMin:e.trigger.graceMin??120,name:e.label||be(e.title,r)||void 0,waitUntilFree:e.serial===!0&&e.holdForHost===!0||void 0}:void 0,cwdHint:e.cwd||null,scheduleId:e.id,origin:`Editing a schedule`}}function R(e){let t=e.action;return{prompts:t.kind===`backlog`&&t.steps?.length?[...t.steps]:[ot(t)],target:t.kind===`fanout`?{kind:`repos`,dirs:t.dirs,...t.budget?{budget:t.budget}:{},...t.launch?{launch:t.launch}:{}}:{kind:`repo`,cwd:t.repoDir,...t.kind===`backlog`&&typeof t.closeWhenDone==`boolean`?{closeWhenDone:t.closeWhenDone}:{},...t.kind===`backlog`&&t.flagWhenDone?{flagWhenDone:!0}:{},...t.kind===`backlog`&&t.budget?{budget:t.budget}:{},...t.kind===`backlog`&&t.launch?{launch:t.launch}:{}},when:{kind:`at`,rule:e.rule,graceMin:e.graceMin??120,name:be(e.name,ot(t))||void 0,waitUntilFree:e.waitUntilFree},cwdHint:t.kind===`fanout`?t.dirs[0]??null:t.repoDir,scheduleId:e.id,origin:`Editing a schedule`}}function ae(e){let t=(y?[...o,y]:o).find(t=>t.id===e);t&&v(t)}function z(e){let t=fo(Tt,(e.prompts?.length?e.prompts:[``]).join(`\f`),e.cwdHint);t===`kept`?G(i):t===`refused`&&G(B),N.current=null,ne(Pc(e,t)),_(`send`)}function oe(e,r){let i=e.prompts.map(e=>e.trim()).filter(Boolean),a=i[0]??``,o=a.slice(0,40),s=e=>e.trimStart().startsWith(`/`)?`command`:`prompt`;if(e.target.kind!==`shell`&&!x(i))return!1;let _=r.scheduleId?c.find(e=>e.id===r.scheduleId)??null:null,v=Ro(e,_);if(v.kind===`refuse`)return G(v.why),!1;if(v.kind===`patch`&&_){let t=e.target.kind===`repo`||e.target.kind===`repos`?e.target.budget:void 0;if(JSON.stringify(t??null)!==JSON.stringify(_.budget??null))return G(`a budget can't be changed on a row that is already waiting — remove the budget change, or post this as a new row`),!1;let r={payload:{kind:`prompt`,steps:i},trigger:e.when.kind===`after`?{kind:`after`,id:e.when.id,onlyIfOk:e.when.onlyIfOk,title:e.when.title}:e.when.kind===`at`?{kind:`at`,rule:e.when.rule,graceMin:e.when.graceMin}:{kind:e.when.kind===`idle`?`idle`:`now`},target:e.target.kind===`session`?{kind:`session`,sessionId:e.target.sessionId}:{kind:`repo`},cwd:e.target.kind===`session`||e.target.kind===`repo`?e.target.cwd:void 0,resume:e.target.kind===`repo`?!!e.target.resume:void 0,closeWhenDone:e.target.kind===`repo`?e.target.closeWhenDone??null:void 0,flagWhenDone:e.target.kind===`repo`?cs(e.target,e.when)??null:void 0,launch:e.target.kind===`repo`?e.target.launch?d(e.target.launch):null:void 0,holdForHost:e.when.kind===`at`?!!e.when.waitUntilFree:void 0,label:o};return W(`action:send.retime`),n({t:`intent.update`,id:_.id,patch:r},Xo(e.when),`no connection — this row's clock lives on the desktop and nothing here changed. Its words are still in the box.`)?(e.when.kind===`at`&&_.cwd&&yc(_.id,_.cwd),!0):!1}if(e.when.kind===`at`&&e.target.kind===`session`){let t=e.when,n=e.target,s={id:r.scheduleId??`i_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,6)}`,cwd:n.cwd,payload:{kind:`prompt`,steps:i},target:{kind:`session`,sessionId:n.sessionId},trigger:{kind:`at`,rule:t.rule,graceMin:t.graceMin},holdForHost:t.waitUntilFree||void 0,auto:!0,pinned:!0,label:o};if(W(`action:send.clockSession`),!S(i.join(`
|
|
@@ -43,8 +43,8 @@ Apply with \`--no-dry-run\` only after I agree. The size metric lags about 24h a
|
|
|
43
43
|
|
|
44
44
|
{marker}`},{id:`screenshots`,title:`Screenshots of your app`,pitch:`Let an agent (and you, from the phone) capture this app's screens on the desktop and check them, instead of describing what it probably looks like.`,cost:`Setting up a capture target spends nothing. Each screenshot an agent looks at costs tokens on every later turn, and the checklist then offers the skill that keeps that cheap.`,verb:`open captures`,action:{kind:`open`,to:`capture`}},{id:`exposure-watch`,title:`Exposure watch`,pitch:`Once a day this desktop looks up what the outside world now says about this repo: published advisories on its dependencies, deprecations and, for a private repo, a local Scorecard run. Findings land under watch.`,cost:`Spends no tokens and makes no AI call: a daily job runs gh and npm audit-type lookups and, for a private repo, Scorecard locally. A tap only adds this repo to the list it reads.`,verb:`watch this repo`,action:{kind:`fix`,fix:`exposure-watch`}},{id:`local-ci-status`,title:`Report local checks to GitHub`,pitch:`This repo's rules require a local-ci status before a pull request can merge. After a push from this phone's push button, the desktop tells GitHub the checks passed. It is the honor system: the status says the pre-push hook did not fail the push, not that anyone verified the tests. It covers pushes from this phone's push button, not pushes an agent or a terminal makes.`,cost:`One GitHub API call after each push from the phone; no tokens.`,verb:`report it`,action:{kind:`fix`,fix:`local-ci-status`}}].map(e=>[e.id,e]));function Ip(e){return Fp.get(e)}function Lp(e,t){let n=Fp.get(e);return n?.prompt?n.prompt.replaceAll(`{repo}`,t).replaceAll(`{marker}`,Pp(e)).replaceAll(`{shared}`,k.sharedDirName).replaceAll(`{skill}`,k.skillName):null}function Rp(e,t){let n=Fp.get(e)?.action;return n?.kind===`schedule`?{kind:`weekly`,days:[...n.days],hour:n.hour,minute:n.minute,tz:t}:null}function zp(e){let t={offered:[],started:[],active:[],declined:[],unfit:[]};for(let n of e)Fp.has(n.id)&&(n.choice===`declined`?t.declined.push(n):n.state===`on`||n.choice===`done`?t.active.push(n):n.relevant?n.sent||n.partial?t.started.push(n):t.offered.push(n):t.unfit.push(n));return t}function Bp(e){return e.state===`on`?`on`:`marked done by you`}function Vp(e,t){let n=e.map(e=>Fp.get(e.id)).filter(e=>!!e);if(n.length===0)return null;let r=n.filter(e=>e.action.kind===`agent`||e.action.kind===`schedule`),i=n.filter(e=>e.action.kind===`fix`||e.action.kind===`open`),a=[`Walk me through the optional features ${k.displayName} offers for ${t}. Do NOT set any of them up in this session.`,``,`1. For each one below, look at the repo briefly and tell me in one or two lines whether it fits here and what it would take. Then ask me which ones I want, in ONE question.`,`2. For each one I pick, post its prompt (quoted below, unchanged) as its own new-session work item in this repo, using the ${k.skillName} skill's way of posting work for later. A schedule one is posted as a weekly schedule with the model named. Do not run them here.`,`3. Finish with a list of what you posted, and nothing else.`,``];for(let e of r){let n=e.action.kind===`schedule`?` — weekly, ${Up(e.action.days)} ${Wp(e.action.hour)}:${Wp(e.action.minute)}, model ${e.action.model}`:``;a.push(`## ${e.title}${n}`,e.pitch,e.cost,``,`Prompt:`,"```",Lp(e.id,t)??``,"```",``)}if(i.length){a.push(`These are a tap on the phone's Opt-ins screen, not something to post. Just say whether they fit:`);for(let e of i)a.push(`- ${e.title}: ${e.pitch}`)}return a.join(`
|
|
45
45
|
`).trimEnd()}var Hp=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Up(e){return e.length===0?`every day`:e.map(e=>Hp[e]??`?`).join(`, `)}function Wp(e){return String(e).padStart(2,`0`)}function Gp(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.id!=`string`||typeof t.relevant!=`boolean`||t.state!==`on`&&t.state!==`off`&&t.state!==`unknown`)return null;let n={id:t.id,relevant:t.relevant,state:t.state,detail:typeof t.detail==`string`?t.detail:``};(t.choice===`declined`||t.choice===`done`)&&(n.choice=t.choice);let r=t.sent;return r&&typeof r==`object`&&typeof r.at==`number`&&Number.isFinite(r.at)&&r.at>0&&Np.includes(r.status)&&(n.sent={at:r.at,status:r.status}),t.partial===!0&&(n.partial=!0),n}var Kp=864e5;function qp(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n.getTime()}function Jp(e,t){let n=new Date(e),r=new Date(t);return Math.round((Date.UTC(r.getFullYear(),r.getMonth(),r.getDate())-Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()))/Kp)}var Yp=e=>e.state===`done`?`done`:e.state===`failed`||e.state===`canceled`?`failed`:e.state===`running`?`running`:e.state===`starting`?`starting`:`pending`,Xp=e=>e.split(`/`).filter(Boolean).pop()||e;function Zp(e,t=10){let n=new Map;for(let t of e){if(!ha(t))continue;let e=n.get(t.groupId)??[];e.push(t),n.set(t.groupId,e)}let r=[];for(let[t,i]of n){let n=e.find(e=>e.id===t),a=i.filter(e=>e.origin===ia).sort((e,t)=>(e.order??e.createdAt)-(t.order??t.createdAt));if(!a.length&&!n)continue;let o=(n?.payload.kind===`prompt`?n.payload.steps[0]:void 0)??(a[0]?.payload.kind===`prompt`?a[0].payload.steps[0]:``),s=n?.createdAt??Math.min(...a.map(e=>e.createdAt)),c=e=>e.state===`done`||e.state===`failed`||e.state===`canceled`,l=i.some(e=>!c(e)),u=new Map;for(let e of i){if(!e.origin?.startsWith(`fanout:fu:`))continue;let t=e.origin.slice(aa.length);u.set(t,[...u.get(t)??[],e])}let d=[...u.values()].map(e=>({text:e[0].payload.kind===`prompt`?e[0].payload.steps[0]:``,at:Math.min(...e.map(e=>e.createdAt)),dirs:e.map(e=>e.cwd)})).sort((e,t)=>e.at-t.at);r.push({id:t,text:o,startedAt:s,finishedAt:l?void 0:Math.max(...i.map(e=>e.settledAt??e.createdAt)),targets:a.map(e=>({dir:e.cwd,title:e.title||Xp(e.cwd),sessionId:e.sessionId,status:Yp(e),error:e.state===`failed`||e.state===`canceled`?e.result?.detail:void 0})),followUps:d.length?d:void 0})}return r.sort((e,t)=>t.startedAt-e.startedAt).slice(0,t)}var Qp=[{id:`security`,label:`Security`,ask:`Security: anything touching sign-in, permissions, secrets or keys, input handling, file or network access, what is exposed and to whom, or new attack surface. Say plainly when nothing does.`},{id:`behavior`,label:`What changes for users`,ask:`Behaviour a user would notice: new or removed features, changed defaults, screens, wording, timing, notifications. Describe it as the user experiences it, not as code.`},{id:`deploy`,label:`Deployment needed`,ask:`Deployment: does any of this need a deploy or release before it takes effect, and of WHICH component — e.g. web app only, backend / server / cloud functions, a mobile, watch or desktop app that needs a store release, infrastructure or config, a database migration. Name the components from the paths. Say when nothing needs deploying (docs, tests, tooling only).`},{id:`data`,label:`Data & migrations`,ask:`Data: changes to stored data, schemas, file formats or migrations; anything irreversible or that touches existing users' data.`},{id:`breaking`,label:`Breaking changes`,ask:`Compatibility: changed APIs, config files, environment variables, CLI flags or URLs; whether older clients, devices or saved state keep working.`},{id:`deps`,label:`Dependencies & cost`,ask:`Dependencies and cost: packages added or upgraded, new external services, new paid API calls or anything that adds a running cost.`},{id:`surprises`,label:`Surprises`,ask:`Surprises: changes the commit messages do not mention, edits unrelated to the stated goal, debug leftovers, disabled or weakened checks and tests, TODOs left behind.`},{id:`check`,label:`What to check by hand`,ask:`Risk: how risky this is (low / medium / high, one reason), and a short list of things to try by hand afterwards. Say whether tests cover the change.`}],$p=Qp.map(e=>e.id);function em(e){let t=new Set(Array.isArray(e)?e.filter(e=>typeof e==`string`):[]);return Qp.filter(e=>t.has(e.id)).map(e=>e.id)}var tm=/^[A-Za-z0-9\-._~:/?#[\]@!$&'()*+,;=%]+$/,nm=/https?:\/\//g,rm=/[.,;:!?)\]}'"]+$/,im=24;function am(e,t){let n=e.slice(t),r=n.search(/\s/);return r===-1?n:n.slice(0,r)}function om(e){let t=0;for(;t<e.length&&tm.test(e[t]);)t++;return t}function sm(e){return e.length-e.trimStart().length}function cm(e){let t=[],n=new Set,r=e.map(e=>e.trimEnd());for(let e=0;e<r.length;e++){nm.lastIndex=0;let i;for(;i=nm.exec(r[e]);){let a=i.index,o=am(r[e],a),s=om(o),c=o.slice(0,s),l=s<o.length-1&&tm.test(o[s+1]),u=!l&&a+c.length===r[e].length,d=c,f=1;if(u){let t=sm(r[e]),n=r[e].length,i=[],a=null;for(let o=e+1;o<r.length;o++){let e=r[o];if(sm(e)!==t)break;let s=e.slice(t);if(!s||/https?:\/\//.test(s))break;if(!tm.test(s)){let e=om(s);e&&!/\s/.test(s)&&t+s.length===n&&(a=s.slice(0,e));break}i.push(s)}if(n>=im){let e=0,r=!1;for(let a=0;a<i.length&&(r=t+i[a].length!==n,e=a+1,!r);a++);e&&(d+=i.slice(0,e).join(``),f=1+e),!r&&e===i.length&&a!==null&&(d+=a,f+=1,l=!0)}}l||(d=d.replace(rm,``)),d.length>i[0].length&&!n.has(d)&&(n.add(d),t.push(l?{url:d,line:e,lines:f,truncated:l}:{url:d,line:e,lines:f})),nm.lastIndex=a+o.length}}return t}function lm(e){return cm(e.split(`
|
|
46
|
-
`))}var um=new Set(`/usage./cost./stats./context./status./todos./help./release-notes./config./model./output-style./statusline./vim./terminal-setup./agents./mcp./hooks./permissions./sandbox./add-dir./resume./rewind./clear./export./memory./bashes./remote-control./ide./upgrade./bug./feedback./privacy-settings./login./logout./effort./fast./theme./color./keybindings./skills./plugin./version./diff./copy`.split(`.`));function dm(e){return um.has(e.trim().split(/\s+/)[0]??``)}var fm=new Set([`/btw`]);function pm(e){return fm.has(e.trim().split(/\s+/)[0]??``)}[k.stateDirName,...vr];function mm(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=`${e.name} ${e.cmd} ${e.dir??``} ${e.source}`.toLowerCase();return n.every(e=>t.includes(e))}):e}var hm={supported:!1,canInstall:!1,silent:!1};function gm(e){if(!e||typeof e!=`object`)return{};let t=e,n={};return(t.distribution===`dev`||t.distribution===`play`)&&(n.distribution=t.distribution),typeof t.self==`string`&&t.self&&(n.self=t.self),n}function q(e){return e.distribution===`play`}function _m(e,t){return q(t)&&!!e&&!!t.self&&e===t.self}var vm=`this build updates through Google Play — install the new version from the Play Store`,ym=`could not read which app this file is, and this build installs only an app it can name`;function bm(e){return`new builds of ${e} wait for a tap: this ${k.displayName} comes from Google Play, which does not let it install apps by themselves — every install asks`}var xm=`A build downloaded here installs with the phone's own confirm dialog, one tap each. This ${k.displayName} comes from Google Play, which does not let it install apps by themselves, and it updates itself only through Play.`;function Sm(e){let t=(e.name??``).toLowerCase(),n=(e.mime??``).toLowerCase();return t.endsWith(`.apk`)||n===`application/vnd.android.package-archive`}function Cm(e){return e.pkgLabel||e.pkg||e.name}function wm(e,t){return!!e.pkg&&t.includes(e.pkg)}function Tm(e,t){return t?e.includes(t)?e.filter(e=>e!==t):[...e,t]:[...e]}function Em(e,t){return!t.supported||!Sm(e)||e.state!==`done`?{verb:null,reason:null}:_m(e.pkg,t)?{verb:null,reason:vm}:q(t)&&!e.pkg?{verb:null,reason:ym}:e.evicted&&e.cleanedAt?{verb:null,reason:Im(e)}:e.evicted?{verb:null,reason:`the bytes were cleared to save space — fetch it again to install it`}:t.canInstall?e.install===`installing`?{verb:null,reason:null}:{verb:`install`,reason:null}:{verb:null,reason:`this phone has not allowed ${k.displayName} to install apps`,settings:!0}}function Dm(e,t,n,r){switch(e){case`installing`:return`installing…`;case`asked`:return`waiting for you to confirm it on this phone`;case`installed`:return`installed${r?` · ${n} ${r}`:``}`;case`failed`:return`could not install: ${Om(t)}`;default:return null}}function Om(e){if(!e)return`the phone did not say why`;if(/VERIFICATION_FAILURE/.test(e))return`Google Play Protect stopped it — it checks every app from outside the Play Store, and refused this build with nobody there to answer it. Retry with the phone in hand: if Play Protect asks, install anyway. If it refuses without asking, Play Store › Play Protect says why`;if(/Session was abandoned/i.test(e))return`the install was dropped before it finished — Android abandons one when the app is closed mid-install or the confirm dialog goes unanswered. A retry starts a fresh one`;let t=/allocate (\d+) because only (\d+) allocatable/i.exec(e);if(!t)return e;let n=e=>`${Math.ceil(e/1e6)} MB`,r=Number(t[1]),i=Number(t[2]),a=i>0?`only ${n(i)} of it is usable`:`none of it is usable yet`;return`this phone is out of space — it needs ${n(r)} beyond the room Android keeps in reserve (up to 500 MB), and ${a}. Free space until Settings shows about ${n(r+5e8-i)} free, then retry`}function km(e){return e===`failed`?`retry install`:e===`installed`?`install again`:`install`}function Am(e){return Dm(e.install,e.installError,Cm(e),e.pkgVersion)}function jm(e,t){let n=e.mtime;return!e.pkg||!e.pkgVersion||!n||!t.some(t=>t.pkg===e.pkg&&t.pkgVersion===e.pkgVersion&&!!t.mtime&&t.mtime<n)?null:`same version (${e.pkgVersion}) as an older build on this phone — its repo does not raise the version on every build, so once installed the two cannot be told apart. Ask the repo's agent to raise it on every build`}function Mm(e,t,n){if(!t.supported||!Sm(e)||!e.pkg)return null;let r=Cm(e);return _m(e.pkg,t)?vm:q(t)?bm(r):wm(e,n)?t.canInstall?t.silent?e.install===`installed`?`new builds of ${r} install by themselves`:`new builds of ${r} install by themselves — the first one asks once`:`new builds of ${r} install by themselves, and this Android asks every time`:`${r} would install itself once this phone allows it`:`new builds of ${r} wait for a tap`}function Nm(e,t,n){if(!t.supported||!Sm(e)||!e.pkg||q(t))return null;let r=wm(e,n);return{pkg:e.pkg,on:r,label:r?`stop installing ${Cm(e)} by itself`:`install ${Cm(e)} by itself`}}function Pm(e,t){if(!e.supported)return null;if(!e.canInstall)return`Allow ${k.displayName} to install apps and a build downloaded here can go straight onto this phone.`;if(q(e))return xm;if(!t.length)return`No app installs by itself yet — you can turn it on for an app, one at a time.`;let n=t.length;return n===1?`1 app installs itself when a new build arrives.`:`${n} apps install themselves when a new build arrives.`}function Fm(e){return e>=1e6?`${Math.round(e/1e6)} MB`:`${Math.max(1,Math.round(e/1e3))} kB`}function Im(e){let t=`APK deleted after it installed${e.cleanedBytes?` (${Fm(e.cleanedBytes)} freed)`:``} — fetch it again to reinstall`;return e.cleanNote?`${t} · ${e.cleanNote}`:t}`${k.stateDirName}`;var Lm=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Rm(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getDate()} ${Lm[t.getMonth()]} ${n(t.getHours())}:${n(t.getMinutes())}`}function zm(e){let t=e.sha?`${e.sha}${e.dirty?` + edits`:``}`:e.dirty?`uncommitted edits`:``;return[e.version??``,t,Rm(e.at)].filter(Boolean).join(` · `)}var Bm=/^[^\r\n]{1,200}$/,Vm=e=>typeof e==`string`&&Bm.test(e.trim())?e.trim():void 0;function Hm(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.at!=`number`||!Number.isFinite(t.at)||t.at<=0)return null;let n={at:t.at},r=Vm(t.version),i=Vm(t.sha);return r&&(n.version=r),i&&/^[0-9a-f]{4,40}$/i.test(i)&&(n.sha=i),t.dirty===!0&&(n.dirty=!0),n}var Um=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)&&Math.floor(e)>=20&&Math.floor(t)>=12,Wm=e=>Math.min(e,160),Gm=/\x1b\[[0-9;?]*[ -/]*[@-~]/y,Km=/[\n\r\u2028\u2029]/g;function qm(e){let t=``,n=0,r=-2,i=-2,a=-2,o=(e,t,n)=>e===-1||e>=t?e:n(t);for(let s=e.indexOf(`\x1B`);s>=0;s=e.indexOf(`\x1B`,s)){let c=e[s+1],l=-1;c===`[`?(Gm.lastIndex=s,Gm.test(e)&&(l=Gm.lastIndex)):c===`P`||c===`X`||c===`^`||c===`_`?(r=o(r,s+2,t=>e.indexOf(`\x1B\\`,t)),a=o(a,s+2,t=>(Km.lastIndex=t,Km.exec(e)?.index??-1)),r>=0&&(a<0||a>r)&&(l=r+2)):c===`]`&&(i=o(i,s+2,t=>e.indexOf(`\x07`,t)),i>=0&&(l=i+1)),l<0?s++:(t+=e.slice(n,s),n=s=l)}return n===0?e:t+e.slice(n)}var Jm=/^(?:\d+(?:\.\d+)?\s*(?:ms|s|m|h)\s*)+$/i,Ym=/\b(?:esc|ctrl\+|shift\+|tab)\b/i,Xm=/([A-Za-z][A-Za-z'-]*ing)\s*(?:…|\.\.\.)/g,Zm=/([A-Za-z][A-Za-z'-]*ing(?:\s+[A-Za-z][A-Za-z'-]*){1,3})\s*(?:…|\.\.\.)/g,Qm=/^[▰▱▬█▓░▒⣿⠿\s]*[▰▱▬█▓░▒⣿⠿]{4,}[\s]*(\d{1,3})\s?%$/,$m=/^\s*[◯◉○●◎⏺]\s+[A-Za-z][\w:-]*\s{2,}\S/,eh=/(?:^|\s)\d+(?:\.\d+)?\s*[smh](?:\s+\d+\s*[sm])*\s+·\s+[↓↑]\s*[\d.,]+\s*[km]?\s+tokens?\s*$/i;function th(e){if(!e)return null;let t=qm(e).split(/[\r\n]+/),n=e=>(e??``).replace(/[│┃|╭╮╰╯─]/g,` `).replace(/\s+/g,` `).trim(),r=null;for(let e=t.length-1;e>=0;e--){if($m.test(t[e]??``)||eh.test(t[e]??``))continue;let i=n(t[e]);if(!i)continue;let a=[...i.matchAll(/\(([^()]*)\)/g)],o=a[a.length-1],s=o?i.slice(0,o.index):i,c=null,l=null,u=[];for(let e of(o?.[1]??``).split(`·`)){let t=e.trim();t&&!Ym.test(t)&&(!c&&Jm.test(t)?c=t:!l&&/tokens?\b/i.test(t)?l=t:u.push(t))}let d=Qm.exec(n(t[e+1]))?.[1]??Qm.exec(i.slice(i.search(/[▰▱▬█▓░▒⣿⠿]/)<0?i.length:i.search(/[▰▱▬█▓░▒⣿⠿]/)))?.[1]??null;d&&u.push(`${d}%`);let f=[...s.matchAll(Xm)],p=f.length||!(c||l||d)?[]:[...s.matchAll(Zm)],m=f[f.length-1]??p[p.length-1];if(!m)continue;let h=`${m[1]}…`;if(!c&&!l&&!d){r??={phrase:h,elapsed:null,tokens:null,extra:[],text:h};continue}let g=[h,l,...u].filter(Boolean).join(` · `);return{phrase:h,elapsed:c,tokens:l,extra:u,text:g.length>140?`${g.slice(0,139)}…`:g}}return r}var nh=/\bto scroll\b/i;function rh(e){return e?nh.test(qm(e).slice(-2e3)):!1}function ih(e){if(e===`shift+tab`)return`\x1B[Z`;if(e===`ctrl+c`||e===`ctrl+g`)return null;let t=/^ctrl\+([a-z])$/.exec(e);return t?String.fromCharCode(t[1].charCodeAt(0)-96):/^[a-z0-9]$/.test(e)?e:null}function ah(e){if(e===`shift+tab`)return`⇧Tab`;let t=/^ctrl\+([a-z])$/.exec(e);return t?`^${t[1].toUpperCase()}`:e}var oh={up:`A`,down:`B`,right:`C`,left:`D`,home:`H`,end:`F`},sh={pgup:`5`,pgdn:`6`,delete:`3`},ch={tab:` `,enter:`\r`,esc:`\x1B`,backspace:``,space:` `,up:`\x1B[A`,down:`\x1B[B`,right:`\x1B[C`,left:`\x1B[D`,home:`\x1B[H`,end:`\x1B[F`,pgup:`\x1B[5~`,pgdn:`\x1B[6~`,delete:`\x1B[3~`},lh={"[":`\x1B`,"\\":``,"]":``,"^":``,_:``,"?":``,"@":`\0`," ":`\0`};function uh(e,t){return[e.ctrl&&`ctrl`,e.alt&&`alt`,e.shift&&`shift`,t===` `?`space`:t].filter(Boolean).join(`+`)}function dh(e){return!!(e.ctrl||e.alt||e.shift)}function fh(e,t){let n=uh(e,t),r=e=>({refused:`${n} has no terminal bytes — ${e}`});if(!t)return r(`no key`);if(t in oh||t in sh){if(!dh(e))return{bytes:ch[t]};let n=1+ +!!e.shift+(e.alt?2:0)+(e.ctrl?4:0);return{bytes:t in oh?`\x1b[1;${n}${oh[t]}`:`\x1b[${sh[t]};${n}~`}}if(e.alt){let n=fh({ctrl:e.ctrl,shift:e.shift},t);return`bytes`in n?{bytes:`\x1b${n.bytes}`}:r(`refused`in n?n.refused.replace(/^.*? — /,``):``)}let i=t===`space`?` `:t;if(e.ctrl){if(e.shift&&t!==`tab`)return r(`a plain terminal sends the same byte as without shift`);if(t===`tab`)return r(`terminals send Tab for it`);if(t===`enter`)return r(`terminals send Return for it`);if(t===`backspace`)return{bytes:`\b`};if(t===`esc`)return r(`terminals send Esc for it`);if(i.length===1){let e=i.toLowerCase();if(/^[a-z]$/.test(e))return{bytes:String.fromCharCode(e.charCodeAt(0)-96)};if(i in lh)return{bytes:lh[i]};if(i===`-`)return{bytes:``}}return r(`ctrl combines only with a letter or [ \\ ] ^ _ ? @ space`)}return e.shift?t===`tab`?{bytes:`\x1B[Z`}:t===`enter`?r(`terminals send Return for it; Alt+Return is claude's newline`):t===`space`?{bytes:` `}:t in ch?{bytes:ch[t]}:i.length===1?{bytes:i.toUpperCase()}:r(`unknown key`):t in ch?{bytes:ch[t]}:i.length===1?{bytes:i}:r(`unknown key`)}var ph=16e3;ph*2;function mh(e,t=ph){let n=e.length*2,r=new ArrayBuffer(44+n),i=new DataView(r),a=(e,t)=>{for(let n=0;n<t.length;n++)i.setUint8(e+n,t.charCodeAt(n))};return a(0,`RIFF`),i.setUint32(4,36+n,!0),a(8,`WAVE`),a(12,`fmt `),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),a(36,`data`),i.setUint32(40,n,!0),new Int16Array(r,44).set(e),new Uint8Array(r)}function hh(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n++){let r=Math.max(-1,Math.min(1,e[n]));t[n]=r<0?r*32768:r*32767}return t}var gh=.25,_h=new Set(`af.am.ar.as.az.ba.be.bg.bn.bo.br.bs.ca.cs.cy.da.de.el.en.es.et.eu.fa.fi.fo.fr.gl.gu.ha.haw.he.hi.hr.ht.hu.hy.id.is.it.ja.jw.ka.kk.km.kn.ko.la.lb.ln.lo.lt.lv.mg.mi.mk.ml.mn.mr.ms.mt.my.ne.nl.nn.no.oc.pa.pl.ps.pt.ro.ru.sa.sd.si.sk.sl.sn.so.sq.sr.su.sv.sw.ta.te.tg.th.tk.tl.tr.tt.uk.ur.uz.vi.yi.yo.yue.zh`.split(`.`)),vh={nb:`no`,jv:`jw`,iw:`he`,in:`id`,ji:`yi`,fil:`tl`,cmn:`zh`,mo:`ro`};function yh(e){let t=(e||``).trim().toLowerCase();if(!t||t===`auto`)return`auto`;let n=t.split(/[-_]/)[0],r=vh[n]||n;return _h.has(r)?r:`auto`}var bh=`auto`,xh={en:`English`,de:`German`,fr:`French`,es:`Spanish`,it:`Italian`,nl:`Dutch`,pt:`Portuguese`,pl:`Polish`,ru:`Russian`,uk:`Ukrainian`,cs:`Czech`,sv:`Swedish`,da:`Danish`,no:`Norwegian`,fi:`Finnish`,tr:`Turkish`,el:`Greek`,he:`Hebrew`,ar:`Arabic`,hi:`Hindi`,ja:`Japanese`,ko:`Korean`,zh:`Chinese`},Sh=[`en`,`de`];function Ch(e){return e===`auto`?`auto — whichever is spoken`:xh[e]||e}function wh(e){return e===`auto`?`auto`:e.toUpperCase()}function Th(e){return e===`auto`?`dictation is read as whichever language is spoken — pick one to pin it`:`dictation is read as ${Ch(e)} — anything else spoken is TRANSLATED into it`}function Eh(e){let t=Object.keys(xh).filter(e=>!Sh.includes(e)),n=[bh,...Sh,...t],r=yh(e);return r!==`auto`&&!n.includes(r)&&n.push(r),n.map(e=>({code:e,label:Ch(e)}))}var Dh=[bh,`en`,`de`];function Oh(e,t,n){let r=Eh(n),i=new Set(r.map(e=>e.code)),a=new Set((e||[]).map(e=>{let t=yh(e);return t===`auto`&&e.trim().toLowerCase()!==`auto`?``:t}).filter(e=>i.has(e)));if(!a.size)for(let e of Dh)i.has(e)&&a.add(e);let o=yh(t);return i.has(o)&&a.add(o),r.filter(e=>a.has(e.code))}function kh(e,t){let n=t.trim();if(!n)return e;let r=e.trimEnd();return r?`${r} ${n}`:n}var Ah=e=>e.replace(/\s+/g,` `).trim().slice(0,40).trim();function jh(e){let t=[],n=new Map;for(let r of String(e||``).split(/\r?\n/)){let e=r.trim();if(!e||e.startsWith(`#`))continue;let i=e.indexOf(`:`),a=Ah(i<0?e:e.slice(0,i));if(!a)continue;let o=i<0?[]:e.slice(i+1).split(`,`).map(Ah).filter(Boolean),s=a.toLowerCase(),c=n.get(s);if(!c){if(t.length>=60)continue;c={term:a,heard:[]},n.set(s,c),t.push(c)}for(let e of o){if(c.heard.length>=8)break;e.toLowerCase()!==s&&(c.heard.some(t=>t.toLowerCase()===e.toLowerCase())||c.heard.push(e))}}return t}function Mh(e){let t=String(e||``).split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`#`)),n=new Set(t.map(e=>Ah(e.split(`:`)[0]).toLowerCase()).filter(Boolean));return Math.max(0,n.size-jh(e).length)}function Nh(e){return e.map(e=>e.heard.length?`${e.term}: ${e.heard.join(`, `)}`:e.term).join(`
|
|
47
|
-
`)}var Ph=`\\p{L}\\p{N}`,Fh=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function Ih(e){return e.length>=3&&/^\S+$/.test(e)&&(/\p{N}/u.test(e)||/\p{Lu}/u.test(e.slice(1)))}function Lh(e,t){if(!e||!t.length)return e;let n=[];for(let e of t){for(let t of e.heard){let r=t.split(` `).map(Fh).join(`[\\s\\-]+`);n.push({re:RegExp(`(?<![${Ph}])${r}(?![${Ph}])`,`giu`),term:e.term,keep:()=>!1,len:t.length})}if(/^\S+$/.test(e.term)&&e.term.length>=2&&e.term.length<=16){let t=Array.from(e.term).map(Fh).join(`[\\s.\\-]?`),r=Ih(e.term);n.push({re:RegExp(`(?<![${Ph}])${t}(?![${Ph}])`,`giu`),term:e.term,keep:t=>t===e.term||!/[\s.\-]/.test(t)&&!r,len:e.term.length})}}n.sort((e,t)=>t.len-e.len);let r=e;for(let e of n)r=r.replace(e.re,t=>e.keep(t)?t:e.term);return r}var Rh=`tools/repohealth.mjs`,zh=`the repo-health engine`,Bh=yr(`repohealth.jsonl`),Vh=br(`health.json`);function Hh(e){return!e||typeof e.hasRepoHealth!=`boolean`?`unknown`:e.hasRepoHealth?`offered`:`absent`}function Uh(e){return e===`absent`?`No repo-health engine on this desktop — neither this repo's own ${Rh} nor a bundled one was found, so there is nothing to read the history with.`:e===`unknown`?`This desktop is older than repo health and cannot say whether this repo has it.`:null}function Wh(e){return!e||!(`plot`in e)||e.plot===void 0?`unknown`:e.plot===null?`none`:`plotted`}function Gh(e,t){return e===`none`?typeof t==`string`&&t.length>0?t:`${zh} read no series to plot here — refresh it to measure one.`:e===`unknown`?`This desktop is older than the repo-health plot and sent no series to draw.`:null}var Kh=e=>typeof e==`string`&&e.length>0;function qh(e){return e&&Kh(e.recut)?e.recut:null}var J=[`size`,`retouch`,`hatches`,`context`,`untested`],Jh={lineMean:500,max:1e3,retouch:.15,hatches:2,untested:.2},Yh=16e3,Xh=e=>typeof e==`number`&&Number.isFinite(e)&&e>0,Y=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function Zh(e,t){return e<=0?100:100*Math.min(1,t/e)}function Qh(e){if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let t=Date.parse(`${e}T00:00:00Z`);if(!Number.isFinite(t)||new Date(t).toISOString().slice(0,10)!==e)return null;let n=(new Date(t).getUTCDay()+6)%7;return new Date(t-n*864e5).toISOString().slice(0,10)}function $h(e){let t=new Map;for(let n of e){if(!n||typeof n.ts!=`number`)continue;let e=Qh(n.day);if(!e)continue;let r=t.get(e);(!r||n.ts>=r.ts)&&t.set(e,n)}return[...t.entries()].sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>({week:e,row:t}))}function eg(e){return 1*(Xh(e)?e:Yh)}function tg(e){let t={},n,r=e.size?.value;r&&Y(r.max)&&(n={value:r.max,path:typeof r.maxPath==`string`&&r.maxPath?r.maxPath:null}),r&&Y(r.lineMean)&&n&&(t.size=r.lineMean);let i=e.retouch?.value?.rate;Y(i)&&(t.retouch=i);let a=e.hatches,o=e.classics?.value?.loc;if(a?.value&&typeof a.value==`object`&&Xh(o)){let e=0,n=!0;if(a.split&&typeof a.split==`object`)Y(a.split.unexplained)?e=a.split.unexplained:n=!1;else for(let t of Object.values(a.value)){if(!Y(t)){n=!1;break}e+=t}n&&(t.hatches=e/(o/1e3))}let s=e.context?.value,c=s?.claudeMdChars,l=s?.descChars;!s&&e.context?.reason===`no CLAUDE.md at this commit`?t.context=0:Y(c)&&(l==null||Y(l))&&(t.context=c+(typeof l==`number`?l:0));let u=e.untested?.value,d=e.classics?.value?.files;Array.isArray(u)&&Xh(d)&&u.length<=d&&(t.untested=u.length/d);let f=rg(e);for(let e of f.disabled)delete t[e],e===`size`&&(n=void 0);for(let r of f.overridden){delete t[r];let i=e.central?.override?.[r]?.value;Y(i)&&(r!==`size`||n)&&(t[r]=i)}return t.size===void 0&&(n=void 0),n?{values:t,max:n}:{values:t}}var ng=e=>J.includes(e);function rg(e){let t=e.central;if(!t||typeof t!=`object`)return{fp:``,disabled:[],overridden:[]};let n=typeof t.fp==`string`?t.fp:``,r=e=>e&&typeof e==`object`?Object.keys(e).filter(ng):[],i=J.filter(e=>r(t.disabled).includes(e));return{fp:n,disabled:i,overridden:J.filter(e=>r(t.override).includes(e)&&!i.includes(e))}}var ig=864e5;function ag(e){let t=e.classics?.value;return t&&Y(t.files)&&Y(t.loc)?{files:t.files,loc:t.loc}:null}var og=(e,t)=>Math.round((Date.parse(`${t}T00:00:00Z`)-Date.parse(`${e}T00:00:00Z`))/ig),X=e=>Math.round(e).toString().replace(/\B(?=(\d{3})+(?!\d))/g,`,`),sg=e=>`${Math.round(e*100)}%`,cg=e=>(Math.round(e*10)/10).toFixed(1),lg={size:`file length`,retouch:`re-touches`,hatches:`escape hatches`,context:`CLAUDE.md + skill descriptions`,untested:`untested modules`};function ug(e,t,n,r,i){return`${e}: ${(()=>{switch(t){case`max`:return`${i??`the longest file`} is ${X(n)} lines (good: under ${X(r)})`;case`lineMean`:return`the average line sits in a file of ${X(n)} lines (good: under ${X(r)})`;case`retouch`:return`${sg(n)} of recent file edits rework the edit before (good: under ${sg(r)})`;case`hatches`:return`${cg(n)} unexplained escape hatches per 1,000 lines (good: under ${cg(r)})`;case`context`:return`CLAUDE.md + skill descriptions are ${X(n)} chars (good: under ${X(r)})`;case`untested`:return`${sg(n)} of source files have no test reaching them (good: under ${sg(r)})`}})()}`}function dg(e,t,n,r,i){let a=Zh(n,r);if(!(a<50))return null;let o=a<25?`severe`:`warn`,s=i??void 0;return{level:o,entry:e,subject:t,value:n,good:r,score:a,...s?{path:s}:{},text:ug(o,t,n,r,s)}}function fg(e){if(!e.cappedBy||!(e.value<e.mean))return null;let t=Math.round(e.value-30);return`Capped at ${Math.round(e.value)} by ${Gf(lg,e.cappedBy,`an entry this app version cannot name`)} (${t} of 100): the entries average ${Math.round(e.mean)}, and the score stays within 30 of its worst entry.`}function pg(e,t,n){let r=J.filter(e=>!t.includes(e));if(r.length===0||r.some(t=>e.values[t]===void 0))return null;let i=eg(n),a={},o=null,s=[];for(let t of r){let n=e.values[t];if(t===`size`){let t=e.max;o={lineMean:{value:n,score:Zh(n,Jh.lineMean)},max:{value:t.value,score:Zh(t.value,Jh.max),path:t.path}},a.size=Math.sqrt(o.lineMean.score*o.max.score);let r=dg(`size`,`lineMean`,n,Jh.lineMean),i=dg(`size`,`max`,t.value,Jh.max,t.path);r&&s.push(r),i&&s.push(i);continue}let r=t===`context`?i:Jh[t];a[t]=Zh(n,r);let c=dg(t,t,n,r);c&&s.push(c)}let c=r.length,l=Math.exp(r.reduce((e,t)=>e+Math.log(a[t]),0)/c),u=r[0];for(let e of r)a[e]<a[u]&&(u=e);let d=a[u]+30,f=Math.min(l,d);return s.sort((e,t)=>e.score-t.score),{index:f,mean:l,scores:a,sizeParts:o,cappedBy:d<l?u:null,alerts:s,enabled:r}}function mg(e,t){let n=[];for(let{week:r,row:i}of $h(e)){let e=rg(i),a=tg(i),o=pg(a,e.disabled,t);if(!o)continue;let s=typeof i.prereg==`string`?i.prereg:null,c=n[n.length-1],l={week:r,index:o.index,mean:o.mean,scores:o.scores,sizeParts:o.sizeParts,cappedBy:o.cappedBy,alerts:o.alerts,values:a.values,prereg:s,central:e.fp,disabled:e.disabled,overridden:e.overridden,tree:ag(i)};if(!c){n.push({...l,gap:!1,lnLink:null,comparable:0,contributions:{},spanDays:null});continue}let u=og(c.week,r),d=c.prereg===s?c.central===e.fp?null:`central`:`prereg`;if(d){n.push({...l,gap:!0,lnLink:null,comparable:0,contributions:{},spanDays:u,gapReason:d});continue}let f=o.enabled.length,p={};for(let e of o.enabled){let t=c.scores[e],n=o.scores[e];t!==void 0&&n!==void 0&&(p[e]=c.mean*(Math.log(n)-Math.log(t))/f)}n.push({...l,gap:!1,lnLink:Math.log(o.index/c.index),comparable:f,contributions:p,spanDays:u})}return n.length===0?null:{baselineWeek:n[0].week,points:n}}function hg(e,t){let n=pg(tg(e),rg(e).disabled,t);return n?{index:n.index,mean:n.mean,scores:n.scores,cappedBy:n.cappedBy}:null}function gg(e,t){if(e.length<=t)return[...e];let n=new Set,r=new Map;e.forEach((e,t)=>r.set(e.week,t));for(let e of r.values())n.add(e);let i=Math.ceil(e.length/Math.max(1,t));for(let t=0;t<e.length;t+=i){let r=t,a=t,o=Math.min(e.length,t+i);for(let n=t;n<o;n++)e[n].index<e[r].index&&(r=n),e[n].index>e[a].index&&(a=n);n.add(r),n.add(a)}return[...n].sort((e,t)=>e-t).map(t=>e[t])}function _g(e,t,n=240){let r=e.filter(e=>e&&typeof e.ts==`number`).sort((e,t)=>e.ts-t.ts),i=[],a=null;for(let e of r){let n=Qh(e.day),r=n?hg(e,t):null;if(!n||!r)continue;let o=typeof e.prereg==`string`?e.prereg:null,s=rg(e).fp;i.push({sha7:typeof e.sha==`string`?e.sha.slice(0,7):``,day:e.day,ts:e.ts,week:n,index:r.index,mean:r.mean,cappedBy:r.cappedBy,gap:a!==null&&(a.prereg!==o||a.central!==s)}),a={prereg:o,central:s}}if(i.length===0)return null;let o=gg(i,n);return{points:o,total:i.length,thinned:o.length<i.length}}function vg(e){return!e||e.commits===void 0?`absent`:e.commits&&e.commits.points.length>0?`present`:`none`}function yg(e,t=12,n=e.length-1){let r=e[n];if(!r||!(t>0)||!Number.isFinite(r.index))return null;let i=Date.parse(`${r.week}T00:00:00Z`),a=i-t*7*ig;for(let t=n-1;t>=0;t--){let n=Date.parse(`${e[t].week}T00:00:00Z`);if(n>a)continue;let o=e[t];return o.index>0?{ratio:r.index/o.index,delta:r.index-o.index,then:o,now:r,weeks:Math.round((i-n)/(7*ig))}:null}return null}function bg(e,t){let n=[...e].sort((e,t)=>e-t),r=t/100*(n.length-1),i=Math.floor(r),a=Math.ceil(r);return n[i]+(n[a]-n[i])*(r-i)}function xg(e,t={}){let n=t.minWeeks??8,r=t.minMonthWindows??4,i=t.lowPct??10,a=t.highPct??90,o=t.minPoints??2,s=(e,t=null,n=null)=>({kind:null,horizon:t,delta:n,reason:e}),c=e[e.length-1];if(!c)return s(`no index yet`);let l=e.filter(e=>e.lnLink!==null);if(l.length<n)return s(`${l.length} weekly link${l.length===1?``:`s`} so far; a move is called after ${n}`);if(c.lnLink!==null){let t=l.slice(0,-1).map(e=>e.lnLink),n=e[e.length-2].index,r=c.index-n;if(c.lnLink<bg(t,i)&&-r>=o)return{kind:`drop`,horizon:`week`,delta:r,reason:`the latest week's link sits below the ${i}th percentile of ${t.length} earlier weeks`};if(c.lnLink>bg(t,a)&&r>=o)return{kind:`rise`,horizon:`week`,delta:r,reason:`the latest week's link sits above the ${a}th percentile of ${t.length} earlier weeks`}}let u=e.length-1;if(u<4)return s(`too few weeks for a four-week reading`);let d=t=>{for(let n=t-4+1;n<=t;n++)if(e[n].gap)return!0;return!1};if(d(u))return s(`the last four weeks span a change of definition, so there is no month move to compare`);let f=[];for(let t=4;t<u;t++)d(t)||f.push(Math.log(e[t].index/e[t-4].index));let p=c.index-e[u-4].index;if(f.length<r)return s(`${f.length} earlier four-week window${f.length===1?``:`s`}; a month move is called after ${r}`);let m=Math.log(c.index/e[u-4].index);return m<bg(f,i)&&-p>=o?{kind:`drop`,horizon:`month`,delta:p,reason:`the last four weeks sit below the ${i}th percentile of ${f.length} earlier four-week windows`}:m>bg(f,a)&&p>=o?{kind:`rise`,horizon:`month`,delta:p,reason:`the last four weeks sit above the ${a}th percentile of ${f.length} earlier four-week windows`}:s(`within this repo's usual range`,null,c.lnLink===null?null:c.index-e[u-1].index)}var Sg={size:[`files grew longer`,`files got shorter`],retouch:[`more re-touched files`,`fewer re-touched files`],hatches:[`more escape hatches`,`fewer escape hatches`],context:[`CLAUDE.md + skill descriptions grew`,`CLAUDE.md + skill descriptions shrank`],untested:[`more untested modules`,`fewer untested modules`]};function Cg(e){let t=Math.round(e);return t===0?`±0`:t<0?`−${-t}`:`+${t}`}function wg(e,t){return t&&e===t?`this week`:`in the week of ${e}`}function Tg(e,t,n){let r=e[e.length-1];if(!r||!t.kind||!t.horizon||t.delta===null)return null;let i=Math.round(r.index),a=t.horizon===`week`?1:4,o=n&&r.week===n,s=t.horizon===`week`?wg(r.week,n):o?`over four weeks`:`over the four weeks to ${r.week}`,c={},l=0,u=null,d=null,f=null,p=0;for(let t=Math.max(1,e.length-a);t<e.length;t++){let n=e[t],r=e[t-1];if(n.gap)continue;let i=Math.log(n.mean/r.mean),a=Math.abs(i)<1e-12?1:Math.expm1(i)/i;for(let e of J){let t=n.contributions[e];t!==void 0&&(c[e]=(c[e]??0)+t*a)}let o=n.index-r.index-(n.mean-r.mean);l+=o;let s=o>0?r.cappedBy:n.cappedBy;s&&Math.abs(o)>p&&(p=Math.abs(o),u=s,d=r.cappedBy,f=n.cappedBy)}let m=t.kind===`drop`?-1:1,h=J.filter(e=>(c[e]??0)*m>0).map(e=>({pts:c[e]??0,words:Sg[e][t.kind===`drop`?0:1]}));if(u&&l*m>0){let e=lg[u],t=m>0?f===u?`${e} holds the score down less`:`${e} no longer holds the score down`:d===u?`${e} holds the score down more`:`${e} now holds the score down`;h.push({pts:l,words:t})}let g=h.filter(e=>Math.round(e.pts)!==0).sort((e,t)=>Math.abs(t.pts)-Math.abs(e.pts)).slice(0,2).map(e=>`${e.words} (${Cg(e.pts)})`),_=t.kind===`rise`?Og(e,a,(c.size??0)+(u===`size`?l:0),t.delta):null,ee=t.kind===`drop`?`slipped`:`rose`,te=Math.abs(Math.round(t.delta)),ne=g.length?`The score ${ee} ${te} point${te===1?``:`s`} ${s}: ${g.join(`, `)}.`:`The score ${ee} ${te} point${te===1?``:`s`} ${s}.`;return{chip:`Health ${i} ${Cg(t.delta)}`,title:`Health score ${i} (${Cg(t.delta)} ${s})`,body:_?`${ne} ${_}`:ne}}var Eg=e=>Math.round(e).toString().replace(/\B(?=(\d{3})+(?!\d))/g,`,`),Dg=1.5;function Og(e,t,n,r){if(!(r>0)||n<r/2)return null;let i=e[Math.max(0,e.length-t-1)]?.tree,a=e[e.length-1]?.tree;return!i||!a||i.files<=0||i.loc<=0||a.files<i.files*Dg||a.loc<i.loc*.9?null:`Mostly files split up: ${Eg(i.files)} → ${Eg(a.files)} source files while the code went from ${Eg(i.loc)} to ${Eg(a.loc)} lines. The score cannot tell whether the design got better.`}function kg(e,t){let n=e?.points,r=n?.[n.length-1];if(!n||!r)return null;let i=n[n.length-2];return{value:r.index,deltaWeek:r.lnLink!==null&&i?r.index-i.index:null,week:r.week,move:t?.kind??null,mean:r.mean,cappedBy:r.cappedBy,alert:r.alerts[0]?.level??null,alertText:r.alerts[0]?.text??null}}var Ag=[`requested`,`shipped`,`superseded`,`dropped`];function jg(e){let t=e.trim(),n=/^\d{4}-\d{2}-\d{2}/.exec(t)?.[0]??null,r=/session ([0-9a-f]{8})/.exec(t)?.[1]??null,i=t.indexOf(`(`),a=i<0?-1:t.indexOf(`)`,i+1),o=a<0?null:t.slice(i+1,a).trim();return{date:n,session:r,note:o&&!r?o:!n&&/^[0-9a-f]{8}$/.test(t)?t:null}}function Mg(e,t){if(!e||!t)return 0;let n=e.split(`.`).map(e=>parseInt(e,10)||0),r=t.split(`.`).map(e=>parseInt(e,10)||0);for(let e=0;e<Math.max(n.length,r.length);e++){let t=(n[e]??0)-(r[e]??0);if(t)return t>0?1:-1}return 0}function Ng(e,t){return!e||!t?null:Mg(t,e)>0?{running:e,installed:t}:null}function Pg(e,t){let n=`This session runs Claude ${e.running}; ${e.installed} is installed.`;if(!t.resumeId)return{text:n,cant:`its conversation id is not known yet, so a restart could not reopen the same conversation`};let r=[];t.turnActive&&r.push(`the turn that is running`);let i=t.agents??0;return i>0&&r.push(i===1?`1 background agent`:`${i} background agents`),t.shells&&r.push(`the background shells`),r.length?{text:n,loses:r.join(` and `)}:{text:n}}function Fg(e){return{title:`Restart on Claude ${e.installed} first?`,lines:[`This session still runs Claude ${e.running}; ${e.installed} is installed.`,`Restart, then send: the same conversation reopens on ${e.installed} and this message is its first prompt.`,`Send on ${e.running}: the message goes now and the bar above stays — this is not asked again for this version.`],confirmLabel:`Restart, then send`,cancelLabel:`Send on ${e.running}`}}var Ig=6e5;function Lg(e,t,n=Ig){return e.cpuMovedAt===void 0&&e.outputAt===void 0?`unknown`:e.workers===0?`waiting`:t-Math.max(e.cpuMovedAt??0,e.outputAt??0)<n?`working`:`quiet`}function Rg(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?r>0?`${n}d ${r}h`:`${n}d`:r>0?i>0?`${r}h ${i}m`:`${r}h`:i>0?`${i}m`:`${a}s`}var zg=/pgrep\s+-f\s+(?:"([^"]*)"|'([^']*)')/g,Bg=/[$^.*+?()[\]{}|\\]/;function Vg(e){zg.lastIndex=0;let t;for(;t=zg.exec(e);){let e=t[1]??t[2]??``;if(e&&!Bg.test(e))return e}return null}function Hg(e,t){if(e.foreground)return`a command this turn is running`;let n=Rg(t-e.startedAt);if(e.serverLike)return`long-running by design · ${n}`;if(e.selfMatch){let t=Vg(e.command);if(t)return`waits for "${t}" to end — its own command line matches that pattern, so this never ends`}let r=Lg(e,t);return r===`unknown`?`can't tell yet`:r===`working`?`running · ${n} · CPU moved ${Rg(t-Math.max(e.cpuMovedAt??0,e.outputAt??0))} ago`:r===`waiting`?`waiting in a loop · ${n} · only sleeps between checks`:`quiet ${n} · no CPU and no output`}function Ug(e,t,n=Ig){let r={working:0,waiting:0,quiet:0,unknown:0,foreground:0,total:0};for(let i of e)i.foreground?r.foreground++:(r[Lg(i,t,n)]++,r.total++);return r}function Wg(e){let t=e.total===1?`shell`:`shells`,n=`${e.total} ${t}`;if(!e.total)return n;let r=[`quiet`,`waiting`,`unknown`,`working`].find(t=>e[t]>0);if(!r)return n;let i=r===`working`?`running`:r;return e.total===1?`${n} · ${i}`:`${n} · ${e[r]} ${i}`}function Gg(e){return e.description?e.description:e.command.trim().split(/\s+/).slice(0,3).join(` `)||`shell`}function Kg(e,t){if(!e.total)return``;let n=[],r=0;for(let e of t)e.foreground||(e.workers===0?r++:n.push(Gg(e)));r&&n.push(r===1?`1 wait loop`:`${r} wait loops`);let i=e.total===1?`background shell`:`background shells`;return`stops ${e.total} ${i}${n.length?` — ${n.join(`, `)}`:``}`}function qg(e){let t=new Set(e.map(e=>e.id)),n=new Map;for(let r of e){if(!r.companionOf||r.companionOf===r.id||!t.has(r.companionOf))continue;let e=n.get(r.companionOf);e?e.push(r):n.set(r.companionOf,[r])}if(!n.size)return[...e];let r=new Set([...n.values()].flat().map(e=>e.id)),i=[],a=e=>{i.push(e);for(let t of n.get(e.id)??[])a(t)};for(let t of e)r.has(t.id)||a(t);if(i.length<e.length)for(let t of e)i.includes(t)||i.push(t);return i}function Jg(e,t){if(e.companionOf){let n=t.find(t=>t.id===e.companionOf);return n?{target:n,to:`cli`}:null}let n=t.filter(t=>t.companionOf===e.id);return n.length?{target:n.reduce((e,t)=>(t.createdAt??0)>(e.createdAt??0)?t:e),to:`shell`}:null}var Yg=j(`brand.migratedFrom`);function Xg(e){for(let t of A)if(t.storagePrefix!==k.storagePrefix&&e.startsWith(t.storagePrefix))return k.storagePrefix+e.slice(t.storagePrefix.length);return null}function Zg(e,t){if(e.getItem(Yg)!==null)return{ran:!1,copied:[],kept:[]};let n=[];for(let t=0;t<e.length;t++){let r=e.key(t);r!==null&&n.push(r)}let r=[],i=[];for(let t of A)if(t.storagePrefix!==k.storagePrefix)for(let a of n){if(!a.startsWith(t.storagePrefix))continue;let n=k.storagePrefix+a.slice(t.storagePrefix.length);if(e.getItem(n)!==null){i.push(a);continue}let o=e.getItem(a);o!==null&&(e.setItem(n,o),r.push([a,n]))}let a={from:A.map(e=>e.slug),at:t};return e.setItem(Yg,JSON.stringify(a)),{ran:!0,copied:r,kept:i}}`${k.slug}`;var Qg=/^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$/;function $g(e){if(typeof e!=`string`||!e.trim())return`no address given`;let t=/^([^:/\s]+):(\d{1,5})$/.exec(e.trim());if(!t)return`write the address as host:port`;let n=Number(t[2]);if(n<1||n>65535)return`the port must be 1-65535`;let r=t[1].toLowerCase(),i=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(r);if(i){let e=i.slice(1).map(Number);return e.some(e=>e>255)||i.slice(1).some(e=>e.length>1&&e.startsWith(`0`))?`not a valid IPv4 address`:e[0]===127&&e[1]===0&&e[2]===0&&e[3]===1||e[0]===100&&e[1]>=64&&e[1]<=127?null:`only a Tailscale address (100.64.0.0/10) or 127.0.0.1 may be a peer`}if(r.endsWith(`.ts.net`)){let e=r.split(`.`);return e.length>=4&&e.every(e=>/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(e))?null:`a MagicDNS name looks like <machine>.<tailnet>.ts.net`}return`only a Tailscale address (100.x or <machine>.<tailnet>.ts.net) or 127.0.0.1 may be a peer`}function e_(e,t){if(!e||typeof e.peer!=`string`||!e.peer)return``;let n={queued:`waiting on ${e.peer}`,waiting:`waiting on ${e.peer}`,running:`waiting on ${e.peer}`,limit:`${e.peer} is at its usage limit`,unreachable:`${e.peer} unreachable`,done:`${e.peer} has answered`,failed:`${e.peer}'s job failed`,refused:`${e.peer} refused the job`}[e.state];if(!n)return``;if(typeof t!=`number`||!Number.isFinite(t)||!Number.isFinite(e.since)||e.since<=0||t<e.since)return n;let r=Math.floor((t-e.since)/6e4);return`${n} · ${r<1?`just now`:r<60?`${r} min`:r<1440?`${Math.floor(r/60)} h`:`${Math.floor(r/1440)} d`}`}var Z=e=>typeof e==`number`&&Number.isFinite(e)&&e>0,t_=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function n_(e){if(typeof e!=`string`)return null;let t=Ge(e),n=t?t.replace(/^claude-/,``):e.trim().toLowerCase();return/^[a-z0-9][a-z0-9._/-]{0,47}$/.test(n)?n:null}function r_(e){if(!e||typeof e!=`object`)return;let t=e,n={};Z(t.usd)&&(n.usd=t.usd);let r=t.tokens&&typeof t.tokens==`object`?t.tokens:null;r&&t_(r.in)&&t_(r.out)&&t_(r.cacheRead)&&t_(r.cacheWrite)&&r.in+r.out+r.cacheRead+r.cacheWrite>0&&(n.tokens={in:r.in,out:r.out,cacheRead:r.cacheRead,cacheWrite:r.cacheWrite});let i=n_(t.model);return i&&(n.model=i),Z(t.durationMs)&&(n.durationMs=t.durationMs),Z(t.weekPct)&&t.weekPct<=100&&(n.weekPct=t.weekPct),Z(t.unpricedTok)&&(n.unpricedTok=t.unpricedTok),Object.keys(n).length?n:void 0}function i_(e){if(!Z(e))return``;let t=Math.floor(e/6e4);if(t<1)return`<1 min`;if(t<60)return`${t} min`;if(t<1440){let e=Math.floor(t/60),n=t%60;return n?`${e} h ${n} min`:`${e} h`}let n=Math.floor(t/1440),r=Math.floor(t%1440/60);return r?`${n} d ${r} h`:`${n} d`}function a_(e){return Z(e)?e<.001?`<0.001% of week`:`≈${e<1?String(Number(e.toPrecision(1))):e<10?e.toFixed(1):String(Math.round(e))}% of week`:``}function o_(e){if(!e)return[];let t=[];Z(e.usd)&&t.push(x(e.usd)),e.model&&t.push(e.model);let n=i_(e.durationMs);return n&&t.push(n),t}var s_={queued:`queued there`,waiting:`waiting there`,running:`running`,limit:`at its usage limit`,unreachable:`unreachable`,done:`done`,failed:`failed`,refused:`refused`},c_=e=>s_[e]??``;function l_(e){if(!e||typeof e.peer!=`string`||!e.peer)return``;let t=c_(e.state);if(!t)return``;let n=typeof e.label==`string`&&e.label.trim()?e.label.trim():`a job`;return[`sent to ${e.peer}: ${n}`,t,...o_(e.cost)].join(` · `)}function u_(e,t){if(!t?.length)return null;let n=new Map,r=0;for(let e of t){let t=e.cost?.usd;Z(t)?n.set(e.peer,(n.get(e.peer)??0)+t):r++}if(!n.size)return null;let i=[...n].map(([e,t])=>({peer:e,usd:t})),a=i.map(e=>`${x(e.usd)} on ${e.peer}`).join(` + `);return{text:`${Z(e)?`${x(e)} here + `:``}${a}${Z(e)?``:` (this desktop's share is not priced)`}${r?` · ${r} peer job${r===1?``:`s`} not priced`:``}`,peerUsd:i.reduce((e,t)=>e+t.usd,0),byPeer:i,unpriced:r}}function d_(e,t,n){if(!e?.length||!Number.isFinite(t)||!Number.isFinite(n)||n<=t)return null;let r=new Map,i=0;for(let a of e){let e=a.cost?.usd;if(!Z(e))continue;let o=Z(a.endedAt)?a.endedAt:null;o!=null&&a.since>=t&&o<=n?r.set(a.peer,(r.get(a.peer)??0)+e):a.since<n&&(o==null||o>t)&&i++}if(!r.size)return null;let a=[...r].map(([e,t])=>({peer:e,usd:t}));return{usd:a.reduce((e,t)=>e+t.usd,0),byPeer:a,straddling:i,text:`incl. ${a.map(e=>`${x(e.usd)} on ${e.peer}`).join(` + `)}`}}function f_(e){if(!e||typeof e.from!=`string`||!e.from)return``;let t=e=>typeof e==`string`?e.replace(/\s+/g,` `).trim().slice(0,80):``;return[`job from ${e.from}`,t(e.askerLabel),t(e.label)].filter(Boolean).join(` · `)}var p_={dark:{background:`#0b0d10`,foreground:`#d6dce5`},light:{background:`#fcfcfd`,foreground:`#1c2430`}},m_=`--bg.--panel.--sub.--raise.--well.--line.--pipe-bg.--fg.--muted.--dim.--ring.--accent.--ok.--dead.--warn.--star.--limit.--ask.--pair.--purple.--sched.--defer.--ctx-low.--fu-hand.--fu-launch.--fu-agent.--fu-host.--on-accent.--on-accent-strong.--on-accent-line.--on-dead.--on-ok.--on-limit.--on-star.--on-media.--accent-wash.--accent-tint.--accent-tint-hi.--accent-edge.--accent-edge-hi.--ok-wash.--ok-edge.--pick-fill.--pick-edge.--dead-wash.--dead-tint.--dead-edge.--dead-edge-hi.--warn-wash.--warn-tint.--warn-tint-hi.--warn-edge.--star-wash.--star-edge.--star-edge-hi.--limit-edge.--ask-wash.--ask-tint-hi.--ask-edge.--ctx-low-edge.--hover-soft.--hover.--hover-hi.--sheen.--panel-veil.--panel-veil-hi.--bg-veil.--float-edge.--scrim.--scrim-media.--scrim-label.--shadow.--shadow-soft.--media-bg.--paper.--chart-1.--chart-2.--chart-3.--chart-4.--ctx-series.--ctx-compact.--ctx-limit.--repo-veil.--repo-veil-on`.split(`.`),h_=[`--accent`,`--ok`,`--dead`,`--warn`,`--star`,`--limit`,`--ask`,`--pair`,`--fu-agent`],g_=new Set(m_),__=new Set(h_),v_=[`dark`,`light`],y_=[`favicon`,`apple-touch`,`192`,`512`,`maskable`],b_=new Set(y_),x_=/^(?:[A-Za-z0-9_][A-Za-z0-9._-]*\/)*[A-Za-z0-9_][A-Za-z0-9._-]*\.(?:png|svg)$/,S_=e=>typeof e==`string`&&e.length<=200&&x_.test(e)&&!e.split(`/`).some(e=>e===`.`||e===`..`),C_=(e,t,n)=>Math.min(n,Math.max(t,e));function w_(e,t,n){t=C_(t,0,100)/100,n=C_(n,0,100)/100,e=(e%360+360)%360;let r=t*Math.min(n,1-n),i=t=>(t+e/30)%12,a=e=>n-r*Math.max(-1,Math.min(i(e)-3,Math.min(9-i(e),1)));return[a(0),a(8),a(4)].map(e=>Math.round(e*255))}var T_=String.raw`[+-]?(?:\d+\.?\d*|\.\d+)`,E_=new RegExp(String.raw`^(rgba?|hsla?)\(\s*(${T_})(%?)(?:\s*,\s*|\s+)(${T_})(%?)(?:\s*,\s*|\s+)(${T_})(%?)(?:\s*(?:,|\/)\s*(${T_})(%?))?\s*\)$`,`i`);function Q(e){if(typeof e!=`string`)return null;let t=e.trim(),n=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t);if(n){let e=n[1];e.length<=4&&(e=[...e].map(e=>e+e).join(``));let t=t=>parseInt(e.slice(t,t+2),16);return{r:t(0),g:t(2),b:t(4),a:e.length===8?Math.round(t(6)/255*1e3)/1e3:1}}if(n=E_.exec(t),!n)return null;let r=n[1].toLowerCase(),i=n[8]===void 0?1:C_(Number(n[8])/(n[9]?100:1),0,1);if(r.startsWith(`rgb`)){let e=(e,t)=>Math.round(C_(t?Number(e)*255/100:Number(e),0,255));return{r:e(n[2],n[3]),g:e(n[4],n[5]),b:e(n[6],n[7]),a:i}}if(n[3]||!n[5]||!n[7])return null;let[a,o,s]=w_(Number(n[2]),Number(n[4]),Number(n[6]));return{r:a,g:o,b:s,a:i}}var D_=e=>e.toString(16).padStart(2,`0`),O_=e=>`#${D_(e.r)}${D_(e.g)}${D_(e.b)}`,k_=e=>e.a>=1?O_(e):`rgb(${e.r} ${e.g} ${e.b} / ${Math.round(e.a*1e3)/1e3})`,$=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function A_(e){let t=[],n={};if(!$(e))return e!=null&&t.push(`top level must be an object; nothing applied`),{overlay:n,notes:t};for(let n of Object.keys(e))n!==`displayName`&&n!==`colors`&&n!==`terminal`&&n!==`icons`&&!n.startsWith(`//`)&&t.push(`unknown key "${n}" ignored (allowed: displayName, colors, terminal, icons)`);if(e.displayName!==void 0){let r=typeof e.displayName==`string`?e.displayName.trim():``;!r||r.length>40||/[\u0000-\u001f\u007f]/.test(r)?t.push(`"displayName" must be 1–40 printable characters; ignored`):n.displayName=r}if(e.colors!==void 0){if(!$(e.colors))t.push(`"colors" must be an object of { dark, light }; ignored`);else for(let r of Object.keys(e.colors)){if(!v_.includes(r)){t.push(`"colors.${r}" ignored (allowed: dark, light)`);continue}let i=e.colors[r];if(!$(i)){t.push(`"colors.${r}" must be an object of token → colour; ignored`);continue}let a={};for(let[e,n]of Object.entries(i)){let i=e.startsWith(`--`)?e:`--${e}`;if(i===`--term-bg`){t.push(`"colors.${r}.${e}" ignored: set "terminal.${r}.background" instead (the grid and its frame are one colour)`);continue}if(!g_.has(i)){t.push(`"colors.${r}.${e}" ignored: not a colour token of this version`);continue}let o=Q(n);o?__.has(i)&&o.a<1?t.push(`"colors.${r}.${e}" ignored: must be opaque (its tints are derived from it)`):a[i]=k_(o):t.push(`"colors.${r}.${e}" ignored: ${JSON.stringify(n)} is not a colour (hex, rgb(), hsl())`)}Object.keys(a).length&&((n.colors??={})[r]=a)}}if(e.terminal!==void 0){if(!$(e.terminal))t.push(`"terminal" must be an object of { dark, light }; ignored`);else for(let r of Object.keys(e.terminal)){if(!v_.includes(r)){t.push(`"terminal.${r}" ignored (allowed: dark, light)`);continue}let i=e.terminal[r];if(!$(i)){t.push(`"terminal.${r}" must be an object of { background, foreground }; ignored`);continue}let a={};for(let[e,n]of Object.entries(i)){if(e!==`background`&&e!==`foreground`){t.push(`"terminal.${r}.${e}" ignored (allowed: background, foreground)`);continue}let i=Q(n);!i||i.a<1?t.push(`"terminal.${r}.${e}" ignored: ${JSON.stringify(n)} is not an opaque colour`):a[e]=O_(i)}Object.keys(a).length&&((n.terminal??={})[r]=a)}}if(e.icons!==void 0){if(!$(e.icons))t.push(`"icons" must be an object of slot → path; ignored`);else{let r={};for(let[n,i]of Object.entries(e.icons))b_.has(n)?S_(i)?r[n]=i:t.push(`"icons.${n}" ignored: ${JSON.stringify(i)} is not a .png/.svg path relative to the config dir`):t.push(`"icons.${n}" ignored (allowed: ${y_.join(`, `)})`);Object.keys(r).length&&(n.icons=r)}}return{overlay:n,notes:t}}var j_=e=>!e||e.displayName===void 0&&!e.colors&&!e.terminal&&!e.icons;function M_(e,t){let n=t?.terminal?.[e];return!n||!n.background&&!n.foreground?p_[e]:{...p_[e],...n}}function N_(e){if(!e)return``;let t=[];for(let n of v_){let r=[];for(let[t,i]of Object.entries(e.colors?.[n]??{})){if(!g_.has(t))continue;let e=Q(i);e&&(__.has(t)?r.push(`${t}-rgb: ${e.r} ${e.g} ${e.b};`):r.push(`${t}: ${k_(e)};`))}let i=e.terminal?.[n]?.background;if(i&&Q(i)&&r.push(`--term-bg: ${O_(Q(i))};`),!r.length)continue;let a=n===`light`?`html[data-theme="light"]`:`html:not([data-theme="light"])`;t.push(`${a} { ${r.join(` `)} }`)}return t.join(`
|
|
48
|
-
`)}function
|
|
46
|
+
`))}var um=new Set(`/usage./cost./stats./context./status./todos./help./release-notes./config./model./output-style./statusline./vim./terminal-setup./agents./mcp./hooks./permissions./sandbox./add-dir./resume./rewind./clear./export./memory./bashes./remote-control./ide./upgrade./bug./feedback./privacy-settings./login./logout./effort./fast./theme./color./keybindings./skills./plugin./version./diff./copy`.split(`.`));function dm(e){return um.has(e.trim().split(/\s+/)[0]??``)}var fm=new Set([`/btw`]);function pm(e){return fm.has(e.trim().split(/\s+/)[0]??``)}[k.stateDirName,...vr];function mm(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=`${e.name} ${e.cmd} ${e.dir??``} ${e.source}`.toLowerCase();return n.every(e=>t.includes(e))}):e}var hm={supported:!1,canInstall:!1,silent:!1};function gm(e){if(!e||typeof e!=`object`)return{};let t=e,n={};return(t.distribution===`dev`||t.distribution===`play`)&&(n.distribution=t.distribution),typeof t.self==`string`&&t.self&&(n.self=t.self),n}function q(e){return e.distribution===`play`}function _m(e,t){return q(t)&&!!e&&!!t.self&&e===t.self}var vm=`this build updates through Google Play — install the new version from the Play Store`,ym=`could not read which app this file is, and this build installs only an app it can name`;function bm(e){return`new builds of ${e} wait for a tap: this ${k.displayName} comes from Google Play, which does not let it install apps by themselves — every install asks`}var xm=`A build downloaded here installs with the phone's own confirm dialog, one tap each. This ${k.displayName} comes from Google Play, which does not let it install apps by themselves, and it updates itself only through Play.`;function Sm(e){let t=(e.name??``).toLowerCase(),n=(e.mime??``).toLowerCase();return t.endsWith(`.apk`)||n===`application/vnd.android.package-archive`}function Cm(e){return e.pkgLabel||e.pkg||e.name}function wm(e,t){return!!e.pkg&&t.includes(e.pkg)}function Tm(e,t){return t?e.includes(t)?e.filter(e=>e!==t):[...e,t]:[...e]}function Em(e,t){return!t.supported||!Sm(e)||e.state!==`done`?{verb:null,reason:null}:_m(e.pkg,t)?{verb:null,reason:vm}:q(t)&&!e.pkg?{verb:null,reason:ym}:e.evicted&&e.cleanedAt?{verb:null,reason:Im(e)}:e.evicted?{verb:null,reason:`the bytes were cleared to save space — fetch it again to install it`}:t.canInstall?e.install===`installing`?{verb:null,reason:null}:{verb:`install`,reason:null}:{verb:null,reason:`this phone has not allowed ${k.displayName} to install apps`,settings:!0}}function Dm(e,t,n,r){switch(e){case`installing`:return`installing…`;case`asked`:return`waiting for you to confirm it on this phone`;case`installed`:return`installed${r?` · ${n} ${r}`:``}`;case`failed`:return`could not install: ${Om(t)}`;default:return null}}function Om(e){if(!e)return`the phone did not say why`;if(/VERIFICATION_FAILURE/.test(e))return`Google Play Protect stopped it — it checks every app from outside the Play Store, and refused this build with nobody there to answer it. Retry with the phone in hand: if Play Protect asks, install anyway. If it refuses without asking, Play Store › Play Protect says why`;if(/Session was abandoned/i.test(e))return`the install was dropped before it finished — Android abandons one when the app is closed mid-install or the confirm dialog goes unanswered. A retry starts a fresh one`;let t=/allocate (\d+) because only (\d+) allocatable/i.exec(e);if(!t)return e;let n=e=>`${Math.ceil(e/1e6)} MB`,r=Number(t[1]),i=Number(t[2]),a=i>0?`only ${n(i)} of it is usable`:`none of it is usable yet`;return`this phone is out of space — it needs ${n(r)} beyond the room Android keeps in reserve (up to 500 MB), and ${a}. Free space until Settings shows about ${n(r+5e8-i)} free, then retry`}function km(e){return e===`failed`?`retry install`:e===`installed`?`install again`:`install`}function Am(e){return Dm(e.install,e.installError,Cm(e),e.pkgVersion)}function jm(e,t){let n=e.mtime;return!e.pkg||!e.pkgVersion||!n||!t.some(t=>t.pkg===e.pkg&&t.pkgVersion===e.pkgVersion&&!!t.mtime&&t.mtime<n)?null:`same version (${e.pkgVersion}) as an older build on this phone — its repo does not raise the version on every build, so once installed the two cannot be told apart. Ask the repo's agent to raise it on every build`}function Mm(e,t,n){if(!t.supported||!Sm(e)||!e.pkg)return null;let r=Cm(e);return _m(e.pkg,t)?vm:q(t)?bm(r):wm(e,n)?t.canInstall?t.silent?e.install===`installed`?`new builds of ${r} install by themselves`:`new builds of ${r} install by themselves — the first one asks once`:`new builds of ${r} install by themselves, and this Android asks every time`:`${r} would install itself once this phone allows it`:`new builds of ${r} wait for a tap`}function Nm(e,t,n){if(!t.supported||!Sm(e)||!e.pkg||q(t))return null;let r=wm(e,n);return{pkg:e.pkg,on:r,label:r?`stop installing ${Cm(e)} by itself`:`install ${Cm(e)} by itself`}}function Pm(e,t){if(!e.supported)return null;if(!e.canInstall)return`Allow ${k.displayName} to install apps and a build downloaded here can go straight onto this phone.`;if(q(e))return xm;if(!t.length)return`No app installs by itself yet — you can turn it on for an app, one at a time.`;let n=t.length;return n===1?`1 app installs itself when a new build arrives.`:`${n} apps install themselves when a new build arrives.`}function Fm(e){return e>=1e6?`${Math.round(e/1e6)} MB`:`${Math.max(1,Math.round(e/1e3))} kB`}function Im(e){let t=`APK deleted after it installed${e.cleanedBytes?` (${Fm(e.cleanedBytes)} freed)`:``} — fetch it again to reinstall`;return e.cleanNote?`${t} · ${e.cleanNote}`:t}`${k.stateDirName}`;var Lm=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Rm(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getDate()} ${Lm[t.getMonth()]} ${n(t.getHours())}:${n(t.getMinutes())}`}function zm(e){let t=e.sha?`${e.sha}${e.dirty?` + edits`:``}`:e.dirty?`uncommitted edits`:``;return[e.version??``,t,Rm(e.at)].filter(Boolean).join(` · `)}var Bm=/^[^\r\n]{1,200}$/,Vm=e=>typeof e==`string`&&Bm.test(e.trim())?e.trim():void 0;function Hm(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.at!=`number`||!Number.isFinite(t.at)||t.at<=0)return null;let n={at:t.at},r=Vm(t.version),i=Vm(t.sha);return r&&(n.version=r),i&&/^[0-9a-f]{4,40}$/i.test(i)&&(n.sha=i),t.dirty===!0&&(n.dirty=!0),n}var Um=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)&&Math.floor(e)>=20&&Math.floor(t)>=12,Wm=e=>Math.min(e,160),Gm=/\x1b\[[0-9;?]*[ -/]*[@-~]/y,Km=/[\n\r\u2028\u2029]/g;function qm(e){let t=``,n=0,r=-2,i=-2,a=-2,o=(e,t,n)=>e===-1||e>=t?e:n(t);for(let s=e.indexOf(`\x1B`);s>=0;s=e.indexOf(`\x1B`,s)){let c=e[s+1],l=-1;c===`[`?(Gm.lastIndex=s,Gm.test(e)&&(l=Gm.lastIndex)):c===`P`||c===`X`||c===`^`||c===`_`?(r=o(r,s+2,t=>e.indexOf(`\x1B\\`,t)),a=o(a,s+2,t=>(Km.lastIndex=t,Km.exec(e)?.index??-1)),r>=0&&(a<0||a>r)&&(l=r+2)):c===`]`&&(i=o(i,s+2,t=>e.indexOf(`\x07`,t)),i>=0&&(l=i+1)),l<0?s++:(t+=e.slice(n,s),n=s=l)}return n===0?e:t+e.slice(n)}var Jm=/^(?:\d+(?:\.\d+)?\s*(?:ms|s|m|h)\s*)+$/i,Ym=/\b(?:esc|ctrl\+|shift\+|tab)\b/i;function Xm(e,t=!1){let n=[],r=e=>e!==void 0&&/[A-Za-z'-]/.test(e),i=e=>e!==void 0&&/[A-Za-z]/.test(e),a=e=>e!==void 0&&/\s/.test(e),o=t=>{for(;r(e[t]);)t++;return t},s=t=>{for(;a(e[t]);)t++;return e[t]===`…`?t+1:e.startsWith(`...`,t)?t+3:-1},c=0;for(;c<e.length;){if(!r(e[c])){c++;continue}let l=o(c),u=c;for(;u<l&&!i(e[u]);)u++;let d=-1,f=l;if(l-u>=4&&e.endsWith(`ing`,l)){if(!t)d=s(l);else for(let t=0;t<3&&d<0;t++){let t=f;for(;a(e[t]);)t++;if(t===f||!i(e[t]))break;f=o(t),d=s(f)}}d<0?c=l:(n.push(e.slice(u,f)),c=d)}return n}var Zm=/^[▰▱▬█▓░▒⣿⠿\s]*[▰▱▬█▓░▒⣿⠿]{4,}[\s]*(\d{1,3})\s?%$/,Qm=/^\s*[◯◉○●◎⏺]\s+[A-Za-z][\w:-]*\s{2,}\S/;function $m(e){let t=e.lastIndexOf(`·`);return t>=0&&/(?:^|\s)\d+(?:\.\d+)?\s*[smh]\s+$/i.test(e.slice(0,t))&&/^\s+[↓↑]\s*[\d.,]+(?:\s*[km])?\s+tokens?\s*$/i.test(e.slice(t+1))}function eh(e){if(!e)return null;let t=qm(e).split(/[\r\n]+/),n=e=>(e??``).replace(/[│┃|╭╮╰╯─]/g,` `).replace(/\s+/g,` `).trim(),r=null;for(let e=t.length-1;e>=0;e--){if(Qm.test(t[e]??``)||$m(t[e]??``))continue;let i=n(t[e]);if(!i)continue;let a=[...i.matchAll(/\(([^()]*)\)/g)],o=a[a.length-1],s=o?i.slice(0,o.index):i,c=null,l=null,u=[];for(let e of(o?.[1]??``).split(`·`)){let t=e.trim();t&&!Ym.test(t)&&(!c&&Jm.test(t)?c=t:!l&&/tokens?\b/i.test(t)?l=t:u.push(t))}let d=Zm.exec(n(t[e+1]))?.[1]??Zm.exec(i.slice(i.search(/[▰▱▬█▓░▒⣿⠿]/)<0?i.length:i.search(/[▰▱▬█▓░▒⣿⠿]/)))?.[1]??null;d&&u.push(`${d}%`);let f=Xm(s),p=f.length||!(c||l||d)?[]:Xm(s,!0),m=f[f.length-1]??p[p.length-1];if(!m)continue;let h=`${m}…`;if(!c&&!l&&!d){r??={phrase:h,elapsed:null,tokens:null,extra:[],text:h};continue}let g=[h,l,...u].filter(Boolean).join(` · `);return{phrase:h,elapsed:c,tokens:l,extra:u,text:g.length>140?`${g.slice(0,139)}…`:g}}return r}var th=/\bto scroll\b/i;function nh(e){return e?th.test(qm(e).slice(-2e3)):!1}function rh(e){if(e===`shift+tab`)return`\x1B[Z`;if(e===`ctrl+c`||e===`ctrl+g`)return null;let t=/^ctrl\+([a-z])$/.exec(e);return t?String.fromCharCode(t[1].charCodeAt(0)-96):/^[a-z0-9]$/.test(e)?e:null}function ih(e){if(e===`shift+tab`)return`⇧Tab`;let t=/^ctrl\+([a-z])$/.exec(e);return t?`^${t[1].toUpperCase()}`:e}var ah={up:`A`,down:`B`,right:`C`,left:`D`,home:`H`,end:`F`},oh={pgup:`5`,pgdn:`6`,delete:`3`},sh={tab:` `,enter:`\r`,esc:`\x1B`,backspace:``,space:` `,up:`\x1B[A`,down:`\x1B[B`,right:`\x1B[C`,left:`\x1B[D`,home:`\x1B[H`,end:`\x1B[F`,pgup:`\x1B[5~`,pgdn:`\x1B[6~`,delete:`\x1B[3~`},ch={"[":`\x1B`,"\\":``,"]":``,"^":``,_:``,"?":``,"@":`\0`," ":`\0`};function lh(e,t){return[e.ctrl&&`ctrl`,e.alt&&`alt`,e.shift&&`shift`,t===` `?`space`:t].filter(Boolean).join(`+`)}function uh(e){return!!(e.ctrl||e.alt||e.shift)}function dh(e,t){let n=lh(e,t),r=e=>({refused:`${n} has no terminal bytes — ${e}`});if(!t)return r(`no key`);if(t in ah||t in oh){if(!uh(e))return{bytes:sh[t]};let n=1+ +!!e.shift+(e.alt?2:0)+(e.ctrl?4:0);return{bytes:t in ah?`\x1b[1;${n}${ah[t]}`:`\x1b[${oh[t]};${n}~`}}if(e.alt){let n=dh({ctrl:e.ctrl,shift:e.shift},t);return`bytes`in n?{bytes:`\x1b${n.bytes}`}:r(`refused`in n?n.refused.replace(/^.*? — /,``):``)}let i=t===`space`?` `:t;if(e.ctrl){if(e.shift&&t!==`tab`)return r(`a plain terminal sends the same byte as without shift`);if(t===`tab`)return r(`terminals send Tab for it`);if(t===`enter`)return r(`terminals send Return for it`);if(t===`backspace`)return{bytes:`\b`};if(t===`esc`)return r(`terminals send Esc for it`);if(i.length===1){let e=i.toLowerCase();if(/^[a-z]$/.test(e))return{bytes:String.fromCharCode(e.charCodeAt(0)-96)};if(i in ch)return{bytes:ch[i]};if(i===`-`)return{bytes:``}}return r(`ctrl combines only with a letter or [ \\ ] ^ _ ? @ space`)}return e.shift?t===`tab`?{bytes:`\x1B[Z`}:t===`enter`?r(`terminals send Return for it; Alt+Return is claude's newline`):t===`space`?{bytes:` `}:t in sh?{bytes:sh[t]}:i.length===1?{bytes:i.toUpperCase()}:r(`unknown key`):t in sh?{bytes:sh[t]}:i.length===1?{bytes:i}:r(`unknown key`)}var fh=16e3;fh*2;function ph(e,t=fh){let n=e.length*2,r=new ArrayBuffer(44+n),i=new DataView(r),a=(e,t)=>{for(let n=0;n<t.length;n++)i.setUint8(e+n,t.charCodeAt(n))};return a(0,`RIFF`),i.setUint32(4,36+n,!0),a(8,`WAVE`),a(12,`fmt `),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),a(36,`data`),i.setUint32(40,n,!0),new Int16Array(r,44).set(e),new Uint8Array(r)}function mh(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n++){let r=Math.max(-1,Math.min(1,e[n]));t[n]=r<0?r*32768:r*32767}return t}var hh=.25,gh=new Set(`af.am.ar.as.az.ba.be.bg.bn.bo.br.bs.ca.cs.cy.da.de.el.en.es.et.eu.fa.fi.fo.fr.gl.gu.ha.haw.he.hi.hr.ht.hu.hy.id.is.it.ja.jw.ka.kk.km.kn.ko.la.lb.ln.lo.lt.lv.mg.mi.mk.ml.mn.mr.ms.mt.my.ne.nl.nn.no.oc.pa.pl.ps.pt.ro.ru.sa.sd.si.sk.sl.sn.so.sq.sr.su.sv.sw.ta.te.tg.th.tk.tl.tr.tt.uk.ur.uz.vi.yi.yo.yue.zh`.split(`.`)),_h={nb:`no`,jv:`jw`,iw:`he`,in:`id`,ji:`yi`,fil:`tl`,cmn:`zh`,mo:`ro`};function vh(e){let t=(e||``).trim().toLowerCase();if(!t||t===`auto`)return`auto`;let n=t.split(/[-_]/)[0],r=_h[n]||n;return gh.has(r)?r:`auto`}var yh=`auto`,bh={en:`English`,de:`German`,fr:`French`,es:`Spanish`,it:`Italian`,nl:`Dutch`,pt:`Portuguese`,pl:`Polish`,ru:`Russian`,uk:`Ukrainian`,cs:`Czech`,sv:`Swedish`,da:`Danish`,no:`Norwegian`,fi:`Finnish`,tr:`Turkish`,el:`Greek`,he:`Hebrew`,ar:`Arabic`,hi:`Hindi`,ja:`Japanese`,ko:`Korean`,zh:`Chinese`},xh=[`en`,`de`];function Sh(e){return e===`auto`?`auto — whichever is spoken`:bh[e]||e}function Ch(e){return e===`auto`?`auto`:e.toUpperCase()}function wh(e){return e===`auto`?`dictation is read as whichever language is spoken — pick one to pin it`:`dictation is read as ${Sh(e)} — anything else spoken is TRANSLATED into it`}function Th(e){let t=Object.keys(bh).filter(e=>!xh.includes(e)),n=[yh,...xh,...t],r=vh(e);return r!==`auto`&&!n.includes(r)&&n.push(r),n.map(e=>({code:e,label:Sh(e)}))}var Eh=[yh,`en`,`de`];function Dh(e,t,n){let r=Th(n),i=new Set(r.map(e=>e.code)),a=new Set((e||[]).map(e=>{let t=vh(e);return t===`auto`&&e.trim().toLowerCase()!==`auto`?``:t}).filter(e=>i.has(e)));if(!a.size)for(let e of Eh)i.has(e)&&a.add(e);let o=vh(t);return i.has(o)&&a.add(o),r.filter(e=>a.has(e.code))}function Oh(e,t){let n=t.trim();if(!n)return e;let r=e.trimEnd();return r?`${r} ${n}`:n}var kh=e=>e.replace(/\s+/g,` `).trim().slice(0,40).trim();function Ah(e){let t=[],n=new Map;for(let r of String(e||``).split(/\r?\n/)){let e=r.trim();if(!e||e.startsWith(`#`))continue;let i=e.indexOf(`:`),a=kh(i<0?e:e.slice(0,i));if(!a)continue;let o=i<0?[]:e.slice(i+1).split(`,`).map(kh).filter(Boolean),s=a.toLowerCase(),c=n.get(s);if(!c){if(t.length>=60)continue;c={term:a,heard:[]},n.set(s,c),t.push(c)}for(let e of o){if(c.heard.length>=8)break;e.toLowerCase()!==s&&(c.heard.some(t=>t.toLowerCase()===e.toLowerCase())||c.heard.push(e))}}return t}function jh(e){let t=String(e||``).split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`#`)),n=new Set(t.map(e=>kh(e.split(`:`)[0]).toLowerCase()).filter(Boolean));return Math.max(0,n.size-Ah(e).length)}function Mh(e){return e.map(e=>e.heard.length?`${e.term}: ${e.heard.join(`, `)}`:e.term).join(`
|
|
47
|
+
`)}var Nh=`\\p{L}\\p{N}`,Ph=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function Fh(e){return e.length>=3&&/^\S+$/.test(e)&&(/\p{N}/u.test(e)||/\p{Lu}/u.test(e.slice(1)))}function Ih(e,t){if(!e||!t.length)return e;let n=[];for(let e of t){for(let t of e.heard){let r=t.split(` `).map(Ph).join(`[\\s\\-]+`);n.push({re:RegExp(`(?<![${Nh}])${r}(?![${Nh}])`,`giu`),term:e.term,keep:()=>!1,len:t.length})}if(/^\S+$/.test(e.term)&&e.term.length>=2&&e.term.length<=16){let t=Array.from(e.term).map(Ph).join(`[\\s.\\-]?`),r=Fh(e.term);n.push({re:RegExp(`(?<![${Nh}])${t}(?![${Nh}])`,`giu`),term:e.term,keep:t=>t===e.term||!/[\s.\-]/.test(t)&&!r,len:e.term.length})}}n.sort((e,t)=>t.len-e.len);let r=e;for(let e of n)r=r.replace(e.re,t=>e.keep(t)?t:e.term);return r}var Lh=`tools/repohealth.mjs`,Rh=`the repo-health engine`,zh=yr(`repohealth.jsonl`),Bh=br(`health.json`);function Vh(e){return!e||typeof e.hasRepoHealth!=`boolean`?`unknown`:e.hasRepoHealth?`offered`:`absent`}function Hh(e){return e===`absent`?`No repo-health engine on this desktop — neither this repo's own ${Lh} nor a bundled one was found, so there is nothing to read the history with.`:e===`unknown`?`This desktop is older than repo health and cannot say whether this repo has it.`:null}function Uh(e){return!e||!(`plot`in e)||e.plot===void 0?`unknown`:e.plot===null?`none`:`plotted`}function Wh(e,t){return e===`none`?typeof t==`string`&&t.length>0?t:`${Rh} read no series to plot here — refresh it to measure one.`:e===`unknown`?`This desktop is older than the repo-health plot and sent no series to draw.`:null}var Gh=e=>typeof e==`string`&&e.length>0;function Kh(e){return e&&Gh(e.recut)?e.recut:null}var J=[`size`,`retouch`,`hatches`,`context`,`untested`],qh={lineMean:500,max:1e3,retouch:.15,hatches:2,untested:.2},Jh=16e3,Yh=e=>typeof e==`number`&&Number.isFinite(e)&&e>0,Y=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function Xh(e,t){return e<=0?100:100*Math.min(1,t/e)}function Zh(e){if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let t=Date.parse(`${e}T00:00:00Z`);if(!Number.isFinite(t)||new Date(t).toISOString().slice(0,10)!==e)return null;let n=(new Date(t).getUTCDay()+6)%7;return new Date(t-n*864e5).toISOString().slice(0,10)}function Qh(e){let t=new Map;for(let n of e){if(!n||typeof n.ts!=`number`)continue;let e=Zh(n.day);if(!e)continue;let r=t.get(e);(!r||n.ts>=r.ts)&&t.set(e,n)}return[...t.entries()].sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>({week:e,row:t}))}function $h(e){return 1*(Yh(e)?e:Jh)}function eg(e){let t={},n,r=e.size?.value;r&&Y(r.max)&&(n={value:r.max,path:typeof r.maxPath==`string`&&r.maxPath?r.maxPath:null}),r&&Y(r.lineMean)&&n&&(t.size=r.lineMean);let i=e.retouch?.value?.rate;Y(i)&&(t.retouch=i);let a=e.hatches,o=e.classics?.value?.loc;if(a?.value&&typeof a.value==`object`&&Yh(o)){let e=0,n=!0;if(a.split&&typeof a.split==`object`)Y(a.split.unexplained)?e=a.split.unexplained:n=!1;else for(let t of Object.values(a.value)){if(!Y(t)){n=!1;break}e+=t}n&&(t.hatches=e/(o/1e3))}let s=e.context?.value,c=s?.claudeMdChars,l=s?.descChars;!s&&e.context?.reason===`no CLAUDE.md at this commit`?t.context=0:Y(c)&&(l==null||Y(l))&&(t.context=c+(typeof l==`number`?l:0));let u=e.untested?.value,d=e.classics?.value?.files;Array.isArray(u)&&Yh(d)&&u.length<=d&&(t.untested=u.length/d);let f=ng(e);for(let e of f.disabled)delete t[e],e===`size`&&(n=void 0);for(let r of f.overridden){delete t[r];let i=e.central?.override?.[r]?.value;Y(i)&&(r!==`size`||n)&&(t[r]=i)}return t.size===void 0&&(n=void 0),n?{values:t,max:n}:{values:t}}var tg=e=>J.includes(e);function ng(e){let t=e.central;if(!t||typeof t!=`object`)return{fp:``,disabled:[],overridden:[]};let n=typeof t.fp==`string`?t.fp:``,r=e=>e&&typeof e==`object`?Object.keys(e).filter(tg):[],i=J.filter(e=>r(t.disabled).includes(e));return{fp:n,disabled:i,overridden:J.filter(e=>r(t.override).includes(e)&&!i.includes(e))}}var rg=864e5;function ig(e){let t=e.classics?.value;return t&&Y(t.files)&&Y(t.loc)?{files:t.files,loc:t.loc}:null}var ag=(e,t)=>Math.round((Date.parse(`${t}T00:00:00Z`)-Date.parse(`${e}T00:00:00Z`))/rg),X=e=>Math.round(e).toString().replace(/\B(?=(\d{3})+(?!\d))/g,`,`),og=e=>`${Math.round(e*100)}%`,sg=e=>(Math.round(e*10)/10).toFixed(1),cg={size:`file length`,retouch:`re-touches`,hatches:`escape hatches`,context:`CLAUDE.md + skill descriptions`,untested:`untested modules`};function lg(e,t,n,r,i){return`${e}: ${(()=>{switch(t){case`max`:return`${i??`the longest file`} is ${X(n)} lines (good: under ${X(r)})`;case`lineMean`:return`the average line sits in a file of ${X(n)} lines (good: under ${X(r)})`;case`retouch`:return`${og(n)} of recent file edits rework the edit before (good: under ${og(r)})`;case`hatches`:return`${sg(n)} unexplained escape hatches per 1,000 lines (good: under ${sg(r)})`;case`context`:return`CLAUDE.md + skill descriptions are ${X(n)} chars (good: under ${X(r)})`;case`untested`:return`${og(n)} of source files have no test reaching them (good: under ${og(r)})`}})()}`}function ug(e,t,n,r,i){let a=Xh(n,r);if(!(a<50))return null;let o=a<25?`severe`:`warn`,s=i??void 0;return{level:o,entry:e,subject:t,value:n,good:r,score:a,...s?{path:s}:{},text:lg(o,t,n,r,s)}}function dg(e){if(!e.cappedBy||!(e.value<e.mean))return null;let t=Math.round(e.value-30);return`Capped at ${Math.round(e.value)} by ${Gf(cg,e.cappedBy,`an entry this app version cannot name`)} (${t} of 100): the entries average ${Math.round(e.mean)}, and the score stays within 30 of its worst entry.`}function fg(e,t,n){let r=J.filter(e=>!t.includes(e));if(r.length===0||r.some(t=>e.values[t]===void 0))return null;let i=$h(n),a={},o=null,s=[];for(let t of r){let n=e.values[t];if(t===`size`){let t=e.max;o={lineMean:{value:n,score:Xh(n,qh.lineMean)},max:{value:t.value,score:Xh(t.value,qh.max),path:t.path}},a.size=Math.sqrt(o.lineMean.score*o.max.score);let r=ug(`size`,`lineMean`,n,qh.lineMean),i=ug(`size`,`max`,t.value,qh.max,t.path);r&&s.push(r),i&&s.push(i);continue}let r=t===`context`?i:qh[t];a[t]=Xh(n,r);let c=ug(t,t,n,r);c&&s.push(c)}let c=r.length,l=Math.exp(r.reduce((e,t)=>e+Math.log(a[t]),0)/c),u=r[0];for(let e of r)a[e]<a[u]&&(u=e);let d=a[u]+30,f=Math.min(l,d);return s.sort((e,t)=>e.score-t.score),{index:f,mean:l,scores:a,sizeParts:o,cappedBy:d<l?u:null,alerts:s,enabled:r}}function pg(e,t){let n=[];for(let{week:r,row:i}of Qh(e)){let e=ng(i),a=eg(i),o=fg(a,e.disabled,t);if(!o)continue;let s=typeof i.prereg==`string`?i.prereg:null,c=n[n.length-1],l={week:r,index:o.index,mean:o.mean,scores:o.scores,sizeParts:o.sizeParts,cappedBy:o.cappedBy,alerts:o.alerts,values:a.values,prereg:s,central:e.fp,disabled:e.disabled,overridden:e.overridden,tree:ig(i)};if(!c){n.push({...l,gap:!1,lnLink:null,comparable:0,contributions:{},spanDays:null});continue}let u=ag(c.week,r),d=c.prereg===s?c.central===e.fp?null:`central`:`prereg`;if(d){n.push({...l,gap:!0,lnLink:null,comparable:0,contributions:{},spanDays:u,gapReason:d});continue}let f=o.enabled.length,p={};for(let e of o.enabled){let t=c.scores[e],n=o.scores[e];t!==void 0&&n!==void 0&&(p[e]=c.mean*(Math.log(n)-Math.log(t))/f)}n.push({...l,gap:!1,lnLink:Math.log(o.index/c.index),comparable:f,contributions:p,spanDays:u})}return n.length===0?null:{baselineWeek:n[0].week,points:n}}function mg(e,t){let n=fg(eg(e),ng(e).disabled,t);return n?{index:n.index,mean:n.mean,scores:n.scores,cappedBy:n.cappedBy}:null}function hg(e,t){if(e.length<=t)return[...e];let n=new Set,r=new Map;e.forEach((e,t)=>r.set(e.week,t));for(let e of r.values())n.add(e);let i=Math.ceil(e.length/Math.max(1,t));for(let t=0;t<e.length;t+=i){let r=t,a=t,o=Math.min(e.length,t+i);for(let n=t;n<o;n++)e[n].index<e[r].index&&(r=n),e[n].index>e[a].index&&(a=n);n.add(r),n.add(a)}return[...n].sort((e,t)=>e-t).map(t=>e[t])}function gg(e,t,n=240){let r=e.filter(e=>e&&typeof e.ts==`number`).sort((e,t)=>e.ts-t.ts),i=[],a=null;for(let e of r){let n=Zh(e.day),r=n?mg(e,t):null;if(!n||!r)continue;let o=typeof e.prereg==`string`?e.prereg:null,s=ng(e).fp;i.push({sha7:typeof e.sha==`string`?e.sha.slice(0,7):``,day:e.day,ts:e.ts,week:n,index:r.index,mean:r.mean,cappedBy:r.cappedBy,gap:a!==null&&(a.prereg!==o||a.central!==s)}),a={prereg:o,central:s}}if(i.length===0)return null;let o=hg(i,n);return{points:o,total:i.length,thinned:o.length<i.length}}function _g(e){return!e||e.commits===void 0?`absent`:e.commits&&e.commits.points.length>0?`present`:`none`}function vg(e,t=12,n=e.length-1){let r=e[n];if(!r||!(t>0)||!Number.isFinite(r.index))return null;let i=Date.parse(`${r.week}T00:00:00Z`),a=i-t*7*rg;for(let t=n-1;t>=0;t--){let n=Date.parse(`${e[t].week}T00:00:00Z`);if(n>a)continue;let o=e[t];return o.index>0?{ratio:r.index/o.index,delta:r.index-o.index,then:o,now:r,weeks:Math.round((i-n)/(7*rg))}:null}return null}function yg(e,t){let n=[...e].sort((e,t)=>e-t),r=t/100*(n.length-1),i=Math.floor(r),a=Math.ceil(r);return n[i]+(n[a]-n[i])*(r-i)}function bg(e,t={}){let n=t.minWeeks??8,r=t.minMonthWindows??4,i=t.lowPct??10,a=t.highPct??90,o=t.minPoints??2,s=(e,t=null,n=null)=>({kind:null,horizon:t,delta:n,reason:e}),c=e[e.length-1];if(!c)return s(`no index yet`);let l=e.filter(e=>e.lnLink!==null);if(l.length<n)return s(`${l.length} weekly link${l.length===1?``:`s`} so far; a move is called after ${n}`);if(c.lnLink!==null){let t=l.slice(0,-1).map(e=>e.lnLink),n=e[e.length-2].index,r=c.index-n;if(c.lnLink<yg(t,i)&&-r>=o)return{kind:`drop`,horizon:`week`,delta:r,reason:`the latest week's link sits below the ${i}th percentile of ${t.length} earlier weeks`};if(c.lnLink>yg(t,a)&&r>=o)return{kind:`rise`,horizon:`week`,delta:r,reason:`the latest week's link sits above the ${a}th percentile of ${t.length} earlier weeks`}}let u=e.length-1;if(u<4)return s(`too few weeks for a four-week reading`);let d=t=>{for(let n=t-4+1;n<=t;n++)if(e[n].gap)return!0;return!1};if(d(u))return s(`the last four weeks span a change of definition, so there is no month move to compare`);let f=[];for(let t=4;t<u;t++)d(t)||f.push(Math.log(e[t].index/e[t-4].index));let p=c.index-e[u-4].index;if(f.length<r)return s(`${f.length} earlier four-week window${f.length===1?``:`s`}; a month move is called after ${r}`);let m=Math.log(c.index/e[u-4].index);return m<yg(f,i)&&-p>=o?{kind:`drop`,horizon:`month`,delta:p,reason:`the last four weeks sit below the ${i}th percentile of ${f.length} earlier four-week windows`}:m>yg(f,a)&&p>=o?{kind:`rise`,horizon:`month`,delta:p,reason:`the last four weeks sit above the ${a}th percentile of ${f.length} earlier four-week windows`}:s(`within this repo's usual range`,null,c.lnLink===null?null:c.index-e[u-1].index)}var xg={size:[`files grew longer`,`files got shorter`],retouch:[`more re-touched files`,`fewer re-touched files`],hatches:[`more escape hatches`,`fewer escape hatches`],context:[`CLAUDE.md + skill descriptions grew`,`CLAUDE.md + skill descriptions shrank`],untested:[`more untested modules`,`fewer untested modules`]};function Sg(e){let t=Math.round(e);return t===0?`±0`:t<0?`−${-t}`:`+${t}`}function Cg(e,t){return t&&e===t?`this week`:`in the week of ${e}`}function wg(e,t,n){let r=e[e.length-1];if(!r||!t.kind||!t.horizon||t.delta===null)return null;let i=Math.round(r.index),a=t.horizon===`week`?1:4,o=n&&r.week===n,s=t.horizon===`week`?Cg(r.week,n):o?`over four weeks`:`over the four weeks to ${r.week}`,c={},l=0,u=null,d=null,f=null,p=0;for(let t=Math.max(1,e.length-a);t<e.length;t++){let n=e[t],r=e[t-1];if(n.gap)continue;let i=Math.log(n.mean/r.mean),a=Math.abs(i)<1e-12?1:Math.expm1(i)/i;for(let e of J){let t=n.contributions[e];t!==void 0&&(c[e]=(c[e]??0)+t*a)}let o=n.index-r.index-(n.mean-r.mean);l+=o;let s=o>0?r.cappedBy:n.cappedBy;s&&Math.abs(o)>p&&(p=Math.abs(o),u=s,d=r.cappedBy,f=n.cappedBy)}let m=t.kind===`drop`?-1:1,h=J.filter(e=>(c[e]??0)*m>0).map(e=>({pts:c[e]??0,words:xg[e][t.kind===`drop`?0:1]}));if(u&&l*m>0){let e=cg[u],t=m>0?f===u?`${e} holds the score down less`:`${e} no longer holds the score down`:d===u?`${e} holds the score down more`:`${e} now holds the score down`;h.push({pts:l,words:t})}let g=h.filter(e=>Math.round(e.pts)!==0).sort((e,t)=>Math.abs(t.pts)-Math.abs(e.pts)).slice(0,2).map(e=>`${e.words} (${Sg(e.pts)})`),_=t.kind===`rise`?Dg(e,a,(c.size??0)+(u===`size`?l:0),t.delta):null,ee=t.kind===`drop`?`slipped`:`rose`,te=Math.abs(Math.round(t.delta)),ne=g.length?`The score ${ee} ${te} point${te===1?``:`s`} ${s}: ${g.join(`, `)}.`:`The score ${ee} ${te} point${te===1?``:`s`} ${s}.`;return{chip:`Health ${i} ${Sg(t.delta)}`,title:`Health score ${i} (${Sg(t.delta)} ${s})`,body:_?`${ne} ${_}`:ne}}var Tg=e=>Math.round(e).toString().replace(/\B(?=(\d{3})+(?!\d))/g,`,`),Eg=1.5;function Dg(e,t,n,r){if(!(r>0)||n<r/2)return null;let i=e[Math.max(0,e.length-t-1)]?.tree,a=e[e.length-1]?.tree;return!i||!a||i.files<=0||i.loc<=0||a.files<i.files*Eg||a.loc<i.loc*.9?null:`Mostly files split up: ${Tg(i.files)} → ${Tg(a.files)} source files while the code went from ${Tg(i.loc)} to ${Tg(a.loc)} lines. The score cannot tell whether the design got better.`}function Og(e,t){let n=e?.points,r=n?.[n.length-1];if(!n||!r)return null;let i=n[n.length-2];return{value:r.index,deltaWeek:r.lnLink!==null&&i?r.index-i.index:null,week:r.week,move:t?.kind??null,mean:r.mean,cappedBy:r.cappedBy,alert:r.alerts[0]?.level??null,alertText:r.alerts[0]?.text??null}}var kg=[`requested`,`shipped`,`superseded`,`dropped`];function Ag(e){let t=e.trim(),n=/^\d{4}-\d{2}-\d{2}/.exec(t)?.[0]??null,r=/session ([0-9a-f]{8})/.exec(t)?.[1]??null,i=t.indexOf(`(`),a=i<0?-1:t.indexOf(`)`,i+1),o=a<0?null:t.slice(i+1,a).trim();return{date:n,session:r,note:o&&!r?o:!n&&/^[0-9a-f]{8}$/.test(t)?t:null}}function jg(e,t){if(!e||!t)return 0;let n=e.split(`.`).map(e=>parseInt(e,10)||0),r=t.split(`.`).map(e=>parseInt(e,10)||0);for(let e=0;e<Math.max(n.length,r.length);e++){let t=(n[e]??0)-(r[e]??0);if(t)return t>0?1:-1}return 0}function Mg(e,t){return!e||!t?null:jg(t,e)>0?{running:e,installed:t}:null}function Ng(e,t){let n=`This session runs Claude ${e.running}; ${e.installed} is installed.`;if(!t.resumeId)return{text:n,cant:`its conversation id is not known yet, so a restart could not reopen the same conversation`};let r=[];t.turnActive&&r.push(`the turn that is running`);let i=t.agents??0;return i>0&&r.push(i===1?`1 background agent`:`${i} background agents`),t.shells&&r.push(`the background shells`),r.length?{text:n,loses:r.join(` and `)}:{text:n}}function Pg(e){return{title:`Restart on Claude ${e.installed} first?`,lines:[`This session still runs Claude ${e.running}; ${e.installed} is installed.`,`Restart, then send: the same conversation reopens on ${e.installed} and this message is its first prompt.`,`Send on ${e.running}: the message goes now and the bar above stays — this is not asked again for this version.`],confirmLabel:`Restart, then send`,cancelLabel:`Send on ${e.running}`}}var Fg=6e5;function Ig(e,t,n=Fg){return e.cpuMovedAt===void 0&&e.outputAt===void 0?`unknown`:e.workers===0?`waiting`:t-Math.max(e.cpuMovedAt??0,e.outputAt??0)<n?`working`:`quiet`}function Lg(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?r>0?`${n}d ${r}h`:`${n}d`:r>0?i>0?`${r}h ${i}m`:`${r}h`:i>0?`${i}m`:`${a}s`}var Rg=/pgrep\s+-f\s+(?:"([^"]*)"|'([^']*)')/g,zg=/[$^.*+?()[\]{}|\\]/;function Bg(e){Rg.lastIndex=0;let t;for(;t=Rg.exec(e);){let e=t[1]??t[2]??``;if(e&&!zg.test(e))return e}return null}function Vg(e,t){if(e.foreground)return`a command this turn is running`;let n=Lg(t-e.startedAt);if(e.serverLike)return`long-running by design · ${n}`;if(e.selfMatch){let t=Bg(e.command);if(t)return`waits for "${t}" to end — its own command line matches that pattern, so this never ends`}let r=Ig(e,t);return r===`unknown`?`can't tell yet`:r===`working`?`running · ${n} · CPU moved ${Lg(t-Math.max(e.cpuMovedAt??0,e.outputAt??0))} ago`:r===`waiting`?`waiting in a loop · ${n} · only sleeps between checks`:`quiet ${n} · no CPU and no output`}function Hg(e,t,n=Fg){let r={working:0,waiting:0,quiet:0,unknown:0,foreground:0,total:0};for(let i of e)i.foreground?r.foreground++:(r[Ig(i,t,n)]++,r.total++);return r}function Ug(e){let t=e.total===1?`shell`:`shells`,n=`${e.total} ${t}`;if(!e.total)return n;let r=[`quiet`,`waiting`,`unknown`,`working`].find(t=>e[t]>0);if(!r)return n;let i=r===`working`?`running`:r;return e.total===1?`${n} · ${i}`:`${n} · ${e[r]} ${i}`}function Wg(e){return e.description?e.description:e.command.trim().split(/\s+/).slice(0,3).join(` `)||`shell`}function Gg(e,t){if(!e.total)return``;let n=[],r=0;for(let e of t)e.foreground||(e.workers===0?r++:n.push(Wg(e)));r&&n.push(r===1?`1 wait loop`:`${r} wait loops`);let i=e.total===1?`background shell`:`background shells`;return`stops ${e.total} ${i}${n.length?` — ${n.join(`, `)}`:``}`}function Kg(e){let t=new Set(e.map(e=>e.id)),n=new Map;for(let r of e){if(!r.companionOf||r.companionOf===r.id||!t.has(r.companionOf))continue;let e=n.get(r.companionOf);e?e.push(r):n.set(r.companionOf,[r])}if(!n.size)return[...e];let r=new Set([...n.values()].flat().map(e=>e.id)),i=[],a=e=>{i.push(e);for(let t of n.get(e.id)??[])a(t)};for(let t of e)r.has(t.id)||a(t);if(i.length<e.length)for(let t of e)i.includes(t)||i.push(t);return i}function qg(e,t){if(e.companionOf){let n=t.find(t=>t.id===e.companionOf);return n?{target:n,to:`cli`}:null}let n=t.filter(t=>t.companionOf===e.id);return n.length?{target:n.reduce((e,t)=>(t.createdAt??0)>(e.createdAt??0)?t:e),to:`shell`}:null}var Jg=j(`brand.migratedFrom`);function Yg(e){for(let t of A)if(t.storagePrefix!==k.storagePrefix&&e.startsWith(t.storagePrefix))return k.storagePrefix+e.slice(t.storagePrefix.length);return null}function Xg(e,t){if(e.getItem(Jg)!==null)return{ran:!1,copied:[],kept:[]};let n=[];for(let t=0;t<e.length;t++){let r=e.key(t);r!==null&&n.push(r)}let r=[],i=[];for(let t of A)if(t.storagePrefix!==k.storagePrefix)for(let a of n){if(!a.startsWith(t.storagePrefix))continue;let n=k.storagePrefix+a.slice(t.storagePrefix.length);if(e.getItem(n)!==null){i.push(a);continue}let o=e.getItem(a);o!==null&&(e.setItem(n,o),r.push([a,n]))}let a={from:A.map(e=>e.slug),at:t};return e.setItem(Jg,JSON.stringify(a)),{ran:!0,copied:r,kept:i}}`${k.slug}`;var Zg=/^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$/;function Qg(e){if(typeof e!=`string`||!e.trim())return`no address given`;let t=/^([^:/\s]+):(\d{1,5})$/.exec(e.trim());if(!t)return`write the address as host:port`;let n=Number(t[2]);if(n<1||n>65535)return`the port must be 1-65535`;let r=t[1].toLowerCase(),i=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(r);if(i){let e=i.slice(1).map(Number);return e.some(e=>e>255)||i.slice(1).some(e=>e.length>1&&e.startsWith(`0`))?`not a valid IPv4 address`:e[0]===127&&e[1]===0&&e[2]===0&&e[3]===1||e[0]===100&&e[1]>=64&&e[1]<=127?null:`only a Tailscale address (100.64.0.0/10) or 127.0.0.1 may be a peer`}if(r.endsWith(`.ts.net`)){let e=r.split(`.`);return e.length>=4&&e.every(e=>/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(e))?null:`a MagicDNS name looks like <machine>.<tailnet>.ts.net`}return`only a Tailscale address (100.x or <machine>.<tailnet>.ts.net) or 127.0.0.1 may be a peer`}function $g(e,t){if(!e||typeof e.peer!=`string`||!e.peer)return``;let n={queued:`waiting on ${e.peer}`,waiting:`waiting on ${e.peer}`,running:`waiting on ${e.peer}`,limit:`${e.peer} is at its usage limit`,unreachable:`${e.peer} unreachable`,done:`${e.peer} has answered`,failed:`${e.peer}'s job failed`,refused:`${e.peer} refused the job`}[e.state];if(!n)return``;if(typeof t!=`number`||!Number.isFinite(t)||!Number.isFinite(e.since)||e.since<=0||t<e.since)return n;let r=Math.floor((t-e.since)/6e4);return`${n} · ${r<1?`just now`:r<60?`${r} min`:r<1440?`${Math.floor(r/60)} h`:`${Math.floor(r/1440)} d`}`}var Z=e=>typeof e==`number`&&Number.isFinite(e)&&e>0,e_=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function t_(e){if(typeof e!=`string`)return null;let t=Ge(e),n=t?t.replace(/^claude-/,``):e.trim().toLowerCase();return/^[a-z0-9][a-z0-9._/-]{0,47}$/.test(n)?n:null}function n_(e){if(!e||typeof e!=`object`)return;let t=e,n={};Z(t.usd)&&(n.usd=t.usd);let r=t.tokens&&typeof t.tokens==`object`?t.tokens:null;r&&e_(r.in)&&e_(r.out)&&e_(r.cacheRead)&&e_(r.cacheWrite)&&r.in+r.out+r.cacheRead+r.cacheWrite>0&&(n.tokens={in:r.in,out:r.out,cacheRead:r.cacheRead,cacheWrite:r.cacheWrite});let i=t_(t.model);return i&&(n.model=i),Z(t.durationMs)&&(n.durationMs=t.durationMs),Z(t.weekPct)&&t.weekPct<=100&&(n.weekPct=t.weekPct),Z(t.unpricedTok)&&(n.unpricedTok=t.unpricedTok),Object.keys(n).length?n:void 0}function r_(e){if(!Z(e))return``;let t=Math.floor(e/6e4);if(t<1)return`<1 min`;if(t<60)return`${t} min`;if(t<1440){let e=Math.floor(t/60),n=t%60;return n?`${e} h ${n} min`:`${e} h`}let n=Math.floor(t/1440),r=Math.floor(t%1440/60);return r?`${n} d ${r} h`:`${n} d`}function i_(e){return Z(e)?e<.001?`<0.001% of week`:`≈${e<1?String(Number(e.toPrecision(1))):e<10?e.toFixed(1):String(Math.round(e))}% of week`:``}function a_(e){if(!e)return[];let t=[];Z(e.usd)&&t.push(x(e.usd)),e.model&&t.push(e.model);let n=r_(e.durationMs);return n&&t.push(n),t}var o_={queued:`queued there`,waiting:`waiting there`,running:`running`,limit:`at its usage limit`,unreachable:`unreachable`,done:`done`,failed:`failed`,refused:`refused`},s_=e=>o_[e]??``;function c_(e){if(!e||typeof e.peer!=`string`||!e.peer)return``;let t=s_(e.state);if(!t)return``;let n=typeof e.label==`string`&&e.label.trim()?e.label.trim():`a job`;return[`sent to ${e.peer}: ${n}`,t,...a_(e.cost)].join(` · `)}function l_(e,t){if(!t?.length)return null;let n=new Map,r=0;for(let e of t){let t=e.cost?.usd;Z(t)?n.set(e.peer,(n.get(e.peer)??0)+t):r++}if(!n.size)return null;let i=[...n].map(([e,t])=>({peer:e,usd:t})),a=i.map(e=>`${x(e.usd)} on ${e.peer}`).join(` + `);return{text:`${Z(e)?`${x(e)} here + `:``}${a}${Z(e)?``:` (this desktop's share is not priced)`}${r?` · ${r} peer job${r===1?``:`s`} not priced`:``}`,peerUsd:i.reduce((e,t)=>e+t.usd,0),byPeer:i,unpriced:r}}function u_(e,t,n){if(!e?.length||!Number.isFinite(t)||!Number.isFinite(n)||n<=t)return null;let r=new Map,i=0;for(let a of e){let e=a.cost?.usd;if(!Z(e))continue;let o=Z(a.endedAt)?a.endedAt:null;o!=null&&a.since>=t&&o<=n?r.set(a.peer,(r.get(a.peer)??0)+e):a.since<n&&(o==null||o>t)&&i++}if(!r.size)return null;let a=[...r].map(([e,t])=>({peer:e,usd:t}));return{usd:a.reduce((e,t)=>e+t.usd,0),byPeer:a,straddling:i,text:`incl. ${a.map(e=>`${x(e.usd)} on ${e.peer}`).join(` + `)}`}}function d_(e){if(!e||typeof e.from!=`string`||!e.from)return``;let t=e=>typeof e==`string`?e.replace(/\s+/g,` `).trim().slice(0,80):``;return[`job from ${e.from}`,t(e.askerLabel),t(e.label)].filter(Boolean).join(` · `)}var f_={dark:{background:`#0b0d10`,foreground:`#d6dce5`},light:{background:`#fcfcfd`,foreground:`#1c2430`}},p_=`--bg.--panel.--sub.--raise.--well.--line.--pipe-bg.--fg.--muted.--dim.--ring.--accent.--ok.--dead.--warn.--star.--limit.--ask.--pair.--purple.--sched.--defer.--ctx-low.--fu-hand.--fu-launch.--fu-agent.--fu-host.--on-accent.--on-accent-strong.--on-accent-line.--on-dead.--on-ok.--on-limit.--on-star.--on-media.--accent-wash.--accent-tint.--accent-tint-hi.--accent-edge.--accent-edge-hi.--ok-wash.--ok-edge.--pick-fill.--pick-edge.--dead-wash.--dead-tint.--dead-edge.--dead-edge-hi.--warn-wash.--warn-tint.--warn-tint-hi.--warn-edge.--star-wash.--star-edge.--star-edge-hi.--limit-edge.--ask-wash.--ask-tint-hi.--ask-edge.--ctx-low-edge.--hover-soft.--hover.--hover-hi.--sheen.--panel-veil.--panel-veil-hi.--bg-veil.--float-edge.--scrim.--scrim-media.--scrim-label.--shadow.--shadow-soft.--media-bg.--paper.--chart-1.--chart-2.--chart-3.--chart-4.--ctx-series.--ctx-compact.--ctx-limit.--repo-veil.--repo-veil-on`.split(`.`),m_=[`--accent`,`--ok`,`--dead`,`--warn`,`--star`,`--limit`,`--ask`,`--pair`,`--fu-agent`],h_=new Set(p_),g_=new Set(m_),__=[`dark`,`light`],v_=[`favicon`,`apple-touch`,`192`,`512`,`maskable`],y_=new Set(v_),b_=/^(?:[A-Za-z0-9_][A-Za-z0-9._-]*\/)*[A-Za-z0-9_][A-Za-z0-9._-]*\.(?:png|svg)$/,x_=e=>typeof e==`string`&&e.length<=200&&b_.test(e)&&!e.split(`/`).some(e=>e===`.`||e===`..`),S_=(e,t,n)=>Math.min(n,Math.max(t,e));function C_(e,t,n){t=S_(t,0,100)/100,n=S_(n,0,100)/100,e=(e%360+360)%360;let r=t*Math.min(n,1-n),i=t=>(t+e/30)%12,a=e=>n-r*Math.max(-1,Math.min(i(e)-3,Math.min(9-i(e),1)));return[a(0),a(8),a(4)].map(e=>Math.round(e*255))}var w_=String.raw`[+-]?(?:\d+\.?\d*|\.\d+)`,T_=new RegExp(String.raw`^(rgba?|hsla?)\(\s*(${w_})(%?)(?:\s*,\s*|\s+)(${w_})(%?)(?:\s*,\s*|\s+)(${w_})(%?)(?:\s*(?:,|\/)\s*(${w_})(%?))?\s*\)$`,`i`);function Q(e){if(typeof e!=`string`)return null;let t=e.trim(),n=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t);if(n){let e=n[1];e.length<=4&&(e=[...e].map(e=>e+e).join(``));let t=t=>parseInt(e.slice(t,t+2),16);return{r:t(0),g:t(2),b:t(4),a:e.length===8?Math.round(t(6)/255*1e3)/1e3:1}}if(n=T_.exec(t),!n)return null;let r=n[1].toLowerCase(),i=n[8]===void 0?1:S_(Number(n[8])/(n[9]?100:1),0,1);if(r.startsWith(`rgb`)){let e=(e,t)=>Math.round(S_(t?Number(e)*255/100:Number(e),0,255));return{r:e(n[2],n[3]),g:e(n[4],n[5]),b:e(n[6],n[7]),a:i}}if(n[3]||!n[5]||!n[7])return null;let[a,o,s]=C_(Number(n[2]),Number(n[4]),Number(n[6]));return{r:a,g:o,b:s,a:i}}var E_=e=>e.toString(16).padStart(2,`0`),D_=e=>`#${E_(e.r)}${E_(e.g)}${E_(e.b)}`,O_=e=>e.a>=1?D_(e):`rgb(${e.r} ${e.g} ${e.b} / ${Math.round(e.a*1e3)/1e3})`,$=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function k_(e){let t=[],n={};if(!$(e))return e!=null&&t.push(`top level must be an object; nothing applied`),{overlay:n,notes:t};for(let n of Object.keys(e))n!==`displayName`&&n!==`colors`&&n!==`terminal`&&n!==`icons`&&!n.startsWith(`//`)&&t.push(`unknown key "${n}" ignored (allowed: displayName, colors, terminal, icons)`);if(e.displayName!==void 0){let r=typeof e.displayName==`string`?e.displayName.trim():``;!r||r.length>40||/[\u0000-\u001f\u007f]/.test(r)?t.push(`"displayName" must be 1–40 printable characters; ignored`):n.displayName=r}if(e.colors!==void 0){if(!$(e.colors))t.push(`"colors" must be an object of { dark, light }; ignored`);else for(let r of Object.keys(e.colors)){if(!__.includes(r)){t.push(`"colors.${r}" ignored (allowed: dark, light)`);continue}let i=e.colors[r];if(!$(i)){t.push(`"colors.${r}" must be an object of token → colour; ignored`);continue}let a={};for(let[e,n]of Object.entries(i)){let i=e.startsWith(`--`)?e:`--${e}`;if(i===`--term-bg`){t.push(`"colors.${r}.${e}" ignored: set "terminal.${r}.background" instead (the grid and its frame are one colour)`);continue}if(!h_.has(i)){t.push(`"colors.${r}.${e}" ignored: not a colour token of this version`);continue}let o=Q(n);o?g_.has(i)&&o.a<1?t.push(`"colors.${r}.${e}" ignored: must be opaque (its tints are derived from it)`):a[i]=O_(o):t.push(`"colors.${r}.${e}" ignored: ${JSON.stringify(n)} is not a colour (hex, rgb(), hsl())`)}Object.keys(a).length&&((n.colors??={})[r]=a)}}if(e.terminal!==void 0){if(!$(e.terminal))t.push(`"terminal" must be an object of { dark, light }; ignored`);else for(let r of Object.keys(e.terminal)){if(!__.includes(r)){t.push(`"terminal.${r}" ignored (allowed: dark, light)`);continue}let i=e.terminal[r];if(!$(i)){t.push(`"terminal.${r}" must be an object of { background, foreground }; ignored`);continue}let a={};for(let[e,n]of Object.entries(i)){if(e!==`background`&&e!==`foreground`){t.push(`"terminal.${r}.${e}" ignored (allowed: background, foreground)`);continue}let i=Q(n);!i||i.a<1?t.push(`"terminal.${r}.${e}" ignored: ${JSON.stringify(n)} is not an opaque colour`):a[e]=D_(i)}Object.keys(a).length&&((n.terminal??={})[r]=a)}}if(e.icons!==void 0){if(!$(e.icons))t.push(`"icons" must be an object of slot → path; ignored`);else{let r={};for(let[n,i]of Object.entries(e.icons))y_.has(n)?x_(i)?r[n]=i:t.push(`"icons.${n}" ignored: ${JSON.stringify(i)} is not a .png/.svg path relative to the config dir`):t.push(`"icons.${n}" ignored (allowed: ${v_.join(`, `)})`);Object.keys(r).length&&(n.icons=r)}}return{overlay:n,notes:t}}var A_=e=>!e||e.displayName===void 0&&!e.colors&&!e.terminal&&!e.icons;function j_(e,t){let n=t?.terminal?.[e];return!n||!n.background&&!n.foreground?f_[e]:{...f_[e],...n}}function M_(e){if(!e)return``;let t=[];for(let n of __){let r=[];for(let[t,i]of Object.entries(e.colors?.[n]??{})){if(!h_.has(t))continue;let e=Q(i);e&&(g_.has(t)?r.push(`${t}-rgb: ${e.r} ${e.g} ${e.b};`):r.push(`${t}: ${O_(e)};`))}let i=e.terminal?.[n]?.background;if(i&&Q(i)&&r.push(`--term-bg: ${D_(Q(i))};`),!r.length)continue;let a=n===`light`?`html[data-theme="light"]`:`html:not([data-theme="light"])`;t.push(`${a} { ${r.join(` `)} }`)}return t.join(`
|
|
48
|
+
`)}function N_(e,t){let n=Q(t?.colors?.[e]?.[`--bg`]);return n?D_(n):null}function P_(e){return e.pending||e.picked===`named`?!1:e.picked!==`chosen`||!e.rootExists}var F_=36e5;5*F_,336*F_,24*F_,24*F_,6*F_;var I_=`Fix the repo's weakest health reading`,L_=["Make ONE focused improvement. Run the repo's tests. Commit on the current branch only if they pass: stage explicit paths, never `git add -A`, never push, never stash or reset.",`If nothing worth doing is left, change nothing and say so in one line.`];function R_(e){let t=e.healthSummary&&e.healthSummary.trim()?`Latest repo readings:\n${e.healthSummary.trim()}`:null,n=e.task&&e.task.trim(),r=n?[`What to work on (from the person who picked this repo):\n${n}`,...t?[t]:[]]:t?[t,`Pick the weakest reading.`]:[`Look for the repo's own checks, tests and lint, and pick the weakest area.`],i=e.note&&e.note.trim();return[`This is an unattended week-end burn package for ${e.repoName}. Nobody is watching, so keep it small.`,...r,...i?[`For this repo:\n${i}`]:[],...L_].join(`
|
|
49
49
|
|
|
50
|
-
`)}var
|
|
50
|
+
`)}var z_=`weekburn:`,B_=e=>!!e?.startsWith(z_),V_=`from the week-end burn`,H_=e=>`${e} from the week-end burn`;export{Lh as $,us as $a,Kt as $c,Bc as $i,y as $l,Yd as $n,Fa as $o,pu as $r,Ar as $s,em as $t,Ig as A,Xs as Aa,In as Ac,wl as Ai,ct as Al,kf as An,So as Ao,nd as Ar,pi as As,hm as At,Og as B,Vs as Ba,Nn as Bc,ml as Bi,rt as Bl,af as Bn,Va as Bo,Fu as Br,ii as Bs,Sm as Bt,u_ as C,Fc as Ca,Yn as Cc,Ll as Ci,ht as Cl,rp as Cn,Co,ud as Cr,hi as Cs,ih as Ct,t as Cu,Xg as D,sc as Da,Vn as Dc,Dl as Di,St as Dl,Wf as Dn,mo as Do,td as Dr,Ci as Ds,Um as Dt,Yg as E,oc as Ea,Hn as Ec,Sl as Ei,_t as El,Uf as En,go as Eo,Xu as Er,_i as Es,Wm as Et,Mg as F,qs as Fa,Mn as Fc,Il as Fi,ot as Fl,H as Fn,uo as Fo,Bu as Fr,si as Fs,Om as Ft,gg as G,Ms as Ga,Sn as Gc,dl as Gi,Je as Gl,nf as Gn,Qa as Go,ku as Gr,Br as Gs,Dm as Gt,bg as H,Ds as Ha,kn as Hc,cl as Hi,He as Hl,sf as Hn,qa as Ho,Du as Hr,Gr as Hs,_m as Ht,Pg as I,Gs as Ia,bn as Ic,yl as Ii,it as Il,Ef as In,fo as Io,Iu as Ir,oi as Is,Pm as It,pg as J,ks as Ja,$t as Jc,nl as Ji,Ye as Jl,cf as Jn,$a as Jo,Au as Jr,Wr as Js,pm as Jt,cg as K,Ns as Ka,dn as Kc,ol as Ki,Xe as Kl,$d as Kn,eo as Ko,ju as Kr,Vr as Ks,Tm as Kt,Ng as L,Ws as La,rn as Lc,bl as Li,at as Ll,ff as Ln,lo as Lo,Lu as Lr,ei as Ls,Em as Lt,Vg as M,ec as Ma,fn as Mc,Al as Mi,tt as Ml,U as Mn,vo as Mo,Zu as Mr,ci as Ms,Nm as Mt,Ug as N,Ys as Na,jn as Nc,Nl as Ni,dt as Nl,_f as Nn,po as No,Qu as Nr,li as Ns,Mm as Nt,qg as O,rc as Oa,Ln as Oc,Fl as Oi,ut as Ol,Nf as On,ho as Oo,ed as Or,mi as Os,zm as Ot,Hg as P,Js as Pa,Fn as Pc,Ml as Pi,S as Pl,Tf as Pn,_o as Po,Vu as Pr,ai as Ps,Im as Pt,zh as Q,ys as Qa,Ut as Qc,tl as Qi,Ke as Ql,Zd as Qn,Pa as Qo,fu as Qr,Nr as Qs,$p as Qt,kg as R,Hs as Ra,tn as Rc,xl as Ri,et as Rl,mf as Rn,ro as Ro,Ru as Rr,$r as Rs,Am as Rt,$g as S,kc as Sa,er as Sc,Wl as Si,wt as Sl,ep as Sn,wo as So,ld as Sr,Ti as Ss,rh as St,r as Su,Jg as T,z as Ta,Jn as Tc,Tl as Ti,gt as Tl,Gf as Tn,yo as To,rd as Tr,P as Ts,eh as Tt,i as Tu,vg as U,Is as Ua,On as Uc,sl as Ui,Ve as Ul,Ud as Un,Ja as Uo,Ou as Ur,Kr as Us,jm as Ut,wg as V,Rs as Va,Dn as Vc,vl as Vi,nt as Vl,of as Vn,Za as Vo,Pu as Vr,qr as Vs,q as Vt,_g as W,Ps as Wa,xn as Wc,fl as Wi,b as Wl,ef as Wn,Ka as Wo,Nu as Wr,Jr as Ws,gm as Wt,Kh as X,Fs as Xa,w as Xc,al as Xi,qe as Xl,rf as Xn,Ra as Xo,Su as Xr,wr as Xs,lm as Xt,Zh as Y,js as Ya,Lt as Yc,rl as Yi,Ze as Yl,tf as Yn,to as Yo,xu as Yr,Fr as Ys,dm as Yt,Bh as Z,Es as Za,zt as Zc,el as Zi,Ge as Zl,Kd as Zn,La as Zo,uu as Zr,N as Zs,Qp as Zt,r_ as _,vc as _a,or as _c,zl as _i,Ot as _l,ap as _n,Ho as _o,_d as _r,ki as _s,ph as _t,m as _u,H_ as a,Ic as aa,k as ac,bu as ai,Bt as al,zp as an,ss as ao,zd as ar,Ea as as,jh as at,Oe as au,s_ as b,Mc as ba,$n as bc,Hl as bi,Dt as bl,wp as bn,Vo as bo,od as br,Di as bs,lh as bt,c as bu,N_ as c,uc as ca,hr as cc,lu as ci,Wt as cl,Rp as cn,es as co,Ad as cr,ca as cs,yh as ct,xe as cu,A_ as d,Sc as da,br as dc,$l as di,jt as dl,Tp as dn,$o as do,Cd as dr,la as ds,Oh as dt,re as du,Wc as ea,jr as ec,V as ei,qt as el,Zp as en,fs as eo,Qd as er,Na as es,Vh as et,Be as eu,f_ as f,Dc as fa,yr as fc,Zl as fi,Et as fl,Dp as fn,Jo as fo,wd as fr,ba as fs,Th as ft,ne as fu,a_ as g,gc as ga,Gn as gc,Kl as gi,Tt as gl,hp as gn,Uo as go,md as gr,Ai as gs,mh as gt,h as gu,Qg as h,Oc as ha,qn as hc,ql as hi,Mt as hl,Mp as hn,Wo as ho,yd as hr,ji as hs,wh as ht,_ as hu,R_ as i,Jc as ia,Dr as ic,yu as ii,Gt as il,Bp as in,as as io,Bd as ir,xa as is,Ih as it,De as iu,Gg as j,Qs as ja,D as jc,Pl as ji,st as jl,Of as jn,xo as jo,$u as jr,ui as js,xm as jt,Kg as k,nc as ka,Bn as kc,jl as ki,lt as kl,jf as kn,To as ko,Yu as kr,di as ks,Hm as kt,j_ as l,fc as la,_r as lc,cu as li,C as ll,Vp as ln,ts as lo,jd as lr,_a as ls,hh as lt,we as lu,n_ as m,hc as ma,rr as mc,Gl as mi,At as ml,Op as mn,qo as mo,xd as mr,ea as ms,Dh as mt,te as mu,I_ as n,Yc as na,kr as nc,vu as ni,Yt as nl,Jp as nn,R as no,Hd as nr,da as ns,Wh as nt,Ee as nu,P_ as o,Rc as oa,A as oc,hu as oi,Rt as ol,Ip as on,cs as oo,Ed as or,sa as os,Ah as ot,Se as ou,Zg as p,yc as pa,mr as pc,nu as pi,Pt as pl,Ap as pn,Xo as po,bd as pr,pa as ps,Ch as pt,ee as pu,dg as q,Ls as qa,an as qc,il as qi,x as ql,lf as qn,no as qo,Mu as qr,Ur as qs,mm as qt,B_ as r,Gc as ra,Er as rc,gu as ri,Jt as rl,Gp as rn,os as ro,Ld as rr,ya as rs,Hh as rt,Ne as ru,k_ as s,zc as sa,gr as sc,su as si,T as sl,Lp as sn,is as so,Dd as sr,Ca as ss,Mh as st,Ce as su,V_ as t,Uc as ta,Mr as tc,_u as ti,E as tl,qp as tn,Ts as to,Vd as tr,ua as ts,Uh as tt,Te as tu,M_ as u,Nc as ua,j as uc,ou as ui,It as ul,Ep as un,Zo as uo,Sd as ur,ga as us,fh as ut,oe as uu,c_ as v,bc as va,Xn as vc,Vl as vi,Ft as vl,cp as vn,Go as vo,vd as vr,Ei as vs,vh as vt,p as vu,i_ as w,Ec as wa,nr as wc,Rl as wi,bt as wl,ip as wn,bo as wo,id as wr,gi as ws,nh as wt,n as wu,l_ as x,Tc as xa,ir as xc,Ul as xi,Nt as xl,up as xn,Ao as xo,sd as xr,wi as xs,uh as xt,e as xu,d_ as y,Ac as ya,ar as yc,Bl as yi,kt as yl,yp as yn,Ro as yo,cd as yr,Oi as ys,dh as yt,s as yu,Ag as z,Us as za,nn as zc,_l as zi,$e as zl,uf as zn,za as zo,zu as zr,ri as zs,km as zt};
|