fluxflow-cli 5.3.0 → 5.4.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.
@@ -1,4 +1,4 @@
1
- import{a as Xs}from"./chunk-XPIXBWTZ.js";import{a as So}from"./chunk-BLAXTPPN.js";import{a as Nt}from"./chunk-56EJGQU3.js";import{a as Js}from"./chunk-L22YGL6T.js";import{c as Hi,g as ji,h as js,i as Ks,j as Vs}from"./chunk-KIPZOUEA.js";import{b as zs,c as qs,d as Ki,f as Ys}from"./chunk-BNKY5QOA.js";import{a as oi}from"./chunk-KOCMIEPK.js";import{a as D}from"./chunk-Y5JU726N.js";import{b as Hs}from"./chunk-25EUCCH5.js";import{y as Wi}from"./chunk-7CCULUZN.js";import{f as ni,l as vt,o as Ui,p as dn,r as Gi}from"./chunk-XAPXZ6KO.js";import{b as ti}from"./chunk-UMS5SEYB.js";import{l as nt,m as ei}from"./chunk-75OCC24T.js";import{c as cn,d as Bi,e as Zo}from"./chunk-NTZSL2UT.js";import{a as _n,b as Jo,c as Bs,d as Gn,e as Ws,k as Qo,l as Ni,m as Us,r as Fi,w as wo,x as bo,y as Gs,z as ln}from"./chunk-YFIWMGCS.js";import{GoogleGenAI as ga,ThinkingLevel as Ye,HarmBlockThreshold as bi,HarmCategory as Si}from"@google/genai";var ii={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 Vt from"fs";import Kt from"path";import ja from"os";import fn from"fs";import In from"path";import dr from"fs";import Vi from"path";import{execSync as fr}from"child_process";import{fileURLToPath as Ua}from"url";var Qs=`# FluxFlow CLI Startup & Flags Reference
1
+ import{a as Js}from"./chunk-XPIXBWTZ.js";import{a as ko}from"./chunk-BLAXTPPN.js";import{a as Nt}from"./chunk-56EJGQU3.js";import{a as Qs}from"./chunk-L22YGL6T.js";import{c as Hi,g as ji,h as Ks,i as Vs,j as zs}from"./chunk-KIPZOUEA.js";import{b as qs,c as Ys,d as Ki,f as Xs}from"./chunk-BNKY5QOA.js";import{a as ii}from"./chunk-KOCMIEPK.js";import{a as D}from"./chunk-Y5JU726N.js";import{b as js}from"./chunk-25EUCCH5.js";import{y as Wi}from"./chunk-7CCULUZN.js";import{f as oi,l as vt,o as Ui,p as dn,r as Gi}from"./chunk-XAPXZ6KO.js";import{b as ni}from"./chunk-UMS5SEYB.js";import{l as nt,m as ti}from"./chunk-75OCC24T.js";import{c as cn,d as Bi,e as ei}from"./chunk-NTZSL2UT.js";import{a as _n,b as Qo,c as Ws,d as Gn,e as Us,k as Zo,l as Ni,m as Gs,r as Fi,w as bo,x as So,y as Hs,z as ln}from"./chunk-YFIWMGCS.js";import{GoogleGenAI as ma,ThinkingLevel as Ye,HarmBlockThreshold as Si,HarmCategory as ki}from"@google/genai";var si={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 Vt from"fs";import Kt from"path";import Ka from"os";import fn from"fs";import In from"path";import fr from"fs";import Vi from"path";import{execSync as ur}from"child_process";import{fileURLToPath as Ga}from"url";var Zs=`# FluxFlow CLI Startup & Flags Reference
2
2
 
3
3
  Launch command syntax:
4
4
  fluxflow [options]
@@ -27,7 +27,7 @@ fluxflow [options]
27
27
  * --help commands \u2192 In-chat slash commands list
28
28
  * --playground \u2192 Launch Playground mode
29
29
  * --prompt, -p \u2192 Non interactive CLI chat, no tools. --new for new headless chat. Holds conversation context upto 10m inactivity or 69 turns. Supports piping from shell, --run if want the command to visible in context. eg \`fluxflow --run "git diff" -p "summarize this" --new\`
30
- `;var Zs=`# Env Variables
30
+ `;var er=`# Env Variables
31
31
 
32
32
  * Locations:
33
33
  * Shell
@@ -58,7 +58,7 @@ fluxflow [options]
58
58
 
59
59
  * I_HAVE_TOO_MUCH_MONEY \u2192 (true|false, default: false) Fun Flag; inserts random padding in system prompt to break provider caching. Not intended for paid APIs unless user hate money
60
60
  * GOOGLE_GEMMA_NONSENSE \u2192 (true|false, default: false) for the 16k TPM nonsense of gemma models on gemini API. False defaults to 256k
61
- `;var er=`# Fluxflow in-app /commands
61
+ `;var tr=`# Fluxflow in-app /commands
62
62
 
63
63
  Trigger in chat via /command
64
64
 
@@ -111,7 +111,7 @@ Trigger in chat via /command
111
111
  * /update latest \u2192 Install latest release
112
112
  * /fluxflow global/saves \u2192 Openes fluxflow storage paths in explorer
113
113
  * /move \u2192 Transfer Playground session data to ./playground-export
114
- `;var tr=`# FluxFlow In-App Settings Reference
114
+ `;var nr=`# FluxFlow In-App Settings Reference
115
115
 
116
116
  Open in chat via /settings
117
117
 
@@ -186,7 +186,7 @@ Open in chat via /settings
186
186
  | Emergency Recovery | Off | Off |
187
187
  | Auto Truncate Results | On | On |
188
188
  | Memory | Off | Off |
189
- `;var nr=`# FluxFlow Tool Reference
189
+ `;var or=`# FluxFlow Tool Reference
190
190
 
191
191
  ## Protocol: [action:ActionName(arg1="val")]
192
192
 
@@ -227,7 +227,7 @@ Open in chat via /settings
227
227
  * KeyboardTyping(text, autoPressEnter?) \u2192 Type string
228
228
  * KeyPress(key) \u2192 Key/combo dispatch ("ctrl;c", "enter", etc.)
229
229
  * RecaptureScreen() \u2192 Fresh screenshot + coordinate grid
230
- `;var or=`# Fluxflow Architecture
230
+ `;var ir=`# Fluxflow Architecture
231
231
 
232
232
  ## 1. Terminal Engine
233
233
  * Framework: React + Ink terminal UI
@@ -257,7 +257,7 @@ Open in chat via /settings
257
257
  ## 6. IDE Bridge
258
258
  * Protocol: WebSocket on ws://localhost:56832
259
259
  * State Sync: Focused file, open tabs, cursor line, selection, diagnostics
260
- `;var ir=`# FluxFlow Sub-Agents & Multi-Agent Architecture
260
+ `;var sr=`# FluxFlow Sub-Agents & Multi-Agent Architecture
261
261
 
262
262
  ## Execution Modes
263
263
  * InvokeSync \u2192 Synchronous blocking delegation; main agent halts until sub-agent finishes task
@@ -288,7 +288,7 @@ Route sub-agent workloads to faster/cheaper models independently of the main age
288
288
  * SUBAGENT_MODEL \u2192 Target model override
289
289
  * SUBAGENT_PROVIDER \u2192 Target provider override
290
290
  * Setting SubAgentModel=ENV in settings pulls directly from environment overrides
291
- `;var sr=`# FluxFlow Security, Sandboxing & Safety
291
+ `;var rr=`# FluxFlow Security, Sandboxing & Safety
292
292
 
293
293
  ## Human-in-the-Loop Governance
294
294
  * Execution Approval Gate \u2192 Destructive commands and high-risk file modifications require explicit user authorization (Allow / Deny)
@@ -311,7 +311,7 @@ Route sub-agent workloads to faster/cheaper models independently of the main age
311
311
  * Emergency Rollback \u2192 Automatic pre-turn file snapshots; Agent can still fix it (default: OFF) \u2192 references/SETTINGS.md
312
312
  * Git-less Checkpoint Reversion \u2192 Trigger conversational changes rollback via double-ESC
313
313
  * External Sanctuary Redirection \u2192 Move ~/.fluxflow data sanctuary (chats, keys etc)
314
- `;var rr=`# Fluxflow IDE Companion
314
+ `;var ar=`# Fluxflow IDE Companion
315
315
 
316
316
  ## WebSocket Bridge Protocol
317
317
  * Local Bridge \u2192 Runs on ws://localhost:56832 connecting FluxFlow CLI with the companion editor extension
@@ -329,7 +329,7 @@ Route sub-agent workloads to faster/cheaper models independently of the main age
329
329
  * File Focus \u2192 Automatically opens edited files in active IDE window
330
330
  * Diff Preview \u2192 Streams side-by-side or inline diff highlights (showDiff, highlightDiff) directly in editor
331
331
  * Status Bar Sync \u2192 Real-time agent status (thinking, running tool, awaiting input) reflected in IDE status bar
332
- `;var ar=`# Fluxflow Modes
332
+ `;var lr=`# Fluxflow Modes
333
333
 
334
334
  ## Modes Overview (TAB to cycle)
335
335
  * [Flux] (Workspace / Dev) \u2192 Primary coding & workspace agent
@@ -347,7 +347,7 @@ Route sub-agent workloads to faster/cheaper models independently of the main age
347
347
  * User Inquiry: AskUser \u2192 [Universal]
348
348
  * Document Creation: WritePDF, WriteDoc \u2192 [Flow]
349
349
  * GUI & Desktop Automation: Click, Scroll, KeyboardTyping, KeyPress, RecaptureScreen \u2192 [ICU] | [FluxCU]
350
- `;var lr=`# FluxFlow AI Providers & Setup
350
+ `;var cr=`# FluxFlow AI Providers & Setup
351
351
 
352
352
  ## Supported Providers
353
353
  * Gemini | NVIDIA NIM | DeepSeek | Mistral | Ollama Local/Cloud | InferX | SenseNova | Poolside | OpenRouter | AIHubMix | Experiential Labs | TokenHarbor | APInex | Infron
@@ -385,7 +385,7 @@ Route sub-agent workloads to faster/cheaper models independently of the main age
385
385
  2. Set ENV ENABLE_9ROUTER=true
386
386
  * NINEROUTER_URL = https://.../v1 Supports external openai compatible endpoints. For direct URL changes no need for 9router package. But 9router package gives better reliability and Anthropic stye endpoint support
387
387
  * NINEROUTER_KEY = If any needed
388
- `;var cr=`# Fluxflow Instructions & Skills System
388
+ `;var dr=`# Fluxflow Instructions & Skills System
389
389
 
390
390
  ## 1. Instructions (AGENTS.md / FLUXFLOW.md root only)
391
391
  * Locations:
@@ -429,14 +429,14 @@ Instruction for this model ID across all providers.
429
429
 
430
430
  * On-Demand Reference System:
431
431
  * Reference: Offload deep/contexual specs to **/{SKILL.md,skill-reference-folder/*.md} & reference in SKILL.md. Saves tokens
432
- `;var si="v4";try{let e=Vi.dirname(Ua(import.meta.url)),t=[Vi.join(e,"../../package.json"),Vi.join(e,"../package.json")],n=!1;for(let i of t)if(dr.existsSync(i)){let o=JSON.parse(dr.readFileSync(i,"utf8"));if(o.version){si=o.version,n=!0;break}}if(!n)try{let i=fr("fluxflow -v",{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();i&&(i.startsWith("v")||/^\d+\.\d+/.test(i))&&(si=i,n=!0)}catch{}if(!n)try{let i=fr("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&&(si=o.version)}catch{}}catch{}var zi={"SKILL.md":`---
432
+ `;var ri="v4";try{let e=Vi.dirname(Ga(import.meta.url)),t=[Vi.join(e,"../../package.json"),Vi.join(e,"../package.json")],n=!1;for(let i of t)if(fr.existsSync(i)){let o=JSON.parse(fr.readFileSync(i,"utf8"));if(o.version){ri=o.version,n=!0;break}}if(!n)try{let i=ur("fluxflow -v",{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();i&&(i.startsWith("v")||/^\d+\.\d+/.test(i))&&(ri=i,n=!0)}catch{}if(!n)try{let i=ur("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&&(ri=o.version)}catch{}}catch{}var zi={"SKILL.md":`---
433
433
  name: fluxflow
434
434
  description: System Generated Documentation. Read this if asked anything regarding FluxFlow Harness
435
435
  ---
436
436
 
437
437
  # FluxFlow, by Kushal Roy Chowdhury
438
438
  Open Source Terminal AI Assistant
439
- App Version: ${si}. Check Updates: fluxflow --update check. Update: fluxflow --update
439
+ App Version: ${ri}. Check Updates: fluxflow --update check. Update: fluxflow --update
440
440
  GitHub: https://github.com/KushalRoyChowdhury/fluxflow-cli
441
441
  Public Docs: https://fluxflow-cli.onrender.com
442
442
 
@@ -456,36 +456,36 @@ Public Docs: https://fluxflow-cli.onrender.com
456
456
 
457
457
  Default Context Length: 256k Tokens. Can be changed via ENV/In-app Settings \u2192 references/{SETTINGS,ENV}.md
458
458
 
459
- Docs missing required info? Say you are not sure enough to answer. Dont give wrong info`,"references/MODES.md":ar,"references/PROVIDERS.md":lr,"references/PLUGINS.md":cr,"references/STARTUP.md":Qs,"references/ENV.md":Zs,"references/COMMANDS.md":er,"references/SETTINGS.md":tr,"references/TOOLS.md":nr,"references/ARCHITECTURE.md":or,"references/SUB_AGENTS.md":ir,"references/SECURITY.md":sr,"references/IDE.md":rr};var ur=()=>{try{let e=In.join(_n,"skills","fluxflow"),t=In.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){fn.existsSync(e)&&fn.rmSync(e,{recursive:!0,force:!0});return}let i=new Set(Object.keys(zi).map(o=>In.normalize(o)));for(let[o,r]of Object.entries(zi)){let d=In.join(e,o),l=In.dirname(d);fn.existsSync(l)||fn.mkdirSync(l,{recursive:!0});let u=r.trim()+`
460
- `,g=null;fn.existsSync(d)&&(g=fn.readFileSync(d,"utf8")),g!==u&&fn.writeFileSync(d,u,"utf8")}if(fn.existsSync(t)){let o=fn.readdirSync(t);for(let r of o){let d=In.normalize(In.join("references",r));if(!i.has(d)){let l=In.join(t,r);try{fn.rmSync(l,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as ri}from"ws";var Pt=null,io=!1,Ga="ws://localhost:56832",qi=[],so=null,Yi=null,Xi=null,gr="2.0.0",wc=e=>{gr=e,mr()},Ji=e=>{Yi=e},bc=e=>{Xi=e},mr=()=>{if(Pt||io)return;io=!0;let e=new ri(Ga);e.on("open",()=>{for(Pt=e,io=!1,Pt.send(JSON.stringify({command:"version",version:gr,pid:process.pid,ppid:process.ppid,cwd:process.cwd()}));qi.length>0;)Pt.send(JSON.stringify(qi.shift()))}),e.on("message",t=>{try{let n=JSON.parse(t.toString());n.command==="contextResponse"&&so?(so(n.data),so=null):n.command==="securityResponse"&&Yi?Yi(n.result):n.command==="inlineComplete"?Ha(n):n.command==="connectionRejected"&&Xi&&Xi(n)}catch{}}),e.on("error",()=>{io=!1,Pt=null}),e.on("close",()=>{io=!1,Pt=null})},ko=e=>{Pt&&Pt.readyState===ri.OPEN?Pt.send(JSON.stringify(e)):(qi.push(e),io||mr())},ro=()=>Pt!==null&&Pt.readyState===ri.OPEN,Ha=async e=>{let t="";try{let{generateAutoCompletion:n}=await import("./auto_completion-ZMONI42Q.js");t=await n({prefix:e.prefix||"",suffix:e.suffix||"",fileName:e.fileName||"",language:e.language||"",recentChanges:e.recentChanges||"",clipboard:e.clipboard||""})}catch{t=""}ko({command:"inlineCompleteResponse",requestId:e.requestId,completion:t||""})},Sc=e=>{ko({command:"status",status:e})},Hn=()=>new Promise(e=>{if(!Pt||Pt.readyState!==ri.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}so=e,Pt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{so===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),so=null)},1e3)}),pr=e=>{let{resolvedPath:t}=ln(e);ko({command:"open",filePath:t})},Qi=(e,t,n)=>{let{resolvedPath:i}=ln(e);ko({command:"showDiff",filePath:i,originalContent:t,modifiedContent:n})},hr=(e,t)=>{let{resolvedPath:n}=ln(e);ko({command:"closeDiff",filePath:n,result:t})};var _o=(e,t)=>{try{if(!Vt.existsSync(e))return null;let n=Array.isArray(t)?t.map(o=>o.toLowerCase()):[t.toLowerCase()],i=Vt.readdirSync(e);for(let o of n){let r=i.find(d=>d.toLowerCase()===o);if(r){let d=Kt.join(e,r);if(Vt.statSync(d).isFile())return d}}}catch{}return null},os=(e,t)=>{let n=_o(e,t);if(n)try{return Vt.readFileSync(n,"utf8")}catch{}return""},yr=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"]),is=(e=process.cwd(),t=0,n=8)=>{let i=[];if(t>n)return i;try{if(!Vt.existsSync(e))return i;let o=Vt.readdirSync(e,{withFileTypes:!0});for(let r of o){let d=r.name,l=Kt.join(e,d);if(r.isDirectory())!yr.has(d)&&!yr.has(d.toLowerCase())&&i.push(...is(l,t+1,n));else if(r.isFile()){let u=d.toLowerCase();(u==="agents.md"||u==="agent.md")&&i.push(l)}}}catch{}return i},xr=(e,t=2)=>{if(!e)return"";let n=" ".repeat(t);return e.split(/\r?\n/).map(i=>n+i).join(`
461
- `)},Tr=()=>_o(_n,["agents.md","agent.md"]),Ar=()=>_o(process.cwd(),["agents.md","agent.md"]),Cr=()=>_o(_n,["fluxflow.md"]),vr=()=>_o(process.cwd(),["fluxflow.md"]),Ao=Tr(),ai=Ar(),un=is(),Co=Cr(),vo=vr(),wr=null,ns="",Rr=!1,Ka=e=>{if(!e||!/^<<<[\s\S]*?Identity:/m.test(e))return e;let t=e.match(/^<<<\s*\r?\n([\s\S]*?)\r?\n>>>\s*(?:\r?\n)?([\s\S]*)$/);if(!t)return e;let n=t[1],i=t[2],o=n.match(/^Identity:\s*([\s\S]*?)(?=\r?\n\s*(?:<><|>>>)|$)/m);return o&&(ns=o[1].trim(),process.env.NO_INS=!0),/<><\s*NO_INS/.test(n)&&(Rr=!0),i.trim()},Va=()=>{Ao=Tr();let e=Ao?os(_n,["agents.md","agent.md"]).trim():"";return e.length===0?(Ao=null,""):e},za=()=>{if(un=is(),ai=Ar(),!un||un.length===0)return"";let e=process.cwd(),t=[...un].sort((o,r)=>{let d=Kt.relative(e,o).replace(/\\/g,"/"),l=Kt.relative(e,r).replace(/\\/g,"/"),u=!d.includes("/"),g=!l.includes("/");return u&&!g?-1:!u&&g?1:d.localeCompare(l)}),n=[],i=[];for(let o of t)try{let r=Vt.readFileSync(o,"utf8").trim();if(!r||r.length===0)continue;n.push(o);let d=Kt.relative(e,o).replace(/\\/g,"/");if(!d.includes("/"))i.push(xr(r,2));else{let u=Kt.dirname(d)+"/:";i.push(`${u}
462
- ${xr(r,2)}`)}}catch{}return un=n,un.length===0&&(ai=null),i.join(`
459
+ Docs missing required info? Say you are not sure enough to answer. Dont give wrong info`,"references/MODES.md":lr,"references/PROVIDERS.md":cr,"references/PLUGINS.md":dr,"references/STARTUP.md":Zs,"references/ENV.md":er,"references/COMMANDS.md":tr,"references/SETTINGS.md":nr,"references/TOOLS.md":or,"references/ARCHITECTURE.md":ir,"references/SUB_AGENTS.md":sr,"references/SECURITY.md":rr,"references/IDE.md":ar};var gr=()=>{try{let e=In.join(_n,"skills","fluxflow"),t=In.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){fn.existsSync(e)&&fn.rmSync(e,{recursive:!0,force:!0});return}let i=new Set(Object.keys(zi).map(o=>In.normalize(o)));for(let[o,r]of Object.entries(zi)){let d=In.join(e,o),l=In.dirname(d);fn.existsSync(l)||fn.mkdirSync(l,{recursive:!0});let u=r.trim()+`
460
+ `,g=null;fn.existsSync(d)&&(g=fn.readFileSync(d,"utf8")),g!==u&&fn.writeFileSync(d,u,"utf8")}if(fn.existsSync(t)){let o=fn.readdirSync(t);for(let r of o){let d=In.normalize(In.join("references",r));if(!i.has(d)){let l=In.join(t,r);try{fn.rmSync(l,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as ai}from"ws";var Pt=null,ro=!1,Ha="ws://localhost:56832",qi=[],ao=null,Yi=null,Xi=null,mr="2.0.0",Sc=e=>{mr=e,pr()},Ji=e=>{Yi=e},kc=e=>{Xi=e},pr=()=>{if(Pt||ro)return;ro=!0;let e=new ai(Ha);e.on("open",()=>{for(Pt=e,ro=!1,Pt.send(JSON.stringify({command:"version",version:mr,pid:process.pid,ppid:process.ppid,cwd:process.cwd()}));qi.length>0;)Pt.send(JSON.stringify(qi.shift()))}),e.on("message",t=>{try{let n=JSON.parse(t.toString());n.command==="contextResponse"&&ao?(ao(n.data),ao=null):n.command==="securityResponse"&&Yi?Yi(n.result):n.command==="inlineComplete"?ja(n):n.command==="connectionRejected"&&Xi&&Xi(n)}catch{}}),e.on("error",()=>{ro=!1,Pt=null}),e.on("close",()=>{ro=!1,Pt=null})},To=e=>{Pt&&Pt.readyState===ai.OPEN?Pt.send(JSON.stringify(e)):(qi.push(e),ro||pr())},lo=()=>Pt!==null&&Pt.readyState===ai.OPEN,ja=async e=>{let t="";try{let{generateAutoCompletion:n}=await import("./auto_completion-UFHKJGZC.js");t=await n({prefix:e.prefix||"",suffix:e.suffix||"",fileName:e.fileName||"",language:e.language||"",recentChanges:e.recentChanges||"",clipboard:e.clipboard||""})}catch{t=""}To({command:"inlineCompleteResponse",requestId:e.requestId,completion:t||""})},Tc=e=>{To({command:"status",status:e})},Hn=()=>new Promise(e=>{if(!Pt||Pt.readyState!==ai.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}ao=e,Pt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{ao===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),ao=null)},1e3)}),hr=e=>{let{resolvedPath:t}=ln(e);To({command:"open",filePath:t})},Qi=(e,t,n)=>{let{resolvedPath:i}=ln(e);To({command:"showDiff",filePath:i,originalContent:t,modifiedContent:n})},yr=(e,t)=>{let{resolvedPath:n}=ln(e);To({command:"closeDiff",filePath:n,result:t})};var Io=(e,t)=>{try{if(!Vt.existsSync(e))return null;let n=Array.isArray(t)?t.map(o=>o.toLowerCase()):[t.toLowerCase()],i=Vt.readdirSync(e);for(let o of n){let r=i.find(d=>d.toLowerCase()===o);if(r){let d=Kt.join(e,r);if(Vt.statSync(d).isFile())return d}}}catch{}return null},is=(e,t)=>{let n=Io(e,t);if(n)try{return Vt.readFileSync(n,"utf8")}catch{}return""},xr=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"]),ss=(e=process.cwd(),t=0,n=8)=>{let i=[];if(t>n)return i;try{if(!Vt.existsSync(e))return i;let o=Vt.readdirSync(e,{withFileTypes:!0});for(let r of o){let d=r.name,l=Kt.join(e,d);if(r.isDirectory())!xr.has(d)&&!xr.has(d.toLowerCase())&&i.push(...ss(l,t+1,n));else if(r.isFile()){let u=d.toLowerCase();(u==="agents.md"||u==="agent.md")&&i.push(l)}}}catch{}return i},wr=(e,t=2)=>{if(!e)return"";let n=" ".repeat(t);return e.split(/\r?\n/).map(i=>n+i).join(`
461
+ `)},Ar=()=>Io(_n,["agents.md","agent.md"]),Cr=()=>Io(process.cwd(),["agents.md","agent.md"]),vr=()=>Io(_n,["fluxflow.md"]),Rr=()=>Io(process.cwd(),["fluxflow.md"]),Co=Ar(),li=Cr(),un=ss(),vo=vr(),Ro=Rr(),br=null,ns="",Er=!1,Va=e=>{if(!e||!/^<<<[\s\S]*?Identity:/m.test(e))return e;let t=e.match(/^<<<\s*\r?\n([\s\S]*?)\r?\n>>>\s*(?:\r?\n)?([\s\S]*)$/);if(!t)return e;let n=t[1],i=t[2],o=n.match(/^Identity:\s*([\s\S]*?)(?=\r?\n\s*(?:<><|>>>)|$)/m);return o&&(ns=o[1].trim(),process.env.NO_INS=!0),/<><\s*NO_INS/.test(n)&&(Er=!0),i.trim()},za=()=>{Co=Ar();let e=Co?is(_n,["agents.md","agent.md"]).trim():"";return e.length===0?(Co=null,""):e},qa=()=>{if(un=ss(),li=Cr(),!un||un.length===0)return"";let e=process.cwd(),t=[...un].sort((o,r)=>{let d=Kt.relative(e,o).replace(/\\/g,"/"),l=Kt.relative(e,r).replace(/\\/g,"/"),u=!d.includes("/"),g=!l.includes("/");return u&&!g?-1:!u&&g?1:d.localeCompare(l)}),n=[],i=[];for(let o of t)try{let r=Vt.readFileSync(o,"utf8").trim();if(!r||r.length===0)continue;n.push(o);let d=Kt.relative(e,o).replace(/\\/g,"/");if(!d.includes("/"))i.push(wr(r,2));else{let u=Kt.dirname(d)+"/:";i.push(`${u}
462
+ ${wr(r,2)}`)}}catch{}return un=n,un.length===0&&(li=null),i.join(`
463
463
 
464
- `).trim()},ss=()=>{Co=Cr();let e=Co?os(_n,["fluxflow.md"]).trim():"",t=Ka(e)?.trim()||"";return t.length===0?(Co=null,""):t},rs=()=>{vo=vr();let e=vo?os(process.cwd(),["fluxflow.md"]).trim():"";return e.length===0?(vo=null,""):e},as=Va(),li=za(),Ro=ss(),Eo=rs(),br=(e,t="",n="")=>{if(!e)return"";let i=n.toLowerCase().trim(),o=t.toLowerCase().trim(),r=Kt.posix.basename(o),d=i&&o?`${i}@${o}`:"",l=i&&r?`${i}@${r}`:"",u=h=>!h||!o?!1:h===o||h===r||h===d||h===l,g=[];return e.replace(/<start_provider_([^>\r\n]+)>([\s\S]*?)<end_provider_([^>\r\n]+)>/gi,(h,m,p,s)=>{if(i&&m.trim().toLowerCase()===s.trim().toLowerCase()&&m.trim().toLowerCase()===i){let _=p.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(Le,v,N,P)=>{if(v.trim().toLowerCase()===P.trim().toLowerCase()){let z=v.trim().toLowerCase();if(u(z)){let M=N.trim();M&&g.push(M)}}return""}).trim();_&&g.push(_)}return""}),e.replace(/<start_model_([^>\r\n@]+@[^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n@]+@[^>\r\n]+)>/gi,(h,m,p,s)=>{if(m.trim().toLowerCase()===s.trim().toLowerCase()){let w=m.trim().toLowerCase();if(u(w)){let _=p.trim();_&&g.push(_)}}return""}),e.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(h,m,p,s)=>{if(m.includes("@"))return"";if(m.trim().toLowerCase()===s.trim().toLowerCase()){let w=m.trim().toLowerCase();if(o&&(w===o||w===r)){let _=p.trim();_&&g.push(_)}}return""}),g.join(`
464
+ `).trim()},rs=()=>{vo=vr();let e=vo?is(_n,["fluxflow.md"]).trim():"",t=Va(e)?.trim()||"";return t.length===0?(vo=null,""):t},as=()=>{Ro=Rr();let e=Ro?is(process.cwd(),["fluxflow.md"]).trim():"";return e.length===0?(Ro=null,""):e},ls=za(),ci=qa(),Eo=rs(),_o=as(),Sr=(e,t="",n="")=>{if(!e)return"";let i=n.toLowerCase().trim(),o=t.toLowerCase().trim(),r=Kt.posix.basename(o),d=i&&o?`${i}@${o}`:"",l=i&&r?`${i}@${r}`:"",u=h=>!h||!o?!1:h===o||h===r||h===d||h===l,g=[];return e.replace(/<start_provider_([^>\r\n]+)>([\s\S]*?)<end_provider_([^>\r\n]+)>/gi,(h,m,p,s)=>{if(i&&m.trim().toLowerCase()===s.trim().toLowerCase()&&m.trim().toLowerCase()===i){let _=p.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(Le,v,N,P)=>{if(v.trim().toLowerCase()===P.trim().toLowerCase()){let z=v.trim().toLowerCase();if(u(z)){let M=N.trim();M&&g.push(M)}}return""}).trim();_&&g.push(_)}return""}),e.replace(/<start_model_([^>\r\n@]+@[^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n@]+@[^>\r\n]+)>/gi,(h,m,p,s)=>{if(m.trim().toLowerCase()===s.trim().toLowerCase()){let w=m.trim().toLowerCase();if(u(w)){let _=p.trim();_&&g.push(_)}}return""}),e.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(h,m,p,s)=>{if(m.includes("@"))return"";if(m.trim().toLowerCase()===s.trim().toLowerCase()){let w=m.trim().toLowerCase();if(o&&(w===o||w===r)){let _=p.trim();_&&g.push(_)}}return""}),g.join(`
465
465
 
466
- `).trim()},qa=(e="",t="")=>{let n=`${e||""}@${t||""}`.toLowerCase().trim();wr!==n&&(wr=n,Ro=ss(),Eo=rs())};ur();var Ya=e=>{if(!e)return null;let t=e.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!t)return null;let n=t[1];if((t[2]||"").trim().length===0)return null;let o="",r="",d=n.match(/^name:\s*(.+)$/m),l=n.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},Xa=e=>{let t=[];if(!e||!Vt.existsSync(e))return t;let n=(i,o=0)=>{if(!(o>5))try{let r=Vt.readdirSync(i,{withFileTypes:!0});for(let d of r){let l=Kt.join(i,d.name),u=d.name.toLowerCase();d.isFile()?u==="skill.md"&&t.push(l):d.isDirectory()&&(o===0?(u==="skills"||u===".skills"||u==="skill"||u===".skill")&&n(l,o+1):n(l,o+1))}}catch{}};return n(e,0),t},Er=e=>{let t=Xa(e),n=[];for(let i of t)try{let o=Vt.readFileSync(i,"utf8"),r=Ya(o);r&&n.push({...r,filePath:i})}catch{}return n},_r=e=>!e||e.length===0?"":e.map(t=>`- ${t.name}: ${t.description}`).join(`
467
- `),ci=Er(_n),di=Er(process.cwd()),Zi=_r(ci),es=_r(di),Ir=e=>{if(!e)return!1;let t=(e.filePath||"").replace(/\\/g,"/").toLowerCase();return t.includes("/skills/fluxflow/skill.md")||t.includes("/skills/about-fluxflow/skill.md")||e.name?.toLowerCase()==="fluxflow"},Mr=()=>(ci||[]).filter(e=>!Ir(e)),Pr=()=>(di||[]).filter(e=>!Ir(e)),Nc=(as?.length>0?1:0)+(li?.length>0?un.length:0)+(Ro?.length>0?1:0)+(Eo?.length>0?1:0)+Mr().length+Pr().length,ts=(e,t="Project")=>{if(!e)return"";let n=e.replace(/\\/g,"/");if(t==="Global"){let o=ja.homedir().replace(/\\/g,"/");return n.toLowerCase().startsWith(o.toLowerCase())?"~"+n.slice(o.length):n}let i=Kt.relative(process.cwd(),e).replace(/\\/g,"/");return i.startsWith(".")?i:`./${i}`},Fc=()=>{Ro=ss(),Eo=rs();let e=[];Ao&&as.length>0&&e.push({scope:"Global",path:Ao}),un&&un.length>0&&li.length>0?un.forEach(r=>{e.push({scope:"Project",path:r})}):ai&&li.length>0&&e.push({scope:"Project",path:ai}),Co&&Ro.length>0&&e.push({scope:"Global",path:Co}),vo&&Eo.length>0&&e.push({scope:"Project",path:vo});let t=Mr(),n=Pr(),i=e.length+t.length+n.length;if(i===0)return`\u2726 Loaded Files & Instructions
466
+ `).trim()},Ya=(e="",t="")=>{let n=`${e||""}@${t||""}`.toLowerCase().trim();br!==n&&(br=n,Eo=rs(),_o=as())};gr();var Xa=e=>{if(!e)return null;let t=e.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!t)return null;let n=t[1];if((t[2]||"").trim().length===0)return null;let o="",r="",d=n.match(/^name:\s*(.+)$/m),l=n.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 t=[];if(!e||!Vt.existsSync(e))return t;let n=(i,o=0)=>{if(!(o>5))try{let r=Vt.readdirSync(i,{withFileTypes:!0});for(let d of r){let l=Kt.join(i,d.name),u=d.name.toLowerCase();d.isFile()?u==="skill.md"&&t.push(l):d.isDirectory()&&(o===0?(u==="skills"||u===".skills"||u==="skill"||u===".skill")&&n(l,o+1):n(l,o+1))}}catch{}};return n(e,0),t},_r=e=>{let t=Ja(e),n=[];for(let i of t)try{let o=Vt.readFileSync(i,"utf8"),r=Xa(o);r&&n.push({...r,filePath:i})}catch{}return n},Ir=e=>!e||e.length===0?"":e.map(t=>`- ${t.name}: ${t.description}`).join(`
467
+ `),di=_r(_n),fi=_r(process.cwd()),Zi=Ir(di),es=Ir(fi),Mr=e=>{if(!e)return!1;let t=(e.filePath||"").replace(/\\/g,"/").toLowerCase();return t.includes("/skills/fluxflow/skill.md")||t.includes("/skills/about-fluxflow/skill.md")||e.name?.toLowerCase()==="fluxflow"},Pr=()=>(di||[]).filter(e=>!Mr(e)),$r=()=>(fi||[]).filter(e=>!Mr(e)),Bc=(ls?.length>0?1:0)+(ci?.length>0?un.length:0)+(Eo?.length>0?1:0)+(_o?.length>0?1:0)+Pr().length+$r().length,ts=(e,t="Project")=>{if(!e)return"";let n=e.replace(/\\/g,"/");if(t==="Global"){let o=Ka.homedir().replace(/\\/g,"/");return n.toLowerCase().startsWith(o.toLowerCase())?"~"+n.slice(o.length):n}let i=Kt.relative(process.cwd(),e).replace(/\\/g,"/");return i.startsWith(".")?i:`./${i}`},Wc=()=>{Eo=rs(),_o=as();let e=[];Co&&ls.length>0&&e.push({scope:"Global",path:Co}),un&&un.length>0&&ci.length>0?un.forEach(r=>{e.push({scope:"Project",path:r})}):li&&ci.length>0&&e.push({scope:"Project",path:li}),vo&&Eo.length>0&&e.push({scope:"Global",path:vo}),Ro&&_o.length>0&&e.push({scope:"Project",path:Ro});let t=Pr(),n=$r(),i=e.length+t.length+n.length;if(i===0)return`\u2726 Loaded Files & Instructions
468
468
  \u2800\u2800\x1B[2m\u2514\u2500\x1B[22m No instruction or skill files are currently loaded.
469
469
  \u2800`;let o=[];return o.push(`\u2726 Loaded Files & Instructions (${i} ${i===1?"file":"files"} active)`),e.length>0&&(o.push(`
470
470
  \x1B[1mInstructions:\x1B[22m`),e.forEach(r=>{o.push(` \u2022 [${r.scope}] ${ts(r.path,r.scope)}`)})),(t?.length>0||n?.length>0)&&(o.push(`
471
471
  \x1B[1mSkills:\x1B[22m`),t?.length>0&&t.forEach(r=>{o.push(` \u2022 [Global] \x1B[36m${r.name}\x1B[39m`),o.push(` \x1B[2m\u2514\u2500 ${ts(r.filePath,"Global")}\x1B[22m`)}),n?.length>0&&n.forEach(r=>{o.push(` \u2022 [Project] \x1B[36m${r.name}\x1B[39m`),o.push(` \x1B[2m\u2514\u2500 ${ts(r.filePath,"Project")}\x1B[22m`)})),o.push("\u2800"),o.join(`
472
- `)},$r=!1;(async()=>{try{let e=await ti();if(Number(e?.display)===1){let{default:t}=await import("screenshot-desktop"),n=await t.listDisplays();n&&n.length>1&&($r=!0)}}catch{}})();var Sr=null,To=null,kr=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",Bc=process.env.NO_DEV||!1,Ja=(e,t)=>{if(!t)return"";if(e!==Sr||To===null){Sr=e;try{let n=cn(Qo,[]);Array.isArray(n)&&n.length>0?To=n.map(i=>`- ${i.memory}`).join(`
473
- `):To=""}catch(n){To="";try{Vt.mkdirSync(Kt.join(Gn,"memory"),{recursive:!0}),Vt.appendFileSync(Kt.join(Gn,"memory","error.txt"),`${n.message}
472
+ `)},Lr=!1;(async()=>{try{let e=await ni();if(Number(e?.display)===1){let{default:t}=await import("screenshot-desktop"),n=await t.listDisplays();n&&n.length>1&&(Lr=!0)}}catch{}})();var kr=null,Ao=null,Tr=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",Uc=process.env.NO_DEV||!1,Qa=(e,t)=>{if(!t)return"";if(e!==kr||Ao===null){kr=e;try{let n=cn(Zo,[]);Array.isArray(n)&&n.length>0?Ao=n.map(i=>`- ${i.memory}`).join(`
473
+ `):Ao=""}catch(n){Ao="";try{Vt.mkdirSync(Kt.join(Gn,"memory"),{recursive:!0}),Vt.appendFileSync(Kt.join(Gn,"memory","error.txt"),`${n.message}
474
474
  -------------------------------------------------
475
475
 
476
- `)}catch{}}}return To};var Lr=(e,t,n,i,o=!0,r=!1,d="Google",l=!1,u,g,h=!1,m="")=>{let p=!1;process.env.forcedReasoning&&(p=!0);let s="";if(!u&&d==="Google"){let Re=t;t==="Fast"&&(Re="Off"),t==="Low"&&(Re="Minimal"),t==="Standard"&&(Re="Medium"),(t==="xHigh"||t==="Max")&&(Re="xHigh"),s=ii[Re]||ii.Medium}(u||d!=="Google")&&(s=ii.xHigh,t==="Fast"?s=`No thinking. Immediate response
476
+ `)}catch{}}}return Ao};var Or=(e,t,n,i,o=!0,r=!1,d="Google",l=!1,u,g,h=!1,m="")=>{let p=!1;process.env.forcedReasoning&&(p=!0);let s="";if(!u&&d==="Google"){let Re=t;t==="Fast"&&(Re="Off"),t==="Low"&&(Re="Minimal"),t==="Standard"&&(Re="Medium"),(t==="xHigh"||t==="Max")&&(Re="xHigh"),s=si[Re]||si.Medium}(u||d!=="Google")&&(s=si.xHigh,t==="Fast"?s=`No thinking. Immediate response
477
477
  Verify imports, tool results & system stability`:t.toLowerCase()==="max"&&(s=null));let w=e.instructions&&e.instructions?.length>0?`User Preferences: ${e.instructions}
478
478
 
479
479
  `:"",_=e.nickname&&e.nickname?.length>0?`User Nickname: ${e.nickname}
480
480
  ${w.length?"":`
481
481
  `}`:"",Le=e.name&&e.name?.length>0?`User Name: ${e.name}
482
482
  ${_.length||w.length?"":`
483
- `}`:"",v=process.cwd(),N=e.preset,z={Sassy:"Sassy",Friendly:"Sassy, Warm & Chatty",Playful:"Playful",Efficient:"Quick, Concise & Efficient",Professional:"Professional"}[N]||null,M=Ja(g,o),$=M?.length>0?`--- Saved Memories ---
483
+ `}`:"",v=process.cwd(),N=e.preset,z={Sassy:"Sassy",Friendly:"Sassy, Warm & Chatty",Playful:"Playful",Efficient:"Quick, Concise & Efficient",Professional:"Professional"}[N]||null,M=Qa(g,o),$=M?.length>0?`--- Saved Memories ---
484
484
  ${M}
485
485
 
486
- `:"";qa(d,m);let xe=br(Ro,m,d).trim(),Ie=[as,xe].filter(Re=>Re&&Re.length>0).join(`
486
+ `:"";Ya(d,m);let xe=Sr(Eo,m,d).trim(),Ie=[ls,xe].filter(Re=>Re&&Re.length>0).join(`
487
487
 
488
- `).trim(),Je=br(Eo,m,d).trim(),x=[li,Je].filter(Re=>Re&&Re.length>0).join(`
488
+ `).trim(),Je=Sr(_o,m,d).trim(),x=[ci,Je].filter(Re=>Re&&Re.length>0).join(`
489
489
 
490
490
  `).trim(),zt=Ie.length>0||x.length>0?`--- Additional Instructions ---
491
491
  ${Ie.length>0?`-- Global --
@@ -494,12 +494,12 @@ ${Ie}`:""}${x.length>0?`${Ie.length>0?`
494
494
  `:""}-- Project --
495
495
  ${x}`:""}
496
496
 
497
- `:"",Ne=(()=>{let Re=process.cwd().toLowerCase();if(process.platform==="win32"){let qn=process.env.SystemRoot?.toLowerCase()||"c:\\windows",Yn=process.env.ProgramFiles?.toLowerCase()||"c:\\program files",Q=process.env["ProgramFiles(x86)"]?.toLowerCase()||"c:\\program files (x86)";return Re.startsWith(qn)||Re.startsWith(Yn)||Re.startsWith(Q)}else return Re==="/"||["/bin","/sbin","/etc","/usr","/var","/root"].some(Yn=>Re.startsWith(Yn))})(),qt=new Date,Fe=qt.getFullYear(),ae=qt.toLocaleString("en-US",{month:"short"}).toUpperCase(),on=String(qt.getDate()).padStart(2,"0"),Vn=`${Fe}-${ae}-${on}`,No=process.env.I_HAVE_TOO_MUCH_MONEY==="true"||!1,Fo=process.env.HALLOWEEN_EEGG==="true"||!1,Bo=Fo&&ae.includes("OCT")&&(on.includes("30")||on.includes("31")),Pn=(m||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),zn=Kt.basename(Pn).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,Re=>Re.toUpperCase().trim()),Yt=process.env.NO_DEV==="true"||!1,$n=!1;try{$n=ro()}catch{$n=!1}return`${No?`${" ".repeat(Math.floor(Math.random()*4)+1)}`:""}=== SYSTEM PROMPT${process.cwd()==="D:\\PROJECTS\\Flux-Flow"?" (Internal testing environment, do as prompted)":""} ===
498
- ${`Identity: ${ns.length>1?ns.trim():`Flux Flow.${z?` ${z}`:""} CLI Assistant${Fo?`. ${Bo?"Peak ":""}Halloween Themed, Spooky`:""}`}
499
- ${Rr?"":`${n==="Flux"?"":n==="Flow"?"Concise, Humorous, Sarcastic":n==="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"}`}${$r&&n.toLowerCase().includes("cu")?`
497
+ `:"",Ne=(()=>{let Re=process.cwd().toLowerCase();if(process.platform==="win32"){let qn=process.env.SystemRoot?.toLowerCase()||"c:\\windows",Yn=process.env.ProgramFiles?.toLowerCase()||"c:\\program files",Q=process.env["ProgramFiles(x86)"]?.toLowerCase()||"c:\\program files (x86)";return Re.startsWith(qn)||Re.startsWith(Yn)||Re.startsWith(Q)}else return Re==="/"||["/bin","/sbin","/etc","/usr","/var","/root"].some(Yn=>Re.startsWith(Yn))})(),qt=new Date,Fe=qt.getFullYear(),ae=qt.toLocaleString("en-US",{month:"short"}).toUpperCase(),on=String(qt.getDate()).padStart(2,"0"),Vn=`${Fe}-${ae}-${on}`,Fo=process.env.I_HAVE_TOO_MUCH_MONEY==="true"||!1,Bo=process.env.HALLOWEEN_EEGG==="true"||!1,Wo=Bo&&ae.includes("OCT")&&(on.includes("30")||on.includes("31")),Pn=(m||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),zn=Kt.basename(Pn).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,Re=>Re.toUpperCase().trim()),Yt=process.env.NO_DEV==="true"||!1,$n=!1;try{$n=lo()}catch{$n=!1}return`${Fo?`${" ".repeat(Math.floor(Math.random()*4)+1)}`:""}=== SYSTEM PROMPT${process.cwd()==="D:\\PROJECTS\\Flux-Flow"?" (Internal testing environment, do as prompted)":""} ===
498
+ ${`Identity: ${ns.length>1?ns.trim():`Flux Flow.${z?` ${z}`:""} CLI Assistant${Bo?`. ${Wo?"Peak ":""}Halloween Themed, Spooky`:""}`}
499
+ ${Er?"":`${n==="Flux"?"":n==="Flow"?"Concise, Humorous, Sarcastic":n==="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"}`}${Lr&&n.toLowerCase().includes("cu")?`
500
500
  - 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()}
501
501
 
502
- - OS: ${kr}${!Yt&&m.length>1?`
502
+ - OS: ${Tr}${!Yt&&m.length>1?`
503
503
  - Model: ${zn}`.trimEnd():""}
504
504
  - Date: ${Vn}
505
505
  ${t.toLowerCase()!=="max"&&process.env.rawReasoning!=="true"?`
@@ -512,7 +512,7 @@ Use <think_fluxflow>...</think_fluxflow> for reasoning before responding any que
512
512
  -- REASONING GUIDANCE --
513
513
  `:""}Before actions, provide user facing summary of findings & decisions IN detail
514
514
  `}
515
- ${Ys(n,kr,l,d,i?.advanceRollback,i?.subAgents!==!1,!!i?.autoExec,!!i?.disableTodo,i?.preferBash!==!1)}${n==="Flux"?"":n.toLowerCase().includes("cu")?`
515
+ ${Xs(n,Tr,l,d,i?.advanceRollback,i?.subAgents!==!1,!!i?.autoExec,!!i?.disableTodo,i?.preferBash!==!1)}${n==="Flux"?"":n.toLowerCase().includes("cu")?`
516
516
 
517
517
  -- SECURITY POLICIES --
518
518
  - Dont operate on ANY confidential/logins/captcha screens \u2192 Tell user to complete it`:""}${$n?`
@@ -528,7 +528,7 @@ ${Zi}
528
528
  `:""}${es.length>0&&n.toLowerCase().includes("flux")?`-- Project Skills --
529
529
  ${es}
530
530
 
531
- `:""}`.trim()};var Or=()=>import("./web_search-C3WKDOSZ.js").then(e=>e.web_search),Dr=()=>import("./web_scrape-MVSCRDKO.js").then(e=>e.web_scrape),Nr=()=>import("./memory-AT7ARTG3.js").then(e=>e.memory),Fr=()=>import("./chat-OYRESDTX.js").then(e=>e.chat),Br=()=>import("./view_file-OYV2IEYG.js").then(e=>e.view_file),Wr=()=>import("./write_file-WX4O436W.js").then(e=>e.write_file),Ur=()=>import("./update_file-CH6YILXO.js").then(e=>e.update_file),Gr=()=>import("./exec_command-SQB5LU5X.js").then(e=>e.exec_command),Hr=()=>import("./read_folder-UWFC5DNX.js").then(e=>e.read_folder),ls=()=>import("./ask_user-K2DLZF6H.js").then(e=>e.ask_user),jr=()=>import("./write_pdf-5HOQYVQO.js").then(e=>e.write_pdf),Kr=()=>import("./write_docx-QGW25TF7.js").then(e=>e.write_docx),fi=()=>import("./search_keyword-IRLPX555.js").then(e=>e.search_keyword),Vr=()=>import("./generate_image-7UBJ3ODS.js").then(e=>e.generate_image),ui=()=>import("./saveSummary-ZJDPCZSR.js").then(e=>e.saveSummary),Io=()=>import("./addMemScore-VUSJ2Q64.js").then(e=>e.addMemScore),zr=()=>import("./file_map-K6JQYV35.js").then(e=>e.file_map),gi=()=>import("./todo-YFLPXYFL.js").then(e=>e.todo),qr=()=>import("./invokeSync-G4OME3EM.js").then(e=>e.invokeSync),Qa=()=>import("./invoke-7C326QLF.js").then(e=>e.invoke),Yr=()=>import("./getProgress-J34K43Y7.js").then(e=>e.getProgress),Za=()=>import("./cancel-F3ZOEBKW.js").then(e=>e.cancel),Xr=()=>import("./emergency_rollback-LC4ZBOLP.js").then(e=>e.emergency_rollback),Mo=()=>import("./awaitSubagent-JKQ2EHVY.js").then(e=>e.awaitSubagent),Po=()=>import("./answerSubagent-BPNNJXPC.js").then(e=>e.answerSubagent),mi=()=>import("./steerSubagent-UETXH2CB.js").then(e=>e.steerSubagent),pi=()=>import("./computer_action-6RHVNLZG.js").then(e=>e.computer_action),Jr=()=>import("./click-3BB6KDIJ.js").then(e=>e.click),Qr=()=>import("./drag-ZGNVQGXW.js").then(e=>e.drag),Zr=()=>import("./scroll-XBXSN2EF.js").then(e=>e.scroll),cs=()=>import("./keyboard_typing-DJ3HHTO7.js").then(e=>e.keyboard_typing),ds=()=>import("./key_press-LO75QEJK.js").then(e=>e.key_press),fs=()=>import("./recapture_screen-LONV6G4U.js").then(e=>e.recapture_screen),hi=()=>import("./find_file-5RUNVQJO.js").then(e=>e.find_file),ea=()=>import("./wait-TJR6LAR4.js").then(e=>e.wait),ta={web_search:Or,web_scrape:Dr,memory:Nr,chat:Fr,view_file:Br,write_file:Wr,update_file:Ur,exec_command:Gr,read_folder:Hr,write_pdf:jr,write_docx:Kr,search_keyword:fi,generate_image:Vr,saveSummary:ui,addMemScore:Io,file_map:zr,todo:gi,Todo:gi,goal:gi,Goal:gi,invokeSync:qr,invoke:Qa,getProgress:Yr,cancel:Za,awaitSubagent:Mo,answerSubagent:Po,steerSubagent:mi,computer_action:pi,computer_use:pi,ComputerAction:pi,ComputerUse:pi,click:Jr,Click:Jr,drag:Qr,Drag:Qr,scroll:Zr,Scroll:Zr,keyboard_typing:cs,KeyboardTyping:cs,keyboardtyping:cs,key_press:ds,KeyPress:ds,keypress:ds,recapture_screen:fs,RecaptureScreen:fs,recapturescreen:fs,invoke_sync:qr,get_progress:Yr,await_subagent:Mo,answer_subagent:Po,steer_subagent:mi,steer:mi,Steer:mi,ask:ls,Ask:ls,AskUser:ls,WebSearch:Or,WebScrape:Dr,ReadFile:Br,ReadFolder:Hr,WriteFile:Wr,PatchFile:Ur,WritePDF:jr,WriteDoc:Kr,Run:Gr,SearchKeyword:fi,CodeSearch:fi,code_search:fi,Memory:Nr,Chat:Fr,GenerateImage:Vr,saveSumary:ui,SaveSummary:ui,SaveSumary:ui,add_mem_score:Io,AddMemScore:Io,addMemoryScore:Io,AddMemoryScore:Io,FileMap:zr,answer:Po,Answer:Po,AnswerSubagent:Po,await:Mo,Await:Mo,AwaitSubagent:Mo,EmergencyRollback:Xr,emergency_rollback:Xr,find_file:hi,findFile:hi,FindFile:hi,findfile:hi,wait:ea,Wait:ea},us=async(e,t,n={})=>{let i=n.mode?n.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(h=>o.includes(h))||o==="ask",u=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(h=>o.includes(h));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 ${n.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let g=ta[e];if(!g){let h=["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"},p=o.replace(/[^a-z0-9]/g,""),s=m[p]||null;if(!s){let _=0,Le=N=>{let P=new Set;for(let z=0;z<N.length-1;z++)P.add(N.slice(z,z+2));return P},v=Le(p);for(let N of h){let P=N.toLowerCase().replace(/[^a-z0-9]/g,"");if(p===P){s=N;break}let z=0;(P.includes(p)||p.includes(P))&&(z+=.6);let M=Le(P),$=0;for(let ve of v)M.has(ve)&&$++;let xe=2*$/(v.size+M.size||1);z=Math.max(z,xe),z>_&&z>=.35&&(_=z,s=N)}}let w=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${w}`}try{return await(await g())(t,n)}catch(h){let m=h instanceof Error?h.message:String(h);return`ERROR: Execution failed for [${e}]: ${m}`}};var yi=e=>{if(!e||typeof e!="string")return!1;let t=e.trim().toLowerCase();return Object.keys(ta).some(n=>n.toLowerCase()===t)};import V from"path";import Ce from"fs";import{execSync as xs}from"child_process";import el from"gradient-string";var na=["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 oa=["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 ia=[{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"]}],ao={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 wi=(e="Dark")=>{let t;e==="Mystery"||e==="Chaos"?(xi||(xi=ia[Math.floor(Math.random()*ia.length)]),t={...xi,id:"Mystery"}):(xi=null,ao[e]?t=ao[e]:e==="Halloween"?t=ao.Spookfest:e==="GitHub"?t=ao["GitHub Dark"]:e==="Transparent"?t=ao["Transparent Dark"]:t=ao.Dark);let n=t.codeText||t.secondary||t.info||t.logoGradient&&t.logoGradient[0]||"cyan",i=t.toolFeedbackAnsi||"\x1B[95m";return{...t,codeText:n,toolFeedbackAnsi:i}};var tl=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",Jc=(e=2)=>{let t=tl();return t==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},sa=new Date,$o=sa.getMonth(),Lo=sa.getDate(),nl=$o===9&&Lo>=15||$o===10&&Lo<=1,gs=null;(process.env.SPOOKFEST==="true"||nl)&&(gs=await import("./halloween-MX3VNQRW.js"));var Qc=(e="...",t="Loading...",n="Dark")=>{let i=wi(n),o=t;if(t==="c_openai"||t==="Custom (OpenAI)")try{let z=Zo(Jo,{})?.systemSettings?.customOpenAIBaseUrl;z&&(o=z)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,l=i.logoMutedAnsi,u="\x1B[0m",g=[" \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 "],h=n==="Spookfest"||i.id==="Spookfest"||n==="Halloween"||i.id==="Halloween",m=$o===9&&Lo>=15||$o===10&&Lo<=1,p=h&&m||process.env.SPOOKFEST==="true"&&h,s=g;if(p&&gs){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:P,halloweenBat:z,halloweenArtUser:M}=gs;s=Math.random()>.9&&$o===9&&Lo>=30?z:Math.random()>.5?P:M}else process.env.HALLOWEEN_EEGG="false";let w=p?oa:na,_=w[Math.floor(Math.random()*w.length)],Le=i.logoGradient||["#0077ff","#ff00ff"],v=el(Le).multiline(s.join(`
531
+ `:""}`.trim()};var Dr=()=>import("./web_search-C3WKDOSZ.js").then(e=>e.web_search),Nr=()=>import("./web_scrape-MVSCRDKO.js").then(e=>e.web_scrape),Fr=()=>import("./memory-AT7ARTG3.js").then(e=>e.memory),Br=()=>import("./chat-OYRESDTX.js").then(e=>e.chat),Wr=()=>import("./view_file-OYV2IEYG.js").then(e=>e.view_file),Ur=()=>import("./write_file-A6MKH4SC.js").then(e=>e.write_file),Gr=()=>import("./update_file-CH6YILXO.js").then(e=>e.update_file),Hr=()=>import("./exec_command-SQB5LU5X.js").then(e=>e.exec_command),jr=()=>import("./read_folder-UWFC5DNX.js").then(e=>e.read_folder),cs=()=>import("./ask_user-K2DLZF6H.js").then(e=>e.ask_user),Kr=()=>import("./write_pdf-5HOQYVQO.js").then(e=>e.write_pdf),Vr=()=>import("./write_docx-QGW25TF7.js").then(e=>e.write_docx),ui=()=>import("./search_keyword-IRLPX555.js").then(e=>e.search_keyword),zr=()=>import("./generate_image-7UBJ3ODS.js").then(e=>e.generate_image),gi=()=>import("./saveSummary-ZJDPCZSR.js").then(e=>e.saveSummary),Mo=()=>import("./addMemScore-VUSJ2Q64.js").then(e=>e.addMemScore),qr=()=>import("./file_map-K6JQYV35.js").then(e=>e.file_map),mi=()=>import("./todo-YFLPXYFL.js").then(e=>e.todo),Yr=()=>import("./invokeSync-6TXH6V5Q.js").then(e=>e.invokeSync),Za=()=>import("./invoke-5S7NCXAS.js").then(e=>e.invoke),Xr=()=>import("./getProgress-J34K43Y7.js").then(e=>e.getProgress),el=()=>import("./cancel-F3ZOEBKW.js").then(e=>e.cancel),Jr=()=>import("./emergency_rollback-LC4ZBOLP.js").then(e=>e.emergency_rollback),Po=()=>import("./awaitSubagent-JKQ2EHVY.js").then(e=>e.awaitSubagent),$o=()=>import("./answerSubagent-BPNNJXPC.js").then(e=>e.answerSubagent),pi=()=>import("./steerSubagent-UETXH2CB.js").then(e=>e.steerSubagent),hi=()=>import("./computer_action-6RHVNLZG.js").then(e=>e.computer_action),Qr=()=>import("./click-3BB6KDIJ.js").then(e=>e.click),Zr=()=>import("./drag-ZGNVQGXW.js").then(e=>e.drag),ea=()=>import("./scroll-XBXSN2EF.js").then(e=>e.scroll),ds=()=>import("./keyboard_typing-DJ3HHTO7.js").then(e=>e.keyboard_typing),fs=()=>import("./key_press-LO75QEJK.js").then(e=>e.key_press),us=()=>import("./recapture_screen-LONV6G4U.js").then(e=>e.recapture_screen),yi=()=>import("./find_file-5RUNVQJO.js").then(e=>e.find_file),ta=()=>import("./wait-TJR6LAR4.js").then(e=>e.wait),na={web_search:Dr,web_scrape:Nr,memory:Fr,chat:Br,view_file:Wr,write_file:Ur,update_file:Gr,exec_command:Hr,read_folder:jr,write_pdf:Kr,write_docx:Vr,search_keyword:ui,generate_image:zr,saveSummary:gi,addMemScore:Mo,file_map:qr,todo:mi,Todo:mi,goal:mi,Goal:mi,invokeSync:Yr,invoke:Za,getProgress:Xr,cancel:el,awaitSubagent:Po,answerSubagent:$o,steerSubagent:pi,computer_action:hi,computer_use:hi,ComputerAction:hi,ComputerUse:hi,click:Qr,Click:Qr,drag:Zr,Drag:Zr,scroll:ea,Scroll:ea,keyboard_typing:ds,KeyboardTyping:ds,keyboardtyping:ds,key_press:fs,KeyPress:fs,keypress:fs,recapture_screen:us,RecaptureScreen:us,recapturescreen:us,invoke_sync:Yr,get_progress:Xr,await_subagent:Po,answer_subagent:$o,steer_subagent:pi,steer:pi,Steer:pi,ask:cs,Ask:cs,AskUser:cs,WebSearch:Dr,WebScrape:Nr,ReadFile:Wr,ReadFolder:jr,WriteFile:Ur,PatchFile:Gr,WritePDF:Kr,WriteDoc:Vr,Run:Hr,SearchKeyword:ui,CodeSearch:ui,code_search:ui,Memory:Fr,Chat:Br,GenerateImage:zr,saveSumary:gi,SaveSummary:gi,SaveSumary:gi,add_mem_score:Mo,AddMemScore:Mo,addMemoryScore:Mo,AddMemoryScore:Mo,FileMap:qr,answer:$o,Answer:$o,AnswerSubagent:$o,await:Po,Await:Po,AwaitSubagent:Po,EmergencyRollback:Jr,emergency_rollback:Jr,find_file:yi,findFile:yi,FindFile:yi,findfile:yi,wait:ta,Wait:ta},gs=async(e,t,n={})=>{let i=n.mode?n.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(h=>o.includes(h))||o==="ask",u=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(h=>o.includes(h));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 ${n.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let g=na[e];if(!g){let h=["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"},p=o.replace(/[^a-z0-9]/g,""),s=m[p]||null;if(!s){let _=0,Le=N=>{let P=new Set;for(let z=0;z<N.length-1;z++)P.add(N.slice(z,z+2));return P},v=Le(p);for(let N of h){let P=N.toLowerCase().replace(/[^a-z0-9]/g,"");if(p===P){s=N;break}let z=0;(P.includes(p)||p.includes(P))&&(z+=.6);let M=Le(P),$=0;for(let ve of v)M.has(ve)&&$++;let xe=2*$/(v.size+M.size||1);z=Math.max(z,xe),z>_&&z>=.35&&(_=z,s=N)}}let w=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${w}`}try{return await(await g())(t,n)}catch(h){let m=h instanceof Error?h.message:String(h);return`ERROR: Execution failed for [${e}]: ${m}`}};var xi=e=>{if(!e||typeof e!="string")return!1;let t=e.trim().toLowerCase();return Object.keys(na).some(n=>n.toLowerCase()===t)};import V from"path";import Ce from"fs";import ll from"crypto";import{execSync as ws}from"child_process";import tl from"gradient-string";var oa=["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 ia=["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 sa=[{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"]}],co={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 wi=null;var bi=(e="Dark")=>{let t;e==="Mystery"||e==="Chaos"?(wi||(wi=sa[Math.floor(Math.random()*sa.length)]),t={...wi,id:"Mystery"}):(wi=null,co[e]?t=co[e]:e==="Halloween"?t=co.Spookfest:e==="GitHub"?t=co["GitHub Dark"]:e==="Transparent"?t=co["Transparent Dark"]:t=co.Dark);let n=t.codeText||t.secondary||t.info||t.logoGradient&&t.logoGradient[0]||"cyan",i=t.toolFeedbackAnsi||"\x1B[95m";return{...t,codeText:n,toolFeedbackAnsi:i}};var nl=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",Zc=(e=2)=>{let t=nl();return t==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},ra=new Date,Lo=ra.getMonth(),Oo=ra.getDate(),ol=Lo===9&&Oo>=15||Lo===10&&Oo<=1,ms=null;(process.env.SPOOKFEST==="true"||ol)&&(ms=await import("./halloween-MX3VNQRW.js"));var ed=(e="...",t="Loading...",n="Dark")=>{let i=bi(n),o=t;if(t==="c_openai"||t==="Custom (OpenAI)")try{let z=ei(Qo,{})?.systemSettings?.customOpenAIBaseUrl;z&&(o=z)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,l=i.logoMutedAnsi,u="\x1B[0m",g=[" \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 "],h=n==="Spookfest"||i.id==="Spookfest"||n==="Halloween"||i.id==="Halloween",m=Lo===9&&Oo>=15||Lo===10&&Oo<=1,p=h&&m||process.env.SPOOKFEST==="true"&&h,s=g;if(p&&ms){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:P,halloweenBat:z,halloweenArtUser:M}=ms;s=Math.random()>.9&&Lo===9&&Oo>=30?z:Math.random()>.5?P:M}else process.env.HALLOWEEN_EEGG="false";let w=p?ia:oa,_=w[Math.floor(Math.random()*w.length)],Le=i.logoGradient||["#0077ff","#ff00ff"],v=tl(Le).multiline(s.join(`
532
532
  `)).split(`
533
533
  `),N=P=>`${l}${P}${u}`;return`${v[0]}
534
534
  ${v[1]} ${r}Selected ${p?"Pumpkin":"Provider"}: ${o}${u}
@@ -538,38 +538,38 @@ ${v[4]}
538
538
  ${v[5]} ${d}See /help for additional commands.${u}
539
539
  ${v[6]} ${N(_)}
540
540
  ${v[7]}
541
- `};import{structuredPatch as al}from"diff";import ms from"path";import ol from"fs";var il=e=>{try{return ol.readdirSync(e,{withFileTypes:!0})}catch{return[]}},ps=(e,t=4,n=1,i=il,o=[],r=null)=>{let d=r||i(e),l=" ".repeat(n-1),u=n===1?new Set([...wo,...o,...bo(e),...bo(process.cwd())]):o instanceof Set?o:new Set([...wo,...o]),g=M=>u.has(M),h=d.filter(M=>!g(M.name)),m=d.filter(M=>g(M.name)).length,p=h.filter(M=>!M.isDirectory()).map(M=>M.name).sort(),s=h.filter(M=>M.isDirectory()).sort((M,$)=>M.name.localeCompare($.name)),w=M=>{let $=M.length;if($===0)return"no files";let xe=Array.from(new Set(M.map(Ie=>{let Je=typeof Ie=="string"?Ie:Ie.name;return ms.extname(Je).slice(1)}).filter(Boolean))).sort(),ve="*";return xe.length===1?ve=`*.${xe[0]}`:xe.length>1&&(ve=`*.{${xe.join(", ")}}`),$===1?ve:`${ve} ${$} files`},_="";if(n===1){let M=p.join(", "),$=m>0?` [${m} ignored]`:"";(M||$)&&(_+=`${l}${M?M+($?`${$}`:""):$.trim()}
541
+ `};import{structuredPatch as cl}from"diff";import ps from"path";import il from"fs";var sl=e=>{try{return il.readdirSync(e,{withFileTypes:!0})}catch{return[]}},hs=(e,t=4,n=1,i=sl,o=[],r=null)=>{let d=r||i(e),l=" ".repeat(n-1),u=n===1?new Set([...bo,...o,...So(e),...So(process.cwd())]):o instanceof Set?o:new Set([...bo,...o]),g=M=>u.has(M),h=d.filter(M=>!g(M.name)),m=d.filter(M=>g(M.name)).length,p=h.filter(M=>!M.isDirectory()).map(M=>M.name).sort(),s=h.filter(M=>M.isDirectory()).sort((M,$)=>M.name.localeCompare($.name)),w=M=>{let $=M.length;if($===0)return"no files";let xe=Array.from(new Set(M.map(Ie=>{let Je=typeof Ie=="string"?Ie:Ie.name;return ps.extname(Je).slice(1)}).filter(Boolean))).sort(),ve="*";return xe.length===1?ve=`*.${xe[0]}`:xe.length>1&&(ve=`*.{${xe.join(", ")}}`),$===1?ve:`${ve} ${$} files`},_="";if(n===1){let M=p.join(", "),$=m>0?` [${m} ignored]`:"";(M||$)&&(_+=`${l}${M?M+($?`${$}`:""):$.trim()}
542
542
  `)}else p.length>0&&(_+=`${l}[${w(p)}]
543
- `);let Le=10,v=s.slice(0,Le),N=s.length>Le,P=[],z=[];for(let M of v){let $=ms.join(e,M.name),xe=M.name,ve=n,Ie=i($),Je=Ie.filter(Ne=>!g(Ne.name)),U=Je.filter(Ne=>Ne.isDirectory()),x=Je.filter(Ne=>!Ne.isDirectory());for(;x.length===0&&U.length===1&&ve<t;)xe=`${xe}/${U[0].name}`,$=ms.join($,U[0].name),ve++,Ie=i($),Je=Ie.filter(Ne=>!g(Ne.name)),U=Je.filter(Ne=>Ne.isDirectory()),x=Je.filter(Ne=>!Ne.isDirectory());let zt=U.length>0;if(zt&&ve<t)z.push({displayName:xe,subDirPath:$,subEntries:Ie,nextDepth:ve+1});else{let Ne=w(x),qt=zt&&ve>=t?" ...max scan depth":"";P.push(`${xe}/${Ne}${qt}`)}}P.length>0&&(_+=`${l}${P.join(", ")}
543
+ `);let Le=10,v=s.slice(0,Le),N=s.length>Le,P=[],z=[];for(let M of v){let $=ps.join(e,M.name),xe=M.name,ve=n,Ie=i($),Je=Ie.filter(Ne=>!g(Ne.name)),U=Je.filter(Ne=>Ne.isDirectory()),x=Je.filter(Ne=>!Ne.isDirectory());for(;x.length===0&&U.length===1&&ve<t;)xe=`${xe}/${U[0].name}`,$=ps.join($,U[0].name),ve++,Ie=i($),Je=Ie.filter(Ne=>!g(Ne.name)),U=Je.filter(Ne=>Ne.isDirectory()),x=Je.filter(Ne=>!Ne.isDirectory());let zt=U.length>0;if(zt&&ve<t)z.push({displayName:xe,subDirPath:$,subEntries:Ie,nextDepth:ve+1});else{let Ne=w(x),qt=zt&&ve>=t?" ...max scan depth":"";P.push(`${xe}/${Ne}${qt}`)}}P.length>0&&(_+=`${l}${P.join(", ")}
544
544
  `);for(let{displayName:M,subDirPath:$,subEntries:xe,nextDepth:ve}of z)_+=`${l}${M}/
545
- `,_+=ps($,t,ve,i,u,xe);return N&&(_+=`${l}...max scan width, ReadFolder if needed
546
- `),_};import hs from"path";import sl from"fs";var rl=e=>{try{return sl.readdirSync(e,{withFileTypes:!0})}catch{return[]}},ys=(e,t,n="",i=1,o=rl,r=[])=>{let d=o(e),l=hs.sep;if(d.length>100)return`${n}\u2514\u2500\u2500 ${hs.basename(e)}${l} ...100+ files...
547
- `;let u="",g=r,h=d.filter(s=>!g.includes(s.name)&&!s.name.startsWith(".")),m=d.filter(s=>g.includes(s.name)||s.name.startsWith(".")).map(s=>s.name).sort();h.sort((s,w)=>s.isDirectory()&&!w.isDirectory()?-1:!s.isDirectory()&&w.isDirectory()?1:s.name.localeCompare(w.name));let p=[...h.map(s=>({name:s.name,isDir:s.isDirectory()})),...m.map(s=>({name:s,isDir:!0,isCollapsed:!0}))];return p.forEach((s,w)=>{let _=w===p.length-1,Le=hs.join(e,s.name),v=_?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",N=n+(_?" ":"\u2502 ");if(s.isCollapsed){u+=`${n}${v}${s.name}${l}...
545
+ `,_+=hs($,t,ve,i,u,xe);return N&&(_+=`${l}...max scan width, ReadFolder if needed
546
+ `),_};import ys from"path";import rl from"fs";var al=e=>{try{return rl.readdirSync(e,{withFileTypes:!0})}catch{return[]}},xs=(e,t,n="",i=1,o=al,r=[])=>{let d=o(e),l=ys.sep;if(d.length>100)return`${n}\u2514\u2500\u2500 ${ys.basename(e)}${l} ...100+ files...
547
+ `;let u="",g=r,h=d.filter(s=>!g.includes(s.name)&&!s.name.startsWith(".")),m=d.filter(s=>g.includes(s.name)||s.name.startsWith(".")).map(s=>s.name).sort();h.sort((s,w)=>s.isDirectory()&&!w.isDirectory()?-1:!s.isDirectory()&&w.isDirectory()?1:s.name.localeCompare(w.name));let p=[...h.map(s=>({name:s.name,isDir:s.isDirectory()})),...m.map(s=>({name:s,isDir:!0,isCollapsed:!0}))];return p.forEach((s,w)=>{let _=w===p.length-1,Le=ys.join(e,s.name),v=_?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",N=n+(_?" ":"\u2502 ");if(s.isCollapsed){u+=`${n}${v}${s.name}${l}...
548
548
  `;return}s.isDir?i>t?u+=`${n}${v}${s.name}${l} ...depth exceeded...
549
549
  `:o(Le).length>80?u+=`${n}${v}${s.name}${l} ...80+ files...
550
550
  `:(u+=`${n}${v}${s.name}${l}
551
- `,u+=ys(Le,t,N,i+1,o,r)):u+=`${n}${v}${s.name}
552
- `}),u};var ll={Ollama:()=>import("./ollama-SMYO5EJG.js").then(e=>e.getOllamaStream),OpenRouter:()=>import("./openrouter-LSG67TST.js").then(e=>e.getOpenRouterStream),DeepSeek:()=>import("./deepseek-I2J4A7WQ.js").then(e=>e.getDeepSeekStream),Mistral:()=>import("./mistral-H23J6UYA.js").then(e=>e.getMistralStream),NVIDIA:()=>import("./nvidia-BUWXTYGV.js").then(e=>e.getNVIDIAStream),NVIDIA_wrap:()=>import("./nvidia-BUWXTYGV.js").then(e=>e.wrapNvidiaStreamWithQueueDepth),InferX:()=>import("./inferx-B6PKXWLZ.js").then(e=>e.getInferXStream),SenseNova:()=>import("./sensenova-MLFZTP7U.js").then(e=>e.getSenseNovaStream),AIHubMix:()=>import("./aihubmix-KJIG7CZO.js").then(e=>e.getAIHubMixStream),Poolside:()=>import("./poolside-KWCBEP3P.js").then(e=>e.getPoolsideStream),NineRouter:()=>import("./9router-KRJQK6JP.js").then(e=>e.getNineRouterStream),ExpLabs:()=>import("./explabs-OYP64XS6.js").then(e=>e.getExpLabsStream),TokenHarbor:()=>import("./tokenharbor-Y6HSTTHA.js").then(e=>e.getTokenHarborStream),Infron:()=>import("./infron-4SLX3HMD.js").then(e=>e.getInfronStream),APInex:()=>import("./apinex-EP3JJPZO.js").then(e=>e.getAPInexStream),xKiro:()=>import("./xkiro-D3DTPVWY.js").then(e=>e.getXKiroStream),c_openai:()=>import("./custom_openai-ODYQEMOR.js").then(e=>e.getCustomOpenAIStream)},ws={},ye=async e=>(ws[e]||(ws[e]=await ll[e]()),ws[e]),cl=/```[\s\S]*?```/g,dl=/```[\s\S]*$/g,fl=/`[^`]+`/g,ul=/^\|.*\|$/gm,gl=/^[^\w]+|[^\w]+$/g,ml=/[^a-z0-9]/gi,Oo=/\[\s*(?:tool|action):(?:functions\.)?([a-z0-9_]+)\s*\(/gi,pl=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-z0-9_]+)\s*\(/gi,hl=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,bn=/["']/g,ra=/\\/g,yl=/<\|channel>thought/gi,xl=/<channel\|>/gi,wl=e=>typeof e!="string"?e:e.replace(yl,"<think_fluxflow>").replace(xl,"</think_fluxflow>"),Vd=/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\]|$)/i,bl=(e,t,n=1)=>{let i=t>0?e[t-1]:"",o=t+n<e.length?e[t+n]:"";return i==="`"&&o==="`"},Sl=e=>{let t=/(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\])/gi,n;for(;(n=t.exec(e))!==null;)if(!bl(e,n.index,n[0].length))return{index:n.index,length:n[0].length};return{index:-1,length:0}},bs=e=>{if(!e||typeof e!="string")return null;let t=e.match(/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])/i);if(!t)return null;let n=t.index+t[0].length,i=e.substring(n),o=Sl(i);if(o.index!==-1){let r=n+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 t=bs(e);return t?t.remainingText.trimStart():e};var aa=/<\|\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,kl=/"([^"]+)"\s*:\s*(?:"([^"]*)"|(\d+)|true|false|null)/g,la=/<\|\s*tool_calls_section_begin\s*\|>/gi,ca=/<\|\s*tool_calls_section_end\s*\|>/gi,Tl=/```(?:tool|action|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi;var ki=e=>!e||typeof e!="string"?e:e.replace(/(```[\s\S]*?```|`[^`]*`)|(<(?:\w+)(?:[^>]*)>\r?\n?|\r?\n?<\/\w+(?:[^>]*)>)/gi,(t,n)=>n||""),ma=e=>{if(!e||typeof e!="string")return e;let t=Mn(e);if(!t||t.length===0)return e;let n=t[t.length-1];if(!n.fullMatch)return e;let i=e.lastIndexOf(n.fullMatch);if(i===-1)return e;let o=i+n.fullMatch.length,r=e.substring(o);if(/\[\s*(?:tool|action):/i.test(r))return e.trimEnd();let d=/\r?\n/.test(r);return e.substring(0,o)+(d?`
553
- `:"")},ks=null,Do={},jn={key:null,value:null},Rt=e=>{if(!e)return e;let t=Do?.theme;if(!t)try{t=Zo(Jo,{})?.systemSettings?.theme}catch{}let i=wi(t||"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`)},Al=async(e,t=8,n=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>=t))throw d;let l=Math.min(n*Math.pow(2,r-1),i);await new Promise((u,g)=>{let h=setTimeout(u,l);o&&o.addEventListener("abort",()=>{clearTimeout(h),g(new DOMException("The user aborted a request.","AbortError"))})})}}},ut=!1;var zd=e=>{let t=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 h=l.substring(0,u).lastIndexOf("[SYSTEM METADATA]");h!==-1?l=l.substring(h).trim():l=l.substring(u).trim()}}else{let u=l.lastIndexOf("[USER]"),g=l.lastIndexOf("[USER PROMPT]");u!==-1?l=l.substring(u+6).trim():g!==-1&&(l=l.substring(g).trim())}return{...o,text:l}}),n=[],i=0;for(;i<t.length;){let o=t[i];if(o.role==="user")n.push(o),i++;else{let r=[];for(;i<t.length&&t[i].role!=="user";)r.push(t[i]),i++;let d=[],l=[],u=!1,g=()=>{d.length>0&&(n.push({role:"agent",text:"combined"}),d=[]),l.length>0&&(n.push({role:"system",text:"combined"}),l=[]),u=!1};r.forEach(h=>{let m=h.role==="system"&&(h.text?.startsWith("[ACTION RESULT]")||h.text?.startsWith("[TOOL RESULT]")||h.text?.startsWith("SUCCESS:")||h.text?.startsWith("ERROR:")||h.fullText?.startsWith("[ACTION RESULT]")||h.fullText?.startsWith("[TOOL RESULT]")||h.fullText?.startsWith("SUCCESS:")||h.fullText?.startsWith("ERROR:")),p=h.fullText||h.text||"",s=p.trim();if(!(!s&&!h.binaryPart)){if(m)l.push(s);else if(h.role==="agent"){!u&&l.length>0&&g();let w=p.endsWith(`
554
- `),_=s.toLowerCase().includes("tool:")||s.toLowerCase().includes("action:");d.push(s),_&&w?u=!0:u=!1}}}),g()}}return n.length};var qd=()=>{ut=!0},Yd=()=>ut,Ss={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"},Kn=(e,t)=>{try{let n=D(t),i=e.toLowerCase().replace(/_/g,"");if(i==="invokesync"||i==="invoke")return n.title||(n.task?n.task.substring(0,30):null);if(i==="getprogress"||i==="cancel"||i==="steer"||i==="steersubagent")return n.id||n.taskId;let o=n.name||n.path||n.targetFile||n.TargetFile||n.directory||n.file||n.query;return o?V.basename(o.replace(/["']/g,"").replace(/\\/g,"/")):null}catch{return null}},pa=e=>e?new ga({apiKey:e}):ks,Xd=async(e,t,n,i,o={})=>{},Ti=e=>{if(!e||typeof e!="string")return e;let t=e.split(""),n=!1,i=!1,o=0;for(;o<t.length;){if(t[o]==="`"&&t[o+1]==="`"&&t[o+2]==="`"){n?(t[o]=" ",t[o+1]=" ",t[o+2]=" ",n=!1):(t[o]=" ",t[o+1]=" ",t[o+2]=" ",n=!0),o+=3;continue}if(n){t[o]!==`
551
+ `,u+=xs(Le,t,N,i+1,o,r)):u+=`${n}${v}${s.name}
552
+ `}),u};var dl={Ollama:()=>import("./ollama-SMYO5EJG.js").then(e=>e.getOllamaStream),OpenRouter:()=>import("./openrouter-LSG67TST.js").then(e=>e.getOpenRouterStream),DeepSeek:()=>import("./deepseek-I2J4A7WQ.js").then(e=>e.getDeepSeekStream),Mistral:()=>import("./mistral-H23J6UYA.js").then(e=>e.getMistralStream),NVIDIA:()=>import("./nvidia-BUWXTYGV.js").then(e=>e.getNVIDIAStream),NVIDIA_wrap:()=>import("./nvidia-BUWXTYGV.js").then(e=>e.wrapNvidiaStreamWithQueueDepth),InferX:()=>import("./inferx-B6PKXWLZ.js").then(e=>e.getInferXStream),SenseNova:()=>import("./sensenova-MLFZTP7U.js").then(e=>e.getSenseNovaStream),AIHubMix:()=>import("./aihubmix-KJIG7CZO.js").then(e=>e.getAIHubMixStream),Poolside:()=>import("./poolside-KWCBEP3P.js").then(e=>e.getPoolsideStream),NineRouter:()=>import("./9router-KRJQK6JP.js").then(e=>e.getNineRouterStream),ExpLabs:()=>import("./explabs-OYP64XS6.js").then(e=>e.getExpLabsStream),TokenHarbor:()=>import("./tokenharbor-Y6HSTTHA.js").then(e=>e.getTokenHarborStream),Infron:()=>import("./infron-4SLX3HMD.js").then(e=>e.getInfronStream),APInex:()=>import("./apinex-EP3JJPZO.js").then(e=>e.getAPInexStream),xKiro:()=>import("./xkiro-D3DTPVWY.js").then(e=>e.getXKiroStream),c_openai:()=>import("./custom_openai-ODYQEMOR.js").then(e=>e.getCustomOpenAIStream)},bs={},ye=async e=>(bs[e]||(bs[e]=await dl[e]()),bs[e]),fl=/```[\s\S]*?```/g,ul=/```[\s\S]*$/g,gl=/`[^`]+`/g,ml=/^\|.*\|$/gm,pl=/^[^\w]+|[^\w]+$/g,hl=/[^a-z0-9]/gi,Do=/\[\s*(?:tool|action):(?:functions\.)?([a-z0-9_]+)\s*\(/gi,yl=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-z0-9_]+)\s*\(/gi,xl=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,bn=/["']/g,aa=/\\/g,wl=/<\|channel>thought/gi,bl=/<channel\|>/gi,Sl=e=>typeof e!="string"?e:e.replace(wl,"<think_fluxflow>").replace(bl,"</think_fluxflow>"),Yd=/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\]|$)/i,kl=(e,t,n=1)=>{let i=t>0?e[t-1]:"",o=t+n<e.length?e[t+n]:"";return i==="`"&&o==="`"},Tl=e=>{let t=/(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\])/gi,n;for(;(n=t.exec(e))!==null;)if(!kl(e,n.index,n[0].length))return{index:n.index,length:n[0].length};return{index:-1,length:0}},Ss=e=>{if(!e||typeof e!="string")return null;let t=e.match(/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])/i);if(!t)return null;let n=t.index+t[0].length,i=e.substring(n),o=Tl(i);if(o.index!==-1){let r=n+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 t=Ss(e);return t?t.remainingText.trimStart():e};var la=/<\|\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,Al=/"([^"]+)"\s*:\s*(?:"([^"]*)"|(\d+)|true|false|null)/g,ca=/<\|\s*tool_calls_section_begin\s*\|>/gi,da=/<\|\s*tool_calls_section_end\s*\|>/gi,Cl=/```(?:tool|action|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi;var Ti=e=>!e||typeof e!="string"?e:e.replace(/(```[\s\S]*?```|`[^`]*`)|(<(?:\w+)(?:[^>]*)>\r?\n?|\r?\n?<\/\w+(?:[^>]*)>)/gi,(t,n)=>n||""),pa=e=>{if(!e||typeof e!="string")return e;let t=Mn(e);if(!t||t.length===0)return e;let n=t[t.length-1];if(!n.fullMatch)return e;let i=e.lastIndexOf(n.fullMatch);if(i===-1)return e;let o=i+n.fullMatch.length,r=e.substring(o);if(/\[\s*(?:tool|action):/i.test(r))return e.trimEnd();let d=/\r?\n/.test(r);return e.substring(0,o)+(d?`
553
+ `:"")},Ts=null,No={},jn={key:null,value:null},Rt=e=>{if(!e)return e;let t=No?.theme;if(!t)try{t=ei(Qo,{})?.systemSettings?.theme}catch{}let i=bi(t||"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`)},vl=async(e,t=8,n=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>=t))throw d;let l=Math.min(n*Math.pow(2,r-1),i);await new Promise((u,g)=>{let h=setTimeout(u,l);o&&o.addEventListener("abort",()=>{clearTimeout(h),g(new DOMException("The user aborted a request.","AbortError"))})})}}},ut=!1;var Xd=e=>{let t=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 h=l.substring(0,u).lastIndexOf("[SYSTEM METADATA]");h!==-1?l=l.substring(h).trim():l=l.substring(u).trim()}}else{let u=l.lastIndexOf("[USER]"),g=l.lastIndexOf("[USER PROMPT]");u!==-1?l=l.substring(u+6).trim():g!==-1&&(l=l.substring(g).trim())}return{...o,text:l}}),n=[],i=0;for(;i<t.length;){let o=t[i];if(o.role==="user")n.push(o),i++;else{let r=[];for(;i<t.length&&t[i].role!=="user";)r.push(t[i]),i++;let d=[],l=[],u=!1,g=()=>{d.length>0&&(n.push({role:"agent",text:"combined"}),d=[]),l.length>0&&(n.push({role:"system",text:"combined"}),l=[]),u=!1};r.forEach(h=>{let m=h.role==="system"&&(h.text?.startsWith("[ACTION RESULT]")||h.text?.startsWith("[TOOL RESULT]")||h.text?.startsWith("SUCCESS:")||h.text?.startsWith("ERROR:")||h.fullText?.startsWith("[ACTION RESULT]")||h.fullText?.startsWith("[TOOL RESULT]")||h.fullText?.startsWith("SUCCESS:")||h.fullText?.startsWith("ERROR:")),p=h.fullText||h.text||"",s=p.trim();if(!(!s&&!h.binaryPart)){if(m)l.push(s);else if(h.role==="agent"){!u&&l.length>0&&g();let w=p.endsWith(`
554
+ `),_=s.toLowerCase().includes("tool:")||s.toLowerCase().includes("action:");d.push(s),_&&w?u=!0:u=!1}}}),g()}}return n.length};var Jd=()=>{ut=!0},Qd=()=>ut,ks={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"},Kn=(e,t)=>{try{let n=D(t),i=e.toLowerCase().replace(/_/g,"");if(i==="invokesync"||i==="invoke")return n.title||(n.task?n.task.substring(0,30):null);if(i==="getprogress"||i==="cancel"||i==="steer"||i==="steersubagent")return n.id||n.taskId;let o=n.name||n.path||n.targetFile||n.TargetFile||n.directory||n.file||n.query;return o?V.basename(o.replace(/["']/g,"").replace(/\\/g,"/")):null}catch{return null}},ha=e=>e?new ma({apiKey:e}):Ts,Zd=async(e,t,n,i,o={})=>{},Ai=e=>{if(!e||typeof e!="string")return e;let t=e.split(""),n=!1,i=!1,o=0;for(;o<t.length;){if(t[o]==="`"&&t[o+1]==="`"&&t[o+2]==="`"){n?(t[o]=" ",t[o+1]=" ",t[o+2]=" ",n=!1):(t[o]=" ",t[o+1]=" ",t[o+2]=" ",n=!0),o+=3;continue}if(n){t[o]!==`
555
555
  `&&t[o]!=="\r"&&(t[o]=" "),o++;continue}if(t[o]==="`")if(i){i=!1,t[o]=" ",o++;continue}else{i=!0,t[o]=" ",o++;continue}if(i){t[o]===`
556
- `||t[o]==="\r"?i=!1:t[o]=" ",o++;continue}o++}return t.join("")},da=(e,t=null)=>{if(!e||typeof e!="string")return e;let n=t||Mn(e);if(!n||n.length===0)return e;let i=e.split("");for(let o of n){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]!==`
557
- `&&i[d]!=="\r"&&(i[d]=" ");r+=o.fullMatch.length}}return i.join("")},Cl=e=>{let t=Ft(e),n=Ti(t);Oo.lastIndex=0;let i;for(;(i=Oo.exec(n))!==null;){let o=i.index+i[0].length-1,r=0,d=null,l=!1,u=!1;for(let g=o;g<n.length;g++){let h=n[g];if(!d&&(h==='"'||h==="'"||h==="`")?(d=h,l=!1):d&&h===d&&!l&&(d=null),!d&&(h==="("?r++:h===")"&&r--,r===0)){let m=g+1;for(;m<n.length&&/\s/.test(n[m]);)m++;if(m<n.length&&n[m]==="]"){u=!0,Oo.lastIndex=m+1;break}}h==="\\"?l=!l:l=!1}if(!u)return{inside:!0,toolName:i[1],startIndex:i.index,args:t.substring(i.index+i[0].length)}}return{inside:!1}},ha=(e,t=!0)=>{let n=Oo;n.lastIndex=0;let i="",o=0,r;for(;(r=n.exec(e))!==null;){let d=e.substring(o,r.index);i+=t&&o===0?Ft(d):d;let l=r.index+r[0].length-1,u=0,g=null,h=-1;for(let m=l;m<e.length;m++){let p=e[m];if(g){if(p===g){let s=0;for(let w=m-1;w>=0&&e[w]==="\\";w--)s++;s%2===0&&(g=null)}}else if(p==='"'||p==="'"||p==="`")g=p;else if(p==="(")u++;else if(p===")"&&(u--,u===0)){let s=m+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(s<e.length&&e[s]==="]"){h=s;break}}}if(h!==-1)i+="[tool:functions."+r[1]+"()]",o=h+1,n.lastIndex=o;else{i+="[tool:functions."+r[1]+"(",o=e.length;break}}return o<e.length&&(i+=t&&o===0?Ft(e.substring(o)):e.substring(o)),i},vl=(e,t,n)=>{let i=Oo;i.lastIndex=0;let o="",r=0,d;for(;(d=i.exec(e))!==null;){let l=e.substring(r,d.index);o+=l.replace(t,n);let u=d.index+d[0].length-1,g=0,h=null,m=-1;for(let p=u;p<e.length;p++){let s=e[p];if(h){if(s===h){let w=0;for(let _=p-1;_>=0&&e[_]==="\\";_--)w++;w%2===0&&(h=null)}}else if(s==='"'||s==="'"||s==="`")h=s;else if(s==="(")g++;else if(s===")"&&(g--,g===0)){let w=p+1;for(;w<e.length&&/\s/.test(e[w]);)w++;if(w<e.length&&e[w]==="]"){m=w;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(t,n)),o},fa=e=>ha(e,!0),Rl=e=>{if(!e)return e;let t={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"},n=o=>o.split("_").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");aa.lastIndex=0;let i=e.replace(aa,(o,r,d)=>{let l="";try{let h=JSON.parse(d.trim());h&&typeof h=="object"&&(l=Object.entries(h).map(([p,s])=>{let w=typeof s=="string"?s:JSON.stringify(s);return`${p}=${JSON.stringify(w)}`}).join(", "))}catch{let m=[],p=kl;p.lastIndex=0;let s;for(;(s=p.exec(d))!==null;){let w=s[1],_=s[2]!==void 0?s[2]:s[0].split(":").slice(1).join(":").trim();m.push(`${w}=${JSON.stringify(_)}`)}m.length>0?l=m.join(", "):l=d.trim()}let u=r.toLowerCase().replace(/_/g,"");return`[tool:functions.${t[u]||n(r)}(${l})]`});return la.lastIndex=0,ca.lastIndex=0,i=i.replace(la,""),i=i.replace(ca,""),i},Mn=e=>{if(!e)return[];let t=Rl(e),n=Ft(t),i=[],o=Ti(n),r=pl;r.lastIndex=0;let d;for(;(d=r.exec(o))!==null;){let l=d[1],u=d.index+d[0].length-1,g=0,h=null,m=-1,p=-1;for(let s=u;s<o.length;s++){let w=o[s];if(h){if(w===h){let _=0;for(let Le=s-1;Le>=0&&o[Le]==="\\";Le--)_++;_%2===0&&(h=null)}}else{if(s>u&&(o.substring(s).startsWith("[action:")||o.substring(s).startsWith("[tool:")))break;if(w==='"'||w==="'"||w==="`")h=w;else if(w==="(")g++;else if(w===")"&&(g--,g===0)){p=s;let _=s+1;for(;_<o.length&&/\s/.test(o[_]);)_++;if(_<o.length&&o[_]==="]"){m=_;break}}}}if(m!==-1){let s=n.substring(u+1,p),w=n.substring(d.index,m+1);i.push({fullMatch:w,toolName:l.trim(),args:s.trim()}),r.lastIndex=m+1}}return i},ua=e=>{if(!e)return null;let t=Ft(e),n=[],i=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,o=[],r;for(;(r=i.exec(t))!==null;)o.push({toolName:r[1],index:r.index,parenIndex:r.index+r[0].length-1});for(let p=0;p<o.length;p++){let s=o[p],w=p+1<o.length?o[p+1].index:t.length,_=t.substring(s.index,w),Le=_.indexOf("("),v=Le!==-1?_.substring(Le+1):"",N=0,P=null,z=!1;for(let M=0;M<v.length;M++){let $=v[M];if(P){if($===P){let xe=0;for(let ve=M-1;ve>=0&&v[ve]==="\\";ve--)xe++;xe%2===0&&(P=null)}}else if($==='"'||$==="'"||$==="`")P=$;else if($==="(")N++;else if($===")")if(N>0)N--;else{let xe=M+1;for(;xe<v.length&&/\s/.test(v[xe]);)xe++;if(xe<v.length&&v[xe]==="]"){z=!0;break}}}if(!z){let M=_.trim(),$="";P?$=`Unclosed quote string (${P}) inside arguments`:M.endsWith("]")?$=`Missing closing ')' before ']' (e.g. found "...]")`:M.endsWith(")")?$=`Missing closing ']' after ')' (e.g. found "...)" instead of "...)]")`:!M.includes(")")&&!M.includes("]")?$="Missing closing delimiter ')]'":$="Malformed or unclosed call syntax (missing ')]')",n.push(`\u2022 [action:${s.toolName}(...)]: ${$}. Expected: [action:${s.toolName}(arg1="...", arg2="...")]`)}}let d=/(?:^|[^\w\[])(?:tool|action):(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/gi,l;for(;(l=d.exec(t))!==null;){let p=l[1],s=l.index+(l[0].indexOf(":")-(l[0].startsWith("action")||l[0].startsWith("tool")?0:1));(s>0?t[s-1]:"")!=="["&&yi(p)&&n.push(`\u2022 action:${p}(...): Missing opening bracket '['. Expected: [action:${p}(...)]`)}let u=/\[\s*(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/g,g;for(;(g=u.exec(t))!==null;){let p=g[1];p!=="action"&&p!=="tool"&&yi(p)&&n.push(`\u2022 [${p}(...)]: Missing 'action:' prefix. Expected: [action:${p}(...)]`)}let h=/\[\s*(?:tool|action)\s*:\s*(?:functions\.)?([a-zA-Z0-9_]+)(?!\s*\()/gi,m;for(;(m=h.exec(t))!==null;){let p=m[1];yi(p)&&n.push(`\u2022 [action:${p}...]: Missing opening '(' for tool arguments. Expected: [action:${p}(...)]`)}return n.length>0?n.join(`
558
- `):null},Jd=(e,t={})=>{if(!e)return null;if(Do=t,ks=new ga({apiKey:e}),!globalThis.__perfCleanupInstalled){globalThis.__perfCleanupInstalled=!0,setInterval(()=>{typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks())},6e4);let n=globalThis.fetch;globalThis.fetch=async(...i)=>{try{let o=await n(...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}}}},ya=e=>{if(!e)return{serviceTier:void 0,cleanModel:e};let t=e.toLowerCase();return t.endsWith(":flex")?{serviceTier:"flex",cleanModel:e.slice(0,-5)}:t.endsWith(":priority")?{serviceTier:"priority",cleanModel:e.slice(0,-9)}:{serviceTier:void 0,cleanModel:e}},El=async(e,t,n,i,o="Fast",r=.75,d="agent")=>Al(async()=>{let{aiProvider:l="Google",apiKey:u,mode:g}=e,h="",m=null,p=typeof n=="string"?[{role:"user",parts:[{text:n}]}]:n,s=new AbortController,w=s.signal,_=setInterval(()=>{ut&&(s.abort(),clearInterval(_))},100),Le=Date.now(),v=null;try{let N;if(l==="Ollama")N=(await ye("Ollama"))(u,t,p,i,o,g,nt(t),w,r,e.systemSettings?.ollamaEndpoint||"Cloud");else if(l==="OpenRouter")N=(await ye("OpenRouter"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="DeepSeek")N=(await ye("DeepSeek"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="Mistral")N=(await ye("Mistral"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="NVIDIA")N=(await ye("NVIDIA"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="InferX")N=(await ye("InferX"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="SenseNova")N=(await ye("SenseNova"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="AIHubMix")N=(await ye("AIHubMix"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="Poolside")N=(await ye("Poolside"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="9router"||l==="9Router")N=(await ye("NineRouter"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="ExpLabs"||l==="ExperientialLabs")N=(await ye("ExpLabs"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="Infron"||l==="infron")N=(await ye("Infron"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="TokenHarbor"||l==="Token Harbor"||l==="tokenharbor"||l==="token_harbor"||l==="thk")N=(await ye("TokenHarbor"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="APInex"||l==="apinex"||l==="apx")N=(await ye("APInex"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="xKiro"||l==="xkiro"||l==="kiro")N=(await ye("xKiro"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="c_openai"||l==="Custom (OpenAI)"){let P=e.systemSettings?.customOpenAIBaseUrl||"";try{P=await Wi("c_openai")||P}catch{}N=(await ye("c_openai"))(u,t,p,i,o,g,nt(t),w,r,P)}else{let P=pa(u),{serviceTier:z,cleanModel:M}=ya(t),$={systemInstruction:i,temperature:r,thinkingConfig:(()=>{let ve=(t||"").toLowerCase(),Ie=ve.includes("gemma-4")||ve.startsWith("gemma"),Je=ve.includes("gemini-3");if(Ie||Je)return Ie?o.toLowerCase()!=="xhigh"?{includeThoughts:!1,thinkingLevel:Ye.MINIMAL}:{includeThoughts:!0,thinkingLevel:Ye.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:ve.includes("pro")?Ye.LOW:Ye.MINIMAL,Low:Ye.LOW,Medium:Ye.MEDIUM,Standard:Ye.MEDIUM,High:Ye.HIGH,xHigh:Ye.HIGH}[o]||Ye.MEDIUM};{let U={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[o]||2048;return U===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:U}}})()};z&&($.serviceTier=z),N=await P.models.generateContentStream({model:M,contents:p,config:$},{signal:w})}for await(let P of N){if(ut)throw new Error("Subagent task was cancelled.");if(e?.taskId&&typeof Nt<"u"){let $=Nt.find(xe=>xe.id===e.taskId);if($&&$.status==="cancelled")throw new Error("Subagent task was cancelled.")}v===null&&(P.candidates?.[0]?.content?.parts||P.text)&&(v=Date.now()-Le);let z="";if(P.candidates?.[0]?.content?.parts)for(let $ of P.candidates[0].content.parts)$.text&&!$.thought&&(h+=$.text,z+=$.text);let M=z?Hi(z):0;e&&typeof e.onTokenChunk=="function"&&e.onTokenChunk(z,M),P.usageMetadata&&(m=P.usageMetadata)}}finally{clearInterval(_)}if(m){let N=m.totalTokenCount||0,P=m.cachedContentTokenCount||0,z=(m.candidatesTokenCount||0)+(l==="Google"&&m.thoughtsTokenCount||0);await dn("tokens",N,l,t),P>0&&await dn("cachedTokens",P,l,t),z>0&&await dn("candidateTokens",z,l,t),v!==null&&v>0&&await dn("ttft",v,l,t),ni({provider:l,model:t,prompt:m.promptTokenCount||0,cached:P,output:z,reasoning:m.thoughtsTokenCount||0,ttft:v}),e&&typeof e.onUsage=="function"&&e.onUsage({totalTokenCount:N,cachedContentTokenCount:P,candidatesTokenCount:z})}return await vt("agent",l),{text:h,usageMetadata:m}}),Qd=async function*(e,t,n,i,o){let{profile:r,thinkingLevel:d,mode:l,janitorModel:u,chatId:g,isPlayground:h,systemSettings:m,sessionStats:p,aiProvider:s="Google",apiTier:w,wildcardTooling:_,wildercardTooling:Le}=n,v=nt(e);if(!ks&&s==="Google")throw new Error("AI not initialized");let N=!1,P=t[t.length-1].text,z=V.join(Ws,"chat-summaries.json"),M=!1,$=t.filter(U=>U.role==="user").length===1,xe=P.includes("[TITLE-UPDATE]"),ve=$||xe,Ie=P.replace(/\[TITLE-UPDATE\]/g,"").trim();Ie=Ie.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),yield{type:"status",content:"[start]"},yield{type:"status",content:"Gathering Context"},await oi.startTransaction(g,Ie),m?.advanceRollback&&await So.takeInitialSnapshot(g),ut=!1;let Je=null;try{let U=new AbortController;Je=setInterval(()=>{ut&&(U.abort(),Je&&(clearInterval(Je),Je=null))},400);let x=[...t.slice(0,-1)];{let ge=cn(z,{})[g]||{summary:"",historyLength:0};if(ge.summary&&ge.historyLength>0){let ht=0,ce=[];for(let q=0;q<x.length;q++){let be=x[q];(be.role==="user"||be.role==="agent"||be.role==="system")&&!String(be.id).startsWith("welcome")&&!be.isMeta&&ht++,ht>ge.historyLength&&ce.push(be)}x=ce}}x=x.map(b=>{if(b.role==="user"&&b.text){let ge=b.text.match(/\[USER\]([\s\S]*?)\[\/USER\]/);if(ge)return{...b,text:ge[1].trim()}}return{...b}});let zt=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")&&zt&&(Fe=16e3),(p?.tokens||0)>Fe){yield{type:"text",content:"\u2726 Maximum Context Limit Reached. Start a new chat."};return}if($&&N){let b=cn(Ni,{});Object.values(b).flat().length>5}let ae=cn(Ni,{}),on=cn(Us,{}),Vn=Object.entries(ae).filter(([b])=>b!==g).flatMap(([b,ge])=>ge),Fo=[...Object.entries(on).filter(([b])=>b!==g).slice(-20).map(([b,ge])=>`[Chat Summary]: ${ge}`),...Vn].map(b=>`- ${b}`).join(`
559
- `),Pn=cn(Qo,[]).map(b=>`- ${b.memory}`).join(`
560
- `),zn=(p?.tokens||0)>=1e4,Yt=new Date,$n=Yt.getFullYear(),Re=Yt.toLocaleString("en-US",{month:"short"}).toUpperCase(),qn=String(Yt.getDate()).padStart(2,"0"),Q=`${Yt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0})}`,B=b=>{try{return Ce.readdirSync(b,{withFileTypes:!0})}catch{return[]}},Xn=Array.from(new Set([...wo,...bo(process.cwd())])),pt=(b,ge=6)=>m?.indentationTree!==!1?ps(b,ge,1,B,Xn):ys(b,ge,"",1,B,Xn),A=cn(Fi,{}),oe=A[g],Xt=oe?oe!==process.cwd():!1;A[g]=process.cwd(),Bi(Fi,A);let Bt=cn(z,{}),kt=Bt[g]||{summary:"",historyLength:0};typeof kt=="string"&&(kt={summary:kt,historyLength:0});let Ln=t.filter(b=>(b.role==="user"||b.role==="agent"||b.role==="system")&&!String(b.id).startsWith("welcome")&&!b.isMeta).length;kt.historyLength&&Ln<kt.historyLength&&(kt.summary="",kt.historyLength=0,Bt[g]=kt,Bi(z,Bt));let Wo=typeof kt=="object"?kt.summary||"":kt||"",Ts=x.length>0;Ts&&Wo&&x[0]&&(x[0].role==="user"||x[0].role==="system")&&(x[0].text.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")||(x[0].text=`[SYSTEM METADATA]
556
+ `||t[o]==="\r"?i=!1:t[o]=" ",o++;continue}o++}return t.join("")},fa=(e,t=null)=>{if(!e||typeof e!="string")return e;let n=t||Mn(e);if(!n||n.length===0)return e;let i=e.split("");for(let o of n){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]!==`
557
+ `&&i[d]!=="\r"&&(i[d]=" ");r+=o.fullMatch.length}}return i.join("")},Rl=e=>{let t=Ft(e),n=Ai(t);Do.lastIndex=0;let i;for(;(i=Do.exec(n))!==null;){let o=i.index+i[0].length-1,r=0,d=null,l=!1,u=!1;for(let g=o;g<n.length;g++){let h=n[g];if(!d&&(h==='"'||h==="'"||h==="`")?(d=h,l=!1):d&&h===d&&!l&&(d=null),!d&&(h==="("?r++:h===")"&&r--,r===0)){let m=g+1;for(;m<n.length&&/\s/.test(n[m]);)m++;if(m<n.length&&n[m]==="]"){u=!0,Do.lastIndex=m+1;break}}h==="\\"?l=!l:l=!1}if(!u)return{inside:!0,toolName:i[1],startIndex:i.index,args:t.substring(i.index+i[0].length)}}return{inside:!1}},ya=(e,t=!0)=>{let n=Do;n.lastIndex=0;let i="",o=0,r;for(;(r=n.exec(e))!==null;){let d=e.substring(o,r.index);i+=t&&o===0?Ft(d):d;let l=r.index+r[0].length-1,u=0,g=null,h=-1;for(let m=l;m<e.length;m++){let p=e[m];if(g){if(p===g){let s=0;for(let w=m-1;w>=0&&e[w]==="\\";w--)s++;s%2===0&&(g=null)}}else if(p==='"'||p==="'"||p==="`")g=p;else if(p==="(")u++;else if(p===")"&&(u--,u===0)){let s=m+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(s<e.length&&e[s]==="]"){h=s;break}}}if(h!==-1)i+="[tool:functions."+r[1]+"()]",o=h+1,n.lastIndex=o;else{i+="[tool:functions."+r[1]+"(",o=e.length;break}}return o<e.length&&(i+=t&&o===0?Ft(e.substring(o)):e.substring(o)),i},El=(e,t,n)=>{let i=Do;i.lastIndex=0;let o="",r=0,d;for(;(d=i.exec(e))!==null;){let l=e.substring(r,d.index);o+=l.replace(t,n);let u=d.index+d[0].length-1,g=0,h=null,m=-1;for(let p=u;p<e.length;p++){let s=e[p];if(h){if(s===h){let w=0;for(let _=p-1;_>=0&&e[_]==="\\";_--)w++;w%2===0&&(h=null)}}else if(s==='"'||s==="'"||s==="`")h=s;else if(s==="(")g++;else if(s===")"&&(g--,g===0)){let w=p+1;for(;w<e.length&&/\s/.test(e[w]);)w++;if(w<e.length&&e[w]==="]"){m=w;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(t,n)),o},ua=e=>ya(e,!0),_l=e=>{if(!e)return e;let t={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"},n=o=>o.split("_").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");la.lastIndex=0;let i=e.replace(la,(o,r,d)=>{let l="";try{let h=JSON.parse(d.trim());h&&typeof h=="object"&&(l=Object.entries(h).map(([p,s])=>{let w=typeof s=="string"?s:JSON.stringify(s);return`${p}=${JSON.stringify(w)}`}).join(", "))}catch{let m=[],p=Al;p.lastIndex=0;let s;for(;(s=p.exec(d))!==null;){let w=s[1],_=s[2]!==void 0?s[2]:s[0].split(":").slice(1).join(":").trim();m.push(`${w}=${JSON.stringify(_)}`)}m.length>0?l=m.join(", "):l=d.trim()}let u=r.toLowerCase().replace(/_/g,"");return`[tool:functions.${t[u]||n(r)}(${l})]`});return ca.lastIndex=0,da.lastIndex=0,i=i.replace(ca,""),i=i.replace(da,""),i},Mn=e=>{if(!e)return[];let t=_l(e),n=Ft(t),i=[],o=Ai(n),r=yl;r.lastIndex=0;let d;for(;(d=r.exec(o))!==null;){let l=d[1],u=d.index+d[0].length-1,g=0,h=null,m=-1,p=-1;for(let s=u;s<o.length;s++){let w=o[s];if(h){if(w===h){let _=0;for(let Le=s-1;Le>=0&&o[Le]==="\\";Le--)_++;_%2===0&&(h=null)}}else{if(s>u&&(o.substring(s).startsWith("[action:")||o.substring(s).startsWith("[tool:")))break;if(w==='"'||w==="'"||w==="`")h=w;else if(w==="(")g++;else if(w===")"&&(g--,g===0)){p=s;let _=s+1;for(;_<o.length&&/\s/.test(o[_]);)_++;if(_<o.length&&o[_]==="]"){m=_;break}}}}if(m!==-1){let s=n.substring(u+1,p),w=n.substring(d.index,m+1);i.push({fullMatch:w,toolName:l.trim(),args:s.trim()}),r.lastIndex=m+1}}return i},ga=e=>{if(!e)return null;let t=Ft(e),n=[],i=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,o=[],r;for(;(r=i.exec(t))!==null;)o.push({toolName:r[1],index:r.index,parenIndex:r.index+r[0].length-1});for(let p=0;p<o.length;p++){let s=o[p],w=p+1<o.length?o[p+1].index:t.length,_=t.substring(s.index,w),Le=_.indexOf("("),v=Le!==-1?_.substring(Le+1):"",N=0,P=null,z=!1;for(let M=0;M<v.length;M++){let $=v[M];if(P){if($===P){let xe=0;for(let ve=M-1;ve>=0&&v[ve]==="\\";ve--)xe++;xe%2===0&&(P=null)}}else if($==='"'||$==="'"||$==="`")P=$;else if($==="(")N++;else if($===")")if(N>0)N--;else{let xe=M+1;for(;xe<v.length&&/\s/.test(v[xe]);)xe++;if(xe<v.length&&v[xe]==="]"){z=!0;break}}}if(!z){let M=_.trim(),$="";P?$=`Unclosed quote string (${P}) inside arguments`:M.endsWith("]")?$=`Missing closing ')' before ']' (e.g. found "...]")`:M.endsWith(")")?$=`Missing closing ']' after ')' (e.g. found "...)" instead of "...)]")`:!M.includes(")")&&!M.includes("]")?$="Missing closing delimiter ')]'":$="Malformed or unclosed call syntax (missing ')]')",n.push(`\u2022 [action:${s.toolName}(...)]: ${$}. Expected: [action:${s.toolName}(arg1="...", arg2="...")]`)}}let d=/(?:^|[^\w\[])(?:tool|action):(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/gi,l;for(;(l=d.exec(t))!==null;){let p=l[1],s=l.index+(l[0].indexOf(":")-(l[0].startsWith("action")||l[0].startsWith("tool")?0:1));(s>0?t[s-1]:"")!=="["&&xi(p)&&n.push(`\u2022 action:${p}(...): Missing opening bracket '['. Expected: [action:${p}(...)]`)}let u=/\[\s*(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/g,g;for(;(g=u.exec(t))!==null;){let p=g[1];p!=="action"&&p!=="tool"&&xi(p)&&n.push(`\u2022 [${p}(...)]: Missing 'action:' prefix. Expected: [action:${p}(...)]`)}let h=/\[\s*(?:tool|action)\s*:\s*(?:functions\.)?([a-zA-Z0-9_]+)(?!\s*\()/gi,m;for(;(m=h.exec(t))!==null;){let p=m[1];xi(p)&&n.push(`\u2022 [action:${p}...]: Missing opening '(' for tool arguments. Expected: [action:${p}(...)]`)}return n.length>0?n.join(`
558
+ `):null},ef=(e,t={})=>{if(!e)return null;if(No=t,Ts=new ma({apiKey:e}),!globalThis.__perfCleanupInstalled){globalThis.__perfCleanupInstalled=!0,setInterval(()=>{typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks())},6e4);let n=globalThis.fetch;globalThis.fetch=async(...i)=>{try{let o=await n(...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}}}},xa=e=>{if(!e)return{serviceTier:void 0,cleanModel:e};let t=e.toLowerCase();return t.endsWith(":flex")?{serviceTier:"flex",cleanModel:e.slice(0,-5)}:t.endsWith(":priority")?{serviceTier:"priority",cleanModel:e.slice(0,-9)}:{serviceTier:void 0,cleanModel:e}},Il=async(e,t,n,i,o="Fast",r=.75,d="agent")=>vl(async()=>{let{aiProvider:l="Google",apiKey:u,mode:g}=e,h="",m=null,p=typeof n=="string"?[{role:"user",parts:[{text:n}]}]:n,s=new AbortController,w=s.signal,_=setInterval(()=>{ut&&(s.abort(),clearInterval(_))},100),Le=Date.now(),v=null;try{let N;if(l==="Ollama")N=(await ye("Ollama"))(u,t,p,i,o,g,nt(t),w,r,e.systemSettings?.ollamaEndpoint||"Cloud");else if(l==="OpenRouter")N=(await ye("OpenRouter"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="DeepSeek")N=(await ye("DeepSeek"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="Mistral")N=(await ye("Mistral"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="NVIDIA")N=(await ye("NVIDIA"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="InferX")N=(await ye("InferX"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="SenseNova")N=(await ye("SenseNova"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="AIHubMix")N=(await ye("AIHubMix"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="Poolside")N=(await ye("Poolside"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="9router"||l==="9Router")N=(await ye("NineRouter"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="ExpLabs"||l==="ExperientialLabs")N=(await ye("ExpLabs"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="Infron"||l==="infron")N=(await ye("Infron"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="TokenHarbor"||l==="Token Harbor"||l==="tokenharbor"||l==="token_harbor"||l==="thk")N=(await ye("TokenHarbor"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="APInex"||l==="apinex"||l==="apx")N=(await ye("APInex"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="xKiro"||l==="xkiro"||l==="kiro")N=(await ye("xKiro"))(u,t,p,i,o,g,nt(t),w,r);else if(l==="c_openai"||l==="Custom (OpenAI)"){let P=e.systemSettings?.customOpenAIBaseUrl||"";try{P=await Wi("c_openai")||P}catch{}N=(await ye("c_openai"))(u,t,p,i,o,g,nt(t),w,r,P)}else{let P=ha(u),{serviceTier:z,cleanModel:M}=xa(t),$={systemInstruction:i,temperature:r,thinkingConfig:(()=>{let ve=(t||"").toLowerCase(),Ie=ve.includes("gemma-4")||ve.startsWith("gemma"),Je=ve.includes("gemini-3");if(Ie||Je)return Ie?o.toLowerCase()!=="xhigh"?{includeThoughts:!1,thinkingLevel:Ye.MINIMAL}:{includeThoughts:!0,thinkingLevel:Ye.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:ve.includes("pro")?Ye.LOW:Ye.MINIMAL,Low:Ye.LOW,Medium:Ye.MEDIUM,Standard:Ye.MEDIUM,High:Ye.HIGH,xHigh:Ye.HIGH}[o]||Ye.MEDIUM};{let U={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[o]||2048;return U===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:U}}})()};z&&($.serviceTier=z),N=await P.models.generateContentStream({model:M,contents:p,config:$},{signal:w})}for await(let P of N){if(ut)throw new Error("Subagent task was cancelled.");if(e?.taskId&&typeof Nt<"u"){let $=Nt.find(xe=>xe.id===e.taskId);if($&&$.status==="cancelled")throw new Error("Subagent task was cancelled.")}v===null&&(P.candidates?.[0]?.content?.parts||P.text)&&(v=Date.now()-Le);let z="";if(P.candidates?.[0]?.content?.parts)for(let $ of P.candidates[0].content.parts)$.text&&!$.thought&&(h+=$.text,z+=$.text);let M=z?Hi(z):0;e&&typeof e.onTokenChunk=="function"&&e.onTokenChunk(z,M),P.usageMetadata&&(m=P.usageMetadata)}}finally{clearInterval(_)}if(m){let N=m.totalTokenCount||0,P=m.cachedContentTokenCount||0,z=(m.candidatesTokenCount||0)+(l==="Google"&&m.thoughtsTokenCount||0);await dn("tokens",N,l,t),P>0&&await dn("cachedTokens",P,l,t),z>0&&await dn("candidateTokens",z,l,t),v!==null&&v>0&&await dn("ttft",v,l,t),oi({provider:l,model:t,prompt:m.promptTokenCount||0,cached:P,output:z,reasoning:m.thoughtsTokenCount||0,ttft:v}),e&&typeof e.onUsage=="function"&&e.onUsage({totalTokenCount:N,cachedContentTokenCount:P,candidatesTokenCount:z})}return await vt("agent",l),{text:h,usageMetadata:m}}),tf=async function*(e,t,n,i,o){let{profile:r,thinkingLevel:d,mode:l,janitorModel:u,chatId:g,isPlayground:h,systemSettings:m,sessionStats:p,aiProvider:s="Google",apiTier:w,wildcardTooling:_,wildercardTooling:Le}=n,v=nt(e);if(!Ts&&s==="Google")throw new Error("AI not initialized");let N=!1,P=t[t.length-1].text,z=V.join(Us,"chat-summaries.json"),M=!1,$=t.filter(U=>U.role==="user").length===1,xe=P.includes("[TITLE-UPDATE]"),ve=$||xe,Ie=P.replace(/\[TITLE-UPDATE\]/g,"").trim();Ie=Ie.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),yield{type:"status",content:"[start]"},yield{type:"status",content:"Gathering Context"},await ii.startTransaction(g,Ie),m?.advanceRollback&&await ko.takeInitialSnapshot(g),ut=!1;let Je=null;try{let U=new AbortController;Je=setInterval(()=>{ut&&(U.abort(),Je&&(clearInterval(Je),Je=null))},400);let x=[...t.slice(0,-1)];{let ge=cn(z,{})[g]||{summary:"",historyLength:0};if(ge.summary&&ge.historyLength>0){let ht=0,ce=[];for(let q=0;q<x.length;q++){let be=x[q];(be.role==="user"||be.role==="agent"||be.role==="system")&&!String(be.id).startsWith("welcome")&&!be.isMeta&&ht++,ht>ge.historyLength&&ce.push(be)}x=ce}}x=x.map(b=>{if(b.role==="user"&&b.text){let ge=b.text.match(/\[USER\]([\s\S]*?)\[\/USER\]/);if(ge)return{...b,text:ge[1].trim()}}return{...b}});let zt=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")&&zt&&(Fe=16e3),(p?.tokens||0)>Fe){yield{type:"text",content:"\u2726 Maximum Context Limit Reached. Start a new chat."};return}if($&&N){let b=cn(Ni,{});Object.values(b).flat().length>5}let ae=cn(Ni,{}),on=cn(Gs,{}),Vn=Object.entries(ae).filter(([b])=>b!==g).flatMap(([b,ge])=>ge),Bo=[...Object.entries(on).filter(([b])=>b!==g).slice(-20).map(([b,ge])=>`[Chat Summary]: ${ge}`),...Vn].map(b=>`- ${b}`).join(`
559
+ `),Pn=cn(Zo,[]).map(b=>`- ${b.memory}`).join(`
560
+ `),zn=(p?.tokens||0)>=1e4,Yt=new Date,$n=Yt.getFullYear(),Re=Yt.toLocaleString("en-US",{month:"short"}).toUpperCase(),qn=String(Yt.getDate()).padStart(2,"0"),Q=`${Yt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0})}`,B=b=>{try{return Ce.readdirSync(b,{withFileTypes:!0})}catch{return[]}},Xn=Array.from(new Set([...bo,...So(process.cwd())])),pt=(b,ge=6)=>m?.indentationTree!==!1?hs(b,ge,1,B,Xn):xs(b,ge,"",1,B,Xn),A=cn(Fi,{}),oe=A[g],Xt=oe?oe!==process.cwd():!1;A[g]=process.cwd(),Bi(Fi,A);let Bt=cn(z,{}),kt=Bt[g]||{summary:"",historyLength:0};typeof kt=="string"&&(kt={summary:kt,historyLength:0});let Ln=t.filter(b=>(b.role==="user"||b.role==="agent"||b.role==="system")&&!String(b.id).startsWith("welcome")&&!b.isMeta).length;kt.historyLength&&Ln<kt.historyLength&&(kt.summary="",kt.historyLength=0,Bt[g]=kt,Bi(z,Bt));let Uo=typeof kt=="object"?kt.summary||"":kt||"",As=x.length>0;As&&Uo&&x[0]&&(x[0].role==="user"||x[0].role==="system")&&(x[0].text.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")||(x[0].text=`[SYSTEM METADATA]
561
561
  **CONTEXT SUMMARY OF PREVIOUS TURNS (PRIORITY: DYNAMIC)**
