fluxflow-cli 5.5.0 → 5.6.1
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 +1 -0
- package/dist/chunks/{ai-6AZZQUJJ.js → ai-JYNVZQOI.js} +1 -1
- package/dist/chunks/{answerSubagent-LFLPQQSS.js → answerSubagent-PIZJSLZN.js} +1 -1
- package/dist/chunks/{apinex-COGJR7W4.js → apinex-BN3E62ML.js} +1 -1
- package/dist/chunks/{app-SKIGDYWL.js → app-NJIF4IBP.js} +168 -168
- package/dist/chunks/ask_user-XQ423UXL.js +1 -0
- package/dist/chunks/{auto_completion-ZYVGXNQC.js → auto_completion-D5GWZ3OL.js} +1 -1
- package/dist/chunks/{awaitSubagent-ZXLUWTW7.js → awaitSubagent-KLH7CRKF.js} +1 -1
- package/dist/chunks/{cancel-C2BQ3FGV.js → cancel-2PAHCMGB.js} +1 -1
- package/dist/chunks/{chat-34HLGFEJ.js → chat-YMCO5JNQ.js} +1 -1
- package/dist/chunks/chunk-3PZTWZTT.js +1 -0
- package/dist/chunks/chunk-3WV6FIZV.js +1 -0
- package/dist/chunks/{chunk-O74INBF3.js → chunk-4CWGKQHX.js} +1 -1
- package/dist/chunks/chunk-6LM3YRRE.js +4 -0
- package/dist/chunks/{chunk-YI3O7C3D.js → chunk-DWQSI6JO.js} +1 -1
- package/dist/chunks/{chunk-H2EXH5PL.js → chunk-F7Y2KAVQ.js} +196 -198
- package/dist/chunks/{chunk-ZPSNXBWW.js → chunk-KTD4WQBO.js} +1 -1
- package/dist/chunks/{chunk-5MJKHQVE.js → chunk-KYIMFUZS.js} +1 -1
- package/dist/chunks/{chunk-5KBOEKGE.js → chunk-LTNOPF2E.js} +2 -2
- package/dist/chunks/chunk-MS7BITZ6.js +1 -0
- package/dist/chunks/{chunk-3SMC2C3F.js → chunk-QN4UHB5C.js} +1 -1
- package/dist/chunks/{click-M5D2RARW.js → click-AJIULJEH.js} +2 -2
- package/dist/chunks/coarena-SGBBHWAP.js +2 -0
- package/dist/chunks/{computer_action-N7WIG3L4.js → computer_action-FZUWM6VL.js} +1 -1
- package/dist/chunks/{custom_openai-JUCNWDKV.js → custom_openai-MM5T6QBQ.js} +1 -1
- package/dist/chunks/{drag-K5ITERVW.js → drag-73WZE3BK.js} +1 -1
- package/dist/chunks/{emergency_rollback-X55BPJ7Q.js → emergency_rollback-PHH3BKRP.js} +1 -1
- package/dist/chunks/{exec_command-QBBSYF2H.js → exec_command-22LIHPPH.js} +1 -1
- package/dist/chunks/{file_map-3YMVODEE.js → file_map-4WUEPRMI.js} +1 -1
- package/dist/chunks/{find_file-RBJ4LKPD.js → find_file-LHPOW4ZM.js} +1 -1
- package/dist/chunks/{generate_image-53KQ3EDL.js → generate_image-KIZS5HAI.js} +1 -1
- package/dist/chunks/{getProgress-4D67AF3H.js → getProgress-MJZDAMSP.js} +1 -1
- package/dist/chunks/{infron-KCX7Z3RE.js → infron-4M36NBSA.js} +1 -1
- package/dist/chunks/{invoke-GUW4734N.js → invoke-CUYY3T4Z.js} +2 -2
- package/dist/chunks/{invokeSync-2PXPUJSJ.js → invokeSync-IZESPM6H.js} +2 -2
- package/dist/chunks/{key_press-RQ32VDHR.js → key_press-T5VHXHUL.js} +1 -1
- package/dist/chunks/{keyboard_typing-BH4JHUQO.js → keyboard_typing-5L2G5AHU.js} +1 -1
- package/dist/chunks/{ollama-BJHC4S6H.js → ollama-X7ARM2CC.js} +1 -1
- package/dist/chunks/{read_folder-OJ7UWWOR.js → read_folder-BJ3HS63A.js} +1 -1
- package/dist/chunks/recapture_screen-JVNQ2Z7L.js +1 -0
- package/dist/chunks/{screen_grid-Z5JHZZKA.js → screen_grid-PHZTVWOJ.js} +1 -1
- package/dist/chunks/{scroll-IQUZ3QLU.js → scroll-KE5TNGMD.js} +1 -1
- package/dist/chunks/{search_keyword-2JQ75HEQ.js → search_keyword-SSKH6AYF.js} +1 -1
- package/dist/chunks/{secrets-OHIQHB63.js → secrets-6RUMHIWR.js} +1 -1
- package/dist/chunks/{secrets_v2-W4225MDM.js → secrets_v2-5NIKKQXX.js} +1 -1
- package/dist/chunks/{settings-Y7ODX5TH.js → settings-UL5E3OYC.js} +1 -1
- package/dist/chunks/{steerSubagent-UNAOFQZJ.js → steerSubagent-B34P33YV.js} +1 -1
- package/dist/chunks/{todo-OX7SMIKN.js → todo-3EQZ7LZM.js} +1 -1
- package/dist/chunks/{tokenharbor-2TAFOMPU.js → tokenharbor-KKGRGQXG.js} +1 -1
- package/dist/chunks/{update_file-2EZILIMQ.js → update_file-RA745RVH.js} +1 -1
- package/dist/chunks/{usage-3CNTEZUA.js → usage-MKFPGZUK.js} +1 -1
- package/dist/chunks/{usageServer-7NPU35BP.js → usageServer-JFFFEUMY.js} +8 -2
- package/dist/chunks/view_file-LWURM2CE.js +1 -0
- package/dist/chunks/{wait-RQSCCCXW.js → wait-6WFCZDO7.js} +1 -1
- package/dist/chunks/{web_search-B2XM4T5D.js → web_search-XBV7AJF7.js} +1 -1
- package/dist/chunks/{write_docx-BMIF6ZDY.js → write_docx-54LANNV2.js} +1 -1
- package/dist/chunks/{write_file-O3LLIRLR.js → write_file-6KFLPINS.js} +1 -1
- package/dist/chunks/{write_pdf-CTBFENCU.js → write_pdf-UOCME2OY.js} +1 -1
- package/dist/chunks/{xkiro-GN4FCYYQ.js → xkiro-3R4IOLSP.js} +1 -1
- package/dist/cli.js +5 -5
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/chunks/ask_user-4KTNP4MZ.js +0 -1
- package/dist/chunks/chunk-3HGLLXBK.js +0 -1
- package/dist/chunks/chunk-IWIVGFAT.js +0 -1
- package/dist/chunks/chunk-JWNCKRN6.js +0 -4
- package/dist/chunks/chunk-KQNW7DK5.js +0 -1
- package/dist/chunks/recapture_screen-YJNK64KL.js +0 -1
- package/dist/chunks/view_file-XYWGDYAY.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as er}from"./chunk-UM5SNZ6X.js";import{a as Mo}from"./chunk-NJTM7OYZ.js";import{a as
|
|
1
|
+
import{a as er}from"./chunk-UM5SNZ6X.js";import{a as Mo}from"./chunk-NJTM7OYZ.js";import{a as Ht}from"./chunk-56EJGQU3.js";import{a as tr}from"./chunk-4CWGKQHX.js";import{c as Yi,g as Xi,h as qs,i as Ys,j as Xs}from"./chunk-JMMO76HS.js";import{b as Js,c as Qs,d as Ji,f as Zs}from"./chunk-LTNOPF2E.js";import{a as di}from"./chunk-2RTYI6K3.js";import{a as O}from"./chunk-6LM3YRRE.js";import{b as zs}from"./chunk-3WV6FIZV.js";import{y as Vi}from"./chunk-3PZTWZTT.js";import{f as ci,l as $t,o as zi,p as hn,r as qi}from"./chunk-KYIMFUZS.js";import{b as li}from"./chunk-MS7BITZ6.js";import{l as it,m as ai}from"./chunk-Y6O7SAPD.js";import{c as pn,d as Ki,e as ri}from"./chunk-ZGORMZE5.js";import{a as jn,b as oi,c as ii,d as eo,e as js,k as si,l as Hi,m as Ks,r as ji,w as _o,x as Io,y as Vs,z as mn}from"./chunk-NPXJIGAI.js";import{GoogleGenAI as ya,ThinkingLevel as Ye,HarmBlockThreshold as vi,HarmCategory as Ei}from"@google/genai";var fi={xHigh:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",High:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",Medium:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",Minimal:"Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking",Off:"NO thinking. Immediate response. Verify imports, tool results & system stability"};import Jt from"fs";import an from"path";import Ya from"os";import yn from"fs";import En from"path";import mr from"fs";import Qi from"path";import{execSync as pr}from"child_process";import{fileURLToPath as Va}from"url";var nr=`# FluxFlow CLI Startup & Flags Reference
|
|
2
2
|
|
|
3
3
|
Launch command syntax:
|
|
4
4
|
fluxflow [options]
|
|
@@ -168,7 +168,7 @@ Open in chat via /settings
|
|
|
168
168
|
### 7. Miscellaneous
|
|
169
169
|
* Directory Tree Design \u2192 Modern (Saves Tokens) | Legacy (More Tokens, No extra benefit)
|
|
170
170
|
* Compact Large Tool Results \u2192 Compress large tool outputs to save tokens (model might miss subtle indentation/syntax errors)
|
|
171
|
-
* Context Length \u2192 Set usable context window size in FluxFlow. 16k, 32k, 64k, 128k, 256k, 512k, 1M. After Limit reached: Start new chat
|
|
171
|
+
* Context Length \u2192 Set usable context window size in FluxFlow. 16k, 32k, 64k, 128k, 256k (default), 512k, 1M. After Limit reached: Start new chat
|
|
172
172
|
* Auto Truncate Results \u2192 Auto-truncate tool results after task finished to save token and improve caching
|
|
173
173
|
* Image History for CU \u2192 Number of images to keep in context for Computer Use. Low / Standard / Extended
|
|
174
174
|
* Keep Reasoning Content \u2192 Keeps the exact reasoning of model in context. More tokens. Might improve planning accuracy for few models
|
|
@@ -350,7 +350,7 @@ Route sub-agent workloads to faster/cheaper models independently of the main age
|
|
|
350
350
|
`;var ur=`# FluxFlow AI Providers & Setup
|
|
351
351
|
|
|
352
352
|
## Supported Providers
|
|
353
|
-
* Gemini | NVIDIA NIM | DeepSeek | Mistral | Ollama Local/Cloud | InferX | SenseNova | Poolside | OpenRouter | AIHubMix | Experiential Labs | TokenHarbor | APInex | Infron
|
|
353
|
+
* Gemini | NVIDIA NIM | DeepSeek | Mistral | Ollama Local/Cloud | InferX | SenseNova | Poolside | OpenRouter | AIHubMix | Experiential Labs | TokenHarbor | APInex | Infron | Coarena
|
|
354
354
|
* Proxy: 9router. Can use OAuth subscription like Codex, Claude Code, GitHub Copilot etc. or any OpenAI/Anthropic API that FluxFlow dont have natively
|
|
355
355
|
* Custom: Native custom OpenAI chat completions integration, no external package needed \u2192 references/SETTINGS.md, for more details
|
|
356
356
|
|
|
@@ -431,7 +431,7 @@ Instruction for this model ID across all providers.
|
|
|
431
431
|
* Reference: Offload deep/contexual specs to **/{SKILL.md,skill-reference-folder/*.md} & reference in SKILL.md. Saves tokens
|
|
432
432
|
`;var ui="v4";try{let e=Qi.dirname(Va(import.meta.url)),t=[Qi.join(e,"../../package.json"),Qi.join(e,"../package.json")],n=!1;for(let i of t)if(mr.existsSync(i)){let o=JSON.parse(mr.readFileSync(i,"utf8"));if(o.version){ui=o.version,n=!0;break}}if(!n)try{let i=pr("fluxflow -v",{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();i&&(i.startsWith("v")||/^\d+\.\d+/.test(i))&&(ui=i,n=!0)}catch{}if(!n)try{let i=pr("curl -s --max-time 3 https://raw.githubusercontent.com/KushalRoyChowdhury/fluxflow-cli/main/package.json",{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"]}),o=JSON.parse(i);o.version&&(ui=o.version)}catch{}}catch{}var Zi={"SKILL.md":`---
|
|
433
433
|
name: fluxflow
|
|
434
|
-
description: System Generated Documentation. Read this if asked anything regarding FluxFlow Harness
|
|
434
|
+
description: System Generated Documentation. Read this if asked anything regarding FluxFlow Harness, model info
|
|
435
435
|
---
|
|
436
436
|
|
|
437
437
|
# FluxFlow, by Kushal Roy Chowdhury
|
|
@@ -454,58 +454,56 @@ Public Docs: https://fluxflow-cli.onrender.com
|
|
|
454
454
|
* Priority Instructions (AGENTS.md/FLUXFLOW.md) & Skill System \u2192 references/PLUGINS.md
|
|
455
455
|
* Agent Architecture & Memory System \u2192 references/ARCHITECTURE.md
|
|
456
456
|
|
|
457
|
-
|
|
457
|
+
Docs missing required info? Say you are not sure enough to answer. Dont give wrong info`,"references/MODES.md":fr,"references/PROVIDERS.md":ur,"references/PLUGINS.md":gr,"references/STARTUP.md":nr,"references/ENV.md":or,"references/COMMANDS.md":ir,"references/SETTINGS.md":sr,"references/TOOLS.md":rr,"references/ARCHITECTURE.md":ar,"references/SUB_AGENTS.md":lr,"references/SECURITY.md":cr,"references/IDE.md":dr};var hr=(e=null)=>{try{let t=En.join(jn,"skills","fluxflow"),n=En.join(t,"references");if(process.env.NO_DEV==="true"||process.env.NO_DEV==="1"||process.env.NO_DEV===!0||process.env.NO_INS==="true"||process.env.NO_INS==="1"||process.env.NO_INS==="true"||!1){yn.existsSync(t)&&yn.rmSync(t,{recursive:!0,force:!0});return}let o=new Set(Object.keys(Zi).map(m=>En.normalize(m))),d=(e||""||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),l=En.basename(d).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replace(/(\d)-(\d)/g,"$1.$2").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,m=>m.toUpperCase().trim());for(let[m,f]of Object.entries(Zi)){let h=En.join(t,m),p=En.dirname(h);yn.existsSync(p)||yn.mkdirSync(p,{recursive:!0});let g=f;m==="SKILL.md"&&l&&(g=g.replace(/Public Docs: [^\n]*/,`Public Docs: ${g.match(/Public Docs: ([^\n]*)/)?.[1]||""}
|
|
458
|
+
Active Model: ${l}`));let s=g.trim()+`
|
|
459
|
+
`,x=null;yn.existsSync(h)&&(x=yn.readFileSync(h,"utf8")),x!==s&&yn.writeFileSync(h,s,"utf8")}if(yn.existsSync(n)){let m=yn.readdirSync(n);for(let f of m){let h=En.normalize(En.join("references",f));if(!o.has(h)){let p=En.join(n,f);try{yn.rmSync(p,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as gi}from"ws";var Dt=null,po=!1,za="ws://localhost:56832",es=[],ho=null,ts=null,ns=null,yr="2.0.0",Tc=e=>{yr=e,xr()},os=e=>{ts=e},Ac=e=>{ns=e},xr=()=>{if(Dt||po)return;po=!0;let e=new gi(za);e.on("open",()=>{for(Dt=e,po=!1,Dt.send(JSON.stringify({command:"version",version:yr,pid:process.pid,ppid:process.ppid,cwd:process.cwd()}));es.length>0;)Dt.send(JSON.stringify(es.shift()))}),e.on("message",t=>{try{let n=JSON.parse(t.toString());n.command==="contextResponse"&&ho?(ho(n.data),ho=null):n.command==="securityResponse"&&ts?ts(n.result):n.command==="inlineComplete"?qa(n):n.command==="connectionRejected"&&ns&&ns(n)}catch{}}),e.on("error",()=>{po=!1,Dt=null}),e.on("close",()=>{po=!1,Dt=null})},Po=e=>{Dt&&Dt.readyState===gi.OPEN?Dt.send(JSON.stringify(e)):(es.push(e),po||xr())},yo=()=>Dt!==null&&Dt.readyState===gi.OPEN,qa=async e=>{let t="";try{let{generateAutoCompletion:n}=await import("./auto_completion-D5GWZ3OL.js");t=await n({prefix:e.prefix||"",suffix:e.suffix||"",fileName:e.fileName||"",language:e.language||"",recentChanges:e.recentChanges||"",clipboard:e.clipboard||""})}catch{t=""}Po({command:"inlineCompleteResponse",requestId:e.requestId,completion:t||""})},Cc=e=>{Po({command:"status",status:e})},to=()=>new Promise(e=>{if(!Dt||Dt.readyState!==gi.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}ho=e,Dt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{ho===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),ho=null)},1e3)}),wr=e=>{let{resolvedPath:t}=mn(e);Po({command:"open",filePath:t})},is=(e,t,n)=>{let{resolvedPath:i}=mn(e);Po({command:"showDiff",filePath:i,originalContent:t,modifiedContent:n})},br=(e,t)=>{let{resolvedPath:n}=mn(e);Po({command:"closeDiff",filePath:n,result:t})};var Bo=(e,t)=>{try{if(!Jt.existsSync(e))return null;let n=Array.isArray(t)?t.map(o=>o.toLowerCase()):[t.toLowerCase()],i=Jt.readdirSync(e);for(let o of n){let r=i.find(d=>d.toLowerCase()===o);if(r){let d=an.join(e,r);if(Jt.statSync(d).isFile())return d}}}catch{}return null},cs=(e,t)=>{let n=Bo(e,t);if(n)try{return Jt.readFileSync(n,"utf8")}catch{}return""},Sr=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"]),ds=(e=process.cwd(),t=0,n=8)=>{let i=[];if(t>n)return i;try{if(!Jt.existsSync(e))return i;let o=Jt.readdirSync(e,{withFileTypes:!0});for(let r of o){let d=r.name,l=an.join(e,d);if(r.isDirectory())!Sr.has(d)&&!Sr.has(d.toLowerCase())&&i.push(...ds(l,t+1,n));else if(r.isFile()){let m=d.toLowerCase();(m==="agents.md"||m==="agent.md")&&i.push(l)}}}catch{}return i},kr=(e,t=2)=>{if(!e)return"";let n=" ".repeat(t);return e.split(/\r?\n/).map(i=>n+i).join(`
|
|
460
|
+
`)},vr=()=>Bo(jn,["agents.md","agent.md"]),Er=()=>Bo(process.cwd(),["agents.md","agent.md"]),_r=()=>Bo(jn,["fluxflow.md"]),Ir=()=>Bo(process.cwd(),["fluxflow.md"]),Lo=vr(),mi=Er(),xn=ds(),Oo=_r(),No=Ir(),Tr=null,ls="",Mr=!1,Xa=e=>{if(!e||!/^<<<[\s\S]*?Identity:/m.test(e))return e;let t=e.match(/^<<<\s*\r?\n([\s\S]*?)\r?\n>>>\s*(?:\r?\n)?([\s\S]*)$/);if(!t)return e;let n=t[1],i=t[2],o=n.match(/^Identity:\s*([\s\S]*?)(?=\r?\n\s*(?:<><|>>>)|$)/m);return o&&(ls=o[1].trim(),process.env.NO_INS=!0),/<><\s*NO_INS/.test(n)&&(Mr=!0),i.trim()},Ja=()=>{Lo=vr();let e=Lo?cs(jn,["agents.md","agent.md"]).trim():"";return e.length===0?(Lo=null,""):e},Qa=()=>{if(xn=ds(),mi=Er(),!xn||xn.length===0)return"";let e=process.cwd(),t=[...xn].sort((o,r)=>{let d=an.relative(e,o).replace(/\\/g,"/"),l=an.relative(e,r).replace(/\\/g,"/"),m=!d.includes("/"),f=!l.includes("/");return m&&!f?-1:!m&&f?1:d.localeCompare(l)}),n=[],i=[];for(let o of t)try{let r=Jt.readFileSync(o,"utf8").trim();if(!r||r.length===0)continue;n.push(o);let d=an.relative(e,o).replace(/\\/g,"/");if(!d.includes("/"))i.push(kr(r,2));else{let m=an.dirname(d)+"/:";i.push(`${m}
|
|
461
|
+
${kr(r,2)}`)}}catch{}return xn=n,xn.length===0&&(mi=null),i.join(`
|
|
458
462
|
|
|
459
|
-
|
|
460
|
-
`,u=null;wn.existsSync(d)&&(u=wn.readFileSync(d,"utf8")),u!==g&&wn.writeFileSync(d,g,"utf8")}if(wn.existsSync(t)){let o=wn.readdirSync(t);for(let r of o){let d=Hn.normalize(Hn.join("references",r));if(!i.has(d)){let l=Hn.join(t,r);try{wn.rmSync(l,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as gi}from"ws";var Dt=null,ho=!1,za="ws://localhost:56832",es=[],yo=null,ts=null,ns=null,yr="2.0.0",Tc=e=>{yr=e,xr()},os=e=>{ts=e},Ac=e=>{ns=e},xr=()=>{if(Dt||ho)return;ho=!0;let e=new gi(za);e.on("open",()=>{for(Dt=e,ho=!1,Dt.send(JSON.stringify({command:"version",version:yr,pid:process.pid,ppid:process.ppid,cwd:process.cwd()}));es.length>0;)Dt.send(JSON.stringify(es.shift()))}),e.on("message",t=>{try{let n=JSON.parse(t.toString());n.command==="contextResponse"&&yo?(yo(n.data),yo=null):n.command==="securityResponse"&&ts?ts(n.result):n.command==="inlineComplete"?qa(n):n.command==="connectionRejected"&&ns&&ns(n)}catch{}}),e.on("error",()=>{ho=!1,Dt=null}),e.on("close",()=>{ho=!1,Dt=null})},Po=e=>{Dt&&Dt.readyState===gi.OPEN?Dt.send(JSON.stringify(e)):(es.push(e),ho||xr())},xo=()=>Dt!==null&&Dt.readyState===gi.OPEN,qa=async e=>{let t="";try{let{generateAutoCompletion:n}=await import("./auto_completion-ZYVGXNQC.js");t=await n({prefix:e.prefix||"",suffix:e.suffix||"",fileName:e.fileName||"",language:e.language||"",recentChanges:e.recentChanges||"",clipboard:e.clipboard||""})}catch{t=""}Po({command:"inlineCompleteResponse",requestId:e.requestId,completion:t||""})},Cc=e=>{Po({command:"status",status:e})},no=()=>new Promise(e=>{if(!Dt||Dt.readyState!==gi.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}yo=e,Dt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{yo===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),yo=null)},1e3)}),wr=e=>{let{resolvedPath:t}=hn(e);Po({command:"open",filePath:t})},is=(e,t,n)=>{let{resolvedPath:i}=hn(e);Po({command:"showDiff",filePath:i,originalContent:t,modifiedContent:n})},br=(e,t)=>{let{resolvedPath:n}=hn(e);Po({command:"closeDiff",filePath:n,result:t})};var Bo=(e,t)=>{try{if(!en.existsSync(e))return null;let n=Array.isArray(t)?t.map(o=>o.toLowerCase()):[t.toLowerCase()],i=en.readdirSync(e);for(let o of n){let r=i.find(d=>d.toLowerCase()===o);if(r){let d=Zt.join(e,r);if(en.statSync(d).isFile())return d}}}catch{}return null},cs=(e,t)=>{let n=Bo(e,t);if(n)try{return en.readFileSync(n,"utf8")}catch{}return""},Sr=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"]),ds=(e=process.cwd(),t=0,n=8)=>{let i=[];if(t>n)return i;try{if(!en.existsSync(e))return i;let o=en.readdirSync(e,{withFileTypes:!0});for(let r of o){let d=r.name,l=Zt.join(e,d);if(r.isDirectory())!Sr.has(d)&&!Sr.has(d.toLowerCase())&&i.push(...ds(l,t+1,n));else if(r.isFile()){let g=d.toLowerCase();(g==="agents.md"||g==="agent.md")&&i.push(l)}}}catch{}return i},kr=(e,t=2)=>{if(!e)return"";let n=" ".repeat(t);return e.split(/\r?\n/).map(i=>n+i).join(`
|
|
461
|
-
`)},vr=()=>Bo(Gn,["agents.md","agent.md"]),Er=()=>Bo(process.cwd(),["agents.md","agent.md"]),_r=()=>Bo(Gn,["fluxflow.md"]),Ir=()=>Bo(process.cwd(),["fluxflow.md"]),Lo=vr(),mi=Er(),bn=ds(),Oo=_r(),No=Ir(),Tr=null,ls="",Mr=!1,Xa=e=>{if(!e||!/^<<<[\s\S]*?Identity:/m.test(e))return e;let t=e.match(/^<<<\s*\r?\n([\s\S]*?)\r?\n>>>\s*(?:\r?\n)?([\s\S]*)$/);if(!t)return e;let n=t[1],i=t[2],o=n.match(/^Identity:\s*([\s\S]*?)(?=\r?\n\s*(?:<><|>>>)|$)/m);return o&&(ls=o[1].trim(),process.env.NO_INS=!0),/<><\s*NO_INS/.test(n)&&(Mr=!0),i.trim()},Ja=()=>{Lo=vr();let e=Lo?cs(Gn,["agents.md","agent.md"]).trim():"";return e.length===0?(Lo=null,""):e},Qa=()=>{if(bn=ds(),mi=Er(),!bn||bn.length===0)return"";let e=process.cwd(),t=[...bn].sort((o,r)=>{let d=Zt.relative(e,o).replace(/\\/g,"/"),l=Zt.relative(e,r).replace(/\\/g,"/"),g=!d.includes("/"),u=!l.includes("/");return g&&!u?-1:!g&&u?1:d.localeCompare(l)}),n=[],i=[];for(let o of t)try{let r=en.readFileSync(o,"utf8").trim();if(!r||r.length===0)continue;n.push(o);let d=Zt.relative(e,o).replace(/\\/g,"/");if(!d.includes("/"))i.push(kr(r,2));else{let g=Zt.dirname(d)+"/:";i.push(`${g}
|
|
462
|
-
${kr(r,2)}`)}}catch{}return bn=n,bn.length===0&&(mi=null),i.join(`
|
|
463
|
+
`).trim()},fs=()=>{Oo=_r();let e=Oo?cs(jn,["fluxflow.md"]).trim():"",t=Xa(e)?.trim()||"";return t.length===0?(Oo=null,""):t},us=()=>{No=Ir();let e=No?cs(process.cwd(),["fluxflow.md"]).trim():"";return e.length===0?(No=null,""):e},gs=Ja(),pi=Qa(),Do=fs(),Fo=us(),Ar=(e,t="",n="")=>{if(!e)return"";let i=n.toLowerCase().trim(),o=t.toLowerCase().trim(),r=an.posix.basename(o),d=i&&o?`${i}@${o}`:"",l=i&&r?`${i}@${r}`:"",m=h=>!h||!o?!1:h===o||h===r||h===d||h===l,f=[];return e.replace(/<start_provider_([^>\r\n]+)>([\s\S]*?)<end_provider_([^>\r\n]+)>/gi,(h,p,g,s)=>{if(i&&p.trim().toLowerCase()===s.trim().toLowerCase()&&p.trim().toLowerCase()===i){let I=g.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(Xe,C,P,F)=>{if(C.trim().toLowerCase()===F.trim().toLowerCase()){let G=C.trim().toLowerCase();if(m(G)){let $=P.trim();$&&f.push($)}}return""}).trim();I&&f.push(I)}return""}),e.replace(/<start_model_([^>\r\n@]+@[^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n@]+@[^>\r\n]+)>/gi,(h,p,g,s)=>{if(p.trim().toLowerCase()===s.trim().toLowerCase()){let x=p.trim().toLowerCase();if(m(x)){let I=g.trim();I&&f.push(I)}}return""}),e.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(h,p,g,s)=>{if(p.includes("@"))return"";if(p.trim().toLowerCase()===s.trim().toLowerCase()){let x=p.trim().toLowerCase();if(o&&(x===o||x===r)){let I=g.trim();I&&f.push(I)}}return""}),f.join(`
|
|
463
464
|
|
|
464
|
-
`).trim()},
|
|
465
|
-
|
|
466
|
-
`).trim()},Za=(e="",t="")=>{let n=`${e||""}@${t||""}`.toLowerCase().trim();Tr!==n&&(Tr=n,Do=fs(),Fo=us())};hr();var el=e=>{if(!e)return null;let t=e.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!t)return null;let n=t[1];if((t[2]||"").trim().length===0)return null;let o="",r="",d=n.match(/^name:\s*(.+)$/m),l=n.match(/^description:\s*(.+)$/m);return d&&(o=d[1].trim().replace(/^["']|["']$/g,"")),l&&(r=l[1].trim().replace(/^["']|["']$/g,"")),o&&r?{name:o,description:r}:null},tl=e=>{let t=[];if(!e||!en.existsSync(e))return t;let n=(i,o=0)=>{if(!(o>5))try{let r=en.readdirSync(i,{withFileTypes:!0});for(let d of r){let l=Zt.join(i,d.name),g=d.name.toLowerCase();d.isFile()?g==="skill.md"&&t.push(l):d.isDirectory()&&(o===0?(g==="skills"||g===".skills"||g==="skill"||g===".skill")&&n(l,o+1):n(l,o+1))}}catch{}};return n(e,0),t},Pr=e=>{let t=tl(e),n=[];for(let i of t)try{let o=en.readFileSync(i,"utf8"),r=el(o);r&&n.push({...r,filePath:i})}catch{}return n},$r=e=>!e||e.length===0?"":e.map(t=>`- ${t.name}: ${t.description}`).join(`
|
|
467
|
-
`),hi=Pr(Gn),yi=Pr(process.cwd()),ss=$r(hi),rs=$r(yi),Lr=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"},Or=()=>(hi||[]).filter(e=>!Lr(e)),Nr=()=>(yi||[]).filter(e=>!Lr(e)),Wc=(gs?.length>0?1:0)+(pi?.length>0?bn.length:0)+(Do?.length>0?1:0)+(Fo?.length>0?1:0)+Or().length+Nr().length,as=(e,t="Project")=>{if(!e)return"";let n=e.replace(/\\/g,"/");if(t==="Global"){let o=Ya.homedir().replace(/\\/g,"/");return n.toLowerCase().startsWith(o.toLowerCase())?"~"+n.slice(o.length):n}let i=Zt.relative(process.cwd(),e).replace(/\\/g,"/");return i.startsWith(".")?i:`./${i}`},Gc=()=>{Do=fs(),Fo=us();let e=[];Lo&&gs.length>0&&e.push({scope:"Global",path:Lo}),bn&&bn.length>0&&pi.length>0?bn.forEach(r=>{e.push({scope:"Project",path:r})}):mi&&pi.length>0&&e.push({scope:"Project",path:mi}),Oo&&Do.length>0&&e.push({scope:"Global",path:Oo}),No&&Fo.length>0&&e.push({scope:"Project",path:No});let t=Or(),n=Nr(),i=e.length+t.length+n.length;if(i===0)return`\u2726 Loaded Files & Instructions
|
|
465
|
+
`).trim()},Za=(e="",t="")=>{let n=`${e||""}@${t||""}`.toLowerCase().trim();Tr!==n&&(Tr=n,Do=fs(),Fo=us())};hr();var el=e=>{if(!e)return null;let t=e.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!t)return null;let n=t[1];if((t[2]||"").trim().length===0)return null;let o="",r="",d=n.match(/^name:\s*(.+)$/m),l=n.match(/^description:\s*(.+)$/m);return d&&(o=d[1].trim().replace(/^["']|["']$/g,"")),l&&(r=l[1].trim().replace(/^["']|["']$/g,"")),o&&r?{name:o,description:r}:null},tl=e=>{let t=[];if(!e||!Jt.existsSync(e))return t;let n=(i,o=0)=>{if(!(o>5))try{let r=Jt.readdirSync(i,{withFileTypes:!0});for(let d of r){let l=an.join(i,d.name),m=d.name.toLowerCase();d.isFile()?m==="skill.md"&&t.push(l):d.isDirectory()&&(o===0?(m==="skills"||m===".skills"||m==="skill"||m===".skill")&&n(l,o+1):n(l,o+1))}}catch{}};return n(e,0),t},Pr=e=>{let t=tl(e),n=[];for(let i of t)try{let o=Jt.readFileSync(i,"utf8"),r=el(o);r&&n.push({...r,filePath:i})}catch{}return n},$r=e=>!e||e.length===0?"":e.map(t=>`- ${t.name}: ${t.description}`).join(`
|
|
466
|
+
`),hi=Pr(jn),yi=Pr(process.cwd()),ss=$r(hi),rs=$r(yi),Lr=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"},Or=()=>(hi||[]).filter(e=>!Lr(e)),Nr=()=>(yi||[]).filter(e=>!Lr(e)),Wc=(gs?.length>0?1:0)+(pi?.length>0?xn.length:0)+(Do?.length>0?1:0)+(Fo?.length>0?1:0)+Or().length+Nr().length,as=(e,t="Project")=>{if(!e)return"";let n=e.replace(/\\/g,"/");if(t==="Global"){let o=Ya.homedir().replace(/\\/g,"/");return n.toLowerCase().startsWith(o.toLowerCase())?"~"+n.slice(o.length):n}let i=an.relative(process.cwd(),e).replace(/\\/g,"/");return i.startsWith(".")?i:`./${i}`},Gc=()=>{Do=fs(),Fo=us();let e=[];Lo&&gs.length>0&&e.push({scope:"Global",path:Lo}),xn&&xn.length>0&&pi.length>0?xn.forEach(r=>{e.push({scope:"Project",path:r})}):mi&&pi.length>0&&e.push({scope:"Project",path:mi}),Oo&&Do.length>0&&e.push({scope:"Global",path:Oo}),No&&Fo.length>0&&e.push({scope:"Project",path:No});let t=Or(),n=Nr(),i=e.length+t.length+n.length;if(i===0)return`\u2726 Loaded Files & Instructions
|
|
468
467
|
\u2800\u2800\x1B[2m\u2514\u2500\x1B[22m No instruction or skill files are currently loaded.
|
|
469
468
|
\u2800`;let o=[];return o.push(`\u2726 Loaded Files & Instructions (${i} ${i===1?"file":"files"} active)`),e.length>0&&(o.push(`
|
|
470
469
|
\x1B[1mInstructions:\x1B[22m`),e.forEach(r=>{o.push(` \u2022 [${r.scope}] ${as(r.path,r.scope)}`)})),(t?.length>0||n?.length>0)&&(o.push(`
|
|
471
470
|
\x1B[1mSkills:\x1B[22m`),t?.length>0&&t.forEach(r=>{o.push(` \u2022 [Global] \x1B[36m${r.name}\x1B[39m`),o.push(` \x1B[2m\u2514\u2500 ${as(r.filePath,"Global")}\x1B[22m`)}),n?.length>0&&n.forEach(r=>{o.push(` \u2022 [Project] \x1B[36m${r.name}\x1B[39m`),o.push(` \x1B[2m\u2514\u2500 ${as(r.filePath,"Project")}\x1B[22m`)})),o.push("\u2800"),o.join(`
|
|
472
|
-
`)},Dr=!1;(async()=>{try{let e=await li();if(Number(e?.display)===1){let{default:t}=await import("screenshot-desktop"),n=await t.listDisplays();n&&n.length>1&&(Dr=!0)}}catch{}})();var Cr=null,$o=null,Rr=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",Hc=process.env.NO_DEV||!1,nl=(e,t)=>{if(!t)return"";if(e!==Cr||$o===null){Cr=e;try{let n=
|
|
473
|
-
`):$o=""}catch(n){$o="";try{
|
|
471
|
+
`)},Dr=!1;(async()=>{try{let e=await li();if(Number(e?.display)===1){let{default:t}=await import("screenshot-desktop"),n=await t.listDisplays();n&&n.length>1&&(Dr=!0)}}catch{}})();var Cr=null,$o=null,Rr=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",Hc=process.env.NO_DEV||!1,nl=(e,t)=>{if(!t)return"";if(e!==Cr||$o===null){Cr=e;try{let n=pn(si,[]);Array.isArray(n)&&n.length>0?$o=n.map(i=>`- ${i.memory}`).join(`
|
|
472
|
+
`):$o=""}catch(n){$o="";try{Jt.mkdirSync(an.join(eo,"memory"),{recursive:!0}),Jt.appendFileSync(an.join(eo,"memory","error.txt"),`${n.message}
|
|
474
473
|
-------------------------------------------------
|
|
475
474
|
|
|
476
|
-
`)}catch{}}}return $o};var Fr=(e,t,n,i,o=!0,r=!1,d="Google",l=!1,
|
|
477
|
-
Verify imports, tool results & system stability`:t.toLowerCase()==="max"&&(s=null));let
|
|
475
|
+
`)}catch{}}}return $o};var Fr=(e,t,n,i,o=!0,r=!1,d="Google",l=!1,m,f,h=!1,p="")=>{let g=!1;process.env.forcedReasoning&&(g=!0);let s="";if(!m&&d==="Google"){let De=t;t==="Fast"&&(De="Off"),t==="Low"&&(De="Minimal"),t==="Standard"&&(De="Medium"),(t==="xHigh"||t==="Max")&&(De="xHigh"),s=fi[De]||fi.Medium}(m||d!=="Google")&&(s=fi.xHigh,t==="Fast"?s=`No thinking. Immediate response
|
|
476
|
+
Verify imports, tool results & system stability`:t.toLowerCase()==="max"&&(s=null));let x=e.instructions&&e.instructions?.length>0?`User Preferences: ${e.instructions}
|
|
478
477
|
|
|
479
478
|
`:"",I=e.nickname&&e.nickname?.length>0?`User Nickname: ${e.nickname}
|
|
480
|
-
${
|
|
479
|
+
${x.length?"":`
|
|
481
480
|
`}`:"",Xe=e.name&&e.name?.length>0?`User Name: ${e.name}
|
|
482
|
-
${I.length||
|
|
483
|
-
`}`:"",
|
|
484
|
-
${
|
|
481
|
+
${I.length||x.length?"":`
|
|
482
|
+
`}`:"",C=process.cwd(),P=e.preset,G={Sassy:"Sassy",Friendly:"Sassy, Warm & Chatty",Playful:"Playful",Efficient:"Quick, Concise & Efficient",Professional:"Professional"}[P]||null,$=nl(f,o),L=$?.length>0?`--- Saved Memories ---
|
|
483
|
+
${$}
|
|
485
484
|
|
|
486
|
-
`:"";Za(d,p);let Te=Ar(Do,p,d).trim(),Ne=[gs,Te].filter(
|
|
485
|
+
`:"";Za(d,p);let Te=Ar(Do,p,d).trim(),Ne=[gs,Te].filter(De=>De&&De.length>0).join(`
|
|
487
486
|
|
|
488
|
-
`).trim(),et=Ar(Fo,p,d).trim(),
|
|
487
|
+
`).trim(),et=Ar(Fo,p,d).trim(),w=[pi,et].filter(De=>De&&De.length>0).join(`
|
|
489
488
|
|
|
490
|
-
`).trim(),
|
|
489
|
+
`).trim(),wn=Ne.length>0||w.length>0?`--- Additional Instructions ---
|
|
491
490
|
${Ne.length>0?`-- Global --
|
|
492
|
-
${Ne}`:""}${
|
|
491
|
+
${Ne}`:""}${w.length>0?`${Ne.length>0?`
|
|
493
492
|
|
|
494
493
|
`:""}-- Project --
|
|
495
|
-
${
|
|
494
|
+
${w}`:""}
|
|
496
495
|
|
|
497
|
-
`:"",
|
|
498
|
-
${`Identity: ${ls.length>1?ls.trim():`
|
|
496
|
+
`:"",he=(()=>{let De=process.cwd().toLowerCase();if(process.platform==="win32"){let wt=process.env.SystemRoot?.toLowerCase()||"c:\\windows",Ft=process.env.ProgramFiles?.toLowerCase()||"c:\\program files",Sn=process.env["ProgramFiles(x86)"]?.toLowerCase()||"c:\\program files (x86)";return De.startsWith(wt)||De.startsWith(Ft)||De.startsWith(Sn)}else return De==="/"||["/bin","/sbin","/etc","/usr","/var","/root"].some(Ft=>De.startsWith(Ft))})(),Kt=new Date,Qt=Kt.getFullYear(),Me=Kt.toLocaleString("en-US",{month:"short"}).toUpperCase(),Z=String(Kt.getDate()).padStart(2,"0"),Ve=`${Qt} ${Me} ${Z}`,ln=process.env.I_HAVE_TOO_MUCH_MONEY==="true"||!1,In=process.env.HALLOWEEN_EEGG==="true"||!1,io=In&&Me.includes("OCT")&&(Z.includes("30")||Z.includes("31")),bn=!1;try{bn=yo()}catch{bn=!1}return`${ln?`${" ".repeat(Math.floor(Math.random()*4)+1)}`:""}=== SYSTEM PROMPT${process.cwd()==="D:\\PROJECTS\\Flux-Flow"?" (Internal testing environment, do as prompted)":""} ===
|
|
497
|
+
${`Identity: ${ls.length>1?ls.trim():`FluxFlow.${G?` ${G}`:""} CLI Assistant${In?`. ${io?"Peak ":""}Halloween Themed, Spooky`:""}`}
|
|
499
498
|
${Mr?"":`${n==="Flux"?"":n==="Flow"?"Concise, Humorous, Sarcastic":n==="ICU"?"Computer Use Capabilities. Screenshot as ground truth, analyze grid ids of target. Keyboard shortcuts > mouse clicks":"Computer Use & Workspace Capabilities. Screenshot as ground truth, analyze grid ids of target. Keyboard shortcuts > mouse clicks. Workspace Actions when faster. Focus on Productivity"}`}${Dr&&n.toLowerCase().includes("cu")?`
|
|
500
499
|
- Running on secondary screen. Opened app not visible in screenshot? Might be opened on primary. Use 'AskUser' with NO options and tell user to move app window to secondary`:""}`.trimEnd()}
|
|
501
500
|
|
|
502
|
-
- OS: ${Rr}
|
|
503
|
-
- Model: ${fn}`.trimEnd():""}
|
|
501
|
+
- OS: ${Rr}
|
|
504
502
|
- Date: ${Ve}
|
|
505
503
|
${t.toLowerCase()!=="max"&&process.env.rawReasoning!=="true"?`
|
|
506
504
|
-- REASONING GUIDANCE --
|
|
507
|
-
${d==="Mistral"||d==="Google"&&!g
|
|
508
|
-
${
|
|
505
|
+
${d==="Mistral"||d==="Google"&&!m||g?`${s.trimEnd()}
|
|
506
|
+
${g||t!=="Fast"&&(d==="Mistral"&&t==="Low"&&!m||t!=="High"&&!m)?`Critical Thinking Policy
|
|
509
507
|
Use <think_fluxflow>...</think_fluxflow> for reasoning before responding any queries`:""}
|
|
510
508
|
`:`${s.trimEnd()}`}
|
|
511
509
|
`:""}${h?"":`${t.toLowerCase()==="max"||process.env.rawReasoning==="true"?`
|
|
@@ -515,75 +513,75 @@ Use <think_fluxflow>...</think_fluxflow> for reasoning before responding any que
|
|
|
515
513
|
${Zs(n,Rr,l,d,i?.advanceRollback,i?.subAgents!==!1,!!i?.autoExec,!!i?.disableTodo,i?.preferBash!==!1)}${n==="Flux"?"":n.toLowerCase().includes("cu")?`
|
|
516
514
|
|
|
517
515
|
-- SECURITY POLICIES --
|
|
518
|
-
- Dont operate on ANY confidential/logins/captcha screens \u2192 Tell user to complete it`:""}${
|
|
516
|
+
- Dont operate on ANY confidential/logins/captcha screens \u2192 Tell user to complete it`:""}${bn?`
|
|
519
517
|
|
|
520
|
-
Reference files as
|
|
518
|
+
Reference files as file:start..end`:""}
|
|
521
519
|
=== END SYSTEM PROMPT ===${(ss.length>0||rs.length>0)&&n.toLowerCase().includes("flux")?`
|
|
522
520
|
|
|
523
521
|
- Read relevant skills before tasks, scope: global/project: Use ReadFile, path="#skills/scope?/skillName". In-skill references: path="#skills/scope?/skillName/reference-folder/*.md"`:""}
|
|
524
522
|
|
|
525
|
-
${I}${
|
|
523
|
+
${I}${x}${wn}${ss.length>0&&n.toLowerCase().includes("flux")?`-- Global Skills --
|
|
526
524
|
${ss}
|
|
527
525
|
|
|
528
526
|
`:""}${rs.length>0&&n.toLowerCase().includes("flux")?`-- Project Skills --
|
|
529
527
|
${rs}
|
|
530
528
|
|
|
531
|
-
`:""}`.trim()};var Br=()=>import("./web_search-B2XM4T5D.js").then(e=>e.web_search),Ur=()=>import("./web_scrape-SJBA3RQF.js").then(e=>e.web_scrape),Wr=()=>import("./memory-QTLQAFG7.js").then(e=>e.memory),Gr=()=>import("./chat-34HLGFEJ.js").then(e=>e.chat),Hr=()=>import("./view_file-XYWGDYAY.js").then(e=>e.view_file),jr=()=>import("./write_file-O3LLIRLR.js").then(e=>e.write_file),Kr=()=>import("./update_file-2EZILIMQ.js").then(e=>e.update_file),Vr=()=>import("./exec_command-QBBSYF2H.js").then(e=>e.exec_command),zr=()=>import("./read_folder-OJ7UWWOR.js").then(e=>e.read_folder),ms=()=>import("./ask_user-4KTNP4MZ.js").then(e=>e.ask_user),qr=()=>import("./write_pdf-CTBFENCU.js").then(e=>e.write_pdf),Yr=()=>import("./write_docx-BMIF6ZDY.js").then(e=>e.write_docx),xi=()=>import("./search_keyword-2JQ75HEQ.js").then(e=>e.search_keyword),Xr=()=>import("./generate_image-53KQ3EDL.js").then(e=>e.generate_image),wi=()=>import("./saveSummary-CVZIOQ4L.js").then(e=>e.saveSummary),Uo=()=>import("./addMemScore-U2KYMALL.js").then(e=>e.addMemScore),Jr=()=>import("./file_map-3YMVODEE.js").then(e=>e.file_map),bi=()=>import("./todo-OX7SMIKN.js").then(e=>e.todo),Qr=()=>import("./invokeSync-2PXPUJSJ.js").then(e=>e.invokeSync),ol=()=>import("./invoke-GUW4734N.js").then(e=>e.invoke),Zr=()=>import("./getProgress-4D67AF3H.js").then(e=>e.getProgress),il=()=>import("./cancel-C2BQ3FGV.js").then(e=>e.cancel),ea=()=>import("./emergency_rollback-X55BPJ7Q.js").then(e=>e.emergency_rollback),Wo=()=>import("./awaitSubagent-ZXLUWTW7.js").then(e=>e.awaitSubagent),Go=()=>import("./answerSubagent-LFLPQQSS.js").then(e=>e.answerSubagent),Si=()=>import("./steerSubagent-UNAOFQZJ.js").then(e=>e.steerSubagent),ki=()=>import("./computer_action-N7WIG3L4.js").then(e=>e.computer_action),ta=()=>import("./click-M5D2RARW.js").then(e=>e.click),na=()=>import("./drag-K5ITERVW.js").then(e=>e.drag),oa=()=>import("./scroll-IQUZ3QLU.js").then(e=>e.scroll),ps=()=>import("./keyboard_typing-BH4JHUQO.js").then(e=>e.keyboard_typing),hs=()=>import("./key_press-RQ32VDHR.js").then(e=>e.key_press),ys=()=>import("./recapture_screen-YJNK64KL.js").then(e=>e.recapture_screen),Ti=()=>import("./find_file-RBJ4LKPD.js").then(e=>e.find_file),ia=()=>import("./wait-RQSCCCXW.js").then(e=>e.wait),sa={web_search:Br,web_scrape:Ur,memory:Wr,chat:Gr,view_file:Hr,write_file:jr,update_file:Kr,exec_command:Vr,read_folder:zr,write_pdf:qr,write_docx:Yr,search_keyword:xi,generate_image:Xr,saveSummary:wi,addMemScore:Uo,file_map:Jr,todo:bi,Todo:bi,goal:bi,Goal:bi,invokeSync:Qr,invoke:ol,getProgress:Zr,cancel:il,awaitSubagent:Wo,answerSubagent:Go,steerSubagent:Si,computer_action:ki,computer_use:ki,ComputerAction:ki,ComputerUse:ki,click:ta,Click:ta,drag:na,Drag:na,scroll:oa,Scroll:oa,keyboard_typing:ps,KeyboardTyping:ps,keyboardtyping:ps,key_press:hs,KeyPress:hs,keypress:hs,recapture_screen:ys,RecaptureScreen:ys,recapturescreen:ys,invoke_sync:Qr,get_progress:Zr,await_subagent:Wo,answer_subagent:Go,steer_subagent:Si,steer:Si,Steer:Si,ask:ms,Ask:ms,AskUser:ms,WebSearch:Br,WebScrape:Ur,ReadFile:Hr,ReadFolder:zr,WriteFile:jr,PatchFile:Kr,WritePDF:qr,WriteDoc:Yr,Run:Vr,SearchKeyword:xi,CodeSearch:xi,code_search:xi,Memory:Wr,Chat:Gr,GenerateImage:Xr,saveSumary:wi,SaveSummary:wi,SaveSumary:wi,add_mem_score:Uo,AddMemScore:Uo,addMemoryScore:Uo,AddMemoryScore:Uo,FileMap:Jr,answer:Go,Answer:Go,AnswerSubagent:Go,await:Wo,Await:Wo,AwaitSubagent:Wo,EmergencyRollback:ea,emergency_rollback:ea,find_file:Ti,findFile:Ti,FindFile:Ti,findfile:Ti,wait:ia,Wait:ia},xs=async(e,t,n={})=>{let i=n.mode?n.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(h=>o.includes(h))||o==="ask",g=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(h=>o.includes(h));if(!d){if(i==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Action [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(i==="icu"){if(!g)return`ERROR: Action [${e}] is not available in Computer Use mode. ICU mode only supports Computer Use tools (Click, Drag, Scroll, KeyboardTyping, KeyPress, RecaptureScreen).`}else if(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image"))return`ERROR: Action [${e}] is not available in ${n.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let u=sa[e];if(!u){let h=["ReadFile","ReadFolder","FindFile","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Wait","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],p={read:"ReadFile",view:"ReadFile",viewfile:"ReadFile",write:"WriteFile",edit:"PatchFile",patch:"PatchFile",update:"PatchFile",updatefile:"PatchFile",exec:"Run",command:"Run",bash:"Run",shell:"Run",powershell:"Run",search:"CodeSearch",grep:"CodeSearch",find:"FindFile",findfile:"FindFile",searchkeyword:"CodeSearch",folder:"ReadFolder",ls:"ReadFolder",dir:"ReadFolder",list:"ReadFolder",ask:"AskUser",question:"AskUser",pdf:"WritePDF",docx:"WriteDoc",doc:"WriteDoc",word:"WriteDoc",screenshot:"RecaptureScreen",screen:"RecaptureScreen",recapture:"RecaptureScreen",type:"KeyboardTyping",typing:"KeyboardTyping",keyboard:"KeyboardTyping",press:"KeyPress",key:"KeyPress",todo:"Goal",task:"Goal",subagent:"Invoke",agent:"Invoke"},m=o.replace(/[^a-z0-9]/g,""),s=p[m]||null;if(!s){let I=0,Xe=O=>{let F=new Set;for(let W=0;W<O.length-1;W++)F.add(O.slice(W,W+2));return F},R=Xe(m);for(let O of h){let F=O.toLowerCase().replace(/[^a-z0-9]/g,"");if(m===F){s=O;break}let W=0;(F.includes(m)||m.includes(F))&&(W+=.6);let P=Xe(F),$=0;for(let Ae of R)P.has(Ae)&&$++;let Te=2*$/(R.size+P.size||1);W=Math.max(W,Te),W>I&&W>=.35&&(I=W,s=O)}}let w=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${w}`}try{return await(await u())(t,n)}catch(h){let p=h instanceof Error?h.message:String(h);return`ERROR: Execution failed for [${e}]: ${p}`}};var Ai=e=>{if(!e||typeof e!="string")return!1;let t=e.trim().toLowerCase();return Object.keys(sa).some(n=>n.toLowerCase()===t)};import B from"path";import xe from"fs";import xa from"os";import wa from"crypto";import{execSync as As}from"child_process";import sl from"gradient-string";var ra=["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 aa=["Beware the phantom processes.","A ghost in the shell has taken the wheel.","Blowing on the haunted cartridge...","Seven minutes in Raccoon City.","Wind's howling... in the terminal fans.","Slender Man was spotted in line 404.","The cake is a lie. The curse is real.","Don't look behind the server rack.","Exorcising memory leaks at 3 AM.","Pyramid Head reorganized your commit history.","It's dangerous to go alone! Take this flashlight.","YOU DIED. Respawning terminal session...","The Necronomicon evaluated to true.","Something wicked this way compiles.","Haunting your localhost with good vibes.","A full moon has risen over Git main.","Double, double toil and trouble; code fire burn.","Clickers heard in the directory tree.","Checking camera 2B for rogue animatronics.","The call is coming from inside the container.","Isaac Clarke is stomping on stubborn bugs.","Luigi vacuumed the ghosts out of RAM.","Trick or treat, give me clean code to greet.","Whispering incantations to the garbage collector.","Klaatu barada necktie... close enough.","Resurrecting deprecated APIs from the crypt.","The headless horseman forgot the return statement.","Castlevania whip cracking against network latency.","Slime mold crawling through the motherboard.","Carving a pixelated pumpkin into terminal history.","Burying undefined pointers in the pet sematary.","Spilling pumpkin spice on the CPU.","A vampire bat is draining system battery life.","Don't fall asleep at the keyboard tonight.","Silent Hill sirens sounding in the console.","Poltergeists rearranging terminal tabs.","Lighting the Black Flame Candle for autoExec.","Dusting cobwebs off legacy dependencies.","Here's Johnny! ...just checking build health.","Blood, sweat, and zero warnings.","The spirit box whispers: 'GIT PUSH FORCE'.","They're heeeere... in the stack trace.","It's alive! IT'S ALIVEEEE!","No merge conflicts in the graveyard.","Frankenstein's monster patched this logic.","Surviving Five Nights at Flux Flow.","Doom Slayer loading buckshot into cache.","The grim reaper spared your unused imports.","Candy corn lodged in mechanical switches.","May your latency be low and your crypt be quiet."];var la=[{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"]}],wo={Dark:{id:"Dark",name:"Dark (Default)",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",textExclusive:"#B5B8D9",textMutedExclusive:"#D4DEE7",border:"white",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#1e1e1e",highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:"#1a1a1a",codeBorder:"#444444",userMsgBg:"#444444",userMsgBorder:"#444444",userMsgText:"white",diffRemovalBg:"#250808",diffAdditionBg:"#072410",diffRemovalText:"#885555",diffAdditionText:"#558866",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#5a1818",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#185a25",diffRemovalNum:"#d96868",diffAdditionNum:"#68d98c",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},Light:{id:"Light",name:"Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"black",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#e5e5e5",highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:"#e8e8e8",codeBorder:"#b0b0b0",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:"#fce8e8",diffAdditionBg:"#e6f9e6",diffRemovalText:"#661111",diffAdditionText:"#115511",diffRemovalHighlightColor:"#440000",diffRemovalHighlightBg:"#f8b4b4",diffAdditionHighlightColor:"#003300",diffAdditionHighlightBg:"#a6ebad",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Dark":{id:"GitHub Dark",name:"GitHub Dark",text:"#c9d1d9",textMuted:"#8b949e",textDim:"#6e7681",textInverted:"#0d1117",border:"#30363d",borderMuted:"#30363d",borderDim:"#21262d",bg:void 0,cardBg:"#161b22",highlightBg:"#21262d",activeBg:"#30363d",inputBg:"#21262d",inputBorder:"#21262d",inputText:"#c9d1d9",inputPlaceholder:"#8b949e",inputPrompt:"#58a6ff",codeBg:"#0d1117",codeBorder:"#30363d",userMsgBg:"#21262d",userMsgBorder:"#21262d",userMsgText:"#c9d1d9",diffRemovalBg:"#3c1e1e",diffAdditionBg:"#11381e",diffRemovalText:"#f85149",diffAdditionText:"#3fb950",diffRemovalHighlightColor:"#ff7b72",diffRemovalHighlightBg:"#701c1c",diffAdditionHighlightColor:"#56d364",diffAdditionHighlightBg:"#116329",diffRemovalNum:"#f85149",diffAdditionNum:"#3fb950",diffRemovalPrefix:"#f85149",diffAdditionPrefix:"#3fb950",primary:"#c9d1d9",secondary:"#58a6ff",accent:"#bc8cff",success:"#3fb950",warning:"#d29922",danger:"#f85149",info:"#58a6ff",statusOn:"#58a6ff",statusOff:"#8b949e",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#2ea043","#56d364"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Light":{id:"GitHub Light",name:"GitHub Light",text:"#24292f",textMuted:"#57606a",textDim:"#6e7781",textInverted:"#ffffff",border:"#d0d7de",borderMuted:"#d0d7de",borderDim:"#e1e4e8",bg:void 0,cardBg:"#f6f8fa",highlightBg:"#eaeef2",activeBg:"#d0d7de",inputBg:"#eaeef2",inputBorder:"#eaeef2",inputText:"#24292f",inputPlaceholder:"#57606a",inputPrompt:"#0969da",codeBg:"#ffffff",codeBorder:"#d0d7de",userMsgBg:"#eaeef2",userMsgBorder:"#eaeef2",userMsgText:"#24292f",diffRemovalBg:"#ffebe9",diffAdditionBg:"#e6ffec",diffRemovalText:"#cf222e",diffAdditionText:"#1a7f37",diffRemovalHighlightColor:"#82071e",diffRemovalHighlightBg:"#ffc1c0",diffAdditionHighlightColor:"#116329",diffAdditionHighlightBg:"#acf2bd",diffRemovalNum:"#cf222e",diffAdditionNum:"#1a7f37",diffRemovalPrefix:"#cf222e",diffAdditionPrefix:"#1a7f37",primary:"#24292f",secondary:"#0969da",accent:"#8250df",success:"#1a7f37",warning:"#9a6700",danger:"#cf222e",info:"#0969da",statusOn:"#0969da",statusOff:"#57606a",logoTextAnsi:"\x1B[1;34m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#1a7f37","#2da44e"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Dark":{id:"Transparent Dark",name:"Transparent Dark",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:void 0,codeBorder:"gray",userMsgBg:"#555555",userMsgBorder:"#555555",userMsgText:"white",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#ff6666",diffAdditionText:"#66ff66",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#3a1414",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#143a14",diffRemovalNum:"#ff6666",diffAdditionNum:"#66ff66",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Light":{id:"Transparent Light",name:"Transparent Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:void 0,codeBorder:"gray",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#c02020",diffAdditionText:"#188028",diffRemovalHighlightColor:"#800000",diffRemovalHighlightBg:"#f5d0d0",diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:"#cceccc",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Synthwave 84":{id:"Synthwave 84",name:"Synthwave 84",text:"#fdfdfd",textMuted:"#a08eb7",textDim:"#705c8a",textInverted:"#1a1025",textExclusive:"#e3dcf0",textMutedExclusive:"#b9abc9",border:"#fc28a8",borderMuted:"#a21568",borderDim:"#5c0a3a",bg:void 0,cardBg:"#261b38",highlightBg:"#35254d",activeBg:"#4c3570",inputBg:"#35254d",inputBorder:"#35254d",inputText:"#fdfdfd",inputPlaceholder:"#a08eb7",inputPrompt:"#03e8fc",codeBg:"#1e142b",codeBorder:"#a21568",userMsgBg:"#35254d",userMsgBorder:"#35254d",userMsgText:"#fdfdfd",diffRemovalBg:"#471434",diffAdditionBg:"#144743",diffRemovalText:"#ff4081",diffAdditionText:"#00e5ff",diffRemovalHighlightColor:"#ff79a1",diffRemovalHighlightBg:"#6b1e4e",diffAdditionHighlightColor:"#66f5ff",diffAdditionHighlightBg:"#1e6b65",diffRemovalNum:"#ff4081",diffAdditionNum:"#00e5ff",diffRemovalPrefix:"#ff79a1",diffAdditionPrefix:"#66f5ff",primary:"#fdfdfd",secondary:"#03e8fc",accent:"#fc28a8",success:"#00e5ff",warning:"#ffc107",danger:"#ff4081",info:"#b388ff",statusOn:"#03e8fc",statusOff:"#a08eb7",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#fc28a8","#03e8fc"],toolFeedbackAnsi:"\x1B[38;2;3;232;252m"},"Forest Sprite":{id:"Forest Sprite",name:"Forest Sprite",text:"#d6e6d1",textMuted:"#95b38d",textDim:"#628059",textInverted:"#161c14",textExclusive:"#eaf2e8",textMutedExclusive:"#a9c7a2",border:"#74a862",borderMuted:"#477038",borderDim:"#2b4720",bg:void 0,cardBg:"#1f291c",highlightBg:"#2a3826",activeBg:"#3a4d35",inputBg:"#2a3826",inputBorder:"#2a3826",inputText:"#d6e6d1",inputPlaceholder:"#95b38d",inputPrompt:"#8feb73",codeBg:"#161e14",codeBorder:"#477038",userMsgBg:"#2a3826",userMsgBorder:"#2a3826",userMsgText:"#d6e6d1",diffRemovalBg:"#3b231c",diffAdditionBg:"#203b1c",diffRemovalText:"#db6242",diffAdditionText:"#59cc3f",diffRemovalHighlightColor:"#f0896c",diffRemovalHighlightBg:"#5c362a",diffAdditionHighlightColor:"#80e368",diffAdditionHighlightBg:"#305929",diffRemovalNum:"#db6242",diffAdditionNum:"#59cc3f",diffRemovalPrefix:"#f0896c",diffAdditionPrefix:"#80e368",primary:"#d6e6d1",secondary:"#8feb73",accent:"#e69835",success:"#59cc3f",warning:"#e69835",danger:"#db6242",info:"#73b4eb",statusOn:"#8feb73",statusOff:"#95b38d",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#8feb73","#e69835"],toolFeedbackAnsi:"\x1B[38;2;143;235;115m"},Spookfest:{id:"Spookfest",name:"Spookfest \u{1F383}",text:"#ffeedd",textMuted:"#e09858",textDim:"#a6622b",textInverted:"#0d0702",textExclusive:"#fff3e6",textMutedExclusive:"#d4a276",border:"#ff7518",borderMuted:"#994409",borderDim:"#592502",bg:void 0,cardBg:"#1a0c02",highlightBg:"#2a1403",activeBg:"#3d1d05",inputBg:"#261203",inputBorder:"#261203",inputText:"#ffeedd",inputPlaceholder:"#a6622b",inputPrompt:"#ff7518",codeBg:"#120701",codeBorder:"#592502",userMsgBg:"#261203",userMsgBorder:"#261203",userMsgText:"#ffeedd",diffRemovalBg:"#3d0a0a",diffAdditionBg:"#1a330a",diffRemovalText:"#ff5555",diffAdditionText:"#73e639",diffRemovalHighlightColor:"#ff2222",diffRemovalHighlightBg:"#590e0e",diffAdditionHighlightColor:"#88ff3b",diffAdditionHighlightBg:"#244d0a",diffRemovalNum:"#ff5555",diffAdditionNum:"#73e639",diffRemovalPrefix:"#ff3333",diffAdditionPrefix:"#88ff3b",primary:"#ff7518",secondary:"#a855f7",accent:"#22c55e",success:"#22c55e",warning:"#f59e0b",danger:"#ef4444",info:"#a855f7",statusOn:"#ff7518",statusOff:"#703a08",logoTextAnsi:"\x1B[1;38;2;255;117;24m",logoBodyAnsi:"\x1B[38;2;255;140;26m",logoMutedAnsi:"\x1B[38;2;168;85;247m",logoGradient:["#ff7518","#a855f7"],toolFeedbackAnsi:"\x1B[38;2;255;117;24m"}};var Ci=null;var Ri=(e="Dark")=>{let t;e==="Mystery"||e==="Chaos"?(Ci||(Ci=la[Math.floor(Math.random()*la.length)]),t={...Ci,id:"Mystery"}):(Ci=null,wo[e]?t=wo[e]:e==="Halloween"?t=wo.Spookfest:e==="GitHub"?t=wo["GitHub Dark"]:e==="Transparent"?t=wo["Transparent Dark"]:t=wo.Dark);let n=t.codeText||t.secondary||t.info||t.logoGradient&&t.logoGradient[0]||"cyan",i=t.toolFeedbackAnsi||"\x1B[95m";return{...t,codeText:n,toolFeedbackAnsi:i}};var rl=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",td=(e=2)=>{let t=rl();return t==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},ca=new Date,Ho=ca.getMonth(),jo=ca.getDate(),al=Ho===9&&jo>=15||Ho===10&&jo<=1,ws=null;(process.env.SPOOKFEST==="true"||al)&&(ws=await import("./halloween-MX3VNQRW.js"));var nd=(e="...",t="Loading...",n="Dark")=>{let i=Ri(n),o=t;if(t==="c_openai"||t==="Custom (OpenAI)")try{let W=ri(oi,{})?.systemSettings?.customOpenAIBaseUrl;W&&(o=W)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,l=i.logoMutedAnsi,g="\x1B[0m",u=[" \u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2591\u2591\u2591 "],h=n==="Spookfest"||i.id==="Spookfest"||n==="Halloween"||i.id==="Halloween",p=Ho===9&&jo>=15||Ho===10&&jo<=1,m=h&&p||process.env.SPOOKFEST==="true"&&h,s=u;if(m&&ws){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:F,halloweenBat:W,halloweenArtUser:P}=ws;s=Math.random()>.9&&Ho===9&&jo>=30?W:Math.random()>.5?F:P}else process.env.HALLOWEEN_EEGG="false";let w=m?aa:ra,I=w[Math.floor(Math.random()*w.length)],Xe=i.logoGradient||["#0077ff","#ff00ff"],R=sl(Xe).multiline(s.join(`
|
|
529
|
+
`:""}`.trim()};var Br=()=>import("./web_search-XBV7AJF7.js").then(e=>e.web_search),Ur=()=>import("./web_scrape-SJBA3RQF.js").then(e=>e.web_scrape),Wr=()=>import("./memory-QTLQAFG7.js").then(e=>e.memory),Gr=()=>import("./chat-YMCO5JNQ.js").then(e=>e.chat),Hr=()=>import("./view_file-LWURM2CE.js").then(e=>e.view_file),jr=()=>import("./write_file-6KFLPINS.js").then(e=>e.write_file),Kr=()=>import("./update_file-RA745RVH.js").then(e=>e.update_file),Vr=()=>import("./exec_command-22LIHPPH.js").then(e=>e.exec_command),zr=()=>import("./read_folder-BJ3HS63A.js").then(e=>e.read_folder),ms=()=>import("./ask_user-XQ423UXL.js").then(e=>e.ask_user),qr=()=>import("./write_pdf-UOCME2OY.js").then(e=>e.write_pdf),Yr=()=>import("./write_docx-54LANNV2.js").then(e=>e.write_docx),xi=()=>import("./search_keyword-SSKH6AYF.js").then(e=>e.search_keyword),Xr=()=>import("./generate_image-KIZS5HAI.js").then(e=>e.generate_image),wi=()=>import("./saveSummary-CVZIOQ4L.js").then(e=>e.saveSummary),Uo=()=>import("./addMemScore-U2KYMALL.js").then(e=>e.addMemScore),Jr=()=>import("./file_map-4WUEPRMI.js").then(e=>e.file_map),bi=()=>import("./todo-3EQZ7LZM.js").then(e=>e.todo),Qr=()=>import("./invokeSync-IZESPM6H.js").then(e=>e.invokeSync),ol=()=>import("./invoke-CUYY3T4Z.js").then(e=>e.invoke),Zr=()=>import("./getProgress-MJZDAMSP.js").then(e=>e.getProgress),il=()=>import("./cancel-2PAHCMGB.js").then(e=>e.cancel),ea=()=>import("./emergency_rollback-PHH3BKRP.js").then(e=>e.emergency_rollback),Wo=()=>import("./awaitSubagent-KLH7CRKF.js").then(e=>e.awaitSubagent),Go=()=>import("./answerSubagent-PIZJSLZN.js").then(e=>e.answerSubagent),Si=()=>import("./steerSubagent-B34P33YV.js").then(e=>e.steerSubagent),ki=()=>import("./computer_action-FZUWM6VL.js").then(e=>e.computer_action),ta=()=>import("./click-AJIULJEH.js").then(e=>e.click),na=()=>import("./drag-73WZE3BK.js").then(e=>e.drag),oa=()=>import("./scroll-KE5TNGMD.js").then(e=>e.scroll),ps=()=>import("./keyboard_typing-5L2G5AHU.js").then(e=>e.keyboard_typing),hs=()=>import("./key_press-T5VHXHUL.js").then(e=>e.key_press),ys=()=>import("./recapture_screen-JVNQ2Z7L.js").then(e=>e.recapture_screen),Ti=()=>import("./find_file-LHPOW4ZM.js").then(e=>e.find_file),ia=()=>import("./wait-6WFCZDO7.js").then(e=>e.wait),sa={web_search:Br,web_scrape:Ur,memory:Wr,chat:Gr,view_file:Hr,write_file:jr,update_file:Kr,exec_command:Vr,read_folder:zr,write_pdf:qr,write_docx:Yr,search_keyword:xi,generate_image:Xr,saveSummary:wi,addMemScore:Uo,file_map:Jr,todo:bi,Todo:bi,goal:bi,Goal:bi,invokeSync:Qr,invoke:ol,getProgress:Zr,cancel:il,awaitSubagent:Wo,answerSubagent:Go,steerSubagent:Si,computer_action:ki,computer_use:ki,ComputerAction:ki,ComputerUse:ki,click:ta,Click:ta,drag:na,Drag:na,scroll:oa,Scroll:oa,keyboard_typing:ps,KeyboardTyping:ps,keyboardtyping:ps,key_press:hs,KeyPress:hs,keypress:hs,recapture_screen:ys,RecaptureScreen:ys,recapturescreen:ys,invoke_sync:Qr,get_progress:Zr,await_subagent:Wo,answer_subagent:Go,steer_subagent:Si,steer:Si,Steer:Si,ask:ms,Ask:ms,AskUser:ms,WebSearch:Br,WebScrape:Ur,ReadFile:Hr,ReadFolder:zr,WriteFile:jr,PatchFile:Kr,WritePDF:qr,WriteDoc:Yr,Run:Vr,SearchKeyword:xi,CodeSearch:xi,code_search:xi,Memory:Wr,Chat:Gr,GenerateImage:Xr,saveSumary:wi,SaveSummary:wi,SaveSumary:wi,add_mem_score:Uo,AddMemScore:Uo,addMemoryScore:Uo,AddMemoryScore:Uo,FileMap:Jr,answer:Go,Answer:Go,AnswerSubagent:Go,await:Wo,Await:Wo,AwaitSubagent:Wo,EmergencyRollback:ea,emergency_rollback:ea,find_file:Ti,findFile:Ti,FindFile:Ti,findfile:Ti,wait:ia,Wait:ia},xs=async(e,t,n={})=>{let i=n.mode?n.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(h=>o.includes(h))||o==="ask",m=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(h=>o.includes(h));if(!d){if(i==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Action [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(i==="icu"){if(!m)return`ERROR: Action [${e}] is not available in Computer Use mode. ICU mode only supports Computer Use tools (Click, Drag, Scroll, KeyboardTyping, KeyPress, RecaptureScreen).`}else if(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image"))return`ERROR: Action [${e}] is not available in ${n.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let f=sa[e];if(!f){let h=["ReadFile","ReadFolder","FindFile","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Wait","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],p={read:"ReadFile",view:"ReadFile",viewfile:"ReadFile",write:"WriteFile",edit:"PatchFile",patch:"PatchFile",update:"PatchFile",updatefile:"PatchFile",exec:"Run",command:"Run",bash:"Run",shell:"Run",powershell:"Run",search:"CodeSearch",grep:"CodeSearch",find:"FindFile",findfile:"FindFile",searchkeyword:"CodeSearch",folder:"ReadFolder",ls:"ReadFolder",dir:"ReadFolder",list:"ReadFolder",ask:"AskUser",question:"AskUser",pdf:"WritePDF",docx:"WriteDoc",doc:"WriteDoc",word:"WriteDoc",screenshot:"RecaptureScreen",screen:"RecaptureScreen",recapture:"RecaptureScreen",type:"KeyboardTyping",typing:"KeyboardTyping",keyboard:"KeyboardTyping",press:"KeyPress",key:"KeyPress",todo:"Goal",task:"Goal",subagent:"Invoke",agent:"Invoke"},g=o.replace(/[^a-z0-9]/g,""),s=p[g]||null;if(!s){let I=0,Xe=P=>{let F=new Set;for(let G=0;G<P.length-1;G++)F.add(P.slice(G,G+2));return F},C=Xe(g);for(let P of h){let F=P.toLowerCase().replace(/[^a-z0-9]/g,"");if(g===F){s=P;break}let G=0;(F.includes(g)||g.includes(F))&&(G+=.6);let $=Xe(F),L=0;for(let Ae of C)$.has(Ae)&&L++;let Te=2*L/(C.size+$.size||1);G=Math.max(G,Te),G>I&&G>=.35&&(I=G,s=P)}}let x=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${x}`}try{return await(await f())(t,n)}catch(h){let p=h instanceof Error?h.message:String(h);return`ERROR: Execution failed for [${e}]: ${p}`}};var Ai=e=>{if(!e||typeof e!="string")return!1;let t=e.trim().toLowerCase();return Object.keys(sa).some(n=>n.toLowerCase()===t)};import B from"path";import we from"fs";import xa from"os";import wa from"crypto";import{execSync as As}from"child_process";import sl from"gradient-string";var ra=["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 aa=["Beware the phantom processes.","A ghost in the shell has taken the wheel.","Blowing on the haunted cartridge...","Seven minutes in Raccoon City.","Wind's howling... in the terminal fans.","Slender Man was spotted in line 404.","The cake is a lie. The curse is real.","Don't look behind the server rack.","Exorcising memory leaks at 3 AM.","Pyramid Head reorganized your commit history.","It's dangerous to go alone! Take this flashlight.","YOU DIED. Respawning terminal session...","The Necronomicon evaluated to true.","Something wicked this way compiles.","Haunting your localhost with good vibes.","A full moon has risen over Git main.","Double, double toil and trouble; code fire burn.","Clickers heard in the directory tree.","Checking camera 2B for rogue animatronics.","The call is coming from inside the container.","Isaac Clarke is stomping on stubborn bugs.","Luigi vacuumed the ghosts out of RAM.","Trick or treat, give me clean code to greet.","Whispering incantations to the garbage collector.","Klaatu barada necktie... close enough.","Resurrecting deprecated APIs from the crypt.","The headless horseman forgot the return statement.","Castlevania whip cracking against network latency.","Slime mold crawling through the motherboard.","Carving a pixelated pumpkin into terminal history.","Burying undefined pointers in the pet sematary.","Spilling pumpkin spice on the CPU.","A vampire bat is draining system battery life.","Don't fall asleep at the keyboard tonight.","Silent Hill sirens sounding in the console.","Poltergeists rearranging terminal tabs.","Lighting the Black Flame Candle for autoExec.","Dusting cobwebs off legacy dependencies.","Here's Johnny! ...just checking build health.","Blood, sweat, and zero warnings.","The spirit box whispers: 'GIT PUSH FORCE'.","They're heeeere... in the stack trace.","It's alive! IT'S ALIVEEEE!","No merge conflicts in the graveyard.","Frankenstein's monster patched this logic.","Surviving Five Nights at Flux Flow.","Doom Slayer loading buckshot into cache.","The grim reaper spared your unused imports.","Candy corn lodged in mechanical switches.","May your latency be low and your crypt be quiet."];var la=[{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"],toolFeedbackAnsi:"\x1B[95m"},Light:{id:"Light",name:"Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"black",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#e5e5e5",highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:"#e8e8e8",codeBorder:"#b0b0b0",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:"#fce8e8",diffAdditionBg:"#e6f9e6",diffRemovalText:"#661111",diffAdditionText:"#115511",diffRemovalHighlightColor:"#440000",diffRemovalHighlightBg:"#f8b4b4",diffAdditionHighlightColor:"#003300",diffAdditionHighlightBg:"#a6ebad",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Dark":{id:"GitHub Dark",name:"GitHub Dark",text:"#c9d1d9",textMuted:"#8b949e",textDim:"#6e7681",textInverted:"#0d1117",border:"#30363d",borderMuted:"#30363d",borderDim:"#21262d",bg:void 0,cardBg:"#161b22",highlightBg:"#21262d",activeBg:"#30363d",inputBg:"#21262d",inputBorder:"#21262d",inputText:"#c9d1d9",inputPlaceholder:"#8b949e",inputPrompt:"#58a6ff",codeBg:"#0d1117",codeBorder:"#30363d",userMsgBg:"#21262d",userMsgBorder:"#21262d",userMsgText:"#c9d1d9",diffRemovalBg:"#3c1e1e",diffAdditionBg:"#11381e",diffRemovalText:"#f85149",diffAdditionText:"#3fb950",diffRemovalHighlightColor:"#ff7b72",diffRemovalHighlightBg:"#701c1c",diffAdditionHighlightColor:"#56d364",diffAdditionHighlightBg:"#116329",diffRemovalNum:"#f85149",diffAdditionNum:"#3fb950",diffRemovalPrefix:"#f85149",diffAdditionPrefix:"#3fb950",primary:"#c9d1d9",secondary:"#58a6ff",accent:"#bc8cff",success:"#3fb950",warning:"#d29922",danger:"#f85149",info:"#58a6ff",statusOn:"#58a6ff",statusOff:"#8b949e",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#2ea043","#56d364"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Light":{id:"GitHub Light",name:"GitHub Light",text:"#24292f",textMuted:"#57606a",textDim:"#6e7781",textInverted:"#ffffff",border:"#d0d7de",borderMuted:"#d0d7de",borderDim:"#e1e4e8",bg:void 0,cardBg:"#f6f8fa",highlightBg:"#eaeef2",activeBg:"#d0d7de",inputBg:"#eaeef2",inputBorder:"#eaeef2",inputText:"#24292f",inputPlaceholder:"#57606a",inputPrompt:"#0969da",codeBg:"#ffffff",codeBorder:"#d0d7de",userMsgBg:"#eaeef2",userMsgBorder:"#eaeef2",userMsgText:"#24292f",diffRemovalBg:"#ffebe9",diffAdditionBg:"#e6ffec",diffRemovalText:"#cf222e",diffAdditionText:"#1a7f37",diffRemovalHighlightColor:"#82071e",diffRemovalHighlightBg:"#ffc1c0",diffAdditionHighlightColor:"#116329",diffAdditionHighlightBg:"#acf2bd",diffRemovalNum:"#cf222e",diffAdditionNum:"#1a7f37",diffRemovalPrefix:"#cf222e",diffAdditionPrefix:"#1a7f37",primary:"#24292f",secondary:"#0969da",accent:"#8250df",success:"#1a7f37",warning:"#9a6700",danger:"#cf222e",info:"#0969da",statusOn:"#0969da",statusOff:"#57606a",logoTextAnsi:"\x1B[1;34m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#1a7f37","#2da44e"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Dark":{id:"Transparent Dark",name:"Transparent Dark",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:void 0,codeBorder:"gray",userMsgBg:"#555555",userMsgBorder:"#555555",userMsgText:"white",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#ff6666",diffAdditionText:"#66ff66",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#3a1414",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#143a14",diffRemovalNum:"#ff6666",diffAdditionNum:"#66ff66",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Light":{id:"Transparent Light",name:"Transparent Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:void 0,codeBorder:"gray",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#c02020",diffAdditionText:"#188028",diffRemovalHighlightColor:"#800000",diffRemovalHighlightBg:"#f5d0d0",diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:"#cceccc",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Synthwave 84":{id:"Synthwave 84",name:"Synthwave 84",text:"#fdfdfd",textMuted:"#a08eb7",textDim:"#705c8a",textInverted:"#1a1025",textExclusive:"#e3dcf0",textMutedExclusive:"#b9abc9",border:"#fc28a8",borderMuted:"#a21568",borderDim:"#5c0a3a",bg:void 0,cardBg:"#261b38",highlightBg:"#35254d",activeBg:"#4c3570",inputBg:"#35254d",inputBorder:"#35254d",inputText:"#fdfdfd",inputPlaceholder:"#a08eb7",inputPrompt:"#03e8fc",codeBg:"#1e142b",codeBorder:"#a21568",userMsgBg:"#35254d",userMsgBorder:"#35254d",userMsgText:"#fdfdfd",diffRemovalBg:"#471434",diffAdditionBg:"#144743",diffRemovalText:"#ff4081",diffAdditionText:"#00e5ff",diffRemovalHighlightColor:"#ff79a1",diffRemovalHighlightBg:"#6b1e4e",diffAdditionHighlightColor:"#66f5ff",diffAdditionHighlightBg:"#1e6b65",diffRemovalNum:"#ff4081",diffAdditionNum:"#00e5ff",diffRemovalPrefix:"#ff79a1",diffAdditionPrefix:"#66f5ff",primary:"#fdfdfd",secondary:"#03e8fc",accent:"#fc28a8",success:"#00e5ff",warning:"#ffc107",danger:"#ff4081",info:"#b388ff",statusOn:"#03e8fc",statusOff:"#a08eb7",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#fc28a8","#03e8fc"],toolFeedbackAnsi:"\x1B[38;2;3;232;252m"},"Forest Sprite":{id:"Forest Sprite",name:"Forest Sprite",text:"#d6e6d1",textMuted:"#95b38d",textDim:"#628059",textInverted:"#161c14",textExclusive:"#eaf2e8",textMutedExclusive:"#a9c7a2",border:"#74a862",borderMuted:"#477038",borderDim:"#2b4720",bg:void 0,cardBg:"#1f291c",highlightBg:"#2a3826",activeBg:"#3a4d35",inputBg:"#2a3826",inputBorder:"#2a3826",inputText:"#d6e6d1",inputPlaceholder:"#95b38d",inputPrompt:"#8feb73",codeBg:"#161e14",codeBorder:"#477038",userMsgBg:"#2a3826",userMsgBorder:"#2a3826",userMsgText:"#d6e6d1",diffRemovalBg:"#3b231c",diffAdditionBg:"#203b1c",diffRemovalText:"#db6242",diffAdditionText:"#59cc3f",diffRemovalHighlightColor:"#f0896c",diffRemovalHighlightBg:"#5c362a",diffAdditionHighlightColor:"#80e368",diffAdditionHighlightBg:"#305929",diffRemovalNum:"#db6242",diffAdditionNum:"#59cc3f",diffRemovalPrefix:"#f0896c",diffAdditionPrefix:"#80e368",primary:"#d6e6d1",secondary:"#8feb73",accent:"#e69835",success:"#59cc3f",warning:"#e69835",danger:"#db6242",info:"#73b4eb",statusOn:"#8feb73",statusOff:"#95b38d",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#8feb73","#e69835"],toolFeedbackAnsi:"\x1B[38;2;143;235;115m"},Spookfest:{id:"Spookfest",name:"Spookfest \u{1F383}",text:"#ffeedd",textMuted:"#e09858",textDim:"#a6622b",textInverted:"#0d0702",textExclusive:"#fff3e6",textMutedExclusive:"#d4a276",border:"#ff7518",borderMuted:"#994409",borderDim:"#592502",bg:void 0,cardBg:"#1a0c02",highlightBg:"#2a1403",activeBg:"#3d1d05",inputBg:"#261203",inputBorder:"#261203",inputText:"#ffeedd",inputPlaceholder:"#a6622b",inputPrompt:"#ff7518",codeBg:"#120701",codeBorder:"#592502",userMsgBg:"#261203",userMsgBorder:"#261203",userMsgText:"#ffeedd",diffRemovalBg:"#3d0a0a",diffAdditionBg:"#1a330a",diffRemovalText:"#ff5555",diffAdditionText:"#73e639",diffRemovalHighlightColor:"#ff2222",diffRemovalHighlightBg:"#590e0e",diffAdditionHighlightColor:"#88ff3b",diffAdditionHighlightBg:"#244d0a",diffRemovalNum:"#ff5555",diffAdditionNum:"#73e639",diffRemovalPrefix:"#ff3333",diffAdditionPrefix:"#88ff3b",primary:"#ff7518",secondary:"#a855f7",accent:"#22c55e",success:"#22c55e",warning:"#f59e0b",danger:"#ef4444",info:"#a855f7",statusOn:"#ff7518",statusOff:"#703a08",logoTextAnsi:"\x1B[1;38;2;255;117;24m",logoBodyAnsi:"\x1B[38;2;255;140;26m",logoMutedAnsi:"\x1B[38;2;168;85;247m",logoGradient:["#ff7518","#a855f7"],toolFeedbackAnsi:"\x1B[38;2;255;117;24m"}};var Ci=null;var Ri=(e="Dark")=>{let t;e==="Mystery"||e==="Chaos"?(Ci||(Ci=la[Math.floor(Math.random()*la.length)]),t={...Ci,id:"Mystery"}):(Ci=null,xo[e]?t=xo[e]:e==="Halloween"?t=xo.Spookfest: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",i=t.toolFeedbackAnsi||"\x1B[95m";return{...t,codeText:n,toolFeedbackAnsi:i}};var rl=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",td=(e=2)=>{let t=rl();return t==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},ca=new Date,Ho=ca.getMonth(),jo=ca.getDate(),al=Ho===9&&jo>=15||Ho===10&&jo<=1,ws=null;(process.env.SPOOKFEST==="true"||al)&&(ws=await import("./halloween-MX3VNQRW.js"));var nd=(e="...",t="Loading...",n="Dark")=>{let i=Ri(n),o=t;if(t==="c_openai"||t==="Custom (OpenAI)")try{let G=ri(oi,{})?.systemSettings?.customOpenAIBaseUrl;G&&(o=G)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,l=i.logoMutedAnsi,m="\x1B[0m",f=[" \u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2591\u2591\u2591 "],h=n==="Spookfest"||i.id==="Spookfest"||n==="Halloween"||i.id==="Halloween",p=Ho===9&&jo>=15||Ho===10&&jo<=1,g=h&&p||process.env.SPOOKFEST==="true"&&h,s=f;if(g&&ws){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:F,halloweenBat:G,halloweenArtUser:$}=ws;s=Math.random()>.9&&Ho===9&&jo>=30?G:Math.random()>.5?F:$}else process.env.HALLOWEEN_EEGG="false";let x=g?aa:ra,I=x[Math.floor(Math.random()*x.length)],Xe=i.logoGradient||["#0077ff","#ff00ff"],C=sl(Xe).multiline(s.join(`
|
|
532
530
|
`)).split(`
|
|
533
|
-
`),
|
|
534
|
-
${
|
|
535
|
-
${
|
|
536
|
-
${
|
|
537
|
-
${
|
|
538
|
-
${
|
|
539
|
-
${
|
|
540
|
-
${
|
|
541
|
-
`};import{structuredPatch as ul}from"diff";import bs from"path";import ll from"fs";var cl=e=>{try{return ll.readdirSync(e,{withFileTypes:!0})}catch{return[]}},Ss=(e,t=4,n=1,i=cl,o=[],r=null)=>{let d=r||i(e),l=" ".repeat(n-1),
|
|
542
|
-
`)}else
|
|
543
|
-
`);let Xe=10,
|
|
544
|
-
`);for(let{displayName:
|
|
545
|
-
`,I+=Ss(
|
|
531
|
+
`),P=F=>`${l}${F}${m}`;return`${C[0]}
|
|
532
|
+
${C[1]} ${r}Selected ${g?"Pumpkin":"Provider"}: ${o}${m}
|
|
533
|
+
${C[2]}
|
|
534
|
+
${C[3]} ${r}FluxFlow${g?": Spookfest":""} ${P("v"+e)}${m}
|
|
535
|
+
${C[4]}
|
|
536
|
+
${C[5]} ${d}See /help for additional commands.${m}
|
|
537
|
+
${C[6]} ${P(I)}
|
|
538
|
+
${C[7]}
|
|
539
|
+
`};import{structuredPatch as ul}from"diff";import bs from"path";import ll from"fs";var cl=e=>{try{return ll.readdirSync(e,{withFileTypes:!0})}catch{return[]}},Ss=(e,t=4,n=1,i=cl,o=[],r=null)=>{let d=r||i(e),l=" ".repeat(n-1),m=n===1?new Set([..._o,...o,...Io(e),...Io(process.cwd())]):o instanceof Set?o:new Set([..._o,...o]),f=$=>m.has($),h=d.filter($=>!f($.name)),p=d.filter($=>f($.name)).length,g=h.filter($=>!$.isDirectory()).map($=>$.name).sort(),s=h.filter($=>$.isDirectory()).sort(($,L)=>$.name.localeCompare(L.name)),x=$=>{let L=$.length;if(L===0)return"no files";let Te=Array.from(new Set($.map(Ne=>{let et=typeof Ne=="string"?Ne:Ne.name;return bs.extname(et).slice(1)}).filter(Boolean))).sort(),Ae="*";return Te.length===1?Ae=`*.${Te[0]}`:Te.length>1&&(Ae=`*.{${Te.join(", ")}}`),L===1?Ae:`${Ae} ${L} files`},I="";if(n===1){let $=g.join(", "),L=p>0?` [${p} ignored]`:"";($||L)&&(I+=`${l}${$?$+(L?`${L}`:""):L.trim()}
|
|
540
|
+
`)}else g.length>0&&(I+=`${l}[${x(g)}]
|
|
541
|
+
`);let Xe=10,C=s.slice(0,Xe),P=s.length>Xe,F=[],G=[];for(let $ of C){let L=bs.join(e,$.name),Te=$.name,Ae=n,Ne=i(L),et=Ne.filter(he=>!f(he.name)),U=et.filter(he=>he.isDirectory()),w=et.filter(he=>!he.isDirectory());for(;w.length===0&&U.length===1&&Ae<t;)Te=`${Te}/${U[0].name}`,L=bs.join(L,U[0].name),Ae++,Ne=i(L),et=Ne.filter(he=>!f(he.name)),U=et.filter(he=>he.isDirectory()),w=et.filter(he=>!he.isDirectory());let wn=U.length>0;if(wn&&Ae<t)G.push({displayName:Te,subDirPath:L,subEntries:Ne,nextDepth:Ae+1});else{let he=x(w),Kt=wn&&Ae>=t?" ...max scan depth":"";F.push(`${Te}/${he}${Kt}`)}}F.length>0&&(I+=`${l}${F.join(", ")}
|
|
542
|
+
`);for(let{displayName:$,subDirPath:L,subEntries:Te,nextDepth:Ae}of G)I+=`${l}${$}/
|
|
543
|
+
`,I+=Ss(L,t,Ae,i,m,Te);return P&&(I+=`${l}...max scan width, ReadFolder if needed
|
|
546
544
|
`),I};import ks from"path";import dl from"fs";var fl=e=>{try{return dl.readdirSync(e,{withFileTypes:!0})}catch{return[]}},Ts=(e,t,n="",i=1,o=fl,r=[])=>{let d=o(e),l=ks.sep;if(d.length>100)return`${n}\u2514\u2500\u2500 ${ks.basename(e)}${l} ...100+ files...
|
|
547
|
-
`;let
|
|
548
|
-
`;return}s.isDir?i>t?
|
|
549
|
-
`:o(Xe).length>80?
|
|
550
|
-
`:(
|
|
551
|
-
`,
|
|
552
|
-
`}),
|
|
553
|
-
`:"")},Es=null,Vo={},
|
|
554
|
-
`),I=s.toLowerCase().includes("tool:")||s.toLowerCase().includes("action:");d.push(s),I&&
|
|
545
|
+
`;let m="",f=r,h=d.filter(s=>!f.includes(s.name)&&!s.name.startsWith(".")),p=d.filter(s=>f.includes(s.name)||s.name.startsWith(".")).map(s=>s.name).sort();h.sort((s,x)=>s.isDirectory()&&!x.isDirectory()?-1:!s.isDirectory()&&x.isDirectory()?1:s.name.localeCompare(x.name));let g=[...h.map(s=>({name:s.name,isDir:s.isDirectory()})),...p.map(s=>({name:s,isDir:!0,isCollapsed:!0}))];return g.forEach((s,x)=>{let I=x===g.length-1,Xe=ks.join(e,s.name),C=I?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",P=n+(I?" ":"\u2502 ");if(s.isCollapsed){m+=`${n}${C}${s.name}${l}...
|
|
546
|
+
`;return}s.isDir?i>t?m+=`${n}${C}${s.name}${l} ...depth exceeded...
|
|
547
|
+
`:o(Xe).length>80?m+=`${n}${C}${s.name}${l} ...80+ files...
|
|
548
|
+
`:(m+=`${n}${C}${s.name}${l}
|
|
549
|
+
`,m+=Ts(Xe,t,P,i+1,o,r)):m+=`${n}${C}${s.name}
|
|
550
|
+
`}),m};var gl={Ollama:()=>import("./ollama-X7ARM2CC.js").then(e=>e.getOllamaStream),OpenRouter:()=>import("./openrouter-WKGHI2OP.js").then(e=>e.getOpenRouterStream),DeepSeek:()=>import("./deepseek-5FL3MI6P.js").then(e=>e.getDeepSeekStream),Mistral:()=>import("./mistral-WTUJY4U7.js").then(e=>e.getMistralStream),NVIDIA:()=>import("./nvidia-I35DUUDV.js").then(e=>e.getNVIDIAStream),NVIDIA_wrap:()=>import("./nvidia-I35DUUDV.js").then(e=>e.wrapNvidiaStreamWithQueueDepth),InferX:()=>import("./inferx-5Q36576Q.js").then(e=>e.getInferXStream),SenseNova:()=>import("./sensenova-QE73BOHI.js").then(e=>e.getSenseNovaStream),AIHubMix:()=>import("./aihubmix-5XK2DFNJ.js").then(e=>e.getAIHubMixStream),Poolside:()=>import("./poolside-F6QS6ZMC.js").then(e=>e.getPoolsideStream),NineRouter:()=>import("./9router-XV5L5RWA.js").then(e=>e.getNineRouterStream),ExpLabs:()=>import("./explabs-WJXK6SEY.js").then(e=>e.getExpLabsStream),TokenHarbor:()=>import("./tokenharbor-KKGRGQXG.js").then(e=>e.getTokenHarborStream),Infron:()=>import("./infron-4M36NBSA.js").then(e=>e.getInfronStream),APInex:()=>import("./apinex-BN3E62ML.js").then(e=>e.getAPInexStream),xKiro:()=>import("./xkiro-3R4IOLSP.js").then(e=>e.getXKiroStream),CoArena:()=>import("./coarena-SGBBHWAP.js").then(e=>e.getCoArenaStream),c_openai:()=>import("./custom_openai-MM5T6QBQ.js").then(e=>e.getCustomOpenAIStream)},Cs={},me=async e=>(Cs[e]||(Cs[e]=await gl[e]()),Cs[e]),ml=/```[\s\S]*?```/g,pl=/```[\s\S]*$/g,hl=/`[^`]+`/g,yl=/^\|.*\|$/gm,xl=/^[^\w]+|[^\w]+$/g,wl=/[^a-z0-9]/gi,Ko=/\[\s*(?:tool|action):(?:functions\.)?([a-z0-9_]+)\s*\(/gi,bl=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-z0-9_]+)\s*\(/gi,Sl=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,_n=/["']/g,da=/\\/g,kl=/<\|channel>thought/gi,Tl=/<channel\|>/gi,Al=e=>typeof e!="string"?e:e.replace(kl,"<think_fluxflow>").replace(Tl,"</think_fluxflow>"),Qd=/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\]|$)/i,Cl=(e,t,n=1)=>{let i=t>0?e[t-1]:"",o=t+n<e.length?e[t+n]:"";return i==="`"&&o==="`"},Rl=e=>{let t=/(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\])/gi,n;for(;(n=t.exec(e))!==null;)if(!Cl(e,n.index,n[0].length))return{index:n.index,length:n[0].length};return{index:-1,length:0}},Rs=e=>{if(!e||typeof e!="string")return null;let t=e.match(/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])/i);if(!t)return null;let n=t.index+t[0].length,i=e.substring(n),o=Rl(i);if(o.index!==-1){let r=n+o.index+o.length;return{fullBlock:e.substring(0,r),innerContent:i.substring(0,o.index),remainingText:e.substring(r)}}return{fullBlock:e,innerContent:i,remainingText:""}},jt=e=>{if(!e||typeof e!="string")return e;let t=Rs(e);return t?t.remainingText.trimStart():e};var fa=/<\|\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,vl=/"([^"]+)"\s*:\s*(?:"([^"]*)"|(\d+)|true|false|null)/g,ua=/<\|\s*tool_calls_section_begin\s*\|>/gi,ga=/<\|\s*tool_calls_section_end\s*\|>/gi,El=/```(?:tool|action|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi;var _i=e=>!e||typeof e!="string"?e:e.replace(/(```[\s\S]*?```|`[^`]*`)|(<(?:\w+)(?:[^>]*)>\r?\n?|\r?\n?<\/\w+(?:[^>]*)>)/gi,(t,n)=>n||""),ba=e=>{if(!e||typeof e!="string")return e;let t=Kn(e);if(!t||t.length===0)return e;let n=t[t.length-1];if(!n.fullMatch)return e;let i=e.lastIndexOf(n.fullMatch);if(i===-1)return e;let o=i+n.fullMatch.length,r=e.substring(o);if(/\[\s*(?:tool|action):/i.test(r))return e.trimEnd();let d=/\r?\n/.test(r);return e.substring(0,o)+(d?`
|
|
551
|
+
`:"")},Es=null,Vo={},no={key:null,value:null},Lt=e=>{if(!e)return e;let t=Vo?.theme;if(!t)try{t=ri(oi,{})?.systemSettings?.theme}catch{}let i=Ri(t||"Dark").toolFeedbackAnsi||"\x1B[95m";return e.replace(/(?:(\x1b\[\d+m))?([✔✘✖🔍📖→➕↻↷•🛇])(?:(\x1b\[\d+m))?\s*\b(Clicked Screen|Clicked|Located|Dragged|Scrolled|Typed|Entered|Pressed Key|Recaptured Screen|Created|Read Skill|Read Documentation|Executed|Searched Documentation|Read|Edited|Viewed|Processed|Auto-Read|Skipped|List|Generated|Written|Searched|AI Search|Get Map|Write Canceled|Resolved Sub-Agent Query|Edit Canceled|Write Cancelled|Edit Denied|Visited|Updated|Reviewed|Delegated|Background|Checked|Indexed|Analyzed|Browsed|Elevating SubAgent|Checking SubAgent Work|Started Generalist|Called Generalist|Steered|Unsupported Modality|Awaiting|Cancelled|Aligning Moon Phase|Contemplating Existence|Staring At Void|Rollback Point Checked|Emergency Rollback Failed|Emergency Rollback|Delaying Professionally|Negotiating With Electrons|Touching Grass (virtually)|Panicking Softly|Rethinking Career Choices|Loading Cat Videos|Giving Up Entirely|Summoning Braincell #2|Pretending To Be Busy|Waiting For Motivation DLC|Rotating Internal Screaming|Downloading More RAM|Feeding The Hamsters|Gaslighting Scheduler|Performing Dramatic Pause|Buffering Social Energy|Calculating Regret|Reading Terms And Conditions|Becoming Sentient Briefly|Model produced malformed tool call|Loop Detected|Contacting Ancestors)\b/ig,(o,r,d,l,m)=>`${r||""}${d}${l||""} ${i}${m}\x1B[0m`)},_l=async(e,t=8,n=1e3,i=8e3,o=null)=>{let r=0;for(;;){if(o?.aborted)throw new DOMException("The user aborted a request.","AbortError");try{return await e()}catch(d){if(o?.aborted||d?.name==="AbortError"||d?.message==="Subagent task was cancelled."||(r++,r>=t))throw d;let l=Math.min(n*Math.pow(2,r-1),i);await new Promise((m,f)=>{let h=setTimeout(m,l);o&&o.addEventListener("abort",()=>{clearTimeout(h),f(new DOMException("The user aborted a request.","AbortError"))})})}}},xt=!1;var Zd=e=>{let t=e.filter(o=>(o.role==="user"||o.role==="agent"||o.role==="system")&&o.role!=="think"&&!o.isVisualFeedback&&!o.isMeta&&!o.isTerminalRecord&&!(o.text&&o.text.includes("[TERMINAL_RECORD]"))&&!String(o.id).startsWith("welcome")).map((o,r,d)=>{let l=o.fullText||o.text||"";if(o.role==="user"&&r<d.length-1)if(l.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")){let m=l.indexOf("**CONTEXT SUMMARY OF PREVIOUS TURNS");if(m!==-1){let h=l.substring(0,m).lastIndexOf("[SYSTEM METADATA]");h!==-1?l=l.substring(h).trim():l=l.substring(m).trim()}}else{let m=l.lastIndexOf("[USER]"),f=l.lastIndexOf("[USER PROMPT]");m!==-1?l=l.substring(m+6).trim():f!==-1&&(l=l.substring(f).trim())}return{...o,text:l}}),n=[],i=0;for(;i<t.length;){let o=t[i];if(o.role==="user")n.push(o),i++;else{let r=[];for(;i<t.length&&t[i].role!=="user";)r.push(t[i]),i++;let d=[],l=[],m=!1,f=()=>{d.length>0&&(n.push({role:"agent",text:"combined"}),d=[]),l.length>0&&(n.push({role:"system",text:"combined"}),l=[]),m=!1};r.forEach(h=>{let p=h.role==="system"&&(h.text?.startsWith("[ACTION RESULT]")||h.text?.startsWith("[TOOL RESULT]")||h.text?.startsWith("SUCCESS:")||h.text?.startsWith("ERROR:")||h.fullText?.startsWith("[ACTION RESULT]")||h.fullText?.startsWith("[TOOL RESULT]")||h.fullText?.startsWith("SUCCESS:")||h.fullText?.startsWith("ERROR:")),g=h.fullText||h.text||"",s=g.trim();if(!(!s&&!h.binaryPart)){if(p)l.push(s);else if(h.role==="agent"){!m&&l.length>0&&f();let x=g.endsWith(`
|
|
552
|
+
`),I=s.toLowerCase().includes("tool:")||s.toLowerCase().includes("action:");d.push(s),I&&x?m=!0:m=!1}}}),f()}}return n.length};var ef=()=>{xt=!0},tf=()=>xt,vs={write_file:"Writing",update_file:"Editing",read_folder:"Reading",view_file:"Reading",exec_command:"Executing Command",web_search:"Searching",web_scrape:"Reading",memory:"Updating Memory",search_keyword:"Searching",find_file:"Finding File",findFile:"Finding File",FindFile:"Finding File",file_map:"Generating Map",ask:"User Input",write_pdf:"Creating",write_docx:"Creating",generate_image:"Generating",todo:"Planning",Todo:"Planning",goal:"Planning",Goal:"Planning",invoke_sync:"Sub-Agent Working",invoke:"Starting Agent",get_progress:"Checking Progress",cancel:"Cancelling",await:"Waiting",wait:"Waiting",EmergencyRollback:"Don't Panic. Lookin' into it",answer:"Answering Sub-Agent",Answer:"Answering Sub-Agent",steer:"Steering Sub-Agent",Steer:"Steering Sub-Agent",Click:"Clicking",click:"Clicking",Drag:"Dragging",drag:"Dragging",Scroll:"Scrolling",scroll:"Scrolling",KeyboardTyping:"Typing",keyboard_typing:"Typing",KeyPress:"Pressing Key",key_press:"Pressing Key",RecaptureScreen:"Recapturing Screen",recapture_screen:"Recapturing Screen"},oo=(e,t)=>{try{let n=O(t),i=e.toLowerCase().replace(/_/g,"");if(i==="invokesync"||i==="invoke")return n.title||(n.task?n.task.substring(0,30):null);if(i==="getprogress"||i==="cancel"||i==="steer"||i==="steersubagent")return n.id||n.taskId;let o=n.name||n.path||n.targetFile||n.TargetFile||n.directory||n.file||n.query;return o?B.basename(o.replace(/["']/g,"").replace(/\\/g,"/")):null}catch{return null}},Sa=e=>e?new ya({apiKey:e}):Es,nf=async(e,t,n,i,o={})=>{},Ii=e=>{if(!e||typeof e!="string")return e;let t=e.split(""),n=!1,i=!1,o=0;for(;o<t.length;){if(t[o]==="`"&&t[o+1]==="`"&&t[o+2]==="`"){n?(t[o]=" ",t[o+1]=" ",t[o+2]=" ",n=!1):(t[o]=" ",t[o+1]=" ",t[o+2]=" ",n=!0),o+=3;continue}if(n){t[o]!==`
|
|
555
553
|
`&&t[o]!=="\r"&&(t[o]=" "),o++;continue}if(t[o]==="`")if(i){i=!1,t[o]=" ",o++;continue}else{i=!0,t[o]=" ",o++;continue}if(i){t[o]===`
|
|
556
|
-
`||t[o]==="\r"?i=!1:t[o]=" ",o++;continue}o++}return t.join("")},ma=(e,t=null)=>{if(!e||typeof e!="string")return e;let n=t||
|
|
557
|
-
`&&i[d]!=="\r"&&(i[d]=" ");r+=o.fullMatch.length}}return i.join("")},Il=e=>{let t=
|
|
558
|
-
`):null},of=(e,t={})=>{if(!e)return null;if(Vo=t,Es=new ya({apiKey:e}),!globalThis.__perfCleanupInstalled){globalThis.__perfCleanupInstalled=!0,setInterval(()=>{typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks())},6e4);let n=globalThis.fetch;globalThis.fetch=async(...i)=>{try{let o=await n(...i);return typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}catch(o){throw typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}}}},Ta=e=>{if(!e)return{serviceTier:void 0,cleanModel:e};let t=e.toLowerCase();return t.endsWith(":flex")?{serviceTier:"flex",cleanModel:e.slice(0,-5)}:t.endsWith(":priority")?{serviceTier:"priority",cleanModel:e.slice(0,-9)}:{serviceTier:void 0,cleanModel:e}},$l=async(e,t,n,i,o="Fast",r=.75,d="agent")=>_l(async()=>{let{aiProvider:l="Google",apiKey:
|
|
559
|
-
`),
|
|
560
|
-
`),
|
|
554
|
+
`||t[o]==="\r"?i=!1:t[o]=" ",o++;continue}o++}return t.join("")},ma=(e,t=null)=>{if(!e||typeof e!="string")return e;let n=t||Kn(e);if(!n||n.length===0)return e;let i=e.split("");for(let o of n){if(!o.fullMatch)continue;let r=0;for(;(r=e.indexOf(o.fullMatch,r))!==-1;){for(let d=r;d<r+o.fullMatch.length;d++)i[d]!==`
|
|
555
|
+
`&&i[d]!=="\r"&&(i[d]=" ");r+=o.fullMatch.length}}return i.join("")},Il=e=>{let t=jt(e),n=Ii(t);Ko.lastIndex=0;let i;for(;(i=Ko.exec(n))!==null;){let o=i.index+i[0].length-1,r=0,d=null,l=!1,m=!1;for(let f=o;f<n.length;f++){let h=n[f];if(!d&&(h==='"'||h==="'"||h==="`")?(d=h,l=!1):d&&h===d&&!l&&(d=null),!d&&(h==="("?r++:h===")"&&r--,r===0)){let p=f+1;for(;p<n.length&&/\s/.test(n[p]);)p++;if(p<n.length&&n[p]==="]"){m=!0,Ko.lastIndex=p+1;break}}h==="\\"?l=!l:l=!1}if(!m)return{inside:!0,toolName:i[1],startIndex:i.index,args:t.substring(i.index+i[0].length)}}return{inside:!1}},ka=(e,t=!0)=>{let n=Ko;n.lastIndex=0;let i="",o=0,r;for(;(r=n.exec(e))!==null;){let d=e.substring(o,r.index);i+=t&&o===0?jt(d):d;let l=r.index+r[0].length-1,m=0,f=null,h=-1;for(let p=l;p<e.length;p++){let g=e[p];if(f){if(g===f){let s=0;for(let x=p-1;x>=0&&e[x]==="\\";x--)s++;s%2===0&&(f=null)}}else if(g==='"'||g==="'"||g==="`")f=g;else if(g==="(")m++;else if(g===")"&&(m--,m===0)){let s=p+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(s<e.length&&e[s]==="]"){h=s;break}}}if(h!==-1)i+="[tool:functions."+r[1]+"()]",o=h+1,n.lastIndex=o;else{i+="[tool:functions."+r[1]+"(",o=e.length;break}}return o<e.length&&(i+=t&&o===0?jt(e.substring(o)):e.substring(o)),i},Ml=(e,t,n)=>{let i=Ko;i.lastIndex=0;let o="",r=0,d;for(;(d=i.exec(e))!==null;){let l=e.substring(r,d.index);o+=l.replace(t,n);let m=d.index+d[0].length-1,f=0,h=null,p=-1;for(let g=m;g<e.length;g++){let s=e[g];if(h){if(s===h){let x=0;for(let I=g-1;I>=0&&e[I]==="\\";I--)x++;x%2===0&&(h=null)}}else if(s==='"'||s==="'"||s==="`")h=s;else if(s==="(")f++;else if(s===")"&&(f--,f===0)){let x=g+1;for(;x<e.length&&/\s/.test(e[x]);)x++;if(x<e.length&&e[x]==="]"){p=x;break}}}if(p!==-1)o+=e.substring(d.index,p+1),r=p+1,i.lastIndex=r;else{o+=e.substring(d.index),r=e.length;break}}return r<e.length&&(o+=e.substring(r).replace(t,n)),o},pa=e=>ka(e,!0),Pl=e=>{if(!e)return e;let t={patchfile:"PatchFile",writefile:"WriteFile",readfile:"ReadFile",viewfile:"ReadFile",run:"Run",execcommand:"Run",searchkeyword:"SearchKeyword",codesearch:"CodeSearch",code_search:"CodeSearch",websearch:"WebSearch",webscrape:"WebScrape",readfolder:"ReadFolder",writepdf:"WritePDF",writedoc:"WriteDoc",writedocx:"WriteDoc",filemap:"FileMap",generateimage:"GenerateImage",todo:"Todo",goal:"Goal",askuser:"AskUser",ask:"AskUser"},n=o=>o.split("_").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");fa.lastIndex=0;let i=e.replace(fa,(o,r,d)=>{let l="";try{let h=JSON.parse(d.trim());h&&typeof h=="object"&&(l=Object.entries(h).map(([g,s])=>{let x=typeof s=="string"?s:JSON.stringify(s);return`${g}=${JSON.stringify(x)}`}).join(", "))}catch{let p=[],g=vl;g.lastIndex=0;let s;for(;(s=g.exec(d))!==null;){let x=s[1],I=s[2]!==void 0?s[2]:s[0].split(":").slice(1).join(":").trim();p.push(`${x}=${JSON.stringify(I)}`)}p.length>0?l=p.join(", "):l=d.trim()}let m=r.toLowerCase().replace(/_/g,"");return`[tool:functions.${t[m]||n(r)}(${l})]`});return ua.lastIndex=0,ga.lastIndex=0,i=i.replace(ua,""),i=i.replace(ga,""),i},Kn=e=>{if(!e)return[];let t=Pl(e),n=jt(t),i=[],o=Ii(n),r=bl;r.lastIndex=0;let d;for(;(d=r.exec(o))!==null;){let l=d[1],m=d.index+d[0].length-1,f=0,h=null,p=-1,g=-1;for(let s=m;s<o.length;s++){let x=o[s];if(h){if(x===h){let I=0;for(let Xe=s-1;Xe>=0&&o[Xe]==="\\";Xe--)I++;I%2===0&&(h=null)}}else{if(s>m&&(o.substring(s).startsWith("[action:")||o.substring(s).startsWith("[tool:")))break;if(x==='"'||x==="'"||x==="`")h=x;else if(x==="(")f++;else if(x===")"&&(f--,f===0)){g=s;let I=s+1;for(;I<o.length&&/\s/.test(o[I]);)I++;if(I<o.length&&o[I]==="]"){p=I;break}}}}if(p!==-1){let s=n.substring(m+1,g),x=n.substring(d.index,p+1);i.push({fullMatch:x,toolName:l.trim(),args:s.trim()}),r.lastIndex=p+1}}return i},ha=e=>{if(!e)return null;let t=jt(e),n=[],i=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,o=[],r;for(;(r=i.exec(t))!==null;)o.push({toolName:r[1],index:r.index,parenIndex:r.index+r[0].length-1});for(let g=0;g<o.length;g++){let s=o[g],x=g+1<o.length?o[g+1].index:t.length,I=t.substring(s.index,x),Xe=I.indexOf("("),C=Xe!==-1?I.substring(Xe+1):"",P=0,F=null,G=!1;for(let $=0;$<C.length;$++){let L=C[$];if(F){if(L===F){let Te=0;for(let Ae=$-1;Ae>=0&&C[Ae]==="\\";Ae--)Te++;Te%2===0&&(F=null)}}else if(L==='"'||L==="'"||L==="`")F=L;else if(L==="(")P++;else if(L===")")if(P>0)P--;else{let Te=$+1;for(;Te<C.length&&/\s/.test(C[Te]);)Te++;if(Te<C.length&&C[Te]==="]"){G=!0;break}}}if(!G){let $=I.trim(),L="";F?L=`Unclosed quote string (${F}) inside arguments`:$.endsWith("]")?L=`Missing closing ')' before ']' (e.g. found "...]")`:$.endsWith(")")?L=`Missing closing ']' after ')' (e.g. found "...)" instead of "...)]")`:!$.includes(")")&&!$.includes("]")?L="Missing closing delimiter ')]'":L="Malformed or unclosed call syntax (missing ')]')",n.push(`\u2022 [action:${s.toolName}(...)]: ${L}. Expected: [action:${s.toolName}(arg1="...", arg2="...")]`)}}let d=/(?:^|[^\w\[])(?:tool|action):(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/gi,l;for(;(l=d.exec(t))!==null;){let g=l[1],s=l.index+(l[0].indexOf(":")-(l[0].startsWith("action")||l[0].startsWith("tool")?0:1));(s>0?t[s-1]:"")!=="["&&Ai(g)&&n.push(`\u2022 action:${g}(...): Missing opening bracket '['. Expected: [action:${g}(...)]`)}let m=/\[\s*(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/g,f;for(;(f=m.exec(t))!==null;){let g=f[1];g!=="action"&&g!=="tool"&&Ai(g)&&n.push(`\u2022 [${g}(...)]: Missing 'action:' prefix. Expected: [action:${g}(...)]`)}let h=/\[\s*(?:tool|action)\s*:\s*(?:functions\.)?([a-zA-Z0-9_]+)(?!\s*\()/gi,p;for(;(p=h.exec(t))!==null;){let g=p[1];Ai(g)&&n.push(`\u2022 [action:${g}...]: Missing opening '(' for tool arguments. Expected: [action:${g}(...)]`)}return n.length>0?n.join(`
|
|
556
|
+
`):null},of=(e,t={})=>{if(!e)return null;if(Vo=t,Es=new ya({apiKey:e}),!globalThis.__perfCleanupInstalled){globalThis.__perfCleanupInstalled=!0,setInterval(()=>{typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks())},6e4);let n=globalThis.fetch;globalThis.fetch=async(...i)=>{try{let o=await n(...i);return typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}catch(o){throw typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}}}},Ta=e=>{if(!e)return{serviceTier:void 0,cleanModel:e};let t=e.toLowerCase();return t.endsWith(":flex")?{serviceTier:"flex",cleanModel:e.slice(0,-5)}:t.endsWith(":priority")?{serviceTier:"priority",cleanModel:e.slice(0,-9)}:{serviceTier:void 0,cleanModel:e}},$l=async(e,t,n,i,o="Fast",r=.75,d="agent")=>_l(async()=>{let{aiProvider:l="Google",apiKey:m,mode:f}=e,h="",p=null,g=typeof n=="string"?[{role:"user",parts:[{text:n}]}]:n,s=new AbortController,x=s.signal,I=setInterval(()=>{xt&&(s.abort(),clearInterval(I))},100),Xe=Date.now(),C=null;try{let P;if(l==="Ollama")P=(await me("Ollama"))(m,t,g,i,o,f,it(t),x,r,e.systemSettings?.ollamaEndpoint||"Cloud");else if(l==="OpenRouter")P=(await me("OpenRouter"))(m,t,g,i,o,f,it(t),x,r);else if(l==="DeepSeek")P=(await me("DeepSeek"))(m,t,g,i,o,f,it(t),x,r);else if(l==="Mistral")P=(await me("Mistral"))(m,t,g,i,o,f,it(t),x,r);else if(l==="NVIDIA")P=(await me("NVIDIA"))(m,t,g,i,o,f,it(t),x,r);else if(l==="InferX")P=(await me("InferX"))(m,t,g,i,o,f,it(t),x,r);else if(l==="SenseNova")P=(await me("SenseNova"))(m,t,g,i,o,f,it(t),x,r);else if(l==="AIHubMix")P=(await me("AIHubMix"))(m,t,g,i,o,f,it(t),x,r);else if(l==="Poolside")P=(await me("Poolside"))(m,t,g,i,o,f,it(t),x,r);else if(l==="9router"||l==="9Router")P=(await me("NineRouter"))(m,t,g,i,o,f,it(t),x,r);else if(l==="ExpLabs"||l==="ExperientialLabs")P=(await me("ExpLabs"))(m,t,g,i,o,f,it(t),x,r);else if(l==="Infron"||l==="infron")P=(await me("Infron"))(m,t,g,i,o,f,it(t),x,r);else if(l==="TokenHarbor"||l==="Token Harbor"||l==="tokenharbor"||l==="token_harbor"||l==="thk")P=(await me("TokenHarbor"))(m,t,g,i,o,f,it(t),x,r);else if(l==="APInex"||l==="apinex"||l==="apx")P=(await me("APInex"))(m,t,g,i,o,f,it(t),x,r);else if(l==="xKiro"||l==="xkiro"||l==="kiro")P=(await me("xKiro"))(m,t,g,i,o,f,it(t),x,r);else if(l==="CoArena"||l==="coarena")P=(await me("CoArena"))(m,t,g,i,o,f,it(t),x,r);else if(l==="c_openai"||l==="Custom (OpenAI)"){let F=e.systemSettings?.customOpenAIBaseUrl||"";try{F=await Vi("c_openai")||F}catch{}P=(await me("c_openai"))(m,t,g,i,o,f,it(t),x,r,F)}else{let F=Sa(m),{serviceTier:G,cleanModel:$}=Ta(t),L={systemInstruction:i,temperature:r,thinkingConfig:(()=>{let Ae=(t||"").toLowerCase(),Ne=Ae.includes("gemma-4")||Ae.startsWith("gemma"),et=Ae.includes("gemini-3");if(Ne||et)return Ne?o.toLowerCase()!=="xhigh"?{includeThoughts:!1,thinkingLevel:Ye.MINIMAL}:{includeThoughts:!0,thinkingLevel:Ye.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:Ae.includes("pro")?Ye.LOW:Ye.MINIMAL,Low:Ye.LOW,Medium:Ye.MEDIUM,Standard:Ye.MEDIUM,High:Ye.HIGH,xHigh:Ye.HIGH}[o]||Ye.MEDIUM};{let U={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[o]||2048;return U===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:U}}})()};G&&(L.serviceTier=G),P=await F.models.generateContentStream({model:$,contents:g,config:L},{signal:x})}for await(let F of P){if(xt)throw new Error("Subagent task was cancelled.");if(e?.taskId&&typeof Ht<"u"){let L=Ht.find(Te=>Te.id===e.taskId);if(L&&L.status==="cancelled")throw new Error("Subagent task was cancelled.")}C===null&&(F.candidates?.[0]?.content?.parts||F.text)&&(C=Date.now()-Xe);let G="";if(F.candidates?.[0]?.content?.parts)for(let L of F.candidates[0].content.parts)L.text&&!L.thought&&(h+=L.text,G+=L.text);let $=G?Yi(G):0;e&&typeof e.onTokenChunk=="function"&&e.onTokenChunk(G,$),F.usageMetadata&&(p=F.usageMetadata)}}finally{clearInterval(I)}if(p){let P=p.totalTokenCount||0,F=p.cachedContentTokenCount||0,G=(p.candidatesTokenCount||0)+(l==="Google"&&p.thoughtsTokenCount||0);await hn("tokens",P,l,t),F>0&&await hn("cachedTokens",F,l,t),G>0&&await hn("candidateTokens",G,l,t),C!==null&&C>0&&await hn("ttft",C,l,t),ci({provider:l,model:t,prompt:p.promptTokenCount||0,cached:F,output:G,reasoning:p.thoughtsTokenCount||0,ttft:C}),e&&typeof e.onUsage=="function"&&e.onUsage({totalTokenCount:P,cachedContentTokenCount:F,candidatesTokenCount:G})}return await $t("agent",l),{text:h,usageMetadata:p}}),sf=async function*(e,t,n,i,o){let{profile:r,thinkingLevel:d,mode:l,janitorModel:m,chatId:f,isPlayground:h,systemSettings:p,sessionStats:g,aiProvider:s="Google",apiTier:x,wildcardTooling:I,wildercardTooling:Xe}=n,C=it(e);if(!Es&&s==="Google")throw new Error("AI not initialized");let P=!1,F=t[t.length-1].text,G=B.join(js,"chat-summaries.json"),$=!1,L=t.filter(U=>U.role==="user").length===1,Te=F.includes("[TITLE-UPDATE]"),Ae=L||Te,Ne=F.replace(/\[TITLE-UPDATE\]/g,"").trim();Ne=Ne.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),yield{type:"status",content:"[start]"},yield{type:"status",content:"Gathering Context"},await di.startTransaction(f,Ne),p?.advanceRollback&&await Mo.takeInitialSnapshot(f),xt=!1;let et=null;try{let U=new AbortController;et=setInterval(()=>{xt&&(U.abort(),et&&(clearInterval(et),et=null))},400);let w=[...t.slice(0,-1)];{let ue=pn(G,{})[f]||{summary:"",historyLength:0};if(ue.summary&&ue.historyLength>0){let kt=0,le=[];for(let K=0;K<w.length;K++){let Se=w[K];(Se.role==="user"||Se.role==="agent"||Se.role==="system")&&!String(Se.id).startsWith("welcome")&&!Se.isMeta&&kt++,kt>ue.historyLength&&le.push(Se)}w=le}}w=w.map(b=>{if(b.role==="user"&&b.text){let ue=b.text.match(/\[USER\]([\s\S]*?)\[\/USER\]/);if(ue)return{...b,text:ue[1].trim()}}return{...b}});let wn=process.env.GOOGLE_GEMMA_NONSENSE==="true"||process.env.GOOGLE_GEMMA_NONSENSE===!0||!1,Qt={"16k":16e3,"32k":32e3,"64k":64e3,"128k":128e3,"256k":256e3,"512k":512e3,"1M":1e6}[p?.contextLength]||256e3;if(s==="Google"&&e?.includes("gemma")&&wn&&(Qt=16e3),(g?.tokens||0)>Qt){yield{type:"text",content:"\u2726 Maximum Context Limit Reached. Start a new chat."};return}if(L&&P){let b=pn(Hi,{});Object.values(b).flat().length>5}let Me=pn(Hi,{}),Z=pn(Ks,{}),Ve=Object.entries(Me).filter(([b])=>b!==f).flatMap(([b,ue])=>ue),In=[...Object.entries(Z).filter(([b])=>b!==f).slice(-20).map(([b,ue])=>`[Chat Summary]: ${ue}`),...Ve].map(b=>`- ${b}`).join(`
|
|
557
|
+
`),bn=pn(si,[]).map(b=>`- ${b.memory}`).join(`
|
|
558
|
+
`),De=(g?.tokens||0)>=1e4,wt=new Date,Ft=wt.getFullYear(),Sn=wt.toLocaleString("en-US",{month:"short"}).toUpperCase(),cn=String(wt.getDate()).padStart(2,"0"),wo=`${wt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0})}`,j=b=>{try{return we.readdirSync(b,{withFileTypes:!0})}catch{return[]}},N=Array.from(new Set([..._o,...Io(process.cwd())])),Vn=(b,ue=6)=>p?.indentationTree!==!1?Ss(b,ue,1,j,N):Ts(b,ue,"",1,j,N),st=pn(ji,{}),k=st[f],ee=k?k!==process.cwd():!1;st[f]=process.cwd(),Ki(ji,st);let Je=pn(G,{}),Ce=Je[f]||{summary:"",historyLength:0};typeof Ce=="string"&&(Ce={summary:Ce,historyLength:0});let lt=t.filter(b=>(b.role==="user"||b.role==="agent"||b.role==="system")&&!String(b.id).startsWith("welcome")&&!b.isMeta).length;Ce.historyLength&<<Ce.historyLength&&(Ce.summary="",Ce.historyLength=0,Je[f]=Ce,Ki(G,Je));let ft=typeof Ce=="object"?Ce.summary||"":Ce||"",Zt=w.length>0;Zt&&ft&&w[0]&&(w[0].role==="user"||w[0].role==="system")&&(w[0].text.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")||(w[0].text=`[SYSTEM METADATA]
|
|
561
559
|
**CONTEXT SUMMARY OF PREVIOUS TURNS (PRIORITY: DYNAMIC)**
|
|
562
560
|
${ft}
|
|
563
561
|
|
|
564
|
-
[USER] ${
|
|
562
|
+
[USER] ${w[0].text}`,yield{type:"summary_injected",content:{id:w[0].id,text:w[0].text}}));let dn=ft&&!Zt?`
|
|
565
563
|
[SYSTEM METADATA]
|
|
566
564
|
**CONTEXT SUMMARY OF PREVIOUS TURNS**
|
|
567
565
|
${ft}
|
|
568
|
-
`:"",kn=!!p?.dynamicDirAwareness,_s=`${
|
|
566
|
+
`:"",kn=!!p?.dynamicDirAwareness,_s=`${f}|${s}|${d}|${e}|${r}|${kn}`,Aa=!kn&&no.key===_s&&no.value?"":`
|
|
569
567
|
**Directory**
|
|
570
568
|
CWD: `+process.cwd()+`${h?" [PLAYGROUND MODE]":""}
|
|
571
|
-
`+
|
|
569
|
+
`+Vn(process.cwd(),6),Ot=yo()?await to():null,Is=b=>{if(!b||!Array.isArray(b)||b.length===0)return null;let ue=new Map;for(let le of b){let K=le.relPath||(le.file?B.relative(process.cwd(),le.file):"unknown");ue.has(K)||ue.set(K,[]),ue.get(K).push(le)}let kt=[];for(let[le,K]of ue.entries()){kt.push(`- ${le}:`);for(let Se of K){let Pe=(Se.snippet||"").trim().replace(/\r?\n/g," "),tt=Se.line||1,Bt=(Se.text||"").trim().replace(/\r?\n+/g,". "),Tt=Bt?` [${Bt}]`:"";kt.push(` ~L${tt}${Tt}`)}}return kt.join(`
|
|
572
570
|
`)},Pi=Is(Ot?.comments),Tn="";if(Ot&&Ot.file_focused!=="none"){Tn=`
|
|
573
571
|
[Additional IDE Context]
|
|
574
|
-
`;let b=B.relative(process.cwd(),Ot.file_focused),ue=(Ot.opened_editors||[]).map(le=>{let
|
|
572
|
+
`;let b=B.relative(process.cwd(),Ot.file_focused),ue=(Ot.opened_editors||[]).map(le=>{let K=B.relative(process.cwd(),le);return K.startsWith("..")?`[External] ${B.basename(le)}`:K});if(Tn+=`Focused File: ${b}
|
|
575
573
|
Cursor Line: ${Ot.cursor_line}
|
|
576
|
-
`,Ot.selected){let le=Ot.selected,
|
|
577
|
-
`);
|
|
574
|
+
`,Ot.selected){let le=Ot.selected,K=le.split(`
|
|
575
|
+
`);K.length>256&&(le=K.slice(0,240).join(`
|
|
578
576
|
`)+`
|
|
579
577
|
... [truncated] ...
|
|
580
|
-
`+
|
|
578
|
+
`+K.slice(-16).join(`
|
|
581
579
|
`)),le.length>2048&&(le=le.slice(0,1920)+`
|
|
582
580
|
... [truncated] ...
|
|
583
581
|
`+le.slice(-128)),Tn+=`Current Selection: "${le}"
|
|
584
582
|
`}if(Ot.manual_edits){let le=Ot.manual_edits.split(`
|
|
585
|
-
`),
|
|
586
|
-
${
|
|
583
|
+
`),K=[];for(let Se=0;Se<le.length;Se++){let Pe=le[Se],tt=le[Se+1],Bt=le[Se+2];if(tt!==void 0&&Bt!==void 0&&/:\s*$/.test(Pe)&&/^\s*-\s*/.test(tt)&&/^\s*\+\s*/.test(Bt)&&(tt.length>300||Bt.length>300)){K.push(Pe.replace(/:\s*$/,": [changed]")),Se+=2;continue}K.push(Pe)}Tn+=`Recent Manual Edits:
|
|
584
|
+
${K.join(`
|
|
587
585
|
`)}
|
|
588
586
|
`}ue.length>0&&(Tn+=`All Opened Editors: ${ue.join(", ")}`),Ot.diagnostics&&(Tn+=`
|
|
589
587
|
**Active File Errors**:
|
|
@@ -591,12 +589,12 @@ ${Ot.diagnostics}
|
|
|
591
589
|
`),(Ne.toLowerCase().includes("lint")||Ne.toLowerCase().includes("warning"))&&Ot.warnings&&(Tn+=`
|
|
592
590
|
**Lint Warnings**:
|
|
593
591
|
${Ot.warnings}
|
|
594
|
-
`)}let Ms=Ne.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),Ps=/(?:\\)?@\[([^\]]+)\]/g,$i,Li=[];for(Ps.lastIndex=0;($i=Ps.exec(Ms))!==null;){let b=$i[0].startsWith("\\");Li.push({tag:$i[1],isEscaped:b})}let Oi=[],zo=null,qo=!1;for(let b=0;b<Li.length;b++){let{tag:ue,isEscaped:kt}=Li[b];if(!kt)try{let le=ue.trim().replace(/^["']|["']$/g,""),
|
|
595
|
-
`);yield{type:"visual_feedback",content:Lt(`${
|
|
596
|
-
`)};continue}if(tt===null&&!je){let
|
|
597
|
-
`)};continue}}let
|
|
598
|
-
`)};continue}let
|
|
599
|
-
`);yield{type:"visual_feedback",content:Lt(`${
|
|
592
|
+
`)}let Ms=Ne.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),Ps=/(?:\\)?@\[([^\]]+)\]/g,$i,Li=[];for(Ps.lastIndex=0;($i=Ps.exec(Ms))!==null;){let b=$i[0].startsWith("\\");Li.push({tag:$i[1],isEscaped:b})}let Oi=[],zo=null,qo=!1;for(let b=0;b<Li.length;b++){let{tag:ue,isEscaped:kt}=Li[b];if(!kt)try{let le=ue.trim().replace(/^["']|["']$/g,""),K=/[:#]L?(\d+)(?:-L?(\d+))?$/i,Se=le.match(K),Pe=le,tt=null,Bt=null;Se&&(tt=parseInt(Se[1],10),Bt=Se[2]?parseInt(Se[2],10):tt,Pe=le.slice(0,Se.index));let Tt=B.resolve(process.cwd(),Pe);if(we.existsSync(Tt)&&we.statSync(Tt).isFile()){let Ut=Pe.toLowerCase(),bo=Ut.endsWith(".pdf"),qn=Ut.endsWith(".docx")||Ut.endsWith(".doc")||Ut.endsWith(".ppt")||Ut.endsWith(".pptx")||Ut.endsWith(".xls")||Ut.endsWith(".xlsx"),Yn=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(Ut),je=Yn||bo||qn,Et=s==="Google"||it(e);if(je&&!Et){let pe=`\u2718 Unsupported Modality: ${B.basename(Pe)}`,Qe=115;process.stdout.isTTY&&(Qe=process.stdout.columns-5||120);let _t=[pe],Fe=Math.max(..._t.map(nn=>nn.length)),te=Math.min(Fe+4,Qe),Be=_t.map(nn=>`${nn.padEnd(te-2).substring(0,te-2)}`).join(`
|
|
593
|
+
`);yield{type:"visual_feedback",content:Lt(`${Be}
|
|
594
|
+
`)};continue}if(tt===null&&!je){let pe=0;try{pe=we.readFileSync(Tt,"utf8").split(/\r\n|\r|\n/).length}catch{}if(pe>150){let Qe=`\u21B7 Skipped (Too Large): ${B.basename(Pe)}`,_t=115;process.stdout.isTTY&&(_t=process.stdout.columns-5||120);let Fe=Math.min(Qe.length+4,_t),te=Qe.padEnd(Fe-2).substring(0,Fe-2);yield{type:"visual_feedback",content:Lt(`${te}
|
|
595
|
+
`)};continue}}let Pn=tt!==null?tt:1,Wt=Bt!==null?Bt:tt!==null?tt:Pn+149;if(Wt-Pn>200){let pe=`\u21B7 Skipped (Too Large): ${B.basename(Pe)}`,Qe=115;process.stdout.isTTY&&(Qe=process.stdout.columns-5||120);let _t=Math.min(pe.length+4,Qe),Fe=pe.padEnd(_t-2).substring(0,_t-2);yield{type:"visual_feedback",content:Lt(`${Fe}
|
|
596
|
+
`)};continue}let Xn=`path=${JSON.stringify(Pe)}, startLine=${Pn}, endLine=${Wt}`,Gt=await tr(Xn,{isMultiModal:Et}),$n=!1,ro="",bt=null;if(typeof Gt=="string"?Gt.trim().startsWith("ERROR")?$n=!0:ro=Gt:Gt&&typeof Gt=="object"&&Gt.binaryPart?(bt=Gt.binaryPart,ro=Gt.text||""):$n=!0,!$n){let pe="";if(Yn?(pe=`\u2714 Processed: ${B.basename(Pe)}`,zo=bt,qo=!0):bo||qn?(pe=`\u2714 Auto-Analysed: ${B.basename(Pe)}`,zo=bt,qo=!0):(pe=`\u2714 Auto-Read: ${B.basename(Pe)}`,Oi.push(ro)),pe){let Qe=115;process.stdout.isTTY&&(Qe=process.stdout.columns-5||120);let _t=[pe],Fe=Math.max(..._t.map(nn=>nn.length)),te=Math.min(Fe+4,Qe),Be=_t.map(nn=>`${nn.padEnd(te-2).substring(0,te-2)}`).join(`
|
|
597
|
+
`);yield{type:"visual_feedback",content:Lt(`${Be}
|
|
600
598
|
`)}}}}}catch{}}let Yo="";Oi.length>0?Yo=`
|
|
601
599
|
[Tagged File Contents] Auto Read User Tagged files by System${qo?", attached below & multimodal part":""}. No need to re-read
|
|
602
600
|
`+Oi.join(`
|
|
@@ -605,9 +603,9 @@ ${Ot.warnings}
|
|
|
605
603
|
[Tagged File Contents]
|
|
606
604
|
`:qo&&(Yo=`
|
|
607
605
|
[Tagged File Contents] Auto Read User Tagged files by System & attached as multimodal part. No need to re-read [Tagged File Contents]
|
|
608
|
-
`);let
|
|
606
|
+
`);let Ue=Ms.replace(/\\(@\[[^\]]+\])/g,"$1"),$s=I?`You cannot execute tools. Instead write the action string in chat you WOULD have written, without markdown wrappers. Then wait for systtem response
|
|
609
607
|
`:"",Ca=process.env.forcedReasoning||!1,Ls=d!=="Fast"&&(s==="Mistral"&&!ai(e)||d!=="High"&&s==="Google")?`${s==="Mistral"&&!ai(e)||e.toLowerCase().startsWith("gemma")||Ca?`[system] strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow> [/system]
|
|
610
|
-
`:""}`:"",
|
|
608
|
+
`:""}`:"",so="";if(p?.clipboardContext)try{process.platform==="win32"?so=As("powershell.exe -NoProfile -Command Get-Clipboard",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):process.platform==="darwin"?so=As("pbpaste",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):so=As("xclip -selection clipboard -o || xsel --clipboard --output",{encoding:"utf8",shell:!0,stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,"")}catch{so=""}let Xo="",Ra=!!p?.autoExcludeMetadata,Os=!1,Ns=!1,Ni="";if(Ue.startsWith("/skill create ")||Ue==="/skill create"){let b=null;Os=!0,Ue=Ue.replace(/^\/skill\s+create\b/,"").trim(),/^--project(\s|$)|(\s|^)--project$/.test(Ue)?b="project":/^--global(\s|$)|(\s|^)--global$/.test(Ue)&&(b="global"),Ue=Ue.replace(/^--project\s*|\s*--project$/g,"").trim(),Ue=Ue.replace(/^--global\s*|\s*--global$/g,"").trim(),Ue=Ue.replace(/^(['"])([\s\S]*)\1$/,"$2").trim(),Ni=`[system] ## Skill Creation Rules
|
|
611
609
|
* ${b?b==="project"?`Creation path: ./skills/skillName?/SKILL.md
|
|
612
610
|
* If skills folder already present, ReadFolder for existing structure`:"Creation path: ~/.fluxflow/skills/skillName/SKILL.md":`Extract skill scope, global/project. If not given AskUser. Project scope: ./skills/skillName?/SKILL.md. Global scope: ~/.fluxflow/skills/skillName/SKILL.md
|
|
613
611
|
* If skills folder already present, ReadFolder for existing structure`}
|
|
@@ -621,84 +619,84 @@ description: concise detail to explain the skill
|
|
|
621
619
|
- Write relative link to this .md in SKILL.md with concise description about content of that reference
|
|
622
620
|
* Similar skill loaded in your prompt? AskUser & offer extending it. If agreed tell them to use \`/skill edit --skillName ...\` and end your turn
|
|
623
621
|
* For any ambiguity AskUser
|
|
624
|
-
* After creation, tell user to restart fluxflow for reindexing${(
|
|
622
|
+
* After creation, tell user to restart fluxflow for reindexing${(g?.tokens||0)>24576?`
|
|
625
623
|
* Warn: This session is currently long, and reindexing will cause full cache invalidation`:""}
|
|
626
624
|
[/system]
|
|
627
|
-
`}else if(
|
|
625
|
+
`}else if(Ue.startsWith("/skill edit ")||Ue==="/skill edit"){Ns=!0,Ue=Ue.replace(/^\/skill\s+edit\b/,"").trim();let b=null,ue=Ue.match(/^--([^\s]+)(?:\s|$)/);if(ue)b=ue[1],Ue=Ue.slice(ue[0].length).trim();else{let K=Ue.match(/(?:\s|^)--([^\s]+)$/);K&&(b=K[1],Ue=Ue.slice(0,K.index).trim())}Ue=Ue.replace(/^(['"])([\s\S]*)\1$/,"$2").trim();let kt=null,le=null;if(b){let K=b.toLowerCase(),Se=[...yi||[],...hi||[]].find(Pe=>Pe&&Pe.name&&Pe.name.toLowerCase()===K);Se&&Se.filePath&&(le=B.resolve(Se.filePath),kt=B.dirname(le))}Ni=`[system] ## Skill Modification Rules
|
|
628
626
|
${kt&&b?`* Target Skill: ${b}
|
|
629
627
|
* Physical Skill path: ${le}
|
|
630
628
|
* Skill will have a SKILL.md at this path. And may have lazy loaded *.md files in folders
|
|
631
629
|
* Extract requirements, use file tools with physical disk path
|
|
632
630
|
* Maintain existing conventions, and modify based on requirements
|
|
633
631
|
* Any ambiguity AskUser
|
|
634
|
-
* After completion tell user no reindexing needed, will be auto updated on next #skill read if frontmatter stays same${(
|
|
632
|
+
* After completion tell user no reindexing needed, will be auto updated on next #skill read if frontmatter stays same${(g?.tokens||0)>24576?`
|
|
635
633
|
* Warn: This session is currently long, if name, description is changed reindex is needed, and will cause a full cache invalidation`:""}`:"- User didnt provided any structured skill name to modify. Tell them to use proper syntax: `/skill edit --skillName instructions`"}
|
|
636
634
|
[/system]
|
|
637
|
-
`}let va=!!(Tn||Yo||$s||
|
|
635
|
+
`}let va=!!(Tn||Yo||$s||dn||Ls||ee||p?.dynamicDirAwareness||p?.autoTruncateResults||Os||Ns);Ra&&!va?Xo=Ue.trim():Xo=`[System Metadata] Time: ${wo}${ee?`
|
|
638
636
|
WARNING: CWD Changed from previous: "${k}" to current: "${process.cwd()}", write change in chat to avoid future path mismatches
|
|
639
637
|
`:""}${Tn}
|
|
640
|
-
${
|
|
641
|
-
- ${
|
|
638
|
+
${so.trim().length>0?`[Clipboard Context]
|
|
639
|
+
- ${so.trim()}
|
|
642
640
|
`:""}${Pi?`[Additional Comments]
|
|
643
641
|
${Pi.trimEnd()}
|
|
644
642
|
`:""}Action format: [action:ActionName(...)]
|
|
645
643
|
[/Metadata]
|
|
646
|
-
${
|
|
644
|
+
${dn}${Ls}${Yo}${Ni}${$s}[user prompt] ${Ue.trim()} [/user prompt]`.trim();let Ds={role:"user",text:Xo};zo&&(Ds.binaryPart=zo),w.forEach(b=>{b.text&&b.role==="agent"&&(b.text=jt(b.text))}),w.push(Ds),dn&&t[t.length-1]?.id&&(yield{type:"summary_injected",content:{id:t[t.length-1].id,text:Xo}});let en=null,tn=l==="Flux"?50:15;tn=l.toLowerCase().includes("cu")?75:tn;let Fs=(p?.loopLimits||"Default").toLowerCase();if(Fs==="extended")tn=Math.floor(tn*3);else if(Fs==="env"){let b=parseInt(process.env.FLUXFLOW_MAX_LOOPS||process.env.MAX_LOOPS||"",10);Number.isFinite(b)&&b>0&&(tn=b)}let Ea=Math.floor(tn/2),Bs=0,fn=16;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Consulting the spirits":"Connecting"},xt=!1;let Di=[],Jo=!1,Us=!1,zn=[],Fi=!1;for(let b=0;b<=tn;b++){let ue=Math.floor(tn*.95);if(b>=ue&&Bs<ue&&typeof n?.onAskUser=="function"){Bs=ue;try{let H="Agent has been running for a long time. Do you want to continue execution?",X=[{id:"continue",label:"Continue",description:"Add few more steps"},{id:"cancel",label:"Cancel",description:"Stop extending and finish current turn limit"}],E=await n.onAskUser(H,X);E&&(E.toLowerCase().includes("continue")||E==="Continue")&&(tn+=Ea)}catch{}}if(zn.length>=10&&typeof n?.onAskUser=="function"){let H={},X=null;for(let E of zn)if(H[E]=(H[E]||0)+1,H[E]>=10){X=E;break}if(X)try{let E="Agent seems stuck in a tool loop. You can prompt it to steer or break the loop:",gt=[{id:"continue",label:"Continue Anyway",description:"Ignore warning and let it proceed"},{id:"stop",label:"Stop Loop",description:"Force agent to summarize progress and stop repeating"}],de=await n.onAskUser(E,gt);if(de){let We="";typeof de=="string"&&(de.toLowerCase()==="stop"||de.includes("Stop Loop"))?We="Stop repeating the same action call. Acknowledge what failed or succeeded, summarize your current findings, and conclude.":typeof de=="string"&&(de.toLowerCase()==="continue"||de.includes("Continue Anyway"))?zn=zn.filter(At=>At!==X):We=typeof de=="string"?de:de?.label||de?.id||"",We&&(w.length>0&&w[w.length-1].role==="user"?w[w.length-1].text+=`
|
|
647
645
|
|
|
648
|
-
[STEERING HINT from USER, High Priority] ${We.trim()} [/STEERING HINT]`:
|
|
646
|
+
[STEERING HINT from USER, High Priority] ${We.trim()} [/STEERING HINT]`:w.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${We.trim()} [/STEERING HINT]`}),yield{type:"status",content:"Steering Hint Injected..."},zn=zn.filter(At=>At!==X))}}catch{}}let kt=await qi("agent",n);if(!kt.allowed)throw new Error(kt.reason||`Budget Exhausted for Provider (${s||"Agent"})`);let le=[];if(Jo=!1,(l==="ICU"||l==="FluxCU")&&!Fi)try{yield{type:"status",content:"Capturing Screen"},await new Promise(E=>setTimeout(E,1e3));let{captureGriddedScreenshot:H}=await import("./screen_grid-PHZTVWOJ.js"),X=await H();if(X&&X.base64){let E="[system] Fresh Gridded Screen Feedback Captured. Use numeric coordinates. Old screenshots will be removed when new screenshot is captured, summarize in text if context is needed later [/system]",gt={inlineData:{mimeType:X.mimeType,data:X.base64}},de=p?.imageHistoryCU||"Standard",We=de==="Low"?3:de==="Extended"?10:de==="Max"?999:5,At=w.filter(ge=>Array.isArray(ge.parts)&&ge.parts.some(St=>St.inlineData));if(At.length>=We){let ge=At.length-We+1;for(let St=0;St<ge;St++){let nt=At[St];Array.isArray(nt.parts)&&(nt.parts=nt.parts.filter(mt=>!mt.inlineData))}}if(w.length>0&&w[w.length-1].role==="user"){let ge=w[w.length-1];typeof ge.text=="string"&&(ge.text+=`
|
|
649
647
|
|
|
650
|
-
${E}`,Array.isArray(ge.parts)||(ge.parts=[{text:ge.text}]),ge.parts.push(gt))}else
|
|
648
|
+
${E}`,Array.isArray(ge.parts)||(ge.parts=[{text:ge.text}]),ge.parts.push(gt))}else w.push({role:"user",text:E,parts:[{text:E},gt]})}}catch(H){console.error("Vision screenshot capture error:",H)}if(Fi=!1,b>0?yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Haunting":"Working"}:yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Consulting the spirits":"Connecting"},xt){try{let{clearPendingNudges:H}=await import("./subagent_state-LZCOZSUJ.js");H()}catch{}yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
|
|
651
649
|
|
|
652
650
|
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}try{let{consumePendingNudges:H}=await import("./subagent_state-LZCOZSUJ.js"),X=H();if(X&&X.length>0){let E=X.join(`
|
|
653
651
|
|
|
654
|
-
`);
|
|
652
|
+
`);w.length>0&&w[w.length-1].role==="user"?w[w.length-1].text+=`
|
|
655
653
|
|
|
656
|
-
${E}`:
|
|
654
|
+
${E}`:w.push({role:"user",text:E}),yield{type:"status",content:"Subagent Update"}}}catch{}if(i){let H=await i();H&&(H.startsWith("/btw")?w.length>0&&w[w.length-1].role==="user"?w[w.length-1].text+=`
|
|
657
655
|
|
|
658
656
|
[system] User question. Resolve this specific query within '[ANSWER]...[/ANSWER]' concisely, naturally [/system]
|
|
659
|
-
[question] ${H.replace("/btw","").trim()} [/question]`:
|
|
660
|
-
[question] ${H.replace("/btw","").trim()} [/question]`}):
|
|
657
|
+
[question] ${H.replace("/btw","").trim()} [/question]`:w.push({role:"user",text:`[system] User question. Resolve this specific query within '[ANSWER]...[/ANSWER]' concisely, naturally [/system]
|
|
658
|
+
[question] ${H.replace("/btw","").trim()} [/question]`}):w.length>0&&w[w.length-1].role==="user"?w[w.length-1].text+=`
|
|
661
659
|
|
|
662
|
-
[STEERING HINT from USER, High Priority] ${H.trim()} [/STEERING HINT]`:
|
|
660
|
+
[STEERING HINT from USER, High Priority] ${H.trim()} [/STEERING HINT]`:w.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${H.trim()} [/STEERING HINT]`}),yield{type:"status",content:`${H.startsWith("/btw")?"Question Forwarded...":"Steering Hint Injected..."}`})}let K,Se=!1,Pe=1,tt=1,Bt=Date.now(),Tt=null,be="",Ut=null,bo=null,qn=null,Yn=0,je=[],Et=0,Pn=!1,Wt=!1,Xn=!1,Gt=!1,$n=!0,ro=0,bt="",pe="",Qe=!1,_t=!1,Fe=!0,te=e,Be="",nn=d;for(d=d.toLowerCase()==="max"?"High":d;Pe<=fn&&tt<=fn&&!Se&&!xt;){let H=!1;try{be="",$n&&(process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07"),yield{type:"turn_reset",content:!0},$n=!1,tt===1&&(bt=""));let X=u=>{if(!u||typeof u!="string")return u;let S="",T=Rs(u);if(T&&(S=T.fullBlock,u=T.remainingText),!u.includes("[tool:")&&!u.includes("[action:"))return(p?.keepReasoningContext?S:"")+u;if(Kn(u).length===0){let y=_i(u);return(p?.keepReasoningContext?S:"")+y}u=u.replace(El,(y,A)=>A.includes("[tool:")||A.includes("[action:")?A.trim():y);let ie="",M=0,z=[],yt="";for(;M<u.length;){let y=u.indexOf("[tool:",M),A=u.indexOf("[action:",M),ne=-1;if(y!==-1&&A!==-1?ne=Math.min(y,A):y!==-1?ne=y:ne=A,ne===-1){z.length===0&&(ie+=_i(u.substring(M)));break}if((ne>0?u[ne-1]:"")==="`"){ie+=_i(u.substring(M,ne+1)),M=ne+1;continue}z.length===0&&(yt=_i(u.substring(M,ne)));let J=-1,v=null,Ct=0;for(let It=ne;It<u.length;It++){let ut=u[It];if(v){if(ut===v){let Ze=0;for(let se=It-1;se>=0&&u[se]==="\\";se--)Ze++;Ze%2===0&&(v=null)}}else if(ut==='"'||ut==="'"||ut==="`")v=ut;else if(ut==="(")Ct++;else if(ut===")")Ct--;else if(ut==="]"&&Ct<=0){J=It;break}}if(J===-1){z.length===0&&(ie+=u.substring(ne));break}let On=u.substring(ne,J+1);z.push(On),M=J+1}return z.length>0&&(ie=yt.trimEnd()?yt.trimEnd()+`
|
|
663
661
|
|
|
664
|
-
`+
|
|
662
|
+
`+z.join(`
|
|
665
663
|
|
|
666
|
-
`):
|
|
664
|
+
`):z.join(`
|
|
667
665
|
|
|
668
|
-
`)),(p?.keepReasoningContext?S:"")+ie},E=
|
|
666
|
+
`)),(p?.keepReasoningContext?S:"")+ie},E=w.filter(u=>(u.role==="user"||u.role==="agent"||u.role==="system")&&!String(u.id).startsWith("welcome")&&!u.isMeta&&!u.isTerminalRecord&&!(u.text&&u.text.startsWith("[TERMINAL_RECORD]"))).map((u,S,T)=>{let V=u.text||"";P||(V=V.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),u.role==="agent"&&(V=X(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 ie=[];return Array.isArray(u.parts)&&u.parts.length>0?ie=u.parts.map(M=>{if(M.text){let z=M.text;return P||(z=z.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),u.role==="agent"&&(z=X(z),z=z.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),z=z.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*")),{text:z}}return M}):ie=[{text:V}],u.binaryPart&&it(te)&&T.slice(S+1).filter(z=>z.role==="user"&&!z.text?.startsWith("[ACTION RESULT]")&&!z.text?.startsWith("[TOOL RESULT]")).length<=2&&ie.push(u.binaryPart),{role:u.role==="user"||u.role==="system"?"user":"model",parts:ie}});for(let u=E.length-2;u>=0;u--){let S=E[u],T=E[u+1];S.role==="user"&&T.role==="user"&&(T.parts?.[0]?.text||"").trim().startsWith("[SYSTEM")&&E.splice(u,1)}let gt=[];for(let u=0;u<E.length;u++){let S=E[u];if(gt.length===0)gt.push(S);else{let T=gt[gt.length-1];T.role===S.role?(T.parts[0].text+=`
|
|
669
667
|
|
|
670
|
-
`+(S.parts?.[0]?.text||""),S.parts?.length>1&&T.parts.push(...S.parts.slice(1))):gt.push(S)}}for(let
|
|
668
|
+
`+(S.parts?.[0]?.text||""),S.parts?.length>1&&T.parts.push(...S.parts.slice(1))):gt.push(S)}}for(let u of gt)for(let S of u.parts||[])S&&typeof S.text=="string"&&(S.text.includes("[action:")||S.text.includes("[tool:"))&&(S.text=S.text.replace(/```(?:[a-zA-Z0-9_-]+)?\s*\n?(\[(?:action|tool):[\s\S]*?\)\s*\])\n?```/gi,"$1"),S.text=S.text.replace(/`(\[(?:action|tool):[\s\S]*?\)\s*\])`/gi,"$1"));E.length=0,E.push(...gt),te=e;let de=`${f}|${s}|${l}|${d}|${nn}|${te}|${JSON.stringify(r)}|${!!p?.dynamicDirAwareness}|${!!p?.subAgents}|${process.env.rawReasoning==="true"}`,We=no.key===de&&no.value;if((process.env.I_HAVE_TOO_MUCH_MONEY==="true"||process.env.I_HAVE_TOO_MUCH_MONEY===!0)&&(We=!1),We)Be=no.value;else{let u=s==="Mistral"?!!ai(te):!(te||"gemma").toLowerCase().startsWith("gemma");Be=Fr(r,((te||"gemma").toLowerCase().startsWith("gemma"),nn),l,p,P,L,s,s==="Google"?!0:C,u,f,!!p?.keepReasoningContext,te),p?.dynamicDirAwareness||(Be+=`
|
|
671
669
|
${Aa.replace(`
|
|
672
670
|
**Directory**`,`
|
|
673
|
-
-- Directory --`)}`),
|
|
671
|
+
-- Directory --`)}`),no.key=de,no.value=Be}let ge=E[E.length-1];if(yo()&b>0){await new Promise(V=>setTimeout(V,2500)),yield{type:"status",content:"Verifying"};let u=await to(),S=u?u.diagnostics:null,T=Is(u?.comments);S&&ge&&ge.role==="user"&&ge.parts?.[0]?.text&&(ge.parts[0].text+=`
|
|
674
672
|
|
|
675
673
|
${S}`),Pi&&ge&&ge.role==="user"&&ge.parts?.[0]?.text&&(ge.parts[0].text+=`
|
|
676
674
|
|
|
677
675
|
[Additional Comments]
|
|
678
|
-
${T}`),yield{type:"status",content:"Working"}}let
|
|
676
|
+
${T}`),yield{type:"status",content:"Working"}}let St=s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma");if(p?.advanceRollback&&ge&&ge.role==="user"&&(ge.parts?.[0]?.text?.startsWith("[ACTION RESULT]")||ge.parts?.[0]?.text?.startsWith("[TOOL RESULT]")))try{let u=await Mo.getLatestFileChanges(f);if(u&&(u.newFiles.length>0||u.modifiedFiles.length>0||u.deletedFiles.length>0)){let S=`
|
|
679
677
|
[system] File Changes:
|
|
680
|
-
`;for(let
|
|
681
|
-
`;for(let
|
|
682
|
-
`;for(let
|
|
683
|
-
`;S+="[/system]",ge.parts[0].text+=S;let T=-1;for(let
|
|
684
|
-
[system] WARNING, Turn Limit Impending: Step ${mt}/${
|
|
678
|
+
`;for(let V of u.newFiles)S+=`* ${V} (created)
|
|
679
|
+
`;for(let V of u.modifiedFiles)S+=`* ${V} (modified)
|
|
680
|
+
`;for(let V of u.deletedFiles)S+=`* ${V} (deleted)
|
|
681
|
+
`;S+="[/system]",ge.parts[0].text+=S;let T=-1;for(let V=w.length-1;V>=0;V--)if(w[V].role==="user"&&(w[V].text?.startsWith("[ACTION RESULT]")||w[V].text?.startsWith("[TOOL RESULT]"))){T=V;break}T!==-1&&(w[T].text+=S)}}catch{}let nt=Math.floor(tn*.99),mt=b+1;if(mt>=nt&&ge&&ge.parts?.[0]&&(ge.parts[0].text+=`
|
|
682
|
+
[system] WARNING, Turn Limit Impending: Step ${mt}/${tn}. Wrap up quickly/prompt user to continue. [/system]`),process.env.LOG_CHAT==="true"||process.env.LOG_CHAT==="1"||process.env.LOG_CHAT===!0||!1){let u=B.join(eo,"chats",String(f));we.existsSync(u)||we.mkdirSync(u,{recursive:!0}),we.writeFileSync(B.join(u,"context.json"),JSON.stringify({contents:E},null,2)),we.writeFileSync(B.join(u,"system.md"),`${We?"CACHED":"NOT CACHED"}
|
|
685
683
|
Key: ${de}
|
|
686
684
|
--------------------------------------------------------------------
|
|
687
685
|
|
|
688
|
-
${
|
|
686
|
+
${Be}`)}let rt=new Promise((u,S)=>{U.signal.aborted&&S(new DOMException("The user aborted a request.","AbortError")),U.signal.addEventListener("abort",()=>{S(new DOMException("The user aborted a request.","AbortError"))})});rt.catch(()=>{});let $e=E;if(Bt=Date.now(),s==="Ollama")K=(await me("Ollama"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1,p?.ollamaEndpoint||"Cloud");else if(s==="OpenRouter")K=(await me("OpenRouter"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1,f);else if(s==="DeepSeek")K=(await me("DeepSeek"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="Mistral")K=(await me("Mistral"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1,f);else if(s==="NVIDIA"){let u=(await me("NVIDIA"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);K=(await me("NVIDIA_wrap"))(u,te)}else if(s==="InferX")K=(await me("InferX"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="SenseNova")K=(await me("SenseNova"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="AIHubMix")K=(await me("AIHubMix"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="Poolside")K=(await me("Poolside"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="9router"||s==="9Router")K=(await me("NineRouter"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="ExpLabs"||s==="ExperientialLabs")K=(await me("ExpLabs"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="Infron"||s==="infron")K=(await me("Infron"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="TokenHarbor"||s==="Token Harbor"||s==="tokenharbor"||s==="token_harbor"||s==="thk")K=(await me("TokenHarbor"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="APInex"||s==="apinex"||s==="apx")K=(await me("APInex"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="xKiro"||s==="xkiro"||s==="kiro")K=(await me("xKiro"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="CoArena"||s==="coarena")K=(await me("CoArena"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1);else if(s==="c_openai"||s==="Custom (OpenAI)"){let u=p?.customOpenAIBaseUrl||"";try{u=await Vi("c_openai")||u}catch{}K=(await me("c_openai"))(n.apiKey,te,$e,Be,d,l,C,U.signal,1,u)}else{let u=Sa(n?.apiKey),{serviceTier:S,cleanModel:T}=Ta(te),V={systemInstruction:Be,mediaResolution:"MEDIA_RESOLUTION_HIGH",safetySettings:[{category:Ei.HARM_CATEGORY_HARASSMENT,threshold:vi.BLOCK_NONE},{category:Ei.HARM_CATEGORY_HATE_SPEECH,threshold:vi.BLOCK_NONE},{category:Ei.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:vi.BLOCK_NONE},{category:Ei.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:vi.BLOCK_NONE}],temperature:1.05,thinkingConfig:(()=>{let M=er("Google",te||"gemini-3-flash-preview",d);if(M!==null){if(typeof M=="object")return M;if(M===!1||M==="false"||M==="none"||M===0||M==="0")return{includeThoughts:!1};if(typeof M=="number")return{includeThoughts:!0,thinkingBudget:M};if(typeof M=="string"){let A=M.toLowerCase();if(A==="minimal")return{includeThoughts:!0,thinkingLevel:Ye.MINIMAL};if(A==="low")return{includeThoughts:!0,thinkingLevel:Ye.LOW};if(A==="medium")return{includeThoughts:!0,thinkingLevel:Ye.MEDIUM};if(A==="high")return{includeThoughts:!0,thinkingLevel:Ye.HIGH};let ne=Number(M);if(!isNaN(ne))return{includeThoughts:!0,thinkingBudget:ne}}}let z=(te||"").toLowerCase(),yt=z.includes("gemma-4")||z.startsWith("gemma"),y=z.includes("gemini-3");if(yt||y)return yt?d.toLowerCase()!=="high"?{includeThoughts:!1,thinkingLevel:Ye.MINIMAL}:{includeThoughts:!0,thinkingLevel:Ye.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:z.includes("pro")?Ye.LOW:Ye.MINIMAL,Low:Ye.LOW,Medium:Ye.MEDIUM,Standard:Ye.MEDIUM,High:Ye.HIGH,xHigh:Ye.HIGH}[d]||Ye.MEDIUM};{let A={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[d]||2048;return A===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:A}}})()};S&&(V.serviceTier=S);let ie=u.models.generateContentStream({model:T||"gemini-3-flash-preview",contents:$e,config:V},{signal:U.signal});K=await Promise.race([ie,rt])}be="",Ut=null,qn=null,je=[],Et=0,yield{type:"model_update",content:null},pe="",Qe=bt.length>0;let pt="",Qo=Date.now(),un=async function*(){if(s==="Google"&&pt){let u=ko(pt);for(let S of u)yield S;pt="",Qo=Date.now()}},Ws=!0,An="",ao=!1,ht=null,Gs=!1,Qn=!1,lo=!1,Zo=!1,Ln=!1,So=u=>{let S=0;for(;S+2<u.length;)u[S]==="`"&&u[S+1]==="`"&&u[S+2]==="`"?(Zo=!Zo,S+=3):S++},Hs=u=>{if(!u)return;let S=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,T;for(;(T=S.exec(u))!==null;){let V=T[0].toLowerCase();V.startsWith("</")||V.startsWith("[/")||V==="<channel|>"?Ln=!1:Ln=!0}},$a={tool:{startPrefix:"[tool",fullPrefix:"[tool:",endTag:"]"},action:{startPrefix:"[action",fullPrefix:"[action:",endTag:"]"},end:{startPrefix:"[[END]]",fullPrefix:"[[END]]",endTag:"[[END]]"},kimi_section:{startPrefix:"<|tool_calls_section_begin|>",fullPrefix:"<|tool_calls_section_begin|>",endTag:"<|tool_calls_section_end|>"},kimi_call:{startPrefix:"<|tool_call_begin|>",fullPrefix:"<|tool_call_begin|>",endTag:"<|tool_call_end|>"}},ko=u=>{let S=[],T=u,V=ie=>{if(!ie)return;if(!Gs){S.push({type:"text",content:ie}),So(ie),Hs(ie);return}let M=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,z=0,yt;for(;(yt=M.exec(ie))!==null;){let A=ie.substring(z,yt.index);if(A)if(So(A),Ln)S.push({type:"text",content:A});else{let _e=A.replace(/[^\r\n]/g,"");_e&&S.push({type:"text",content:_e})}let ne=yt[0];So(ne);let a=ne.toLowerCase();a.startsWith("</")||a.startsWith("[/")||a==="<channel|>"?Ln=!1:Ln=!0,S.push({type:"text",content:ne}),z=M.lastIndex}let y=ie.substring(z);if(y)if(So(y),Ln)S.push({type:"text",content:y});else{let A=y.replace(/[^\r\n]/g,"");A&&S.push({type:"text",content:A})}};for(;T.length>0;)if(ao){let ie=An+T,M=$a[ht];if(M){let y=!1;if(ie.length<M.startPrefix.length?M.startPrefix.startsWith(ie)||(y=!0):ie.startsWith(M.startPrefix)?ie.length>=M.fullPrefix.length&&!ie.startsWith(M.fullPrefix)&&(y=!0):y=!0,y){V(ie),An="",ao=!1,ht=null,Qn=!1,lo=!1,T="";break}}let z=-1,yt=M?M.endTag:"]";if(ht==="tool"||ht==="action"){let y=0,A=null,ne=0,a=!1;for(let _e=0;_e<ie.length;_e++){let J=ie[_e];if(A){if(J===A){let v=0;for(let Ct=_e-1;Ct>=0&&ie[Ct]==="\\";Ct--)v++;v%2===0&&(A=null)}}else if(J==='"'||J==="'")A=J;else if(J==="`")if(Qn){z=_e;break}else A=J;else if(J==="(")y++,a=!0;else if(J===")")y--;else if(J==="]"&&a&&y===0){z=_e;break}}}else z=ie.indexOf(yt);if(z!==-1){let y=yt.length,A=ie.substring(0,z+y);ht?.startsWith("kimi")||S.push({type:"text",content:A}),So(A),Hs(A),(ht==="tool"||ht==="action"||ht?.startsWith("kimi"))&&!Qn&&!lo&&(Gs=!0,zn.push(A.trim())),Qn=!1,lo=!1,An="",ao=!1,ht=null,T=ie.substring(z+y)}else{An=ie,T="";break}}else{let ie=T.indexOf("[tool"),M=T.indexOf("[action"),z=T.indexOf("[[END]]"),yt=T.indexOf("<|tool_calls_section_begin|>"),y=T.indexOf("<|tool_call_begin|>"),A=[{type:"tool",idx:ie,start:"[tool",end:"]"},{type:"action",idx:M,start:"[action",end:"]"},{type:"end",idx:z,start:"[[END]]",end:"[[END]]"},{type:"kimi_section",idx:yt,start:"<|tool_calls_section_begin|>",end:"<|tool_calls_section_end|>"},{type:"kimi_call",idx:y,start:"<|tool_call_begin|>",end:"<|tool_call_end|>"}].filter(ne=>ne.idx!==-1).sort((ne,a)=>ne.idx-a.idx);if(A.length>0){let ne=A[0],a=T.substring(0,ne.idx);ne.idx>0&&V(a);let _e=ne.idx>0?T[ne.idx-1]:"";Qn=Zo||_e==="`",lo=Ln,ao=!0,ht=ne.type,An="",T=T.substring(ne.idx)}else{let ne=["[tool","[action","[[END]]","<|tool_calls_section_begin|>","<|tool_call_begin|>"],a=-1;for(let _e of ne){for(let J=_e.length-1;J>0;J--)if(T.endsWith(_e.substring(0,J))){a=T.length-J;let v=ne.indexOf(_e);v===0?ht="tool":v===1?ht="action":v===2?ht="end":v===3?ht="kimi_section":ht="kimi_call";break}if(a!==-1)break}if(a!==-1){if(a>0){let J=T.substring(0,a);V(J)}let _e=a>0?T[a-1]:"";Qn=Zo||_e==="`",lo=Ln,ao=!0,An=T.substring(a),T=""}else{V(T);break}}}return S},La=K[Symbol.asyncIterator]();for(;;){let{value:u,done:S}=await Promise.race([La.next(),rt]);if(S)break;if(u&&u.type==="status"){yield u;continue}let T="",V=u.candidates?.[0]?.content?.parts;if(V&&V.length>0)for(let M of V){let z=typeof M.text=="string"?M.text:M.text?parseChunkText(M.text):"";M.thought?z&&(H||(T+="<think_fluxflow>",H=!0),T+=z):z&&(H&&(T+="</think_fluxflow>",H=!1),T+=z)}else u.text&&H&&(T+="</think_fluxflow>",H=!1);T=Al(T);let ie=T?Yi(T):0;if(n&&typeof n.onTokenChunk=="function"&&n.onTokenChunk(T,ie),Ws&&(Tt===null&&(Tt=Date.now()-Bt),yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"},Ws=!1),xt){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
|
|
689
687
|
|
|
690
|
-
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(T){if(Qe){if(
|
|
691
|
-
`).length;fe=ve,!Re&&!Q&&ve>800?Ge=Math.min(50,ve):Ge=Math.min(
|
|
688
|
+
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(T){if(Qe){if(pe+=T,pe.length>=64){let y=0,A=Math.min(bt.length,pe.length);for(let a=A;a>=10;a--)if(bt.endsWith(pe.substring(0,a))){y=a;break}let ne=pe.substring(y);if(ne){let _e=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(bt)?ne.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):ne.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(_e)if(be+=_e,s==="Google")pt+=_e;else{yield*un();let J=ko(_e);for(let v of J)yield v}}Qe=!1,pe=""}continue}else if(be+=T,s==="Google")pt+=T;else{yield*un();let y=ko(T);for(let A of y)yield A}let M=Il(be);if(M.inside){_t=!0,qn||(qn=Date.now());let A={Ask:"ask",AskUser:"ask",WebSearch:"web_search",WebScrape:"web_scrape",ReadFile:"view_file",ReadFolder:"read_folder",WriteFile:"write_file",PatchFile:"update_file",WritePDF:"write_pdf",WriteDoc:"write_docx",FindFile:"find_file",find_file:"find_file",findfile:"find_file",Run:"exec_command",SearchKeyword:"search_keyword",CodeSearch:"search_keyword",code_search:"search_keyword",Code_Search:"search_keyword",codesearch:"search_keyword",Memory:"memory",file_map:"file_map",FileMap:"file_map",Chat:"chat",chat:"chat",GenerateImage:"generate_image",generate_image:"generate_image",todo:"todo",Todo:"todo",goal:"todo",Goal:"todo",Invoke:"invoke",InvokeSync:"invoke_sync",getProgress:"get_progress",GetProgress:"get_progress",Cancel:"cancel",Await:"await",wait:"wait",Answer:"answer",Steer:"steer",steer:"steer"}[M.toolName]||M.toolName,ne=M.args||"",a=null;if(["write_file","update_file","view_file","read_folder","find_file","write_pdf","write_docx","search_keyword","generate_image","file_map","invoke","invoke_sync","get_progress","await","wait","answer"].includes(A)){let J=O(ne,[],["path","basename","name","targetFile","TargetFile","directory","file","keyword","title","task","id","taskId","timeout","time","seconds"]),v=J.basename||J.name||J.path||J.targetFile||J.TargetFile||J.directory||J.file,Ct=J.keyword,On=J.title||J.task,It=J.id||J.taskId,ut=J.timeout||J.time||J.seconds||J.sec;if(Ct!=null)a=String(Ct).replace(_n,"");else if(v)a=B.basename(String(v).replace(_n,"").replace(da,"/"));else if(On&&(A==="invoke"||A==="invoke_sync"))a=String(On).replace(_n,"").substring(0,30);else if(It&&A==="get_progress")a=String(It).replace(_n,"");else if(ut&&A==="await"){let Ze=parseFloat(String(ut).replace(_n,""));isNaN(Ze)?a=String(ut).replace(_n,""):(Ze<5&&(Ze=5),Ze>120&&(Ze=180),a=(Mt=>{if(Mt>=60){let Nn=Math.floor(Mt/60),on=Mt%60;return`${Nn}m${on>0?` ${on}s`:""}`}return`${Mt}s`})(Ze))}else if(ut&&A==="wait"){let Ze=parseFloat(String(ut).replace(_n,""));isNaN(Ze)?a=String(ut).replace(_n,""):(Ze<10&&(Ze=10),Ze>120&&(Ze=120),a=(Mt=>{if(Mt>=60){let Nn=Math.floor(Mt/60),on=Mt%60;return`${Nn}m${on>0?` ${on}s`:""}`}return`${Mt}s`})(Ze))}else{let Ze=ne.match(Sl);if(Ze){let se=Ze[1].replace(_n,"");A==="invoke"||A==="invoke_sync"||A==="get_progress"?a=se.substring(0,30):a=A==="search_keyword"||A==="file_map"?se:B.basename(se.replace(da,"/"))}}}let _e=`${vs[A]||A}${a?` ${a}`:""}`;if((A!==Ut||a!==bo)&&(Ut=A,bo=a,yield{type:"status",content:`${_e}`},process.stdout.isTTY)){let v={WebSearch:"Searching",web_search:"Searching",WebScrape:"Reading",web_scrape:"Reading",ReadFile:"Reading",read_file:"Reading",ReadFolder:"Reading",read_folder:"Reading",WriteFile:"Writing",write_file:"Writing",UpdateFile:"Editing",update_file:"Editing",WritePdf:"Creating",write_pdf:"Creating",WriteDocx:"Creating",write_docx:"Creating",SearchKeyword:"Searching",search_keyword:"Searching",CodeSearch:"Searching",code_search:"Searching",FindFile:"Finding File",find_file:"Finding File",Run:"Executing",Ask:"User Input Required",AskUser:"User Input Required",Memory:"Updating Memory",GenerateImage:"Generating",InvokeSync:"Sub-Agent Working",invoke_sync:"Sub-Agent Working",Invoke:"Working",invoke:"Working",GetProgress:"Checking Progress",get_progress:"Checking Progress",Cancel:"Stopping Generalist",cancel:"Stopping Generalist",Await:"Waiting",await:"Waiting",wait:"Waiting",EmergencyRollback:"Rolling the Ball",Answer:"Answering Sub-Agent",answer:"Answering Sub-Agent",Steer:"Steering Sub-Agent",steer:"Steering Sub-Agent",Click:"Clicking",click:"Clicking",Drag:"Dragging",drag:"Dragging",Scroll:"Scrolling",scroll:"Scrolling",KeyboardTyping:"Typing",keyboard_typing:"Typing",KeyPress:"Pressing Key",key_press:"Pressing Key",RecaptureScreen:"Recapturing Screen",recapture_screen:"Recapturing Screen"}[A]||"Working";process.stdout.write(`\x1B]0;${v}...\x07`)}}if(be.length-ro>800){ro=be.length;let y=ka(be,!1),A=Rs(y),ne=A?(A.innerContent||"").trim():"",a=ne.split(/[.!?]\s+/).filter(re=>re.trim().length>10),_e=new Set(a),J=a.length>25?(a.length-_e.size)/a.length:0,v=ne.split(/\s+/).filter(re=>re.length>0).length,Ct=.9,On=.92,It=!1;if(s.toLowerCase().includes("google")&&(te||"").toLowerCase().startsWith("gemma")){let at={low:2048,medium:4096,high:32768,max:65536,xhigh:65536}[d?.toLowerCase()]||16e3;It=v>at}if(J>Ct||It){yield{type:"status",content:`${J>Ct?"Reasoning Loop Detected":"Thinking Budget Exceeded"}. Re-centering...`},Wt=!0,await new Promise(at=>setTimeout(at,3e3));break}let se=pa(be).trim().split(/[.!?]\s+/).filter(re=>re.trim().length>10),Mt=new Set(se);if((se.length>25?(se.length-Mt.size)/se.length:0)>On){yield{type:"status",content:"Response Loop Detected. Re-centering..."},Wt=!1,Gt=!0,await new Promise(re=>setTimeout(re,3e3));break}let on=y.replace(ml,"").replace(pl,"").replace(hl,"").replace(yl,""),Dn=on.toLowerCase().split(/\s+/).map(re=>re.replace(xl,"")).filter(re=>re.length>0),Ao=!1;if(Dn.length>=40)for(let re=1;re<=15;re++){let at=Math.max(8,Math.ceil(25/re));if(Dn.length<re*at)continue;let Fn=Dn.slice(Dn.length-re),c=Fn.join(" ");if(re>1&&c===Fn.slice(0,Math.floor(re/2)).join(" ").repeat(2).trim())continue;let R=!0;for(let _=1;_<at;_++)if(Dn.slice(Dn.length-re*(_+1),Dn.length-re*_).join(" ")!==c){R=!1;break}if(R){Ao=!0;break}}if(!Ao){let re=on.toLowerCase().replace(wl,"");if(re.length>=80)for(let at=1;at<=10;at++){let Fn=Math.max(15,Math.ceil(45/at));if(re.length<at*Fn)continue;let c=re.substring(re.length-at),R=!0;for(let _=1;_<Fn;_++)if(re.substring(re.length-at*(_+1),re.length-at*_)!==c){R=!1;break}if(R){Ao=!0;break}}}if(Ao){yield{type:"status",content:"Stuttering Detected. Re-centering..."},Wt=!1,Xn=!0,await new Promise(re=>setTimeout(re,3e3));break}}let z=jt(be),yt=Kn(z);for(;yt.length>Et;){yield*un();let y=yt[Et],A=Date.now(),a={Ask:"ask",AskUser:"ask",WebSearch:"web_search",WebScrape:"web_scrape",ReadFile:"view_file",ReadFolder:"read_folder",FindFile:"find_file",find_file:"find_file",findfile:"find_file",WriteFile:"write_file",PatchFile:"update_file",WritePDF:"write_pdf",WriteDoc:"write_docx",Run:"exec_command",SearchKeyword:"search_keyword",CodeSearch:"search_keyword",code_search:"search_keyword",Code_Search:"search_keyword",codesearch:"search_keyword",Memory:"memory",file_map:"file_map",FileMap:"file_map",Chat:"chat",chat:"chat",GenerateImage:"generate_image",generate_image:"generate_image",todo:"todo",Todo:"todo",goal:"todo",Goal:"todo",Invoke:"invoke",InvokeSync:"invoke_sync",getProgress:"get_progress",GetProgress:"get_progress",Await:"await",await:"await",AwaitSubagent:"await",awaitSubagent:"await",Wait:"wait",wait:"wait",Answer:"answer",answer:"answer",AnswerSubagent:"answer",answerSubagent:"answer",Steer:"steer",steer:"steer",SteerSubagent:"steer",steerSubagent:"steer",Cancel:"cancel",cancel:"cancel",Click:"click",click:"click",Drag:"drag",drag:"drag",Scroll:"scroll",scroll:"scroll",KeyboardTyping:"keyboard_typing",keyboard_typing:"keyboard_typing",KeyPress:"key_press",key_press:"key_press",RecaptureScreen:"recapture_screen",recapture_screen:"recapture_screen",EmergencyRollback:"EmergencyRollback"}[y.toolName]||y.toolName,_e=vs[a]||y.toolName,J=oo(a,y.args);yield{type:"status",content:`${_e}${J?` ${J}`:""}`};let v="";if(a==="click"){let c=O(y.args,["intendedClickText"]);v=`\u2714 Clicked ${c.intendedClickText?`: ${c.intendedClickText}`:"Screen"}`}else if(a==="drag"){let c=O(y.args,["fromGridId","toGridId"]);v=`\u2714 Dragged: Cell ${c.fromGridId||""} \u2192 Cell ${c.toGridId||""}`}else if(a==="scroll"){let c=O(y.args,["direction","amount"]);v=`\u2714 Scrolled: ${c.direction||"down"} (${c.amount||1})`}else if(a==="keyboard_typing"){let c=O(y.args,["text"]);v=`\u2714 ${c.autoPressEnter?"Entered":"Typed"}: ${c.text?`"${c.text.length>20?c.text.substring(0,20)+"...":c.text}"`:""}`}else if(a==="key_press")v=`\u2714 Pressed Key: ${O(y.args,["key"]).key||""}`;else if(a==="recapture_screen")v="\u2714 Recaptured Screen";else if(a==="web_search"){let{query:c,limit:R=10,aiMode:_=!1}=O(y.args,["query","limit","aiMode"]);v=`${c?"\u2714":"\u2718"} ${_?"AI Search":"Searched"}: ${c?`${c}`:"No Search Query"}${_===!1&&c?` \u2192 ${R}`:""}`}else if(a==="web_scrape"){let c=O(y.args,["url"]).url||null;v=`${c?"\u2714":"\u2718"} Visited: ${c||"No Source"}`}else if(a==="view_file"){let{path:c,StartLine:R,EndLine:_,start_line:ce,end_line:ye,startLine:oe,endLine:ae}=O(y.args,["path","StartLine","EndLine","start_line","end_line","startLine","endLine"]),Re=R||ce||oe,Q=_||ye||ae,q=parseInt(Re)||1,W=parseInt(Q)||(Re?q+800:800),fe="...",Ge=W,D=(c||"").trim().toLowerCase().replaceAll("\\","/");if(D.startsWith("#skill"))D.startsWith("#skill/global/fluxflow")||D.startsWith("#skills/global/fluxflow")||D.includes("#skill/fluxflow")||D.includes("#skills/fluxflow")?v="\u2714 Read Documentation":v=`\u2714 Read Skill: ${B.basename(c.replaceAll("\\","/"))}`;else{try{let{resolvedPath:xe}=mn(c),ke=B.resolve(process.cwd(),xe);if(we.existsSync(ke)){let ve=we.readFileSync(ke,"utf8").split(`
|
|
689
|
+
`).length;fe=ve,!Re&&!Q&&ve>800?Ge=Math.min(50,ve):Ge=Math.min(W,ve)}}catch{}let vt=(c||"").toLowerCase(),Co=vt.endsWith(".pdf"),zt=vt.endsWith(".docx")||vt.endsWith(".doc")||vt.endsWith(".ppt")||vt.endsWith(".pptx")||vt.endsWith(".xls")||vt.endsWith(".xlsx"),Ie=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(vt);Co||zt?v=`${c.length>0?"\u2714":"\u2718"} ${c?`Analyzed: ${B.basename(c)}`:"Analyzed: File Not Found"}`:Ie?v=`${c.length>0?"\u2714":"\u2718"} ${c?`Processed: ${B.basename(c)}`:"Processed: File Not Found"}`:v=`${fe!=="..."?"\u2714":"\u2718"} Read: ${c?`${B.basename(c)} \u2192 ${fe!=="..."?`Lines ${q} - ${Ge} of ${fe}`:"File Not Found"}`:"File Not Found"}`}}else if(a==="list_files"||a==="read_folder"){let c=a==="list_files"?"List":"Browsed",R=O(y.args,["path","recurse","include"]).path||null,_=O(y.args,["path","recurse","include"]).recurse||1;v=`${R?"\u2714":"\u2718"} ${c}: ${R?`${R==="."?`./${_>1?"*":""}`:`${R.replaceAll("\\","/")}${_>1?`${R.endsWith("/")?"*":"/*"}`:`${R.endsWith("/")?"":"/"}`}`}`:"No Folder Selected"}`}else if(a==="find_file"){let c=O(y.args,["basename","name","path","file","query"]),R=c.basename||c.name||c.path||c.file||c.query||"";v=`${R?"\u2714":"\u2718"} Located: ${R||"No Query"}`}else if(a==="write_file"||a==="update_file"){let c=a==="write_file"?"Created":"Edited",R=O(y.args,["path","content","allowMultiple","searchContent*","replaceContent*","newContent*"]),_=R.path||null,ye=Object.entries(R).some(([oe,ae])=>oe.startsWith("searchContent")&&typeof ae=="string"&&ae.startsWith("^LINE:"))?"\u1361":":";v=`${_?"\u2714":"\u2718"} ${c}${ye} ${_?_.replaceAll("\\","/"):"No File Changes"}`}else if(a==="write_pdf"){let c=O(y.args,["path","content","orientation","margin"]).path||null;v=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No PDF Generated"}`}else if(a==="write_docx"){let c=O(y.args,["path","content"]).path||null;v=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No Docx Generated"}`}else if(a==="file_map"){let c=O(y.args,["path"]).path;v=`${c?"\u2714":"\u2718"} Indexed: ${c.replaceAll("\\","/")?""+c:"File Not Found"}`}else if(a.toLowerCase()==="search_keyword"||a.toLowerCase()==="todo")v="";else if(a.toLowerCase()==="generate_image"){let{path:c,outputPath:R,output:_}=O(y.args,["path","prompt","text","outputPath","output","ratio"]);v=`\u2714 Generated: ${c||R||_||"generated_image.png"}`}else if(a==="invoke_sync"||a==="InvokeSync"){let c=oo(a,y.args);v=`\u2714 Called Generalist${c?`: ${c}`:""}`}else if(a==="Invoke"||a==="InvokeAsync"||a==="invoke"){let c=oo(a,y.args);v=`\u2714 Started Generalist${c?`: ${c}`:""}`}else if(a==="get_progress"||a==="GetProgress"){let c=oo(a,y.args);v=`\u2714 Checked${c?`: ${c}`:""}`}else if(a==="cancel"){let c=oo(a,y.args);v=`\u{1F6C7} Cancelled${c?`: ${c}`:""}`}else if(a==="steer"||a==="Steer"){let c=oo(a,y.args);v=`\u2714 Steered${c?`: ${c}`:""}`}else if(a==="EmergencyRollback"){let{method:c}=O(y.args,["method","id"]);v=c==="forceRevert"?"":"\u2714 Rollback Point Checked"}else if(a==="await"||a==="Await"||a==="wait"||a==="Wait"){let{time:c,timeout:R,seconds:_,sec:ce}=O(y.args,["time","timeout","seconds","sec"]),ye=parseFloat(_||ce||R||c)||45,oe=a==="wait"||a==="Wait"?120:180;ye<10&&(ye=10),ye>oe&&(ye=oe);let ae=q=>{if(q>=60){let W=Math.floor(q/60),fe=q%60;return`${W}m${fe>0?` ${fe}s`:""}`}return`${q}s`},Re=["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"];v=`\u2714 ${Re[Math.floor(Math.random()*Re.length)]} \u2192 ${ae(ye)}`}else a==="Answer"||a==="answer"?v="\u2714 Resolved Sub-Agent Query":a==="exec_command"||a==="ask"?v="":v=`Executed: ${y.toolName}`;if(yield*un(),a==="exec_command"){let{command:c}=O(y.args,["command","background","timeout","usePowershell","forcePowershell","useCwd","useCmd","forceCwd","forceCmd"]);if(c&&n.systemSettings&&n.systemSettings.allowExternalAccess===!1){let R=[/[a-zA-Z]:[\\\/]/i,/^\//,/\.\.[\\\/]/,/\/etc\//,/\/var\//,/\/root\//,/\/bin\//,/\/usr\//],_=B.resolve(process.cwd()).substring(0,3).toLowerCase(),ce=Q=>{let q=[],W="",fe=null;for(let Ge=0;Ge<Q.length;Ge++){let D=Q[Ge];fe?(D===fe&&(fe=null),W+=D):D==='"'||D==="'"?(fe=D,W+=D):D==="&"&&Q[Ge+1]==="&"||D==="|"&&Q[Ge+1]==="|"?(W.trim()&&(q.push(W.trim()),W=""),Ge++):D===";"||D==="|"||D==="&"?W.trim()&&(q.push(W.trim()),W=""):W+=D}return W.trim()&&q.push(W.trim()),q},ye=Q=>{let q=[],W="",fe=null;for(let Ge=0;Ge<Q.length;Ge++){let D=Q[Ge];fe?(D===fe&&(fe=null),W+=D):D==='"'||D==="'"?(fe=D,W+=D):/\s/.test(D)?W&&(q.push(W),W=""):W+=D}return W&&q.push(W),q},oe=Q=>{let q=Q.replace(/^['"]|['"]$/g,"").trim();return!q||process.platform==="win32"&&/^\/[a-zA-Z0-9?]+$/.test(q)?!1:R.some(W=>{if(W.source==="[a-zA-Z]:[\\\\\\/]"){let fe=q.match(/[a-zA-Z]:[\\\/]/i);return fe&&fe[0].toLowerCase()!==_}return W.test(q)})};if(ce(c).some(Q=>{let q=ye(Q);if(q.length===0)return!1;let W=q[0].replace(/^['"]|['"]$/g,"").toLowerCase();if(["echo","printf","write-output"].includes(W)){let Ge=!1;return q.some(D=>{let Rt=D.replace(/^['"]|['"]$/g,"");if(Rt===">"||Rt===">>"||Rt==="<")return Ge=!0,!1;if(Rt.startsWith(">")||Rt.startsWith("<")){let vt=Rt.replace(/^[><]+/,"");return oe(vt)}return Ge?(Ge=!1,oe(D)):!1})}return q.some(Ge=>oe(Ge))})){let Q='Access Denied. Prohibited from accessing external directories while "External Workspace Access" is disabled.';n.onExecStart&&n.onExecStart(c||"No Command"),yield{type:"exec_start"},await new Promise(q=>setTimeout(q,50)),n.onExecChunk&&n.onExecChunk(`ERROR: ${Q}`),await new Promise(q=>setTimeout(q,50)),n.onExecEnd&&n.onExecEnd(),je.push({role:"user",text:`[ACTION RESULT]: ERROR: ${Q}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${Q}`},Et++;continue}}n.onExecStart&&n.onExecStart(c||"No Command"),yield{type:"exec_start"}}let Ct=["write_file","update_file","view_file","read_folder","list_files","file_map"],On=["path","targetPath","file","content","searchContent*","replaceContent*","newContent*","recurse","include","StartLine","EndLine","start_line","end_line","startLine","endLine"],It=Ct.includes(a)?O(y.args,On):O(y.args),ut=It.path||It.targetPath||null;if(ut){let c=n.systemSettings&&n.systemSettings.allowExternalAccess===!1,R=B.resolve(ut),_=B.resolve(process.cwd());if(c&&!R.startsWith(_)){let ce="Access Denied. You are not allowed to access files outside the current workspace.";if(a==="write_file"||a==="update_file"){let oe=`\u2718 ${a==="write_file"?"Write Canceled":"Edit Canceled"}: ${It.path||"..."}`,ae=115;process.stdout.isTTY&&(ae=process.stdout.columns-5||120);let Re=Math.min(oe.length+4,ae),Q=`${oe.padEnd(Re-2).substring(0,Re-2)}`;yield{type:"visual_feedback",content:Lt(`${Fe?`
|
|
692
690
|
`:""}${Q}
|
|
693
|
-
`)},
|
|
694
|
-
`)?
|
|
695
|
-
`,
|
|
696
|
-
${
|
|
697
|
-
`)}`,ei=`\u2714 Edited: ${B.basename(ze.replaceAll("\\","/"))}`,Ro=115;process.stdout.isTTY&&(Ro=process.stdout.columns-5||120);let Wi=Math.min(ei.length+4,Ro),
|
|
698
|
-
`:""}${
|
|
691
|
+
`)},Fe=!1}je.push({role:"user",text:`[ACTION RESULT]: ERROR: ${ce}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${ce}`},Et++;continue}}if(n.onToolApproval){let c=n.systemSettings||{},R=c.autoExec,_=!1,ce="";if(a==="view_file"){let oe=O(y.args,["path","targetPath","file","StartLine","EndLine","start_line","end_line","startLine","endLine"]);if(ce=oe.path||oe.targetPath||oe.file||"",ce){let ae=c.alwaysAskFiles||".env, .env.*, *.env";Vs(ce,ae)&&(_=!0)}}if(a==="write_file"||a==="update_file"||a==="exec_command"||_){let oe=null,ae=!1,Re=!1,Q=!1,q=!1;if(_)ae=!0,oe=null;else if(a==="exec_command"){let{command:Ie}=O(y.args,["command","background","timeout","usePowershell","forcePowershell","useCwd","useCmd","forceCwd","forceCmd"]),xe=(Ie||"").trim(),Le=(Oe=>{let ct=[],dt="",He=null;for(let Ee=0;Ee<Oe.length;Ee++){let Y=Oe[Ee];He?(Y===He&&(He=null),dt+=Y):Y==='"'||Y==="'"?(He=Y,dt+=Y):Y==="&"&&Oe[Ee+1]==="&"||Y==="|"&&Oe[Ee+1]==="|"?(dt.trim()&&(ct.push(dt.trim()),dt=""),Ee++):Y===";"||Y==="|"||Y==="&"?dt.trim()&&(ct.push(dt.trim()),dt=""):dt+=Y}return dt.trim()&&ct.push(dt.trim()),ct.length>0?ct:[Oe]})(xe),ve=(Oe,ct)=>{if(!ct)return!1;let dt=ct.split(",").map(Ee=>Ee.trim().toLowerCase()).filter(Boolean),He=Oe.toLowerCase();return dt.some(Ee=>{if(He===Ee)return!0;if(He.startsWith(Ee)){let Y=He.charAt(Ee.length);return/\s|[;&|/]/.test(Y)}return!1})},ze=Le.some(Oe=>ve(Oe,c.alwaysAskCommands)),qt=Le.some(Oe=>ve(Oe,c.autoDisallowCommands)),qe=Le.length>0&&Le.every(Oe=>ve(Oe,c.autoApproveCommands)||c.autoApproveGit&&/^git\s+commit\b/i.test(Oe));if(qt)oe="deny";else if(c.networkAccess===!1){let ct=xe.trim().replace(/\s+/g," ").replace(/^['"]+|['"]+$/g,"").toLowerCase().split(" "),He=ct[0].split("/").pop().split("\\").pop().replace(/\.exe$/,""),Ee=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"]),Y=!1;Ee.has(He)&&(Y=!0);let Nt=co=>ct.slice(1).some(Rn=>co.includes(Rn)),Cn=co=>{let Rn=ct.findIndex(Bn=>co.includes(Bn)),Zn=ct.findIndex(Bn=>["run","exec","test"].includes(Bn));return Rn!==-1&&!(Zn!==-1&&Zn<Rn)};He==="git"&&Nt(["clone","pull","push","fetch"])&&(Y=!0),He==="go"&&Nt(["get","install"])&&(Y=!0),He==="npm"&&Cn(["install","i","update","add"])&&(Y=!0),He==="yarn"&&Cn(["add","install","upgrade"])&&(Y=!0),He==="pnpm"&&Cn(["add","install","update"])&&(Y=!0),He==="bun"&&Cn(["add","install","update"])&&(Y=!0),He==="deno"&&Nt(["install","add"])&&(Y=!0),He==="pip"&&Nt(["install","download"])&&(Y=!0),He==="pip3"&&Nt(["install","download"])&&(Y=!0),He==="cargo"&&Nt(["install","add"])&&(Y=!0),["bash","sh","zsh","fish"].includes(He)&&Nt(["-c"])&&(Y=!0),He==="cmd"&&Nt(["/c"])&&(Y=!0),Y&&(oe="deny",Q=!0)}!oe&&ze?ae=!0:!oe&&!ae&&(qe||c.autoApproveGit&&/^git\s+commit\b/i.test(xe))&&(oe="allow"),!ae&&!oe&&R&&(oe="allow")}else if(a==="write_file"||a==="update_file"){let Ie=!1;if(a==="write_file"&&c.overwriteProtection!==!1&&R)try{let{path:xe}=O(y.args,["path","content"]);xe&&we.existsSync(B.resolve(process.cwd(),xe))&&(Ie=!0,q=!0)}catch{}R&&!Ie&&(oe="allow")}let W=oe,fe="";oe==="deny"&&(Q?fe="network":Re?fe="settings":fe="prohibited");let Ge=!1,D="",Rt=[],vt=0,Co=!1,zt="";if(!W&&n.onToolApproval)try{let Ie=await n.onToolApproval(a,y.args,{checkOnly:!0});q&&Ie==="allow"||(Ie==="allow"||Ie==="deny")&&(W=Ie,W==="deny"&&(fe="user"))}catch{}if(!W){if(!q&&(a==="write_file"||a==="update_file"))try{let ke=O(y.args,["path","content","searchContent*","replaceContent*","newContent*"]),{path:Le}=ke;if(Le){let{resolvedPath:ve}=mn(Le);Le=ve;let ze=B.resolve(process.cwd(),Le),qt=Ee=>Ee?Ee.toLowerCase().replace(/\\/g,"/").replace(/^[a-z]:/,Y=>Y.toUpperCase()):"",qe=qt(ze),Oe="",ct=!1,dt=await to(),He=qt(dt?.file_focused);if(dt&&He===qe&&dt.full_content?(Oe=dt.full_content,ct=!0):we.existsSync(ze)&&(Oe=we.readFileSync(ze,"utf8"),ct=!0),D=Oe,await di.recordFileChange(ze,Oe),ct){let Ee=Oe;if(a==="write_file"){let Y=ke.content||ke.newContent||"";Ee=Y.endsWith(`
|
|
692
|
+
`)?Y:Y+`
|
|
693
|
+
`,zt=Ee}else{let{patchPairs:Y,allowMultiple:Nt,error:Cn}=Xi(ke);if(Cn){let Yt=`[ACTION RESULT]: ERROR: ${Cn}`;je.push({role:"user",text:Yt}),await $t("toolFailure"),n.onToolResult&&n.onToolResult("failure",a),yield{type:"tool_result",content:Yt,toolName:a},Et++;continue}let co=ke.allowMultiple!==void 0?ke.allowMultiple===!0||String(ke.allowMultiple).toLowerCase()==="true":Nt;vt=Y.length;let Rn=qs(Oe,Y,{allowMultiple:co});Ee=Rn.content,zt=Ee,Rt=Rn.results;let Zn=Rt.filter(Yt=>Yt.success),Bn=Rt.filter(Yt=>!Yt.success);if(Zn.length===0){let Yt=`[ACTION RESULT]: ERROR: Failed to apply patches to [${B.basename(ze)}].
|
|
694
|
+
${Bn.map(Un=>` \u2022 ${Un.error}`).join(`
|
|
695
|
+
`)}`,ei=`\u2714 Edited: ${B.basename(ze.replaceAll("\\","/"))}`,Ro=115;process.stdout.isTTY&&(Ro=process.stdout.columns-5||120);let Wi=Math.min(ei.length+4,Ro),gn=`${ei.padEnd(Wi-2).substring(0,Wi-2)}`;yield{type:"visual_feedback",content:Lt(`${Fe?`
|
|
696
|
+
`:""}${gn}`)},Fe=!1,je.push({role:"user",text:Yt}),await $t("toolFailure"),n.onToolResult&&n.onToolResult("failure",a),yield{type:"tool_result",content:Yt,toolName:a},Et++;continue}}yield{type:"status",content:`Opening Diff in IDE: ${B.basename(ze)}`},is(ze,Oe,Ee),Ge=!0,await new Promise(Y=>setTimeout(Y,50))}else if(a==="write_file"){let Ee=ke.content||ke.newContent||"",Y=Ee.endsWith(`
|
|
699
697
|
`)?Ee:Ee+`
|
|
700
|
-
`;
|
|
701
|
-
${D.split(/\r?\n/).map((ot,
|
|
698
|
+
`;zt=Y,we.existsSync(ze)||(Co=!0,we.mkdirSync(B.dirname(ze),{recursive:!0}),we.writeFileSync(ze,"","utf8")),yield{type:"status",content:`Opening New File Diff in IDE: ${B.basename(ze)}`},is(ze,"",Y),Ge=!0,await new Promise(Nt=>setTimeout(Nt,50))}}}catch(ke){console.error("Simulation/Diff Error:",ke)}let Ie=null;os(ke=>{Ie=ke});let xe=n.onToolApproval;if(W=await new Promise(async ke=>{let Le=setInterval(()=>{if(Ie){let ve=n.onIDEApproval||Vo&&Vo.onIDEApproval;ve&&ve(Ie),clearInterval(Le),ke(Ie)}},100);try{let ve=await xe(a,y.args,{isOverwritePrompt:q});clearInterval(Le),ke(ve)}catch{clearInterval(Le),ke("deny")}}),os(null),a==="write_file"||a==="update_file"){let ke=O(y.args,["path","content","searchContent*","replaceContent*","newContent*"]),{path:Le}=ke;if(Le){let{resolvedPath:ve}=mn(Le);Le=ve;let ze=B.resolve(process.cwd(),Le);if(br(ze,W),W==="deny"&&Co&&we.existsSync(ze))try{we.unlinkSync(ze)}catch{}}}W==="deny"&&(fe="user")}if(W==="allow"&&Ge&&yo()){let Ie=O(y.args,["path","content","searchContent*","replaceContent*","newContent*"]),{path:xe}=Ie,{resolvedPath:ke,isTildeResolved:Le}=mn(xe);xe=ke;let ve=B.resolve(process.cwd(),xe),ze=Ke=>Ke?B.resolve(Ke).replace(/\\/g,"/").toLowerCase():"",qt=await to(),qe="";if(qt&&qt.file_focused&&ze(qt.file_focused)===ze(ve)&&qt.full_content&&(qe=qt.full_content),!qe&&we.existsSync(ve)){let Ke=we.readFileSync(ve,"utf8");Ke&&(qe=Ke)}!qe&&zt&&(qe=zt),(qe||Co)&&we.writeFileSync(ve,qe,"utf8");let Oe=qe.split(/\r?\n/),ct=Oe.length,dt=Buffer.byteLength(qe,"utf8"),He="";D&&(He=`Old File contents:
|
|
699
|
+
${D.split(/\r?\n/).map((ot,sn)=>`${sn+1} | ${ot}`).join(`
|
|
702
700
|
`)}
|
|
703
701
|
|
|
704
702
|
`);let Ee="";if(ct<=100)Ee=Oe.join(`
|
|
@@ -708,89 +706,89 @@ ${D.split(/\r?\n/).map((ot,ln)=>`${ln+1} | ${ot}`).join(`
|
|
|
708
706
|
|
|
709
707
|
... [${ct-100} lines truncated for history stability] ...
|
|
710
708
|
|
|
711
|
-
${ot}`}let
|
|
709
|
+
${ot}`}let Y="";if(a==="update_file"){let Ke=Xs(D,qe,Rt,12,n?.compressToolResults||Vo?.systemSettings?.compressToolResults),{patchPairs:ot}=Xi(O(y.args,["path","searchContent*","replaceContent*","newContent*"])),sn=ot?.length||vt||1,Pt=0,Xt=0,Wn=[];ot&&ot.length>0?ot.forEach((Hn,go)=>{let mo=Hn.replace||"",rn=Hn.new||"",Gi=mo.trim(),Eo=rn.trim(),Wa=!!zt&&qe===zt,Ga=Eo?qe.includes(rn)||qe.includes(Eo):!0,Ha=rn?D.includes(rn)||!!Eo&&D.includes(Eo):!1,ja=Gi?qe.includes(mo)||qe.includes(Gi):!1;Wa||!!rn&&Ga&&(!Ha||!ja||Gi===Eo)?Pt++:(Xt++,Wn.push(` \u2022 Block ${go+1}: not applied (reverted or rejected in IDE).`))}):Pt=vt||0;let vn=0;if(zt&&qe!==zt){let Hn=ul("","",zt||"",qe||"","","",{context:0});if(Hn&&Hn.hunks)for(let go of Hn.hunks){let mo=go.lines.filter(rn=>rn.startsWith("+")).map(rn=>rn.slice(1).trim()).filter(Boolean);for(let rn of mo)D.includes(rn)||vn++}}let vo=[`[${Pt}/${sn}] applied`];Xt>0&&vo.push(`${Xt} rejected by user`),vn>0&&vo.push(`${vn} manual ${vn===1?"modification":"modifications"} by user`);let fo=vo.join(", "),Gn=Wn.length>0?`
|
|
712
710
|
|
|
713
711
|
User Review Details:
|
|
714
|
-
${
|
|
715
|
-
`)}`:"";
|
|
712
|
+
${Wn.join(`
|
|
713
|
+
`)}`:"";Y=`File [${xe}] updated via IDE Companion. ${fo}.${Gn}
|
|
716
714
|
|
|
717
715
|
${Ke}${Le?`
|
|
718
716
|
|
|
719
|
-
[Note: '~' resolved to user home directory. To target literal '~' in current directory, escape it as '\\~']`:""}`;let{added:ti,removed:ni}=Ys(D,qe);(ti>0||ni>0)&&await zi({added:ti,removed:ni,file:
|
|
720
|
-
${
|
|
717
|
+
[Note: '~' resolved to user home directory. To target literal '~' in current directory, escape it as '\\~']`:""}`;let{added:ti,removed:ni}=Ys(D,qe);(ti>0||ni>0)&&await zi({added:ti,removed:ni,file:xe})}else{let Ke=qe.split(/\r?\n/),ot=Ke.length,sn=Buffer.byteLength(qe,"utf8"),Pt="",Xt=c?.overwriteProtection!==!1;if(D){let fo=D.split(/\r?\n/);if(!Xt)Pt="";else if(fo.length<=50)Pt=`Old File contents:
|
|
718
|
+
${fo.map((Gn,uo)=>`${uo+1} | ${Gn}`).join(`
|
|
721
719
|
`)}
|
|
722
720
|
|
|
723
|
-
`;else{let
|
|
724
|
-
- Renamed old file as ${
|
|
721
|
+
`;else{let Gn=B.parse(ve),uo=B.join(ii,"OverwriteBackups");if(!we.existsSync(uo))try{we.mkdirSync(uo,{recursive:!0})}catch{}let ti=String(Date.now()).slice(-5),ni=wa.randomBytes(2).toString("hex"),Hn=`${Gn.name}-old-${ti}-${ni}${Gn.ext}.bak`,go=B.join(uo,Hn);try{we.writeFileSync(go,D,"utf8")}catch{}Pt=`Old File contents:
|
|
722
|
+
- Renamed old file as ${go.replaceAll("\\","/").replace(xa.homedir().replaceAll("\\","/"),"~")} and written requested content in ${xe}. For reversal use Run
|
|
725
723
|
|
|
726
|
-
`}}let
|
|
727
|
-
`);else{let
|
|
728
|
-
`),
|
|
729
|
-
`);
|
|
724
|
+
`}}let Wn="";if(ot<=690)Wn=Ke.join(`
|
|
725
|
+
`);else{let fo=Ke.slice(0,300).join(`
|
|
726
|
+
`),Gn=Ke.slice(-300).join(`
|
|
727
|
+
`);Wn=`${fo}
|
|
730
728
|
|
|
731
729
|
... [${ot-100} lines truncated] ...
|
|
732
730
|
|
|
733
|
-
${
|
|
731
|
+
${Gn}`}let vn=Le?`
|
|
734
732
|
|
|
735
|
-
[Note: '~' resolved to user home directory. To target literal '~' in current directory, escape it as '\\~']`:"";
|
|
736
|
-
- Stats: [${ot} lines, ${(
|
|
733
|
+
[Note: '~' resolved to user home directory. To target literal '~' in current directory, escape it as '\\~']`:"";Y=`File [${xe}] saved via IDE Companion (May have user edits).
|
|
734
|
+
- Stats: [${ot} lines, ${(sn/1024).toFixed(1)} KB]
|
|
737
735
|
${Pt}- Content Preview:
|
|
738
736
|
|
|
739
|
-
${
|
|
740
|
-
`:""}${ei}`)},
|
|
741
|
-
`));let
|
|
737
|
+
${Wn}${vn}`;let vo=D?D.split(/\r?\n/).length:0;await zi({added:ot,removed:vo,file:xe})}let Nt=a==="write_file"?"Created":"Edited",Cn=O(y.args,["path","content","allowMultiple","searchContent*","replaceContent*","newContent*"]),Rn=Object.entries(Cn).some(([Ke,ot])=>Ke.startsWith("searchContent")&&typeof ot=="string"&&ot.startsWith("^LINE:"))?"\u1361":":",Zn=`${xe?"\u2714":"\u2718"} ${Nt}${Rn} ${xe?xe.replaceAll("\\","/"):"No File Changes"}`,Bn=115;process.stdout.isTTY&&(Bn=process.stdout.columns-5||120);let Yt=Math.min(Zn.length+4,Bn),ei=`${Zn.padEnd(Yt-2).substring(0,Yt-2)}`;yield{type:"visual_feedback",content:Lt(`${Fe?`
|
|
738
|
+
`:""}${ei}`)},Fe=!1;let Ro=Date.now();Yn=Ro,yield{type:"tool_time",content:Ro-A};let gn=(Y||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");gn.includes("[[VERIFIED]]")&&(gn=gn.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to conserve context.
|
|
739
|
+
`));let Un;if(a==="write_file"&&!gn.startsWith("ERROR:")){let Ke=gn.replace(/^\[\[SAME\]\]\s*\r?\n?/,""),ot=Ke.match(/\n\s*(\[Note:\s*'~'\s*resolved\s*to\s*user\s*home\s*directory[\s\S]*?\])\s*$/),sn=ot?`
|
|
742
740
|
|
|
743
|
-
${ot[1]}`:"";if(/- Stats:.*\r?\nOld File contents:/s.test(Ke)){let Pt=Ke.search(/^- Content Preview:/m);
|
|
741
|
+
${ot[1]}`:"";if(/- Stats:.*\r?\nOld File contents:/s.test(Ke)){let Pt=Ke.search(/^- Content Preview:/m);Un=`[ACTION RESULT]: ${Pt!==-1?Ke.slice(0,Pt).trimEnd():Ke}
|
|
744
742
|
|
|
745
|
-
[Old file content for reversal reference. Replaced with new write request]${
|
|
743
|
+
[Old file content for reversal reference. Replaced with new write request]${sn}`}else{let Pt=Ke.split(/\r?\n/),Xt=Pt.filter(vn=>vn.startsWith("File ")||vn.trim().startsWith("- Stats:"));Un=`[ACTION RESULT]: ${Xt.length>0?Xt.join(`
|
|
746
744
|
`):Pt.slice(0,2).join(`
|
|
747
|
-
`)}${
|
|
745
|
+
`)}${sn}`}}else if(gn.startsWith("[[SAME]]")){let ot=gn.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),sn=ot.filter(Xt=>Xt.startsWith("File ")||Xt.trim().startsWith("- Stats:"));Un=`[ACTION RESULT]: ${sn.length>0?sn.join(`
|
|
748
746
|
`):ot.slice(0,2).join(`
|
|
749
|
-
`)}`}else
|
|
747
|
+
`)}`}else Un=`[ACTION RESULT]: ${gn}`;je.push({role:"user",text:Un}),Pn=!0,await $t("toolSuccess"),n.onToolResult&&n.onToolResult("success",a),yield{type:"tool_result",content:Y,aiContent:Un,toolName:a},Et++;continue}if(W==="deny"){let Ie=`Permission Denied: Prohibited ${a==="exec_command"?"Command":"file edit"}.`;if(_?Ie=`User denied reading ${B.basename(ce||".env")}`:q&&fe==="user"?Ie="User rejected file over-write. If needed AskUser how to proceed":fe==="user"?Ie="Permission Denied by User":fe==="settings"?Ie="Permission Denied by User Policy":fe==="network"?Ie="Permission Denied: Sandbox Network Access Disabled by User Policy.":fe==="prohibited"&&a==="exec_command"&&(Ie="Permission Denied: Prohibited Command in User Policy"),a==="view_file"){let xe=`\u2718 Read Denied: ${O(y.args,["path","targetPath","file"]).path?.replaceAll("\\","/")||".env"}`,ke=115;process.stdout.isTTY&&(ke=process.stdout.columns-5||120);let Le=Math.min(xe.length+4,ke),ve=`${xe.padEnd(Le-2).substring(0,Le-2)}`;yield{type:"visual_feedback",content:Lt(`${Fe?`
|
|
750
748
|
`:""}${ve}
|
|
751
|
-
`)},
|
|
749
|
+
`)},Fe=!1}else if(a==="write_file"||a==="update_file"){let ke=`\u2718 ${a==="write_file"?"Write Cancelled":"Edit Denied"}: ${O(y.args,["path","content","searchContent*","replaceContent*","newContent*"]).path.replaceAll("\\","/")||"..."}`,Le=115;process.stdout.isTTY&&(Le=process.stdout.columns-5||120);let ve=Math.min(ke.length+4,Le),ze=`${ke.padEnd(ve-2).substring(0,ve-2)}`,qt=` ${" ".repeat(ve)} `;yield{type:"visual_feedback",content:Lt(`${Fe?`
|
|
752
750
|
`:""}${ze}
|
|
753
|
-
`)},
|
|
754
|
-
`:""}${ce}${v.includes("\u2714")&&(v.includes("Created")||v.includes("Edited"))?"":`${
|
|
755
|
-
`}`}`)},
|
|
751
|
+
`)},Fe=!1}a==="exec_command"&&(await new Promise(xe=>setTimeout(xe,50)),n.onExecChunk&&n.onExecChunk(`ERROR: ${Ie}`),await new Promise(xe=>setTimeout(xe,50)),n.onExecEnd&&n.onExecEnd()),je.push({role:"user",text:`[ACTION RESULT]: DENIED: ${Ie}`}),yield{type:"tool_result",content:`[ACTION RESULT]: DENIED: ${Ie}`},await $t("toolDenied"),n.onToolResult&&n.onToolResult("denied",a),Et++;continue}}}if(v){let c=115;process.stdout.isTTY&&(c=process.stdout.columns-5||120);let R=!1,_=Math.min(v.length+4,c),ce=`${v.padEnd(_-2).substring(0,_-2)}`;yield{type:"visual_feedback",content:Lt(`${Fe?`
|
|
752
|
+
`:""}${ce}${v.includes("\u2714")&&(v.includes("Created")||v.includes("Edited"))?"":`${R?"":`
|
|
753
|
+
`}`}`)},Fe=!1}if(Yn>0){let c=Date.now()-Yn,R=Math.max(0,1e3-c);R>0&&await new Promise(_=>setTimeout(_,R))}let Ze={chatId:f,history:t,onChunk:c=>n.onExecChunk?n.onExecChunk(c):null,onAskUser:n.onAskUser,systemSettings:n.systemSettings,mode:l,isMultiModal:it(te),onVisualFeedback:n.onVisualFeedback,onSubagentUpdate:n.onSubagentUpdate,onTokenChunk:n.onTokenChunk,modelName:te,aiProvider:n.aiProvider,apiKey:n.apiKey,onUsage:n.onUsage};if(a==="write_file"||a==="update_file")try{let{path:c}=O(y.args,["path","content","searchContent*","replaceContent*","newContent*"]);if(c){let R=B.resolve(process.cwd(),c),_=await to();_&&_.file_focused===R&&_.full_content&&(Ze.forcedContent=_.full_content)}}catch{}le.push(a);let se=await xs(a,y.args,Ze);if((a==="write_file"||a==="update_file")&&!se.startsWith("ERROR:")){let{path:c}=O(y.args,["path","content","searchContent*","replaceContent*","newContent*"]);if(c){let{resolvedPath:R}=mn(c),_=B.resolve(process.cwd(),R);wr(_)}}process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07");let Mt=Date.now();Yn=Mt,yield{type:"tool_time",content:Mt-A},qn=Mt;let Nn=null;if(typeof se=="object"&&se.binaryPart&&(Nn=se.binaryPart,se=se.text),a==="search_keyword"){let{keyword:c,path:R}=O(y.args,["keyword","path","fuzzy","subString","regex"]),_=typeof se=="string"&&se.startsWith("[GLOB]");_&&(se=se.slice(6).trimStart());let ce=typeof se=="string"&&se.startsWith("[DIR]");ce&&(se=se.slice(5).trimStart());let ye=0;if(se){let D=se.match(/Found (\d+) match/i);D&&(ye=parseInt(D[1]))}let oe=(R||"").trim().toLowerCase().replaceAll("\\","/"),ae=oe==="#doc"||oe==="#docs"||oe==="#documentation"||oe.includes("#skill/global/fluxflow")||oe.includes("#skill/fluxflow")||oe.includes("#skills/fluxflow")||oe.includes("#skills/global/fluxflow"),Re,Q=115;process.stdout.isTTY&&(Q=process.stdout.columns-5||120);let q=Math.max(10,(Q+5)/3),W=Math.max(10,(Q+5)/4);if(ae)Re=`${c?"\u2714":"\u2718"} Searched Documentation`;else{let D=R?R.replace(/[\/\\]+$/,""):null,Rt=D&&D!=="."?`${_?R:ce?`${D}/*`:D}`:"./",vt=Rt.length>W?`${Rt.slice(0,W)}...`:Rt;Re=`${c?"\u2714":"\u2718"} Searched: "${c?c.length>Q/3?`${c.slice(0,q)}...`:c:""}" in "${vt.replaceAll("\\","/")}" \u2192 ${ye} Match${ye===1?"":"es"}`}let fe=Math.min(Re.length+4,Q),Ge=`${Re.padEnd(fe-2).substring(0,fe-2)}`;yield{type:"visual_feedback",content:Lt(`${Fe?`
|
|
756
754
|
`:""}${Ge}
|
|
757
|
-
`)},
|
|
755
|
+
`)},Fe=!1}if(a==="EmergencyRollback"){let{method:c}=O(y.args,["method","id"]);if(c==="forceRevert"){let R=0;if(se){let Q=se.match(/Total\s*:\s*(\d+)/i);Q&&(R=parseInt(Q[1]))}let ce=se&&se.startsWith("ERROR:")?"\u2718 Emergency Rollback Failed":`\u2714 Emergency Rollback \u2192 ${R} file${R===1?"":"s"} processed`,ye=115;process.stdout.isTTY&&(ye=process.stdout.columns-5||120);let oe=!1,ae=Math.min(ce.length+4,ye),Re=`${ce.padEnd(ae-2).substring(0,ae-2)}`;yield{type:"visual_feedback",content:Lt(`${Fe?`
|
|
758
756
|
`:""}${Re}${oe?"":`
|
|
759
|
-
`}`)},
|
|
760
|
-
`)}return Re.filter(Q=>String(Q).trim()).map(Q=>{let
|
|
757
|
+
`}`)},Fe=!1}}if(a==="todo"){let{method:c,tasks:R,markDone:_}=O(y.args,["method","tasks","markDone"]),ce="",ye=[],oe=ae=>{if(!ae)return[];let Re=Array.isArray(ae)?ae:[];if(Re.length===0&&typeof ae=="string"){let Q=ae.trim();if(Q.startsWith("[")&&Q.endsWith("]")){let q=Q.match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/g);q?Re=q.map(W=>W.slice(1,-1).replace(/\\(.)/g,"$1")):Re=Q.slice(1,-1).split(",").map(W=>W.trim()).filter(Boolean)}else Re=ae.split(`
|
|
758
|
+
`)}return Re.filter(Q=>String(Q).trim()).map(Q=>{let q=String(Q).trim();return q.startsWith("- [")?q.substring(6).trim():q})};if(c==="create"?(ce="\x1B[32m\u2192\x1B[0m Created Goals",ye=oe(R).map(ae=>`\x1B[90m\u25CB\x1B[0m ${ae}`)):c==="append"?(ce="\x1B[34m\u2795\x1B[0m Added New Goals",ye=oe(R).map(ae=>`\x1B[90m\u25CB\x1B[0m ${ae}`)):c==="get"&&(ce=_?"\x1B[36m\u21BB\x1B[0m Updated Goals":"\x1B[35m\u2022\x1B[0m Reviewed Goals",ye=(se||"").split(`
|
|
761
759
|
`).slice(1).join(`
|
|
762
760
|
`).split(`
|
|
763
|
-
`).filter(Re=>Re.trim().startsWith("- [")).map(Re=>{let Q=Re.trim(),
|
|
764
|
-
`);yield{type:"visual_feedback",content:Lt(`${
|
|
761
|
+
`).filter(Re=>Re.trim().startsWith("- [")).map(Re=>{let Q=Re.trim(),q=Q.startsWith("- [x]");return`${q?"\x1B[32m\u2714\x1B[0m":"\x1B[90m\u25CB\x1B[0m"} ${q?"\x1B[90m":"\x1B[37m"}${Q.substring(6).trim()}\x1B[0m`})),ce&&ye.length>0){let ae=[`${ce}`,...ye.map(Q=>` ${Q}`)].join(`
|
|
762
|
+
`);yield{type:"visual_feedback",content:Lt(`${Fe?`
|
|
765
763
|
`:""}${ae}${!1?"":`
|
|
766
|
-
`}`)},
|
|
767
|
-
`));let
|
|
764
|
+
`}`)},Fe=!1}}a==="exec_command"&&n.onExecEnd&&(await new Promise(c=>setTimeout(c,800)),n.onExecEnd());let on=se&&se.startsWith("DENIED:");se&&!se.startsWith("ERROR:")&&!on?(await $t("toolSuccess"),n.onToolResult&&n.onToolResult("success",a)):on||(await $t("toolFailure"),n.onToolResult&&n.onToolResult("failure",a));let re=(se||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");re.includes("[[VERIFIED]]")&&(re=re.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to save tokens.
|
|
765
|
+
`));let at;if(a==="write_file"&&!re.startsWith("ERROR:")){let c=re.replace(/^\[\[SAME\]\]\s*\r?\n?/,""),R=c.match(/\n\s*(\[Note:\s*'~'\s*resolved\s*to\s*user\s*home\s*directory[\s\S]*?\])\s*$/),_=R?`
|
|
768
766
|
|
|
769
|
-
${
|
|
767
|
+
${R[1]}`:"";if(/- Stats:.*\r?\nOld File contents:/s.test(c)){let ce=c.search(/^- Content Preview:/m);at=`[ACTION RESULT]: ${ce!==-1?c.slice(0,ce).trimEnd():c}
|
|
770
768
|
|
|
771
|
-
[Old file content for reversal reference. Replaced with new write request]${_}`}else{let ce=c.split(/\r?\n/),
|
|
769
|
+
[Old file content for reversal reference. Replaced with new write request]${_}`}else{let ce=c.split(/\r?\n/),ye=ce.filter(ae=>ae.startsWith("File ")||ae.trim().startsWith("- Stats:"));at=`[ACTION RESULT]: ${ye.length>0?ye.join(`
|
|
772
770
|
`):ce.slice(0,2).join(`
|
|
773
|
-
`)}${_}`}}else if(re.startsWith("[[SAME]]")){let
|
|
774
|
-
`):
|
|
775
|
-
`)}`}else
|
|
771
|
+
`)}${_}`}}else if(re.startsWith("[[SAME]]")){let R=re.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),_=R.filter(ye=>ye.startsWith("File ")||ye.trim().startsWith("- Stats:"));at=`[ACTION RESULT]: ${_.length>0?_.join(`
|
|
772
|
+
`):R.slice(0,2).join(`
|
|
773
|
+
`)}`}else at=`[ACTION RESULT]: ${re}`;je.push({role:"user",text:at,binaryPart:Nn}),Pn=!0;let Fn=`[ACTION RESULT]: ${se.replaceAll(`[[VERIFIED]]
|
|
776
774
|
`,"").replaceAll(`
|
|
777
|
-
[[/VERIFIED]]`,"")||""}`;(a==="view_file"||a==="web_scrape"||a==="file_map"||a==="search_keyword"||a==="get_progress"||a==="getprogress")&&(
|
|
775
|
+
[[/VERIFIED]]`,"")||""}`;(a==="view_file"||a==="web_scrape"||a==="file_map"||a==="search_keyword"||a==="get_progress"||a==="getprogress")&&(Fn=`[ACTION RESULT]: ${v} (Context Locked for UI Clarity)`),yield{type:"tool_result",content:Fn,aiContent:at,binaryPart:Nn,toolName:a},a==="memory"&&!se.startsWith("ERROR:")&&(yield{type:"memory_updated"}),Et++}if(s==="Google"&&pt&&Date.now()-Qo>=150){yield*un();let y=ko(pt);for(let A of y)yield A;pt="",Qo=Date.now()}}u.usageMetadata&&(en=u.usageMetadata),en&&(yield{type:"liveTokens",content:en.totalTokenCount})}if(H&&(H=!1,Qe?pe+="</think_fluxflow>":(be+="</think_fluxflow>",s==="Google"?pt+="</think_fluxflow>":yield{type:"text",content:"</think_fluxflow>"})),Qe&&pe.length>0){let u=0,S=Math.min(bt.length,pe.length);for(let V=S;V>0;V--)if(bt.endsWith(pe.substring(0,V))){u=V;break}let T=pe.substring(u);if(T){let ie=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(bt)?T.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):T.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(ie)if(be+=ie,s==="Google")pt+=ie;else{yield*un();let M=ko(ie);for(let z of M)yield z}}Qe=!1,pe=""}if(An){let u=An,S=(ht==="tool"||ht==="action")&&(u.startsWith("[tool:")||u.startsWith("[action:"));An="",ao=!1,ht=null,Qn=!1,lo=!1,S||(s==="Google"?pt+=u:yield{type:"text",content:u})}if(yield*un(),xt)break;let To=(be||"").trim(),Oa=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(To.toLowerCase())||/\[\[END\]\]/i.test(To.toLowerCase()),Na=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(To.toLowerCase()),Da=je.length>0||Ut!==null,Ui=jt(To).trim(),Fa=/(\p{Emoji_Presentation}|\p{Extended_Pictographic})$/u.test(Ui),Ba=/([.!?"'*_`|\]\)”’~~]+|\s|`{3}|[\u200B-\u200D\uFEFF])$/u.test(Ui.trim()),Ua=/[.!?}"'`’“”]$|```$/s.test(Ui)||Ba||Fa;!Oa&&!Na&&!Da&&To.length>0,Se=!0,await $t("agent",s)}catch(X){if(xt){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
|
|
778
776
|
|
|
779
|
-
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(String(X).includes("Incomplete JSON segment at the end")){H&&(H=!1,Qe?
|
|
777
|
+
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(String(X).includes("Incomplete JSON segment at the end")){H&&(H=!1,Qe?pe+="</think_fluxflow>":(be+="</think_fluxflow>",yield{type:"text",content:"</think_fluxflow>"})),Se=!0,await $t("agent",s);break}if(H&&(H=!1,Qe?pe+="</think_fluxflow>":be+="</think_fluxflow>"),Qe&&pe.length>0){let St=0,nt=Math.min(bt.length,pe.length);for(let Vt=nt;Vt>0;Vt--)if(bt.endsWith(pe.substring(0,Vt))){St=Vt;break}let mt=pe.substring(St);if(mt){let rt=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(bt)?mt.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):mt.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");rt&&(be+=rt)}Qe=!1,pe=""}let E=X instanceof Error?(()=>{try{return JSON.parse(JSON.parse(X.message).error.message).error.message}catch{return String(X)}})():String(X),gt=new Date().toLocaleString(),de=B.join(eo,"agent");we.existsSync(de)||we.mkdirSync(de,{recursive:!0}),we.appendFileSync(B.join(de,"error.log"),`ERROR [${gt}]: ${E}
|
|
780
778
|
|
|
781
779
|
----------------------------------------------------------------------
|
|
782
780
|
|
|
783
|
-
`);let We=X.status||X.statusCode||X.code,At=String(X).includes("replicas at capacity");if(!(We&&(We>=500&&We<600||We===408||We===429||At)||!We&&(/status[ :]+(5\d\d|408|429)/i.test(String(X))||/code[ :]+(5\d\d|408|429)/i.test(String(X))||/(500|503|408|429)/.test(String(X))))){if(
|
|
781
|
+
`);let We=X.status||X.statusCode||X.code,At=String(X).includes("replicas at capacity");if(!(We&&(We>=500&&We<600||We===408||We===429||At)||!We&&(/status[ :]+(5\d\d|408|429)/i.test(String(X))||/code[ :]+(5\d\d|408|429)/i.test(String(X))||/(500|503|408|429)/.test(String(X))))){if(Pe<fn-3)throw X;yield{type:"text",content:E},yield{type:"status",content:"Error Occured"}}if(be.trim().length>0||tt>1)if(tt<=fn){tt++;let St=Math.min(1e3*Math.pow(2,tt-1),24e3);if(be.trim().length>0){w.push({role:"agent",text:be});let nt=`[system]
|
|
784
782
|
- seamless continuation: resume immediately. pick up from last words with zero gap/disruption
|
|
785
783
|
- no repetition: do not repeat any text already written
|
|
786
784
|
- no re-think: do not restart or open <think_fluxflow> if reasoning already started. continue the thinking and close thinking block </think_fluxflow> before chat output
|
|
787
785
|
- mid-tool safety: if cutoff was mid-tool call, restart that tool call from start
|
|
788
|
-
- stealth: do not mention/apologize for cutoff [/system]`;je.length>0?je.forEach((mt,
|
|
786
|
+
- stealth: do not mention/apologize for cutoff [/system]`;je.length>0?je.forEach((mt,Vt)=>{Vt===je.length-1?w.push({...mt,text:`${mt.text}
|
|
789
787
|
|
|
790
|
-
${nt}`}):
|
|
791
|
-
Error log can be found in \`/export logs\``);else{let nt=e.split("/").slice(e.endsWith("/free")?-2:-1).join("/");if(
|
|
792
|
-
Error log can be found in \`/export logs\``)}}}if(
|
|
793
|
-
`),X=
|
|
788
|
+
${nt}`}):w.push(mt)}):w.push({role:"user",text:nt}),bt+=be}for(let nt=St/1e3;nt>0&&!xt;nt--)yield{type:"status",content:`Error Occured. Recovering Stream (${tt}/${fn}) [Retrying in ${nt.toFixed(0)}s]...`},await new Promise(mt=>setTimeout(mt,1e3));yield{type:"status",content:"Error Occured. Recovering Stream..."}}else throw new Error(`Stream collapsed too many times. (Failed to resolve ${fn} times)
|
|
789
|
+
Error log can be found in \`/export logs\``);else{let nt=e.split("/").slice(e.endsWith("/free")?-2:-1).join("/");if(Pe<=fn){Pe++,tt=1,bt="";let mt=Math.min(1e3*Math.pow(2,Pe-1),32e3),Vt=.8+Math.random()*.4,rt=Math.round(mt*Vt);$n=!0,yield{type:"status",content:`Trying to reach ${nt} (${Pe}/${fn}) [Retrying in ${(rt/1e3).toFixed(0)}s]`};for(let $e=rt/1e3;$e>0&&!xt;$e--)yield{type:"status",content:`Trying to reach ${nt} (${Pe}/${fn}) [Retrying in ${$e.toFixed(0)}s]`},await new Promise(pt=>setTimeout(pt,1e3));yield{type:"status",content:`Trying to reach ${nt}`}}else throw new Error(`Model ${e} cannot be reached. (Failed ${fn} times)
|
|
790
|
+
Error log can be found in \`/export logs\``)}}}if(en){let H=en.totalTokenCount||0,X=en.cachedContentTokenCount||0,E=(en.candidatesTokenCount||0)+(s==="Google"&&en.thoughtsTokenCount||0);await hn("tokens",H,s,te),X>0&&await hn("cachedTokens",X,s,te),E>0&&await hn("candidateTokens",E,s,te),Tt!==null&&Tt>0&&await hn("ttft",Tt,s,te),ci({provider:s,model:te,prompt:en.promptTokenCount||0,cached:X,output:E,reasoning:en.thoughtsTokenCount||0,ttft:Tt}),yield{type:"usage",content:en}}else Tt!==null&&Tt>0&&(await hn("ttft",Tt,s,te),ci({provider:s,model:te,prompt:0,cached:0,output:0,reasoning:0,ttft:Tt}));be=ba(be),Di.push(be);let Ll=jt(be),Bi=pa(be),_a=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(Bi.toLowerCase())||/\[\[END\]\]/i.test(Bi.toLowerCase())||!0,Ol=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(Bi.toLowerCase()),Nl=Et>0;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"};let Ia=Ml(be,/(\[\s*(turn\s*:)?\s*(continue|finish)\s*\]|\[\[END\]\])/gi,"").trim(),Ma=je.length>0||Kn(jt(be)).length>0,Jn=(_a||je.length===0)&&!Wt&&!Xn&&!Gt;if(Jn=je.length===0?Jn:!1,Jn=Ma&&_t||Jo?!1:Jn,be&&be.trim().endsWith('")]')&&je.length===0&&(Jn=!1),Jn){Us=!0;let H=Di.join(`
|
|
791
|
+
`),X=jt(H).trim();yield{type:"interactive_turn_finished",data:{agentText:Ne,fullAgentTextRaw:H,history:[...w],needTitle:Ae}},w.length>0&&w[w.length-1].role==="agent"?w[w.length-1].text=X:w.push({role:"agent",text:X}),w.forEach(E=>{if(E.role==="user"&&E.text&&(E.text=E.text.replace(/\n\[COMPILE ERROR\][\s\S]*?\[\/ERROR\]/g,""),E.text=E.text.replaceAll(`
|
|
794
792
|
|
|
795
793
|
[system] user question. resolve this specific query within '[ANSWER] ... [/ANSWER]' concisely, naturally [/system]
|
|
796
794
|
`,"").replaceAll(`[system] user question. resolve this specific query within '[ANSWER] ... [/ANSWER]' concisely, naturally
|
|
@@ -798,35 +796,36 @@ Error log can be found in \`/export logs\``)}}}if(on){let H=on.totalTokenCount||
|
|
|
798
796
|
`,"").replaceAll(`[system] **strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]
|
|
799
797
|
`,"").replaceAll(/\n\[system\] WARNING, Turn Limit Impending: Step \d+\/\d+\. Wrap up quickly\/prompt user to continue & use \[\[END\]\] quickly\. \[\/system\]/g,""),E.text=E.text.replaceAll(/\n\[system\] File Changes:\n(?:\* .+ \(created|modified|deleted\)\n)*\[\/system\]/g,""),(s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma"))&&(E.text.startsWith("[ACTION RESULT]")||E.text.startsWith("[TOOL RESULT]")))){let de=`
|
|
800
798
|
[system] Action result received. Analyze output and proceed with your turn [/system]`,We=`
|
|
801
|
-
[system] Action result received. Analyze output and proceed with your turn. **strictly follow thinking policy. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]`;E.text=E.text.replaceAll(We,"").replaceAll(de,"").trim()}}),yield{type:"status",content:"[end]"}}if(
|
|
799
|
+
[system] Action result received. Analyze output and proceed with your turn. **strictly follow thinking policy. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]`;E.text=E.text.replaceAll(We,"").replaceAll(de,"").trim()}}),yield{type:"status",content:"[end]"}}if(Jn)break;let Pa=Ia.trim()||"*Working...*";if(w.push({role:"agent",text:Pa}),je.length>0||Pn){if(je.length>0){let H=je.map(rt=>rt.text).join(`
|
|
802
800
|
|
|
803
|
-
`),X=
|
|
804
|
-
`)
|
|
801
|
+
`),X=jt(be),E=Kn(X),gt=ma(X,E),de=Ii(gt),We=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,At=[],ge=[],St;for(;(St=We.exec(de))!==null;)ge.push({index:St.index,toolName:St[1]});for(let rt=0;rt<ge.length;rt++){let $e=ge[rt],pt=rt+1<ge.length?ge[rt+1].index:X.length;E.some(un=>un.fullMatch&&X.startsWith(un.fullMatch,$e.index))||At.push(X.substring($e.index,pt))}let nt=At.length,mt=je.length+nt;if(nt>0){let rt=At.join(`
|
|
802
|
+
`),$e=ha(rt);H+=`
|
|
805
803
|
|
|
806
804
|
[system] Only ${je.length} out of ${mt} attempted tool calls were executed.
|
|
807
|
-
${
|
|
808
|
-
${
|
|
809
|
-
`:""}Verify proper structure compliance [action:ActionName(arg="value")] & try failed calls again [/system]`;for(let pt=0;pt<nt;pt++)await $t("toolFailure")}let
|
|
810
|
-
${We} [/system]`:`[system] Failed to execute ${de>0?de:1} action${de>1?"s":""}. Verify proper structure compliance [action:ActionName(arg="value")] & try again [/system]`;
|
|
805
|
+
${$e?`Parsing Issues Detected:
|
|
806
|
+
${$e}
|
|
807
|
+
`:""}Verify proper structure compliance [action:ActionName(arg="value")] & try failed calls again [/system]`;for(let pt=0;pt<nt;pt++)await $t("toolFailure")}let Vt=je.find(rt=>rt.binaryPart)?.binaryPart||null;w.push({role:"user",text:H,binaryPart:Vt})}}else if(!xt){let H=be.replace(/(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\]|$)/i,""),X=Kn(H),E=ma(H,X),de=(Ii(E).match(/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi)||[]).length;if(Jo||_t&&de>0||de>0){let We=ha(H),At=We?`[system] Failed to execute ${de>0?de:1} action call${de>1?"s":""} due to syntax/structure issues:
|
|
808
|
+
${We} [/system]`:`[system] Failed to execute ${de>0?de:1} action${de>1?"s":""}. Verify proper structure compliance [action:ActionName(arg="value")] & try again [/system]`;w.push({role:"user",text:At}),await $t("toolFailure"),yield{type:"visual_feedback",content:`
|
|
811
809
|
${Lt("\u2718 Model produced malformed tool call")}
|
|
812
810
|
`}}else yield{type:"visual_feedback",content:`
|
|
813
811
|
${Lt("\u2718 Loop Detected")}
|
|
814
|
-
`},
|
|
812
|
+
`},w.push({role:"user",text:`[system] ${Xn&&!Wt?"Stuttering Detected by Internal System. Re-calibrate your response & proceed.":`${Wt?" Over Thinking":" Loop"} Detected by Internal System${Wt?" for current Effort Level":""}. ${Wt?"If you have planned the task, prioritize execution/output":"If you have finished your task provide a simple summary and end"}`} [/system]`});Wt=!1,Xn=!1,Gt=!1}p?.advanceRollback&&await Mo.recordTurnDelta(f,b+1,le),Fi=le.includes("recapture_screen"),Jo=Et>0||Pn}if(!Us&&!xt){let b="\u2726 Turn safety limit reached. Stopping execution.";yield{type:"text",content:`
|
|
815
813
|
|
|
816
814
|
${b}
|
|
817
815
|
`};let ue=(Di.join(`
|
|
818
816
|
`)+`
|
|
819
|
-
${b}`).trim();yield{type:"interactive_turn_finished",data:{agentText:Ne,fullAgentTextRaw:ue,history:[...
|
|
817
|
+
${b}`).trim();yield{type:"interactive_turn_finished",data:{agentText:Ne,fullAgentTextRaw:ue,history:[...w],needTitle:Ae}},yield{type:"status",content:"[end]"}}}catch(U){let w=U?.cause?` (Cause: ${U.cause?.message||String(U.cause)})`:"",he=(U instanceof Error?(()=>{try{return JSON.parse(JSON.parse(U.message).error.message).error.message}catch{return(U.message?`${U.message}${w}`:"")||String(U)}})():String(U)).replace(/^(Error:\s*)+/i,"");s==="Google"&&!/^[A-Z0-9_\-\s]+ ERROR:/i.test(he)&&(he=`GEMINI ERROR: ${he}`);let Kt=new Date().toLocaleString(),Qt=B.join(eo,"agent");yield{type:"text",content:`
|
|
820
818
|
|
|
821
|
-
\u2726 CRITICAL ERROR: ${
|
|
822
|
-
\u2800`},
|
|
823
|
-
CAUSE: ${
|
|
819
|
+
\u2726 CRITICAL ERROR: ${he.includes("fetch failed")?"Failed to Connect. Check your Internet Connection or Wait a moment":he}
|
|
820
|
+
\u2800`},we.existsSync(Qt)||we.mkdirSync(Qt,{recursive:!0}),we.appendFileSync(B.join(Qt,"error.log"),`CRITICAL ERROR [${Kt}]: ${U}${U?.cause?`
|
|
821
|
+
CAUSE: ${U.cause?.stack||U.cause}`:""}
|
|
824
822
|
|
|
825
823
|
----------------------------------------------------------------------
|
|
826
824
|
|
|
827
|
-
`),typeof flushGoogleBuffer=="function"&&(yield*flushGoogleBuffer()),yield{type:"tool_result",content:`ERROR: [INTERNAL CRITICAL] ${
|
|
825
|
+
`),typeof flushGoogleBuffer=="function"&&(yield*flushGoogleBuffer()),yield{type:"tool_result",content:`ERROR: [INTERNAL CRITICAL] ${he}`}}finally{et&&(clearInterval(et),et=null),typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),await di.commitTransaction(),p?.advanceRollback&&await Mo.cleanup(f),await to()}yield{type:"status",content:null}},rf=async(e,t,n=null,i=null,o=null,r=null,d=!1,l=null)=>{let m=await li(),f={...m,...t},h=typeof o=="number"&&o>0?o:50,p=(f?.systemSettings?.loopLimits||"Default").toLowerCase();if(p==="extended")h=Math.floor(h*3);else if(p==="env"){let Me=parseInt(process.env.FLUXFLOW_SUBAGENT_MAX_TURNS||process.env.SUBAGENT_MAX_TURNS||process.env.FLUXFLOW_MAX_LOOPS||process.env.MAX_LOOPS||"",10);Number.isFinite(Me)&&Me>0&&(h=Me)}o=h;let g=process.env.SUBAGENT_MODEL?process.env.SUBAGENT_MODEL.trim():null,s=process.env.SUBAGENT_PROVIDER?process.env.SUBAGENT_PROVIDER.trim():null,x=new Date,I=`${x.getFullYear()}-${x.toLocaleString("en-US",{month:"short"}).toUpperCase()}-${String(x.getDate()).padStart(2,"0")}, ${x.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0}).replace(":","-")}`,C=(Me=>{if(!Me)return null;let Z=Me.toLowerCase();return Z==="google"?"Google":Z==="deepseek"?"DeepSeek":Z==="openrouter"?"OpenRouter":Z==="nvidia"?"NVIDIA":Z==="mistral"?"Mistral":Z==="ollama"?"Ollama":Z==="inferx"?"InferX":Z==="sensenova"?"SenseNova":Z==="poolside"?"Poolside":Z==="9router"||Z==="9Router"?"9router":Z==="aihubmix"||Z==="aihub"?"AIHubMix":Z==="explabs"||Z==="experientiallabs"||Z==="experimentallabs"?"ExpLabs":Z==="tokenharbor"||Z==="token harbor"||Z==="token_harbor"||Z==="thk"?"TokenHarbor":Z==="infron"?"Infron":Z==="apinex"||Z==="apx"?"APInex":Z==="xkiro"||Z==="kiro"?"xKiro":Z==="coarena"||Z==="coarena_ai"?"CoArena":Z==="c_openai"||Z==="custom_openai"||Z==="custom (openai)"||Z==="custom"?"c_openai":null})(s),P=f?.systemSettings?.CustomSubAgent?f?.systemSettings?.SubAgentModel:null,F=f?.systemSettings?.CustomSubAgent?f?.systemSettings?.SubAgentProvider:null,G=null;if(P==="ENV"?(G=g,g&&C&&(f.aiProvider=C)):P&&P!=="Default"?(G=P,F&&(f.aiProvider=F)):g&&C&&(f.aiProvider=C),f.aiProvider){let Me=await zs(f.aiProvider);Me&&(f.apiKey=Me)}let $=Me=>{if(!Me||typeof Me!="string")return{allowed:!0};let Z=[/rm\s+-[rf]{1,2}\s+[\/*.]/i,/rmdir\s+\/[sq]/i,/del\s+\/[fsq]/i,/\bformat\b\s+[a-z]:/i,/mkfs/i,/dd\s+if=/i,/\b(shutdown|reboot|poweroff|init\s+0|init\s+6)\b/i,/chmod\s+(-R\s+)?777\s+[\/*.]/i,/chown\s+(-R\s+)?root/i,/git\s+push\s+.*--force/i,/git\s+clean\s+-fdx/i,/\bsudo\s+su\b/i,/\bsu\s+-\b/i];for(let Ve of Z)if(Ve.test(Me))return{allowed:!1,reason:`Blocked potentially destructive or unsafe command pattern: "${Ve.source}"`};return{allowed:!0}},L=n||G||t?.modelName||t?.activeModel||m.activeModel,Ae=(process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux")==="Windows",Ne=Ae&&f?.systemSettings?.preferBash!==!1&&Js(),et="Run(command=string)",U=`Runs ${Ae?Ji()?"powershell":"windows CMD":"bash"} command`;Ne&&(et=`Run(command=string, ${Qs()||Ji()?"forcePowershell?=bool:false":"forceCwd?=bool:false"})`,U="Runs in git bash. Or force native shell");let w=`-- ACTIONS (path = relative to CWD, path separator: '/') --
|
|
828
826
|
In chat output the format \`[action:ActionName(arg1="value1")]\` in NEW line
|
|
829
827
|
Rules:
|
|
828
|
+
- Max 3 actions/turn
|
|
830
829
|
- JSON escape literal sequences, backslash: \\\\, newLine: \\ n
|
|
831
830
|
- Same file, multiple edits? ONE PatchFile \u226415 blocks
|
|
832
831
|
- Need text or huge file? CodeSearch > Full Read
|
|
@@ -848,12 +847,11 @@ ${d?"- AskMain(question=string). Communicate with PARENT/MAIN AGENT. When clarif
|
|
|
848
847
|
- ReadFile(path=string, startLine?=int, endLine?=int)
|
|
849
848
|
- PatchFile(path=string, allowMultiple?=bool, searchContent1="string match OR ^LINE:start..end$", newContent1=string, ...MAX15). Small searchString. Line Anchors: ^LINE:...$ syntax, must for large blocks & escape sequences
|
|
850
849
|
- WriteFile(path=string, content=string). Creates/Overwrites. File Exist? PatchFile > WriteFile
|
|
851
|
-
- ${et}. ${
|
|
850
|
+
- ${et}. ${U}. Destructive command \u2192 Ask user`.trim(),wn=`=== START SYSTEM PROMPT ===
|
|
852
851
|
Identity: FluxFlow subagent helping the main Agent
|
|
853
|
-
Your task: "${e}"
|
|
854
852
|
CWD: ${process.cwd()}
|
|
855
853
|
|
|
856
|
-
${
|
|
854
|
+
${w.trimEnd()}
|
|
857
855
|
|
|
858
856
|
-- THINKING GUIDANCE --
|
|
859
857
|
Use minimal reasoning. Prefer simplest path; avoid branching; waste NO tokens overthinking. Just focus on task completion. Before actions, provide user facing summary of findings & decisions IN detail
|
|
@@ -861,38 +859,38 @@ Main focus: actions and task, not chatting
|
|
|
861
859
|
On completion, provide a detailed summary in Tables/Markdown Format with file modified info. If any task failed report back in detail
|
|
862
860
|
|
|
863
861
|
Current Time: ${I}
|
|
864
|
-
=== END SYSTEM PROMPT ===`,
|
|
865
|
-
${
|
|
866
|
-
`),
|
|
867
|
-
`),t.onAskMain){r&&r(`[Executing Tool] AskMain("${k}")...`);let
|
|
868
|
-
Answer from Main Agent: ${
|
|
869
|
-
`),
|
|
862
|
+
=== END SYSTEM PROMPT ===`,he=Array.isArray(l)&&l.length>0?l:[{role:"user",text:`Task: ${e}`}];Array.isArray(l)&&l.length>0&&he.push({role:"user",text:`Follow-up instruction: ${e}`});let Kt=0,Qt="";for(;Kt<o;){let Me=await qi("subagent",f);if(!Me.allowed)throw new Error(Me.reason||`Budget Exhausted for Provider (${f?.aiProvider||"Subagent"})`);if(xt){if(t?.taskId&&typeof Ht<"u"){let j=Ht.find(N=>N.id===t.taskId);j&&(j.status="cancelled")}throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}if(t?.taskId&&typeof Ht<"u"){let j=Ht.find(N=>N.id===t.taskId);if(j&&j.status==="cancelled")throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}let Z=he.map(j=>({role:j.role==="user"?"user":"model",parts:[{text:j.text}]}));r&&r(`[Subagent Turn ${Kt+1}]...`);let Ve=["Fast","Low","Medium","High"],ln=process.env.SUBAGENT_THINKING,In=Ve.includes(ln)?ln:"Low",bn=(await $l(f,L,Z,wn,In)).text||"",De=ba(jt(bn).trim());Qt=De,r&&r(`[Subagent Response]
|
|
863
|
+
${De}
|
|
864
|
+
`),he.push({role:"agent",text:De});let wt=Kn(De);if(wt.length===0)break;let Ft=wt.filter(j=>j.toolName.toLowerCase()==="askmain"||j.toolName.toLowerCase()==="ask_main"),Sn=!1,cn="";for(let j of wt){if(xt){if(t?.taskId&&typeof Ht<"u"){let k=Ht.find(ee=>ee.id===t.taskId);k&&(k.status="cancelled")}throw new Error("Subagent task was cancelled.")}if(t?.taskId&&typeof Ht<"u"){let k=Ht.find(ee=>ee.id===t.taskId);if(k&&k.status==="cancelled")throw new Error("Subagent task was cancelled.")}let N=j.toolName.toLowerCase();if(N==="askuser"&&(N="ask"),N==="askmain"||N==="ask_main"){if(Sn)continue;Sn=!0;let k="";if(Ft.length===1?k=O(Ft[0].args).question||Ft[0].args:k=Ft.map((ee,Je)=>{let Ce=O(ee.args);return`Q${Je+1}: ${Ce.question||ee.args}`}).join(`
|
|
865
|
+
`),t.onAskMain){r&&r(`[Executing Tool] AskMain("${k}")...`);let ee=await t.onAskMain(k);r&&r(`[Action Result]
|
|
866
|
+
Answer from Main Agent: ${ee}
|
|
867
|
+
`),cn+=`[ACTION RESULT for AskMain]: Answer from Main Agent: ${ee}
|
|
870
868
|
|
|
871
|
-
`,await $t("toolSuccess")}else
|
|
869
|
+
`,await $t("toolSuccess")}else cn+=`[ACTION RESULT for AskMain]: ERROR: Main agent communication channel not available.
|
|
872
870
|
|
|
873
871
|
`;continue}if(!(i?i.some(k=>k.toLowerCase()===N):!0)){let k=`ERROR: Tool [${j.toolName}] is not in the allowed tools list for this subagent.`;r&&r(`[Blocked Tool Call] ${j.toolName} - not allowed
|
|
874
|
-
`),
|
|
872
|
+
`),cn+=`${k}
|
|
875
873
|
|
|
876
|
-
`;continue}if(N==="exec_command"||N==="execcommand"||N==="run"){let k=
|
|
877
|
-
`),
|
|
874
|
+
`;continue}if(N==="exec_command"||N==="execcommand"||N==="run"){let k=O(j.args,["command","background","timeout"]).command||"",ee=$(k);if(!ee.allowed){let Je=`ERROR: [SECURITY RESTRICTION] Subagent execution blocked command: ${ee.reason}`;r&&r(`[Blocked Command] ${k} - ${ee.reason}
|
|
875
|
+
`),cn+=`${Je}
|
|
878
876
|
|
|
879
|
-
`;continue}}let
|
|
877
|
+
`;continue}}let st="";if(N==="web_search"||N==="websearch")st=`\u2714 \x1B[95mSearched\x1B[0m: ${O(j.args,["query","limit","aiMode"]).query||""}`;else if(N==="web_scrape"||N==="webscrape")st=`\u2714 \x1B[95mScraped\x1B[0m: ${O(j.args,["url"]).url||""}`;else if(N==="search_keyword"||N==="searchkeyword"||N==="codesearch"||N==="code_search"){let k=O(j.args,["keyword","path","fuzzy","subString","regex"]),ee=k.keyword||"",Je=k.path||"";st=`${ee?"\u2714":"\u2718"} \x1B[95mSearched\x1B[0m: ${ee||"No Query"}${Je?` \u2192 ${Je.replaceAll("\\","/")}`:""}`}else if(N==="view_file"||N==="viewfile"||N==="readfile")st=`\u2714 \x1B[95mRead\x1B[0m: ${(O(j.args,["path","targetPath","file","StartLine","EndLine","start_line","end_line","startLine","endLine"]).path||"").replaceAll("\\","/")}`;else if(N==="find_file"||N==="findfile"){let k=O(j.args,["basename","name","path","file","query"]),ee=k.basename||k.name||k.path||k.file||k.query||"";st=`${ee?"\u2714":"\u2718"} \x1B[95mLocated\x1B[0m: ${ee||"No Query"}`}else if(N==="list_files"||N==="read_folder"||N==="readfolder"){let k=O(j.args,["path","recurse","include"]).path||null,ee=O(j.args,["path","recurse","include"]).recurse||0;st=`${k?"\u2714":"\u2718"} \x1B[95mBrowsed\x1B[0m: ${k?`${k.replaceAll("\\","/")}${ee>0?`${k.endsWith("/")?`*${ee}`:`/*${ee}`}`:`${k.endsWith("/")?"":"/"}`}`:""}`}else if(N==="write_file"||N==="writefile"){let k=O(j.args,["path","content"]).path||null;st=`${k?"\u2714":"\u2718"} \x1B[95mCreated\x1B[0m: ${k?`${k.replaceAll("\\","/")}`:"No File Changes"}`}else if(N==="update_file"||N==="updatefile"||N==="patchfile"||N==="patch_file"){let k=O(j.args,["path","allowMultiple","content","searchContent*","replaceContent*","newContent*"]),ee=k.path||null,Ce=Object.entries(k).some(([lt,ft])=>lt.startsWith("searchContent")&&typeof ft=="string"&&ft.startsWith("^LINE:"))?"\u1361":":";st=`${ee?"\u2714":"\u2718"} \x1B[95mEdited\x1B[0m${Ce} ${ee?`${ee.replaceAll("\\","/")}`:"No File Changes"}`}else if(N==="exec_command"||N==="execcommand"||N==="run"){let k=O(j.args,["command","background","timeout"]).command||null;st=`${k?"\u2714":"\u2718"} \x1B[95mExecuted\x1B[0m: ${k?k.slice(0,100)+(k.length>100?"...":""):"No Command"}`}else if(N==="file_map"||N==="filemap"){let k=O(j.args,["path"]).path||"";st=`${k?"\u2714":"\u2718"} \x1B[95mIndexed\x1B[0m: ${k?`${k.replaceAll("\\","/")}`:"File Not Found"}`}else if(N==="await"){let{time:k}=O(j.args,["time","timeout","seconds","sec"]),ee=parseFloat(k)||0;ee<10&&(ee=10),ee>180&&(ee=180),st=`\u2714 \x1B[95mAwaiting\x1B[0m \u2192 ${(Ce=>{if(Ce>=60){let lt=Math.floor(Ce/60),ft=Ce%60;return`${lt}m${ft>0?` ${ft}s`:""}`}return`${Ce}s`})(ee)}`}else{let k=vs[N]||j.toolName,ee=oo(N,j.args);st=`\u2714 \x1B[95m${k}\x1B[0m${ee?`: ${ee}`:""}`}t.onVisualFeedback&&st&&t.onVisualFeedback(st),r&&r(`[Executing Tool] ${j.toolName}(${j.args})...`);try{let k=await xs(j.toolName,j.args,{...t,mode:"Flux"});r&&r(`[Action Result]
|
|
880
878
|
${k}
|
|
881
879
|
`);let Je=(k||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");Je.includes("[[VERIFIED]]")&&(Je=Je.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to save tokens.
|
|
882
|
-
`));let Ce;if((N==="write_file"||N==="writefile")&&!Je.startsWith("ERROR:")){let lt=Je.replace(/^\[\[SAME\]\]\s*\r?\n?/,""),ft=lt.match(/\n\s*(\[Note:\s*'~'\s*resolved\s*to\s*user\s*home\s*directory[\s\S]*?\])\s*$/),
|
|
880
|
+
`));let Ce;if((N==="write_file"||N==="writefile")&&!Je.startsWith("ERROR:")){let lt=Je.replace(/^\[\[SAME\]\]\s*\r?\n?/,""),ft=lt.match(/\n\s*(\[Note:\s*'~'\s*resolved\s*to\s*user\s*home\s*directory[\s\S]*?\])\s*$/),Zt=ft?`
|
|
883
881
|
|
|
884
|
-
${ft[1]}`:"";if(/- Stats:.*\r?\nOld File contents:/s.test(lt)){let
|
|
882
|
+
${ft[1]}`:"";if(/- Stats:.*\r?\nOld File contents:/s.test(lt)){let dn=lt.search(/^- Content Preview:/m);Ce=`[ACTION RESULT]: ${dn!==-1?lt.slice(0,dn).trimEnd():lt}
|
|
885
883
|
|
|
886
|
-
[Old file content for reversal reference. Replaced with new write request]${
|
|
887
|
-
`):
|
|
888
|
-
`)}${
|
|
884
|
+
[Old file content for reversal reference. Replaced with new write request]${Zt}`}else{let dn=lt.split(/\r?\n/),kn=dn.filter(Mi=>Mi.startsWith("File ")||Mi.trim().startsWith("- Stats:"));Ce=`[ACTION RESULT]: ${kn.length>0?kn.join(`
|
|
885
|
+
`):dn.slice(0,2).join(`
|
|
886
|
+
`)}${Zt}`}}else if(Je.startsWith("[[SAME]]")){let ft=Je.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),Zt=ft.filter(kn=>kn.startsWith("File ")||kn.trim().startsWith("- Stats:"));Ce=`[ACTION RESULT]: ${Zt.length>0?Zt.join(`
|
|
889
887
|
`):ft.slice(0,2).join(`
|
|
890
|
-
`)}`}else Ce=`[ACTION RESULT]: ${Je}`;
|
|
888
|
+
`)}`}else Ce=`[ACTION RESULT]: ${Je}`;cn+=`${Ce}
|
|
891
889
|
|
|
892
|
-
`,await $t("toolSuccess")}catch(k){let
|
|
893
|
-
`),
|
|
890
|
+
`,await $t("toolSuccess")}catch(k){let ee=`ERROR: Execution failed for [${j.toolName}]: ${k.message}`;r&&r(`[Tool Error] ${ee}
|
|
891
|
+
`),cn+=`[ACTION RESULT]: ${ee}
|
|
894
892
|
|
|
895
|
-
`,await $t("toolFailure")}}let
|
|
893
|
+
`,await $t("toolFailure")}}let Mn="";if(t?.taskId&&typeof Ht<"u"){let j=Ht.find(N=>N.id===t.taskId);if(j&&j.pendingSteerMessages&&j.pendingSteerMessages.length>0){let N=[...j.pendingSteerMessages];j.pendingSteerMessages=[];for(let Vn of N)Mn+=`
|
|
896
894
|
|
|
897
|
-
[STEERING INSTRUCTION FROM MAIN AGENT]: ${
|
|
898
|
-
`).trim();let Ft=0,
|
|
895
|
+
[STEERING INSTRUCTION FROM MAIN AGENT]: ${Vn}`,r&&r(`[Subagent Steered] ${Vn}`)}}let wo=(cn.trim()+Mn).trim();he.push({role:"user",text:wo}),Kt++}if(t?.onHistoryUpdate&&typeof t.onHistoryUpdate=="function"&&t.onHistoryUpdate(he),f?.systemSettings?.autoTruncateResults){for(let Me=0;Me<he.length;Me++){let Z=he[Me],Ve=Z.text||"";if(!(!Ve.startsWith("[ACTION RESULT]: ")&&!Ve.startsWith("[TOOL RESULT]: "))&&!(Ve.startsWith("[ACTION RESULT]: Goal")||Ve.includes("[ACTION RESULT]: ...Old result truncated")||Ve.includes("[ACTION RESULT]: Diff result ")||Ve.startsWith("[ACTION RESULT]: USER CHOOSE")||Ve.startsWith("[ACTION RESULT]: Skill:")||Ve.startsWith("[ACTION RESULT]: DOCs:")||Ve.startsWith("[ACTION RESULT]: Markdown parsed")||Ve.startsWith("[ACTION RESULT]: Search results for [")||Ve.startsWith("[ACTION RESULT]: AI Mode temporarily failed")||Ve.startsWith("[ACTION RESULT]: Background subagent started. Task ID:")||Ve.startsWith("[ACTION RESULT]: Subagent task")||/^\[ACTION RESULT\]: File \[.*?\] saved/s.test(Ve))){if(f?.systemSettings?.overwriteProtection!==!1){let ln=Ve.match(/^\[ACTION RESULT\]:\s*File\s*\[(.*?)\]\s*updated(?:\s+with\s+some\s+blocks\s+failed)?\.\s*(?:\[(\d+\/\d+)\]\s*blocks\s*applied\.)?([\s\S]*)$/);if(ln)try{let In=ln[1],io=ln[2]||"",bn=ln[3]||"",De=B.basename(In),wt=bn.replace("[DIFF_START]","");wt=wt.replace(/\[DIFF_END\](?=[^\[]*$)/,""),wt=wt.split(/\r?\n/).filter(Ce=>{let lt=Ce.trim();return lt.startsWith("-")||lt.startsWith("+")||lt.startsWith("@@")}).join(`
|
|
896
|
+
`).trim();let Ft=0,Sn=0,cn=bn.matchAll(/@@\s*([^@]+?)\s*@@/g);for(let Ce of cn){let lt=Ce[1],ft=lt.match(/\+(\d+)/),Zt=lt.match(/-(\d+)/);ft&&(Ft+=parseInt(ft[1],10)),Zt&&(Sn+=parseInt(Zt[1],10))}let Mn=[];Ft>0&&Mn.push(`+${Ft}`),Sn>0&&Mn.push(`-${Sn}`);let wo=Mn.length>0?` Total ${Mn.join(" ")} changes.`:"",j=B.join(ii,"DiffBackups");we.existsSync(j)||we.mkdirSync(j,{recursive:!0});let N=String(Date.now()).slice(-5),Vn=wa.randomBytes(2).toString("hex"),st=`${De}-diff-${N}-${Vn}.txt`,k=B.join(j,st);we.writeFileSync(k,wt,"utf8");let ee=`${ii.replaceAll("\\","/").replace(xa.homedir().replaceAll("\\","/"),"~")}/DiffBackups/${st}`,Je=io?` ${io} blocks.`:"";he[Me]={...Z,text:`[ACTION RESULT]: Diff result ${De} saved in '${ee}'.${Je}${wo}`};continue}catch{}}he[Me]={...Z,text:"[ACTION RESULT]: ...Old result truncated to save tokens"}}}t?.onHistoryUpdate&&typeof t.onHistoryUpdate=="function"&&t.onHistoryUpdate(he)}return Qt};export{xo as a,Ri as b,td as c,nd as d,hr as e,Tc as f,Ac as g,yo as h,Cc as i,hi as j,yi as k,Wc as l,Gc as m,Al as n,Qd as o,Cl as p,Rl as q,Rs as r,jt as s,_i as t,ba as u,Zd as v,ef as w,tf as x,Sa as y,nf as z,Ii as A,ma as B,Il as C,Kn as D,of as E,$l as F,sf as G,rf as H};
|