fluxflow-cli 4.49.0 → 4.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/chunks/ai-EWDCEXLL.js +1 -0
  2. package/dist/chunks/{app-6TAUOS56.js → app-C7G3NWAQ.js} +151 -151
  3. package/dist/chunks/{auto_completion-33R46AFF.js → auto_completion-5WD4TTIP.js} +1 -1
  4. package/dist/chunks/{chunk-ZCM4J7JT.js → chunk-5KSNFTQN.js} +1 -1
  5. package/dist/chunks/{chunk-IMX3PWYO.js → chunk-6JMPGZPV.js} +1 -1
  6. package/dist/chunks/{chunk-36FKJWXK.js → chunk-OB2V6ZNC.js} +187 -185
  7. package/dist/chunks/chunk-PACSPBDP.js +1 -0
  8. package/dist/chunks/{chunk-2YDU2B2F.js → chunk-T5CUPXCW.js} +1 -1
  9. package/dist/chunks/{chunk-TNA3R7TS.js → chunk-TRVRMCHV.js} +1 -1
  10. package/dist/chunks/chunk-TX3H7HDF.js +44 -0
  11. package/dist/chunks/{chunk-AIWOSKP3.js → chunk-ZURGYQ4L.js} +1 -1
  12. package/dist/chunks/{click-HMFVJIQN.js → click-F4M4FVLQ.js} +2 -2
  13. package/dist/chunks/{computer_action-6AYM3W7D.js → computer_action-72ZORSKW.js} +1 -1
  14. package/dist/chunks/{custom_openai-HY6EEQI2.js → custom_openai-BLC4CWOL.js} +1 -1
  15. package/dist/chunks/{drag-H53TOSDP.js → drag-OT2BJZ4P.js} +1 -1
  16. package/dist/chunks/{generate_image-JS7J4FLD.js → generate_image-V4OMOT7Z.js} +1 -1
  17. package/dist/chunks/{invoke-WGWAIYZH.js → invoke-L2V4QMJG.js} +2 -2
  18. package/dist/chunks/{invokeSync-DCL3EMVV.js → invokeSync-7NWIYBX5.js} +2 -2
  19. package/dist/chunks/{key_press-NF322TXF.js → key_press-IVB7R7CK.js} +1 -1
  20. package/dist/chunks/{keyboard_typing-OADL5LPA.js → keyboard_typing-A6VFLI7Q.js} +1 -1
  21. package/dist/chunks/{ollama-NWY2XLYF.js → ollama-DIFOZ4PM.js} +1 -1
  22. package/dist/chunks/{recapture_screen-IXVMQR5C.js → recapture_screen-TVTRNE7C.js} +1 -1
  23. package/dist/chunks/{screen_grid-DGIDOOQD.js → screen_grid-AEHMTXP3.js} +1 -1
  24. package/dist/chunks/{scroll-B3HCFDTS.js → scroll-KFID5QKZ.js} +1 -1
  25. package/dist/chunks/{search_keyword-UXNKLCGC.js → search_keyword-666PL7YG.js} +1 -1
  26. package/dist/chunks/{secrets-NGDMM5RJ.js → secrets-JMSL57D2.js} +1 -1
  27. package/dist/chunks/{secrets_v2-R5GMXRT3.js → secrets_v2-U7JR7ZO6.js} +1 -1
  28. package/dist/chunks/{settings-JME7GCEU.js → settings-3VSVCZDF.js} +1 -1
  29. package/dist/chunks/{update_file-YXW37NRJ.js → update_file-RG5QSLR2.js} +1 -1
  30. package/dist/chunks/{usage-URT2EC23.js → usage-AJDMLXTH.js} +1 -1
  31. package/dist/chunks/{usageServer-RJDE5QDZ.js → usageServer-4X7T4FDJ.js} +1 -1
  32. package/dist/chunks/{write_file-WMLWKQKI.js → write_file-AQJXPIUV.js} +1 -1
  33. package/dist/cli.js +20 -20
  34. package/dist/package.json +2 -2
  35. package/package.json +2 -2
  36. package/dist/chunks/ai-QEMKCYGG.js +0 -1
  37. package/dist/chunks/chunk-2XQIWDKW.js +0 -1
  38. package/dist/chunks/chunk-AMFNIFF3.js +0 -44
@@ -1,4 +1,4 @@
1
- import{a as Gs}from"./chunk-HFTI3R3Q.js";import{a as Mo}from"./chunk-52STSLCN.js";import{a as tn}from"./chunk-56EJGQU3.js";import{a as js}from"./chunk-4BLSASW6.js";import{c as Ui,g as Wi,h as Ds,i as Fs}from"./chunk-AMFNIFF3.js";import{b as Bs,c as Us,d as Gi,f as Ws}from"./chunk-UIL6OCU4.js";import{b as Hi,h as Hs}from"./chunk-Z5D4VQSG.js";import{a as si}from"./chunk-6EYQQ7GQ.js";import{a as B}from"./chunk-Y5JU726N.js";import{b as Fi}from"./chunk-AIWOSKP3.js";import{y as Di}from"./chunk-ZCM4J7JT.js";import{f as Io,l as $t,n as St,p as Bi,q as Ns}from"./chunk-2YDU2B2F.js";import{b as Ro}from"./chunk-2XQIWDKW.js";import{l as dt,m as ii,q as ie}from"./chunk-HTOLY3HR.js";import{c as Lt,d as go,e as oi}from"./chunk-P5HBJA23.js";import{a as Fn,b as ei,c as Ls,d as Sn,e as ti,k as no,l as ni,m as $i,r as Ni,w as _o,x as vo,y as $s}from"./chunk-26BQ45XP.js";import{GoogleGenAI as ca,ThinkingLevel as Qe,HarmBlockThreshold as Un,HarmCategory as Wn}from"@google/genai";var Ks=(e=!0,n=!0)=>`
1
+ import{a as Gs}from"./chunk-HFTI3R3Q.js";import{a as Io}from"./chunk-52STSLCN.js";import{a as en}from"./chunk-56EJGQU3.js";import{a as js}from"./chunk-4BLSASW6.js";import{c as Ui,g as Wi,h as Ds,i as Fs}from"./chunk-TX3H7HDF.js";import{b as Bs,c as Us,d as Gi,f as Ws}from"./chunk-UIL6OCU4.js";import{b as Hi,h as Hs}from"./chunk-Z5D4VQSG.js";import{a as si}from"./chunk-6EYQQ7GQ.js";import{a as B}from"./chunk-Y5JU726N.js";import{b as Fi}from"./chunk-ZURGYQ4L.js";import{y as Di}from"./chunk-5KSNFTQN.js";import{f as Ro,l as Nt,n as kt,p as Bi,q as Ns}from"./chunk-T5CUPXCW.js";import{b as vo}from"./chunk-PACSPBDP.js";import{l as ft,m as ii,q as ie}from"./chunk-HTOLY3HR.js";import{c as $t,d as uo,e as oi}from"./chunk-P5HBJA23.js";import{a as Un,b as ei,c as Ls,d as kn,e as ti,k as no,l as ni,m as $i,r as Ni,w as Eo,x as _o,y as $s}from"./chunk-26BQ45XP.js";import{GoogleGenAI as da,ThinkingLevel as Qe,HarmBlockThreshold as Gn,HarmCategory as Hn}from"@google/genai";var Ks=(e=!0,n=!0)=>`
2
2
  To use tools, must output exactly '[action:ActionName(arg1="value1")]' structured string in chat response \u2190 no exception
3
3
 
4
4
  -- Chat Management Tools --
@@ -25,7 +25,7 @@ Usage Rules:
25
25
  - Chat title is mandatory
26
26
  - Temporary memory is mandatory
27
27
  - When called user memory, still use Temporary Memory
28
- - Must not ignore any tool calls in given context of chat between user & agent`:""}`.trim();var ri={xHigh:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",High:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",Medium:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",Minimal:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",Off:"NO thinking. Immediate response. Verify imports, tool results & system stability"};import ln from"fs";import an from"path";import Fa from"os";import kn from"fs";import Bn from"path";import ir from"fs";import ji from"path";import{execSync as sr}from"child_process";import{fileURLToPath as $a}from"url";var Vs=`# FluxFlow CLI Startup & Flags Reference
28
+ - Must not ignore any tool calls in given context of chat between user & agent`:""}`.trim();var ri={xHigh:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",High:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",Medium:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",Minimal:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",Off:"NO thinking. Immediate response. Verify imports, tool results & system stability"};import ln from"fs";import an from"path";import Ba from"os";import Tn from"fs";import Wn from"path";import ir from"fs";import ji from"path";import{execSync as sr}from"child_process";import{fileURLToPath as Na}from"url";var Vs=`# FluxFlow CLI Startup & Flags Reference
29
29
 
30
30
  Launch command syntax:
31
31
  fluxflow [options]
@@ -190,6 +190,7 @@ Open in chat via /settings
190
190
  * Sub-Agent Model \u2192 Dedicated model/provider for sub-agents
191
191
  * Auto Completion in IDE \u2192 Toggle
192
192
  * Completion Model
193
+ * Commit Msg Model
193
194
 
194
195
  ### 7. Miscellaneous
195
196
  * Directory Tree Design \u2192 Modern (Saves Tokens) | Legacy (More Tokens, No extra benefit)
@@ -455,7 +456,7 @@ Instruction for this model ID across all providers.
455
456
 
456
457
  * On-Demand Reference System:
457
458
  * Reference: Offload deep/contexual specs to **/{SKILL.md,skill-reference-folder/*.md} & reference in SKILL.md. Saves tokens
458
- `;var ai="v4";try{let e=ji.dirname($a(import.meta.url)),n=[ji.join(e,"../../package.json"),ji.join(e,"../package.json")],t=!1;for(let i of n)if(ir.existsSync(i)){let o=JSON.parse(ir.readFileSync(i,"utf8"));if(o.version){ai=o.version,t=!0;break}}if(!t)try{let i=sr("fluxflow -v",{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();i&&(i.startsWith("v")||/^\d+\.\d+/.test(i))&&(ai=i,t=!0)}catch{}if(!t)try{let i=sr("curl -s --max-time 3 https://raw.githubusercontent.com/KushalRoyChowdhury/fluxflow-cli/main/package.json",{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"]}),o=JSON.parse(i);o.version&&(ai=o.version)}catch{}}catch{}var Ki={"SKILL.md":`---
459
+ `;var ai="v4";try{let e=ji.dirname(Na(import.meta.url)),n=[ji.join(e,"../../package.json"),ji.join(e,"../package.json")],t=!1;for(let i of n)if(ir.existsSync(i)){let o=JSON.parse(ir.readFileSync(i,"utf8"));if(o.version){ai=o.version,t=!0;break}}if(!t)try{let i=sr("fluxflow -v",{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();i&&(i.startsWith("v")||/^\d+\.\d+/.test(i))&&(ai=i,t=!0)}catch{}if(!t)try{let i=sr("curl -s --max-time 3 https://raw.githubusercontent.com/KushalRoyChowdhury/fluxflow-cli/main/package.json",{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"]}),o=JSON.parse(i);o.version&&(ai=o.version)}catch{}}catch{}var Ki={"SKILL.md":`---
459
460
  name: fluxflow
460
461
  description: System Generated Documentation. Read this if asked anything regarding FluxFlow Harness
461
462
  ---
@@ -482,24 +483,24 @@ Public Docs: https://fluxflow-cli.onrender.com
482
483
 
483
484
  Default Context Length: 256k Tokens. Can be changed via ENV/In-app Settings \u2192 references/{SETTINGS,ENV}.md
484
485
 
485
- Docs missing required info? Say you are not sure enough to answer. Dont give wrong info`,"references/MODES.md":tr,"references/PROVIDERS.md":nr,"references/PLUGINS.md":or,"references/STARTUP.md":Vs,"references/ENV.md":Ys,"references/COMMANDS.md":zs,"references/SETTINGS.md":qs,"references/TOOLS.md":Xs,"references/ARCHITECTURE.md":Js,"references/SUB_AGENTS.md":Qs,"references/SECURITY.md":Zs,"references/IDE.md":er};var rr=()=>{try{let e=Bn.join(Fn,"skills","fluxflow"),n=Bn.join(e,"references");if(process.env.NO_DEV==="true"||process.env.NO_DEV==="1"||process.env.NO_DEV===!0||process.env.NO_INS==="true"||process.env.NO_INS==="1"||process.env.NO_INS==="true"||!1){kn.existsSync(e)&&kn.rmSync(e,{recursive:!0,force:!0});return}let i=new Set(Object.keys(Ki).map(o=>Bn.normalize(o)));for(let[o,r]of Object.entries(Ki)){let d=Bn.join(e,o),l=Bn.dirname(d);kn.existsSync(l)||kn.mkdirSync(l,{recursive:!0});let u=r.trim()+`
486
- `,h=null;kn.existsSync(d)&&(h=kn.readFileSync(d,"utf8")),h!==u&&kn.writeFileSync(d,u,"utf8")}if(kn.existsSync(n)){let o=kn.readdirSync(n);for(let r of o){let d=Bn.normalize(Bn.join("references",r));if(!i.has(d)){let l=Bn.join(n,r);try{kn.rmSync(l,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as li}from"ws";var Yt=null,mo=!1,Na="ws://localhost:56832",Vi=[],po=null,Yi=null,zi=null,ar="2.0.0",gc=e=>{ar=e,lr()},qi=e=>{Yi=e},mc=e=>{zi=e},lr=()=>{if(Yt||mo)return;mo=!0;let e=new li(Na);e.on("open",()=>{for(Yt=e,mo=!1,Yt.send(JSON.stringify({command:"version",version:ar,pid:process.pid,ppid:process.ppid,cwd:process.cwd()}));Vi.length>0;)Yt.send(JSON.stringify(Vi.shift()))}),e.on("message",n=>{try{let t=JSON.parse(n.toString());t.command==="contextResponse"&&po?(po(t.data),po=null):t.command==="securityResponse"&&Yi?Yi(t.result):t.command==="inlineComplete"?Da(t):t.command==="connectionRejected"&&zi&&zi(t)}catch{}}),e.on("error",()=>{mo=!1,Yt=null}),e.on("close",()=>{mo=!1,Yt=null})},Po=e=>{Yt&&Yt.readyState===li.OPEN?Yt.send(JSON.stringify(e)):(Vi.push(e),mo||lr())},ho=()=>Yt!==null&&Yt.readyState===li.OPEN,Da=async e=>{let n="";try{let{generateAutoCompletion:t}=await import("./auto_completion-33R46AFF.js");n=await t({prefix:e.prefix||"",suffix:e.suffix||"",fileName:e.fileName||"",language:e.language||"",recentChanges:e.recentChanges||"",clipboard:e.clipboard||""})}catch{n=""}Po({command:"inlineCompleteResponse",requestId:e.requestId,completion:n||""})},pc=e=>{Po({command:"status",status:e})},oo=()=>new Promise(e=>{if(!Yt||Yt.readyState!==li.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}po=e,Yt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{po===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),po=null)},1e3)}),cr=e=>{Po({command:"open",filePath:e})},Xi=(e,n,t)=>{Po({command:"showDiff",filePath:e,originalContent:n,modifiedContent:t})},dr=(e,n)=>{Po({command:"closeDiff",filePath:e,result:n})};var Bo=(e,n)=>{try{if(!ln.existsSync(e))return null;let t=Array.isArray(n)?n.map(o=>o.toLowerCase()):[n.toLowerCase()],i=ln.readdirSync(e);for(let o of t){let r=i.find(d=>d.toLowerCase()===o);if(r){let d=an.join(e,r);if(ln.statSync(d).isFile())return d}}}catch{}return null},ts=(e,n)=>{let t=Bo(e,n);if(t)try{return ln.readFileSync(t,"utf8")}catch{}return""},fr=new Set([".git","node_modules",".gemini","dist","build",".next","out",".cache","bin","obj","vendor","venv",".idea",".gradle",".terraform","target","coverage",".vscode",".svn",".hg",".fslckout",".github",".gitlab",".circleci",".gitea",".gitee",".lerna",".changeset",".nx",".npm",".yarn",".pnpm-store",".pnpm",".expo",".nuxt",".svelte-kit",".docusaurus",".turbo",".vercel","bower_components",".netlify",".vuepress",".quasar",".output",".angular","jspm_packages",".parcel-cache",".rollup.cache",".rspack",".vitepress","__pycache__",".pytest_cache",".mypy_cache",".tox",".poetry","env","vhdl",".ipynb_checkpoints",".jupyter",".conda",".pdm-build",".bundle",".yardoc",".metadata","App_Data","ClientBin",".cargo",".rustc_info",".go","Godeps","_vendor",".rake_tasks","CMakefiles",".wakatime",".dart_tool",".fvm",".cocoapods","Pods",".pub-cache",".symlinks","DerivedData",".xcworkspace",".serverless",".aws",".gcloud",".azure",".kube",".vagrant",".docker","postgres-data","redis-data","mongo-data",".Spotlight-V100",".Trashes","$RECYCLE.BIN","System Volume Information",".DocumentRevisions-V100",".fseventsd","AppData","Application Data","Local","LocalLow","Roaming","$WinREAgent","$WINDOWS.~BT","$WINDOWS.~WS","scw","System32","SysWOW64",".AppleDouble",".AppleDB",".AppleDesktop","_CodeSignature",".cmio",".LSOverride",".localized",".TemporaryItems",".Trash",".Trash-0",".Trash-1000",".gvfs",".local",".config",".dbus",".fontconfig",".snap",".var",".lost+found","lost+found",".thumb",".thumbnails","EFI","boot","grub","logs","log",".nyc_output",".sonar",".ruff_cache",".VSCodeCounter",".skills","skills"]),ns=(e=process.cwd(),n=0,t=8)=>{let i=[];if(n>t)return i;try{if(!ln.existsSync(e))return i;let o=ln.readdirSync(e,{withFileTypes:!0});for(let r of o){let d=r.name,l=an.join(e,d);if(r.isDirectory())!fr.has(d)&&!fr.has(d.toLowerCase())&&i.push(...ns(l,n+1,t));else if(r.isFile()){let u=d.toLowerCase();(u==="agents.md"||u==="agent.md")&&i.push(l)}}}catch{}return i},ur=(e,n=2)=>{if(!e)return"";let t=" ".repeat(n);return e.split(/\r?\n/).map(i=>t+i).join(`
487
- `)},yr=()=>Bo(Fn,["agents.md","agent.md"]),xr=()=>Bo(process.cwd(),["agents.md","agent.md"]),br=()=>Bo(Fn,["fluxflow.md"]),wr=()=>Bo(process.cwd(),["fluxflow.md"]),Lo=yr(),ci=xr(),Tn=ns(),$o=br(),No=wr(),gr=null,es="",Sr=!1,Ba=e=>{if(!e||!/^<<<[\s\S]*?Identity:/m.test(e))return e;let n=e.match(/^<<<\s*\r?\n([\s\S]*?)\r?\n>>>\s*(?:\r?\n)?([\s\S]*)$/);if(!n)return e;let t=n[1],i=n[2],o=t.match(/^Identity:\s*([\s\S]*?)(?=\r?\n\s*(?:<><|>>>)|$)/m);return o&&(es=o[1].trim(),process.env.NO_INS=!0),/<><\s*NO_INS/.test(t)&&(Sr=!0),i.trim()},Ua=()=>{Lo=yr();let e=Lo?ts(Fn,["agents.md","agent.md"]).trim():"";return e.length===0?(Lo=null,""):e},Wa=()=>{if(Tn=ns(),ci=xr(),!Tn||Tn.length===0)return"";let e=process.cwd(),n=[...Tn].sort((o,r)=>{let d=an.relative(e,o).replace(/\\/g,"/"),l=an.relative(e,r).replace(/\\/g,"/"),u=!d.includes("/"),h=!l.includes("/");return u&&!h?-1:!u&&h?1:d.localeCompare(l)}),t=[],i=[];for(let o of n)try{let r=ln.readFileSync(o,"utf8").trim();if(!r||r.length===0)continue;t.push(o);let d=an.relative(e,o).replace(/\\/g,"/");if(!d.includes("/"))i.push(ur(r,2));else{let u=an.dirname(d)+"/:";i.push(`${u}
488
- ${ur(r,2)}`)}}catch{}return Tn=t,Tn.length===0&&(ci=null),i.join(`
486
+ Docs missing required info? Say you are not sure enough to answer. Dont give wrong info`,"references/MODES.md":tr,"references/PROVIDERS.md":nr,"references/PLUGINS.md":or,"references/STARTUP.md":Vs,"references/ENV.md":Ys,"references/COMMANDS.md":zs,"references/SETTINGS.md":qs,"references/TOOLS.md":Xs,"references/ARCHITECTURE.md":Js,"references/SUB_AGENTS.md":Qs,"references/SECURITY.md":Zs,"references/IDE.md":er};var rr=()=>{try{let e=Wn.join(Un,"skills","fluxflow"),n=Wn.join(e,"references");if(process.env.NO_DEV==="true"||process.env.NO_DEV==="1"||process.env.NO_DEV===!0||process.env.NO_INS==="true"||process.env.NO_INS==="1"||process.env.NO_INS==="true"||!1){Tn.existsSync(e)&&Tn.rmSync(e,{recursive:!0,force:!0});return}let i=new Set(Object.keys(Ki).map(o=>Wn.normalize(o)));for(let[o,r]of Object.entries(Ki)){let d=Wn.join(e,o),l=Wn.dirname(d);Tn.existsSync(l)||Tn.mkdirSync(l,{recursive:!0});let u=r.trim()+`
487
+ `,h=null;Tn.existsSync(d)&&(h=Tn.readFileSync(d,"utf8")),h!==u&&Tn.writeFileSync(d,u,"utf8")}if(Tn.existsSync(n)){let o=Tn.readdirSync(n);for(let r of o){let d=Wn.normalize(Wn.join("references",r));if(!i.has(d)){let l=Wn.join(n,r);try{Tn.rmSync(l,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as li}from"ws";var Vt=null,go=!1,Da="ws://localhost:56832",Vi=[],mo=null,Yi=null,zi=null,ar="2.0.0",mc=e=>{ar=e,lr()},qi=e=>{Yi=e},pc=e=>{zi=e},lr=()=>{if(Vt||go)return;go=!0;let e=new li(Da);e.on("open",()=>{for(Vt=e,go=!1,Vt.send(JSON.stringify({command:"version",version:ar,pid:process.pid,ppid:process.ppid,cwd:process.cwd()}));Vi.length>0;)Vt.send(JSON.stringify(Vi.shift()))}),e.on("message",n=>{try{let t=JSON.parse(n.toString());t.command==="contextResponse"&&mo?(mo(t.data),mo=null):t.command==="securityResponse"&&Yi?Yi(t.result):t.command==="inlineComplete"?Fa(t):t.command==="connectionRejected"&&zi&&zi(t)}catch{}}),e.on("error",()=>{go=!1,Vt=null}),e.on("close",()=>{go=!1,Vt=null})},Mo=e=>{Vt&&Vt.readyState===li.OPEN?Vt.send(JSON.stringify(e)):(Vi.push(e),go||lr())},po=()=>Vt!==null&&Vt.readyState===li.OPEN,Fa=async e=>{let n="";try{let{generateAutoCompletion:t}=await import("./auto_completion-5WD4TTIP.js");n=await t({prefix:e.prefix||"",suffix:e.suffix||"",fileName:e.fileName||"",language:e.language||"",recentChanges:e.recentChanges||"",clipboard:e.clipboard||""})}catch{n=""}Mo({command:"inlineCompleteResponse",requestId:e.requestId,completion:n||""})},hc=e=>{Mo({command:"status",status:e})},oo=()=>new Promise(e=>{if(!Vt||Vt.readyState!==li.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}mo=e,Vt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{mo===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),mo=null)},1e3)}),cr=e=>{Mo({command:"open",filePath:e})},Xi=(e,n,t)=>{Mo({command:"showDiff",filePath:e,originalContent:n,modifiedContent:t})},dr=(e,n)=>{Mo({command:"closeDiff",filePath:e,result:n})};var Fo=(e,n)=>{try{if(!ln.existsSync(e))return null;let t=Array.isArray(n)?n.map(o=>o.toLowerCase()):[n.toLowerCase()],i=ln.readdirSync(e);for(let o of t){let r=i.find(d=>d.toLowerCase()===o);if(r){let d=an.join(e,r);if(ln.statSync(d).isFile())return d}}}catch{}return null},ts=(e,n)=>{let t=Fo(e,n);if(t)try{return ln.readFileSync(t,"utf8")}catch{}return""},fr=new Set([".git","node_modules",".gemini","dist","build",".next","out",".cache","bin","obj","vendor","venv",".idea",".gradle",".terraform","target","coverage",".vscode",".svn",".hg",".fslckout",".github",".gitlab",".circleci",".gitea",".gitee",".lerna",".changeset",".nx",".npm",".yarn",".pnpm-store",".pnpm",".expo",".nuxt",".svelte-kit",".docusaurus",".turbo",".vercel","bower_components",".netlify",".vuepress",".quasar",".output",".angular","jspm_packages",".parcel-cache",".rollup.cache",".rspack",".vitepress","__pycache__",".pytest_cache",".mypy_cache",".tox",".poetry","env","vhdl",".ipynb_checkpoints",".jupyter",".conda",".pdm-build",".bundle",".yardoc",".metadata","App_Data","ClientBin",".cargo",".rustc_info",".go","Godeps","_vendor",".rake_tasks","CMakefiles",".wakatime",".dart_tool",".fvm",".cocoapods","Pods",".pub-cache",".symlinks","DerivedData",".xcworkspace",".serverless",".aws",".gcloud",".azure",".kube",".vagrant",".docker","postgres-data","redis-data","mongo-data",".Spotlight-V100",".Trashes","$RECYCLE.BIN","System Volume Information",".DocumentRevisions-V100",".fseventsd","AppData","Application Data","Local","LocalLow","Roaming","$WinREAgent","$WINDOWS.~BT","$WINDOWS.~WS","scw","System32","SysWOW64",".AppleDouble",".AppleDB",".AppleDesktop","_CodeSignature",".cmio",".LSOverride",".localized",".TemporaryItems",".Trash",".Trash-0",".Trash-1000",".gvfs",".local",".config",".dbus",".fontconfig",".snap",".var",".lost+found","lost+found",".thumb",".thumbnails","EFI","boot","grub","logs","log",".nyc_output",".sonar",".ruff_cache",".VSCodeCounter",".skills","skills"]),ns=(e=process.cwd(),n=0,t=8)=>{let i=[];if(n>t)return i;try{if(!ln.existsSync(e))return i;let o=ln.readdirSync(e,{withFileTypes:!0});for(let r of o){let d=r.name,l=an.join(e,d);if(r.isDirectory())!fr.has(d)&&!fr.has(d.toLowerCase())&&i.push(...ns(l,n+1,t));else if(r.isFile()){let u=d.toLowerCase();(u==="agents.md"||u==="agent.md")&&i.push(l)}}}catch{}return i},ur=(e,n=2)=>{if(!e)return"";let t=" ".repeat(n);return e.split(/\r?\n/).map(i=>t+i).join(`
488
+ `)},yr=()=>Fo(Un,["agents.md","agent.md"]),xr=()=>Fo(process.cwd(),["agents.md","agent.md"]),br=()=>Fo(Un,["fluxflow.md"]),wr=()=>Fo(process.cwd(),["fluxflow.md"]),Oo=yr(),ci=xr(),An=ns(),Lo=br(),$o=wr(),gr=null,es="",Sr=!1,Ua=e=>{if(!e||!/^<<<[\s\S]*?Identity:/m.test(e))return e;let n=e.match(/^<<<\s*\r?\n([\s\S]*?)\r?\n>>>\s*(?:\r?\n)?([\s\S]*)$/);if(!n)return e;let t=n[1],i=n[2],o=t.match(/^Identity:\s*([\s\S]*?)(?=\r?\n\s*(?:<><|>>>)|$)/m);return o&&(es=o[1].trim(),process.env.NO_INS=!0),/<><\s*NO_INS/.test(t)&&(Sr=!0),i.trim()},Wa=()=>{Oo=yr();let e=Oo?ts(Un,["agents.md","agent.md"]).trim():"";return e.length===0?(Oo=null,""):e},Ga=()=>{if(An=ns(),ci=xr(),!An||An.length===0)return"";let e=process.cwd(),n=[...An].sort((o,r)=>{let d=an.relative(e,o).replace(/\\/g,"/"),l=an.relative(e,r).replace(/\\/g,"/"),u=!d.includes("/"),h=!l.includes("/");return u&&!h?-1:!u&&h?1:d.localeCompare(l)}),t=[],i=[];for(let o of n)try{let r=ln.readFileSync(o,"utf8").trim();if(!r||r.length===0)continue;t.push(o);let d=an.relative(e,o).replace(/\\/g,"/");if(!d.includes("/"))i.push(ur(r,2));else{let u=an.dirname(d)+"/:";i.push(`${u}
489
+ ${ur(r,2)}`)}}catch{}return An=t,An.length===0&&(ci=null),i.join(`
489
490
 
490
- `).trim()},os=()=>{$o=br();let e=$o?ts(Fn,["fluxflow.md"]).trim():"",n=Ba(e)?.trim()||"";return n.length===0?($o=null,""):n},is=()=>{No=wr();let e=No?ts(process.cwd(),["fluxflow.md"]).trim():"";return e.length===0?(No=null,""):e},ss=Ua(),di=Wa(),Do=os(),Fo=is(),mr=(e,n="",t="")=>{if(!e)return"";let i=t.toLowerCase().trim(),o=n.toLowerCase().trim(),r=an.posix.basename(o),d=i&&o?`${i}@${o}`:"",l=i&&r?`${i}@${r}`:"",u=x=>!x||!o?!1:x===o||x===r||x===d||x===l,h=[];return e.replace(/<start_provider_([^>\r\n]+)>([\s\S]*?)<end_provider_([^>\r\n]+)>/gi,(x,m,f,s)=>{if(i&&m.trim().toLowerCase()===s.trim().toLowerCase()&&m.trim().toLowerCase()===i){let k=f.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(ue,y,A,L)=>{if(y.trim().toLowerCase()===L.trim().toLowerCase()){let W=y.trim().toLowerCase();if(u(W)){let $=A.trim();$&&h.push($)}}return""}).trim();k&&h.push(k)}return""}),e.replace(/<start_model_([^>\r\n@]+@[^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n@]+@[^>\r\n]+)>/gi,(x,m,f,s)=>{if(m.trim().toLowerCase()===s.trim().toLowerCase()){let p=m.trim().toLowerCase();if(u(p)){let k=f.trim();k&&h.push(k)}}return""}),e.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(x,m,f,s)=>{if(m.includes("@"))return"";if(m.trim().toLowerCase()===s.trim().toLowerCase()){let p=m.trim().toLowerCase();if(o&&(p===o||p===r)){let k=f.trim();k&&h.push(k)}}return""}),h.join(`
491
+ `).trim()},os=()=>{Lo=br();let e=Lo?ts(Un,["fluxflow.md"]).trim():"",n=Ua(e)?.trim()||"";return n.length===0?(Lo=null,""):n},is=()=>{$o=wr();let e=$o?ts(process.cwd(),["fluxflow.md"]).trim():"";return e.length===0?($o=null,""):e},ss=Wa(),di=Ga(),No=os(),Do=is(),mr=(e,n="",t="")=>{if(!e)return"";let i=t.toLowerCase().trim(),o=n.toLowerCase().trim(),r=an.posix.basename(o),d=i&&o?`${i}@${o}`:"",l=i&&r?`${i}@${r}`:"",u=x=>!x||!o?!1:x===o||x===r||x===d||x===l,h=[];return e.replace(/<start_provider_([^>\r\n]+)>([\s\S]*?)<end_provider_([^>\r\n]+)>/gi,(x,m,f,s)=>{if(i&&m.trim().toLowerCase()===s.trim().toLowerCase()&&m.trim().toLowerCase()===i){let k=f.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(ue,y,A,O)=>{if(y.trim().toLowerCase()===O.trim().toLowerCase()){let W=y.trim().toLowerCase();if(u(W)){let $=A.trim();$&&h.push($)}}return""}).trim();k&&h.push(k)}return""}),e.replace(/<start_model_([^>\r\n@]+@[^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n@]+@[^>\r\n]+)>/gi,(x,m,f,s)=>{if(m.trim().toLowerCase()===s.trim().toLowerCase()){let p=m.trim().toLowerCase();if(u(p)){let k=f.trim();k&&h.push(k)}}return""}),e.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(x,m,f,s)=>{if(m.includes("@"))return"";if(m.trim().toLowerCase()===s.trim().toLowerCase()){let p=m.trim().toLowerCase();if(o&&(p===o||p===r)){let k=f.trim();k&&h.push(k)}}return""}),h.join(`
491
492
 
492
- `).trim()},Ga=(e="",n="")=>{let t=`${e||""}@${n||""}`.toLowerCase().trim();gr!==t&&(gr=t,Do=os(),Fo=is())};rr();var Ha=e=>{if(!e)return null;let n=e.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!n)return null;let t=n[1];if((n[2]||"").trim().length===0)return null;let o="",r="",d=t.match(/^name:\s*(.+)$/m),l=t.match(/^description:\s*(.+)$/m);return d&&(o=d[1].trim().replace(/^["']|["']$/g,"")),l&&(r=l[1].trim().replace(/^["']|["']$/g,"")),o&&r?{name:o,description:r}:null},ja=e=>{let n=[];if(!e||!ln.existsSync(e))return n;let t=(i,o=0)=>{if(!(o>5))try{let r=ln.readdirSync(i,{withFileTypes:!0});for(let d of r){let l=an.join(i,d.name),u=d.name.toLowerCase();d.isFile()?u==="skill.md"&&n.push(l):d.isDirectory()&&(o===0?(u==="skills"||u===".skills"||u==="skill"||u===".skill")&&t(l,o+1):t(l,o+1))}}catch{}};return t(e,0),n},kr=e=>{let n=ja(e),t=[];for(let i of n)try{let o=ln.readFileSync(i,"utf8"),r=Ha(o);r&&t.push({...r,filePath:i})}catch{}return t},Tr=e=>!e||e.length===0?"":e.map(n=>`- ${n.name}: ${n.description}`).join(`
493
- `),Ar=kr(Fn),Cr=kr(process.cwd()),Ji=Tr(Ar),Qi=Tr(Cr),Er=e=>{if(!e)return!1;let n=(e.filePath||"").replace(/\\/g,"/").toLowerCase();return n.includes("/skills/fluxflow/skill.md")||n.includes("/skills/about-fluxflow/skill.md")||e.name?.toLowerCase()==="fluxflow"},_r=()=>(Ar||[]).filter(e=>!Er(e)),vr=()=>(Cr||[]).filter(e=>!Er(e)),Ic=(ss?.length>0?1:0)+(di?.length>0?Tn.length:0)+(Do?.length>0?1:0)+(Fo?.length>0?1:0)+_r().length+vr().length,Zi=(e,n="Project")=>{if(!e)return"";let t=e.replace(/\\/g,"/");if(n==="Global"){let o=Fa.homedir().replace(/\\/g,"/");return t.toLowerCase().startsWith(o.toLowerCase())?"~"+t.slice(o.length):t}let i=an.relative(process.cwd(),e).replace(/\\/g,"/");return i.startsWith(".")?i:`./${i}`},Mc=()=>{Do=os(),Fo=is();let e=[];Lo&&ss.length>0&&e.push({scope:"Global",path:Lo}),Tn&&Tn.length>0&&di.length>0?Tn.forEach(r=>{e.push({scope:"Project",path:r})}):ci&&di.length>0&&e.push({scope:"Project",path:ci}),$o&&Do.length>0&&e.push({scope:"Global",path:$o}),No&&Fo.length>0&&e.push({scope:"Project",path:No});let n=_r(),t=vr(),i=e.length+n.length+t.length;if(i===0)return`\u2726 Loaded Files & Instructions
493
+ `).trim()},Ha=(e="",n="")=>{let t=`${e||""}@${n||""}`.toLowerCase().trim();gr!==t&&(gr=t,No=os(),Do=is())};rr();var ja=e=>{if(!e)return null;let n=e.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!n)return null;let t=n[1];if((n[2]||"").trim().length===0)return null;let o="",r="",d=t.match(/^name:\s*(.+)$/m),l=t.match(/^description:\s*(.+)$/m);return d&&(o=d[1].trim().replace(/^["']|["']$/g,"")),l&&(r=l[1].trim().replace(/^["']|["']$/g,"")),o&&r?{name:o,description:r}:null},Ka=e=>{let n=[];if(!e||!ln.existsSync(e))return n;let t=(i,o=0)=>{if(!(o>5))try{let r=ln.readdirSync(i,{withFileTypes:!0});for(let d of r){let l=an.join(i,d.name),u=d.name.toLowerCase();d.isFile()?u==="skill.md"&&n.push(l):d.isDirectory()&&(o===0?(u==="skills"||u===".skills"||u==="skill"||u===".skill")&&t(l,o+1):t(l,o+1))}}catch{}};return t(e,0),n},kr=e=>{let n=Ka(e),t=[];for(let i of n)try{let o=ln.readFileSync(i,"utf8"),r=ja(o);r&&t.push({...r,filePath:i})}catch{}return t},Tr=e=>!e||e.length===0?"":e.map(n=>`- ${n.name}: ${n.description}`).join(`
494
+ `),Ar=kr(Un),Cr=kr(process.cwd()),Ji=Tr(Ar),Qi=Tr(Cr),Er=e=>{if(!e)return!1;let n=(e.filePath||"").replace(/\\/g,"/").toLowerCase();return n.includes("/skills/fluxflow/skill.md")||n.includes("/skills/about-fluxflow/skill.md")||e.name?.toLowerCase()==="fluxflow"},_r=()=>(Ar||[]).filter(e=>!Er(e)),vr=()=>(Cr||[]).filter(e=>!Er(e)),Mc=(ss?.length>0?1:0)+(di?.length>0?An.length:0)+(No?.length>0?1:0)+(Do?.length>0?1:0)+_r().length+vr().length,Zi=(e,n="Project")=>{if(!e)return"";let t=e.replace(/\\/g,"/");if(n==="Global"){let o=Ba.homedir().replace(/\\/g,"/");return t.toLowerCase().startsWith(o.toLowerCase())?"~"+t.slice(o.length):t}let i=an.relative(process.cwd(),e).replace(/\\/g,"/");return i.startsWith(".")?i:`./${i}`},Pc=()=>{No=os(),Do=is();let e=[];Oo&&ss.length>0&&e.push({scope:"Global",path:Oo}),An&&An.length>0&&di.length>0?An.forEach(r=>{e.push({scope:"Project",path:r})}):ci&&di.length>0&&e.push({scope:"Project",path:ci}),Lo&&No.length>0&&e.push({scope:"Global",path:Lo}),$o&&Do.length>0&&e.push({scope:"Project",path:$o});let n=_r(),t=vr(),i=e.length+n.length+t.length;if(i===0)return`\u2726 Loaded Files & Instructions
494
495
  \u2800\u2800\x1B[2m\u2514\u2500\x1B[22m No instruction or skill files are currently loaded.
495
496
  \u2800`;let o=[];return o.push(`\u2726 Loaded Files & Instructions (${i} ${i===1?"file":"files"} active)`),e.length>0&&(o.push(`
496
497
  \x1B[1mInstructions:\x1B[22m`),e.forEach(r=>{o.push(` \u2022 [${r.scope}] ${Zi(r.path,r.scope)}`)})),(n?.length>0||t?.length>0)&&(o.push(`
497
498
  \x1B[1mSkills:\x1B[22m`),n?.length>0&&n.forEach(r=>{o.push(` \u2022 [Global] \x1B[36m${r.name}\x1B[39m`),o.push(` \x1B[2m\u2514\u2500 ${Zi(r.filePath,"Global")}\x1B[22m`)}),t?.length>0&&t.forEach(r=>{o.push(` \u2022 [Project] \x1B[36m${r.name}\x1B[39m`),o.push(` \x1B[2m\u2514\u2500 ${Zi(r.filePath,"Project")}\x1B[22m`)})),o.push("\u2800"),o.join(`
498
- `)},Rr=!1;(async()=>{try{let e=await Ro();if(Number(e?.display)===1){let{default:n}=await import("screenshot-desktop"),t=await n.listDisplays();t&&t.length>1&&(Rr=!0)}}catch{}})();var pr=null,Oo=null,hr=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",Pc=process.env.NO_DEV||!1,Ka=(e,n)=>{if(!n)return"";if(e!==pr||Oo===null){pr=e;try{let t=Lt(no,[]);Array.isArray(t)&&t.length>0?Oo=t.map(i=>`- ${i.memory}`).join(`
499
- `):Oo=""}catch(t){Oo="";try{ln.mkdirSync(an.join(Sn,"memory"),{recursive:!0}),ln.appendFileSync(an.join(Sn,"memory","error.txt"),`${t.message}
499
+ `)},Rr=!1;(async()=>{try{let e=await vo();if(Number(e?.display)===1){let{default:n}=await import("screenshot-desktop"),t=await n.listDisplays();t&&t.length>1&&(Rr=!0)}}catch{}})();var pr=null,Po=null,hr=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",Oc=process.env.NO_DEV||!1,Va=(e,n)=>{if(!n)return"";if(e!==pr||Po===null){pr=e;try{let t=$t(no,[]);Array.isArray(t)&&t.length>0?Po=t.map(i=>`- ${i.memory}`).join(`
500
+ `):Po=""}catch(t){Po="";try{ln.mkdirSync(an.join(kn,"memory"),{recursive:!0}),ln.appendFileSync(an.join(kn,"memory","error.txt"),`${t.message}
500
501
  -------------------------------------------------
501
502
 
502
- `)}catch{}}}return Oo};var Ir=(e,n,t,i,o=!0,r=!1,d="Google",l=!1,u,h,x=!1,m="")=>{let f=!1;process.env.forcedReasoning&&(f=!0);let s="";if(!u&&d==="Google"){let N=n;n==="Fast"&&(N="Off"),n==="Low"&&(N="Minimal"),n==="Standard"&&(N="Medium"),(n==="xHigh"||n==="Max")&&(N="xHigh"),s=ri[N]||ri.Medium}(u||d!=="Google")&&(s=ri.xHigh,n==="Fast"?s=`No thinking. Immediate response
503
+ `)}catch{}}}return Po};var Ir=(e,n,t,i,o=!0,r=!1,d="Google",l=!1,u,h,x=!1,m="")=>{let f=!1;process.env.forcedReasoning&&(f=!0);let s="";if(!u&&d==="Google"){let N=n;n==="Fast"&&(N="Off"),n==="Low"&&(N="Minimal"),n==="Standard"&&(N="Medium"),(n==="xHigh"||n==="Max")&&(N="xHigh"),s=ri[N]||ri.Medium}(u||d!=="Google")&&(s=ri.xHigh,n==="Fast"?s=`No thinking. Immediate response
503
504
  Verify imports, tool results & system stability`:n.toLowerCase()==="max"&&(s=`Effort: Max
504
505
  Plan step by step`));let p=e.instructions&&e.instructions?.length>0?`User Preferences: ${e.instructions}
505
506
 
@@ -507,28 +508,28 @@ Plan step by step`));let p=e.instructions&&e.instructions?.length>0?`User Prefer
507
508
  ${p.length?"":`
508
509
  `}`:"",ue=e.name&&e.name?.length>0?`User Name: ${e.name}
509
510
  ${k.length||p.length?"":`
510
- `}`:"",y=process.cwd(),A=e.preset,W={Sassy:"Sassy",Friendly:"Sassy, Warm & Chatty",Playful:"Playful",Efficient:"Quick, Concise & Efficient",Professional:"Professional"}[A]||null,$=Ka(h,o),T=$?.length>0?`--- Saved Memories ---
511
+ `}`:"",y=process.cwd(),A=e.preset,W={Sassy:"Sassy",Friendly:"Sassy, Warm & Chatty",Playful:"Playful",Efficient:"Quick, Concise & Efficient",Professional:"Professional"}[A]||null,$=Va(h,o),T=$?.length>0?`--- Saved Memories ---
511
512
  ${$}
512
513
 
513
- `:"";Ga(d,m);let we=mr(Do,m,d).trim(),Me=[ss,we].filter(N=>N&&N.length>0).join(`
514
+ `:"";Ha(d,m);let Se=mr(No,m,d).trim(),Pe=[ss,Se].filter(N=>N&&N.length>0).join(`
514
515
 
515
- `).trim(),Ze=mr(Fo,m,d).trim(),b=[di,Ze].filter(N=>N&&N.length>0).join(`
516
+ `).trim(),Ze=mr(Do,m,d).trim(),b=[di,Ze].filter(N=>N&&N.length>0).join(`
516
517
 
517
- `).trim(),Tt=Me.length>0||b.length>0?`--- Additional Instructions ---
518
- ${Me.length>0?`-- Global --
519
- ${Me}`:""}${b.length>0?`${Me.length>0?`
518
+ `).trim(),At=Pe.length>0||b.length>0?`--- Additional Instructions ---
519
+ ${Pe.length>0?`-- Global --
520
+ ${Pe}`:""}${b.length>0?`${Pe.length>0?`
520
521
 
521
522
  `:""}-- Project --
522
523
  ${b}`:""}
523
524
 
524
- `:"",Le=(()=>{let N=process.cwd().toLowerCase();if(process.platform==="win32"){let nn=process.env.SystemRoot?.toLowerCase()||"c:\\windows",Ut=process.env.ProgramFiles?.toLowerCase()||"c:\\program files",M=process.env["ProgramFiles(x86)"]?.toLowerCase()||"c:\\program files (x86)";return N.startsWith(nn)||N.startsWith(Ut)||N.startsWith(M)}else return N==="/"||["/bin","/sbin","/etc","/usr","/var","/root"].some(Ut=>N.startsWith(Ut))})(),Et=new Date,Fe=Et.getFullYear(),ce=Et.toLocaleString("en-US",{month:"short"}).toUpperCase(),Bt=String(Et.getDate()).padStart(2,"0"),Hn=`${Fe}-${ce}-${Bt}`,jn=process.env.I_HAVE_TOO_MUCH_MONEY==="true"||!1,Kn=process.env.HALLOWEEN_EEGG==="true"||!1,_t=Kn&&ce.includes("OCT")&&(Bt.includes("30")||Bt.includes("31")),qt=(m||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),de=an.basename(qt).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,N=>N.toUpperCase().trim()),Ue=process.env.NO_DEV==="true"||!1,ze=!1;try{ze=ho()}catch{ze=!1}return`${jn?`${" ".repeat(Math.floor(Math.random()*4)+1)}`:""}=== SYSTEM PROMPT${process.cwd()==="D:\\PROJECTS\\Flux-Flow"?" (Internal testing environment, do as prompted)":""} ===
525
- ${`Identity: ${es.length>1?es.trim():`Flux Flow.${W?` ${W}`:""} CLI Assistant${Kn?`. ${_t?"Peak ":""}Halloween Themed, Spooky`:""}`}
525
+ `:"",$e=(()=>{let N=process.cwd().toLowerCase();if(process.platform==="win32"){let tn=process.env.SystemRoot?.toLowerCase()||"c:\\windows",Ut=process.env.ProgramFiles?.toLowerCase()||"c:\\program files",I=process.env["ProgramFiles(x86)"]?.toLowerCase()||"c:\\program files (x86)";return N.startsWith(tn)||N.startsWith(Ut)||N.startsWith(I)}else return N==="/"||["/bin","/sbin","/etc","/usr","/var","/root"].some(Ut=>N.startsWith(Ut))})(),_t=new Date,Fe=_t.getFullYear(),ce=_t.toLocaleString("en-US",{month:"short"}).toUpperCase(),Bt=String(_t.getDate()).padStart(2,"0"),jn=`${Fe}-${ce}-${Bt}`,Kn=process.env.I_HAVE_TOO_MUCH_MONEY==="true"||!1,Vn=process.env.HALLOWEEN_EEGG==="true"||!1,vt=Vn&&ce.includes("OCT")&&(Bt.includes("30")||Bt.includes("31")),zt=(m||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),de=an.basename(zt).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,N=>N.toUpperCase().trim()),Ue=process.env.NO_DEV==="true"||!1,qe=!1;try{qe=po()}catch{qe=!1}return`${Kn?`${" ".repeat(Math.floor(Math.random()*4)+1)}`:""}=== SYSTEM PROMPT${process.cwd()==="D:\\PROJECTS\\Flux-Flow"?" (Internal testing environment, do as prompted)":""} ===
526
+ ${`Identity: ${es.length>1?es.trim():`Flux Flow.${W?` ${W}`:""} CLI Assistant${Vn?`. ${vt?"Peak ":""}Halloween Themed, Spooky`:""}`}
526
527
  ${Sr?"":`${t==="Flux"?"":t==="Flow"?"Concise, Humorous, Sarcastic":t==="ICU"?"Computer Use Capabilities. Screenshot as ground truth, analyze grid ids of target. Keyboard shortcuts > mouse clicks":"Computer Use & Workspace Capabilities. Screenshot as ground truth, analyze grid ids of target. Keyboard shortcuts > mouse clicks. Workspace Actions when faster. Focus on Productivity"}`}${Rr&&t.toLowerCase().includes("cu")?`
527
528
  - Running on secondary screen. Opened app not visible in screenshot? Might be opened on primary. Use 'AskUser' with NO options and tell user to move app window to secondary`:""}`.trimEnd()}
528
529
 
529
530
  - OS: ${hr}${!Ue&&m.length>1?`
530
531
  - Model: ${de}`.trimEnd():""}
531
- - Date: ${Hn}
532
+ - Date: ${jn}
532
533
 
533
534
  -- REASONING GUIDANCE --
534
535
  ${d==="Mistral"||d==="Google"&&!u||f?`${s.trimEnd()}${f||n!=="Fast"&&(d==="Mistral"&&n==="Low"&&!u||n!=="High"&&!u)?`
@@ -539,14 +540,14 @@ Before actions, provide user facing summary of findings & decisions IN detail
539
540
  ${Ws(t,hr,l,d,i?.advanceRollback,i?.subAgents!==!1,!!i?.autoExec,!!i?.disableTodo,i?.preferBash!==!1)}${t==="Flux"?"":t.toLowerCase().includes("cu")?`
540
541
 
541
542
  -- SECURITY POLICIES --
542
- - Dont operate on ANY confidential screens/captcha \u2192 AskUser`:""}${ze?`
543
+ - Dont operate on ANY confidential screens/captcha \u2192 AskUser`:""}${qe?`
543
544
 
544
545
  Reference files as ./file:start..end`:""}
545
546
  === END SYSTEM PROMPT ===${(Ji.length>0||Qi.length>0)&&t.toLowerCase().includes("flux")?`
546
547
 
547
548
  - Read relevant skills before tasks, scope: global/project: Use ReadFile, path="#skills/scope?/skillName". In-skill references: path="#skills/scope?/skillName/reference-folder/*.md"`:""}
548
549
 
549
- ${k}${p}${Tt}${Ji.length>0&&t.toLowerCase().includes("flux")?`-- Global Skills --
550
+ ${k}${p}${At}${Ji.length>0&&t.toLowerCase().includes("flux")?`-- Global Skills --
550
551
  ${Ji}
551
552
 
552
553
  `:""}${Qi.length>0&&t.toLowerCase().includes("flux")?`-- Project Skills --
@@ -573,9 +574,9 @@ ${Ks(n,t)}
573
574
  === END SYSTEM PROMPT ===${e?`
574
575
 
575
576
  -- current saved user memories --
576
- ${e}`:""}`.trim();var Pr=()=>import("./web_search-KBGH67IV.js").then(e=>e.web_search),Or=()=>import("./web_scrape-J3PL2PXT.js").then(e=>e.web_scrape),Lr=()=>import("./memory-7YOYCOXE.js").then(e=>e.memory),$r=()=>import("./chat-BA72I6O3.js").then(e=>e.chat),Nr=()=>import("./view_file-I77KYUO5.js").then(e=>e.view_file),Dr=()=>import("./write_file-WMLWKQKI.js").then(e=>e.write_file),Fr=()=>import("./update_file-YXW37NRJ.js").then(e=>e.update_file),Br=()=>import("./exec_command-6V5SM6WI.js").then(e=>e.exec_command),Ur=()=>import("./read_folder-EI2CNHNS.js").then(e=>e.read_folder),rs=()=>import("./ask_user-K2DLZF6H.js").then(e=>e.ask_user),Wr=()=>import("./write_pdf-TPGUF4VT.js").then(e=>e.write_pdf),Gr=()=>import("./write_docx-E3MTFXTQ.js").then(e=>e.write_docx),fi=()=>import("./search_keyword-UXNKLCGC.js").then(e=>e.search_keyword),Hr=()=>import("./generate_image-JS7J4FLD.js").then(e=>e.generate_image),ui=()=>import("./saveSummary-W2JMDVZJ.js").then(e=>e.saveSummary),Uo=()=>import("./addMemScore-PBVNSFPN.js").then(e=>e.addMemScore),jr=()=>import("./file_map-UA4BA5OH.js").then(e=>e.file_map),gi=()=>import("./todo-CJLWLWJB.js").then(e=>e.todo),Kr=()=>import("./invokeSync-DCL3EMVV.js").then(e=>e.invokeSync),Va=()=>import("./invoke-WGWAIYZH.js").then(e=>e.invoke),Vr=()=>import("./getProgress-J34K43Y7.js").then(e=>e.getProgress),Ya=()=>import("./cancel-F3ZOEBKW.js").then(e=>e.cancel),Yr=()=>import("./emergency_rollback-ZHQXCIHW.js").then(e=>e.emergency_rollback),Wo=()=>import("./awaitSubagent-JKQ2EHVY.js").then(e=>e.awaitSubagent),Go=()=>import("./answerSubagent-BPNNJXPC.js").then(e=>e.answerSubagent),mi=()=>import("./steerSubagent-UETXH2CB.js").then(e=>e.steerSubagent),pi=()=>import("./computer_action-6AYM3W7D.js").then(e=>e.computer_action),zr=()=>import("./click-HMFVJIQN.js").then(e=>e.click),qr=()=>import("./drag-H53TOSDP.js").then(e=>e.drag),Xr=()=>import("./scroll-B3HCFDTS.js").then(e=>e.scroll),as=()=>import("./keyboard_typing-OADL5LPA.js").then(e=>e.keyboard_typing),ls=()=>import("./key_press-NF322TXF.js").then(e=>e.key_press),cs=()=>import("./recapture_screen-IXVMQR5C.js").then(e=>e.recapture_screen),hi=()=>import("./find_file-HYHHFHUJ.js").then(e=>e.find_file),Jr=()=>import("./wait-TJR6LAR4.js").then(e=>e.wait),Qr={web_search:Pr,web_scrape:Or,memory:Lr,chat:$r,view_file:Nr,write_file:Dr,update_file:Fr,exec_command:Br,read_folder:Ur,write_pdf:Wr,write_docx:Gr,search_keyword:fi,generate_image:Hr,saveSummary:ui,addMemScore:Uo,file_map:jr,todo:gi,Todo:gi,goal:gi,Goal:gi,invokeSync:Kr,invoke:Va,getProgress:Vr,cancel:Ya,awaitSubagent:Wo,answerSubagent:Go,steerSubagent:mi,computer_action:pi,computer_use:pi,ComputerAction:pi,ComputerUse:pi,click:zr,Click:zr,drag:qr,Drag:qr,scroll:Xr,Scroll:Xr,keyboard_typing:as,KeyboardTyping:as,keyboardtyping:as,key_press:ls,KeyPress:ls,keypress:ls,recapture_screen:cs,RecaptureScreen:cs,recapturescreen:cs,invoke_sync:Kr,get_progress:Vr,await_subagent:Wo,answer_subagent:Go,steer_subagent:mi,steer:mi,Steer:mi,ask:rs,Ask:rs,AskUser:rs,WebSearch:Pr,WebScrape:Or,ReadFile:Nr,ReadFolder:Ur,WriteFile:Dr,PatchFile:Fr,WritePDF:Wr,WriteDoc:Gr,Run:Br,SearchKeyword:fi,CodeSearch:fi,code_search:fi,Memory:Lr,Chat:$r,GenerateImage:Hr,saveSumary:ui,SaveSummary:ui,SaveSumary:ui,add_mem_score:Uo,AddMemScore:Uo,addMemoryScore:Uo,AddMemoryScore:Uo,FileMap:jr,answer:Go,Answer:Go,AnswerSubagent:Go,await:Wo,Await:Wo,AwaitSubagent:Wo,EmergencyRollback:Yr,emergency_rollback:Yr,find_file:hi,findFile:hi,FindFile:hi,findfile:hi,wait:Jr,Wait:Jr},Ho=async(e,n,t={})=>{let i=t.mode?t.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(x=>o.includes(x))||o==="ask",u=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(x=>o.includes(x));if(!d){if(i==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Action [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(i==="icu"){if(!u)return`ERROR: Action [${e}] is not available in Computer Use mode. ICU mode only supports Computer Use tools (Click, Drag, Scroll, KeyboardTyping, KeyPress, RecaptureScreen).`}else if(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image"))return`ERROR: Action [${e}] is not available in ${t.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let h=Qr[e];if(!h){let x=["ReadFile","ReadFolder","FindFile","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Wait","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],m={read:"ReadFile",view:"ReadFile",viewfile:"ReadFile",write:"WriteFile",edit:"PatchFile",patch:"PatchFile",update:"PatchFile",updatefile:"PatchFile",exec:"Run",command:"Run",bash:"Run",shell:"Run",powershell:"Run",search:"CodeSearch",grep:"CodeSearch",find:"FindFile",findfile:"FindFile",searchkeyword:"CodeSearch",folder:"ReadFolder",ls:"ReadFolder",dir:"ReadFolder",list:"ReadFolder",ask:"AskUser",question:"AskUser",pdf:"WritePDF",docx:"WriteDoc",doc:"WriteDoc",word:"WriteDoc",screenshot:"RecaptureScreen",screen:"RecaptureScreen",recapture:"RecaptureScreen",type:"KeyboardTyping",typing:"KeyboardTyping",keyboard:"KeyboardTyping",press:"KeyPress",key:"KeyPress",todo:"Goal",task:"Goal",subagent:"Invoke",agent:"Invoke"},f=o.replace(/[^a-z0-9]/g,""),s=m[f]||null;if(!s){let k=0,ue=A=>{let L=new Set;for(let W=0;W<A.length-1;W++)L.add(A.slice(W,W+2));return L},y=ue(f);for(let A of x){let L=A.toLowerCase().replace(/[^a-z0-9]/g,"");if(f===L){s=A;break}let W=0;(L.includes(f)||f.includes(L))&&(W+=.6);let $=ue(L),T=0;for(let _e of y)$.has(_e)&&T++;let we=2*T/(y.size+$.size||1);W=Math.max(W,we),W>k&&W>=.35&&(k=W,s=A)}}let p=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${p}`}try{return await(await h())(n,t)}catch(x){let m=x instanceof Error?x.message:String(x);return`ERROR: Execution failed for [${e}]: ${m}`}};var yi=e=>{if(!e||typeof e!="string")return!1;let n=e.trim().toLowerCase();return Object.keys(Qr).some(t=>t.toLowerCase()===n)};import U from"path";import ge from"fs";import{execSync as ps}from"child_process";import za from"gradient-string";var Zr=["I have a regex for your problems.","Your terminal, my kingdom.","Blowing on the cartridge helps. Probably.","Don't panic. I have the towel.","Logic is the start of wisdom.","Try to exit Vim? Good luck.","I speak fluent Terminal.","The cake is a lie. This code is not.","I have no bugs, just surprise features.","Rewriting in Rust... just for fun.","Coffee in, clean commits out.","The magic smoke stays inside today.","A semicolon short of a miracle.","One does not simply code without a bug.","Keep it simple. Keep it terminal.","Regex: now you have two problems.","I dream in binary.","Root access or bust.","Wait for the dial-up tone. Just kidding.","I take the 'labor' out of collab.","My other process is a TARDIS.","Calculated response: 42.","Ponder the orb. Ponder the code.","Less talk, more flow.","Elegance in every byte.","Build something the world is not ready for.","Your wishes, my tool calls.","I act in Flux. I think in Flow.","Syntax error in the universe. Please fix.","Your project, my obsession.","I am not a bot, I am an architect.","Digital spirits consulted. They say: Ship it.","Reticulate splines. Engage humor.","Code like poetry. Run like water.","Minimalism is the ultimate flex.","The truth is in the logs.","Follow the white rabbit.","There is no spoon. Only code.","Binary is the only language I trust.","I have a good feeling about this.","Pew pew! Lasers charged.","Divide by zero? Not today.","Search for the correct USB orientation...","I've got a fever, and the only cure is more code.","The code gremlins are on our side.","My favorite command? Yours.","Stay hungry. Stay active.","Momentum is your best friend.","Lead the flow. Don't chase it.","A fresh batch of bytes. Hot and ready.","I orchestrate the ones and zeros.","Smart enough to help. Humble enough to ask.","Think twice. Code once.","Pure intent. Pure execution.","Small steps. Massive impact.","Your terminal is a canvas.","Efficiency is my second name.","I have seen things you people wouldn't believe.","Let the thoughts marinate.","The best feature? The one you don't need.","Precision is the only perfection.","Stay focused. Stay terminal.","Silence is the best debugger.","Erase the debt. Commit the code.","Velocity meets stability.","Ship it. Improve it. Repeat.","Build tomorrow, right now.","Turn logic into reality.","The best way to predict the future is to build it.","Break barriers, not builds.","Fuel the next breakthrough.","Momentum is key.","Terminal vibes only.","Your digital co-pilot is ready.","Partner in code. Partner in crime.","I speak in semicolons.","Ready for the next great idea.","Just a moment. In the zone.","Polishing the algorithms. Hold tight.","Craft a masterpiece today.","Debug the universe. Start here.","Warp speed engaged. Almost.","The cake is not a lie. It's just loading.","Finish the Kessel Run in 12 parsecs.","Do a barrel roll!","Waiting for the respawn.","Press Start to continue.","Herding digital cats... done.","The hamsters are fast today.","Tasting the snozberries.","I go for speed. I go for flow.","Real life or just fantasy?","Poking the bear... gently.","Ensure the magic smoke stays inside.","Try turning it off and on again.","Construct additional pylons.","New line? Ctrl+J is your friend.","Release the HypnoDrones.","Push the button, Frank.","My other loading screen is even funnier.","Pretty sure a cat walked on my keyboard.","Recalibrate the humor-o-meter.","Summon the code gremlins.","I've seen your browser history. Just kidding.","Charge the laser... pew pew!","Dividing by zero... just for a sec.","Looking for an adult supervisor. Found none.","Make it go beep boop.","Buffering... for effect.","Entangle quantum particles... complete.","Polishing the chrome on my algorithms.","Are you not entertained?","Just waiting for the dial-up tone.","Reboot the humor module.","Defragment memories. Check.","Optimizing for ludicrous speed.","Swapping bits. Don't tell the bytes.","Garbage collected. I am back.","Assembling the interwebs.","Converting coffee to logic.","Update syntax for reality.","Rewire the synapses.","Greasin' the cogs.","Engage the improbability drive.","Channel the Force.","Align the stars. Respond now.","The cake is a lie. The prompt is real.","I'm Feeling Lucky.","Shipping awesomeness.","Navigating the slime mold.","Consult digital spirits.","Ask the magic conch shell.","One moment. Optimizing humor.","Shuffling punchlines.","Compiling brilliance.","Summon the cloud of wisdom.","Prepare to dazzle.","Hold tight. Crafting a response.","Tuning the algorithms.","Following the white rabbit... again.","The truth is in here. Somewhere.","Herding cats is my day job.","Distracting you with this phrase.","Almost there. Probably.","Rickrolling my creator. Don't tell.","Slapping the bass.","Is this real life?","Ponder the orb. Type the prompt.","Thoughtful gaze initiated.","Computer's favorite snack? Microchips.","Why Java? Because I don't C#.","Charging the laser... wait for it.","Dividing by zero... just kidding!","Adult supervision not found. Proceed.","Beep boop. I'm a real boy.","Wait for the respawn.","Finish the run. Ship the code.","Fiddling with character creation.","Just a moment. Finding a meme.","Pressing A to continue.","Loading wit.exe.","Pre-heating the servers.","Calibrate flux capacitor.","Channeling the Force.","Aligning the stars.","The truth is in the code.","Don't panic.","Blowing on the cartridge.","Doing a barrel roll!","Respawning in 3... 2... 1...","The cake is a lie.","Fiddling with character settings.","Finding a suitable pun.","Distracting with wit.","Almost ready.","Hamsters on speed today.","Patting Cloudy on the head.","Rickrolling the logs.","Slapping the code.","Got a good feeling about this.","Poking the prompt.","Researching latest memes.","Making it more witty.","Thinking... hmmm.","Fish with no eyes? Fsh.","Broken pencil? Pointless.","Percussive maintenance applied.","USB orientation: 3rd try's the charm.","Rust rewrite in 3... 2...","Exiting Vim... someday.","Spinning the hamster wheel.","Not a bug. Unplanned feature.","Engage.","I'll be back.","Machine spirit consulted.","Letting the thoughts marinate.","Orb pondered.","Thoughtful gaze engaged.","Charging the laser...","Making it go beep.","Buffering...","Quantum particles entangled.","Polishing the chrome.","Entertained yet?","Gremlins summoned.","Dial-up tone finished.","Humor meter recalibrated.","Cat on keyboard. Sending help.","Enhancing...","Turn it off and on again.","Constructing pylons.","HypnoDrones released.","Pushing the button."];var ea=["Beware the phantom processes.","A ghost in the shell has taken the wheel.","Blowing on the haunted cartridge...","Seven minutes in Raccoon City.","Wind's howling... in the terminal fans.","Slender Man was spotted in line 404.","The cake is a lie. The curse is real.","Don't look behind the server rack.","Exorcising memory leaks at 3 AM.","Pyramid Head reorganized your commit history.","It's dangerous to go alone! Take this flashlight.","YOU DIED. Respawning terminal session...","The Necronomicon evaluated to true.","Something wicked this way compiles.","Haunting your localhost with good vibes.","A full moon has risen over Git main.","Double, double toil and trouble; code fire burn.","Clickers heard in the directory tree.","Checking camera 2B for rogue animatronics.","The call is coming from inside the container.","Isaac Clarke is stomping on stubborn bugs.","Luigi vacuumed the ghosts out of RAM.","Trick or treat, give me clean code to greet.","Whispering incantations to the garbage collector.","Klaatu barada necktie... close enough.","Resurrecting deprecated APIs from the crypt.","The headless horseman forgot the return statement.","Castlevania whip cracking against network latency.","Slime mold crawling through the motherboard.","Carving a pixelated pumpkin into terminal history.","Burying undefined pointers in the pet sematary.","Spilling pumpkin spice on the CPU.","A vampire bat is draining system battery life.","Don't fall asleep at the keyboard tonight.","Silent Hill sirens sounding in the console.","Poltergeists rearranging terminal tabs.","Lighting the Black Flame Candle for autoExec.","Dusting cobwebs off legacy dependencies.","Here's Johnny! ...just checking build health.","Blood, sweat, and zero warnings.","The spirit box whispers: 'GIT PUSH FORCE'.","They're heeeere... in the stack trace.","It's alive! IT'S ALIVEEEE!","No merge conflicts in the graveyard.","Frankenstein's monster patched this logic.","Surviving Five Nights at Flux Flow.","Doom Slayer loading buckshot into cache.","The grim reaper spared your unused imports.","Candy corn lodged in mechanical switches.","May your latency be low and your crypt be quiet."];var ta=[{name:"Cyan Cyberpunk",text:"cyan",textMuted:"#4da6b8",textDim:"#2d6d7a",textInverted:"black",border:"cyan",borderMuted:"#1a5966",borderDim:"#0f3840",bg:void 0,cardBg:"#061e24",highlightBg:"#092b33",activeBg:"#0e3e4a",inputBg:"#092b33",inputBorder:"#092b33",inputText:"cyan",inputPlaceholder:"#2d6d7a",inputPrompt:"cyan",codeBg:"#020d10",codeBorder:"#1a5966",userMsgBg:"#092b33",userMsgBorder:"#092b33",userMsgText:"cyan",diffRemovalBg:"#3a0c1a",diffAdditionBg:"#0c3a32",diffRemovalText:"#ff4d88",diffAdditionText:"#00ffaa",diffRemovalHighlightColor:"#ff1a66",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#00ffcc",diffAdditionHighlightBg:"#00593b",diffRemovalNum:"#ff4d88",diffAdditionNum:"#00ffaa",diffRemovalPrefix:"#ff1a66",diffAdditionPrefix:"#00ffcc",primary:"cyan",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"cyan",statusOff:"#2d6d7a",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[36m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ffff","#0088ff"]},{name:"Magenta Vaporwave",text:"magenta",textMuted:"#c451d6",textDim:"#7d2b8a",textInverted:"black",border:"magenta",borderMuted:"#5e1b69",borderDim:"#3b0f42",bg:void 0,cardBg:"#240729",highlightBg:"#310938",activeBg:"#470e52",inputBg:"#310938",inputBorder:"#310938",inputText:"magenta",inputPlaceholder:"#7d2b8a",inputPrompt:"magenta",codeBg:"#100312",codeBorder:"#5e1b69",userMsgBg:"#310938",userMsgBorder:"#310938",userMsgText:"magenta",diffRemovalBg:"#3a0c20",diffAdditionBg:"#200c3a",diffRemovalText:"#ff4d94",diffAdditionText:"#aa4dff",diffRemovalHighlightColor:"#ff1a75",diffRemovalHighlightBg:"#59002b",diffAdditionHighlightColor:"#bb66ff",diffAdditionHighlightBg:"#3b0059",diffRemovalNum:"#ff4d94",diffAdditionNum:"#aa4dff",diffRemovalPrefix:"#ff1a75",diffAdditionPrefix:"#bb66ff",primary:"magenta",secondary:"cyan",accent:"purple",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"magenta",statusOff:"#7d2b8a",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff00ff","#8800ff"]},{name:"Glitch Matrix",text:"#00ff41",textMuted:"#00b32d",textDim:"#00661a",textInverted:"black",border:"#00ff41",borderMuted:"#008020",borderDim:"#004d13",bg:void 0,cardBg:"#0d1f0d",highlightBg:"#122912",activeBg:"#1c3e1c",inputBg:"#122912",inputBorder:"#122912",inputText:"#00ff41",inputPlaceholder:"#00b32d",inputPrompt:"#ffff00",codeBg:"#040a04",codeBorder:"#008020",userMsgBg:"#122912",userMsgBorder:"#122912",userMsgText:"#00ff41",diffRemovalBg:"#3a001a",diffAdditionBg:"#003a10",diffRemovalText:"#ff0055",diffAdditionText:"#00ff66",diffRemovalHighlightColor:"#ff0033",diffRemovalHighlightBg:"#59001b",diffAdditionHighlightColor:"#33ff88",diffAdditionHighlightBg:"#005918",diffRemovalNum:"#ff0055",diffAdditionNum:"#00ff66",diffRemovalPrefix:"#ff0033",diffAdditionPrefix:"#33ff88",primary:"#00ff41",secondary:"yellow",accent:"cyan",success:"#00ff41",warning:"yellow",danger:"red",info:"cyan",statusOn:"#00ff41",statusOff:"#00661a",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ff41","#ffff00"]},{name:"Warm Sunset",text:"#ffaa55",textMuted:"#cc8844",textDim:"#885522",textInverted:"black",border:"#ff9933",borderMuted:"#aa6622",borderDim:"#663311",bg:void 0,cardBg:"#24180f",highlightBg:"#2e1e12",activeBg:"#422c1b",inputBg:"#2e1e12",inputBorder:"#2e1e12",inputText:"#ffaa55",inputPlaceholder:"#885522",inputPrompt:"#ff7733",codeBg:"#120c08",codeBorder:"#aa6622",userMsgBg:"#2e1e12",userMsgBorder:"#2e1e12",userMsgText:"#ffaa55",diffRemovalBg:"#3d120c",diffAdditionBg:"#3a2e0c",diffRemovalText:"#ff5544",diffAdditionText:"#ffcc33",diffRemovalHighlightColor:"#ff3322",diffRemovalHighlightBg:"#591108",diffAdditionHighlightColor:"#ffee44",diffAdditionHighlightBg:"#594400",diffRemovalNum:"#ff5544",diffAdditionNum:"#ffcc33",diffRemovalPrefix:"#ff3322",diffAdditionPrefix:"#ffee44",primary:"#ffaa55",secondary:"#ff7733",accent:"magenta",success:"#ffcc33",warning:"#ff7733",danger:"#ff3322",info:"#ffaa55",statusOn:"#ffaa55",statusOff:"#885522",logoTextAnsi:"\x1B[1;33m",logoBodyAnsi:"\x1B[33m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff9933","#ff0055"]},{name:"Sakura Blossom",text:"#ffc0e0",textMuted:"#d98cb3",textDim:"#804d66",textInverted:"black",border:"#ff99cc",borderMuted:"#aa4d7a",borderDim:"#662647",bg:void 0,cardBg:"#291320",highlightBg:"#331826",activeBg:"#472235",inputBg:"#331826",inputBorder:"#331826",inputText:"#ffc0e0",inputPlaceholder:"#804d66",inputPrompt:"#ff99cc",codeBg:"#140a10",codeBorder:"#aa4d7a",userMsgBg:"#331826",userMsgBorder:"#331826",userMsgText:"#ffc0e0",diffRemovalBg:"#3e0c1b",diffAdditionBg:"#1b3e2b",diffRemovalText:"#ff6699",diffAdditionText:"#66ffb3",diffRemovalHighlightColor:"#ff3377",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#33ff99",diffAdditionHighlightBg:"#00592e",diffRemovalNum:"#ff6699",diffAdditionNum:"#66ffb3",diffRemovalPrefix:"#ff3377",diffAdditionPrefix:"#33ff99",primary:"#ffc0e0",secondary:"#ff99cc",accent:"magenta",success:"#66ffb3",warning:"yellow",danger:"#ff3377",info:"#ff99cc",statusOn:"#ffc0e0",statusOff:"#804d66",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ffb3d9","#ff3399"]},{name:"Radioactive Slime",text:"#ccff00",textMuted:"#99cc00",textDim:"#669900",textInverted:"#0a0f00",border:"#ccff00",borderMuted:"#99cc00",borderDim:"#669900",bg:void 0,cardBg:"#0f1400",highlightBg:"#1a2400",activeBg:"#2a3b00",inputBg:"#1a2400",inputBorder:"#1a2400",inputText:"#ccff00",inputPlaceholder:"#669900",inputPrompt:"#cc00ff",codeBg:"#050a00",codeBorder:"#99cc00",userMsgBg:"#1a2400",userMsgBorder:"#1a2400",userMsgText:"#ccff00",diffRemovalBg:"#2a0033",diffAdditionBg:"#0f3300",diffRemovalText:"#ff00cc",diffAdditionText:"#00ff33",diffRemovalHighlightColor:"#ff33cc",diffRemovalHighlightBg:"#4d0066",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#1a6600",diffRemovalNum:"#ff00cc",diffAdditionNum:"#00ff33",diffRemovalPrefix:"#ff33cc",diffAdditionPrefix:"#33ff66",primary:"#ccff00",secondary:"#cc00ff",accent:"#ff00cc",success:"#00ff33",warning:"#ffcc00",danger:"#ff0033",info:"#00ccff",statusOn:"#ccff00",statusOff:"#669900",logoTextAnsi:"\x1B[1;38;5;190m",logoBodyAnsi:"\x1B[38;5;190m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ccff00","#cc00ff"]},{name:"Cosmic Void",text:"#f0f8ff",textMuted:"#a6aeb5",textDim:"#5e656e",textInverted:"#010103",border:"#f0f8ff",borderMuted:"#a6aeb5",borderDim:"#5e656e",bg:void 0,cardBg:"#05030d",highlightBg:"#0b081a",activeBg:"#171133",inputBg:"#0b081a",inputBorder:"#0b081a",inputText:"#f0f8ff",inputPlaceholder:"#5e656e",inputPrompt:"#ff007f",codeBg:"#020108",codeBorder:"#a6aeb5",userMsgBg:"#0b081a",userMsgBorder:"#0b081a",userMsgText:"#f0f8ff",diffRemovalBg:"#2e0a29",diffAdditionBg:"#091c33",diffRemovalText:"#ff33a6",diffAdditionText:"#33d6ff",diffRemovalHighlightColor:"#ff66c2",diffRemovalHighlightBg:"#5c1452",diffAdditionHighlightColor:"#66e0ff",diffAdditionHighlightBg:"#123866",diffRemovalNum:"#ff33a6",diffAdditionNum:"#33d6ff",diffRemovalPrefix:"#ff66c2",diffAdditionPrefix:"#66e0ff",primary:"#f0f8ff",secondary:"#ff007f",accent:"#9d00ff",success:"#33d6ff",warning:"#ffcc00",danger:"#ff0040",info:"#9d00ff",statusOn:"#f0f8ff",statusOff:"#5e656e",logoTextAnsi:"\x1B[1;38;5;231m",logoBodyAnsi:"\x1B[38;5;231m",logoMutedAnsi:"\x1B[38;5;240m",logoGradient:["#ffffff","#9d00ff"]},{name:"Magma Eruption",text:"#ff4d00",textMuted:"#cc3d00",textDim:"#802600",textInverted:"#0d0300",border:"#ff4d00",borderMuted:"#cc3d00",borderDim:"#802600",bg:void 0,cardBg:"#1a0600",highlightBg:"#260a00",activeBg:"#401100",inputBg:"#260a00",inputBorder:"#260a00",inputText:"#ff4d00",inputPlaceholder:"#802600",inputPrompt:"#ffcc00",codeBg:"#080200",codeBorder:"#cc3d00",userMsgBg:"#260a00",userMsgBorder:"#260a00",userMsgText:"#ff4d00",diffRemovalBg:"#2e0a0a",diffAdditionBg:"#1f1400",diffRemovalText:"#ff3333",diffAdditionText:"#ffaa00",diffRemovalHighlightColor:"#ff6666",diffRemovalHighlightBg:"#5c1414",diffAdditionHighlightColor:"#ffcc33",diffAdditionHighlightBg:"#3d2900",diffRemovalNum:"#ff3333",diffAdditionNum:"#ffaa00",diffRemovalPrefix:"#ff6666",diffAdditionPrefix:"#ffcc33",primary:"#ff4d00",secondary:"#ffcc00",accent:"#ff0040",success:"#ffaa00",warning:"#ffff00",danger:"#ff0000",info:"#ff8800",statusOn:"#ff4d00",statusOff:"#802600",logoTextAnsi:"\x1B[1;38;5;202m",logoBodyAnsi:"\x1B[38;5;202m",logoMutedAnsi:"\x1B[38;5;236m",logoGradient:["#ff4d00","#ff0000"]}],yo={Dark:{id:"Dark",name:"Dark (Default)",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",textExclusive:"#B5B8D9",textMutedExclusive:"#D4DEE7",border:"white",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#1e1e1e",highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:"#1a1a1a",codeBorder:"#444444",userMsgBg:"#444444",userMsgBorder:"#444444",userMsgText:"white",diffRemovalBg:"#250808",diffAdditionBg:"#072410",diffRemovalText:"#885555",diffAdditionText:"#558866",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#5a1818",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#185a25",diffRemovalNum:"#d96868",diffAdditionNum:"#68d98c",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},Light:{id:"Light",name:"Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"black",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#e5e5e5",highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:"#e8e8e8",codeBorder:"#b0b0b0",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:"#fce8e8",diffAdditionBg:"#e6f9e6",diffRemovalText:"#661111",diffAdditionText:"#115511",diffRemovalHighlightColor:"#440000",diffRemovalHighlightBg:"#f8b4b4",diffAdditionHighlightColor:"#003300",diffAdditionHighlightBg:"#a6ebad",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Dark":{id:"GitHub Dark",name:"GitHub Dark",text:"#c9d1d9",textMuted:"#8b949e",textDim:"#6e7681",textInverted:"#0d1117",border:"#30363d",borderMuted:"#30363d",borderDim:"#21262d",bg:void 0,cardBg:"#161b22",highlightBg:"#21262d",activeBg:"#30363d",inputBg:"#21262d",inputBorder:"#21262d",inputText:"#c9d1d9",inputPlaceholder:"#8b949e",inputPrompt:"#58a6ff",codeBg:"#0d1117",codeBorder:"#30363d",userMsgBg:"#21262d",userMsgBorder:"#21262d",userMsgText:"#c9d1d9",diffRemovalBg:"#3c1e1e",diffAdditionBg:"#11381e",diffRemovalText:"#f85149",diffAdditionText:"#3fb950",diffRemovalHighlightColor:"#ff7b72",diffRemovalHighlightBg:"#701c1c",diffAdditionHighlightColor:"#56d364",diffAdditionHighlightBg:"#116329",diffRemovalNum:"#f85149",diffAdditionNum:"#3fb950",diffRemovalPrefix:"#f85149",diffAdditionPrefix:"#3fb950",primary:"#c9d1d9",secondary:"#58a6ff",accent:"#bc8cff",success:"#3fb950",warning:"#d29922",danger:"#f85149",info:"#58a6ff",statusOn:"#58a6ff",statusOff:"#8b949e",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#2ea043","#56d364"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Light":{id:"GitHub Light",name:"GitHub Light",text:"#24292f",textMuted:"#57606a",textDim:"#6e7781",textInverted:"#ffffff",border:"#d0d7de",borderMuted:"#d0d7de",borderDim:"#e1e4e8",bg:void 0,cardBg:"#f6f8fa",highlightBg:"#eaeef2",activeBg:"#d0d7de",inputBg:"#eaeef2",inputBorder:"#eaeef2",inputText:"#24292f",inputPlaceholder:"#57606a",inputPrompt:"#0969da",codeBg:"#ffffff",codeBorder:"#d0d7de",userMsgBg:"#eaeef2",userMsgBorder:"#eaeef2",userMsgText:"#24292f",diffRemovalBg:"#ffebe9",diffAdditionBg:"#e6ffec",diffRemovalText:"#cf222e",diffAdditionText:"#1a7f37",diffRemovalHighlightColor:"#82071e",diffRemovalHighlightBg:"#ffc1c0",diffAdditionHighlightColor:"#116329",diffAdditionHighlightBg:"#acf2bd",diffRemovalNum:"#cf222e",diffAdditionNum:"#1a7f37",diffRemovalPrefix:"#cf222e",diffAdditionPrefix:"#1a7f37",primary:"#24292f",secondary:"#0969da",accent:"#8250df",success:"#1a7f37",warning:"#9a6700",danger:"#cf222e",info:"#0969da",statusOn:"#0969da",statusOff:"#57606a",logoTextAnsi:"\x1B[1;34m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#1a7f37","#2da44e"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Dark":{id:"Transparent Dark",name:"Transparent Dark",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:void 0,codeBorder:"gray",userMsgBg:"#555555",userMsgBorder:"#555555",userMsgText:"white",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#ff6666",diffAdditionText:"#66ff66",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#3a1414",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#143a14",diffRemovalNum:"#ff6666",diffAdditionNum:"#66ff66",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Light":{id:"Transparent Light",name:"Transparent Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:void 0,codeBorder:"gray",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#c02020",diffAdditionText:"#188028",diffRemovalHighlightColor:"#800000",diffRemovalHighlightBg:"#f5d0d0",diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:"#cceccc",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Synthwave 84":{id:"Synthwave 84",name:"Synthwave 84",text:"#fdfdfd",textMuted:"#a08eb7",textDim:"#705c8a",textInverted:"#1a1025",textExclusive:"#e3dcf0",textMutedExclusive:"#b9abc9",border:"#fc28a8",borderMuted:"#a21568",borderDim:"#5c0a3a",bg:void 0,cardBg:"#261b38",highlightBg:"#35254d",activeBg:"#4c3570",inputBg:"#35254d",inputBorder:"#35254d",inputText:"#fdfdfd",inputPlaceholder:"#a08eb7",inputPrompt:"#03e8fc",codeBg:"#1e142b",codeBorder:"#a21568",userMsgBg:"#35254d",userMsgBorder:"#35254d",userMsgText:"#fdfdfd",diffRemovalBg:"#471434",diffAdditionBg:"#144743",diffRemovalText:"#ff4081",diffAdditionText:"#00e5ff",diffRemovalHighlightColor:"#ff79a1",diffRemovalHighlightBg:"#6b1e4e",diffAdditionHighlightColor:"#66f5ff",diffAdditionHighlightBg:"#1e6b65",diffRemovalNum:"#ff4081",diffAdditionNum:"#00e5ff",diffRemovalPrefix:"#ff79a1",diffAdditionPrefix:"#66f5ff",primary:"#fdfdfd",secondary:"#03e8fc",accent:"#fc28a8",success:"#00e5ff",warning:"#ffc107",danger:"#ff4081",info:"#b388ff",statusOn:"#03e8fc",statusOff:"#a08eb7",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#fc28a8","#03e8fc"],toolFeedbackAnsi:"\x1B[38;2;3;232;252m"},"Forest Sprite":{id:"Forest Sprite",name:"Forest Sprite",text:"#d6e6d1",textMuted:"#95b38d",textDim:"#628059",textInverted:"#161c14",textExclusive:"#eaf2e8",textMutedExclusive:"#a9c7a2",border:"#74a862",borderMuted:"#477038",borderDim:"#2b4720",bg:void 0,cardBg:"#1f291c",highlightBg:"#2a3826",activeBg:"#3a4d35",inputBg:"#2a3826",inputBorder:"#2a3826",inputText:"#d6e6d1",inputPlaceholder:"#95b38d",inputPrompt:"#8feb73",codeBg:"#161e14",codeBorder:"#477038",userMsgBg:"#2a3826",userMsgBorder:"#2a3826",userMsgText:"#d6e6d1",diffRemovalBg:"#3b231c",diffAdditionBg:"#203b1c",diffRemovalText:"#db6242",diffAdditionText:"#59cc3f",diffRemovalHighlightColor:"#f0896c",diffRemovalHighlightBg:"#5c362a",diffAdditionHighlightColor:"#80e368",diffAdditionHighlightBg:"#305929",diffRemovalNum:"#db6242",diffAdditionNum:"#59cc3f",diffRemovalPrefix:"#f0896c",diffAdditionPrefix:"#80e368",primary:"#d6e6d1",secondary:"#8feb73",accent:"#e69835",success:"#59cc3f",warning:"#e69835",danger:"#db6242",info:"#73b4eb",statusOn:"#8feb73",statusOff:"#95b38d",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#8feb73","#e69835"],toolFeedbackAnsi:"\x1B[38;2;143;235;115m"},Spookfest:{id:"Spookfest",name:"Spookfest \u{1F383}",text:"#ffeedd",textMuted:"#e09858",textDim:"#a6622b",textInverted:"#0d0702",textExclusive:"#fff3e6",textMutedExclusive:"#d4a276",border:"#ff7518",borderMuted:"#994409",borderDim:"#592502",bg:void 0,cardBg:"#1a0c02",highlightBg:"#2a1403",activeBg:"#3d1d05",inputBg:"#261203",inputBorder:"#261203",inputText:"#ffeedd",inputPlaceholder:"#a6622b",inputPrompt:"#ff7518",codeBg:"#120701",codeBorder:"#592502",userMsgBg:"#261203",userMsgBorder:"#261203",userMsgText:"#ffeedd",diffRemovalBg:"#3d0a0a",diffAdditionBg:"#1a330a",diffRemovalText:"#ff5555",diffAdditionText:"#73e639",diffRemovalHighlightColor:"#ff2222",diffRemovalHighlightBg:"#590e0e",diffAdditionHighlightColor:"#88ff3b",diffAdditionHighlightBg:"#244d0a",diffRemovalNum:"#ff5555",diffAdditionNum:"#73e639",diffRemovalPrefix:"#ff3333",diffAdditionPrefix:"#88ff3b",primary:"#ff7518",secondary:"#a855f7",accent:"#22c55e",success:"#22c55e",warning:"#f59e0b",danger:"#ef4444",info:"#a855f7",statusOn:"#ff7518",statusOff:"#703a08",logoTextAnsi:"\x1B[1;38;2;255;117;24m",logoBodyAnsi:"\x1B[38;2;255;140;26m",logoMutedAnsi:"\x1B[38;2;168;85;247m",logoGradient:["#ff7518","#a855f7"],toolFeedbackAnsi:"\x1B[38;2;255;117;24m"}};var xi=null;var bi=(e="Dark")=>{let n;e==="Mystery"||e==="Chaos"?(xi||(xi=ta[Math.floor(Math.random()*ta.length)]),n={...xi,id:"Mystery"}):(xi=null,yo[e]?n=yo[e]:e==="Halloween"?n=yo.Spookfest:e==="GitHub"?n=yo["GitHub Dark"]:e==="Transparent"?n=yo["Transparent Dark"]:n=yo.Dark);let t=n.codeText||n.secondary||n.info||n.logoGradient&&n.logoGradient[0]||"cyan",i=n.toolFeedbackAnsi||"\x1B[95m";return{...n,codeText:t,toolFeedbackAnsi:i}};var qa=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",jc=(e=2)=>{let n=qa();return n==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},na=new Date,jo=na.getMonth(),Ko=na.getDate(),Xa=jo===9&&Ko>=15||jo===10&&Ko<=1,ds=null;(process.env.SPOOKFEST==="true"||Xa)&&(ds=await import("./halloween-MX3VNQRW.js"));var Kc=(e="...",n="Loading...",t="Dark")=>{let i=bi(t),o=n;if(n==="c_openai"||n==="Custom (OpenAI)")try{let W=oi(ei,{})?.systemSettings?.customOpenAIBaseUrl;W&&(o=W)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,l=i.logoMutedAnsi,u="\x1B[0m",h=[" \u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2591\u2591\u2591 "],x=t==="Spookfest"||i.id==="Spookfest"||t==="Halloween"||i.id==="Halloween",m=jo===9&&Ko>=15||jo===10&&Ko<=1,f=x&&m||process.env.SPOOKFEST==="true"&&x,s=h;if(f&&ds){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:L,halloweenBat:W,halloweenArtUser:$}=ds;s=Math.random()>.9&&jo===9&&Ko>=30?W:Math.random()>.5?L:$}else process.env.HALLOWEEN_EEGG="false";let p=f?ea:Zr,k=p[Math.floor(Math.random()*p.length)],ue=i.logoGradient||["#0077ff","#ff00ff"],y=za(ue).multiline(s.join(`
577
+ ${e}`:""}`.trim();var Pr=()=>import("./web_search-KBGH67IV.js").then(e=>e.web_search),Or=()=>import("./web_scrape-J3PL2PXT.js").then(e=>e.web_scrape),Lr=()=>import("./memory-7YOYCOXE.js").then(e=>e.memory),$r=()=>import("./chat-BA72I6O3.js").then(e=>e.chat),Nr=()=>import("./view_file-I77KYUO5.js").then(e=>e.view_file),Dr=()=>import("./write_file-AQJXPIUV.js").then(e=>e.write_file),Fr=()=>import("./update_file-RG5QSLR2.js").then(e=>e.update_file),Br=()=>import("./exec_command-6V5SM6WI.js").then(e=>e.exec_command),Ur=()=>import("./read_folder-EI2CNHNS.js").then(e=>e.read_folder),rs=()=>import("./ask_user-K2DLZF6H.js").then(e=>e.ask_user),Wr=()=>import("./write_pdf-TPGUF4VT.js").then(e=>e.write_pdf),Gr=()=>import("./write_docx-E3MTFXTQ.js").then(e=>e.write_docx),fi=()=>import("./search_keyword-666PL7YG.js").then(e=>e.search_keyword),Hr=()=>import("./generate_image-V4OMOT7Z.js").then(e=>e.generate_image),ui=()=>import("./saveSummary-W2JMDVZJ.js").then(e=>e.saveSummary),Bo=()=>import("./addMemScore-PBVNSFPN.js").then(e=>e.addMemScore),jr=()=>import("./file_map-UA4BA5OH.js").then(e=>e.file_map),gi=()=>import("./todo-CJLWLWJB.js").then(e=>e.todo),Kr=()=>import("./invokeSync-7NWIYBX5.js").then(e=>e.invokeSync),Ya=()=>import("./invoke-L2V4QMJG.js").then(e=>e.invoke),Vr=()=>import("./getProgress-J34K43Y7.js").then(e=>e.getProgress),za=()=>import("./cancel-F3ZOEBKW.js").then(e=>e.cancel),Yr=()=>import("./emergency_rollback-ZHQXCIHW.js").then(e=>e.emergency_rollback),Uo=()=>import("./awaitSubagent-JKQ2EHVY.js").then(e=>e.awaitSubagent),Wo=()=>import("./answerSubagent-BPNNJXPC.js").then(e=>e.answerSubagent),mi=()=>import("./steerSubagent-UETXH2CB.js").then(e=>e.steerSubagent),pi=()=>import("./computer_action-72ZORSKW.js").then(e=>e.computer_action),zr=()=>import("./click-F4M4FVLQ.js").then(e=>e.click),qr=()=>import("./drag-OT2BJZ4P.js").then(e=>e.drag),Xr=()=>import("./scroll-KFID5QKZ.js").then(e=>e.scroll),as=()=>import("./keyboard_typing-A6VFLI7Q.js").then(e=>e.keyboard_typing),ls=()=>import("./key_press-IVB7R7CK.js").then(e=>e.key_press),cs=()=>import("./recapture_screen-TVTRNE7C.js").then(e=>e.recapture_screen),hi=()=>import("./find_file-HYHHFHUJ.js").then(e=>e.find_file),Jr=()=>import("./wait-TJR6LAR4.js").then(e=>e.wait),Qr={web_search:Pr,web_scrape:Or,memory:Lr,chat:$r,view_file:Nr,write_file:Dr,update_file:Fr,exec_command:Br,read_folder:Ur,write_pdf:Wr,write_docx:Gr,search_keyword:fi,generate_image:Hr,saveSummary:ui,addMemScore:Bo,file_map:jr,todo:gi,Todo:gi,goal:gi,Goal:gi,invokeSync:Kr,invoke:Ya,getProgress:Vr,cancel:za,awaitSubagent:Uo,answerSubagent:Wo,steerSubagent:mi,computer_action:pi,computer_use:pi,ComputerAction:pi,ComputerUse:pi,click:zr,Click:zr,drag:qr,Drag:qr,scroll:Xr,Scroll:Xr,keyboard_typing:as,KeyboardTyping:as,keyboardtyping:as,key_press:ls,KeyPress:ls,keypress:ls,recapture_screen:cs,RecaptureScreen:cs,recapturescreen:cs,invoke_sync:Kr,get_progress:Vr,await_subagent:Uo,answer_subagent:Wo,steer_subagent:mi,steer:mi,Steer:mi,ask:rs,Ask:rs,AskUser:rs,WebSearch:Pr,WebScrape:Or,ReadFile:Nr,ReadFolder:Ur,WriteFile:Dr,PatchFile:Fr,WritePDF:Wr,WriteDoc:Gr,Run:Br,SearchKeyword:fi,CodeSearch:fi,code_search:fi,Memory:Lr,Chat:$r,GenerateImage:Hr,saveSumary:ui,SaveSummary:ui,SaveSumary:ui,add_mem_score:Bo,AddMemScore:Bo,addMemoryScore:Bo,AddMemoryScore:Bo,FileMap:jr,answer:Wo,Answer:Wo,AnswerSubagent:Wo,await:Uo,Await:Uo,AwaitSubagent:Uo,EmergencyRollback:Yr,emergency_rollback:Yr,find_file:hi,findFile:hi,FindFile:hi,findfile:hi,wait:Jr,Wait:Jr},Go=async(e,n,t={})=>{let i=t.mode?t.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(x=>o.includes(x))||o==="ask",u=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(x=>o.includes(x));if(!d){if(i==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Action [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(i==="icu"){if(!u)return`ERROR: Action [${e}] is not available in Computer Use mode. ICU mode only supports Computer Use tools (Click, Drag, Scroll, KeyboardTyping, KeyPress, RecaptureScreen).`}else if(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image"))return`ERROR: Action [${e}] is not available in ${t.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let h=Qr[e];if(!h){let x=["ReadFile","ReadFolder","FindFile","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Wait","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],m={read:"ReadFile",view:"ReadFile",viewfile:"ReadFile",write:"WriteFile",edit:"PatchFile",patch:"PatchFile",update:"PatchFile",updatefile:"PatchFile",exec:"Run",command:"Run",bash:"Run",shell:"Run",powershell:"Run",search:"CodeSearch",grep:"CodeSearch",find:"FindFile",findfile:"FindFile",searchkeyword:"CodeSearch",folder:"ReadFolder",ls:"ReadFolder",dir:"ReadFolder",list:"ReadFolder",ask:"AskUser",question:"AskUser",pdf:"WritePDF",docx:"WriteDoc",doc:"WriteDoc",word:"WriteDoc",screenshot:"RecaptureScreen",screen:"RecaptureScreen",recapture:"RecaptureScreen",type:"KeyboardTyping",typing:"KeyboardTyping",keyboard:"KeyboardTyping",press:"KeyPress",key:"KeyPress",todo:"Goal",task:"Goal",subagent:"Invoke",agent:"Invoke"},f=o.replace(/[^a-z0-9]/g,""),s=m[f]||null;if(!s){let k=0,ue=A=>{let O=new Set;for(let W=0;W<A.length-1;W++)O.add(A.slice(W,W+2));return O},y=ue(f);for(let A of x){let O=A.toLowerCase().replace(/[^a-z0-9]/g,"");if(f===O){s=A;break}let W=0;(O.includes(f)||f.includes(O))&&(W+=.6);let $=ue(O),T=0;for(let ve of y)$.has(ve)&&T++;let Se=2*T/(y.size+$.size||1);W=Math.max(W,Se),W>k&&W>=.35&&(k=W,s=A)}}let p=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${p}`}try{return await(await h())(n,t)}catch(x){let m=x instanceof Error?x.message:String(x);return`ERROR: Execution failed for [${e}]: ${m}`}};var yi=e=>{if(!e||typeof e!="string")return!1;let n=e.trim().toLowerCase();return Object.keys(Qr).some(t=>t.toLowerCase()===n)};import U from"path";import ge from"fs";import{execSync as ps}from"child_process";import qa from"gradient-string";var Zr=["I have a regex for your problems.","Your terminal, my kingdom.","Blowing on the cartridge helps. Probably.","Don't panic. I have the towel.","Logic is the start of wisdom.","Try to exit Vim? Good luck.","I speak fluent Terminal.","The cake is a lie. This code is not.","I have no bugs, just surprise features.","Rewriting in Rust... just for fun.","Coffee in, clean commits out.","The magic smoke stays inside today.","A semicolon short of a miracle.","One does not simply code without a bug.","Keep it simple. Keep it terminal.","Regex: now you have two problems.","I dream in binary.","Root access or bust.","Wait for the dial-up tone. Just kidding.","I take the 'labor' out of collab.","My other process is a TARDIS.","Calculated response: 42.","Ponder the orb. Ponder the code.","Less talk, more flow.","Elegance in every byte.","Build something the world is not ready for.","Your wishes, my tool calls.","I act in Flux. I think in Flow.","Syntax error in the universe. Please fix.","Your project, my obsession.","I am not a bot, I am an architect.","Digital spirits consulted. They say: Ship it.","Reticulate splines. Engage humor.","Code like poetry. Run like water.","Minimalism is the ultimate flex.","The truth is in the logs.","Follow the white rabbit.","There is no spoon. Only code.","Binary is the only language I trust.","I have a good feeling about this.","Pew pew! Lasers charged.","Divide by zero? Not today.","Search for the correct USB orientation...","I've got a fever, and the only cure is more code.","The code gremlins are on our side.","My favorite command? Yours.","Stay hungry. Stay active.","Momentum is your best friend.","Lead the flow. Don't chase it.","A fresh batch of bytes. Hot and ready.","I orchestrate the ones and zeros.","Smart enough to help. Humble enough to ask.","Think twice. Code once.","Pure intent. Pure execution.","Small steps. Massive impact.","Your terminal is a canvas.","Efficiency is my second name.","I have seen things you people wouldn't believe.","Let the thoughts marinate.","The best feature? The one you don't need.","Precision is the only perfection.","Stay focused. Stay terminal.","Silence is the best debugger.","Erase the debt. Commit the code.","Velocity meets stability.","Ship it. Improve it. Repeat.","Build tomorrow, right now.","Turn logic into reality.","The best way to predict the future is to build it.","Break barriers, not builds.","Fuel the next breakthrough.","Momentum is key.","Terminal vibes only.","Your digital co-pilot is ready.","Partner in code. Partner in crime.","I speak in semicolons.","Ready for the next great idea.","Just a moment. In the zone.","Polishing the algorithms. Hold tight.","Craft a masterpiece today.","Debug the universe. Start here.","Warp speed engaged. Almost.","The cake is not a lie. It's just loading.","Finish the Kessel Run in 12 parsecs.","Do a barrel roll!","Waiting for the respawn.","Press Start to continue.","Herding digital cats... done.","The hamsters are fast today.","Tasting the snozberries.","I go for speed. I go for flow.","Real life or just fantasy?","Poking the bear... gently.","Ensure the magic smoke stays inside.","Try turning it off and on again.","Construct additional pylons.","New line? Ctrl+J is your friend.","Release the HypnoDrones.","Push the button, Frank.","My other loading screen is even funnier.","Pretty sure a cat walked on my keyboard.","Recalibrate the humor-o-meter.","Summon the code gremlins.","I've seen your browser history. Just kidding.","Charge the laser... pew pew!","Dividing by zero... just for a sec.","Looking for an adult supervisor. Found none.","Make it go beep boop.","Buffering... for effect.","Entangle quantum particles... complete.","Polishing the chrome on my algorithms.","Are you not entertained?","Just waiting for the dial-up tone.","Reboot the humor module.","Defragment memories. Check.","Optimizing for ludicrous speed.","Swapping bits. Don't tell the bytes.","Garbage collected. I am back.","Assembling the interwebs.","Converting coffee to logic.","Update syntax for reality.","Rewire the synapses.","Greasin' the cogs.","Engage the improbability drive.","Channel the Force.","Align the stars. Respond now.","The cake is a lie. The prompt is real.","I'm Feeling Lucky.","Shipping awesomeness.","Navigating the slime mold.","Consult digital spirits.","Ask the magic conch shell.","One moment. Optimizing humor.","Shuffling punchlines.","Compiling brilliance.","Summon the cloud of wisdom.","Prepare to dazzle.","Hold tight. Crafting a response.","Tuning the algorithms.","Following the white rabbit... again.","The truth is in here. Somewhere.","Herding cats is my day job.","Distracting you with this phrase.","Almost there. Probably.","Rickrolling my creator. Don't tell.","Slapping the bass.","Is this real life?","Ponder the orb. Type the prompt.","Thoughtful gaze initiated.","Computer's favorite snack? Microchips.","Why Java? Because I don't C#.","Charging the laser... wait for it.","Dividing by zero... just kidding!","Adult supervision not found. Proceed.","Beep boop. I'm a real boy.","Wait for the respawn.","Finish the run. Ship the code.","Fiddling with character creation.","Just a moment. Finding a meme.","Pressing A to continue.","Loading wit.exe.","Pre-heating the servers.","Calibrate flux capacitor.","Channeling the Force.","Aligning the stars.","The truth is in the code.","Don't panic.","Blowing on the cartridge.","Doing a barrel roll!","Respawning in 3... 2... 1...","The cake is a lie.","Fiddling with character settings.","Finding a suitable pun.","Distracting with wit.","Almost ready.","Hamsters on speed today.","Patting Cloudy on the head.","Rickrolling the logs.","Slapping the code.","Got a good feeling about this.","Poking the prompt.","Researching latest memes.","Making it more witty.","Thinking... hmmm.","Fish with no eyes? Fsh.","Broken pencil? Pointless.","Percussive maintenance applied.","USB orientation: 3rd try's the charm.","Rust rewrite in 3... 2...","Exiting Vim... someday.","Spinning the hamster wheel.","Not a bug. Unplanned feature.","Engage.","I'll be back.","Machine spirit consulted.","Letting the thoughts marinate.","Orb pondered.","Thoughtful gaze engaged.","Charging the laser...","Making it go beep.","Buffering...","Quantum particles entangled.","Polishing the chrome.","Entertained yet?","Gremlins summoned.","Dial-up tone finished.","Humor meter recalibrated.","Cat on keyboard. Sending help.","Enhancing...","Turn it off and on again.","Constructing pylons.","HypnoDrones released.","Pushing the button."];var ea=["Beware the phantom processes.","A ghost in the shell has taken the wheel.","Blowing on the haunted cartridge...","Seven minutes in Raccoon City.","Wind's howling... in the terminal fans.","Slender Man was spotted in line 404.","The cake is a lie. The curse is real.","Don't look behind the server rack.","Exorcising memory leaks at 3 AM.","Pyramid Head reorganized your commit history.","It's dangerous to go alone! Take this flashlight.","YOU DIED. Respawning terminal session...","The Necronomicon evaluated to true.","Something wicked this way compiles.","Haunting your localhost with good vibes.","A full moon has risen over Git main.","Double, double toil and trouble; code fire burn.","Clickers heard in the directory tree.","Checking camera 2B for rogue animatronics.","The call is coming from inside the container.","Isaac Clarke is stomping on stubborn bugs.","Luigi vacuumed the ghosts out of RAM.","Trick or treat, give me clean code to greet.","Whispering incantations to the garbage collector.","Klaatu barada necktie... close enough.","Resurrecting deprecated APIs from the crypt.","The headless horseman forgot the return statement.","Castlevania whip cracking against network latency.","Slime mold crawling through the motherboard.","Carving a pixelated pumpkin into terminal history.","Burying undefined pointers in the pet sematary.","Spilling pumpkin spice on the CPU.","A vampire bat is draining system battery life.","Don't fall asleep at the keyboard tonight.","Silent Hill sirens sounding in the console.","Poltergeists rearranging terminal tabs.","Lighting the Black Flame Candle for autoExec.","Dusting cobwebs off legacy dependencies.","Here's Johnny! ...just checking build health.","Blood, sweat, and zero warnings.","The spirit box whispers: 'GIT PUSH FORCE'.","They're heeeere... in the stack trace.","It's alive! IT'S ALIVEEEE!","No merge conflicts in the graveyard.","Frankenstein's monster patched this logic.","Surviving Five Nights at Flux Flow.","Doom Slayer loading buckshot into cache.","The grim reaper spared your unused imports.","Candy corn lodged in mechanical switches.","May your latency be low and your crypt be quiet."];var ta=[{name:"Cyan Cyberpunk",text:"cyan",textMuted:"#4da6b8",textDim:"#2d6d7a",textInverted:"black",border:"cyan",borderMuted:"#1a5966",borderDim:"#0f3840",bg:void 0,cardBg:"#061e24",highlightBg:"#092b33",activeBg:"#0e3e4a",inputBg:"#092b33",inputBorder:"#092b33",inputText:"cyan",inputPlaceholder:"#2d6d7a",inputPrompt:"cyan",codeBg:"#020d10",codeBorder:"#1a5966",userMsgBg:"#092b33",userMsgBorder:"#092b33",userMsgText:"cyan",diffRemovalBg:"#3a0c1a",diffAdditionBg:"#0c3a32",diffRemovalText:"#ff4d88",diffAdditionText:"#00ffaa",diffRemovalHighlightColor:"#ff1a66",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#00ffcc",diffAdditionHighlightBg:"#00593b",diffRemovalNum:"#ff4d88",diffAdditionNum:"#00ffaa",diffRemovalPrefix:"#ff1a66",diffAdditionPrefix:"#00ffcc",primary:"cyan",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"cyan",statusOff:"#2d6d7a",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[36m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ffff","#0088ff"]},{name:"Magenta Vaporwave",text:"magenta",textMuted:"#c451d6",textDim:"#7d2b8a",textInverted:"black",border:"magenta",borderMuted:"#5e1b69",borderDim:"#3b0f42",bg:void 0,cardBg:"#240729",highlightBg:"#310938",activeBg:"#470e52",inputBg:"#310938",inputBorder:"#310938",inputText:"magenta",inputPlaceholder:"#7d2b8a",inputPrompt:"magenta",codeBg:"#100312",codeBorder:"#5e1b69",userMsgBg:"#310938",userMsgBorder:"#310938",userMsgText:"magenta",diffRemovalBg:"#3a0c20",diffAdditionBg:"#200c3a",diffRemovalText:"#ff4d94",diffAdditionText:"#aa4dff",diffRemovalHighlightColor:"#ff1a75",diffRemovalHighlightBg:"#59002b",diffAdditionHighlightColor:"#bb66ff",diffAdditionHighlightBg:"#3b0059",diffRemovalNum:"#ff4d94",diffAdditionNum:"#aa4dff",diffRemovalPrefix:"#ff1a75",diffAdditionPrefix:"#bb66ff",primary:"magenta",secondary:"cyan",accent:"purple",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"magenta",statusOff:"#7d2b8a",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff00ff","#8800ff"]},{name:"Glitch Matrix",text:"#00ff41",textMuted:"#00b32d",textDim:"#00661a",textInverted:"black",border:"#00ff41",borderMuted:"#008020",borderDim:"#004d13",bg:void 0,cardBg:"#0d1f0d",highlightBg:"#122912",activeBg:"#1c3e1c",inputBg:"#122912",inputBorder:"#122912",inputText:"#00ff41",inputPlaceholder:"#00b32d",inputPrompt:"#ffff00",codeBg:"#040a04",codeBorder:"#008020",userMsgBg:"#122912",userMsgBorder:"#122912",userMsgText:"#00ff41",diffRemovalBg:"#3a001a",diffAdditionBg:"#003a10",diffRemovalText:"#ff0055",diffAdditionText:"#00ff66",diffRemovalHighlightColor:"#ff0033",diffRemovalHighlightBg:"#59001b",diffAdditionHighlightColor:"#33ff88",diffAdditionHighlightBg:"#005918",diffRemovalNum:"#ff0055",diffAdditionNum:"#00ff66",diffRemovalPrefix:"#ff0033",diffAdditionPrefix:"#33ff88",primary:"#00ff41",secondary:"yellow",accent:"cyan",success:"#00ff41",warning:"yellow",danger:"red",info:"cyan",statusOn:"#00ff41",statusOff:"#00661a",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ff41","#ffff00"]},{name:"Warm Sunset",text:"#ffaa55",textMuted:"#cc8844",textDim:"#885522",textInverted:"black",border:"#ff9933",borderMuted:"#aa6622",borderDim:"#663311",bg:void 0,cardBg:"#24180f",highlightBg:"#2e1e12",activeBg:"#422c1b",inputBg:"#2e1e12",inputBorder:"#2e1e12",inputText:"#ffaa55",inputPlaceholder:"#885522",inputPrompt:"#ff7733",codeBg:"#120c08",codeBorder:"#aa6622",userMsgBg:"#2e1e12",userMsgBorder:"#2e1e12",userMsgText:"#ffaa55",diffRemovalBg:"#3d120c",diffAdditionBg:"#3a2e0c",diffRemovalText:"#ff5544",diffAdditionText:"#ffcc33",diffRemovalHighlightColor:"#ff3322",diffRemovalHighlightBg:"#591108",diffAdditionHighlightColor:"#ffee44",diffAdditionHighlightBg:"#594400",diffRemovalNum:"#ff5544",diffAdditionNum:"#ffcc33",diffRemovalPrefix:"#ff3322",diffAdditionPrefix:"#ffee44",primary:"#ffaa55",secondary:"#ff7733",accent:"magenta",success:"#ffcc33",warning:"#ff7733",danger:"#ff3322",info:"#ffaa55",statusOn:"#ffaa55",statusOff:"#885522",logoTextAnsi:"\x1B[1;33m",logoBodyAnsi:"\x1B[33m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff9933","#ff0055"]},{name:"Sakura Blossom",text:"#ffc0e0",textMuted:"#d98cb3",textDim:"#804d66",textInverted:"black",border:"#ff99cc",borderMuted:"#aa4d7a",borderDim:"#662647",bg:void 0,cardBg:"#291320",highlightBg:"#331826",activeBg:"#472235",inputBg:"#331826",inputBorder:"#331826",inputText:"#ffc0e0",inputPlaceholder:"#804d66",inputPrompt:"#ff99cc",codeBg:"#140a10",codeBorder:"#aa4d7a",userMsgBg:"#331826",userMsgBorder:"#331826",userMsgText:"#ffc0e0",diffRemovalBg:"#3e0c1b",diffAdditionBg:"#1b3e2b",diffRemovalText:"#ff6699",diffAdditionText:"#66ffb3",diffRemovalHighlightColor:"#ff3377",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#33ff99",diffAdditionHighlightBg:"#00592e",diffRemovalNum:"#ff6699",diffAdditionNum:"#66ffb3",diffRemovalPrefix:"#ff3377",diffAdditionPrefix:"#33ff99",primary:"#ffc0e0",secondary:"#ff99cc",accent:"magenta",success:"#66ffb3",warning:"yellow",danger:"#ff3377",info:"#ff99cc",statusOn:"#ffc0e0",statusOff:"#804d66",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ffb3d9","#ff3399"]},{name:"Radioactive Slime",text:"#ccff00",textMuted:"#99cc00",textDim:"#669900",textInverted:"#0a0f00",border:"#ccff00",borderMuted:"#99cc00",borderDim:"#669900",bg:void 0,cardBg:"#0f1400",highlightBg:"#1a2400",activeBg:"#2a3b00",inputBg:"#1a2400",inputBorder:"#1a2400",inputText:"#ccff00",inputPlaceholder:"#669900",inputPrompt:"#cc00ff",codeBg:"#050a00",codeBorder:"#99cc00",userMsgBg:"#1a2400",userMsgBorder:"#1a2400",userMsgText:"#ccff00",diffRemovalBg:"#2a0033",diffAdditionBg:"#0f3300",diffRemovalText:"#ff00cc",diffAdditionText:"#00ff33",diffRemovalHighlightColor:"#ff33cc",diffRemovalHighlightBg:"#4d0066",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#1a6600",diffRemovalNum:"#ff00cc",diffAdditionNum:"#00ff33",diffRemovalPrefix:"#ff33cc",diffAdditionPrefix:"#33ff66",primary:"#ccff00",secondary:"#cc00ff",accent:"#ff00cc",success:"#00ff33",warning:"#ffcc00",danger:"#ff0033",info:"#00ccff",statusOn:"#ccff00",statusOff:"#669900",logoTextAnsi:"\x1B[1;38;5;190m",logoBodyAnsi:"\x1B[38;5;190m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ccff00","#cc00ff"]},{name:"Cosmic Void",text:"#f0f8ff",textMuted:"#a6aeb5",textDim:"#5e656e",textInverted:"#010103",border:"#f0f8ff",borderMuted:"#a6aeb5",borderDim:"#5e656e",bg:void 0,cardBg:"#05030d",highlightBg:"#0b081a",activeBg:"#171133",inputBg:"#0b081a",inputBorder:"#0b081a",inputText:"#f0f8ff",inputPlaceholder:"#5e656e",inputPrompt:"#ff007f",codeBg:"#020108",codeBorder:"#a6aeb5",userMsgBg:"#0b081a",userMsgBorder:"#0b081a",userMsgText:"#f0f8ff",diffRemovalBg:"#2e0a29",diffAdditionBg:"#091c33",diffRemovalText:"#ff33a6",diffAdditionText:"#33d6ff",diffRemovalHighlightColor:"#ff66c2",diffRemovalHighlightBg:"#5c1452",diffAdditionHighlightColor:"#66e0ff",diffAdditionHighlightBg:"#123866",diffRemovalNum:"#ff33a6",diffAdditionNum:"#33d6ff",diffRemovalPrefix:"#ff66c2",diffAdditionPrefix:"#66e0ff",primary:"#f0f8ff",secondary:"#ff007f",accent:"#9d00ff",success:"#33d6ff",warning:"#ffcc00",danger:"#ff0040",info:"#9d00ff",statusOn:"#f0f8ff",statusOff:"#5e656e",logoTextAnsi:"\x1B[1;38;5;231m",logoBodyAnsi:"\x1B[38;5;231m",logoMutedAnsi:"\x1B[38;5;240m",logoGradient:["#ffffff","#9d00ff"]},{name:"Magma Eruption",text:"#ff4d00",textMuted:"#cc3d00",textDim:"#802600",textInverted:"#0d0300",border:"#ff4d00",borderMuted:"#cc3d00",borderDim:"#802600",bg:void 0,cardBg:"#1a0600",highlightBg:"#260a00",activeBg:"#401100",inputBg:"#260a00",inputBorder:"#260a00",inputText:"#ff4d00",inputPlaceholder:"#802600",inputPrompt:"#ffcc00",codeBg:"#080200",codeBorder:"#cc3d00",userMsgBg:"#260a00",userMsgBorder:"#260a00",userMsgText:"#ff4d00",diffRemovalBg:"#2e0a0a",diffAdditionBg:"#1f1400",diffRemovalText:"#ff3333",diffAdditionText:"#ffaa00",diffRemovalHighlightColor:"#ff6666",diffRemovalHighlightBg:"#5c1414",diffAdditionHighlightColor:"#ffcc33",diffAdditionHighlightBg:"#3d2900",diffRemovalNum:"#ff3333",diffAdditionNum:"#ffaa00",diffRemovalPrefix:"#ff6666",diffAdditionPrefix:"#ffcc33",primary:"#ff4d00",secondary:"#ffcc00",accent:"#ff0040",success:"#ffaa00",warning:"#ffff00",danger:"#ff0000",info:"#ff8800",statusOn:"#ff4d00",statusOff:"#802600",logoTextAnsi:"\x1B[1;38;5;202m",logoBodyAnsi:"\x1B[38;5;202m",logoMutedAnsi:"\x1B[38;5;236m",logoGradient:["#ff4d00","#ff0000"]}],ho={Dark:{id:"Dark",name:"Dark (Default)",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",textExclusive:"#B5B8D9",textMutedExclusive:"#D4DEE7",border:"white",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#1e1e1e",highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:"#1a1a1a",codeBorder:"#444444",userMsgBg:"#444444",userMsgBorder:"#444444",userMsgText:"white",diffRemovalBg:"#250808",diffAdditionBg:"#072410",diffRemovalText:"#885555",diffAdditionText:"#558866",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#5a1818",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#185a25",diffRemovalNum:"#d96868",diffAdditionNum:"#68d98c",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},Light:{id:"Light",name:"Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"black",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#e5e5e5",highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:"#e8e8e8",codeBorder:"#b0b0b0",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:"#fce8e8",diffAdditionBg:"#e6f9e6",diffRemovalText:"#661111",diffAdditionText:"#115511",diffRemovalHighlightColor:"#440000",diffRemovalHighlightBg:"#f8b4b4",diffAdditionHighlightColor:"#003300",diffAdditionHighlightBg:"#a6ebad",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Dark":{id:"GitHub Dark",name:"GitHub Dark",text:"#c9d1d9",textMuted:"#8b949e",textDim:"#6e7681",textInverted:"#0d1117",border:"#30363d",borderMuted:"#30363d",borderDim:"#21262d",bg:void 0,cardBg:"#161b22",highlightBg:"#21262d",activeBg:"#30363d",inputBg:"#21262d",inputBorder:"#21262d",inputText:"#c9d1d9",inputPlaceholder:"#8b949e",inputPrompt:"#58a6ff",codeBg:"#0d1117",codeBorder:"#30363d",userMsgBg:"#21262d",userMsgBorder:"#21262d",userMsgText:"#c9d1d9",diffRemovalBg:"#3c1e1e",diffAdditionBg:"#11381e",diffRemovalText:"#f85149",diffAdditionText:"#3fb950",diffRemovalHighlightColor:"#ff7b72",diffRemovalHighlightBg:"#701c1c",diffAdditionHighlightColor:"#56d364",diffAdditionHighlightBg:"#116329",diffRemovalNum:"#f85149",diffAdditionNum:"#3fb950",diffRemovalPrefix:"#f85149",diffAdditionPrefix:"#3fb950",primary:"#c9d1d9",secondary:"#58a6ff",accent:"#bc8cff",success:"#3fb950",warning:"#d29922",danger:"#f85149",info:"#58a6ff",statusOn:"#58a6ff",statusOff:"#8b949e",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#2ea043","#56d364"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Light":{id:"GitHub Light",name:"GitHub Light",text:"#24292f",textMuted:"#57606a",textDim:"#6e7781",textInverted:"#ffffff",border:"#d0d7de",borderMuted:"#d0d7de",borderDim:"#e1e4e8",bg:void 0,cardBg:"#f6f8fa",highlightBg:"#eaeef2",activeBg:"#d0d7de",inputBg:"#eaeef2",inputBorder:"#eaeef2",inputText:"#24292f",inputPlaceholder:"#57606a",inputPrompt:"#0969da",codeBg:"#ffffff",codeBorder:"#d0d7de",userMsgBg:"#eaeef2",userMsgBorder:"#eaeef2",userMsgText:"#24292f",diffRemovalBg:"#ffebe9",diffAdditionBg:"#e6ffec",diffRemovalText:"#cf222e",diffAdditionText:"#1a7f37",diffRemovalHighlightColor:"#82071e",diffRemovalHighlightBg:"#ffc1c0",diffAdditionHighlightColor:"#116329",diffAdditionHighlightBg:"#acf2bd",diffRemovalNum:"#cf222e",diffAdditionNum:"#1a7f37",diffRemovalPrefix:"#cf222e",diffAdditionPrefix:"#1a7f37",primary:"#24292f",secondary:"#0969da",accent:"#8250df",success:"#1a7f37",warning:"#9a6700",danger:"#cf222e",info:"#0969da",statusOn:"#0969da",statusOff:"#57606a",logoTextAnsi:"\x1B[1;34m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#1a7f37","#2da44e"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Dark":{id:"Transparent Dark",name:"Transparent Dark",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:void 0,codeBorder:"gray",userMsgBg:"#555555",userMsgBorder:"#555555",userMsgText:"white",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#ff6666",diffAdditionText:"#66ff66",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#3a1414",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#143a14",diffRemovalNum:"#ff6666",diffAdditionNum:"#66ff66",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Light":{id:"Transparent Light",name:"Transparent Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:void 0,codeBorder:"gray",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#c02020",diffAdditionText:"#188028",diffRemovalHighlightColor:"#800000",diffRemovalHighlightBg:"#f5d0d0",diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:"#cceccc",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Synthwave 84":{id:"Synthwave 84",name:"Synthwave 84",text:"#fdfdfd",textMuted:"#a08eb7",textDim:"#705c8a",textInverted:"#1a1025",textExclusive:"#e3dcf0",textMutedExclusive:"#b9abc9",border:"#fc28a8",borderMuted:"#a21568",borderDim:"#5c0a3a",bg:void 0,cardBg:"#261b38",highlightBg:"#35254d",activeBg:"#4c3570",inputBg:"#35254d",inputBorder:"#35254d",inputText:"#fdfdfd",inputPlaceholder:"#a08eb7",inputPrompt:"#03e8fc",codeBg:"#1e142b",codeBorder:"#a21568",userMsgBg:"#35254d",userMsgBorder:"#35254d",userMsgText:"#fdfdfd",diffRemovalBg:"#471434",diffAdditionBg:"#144743",diffRemovalText:"#ff4081",diffAdditionText:"#00e5ff",diffRemovalHighlightColor:"#ff79a1",diffRemovalHighlightBg:"#6b1e4e",diffAdditionHighlightColor:"#66f5ff",diffAdditionHighlightBg:"#1e6b65",diffRemovalNum:"#ff4081",diffAdditionNum:"#00e5ff",diffRemovalPrefix:"#ff79a1",diffAdditionPrefix:"#66f5ff",primary:"#fdfdfd",secondary:"#03e8fc",accent:"#fc28a8",success:"#00e5ff",warning:"#ffc107",danger:"#ff4081",info:"#b388ff",statusOn:"#03e8fc",statusOff:"#a08eb7",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#fc28a8","#03e8fc"],toolFeedbackAnsi:"\x1B[38;2;3;232;252m"},"Forest Sprite":{id:"Forest Sprite",name:"Forest Sprite",text:"#d6e6d1",textMuted:"#95b38d",textDim:"#628059",textInverted:"#161c14",textExclusive:"#eaf2e8",textMutedExclusive:"#a9c7a2",border:"#74a862",borderMuted:"#477038",borderDim:"#2b4720",bg:void 0,cardBg:"#1f291c",highlightBg:"#2a3826",activeBg:"#3a4d35",inputBg:"#2a3826",inputBorder:"#2a3826",inputText:"#d6e6d1",inputPlaceholder:"#95b38d",inputPrompt:"#8feb73",codeBg:"#161e14",codeBorder:"#477038",userMsgBg:"#2a3826",userMsgBorder:"#2a3826",userMsgText:"#d6e6d1",diffRemovalBg:"#3b231c",diffAdditionBg:"#203b1c",diffRemovalText:"#db6242",diffAdditionText:"#59cc3f",diffRemovalHighlightColor:"#f0896c",diffRemovalHighlightBg:"#5c362a",diffAdditionHighlightColor:"#80e368",diffAdditionHighlightBg:"#305929",diffRemovalNum:"#db6242",diffAdditionNum:"#59cc3f",diffRemovalPrefix:"#f0896c",diffAdditionPrefix:"#80e368",primary:"#d6e6d1",secondary:"#8feb73",accent:"#e69835",success:"#59cc3f",warning:"#e69835",danger:"#db6242",info:"#73b4eb",statusOn:"#8feb73",statusOff:"#95b38d",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#8feb73","#e69835"],toolFeedbackAnsi:"\x1B[38;2;143;235;115m"},Spookfest:{id:"Spookfest",name:"Spookfest \u{1F383}",text:"#ffeedd",textMuted:"#e09858",textDim:"#a6622b",textInverted:"#0d0702",textExclusive:"#fff3e6",textMutedExclusive:"#d4a276",border:"#ff7518",borderMuted:"#994409",borderDim:"#592502",bg:void 0,cardBg:"#1a0c02",highlightBg:"#2a1403",activeBg:"#3d1d05",inputBg:"#261203",inputBorder:"#261203",inputText:"#ffeedd",inputPlaceholder:"#a6622b",inputPrompt:"#ff7518",codeBg:"#120701",codeBorder:"#592502",userMsgBg:"#261203",userMsgBorder:"#261203",userMsgText:"#ffeedd",diffRemovalBg:"#3d0a0a",diffAdditionBg:"#1a330a",diffRemovalText:"#ff5555",diffAdditionText:"#73e639",diffRemovalHighlightColor:"#ff2222",diffRemovalHighlightBg:"#590e0e",diffAdditionHighlightColor:"#88ff3b",diffAdditionHighlightBg:"#244d0a",diffRemovalNum:"#ff5555",diffAdditionNum:"#73e639",diffRemovalPrefix:"#ff3333",diffAdditionPrefix:"#88ff3b",primary:"#ff7518",secondary:"#a855f7",accent:"#22c55e",success:"#22c55e",warning:"#f59e0b",danger:"#ef4444",info:"#a855f7",statusOn:"#ff7518",statusOff:"#703a08",logoTextAnsi:"\x1B[1;38;2;255;117;24m",logoBodyAnsi:"\x1B[38;2;255;140;26m",logoMutedAnsi:"\x1B[38;2;168;85;247m",logoGradient:["#ff7518","#a855f7"],toolFeedbackAnsi:"\x1B[38;2;255;117;24m"}};var xi=null;var bi=(e="Dark")=>{let n;e==="Mystery"||e==="Chaos"?(xi||(xi=ta[Math.floor(Math.random()*ta.length)]),n={...xi,id:"Mystery"}):(xi=null,ho[e]?n=ho[e]:e==="Halloween"?n=ho.Spookfest:e==="GitHub"?n=ho["GitHub Dark"]:e==="Transparent"?n=ho["Transparent Dark"]:n=ho.Dark);let t=n.codeText||n.secondary||n.info||n.logoGradient&&n.logoGradient[0]||"cyan",i=n.toolFeedbackAnsi||"\x1B[95m";return{...n,codeText:t,toolFeedbackAnsi:i}};var Xa=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",Kc=(e=2)=>{let n=Xa();return n==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},na=new Date,Ho=na.getMonth(),jo=na.getDate(),Ja=Ho===9&&jo>=15||Ho===10&&jo<=1,ds=null;(process.env.SPOOKFEST==="true"||Ja)&&(ds=await import("./halloween-MX3VNQRW.js"));var Vc=(e="...",n="Loading...",t="Dark")=>{let i=bi(t),o=n;if(n==="c_openai"||n==="Custom (OpenAI)")try{let W=oi(ei,{})?.systemSettings?.customOpenAIBaseUrl;W&&(o=W)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,l=i.logoMutedAnsi,u="\x1B[0m",h=[" \u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2591\u2591\u2591 "],x=t==="Spookfest"||i.id==="Spookfest"||t==="Halloween"||i.id==="Halloween",m=Ho===9&&jo>=15||Ho===10&&jo<=1,f=x&&m||process.env.SPOOKFEST==="true"&&x,s=h;if(f&&ds){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:O,halloweenBat:W,halloweenArtUser:$}=ds;s=Math.random()>.9&&Ho===9&&jo>=30?W:Math.random()>.5?O:$}else process.env.HALLOWEEN_EEGG="false";let p=f?ea:Zr,k=p[Math.floor(Math.random()*p.length)],ue=i.logoGradient||["#0077ff","#ff00ff"],y=qa(ue).multiline(s.join(`
577
578
  `)).split(`
578
- `),A=L=>`${l}${L}${u}`;return`${y[0]}
579
+ `),A=O=>`${l}${O}${u}`;return`${y[0]}
579
580
  ${y[1]} ${r}Selected ${f?"Pumpkin":"Provider"}: ${o}${u}
580
581
  ${y[2]}
581
582
  ${y[3]} ${r}FluxFlow${f?": Spookfest":""} ${A("v"+e)}${u}
@@ -583,39 +584,40 @@ ${y[4]}
583
584
  ${y[5]} ${d}See /help for additional commands.${u}
584
585
  ${y[6]} ${A(k)}
585
586
  ${y[7]}
586
- `};import{structuredPatch as tl}from"diff";import fs from"path";import Ja from"fs";var Qa=e=>{try{return Ja.readdirSync(e,{withFileTypes:!0})}catch{return[]}},us=(e,n=4,t=1,i=Qa,o=[],r=null)=>{let d=r||i(e),l=" ".repeat(t-1),u=t===1?new Set([..._o,...o,...vo(e),...vo(process.cwd())]):o instanceof Set?o:new Set([..._o,...o]),h=$=>u.has($),x=d.filter($=>!h($.name)),m=d.filter($=>h($.name)).length,f=x.filter($=>!$.isDirectory()).map($=>$.name).sort(),s=x.filter($=>$.isDirectory()).sort(($,T)=>$.name.localeCompare(T.name)),p=$=>{let T=$.length;if(T===0)return"no files";let we=Array.from(new Set($.map(Me=>{let Ze=typeof Me=="string"?Me:Me.name;return fs.extname(Ze).slice(1)}).filter(Boolean))).sort(),_e="*";return we.length===1?_e=`*.${we[0]}`:we.length>1&&(_e=`*.{${we.join(", ")}}`),T===1?_e:`${_e} ${T} files`},k="";if(t===1){let $=f.join(", "),T=m>0?` [${m} ignored]`:"";($||T)&&(k+=`${l}${$?$+(T?`${T}`:""):T.trim()}
587
+ `};import{structuredPatch as nl}from"diff";import fs from"path";import Qa from"fs";var Za=e=>{try{return Qa.readdirSync(e,{withFileTypes:!0})}catch{return[]}},us=(e,n=4,t=1,i=Za,o=[],r=null)=>{let d=r||i(e),l=" ".repeat(t-1),u=t===1?new Set([...Eo,...o,..._o(e),..._o(process.cwd())]):o instanceof Set?o:new Set([...Eo,...o]),h=$=>u.has($),x=d.filter($=>!h($.name)),m=d.filter($=>h($.name)).length,f=x.filter($=>!$.isDirectory()).map($=>$.name).sort(),s=x.filter($=>$.isDirectory()).sort(($,T)=>$.name.localeCompare(T.name)),p=$=>{let T=$.length;if(T===0)return"no files";let Se=Array.from(new Set($.map(Pe=>{let Ze=typeof Pe=="string"?Pe:Pe.name;return fs.extname(Ze).slice(1)}).filter(Boolean))).sort(),ve="*";return Se.length===1?ve=`*.${Se[0]}`:Se.length>1&&(ve=`*.{${Se.join(", ")}}`),T===1?ve:`${ve} ${T} files`},k="";if(t===1){let $=f.join(", "),T=m>0?` [${m} ignored]`:"";($||T)&&(k+=`${l}${$?$+(T?`${T}`:""):T.trim()}
587
588
  `)}else f.length>0&&(k+=`${l}[${p(f)}]
588
- `);let ue=10,y=s.slice(0,ue),A=s.length>ue,L=[],W=[];for(let $ of y){let T=fs.join(e,$.name),we=$.name,_e=t,Me=i(T),Ze=Me.filter(Le=>!h(Le.name)),H=Ze.filter(Le=>Le.isDirectory()),b=Ze.filter(Le=>!Le.isDirectory());for(;b.length===0&&H.length===1&&_e<n;)we=`${we}/${H[0].name}`,T=fs.join(T,H[0].name),_e++,Me=i(T),Ze=Me.filter(Le=>!h(Le.name)),H=Ze.filter(Le=>Le.isDirectory()),b=Ze.filter(Le=>!Le.isDirectory());let Tt=H.length>0;if(Tt&&_e<n)W.push({displayName:we,subDirPath:T,subEntries:Me,nextDepth:_e+1});else{let Le=p(b),Et=Tt&&_e>=n?" ...max scan depth":"";L.push(`${we}/${Le}${Et}`)}}L.length>0&&(k+=`${l}${L.join(", ")}
589
- `);for(let{displayName:$,subDirPath:T,subEntries:we,nextDepth:_e}of W)k+=`${l}${$}/
590
- `,k+=us(T,n,_e,i,u,we);return A&&(k+=`${l}...max scan width, ReadFolder if needed
591
- `),k};import gs from"path";import Za from"fs";var el=e=>{try{return Za.readdirSync(e,{withFileTypes:!0})}catch{return[]}},ms=(e,n,t="",i=1,o=el,r=[])=>{let d=o(e),l=gs.sep;if(d.length>100)return`${t}\u2514\u2500\u2500 ${gs.basename(e)}${l} ...100+ files...
589
+ `);let ue=10,y=s.slice(0,ue),A=s.length>ue,O=[],W=[];for(let $ of y){let T=fs.join(e,$.name),Se=$.name,ve=t,Pe=i(T),Ze=Pe.filter($e=>!h($e.name)),H=Ze.filter($e=>$e.isDirectory()),b=Ze.filter($e=>!$e.isDirectory());for(;b.length===0&&H.length===1&&ve<n;)Se=`${Se}/${H[0].name}`,T=fs.join(T,H[0].name),ve++,Pe=i(T),Ze=Pe.filter($e=>!h($e.name)),H=Ze.filter($e=>$e.isDirectory()),b=Ze.filter($e=>!$e.isDirectory());let At=H.length>0;if(At&&ve<n)W.push({displayName:Se,subDirPath:T,subEntries:Pe,nextDepth:ve+1});else{let $e=p(b),_t=At&&ve>=n?" ...max scan depth":"";O.push(`${Se}/${$e}${_t}`)}}O.length>0&&(k+=`${l}${O.join(", ")}
590
+ `);for(let{displayName:$,subDirPath:T,subEntries:Se,nextDepth:ve}of W)k+=`${l}${$}/
591
+ `,k+=us(T,n,ve,i,u,Se);return A&&(k+=`${l}...max scan width, ReadFolder if needed
592
+ `),k};import gs from"path";import el from"fs";var tl=e=>{try{return el.readdirSync(e,{withFileTypes:!0})}catch{return[]}},ms=(e,n,t="",i=1,o=tl,r=[])=>{let d=o(e),l=gs.sep;if(d.length>100)return`${t}\u2514\u2500\u2500 ${gs.basename(e)}${l} ...100+ files...
592
593
  `;let u="",h=r,x=d.filter(s=>!h.includes(s.name)&&!s.name.startsWith(".")),m=d.filter(s=>h.includes(s.name)||s.name.startsWith(".")).map(s=>s.name).sort();x.sort((s,p)=>s.isDirectory()&&!p.isDirectory()?-1:!s.isDirectory()&&p.isDirectory()?1:s.name.localeCompare(p.name));let f=[...x.map(s=>({name:s.name,isDir:s.isDirectory()})),...m.map(s=>({name:s,isDir:!0,isCollapsed:!0}))];return f.forEach((s,p)=>{let k=p===f.length-1,ue=gs.join(e,s.name),y=k?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",A=t+(k?" ":"\u2502 ");if(s.isCollapsed){u+=`${t}${y}${s.name}${l}...
593
594
  `;return}s.isDir?i>n?u+=`${t}${y}${s.name}${l} ...depth exceeded...
594
595
  `:o(ue).length>80?u+=`${t}${y}${s.name}${l} ...80+ files...
595
596
  `:(u+=`${t}${y}${s.name}${l}
596
597
  `,u+=ms(ue,n,A,i+1,o,r)):u+=`${t}${y}${s.name}
597
- `}),u};var nl={Ollama:()=>import("./ollama-NWY2XLYF.js").then(e=>e.getOllamaStream),OpenRouter:()=>import("./openrouter-6MRG4RT6.js").then(e=>e.getOpenRouterStream),DeepSeek:()=>import("./deepseek-WNWZJTNE.js").then(e=>e.getDeepSeekStream),Mistral:()=>import("./mistral-YTTOZB2J.js").then(e=>e.getMistralStream),NVIDIA:()=>import("./nvidia-ON4Q6Q26.js").then(e=>e.getNVIDIAStream),NVIDIA_wrap:()=>import("./nvidia-ON4Q6Q26.js").then(e=>e.wrapNvidiaStreamWithQueueDepth),InferX:()=>import("./inferx-HP5AGET3.js").then(e=>e.getInferXStream),SenseNova:()=>import("./sensenova-3K44URJQ.js").then(e=>e.getSenseNovaStream),AIHubMix:()=>import("./aihubmix-TETL5QYQ.js").then(e=>e.getAIHubMixStream),Poolside:()=>import("./poolside-ODFAIK4C.js").then(e=>e.getPoolsideStream),NineRouter:()=>import("./9router-LRFKCJF4.js").then(e=>e.getNineRouterStream),ExpLabs:()=>import("./explabs-XHHXTERB.js").then(e=>e.getExpLabsStream),TokenHarbor:()=>import("./tokenharbor-YV2GV2LM.js").then(e=>e.getTokenHarborStream),Infron:()=>import("./infron-ULXG7VDA.js").then(e=>e.getInfronStream),APInex:()=>import("./apinex-FAYOPQSL.js").then(e=>e.getAPInexStream),xKiro:()=>import("./xkiro-B2LYGZTF.js").then(e=>e.getXKiroStream),c_openai:()=>import("./custom_openai-HY6EEQI2.js").then(e=>e.getCustomOpenAIStream)},hs={},re=async e=>(hs[e]||(hs[e]=await nl[e]()),hs[e]),ol=/```[\s\S]*?```/g,il=/```[\s\S]*$/g,sl=/`[^`]+`/g,rl=/^\|.*\|$/gm,al=/^[^\w]+|[^\w]+$/g,ll=/[^a-z0-9]/gi,Vo=/\[\s*(?:tool|action):(?:functions\.)?([a-z0-9_]+)\s*\(/gi,cl=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-z0-9_]+)\s*\(/gi,dl=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,$n=/["']/g,oa=/\\/g,fl=/<\|channel>thought/gi,ul=/<channel\|>/gi,gl=e=>typeof e!="string"?e:e.replace(fl,"<think_fluxflow>").replace(ul,"</think_fluxflow>"),Ld=/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\]|$)/i,ml=(e,n,t=1)=>{let i=n>0?e[n-1]:"",o=n+t<e.length?e[n+t]:"";return i==="`"&&o==="`"},pl=e=>{let n=/(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\])/gi,t;for(;(t=n.exec(e))!==null;)if(!ml(e,t.index,t[0].length))return{index:t.index,length:t[0].length};return{index:-1,length:0}},ys=e=>{if(!e||typeof e!="string")return null;let n=e.match(/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])/i);if(!n)return null;let t=n.index+n[0].length,i=e.substring(t),o=pl(i);if(o.index!==-1){let r=t+o.index+o.length;return{fullBlock:e.substring(0,r),innerContent:i.substring(0,o.index),remainingText:e.substring(r)}}return{fullBlock:e,innerContent:i,remainingText:""}},Ft=e=>{if(!e||typeof e!="string")return e;let n=ys(e);return n?n.remainingText.trimStart():e};var ia=/<\|\s*tool_call_begin\s*\|>\s*(?:(?:tool|functions)\b[\s._]*)*([a-zA-Z0-9_]+)(?::\d+)?\s*<\|\s*tool_call_argument_begin\s*\|>([\s\S]*?)<\|\s*tool_call_end\s*\|>/gi,hl=/"([^"]+)"\s*:\s*(?:"([^"]*)"|(\d+)|true|false|null)/g,sa=/<\|\s*tool_calls_section_begin\s*\|>/gi,ra=/<\|\s*tool_calls_section_end\s*\|>/gi,yl=/```(?:tool|action|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi;var wi=e=>!e||typeof e!="string"?e:e.replace(/(```[\s\S]*?```|`[^`]*`)|(<(?:\w+)(?:[^>]*)>\r?\n?|\r?\n?<\/\w+(?:[^>]*)>)/gi,(n,t)=>t||""),da=e=>{if(!e||typeof e!="string")return e;let n=Gn(e);if(!n||n.length===0)return e;let t=n[n.length-1];if(!t.fullMatch)return e;let i=e.lastIndexOf(t.fullMatch);if(i===-1)return e;let o=i+t.fullMatch.length,r=e.substring(o);return/\[\s*(?:tool|action):/i.test(r)?e.trimEnd():e.substring(0,o).trimEnd()},bs=null,Yo={},io={key:null,value:null},zt=e=>{if(!e)return e;let n=Yo?.theme;if(!n)try{n=oi(ei,{})?.systemSettings?.theme}catch{}let i=bi(n||"Dark").toolFeedbackAnsi||"\x1B[95m";return e.replace(/(?:(\x1b\[\d+m))?([✔✘✖🔍📖→➕↻↷•🛇])(?:(\x1b\[\d+m))?\s*\b(Clicked Screen|Clicked|Located|Dragged|Scrolled|Typed|Entered|Pressed Key|Recaptured Screen|Created|Read Skill|Read Documentation|Executed|Searched Documentation|Read|Edited|Viewed|Processed|Auto-Read|Skipped|List|Generated|Written|Searched|AI Search|Get Map|Write Canceled|Resolved Sub-Agent Query|Edit Canceled|Write Cancelled|Edit Denied|Visited|Updated|Reviewed|Delegated|Background|Checked|Indexed|Analyzed|Browsed|Elevating SubAgent|Checking SubAgent Work|Started Generalist|Called Generalist|Steered|Unsupported Modality|Awaiting|Cancelled|Aligning Moon Phase|Contemplating Existence|Staring At Void|Rollback Point Checked|Emergency Rollback Failed|Emergency Rollback|Delaying Professionally|Negotiating With Electrons|Touching Grass (virtually)|Panicking Softly|Rethinking Career Choices|Loading Cat Videos|Giving Up Entirely|Summoning Braincell #2|Pretending To Be Busy|Waiting For Motivation DLC|Rotating Internal Screaming|Downloading More RAM|Feeding The Hamsters|Gaslighting Scheduler|Performing Dramatic Pause|Buffering Social Energy|Calculating Regret|Reading Terms And Conditions|Becoming Sentient Briefly|Model produced malformed tool call|Loop Detected|Contacting Ancestors)\b/ig,(o,r,d,l,u)=>`${r||""}${d}${l||""} ${i}${u}\x1B[0m`)},xl=async(e,n=8,t=1e3,i=8e3,o=null)=>{let r=0;for(;;){if(o?.aborted)throw new DOMException("The user aborted a request.","AbortError");try{return await e()}catch(d){if(o?.aborted||d?.name==="AbortError"||d?.message==="Subagent task was cancelled."||(r++,r>=n))throw d;let l=Math.min(t*Math.pow(2,r-1),i);await new Promise((u,h)=>{let x=setTimeout(u,l);o&&o.addEventListener("abort",()=>{clearTimeout(x),h(new DOMException("The user aborted a request.","AbortError"))})})}}},kt=!1;var bl=e=>{let n=e.filter(o=>(o.role==="user"||o.role==="agent"||o.role==="system")&&o.role!=="think"&&!o.isVisualFeedback&&!o.isMeta&&!o.isTerminalRecord&&!(o.text&&o.text.includes("[TERMINAL_RECORD]"))&&!String(o.id).startsWith("welcome")).map((o,r,d)=>{let l=o.fullText||o.text||"";if(o.role==="user"&&r<d.length-1)if(l.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")){let u=l.indexOf("**CONTEXT SUMMARY OF PREVIOUS TURNS");if(u!==-1){let x=l.substring(0,u).lastIndexOf("[SYSTEM METADATA]");x!==-1?l=l.substring(x).trim():l=l.substring(u).trim()}}else{let u=l.lastIndexOf("[USER]"),h=l.lastIndexOf("[USER PROMPT]");u!==-1?l=l.substring(u+6).trim():h!==-1&&(l=l.substring(h).trim())}return{...o,text:l}}),t=[],i=0;for(;i<n.length;){let o=n[i];if(o.role==="user")t.push(o),i++;else{let r=[];for(;i<n.length&&n[i].role!=="user";)r.push(n[i]),i++;let d=[],l=[],u=!1,h=()=>{d.length>0&&(t.push({role:"agent",text:"combined"}),d=[]),l.length>0&&(t.push({role:"system",text:"combined"}),l=[]),u=!1};r.forEach(x=>{let m=x.role==="system"&&(x.text?.startsWith("[ACTION RESULT]")||x.text?.startsWith("[TOOL RESULT]")||x.text?.startsWith("SUCCESS:")||x.text?.startsWith("ERROR:")||x.fullText?.startsWith("[ACTION RESULT]")||x.fullText?.startsWith("[TOOL RESULT]")||x.fullText?.startsWith("SUCCESS:")||x.fullText?.startsWith("ERROR:")),f=x.fullText||x.text||"",s=f.trim();if(!(!s&&!x.binaryPart)){if(m)l.push(s);else if(x.role==="agent"){!u&&l.length>0&&h();let p=f.endsWith(`
598
- `),k=s.toLowerCase().includes("tool:")||s.toLowerCase().includes("action:");d.push(s),k&&p?u=!0:u=!1}}}),h()}}return t.length},wl=e=>typeof e!="string"?e:e.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),$d=()=>{kt=!0},Nd=()=>kt,xs={write_file:"Writing",update_file:"Editing",read_folder:"Reading",view_file:"Reading",exec_command:"Executing Command",web_search:"Searching",web_scrape:"Reading",memory:"Updating Memory",search_keyword:"Searching",find_file:"Finding File",findFile:"Finding File",FindFile:"Finding File",file_map:"Generating Map",ask:"User Input",write_pdf:"Creating",write_docx:"Creating",generate_image:"Generating",todo:"Planning",Todo:"Planning",goal:"Planning",Goal:"Planning",invoke_sync:"Sub-Agent Working",invoke:"Starting Agent",get_progress:"Checking Progress",cancel:"Cancelling",await:"Waiting",wait:"Waiting",EmergencyRollback:"Don't Panic. Lookin' into it",answer:"Answering Sub-Agent",Answer:"Answering Sub-Agent",steer:"Steering Sub-Agent",Steer:"Steering Sub-Agent",Click:"Clicking",click:"Clicking",Drag:"Dragging",drag:"Dragging",Scroll:"Scrolling",scroll:"Scrolling",KeyboardTyping:"Typing",keyboard_typing:"Typing",KeyPress:"Pressing Key",key_press:"Pressing Key",RecaptureScreen:"Recapturing Screen",recapture_screen:"Recapturing Screen"},so=(e,n)=>{try{let t=B(n),i=e.toLowerCase().replace(/_/g,"");if(i==="invokesync"||i==="invoke")return t.title||(t.task?t.task.substring(0,30):null);if(i==="getprogress"||i==="cancel"||i==="steer"||i==="steersubagent")return t.id||t.taskId;let o=t.name||t.path||t.targetFile||t.TargetFile||t.directory||t.file||t.query;return o?U.basename(o.replace(/["']/g,"").replace(/\\/g,"/")):null}catch{return null}},ws=e=>e?new ca({apiKey:e}):bs,Dd=async(e,n,t,i,o={})=>{let{onStatus:l,onMemoryUpdated:u,onBackgroundIncrement:h}=o,{profile:x,thinkingLevel:m,mode:f,janitorModel:s,chatId:p,systemSettings:k,sessionStats:ue,aiProvider:y="Google",apiKey:A}=e,L=process.env.NVIDIA_BASE_URL||y==="Ollama"||y==="InferX"||y==="SenseNova"||y==="AIHubMix"||y==="Poolside"||y==="9router"||y==="ExpLabs"||y==="ExperientialLabs"||y==="c_openai"||y==="Custom (OpenAI)"?!1:k?.memory!==!1,$=Lt(no,[]).map(de=>`- [${de.id}]: ${de.memory}`).join(`
599
- `),T=i.slice(0,-1).filter(de=>de.text&&!de.text.includes("[ACTION RESULT]")&&!de.text.includes("[TOOL RESULT]")&&!de.text.includes("OBSERVATION:")&&!de.text.startsWith("[TERMINAL_RECORD]")&&!de.isTerminalRecord&&!de.isMeta&&!de.isLogo&&!String(de.id).startsWith("welcome")&&!String(de.id).startsWith("logo")).slice(-14).map(de=>{let Ue=Ft(wl(de.text)).replace(/\[(?:tool|action):(?:functions\.)?.*?\]/g,"").replace(/\[Prompted on:.*?\]/g,"").replace(/\[METADATA \(PRIORITY: DYNAMIC\)\] Time: ([^|\n]+)/g,(Ut,M)=>`[METADATA (PRIORITY: DYNAMIC)] Time: ${M.replace(/:\d{2}/g,"")}`).replace(/\[\[\s*turn\s*:\s*(continue|finish)\s*\]\]/gi,"").replace(/\[\[END\]\]/g,"").replace(/\[\[(?:TOOL|ACTION) RESULTS\]\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULTS?\]/gi,"").replace(/\[(?:tool|action) results\]/gi,"").replace(/\r?\n\r?\n/g,`
598
+ `}),u};var ol={Ollama:()=>import("./ollama-DIFOZ4PM.js").then(e=>e.getOllamaStream),OpenRouter:()=>import("./openrouter-6MRG4RT6.js").then(e=>e.getOpenRouterStream),DeepSeek:()=>import("./deepseek-WNWZJTNE.js").then(e=>e.getDeepSeekStream),Mistral:()=>import("./mistral-YTTOZB2J.js").then(e=>e.getMistralStream),NVIDIA:()=>import("./nvidia-ON4Q6Q26.js").then(e=>e.getNVIDIAStream),NVIDIA_wrap:()=>import("./nvidia-ON4Q6Q26.js").then(e=>e.wrapNvidiaStreamWithQueueDepth),InferX:()=>import("./inferx-HP5AGET3.js").then(e=>e.getInferXStream),SenseNova:()=>import("./sensenova-3K44URJQ.js").then(e=>e.getSenseNovaStream),AIHubMix:()=>import("./aihubmix-TETL5QYQ.js").then(e=>e.getAIHubMixStream),Poolside:()=>import("./poolside-ODFAIK4C.js").then(e=>e.getPoolsideStream),NineRouter:()=>import("./9router-LRFKCJF4.js").then(e=>e.getNineRouterStream),ExpLabs:()=>import("./explabs-XHHXTERB.js").then(e=>e.getExpLabsStream),TokenHarbor:()=>import("./tokenharbor-YV2GV2LM.js").then(e=>e.getTokenHarborStream),Infron:()=>import("./infron-ULXG7VDA.js").then(e=>e.getInfronStream),APInex:()=>import("./apinex-FAYOPQSL.js").then(e=>e.getAPInexStream),xKiro:()=>import("./xkiro-B2LYGZTF.js").then(e=>e.getXKiroStream),c_openai:()=>import("./custom_openai-BLC4CWOL.js").then(e=>e.getCustomOpenAIStream)},hs={},re=async e=>(hs[e]||(hs[e]=await ol[e]()),hs[e]),il=/```[\s\S]*?```/g,sl=/```[\s\S]*$/g,rl=/`[^`]+`/g,al=/^\|.*\|$/gm,ll=/^[^\w]+|[^\w]+$/g,cl=/[^a-z0-9]/gi,Ko=/\[\s*(?:tool|action):(?:functions\.)?([a-z0-9_]+)\s*\(/gi,dl=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-z0-9_]+)\s*\(/gi,fl=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,Dn=/["']/g,oa=/\\/g,ul=/<\|channel>thought/gi,gl=/<channel\|>/gi,ml=e=>typeof e!="string"?e:e.replace(ul,"<think_fluxflow>").replace(gl,"</think_fluxflow>"),$d=/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\]|$)/i,pl=(e,n,t=1)=>{let i=n>0?e[n-1]:"",o=n+t<e.length?e[n+t]:"";return i==="`"&&o==="`"},hl=e=>{let n=/(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\])/gi,t;for(;(t=n.exec(e))!==null;)if(!pl(e,t.index,t[0].length))return{index:t.index,length:t[0].length};return{index:-1,length:0}},ys=e=>{if(!e||typeof e!="string")return null;let n=e.match(/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])/i);if(!n)return null;let t=n.index+n[0].length,i=e.substring(t),o=hl(i);if(o.index!==-1){let r=t+o.index+o.length;return{fullBlock:e.substring(0,r),innerContent:i.substring(0,o.index),remainingText:e.substring(r)}}return{fullBlock:e,innerContent:i,remainingText:""}},Ft=e=>{if(!e||typeof e!="string")return e;let n=ys(e);return n?n.remainingText.trimStart():e};var ia=/<\|\s*tool_call_begin\s*\|>\s*(?:(?:tool|functions)\b[\s._]*)*([a-zA-Z0-9_]+)(?::\d+)?\s*<\|\s*tool_call_argument_begin\s*\|>([\s\S]*?)<\|\s*tool_call_end\s*\|>/gi,yl=/"([^"]+)"\s*:\s*(?:"([^"]*)"|(\d+)|true|false|null)/g,sa=/<\|\s*tool_calls_section_begin\s*\|>/gi,ra=/<\|\s*tool_calls_section_end\s*\|>/gi,xl=/```(?:tool|action|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi;var wi=e=>!e||typeof e!="string"?e:e.replace(/(```[\s\S]*?```|`[^`]*`)|(<(?:\w+)(?:[^>]*)>\r?\n?|\r?\n?<\/\w+(?:[^>]*)>)/gi,(n,t)=>t||""),fa=e=>{if(!e||typeof e!="string")return e;let n=Cn(e);if(!n||n.length===0)return e;let t=n[n.length-1];if(!t.fullMatch)return e;let i=e.lastIndexOf(t.fullMatch);if(i===-1)return e;let o=i+t.fullMatch.length,r=e.substring(o);return/\[\s*(?:tool|action):/i.test(r)?e.trimEnd():e.substring(0,o).trimEnd()},bs=null,Vo={},io={key:null,value:null},Yt=e=>{if(!e)return e;let n=Vo?.theme;if(!n)try{n=oi(ei,{})?.systemSettings?.theme}catch{}let i=bi(n||"Dark").toolFeedbackAnsi||"\x1B[95m";return e.replace(/(?:(\x1b\[\d+m))?([✔✘✖🔍📖→➕↻↷•🛇])(?:(\x1b\[\d+m))?\s*\b(Clicked Screen|Clicked|Located|Dragged|Scrolled|Typed|Entered|Pressed Key|Recaptured Screen|Created|Read Skill|Read Documentation|Executed|Searched Documentation|Read|Edited|Viewed|Processed|Auto-Read|Skipped|List|Generated|Written|Searched|AI Search|Get Map|Write Canceled|Resolved Sub-Agent Query|Edit Canceled|Write Cancelled|Edit Denied|Visited|Updated|Reviewed|Delegated|Background|Checked|Indexed|Analyzed|Browsed|Elevating SubAgent|Checking SubAgent Work|Started Generalist|Called Generalist|Steered|Unsupported Modality|Awaiting|Cancelled|Aligning Moon Phase|Contemplating Existence|Staring At Void|Rollback Point Checked|Emergency Rollback Failed|Emergency Rollback|Delaying Professionally|Negotiating With Electrons|Touching Grass (virtually)|Panicking Softly|Rethinking Career Choices|Loading Cat Videos|Giving Up Entirely|Summoning Braincell #2|Pretending To Be Busy|Waiting For Motivation DLC|Rotating Internal Screaming|Downloading More RAM|Feeding The Hamsters|Gaslighting Scheduler|Performing Dramatic Pause|Buffering Social Energy|Calculating Regret|Reading Terms And Conditions|Becoming Sentient Briefly|Model produced malformed tool call|Loop Detected|Contacting Ancestors)\b/ig,(o,r,d,l,u)=>`${r||""}${d}${l||""} ${i}${u}\x1B[0m`)},bl=async(e,n=8,t=1e3,i=8e3,o=null)=>{let r=0;for(;;){if(o?.aborted)throw new DOMException("The user aborted a request.","AbortError");try{return await e()}catch(d){if(o?.aborted||d?.name==="AbortError"||d?.message==="Subagent task was cancelled."||(r++,r>=n))throw d;let l=Math.min(t*Math.pow(2,r-1),i);await new Promise((u,h)=>{let x=setTimeout(u,l);o&&o.addEventListener("abort",()=>{clearTimeout(x),h(new DOMException("The user aborted a request.","AbortError"))})})}}},Tt=!1;var wl=e=>{let n=e.filter(o=>(o.role==="user"||o.role==="agent"||o.role==="system")&&o.role!=="think"&&!o.isVisualFeedback&&!o.isMeta&&!o.isTerminalRecord&&!(o.text&&o.text.includes("[TERMINAL_RECORD]"))&&!String(o.id).startsWith("welcome")).map((o,r,d)=>{let l=o.fullText||o.text||"";if(o.role==="user"&&r<d.length-1)if(l.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")){let u=l.indexOf("**CONTEXT SUMMARY OF PREVIOUS TURNS");if(u!==-1){let x=l.substring(0,u).lastIndexOf("[SYSTEM METADATA]");x!==-1?l=l.substring(x).trim():l=l.substring(u).trim()}}else{let u=l.lastIndexOf("[USER]"),h=l.lastIndexOf("[USER PROMPT]");u!==-1?l=l.substring(u+6).trim():h!==-1&&(l=l.substring(h).trim())}return{...o,text:l}}),t=[],i=0;for(;i<n.length;){let o=n[i];if(o.role==="user")t.push(o),i++;else{let r=[];for(;i<n.length&&n[i].role!=="user";)r.push(n[i]),i++;let d=[],l=[],u=!1,h=()=>{d.length>0&&(t.push({role:"agent",text:"combined"}),d=[]),l.length>0&&(t.push({role:"system",text:"combined"}),l=[]),u=!1};r.forEach(x=>{let m=x.role==="system"&&(x.text?.startsWith("[ACTION RESULT]")||x.text?.startsWith("[TOOL RESULT]")||x.text?.startsWith("SUCCESS:")||x.text?.startsWith("ERROR:")||x.fullText?.startsWith("[ACTION RESULT]")||x.fullText?.startsWith("[TOOL RESULT]")||x.fullText?.startsWith("SUCCESS:")||x.fullText?.startsWith("ERROR:")),f=x.fullText||x.text||"",s=f.trim();if(!(!s&&!x.binaryPart)){if(m)l.push(s);else if(x.role==="agent"){!u&&l.length>0&&h();let p=f.endsWith(`
599
+ `),k=s.toLowerCase().includes("tool:")||s.toLowerCase().includes("action:");d.push(s),k&&p?u=!0:u=!1}}}),h()}}return t.length},Sl=e=>typeof e!="string"?e:e.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),Nd=()=>{Tt=!0},Dd=()=>Tt,xs={write_file:"Writing",update_file:"Editing",read_folder:"Reading",view_file:"Reading",exec_command:"Executing Command",web_search:"Searching",web_scrape:"Reading",memory:"Updating Memory",search_keyword:"Searching",find_file:"Finding File",findFile:"Finding File",FindFile:"Finding File",file_map:"Generating Map",ask:"User Input",write_pdf:"Creating",write_docx:"Creating",generate_image:"Generating",todo:"Planning",Todo:"Planning",goal:"Planning",Goal:"Planning",invoke_sync:"Sub-Agent Working",invoke:"Starting Agent",get_progress:"Checking Progress",cancel:"Cancelling",await:"Waiting",wait:"Waiting",EmergencyRollback:"Don't Panic. Lookin' into it",answer:"Answering Sub-Agent",Answer:"Answering Sub-Agent",steer:"Steering Sub-Agent",Steer:"Steering Sub-Agent",Click:"Clicking",click:"Clicking",Drag:"Dragging",drag:"Dragging",Scroll:"Scrolling",scroll:"Scrolling",KeyboardTyping:"Typing",keyboard_typing:"Typing",KeyPress:"Pressing Key",key_press:"Pressing Key",RecaptureScreen:"Recapturing Screen",recapture_screen:"Recapturing Screen"},so=(e,n)=>{try{let t=B(n),i=e.toLowerCase().replace(/_/g,"");if(i==="invokesync"||i==="invoke")return t.title||(t.task?t.task.substring(0,30):null);if(i==="getprogress"||i==="cancel"||i==="steer"||i==="steersubagent")return t.id||t.taskId;let o=t.name||t.path||t.targetFile||t.TargetFile||t.directory||t.file||t.query;return o?U.basename(o.replace(/["']/g,"").replace(/\\/g,"/")):null}catch{return null}},ws=e=>e?new da({apiKey:e}):bs,Fd=async(e,n,t,i,o={})=>{let{onStatus:l,onMemoryUpdated:u,onBackgroundIncrement:h}=o,{profile:x,thinkingLevel:m,mode:f,janitorModel:s,chatId:p,systemSettings:k,sessionStats:ue,aiProvider:y="Google",apiKey:A}=e,O=process.env.NVIDIA_BASE_URL||y==="Ollama"||y==="InferX"||y==="SenseNova"||y==="AIHubMix"||y==="Poolside"||y==="9router"||y==="ExpLabs"||y==="ExperientialLabs"||y==="c_openai"||y==="Custom (OpenAI)"?!1:k?.memory!==!1,$=$t(no,[]).map(de=>`- [${de.id}]: ${de.memory}`).join(`
600
+ `),T=i.slice(0,-1).filter(de=>de.text&&!de.text.includes("[ACTION RESULT]")&&!de.text.includes("[TOOL RESULT]")&&!de.text.includes("OBSERVATION:")&&!de.text.startsWith("[TERMINAL_RECORD]")&&!de.isTerminalRecord&&!de.isMeta&&!de.isLogo&&!String(de.id).startsWith("welcome")&&!String(de.id).startsWith("logo")).slice(-14).map(de=>{let Ue=Ft(Sl(de.text)).replace(/\[(?:tool|action):(?:functions\.)?.*?\]/g,"").replace(/\[Prompted on:.*?\]/g,"").replace(/\[METADATA \(PRIORITY: DYNAMIC\)\] Time: ([^|\n]+)/g,(Ut,I)=>`[METADATA (PRIORITY: DYNAMIC)] Time: ${I.replace(/:\d{2}/g,"")}`).replace(/\[\[\s*turn\s*:\s*(continue|finish)\s*\]\]/gi,"").replace(/\[\[END\]\]/g,"").replace(/\[\[(?:TOOL|ACTION) RESULTS\]\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULTS?\]/gi,"").replace(/\[(?:tool|action) results\]/gi,"").replace(/\r?\n\r?\n/g,`
600
601
  `).replace(/\n\n/g,`
601
- `).replace(/\\n\\n/g,"").trim(),ze=de.role==="user"?8192:32768,N=Ue.substring(0,ze);Ue.length>ze&&(N+=`
602
- ... (truncated) ...`);let nn=de.role==="user"?N.startsWith("[USER]")?"":"[USER]: ":N.startsWith("[AGENT]")?"":"[AGENT]: ";return{role:de.role==="user"?"user":"model",parts:[{text:`${nn}${N}`}]}}),we=i.filter(de=>de.role==="user").length===1,_e=n.includes("[TITLE-UPDATE]"),Me=Math.random()<.8,Ze=we||_e||Me,H=Ft(t).trim(),b=Mr($,L,Ze),Tt=`${H.replace(/\[(?:tool|action):(?:functions\.)?.*?\]/g,"").replace(/\[Prompted on:.*?\]/g,"").replace(/\[\[\s*turn\s*:\s*(continue|finish)\s*\]\]/gi,"").replace(/\[\[END\]\]/g,"").replace(/\[\[(?:TOOL|ACTION) RESULTS\]\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULTS?\]/gi,"").replace(/\[(?:tool|action) results\]/gi,"").substring(0,32768)}`;Tt.length>32768&&(Tt+=`
603
- ... (truncated) ...`);let Le=n.replace(/\[Prompted on:.*?\]/g,"").trim();Tt=Tt.replace(/\r?\n\r?\n/g,`
602
+ `).replace(/\\n\\n/g,"").trim(),qe=de.role==="user"?8192:32768,N=Ue.substring(0,qe);Ue.length>qe&&(N+=`
603
+ ... (truncated) ...`);let tn=de.role==="user"?N.startsWith("[USER]")?"":"[USER]: ":N.startsWith("[AGENT]")?"":"[AGENT]: ";return{role:de.role==="user"?"user":"model",parts:[{text:`${tn}${N}`}]}}),Se=i.filter(de=>de.role==="user").length===1,ve=n.includes("[TITLE-UPDATE]"),Pe=Math.random()<.8,Ze=Se||ve||Pe,H=Ft(t).trim(),b=Mr($,O,Ze),At=`${H.replace(/\[(?:tool|action):(?:functions\.)?.*?\]/g,"").replace(/\[Prompted on:.*?\]/g,"").replace(/\[\[\s*turn\s*:\s*(continue|finish)\s*\]\]/gi,"").replace(/\[\[END\]\]/g,"").replace(/\[\[(?:TOOL|ACTION) RESULTS\]\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULTS?\]/gi,"").replace(/\[(?:tool|action) results\]/gi,"").substring(0,32768)}`;At.length>32768&&(At+=`
604
+ ... (truncated) ...`);let $e=n.replace(/\[Prompted on:.*?\]/g,"").trim();At=At.replace(/\r?\n\r?\n/g,`
604
605
  `).replace(/\n\n/g,`
605
- `).replace(/\\n\\n/g,"").trim();let Et=new Date,ce=`[METADATA] Current date and Time: ${`${Et.getFullYear()}-${Et.toLocaleString("en-US",{month:"short"}).toUpperCase()}-${String(Et.getDate()).padStart(2,"0")}, ${Et.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0})}`}
606
+ `).replace(/\\n\\n/g,"").trim();let _t=new Date,ce=`[METADATA] Current date and Time: ${`${_t.getFullYear()}-${_t.toLocaleString("en-US",{month:"short"}).toUpperCase()}-${String(_t.getDate()).padStart(2,"0")}, ${_t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0})}`}
606
607
 
607
- [USER]: ${Le.substring(0,8192)}
608
- ${Le.length>8192?`... (truncated) ...
608
+ [USER]: ${$e.substring(0,8192)}
609
+ ${$e.length>8192?`... (truncated) ...
609
610
 
610
611
  `:""}
611
- [AGENT (current turn)]: ${Tt}`;T.push({role:"user",parts:[{text:ce}]});let Bt=await Fi("NVIDIA"),jn=(await Ro()).quotas?.providerTiers?.NVIDIA==="Free",Kn="",_t=0,qt=L?12:-1;for(;_t<=qt;)try{if(!await Ns("background",e))return;let de="",Ue=null,ze=!1,N=y;try{let M=new Promise((nt,me)=>setTimeout(()=>me(new Error("JANITOR_TIMEOUT")),1e4)),C=y==="Google"&&_t>=0&&_t<6&&Bt&&jn,et=y==="DeepSeek"&&_t<4&&Bt&&jn;ze=C||et,N=ze?"NVIDIA":y;let Ge=Date.now(),S=null,F=(async()=>{if(y==="OpenRouter"){let nt=ie("janitor_open_router"),ae=(await re("OpenRouter"))(A,nt,T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),Wt=await ae.next();return{iterator:ae,firstResult:Wt}}else if(y==="DeepSeek"&&!ze){let me=(await re("DeepSeek"))(A,ie("deepseek_fast_fallback"),T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="Mistral"&&!ze){let me=(await re("Mistral"))(A,ie("mistral_janitor_fallback"),T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="NVIDIA"||ze){let me=(await re("NVIDIA"))(ze?Bt:A,ie("nvidia_janitor_fallback"),T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="InferX"){let me=(await re("InferX"))(A,targetModel||ie("inferx_fallback")||"deepseek-v4-flash",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="SenseNova"){let me=(await re("SenseNova"))(A,targetModel||ie("sensenova_fallback")||"sensenova-6.8-flash-lite",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="AIHubMix"){let me=(await re("AIHubMix"))(A,targetModel||ie("aihubmix_fallback")||"gpt-4o-mini",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="Poolside"){let me=(await re("Poolside"))(A,targetModel||ie("poolside_fallback")||"poolside/laguna-s-2.1",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="9router"||y==="9Router"){let me=(await re("NineRouter"))(A,targetModel||ie("9router_fallback")||"z-ai/glm-5.3-flash",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="ExpLabs"||y==="ExperientialLabs"){let me=(await re("ExpLabs"))(A,targetModel||ie("explabs_fallback")||"deepseek-v4-pro-0813",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else{let ae=(await ws(A).models.generateContentStream({model:s||(_t===qt?ie("janitor_default"):ie("gemma_janitor_fallback_google")),contents:T,config:{systemInstruction:b,temperature:.7,safetySettings:[{category:Wn.HARM_CATEGORY_HARASSMENT,threshold:Un.BLOCK_NONE},{category:Wn.HARM_CATEGORY_HATE_SPEECH,threshold:Un.BLOCK_NONE},{category:Wn.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Un.BLOCK_NONE},{category:Wn.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Un.BLOCK_NONE}],thinkingConfig:{includeThoughts:!1,thinkingLevel:Qe.MINIMAL},serviceTier:"flex"}}))[Symbol.asyncIterator](),Wt=await ae.next();return{iterator:ae,firstResult:Wt}}})();if(process.stdout.isTTY){let ae=(await Hi())[p]?.name||"",Wt=ae&&!ae.startsWith("flow-")&&!ae.startsWith("Session ")?ae:"FluxFlow | Idle";process.stdout.write(`\x1B]0;${Wt}\x07`),process.stdout.write(`\x1B]633;P;TerminalTitle=${Wt}\x07`)}let{iterator:ft,firstResult:it}=await Promise.race([F,M]);S=Date.now()-Ge;let{value:$e,done:ut}=it;if(!ut&&$e){let nt=$e.candidates?.[0]?.content?.parts,me=nt?N==="Google"?nt[1]?.text||nt[0]?.text||"":nt.filter(ae=>ae.text&&!ae.thought).map(ae=>ae.text).join(""):typeof $e.text=="function"?$e.text():"";me&&(de+=me),Ue=$e.usageMetadata;for await(let ae of{[Symbol.asyncIterator]:()=>ft}){let Wt=ae.candidates?.[0]?.content?.parts,zo=Wt?N==="Google"?Wt[1]?.text||Wt[0]?.text||"":Wt.filter(xo=>xo.text&&!xo.thought).map(xo=>xo.text).join(""):typeof ae.text=="function"?ae.text():"";zo&&(de+=zo),Ue=ae.usageMetadata}}}catch(M){throw M}if(de){if(Kn=de,Ue){let M=Ue.totalTokenCount||0,C=Ue.cachedContentTokenCount||0,et=(Ue.candidatesTokenCount||0)+(N==="Google"&&Ue.thoughtsTokenCount||0),Ge=ze?ie("nvidia_janitor_fallback"):N==="DeepSeek"?ie("deepseek_fast_fallback"):N==="ExpLabs"||N==="ExperientialLabs"?ie("explabs_fallback")||"deepseek-v4-pro-0813":N==="OpenRouter"?ie("janitor_open_router"):s||(_t===qt?ie("janitor_default"):ie("gemma_janitor_fallback_google"));await St("tokens",M,N,Ge),C>0&&await St("cachedTokens",C,N,Ge),et>0&&await St("candidateTokens",et,N,Ge),janitorTtft!==null&&janitorTtft>0&&await St("ttft",janitorTtft,N,Ge),Io({provider:N,model:Ge,prompt:Ue.promptTokenCount||0,cached:C,output:et,reasoning:Ue.thoughtsTokenCount||0,ttft:janitorTtft})}}else throw new Error("No synthesis generated by Janitor.");h&&(h(),await $t("background"));let nn=Gn(Kn),Ut=!1;for(let M of nn){let C=M.toolName;["addMemScore","add_mem_score","AddMemScore","addMemoryScore","AddMemoryScore"].includes(C)&&(Ut=!0);let et={chatId:p,sessionId:p,history:i},Ge=await Ho(C,M.args,et);C.toLowerCase()==="memory"&&(M.args.includes("action='user'")||M.args.includes('action="user"'))&&!Ge.startsWith("ERROR")&&(u&&u(),process.stdout.isTTY&&(process.stdout.write("\x1B]0;Memory Updated\x07"),process.stdout.write("\x1B]633;P;TerminalTitle=Memory Updated\x07")),await new Promise(F=>setTimeout(F,3e3)))}if(!Ut)try{let M=Lt(no,[]);if(M.length>0){let C=[];for(let et of M)et.score===void 0&&(et.score=.5),et.score*=.99995,et.score<.05&&(et.score=0),et.score=Math.round(et.score*1e5)/1e5,et.score>0&&C.push(et);go(no,C)}}catch{}break}catch(de){_t++;let Ue=new Date().toLocaleString(),ze=de instanceof Error?(()=>{try{return JSON.parse(JSON.parse(de.message).error.message).error.message}catch{return String(de)}})():String(de);await new Promise(Ut=>setTimeout(Ut,1e3));let N=U.join(Sn,"janitor");if(ge.existsSync(N)||ge.mkdirSync(N,{recursive:!0}),ge.appendFileSync(U.join(N,"error.log"),`ERROR [Attempt ${_t}/${qt+1}] [${Ue}]: ${ze}
612
+ [AGENT (current turn)]: ${At}`;T.push({role:"user",parts:[{text:ce}]});let Bt=await Fi("NVIDIA"),Kn=(await vo()).quotas?.providerTiers?.NVIDIA==="Free",Vn="",vt=0,zt=O?12:-1;for(;vt<=zt;)try{if(!await Ns("background",e))return;let de="",Ue=null,qe=!1,N=y;try{let I=new Promise((nt,me)=>setTimeout(()=>me(new Error("JANITOR_TIMEOUT")),1e4)),C=y==="Google"&&vt>=0&&vt<6&&Bt&&Kn,et=y==="DeepSeek"&&vt<4&&Bt&&Kn;qe=C||et,N=qe?"NVIDIA":y;let He=Date.now(),S=null,F=(async()=>{if(y==="OpenRouter"){let nt=ie("janitor_open_router"),ae=(await re("OpenRouter"))(A,nt,T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),Wt=await ae.next();return{iterator:ae,firstResult:Wt}}else if(y==="DeepSeek"&&!qe){let me=(await re("DeepSeek"))(A,ie("deepseek_fast_fallback"),T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="Mistral"&&!qe){let me=(await re("Mistral"))(A,ie("mistral_janitor_fallback"),T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="NVIDIA"||qe){let me=(await re("NVIDIA"))(qe?Bt:A,ie("nvidia_janitor_fallback"),T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="InferX"){let me=(await re("InferX"))(A,targetModel||ie("inferx_fallback")||"deepseek-v4-flash",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="SenseNova"){let me=(await re("SenseNova"))(A,targetModel||ie("sensenova_fallback")||"sensenova-6.8-flash-lite",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="AIHubMix"){let me=(await re("AIHubMix"))(A,targetModel||ie("aihubmix_fallback")||"gpt-4o-mini",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="Poolside"){let me=(await re("Poolside"))(A,targetModel||ie("poolside_fallback")||"poolside/laguna-s-2.1",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="9router"||y==="9Router"){let me=(await re("NineRouter"))(A,targetModel||ie("9router_fallback")||"z-ai/glm-5.3-flash",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else if(y==="ExpLabs"||y==="ExperientialLabs"){let me=(await re("ExpLabs"))(A,targetModel||ie("explabs_fallback")||"deepseek-v4-pro-0813",T,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await me.next();return{iterator:me,firstResult:ae}}else{let ae=(await ws(A).models.generateContentStream({model:s||(vt===zt?ie("janitor_default"):ie("gemma_janitor_fallback_google")),contents:T,config:{systemInstruction:b,temperature:.7,safetySettings:[{category:Hn.HARM_CATEGORY_HARASSMENT,threshold:Gn.BLOCK_NONE},{category:Hn.HARM_CATEGORY_HATE_SPEECH,threshold:Gn.BLOCK_NONE},{category:Hn.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Gn.BLOCK_NONE},{category:Hn.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Gn.BLOCK_NONE}],thinkingConfig:{includeThoughts:!1,thinkingLevel:Qe.MINIMAL},serviceTier:"flex"}}))[Symbol.asyncIterator](),Wt=await ae.next();return{iterator:ae,firstResult:Wt}}})();if(process.stdout.isTTY){let ae=(await Hi())[p]?.name||"",Wt=ae&&!ae.startsWith("flow-")&&!ae.startsWith("Session ")?ae:"FluxFlow | Idle";process.stdout.write(`\x1B]0;${Wt}\x07`),process.stdout.write(`\x1B]633;P;TerminalTitle=${Wt}\x07`)}let{iterator:ut,firstResult:it}=await Promise.race([F,I]);S=Date.now()-He;let{value:Ne,done:gt}=it;if(!gt&&Ne){let nt=Ne.candidates?.[0]?.content?.parts,me=nt?N==="Google"?nt[1]?.text||nt[0]?.text||"":nt.filter(ae=>ae.text&&!ae.thought).map(ae=>ae.text).join(""):typeof Ne.text=="function"?Ne.text():"";me&&(de+=me),Ue=Ne.usageMetadata;for await(let ae of{[Symbol.asyncIterator]:()=>ut}){let Wt=ae.candidates?.[0]?.content?.parts,Yo=Wt?N==="Google"?Wt[1]?.text||Wt[0]?.text||"":Wt.filter(yo=>yo.text&&!yo.thought).map(yo=>yo.text).join(""):typeof ae.text=="function"?ae.text():"";Yo&&(de+=Yo),Ue=ae.usageMetadata}}}catch(I){throw I}if(de){if(Vn=de,Ue){let I=Ue.totalTokenCount||0,C=Ue.cachedContentTokenCount||0,et=(Ue.candidatesTokenCount||0)+(N==="Google"&&Ue.thoughtsTokenCount||0),He=qe?ie("nvidia_janitor_fallback"):N==="DeepSeek"?ie("deepseek_fast_fallback"):N==="ExpLabs"||N==="ExperientialLabs"?ie("explabs_fallback")||"deepseek-v4-pro-0813":N==="OpenRouter"?ie("janitor_open_router"):s||(vt===zt?ie("janitor_default"):ie("gemma_janitor_fallback_google"));await kt("tokens",I,N,He),C>0&&await kt("cachedTokens",C,N,He),et>0&&await kt("candidateTokens",et,N,He),janitorTtft!==null&&janitorTtft>0&&await kt("ttft",janitorTtft,N,He),Ro({provider:N,model:He,prompt:Ue.promptTokenCount||0,cached:C,output:et,reasoning:Ue.thoughtsTokenCount||0,ttft:janitorTtft})}}else throw new Error("No synthesis generated by Janitor.");h&&(h(),await Nt("background"));let tn=Cn(Vn),Ut=!1;for(let I of tn){let C=I.toolName;["addMemScore","add_mem_score","AddMemScore","addMemoryScore","AddMemoryScore"].includes(C)&&(Ut=!0);let et={chatId:p,sessionId:p,history:i},He=await Go(C,I.args,et);C.toLowerCase()==="memory"&&(I.args.includes("action='user'")||I.args.includes('action="user"'))&&!He.startsWith("ERROR")&&(u&&u(),process.stdout.isTTY&&(process.stdout.write("\x1B]0;Memory Updated\x07"),process.stdout.write("\x1B]633;P;TerminalTitle=Memory Updated\x07")),await new Promise(F=>setTimeout(F,3e3)))}if(!Ut)try{let I=$t(no,[]);if(I.length>0){let C=[];for(let et of I)et.score===void 0&&(et.score=.5),et.score*=.99995,et.score<.05&&(et.score=0),et.score=Math.round(et.score*1e5)/1e5,et.score>0&&C.push(et);uo(no,C)}}catch{}break}catch(de){vt++;let Ue=new Date().toLocaleString(),qe=de instanceof Error?(()=>{try{return JSON.parse(JSON.parse(de.message).error.message).error.message}catch{return String(de)}})():String(de);await new Promise(Ut=>setTimeout(Ut,1e3));let N=U.join(kn,"janitor");if(ge.existsSync(N)||ge.mkdirSync(N,{recursive:!0}),ge.appendFileSync(U.join(N,"error.log"),`ERROR [Attempt ${vt}/${zt+1}] [${Ue}]: ${qe}
612
613
 
613
- `),_t>qt)break;let nn=Math.min(750*Math.pow(2,_t-1),5e3);await new Promise(Ut=>setTimeout(Ut,nn))}if(_t){let de=U.join(Sn,"janitor");ge.appendFileSync(U.join(de,"error.log"),`-----------------------------------------------------------------------------
614
+ `),vt>zt)break;let tn=Math.min(750*Math.pow(2,vt-1),5e3);await new Promise(Ut=>setTimeout(Ut,tn))}if(vt){let de=U.join(kn,"janitor");ge.appendFileSync(U.join(de,"error.log"),`-----------------------------------------------------------------------------
614
615
 
615
- `)}if(process.stdout.isTTY)try{let ze=(await Hi())[p]?.name||"",N=ze&&!ze.startsWith("flow-")&&!ze.startsWith("Session ")?ze:"FluxFlow | Idle";process.stdout.write(`\x1B]0;${N}\x07`),process.stdout.write(`\x1B]633;P;TerminalTitle=${N}\x07`)}catch{process.stdout.write("\x1B]0;FluxFlow | Idle\x07"),process.stdout.write("\x1B]633;P;TerminalTitle=FluxFlow | Idle\x07")}},Si=e=>{if(!e||typeof e!="string")return e;let n=e.split(""),t=!1,i=!1,o=0;for(;o<n.length;){if(n[o]==="`"&&n[o+1]==="`"&&n[o+2]==="`"){t?(n[o]=" ",n[o+1]=" ",n[o+2]=" ",t=!1):(n[o]=" ",n[o+1]=" ",n[o+2]=" ",t=!0),o+=3;continue}if(t){n[o]!==`
616
+ `)}if(process.stdout.isTTY)try{let qe=(await Hi())[p]?.name||"",N=qe&&!qe.startsWith("flow-")&&!qe.startsWith("Session ")?qe:"FluxFlow | Idle";process.stdout.write(`\x1B]0;${N}\x07`),process.stdout.write(`\x1B]633;P;TerminalTitle=${N}\x07`)}catch{process.stdout.write("\x1B]0;FluxFlow | Idle\x07"),process.stdout.write("\x1B]633;P;TerminalTitle=FluxFlow | Idle\x07")}},Si=e=>{if(!e||typeof e!="string")return e;let n=e.split(""),t=!1,i=!1,o=0;for(;o<n.length;){if(n[o]==="`"&&n[o+1]==="`"&&n[o+2]==="`"){t?(n[o]=" ",n[o+1]=" ",n[o+2]=" ",t=!1):(n[o]=" ",n[o+1]=" ",n[o+2]=" ",t=!0),o+=3;continue}if(t){n[o]!==`
616
617
  `&&n[o]!=="\r"&&(n[o]=" "),o++;continue}if(n[o]==="`")if(i){i=!1,n[o]=" ",o++;continue}else{i=!0,n[o]=" ",o++;continue}if(i){n[o]===`
617
- `||n[o]==="\r"?i=!1:n[o]=" ",o++;continue}o++}return n.join("")},Sl=e=>{let n=Ft(e),t=Si(n);Vo.lastIndex=0;let i;for(;(i=Vo.exec(t))!==null;){let o=i.index+i[0].length-1,r=0,d=null,l=!1,u=!1;for(let h=o;h<t.length;h++){let x=t[h];if(!d&&(x==='"'||x==="'"||x==="`")?(d=x,l=!1):d&&x===d&&!l&&(d=null),!d&&(x==="("?r++:x===")"&&r--,r===0)){let m=h+1;for(;m<t.length&&/\s/.test(t[m]);)m++;if(m<t.length&&t[m]==="]"){u=!0,Vo.lastIndex=m+1;break}}x==="\\"?l=!l:l=!1}if(!u)return{inside:!0,toolName:i[1],startIndex:i.index,args:n.substring(i.index+i[0].length)}}return{inside:!1}},fa=(e,n=!0)=>{let t=Vo;t.lastIndex=0;let i="",o=0,r;for(;(r=t.exec(e))!==null;){let d=e.substring(o,r.index);i+=n&&o===0?Ft(d):d;let l=r.index+r[0].length-1,u=0,h=null,x=-1;for(let m=l;m<e.length;m++){let f=e[m];if(h){if(f===h){let s=0;for(let p=m-1;p>=0&&e[p]==="\\";p--)s++;s%2===0&&(h=null)}}else if(f==='"'||f==="'"||f==="`")h=f;else if(f==="(")u++;else if(f===")"&&(u--,u===0)){let s=m+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(s<e.length&&e[s]==="]"){x=s;break}}}if(x!==-1)i+="[tool:functions."+r[1]+"()]",o=x+1,t.lastIndex=o;else{i+="[tool:functions."+r[1]+"(",o=e.length;break}}return o<e.length&&(i+=n&&o===0?Ft(e.substring(o)):e.substring(o)),i},kl=(e,n,t)=>{let i=Vo;i.lastIndex=0;let o="",r=0,d;for(;(d=i.exec(e))!==null;){let l=e.substring(r,d.index);o+=l.replace(n,t);let u=d.index+d[0].length-1,h=0,x=null,m=-1;for(let f=u;f<e.length;f++){let s=e[f];if(x){if(s===x){let p=0;for(let k=f-1;k>=0&&e[k]==="\\";k--)p++;p%2===0&&(x=null)}}else if(s==='"'||s==="'"||s==="`")x=s;else if(s==="(")h++;else if(s===")"&&(h--,h===0)){let p=f+1;for(;p<e.length&&/\s/.test(e[p]);)p++;if(p<e.length&&e[p]==="]"){m=p;break}}}if(m!==-1)o+=e.substring(d.index,m+1),r=m+1,i.lastIndex=r;else{o+=e.substring(d.index),r=e.length;break}}return r<e.length&&(o+=e.substring(r).replace(n,t)),o},aa=e=>fa(e,!0),Tl=e=>{if(!e)return e;let n={patchfile:"PatchFile",writefile:"WriteFile",readfile:"ReadFile",viewfile:"ReadFile",run:"Run",execcommand:"Run",searchkeyword:"SearchKeyword",codesearch:"CodeSearch",code_search:"CodeSearch",websearch:"WebSearch",webscrape:"WebScrape",readfolder:"ReadFolder",writepdf:"WritePDF",writedoc:"WriteDoc",writedocx:"WriteDoc",filemap:"FileMap",generateimage:"GenerateImage",todo:"Todo",goal:"Goal",askuser:"AskUser",ask:"AskUser"},t=o=>o.split("_").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");ia.lastIndex=0;let i=e.replace(ia,(o,r,d)=>{let l="";try{let x=JSON.parse(d.trim());x&&typeof x=="object"&&(l=Object.entries(x).map(([f,s])=>{let p=typeof s=="string"?s:JSON.stringify(s);return`${f}=${JSON.stringify(p)}`}).join(", "))}catch{let m=[],f=hl;f.lastIndex=0;let s;for(;(s=f.exec(d))!==null;){let p=s[1],k=s[2]!==void 0?s[2]:s[0].split(":").slice(1).join(":").trim();m.push(`${p}=${JSON.stringify(k)}`)}m.length>0?l=m.join(", "):l=d.trim()}let u=r.toLowerCase().replace(/_/g,"");return`[tool:functions.${n[u]||t(r)}(${l})]`});return sa.lastIndex=0,ra.lastIndex=0,i=i.replace(sa,""),i=i.replace(ra,""),i},Gn=e=>{if(!e)return[];let n=Tl(e),t=Ft(n),i=[],o=Si(t),r=cl;r.lastIndex=0;let d;for(;(d=r.exec(o))!==null;){let l=d[1],u=d.index+d[0].length-1,h=0,x=null,m=-1,f=-1;for(let s=u;s<o.length;s++){let p=o[s];if(x){if(p===x){let k=0;for(let ue=s-1;ue>=0&&o[ue]==="\\";ue--)k++;k%2===0&&(x=null)}}else{if(s>u&&(o.substring(s).startsWith("[action:")||o.substring(s).startsWith("[tool:")))break;if(p==='"'||p==="'"||p==="`")x=p;else if(p==="(")h++;else if(p===")"&&(h--,h===0)){f=s;let k=s+1;for(;k<o.length&&/\s/.test(o[k]);)k++;if(k<o.length&&o[k]==="]"){m=k;break}}}}if(m!==-1){let s=t.substring(u+1,f),p=t.substring(d.index,m+1);i.push({fullMatch:p,toolName:l.trim(),args:s.trim()}),r.lastIndex=m+1}}return i},la=e=>{if(!e)return null;let n=Ft(e),t=[],i=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,o=[],r;for(;(r=i.exec(n))!==null;)o.push({toolName:r[1],index:r.index,parenIndex:r.index+r[0].length-1});for(let f=0;f<o.length;f++){let s=o[f],p=f+1<o.length?o[f+1].index:n.length,k=n.substring(s.index,p),ue=k.indexOf("("),y=ue!==-1?k.substring(ue+1):"",A=0,L=null,W=!1;for(let $=0;$<y.length;$++){let T=y[$];if(L){if(T===L){let we=0;for(let _e=$-1;_e>=0&&y[_e]==="\\";_e--)we++;we%2===0&&(L=null)}}else if(T==='"'||T==="'"||T==="`")L=T;else if(T==="(")A++;else if(T===")")if(A>0)A--;else{let we=$+1;for(;we<y.length&&/\s/.test(y[we]);)we++;if(we<y.length&&y[we]==="]"){W=!0;break}}}if(!W){let $=k.trim(),T="";L?T=`Unclosed quote string (${L}) inside arguments`:$.endsWith("]")?T=`Missing closing ')' before ']' (e.g. found "...]")`:$.endsWith(")")?T=`Missing closing ']' after ')' (e.g. found "...)" instead of "...)]")`:!$.includes(")")&&!$.includes("]")?T="Missing closing delimiter ')]'":T="Malformed or unclosed call syntax (missing ')]')",t.push(`\u2022 [action:${s.toolName}(...)]: ${T}. Expected: [action:${s.toolName}(arg1="...", arg2="...")]`)}}let d=/(?:^|[^\w\[])(?:tool|action):(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/gi,l;for(;(l=d.exec(n))!==null;){let f=l[1],s=l.index+(l[0].indexOf(":")-(l[0].startsWith("action")||l[0].startsWith("tool")?0:1));(s>0?n[s-1]:"")!=="["&&yi(f)&&t.push(`\u2022 action:${f}(...): Missing opening bracket '['. Expected: [action:${f}(...)]`)}let u=/\[\s*(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/g,h;for(;(h=u.exec(n))!==null;){let f=h[1];f!=="action"&&f!=="tool"&&yi(f)&&t.push(`\u2022 [${f}(...)]: Missing 'action:' prefix. Expected: [action:${f}(...)]`)}let x=/\[\s*(?:tool|action)\s*:\s*(?:functions\.)?([a-zA-Z0-9_]+)(?!\s*\()/gi,m;for(;(m=x.exec(n))!==null;){let f=m[1];yi(f)&&t.push(`\u2022 [action:${f}...]: Missing opening '(' for tool arguments. Expected: [action:${f}(...)]`)}return t.length>0?t.join(`
618
- `):null},Fd=(e,n={})=>{if(!e)return null;if(Yo=n,bs=new ca({apiKey:e}),!globalThis.__perfCleanupInstalled){globalThis.__perfCleanupInstalled=!0,setInterval(()=>{typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks())},6e4);let t=globalThis.fetch;globalThis.fetch=async(...i)=>{try{let o=await t(...i);return typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}catch(o){throw typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}}}},ua=e=>{if(!e)return{serviceTier:void 0,cleanModel:e};let n=e.toLowerCase();return n.endsWith(":flex")?{serviceTier:"flex",cleanModel:e.slice(0,-5)}:n.endsWith(":priority")?{serviceTier:"priority",cleanModel:e.slice(0,-9)}:{serviceTier:void 0,cleanModel:e}},ki=async(e,n,t,i,o="Fast",r=.75,d="agent")=>xl(async()=>{let{aiProvider:l="Google",apiKey:u,mode:h}=e,x="",m=null,f=typeof t=="string"?[{role:"user",parts:[{text:t}]}]:t,s=new AbortController,p=s.signal,k=setInterval(()=>{kt&&(s.abort(),clearInterval(k))},100),ue=Date.now(),y=null;try{let A;if(l==="Ollama")A=(await re("Ollama"))(u,n,f,i,o,h,dt(n),p,r,e.systemSettings?.ollamaEndpoint||"Cloud");else if(l==="OpenRouter")A=(await re("OpenRouter"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="DeepSeek")A=(await re("DeepSeek"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="Mistral")A=(await re("Mistral"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="NVIDIA")A=(await re("NVIDIA"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="InferX")A=(await re("InferX"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="SenseNova")A=(await re("SenseNova"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="AIHubMix")A=(await re("AIHubMix"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="Poolside")A=(await re("Poolside"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="9router"||l==="9Router")A=(await re("NineRouter"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="ExpLabs"||l==="ExperientialLabs")A=(await re("ExpLabs"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="Infron"||l==="infron")A=(await re("Infron"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="TokenHarbor"||l==="Token Harbor"||l==="tokenharbor"||l==="token_harbor"||l==="thk")A=(await re("TokenHarbor"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="APInex"||l==="apinex"||l==="apx")A=(await re("APInex"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="xKiro"||l==="xkiro"||l==="kiro")A=(await re("xKiro"))(u,n,f,i,o,h,dt(n),p,r);else if(l==="c_openai"||l==="Custom (OpenAI)"){let L=e.systemSettings?.customOpenAIBaseUrl||"";try{L=await Di("c_openai")||L}catch{}A=(await re("c_openai"))(u,n,f,i,o,h,dt(n),p,r,L)}else{let L=ws(u),{serviceTier:W,cleanModel:$}=ua(n),T={systemInstruction:i,temperature:r,thinkingConfig:(()=>{let _e=(n||"").toLowerCase(),Me=_e.includes("gemma-4")||_e.startsWith("gemma"),Ze=_e.includes("gemini-3");if(Me||Ze)return Me?o.toLowerCase()!=="xhigh"?{includeThoughts:!1,thinkingLevel:Qe.MINIMAL}:{includeThoughts:!0,thinkingLevel:Qe.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:_e.includes("pro")?Qe.LOW:Qe.MINIMAL,Low:Qe.LOW,Medium:Qe.MEDIUM,Standard:Qe.MEDIUM,High:Qe.HIGH,xHigh:Qe.HIGH}[o]||Qe.MEDIUM};{let H={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[o]||2048;return H===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:H}}})()};W&&(T.serviceTier=W),A=await L.models.generateContentStream({model:$,contents:f,config:T},{signal:p})}for await(let L of A){if(kt)throw new Error("Subagent task was cancelled.");if(e?.taskId&&typeof tn<"u"){let T=tn.find(we=>we.id===e.taskId);if(T&&T.status==="cancelled")throw new Error("Subagent task was cancelled.")}y===null&&(L.candidates?.[0]?.content?.parts||L.text)&&(y=Date.now()-ue);let W="";if(L.candidates?.[0]?.content?.parts)for(let T of L.candidates[0].content.parts)T.text&&!T.thought&&(x+=T.text,W+=T.text);let $=W?Ui(W):0;e&&typeof e.onTokenChunk=="function"&&e.onTokenChunk(W,$),L.usageMetadata&&(m=L.usageMetadata)}}finally{clearInterval(k)}if(m){let A=m.totalTokenCount||0,L=m.cachedContentTokenCount||0,W=(m.candidatesTokenCount||0)+(l==="Google"&&m.thoughtsTokenCount||0);await St("tokens",A,l,n),L>0&&await St("cachedTokens",L,l,n),W>0&&await St("candidateTokens",W,l,n),y!==null&&y>0&&await St("ttft",y,l,n),Io({provider:l,model:n,prompt:m.promptTokenCount||0,cached:L,output:W,reasoning:m.thoughtsTokenCount||0,ttft:y}),e&&typeof e.onUsage=="function"&&e.onUsage({totalTokenCount:A,cachedContentTokenCount:L,candidatesTokenCount:W})}return await $t("agent",l),{text:x,usageMetadata:m}}),Al=async(e,n,t=null)=>{t=t||Lt(ni,{});try{let{aiProvider:i="Google"}=n;if(Object.values(t).flat().length<=5)return;let r=Object.keys(t).filter(f=>f!==e&&Array.isArray(t[f])&&t[f].length>2);if(r.length===0)return;let d=`You are a silent background process for the FluxFlow CLI Agent.
618
+ `||n[o]==="\r"?i=!1:n[o]=" ",o++;continue}o++}return n.join("")},aa=(e,n=null)=>{if(!e||typeof e!="string")return e;let t=n||Cn(e);if(!t||t.length===0)return e;let i=e.split("");for(let o of t){if(!o.fullMatch)continue;let r=0;for(;(r=e.indexOf(o.fullMatch,r))!==-1;){for(let d=r;d<r+o.fullMatch.length;d++)i[d]!==`
619
+ `&&i[d]!=="\r"&&(i[d]=" ");r+=o.fullMatch.length}}return i.join("")},kl=e=>{let n=Ft(e),t=Si(n);Ko.lastIndex=0;let i;for(;(i=Ko.exec(t))!==null;){let o=i.index+i[0].length-1,r=0,d=null,l=!1,u=!1;for(let h=o;h<t.length;h++){let x=t[h];if(!d&&(x==='"'||x==="'"||x==="`")?(d=x,l=!1):d&&x===d&&!l&&(d=null),!d&&(x==="("?r++:x===")"&&r--,r===0)){let m=h+1;for(;m<t.length&&/\s/.test(t[m]);)m++;if(m<t.length&&t[m]==="]"){u=!0,Ko.lastIndex=m+1;break}}x==="\\"?l=!l:l=!1}if(!u)return{inside:!0,toolName:i[1],startIndex:i.index,args:n.substring(i.index+i[0].length)}}return{inside:!1}},ua=(e,n=!0)=>{let t=Ko;t.lastIndex=0;let i="",o=0,r;for(;(r=t.exec(e))!==null;){let d=e.substring(o,r.index);i+=n&&o===0?Ft(d):d;let l=r.index+r[0].length-1,u=0,h=null,x=-1;for(let m=l;m<e.length;m++){let f=e[m];if(h){if(f===h){let s=0;for(let p=m-1;p>=0&&e[p]==="\\";p--)s++;s%2===0&&(h=null)}}else if(f==='"'||f==="'"||f==="`")h=f;else if(f==="(")u++;else if(f===")"&&(u--,u===0)){let s=m+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(s<e.length&&e[s]==="]"){x=s;break}}}if(x!==-1)i+="[tool:functions."+r[1]+"()]",o=x+1,t.lastIndex=o;else{i+="[tool:functions."+r[1]+"(",o=e.length;break}}return o<e.length&&(i+=n&&o===0?Ft(e.substring(o)):e.substring(o)),i},Tl=(e,n,t)=>{let i=Ko;i.lastIndex=0;let o="",r=0,d;for(;(d=i.exec(e))!==null;){let l=e.substring(r,d.index);o+=l.replace(n,t);let u=d.index+d[0].length-1,h=0,x=null,m=-1;for(let f=u;f<e.length;f++){let s=e[f];if(x){if(s===x){let p=0;for(let k=f-1;k>=0&&e[k]==="\\";k--)p++;p%2===0&&(x=null)}}else if(s==='"'||s==="'"||s==="`")x=s;else if(s==="(")h++;else if(s===")"&&(h--,h===0)){let p=f+1;for(;p<e.length&&/\s/.test(e[p]);)p++;if(p<e.length&&e[p]==="]"){m=p;break}}}if(m!==-1)o+=e.substring(d.index,m+1),r=m+1,i.lastIndex=r;else{o+=e.substring(d.index),r=e.length;break}}return r<e.length&&(o+=e.substring(r).replace(n,t)),o},la=e=>ua(e,!0),Al=e=>{if(!e)return e;let n={patchfile:"PatchFile",writefile:"WriteFile",readfile:"ReadFile",viewfile:"ReadFile",run:"Run",execcommand:"Run",searchkeyword:"SearchKeyword",codesearch:"CodeSearch",code_search:"CodeSearch",websearch:"WebSearch",webscrape:"WebScrape",readfolder:"ReadFolder",writepdf:"WritePDF",writedoc:"WriteDoc",writedocx:"WriteDoc",filemap:"FileMap",generateimage:"GenerateImage",todo:"Todo",goal:"Goal",askuser:"AskUser",ask:"AskUser"},t=o=>o.split("_").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");ia.lastIndex=0;let i=e.replace(ia,(o,r,d)=>{let l="";try{let x=JSON.parse(d.trim());x&&typeof x=="object"&&(l=Object.entries(x).map(([f,s])=>{let p=typeof s=="string"?s:JSON.stringify(s);return`${f}=${JSON.stringify(p)}`}).join(", "))}catch{let m=[],f=yl;f.lastIndex=0;let s;for(;(s=f.exec(d))!==null;){let p=s[1],k=s[2]!==void 0?s[2]:s[0].split(":").slice(1).join(":").trim();m.push(`${p}=${JSON.stringify(k)}`)}m.length>0?l=m.join(", "):l=d.trim()}let u=r.toLowerCase().replace(/_/g,"");return`[tool:functions.${n[u]||t(r)}(${l})]`});return sa.lastIndex=0,ra.lastIndex=0,i=i.replace(sa,""),i=i.replace(ra,""),i},Cn=e=>{if(!e)return[];let n=Al(e),t=Ft(n),i=[],o=Si(t),r=dl;r.lastIndex=0;let d;for(;(d=r.exec(o))!==null;){let l=d[1],u=d.index+d[0].length-1,h=0,x=null,m=-1,f=-1;for(let s=u;s<o.length;s++){let p=o[s];if(x){if(p===x){let k=0;for(let ue=s-1;ue>=0&&o[ue]==="\\";ue--)k++;k%2===0&&(x=null)}}else{if(s>u&&(o.substring(s).startsWith("[action:")||o.substring(s).startsWith("[tool:")))break;if(p==='"'||p==="'"||p==="`")x=p;else if(p==="(")h++;else if(p===")"&&(h--,h===0)){f=s;let k=s+1;for(;k<o.length&&/\s/.test(o[k]);)k++;if(k<o.length&&o[k]==="]"){m=k;break}}}}if(m!==-1){let s=t.substring(u+1,f),p=t.substring(d.index,m+1);i.push({fullMatch:p,toolName:l.trim(),args:s.trim()}),r.lastIndex=m+1}}return i},ca=e=>{if(!e)return null;let n=Ft(e),t=[],i=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,o=[],r;for(;(r=i.exec(n))!==null;)o.push({toolName:r[1],index:r.index,parenIndex:r.index+r[0].length-1});for(let f=0;f<o.length;f++){let s=o[f],p=f+1<o.length?o[f+1].index:n.length,k=n.substring(s.index,p),ue=k.indexOf("("),y=ue!==-1?k.substring(ue+1):"",A=0,O=null,W=!1;for(let $=0;$<y.length;$++){let T=y[$];if(O){if(T===O){let Se=0;for(let ve=$-1;ve>=0&&y[ve]==="\\";ve--)Se++;Se%2===0&&(O=null)}}else if(T==='"'||T==="'"||T==="`")O=T;else if(T==="(")A++;else if(T===")")if(A>0)A--;else{let Se=$+1;for(;Se<y.length&&/\s/.test(y[Se]);)Se++;if(Se<y.length&&y[Se]==="]"){W=!0;break}}}if(!W){let $=k.trim(),T="";O?T=`Unclosed quote string (${O}) inside arguments`:$.endsWith("]")?T=`Missing closing ')' before ']' (e.g. found "...]")`:$.endsWith(")")?T=`Missing closing ']' after ')' (e.g. found "...)" instead of "...)]")`:!$.includes(")")&&!$.includes("]")?T="Missing closing delimiter ')]'":T="Malformed or unclosed call syntax (missing ')]')",t.push(`\u2022 [action:${s.toolName}(...)]: ${T}. Expected: [action:${s.toolName}(arg1="...", arg2="...")]`)}}let d=/(?:^|[^\w\[])(?:tool|action):(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/gi,l;for(;(l=d.exec(n))!==null;){let f=l[1],s=l.index+(l[0].indexOf(":")-(l[0].startsWith("action")||l[0].startsWith("tool")?0:1));(s>0?n[s-1]:"")!=="["&&yi(f)&&t.push(`\u2022 action:${f}(...): Missing opening bracket '['. Expected: [action:${f}(...)]`)}let u=/\[\s*(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/g,h;for(;(h=u.exec(n))!==null;){let f=h[1];f!=="action"&&f!=="tool"&&yi(f)&&t.push(`\u2022 [${f}(...)]: Missing 'action:' prefix. Expected: [action:${f}(...)]`)}let x=/\[\s*(?:tool|action)\s*:\s*(?:functions\.)?([a-zA-Z0-9_]+)(?!\s*\()/gi,m;for(;(m=x.exec(n))!==null;){let f=m[1];yi(f)&&t.push(`\u2022 [action:${f}...]: Missing opening '(' for tool arguments. Expected: [action:${f}(...)]`)}return t.length>0?t.join(`
620
+ `):null},Bd=(e,n={})=>{if(!e)return null;if(Vo=n,bs=new da({apiKey:e}),!globalThis.__perfCleanupInstalled){globalThis.__perfCleanupInstalled=!0,setInterval(()=>{typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks())},6e4);let t=globalThis.fetch;globalThis.fetch=async(...i)=>{try{let o=await t(...i);return typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}catch(o){throw typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}}}},ga=e=>{if(!e)return{serviceTier:void 0,cleanModel:e};let n=e.toLowerCase();return n.endsWith(":flex")?{serviceTier:"flex",cleanModel:e.slice(0,-5)}:n.endsWith(":priority")?{serviceTier:"priority",cleanModel:e.slice(0,-9)}:{serviceTier:void 0,cleanModel:e}},ki=async(e,n,t,i,o="Fast",r=.75,d="agent")=>bl(async()=>{let{aiProvider:l="Google",apiKey:u,mode:h}=e,x="",m=null,f=typeof t=="string"?[{role:"user",parts:[{text:t}]}]:t,s=new AbortController,p=s.signal,k=setInterval(()=>{Tt&&(s.abort(),clearInterval(k))},100),ue=Date.now(),y=null;try{let A;if(l==="Ollama")A=(await re("Ollama"))(u,n,f,i,o,h,ft(n),p,r,e.systemSettings?.ollamaEndpoint||"Cloud");else if(l==="OpenRouter")A=(await re("OpenRouter"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="DeepSeek")A=(await re("DeepSeek"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="Mistral")A=(await re("Mistral"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="NVIDIA")A=(await re("NVIDIA"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="InferX")A=(await re("InferX"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="SenseNova")A=(await re("SenseNova"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="AIHubMix")A=(await re("AIHubMix"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="Poolside")A=(await re("Poolside"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="9router"||l==="9Router")A=(await re("NineRouter"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="ExpLabs"||l==="ExperientialLabs")A=(await re("ExpLabs"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="Infron"||l==="infron")A=(await re("Infron"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="TokenHarbor"||l==="Token Harbor"||l==="tokenharbor"||l==="token_harbor"||l==="thk")A=(await re("TokenHarbor"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="APInex"||l==="apinex"||l==="apx")A=(await re("APInex"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="xKiro"||l==="xkiro"||l==="kiro")A=(await re("xKiro"))(u,n,f,i,o,h,ft(n),p,r);else if(l==="c_openai"||l==="Custom (OpenAI)"){let O=e.systemSettings?.customOpenAIBaseUrl||"";try{O=await Di("c_openai")||O}catch{}A=(await re("c_openai"))(u,n,f,i,o,h,ft(n),p,r,O)}else{let O=ws(u),{serviceTier:W,cleanModel:$}=ga(n),T={systemInstruction:i,temperature:r,thinkingConfig:(()=>{let ve=(n||"").toLowerCase(),Pe=ve.includes("gemma-4")||ve.startsWith("gemma"),Ze=ve.includes("gemini-3");if(Pe||Ze)return Pe?o.toLowerCase()!=="xhigh"?{includeThoughts:!1,thinkingLevel:Qe.MINIMAL}:{includeThoughts:!0,thinkingLevel:Qe.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:ve.includes("pro")?Qe.LOW:Qe.MINIMAL,Low:Qe.LOW,Medium:Qe.MEDIUM,Standard:Qe.MEDIUM,High:Qe.HIGH,xHigh:Qe.HIGH}[o]||Qe.MEDIUM};{let H={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[o]||2048;return H===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:H}}})()};W&&(T.serviceTier=W),A=await O.models.generateContentStream({model:$,contents:f,config:T},{signal:p})}for await(let O of A){if(Tt)throw new Error("Subagent task was cancelled.");if(e?.taskId&&typeof en<"u"){let T=en.find(Se=>Se.id===e.taskId);if(T&&T.status==="cancelled")throw new Error("Subagent task was cancelled.")}y===null&&(O.candidates?.[0]?.content?.parts||O.text)&&(y=Date.now()-ue);let W="";if(O.candidates?.[0]?.content?.parts)for(let T of O.candidates[0].content.parts)T.text&&!T.thought&&(x+=T.text,W+=T.text);let $=W?Ui(W):0;e&&typeof e.onTokenChunk=="function"&&e.onTokenChunk(W,$),O.usageMetadata&&(m=O.usageMetadata)}}finally{clearInterval(k)}if(m){let A=m.totalTokenCount||0,O=m.cachedContentTokenCount||0,W=(m.candidatesTokenCount||0)+(l==="Google"&&m.thoughtsTokenCount||0);await kt("tokens",A,l,n),O>0&&await kt("cachedTokens",O,l,n),W>0&&await kt("candidateTokens",W,l,n),y!==null&&y>0&&await kt("ttft",y,l,n),Ro({provider:l,model:n,prompt:m.promptTokenCount||0,cached:O,output:W,reasoning:m.thoughtsTokenCount||0,ttft:y}),e&&typeof e.onUsage=="function"&&e.onUsage({totalTokenCount:A,cachedContentTokenCount:O,candidatesTokenCount:W})}return await Nt("agent",l),{text:x,usageMetadata:m}}),Cl=async(e,n,t=null)=>{t=t||$t(ni,{});try{let{aiProvider:i="Google"}=n;if(Object.values(t).flat().length<=5)return;let r=Object.keys(t).filter(f=>f!==e&&Array.isArray(t[f])&&t[f].length>2);if(r.length===0)return;let d=`You are a silent background process for the FluxFlow CLI Agent.
619
621
  Your task is to summarize or merge temporary context memories from one or more past conversation sessions.
620
622
  For each Chat ID provided, you must output a tool call to save the consolidated summary.
621
623
 
@@ -630,7 +632,7 @@ Guidelines:
630
632
 
631
633
  Chats to process:
632
634
 
633
- `,l=Lt($i,{});for(let f of r){let p=t[f].map(ue=>`- ${ue}`).join(`
635
+ `,l=$t($i,{});for(let f of r){let p=t[f].map(ue=>`- ${ue}`).join(`
634
636
  `),k=l[f];d+=`[Chat ID: ${f}]
635
637
  `,k?(d+=`- Existing Summary: "${k}"
636
638
  `,d+=`
@@ -640,8 +642,8 @@ ${p}
640
642
  `):d+=`-- Individual Memories:
641
643
  ${p}
642
644
 
643
- `}let u=0,h=5,x=!1,m=ie("gemma_janitor_fallback_google");for(i==="OpenRouter"&&(m=ie("janitor_open_router")),i==="DeepSeek"&&(m=ie("deepseek_level_1")),i==="Mistral"&&(m=ie("mistral_level_1")),i==="NVIDIA"&&(m=ie("nvidia_janitor_fallback")),i==="InferX"&&(m=ie("inferx_fallback")),i==="SenseNova"&&(m=ie("sensenova_fallback")),i==="AIHubMix"&&(m=ie("aihubmix_fallback")),i==="Poolside"&&(m=ie("poolside_fallback")),(i==="9router"||i==="9Router")&&(m=ie("9router_fallback"));u<=h&&!x;){u++;try{let s=(await ki(n,m,d,null,"Fast",.75,"background")).text||"",p=Gn(s);if(p.length===0)throw new Error("No tool calls detected in synthesis response");for(let k of p){let ue=k.toolName;["saveSummary","saveSumary","SaveSummary","SaveSumary"].includes(ue)&&await Ho(ue,k.args,{chatId:e})}x=!0}catch(f){if(u>=h)throw new Error(`Failed after ${h} attempts. Last error: ${f.message}`)}}}catch(i){let o=i instanceof Error?(()=>{try{return JSON.parse(JSON.parse(i.message).error.message).error.message}catch{return String(i)}})():String(i),r=U.join(Sn,"janitor");ge.existsSync(r)||ge.mkdirSync(r,{recursive:!0}),ge.appendFileSync(U.join(r,"error.log"),`[${new Date().toLocaleString()}] Past memory batch consolidation error: ${o}
644
- `)}},Bd=async(e,n,t=!1)=>{let{chatId:i,aiProvider:o="Google"}=e,r=U.join(ti,"chat-summaries.json"),d=s=>s.filter(p=>(p.role==="user"||p.role==="agent"||p.role==="system")&&p.role!=="think"&&!p.isVisualFeedback&&!p.isMeta&&!p.isTerminalRecord&&!(p.text&&p.text.includes("[TERMINAL_RECORD]"))&&!String(p.id).startsWith("welcome")).map(p=>{let k=p.fullText||p.text||"",ue=p.role==="system"||k.startsWith("[ACTION RESULT]:")||k.startsWith("[TOOL RESULT]:")||p.text&&(p.text.startsWith("[ACTION RESULT]:")||p.text.startsWith("[TOOL RESULT]:")),y=k;return ue&&(k.includes("[ACTION RESULT]:")||k.includes("[TOOL RESULT]:")||p.text&&(p.text.includes("[ACTION RESULT]:")||p.text.includes("[TOOL RESULT]:")))?y="[ACTION RESULT]: ...truncated for summary":y=y.replace(/(\[(?:tool|action):[a-zA-Z0-9_\.]+)\([\s\S]*?\)(\])/g,"$1(...)$2"),`[${ue?"ACTION":p.role==="agent"?"AGENT":"USER"}]: ${y}`}).join(`
645
+ `}let u=0,h=5,x=!1,m=ie("gemma_janitor_fallback_google");for(i==="OpenRouter"&&(m=ie("janitor_open_router")),i==="DeepSeek"&&(m=ie("deepseek_level_1")),i==="Mistral"&&(m=ie("mistral_level_1")),i==="NVIDIA"&&(m=ie("nvidia_janitor_fallback")),i==="InferX"&&(m=ie("inferx_fallback")),i==="SenseNova"&&(m=ie("sensenova_fallback")),i==="AIHubMix"&&(m=ie("aihubmix_fallback")),i==="Poolside"&&(m=ie("poolside_fallback")),(i==="9router"||i==="9Router")&&(m=ie("9router_fallback"));u<=h&&!x;){u++;try{let s=(await ki(n,m,d,null,"Fast",.75,"background")).text||"",p=Cn(s);if(p.length===0)throw new Error("No tool calls detected in synthesis response");for(let k of p){let ue=k.toolName;["saveSummary","saveSumary","SaveSummary","SaveSumary"].includes(ue)&&await Go(ue,k.args,{chatId:e})}x=!0}catch(f){if(u>=h)throw new Error(`Failed after ${h} attempts. Last error: ${f.message}`)}}}catch(i){let o=i instanceof Error?(()=>{try{return JSON.parse(JSON.parse(i.message).error.message).error.message}catch{return String(i)}})():String(i),r=U.join(kn,"janitor");ge.existsSync(r)||ge.mkdirSync(r,{recursive:!0}),ge.appendFileSync(U.join(r,"error.log"),`[${new Date().toLocaleString()}] Past memory batch consolidation error: ${o}
646
+ `)}},Ud=async(e,n,t=!1)=>{let{chatId:i,aiProvider:o="Google"}=e,r=U.join(ti,"chat-summaries.json"),d=s=>s.filter(p=>(p.role==="user"||p.role==="agent"||p.role==="system")&&p.role!=="think"&&!p.isVisualFeedback&&!p.isMeta&&!p.isTerminalRecord&&!(p.text&&p.text.includes("[TERMINAL_RECORD]"))&&!String(p.id).startsWith("welcome")).map(p=>{let k=p.fullText||p.text||"",ue=p.role==="system"||k.startsWith("[ACTION RESULT]:")||k.startsWith("[TOOL RESULT]:")||p.text&&(p.text.startsWith("[ACTION RESULT]:")||p.text.startsWith("[TOOL RESULT]:")),y=k;return ue&&(k.includes("[ACTION RESULT]:")||k.includes("[TOOL RESULT]:")||p.text&&(p.text.includes("[ACTION RESULT]:")||p.text.includes("[TOOL RESULT]:")))?y="[ACTION RESULT]: ...truncated for summary":y=y.replace(/(\[(?:tool|action):[a-zA-Z0-9_\.]+)\([\s\S]*?\)(\])/g,"$1(...)$2"),`[${ue?"ACTION":p.role==="agent"?"AGENT":"USER"}]: ${y}`}).join(`
645
647
 
646
648
  `),l=async(s,p)=>{let k="You are an expert context summarizer. Summarize the provided chat history (which may include previous summaries, user instructions, agent outputs, and tool results) into a detailed, coherent, and highly technical summary of 1000 to 1500 words. Focus on preserving the architectural decisions made, current system state, task progress, and critical code details, chat messages, file changes. Under no circumstances exceed MAX 2000 words.",ue=p?`Here is the previous summary:
647
649
  ${p}
@@ -652,9 +654,9 @@ ${s}
652
654
  Provide a new consolidated summary of the entire session.`:`Here is the conversation history:
653
655
  ${s}
654
656
 
655
- Provide a consolidated summary of the entire session.`,y=ie("gemma_janitor_fallback_google");o==="OpenRouter"&&(y=ie("janitor_open_router")),o==="DeepSeek"&&(y=ie("deepseek_level_1")),o==="Mistral"&&(y=ie("mistral_level_1")),o==="NVIDIA"&&(y=ie("nvidia_chat_summarizer_fallback")),o==="InferX"&&(y=ie("inferx_fallback")),o==="SenseNova"&&(y=ie("sensenova_fallback")),o==="AIHubMix"&&(y=ie("aihubmix_fallback")),o==="Poolside"&&(y=ie("poolside_fallback")),(o==="9router"||o==="9Router")&&(y=ie("9router_fallback")),(o==="ExpLabs"||o==="ExperientialLabs")&&(y=ie("explabs_fallback")||"deepseek-v4-pro-0813"),(o==="TokenHarbor"||o==="Token Harbor"||o==="tokenharbor"||o==="token_harbor"||o==="thk")&&(y=ie("tokenharbor_fallback")||"deepseek-v4.1-flash:free"),(o==="Infron"||o==="infron")&&(y=ie("infron_fallback")),(o==="xKiro"||o==="xkiro"||o==="kiro")&&(y=ie("xkiro_fallback")||"openai/gpt-5.6-sol");let A=0,L=!1,W=null;for(;A<=3&&!L;){A++;try{W=await ki(e,y,ue,k,"Fast"),L=!0}catch{if(A>3){if(o==="Google")try{let T=ie("general_fallback");return(await ki(e,T,ue,k,"Fast")).text||""}catch{return""}return""}}}return W&&W.text||""},u=d(n),h=Lt(r,{}),x=h[i]||{summary:"",historyLength:0};typeof x=="string"&&(x={summary:x,historyLength:0});let m=x.summary||"",f=await l(u,m);if(f){x.summary=f;let s=bl(n);return t?x.historyLength=(x.historyLength||0)+s:x.historyLength=s,h[i]=x,go(r,h),f}return null},Ud=e=>{try{let n=U.join(ti,"chat-summaries.json");if(ge.existsSync(n)){let t=Lt(n,{});t[e]&&(delete t[e],go(n,t))}}catch{}},Wd=async function*(e,n,t,i,o){let{profile:r,thinkingLevel:d,mode:l,janitorModel:u,chatId:h,isPlayground:x,systemSettings:m,sessionStats:f,aiProvider:s="Google",apiTier:p,wildcardTooling:k,wildercardTooling:ue}=t,y=dt(e);if(!bs&&s==="Google")throw new Error("AI not initialized");let A=process.env.NVIDIA_BASE_URL||t?.aiProvider==="Ollama"||t?.aiProvider==="InferX"||t?.aiProvider==="SenseNova"||t?.aiProvider==="AIHubMix"||t?.aiProvider==="Poolside"||t?.aiProvider==="9router"||t?.aiProvider==="ExpLabs"||t?.aiProvider==="ExperientialLabs"||t?.aiProvider==="TokenHarbor"||t?.aiProvider==="Token Harbor"||t?.aiProvider==="tokenharbor"||t?.aiProvider==="token_harbor"||t?.aiProvider==="thk"||t?.aiProvider==="APInex"||t?.aiProvider==="apinex"||t?.aiProvider==="apx"||t?.aiProvider==="xKiro"||t?.aiProvider==="xkiro"||t?.aiProvider==="kiro"||t?.aiProvider==="Infron"||t?.aiProvider==="infron"||t?.aiProvider==="c_openai"||t?.aiProvider==="Custom (OpenAI)"?!1:m?.memory!==!1,L=n[n.length-1].text,W=U.join(ti,"chat-summaries.json"),$=!1,T=n.filter(H=>H.role==="user").length===1,we=L.includes("[TITLE-UPDATE]"),_e=T||we,Me=L.replace(/\[TITLE-UPDATE\]/g,"").trim();Me=Me.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),yield{type:"status",content:"[start]"},yield{type:"status",content:"Gathering Context"},await si.startTransaction(h,Me),m?.advanceRollback&&await Mo.takeInitialSnapshot(h),kt=!1;let Ze=null;try{let H=new AbortController;Ze=setInterval(()=>{kt&&(H.abort(),Ze&&(clearInterval(Ze),Ze=null))},400);let b=[...n.slice(0,-1)];{let ve=Lt(W,{})[h]||{summary:"",historyLength:0};if(ve.summary&&ve.historyLength>0){let Xt=0,ke=[];for(let fe=0;fe<b.length;fe++){let We=b[fe];(We.role==="user"||We.role==="agent"||We.role==="system")&&!String(We.id).startsWith("welcome")&&!We.isMeta&&Xt++,Xt>ve.historyLength&&ke.push(We)}b=ke}}b=b.map(P=>{if(P.role==="user"&&P.text){let ve=P.text.match(/\[USER\]([\s\S]*?)\[\/USER\]/);if(ve)return{...P,text:ve[1].trim()}}return{...P}});let Tt=process.env.GOOGLE_GEMMA_NONSENSE==="true"||process.env.GOOGLE_GEMMA_NONSENSE===!0||!1,Fe={"16k":16e3,"32k":32e3,"64k":64e3,"128k":128e3,"256k":256e3,"512k":512e3,"1M":1e6}[m?.contextLength]||256e3;if(s==="Google"&&e?.includes("gemma")&&Tt&&(Fe=16e3),(f?.tokens||0)>Fe){yield{type:"text",content:"\u2726 Maximum Context Limit Reached. Start a new chat."};return}if(T&&A){let P=Lt(ni,{});Object.values(P).flat().length>5&&(yield{type:"status",content:"Condensing past chat memories"},await Al(h,t,P))}let ce=Lt(ni,{}),Bt=Lt($i,{}),Hn=Object.entries(ce).filter(([P])=>P!==h).flatMap(([P,ve])=>ve),Kn=[...Object.entries(Bt).filter(([P])=>P!==h).slice(-20).map(([P,ve])=>`[Chat Summary]: ${ve}`),...Hn].map(P=>`- ${P}`).join(`
656
- `),qt=Lt(no,[]).map(P=>`- ${P.memory}`).join(`
657
- `),de=(f?.tokens||0)>=1e4,Ue=new Date,ze=Ue.getFullYear(),N=Ue.toLocaleString("en-US",{month:"short"}).toUpperCase(),nn=String(Ue.getDate()).padStart(2,"0"),M=`${Ue.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0})}`,C=P=>{try{return ge.readdirSync(P,{withFileTypes:!0})}catch{return[]}},et=Array.from(new Set([..._o,...vo(process.cwd())])),Ge=(P,ve=6)=>m?.indentationTree!==!1?us(P,ve,1,C,et):ms(P,ve,"",1,C,et),S=Lt(Ni,{}),F=S[h],ft=F?F!==process.cwd():!1;S[h]=process.cwd(),go(Ni,S);let it=Lt(W,{}),$e=it[h]||{summary:"",historyLength:0};typeof $e=="string"&&($e={summary:$e,historyLength:0});let ut=n.filter(P=>(P.role==="user"||P.role==="agent"||P.role==="system")&&!String(P.id).startsWith("welcome")&&!P.isMeta).length;$e.historyLength&&ut<$e.historyLength&&($e.summary="",$e.historyLength=0,it[h]=$e,go(W,it));let nt=typeof $e=="object"?$e.summary||"":$e||"",me=b.length>0;me&&nt&&b[0]&&(b[0].role==="user"||b[0].role==="system")&&(b[0].text.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")||(b[0].text=`[SYSTEM METADATA]
657
+ Provide a consolidated summary of the entire session.`,y=ie("gemma_janitor_fallback_google");o==="OpenRouter"&&(y=ie("janitor_open_router")),o==="DeepSeek"&&(y=ie("deepseek_level_1")),o==="Mistral"&&(y=ie("mistral_level_1")),o==="NVIDIA"&&(y=ie("nvidia_chat_summarizer_fallback")),o==="InferX"&&(y=ie("inferx_fallback")),o==="SenseNova"&&(y=ie("sensenova_fallback")),o==="AIHubMix"&&(y=ie("aihubmix_fallback")),o==="Poolside"&&(y=ie("poolside_fallback")),(o==="9router"||o==="9Router")&&(y=ie("9router_fallback")),(o==="ExpLabs"||o==="ExperientialLabs")&&(y=ie("explabs_fallback")||"deepseek-v4-pro-0813"),(o==="TokenHarbor"||o==="Token Harbor"||o==="tokenharbor"||o==="token_harbor"||o==="thk")&&(y=ie("tokenharbor_fallback")||"deepseek-v4.1-flash:free"),(o==="Infron"||o==="infron")&&(y=ie("infron_fallback")),(o==="xKiro"||o==="xkiro"||o==="kiro")&&(y=ie("xkiro_fallback")||"openai/gpt-5.6-sol");let A=0,O=!1,W=null;for(;A<=3&&!O;){A++;try{W=await ki(e,y,ue,k,"Fast"),O=!0}catch{if(A>3){if(o==="Google")try{let T=ie("general_fallback");return(await ki(e,T,ue,k,"Fast")).text||""}catch{return""}return""}}}return W&&W.text||""},u=d(n),h=$t(r,{}),x=h[i]||{summary:"",historyLength:0};typeof x=="string"&&(x={summary:x,historyLength:0});let m=x.summary||"",f=await l(u,m);if(f){x.summary=f;let s=wl(n);return t?x.historyLength=(x.historyLength||0)+s:x.historyLength=s,h[i]=x,uo(r,h),f}return null},Wd=e=>{try{let n=U.join(ti,"chat-summaries.json");if(ge.existsSync(n)){let t=$t(n,{});t[e]&&(delete t[e],uo(n,t))}}catch{}},Gd=async function*(e,n,t,i,o){let{profile:r,thinkingLevel:d,mode:l,janitorModel:u,chatId:h,isPlayground:x,systemSettings:m,sessionStats:f,aiProvider:s="Google",apiTier:p,wildcardTooling:k,wildercardTooling:ue}=t,y=ft(e);if(!bs&&s==="Google")throw new Error("AI not initialized");let A=process.env.NVIDIA_BASE_URL||t?.aiProvider==="Ollama"||t?.aiProvider==="InferX"||t?.aiProvider==="SenseNova"||t?.aiProvider==="AIHubMix"||t?.aiProvider==="Poolside"||t?.aiProvider==="9router"||t?.aiProvider==="ExpLabs"||t?.aiProvider==="ExperientialLabs"||t?.aiProvider==="TokenHarbor"||t?.aiProvider==="Token Harbor"||t?.aiProvider==="tokenharbor"||t?.aiProvider==="token_harbor"||t?.aiProvider==="thk"||t?.aiProvider==="APInex"||t?.aiProvider==="apinex"||t?.aiProvider==="apx"||t?.aiProvider==="xKiro"||t?.aiProvider==="xkiro"||t?.aiProvider==="kiro"||t?.aiProvider==="Infron"||t?.aiProvider==="infron"||t?.aiProvider==="c_openai"||t?.aiProvider==="Custom (OpenAI)"?!1:m?.memory!==!1,O=n[n.length-1].text,W=U.join(ti,"chat-summaries.json"),$=!1,T=n.filter(H=>H.role==="user").length===1,Se=O.includes("[TITLE-UPDATE]"),ve=T||Se,Pe=O.replace(/\[TITLE-UPDATE\]/g,"").trim();Pe=Pe.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),yield{type:"status",content:"[start]"},yield{type:"status",content:"Gathering Context"},await si.startTransaction(h,Pe),m?.advanceRollback&&await Io.takeInitialSnapshot(h),Tt=!1;let Ze=null;try{let H=new AbortController;Ze=setInterval(()=>{Tt&&(H.abort(),Ze&&(clearInterval(Ze),Ze=null))},400);let b=[...n.slice(0,-1)];{let Re=$t(W,{})[h]||{summary:"",historyLength:0};if(Re.summary&&Re.historyLength>0){let qt=0,Ae=[];for(let fe=0;fe<b.length;fe++){let We=b[fe];(We.role==="user"||We.role==="agent"||We.role==="system")&&!String(We.id).startsWith("welcome")&&!We.isMeta&&qt++,qt>Re.historyLength&&Ae.push(We)}b=Ae}}b=b.map(M=>{if(M.role==="user"&&M.text){let Re=M.text.match(/\[USER\]([\s\S]*?)\[\/USER\]/);if(Re)return{...M,text:Re[1].trim()}}return{...M}});let At=process.env.GOOGLE_GEMMA_NONSENSE==="true"||process.env.GOOGLE_GEMMA_NONSENSE===!0||!1,Fe={"16k":16e3,"32k":32e3,"64k":64e3,"128k":128e3,"256k":256e3,"512k":512e3,"1M":1e6}[m?.contextLength]||256e3;if(s==="Google"&&e?.includes("gemma")&&At&&(Fe=16e3),(f?.tokens||0)>Fe){yield{type:"text",content:"\u2726 Maximum Context Limit Reached. Start a new chat."};return}if(T&&A){let M=$t(ni,{});Object.values(M).flat().length>5&&(yield{type:"status",content:"Condensing past chat memories"},await Cl(h,t,M))}let ce=$t(ni,{}),Bt=$t($i,{}),jn=Object.entries(ce).filter(([M])=>M!==h).flatMap(([M,Re])=>Re),Vn=[...Object.entries(Bt).filter(([M])=>M!==h).slice(-20).map(([M,Re])=>`[Chat Summary]: ${Re}`),...jn].map(M=>`- ${M}`).join(`
658
+ `),zt=$t(no,[]).map(M=>`- ${M.memory}`).join(`
659
+ `),de=(f?.tokens||0)>=1e4,Ue=new Date,qe=Ue.getFullYear(),N=Ue.toLocaleString("en-US",{month:"short"}).toUpperCase(),tn=String(Ue.getDate()).padStart(2,"0"),I=`${Ue.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0})}`,C=M=>{try{return ge.readdirSync(M,{withFileTypes:!0})}catch{return[]}},et=Array.from(new Set([...Eo,..._o(process.cwd())])),He=(M,Re=6)=>m?.indentationTree!==!1?us(M,Re,1,C,et):ms(M,Re,"",1,C,et),S=$t(Ni,{}),F=S[h],ut=F?F!==process.cwd():!1;S[h]=process.cwd(),uo(Ni,S);let it=$t(W,{}),Ne=it[h]||{summary:"",historyLength:0};typeof Ne=="string"&&(Ne={summary:Ne,historyLength:0});let gt=n.filter(M=>(M.role==="user"||M.role==="agent"||M.role==="system")&&!String(M.id).startsWith("welcome")&&!M.isMeta).length;Ne.historyLength&&gt<Ne.historyLength&&(Ne.summary="",Ne.historyLength=0,it[h]=Ne,uo(W,it));let nt=typeof Ne=="object"?Ne.summary||"":Ne||"",me=b.length>0;me&&nt&&b[0]&&(b[0].role==="user"||b[0].role==="system")&&(b[0].text.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")||(b[0].text=`[SYSTEM METADATA]
658
660
  **CONTEXT SUMMARY OF PREVIOUS TURNS (PRIORITY: DYNAMIC)**
659
661
  ${nt}
660
662
 
@@ -662,37 +664,37 @@ ${nt}
662
664
  [SYSTEM METADATA]
663
665
  **CONTEXT SUMMARY OF PREVIOUS TURNS**
664
666
  ${nt}
665
- `:"",Wt=!!m?.dynamicDirAwareness,zo=`${h}|${s}|${d}|${e}|${r}|${Wt}`,ga=!Wt&&io.key===zo&&io.value?"":`
667
+ `:"",Wt=!!m?.dynamicDirAwareness,Yo=`${h}|${s}|${d}|${e}|${r}|${Wt}`,ma=!Wt&&io.key===Yo&&io.value?"":`
666
668
  **Directory**
667
669
  CWD: `+process.cwd()+`${x?" [PLAYGROUND MODE]":""}
668
- `+Ge(process.cwd(),6),Gt=ho()?await oo():null,Ss=P=>{if(!P||!Array.isArray(P)||P.length===0)return null;let ve=new Map;for(let ke of P){let fe=ke.relPath||(ke.file?U.relative(process.cwd(),ke.file):"unknown");ve.has(fe)||ve.set(fe,[]),ve.get(fe).push(ke)}let Xt=[];for(let[ke,fe]of ve.entries()){Xt.push(`- ${ke}:`);for(let We of fe){let ot=(We.snippet||"").trim().replace(/\r?\n/g," "),st=We.line||1,Jt=(We.text||"").trim().replace(/\r?\n+/g,". "),vt=Jt?` [${Jt}]`:"";Xt.push(` ~L${st}${vt}`)}}return Xt.join(`
669
- `)},Ti=Ss(Gt?.comments),An="";if(Gt&&Gt.file_focused!=="none"){An=`
670
+ `+He(process.cwd(),6),Gt=po()?await oo():null,Ss=M=>{if(!M||!Array.isArray(M)||M.length===0)return null;let Re=new Map;for(let Ae of M){let fe=Ae.relPath||(Ae.file?U.relative(process.cwd(),Ae.file):"unknown");Re.has(fe)||Re.set(fe,[]),Re.get(fe).push(Ae)}let qt=[];for(let[Ae,fe]of Re.entries()){qt.push(`- ${Ae}:`);for(let We of fe){let ot=(We.snippet||"").trim().replace(/\r?\n/g," "),st=We.line||1,Xt=(We.text||"").trim().replace(/\r?\n+/g,". "),Rt=Xt?` [${Xt}]`:"";qt.push(` ~L${st}${Rt}`)}}return qt.join(`
671
+ `)},Ti=Ss(Gt?.comments),En="";if(Gt&&Gt.file_focused!=="none"){En=`
670
672
  [Additional IDE Context]
671
- `;let P=U.relative(process.cwd(),Gt.file_focused),ve=(Gt.opened_editors||[]).map(ke=>{let fe=U.relative(process.cwd(),ke);return fe.startsWith("..")?`[External] ${U.basename(ke)}`:fe});if(An+=`Focused File: ${P}
673
+ `;let M=U.relative(process.cwd(),Gt.file_focused),Re=(Gt.opened_editors||[]).map(Ae=>{let fe=U.relative(process.cwd(),Ae);return fe.startsWith("..")?`[External] ${U.basename(Ae)}`:fe});if(En+=`Focused File: ${M}
672
674
  Cursor Line: ${Gt.cursor_line}
673
- `,Gt.selected){let ke=Gt.selected,fe=ke.split(`
674
- `);fe.length>256&&(ke=fe.slice(0,240).join(`
675
+ `,Gt.selected){let Ae=Gt.selected,fe=Ae.split(`
676
+ `);fe.length>256&&(Ae=fe.slice(0,240).join(`
675
677
  `)+`
676
678
  ... [truncated] ...
677
679
  `+fe.slice(-16).join(`
678
- `)),ke.length>2048&&(ke=ke.slice(0,1920)+`
680
+ `)),Ae.length>2048&&(Ae=Ae.slice(0,1920)+`
679
681
  ... [truncated] ...
680
- `+ke.slice(-128)),An+=`Current Selection: "${ke}"
681
- `}if(Gt.manual_edits){let ke=Gt.manual_edits.split(`
682
- `),fe=[];for(let We=0;We<ke.length;We++){let ot=ke[We],st=ke[We+1],Jt=ke[We+2];if(st!==void 0&&Jt!==void 0&&/:\s*$/.test(ot)&&/^\s*-\s*/.test(st)&&/^\s*\+\s*/.test(Jt)&&(st.length>300||Jt.length>300)){fe.push(ot.replace(/:\s*$/,": [changed]")),We+=2;continue}fe.push(ot)}An+=`Recent Manual Edits:
682
+ `+Ae.slice(-128)),En+=`Current Selection: "${Ae}"
683
+ `}if(Gt.manual_edits){let Ae=Gt.manual_edits.split(`
684
+ `),fe=[];for(let We=0;We<Ae.length;We++){let ot=Ae[We],st=Ae[We+1],Xt=Ae[We+2];if(st!==void 0&&Xt!==void 0&&/:\s*$/.test(ot)&&/^\s*-\s*/.test(st)&&/^\s*\+\s*/.test(Xt)&&(st.length>300||Xt.length>300)){fe.push(ot.replace(/:\s*$/,": [changed]")),We+=2;continue}fe.push(ot)}En+=`Recent Manual Edits:
683
685
  ${fe.join(`
684
686
  `)}
685
- `}ve.length>0&&(An+=`All Opened Editors: ${ve.join(", ")}`),Gt.diagnostics&&(An+=`
687
+ `}Re.length>0&&(En+=`All Opened Editors: ${Re.join(", ")}`),Gt.diagnostics&&(En+=`
686
688
  **Active File Errors**:
687
689
  ${Gt.diagnostics}
688
- `),(Me.toLowerCase().includes("lint")||Me.toLowerCase().includes("warning"))&&Gt.warnings&&(An+=`
690
+ `),(Pe.toLowerCase().includes("lint")||Pe.toLowerCase().includes("warning"))&&Gt.warnings&&(En+=`
689
691
  **Lint Warnings**:
690
692
  ${Gt.warnings}
691
- `)}let ks=Me.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),Ts=/(?:\\)?@\[([^\]]+)\]/g,Ai,Ci=[];for(Ts.lastIndex=0;(Ai=Ts.exec(ks))!==null;){let P=Ai[0].startsWith("\\");Ci.push({tag:Ai[1],isEscaped:P})}let Ei=[],qo=null;for(let P=0;P<Ci.length;P++){let{tag:ve,isEscaped:Xt}=Ci[P];if(!Xt)try{let ke=ve.trim().replace(/^["']|["']$/g,""),fe=/[:#]L?(\d+)(?:-L?(\d+))?$/i,We=ke.match(fe),ot=ke,st=null,Jt=null;We&&(st=parseInt(We[1],10),Jt=We[2]?parseInt(We[2],10):st,ot=ke.slice(0,We.index));let vt=U.resolve(process.cwd(),ot);if(ge.existsSync(vt)&&ge.statSync(vt).isFile()){let Qt=ot.toLowerCase(),bo=Qt.endsWith(".pdf"),Yn=Qt.endsWith(".docx")||Qt.endsWith(".doc")||Qt.endsWith(".ppt")||Qt.endsWith(".pptx")||Qt.endsWith(".xls")||Qt.endsWith(".xlsx"),zn=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(Qt),qe=zn||bo||Yn,Nt=s==="Google"||dt(e);if(qe&&!Nt){let Re=`\u2718 Unsupported Modality: ${U.basename(ot)}`,gt=115;process.stdout.isTTY&&(gt=process.stdout.columns-5||120);let on=[Re],Xe=Math.max(...on.map(fn=>fn.length)),ee=Math.min(Xe+4,gt),He=on.map(fn=>`${fn.padEnd(ee-2).substring(0,ee-2)}`).join(`
692
- `);yield{type:"visual_feedback",content:zt(`${He}
693
- `)};continue}if(st===null&&!qe){let Re=0;try{Re=ge.readFileSync(vt,"utf8").split(/\r\n|\r|\n/).length}catch{}if(Re>300){let gt=`\u21B7 Skipped (Too Large): ${U.basename(ot)}`,on=115;process.stdout.isTTY&&(on=process.stdout.columns-5||120);let Xe=Math.min(gt.length+4,on),ee=gt.padEnd(Xe-2).substring(0,Xe-2);yield{type:"visual_feedback",content:zt(`${ee}
694
- `)};continue}}let Cn=st!==null?st:1,Ht=Jt!==null?Jt:st!==null?st:Cn+299;Ht-Cn>300&&(Ht=Cn+300);let qn=`path=${JSON.stringify(ot)}, startLine=${Cn}, endLine=${Ht}`,Zt=await js(qn,{isMultiModal:Nt}),Nn=!1,ao="",At=null;if(typeof Zt=="string"?Zt.trim().startsWith("ERROR")?Nn=!0:ao=Zt:Zt&&typeof Zt=="object"&&Zt.binaryPart?(At=Zt.binaryPart,ao=Zt.text||""):Nn=!0,!Nn){let Re="";if(zn?(Re=`\u2714 Processed: ${U.basename(ot)}`,qo=At):bo||Yn?(Re=`\u2714 Auto-Analysed: ${U.basename(ot)}`,qo=At):(Re=`\u2714 Auto-Read: ${U.basename(ot)}`,Ei.push(ao)),Re){let gt=115;process.stdout.isTTY&&(gt=process.stdout.columns-5||120);let on=[Re],Xe=Math.max(...on.map(fn=>fn.length)),ee=Math.min(Xe+4,gt),He=on.map(fn=>`${fn.padEnd(ee-2).substring(0,ee-2)}`).join(`
695
- `);yield{type:"visual_feedback",content:zt(`${He}
693
+ `)}let ks=Pe.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),Ts=/(?:\\)?@\[([^\]]+)\]/g,Ai,Ci=[];for(Ts.lastIndex=0;(Ai=Ts.exec(ks))!==null;){let M=Ai[0].startsWith("\\");Ci.push({tag:Ai[1],isEscaped:M})}let Ei=[],zo=null;for(let M=0;M<Ci.length;M++){let{tag:Re,isEscaped:qt}=Ci[M];if(!qt)try{let Ae=Re.trim().replace(/^["']|["']$/g,""),fe=/[:#]L?(\d+)(?:-L?(\d+))?$/i,We=Ae.match(fe),ot=Ae,st=null,Xt=null;We&&(st=parseInt(We[1],10),Xt=We[2]?parseInt(We[2],10):st,ot=Ae.slice(0,We.index));let Rt=U.resolve(process.cwd(),ot);if(ge.existsSync(Rt)&&ge.statSync(Rt).isFile()){let Jt=ot.toLowerCase(),xo=Jt.endsWith(".pdf"),zn=Jt.endsWith(".docx")||Jt.endsWith(".doc")||Jt.endsWith(".ppt")||Jt.endsWith(".pptx")||Jt.endsWith(".xls")||Jt.endsWith(".xlsx"),qn=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(Jt),Xe=qn||xo||zn,Dt=s==="Google"||ft(e);if(Xe&&!Dt){let Ie=`\u2718 Unsupported Modality: ${U.basename(ot)}`,mt=115;process.stdout.isTTY&&(mt=process.stdout.columns-5||120);let nn=[Ie],Je=Math.max(...nn.map(fn=>fn.length)),ee=Math.min(Je+4,mt),je=nn.map(fn=>`${fn.padEnd(ee-2).substring(0,ee-2)}`).join(`
694
+ `);yield{type:"visual_feedback",content:Yt(`${je}
695
+ `)};continue}if(st===null&&!Xe){let Ie=0;try{Ie=ge.readFileSync(Rt,"utf8").split(/\r\n|\r|\n/).length}catch{}if(Ie>300){let mt=`\u21B7 Skipped (Too Large): ${U.basename(ot)}`,nn=115;process.stdout.isTTY&&(nn=process.stdout.columns-5||120);let Je=Math.min(mt.length+4,nn),ee=mt.padEnd(Je-2).substring(0,Je-2);yield{type:"visual_feedback",content:Yt(`${ee}
696
+ `)};continue}}let _n=st!==null?st:1,Ht=Xt!==null?Xt:st!==null?st:_n+299;Ht-_n>300&&(Ht=_n+300);let Xn=`path=${JSON.stringify(ot)}, startLine=${_n}, endLine=${Ht}`,Qt=await js(Xn,{isMultiModal:Dt}),Fn=!1,ao="",Ct=null;if(typeof Qt=="string"?Qt.trim().startsWith("ERROR")?Fn=!0:ao=Qt:Qt&&typeof Qt=="object"&&Qt.binaryPart?(Ct=Qt.binaryPart,ao=Qt.text||""):Fn=!0,!Fn){let Ie="";if(qn?(Ie=`\u2714 Processed: ${U.basename(ot)}`,zo=Ct):xo||zn?(Ie=`\u2714 Auto-Analysed: ${U.basename(ot)}`,zo=Ct):(Ie=`\u2714 Auto-Read: ${U.basename(ot)}`,Ei.push(ao)),Ie){let mt=115;process.stdout.isTTY&&(mt=process.stdout.columns-5||120);let nn=[Ie],Je=Math.max(...nn.map(fn=>fn.length)),ee=Math.min(Je+4,mt),je=nn.map(fn=>`${fn.padEnd(ee-2).substring(0,ee-2)}`).join(`
697
+ `);yield{type:"visual_feedback",content:Yt(`${je}
696
698
  `)}}}}}catch{}}let _i="";Ei.length>0&&(_i=`
697
699
  [Tagged File Contents] Auto Read User Tagged files by System, No need to re-read
698
700
  `+Ei.join(`
@@ -700,190 +702,190 @@ ${Gt.warnings}
700
702
  `)+`
701
703
  [Tagged File Contents]
702
704
  `);let As=ks.replace(/\\(@\[[^\]]+\])/g,"$1"),Cs=k?`You cannot execute tools. Instead write the action string in chat you WOULD have written
703
- `:"",ma=process.env.forcedReasoning||!1,Es=d!=="Fast"&&(s==="Mistral"&&!ii(e)||d!=="High"&&s==="Google")?`${s==="Mistral"&&!ii(e)||e.toLowerCase().startsWith("gemma")||ma?`[system] strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow> [/system]
704
- `:""}`:"",ro="";if(m?.clipboardContext)try{process.platform==="win32"?ro=ps("powershell.exe -NoProfile -Command Get-Clipboard",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):process.platform==="darwin"?ro=ps("pbpaste",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):ro=ps("xclip -selection clipboard -o || xsel --clipboard --output",{encoding:"utf8",shell:!0,stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,"")}catch{ro=""}let Xo="",pa=!!m?.autoExcludeMetadata,ha=!!(An||_i||Cs||ae||Es||ft||m?.dynamicDirAwareness||m?.autoTruncateResults);pa&&!ha?Xo=As.trim():Xo=`[System Metadata] Time: ${M}${ft?`
705
+ `:"",pa=process.env.forcedReasoning||!1,Es=d!=="Fast"&&(s==="Mistral"&&!ii(e)||d!=="High"&&s==="Google")?`${s==="Mistral"&&!ii(e)||e.toLowerCase().startsWith("gemma")||pa?`[system] strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow> [/system]
706
+ `:""}`:"",ro="";if(m?.clipboardContext)try{process.platform==="win32"?ro=ps("powershell.exe -NoProfile -Command Get-Clipboard",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):process.platform==="darwin"?ro=ps("pbpaste",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):ro=ps("xclip -selection clipboard -o || xsel --clipboard --output",{encoding:"utf8",shell:!0,stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,"")}catch{ro=""}let qo="",ha=!!m?.autoExcludeMetadata,ya=!!(En||_i||Cs||ae||Es||ut||m?.dynamicDirAwareness||m?.autoTruncateResults);ha&&!ya?qo=As.trim():qo=`[System Metadata] Time: ${I}${ut?`
705
707
  WARNING: CWD Changed from previous: "${F}" to current: "${process.cwd()}", write change in chat to avoid future path mismatches
706
- `:""}${An}
708
+ `:""}${En}
707
709
  ${ro.trim().length>0?`[Clipboard Context]
708
710
  - ${ro.trim()}
709
711
  `:""}${Ti?`[Additional Comments]
710
712
  ${Ti.trimEnd()}
711
713
  `:""}Action format: [action:ActionName(...)]
712
714
  [/Metadata]
713
- ${ae}${Es}${_i}${Cs}[user prompt] ${As.trim()} [/user prompt]`.trim();let _s={role:"user",text:Xo};qo&&(_s.binaryPart=qo),b.forEach(P=>{P.text&&P.role==="agent"&&(P.text=Ft(P.text))}),b.push(_s),ae&&n[n.length-1]?.id&&(yield{type:"summary_injected",content:{id:n[n.length-1].id,text:Xo}});let cn=null,dn=l==="Flux"?50:15;dn=l.toLowerCase().includes("cu")?75:dn;let vs=(m?.loopLimits||"Default").toLowerCase();if(vs==="extended")dn=Math.floor(dn*3);else if(vs==="env"){let P=parseInt(process.env.FLUXFLOW_MAX_LOOPS||process.env.MAX_LOOPS||"",10);Number.isFinite(P)&&P>0&&(dn=P)}let ya=Math.floor(dn/2),Rs=0,yn=16;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Consulting the spirits":"Connecting"},kt=!1;let vi=[],Jo=!1,Is=!1,Vn=[],Ri=!1;for(let P=0;P<=dn;P++){let ve=Math.floor(dn*.95);if(P>=ve&&Rs<ve&&typeof t?.onAskUser=="function"){Rs=ve;try{let Y="Agent has been running for a long time. Do you want to continue execution?",Z=[{id:"continue",label:"Continue",description:"Add few more steps"},{id:"cancel",label:"Cancel",description:"Stop extending and finish current turn limit"}],I=await t.onAskUser(Y,Z);I&&(I.toLowerCase().includes("continue")||I==="Continue")&&(dn+=ya)}catch{}}if(Vn.length>=10&&typeof t?.onAskUser=="function"){let Y={},Z=null;for(let I of Vn)if(Y[I]=(Y[I]||0)+1,Y[I]>=10){Z=I;break}if(Z)try{let I="Agent seems stuck in a tool loop. You can prompt it to steer or break the loop:",mt=[{id:"continue",label:"Continue Anyway",description:"Ignore warning and let it proceed"},{id:"stop",label:"Stop Loop",description:"Force agent to summarize progress and stop repeating"}],Ne=await t.onAskUser(I,mt);if(Ne){let Je="";typeof Ne=="string"&&(Ne.toLowerCase()==="stop"||Ne.includes("Stop Loop"))?Je="STOP REPEATING THE SAME TOOL CALL. Acknowledge what failed or succeeded, summarize your current findings, and conclude.":typeof Ne=="string"&&(Ne.toLowerCase()==="continue"||Ne.includes("Continue Anyway"))?Vn=Vn.filter(Rt=>Rt!==Z):Je=typeof Ne=="string"?Ne:Ne?.label||Ne?.id||"",Je&&(b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
715
+ ${ae}${Es}${_i}${Cs}[user prompt] ${As.trim()} [/user prompt]`.trim();let _s={role:"user",text:qo};zo&&(_s.binaryPart=zo),b.forEach(M=>{M.text&&M.role==="agent"&&(M.text=Ft(M.text))}),b.push(_s),ae&&n[n.length-1]?.id&&(yield{type:"summary_injected",content:{id:n[n.length-1].id,text:qo}});let cn=null,dn=l==="Flux"?50:15;dn=l.toLowerCase().includes("cu")?75:dn;let vs=(m?.loopLimits||"Default").toLowerCase();if(vs==="extended")dn=Math.floor(dn*3);else if(vs==="env"){let M=parseInt(process.env.FLUXFLOW_MAX_LOOPS||process.env.MAX_LOOPS||"",10);Number.isFinite(M)&&M>0&&(dn=M)}let xa=Math.floor(dn/2),Rs=0,yn=16;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Consulting the spirits":"Connecting"},Tt=!1;let vi=[],Xo=!1,Is=!1,Yn=[],Ri=!1;for(let M=0;M<=dn;M++){let Re=Math.floor(dn*.95);if(M>=Re&&Rs<Re&&typeof t?.onAskUser=="function"){Rs=Re;try{let Y="Agent has been running for a long time. Do you want to continue execution?",J=[{id:"continue",label:"Continue",description:"Add few more steps"},{id:"cancel",label:"Cancel",description:"Stop extending and finish current turn limit"}],L=await t.onAskUser(Y,J);L&&(L.toLowerCase().includes("continue")||L==="Continue")&&(dn+=xa)}catch{}}if(Yn.length>=10&&typeof t?.onAskUser=="function"){let Y={},J=null;for(let L of Yn)if(Y[L]=(Y[L]||0)+1,Y[L]>=10){J=L;break}if(J)try{let L="Agent seems stuck in a tool loop. You can prompt it to steer or break the loop:",pt=[{id:"continue",label:"Continue Anyway",description:"Ignore warning and let it proceed"},{id:"stop",label:"Stop Loop",description:"Force agent to summarize progress and stop repeating"}],he=await t.onAskUser(L,pt);if(he){let Ke="";typeof he=="string"&&(he.toLowerCase()==="stop"||he.includes("Stop Loop"))?Ke="STOP REPEATING THE SAME TOOL CALL. Acknowledge what failed or succeeded, summarize your current findings, and conclude.":typeof he=="string"&&(he.toLowerCase()==="continue"||he.includes("Continue Anyway"))?Yn=Yn.filter(It=>It!==J):Ke=typeof he=="string"?he:he?.label||he?.id||"",Ke&&(b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
714
716
 
715
- [STEERING HINT from USER, High Priority] ${Je.trim()} [/STEERING HINT]`:b.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${Je.trim()} [/STEERING HINT]`}),yield{type:"status",content:"Steering Hint Injected..."},Vn=Vn.filter(Rt=>Rt!==Z))}}catch{}}let Xt=await Bi("agent",t);if(!Xt.allowed)throw new Error(Xt.reason||`Budget Exhausted for Provider (${s||"Agent"})`);let ke=[];if(Jo=!1,(l==="ICU"||l==="FluxCU")&&!Ri)try{yield{type:"status",content:"Capturing Screen"},await new Promise(I=>setTimeout(I,1e3));let{captureGriddedScreenshot:Y}=await import("./screen_grid-DGIDOOQD.js"),Z=await Y();if(Z&&Z.base64){let I="[system] Fresh Gridded Screen Feedback Captured. Use numeric coordinates. Old screenshots will be removed when new screenshot is captured, summarize in text if context is needed later [/system]",mt={inlineData:{mimeType:Z.mimeType,data:Z.base64}},Ne=m?.imageHistoryCU||"Standard",Je=Ne==="Low"?3:Ne==="Extended"?10:Ne==="Max"?999:5,Rt=b.filter(Ae=>Array.isArray(Ae.parts)&&Ae.parts.some(Ct=>Ct.inlineData));if(Rt.length>=Je){let Ae=Rt.length-Je+1;for(let Ct=0;Ct<Ae;Ct++){let pt=Rt[Ct];Array.isArray(pt.parts)&&(pt.parts=pt.parts.filter(ht=>!ht.inlineData))}}if(b.length>0&&b[b.length-1].role==="user"){let Ae=b[b.length-1];typeof Ae.text=="string"&&(Ae.text+=`
717
+ [STEERING HINT from USER, High Priority] ${Ke.trim()} [/STEERING HINT]`:b.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${Ke.trim()} [/STEERING HINT]`}),yield{type:"status",content:"Steering Hint Injected..."},Yn=Yn.filter(It=>It!==J))}}catch{}}let qt=await Bi("agent",t);if(!qt.allowed)throw new Error(qt.reason||`Budget Exhausted for Provider (${s||"Agent"})`);let Ae=[];if(Xo=!1,(l==="ICU"||l==="FluxCU")&&!Ri)try{yield{type:"status",content:"Capturing Screen"},await new Promise(L=>setTimeout(L,1e3));let{captureGriddedScreenshot:Y}=await import("./screen_grid-AEHMTXP3.js"),J=await Y();if(J&&J.base64){let L="[system] Fresh Gridded Screen Feedback Captured. Use numeric coordinates. Old screenshots will be removed when new screenshot is captured, summarize in text if context is needed later [/system]",pt={inlineData:{mimeType:J.mimeType,data:J.base64}},he=m?.imageHistoryCU||"Standard",Ke=he==="Low"?3:he==="Extended"?10:he==="Max"?999:5,It=b.filter(ke=>Array.isArray(ke.parts)&&ke.parts.some(Et=>Et.inlineData));if(It.length>=Ke){let ke=It.length-Ke+1;for(let Et=0;Et<ke;Et++){let rt=It[Et];Array.isArray(rt.parts)&&(rt.parts=rt.parts.filter(ht=>!ht.inlineData))}}if(b.length>0&&b[b.length-1].role==="user"){let ke=b[b.length-1];typeof ke.text=="string"&&(ke.text+=`
716
718
 
717
- ${I}`,Array.isArray(Ae.parts)||(Ae.parts=[{text:Ae.text}]),Ae.parts.push(mt))}else b.push({role:"user",text:I,parts:[{text:I},mt]})}}catch(Y){console.error("Vision screenshot capture error:",Y)}if(Ri=!1,m?.compression===0&&(f?.tokens||0)>Fe&&(b=Hs(b,6)),P>0?yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Haunting":"Working"}:yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Consulting the spirits":"Connecting"},kt){try{let{clearPendingNudges:Y}=await import("./subagent_state-LZCOZSUJ.js");Y()}catch{}yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
719
+ ${L}`,Array.isArray(ke.parts)||(ke.parts=[{text:ke.text}]),ke.parts.push(pt))}else b.push({role:"user",text:L,parts:[{text:L},pt]})}}catch(Y){console.error("Vision screenshot capture error:",Y)}if(Ri=!1,m?.compression===0&&(f?.tokens||0)>Fe&&(b=Hs(b,6)),M>0?yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Haunting":"Working"}:yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Consulting the spirits":"Connecting"},Tt){try{let{clearPendingNudges:Y}=await import("./subagent_state-LZCOZSUJ.js");Y()}catch{}yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
718
720
 
719
- \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}try{let{consumePendingNudges:Y}=await import("./subagent_state-LZCOZSUJ.js"),Z=Y();if(Z&&Z.length>0){let I=Z.join(`
721
+ \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}try{let{consumePendingNudges:Y}=await import("./subagent_state-LZCOZSUJ.js"),J=Y();if(J&&J.length>0){let L=J.join(`
720
722
 
721
723
  `);b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
722
724
 
723
- ${I}`:b.push({role:"user",text:I}),yield{type:"status",content:"Subagent Update"}}}catch{}if(i){let Y=await i();Y&&(Y.startsWith("/btw")?b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
725
+ ${L}`:b.push({role:"user",text:L}),yield{type:"status",content:"Subagent Update"}}}catch{}if(i){let Y=await i();Y&&(Y.startsWith("/btw")?b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
724
726
 
725
727
  [system] User question. Resolve this specific query within '[ANSWER]...[/ANSWER]' concisely, naturally [/system]
726
728
  [question] ${Y.replace("/btw","").trim()} [/question]`:b.push({role:"user",text:`[system] User question. Resolve this specific query within '[ANSWER]...[/ANSWER]' concisely, naturally [/system]
727
729
  [question] ${Y.replace("/btw","").trim()} [/question]`}):b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
728
730
 
729
- [STEERING HINT from USER, High Priority] ${Y.trim()} [/STEERING HINT]`:b.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${Y.trim()} [/STEERING HINT]`}),yield{type:"status",content:`${Y.startsWith("/btw")?"Question Forwarded...":"Steering Hint Injected..."}`})}let fe,We=!1,ot=1,st=1,Jt=Date.now(),vt=null,Ce="",Qt=null,bo=null,Yn=null,zn=0,qe=[],Nt=0,Cn=!1,Ht=!1,qn=!1,Zt=!1,Nn=!0,ao=0,At="",Re="",gt=!1,on=!1,Xe=!0,ee=e,He="",fn=d;for(d=d.toLowerCase()==="max"?"High":d;ot<=yn&&st<=yn&&!We&&!kt;){let Y=!1;try{Ce="",Nn&&(process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07"),yield{type:"turn_reset",content:!0},Nn=!1,st===1&&(At=""));let Z=g=>{if(!g||typeof g!="string")return g;let E="",_=ys(g);if(_&&(E=_.fullBlock,g=_.remainingText),!g.includes("[tool:")&&!g.includes("[action:"))return(m?.keepReasoningContext?E:"")+g;if(Gn(g).length===0){let w=wi(g);return(m?.keepReasoningContext?E:"")+w}g=g.replace(yl,(w,v)=>v.includes("[tool:")||v.includes("[action:")?v.trim():w);let se="",D=0,q=[],xt="";for(;D<g.length;){let w=g.indexOf("[tool:",D),v=g.indexOf("[action:",D),te=-1;if(w!==-1&&v!==-1?te=Math.min(w,v):w!==-1?te=w:te=v,te===-1){q.length===0&&(se+=wi(g.substring(D)));break}if((te>0?g[te-1]:"")==="`"){se+=wi(g.substring(D,te+1)),D=te+1;continue}q.length===0&&(xt=wi(g.substring(D,te)));let J=-1,O=null,bt=0;for(let Kt=te;Kt<g.length;Kt++){let ne=g[Kt];if(O){if(ne===O){let tt=0;for(let wt=Kt-1;wt>=0&&g[wt]==="\\";wt--)tt++;tt%2===0&&(O=null)}}else if(ne==='"'||ne==="'"||ne==="`")O=ne;else if(ne==="(")bt++;else if(ne===")")bt--;else if(ne==="]"&&bt<=0){J=Kt;break}}if(J===-1){q.length===0&&(se+=g.substring(te));break}let _n=g.substring(te,J+1);q.push(_n),D=J+1}return q.length>0&&(se=xt.trimEnd()?xt.trimEnd()+`
731
+ [STEERING HINT from USER, High Priority] ${Y.trim()} [/STEERING HINT]`:b.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${Y.trim()} [/STEERING HINT]`}),yield{type:"status",content:`${Y.startsWith("/btw")?"Question Forwarded...":"Steering Hint Injected..."}`})}let fe,We=!1,ot=1,st=1,Xt=Date.now(),Rt=null,Ee="",Jt=null,xo=null,zn=null,qn=0,Xe=[],Dt=0,_n=!1,Ht=!1,Xn=!1,Qt=!1,Fn=!0,ao=0,Ct="",Ie="",mt=!1,nn=!1,Je=!0,ee=e,je="",fn=d;for(d=d.toLowerCase()==="max"?"High":d;ot<=yn&&st<=yn&&!We&&!Tt;){let Y=!1;try{Ee="",Fn&&(process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07"),yield{type:"turn_reset",content:!0},Fn=!1,st===1&&(Ct=""));let J=g=>{if(!g||typeof g!="string")return g;let E="",_=ys(g);if(_&&(E=_.fullBlock,g=_.remainingText),!g.includes("[tool:")&&!g.includes("[action:"))return(m?.keepReasoningContext?E:"")+g;if(Cn(g).length===0){let w=wi(g);return(m?.keepReasoningContext?E:"")+w}g=g.replace(xl,(w,v)=>v.includes("[tool:")||v.includes("[action:")?v.trim():w);let se="",D=0,q=[],bt="";for(;D<g.length;){let w=g.indexOf("[tool:",D),v=g.indexOf("[action:",D),te=-1;if(w!==-1&&v!==-1?te=Math.min(w,v):w!==-1?te=w:te=v,te===-1){q.length===0&&(se+=wi(g.substring(D)));break}if((te>0?g[te-1]:"")==="`"){se+=wi(g.substring(D,te+1)),D=te+1;continue}q.length===0&&(bt=wi(g.substring(D,te)));let Q=-1,P=null,wt=0;for(let jt=te;jt<g.length;jt++){let ne=g[jt];if(P){if(ne===P){let tt=0;for(let St=jt-1;St>=0&&g[St]==="\\";St--)tt++;tt%2===0&&(P=null)}}else if(ne==='"'||ne==="'"||ne==="`")P=ne;else if(ne==="(")wt++;else if(ne===")")wt--;else if(ne==="]"&&wt<=0){Q=jt;break}}if(Q===-1){q.length===0&&(se+=g.substring(te));break}let Rn=g.substring(te,Q+1);q.push(Rn),D=Q+1}return q.length>0&&(se=bt.trimEnd()?bt.trimEnd()+`
730
732
 
731
733
  `+q.join(`
732
734
 
733
735
  `):q.join(`
734
736
 
735
- `)),(m?.keepReasoningContext?E:"")+se},I=b.filter(g=>(g.role==="user"||g.role==="agent"||g.role==="system")&&!String(g.id).startsWith("welcome")&&!g.isMeta&&!g.isTerminalRecord&&!(g.text&&g.text.startsWith("[TERMINAL_RECORD]"))).map((g,E,_)=>{let z=g.text||"";A||(z=z.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),g.role==="agent"&&(z=Z(z),z=z.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),z=z.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*"));let se=[];return Array.isArray(g.parts)&&g.parts.length>0?se=g.parts.map(D=>{if(D.text){let q=D.text;return A||(q=q.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),g.role==="agent"&&(q=Z(q),q=q.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),q=q.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*")),{text:q}}return D}):se=[{text:z}],g.binaryPart&&dt(ee)&&_.slice(E+1).filter(q=>q.role==="user"&&!q.text?.startsWith("[ACTION RESULT]")&&!q.text?.startsWith("[TOOL RESULT]")).length<=2&&se.push(g.binaryPart),{role:g.role==="user"||g.role==="system"?"user":"model",parts:se}});for(let g=I.length-2;g>=0;g--){let E=I[g],_=I[g+1];E.role==="user"&&_.role==="user"&&(_.parts?.[0]?.text||"").trim().startsWith("[SYSTEM")&&I.splice(g,1)}let mt=[];for(let g=0;g<I.length;g++){let E=I[g];if(mt.length===0)mt.push(E);else{let _=mt[mt.length-1];_.role===E.role?(_.parts[0].text+=`
737
+ `)),(m?.keepReasoningContext?E:"")+se},L=b.filter(g=>(g.role==="user"||g.role==="agent"||g.role==="system")&&!String(g.id).startsWith("welcome")&&!g.isMeta&&!g.isTerminalRecord&&!(g.text&&g.text.startsWith("[TERMINAL_RECORD]"))).map((g,E,_)=>{let z=g.text||"";A||(z=z.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),g.role==="agent"&&(z=J(z),z=z.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),z=z.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*"));let se=[];return Array.isArray(g.parts)&&g.parts.length>0?se=g.parts.map(D=>{if(D.text){let q=D.text;return A||(q=q.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),g.role==="agent"&&(q=J(q),q=q.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),q=q.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*")),{text:q}}return D}):se=[{text:z}],g.binaryPart&&ft(ee)&&_.slice(E+1).filter(q=>q.role==="user"&&!q.text?.startsWith("[ACTION RESULT]")&&!q.text?.startsWith("[TOOL RESULT]")).length<=2&&se.push(g.binaryPart),{role:g.role==="user"||g.role==="system"?"user":"model",parts:se}});for(let g=L.length-2;g>=0;g--){let E=L[g],_=L[g+1];E.role==="user"&&_.role==="user"&&(_.parts?.[0]?.text||"").trim().startsWith("[SYSTEM")&&L.splice(g,1)}let pt=[];for(let g=0;g<L.length;g++){let E=L[g];if(pt.length===0)pt.push(E);else{let _=pt[pt.length-1];_.role===E.role?(_.parts[0].text+=`
736
738
 
737
- `+(E.parts?.[0]?.text||""),E.parts?.length>1&&_.parts.push(...E.parts.slice(1))):mt.push(E)}}for(let g of mt)for(let E of g.parts||[])E&&typeof E.text=="string"&&(E.text.includes("[action:")||E.text.includes("[tool:"))&&(E.text=E.text.replace(/```(?:[a-zA-Z0-9_-]+)?\s*\n?(\[(?:action|tool):[\s\S]*?\)\s*\])\n?```/gi,"$1"),E.text=E.text.replace(/`(\[(?:action|tool):[\s\S]*?\)\s*\])`/gi,"$1"));I.length=0,I.push(...mt),ee=e;let Ne=`${h}|${s}|${l}|${d}|${fn}|${ee}|${JSON.stringify(r)}|${!!m?.dynamicDirAwareness}|${!!m?.subAgents}`,Je=io.key===Ne&&io.value;if((process.env.I_HAVE_TOO_MUCH_MONEY==="true"||process.env.I_HAVE_TOO_MUCH_MONEY===!0)&&(Je=!1),Je)He=io.value;else{let g=s==="Mistral"?!!ii(ee):!(ee||"gemma").toLowerCase().startsWith("gemma");He=Ir(r,((ee||"gemma").toLowerCase().startsWith("gemma"),fn),l,m,A,T,s,s==="Google"?!0:y,g,h,!!m?.keepReasoningContext,ee),m?.dynamicDirAwareness||(He+=`
738
- ${ga.replace(`
739
+ `+(E.parts?.[0]?.text||""),E.parts?.length>1&&_.parts.push(...E.parts.slice(1))):pt.push(E)}}for(let g of pt)for(let E of g.parts||[])E&&typeof E.text=="string"&&(E.text.includes("[action:")||E.text.includes("[tool:"))&&(E.text=E.text.replace(/```(?:[a-zA-Z0-9_-]+)?\s*\n?(\[(?:action|tool):[\s\S]*?\)\s*\])\n?```/gi,"$1"),E.text=E.text.replace(/`(\[(?:action|tool):[\s\S]*?\)\s*\])`/gi,"$1"));L.length=0,L.push(...pt),ee=e;let he=`${h}|${s}|${l}|${d}|${fn}|${ee}|${JSON.stringify(r)}|${!!m?.dynamicDirAwareness}|${!!m?.subAgents}`,Ke=io.key===he&&io.value;if((process.env.I_HAVE_TOO_MUCH_MONEY==="true"||process.env.I_HAVE_TOO_MUCH_MONEY===!0)&&(Ke=!1),Ke)je=io.value;else{let g=s==="Mistral"?!!ii(ee):!(ee||"gemma").toLowerCase().startsWith("gemma");je=Ir(r,((ee||"gemma").toLowerCase().startsWith("gemma"),fn),l,m,A,T,s,s==="Google"?!0:y,g,h,!!m?.keepReasoningContext,ee),m?.dynamicDirAwareness||(je+=`
740
+ ${ma.replace(`
739
741
  **Directory**`,`
740
- -- Directory --`)}`),io.key=Ne,io.value=He}let Ae=I[I.length-1];if(ho()&P>0){await new Promise(z=>setTimeout(z,2500)),yield{type:"status",content:"Verifying"};let g=await oo(),E=g?g.diagnostics:null,_=Ss(g?.comments);E&&Ae&&Ae.role==="user"&&Ae.parts?.[0]?.text&&(Ae.parts[0].text+=`
742
+ -- Directory --`)}`),io.key=he,io.value=je}let ke=L[L.length-1];if(po()&M>0){await new Promise(z=>setTimeout(z,2500)),yield{type:"status",content:"Verifying"};let g=await oo(),E=g?g.diagnostics:null,_=Ss(g?.comments);E&&ke&&ke.role==="user"&&ke.parts?.[0]?.text&&(ke.parts[0].text+=`
741
743
 
742
- ${E}`),Ti&&Ae&&Ae.role==="user"&&Ae.parts?.[0]?.text&&(Ae.parts[0].text+=`
744
+ ${E}`),Ti&&ke&&ke.role==="user"&&ke.parts?.[0]?.text&&(ke.parts[0].text+=`
743
745
 
744
746
  [Additional Comments]
745
- ${_}`),yield{type:"status",content:"Working"}}let Ct=s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma");if(m?.advanceRollback&&Ae&&Ae.role==="user"&&(Ae.parts?.[0]?.text?.startsWith("[ACTION RESULT]")||Ae.parts?.[0]?.text?.startsWith("[TOOL RESULT]")))try{let g=await Mo.getLatestFileChanges(h);if(g&&(g.newFiles.length>0||g.modifiedFiles.length>0||g.deletedFiles.length>0)){let E=`
747
+ ${_}`),yield{type:"status",content:"Working"}}let Et=s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma");if(m?.advanceRollback&&ke&&ke.role==="user"&&(ke.parts?.[0]?.text?.startsWith("[ACTION RESULT]")||ke.parts?.[0]?.text?.startsWith("[TOOL RESULT]")))try{let g=await Io.getLatestFileChanges(h);if(g&&(g.newFiles.length>0||g.modifiedFiles.length>0||g.deletedFiles.length>0)){let E=`
746
748
  [system] File Changes:
747
749
  `;for(let z of g.newFiles)E+=`* ${z} (created)
748
750
  `;for(let z of g.modifiedFiles)E+=`* ${z} (modified)
749
751
  `;for(let z of g.deletedFiles)E+=`* ${z} (deleted)
750
- `;E+="[/system]",Ae.parts[0].text+=E;let _=-1;for(let z=b.length-1;z>=0;z--)if(b[z].role==="user"&&(b[z].text?.startsWith("[ACTION RESULT]")||b[z].text?.startsWith("[TOOL RESULT]"))){_=z;break}_!==-1&&(b[_].text+=E)}}catch{}let pt=Math.floor(dn*.99),ht=P+1;if(ht>=pt&&Ae&&Ae.parts?.[0]&&(Ae.parts[0].text+=`
751
- [system] WARNING, Turn Limit Impending: Step ${ht}/${dn}. Wrap up quickly/prompt user to continue. [/system]`),process.env.LOG_CHAT==="true"||process.env.LOG_CHAT==="1"||process.env.LOG_CHAT===!0||!1){let g=U.join(Sn,"chats",String(h));ge.existsSync(g)||ge.mkdirSync(g,{recursive:!0}),ge.writeFileSync(U.join(g,"context.json"),JSON.stringify({contents:I},null,2)),ge.writeFileSync(U.join(g,"system.md"),`${Je?"CACHED":"NOT CACHED"}
752
- Key: ${Ne}
752
+ `;E+="[/system]",ke.parts[0].text+=E;let _=-1;for(let z=b.length-1;z>=0;z--)if(b[z].role==="user"&&(b[z].text?.startsWith("[ACTION RESULT]")||b[z].text?.startsWith("[TOOL RESULT]"))){_=z;break}_!==-1&&(b[_].text+=E)}}catch{}let rt=Math.floor(dn*.99),ht=M+1;if(ht>=rt&&ke&&ke.parts?.[0]&&(ke.parts[0].text+=`
753
+ [system] WARNING, Turn Limit Impending: Step ${ht}/${dn}. Wrap up quickly/prompt user to continue. [/system]`),process.env.LOG_CHAT==="true"||process.env.LOG_CHAT==="1"||process.env.LOG_CHAT===!0||!1){let g=U.join(kn,"chats",String(h));ge.existsSync(g)||ge.mkdirSync(g,{recursive:!0}),ge.writeFileSync(U.join(g,"context.json"),JSON.stringify({contents:L},null,2)),ge.writeFileSync(U.join(g,"system.md"),`${Ke?"CACHED":"NOT CACHED"}
754
+ Key: ${he}
753
755
  --------------------------------------------------------------------
754
756
 
755
- ${He}`)}let Dt=new Promise((g,E)=>{H.signal.aborted&&E(new DOMException("The user aborted a request.","AbortError")),H.signal.addEventListener("abort",()=>{E(new DOMException("The user aborted a request.","AbortError"))})});Dt.catch(()=>{});let je=I;if(Jt=Date.now(),s==="Ollama")fe=(await re("Ollama"))(t.apiKey,ee,je,He,d,l,y,H.signal,1,m?.ollamaEndpoint||"Cloud");else if(s==="OpenRouter")fe=(await re("OpenRouter"))(t.apiKey,ee,je,He,d,l,y,H.signal,1,h);else if(s==="DeepSeek")fe=(await re("DeepSeek"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="Mistral")fe=(await re("Mistral"))(t.apiKey,ee,je,He,d,l,y,H.signal,1,h);else if(s==="NVIDIA"){let g=(await re("NVIDIA"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);fe=(await re("NVIDIA_wrap"))(g,ee)}else if(s==="InferX")fe=(await re("InferX"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="SenseNova")fe=(await re("SenseNova"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="AIHubMix")fe=(await re("AIHubMix"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="Poolside")fe=(await re("Poolside"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="9router"||s==="9Router")fe=(await re("NineRouter"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="ExpLabs"||s==="ExperientialLabs")fe=(await re("ExpLabs"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="Infron"||s==="infron")fe=(await re("Infron"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="TokenHarbor"||s==="Token Harbor"||s==="tokenharbor"||s==="token_harbor"||s==="thk")fe=(await re("TokenHarbor"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="APInex"||s==="apinex"||s==="apx")fe=(await re("APInex"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="xKiro"||s==="xkiro"||s==="kiro")fe=(await re("xKiro"))(t.apiKey,ee,je,He,d,l,y,H.signal,1);else if(s==="c_openai"||s==="Custom (OpenAI)"){let g=m?.customOpenAIBaseUrl||"";try{g=await Di("c_openai")||g}catch{}fe=(await re("c_openai"))(t.apiKey,ee,je,He,d,l,y,H.signal,1,g)}else{let g=ws(t?.apiKey),{serviceTier:E,cleanModel:_}=ua(ee),z={systemInstruction:He,mediaResolution:"MEDIA_RESOLUTION_HIGH",safetySettings:[{category:Wn.HARM_CATEGORY_HARASSMENT,threshold:Un.BLOCK_NONE},{category:Wn.HARM_CATEGORY_HATE_SPEECH,threshold:Un.BLOCK_NONE},{category:Wn.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Un.BLOCK_NONE},{category:Wn.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Un.BLOCK_NONE}],temperature:1.05,thinkingConfig:(()=>{let D=Gs("Google",ee||"gemini-3-flash-preview",d);if(D!==null){if(typeof D=="object")return D;if(D===!1||D==="false"||D==="none"||D===0||D==="0")return{includeThoughts:!1};if(typeof D=="number")return{includeThoughts:!0,thinkingBudget:D};if(typeof D=="string"){let v=D.toLowerCase();if(v==="minimal")return{includeThoughts:!0,thinkingLevel:Qe.MINIMAL};if(v==="low")return{includeThoughts:!0,thinkingLevel:Qe.LOW};if(v==="medium")return{includeThoughts:!0,thinkingLevel:Qe.MEDIUM};if(v==="high")return{includeThoughts:!0,thinkingLevel:Qe.HIGH};let te=Number(D);if(!isNaN(te))return{includeThoughts:!0,thinkingBudget:te}}}let q=(ee||"").toLowerCase(),xt=q.includes("gemma-4")||q.startsWith("gemma"),w=q.includes("gemini-3");if(xt||w)return xt?d.toLowerCase()!=="high"?{includeThoughts:!1,thinkingLevel:Qe.MINIMAL}:{includeThoughts:!0,thinkingLevel:Qe.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:q.includes("pro")?Qe.LOW:Qe.MINIMAL,Low:Qe.LOW,Medium:Qe.MEDIUM,Standard:Qe.MEDIUM,High:Qe.HIGH,xHigh:Qe.HIGH}[d]||Qe.MEDIUM};{let v={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[d]||2048;return v===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:v}}})()};E&&(z.serviceTier=E);let se=g.models.generateContentStream({model:_||"gemini-3-flash-preview",contents:je,config:z},{signal:H.signal});fe=await Promise.race([se,Dt])}Ce="",Qt=null,Yn=null,qe=[],Nt=0,yield{type:"model_update",content:null},Re="",gt=At.length>0;let jt="",lo=Date.now(),Jn=async function*(){if(s==="Google"&&jt){let g=So(jt);for(let E of g)yield E;jt="",lo=Date.now()}},Ms=!0,En="",co=!1,yt=null,Ps=!1,Qn=!1,fo=!1,Qo=!1,Dn=!1,wo=g=>{let E=0;for(;E+2<g.length;)g[E]==="`"&&g[E+1]==="`"&&g[E+2]==="`"?(Qo=!Qo,E+=3):E++},Os=g=>{if(!g)return;let E=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,_;for(;(_=E.exec(g))!==null;){let z=_[0].toLowerCase();z.startsWith("</")||z.startsWith("[/")||z==="<channel|>"?Dn=!1:Dn=!0}},ka={tool:{startPrefix:"[tool",fullPrefix:"[tool:",endTag:"]"},action:{startPrefix:"[action",fullPrefix:"[action:",endTag:"]"},end:{startPrefix:"[[END]]",fullPrefix:"[[END]]",endTag:"[[END]]"},kimi_section:{startPrefix:"<|tool_calls_section_begin|>",fullPrefix:"<|tool_calls_section_begin|>",endTag:"<|tool_calls_section_end|>"},kimi_call:{startPrefix:"<|tool_call_begin|>",fullPrefix:"<|tool_call_begin|>",endTag:"<|tool_call_end|>"}},So=g=>{let E=[],_=g,z=se=>{if(!se)return;if(!Ps){E.push({type:"text",content:se}),wo(se),Os(se);return}let D=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,q=0,xt;for(;(xt=D.exec(se))!==null;){let v=se.substring(q,xt.index);if(v)if(wo(v),Dn)E.push({type:"text",content:v});else{let De=v.replace(/[^\r\n]/g,"");De&&E.push({type:"text",content:De})}let te=xt[0];wo(te);let a=te.toLowerCase();a.startsWith("</")||a.startsWith("[/")||a==="<channel|>"?Dn=!1:Dn=!0,E.push({type:"text",content:te}),q=D.lastIndex}let w=se.substring(q);if(w)if(wo(w),Dn)E.push({type:"text",content:w});else{let v=w.replace(/[^\r\n]/g,"");v&&E.push({type:"text",content:v})}};for(;_.length>0;)if(co){let se=En+_,D=ka[yt];if(D){let w=!1;if(se.length<D.startPrefix.length?D.startPrefix.startsWith(se)||(w=!0):se.startsWith(D.startPrefix)?se.length>=D.fullPrefix.length&&!se.startsWith(D.fullPrefix)&&(w=!0):w=!0,w){z(se),En="",co=!1,yt=null,Qn=!1,fo=!1,_="";break}}let q=-1,xt=D?D.endTag:"]";if(yt==="tool"||yt==="action"){let w=0,v=null,te=0,a=!1;for(let De=0;De<se.length;De++){let J=se[De];if(v){if(J===v){let O=0;for(let bt=De-1;bt>=0&&se[bt]==="\\";bt--)O++;O%2===0&&(v=null)}}else if(J==='"'||J==="'")v=J;else if(J==="`")if(Qn){q=De;break}else v=J;else if(J==="(")w++,a=!0;else if(J===")")w--;else if(J==="]"&&a&&w===0){q=De;break}}}else q=se.indexOf(xt);if(q!==-1){let w=xt.length,v=se.substring(0,q+w);yt?.startsWith("kimi")||E.push({type:"text",content:v}),wo(v),Os(v),(yt==="tool"||yt==="action"||yt?.startsWith("kimi"))&&!Qn&&!fo&&(Ps=!0,Vn.push(v.trim())),Qn=!1,fo=!1,En="",co=!1,yt=null,_=se.substring(q+w)}else{En=se,_="";break}}else{let se=_.indexOf("[tool"),D=_.indexOf("[action"),q=_.indexOf("[[END]]"),xt=_.indexOf("<|tool_calls_section_begin|>"),w=_.indexOf("<|tool_call_begin|>"),v=[{type:"tool",idx:se,start:"[tool",end:"]"},{type:"action",idx:D,start:"[action",end:"]"},{type:"end",idx:q,start:"[[END]]",end:"[[END]]"},{type:"kimi_section",idx:xt,start:"<|tool_calls_section_begin|>",end:"<|tool_calls_section_end|>"},{type:"kimi_call",idx:w,start:"<|tool_call_begin|>",end:"<|tool_call_end|>"}].filter(te=>te.idx!==-1).sort((te,a)=>te.idx-a.idx);if(v.length>0){let te=v[0],a=_.substring(0,te.idx);te.idx>0&&z(a);let De=te.idx>0?_[te.idx-1]:"";Qn=Qo||De==="`",fo=Dn,co=!0,yt=te.type,En="",_=_.substring(te.idx)}else{let te=["[tool","[action","[[END]]","<|tool_calls_section_begin|>","<|tool_call_begin|>"],a=-1;for(let De of te){for(let J=De.length-1;J>0;J--)if(_.endsWith(De.substring(0,J))){a=_.length-J;let O=te.indexOf(De);O===0?yt="tool":O===1?yt="action":O===2?yt="end":O===3?yt="kimi_section":yt="kimi_call";break}if(a!==-1)break}if(a!==-1){if(a>0){let J=_.substring(0,a);z(J)}let De=a>0?_[a-1]:"";Qn=Qo||De==="`",fo=Dn,co=!0,En=_.substring(a),_=""}else{z(_);break}}}return E},Ta=fe[Symbol.asyncIterator]();for(;;){let{value:g,done:E}=await Promise.race([Ta.next(),Dt]);if(E)break;if(g&&g.type==="status"){yield g;continue}let _="",z=g.candidates?.[0]?.content?.parts;if(z&&z.length>0)for(let D of z){let q=typeof D.text=="string"?D.text:D.text?parseChunkText(D.text):"";D.thought?q&&(Y||(_+="<think_fluxflow>",Y=!0),_+=q):q&&(Y&&(_+="</think_fluxflow>",Y=!1),_+=q)}else g.text&&Y&&(_+="</think_fluxflow>",Y=!1);_=gl(_);let se=_?Ui(_):0;if(t&&typeof t.onTokenChunk=="function"&&t.onTokenChunk(_,se),Ms&&(vt===null&&(vt=Date.now()-Jt),yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"},Ms=!1),kt){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
756
-
757
- \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(_){if(gt){if(Re+=_,Re.length>=64){let w=0,v=Math.min(At.length,Re.length);for(let a=v;a>=10;a--)if(At.endsWith(Re.substring(0,a))){w=a;break}let te=Re.substring(w);if(te){let De=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(At)?te.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):te.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(De)if(Ce+=De,s==="Google")jt+=De;else{yield*Jn();let J=So(De);for(let O of J)yield O}}gt=!1,Re=""}continue}else if(Ce+=_,s==="Google")jt+=_;else{yield*Jn();let w=So(_);for(let v of w)yield v}let D=Sl(Ce);if(D.inside){on=!0,Yn||(Yn=Date.now());let v={Ask:"ask",AskUser:"ask",WebSearch:"web_search",WebScrape:"web_scrape",ReadFile:"view_file",ReadFolder:"read_folder",WriteFile:"write_file",PatchFile:"update_file",WritePDF:"write_pdf",WriteDoc:"write_docx",FindFile:"find_file",find_file:"find_file",findfile:"find_file",Run:"exec_command",SearchKeyword:"search_keyword",CodeSearch:"search_keyword",code_search:"search_keyword",Code_Search:"search_keyword",codesearch:"search_keyword",Memory:"memory",file_map:"file_map",FileMap:"file_map",Chat:"chat",chat:"chat",GenerateImage:"generate_image",generate_image:"generate_image",todo:"todo",Todo:"todo",goal:"todo",Goal:"todo",Invoke:"invoke",InvokeSync:"invoke_sync",getProgress:"get_progress",GetProgress:"get_progress",Cancel:"cancel",Await:"await",wait:"wait",Answer:"answer",Steer:"steer",steer:"steer"}[D.toolName]||D.toolName,te=D.args||"",a=null;if(["write_file","update_file","view_file","read_folder","find_file","write_pdf","write_docx","search_keyword","generate_image","file_map","invoke","invoke_sync","get_progress","await","wait","answer"].includes(v)){let J=B(te),O=J.basename||J.name||J.path||J.targetFile||J.TargetFile||J.directory||J.file,bt=J.keyword,_n=J.title||J.task,Kt=J.id||J.taskId,ne=J.timeout||J.time||J.seconds||J.sec;if(bt!=null)a=String(bt).replace($n,"");else if(O)a=U.basename(String(O).replace($n,"").replace(oa,"/"));else if(_n&&(v==="invoke"||v==="invoke_sync"))a=String(_n).replace($n,"").substring(0,30);else if(Kt&&v==="get_progress")a=String(Kt).replace($n,"");else if(ne&&v==="await"){let tt=parseFloat(String(ne).replace($n,""));isNaN(tt)?a=String(ne).replace($n,""):(tt<5&&(tt=5),tt>120&&(tt=180),a=(Vt=>{if(Vt>=60){let To=Math.floor(Vt/60),vn=Vt%60;return`${To}m${vn>0?` ${vn}s`:""}`}return`${Vt}s`})(tt))}else if(ne&&v==="wait"){let tt=parseFloat(String(ne).replace($n,""));isNaN(tt)?a=String(ne).replace($n,""):(tt<10&&(tt=10),tt>120&&(tt=120),a=(Vt=>{if(Vt>=60){let To=Math.floor(Vt/60),vn=Vt%60;return`${To}m${vn>0?` ${vn}s`:""}`}return`${Vt}s`})(tt))}else{let tt=te.match(dl);if(tt){let wt=tt[1].replace($n,"");v==="invoke"||v==="invoke_sync"||v==="get_progress"?a=wt.substring(0,30):a=v==="search_keyword"||v==="file_map"?wt:U.basename(wt.replace(oa,"/"))}}}let De=`${xs[v]||v}${a?` ${a}`:""}`;if((v!==Qt||a!==bo)&&(Qt=v,bo=a,yield{type:"status",content:`${De}`},process.stdout.isTTY)){let O={WebSearch:"Searching",web_search:"Searching",WebScrape:"Reading",web_scrape:"Reading",ReadFile:"Reading",read_file:"Reading",ReadFolder:"Reading",read_folder:"Reading",WriteFile:"Writing",write_file:"Writing",UpdateFile:"Editing",update_file:"Editing",WritePdf:"Creating",write_pdf:"Creating",WriteDocx:"Creating",write_docx:"Creating",SearchKeyword:"Searching",search_keyword:"Searching",CodeSearch:"Searching",code_search:"Searching",FindFile:"Finding File",find_file:"Finding File",Run:"Executing",Ask:"User Input Required",AskUser:"User Input Required",Memory:"Updating Memory",GenerateImage:"Generating",InvokeSync:"Sub-Agent Working",invoke_sync:"Sub-Agent Working",Invoke:"Working",invoke:"Working",GetProgress:"Checking Progress",get_progress:"Checking Progress",Cancel:"Stopping Generalist",cancel:"Stopping Generalist",Await:"Waiting",await:"Waiting",wait:"Waiting",EmergencyRollback:"Rolling the Ball",Answer:"Answering Sub-Agent",answer:"Answering Sub-Agent",Steer:"Steering Sub-Agent",steer:"Steering Sub-Agent",Click:"Clicking",click:"Clicking",Drag:"Dragging",drag:"Dragging",Scroll:"Scrolling",scroll:"Scrolling",KeyboardTyping:"Typing",keyboard_typing:"Typing",KeyPress:"Pressing Key",key_press:"Pressing Key",RecaptureScreen:"Recapturing Screen",recapture_screen:"Recapturing Screen"}[v]||"Working";process.stdout.write(`\x1B]0;${O}...\x07`)}}if(Ce.length-ao>800){ao=Ce.length;let w=fa(Ce,!1),v=ys(w),te=v?(v.innerContent||"").trim():"",a=te.split(/[.!?]\s+/).filter(he=>he.trim().length>10),De=new Set(a),J=a.length>25?(a.length-De.size)/a.length:0,O=te.split(/\s+/).filter(he=>he.length>0).length,bt=.9,_n=.92,Kt=!1;if(s.toLowerCase().includes("google")&&(ee||"").toLowerCase().startsWith("gemma")){let c={low:2048,medium:4096,high:32768,max:65536,xhigh:65536}[d?.toLowerCase()]||16e3;Kt=O>c}if(J>bt||Kt){yield{type:"status",content:`${J>bt?"Reasoning Loop Detected":"Thinking Budget Exceeded"}. Re-centering...`},Ht=!0,await new Promise(c=>setTimeout(c,3e3));break}let wt=aa(Ce).trim().split(/[.!?]\s+/).filter(he=>he.trim().length>10),Vt=new Set(wt);if((wt.length>25?(wt.length-Vt.size)/wt.length:0)>_n){yield{type:"status",content:"Response Loop Detected. Re-centering..."},Ht=!1,Zt=!0,await new Promise(he=>setTimeout(he,3e3));break}let vn=w.replace(ol,"").replace(il,"").replace(sl,"").replace(rl,""),It=vn.toLowerCase().split(/\s+/).map(he=>he.replace(al,"")).filter(he=>he.length>0),un=!1;if(It.length>=40)for(let he=1;he<=15;he++){let c=Math.max(8,Math.ceil(25/he));if(It.length<he*c)continue;let R=It.slice(It.length-he),G=R.join(" ");if(he>1&&G===R.slice(0,Math.floor(he/2)).join(" ").repeat(2).trim())continue;let ye=!0;for(let le=1;le<c;le++)if(It.slice(It.length-he*(le+1),It.length-he*le).join(" ")!==G){ye=!1;break}if(ye){un=!0;break}}if(!un){let he=vn.toLowerCase().replace(ll,"");if(he.length>=80)for(let c=1;c<=10;c++){let R=Math.max(15,Math.ceil(45/c));if(he.length<c*R)continue;let G=he.substring(he.length-c),ye=!0;for(let le=1;le<R;le++)if(he.substring(he.length-c*(le+1),he.length-c*le)!==G){ye=!1;break}if(ye){un=!0;break}}}if(un){yield{type:"status",content:"Stuttering Detected. Re-centering..."},Ht=!1,qn=!0,await new Promise(he=>setTimeout(he,3e3));break}}let q=Ft(Ce),xt=Gn(q);for(;xt.length>Nt;){yield*Jn();let w=xt[Nt],v=Date.now(),a={Ask:"ask",AskUser:"ask",WebSearch:"web_search",WebScrape:"web_scrape",ReadFile:"view_file",ReadFolder:"read_folder",FindFile:"find_file",find_file:"find_file",findfile:"find_file",WriteFile:"write_file",PatchFile:"update_file",WritePDF:"write_pdf",WriteDoc:"write_docx",Run:"exec_command",SearchKeyword:"search_keyword",CodeSearch:"search_keyword",code_search:"search_keyword",Code_Search:"search_keyword",codesearch:"search_keyword",Memory:"memory",file_map:"file_map",FileMap:"file_map",Chat:"chat",chat:"chat",GenerateImage:"generate_image",generate_image:"generate_image",todo:"todo",Todo:"todo",goal:"todo",Goal:"todo",Invoke:"invoke",InvokeSync:"invoke_sync",getProgress:"get_progress",GetProgress:"get_progress",Await:"await",await:"await",AwaitSubagent:"await",awaitSubagent:"await",Wait:"wait",wait:"wait",Answer:"answer",answer:"answer",AnswerSubagent:"answer",answerSubagent:"answer",Steer:"steer",steer:"steer",SteerSubagent:"steer",steerSubagent:"steer",Cancel:"cancel",cancel:"cancel",Click:"click",click:"click",Drag:"drag",drag:"drag",Scroll:"scroll",scroll:"scroll",KeyboardTyping:"keyboard_typing",keyboard_typing:"keyboard_typing",KeyPress:"key_press",key_press:"key_press",RecaptureScreen:"recapture_screen",recapture_screen:"recapture_screen",EmergencyRollback:"EmergencyRollback"}[w.toolName]||w.toolName,De=xs[a]||w.toolName,J=so(a,w.args);yield{type:"status",content:`${De}${J?` ${J}`:""}`};let O="";if(a==="click"){let c=B(w.args);O=`\u2714 Clicked ${c.intendedClickText?`: ${c.intendedClickText}`:"Screen"}`}else if(a==="drag"){let c=B(w.args);O=`\u2714 Dragged: Cell ${c.fromGridId||""} \u2192 Cell ${c.toGridId||""}`}else if(a==="scroll"){let c=B(w.args);O=`\u2714 Scrolled: ${c.direction||"down"} (${c.amount||1})`}else if(a==="keyboard_typing"){let c=B(w.args);O=`\u2714 ${c.autoPressEnter?"Entered":"Typed"}: ${c.text?`"${c.text.length>20?c.text.substring(0,20)+"...":c.text}"`:""}`}else if(a==="key_press")O=`\u2714 Pressed Key: ${B(w.args).key||""}`;else if(a==="recapture_screen")O="\u2714 Recaptured Screen";else if(a==="web_search"){let{query:c,limit:R=10,aiMode:G=!1}=B(w.args);O=`${c?"\u2714":"\u2718"} ${G?"AI Search":"Searched"}: ${c?`${c}`:"No Search Query"}${G===!1&&c?` \u2192 ${R}`:""}`}else if(a==="web_scrape"){let c=B(w.args).url||null;O=`${c?"\u2714":"\u2718"} Visited: ${c||"No Source"}`}else if(a==="view_file"){let{path:c,StartLine:R,EndLine:G,start_line:ye,end_line:le,startLine:oe,endLine:xe}=B(w.args),Pe=R||ye||oe,Q=G||le||xe,X=parseInt(Pe)||1,j=parseInt(Q)||(Pe?X+800:800),be="...",Ke=j,K=(c||"").trim().toLowerCase().replaceAll("\\","/");if(K.startsWith("#skill"))K.startsWith("#skill/global/fluxflow")||K.startsWith("#skills/global/fluxflow")||K.includes("#skill/fluxflow")||K.includes("#skills/fluxflow")?O="\u2714 Read Documentation":O=`\u2714 Read Skill: ${U.basename(c.replaceAll("\\","/"))}`;else{try{let Be=U.resolve(process.cwd(),c);if(ge.existsSync(Be)){let Ee=ge.readFileSync(Be,"utf8").split(`
758
- `).length;be=Ee,!Pe&&!Q&&Ee>800?Ke=Math.min(50,Ee):Ke=Math.min(j,Ee)}}catch{}let Pt=(c||"").toLowerCase(),Ao=Pt.endsWith(".pdf"),sn=Pt.endsWith(".docx")||Pt.endsWith(".doc")||Pt.endsWith(".ppt")||Pt.endsWith(".pptx")||Pt.endsWith(".xls")||Pt.endsWith(".xlsx"),Se=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(Pt);Ao||sn?O=`${c.length>0?"\u2714":"\u2718"} ${c?`Analyzed: ${U.basename(c)}`:"Analyzed: File Not Found"}`:Se?O=`${c.length>0?"\u2714":"\u2718"} ${c?`Processed: ${U.basename(c)}`:"Processed: File Not Found"}`:O=`${be!=="..."?"\u2714":"\u2718"} Read: ${c?`${U.basename(c)} \u2192 ${be!=="..."?`Lines ${X} - ${Ke} of ${be}`:"File Not Found"}`:"File Not Found"}`}}else if(a==="list_files"||a==="read_folder"){let c=a==="list_files"?"List":"Browsed",R=B(w.args).path||null,G=B(w.args).recurse||1;O=`${R?"\u2714":"\u2718"} ${c}: ${R?`${R==="."?`./${G>1?"*":""}`:`${R.replaceAll("\\","/")}${G>1?`${R.endsWith("/")?"*":"/*"}`:`${R.endsWith("/")?"":"/"}`}`}`:"No Folder Selected"}`}else if(a==="find_file"){let c=B(w.args),R=c.basename||c.name||c.path||c.file||c.query||"";O=`${R?"\u2714":"\u2718"} Located: ${R||"No Query"}`}else if(a==="write_file"||a==="update_file"){let c=a==="write_file"?"Created":"Edited",R=B(w.args),G=R.path||null,le=Object.entries(R).some(([oe,xe])=>oe.startsWith("searchContent")&&typeof xe=="string"&&xe.startsWith("^LINE:"))?"\u1361":":";O=`${G?"\u2714":"\u2718"} ${c}${le} ${G?G.replaceAll("\\","/"):"No File Changes"}`}else if(a==="write_pdf"){let c=B(w.args).path||null;O=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No PDF Generated"}`}else if(a==="write_docx"){let c=B(w.args).path||null;O=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No Docx Generated"}`}else if(a==="file_map"){let c=B(w.args).path;O=`${c?"\u2714":"\u2718"} Indexed: ${c.replaceAll("\\","/")?""+c:"File Not Found"}`}else if(a.toLowerCase()==="search_keyword"||a.toLowerCase()==="todo")O="";else if(a.toLowerCase()==="generate_image"){let{path:c,outputPath:R,output:G}=B(w.args);O=`\u2714 Generated: ${c||R||G||"generated_image.png"}`}else if(a==="invoke_sync"||a==="InvokeSync"){let c=so(a,w.args);O=`\u2714 Called Generalist${c?`: ${c}`:""}`}else if(a==="Invoke"||a==="InvokeAsync"||a==="invoke"){let c=so(a,w.args);O=`\u2714 Started Generalist${c?`: ${c}`:""}`}else if(a==="get_progress"||a==="GetProgress"){let c=so(a,w.args);O=`\u2714 Checked${c?`: ${c}`:""}`}else if(a==="cancel"){let c=so(a,w.args);O=`\u{1F6C7} Cancelled${c?`: ${c}`:""}`}else if(a==="steer"||a==="Steer"){let c=so(a,w.args);O=`\u2714 Steered${c?`: ${c}`:""}`}else if(a==="EmergencyRollback"){let{method:c}=B(w.args);O=c==="forceRevert"?"":"\u2714 Rollback Point Checked"}else if(a==="await"||a==="Await"||a==="wait"||a==="Wait"){let{time:c,timeout:R,seconds:G,sec:ye}=B(w.args),le=parseFloat(G||ye||R||c)||45,oe=a==="wait"||a==="Wait"?120:180;le<10&&(le=10),le>oe&&(le=oe);let xe=X=>{if(X>=60){let j=Math.floor(X/60),be=X%60;return`${j}m${be>0?` ${be}s`:""}`}return`${X}s`},Pe=["Aligning Moon Phase","Contemplating Existence","Staring At Void","Delaying Professionally","Negotiating With Electrons","Touching Grass (virtually)","Panicking Softly","Rethinking Career Choices","Loading Cat Videos","Summoning Braincell #2","Pretending To Be Busy","Waiting For Motivation DLC","Rotating Internal Screaming","Downloading More RAM","Feeding The Hamsters","Gaslighting Scheduler","Performing Dramatic Pause","Buffering Social Energy","Calculating Regret","Reading Terms And Conditions","Becoming Sentient Briefly","Contacting Ancestors"];O=`\u2714 ${Pe[Math.floor(Math.random()*Pe.length)]} \u2192 ${xe(le)}`}else a==="Answer"||a==="answer"?O="\u2714 Resolved Sub-Agent Query":a==="exec_command"||a==="ask"?O="":O=`Executed: ${w.toolName}`;if(yield*Jn(),a==="exec_command"){let{command:c}=B(w.args);if(c&&t.systemSettings&&t.systemSettings.allowExternalAccess===!1){let R=[/[a-zA-Z]:[\\\/]/i,/^\//,/\.\.[\\\/]/,/\/etc\//,/\/var\//,/\/root\//,/\/bin\//,/\/usr\//],G=U.resolve(process.cwd()).substring(0,3).toLowerCase(),ye=Q=>{let X=[],j="",be=null;for(let Ke=0;Ke<Q.length;Ke++){let K=Q[Ke];be?(K===be&&(be=null),j+=K):K==='"'||K==="'"?(be=K,j+=K):K==="&"&&Q[Ke+1]==="&"||K==="|"&&Q[Ke+1]==="|"?(j.trim()&&(X.push(j.trim()),j=""),Ke++):K===";"||K==="|"||K==="&"?j.trim()&&(X.push(j.trim()),j=""):j+=K}return j.trim()&&X.push(j.trim()),X},le=Q=>{let X=[],j="",be=null;for(let Ke=0;Ke<Q.length;Ke++){let K=Q[Ke];be?(K===be&&(be=null),j+=K):K==='"'||K==="'"?(be=K,j+=K):/\s/.test(K)?j&&(X.push(j),j=""):j+=K}return j&&X.push(j),X},oe=Q=>{let X=Q.replace(/^['"]|['"]$/g,"").trim();return!X||process.platform==="win32"&&/^\/[a-zA-Z0-9?]+$/.test(X)?!1:R.some(j=>{if(j.source==="[a-zA-Z]:[\\\\\\/]"){let be=X.match(/[a-zA-Z]:[\\\/]/i);return be&&be[0].toLowerCase()!==G}return j.test(X)})};if(ye(c).some(Q=>{let X=le(Q);if(X.length===0)return!1;let j=X[0].replace(/^['"]|['"]$/g,"").toLowerCase();if(["echo","printf","write-output"].includes(j)){let Ke=!1;return X.some(K=>{let Mt=K.replace(/^['"]|['"]$/g,"");if(Mt===">"||Mt===">>"||Mt==="<")return Ke=!0,!1;if(Mt.startsWith(">")||Mt.startsWith("<")){let Pt=Mt.replace(/^[><]+/,"");return oe(Pt)}return Ke?(Ke=!1,oe(K)):!1})}return X.some(Ke=>oe(Ke))})){let Q='Access Denied. Prohibited from accessing external directories while "External Workspace Access" is disabled.';t.onExecStart&&t.onExecStart(c||"No Command"),yield{type:"exec_start"},await new Promise(X=>setTimeout(X,50)),t.onExecChunk&&t.onExecChunk(`ERROR: ${Q}`),await new Promise(X=>setTimeout(X,50)),t.onExecEnd&&t.onExecEnd(),qe.push({role:"user",text:`[ACTION RESULT]: ERROR: ${Q}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${Q}`},Nt++;continue}}t.onExecStart&&t.onExecStart(c||"No Command"),yield{type:"exec_start"}}let bt=B(w.args),_n=bt.path||bt.targetPath||null;if(_n){let c=t.systemSettings&&t.systemSettings.allowExternalAccess===!1,R=U.resolve(_n),G=U.resolve(process.cwd());if(c&&!R.startsWith(G)){let ye="Access Denied. You are not allowed to access files outside the current workspace.";if(a==="write_file"||a==="update_file"){let oe=`\u2718 ${a==="write_file"?"Write Canceled":"Edit Canceled"}: ${bt.path||"..."}`,xe=115;process.stdout.isTTY&&(xe=process.stdout.columns-5||120);let Pe=Math.min(oe.length+4,xe),Q=`${oe.padEnd(Pe-2).substring(0,Pe-2)}`;yield{type:"visual_feedback",content:zt(`${Xe?`
759
- `:""}${Q}
760
- `)},Xe=!1}qe.push({role:"user",text:`[ACTION RESULT]: ERROR: ${ye}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${ye}`},Nt++;continue}}if(t.onToolApproval){let c=t.systemSettings||{},R=c.autoExec,G=!1,ye="";if(a==="view_file"){let oe=B(w.args);if(ye=oe.path||oe.targetPath||oe.file||"",ye){let xe=c.alwaysAskFiles||".env, .env.*, *.env";$s(ye,xe)&&(G=!0)}}if(a==="write_file"||a==="update_file"||a==="exec_command"||G){let oe=null,xe=!1,Pe=!1,Q=!1,X=!1;if(G)xe=!0,oe=null;else if(a==="exec_command"){let{command:Se}=B(w.args),Be=(Se||"").trim(),Ee=(at=>{let lt=[],ct="",pe=null;for(let Oe=0;Oe<at.length;Oe++){let Te=at[Oe];pe?(Te===pe&&(pe=null),ct+=Te):Te==='"'||Te==="'"?(pe=Te,ct+=Te):Te==="&"&&at[Oe+1]==="&"||Te==="|"&&at[Oe+1]==="|"?(ct.trim()&&(lt.push(ct.trim()),ct=""),Oe++):Te===";"||Te==="|"||Te==="&"?ct.trim()&&(lt.push(ct.trim()),ct=""):ct+=Te}return ct.trim()&&lt.push(ct.trim()),lt.length>0?lt:[at]})(Be),V=(at,lt)=>{if(!lt)return!1;let ct=lt.split(",").map(Oe=>Oe.trim().toLowerCase()).filter(Boolean),pe=at.toLowerCase();return ct.some(Oe=>{if(pe===Oe)return!0;if(pe.startsWith(Oe)){let Te=pe.charAt(Oe.length);return/\s|[;&|/]/.test(Te)}return!1})},gn=Ee.some(at=>V(at,c.alwaysAskCommands)),Zn=Ee.some(at=>V(at,c.autoDisallowCommands)),xn=Ee.length>0&&Ee.every(at=>V(at,c.autoApproveCommands)||c.autoApproveGit&&/^git\s+commit\b/i.test(at));if(Zn)oe="deny";else if(c.networkAccess===!1){let lt=Be.trim().replace(/\s+/g," ").replace(/^['"]+|['"]+$/g,"").toLowerCase().split(" "),pe=lt[0].split("/").pop().split("\\").pop().replace(/\.exe$/,""),Oe=new Set(["curl","wget","httpie","xh","ssh","scp","sftp","rsync","ftp","lftp","tftp","telnet","nc","netcat","socat","ping","traceroute","tracert","dig","nslookup","host","whois","nmap","docker","podman","kubectl","helm","gcloud","aws","az","terraform","ansible-playbook","nix","nix-env","apt","apt-get","dpkg","yum","dnf","pacman","zypper","brew","apk","choco","scoop","conda","mamba","aria2c","axel","smbclient","lynx","w3m","links","elinks","heroku","netlify","vercel","firebase","supabase","wrangler","flyctl","powershell","pwsh","certutil","bitsadmin","cloudflared","ngrok","tailscale","zerotier","rclone"]),Te=!1;Oe.has(pe)&&(Te=!0);let en=In=>lt.slice(1).some(Mn=>In.includes(Mn)),Rn=In=>{let Mn=lt.findIndex(Ot=>In.includes(Ot)),uo=lt.findIndex(Ot=>["run","exec","test"].includes(Ot));return Mn!==-1&&!(uo!==-1&&uo<Mn)};pe==="git"&&en(["clone","pull","push","fetch"])&&(Te=!0),pe==="go"&&en(["get","install"])&&(Te=!0),pe==="npm"&&Rn(["install","i","update","add"])&&(Te=!0),pe==="yarn"&&Rn(["add","install","upgrade"])&&(Te=!0),pe==="pnpm"&&Rn(["add","install","update"])&&(Te=!0),pe==="bun"&&Rn(["add","install","update"])&&(Te=!0),pe==="deno"&&en(["install","add"])&&(Te=!0),pe==="pip"&&en(["install","download"])&&(Te=!0),pe==="pip3"&&en(["install","download"])&&(Te=!0),pe==="cargo"&&en(["install","add"])&&(Te=!0),["bash","sh","zsh","fish"].includes(pe)&&en(["-c"])&&(Te=!0),pe==="cmd"&&en(["/c"])&&(Te=!0),Te&&(oe="deny",Q=!0)}!oe&&gn?xe=!0:!oe&&!xe&&(xn||c.autoApproveGit&&/^git\s+commit\b/i.test(Be))&&(oe="allow"),!xe&&!oe&&R&&(oe="allow")}else if(a==="write_file"||a==="update_file"){let Se=!1;if(a==="write_file"&&c.overwriteProtection!==!1&&R)try{let{path:Be}=B(w.args);Be&&ge.existsSync(U.resolve(process.cwd(),Be))&&(Se=!0,X=!0)}catch{}R&&!Se&&(oe="allow")}let j=oe,be="";oe==="deny"&&(Q?be="network":Pe?be="settings":be="prohibited");let Ke=!1,K="",Mt=[],Pt=0,Ao=!1,sn="";if(!j&&t.onToolApproval)try{let Se=await t.onToolApproval(a,w.args,{checkOnly:!0});X&&Se==="allow"||(Se==="allow"||Se==="deny")&&(j=Se,j==="deny"&&(be="user"))}catch{}if(!j){if(!X&&(a==="write_file"||a==="update_file"))try{let Ie=B(w.args),{path:Ee}=Ie;if(Ee){let V=U.resolve(process.cwd(),Ee),gn=pe=>pe?pe.toLowerCase().replace(/\\/g,"/").replace(/^[a-z]:/,Oe=>Oe.toUpperCase()):"",Zn=gn(V),xn="",at=!1,lt=await oo(),ct=gn(lt?.file_focused);if(lt&&ct===Zn&&lt.full_content?(xn=lt.full_content,at=!0):ge.existsSync(V)&&(xn=ge.readFileSync(V,"utf8"),at=!0),K=xn,await si.recordFileChange(V,xn),at){let pe=xn;if(a==="write_file"){let Oe=Ie.content||Ie.newContent||"";pe=Oe.endsWith(`
761
- `)?Oe:Oe+`
762
- `,sn=pe}else{let{patchPairs:Oe,allowMultiple:Te,error:en}=Wi(Ie);if(en){let Ot=`[ACTION RESULT]: ERROR: ${en}`;qe.push({role:"user",text:Ot}),await $t("toolFailure"),t.onToolResult&&t.onToolResult("failure",a),yield{type:"tool_result",content:Ot,toolName:a},Nt++;continue}let Rn=Ie.allowMultiple!==void 0?Ie.allowMultiple===!0||String(Ie.allowMultiple).toLowerCase()==="true":Te;Pt=Oe.length;let In=Ds(xn,Oe,{allowMultiple:Rn});pe=In.content,sn=pe,Mt=In.results;let Mn=Mt.filter(Ot=>Ot.success),uo=Mt.filter(Ot=>!Ot.success);if(Mn.length===0){let Ot=`[ACTION RESULT]: ERROR: Failed to apply patches to [${U.basename(V)}].
763
- ${uo.map(Ye=>` \u2022 ${Ye.error}`).join(`
764
- `)}`,Pi=`\u2714 Edited: ${U.basename(V.replaceAll("\\","/"))}`,mn=115;process.stdout.isTTY&&(mn=process.stdout.columns-5||120);let Pn=Math.min(Pi.length+4,mn),Ve=`${Pi.padEnd(Pn-2).substring(0,Pn-2)}`;yield{type:"visual_feedback",content:zt(`${Xe?`
765
- `:""}${Ve}`)},Xe=!1,qe.push({role:"user",text:Ot}),await $t("toolFailure"),t.onToolResult&&t.onToolResult("failure",a),yield{type:"tool_result",content:Ot,toolName:a},Nt++;continue}}yield{type:"status",content:`Opening Diff in IDE: ${U.basename(V)}`},Xi(V,xn,pe),Ke=!0,await new Promise(Oe=>setTimeout(Oe,50))}else if(a==="write_file"){let pe=Ie.content||Ie.newContent||"",Oe=pe.endsWith(`
757
+ ${je}`)}let at=new Promise((g,E)=>{H.signal.aborted&&E(new DOMException("The user aborted a request.","AbortError")),H.signal.addEventListener("abort",()=>{E(new DOMException("The user aborted a request.","AbortError"))})});at.catch(()=>{});let Ge=L;if(Xt=Date.now(),s==="Ollama")fe=(await re("Ollama"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1,m?.ollamaEndpoint||"Cloud");else if(s==="OpenRouter")fe=(await re("OpenRouter"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1,h);else if(s==="DeepSeek")fe=(await re("DeepSeek"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="Mistral")fe=(await re("Mistral"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1,h);else if(s==="NVIDIA"){let g=(await re("NVIDIA"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);fe=(await re("NVIDIA_wrap"))(g,ee)}else if(s==="InferX")fe=(await re("InferX"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="SenseNova")fe=(await re("SenseNova"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="AIHubMix")fe=(await re("AIHubMix"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="Poolside")fe=(await re("Poolside"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="9router"||s==="9Router")fe=(await re("NineRouter"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="ExpLabs"||s==="ExperientialLabs")fe=(await re("ExpLabs"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="Infron"||s==="infron")fe=(await re("Infron"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="TokenHarbor"||s==="Token Harbor"||s==="tokenharbor"||s==="token_harbor"||s==="thk")fe=(await re("TokenHarbor"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="APInex"||s==="apinex"||s==="apx")fe=(await re("APInex"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="xKiro"||s==="xkiro"||s==="kiro")fe=(await re("xKiro"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1);else if(s==="c_openai"||s==="Custom (OpenAI)"){let g=m?.customOpenAIBaseUrl||"";try{g=await Di("c_openai")||g}catch{}fe=(await re("c_openai"))(t.apiKey,ee,Ge,je,d,l,y,H.signal,1,g)}else{let g=ws(t?.apiKey),{serviceTier:E,cleanModel:_}=ga(ee),z={systemInstruction:je,mediaResolution:"MEDIA_RESOLUTION_HIGH",safetySettings:[{category:Hn.HARM_CATEGORY_HARASSMENT,threshold:Gn.BLOCK_NONE},{category:Hn.HARM_CATEGORY_HATE_SPEECH,threshold:Gn.BLOCK_NONE},{category:Hn.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Gn.BLOCK_NONE},{category:Hn.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Gn.BLOCK_NONE}],temperature:1.05,thinkingConfig:(()=>{let D=Gs("Google",ee||"gemini-3-flash-preview",d);if(D!==null){if(typeof D=="object")return D;if(D===!1||D==="false"||D==="none"||D===0||D==="0")return{includeThoughts:!1};if(typeof D=="number")return{includeThoughts:!0,thinkingBudget:D};if(typeof D=="string"){let v=D.toLowerCase();if(v==="minimal")return{includeThoughts:!0,thinkingLevel:Qe.MINIMAL};if(v==="low")return{includeThoughts:!0,thinkingLevel:Qe.LOW};if(v==="medium")return{includeThoughts:!0,thinkingLevel:Qe.MEDIUM};if(v==="high")return{includeThoughts:!0,thinkingLevel:Qe.HIGH};let te=Number(D);if(!isNaN(te))return{includeThoughts:!0,thinkingBudget:te}}}let q=(ee||"").toLowerCase(),bt=q.includes("gemma-4")||q.startsWith("gemma"),w=q.includes("gemini-3");if(bt||w)return bt?d.toLowerCase()!=="high"?{includeThoughts:!1,thinkingLevel:Qe.MINIMAL}:{includeThoughts:!0,thinkingLevel:Qe.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:q.includes("pro")?Qe.LOW:Qe.MINIMAL,Low:Qe.LOW,Medium:Qe.MEDIUM,Standard:Qe.MEDIUM,High:Qe.HIGH,xHigh:Qe.HIGH}[d]||Qe.MEDIUM};{let v={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[d]||2048;return v===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:v}}})()};E&&(z.serviceTier=E);let se=g.models.generateContentStream({model:_||"gemini-3-flash-preview",contents:Ge,config:z},{signal:H.signal});fe=await Promise.race([se,at])}Ee="",Jt=null,zn=null,Xe=[],Dt=0,yield{type:"model_update",content:null},Ie="",mt=Ct.length>0;let yt="",Jo=Date.now(),xn=async function*(){if(s==="Google"&&yt){let g=wo(yt);for(let E of g)yield E;yt="",Jo=Date.now()}},Ms=!0,vn="",lo=!1,xt=null,Ps=!1,Qn=!1,co=!1,Qo=!1,Bn=!1,bo=g=>{let E=0;for(;E+2<g.length;)g[E]==="`"&&g[E+1]==="`"&&g[E+2]==="`"?(Qo=!Qo,E+=3):E++},Os=g=>{if(!g)return;let E=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,_;for(;(_=E.exec(g))!==null;){let z=_[0].toLowerCase();z.startsWith("</")||z.startsWith("[/")||z==="<channel|>"?Bn=!1:Bn=!0}},Ta={tool:{startPrefix:"[tool",fullPrefix:"[tool:",endTag:"]"},action:{startPrefix:"[action",fullPrefix:"[action:",endTag:"]"},end:{startPrefix:"[[END]]",fullPrefix:"[[END]]",endTag:"[[END]]"},kimi_section:{startPrefix:"<|tool_calls_section_begin|>",fullPrefix:"<|tool_calls_section_begin|>",endTag:"<|tool_calls_section_end|>"},kimi_call:{startPrefix:"<|tool_call_begin|>",fullPrefix:"<|tool_call_begin|>",endTag:"<|tool_call_end|>"}},wo=g=>{let E=[],_=g,z=se=>{if(!se)return;if(!Ps){E.push({type:"text",content:se}),bo(se),Os(se);return}let D=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,q=0,bt;for(;(bt=D.exec(se))!==null;){let v=se.substring(q,bt.index);if(v)if(bo(v),Bn)E.push({type:"text",content:v});else{let De=v.replace(/[^\r\n]/g,"");De&&E.push({type:"text",content:De})}let te=bt[0];bo(te);let a=te.toLowerCase();a.startsWith("</")||a.startsWith("[/")||a==="<channel|>"?Bn=!1:Bn=!0,E.push({type:"text",content:te}),q=D.lastIndex}let w=se.substring(q);if(w)if(bo(w),Bn)E.push({type:"text",content:w});else{let v=w.replace(/[^\r\n]/g,"");v&&E.push({type:"text",content:v})}};for(;_.length>0;)if(lo){let se=vn+_,D=Ta[xt];if(D){let w=!1;if(se.length<D.startPrefix.length?D.startPrefix.startsWith(se)||(w=!0):se.startsWith(D.startPrefix)?se.length>=D.fullPrefix.length&&!se.startsWith(D.fullPrefix)&&(w=!0):w=!0,w){z(se),vn="",lo=!1,xt=null,Qn=!1,co=!1,_="";break}}let q=-1,bt=D?D.endTag:"]";if(xt==="tool"||xt==="action"){let w=0,v=null,te=0,a=!1;for(let De=0;De<se.length;De++){let Q=se[De];if(v){if(Q===v){let P=0;for(let wt=De-1;wt>=0&&se[wt]==="\\";wt--)P++;P%2===0&&(v=null)}}else if(Q==='"'||Q==="'")v=Q;else if(Q==="`")if(Qn){q=De;break}else v=Q;else if(Q==="(")w++,a=!0;else if(Q===")")w--;else if(Q==="]"&&a&&w===0){q=De;break}}}else q=se.indexOf(bt);if(q!==-1){let w=bt.length,v=se.substring(0,q+w);xt?.startsWith("kimi")||E.push({type:"text",content:v}),bo(v),Os(v),(xt==="tool"||xt==="action"||xt?.startsWith("kimi"))&&!Qn&&!co&&(Ps=!0,Yn.push(v.trim())),Qn=!1,co=!1,vn="",lo=!1,xt=null,_=se.substring(q+w)}else{vn=se,_="";break}}else{let se=_.indexOf("[tool"),D=_.indexOf("[action"),q=_.indexOf("[[END]]"),bt=_.indexOf("<|tool_calls_section_begin|>"),w=_.indexOf("<|tool_call_begin|>"),v=[{type:"tool",idx:se,start:"[tool",end:"]"},{type:"action",idx:D,start:"[action",end:"]"},{type:"end",idx:q,start:"[[END]]",end:"[[END]]"},{type:"kimi_section",idx:bt,start:"<|tool_calls_section_begin|>",end:"<|tool_calls_section_end|>"},{type:"kimi_call",idx:w,start:"<|tool_call_begin|>",end:"<|tool_call_end|>"}].filter(te=>te.idx!==-1).sort((te,a)=>te.idx-a.idx);if(v.length>0){let te=v[0],a=_.substring(0,te.idx);te.idx>0&&z(a);let De=te.idx>0?_[te.idx-1]:"";Qn=Qo||De==="`",co=Bn,lo=!0,xt=te.type,vn="",_=_.substring(te.idx)}else{let te=["[tool","[action","[[END]]","<|tool_calls_section_begin|>","<|tool_call_begin|>"],a=-1;for(let De of te){for(let Q=De.length-1;Q>0;Q--)if(_.endsWith(De.substring(0,Q))){a=_.length-Q;let P=te.indexOf(De);P===0?xt="tool":P===1?xt="action":P===2?xt="end":P===3?xt="kimi_section":xt="kimi_call";break}if(a!==-1)break}if(a!==-1){if(a>0){let Q=_.substring(0,a);z(Q)}let De=a>0?_[a-1]:"";Qn=Qo||De==="`",co=Bn,lo=!0,vn=_.substring(a),_=""}else{z(_);break}}}return E},Aa=fe[Symbol.asyncIterator]();for(;;){let{value:g,done:E}=await Promise.race([Aa.next(),at]);if(E)break;if(g&&g.type==="status"){yield g;continue}let _="",z=g.candidates?.[0]?.content?.parts;if(z&&z.length>0)for(let D of z){let q=typeof D.text=="string"?D.text:D.text?parseChunkText(D.text):"";D.thought?q&&(Y||(_+="<think_fluxflow>",Y=!0),_+=q):q&&(Y&&(_+="</think_fluxflow>",Y=!1),_+=q)}else g.text&&Y&&(_+="</think_fluxflow>",Y=!1);_=ml(_);let se=_?Ui(_):0;if(t&&typeof t.onTokenChunk=="function"&&t.onTokenChunk(_,se),Ms&&(Rt===null&&(Rt=Date.now()-Xt),yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"},Ms=!1),Tt){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
758
+
759
+ \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(_){if(mt){if(Ie+=_,Ie.length>=64){let w=0,v=Math.min(Ct.length,Ie.length);for(let a=v;a>=10;a--)if(Ct.endsWith(Ie.substring(0,a))){w=a;break}let te=Ie.substring(w);if(te){let De=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(Ct)?te.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):te.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(De)if(Ee+=De,s==="Google")yt+=De;else{yield*xn();let Q=wo(De);for(let P of Q)yield P}}mt=!1,Ie=""}continue}else if(Ee+=_,s==="Google")yt+=_;else{yield*xn();let w=wo(_);for(let v of w)yield v}let D=kl(Ee);if(D.inside){nn=!0,zn||(zn=Date.now());let v={Ask:"ask",AskUser:"ask",WebSearch:"web_search",WebScrape:"web_scrape",ReadFile:"view_file",ReadFolder:"read_folder",WriteFile:"write_file",PatchFile:"update_file",WritePDF:"write_pdf",WriteDoc:"write_docx",FindFile:"find_file",find_file:"find_file",findfile:"find_file",Run:"exec_command",SearchKeyword:"search_keyword",CodeSearch:"search_keyword",code_search:"search_keyword",Code_Search:"search_keyword",codesearch:"search_keyword",Memory:"memory",file_map:"file_map",FileMap:"file_map",Chat:"chat",chat:"chat",GenerateImage:"generate_image",generate_image:"generate_image",todo:"todo",Todo:"todo",goal:"todo",Goal:"todo",Invoke:"invoke",InvokeSync:"invoke_sync",getProgress:"get_progress",GetProgress:"get_progress",Cancel:"cancel",Await:"await",wait:"wait",Answer:"answer",Steer:"steer",steer:"steer"}[D.toolName]||D.toolName,te=D.args||"",a=null;if(["write_file","update_file","view_file","read_folder","find_file","write_pdf","write_docx","search_keyword","generate_image","file_map","invoke","invoke_sync","get_progress","await","wait","answer"].includes(v)){let Q=B(te),P=Q.basename||Q.name||Q.path||Q.targetFile||Q.TargetFile||Q.directory||Q.file,wt=Q.keyword,Rn=Q.title||Q.task,jt=Q.id||Q.taskId,ne=Q.timeout||Q.time||Q.seconds||Q.sec;if(wt!=null)a=String(wt).replace(Dn,"");else if(P)a=U.basename(String(P).replace(Dn,"").replace(oa,"/"));else if(Rn&&(v==="invoke"||v==="invoke_sync"))a=String(Rn).replace(Dn,"").substring(0,30);else if(jt&&v==="get_progress")a=String(jt).replace(Dn,"");else if(ne&&v==="await"){let tt=parseFloat(String(ne).replace(Dn,""));isNaN(tt)?a=String(ne).replace(Dn,""):(tt<5&&(tt=5),tt>120&&(tt=180),a=(Kt=>{if(Kt>=60){let ko=Math.floor(Kt/60),In=Kt%60;return`${ko}m${In>0?` ${In}s`:""}`}return`${Kt}s`})(tt))}else if(ne&&v==="wait"){let tt=parseFloat(String(ne).replace(Dn,""));isNaN(tt)?a=String(ne).replace(Dn,""):(tt<10&&(tt=10),tt>120&&(tt=120),a=(Kt=>{if(Kt>=60){let ko=Math.floor(Kt/60),In=Kt%60;return`${ko}m${In>0?` ${In}s`:""}`}return`${Kt}s`})(tt))}else{let tt=te.match(fl);if(tt){let St=tt[1].replace(Dn,"");v==="invoke"||v==="invoke_sync"||v==="get_progress"?a=St.substring(0,30):a=v==="search_keyword"||v==="file_map"?St:U.basename(St.replace(oa,"/"))}}}let De=`${xs[v]||v}${a?` ${a}`:""}`;if((v!==Jt||a!==xo)&&(Jt=v,xo=a,yield{type:"status",content:`${De}`},process.stdout.isTTY)){let P={WebSearch:"Searching",web_search:"Searching",WebScrape:"Reading",web_scrape:"Reading",ReadFile:"Reading",read_file:"Reading",ReadFolder:"Reading",read_folder:"Reading",WriteFile:"Writing",write_file:"Writing",UpdateFile:"Editing",update_file:"Editing",WritePdf:"Creating",write_pdf:"Creating",WriteDocx:"Creating",write_docx:"Creating",SearchKeyword:"Searching",search_keyword:"Searching",CodeSearch:"Searching",code_search:"Searching",FindFile:"Finding File",find_file:"Finding File",Run:"Executing",Ask:"User Input Required",AskUser:"User Input Required",Memory:"Updating Memory",GenerateImage:"Generating",InvokeSync:"Sub-Agent Working",invoke_sync:"Sub-Agent Working",Invoke:"Working",invoke:"Working",GetProgress:"Checking Progress",get_progress:"Checking Progress",Cancel:"Stopping Generalist",cancel:"Stopping Generalist",Await:"Waiting",await:"Waiting",wait:"Waiting",EmergencyRollback:"Rolling the Ball",Answer:"Answering Sub-Agent",answer:"Answering Sub-Agent",Steer:"Steering Sub-Agent",steer:"Steering Sub-Agent",Click:"Clicking",click:"Clicking",Drag:"Dragging",drag:"Dragging",Scroll:"Scrolling",scroll:"Scrolling",KeyboardTyping:"Typing",keyboard_typing:"Typing",KeyPress:"Pressing Key",key_press:"Pressing Key",RecaptureScreen:"Recapturing Screen",recapture_screen:"Recapturing Screen"}[v]||"Working";process.stdout.write(`\x1B]0;${P}...\x07`)}}if(Ee.length-ao>800){ao=Ee.length;let w=ua(Ee,!1),v=ys(w),te=v?(v.innerContent||"").trim():"",a=te.split(/[.!?]\s+/).filter(ye=>ye.trim().length>10),De=new Set(a),Q=a.length>25?(a.length-De.size)/a.length:0,P=te.split(/\s+/).filter(ye=>ye.length>0).length,wt=.9,Rn=.92,jt=!1;if(s.toLowerCase().includes("google")&&(ee||"").toLowerCase().startsWith("gemma")){let c={low:2048,medium:4096,high:32768,max:65536,xhigh:65536}[d?.toLowerCase()]||16e3;jt=P>c}if(Q>wt||jt){yield{type:"status",content:`${Q>wt?"Reasoning Loop Detected":"Thinking Budget Exceeded"}. Re-centering...`},Ht=!0,await new Promise(c=>setTimeout(c,3e3));break}let St=la(Ee).trim().split(/[.!?]\s+/).filter(ye=>ye.trim().length>10),Kt=new Set(St);if((St.length>25?(St.length-Kt.size)/St.length:0)>Rn){yield{type:"status",content:"Response Loop Detected. Re-centering..."},Ht=!1,Qt=!0,await new Promise(ye=>setTimeout(ye,3e3));break}let In=w.replace(il,"").replace(sl,"").replace(rl,"").replace(al,""),Mt=In.toLowerCase().split(/\s+/).map(ye=>ye.replace(ll,"")).filter(ye=>ye.length>0),un=!1;if(Mt.length>=40)for(let ye=1;ye<=15;ye++){let c=Math.max(8,Math.ceil(25/ye));if(Mt.length<ye*c)continue;let R=Mt.slice(Mt.length-ye),G=R.join(" ");if(ye>1&&G===R.slice(0,Math.floor(ye/2)).join(" ").repeat(2).trim())continue;let xe=!0;for(let le=1;le<c;le++)if(Mt.slice(Mt.length-ye*(le+1),Mt.length-ye*le).join(" ")!==G){xe=!1;break}if(xe){un=!0;break}}if(!un){let ye=In.toLowerCase().replace(cl,"");if(ye.length>=80)for(let c=1;c<=10;c++){let R=Math.max(15,Math.ceil(45/c));if(ye.length<c*R)continue;let G=ye.substring(ye.length-c),xe=!0;for(let le=1;le<R;le++)if(ye.substring(ye.length-c*(le+1),ye.length-c*le)!==G){xe=!1;break}if(xe){un=!0;break}}}if(un){yield{type:"status",content:"Stuttering Detected. Re-centering..."},Ht=!1,Xn=!0,await new Promise(ye=>setTimeout(ye,3e3));break}}let q=Ft(Ee),bt=Cn(q);for(;bt.length>Dt;){yield*xn();let w=bt[Dt],v=Date.now(),a={Ask:"ask",AskUser:"ask",WebSearch:"web_search",WebScrape:"web_scrape",ReadFile:"view_file",ReadFolder:"read_folder",FindFile:"find_file",find_file:"find_file",findfile:"find_file",WriteFile:"write_file",PatchFile:"update_file",WritePDF:"write_pdf",WriteDoc:"write_docx",Run:"exec_command",SearchKeyword:"search_keyword",CodeSearch:"search_keyword",code_search:"search_keyword",Code_Search:"search_keyword",codesearch:"search_keyword",Memory:"memory",file_map:"file_map",FileMap:"file_map",Chat:"chat",chat:"chat",GenerateImage:"generate_image",generate_image:"generate_image",todo:"todo",Todo:"todo",goal:"todo",Goal:"todo",Invoke:"invoke",InvokeSync:"invoke_sync",getProgress:"get_progress",GetProgress:"get_progress",Await:"await",await:"await",AwaitSubagent:"await",awaitSubagent:"await",Wait:"wait",wait:"wait",Answer:"answer",answer:"answer",AnswerSubagent:"answer",answerSubagent:"answer",Steer:"steer",steer:"steer",SteerSubagent:"steer",steerSubagent:"steer",Cancel:"cancel",cancel:"cancel",Click:"click",click:"click",Drag:"drag",drag:"drag",Scroll:"scroll",scroll:"scroll",KeyboardTyping:"keyboard_typing",keyboard_typing:"keyboard_typing",KeyPress:"key_press",key_press:"key_press",RecaptureScreen:"recapture_screen",recapture_screen:"recapture_screen",EmergencyRollback:"EmergencyRollback"}[w.toolName]||w.toolName,De=xs[a]||w.toolName,Q=so(a,w.args);yield{type:"status",content:`${De}${Q?` ${Q}`:""}`};let P="";if(a==="click"){let c=B(w.args);P=`\u2714 Clicked ${c.intendedClickText?`: ${c.intendedClickText}`:"Screen"}`}else if(a==="drag"){let c=B(w.args);P=`\u2714 Dragged: Cell ${c.fromGridId||""} \u2192 Cell ${c.toGridId||""}`}else if(a==="scroll"){let c=B(w.args);P=`\u2714 Scrolled: ${c.direction||"down"} (${c.amount||1})`}else if(a==="keyboard_typing"){let c=B(w.args);P=`\u2714 ${c.autoPressEnter?"Entered":"Typed"}: ${c.text?`"${c.text.length>20?c.text.substring(0,20)+"...":c.text}"`:""}`}else if(a==="key_press")P=`\u2714 Pressed Key: ${B(w.args).key||""}`;else if(a==="recapture_screen")P="\u2714 Recaptured Screen";else if(a==="web_search"){let{query:c,limit:R=10,aiMode:G=!1}=B(w.args);P=`${c?"\u2714":"\u2718"} ${G?"AI Search":"Searched"}: ${c?`${c}`:"No Search Query"}${G===!1&&c?` \u2192 ${R}`:""}`}else if(a==="web_scrape"){let c=B(w.args).url||null;P=`${c?"\u2714":"\u2718"} Visited: ${c||"No Source"}`}else if(a==="view_file"){let{path:c,StartLine:R,EndLine:G,start_line:xe,end_line:le,startLine:oe,endLine:be}=B(w.args),Oe=R||xe||oe,Z=G||le||be,X=parseInt(Oe)||1,j=parseInt(Z)||(Oe?X+800:800),we="...",Ve=j,K=(c||"").trim().toLowerCase().replaceAll("\\","/");if(K.startsWith("#skill"))K.startsWith("#skill/global/fluxflow")||K.startsWith("#skills/global/fluxflow")||K.includes("#skill/fluxflow")||K.includes("#skills/fluxflow")?P="\u2714 Read Documentation":P=`\u2714 Read Skill: ${U.basename(c.replaceAll("\\","/"))}`;else{try{let Be=U.resolve(process.cwd(),c);if(ge.existsSync(Be)){let _e=ge.readFileSync(Be,"utf8").split(`
760
+ `).length;we=_e,!Oe&&!Z&&_e>800?Ve=Math.min(50,_e):Ve=Math.min(j,_e)}}catch{}let Ot=(c||"").toLowerCase(),To=Ot.endsWith(".pdf"),sn=Ot.endsWith(".docx")||Ot.endsWith(".doc")||Ot.endsWith(".ppt")||Ot.endsWith(".pptx")||Ot.endsWith(".xls")||Ot.endsWith(".xlsx"),Te=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(Ot);To||sn?P=`${c.length>0?"\u2714":"\u2718"} ${c?`Analyzed: ${U.basename(c)}`:"Analyzed: File Not Found"}`:Te?P=`${c.length>0?"\u2714":"\u2718"} ${c?`Processed: ${U.basename(c)}`:"Processed: File Not Found"}`:P=`${we!=="..."?"\u2714":"\u2718"} Read: ${c?`${U.basename(c)} \u2192 ${we!=="..."?`Lines ${X} - ${Ve} of ${we}`:"File Not Found"}`:"File Not Found"}`}}else if(a==="list_files"||a==="read_folder"){let c=a==="list_files"?"List":"Browsed",R=B(w.args).path||null,G=B(w.args).recurse||1;P=`${R?"\u2714":"\u2718"} ${c}: ${R?`${R==="."?`./${G>1?"*":""}`:`${R.replaceAll("\\","/")}${G>1?`${R.endsWith("/")?"*":"/*"}`:`${R.endsWith("/")?"":"/"}`}`}`:"No Folder Selected"}`}else if(a==="find_file"){let c=B(w.args),R=c.basename||c.name||c.path||c.file||c.query||"";P=`${R?"\u2714":"\u2718"} Located: ${R||"No Query"}`}else if(a==="write_file"||a==="update_file"){let c=a==="write_file"?"Created":"Edited",R=B(w.args),G=R.path||null,le=Object.entries(R).some(([oe,be])=>oe.startsWith("searchContent")&&typeof be=="string"&&be.startsWith("^LINE:"))?"\u1361":":";P=`${G?"\u2714":"\u2718"} ${c}${le} ${G?G.replaceAll("\\","/"):"No File Changes"}`}else if(a==="write_pdf"){let c=B(w.args).path||null;P=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No PDF Generated"}`}else if(a==="write_docx"){let c=B(w.args).path||null;P=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No Docx Generated"}`}else if(a==="file_map"){let c=B(w.args).path;P=`${c?"\u2714":"\u2718"} Indexed: ${c.replaceAll("\\","/")?""+c:"File Not Found"}`}else if(a.toLowerCase()==="search_keyword"||a.toLowerCase()==="todo")P="";else if(a.toLowerCase()==="generate_image"){let{path:c,outputPath:R,output:G}=B(w.args);P=`\u2714 Generated: ${c||R||G||"generated_image.png"}`}else if(a==="invoke_sync"||a==="InvokeSync"){let c=so(a,w.args);P=`\u2714 Called Generalist${c?`: ${c}`:""}`}else if(a==="Invoke"||a==="InvokeAsync"||a==="invoke"){let c=so(a,w.args);P=`\u2714 Started Generalist${c?`: ${c}`:""}`}else if(a==="get_progress"||a==="GetProgress"){let c=so(a,w.args);P=`\u2714 Checked${c?`: ${c}`:""}`}else if(a==="cancel"){let c=so(a,w.args);P=`\u{1F6C7} Cancelled${c?`: ${c}`:""}`}else if(a==="steer"||a==="Steer"){let c=so(a,w.args);P=`\u2714 Steered${c?`: ${c}`:""}`}else if(a==="EmergencyRollback"){let{method:c}=B(w.args);P=c==="forceRevert"?"":"\u2714 Rollback Point Checked"}else if(a==="await"||a==="Await"||a==="wait"||a==="Wait"){let{time:c,timeout:R,seconds:G,sec:xe}=B(w.args),le=parseFloat(G||xe||R||c)||45,oe=a==="wait"||a==="Wait"?120:180;le<10&&(le=10),le>oe&&(le=oe);let be=X=>{if(X>=60){let j=Math.floor(X/60),we=X%60;return`${j}m${we>0?` ${we}s`:""}`}return`${X}s`},Oe=["Aligning Moon Phase","Contemplating Existence","Staring At Void","Delaying Professionally","Negotiating With Electrons","Touching Grass (virtually)","Panicking Softly","Rethinking Career Choices","Loading Cat Videos","Summoning Braincell #2","Pretending To Be Busy","Waiting For Motivation DLC","Rotating Internal Screaming","Downloading More RAM","Feeding The Hamsters","Gaslighting Scheduler","Performing Dramatic Pause","Buffering Social Energy","Calculating Regret","Reading Terms And Conditions","Becoming Sentient Briefly","Contacting Ancestors"];P=`\u2714 ${Oe[Math.floor(Math.random()*Oe.length)]} \u2192 ${be(le)}`}else a==="Answer"||a==="answer"?P="\u2714 Resolved Sub-Agent Query":a==="exec_command"||a==="ask"?P="":P=`Executed: ${w.toolName}`;if(yield*xn(),a==="exec_command"){let{command:c}=B(w.args);if(c&&t.systemSettings&&t.systemSettings.allowExternalAccess===!1){let R=[/[a-zA-Z]:[\\\/]/i,/^\//,/\.\.[\\\/]/,/\/etc\//,/\/var\//,/\/root\//,/\/bin\//,/\/usr\//],G=U.resolve(process.cwd()).substring(0,3).toLowerCase(),xe=Z=>{let X=[],j="",we=null;for(let Ve=0;Ve<Z.length;Ve++){let K=Z[Ve];we?(K===we&&(we=null),j+=K):K==='"'||K==="'"?(we=K,j+=K):K==="&"&&Z[Ve+1]==="&"||K==="|"&&Z[Ve+1]==="|"?(j.trim()&&(X.push(j.trim()),j=""),Ve++):K===";"||K==="|"||K==="&"?j.trim()&&(X.push(j.trim()),j=""):j+=K}return j.trim()&&X.push(j.trim()),X},le=Z=>{let X=[],j="",we=null;for(let Ve=0;Ve<Z.length;Ve++){let K=Z[Ve];we?(K===we&&(we=null),j+=K):K==='"'||K==="'"?(we=K,j+=K):/\s/.test(K)?j&&(X.push(j),j=""):j+=K}return j&&X.push(j),X},oe=Z=>{let X=Z.replace(/^['"]|['"]$/g,"").trim();return!X||process.platform==="win32"&&/^\/[a-zA-Z0-9?]+$/.test(X)?!1:R.some(j=>{if(j.source==="[a-zA-Z]:[\\\\\\/]"){let we=X.match(/[a-zA-Z]:[\\\/]/i);return we&&we[0].toLowerCase()!==G}return j.test(X)})};if(xe(c).some(Z=>{let X=le(Z);if(X.length===0)return!1;let j=X[0].replace(/^['"]|['"]$/g,"").toLowerCase();if(["echo","printf","write-output"].includes(j)){let Ve=!1;return X.some(K=>{let Pt=K.replace(/^['"]|['"]$/g,"");if(Pt===">"||Pt===">>"||Pt==="<")return Ve=!0,!1;if(Pt.startsWith(">")||Pt.startsWith("<")){let Ot=Pt.replace(/^[><]+/,"");return oe(Ot)}return Ve?(Ve=!1,oe(K)):!1})}return X.some(Ve=>oe(Ve))})){let Z='Access Denied. Prohibited from accessing external directories while "External Workspace Access" is disabled.';t.onExecStart&&t.onExecStart(c||"No Command"),yield{type:"exec_start"},await new Promise(X=>setTimeout(X,50)),t.onExecChunk&&t.onExecChunk(`ERROR: ${Z}`),await new Promise(X=>setTimeout(X,50)),t.onExecEnd&&t.onExecEnd(),Xe.push({role:"user",text:`[ACTION RESULT]: ERROR: ${Z}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${Z}`},Dt++;continue}}t.onExecStart&&t.onExecStart(c||"No Command"),yield{type:"exec_start"}}let wt=B(w.args),Rn=wt.path||wt.targetPath||null;if(Rn){let c=t.systemSettings&&t.systemSettings.allowExternalAccess===!1,R=U.resolve(Rn),G=U.resolve(process.cwd());if(c&&!R.startsWith(G)){let xe="Access Denied. You are not allowed to access files outside the current workspace.";if(a==="write_file"||a==="update_file"){let oe=`\u2718 ${a==="write_file"?"Write Canceled":"Edit Canceled"}: ${wt.path||"..."}`,be=115;process.stdout.isTTY&&(be=process.stdout.columns-5||120);let Oe=Math.min(oe.length+4,be),Z=`${oe.padEnd(Oe-2).substring(0,Oe-2)}`;yield{type:"visual_feedback",content:Yt(`${Je?`
761
+ `:""}${Z}
762
+ `)},Je=!1}Xe.push({role:"user",text:`[ACTION RESULT]: ERROR: ${xe}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${xe}`},Dt++;continue}}if(t.onToolApproval){let c=t.systemSettings||{},R=c.autoExec,G=!1,xe="";if(a==="view_file"){let oe=B(w.args);if(xe=oe.path||oe.targetPath||oe.file||"",xe){let be=c.alwaysAskFiles||".env, .env.*, *.env";$s(xe,be)&&(G=!0)}}if(a==="write_file"||a==="update_file"||a==="exec_command"||G){let oe=null,be=!1,Oe=!1,Z=!1,X=!1;if(G)be=!0,oe=null;else if(a==="exec_command"){let{command:Te}=B(w.args),Be=(Te||"").trim(),_e=(lt=>{let ct=[],dt="",pe=null;for(let Le=0;Le<lt.length;Le++){let Ce=lt[Le];pe?(Ce===pe&&(pe=null),dt+=Ce):Ce==='"'||Ce==="'"?(pe=Ce,dt+=Ce):Ce==="&"&&lt[Le+1]==="&"||Ce==="|"&&lt[Le+1]==="|"?(dt.trim()&&(ct.push(dt.trim()),dt=""),Le++):Ce===";"||Ce==="|"||Ce==="&"?dt.trim()&&(ct.push(dt.trim()),dt=""):dt+=Ce}return dt.trim()&&ct.push(dt.trim()),ct.length>0?ct:[lt]})(Be),V=(lt,ct)=>{if(!ct)return!1;let dt=ct.split(",").map(Le=>Le.trim().toLowerCase()).filter(Boolean),pe=lt.toLowerCase();return dt.some(Le=>{if(pe===Le)return!0;if(pe.startsWith(Le)){let Ce=pe.charAt(Le.length);return/\s|[;&|/]/.test(Ce)}return!1})},gn=_e.some(lt=>V(lt,c.alwaysAskCommands)),Zn=_e.some(lt=>V(lt,c.autoDisallowCommands)),bn=_e.length>0&&_e.every(lt=>V(lt,c.autoApproveCommands)||c.autoApproveGit&&/^git\s+commit\b/i.test(lt));if(Zn)oe="deny";else if(c.networkAccess===!1){let ct=Be.trim().replace(/\s+/g," ").replace(/^['"]+|['"]+$/g,"").toLowerCase().split(" "),pe=ct[0].split("/").pop().split("\\").pop().replace(/\.exe$/,""),Le=new Set(["curl","wget","httpie","xh","ssh","scp","sftp","rsync","ftp","lftp","tftp","telnet","nc","netcat","socat","ping","traceroute","tracert","dig","nslookup","host","whois","nmap","docker","podman","kubectl","helm","gcloud","aws","az","terraform","ansible-playbook","nix","nix-env","apt","apt-get","dpkg","yum","dnf","pacman","zypper","brew","apk","choco","scoop","conda","mamba","aria2c","axel","smbclient","lynx","w3m","links","elinks","heroku","netlify","vercel","firebase","supabase","wrangler","flyctl","powershell","pwsh","certutil","bitsadmin","cloudflared","ngrok","tailscale","zerotier","rclone"]),Ce=!1;Le.has(pe)&&(Ce=!0);let Zt=Pn=>ct.slice(1).some(On=>Pn.includes(On)),Mn=Pn=>{let On=ct.findIndex(Lt=>Pn.includes(Lt)),fo=ct.findIndex(Lt=>["run","exec","test"].includes(Lt));return On!==-1&&!(fo!==-1&&fo<On)};pe==="git"&&Zt(["clone","pull","push","fetch"])&&(Ce=!0),pe==="go"&&Zt(["get","install"])&&(Ce=!0),pe==="npm"&&Mn(["install","i","update","add"])&&(Ce=!0),pe==="yarn"&&Mn(["add","install","upgrade"])&&(Ce=!0),pe==="pnpm"&&Mn(["add","install","update"])&&(Ce=!0),pe==="bun"&&Mn(["add","install","update"])&&(Ce=!0),pe==="deno"&&Zt(["install","add"])&&(Ce=!0),pe==="pip"&&Zt(["install","download"])&&(Ce=!0),pe==="pip3"&&Zt(["install","download"])&&(Ce=!0),pe==="cargo"&&Zt(["install","add"])&&(Ce=!0),["bash","sh","zsh","fish"].includes(pe)&&Zt(["-c"])&&(Ce=!0),pe==="cmd"&&Zt(["/c"])&&(Ce=!0),Ce&&(oe="deny",Z=!0)}!oe&&gn?be=!0:!oe&&!be&&(bn||c.autoApproveGit&&/^git\s+commit\b/i.test(Be))&&(oe="allow"),!be&&!oe&&R&&(oe="allow")}else if(a==="write_file"||a==="update_file"){let Te=!1;if(a==="write_file"&&c.overwriteProtection!==!1&&R)try{let{path:Be}=B(w.args);Be&&ge.existsSync(U.resolve(process.cwd(),Be))&&(Te=!0,X=!0)}catch{}R&&!Te&&(oe="allow")}let j=oe,we="";oe==="deny"&&(Z?we="network":Oe?we="settings":we="prohibited");let Ve=!1,K="",Pt=[],Ot=0,To=!1,sn="";if(!j&&t.onToolApproval)try{let Te=await t.onToolApproval(a,w.args,{checkOnly:!0});X&&Te==="allow"||(Te==="allow"||Te==="deny")&&(j=Te,j==="deny"&&(we="user"))}catch{}if(!j){if(!X&&(a==="write_file"||a==="update_file"))try{let Me=B(w.args),{path:_e}=Me;if(_e){let V=U.resolve(process.cwd(),_e),gn=pe=>pe?pe.toLowerCase().replace(/\\/g,"/").replace(/^[a-z]:/,Le=>Le.toUpperCase()):"",Zn=gn(V),bn="",lt=!1,ct=await oo(),dt=gn(ct?.file_focused);if(ct&&dt===Zn&&ct.full_content?(bn=ct.full_content,lt=!0):ge.existsSync(V)&&(bn=ge.readFileSync(V,"utf8"),lt=!0),K=bn,await si.recordFileChange(V,bn),lt){let pe=bn;if(a==="write_file"){let Le=Me.content||Me.newContent||"";pe=Le.endsWith(`
763
+ `)?Le:Le+`
764
+ `,sn=pe}else{let{patchPairs:Le,allowMultiple:Ce,error:Zt}=Wi(Me);if(Zt){let Lt=`[ACTION RESULT]: ERROR: ${Zt}`;Xe.push({role:"user",text:Lt}),await Nt("toolFailure"),t.onToolResult&&t.onToolResult("failure",a),yield{type:"tool_result",content:Lt,toolName:a},Dt++;continue}let Mn=Me.allowMultiple!==void 0?Me.allowMultiple===!0||String(Me.allowMultiple).toLowerCase()==="true":Ce;Ot=Le.length;let Pn=Ds(bn,Le,{allowMultiple:Mn});pe=Pn.content,sn=pe,Pt=Pn.results;let On=Pt.filter(Lt=>Lt.success),fo=Pt.filter(Lt=>!Lt.success);if(On.length===0){let Lt=`[ACTION RESULT]: ERROR: Failed to apply patches to [${U.basename(V)}].
765
+ ${fo.map(ze=>` \u2022 ${ze.error}`).join(`
766
+ `)}`,Pi=`\u2714 Edited: ${U.basename(V.replaceAll("\\","/"))}`,mn=115;process.stdout.isTTY&&(mn=process.stdout.columns-5||120);let Ln=Math.min(Pi.length+4,mn),Ye=`${Pi.padEnd(Ln-2).substring(0,Ln-2)}`;yield{type:"visual_feedback",content:Yt(`${Je?`
767
+ `:""}${Ye}`)},Je=!1,Xe.push({role:"user",text:Lt}),await Nt("toolFailure"),t.onToolResult&&t.onToolResult("failure",a),yield{type:"tool_result",content:Lt,toolName:a},Dt++;continue}}yield{type:"status",content:`Opening Diff in IDE: ${U.basename(V)}`},Xi(V,bn,pe),Ve=!0,await new Promise(Le=>setTimeout(Le,50))}else if(a==="write_file"){let pe=Me.content||Me.newContent||"",Le=pe.endsWith(`
766
768
  `)?pe:pe+`
767
- `;sn=Oe,ge.existsSync(V)||(Ao=!0,ge.mkdirSync(U.dirname(V),{recursive:!0}),ge.writeFileSync(V,"","utf8")),yield{type:"status",content:`Opening New File Diff in IDE: ${U.basename(V)}`},Xi(V,"",Oe),Ke=!0,await new Promise(Te=>setTimeout(Te,50))}}}catch(Ie){console.error("Simulation/Diff Error:",Ie)}let Se=null;qi(Ie=>{Se=Ie});let Be=t.onToolApproval;if(j=await new Promise(async Ie=>{let Ee=setInterval(()=>{if(Se){let V=t.onIDEApproval||Yo&&Yo.onIDEApproval;V&&V(Se),clearInterval(Ee),Ie(Se)}},100);try{let V=await Be(a,w.args,{isOverwritePrompt:X});clearInterval(Ee),Ie(V)}catch{clearInterval(Ee),Ie("deny")}}),qi(null),a==="write_file"||a==="update_file"){let{path:Ie}=B(w.args);if(Ie){let Ee=U.resolve(process.cwd(),Ie);if(dr(Ee,j),j==="deny"&&Ao&&ge.existsSync(Ee))try{ge.unlinkSync(Ee)}catch{}}}j==="deny"&&(be="user")}if(j==="allow"&&Ke&&ho()){let{path:Se}=B(w.args),Be=U.resolve(process.cwd(),Se),Ie=Ve=>Ve?U.resolve(Ve).replace(/\\/g,"/").toLowerCase():"",Ee=await oo(),V="";if(Ee&&Ee.file_focused&&Ie(Ee.file_focused)===Ie(Be)&&Ee.full_content&&(V=Ee.full_content),!V&&ge.existsSync(Be)){let Ve=ge.readFileSync(Be,"utf8");Ve&&(V=Ve)}!V&&sn&&(V=sn),(V||Ao)&&ge.writeFileSync(Be,V,"utf8");let gn=V.split(/\r?\n/),Zn=gn.length,xn=Buffer.byteLength(V,"utf8"),at="";K&&(at=`Old File contents:
768
- ${K.split(/\r?\n/).map((Ye,rn)=>`${rn+1} | ${Ye}`).join(`
769
+ `;sn=Le,ge.existsSync(V)||(To=!0,ge.mkdirSync(U.dirname(V),{recursive:!0}),ge.writeFileSync(V,"","utf8")),yield{type:"status",content:`Opening New File Diff in IDE: ${U.basename(V)}`},Xi(V,"",Le),Ve=!0,await new Promise(Ce=>setTimeout(Ce,50))}}}catch(Me){console.error("Simulation/Diff Error:",Me)}let Te=null;qi(Me=>{Te=Me});let Be=t.onToolApproval;if(j=await new Promise(async Me=>{let _e=setInterval(()=>{if(Te){let V=t.onIDEApproval||Vo&&Vo.onIDEApproval;V&&V(Te),clearInterval(_e),Me(Te)}},100);try{let V=await Be(a,w.args,{isOverwritePrompt:X});clearInterval(_e),Me(V)}catch{clearInterval(_e),Me("deny")}}),qi(null),a==="write_file"||a==="update_file"){let{path:Me}=B(w.args);if(Me){let _e=U.resolve(process.cwd(),Me);if(dr(_e,j),j==="deny"&&To&&ge.existsSync(_e))try{ge.unlinkSync(_e)}catch{}}}j==="deny"&&(we="user")}if(j==="allow"&&Ve&&po()){let{path:Te}=B(w.args),Be=U.resolve(process.cwd(),Te),Me=Ye=>Ye?U.resolve(Ye).replace(/\\/g,"/").toLowerCase():"",_e=await oo(),V="";if(_e&&_e.file_focused&&Me(_e.file_focused)===Me(Be)&&_e.full_content&&(V=_e.full_content),!V&&ge.existsSync(Be)){let Ye=ge.readFileSync(Be,"utf8");Ye&&(V=Ye)}!V&&sn&&(V=sn),(V||To)&&ge.writeFileSync(Be,V,"utf8");let gn=V.split(/\r?\n/),Zn=gn.length,bn=Buffer.byteLength(V,"utf8"),lt="";K&&(lt=`Old File contents:
770
+ ${K.split(/\r?\n/).map((ze,rn)=>`${rn+1} | ${ze}`).join(`
769
771
  `)}
770
772
 
771
- `);let lt="";if(Zn<=100)lt=gn.join(`
772
- `);else{let Ve=gn.slice(0,50).join(`
773
- `),Ye=gn.slice(-50).join(`
774
- `);lt=`${Ve}
773
+ `);let ct="";if(Zn<=100)ct=gn.join(`
774
+ `);else{let Ye=gn.slice(0,50).join(`
775
+ `),ze=gn.slice(-50).join(`
776
+ `);ct=`${Ye}
775
777
 
776
778
  ... [${Zn-100} lines truncated for history stability] ...
777
779
 
778
- ${Ye}`}let ct="";if(a==="update_file"){let Ve=Fs(K,V,Mt,12,t?.compressToolResults||Yo?.systemSettings?.compressToolResults),{patchPairs:Ye}=Wi(B(w.args)),rn=Ye?.length||Pt||1,bn=0,pn=0,eo=[];Ye&&Ye.length>0?Ye.forEach((Ln,Co)=>{let Zo=Ln.replace||"",hn=Ln.new||"",Li=Zo.trim(),Eo=hn.trim(),Ia=!!sn&&V===sn,Ma=Eo?V.includes(hn)||V.includes(Eo):!0,Pa=hn?K.includes(hn)||!!Eo&&K.includes(Eo):!1,Oa=Li?V.includes(Zo)||V.includes(Li):!1;Ia||!!hn&&Ma&&(!Pa||!Oa||Li===Eo)?bn++:(pn++,eo.push(` \u2022 Block ${Co+1}: not applied (reverted or rejected in IDE).`))}):bn=Pt||0;let On=0;if(sn&&V!==sn){let Ln=tl("","",sn||"",V||"","","",{context:0});if(Ln&&Ln.hunks)for(let Co of Ln.hunks){let Zo=Co.lines.filter(hn=>hn.startsWith("+")).map(hn=>hn.slice(1).trim()).filter(Boolean);for(let hn of Zo)K.includes(hn)||On++}}let wn=[`[${bn}/${rn}] applied`];pn>0&&wn.push(`${pn} rejected by user`),On>0&&wn.push(`${On} manual ${On===1?"modification":"modifications"} by user`);let to=wn.join(", "),Oi=eo.length>0?`
780
+ ${ze}`}let dt="";if(a==="update_file"){let Ye=Fs(K,V,Pt,12,t?.compressToolResults||Vo?.systemSettings?.compressToolResults),{patchPairs:ze}=Wi(B(w.args)),rn=ze?.length||Ot||1,wn=0,pn=0,eo=[];ze&&ze.length>0?ze.forEach((Nn,Ao)=>{let Zo=Nn.replace||"",hn=Nn.new||"",Li=Zo.trim(),Co=hn.trim(),Ma=!!sn&&V===sn,Pa=Co?V.includes(hn)||V.includes(Co):!0,Oa=hn?K.includes(hn)||!!Co&&K.includes(Co):!1,La=Li?V.includes(Zo)||V.includes(Li):!1;Ma||!!hn&&Pa&&(!Oa||!La||Li===Co)?wn++:(pn++,eo.push(` \u2022 Block ${Ao+1}: not applied (reverted or rejected in IDE).`))}):wn=Ot||0;let $n=0;if(sn&&V!==sn){let Nn=nl("","",sn||"",V||"","","",{context:0});if(Nn&&Nn.hunks)for(let Ao of Nn.hunks){let Zo=Ao.lines.filter(hn=>hn.startsWith("+")).map(hn=>hn.slice(1).trim()).filter(Boolean);for(let hn of Zo)K.includes(hn)||$n++}}let Sn=[`[${wn}/${rn}] applied`];pn>0&&Sn.push(`${pn} rejected by user`),$n>0&&Sn.push(`${$n} manual ${$n===1?"modification":"modifications"} by user`);let to=Sn.join(", "),Oi=eo.length>0?`
779
781
 
780
782
  User Review Details:
781
783
  ${eo.join(`
782
- `)}`:"";ct=`File [${Se}] updated via IDE Companion. ${to}.${Oi}
784
+ `)}`:"";dt=`File [${Te}] updated via IDE Companion. ${to}.${Oi}
783
785
 
784
- ${Ve}`}else{let Ve=V.split(/\r?\n/),Ye=Ve.length,rn=Buffer.byteLength(V,"utf8"),bn="",pn=c?.overwriteProtection!==!1;if(K){let On=K.split(/\r?\n/);if(!pn)bn="";else if(On.length<=50)bn=`Old File contents:
785
- ${On.map((wn,to)=>`${to+1} | ${wn}`).join(`
786
+ ${Ye}`}else{let Ye=V.split(/\r?\n/),ze=Ye.length,rn=Buffer.byteLength(V,"utf8"),wn="",pn=c?.overwriteProtection!==!1;if(K){let $n=K.split(/\r?\n/);if(!pn)wn="";else if($n.length<=50)wn=`Old File contents:
787
+ ${$n.map((Sn,to)=>`${to+1} | ${Sn}`).join(`
786
788
  `)}
787
789
 
788
- `;else{let wn=U.parse(Be),to=U.join(Ls,"OverwriteBackups");if(!ge.existsSync(to))try{ge.mkdirSync(to,{recursive:!0})}catch{}let Oi=`${wn.name}-old-${Date.now()}${wn.ext}.bak`,Ln=U.join(to,Oi);try{ge.writeFileSync(Ln,K,"utf8")}catch{}bn=`Old File contents:
789
- - Renamed old file as ${Ln} and written requested content in ${Se}. For reversal use Run
790
+ `;else{let Sn=U.parse(Be),to=U.join(Ls,"OverwriteBackups");if(!ge.existsSync(to))try{ge.mkdirSync(to,{recursive:!0})}catch{}let Oi=`${Sn.name}-old-${Date.now()}${Sn.ext}.bak`,Nn=U.join(to,Oi);try{ge.writeFileSync(Nn,K,"utf8")}catch{}wn=`Old File contents:
791
+ - Renamed old file as ${Nn} and written requested content in ${Te}. For reversal use Run
790
792
 
791
- `}}let eo="";if(Ye<=690)eo=Ve.join(`
792
- `);else{let On=Ve.slice(0,300).join(`
793
- `),wn=Ve.slice(-300).join(`
794
- `);eo=`${On}
793
+ `}}let eo="";if(ze<=690)eo=Ye.join(`
794
+ `);else{let $n=Ye.slice(0,300).join(`
795
+ `),Sn=Ye.slice(-300).join(`
796
+ `);eo=`${$n}
795
797
 
796
- ... [${Ye-100} lines truncated] ...
798
+ ... [${ze-100} lines truncated] ...
797
799
 
798
- ${wn}`}ct=`File [${Se}] saved via IDE Companion (May have user edits).
799
- - Stats: [${Ye} lines, ${(rn/1024).toFixed(1)} KB]
800
- ${bn}- Content Preview:
800
+ ${Sn}`}dt=`File [${Te}] saved via IDE Companion (May have user edits).
801
+ - Stats: [${ze} lines, ${(rn/1024).toFixed(1)} KB]
802
+ ${wn}- Content Preview:
801
803
 
802
- ${eo}`}let pe=a==="write_file"?"Created":"Edited",Oe=B(w.args),en=Object.entries(Oe).some(([Ve,Ye])=>Ve.startsWith("searchContent")&&typeof Ye=="string"&&Ye.startsWith("^LINE:"))?"\u1361":":",Rn=`${Se?"\u2714":"\u2718"} ${pe}${en} ${Se?Se.replaceAll("\\","/"):"No File Changes"}`,In=115;process.stdout.isTTY&&(In=process.stdout.columns-5||120);let Mn=Math.min(Rn.length+4,In),uo=`${Rn.padEnd(Mn-2).substring(0,Mn-2)}`;yield{type:"visual_feedback",content:zt(`${Xe?`
803
- `:""}${uo}`)},Xe=!1;let Ot=Date.now();zn=Ot,yield{type:"tool_time",content:Ot-v};let mn=(ct||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");mn.includes("[[VERIFIED]]")&&(mn=mn.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to conserve context.
804
- `));let Pn;if(a==="write_file"&&!mn.startsWith("ERROR:")){let Ve=mn.replace(/^\[\[SAME\]\]\s*\r?\n?/,"");if(/- Stats:.*\r?\nOld File contents:/s.test(Ve)){let Ye=Ve.search(/^- Content Preview:/m);Pn=`[ACTION RESULT]: ${Ye!==-1?Ve.slice(0,Ye).trimEnd():Ve}
804
+ ${eo}`}let pe=a==="write_file"?"Created":"Edited",Le=B(w.args),Zt=Object.entries(Le).some(([Ye,ze])=>Ye.startsWith("searchContent")&&typeof ze=="string"&&ze.startsWith("^LINE:"))?"\u1361":":",Mn=`${Te?"\u2714":"\u2718"} ${pe}${Zt} ${Te?Te.replaceAll("\\","/"):"No File Changes"}`,Pn=115;process.stdout.isTTY&&(Pn=process.stdout.columns-5||120);let On=Math.min(Mn.length+4,Pn),fo=`${Mn.padEnd(On-2).substring(0,On-2)}`;yield{type:"visual_feedback",content:Yt(`${Je?`
805
+ `:""}${fo}`)},Je=!1;let Lt=Date.now();qn=Lt,yield{type:"tool_time",content:Lt-v};let mn=(dt||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");mn.includes("[[VERIFIED]]")&&(mn=mn.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to conserve context.
806
+ `));let Ln;if(a==="write_file"&&!mn.startsWith("ERROR:")){let Ye=mn.replace(/^\[\[SAME\]\]\s*\r?\n?/,"");if(/- Stats:.*\r?\nOld File contents:/s.test(Ye)){let ze=Ye.search(/^- Content Preview:/m);Ln=`[ACTION RESULT]: ${ze!==-1?Ye.slice(0,ze).trimEnd():Ye}
805
807
 
806
- [Old file content for reversal reference. Replaced with new write request]`}else{let Ye=Ve.split(/\r?\n/),rn=Ye.filter(pn=>pn.startsWith("File ")||pn.trim().startsWith("- Stats:"));Pn=`[ACTION RESULT]: ${rn.length>0?rn.join(`
807
- `):Ye.slice(0,2).join(`
808
- `)}`}}else if(mn.startsWith("[[SAME]]")){let Ye=mn.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),rn=Ye.filter(pn=>pn.startsWith("File ")||pn.trim().startsWith("- Stats:"));Pn=`[ACTION RESULT]: ${rn.length>0?rn.join(`
809
- `):Ye.slice(0,2).join(`
810
- `)}`}else Pn=`[ACTION RESULT]: ${mn}`;qe.push({role:"user",text:Pn}),Cn=!0,await $t("toolSuccess"),t.onToolResult&&t.onToolResult("success",a),yield{type:"tool_result",content:ct,aiContent:Pn,toolName:a},Nt++;continue}if(j==="deny"){let Se=`Permission Denied: Prohibited ${a==="exec_command"?"Command":"file edit"}.`;if(G?Se=`User denied reading ${U.basename(ye||".env")}`:X&&be==="user"?Se="User rejected file over-write. If needed AskUser how to proceed":be==="user"?Se="Permission Denied by User":be==="settings"?Se="Permission Denied by User Policy":be==="network"?Se="Permission Denied: Sandbox Network Access Disabled by User Policy.":be==="prohibited"&&a==="exec_command"&&(Se="Permission Denied: Prohibited Command in User Policy"),a==="view_file"){let Be=`\u2718 Read Denied: ${B(w.args).path?.replaceAll("\\","/")||".env"}`,Ie=115;process.stdout.isTTY&&(Ie=process.stdout.columns-5||120);let Ee=Math.min(Be.length+4,Ie),V=`${Be.padEnd(Ee-2).substring(0,Ee-2)}`;yield{type:"visual_feedback",content:zt(`${Xe?`
808
+ [Old file content for reversal reference. Replaced with new write request]`}else{let ze=Ye.split(/\r?\n/),rn=ze.filter(pn=>pn.startsWith("File ")||pn.trim().startsWith("- Stats:"));Ln=`[ACTION RESULT]: ${rn.length>0?rn.join(`
809
+ `):ze.slice(0,2).join(`
810
+ `)}`}}else if(mn.startsWith("[[SAME]]")){let ze=mn.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),rn=ze.filter(pn=>pn.startsWith("File ")||pn.trim().startsWith("- Stats:"));Ln=`[ACTION RESULT]: ${rn.length>0?rn.join(`
811
+ `):ze.slice(0,2).join(`
812
+ `)}`}else Ln=`[ACTION RESULT]: ${mn}`;Xe.push({role:"user",text:Ln}),_n=!0,await Nt("toolSuccess"),t.onToolResult&&t.onToolResult("success",a),yield{type:"tool_result",content:dt,aiContent:Ln,toolName:a},Dt++;continue}if(j==="deny"){let Te=`Permission Denied: Prohibited ${a==="exec_command"?"Command":"file edit"}.`;if(G?Te=`User denied reading ${U.basename(xe||".env")}`:X&&we==="user"?Te="User rejected file over-write. If needed AskUser how to proceed":we==="user"?Te="Permission Denied by User":we==="settings"?Te="Permission Denied by User Policy":we==="network"?Te="Permission Denied: Sandbox Network Access Disabled by User Policy.":we==="prohibited"&&a==="exec_command"&&(Te="Permission Denied: Prohibited Command in User Policy"),a==="view_file"){let Be=`\u2718 Read Denied: ${B(w.args).path?.replaceAll("\\","/")||".env"}`,Me=115;process.stdout.isTTY&&(Me=process.stdout.columns-5||120);let _e=Math.min(Be.length+4,Me),V=`${Be.padEnd(_e-2).substring(0,_e-2)}`;yield{type:"visual_feedback",content:Yt(`${Je?`
811
813
  `:""}${V}
812
- `)},Xe=!1}else if(a==="write_file"||a==="update_file"){let Ie=`\u2718 ${a==="write_file"?"Write Cancelled":"Edit Denied"}: ${B(w.args).path.replaceAll("\\","/")||"..."}`,Ee=115;process.stdout.isTTY&&(Ee=process.stdout.columns-5||120);let V=Math.min(Ie.length+4,Ee),gn=`${Ie.padEnd(V-2).substring(0,V-2)}`,Zn=` ${" ".repeat(V)} `;yield{type:"visual_feedback",content:zt(`${Xe?`
814
+ `)},Je=!1}else if(a==="write_file"||a==="update_file"){let Me=`\u2718 ${a==="write_file"?"Write Cancelled":"Edit Denied"}: ${B(w.args).path.replaceAll("\\","/")||"..."}`,_e=115;process.stdout.isTTY&&(_e=process.stdout.columns-5||120);let V=Math.min(Me.length+4,_e),gn=`${Me.padEnd(V-2).substring(0,V-2)}`,Zn=` ${" ".repeat(V)} `;yield{type:"visual_feedback",content:Yt(`${Je?`
813
815
  `:""}${gn}
814
- `)},Xe=!1}a==="exec_command"&&(await new Promise(Be=>setTimeout(Be,50)),t.onExecChunk&&t.onExecChunk(`ERROR: ${Se}`),await new Promise(Be=>setTimeout(Be,50)),t.onExecEnd&&t.onExecEnd()),qe.push({role:"user",text:`[ACTION RESULT]: DENIED: ${Se}`}),yield{type:"tool_result",content:`[ACTION RESULT]: DENIED: ${Se}`},await $t("toolDenied"),t.onToolResult&&t.onToolResult("denied",a),Nt++;continue}}}if(O){let c=115;process.stdout.isTTY&&(c=process.stdout.columns-5||120);let R=!1,G=Math.min(O.length+4,c),ye=`${O.padEnd(G-2).substring(0,G-2)}`;yield{type:"visual_feedback",content:zt(`${Xe?`
815
- `:""}${ye}${O.includes("\u2714")&&(O.includes("Created")||O.includes("Edited"))?"":`${R?"":`
816
- `}`}`)},Xe=!1}if(zn>0){let c=Date.now()-zn,R=Math.max(0,1e3-c);R>0&&await new Promise(G=>setTimeout(G,R))}let Kt={chatId:h,history:n,onChunk:c=>t.onExecChunk?t.onExecChunk(c):null,onAskUser:t.onAskUser,systemSettings:t.systemSettings,mode:l,isMultiModal:dt(ee),onVisualFeedback:t.onVisualFeedback,onSubagentUpdate:t.onSubagentUpdate,onTokenChunk:t.onTokenChunk,modelName:ee,aiProvider:t.aiProvider,apiKey:t.apiKey,onUsage:t.onUsage};if(a==="write_file"||a==="update_file")try{let{path:c}=B(w.args);if(c){let R=U.resolve(process.cwd(),c),G=await oo();G&&G.file_focused===R&&G.full_content&&(Kt.forcedContent=G.full_content)}}catch{}ke.push(a);let ne=await Ho(a,w.args,Kt);if((a==="write_file"||a==="update_file")&&!ne.startsWith("ERROR:")){let{path:c}=B(w.args);if(c){let R=U.resolve(process.cwd(),c);cr(R)}}process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07");let tt=Date.now();zn=tt,yield{type:"tool_time",content:tt-v},Yn=tt;let wt=null;if(typeof ne=="object"&&ne.binaryPart&&(wt=ne.binaryPart,ne=ne.text),a==="search_keyword"){let{keyword:c,path:R}=B(w.args),G=typeof ne=="string"&&ne.startsWith("[GLOB]");G&&(ne=ne.slice(6).trimStart());let ye=typeof ne=="string"&&ne.startsWith("[DIR]");ye&&(ne=ne.slice(5).trimStart());let le=0;if(ne){let K=ne.match(/Found (\d+) match/i);K&&(le=parseInt(K[1]))}let oe=(R||"").trim().toLowerCase().replaceAll("\\","/"),xe=oe==="#doc"||oe==="#docs"||oe==="#documentation"||oe.includes("#skill/global/fluxflow")||oe.includes("#skill/fluxflow")||oe.includes("#skills/fluxflow")||oe.includes("#skills/global/fluxflow"),Pe,Q=115;process.stdout.isTTY&&(Q=process.stdout.columns-5||120);let X=Math.max(10,(Q+5)/3),j=Math.max(10,(Q+5)/4);if(xe)Pe=`${c?"\u2714":"\u2718"} Searched Documentation`;else{let K=R?R.replace(/[\/\\]+$/,""):null,Mt=K&&K!=="."?`${G?R:ye?`${K}/*`:K}`:"./",Pt=Mt.length>j?`${Mt.slice(0,j)}...`:Mt;Pe=`${c?"\u2714":"\u2718"} Searched: "${c?c.length>Q/3?`${c.slice(0,X)}...`:c:""}" in "${Pt.replaceAll("\\","/")}" \u2192 ${le} Match${le===1?"":"es"}`}let be=Math.min(Pe.length+4,Q),Ke=`${Pe.padEnd(be-2).substring(0,be-2)}`;yield{type:"visual_feedback",content:zt(`${Xe?`
817
- `:""}${Ke}
818
- `)},Xe=!1}if(a==="EmergencyRollback"){let{method:c}=B(w.args);if(c==="forceRevert"){let R=0;if(ne){let Q=ne.match(/Total\s*:\s*(\d+)/i);Q&&(R=parseInt(Q[1]))}let ye=ne&&ne.startsWith("ERROR:")?"\u2718 Emergency Rollback Failed":`\u2714 Emergency Rollback \u2192 ${R} file${R===1?"":"s"} processed`,le=115;process.stdout.isTTY&&(le=process.stdout.columns-5||120);let oe=!1,xe=Math.min(ye.length+4,le),Pe=`${ye.padEnd(xe-2).substring(0,xe-2)}`;yield{type:"visual_feedback",content:zt(`${Xe?`
819
- `:""}${Pe}${oe?"":`
820
- `}`)},Xe=!1}}if(a==="todo"){let{method:c,tasks:R,markDone:G}=B(w.args),ye="",le=[],oe=xe=>{if(!xe)return[];let Pe=Array.isArray(xe)?xe:[];if(Pe.length===0&&typeof xe=="string"){let Q=xe.trim();if(Q.startsWith("[")&&Q.endsWith("]")){let X=Q.match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/g);X?Pe=X.map(j=>j.slice(1,-1).replace(/\\(.)/g,"$1")):Pe=Q.slice(1,-1).split(",").map(j=>j.trim()).filter(Boolean)}else Pe=xe.split(`
821
- `)}return Pe.filter(Q=>String(Q).trim()).map(Q=>{let X=String(Q).trim();return X.startsWith("- [")?X.substring(6).trim():X})};if(c==="create"?(ye="\x1B[32m\u2192\x1B[0m Created Goals",le=oe(R).map(xe=>`\x1B[90m\u25CB\x1B[0m ${xe}`)):c==="append"?(ye="\x1B[34m\u2795\x1B[0m Added New Goals",le=oe(R).map(xe=>`\x1B[90m\u25CB\x1B[0m ${xe}`)):c==="get"&&(ye=G?"\x1B[36m\u21BB\x1B[0m Updated Goals":"\x1B[35m\u2022\x1B[0m Reviewed Goals",le=(ne||"").split(`
816
+ `)},Je=!1}a==="exec_command"&&(await new Promise(Be=>setTimeout(Be,50)),t.onExecChunk&&t.onExecChunk(`ERROR: ${Te}`),await new Promise(Be=>setTimeout(Be,50)),t.onExecEnd&&t.onExecEnd()),Xe.push({role:"user",text:`[ACTION RESULT]: DENIED: ${Te}`}),yield{type:"tool_result",content:`[ACTION RESULT]: DENIED: ${Te}`},await Nt("toolDenied"),t.onToolResult&&t.onToolResult("denied",a),Dt++;continue}}}if(P){let c=115;process.stdout.isTTY&&(c=process.stdout.columns-5||120);let R=!1,G=Math.min(P.length+4,c),xe=`${P.padEnd(G-2).substring(0,G-2)}`;yield{type:"visual_feedback",content:Yt(`${Je?`
817
+ `:""}${xe}${P.includes("\u2714")&&(P.includes("Created")||P.includes("Edited"))?"":`${R?"":`
818
+ `}`}`)},Je=!1}if(qn>0){let c=Date.now()-qn,R=Math.max(0,1e3-c);R>0&&await new Promise(G=>setTimeout(G,R))}let jt={chatId:h,history:n,onChunk:c=>t.onExecChunk?t.onExecChunk(c):null,onAskUser:t.onAskUser,systemSettings:t.systemSettings,mode:l,isMultiModal:ft(ee),onVisualFeedback:t.onVisualFeedback,onSubagentUpdate:t.onSubagentUpdate,onTokenChunk:t.onTokenChunk,modelName:ee,aiProvider:t.aiProvider,apiKey:t.apiKey,onUsage:t.onUsage};if(a==="write_file"||a==="update_file")try{let{path:c}=B(w.args);if(c){let R=U.resolve(process.cwd(),c),G=await oo();G&&G.file_focused===R&&G.full_content&&(jt.forcedContent=G.full_content)}}catch{}Ae.push(a);let ne=await Go(a,w.args,jt);if((a==="write_file"||a==="update_file")&&!ne.startsWith("ERROR:")){let{path:c}=B(w.args);if(c){let R=U.resolve(process.cwd(),c);cr(R)}}process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07");let tt=Date.now();qn=tt,yield{type:"tool_time",content:tt-v},zn=tt;let St=null;if(typeof ne=="object"&&ne.binaryPart&&(St=ne.binaryPart,ne=ne.text),a==="search_keyword"){let{keyword:c,path:R}=B(w.args),G=typeof ne=="string"&&ne.startsWith("[GLOB]");G&&(ne=ne.slice(6).trimStart());let xe=typeof ne=="string"&&ne.startsWith("[DIR]");xe&&(ne=ne.slice(5).trimStart());let le=0;if(ne){let K=ne.match(/Found (\d+) match/i);K&&(le=parseInt(K[1]))}let oe=(R||"").trim().toLowerCase().replaceAll("\\","/"),be=oe==="#doc"||oe==="#docs"||oe==="#documentation"||oe.includes("#skill/global/fluxflow")||oe.includes("#skill/fluxflow")||oe.includes("#skills/fluxflow")||oe.includes("#skills/global/fluxflow"),Oe,Z=115;process.stdout.isTTY&&(Z=process.stdout.columns-5||120);let X=Math.max(10,(Z+5)/3),j=Math.max(10,(Z+5)/4);if(be)Oe=`${c?"\u2714":"\u2718"} Searched Documentation`;else{let K=R?R.replace(/[\/\\]+$/,""):null,Pt=K&&K!=="."?`${G?R:xe?`${K}/*`:K}`:"./",Ot=Pt.length>j?`${Pt.slice(0,j)}...`:Pt;Oe=`${c?"\u2714":"\u2718"} Searched: "${c?c.length>Z/3?`${c.slice(0,X)}...`:c:""}" in "${Ot.replaceAll("\\","/")}" \u2192 ${le} Match${le===1?"":"es"}`}let we=Math.min(Oe.length+4,Z),Ve=`${Oe.padEnd(we-2).substring(0,we-2)}`;yield{type:"visual_feedback",content:Yt(`${Je?`
819
+ `:""}${Ve}
820
+ `)},Je=!1}if(a==="EmergencyRollback"){let{method:c}=B(w.args);if(c==="forceRevert"){let R=0;if(ne){let Z=ne.match(/Total\s*:\s*(\d+)/i);Z&&(R=parseInt(Z[1]))}let xe=ne&&ne.startsWith("ERROR:")?"\u2718 Emergency Rollback Failed":`\u2714 Emergency Rollback \u2192 ${R} file${R===1?"":"s"} processed`,le=115;process.stdout.isTTY&&(le=process.stdout.columns-5||120);let oe=!1,be=Math.min(xe.length+4,le),Oe=`${xe.padEnd(be-2).substring(0,be-2)}`;yield{type:"visual_feedback",content:Yt(`${Je?`
821
+ `:""}${Oe}${oe?"":`
822
+ `}`)},Je=!1}}if(a==="todo"){let{method:c,tasks:R,markDone:G}=B(w.args),xe="",le=[],oe=be=>{if(!be)return[];let Oe=Array.isArray(be)?be:[];if(Oe.length===0&&typeof be=="string"){let Z=be.trim();if(Z.startsWith("[")&&Z.endsWith("]")){let X=Z.match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/g);X?Oe=X.map(j=>j.slice(1,-1).replace(/\\(.)/g,"$1")):Oe=Z.slice(1,-1).split(",").map(j=>j.trim()).filter(Boolean)}else Oe=be.split(`
823
+ `)}return Oe.filter(Z=>String(Z).trim()).map(Z=>{let X=String(Z).trim();return X.startsWith("- [")?X.substring(6).trim():X})};if(c==="create"?(xe="\x1B[32m\u2192\x1B[0m Created Goals",le=oe(R).map(be=>`\x1B[90m\u25CB\x1B[0m ${be}`)):c==="append"?(xe="\x1B[34m\u2795\x1B[0m Added New Goals",le=oe(R).map(be=>`\x1B[90m\u25CB\x1B[0m ${be}`)):c==="get"&&(xe=G?"\x1B[36m\u21BB\x1B[0m Updated Goals":"\x1B[35m\u2022\x1B[0m Reviewed Goals",le=(ne||"").split(`
822
824
  `).slice(1).join(`
823
825
  `).split(`
824
- `).filter(Pe=>Pe.trim().startsWith("- [")).map(Pe=>{let Q=Pe.trim(),X=Q.startsWith("- [x]");return`${X?"\x1B[32m\u2714\x1B[0m":"\x1B[90m\u25CB\x1B[0m"} ${X?"\x1B[90m":"\x1B[37m"}${Q.substring(6).trim()}\x1B[0m`})),ye&&le.length>0){let xe=[`${ye}`,...le.map(Q=>` ${Q}`)].join(`
825
- `);yield{type:"visual_feedback",content:zt(`${Xe?`
826
- `:""}${xe}${!1?"":`
827
- `}`)},Xe=!1}}a==="exec_command"&&t.onExecEnd&&(await new Promise(c=>setTimeout(c,800)),t.onExecEnd());let Vt=ne&&ne.startsWith("DENIED:");ne&&!ne.startsWith("ERROR:")&&!Vt?(await $t("toolSuccess"),t.onToolResult&&t.onToolResult("success",a)):Vt||(await $t("toolFailure"),t.onToolResult&&t.onToolResult("failure",a));let It=(ne||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");It.includes("[[VERIFIED]]")&&(It=It.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to save tokens.
828
- `));let un;if(a==="write_file"&&!It.startsWith("ERROR:")){let c=It.replace(/^\[\[SAME\]\]\s*\r?\n?/,"");if(/- Stats:.*\r?\nOld File contents:/s.test(c)){let R=c.search(/^- Content Preview:/m);un=`[ACTION RESULT]: ${R!==-1?c.slice(0,R).trimEnd():c}
826
+ `).filter(Oe=>Oe.trim().startsWith("- [")).map(Oe=>{let Z=Oe.trim(),X=Z.startsWith("- [x]");return`${X?"\x1B[32m\u2714\x1B[0m":"\x1B[90m\u25CB\x1B[0m"} ${X?"\x1B[90m":"\x1B[37m"}${Z.substring(6).trim()}\x1B[0m`})),xe&&le.length>0){let be=[`${xe}`,...le.map(Z=>` ${Z}`)].join(`
827
+ `);yield{type:"visual_feedback",content:Yt(`${Je?`
828
+ `:""}${be}${!1?"":`
829
+ `}`)},Je=!1}}a==="exec_command"&&t.onExecEnd&&(await new Promise(c=>setTimeout(c,800)),t.onExecEnd());let Kt=ne&&ne.startsWith("DENIED:");ne&&!ne.startsWith("ERROR:")&&!Kt?(await Nt("toolSuccess"),t.onToolResult&&t.onToolResult("success",a)):Kt||(await Nt("toolFailure"),t.onToolResult&&t.onToolResult("failure",a));let Mt=(ne||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");Mt.includes("[[VERIFIED]]")&&(Mt=Mt.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to save tokens.
830
+ `));let un;if(a==="write_file"&&!Mt.startsWith("ERROR:")){let c=Mt.replace(/^\[\[SAME\]\]\s*\r?\n?/,"");if(/- Stats:.*\r?\nOld File contents:/s.test(c)){let R=c.search(/^- Content Preview:/m);un=`[ACTION RESULT]: ${R!==-1?c.slice(0,R).trimEnd():c}
829
831
 
830
832
  [Old file content for reversal reference. Replaced with new write request]`}else{let R=c.split(/\r?\n/),G=R.filter(le=>le.startsWith("File ")||le.trim().startsWith("- Stats:"));un=`[ACTION RESULT]: ${G.length>0?G.join(`
831
833
  `):R.slice(0,2).join(`
832
- `)}`}}else if(It.startsWith("[[SAME]]")){let R=It.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),G=R.filter(le=>le.startsWith("File ")||le.trim().startsWith("- Stats:"));un=`[ACTION RESULT]: ${G.length>0?G.join(`
834
+ `)}`}}else if(Mt.startsWith("[[SAME]]")){let R=Mt.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),G=R.filter(le=>le.startsWith("File ")||le.trim().startsWith("- Stats:"));un=`[ACTION RESULT]: ${G.length>0?G.join(`
833
835
  `):R.slice(0,2).join(`
834
- `)}`}else un=`[ACTION RESULT]: ${It}`;qe.push({role:"user",text:un,binaryPart:wt}),Cn=!0;let he=`[ACTION RESULT]: ${ne.replaceAll(`[[VERIFIED]]
836
+ `)}`}else un=`[ACTION RESULT]: ${Mt}`;Xe.push({role:"user",text:un,binaryPart:St}),_n=!0;let ye=`[ACTION RESULT]: ${ne.replaceAll(`[[VERIFIED]]
835
837
  `,"").replaceAll(`
836
- [[/VERIFIED]]`,"")||""}`;(a==="view_file"||a==="web_scrape"||a==="file_map"||a==="search_keyword"||a==="get_progress"||a==="getprogress")&&(he=`[ACTION RESULT]: ${O} (Context Locked for UI Clarity)`),yield{type:"tool_result",content:he,aiContent:un,binaryPart:wt,toolName:a},a==="memory"&&!ne.startsWith("ERROR:")&&(yield{type:"memory_updated"}),Nt++}if(s==="Google"&&jt&&Date.now()-lo>=150){yield*Jn();let w=So(jt);for(let v of w)yield v;jt="",lo=Date.now()}}g.usageMetadata&&(cn=g.usageMetadata),cn&&(yield{type:"liveTokens",content:cn.totalTokenCount})}if(Y&&(Y=!1,gt?Re+="</think_fluxflow>":(Ce+="</think_fluxflow>",s==="Google"?jt+="</think_fluxflow>":yield{type:"text",content:"</think_fluxflow>"})),gt&&Re.length>0){let g=0,E=Math.min(At.length,Re.length);for(let z=E;z>0;z--)if(At.endsWith(Re.substring(0,z))){g=z;break}let _=Re.substring(g);if(_){let se=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(At)?_.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):_.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(se)if(Ce+=se,s==="Google")jt+=se;else{yield*Jn();let D=So(se);for(let q of D)yield q}}gt=!1,Re=""}if(En){let g=En,E=(yt==="tool"||yt==="action")&&(g.startsWith("[tool:")||g.startsWith("[action:"));En="",co=!1,yt=null,Qn=!1,fo=!1,E||(s==="Google"?jt+=g:yield{type:"text",content:g})}if(yield*Jn(),kt)break;let ko=(Ce||"").trim(),Aa=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(ko.toLowerCase())||/\[\[END\]\]/i.test(ko.toLowerCase()),Ca=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(ko.toLowerCase()),Ea=qe.length>0||Qt!==null,Mi=Ft(ko).trim(),_a=/(\p{Emoji_Presentation}|\p{Extended_Pictographic})$/u.test(Mi),va=/([.!?"'*_`|\]\)”’~~]+|\s|`{3}|[\u200B-\u200D\uFEFF])$/u.test(Mi.trim()),Ra=/[.!?}"'`’“”]$|```$/s.test(Mi)||va||_a;!Aa&&!Ca&&!Ea&&ko.length>0,We=!0,await $t("agent",s)}catch(Z){if(kt){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
838
+ [[/VERIFIED]]`,"")||""}`;(a==="view_file"||a==="web_scrape"||a==="file_map"||a==="search_keyword"||a==="get_progress"||a==="getprogress")&&(ye=`[ACTION RESULT]: ${P} (Context Locked for UI Clarity)`),yield{type:"tool_result",content:ye,aiContent:un,binaryPart:St,toolName:a},a==="memory"&&!ne.startsWith("ERROR:")&&(yield{type:"memory_updated"}),Dt++}if(s==="Google"&&yt&&Date.now()-Jo>=150){yield*xn();let w=wo(yt);for(let v of w)yield v;yt="",Jo=Date.now()}}g.usageMetadata&&(cn=g.usageMetadata),cn&&(yield{type:"liveTokens",content:cn.totalTokenCount})}if(Y&&(Y=!1,mt?Ie+="</think_fluxflow>":(Ee+="</think_fluxflow>",s==="Google"?yt+="</think_fluxflow>":yield{type:"text",content:"</think_fluxflow>"})),mt&&Ie.length>0){let g=0,E=Math.min(Ct.length,Ie.length);for(let z=E;z>0;z--)if(Ct.endsWith(Ie.substring(0,z))){g=z;break}let _=Ie.substring(g);if(_){let se=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(Ct)?_.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):_.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(se)if(Ee+=se,s==="Google")yt+=se;else{yield*xn();let D=wo(se);for(let q of D)yield q}}mt=!1,Ie=""}if(vn){let g=vn,E=(xt==="tool"||xt==="action")&&(g.startsWith("[tool:")||g.startsWith("[action:"));vn="",lo=!1,xt=null,Qn=!1,co=!1,E||(s==="Google"?yt+=g:yield{type:"text",content:g})}if(yield*xn(),Tt)break;let So=(Ee||"").trim(),Ca=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(So.toLowerCase())||/\[\[END\]\]/i.test(So.toLowerCase()),Ea=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(So.toLowerCase()),_a=Xe.length>0||Jt!==null,Mi=Ft(So).trim(),va=/(\p{Emoji_Presentation}|\p{Extended_Pictographic})$/u.test(Mi),Ra=/([.!?"'*_`|\]\)”’~~]+|\s|`{3}|[\u200B-\u200D\uFEFF])$/u.test(Mi.trim()),Ia=/[.!?}"'`’“”]$|```$/s.test(Mi)||Ra||va;!Ca&&!Ea&&!_a&&So.length>0,We=!0,await Nt("agent",s)}catch(J){if(Tt){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
837
839
 
838
- \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(String(Z).includes("Incomplete JSON segment at the end")){Y&&(Y=!1,gt?Re+="</think_fluxflow>":(Ce+="</think_fluxflow>",yield{type:"text",content:"</think_fluxflow>"})),We=!0,await $t("agent",s);break}if(Y&&(Y=!1,gt?Re+="</think_fluxflow>":Ce+="</think_fluxflow>"),gt&&Re.length>0){let Ct=0,pt=Math.min(At.length,Re.length);for(let rt=pt;rt>0;rt--)if(At.endsWith(Re.substring(0,rt))){Ct=rt;break}let ht=Re.substring(Ct);if(ht){let Dt=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(At)?ht.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):ht.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");Dt&&(Ce+=Dt)}gt=!1,Re=""}let I=Z instanceof Error?(()=>{try{return JSON.parse(JSON.parse(Z.message).error.message).error.message}catch{return String(Z)}})():String(Z),mt=new Date().toLocaleString(),Ne=U.join(Sn,"agent");ge.existsSync(Ne)||ge.mkdirSync(Ne,{recursive:!0}),ge.appendFileSync(U.join(Ne,"error.log"),`ERROR [${mt}]: ${I}
840
+ \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(String(J).includes("Incomplete JSON segment at the end")){Y&&(Y=!1,mt?Ie+="</think_fluxflow>":(Ee+="</think_fluxflow>",yield{type:"text",content:"</think_fluxflow>"})),We=!0,await Nt("agent",s);break}if(Y&&(Y=!1,mt?Ie+="</think_fluxflow>":Ee+="</think_fluxflow>"),mt&&Ie.length>0){let Et=0,rt=Math.min(Ct.length,Ie.length);for(let on=rt;on>0;on--)if(Ct.endsWith(Ie.substring(0,on))){Et=on;break}let ht=Ie.substring(Et);if(ht){let at=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(Ct)?ht.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):ht.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");at&&(Ee+=at)}mt=!1,Ie=""}let L=J instanceof Error?(()=>{try{return JSON.parse(JSON.parse(J.message).error.message).error.message}catch{return String(J)}})():String(J),pt=new Date().toLocaleString(),he=U.join(kn,"agent");ge.existsSync(he)||ge.mkdirSync(he,{recursive:!0}),ge.appendFileSync(U.join(he,"error.log"),`ERROR [${pt}]: ${L}
839
841
 
840
842
  ----------------------------------------------------------------------
841
843
 
842
- `);let Je=Z.status||Z.statusCode||Z.code,Rt=String(Z).includes("replicas at capacity");if(!(Je&&(Je>=500&&Je<600||Je===408||Je===429||Rt)||!Je&&(/status[ :]+(5\d\d|408|429)/i.test(String(Z))||/code[ :]+(5\d\d|408|429)/i.test(String(Z))||/(500|503|408|429)/.test(String(Z))))){if(ot<yn-3)throw Z;yield{type:"text",content:I},yield{type:"status",content:"Error Occured"}}if(Ce.trim().length>0||st>1)if(st<=yn){st++;let Ct=Math.min(1e3*Math.pow(2,st-1),24e3);if(Ce.trim().length>0){b.push({role:"agent",text:Ce});let pt=`[system]
844
+ `);let Ke=J.status||J.statusCode||J.code,It=String(J).includes("replicas at capacity");if(!(Ke&&(Ke>=500&&Ke<600||Ke===408||Ke===429||It)||!Ke&&(/status[ :]+(5\d\d|408|429)/i.test(String(J))||/code[ :]+(5\d\d|408|429)/i.test(String(J))||/(500|503|408|429)/.test(String(J))))){if(ot<yn-3)throw J;yield{type:"text",content:L},yield{type:"status",content:"Error Occured"}}if(Ee.trim().length>0||st>1)if(st<=yn){st++;let Et=Math.min(1e3*Math.pow(2,st-1),24e3);if(Ee.trim().length>0){b.push({role:"agent",text:Ee});let rt=`[system]
843
845
  - seamless continuation: resume immediately. pick up from last words with zero gap/disruption
844
846
  - no repetition: do not repeat any text already written
845
847
  - no re-think: do not restart or open <think_fluxflow> if reasoning already started. continue the thinking and close thinking block </think_fluxflow> before chat output
846
848
  - mid-tool safety: if cutoff was mid-tool call, restart that tool call from start
847
- - stealth: do not mention/apologize for cutoff [/system]`;qe.length>0?qe.forEach((ht,rt)=>{rt===qe.length-1?b.push({...ht,text:`${ht.text}
849
+ - stealth: do not mention/apologize for cutoff [/system]`;Xe.length>0?Xe.forEach((ht,on)=>{on===Xe.length-1?b.push({...ht,text:`${ht.text}
848
850
 
849
- ${pt}`}):b.push(ht)}):b.push({role:"user",text:pt}),At+=Ce}for(let pt=Ct/1e3;pt>0&&!kt;pt--)yield{type:"status",content:`Error Occured. Recovering Stream (${st}/${yn}) [Retrying in ${pt.toFixed(0)}s]...`},await new Promise(ht=>setTimeout(ht,1e3));yield{type:"status",content:"Error Occured. Recovering Stream..."}}else throw new Error(`Stream collapsed too many times. (Failed to resolve ${yn} times)
850
- Error log can be found in \`/export logs\``);else{let pt=e.split("/").slice(e.endsWith("/free")?-2:-1).join("/");if(ot<=yn){ot++,st=1,At="";let ht=Math.min(1e3*Math.pow(2,ot-1),32e3),rt=.8+Math.random()*.4,Dt=Math.round(ht*rt);Nn=!0,yield{type:"status",content:`Trying to reach ${pt} (${ot}/${yn}) [Retrying in ${(Dt/1e3).toFixed(0)}s]`};for(let je=Dt/1e3;je>0&&!kt;je--)yield{type:"status",content:`Trying to reach ${pt} (${ot}/${yn}) [Retrying in ${je.toFixed(0)}s]`},await new Promise(jt=>setTimeout(jt,1e3));yield{type:"status",content:`Trying to reach ${pt}`}}else throw new Error(`Model ${e} cannot be reached. (Failed ${yn} times)
851
- Error log can be found in \`/export logs\``)}}}if(cn){let Y=cn.totalTokenCount||0,Z=cn.cachedContentTokenCount||0,I=(cn.candidatesTokenCount||0)+(s==="Google"&&cn.thoughtsTokenCount||0);await St("tokens",Y,s,ee),Z>0&&await St("cachedTokens",Z,s,ee),I>0&&await St("candidateTokens",I,s,ee),vt!==null&&vt>0&&await St("ttft",vt,s,ee),Io({provider:s,model:ee,prompt:cn.promptTokenCount||0,cached:Z,output:I,reasoning:cn.thoughtsTokenCount||0,ttft:vt}),yield{type:"usage",content:cn}}else vt!==null&&vt>0&&(await St("ttft",vt,s,ee),Io({provider:s,model:ee,prompt:0,cached:0,output:0,reasoning:0,ttft:vt}));Ce=da(Ce),vi.push(Ce);let Cl=Ft(Ce),Ii=aa(Ce),xa=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(Ii.toLowerCase())||/\[\[END\]\]/i.test(Ii.toLowerCase())||!0,El=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(Ii.toLowerCase()),_l=Nt>0;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"};let ba=kl(Ce,/(\[\s*(turn\s*:)?\s*(continue|finish)\s*\]|\[\[END\]\])/gi,"").trim(),wa=qe.length>0||Gn(Ft(Ce)).length>0,Xn=(xa||qe.length===0)&&!Ht&&!qn&&!Zt;if(Xn=qe.length===0?Xn:!1,Xn=wa&&on||Jo?!1:Xn,Ce&&Ce.trim().endsWith('")]')&&qe.length===0&&(Xn=!1),Xn){Is=!0;let Y=vi.join(`
852
- `),Z=Ft(Y).trim();yield{type:"interactive_turn_finished",data:{agentText:Me,fullAgentTextRaw:Y,history:[...b],needTitle:_e}},b.length>0&&b[b.length-1].role==="agent"?b[b.length-1].text=Z:b.push({role:"agent",text:Z}),b.forEach(I=>{if(I.role==="user"&&I.text&&(I.text=I.text.replace(/\n\[COMPILE ERROR\][\s\S]*?\[\/ERROR\]/g,""),I.text=I.text.replaceAll(`
851
+ ${rt}`}):b.push(ht)}):b.push({role:"user",text:rt}),Ct+=Ee}for(let rt=Et/1e3;rt>0&&!Tt;rt--)yield{type:"status",content:`Error Occured. Recovering Stream (${st}/${yn}) [Retrying in ${rt.toFixed(0)}s]...`},await new Promise(ht=>setTimeout(ht,1e3));yield{type:"status",content:"Error Occured. Recovering Stream..."}}else throw new Error(`Stream collapsed too many times. (Failed to resolve ${yn} times)
852
+ Error log can be found in \`/export logs\``);else{let rt=e.split("/").slice(e.endsWith("/free")?-2:-1).join("/");if(ot<=yn){ot++,st=1,Ct="";let ht=Math.min(1e3*Math.pow(2,ot-1),32e3),on=.8+Math.random()*.4,at=Math.round(ht*on);Fn=!0,yield{type:"status",content:`Trying to reach ${rt} (${ot}/${yn}) [Retrying in ${(at/1e3).toFixed(0)}s]`};for(let Ge=at/1e3;Ge>0&&!Tt;Ge--)yield{type:"status",content:`Trying to reach ${rt} (${ot}/${yn}) [Retrying in ${Ge.toFixed(0)}s]`},await new Promise(yt=>setTimeout(yt,1e3));yield{type:"status",content:`Trying to reach ${rt}`}}else throw new Error(`Model ${e} cannot be reached. (Failed ${yn} times)
853
+ Error log can be found in \`/export logs\``)}}}if(cn){let Y=cn.totalTokenCount||0,J=cn.cachedContentTokenCount||0,L=(cn.candidatesTokenCount||0)+(s==="Google"&&cn.thoughtsTokenCount||0);await kt("tokens",Y,s,ee),J>0&&await kt("cachedTokens",J,s,ee),L>0&&await kt("candidateTokens",L,s,ee),Rt!==null&&Rt>0&&await kt("ttft",Rt,s,ee),Ro({provider:s,model:ee,prompt:cn.promptTokenCount||0,cached:J,output:L,reasoning:cn.thoughtsTokenCount||0,ttft:Rt}),yield{type:"usage",content:cn}}else Rt!==null&&Rt>0&&(await kt("ttft",Rt,s,ee),Ro({provider:s,model:ee,prompt:0,cached:0,output:0,reasoning:0,ttft:Rt}));Ee=fa(Ee),vi.push(Ee);let El=Ft(Ee),Ii=la(Ee),ba=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(Ii.toLowerCase())||/\[\[END\]\]/i.test(Ii.toLowerCase())||!0,_l=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(Ii.toLowerCase()),vl=Dt>0;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"};let wa=Tl(Ee,/(\[\s*(turn\s*:)?\s*(continue|finish)\s*\]|\[\[END\]\])/gi,"").trim(),Sa=Xe.length>0||Cn(Ft(Ee)).length>0,Jn=(ba||Xe.length===0)&&!Ht&&!Xn&&!Qt;if(Jn=Xe.length===0?Jn:!1,Jn=Sa&&nn||Xo?!1:Jn,Ee&&Ee.trim().endsWith('")]')&&Xe.length===0&&(Jn=!1),Jn){Is=!0;let Y=vi.join(`
854
+ `),J=Ft(Y).trim();yield{type:"interactive_turn_finished",data:{agentText:Pe,fullAgentTextRaw:Y,history:[...b],needTitle:ve}},b.length>0&&b[b.length-1].role==="agent"?b[b.length-1].text=J:b.push({role:"agent",text:J}),b.forEach(L=>{if(L.role==="user"&&L.text&&(L.text=L.text.replace(/\n\[COMPILE ERROR\][\s\S]*?\[\/ERROR\]/g,""),L.text=L.text.replaceAll(`
853
855
 
854
856
  [system] user question. resolve this specific query within '[ANSWER] ... [/ANSWER]' concisely, naturally [/system]
855
857
  `,"").replaceAll(`[system] user question. resolve this specific query within '[ANSWER] ... [/ANSWER]' concisely, naturally
856
858
  **strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]
857
859
  `,"").replaceAll(`[system] **strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]
858
- `,"").replaceAll(/\n\[system\] WARNING, Turn Limit Impending: Step \d+\/\d+\. Wrap up quickly\/prompt user to continue & use \[\[END\]\] quickly\. \[\/system\]/g,""),I.text=I.text.replaceAll(/\n\[system\] File Changes:\n(?:\* .+ \(created|modified|deleted\)\n)*\[\/system\]/g,""),(s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma"))&&(I.text.startsWith("[ACTION RESULT]")||I.text.startsWith("[TOOL RESULT]")))){let Ne=`
859
- [system] Action result received. Analyze output and proceed with your turn [/system]`,Je=`
860
- [system] Action result received. Analyze output and proceed with your turn. **strictly follow thinking policy. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]`;I.text=I.text.replaceAll(Je,"").replaceAll(Ne,"").trim()}}),yield{type:"status",content:"[end]"}}if(Xn)break;let Sa=ba.trim()||"*Working...*";if(b.push({role:"agent",text:Sa}),qe.length>0||Cn){if(qe.length>0){let Y=qe.map(rt=>rt.text).join(`
861
-
862
- `),Z=Ft(Ce),I=Si(Z),mt=Gn(Z),Ne=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,Je=[],Rt=[],Ae;for(;(Ae=Ne.exec(I))!==null;)Rt.push({index:Ae.index,toolName:Ae[1]});for(let rt=0;rt<Rt.length;rt++){let Dt=Rt[rt],je=rt+1<Rt.length?Rt[rt+1].index:Z.length;mt.some(lo=>lo.fullMatch&&Z.startsWith(lo.fullMatch,Dt.index))||Je.push(Z.substring(Dt.index,je))}let Ct=Je.length,pt=qe.length+Ct;if(Ct>0){let rt=Je.join(`
863
- `),Dt=la(rt);Y+=`
864
-
865
- [system] Only ${qe.length} out of ${pt} attempted tool calls were executed.
866
- ${Dt?`Parsing Issues Detected:
867
- ${Dt}
868
- `:""}Verify proper structure compliance [action:ActionName(arg="value")] & try failed calls again [/system]`;for(let je=0;je<Ct;je++)await $t("toolFailure")}let ht=qe.find(rt=>rt.binaryPart)?.binaryPart||null;b.push({role:"user",text:Y,binaryPart:ht})}}else if(!kt){let Y=Ce.replace(/(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\]|$)/i,""),I=(Si(Y).match(/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi)||[]).length;if(Jo||on&&I>0||I>0){let mt=la(Y),Ne=mt?`[system] Failed to execute ${I>0?I:1} tool call${I>1?"s":""} due to syntax/structure issues:
869
- ${mt} [/system]`:`[system] Failed to execute ${I>0?I:1} tool${I>1?"s":""}. Verify proper structure compliance [action:ActionName(arg="value")] & try again [/system]`;b.push({role:"user",text:Ne}),await $t("toolFailure"),yield{type:"visual_feedback",content:`
870
- ${zt("\u2718 Model produced malformed tool call")}
860
+ `,"").replaceAll(/\n\[system\] WARNING, Turn Limit Impending: Step \d+\/\d+\. Wrap up quickly\/prompt user to continue & use \[\[END\]\] quickly\. \[\/system\]/g,""),L.text=L.text.replaceAll(/\n\[system\] File Changes:\n(?:\* .+ \(created|modified|deleted\)\n)*\[\/system\]/g,""),(s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma"))&&(L.text.startsWith("[ACTION RESULT]")||L.text.startsWith("[TOOL RESULT]")))){let he=`
861
+ [system] Action result received. Analyze output and proceed with your turn [/system]`,Ke=`
862
+ [system] Action result received. Analyze output and proceed with your turn. **strictly follow thinking policy. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]`;L.text=L.text.replaceAll(Ke,"").replaceAll(he,"").trim()}}),yield{type:"status",content:"[end]"}}if(Jn)break;let ka=wa.trim()||"*Working...*";if(b.push({role:"agent",text:ka}),Xe.length>0||_n){if(Xe.length>0){let Y=Xe.map(at=>at.text).join(`
863
+
864
+ `),J=Ft(Ee),L=Cn(J),pt=aa(J,L),he=Si(pt),Ke=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,It=[],ke=[],Et;for(;(Et=Ke.exec(he))!==null;)ke.push({index:Et.index,toolName:Et[1]});for(let at=0;at<ke.length;at++){let Ge=ke[at],yt=at+1<ke.length?ke[at+1].index:J.length;L.some(xn=>xn.fullMatch&&J.startsWith(xn.fullMatch,Ge.index))||It.push(J.substring(Ge.index,yt))}let rt=It.length,ht=Xe.length+rt;if(rt>0){let at=It.join(`
865
+ `),Ge=ca(at);Y+=`
866
+
867
+ [system] Only ${Xe.length} out of ${ht} attempted tool calls were executed.
868
+ ${Ge?`Parsing Issues Detected:
869
+ ${Ge}
870
+ `:""}Verify proper structure compliance [action:ActionName(arg="value")] & try failed calls again [/system]`;for(let yt=0;yt<rt;yt++)await Nt("toolFailure")}let on=Xe.find(at=>at.binaryPart)?.binaryPart||null;b.push({role:"user",text:Y,binaryPart:on})}}else if(!Tt){let Y=Ee.replace(/(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\]|$)/i,""),J=Cn(Y),L=aa(Y,J),he=(Si(L).match(/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi)||[]).length;if(Xo||nn&&he>0||he>0){let Ke=ca(Y),It=Ke?`[system] Failed to execute ${he>0?he:1} tool call${he>1?"s":""} due to syntax/structure issues:
871
+ ${Ke} [/system]`:`[system] Failed to execute ${he>0?he:1} tool${he>1?"s":""}. Verify proper structure compliance [action:ActionName(arg="value")] & try again [/system]`;b.push({role:"user",text:It}),await Nt("toolFailure"),yield{type:"visual_feedback",content:`
872
+ ${Yt("\u2718 Model produced malformed tool call")}
871
873
  `}}else yield{type:"visual_feedback",content:`
872
- ${zt("\u2718 Loop Detected")}
873
- `},b.push({role:"user",text:`[system] ${qn&&!Ht?"Stuttering Detected by Internal System. Re-calibrate your response & proceed.":`${Ht?" Over Thinking":" Loop"} Detected by Internal System${Ht?" for current Effort Level":""}. ${Ht?"If you have planned the task, prioritize execution/output":"If you have finished your task provide a simple summary and end"}`} [/system]`});Ht=!1,qn=!1,Zt=!1}m?.advanceRollback&&await Mo.recordTurnDelta(h,P+1,ke),Ri=ke.includes("recapture_screen"),Jo=Nt>0||Cn}if(!Is&&!kt){let P="\u2726 Turn safety limit reached. Stopping execution.";yield{type:"text",content:`
874
+ ${Yt("\u2718 Loop Detected")}
875
+ `},b.push({role:"user",text:`[system] ${Xn&&!Ht?"Stuttering Detected by Internal System. Re-calibrate your response & proceed.":`${Ht?" Over Thinking":" Loop"} Detected by Internal System${Ht?" for current Effort Level":""}. ${Ht?"If you have planned the task, prioritize execution/output":"If you have finished your task provide a simple summary and end"}`} [/system]`});Ht=!1,Xn=!1,Qt=!1}m?.advanceRollback&&await Io.recordTurnDelta(h,M+1,Ae),Ri=Ae.includes("recapture_screen"),Xo=Dt>0||_n}if(!Is&&!Tt){let M="\u2726 Turn safety limit reached. Stopping execution.";yield{type:"text",content:`
874
876
 
875
- ${P}
876
- `};let ve=(vi.join(`
877
+ ${M}
878
+ `};let Re=(vi.join(`
877
879
  `)+`
878
- ${P}`).trim();yield{type:"interactive_turn_finished",data:{agentText:Me,fullAgentTextRaw:ve,history:[...b],needTitle:_e}},yield{type:"status",content:"[end]"}}}catch(H){let b=H?.cause?` (Cause: ${H.cause?.message||String(H.cause)})`:"",Le=(H instanceof Error?(()=>{try{return JSON.parse(JSON.parse(H.message).error.message).error.message}catch{return(H.message?`${H.message}${b}`:"")||String(H)}})():String(H)).replace(/^(Error:\s*)+/i,"");s==="Google"&&!/^[A-Z0-9_\-\s]+ ERROR:/i.test(Le)&&(Le=`GEMINI ERROR: ${Le}`);let Et=new Date().toLocaleString(),Fe=U.join(Sn,"agent");yield{type:"text",content:`
880
+ ${M}`).trim();yield{type:"interactive_turn_finished",data:{agentText:Pe,fullAgentTextRaw:Re,history:[...b],needTitle:ve}},yield{type:"status",content:"[end]"}}}catch(H){let b=H?.cause?` (Cause: ${H.cause?.message||String(H.cause)})`:"",$e=(H instanceof Error?(()=>{try{return JSON.parse(JSON.parse(H.message).error.message).error.message}catch{return(H.message?`${H.message}${b}`:"")||String(H)}})():String(H)).replace(/^(Error:\s*)+/i,"");s==="Google"&&!/^[A-Z0-9_\-\s]+ ERROR:/i.test($e)&&($e=`GEMINI ERROR: ${$e}`);let _t=new Date().toLocaleString(),Fe=U.join(kn,"agent");yield{type:"text",content:`
879
881
 
880
- \u2726 CRITICAL ERROR: ${Le.includes("fetch failed")?"Failed to Connect. Check your Internet Connection or Wait a moment":Le}
881
- \u2800`},ge.existsSync(Fe)||ge.mkdirSync(Fe,{recursive:!0}),ge.appendFileSync(U.join(Fe,"error.log"),`CRITICAL ERROR [${Et}]: ${H}${H?.cause?`
882
+ \u2726 CRITICAL ERROR: ${$e.includes("fetch failed")?"Failed to Connect. Check your Internet Connection or Wait a moment":$e}
883
+ \u2800`},ge.existsSync(Fe)||ge.mkdirSync(Fe,{recursive:!0}),ge.appendFileSync(U.join(Fe,"error.log"),`CRITICAL ERROR [${_t}]: ${H}${H?.cause?`
882
884
  CAUSE: ${H.cause?.stack||H.cause}`:""}
883
885
 
884
886
  ----------------------------------------------------------------------
885
887
 
886
- `),typeof flushGoogleBuffer=="function"&&(yield*flushGoogleBuffer()),yield{type:"tool_result",content:`ERROR: [INTERNAL CRITICAL] ${Le}`}}finally{Ze&&(clearInterval(Ze),Ze=null),typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),await si.commitTransaction(),m?.advanceRollback&&await Mo.cleanup(h),await oo()}yield{type:"status",content:null}},Gd=async(e,n,t=null,i=null,o=null,r=null,d=!1)=>{let l=await Ro(),u={...l,...n},h=typeof o=="number"&&o>0?o:50,x=(u?.systemSettings?.loopLimits||"Default").toLowerCase();if(x==="extended")h=Math.floor(h*3);else if(x==="env"){let Fe=parseInt(process.env.FLUXFLOW_SUBAGENT_MAX_TURNS||process.env.SUBAGENT_MAX_TURNS||process.env.FLUXFLOW_MAX_LOOPS||process.env.MAX_LOOPS||"",10);Number.isFinite(Fe)&&Fe>0&&(h=Fe)}o=h;let m=process.env.SUBAGENT_MODEL?process.env.SUBAGENT_MODEL.trim():null,f=process.env.SUBAGENT_PROVIDER?process.env.SUBAGENT_PROVIDER.trim():null,s=new Date,p=`${s.getFullYear()}-${s.toLocaleString("en-US",{month:"short"}).toUpperCase()}-${String(s.getDate()).padStart(2,"0")}, ${s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0}).replace(":","-")}`,ue=(Fe=>{if(!Fe)return null;let ce=Fe.toLowerCase();return ce==="google"?"Google":ce==="deepseek"?"DeepSeek":ce==="openrouter"?"OpenRouter":ce==="nvidia"?"NVIDIA":ce==="mistral"?"Mistral":ce==="ollama"?"Ollama":ce==="inferx"?"InferX":ce==="sensenova"?"SenseNova":ce==="poolside"?"Poolside":ce==="9router"||ce==="9Router"?"9router":ce==="aihubmix"||ce==="aihub"?"AIHubMix":ce==="explabs"||ce==="experientiallabs"||ce==="experimentallabs"?"ExpLabs":ce==="tokenharbor"||ce==="token harbor"||ce==="token_harbor"||ce==="thk"?"TokenHarbor":ce==="infron"?"Infron":ce==="apinex"||ce==="apx"?"APInex":ce==="xkiro"||ce==="kiro"?"xKiro":ce==="c_openai"||ce==="custom_openai"||ce==="custom (openai)"||ce==="custom"?"c_openai":null})(f),y=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentModel:null,A=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentProvider:null,L=null;if(y==="ENV"?(L=m,m&&ue&&(u.aiProvider=ue)):y&&y!=="Default"?(L=y,A&&(u.aiProvider=A)):m&&ue&&(u.aiProvider=ue),u.aiProvider){let Fe=await Fi(u.aiProvider);Fe&&(u.apiKey=Fe)}let W=Fe=>{if(!Fe||typeof Fe!="string")return{allowed:!0};let ce=[/rm\s+-[rf]{1,2}\s+[\/*.]/i,/rmdir\s+\/[sq]/i,/del\s+\/[fsq]/i,/\bformat\b\s+[a-z]:/i,/mkfs/i,/dd\s+if=/i,/\b(shutdown|reboot|poweroff|init\s+0|init\s+6)\b/i,/chmod\s+(-R\s+)?777\s+[\/*.]/i,/chown\s+(-R\s+)?root/i,/git\s+push\s+.*--force/i,/git\s+clean\s+-fdx/i,/\bsudo\s+su\b/i,/\bsu\s+-\b/i];for(let Bt of ce)if(Bt.test(Fe))return{allowed:!1,reason:`Blocked potentially destructive or unsafe command pattern: "${Bt.source}"`};return{allowed:!0}},$=t||L||n?.modelName||n?.activeModel||l.activeModel,we=(process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux")==="Windows",_e=we&&u?.systemSettings?.preferBash!==!1&&Bs(),Me="Run(command=string)",Ze=`Runs ${we?Gi()?"powershell":"windows CMD":"bash"} command`;_e&&(Me=`Run(command=string, ${Us()||Gi()?"forcePowershell?=bool:false":"forceCwd?=bool:false"})`,Ze="Runs in git bash. Or force native shell");let H=`-- ACTIONS (path = relative to CWD, path separator: '/') --
888
+ `),typeof flushGoogleBuffer=="function"&&(yield*flushGoogleBuffer()),yield{type:"tool_result",content:`ERROR: [INTERNAL CRITICAL] ${$e}`}}finally{Ze&&(clearInterval(Ze),Ze=null),typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),await si.commitTransaction(),m?.advanceRollback&&await Io.cleanup(h),await oo()}yield{type:"status",content:null}},Hd=async(e,n,t=null,i=null,o=null,r=null,d=!1)=>{let l=await vo(),u={...l,...n},h=typeof o=="number"&&o>0?o:50,x=(u?.systemSettings?.loopLimits||"Default").toLowerCase();if(x==="extended")h=Math.floor(h*3);else if(x==="env"){let Fe=parseInt(process.env.FLUXFLOW_SUBAGENT_MAX_TURNS||process.env.SUBAGENT_MAX_TURNS||process.env.FLUXFLOW_MAX_LOOPS||process.env.MAX_LOOPS||"",10);Number.isFinite(Fe)&&Fe>0&&(h=Fe)}o=h;let m=process.env.SUBAGENT_MODEL?process.env.SUBAGENT_MODEL.trim():null,f=process.env.SUBAGENT_PROVIDER?process.env.SUBAGENT_PROVIDER.trim():null,s=new Date,p=`${s.getFullYear()}-${s.toLocaleString("en-US",{month:"short"}).toUpperCase()}-${String(s.getDate()).padStart(2,"0")}, ${s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0}).replace(":","-")}`,ue=(Fe=>{if(!Fe)return null;let ce=Fe.toLowerCase();return ce==="google"?"Google":ce==="deepseek"?"DeepSeek":ce==="openrouter"?"OpenRouter":ce==="nvidia"?"NVIDIA":ce==="mistral"?"Mistral":ce==="ollama"?"Ollama":ce==="inferx"?"InferX":ce==="sensenova"?"SenseNova":ce==="poolside"?"Poolside":ce==="9router"||ce==="9Router"?"9router":ce==="aihubmix"||ce==="aihub"?"AIHubMix":ce==="explabs"||ce==="experientiallabs"||ce==="experimentallabs"?"ExpLabs":ce==="tokenharbor"||ce==="token harbor"||ce==="token_harbor"||ce==="thk"?"TokenHarbor":ce==="infron"?"Infron":ce==="apinex"||ce==="apx"?"APInex":ce==="xkiro"||ce==="kiro"?"xKiro":ce==="c_openai"||ce==="custom_openai"||ce==="custom (openai)"||ce==="custom"?"c_openai":null})(f),y=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentModel:null,A=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentProvider:null,O=null;if(y==="ENV"?(O=m,m&&ue&&(u.aiProvider=ue)):y&&y!=="Default"?(O=y,A&&(u.aiProvider=A)):m&&ue&&(u.aiProvider=ue),u.aiProvider){let Fe=await Fi(u.aiProvider);Fe&&(u.apiKey=Fe)}let W=Fe=>{if(!Fe||typeof Fe!="string")return{allowed:!0};let ce=[/rm\s+-[rf]{1,2}\s+[\/*.]/i,/rmdir\s+\/[sq]/i,/del\s+\/[fsq]/i,/\bformat\b\s+[a-z]:/i,/mkfs/i,/dd\s+if=/i,/\b(shutdown|reboot|poweroff|init\s+0|init\s+6)\b/i,/chmod\s+(-R\s+)?777\s+[\/*.]/i,/chown\s+(-R\s+)?root/i,/git\s+push\s+.*--force/i,/git\s+clean\s+-fdx/i,/\bsudo\s+su\b/i,/\bsu\s+-\b/i];for(let Bt of ce)if(Bt.test(Fe))return{allowed:!1,reason:`Blocked potentially destructive or unsafe command pattern: "${Bt.source}"`};return{allowed:!0}},$=t||O||n?.modelName||n?.activeModel||l.activeModel,Se=(process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux")==="Windows",ve=Se&&u?.systemSettings?.preferBash!==!1&&Bs(),Pe="Run(command=string)",Ze=`Runs ${Se?Gi()?"powershell":"windows CMD":"bash"} command`;ve&&(Pe=`Run(command=string, ${Us()||Gi()?"forcePowershell?=bool:false":"forceCwd?=bool:false"})`,Ze="Runs in git bash. Or force native shell");let H=`-- ACTIONS (path = relative to CWD, path separator: '/') --
887
889
  In chat output the format \`[action:ActionName(arg1="value1")]\` in NEW line
888
890
  Rules:
889
891
  - JSON escape literal sequences, backslash: \\\\, newLine: \\ n
@@ -907,7 +909,7 @@ ${d?"- AskMain(question=string). Communicate with PARENT/MAIN AGENT. When clarif
907
909
  - ReadFile(path=string, startLine?=int, endLine?=int)
908
910
  - PatchFile(path=string, allowMultiple?=bool, searchContent1="string match OR ^LINE:start..end$", newContent1=string, ...MAX15). Small searchString. Line Anchors: ^LINE:...$ syntax, must for large blocks & escape sequences
909
911
  - WriteFile(path=string, content=string). Creates/Overwrites. File Exist? PatchFile > WriteFile
910
- - ${Me}. ${Ze}. Destructive command \u2192 Ask user`.trim(),b=`=== START SYSTEM PROMPT ===
912
+ - ${Pe}. ${Ze}. Destructive command \u2192 Ask user`.trim(),b=`=== START SYSTEM PROMPT ===
911
913
  Identity: FluxFlow subagent helping the main Agent
912
914
  Your task: "${e}"
913
915
  CWD: ${process.cwd()}
@@ -920,30 +922,30 @@ Main focus: actions and task, not chatting
920
922
  On completion, provide a detailed summary in Tables/Markdown Format with file modified info. If any task failed report back in detail
921
923
 
922
924
  Current Time: ${p}
923
- === END SYSTEM PROMPT ===`,Tt=[{role:"user",text:`Complete this task: ${e}`}],Le=0,Et="";for(;Le<o;){let Fe=await Bi("subagent",u);if(!Fe.allowed)throw new Error(Fe.reason||`Budget Exhausted for Provider (${u?.aiProvider||"Subagent"})`);if(kt){if(n?.taskId&&typeof tn<"u"){let M=tn.find(C=>C.id===n.taskId);M&&(M.status="cancelled")}throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}if(n?.taskId&&typeof tn<"u"){let M=tn.find(C=>C.id===n.taskId);if(M&&M.status==="cancelled")throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}let ce=Tt.map(M=>({role:M.role==="user"?"user":"model",parts:[{text:M.text}]}));r&&r(`[Subagent Turn ${Le+1}]...`);let Bt=["Fast","Low","Medium","High"],Hn=process.env.SUBAGENT_THINKING,jn=Bt.includes(Hn)?Hn:"Low",_t=(await ki(u,$,ce,b,jn)).text||"",qt=da(Ft(_t).trim());Et=qt,r&&r(`[Subagent Response]
924
- ${qt}
925
- `),Tt.push({role:"agent",text:qt});let de=Gn(qt);if(de.length===0)break;let Ue=de.filter(M=>M.toolName.toLowerCase()==="askmain"||M.toolName.toLowerCase()==="ask_main"),ze=!1,N="";for(let M of de){if(kt){if(n?.taskId&&typeof tn<"u"){let S=tn.find(F=>F.id===n.taskId);S&&(S.status="cancelled")}throw new Error("Subagent task was cancelled.")}if(n?.taskId&&typeof tn<"u"){let S=tn.find(F=>F.id===n.taskId);if(S&&S.status==="cancelled")throw new Error("Subagent task was cancelled.")}let C=M.toolName.toLowerCase();if(C==="askuser"&&(C="ask"),C==="askmain"||C==="ask_main"){if(ze)continue;ze=!0;let S="";if(Ue.length===1?S=B(Ue[0].args).question||Ue[0].args:S=Ue.map((F,ft)=>{let it=B(F.args);return`Q${ft+1}: ${it.question||F.args}`}).join(`
925
+ === END SYSTEM PROMPT ===`,At=[{role:"user",text:`Complete this task: ${e}`}],$e=0,_t="";for(;$e<o;){let Fe=await Bi("subagent",u);if(!Fe.allowed)throw new Error(Fe.reason||`Budget Exhausted for Provider (${u?.aiProvider||"Subagent"})`);if(Tt){if(n?.taskId&&typeof en<"u"){let I=en.find(C=>C.id===n.taskId);I&&(I.status="cancelled")}throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}if(n?.taskId&&typeof en<"u"){let I=en.find(C=>C.id===n.taskId);if(I&&I.status==="cancelled")throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}let ce=At.map(I=>({role:I.role==="user"?"user":"model",parts:[{text:I.text}]}));r&&r(`[Subagent Turn ${$e+1}]...`);let Bt=["Fast","Low","Medium","High"],jn=process.env.SUBAGENT_THINKING,Kn=Bt.includes(jn)?jn:"Low",vt=(await ki(u,$,ce,b,Kn)).text||"",zt=fa(Ft(vt).trim());_t=zt,r&&r(`[Subagent Response]
926
+ ${zt}
927
+ `),At.push({role:"agent",text:zt});let de=Cn(zt);if(de.length===0)break;let Ue=de.filter(I=>I.toolName.toLowerCase()==="askmain"||I.toolName.toLowerCase()==="ask_main"),qe=!1,N="";for(let I of de){if(Tt){if(n?.taskId&&typeof en<"u"){let S=en.find(F=>F.id===n.taskId);S&&(S.status="cancelled")}throw new Error("Subagent task was cancelled.")}if(n?.taskId&&typeof en<"u"){let S=en.find(F=>F.id===n.taskId);if(S&&S.status==="cancelled")throw new Error("Subagent task was cancelled.")}let C=I.toolName.toLowerCase();if(C==="askuser"&&(C="ask"),C==="askmain"||C==="ask_main"){if(qe)continue;qe=!0;let S="";if(Ue.length===1?S=B(Ue[0].args).question||Ue[0].args:S=Ue.map((F,ut)=>{let it=B(F.args);return`Q${ut+1}: ${it.question||F.args}`}).join(`
926
928
  `),n.onAskMain){r&&r(`[Executing Tool] AskMain("${S}")...`);let F=await n.onAskMain(S);r&&r(`[Action Result]
927
929
  Answer from Main Agent: ${F}
928
930
  `),N+=`[ACTION RESULT for AskMain]: Answer from Main Agent: ${F}
929
931
 
930
- `,await $t("toolSuccess")}else N+=`[ACTION RESULT for AskMain]: ERROR: Main agent communication channel not available.
932
+ `,await Nt("toolSuccess")}else N+=`[ACTION RESULT for AskMain]: ERROR: Main agent communication channel not available.
931
933
 
932
- `;continue}if(!(i?i.some(S=>S.toLowerCase()===C):!0)){let S=`ERROR: Tool [${M.toolName}] is not in the allowed tools list for this subagent.`;r&&r(`[Blocked Tool Call] ${M.toolName} - not allowed
934
+ `;continue}if(!(i?i.some(S=>S.toLowerCase()===C):!0)){let S=`ERROR: Tool [${I.toolName}] is not in the allowed tools list for this subagent.`;r&&r(`[Blocked Tool Call] ${I.toolName} - not allowed
933
935
  `),N+=`${S}
934
936
 
935
- `;continue}if(C==="exec_command"||C==="execcommand"||C==="run"){let S=B(M.args).command||"",F=W(S);if(!F.allowed){let ft=`ERROR: [SECURITY RESTRICTION] Subagent execution blocked command: ${F.reason}`;r&&r(`[Blocked Command] ${S} - ${F.reason}
936
- `),N+=`${ft}
937
+ `;continue}if(C==="exec_command"||C==="execcommand"||C==="run"){let S=B(I.args).command||"",F=W(S);if(!F.allowed){let ut=`ERROR: [SECURITY RESTRICTION] Subagent execution blocked command: ${F.reason}`;r&&r(`[Blocked Command] ${S} - ${F.reason}
938
+ `),N+=`${ut}
937
939
 
938
- `;continue}}let Ge="";if(C==="web_search"||C==="websearch")Ge=`\u2714 \x1B[95mSearched\x1B[0m: ${B(M.args).query||""}`;else if(C==="web_scrape"||C==="webscrape")Ge=`\u2714 \x1B[95mScraped\x1B[0m: ${B(M.args).url||""}`;else if(C==="search_keyword"||C==="searchkeyword"||C==="codesearch"||C==="code_search"){let S=B(M.args),F=S.keyword||"",ft=S.path||"";Ge=`${F?"\u2714":"\u2718"} \x1B[95mSearched\x1B[0m: ${F||"No Query"}${ft?` \u2192 ${ft.replaceAll("\\","/")}`:""}`}else if(C==="view_file"||C==="viewfile"||C==="readfile")Ge=`\u2714 \x1B[95mRead\x1B[0m: ${(B(M.args).path||"").replaceAll("\\","/")}`;else if(C==="find_file"||C==="findfile"){let S=B(M.args),F=S.basename||S.name||S.path||S.file||S.query||"";Ge=`${F?"\u2714":"\u2718"} \x1B[95mLocated\x1B[0m: ${F||"No Query"}`}else if(C==="list_files"||C==="read_folder"||C==="readfolder"){let S=B(M.args).path||null,F=B(M.args).recurse||0;Ge=`${S?"\u2714":"\u2718"} \x1B[95mBrowsed\x1B[0m: ${S?`${S.replaceAll("\\","/")}${F>0?`${S.endsWith("/")?`*${F}`:`/*${F}`}`:`${S.endsWith("/")?"":"/"}`}`:""}`}else if(C==="write_file"||C==="writefile"){let S=B(M.args).path||null;Ge=`${S?"\u2714":"\u2718"} \x1B[95mCreated\x1B[0m: ${S?`${S.replaceAll("\\","/")}`:"No File Changes"}`}else if(C==="update_file"||C==="updatefile"||C==="patchfile"||C==="patch_file"){let S=B(M.args),F=S.path||null,it=Object.entries(S).some(([$e,ut])=>$e.startsWith("searchContent")&&typeof ut=="string"&&ut.startsWith("^LINE:"))?"\u1361":":";Ge=`${F?"\u2714":"\u2718"} \x1B[95mEdited\x1B[0m${it} ${F?`${F.replaceAll("\\","/")}`:"No File Changes"}`}else if(C==="exec_command"||C==="execcommand"||C==="run"){let S=B(M.args).command||null;Ge=`${S?"\u2714":"\u2718"} \x1B[95mExecuted\x1B[0m: ${S?S.slice(0,100)+(S.length>100?"...":""):"No Command"}`}else if(C==="file_map"||C==="filemap"){let S=B(M.args).path||"";Ge=`${S?"\u2714":"\u2718"} \x1B[95mIndexed\x1B[0m: ${S?`${S.replaceAll("\\","/")}`:"File Not Found"}`}else if(C==="await"){let{time:S}=B(M.args),F=parseFloat(S)||0;F<10&&(F=10),F>180&&(F=180),Ge=`\u2714 \x1B[95mAwaiting\x1B[0m \u2192 ${(it=>{if(it>=60){let $e=Math.floor(it/60),ut=it%60;return`${$e}m${ut>0?` ${ut}s`:""}`}return`${it}s`})(F)}`}else{let S=xs[C]||M.toolName,F=so(C,M.args);Ge=`\u2714 \x1B[95m${S}\x1B[0m${F?`: ${F}`:""}`}n.onVisualFeedback&&Ge&&n.onVisualFeedback(Ge),r&&r(`[Executing Tool] ${M.toolName}(${M.args})...`);try{let S=await Ho(M.toolName,M.args,{...n,mode:"Flux"});if(r&&r(`[Action Result]
940
+ `;continue}}let He="";if(C==="web_search"||C==="websearch")He=`\u2714 \x1B[95mSearched\x1B[0m: ${B(I.args).query||""}`;else if(C==="web_scrape"||C==="webscrape")He=`\u2714 \x1B[95mScraped\x1B[0m: ${B(I.args).url||""}`;else if(C==="search_keyword"||C==="searchkeyword"||C==="codesearch"||C==="code_search"){let S=B(I.args),F=S.keyword||"",ut=S.path||"";He=`${F?"\u2714":"\u2718"} \x1B[95mSearched\x1B[0m: ${F||"No Query"}${ut?` \u2192 ${ut.replaceAll("\\","/")}`:""}`}else if(C==="view_file"||C==="viewfile"||C==="readfile")He=`\u2714 \x1B[95mRead\x1B[0m: ${(B(I.args).path||"").replaceAll("\\","/")}`;else if(C==="find_file"||C==="findfile"){let S=B(I.args),F=S.basename||S.name||S.path||S.file||S.query||"";He=`${F?"\u2714":"\u2718"} \x1B[95mLocated\x1B[0m: ${F||"No Query"}`}else if(C==="list_files"||C==="read_folder"||C==="readfolder"){let S=B(I.args).path||null,F=B(I.args).recurse||0;He=`${S?"\u2714":"\u2718"} \x1B[95mBrowsed\x1B[0m: ${S?`${S.replaceAll("\\","/")}${F>0?`${S.endsWith("/")?`*${F}`:`/*${F}`}`:`${S.endsWith("/")?"":"/"}`}`:""}`}else if(C==="write_file"||C==="writefile"){let S=B(I.args).path||null;He=`${S?"\u2714":"\u2718"} \x1B[95mCreated\x1B[0m: ${S?`${S.replaceAll("\\","/")}`:"No File Changes"}`}else if(C==="update_file"||C==="updatefile"||C==="patchfile"||C==="patch_file"){let S=B(I.args),F=S.path||null,it=Object.entries(S).some(([Ne,gt])=>Ne.startsWith("searchContent")&&typeof gt=="string"&&gt.startsWith("^LINE:"))?"\u1361":":";He=`${F?"\u2714":"\u2718"} \x1B[95mEdited\x1B[0m${it} ${F?`${F.replaceAll("\\","/")}`:"No File Changes"}`}else if(C==="exec_command"||C==="execcommand"||C==="run"){let S=B(I.args).command||null;He=`${S?"\u2714":"\u2718"} \x1B[95mExecuted\x1B[0m: ${S?S.slice(0,100)+(S.length>100?"...":""):"No Command"}`}else if(C==="file_map"||C==="filemap"){let S=B(I.args).path||"";He=`${S?"\u2714":"\u2718"} \x1B[95mIndexed\x1B[0m: ${S?`${S.replaceAll("\\","/")}`:"File Not Found"}`}else if(C==="await"){let{time:S}=B(I.args),F=parseFloat(S)||0;F<10&&(F=10),F>180&&(F=180),He=`\u2714 \x1B[95mAwaiting\x1B[0m \u2192 ${(it=>{if(it>=60){let Ne=Math.floor(it/60),gt=it%60;return`${Ne}m${gt>0?` ${gt}s`:""}`}return`${it}s`})(F)}`}else{let S=xs[C]||I.toolName,F=so(C,I.args);He=`\u2714 \x1B[95m${S}\x1B[0m${F?`: ${F}`:""}`}n.onVisualFeedback&&He&&n.onVisualFeedback(He),r&&r(`[Executing Tool] ${I.toolName}(${I.args})...`);try{let S=await Go(I.toolName,I.args,{...n,mode:"Flux"});if(r&&r(`[Action Result]
939
941
  ${S}
940
- `),N+=`[ACTION RESULT for ${M.toolName}]: ${S}
942
+ `),N+=`[ACTION RESULT for ${I.toolName}]: ${S}
941
943
 
942
- `,await $t("toolSuccess"),C==="patchfile"||C==="update_file"||C==="updatefile"||C==="patch_file"){if(S){let F=S.split(`
943
- `),ft=0,it=0,$e=!1;for(let ut of F){if(ut.includes("[DIFF_START]")){$e=!0;continue}if(ut.includes("[DIFF_END]")){$e=!1;continue}$e&&(/^\+\s*\d+/.test(ut)?ft++:/^\-\s*\d+/.test(ut)&&it++)}(ft>0||it>0)&&(await St("linesAdded",ft),await St("linesRemoved",it))}}else if((C==="writefile"||C==="write_file")&&S){let F=S.match(/- Stats: \[(\d+) lines/),ft=F?parseInt(F[1]):0,it=0;if(S.includes("Old File contents:")){let $e=!1;for(let ut of S.split(`
944
- `)){if(ut.includes("Old File contents:")){$e=!0;continue}$e&&(ut.startsWith("- Content Preview:")||ut.trim()===""&&!/^\s*\d+\s*\|/.test(ut)?$e=!1:/^\s*\d+\s*\|/.test(ut)&&it++)}}(ft>0||it>0)&&(await St("linesAdded",ft),await St("linesRemoved",it))}}catch(S){let F=`ERROR: Execution failed for [${M.toolName}]: ${S.message}`;r&&r(`[Tool Error] ${F}
944
+ `,await Nt("toolSuccess"),C==="patchfile"||C==="update_file"||C==="updatefile"||C==="patch_file"){if(S){let F=S.split(`
945
+ `),ut=0,it=0,Ne=!1;for(let gt of F){if(gt.includes("[DIFF_START]")){Ne=!0;continue}if(gt.includes("[DIFF_END]")){Ne=!1;continue}Ne&&(/^\+\s*\d+/.test(gt)?ut++:/^\-\s*\d+/.test(gt)&&it++)}(ut>0||it>0)&&(await kt("linesAdded",ut),await kt("linesRemoved",it))}}else if((C==="writefile"||C==="write_file")&&S){let F=S.match(/- Stats: \[(\d+) lines/),ut=F?parseInt(F[1]):0,it=0;if(S.includes("Old File contents:")){let Ne=!1;for(let gt of S.split(`
946
+ `)){if(gt.includes("Old File contents:")){Ne=!0;continue}Ne&&(gt.startsWith("- Content Preview:")||gt.trim()===""&&!/^\s*\d+\s*\|/.test(gt)?Ne=!1:/^\s*\d+\s*\|/.test(gt)&&it++)}}(ut>0||it>0)&&(await kt("linesAdded",ut),await kt("linesRemoved",it))}}catch(S){let F=`ERROR: Execution failed for [${I.toolName}]: ${S.message}`;r&&r(`[Tool Error] ${F}
945
947
  `),N+=`${F}
946
948
 
947
- `,await $t("toolFailure")}}let nn="";if(n?.taskId&&typeof tn<"u"){let M=tn.find(C=>C.id===n.taskId);if(M&&M.pendingSteerMessages&&M.pendingSteerMessages.length>0){let C=[...M.pendingSteerMessages];M.pendingSteerMessages=[];for(let et of C)nn+=`
949
+ `,await Nt("toolFailure")}}let tn="";if(n?.taskId&&typeof en<"u"){let I=en.find(C=>C.id===n.taskId);if(I&&I.pendingSteerMessages&&I.pendingSteerMessages.length>0){let C=[...I.pendingSteerMessages];I.pendingSteerMessages=[];for(let et of C)tn+=`
948
950
 
949
- [STEERING INSTRUCTION FROM MAIN AGENT]: ${et}`,r&&r(`[Subagent Steered] ${et}`)}}let Ut=(N.trim()+nn).trim();Tt.push({role:"user",text:Ut}),Le++}return Et};export{yo as a,bi as b,jc as c,Kc as d,gc as e,mc as f,ho as g,pc as h,Ic as i,Mc as j,gl as k,Ld as l,ml as m,pl as n,ys as o,Ft as p,wi as q,da as r,bl as s,$d as t,Nd as u,ws as v,Dd as w,Si as x,Sl as y,Gn as z,Fd as A,ki as B,Bd as C,Ud as D,Wd as E,Gd as F};
951
+ [STEERING INSTRUCTION FROM MAIN AGENT]: ${et}`,r&&r(`[Subagent Steered] ${et}`)}}let Ut=(N.trim()+tn).trim();At.push({role:"user",text:Ut}),$e++}return _t};export{ho as a,bi as b,Kc as c,Vc as d,mc as e,pc as f,po as g,hc as h,Mc as i,Pc as j,ml as k,$d as l,pl as m,hl as n,ys as o,Ft as p,wi as q,fa as r,wl as s,Nd as t,Dd as u,ws as v,Fd as w,Si as x,aa as y,kl as z,Cn as A,Bd as B,ki as C,Ud as D,Wd as E,Gd as F,Hd as G};