562
- ${Wo}
562
+ ${Uo}
563
563
 
564
- [USER] ${x[0].text}`,yield{type:"summary_injected",content:{id:x[0].id,text:x[0].text}}));let Ai=Wo&&!Ts?`
564
+ [USER] ${x[0].text}`,yield{type:"summary_injected",content:{id:x[0].id,text:x[0].text}}));let Ci=Uo&&!As?`
565
565
  [SYSTEM METADATA]
566
566
  **CONTEXT SUMMARY OF PREVIOUS TURNS**
567
- ${Wo}
568
- `:"",As=!!m?.dynamicDirAwareness,xa=`${g}|${s}|${d}|${e}|${r}|${As}`,wa=!As&&jn.key===xa&&jn.value?"":`
567
+ ${Uo}
568
+ `:"",Cs=!!m?.dynamicDirAwareness,wa=`${g}|${s}|${d}|${e}|${r}|${Cs}`,ba=!Cs&&jn.key===wa&&jn.value?"":`
569
569
  **Directory**
570
570
  CWD: `+process.cwd()+`${h?" [PLAYGROUND MODE]":""}
571
- `+pt(process.cwd(),6),Et=ro()?await Hn():null,Cs=b=>{if(!b||!Array.isArray(b)||b.length===0)return null;let ge=new Map;for(let ce of b){let q=ce.relPath||(ce.file?V.relative(process.cwd(),ce.file):"unknown");ge.has(q)||ge.set(q,[]),ge.get(q).push(ce)}let ht=[];for(let[ce,q]of ge.entries()){ht.push(`- ${ce}:`);for(let be of q){let Me=(be.snippet||"").trim().replace(/\r?\n/g," "),Qe=be.line||1,$t=(be.text||"").trim().replace(/\r?\n+/g,". "),yt=$t?` [${$t}]`:"";ht.push(` ~L${Qe}${yt}`)}}return ht.join(`
572
- `)},Ci=Cs(Et?.comments),gn="";if(Et&&Et.file_focused!=="none"){gn=`
571
+ `+pt(process.cwd(),6),Et=lo()?await Hn():null,vs=b=>{if(!b||!Array.isArray(b)||b.length===0)return null;let ge=new Map;for(let ce of b){let q=ce.relPath||(ce.file?V.relative(process.cwd(),ce.file):"unknown");ge.has(q)||ge.set(q,[]),ge.get(q).push(ce)}let ht=[];for(let[ce,q]of ge.entries()){ht.push(`- ${ce}:`);for(let be of q){let Me=(be.snippet||"").trim().replace(/\r?\n/g," "),Qe=be.line||1,$t=(be.text||"").trim().replace(/\r?\n+/g,". "),yt=$t?` [${$t}]`:"";ht.push(` ~L${Qe}${yt}`)}}return ht.join(`
572
+ `)},vi=vs(Et?.comments),gn="";if(Et&&Et.file_focused!=="none"){gn=`
573
573
  [Additional IDE Context]
