fluxflow-cli 4.23.4 → 4.23.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chunks/{ai-QZPSCQTC.js → ai-IOEGZWGA.js} +1 -1
- package/dist/chunks/{app-VDMSLYCY.js → app-OWHF6FXI.js} +2 -2
- package/dist/chunks/{chunk-D7RU7MKC.js → chunk-5LRTKLA4.js} +71 -70
- package/dist/chunks/{chunk-XIH6C5WL.js → chunk-CXNFFI7L.js} +1 -1
- package/dist/chunks/{chunk-F6DMKN7N.js → chunk-HRKT75ZJ.js} +1 -1
- package/dist/chunks/{exec_command-ER3K4TLH.js → exec_command-27EPEAE5.js} +1 -1
- package/dist/chunks/{invoke-ZGIGNTE6.js → invoke-GKLK35YP.js} +2 -2
- package/dist/chunks/{invokeSync-LXDZKOPO.js → invokeSync-7PK3CJVJ.js} +2 -2
- package/dist/cli.js +8 -8
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as Vt}from"./chunk-56EJGQU3.js";import{a as ao}from"./chunk-P52SKLRJ.js";import{a as Ai,c as Ei}from"./chunk-HRKT75ZJ.js";import{a as Es,g as Ci}from"./chunk-Z4HHJIHG.js";import{a as Ri}from"./chunk-2KD7V3OK.js";import{c as _s,g as Ti,h as Si,i as _i,m as As}from"./chunk-UDJ2C3N3.js";import{a as Oo}from"./chunk-IRFTRBG2.js";import{a as re}from"./chunk-Y5JU726N.js";import{b as Ts}from"./chunk-BSUDXEA2.js";import{d as Do,i as Ct,k as Ut,m as Ss,n as wi}from"./chunk-7UNVYHZ7.js";import{a as ro}from"./chunk-OOTXMJIA.js";import{k as ft,l as Io,o as pe}from"./chunk-QGPOMXO4.js";import{c as Et,d as Jn}from"./chunk-L3W2X74K.js";import{a as on,d as Mn,e as Ro,k as Wn,l as vo,m as ks,r as ws,v as Mo}from"./chunk-RI37VZYB.js";import{GoogleGenAI as Yr,ThinkingLevel as Xe,HarmBlockThreshold as On,HarmCategory as Ln}from"@google/genai";var vi=(e=!0,t=!0)=>`
|
|
2
2
|
To use tools, must output exactly '[tool:ToolName(arg1="value1")]' structured string in chat response \u2190 no exception
|
|
3
3
|
|
|
4
4
|
-- Chat Management Tools --
|
|
@@ -92,8 +92,8 @@ fluxflow [options]
|
|
|
92
92
|
* SHELL \u2192 Terminal shell executable
|
|
93
93
|
* HIGH_CONTEXT \u2192 Context window override (false or integer 32k..1M) [Deprecated! Will stop working from next major version]
|
|
94
94
|
* ENABLE_9ROUTER \u2192 Enables 9Router provider. Can use OAuth subscription like Codex, Claude Code, GitHub Copilot etc. or use providers not natively in Fluxflow. Set ENV ENABLE_9ROUTER=true, needs 9router package installed (via npm/npx etc) & running
|
|
95
|
-
*
|
|
96
|
-
*
|
|
95
|
+
* NINEROUTER_URL \u2192 If different from default, Any OpenAI Compatible, include /v1/chat/completions
|
|
96
|
+
* NINEROUTER_KEY \u2192 if any
|
|
97
97
|
|
|
98
98
|
## Diagnostic & Optimization Flags
|
|
99
99
|
* SHOW_DEBUG_GRID \u2192 (true|false, default: false) Coordinate grid overlay for Computer Use tooling
|
|
@@ -129,8 +129,8 @@ Trigger in chat via /command
|
|
|
129
129
|
## Configuration & Model Controls
|
|
130
130
|
* /settings \u2192 Full-screen interactive settings menu
|
|
131
131
|
* /mode \u2192 Toggle Operating Mode
|
|
132
|
-
* /model model-id --
|
|
133
|
-
* /provider \u2192
|
|
132
|
+
* /model model-id --flags \u2192 Flags optional to customize list (--save, --remove, --default, /model old-model new-model --rename)
|
|
133
|
+
* /provider \u2192 Switch AI provider
|
|
134
134
|
* /thinking effort \u2192 Set reasoning effort. Can be mapped based on provider & model support (/thinking effort --map provider-effort-value/'rm' to unmap). Changes the Translation Table only for the currently selected provider and model
|
|
135
135
|
* /wildcard-tooling \u2192 Tool compatibility mode for non-tooling models
|
|
136
136
|
* /wildercard-tooling \u2192 Extended version of /wildcard-tooling
|
|
@@ -374,32 +374,33 @@ Route sub-agent workloads to faster/cheaper models independently of the main age
|
|
|
374
374
|
|
|
375
375
|
## Supported Providers
|
|
376
376
|
* Gemini (aistudio.google.com) | NVIDIA NIM (build.nvidia.com) | DeepSeek (platform.deepseek.com) | Mistral (admin.mistral.ai) | Ollama Local/Cloud (ollama.com) | InferX (inferx.net) | SenseNova (platform.sensenova.ai) | Poolside (platform.poolside.ai) | OpenRouter (openrouter.ai) | AIHubMix (aihubmix.com) | Experiential Labs (experientiallabs.ai) | TokenHarbor (tokenharbor.ai) | APInex (apinex.bond)
|
|
377
|
-
* Proxy: 9router. Can use OAuth subscription like Codex, Claude Code, GitHub Copilot etc. or any OpenAI/Anthropic API that FluxFlow dont have natively
|
|
377
|
+
* Proxy: 9router. Can use OAuth subscription like Codex, Claude Code, GitHub Copilot etc. or any OpenAI/Anthropic API that FluxFlow dont have natively
|
|
378
|
+
|
|
379
|
+
## Switch Providers/Models:
|
|
380
|
+
* /model model-id --flags \u2192 Flags optional to customize list (--save, --remove, --default, /model old-model new-model --rename)
|
|
381
|
+
* /provider \u2192 Switch AI provider
|
|
378
382
|
|
|
379
383
|
## OpenRouter: Routing, Tiers & Model Variants
|
|
380
|
-
* Model Syntax: /model model-id
|
|
381
384
|
* Provider Routing: Append :provider. /model model-id:provider
|
|
382
385
|
* Service Tiers & Variants:
|
|
383
386
|
* :flex|priority. flex = cheaper, priority = faster & expensive. /model openai/gpt-5:tier or /model openai/gpt-5:openai:tier
|
|
384
387
|
* Variants :free, :nitro, :floor, :exacto
|
|
385
388
|
|
|
386
|
-
## Setup
|
|
387
|
-
1. Environment Variables
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
2. Switch Provider: Select NVIDIA in /settings \u2192 Providers
|
|
391
|
-
3. Select Model: /model <model_name>
|
|
392
|
-
* Memory agent is automatically disabled on custom/local & few providers endpoints
|
|
389
|
+
## Setup Local NVIDIA NIM (OpenAI-Compatible)
|
|
390
|
+
1. Environment Variables:
|
|
391
|
+
* NVIDIA_BASE_URL = http://.../v1/chat/completions or custom openai endpoint, dot get fooled by BASE, its not
|
|
392
|
+
* NVIDIA_API_KEY = If needed
|
|
393
393
|
|
|
394
|
-
## Setup
|
|
394
|
+
## Setup Ollama (Local / Cloud)
|
|
395
395
|
1. Endpoint & Authentication:
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
396
|
+
* Local: Set API Key to LOCAL in /settings \u2192 Providers or on key prompt
|
|
397
|
+
* Endpoint URL: Default is http://127.0.0.1:11434 Override via OLLAMA_HOST
|
|
398
|
+
|
|
399
|
+
## Setup: 9Router
|
|
400
|
+
1. Install NPM Package (9router)
|
|
401
|
+
2. Set ENV ENABLE_9ROUTER=true
|
|
402
|
+
* NINEROUTER_URL = https://.../v1/chat/completions Support external openai compatible endpoints too
|
|
403
|
+
* NINEROUTER_KEY = If any needed
|
|
403
404
|
`;var Hi=`# Fluxflow Instructions & Skills System
|
|
404
405
|
|
|
405
406
|
## 1. Instructions (AGENTS.md / FLUXFLOW.md root only)
|
|
@@ -473,14 +474,14 @@ Public Docs: https://fluxflow-cli.onrender.com
|
|
|
473
474
|
|
|
474
475
|
Default Context Length: 256k Tokens. Can be changed via ENV/In-app Settings \u2192 references/{SETTINGS,ENV}.md
|
|
475
476
|
|
|
476
|
-
Docs missing required info? Say you are not sure enough to answer. Dont give wrong info`,"references/MODES.md":Ui,"references/PROVIDERS.md":Wi,"references/PLUGINS.md":Hi,"references/STARTUP.md":Ii,"references/ENV.md":Di,"references/COMMANDS.md":Oi,"references/SETTINGS.md":Li,"references/TOOLS.md":Pi,"references/ARCHITECTURE.md":$i,"references/SUB_AGENTS.md":Ni,"references/SECURITY.md":Fi,"references/IDE.md":Bi};var
|
|
477
|
-
`,p=null;dn.existsSync(u)&&(p=dn.readFileSync(u,"utf8")),p!==y&&dn.writeFileSync(u,y,"utf8")}if(dn.existsSync(t)){let o=dn.readdirSync(t);for(let c of o){let u=In.normalize(In.join("references",c));if(!s.has(u)){let a=In.join(t,c);try{dn.rmSync(a,{recursive:!0,force:!0})}catch{}}}}}catch{}};var go=(e,t)=>{try{if(!sn.existsSync(e))return null;let n=Array.isArray(t)?t.map(o=>o.toLowerCase()):[t.toLowerCase()],s=sn.readdirSync(e);for(let o of n){let c=s.find(u=>u.toLowerCase()===o);if(c){let u=fn.join(e,c);if(sn.statSync(u).isFile())return u}}}catch{}return null},Ps=(e,t)=>{let n=go(e,t);if(n)try{return sn.readFileSync(n,"utf8")}catch{}return""},
|
|
477
|
+
Docs missing required info? Say you are not sure enough to answer. Dont give wrong info`,"references/MODES.md":Ui,"references/PROVIDERS.md":Wi,"references/PLUGINS.md":Hi,"references/STARTUP.md":Ii,"references/ENV.md":Di,"references/COMMANDS.md":Oi,"references/SETTINGS.md":Li,"references/TOOLS.md":Pi,"references/ARCHITECTURE.md":$i,"references/SUB_AGENTS.md":Ni,"references/SECURITY.md":Fi,"references/IDE.md":Bi};var Ki=()=>{try{let e=In.join(on,"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===!0||!1){dn.existsSync(e)&&dn.rmSync(e,{recursive:!0,force:!0});return}let s=new Set(Object.keys(vs).map(o=>In.normalize(o)));for(let[o,c]of Object.entries(vs)){let u=In.join(e,o),a=In.dirname(u);dn.existsSync(a)||dn.mkdirSync(a,{recursive:!0});let y=c.trim()+`
|
|
478
|
+
`,p=null;dn.existsSync(u)&&(p=dn.readFileSync(u,"utf8")),p!==y&&dn.writeFileSync(u,y,"utf8")}if(dn.existsSync(t)){let o=dn.readdirSync(t);for(let c of o){let u=In.normalize(In.join("references",c));if(!s.has(u)){let a=In.join(t,c);try{dn.rmSync(a,{recursive:!0,force:!0})}catch{}}}}}catch{}};var go=(e,t)=>{try{if(!sn.existsSync(e))return null;let n=Array.isArray(t)?t.map(o=>o.toLowerCase()):[t.toLowerCase()],s=sn.readdirSync(e);for(let o of n){let c=s.find(u=>u.toLowerCase()===o);if(c){let u=fn.join(e,c);if(sn.statSync(u).isFile())return u}}}catch{}return null},Ps=(e,t)=>{let n=go(e,t);if(n)try{return sn.readFileSync(n,"utf8")}catch{}return""},Vi=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"]),$s=(e=process.cwd(),t=0,n=8)=>{let s=[];if(t>n)return s;try{if(!sn.existsSync(e))return s;let o=sn.readdirSync(e,{withFileTypes:!0});for(let c of o){let u=c.name,a=fn.join(e,u);if(c.isDirectory())!Vi.has(u)&&!Vi.has(u.toLowerCase())&&s.push(...$s(a,t+1,n));else if(c.isFile()){let y=u.toLowerCase();(y==="agents.md"||y==="agent.md")&&s.push(a)}}}catch{}return s},Yi=(e,t=2)=>{if(!e)return"";let n=" ".repeat(t);return e.split(/\r?\n/).map(s=>n+s).join(`
|
|
478
479
|
`)},Qi=()=>go(on,["agents.md","agent.md"]),Zi=()=>go(process.cwd(),["agents.md","agent.md"]),er=()=>go(on,["fluxflow.md"]),tr=()=>go(process.cwd(),["fluxflow.md"]),$o=Qi(),Os=Zi(),Dn=$s(),No=er(),Fo=tr(),qi=null,Ls="",nr=!1,ya=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],s=t[2],o=n.match(/^Identity:\s*([\s\S]*?)(?=\r?\n\s*(?:<><|>>>)|$)/m);return o&&(Ls=o[1].trim(),process.env.NO_INS=!0),/<><\s*NO_INS/.test(n)&&(nr=!0),s.trim()},xa=()=>($o=Qi(),$o?Ps(on,["agents.md","agent.md"]).trim():""),ba=()=>{if(Dn=$s(),Os=Zi(),!Dn||Dn.length===0)return"";let e=process.cwd(),t=[...Dn].sort((s,o)=>{let c=fn.relative(e,s).replace(/\\/g,"/"),u=fn.relative(e,o).replace(/\\/g,"/"),a=!c.includes("/"),y=!u.includes("/");return a&&!y?-1:!a&&y?1:c.localeCompare(u)}),n=[];for(let s of t)try{let o=sn.readFileSync(s,"utf8").trim();if(!o)continue;let c=fn.relative(e,s).replace(/\\/g,"/");if(!c.includes("/"))n.push(Yi(o,2));else{let a=fn.dirname(c)+"/:";n.push(`${a}
|
|
479
480
|
${Yi(o,2)}`)}}catch{}return n.join(`
|
|
480
481
|
|
|
481
482
|
`).trim()},Ns=()=>{No=er();let e=No?Ps(on,["fluxflow.md"]).trim():"";return ya(e)},Fs=()=>(Fo=tr(),Fo?Ps(process.cwd(),["fluxflow.md"]).trim():""),Bs=xa(),Bo=ba(),fo=Ns(),uo=Fs(),zi=(e,t="",n="")=>{if(!e)return"";let s=n.toLowerCase().trim(),o=t.toLowerCase().trim(),c=fn.posix.basename(o),u=s&&o?`${s}::${o}`:"",a=s&&c?`${s}::${c}`:"",y=g=>!g||!o?!1:g===o||g===c||g===u||g===a,p=[];return e.replace(/<start_provider_([^>\r\n]+)>([\s\S]*?)<end_provider_([^>\r\n]+)>/gi,(g,b,h,i)=>{if(s&&b.trim().toLowerCase()===i.trim().toLowerCase()&&b.trim().toLowerCase()===s){let k=h.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(v,m,_,P)=>{if(m.trim().toLowerCase()===P.trim().toLowerCase()){let E=m.trim().toLowerCase();if(y(E)){let S=_.trim();S&&p.push(S)}}return""}).trim();k&&p.push(k)}return""}),e.replace(/<start_model_([^>\r\n]+::[^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+::[^>\r\n]+)>/gi,(g,b,h,i)=>{if(b.trim().toLowerCase()===i.trim().toLowerCase()){let l=b.trim().toLowerCase();if(u&&(l===u||a&&l===a)){let k=h.trim();k&&p.push(k)}}return""}),e.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(g,b,h,i)=>{if(b.includes("::"))return"";if(b.trim().toLowerCase()===i.trim().toLowerCase()){let l=b.trim().toLowerCase();if(o&&(l===o||l===c)){let k=h.trim();k&&p.push(k)}}return""}),p.join(`
|
|
482
483
|
|
|
483
|
-
`).trim()},ka=(e="",t="")=>{let n=`${e||""}::${t||""}`.toLowerCase().trim();qi!==n&&(qi=n,fo=Ns(),uo=Fs())};
|
|
484
|
+
`).trim()},ka=(e="",t="")=>{let n=`${e||""}::${t||""}`.toLowerCase().trim();qi!==n&&(qi=n,fo=Ns(),uo=Fs())};Ki();var wa=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="",c="",u=n.match(/^name:\s*(.+)$/m),a=n.match(/^description:\s*(.+)$/m);return u&&(o=u[1].trim().replace(/^["']|["']$/g,"")),a&&(c=a[1].trim().replace(/^["']|["']$/g,"")),o&&c?{name:o,description:c}:null},Ta=e=>{let t=[];if(!e||!sn.existsSync(e))return t;let n=(s,o=0)=>{if(!(o>5))try{let c=sn.readdirSync(s,{withFileTypes:!0});for(let u of c){let a=fn.join(s,u.name),y=u.name.toLowerCase();u.isFile()?y==="skill.md"&&t.push(a):u.isDirectory()&&(o===0?(y==="skills"||y===".skills"||y==="skill"||y===".skill")&&n(a,o+1):n(a,o+1))}}catch{}};return n(e,0),t},or=e=>{let t=Ta(e),n=[];for(let s of t)try{let o=sn.readFileSync(s,"utf8"),c=wa(o);c&&n.push({...c,filePath:s})}catch{}return n},sr=e=>!e||e.length===0?"":e.map(t=>`- ${t.name}: ${t.description}`).join(`
|
|
484
485
|
`),ir=or(on),rr=or(process.cwd()),Ms=sr(ir),Is=sr(rr),ar=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"},lr=()=>(ir||[]).filter(e=>!ar(e)),cr=()=>(rr||[]).filter(e=>!ar(e)),lc=(Bs?1:0)+(Dn?.length||(Bo?1:0))+(fo?1:0)+(uo?1:0)+lr().length+cr().length,Ds=(e,t="Project")=>{if(!e)return"";let n=e.replace(/\\/g,"/");if(t==="Global"){let o=pa.homedir().replace(/\\/g,"/");return n.toLowerCase().startsWith(o.toLowerCase())?"~"+n.slice(o.length):n}let s=fn.relative(process.cwd(),e).replace(/\\/g,"/");return s.startsWith(".")?s:`./${s}`},cc=()=>{fo=Ns(),uo=Fs();let e=[];$o&&Bs.length>0&&e.push({scope:"Global",path:$o}),Dn&&Dn.length>0&&Bo.length>0?Dn.forEach(c=>{e.push({scope:"Project",path:c})}):Os&&Bo.length>0&&e.push({scope:"Project",path:Os}),No&&fo.length>0&&e.push({scope:"Global",path:No}),Fo&&uo.length>0&&e.push({scope:"Project",path:Fo});let t=lr(),n=cr(),s=e.length+t.length+n.length;if(s===0)return`\u2726 Loaded Files & Instructions
|
|
485
486
|
\u2800\u2800\x1B[2m\u2514\u2500\x1B[22m No instruction or skill files are currently loaded.
|
|
486
487
|
\u2800`;let o=[];return o.push(`\u2726 Loaded Files & Instructions (${s} ${s===1?"file":"files"} active)`),e.length>0&&(o.push(`
|
|
@@ -570,7 +571,7 @@ ${vi(t,n)}
|
|
|
570
571
|
=== END SYSTEM PROMPT ===${e?`
|
|
571
572
|
|
|
572
573
|
-- current saved user memories --
|
|
573
|
-
${e}`:""}`.trim();var hr=()=>import("./web_search-D2GOWARI.js").then(e=>e.web_search),mr=()=>import("./web_scrape-LAQI7CVA.js").then(e=>e.web_scrape),pr=()=>import("./memory-5CNSGF6X.js").then(e=>e.memory),yr=()=>import("./chat-J5AAPLPF.js").then(e=>e.chat),xr=()=>import("./view_file-4UCCUBFK.js").then(e=>e.view_file),br=()=>import("./write_file-MDPZMOG3.js").then(e=>e.write_file),kr=()=>import("./update_file-2YCGNOBP.js").then(e=>e.update_file),wr=()=>import("./exec_command-ER3K4TLH.js").then(e=>e.exec_command),Tr=()=>import("./read_folder-OOKZITME.js").then(e=>e.read_folder),Us=()=>import("./ask_user-K2DLZF6H.js").then(e=>e.ask_user),Sr=()=>import("./write_pdf-KF7HZODR.js").then(e=>e.write_pdf),_r=()=>import("./write_docx-J5OO4ZSE.js").then(e=>e.write_docx),Uo=()=>import("./search_keyword-EAMQWPPI.js").then(e=>e.search_keyword),Ar=()=>import("./generate_image-S6M2GCD7.js").then(e=>e.generate_image),Wo=()=>import("./saveSummary-XQ2STWSN.js").then(e=>e.saveSummary),ho=()=>import("./addMemScore-COX3MDEK.js").then(e=>e.addMemScore),Er=()=>import("./file_map-XK7BFZFI.js").then(e=>e.file_map),Ho=()=>import("./todo-C5HHG7TN.js").then(e=>e.todo),Cr=()=>import("./invokeSync-LXDZKOPO.js").then(e=>e.invokeSync),_a=()=>import("./invoke-ZGIGNTE6.js").then(e=>e.invoke),Rr=()=>import("./getProgress-VG2IBPZU.js").then(e=>e.getProgress),Aa=()=>import("./cancel-7IMADALP.js").then(e=>e.cancel),vr=()=>import("./emergency_rollback-6M5EH75W.js").then(e=>e.emergency_rollback),mo=()=>import("./awaitSubagent-JTUSJDKD.js").then(e=>e.awaitSubagent),po=()=>import("./answerSubagent-JUVFNLE5.js").then(e=>e.answerSubagent),Go=()=>import("./steerSubagent-L2JVT4QN.js").then(e=>e.steerSubagent),jo=()=>import("./computer_action-YCFAAZNA.js").then(e=>e.computer_action),Mr=()=>import("./click-HS7NJR6J.js").then(e=>e.click),Ir=()=>import("./drag-SBWNKGDV.js").then(e=>e.drag),Dr=()=>import("./scroll-TA2JTVSR.js").then(e=>e.scroll),Ws=()=>import("./keyboard_typing-IWKUCQE4.js").then(e=>e.keyboard_typing),Hs=()=>import("./key_press-BT6QQ24M.js").then(e=>e.key_press),Gs=()=>import("./recapture_screen-5FKLOHJL.js").then(e=>e.recapture_screen),Ea={web_search:hr,web_scrape:mr,memory:pr,chat:yr,view_file:xr,write_file:br,update_file:kr,exec_command:wr,read_folder:Tr,write_pdf:Sr,write_docx:_r,search_keyword:Uo,generate_image:Ar,saveSummary:Wo,addMemScore:ho,file_map:Er,todo:Ho,Todo:Ho,goal:Ho,Goal:Ho,invokeSync:Cr,invoke:_a,getProgress:Rr,cancel:Aa,awaitSubagent:mo,answerSubagent:po,steerSubagent:Go,computer_action:jo,computer_use:jo,ComputerAction:jo,ComputerUse:jo,click:Mr,Click:Mr,drag:Ir,Drag:Ir,scroll:Dr,Scroll:Dr,keyboard_typing:Ws,KeyboardTyping:Ws,keyboardtyping:Ws,key_press:Hs,KeyPress:Hs,keypress:Hs,recapture_screen:Gs,RecaptureScreen:Gs,recapturescreen:Gs,invoke_sync:Cr,get_progress:Rr,await_subagent:mo,answer_subagent:po,steer_subagent:Go,steer:Go,Steer:Go,ask:Us,Ask:Us,AskUser:Us,WebSearch:hr,WebScrape:mr,ReadFile:xr,ReadFolder:Tr,WriteFile:br,PatchFile:kr,WritePDF:Sr,WriteDoc:_r,Run:wr,SearchKeyword:Uo,CodeSearch:Uo,code_search:Uo,Memory:pr,Chat:yr,GenerateImage:Ar,saveSumary:Wo,SaveSummary:Wo,SaveSumary:Wo,add_mem_score:ho,AddMemScore:ho,addMemoryScore:ho,AddMemoryScore:ho,FileMap:Er,answer:po,Answer:po,AnswerSubagent:po,await:mo,Await:mo,AwaitSubagent:mo,EmergencyRollback:vr,emergency_rollback:vr},yo=async(e,t,n={})=>{let s=n.mode?n.mode.toLowerCase():"flux",o=e.toLowerCase(),u=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await"].some(g=>o.includes(g))||o==="ask",y=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer"].some(g=>o.includes(g));if(!u){if(s==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Tool [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(s==="icu"){if(!y)return`ERROR: Tool [${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: Tool [${e}] is not available in ${n.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let p=Ea[e];if(!p){let g=["ReadFile","ReadFolder","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],b={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:"CodeSearch",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"},h=o.replace(/[^a-z0-9]/g,""),i=b[h]||null;if(!i){let k=0,v=_=>{let P=new Set;for(let E=0;E<_.length-1;E++)P.add(_.slice(E,E+2));return P},m=v(h);for(let _ of g){let P=_.toLowerCase().replace(/[^a-z0-9]/g,"");if(h===P){i=_;break}let E=0;(P.includes(h)||h.includes(P))&&(E+=.6);let S=v(P),R=0;for(let w of m)S.has(w)&&R++;let $=2*R/(m.size+S.size||1);E=Math.max(E,$),E>k&&E>=.35&&(k=E,i=_)}}let l=i?` Do you mean '${i}'?`:"";return`ERROR: Tool [${e}] not found in registry.${l}`}try{return await(await p())(t,n)}catch(g){let b=g instanceof Error?g.message:String(g);return`ERROR: Execution failed for [${e}]: ${b}`}};import te from"path";import He from"fs";import Ca from"gradient-string";var js=["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 Or=[{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"]}],xo={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"]},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"]},"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"]},"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"]},"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:void 0,diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:void 0,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"]},"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:void 0,diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:void 0,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"]},"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"]},"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"]}};var Vo=null;var Lr=(e="Dark")=>{let t;e==="Mystery"||e==="Chaos"?(Vo||(Vo=Or[Math.floor(Math.random()*Or.length)]),t={...Vo,id:"Mystery"}):(Vo=null,xo[e]?t=xo[e]:e==="GitHub"?t=xo["GitHub Dark"]:e==="Transparent"?t=xo["Transparent Dark"]:t=xo.Dark);let n=t.codeText||t.secondary||t.info||t.logoGradient&&t.logoGradient[0]||"cyan";return{...t,codeText:n}};var Ra=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",xc=(e=2)=>{let t=Ra();return t==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},bc=(e="...",t="Loading...",n="Dark")=>{let s=js[Math.floor(Math.random()*js.length)],o=Lr(n),c=o.logoTextAnsi,u=o.logoBodyAnsi,a=o.logoMutedAnsi,y="\x1B[0m",p=[" \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 "],g=o.logoGradient||["#0077ff","#ff00ff"],b=Ca(g).multiline(p.join(`
|
|
574
|
+
${e}`:""}`.trim();var hr=()=>import("./web_search-D2GOWARI.js").then(e=>e.web_search),mr=()=>import("./web_scrape-LAQI7CVA.js").then(e=>e.web_scrape),pr=()=>import("./memory-5CNSGF6X.js").then(e=>e.memory),yr=()=>import("./chat-J5AAPLPF.js").then(e=>e.chat),xr=()=>import("./view_file-4UCCUBFK.js").then(e=>e.view_file),br=()=>import("./write_file-MDPZMOG3.js").then(e=>e.write_file),kr=()=>import("./update_file-2YCGNOBP.js").then(e=>e.update_file),wr=()=>import("./exec_command-27EPEAE5.js").then(e=>e.exec_command),Tr=()=>import("./read_folder-OOKZITME.js").then(e=>e.read_folder),Us=()=>import("./ask_user-K2DLZF6H.js").then(e=>e.ask_user),Sr=()=>import("./write_pdf-KF7HZODR.js").then(e=>e.write_pdf),_r=()=>import("./write_docx-J5OO4ZSE.js").then(e=>e.write_docx),Uo=()=>import("./search_keyword-EAMQWPPI.js").then(e=>e.search_keyword),Ar=()=>import("./generate_image-S6M2GCD7.js").then(e=>e.generate_image),Wo=()=>import("./saveSummary-XQ2STWSN.js").then(e=>e.saveSummary),ho=()=>import("./addMemScore-COX3MDEK.js").then(e=>e.addMemScore),Er=()=>import("./file_map-XK7BFZFI.js").then(e=>e.file_map),Ho=()=>import("./todo-C5HHG7TN.js").then(e=>e.todo),Cr=()=>import("./invokeSync-7PK3CJVJ.js").then(e=>e.invokeSync),_a=()=>import("./invoke-GKLK35YP.js").then(e=>e.invoke),Rr=()=>import("./getProgress-VG2IBPZU.js").then(e=>e.getProgress),Aa=()=>import("./cancel-7IMADALP.js").then(e=>e.cancel),vr=()=>import("./emergency_rollback-6M5EH75W.js").then(e=>e.emergency_rollback),mo=()=>import("./awaitSubagent-JTUSJDKD.js").then(e=>e.awaitSubagent),po=()=>import("./answerSubagent-JUVFNLE5.js").then(e=>e.answerSubagent),Go=()=>import("./steerSubagent-L2JVT4QN.js").then(e=>e.steerSubagent),jo=()=>import("./computer_action-YCFAAZNA.js").then(e=>e.computer_action),Mr=()=>import("./click-HS7NJR6J.js").then(e=>e.click),Ir=()=>import("./drag-SBWNKGDV.js").then(e=>e.drag),Dr=()=>import("./scroll-TA2JTVSR.js").then(e=>e.scroll),Ws=()=>import("./keyboard_typing-IWKUCQE4.js").then(e=>e.keyboard_typing),Hs=()=>import("./key_press-BT6QQ24M.js").then(e=>e.key_press),Gs=()=>import("./recapture_screen-5FKLOHJL.js").then(e=>e.recapture_screen),Ea={web_search:hr,web_scrape:mr,memory:pr,chat:yr,view_file:xr,write_file:br,update_file:kr,exec_command:wr,read_folder:Tr,write_pdf:Sr,write_docx:_r,search_keyword:Uo,generate_image:Ar,saveSummary:Wo,addMemScore:ho,file_map:Er,todo:Ho,Todo:Ho,goal:Ho,Goal:Ho,invokeSync:Cr,invoke:_a,getProgress:Rr,cancel:Aa,awaitSubagent:mo,answerSubagent:po,steerSubagent:Go,computer_action:jo,computer_use:jo,ComputerAction:jo,ComputerUse:jo,click:Mr,Click:Mr,drag:Ir,Drag:Ir,scroll:Dr,Scroll:Dr,keyboard_typing:Ws,KeyboardTyping:Ws,keyboardtyping:Ws,key_press:Hs,KeyPress:Hs,keypress:Hs,recapture_screen:Gs,RecaptureScreen:Gs,recapturescreen:Gs,invoke_sync:Cr,get_progress:Rr,await_subagent:mo,answer_subagent:po,steer_subagent:Go,steer:Go,Steer:Go,ask:Us,Ask:Us,AskUser:Us,WebSearch:hr,WebScrape:mr,ReadFile:xr,ReadFolder:Tr,WriteFile:br,PatchFile:kr,WritePDF:Sr,WriteDoc:_r,Run:wr,SearchKeyword:Uo,CodeSearch:Uo,code_search:Uo,Memory:pr,Chat:yr,GenerateImage:Ar,saveSumary:Wo,SaveSummary:Wo,SaveSumary:Wo,add_mem_score:ho,AddMemScore:ho,addMemoryScore:ho,AddMemoryScore:ho,FileMap:Er,answer:po,Answer:po,AnswerSubagent:po,await:mo,Await:mo,AwaitSubagent:mo,EmergencyRollback:vr,emergency_rollback:vr},yo=async(e,t,n={})=>{let s=n.mode?n.mode.toLowerCase():"flux",o=e.toLowerCase(),u=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await"].some(g=>o.includes(g))||o==="ask",y=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer"].some(g=>o.includes(g));if(!u){if(s==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Tool [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(s==="icu"){if(!y)return`ERROR: Tool [${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: Tool [${e}] is not available in ${n.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let p=Ea[e];if(!p){let g=["ReadFile","ReadFolder","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],b={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:"CodeSearch",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"},h=o.replace(/[^a-z0-9]/g,""),i=b[h]||null;if(!i){let k=0,v=_=>{let P=new Set;for(let E=0;E<_.length-1;E++)P.add(_.slice(E,E+2));return P},m=v(h);for(let _ of g){let P=_.toLowerCase().replace(/[^a-z0-9]/g,"");if(h===P){i=_;break}let E=0;(P.includes(h)||h.includes(P))&&(E+=.6);let S=v(P),R=0;for(let w of m)S.has(w)&&R++;let $=2*R/(m.size+S.size||1);E=Math.max(E,$),E>k&&E>=.35&&(k=E,i=_)}}let l=i?` Do you mean '${i}'?`:"";return`ERROR: Tool [${e}] not found in registry.${l}`}try{return await(await p())(t,n)}catch(g){let b=g instanceof Error?g.message:String(g);return`ERROR: Execution failed for [${e}]: ${b}`}};import te from"path";import He from"fs";import Ca from"gradient-string";var js=["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 Or=[{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"]}],xo={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"]},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"]},"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"]},"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"]},"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:void 0,diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:void 0,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"]},"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:void 0,diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:void 0,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"]},"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"]},"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"]}};var Ko=null;var Lr=(e="Dark")=>{let t;e==="Mystery"||e==="Chaos"?(Ko||(Ko=Or[Math.floor(Math.random()*Or.length)]),t={...Ko,id:"Mystery"}):(Ko=null,xo[e]?t=xo[e]:e==="GitHub"?t=xo["GitHub Dark"]:e==="Transparent"?t=xo["Transparent Dark"]:t=xo.Dark);let n=t.codeText||t.secondary||t.info||t.logoGradient&&t.logoGradient[0]||"cyan";return{...t,codeText:n}};var Ra=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",xc=(e=2)=>{let t=Ra();return t==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},bc=(e="...",t="Loading...",n="Dark")=>{let s=js[Math.floor(Math.random()*js.length)],o=Lr(n),c=o.logoTextAnsi,u=o.logoBodyAnsi,a=o.logoMutedAnsi,y="\x1B[0m",p=[" \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 "],g=o.logoGradient||["#0077ff","#ff00ff"],b=Ca(g).multiline(p.join(`
|
|
574
575
|
`)).split(`
|
|
575
576
|
`),h=i=>`${a}${i}${y}`;return`${b[0]}
|
|
576
577
|
${b[1]} ${c}Selected Provider: ${t}${y}
|
|
@@ -580,7 +581,7 @@ ${b[4]}
|
|
|
580
581
|
${b[5]} ${u}See /help for additional commands.${y}
|
|
581
582
|
${b[6]} ${h(s)}
|
|
582
583
|
${b[7]}
|
|
583
|
-
`};import{WebSocket as
|
|
584
|
+
`};import{WebSocket as Vo}from"ws";var Wt=null,Xn=!1,va="ws://localhost:56832",Ks=[],Qn=null,Vs=null,Pr="2.0.0",Tc=e=>{Pr=e,$r()},Ys=e=>{Vs=e},$r=()=>{if(Wt||Xn)return;Xn=!0;let e=new Vo(va);e.on("open",()=>{for(Wt=e,Xn=!1,Wt.send(JSON.stringify({command:"version",version:Pr,pid:process.pid,ppid:process.ppid}));Ks.length>0;)Wt.send(JSON.stringify(Ks.shift()))}),e.on("message",t=>{try{let n=JSON.parse(t.toString());n.command==="contextResponse"&&Qn?(Qn(n.data),Qn=null):n.command==="securityResponse"&&Vs&&Vs(n.result)}catch{}}),e.on("error",()=>{Xn=!1,Wt=null}),e.on("close",()=>{Xn=!1,Wt=null})},Yo=e=>{Wt&&Wt.readyState===Vo.OPEN?Wt.send(JSON.stringify(e)):(Ks.push(e),Xn||$r())},qo=()=>Wt!==null&&Wt.readyState===Vo.OPEN,Sc=e=>{Yo({command:"status",status:e})},Hn=()=>new Promise(e=>{if(!Wt||Wt.readyState!==Vo.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}Qn=e,Wt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{Qn===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),Qn=null)},1e3)}),Nr=e=>{Yo({command:"open",filePath:e})},qs=(e,t,n)=>{Yo({command:"showDiff",filePath:e,originalContent:t,modifiedContent:n})},Fr=(e,t)=>{Yo({command:"closeDiff",filePath:e,result:t})};import Br from"path";import Ma from"fs";var Ia=e=>{try{return Ma.readdirSync(e,{withFileTypes:!0})}catch{return[]}},zs=(e,t,n=1,s=Ia,o=[],c=null)=>{let u=c||s(e),a=" ".repeat(n-1);if(u.length>100)return`${a}${Br.basename(e)}/ (>100 files)
|
|
584
585
|
`;let y="",p=o,g=u.filter(l=>!p.includes(l.name)&&!l.name.startsWith(".")),b=u.filter(l=>p.includes(l.name)||l.name.startsWith(".")).map(l=>l.name).sort();b.length>0&&(y+=`${a}[ignored: ${b.map(l=>l+"/").join(", ")}]
|
|
585
586
|
`);let h=g.filter(l=>l.isDirectory()).sort((l,k)=>l.name.localeCompare(k.name)),i=g.filter(l=>!l.isDirectory()).map(l=>l.name).sort();for(let l of h){let k=Br.join(e,l.name);if(n>t)y+=`${a}${l.name}/ (max depth)
|
|
586
587
|
`;else{let v=s(k);v.length>80?y+=`${a}${l.name}/ (>80 files)
|
|
@@ -602,12 +603,12 @@ ${b[7]}
|
|
|
602
603
|
`);P=f.pop();for(let r of f){let A=r.trim();if(!A||!A.startsWith("data: "))continue;let M=!1;if(A==="data: [DONE]")M=!0;else try{let W=JSON.parse(A.substring(6)),D=W.choices?.[0]?.delta,O=W.usage;if(O&&(S={totalTokenCount:O.total_tokens||(O.prompt_tokens||0)+(O.completion_tokens||0),promptTokenCount:O.prompt_tokens||0,candidatesTokenCount:O.completion_tokens||0,cachedContentTokenCount:O.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:O.completion_tokens_details?.reasoning_tokens||O.reasoning_tokens||0},$=!0),D){let ae=D.reasoning||D.reasoning_content||null;if(ae&&(E.push({text:ae,thought:!0}),$=!0),D.content){let de=D.content;l&&w&&de.length>0&&(de="<think>"+de,w=!1),E.push({text:de}),$=!0}}}catch{}if((M||Date.now()-R>=150||S)&&$&&(yield{candidates:E.length>0?[{content:{parts:[...E]}}]:[],usageMetadata:S},E=[],R=Date.now(),$=!1),M)break}Date.now()-R>=150&&$&&(yield{candidates:E.length>0?[{content:{parts:[...E]}}]:[],usageMetadata:S},E=[],R=Date.now(),$=!1)}};var ts=async function*(e,t,n,s,o,c,u,a,y=1){let p=[];s&&p.push({role:"system",content:s});for(let R of n){let $=R.role==="user"?"user":"assistant",w=[];if(Array.isArray(R.parts)){for(let d of R.parts)if(d.text)w.push({type:"text",text:d.text});else if(d.inlineData&&u){let C=d.inlineData.mimeType,f=d.inlineData.data;C.startsWith("image/")&&w.push({type:"image_url",image_url:{url:`data:${C};base64,${f}`}})}}else{let d=R.text||"";d&&w.push({type:"text",text:d})}p.push({role:$,content:w.length===1&&w[0].type==="text"?w[0].text:w})}let g=je("SenseNova",t,o),h=g!==null?g:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[o],i={model:t,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:y};h&&(i.reasoning_effort=h);let l=await et("https://token.sensenova.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i),signal:a});if(!l.ok){let R=await l.json().catch(()=>({}));throw new Error(`SenseNova Error (${l.status}): ${R.error?.message||l.statusText}`)}let k=l.body.getReader(),v=new TextDecoder,m="",_=[],P=null,E=Date.now(),S=!1;for(;;){let{done:R,value:$}=await k.read();if(R){S&&(_.length>0||P)&&(yield{candidates:_.length>0?[{content:{parts:_}}]:[],usageMetadata:P});break}m+=v.decode($,{stream:!0});let w=m.split(`
|
|
603
604
|
`);m=w.pop();for(let d of w){let C=d.trim();if(!C||!C.startsWith("data: "))continue;let f=!1;if(C==="data: [DONE]")f=!0;else try{let r=JSON.parse(C.substring(6)),A=r.choices?.[0]?.delta,M=r.usage;if(M&&(P={totalTokenCount:M.total_tokens||(M.prompt_tokens||0)+(M.completion_tokens||0),promptTokenCount:M.prompt_tokens||0,candidatesTokenCount:M.completion_tokens||0,cachedContentTokenCount:M.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:M.completion_tokens_details?.reasoning_tokens||M.reasoning_tokens||0},S=!0),A){let W=A.reasoning||A.reasoning_content||null;W&&(_.push({text:W,thought:!0}),S=!0),A.content&&(_.push({text:A.content}),S=!0)}}catch{}if((f||Date.now()-E>=150||P)&&S&&(yield{candidates:_.length>0?[{content:{parts:[..._]}}]:[],usageMetadata:P},_=[],E=Date.now(),S=!1),f)break}Date.now()-E>=150&&S&&(yield{candidates:_.length>0?[{content:{parts:[..._]}}]:[],usageMetadata:P},_=[],E=Date.now(),S=!1)}};var ns=async function*(e,t,n,s,o,c,u,a,y=1){let p=[];s&&p.push({role:"system",content:s});for(let R of n){let $=R.role==="user"?"user":"assistant",w=[];if(Array.isArray(R.parts)){for(let d of R.parts)if(d.text)w.push({type:"text",text:d.text});else if(d.inlineData&&u){let C=d.inlineData.mimeType,f=d.inlineData.data;C.startsWith("image/")&&w.push({type:"image_url",image_url:{url:`data:${C};base64,${f}`}})}}else{let d=R.text||"";d&&w.push({type:"text",text:d})}p.push({role:$,content:w.length===1&&w[0].type==="text"?w[0].text:w})}let g=je("AIHubMix",t,o),h=g!==null?g:{Fast:"minimal",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[o],i={model:t,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:y};h&&(i.reasoning_effort=h);let l=await et("https://aihubmix.com/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(i),signal:a});if(!l.ok){let R=await l.json().catch(()=>({}));throw new Error(`AIHubMix Error (${l.status}): ${R.error?.message||l.statusText}`)}let k=l.body.getReader(),v=new TextDecoder,m="",_=[],P=null,E=Date.now(),S=!1;for(;;){let{done:R,value:$}=await k.read();if(R){S&&(_.length>0||P)&&(yield{candidates:_.length>0?[{content:{parts:_}}]:[],usageMetadata:P});break}m+=v.decode($,{stream:!0});let w=m.split(`
|
|
604
605
|
`);m=w.pop();for(let d of w){let C=d.trim();if(!C||!C.startsWith("data: "))continue;let f=!1;if(C==="data: [DONE]")f=!0;else try{let r=JSON.parse(C.substring(6)),A=r.choices?.[0]?.delta,M=r.usage;if(r.choices?.[0]?.finish_reason&&(f=!0),M&&(P={totalTokenCount:M.total_tokens||(M.prompt_tokens||0)+(M.completion_tokens||0),promptTokenCount:M.prompt_tokens||0,candidatesTokenCount:M.completion_tokens||0,cachedContentTokenCount:M.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:M.completion_tokens_details?.reasoning_tokens||M.reasoning_tokens||0},S=!0),A){let W=A.reasoning_content||null;W&&(_.push({text:W,thought:!0}),S=!0),A.content&&(_.push({text:A.content}),S=!0)}}catch{}if((f||Date.now()-E>=150)&&S&&(yield{candidates:_.length>0?[{content:{parts:[..._]}}]:[],usageMetadata:P},_=[],E=Date.now(),S=!1),f)break}Date.now()-E>=150&&S&&(yield{candidates:_.length>0?[{content:{parts:[..._]}}]:[],usageMetadata:P},_=[],E=Date.now(),S=!1)}};var os=async function*(e,t,n,s,o,c,u,a,y=1){let p=[];s&&p.push({role:"system",content:s});for(let S of n){let R=S.role==="user"?"user":"assistant",$=[];if(Array.isArray(S.parts)){for(let w of S.parts)if(w.text)$.push({type:"text",text:w.text});else if(w.inlineData&&u){let d=w.inlineData.mimeType,C=w.inlineData.data;d.startsWith("image/")&&$.push({type:"image_url",image_url:{url:`data:${d};base64,${C}`}})}}else{let w=S.text||"";w&&$.push({type:"text",text:w})}p.push({role:R,content:$.length===1&&$[0].type==="text"?$[0].text:$})}let g=je("Poolside",t,o),b=g!==null?g===!1||g==="false"||g==="none"||g==="Fast":o==="Fast",h={model:t,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:y};b?h.chat_template_kwargs={enable_thinking:!1}:g!==null&&typeof g=="object"?h.chat_template_kwargs=g:h.chat_template_kwargs={enable_thinking:!0};let i=await et("https://inference.poolside.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify(h),signal:a});if(!i.ok){let S=await i.json().catch(()=>({}));throw new Error(`Poolside Error (${i.status}): ${S.error?.message||i.statusText}`)}let l=i.body.getReader(),k=new TextDecoder,v="",m=[],_=null,P=Date.now(),E=!1;for(;;){let{done:S,value:R}=await l.read();if(S){E&&(m.length>0||_)&&(yield{candidates:m.length>0?[{content:{parts:m}}]:[],usageMetadata:_});break}v+=k.decode(R,{stream:!0});let $=v.split(`
|
|
605
|
-
`);v=$.pop();for(let w of $){let d=w.trim();if(!d||!d.startsWith("data: "))continue;let C=!1;if(d==="data: [DONE]")C=!0;else try{let f=JSON.parse(d.substring(6)),r=f.choices?.[0]?.delta,A=f.usage;if(f.choices?.[0]?.finish_reason&&(C=!0),A&&(_={totalTokenCount:A.total_tokens||(A.prompt_tokens||0)+(A.completion_tokens||0),promptTokenCount:A.prompt_tokens||0,candidatesTokenCount:A.completion_tokens||0,cachedContentTokenCount:A.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:A.completion_tokens_details?.reasoning_tokens||A.reasoning_tokens||0},E=!0),r){let M=r.reasoning_content||r.reasoning||null;M&&(m.push({text:M,thought:!0}),E=!0),r.content&&(m.push({text:r.content}),E=!0)}}catch{}if((C||Date.now()-P>=150)&&E&&(yield{candidates:m.length>0?[{content:{parts:[...m]}}]:[],usageMetadata:_},m=[],P=Date.now(),E=!1),C)break}Date.now()-P>=150&&E&&(yield{candidates:m.length>0?[{content:{parts:[...m]}}]:[],usageMetadata:_},m=[],P=Date.now(),E=!1)}};var ss=async function*(e,t,n,s,o,c,u,a,y=1){let p=[];s&&p.push({role:"system",content:s});for(let d of n){let C=d.role==="user"?"user":"assistant",f=[];if(Array.isArray(d.parts)){for(let r of d.parts)if(r.text)f.push({type:"text",text:r.text});else if(r.inlineData&&u){let A=r.inlineData.mimeType,M=r.inlineData.data;A.startsWith("image/")&&f.push({type:"image_url",image_url:{url:`data:${A};base64,${M}`}})}}else{let r=d.text||"";r&&f.push({type:"text",text:r})}p.push({role:C,content:f.length===1&&f[0].type==="text"?f[0].text:f})}let g=je("9router",t,o)||je("9Router",t,o),h=g!==null?g:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[o],i={model:t,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:y};h&&h!=="none"&&(g!==null||o!=="Fast")&&(i.reasoning_effort=h);let l=process.env["9ROUTER_URL"]||process.env.NINEROUTER_URL||"http://127.0.0.1:20128/v1/chat/completions",k={"Content-Type":"application/json"},v=e&&e!=="LOCAL"?e:process.env
|
|
606
|
+
`);v=$.pop();for(let w of $){let d=w.trim();if(!d||!d.startsWith("data: "))continue;let C=!1;if(d==="data: [DONE]")C=!0;else try{let f=JSON.parse(d.substring(6)),r=f.choices?.[0]?.delta,A=f.usage;if(f.choices?.[0]?.finish_reason&&(C=!0),A&&(_={totalTokenCount:A.total_tokens||(A.prompt_tokens||0)+(A.completion_tokens||0),promptTokenCount:A.prompt_tokens||0,candidatesTokenCount:A.completion_tokens||0,cachedContentTokenCount:A.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:A.completion_tokens_details?.reasoning_tokens||A.reasoning_tokens||0},E=!0),r){let M=r.reasoning_content||r.reasoning||null;M&&(m.push({text:M,thought:!0}),E=!0),r.content&&(m.push({text:r.content}),E=!0)}}catch{}if((C||Date.now()-P>=150)&&E&&(yield{candidates:m.length>0?[{content:{parts:[...m]}}]:[],usageMetadata:_},m=[],P=Date.now(),E=!1),C)break}Date.now()-P>=150&&E&&(yield{candidates:m.length>0?[{content:{parts:[...m]}}]:[],usageMetadata:_},m=[],P=Date.now(),E=!1)}};var ss=async function*(e,t,n,s,o,c,u,a,y=1){let p=[];s&&p.push({role:"system",content:s});for(let d of n){let C=d.role==="user"?"user":"assistant",f=[];if(Array.isArray(d.parts)){for(let r of d.parts)if(r.text)f.push({type:"text",text:r.text});else if(r.inlineData&&u){let A=r.inlineData.mimeType,M=r.inlineData.data;A.startsWith("image/")&&f.push({type:"image_url",image_url:{url:`data:${A};base64,${M}`}})}}else{let r=d.text||"";r&&f.push({type:"text",text:r})}p.push({role:C,content:f.length===1&&f[0].type==="text"?f[0].text:f})}let g=je("9router",t,o)||je("9Router",t,o),h=g!==null?g:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[o],i={model:t,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:y};h&&h!=="none"&&(g!==null||o!=="Fast")&&(i.reasoning_effort=h);let l=process.env["9ROUTER_URL"]||process.env.NINEROUTER_URL||"http://127.0.0.1:20128/v1/chat/completions",k={"Content-Type":"application/json"},v=e&&e!=="LOCAL"?e:process.env.NINEROUTER_KEY||"dummy-key";k.Authorization=`Bearer ${v}`;let m=await et(l,{method:"POST",headers:k,body:JSON.stringify(i),signal:a});if(!m.ok){let d=await m.json().catch(()=>({}));throw new Error(`9router Error (${m.status}): ${d.error?.message||m.statusText}`)}let _=m.body.getReader(),P=new TextDecoder,E="",S=[],R=null,$=Date.now(),w=!1;for(;;){let{done:d,value:C}=await _.read();if(d){w&&(S.length>0||R)&&(yield{candidates:S.length>0?[{content:{parts:S}}]:[],usageMetadata:R});break}E+=P.decode(C,{stream:!0});let f=E.split(`
|
|
606
607
|
`);E=f.pop();for(let r of f){let A=r.trim();if(!A||!A.startsWith("data: "))continue;let M=!1;if(A==="data: [DONE]")M=!0;else try{let W=JSON.parse(A.substring(6)),D=W.choices?.[0]?.delta,O=W.usage;if(W.choices?.[0]?.finish_reason&&(M=!0),O&&(R={totalTokenCount:O.total_tokens||(O.prompt_tokens||0)+(O.completion_tokens||0),promptTokenCount:O.prompt_tokens||0,candidatesTokenCount:O.completion_tokens||0,cachedContentTokenCount:O.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:O.completion_tokens_details?.reasoning_tokens||O.reasoning_tokens||0},w=!0),D){let ae=D.reasoning_content||D.reasoning||D.thinking||null;!ae&&Array.isArray(D.reasoning_details)&&D.reasoning_details.length>0&&(ae=D.reasoning_details.map(de=>typeof de=="string"?de:de?.text||"").filter(Boolean).join("")),ae&&(S.push({text:ae,thought:!0}),w=!0),D.content&&(S.push({text:D.content}),w=!0)}}catch{}if((M||Date.now()-$>=150)&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1),M)break}Date.now()-$>=150&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1)}};var is=async function*(e,t,n,s,o,c,u,a,y=1){let p=[];s&&p.push({role:"system",content:s});for(let d of n){let C=d.role==="user"?"user":"assistant",f=[];if(Array.isArray(d.parts)){for(let r of d.parts)if(r.text)f.push({type:"text",text:r.text});else if(r.inlineData&&u){let A=r.inlineData.mimeType,M=r.inlineData.data;A.startsWith("image/")&&f.push({type:"image_url",image_url:{url:`data:${A};base64,${M}`}})}}else{let r=d.text||"";r&&f.push({type:"text",text:r})}p.push({role:C,content:f.length===1&&f[0].type==="text"?f[0].text:f})}let g=je("ExpLabs",t,o),h=g!==null?g:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[o],i={model:t,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:y};h&&(i.reasoning_effort=h);let l=process.env.EXPLABS_URL||process.env.EXPERIENTIALLABS_URL||"https://api.experientiallabs.ai/v1/chat/completions",k={"Content-Type":"application/json"},v=e||process.env.EXPLABS_API_KEY||process.env.EXPERIENTIALLABS_API_KEY||"";k.Authorization=`Bearer ${v}`;let m=await et(l,{method:"POST",headers:k,body:JSON.stringify(i),signal:a});if(!m.ok){let d=await m.json().catch(()=>({}));throw new Error(`Experiential Labs Error (${m.status}): ${d.error?.message||d.message||m.statusText}`)}let _=m.body.getReader(),P=new TextDecoder,E="",S=[],R=null,$=Date.now(),w=!1;for(;;){let{done:d,value:C}=await _.read();if(d){w&&(S.length>0||R)&&(yield{candidates:S.length>0?[{content:{parts:S}}]:[],usageMetadata:R});break}E+=P.decode(C,{stream:!0});let f=E.split(`
|
|
607
608
|
`);E=f.pop();for(let r of f){let A=r.trim();if(!A||!A.startsWith("data: "))continue;let M=!1;if(A==="data: [DONE]")M=!0;else try{let W=JSON.parse(A.substring(6)),D=W.choices?.[0]?.delta,O=W.usage;if(O&&(R={totalTokenCount:O.total_tokens||(O.prompt_tokens||0)+(O.completion_tokens||0),promptTokenCount:O.prompt_tokens||0,candidatesTokenCount:O.completion_tokens||0,cachedContentTokenCount:O.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:O.completion_tokens_details?.reasoning_tokens||O.reasoning_tokens||0},w=!0),D){let ae=D.reasoning_content||D.reasoning||null;!ae&&Array.isArray(D.reasoning_details)&&D.reasoning_details.length>0&&(ae=D.reasoning_details.map(de=>de.text||"").filter(Boolean).join("")),ae&&(S.push({text:ae,thought:!0}),w=!0),D.content&&(S.push({text:D.content}),w=!0)}}catch{}if((M||Date.now()-$>=150)&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1),M)break}Date.now()-$>=150&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1)}};var Zs=async function*(e,t,n,s,o,c,u,a,y=1){let p=[];s&&p.push({role:"system",content:s});for(let d of n){let C=d.role==="user"?"user":"assistant",f=[];if(Array.isArray(d.parts)){for(let r of d.parts)if(r.text)f.push({type:"text",text:r.text});else if(r.inlineData&&u){let A=r.inlineData.mimeType,M=r.inlineData.data;A.startsWith("image/")&&f.push({type:"image_url",image_url:{url:`data:${A};base64,${M}`}})}}else{let r=d.text||"";r&&f.push({type:"text",text:r})}p.push({role:C,content:f.length===1&&f[0].type==="text"?f[0].text:f})}let g=je("TokenHarbor",t,o),h=g!==null?g:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[o],i={model:t,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:y};h&&(i.reasoning_effort=h);let l=process.env.TOKENHARBOR_URL||process.env.TOKEN_HARBOR_URL||"https://tokenharbor.ai/v1/chat/completions",k={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},v=e||process.env.TOKENHARBOR_API_KEY||process.env.TOKEN_HARBOR_API_KEY||"";k.Authorization=`Bearer ${v}`;let m=await et(l,{method:"POST",headers:k,body:JSON.stringify(i),signal:a});if(!m.ok){let d=await m.json().catch(()=>({}));throw new Error(`Token Harbor Error (${m.status}): ${d.error?.message||d.message||m.statusText}`)}let _=m.body.getReader(),P=new TextDecoder,E="",S=[],R=null,$=Date.now(),w=!1;for(;;){let{done:d,value:C}=await _.read();if(d){w&&(S.length>0||R)&&(yield{candidates:S.length>0?[{content:{parts:S}}]:[],usageMetadata:R});break}E+=P.decode(C,{stream:!0});let f=E.split(`
|
|
608
609
|
`);E=f.pop();for(let r of f){let A=r.trim();if(!A||!A.startsWith("data: "))continue;let M=!1;if(A==="data: [DONE]")M=!0;else try{let W=JSON.parse(A.substring(6)),D=W.choices?.[0]?.delta,O=W.usage;if(O&&(R={totalTokenCount:O.total_tokens||(O.prompt_tokens||0)+(O.completion_tokens||0),promptTokenCount:O.prompt_tokens||0,candidatesTokenCount:O.completion_tokens||0,cachedContentTokenCount:O.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:O.completion_tokens_details?.reasoning_tokens||O.reasoning_tokens||0},w=!0),D){let ae=D.reasoning_content||D.reasoning||null;!ae&&Array.isArray(D.reasoning_details)&&D.reasoning_details.length>0&&(ae=D.reasoning_details.map(de=>de.text||"").filter(Boolean).join("")),ae&&(S.push({text:ae,thought:!0}),w=!0),D.content&&(S.push({text:D.content}),w=!0)}}catch{}if((M||Date.now()-$>=150)&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1),M)break}Date.now()-$>=150&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1)}};var ei=async function*(e,t,n,s,o,c,u,a,y=1){let p=[];s&&p.push({role:"system",content:s});for(let d of n){let C=d.role==="user"?"user":"assistant",f=[];if(Array.isArray(d.parts)){for(let r of d.parts)if(r.text)f.push({type:"text",text:r.text});else if(r.inlineData&&u){let A=r.inlineData.mimeType,M=r.inlineData.data;A.startsWith("image/")&&f.push({type:"image_url",image_url:{url:`data:${A};base64,${M}`}})}}else{let r=d.text||"";r&&f.push({type:"text",text:r})}p.push({role:C,content:f.length===1&&f[0].type==="text"?f[0].text:f})}let g=je("APInex",t,o),h=g!==null?g:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[o],i={model:t,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:y};h&&(i.reasoning_effort=h);let l=process.env.APINEX_URL||"https://api.apinex.bond/v1/chat/completions",k={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},v=e||process.env.APINEX_API_KEY||"";k.Authorization=`Bearer ${v}`;let m=await et(l,{method:"POST",headers:k,body:JSON.stringify(i),signal:a});if(!m.ok){let d=await m.json().catch(()=>({}));throw new Error(`APInex Error (${m.status}): ${d.error?.message||d.message||m.statusText}`)}let _=m.body.getReader(),P=new TextDecoder,E="",S=[],R=null,$=Date.now(),w=!1;for(;;){let{done:d,value:C}=await _.read();if(d){w&&(S.length>0||R)&&(yield{candidates:S.length>0?[{content:{parts:S}}]:[],usageMetadata:R});break}E+=P.decode(C,{stream:!0});let f=E.split(`
|
|
609
|
-
`);E=f.pop();for(let r of f){let A=r.trim();if(!A||!A.startsWith("data: "))continue;let M=!1;if(A==="data: [DONE]")M=!0;else try{let W=JSON.parse(A.substring(6)),D=W.choices?.[0]?.delta,O=W.usage;if(O&&(R={totalTokenCount:O.total_tokens||(O.prompt_tokens||0)+(O.completion_tokens||0),promptTokenCount:O.prompt_tokens||0,candidatesTokenCount:O.completion_tokens||0,cachedContentTokenCount:O.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:O.completion_tokens_details?.reasoning_tokens||O.reasoning_tokens||0},w=!0),D){let ae=D.reasoning_content||D.reasoning||null;!ae&&Array.isArray(D.reasoning_details)&&D.reasoning_details.length>0&&(ae=D.reasoning_details.map(de=>de.text||"").filter(Boolean).join("")),ae&&(S.push({text:ae,thought:!0}),w=!0),D.content&&(S.push({text:D.content}),w=!0)}}catch{}if((M||Date.now()-$>=150)&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1),M)break}Date.now()-$>=150&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1)}};var Pa=/```[\s\S]*?```/g,$a=/```[\s\S]*$/g,Na=/`[^`]+`/g,Fa=/^\|.*\|$/gm,Ba=/^[^\w]+|[^\w]+$/g,Ua=/[^a-z0-9]/gi,bo=/\[\s*tool:(?:functions\.)?([a-z0-9_]+)\s*\(/gi,Wa=/\[\s*(?:tool:(?:functions\.)?|agent:generalist\.)([a-z0-9_]+)\s*\(/gi,Ha=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,Gn=/["']/g,Wr=/\\/g,Ga=/<\|channel>thought/gi,ja=/<channel\|>/gi,
|
|
610
|
-
`),k=i.toLowerCase().includes("tool:functions.")||i.toLowerCase().includes("agent:generalist.");u.push(i),k&&l?y=!0:y=!1}}}),p()}}return n.length},Qa=e=>typeof e!="string"?e:e.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),ff=()=>{bt=!0},uf=()=>bt,ni={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",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",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"},
|
|
610
|
+
`);E=f.pop();for(let r of f){let A=r.trim();if(!A||!A.startsWith("data: "))continue;let M=!1;if(A==="data: [DONE]")M=!0;else try{let W=JSON.parse(A.substring(6)),D=W.choices?.[0]?.delta,O=W.usage;if(O&&(R={totalTokenCount:O.total_tokens||(O.prompt_tokens||0)+(O.completion_tokens||0),promptTokenCount:O.prompt_tokens||0,candidatesTokenCount:O.completion_tokens||0,cachedContentTokenCount:O.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:O.completion_tokens_details?.reasoning_tokens||O.reasoning_tokens||0},w=!0),D){let ae=D.reasoning_content||D.reasoning||null;!ae&&Array.isArray(D.reasoning_details)&&D.reasoning_details.length>0&&(ae=D.reasoning_details.map(de=>de.text||"").filter(Boolean).join("")),ae&&(S.push({text:ae,thought:!0}),w=!0),D.content&&(S.push({text:D.content}),w=!0)}}catch{}if((M||Date.now()-$>=150)&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1),M)break}Date.now()-$>=150&&w&&(yield{candidates:S.length>0?[{content:{parts:[...S]}}]:[],usageMetadata:R},S=[],$=Date.now(),w=!1)}};var Pa=/```[\s\S]*?```/g,$a=/```[\s\S]*$/g,Na=/`[^`]+`/g,Fa=/^\|.*\|$/gm,Ba=/^[^\w]+|[^\w]+$/g,Ua=/[^a-z0-9]/gi,bo=/\[\s*tool:(?:functions\.)?([a-z0-9_]+)\s*\(/gi,Wa=/\[\s*(?:tool:(?:functions\.)?|agent:generalist\.)([a-z0-9_]+)\s*\(/gi,Ha=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,Gn=/["']/g,Wr=/\\/g,Ga=/<\|channel>thought/gi,ja=/<channel\|>/gi,Ka=e=>typeof e!="string"?e:e.replace(Ga,"<think>").replace(ja,"</think>"),df=/^\s*(?:<(think|thought|thoughts)[^>]*>|<\|channel>thought|\[(think|thought|thoughts)\])[\s\S]*?(?:<\/(think|thought|thoughts)>|<channel\|>|\[\/(think|thought|thoughts)\]|$)/i,Va=(e,t,n=1)=>{let s=t>0?e[t-1]:"",o=t+n<e.length?e[t+n]:"";return s==="`"&&o==="`"},Ya=e=>{let t=/(?:<\/(think|thought|thoughts)>|<channel\|>|\[\/(think|thought|thoughts)\])/gi,n;for(;(n=t.exec(e))!==null;)if(!Va(e,n.index,n[0].length))return{index:n.index,length:n[0].length};return{index:-1,length:0}},ti=e=>{if(!e||typeof e!="string")return null;let t=e.match(/^\s*(?:<(think|thought|thoughts)[^>]*>|<\|channel>thought|\[(think|thought|thoughts)\])/i);if(!t)return null;let n=t.index+t[0].length,s=e.substring(n),o=Ya(s);if(o.index!==-1){let c=n+o.index+o.length;return{fullBlock:e.substring(0,c),innerContent:s.substring(0,o.index),remainingText:e.substring(c)}}return{fullBlock:e,innerContent:s,remainingText:""}},qt=e=>{if(!e||typeof e!="string")return e;let t=ti(e);return t?t.remainingText.trimStart():e};var qr=/`[^`]*`/g,zr=/`[^`]*$/,Hr=/<\|\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,qa=/"([^"]+)"\s*:\s*(?:"([^"]*)"|(\d+)|true|false|null)/g,Gr=/<\|\s*tool_calls_section_begin\s*\|>/gi,jr=/<\|\s*tool_calls_section_end\s*\|>/gi,za=/```(?:tool|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi;var Kr=e=>!e||typeof e!="string"?e:e.replace(/(```[\s\S]*?```|`[^`]*`)|(<(?:\w+)(?:[^>]*)>\r?\n?|\r?\n?<\/\w+(?:[^>]*)>)/gi,(t,n)=>n||""),Jr=e=>{if(!e||typeof e!="string")return e;let t=ko(e);if(!t||t.length===0)return e;let n=t[t.length-1];if(!n.fullMatch)return e;let s=e.lastIndexOf(n.fullMatch);if(s===-1)return e;let o=s+n.fullMatch.length;return e.substring(0,o).trimEnd()},oi=null,rs={},jn={key:null,value:null},Yt=e=>e&&e.replace(/(?:(\x1b\[\d+m))?([✔✘✖🔍📖→➕↻↷•🛇])(?:(\x1b\[\d+m))?\s*\b(Clicked|Dragged|Scrolled|Typed|Pressed Key|Recaptured Screen|Created|Read Skill|Read Documentation|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|Execution Error|Loop Detected|Contacting Ancestors)\b/ig,(t,n,s,o,c)=>`${n||""}${s}${o||""} \x1B[95m${c}\x1B[0m`),Ja=async(e,t=8,n=1e3,s=8e3,o=null)=>{let c=0;for(;;){if(o?.aborted)throw new DOMException("The user aborted a request.","AbortError");try{return await e()}catch(u){if(o?.aborted||u?.name==="AbortError"||u?.message==="Subagent task was cancelled."||(c++,c>=t))throw u;let a=Math.min(n*Math.pow(2,c-1),s);await new Promise((y,p)=>{let g=setTimeout(y,a);o&&o.addEventListener("abort",()=>{clearTimeout(g),p(new DOMException("The user aborted a request.","AbortError"))})})}}},bt=!1;var Xa=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,c,u)=>{let a=o.fullText||o.text||"";if(o.role==="user"&&c<u.length-1)if(a.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")){let y=a.indexOf("**CONTEXT SUMMARY OF PREVIOUS TURNS");if(y!==-1){let g=a.substring(0,y).lastIndexOf("[SYSTEM METADATA]");g!==-1?a=a.substring(g).trim():a=a.substring(y).trim()}}else{let y=a.lastIndexOf("[USER]"),p=a.lastIndexOf("[USER PROMPT]");y!==-1?a=a.substring(y+6).trim():p!==-1&&(a=a.substring(p).trim())}return{...o,text:a}}),n=[],s=0;for(;s<t.length;){let o=t[s];if(o.role==="user")n.push(o),s++;else{let c=[];for(;s<t.length&&t[s].role!=="user";)c.push(t[s]),s++;let u=[],a=[],y=!1,p=()=>{u.length>0&&(n.push({role:"agent",text:"combined"}),u=[]),a.length>0&&(n.push({role:"system",text:"combined"}),a=[]),y=!1};c.forEach(g=>{let b=g.role==="system"&&(g.text?.startsWith("[TOOL RESULT]")||g.text?.startsWith("SUCCESS:")||g.text?.startsWith("ERROR:")||g.fullText?.startsWith("[TOOL RESULT]")||g.fullText?.startsWith("SUCCESS:")||g.fullText?.startsWith("ERROR:")),h=g.fullText||g.text||"",i=h.trim();if(!(!i&&!g.binaryPart)){if(b)a.push(i);else if(g.role==="agent"){!y&&a.length>0&&p();let l=h.endsWith(`
|
|
611
|
+
`),k=i.toLowerCase().includes("tool:functions.")||i.toLowerCase().includes("agent:generalist.");u.push(i),k&&l?y=!0:y=!1}}}),p()}}return n.length},Qa=e=>typeof e!="string"?e:e.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),ff=()=>{bt=!0},uf=()=>bt,ni={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",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",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=re(t),s=e.toLowerCase().replace(/_/g,"");if(s==="invokesync"||s==="invoke")return n.title||(n.task?n.task.substring(0,30):null);if(s==="getprogress"||s==="cancel"||s==="steer"||s==="steersubagent")return n.id||n.taskId;let o=n.path||n.targetFile||n.TargetFile||n.directory;return o?te.basename(o.replace(/["']/g,"").replace(/\\/g,"/")):null}catch{return null}},si=e=>e?new Yr({apiKey:e}):oi,gf=async(e,t,n,s,o={})=>{let{onStatus:a,onMemoryUpdated:y,onBackgroundIncrement:p}=o,{profile:g,thinkingLevel:b,mode:h,janitorModel:i,chatId:l,systemSettings:k,sessionStats:v,aiProvider:m="Google",apiKey:_}=e,P=process.env.NVIDIA_BASE_URL||m==="Ollama"||m==="InferX"||m==="SenseNova"||m==="AIHubMix"||m==="Poolside"||m==="9router"||m==="ExpLabs"||m==="ExperientialLabs"?!1:k?.memory!==!1,S=Et(Wn,[]).map(L=>`- [${L.id}]: ${L.memory}`).join(`
|
|
611
612
|
`),R=s.slice(0,-1).filter(L=>L.text&&!L.text.includes("[TOOL RESULT]")&&!L.text.includes("OBSERVATION:")&&!L.text.startsWith("[TERMINAL_RECORD]")&&!L.isTerminalRecord&&!L.isMeta&&!L.isLogo&&!String(L.id).startsWith("welcome")&&!String(L.id).startsWith("logo")).slice(-14).map(L=>{let B=qt(Qa(L.text)).replace(/\[tool:(?:functions\.)?.*?\]/g,"").replace(/\[Prompted on:.*?\]/g,"").replace(/\[METADATA \(PRIORITY: DYNAMIC\)\] Time: ([^|\n]+)/g,(G,ke)=>`[METADATA (PRIORITY: DYNAMIC)] Time: ${ke.replace(/:\d{2}/g,"")}`).replace(/\[\[\s*turn\s*:\s*(continue|finish)\s*\]\]/gi,"").replace(/\[\[END\]\]/g,"").replace(/\[TOOL RESULTS\]/g,"").replace(/\[tool results\]/g,"").replace(/\r?\n\r?\n/g,`
|
|
612
613
|
`).replace(/\n\n/g,`
|
|
613
614
|
`).replace(/\\n\\n/g,"").trim(),Me=L.role==="user"?8192:32768,Z=B.substring(0,Me);B.length>Me&&(Z+=`
|
|
@@ -624,7 +625,7 @@ ${M.length>8192?`... (truncated) ...
|
|
|
624
625
|
|
|
625
626
|
`),ne>it)break;let U=Math.min(750*Math.pow(2,ne-1),5e3);await new Promise(G=>setTimeout(G,U))}if(ne){let L=te.join(Mn,"janitor");He.appendFileSync(te.join(L,"error.log"),`-----------------------------------------------------------------------------
|
|
626
627
|
|
|
627
|
-
`)}if(process.stdout.isTTY)try{let Me=(await Es())[l]?.name||"",Z=Me&&!Me.startsWith("flow-")&&!Me.startsWith("Session ")?Me:"FluxFlow | Idle";process.stdout.write(`\x1B]0;${Z}\x07`),process.stdout.write(`\x1B]633;P;TerminalTitle=${Z}\x07`)}catch{process.stdout.write("\x1B]0;FluxFlow | Idle\x07"),process.stdout.write("\x1B]633;P;TerminalTitle=FluxFlow | Idle\x07")}},Za=e=>{let t=qt(e),n=As?t:t.replace(qr,o=>" ".repeat(o.length)).replace(zr,o=>" ".repeat(o.length));bo.lastIndex=0;let s;for(;(s=bo.exec(n))!==null;){let o=s.index+s[0].length-1,c=0,u=null,a=!1,y=!1;for(let p=o;p<n.length;p++){let g=t[p];if(!u&&(g==='"'||g==="'"||g==="`")?(u=g,a=!1):u&&g===u&&!a&&(u=null),!u&&(g==="("?c++:g===")"&&c--,c===0)){let b=p+1;for(;b<n.length&&/\s/.test(n[b]);)b++;if(b<n.length&&n[b]==="]"){y=!0,bo.lastIndex=b+1;break}}g==="\\"?a=!a:a=!1}if(!y)return{inside:!0,toolName:s[1],startIndex:s.index,args:t.substring(s.index+s[0].length)}}return{inside:!1}},Xr=(e,t=!0)=>{let n=bo;n.lastIndex=0;let s="",o=0,c;for(;(c=n.exec(e))!==null;){let u=e.substring(o,c.index);s+=t&&o===0?qt(u):u;let a=c.index+c[0].length-1,y=0,p=null,g=-1;for(let b=a;b<e.length;b++){let h=e[b];if(p){if(h===p){let i=0;for(let l=b-1;l>=0&&e[l]==="\\";l--)i++;i%2===0&&(p=null)}}else if(h==='"'||h==="'"||h==="`")p=h;else if(h==="(")y++;else if(h===")"&&(y--,y===0)){let i=b+1;for(;i<e.length&&/\s/.test(e[i]);)i++;if(i<e.length&&e[i]==="]"){g=i;break}}}if(g!==-1)s+="[tool:functions."+c[1]+"()]",o=g+1,n.lastIndex=o;else{s+="[tool:functions."+c[1]+"(",o=e.length;break}}return o<e.length&&(s+=t&&o===0?qt(e.substring(o)):e.substring(o)),s},el=(e,t,n)=>{let s=bo;s.lastIndex=0;let o="",c=0,u;for(;(u=s.exec(e))!==null;){let a=e.substring(c,u.index);o+=a.replace(t,n);let y=u.index+u[0].length-1,p=0,g=null,b=-1;for(let h=y;h<e.length;h++){let i=e[h];if(g){if(i===g){let l=0;for(let k=h-1;k>=0&&e[k]==="\\";k--)l++;l%2===0&&(g=null)}}else if(i==='"'||i==="'"||i==="`")g=i;else if(i==="(")p++;else if(i===")"&&(p--,p===0)){let l=h+1;for(;l<e.length&&/\s/.test(e[l]);)l++;if(l<e.length&&e[l]==="]"){b=l;break}}}if(b!==-1)o+=e.substring(u.index,b+1),c=b+1,s.lastIndex=c;else{o+=e.substring(u.index),c=e.length;break}}return c<e.length&&(o+=e.substring(c).replace(t,n)),o},
|
|
628
|
+
`)}if(process.stdout.isTTY)try{let Me=(await Es())[l]?.name||"",Z=Me&&!Me.startsWith("flow-")&&!Me.startsWith("Session ")?Me:"FluxFlow | Idle";process.stdout.write(`\x1B]0;${Z}\x07`),process.stdout.write(`\x1B]633;P;TerminalTitle=${Z}\x07`)}catch{process.stdout.write("\x1B]0;FluxFlow | Idle\x07"),process.stdout.write("\x1B]633;P;TerminalTitle=FluxFlow | Idle\x07")}},Za=e=>{let t=qt(e),n=As?t:t.replace(qr,o=>" ".repeat(o.length)).replace(zr,o=>" ".repeat(o.length));bo.lastIndex=0;let s;for(;(s=bo.exec(n))!==null;){let o=s.index+s[0].length-1,c=0,u=null,a=!1,y=!1;for(let p=o;p<n.length;p++){let g=t[p];if(!u&&(g==='"'||g==="'"||g==="`")?(u=g,a=!1):u&&g===u&&!a&&(u=null),!u&&(g==="("?c++:g===")"&&c--,c===0)){let b=p+1;for(;b<n.length&&/\s/.test(n[b]);)b++;if(b<n.length&&n[b]==="]"){y=!0,bo.lastIndex=b+1;break}}g==="\\"?a=!a:a=!1}if(!y)return{inside:!0,toolName:s[1],startIndex:s.index,args:t.substring(s.index+s[0].length)}}return{inside:!1}},Xr=(e,t=!0)=>{let n=bo;n.lastIndex=0;let s="",o=0,c;for(;(c=n.exec(e))!==null;){let u=e.substring(o,c.index);s+=t&&o===0?qt(u):u;let a=c.index+c[0].length-1,y=0,p=null,g=-1;for(let b=a;b<e.length;b++){let h=e[b];if(p){if(h===p){let i=0;for(let l=b-1;l>=0&&e[l]==="\\";l--)i++;i%2===0&&(p=null)}}else if(h==='"'||h==="'"||h==="`")p=h;else if(h==="(")y++;else if(h===")"&&(y--,y===0)){let i=b+1;for(;i<e.length&&/\s/.test(e[i]);)i++;if(i<e.length&&e[i]==="]"){g=i;break}}}if(g!==-1)s+="[tool:functions."+c[1]+"()]",o=g+1,n.lastIndex=o;else{s+="[tool:functions."+c[1]+"(",o=e.length;break}}return o<e.length&&(s+=t&&o===0?qt(e.substring(o)):e.substring(o)),s},el=(e,t,n)=>{let s=bo;s.lastIndex=0;let o="",c=0,u;for(;(u=s.exec(e))!==null;){let a=e.substring(c,u.index);o+=a.replace(t,n);let y=u.index+u[0].length-1,p=0,g=null,b=-1;for(let h=y;h<e.length;h++){let i=e[h];if(g){if(i===g){let l=0;for(let k=h-1;k>=0&&e[k]==="\\";k--)l++;l%2===0&&(g=null)}}else if(i==='"'||i==="'"||i==="`")g=i;else if(i==="(")p++;else if(i===")"&&(p--,p===0)){let l=h+1;for(;l<e.length&&/\s/.test(e[l]);)l++;if(l<e.length&&e[l]==="]"){b=l;break}}}if(b!==-1)o+=e.substring(u.index,b+1),c=b+1,s.lastIndex=c;else{o+=e.substring(u.index),c=e.length;break}}return c<e.length&&(o+=e.substring(c).replace(t,n)),o},Vr=e=>Xr(e,!0),tl=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(c=>c.charAt(0).toUpperCase()+c.slice(1)).join("");Hr.lastIndex=0;let s=e.replace(Hr,(o,c,u)=>{let a="";try{let g=JSON.parse(u.trim());g&&typeof g=="object"&&(a=Object.entries(g).map(([h,i])=>{let l=typeof i=="string"?i:JSON.stringify(i);return`${h}=${JSON.stringify(l)}`}).join(", "))}catch{let b=[],h=qa;h.lastIndex=0;let i;for(;(i=h.exec(u))!==null;){let l=i[1],k=i[2]!==void 0?i[2]:i[0].split(":").slice(1).join(":").trim();b.push(`${l}=${JSON.stringify(k)}`)}b.length>0?a=b.join(", "):a=u.trim()}let y=c.toLowerCase().replace(/_/g,"");return`[tool:functions.${t[y]||n(c)}(${a})]`});return Gr.lastIndex=0,jr.lastIndex=0,s=s.replace(Gr,""),s=s.replace(jr,""),s},nl=/(?:path|query|url|keyword|command|method|title|task|id)\s*=\s*['"`]?\s*\.\.\.\s*['"`]?/i,ol=/^['"`]?\s*\.\.\.\s*['"`]?$/,kn=e=>{if(e==null)return!1;let t=String(e).trim();return t==="..."||t==="\u2026"||ol.test(t)},ko=e=>{if(!e)return[];let t=tl(e),n=qt(t),s=[],o=As?n:n.replace(qr,a=>" ".repeat(a.length)).replace(zr,a=>" ".repeat(a.length)),c=Wa;c.lastIndex=0;let u;for(;(u=c.exec(o))!==null;){let a=u[1],y=u.index+u[0].length-1,p=0,g=null,b=-1,h=-1;for(let i=y;i<o.length;i++){let l=n[i];if(g){if(l===g){let k=0;for(let v=i-1;v>=0&&n[v]==="\\";v--)k++;k%2===0&&(g=null)}}else if(l==='"'||l==="'"||l==="`")g=l;else if(l==="(")p++;else if(l===")"&&(p--,p===0)){h=i;let k=i+1;for(;k<o.length&&/\s/.test(o[k]);)k++;if(k<o.length&&o[k]==="]"){b=k;break}}}if(b!==-1){let i=n.substring(y+1,h),l=n.substring(u.index,b+1),k=re(i);kn(k.path)||kn(k.query)||kn(k.url)||kn(k.keyword)||kn(k.command)||kn(k.method)||kn(k.title)||kn(k.task)||kn(k.id)||nl.test(i)||s.push({fullMatch:l,toolName:a.trim(),args:i.trim()}),c.lastIndex=b+1}}return s},hf=(e,t={})=>{if(!e)return null;if(rs=t,oi=new Yr({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(...s)=>{try{let o=await n(...s);return typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}catch(o){throw typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}}}},as=async(e,t,n,s,o="Fast",c=.75,u="agent")=>Ja(async()=>{let{aiProvider:a="Google",apiKey:y,mode:p}=e,g="",b=null,h=typeof n=="string"?[{role:"user",parts:[{text:n}]}]:n,i=new AbortController,l=i.signal,k=setInterval(()=>{bt&&(i.abort(),clearInterval(k))},100);try{let v;a==="Ollama"?v=Qs(y,t,h,s,o,p,ft(t),l,c,e.systemSettings?.ollamaEndpoint||"Cloud"):a==="OpenRouter"?v=Zo(y,t,h,s,o,p,ft(t),l,c):a==="DeepSeek"?v=Jo(y,t,h,s,o,p,ft(t),l,c):a==="Mistral"?v=Xo(y,t,h,s,o,p,ft(t),l,c):a==="NVIDIA"?v=Qo(y,t,h,s,o,p,ft(t),l,c):a==="InferX"?v=es(y,t,h,s,o,p,ft(t),l,c):a==="SenseNova"?v=ts(y,t,h,s,o,p,ft(t),l,c):a==="AIHubMix"?v=ns(y,t,h,s,o,p,ft(t),l,c):a==="Poolside"?v=os(y,t,h,s,o,p,ft(t),l,c):a==="9router"||a==="9Router"?v=ss(y,t,h,s,o,p,ft(t),l,c):a==="ExpLabs"||a==="ExperientialLabs"?v=is(y,t,h,s,o,p,ft(t),l,c):a==="TokenHarbor"||a==="Token Harbor"||a==="tokenharbor"||a==="token_harbor"||a==="thk"?v=Zs(y,t,h,s,o,p,ft(t),l,c):a==="APInex"||a==="apinex"||a==="apx"?v=ei(y,t,h,s,o,p,ft(t),l,c):v=await si(y).models.generateContentStream({model:t,contents:h,config:{systemInstruction:s,temperature:c,thinkingConfig:(()=>{let P=(t||"").toLowerCase(),E=P.includes("gemma-4")||P.startsWith("gemma"),S=P.includes("gemini-3");if(E||S)return E?o.toLowerCase()!=="xhigh"?{includeThoughts:!1,thinkingLevel:Xe.MINIMAL}:{includeThoughts:!0,thinkingLevel:Xe.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:P.includes("pro")?Xe.LOW:Xe.MINIMAL,Low:Xe.LOW,Medium:Xe.MEDIUM,Standard:Xe.MEDIUM,High:Xe.HIGH,xHigh:Xe.HIGH}[o]||Xe.MEDIUM};{let R={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[o]||2048;return R===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:R}}})()}},{signal:l});for await(let m of v){if(bt)throw new Error("Subagent task was cancelled.");if(e?.taskId&&typeof Vt<"u"){let E=Vt.find(S=>S.id===e.taskId);if(E&&E.status==="cancelled")throw new Error("Subagent task was cancelled.")}let _="";if(m.candidates?.[0]?.content?.parts)for(let E of m.candidates[0].content.parts)E.text&&!E.thought&&(g+=E.text,_+=E.text);let P=_?_s(_):0;e&&typeof e.onTokenChunk=="function"&&e.onTokenChunk(_,P),m.usageMetadata&&(b=m.usageMetadata)}}finally{clearInterval(k)}if(b){let v=b.totalTokenCount||0,m=b.cachedContentTokenCount||0,_=(b.candidatesTokenCount||0)+(a==="Google"&&b.thoughtsTokenCount||0);await Ut("tokens",v,a,t),m>0&&await Ut("cachedTokens",m,a,t),_>0&&await Ut("candidateTokens",_,a,t),Do({provider:a,model:t,prompt:b.promptTokenCount||0,cached:m,output:_,reasoning:b.thoughtsTokenCount||0}),e&&typeof e.onUsage=="function"&&e.onUsage({totalTokenCount:v,cachedContentTokenCount:m,candidatesTokenCount:_})}return await Ct("agent",a),{text:g,usageMetadata:b}}),sl=async(e,t,n=null)=>{n=n||Et(vo,{});try{let{aiProvider:s="Google"}=t;if(Object.values(n).flat().length<=5)return;let c=Object.keys(n).filter(h=>h!==e&&Array.isArray(n[h])&&n[h].length>2);if(c.length===0)return;let u=`You are a silent background process for the FluxFlow CLI Agent.
|
|
628
629
|
Your task is to summarize or merge temporary context memories from one or more past conversation sessions.
|
|
629
630
|
For each Chat ID provided, you must output a tool call to save the consolidated summary.
|
|
630
631
|
|
|
@@ -722,9 +723,9 @@ Time: ${gi?Oe:Re}${b?.dynamicDirAwareness?ai:""}${Zn?`
|
|
|
722
723
|
WARNING: CWD Changed from previous: "${vt}" to current: "${process.cwd()}", write change in chat to avoid future path mismatches
|
|
723
724
|
`:""}${Me}${un}
|
|
724
725
|
[/Metadata]
|
|
725
|
-
${ls}${ui}${us}${fi}[user prompt] ${di.trim()} [/user prompt]`.trim();let hi={role:"user",text:So};To&&(hi.binaryPart=To),r.forEach(H=>{H.text&&H.role==="agent"&&(H.text=qt(H.text))}),r.push(hi),ls&&t[t.length-1]?.id&&(yield{type:"summary_injected",content:{id:t[t.length-1].id,text:So}});let en=null,Sn=a==="Flux"?50:15;Sn=a.toLowerCase().includes("cu")?75:Sn;let na=Math.floor(Sn/2),mi=0,rn=16;yield{type:"status",content:"Connecting"},bt=!1;let gs=[],_o=!1,pi=!1;for(let H=0;H<=Sn;H++){let Pe=Math.floor(Sn*.95);if(H>=Pe&&mi<Pe&&typeof n?.onAskUser=="function"){mi=Pe;try{let me="Agent has been running for a long time. Do you want to continue execution?",_e=[{id:"continue",label:"Continue",description:"Add few more steps"},{id:"cancel",label:"Cancel",description:"Stop extending and finish current turn limit"}],ee=await n.onAskUser(me,_e);ee&&(ee.toLowerCase().includes("continue")||ee==="Continue")&&(Sn+=na)}catch{}}let Jt=await Ss("agent",n);if(!Jt.allowed)throw new Error(Jt.reason||`Budget Exhausted for Provider (${i||"Agent"})`);let Qe=[];if(_o=!1,a==="ICU"||a==="FluxCU")try{yield{type:"status",content:"Capturing Screen"},await new Promise(ee=>setTimeout(ee,1e3));let{captureGriddedScreenshot:me}=await import("./screen_grid-YL4W6LEM.js"),_e=await me();if(_e&&_e.base64){let ee="[system] Fresh Gridded Screen Feedback Captured. Use numeric coordinates. Old screenshots will be removed when new screenshot is captured, summarize in text if context is needed later [/system]",Pt={inlineData:{mimeType:_e.mimeType,data:_e.base64}},It=b?.imageHistoryCU||"Standard",_t=It==="Low"?1:It==="Extended"?5:3,Xt=r.filter(
|
|
726
|
+
${ls}${ui}${us}${fi}[user prompt] ${di.trim()} [/user prompt]`.trim();let hi={role:"user",text:So};To&&(hi.binaryPart=To),r.forEach(H=>{H.text&&H.role==="agent"&&(H.text=qt(H.text))}),r.push(hi),ls&&t[t.length-1]?.id&&(yield{type:"summary_injected",content:{id:t[t.length-1].id,text:So}});let en=null,Sn=a==="Flux"?50:15;Sn=a.toLowerCase().includes("cu")?75:Sn;let na=Math.floor(Sn/2),mi=0,rn=16;yield{type:"status",content:"Connecting"},bt=!1;let gs=[],_o=!1,pi=!1;for(let H=0;H<=Sn;H++){let Pe=Math.floor(Sn*.95);if(H>=Pe&&mi<Pe&&typeof n?.onAskUser=="function"){mi=Pe;try{let me="Agent has been running for a long time. Do you want to continue execution?",_e=[{id:"continue",label:"Continue",description:"Add few more steps"},{id:"cancel",label:"Cancel",description:"Stop extending and finish current turn limit"}],ee=await n.onAskUser(me,_e);ee&&(ee.toLowerCase().includes("continue")||ee==="Continue")&&(Sn+=na)}catch{}}let Jt=await Ss("agent",n);if(!Jt.allowed)throw new Error(Jt.reason||`Budget Exhausted for Provider (${i||"Agent"})`);let Qe=[];if(_o=!1,a==="ICU"||a==="FluxCU")try{yield{type:"status",content:"Capturing Screen"},await new Promise(ee=>setTimeout(ee,1e3));let{captureGriddedScreenshot:me}=await import("./screen_grid-YL4W6LEM.js"),_e=await me();if(_e&&_e.base64){let ee="[system] Fresh Gridded Screen Feedback Captured. Use numeric coordinates. Old screenshots will be removed when new screenshot is captured, summarize in text if context is needed later [/system]",Pt={inlineData:{mimeType:_e.mimeType,data:_e.base64}},It=b?.imageHistoryCU||"Standard",_t=It==="Low"?1:It==="Extended"?5:3,Xt=r.filter(Ve=>Array.isArray(Ve.parts)&&Ve.parts.some($t=>$t.inlineData));if(Xt.length>=_t){let Ve=Xt.length-_t+1;for(let $t=0;$t<Ve;$t++){let At=Xt[$t];Array.isArray(At.parts)&&(At.parts=At.parts.filter(wt=>!wt.inlineData))}}if(r.length>0&&r[r.length-1].role==="user"){let Ve=r[r.length-1];typeof Ve.text=="string"&&(Ve.text+=`
|
|
726
727
|
|
|
727
|
-
${ee}`,Array.isArray(
|
|
728
|
+
${ee}`,Array.isArray(Ve.parts)||(Ve.parts=[{text:Ve.text}]),Ve.parts.push(Pt))}else r.push({role:"user",text:ee,parts:[{text:ee},Pt]})}}catch(me){console.error("Vision screenshot capture error:",me)}if(b?.compression===0&&(h?.tokens||0)>O&&(r=Ci(r,6)),H>0?yield{type:"status",content:"Working"}:yield{type:"status",content:"Connecting"},bt){try{let{clearPendingNudges:me}=await import("./subagent_state-LZCOZSUJ.js");me()}catch{}yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
|
|
728
729
|
|
|
729
730
|
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}try{let{consumePendingNudges:me}=await import("./subagent_state-LZCOZSUJ.js"),_e=me();if(_e&&_e.length>0){let ee=_e.join(`
|
|
730
731
|
|
|
@@ -736,81 +737,81 @@ ${ee}`:r.push({role:"user",text:ee}),yield{type:"status",content:"Subagent Updat
|
|
|
736
737
|
[question] ${me.replace("/btw","").trim()} [/question]`:r.push({role:"user",text:`[system] User question. Resolve this specific query within '[ANSWER]...[/ANSWER]' concisely, naturally [/system]
|
|
737
738
|
[question] ${me.replace("/btw","").trim()} [/question]`}):r.length>0&&r[r.length-1].role==="user"?r[r.length-1].text+=`
|
|
738
739
|
|
|
739
|
-
[STEERING HINT from USER, High Priority] ${me.trim()} [/STEERING HINT]`:r.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${me.trim()} [/STEERING HINT]`}),yield{type:"status",content:`${me.startsWith("/btw")?"Question Forwarded...":"Steering Hint Injected..."}`})}let Ie,st=!1,tt=1,rt=1,we="",Ye=null,an=null,j=null,Ge=0,ve=[],ut=0,_n=!1,Mt=!1,ln=!1,An=!1,eo=!0,tn=0,yt="",Ze="",Ot=!1,Lt=!1,qe=!0,Te=e,ze="";for(;tt<=rn&&rt<=rn&&!st&&!bt;){let me=!1;try{we="",eo&&(process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07"),yield{type:"turn_reset",content:!0},eo=!1,rt===1&&(yt=""));let _e=I=>{if(!I||!I.includes("[tool:"))return I;let Y="",N=ti(I);N&&(Y=N.fullBlock,I=N.remainingText),I=I.replace(za,(ce,se)=>se.includes("[tool:")?se.trim():ce);let
|
|
740
|
+
[STEERING HINT from USER, High Priority] ${me.trim()} [/STEERING HINT]`:r.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${me.trim()} [/STEERING HINT]`}),yield{type:"status",content:`${me.startsWith("/btw")?"Question Forwarded...":"Steering Hint Injected..."}`})}let Ie,st=!1,tt=1,rt=1,we="",Ye=null,an=null,j=null,Ge=0,ve=[],ut=0,_n=!1,Mt=!1,ln=!1,An=!1,eo=!0,tn=0,yt="",Ze="",Ot=!1,Lt=!1,qe=!0,Te=e,ze="";for(;tt<=rn&&rt<=rn&&!st&&!bt;){let me=!1;try{we="",eo&&(process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07"),yield{type:"turn_reset",content:!0},eo=!1,rt===1&&(yt=""));let _e=I=>{if(!I||!I.includes("[tool:"))return I;let Y="",N=ti(I);N&&(Y=N.fullBlock,I=N.remainingText),I=I.replace(za,(ce,se)=>se.includes("[tool:")?se.trim():ce);let V="",J=0;for(;J<I.length;){let ce=I.indexOf("[tool:",J);if(ce===-1){V+=Kr(I.substring(J));break}let se=I.substring(J,ce);V+=Kr(se);let ht=-1,F=null,Q=0;for(let Ee=ce;Ee<I.length;Ee++){let x=I[Ee];if(F){if(x===F){let We=0;for(let ye=Ee-1;ye>=0&&I[ye]==="\\";ye--)We++;We%2===0&&(F=null)}}else if(x==='"'||x==="'"||x==="`")F=x;else if(x==="(")Q++;else if(x===")")Q--;else if(x==="]"&&Q<=0){ht=Ee;break}}if(ht===-1){V+=I.substring(ce);break}V+=I.substring(ce,ht+1),J=ht+1}return(b?.keepReasoningContext?Y:"")+V},ee=r.filter(I=>(I.role==="user"||I.role==="agent"||I.role==="system")&&!String(I.id).startsWith("welcome")&&!I.isMeta&&!I.isTerminalRecord&&!(I.text&&I.text.startsWith("[TERMINAL_RECORD]"))).map((I,Y,N)=>{let V=I.text||"";_||(V=V.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),I.role==="agent"&&(V=_e(V),V=V.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),V=V.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*"));let J=[];return Array.isArray(I.parts)&&I.parts.length>0?J=I.parts.map(ce=>{if(ce.text){let se=ce.text;return _||(se=se.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),I.role==="agent"&&(se=_e(se),se=se.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),se=se.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*")),{text:se}}return ce}):J=[{text:V}],I.binaryPart&&ft(Te)&&N.slice(Y+1).filter(se=>se.role==="user"&&!se.text?.startsWith("[TOOL RESULT]")).length<=2&&J.push(I.binaryPart),{role:I.role==="user"||I.role==="system"?"user":"model",parts:J}});for(let I=0;I<ee.length;I++){let Y=ee[I],N=Y.parts?.[0]?.text||"";if(Y.role==="model"&&/\[tool:/i.test(N)){let V=-1;for(let J=I+1;J<ee.length;J++){let ce=ee[J],se=ce.parts?.[0]?.text||"";if(ce.role==="user"&&se.startsWith("[TOOL RESULT]")){V=J;break}}if(V!==-1&&V!==I+1){let[J]=ee.splice(V,1);ee.splice(I+1,0,J)}}}for(let I=ee.length-2;I>=0;I--){let Y=ee[I],N=ee[I+1];Y.role==="user"&&N.role==="user"&&(N.parts?.[0]?.text||"").trim().startsWith("[SYSTEM")&&ee.splice(I,1)}let Pt=[];for(let I=0;I<ee.length;I++){let Y=ee[I];if(Pt.length===0)Pt.push(Y);else{let N=Pt[Pt.length-1];N.role===Y.role?(N.parts[0].text+=`
|
|
740
741
|
|
|
741
742
|
`+(Y.parts?.[0]?.text||""),Y.parts?.length>1&&N.parts.push(...Y.parts.slice(1))):Pt.push(Y)}}ee.length=0,ee.push(...Pt),Te=e;let It=`${p}|${i}|${a}|${u}|${Te}|${JSON.stringify(c)}|${!!b?.dynamicDirAwareness}|${!!b?.subAgents}`,_t=jn.key===It&&jn.value;if((process.env.I_HAVE_TOO_MUCH_MONEY==="true"||process.env.I_HAVE_TOO_MUCH_MONEY===!0)&&(_t=!1),_t)ze=jn.value;else{let I=i==="Mistral"?!!Io(Te):!(Te||"gemma").toLowerCase().startsWith("gemma");ze=ur(c,((Te||"gemma").toLowerCase().startsWith("gemma"),u),a,b,_,R,i,i==="Google"?!0:m,I,p,!!b?.keepReasoningContext,Te),b?.dynamicDirAwareness||(ze+=`
|
|
742
743
|
${ai.replace(`
|
|
743
744
|
**Directory Structure**`,`
|
|
744
|
-
-- Directory Structure --`)}`),jn.key=It,jn.value=ze}let
|
|
745
|
-
${Y} [/ERROR]`),yield{type:"status",content:"Working"}}let $t=i==="Mistral"||i==="Google"&&e?.toLowerCase().startsWith("gemma");if(b?.advanceRollback&&
|
|
745
|
+
-- Directory Structure --`)}`),jn.key=It,jn.value=ze}let Ve=ee[ee.length-1];if(qo()&H>0){await new Promise(N=>setTimeout(N,2500)),yield{type:"status",content:"Verifying"};let I=await Hn(),Y=I?I.diagnostics:null;Y&&Ve&&Ve.role==="user"&&Ve.parts?.[0]?.text&&(Ve.parts[0].text+=`
|
|
746
|
+
${Y} [/ERROR]`),yield{type:"status",content:"Working"}}let $t=i==="Mistral"||i==="Google"&&e?.toLowerCase().startsWith("gemma");if(b?.advanceRollback&&Ve&&Ve.role==="user"&&Ve.parts?.[0]?.text?.startsWith("[TOOL RESULT]"))try{let I=await ao.getLatestFileChanges(p);if(I&&(I.newFiles.length>0||I.modifiedFiles.length>0||I.deletedFiles.length>0)){let Y=`
|
|
746
747
|
[system] File Changes:
|
|
747
|
-
`;for(let
|
|
748
|
-
`;for(let
|
|
749
|
-
`;for(let
|
|
750
|
-
`;Y+="[/system]",
|
|
751
|
-
[system] WARNING, Turn Limit Impending: Step ${wt}/${Sn}. Wrap up quickly/prompt user to continue. [/system]`);let Dt=new Promise((I,Y)=>{f.signal.aborted&&Y(new DOMException("The user aborted a request.","AbortError")),f.signal.addEventListener("abort",()=>{Y(new DOMException("The user aborted a request.","AbortError"))})});Dt.catch(()=>{});let gt=ee;if(i==="Ollama")Ie=Qs(n.apiKey,Te,gt,ze,u,a,m,f.signal,1,b?.ollamaEndpoint||"Cloud");else if(i==="OpenRouter")Ie=Zo(n.apiKey,Te,gt,ze,u,a,m,f.signal,1,p);else if(i==="DeepSeek")Ie=Jo(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="Mistral")Ie=Xo(n.apiKey,Te,gt,ze,u,a,m,f.signal,1,p);else if(i==="NVIDIA"){let I=Qo(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);Ie=Ur(I,Te)}else if(i==="InferX")Ie=es(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="SenseNova")Ie=ts(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="AIHubMix")Ie=ns(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="Poolside")Ie=os(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="9router"||i==="9Router")Ie=ss(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="ExpLabs"||i==="ExperientialLabs")Ie=is(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="TokenHarbor"||i==="Token Harbor"||i==="tokenharbor"||i==="token_harbor"||i==="thk")Ie=Zs(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="APInex"||i==="apinex"||i==="apx")Ie=ei(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else{let Y=si(n?.apiKey).models.generateContentStream({model:Te||"gemini-3-flash-preview",contents:gt,config:{systemInstruction:ze,mediaResolution:"MEDIA_RESOLUTION_HIGH",safetySettings:[{category:Ln.HARM_CATEGORY_HARASSMENT,threshold:On.BLOCK_NONE},{category:Ln.HARM_CATEGORY_HATE_SPEECH,threshold:On.BLOCK_NONE},{category:Ln.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:On.BLOCK_NONE},{category:Ln.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:On.BLOCK_NONE}],temperature:1.05,thinkingConfig:(()=>{let N=je("Google",Te||"gemini-3-flash-preview",u);if(N!==null){if(typeof N=="object")return N;if(N===!1||N==="false"||N==="none"||N===0||N==="0")return{includeThoughts:!1};if(typeof N=="number")return{includeThoughts:!0,thinkingBudget:N};if(typeof N=="string"){let se=N.toLowerCase();if(se==="minimal")return{includeThoughts:!0,thinkingLevel:Xe.MINIMAL};if(se==="low")return{includeThoughts:!0,thinkingLevel:Xe.LOW};if(se==="medium")return{includeThoughts:!0,thinkingLevel:Xe.MEDIUM};if(se==="high")return{includeThoughts:!0,thinkingLevel:Xe.HIGH};let ht=Number(N);if(!isNaN(ht))return{includeThoughts:!0,thinkingBudget:ht}}}let
|
|
752
|
-
|
|
753
|
-
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(N){if(Ot){if(Ze+=N,Ze.length>=64){let F=0,Q=Math.min(yt.length,Ze.length);for(let x=Q;x>=10;x--)if(yt.endsWith(Ze.substring(0,x))){F=x;break}let Ee=Ze.substring(F);if(Ee){let We=/(?:<(think|thought)>|\[(think|thought)\])(?:(?!(?:<\/(?:think|thought)>|\[\/(?:think|thought)\]))[\s\S])*$/i.test(yt)?Ee.replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])\s*/gi,""):Ee.replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])[\s\S]*?(?:<\/(think|thought)>|\[\/(think|thought)\])\s*/gi,"").replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])\s*/gi,"");if(We)if(we+=We,i==="Google")cn+=We;else{yield*Nn();let ye=no(We);for(let z of ye)yield z}}Ot=!1,Ze=""}continue}else if(we+=N,i==="Google")cn+=N;else{yield*Nn();let F=no(N);for(let Q of F)yield Q}let ce=Za(we);if(ce.inside){Lt=!0,j||(j=Date.now());let Q={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",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",Answer:"answer",Steer:"steer",steer:"steer"}[ce.toolName]||ce.toolName,Ee=ce.args||"",x=null;if(["write_file","update_file","view_file","read_folder","write_pdf","write_docx","search_keyword","generate_image","file_map","invoke","invoke_sync","get_progress","await","answer"].includes(Q)){let ye=re(Ee),z=ye.path||ye.targetFile||ye.TargetFile||ye.directory,Nt=ye.keyword,Bn=ye.title||ye.task,Rn=ye.id||ye.taskId,$e=ye.timeout||ye.time;if(Nt!=null)x=String(Nt).replace(Gn,"");else if(z)x=te.basename(String(z).replace(Gn,"").replace(Wr,"/"));else if(Bn&&(Q==="invoke"||Q==="invoke_sync"))x=String(Bn).replace(Gn,"").substring(0,30);else if(Rn&&Q==="get_progress")x=String(Rn).replace(Gn,"");else if($e&&Q==="await"){let Ft=parseFloat(String($e).replace(Gn,""));isNaN(Ft)?x=String($e).replace(Gn,""):(Ft<5&&(Ft=5),Ft>120&&(Ft=120),x=(hn=>{if(hn>=60){let ps=Math.floor(hn/60),zn=hn%60;return`${ps}m${zn>0?` ${zn}s`:""}`}return`${hn}s`})(Ft))}else{let Ft=Ee.match(Ha);if(Ft){let Ht=Ft[1].replace(Gn,"");Q==="invoke"||Q==="invoke_sync"||Q==="get_progress"?x=Ht.substring(0,30):x=Q==="search_keyword"||Q==="file_map"?Ht:te.basename(Ht.replace(Wr,"/"))}}}let We=`${ni[Q]||Q}${x?` ${x}`:""}`;if((Q!==Ye||x!==an)&&(Ye=Q,an=x,yield{type:"status",content:`${We}`},process.stdout.isTTY)){let z={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",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",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"}[Q]||"Working";process.stdout.write(`\x1B]0;${z}...\x07`)}}if(we.length-tn>150){tn=we.length;let F=Xr(we,!1),Q=ti(F),Ee=Q?(Q.innerContent||"").trim():"",x=Ee.split(/[.!?]\s+/),We=new Set(x),ye=x.length>10?(x.length-We.size)/x.length:0,z=Ee.split(/\s+/).filter(Ne=>Ne.length>0).length,Nt=.6,Bn=.8,Rn=!1;if(i.toLowerCase().includes("google")&&(Te||"").toLowerCase().startsWith("gemma")){let T={low:256,medium:1024,high:8192,max:16384,xhigh:16384}[u?.toLowerCase()]||2500;Rn=z>T}if(ye>Nt||Rn){yield{type:"status",content:`${ye>Nt?"Reasoning Loop Detected":"Thinking Budget Exceeded"}. Re-centering...`},Mt=!0,await new Promise(T=>setTimeout(T,3e3));break}let Ht=
|
|
754
|
-
`).length;
|
|
748
|
+
`;for(let V of I.newFiles)Y+=`* ${V} (created)
|
|
749
|
+
`;for(let V of I.modifiedFiles)Y+=`* ${V} (modified)
|
|
750
|
+
`;for(let V of I.deletedFiles)Y+=`* ${V} (deleted)
|
|
751
|
+
`;Y+="[/system]",Ve.parts[0].text+=Y;let N=-1;for(let V=r.length-1;V>=0;V--)if(r[V].role==="user"&&r[V].text?.startsWith("[TOOL RESULT]")){N=V;break}N!==-1&&(r[N].text+=Y)}}catch{}let At=Math.floor(Sn*.99),wt=H+1;wt>=At&&Ve&&Ve.parts?.[0]&&(Ve.parts[0].text+=`
|
|
752
|
+
[system] WARNING, Turn Limit Impending: Step ${wt}/${Sn}. Wrap up quickly/prompt user to continue. [/system]`);let Dt=new Promise((I,Y)=>{f.signal.aborted&&Y(new DOMException("The user aborted a request.","AbortError")),f.signal.addEventListener("abort",()=>{Y(new DOMException("The user aborted a request.","AbortError"))})});Dt.catch(()=>{});let gt=ee;if(i==="Ollama")Ie=Qs(n.apiKey,Te,gt,ze,u,a,m,f.signal,1,b?.ollamaEndpoint||"Cloud");else if(i==="OpenRouter")Ie=Zo(n.apiKey,Te,gt,ze,u,a,m,f.signal,1,p);else if(i==="DeepSeek")Ie=Jo(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="Mistral")Ie=Xo(n.apiKey,Te,gt,ze,u,a,m,f.signal,1,p);else if(i==="NVIDIA"){let I=Qo(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);Ie=Ur(I,Te)}else if(i==="InferX")Ie=es(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="SenseNova")Ie=ts(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="AIHubMix")Ie=ns(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="Poolside")Ie=os(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="9router"||i==="9Router")Ie=ss(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="ExpLabs"||i==="ExperientialLabs")Ie=is(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="TokenHarbor"||i==="Token Harbor"||i==="tokenharbor"||i==="token_harbor"||i==="thk")Ie=Zs(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else if(i==="APInex"||i==="apinex"||i==="apx")Ie=ei(n.apiKey,Te,gt,ze,u,a,m,f.signal,1);else{let Y=si(n?.apiKey).models.generateContentStream({model:Te||"gemini-3-flash-preview",contents:gt,config:{systemInstruction:ze,mediaResolution:"MEDIA_RESOLUTION_HIGH",safetySettings:[{category:Ln.HARM_CATEGORY_HARASSMENT,threshold:On.BLOCK_NONE},{category:Ln.HARM_CATEGORY_HATE_SPEECH,threshold:On.BLOCK_NONE},{category:Ln.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:On.BLOCK_NONE},{category:Ln.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:On.BLOCK_NONE}],temperature:1.05,thinkingConfig:(()=>{let N=je("Google",Te||"gemini-3-flash-preview",u);if(N!==null){if(typeof N=="object")return N;if(N===!1||N==="false"||N==="none"||N===0||N==="0")return{includeThoughts:!1};if(typeof N=="number")return{includeThoughts:!0,thinkingBudget:N};if(typeof N=="string"){let se=N.toLowerCase();if(se==="minimal")return{includeThoughts:!0,thinkingLevel:Xe.MINIMAL};if(se==="low")return{includeThoughts:!0,thinkingLevel:Xe.LOW};if(se==="medium")return{includeThoughts:!0,thinkingLevel:Xe.MEDIUM};if(se==="high")return{includeThoughts:!0,thinkingLevel:Xe.HIGH};let ht=Number(N);if(!isNaN(ht))return{includeThoughts:!0,thinkingBudget:ht}}}let V=(Te||"").toLowerCase(),J=V.includes("gemma-4")||V.startsWith("gemma"),ce=V.includes("gemini-3");if(J||ce)return J?u.toLowerCase()!=="high"?{includeThoughts:!1,thinkingLevel:Xe.MINIMAL}:{includeThoughts:!0,thinkingLevel:Xe.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:V.includes("pro")?Xe.LOW:Xe.MINIMAL,Low:Xe.LOW,Medium:Xe.MEDIUM,Standard:Xe.MEDIUM,High:Xe.HIGH,xHigh:Xe.HIGH}[u]||Xe.MEDIUM};{let se={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[u]||2048;return se===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:se}}})()}},{signal:f.signal});Ie=await Promise.race([Y,Dt])}we="",Ye=null,j=null,ve=[],ut=0,yield{type:"model_update",content:null},Ze="",Ot=yt.length>0;let cn="",hs=Date.now(),Nn=async function*(){if(i==="Google"&&cn){let I=no(cn);for(let Y of I)yield Y;cn="",hs=Date.now()}},yi=!0,Fn="",Vn=!1,Tt=null,xi=!1,Yn=!1,qn=!1,Ao=!1,Cn=!1,to=I=>{let Y=0;for(;Y+2<I.length;)I[Y]==="`"&&I[Y+1]==="`"&&I[Y+2]==="`"?(Ao=!Ao,Y+=3):Y++},bi=I=>{if(!I)return;let Y=/(?:<(\/?)(?:think|thought|thoughts)[^>]*>|\[(\/?)(?:think|thought|thoughts)\]|<\/?channel\|?>|<\|channel>thought)/gi,N;for(;(N=Y.exec(I))!==null;){let V=N[0].toLowerCase();V.startsWith("</")||V.startsWith("[/")||V==="<channel|>"?Cn=!1:Cn=!0}},ia={tool:{startPrefix:"[tool",fullPrefix:"[tool:",endTag:"]"},agent:{startPrefix:"[agent",fullPrefix:"[agent:generalist.",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|>"}},no=I=>{let Y=[],N=I,V=J=>{if(!J)return;if(!xi){Y.push({type:"text",content:J}),to(J),bi(J);return}let ce=/(?:<(\/?)(?:think|thought|thoughts)[^>]*>|\[(\/?)(?:think|thought|thoughts)\]|<\/?channel\|?>|<\|channel>thought)/gi,se=0,ht;for(;(ht=ce.exec(J))!==null;){let Q=J.substring(se,ht.index);if(Q)if(to(Q),Cn)Y.push({type:"text",content:Q});else{let We=Q.replace(/[^\n]/g,"");We&&Y.push({type:"text",content:We})}let Ee=ht[0];to(Ee);let x=Ee.toLowerCase();x.startsWith("</")||x.startsWith("[/")||x==="<channel|>"?Cn=!1:Cn=!0,Y.push({type:"text",content:Ee}),se=ce.lastIndex}let F=J.substring(se);if(F)if(to(F),Cn)Y.push({type:"text",content:F});else{let Q=F.replace(/[^\n]/g,"");Q&&Y.push({type:"text",content:Q})}};for(;N.length>0;)if(Vn){let J=Fn+N,ce=ia[Tt];if(ce){let F=!1;if(J.length<ce.startPrefix.length?ce.startPrefix.startsWith(J)||(F=!0):J.startsWith(ce.startPrefix)?J.length>=ce.fullPrefix.length&&!J.startsWith(ce.fullPrefix)&&(F=!0):F=!0,F){V(J),Fn="",Vn=!1,Tt=null,Yn=!1,qn=!1,N="";break}}let se=-1,ht=ce?ce.endTag:"]";if(Tt==="tool"||Tt==="agent"){let F=0,Q=null,Ee=0,x=!1;for(let We=0;We<J.length;We++){let ye=J[We];if(Q){if(ye===Q){let z=0;for(let Nt=We-1;Nt>=0&&J[Nt]==="\\";Nt--)z++;z%2===0&&(Q=null)}}else if(ye==='"'||ye==="'"||ye==="`")Q=ye;else if(ye==="(")F++,x=!0;else if(ye===")")F--;else if(ye==="[")Ee++;else if(ye==="]"){if(x&&F===0&&Ee===1){se=We;break}Ee--}}}else se=J.indexOf(ht);if(se!==-1){let F=ht.length,Q=J.substring(0,se+F);Tt?.startsWith("kimi")||Y.push({type:"text",content:Q}),to(Q),bi(Q),(Tt==="tool"||Tt==="agent"||Tt?.startsWith("kimi"))&&!Yn&&!qn&&(xi=!0),Yn=!1,qn=!1,Fn="",Vn=!1,Tt=null,N=J.substring(se+F)}else{let F=Tt?.startsWith("kimi")?8192:512;J.length>F?(V(J),Fn="",Vn=!1,Tt=null,Yn=!1,qn=!1):Fn=J,N="";break}}else{let J=N.indexOf("[tool"),ce=N.indexOf("[agent"),se=N.indexOf("[[END]]"),ht=N.indexOf("<|tool_calls_section_begin|>"),F=N.indexOf("<|tool_call_begin|>"),Q=[{type:"tool",idx:J,start:"[tool",end:"]"},{type:"agent",idx:ce,start:"[agent",end:"]"},{type:"end",idx:se,start:"[[END]]",end:"[[END]]"},{type:"kimi_section",idx:ht,start:"<|tool_calls_section_begin|>",end:"<|tool_calls_section_end|>"},{type:"kimi_call",idx:F,start:"<|tool_call_begin|>",end:"<|tool_call_end|>"}].filter(Ee=>Ee.idx!==-1).sort((Ee,x)=>Ee.idx-x.idx);if(Q.length>0){let Ee=Q[0],x=N.substring(0,Ee.idx);Ee.idx>0&&V(x);let We=Ee.idx>0?N[Ee.idx-1]:"";Yn=Ao||We==="`",qn=Cn,Vn=!0,Tt=Ee.type,Fn="",N=N.substring(Ee.idx)}else{let Ee=["[tool","[agent","[[END]]","<|tool_calls_section_begin|>","<|tool_call_begin|>"],x=-1;for(let We of Ee){for(let ye=We.length-1;ye>0;ye--)if(N.endsWith(We.substring(0,ye))){x=N.length-ye;let z=Ee.indexOf(We);z===0?Tt="tool":z===1?Tt="agent":z===2?Tt="end":z===3?Tt="kimi_section":Tt="kimi_call";break}if(x!==-1)break}if(x!==-1){if(x>0){let ye=N.substring(0,x);V(ye)}let We=x>0?N[x-1]:"";Yn=Ao||We==="`",qn=Cn,Vn=!0,Fn=N.substring(x),N=""}else{V(N);break}}}return Y},ra=Ie[Symbol.asyncIterator]();for(;;){let{value:I,done:Y}=await Promise.race([ra.next(),Dt]);if(Y)break;if(I&&I.type==="status"){yield I;continue}let N="",V=I.candidates?.[0]?.content?.parts;if(V&&V.length>0)for(let ce of V){let se=typeof ce.text=="string"?ce.text:ce.text?parseChunkText(ce.text):"";ce.thought?se&&(me||(N+="<think>",me=!0),N+=se):se&&(me&&(N+="</think>",me=!1),N+=se)}else I.text&&me&&(N+="</think>",me=!1);N=Ka(N);let J=N?_s(N):0;if(n&&typeof n.onTokenChunk=="function"&&n.onTokenChunk(N,J),yi&&(yield{type:"status",content:"Thinking"},yi=!1),bt){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
|
|
753
|
+
|
|
754
|
+
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(N){if(Ot){if(Ze+=N,Ze.length>=64){let F=0,Q=Math.min(yt.length,Ze.length);for(let x=Q;x>=10;x--)if(yt.endsWith(Ze.substring(0,x))){F=x;break}let Ee=Ze.substring(F);if(Ee){let We=/(?:<(think|thought)>|\[(think|thought)\])(?:(?!(?:<\/(?:think|thought)>|\[\/(?:think|thought)\]))[\s\S])*$/i.test(yt)?Ee.replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])\s*/gi,""):Ee.replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])[\s\S]*?(?:<\/(think|thought)>|\[\/(think|thought)\])\s*/gi,"").replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])\s*/gi,"");if(We)if(we+=We,i==="Google")cn+=We;else{yield*Nn();let ye=no(We);for(let z of ye)yield z}}Ot=!1,Ze=""}continue}else if(we+=N,i==="Google")cn+=N;else{yield*Nn();let F=no(N);for(let Q of F)yield Q}let ce=Za(we);if(ce.inside){Lt=!0,j||(j=Date.now());let Q={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",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",Answer:"answer",Steer:"steer",steer:"steer"}[ce.toolName]||ce.toolName,Ee=ce.args||"",x=null;if(["write_file","update_file","view_file","read_folder","write_pdf","write_docx","search_keyword","generate_image","file_map","invoke","invoke_sync","get_progress","await","answer"].includes(Q)){let ye=re(Ee),z=ye.path||ye.targetFile||ye.TargetFile||ye.directory,Nt=ye.keyword,Bn=ye.title||ye.task,Rn=ye.id||ye.taskId,$e=ye.timeout||ye.time;if(Nt!=null)x=String(Nt).replace(Gn,"");else if(z)x=te.basename(String(z).replace(Gn,"").replace(Wr,"/"));else if(Bn&&(Q==="invoke"||Q==="invoke_sync"))x=String(Bn).replace(Gn,"").substring(0,30);else if(Rn&&Q==="get_progress")x=String(Rn).replace(Gn,"");else if($e&&Q==="await"){let Ft=parseFloat(String($e).replace(Gn,""));isNaN(Ft)?x=String($e).replace(Gn,""):(Ft<5&&(Ft=5),Ft>120&&(Ft=120),x=(hn=>{if(hn>=60){let ps=Math.floor(hn/60),zn=hn%60;return`${ps}m${zn>0?` ${zn}s`:""}`}return`${hn}s`})(Ft))}else{let Ft=Ee.match(Ha);if(Ft){let Ht=Ft[1].replace(Gn,"");Q==="invoke"||Q==="invoke_sync"||Q==="get_progress"?x=Ht.substring(0,30):x=Q==="search_keyword"||Q==="file_map"?Ht:te.basename(Ht.replace(Wr,"/"))}}}let We=`${ni[Q]||Q}${x?` ${x}`:""}`;if((Q!==Ye||x!==an)&&(Ye=Q,an=x,yield{type:"status",content:`${We}`},process.stdout.isTTY)){let z={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",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",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"}[Q]||"Working";process.stdout.write(`\x1B]0;${z}...\x07`)}}if(we.length-tn>150){tn=we.length;let F=Xr(we,!1),Q=ti(F),Ee=Q?(Q.innerContent||"").trim():"",x=Ee.split(/[.!?]\s+/),We=new Set(x),ye=x.length>10?(x.length-We.size)/x.length:0,z=Ee.split(/\s+/).filter(Ne=>Ne.length>0).length,Nt=.6,Bn=.8,Rn=!1;if(i.toLowerCase().includes("google")&&(Te||"").toLowerCase().startsWith("gemma")){let T={low:256,medium:1024,high:8192,max:16384,xhigh:16384}[u?.toLowerCase()]||2500;Rn=z>T}if(ye>Nt||Rn){yield{type:"status",content:`${ye>Nt?"Reasoning Loop Detected":"Thinking Budget Exceeded"}. Re-centering...`},Mt=!0,await new Promise(T=>setTimeout(T,3e3));break}let Ht=Vr(we).trim().split(/[.!?]\s+/),hn=new Set(Ht);if((Ht.length>10?(Ht.length-hn.size)/Ht.length:0)>Bn){yield{type:"status",content:"Response Loop Detected. Re-centering..."},Mt=!1,An=!0,await new Promise(Ne=>setTimeout(Ne,3e3));break}let zn=F.replace(Pa,"").replace($a,"").replace(Na,"").replace(Fa,""),Bt=zn.toLowerCase().split(/\s+/).map(Ne=>Ne.replace(Ba,"")).filter(Ne=>Ne.length>0),mn=!1;if(Bt.length>=10)for(let Ne=1;Ne<=15;Ne++){let T=Math.max(3,Math.ceil(10/Ne));if(Bt.length<Ne*T)continue;let K=Bt.slice(Bt.length-Ne),ie=K.join(" ");if(Ne>1&&ie===K.slice(0,Math.floor(Ne/2)).join(" ").repeat(2).trim())continue;let ue=!0;for(let xe=1;xe<T;xe++)if(Bt.slice(Bt.length-Ne*(xe+1),Bt.length-Ne*xe).join(" ")!==ie){ue=!1;break}if(ue){mn=!0;break}}if(!mn){let Ne=zn.toLowerCase().replace(Ua,"");if(Ne.length>=20)for(let T=1;T<=10;T++){let K=Math.max(5,Math.ceil(16/T));if(Ne.length<T*K)continue;let ie=Ne.substring(Ne.length-T),ue=!0;for(let xe=1;xe<K;xe++)if(Ne.substring(Ne.length-T*(xe+1),Ne.length-T*xe)!==ie){ue=!1;break}if(ue){mn=!0;break}}}if(mn){yield{type:"status",content:"Stuttering Detected. Re-centering..."},Mt=!1,ln=!0,await new Promise(Ne=>setTimeout(Ne,3e3));break}}let se=qt(we),ht=ko(se);for(;ht.length>ut;){yield*Nn();let F=ht[ut],Q=Date.now(),x={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",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",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"}[F.toolName]||F.toolName,We=ni[x]||F.toolName,ye=Kn(x,F.args);yield{type:"status",content:`${We}${ye?` ${ye}`:""}`};let z="";if(x==="click"){let T=re(F.args);z=`\u2714 Clicked: ${T.intendedClickText?`${T.intendedClickText}`:""}`}else if(x==="drag"){let T=re(F.args);z=`\u2714 Dragged: Cell ${T.fromGridId||""} \u2192 Cell ${T.toGridId||""}`}else if(x==="scroll"){let T=re(F.args);z=`\u2714 Scrolled: ${T.direction||"down"} (${T.amount||1})`}else if(x==="keyboard_typing"){let T=re(F.args);z=`\u2714 Typed: ${T.text?`"${T.text.length>20?T.text.substring(0,20)+"...":T.text}"`:""}`}else if(x==="key_press")z=`\u2714 Pressed Key: ${re(F.args).key||""}`;else if(x==="recapture_screen")z="\u2714 Recaptured Screen";else if(x==="web_search"){let{query:T,limit:K=10,aiMode:ie=!1}=re(F.args);z=`${T?"\u2714":"\u2718"} ${ie?"AI Search":"Searched"}: ${T?`${T}`:"No Search Query"}${ie===!1&&T?` \u2192 ${K}`:""}`}else if(x==="web_scrape"){let T=re(F.args).url||null;z=`${T?"\u2714":"\u2718"} Visited: ${T||"No Source"}`}else if(x==="view_file"){let{path:T,StartLine:K,EndLine:ie,start_line:ue,end_line:xe,startLine:Ue,endLine:De}=re(F.args),Ce=K||ue||Ue,q=ie||xe||De,le=parseInt(Ce)||1,fe=parseInt(q)||(Ce?le+800:800),Ke="...",Je=fe,ge=(T||"").trim().toLowerCase().replaceAll("\\","/");if(ge.startsWith("#skill"))ge.startsWith("#skill/global/fluxflow")||ge.startsWith("#skills/global/fluxflow")||ge.includes("#skill/fluxflow")||ge.includes("#skills/fluxflow")?z="\u2714 Read Documentation":z=`\u2714 Read Skill: ${te.basename(T.replaceAll("\\","/"))}`;else{try{let Se=te.resolve(process.cwd(),T);if(He.existsSync(Se)){let xt=He.readFileSync(Se,"utf8").split(`
|
|
755
|
+
`).length;Ke=xt,!Ce&&!q&&xt>800?Je=Math.min(50,xt):Je=Math.min(fe,xt)}}catch{}let Le=(T||"").toLowerCase(),mt=Le.endsWith(".pdf"),Fe=Le.endsWith(".docx")||Le.endsWith(".doc")||Le.endsWith(".ppt")||Le.endsWith(".pptx")||Le.endsWith(".xls")||Le.endsWith(".xlsx"),nt=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(Le);mt||Fe?z=`${T.length>0?"\u2714":"\u2718"} ${T?`Analyzed: ${te.basename(T)}`:"Analyzed: File Not Found"}`:nt?z=`${T.length>0?"\u2714":"\u2718"} ${T?`Processed: ${te.basename(T)}`:"Processed: File Not Found"}`:z=`${Ke!=="..."?"\u2714":"\u2718"} Read: ${T?`${te.basename(T)} \u2192 ${Ke!=="..."?`Lines ${le} - ${Je} of ${Ke}`:"File Not Found"}`:"File Not Found"}`}}else if(x==="list_files"||x==="read_folder"){let T=x==="list_files"?"List":"Browsed",K=re(F.args).path||null,ie=re(F.args).recurse||1;z=`${K?"\u2714":"\u2718"} ${T}: ${K?`${K==="."?`./${ie>1?"*":""}`:`${K.replaceAll("\\","/")}${ie>1?`${K.endsWith("/")?"*":"/*"}`:`${K.endsWith("/")?"":"/"}`}`}`:"No Folder Selected"}`}else if(x==="write_file"||x==="update_file"){let T=x==="write_file"?"Created":"Edited",K=re(F.args),ie=K.path||null,xe=Object.entries(K).some(([Ue,De])=>Ue.startsWith("searchContent")&&typeof De=="string"&&De.startsWith("^LINE:"))?"\u1361":":";z=`${ie?"\u2714":"\u2718"} ${T}${xe} ${ie?ie.replaceAll("\\","/"):"No File Changes"}`}else if(x==="write_pdf"){let T=re(F.args).path||null;z=`${T?"\u2714":"\u2718"} Generated: ${T.replaceAll("\\","/")||"No PDF Generated"}`}else if(x==="write_docx"){let T=re(F.args).path||null;z=`${T?"\u2714":"\u2718"} Generated: ${T.replaceAll("\\","/")||"No Docx Generated"}`}else if(x==="file_map"){let T=re(F.args).path;z=`${T?"\u2714":"\u2718"} Indexed: ${T.replaceAll("\\","/")?""+T:"File Not Found"}`}else if(x.toLowerCase()==="search_keyword"||x.toLowerCase()==="todo")z="";else if(x.toLowerCase()==="generate_image"){let{path:T,outputPath:K,output:ie}=re(F.args);z=`\u2714 Generated: ${T||K||ie||"generated_image.png"}`}else if(x==="invoke_sync"||x==="InvokeSync"){let T=Kn(x,F.args);z=`\u2714 Called Generalist${T?`: ${T}`:""}`}else if(x==="Invoke"||x==="InvokeAsync"||x==="invoke"){let T=Kn(x,F.args);z=`\u2714 Started Generalist${T?`: ${T}`:""}`}else if(x==="get_progress"||x==="GetProgress"){let T=Kn(x,F.args);z=`\u2714 Checked${T?`: ${T}`:""}`}else if(x==="cancel"){let T=Kn(x,F.args);z=`\u{1F6C7} Cancelled${T?`: ${T}`:""}`}else if(x==="steer"||x==="Steer"){let T=Kn(x,F.args);z=`\u2714 Steered${T?`: ${T}`:""}`}else if(x==="EmergencyRollback"){let{method:T}=re(F.args);z=T==="forceRevert"?"":"\u2714 Rollback Point Checked"}else if(x==="await"||x==="Await"){let{time:T,timeout:K}=re(F.args),ie=parseFloat(K||T)||0;ie||(ie=120);let ue=De=>{if(De>=60){let Ce=Math.floor(De/60),q=De%60;return`${Ce}m${q>0?` ${q}s`:""}`}return`${De}s`},xe=["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"];z=`\u2714 ${xe[Math.floor(Math.random()*xe.length)]} \u2192 ${ue(ie)}`}else x==="Answer"||x==="answer"?z="\u2714 Resolved Sub-Agent Query":x==="exec_command"||x==="ask"?z="":z=`Executed: ${F.toolName}`;if(yield*Nn(),x==="exec_command"){let{command:T}=re(F.args);if(T&&n.systemSettings&&n.systemSettings.allowExternalAccess===!1){let K=[/[a-zA-Z]:[\\\/]/i,/^\//,/\.\.[\\\/]/,/\/etc\//,/\/var\//,/\/root\//,/\/bin\//,/\/usr\//],ie=te.resolve(process.cwd()).substring(0,3).toLowerCase(),ue=q=>{let le=[],fe="",Ke=null;for(let Je=0;Je<q.length;Je++){let ge=q[Je];Ke?(ge===Ke&&(Ke=null),fe+=ge):ge==='"'||ge==="'"?(Ke=ge,fe+=ge):ge==="&"&&q[Je+1]==="&"||ge==="|"&&q[Je+1]==="|"?(fe.trim()&&(le.push(fe.trim()),fe=""),Je++):ge===";"||ge==="|"||ge==="&"?fe.trim()&&(le.push(fe.trim()),fe=""):fe+=ge}return fe.trim()&&le.push(fe.trim()),le},xe=q=>{let le=[],fe="",Ke=null;for(let Je=0;Je<q.length;Je++){let ge=q[Je];Ke?(ge===Ke&&(Ke=null),fe+=ge):ge==='"'||ge==="'"?(Ke=ge,fe+=ge):/\s/.test(ge)?fe&&(le.push(fe),fe=""):fe+=ge}return fe&&le.push(fe),le},Ue=q=>{let le=q.replace(/^['"]|['"]$/g,"").trim();return!le||process.platform==="win32"&&/^\/[a-zA-Z0-9?]+$/.test(le)?!1:K.some(fe=>{if(fe.source==="[a-zA-Z]:[\\\\\\/]"){let Ke=le.match(/[a-zA-Z]:[\\\/]/i);return Ke&&Ke[0].toLowerCase()!==ie}return fe.test(le)})};if(ue(T).some(q=>{let le=xe(q);if(le.length===0)return!1;let fe=le[0].replace(/^['"]|['"]$/g,"").toLowerCase();if(["echo","printf","write-output"].includes(fe)){let Je=!1;return le.some(ge=>{let St=ge.replace(/^['"]|['"]$/g,"");if(St===">"||St===">>"||St==="<")return Je=!0,!1;if(St.startsWith(">")||St.startsWith("<")){let Le=St.replace(/^[><]+/,"");return Ue(Le)}return Je?(Je=!1,Ue(ge)):!1})}return le.some(Je=>Ue(Je))})){let q='Access Denied. Prohibited from accessing external directories while "External Workspace Access" is disabled.';n.onExecStart&&n.onExecStart(T||"No Command"),yield{type:"exec_start"},await new Promise(le=>setTimeout(le,50)),n.onExecChunk&&n.onExecChunk(`ERROR: ${q}`),await new Promise(le=>setTimeout(le,50)),n.onExecEnd&&n.onExecEnd(),ve.push({role:"user",text:`[TOOL RESULT]: ERROR: ${q}`}),yield{type:"tool_result",content:`[TOOL RESULT]: ERROR: ${q}`},ut++;continue}}n.onExecStart&&n.onExecStart(T||"No Command"),yield{type:"exec_start"}}let Nt=re(F.args),Bn=Nt.path||Nt.targetPath||null;if(Bn){let T=n.systemSettings&&n.systemSettings.allowExternalAccess===!1,K=te.resolve(Bn),ie=te.resolve(process.cwd());if(T&&!K.startsWith(ie)){let ue="Access Denied. You are not allowed to access files outside the current workspace.";if(x==="write_file"||x==="update_file"){let Ue=`\u2718 ${x==="write_file"?"Write Canceled":"Edit Canceled"}: ${Nt.path||"..."}`,De=115;process.stdout.isTTY&&(De=process.stdout.columns-5||120);let Ce=Math.min(Ue.length+4,De),q=`${Ue.padEnd(Ce-2).substring(0,Ce-2)}`;yield{type:"visual_feedback",content:Yt(`${qe?`
|
|
755
756
|
`:""}${q}
|
|
756
|
-
`)},qe=!1}ve.push({role:"user",text:`[TOOL RESULT]: ERROR: ${ue}`}),yield{type:"tool_result",content:`[TOOL RESULT]: ERROR: ${ue}`},ut++;continue}}if(n.onToolApproval&&(x==="write_file"||x==="update_file"||x==="exec_command")){let
|
|
757
|
+
`)},qe=!1}ve.push({role:"user",text:`[TOOL RESULT]: ERROR: ${ue}`}),yield{type:"tool_result",content:`[TOOL RESULT]: ERROR: ${ue}`},ut++;continue}}if(n.onToolApproval&&(x==="write_file"||x==="update_file"||x==="exec_command")){let K=n.systemSettings||{},ie=K.autoExec,ue=null,xe=!1,Ue=!1,De=!1;if(x==="exec_command"){let{command:Le}=re(F.args),mt=(Le||"").trim(),Fe=(Gt,xt)=>{if(!xt)return!1;let nn=xt.split(",").map(jt=>jt.trim().toLowerCase()).filter(Boolean),at=Gt.toLowerCase();return nn.some(jt=>at.startsWith(jt))},nt=Fe(mt,K.alwaysAskCommands),Se=Fe(mt,K.autoApproveCommands);if(Ue=Fe(mt,K.autoDisallowCommands),nt?xe=!0:(Se||K.autoApproveGit&&/^git\s+commit\b/i.test(mt))&&(ue="allow"),!xe&&!ue){if(K.networkAccess===!1){let xt=mt.trim().replace(/\s+/g," ").replace(/^['"]+|['"]+$/g,"").toLowerCase().split(" "),at=xt[0].split("/").pop().split("\\").pop().replace(/\.exe$/,""),jt=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"]),lt=!1;jt.has(at)&&(lt=!0);let ot=vn=>xt.slice(1).some(pn=>vn.includes(pn)),ct=vn=>{let pn=xt.findIndex(yn=>vn.includes(yn)),Un=xt.findIndex(yn=>["run","exec","test"].includes(yn));return pn!==-1&&!(Un!==-1&&Un<pn)};at==="git"&&ot(["clone","pull","push","fetch"])&&(lt=!0),at==="go"&&ot(["get","install"])&&(lt=!0),at==="npm"&&ct(["install","i","update","add"])&&(lt=!0),at==="yarn"&&ct(["add","install","upgrade"])&&(lt=!0),at==="pnpm"&&ct(["add","install","update"])&&(lt=!0),at==="bun"&&ct(["add","install","update"])&&(lt=!0),at==="deno"&&ot(["install","add"])&&(lt=!0),at==="pip"&&ot(["install","download"])&&(lt=!0),at==="pip3"&&ot(["install","download"])&&(lt=!0),at==="cargo"&&ot(["install","add"])&&(lt=!0),["bash","sh","zsh","fish"].includes(at)&&ot(["-c"])&&(lt=!0),at==="cmd"&&ot(["/c"])&&(lt=!0),lt&&(ue="deny",De=!0)}!ue&&Ue&&(ue="deny")}!xe&&!ue&&ie&&(ue="allow")}else ie&&(ue="allow");let Ce=ue,q="";ue==="deny"&&(De?q="network":Ue?q="settings":q="prohibited");let le=!1,fe="",Ke=[],Je=0,ge=!1,St="";if(!Ce){if(x==="write_file"||x==="update_file")try{let Fe=re(F.args),{path:nt}=Fe;if(nt){let Se=te.resolve(process.cwd(),nt),Gt=ot=>ot?ot.toLowerCase().replace(/\\/g,"/").replace(/^[a-z]:/,ct=>ct.toUpperCase()):"",xt=Gt(Se),nn="",at=!1,jt=await Hn(),lt=Gt(jt?.file_focused);if(jt&<===xt&&jt.full_content?(nn=jt.full_content,at=!0):He.existsSync(Se)&&(nn=He.readFileSync(Se,"utf8"),at=!0),fe=nn,await Oo.recordFileChange(Se,nn),at){let ot=nn;if(x==="write_file"){let ct=Fe.content||Fe.newContent||"";ot=ct.endsWith(`
|
|
757
758
|
`)?ct:ct+`
|
|
758
|
-
`,St=ot}else{let{patchPairs:ct,allowMultiple:vn,error:pn}=Ti(Fe);if(pn){let Qt=`[TOOL RESULT]: ERROR: ${pn}`;ve.push({role:"user",text:Qt}),await Ct("toolFailure"),n.onToolResult&&n.onToolResult("failure",x),yield{type:"tool_result",content:Qt,toolName:x},ut++;continue}let Un=Fe.allowMultiple!==void 0?Fe.allowMultiple===!0||String(Fe.allowMultiple).toLowerCase()==="true":vn;Je=ct.length;let yn=Si(nn,ct,{allowMultiple:Un});ot=yn.content,St=ot,
|
|
759
|
+
`,St=ot}else{let{patchPairs:ct,allowMultiple:vn,error:pn}=Ti(Fe);if(pn){let Qt=`[TOOL RESULT]: ERROR: ${pn}`;ve.push({role:"user",text:Qt}),await Ct("toolFailure"),n.onToolResult&&n.onToolResult("failure",x),yield{type:"tool_result",content:Qt,toolName:x},ut++;continue}let Un=Fe.allowMultiple!==void 0?Fe.allowMultiple===!0||String(Fe.allowMultiple).toLowerCase()==="true":vn;Je=ct.length;let yn=Si(nn,ct,{allowMultiple:Un});ot=yn.content,St=ot,Ke=yn.results;let Eo=Ke.filter(Qt=>Qt.success),ys=Ke.filter(Qt=>!Qt.success);if(Eo.length===0){let Qt=`[TOOL RESULT]: ERROR: Failed to apply patches to [${te.basename(Se)}].
|
|
759
760
|
${ys.map(Co=>` \u2022 ${Co.error}`).join(`
|
|
760
|
-
`)}`,so=`\u2714 Edited: ${te.basename(Se.replaceAll("\\","/"))}`,dt=115;process.stdout.isTTY&&(dt=process.stdout.columns-5||120);let
|
|
761
|
+
`)}`,so=`\u2714 Edited: ${te.basename(Se.replaceAll("\\","/"))}`,dt=115;process.stdout.isTTY&&(dt=process.stdout.columns-5||120);let Kt=Math.min(so.length+4,dt),io=`${so.padEnd(Kt-2).substring(0,Kt-2)}`;yield{type:"visual_feedback",content:Yt(`${qe?`
|
|
761
762
|
`:""}${io}`)},qe=!1,ve.push({role:"user",text:Qt}),await Ct("toolFailure"),n.onToolResult&&n.onToolResult("failure",x),yield{type:"tool_result",content:Qt,toolName:x},ut++;continue}}yield{type:"status",content:`Opening Diff in IDE: ${te.basename(Se)}`},qs(Se,nn,ot),le=!0,await new Promise(ct=>setTimeout(ct,50))}else if(x==="write_file"){let ot=Fe.content||Fe.newContent||"",ct=ot.endsWith(`
|
|
762
763
|
`)?ot:ot+`
|
|
763
764
|
`;St=ct,He.existsSync(Se)||(ge=!0,He.mkdirSync(te.dirname(Se),{recursive:!0}),He.writeFileSync(Se,"","utf8")),yield{type:"status",content:`Opening New File Diff in IDE: ${te.basename(Se)}`},qs(Se,"",ct),le=!0,await new Promise(vn=>setTimeout(vn,50))}}}catch(Fe){console.error("Simulation/Diff Error:",Fe)}let Le=null;Ys(Fe=>{Le=Fe});let mt=n.onToolApproval;if(Ce=await new Promise(async Fe=>{let nt=setInterval(()=>{Le&&(rs.onIDEApproval&&rs.onIDEApproval(Le),clearInterval(nt),Fe(Le))},100);try{let Se=await mt(x,F.args);clearInterval(nt),Fe(Se)}catch{clearInterval(nt),Fe("deny")}}),Ys(null),x==="write_file"||x==="update_file"){let{path:Fe}=re(F.args);if(Fe){let nt=te.resolve(process.cwd(),Fe);if(Fr(nt,Ce),Ce==="deny"&&ge&&He.existsSync(nt))try{He.unlinkSync(nt)}catch{}}}Ce==="deny"&&(q="user")}if(Ce==="allow"&&le&&qo()){let{path:Le}=re(F.args),mt=te.resolve(process.cwd(),Le),Fe=dt=>dt?te.resolve(dt).replace(/\\/g,"/").toLowerCase():"",nt=await Hn(),Se="";if(nt&&nt.file_focused&&Fe(nt.file_focused)===Fe(mt)&&nt.full_content&&(Se=nt.full_content),!Se&&He.existsSync(mt)){let dt=He.readFileSync(mt,"utf8");dt&&(Se=dt)}!Se&&St&&(Se=St),(Se||ge)&&He.writeFileSync(mt,Se,"utf8");let Gt=Se.split(/\r?\n/),xt=Gt.length,nn=Buffer.byteLength(Se,"utf8"),at="";fe&&(at=`Old File contents:
|
|
764
|
-
${fe.split(/\r?\n/).map((
|
|
765
|
+
${fe.split(/\r?\n/).map((Kt,io)=>`${io+1} | ${Kt}`).join(`
|
|
765
766
|
`)}
|
|
766
767
|
|
|
767
768
|
`);let jt="";if(xt<=100)jt=Gt.join(`
|
|
768
769
|
`);else{let dt=Gt.slice(0,50).join(`
|
|
769
|
-
`),
|
|
770
|
+
`),Kt=Gt.slice(-50).join(`
|
|
770
771
|
`);jt=`${dt}
|
|
771
772
|
|
|
772
773
|
... [${xt-100} lines truncated for history stability] ...
|
|
773
774
|
|
|
774
|
-
${
|
|
775
|
+
${Kt}`}let lt="";if(x==="update_file"){let dt=_i(fe,Se,Ke,12,n?.compressToolResults||rs?.systemSettings?.compressToolResults);lt=`SUCCESS: File [${Le}] updated via IDE Companion (May have user edits). [${Ke.length}/${Je}] blocks applied.
|
|
775
776
|
|
|
776
|
-
${dt}`}else{let dt=Se.split(/\r?\n/),
|
|
777
|
+
${dt}`}else{let dt=Se.split(/\r?\n/),Kt=dt.length,io=Buffer.byteLength(Se,"utf8"),Co="";fe&&(Co=`Old File contents:
|
|
777
778
|
${fe.split(/\r?\n/).map((bs,ga)=>`${ga+1} | ${bs}`).join(`
|
|
778
779
|
`)}
|
|
779
780
|
|
|
780
|
-
`);let xs="";if(
|
|
781
|
+
`);let xs="";if(Kt<=100)xs=dt.join(`
|
|
781
782
|
`);else{let ki=dt.slice(0,50).join(`
|
|
782
783
|
`),bs=dt.slice(-50).join(`
|
|
783
784
|
`);xs=`${ki}
|
|
784
785
|
|
|
785
|
-
... [${
|
|
786
|
+
... [${Kt-100} lines truncated] ...
|
|
786
787
|
|
|
787
788
|
${bs}`}lt=`SUCCESS: File [${Le}] saved via IDE Companion (May have user edits).
|
|
788
|
-
- Stats: [${
|
|
789
|
+
- Stats: [${Kt} lines, ${(io/1024).toFixed(1)} KB]
|
|
789
790
|
${Co}- Content Preview:
|
|
790
791
|
|
|
791
|
-
${xs}`}let ot=x==="write_file"?"Created":"Edited",ct=re(F.args),pn=Object.entries(ct).some(([dt,
|
|
792
|
+
${xs}`}let ot=x==="write_file"?"Created":"Edited",ct=re(F.args),pn=Object.entries(ct).some(([dt,Kt])=>dt.startsWith("searchContent")&&typeof Kt=="string"&&Kt.startsWith("^LINE:"))?"\u1361":":",Un=`${Le?"\u2714":"\u2718"} ${ot}${pn} ${Le?Le.replaceAll("\\","/"):"No File Changes"}`,yn=115;process.stdout.isTTY&&(yn=process.stdout.columns-5||120);let Eo=Math.min(Un.length+4,yn),ys=`${Un.padEnd(Eo-2).substring(0,Eo-2)}`;yield{type:"visual_feedback",content:Yt(`${qe?`
|
|
792
793
|
`:""}${ys}`)},qe=!1;let Qt=Date.now();Ge=Qt,yield{type:"tool_time",content:Qt-Q};let so=`[TOOL RESULT]: ${lt}`;ve.push({role:"user",text:so}),_n=!0,await Ct("toolSuccess"),n.onToolResult&&n.onToolResult("success",x),yield{type:"tool_result",content:lt,aiContent:so,toolName:x},ut++;continue}if(Ce==="deny"){let Le=`Permission Denied: Prohibited ${x==="exec_command"?"Command":"file edit"}.`;if(q==="user"?Le="Permission Denied by User":q==="settings"?Le="Permission Denied by User Policy":q==="network"?Le="Permission Denied: Sandbox Network Access Disabled by User Policy.":q==="prohibited"&&x==="exec_command"&&(Le="Permission Denied: Prohibited Command in User Policy"),x==="write_file"||x==="update_file"){let Fe=`\u2718 ${x==="write_file"?"Write Cancelled":"Edit Denied"}: ${re(F.args).path.replaceAll("\\","/")||"..."}`,nt=115;process.stdout.isTTY&&(nt=process.stdout.columns-5||120);let Se=Math.min(Fe.length+4,nt),Gt=`${Fe.padEnd(Se-2).substring(0,Se-2)}`,xt=` ${" ".repeat(Se)} `;yield{type:"visual_feedback",content:Yt(`${qe?`
|
|
793
794
|
`:""}${Gt}
|
|
794
|
-
`)},qe=!1}x==="exec_command"&&(await new Promise(mt=>setTimeout(mt,50)),n.onExecChunk&&n.onExecChunk(`ERROR: ${Le}`),await new Promise(mt=>setTimeout(mt,50)),n.onExecEnd&&n.onExecEnd()),ve.push({role:"user",text:`[TOOL RESULT]: DENIED: ${Le}`}),yield{type:"tool_result",content:`[TOOL RESULT]: DENIED: ${Le}`},await Ct("toolDenied"),n.onToolResult&&n.onToolResult("denied",x),ut++;continue}}if(z){let T=115;process.stdout.isTTY&&(T=process.stdout.columns-5||120);let
|
|
795
|
+
`)},qe=!1}x==="exec_command"&&(await new Promise(mt=>setTimeout(mt,50)),n.onExecChunk&&n.onExecChunk(`ERROR: ${Le}`),await new Promise(mt=>setTimeout(mt,50)),n.onExecEnd&&n.onExecEnd()),ve.push({role:"user",text:`[TOOL RESULT]: DENIED: ${Le}`}),yield{type:"tool_result",content:`[TOOL RESULT]: DENIED: ${Le}`},await Ct("toolDenied"),n.onToolResult&&n.onToolResult("denied",x),ut++;continue}}if(z){let T=115;process.stdout.isTTY&&(T=process.stdout.columns-5||120);let K=await s(),ie=!1;K&&(ie=K.trim().length>0);let ue=Math.min(z.length+4,T),xe=`${z.padEnd(ue-2).substring(0,ue-2)}`;yield{type:"visual_feedback",content:Yt(`${qe?`
|
|
795
796
|
`:""}${xe}${z.includes("\u2714")&&(z.includes("Created")||z.includes("Edited"))?"":`${ie?"":`
|
|
796
|
-
`}`}`)},qe=!1}if(Ge>0){let T=Date.now()-Ge,
|
|
797
|
+
`}`}`)},qe=!1}if(Ge>0){let T=Date.now()-Ge,K=Math.max(0,1e3-T);K>0&&await new Promise(ie=>setTimeout(ie,K))}let Rn={chatId:p,history:t,onChunk:T=>n.onExecChunk?n.onExecChunk(T):null,onAskUser:n.onAskUser,systemSettings:n.systemSettings,mode:a,isMultiModal:ft(Te),onVisualFeedback:n.onVisualFeedback,onSubagentUpdate:n.onSubagentUpdate,onTokenChunk:n.onTokenChunk,modelName:Te,aiProvider:n.aiProvider,apiKey:n.apiKey,onUsage:n.onUsage};if(x==="write_file"||x==="update_file")try{let{path:T}=re(F.args);if(T){let K=te.resolve(process.cwd(),T),ie=await Hn();ie&&ie.file_focused===K&&ie.full_content&&(Rn.forcedContent=ie.full_content)}}catch{}Qe.push(x);let $e=await yo(x,F.args,Rn);if((x==="write_file"||x==="update_file")&&$e.startsWith("SUCCESS")){let{path:T}=re(F.args);if(T){let K=te.resolve(process.cwd(),T);Nr(K)}}process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07");let Ft=Date.now();Ge=Ft,yield{type:"tool_time",content:Ft-Q},j=Ft;let Ht=null;if(typeof $e=="object"&&$e.binaryPart&&(Ht=$e.binaryPart,$e=$e.text),x==="search_keyword"){let{keyword:T,path:K}=re(F.args),ie=typeof $e=="string"&&$e.startsWith("[GLOB]");ie&&($e=$e.slice(6).trimStart());let ue=typeof $e=="string"&&$e.startsWith("[DIR]");ue&&($e=$e.slice(5).trimStart());let xe=0;if($e){let ge=$e.match(/Found (\d+) match/i);ge&&(xe=parseInt(ge[1]))}let Ue=(K||"").trim().toLowerCase().replaceAll("\\","/"),De=Ue==="#doc"||Ue==="#docs"||Ue==="#documentation"||Ue.includes("#skill/global/fluxflow")||Ue.includes("#skill/fluxflow")||Ue.includes("#skills/fluxflow")||Ue.includes("#skills/global/fluxflow"),Ce,q=115;process.stdout.isTTY&&(q=process.stdout.columns-5||120);let le=Math.max(10,(q+5)/3),fe=Math.max(10,(q+5)/4);if(De)Ce=`${T?"\u2714":"\u2718"} Searched Documentation`;else{let ge=K?K.replace(/[\/\\]+$/,""):null,St=ge&&ge!=="."?`"${ie?K:ue?`${ge}/*`:ge}"`:"./",Le=St.length>fe?`${St.slice(0,fe)}...`:St;Ce=`${T?"\u2714":"\u2718"} Searched: "${T?T.length>q/2?`${T.slice(0,le)}...`:T:""}" in ${Le.replaceAll("\\","/")} \u2192 ${xe} Match${xe===1?"":"es"}`}let Ke=Math.min(Ce.length+4,q),Je=`${Ce.padEnd(Ke-2).substring(0,Ke-2)}`;yield{type:"visual_feedback",content:Yt(`${qe?`
|
|
797
798
|
`:""}${Je}
|
|
798
|
-
`)},qe=!1}if(x==="EmergencyRollback"){let{method:T}=re(F.args);if(T==="forceRevert"){let
|
|
799
|
+
`)},qe=!1}if(x==="EmergencyRollback"){let{method:T}=re(F.args);if(T==="forceRevert"){let K=0;if($e){let le=$e.match(/Total\s*:\s*(\d+)/i);le&&(K=parseInt(le[1]))}let ue=$e&&$e.startsWith("ERROR:")?"\u2718 Emergency Rollback Failed":`\u2714 Emergency Rollback \u2192 ${K} file${K===1?"":"s"} processed`,xe=115;process.stdout.isTTY&&(xe=process.stdout.columns-5||120);let Ue=await s(),De=!1;Ue&&(De=Ue.trim().length>0);let Ce=Math.min(ue.length+4,xe),q=`${ue.padEnd(Ce-2).substring(0,Ce-2)}`;yield{type:"visual_feedback",content:Yt(`${qe?`
|
|
799
800
|
`:""}${q}${De?"":`
|
|
800
|
-
`}`)},qe=!1}}if(x==="todo"){let{method:T,tasks:
|
|
801
|
-
`)}return Ce.filter(q=>String(q).trim()).map(q=>{let le=String(q).trim();return le.startsWith("- [")?le.substring(6).trim():le})};if(T==="create"?(ue="\x1B[32m\u2192\x1B[0m Created Goals",xe=Ue(
|
|
801
|
+
`}`)},qe=!1}}if(x==="todo"){let{method:T,tasks:K,markDone:ie}=re(F.args),ue="",xe=[],Ue=De=>{if(!De)return[];let Ce=Array.isArray(De)?De:[];if(Ce.length===0&&typeof De=="string"){let q=De.trim();if(q.startsWith("[")&&q.endsWith("]")){let le=q.match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/g);le?Ce=le.map(fe=>fe.slice(1,-1).replace(/\\(.)/g,"$1")):Ce=q.slice(1,-1).split(",").map(fe=>fe.trim()).filter(Boolean)}else Ce=De.split(`
|
|
802
|
+
`)}return Ce.filter(q=>String(q).trim()).map(q=>{let le=String(q).trim();return le.startsWith("- [")?le.substring(6).trim():le})};if(T==="create"?(ue="\x1B[32m\u2192\x1B[0m Created Goals",xe=Ue(K).map(De=>`\x1B[90m\u25CB\x1B[0m ${De}`)):T==="append"?(ue="\x1B[34m\u2795\x1B[0m Added New Goals",xe=Ue(K).map(De=>`\x1B[90m\u25CB\x1B[0m ${De}`)):T==="get"&&(ue=ie?"\x1B[36m\u21BB\x1B[0m Updated Goals":"\x1B[35m\u2022\x1B[0m Reviewed Goals",xe=($e||"").split(`
|
|
802
803
|
`).slice(1).join(`
|
|
803
804
|
`).split(`
|
|
804
805
|
`).filter(Ce=>Ce.trim().startsWith("- [")).map(Ce=>{let q=Ce.trim(),le=q.startsWith("- [x]");return`${le?"\x1B[32m\u2714\x1B[0m":"\x1B[90m\u25CB\x1B[0m"} ${le?"\x1B[90m":"\x1B[37m"}${q.substring(6).trim()}\x1B[0m`})),ue&&xe.length>0){let De=[`${ue}`,...xe.map(le=>` ${le}`)].join(`
|
|
805
806
|
`),Ce=await s(),q=!1;Ce&&(q=Ce.trim().length>0),yield{type:"visual_feedback",content:Yt(`${qe?`
|
|
806
807
|
`:""}${De}${q?"":`
|
|
807
808
|
`}`)},qe=!1}}x==="exec_command"&&n.onExecEnd&&(await new Promise(T=>setTimeout(T,800)),n.onExecEnd());let hn=$e&&$e.startsWith("DENIED:");$e&&!$e.startsWith("ERROR:")&&!hn?(await Ct("toolSuccess"),n.onToolResult&&n.onToolResult("success",x)):hn||(await Ct("toolFailure"),n.onToolResult&&n.onToolResult("failure",x));let Bt=($e||"").toString().replaceAll("[UI_CONTEXT]","");Bt.includes("[[VERIFIED]]")&&(Bt=Bt.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to conserve context.
|
|
808
|
-
`));let mn;if(Bt.startsWith("[[SAME]]")){let
|
|
809
|
-
`):
|
|
809
|
+
`));let mn;if(Bt.startsWith("[[SAME]]")){let K=Bt.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),ie=K.filter(xe=>xe.startsWith("SUCCESS:")||xe.trim().startsWith("- Stats:"));mn=`[TOOL RESULT]: ${ie.length>0?ie.join(`
|
|
810
|
+
`):K.slice(0,2).join(`
|
|
810
811
|
`)}
|
|
811
812
|
[SYSTEM NOTE]: Content verified and persisted to disk. Full preview omitted to conserve context.`}else mn=`[TOOL RESULT]: ${Bt}`;ve.push({role:"user",text:mn,binaryPart:Ht}),_n=!0;let Ne=`[TOOL RESULT]: ${$e.replaceAll(`[[VERIFIED]]
|
|
812
813
|
`,"").replaceAll(`
|
|
813
|
-
[[/VERIFIED]]`,"")||""}`;(x==="view_file"||x==="web_scrape"||x==="file_map")&&(Ne=`[TOOL RESULT]: ${z} (Context Locked for UI Clarity)`),yield{type:"tool_result",content:Ne,aiContent:mn,binaryPart:Ht,toolName:x},x==="memory"&&$e.includes("SUCCESS")&&(yield{type:"memory_updated"}),ut++}if(i==="Google"&&cn&&Date.now()-hs>=150){yield*Nn();let F=no(cn);for(let Q of F)yield Q;cn="",hs=Date.now()}}I.usageMetadata&&(en=I.usageMetadata),en&&(yield{type:"liveTokens",content:en.totalTokenCount})}if(me&&(me=!1,Ot?Ze+="</think>":(we+="</think>",i==="Google"?cn+="</think>":yield{type:"text",content:"</think>"})),Ot&&Ze.length>0){let I=0,Y=Math.min(yt.length,Ze.length);for(let
|
|
814
|
+
[[/VERIFIED]]`,"")||""}`;(x==="view_file"||x==="web_scrape"||x==="file_map")&&(Ne=`[TOOL RESULT]: ${z} (Context Locked for UI Clarity)`),yield{type:"tool_result",content:Ne,aiContent:mn,binaryPart:Ht,toolName:x},x==="memory"&&$e.includes("SUCCESS")&&(yield{type:"memory_updated"}),ut++}if(i==="Google"&&cn&&Date.now()-hs>=150){yield*Nn();let F=no(cn);for(let Q of F)yield Q;cn="",hs=Date.now()}}I.usageMetadata&&(en=I.usageMetadata),en&&(yield{type:"liveTokens",content:en.totalTokenCount})}if(me&&(me=!1,Ot?Ze+="</think>":(we+="</think>",i==="Google"?cn+="</think>":yield{type:"text",content:"</think>"})),Ot&&Ze.length>0){let I=0,Y=Math.min(yt.length,Ze.length);for(let V=Y;V>0;V--)if(yt.endsWith(Ze.substring(0,V))){I=V;break}let N=Ze.substring(I);if(N){let J=/(?:<(think|thought)>|\[(think|thought)\])(?:(?!(?:<\/(?:think|thought)>|\[\/(?:think|thought)\]))[\s\S])*$/i.test(yt)?N.replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])\s*/gi,""):N.replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])[\s\S]*?(?:<\/(think|thought)>|\[\/(think|thought)\])\s*/gi,"").replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])\s*/gi,"");if(J)if(we+=J,i==="Google")cn+=J;else{yield*Nn();let ce=no(J);for(let se of ce)yield se}}Ot=!1,Ze=""}if(yield*Nn(),bt)break;let oo=(we||"").trim(),aa=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(oo.toLowerCase())||/\[\[END\]\]/i.test(oo.toLowerCase()),la=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(oo.toLowerCase()),ca=ve.length>0||Ye!==null,ms=qt(oo).trim(),da=/(\p{Emoji_Presentation}|\p{Extended_Pictographic})$/u.test(ms),fa=/([.!?"'*_`|\]\)”’~~]+|\s|`{3}|[\u200B-\u200D\uFEFF])$/u.test(ms.trim()),ua=/[.!?}"'`’“”]$|```$/s.test(ms)||fa||da;!aa&&!la&&!ca&&oo.length>0,st=!0,await Ct("agent",i)}catch(_e){if(bt){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
|
|
814
815
|
|
|
815
816
|
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(String(_e).includes("Incomplete JSON segment at the end")){me&&(me=!1,Ot?Ze+="</think>":(we+="</think>",yield{type:"text",content:"</think>"})),st=!0,await Ct("agent",i);break}if(me&&(me=!1,Ot?Ze+="</think>":we+="</think>"),Ot&&Ze.length>0){let $t=0,At=Math.min(yt.length,Ze.length);for(let Dt=At;Dt>0;Dt--)if(yt.endsWith(Ze.substring(0,Dt))){$t=Dt;break}let wt=Ze.substring($t);if(wt){let gt=/(?:<(think|thought)>|\[(think|thought)\])(?:(?!(?:<\/(?:think|thought)>|\[\/(?:think|thought)\]))[\s\S])*$/i.test(yt)?wt.replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])\s*/gi,""):wt.replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])[\s\S]*?(?:<\/(think|thought)>|\[\/(think|thought)\])\s*/gi,"").replace(/^\s*(?:<(think|thought)>|\[(think|thought)\])\s*/gi,"");gt&&(we+=gt)}Ot=!1,Ze=""}let ee=_e instanceof Error?(()=>{try{return JSON.parse(JSON.parse(_e.message).error.message).error.message}catch{return String(_e)}})():String(_e),Pt=new Date().toLocaleString(),It=te.join(Mn,"agent");He.existsSync(It)||He.mkdirSync(It,{recursive:!0}),He.appendFileSync(te.join(It,"error.log"),`ERROR [${Pt}]: ${ee}
|
|
816
817
|
|
|
@@ -825,7 +826,7 @@ ${xs}`}let ot=x==="write_file"?"Created":"Edited",ct=re(F.args),pn=Object.entrie
|
|
|
825
826
|
|
|
826
827
|
${At}`}):r.push(wt)}):r.push({role:"user",text:At}),yt+=we}for(let At=$t/1e3;At>0&&!bt;At--)yield{type:"status",content:`Error Occured. Recovering Stream (${rt}/${rn}) [Retrying in ${At.toFixed(0)}s]...`},await new Promise(wt=>setTimeout(wt,1e3));yield{type:"status",content:"Error Occured. Recovering Stream..."}}else throw new Error(`Stream collapsed too many times. (Failed to resolve ${rn} times)
|
|
827
828
|
Error log can be found in \`/export logs\``);else if(tt<=rn){tt++,rt=1,yt="";let $t=Math.min(1e3*Math.pow(2,tt-1),32e3),At=.8+Math.random()*.4,wt=Math.round($t*At);eo=!0,yield{type:"status",content:`Trying to reach ${e} (${tt}/${rn}) [Retrying in ${(wt/1e3).toFixed(0)}s]`};for(let Dt=wt/1e3;Dt>0&&!bt;Dt--)yield{type:"status",content:`Trying to reach ${e} (${tt}/${rn}) [Retrying in ${Dt.toFixed(0)}s]`},await new Promise(gt=>setTimeout(gt,1e3));yield{type:"status",content:`Trying to reach ${e}`}}else throw new Error(`Model ${e} cannot be reached. (Failed ${rn} times)
|
|
828
|
-
Error log can be found in \`/export logs\``)}}if(en){let me=en.totalTokenCount||0,_e=en.cachedContentTokenCount||0,ee=(en.candidatesTokenCount||0)+(i==="Google"&&en.thoughtsTokenCount||0);await Ut("tokens",me,i,Te),_e>0&&await Ut("cachedTokens",_e,i,Te),ee>0&&await Ut("candidateTokens",ee,i,Te),Do({provider:i,model:Te,prompt:en.promptTokenCount||0,cached:_e,output:ee,reasoning:en.thoughtsTokenCount||0}),yield{type:"usage",content:en}}we=Jr(we),gs.push(we);let En=qt(we),Pn=
|
|
829
|
+
Error log can be found in \`/export logs\``)}}if(en){let me=en.totalTokenCount||0,_e=en.cachedContentTokenCount||0,ee=(en.candidatesTokenCount||0)+(i==="Google"&&en.thoughtsTokenCount||0);await Ut("tokens",me,i,Te),_e>0&&await Ut("cachedTokens",_e,i,Te),ee>0&&await Ut("candidateTokens",ee,i,Te),Do({provider:i,model:Te,prompt:en.promptTokenCount||0,cached:_e,output:ee,reasoning:en.thoughtsTokenCount||0}),yield{type:"usage",content:en}}we=Jr(we),gs.push(we);let En=qt(we),Pn=Vr(we),gn=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(Pn.toLowerCase())||/\[\[END\]\]/i.test(Pn.toLowerCase())||!0,rl=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(Pn.toLowerCase()),al=ut>0;yield{type:"status",content:"Thinking"};let oa=el(we,/(\[\s*(turn\s*:)?\s*(continue|finish)\s*\]|\[\[END\]\])/gi,"").trim(),$n=(gn||ve.length===0)&&!Mt&&!ln&&!An;if($n=ve.length===0?$n:!1,$n=Lt||_o?!1:$n,we&&we.trim().endsWith('")]')&&ve.length===0&&($n=!1),$n){pi=!0;let me=gs.join(`
|
|
829
830
|
`),_e=qt(me).trim();yield{type:"interactive_turn_finished",data:{agentText:d,fullAgentTextRaw:me,history:[...r],needTitle:w}},r.length>0&&r[r.length-1].role==="agent"?r[r.length-1].text=_e:r.push({role:"agent",text:_e}),r.forEach(ee=>{if(ee.role==="user"&&ee.text&&(ee.text=ee.text.replace(/\n\[COMPILE ERROR\][\s\S]*?\[\/ERROR\]/g,""),ee.text=ee.text.replaceAll(`
|
|
830
831
|
|
|
831
832
|
[system] user question. resolve this specific query within '[ANSWER] ... [/ANSWER]' concisely, naturally [/system]
|
|
@@ -838,7 +839,7 @@ Error log can be found in \`/export logs\``)}}if(en){let me=en.totalTokenCount||
|
|
|
838
839
|
|
|
839
840
|
`),Pt=(qt(we).replace(/\[{1,2}tool:[\s\S]*?\)\s*\]{1,2}/gi,"").match(/\[tool:/gi)||[]).length,It=ve.length+Pt;if(ve.length<It){me+=`
|
|
840
841
|
|
|
841
|
-
[system] Only ${ve.length} out of ${It} attempted tool calls were executed. Verify proper structure compliance & try failed calls again [/system]`;let Xt=It-ve.length;for(let
|
|
842
|
+
[system] Only ${ve.length} out of ${It} attempted tool calls were executed. Verify proper structure compliance & try failed calls again [/system]`;let Xt=It-ve.length;for(let Ve=0;Ve<Xt;Ve++)await Ct("toolFailure")}let _t=ve.find(Xt=>Xt.binaryPart)?.binaryPart||null;r.push({role:"user",text:me,binaryPart:_t})}}else if(!bt){let _e=(we.replace(/(?:<(think|thought|thoughts)>|\[(think|thought|thoughts)\])[\s\S]*?(?:<\/(think|thought|thoughts)>|\[\/(think|thought|thoughts)\]|$)/i,"").match(/\[tool:/gi)||[]).length;_o||Lt||_e>0?(r.push({role:"user",text:`[system] Failed to execute ${_e} tool${_e>1?"s":""}. Verify proper structure compliance & try again [/system]`}),await Ct("toolFailure"),yield{type:"visual_feedback",content:`
|
|
842
843
|
${Yt("\u2718 Execution Error")}
|
|
843
844
|
`}):(yield{type:"visual_feedback",content:`
|
|
844
845
|
${Yt("\u2718 Loop Detected")}
|
|
@@ -893,9 +894,9 @@ Main focus: tools and task, not chatting
|
|
|
893
894
|
On completion, provide a detailed summary in Tables/Markdown Format with file modified info. If any task failed report back in detail
|
|
894
895
|
|
|
895
896
|
Current Time: ${h}
|
|
896
|
-
=== END SYSTEM PROMPT ===`,$=[{role:"user",text:`Complete this task: ${e}`}],w=0,d="";for(;w<o;){let C=await Ss("subagent",y);if(!C.allowed)throw new Error(C.reason||`Budget Exhausted for Provider (${y?.aiProvider||"Subagent"})`);if(bt){if(t?.taskId&&typeof
|
|
897
|
+
=== END SYSTEM PROMPT ===`,$=[{role:"user",text:`Complete this task: ${e}`}],w=0,d="";for(;w<o;){let C=await Ss("subagent",y);if(!C.allowed)throw new Error(C.reason||`Budget Exhausted for Provider (${y?.aiProvider||"Subagent"})`);if(bt){if(t?.taskId&&typeof Vt<"u"){let L=Vt.find(B=>B.id===t.taskId);L&&(L.status="cancelled")}throw c&&c("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}if(t?.taskId&&typeof Vt<"u"){let L=Vt.find(B=>B.id===t.taskId);if(L&&L.status==="cancelled")throw c&&c("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}let f=$.map(L=>({role:L.role==="user"?"user":"model",parts:[{text:L.text}]}));c&&c(`[Subagent Turn ${w+1}]...`);let r=["Fast","Low","Medium","High"],A=process.env.SUBAGENT_THINKING,M=r.includes(A)?A:"Low",D=(await as(y,P,f,R,M)).text||"",O=Jr(qt(D).trim());d=O,c&&c(`[Subagent Response]
|
|
897
898
|
${O}
|
|
898
|
-
`),$.push({role:"agent",text:O});let ae=ko(O);if(ae.length===0)break;let de=ae.filter(L=>L.toolName.toLowerCase()==="askmain"||L.toolName.toLowerCase()==="ask_main"),X=!1,be="";for(let L of ae){if(bt){if(t?.taskId&&typeof
|
|
899
|
+
`),$.push({role:"agent",text:O});let ae=ko(O);if(ae.length===0)break;let de=ae.filter(L=>L.toolName.toLowerCase()==="askmain"||L.toolName.toLowerCase()==="ask_main"),X=!1,be="";for(let L of ae){if(bt){if(t?.taskId&&typeof Vt<"u"){let U=Vt.find(G=>G.id===t.taskId);U&&(U.status="cancelled")}throw new Error("Subagent task was cancelled.")}if(t?.taskId&&typeof Vt<"u"){let U=Vt.find(G=>G.id===t.taskId);if(U&&U.status==="cancelled")throw new Error("Subagent task was cancelled.")}let B=L.toolName.toLowerCase();if(B==="askuser"&&(B="ask"),B==="askmain"||B==="ask_main"){if(X)continue;X=!0;let U="";if(de.length===1?U=re(de[0].args).question||de[0].args:U=de.map((G,ke)=>{let Ae=re(G.args);return`Q${ke+1}: ${Ae.question||G.args}`}).join(`
|
|
899
900
|
`),t.onAskMain){c&&c(`[Executing Tool] AskMain("${U}")...`);let G=await t.onAskMain(U);c&&c(`[Tool Result]
|
|
900
901
|
Answer from Main Agent: ${G}
|
|
901
902
|
`),be+=`[TOOL RESULT for AskMain]: Answer from Main Agent: ${G}
|
|
@@ -908,7 +909,7 @@ Answer from Main Agent: ${G}
|
|
|
908
909
|
`;continue}if(B==="exec_command"||B==="execcommand"||B==="run"){let U=re(L.args).command||"",G=_(U);if(!G.allowed){let ke=`ERROR: [SECURITY RESTRICTION] Subagent execution blocked command: ${G.reason}`;c&&c(`[Blocked Command] ${U} - ${G.reason}
|
|
909
910
|
`),be+=`${ke}
|
|
910
911
|
|
|
911
|
-
`;continue}}let Z="";if(B==="web_search"||B==="websearch")Z=`\u2714 \x1B[95mSearched\x1B[0m: ${re(L.args).query||""}`;else if(B==="web_scrape"||B==="webscrape")Z=`\u2714 \x1B[95mScraped\x1B[0m: ${re(L.args).url||""}`;else if(B==="search_keyword"||B==="searchkeyword"||B==="codesearch"||B==="code_search"){let U=re(L.args),G=U.keyword||"",ke=U.path||"";Z=`${G?"\u2714":"\u2718"} \x1B[95mSearched\x1B[0m: ${G||"No Query"}${ke?` \u2192 ${ke.replaceAll("\\","/")}`:""}`}else if(B==="view_file"||B==="viewfile"||B==="readfile")Z=`\u2714 \x1B[95mRead\x1B[0m: ${(re(L.args).path||"").replaceAll("\\","/")}`;else if(B==="list_files"||B==="read_folder"||B==="readfolder"){let U=re(L.args).path||null,G=re(L.args).recurse||0;Z=`${U?"\u2714":"\u2718"} \x1B[95mBrowsed\x1B[0m: ${U?`${U.replaceAll("\\","/")}${G>0?`${U.endsWith("/")?`*${G}`:`/*${G}`}`:`${U.endsWith("/")?"":"/"}`}`:""}`}else if(B==="write_file"||B==="writefile"){let U=re(L.args).path||null;Z=`${U?"\u2714":"\u2718"} \x1B[95mCreated\x1B[0m: ${U?`${U.replaceAll("\\","/")}`:"No File Changes"}`}else if(B==="update_file"||B==="updatefile"||B==="patchfile"||B==="patch_file"){let U=re(L.args),G=U.path||null,Ae=Object.entries(U).some(([Re,Oe])=>Re.startsWith("searchContent")&&typeof Oe=="string"&&Oe.startsWith("^LINE:"))?"\u1361":":";Z=`${G?"\u2714":"\u2718"} \x1B[95mEdited\x1B[0m${Ae} ${G?`${G.replaceAll("\\","/")}`:"No File Changes"}`}else if(B==="exec_command"||B==="execcommand"||B==="run"){let U=re(L.args).command||null;Z=`${U?"\u2714":"\u2718"} \x1B[95mExecuted\x1B[0m: ${U?U.slice(0,100)+(U.length>100?"...":""):"No Command"}`}else if(B==="file_map"||B==="filemap"){let U=re(L.args).path||"";Z=`${U?"\u2714":"\u2718"} \x1B[95mIndexed\x1B[0m: ${U?`${U.replaceAll("\\","/")}`:"File Not Found"}`}else if(B==="await"){let{time:U}=re(L.args),G=parseFloat(U)||0;G<10&&(G=10),G>180&&(G=180),Z=`\u2714 \x1B[95mAwaiting\x1B[0m \u2192 ${(Ae=>{if(Ae>=60){let Re=Math.floor(Ae/60),Oe=Ae%60;return`${Re}m${Oe>0?` ${Oe}s`:""}`}return`${Ae}s`})(G)}`}else{let U=ni[B]||L.toolName,G=
|
|
912
|
+
`;continue}}let Z="";if(B==="web_search"||B==="websearch")Z=`\u2714 \x1B[95mSearched\x1B[0m: ${re(L.args).query||""}`;else if(B==="web_scrape"||B==="webscrape")Z=`\u2714 \x1B[95mScraped\x1B[0m: ${re(L.args).url||""}`;else if(B==="search_keyword"||B==="searchkeyword"||B==="codesearch"||B==="code_search"){let U=re(L.args),G=U.keyword||"",ke=U.path||"";Z=`${G?"\u2714":"\u2718"} \x1B[95mSearched\x1B[0m: ${G||"No Query"}${ke?` \u2192 ${ke.replaceAll("\\","/")}`:""}`}else if(B==="view_file"||B==="viewfile"||B==="readfile")Z=`\u2714 \x1B[95mRead\x1B[0m: ${(re(L.args).path||"").replaceAll("\\","/")}`;else if(B==="list_files"||B==="read_folder"||B==="readfolder"){let U=re(L.args).path||null,G=re(L.args).recurse||0;Z=`${U?"\u2714":"\u2718"} \x1B[95mBrowsed\x1B[0m: ${U?`${U.replaceAll("\\","/")}${G>0?`${U.endsWith("/")?`*${G}`:`/*${G}`}`:`${U.endsWith("/")?"":"/"}`}`:""}`}else if(B==="write_file"||B==="writefile"){let U=re(L.args).path||null;Z=`${U?"\u2714":"\u2718"} \x1B[95mCreated\x1B[0m: ${U?`${U.replaceAll("\\","/")}`:"No File Changes"}`}else if(B==="update_file"||B==="updatefile"||B==="patchfile"||B==="patch_file"){let U=re(L.args),G=U.path||null,Ae=Object.entries(U).some(([Re,Oe])=>Re.startsWith("searchContent")&&typeof Oe=="string"&&Oe.startsWith("^LINE:"))?"\u1361":":";Z=`${G?"\u2714":"\u2718"} \x1B[95mEdited\x1B[0m${Ae} ${G?`${G.replaceAll("\\","/")}`:"No File Changes"}`}else if(B==="exec_command"||B==="execcommand"||B==="run"){let U=re(L.args).command||null;Z=`${U?"\u2714":"\u2718"} \x1B[95mExecuted\x1B[0m: ${U?U.slice(0,100)+(U.length>100?"...":""):"No Command"}`}else if(B==="file_map"||B==="filemap"){let U=re(L.args).path||"";Z=`${U?"\u2714":"\u2718"} \x1B[95mIndexed\x1B[0m: ${U?`${U.replaceAll("\\","/")}`:"File Not Found"}`}else if(B==="await"){let{time:U}=re(L.args),G=parseFloat(U)||0;G<10&&(G=10),G>180&&(G=180),Z=`\u2714 \x1B[95mAwaiting\x1B[0m \u2192 ${(Ae=>{if(Ae>=60){let Re=Math.floor(Ae/60),Oe=Ae%60;return`${Re}m${Oe>0?` ${Oe}s`:""}`}return`${Ae}s`})(G)}`}else{let U=ni[B]||L.toolName,G=Kn(B,L.args);Z=`\u2714 \x1B[95m${U}\x1B[0m${G?`: ${G}`:""}`}t.onVisualFeedback&&Z&&t.onVisualFeedback(Z),c&&c(`[Executing Tool] ${L.toolName}(${L.args})...`);try{let U=await yo(L.toolName,L.args,{...t,mode:"Flux"});if(c&&c(`[Tool Result]
|
|
912
913
|
${U}
|
|
913
914
|
`),be+=`[TOOL RESULT for ${L.toolName}]: ${U}
|
|
914
915
|
|
|
@@ -917,6 +918,6 @@ ${U}
|
|
|
917
918
|
`)){if(Oe.includes("Old File contents:")){Re=!0;continue}Re&&(Oe.trim()===""?Re=!1:/^\d+ \|/.test(Oe)&&Ae++)}}(ke>0||Ae>0)&&(await Ut("linesAdded",ke),await Ut("linesRemoved",Ae))}}catch(U){let G=`ERROR: Execution failed for [${L.toolName}]: ${U.message}`;c&&c(`[Tool Error] ${G}
|
|
918
919
|
`),be+=`${G}
|
|
919
920
|
|
|
920
|
-
`,await Ct("toolFailure")}}let ne="";if(t?.taskId&&typeof
|
|
921
|
+
`,await Ct("toolFailure")}}let ne="";if(t?.taskId&&typeof Vt<"u"){let L=Vt.find(B=>B.id===t.taskId);if(L&&L.pendingSteerMessages&&L.pendingSteerMessages.length>0){let B=[...L.pendingSteerMessages];L.pendingSteerMessages=[];for(let Me of B)ne+=`
|
|
921
922
|
|
|
922
|
-
[STEERING INSTRUCTION FROM MAIN AGENT]: ${Me}`,c&&c(`[Subagent Steered] ${Me}`)}}let it=(be.trim()+ne).trim();$.push({role:"user",text:it}),w++}return d};export{xo as a,Lr as b,xc as c,bc as d,je as e,gl as f,hl as g,lc as h,cc as i,Tc as j,qo as k,Sc as l,
|
|
923
|
+
[STEERING INSTRUCTION FROM MAIN AGENT]: ${Me}`,c&&c(`[Subagent Steered] ${Me}`)}}let it=(be.trim()+ne).trim();$.push({role:"user",text:it}),w++}return d};export{xo as a,Lr as b,xc as c,bc as d,je as e,gl as f,hl as g,lc as h,cc as i,Tc as j,qo as k,Sc as l,Ka as m,df as n,Va as o,Ya as p,ti as q,qt as r,Kr as s,Jr as t,Xa as u,ff as v,uf as w,si as x,gf as y,hf as z,as as A,mf as B,pf as C,yf as D,xf as E};
|