howtocode 0.7.69 → 0.7.71

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.
@@ -1,4 +1,4 @@
1
- import{$a as ps,A as Oo,Aa as Jo,Ba as Xo,Ca as Zo,D as Rt,Da as Qo,E as No,Ea as es,G as Fo,Ga as de,Ha as E,Ia as X,J as jo,Ja as A,K as Do,Ka as ts,L as It,La as ns,M as Wo,Ma as rs,N as Uo,Na as is,O as Bo,Oa as Kn,P as Wn,Pa as os,Qa as ss,Sa as as,Ta as ls,Va as cs,X as Un,Xa as ds,Ya as us,Z as Bn,Za as fs,_a as ms,aa as Qe,ab as gs,bb as hs,c as Ao,e as To,g as Eo,h as Mo,ha as Vo,ia as et,ka as _t,n as Io,oa as Ko,pa as Go,ra as Ho,sa as qo,ta as zo,v as _o,wa as Yo,x as Lo,z as Dn,za as Vn}from"./chunk-GNV6G3JW.js";import{b as bs,c as ws}from"./chunk-SDU65XW4.js";import{b as Ee,c as Ze,e as Po,f as Mt,g as Ro,h as Pt}from"./chunk-27TRKD65.js";import{A as so,B as Ct,C as ao,b as In,c as ye,d as Ji,e as Xi,h as Zi,n as _n,o as Qi,q as oe,s as eo,t as Ie,v as to,w as no,x as ro,y as io,z as oo}from"./chunk-SKLMU4IE.js";import{a as lo,b as co,c as uo,d as fo,f as mo,g as po,h as go,i as ho,l as bo}from"./chunk-VZZPQZDI.js";import{a as At,b as Ln,c as On,d as wo,e as Tt}from"./chunk-3FYCFLNK.js";import{u as yo}from"./chunk-SDO33XPR.js";import{a as ko}from"./chunk-ORJ2QZBG.js";import{a as $o,c as Et,d as Nn,j as vo,k as xo,l as So,n as Fn,o as jn,p as Co}from"./chunk-ZJL4OEXX.js";import{a as Pn,b as Rn,c as Vi,d as Ki}from"./chunk-EZNNALD3.js";import{b as St}from"./chunk-7LA2AMZB.js";import{h as Ci,i as Ai}from"./chunk-W34I6VMP.js";import{a as vn,b as wt,e as Si}from"./chunk-DK3DYJTA.js";import{A as ji,B as vt,C as xt,D as Di,E as Cn,F as An,G as Wi,H as P,M as Xe,N as Tn,O as Ui,Q as Bi,c as xn,d as yt,g as kt,i as Ti,j as Ei,k as Mi,l as Pi,m as $t,n as Ri,o as Sn,p as Ii,s as se,t as _i,u as Li,x as Oi,y as Ni,z as Fi}from"./chunk-5FIFNXLT.js";import{a as ie}from"./chunk-UTYFLLSM.js";import{j as En,k as Mn}from"./chunk-MVVEYKN6.js";import{b as Gi,c as Hi,d as qi,e as zi,f as Yi}from"./chunk-TUXY64DT.js";import"./chunk-WOT6VMZA.js";import{execFile as yd}from"node:child_process";import{promisify as kd}from"node:util";import{appendFileSync as $d,existsSync as qt,mkdirSync as $r,readFileSync as zt,rmSync as vd,statSync as tl,writeFileSync as vr}from"node:fs";import{basename as xd,dirname as Sd,join as me,resolve as Cd}from"node:path";function ys(e){if(e==="")return!0;let t=/^\x1b\[(\d+);(\d+)u$/.exec(e);if(t&&Number(t[1])===99&&(Number(t[2])&5)!==0)return!0;let n=/^\x1b\[27;(\d+);(\d+)~$/.exec(e);return!!(n&&Number(n[2])===99&&(Number(n[1])&5)!==0)}function ks(e){let t=!1;process.on("SIGINT",()=>{t||(t=!0,e())})}function Il(e){if(!e||typeof e!="object")return;let t=e;if(!(typeof t.input!="number"&&typeof t.cacheRead!="number"&&typeof t.cacheWrite!="number"))return t}function _l(e){let t=e?.input??0,n=e?.cacheRead??0,r=e?.cacheWrite??0;return{input:t,cacheRead:n,cacheWrite:r,prompt:t+n+r}}function Ll(e){if(typeof e!="string")return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Ol(e){if(!e||typeof e!="object")return;let t=e,r=(t.message&&typeof t.message=="object"?t.message:void 0)??t,o=Il(r.usage);if(!o)return;let u=typeof r.provider=="string"?r.provider:"",a=typeof r.model=="string"?r.model:"";return{usage:o,model:[u,a].filter(Boolean).join("/")}}function $s(e){let t=0,n=0,r=[],o=0,u=null;for(let g of e){let b=Ol(g);if(!b)continue;let{input:k,cacheRead:C,cacheWrite:_,prompt:O}=_l(b.usage);if(O===0)continue;t+=C,n+=k+_;let F=Ll(g.timestamp),W=u,K=W?W.at:null;if(W!==null&&C===0&&k>=1e3){let ee=F!==null&&K!==null?Math.max(0,F-K):0;r.push({missedTokens:k,idleMs:ee,modelChanged:b.model!==""&&W.model!==""&&b.model!==W.model}),o+=k}u={prompt:O,at:F??K??null,model:b.model}}let a=t+n;return{cachedTokens:t,billedTokens:n,hitRate:a>0?t/a*100:null,misses:r,missedTokens:o}}function vs(e){return e.modelChanged?"model changed, so its cache had to be built":e.idleMs>=3e5?`cache expired after ${Math.round(e.idleMs/1e3)}s idle`:e.idleMs>0?"prompt changed too early in the prefix to hit":"reason not recorded"}import{copyToClipboard as Ad,ProjectTrustStore as Td,SessionManager as Ed}from"@netrodev/hxf-coding-agent";import{CombinedAutocompleteProvider as nl,Container as Md,Editor as Pd,matchesKey as q,ProcessTerminal as Rd,ScrollView as Id,KeybindingsManager as sl,setKeybindings as al,isKeyRelease as _d,parseColor as Jt,TUI_KEYBINDINGS as ll,SelectList as Ld,TuiAltScreen as Od,truncateToWidth as We,VStack as Nd,visibleWidth as Ar,wrapTextWithAnsi as cl}from"@netrodev/hxf-tui";import{spawn as Nl}from"node:child_process";function Fl(e,t,n=2e3){return new Promise(r=>{let o=!1,u,a=k=>{o||(o=!0,u!==void 0&&clearTimeout(u),r(k))},g;try{g=Nl(e,[...t],{stdio:["ignore","pipe","ignore"]})}catch{a({ok:!1,stdout:""});return}u=setTimeout(()=>{g.kill("SIGKILL"),a({ok:!1,stdout:""})},n);let b=[];g.stdout?.on("data",k=>b.push(k)),g.on("error",()=>a({ok:!1,stdout:""})),g.on("close",k=>{a({ok:k===0,stdout:Buffer.concat(b).toString("utf8")})})})}function Gn(){return process.env.XDG_SESSION_TYPE==="wayland"||(process.env.WAYLAND_DISPLAY?.length??0)>0}async function jl(){let e=[];process.platform==="darwin"?e.push({command:"pbpaste",args:[]}):process.platform==="win32"?e.push({command:"powershell.exe",args:["-NoProfile","-Command","Get-Clipboard -Raw"]}):(Gn()&&(e.push({command:"wl-paste",args:["--no-newline","--type","text/plain;charset=utf-8"]}),e.push({command:"wl-paste",args:["--no-newline","--type","text/plain"]}),e.push({command:"wl-paste",args:["--no-newline"]})),((process.env.DISPLAY?.length??0)>0||!Gn())&&(e.push({command:"xclip",args:["-selection","clipboard","-o"]}),e.push({command:"xsel",args:["--clipboard","--output"]})),e.push({command:"termux-clipboard-get",args:[]}));for(let t of e){let n=await Fl(t.command,t.args);if(n.ok&&n.stdout.length>0)return n.stdout}}async function xs(){let e;try{let{getNativeClipboard:r}=await import("@netrodev/hxf-tui");e=r()}catch{e=void 0}if(e)try{let r=await e.getText();if(typeof r=="string"&&r.length>0)return{ok:!0,text:r}}catch{}let t=await jl();return t!==void 0?{ok:!0,text:t}:{ok:!1,reason:`no clipboard tool could read it \u2014 ${Gn()?"install wl-clipboard (wl-paste)":process.platform==="darwin"?"pbpaste should be present on macOS":process.platform==="win32"?"Get-Clipboard should be present on Windows":"install xclip or xsel, or run under a display"}`}}import{spawn as Dl}from"node:child_process";import{mkdirSync as Wl,writeFileSync as Ul}from"node:fs";import{join as Bl}from"node:path";import{getNativeClipboard as Vl}from"@netrodev/hxf-tui";async function _e(e,t,n=4e3){let{promise:r,resolve:o}=Promise.withResolvers(),u=!1,a,g=C=>{u||(u=!0,clearTimeout(a),o(C))},b;try{b=Dl(e,[...t],{stdio:["ignore","pipe","ignore"]})}catch{return g(void 0),r}a=setTimeout(()=>{b.kill("SIGKILL"),g(void 0)},n);let k=[];return b.stdout?.on("data",C=>k.push(C)),b.on("error",()=>g(void 0)),b.on("close",C=>{let _=Buffer.concat(k);g(C===0&&_.length>0?_:void 0)}),r}function Ss(){return process.env.XDG_SESSION_TYPE==="wayland"||(process.env.WAYLAND_DISPLAY?.length??0)>0}function Kl(e){return e.length>8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71}function Gl(e){return e.length>3&&e[0]===255&&e[1]===216&&e[2]===255}async function Hl(){try{let e=await Vl()?.getImage();if(e&&e.length>0)return Buffer.from(e)}catch{}if(process.platform==="darwin"){let e=await _e("pngpaste",["-"]);return e||await _e("osascript",["-e",`set d to the clipboard as \xABclass PNGf\xBB
1
+ import{$a as ps,A as Oo,Aa as Jo,Ba as Xo,Ca as Zo,D as Rt,Da as Qo,E as No,Ea as es,G as Fo,Ga as de,Ha as E,Ia as X,J as jo,Ja as A,K as Do,Ka as ts,L as It,La as ns,M as Wo,Ma as rs,N as Uo,Na as is,O as Bo,Oa as Kn,P as Wn,Pa as os,Qa as ss,Sa as as,Ta as ls,Va as cs,X as Un,Xa as ds,Ya as us,Z as Bn,Za as fs,_a as ms,aa as Qe,ab as gs,bb as hs,c as Ao,e as To,g as Eo,h as Mo,ha as Vo,ia as et,ka as _t,n as Io,oa as Ko,pa as Go,ra as Ho,sa as qo,ta as zo,v as _o,wa as Yo,x as Lo,z as Dn,za as Vn}from"./chunk-7HVQT3IC.js";import{b as bs,c as ws}from"./chunk-SDU65XW4.js";import{b as Ee,c as Ze,e as Po,f as Mt,g as Ro,h as Pt}from"./chunk-27TRKD65.js";import{A as so,B as Ct,C as ao,b as In,c as ye,d as Ji,e as Xi,h as Zi,n as _n,o as Qi,q as oe,s as eo,t as Ie,v as to,w as no,x as ro,y as io,z as oo}from"./chunk-D5TQNROK.js";import{a as lo,b as co,c as uo,d as fo,f as mo,g as po,h as go,i as ho,l as bo}from"./chunk-YUS7EX6B.js";import{a as At,b as Ln,c as On,d as wo,e as Tt}from"./chunk-3FYCFLNK.js";import{u as yo}from"./chunk-SDO33XPR.js";import{a as ko}from"./chunk-ORJ2QZBG.js";import{a as $o,c as Et,d as Nn,j as vo,k as xo,l as So,n as Fn,o as jn,p as Co}from"./chunk-ZJL4OEXX.js";import{a as Pn,b as Rn,c as Vi,d as Ki}from"./chunk-EZNNALD3.js";import{b as St}from"./chunk-7LA2AMZB.js";import{h as Ci,i as Ai}from"./chunk-VSVEFNSH.js";import{a as vn,b as wt,e as Si}from"./chunk-EF3Z3FAO.js";import{A as ji,B as vt,C as xt,D as Di,E as Cn,F as An,G as Wi,H as P,M as Xe,N as Tn,O as Ui,Q as Bi,c as xn,d as yt,g as kt,i as Ti,j as Ei,k as Mi,l as Pi,m as $t,n as Ri,o as Sn,p as Ii,s as se,t as _i,u as Li,x as Oi,y as Ni,z as Fi}from"./chunk-5FIFNXLT.js";import{a as ie}from"./chunk-UTYFLLSM.js";import{j as En,k as Mn}from"./chunk-MVVEYKN6.js";import{b as Gi,c as Hi,d as qi,e as zi,f as Yi}from"./chunk-TUXY64DT.js";import"./chunk-WOT6VMZA.js";import{execFile as yd}from"node:child_process";import{promisify as kd}from"node:util";import{appendFileSync as $d,existsSync as qt,mkdirSync as $r,readFileSync as zt,rmSync as vd,statSync as tl,writeFileSync as vr}from"node:fs";import{basename as xd,dirname as Sd,join as me,resolve as Cd}from"node:path";function ys(e){if(e==="")return!0;let t=/^\x1b\[(\d+);(\d+)u$/.exec(e);if(t&&Number(t[1])===99&&(Number(t[2])&5)!==0)return!0;let n=/^\x1b\[27;(\d+);(\d+)~$/.exec(e);return!!(n&&Number(n[2])===99&&(Number(n[1])&5)!==0)}function ks(e){let t=!1;process.on("SIGINT",()=>{t||(t=!0,e())})}function Il(e){if(!e||typeof e!="object")return;let t=e;if(!(typeof t.input!="number"&&typeof t.cacheRead!="number"&&typeof t.cacheWrite!="number"))return t}function _l(e){let t=e?.input??0,n=e?.cacheRead??0,r=e?.cacheWrite??0;return{input:t,cacheRead:n,cacheWrite:r,prompt:t+n+r}}function Ll(e){if(typeof e!="string")return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Ol(e){if(!e||typeof e!="object")return;let t=e,r=(t.message&&typeof t.message=="object"?t.message:void 0)??t,o=Il(r.usage);if(!o)return;let u=typeof r.provider=="string"?r.provider:"",a=typeof r.model=="string"?r.model:"";return{usage:o,model:[u,a].filter(Boolean).join("/")}}function $s(e){let t=0,n=0,r=[],o=0,u=null;for(let g of e){let b=Ol(g);if(!b)continue;let{input:k,cacheRead:C,cacheWrite:_,prompt:O}=_l(b.usage);if(O===0)continue;t+=C,n+=k+_;let F=Ll(g.timestamp),W=u,K=W?W.at:null;if(W!==null&&C===0&&k>=1e3){let ee=F!==null&&K!==null?Math.max(0,F-K):0;r.push({missedTokens:k,idleMs:ee,modelChanged:b.model!==""&&W.model!==""&&b.model!==W.model}),o+=k}u={prompt:O,at:F??K??null,model:b.model}}let a=t+n;return{cachedTokens:t,billedTokens:n,hitRate:a>0?t/a*100:null,misses:r,missedTokens:o}}function vs(e){return e.modelChanged?"model changed, so its cache had to be built":e.idleMs>=3e5?`cache expired after ${Math.round(e.idleMs/1e3)}s idle`:e.idleMs>0?"prompt changed too early in the prefix to hit":"reason not recorded"}import{copyToClipboard as Ad,ProjectTrustStore as Td,SessionManager as Ed}from"@netrodev/hxf-coding-agent";import{CombinedAutocompleteProvider as nl,Container as Md,Editor as Pd,matchesKey as q,ProcessTerminal as Rd,ScrollView as Id,KeybindingsManager as sl,setKeybindings as al,isKeyRelease as _d,parseColor as Jt,TUI_KEYBINDINGS as ll,SelectList as Ld,TuiAltScreen as Od,truncateToWidth as We,VStack as Nd,visibleWidth as Ar,wrapTextWithAnsi as cl}from"@netrodev/hxf-tui";import{spawn as Nl}from"node:child_process";function Fl(e,t,n=2e3){return new Promise(r=>{let o=!1,u,a=k=>{o||(o=!0,u!==void 0&&clearTimeout(u),r(k))},g;try{g=Nl(e,[...t],{stdio:["ignore","pipe","ignore"]})}catch{a({ok:!1,stdout:""});return}u=setTimeout(()=>{g.kill("SIGKILL"),a({ok:!1,stdout:""})},n);let b=[];g.stdout?.on("data",k=>b.push(k)),g.on("error",()=>a({ok:!1,stdout:""})),g.on("close",k=>{a({ok:k===0,stdout:Buffer.concat(b).toString("utf8")})})})}function Gn(){return process.env.XDG_SESSION_TYPE==="wayland"||(process.env.WAYLAND_DISPLAY?.length??0)>0}async function jl(){let e=[];process.platform==="darwin"?e.push({command:"pbpaste",args:[]}):process.platform==="win32"?e.push({command:"powershell.exe",args:["-NoProfile","-Command","Get-Clipboard -Raw"]}):(Gn()&&(e.push({command:"wl-paste",args:["--no-newline","--type","text/plain;charset=utf-8"]}),e.push({command:"wl-paste",args:["--no-newline","--type","text/plain"]}),e.push({command:"wl-paste",args:["--no-newline"]})),((process.env.DISPLAY?.length??0)>0||!Gn())&&(e.push({command:"xclip",args:["-selection","clipboard","-o"]}),e.push({command:"xsel",args:["--clipboard","--output"]})),e.push({command:"termux-clipboard-get",args:[]}));for(let t of e){let n=await Fl(t.command,t.args);if(n.ok&&n.stdout.length>0)return n.stdout}}async function xs(){let e;try{let{getNativeClipboard:r}=await import("@netrodev/hxf-tui");e=r()}catch{e=void 0}if(e)try{let r=await e.getText();if(typeof r=="string"&&r.length>0)return{ok:!0,text:r}}catch{}let t=await jl();return t!==void 0?{ok:!0,text:t}:{ok:!1,reason:`no clipboard tool could read it \u2014 ${Gn()?"install wl-clipboard (wl-paste)":process.platform==="darwin"?"pbpaste should be present on macOS":process.platform==="win32"?"Get-Clipboard should be present on Windows":"install xclip or xsel, or run under a display"}`}}import{spawn as Dl}from"node:child_process";import{mkdirSync as Wl,writeFileSync as Ul}from"node:fs";import{join as Bl}from"node:path";import{getNativeClipboard as Vl}from"@netrodev/hxf-tui";async function _e(e,t,n=4e3){let{promise:r,resolve:o}=Promise.withResolvers(),u=!1,a,g=C=>{u||(u=!0,clearTimeout(a),o(C))},b;try{b=Dl(e,[...t],{stdio:["ignore","pipe","ignore"]})}catch{return g(void 0),r}a=setTimeout(()=>{b.kill("SIGKILL"),g(void 0)},n);let k=[];return b.stdout?.on("data",C=>k.push(C)),b.on("error",()=>g(void 0)),b.on("close",C=>{let _=Buffer.concat(k);g(C===0&&_.length>0?_:void 0)}),r}function Ss(){return process.env.XDG_SESSION_TYPE==="wayland"||(process.env.WAYLAND_DISPLAY?.length??0)>0}function Kl(e){return e.length>8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71}function Gl(e){return e.length>3&&e[0]===255&&e[1]===216&&e[2]===255}async function Hl(){try{let e=await Vl()?.getImage();if(e&&e.length>0)return Buffer.from(e)}catch{}if(process.platform==="darwin"){let e=await _e("pngpaste",["-"]);return e||await _e("osascript",["-e",`set d to the clipboard as \xABclass PNGf\xBB
2
2
  return d`])}if(process.platform==="win32"){let e=["Add-Type -AssemblyName System.Windows.Forms","$img = [System.Windows.Forms.Clipboard]::GetImage()","if ($img -ne $null) {"," $ms = New-Object System.IO.MemoryStream"," $img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)"," [Console]::OpenStandardOutput().Write($ms.ToArray(), 0, $ms.Length)","}"].join("; ");return _e("powershell.exe",["-NoProfile","-Command",e])}if(Ss()){let e=await _e("wl-paste",["--type","image/png"]);if(e)return e}if((process.env.DISPLAY?.length??0)>0||!Ss()){let e=await _e("xclip",["-selection","clipboard","-t","image/png","-o"]);if(e)return e;let t=await _e("xclip",["-selection","clipboard","-t","image/jpeg","-o"]);if(t)return t}}function ql(e,t){let n=t==="image/jpeg"?"jpg":"png";return`pasted-${new Date(e).toISOString().replace(/[:.]/g,"-")}.${n}`}async function Hn(e=Bi,t=Date.now()){let n=await Hl();if(!n)return{ok:!1,reason:"the clipboard holds no image"};let r=Kl(n)?"image/png":Gl(n)?"image/jpeg":void 0;if(!r)return{ok:!1,reason:"the clipboard image is not PNG or JPEG"};try{Wl(e,{recursive:!0});let o=Bl(e,ql(t,r));return Ul(o,n,{mode:384}),{ok:!0,image:{path:o,data:n.toString("base64"),mimeType:r}}}catch(o){return{ok:!1,reason:`could not store the image: ${o instanceof Error?o.message:String(o)}`}}}import{TreeSelectorComponent as Fd,initTheme as jd}from"@netrodev/hxf-coding-agent";import{getKeybindings as rl}from"@netrodev/hxf-tui";import{mixColors as zl,parseColor as Yl,styleText as he}from"@netrodev/hxf-tui";var ue=process.env.HOWTOCODE_NO_MOTION!=="1",Jl=45,Cs=5,As=8,qn=1e4,Ts=6e4,Es=3,Ms=4,zn=e=>e<0?0:e>1?1:e;function ke(e,t,n){let r=zn(n);return r>=1?t:r<=0?e:zl(e,t,r)}var Lt=class{value;velocity=0;last=Date.now();target;constructor(t,n=t){this.value=t,this.target=n}set(t){this.target=t}get moving(){return Math.abs(this.target-this.value)>.15}snap(t){this.value=t,this.target=t,this.velocity=0,this.last=Date.now()}step(t=Date.now()){let n=Math.max(0,t-this.last),r=Math.min(250,n)/1e3;if(this.last=t,!ue)return this.value=this.target,this.velocity=0,this.value;n>250&&(this.velocity=0);let o=150,u=2*Math.sqrt(o),a=Math.max(1,Math.ceil(r/.008)),g=r/a;for(let b=0;b<a;b+=1)this.velocity+=(this.target-this.value)*o*g-this.velocity*u*g,this.value+=this.velocity*g;return this.moving||(this.value=this.target,this.velocity=0),this.value}};function Yn(e,t,n,r){return!ue||e<=qn?t:e>=Ts?r:ke(n,r,(e-qn)/(Ts-qn))}function Ps(e,t){return!ue||t<=0||e<0?1:1-(1-zn(e/t))**3}var Rs=260,Xl=45;function Is(e,t,n=Xl,r=400){return!ue||n<=0||e<0||e>=r?t:Math.min(t,Math.floor(e/n)+1)}function _s(e,t,n=Date.now(),r=1400){if(!ue||r<=0)return e;let o=n%r/r;return ke(e,t,o<.5?o*2:(1-o)*2)}function Ot(e,t,n){let r=he(e,{fg:t.rest},de);if(!ue||e.length===0)return r;let o=zn(n);if(o>=1)return r;let u=t.band??1,a=e.length+Ms*2,b=Math.min(a-1,Math.floor(o*a))-Ms,k=K=>{let ee=Math.abs(K-b);return ee>u?0:1-ee/(u+1)},C="",_=0,O=null,F=0,W=0;for(let K of e){let ee=k(W);O===null?O=ee:ee!==O&&(C+=he(e.slice(_,F),{fg:ke(t.rest,t.lit,O)},de),_=F,O=ee),F+=K.length,W+=1}return C+he(e.slice(_),{fg:ke(t.rest,t.lit,O??0)},de)}function Jn(e,t,n=Date.now(),r=90){let o=t[0]??Yl("#e6e6e6");if(t.length===0||e.length===0)return he(e,{fg:o},de);if(!ue||r<=0)return he(e,{fg:t[t.length-1]??o},de);let u=t.length*r,a=(n%u+u)%u,g="",b=0,k=null,C=0,_=0,O=F=>{let W=(a+F*r)/u%1*t.length,K=Math.floor(W)%t.length,ee=(K+1)%t.length;return ke(t[K]??o,t[ee]??o,W-Math.floor(W))};for(let F of e){let W=O(_);k===null?k=W:W!==k&&(g+=he(e.slice(b,C),{fg:k},de),b=C,k=W),C+=F.length,_+=1}return g+he(e.slice(b),{fg:k??o},de)}function Zl(e,t){let n=Math.abs(e-t);return n>=Cs?0:Math.ceil((1-n/Cs)*Es)/Es}function Ls(e,t,n=Date.now()){let r=t.charMs??Jl;if(!ue||e.length===0||r<=0)return he(e,{fg:t.base},de);let o=e.length+As*2,u=n/r%o-As,a=(O,F)=>he(O,{fg:ke(t.base,t.bright,F)},de),g="",b=0,k=null,C=0,_=0;for(let O of e){let F=Zl(_,u);k===null?k=F:F!==k&&(g+=a(e.slice(b,C),k),b=C,k=F),C+=O.length,_+=1}return g+a(e.slice(b),k??0)}import{readFileSync as Ql,statSync as ec}from"node:fs";import{homedir as tc}from"node:os";import{extname as nc}from"node:path";var Xn="\x1B[200~",Zn="\x1B[201~",rc={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp"},Os=10*1024*1024,ic=256*1024,oc=20;function Ns(e){if(!e.startsWith(Xn)||!e.endsWith(Zn))return;let t=e.slice(Xn.length,e.length-Zn.length);if(!(t.includes(Xn)||t.includes(Zn)))return t}function Fs(e){return e.trim()===""}function sc(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")||e.startsWith("/")||e==="~"||e.startsWith("~/")}function ac(e,t=tc()){let n=e.trim();return n.startsWith("file://")&&(n=decodeURIComponent(n.slice(7)),/^\/[a-zA-Z]:\//.test(n)&&(n=n.slice(1))),!/^[a-zA-Z]:[\\/]/.test(n)&&!n.startsWith("\\\\")&&(n=n.replace(/\\([ ()'&])/g,"$1")),n==="~"?t:n.startsWith("~/")?t+n.slice(1):n}function js(e,t){let n=e.trim();if(!n||n.length>8192)return;let r,o=[...n.matchAll(/"([^"]+)"|'([^']+)'/g)].map(a=>a[1]??a[2]??"");if(o.length>0&&n.replace(/"[^"]+"|'[^']+'/g,"").trim()===""?r=o:r=n.split(/\r?\n/).map(a=>a.trim()).filter(a=>a.length>0),r.length===0||r.length>oc||!r.every(a=>sc(a)||a.startsWith("file://")))return;let u=r.map(a=>ac(a));return u.every(t)?u:void 0}function Ds(e){return rc[nc(e).toLowerCase()]}function Ws(e){return`[file ${e}]`}function Qn(e){return`[image ${e}]`}function Us(e,t){return e.replace(/\[file ([^\]\n]+)\]/g,(n,r)=>{let o=t(r);return o===void 0?n:`<file name="${r}">
3
3
  ${o.trimEnd()}
4
4
  </file>`})}function Bs(e){try{let t=ec(e);if(!t.isFile()||t.size===0||t.size>ic)return;let n=Ql(e);return n.includes(0)?void 0:n.toString("utf8")}catch{return}}import{Markdown as Tc,wrapTextWithAnsi as Ec}from"@netrodev/hxf-tui";import{homedir as lc}from"node:os";import{isAbsolute as cc,relative as dc,resolve as uc,sep as Vs}from"node:path";import{getImageDimensions as fc,imageFallback as Ks,renderImage as mc}from"@netrodev/hxf-tui";var pc="\u25CF",nr="\u2514",Ft="\u22EF",er=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function rt(e=1e3/30){let t=Math.floor(Date.now()/e)%er.length;return er[t]??er[0]}var gc="\u25B2";var hc="\u25CB",bc=["create_object","set_properties","delete_object","clone_instance","reparent_instance","set_script_source","edit_script_lines","insert_script_lines","execute_luau","generate_mesh","generate_material","generate_procedural_model"];function rr(e){return e.includes("__")?e.slice(e.lastIndexOf("__")+2):e}function zs(e){return bc.includes(rr(e))}function tt(e,t=process.cwd()){if(!e||!cc(e))return e;let n=uc(e),r=dc(t,n);if(r==="")return".";if(r&&!r.startsWith(`..${Vs}`)&&r!=="..")return r;let o=lc();return o&&(n===o||n.startsWith(o+Vs))?`~${n.slice(o.length)}`:n}function ae(e,t){let n=e.replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,Math.max(1,t-1))}\u2026`:n}function U(e,t){if(e&&typeof e=="object"){let n=e[t];if(typeof n=="string"&&n.length>0)return n;if(typeof n=="number")return String(n)}}function wc(e,t=160){if(!e||typeof e!="object")return"";try{let n=JSON.stringify(e);return n&&n!=="{}"?ae(n,t):""}catch{return""}}function yc(e,t){switch(e){case"read":{let n=tt(U(t,"path")??""),r=[U(t,"offset"),U(t,"limit")].filter(Boolean);return r.length>0?`${n} ${r.length===1?`offset=${r[0]}`:`offset=${r[0]}, limit=${r[1]}`}`:n}case"edit":case"write":return tt(U(t,"path")??"");case"bash":case"powershell":{let n=U(t,"command")??"";return t?.run_in_background===!0?`${n} [background]`:n}case"bash_output":{let n=U(t,"task_id"),r=U(t,"filter");return n?r?`${n} filter=${r}`:n:"all tasks"}case"kill_shell":return U(t,"task_id")??"";case"compress":{let n=U(t,"topic")??"",r=Array.isArray(t.content)?t.content.length:0;return r>1?`${n} (${r} ranges)`:n}case"grep":{let n=U(t,"pattern")??"",r=U(t,"path");return r?`${n} in ${tt(r)}`:n}case"find":case"glob":{let n=U(t,"pattern")??U(t,"glob")??"",r=U(t,"path");return r?`${n} in ${tt(r)}`:n}case"ls":return tt(U(t,"path")??".");case"task":return U(t,"agent")??"task";case"ask":return U(t,"question")??"";case"web_search":return U(t,"query")??"";case"web_fetch":return U(t,"url")??"";case"lsp":{let n=U(t,"action")??"lsp",r=U(t,"file")??"",o=U(t,"line");return o?`${n} ${r}:${o}`:`${n} ${r}`}case"quality":return U(t,"path")??"changed files";case"think":return"private";case"todo":{let n=U(t,"op")??"view",r=U(t,"task"),o=t?.items;return n==="init"&&Array.isArray(o)?`init ${o.length} task${o.length===1?"":"s"}`:r?`${n} ${r}`:n}case"context":{let n=U(t,"op")??"list",r=U(t,"key");return r?`${n} ${r}`:n}case"workflow":{let n=U(t,"path");if(n)return n;let r=U(t,"code")??"",o=/export\s+const\s+meta\s*=\s*\{[\s\S]*?name\s*:\s*["'`]([^"'`]+)/.exec(r)?.[1];if(o)return o;let u=r.trim().split(`
@@ -138,4 +138,4 @@ plan file: ${Wo()??"(unknown)"}`);return}if(s==="goal"){let d=l.trim();if(!d){m(
138
138
  ${Dn(p)}`);return}if(s==="session"){let d=$.model;m("session",d?`${d.provider}/${d.id}`:"no model");return}if(s==="skills"){m("skills",ws($.resourceLoader.getSkills().skills));return}if(s==="preset"){xi(l);return}if(s==="roblox"){let d=se(e.cwd).entries.find(x=>x.manifest.name==="rotoolbox");if(!d||d.source!=="installed"){m("roblox","RoToolbox is not installed. Run /preset and install RoToolbox first.");return}let p=Sn(d.dir),w=$.getActiveToolNames().filter(x=>/roblox[-_]studio/i.test(x)),h=w.length>0;m("roblox",p?`RoToolbox: disabled
139
139
  Enable with /preset enable rotoolbox
140
140
  The MCP server and manager stay stopped while disabled.`:["RoToolbox: active",`MCP server: ${h?`connected \u2014 ${w.length} tool${w.length===1?"":"s"} registered`:"not connected yet"}`,"Open Roblox Studio with a place, then use a prompt to inspect it.","Disable with /preset disable rotoolbox"].join(`
141
- `));return}let f=bs(i,$.resourceLoader.getSkills().skills.map(d=>d.name));if(f){ai(f);return}let y=$.extensionRunner.getCommand(s??"");if(y){try{await y.handler(l,$.extensionRunner.createCommandContext())}catch(d){G(d instanceof Error?d.message:String(d))}return}m("command",`/${s??""} is not available in this screen yet`)};Io((i,s)=>{let{promise:c,resolve:l}=Promise.withResolvers();return j(i,s.map(f=>({value:f,label:f})),l,()=>l("cancelled")),c}),process.on("SIGTERM",Ge),ks(()=>{Ge()}),t.setTitle(`${vn} ${wt}`),Yd(),r.start(),r.requestRender(!0),gn(!0);{let{maybeShowWelcome:i}=await import("./chunk-PMWAHAZV.js");await i({cwd:e.cwd,note:e.note,signedIn:be!==void 0,runSlash:s=>{Je(s)},openExternal:s=>{Fe(s)}},j,m)}e.initialPrompt&&hn(e.initialPrompt),await new Promise(()=>{})}var Z,Jd=1e3/30,Xd=45e3;export{Pr as Dock,Er as Hud,Mr as PinnedBlock,Hd as approvalDetail,Gd as infoPanel,_t as orderModelsForDefault,Kd as pickerPanel,Im as runWorkbench,Cr as slashCommands,qd as workflowPanel,Yt as workflowPanelFromRun,Rr as workflowRunOf};
141
+ `));return}let f=bs(i,$.resourceLoader.getSkills().skills.map(d=>d.name));if(f){ai(f);return}let y=$.extensionRunner.getCommand(s??"");if(y){try{await y.handler(l,$.extensionRunner.createCommandContext())}catch(d){G(d instanceof Error?d.message:String(d))}return}m("command",`/${s??""} is not available in this screen yet`)};Io((i,s)=>{let{promise:c,resolve:l}=Promise.withResolvers();return j(i,s.map(f=>({value:f,label:f})),l,()=>l("cancelled")),c}),process.on("SIGTERM",Ge),ks(()=>{Ge()}),t.setTitle(`${vn} ${wt}`),Yd(),r.start(),r.requestRender(!0),gn(!0);{let{maybeShowWelcome:i}=await import("./chunk-VCDC3RAJ.js");await i({cwd:e.cwd,note:e.note,signedIn:be!==void 0,runSlash:s=>{Je(s)},openExternal:s=>{Fe(s)}},j,m)}e.initialPrompt&&hn(e.initialPrompt),await new Promise(()=>{})}var Z,Jd=1e3/30,Xd=45e3;export{Pr as Dock,Er as Hud,Mr as PinnedBlock,Hd as approvalDetail,Gd as infoPanel,_t as orderModelsForDefault,Kd as pickerPanel,Im as runWorkbench,Cr as slashCommands,qd as workflowPanel,Yt as workflowPanelFromRun,Rr as workflowRunOf};
@@ -1 +1 @@
1
- import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i}from"./chunk-VZZPQZDI.js";import"./chunk-W34I6VMP.js";import"./chunk-DK3DYJTA.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{b as CLI_REFRESH_SKEW_MS,c as accessTokenIsFresh,g as clearCliCredential,a as cliCredentialsPath,e as readCliCredential,h as refreshCliCredential,d as refreshTokenIsUsable,i as renewCliCredentialIfNeeded,f as writeCliCredential};
1
+ import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i}from"./chunk-YUS7EX6B.js";import"./chunk-VSVEFNSH.js";import"./chunk-EF3Z3FAO.js";import"./chunk-UTYFLLSM.js";import"./chunk-WOT6VMZA.js";export{b as CLI_REFRESH_SKEW_MS,c as accessTokenIsFresh,g as clearCliCredential,a as cliCredentialsPath,e as readCliCredential,h as refreshCliCredential,d as refreshTokenIsUsable,i as renewCliCredentialIfNeeded,f as writeCliCredential};