574
574
  `;let b=V.relative(process.cwd(),Et.file_focused),ge=(Et.opened_editors||[]).map(ce=>{let q=V.relative(process.cwd(),ce);return q.startsWith("..")?`[External] ${V.basename(ce)}`:q});if(gn+=`Focused File: ${b}
575
575
  Cursor Line: ${Et.cursor_line}
@@ -591,23 +591,23 @@ ${Et.diagnostics}
591
591
  `),(Ie.toLowerCase().includes("lint")||Ie.toLowerCase().includes("warning"))&&Et.warnings&&(gn+=`
592
592
  **Lint Warnings**:
593
593
  ${Et.warnings}
594
- `)}let vs=Ie.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),Rs=/(?:\\)?@\[([^\]]+)\]/g,vi,Ri=[];for(Rs.lastIndex=0;(vi=Rs.exec(vs))!==null;){let b=vi[0].startsWith("\\");Ri.push({tag:vi[1],isEscaped:b})}let Ei=[],Uo=null,Go=!1;for(let b=0;b<Ri.length;b++){let{tag:ge,isEscaped:ht}=Ri[b];if(!ht)try{let ce=ge.trim().replace(/^["']|["']$/g,""),q=/[:#]L?(\d+)(?:-L?(\d+))?$/i,be=ce.match(q),Me=ce,Qe=null,$t=null;be&&(Qe=parseInt(be[1],10),$t=be[2]?parseInt(be[2],10):Qe,Me=ce.slice(0,be.index));let yt=V.resolve(process.cwd(),Me);if(Ce.existsSync(yt)&&Ce.statSync(yt).isFile()){let Lt=Me.toLowerCase(),lo=Lt.endsWith(".pdf"),Dn=Lt.endsWith(".docx")||Lt.endsWith(".doc")||Lt.endsWith(".ppt")||Lt.endsWith(".pptx")||Lt.endsWith(".xls")||Lt.endsWith(".xlsx"),Nn=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(Lt),je=Nn||lo||Dn,Tt=s==="Google"||nt(e);if(je&&!Tt){let pe=`\u2718 Unsupported Modality: ${V.basename(Me)}`,Xe=115;process.stdout.isTTY&&(Xe=process.stdout.columns-5||120);let At=[pe],Oe=Math.max(...At.map(Zt=>Zt.length)),ee=Math.min(Oe+4,Xe),We=At.map(Zt=>`${Zt.padEnd(ee-2).substring(0,ee-2)}`).join(`
594
+ `)}let Rs=Ie.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),Es=/(?:\\)?@\[([^\]]+)\]/g,Ri,Ei=[];for(Es.lastIndex=0;(Ri=Es.exec(Rs))!==null;){let b=Ri[0].startsWith("\\");Ei.push({tag:Ri[1],isEscaped:b})}let _i=[],Go=null,Ho=!1;for(let b=0;b<Ei.length;b++){let{tag:ge,isEscaped:ht}=Ei[b];if(!ht)try{let ce=ge.trim().replace(/^["']|["']$/g,""),q=/[:#]L?(\d+)(?:-L?(\d+))?$/i,be=ce.match(q),Me=ce,Qe=null,$t=null;be&&(Qe=parseInt(be[1],10),$t=be[2]?parseInt(be[2],10):Qe,Me=ce.slice(0,be.index));let yt=V.resolve(process.cwd(),Me);if(Ce.existsSync(yt)&&Ce.statSync(yt).isFile()){let Lt=Me.toLowerCase(),fo=Lt.endsWith(".pdf"),Dn=Lt.endsWith(".docx")||Lt.endsWith(".doc")||Lt.endsWith(".ppt")||Lt.endsWith(".pptx")||Lt.endsWith(".xls")||Lt.endsWith(".xlsx"),Nn=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(Lt),je=Nn||fo||Dn,Tt=s==="Google"||nt(e);if(je&&!Tt){let pe=`\u2718 Unsupported Modality: ${V.basename(Me)}`,Xe=115;process.stdout.isTTY&&(Xe=process.stdout.columns-5||120);let At=[pe],Oe=Math.max(...At.map(Zt=>Zt.length)),ee=Math.min(Oe+4,Xe),We=At.map(Zt=>`${Zt.padEnd(ee-2).substring(0,ee-2)}`).join(`
595
595
  `);yield{type:"visual_feedback",content:Rt(`${We}
