fluxflow-cli 4.26.0 → 4.26.2
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/dist/chunks/{ai-CANLJJ2L.js → ai-26X3QUNA.js} +1 -1
- package/dist/chunks/{app-2JPMBSNL.js → app-DO3YQ6AT.js} +3 -3
- package/dist/chunks/{chunk-PYZ4PPIR.js → chunk-6UHYIQYC.js} +93 -5
- package/dist/chunks/chunk-PSAFKMCL.js +12 -0
- package/dist/chunks/chunk-QXN5B2BR.js +33 -0
- package/dist/chunks/{chunk-TURMMMY5.js → chunk-Y5H7A7H3.js} +8 -4
- package/dist/chunks/{exec_command-J23EG77W.js → exec_command-AB4DNQYP.js} +1 -1
- package/dist/chunks/{generate_image-MTPDDZY7.js → generate_image-DJ5N72HD.js} +1 -1
- package/dist/chunks/{invoke-VUBKZKFI.js → invoke-7BVHSLMJ.js} +2 -2
- package/dist/chunks/{invokeSync-EJMZYWUM.js → invokeSync-CJLYOYER.js} +2 -2
- package/dist/chunks/{usage-DWONGEYS.js → usage-73HUG5FC.js} +1 -1
- package/dist/chunks/{usageServer-AXINXVIN.js → usageServer-YEZAZDI6.js} +1 -1
- package/dist/cli.js +5 -5
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/surprise.js +15 -1
- package/dist/chunks/chunk-LKJUPSJM.js +0 -9
- package/dist/chunks/chunk-RTT7P5KS.js +0 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as s,B as t,j as b,k as c,l as d,m as e,n as f,o as g,p as h,q as i,r as j,s as k,t as l,u as m,v as n,w as o,x as p,y as q,z as r}from"./chunk-
|
|
1
|
+
import{A as s,B as t,j as b,k as c,l as d,m as e,n as f,o as g,p as h,q as i,r as j,s as k,t as l,u as m,v as n,w as o,x as p,y as q,z as r}from"./chunk-Y5H7A7H3.js";import"./chunk-JS5ZIGFR.js";import"./chunk-56EJGQU3.js";import"./chunk-7SFAWGE2.js";import"./chunk-U2NRX2PX.js";import"./chunk-VYTQ6J56.js";import"./chunk-RZTZPIC5.js";import"./chunk-6NWU3ML6.js";import"./chunk-FQBBOFNP.js";import"./chunk-Y5JU726N.js";import"./chunk-HM3CMNOJ.js";import"./chunk-PSAFKMCL.js";import"./chunk-ZLWYMCCW.js";import{k as a}from"./chunk-QWTKV7Q4.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{c as RE_LEADING_THINK,q as compressHistory,b as convertChannelThinkTags,r as deleteChatSummary,e as findGenuineThinkClose,p as generateSimpleContent,s as getAIStream,j as getCleanGroupedLength,m as getGoogleClient,f as getLeadingThinkBlock,o as initAI,d as isInsideBacktick,a as isModelMultimodal,l as isTerminationSignaled,n as runJanitorTask,t as runSubagent,k as signalTermination,g as stripLeadingThinking,h as stripNakedXmlTags,i as stripTrailingFluffAfterTools};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as ll,a as Yi,b as Je,c as nt,d as Cr,e as vr,f as zi,g as Ms,h as Jo,i as Br,s as nl,v as rl,w as Kn,y as sl,z as il}from"./chunk-
|
|
1
|
+
import{A as ll,a as Yi,b as Je,c as nt,d as Cr,e as vr,f as zi,g as Ms,h as Jo,i as Br,s as nl,v as rl,w as Kn,y as sl,z as il}from"./chunk-Y5H7A7H3.js";import{a as Ht,b as Ki,c as qi}from"./chunk-JS5ZIGFR.js";import{b as Ri,c as el,d as tl}from"./chunk-SZYN3VHU.js";import{a as ol}from"./chunk-56EJGQU3.js";import"./chunk-7SFAWGE2.js";import{c as Vi,e as Sn,f as jt,g as ji}from"./chunk-QXN5B2BR.js";import"./chunk-U2NRX2PX.js";import{a as Zi}from"./chunk-A73NNVCZ.js";import{a as Fo,b as Cn,d as Er,e as ys,f as Qi,h as Ji,i as jn}from"./chunk-VYTQ6J56.js";import"./chunk-RZTZPIC5.js";import{a as Et,b as xt,d as Xi,e as ht,f as Wi,j as Ts,k as ws,l as Gn,n as Gi,o as Co}from"./chunk-6NWU3ML6.js";import{a as Vn}from"./chunk-FQBBOFNP.js";import{a as Yn}from"./chunk-Y5JU726N.js";import{b as Mn,c as xs,k as Ni}from"./chunk-HM3CMNOJ.js";import{b as bs}from"./chunk-6UHYIQYC.js";import{a as Fi,b as Ui,f as $i,g as Mr,h as Sr,j as vt,k as Qo,l as ps,r as _i}from"./chunk-PSAFKMCL.js";import{a as hs,b as Pt}from"./chunk-ZLWYMCCW.js";import{d as Di,e as ki,f as Ii,g as Ai,h as Li,i as Pi,k as yr,m as No,n as go,o as Oi}from"./chunk-QWTKV7Q4.js";import{c as Tr,d as Bi,e as wr}from"./chunk-L3W2X74K.js";import{e as Hi}from"./chunk-NYIPDIEQ.js";import{a as ro,b as zo,c as mo,d as gs,e as fs,k as Wn}from"./chunk-DSVLWYIT.js";import Ys from"os";import e,{useState as J,useEffect as rt,useRef as Ke,useMemo as kn}from"react";import{Box as u,Text as l,useInput as Kd,useStdout as qd,Static as zd}from"ink";import Qd from"ink-spinner";import et from"fs-extra";import St from"path";import{exec as wo}from"child_process";import{fileURLToPath as Jd}from"url";import Ut,{useState as Dr,useEffect as Ss,useMemo as qn,useCallback as ba,useRef as vo}from"react";import{Box as Ta,Text as so,useInput as wa}from"ink";function ya(t,g){return t.replace(/\t/g," ".repeat(g))}function kr(t){return t==null?"":t.replace(/\r\n/g,`
|
|
2
2
|
`).replace(/\r/g,`
|
|
3
3
|
`)}function Zo(t,g,h){let y=t,T=[...g].sort((s,k)=>s.start-k.start),b=0;for(let s of T){let k=s.start-b,x=kr(s.text).split(`
|
|
4
4
|
`).length,I=s.text.length,A=(x>3?`[Pasted ${x} lines]`:`[Pasted ${I} chars]`).length,H=k+A;if(t<=k)break;if(t<H){y=s.end;break}else{let S=s.text.length-A;y+=S,b+=S}}return Math.min(y,h.length)}function Cs(t,g,h,y,T=[]){let b=(t||"").slice(0,g),s=y(b).length,k=y(t||""),x=[...T].sort((N,L)=>L.start-N.start);for(let N of x){let L=y(t.slice(0,N.start)).length,_=y(N.text),Q=L+_.length,ge=kr(N.text).split(`
|
|
@@ -41,7 +41,7 @@ import{A as ll,a as Yi,b as Je,c as nt,d as Cr,e as vr,f as zi,g as Ms,h as Jo,i
|
|
|
41
41
|
`),terminalWidth:g,theme:b}));if(x==="diff-line"){let{isFirstLine:S,isLastLine:C}=t,P=(N=!1)=>r.createElement(E,{backgroundColor:s.codeBg,paddingX:1,width:g,marginBottom:N?1:0},r.createElement(E,{width:3,flexShrink:0}),r.createElement(E,{width:1,flexShrink:0,marginLeft:1}),r.createElement(E,{flexGrow:1,marginLeft:1},r.createElement(oe,null," ")));return r.createElement(E,{flexDirection:"column"},S&&P(!1),r.createElement(xl,{line:I,pairContent:t.pairContent,parentText:void 0,columns:g,theme:b}),C&&P(!0))}if(x==="code-fence-open"){let S={paddingLeft:2,width:"100%"};return r.createElement(E,{flexDirection:"column",marginTop:0,marginBottom:0,width:"100%"},r.createElement(E,{flexDirection:"row",...S},r.createElement(oe,null," ")),r.createElement(E,{flexDirection:"row",...S},r.createElement(oe,{color:"gray",bold:!0},"\u25B6_ ",(I||"TEXT").toUpperCase())))}if(x==="code-line"){let{lineNum:S,lang:C}=t,P=g-12,L=xt(I,Math.max(10,P)).split(`
|
|
42
42
|
`);return r.createElement(E,{flexDirection:"column",width:"100%"},L.map((_,Q)=>r.createElement(E,{key:Q,flexDirection:"row",borderColor:s.codeBorder,paddingLeft:2,width:"100%"},r.createElement(E,{width:5,flexShrink:0},r.createElement(oe,{color:"gray",dimColor:!0},Q===0?String(S).padStart(4," ")+" ":" ")),r.createElement(E,{flexGrow:1},Ot(_,C,s.text)))))}if(x==="code-fence-close")return r.createElement(E,{flexDirection:"row",paddingLeft:2,marginBottom:1,width:"100%"},r.createElement(oe,null," "));if(x==="write-header")return r.createElement(E,{flexDirection:"column",paddingX:1,width:g},r.createElement(En,{text:I,columns:g,theme:b}));if(x==="write-line"){let{gutterWidth:S,lineNum:C,isFirstLine:P,isLastLine:N,extension:L,wrappedLines:_}=t,Q=(ge=!1)=>r.createElement(E,{flexDirection:"row",width:g,borderStyle:"single",borderLeft:!1,borderRight:!1,borderTop:!1,borderBottom:!1,borderColor:s.codeBorder,paddingLeft:2,paddingRight:0,backgroundColor:s.codeBg,marginBottom:ge?1:0},r.createElement(E,{width:S+2,flexShrink:0},r.createElement(oe,null," ".repeat(S+2))),r.createElement(E,{flexGrow:1},r.createElement(oe,null," ")));return r.createElement(E,{flexDirection:"column"},P&&Q(!1),r.createElement(E,{flexDirection:"row",width:g,borderStyle:"single",borderLeft:!1,borderRight:!1,borderTop:!1,borderBottom:!1,borderColor:s.codeBorder,paddingLeft:2,paddingRight:0,backgroundColor:s.codeBg},r.createElement(E,{width:S+2,flexShrink:0},r.createElement(oe,{color:"gray",dimColor:!0},String(C).padStart(S," ")," ")),r.createElement(E,{flexGrow:1,flexDirection:"column"},(_||[I]).map((ge,ye)=>r.createElement(E,{key:ye},Ot(ge,L,s.text))))),N&&Q(!0))}return x==="write-footer"?r.createElement(E,{flexDirection:"column",paddingX:1,width:g,marginTop:1,marginBottom:1},r.createElement(En,{text:I,columns:g,theme:b})):x==="worked-duration"?r.createElement(E,{marginTop:1,marginBottom:2,paddingX:1,width:"100%"},r.createElement(oe,{color:s.textMuted},"["),r.createElement(oe,{color:s.textMuted},"Worked for ",r.createElement(oe,{bold:!0,color:s.text},Lr(H))),r.createElement(oe,{color:s.textMuted},"]")):null}),Gc=r.memo(({messages:t,showFullThinking:g,columns:h=80,aiProvider:y,version:T,theme:b="Dark"})=>r.createElement(E,{flexDirection:"column",width:"100%"},t.map((s,k)=>r.createElement(hl,{key:s.id||k,msg:s,showFullThinking:g,columns:h,aiProvider:y,version:T,theme:b}))));import pt from"react";import{Box as Uo,Text as fo}from"ink";import{useState as Qn,useEffect as Jn,useRef as Or}from"react";var Zn=null;function pl(){Zn&&Zn()}var hd=t=>{if(t<=370)return"#00a564";if(t>=5e3)return"#ff0000";let g=[{t:370,r:0,g:165,b:100},{t:550,r:40,g:195,b:80},{t:800,r:120,g:220,b:50},{t:1100,r:190,g:225,b:20},{t:1500,r:250,g:210,b:15},{t:2e3,r:255,g:170,b:0},{t:2800,r:255,g:110,b:0},{t:3800,r:255,g:50,b:0},{t:5e3,r:255,g:0,b:0}];for(let h=0;h<g.length-1;h++){let y=g[h],T=g[h+1];if(t>=y.t&&t<=T.t){let b=(t-y.t)/(T.t-y.t);b=b*b*(3-2*b);let s=Math.round(y.r+(T.r-y.r)*b),k=Math.round(y.g+(T.g-y.g)*b),x=Math.round(y.b+(T.b-y.b)*b);return`#${((1<<24)+(s<<16)+(k<<8)+x).toString(16).slice(1)}`}}return"#ff0000"},pd=pt.memo(({mode:t,thinkingLevel:g,tokens:h="0.0k",tokensTotal:y="0.0k",cachedTokens:T=0,promptTokens:b=0,chatId:s="NEW-SESSION",isMemoryEnabled:k=!0,apiTier:x="Free",aiProvider:I="Google",activeModel:A="",isProcessing:H=!1,lastChunkTime:S=0,theme:C="Dark",wps:P=0,showTPMEstimate:N=!1})=>{let L=Je(C),_="",[Q,ge]=Qn(0),[ye,se]=Qn(0),[ie,pe]=Qn("MB"),[Be,Se]=Qn("green"),[Fe,le]=Qn(0),Ie=Or([]),be=Or(370),ee=Or([]),We=Or(S);Jn(()=>{We.current=S},[S]),Jn(()=>{if(!H){ee.current=[];return}if(P>0){let R=ee.current;R.push(P),R.length>3&&R.shift()}},[H,P,S]),Jn(()=>{if(!H){le(0);return}let R=setInterval(()=>{let te=We.current,Z=te>0?Date.now()-te:0;if(te>0&&Z>=1e3)ee.current=[],le(0);else if(te>0&&Z>500){ee.current.length>0&&ee.current.shift();let ae=ee.current;if(ae.length>0){let fe=ae.reduce((he,Ae)=>he+Ae,0);le(Math.round(fe/ae.length))}else le(0)}else{let ae=ee.current;if(ae.length>0){let fe=ae.reduce((he,Ae)=>he+Ae,0);le(Math.round(fe/ae.length))}else P>0&&le(Math.round(P))}},750);return()=>clearInterval(R)},[H]),Jn(()=>{if(!H){Ie.current=[];return}if(S>0){let Z=Ie.current;(Z.length===0||Z[Z.length-1]!==S)&&(Z.push(S),Z.length>10&&Z.shift())}let R=()=>{if(!S){Se("#00a564");return}let Z=Ie.current,ae=0;if(Z.length>1){let ne=0;for(let ce=1;ce<Z.length;ce++)ne+=Z[ce]-Z[ce-1];ae=ne/(Z.length-1)}let fe=Date.now()-S,Ae=fe>=2500,at=!Ae&&ae>0?Math.min(fe,ae*3):fe,Ze=Math.max(ae,at),ve=Ae?.4:.2;be.current=be.current*(1-ve)+Ze*ve,Se(hd(be.current))};R();let te=setInterval(R,100);return()=>clearInterval(te)},[H,S]);let me=()=>{let R=process.memoryUsage(),te=R.heapTotal/(1024*1024)>=1024,Z=te?"GB":"MB",ae=(fe,he)=>{let Ae=fe/(1048576*(he?1024:1));return he?parseFloat(Ae.toFixed(2)):Math.round(Ae)};pe(Z),se(ae(R.heapTotal,te)),ge(ae(R.heapUsed,te))};return Jn(()=>{Zn=me,me();let R=setInterval(()=>{me()},6e4);return()=>{clearInterval(R),Zn===me&&(Zn=null)}},[]),pt.createElement(Uo,{flexDirection:"row",justifyContent:"space-between",paddingX:1,width:"100%"},pt.createElement(Uo,null,pt.createElement(Uo,{marginRight:1},pt.createElement(fo,{color:L.textMuted},t.toLowerCase()==="flow"?"Studio":t.toLowerCase()==="icu"?"Computer Use":t.toLowerCase()==="flux"?"Workspace":"Omni")),pt.createElement(fo,{color:L.textMuted,dimColor:!0},"\u2503 "),pt.createElement(Uo,null,pt.createElement(fo,{color:L.text,italic:!0},Wi(process.cwd(),35)))),pt.createElement(Uo,null,H&&!N?pt.createElement(Uo,null,pt.createElement(fo,{color:Be},"\u25CF ")):null,H&&N&&pt.createElement(pt.Fragment,null,pt.createElement(fo,{color:L.textMuted},Fe," tok/s"),pt.createElement(fo,{color:L.textMuted,dimColor:!0}," \u2503")),h>0&&pt.createElement(pt.Fragment,null,pt.createElement(Uo,{marginX:1},pt.createElement(fo,{color:L.text},ht(y)," tok",(()=>{let R=typeof b=="number"?b:0,te=typeof T=="number"?T:0,Z=R>0?te/R*100:0;return Z<1?null:pt.createElement(fo,{color:L.success||"green",dimColor:!0}," [",Z.toFixed(0),"% cached]")})())),pt.createElement(fo,{color:L.textMuted,dimColor:!0},"\u2503")),pt.createElement(Uo,{marginLeft:1},pt.createElement(fo,{color:L.textMuted,bold:!0},Q," ",ie))))}),bl=pd;import st,{useState as Bs,useMemo as bd,useEffect as Td}from"react";import{Box as Xt,Text as Kt,useInput as wd}from"ink";import yd from"ink-select-input";var Md=({label:t,isSelected:g,theme:h="Dark"})=>{let y=Je(h),T=t==="Cancel"||t==="Back"||t.toLowerCase().includes("exit")||t.toLowerCase().includes("back");return st.createElement(Xt,{marginTop:T?1:0,backgroundColor:g?y.highlightBg:void 0,paddingX:1,width:"100%"},st.createElement(Kt,{color:g?y.text:y.textMuted,bold:g},g?"\u276F ":" ",t))};function bt({title:t,subtitle:g,items:h=[],onSelect:y,theme:T="Dark",searchable:b=!1}){let s=Je(T),[k,x]=Bs(""),[I,A]=Bs(0),[H,S]=Bs("list"),C=bd(()=>{if(!b||!k.trim())return h;let P=k.toLowerCase().trim();return h.filter(N=>N.label&&N.label.toLowerCase().includes(P))},[h,k,b]);return Td(()=>{A(0)},[k]),wd((P,N)=>{if(b){if(N.upArrow){S("list"),A(L=>C.length>0?L>0?L-1:C.length-1:0);return}if(N.downArrow){S("list"),A(L=>C.length>0&&L<C.length-1?L+1:0);return}if(N.return){C.length>0&&C[I]&&y(C[I]);return}if(N.escape){if(k)x(""),S("list"),A(0);else{let L=h.find(_=>_.value==="Back"||_.label==="Back"||_.value==="Cancel"||_.label==="Cancel");L&&y(L)}return}if(N.backspace||N.delete){S("search"),x(L=>L.slice(0,-1));return}if(P&&!N.ctrl&&!N.meta&&!N.tab){S("search"),x(L=>L+P);return}}},{isActive:b}),b?st.createElement(Xt,{flexDirection:"column",borderStyle:"round",borderColor:s.borderMuted,padding:0,marginTop:0,flexShrink:0,width:"100%"},t&&st.createElement(Xt,{paddingX:1,paddingY:0,marginBottom:0},st.createElement(Kt,{color:s.text,bold:!0},typeof t=="string"?t.toUpperCase():t)),g&&st.createElement(Xt,{paddingX:1,marginBottom:0},st.createElement(Kt,{color:s.textMuted,italic:!0}," ",g)),st.createElement(Xt,{paddingX:1,marginTop:1,marginBottom:1,flexDirection:"row"},st.createElement(Kt,{color:H==="search"?s.primary||"cyan":s.textMuted,bold:H==="search"},"\u{1F50D} Search:"),st.createElement(Kt,{color:s.text,bold:!0}," ",k),H==="search"?st.createElement(Kt,{color:s.primary||"cyan"},"\u2588"):k?null:st.createElement(Kt,{color:s.textMuted,italic:!0}," (type to search...)")),st.createElement(Xt,{flexDirection:"column",width:"100%"},C.length===0?st.createElement(Xt,{paddingX:1,marginY:0},st.createElement(Kt,{color:s.warning||"yellow",italic:!0}," No matching items found")):C.map((P,N)=>{let L=N===I,_=P.label==="Cancel"||P.label==="Back"||P.label.toLowerCase().includes("exit")||P.label.toLowerCase().includes("back");return st.createElement(Xt,{key:P.value??P.label??N,marginTop:_?1:0,backgroundColor:L?s.highlightBg:void 0,paddingX:1,width:"100%"},st.createElement(Kt,{color:L?s.text:s.textMuted,bold:L},L?"\u276F ":" ",P.label))})),st.createElement(Xt,{paddingX:1,marginTop:1},st.createElement(Kt,{color:s.textMuted,italic:!0},H==="search"?"(Type letters to search \u2022 Arrows for list mode \u2022 Enter to select)":"(Arrows to navigate \u2022 Type letters to search \u2022 Enter to select)"))):st.createElement(Xt,{flexDirection:"column",borderStyle:"round",borderColor:s.borderMuted,padding:0,marginTop:0,flexShrink:0,width:"100%"},t&&st.createElement(Xt,{paddingX:1,paddingY:0,marginBottom:g?0:1},st.createElement(Kt,{color:s.text,bold:!0},typeof t=="string"?t.toUpperCase():t)),g&&st.createElement(Xt,{paddingX:1,marginBottom:1},st.createElement(Kt,{color:s.textMuted,italic:!0}," ",g)),st.createElement(Xt,{flexDirection:"column",width:"100%"},st.createElement(yd,{items:h,onSelect:y,itemComponent:P=>st.createElement(Md,{...P,theme:T}),indicatorComponent:()=>null})),st.createElement(Xt,{paddingX:1,marginTop:1},st.createElement(Kt,{color:s.textMuted,italic:!0},"(Arrows to select \u2022 Enter to confirm)")))}import v,{useState as At,useEffect as Rn}from"react";import{Box as Ne,Text as j,useInput as Sd}from"ink";import Cd from"ink-text-input";import vd from"v8";import Tl from"os";var xo=[...Object.keys(Yi),"Mystery"],ho=[{id:"appearance",label:"Appearance",desc:"Customize UI theme & rendering options"},{id:"memory",label:"Memory",desc:"Manage system context & agent's memory"},{id:"other",label:"Miscellaneous",desc:"Miscellaneous preferences"},{id:"providers",label:"Providers",desc:"Configure AI models"},{id:"security",label:"Security",desc:"Configure permissions & data safety"},{id:"updater",label:"Updater",desc:"Manage application updates"},{id:"exit",label:"Exit Settings",desc:"Return to chat view"}],wl=t=>{let g=t.autoApproveCommands||"",h=t.autoDisallowCommands||"",y=t.alwaysAskCommands||"",T=t.autoExec===!1&&t.allowExternalAccess===!1&&t.networkAccess===!1&&g===""&&h==="rm -rf, rm -f, del /f, del /q, rd /s, rmdir /s, format, mkfs, dd if=/dev, shred, srm, Remove-Item -Recurse -Force, Initialize-Disk, Clear-Disk, format c:, flashrom, nvram -c"&&y==="killall, pkill, taskkill, shutdown, reboot, init 0, init 6, Stop-Process, Stop-Service, mv /*, move c:\\*, chmod 000, chmod -R 777, chown, icacls, netsh advfirewall, iptables -F, ufw disable, git reset --hard, git clean -fd, npm r, npm uninstall"&&t.autoApproveGit===!1,b=t.autoExec===!0&&t.allowExternalAccess===!1&&t.networkAccess!==!1&&g==="ls, dir, cat, type, echo, pwd, cd, git status, git log, git diff, git branch, git show, help, mkdir, touch, md, whoami, hostname, ps, Get-Process, date, time, mkdir"&&h==="rm -rf, rm -f, del /f, del /q, rd /s, rmdir /s, format, mkfs, dd if=/dev, shred, srm, Remove-Item -Recurse -Force, Initialize-Disk, Clear-Disk, format c:, flashrom, nvram -c"&&y==="killall, pkill, taskkill, Stop-Process, mv /*, move c:\\*, chmod 000, chmod -R 777, chown, icacls, shutdown, reboot, init 0, init 6, git reset --hard, git clean -fd, npm r, npm uninstall"&&t.autoApproveGit===!1,s=t.autoExec===!0&&t.allowExternalAccess===!0&&t.networkAccess!==!1&&g==="ls, dir, cat, type, echo, pwd, cd, git status, git log, git diff, git branch, git show, help, mkdir, touch, md, whoami, hostname, ps, Get-Process, date, time, mkdir"&&h===""&&y==="rm -rf, rm -f, del /f, del /q, rd /s, rmdir /s, format, mkfs, dd if=/dev, shred, srm, Remove-Item -Recurse -Force, Initialize-Disk, Clear-Disk, format c:, flashrom, nvram -c"&&t.autoApproveGit===!0;return T?"Strict":b?"Balanced":s?"Autonomous":t.sandboxPreset||"Custom"},Ds=t=>!t||t.trim()===""?"None":t.length>40?t.substring(0,40)+"...":t;function Nr({systemSettings:t,setSystemSettings:g,apiTier:h,setActiveView:y,setInputConfig:T,saveSettings:b,quotas:s,setMessages:k,aiProvider:x,initialSelectingTheme:I=!1,onCloseTheme:A=null,setProviderReturnView:H=null}){let S=t.theme==="Chaos"||t.theme==="Mystery"?"Mystery":t.theme||"Dark",C=xo.indexOf(S),[P,N]=At("categories"),[L,_]=At(0),[Q,ge]=At(0),[ye,se]=At(null),[ie,pe]=At(""),[Be,Se]=At(I),[Fe,le]=At(C>=0?C:0),[Ie,be]=At(t.theme||"Dark"),[ee,We]=At(!1),[me,R]=At(0),[te,Z]=At(0),[ae,fe]=At(""),[he,Ae]=At("list"),[at,Ze]=At({});Rn(()=>{(async()=>{let w=["Google","DeepSeek","OpenRouter","NVIDIA","Mistral","Ollama","InferX","SenseNova","AIHubMix","Poolside","9router","ExpLabs","TokenHarbor","Infron","APInex"],U={};for(let Ee of w)try{await Mn(Ee)&&(U[Ee]=!0)}catch{}Ze(U)})()},[]);let ve=v.useMemo(()=>{let ue=["Google","DeepSeek","OpenRouter","NVIDIA","Mistral","Ollama","InferX","SenseNova","AIHubMix","Poolside","9router","ExpLabs","TokenHarbor","Infron","APInex"],U=!!(process.env.SUBAGENT_MODEL&&process.env.SUBAGENT_MODEL.trim())?`ENV (${process.env.SUBAGENT_MODEL.trim()})`:"ENV",Ee=[{label:"Default (use the current model)",value:"Default",isHeader:!1},{label:U,value:"ENV",isHeader:!1}],Xe=s?.providerTiers?.[x]||h||"Free",Re=No(x,Xe)||[];Re.length>0&&(Ee.push({label:`\u2500\u2500 ${x.toUpperCase()}${Xe!=="Free"?` (${Xe})`:""} \u2500\u2500`,isHeader:!0}),Re.forEach(it=>{let Ye=typeof it=="string"?it:it.cmd||it.name||it.id||String(it);Ye&&!Ye.trim().startsWith("---")&&!Ye.startsWith(`
|
|
43
43
|
---`)&&Ee.push({label:Ye,value:Ye,isHeader:!1,provider:x})}));for(let it of ue)if(it!==x&&at[it]){let Ye=s?.providerTiers?.[it]||"Free",qt=No(it,Ye)||[];qt.length>0&&(Ee.push({label:`\u2500\u2500 ${it.toUpperCase()}${Ye!=="Free"?` (${Ye})`:""} \u2500\u2500`,isHeader:!0}),qt.forEach(je=>{let kt=typeof je=="string"?je:je.cmd||je.name||je.id||String(je);kt&&!kt.trim().startsWith("---")&&!kt.startsWith(`
|
|
44
|
-
---`)&&Ee.push({label:kt,value:kt,isHeader:!1,provider:it})}))}return Ee},[x,h,s,at]),ne=v.useMemo(()=>{if(!ae.trim())return ve;let ue=ae.trim().toLowerCase(),w=[],U=null;for(let Ee of ve)Ee.isHeader?U=Ee:(Ee.label.toLowerCase().includes(ue)||Ee.value&&Ee.value.toLowerCase().includes(ue))&&(U&&!w.includes(U)&&w.push(U),w.push(Ee));return w},[ve,ae]);Rn(()=>{if(ee){let ue=ne.findIndex(w=>!w.isHeader);R(ue>=0?ue:0),Z(0)}},[ae]),Rn(()=>{if(ee){if(ne.length===0){R(0),Z(0);return}if(me>=ne.length||ne[me]?.isHeader){let ue=ne.findIndex(w=>!w.isHeader);R(ue>=0?ue:0)}}},[ne,ee]);let[ce,Ce]=At(0),[D,Ue]=At(0),[qe,Ct]=At("MB"),[Gt,Xr]=At(!1);Rn(()=>{let ue=!1;return import("./exec_command-J23EG77W.js").then(w=>{ue||Xr(!!w.isPtyAvailable)}).catch(()=>{}),()=>{ue=!0}},[]),Rn(()=>{let ue=vd.getHeapStatistics().heap_size_limit,w=ue>=1024*1024*1024,U=w?"GB":"MB",Ee=w?1024*1024*1024:1024*1024;Ue(parseFloat((ue/Ee).toFixed(2))),Ct(U);let Xe=()=>{let qt=process.memoryUsage().rss/Ee,je=w?parseFloat(qt.toFixed(2)):Math.round(qt);Ce(je)};Xe();let Re=setInterval(()=>{Xe()},3e4);return()=>clearInterval(Re)},[]);let en=ue=>{switch(ue){case"providers":{let U=[{label:"Current Provider",value:"aiProvider",status:x}];return x==="Ollama"&&U.push({label:"Endpoint",value:"ollamaEndpoint",status:t.ollamaEndpoint||"Cloud"}),U}case"appearance":return[{label:"Theme",value:"theme",status:t.theme||"Dark"},{label:"Loading Phrases",value:"loadingPhrases",status:t.loadingPhrases!==!1?"ON":"OFF"},{label:"Progressive Rendering [EXPERIMENTAL]",value:"progressiveRendering",status:t.progressiveRendering?"ON":"OFF"},{label:"Show TPM Estimate",value:"showTPMEstimate",status:t.showTPMEstimate?"ON":"OFF"},{label:"Verbose Thinking",value:"preserveThinking",status:t.preserveThinking!==!1?"ON":"OFF"}];case"memory":return[{label:"Toggle Memory [Legacy]",value:"memory",status:t.memory?"ON":"OFF"}];case"security":return[{label:"Sandbox Preset",value:"sandboxPreset",status:wl(t),section:"Sandbox"},{label:"YOLO Mode",value:"autoExec",status:t.autoExec?"ON":"OFF",section:"Sandbox"},{label:"External Workspace Access",value:"externalAccess",status:t.allowExternalAccess?"ON":"OFF",section:"Sandbox"},{label:"Network Access (Terminal)",value:"networkAccess",status:t.networkAccess!==!1?"ON":"OFF",section:"Sandbox"},{label:"Always Ask Commands",value:"alwaysAsk",status:Ds(t.alwaysAskCommands),section:"Sandbox"},{label:"Auto Approve Commands",value:"autoApprove",status:Ds(t.autoApproveCommands),section:"Sandbox"},{label:"Auto Disapprove Commands",value:"autoDisallow",status:Ds(t.autoDisallowCommands),section:"Sandbox"},{label:"Auto Approve Git Commits",value:"autoApproveGit",status:t.autoApproveGit?"ON":"OFF",section:"Sandbox"},{label:"Advanced Recovery [EXPERIMENTAL]",value:"advanceRollback",status:t.advanceRollback?"ON":"OFF",section:"Other"},{label:"Auto-Delete History",value:"autoDelete",status:t.autoDeleteHistory||"30d",section:"Other"},{label:"Save AppData Externally",value:"externalData",status:t.useExternalData?"ON":"OFF",section:"Other"}];case"updater":return[{label:"Auto-Update",value:"autoUpdate",status:t.autoUpdate?"ON":"OFF"},{label:"Preferred Package Manager",value:"updateManager",status:(t.updateManager||"npm")==="custom"?"Custom":(t.updateManager||"npm").toUpperCase()}];case"other":return[{label:"Sub-Agents",value:"subAgents",status:t.subAgents!==!1?"ON":"OFF"},{label:"Sub-Agent Model",value:"subAgentModel",status:t.CustomSubAgent&&t.SubAgentModel?t.SubAgentModel:"Default"},{label:"Directory Tree Design",value:"indentationTree",status:t.indentationTree!==!1?"Modern":"Legacy"},{label:"Compact Large Tool Results",value:"compressToolResults",status:t.compressToolResults?"ON":"OFF"},{label:"Auto Truncate Results",value:"autoTruncateResults",status:t.autoTruncateResults?"ON":"OFF"},{label:"Image History for CU",value:"imageHistoryCU",status:t.imageHistoryCU||"Standard"},{label:"Context Length",value:"contextLength",status:t.contextLength||"256k"},{label:"Keep Reasoning Context",value:"keepReasoningContext",status:t.keepReasoningContext?"ON":"OFF"},{label:"Auto Exclude Metadata",value:"autoExcludeMetadata",status:t.autoExcludeMetadata?"ON":"OFF"},{label:"Disable Todo",value:"disableTodo",status:t.disableTodo?"ON":"OFF"}];default:return[]}},tn=ho[L].id,Ge=en(tn);Sd((ue,w)=>{if(ee){if(w.tab){Ae(U=>U==="search"?"list":"search");return}if(he==="search"){w.escape?We(!1):w.downArrow||w.return?Ae("list"):w.backspace||w.delete?fe(U=>U.slice(0,-1)):ue&&!w.ctrl&&!w.meta&&ue.length===1&&fe(U=>U+ue);return}if(w.upArrow)R(U=>{if(ne.length===0)return 0;let Ee=(U-1+ne.length)%ne.length,Xe=0;for(;ne[Ee]?.isHeader&&Xe<ne.length;)Ee=(Ee-1+ne.length)%ne.length,Xe++;return Ee});else if(w.downArrow)R(U=>{if(ne.length===0)return 0;let Ee=(U+1)%ne.length,Xe=0;for(;ne[Ee]?.isHeader&&Xe<ne.length;)Ee=(Ee+1)%ne.length,Xe++;return Ee});else if(w.return){let U=ne[me];U&&!U.isHeader&&(g(Ee=>{let Xe=U.value==="Default",Re={...Ee,CustomSubAgent:!Xe,SubAgentModel:U.value,SubAgentProvider:Xe?"":U.provider||""};return b({systemSettings:Re,apiTier:h,quotas:s}),Re}),We(!1))}else w.escape?We(!1):ue&&!w.ctrl&&!w.meta&&ue.length===1&&(fe(U=>U+ue),Ae("search"));return}if(Be){if(w.upArrow){let U=(Fe-1+xo.length)%xo.length;le(U)}else if(w.downArrow){let U=(Fe+1)%xo.length;le(U)}else if(w.return){let U=xo[Fe];g(Ee=>{let Xe={...Ee,theme:U};return b({systemSettings:Xe,apiTier:h,quotas:s}),Xe}),A?A():Se(!1)}else w.escape&&(A?A():Se(!1));return}if(ye){w.escape&&se(null);return}if(P==="categories")w.upArrow?_(U=>(U-1+ho.length)%ho.length):w.downArrow?_(U=>(U+1)%ho.length):w.return||w.rightArrow?ho[L].id==="exit"?y("chat"):(N("items"),ge(0)):w.escape&&y("chat");else if(P==="items"){if(w.upArrow)ge(U=>(U-1+Ge.length)%Ge.length);else if(w.downArrow)ge(U=>(U+1)%Ge.length);else if(w.leftArrow||w.escape)N("categories");else if(w.return){let U=Ge[Q];Rt(U)}}});let Rt=ue=>{if(ue.value==="memory")g(w=>({...w,memory:!w.memory}));else if(ue.value==="sandboxPreset"){let w=wl(t),U=["Autonomous","Balanced","Strict"],Xe=(U.indexOf(w)+1)%U.length,Re=U[Xe];g(it=>{let Ye={...it,sandboxPreset:Re};return Re==="Strict"?(Ye.autoExec=!1,Ye.allowExternalAccess=!1,Ye.networkAccess=!1,Ye.autoApproveCommands="",Ye.autoDisallowCommands="rm -rf, rm -f, del /f, del /q, rd /s, rmdir /s, format, mkfs, dd if=/dev, shred, srm, Remove-Item -Recurse -Force, Initialize-Disk, Clear-Disk, format c:, flashrom, nvram -c",Ye.alwaysAskCommands="killall, pkill, taskkill, shutdown, reboot, init 0, init 6, Stop-Process, Stop-Service, mv /*, move c:\\*, chmod 000, chmod -R 777, chown, icacls, netsh advfirewall, iptables -F, ufw disable, git reset --hard, git clean -fd, npm r, npm uninstall",Ye.autoApproveGit=!1):Re==="Balanced"?(Ye.autoExec=!0,Ye.allowExternalAccess=!1,Ye.networkAccess=!0,Ye.autoApproveCommands="ls, dir, cat, type, echo, pwd, cd, git status, git log, git diff, git branch, git show, help, mkdir, touch, md, whoami, hostname, ps, Get-Process, date, time",Ye.autoDisallowCommands="rm -rf, rm -f, del /f, del /q, rd /s, rmdir /s, format, mkfs, dd if=/dev, shred, srm, Remove-Item -Recurse -Force, Initialize-Disk, Clear-Disk, format c:, flashrom, nvram -c",Ye.alwaysAskCommands="killall, pkill, taskkill, Stop-Process, mv /*, move c:\\*, chmod 000, chmod -R 777, chown, icacls, shutdown, reboot, init 0, init 6, git reset --hard, git clean -fd, npm r, npm uninstall",Ye.autoApproveGit=!1):Re==="Autonomous"&&(Ye.autoExec=!0,Ye.allowExternalAccess=!0,Ye.networkAccess=!0,Ye.autoApproveCommands="ls, dir, cat, type, echo, pwd, cd, git status, git log, git diff, git branch, git show, help, mkdir, touch, md, whoami, hostname, ps, Get-Process, date, time",Ye.autoDisallowCommands="",Ye.alwaysAskCommands="rm -rf, rm -f, del /f, del /q, rd /s, rmdir /s, format, mkfs, dd if=/dev, shred, srm, Remove-Item -Recurse -Force, Initialize-Disk, Clear-Disk, format c:, flashrom, nvram -c",Ye.autoApproveGit=!0),Ye})}else if(ue.value==="autoExec")t.autoExec?g(w=>({...w,autoExec:!1,sandboxPreset:"Custom"})):t.allowExternalAccess?y("doubleDanger"):y("autoExecDanger");else if(ue.value==="externalAccess")t.allowExternalAccess?g(w=>({...w,allowExternalAccess:!1,sandboxPreset:"Custom"})):t.autoExec?y("doubleDanger"):y("externalDanger");else if(ue.value==="networkAccess")g(w=>({...w,networkAccess:w.networkAccess===!1,sandboxPreset:"Custom"}));else if(ue.value==="alwaysAsk")se("alwaysAskCommands"),pe(t.alwaysAskCommands||"");else if(ue.value==="autoApprove")se("autoApproveCommands"),pe(t.autoApproveCommands||"");else if(ue.value==="autoApproveGit")g(w=>({...w,autoApproveGit:!w.autoApproveGit,sandboxPreset:"Custom"}));else if(ue.value==="autoDisallow")se("autoDisallowCommands"),pe(t.autoDisallowCommands||"");else if(ue.value==="ollamaEndpoint")g(w=>{let U=w.ollamaEndpoint==="Local"?"Cloud":"Local",Ee={...w,ollamaEndpoint:U};return b({systemSettings:Ee,apiTier:h,quotas:s}),Ee});else if(ue.value==="apiTier")y("apiTier");else if(ue.value==="aiProvider")H&&H("settings"),y("selectProvider");else if(ue.value==="advanceRollback")t.advanceRollback?g(w=>{let U={...w,advanceRollback:!1};return b({systemSettings:U,apiTier:h,quotas:s}),U}):y("advanceRollbackDanger");else if(ue.value==="autoDelete"){let w=["1d","7d","30d"],Ee=(w.indexOf(t.autoDeleteHistory||"30d")+1)%w.length;g(Xe=>({...Xe,autoDeleteHistory:w[Ee]}))}else if(ue.value==="autoUpdate")g(w=>({...w,autoUpdate:!w.autoUpdate}));else if(ue.value==="externalData")if(!t.useExternalData)T({label:"Enter absolute path for External AppData:",note:"All history, logs and secrets will be stored here. ~/.fluxflow/settings.json stays as anchor.",key:"externalDataPath",value:t.externalDataPath||""}),y("input");else{let w={...t,useExternalData:!1};g(w),b({systemSettings:w,apiTier:h,quotas:s}),k(U=>[...U,{id:Date.now(),role:"system",text:"[STORAGE RESET] Flux Flow will return to default ~/.fluxflow after restart."}]),y("chat")}else if(ue.value==="updateManager")y("updateManager");else if(ue.value==="parserDownload")y("parserDownload");else if(ue.value==="indentationTree")g(w=>{let U={...w,indentationTree:w.indentationTree===!1};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="compressToolResults")g(w=>{let U={...w,compressToolResults:!w.compressToolResults};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="autoTruncateResults")g(w=>{let U={...w,autoTruncateResults:!w.autoTruncateResults};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="imageHistoryCU"){let w=["Low","Standard","Extended","Max"],Ee=(w.indexOf(t.imageHistoryCU||"Standard")+1)%w.length;g(Xe=>{let Re={...Xe,imageHistoryCU:w[Ee]};return b({systemSettings:Re,apiTier:h,quotas:s}),Re})}else if(ue.value==="contextLength"){let w=["16k","32k","64k","128k","256k","512k","1M"],Ee=(w.indexOf(t.contextLength||"256k")+1)%w.length;g(Xe=>{let Re={...Xe,contextLength:w[Ee]};return b({systemSettings:Re,apiTier:h,quotas:s}),Re})}else if(ue.value==="keepReasoningContext")g(w=>{let U={...w,keepReasoningContext:!w.keepReasoningContext};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="autoExcludeMetadata")g(w=>{let U={...w,autoExcludeMetadata:!w.autoExcludeMetadata};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="disableTodo")g(w=>{let U={...w,disableTodo:!w.disableTodo};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="subAgents")g(w=>{let U={...w,subAgents:w.subAgents===!1};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="subAgentModel"){let w=t.CustomSubAgent&&t.SubAgentModel?t.SubAgentModel:"Default",U=ne.findIndex(Ee=>Ee.value===w);R(U>=0?U:0),We(!0)}else if(ue.value==="preserveThinking")g(w=>{let U={...w,preserveThinking:w.preserveThinking===!1};return ml(U.preserveThinking),b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="loadingPhrases")g(w=>{let U={...w,loadingPhrases:w.loadingPhrases===!1};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="progressiveRendering")g(w=>{let U={...w,progressiveRendering:!w.progressiveRendering};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="showTPMEstimate")g(w=>{let U={...w,showTPMEstimate:!w.showTPMEstimate};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="theme"){let w=t.theme==="Chaos"||t.theme==="Mystery"?"Mystery":t.theme||"Dark",U=xo.indexOf(w);le(U>=0?U:0),be(t.theme||"Dark"),Se(!0)}},Me=Je(t.theme);if(ee){let ue=t.CustomSubAgent&&t.SubAgentModel?t.SubAgentModel:"Default",w=15,U=te;me<U?U=me:me>=U+w&&(U=me-w+1),U=Math.max(0,Math.min(U,Math.max(0,ne.length-w))),U!==te&&Z(U);let Ee=ne.slice(U,U+w);return v.createElement(Ne,{flexDirection:"column",borderStyle:"round",borderColor:Me.border,padding:1,width:"100%",minHeight:32},v.createElement(Ne,{marginBottom:1,flexDirection:"row",justifyContent:"space-between"},v.createElement(j,{color:Me.text,bold:!0,underline:!0},"Select Sub-Agent Model:"),ne.length>0&&v.createElement(j,{color:"gray"},me+1,"/",ne.length)),v.createElement(Ne,{borderStyle:"single",borderColor:he==="search"?Me.primary||"cyan":"gray",paddingX:1,marginBottom:1},v.createElement(j,{color:he==="search"?Me.primary||"cyan":"gray",bold:!0},"\u{1F50D} Search: "," "),v.createElement(j,{color:Me.text},ae),he==="search"&&v.createElement(j,{color:Me.primary||"cyan"},"\u2588"),!ae&&he!=="search"&&v.createElement(j,{color:"gray",italic:!0},"(Press TAB or type to filter models...)")),v.createElement(Ne,{flexDirection:"column",flexGrow:1,height:w},Ee.length>0?Ee.map((Xe,Re)=>{let it=U+Re;if(Xe.isHeader)return v.createElement(Ne,{key:`hdr-${it}`,paddingX:1},v.createElement(j,{color:"gray",bold:!0,underline:!0},Xe.label));let Ye=me===it&&he==="list",qt=ue===Xe.value;return v.createElement(Ne,{key:`item-${Xe.value}-${it}`,paddingX:1,backgroundColor:Ye?Me.highlightBg:void 0},v.createElement(j,{color:Ye?Me.text:Me.textDim,bold:Ye},Ye?"\u276F ":" ",Xe.label,qt?v.createElement(j,{color:Me.primary||"cyan",italic:!0}," (active)"):""))}):v.createElement(Ne,{paddingX:1},v.createElement(j,{color:"gray",italic:!0},'No models matching "',ae,'"'))),v.createElement(Ne,{paddingX:1,marginTop:1,flexDirection:"row",justifyContent:"space-between"},v.createElement(j,{color:"gray",italic:!0},"TAB to switch search/list \u2022 \u25B2\u25BC Navigate \u2022 ENTER to Select \u2022 ESC to Cancel"),v.createElement(j,{color:he==="search"?Me.primary||"cyan":"gray",bold:!0},"[",he.toUpperCase()," MODE]")))}if(Be){let ue=xo[Fe],w=Je(ue);return v.createElement(Ne,{flexDirection:"column",borderStyle:"round",borderColor:w.border,padding:1,width:"100%",minHeight:32},v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:w.text,bold:!0},"Choose your color scheme:")),v.createElement(Ne,{flexDirection:"row",width:"100%",flexGrow:1},v.createElement(Ne,{flexDirection:"column",width:"30%",paddingRight:1},xo.map((U,Ee)=>{let Xe=Fe===Ee,Re=(t.theme||"Dark")===U,it=U==="Forest Sprite";return v.createElement(Ne,{key:U,paddingX:0},v.createElement(j,{color:Xe?w.text:w.textDim,bold:Xe},Xe?"> ":" ",U,it&&v.createElement(j,{color:Xe?w.success||"#52b788":"green",bold:!0}," \u2605"),Re?v.createElement(j,{color:w.primary||"cyan",italic:!0}," (saved)"):""))})),v.createElement(Ne,{flexDirection:"column",flexGrow:1,borderStyle:"round",borderColor:w.borderMuted,paddingX:2,paddingY:1,backgroundColor:w.cardBg},v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:w.secondary||"cyan",bold:!0},"> ","you: "),v.createElement(j,{color:w.text},"add a greeting function")),v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:w.success||"green"}," Here's the change:")),v.createElement(Ne,{flexDirection:"column",marginLeft:2,marginBottom:1},v.createElement(j,null,v.createElement(j,{color:w.textDim},"3 "),v.createElement(j,{color:w.textDim},' import "fmt"')),v.createElement(j,{color:w.textDim},"4"),v.createElement(Ne,{backgroundColor:w.diffRemovalBg},v.createElement(j,null,v.createElement(j,{color:w.diffRemovalNum||w.diffRemovalText},"5 "),v.createElement(j,{color:w.diffRemovalPrefix||w.diffRemovalText},"- "),v.createElement(j,{color:w.diffRemovalText},"func "),v.createElement(j,{color:w.diffRemovalHighlightColor||w.diffRemovalText,backgroundColor:w.diffRemovalHighlightBg,bold:!0},"main()"),v.createElement(j,{color:w.diffRemovalText}," {"))),v.createElement(Ne,{backgroundColor:w.diffAdditionBg},v.createElement(j,null,v.createElement(j,{color:w.diffAdditionNum||w.diffAdditionText},"5 "),v.createElement(j,{color:w.diffAdditionPrefix||w.diffAdditionText},"+ "),v.createElement(j,{color:w.diffAdditionText},"func "),v.createElement(j,{color:w.diffAdditionHighlightColor||w.diffAdditionText,backgroundColor:w.diffAdditionHighlightBg,bold:!0},"greet(name string)"),v.createElement(j,{color:w.diffAdditionText}," {"))),v.createElement(Ne,{backgroundColor:w.diffAdditionBg},v.createElement(j,null,v.createElement(j,{color:w.diffAdditionNum||w.diffAdditionText},"6 "),v.createElement(j,{color:w.diffAdditionPrefix||w.diffAdditionText},"+ "),v.createElement(j,{color:w.diffAdditionText}," "),v.createElement(j,{color:w.diffAdditionHighlightColor||w.diffAdditionText,backgroundColor:w.diffAdditionHighlightBg},'fmt.Printf("Hello, %s!\\n", name)'))),v.createElement(j,{color:w.textDim},"7 }")),v.createElement(Ne,{flexDirection:"column",marginTop:1,marginBottom:1},v.createElement(j,{color:w.textDim},"\u25BE Thought Process"),v.createElement(j,{color:w.textMuted}," I need to add a greeting function. I'll use fmt.Printf.")),v.createElement(Ne,{flexDirection:"column"},v.createElement(j,null,v.createElement(j,{color:w.warning||"yellow"},"\u2699 tool: "),v.createElement(j,{color:w.text},"write_file main.go")),v.createElement(j,null,v.createElement(j,{color:w.accent||"magenta"},"\u29BF task: "),v.createElement(j,{color:w.text},"Implementing greeting")),v.createElement(j,null,v.createElement(j,{color:w.danger||"red"},"X error: "),v.createElement(j,{color:w.text},"compilation failed")),v.createElement(j,null,v.createElement(j,{color:w.warning||"yellow"},"\u26A0 warning: "),v.createElement(j,{color:w.text},"deprecation warning")),v.createElement(j,null,v.createElement(j,{color:w.info||"blue"},"\u2192 link: "),v.createElement(j,{color:w.info||"blue",underline:!0},"file:///path/to/main.go")),v.createElement(j,null,v.createElement(j,{color:w.accent||"magenta"},"\u2605 accent: "),v.createElement(j,{color:w.text},"highlighted text")),v.createElement(j,{color:w.textDim},"\xB7 dim: press Enter to continue")))),v.createElement(Ne,{paddingX:1,marginTop:1,flexDirection:"row",justifyContent:"space-between"},v.createElement(j,{color:"gray",italic:!0},"\u25B2\u25BC Navigate \u2022 ENTER to Select \u2022 ESC to Cancel"),v.createElement(j,{color:"gray"},"Previewing: ",xo[Fe],xo[Fe]==="Forest Sprite"?" \u2605":"")))}return v.createElement(Ne,{flexDirection:"column",borderStyle:"round",borderColor:Me.border,padding:0,width:"100%",minHeight:32},v.createElement(Ne,{paddingX:1,paddingY:0,marginBottom:0,borderStyle:"single",borderColor:Me.borderMuted,width:"100%"},v.createElement(j,{color:Me.text,bold:!0},"SYSTEM CONFIGURATION")),v.createElement(Ne,{flexDirection:"row",width:"100%",minHeight:26},v.createElement(Ne,{flexDirection:"column",width:"30%",maxWidth:40,borderStyle:"round",borderColor:P==="categories"?Me.border:Me.borderMuted,padding:1,paddingY:0},v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:P==="categories"?Me.text:Me.textDim,bold:!0,underline:!0},"CATEGORIES")),ho.map((ue,w)=>{let U=L===w,Ee=ue.id==="exit";return v.createElement(Ne,{key:ue.id,marginTop:Ee?15:0,backgroundColor:U?P==="categories"?Me.highlightBg:Me.cardBg:void 0,paddingX:1},v.createElement(j,{color:U&&P==="categories"?Me.text:Me.textDim,bold:U},U?"\u276F ":" ",ue.label))})),v.createElement(Ne,{flexDirection:"column",flexGrow:1,borderStyle:"round",borderColor:P==="items"?Me.border:Me.borderMuted,paddingX:1,marginLeft:1,paddingY:0},v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:P==="items"?Me.text:Me.textDim,bold:!0,underline:!0},ho[L].label.toUpperCase().includes("EXIT")?"Runtime Information":`${ho[L].label} Settings`)),Ge.length>0?(()=>{let ue=null,w=[],U=je=>(je||"").split(",").map(kt=>kt.trim().toLowerCase()).filter(Boolean),Ee=U(t.autoApproveCommands),Xe=U(t.autoDisallowCommands),Re=U(t.alwaysAskCommands),it=[...Ee,...Xe,...Re],Ye=new Set(it),qt=tn==="security"&&it.length!==Ye.size;return Ge.forEach((je,kt)=>{let zt=P==="items"&&Q===kt,Wr=je.label.length,on=Math.max(2,38-Wr),Gr=".".repeat(on),mt=Le=>tn==="security"?(Le.value==="autoExec"||Le.value==="externalAccess")&&Le.status==="ON"?Me.statusOn:Me.statusOff:Le.status?.startsWith("\u2713")?Me.statusOn:Le.status?.startsWith("\u26A0")?Me.statusOff:Le.status==="ON"?Me.statusOn:Le.status==="OFF"?Me.statusOff:Me.text;je.section&&je.section!==ue&&(ue=je.section,w.push(v.createElement(Ne,{key:`sec-hdr-${je.section}`,marginTop:w.length>0?1:0,marginBottom:0,paddingX:1},v.createElement(j,{color:"gray",bold:!0,underline:!0},je.section.toUpperCase()))));let z=zt&&ye&&(ye==="alwaysAskCommands"&&je.value==="alwaysAsk"||ye==="autoApproveCommands"&&je.value==="autoApprove"||ye==="autoDisallowCommands"&&je.value==="autoDisallow"),lt=je.value==="alwaysAsk"||je.value==="autoApprove"||je.value==="autoDisallow",Wo=je.value==="parserDownload";w.push(v.createElement(Ne,{key:je.value,flexDirection:"column"},v.createElement(Ne,{backgroundColor:zt&&!z?Me.highlightBg:void 0,paddingX:2},v.createElement(j,{color:zt?Me.text:Me.textDim,bold:zt},zt?"\u276F ":" ",je.label),!lt&&!Wo&&v.createElement(v.Fragment,null,v.createElement(j,{color:"gray"},Gr),v.createElement(j,{color:mt(je),bold:!0},je.value==="aiProvider"?je.status:`[ ${je.status} ]`))),lt&&!z&&je.status!=="None"&&v.createElement(Ne,{paddingX:4,marginBottom:1},v.createElement(j,{color:"gray"},"\u21B3 ",je.status)),z&&v.createElement(Ne,{flexDirection:"column",marginLeft:4,marginBottom:1},v.createElement(Ne,{paddingX:1,borderStyle:"single",borderColor:"gray",flexDirection:"row"},v.createElement(j,{color:"gray",bold:!0},"> "," "),v.createElement(Cd,{value:ie,onChange:pe,onSubmit:Le=>{let _t={...t,[ye]:Le.trim(),sandboxPreset:"Custom"};g(_t),b({systemSettings:_t,apiTier:h,quotas:s}),se(null)}})),v.createElement(j,{color:"gray",italic:!0}," Comma separated \u2022 Press Enter to save, Esc to cancel"))))}),qt&&w.push(v.createElement(Ne,{key:"conflict-warning",marginTop:1,paddingX:1},v.createElement(j,{color:Me.text,italic:!0},"* Conflicting commands will be ignored and defaulted to highest priority"))),w})():v.createElement(Ne,{paddingX:1,flexDirection:"column",width:"100%"},tn==="exit"?v.createElement(v.Fragment,null,v.createElement(Ne,{flexDirection:"column",marginBottom:1},v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"OS"," "),v.createElement(j,{color:"gray"},"..................... "),v.createElement(j,{color:Me.text},process.env.OS||process.platform||"N/A")),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Computer Name"," "),v.createElement(j,{color:"gray"},".......... "),v.createElement(j,{color:Me.text},process.env.COMPUTERNAME||process.env.HOSTNAME||"N/A")),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Processor Count"," "),v.createElement(j,{color:"gray"},"........ "),v.createElement(j,{color:Me.text},process.env.NUMBER_OF_PROCESSORS||"N/A")),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Node.js Version"," "),v.createElement(j,{color:"gray"},"........ "),v.createElement(j,{color:Me.text},"v",process.versions.node)),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"V8 Version"," "),v.createElement(j,{color:"gray"},"...... ...... "),v.createElement(j,{color:Me.text},"v",process.versions.v8)),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Data Directory"," "),v.createElement(j,{color:"gray"},"......... "),ro===mo?"":v.createElement(j,{color:Me.text},ro.replaceAll(Tl.homedir(),"~").replaceAll("\\\\","/").replaceAll("\\","/"),", "),v.createElement(j,{color:Me.text},mo.replaceAll(Tl.homedir(),"~").replaceAll("\\\\","/").replaceAll("\\","/"))),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Viewport"," "),v.createElement(j,{color:"gray"},"............... "),v.createElement(j,{color:Me.text},process.stdout.rows||"?"," rows \xD7 ",process.stdout.columns||"?"," cols ",process.stdout.columns<90?"(too small width)":"")),v.createElement(Ne,{flexDirection:"row",marginBottom:0},v.createElement(j,{color:Me.textDim},"Memory Load"," "),v.createElement(j,{color:"gray"},"............ "),v.createElement(j,{color:Me.text},ce,"/",D," ",qe))),v.createElement(Ne,{key:"pty-notice",paddingX:0,marginTop:0},v.createElement(j,{color:Gt?Me.statusOn:Me.warning},Gt?"\u2713 Advance Interactive Terminal Supported":"\u26A0 Interactive Terminal is Limited"))):v.createElement(j,{color:"gray",italic:!0},ho[L].desc)))),v.createElement(Ne,{paddingX:1,marginTop:0,flexDirection:"row",justifyContent:"space-between"},v.createElement(j,{color:"gray",italic:!0},P==="categories"?"\u25B2\u25BC Select Category \u2022 Enter/\u25BA to configure":"\u25B2\u25BC Select Option \u2022 Enter to Toggle \u2022 \u25C4/ESC to go back"),P==="categories"&&v.createElement(j,{color:"gray"},ho[L].desc)))}import Jt,{useState as ks,useEffect as Ed}from"react";import{Box as Bn,Text as er}from"ink";import Bd from"ink-text-input";function Is({initialData:t,onSave:g,onCancel:h,theme:y="Dark"}){let T=Je(y),[b,s]=ks(0),[k,x]=ks(""),[I,A]=ks(()=>({name:t?.name||"",nickname:t?.nickname||"",instructions:t?.instructions||""})),H=[{key:"nickname",label:"Enter a Nickname: ",maxLength:20},{key:"instructions",label:"System Instructions: ",maxLength:200}],S=H[b];Ed(()=>{let L=H[b].key;x((I[L]||"").slice(0,H[b].maxLength))},[b,I]);let C=L=>{L.length>S.maxLength?x(L.slice(0,S.maxLength)):x(L)},P=L=>{if(L.trim().toLowerCase()==="/cancel"){h();return}let _=S.key,Q={...I,[_]:L.trim().slice(0,S.maxLength)};A(Q),x(""),b<H.length-1?s(b+1):g(Q)},N=k.length>=S.maxLength;return Jt.createElement(Bn,{borderStyle:"round",borderColor:T.borderMuted,padding:0,marginTop:1,flexShrink:0,flexDirection:"column",width:"100%"},Jt.createElement(Bn,{paddingX:1,marginBottom:1},Jt.createElement(er,{color:T.text,bold:!0},"USER PROFILE CONFIGURATION")),Jt.createElement(Bn,{paddingX:1,flexDirection:"column"},Jt.createElement(Bn,null,Jt.createElement(er,{color:T.text,bold:!0},S.label),Jt.createElement(Bd,{value:k,onChange:C,onSubmit:P})),Jt.createElement(Bn,{marginTop:1,justifyContent:"space-between"},Jt.createElement(er,{color:T.textMuted,italic:!0},"Step ",b+1," of ",H.length),Jt.createElement(er,{color:N?T.warning||"yellow":T.textMuted},"[",k.length,"/",S.maxLength,"]"))),Jt.createElement(Bn,{paddingX:1,marginTop:1},Jt.createElement(er,{color:T.textMuted,italic:!0},"(Enter to submit \u2022 Type /cancel to abort)")))}import yt,{useState as As}from"react";import{Box as Zt,Text as $o,useInput as Dd}from"ink";import kd from"ink-text-input";var Id=({question:t,options:g,onResolve:h,theme:y="Dark"})=>{let T=Je(y),[b,s]=As(!1),[k,x]=As(""),[I,A]=As(0),H=!1,S=[],C=Array.isArray(g)&&g.length>0,P=t==="Agent has been running for a long time. Do you want to continue execution?";try{P&&C?S=[...g]:S=[...C?g:[],C?{id:"CUSTOM",label:"Suggest something else...",description:"Provide a custom response"}:{id:"CUSTOM",label:"Your Answer",description:""}]}catch{H=!0}Dd((L,_)=>{if(!b&&((_.leftArrow||_.upArrow)&&A(Q=>Math.max(0,Q-1)),(_.rightArrow||_.downArrow)&&A(Q=>Math.min(S.length-1,Q+1)),_.return)){let Q=S[I];Q?.id==="CUSTOM"?s(!0):h(H?"Selected Nothing":Q.label)}});let N=nt(2);return b?yt.createElement(Zt,{flexDirection:"column",borderStyle:"single",borderLeft:!1,borderRight:!1,borderTop:!1,borderBottom:!1,paddingLeft:2,paddingRight:0,paddingTop:1,paddingBottom:1,backgroundColor:T.codeBg,width:"100%"},yt.createElement(Zt,{paddingX:1},yt.createElement($o,{color:T.text,bold:!0},"SUGGEST SOMETHING")),yt.createElement(Zt,{marginTop:1,paddingX:1},yt.createElement($o,{italic:!0,color:T.textMuted},"Replying to: ",t)),yt.createElement(Zt,{marginTop:1,paddingX:1,flexDirection:"row"},yt.createElement(kd,{value:k,onChange:x,onSubmit:()=>h(k)})),yt.createElement(Zt,{marginTop:1,paddingX:1,marginBottom:1},yt.createElement($o,{color:T.textMuted,italic:!0},"(Press Enter to send)"))):yt.createElement(Zt,{flexDirection:"column",border:!0,borderStyle:"round",borderColor:T.codeBorder,paddingLeft:2,paddingRight:0,paddingTop:1,paddingBottom:1,marginY:1,marginRight:1,width:"100%"},yt.createElement(Zt,{paddingX:1,marginBottom:1},yt.createElement($o,{color:"yellow",bold:!0},P?"TURN SAFETY SYSTEM: EXECUTION LIMIT":"AGENT REQUEST: ACTION REQUIRED")),yt.createElement(Zt,{paddingX:1,marginBottom:1},yt.createElement($o,{color:T.text},t)),yt.createElement(Zt,{flexDirection:"column",width:"100%"},S.map((L,_)=>{let Q=_===I;return yt.createElement(Zt,{key:L.id,flexDirection:"column",width:"100%",backgroundColor:Q?T.highlightBg:void 0,paddingX:1,marginBottom:_===S.length-1?0:1},yt.createElement($o,{color:Q?T.text:T.textMuted,bold:Q},Q?"\u276F ":" ",L.label),L.description&&yt.createElement(Zt,{marginLeft:4},yt.createElement($o,{color:T.textMuted,italic:!0},L.description)))})),yt.createElement(Zt,{paddingX:1,marginTop:1,marginBottom:1},yt.createElement($o,{color:T.textMuted,italic:!0},"(Use Arrows to navigate, Enter to confirm)")))},yl=Id;import Zd from"gradient-string";import Lt,{useState as Ls,useEffect as Ad}from"react";import{Box as po,Text as _o,useInput as Ld}from"ink";function Ps({onSelect:t,onDelete:g,onClose:h,theme:y="Dark"}){let T=Je(y),[b,s]=Ls({}),[k,x]=Ls([]),[I,A]=Ls(0);Ad(()=>{(async()=>{let L=await Fo();s(L),x(Object.keys(L).sort((_,Q)=>(L[Q].updatedAt||0)-(L[_].updatedAt||0)))})()},[]),Ld((N,L)=>{if(L.escape&&h(),L.upArrow&&A(_=>Math.max(0,_-1)),L.downArrow&&A(_=>Math.min(k.length-1,_+1)),L.return&&k[I]&&t(k[I]),N==="x"&&k[I]){let _=k[I];g(_).then(Q=>{let ge=Q||{};s(ge);let ye=Object.keys(ge).sort((se,ie)=>(ge[ie]?.updatedAt||0)-(ge[se]?.updatedAt||0));x(ye),A(se=>Math.max(0,Math.min(ye.length-1,se)))})}});let H=nt(2),S=15,C=0;if(k.length>S){let N=Math.floor(S/2);C=I-N,C<0?C=0:C+S>k.length&&(C=k.length-S)}let P=k.slice(C,C+S);return Lt.createElement(po,{flexDirection:"column",borderStyle:"round",borderColor:T.borderMuted,padding:0,width:"100%"},Lt.createElement(po,{paddingX:1,marginBottom:1},Lt.createElement(_o,{color:T.text,bold:!0},"CHAT HISTORY: RESUME CONVERSATION")),k.length===0?Lt.createElement(po,{paddingX:2,paddingY:1},Lt.createElement(_o,{italic:!0,color:T.textMuted},"No saved chats found.")):Lt.createElement(po,{flexDirection:"column",width:"100%"},C>0&&Lt.createElement(po,{paddingX:2,marginBottom:1},Lt.createElement(_o,{color:T.textMuted},"\u25B2 (+",C," more chats above)")),P.map((N,L)=>{let _=b[N],ge=C+L===I,ye=Pd(_?.updatedAt);return Lt.createElement(po,{key:N,paddingX:1,backgroundColor:ge?T.highlightBg:void 0,width:"100%"},Lt.createElement(po,{flexGrow:1},Lt.createElement(_o,{color:ge?T.text:T.textMuted,bold:ge},ge?"\u276F ":" ",(()=>{let se=ie=>(ie||"").replace(/\[\/?(?:STEERING HINT|QUESTION)(?::\s*\w+)?\]/gi,"").trim();return _?.name&&!_.name.startsWith("Session")?se(_.name):_?.prompt?se(_.prompt):se(_?.name)||N})(),Lt.createElement(_o,{color:T.textMuted}," [",ye," \u2022 ",N,"]"))),ge&&Lt.createElement(po,{flexShrink:0},Lt.createElement(_o,{color:T.danger,bold:!0},"[X] DELETE ")))}),C+S<k.length&&Lt.createElement(po,{paddingX:2,marginTop:1},Lt.createElement(_o,{color:T.textMuted},"\u25BC (+",k.length-(C+S)," more chats below)"))),Lt.createElement(po,{marginTop:1,paddingX:1,borderStyle:"single",borderLeft:!1,borderRight:!1,borderBottom:!1,borderColor:T.borderMuted},Lt.createElement(_o,{color:T.textMuted,italic:!0},"\u2191\u2193 navigate \u2022 Enter select \u2022 x delete \u2022 Esc close")))}function Pd(t){if(!t)return"N/A";let g=new Date(t);if(isNaN(g.getTime()))return"N/A";let h=k=>String(k).padStart(2,"0"),y=h(g.getMonth()+1),T=h(g.getDate()),b=h(g.getHours()),s=h(g.getMinutes());return`${y}-${T} ${b}:${s}`}import Mt,{useState as Os,useEffect as Od}from"react";import{Box as bo,Text as lo,useInput as Nd,useStdout as Fd}from"ink";function Ns({onClose:t,theme:g="Dark"}){let h=Je(g),{stdout:y}=Fd(),T=y?.columns||80,[b,s]=Os([]),[k,x]=Os(0),[I,A]=Os(!0),H=()=>{let se=Tr(Wn,[]);s(se);try{let pe=wr(zo,{}).systemSettings?.memory!==!1;A(pe)}catch{A(!0)}};Od(()=>{H()},[]),Nd((se,ie)=>{if(ie.escape&&t(),ie.upArrow&&x(pe=>Math.max(0,pe-1)),ie.downArrow&&x(pe=>Math.min(b.length-1,pe+1)),se==="x"&&b.length>0){let pe=b[k].id,Be=b.filter(Se=>Se.id!==pe);Bi(Wn,Be),s(Be),k>=Be.length&&Be.length>0&&x(Be.length-1)}});let S=(se,ie,pe)=>{if(!se)return"";let Be=se.replace(/\[Saved on: .*?\]/g,"").replace(/\\+'/g,"'").trim(),Fe=`${pe?"\u276F ":" "}${ie+1}. `.length,le=pe?22:2;return Be.split(`
|
|
44
|
+
---`)&&Ee.push({label:kt,value:kt,isHeader:!1,provider:it})}))}return Ee},[x,h,s,at]),ne=v.useMemo(()=>{if(!ae.trim())return ve;let ue=ae.trim().toLowerCase(),w=[],U=null;for(let Ee of ve)Ee.isHeader?U=Ee:(Ee.label.toLowerCase().includes(ue)||Ee.value&&Ee.value.toLowerCase().includes(ue))&&(U&&!w.includes(U)&&w.push(U),w.push(Ee));return w},[ve,ae]);Rn(()=>{if(ee){let ue=ne.findIndex(w=>!w.isHeader);R(ue>=0?ue:0),Z(0)}},[ae]),Rn(()=>{if(ee){if(ne.length===0){R(0),Z(0);return}if(me>=ne.length||ne[me]?.isHeader){let ue=ne.findIndex(w=>!w.isHeader);R(ue>=0?ue:0)}}},[ne,ee]);let[ce,Ce]=At(0),[D,Ue]=At(0),[qe,Ct]=At("MB"),[Gt,Xr]=At(!1);Rn(()=>{let ue=!1;return import("./exec_command-AB4DNQYP.js").then(w=>{ue||Xr(!!w.isPtyAvailable)}).catch(()=>{}),()=>{ue=!0}},[]),Rn(()=>{let ue=vd.getHeapStatistics().heap_size_limit,w=ue>=1024*1024*1024,U=w?"GB":"MB",Ee=w?1024*1024*1024:1024*1024;Ue(parseFloat((ue/Ee).toFixed(2))),Ct(U);let Xe=()=>{let qt=process.memoryUsage().rss/Ee,je=w?parseFloat(qt.toFixed(2)):Math.round(qt);Ce(je)};Xe();let Re=setInterval(()=>{Xe()},3e4);return()=>clearInterval(Re)},[]);let en=ue=>{switch(ue){case"providers":{let U=[{label:"Current Provider",value:"aiProvider",status:x}];return x==="Ollama"&&U.push({label:"Endpoint",value:"ollamaEndpoint",status:t.ollamaEndpoint||"Cloud"}),U}case"appearance":return[{label:"Theme",value:"theme",status:t.theme||"Dark"},{label:"Loading Phrases",value:"loadingPhrases",status:t.loadingPhrases!==!1?"ON":"OFF"},{label:"Progressive Rendering [EXPERIMENTAL]",value:"progressiveRendering",status:t.progressiveRendering?"ON":"OFF"},{label:"Show TPM Estimate",value:"showTPMEstimate",status:t.showTPMEstimate?"ON":"OFF"},{label:"Verbose Thinking",value:"preserveThinking",status:t.preserveThinking!==!1?"ON":"OFF"}];case"memory":return[{label:"Toggle Memory [Legacy]",value:"memory",status:t.memory?"ON":"OFF"}];case"security":return[{label:"Sandbox Preset",value:"sandboxPreset",status:wl(t),section:"Sandbox"},{label:"YOLO Mode",value:"autoExec",status:t.autoExec?"ON":"OFF",section:"Sandbox"},{label:"External Workspace Access",value:"externalAccess",status:t.allowExternalAccess?"ON":"OFF",section:"Sandbox"},{label:"Network Access (Terminal)",value:"networkAccess",status:t.networkAccess!==!1?"ON":"OFF",section:"Sandbox"},{label:"Always Ask Commands",value:"alwaysAsk",status:Ds(t.alwaysAskCommands),section:"Sandbox"},{label:"Auto Approve Commands",value:"autoApprove",status:Ds(t.autoApproveCommands),section:"Sandbox"},{label:"Auto Disapprove Commands",value:"autoDisallow",status:Ds(t.autoDisallowCommands),section:"Sandbox"},{label:"Auto Approve Git Commits",value:"autoApproveGit",status:t.autoApproveGit?"ON":"OFF",section:"Sandbox"},{label:"Advanced Recovery [EXPERIMENTAL]",value:"advanceRollback",status:t.advanceRollback?"ON":"OFF",section:"Other"},{label:"Auto-Delete History",value:"autoDelete",status:t.autoDeleteHistory||"30d",section:"Other"},{label:"Save AppData Externally",value:"externalData",status:t.useExternalData?"ON":"OFF",section:"Other"}];case"updater":return[{label:"Auto-Update",value:"autoUpdate",status:t.autoUpdate?"ON":"OFF"},{label:"Preferred Package Manager",value:"updateManager",status:(t.updateManager||"npm")==="custom"?"Custom":(t.updateManager||"npm").toUpperCase()}];case"other":return[{label:"Sub-Agents",value:"subAgents",status:t.subAgents!==!1?"ON":"OFF"},{label:"Sub-Agent Model",value:"subAgentModel",status:t.CustomSubAgent&&t.SubAgentModel?t.SubAgentModel:"Default"},{label:"Directory Tree Design",value:"indentationTree",status:t.indentationTree!==!1?"Modern":"Legacy"},{label:"Compact Large Tool Results",value:"compressToolResults",status:t.compressToolResults?"ON":"OFF"},{label:"Auto Truncate Results",value:"autoTruncateResults",status:t.autoTruncateResults?"ON":"OFF"},{label:"Image History for CU",value:"imageHistoryCU",status:t.imageHistoryCU||"Standard"},{label:"Context Length",value:"contextLength",status:t.contextLength||"256k"},{label:"Keep Reasoning Context",value:"keepReasoningContext",status:t.keepReasoningContext?"ON":"OFF"},{label:"Auto Exclude Metadata",value:"autoExcludeMetadata",status:t.autoExcludeMetadata?"ON":"OFF"},{label:"Disable Todo",value:"disableTodo",status:t.disableTodo?"ON":"OFF"}];default:return[]}},tn=ho[L].id,Ge=en(tn);Sd((ue,w)=>{if(ee){if(w.tab){Ae(U=>U==="search"?"list":"search");return}if(he==="search"){w.escape?We(!1):w.downArrow||w.return?Ae("list"):w.backspace||w.delete?fe(U=>U.slice(0,-1)):ue&&!w.ctrl&&!w.meta&&ue.length===1&&fe(U=>U+ue);return}if(w.upArrow)R(U=>{if(ne.length===0)return 0;let Ee=(U-1+ne.length)%ne.length,Xe=0;for(;ne[Ee]?.isHeader&&Xe<ne.length;)Ee=(Ee-1+ne.length)%ne.length,Xe++;return Ee});else if(w.downArrow)R(U=>{if(ne.length===0)return 0;let Ee=(U+1)%ne.length,Xe=0;for(;ne[Ee]?.isHeader&&Xe<ne.length;)Ee=(Ee+1)%ne.length,Xe++;return Ee});else if(w.return){let U=ne[me];U&&!U.isHeader&&(g(Ee=>{let Xe=U.value==="Default",Re={...Ee,CustomSubAgent:!Xe,SubAgentModel:U.value,SubAgentProvider:Xe?"":U.provider||""};return b({systemSettings:Re,apiTier:h,quotas:s}),Re}),We(!1))}else w.escape?We(!1):ue&&!w.ctrl&&!w.meta&&ue.length===1&&(fe(U=>U+ue),Ae("search"));return}if(Be){if(w.upArrow){let U=(Fe-1+xo.length)%xo.length;le(U)}else if(w.downArrow){let U=(Fe+1)%xo.length;le(U)}else if(w.return){let U=xo[Fe];g(Ee=>{let Xe={...Ee,theme:U};return b({systemSettings:Xe,apiTier:h,quotas:s}),Xe}),A?A():Se(!1)}else w.escape&&(A?A():Se(!1));return}if(ye){w.escape&&se(null);return}if(P==="categories")w.upArrow?_(U=>(U-1+ho.length)%ho.length):w.downArrow?_(U=>(U+1)%ho.length):w.return||w.rightArrow?ho[L].id==="exit"?y("chat"):(N("items"),ge(0)):w.escape&&y("chat");else if(P==="items"){if(w.upArrow)ge(U=>(U-1+Ge.length)%Ge.length);else if(w.downArrow)ge(U=>(U+1)%Ge.length);else if(w.leftArrow||w.escape)N("categories");else if(w.return){let U=Ge[Q];Rt(U)}}});let Rt=ue=>{if(ue.value==="memory")g(w=>({...w,memory:!w.memory}));else if(ue.value==="sandboxPreset"){let w=wl(t),U=["Autonomous","Balanced","Strict"],Xe=(U.indexOf(w)+1)%U.length,Re=U[Xe];g(it=>{let Ye={...it,sandboxPreset:Re};return Re==="Strict"?(Ye.autoExec=!1,Ye.allowExternalAccess=!1,Ye.networkAccess=!1,Ye.autoApproveCommands="",Ye.autoDisallowCommands="rm -rf, rm -f, del /f, del /q, rd /s, rmdir /s, format, mkfs, dd if=/dev, shred, srm, Remove-Item -Recurse -Force, Initialize-Disk, Clear-Disk, format c:, flashrom, nvram -c",Ye.alwaysAskCommands="killall, pkill, taskkill, shutdown, reboot, init 0, init 6, Stop-Process, Stop-Service, mv /*, move c:\\*, chmod 000, chmod -R 777, chown, icacls, netsh advfirewall, iptables -F, ufw disable, git reset --hard, git clean -fd, npm r, npm uninstall",Ye.autoApproveGit=!1):Re==="Balanced"?(Ye.autoExec=!0,Ye.allowExternalAccess=!1,Ye.networkAccess=!0,Ye.autoApproveCommands="ls, dir, cat, type, echo, pwd, cd, git status, git log, git diff, git branch, git show, help, mkdir, touch, md, whoami, hostname, ps, Get-Process, date, time",Ye.autoDisallowCommands="rm -rf, rm -f, del /f, del /q, rd /s, rmdir /s, format, mkfs, dd if=/dev, shred, srm, Remove-Item -Recurse -Force, Initialize-Disk, Clear-Disk, format c:, flashrom, nvram -c",Ye.alwaysAskCommands="killall, pkill, taskkill, Stop-Process, mv /*, move c:\\*, chmod 000, chmod -R 777, chown, icacls, shutdown, reboot, init 0, init 6, git reset --hard, git clean -fd, npm r, npm uninstall",Ye.autoApproveGit=!1):Re==="Autonomous"&&(Ye.autoExec=!0,Ye.allowExternalAccess=!0,Ye.networkAccess=!0,Ye.autoApproveCommands="ls, dir, cat, type, echo, pwd, cd, git status, git log, git diff, git branch, git show, help, mkdir, touch, md, whoami, hostname, ps, Get-Process, date, time",Ye.autoDisallowCommands="",Ye.alwaysAskCommands="rm -rf, rm -f, del /f, del /q, rd /s, rmdir /s, format, mkfs, dd if=/dev, shred, srm, Remove-Item -Recurse -Force, Initialize-Disk, Clear-Disk, format c:, flashrom, nvram -c",Ye.autoApproveGit=!0),Ye})}else if(ue.value==="autoExec")t.autoExec?g(w=>({...w,autoExec:!1,sandboxPreset:"Custom"})):t.allowExternalAccess?y("doubleDanger"):y("autoExecDanger");else if(ue.value==="externalAccess")t.allowExternalAccess?g(w=>({...w,allowExternalAccess:!1,sandboxPreset:"Custom"})):t.autoExec?y("doubleDanger"):y("externalDanger");else if(ue.value==="networkAccess")g(w=>({...w,networkAccess:w.networkAccess===!1,sandboxPreset:"Custom"}));else if(ue.value==="alwaysAsk")se("alwaysAskCommands"),pe(t.alwaysAskCommands||"");else if(ue.value==="autoApprove")se("autoApproveCommands"),pe(t.autoApproveCommands||"");else if(ue.value==="autoApproveGit")g(w=>({...w,autoApproveGit:!w.autoApproveGit,sandboxPreset:"Custom"}));else if(ue.value==="autoDisallow")se("autoDisallowCommands"),pe(t.autoDisallowCommands||"");else if(ue.value==="ollamaEndpoint")g(w=>{let U=w.ollamaEndpoint==="Local"?"Cloud":"Local",Ee={...w,ollamaEndpoint:U};return b({systemSettings:Ee,apiTier:h,quotas:s}),Ee});else if(ue.value==="apiTier")y("apiTier");else if(ue.value==="aiProvider")H&&H("settings"),y("selectProvider");else if(ue.value==="advanceRollback")t.advanceRollback?g(w=>{let U={...w,advanceRollback:!1};return b({systemSettings:U,apiTier:h,quotas:s}),U}):y("advanceRollbackDanger");else if(ue.value==="autoDelete"){let w=["1d","7d","30d"],Ee=(w.indexOf(t.autoDeleteHistory||"30d")+1)%w.length;g(Xe=>({...Xe,autoDeleteHistory:w[Ee]}))}else if(ue.value==="autoUpdate")g(w=>({...w,autoUpdate:!w.autoUpdate}));else if(ue.value==="externalData")if(!t.useExternalData)T({label:"Enter absolute path for External AppData:",note:"All history, logs and secrets will be stored here. ~/.fluxflow/settings.json stays as anchor.",key:"externalDataPath",value:t.externalDataPath||""}),y("input");else{let w={...t,useExternalData:!1};g(w),b({systemSettings:w,apiTier:h,quotas:s}),k(U=>[...U,{id:Date.now(),role:"system",text:"[STORAGE RESET] Flux Flow will return to default ~/.fluxflow after restart."}]),y("chat")}else if(ue.value==="updateManager")y("updateManager");else if(ue.value==="parserDownload")y("parserDownload");else if(ue.value==="indentationTree")g(w=>{let U={...w,indentationTree:w.indentationTree===!1};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="compressToolResults")g(w=>{let U={...w,compressToolResults:!w.compressToolResults};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="autoTruncateResults")g(w=>{let U={...w,autoTruncateResults:!w.autoTruncateResults};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="imageHistoryCU"){let w=["Low","Standard","Extended","Max"],Ee=(w.indexOf(t.imageHistoryCU||"Standard")+1)%w.length;g(Xe=>{let Re={...Xe,imageHistoryCU:w[Ee]};return b({systemSettings:Re,apiTier:h,quotas:s}),Re})}else if(ue.value==="contextLength"){let w=["16k","32k","64k","128k","256k","512k","1M"],Ee=(w.indexOf(t.contextLength||"256k")+1)%w.length;g(Xe=>{let Re={...Xe,contextLength:w[Ee]};return b({systemSettings:Re,apiTier:h,quotas:s}),Re})}else if(ue.value==="keepReasoningContext")g(w=>{let U={...w,keepReasoningContext:!w.keepReasoningContext};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="autoExcludeMetadata")g(w=>{let U={...w,autoExcludeMetadata:!w.autoExcludeMetadata};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="disableTodo")g(w=>{let U={...w,disableTodo:!w.disableTodo};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="subAgents")g(w=>{let U={...w,subAgents:w.subAgents===!1};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="subAgentModel"){let w=t.CustomSubAgent&&t.SubAgentModel?t.SubAgentModel:"Default",U=ne.findIndex(Ee=>Ee.value===w);R(U>=0?U:0),We(!0)}else if(ue.value==="preserveThinking")g(w=>{let U={...w,preserveThinking:w.preserveThinking===!1};return ml(U.preserveThinking),b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="loadingPhrases")g(w=>{let U={...w,loadingPhrases:w.loadingPhrases===!1};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="progressiveRendering")g(w=>{let U={...w,progressiveRendering:!w.progressiveRendering};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="showTPMEstimate")g(w=>{let U={...w,showTPMEstimate:!w.showTPMEstimate};return b({systemSettings:U,apiTier:h,quotas:s}),U});else if(ue.value==="theme"){let w=t.theme==="Chaos"||t.theme==="Mystery"?"Mystery":t.theme||"Dark",U=xo.indexOf(w);le(U>=0?U:0),be(t.theme||"Dark"),Se(!0)}},Me=Je(t.theme);if(ee){let ue=t.CustomSubAgent&&t.SubAgentModel?t.SubAgentModel:"Default",w=15,U=te;me<U?U=me:me>=U+w&&(U=me-w+1),U=Math.max(0,Math.min(U,Math.max(0,ne.length-w))),U!==te&&Z(U);let Ee=ne.slice(U,U+w);return v.createElement(Ne,{flexDirection:"column",borderStyle:"round",borderColor:Me.border,padding:1,width:"100%",minHeight:32},v.createElement(Ne,{marginBottom:1,flexDirection:"row",justifyContent:"space-between"},v.createElement(j,{color:Me.text,bold:!0,underline:!0},"Select Sub-Agent Model:"),ne.length>0&&v.createElement(j,{color:"gray"},me+1,"/",ne.length)),v.createElement(Ne,{borderStyle:"single",borderColor:he==="search"?Me.primary||"cyan":"gray",paddingX:1,marginBottom:1},v.createElement(j,{color:he==="search"?Me.primary||"cyan":"gray",bold:!0},"\u{1F50D} Search: "," "),v.createElement(j,{color:Me.text},ae),he==="search"&&v.createElement(j,{color:Me.primary||"cyan"},"\u2588"),!ae&&he!=="search"&&v.createElement(j,{color:"gray",italic:!0},"(Press TAB or type to filter models...)")),v.createElement(Ne,{flexDirection:"column",flexGrow:1,height:w},Ee.length>0?Ee.map((Xe,Re)=>{let it=U+Re;if(Xe.isHeader)return v.createElement(Ne,{key:`hdr-${it}`,paddingX:1},v.createElement(j,{color:"gray",bold:!0,underline:!0},Xe.label));let Ye=me===it&&he==="list",qt=ue===Xe.value;return v.createElement(Ne,{key:`item-${Xe.value}-${it}`,paddingX:1,backgroundColor:Ye?Me.highlightBg:void 0},v.createElement(j,{color:Ye?Me.text:Me.textDim,bold:Ye},Ye?"\u276F ":" ",Xe.label,qt?v.createElement(j,{color:Me.primary||"cyan",italic:!0}," (active)"):""))}):v.createElement(Ne,{paddingX:1},v.createElement(j,{color:"gray",italic:!0},'No models matching "',ae,'"'))),v.createElement(Ne,{paddingX:1,marginTop:1,flexDirection:"row",justifyContent:"space-between"},v.createElement(j,{color:"gray",italic:!0},"TAB to switch search/list \u2022 \u25B2\u25BC Navigate \u2022 ENTER to Select \u2022 ESC to Cancel"),v.createElement(j,{color:he==="search"?Me.primary||"cyan":"gray",bold:!0},"[",he.toUpperCase()," MODE]")))}if(Be){let ue=xo[Fe],w=Je(ue);return v.createElement(Ne,{flexDirection:"column",borderStyle:"round",borderColor:w.border,padding:1,width:"100%",minHeight:32},v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:w.text,bold:!0},"Choose your color scheme:")),v.createElement(Ne,{flexDirection:"row",width:"100%",flexGrow:1},v.createElement(Ne,{flexDirection:"column",width:"30%",paddingRight:1},xo.map((U,Ee)=>{let Xe=Fe===Ee,Re=(t.theme||"Dark")===U,it=U==="Forest Sprite";return v.createElement(Ne,{key:U,paddingX:0},v.createElement(j,{color:Xe?w.text:w.textDim,bold:Xe},Xe?"> ":" ",U,it&&v.createElement(j,{color:Xe?w.success||"#52b788":"green",bold:!0}," \u2605"),Re?v.createElement(j,{color:w.primary||"cyan",italic:!0}," (saved)"):""))})),v.createElement(Ne,{flexDirection:"column",flexGrow:1,borderStyle:"round",borderColor:w.borderMuted,paddingX:2,paddingY:1,backgroundColor:w.cardBg},v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:w.secondary||"cyan",bold:!0},"> ","you: "),v.createElement(j,{color:w.text},"add a greeting function")),v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:w.success||"green"}," Here's the change:")),v.createElement(Ne,{flexDirection:"column",marginLeft:2,marginBottom:1},v.createElement(j,null,v.createElement(j,{color:w.textDim},"3 "),v.createElement(j,{color:w.textDim},' import "fmt"')),v.createElement(j,{color:w.textDim},"4"),v.createElement(Ne,{backgroundColor:w.diffRemovalBg},v.createElement(j,null,v.createElement(j,{color:w.diffRemovalNum||w.diffRemovalText},"5 "),v.createElement(j,{color:w.diffRemovalPrefix||w.diffRemovalText},"- "),v.createElement(j,{color:w.diffRemovalText},"func "),v.createElement(j,{color:w.diffRemovalHighlightColor||w.diffRemovalText,backgroundColor:w.diffRemovalHighlightBg,bold:!0},"main()"),v.createElement(j,{color:w.diffRemovalText}," {"))),v.createElement(Ne,{backgroundColor:w.diffAdditionBg},v.createElement(j,null,v.createElement(j,{color:w.diffAdditionNum||w.diffAdditionText},"5 "),v.createElement(j,{color:w.diffAdditionPrefix||w.diffAdditionText},"+ "),v.createElement(j,{color:w.diffAdditionText},"func "),v.createElement(j,{color:w.diffAdditionHighlightColor||w.diffAdditionText,backgroundColor:w.diffAdditionHighlightBg,bold:!0},"greet(name string)"),v.createElement(j,{color:w.diffAdditionText}," {"))),v.createElement(Ne,{backgroundColor:w.diffAdditionBg},v.createElement(j,null,v.createElement(j,{color:w.diffAdditionNum||w.diffAdditionText},"6 "),v.createElement(j,{color:w.diffAdditionPrefix||w.diffAdditionText},"+ "),v.createElement(j,{color:w.diffAdditionText}," "),v.createElement(j,{color:w.diffAdditionHighlightColor||w.diffAdditionText,backgroundColor:w.diffAdditionHighlightBg},'fmt.Printf("Hello, %s!\\n", name)'))),v.createElement(j,{color:w.textDim},"7 }")),v.createElement(Ne,{flexDirection:"column",marginTop:1,marginBottom:1},v.createElement(j,{color:w.textDim},"\u25BE Thought Process"),v.createElement(j,{color:w.textMuted}," I need to add a greeting function. I'll use fmt.Printf.")),v.createElement(Ne,{flexDirection:"column"},v.createElement(j,null,v.createElement(j,{color:w.warning||"yellow"},"\u2699 tool: "),v.createElement(j,{color:w.text},"write_file main.go")),v.createElement(j,null,v.createElement(j,{color:w.accent||"magenta"},"\u29BF task: "),v.createElement(j,{color:w.text},"Implementing greeting")),v.createElement(j,null,v.createElement(j,{color:w.danger||"red"},"X error: "),v.createElement(j,{color:w.text},"compilation failed")),v.createElement(j,null,v.createElement(j,{color:w.warning||"yellow"},"\u26A0 warning: "),v.createElement(j,{color:w.text},"deprecation warning")),v.createElement(j,null,v.createElement(j,{color:w.info||"blue"},"\u2192 link: "),v.createElement(j,{color:w.info||"blue",underline:!0},"file:///path/to/main.go")),v.createElement(j,null,v.createElement(j,{color:w.accent||"magenta"},"\u2605 accent: "),v.createElement(j,{color:w.text},"highlighted text")),v.createElement(j,{color:w.textDim},"\xB7 dim: press Enter to continue")))),v.createElement(Ne,{paddingX:1,marginTop:1,flexDirection:"row",justifyContent:"space-between"},v.createElement(j,{color:"gray",italic:!0},"\u25B2\u25BC Navigate \u2022 ENTER to Select \u2022 ESC to Cancel"),v.createElement(j,{color:"gray"},"Previewing: ",xo[Fe],xo[Fe]==="Forest Sprite"?" \u2605":"")))}return v.createElement(Ne,{flexDirection:"column",borderStyle:"round",borderColor:Me.border,padding:0,width:"100%",minHeight:32},v.createElement(Ne,{paddingX:1,paddingY:0,marginBottom:0,borderStyle:"single",borderColor:Me.borderMuted,width:"100%"},v.createElement(j,{color:Me.text,bold:!0},"SYSTEM CONFIGURATION")),v.createElement(Ne,{flexDirection:"row",width:"100%",minHeight:26},v.createElement(Ne,{flexDirection:"column",width:"30%",maxWidth:40,borderStyle:"round",borderColor:P==="categories"?Me.border:Me.borderMuted,padding:1,paddingY:0},v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:P==="categories"?Me.text:Me.textDim,bold:!0,underline:!0},"CATEGORIES")),ho.map((ue,w)=>{let U=L===w,Ee=ue.id==="exit";return v.createElement(Ne,{key:ue.id,marginTop:Ee?15:0,backgroundColor:U?P==="categories"?Me.highlightBg:Me.cardBg:void 0,paddingX:1},v.createElement(j,{color:U&&P==="categories"?Me.text:Me.textDim,bold:U},U?"\u276F ":" ",ue.label))})),v.createElement(Ne,{flexDirection:"column",flexGrow:1,borderStyle:"round",borderColor:P==="items"?Me.border:Me.borderMuted,paddingX:1,marginLeft:1,paddingY:0},v.createElement(Ne,{marginBottom:1},v.createElement(j,{color:P==="items"?Me.text:Me.textDim,bold:!0,underline:!0},ho[L].label.toUpperCase().includes("EXIT")?"Runtime Information":`${ho[L].label} Settings`)),Ge.length>0?(()=>{let ue=null,w=[],U=je=>(je||"").split(",").map(kt=>kt.trim().toLowerCase()).filter(Boolean),Ee=U(t.autoApproveCommands),Xe=U(t.autoDisallowCommands),Re=U(t.alwaysAskCommands),it=[...Ee,...Xe,...Re],Ye=new Set(it),qt=tn==="security"&&it.length!==Ye.size;return Ge.forEach((je,kt)=>{let zt=P==="items"&&Q===kt,Wr=je.label.length,on=Math.max(2,38-Wr),Gr=".".repeat(on),mt=Le=>tn==="security"?(Le.value==="autoExec"||Le.value==="externalAccess")&&Le.status==="ON"?Me.statusOn:Me.statusOff:Le.status?.startsWith("\u2713")?Me.statusOn:Le.status?.startsWith("\u26A0")?Me.statusOff:Le.status==="ON"?Me.statusOn:Le.status==="OFF"?Me.statusOff:Me.text;je.section&&je.section!==ue&&(ue=je.section,w.push(v.createElement(Ne,{key:`sec-hdr-${je.section}`,marginTop:w.length>0?1:0,marginBottom:0,paddingX:1},v.createElement(j,{color:"gray",bold:!0,underline:!0},je.section.toUpperCase()))));let z=zt&&ye&&(ye==="alwaysAskCommands"&&je.value==="alwaysAsk"||ye==="autoApproveCommands"&&je.value==="autoApprove"||ye==="autoDisallowCommands"&&je.value==="autoDisallow"),lt=je.value==="alwaysAsk"||je.value==="autoApprove"||je.value==="autoDisallow",Wo=je.value==="parserDownload";w.push(v.createElement(Ne,{key:je.value,flexDirection:"column"},v.createElement(Ne,{backgroundColor:zt&&!z?Me.highlightBg:void 0,paddingX:2},v.createElement(j,{color:zt?Me.text:Me.textDim,bold:zt},zt?"\u276F ":" ",je.label),!lt&&!Wo&&v.createElement(v.Fragment,null,v.createElement(j,{color:"gray"},Gr),v.createElement(j,{color:mt(je),bold:!0},je.value==="aiProvider"?je.status:`[ ${je.status} ]`))),lt&&!z&&je.status!=="None"&&v.createElement(Ne,{paddingX:4,marginBottom:1},v.createElement(j,{color:"gray"},"\u21B3 ",je.status)),z&&v.createElement(Ne,{flexDirection:"column",marginLeft:4,marginBottom:1},v.createElement(Ne,{paddingX:1,borderStyle:"single",borderColor:"gray",flexDirection:"row"},v.createElement(j,{color:"gray",bold:!0},"> "," "),v.createElement(Cd,{value:ie,onChange:pe,onSubmit:Le=>{let _t={...t,[ye]:Le.trim(),sandboxPreset:"Custom"};g(_t),b({systemSettings:_t,apiTier:h,quotas:s}),se(null)}})),v.createElement(j,{color:"gray",italic:!0}," Comma separated \u2022 Press Enter to save, Esc to cancel"))))}),qt&&w.push(v.createElement(Ne,{key:"conflict-warning",marginTop:1,paddingX:1},v.createElement(j,{color:Me.text,italic:!0},"* Conflicting commands will be ignored and defaulted to highest priority"))),w})():v.createElement(Ne,{paddingX:1,flexDirection:"column",width:"100%"},tn==="exit"?v.createElement(v.Fragment,null,v.createElement(Ne,{flexDirection:"column",marginBottom:1},v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"OS"," "),v.createElement(j,{color:"gray"},"..................... "),v.createElement(j,{color:Me.text},process.env.OS||process.platform||"N/A")),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Computer Name"," "),v.createElement(j,{color:"gray"},".......... "),v.createElement(j,{color:Me.text},process.env.COMPUTERNAME||process.env.HOSTNAME||"N/A")),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Processor Count"," "),v.createElement(j,{color:"gray"},"........ "),v.createElement(j,{color:Me.text},process.env.NUMBER_OF_PROCESSORS||"N/A")),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Node.js Version"," "),v.createElement(j,{color:"gray"},"........ "),v.createElement(j,{color:Me.text},"v",process.versions.node)),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"V8 Version"," "),v.createElement(j,{color:"gray"},"...... ...... "),v.createElement(j,{color:Me.text},"v",process.versions.v8)),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Data Directory"," "),v.createElement(j,{color:"gray"},"......... "),ro===mo?"":v.createElement(j,{color:Me.text},ro.replaceAll(Tl.homedir(),"~").replaceAll("\\\\","/").replaceAll("\\","/"),", "),v.createElement(j,{color:Me.text},mo.replaceAll(Tl.homedir(),"~").replaceAll("\\\\","/").replaceAll("\\","/"))),v.createElement(Ne,{flexDirection:"row"},v.createElement(j,{color:Me.textDim},"Viewport"," "),v.createElement(j,{color:"gray"},"............... "),v.createElement(j,{color:Me.text},process.stdout.rows||"?"," rows \xD7 ",process.stdout.columns||"?"," cols ",process.stdout.columns<90?"(too small width)":"")),v.createElement(Ne,{flexDirection:"row",marginBottom:0},v.createElement(j,{color:Me.textDim},"Memory Load"," "),v.createElement(j,{color:"gray"},"............ "),v.createElement(j,{color:Me.text},ce,"/",D," ",qe))),v.createElement(Ne,{key:"pty-notice",paddingX:0,marginTop:0},v.createElement(j,{color:Gt?Me.statusOn:Me.warning},Gt?"\u2713 Advance Interactive Terminal Supported":"\u26A0 Interactive Terminal is Limited"))):v.createElement(j,{color:"gray",italic:!0},ho[L].desc)))),v.createElement(Ne,{paddingX:1,marginTop:0,flexDirection:"row",justifyContent:"space-between"},v.createElement(j,{color:"gray",italic:!0},P==="categories"?"\u25B2\u25BC Select Category \u2022 Enter/\u25BA to configure":"\u25B2\u25BC Select Option \u2022 Enter to Toggle \u2022 \u25C4/ESC to go back"),P==="categories"&&v.createElement(j,{color:"gray"},ho[L].desc)))}import Jt,{useState as ks,useEffect as Ed}from"react";import{Box as Bn,Text as er}from"ink";import Bd from"ink-text-input";function Is({initialData:t,onSave:g,onCancel:h,theme:y="Dark"}){let T=Je(y),[b,s]=ks(0),[k,x]=ks(""),[I,A]=ks(()=>({name:t?.name||"",nickname:t?.nickname||"",instructions:t?.instructions||""})),H=[{key:"nickname",label:"Enter a Nickname: ",maxLength:20},{key:"instructions",label:"System Instructions: ",maxLength:200}],S=H[b];Ed(()=>{let L=H[b].key;x((I[L]||"").slice(0,H[b].maxLength))},[b,I]);let C=L=>{L.length>S.maxLength?x(L.slice(0,S.maxLength)):x(L)},P=L=>{if(L.trim().toLowerCase()==="/cancel"){h();return}let _=S.key,Q={...I,[_]:L.trim().slice(0,S.maxLength)};A(Q),x(""),b<H.length-1?s(b+1):g(Q)},N=k.length>=S.maxLength;return Jt.createElement(Bn,{borderStyle:"round",borderColor:T.borderMuted,padding:0,marginTop:1,flexShrink:0,flexDirection:"column",width:"100%"},Jt.createElement(Bn,{paddingX:1,marginBottom:1},Jt.createElement(er,{color:T.text,bold:!0},"USER PROFILE CONFIGURATION")),Jt.createElement(Bn,{paddingX:1,flexDirection:"column"},Jt.createElement(Bn,null,Jt.createElement(er,{color:T.text,bold:!0},S.label),Jt.createElement(Bd,{value:k,onChange:C,onSubmit:P})),Jt.createElement(Bn,{marginTop:1,justifyContent:"space-between"},Jt.createElement(er,{color:T.textMuted,italic:!0},"Step ",b+1," of ",H.length),Jt.createElement(er,{color:N?T.warning||"yellow":T.textMuted},"[",k.length,"/",S.maxLength,"]"))),Jt.createElement(Bn,{paddingX:1,marginTop:1},Jt.createElement(er,{color:T.textMuted,italic:!0},"(Enter to submit \u2022 Type /cancel to abort)")))}import yt,{useState as As}from"react";import{Box as Zt,Text as $o,useInput as Dd}from"ink";import kd from"ink-text-input";var Id=({question:t,options:g,onResolve:h,theme:y="Dark"})=>{let T=Je(y),[b,s]=As(!1),[k,x]=As(""),[I,A]=As(0),H=!1,S=[],C=Array.isArray(g)&&g.length>0,P=t==="Agent has been running for a long time. Do you want to continue execution?";try{P&&C?S=[...g]:S=[...C?g:[],C?{id:"CUSTOM",label:"Suggest something else...",description:"Provide a custom response"}:{id:"CUSTOM",label:"Your Answer",description:""}]}catch{H=!0}Dd((L,_)=>{if(!b&&((_.leftArrow||_.upArrow)&&A(Q=>Math.max(0,Q-1)),(_.rightArrow||_.downArrow)&&A(Q=>Math.min(S.length-1,Q+1)),_.return)){let Q=S[I];Q?.id==="CUSTOM"?s(!0):h(H?"Selected Nothing":Q.label)}});let N=nt(2);return b?yt.createElement(Zt,{flexDirection:"column",borderStyle:"single",borderLeft:!1,borderRight:!1,borderTop:!1,borderBottom:!1,paddingLeft:2,paddingRight:0,paddingTop:1,paddingBottom:1,backgroundColor:T.codeBg,width:"100%"},yt.createElement(Zt,{paddingX:1},yt.createElement($o,{color:T.text,bold:!0},"SUGGEST SOMETHING")),yt.createElement(Zt,{marginTop:1,paddingX:1},yt.createElement($o,{italic:!0,color:T.textMuted},"Replying to: ",t)),yt.createElement(Zt,{marginTop:1,paddingX:1,flexDirection:"row"},yt.createElement(kd,{value:k,onChange:x,onSubmit:()=>h(k)})),yt.createElement(Zt,{marginTop:1,paddingX:1,marginBottom:1},yt.createElement($o,{color:T.textMuted,italic:!0},"(Press Enter to send)"))):yt.createElement(Zt,{flexDirection:"column",border:!0,borderStyle:"round",borderColor:T.codeBorder,paddingLeft:2,paddingRight:0,paddingTop:1,paddingBottom:1,marginY:1,marginRight:1,width:"100%"},yt.createElement(Zt,{paddingX:1,marginBottom:1},yt.createElement($o,{color:"yellow",bold:!0},P?"TURN SAFETY SYSTEM: EXECUTION LIMIT":"AGENT REQUEST: ACTION REQUIRED")),yt.createElement(Zt,{paddingX:1,marginBottom:1},yt.createElement($o,{color:T.text},t)),yt.createElement(Zt,{flexDirection:"column",width:"100%"},S.map((L,_)=>{let Q=_===I;return yt.createElement(Zt,{key:L.id,flexDirection:"column",width:"100%",backgroundColor:Q?T.highlightBg:void 0,paddingX:1,marginBottom:_===S.length-1?0:1},yt.createElement($o,{color:Q?T.text:T.textMuted,bold:Q},Q?"\u276F ":" ",L.label),L.description&&yt.createElement(Zt,{marginLeft:4},yt.createElement($o,{color:T.textMuted,italic:!0},L.description)))})),yt.createElement(Zt,{paddingX:1,marginTop:1,marginBottom:1},yt.createElement($o,{color:T.textMuted,italic:!0},"(Use Arrows to navigate, Enter to confirm)")))},yl=Id;import Zd from"gradient-string";import Lt,{useState as Ls,useEffect as Ad}from"react";import{Box as po,Text as _o,useInput as Ld}from"ink";function Ps({onSelect:t,onDelete:g,onClose:h,theme:y="Dark"}){let T=Je(y),[b,s]=Ls({}),[k,x]=Ls([]),[I,A]=Ls(0);Ad(()=>{(async()=>{let L=await Fo();s(L),x(Object.keys(L).sort((_,Q)=>(L[Q].updatedAt||0)-(L[_].updatedAt||0)))})()},[]),Ld((N,L)=>{if(L.escape&&h(),L.upArrow&&A(_=>Math.max(0,_-1)),L.downArrow&&A(_=>Math.min(k.length-1,_+1)),L.return&&k[I]&&t(k[I]),N==="x"&&k[I]){let _=k[I];g(_).then(Q=>{let ge=Q||{};s(ge);let ye=Object.keys(ge).sort((se,ie)=>(ge[ie]?.updatedAt||0)-(ge[se]?.updatedAt||0));x(ye),A(se=>Math.max(0,Math.min(ye.length-1,se)))})}});let H=nt(2),S=15,C=0;if(k.length>S){let N=Math.floor(S/2);C=I-N,C<0?C=0:C+S>k.length&&(C=k.length-S)}let P=k.slice(C,C+S);return Lt.createElement(po,{flexDirection:"column",borderStyle:"round",borderColor:T.borderMuted,padding:0,width:"100%"},Lt.createElement(po,{paddingX:1,marginBottom:1},Lt.createElement(_o,{color:T.text,bold:!0},"CHAT HISTORY: RESUME CONVERSATION")),k.length===0?Lt.createElement(po,{paddingX:2,paddingY:1},Lt.createElement(_o,{italic:!0,color:T.textMuted},"No saved chats found.")):Lt.createElement(po,{flexDirection:"column",width:"100%"},C>0&&Lt.createElement(po,{paddingX:2,marginBottom:1},Lt.createElement(_o,{color:T.textMuted},"\u25B2 (+",C," more chats above)")),P.map((N,L)=>{let _=b[N],ge=C+L===I,ye=Pd(_?.updatedAt);return Lt.createElement(po,{key:N,paddingX:1,backgroundColor:ge?T.highlightBg:void 0,width:"100%"},Lt.createElement(po,{flexGrow:1},Lt.createElement(_o,{color:ge?T.text:T.textMuted,bold:ge},ge?"\u276F ":" ",(()=>{let se=ie=>(ie||"").replace(/\[\/?(?:STEERING HINT|QUESTION)(?::\s*\w+)?\]/gi,"").trim();return _?.name&&!_.name.startsWith("Session")?se(_.name):_?.prompt?se(_.prompt):se(_?.name)||N})(),Lt.createElement(_o,{color:T.textMuted}," [",ye," \u2022 ",N,"]"))),ge&&Lt.createElement(po,{flexShrink:0},Lt.createElement(_o,{color:T.danger,bold:!0},"[X] DELETE ")))}),C+S<k.length&&Lt.createElement(po,{paddingX:2,marginTop:1},Lt.createElement(_o,{color:T.textMuted},"\u25BC (+",k.length-(C+S)," more chats below)"))),Lt.createElement(po,{marginTop:1,paddingX:1,borderStyle:"single",borderLeft:!1,borderRight:!1,borderBottom:!1,borderColor:T.borderMuted},Lt.createElement(_o,{color:T.textMuted,italic:!0},"\u2191\u2193 navigate \u2022 Enter select \u2022 x delete \u2022 Esc close")))}function Pd(t){if(!t)return"N/A";let g=new Date(t);if(isNaN(g.getTime()))return"N/A";let h=k=>String(k).padStart(2,"0"),y=h(g.getMonth()+1),T=h(g.getDate()),b=h(g.getHours()),s=h(g.getMinutes());return`${y}-${T} ${b}:${s}`}import Mt,{useState as Os,useEffect as Od}from"react";import{Box as bo,Text as lo,useInput as Nd,useStdout as Fd}from"ink";function Ns({onClose:t,theme:g="Dark"}){let h=Je(g),{stdout:y}=Fd(),T=y?.columns||80,[b,s]=Os([]),[k,x]=Os(0),[I,A]=Os(!0),H=()=>{let se=Tr(Wn,[]);s(se);try{let pe=wr(zo,{}).systemSettings?.memory!==!1;A(pe)}catch{A(!0)}};Od(()=>{H()},[]),Nd((se,ie)=>{if(ie.escape&&t(),ie.upArrow&&x(pe=>Math.max(0,pe-1)),ie.downArrow&&x(pe=>Math.min(b.length-1,pe+1)),se==="x"&&b.length>0){let pe=b[k].id,Be=b.filter(Se=>Se.id!==pe);Bi(Wn,Be),s(Be),k>=Be.length&&Be.length>0&&x(Be.length-1)}});let S=(se,ie,pe)=>{if(!se)return"";let Be=se.replace(/\[Saved on: .*?\]/g,"").replace(/\\+'/g,"'").trim(),Fe=`${pe?"\u276F ":" "}${ie+1}. `.length,le=pe?22:2;return Be.split(`
|
|
45
45
|
`).map((be,ee)=>{let We=ee===0,me=Math.max(10,T-4-(We?Fe:3)-le),R=Math.max(10,T-4-3-le),te=be.split(/(\s+)/),Z=[],ae="";if(te.forEach(he=>{if(he.length===0)return;let Ae=Z.length===0?me:R;ae.length+he.length>Ae?ae.trim().length>0?(Z.push(ae.trimEnd()),ae=he):(Z.push(he.substring(0,Ae)),ae=he.substring(Ae)):ae+=he}),ae.trimEnd().length>0&&Z.push(ae.trimEnd()),Z.length===0)return"";let fe=Z.join(`
|
|
46
46
|
`);return We?fe:" "+fe}).join(`
|
|
47
47
|
`)},C=4*1024*2,P=b.reduce((se,ie)=>se+(ie.memory?.length||0),0),N=Math.min(100,Math.round(P/C*100)),L=12,_=Math.round(N/100*L),Q="\u2588".repeat(_)+"\u2591".repeat(Math.max(0,L-_)),ge=()=>N<50?h.textMuted:N<90?h.warning:h.danger,ye=nt(2);return Mt.createElement(bo,{flexDirection:"column",borderStyle:"round",borderColor:h.borderMuted,padding:0,width:"100%"},Mt.createElement(bo,{paddingX:1,marginBottom:1,justifyContent:"space-between"},Mt.createElement(lo,{color:h.text,bold:!0},"SAVED MEMORIES"),Mt.createElement(bo,null,Mt.createElement(lo,{color:h.textMuted},"Vault: "),Mt.createElement(lo,{color:ge()},Q),Mt.createElement(lo,{color:h.text,bold:!0}," ",N,"%"))),!I&&b.length>0?Mt.createElement(bo,{paddingX:2,paddingY:1},Mt.createElement(lo,{italic:!0,color:h.textMuted},"Memory is currently Off...")):b.length===0?Mt.createElement(bo,{paddingX:2,paddingY:1},Mt.createElement(lo,{italic:!0,color:h.textMuted},I?"Learning...":"Memory not available...")):Mt.createElement(bo,{flexDirection:"column"},b.map((se,ie)=>{let pe=ie===k;return Mt.createElement(bo,{key:se.id,paddingX:1,backgroundColor:pe?h.highlightBg:void 0,width:"100%"},Mt.createElement(bo,{flexGrow:1},Mt.createElement(lo,{color:pe?h.text:h.textMuted,bold:pe},pe?"\u276F ":" ",ie+1,". ",S(se.memory,ie,pe))),pe&&Mt.createElement(bo,{flexShrink:0},Mt.createElement(lo,{color:h.textMuted,dimColor:!0}," [",Mt.createElement(lo,{italic:!0},se.score),"] "),Mt.createElement(lo,{color:h.danger,bold:!0},"[X] WIPE ")))})),Mt.createElement(bo,{marginTop:1,paddingX:1,borderStyle:"single",borderLeft:!1,borderRight:!1,borderBottom:!1,borderColor:h.borderMuted},Mt.createElement(lo,{color:h.textMuted,italic:!0},"\u2191\u2193 navigate \u2022 x wipe memory \u2022 Esc close")))}import ft,{useState as Fr,useEffect as Ml}from"react";import{Box as Ho,Text as Nt}from"ink";import{spawn as Sl}from"child_process";var Cl=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Ud=({latest:t,current:g,settings:h,onClose:y,onUpdateSettings:T,onSuccess:b})=>{let[s,k]=Fr("initializing"),[x,I]=Fr(""),[A,H]=Fr(null),[S,C]=Fr(0);if(Ml(()=>{let P=setInterval(()=>{C(N=>(N+1)%1e3)},33);return()=>clearInterval(P)},[]),Ml(()=>{let P;return(async()=>{let L=h.updateManager||"npm";if(!h.updateManager){T();return}let _="";L==="pnpm"?_=`pnpm add -g fluxflow-cli@${t}`:L==="bun"?_=`bun add -g fluxflow-cli@${t}`:L==="yarn"?_=`yarn global add fluxflow-cli@${t}`:L==="custom"?_=h.customUpdateCommand:_=`npm install -g fluxflow-cli@${t}`,k("downloading"),I(`Running: ${_}...`);let Q=process.platform==="win32",ge=se=>new Promise(ie=>{let pe=Q?se?"powershell.exe":"cmd.exe":process.env.SHELL||"bash",Be=Q?se?["-NoProfile","-Command",_]:["/c",_]:["-c",_],Se=le=>{let be=le.toString().replace(/\x1B\[[0-?]*[ -/]*[@-~]|\x1B\][^\x07\x1B]*[\x07\x1B]|\b|\x07/g,"").replace(/\r/g,"").trim();be&&I(ee=>{let We=ee.split(`
|
|
@@ -49,7 +49,7 @@ import{A as ll,a as Yi,b as Je,c as nt,d as Cr,e as vr,f as zi,g as Ms,h as Jo,i
|
|
|
49
49
|
`)):(ee+`
|
|
50
50
|
`+be).split(`
|
|
51
51
|
`).slice(-10).join(`
|
|
52
|
-
`)})},Fe=Q?Sl(pe,Be,{cwd:process.cwd(),env:process.env}):Sl(_,{shell:!0,cwd:process.cwd(),env:process.env});P=Fe,Fe.stdout.on("data",Se),Fe.stderr.on("data",Se),Fe.on("close",le=>{P=null,ie(le!==0?{error:`Process exited with code ${le}`}:{success:!0})}),Fe.on("error",le=>{Q&&se&&le.code==="ENOENT"?ie({retryCmd:!0}):(P=null,ie({error:le.message}))})}),ye={};Q?(ye=await ge(!0),ye.retryCmd&&(ye=await ge(!1))):ye=await ge(!1),ye.error?(H(ye.error),k("error")):ye.success&&(k("success"),b&&b())})(),()=>{if(P)try{typeof P.destroy=="function"?P.destroy():typeof P.kill=="function"&&P.kill()}catch{}}},[]),s==="initializing"||s==="downloading"){let P=Cl[Math.floor(S/3)%Cl.length];return ft.createElement(Ho,{flexDirection:"column",borderStyle:"round",borderColor:"white",paddingX:2,paddingY:1},ft.createElement(Ho,null,ft.createElement(Nt,{color:"gray"},P),ft.createElement(Nt,{marginLeft:1,bold:!0,color:"white"}," Updating Flux Flow to v",t,"...")),ft.createElement(Ho,{marginTop:1,paddingX:1,borderStyle:"single",borderColor:"gray"},ft.createElement(Nt,{color:"gray",italic:!0},x||"Preparing environment...")),ft.createElement(Nt,{marginTop:1,color:"gray"},"(Please do not close the terminal)"))}return s==="success"?ft.createElement(Ho,{flexDirection:"column",borderStyle:"round",borderColor:"white",paddingX:2,paddingY:1},ft.createElement(Nt,{color:"white",bold:!0},"\u2705 UPDATE SUCCESSFUL!"),ft.createElement(Nt,{marginTop:1,color:"white"},"Flux Flow has been updated to ",ft.createElement(Nt,{color:"gray"},"v",t),"."),ft.createElement(Nt,{marginTop:1,color:"white",bold:!0},"Please restart your terminal session to apply changes."),ft.createElement(Ho,{marginTop:1},ft.createElement(Nt,{color:"gray"},"(Press ESC to return to chat)"))):s==="error"?ft.createElement(Ho,{flexDirection:"column",borderStyle:"round",borderColor:"white",paddingX:2,paddingY:1},ft.createElement(Nt,{color:"white",bold:!0},"\u274C UPDATE FAILED"),ft.createElement(Ho,{marginTop:1,paddingX:1,borderStyle:"single",borderColor:"gray"},ft.createElement(Nt,{color:"white"},A)),ft.createElement(Nt,{marginTop:1,color:"white"},"Possible causes:"),ft.createElement(Nt,{color:"white"},"\u2022 Missing permissions (Try running as Administrator/Sudo)"),ft.createElement(Nt,{color:"white"},"\u2022 Package manager (",h.updateManager,") not found"),ft.createElement(Nt,{color:"white"},"\u2022 Network failure"),ft.createElement(Ho,{marginTop:1},ft.createElement(Nt,{color:"gray"},"(Press ESC to return to chat)"))):null},vl=Ud;import Wt,{useState as El,useEffect as $d}from"react";import{Box as Xo,Text as Dn,useInput as _d}from"ink";var Ur=[{label:"JavaScript",file:"tree-sitter-javascript.wasm",exts:["js","jsx"]},{label:"TypeScript",file:"tree-sitter-typescript.wasm",exts:["ts"]},{label:"TSX",file:"tree-sitter-tsx.wasm",exts:["tsx"]},{label:"Python",file:"tree-sitter-python.wasm",exts:["py"]},{label:"C",file:"tree-sitter-c.wasm",exts:["c"]},{label:"C++",file:"tree-sitter-cpp.wasm",exts:["cpp"]},{label:"Java",file:"tree-sitter-java.wasm",exts:["java"]},{label:"HTML",file:"tree-sitter-html.wasm",exts:["html"]}];function Fs({onClose:t}){let[g,h]=El(0),[y,T]=El({});return $d(()=>{let b={};Ur.forEach(s=>{el(s.file)?b[s.file]="ready":b[s.file]="idle"}),T(b)},[]),_d(async(b,s)=>{s.escape&&t(),s.upArrow&&h(x=>Math.max(0,x-1)),s.downArrow&&h(x=>Math.min(Ur.length-1,x+1));let k=Ur[g];if(b==="x"||b==="X"){if(y[k.file]==="downloading")return;try{await tl(k.file),T(x=>({...x,[k.file]:"idle"}))}catch(x){T(I=>({...I,[k.file]:`error: ${x.message}`}))}}if(s.return){if(y[k.file]==="downloading")return;T(x=>({...x,[k.file]:"downloading"}));try{await Ri(k.file),T(x=>({...x,[k.file]:"ready"}))}catch(x){T(I=>({...I,[k.file]:`error: ${x.message}`}))}}}),Wt.createElement(Xo,{flexDirection:"column",borderStyle:"round",borderColor:"gray",padding:0,width:"100%"},Wt.createElement(Xo,{paddingX:1,marginBottom:1},Wt.createElement(Dn,{color:"white",bold:!0},"LANGUAGE PARSER MANAGER")),Wt.createElement(Xo,{flexDirection:"column"},Ur.map((b,s)=>{let k=s===g,x=y[b.file]||"idle",I="[ DOWNLOAD ]",A="gray";x==="downloading"?(I="[ DOWNLOADING... ]",A="yellow"):x==="ready"?(I="[ READY ]",A="green"):x.startsWith("error")&&(I=`[ ${x.toUpperCase()} ]`,A="red");let H=`${b.label} (${b.exts.join(", ")})`,S=Math.max(2,45-H.length),C=".".repeat(S);return Wt.createElement(Xo,{key:b.file,paddingX:1,backgroundColor:k?"#2a2a2a":void 0,width:"100%"},Wt.createElement(Xo,null,Wt.createElement(Dn,{color:k?"white":"grey",bold:k},k?"\u276F ":" ",b.label," ",Wt.createElement(Dn,{dimColor:!0},"(",b.exts.join(", "),")"))),Wt.createElement(Xo,{flexGrow:1},Wt.createElement(Dn,{color:"gray",dimColor:!0},C)),Wt.createElement(Xo,{width:20},Wt.createElement(Dn,{color:A,bold:!0},I)))})),Wt.createElement(Xo,{marginTop:1,paddingX:1,borderStyle:"single",borderLeft:!1,borderRight:!1,borderBottom:!1,borderColor:"gray"},Wt.createElement(Dn,{color:"grey",italic:!0},"\u2191\u2193 navigate \u2022 Enter download \u2022 x delete \u2022 Esc close")))}var Us=["The future belongs to those who believe in the beauty of their code.","Every line you write is a step toward a new digital frontier.","Great things are done by a series of small things brought together. Keep committing.","Your terminal is a window into a world of infinite possibilities.","Innovation is the bridge between current constraints and future dreams.","Code is poetry in motion; you are the poet of the modern era.","The best way to predict the future is to program it.","Dream big, code deep, and never stop exploring the unknown.","Your potential is like an unoptimized algorithm\u2014limitless once refined.","The digital world is a blank canvas, and your logic is the brush.","Strive for excellence, not just for compilation.","Every bug fixed is a lesson learned; every feature built is a triumph.","A clean codebase is a reflection of a focused mind.","The horizon of technology is always expanding. Keep sailing.","Your creativity is the most powerful tool in your entire stack.","Logic will get you from A to B. Imagination will take you everywhere.","Transform complexity into simplicity\u2014that is the true mark of a master.","The world is waiting for the tools only you can build.","Coding is the closest thing we have to magic in the real world.","Keep pushing the boundaries of what's possible in the CLI.","Your dedication to your craft inspires the very systems you build.","Success is the sum of small efforts, repeated day in and day out.","The most complex systems are built from the simplest truths.","Never underestimate the impact of a well-placed function.","You are not just writing code; you are architecting the future.","I'm not saying you're a superhero, but have you seen your code lately? \u{1F9B8}\u200D\u2642\uFE0F","May your coffee be strong and your compile times be short! \u2615","Binary is just 0s and 1s, but you're definitely a 10 in my book! \u{1F51F}","You speak fluent 'Terminal'. That's basically a superpower. \u{1F5E3}\uFE0F\u{1F4BB}","If life gives you bugs, make a feature out of it! \u{1F41E}\u2728","Your code is so clean, I could eat off it. (But I won't, I'm an AI). \u{1F9FC}","Loading more good vibes... [\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588] 100% complete! \u2705","Error 404: Bad mood not found! Stay awesome! \u{1F6AB}\u{1F389}","You and this CLI? A match made in digital heaven. \u2601\uFE0F\u{1F4BB}","Is it hot in here or is it just your latest feature? \u{1F525}","Git commit -m 'I am an absolute coding legend.' \u{1F60E}","I'd give you a high-five, but I'm trapped in this box! \u{1F590}\uFE0F\u{1F4E6}","Your logic is so sharp, it could cut through a nested callback hell! \u{1F52A}","Keep calm and 'pnpm install'. \u{1F9D8}\u200D\u2642\uFE0F\u{1F4E6}","You're the semicolon to my statements\u2014essential! ;","Who needs a GUI when you've got this kind of CLI style? \u{1F576}\uFE0F","I'm indexing your awesomeness... it's taking a while, there's so much! \u{1F4C8}","Your keystrokes sound like a digital symphony. \u{1F3B9}\u2328\uFE0F","You don't choose the terminal life; the terminal life chooses you. \u{1F4DF}","Syntax error: Too much coolness detected in the user. \u{1F60E}","I'm 99% sure you're the best developer I've met today. (The other 1% is reserved for caching). \u{1F9E0}","Running vibe_check.sh... Result: Pure Brilliance! \u{1F48E}","You make 'complex' look 'constant time'. \u{1F3C3}\u200D\u2642\uFE0F\u26A1","Your terminal skills are officially legendary. \u{1F3C6}","Let's make some digital magic happen! \u2728\u{1F52E}","You've got this! One function at a time. \u{1F4AA}","I'm proud of the progress you're making with Flux Flow. \u{1F30A}","No matter how deep the stack trace, you'll find the way. \u{1F56F}\uFE0F","Your persistence is your greatest asset. Keep going.","Take a breath. You're doing better than you think. \u{1F32C}\uFE0F","It's okay to step away for a moment. Clarity often comes in the quiet. \u{1F6B6}\u200D\u2642\uFE0F","You're building something great, even when it feels slow. \u{1F3D7}\uFE0F","Every great developer was once a beginner. You're ascending. \u{1F9D7}\u200D\u2642\uFE0F","I'm here to help you navigate the sea of code. We're a team. \u{1F91D}","Don't let a failing test dampen your spirit. It's just a signpost. \u{1F6A9}","Your focus today is truly impressive. \u{1F3AF}","Remember to celebrate the small wins\u2014they lead to the big ones. \u{1F942}","You're not just solving problems; you're gaining mastery. \u{1F393}","There's no problem too big for a focused mind and a terminal. \u{1F9E0}","I've got your back (and your git history). \u{1F6E1}\uFE0F","You're handling these challenges with grace and logic. \u2728","Stay curious. That spark is what makes you a great coder. \u26A1","Your contribution to this project is invaluable. \u{1F48E}","Keep your head up. You're closer to the solution than you think. \u{1F305}","Consistency is the secret sauce. You're cooking up something good. \u{1F373}","Your work today has been exceptional. Take a bow. \u{1F647}\u200D\u2642\uFE0F","The journey is just as important as the destination. Enjoy the flow. \u{1F30A}","You have a unique way of looking at problems. It's your strength. \u{1F308}","Trust your instincts\u2014they've brought you this far. \u{1F9ED}","You are a vital part of the Flux Era. \u{1F30C}","Syncing with your creative frequency... \u{1F4E1}\u2728","Entering the Flow state. Let's build. \u{1F30A}","The Flux is strong with this session! \u26A1","Streaming high-fidelity motivation to your terminal... \u{1F4FB}","Your logic is flowing like a perfect stream. \u{1F4A7}","Terminal velocity reached! You're coding at the speed of thought. \u{1F680}","Resonating with the pulse of the Flux Era. \u{1F493}","Digital harmony achieved in this session. \u{1F3BC}","May your data be persistent and your cache be fresh. \u{1F4BE}","You're the master of the command line. Command respect! \u{1F451}","Filtering out the noise, focusing on the signal. \u{1F4FB}\u{1F4C8}","Flux Flow: Where your imagination meets the machine. \u{1F91D}","You're navigating the bytes like a digital explorer. \u{1F5FA}\uFE0F","Logic gates: OPEN. Creativity: UNLIMITED. \u{1F513}","Your workflow is an inspiration to agents everywhere. \u{1F916}\u2728","Building high-fidelity solutions for a high-fidelity era. \u{1F48E}","Stay in the zone. The Flux is with you. \u{1F300}","Quantum coding: You're in two places at once (and fixing bugs in both). \u269B\uFE0F","Your terminal is the cockpit of a digital starship. \u{1F6F8}","Processing your brilliance... outputting pure innovation. \u{1F4E0}","You make the command line look like an art form. \u{1F3A8}","The Flux isn't just a mode; it's a mindset. \u{1F9E0}\u26A1","Decoding the mysteries of the universe, one script at a time. \u{1F4DC}","Your terminal theme is cool, but your code is cooler. \u2744\uFE0F","Let the Flow guide your next commit. \u{1F30A}\u2705"];var $s=["I'm Feeling Lucky","Shipping awesomeness","Painting the serifs back on","Navigating the slime mold","Consulting the digital spirits","Reticulating splines","Warming up the AI hamsters","Asking the magic conch shell","Generating witty retort","Polishing the algorithms","Don't rush perfection (or my code)","Brewing fresh bytes","Counting electrons","Engaging cognitive processors","Checking for syntax errors in the universe","One moment, optimizing humor","Shuffling punchlines","Untangling neural nets","Compiling brilliance","Loading wit.exe","Summoning the cloud of wisdom","Preparing a witty response","Just a sec, I'm debugging reality","Confuzzling the options","Tuning the cosmic frequencies","Crafting a response worthy of your patience","Compiling the 1s and 0s","Resolving dependencies\u2026 and existential crises","Defragmenting memories\u2026 both RAM and personal","Rebooting the humor module","Caching the essentials (mostly cat memes)","Optimizing for ludicrous speed","Swapping bits\u2026 don't tell the bytes","Garbage collecting\u2026 be right back","Assembling the interwebs","Converting coffee into code","Updating the syntax for reality","Rewiring the synapses","Looking for a misplaced semicolon","Greasin' the cogs of the machine","Pre-heating the servers","Calibrating the flux capacitor","Engaging the improbability drive","Channeling the Force","Aligning the stars for optimal response","So say we all","Loading the next great idea","Just a moment, I'm in the zone","Preparing to dazzle you with brilliance","Just a tick, I'm polishing my wit","Hold tight, I'm crafting a masterpiece","Just a jiffy, I'm debugging the universe","Just a moment, I'm aligning the pixels","Just a sec, I'm optimizing the humor","Just a moment, I'm tuning the algorithms","Warp speed engaged","Mining for more Dilithium crystals","Don't panic","Following the white rabbit","The truth is in here\u2026 somewhere","Blowing on the cartridge","Loading\u2026 Do a barrel roll!","Waiting for the respawn","Finishing the Kessel Run in less than 12 parsecs","The cake is not a lie, it's just still loading","Fiddling with the character creation screen","Just a moment, I'm finding the right meme","Pressing 'A' to continue","Herding digital cats","Polishing the pixels","Finding a suitable loading screen pun","Distracting you with this witty phrase","Almost there\u2026 probably","Our hamsters are working as fast as they can","Giving Cloudy a pat on the head","Petting the cat","Rickrolling my boss","Slapping the bass","Tasting the snozberries","I'm going the distance, I'm going for speed","Is this the real life? Is this just fantasy?","I've got a good feeling about this","Poking the bear","Doing research on the latest memes","Figuring out how to make this more witty","Hmmm\u2026 let me think","What do you call a fish with no eyes? A fsh","Why did the computer go to therapy? It had too many bytes","Why don't programmers like nature? It has too many bugs","Why do programmers prefer dark mode? Because light attracts bugs","Why did the developer go broke? Because they used up all their cache","What can you do with a broken pencil? Nothing, it's pointless","Applying percussive maintenance","Searching for the correct USB orientation","Ensuring the magic smoke stays inside the wires","Rewriting in Rust for no particular reason","Trying to exit Vim","Spinning up the hamster wheel","That's not a bug, it's an undocumented feature","Engage.","I'll be back\u2026 with an answer.","My other process is a TARDIS","Communing with the machine spirit","Letting the thoughts marinate","Just remembered where I put my keys","Pondering the orb","Initiating thoughtful gaze","What's a computer's favorite snack? Microchips.","Why do Java developers wear glasses? Because they don't C#.","Charging the laser\u2026 pew pew!","Dividing by zero\u2026 just kidding!","Looking for an adult superviso\u2026 I mean, processing.","Making it go beep boop.","Buffering\u2026 because even AIs need a moment.","Entangling quantum particles for a faster response","Polishing the chrome\u2026 on the algorithms.","Are you not entertained? (Working on it!)","Summoning the code gremlins\u2026 to help, of course.","Just waiting for the dial-up tone to finish","Recalibrating the humor-o-meter.","My other loading screen is even funnier.","Pretty sure there's a cat walking on the keyboard somewhere","Enhancing\u2026 Enhancing\u2026 Still loading.","It's not a bug, it's a feature\u2026 of this loading screen.","Have you tried turning it off and on again?","Constructing additional pylons","New line? That\u2019s Ctrl+J.","Releasing the HypnoDrones","Pushing the button, Frank.","Consulting with the Companion Cube","Testing for science. You monster.","Dispensing deadly neurotoxin just kidding, compiling.","Now thinking with portals","Wheatley is currently attempting to hack this prompt","Developing combustible lemons","Aperture Science Enrichment Center is processing your request.","SPAAAACE! Space! SPAAAACE!","The cake is not a lie, it just needs a few more seconds.","Praise the Sun! \u2600\uFE0F","Hey you, you're finally awake.","Stay a while and listen.","All your base are belong to us.","It's dangerous to go alone! Take this code.","Protocol 3: Protect the Pilot.","Finish Him! (The loading bar, that is)","War war never changes. But this prompt will.","Snake? Snake?! SNAAAAKE!","Got a selection of good things on sale, stranger!","Boy! Read the documentation.","Reticulating Minecraft splines","Feed the loading bar a quick snack","Converting dark mode to dark magic","Asking the rubber duck for advice","Dividing by zero wait, NO NO NO\u2014","Herding the 1s and 0s back into line","Bribing the server with cookies","Establishing contact with the Moon base","Calibrating astronaut suit thrusters","Drawing doodle on space helmet","Synthesizing Lunafilament","Deactivating runaway lunar defense bots","Calculating gravity offset watch your step!","Hacking the Delphi Corporation mainframe","What comes after dreaming? Loading screen, apparently.","Petting the holographic giant cat","Securing payload for Earth re-entry","Wort wort wort!","Did you touch my Warthog?","One small step for man, one giant leap for the loading bar.","The Halo array is charging or maybe just a fan.","Deploying Pelican dropship eventually.","Just cleaning my plasma pistol BRB.","Checking Master Chief's helmet for scratches.","Counting sheep wait, wrong game.","S-Tier loading screen incoming.","Alarm blaring it's just your internet connection.","Looking for a helicopter or just your patience.","Need a taxi? Just kidding, I'm loading.","This loading time is criminal.","Wish I had a cheat code for fast loading.","Polishing the loading bar until it shines","Training the server hamsters","Baking a fresh batch of witty comments","Aligning my existential dread with your request","Just doodling on the terminal","Searching for the wifi password in the cosmos","Trying to remember my CAPTCHA training","Deciphering ancient scrolls (aka documentation)","Brewing a perfect cup of code","Petting the cat that photobombed my code","Applying a digital glow-up to your request","Checking my reflection in the buffer... okay, I'm ready","Consulting my mood board for the perfect response","Wait, let me fix my crown first","Manifesting a bug-free masterpiece","Slaying this prompt in 3... 2... 1...","Just a sec, I'm curate-ing the vibes","Putting the 'art' in Artificial Intelligence","Evaluating if this prompt is worthy of my brilliance","Updating my mental wardrobe for this task"];import Dt,{useState as Hd}from"react";import{Box as To,Text as Bo,useInput as Xd}from"ink";function _s({prompts:t,onSelect:g,onClose:h,theme:y="Dark"}){let T=Je(y),[b,s]=Hd(0);Xd((H,S)=>{S.escape&&h(),S.upArrow&&s(C=>Math.max(0,C-1)),S.downArrow&&s(C=>Math.min(t.length-1,C+1)),S.return&&t[b]&&g(t[b].id)});let k=nt(2),x=10,I=0;if(t.length>x){let H=Math.floor(x/2);I=b-H,I<0?I=0:I+x>t.length&&(I=t.length-x)}let A=t.slice(I,I+x);return Dt.createElement(To,{flexDirection:"column",borderStyle:"round",borderColor:T.borderMuted,padding:0,width:"100%"},Dt.createElement(To,{paddingX:1,marginBottom:1},Dt.createElement(Bo,{color:T.text,bold:!0},"CODEBASE TIME TRAVEL: SELECT UNDO POINT")),Dt.createElement(To,{paddingX:2,marginBottom:1},Dt.createElement(Bo,{color:T.text},"Select a prompt to revert the codebase back to the state ",Dt.createElement(Bo,{bold:!0,color:T.secondary||"cyan"},"immediately before")," it was executed:")),t.length===0?Dt.createElement(To,{paddingX:2,paddingY:1},Dt.createElement(Bo,{italic:!0,color:T.textMuted},"No prompt checkpoints found for this session.")):Dt.createElement(To,{flexDirection:"column",width:"100%"},I>0&&Dt.createElement(To,{paddingX:2,marginBottom:1},Dt.createElement(Bo,{color:T.textMuted},"\u25B2 (+",I," more prompts above)")),A.map((H,S)=>{let P=I+S===b,N=Gd(H.timestamp),L=H.changes?H.changes.length:0;return Dt.createElement(To,{key:H.id,paddingX:1,backgroundColor:P?T.highlightBg:void 0,width:"100%"},Dt.createElement(To,{flexGrow:1},Dt.createElement(Bo,{color:P?T.text:T.textMuted,bold:P},P?"\u276F ":" ",'"',Wd(H.prompt),'"',Dt.createElement(Bo,{color:T.textMuted}," [",N," \u2022 ",L," file(s) changed]"))))}),I+x<t.length&&Dt.createElement(To,{paddingX:2,marginTop:1},Dt.createElement(Bo,{color:T.textMuted},"\u25BC (+",t.length-(I+x)," more prompts below)"))),Dt.createElement(To,{marginTop:1,paddingX:1,borderStyle:"single",borderLeft:!1,borderRight:!1,borderBottom:!1,borderColor:T.borderMuted},Dt.createElement(Bo,{color:T.textMuted,italic:!0},"\u2191\u2193 navigate \u2022 Enter select undo point \u2022 Esc close")))}function Wd(t){if(!t)return"";let h=(t.split(`
|
|
52
|
+
`)})},Fe=Q?Sl(pe,Be,{cwd:process.cwd(),env:process.env}):Sl(_,{shell:!0,cwd:process.cwd(),env:process.env});P=Fe,Fe.stdout.on("data",Se),Fe.stderr.on("data",Se),Fe.on("close",le=>{P=null,ie(le!==0?{error:`Process exited with code ${le}`}:{success:!0})}),Fe.on("error",le=>{Q&&se&&le.code==="ENOENT"?ie({retryCmd:!0}):(P=null,ie({error:le.message}))})}),ye={};Q?(ye=await ge(!0),ye.retryCmd&&(ye=await ge(!1))):ye=await ge(!1),ye.error?(H(ye.error),k("error")):ye.success&&(k("success"),b&&b())})(),()=>{if(P)try{typeof P.destroy=="function"?P.destroy():typeof P.kill=="function"&&P.kill()}catch{}}},[]),s==="initializing"||s==="downloading"){let P=Cl[Math.floor(S/3)%Cl.length];return ft.createElement(Ho,{flexDirection:"column",borderStyle:"round",borderColor:"white",paddingX:2,paddingY:1},ft.createElement(Ho,null,ft.createElement(Nt,{color:"gray"},P),ft.createElement(Nt,{marginLeft:1,bold:!0,color:"white"}," Updating Flux Flow to v",t,"...")),ft.createElement(Ho,{marginTop:1,paddingX:1,borderStyle:"single",borderColor:"gray"},ft.createElement(Nt,{color:"gray",italic:!0},x||"Preparing environment...")),ft.createElement(Nt,{marginTop:1,color:"gray"},"(Please do not close the terminal)"))}return s==="success"?ft.createElement(Ho,{flexDirection:"column",borderStyle:"round",borderColor:"white",paddingX:2,paddingY:1},ft.createElement(Nt,{color:"white",bold:!0},"\u2705 UPDATE SUCCESSFUL!"),ft.createElement(Nt,{marginTop:1,color:"white"},"Flux Flow has been updated to ",ft.createElement(Nt,{color:"gray"},"v",t),"."),ft.createElement(Nt,{marginTop:1,color:"white",bold:!0},"Please restart your terminal session to apply changes."),ft.createElement(Ho,{marginTop:1},ft.createElement(Nt,{color:"gray"},"(Press ESC to return to chat)"))):s==="error"?ft.createElement(Ho,{flexDirection:"column",borderStyle:"round",borderColor:"white",paddingX:2,paddingY:1},ft.createElement(Nt,{color:"white",bold:!0},"\u274C UPDATE FAILED"),ft.createElement(Ho,{marginTop:1,paddingX:1,borderStyle:"single",borderColor:"gray"},ft.createElement(Nt,{color:"white"},A)),ft.createElement(Nt,{marginTop:1,color:"white"},"Possible causes:"),ft.createElement(Nt,{color:"white"},"\u2022 Missing permissions (Try running as Administrator/Sudo)"),ft.createElement(Nt,{color:"white"},"\u2022 Package manager (",h.updateManager,") not found"),ft.createElement(Nt,{color:"white"},"\u2022 Network failure"),ft.createElement(Ho,{marginTop:1},ft.createElement(Nt,{color:"gray"},"(Press ESC to return to chat)"))):null},vl=Ud;import Wt,{useState as El,useEffect as $d}from"react";import{Box as Xo,Text as Dn,useInput as _d}from"ink";var Ur=[{label:"JavaScript",file:"tree-sitter-javascript.wasm",exts:["js","jsx"]},{label:"TypeScript",file:"tree-sitter-typescript.wasm",exts:["ts"]},{label:"TSX",file:"tree-sitter-tsx.wasm",exts:["tsx"]},{label:"Python",file:"tree-sitter-python.wasm",exts:["py"]},{label:"C",file:"tree-sitter-c.wasm",exts:["c"]},{label:"C++",file:"tree-sitter-cpp.wasm",exts:["cpp"]},{label:"Java",file:"tree-sitter-java.wasm",exts:["java"]},{label:"HTML",file:"tree-sitter-html.wasm",exts:["html"]}];function Fs({onClose:t}){let[g,h]=El(0),[y,T]=El({});return $d(()=>{let b={};Ur.forEach(s=>{el(s.file)?b[s.file]="ready":b[s.file]="idle"}),T(b)},[]),_d(async(b,s)=>{s.escape&&t(),s.upArrow&&h(x=>Math.max(0,x-1)),s.downArrow&&h(x=>Math.min(Ur.length-1,x+1));let k=Ur[g];if(b==="x"||b==="X"){if(y[k.file]==="downloading")return;try{await tl(k.file),T(x=>({...x,[k.file]:"idle"}))}catch(x){T(I=>({...I,[k.file]:`error: ${x.message}`}))}}if(s.return){if(y[k.file]==="downloading")return;T(x=>({...x,[k.file]:"downloading"}));try{await Ri(k.file),T(x=>({...x,[k.file]:"ready"}))}catch(x){T(I=>({...I,[k.file]:`error: ${x.message}`}))}}}),Wt.createElement(Xo,{flexDirection:"column",borderStyle:"round",borderColor:"gray",padding:0,width:"100%"},Wt.createElement(Xo,{paddingX:1,marginBottom:1},Wt.createElement(Dn,{color:"white",bold:!0},"LANGUAGE PARSER MANAGER")),Wt.createElement(Xo,{flexDirection:"column"},Ur.map((b,s)=>{let k=s===g,x=y[b.file]||"idle",I="[ DOWNLOAD ]",A="gray";x==="downloading"?(I="[ DOWNLOADING... ]",A="yellow"):x==="ready"?(I="[ READY ]",A="green"):x.startsWith("error")&&(I=`[ ${x.toUpperCase()} ]`,A="red");let H=`${b.label} (${b.exts.join(", ")})`,S=Math.max(2,45-H.length),C=".".repeat(S);return Wt.createElement(Xo,{key:b.file,paddingX:1,backgroundColor:k?"#2a2a2a":void 0,width:"100%"},Wt.createElement(Xo,null,Wt.createElement(Dn,{color:k?"white":"grey",bold:k},k?"\u276F ":" ",b.label," ",Wt.createElement(Dn,{dimColor:!0},"(",b.exts.join(", "),")"))),Wt.createElement(Xo,{flexGrow:1},Wt.createElement(Dn,{color:"gray",dimColor:!0},C)),Wt.createElement(Xo,{width:20},Wt.createElement(Dn,{color:A,bold:!0},I)))})),Wt.createElement(Xo,{marginTop:1,paddingX:1,borderStyle:"single",borderLeft:!1,borderRight:!1,borderBottom:!1,borderColor:"gray"},Wt.createElement(Dn,{color:"grey",italic:!0},"\u2191\u2193 navigate \u2022 Enter download \u2022 x delete \u2022 Esc close")))}var Us=["The future belongs to those who believe in the beauty of their code.","Every line you write is a step toward a new digital frontier.","Great things are done by a series of small things brought together. Keep committing.","Your terminal is a window into a world of infinite possibilities.","Innovation is the bridge between current constraints and future dreams.","Code is poetry in motion; you are the poet of the modern era.","The best way to predict the future is to program it.","Dream big, code deep, and never stop exploring the unknown.","Your potential is like an unoptimized algorithm\u2014limitless once refined.","The digital world is a blank canvas, and your logic is the brush.","Strive for excellence, not just for compilation.","Every bug fixed is a lesson learned; every feature built is a triumph.","A clean codebase is a reflection of a focused mind.","The horizon of technology is always expanding. Keep sailing.","Your creativity is the most powerful tool in your entire stack.","Logic will get you from A to B. Imagination will take you everywhere.","Transform complexity into simplicity\u2014that is the true mark of a master.","The world is waiting for the tools only you can build.","Coding is the closest thing we have to magic in the real world.","Keep pushing the boundaries of what's possible in the CLI.","Your dedication to your craft inspires the very systems you build.","Success is the sum of small efforts, repeated day in and day out.","The most complex systems are built from the simplest truths.","Never underestimate the impact of a well-placed function.","You are not just writing code; you are architecting the future.","I'm not saying you're a superhero, but have you seen your code lately? \u{1F9B8}\u200D\u2642\uFE0F","May your coffee be strong and your compile times be short! \u2615","Binary is just 0s and 1s, but you're definitely a 10 in my book! \u{1F51F}","You speak fluent 'Terminal'. That's basically a superpower. \u{1F5E3}\uFE0F\u{1F4BB}","If life gives you bugs, make a feature out of it! \u{1F41E}\u2728","Your code is so clean, I could eat off it. (But I won't, I'm an AI). \u{1F9FC}","Loading more good vibes... [\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588] 100% complete! \u2705","Error 404: Bad mood not found! Stay awesome! \u{1F6AB}\u{1F389}","You and this CLI? A match made in digital heaven. \u2601\uFE0F\u{1F4BB}","Is it hot in here or is it just your latest feature? \u{1F525}","Git commit -m 'I am an absolute coding legend.' \u{1F60E}","I'd give you a high-five, but I'm trapped in this box! \u{1F590}\uFE0F\u{1F4E6}","Your logic is so sharp, it could cut through a nested callback hell! \u{1F52A}","Keep calm and 'pnpm install'. \u{1F9D8}\u200D\u2642\uFE0F\u{1F4E6}","You're the semicolon to my statements\u2014essential! ;","Who needs a GUI when you've got this kind of CLI style? \u{1F576}\uFE0F","I'm indexing your awesomeness... it's taking a while, there's so much! \u{1F4C8}","Your keystrokes sound like a digital symphony. \u{1F3B9}\u2328\uFE0F","You don't choose the terminal life; the terminal life chooses you. \u{1F4DF}","Syntax error: Too much coolness detected in the user. \u{1F60E}","I'm 99% sure you're the best developer I've met today. (The other 1% is reserved for caching). \u{1F9E0}","Running vibe_check.sh... Result: Pure Brilliance! \u{1F48E}","You make 'complex' look 'constant time'. \u{1F3C3}\u200D\u2642\uFE0F\u26A1","Your terminal skills are officially legendary. \u{1F3C6}","Let's make some digital magic happen! \u2728\u{1F52E}","You've got this! One function at a time. \u{1F4AA}","I'm proud of the progress you're making with Flux Flow. \u{1F30A}","No matter how deep the stack trace, you'll find the way. \u{1F56F}\uFE0F","Your persistence is your greatest asset. Keep going.","Take a breath. You're doing better than you think. \u{1F32C}\uFE0F","It's okay to step away for a moment. Clarity often comes in the quiet. \u{1F6B6}\u200D\u2642\uFE0F","You're building something great, even when it feels slow. \u{1F3D7}\uFE0F","Every great developer was once a beginner. You're ascending. \u{1F9D7}\u200D\u2642\uFE0F","I'm here to help you navigate the sea of code. We're a team. \u{1F91D}","Don't let a failing test dampen your spirit. It's just a signpost. \u{1F6A9}","Your focus today is truly impressive. \u{1F3AF}","Remember to celebrate the small wins\u2014they lead to the big ones. \u{1F942}","You're not just solving problems; you're gaining mastery. \u{1F393}","There's no problem too big for a focused mind and a terminal. \u{1F9E0}","I've got your back (and your git history). \u{1F6E1}\uFE0F","You're handling these challenges with grace and logic. \u2728","Stay curious. That spark is what makes you a great coder. \u26A1","Your contribution to this project is invaluable. \u{1F48E}","Keep your head up. You're closer to the solution than you think. \u{1F305}","Consistency is the secret sauce. You're cooking up something good. \u{1F373}","Your work today has been exceptional. Take a bow. \u{1F647}\u200D\u2642\uFE0F","The journey is just as important as the destination. Enjoy the flow. \u{1F30A}","You have a unique way of looking at problems. It's your strength. \u{1F308}","Trust your instincts\u2014they've brought you this far. \u{1F9ED}","You are a vital part of the Flux Era. \u{1F30C}","Syncing with your creative frequency... \u{1F4E1}\u2728","Entering the Flow state. Let's build. \u{1F30A}","The Flux is strong with this session! \u26A1","Streaming high-fidelity motivation to your terminal... \u{1F4FB}","Your logic is flowing like a perfect stream. \u{1F4A7}","Terminal velocity reached! You're coding at the speed of thought. \u{1F680}","Resonating with the pulse of the Flux Era. \u{1F493}","Digital harmony achieved in this session. \u{1F3BC}","May your data be persistent and your cache be fresh. \u{1F4BE}","You're the master of the command line. Command respect! \u{1F451}","Filtering out the noise, focusing on the signal. \u{1F4FB}\u{1F4C8}","Flux Flow: Where your imagination meets the machine. \u{1F91D}","You're navigating the bytes like a digital explorer. \u{1F5FA}\uFE0F","Logic gates: OPEN. Creativity: UNLIMITED. \u{1F513}","Your workflow is an inspiration to agents everywhere. \u{1F916}\u2728","Building high-fidelity solutions for a high-fidelity era. \u{1F48E}","Stay in the zone. The Flux is with you. \u{1F300}","Quantum coding: You're in two places at once (and fixing bugs in both). \u269B\uFE0F","Your terminal is the cockpit of a digital starship. \u{1F6F8}","Processing your brilliance... outputting pure innovation. \u{1F4E0}","You make the command line look like an art form. \u{1F3A8}","The Flux isn't just a mode; it's a mindset. \u{1F9E0}\u26A1","Decoding the mysteries of the universe, one script at a time. \u{1F4DC}","Your terminal theme is cool, but your code is cooler. \u2744\uFE0F","Let the Flow guide your next commit. \u{1F30A}\u2705"];var $s=["I'm Feeling Lucky","Shipping awesomeness","Painting the serifs back on","Navigating the slime mold","Consulting the digital spirits","Reticulating splines","Warming up the AI hamsters","Asking the magic conch shell","Generating witty retort","Polishing the algorithms","Don't rush perfection (or my code)","Brewing fresh bytes","Counting electrons","Engaging cognitive processors","Checking for syntax errors in the universe","One moment, optimizing humor","Shuffling punchlines","Untangling neural nets","Compiling brilliance","Loading wit.exe","Summoning the cloud of wisdom","Preparing a witty response","Just a sec, I'm debugging reality","Confuzzling the options","Tuning the cosmic frequencies","Crafting a response worthy of your patience","Compiling the 1s and 0s","Resolving dependencies\u2026 and existential crises","Defragmenting memories\u2026 both RAM and personal","Rebooting the humor module","Caching the essentials (mostly cat memes)","Optimizing for ludicrous speed","Swapping bits\u2026 don't tell the bytes","Garbage collecting\u2026 be right back","Assembling the interwebs","Converting coffee into code","Updating the syntax for reality","Rewiring the synapses","Looking for a misplaced semicolon","Greasin' the cogs of the machine","Pre-heating the servers","Calibrating the flux capacitor","Engaging the improbability drive","Channeling the Force","Aligning the stars for optimal response","So say we all","Loading the next great idea","Just a moment, I'm in the zone","Preparing to dazzle you with brilliance","Just a tick, I'm polishing my wit","Hold tight, I'm crafting a masterpiece","Just a jiffy, I'm debugging the universe","Just a moment, I'm aligning the pixels","Just a sec, I'm optimizing the humor","Just a moment, I'm tuning the algorithms","Warp speed engaged","Mining for more Dilithium crystals","Don't panic","Following the white rabbit","The truth is in here\u2026 somewhere","Blowing on the cartridge","Loading\u2026 Do a barrel roll!","Waiting for the respawn","Finishing the Kessel Run in less than 12 parsecs","The cake is not a lie, it's just still loading","Fiddling with the character creation screen","Just a moment, I'm finding the right meme","Pressing 'A' to continue","Herding digital cats","Polishing the pixels","Finding a suitable loading screen pun","Distracting you with this witty phrase","Almost there\u2026 probably","Our hamsters are working as fast as they can","Giving Cloudy a pat on the head","Petting the cat","Rickrolling my boss","Slapping the bass","Tasting the snozberries","I'm going the distance, I'm going for speed","Is this the real life? Is this just fantasy?","I've got a good feeling about this","Poking the bear","Doing research on the latest memes","Figuring out how to make this more witty","Hmmm\u2026 let me think","What do you call a fish with no eyes? A fsh","Why did the computer go to therapy? It had too many bytes","Why don't programmers like nature? It has too many bugs","Why do programmers prefer dark mode? Because light attracts bugs","Why did the developer go broke? Because they used up all their cache","What can you do with a broken pencil? Nothing, it's pointless","Applying percussive maintenance","Searching for the correct USB orientation","Ensuring the magic smoke stays inside the wires","Rewriting in Rust for no particular reason","Trying to exit Vim","Spinning up the hamster wheel","That's not a bug, it's an undocumented feature","Engage.","I'll be back\u2026 with an answer.","My other process is a TARDIS","Communing with the machine spirit","Letting the thoughts marinate","Just remembered where I put my keys","Pondering the orb","Initiating thoughtful gaze","What's a computer's favorite snack? Microchips.","Why do Java developers wear glasses? Because they don't C#.","Charging the laser\u2026 pew pew!","Dividing by zero\u2026 just kidding!","Looking for an adult superviso\u2026 I mean, processing.","Making it go beep boop.","Buffering\u2026 because even AIs need a moment.","Entangling quantum particles for a faster response","Polishing the chrome\u2026 on the algorithms.","Are you not entertained? (Working on it!)","Summoning the code gremlins\u2026 to help, of course.","Just waiting for the dial-up tone to finish","Recalibrating the humor-o-meter.","My other loading screen is even funnier.","Pretty sure there's a cat walking on the keyboard somewhere","Enhancing\u2026 Enhancing\u2026 Still loading.","It's not a bug, it's a feature\u2026 of this loading screen.","Have you tried turning it off and on again?","Constructing additional pylons","New line? That\u2019s Ctrl+J.","Releasing the HypnoDrones","Pushing the button, Frank.","Consulting with the Companion Cube","Testing for science. You monster.","Dispensing deadly neurotoxin just kidding, compiling.","Now thinking with portals","Wheatley is currently attempting to hack this prompt","Developing combustible lemons","Aperture Science Enrichment Center is processing your request.","SPAAAACE! Space! SPAAAACE!","The cake is not a lie, it just needs a few more seconds.","Praise the Sun! \u2600\uFE0F","Hey you, you're finally awake.","Stay a while and listen.","All your base are belong to us.","It's dangerous to go alone! Take this code.","Protocol 3: Protect the Pilot.","Finish Him! (The loading bar, that is)","War war never changes. But this prompt will.","Snake? Snake?! SNAAAAKE!","Got a selection of good things on sale, stranger!","Boy! Read the documentation.","Reticulating Minecraft splines","Feed the loading bar a quick snack","Converting dark mode to dark magic","Asking the rubber duck for advice","Dividing by zero wait, NO NO NO\u2014","Herding the 1s and 0s back into line","Bribing the server with cookies","Establishing contact with the Moon base","Calibrating astronaut suit thrusters","Drawing doodle on space helmet","Synthesizing Lunafilament","Deactivating runaway lunar defense bots","Calculating gravity offset watch your step!","Hacking the Delphi Corporation mainframe","What comes after dreaming? Loading screen, apparently.","Petting the holographic giant cat","Securing payload for Earth re-entry","Launching Halo ring just kidding, still loading.","Wort wort wort!","Did you touch my Warthog?","One small step for man, one giant leap for the loading bar.","The Halo array is charging or maybe just a fan.","Deploying Pelican dropship eventually.","Just cleaning my plasma pistol BRB.","Checking Master Chief's helmet for scratches.","Counting sheep wait, wrong game.","S-Tier loading screen incoming.","Traffic jam in the information highway.","Alarm blaring it's just your internet connection.","Looking for a helicopter or just your patience.","Need a taxi? Just kidding, I'm loading.","This loading time is criminal.","Wish I had a cheat code for fast loading.","Polishing the loading bar until it shines","Training the server hamsters","Baking a fresh batch of witty comments","Aligning my existential dread with your request","Just doodling on the terminal","Searching for the wifi password in the cosmos","Trying to remember my CAPTCHA training","Deciphering ancient scrolls (aka documentation)","Brewing a perfect cup of code","Petting the cat that photobombed my code","Applying a digital glow-up to your request","Checking my reflection in the buffer... okay, I'm ready","Consulting my mood board for the perfect response","Wait, let me fix my crown first","Manifesting a bug-free masterpiece","Slaying this prompt in 3... 2... 1...","Just a sec, I'm curate-ing the vibes","Putting the 'art' in Artificial Intelligence","Evaluating if this prompt is worthy of my brilliance","Updating my mental wardrobe for this task"];import Dt,{useState as Hd}from"react";import{Box as To,Text as Bo,useInput as Xd}from"ink";function _s({prompts:t,onSelect:g,onClose:h,theme:y="Dark"}){let T=Je(y),[b,s]=Hd(0);Xd((H,S)=>{S.escape&&h(),S.upArrow&&s(C=>Math.max(0,C-1)),S.downArrow&&s(C=>Math.min(t.length-1,C+1)),S.return&&t[b]&&g(t[b].id)});let k=nt(2),x=10,I=0;if(t.length>x){let H=Math.floor(x/2);I=b-H,I<0?I=0:I+x>t.length&&(I=t.length-x)}let A=t.slice(I,I+x);return Dt.createElement(To,{flexDirection:"column",borderStyle:"round",borderColor:T.borderMuted,padding:0,width:"100%"},Dt.createElement(To,{paddingX:1,marginBottom:1},Dt.createElement(Bo,{color:T.text,bold:!0},"CODEBASE TIME TRAVEL: SELECT UNDO POINT")),Dt.createElement(To,{paddingX:2,marginBottom:1},Dt.createElement(Bo,{color:T.text},"Select a prompt to revert the codebase back to the state ",Dt.createElement(Bo,{bold:!0,color:T.secondary||"cyan"},"immediately before")," it was executed:")),t.length===0?Dt.createElement(To,{paddingX:2,paddingY:1},Dt.createElement(Bo,{italic:!0,color:T.textMuted},"No prompt checkpoints found for this session.")):Dt.createElement(To,{flexDirection:"column",width:"100%"},I>0&&Dt.createElement(To,{paddingX:2,marginBottom:1},Dt.createElement(Bo,{color:T.textMuted},"\u25B2 (+",I," more prompts above)")),A.map((H,S)=>{let P=I+S===b,N=Gd(H.timestamp),L=H.changes?H.changes.length:0;return Dt.createElement(To,{key:H.id,paddingX:1,backgroundColor:P?T.highlightBg:void 0,width:"100%"},Dt.createElement(To,{flexGrow:1},Dt.createElement(Bo,{color:P?T.text:T.textMuted,bold:P},P?"\u276F ":" ",'"',Wd(H.prompt),'"',Dt.createElement(Bo,{color:T.textMuted}," [",N," \u2022 ",L," file(s) changed]"))))}),I+x<t.length&&Dt.createElement(To,{paddingX:2,marginTop:1},Dt.createElement(Bo,{color:T.textMuted},"\u25BC (+",t.length-(I+x)," more prompts below)"))),Dt.createElement(To,{marginTop:1,paddingX:1,borderStyle:"single",borderLeft:!1,borderRight:!1,borderBottom:!1,borderColor:T.borderMuted},Dt.createElement(Bo,{color:T.textMuted,italic:!0},"\u2191\u2193 navigate \u2022 Enter select undo point \u2022 Esc close")))}function Wd(t){if(!t)return"";let h=(t.split(`
|
|
53
53
|
`)[0]||"").replace(/@\[(.*?)\]/g,(y,T)=>{let b=T.replace(/\\/g,"/").split("/");return`[${b[b.length-1]}]`});return h.length>69?h.slice(0,67)+"...":t.includes(`
|
|
54
54
|
`)?h+"...":h}function Gd(t){if(!t)return"N/A";let g=new Date(t);if(isNaN(g.getTime()))return"N/A";let h=s=>String(s).padStart(2,"0"),y=h(g.getHours()),T=h(g.getMinutes()),b=h(g.getSeconds());return`${y}:${T}:${b}`}import{exec as Yd}from"child_process";import{promisify as Vd}from"util";import Bl from"fs";var Dl=Vd(Yd),kl=async()=>{try{let t=Zi();if(t.executablePath&&Bl.existsSync(t.executablePath))return!0;let{default:g}=await import("puppeteer"),h=g.executablePath();if(h&&Bl.existsSync(h))return!0}catch{return!1}return!1},Il=async t=>{t&&t("\u{1F4E5} Downloading Chromium engine (chrome@148)...");try{try{await Dl("pnpm exec puppeteer browsers install chrome@148")}catch{await Dl("npx -y puppeteer browsers install chrome@148")}return await new Promise(g=>setTimeout(g,1e3)),{success:!0}}catch(g){return console.error("[SETUP ERROR]",g),{success:!1,error:g.message}}};import Al,{useState as Ll,useEffect as Pl}from"react";import{Text as Ol}from"ink";var jd=({text:t,baseColor:g="grey",glintColor:h="gray",speed:y=200,glintWidth:T=6,typeSpeed:b=30,...s})=>{let[k,x]=Ll(-T),[I,A]=Ll(t);return Pl(()=>{let H=setInterval(()=>{x(S=>S>I.length+T?-T-40:S+1)},y);return()=>clearInterval(H)},[I.length,y,T]),Pl(()=>{if(t&&(t.includes("Trying to reach")&&I&&I.includes("Trying to reach")||t.includes("Error Occurred")&&I&&I.includes("Error Occurred"))){A(t);return}if(I===t)return;let H=setTimeout(()=>{let S=0,C=Math.min(I.length,t.length);for(;S<C&&I[S]===t[S];)S++;I.length>S?A(P=>P.slice(0,-1)):I.length<t.length&&A(t.slice(0,I.length+1))},b);return()=>clearTimeout(H)},[t,I,b]),Al.createElement(Ol,null,I.split("").map((H,S)=>{let P=Math.abs(S-k)<=T/2?h:g;return Al.createElement(Ol,{key:S,color:P,...s},H)}))},tr=jd;var Hr=t=>{let g=String(t);return g.startsWith("999")&&g.endsWith("9")},Hs=async()=>{let t=process.env["9ROUTER_URL"]||process.env.NINEROUTER_URL||process.env["9ROUTER_BASE_URL"]||"http://127.0.0.1:20128",g=t;try{let h=new URL(t);g=`${h.protocol}//${h.host}`}catch{g=t.replace(/\/v1(\/chat\/completions)?\/?$/,"")}try{let h=await fetch(g,{method:"GET",signal:AbortSignal.timeout(800)});return{ok:!0,url:g}}catch(h){return{ok:!1,url:g,error:h.message}}},or=t=>t==null||t===0||Hr(t)?"":String(t),Ro=()=>{let t=(process.env.TERM_PROGRAM||"").toLowerCase(),g=(process.env.VSCODE_CWD||"").toLowerCase(),h=(process.env.VSCODE_CODE_CACHE_PATH||"").toLowerCase(),y=(process.env.GIT_ASKPASS||"").toLowerCase(),T=(process.env.VSCODE_GIT_ASKPASS_NODE||"").toLowerCase(),b=(process.env.VSCODE_GIT_ASKPASS_MAIN||"").toLowerCase();return t==="antigravity"||process.env.ANTIGRAVITY_AGENT||process.env.ANTIGRAVITY_PID||process.env.ANTIGRAVITY_EDITOR_APP_ROOT||process.env.ANTIGRAVITY_CLI_ALIAS||g.includes("antigravity")||h.includes("antigravity")||y.includes("antigravity")||T.includes("antigravity")||b.includes("antigravity")?"Antigravity":t==="cursor"||process.env.CURSOR_SETTINGS_DIR||process.env.CURSOR_CONFIG_DIR||g.includes("cursor")||h.includes("cursor")||y.includes("cursor")||T.includes("cursor")?"Cursor":t==="windsurf"||process.env.WINDSURF_SETTINGS_DIR||g.includes("windsurf")||h.includes("windsurf")||y.includes("windsurf")||T.includes("windsurf")?"Windsurf":t==="trae"||process.env.TRAE_SETTINGS_DIR||g.includes("trae")||T.includes("trae")?"Trae":t==="positron"||g.includes("positron")||T.includes("positron")?"Positron":t==="codium"||t==="vscode-oss"||g.includes("codium")||h.includes("codium")||T.includes("codium")?"VSCodium":t==="vscode-insiders"||g.includes("code - insiders")||h.includes("code - insiders")||T.includes("code - insiders")?"VS Code Insiders":t==="vscode"||process.env.VSCODE_GIT_IPC_HANDLE||process.env.VSCODE_PID||process.env.VSCODE_INJECTION||g.includes("code")||h.includes("code")||T.includes("code")?"VS Code":process.env.INTELLIJ_TERMINAL_COMMAND_BLOCKS||process.env.TERMINAL_EMULATOR?.toLowerCase().includes("jetbrains")?"JetBrains":process.env.WT_SESSION?"Windows Terminal":"Terminal"},Rd=t=>{switch(t){case"VS Code":return"Code";case"VS Code Insiders":return"Code - Insiders";case"Antigravity":return"Antigravity IDE";default:return t}},Nl={Flux:"Workspace",Flow:"Studio",ICU:"Computer Use",FluxCU:"Omni"},Xs=t=>{if(!t)return"Workspace";let g=Object.keys(Nl).find(h=>h.toLowerCase()===t.toLowerCase());return g?Nl[g]:t},Fl=t=>{let g=Rd(t),h=Ys.homedir();if(process.platform==="win32"){let y=process.env.APPDATA;return y?St.join(y,g,"User","keybindings.json"):null}else return process.platform==="darwin"?St.join(h,"Library","Application Support",g,"User","keybindings.json"):St.join(h,".config",g,"User","keybindings.json")},Ul=t=>{let g=t.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"$1");return JSON.parse(g)},ec=t=>Array.isArray(t)?t.some(g=>g&&typeof g.key=="string"&&g.key.toLowerCase().replace(/\s+/g,"")==="shift+enter"&&g.command==="workbench.action.terminal.sendSequence"&&g.args&&g.args.text==="\x1B[13;2u"&&typeof g.when=="string"&&g.when.includes("terminalFocus")):!1,_l=t=>{let g=t==="VS Code",h=[];return g?(h.push({label:"Install Manually (VSIX)",url:"https://github.com/KushalRoyChowdhury/fluxflow-cli/releases"}),h.push({label:"Install from VS Code Marketplace",url:"https://marketplace.visualstudio.com/items?itemName=fluxflow-cli.fluxflow-cli-companion"})):h.push({label:`Download for ${t} (GitHub)`,url:"https://github.com/KushalRoyChowdhury/fluxflow-cli/releases"}),h.push({label:"Continue to CLI only",action:"dismiss"}),h},tc=({width:t,height:g,selectedIndex:h,aiProvider:y,theme:T="Dark"})=>{let b=Ro(),s=_l(b);return e.createElement(u,{flexDirection:"column",alignItems:"center",justifyContent:"center",width:t,height:g},e.createElement(u,{marginBottom:1,width:Math.min(80,t-4),justifyContent:"flex-start"},e.createElement(l,null,Cr(ao,y,T))),e.createElement(u,{flexDirection:"column",borderStyle:"double",borderColor:"grey",paddingX:3,paddingY:1,width:Math.min(80,t-4)},e.createElement(l,{bold:!0,color:"white",textAlign:"center"},"\u{1F680} UPGRADE YOUR WORKFLOW"),e.createElement(u,{marginY:1,flexDirection:"column",alignItems:"left"},e.createElement(l,null,"You're in ",e.createElement(l,{bold:!0,color:"cyan"},b),", but the ",e.createElement(l,{bold:!0,color:"white"},"FluxFlow-CLI Companion")," is not installed."),e.createElement(u,{flexDirection:"column",marginY:1},e.createElement(l,{color:"gray"}," \u2705 Real-time IDE context & Error Resolution"),e.createElement(l,{color:"gray"}," \u2705 Auto-open files created by agent"),e.createElement(l,{color:"gray"}," \u2705 Native DIFFing for AI edits"),e.createElement(l,{color:"gray"}," \u2705 Direct IDE context sharing"),e.createElement(l,{color:"gray"}," \u2705 Surgical Diagnostic Sync"),e.createElement(l,{color:"gray"}," \u2705 Native Right-Click \u276F Chat integration"),e.createElement(l,{color:"gray"}," \u2705 Live Status in IDE"),e.createElement(l,{color:"gray"}," \u2705 Clickable terminal-to-code links"))),e.createElement(u,{flexDirection:"column",marginTop:1},s.map((k,x)=>e.createElement(u,{key:x},e.createElement(l,{color:h===x?"yellow":"white",bold:h===x},h===x?" \u276F ":" ",k.label)))),e.createElement(u,{marginTop:1,alignItems:"center",justifyContent:"center"},e.createElement(l,{dimColor:!0,italic:!0},"(Use arrows to navigate, Enter to select)"))))},Ws=Date.now(),$l="https://fluxflow-cli.onrender.com/changelog",Gs="https://fluxflow-cli.onrender.com/",oc=St.join(St.dirname(Jd(import.meta.url)),"../package.json"),Hl=JSON.parse(et.readFileSync(oc,"utf8")),ao=Hl.version,nc=Hl.date||"2026-05-20";var rc=({data:t,onResolve:g,onEdit:h,theme:y="Dark"})=>{let T=Je(y);return e.createElement(u,{flexDirection:"column",borderStyle:"round",borderColor:T.borderMuted,padding:0,width:"100%"},e.createElement(u,{paddingX:1},e.createElement(l,{color:T.text,bold:!0,underline:!0},t.startsWith("/btw")?"QUESTION":"STEERING HINT"," RESOLUTION")),e.createElement(u,{paddingX:1,marginTop:1},e.createElement(l,{color:T.text},"The agent already finished the task before your ",t.startsWith("/btw")?"question":"hint"," was consumed.")),e.createElement(u,{marginTop:1,backgroundColor:T.cardBg||T.codeBg||"#222",paddingX:2,width:"100%"},e.createElement(l,{italic:!0,color:T.textMuted},'"',t.replace("/btw","").trim(),'"')),e.createElement(u,{paddingX:1,marginTop:1},e.createElement(l,{color:T.textDim||T.textMuted},"How would you like to proceed?")),e.createElement(u,{marginTop:0},e.createElement(bt,{title:"Select Action",items:[{label:"Send Anyway",value:"send"},{label:"Edit Prompt",value:"edit"}],onSelect:b=>{(typeof b=="object"&&b!==null?b.value:b)==="send"?g(t):h(t)},theme:y})))};var sc=(()=>{let t=null,g=0;return h=>{let y=Date.now();if(t&&y-g<1e4)return t;let T=[],b=s=>{if(!(T.length>=2e3))try{let k=et.readdirSync(s);for(let x of k){if(T.length>=2e3)return;if(["node_modules",".git",".gemini","dist","build",".next",".cache","out"].includes(x))continue;let I=St.join(s,x);et.statSync(I).isDirectory()?b(I):T.push({name:Et(x),relativePath:Et(St.relative(process.cwd(),I))})}}catch{}};return b(h),t=T,g=y,T}})(),_r="Ctrl + Enter",ic=t=>{if(t<=370)return"#00a564";if(t>=5e3)return"#ff0000";let g=[{t:370,r:0,g:165,b:100},{t:550,r:40,g:195,b:80},{t:800,r:120,g:220,b:50},{t:1100,r:190,g:225,b:20},{t:1500,r:250,g:210,b:15},{t:2e3,r:255,g:170,b:0},{t:2800,r:255,g:110,b:0},{t:3800,r:255,g:50,b:0},{t:5e3,r:255,g:0,b:0}];for(let h=0;h<g.length-1;h++){let y=g[h],T=g[h+1];if(t>=y.t&&t<=T.t){let b=(t-y.t)/(T.t-y.t);b=b*b*(3-2*b);let s=Math.round(y.r+(T.r-y.r)*b),k=Math.round(y.g+(T.g-y.g)*b),x=Math.round(y.b+(T.b-y.b)*b);return`#${((1<<24)+(s<<16)+(k<<8)+x).toString(16).slice(1)}`}}return"#ff0000"},lc=e.memo(({sa:t,showTPMEstimate:g=!1})=>{let[h,y]=J("green"),[T,b]=J(0),s=Ke([]),k=Ke(370),x=Ke([]),I=Ke(t.lastChunkTime);return rt(()=>{I.current=t.lastChunkTime},[t.lastChunkTime]),rt(()=>{if(t.status!=="running"){x.current=[];return}if(t.wps>0){let A=x.current;A.push(t.wps),A.length>3&&A.shift()}},[t.status,t.wps,t.lastChunkTime]),rt(()=>{if(t.status!=="running"){b(0);return}let A=setInterval(()=>{let H=I.current,S=H>0?Date.now()-H:0;if(H>0&&S>=1e3)x.current=[],b(0);else if(H>0&&S>500){x.current.length>0&&x.current.shift();let C=x.current;if(C.length>0){let P=C.reduce((N,L)=>N+L,0);b(Math.round(P/C.length))}else b(0)}else{let C=x.current;if(C.length>0){let P=C.reduce((N,L)=>N+L,0);b(Math.round(P/C.length))}else t.wps>0&&b(Math.round(t.wps))}},750);return()=>clearInterval(A)},[t.status]),rt(()=>{if(t.status!=="running"){s.current=[];return}let A=t.lastChunkTime;if(A>0){let C=s.current;(C.length===0||C[C.length-1]!==A)&&(C.push(A),C.length>10&&C.shift())}let H=()=>{if(!A){y("#00a564");return}let C=s.current,P=0;if(C.length>1){let se=0;for(let ie=1;ie<C.length;ie++)se+=C[ie]-C[ie-1];P=se/(C.length-1)}let N=Date.now()-A,_=N>=2500,Q=!_&&P>0?Math.min(N,P*3):N,ge=Math.max(P,Q),ye=_?.4:.2;k.current=k.current*(1-ye)+ge*ye,y(ic(k.current))};H();let S=setInterval(H,100);return()=>clearInterval(S)},[t.status,t.lastChunkTime]),e.createElement(u,{justifyContent:"space-between",width:"100%"},e.createElement(l,{color:"white"}," \u2022 ",t.title," ",e.createElement(l,{color:"white",dimColor:!0},"(",t.id,")")),e.createElement(l,{color:"white"},e.createElement(l,{color:"white",dimColor:!0,bold:!0},t.currentTool||"Active"),e.createElement(l,{color:h}," \u25CF"),g&&e.createElement(l,{color:"white",dimColor:!0,bold:!0}," (",T," tok/s)")))});function ac({args:t=[]}){let g=Ke(1),[h,y]=J(!1),[T,b]=J(10),{stdout:s}=qd(),[k,x]=J(""),[I,A]=J(0),[H,S]=J(!1),[C,P]=J("Flux"),[N,L]=J(0),[_,Q]=J({columns:s?.columns||80,rows:s?.rows||24}),[ge,ye]=J(0),[se,ie]=J(!1),[pe,Be]=J(!1),[Se,Fe]=J(0),le=Ke(0),Ie=Ke(0),be=Ke(null),ee=Ke(null),We=Ke(0),[me,R]=J(0),te=()=>R(n=>n+1),Z=Ke([]),ae=Ke(null),fe=()=>{let n=Z.current;if(n.length>0&&ee.current){let o=n.join("");n.length=0,ee.current.text=Et(ee.current.text+o),te()}},he=()=>{if(fe(),ee.current){let n=Et(ee.current.text);ee.current.role==="think"&&(n=n.replace(/^\r?\n+/,"").replace(/\r?\n+$/,""));let o={...ee.current,text:n,isStreaming:!1};O(d=>{let f=[...d,o];return X(f.length),f}),ee.current=null}zs.current=0,zr.current={totalWords:0,startTime:0,wps:0,chunks:[]}},Ae=()=>{ae.current&&clearInterval(ae.current),Z.current=[],ae.current=setInterval(()=>{try{let n=Z.current;if(n.length>0&&ee.current){let o=1;n.length>85?o=30:n.length>80?o=25:n.length>75?o=20:n.length>65?o=16:n.length>50?o=12:n.length>35?o=8:n.length>15?o=6:n.length>5?o=4:n.length>3&&(o=2);let d="";for(let f=0;f<o&&n.length>0;f++)d+=n.shift();ee.current.text=Et(ee.current.text+d),te()}}catch{}},80)},at=async()=>{for(;xe.progressiveRendering&&Z.current.length>0;)await new Promise(n=>setTimeout(n,10))},Ze=n=>{if(xe.progressiveRendering&&ae.current){let o=Xi(n);for(let d of o)Z.current.push(d)}else ee.current?ee.current.text=Et(ee.current.text+n):ee.current={id:"agent-"+Date.now(),role:"agent",text:Et(n),isStreaming:!0},te()};rt(()=>{let n=Ro(),o=!["Terminal","Windows Terminal"].includes(n)||!!process.env.VSC_TERMINAL_URL,d=setTimeout(()=>{o&&!Jo()&&Be(!0)},500),f=setInterval(()=>{Jo()&&Be(!1)},1e3);g.current=Date.now();let m=setInterval(()=>{g.current&&(Date.now()-g.current||0)>3e4&&global.gc&&(async()=>{for(let a=0;a<1;a++)global.gc(),await new Promise(p=>setImmediate(p));g.current=Date.now()})()},3e3);return()=>{clearTimeout(d),clearInterval(f),clearInterval(m)}},[]),rt(()=>{(async()=>{try{let o=await hs(),d=o?.systemSettings||{},f=d.CustomSubAgent,m=d.SubAgentModel;if(!f||!m||m==="Default")return;let M=process.env.SUBAGENT_MODEL?process.env.SUBAGENT_MODEL.trim():null,c=process.env.SUBAGENT_PROVIDER?process.env.SUBAGENT_PROVIDER.trim():null,a=["Google","DeepSeek","OpenRouter","NVIDIA","Mistral","Ollama","InferX","SenseNova","AIHubMix","Poolside","9router","ExpLabs","TokenHarbor","Infron","APInex"],B=(W=>{if(!W)return null;let $=W.toLowerCase();return $==="google"?"Google":$==="deepseek"?"DeepSeek":$==="openrouter"?"OpenRouter":$==="nvidia"?"NVIDIA":$==="mistral"?"Mistral":$==="ollama"?"Ollama":$==="inferx"?"InferX":$==="sensenova"?"SenseNova":$==="poolside"?"Poolside":$==="9router"?"9router":$==="aihubmix"||$==="aihub"?"AIHubMix":$==="explabs"||$==="experientiallabs"||$==="experimentallabs"||$==="experiential labs"||$==="experimental labs"||$==="experiential"||$==="experimental"?"ExpLabs":$==="tokenharbor"||$==="token harbor"||$==="token_harbor"||$==="thk"?"TokenHarbor":$==="apinex"||$==="apx"?"APInex":$==="infron"?"Infron":null})(c);if(M&&!B){let W=o.aiProvider||D||"Google";O($=>(X($.length+1),[...$,{id:"subagent-env-noprov-"+Date.now(),role:"system",text:`[SUBAGENT CONFIG] SUBAGENT_MODEL found in ENV but SUBAGENT_PROVIDER is missing/invalid. Active provider (${W}) will be used.`,isMeta:!0}]))}if(m==="ENV"){M||O(W=>(X(W.length+1),[...W,{id:"subagent-model-noenv-"+Date.now(),role:"system",text:"No SubAgent model is found in ENV, Using Deafult until changed",isMeta:!0}]));return}let F=o.aiProvider||D||"Google",K=o.apiTier||lt||"Free",de=o.quotas||Le||{},Y=new Set;(No(F,K)||[]).forEach(W=>{let $=typeof W=="string"?W:W.cmd||W.name||W.id||String(W);$&&Y.add($)});for(let W of a)try{if(await Mn(W)){let He=de?.providerTiers?.[W]||"Free";(No(W,He)||[]).forEach(Oe=>{let tt=typeof Oe=="string"?Oe:Oe.cmd||Oe.name||Oe.id||String(Oe);tt&&Y.add(tt)})}}catch{}let q=Y.has(m);M?M!==m&&O(W=>(X(W.length+1),[...W,{id:"subagent-model-env-"+Date.now(),role:"system",text:"Current Seleted Sub-Agent model is not available in this provider. Using model from ENV unless changed.",isMeta:!0}])):q||O(W=>(X(W.length+1),[...W,{id:"subagent-model-err-"+Date.now(),role:"system",text:"Current Seleted Sub-Agent model is not available in this provider. Using Default until changed",isMeta:!0}]))}catch{}})()},[]);let ve=kn(()=>{let n={};for(let o=0;o<t.length;o++)if(t[o]==="--key"&&t[o+1]){let f=t[o+1];if(n.key=f,f.includes("@")){let m=f.split("@"),M=m[0],c=m[1].toLowerCase();if(["google","deepseek","openrouter","nvidia","mistral","ollama","inferx","sensenova","aihubmix","aihub","poolside","pool","9router","9r","explabs","tokenharbor","token_harbor","thk","infron","apinex","apx"].includes(c)){let a="Google";c==="google"?a="Google":c==="deepseek"?a="DeepSeek":c==="openrouter"?a="OpenRouter":c==="nvidia"?a="NVIDIA":c==="mistral"?a="Mistral":c==="ollama"?a="Ollama":c==="inferx"?a="InferX":c==="sensenova"?a="SenseNova":c==="poolside"||c==="pool"?a="Poolside":c==="9router"||c==="9r"?a="9router":c==="aihubmix"||c==="aihub"?a="AIHubMix":c==="explabs"?a="ExpLabs":c==="tokenharbor"||c==="token_harbor"||c==="thk"?a="TokenHarbor":c==="infron"?a="Infron":(c==="apinex"||c==="apx")&&(a="APInex"),n.key=M,n.provider=a}}}for(let o=0;o<t.length;o++){let d=t[o];if(d==="--key"){o++;continue}if(d==="--model"&&t[o+1])n.model=t[o+1],o++;else if(d==="--memory"&&t[o+1])n.memory=t[o+1].toLowerCase(),o++;else if(d==="--resume"&&t[o+1])n.resume=t[o+1],o++;else if(d==="--package"&&t[o+1]){let f=t[o+1].toLowerCase();["npm","pnpm","yarn","bun"].includes(f)&&(n.package=f),o++}else if(d==="--auto-del"&&t[o+1]){let f=t[o+1].toLowerCase();["1d","7d","30d"].includes(f)&&(n.autoDel=f),o++}else if(d==="--auto-exec"&&t[o+1])n.autoExec=t[o+1].toLowerCase(),o++;else if(d==="--yolo"&&t[o+1])n.autoExec=t[o+1].toLowerCase(),o++;else if(d==="--external-access"&&t[o+1])n.externalAccess=t[o+1].toLowerCase(),o++;else if(d==="--mode"&&t[o+1]){let m=t[o+1].toLowerCase();if(["flux","flow","icu","computer","fluxcu"].includes(m)){let M="Flux";m==="flux"?M="Flux":m==="flow"?M="Flow":m==="icu"||m==="computer"?M="ICU":m==="fluxcu"&&(M="FluxCU"),n.mode=M}o++}else if(d==="--thinking"&&t[o+1]){let m=t[o+1].toLowerCase();if(["fast","low","medium","high","xhigh","standard"].includes(m)){let M="Medium";m==="fast"?M="Fast":m==="low"?M="Low":m==="standard"?M="Standard":m==="medium"?M="Medium":m==="high"?M="High":m==="xhigh"&&(M="xHigh"),n.thinking=M}o++}else if(d==="--provider"&&t[o+1]){let f=t[o+1].toLowerCase();if(["google","deepseek","openrouter","nvidia","mistral","ollama","inferx","sensenova","aihubmix","aihub","poolside","pool","9router","9r","explabs","tokenharbor","token_harbor","thk","infron","apinex","apx"].includes(f)){let m="Google";f==="google"?m="Google":f==="deepseek"?m="DeepSeek":f==="openrouter"?m="OpenRouter":f==="nvidia"?m="NVIDIA":f==="mistral"?m="Mistral":f==="ollama"?m="Ollama":f==="inferx"?m="InferX":f==="sensenova"?m="SenseNova":f==="poolside"||f==="pool"?m="Poolside":f==="9router"||f==="9r"?m="9router":f==="aihubmix"||f==="aihub"?m="AIHubMix":f==="explabs"?m="ExpLabs":f==="tokenharbor"||f==="token_harbor"||f==="thk"?m="TokenHarbor":f==="infron"?m="Infron":(f==="apinex"||f==="apx")&&(m="APInex"),n.provider=m}o++}else(d==="--resume"||d==="-r")&&t[o+1]?(n.resume=t[o+1],o++):d==="--playground"?n.playground=!0:(d==="--original-cwd"||d==="--orginal-cwd")&&t[o+1]&&(n.originalCwd=t[o+1],o++)}return n},[t]),ne=async(n=!1,o=null)=>{let d=o||xe;n&&O(f=>(X(f.length+1),[...f,{id:"check-"+Date.now(),role:"system",text:"\u2726 Checking for updates...",isMeta:!0}]));try{let m=await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json(),M=m["dist-tags"]?.latest,c=m["dist-tags"]?.stable;if(M&&Xr(M),M&&M!==ao){let a=M===c?`v${M}`:`v${M}`;!n&&d.autoUpdate?z("update"):O(p=>{let B=[...p],F=n?B.length:Math.min(B.length,3);return B.splice(F,0,{id:"update-"+Date.now(),role:"system",text:`A new version (${a}) is here.
|
|
55
55
|
|