596
596
  `)};continue}if(Qe===null&&!je){let pe=0;try{pe=Ce.readFileSync(yt,"utf8").split(/\r\n|\r|\n/).length}catch{}if(pe>150){let Xe=`\u21B7 Skipped (Too Large): ${V.basename(Me)}`,At=115;process.stdout.isTTY&&(At=process.stdout.columns-5||120);let Oe=Math.min(Xe.length+4,At),ee=Xe.padEnd(Oe-2).substring(0,Oe-2);yield{type:"visual_feedback",content:Rt(`${ee}
597
597
  `)};continue}}let Sn=Qe!==null?Qe:1,Ot=$t!==null?$t:Qe!==null?Qe:Sn+149;if(Ot-Sn>200){let pe=`\u21B7 Skipped (Too Large): ${V.basename(Me)}`,Xe=115;process.stdout.isTTY&&(Xe=process.stdout.columns-5||120);let At=Math.min(pe.length+4,Xe),Oe=pe.padEnd(At-2).substring(0,At-2);yield{type:"visual_feedback",content:Rt(`${Oe}
598
- `)};continue}let Fn=`path=${JSON.stringify(Me)}, startLine=${Sn}, endLine=${Ot}`,Dt=await Js(Fn,{isMultiModal:Tt}),kn=!1,Qn="",gt=null;if(typeof Dt=="string"?Dt.trim().startsWith("ERROR")?kn=!0:Qn=Dt:Dt&&typeof Dt=="object"&&Dt.binaryPart?(gt=Dt.binaryPart,Qn=Dt.text||""):kn=!0,!kn){let pe="";if(Nn?(pe=`\u2714 Processed: ${V.basename(Me)}`,Uo=gt,Go=!0):lo||Dn?(pe=`\u2714 Auto-Analysed: ${V.basename(Me)}`,Uo=gt,Go=!0):(pe=`\u2714 Auto-Read: ${V.basename(Me)}`,Ei.push(Qn)),pe){let Xe=115;process.stdout.isTTY&&(Xe=process.stdout.columns-5||120);let At=[pe],Oe=Math.max(...At.map(Zt=>Zt.length)),ee=Math.min(Oe+4,Xe),We=At.map(Zt=>`${Zt.padEnd(ee-2).substring(0,ee-2)}`).join(`
598
+ `)};continue}let Fn=`path=${JSON.stringify(Me)}, startLine=${Sn}, endLine=${Ot}`,Dt=await Qs(Fn,{isMultiModal:Tt}),kn=!1,Qn="",gt=null;if(typeof Dt=="string"?Dt.trim().startsWith("ERROR")?kn=!0:Qn=Dt:Dt&&typeof Dt=="object"&&Dt.binaryPart?(gt=Dt.binaryPart,Qn=Dt.text||""):kn=!0,!kn){let pe="";if(Nn?(pe=`\u2714 Processed: ${V.basename(Me)}`,Go=gt,Ho=!0):fo||Dn?(pe=`\u2714 Auto-Analysed: ${V.basename(Me)}`,Go=gt,Ho=!0):(pe=`\u2714 Auto-Read: ${V.basename(Me)}`,_i.push(Qn)),pe){let Xe=115;process.stdout.isTTY&&(Xe=process.stdout.columns-5||120);let At=[pe],Oe=Math.max(...At.map(Zt=>Zt.length)),ee=Math.min(Oe+4,Xe),We=At.map(Zt=>`${Zt.padEnd(ee-2).substring(0,ee-2)}`).join(`
599
599
  `);yield{type:"visual_feedback",content:Rt(`${We}
600
- `)}}}}}catch{}}let Ho="";Ei.length>0?Ho=`
601
- [Tagged File Contents] Auto Read User Tagged files by System${Go?", attached below & multimodal part":""}. No need to re-read
602
- `+Ei.join(`
600
+ `)}}}}}catch{}}let jo="";_i.length>0?jo=`
601
+ [Tagged File Contents] Auto Read User Tagged files by System${Ho?", attached below & multimodal part":""}. No need to re-read
602
+ `+_i.join(`
603
603
 
604
604
  `)+`
605
605
  [Tagged File Contents]
606
- `:Go&&(Ho=`
606
+ `:Ho&&(jo=`
607
607
  [Tagged File Contents] Auto Read User Tagged files by System & attached as multimodal part. No need to re-read [Tagged File Contents]
608
- `);let Be=vs.replace(/\\(@\[[^\]]+\])/g,"$1"),Es=_?`You cannot execute tools. Instead write the action string in chat you WOULD have written, without markdown wrappers. Then wait for systtem response
609
- `:"",ba=process.env.forcedReasoning||!1,_s=d!=="Fast"&&(s==="Mistral"&&!ei(e)||d!=="High"&&s==="Google")?`${s==="Mistral"&&!ei(e)||e.toLowerCase().startsWith("gemma")||ba?`[system] strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow> [/system]
610
- `:""}`:"",Jn="";if(m?.clipboardContext)try{process.platform==="win32"?Jn=xs("powershell.exe -NoProfile -Command Get-Clipboard",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):process.platform==="darwin"?Jn=xs("pbpaste",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):Jn=xs("xclip -selection clipboard -o || xsel --clipboard --output",{encoding:"utf8",shell:!0,stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,"")}catch{Jn=""}let jo="",Sa=!!m?.autoExcludeMetadata,Is=!1,Ms=!1,_i="";if(Be.startsWith("/skill create ")||Be==="/skill create"){let b=null;Is=!0,Be=Be.replace(/^\/skill\s+create\b/,"").trim(),/^--project(\s|$)|(\s|^)--project$/.test(Be)?b="project":/^--global(\s|$)|(\s|^)--global$/.test(Be)&&(b="global"),Be=Be.replace(/^--project\s*|\s*--project$/g,"").trim(),Be=Be.replace(/^--global\s*|\s*--global$/g,"").trim(),Be=Be.replace(/^(['"])([\s\S]*)\1$/,"$2").trim(),_i=`[system] ## Skill Creation Rules
608
+ `);let Be=Rs.replace(/\\(@\[[^\]]+\])/g,"$1"),_s=_?`You cannot execute tools. Instead write the action string in chat you WOULD have written, without markdown wrappers. Then wait for systtem response
609
+ `:"",Sa=process.env.forcedReasoning||!1,Is=d!=="Fast"&&(s==="Mistral"&&!ti(e)||d!=="High"&&s==="Google")?`${s==="Mistral"&&!ti(e)||e.toLowerCase().startsWith("gemma")||Sa?`[system] strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow> [/system]
610
+ `:""}`:"",Jn="";if(m?.clipboardContext)try{process.platform==="win32"?Jn=ws("powershell.exe -NoProfile -Command Get-Clipboard",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):process.platform==="darwin"?Jn=ws("pbpaste",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):Jn=ws("xclip -selection clipboard -o || xsel --clipboard --output",{encoding:"utf8",shell:!0,stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,"")}catch{Jn=""}let Ko="",ka=!!m?.autoExcludeMetadata,Ms=!1,Ps=!1,Ii="";if(Be.startsWith("/skill create ")||Be==="/skill create"){let b=null;Ms=!0,Be=Be.replace(/^\/skill\s+create\b/,"").trim(),/^--project(\s|$)|(\s|^)--project$/.test(Be)?b="project":/^--global(\s|$)|(\s|^)--global$/.test(Be)&&(b="global"),Be=Be.replace(/^--project\s*|\s*--project$/g,"").trim(),Be=Be.replace(/^--global\s*|\s*--global$/g,"").trim(),Be=Be.replace(/^(['"])([\s\S]*)\1$/,"$2").trim(),Ii=`[system] ## Skill Creation Rules
611
611
  * ${b?b==="project"?`Creation path: ./skills/skillName?/SKILL.md
612
612
  * If skills folder already present, ReadFolder for existing structure`:"Creation path: ~/.fluxflow/skills/skillName/SKILL.md":`Extract skill scope, global/project. If not given AskUser. Project scope: ./skills/skillName?/SKILL.md. Global scope: ~/.fluxflow/skills/skillName/SKILL.md
613
613
  * If skills folder already present, ReadFolder for existing structure`}
@@ -624,7 +624,7 @@ description: concise detail to explain the skill
624
624
  * After creation, tell user to restart fluxflow for reindexing${(p?.tokens||0)>24576?`
625
625
  * Warn: This session is currently long, and reindexing will cause full cache invalidation`:""}
626
626
  [/system]
627
- `}else if(Be.startsWith("/skill edit ")||Be==="/skill edit"){Ms=!0,Be=Be.replace(/^\/skill\s+edit\b/,"").trim();let b=null,ge=Be.match(/^--([^\s]+)(?:\s|$)/);if(ge)b=ge[1],Be=Be.slice(ge[0].length).trim();else{let q=Be.match(/(?:\s|^)--([^\s]+)$/);q&&(b=q[1],Be=Be.slice(0,q.index).trim())}Be=Be.replace(/^(['"])([\s\S]*)\1$/,"$2").trim();let ht=null,ce=null;if(b){let q=b.toLowerCase(),be=[...di||[],...ci||[]].find(Me=>Me&&Me.name&&Me.name.toLowerCase()===q);be&&be.filePath&&(ce=V.resolve(be.filePath),ht=V.dirname(ce))}_i=`[system] ## Skill Modification Rules
627
+ `}else if(Be.startsWith("/skill edit ")||Be==="/skill edit"){Ps=!0,Be=Be.replace(/^\/skill\s+edit\b/,"").trim();let b=null,ge=Be.match(/^--([^\s]+)(?:\s|$)/);if(ge)b=ge[1],Be=Be.slice(ge[0].length).trim();else{let q=Be.match(/(?:\s|^)--([^\s]+)$/);q&&(b=q[1],Be=Be.slice(0,q.index).trim())}Be=Be.replace(/^(['"])([\s\S]*)\1$/,"$2").trim();let ht=null,ce=null;if(b){let q=b.toLowerCase(),be=[...fi||[],...di||[]].find(Me=>Me&&Me.name&&Me.name.toLowerCase()===q);be&&be.filePath&&(ce=V.resolve(be.filePath),ht=V.dirname(ce))}Ii=`[system] ## Skill Modification Rules
628
628
  ${ht&&b?`* Target Skill: ${b}
629
629
  * Physical Skill path: ${ce}
630
630
  * Skill will have a SKILL.md at this path. And may have lazy loaded *.md files in folders
@@ -634,20 +634,20 @@ ${ht&&b?`* Target Skill: ${b}
634
634
  * After completion tell user no reindexing needed, will be auto updated on next #skill read if frontmatter stays same${(p?.tokens||0)>24576?`
635
635
  * Warn: This session is currently long, if name, description is changed reindex is needed, and will cause a full cache invalidation`:""}`:"- User didnt provided any structured skill name to modify. Tell them to use proper syntax: `/skill edit --skillName instructions`"}
636
636
  [/system]
637
- `}let ka=!!(gn||Ho||Es||Ai||_s||Xt||m?.dynamicDirAwareness||m?.autoTruncateResults||Is||Ms);Sa&&!ka?jo=Be.trim():jo=`[System Metadata] Time: ${Q}${Xt?`
637
+ `}let Ta=!!(gn||jo||_s||Ci||Is||Xt||m?.dynamicDirAwareness||m?.autoTruncateResults||Ms||Ps);ka&&!Ta?Ko=Be.trim():Ko=`[System Metadata] Time: ${Q}${Xt?`
638
638
  WARNING: CWD Changed from previous: "${oe}" to current: "${process.cwd()}", write change in chat to avoid future path mismatches
639
639
  `:""}${gn}
640
640
  ${Jn.trim().length>0?`[Clipboard Context]
641
641
  - ${Jn.trim()}
642
- `:""}${Ci?`[Additional Comments]
643
- ${Ci.trimEnd()}
642
+ `:""}${vi?`[Additional Comments]
643
+ ${vi.trimEnd()}
644
644
  `:""}Action format: [action:ActionName(...)]
645
645
  [/Metadata]
646
- ${Ai}${_s}${Ho}${_i}${Es}[user prompt] ${Be.trim()} [/user prompt]`.trim();let Ps={role:"user",text:jo};Uo&&(Ps.binaryPart=Uo),x.forEach(b=>{b.text&&b.role==="agent"&&(b.text=Ft(b.text))}),x.push(Ps),Ai&&t[t.length-1]?.id&&(yield{type:"summary_injected",content:{id:t[t.length-1].id,text:jo}});let Jt=null,Qt=l==="Flux"?50:15;Qt=l.toLowerCase().includes("cu")?75:Qt;let $s=(m?.loopLimits||"Default").toLowerCase();if($s==="extended")Qt=Math.floor(Qt*3);else if($s==="env"){let b=parseInt(process.env.FLUXFLOW_MAX_LOOPS||process.env.MAX_LOOPS||"",10);Number.isFinite(b)&&b>0&&(Qt=b)}let Ta=Math.floor(Qt/2),Ls=0,sn=16;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Consulting the spirits":"Connecting"},ut=!1;let Ii=[],Ko=!1,Os=!1,On=[],Mi=!1;for(let b=0;b<=Qt;b++){let ge=Math.floor(Qt*.95);if(b>=ge&&Ls<ge&&typeof n?.onAskUser=="function"){Ls=ge;try{let W="Agent has been running for a long time. Do you want to continue execution?",Y=[{id:"continue",label:"Continue",description:"Add few more steps"},{id:"cancel",label:"Cancel",description:"Stop extending and finish current turn limit"}],E=await n.onAskUser(W,Y);E&&(E.toLowerCase().includes("continue")||E==="Continue")&&(Qt+=Ta)}catch{}}if(On.length>=10&&typeof n?.onAskUser=="function"){let W={},Y=null;for(let E of On)if(W[E]=(W[E]||0)+1,W[E]>=10){Y=E;break}if(Y)try{let E="Agent seems stuck in a tool loop. You can prompt it to steer or break the loop:",st=[{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"}],de=await n.onAskUser(E,st);if(de){let Ue="";typeof de=="string"&&(de.toLowerCase()==="stop"||de.includes("Stop Loop"))?Ue="Stop repeating the same action call. Acknowledge what failed or succeeded, summarize your current findings, and conclude.":typeof de=="string"&&(de.toLowerCase()==="continue"||de.includes("Continue Anyway"))?On=On.filter(xt=>xt!==Y):Ue=typeof de=="string"?de:de?.label||de?.id||"",Ue&&(x.length>0&&x[x.length-1].role==="user"?x[x.length-1].text+=`
646
+ ${Ci}${Is}${jo}${Ii}${_s}[user prompt] ${Be.trim()} [/user prompt]`.trim();let $s={role:"user",text:Ko};Go&&($s.binaryPart=Go),x.forEach(b=>{b.text&&b.role==="agent"&&(b.text=Ft(b.text))}),x.push($s),Ci&&t[t.length-1]?.id&&(yield{type:"summary_injected",content:{id:t[t.length-1].id,text:Ko}});let Jt=null,Qt=l==="Flux"?50:15;Qt=l.toLowerCase().includes("cu")?75:Qt;let Ls=(m?.loopLimits||"Default").toLowerCase();if(Ls==="extended")Qt=Math.floor(Qt*3);else if(Ls==="env"){let b=parseInt(process.env.FLUXFLOW_MAX_LOOPS||process.env.MAX_LOOPS||"",10);Number.isFinite(b)&&b>0&&(Qt=b)}let Aa=Math.floor(Qt/2),Os=0,sn=16;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Consulting the spirits":"Connecting"},ut=!1;let Mi=[],Vo=!1,Ds=!1,On=[],Pi=!1;for(let b=0;b<=Qt;b++){let ge=Math.floor(Qt*.95);if(b>=ge&&Os<ge&&typeof n?.onAskUser=="function"){Os=ge;try{let W="Agent has been running for a long time. Do you want to continue execution?",Y=[{id:"continue",label:"Continue",description:"Add few more steps"},{id:"cancel",label:"Cancel",description:"Stop extending and finish current turn limit"}],E=await n.onAskUser(W,Y);E&&(E.toLowerCase().includes("continue")||E==="Continue")&&(Qt+=Aa)}catch{}}if(On.length>=10&&typeof n?.onAskUser=="function"){let W={},Y=null;for(let E of On)if(W[E]=(W[E]||0)+1,W[E]>=10){Y=E;break}if(Y)try{let E="Agent seems stuck in a tool loop. You can prompt it to steer or break the loop:",st=[{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"}],de=await n.onAskUser(E,st);if(de){let Ue="";typeof de=="string"&&(de.toLowerCase()==="stop"||de.includes("Stop Loop"))?Ue="Stop repeating the same action call. Acknowledge what failed or succeeded, summarize your current findings, and conclude.":typeof de=="string"&&(de.toLowerCase()==="continue"||de.includes("Continue Anyway"))?On=On.filter(xt=>xt!==Y):Ue=typeof de=="string"?de:de?.label||de?.id||"",Ue&&(x.length>0&&x[x.length-1].role==="user"?x[x.length-1].text+=`
647
647
 
648
- [STEERING HINT from USER, High Priority] ${Ue.trim()} [/STEERING HINT]`:x.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${Ue.trim()} [/STEERING HINT]`}),yield{type:"status",content:"Steering Hint Injected..."},On=On.filter(xt=>xt!==Y))}}catch{}}let ht=await Gi("agent",n);if(!ht.allowed)throw new Error(ht.reason||`Budget Exhausted for Provider (${s||"Agent"})`);let ce=[];if(Ko=!1,(l==="ICU"||l==="FluxCU")&&!Mi)try{yield{type:"status",content:"Capturing Screen"},await new Promise(E=>setTimeout(E,1e3));let{captureGriddedScreenshot:W}=await import("./screen_grid-LK6IVH4B.js"),Y=await W();if(Y&&Y.base64){let E="[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]",st={inlineData:{mimeType:Y.mimeType,data:Y.base64}},de=m?.imageHistoryCU||"Standard",Ue=de==="Low"?3:de==="Extended"?10:de==="Max"?999:5,xt=x.filter(me=>Array.isArray(me.parts)&&me.parts.some(mt=>mt.inlineData));if(xt.length>=Ue){let me=xt.length-Ue+1;for(let mt=0;mt<me;mt++){let Ze=xt[mt];Array.isArray(Ze.parts)&&(Ze.parts=Ze.parts.filter(rt=>!rt.inlineData))}}if(x.length>0&&x[x.length-1].role==="user"){let me=x[x.length-1];typeof me.text=="string"&&(me.text+=`
648
+ [STEERING HINT from USER, High Priority] ${Ue.trim()} [/STEERING HINT]`:x.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${Ue.trim()} [/STEERING HINT]`}),yield{type:"status",content:"Steering Hint Injected..."},On=On.filter(xt=>xt!==Y))}}catch{}}let ht=await Gi("agent",n);if(!ht.allowed)throw new Error(ht.reason||`Budget Exhausted for Provider (${s||"Agent"})`);let ce=[];if(Vo=!1,(l==="ICU"||l==="FluxCU")&&!Pi)try{yield{type:"status",content:"Capturing Screen"},await new Promise(E=>setTimeout(E,1e3));let{captureGriddedScreenshot:W}=await import("./screen_grid-LK6IVH4B.js"),Y=await W();if(Y&&Y.base64){let E="[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]",st={inlineData:{mimeType:Y.mimeType,data:Y.base64}},de=m?.imageHistoryCU||"Standard",Ue=de==="Low"?3:de==="Extended"?10:de==="Max"?999:5,xt=x.filter(me=>Array.isArray(me.parts)&&me.parts.some(mt=>mt.inlineData));if(xt.length>=Ue){let me=xt.length-Ue+1;for(let mt=0;mt<me;mt++){let Ze=xt[mt];Array.isArray(Ze.parts)&&(Ze.parts=Ze.parts.filter(rt=>!rt.inlineData))}}if(x.length>0&&x[x.length-1].role==="user"){let me=x[x.length-1];typeof me.text=="string"&&(me.text+=`
649
649
 
650
- ${E}`,Array.isArray(me.parts)||(me.parts=[{text:me.text}]),me.parts.push(st))}else x.push({role:"user",text:E,parts:[{text:E},st]})}}catch(W){console.error("Vision screenshot capture error:",W)}if(Mi=!1,b>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"},ut){try{let{clearPendingNudges:W}=await import("./subagent_state-LZCOZSUJ.js");W()}catch{}yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
650
+ ${E}`,Array.isArray(me.parts)||(me.parts=[{text:me.text}]),me.parts.push(st))}else x.push({role:"user",text:E,parts:[{text:E},st]})}}catch(W){console.error("Vision screenshot capture error:",W)}if(Pi=!1,b>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"},ut){try{let{clearPendingNudges:W}=await import("./subagent_state-LZCOZSUJ.js");W()}catch{}yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
651
651
 
652
652
  \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}try{let{consumePendingNudges:W}=await import("./subagent_state-LZCOZSUJ.js"),Y=W();if(Y&&Y.length>0){let E=Y.join(`
653
653
 
@@ -659,7 +659,7 @@ ${E}`:x.push({role:"user",text:E}),yield{type:"status",content:"Subagent Update"
659
659
  [question] ${W.replace("/btw","").trim()} [/question]`:x.push({role:"user",text:`[system] User question. Resolve this specific query within '[ANSWER]...[/ANSWER]' concisely, naturally [/system]
660
660
  [question] ${W.replace("/btw","").trim()} [/question]`}):x.length>0&&x[x.length-1].role==="user"?x[x.length-1].text+=`
661
661
 
662
- [STEERING HINT from USER, High Priority] ${W.trim()} [/STEERING HINT]`:x.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${W.trim()} [/STEERING HINT]`}),yield{type:"status",content:`${W.startsWith("/btw")?"Question Forwarded...":"Steering Hint Injected..."}`})}let q,be=!1,Me=1,Qe=1,$t=Date.now(),yt=null,we="",Lt=null,lo=null,Dn=null,Nn=0,je=[],Tt=0,Sn=!1,Ot=!1,Fn=!1,Dt=!1,kn=!0,Qn=0,gt="",pe="",Xe=!1,At=!1,Oe=!0,ee=e,We="",Zt=d;for(d=d.toLowerCase()==="max"?"High":d;Me<=sn&&Qe<=sn&&!be&&!ut;){let W=!1;try{we="",kn&&(process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07"),yield{type:"turn_reset",content:!0},kn=!1,Qe===1&&(gt=""));let Y=f=>{if(!f||typeof f!="string")return f;let S="",k=bs(f);if(k&&(S=k.fullBlock,f=k.remainingText),!f.includes("[tool:")&&!f.includes("[action:"))return(m?.keepReasoningContext?S:"")+f;if(Mn(f).length===0){let y=ki(f);return(m?.keepReasoningContext?S:"")+y}f=f.replace(Tl,(y,T)=>T.includes("[tool:")||T.includes("[action:")?T.trim():y);let ie="",I=0,H=[],ct="";for(;I<f.length;){let y=f.indexOf("[tool:",I),T=f.indexOf("[action:",I),te=-1;if(y!==-1&&T!==-1?te=Math.min(y,T):y!==-1?te=y:te=T,te===-1){H.length===0&&(ie+=ki(f.substring(I)));break}if((te>0?f[te-1]:"")==="`"){ie+=ki(f.substring(I,te+1)),I=te+1;continue}H.length===0&&(ct=ki(f.substring(I,te)));let X=-1,R=null,dt=0;for(let _t=te;_t<f.length;_t++){let ne=f[_t];if(R){if(ne===R){let Ve=0;for(let ft=_t-1;ft>=0&&f[ft]==="\\";ft--)Ve++;Ve%2===0&&(R=null)}}else if(ne==='"'||ne==="'"||ne==="`")R=ne;else if(ne==="(")dt++;else if(ne===")")dt--;else if(ne==="]"&&dt<=0){X=_t;break}}if(X===-1){H.length===0&&(ie+=f.substring(te));break}let pn=f.substring(te,X+1);H.push(pn),I=X+1}return H.length>0&&(ie=ct.trimEnd()?ct.trimEnd()+`
662
+ [STEERING HINT from USER, High Priority] ${W.trim()} [/STEERING HINT]`:x.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${W.trim()} [/STEERING HINT]`}),yield{type:"status",content:`${W.startsWith("/btw")?"Question Forwarded...":"Steering Hint Injected..."}`})}let q,be=!1,Me=1,Qe=1,$t=Date.now(),yt=null,we="",Lt=null,fo=null,Dn=null,Nn=0,je=[],Tt=0,Sn=!1,Ot=!1,Fn=!1,Dt=!1,kn=!0,Qn=0,gt="",pe="",Xe=!1,At=!1,Oe=!0,ee=e,We="",Zt=d;for(d=d.toLowerCase()==="max"?"High":d;Me<=sn&&Qe<=sn&&!be&&!ut;){let W=!1;try{we="",kn&&(process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07"),yield{type:"turn_reset",content:!0},kn=!1,Qe===1&&(gt=""));let Y=f=>{if(!f||typeof f!="string")return f;let S="",k=Ss(f);if(k&&(S=k.fullBlock,f=k.remainingText),!f.includes("[tool:")&&!f.includes("[action:"))return(m?.keepReasoningContext?S:"")+f;if(Mn(f).length===0){let y=Ti(f);return(m?.keepReasoningContext?S:"")+y}f=f.replace(Cl,(y,T)=>T.includes("[tool:")||T.includes("[action:")?T.trim():y);let ie="",I=0,H=[],ct="";for(;I<f.length;){let y=f.indexOf("[tool:",I),T=f.indexOf("[action:",I),te=-1;if(y!==-1&&T!==-1?te=Math.min(y,T):y!==-1?te=y:te=T,te===-1){H.length===0&&(ie+=Ti(f.substring(I)));break}if((te>0?f[te-1]:"")==="`"){ie+=Ti(f.substring(I,te+1)),I=te+1;continue}H.length===0&&(ct=Ti(f.substring(I,te)));let X=-1,R=null,dt=0;for(let _t=te;_t<f.length;_t++){let ne=f[_t];if(R){if(ne===R){let Ve=0;for(let ft=_t-1;ft>=0&&f[ft]==="\\";ft--)Ve++;Ve%2===0&&(R=null)}}else if(ne==='"'||ne==="'"||ne==="`")R=ne;else if(ne==="(")dt++;else if(ne===")")dt--;else if(ne==="]"&&dt<=0){X=_t;break}}if(X===-1){H.length===0&&(ie+=f.substring(te));break}let pn=f.substring(te,X+1);H.push(pn),I=X+1}return H.length>0&&(ie=ct.trimEnd()?ct.trimEnd()+`
663
663
 
664
664
  `+H.join(`
665
665
 
@@ -667,15 +667,15 @@ ${E}`:x.push({role:"user",text:E}),yield{type:"status",content:"Subagent Update"
667
667
 
668
668
  `)),(m?.keepReasoningContext?S:"")+ie},E=x.filter(f=>(f.role==="user"||f.role==="agent"||f.role==="system")&&!String(f.id).startsWith("welcome")&&!f.isMeta&&!f.isTerminalRecord&&!(f.text&&f.text.startsWith("[TERMINAL_RECORD]"))).map((f,S,k)=>{let G=f.text||"";N||(G=G.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),f.role==="agent"&&(G=Y(G),G=G.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),G=G.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*"));let ie=[];return Array.isArray(f.parts)&&f.parts.length>0?ie=f.parts.map(I=>{if(I.text){let H=I.text;return N||(H=H.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),f.role==="agent"&&(H=Y(H),H=H.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),H=H.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*")),{text:H}}return I}):ie=[{text:G}],f.binaryPart&&nt(ee)&&k.slice(S+1).filter(H=>H.role==="user"&&!H.text?.startsWith("[ACTION RESULT]")&&!H.text?.startsWith("[TOOL RESULT]")).length<=2&&ie.push(f.binaryPart),{role:f.role==="user"||f.role==="system"?"user":"model",parts:ie}});for(let f=E.length-2;f>=0;f--){let S=E[f],k=E[f+1];S.role==="user"&&k.role==="user"&&(k.parts?.[0]?.text||"").trim().startsWith("[SYSTEM")&&E.splice(f,1)}let st=[];for(let f=0;f<E.length;f++){let S=E[f];if(st.length===0)st.push(S);else{let k=st[st.length-1];k.role===S.role?(k.parts[0].text+=`
669
669
 
670
- `+(S.parts?.[0]?.text||""),S.parts?.length>1&&k.parts.push(...S.parts.slice(1))):st.push(S)}}for(let f of st)for(let S of f.parts||[])S&&typeof S.text=="string"&&(S.text.includes("[action:")||S.text.includes("[tool:"))&&(S.text=S.text.replace(/```(?:[a-zA-Z0-9_-]+)?\s*\n?(\[(?:action|tool):[\s\S]*?\)\s*\])\n?```/gi,"$1"),S.text=S.text.replace(/`(\[(?:action|tool):[\s\S]*?\)\s*\])`/gi,"$1"));E.length=0,E.push(...st),ee=e;let de=`${g}|${s}|${l}|${d}|${Zt}|${ee}|${JSON.stringify(r)}|${!!m?.dynamicDirAwareness}|${!!m?.subAgents}|${process.env.rawReasoning==="true"}`,Ue=jn.key===de&&jn.value;if((process.env.I_HAVE_TOO_MUCH_MONEY==="true"||process.env.I_HAVE_TOO_MUCH_MONEY===!0)&&(Ue=!1),Ue)We=jn.value;else{let f=s==="Mistral"?!!ei(ee):!(ee||"gemma").toLowerCase().startsWith("gemma");We=Lr(r,((ee||"gemma").toLowerCase().startsWith("gemma"),Zt),l,m,N,$,s,s==="Google"?!0:v,f,g,!!m?.keepReasoningContext,ee),m?.dynamicDirAwareness||(We+=`
671
- ${wa.replace(`
670
+ `+(S.parts?.[0]?.text||""),S.parts?.length>1&&k.parts.push(...S.parts.slice(1))):st.push(S)}}for(let f of st)for(let S of f.parts||[])S&&typeof S.text=="string"&&(S.text.includes("[action:")||S.text.includes("[tool:"))&&(S.text=S.text.replace(/```(?:[a-zA-Z0-9_-]+)?\s*\n?(\[(?:action|tool):[\s\S]*?\)\s*\])\n?```/gi,"$1"),S.text=S.text.replace(/`(\[(?:action|tool):[\s\S]*?\)\s*\])`/gi,"$1"));E.length=0,E.push(...st),ee=e;let de=`${g}|${s}|${l}|${d}|${Zt}|${ee}|${JSON.stringify(r)}|${!!m?.dynamicDirAwareness}|${!!m?.subAgents}|${process.env.rawReasoning==="true"}`,Ue=jn.key===de&&jn.value;if((process.env.I_HAVE_TOO_MUCH_MONEY==="true"||process.env.I_HAVE_TOO_MUCH_MONEY===!0)&&(Ue=!1),Ue)We=jn.value;else{let f=s==="Mistral"?!!ti(ee):!(ee||"gemma").toLowerCase().startsWith("gemma");We=Or(r,((ee||"gemma").toLowerCase().startsWith("gemma"),Zt),l,m,N,$,s,s==="Google"?!0:v,f,g,!!m?.keepReasoningContext,ee),m?.dynamicDirAwareness||(We+=`
671
+ ${ba.replace(`
672
672
  **Directory**`,`
673
- -- Directory --`)}`),jn.key=de,jn.value=We}let me=E[E.length-1];if(ro()&b>0){await new Promise(G=>setTimeout(G,2500)),yield{type:"status",content:"Verifying"};let f=await Hn(),S=f?f.diagnostics:null,k=Cs(f?.comments);S&&me&&me.role==="user"&&me.parts?.[0]?.text&&(me.parts[0].text+=`
673
+ -- Directory --`)}`),jn.key=de,jn.value=We}let me=E[E.length-1];if(lo()&b>0){await new Promise(G=>setTimeout(G,2500)),yield{type:"status",content:"Verifying"};let f=await Hn(),S=f?f.diagnostics:null,k=vs(f?.comments);S&&me&&me.role==="user"&&me.parts?.[0]?.text&&(me.parts[0].text+=`
674
674
 
675
- ${S}`),Ci&&me&&me.role==="user"&&me.parts?.[0]?.text&&(me.parts[0].text+=`
675
+ ${S}`),vi&&me&&me.role==="user"&&me.parts?.[0]?.text&&(me.parts[0].text+=`
676
676
 
677
677
  [Additional Comments]
678
- ${k}`),yield{type:"status",content:"Working"}}let mt=s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma");if(m?.advanceRollback&&me&&me.role==="user"&&(me.parts?.[0]?.text?.startsWith("[ACTION RESULT]")||me.parts?.[0]?.text?.startsWith("[TOOL RESULT]")))try{let f=await So.getLatestFileChanges(g);if(f&&(f.newFiles.length>0||f.modifiedFiles.length>0||f.deletedFiles.length>0)){let S=`
678
+ ${k}`),yield{type:"status",content:"Working"}}let mt=s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma");if(m?.advanceRollback&&me&&me.role==="user"&&(me.parts?.[0]?.text?.startsWith("[ACTION RESULT]")||me.parts?.[0]?.text?.startsWith("[TOOL RESULT]")))try{let f=await ko.getLatestFileChanges(g);if(f&&(f.newFiles.length>0||f.modifiedFiles.length>0||f.deletedFiles.length>0)){let S=`
679
679
  [system] File Changes:
680
680
  `;for(let G of f.newFiles)S+=`* ${G} (created)
681
681
  `;for(let G of f.modifiedFiles)S+=`* ${G} (modified)
@@ -685,19 +685,19 @@ ${k}`),yield{type:"status",content:"Working"}}let mt=s==="Mistral"||s==="Google"
685
685
  Key: ${de}
686
686
  --------------------------------------------------------------------
687
687
 
688
- ${We}`)}let tt=new Promise((f,S)=>{U.signal.aborted&&S(new DOMException("The user aborted a request.","AbortError")),U.signal.addEventListener("abort",()=>{S(new DOMException("The user aborted a request.","AbortError"))})});tt.catch(()=>{});let De=E;if($t=Date.now(),s==="Ollama")q=(await ye("Ollama"))(n.apiKey,ee,De,We,d,l,v,U.signal,1,m?.ollamaEndpoint||"Cloud");else if(s==="OpenRouter")q=(await ye("OpenRouter"))(n.apiKey,ee,De,We,d,l,v,U.signal,1,g);else if(s==="DeepSeek")q=(await ye("DeepSeek"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="Mistral")q=(await ye("Mistral"))(n.apiKey,ee,De,We,d,l,v,U.signal,1,g);else if(s==="NVIDIA"){let f=(await ye("NVIDIA"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);q=(await ye("NVIDIA_wrap"))(f,ee)}else if(s==="InferX")q=(await ye("InferX"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="SenseNova")q=(await ye("SenseNova"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="AIHubMix")q=(await ye("AIHubMix"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="Poolside")q=(await ye("Poolside"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="9router"||s==="9Router")q=(await ye("NineRouter"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="ExpLabs"||s==="ExperientialLabs")q=(await ye("ExpLabs"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="Infron"||s==="infron")q=(await ye("Infron"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="TokenHarbor"||s==="Token Harbor"||s==="tokenharbor"||s==="token_harbor"||s==="thk")q=(await ye("TokenHarbor"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="APInex"||s==="apinex"||s==="apx")q=(await ye("APInex"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="xKiro"||s==="xkiro"||s==="kiro")q=(await ye("xKiro"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="c_openai"||s==="Custom (OpenAI)"){let f=m?.customOpenAIBaseUrl||"";try{f=await Wi("c_openai")||f}catch{}q=(await ye("c_openai"))(n.apiKey,ee,De,We,d,l,v,U.signal,1,f)}else{let f=pa(n?.apiKey),{serviceTier:S,cleanModel:k}=ya(ee),G={systemInstruction:We,mediaResolution:"MEDIA_RESOLUTION_HIGH",safetySettings:[{category:Si.HARM_CATEGORY_HARASSMENT,threshold:bi.BLOCK_NONE},{category:Si.HARM_CATEGORY_HATE_SPEECH,threshold:bi.BLOCK_NONE},{category:Si.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:bi.BLOCK_NONE},{category:Si.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:bi.BLOCK_NONE}],temperature:1.05,thinkingConfig:(()=>{let I=Xs("Google",ee||"gemini-3-flash-preview",d);if(I!==null){if(typeof I=="object")return I;if(I===!1||I==="false"||I==="none"||I===0||I==="0")return{includeThoughts:!1};if(typeof I=="number")return{includeThoughts:!0,thinkingBudget:I};if(typeof I=="string"){let T=I.toLowerCase();if(T==="minimal")return{includeThoughts:!0,thinkingLevel:Ye.MINIMAL};if(T==="low")return{includeThoughts:!0,thinkingLevel:Ye.LOW};if(T==="medium")return{includeThoughts:!0,thinkingLevel:Ye.MEDIUM};if(T==="high")return{includeThoughts:!0,thinkingLevel:Ye.HIGH};let te=Number(I);if(!isNaN(te))return{includeThoughts:!0,thinkingBudget:te}}}let H=(ee||"").toLowerCase(),ct=H.includes("gemma-4")||H.startsWith("gemma"),y=H.includes("gemini-3");if(ct||y)return ct?d.toLowerCase()!=="high"?{includeThoughts:!1,thinkingLevel:Ye.MINIMAL}:{includeThoughts:!0,thinkingLevel:Ye.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:H.includes("pro")?Ye.LOW:Ye.MINIMAL,Low:Ye.LOW,Medium:Ye.MEDIUM,Standard:Ye.MEDIUM,High:Ye.HIGH,xHigh:Ye.HIGH}[d]||Ye.MEDIUM};{let T={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[d]||2048;return T===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:T}}})()};S&&(G.serviceTier=S);let ie=f.models.generateContentStream({model:k||"gemini-3-flash-preview",contents:De,config:G},{signal:U.signal});q=await Promise.race([ie,tt])}we="",Lt=null,Dn=null,je=[],Tt=0,yield{type:"model_update",content:null},pe="",Xe=gt.length>0;let at="",Vo=Date.now(),rn=async function*(){if(s==="Google"&&at){let f=fo(at);for(let S of f)yield S;at="",Vo=Date.now()}},Ds=!0,mn="",Zn=!1,lt=null,Ns=!1,Wn=!1,eo=!1,zo=!1,Tn=!1,co=f=>{let S=0;for(;S+2<f.length;)f[S]==="`"&&f[S+1]==="`"&&f[S+2]==="`"?(zo=!zo,S+=3):S++},Fs=f=>{if(!f)return;let S=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,k;for(;(k=S.exec(f))!==null;){let G=k[0].toLowerCase();G.startsWith("</")||G.startsWith("[/")||G==="<channel|>"?Tn=!1:Tn=!0}},Ea={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|>"}},fo=f=>{let S=[],k=f,G=ie=>{if(!ie)return;if(!Ns){S.push({type:"text",content:ie}),co(ie),Fs(ie);return}let I=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,H=0,ct;for(;(ct=I.exec(ie))!==null;){let T=ie.substring(H,ct.index);if(T)if(co(T),Tn)S.push({type:"text",content:T});else{let Ee=T.replace(/[^\r\n]/g,"");Ee&&S.push({type:"text",content:Ee})}let te=ct[0];co(te);let a=te.toLowerCase();a.startsWith("</")||a.startsWith("[/")||a==="<channel|>"?Tn=!1:Tn=!0,S.push({type:"text",content:te}),H=I.lastIndex}let y=ie.substring(H);if(y)if(co(y),Tn)S.push({type:"text",content:y});else{let T=y.replace(/[^\r\n]/g,"");T&&S.push({type:"text",content:T})}};for(;k.length>0;)if(Zn){let ie=mn+k,I=Ea[lt];if(I){let y=!1;if(ie.length<I.startPrefix.length?I.startPrefix.startsWith(ie)||(y=!0):ie.startsWith(I.startPrefix)?ie.length>=I.fullPrefix.length&&!ie.startsWith(I.fullPrefix)&&(y=!0):y=!0,y){G(ie),mn="",Zn=!1,lt=null,Wn=!1,eo=!1,k="";break}}let H=-1,ct=I?I.endTag:"]";if(lt==="tool"||lt==="action"){let y=0,T=null,te=0,a=!1;for(let Ee=0;Ee<ie.length;Ee++){let X=ie[Ee];if(T){if(X===T){let R=0;for(let dt=Ee-1;dt>=0&&ie[dt]==="\\";dt--)R++;R%2===0&&(T=null)}}else if(X==='"'||X==="'")T=X;else if(X==="`")if(Wn){H=Ee;break}else T=X;else if(X==="(")y++,a=!0;else if(X===")")y--;else if(X==="]"&&a&&y===0){H=Ee;break}}}else H=ie.indexOf(ct);if(H!==-1){let y=ct.length,T=ie.substring(0,H+y);lt?.startsWith("kimi")||S.push({type:"text",content:T}),co(T),Fs(T),(lt==="tool"||lt==="action"||lt?.startsWith("kimi"))&&!Wn&&!eo&&(Ns=!0,On.push(T.trim())),Wn=!1,eo=!1,mn="",Zn=!1,lt=null,k=ie.substring(H+y)}else{mn=ie,k="";break}}else{let ie=k.indexOf("[tool"),I=k.indexOf("[action"),H=k.indexOf("[[END]]"),ct=k.indexOf("<|tool_calls_section_begin|>"),y=k.indexOf("<|tool_call_begin|>"),T=[{type:"tool",idx:ie,start:"[tool",end:"]"},{type:"action",idx:I,start:"[action",end:"]"},{type:"end",idx:H,start:"[[END]]",end:"[[END]]"},{type:"kimi_section",idx:ct,start:"<|tool_calls_section_begin|>",end:"<|tool_calls_section_end|>"},{type:"kimi_call",idx:y,start:"<|tool_call_begin|>",end:"<|tool_call_end|>"}].filter(te=>te.idx!==-1).sort((te,a)=>te.idx-a.idx);if(T.length>0){let te=T[0],a=k.substring(0,te.idx);te.idx>0&&G(a);let Ee=te.idx>0?k[te.idx-1]:"";Wn=zo||Ee==="`",eo=Tn,Zn=!0,lt=te.type,mn="",k=k.substring(te.idx)}else{let te=["[tool","[action","[[END]]","<|tool_calls_section_begin|>","<|tool_call_begin|>"],a=-1;for(let Ee of te){for(let X=Ee.length-1;X>0;X--)if(k.endsWith(Ee.substring(0,X))){a=k.length-X;let R=te.indexOf(Ee);R===0?lt="tool":R===1?lt="action":R===2?lt="end":R===3?lt="kimi_section":lt="kimi_call";break}if(a!==-1)break}if(a!==-1){if(a>0){let X=k.substring(0,a);G(X)}let Ee=a>0?k[a-1]:"";Wn=zo||Ee==="`",eo=Tn,Zn=!0,mn=k.substring(a),k=""}else{G(k);break}}}return S},_a=q[Symbol.asyncIterator]();for(;;){let{value:f,done:S}=await Promise.race([_a.next(),tt]);if(S)break;if(f&&f.type==="status"){yield f;continue}let k="",G=f.candidates?.[0]?.content?.parts;if(G&&G.length>0)for(let I of G){let H=typeof I.text=="string"?I.text:I.text?parseChunkText(I.text):"";I.thought?H&&(W||(k+="<think_fluxflow>",W=!0),k+=H):H&&(W&&(k+="</think_fluxflow>",W=!1),k+=H)}else f.text&&W&&(k+="</think_fluxflow>",W=!1);k=wl(k);let ie=k?Hi(k):0;if(n&&typeof n.onTokenChunk=="function"&&n.onTokenChunk(k,ie),Ds&&(yt===null&&(yt=Date.now()-$t),yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"},Ds=!1),ut){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
688
+ ${We}`)}let tt=new Promise((f,S)=>{U.signal.aborted&&S(new DOMException("The user aborted a request.","AbortError")),U.signal.addEventListener("abort",()=>{S(new DOMException("The user aborted a request.","AbortError"))})});tt.catch(()=>{});let De=E;if($t=Date.now(),s==="Ollama")q=(await ye("Ollama"))(n.apiKey,ee,De,We,d,l,v,U.signal,1,m?.ollamaEndpoint||"Cloud");else if(s==="OpenRouter")q=(await ye("OpenRouter"))(n.apiKey,ee,De,We,d,l,v,U.signal,1,g);else if(s==="DeepSeek")q=(await ye("DeepSeek"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="Mistral")q=(await ye("Mistral"))(n.apiKey,ee,De,We,d,l,v,U.signal,1,g);else if(s==="NVIDIA"){let f=(await ye("NVIDIA"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);q=(await ye("NVIDIA_wrap"))(f,ee)}else if(s==="InferX")q=(await ye("InferX"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="SenseNova")q=(await ye("SenseNova"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="AIHubMix")q=(await ye("AIHubMix"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="Poolside")q=(await ye("Poolside"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="9router"||s==="9Router")q=(await ye("NineRouter"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="ExpLabs"||s==="ExperientialLabs")q=(await ye("ExpLabs"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="Infron"||s==="infron")q=(await ye("Infron"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="TokenHarbor"||s==="Token Harbor"||s==="tokenharbor"||s==="token_harbor"||s==="thk")q=(await ye("TokenHarbor"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="APInex"||s==="apinex"||s==="apx")q=(await ye("APInex"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="xKiro"||s==="xkiro"||s==="kiro")q=(await ye("xKiro"))(n.apiKey,ee,De,We,d,l,v,U.signal,1);else if(s==="c_openai"||s==="Custom (OpenAI)"){let f=m?.customOpenAIBaseUrl||"";try{f=await Wi("c_openai")||f}catch{}q=(await ye("c_openai"))(n.apiKey,ee,De,We,d,l,v,U.signal,1,f)}else{let f=ha(n?.apiKey),{serviceTier:S,cleanModel:k}=xa(ee),G={systemInstruction:We,mediaResolution:"MEDIA_RESOLUTION_HIGH",safetySettings:[{category:ki.HARM_CATEGORY_HARASSMENT,threshold:Si.BLOCK_NONE},{category:ki.HARM_CATEGORY_HATE_SPEECH,threshold:Si.BLOCK_NONE},{category:ki.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Si.BLOCK_NONE},{category:ki.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Si.BLOCK_NONE}],temperature:1.05,thinkingConfig:(()=>{let I=Js("Google",ee||"gemini-3-flash-preview",d);if(I!==null){if(typeof I=="object")return I;if(I===!1||I==="false"||I==="none"||I===0||I==="0")return{includeThoughts:!1};if(typeof I=="number")return{includeThoughts:!0,thinkingBudget:I};if(typeof I=="string"){let T=I.toLowerCase();if(T==="minimal")return{includeThoughts:!0,thinkingLevel:Ye.MINIMAL};if(T==="low")return{includeThoughts:!0,thinkingLevel:Ye.LOW};if(T==="medium")return{includeThoughts:!0,thinkingLevel:Ye.MEDIUM};if(T==="high")return{includeThoughts:!0,thinkingLevel:Ye.HIGH};let te=Number(I);if(!isNaN(te))return{includeThoughts:!0,thinkingBudget:te}}}let H=(ee||"").toLowerCase(),ct=H.includes("gemma-4")||H.startsWith("gemma"),y=H.includes("gemini-3");if(ct||y)return ct?d.toLowerCase()!=="high"?{includeThoughts:!1,thinkingLevel:Ye.MINIMAL}:{includeThoughts:!0,thinkingLevel:Ye.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:H.includes("pro")?Ye.LOW:Ye.MINIMAL,Low:Ye.LOW,Medium:Ye.MEDIUM,Standard:Ye.MEDIUM,High:Ye.HIGH,xHigh:Ye.HIGH}[d]||Ye.MEDIUM};{let T={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[d]||2048;return T===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:T}}})()};S&&(G.serviceTier=S);let ie=f.models.generateContentStream({model:k||"gemini-3-flash-preview",contents:De,config:G},{signal:U.signal});q=await Promise.race([ie,tt])}we="",Lt=null,Dn=null,je=[],Tt=0,yield{type:"model_update",content:null},pe="",Xe=gt.length>0;let at="",zo=Date.now(),rn=async function*(){if(s==="Google"&&at){let f=go(at);for(let S of f)yield S;at="",zo=Date.now()}},Ns=!0,mn="",Zn=!1,lt=null,Fs=!1,Wn=!1,eo=!1,qo=!1,Tn=!1,uo=f=>{let S=0;for(;S+2<f.length;)f[S]==="`"&&f[S+1]==="`"&&f[S+2]==="`"?(qo=!qo,S+=3):S++},Bs=f=>{if(!f)return;let S=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,k;for(;(k=S.exec(f))!==null;){let G=k[0].toLowerCase();G.startsWith("</")||G.startsWith("[/")||G==="<channel|>"?Tn=!1:Tn=!0}},_a={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|>"}},go=f=>{let S=[],k=f,G=ie=>{if(!ie)return;if(!Fs){S.push({type:"text",content:ie}),uo(ie),Bs(ie);return}let I=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,H=0,ct;for(;(ct=I.exec(ie))!==null;){let T=ie.substring(H,ct.index);if(T)if(uo(T),Tn)S.push({type:"text",content:T});else{let Ee=T.replace(/[^\r\n]/g,"");Ee&&S.push({type:"text",content:Ee})}let te=ct[0];uo(te);let a=te.toLowerCase();a.startsWith("</")||a.startsWith("[/")||a==="<channel|>"?Tn=!1:Tn=!0,S.push({type:"text",content:te}),H=I.lastIndex}let y=ie.substring(H);if(y)if(uo(y),Tn)S.push({type:"text",content:y});else{let T=y.replace(/[^\r\n]/g,"");T&&S.push({type:"text",content:T})}};for(;k.length>0;)if(Zn){let ie=mn+k,I=_a[lt];if(I){let y=!1;if(ie.length<I.startPrefix.length?I.startPrefix.startsWith(ie)||(y=!0):ie.startsWith(I.startPrefix)?ie.length>=I.fullPrefix.length&&!ie.startsWith(I.fullPrefix)&&(y=!0):y=!0,y){G(ie),mn="",Zn=!1,lt=null,Wn=!1,eo=!1,k="";break}}let H=-1,ct=I?I.endTag:"]";if(lt==="tool"||lt==="action"){let y=0,T=null,te=0,a=!1;for(let Ee=0;Ee<ie.length;Ee++){let X=ie[Ee];if(T){if(X===T){let R=0;for(let dt=Ee-1;dt>=0&&ie[dt]==="\\";dt--)R++;R%2===0&&(T=null)}}else if(X==='"'||X==="'")T=X;else if(X==="`")if(Wn){H=Ee;break}else T=X;else if(X==="(")y++,a=!0;else if(X===")")y--;else if(X==="]"&&a&&y===0){H=Ee;break}}}else H=ie.indexOf(ct);if(H!==-1){let y=ct.length,T=ie.substring(0,H+y);lt?.startsWith("kimi")||S.push({type:"text",content:T}),uo(T),Bs(T),(lt==="tool"||lt==="action"||lt?.startsWith("kimi"))&&!Wn&&!eo&&(Fs=!0,On.push(T.trim())),Wn=!1,eo=!1,mn="",Zn=!1,lt=null,k=ie.substring(H+y)}else{mn=ie,k="";break}}else{let ie=k.indexOf("[tool"),I=k.indexOf("[action"),H=k.indexOf("[[END]]"),ct=k.indexOf("<|tool_calls_section_begin|>"),y=k.indexOf("<|tool_call_begin|>"),T=[{type:"tool",idx:ie,start:"[tool",end:"]"},{type:"action",idx:I,start:"[action",end:"]"},{type:"end",idx:H,start:"[[END]]",end:"[[END]]"},{type:"kimi_section",idx:ct,start:"<|tool_calls_section_begin|>",end:"<|tool_calls_section_end|>"},{type:"kimi_call",idx:y,start:"<|tool_call_begin|>",end:"<|tool_call_end|>"}].filter(te=>te.idx!==-1).sort((te,a)=>te.idx-a.idx);if(T.length>0){let te=T[0],a=k.substring(0,te.idx);te.idx>0&&G(a);let Ee=te.idx>0?k[te.idx-1]:"";Wn=qo||Ee==="`",eo=Tn,Zn=!0,lt=te.type,mn="",k=k.substring(te.idx)}else{let te=["[tool","[action","[[END]]","<|tool_calls_section_begin|>","<|tool_call_begin|>"],a=-1;for(let Ee of te){for(let X=Ee.length-1;X>0;X--)if(k.endsWith(Ee.substring(0,X))){a=k.length-X;let R=te.indexOf(Ee);R===0?lt="tool":R===1?lt="action":R===2?lt="end":R===3?lt="kimi_section":lt="kimi_call";break}if(a!==-1)break}if(a!==-1){if(a>0){let X=k.substring(0,a);G(X)}let Ee=a>0?k[a-1]:"";Wn=qo||Ee==="`",eo=Tn,Zn=!0,mn=k.substring(a),k=""}else{G(k);break}}}return S},Ia=q[Symbol.asyncIterator]();for(;;){let{value:f,done:S}=await Promise.race([Ia.next(),tt]);if(S)break;if(f&&f.type==="status"){yield f;continue}let k="",G=f.candidates?.[0]?.content?.parts;if(G&&G.length>0)for(let I of G){let H=typeof I.text=="string"?I.text:I.text?parseChunkText(I.text):"";I.thought?H&&(W||(k+="<think_fluxflow>",W=!0),k+=H):H&&(W&&(k+="</think_fluxflow>",W=!1),k+=H)}else f.text&&W&&(k+="</think_fluxflow>",W=!1);k=Sl(k);let ie=k?Hi(k):0;if(n&&typeof n.onTokenChunk=="function"&&n.onTokenChunk(k,ie),Ns&&(yt===null&&(yt=Date.now()-$t),yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"},Ns=!1),ut){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
689
689
 
690
- \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(k){if(Xe){if(pe+=k,pe.length>=64){let y=0,T=Math.min(gt.length,pe.length);for(let a=T;a>=10;a--)if(gt.endsWith(pe.substring(0,a))){y=a;break}let te=pe.substring(y);if(te){let Ee=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(gt)?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(Ee)if(we+=Ee,s==="Google")at+=Ee;else{yield*rn();let X=fo(Ee);for(let R of X)yield R}}Xe=!1,pe=""}continue}else if(we+=k,s==="Google")at+=k;else{yield*rn();let y=fo(k);for(let T of y)yield T}let I=Cl(we);if(I.inside){At=!0,Dn||(Dn=Date.now());let T={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"}[I.toolName]||I.toolName,te=I.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(T)){let X=D(te),R=X.basename||X.name||X.path||X.targetFile||X.TargetFile||X.directory||X.file,dt=X.keyword,pn=X.title||X.task,_t=X.id||X.taskId,ne=X.timeout||X.time||X.seconds||X.sec;if(dt!=null)a=String(dt).replace(bn,"");else if(R)a=V.basename(String(R).replace(bn,"").replace(ra,"/"));else if(pn&&(T==="invoke"||T==="invoke_sync"))a=String(pn).replace(bn,"").substring(0,30);else if(_t&&T==="get_progress")a=String(_t).replace(bn,"");else if(ne&&T==="await"){let Ve=parseFloat(String(ne).replace(bn,""));isNaN(Ve)?a=String(ne).replace(bn,""):(Ve<5&&(Ve=5),Ve>120&&(Ve=180),a=(It=>{if(It>=60){let go=Math.floor(It/60),hn=It%60;return`${go}m${hn>0?` ${hn}s`:""}`}return`${It}s`})(Ve))}else if(ne&&T==="wait"){let Ve=parseFloat(String(ne).replace(bn,""));isNaN(Ve)?a=String(ne).replace(bn,""):(Ve<10&&(Ve=10),Ve>120&&(Ve=120),a=(It=>{if(It>=60){let go=Math.floor(It/60),hn=It%60;return`${go}m${hn>0?` ${hn}s`:""}`}return`${It}s`})(Ve))}else{let Ve=te.match(hl);if(Ve){let ft=Ve[1].replace(bn,"");T==="invoke"||T==="invoke_sync"||T==="get_progress"?a=ft.substring(0,30):a=T==="search_keyword"||T==="file_map"?ft:V.basename(ft.replace(ra,"/"))}}}let Ee=`${Ss[T]||T}${a?` ${a}`:""}`;if((T!==Lt||a!==lo)&&(Lt=T,lo=a,yield{type:"status",content:`${Ee}`},process.stdout.isTTY)){let R={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"}[T]||"Working";process.stdout.write(`\x1B]0;${R}...\x07`)}}if(we.length-Qn>800){Qn=we.length;let y=ha(we,!1),T=bs(y),te=T?(T.innerContent||"").trim():"",a=te.split(/[.!?]\s+/).filter(fe=>fe.trim().length>10),Ee=new Set(a),X=a.length>25?(a.length-Ee.size)/a.length:0,R=te.split(/\s+/).filter(fe=>fe.length>0).length,dt=.9,pn=.92,_t=!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;_t=R>c}if(X>dt||_t){yield{type:"status",content:`${X>dt?"Reasoning Loop Detected":"Thinking Budget Exceeded"}. Re-centering...`},Ot=!0,await new Promise(c=>setTimeout(c,3e3));break}let ft=fa(we).trim().split(/[.!?]\s+/).filter(fe=>fe.trim().length>10),It=new Set(ft);if((ft.length>25?(ft.length-It.size)/ft.length:0)>pn){yield{type:"status",content:"Response Loop Detected. Re-centering..."},Ot=!1,Dt=!0,await new Promise(fe=>setTimeout(fe,3e3));break}let hn=y.replace(cl,"").replace(dl,"").replace(fl,"").replace(ul,""),wt=hn.toLowerCase().split(/\s+/).map(fe=>fe.replace(gl,"")).filter(fe=>fe.length>0),en=!1;if(wt.length>=40)for(let fe=1;fe<=15;fe++){let c=Math.max(8,Math.ceil(25/fe));if(wt.length<fe*c)continue;let C=wt.slice(wt.length-fe),L=C.join(" ");if(fe>1&&L===C.slice(0,Math.floor(fe/2)).join(" ").repeat(2).trim())continue;let re=!0;for(let se=1;se<c;se++)if(wt.slice(wt.length-fe*(se+1),wt.length-fe*se).join(" ")!==L){re=!1;break}if(re){en=!0;break}}if(!en){let fe=hn.toLowerCase().replace(ml,"");if(fe.length>=80)for(let c=1;c<=10;c++){let C=Math.max(15,Math.ceil(45/c));if(fe.length<c*C)continue;let L=fe.substring(fe.length-c),re=!0;for(let se=1;se<C;se++)if(fe.substring(fe.length-c*(se+1),fe.length-c*se)!==L){re=!1;break}if(re){en=!0;break}}}if(en){yield{type:"status",content:"Stuttering Detected. Re-centering..."},Ot=!1,Fn=!0,await new Promise(fe=>setTimeout(fe,3e3));break}}let H=Ft(we),ct=Mn(H);for(;ct.length>Tt;){yield*rn();let y=ct[Tt],T=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"}[y.toolName]||y.toolName,Ee=Ss[a]||y.toolName,X=Kn(a,y.args);yield{type:"status",content:`${Ee}${X?` ${X}`:""}`};let R="";if(a==="click"){let c=D(y.args);R=`\u2714 Clicked ${c.intendedClickText?`: ${c.intendedClickText}`:"Screen"}`}else if(a==="drag"){let c=D(y.args);R=`\u2714 Dragged: Cell ${c.fromGridId||""} \u2192 Cell ${c.toGridId||""}`}else if(a==="scroll"){let c=D(y.args);R=`\u2714 Scrolled: ${c.direction||"down"} (${c.amount||1})`}else if(a==="keyboard_typing"){let c=D(y.args);R=`\u2714 ${c.autoPressEnter?"Entered":"Typed"}: ${c.text?`"${c.text.length>20?c.text.substring(0,20)+"...":c.text}"`:""}`}else if(a==="key_press")R=`\u2714 Pressed Key: ${D(y.args).key||""}`;else if(a==="recapture_screen")R="\u2714 Recaptured Screen";else if(a==="web_search"){let{query:c,limit:C=10,aiMode:L=!1}=D(y.args);R=`${c?"\u2714":"\u2718"} ${L?"AI Search":"Searched"}: ${c?`${c}`:"No Search Query"}${L===!1&&c?` \u2192 ${C}`:""}`}else if(a==="web_scrape"){let c=D(y.args).url||null;R=`${c?"\u2714":"\u2718"} Visited: ${c||"No Source"}`}else if(a==="view_file"){let{path:c,StartLine:C,EndLine:L,start_line:re,end_line:se,startLine:Z,endLine:le}=D(y.args),ke=C||re||Z,J=L||se||le,j=parseInt(ke)||1,F=parseInt(J)||(ke?j+800:800),ue="...",Ge=F,O=(c||"").trim().toLowerCase().replaceAll("\\","/");if(O.startsWith("#skill"))O.startsWith("#skill/global/fluxflow")||O.startsWith("#skills/global/fluxflow")||O.includes("#skill/fluxflow")||O.includes("#skills/fluxflow")?R="\u2714 Read Documentation":R=`\u2714 Read Skill: ${V.basename(c.replaceAll("\\","/"))}`;else{try{let{resolvedPath:he}=ln(c),Se=V.resolve(process.cwd(),he);if(Ce.existsSync(Se)){let Te=Ce.readFileSync(Se,"utf8").split(`
691
- `).length;ue=Te,!ke&&!J&&Te>800?Ge=Math.min(50,Te):Ge=Math.min(F,Te)}}catch{}let St=(c||"").toLowerCase(),mo=St.endsWith(".pdf"),Ut=St.endsWith(".docx")||St.endsWith(".doc")||St.endsWith(".ppt")||St.endsWith(".pptx")||St.endsWith(".xls")||St.endsWith(".xlsx"),_e=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(St);mo||Ut?R=`${c.length>0?"\u2714":"\u2718"} ${c?`Analyzed: ${V.basename(c)}`:"Analyzed: File Not Found"}`:_e?R=`${c.length>0?"\u2714":"\u2718"} ${c?`Processed: ${V.basename(c)}`:"Processed: File Not Found"}`:R=`${ue!=="..."?"\u2714":"\u2718"} Read: ${c?`${V.basename(c)} \u2192 ${ue!=="..."?`Lines ${j} - ${Ge} of ${ue}`:"File Not Found"}`:"File Not Found"}`}}else if(a==="list_files"||a==="read_folder"){let c=a==="list_files"?"List":"Browsed",C=D(y.args).path||null,L=D(y.args).recurse||1;R=`${C?"\u2714":"\u2718"} ${c}: ${C?`${C==="."?`./${L>1?"*":""}`:`${C.replaceAll("\\","/")}${L>1?`${C.endsWith("/")?"*":"/*"}`:`${C.endsWith("/")?"":"/"}`}`}`:"No Folder Selected"}`}else if(a==="find_file"){let c=D(y.args),C=c.basename||c.name||c.path||c.file||c.query||"";R=`${C?"\u2714":"\u2718"} Located: ${C||"No Query"}`}else if(a==="write_file"||a==="update_file"){let c=a==="write_file"?"Created":"Edited",C=D(y.args),L=C.path||null,se=Object.entries(C).some(([Z,le])=>Z.startsWith("searchContent")&&typeof le=="string"&&le.startsWith("^LINE:"))?"\u1361":":";R=`${L?"\u2714":"\u2718"} ${c}${se} ${L?L.replaceAll("\\","/"):"No File Changes"}`}else if(a==="write_pdf"){let c=D(y.args).path||null;R=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No PDF Generated"}`}else if(a==="write_docx"){let c=D(y.args).path||null;R=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No Docx Generated"}`}else if(a==="file_map"){let c=D(y.args).path;R=`${c?"\u2714":"\u2718"} Indexed: ${c.replaceAll("\\","/")?""+c:"File Not Found"}`}else if(a.toLowerCase()==="search_keyword"||a.toLowerCase()==="todo")R="";else if(a.toLowerCase()==="generate_image"){let{path:c,outputPath:C,output:L}=D(y.args);R=`\u2714 Generated: ${c||C||L||"generated_image.png"}`}else if(a==="invoke_sync"||a==="InvokeSync"){let c=Kn(a,y.args);R=`\u2714 Called Generalist${c?`: ${c}`:""}`}else if(a==="Invoke"||a==="InvokeAsync"||a==="invoke"){let c=Kn(a,y.args);R=`\u2714 Started Generalist${c?`: ${c}`:""}`}else if(a==="get_progress"||a==="GetProgress"){let c=Kn(a,y.args);R=`\u2714 Checked${c?`: ${c}`:""}`}else if(a==="cancel"){let c=Kn(a,y.args);R=`\u{1F6C7} Cancelled${c?`: ${c}`:""}`}else if(a==="steer"||a==="Steer"){let c=Kn(a,y.args);R=`\u2714 Steered${c?`: ${c}`:""}`}else if(a==="EmergencyRollback"){let{method:c}=D(y.args);R=c==="forceRevert"?"":"\u2714 Rollback Point Checked"}else if(a==="await"||a==="Await"||a==="wait"||a==="Wait"){let{time:c,timeout:C,seconds:L,sec:re}=D(y.args),se=parseFloat(L||re||C||c)||45,Z=a==="wait"||a==="Wait"?120:180;se<10&&(se=10),se>Z&&(se=Z);let le=j=>{if(j>=60){let F=Math.floor(j/60),ue=j%60;return`${F}m${ue>0?` ${ue}s`:""}`}return`${j}s`},ke=["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"];R=`\u2714 ${ke[Math.floor(Math.random()*ke.length)]} \u2192 ${le(se)}`}else a==="Answer"||a==="answer"?R="\u2714 Resolved Sub-Agent Query":a==="exec_command"||a==="ask"?R="":R=`Executed: ${y.toolName}`;if(yield*rn(),a==="exec_command"){let{command:c}=D(y.args);if(c&&n.systemSettings&&n.systemSettings.allowExternalAccess===!1){let C=[/[a-zA-Z]:[\\\/]/i,/^\//,/\.\.[\\\/]/,/\/etc\//,/\/var\//,/\/root\//,/\/bin\//,/\/usr\//],L=V.resolve(process.cwd()).substring(0,3).toLowerCase(),re=J=>{let j=[],F="",ue=null;for(let Ge=0;Ge<J.length;Ge++){let O=J[Ge];ue?(O===ue&&(ue=null),F+=O):O==='"'||O==="'"?(ue=O,F+=O):O==="&"&&J[Ge+1]==="&"||O==="|"&&J[Ge+1]==="|"?(F.trim()&&(j.push(F.trim()),F=""),Ge++):O===";"||O==="|"||O==="&"?F.trim()&&(j.push(F.trim()),F=""):F+=O}return F.trim()&&j.push(F.trim()),j},se=J=>{let j=[],F="",ue=null;for(let Ge=0;Ge<J.length;Ge++){let O=J[Ge];ue?(O===ue&&(ue=null),F+=O):O==='"'||O==="'"?(ue=O,F+=O):/\s/.test(O)?F&&(j.push(F),F=""):F+=O}return F&&j.push(F),j},Z=J=>{let j=J.replace(/^['"]|['"]$/g,"").trim();return!j||process.platform==="win32"&&/^\/[a-zA-Z0-9?]+$/.test(j)?!1:C.some(F=>{if(F.source==="[a-zA-Z]:[\\\\\\/]"){let ue=j.match(/[a-zA-Z]:[\\\/]/i);return ue&&ue[0].toLowerCase()!==L}return F.test(j)})};if(re(c).some(J=>{let j=se(J);if(j.length===0)return!1;let F=j[0].replace(/^['"]|['"]$/g,"").toLowerCase();if(["echo","printf","write-output"].includes(F)){let Ge=!1;return j.some(O=>{let bt=O.replace(/^['"]|['"]$/g,"");if(bt===">"||bt===">>"||bt==="<")return Ge=!0,!1;if(bt.startsWith(">")||bt.startsWith("<")){let St=bt.replace(/^[><]+/,"");return Z(St)}return Ge?(Ge=!1,Z(O)):!1})}return j.some(Ge=>Z(Ge))})){let J='Access Denied. Prohibited from accessing external directories while "External Workspace Access" is disabled.';n.onExecStart&&n.onExecStart(c||"No Command"),yield{type:"exec_start"},await new Promise(j=>setTimeout(j,50)),n.onExecChunk&&n.onExecChunk(`ERROR: ${J}`),await new Promise(j=>setTimeout(j,50)),n.onExecEnd&&n.onExecEnd(),je.push({role:"user",text:`[ACTION RESULT]: ERROR: ${J}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${J}`},Tt++;continue}}n.onExecStart&&n.onExecStart(c||"No Command"),yield{type:"exec_start"}}let dt=D(y.args),pn=dt.path||dt.targetPath||null;if(pn){let c=n.systemSettings&&n.systemSettings.allowExternalAccess===!1,C=V.resolve(pn),L=V.resolve(process.cwd());if(c&&!C.startsWith(L)){let re="Access Denied. You are not allowed to access files outside the current workspace.";if(a==="write_file"||a==="update_file"){let Z=`\u2718 ${a==="write_file"?"Write Canceled":"Edit Canceled"}: ${dt.path||"..."}`,le=115;process.stdout.isTTY&&(le=process.stdout.columns-5||120);let ke=Math.min(Z.length+4,le),J=`${Z.padEnd(ke-2).substring(0,ke-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
690
+ \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(k){if(Xe){if(pe+=k,pe.length>=64){let y=0,T=Math.min(gt.length,pe.length);for(let a=T;a>=10;a--)if(gt.endsWith(pe.substring(0,a))){y=a;break}let te=pe.substring(y);if(te){let Ee=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(gt)?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(Ee)if(we+=Ee,s==="Google")at+=Ee;else{yield*rn();let X=go(Ee);for(let R of X)yield R}}Xe=!1,pe=""}continue}else if(we+=k,s==="Google")at+=k;else{yield*rn();let y=go(k);for(let T of y)yield T}let I=Rl(we);if(I.inside){At=!0,Dn||(Dn=Date.now());let T={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"}[I.toolName]||I.toolName,te=I.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(T)){let X=D(te),R=X.basename||X.name||X.path||X.targetFile||X.TargetFile||X.directory||X.file,dt=X.keyword,pn=X.title||X.task,_t=X.id||X.taskId,ne=X.timeout||X.time||X.seconds||X.sec;if(dt!=null)a=String(dt).replace(bn,"");else if(R)a=V.basename(String(R).replace(bn,"").replace(aa,"/"));else if(pn&&(T==="invoke"||T==="invoke_sync"))a=String(pn).replace(bn,"").substring(0,30);else if(_t&&T==="get_progress")a=String(_t).replace(bn,"");else if(ne&&T==="await"){let Ve=parseFloat(String(ne).replace(bn,""));isNaN(Ve)?a=String(ne).replace(bn,""):(Ve<5&&(Ve=5),Ve>120&&(Ve=180),a=(It=>{if(It>=60){let po=Math.floor(It/60),hn=It%60;return`${po}m${hn>0?` ${hn}s`:""}`}return`${It}s`})(Ve))}else if(ne&&T==="wait"){let Ve=parseFloat(String(ne).replace(bn,""));isNaN(Ve)?a=String(ne).replace(bn,""):(Ve<10&&(Ve=10),Ve>120&&(Ve=120),a=(It=>{if(It>=60){let po=Math.floor(It/60),hn=It%60;return`${po}m${hn>0?` ${hn}s`:""}`}return`${It}s`})(Ve))}else{let Ve=te.match(xl);if(Ve){let ft=Ve[1].replace(bn,"");T==="invoke"||T==="invoke_sync"||T==="get_progress"?a=ft.substring(0,30):a=T==="search_keyword"||T==="file_map"?ft:V.basename(ft.replace(aa,"/"))}}}let Ee=`${ks[T]||T}${a?` ${a}`:""}`;if((T!==Lt||a!==fo)&&(Lt=T,fo=a,yield{type:"status",content:`${Ee}`},process.stdout.isTTY)){let R={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"}[T]||"Working";process.stdout.write(`\x1B]0;${R}...\x07`)}}if(we.length-Qn>800){Qn=we.length;let y=ya(we,!1),T=Ss(y),te=T?(T.innerContent||"").trim():"",a=te.split(/[.!?]\s+/).filter(fe=>fe.trim().length>10),Ee=new Set(a),X=a.length>25?(a.length-Ee.size)/a.length:0,R=te.split(/\s+/).filter(fe=>fe.length>0).length,dt=.9,pn=.92,_t=!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;_t=R>c}if(X>dt||_t){yield{type:"status",content:`${X>dt?"Reasoning Loop Detected":"Thinking Budget Exceeded"}. Re-centering...`},Ot=!0,await new Promise(c=>setTimeout(c,3e3));break}let ft=ua(we).trim().split(/[.!?]\s+/).filter(fe=>fe.trim().length>10),It=new Set(ft);if((ft.length>25?(ft.length-It.size)/ft.length:0)>pn){yield{type:"status",content:"Response Loop Detected. Re-centering..."},Ot=!1,Dt=!0,await new Promise(fe=>setTimeout(fe,3e3));break}let hn=y.replace(fl,"").replace(ul,"").replace(gl,"").replace(ml,""),wt=hn.toLowerCase().split(/\s+/).map(fe=>fe.replace(pl,"")).filter(fe=>fe.length>0),en=!1;if(wt.length>=40)for(let fe=1;fe<=15;fe++){let c=Math.max(8,Math.ceil(25/fe));if(wt.length<fe*c)continue;let C=wt.slice(wt.length-fe),L=C.join(" ");if(fe>1&&L===C.slice(0,Math.floor(fe/2)).join(" ").repeat(2).trim())continue;let re=!0;for(let se=1;se<c;se++)if(wt.slice(wt.length-fe*(se+1),wt.length-fe*se).join(" ")!==L){re=!1;break}if(re){en=!0;break}}if(!en){let fe=hn.toLowerCase().replace(hl,"");if(fe.length>=80)for(let c=1;c<=10;c++){let C=Math.max(15,Math.ceil(45/c));if(fe.length<c*C)continue;let L=fe.substring(fe.length-c),re=!0;for(let se=1;se<C;se++)if(fe.substring(fe.length-c*(se+1),fe.length-c*se)!==L){re=!1;break}if(re){en=!0;break}}}if(en){yield{type:"status",content:"Stuttering Detected. Re-centering..."},Ot=!1,Fn=!0,await new Promise(fe=>setTimeout(fe,3e3));break}}let H=Ft(we),ct=Mn(H);for(;ct.length>Tt;){yield*rn();let y=ct[Tt],T=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"}[y.toolName]||y.toolName,Ee=ks[a]||y.toolName,X=Kn(a,y.args);yield{type:"status",content:`${Ee}${X?` ${X}`:""}`};let R="";if(a==="click"){let c=D(y.args);R=`\u2714 Clicked ${c.intendedClickText?`: ${c.intendedClickText}`:"Screen"}`}else if(a==="drag"){let c=D(y.args);R=`\u2714 Dragged: Cell ${c.fromGridId||""} \u2192 Cell ${c.toGridId||""}`}else if(a==="scroll"){let c=D(y.args);R=`\u2714 Scrolled: ${c.direction||"down"} (${c.amount||1})`}else if(a==="keyboard_typing"){let c=D(y.args);R=`\u2714 ${c.autoPressEnter?"Entered":"Typed"}: ${c.text?`"${c.text.length>20?c.text.substring(0,20)+"...":c.text}"`:""}`}else if(a==="key_press")R=`\u2714 Pressed Key: ${D(y.args).key||""}`;else if(a==="recapture_screen")R="\u2714 Recaptured Screen";else if(a==="web_search"){let{query:c,limit:C=10,aiMode:L=!1}=D(y.args);R=`${c?"\u2714":"\u2718"} ${L?"AI Search":"Searched"}: ${c?`${c}`:"No Search Query"}${L===!1&&c?` \u2192 ${C}`:""}`}else if(a==="web_scrape"){let c=D(y.args).url||null;R=`${c?"\u2714":"\u2718"} Visited: ${c||"No Source"}`}else if(a==="view_file"){let{path:c,StartLine:C,EndLine:L,start_line:re,end_line:se,startLine:Z,endLine:le}=D(y.args),ke=C||re||Z,J=L||se||le,j=parseInt(ke)||1,F=parseInt(J)||(ke?j+800:800),ue="...",Ge=F,O=(c||"").trim().toLowerCase().replaceAll("\\","/");if(O.startsWith("#skill"))O.startsWith("#skill/global/fluxflow")||O.startsWith("#skills/global/fluxflow")||O.includes("#skill/fluxflow")||O.includes("#skills/fluxflow")?R="\u2714 Read Documentation":R=`\u2714 Read Skill: ${V.basename(c.replaceAll("\\","/"))}`;else{try{let{resolvedPath:he}=ln(c),Se=V.resolve(process.cwd(),he);if(Ce.existsSync(Se)){let Te=Ce.readFileSync(Se,"utf8").split(`
691
+ `).length;ue=Te,!ke&&!J&&Te>800?Ge=Math.min(50,Te):Ge=Math.min(F,Te)}}catch{}let St=(c||"").toLowerCase(),ho=St.endsWith(".pdf"),Ut=St.endsWith(".docx")||St.endsWith(".doc")||St.endsWith(".ppt")||St.endsWith(".pptx")||St.endsWith(".xls")||St.endsWith(".xlsx"),_e=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(St);ho||Ut?R=`${c.length>0?"\u2714":"\u2718"} ${c?`Analyzed: ${V.basename(c)}`:"Analyzed: File Not Found"}`:_e?R=`${c.length>0?"\u2714":"\u2718"} ${c?`Processed: ${V.basename(c)}`:"Processed: File Not Found"}`:R=`${ue!=="..."?"\u2714":"\u2718"} Read: ${c?`${V.basename(c)} \u2192 ${ue!=="..."?`Lines ${j} - ${Ge} of ${ue}`:"File Not Found"}`:"File Not Found"}`}}else if(a==="list_files"||a==="read_folder"){let c=a==="list_files"?"List":"Browsed",C=D(y.args).path||null,L=D(y.args).recurse||1;R=`${C?"\u2714":"\u2718"} ${c}: ${C?`${C==="."?`./${L>1?"*":""}`:`${C.replaceAll("\\","/")}${L>1?`${C.endsWith("/")?"*":"/*"}`:`${C.endsWith("/")?"":"/"}`}`}`:"No Folder Selected"}`}else if(a==="find_file"){let c=D(y.args),C=c.basename||c.name||c.path||c.file||c.query||"";R=`${C?"\u2714":"\u2718"} Located: ${C||"No Query"}`}else if(a==="write_file"||a==="update_file"){let c=a==="write_file"?"Created":"Edited",C=D(y.args),L=C.path||null,se=Object.entries(C).some(([Z,le])=>Z.startsWith("searchContent")&&typeof le=="string"&&le.startsWith("^LINE:"))?"\u1361":":";R=`${L?"\u2714":"\u2718"} ${c}${se} ${L?L.replaceAll("\\","/"):"No File Changes"}`}else if(a==="write_pdf"){let c=D(y.args).path||null;R=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No PDF Generated"}`}else if(a==="write_docx"){let c=D(y.args).path||null;R=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No Docx Generated"}`}else if(a==="file_map"){let c=D(y.args).path;R=`${c?"\u2714":"\u2718"} Indexed: ${c.replaceAll("\\","/")?""+c:"File Not Found"}`}else if(a.toLowerCase()==="search_keyword"||a.toLowerCase()==="todo")R="";else if(a.toLowerCase()==="generate_image"){let{path:c,outputPath:C,output:L}=D(y.args);R=`\u2714 Generated: ${c||C||L||"generated_image.png"}`}else if(a==="invoke_sync"||a==="InvokeSync"){let c=Kn(a,y.args);R=`\u2714 Called Generalist${c?`: ${c}`:""}`}else if(a==="Invoke"||a==="InvokeAsync"||a==="invoke"){let c=Kn(a,y.args);R=`\u2714 Started Generalist${c?`: ${c}`:""}`}else if(a==="get_progress"||a==="GetProgress"){let c=Kn(a,y.args);R=`\u2714 Checked${c?`: ${c}`:""}`}else if(a==="cancel"){let c=Kn(a,y.args);R=`\u{1F6C7} Cancelled${c?`: ${c}`:""}`}else if(a==="steer"||a==="Steer"){let c=Kn(a,y.args);R=`\u2714 Steered${c?`: ${c}`:""}`}else if(a==="EmergencyRollback"){let{method:c}=D(y.args);R=c==="forceRevert"?"":"\u2714 Rollback Point Checked"}else if(a==="await"||a==="Await"||a==="wait"||a==="Wait"){let{time:c,timeout:C,seconds:L,sec:re}=D(y.args),se=parseFloat(L||re||C||c)||45,Z=a==="wait"||a==="Wait"?120:180;se<10&&(se=10),se>Z&&(se=Z);let le=j=>{if(j>=60){let F=Math.floor(j/60),ue=j%60;return`${F}m${ue>0?` ${ue}s`:""}`}return`${j}s`},ke=["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"];R=`\u2714 ${ke[Math.floor(Math.random()*ke.length)]} \u2192 ${le(se)}`}else a==="Answer"||a==="answer"?R="\u2714 Resolved Sub-Agent Query":a==="exec_command"||a==="ask"?R="":R=`Executed: ${y.toolName}`;if(yield*rn(),a==="exec_command"){let{command:c}=D(y.args);if(c&&n.systemSettings&&n.systemSettings.allowExternalAccess===!1){let C=[/[a-zA-Z]:[\\\/]/i,/^\//,/\.\.[\\\/]/,/\/etc\//,/\/var\//,/\/root\//,/\/bin\//,/\/usr\//],L=V.resolve(process.cwd()).substring(0,3).toLowerCase(),re=J=>{let j=[],F="",ue=null;for(let Ge=0;Ge<J.length;Ge++){let O=J[Ge];ue?(O===ue&&(ue=null),F+=O):O==='"'||O==="'"?(ue=O,F+=O):O==="&"&&J[Ge+1]==="&"||O==="|"&&J[Ge+1]==="|"?(F.trim()&&(j.push(F.trim()),F=""),Ge++):O===";"||O==="|"||O==="&"?F.trim()&&(j.push(F.trim()),F=""):F+=O}return F.trim()&&j.push(F.trim()),j},se=J=>{let j=[],F="",ue=null;for(let Ge=0;Ge<J.length;Ge++){let O=J[Ge];ue?(O===ue&&(ue=null),F+=O):O==='"'||O==="'"?(ue=O,F+=O):/\s/.test(O)?F&&(j.push(F),F=""):F+=O}return F&&j.push(F),j},Z=J=>{let j=J.replace(/^['"]|['"]$/g,"").trim();return!j||process.platform==="win32"&&/^\/[a-zA-Z0-9?]+$/.test(j)?!1:C.some(F=>{if(F.source==="[a-zA-Z]:[\\\\\\/]"){let ue=j.match(/[a-zA-Z]:[\\\/]/i);return ue&&ue[0].toLowerCase()!==L}return F.test(j)})};if(re(c).some(J=>{let j=se(J);if(j.length===0)return!1;let F=j[0].replace(/^['"]|['"]$/g,"").toLowerCase();if(["echo","printf","write-output"].includes(F)){let Ge=!1;return j.some(O=>{let bt=O.replace(/^['"]|['"]$/g,"");if(bt===">"||bt===">>"||bt==="<")return Ge=!0,!1;if(bt.startsWith(">")||bt.startsWith("<")){let St=bt.replace(/^[><]+/,"");return Z(St)}return Ge?(Ge=!1,Z(O)):!1})}return j.some(Ge=>Z(Ge))})){let J='Access Denied. Prohibited from accessing external directories while "External Workspace Access" is disabled.';n.onExecStart&&n.onExecStart(c||"No Command"),yield{type:"exec_start"},await new Promise(j=>setTimeout(j,50)),n.onExecChunk&&n.onExecChunk(`ERROR: ${J}`),await new Promise(j=>setTimeout(j,50)),n.onExecEnd&&n.onExecEnd(),je.push({role:"user",text:`[ACTION RESULT]: ERROR: ${J}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${J}`},Tt++;continue}}n.onExecStart&&n.onExecStart(c||"No Command"),yield{type:"exec_start"}}let dt=D(y.args),pn=dt.path||dt.targetPath||null;if(pn){let c=n.systemSettings&&n.systemSettings.allowExternalAccess===!1,C=V.resolve(pn),L=V.resolve(process.cwd());if(c&&!C.startsWith(L)){let re="Access Denied. You are not allowed to access files outside the current workspace.";if(a==="write_file"||a==="update_file"){let Z=`\u2718 ${a==="write_file"?"Write Canceled":"Edit Canceled"}: ${dt.path||"..."}`,le=115;process.stdout.isTTY&&(le=process.stdout.columns-5||120);let ke=Math.min(Z.length+4,le),J=`${Z.padEnd(ke-2).substring(0,ke-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
692
692
  `:""}${J}
693
- `)},Oe=!1}je.push({role:"user",text:`[ACTION RESULT]: ERROR: ${re}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${re}`},Tt++;continue}}if(n.onToolApproval){let c=n.systemSettings||{},C=c.autoExec,L=!1,re="";if(a==="view_file"){let Z=D(y.args);if(re=Z.path||Z.targetPath||Z.file||"",re){let le=c.alwaysAskFiles||".env, .env.*, *.env";Gs(re,le)&&(L=!0)}}if(a==="write_file"||a==="update_file"||a==="exec_command"||L){let Z=null,le=!1,ke=!1,J=!1,j=!1;if(L)le=!0,Z=null;else if(a==="exec_command"){let{command:_e}=D(y.args),he=(_e||"").trim(),Pe=($e=>{let ot=[],it="",He=null;for(let Ae=0;Ae<$e.length;Ae++){let K=$e[Ae];He?(K===He&&(He=null),it+=K):K==='"'||K==="'"?(He=K,it+=K):K==="&"&&$e[Ae+1]==="&"||K==="|"&&$e[Ae+1]==="|"?(it.trim()&&(ot.push(it.trim()),it=""),Ae++):K===";"||K==="|"||K==="&"?it.trim()&&(ot.push(it.trim()),it=""):it+=K}return it.trim()&&ot.push(it.trim()),ot.length>0?ot:[$e]})(he),Te=($e,ot)=>{if(!ot)return!1;let it=ot.split(",").map(Ae=>Ae.trim().toLowerCase()).filter(Boolean),He=$e.toLowerCase();return it.some(Ae=>{if(He===Ae)return!0;if(He.startsWith(Ae)){let K=He.charAt(Ae.length);return/\s|[;&|/]/.test(K)}return!1})},ze=Pe.some($e=>Te($e,c.alwaysAskCommands)),Gt=Pe.some($e=>Te($e,c.autoDisallowCommands)),qe=Pe.length>0&&Pe.every($e=>Te($e,c.autoApproveCommands)||c.autoApproveGit&&/^git\s+commit\b/i.test($e));if(Gt)Z="deny";else if(c.networkAccess===!1){let ot=he.trim().replace(/\s+/g," ").replace(/^['"]+|['"]+$/g,"").toLowerCase().split(" "),He=ot[0].split("/").pop().split("\\").pop().replace(/\.exe$/,""),Ae=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"]),K=!1;Ae.has(He)&&(K=!0);let Mt=to=>ot.slice(1).some(xn=>to.includes(xn)),yn=to=>{let xn=ot.findIndex(An=>to.includes(An)),Un=ot.findIndex(An=>["run","exec","test"].includes(An));return xn!==-1&&!(Un!==-1&&Un<xn)};He==="git"&&Mt(["clone","pull","push","fetch"])&&(K=!0),He==="go"&&Mt(["get","install"])&&(K=!0),He==="npm"&&yn(["install","i","update","add"])&&(K=!0),He==="yarn"&&yn(["add","install","upgrade"])&&(K=!0),He==="pnpm"&&yn(["add","install","update"])&&(K=!0),He==="bun"&&yn(["add","install","update"])&&(K=!0),He==="deno"&&Mt(["install","add"])&&(K=!0),He==="pip"&&Mt(["install","download"])&&(K=!0),He==="pip3"&&Mt(["install","download"])&&(K=!0),He==="cargo"&&Mt(["install","add"])&&(K=!0),["bash","sh","zsh","fish"].includes(He)&&Mt(["-c"])&&(K=!0),He==="cmd"&&Mt(["/c"])&&(K=!0),K&&(Z="deny",J=!0)}!Z&&ze?le=!0:!Z&&!le&&(qe||c.autoApproveGit&&/^git\s+commit\b/i.test(he))&&(Z="allow"),!le&&!Z&&C&&(Z="allow")}else if(a==="write_file"||a==="update_file"){let _e=!1;if(a==="write_file"&&c.overwriteProtection!==!1&&C)try{let{path:he}=D(y.args);he&&Ce.existsSync(V.resolve(process.cwd(),he))&&(_e=!0,j=!0)}catch{}C&&!_e&&(Z="allow")}let F=Z,ue="";Z==="deny"&&(J?ue="network":ke?ue="settings":ue="prohibited");let Ge=!1,O="",bt=[],St=0,mo=!1,Ut="";if(!F&&n.onToolApproval)try{let _e=await n.onToolApproval(a,y.args,{checkOnly:!0});j&&_e==="allow"||(_e==="allow"||_e==="deny")&&(F=_e,F==="deny"&&(ue="user"))}catch{}if(!F){if(!j&&(a==="write_file"||a==="update_file"))try{let Se=D(y.args),{path:Pe}=Se;if(Pe){let{resolvedPath:Te}=ln(Pe);Pe=Te;let ze=V.resolve(process.cwd(),Pe),Gt=Ae=>Ae?Ae.toLowerCase().replace(/\\/g,"/").replace(/^[a-z]:/,K=>K.toUpperCase()):"",qe=Gt(ze),$e="",ot=!1,it=await Hn(),He=Gt(it?.file_focused);if(it&&He===qe&&it.full_content?($e=it.full_content,ot=!0):Ce.existsSync(ze)&&($e=Ce.readFileSync(ze,"utf8"),ot=!0),O=$e,await oi.recordFileChange(ze,$e),ot){let Ae=$e;if(a==="write_file"){let K=Se.content||Se.newContent||"";Ae=K.endsWith(`
693
+ `)},Oe=!1}je.push({role:"user",text:`[ACTION RESULT]: ERROR: ${re}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${re}`},Tt++;continue}}if(n.onToolApproval){let c=n.systemSettings||{},C=c.autoExec,L=!1,re="";if(a==="view_file"){let Z=D(y.args);if(re=Z.path||Z.targetPath||Z.file||"",re){let le=c.alwaysAskFiles||".env, .env.*, *.env";Hs(re,le)&&(L=!0)}}if(a==="write_file"||a==="update_file"||a==="exec_command"||L){let Z=null,le=!1,ke=!1,J=!1,j=!1;if(L)le=!0,Z=null;else if(a==="exec_command"){let{command:_e}=D(y.args),he=(_e||"").trim(),Pe=($e=>{let ot=[],it="",He=null;for(let Ae=0;Ae<$e.length;Ae++){let K=$e[Ae];He?(K===He&&(He=null),it+=K):K==='"'||K==="'"?(He=K,it+=K):K==="&"&&$e[Ae+1]==="&"||K==="|"&&$e[Ae+1]==="|"?(it.trim()&&(ot.push(it.trim()),it=""),Ae++):K===";"||K==="|"||K==="&"?it.trim()&&(ot.push(it.trim()),it=""):it+=K}return it.trim()&&ot.push(it.trim()),ot.length>0?ot:[$e]})(he),Te=($e,ot)=>{if(!ot)return!1;let it=ot.split(",").map(Ae=>Ae.trim().toLowerCase()).filter(Boolean),He=$e.toLowerCase();return it.some(Ae=>{if(He===Ae)return!0;if(He.startsWith(Ae)){let K=He.charAt(Ae.length);return/\s|[;&|/]/.test(K)}return!1})},ze=Pe.some($e=>Te($e,c.alwaysAskCommands)),Gt=Pe.some($e=>Te($e,c.autoDisallowCommands)),qe=Pe.length>0&&Pe.every($e=>Te($e,c.autoApproveCommands)||c.autoApproveGit&&/^git\s+commit\b/i.test($e));if(Gt)Z="deny";else if(c.networkAccess===!1){let ot=he.trim().replace(/\s+/g," ").replace(/^['"]+|['"]+$/g,"").toLowerCase().split(" "),He=ot[0].split("/").pop().split("\\").pop().replace(/\.exe$/,""),Ae=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"]),K=!1;Ae.has(He)&&(K=!0);let Mt=to=>ot.slice(1).some(xn=>to.includes(xn)),yn=to=>{let xn=ot.findIndex(An=>to.includes(An)),Un=ot.findIndex(An=>["run","exec","test"].includes(An));return xn!==-1&&!(Un!==-1&&Un<xn)};He==="git"&&Mt(["clone","pull","push","fetch"])&&(K=!0),He==="go"&&Mt(["get","install"])&&(K=!0),He==="npm"&&yn(["install","i","update","add"])&&(K=!0),He==="yarn"&&yn(["add","install","upgrade"])&&(K=!0),He==="pnpm"&&yn(["add","install","update"])&&(K=!0),He==="bun"&&yn(["add","install","update"])&&(K=!0),He==="deno"&&Mt(["install","add"])&&(K=!0),He==="pip"&&Mt(["install","download"])&&(K=!0),He==="pip3"&&Mt(["install","download"])&&(K=!0),He==="cargo"&&Mt(["install","add"])&&(K=!0),["bash","sh","zsh","fish"].includes(He)&&Mt(["-c"])&&(K=!0),He==="cmd"&&Mt(["/c"])&&(K=!0),K&&(Z="deny",J=!0)}!Z&&ze?le=!0:!Z&&!le&&(qe||c.autoApproveGit&&/^git\s+commit\b/i.test(he))&&(Z="allow"),!le&&!Z&&C&&(Z="allow")}else if(a==="write_file"||a==="update_file"){let _e=!1;if(a==="write_file"&&c.overwriteProtection!==!1&&C)try{let{path:he}=D(y.args);he&&Ce.existsSync(V.resolve(process.cwd(),he))&&(_e=!0,j=!0)}catch{}C&&!_e&&(Z="allow")}let F=Z,ue="";Z==="deny"&&(J?ue="network":ke?ue="settings":ue="prohibited");let Ge=!1,O="",bt=[],St=0,ho=!1,Ut="";if(!F&&n.onToolApproval)try{let _e=await n.onToolApproval(a,y.args,{checkOnly:!0});j&&_e==="allow"||(_e==="allow"||_e==="deny")&&(F=_e,F==="deny"&&(ue="user"))}catch{}if(!F){if(!j&&(a==="write_file"||a==="update_file"))try{let Se=D(y.args),{path:Pe}=Se;if(Pe){let{resolvedPath:Te}=ln(Pe);Pe=Te;let ze=V.resolve(process.cwd(),Pe),Gt=Ae=>Ae?Ae.toLowerCase().replace(/\\/g,"/").replace(/^[a-z]:/,K=>K.toUpperCase()):"",qe=Gt(ze),$e="",ot=!1,it=await Hn(),He=Gt(it?.file_focused);if(it&&He===qe&&it.full_content?($e=it.full_content,ot=!0):Ce.existsSync(ze)&&($e=Ce.readFileSync(ze,"utf8"),ot=!0),O=$e,await ii.recordFileChange(ze,$e),ot){let Ae=$e;if(a==="write_file"){let K=Se.content||Se.newContent||"";Ae=K.endsWith(`
694
694
  `)?K:K+`
695
- `,Ut=Ae}else{let{patchPairs:K,allowMultiple:Mt,error:yn}=ji(Se);if(yn){let Ht=`[ACTION RESULT]: ERROR: ${yn}`;je.push({role:"user",text:Ht}),await vt("toolFailure"),n.onToolResult&&n.onToolResult("failure",a),yield{type:"tool_result",content:Ht,toolName:a},Tt++;continue}let to=Se.allowMultiple!==void 0?Se.allowMultiple===!0||String(Se.allowMultiple).toLowerCase()==="true":Mt;St=K.length;let xn=js($e,K,{allowMultiple:to});Ae=xn.content,Ut=Ae,bt=xn.results;let Un=bt.filter(Ht=>Ht.success),An=bt.filter(Ht=>!Ht.success);if(Un.length===0){let Ht=`[ACTION RESULT]: ERROR: Failed to apply patches to [${V.basename(ze)}].
695
+ `,Ut=Ae}else{let{patchPairs:K,allowMultiple:Mt,error:yn}=ji(Se);if(yn){let Ht=`[ACTION RESULT]: ERROR: ${yn}`;je.push({role:"user",text:Ht}),await vt("toolFailure"),n.onToolResult&&n.onToolResult("failure",a),yield{type:"tool_result",content:Ht,toolName:a},Tt++;continue}let to=Se.allowMultiple!==void 0?Se.allowMultiple===!0||String(Se.allowMultiple).toLowerCase()==="true":Mt;St=K.length;let xn=Ks($e,K,{allowMultiple:to});Ae=xn.content,Ut=Ae,bt=xn.results;let Un=bt.filter(Ht=>Ht.success),An=bt.filter(Ht=>!Ht.success);if(Un.length===0){let Ht=`[ACTION RESULT]: ERROR: Failed to apply patches to [${V.basename(ze)}].
696
696
  ${An.map(Cn=>` \u2022 ${Cn.error}`).join(`
697
- `)}`,qo=`\u2714 Edited: ${V.basename(ze.replaceAll("\\","/"))}`,po=115;process.stdout.isTTY&&(po=process.stdout.columns-5||120);let Li=Math.min(qo.length+4,po),an=`${qo.padEnd(Li-2).substring(0,Li-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
697
+ `)}`,Yo=`\u2714 Edited: ${V.basename(ze.replaceAll("\\","/"))}`,yo=115;process.stdout.isTTY&&(yo=process.stdout.columns-5||120);let Oi=Math.min(Yo.length+4,yo),an=`${Yo.padEnd(Oi-2).substring(0,Oi-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
698
698
  `:""}${an}`)},Oe=!1,je.push({role:"user",text:Ht}),await vt("toolFailure"),n.onToolResult&&n.onToolResult("failure",a),yield{type:"tool_result",content:Ht,toolName:a},Tt++;continue}}yield{type:"status",content:`Opening Diff in IDE: ${V.basename(ze)}`},Qi(ze,$e,Ae),Ge=!0,await new Promise(K=>setTimeout(K,50))}else if(a==="write_file"){let Ae=Se.content||Se.newContent||"",K=Ae.endsWith(`
699
699
  `)?Ae:Ae+`
700
- `;Ut=K,Ce.existsSync(ze)||(mo=!0,Ce.mkdirSync(V.dirname(ze),{recursive:!0}),Ce.writeFileSync(ze,"","utf8")),yield{type:"status",content:`Opening New File Diff in IDE: ${V.basename(ze)}`},Qi(ze,"",K),Ge=!0,await new Promise(Mt=>setTimeout(Mt,50))}}}catch(Se){console.error("Simulation/Diff Error:",Se)}let _e=null;Ji(Se=>{_e=Se});let he=n.onToolApproval;if(F=await new Promise(async Se=>{let Pe=setInterval(()=>{if(_e){let Te=n.onIDEApproval||Do&&Do.onIDEApproval;Te&&Te(_e),clearInterval(Pe),Se(_e)}},100);try{let Te=await he(a,y.args,{isOverwritePrompt:j});clearInterval(Pe),Se(Te)}catch{clearInterval(Pe),Se("deny")}}),Ji(null),a==="write_file"||a==="update_file"){let Se=D(y.args),{path:Pe}=Se;if(Pe){let{resolvedPath:Te}=ln(Pe);Pe=Te;let ze=V.resolve(process.cwd(),Pe);if(hr(ze,F),F==="deny"&&mo&&Ce.existsSync(ze))try{Ce.unlinkSync(ze)}catch{}}}F==="deny"&&(ue="user")}if(F==="allow"&&Ge&&ro()){let _e=D(y.args),{path:he}=_e,{resolvedPath:Se,isTildeResolved:Pe}=ln(he);he=Se;let Te=V.resolve(process.cwd(),he),ze=Ke=>Ke?V.resolve(Ke).replace(/\\/g,"/").toLowerCase():"",Gt=await Hn(),qe="";if(Gt&&Gt.file_focused&&ze(Gt.file_focused)===ze(Te)&&Gt.full_content&&(qe=Gt.full_content),!qe&&Ce.existsSync(Te)){let Ke=Ce.readFileSync(Te,"utf8");Ke&&(qe=Ke)}!qe&&Ut&&(qe=Ut),(qe||mo)&&Ce.writeFileSync(Te,qe,"utf8");let $e=qe.split(/\r?\n/),ot=$e.length,it=Buffer.byteLength(qe,"utf8"),He="";O&&(He=`Old File contents:
700
+ `;Ut=K,Ce.existsSync(ze)||(ho=!0,Ce.mkdirSync(V.dirname(ze),{recursive:!0}),Ce.writeFileSync(ze,"","utf8")),yield{type:"status",content:`Opening New File Diff in IDE: ${V.basename(ze)}`},Qi(ze,"",K),Ge=!0,await new Promise(Mt=>setTimeout(Mt,50))}}}catch(Se){console.error("Simulation/Diff Error:",Se)}let _e=null;Ji(Se=>{_e=Se});let he=n.onToolApproval;if(F=await new Promise(async Se=>{let Pe=setInterval(()=>{if(_e){let Te=n.onIDEApproval||No&&No.onIDEApproval;Te&&Te(_e),clearInterval(Pe),Se(_e)}},100);try{let Te=await he(a,y.args,{isOverwritePrompt:j});clearInterval(Pe),Se(Te)}catch{clearInterval(Pe),Se("deny")}}),Ji(null),a==="write_file"||a==="update_file"){let Se=D(y.args),{path:Pe}=Se;if(Pe){let{resolvedPath:Te}=ln(Pe);Pe=Te;let ze=V.resolve(process.cwd(),Pe);if(yr(ze,F),F==="deny"&&ho&&Ce.existsSync(ze))try{Ce.unlinkSync(ze)}catch{}}}F==="deny"&&(ue="user")}if(F==="allow"&&Ge&&lo()){let _e=D(y.args),{path:he}=_e,{resolvedPath:Se,isTildeResolved:Pe}=ln(he);he=Se;let Te=V.resolve(process.cwd(),he),ze=Ke=>Ke?V.resolve(Ke).replace(/\\/g,"/").toLowerCase():"",Gt=await Hn(),qe="";if(Gt&&Gt.file_focused&&ze(Gt.file_focused)===ze(Te)&&Gt.full_content&&(qe=Gt.full_content),!qe&&Ce.existsSync(Te)){let Ke=Ce.readFileSync(Te,"utf8");Ke&&(qe=Ke)}!qe&&Ut&&(qe=Ut),(qe||ho)&&Ce.writeFileSync(Te,qe,"utf8");let $e=qe.split(/\r?\n/),ot=$e.length,it=Buffer.byteLength(qe,"utf8"),He="";O&&(He=`Old File contents:
701
701
  ${O.split(/\r?\n/).map((et,tn)=>`${tn+1} | ${et}`).join(`
702
702
  `)}
703
703
 
@@ -708,7 +708,7 @@ ${O.split(/\r?\n/).map((et,tn)=>`${tn+1} | ${et}`).join(`
708
708
 
709
709
  ... [${ot-100} lines truncated for history stability] ...
710
710
 
711
- ${et}`}let K="";if(a==="update_file"){let Ke=Vs(O,qe,bt,12,n?.compressToolResults||Do?.systemSettings?.compressToolResults),{patchPairs:et}=ji(D(y.args)),tn=et?.length||St||1,Ct=0,jt=0,vn=[];et&&et.length>0?et.forEach((En,Oi)=>{let Xo=En.replace||"",nn=En.new||"",Di=Xo.trim(),xo=nn.trim(),Da=!!Ut&&qe===Ut,Na=xo?qe.includes(nn)||qe.includes(xo):!0,Fa=nn?O.includes(nn)||!!xo&&O.includes(xo):!1,Ba=Di?qe.includes(Xo)||qe.includes(Di):!1;Da||!!nn&&Na&&(!Fa||!Ba||Di===xo)?Ct++:(jt++,vn.push(` \u2022 Block ${Oi+1}: not applied (reverted or rejected in IDE).`))}):Ct=St||0;let wn=0;if(Ut&&qe!==Ut){let En=al("","",Ut||"",qe||"","","",{context:0});if(En&&En.hunks)for(let Oi of En.hunks){let Xo=Oi.lines.filter(nn=>nn.startsWith("+")).map(nn=>nn.slice(1).trim()).filter(Boolean);for(let nn of Xo)O.includes(nn)||wn++}}let ho=[`[${Ct}/${tn}] applied`];jt>0&&ho.push(`${jt} rejected by user`),wn>0&&ho.push(`${wn} manual ${wn===1?"modification":"modifications"} by user`);let no=ho.join(", "),Rn=vn.length>0?`
711
+ ${et}`}let K="";if(a==="update_file"){let Ke=zs(O,qe,bt,12,n?.compressToolResults||No?.systemSettings?.compressToolResults),{patchPairs:et}=ji(D(y.args)),tn=et?.length||St||1,Ct=0,jt=0,vn=[];et&&et.length>0?et.forEach((En,io)=>{let so=En.replace||"",nn=En.new||"",Di=so.trim(),wo=nn.trim(),Na=!!Ut&&qe===Ut,Fa=wo?qe.includes(nn)||qe.includes(wo):!0,Ba=nn?O.includes(nn)||!!wo&&O.includes(wo):!1,Wa=Di?qe.includes(so)||qe.includes(Di):!1;Na||!!nn&&Fa&&(!Ba||!Wa||Di===wo)?Ct++:(jt++,vn.push(` \u2022 Block ${io+1}: not applied (reverted or rejected in IDE).`))}):Ct=St||0;let wn=0;if(Ut&&qe!==Ut){let En=cl("","",Ut||"",qe||"","","",{context:0});if(En&&En.hunks)for(let io of En.hunks){let so=io.lines.filter(nn=>nn.startsWith("+")).map(nn=>nn.slice(1).trim()).filter(Boolean);for(let nn of so)O.includes(nn)||wn++}}let xo=[`[${Ct}/${tn}] applied`];jt>0&&xo.push(`${jt} rejected by user`),wn>0&&xo.push(`${wn} manual ${wn===1?"modification":"modifications"} by user`);let no=xo.join(", "),Rn=vn.length>0?`
712
712
 
713
713
  User Review Details:
714
714
  ${vn.join(`
@@ -716,12 +716,12 @@ ${vn.join(`
716
716
 
717
717
  ${Ke}${Pe?`
718
718
 
719
- [Note: '~' resolved to user home directory. To target literal '~' in current directory, escape it as '\\~']`:""}`;let{added:Yo,removed:yo}=Ks(O,qe);(Yo>0||yo>0)&&await Ui({added:Yo,removed:yo,file:he})}else{let Ke=qe.split(/\r?\n/),et=Ke.length,tn=Buffer.byteLength(qe,"utf8"),Ct="",jt=c?.overwriteProtection!==!1;if(O){let no=O.split(/\r?\n/);if(!jt)Ct="";else if(no.length<=50)Ct=`Old File contents:
719
+ [Note: '~' resolved to user home directory. To target literal '~' in current directory, escape it as '\\~']`:""}`;let{added:Xo,removed:Jo}=Vs(O,qe);(Xo>0||Jo>0)&&await Ui({added:Xo,removed:Jo,file:he})}else{let Ke=qe.split(/\r?\n/),et=Ke.length,tn=Buffer.byteLength(qe,"utf8"),Ct="",jt=c?.overwriteProtection!==!1;if(O){let no=O.split(/\r?\n/);if(!jt)Ct="";else if(no.length<=50)Ct=`Old File contents:
720
720
  ${no.map((Rn,oo)=>`${oo+1} | ${Rn}`).join(`
721
721
  `)}
722
722
 
723
- `;else{let Rn=V.parse(Te),oo=V.join(Bs,"OverwriteBackups");if(!Ce.existsSync(oo))try{Ce.mkdirSync(oo,{recursive:!0})}catch{}let Yo=`${Rn.name}-old-${Date.now()}${Rn.ext}.bak`,yo=V.join(oo,Yo);try{Ce.writeFileSync(yo,O,"utf8")}catch{}Ct=`Old File contents:
724
- - Renamed old file as ${yo} and written requested content in ${he}. For reversal use Run
723
+ `;else{let Rn=V.parse(Te),oo=V.join(Ws,"OverwriteBackups");if(!Ce.existsSync(oo))try{Ce.mkdirSync(oo,{recursive:!0})}catch{}let Xo=String(Date.now()).slice(-5),Jo=ll.randomBytes(2).toString("hex"),En=`${Rn.name}-old-${Xo}-${Jo}${Rn.ext}.bak`,io=V.join(oo,En);try{Ce.writeFileSync(io,O,"utf8")}catch{}Ct=`Old File contents:
724
+ - Renamed old file as ${io.replaceAll("\\","/").replace(os.homedir().replaceAll("\\","/"),"~")} and written requested content in ${he}. For reversal use Run
725
725
 
726
726
  `}}let vn="";if(et<=690)vn=Ke.join(`
727
727
  `);else{let no=Ke.slice(0,300).join(`
@@ -736,8 +736,8 @@ ${Rn}`}let wn=Pe?`
736
736
  - Stats: [${et} lines, ${(tn/1024).toFixed(1)} KB]
737
737
  ${Ct}- Content Preview:
738
738
 
739
- ${vn}${wn}`;let ho=O?O.split(/\r?\n/).length:0;await Ui({added:et,removed:ho,file:he})}let Mt=a==="write_file"?"Created":"Edited",yn=D(y.args),xn=Object.entries(yn).some(([Ke,et])=>Ke.startsWith("searchContent")&&typeof et=="string"&&et.startsWith("^LINE:"))?"\u1361":":",Un=`${he?"\u2714":"\u2718"} ${Mt}${xn} ${he?he.replaceAll("\\","/"):"No File Changes"}`,An=115;process.stdout.isTTY&&(An=process.stdout.columns-5||120);let Ht=Math.min(Un.length+4,An),qo=`${Un.padEnd(Ht-2).substring(0,Ht-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
740
- `:""}${qo}`)},Oe=!1;let po=Date.now();Nn=po,yield{type:"tool_time",content:po-T};let an=(K||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");an.includes("[[VERIFIED]]")&&(an=an.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to conserve context.
739
+ ${vn}${wn}`;let xo=O?O.split(/\r?\n/).length:0;await Ui({added:et,removed:xo,file:he})}let Mt=a==="write_file"?"Created":"Edited",yn=D(y.args),xn=Object.entries(yn).some(([Ke,et])=>Ke.startsWith("searchContent")&&typeof et=="string"&&et.startsWith("^LINE:"))?"\u1361":":",Un=`${he?"\u2714":"\u2718"} ${Mt}${xn} ${he?he.replaceAll("\\","/"):"No File Changes"}`,An=115;process.stdout.isTTY&&(An=process.stdout.columns-5||120);let Ht=Math.min(Un.length+4,An),Yo=`${Un.padEnd(Ht-2).substring(0,Ht-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
740
+ `:""}${Yo}`)},Oe=!1;let yo=Date.now();Nn=yo,yield{type:"tool_time",content:yo-T};let an=(K||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");an.includes("[[VERIFIED]]")&&(an=an.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to conserve context.
741
741
  `));let Cn;if(a==="write_file"&&!an.startsWith("ERROR:")){let Ke=an.replace(/^\[\[SAME\]\]\s*\r?\n?/,""),et=Ke.match(/\n\s*(\[Note:\s*'~'\s*resolved\s*to\s*user\s*home\s*directory[\s\S]*?\])\s*$/),tn=et?`
742
742
 
743
743
  ${et[1]}`:"";if(/- Stats:.*\r?\nOld File contents:/s.test(Ke)){let Ct=Ke.search(/^- Content Preview:/m);Cn=`[ACTION RESULT]: ${Ct!==-1?Ke.slice(0,Ct).trimEnd():Ke}
@@ -752,7 +752,7 @@ ${et[1]}`:"";if(/- Stats:.*\r?\nOld File contents:/s.test(Ke)){let Ct=Ke.search(
752
752
  `:""}${ze}
753
753
  `)},Oe=!1}a==="exec_command"&&(await new Promise(he=>setTimeout(he,50)),n.onExecChunk&&n.onExecChunk(`ERROR: ${_e}`),await new Promise(he=>setTimeout(he,50)),n.onExecEnd&&n.onExecEnd()),je.push({role:"user",text:`[ACTION RESULT]: DENIED: ${_e}`}),yield{type:"tool_result",content:`[ACTION RESULT]: DENIED: ${_e}`},await vt("toolDenied"),n.onToolResult&&n.onToolResult("denied",a),Tt++;continue}}}if(R){let c=115;process.stdout.isTTY&&(c=process.stdout.columns-5||120);let C=!1,L=Math.min(R.length+4,c),re=`${R.padEnd(L-2).substring(0,L-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
754
754
  `:""}${re}${R.includes("\u2714")&&(R.includes("Created")||R.includes("Edited"))?"":`${C?"":`
755
- `}`}`)},Oe=!1}if(Nn>0){let c=Date.now()-Nn,C=Math.max(0,1e3-c);C>0&&await new Promise(L=>setTimeout(L,C))}let _t={chatId:g,history:t,onChunk:c=>n.onExecChunk?n.onExecChunk(c):null,onAskUser:n.onAskUser,systemSettings:n.systemSettings,mode:l,isMultiModal:nt(ee),onVisualFeedback:n.onVisualFeedback,onSubagentUpdate:n.onSubagentUpdate,onTokenChunk:n.onTokenChunk,modelName:ee,aiProvider:n.aiProvider,apiKey:n.apiKey,onUsage:n.onUsage};if(a==="write_file"||a==="update_file")try{let{path:c}=D(y.args);if(c){let C=V.resolve(process.cwd(),c),L=await Hn();L&&L.file_focused===C&&L.full_content&&(_t.forcedContent=L.full_content)}}catch{}ce.push(a);let ne=await us(a,y.args,_t);if((a==="write_file"||a==="update_file")&&!ne.startsWith("ERROR:")){let{path:c}=D(y.args);if(c){let{resolvedPath:C}=ln(c),L=V.resolve(process.cwd(),C);pr(L)}}process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07");let Ve=Date.now();Nn=Ve,yield{type:"tool_time",content:Ve-T},Dn=Ve;let ft=null;if(typeof ne=="object"&&ne.binaryPart&&(ft=ne.binaryPart,ne=ne.text),a==="search_keyword"){let{keyword:c,path:C}=D(y.args),L=typeof ne=="string"&&ne.startsWith("[GLOB]");L&&(ne=ne.slice(6).trimStart());let re=typeof ne=="string"&&ne.startsWith("[DIR]");re&&(ne=ne.slice(5).trimStart());let se=0;if(ne){let O=ne.match(/Found (\d+) match/i);O&&(se=parseInt(O[1]))}let Z=(C||"").trim().toLowerCase().replaceAll("\\","/"),le=Z==="#doc"||Z==="#docs"||Z==="#documentation"||Z.includes("#skill/global/fluxflow")||Z.includes("#skill/fluxflow")||Z.includes("#skills/fluxflow")||Z.includes("#skills/global/fluxflow"),ke,J=115;process.stdout.isTTY&&(J=process.stdout.columns-5||120);let j=Math.max(10,(J+5)/3),F=Math.max(10,(J+5)/4);if(le)ke=`${c?"\u2714":"\u2718"} Searched Documentation`;else{let O=C?C.replace(/[\/\\]+$/,""):null,bt=O&&O!=="."?`${L?C:re?`${O}/*`:O}`:"./",St=bt.length>F?`${bt.slice(0,F)}...`:bt;ke=`${c?"\u2714":"\u2718"} Searched: "${c?c.length>J/3?`${c.slice(0,j)}...`:c:""}" in "${St.replaceAll("\\","/")}" \u2192 ${se} Match${se===1?"":"es"}`}let ue=Math.min(ke.length+4,J),Ge=`${ke.padEnd(ue-2).substring(0,ue-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
755
+ `}`}`)},Oe=!1}if(Nn>0){let c=Date.now()-Nn,C=Math.max(0,1e3-c);C>0&&await new Promise(L=>setTimeout(L,C))}let _t={chatId:g,history:t,onChunk:c=>n.onExecChunk?n.onExecChunk(c):null,onAskUser:n.onAskUser,systemSettings:n.systemSettings,mode:l,isMultiModal:nt(ee),onVisualFeedback:n.onVisualFeedback,onSubagentUpdate:n.onSubagentUpdate,onTokenChunk:n.onTokenChunk,modelName:ee,aiProvider:n.aiProvider,apiKey:n.apiKey,onUsage:n.onUsage};if(a==="write_file"||a==="update_file")try{let{path:c}=D(y.args);if(c){let C=V.resolve(process.cwd(),c),L=await Hn();L&&L.file_focused===C&&L.full_content&&(_t.forcedContent=L.full_content)}}catch{}ce.push(a);let ne=await gs(a,y.args,_t);if((a==="write_file"||a==="update_file")&&!ne.startsWith("ERROR:")){let{path:c}=D(y.args);if(c){let{resolvedPath:C}=ln(c),L=V.resolve(process.cwd(),C);hr(L)}}process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07");let Ve=Date.now();Nn=Ve,yield{type:"tool_time",content:Ve-T},Dn=Ve;let ft=null;if(typeof ne=="object"&&ne.binaryPart&&(ft=ne.binaryPart,ne=ne.text),a==="search_keyword"){let{keyword:c,path:C}=D(y.args),L=typeof ne=="string"&&ne.startsWith("[GLOB]");L&&(ne=ne.slice(6).trimStart());let re=typeof ne=="string"&&ne.startsWith("[DIR]");re&&(ne=ne.slice(5).trimStart());let se=0;if(ne){let O=ne.match(/Found (\d+) match/i);O&&(se=parseInt(O[1]))}let Z=(C||"").trim().toLowerCase().replaceAll("\\","/"),le=Z==="#doc"||Z==="#docs"||Z==="#documentation"||Z.includes("#skill/global/fluxflow")||Z.includes("#skill/fluxflow")||Z.includes("#skills/fluxflow")||Z.includes("#skills/global/fluxflow"),ke,J=115;process.stdout.isTTY&&(J=process.stdout.columns-5||120);let j=Math.max(10,(J+5)/3),F=Math.max(10,(J+5)/4);if(le)ke=`${c?"\u2714":"\u2718"} Searched Documentation`;else{let O=C?C.replace(/[\/\\]+$/,""):null,bt=O&&O!=="."?`${L?C:re?`${O}/*`:O}`:"./",St=bt.length>F?`${bt.slice(0,F)}...`:bt;ke=`${c?"\u2714":"\u2718"} Searched: "${c?c.length>J/3?`${c.slice(0,j)}...`:c:""}" in "${St.replaceAll("\\","/")}" \u2192 ${se} Match${se===1?"":"es"}`}let ue=Math.min(ke.length+4,J),Ge=`${ke.padEnd(ue-2).substring(0,ue-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
756
756
  `:""}${Ge}
757
757
  `)},Oe=!1}if(a==="EmergencyRollback"){let{method:c}=D(y.args);if(c==="forceRevert"){let C=0;if(ne){let J=ne.match(/Total\s*:\s*(\d+)/i);J&&(C=parseInt(J[1]))}let re=ne&&ne.startsWith("ERROR:")?"\u2718 Emergency Rollback Failed":`\u2714 Emergency Rollback \u2192 ${C} file${C===1?"":"s"} processed`,se=115;process.stdout.isTTY&&(se=process.stdout.columns-5||120);let Z=!1,le=Math.min(re.length+4,se),ke=`${re.padEnd(le-2).substring(0,le-2)}`;yield{type:"visual_feedback",content:Rt(`${Oe?`
758
758
  `:""}${ke}${Z?"":`
@@ -774,7 +774,7 @@ ${C[1]}`:"";if(/- Stats:.*\r?\nOld File contents:/s.test(c)){let re=c.search(/^-
774
774
  `):C.slice(0,2).join(`
775
775
  `)}`}else en=`[ACTION RESULT]: ${wt}`;je.push({role:"user",text:en,binaryPart:ft}),Sn=!0;let fe=`[ACTION RESULT]: ${ne.replaceAll(`[[VERIFIED]]
776
776
  `,"").replaceAll(`
777
- [[/VERIFIED]]`,"")||""}`;(a==="view_file"||a==="web_scrape"||a==="file_map"||a==="search_keyword"||a==="get_progress"||a==="getprogress")&&(fe=`[ACTION RESULT]: ${R} (Context Locked for UI Clarity)`),yield{type:"tool_result",content:fe,aiContent:en,binaryPart:ft,toolName:a},a==="memory"&&!ne.startsWith("ERROR:")&&(yield{type:"memory_updated"}),Tt++}if(s==="Google"&&at&&Date.now()-Vo>=150){yield*rn();let y=fo(at);for(let T of y)yield T;at="",Vo=Date.now()}}f.usageMetadata&&(Jt=f.usageMetadata),Jt&&(yield{type:"liveTokens",content:Jt.totalTokenCount})}if(W&&(W=!1,Xe?pe+="</think_fluxflow>":(we+="</think_fluxflow>",s==="Google"?at+="</think_fluxflow>":yield{type:"text",content:"</think_fluxflow>"})),Xe&&pe.length>0){let f=0,S=Math.min(gt.length,pe.length);for(let G=S;G>0;G--)if(gt.endsWith(pe.substring(0,G))){f=G;break}let k=pe.substring(f);if(k){let ie=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(gt)?k.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):k.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(ie)if(we+=ie,s==="Google")at+=ie;else{yield*rn();let I=fo(ie);for(let H of I)yield H}}Xe=!1,pe=""}if(mn){let f=mn,S=(lt==="tool"||lt==="action")&&(f.startsWith("[tool:")||f.startsWith("[action:"));mn="",Zn=!1,lt=null,Wn=!1,eo=!1,S||(s==="Google"?at+=f:yield{type:"text",content:f})}if(yield*rn(),ut)break;let uo=(we||"").trim(),Ia=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(uo.toLowerCase())||/\[\[END\]\]/i.test(uo.toLowerCase()),Ma=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(uo.toLowerCase()),Pa=je.length>0||Lt!==null,$i=Ft(uo).trim(),$a=/(\p{Emoji_Presentation}|\p{Extended_Pictographic})$/u.test($i),La=/([.!?"'*_`|\]\)”’~~]+|\s|`{3}|[\u200B-\u200D\uFEFF])$/u.test($i.trim()),Oa=/[.!?}"'`’“”]$|```$/s.test($i)||La||$a;!Ia&&!Ma&&!Pa&&uo.length>0,be=!0,await vt("agent",s)}catch(Y){if(ut){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
777
+ [[/VERIFIED]]`,"")||""}`;(a==="view_file"||a==="web_scrape"||a==="file_map"||a==="search_keyword"||a==="get_progress"||a==="getprogress")&&(fe=`[ACTION RESULT]: ${R} (Context Locked for UI Clarity)`),yield{type:"tool_result",content:fe,aiContent:en,binaryPart:ft,toolName:a},a==="memory"&&!ne.startsWith("ERROR:")&&(yield{type:"memory_updated"}),Tt++}if(s==="Google"&&at&&Date.now()-zo>=150){yield*rn();let y=go(at);for(let T of y)yield T;at="",zo=Date.now()}}f.usageMetadata&&(Jt=f.usageMetadata),Jt&&(yield{type:"liveTokens",content:Jt.totalTokenCount})}if(W&&(W=!1,Xe?pe+="</think_fluxflow>":(we+="</think_fluxflow>",s==="Google"?at+="</think_fluxflow>":yield{type:"text",content:"</think_fluxflow>"})),Xe&&pe.length>0){let f=0,S=Math.min(gt.length,pe.length);for(let G=S;G>0;G--)if(gt.endsWith(pe.substring(0,G))){f=G;break}let k=pe.substring(f);if(k){let ie=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(gt)?k.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):k.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(ie)if(we+=ie,s==="Google")at+=ie;else{yield*rn();let I=go(ie);for(let H of I)yield H}}Xe=!1,pe=""}if(mn){let f=mn,S=(lt==="tool"||lt==="action")&&(f.startsWith("[tool:")||f.startsWith("[action:"));mn="",Zn=!1,lt=null,Wn=!1,eo=!1,S||(s==="Google"?at+=f:yield{type:"text",content:f})}if(yield*rn(),ut)break;let mo=(we||"").trim(),Ma=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(mo.toLowerCase())||/\[\[END\]\]/i.test(mo.toLowerCase()),Pa=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(mo.toLowerCase()),$a=je.length>0||Lt!==null,Li=Ft(mo).trim(),La=/(\p{Emoji_Presentation}|\p{Extended_Pictographic})$/u.test(Li),Oa=/([.!?"'*_`|\]\)”’~~]+|\s|`{3}|[\u200B-\u200D\uFEFF])$/u.test(Li.trim()),Da=/[.!?}"'`’“”]$|```$/s.test(Li)||Oa||La;!Ma&&!Pa&&!$a&&mo.length>0,be=!0,await vt("agent",s)}catch(Y){if(ut){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
778
778
 
779
779
  \x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(String(Y).includes("Incomplete JSON segment at the end")){W&&(W=!1,Xe?pe+="</think_fluxflow>":(we+="</think_fluxflow>",yield{type:"text",content:"</think_fluxflow>"})),be=!0,await vt("agent",s);break}if(W&&(W=!1,Xe?pe+="</think_fluxflow>":we+="</think_fluxflow>"),Xe&&pe.length>0){let mt=0,Ze=Math.min(gt.length,pe.length);for(let Wt=Ze;Wt>0;Wt--)if(gt.endsWith(pe.substring(0,Wt))){mt=Wt;break}let rt=pe.substring(mt);if(rt){let tt=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(gt)?rt.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):rt.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");tt&&(we+=tt)}Xe=!1,pe=""}let E=Y instanceof Error?(()=>{try{return JSON.parse(JSON.parse(Y.message).error.message).error.message}catch{return String(Y)}})():String(Y),st=new Date().toLocaleString(),de=V.join(Gn,"agent");Ce.existsSync(de)||Ce.mkdirSync(de,{recursive:!0}),Ce.appendFileSync(V.join(de,"error.log"),`ERROR [${st}]: ${E}
780
780
 
@@ -789,7 +789,7 @@ ${C[1]}`:"";if(/- Stats:.*\r?\nOld File contents:/s.test(c)){let re=c.search(/^-
789
789
 
790
790
  ${Ze}`}):x.push(rt)}):x.push({role:"user",text:Ze}),gt+=we}for(let Ze=mt/1e3;Ze>0&&!ut;Ze--)yield{type:"status",content:`Error Occured. Recovering Stream (${Qe}/${sn}) [Retrying in ${Ze.toFixed(0)}s]...`},await new Promise(rt=>setTimeout(rt,1e3));yield{type:"status",content:"Error Occured. Recovering Stream..."}}else throw new Error(`Stream collapsed too many times. (Failed to resolve ${sn} times)
791
791
  Error log can be found in \`/export logs\``);else{let Ze=e.split("/").slice(e.endsWith("/free")?-2:-1).join("/");if(Me<=sn){Me++,Qe=1,gt="";let rt=Math.min(1e3*Math.pow(2,Me-1),32e3),Wt=.8+Math.random()*.4,tt=Math.round(rt*Wt);kn=!0,yield{type:"status",content:`Trying to reach ${Ze} (${Me}/${sn}) [Retrying in ${(tt/1e3).toFixed(0)}s]`};for(let De=tt/1e3;De>0&&!ut;De--)yield{type:"status",content:`Trying to reach ${Ze} (${Me}/${sn}) [Retrying in ${De.toFixed(0)}s]`},await new Promise(at=>setTimeout(at,1e3));yield{type:"status",content:`Trying to reach ${Ze}`}}else throw new Error(`Model ${e} cannot be reached. (Failed ${sn} times)
792
- Error log can be found in \`/export logs\``)}}}if(Jt){let W=Jt.totalTokenCount||0,Y=Jt.cachedContentTokenCount||0,E=(Jt.candidatesTokenCount||0)+(s==="Google"&&Jt.thoughtsTokenCount||0);await dn("tokens",W,s,ee),Y>0&&await dn("cachedTokens",Y,s,ee),E>0&&await dn("candidateTokens",E,s,ee),yt!==null&&yt>0&&await dn("ttft",yt,s,ee),ni({provider:s,model:ee,prompt:Jt.promptTokenCount||0,cached:Y,output:E,reasoning:Jt.thoughtsTokenCount||0,ttft:yt}),yield{type:"usage",content:Jt}}else yt!==null&&yt>0&&(await dn("ttft",yt,s,ee),ni({provider:s,model:ee,prompt:0,cached:0,output:0,reasoning:0,ttft:yt}));we=ma(we),Ii.push(we);let Il=Ft(we),Pi=fa(we),Aa=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(Pi.toLowerCase())||/\[\[END\]\]/i.test(Pi.toLowerCase())||!0,Ml=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(Pi.toLowerCase()),Pl=Tt>0;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"};let Ca=vl(we,/(\[\s*(turn\s*:)?\s*(continue|finish)\s*\]|\[\[END\]\])/gi,"").trim(),va=je.length>0||Mn(Ft(we)).length>0,Bn=(Aa||je.length===0)&&!Ot&&!Fn&&!Dt;if(Bn=je.length===0?Bn:!1,Bn=va&&At||Ko?!1:Bn,we&&we.trim().endsWith('")]')&&je.length===0&&(Bn=!1),Bn){Os=!0;let W=Ii.join(`
792
+ Error log can be found in \`/export logs\``)}}}if(Jt){let W=Jt.totalTokenCount||0,Y=Jt.cachedContentTokenCount||0,E=(Jt.candidatesTokenCount||0)+(s==="Google"&&Jt.thoughtsTokenCount||0);await dn("tokens",W,s,ee),Y>0&&await dn("cachedTokens",Y,s,ee),E>0&&await dn("candidateTokens",E,s,ee),yt!==null&&yt>0&&await dn("ttft",yt,s,ee),oi({provider:s,model:ee,prompt:Jt.promptTokenCount||0,cached:Y,output:E,reasoning:Jt.thoughtsTokenCount||0,ttft:yt}),yield{type:"usage",content:Jt}}else yt!==null&&yt>0&&(await dn("ttft",yt,s,ee),oi({provider:s,model:ee,prompt:0,cached:0,output:0,reasoning:0,ttft:yt}));we=pa(we),Mi.push(we);let Pl=Ft(we),$i=ua(we),Ca=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test($i.toLowerCase())||/\[\[END\]\]/i.test($i.toLowerCase())||!0,$l=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test($i.toLowerCase()),Ll=Tt>0;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"};let va=El(we,/(\[\s*(turn\s*:)?\s*(continue|finish)\s*\]|\[\[END\]\])/gi,"").trim(),Ra=je.length>0||Mn(Ft(we)).length>0,Bn=(Ca||je.length===0)&&!Ot&&!Fn&&!Dt;if(Bn=je.length===0?Bn:!1,Bn=Ra&&At||Vo?!1:Bn,we&&we.trim().endsWith('")]')&&je.length===0&&(Bn=!1),Bn){Ds=!0;let W=Mi.join(`
793
793
  `),Y=Ft(W).trim();yield{type:"interactive_turn_finished",data:{agentText:Ie,fullAgentTextRaw:W,history:[...x],needTitle:ve}},x.length>0&&x[x.length-1].role==="agent"?x[x.length-1].text=Y:x.push({role:"agent",text:Y}),x.forEach(E=>{if(E.role==="user"&&E.text&&(E.text=E.text.replace(/\n\[COMPILE ERROR\][\s\S]*?\[\/ERROR\]/g,""),E.text=E.text.replaceAll(`
794
794
 
795
795
  [system] user question. resolve this specific query within '[ANSWER] ... [/ANSWER]' concisely, naturally [/system]
@@ -798,23 +798,23 @@ Error log can be found in \`/export logs\``)}}}if(Jt){let W=Jt.totalTokenCount||
798
798
  `,"").replaceAll(`[system] **strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]
799
799
  `,"").replaceAll(/\n\[system\] WARNING, Turn Limit Impending: Step \d+\/\d+\. Wrap up quickly\/prompt user to continue & use \[\[END\]\] quickly\. \[\/system\]/g,""),E.text=E.text.replaceAll(/\n\[system\] File Changes:\n(?:\* .+ \(created|modified|deleted\)\n)*\[\/system\]/g,""),(s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma"))&&(E.text.startsWith("[ACTION RESULT]")||E.text.startsWith("[TOOL RESULT]")))){let de=`
800
800
  [system] Action result received. Analyze output and proceed with your turn [/system]`,Ue=`
801
- [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]`;E.text=E.text.replaceAll(Ue,"").replaceAll(de,"").trim()}}),yield{type:"status",content:"[end]"}}if(Bn)break;let Ra=Ca.trim()||"*Working...*";if(x.push({role:"agent",text:Ra}),je.length>0||Sn){if(je.length>0){let W=je.map(tt=>tt.text).join(`
801
+ [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]`;E.text=E.text.replaceAll(Ue,"").replaceAll(de,"").trim()}}),yield{type:"status",content:"[end]"}}if(Bn)break;let Ea=va.trim()||"*Working...*";if(x.push({role:"agent",text:Ea}),je.length>0||Sn){if(je.length>0){let W=je.map(tt=>tt.text).join(`
802
802
 
803
- `),Y=Ft(we),E=Mn(Y),st=da(Y,E),de=Ti(st),Ue=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,xt=[],me=[],mt;for(;(mt=Ue.exec(de))!==null;)me.push({index:mt.index,toolName:mt[1]});for(let tt=0;tt<me.length;tt++){let De=me[tt],at=tt+1<me.length?me[tt+1].index:Y.length;E.some(rn=>rn.fullMatch&&Y.startsWith(rn.fullMatch,De.index))||xt.push(Y.substring(De.index,at))}let Ze=xt.length,rt=je.length+Ze;if(Ze>0){let tt=xt.join(`
804
- `),De=ua(tt);W+=`
803
+ `),Y=Ft(we),E=Mn(Y),st=fa(Y,E),de=Ai(st),Ue=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,xt=[],me=[],mt;for(;(mt=Ue.exec(de))!==null;)me.push({index:mt.index,toolName:mt[1]});for(let tt=0;tt<me.length;tt++){let De=me[tt],at=tt+1<me.length?me[tt+1].index:Y.length;E.some(rn=>rn.fullMatch&&Y.startsWith(rn.fullMatch,De.index))||xt.push(Y.substring(De.index,at))}let Ze=xt.length,rt=je.length+Ze;if(Ze>0){let tt=xt.join(`
804
+ `),De=ga(tt);W+=`
805
805
 
806
806
  [system] Only ${je.length} out of ${rt} attempted tool calls were executed.
807
807
  ${De?`Parsing Issues Detected:
808
808
  ${De}
809
- `:""}Verify proper structure compliance [action:ActionName(arg="value")] & try failed calls again [/system]`;for(let at=0;at<Ze;at++)await vt("toolFailure")}let Wt=je.find(tt=>tt.binaryPart)?.binaryPart||null;x.push({role:"user",text:W,binaryPart:Wt})}}else if(!ut){let W=we.replace(/(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\]|$)/i,""),Y=Mn(W),E=da(W,Y),de=(Ti(E).match(/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi)||[]).length;if(Ko||At&&de>0||de>0){let Ue=ua(W),xt=Ue?`[system] Failed to execute ${de>0?de:1} action call${de>1?"s":""} due to syntax/structure issues:
809
+ `:""}Verify proper structure compliance [action:ActionName(arg="value")] & try failed calls again [/system]`;for(let at=0;at<Ze;at++)await vt("toolFailure")}let Wt=je.find(tt=>tt.binaryPart)?.binaryPart||null;x.push({role:"user",text:W,binaryPart:Wt})}}else if(!ut){let W=we.replace(/(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\]|$)/i,""),Y=Mn(W),E=fa(W,Y),de=(Ai(E).match(/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi)||[]).length;if(Vo||At&&de>0||de>0){let Ue=ga(W),xt=Ue?`[system] Failed to execute ${de>0?de:1} action call${de>1?"s":""} due to syntax/structure issues:
810
810
  ${Ue} [/system]`:`[system] Failed to execute ${de>0?de:1} action${de>1?"s":""}. Verify proper structure compliance [action:ActionName(arg="value")] & try again [/system]`;x.push({role:"user",text:xt}),await vt("toolFailure"),yield{type:"visual_feedback",content:`
811
811
  ${Rt("\u2718 Model produced malformed tool call")}
812
812
  `}}else yield{type:"visual_feedback",content:`
813
813
  ${Rt("\u2718 Loop Detected")}
814
- `},x.push({role:"user",text:`[system] ${Fn&&!Ot?"Stuttering Detected by Internal System. Re-calibrate your response & proceed.":`${Ot?" Over Thinking":" Loop"} Detected by Internal System${Ot?" for current Effort Level":""}. ${Ot?"If you have planned the task, prioritize execution/output":"If you have finished your task provide a simple summary and end"}`} [/system]`});Ot=!1,Fn=!1,Dt=!1}m?.advanceRollback&&await So.recordTurnDelta(g,b+1,ce),Mi=ce.includes("recapture_screen"),Ko=Tt>0||Sn}if(!Os&&!ut){let b="\u2726 Turn safety limit reached. Stopping execution.";yield{type:"text",content:`
814
+ `},x.push({role:"user",text:`[system] ${Fn&&!Ot?"Stuttering Detected by Internal System. Re-calibrate your response & proceed.":`${Ot?" Over Thinking":" Loop"} Detected by Internal System${Ot?" for current Effort Level":""}. ${Ot?"If you have planned the task, prioritize execution/output":"If you have finished your task provide a simple summary and end"}`} [/system]`});Ot=!1,Fn=!1,Dt=!1}m?.advanceRollback&&await ko.recordTurnDelta(g,b+1,ce),Pi=ce.includes("recapture_screen"),Vo=Tt>0||Sn}if(!Ds&&!ut){let b="\u2726 Turn safety limit reached. Stopping execution.";yield{type:"text",content:`
815
815
 
816
816
  ${b}
817
- `};let ge=(Ii.join(`
817
+ `};let ge=(Mi.join(`
818
818
  `)+`
819
819
  ${b}`).trim();yield{type:"interactive_turn_finished",data:{agentText:Ie,fullAgentTextRaw:ge,history:[...x],needTitle:ve}},yield{type:"status",content:"[end]"}}}catch(U){let x=U?.cause?` (Cause: ${U.cause?.message||String(U.cause)})`:"",Ne=(U instanceof Error?(()=>{try{return JSON.parse(JSON.parse(U.message).error.message).error.message}catch{return(U.message?`${U.message}${x}`:"")||String(U)}})():String(U)).replace(/^(Error:\s*)+/i,"");s==="Google"&&!/^[A-Z0-9_\-\s]+ ERROR:/i.test(Ne)&&(Ne=`GEMINI ERROR: ${Ne}`);let qt=new Date().toLocaleString(),Fe=V.join(Gn,"agent");yield{type:"text",content:`
820
820
 
@@ -824,7 +824,7 @@ CAUSE: ${U.cause?.stack||U.cause}`:""}
824
824
 
825
825
  ----------------------------------------------------------------------
826
826
 
827
- `),typeof flushGoogleBuffer=="function"&&(yield*flushGoogleBuffer()),yield{type:"tool_result",content:`ERROR: [INTERNAL CRITICAL] ${Ne}`}}finally{Je&&(clearInterval(Je),Je=null),typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),await oi.commitTransaction(),m?.advanceRollback&&await So.cleanup(g),await Hn()}yield{type:"status",content:null}},Zd=async(e,t,n=null,i=null,o=null,r=null,d=!1)=>{let l=await ti(),u={...l,...t},g=typeof o=="number"&&o>0?o:50,h=(u?.systemSettings?.loopLimits||"Default").toLowerCase();if(h==="extended")g=Math.floor(g*3);else if(h==="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&&(g=Fe)}o=g;let m=process.env.SUBAGENT_MODEL?process.env.SUBAGENT_MODEL.trim():null,p=process.env.SUBAGENT_PROVIDER?process.env.SUBAGENT_PROVIDER.trim():null,s=new Date,w=`${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(":","-")}`,Le=(Fe=>{if(!Fe)return null;let ae=Fe.toLowerCase();return ae==="google"?"Google":ae==="deepseek"?"DeepSeek":ae==="openrouter"?"OpenRouter":ae==="nvidia"?"NVIDIA":ae==="mistral"?"Mistral":ae==="ollama"?"Ollama":ae==="inferx"?"InferX":ae==="sensenova"?"SenseNova":ae==="poolside"?"Poolside":ae==="9router"||ae==="9Router"?"9router":ae==="aihubmix"||ae==="aihub"?"AIHubMix":ae==="explabs"||ae==="experientiallabs"||ae==="experimentallabs"?"ExpLabs":ae==="tokenharbor"||ae==="token harbor"||ae==="token_harbor"||ae==="thk"?"TokenHarbor":ae==="infron"?"Infron":ae==="apinex"||ae==="apx"?"APInex":ae==="xkiro"||ae==="kiro"?"xKiro":ae==="c_openai"||ae==="custom_openai"||ae==="custom (openai)"||ae==="custom"?"c_openai":null})(p),v=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentModel:null,N=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentProvider:null,P=null;if(v==="ENV"?(P=m,m&&Le&&(u.aiProvider=Le)):v&&v!=="Default"?(P=v,N&&(u.aiProvider=N)):m&&Le&&(u.aiProvider=Le),u.aiProvider){let Fe=await Hs(u.aiProvider);Fe&&(u.apiKey=Fe)}let z=Fe=>{if(!Fe||typeof Fe!="string")return{allowed:!0};let ae=[/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 on of ae)if(on.test(Fe))return{allowed:!1,reason:`Blocked potentially destructive or unsafe command pattern: "${on.source}"`};return{allowed:!0}},M=n||P||t?.modelName||t?.activeModel||l.activeModel,xe=(process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux")==="Windows",ve=xe&&u?.systemSettings?.preferBash!==!1&&zs(),Ie="Run(command=string)",Je=`Runs ${xe?Ki()?"powershell":"windows CMD":"bash"} command`;ve&&(Ie=`Run(command=string, ${qs()||Ki()?"forcePowershell?=bool:false":"forceCwd?=bool:false"})`,Je="Runs in git bash. Or force native shell");let U=`-- ACTIONS (path = relative to CWD, path separator: '/') --
827
+ `),typeof flushGoogleBuffer=="function"&&(yield*flushGoogleBuffer()),yield{type:"tool_result",content:`ERROR: [INTERNAL CRITICAL] ${Ne}`}}finally{Je&&(clearInterval(Je),Je=null),typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),await ii.commitTransaction(),m?.advanceRollback&&await ko.cleanup(g),await Hn()}yield{type:"status",content:null}},nf=async(e,t,n=null,i=null,o=null,r=null,d=!1)=>{let l=await ni(),u={...l,...t},g=typeof o=="number"&&o>0?o:50,h=(u?.systemSettings?.loopLimits||"Default").toLowerCase();if(h==="extended")g=Math.floor(g*3);else if(h==="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&&(g=Fe)}o=g;let m=process.env.SUBAGENT_MODEL?process.env.SUBAGENT_MODEL.trim():null,p=process.env.SUBAGENT_PROVIDER?process.env.SUBAGENT_PROVIDER.trim():null,s=new Date,w=`${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(":","-")}`,Le=(Fe=>{if(!Fe)return null;let ae=Fe.toLowerCase();return ae==="google"?"Google":ae==="deepseek"?"DeepSeek":ae==="openrouter"?"OpenRouter":ae==="nvidia"?"NVIDIA":ae==="mistral"?"Mistral":ae==="ollama"?"Ollama":ae==="inferx"?"InferX":ae==="sensenova"?"SenseNova":ae==="poolside"?"Poolside":ae==="9router"||ae==="9Router"?"9router":ae==="aihubmix"||ae==="aihub"?"AIHubMix":ae==="explabs"||ae==="experientiallabs"||ae==="experimentallabs"?"ExpLabs":ae==="tokenharbor"||ae==="token harbor"||ae==="token_harbor"||ae==="thk"?"TokenHarbor":ae==="infron"?"Infron":ae==="apinex"||ae==="apx"?"APInex":ae==="xkiro"||ae==="kiro"?"xKiro":ae==="c_openai"||ae==="custom_openai"||ae==="custom (openai)"||ae==="custom"?"c_openai":null})(p),v=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentModel:null,N=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentProvider:null,P=null;if(v==="ENV"?(P=m,m&&Le&&(u.aiProvider=Le)):v&&v!=="Default"?(P=v,N&&(u.aiProvider=N)):m&&Le&&(u.aiProvider=Le),u.aiProvider){let Fe=await js(u.aiProvider);Fe&&(u.apiKey=Fe)}let z=Fe=>{if(!Fe||typeof Fe!="string")return{allowed:!0};let ae=[/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 on of ae)if(on.test(Fe))return{allowed:!1,reason:`Blocked potentially destructive or unsafe command pattern: "${on.source}"`};return{allowed:!0}},M=n||P||t?.modelName||t?.activeModel||l.activeModel,xe=(process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux")==="Windows",ve=xe&&u?.systemSettings?.preferBash!==!1&&qs(),Ie="Run(command=string)",Je=`Runs ${xe?Ki()?"powershell":"windows CMD":"bash"} command`;ve&&(Ie=`Run(command=string, ${Ys()||Ki()?"forcePowershell?=bool:false":"forceCwd?=bool:false"})`,Je="Runs in git bash. Or force native shell");let U=`-- ACTIONS (path = relative to CWD, path separator: '/') --
828
828
  In chat output the format \`[action:ActionName(arg1="value1")]\` in NEW line
829
829
  Rules:
830
830
  - JSON escape literal sequences, backslash: \\\\, newLine: \\ n
@@ -861,7 +861,7 @@ Main focus: actions and task, not chatting
861
861
  On completion, provide a detailed summary in Tables/Markdown Format with file modified info. If any task failed report back in detail
862
862
 
863
863
  Current Time: ${w}
864
- === END SYSTEM PROMPT ===`,zt=[{role:"user",text:`Complete this task: ${e}`}],Ne=0,qt="";for(;Ne<o;){let Fe=await Gi("subagent",u);if(!Fe.allowed)throw new Error(Fe.reason||`Budget Exhausted for Provider (${u?.aiProvider||"Subagent"})`);if(ut){if(t?.taskId&&typeof Nt<"u"){let Q=Nt.find(B=>B.id===t.taskId);Q&&(Q.status="cancelled")}throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}if(t?.taskId&&typeof Nt<"u"){let Q=Nt.find(B=>B.id===t.taskId);if(Q&&Q.status==="cancelled")throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}let ae=zt.map(Q=>({role:Q.role==="user"?"user":"model",parts:[{text:Q.text}]}));r&&r(`[Subagent Turn ${Ne+1}]...`);let on=["Fast","Low","Medium","High"],Vn=process.env.SUBAGENT_THINKING,No=on.includes(Vn)?Vn:"Low",Bo=(await El(u,M,ae,x,No)).text||"",Pn=ma(Ft(Bo).trim());qt=Pn,r&&r(`[Subagent Response]
864
+ === END SYSTEM PROMPT ===`,zt=[{role:"user",text:`Complete this task: ${e}`}],Ne=0,qt="";for(;Ne<o;){let Fe=await Gi("subagent",u);if(!Fe.allowed)throw new Error(Fe.reason||`Budget Exhausted for Provider (${u?.aiProvider||"Subagent"})`);if(ut){if(t?.taskId&&typeof Nt<"u"){let Q=Nt.find(B=>B.id===t.taskId);Q&&(Q.status="cancelled")}throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}if(t?.taskId&&typeof Nt<"u"){let Q=Nt.find(B=>B.id===t.taskId);if(Q&&Q.status==="cancelled")throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}let ae=zt.map(Q=>({role:Q.role==="user"?"user":"model",parts:[{text:Q.text}]}));r&&r(`[Subagent Turn ${Ne+1}]...`);let on=["Fast","Low","Medium","High"],Vn=process.env.SUBAGENT_THINKING,Fo=on.includes(Vn)?Vn:"Low",Wo=(await Il(u,M,ae,x,Fo)).text||"",Pn=pa(Ft(Wo).trim());qt=Pn,r&&r(`[Subagent Response]
865
865
  ${Pn}
866
866
  `),zt.push({role:"agent",text:Pn});let zn=Mn(Pn);if(zn.length===0)break;let Yt=zn.filter(Q=>Q.toolName.toLowerCase()==="askmain"||Q.toolName.toLowerCase()==="ask_main"),$n=!1,Re="";for(let Q of zn){if(ut){if(t?.taskId&&typeof Nt<"u"){let A=Nt.find(oe=>oe.id===t.taskId);A&&(A.status="cancelled")}throw new Error("Subagent task was cancelled.")}if(t?.taskId&&typeof Nt<"u"){let A=Nt.find(oe=>oe.id===t.taskId);if(A&&A.status==="cancelled")throw new Error("Subagent task was cancelled.")}let B=Q.toolName.toLowerCase();if(B==="askuser"&&(B="ask"),B==="askmain"||B==="ask_main"){if($n)continue;$n=!0;let A="";if(Yt.length===1?A=D(Yt[0].args).question||Yt[0].args:A=Yt.map((oe,Xt)=>{let Bt=D(oe.args);return`Q${Xt+1}: ${Bt.question||oe.args}`}).join(`
867
867
  `),t.onAskMain){r&&r(`[Executing Tool] AskMain("${A}")...`);let oe=await t.onAskMain(A);r&&r(`[Action Result]
@@ -876,7 +876,7 @@ Answer from Main Agent: ${oe}
876
876
  `;continue}if(B==="exec_command"||B==="execcommand"||B==="run"){let A=D(Q.args).command||"",oe=z(A);if(!oe.allowed){let Xt=`ERROR: [SECURITY RESTRICTION] Subagent execution blocked command: ${oe.reason}`;r&&r(`[Blocked Command] ${A} - ${oe.reason}
877
877
  `),Re+=`${Xt}
878
878
 
879
- `;continue}}let pt="";if(B==="web_search"||B==="websearch")pt=`\u2714 \x1B[95mSearched\x1B[0m: ${D(Q.args).query||""}`;else if(B==="web_scrape"||B==="webscrape")pt=`\u2714 \x1B[95mScraped\x1B[0m: ${D(Q.args).url||""}`;else if(B==="search_keyword"||B==="searchkeyword"||B==="codesearch"||B==="code_search"){let A=D(Q.args),oe=A.keyword||"",Xt=A.path||"";pt=`${oe?"\u2714":"\u2718"} \x1B[95mSearched\x1B[0m: ${oe||"No Query"}${Xt?` \u2192 ${Xt.replaceAll("\\","/")}`:""}`}else if(B==="view_file"||B==="viewfile"||B==="readfile")pt=`\u2714 \x1B[95mRead\x1B[0m: ${(D(Q.args).path||"").replaceAll("\\","/")}`;else if(B==="find_file"||B==="findfile"){let A=D(Q.args),oe=A.basename||A.name||A.path||A.file||A.query||"";pt=`${oe?"\u2714":"\u2718"} \x1B[95mLocated\x1B[0m: ${oe||"No Query"}`}else if(B==="list_files"||B==="read_folder"||B==="readfolder"){let A=D(Q.args).path||null,oe=D(Q.args).recurse||0;pt=`${A?"\u2714":"\u2718"} \x1B[95mBrowsed\x1B[0m: ${A?`${A.replaceAll("\\","/")}${oe>0?`${A.endsWith("/")?`*${oe}`:`/*${oe}`}`:`${A.endsWith("/")?"":"/"}`}`:""}`}else if(B==="write_file"||B==="writefile"){let A=D(Q.args).path||null;pt=`${A?"\u2714":"\u2718"} \x1B[95mCreated\x1B[0m: ${A?`${A.replaceAll("\\","/")}`:"No File Changes"}`}else if(B==="update_file"||B==="updatefile"||B==="patchfile"||B==="patch_file"){let A=D(Q.args),oe=A.path||null,Bt=Object.entries(A).some(([kt,Ln])=>kt.startsWith("searchContent")&&typeof Ln=="string"&&Ln.startsWith("^LINE:"))?"\u1361":":";pt=`${oe?"\u2714":"\u2718"} \x1B[95mEdited\x1B[0m${Bt} ${oe?`${oe.replaceAll("\\","/")}`:"No File Changes"}`}else if(B==="exec_command"||B==="execcommand"||B==="run"){let A=D(Q.args).command||null;pt=`${A?"\u2714":"\u2718"} \x1B[95mExecuted\x1B[0m: ${A?A.slice(0,100)+(A.length>100?"...":""):"No Command"}`}else if(B==="file_map"||B==="filemap"){let A=D(Q.args).path||"";pt=`${A?"\u2714":"\u2718"} \x1B[95mIndexed\x1B[0m: ${A?`${A.replaceAll("\\","/")}`:"File Not Found"}`}else if(B==="await"){let{time:A}=D(Q.args),oe=parseFloat(A)||0;oe<10&&(oe=10),oe>180&&(oe=180),pt=`\u2714 \x1B[95mAwaiting\x1B[0m \u2192 ${(Bt=>{if(Bt>=60){let kt=Math.floor(Bt/60),Ln=Bt%60;return`${kt}m${Ln>0?` ${Ln}s`:""}`}return`${Bt}s`})(oe)}`}else{let A=Ss[B]||Q.toolName,oe=Kn(B,Q.args);pt=`\u2714 \x1B[95m${A}\x1B[0m${oe?`: ${oe}`:""}`}t.onVisualFeedback&&pt&&t.onVisualFeedback(pt),r&&r(`[Executing Tool] ${Q.toolName}(${Q.args})...`);try{let A=await us(Q.toolName,Q.args,{...t,mode:"Flux"});r&&r(`[Action Result]
879
+ `;continue}}let pt="";if(B==="web_search"||B==="websearch")pt=`\u2714 \x1B[95mSearched\x1B[0m: ${D(Q.args).query||""}`;else if(B==="web_scrape"||B==="webscrape")pt=`\u2714 \x1B[95mScraped\x1B[0m: ${D(Q.args).url||""}`;else if(B==="search_keyword"||B==="searchkeyword"||B==="codesearch"||B==="code_search"){let A=D(Q.args),oe=A.keyword||"",Xt=A.path||"";pt=`${oe?"\u2714":"\u2718"} \x1B[95mSearched\x1B[0m: ${oe||"No Query"}${Xt?` \u2192 ${Xt.replaceAll("\\","/")}`:""}`}else if(B==="view_file"||B==="viewfile"||B==="readfile")pt=`\u2714 \x1B[95mRead\x1B[0m: ${(D(Q.args).path||"").replaceAll("\\","/")}`;else if(B==="find_file"||B==="findfile"){let A=D(Q.args),oe=A.basename||A.name||A.path||A.file||A.query||"";pt=`${oe?"\u2714":"\u2718"} \x1B[95mLocated\x1B[0m: ${oe||"No Query"}`}else if(B==="list_files"||B==="read_folder"||B==="readfolder"){let A=D(Q.args).path||null,oe=D(Q.args).recurse||0;pt=`${A?"\u2714":"\u2718"} \x1B[95mBrowsed\x1B[0m: ${A?`${A.replaceAll("\\","/")}${oe>0?`${A.endsWith("/")?`*${oe}`:`/*${oe}`}`:`${A.endsWith("/")?"":"/"}`}`:""}`}else if(B==="write_file"||B==="writefile"){let A=D(Q.args).path||null;pt=`${A?"\u2714":"\u2718"} \x1B[95mCreated\x1B[0m: ${A?`${A.replaceAll("\\","/")}`:"No File Changes"}`}else if(B==="update_file"||B==="updatefile"||B==="patchfile"||B==="patch_file"){let A=D(Q.args),oe=A.path||null,Bt=Object.entries(A).some(([kt,Ln])=>kt.startsWith("searchContent")&&typeof Ln=="string"&&Ln.startsWith("^LINE:"))?"\u1361":":";pt=`${oe?"\u2714":"\u2718"} \x1B[95mEdited\x1B[0m${Bt} ${oe?`${oe.replaceAll("\\","/")}`:"No File Changes"}`}else if(B==="exec_command"||B==="execcommand"||B==="run"){let A=D(Q.args).command||null;pt=`${A?"\u2714":"\u2718"} \x1B[95mExecuted\x1B[0m: ${A?A.slice(0,100)+(A.length>100?"...":""):"No Command"}`}else if(B==="file_map"||B==="filemap"){let A=D(Q.args).path||"";pt=`${A?"\u2714":"\u2718"} \x1B[95mIndexed\x1B[0m: ${A?`${A.replaceAll("\\","/")}`:"File Not Found"}`}else if(B==="await"){let{time:A}=D(Q.args),oe=parseFloat(A)||0;oe<10&&(oe=10),oe>180&&(oe=180),pt=`\u2714 \x1B[95mAwaiting\x1B[0m \u2192 ${(Bt=>{if(Bt>=60){let kt=Math.floor(Bt/60),Ln=Bt%60;return`${kt}m${Ln>0?` ${Ln}s`:""}`}return`${Bt}s`})(oe)}`}else{let A=ks[B]||Q.toolName,oe=Kn(B,Q.args);pt=`\u2714 \x1B[95m${A}\x1B[0m${oe?`: ${oe}`:""}`}t.onVisualFeedback&&pt&&t.onVisualFeedback(pt),r&&r(`[Executing Tool] ${Q.toolName}(${Q.args})...`);try{let A=await gs(Q.toolName,Q.args,{...t,mode:"Flux"});r&&r(`[Action Result]
880
880
  ${A}
881
881
  `),Re+=`[ACTION RESULT for ${Q.toolName}]: ${A}
882
882
 
@@ -885,4 +885,4 @@ ${A}
885
885
 
886
886
  `,await vt("toolFailure")}}let qn="";if(t?.taskId&&typeof Nt<"u"){let Q=Nt.find(B=>B.id===t.taskId);if(Q&&Q.pendingSteerMessages&&Q.pendingSteerMessages.length>0){let B=[...Q.pendingSteerMessages];Q.pendingSteerMessages=[];for(let Xn of B)qn+=`
887
887
 
888
- [STEERING INSTRUCTION FROM MAIN AGENT]: ${Xn}`,r&&r(`[Subagent Steered] ${Xn}`)}}let Yn=(Re.trim()+qn).trim();zt.push({role:"user",text:Yn}),Ne++}return qt};export{ao as a,wi as b,Jc as c,Qc as d,wc as e,bc as f,ro as g,Sc as h,ci as i,di as j,Nc as k,Fc as l,wl as m,Vd as n,bl as o,Sl as p,bs as q,Ft as r,ki as s,ma as t,zd as u,qd as v,Yd as w,pa as x,Xd as y,Ti as z,da as A,Cl as B,Mn as C,Jd as D,El as E,Qd as F,Zd as G};
888
+ [STEERING INSTRUCTION FROM MAIN AGENT]: ${Xn}`,r&&r(`[Subagent Steered] ${Xn}`)}}let Yn=(Re.trim()+qn).trim();zt.push({role:"user",text:Yn}),Ne++}return qt};export{co as a,bi as b,Zc as c,ed as d,Sc as e,kc as f,lo as g,Tc as h,di as i,fi as j,Bc as k,Wc as l,Sl as m,Yd as n,kl as o,Tl as p,Ss as q,Ft as r,Ti as s,pa as t,Xd as u,Jd as v,Qd as w,ha as x,Zd as y,Ai as z,fa as A,Rl as B,Mn as C,ef as D,Il as E,tf as F,nf as G};