fluxflow-cli 4.39.0 → 4.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{ai-Z2RCLVQR.js → ai-ZKC574A7.js} +1 -1
- package/dist/chunks/app-S2QWIJAK.js +324 -0
- package/dist/chunks/{auto_completion-AIWB2XM2.js → auto_completion-NWIEI4SU.js} +2 -2
- package/dist/chunks/{chunk-IXXTQAO2.js → chunk-4DAFC4RK.js} +1 -1
- package/dist/chunks/{chunk-HIP66OBL.js → chunk-4LL36ESE.js} +175 -173
- package/dist/chunks/{chunk-M2LU3TCU.js → chunk-M3NOFDLJ.js} +1 -1
- package/dist/chunks/chunk-RHZU5POT.js +1 -0
- package/dist/chunks/{chunk-MX5Q32YU.js → chunk-VJT4U6KR.js} +1 -1
- package/dist/chunks/{click-O33RKVOZ.js → click-T2BXRY7O.js} +2 -2
- package/dist/chunks/{computer_action-BUZAZ3LJ.js → computer_action-VQBY6TW2.js} +1 -1
- package/dist/chunks/{drag-BZRZLDLG.js → drag-B5ED6RY7.js} +1 -1
- package/dist/chunks/{generate_image-N2SIC5BA.js → generate_image-UHMQ32EH.js} +1 -1
- package/dist/chunks/{invoke-O2YAE4FY.js → invoke-CYDFNNQ4.js} +2 -2
- package/dist/chunks/{invokeSync-URGZXNDC.js → invokeSync-YEOM3MAZ.js} +2 -2
- package/dist/chunks/{key_press-Y7F3VAKL.js → key_press-MMN6Y3WZ.js} +1 -1
- package/dist/chunks/{keyboard_typing-IEVRWQJJ.js → keyboard_typing-2OCGKXE2.js} +1 -1
- package/dist/chunks/{screen_grid-7APUBF2H.js → screen_grid-26MRFY7E.js} +1 -1
- package/dist/chunks/{scroll-FIN5Z7W4.js → scroll-CVJDBGZL.js} +1 -1
- package/dist/chunks/{search_keyword-YLKWY2XH.js → search_keyword-WIVNNMLY.js} +1 -1
- package/dist/chunks/{settings-IGHDSHFT.js → settings-OPQ3GJ62.js} +1 -1
- package/dist/chunks/{update_file-CYGKZXSH.js → update_file-NT666LF5.js} +1 -1
- package/dist/chunks/{usage-IR23BYQX.js → usage-DFN6SYQ3.js} +1 -1
- package/dist/chunks/{usageServer-ZYJCDO27.js → usageServer-JWNNKDR3.js} +1 -1
- package/dist/chunks/{write_file-TZ2Q6CEB.js → write_file-YYKJ3BGD.js} +1 -1
- package/dist/cli.js +5 -6
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/dist/chunks/app-IKYO4AHO.js +0 -331
- package/dist/chunks/chunk-EUNKA2MP.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Is}from"./chunk-HFTI3R3Q.js";import{a as Ao}from"./chunk-52STSLCN.js";import{a as
|
|
1
|
+
import{a as Is}from"./chunk-HFTI3R3Q.js";import{a as Ao}from"./chunk-52STSLCN.js";import{a as Kt}from"./chunk-56EJGQU3.js";import{c as Oi,g as Li,h as Cs,i as Rs}from"./chunk-M46I73DX.js";import{a as _s,c as vs}from"./chunk-IUN7DBB4.js";import{a as $i,g as Ms}from"./chunk-6H2P5XUL.js";import{a as ei}from"./chunk-6EYQQ7GQ.js";import{a as Ps}from"./chunk-4BLSASW6.js";import{a as H}from"./chunk-Y5JU726N.js";import{b as Mi}from"./chunk-FXRFFNRK.js";import{f as To,l as Rt,n as pt,p as Pi,q as Es}from"./chunk-4DAFC4RK.js";import{b as ko}from"./chunk-RHZU5POT.js";import{l as rt,m as Zo,q as re}from"./chunk-KMOTPBF5.js";import{c as Ct,d as so,e as Qo}from"./chunk-P5HBJA23.js";import{a as $n,b as qo,d as Cn,e as Xo,k as zn,l as Jo,m as vi,r as Ii,w as wo,x as So,y as As}from"./chunk-26BQ45XP.js";import{GoogleGenAI as Jr,ThinkingLevel as He,HarmBlockThreshold as Dn,HarmCategory as Fn}from"@google/genai";var Os=(e=!0,n=!0)=>`
|
|
2
2
|
To use tools, must output exactly '[action:ActionName(arg1="value1")]' structured string in chat response \u2190 no exception
|
|
3
3
|
|
|
4
4
|
-- Chat Management Tools --
|
|
@@ -25,7 +25,7 @@ Usage Rules:
|
|
|
25
25
|
- Chat title is mandatory
|
|
26
26
|
- Temporary memory is mandatory
|
|
27
27
|
- When called user memory, still use Temporary Memory
|
|
28
|
-
- Must not ignore any tool calls in given context of chat between user & agent`:""}`.trim();var ti={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
|
|
28
|
+
- Must not ignore any tool calls in given context of chat between user & agent`:""}`.trim();var ti={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 sn from"fs";import fn from"path";import _a from"os";import cn from"fs";import Nn from"path";import Vs from"fs";import Ni from"path";import{execSync as Ys}from"child_process";import{fileURLToPath as Ea}from"url";var Ls=`# FluxFlow CLI Startup & Flags Reference
|
|
29
29
|
|
|
30
30
|
Launch command syntax:
|
|
31
31
|
fluxflow [options]
|
|
@@ -117,7 +117,6 @@ Trigger in chat via /command
|
|
|
117
117
|
* /wildcard-tooling \u2192 Tool compatibility mode for non-tooling models
|
|
118
118
|
* /wildercard-tooling \u2192 Extended version of /wildcard-tooling
|
|
119
119
|
* /key \u2192 Manage saved API keys
|
|
120
|
-
* /profile \u2192 Edit user persona, nickname, and custom instructions
|
|
121
120
|
* /theme \u2192 Select UI color theme
|
|
122
121
|
* /memory \u2192 View/manage agent persistent memory
|
|
123
122
|
* /budget \u2192 Set/view token budget limits
|
|
@@ -150,7 +149,10 @@ Open in chat via /settings
|
|
|
150
149
|
* Show TPM Estimate \u2192 Real-time Tokens Throughput speed estimate
|
|
151
150
|
* Verbose Thinking \u2192 Show reasoning blocks in the UI. Keeps UI clean when disabled. And reasoning transparent when enabled
|
|
152
151
|
|
|
153
|
-
### 3.
|
|
152
|
+
### 3. Personalization
|
|
153
|
+
* Base Personality \u2192 Pick base personality for agent
|
|
154
|
+
* Nickname \u2192 What agent should call user
|
|
155
|
+
* Custom Instruction \u2192 Custom user preferences
|
|
154
156
|
* Toggle Memory \u2192 Persistent cross-session memory learning (Not available for some providers)
|
|
155
157
|
|
|
156
158
|
### 4. Security & Sandbox
|
|
@@ -468,23 +470,23 @@ Public Docs: https://fluxflow-cli.onrender.com
|
|
|
468
470
|
Default Context Length: 256k Tokens. Can be changed via ENV/In-app Settings \u2192 references/{SETTINGS,ENV}.md
|
|
469
471
|
|
|
470
472
|
Docs missing required info? Say you are not sure enough to answer. Dont give wrong info`,"references/MODES.md":Hs,"references/PROVIDERS.md":js,"references/PLUGINS.md":Ks,"references/STARTUP.md":Ls,"references/ENV.md":$s,"references/COMMANDS.md":Ns,"references/SETTINGS.md":Ds,"references/TOOLS.md":Fs,"references/ARCHITECTURE.md":Bs,"references/SUB_AGENTS.md":Us,"references/SECURITY.md":Ws,"references/IDE.md":Gs};var zs=()=>{try{let e=Nn.join($n,"skills","fluxflow"),n=Nn.join(e,"references");if(process.env.NO_DEV==="true"||process.env.NO_DEV==="1"||process.env.NO_DEV===!0||process.env.NO_INS==="true"||process.env.NO_INS==="1"||process.env.NO_INS==="true"||!1){cn.existsSync(e)&&cn.rmSync(e,{recursive:!0,force:!0});return}let i=new Set(Object.keys(Di).map(o=>Nn.normalize(o)));for(let[o,r]of Object.entries(Di)){let d=Nn.join(e,o),a=Nn.dirname(d);cn.existsSync(a)||cn.mkdirSync(a,{recursive:!0});let u=r.trim()+`
|
|
471
|
-
`,p=null;cn.existsSync(d)&&(p=cn.readFileSync(d,"utf8")),p!==u&&cn.writeFileSync(d,u,"utf8")}if(cn.existsSync(n)){let o=cn.readdirSync(n);for(let r of o){let d=Nn.normalize(Nn.join("references",r));if(!i.has(d)){let a=Nn.join(n,r);try{cn.rmSync(a,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as oi}from"ws";var
|
|
472
|
-
`)},sr=()=>
|
|
473
|
+
`,p=null;cn.existsSync(d)&&(p=cn.readFileSync(d,"utf8")),p!==u&&cn.writeFileSync(d,u,"utf8")}if(cn.existsSync(n)){let o=cn.readdirSync(n);for(let r of o){let d=Nn.normalize(Nn.join("references",r));if(!i.has(d)){let a=Nn.join(n,r);try{cn.rmSync(a,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as oi}from"ws";var Dt=null,ro=!1,Ca="ws://localhost:56832",Fi=[],ao=null,Bi=null,Ui=null,qs="2.0.0",ic=e=>{qs=e,Xs()},Wi=e=>{Bi=e},sc=e=>{Ui=e},Xs=()=>{if(Dt||ro)return;ro=!0;let e=new oi(Ca);e.on("open",()=>{for(Dt=e,ro=!1,Dt.send(JSON.stringify({command:"version",version:qs,pid:process.pid,ppid:process.ppid,cwd:process.cwd()}));Fi.length>0;)Dt.send(JSON.stringify(Fi.shift()))}),e.on("message",n=>{try{let t=JSON.parse(n.toString());t.command==="contextResponse"&&ao?(ao(t.data),ao=null):t.command==="securityResponse"&&Bi?Bi(t.result):t.command==="inlineComplete"?Ra(t):t.command==="connectionRejected"&&Ui&&Ui(t)}catch{}}),e.on("error",()=>{ro=!1,Dt=null}),e.on("close",()=>{ro=!1,Dt=null})},Eo=e=>{Dt&&Dt.readyState===oi.OPEN?Dt.send(JSON.stringify(e)):(Fi.push(e),ro||Xs())},lo=()=>Dt!==null&&Dt.readyState===oi.OPEN,Ra=async e=>{let n="";try{let{generateAutoCompletion:t}=await import("./auto_completion-NWIEI4SU.js");n=await t({prefix:e.prefix||"",suffix:e.suffix||"",fileName:e.fileName||"",language:e.language||"",recentChanges:e.recentChanges||"",clipboard:e.clipboard||""})}catch{n=""}Eo({command:"inlineCompleteResponse",requestId:e.requestId,completion:n||""})},rc=e=>{Eo({command:"status",status:e})},qn=()=>new Promise(e=>{if(!Dt||Dt.readyState!==oi.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}ao=e,Dt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{ao===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),ao=null)},1e3)}),Js=e=>{Eo({command:"open",filePath:e})},Gi=(e,n,t)=>{Eo({command:"showDiff",filePath:e,originalContent:n,modifiedContent:t})},Qs=(e,n)=>{Eo({command:"closeDiff",filePath:e,result:n})};var Po=(e,n)=>{try{if(!sn.existsSync(e))return null;let t=Array.isArray(n)?n.map(o=>o.toLowerCase()):[n.toLowerCase()],i=sn.readdirSync(e);for(let o of t){let r=i.find(d=>d.toLowerCase()===o);if(r){let d=fn.join(e,r);if(sn.statSync(d).isFile())return d}}}catch{}return null},Yi=(e,n)=>{let t=Po(e,n);if(t)try{return sn.readFileSync(t,"utf8")}catch{}return""},Zs=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"]),zi=(e=process.cwd(),n=0,t=8)=>{let i=[];if(n>t)return i;try{if(!sn.existsSync(e))return i;let o=sn.readdirSync(e,{withFileTypes:!0});for(let r of o){let d=r.name,a=fn.join(e,d);if(r.isDirectory())!Zs.has(d)&&!Zs.has(d.toLowerCase())&&i.push(...zi(a,n+1,t));else if(r.isFile()){let u=d.toLowerCase();(u==="agents.md"||u==="agent.md")&&i.push(a)}}}catch{}return i},er=(e,n=2)=>{if(!e)return"";let t=" ".repeat(n);return e.split(/\r?\n/).map(i=>t+i).join(`
|
|
474
|
+
`)},sr=()=>Po($n,["agents.md","agent.md"]),rr=()=>Po(process.cwd(),["agents.md","agent.md"]),ar=()=>Po($n,["fluxflow.md"]),lr=()=>Po(process.cwd(),["fluxflow.md"]),Ro=sr(),ii=rr(),dn=zi(),_o=ar(),vo=lr(),tr=null,Vi="",cr=!1,va=e=>{if(!e||!/^<<<[\s\S]*?Identity:/m.test(e))return e;let n=e.match(/^<<<\s*\r?\n([\s\S]*?)\r?\n>>>\s*(?:\r?\n)?([\s\S]*)$/);if(!n)return e;let t=n[1],i=n[2],o=t.match(/^Identity:\s*([\s\S]*?)(?=\r?\n\s*(?:<><|>>>)|$)/m);return o&&(Vi=o[1].trim(),process.env.NO_INS=!0),/<><\s*NO_INS/.test(t)&&(cr=!0),i.trim()},Ia=()=>{Ro=sr();let e=Ro?Yi($n,["agents.md","agent.md"]).trim():"";return e.length===0?(Ro=null,""):e},Ma=()=>{if(dn=zi(),ii=rr(),!dn||dn.length===0)return"";let e=process.cwd(),n=[...dn].sort((o,r)=>{let d=fn.relative(e,o).replace(/\\/g,"/"),a=fn.relative(e,r).replace(/\\/g,"/"),u=!d.includes("/"),p=!a.includes("/");return u&&!p?-1:!u&&p?1:d.localeCompare(a)}),t=[],i=[];for(let o of n)try{let r=sn.readFileSync(o,"utf8").trim();if(!r||r.length===0)continue;t.push(o);let d=fn.relative(e,o).replace(/\\/g,"/");if(!d.includes("/"))i.push(er(r,2));else{let u=fn.dirname(d)+"/:";i.push(`${u}
|
|
473
475
|
${er(r,2)}`)}}catch{}return dn=t,dn.length===0&&(ii=null),i.join(`
|
|
474
476
|
|
|
475
|
-
`).trim()},qi=()=>{_o=ar();let e=_o?Yi($n,["fluxflow.md"]).trim():"",n=va(e)?.trim()||"";return n.length===0?(_o=null,""):n},Xi=()=>{vo=lr();let e=vo?Yi(process.cwd(),["fluxflow.md"]).trim():"";return e.length===0?(vo=null,""):e},Ji=Ia(),si=Ma(),Io=qi(),Mo=Xi(),nr=(e,n="",t="")=>{if(!e)return"";let i=t.toLowerCase().trim(),o=n.toLowerCase().trim(),r=fn.posix.basename(o),d=i&&o?`${i}@${o}`:"",a=i&&r?`${i}@${r}`:"",u=x=>!x||!o?!1:x===o||x===r||x===d||x===a,p=[];return e.replace(/<start_provider_([^>\r\n]+)>([\s\S]*?)<end_provider_([^>\r\n]+)>/gi,(x,m,f,s)=>{if(i&&m.trim().toLowerCase()===s.trim().toLowerCase()&&m.trim().toLowerCase()===i){let T=f.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(ue,y,
|
|
477
|
+
`).trim()},qi=()=>{_o=ar();let e=_o?Yi($n,["fluxflow.md"]).trim():"",n=va(e)?.trim()||"";return n.length===0?(_o=null,""):n},Xi=()=>{vo=lr();let e=vo?Yi(process.cwd(),["fluxflow.md"]).trim():"";return e.length===0?(vo=null,""):e},Ji=Ia(),si=Ma(),Io=qi(),Mo=Xi(),nr=(e,n="",t="")=>{if(!e)return"";let i=t.toLowerCase().trim(),o=n.toLowerCase().trim(),r=fn.posix.basename(o),d=i&&o?`${i}@${o}`:"",a=i&&r?`${i}@${r}`:"",u=x=>!x||!o?!1:x===o||x===r||x===d||x===a,p=[];return e.replace(/<start_provider_([^>\r\n]+)>([\s\S]*?)<end_provider_([^>\r\n]+)>/gi,(x,m,f,s)=>{if(i&&m.trim().toLowerCase()===s.trim().toLowerCase()&&m.trim().toLowerCase()===i){let T=f.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(ue,y,_,W)=>{if(y.trim().toLowerCase()===W.trim().toLowerCase()){let K=y.trim().toLowerCase();if(u(K)){let F=_.trim();F&&p.push(F)}}return""}).trim();T&&p.push(T)}return""}),e.replace(/<start_model_([^>\r\n@]+@[^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n@]+@[^>\r\n]+)>/gi,(x,m,f,s)=>{if(m.trim().toLowerCase()===s.trim().toLowerCase()){let g=m.trim().toLowerCase();if(u(g)){let T=f.trim();T&&p.push(T)}}return""}),e.replace(/<start_model_([^>\r\n]+)>([\s\S]*?)<end_model_([^>\r\n]+)>/gi,(x,m,f,s)=>{if(m.includes("@"))return"";if(m.trim().toLowerCase()===s.trim().toLowerCase()){let g=m.trim().toLowerCase();if(o&&(g===o||g===r)){let T=f.trim();T&&p.push(T)}}return""}),p.join(`
|
|
476
478
|
|
|
477
|
-
`).trim()},
|
|
479
|
+
`).trim()},Pa=(e="",n="")=>{let t=`${e||""}@${n||""}`.toLowerCase().trim();tr!==t&&(tr=t,Io=qi(),Mo=Xi())};zs();var Oa=e=>{if(!e)return null;let n=e.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!n)return null;let t=n[1];if((n[2]||"").trim().length===0)return null;let o="",r="",d=t.match(/^name:\s*(.+)$/m),a=t.match(/^description:\s*(.+)$/m);return d&&(o=d[1].trim().replace(/^["']|["']$/g,"")),a&&(r=a[1].trim().replace(/^["']|["']$/g,"")),o&&r?{name:o,description:r}:null},La=e=>{let n=[];if(!e||!sn.existsSync(e))return n;let t=(i,o=0)=>{if(!(o>5))try{let r=sn.readdirSync(i,{withFileTypes:!0});for(let d of r){let a=fn.join(i,d.name),u=d.name.toLowerCase();d.isFile()?u==="skill.md"&&n.push(a):d.isDirectory()&&(o===0?(u==="skills"||u===".skills"||u==="skill"||u===".skill")&&t(a,o+1):t(a,o+1))}}catch{}};return t(e,0),n},dr=e=>{let n=La(e),t=[];for(let i of n)try{let o=sn.readFileSync(i,"utf8"),r=Oa(o);r&&t.push({...r,filePath:i})}catch{}return t},fr=e=>!e||e.length===0?"":e.map(n=>`- ${n.name}: ${n.description}`).join(`
|
|
478
480
|
`),ur=dr($n),gr=dr(process.cwd()),Hi=fr(ur),ji=fr(gr),mr=e=>{if(!e)return!1;let n=(e.filePath||"").replace(/\\/g,"/").toLowerCase();return n.includes("/skills/fluxflow/skill.md")||n.includes("/skills/about-fluxflow/skill.md")||e.name?.toLowerCase()==="fluxflow"},pr=()=>(ur||[]).filter(e=>!mr(e)),hr=()=>(gr||[]).filter(e=>!mr(e)),Sc=(Ji?.length>0?1:0)+(si?.length>0?dn.length:0)+(Io?.length>0?1:0)+(Mo?.length>0?1:0)+pr().length+hr().length,Ki=(e,n="Project")=>{if(!e)return"";let t=e.replace(/\\/g,"/");if(n==="Global"){let o=_a.homedir().replace(/\\/g,"/");return t.toLowerCase().startsWith(o.toLowerCase())?"~"+t.slice(o.length):t}let i=fn.relative(process.cwd(),e).replace(/\\/g,"/");return i.startsWith(".")?i:`./${i}`},kc=()=>{Io=qi(),Mo=Xi();let e=[];Ro&&Ji.length>0&&e.push({scope:"Global",path:Ro}),dn&&dn.length>0&&si.length>0?dn.forEach(r=>{e.push({scope:"Project",path:r})}):ii&&si.length>0&&e.push({scope:"Project",path:ii}),_o&&Io.length>0&&e.push({scope:"Global",path:_o}),vo&&Mo.length>0&&e.push({scope:"Project",path:vo});let n=pr(),t=hr(),i=e.length+n.length+t.length;if(i===0)return`\u2726 Loaded Files & Instructions
|
|
479
481
|
\u2800\u2800\x1B[2m\u2514\u2500\x1B[22m No instruction or skill files are currently loaded.
|
|
480
482
|
\u2800`;let o=[];return o.push(`\u2726 Loaded Files & Instructions (${i} ${i===1?"file":"files"} active)`),e.length>0&&(o.push(`
|
|
481
483
|
\x1B[1mInstructions:\x1B[22m`),e.forEach(r=>{o.push(` \u2022 [${r.scope}] ${Ki(r.path,r.scope)}`)})),(n?.length>0||t?.length>0)&&(o.push(`
|
|
482
484
|
\x1B[1mSkills:\x1B[22m`),n?.length>0&&n.forEach(r=>{o.push(` \u2022 [Global] \x1B[36m${r.name}\x1B[39m`),o.push(` \x1B[2m\u2514\u2500 ${Ki(r.filePath,"Global")}\x1B[22m`)}),t?.length>0&&t.forEach(r=>{o.push(` \u2022 [Project] \x1B[36m${r.name}\x1B[39m`),o.push(` \x1B[2m\u2514\u2500 ${Ki(r.filePath,"Project")}\x1B[22m`)})),o.push("\u2800"),o.join(`
|
|
483
485
|
`)},yr=!1;(async()=>{try{let e=await ko();if(Number(e?.display)===1){let{default:n}=await import("screenshot-desktop"),t=await n.listDisplays();t&&t.length>1&&(yr=!0)}}catch{}})();var or=null,Co=null,ir=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",Tc=process.env.NO_DEV||!1,$a=(e,n)=>{if(!n)return"";if(e!==or||Co===null){or=e;try{let t=Ct(zn,[]);Array.isArray(t)&&t.length>0?Co=t.map(i=>`- ${i.memory}`).join(`
|
|
484
|
-
`):Co=""}catch(t){Co="",
|
|
486
|
+
`):Co=""}catch(t){Co="",sn.appendFileSync(`${Cn}/memory/error.txt`,`${t.message}
|
|
485
487
|
-------------------------------------------------
|
|
486
488
|
|
|
487
|
-
`)}}return Co};var xr=(e,n,t,i,o=!0,r=!1,d="Google",a=!1,u,p,x=!1,m="")=>{let f=!1;process.env.forcedReasoning&&(f=!0);let s="";if(!u&&d==="Google"){let
|
|
489
|
+
`)}}return Co};var xr=(e,n,t,i,o=!0,r=!1,d="Google",a=!1,u,p,x=!1,m="")=>{let f=!1;process.env.forcedReasoning&&(f=!0);let s="";if(!u&&d==="Google"){let M=n;n==="Fast"&&(M="Off"),n==="Low"&&(M="Minimal"),n==="Standard"&&(M="Medium"),(n==="xHigh"||n==="Max")&&(M="xHigh"),s=ti[M]||ti.Medium}(u||d!=="Google")&&(s=ti.xHigh,n==="Fast"?s=`No thinking. Immediate response
|
|
488
490
|
Verify imports, tool results & system stability`:n.toLowerCase()==="max"&&(s=`Effort: Max
|
|
489
491
|
Plan step by step`));let g=e.instructions&&e.instructions?.length>0?`User Preferences: ${e.instructions}
|
|
490
492
|
|
|
@@ -492,28 +494,28 @@ Plan step by step`));let g=e.instructions&&e.instructions?.length>0?`User Prefer
|
|
|
492
494
|
${g.length?"":`
|
|
493
495
|
`}`:"",ue=e.name&&e.name?.length>0?`User Name: ${e.name}
|
|
494
496
|
${T.length||g.length?"":`
|
|
495
|
-
`}`:"",y=process.cwd(),
|
|
496
|
-
${
|
|
497
|
+
`}`:"",y=process.cwd(),_=e.preset,K={Sassy:"Sassy",Friendly:"Warm & Chatty",Playful:"Playful",Efficient:"Quick, Concise & Efficient"}[_]||null,F=$a(p,o),E=F?.length>0?`--- Saved Memories ---
|
|
498
|
+
${F}
|
|
497
499
|
|
|
498
|
-
`:"";
|
|
500
|
+
`:"";Pa(d,m);let me=nr(Io,m,d).trim(),ve=[Ji,me].filter(M=>M&&M.length>0).join(`
|
|
499
501
|
|
|
500
|
-
`).trim(),
|
|
502
|
+
`).trim(),we=nr(Mo,m,d).trim(),b=[si,we].filter(M=>M&&M.length>0).join(`
|
|
501
503
|
|
|
502
|
-
`).trim(),
|
|
503
|
-
${
|
|
504
|
-
${
|
|
504
|
+
`).trim(),lt=ve.length>0||b.length>0?`--- Additional Instructions ---
|
|
505
|
+
${ve.length>0?`-- Global --
|
|
506
|
+
${ve}`:""}${b.length>0?`${ve.length>0?`
|
|
505
507
|
|
|
506
508
|
`:""}-- Project --
|
|
507
|
-
${
|
|
509
|
+
${b}`:""}
|
|
508
510
|
|
|
509
|
-
`:""
|
|
510
|
-
${`Identity: ${Vi.length>1?Vi.trim():`Flux Flow
|
|
511
|
+
`:"",$e=(()=>{let M=process.cwd().toLowerCase();if(process.platform==="win32"){let A=process.env.SystemRoot?.toLowerCase()||"c:\\windows",D=process.env.ProgramFiles?.toLowerCase()||"c:\\program files",xe=process.env["ProgramFiles(x86)"]?.toLowerCase()||"c:\\program files (x86)";return M.startsWith(A)||M.startsWith(D)||M.startsWith(xe)}else return M==="/"||["/bin","/sbin","/etc","/usr","/var","/root"].some(D=>M.startsWith(D))})(),Mt=new Date,un=Mt.getFullYear(),_t=Mt.toLocaleString("en-US",{month:"short"}).toUpperCase(),Ut=String(Mt.getDate()).padStart(2,"0"),gn=`${un}-${_t}-${Ut}`,mn=process.env.I_HAVE_TOO_MUCH_MONEY==="true"||!1,Pt=process.env.HALLOWEEN_EEGG==="true"||!1,yt=Pt&&_t.includes("OCT")&&(Ut.includes("30")||Ut.includes("31")),rn=(m||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),S=fn.basename(rn).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,M=>M.toUpperCase().trim()),C=process.env.NO_DEV==="true"||!1,Ie=!1;try{Ie=lo()}catch{Ie=!1}return`${mn?`${" ".repeat(Math.floor(Math.random()*4)+1)}`:""}=== SYSTEM PROMPT ===
|
|
512
|
+
${`Identity: ${Vi.length>1?Vi.trim():`Flux Flow.${K?` ${K}`:""} CLI Assistant${Pt?`. ${yt?"Peak ":""}Halloween Themed, Spooky`:""}`}
|
|
511
513
|
${cr?"":`${t==="Flux"?"":t==="Flow"?"Concise, Humorous, Sarcastic":t==="ICU"?"Computer Use Capabilities. Screenshot as ground truth, analyze grid ids of target. Keyboard shortcuts > mouse clicks":"Computer Use & Workspace Capabilities. Screenshot as ground truth, analyze grid ids of target. Keyboard shortcuts > mouse clicks. Workspace Actions when faster. Focus on Productivity"}`}${yr&&t.toLowerCase().includes("cu")?`
|
|
512
514
|
- 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()}
|
|
513
515
|
|
|
514
|
-
- OS: ${ir}${!
|
|
515
|
-
- Model: ${
|
|
516
|
-
- Date: ${
|
|
516
|
+
- OS: ${ir}${!C&&m.length>1?`
|
|
517
|
+
- Model: ${S}`.trimEnd():""}
|
|
518
|
+
- Date: ${gn}
|
|
517
519
|
|
|
518
520
|
-- REASONING GUIDANCE --
|
|
519
521
|
${d==="Mistral"||d==="Google"&&!u||f?`${s.trimEnd()}${f||n!=="Fast"&&(d==="Mistral"&&n==="Low"&&!u||n!=="High"&&!u)?`
|
|
@@ -524,20 +526,20 @@ Before actions, provide user facing summary of findings & decisions IN detail
|
|
|
524
526
|
${vs(t,ir,a,d,i?.advanceRollback,i?.subAgents!==!1,!!i?.autoExec,!!i?.disableTodo)}${t==="Flux"?"":t.toLowerCase().includes("cu")?`
|
|
525
527
|
|
|
526
528
|
-- SECURITY POLICIES --
|
|
527
|
-
- Dont operate on ANY confidential screens/captcha \u2192 AskUser`:""}${
|
|
529
|
+
- Dont operate on ANY confidential screens/captcha \u2192 AskUser`:""}${Ie?`
|
|
528
530
|
|
|
529
531
|
Reference files as ./file:start..end`:""}
|
|
530
532
|
=== END SYSTEM PROMPT ===${(Hi.length>0||ji.length>0)&&t.toLowerCase().includes("flux")?`
|
|
531
533
|
|
|
532
534
|
- Read relevant skills before tasks, scope: global/project: Use ReadFile, path="#skills/scope?/skillName". In-skill references: path="#skills/scope?/skillName/reference-folder/*.md"`:""}
|
|
533
535
|
|
|
534
|
-
${T}${g}${
|
|
536
|
+
${T}${g}${lt}${Hi.length>0&&t.toLowerCase().includes("flux")?`-- Global Skills --
|
|
535
537
|
${Hi}
|
|
536
538
|
|
|
537
539
|
`:""}${ji.length>0&&t.toLowerCase().includes("flux")?`-- Project Skills --
|
|
538
540
|
${ji}
|
|
539
541
|
|
|
540
|
-
`:""}${
|
|
542
|
+
`:""}${E}`.trim()},br=(e="",n=!0,t=!0)=>`=== SYSTEM PROMPT (strict headless logic worker: zero user-facing text policy, strictly follow) ===
|
|
541
543
|
identity: silent background system process, have no mouth, only output is valid tool calls
|
|
542
544
|
[critical rules]
|
|
543
545
|
- output exactly '[action:ActionName(args)]' calls. no extra words outside
|
|
@@ -554,53 +556,53 @@ identity: silent background system process, have no mouth, only output is valid
|
|
|
554
556
|
YOUR JOB: Analyze the 'User prompt' and 'Agent Raws' to extract facts for long-term memory or handle system tasks
|
|
555
557
|
${n?"If user tell something that is important (like, hobbies, preferences, facts about user, hates, likes, etc) to know user better over time, use user memory tools":""}
|
|
556
558
|
|
|
557
|
-
${
|
|
559
|
+
${Os(n,t)}
|
|
558
560
|
=== END SYSTEM PROMPT ===${e?`
|
|
559
561
|
|
|
560
562
|
-- current saved user memories --
|
|
561
|
-
${e}`:""}`.trim();var wr=()=>import("./web_search-NT3HXUO3.js").then(e=>e.web_search),Sr=()=>import("./web_scrape-MW6YSZ7L.js").then(e=>e.web_scrape),kr=()=>import("./memory-7YOYCOXE.js").then(e=>e.memory),Tr=()=>import("./chat-C7HYXKVZ.js").then(e=>e.chat),Ar=()=>import("./view_file-I77KYUO5.js").then(e=>e.view_file),Er=()=>import("./write_file-TZ2Q6CEB.js").then(e=>e.write_file),Cr=()=>import("./update_file-CYGKZXSH.js").then(e=>e.update_file),Rr=()=>import("./exec_command-WB2PILWK.js").then(e=>e.exec_command),_r=()=>import("./read_folder-EI2CNHNS.js").then(e=>e.read_folder),Qi=()=>import("./ask_user-K2DLZF6H.js").then(e=>e.ask_user),vr=()=>import("./write_pdf-26OQPNEP.js").then(e=>e.write_pdf),Ir=()=>import("./write_docx-E3MTFXTQ.js").then(e=>e.write_docx),ri=()=>import("./search_keyword-YLKWY2XH.js").then(e=>e.search_keyword),Mr=()=>import("./generate_image-N2SIC5BA.js").then(e=>e.generate_image),ai=()=>import("./saveSummary-W2JMDVZJ.js").then(e=>e.saveSummary),Po=()=>import("./addMemScore-PBVNSFPN.js").then(e=>e.addMemScore),Or=()=>import("./file_map-UA4BA5OH.js").then(e=>e.file_map),li=()=>import("./todo-CJLWLWJB.js").then(e=>e.todo),Pr=()=>import("./invokeSync-URGZXNDC.js").then(e=>e.invokeSync),Na=()=>import("./invoke-O2YAE4FY.js").then(e=>e.invoke),Lr=()=>import("./getProgress-A2TW34Q7.js").then(e=>e.getProgress),Da=()=>import("./cancel-F3ZOEBKW.js").then(e=>e.cancel),$r=()=>import("./emergency_rollback-ZHQXCIHW.js").then(e=>e.emergency_rollback),Lo=()=>import("./awaitSubagent-JKQ2EHVY.js").then(e=>e.awaitSubagent),$o=()=>import("./answerSubagent-BPNNJXPC.js").then(e=>e.answerSubagent),ci=()=>import("./steerSubagent-UETXH2CB.js").then(e=>e.steerSubagent),di=()=>import("./computer_action-BUZAZ3LJ.js").then(e=>e.computer_action),Nr=()=>import("./click-O33RKVOZ.js").then(e=>e.click),Dr=()=>import("./drag-BZRZLDLG.js").then(e=>e.drag),Fr=()=>import("./scroll-FIN5Z7W4.js").then(e=>e.scroll),Zi=()=>import("./keyboard_typing-IEVRWQJJ.js").then(e=>e.keyboard_typing),es=()=>import("./key_press-Y7F3VAKL.js").then(e=>e.key_press),ts=()=>import("./recapture_screen-PPT2E3CK.js").then(e=>e.recapture_screen),fi=()=>import("./find_file-HYHHFHUJ.js").then(e=>e.find_file),Br=()=>import("./wait-TJR6LAR4.js").then(e=>e.wait),Ur={web_search:wr,web_scrape:Sr,memory:kr,chat:Tr,view_file:Ar,write_file:Er,update_file:Cr,exec_command:Rr,read_folder:_r,write_pdf:vr,write_docx:Ir,search_keyword:ri,generate_image:Mr,saveSummary:ai,addMemScore:Po,file_map:Or,todo:li,Todo:li,goal:li,Goal:li,invokeSync:Pr,invoke:Na,getProgress:Lr,cancel:Da,awaitSubagent:Lo,answerSubagent:$o,steerSubagent:ci,computer_action:di,computer_use:di,ComputerAction:di,ComputerUse:di,click:Nr,Click:Nr,drag:Dr,Drag:Dr,scroll:Fr,Scroll:Fr,keyboard_typing:Zi,KeyboardTyping:Zi,keyboardtyping:Zi,key_press:es,KeyPress:es,keypress:es,recapture_screen:ts,RecaptureScreen:ts,recapturescreen:ts,invoke_sync:Pr,get_progress:Lr,await_subagent:Lo,answer_subagent:$o,steer_subagent:ci,steer:ci,Steer:ci,ask:Qi,Ask:Qi,AskUser:Qi,WebSearch:wr,WebScrape:Sr,ReadFile:Ar,ReadFolder:_r,WriteFile:Er,PatchFile:Cr,WritePDF:vr,WriteDoc:Ir,Run:Rr,SearchKeyword:ri,CodeSearch:ri,code_search:ri,Memory:kr,Chat:Tr,GenerateImage:Mr,saveSumary:ai,SaveSummary:ai,SaveSumary:ai,add_mem_score:Po,AddMemScore:Po,addMemoryScore:Po,AddMemoryScore:Po,FileMap:Or,answer:$o,Answer:$o,AnswerSubagent:$o,await:Lo,Await:Lo,AwaitSubagent:Lo,EmergencyRollback:$r,emergency_rollback:$r,find_file:fi,findFile:fi,FindFile:fi,findfile:fi,wait:Br,Wait:Br},No=async(e,n,t={})=>{let i=t.mode?t.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(x=>o.includes(x))||o==="ask",u=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(x=>o.includes(x));if(!d){if(i==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Action [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(i==="icu"){if(!u)return`ERROR: Action [${e}] is not available in Computer Use mode. ICU mode only supports Computer Use tools (Click, Drag, Scroll, KeyboardTyping, KeyPress, RecaptureScreen).`}else if(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image"))return`ERROR: Action [${e}] is not available in ${t.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let p=Ur[e];if(!p){let x=["ReadFile","ReadFolder","FindFile","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Wait","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],m={read:"ReadFile",view:"ReadFile",viewfile:"ReadFile",write:"WriteFile",edit:"PatchFile",patch:"PatchFile",update:"PatchFile",updatefile:"PatchFile",exec:"Run",command:"Run",bash:"Run",shell:"Run",powershell:"Run",search:"CodeSearch",grep:"CodeSearch",find:"FindFile",findfile:"FindFile",searchkeyword:"CodeSearch",folder:"ReadFolder",ls:"ReadFolder",dir:"ReadFolder",list:"ReadFolder",ask:"AskUser",question:"AskUser",pdf:"WritePDF",docx:"WriteDoc",doc:"WriteDoc",word:"WriteDoc",screenshot:"RecaptureScreen",screen:"RecaptureScreen",recapture:"RecaptureScreen",type:"KeyboardTyping",typing:"KeyboardTyping",keyboard:"KeyboardTyping",press:"KeyPress",key:"KeyPress",todo:"Goal",task:"Goal",subagent:"Invoke",agent:"Invoke"},f=o.replace(/[^a-z0-9]/g,""),s=m[f]||null;if(!s){let T=0,ue=R=>{let B=new Set;for(let j=0;j<R.length-1;j++)B.add(R.slice(j,j+2));return B},y=ue(f);for(let R of x){let B=R.toLowerCase().replace(/[^a-z0-9]/g,"");if(f===B){s=R;break}let j=0;(B.includes(f)||f.includes(B))&&(j+=.6);let N=ue(B),A=0;for(let Se of y)N.has(Se)&&A++;let me=2*A/(y.size+N.size||1);j=Math.max(j,me),j>T&&j>=.35&&(T=j,s=R)}}let g=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${g}`}try{return await(await p())(n,t)}catch(x){let m=x instanceof Error?x.message:String(x);return`ERROR: Execution failed for [${e}]: ${m}`}};var ui=e=>{if(!e||typeof e!="string")return!1;let n=e.trim().toLowerCase();return Object.keys(Ur).some(t=>t.toLowerCase()===n)};import H from"path";import we from"fs";import{execSync as as}from"child_process";import Fa from"gradient-string";var Wr=["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 Gr=["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 Hr=[{name:"Cyan Cyberpunk",text:"cyan",textMuted:"#4da6b8",textDim:"#2d6d7a",textInverted:"black",border:"cyan",borderMuted:"#1a5966",borderDim:"#0f3840",bg:void 0,cardBg:"#061e24",highlightBg:"#092b33",activeBg:"#0e3e4a",inputBg:"#092b33",inputBorder:"#092b33",inputText:"cyan",inputPlaceholder:"#2d6d7a",inputPrompt:"cyan",codeBg:"#020d10",codeBorder:"#1a5966",userMsgBg:"#092b33",userMsgBorder:"#092b33",userMsgText:"cyan",diffRemovalBg:"#3a0c1a",diffAdditionBg:"#0c3a32",diffRemovalText:"#ff4d88",diffAdditionText:"#00ffaa",diffRemovalHighlightColor:"#ff1a66",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#00ffcc",diffAdditionHighlightBg:"#00593b",diffRemovalNum:"#ff4d88",diffAdditionNum:"#00ffaa",diffRemovalPrefix:"#ff1a66",diffAdditionPrefix:"#00ffcc",primary:"cyan",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"cyan",statusOff:"#2d6d7a",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[36m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ffff","#0088ff"]},{name:"Magenta Vaporwave",text:"magenta",textMuted:"#c451d6",textDim:"#7d2b8a",textInverted:"black",border:"magenta",borderMuted:"#5e1b69",borderDim:"#3b0f42",bg:void 0,cardBg:"#240729",highlightBg:"#310938",activeBg:"#470e52",inputBg:"#310938",inputBorder:"#310938",inputText:"magenta",inputPlaceholder:"#7d2b8a",inputPrompt:"magenta",codeBg:"#100312",codeBorder:"#5e1b69",userMsgBg:"#310938",userMsgBorder:"#310938",userMsgText:"magenta",diffRemovalBg:"#3a0c20",diffAdditionBg:"#200c3a",diffRemovalText:"#ff4d94",diffAdditionText:"#aa4dff",diffRemovalHighlightColor:"#ff1a75",diffRemovalHighlightBg:"#59002b",diffAdditionHighlightColor:"#bb66ff",diffAdditionHighlightBg:"#3b0059",diffRemovalNum:"#ff4d94",diffAdditionNum:"#aa4dff",diffRemovalPrefix:"#ff1a75",diffAdditionPrefix:"#bb66ff",primary:"magenta",secondary:"cyan",accent:"purple",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"magenta",statusOff:"#7d2b8a",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff00ff","#8800ff"]},{name:"Glitch Matrix",text:"#00ff41",textMuted:"#00b32d",textDim:"#00661a",textInverted:"black",border:"#00ff41",borderMuted:"#008020",borderDim:"#004d13",bg:void 0,cardBg:"#0d1f0d",highlightBg:"#122912",activeBg:"#1c3e1c",inputBg:"#122912",inputBorder:"#122912",inputText:"#00ff41",inputPlaceholder:"#00b32d",inputPrompt:"#ffff00",codeBg:"#040a04",codeBorder:"#008020",userMsgBg:"#122912",userMsgBorder:"#122912",userMsgText:"#00ff41",diffRemovalBg:"#3a001a",diffAdditionBg:"#003a10",diffRemovalText:"#ff0055",diffAdditionText:"#00ff66",diffRemovalHighlightColor:"#ff0033",diffRemovalHighlightBg:"#59001b",diffAdditionHighlightColor:"#33ff88",diffAdditionHighlightBg:"#005918",diffRemovalNum:"#ff0055",diffAdditionNum:"#00ff66",diffRemovalPrefix:"#ff0033",diffAdditionPrefix:"#33ff88",primary:"#00ff41",secondary:"yellow",accent:"cyan",success:"#00ff41",warning:"yellow",danger:"red",info:"cyan",statusOn:"#00ff41",statusOff:"#00661a",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ff41","#ffff00"]},{name:"Warm Sunset",text:"#ffaa55",textMuted:"#cc8844",textDim:"#885522",textInverted:"black",border:"#ff9933",borderMuted:"#aa6622",borderDim:"#663311",bg:void 0,cardBg:"#24180f",highlightBg:"#2e1e12",activeBg:"#422c1b",inputBg:"#2e1e12",inputBorder:"#2e1e12",inputText:"#ffaa55",inputPlaceholder:"#885522",inputPrompt:"#ff7733",codeBg:"#120c08",codeBorder:"#aa6622",userMsgBg:"#2e1e12",userMsgBorder:"#2e1e12",userMsgText:"#ffaa55",diffRemovalBg:"#3d120c",diffAdditionBg:"#3a2e0c",diffRemovalText:"#ff5544",diffAdditionText:"#ffcc33",diffRemovalHighlightColor:"#ff3322",diffRemovalHighlightBg:"#591108",diffAdditionHighlightColor:"#ffee44",diffAdditionHighlightBg:"#594400",diffRemovalNum:"#ff5544",diffAdditionNum:"#ffcc33",diffRemovalPrefix:"#ff3322",diffAdditionPrefix:"#ffee44",primary:"#ffaa55",secondary:"#ff7733",accent:"magenta",success:"#ffcc33",warning:"#ff7733",danger:"#ff3322",info:"#ffaa55",statusOn:"#ffaa55",statusOff:"#885522",logoTextAnsi:"\x1B[1;33m",logoBodyAnsi:"\x1B[33m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff9933","#ff0055"]},{name:"Sakura Blossom",text:"#ffc0e0",textMuted:"#d98cb3",textDim:"#804d66",textInverted:"black",border:"#ff99cc",borderMuted:"#aa4d7a",borderDim:"#662647",bg:void 0,cardBg:"#291320",highlightBg:"#331826",activeBg:"#472235",inputBg:"#331826",inputBorder:"#331826",inputText:"#ffc0e0",inputPlaceholder:"#804d66",inputPrompt:"#ff99cc",codeBg:"#140a10",codeBorder:"#aa4d7a",userMsgBg:"#331826",userMsgBorder:"#331826",userMsgText:"#ffc0e0",diffRemovalBg:"#3e0c1b",diffAdditionBg:"#1b3e2b",diffRemovalText:"#ff6699",diffAdditionText:"#66ffb3",diffRemovalHighlightColor:"#ff3377",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#33ff99",diffAdditionHighlightBg:"#00592e",diffRemovalNum:"#ff6699",diffAdditionNum:"#66ffb3",diffRemovalPrefix:"#ff3377",diffAdditionPrefix:"#33ff99",primary:"#ffc0e0",secondary:"#ff99cc",accent:"magenta",success:"#66ffb3",warning:"yellow",danger:"#ff3377",info:"#ff99cc",statusOn:"#ffc0e0",statusOff:"#804d66",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ffb3d9","#ff3399"]},{name:"Radioactive Slime",text:"#ccff00",textMuted:"#99cc00",textDim:"#669900",textInverted:"#0a0f00",border:"#ccff00",borderMuted:"#99cc00",borderDim:"#669900",bg:void 0,cardBg:"#0f1400",highlightBg:"#1a2400",activeBg:"#2a3b00",inputBg:"#1a2400",inputBorder:"#1a2400",inputText:"#ccff00",inputPlaceholder:"#669900",inputPrompt:"#cc00ff",codeBg:"#050a00",codeBorder:"#99cc00",userMsgBg:"#1a2400",userMsgBorder:"#1a2400",userMsgText:"#ccff00",diffRemovalBg:"#2a0033",diffAdditionBg:"#0f3300",diffRemovalText:"#ff00cc",diffAdditionText:"#00ff33",diffRemovalHighlightColor:"#ff33cc",diffRemovalHighlightBg:"#4d0066",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#1a6600",diffRemovalNum:"#ff00cc",diffAdditionNum:"#00ff33",diffRemovalPrefix:"#ff33cc",diffAdditionPrefix:"#33ff66",primary:"#ccff00",secondary:"#cc00ff",accent:"#ff00cc",success:"#00ff33",warning:"#ffcc00",danger:"#ff0033",info:"#00ccff",statusOn:"#ccff00",statusOff:"#669900",logoTextAnsi:"\x1B[1;38;5;190m",logoBodyAnsi:"\x1B[38;5;190m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ccff00","#cc00ff"]},{name:"Cosmic Void",text:"#f0f8ff",textMuted:"#a6aeb5",textDim:"#5e656e",textInverted:"#010103",border:"#f0f8ff",borderMuted:"#a6aeb5",borderDim:"#5e656e",bg:void 0,cardBg:"#05030d",highlightBg:"#0b081a",activeBg:"#171133",inputBg:"#0b081a",inputBorder:"#0b081a",inputText:"#f0f8ff",inputPlaceholder:"#5e656e",inputPrompt:"#ff007f",codeBg:"#020108",codeBorder:"#a6aeb5",userMsgBg:"#0b081a",userMsgBorder:"#0b081a",userMsgText:"#f0f8ff",diffRemovalBg:"#2e0a29",diffAdditionBg:"#091c33",diffRemovalText:"#ff33a6",diffAdditionText:"#33d6ff",diffRemovalHighlightColor:"#ff66c2",diffRemovalHighlightBg:"#5c1452",diffAdditionHighlightColor:"#66e0ff",diffAdditionHighlightBg:"#123866",diffRemovalNum:"#ff33a6",diffAdditionNum:"#33d6ff",diffRemovalPrefix:"#ff66c2",diffAdditionPrefix:"#66e0ff",primary:"#f0f8ff",secondary:"#ff007f",accent:"#9d00ff",success:"#33d6ff",warning:"#ffcc00",danger:"#ff0040",info:"#9d00ff",statusOn:"#f0f8ff",statusOff:"#5e656e",logoTextAnsi:"\x1B[1;38;5;231m",logoBodyAnsi:"\x1B[38;5;231m",logoMutedAnsi:"\x1B[38;5;240m",logoGradient:["#ffffff","#9d00ff"]},{name:"Magma Eruption",text:"#ff4d00",textMuted:"#cc3d00",textDim:"#802600",textInverted:"#0d0300",border:"#ff4d00",borderMuted:"#cc3d00",borderDim:"#802600",bg:void 0,cardBg:"#1a0600",highlightBg:"#260a00",activeBg:"#401100",inputBg:"#260a00",inputBorder:"#260a00",inputText:"#ff4d00",inputPlaceholder:"#802600",inputPrompt:"#ffcc00",codeBg:"#080200",codeBorder:"#cc3d00",userMsgBg:"#260a00",userMsgBorder:"#260a00",userMsgText:"#ff4d00",diffRemovalBg:"#2e0a0a",diffAdditionBg:"#1f1400",diffRemovalText:"#ff3333",diffAdditionText:"#ffaa00",diffRemovalHighlightColor:"#ff6666",diffRemovalHighlightBg:"#5c1414",diffAdditionHighlightColor:"#ffcc33",diffAdditionHighlightBg:"#3d2900",diffRemovalNum:"#ff3333",diffAdditionNum:"#ffaa00",diffRemovalPrefix:"#ff6666",diffAdditionPrefix:"#ffcc33",primary:"#ff4d00",secondary:"#ffcc00",accent:"#ff0040",success:"#ffaa00",warning:"#ffff00",danger:"#ff0000",info:"#ff8800",statusOn:"#ff4d00",statusOff:"#802600",logoTextAnsi:"\x1B[1;38;5;202m",logoBodyAnsi:"\x1B[38;5;202m",logoMutedAnsi:"\x1B[38;5;236m",logoGradient:["#ff4d00","#ff0000"]}],co={Dark:{id:"Dark",name:"Dark (Default)",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",textExclusive:"#B5B8D9",textMutedExclusive:"#D4DEE7",border:"white",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#1e1e1e",highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:"#1a1a1a",codeBorder:"#444444",userMsgBg:"#444444",userMsgBorder:"#444444",userMsgText:"white",diffRemovalBg:"#250808",diffAdditionBg:"#072410",diffRemovalText:"#885555",diffAdditionText:"#558866",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#5a1818",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#185a25",diffRemovalNum:"#d96868",diffAdditionNum:"#68d98c",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},Light:{id:"Light",name:"Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"black",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#e5e5e5",highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:"#e8e8e8",codeBorder:"#b0b0b0",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:"#fce8e8",diffAdditionBg:"#e6f9e6",diffRemovalText:"#661111",diffAdditionText:"#115511",diffRemovalHighlightColor:"#440000",diffRemovalHighlightBg:"#f8b4b4",diffAdditionHighlightColor:"#003300",diffAdditionHighlightBg:"#a6ebad",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Dark":{id:"GitHub Dark",name:"GitHub Dark",text:"#c9d1d9",textMuted:"#8b949e",textDim:"#6e7681",textInverted:"#0d1117",border:"#30363d",borderMuted:"#30363d",borderDim:"#21262d",bg:void 0,cardBg:"#161b22",highlightBg:"#21262d",activeBg:"#30363d",inputBg:"#21262d",inputBorder:"#21262d",inputText:"#c9d1d9",inputPlaceholder:"#8b949e",inputPrompt:"#58a6ff",codeBg:"#0d1117",codeBorder:"#30363d",userMsgBg:"#21262d",userMsgBorder:"#21262d",userMsgText:"#c9d1d9",diffRemovalBg:"#3c1e1e",diffAdditionBg:"#11381e",diffRemovalText:"#f85149",diffAdditionText:"#3fb950",diffRemovalHighlightColor:"#ff7b72",diffRemovalHighlightBg:"#701c1c",diffAdditionHighlightColor:"#56d364",diffAdditionHighlightBg:"#116329",diffRemovalNum:"#f85149",diffAdditionNum:"#3fb950",diffRemovalPrefix:"#f85149",diffAdditionPrefix:"#3fb950",primary:"#c9d1d9",secondary:"#58a6ff",accent:"#bc8cff",success:"#3fb950",warning:"#d29922",danger:"#f85149",info:"#58a6ff",statusOn:"#58a6ff",statusOff:"#8b949e",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#2ea043","#56d364"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Light":{id:"GitHub Light",name:"GitHub Light",text:"#24292f",textMuted:"#57606a",textDim:"#6e7781",textInverted:"#ffffff",border:"#d0d7de",borderMuted:"#d0d7de",borderDim:"#e1e4e8",bg:void 0,cardBg:"#f6f8fa",highlightBg:"#eaeef2",activeBg:"#d0d7de",inputBg:"#eaeef2",inputBorder:"#eaeef2",inputText:"#24292f",inputPlaceholder:"#57606a",inputPrompt:"#0969da",codeBg:"#ffffff",codeBorder:"#d0d7de",userMsgBg:"#eaeef2",userMsgBorder:"#eaeef2",userMsgText:"#24292f",diffRemovalBg:"#ffebe9",diffAdditionBg:"#e6ffec",diffRemovalText:"#cf222e",diffAdditionText:"#1a7f37",diffRemovalHighlightColor:"#82071e",diffRemovalHighlightBg:"#ffc1c0",diffAdditionHighlightColor:"#116329",diffAdditionHighlightBg:"#acf2bd",diffRemovalNum:"#cf222e",diffAdditionNum:"#1a7f37",diffRemovalPrefix:"#cf222e",diffAdditionPrefix:"#1a7f37",primary:"#24292f",secondary:"#0969da",accent:"#8250df",success:"#1a7f37",warning:"#9a6700",danger:"#cf222e",info:"#0969da",statusOn:"#0969da",statusOff:"#57606a",logoTextAnsi:"\x1B[1;34m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#1a7f37","#2da44e"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Dark":{id:"Transparent Dark",name:"Transparent Dark",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:void 0,codeBorder:"gray",userMsgBg:"#555555",userMsgBorder:"#555555",userMsgText:"white",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#ff6666",diffAdditionText:"#66ff66",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#3a1414",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#143a14",diffRemovalNum:"#ff6666",diffAdditionNum:"#66ff66",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Light":{id:"Transparent Light",name:"Transparent Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:void 0,codeBorder:"gray",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#c02020",diffAdditionText:"#188028",diffRemovalHighlightColor:"#800000",diffRemovalHighlightBg:"#f5d0d0",diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:"#cceccc",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Synthwave 84":{id:"Synthwave 84",name:"Synthwave 84",text:"#fdfdfd",textMuted:"#a08eb7",textDim:"#705c8a",textInverted:"#1a1025",textExclusive:"#e3dcf0",textMutedExclusive:"#b9abc9",border:"#fc28a8",borderMuted:"#a21568",borderDim:"#5c0a3a",bg:void 0,cardBg:"#261b38",highlightBg:"#35254d",activeBg:"#4c3570",inputBg:"#35254d",inputBorder:"#35254d",inputText:"#fdfdfd",inputPlaceholder:"#a08eb7",inputPrompt:"#03e8fc",codeBg:"#1e142b",codeBorder:"#a21568",userMsgBg:"#35254d",userMsgBorder:"#35254d",userMsgText:"#fdfdfd",diffRemovalBg:"#471434",diffAdditionBg:"#144743",diffRemovalText:"#ff4081",diffAdditionText:"#00e5ff",diffRemovalHighlightColor:"#ff79a1",diffRemovalHighlightBg:"#6b1e4e",diffAdditionHighlightColor:"#66f5ff",diffAdditionHighlightBg:"#1e6b65",diffRemovalNum:"#ff4081",diffAdditionNum:"#00e5ff",diffRemovalPrefix:"#ff79a1",diffAdditionPrefix:"#66f5ff",primary:"#fdfdfd",secondary:"#03e8fc",accent:"#fc28a8",success:"#00e5ff",warning:"#ffc107",danger:"#ff4081",info:"#b388ff",statusOn:"#03e8fc",statusOff:"#a08eb7",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#fc28a8","#03e8fc"],toolFeedbackAnsi:"\x1B[38;2;3;232;252m"},"Forest Sprite":{id:"Forest Sprite",name:"Forest Sprite",text:"#d6e6d1",textMuted:"#95b38d",textDim:"#628059",textInverted:"#161c14",textExclusive:"#eaf2e8",textMutedExclusive:"#a9c7a2",border:"#74a862",borderMuted:"#477038",borderDim:"#2b4720",bg:void 0,cardBg:"#1f291c",highlightBg:"#2a3826",activeBg:"#3a4d35",inputBg:"#2a3826",inputBorder:"#2a3826",inputText:"#d6e6d1",inputPlaceholder:"#95b38d",inputPrompt:"#8feb73",codeBg:"#161e14",codeBorder:"#477038",userMsgBg:"#2a3826",userMsgBorder:"#2a3826",userMsgText:"#d6e6d1",diffRemovalBg:"#3b231c",diffAdditionBg:"#203b1c",diffRemovalText:"#db6242",diffAdditionText:"#59cc3f",diffRemovalHighlightColor:"#f0896c",diffRemovalHighlightBg:"#5c362a",diffAdditionHighlightColor:"#80e368",diffAdditionHighlightBg:"#305929",diffRemovalNum:"#db6242",diffAdditionNum:"#59cc3f",diffRemovalPrefix:"#f0896c",diffAdditionPrefix:"#80e368",primary:"#d6e6d1",secondary:"#8feb73",accent:"#e69835",success:"#59cc3f",warning:"#e69835",danger:"#db6242",info:"#73b4eb",statusOn:"#8feb73",statusOff:"#95b38d",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#8feb73","#e69835"],toolFeedbackAnsi:"\x1B[38;2;143;235;115m"},Spookfest:{id:"Spookfest",name:"Spookfest \u{1F383}",text:"#ffeedd",textMuted:"#e09858",textDim:"#a6622b",textInverted:"#0d0702",textExclusive:"#fff3e6",textMutedExclusive:"#d4a276",border:"#ff7518",borderMuted:"#994409",borderDim:"#592502",bg:void 0,cardBg:"#1a0c02",highlightBg:"#2a1403",activeBg:"#3d1d05",inputBg:"#261203",inputBorder:"#261203",inputText:"#ffeedd",inputPlaceholder:"#a6622b",inputPrompt:"#ff7518",codeBg:"#120701",codeBorder:"#592502",userMsgBg:"#261203",userMsgBorder:"#261203",userMsgText:"#ffeedd",diffRemovalBg:"#3d0a0a",diffAdditionBg:"#1a330a",diffRemovalText:"#ff5555",diffAdditionText:"#73e639",diffRemovalHighlightColor:"#ff2222",diffRemovalHighlightBg:"#590e0e",diffAdditionHighlightColor:"#88ff3b",diffAdditionHighlightBg:"#244d0a",diffRemovalNum:"#ff5555",diffAdditionNum:"#73e639",diffRemovalPrefix:"#ff3333",diffAdditionPrefix:"#88ff3b",primary:"#ff7518",secondary:"#a855f7",accent:"#22c55e",success:"#22c55e",warning:"#f59e0b",danger:"#ef4444",info:"#a855f7",statusOn:"#ff7518",statusOff:"#703a08",logoTextAnsi:"\x1B[1;38;2;255;117;24m",logoBodyAnsi:"\x1B[38;2;255;140;26m",logoMutedAnsi:"\x1B[38;2;168;85;247m",logoGradient:["#ff7518","#a855f7"],toolFeedbackAnsi:"\x1B[38;2;255;117;24m"}};var gi=null;var mi=(e="Dark")=>{let n;e==="Mystery"||e==="Chaos"?(gi||(gi=Hr[Math.floor(Math.random()*Hr.length)]),n={...gi,id:"Mystery"}):(gi=null,co[e]?n=co[e]:e==="Halloween"?n=co.Spookfest:e==="GitHub"?n=co["GitHub Dark"]:e==="Transparent"?n=co["Transparent Dark"]:n=co.Dark);let t=n.codeText||n.secondary||n.info||n.logoGradient&&n.logoGradient[0]||"cyan",i=n.toolFeedbackAnsi||"\x1B[95m";return{...n,codeText:t,toolFeedbackAnsi:i}};var Ba=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",$c=(e=2)=>{let n=Ba();return n==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},jr=new Date,Do=jr.getMonth(),Fo=jr.getDate(),Ua=Do===9&&Fo>=15||Do===10&&Fo<=1,ns=null;(process.env.SPOOKFEST==="true"||Ua)&&(ns=await import("./halloween-MX3VNQRW.js"));var Nc=(e="...",n="Loading...",t="Dark")=>{let i=mi(t),o=n;if(n==="c_openai"||n==="Custom (OpenAI)")try{let j=Qo(qo,{})?.systemSettings?.customOpenAIBaseUrl;j&&(o=j)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,a=i.logoMutedAnsi,u="\x1B[0m",p=[" \u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2591\u2591\u2591 "],x=t==="Spookfest"||i.id==="Spookfest"||t==="Halloween"||i.id==="Halloween",m=Do===9&&Fo>=15||Do===10&&Fo<=1,f=x&&m||process.env.SPOOKFEST==="true"&&x,s=p;if(f&&ns){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:B,halloweenBat:j,halloweenArtUser:N}=ns;s=Math.random()>.9&&Do===9&&Fo>=30?j:Math.random()>.5?B:N}else process.env.HALLOWEEN_EEGG="false";let g=f?Gr:Wr,T=g[Math.floor(Math.random()*g.length)],ue=i.logoGradient||["#0077ff","#ff00ff"],y=Fa(ue).multiline(s.join(`
|
|
563
|
+
${e}`:""}`.trim();var wr=()=>import("./web_search-NT3HXUO3.js").then(e=>e.web_search),Sr=()=>import("./web_scrape-MW6YSZ7L.js").then(e=>e.web_scrape),kr=()=>import("./memory-7YOYCOXE.js").then(e=>e.memory),Tr=()=>import("./chat-C7HYXKVZ.js").then(e=>e.chat),Ar=()=>import("./view_file-I77KYUO5.js").then(e=>e.view_file),Er=()=>import("./write_file-YYKJ3BGD.js").then(e=>e.write_file),Cr=()=>import("./update_file-NT666LF5.js").then(e=>e.update_file),Rr=()=>import("./exec_command-WB2PILWK.js").then(e=>e.exec_command),_r=()=>import("./read_folder-EI2CNHNS.js").then(e=>e.read_folder),Qi=()=>import("./ask_user-K2DLZF6H.js").then(e=>e.ask_user),vr=()=>import("./write_pdf-26OQPNEP.js").then(e=>e.write_pdf),Ir=()=>import("./write_docx-E3MTFXTQ.js").then(e=>e.write_docx),ri=()=>import("./search_keyword-WIVNNMLY.js").then(e=>e.search_keyword),Mr=()=>import("./generate_image-UHMQ32EH.js").then(e=>e.generate_image),ai=()=>import("./saveSummary-W2JMDVZJ.js").then(e=>e.saveSummary),Oo=()=>import("./addMemScore-PBVNSFPN.js").then(e=>e.addMemScore),Pr=()=>import("./file_map-UA4BA5OH.js").then(e=>e.file_map),li=()=>import("./todo-CJLWLWJB.js").then(e=>e.todo),Or=()=>import("./invokeSync-YEOM3MAZ.js").then(e=>e.invokeSync),Na=()=>import("./invoke-CYDFNNQ4.js").then(e=>e.invoke),Lr=()=>import("./getProgress-A2TW34Q7.js").then(e=>e.getProgress),Da=()=>import("./cancel-F3ZOEBKW.js").then(e=>e.cancel),$r=()=>import("./emergency_rollback-ZHQXCIHW.js").then(e=>e.emergency_rollback),Lo=()=>import("./awaitSubagent-JKQ2EHVY.js").then(e=>e.awaitSubagent),$o=()=>import("./answerSubagent-BPNNJXPC.js").then(e=>e.answerSubagent),ci=()=>import("./steerSubagent-UETXH2CB.js").then(e=>e.steerSubagent),di=()=>import("./computer_action-VQBY6TW2.js").then(e=>e.computer_action),Nr=()=>import("./click-T2BXRY7O.js").then(e=>e.click),Dr=()=>import("./drag-B5ED6RY7.js").then(e=>e.drag),Fr=()=>import("./scroll-CVJDBGZL.js").then(e=>e.scroll),Zi=()=>import("./keyboard_typing-2OCGKXE2.js").then(e=>e.keyboard_typing),es=()=>import("./key_press-MMN6Y3WZ.js").then(e=>e.key_press),ts=()=>import("./recapture_screen-PPT2E3CK.js").then(e=>e.recapture_screen),fi=()=>import("./find_file-HYHHFHUJ.js").then(e=>e.find_file),Br=()=>import("./wait-TJR6LAR4.js").then(e=>e.wait),Ur={web_search:wr,web_scrape:Sr,memory:kr,chat:Tr,view_file:Ar,write_file:Er,update_file:Cr,exec_command:Rr,read_folder:_r,write_pdf:vr,write_docx:Ir,search_keyword:ri,generate_image:Mr,saveSummary:ai,addMemScore:Oo,file_map:Pr,todo:li,Todo:li,goal:li,Goal:li,invokeSync:Or,invoke:Na,getProgress:Lr,cancel:Da,awaitSubagent:Lo,answerSubagent:$o,steerSubagent:ci,computer_action:di,computer_use:di,ComputerAction:di,ComputerUse:di,click:Nr,Click:Nr,drag:Dr,Drag:Dr,scroll:Fr,Scroll:Fr,keyboard_typing:Zi,KeyboardTyping:Zi,keyboardtyping:Zi,key_press:es,KeyPress:es,keypress:es,recapture_screen:ts,RecaptureScreen:ts,recapturescreen:ts,invoke_sync:Or,get_progress:Lr,await_subagent:Lo,answer_subagent:$o,steer_subagent:ci,steer:ci,Steer:ci,ask:Qi,Ask:Qi,AskUser:Qi,WebSearch:wr,WebScrape:Sr,ReadFile:Ar,ReadFolder:_r,WriteFile:Er,PatchFile:Cr,WritePDF:vr,WriteDoc:Ir,Run:Rr,SearchKeyword:ri,CodeSearch:ri,code_search:ri,Memory:kr,Chat:Tr,GenerateImage:Mr,saveSumary:ai,SaveSummary:ai,SaveSumary:ai,add_mem_score:Oo,AddMemScore:Oo,addMemoryScore:Oo,AddMemoryScore:Oo,FileMap:Pr,answer:$o,Answer:$o,AnswerSubagent:$o,await:Lo,Await:Lo,AwaitSubagent:Lo,EmergencyRollback:$r,emergency_rollback:$r,find_file:fi,findFile:fi,FindFile:fi,findfile:fi,wait:Br,Wait:Br},No=async(e,n,t={})=>{let i=t.mode?t.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(x=>o.includes(x))||o==="ask",u=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(x=>o.includes(x));if(!d){if(i==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Action [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(i==="icu"){if(!u)return`ERROR: Action [${e}] is not available in Computer Use mode. ICU mode only supports Computer Use tools (Click, Drag, Scroll, KeyboardTyping, KeyPress, RecaptureScreen).`}else if(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image"))return`ERROR: Action [${e}] is not available in ${t.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let p=Ur[e];if(!p){let x=["ReadFile","ReadFolder","FindFile","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Wait","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],m={read:"ReadFile",view:"ReadFile",viewfile:"ReadFile",write:"WriteFile",edit:"PatchFile",patch:"PatchFile",update:"PatchFile",updatefile:"PatchFile",exec:"Run",command:"Run",bash:"Run",shell:"Run",powershell:"Run",search:"CodeSearch",grep:"CodeSearch",find:"FindFile",findfile:"FindFile",searchkeyword:"CodeSearch",folder:"ReadFolder",ls:"ReadFolder",dir:"ReadFolder",list:"ReadFolder",ask:"AskUser",question:"AskUser",pdf:"WritePDF",docx:"WriteDoc",doc:"WriteDoc",word:"WriteDoc",screenshot:"RecaptureScreen",screen:"RecaptureScreen",recapture:"RecaptureScreen",type:"KeyboardTyping",typing:"KeyboardTyping",keyboard:"KeyboardTyping",press:"KeyPress",key:"KeyPress",todo:"Goal",task:"Goal",subagent:"Invoke",agent:"Invoke"},f=o.replace(/[^a-z0-9]/g,""),s=m[f]||null;if(!s){let T=0,ue=_=>{let W=new Set;for(let K=0;K<_.length-1;K++)W.add(_.slice(K,K+2));return W},y=ue(f);for(let _ of x){let W=_.toLowerCase().replace(/[^a-z0-9]/g,"");if(f===W){s=_;break}let K=0;(W.includes(f)||f.includes(W))&&(K+=.6);let F=ue(W),E=0;for(let ke of y)F.has(ke)&&E++;let me=2*E/(y.size+F.size||1);K=Math.max(K,me),K>T&&K>=.35&&(T=K,s=_)}}let g=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${g}`}try{return await(await p())(n,t)}catch(x){let m=x instanceof Error?x.message:String(x);return`ERROR: Execution failed for [${e}]: ${m}`}};var ui=e=>{if(!e||typeof e!="string")return!1;let n=e.trim().toLowerCase();return Object.keys(Ur).some(t=>t.toLowerCase()===n)};import j from"path";import Se from"fs";import{execSync as as}from"child_process";import Fa from"gradient-string";var Wr=["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 Gr=["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 Hr=[{name:"Cyan Cyberpunk",text:"cyan",textMuted:"#4da6b8",textDim:"#2d6d7a",textInverted:"black",border:"cyan",borderMuted:"#1a5966",borderDim:"#0f3840",bg:void 0,cardBg:"#061e24",highlightBg:"#092b33",activeBg:"#0e3e4a",inputBg:"#092b33",inputBorder:"#092b33",inputText:"cyan",inputPlaceholder:"#2d6d7a",inputPrompt:"cyan",codeBg:"#020d10",codeBorder:"#1a5966",userMsgBg:"#092b33",userMsgBorder:"#092b33",userMsgText:"cyan",diffRemovalBg:"#3a0c1a",diffAdditionBg:"#0c3a32",diffRemovalText:"#ff4d88",diffAdditionText:"#00ffaa",diffRemovalHighlightColor:"#ff1a66",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#00ffcc",diffAdditionHighlightBg:"#00593b",diffRemovalNum:"#ff4d88",diffAdditionNum:"#00ffaa",diffRemovalPrefix:"#ff1a66",diffAdditionPrefix:"#00ffcc",primary:"cyan",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"cyan",statusOff:"#2d6d7a",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[36m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ffff","#0088ff"]},{name:"Magenta Vaporwave",text:"magenta",textMuted:"#c451d6",textDim:"#7d2b8a",textInverted:"black",border:"magenta",borderMuted:"#5e1b69",borderDim:"#3b0f42",bg:void 0,cardBg:"#240729",highlightBg:"#310938",activeBg:"#470e52",inputBg:"#310938",inputBorder:"#310938",inputText:"magenta",inputPlaceholder:"#7d2b8a",inputPrompt:"magenta",codeBg:"#100312",codeBorder:"#5e1b69",userMsgBg:"#310938",userMsgBorder:"#310938",userMsgText:"magenta",diffRemovalBg:"#3a0c20",diffAdditionBg:"#200c3a",diffRemovalText:"#ff4d94",diffAdditionText:"#aa4dff",diffRemovalHighlightColor:"#ff1a75",diffRemovalHighlightBg:"#59002b",diffAdditionHighlightColor:"#bb66ff",diffAdditionHighlightBg:"#3b0059",diffRemovalNum:"#ff4d94",diffAdditionNum:"#aa4dff",diffRemovalPrefix:"#ff1a75",diffAdditionPrefix:"#bb66ff",primary:"magenta",secondary:"cyan",accent:"purple",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"magenta",statusOff:"#7d2b8a",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff00ff","#8800ff"]},{name:"Glitch Matrix",text:"#00ff41",textMuted:"#00b32d",textDim:"#00661a",textInverted:"black",border:"#00ff41",borderMuted:"#008020",borderDim:"#004d13",bg:void 0,cardBg:"#0d1f0d",highlightBg:"#122912",activeBg:"#1c3e1c",inputBg:"#122912",inputBorder:"#122912",inputText:"#00ff41",inputPlaceholder:"#00b32d",inputPrompt:"#ffff00",codeBg:"#040a04",codeBorder:"#008020",userMsgBg:"#122912",userMsgBorder:"#122912",userMsgText:"#00ff41",diffRemovalBg:"#3a001a",diffAdditionBg:"#003a10",diffRemovalText:"#ff0055",diffAdditionText:"#00ff66",diffRemovalHighlightColor:"#ff0033",diffRemovalHighlightBg:"#59001b",diffAdditionHighlightColor:"#33ff88",diffAdditionHighlightBg:"#005918",diffRemovalNum:"#ff0055",diffAdditionNum:"#00ff66",diffRemovalPrefix:"#ff0033",diffAdditionPrefix:"#33ff88",primary:"#00ff41",secondary:"yellow",accent:"cyan",success:"#00ff41",warning:"yellow",danger:"red",info:"cyan",statusOn:"#00ff41",statusOff:"#00661a",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ff41","#ffff00"]},{name:"Warm Sunset",text:"#ffaa55",textMuted:"#cc8844",textDim:"#885522",textInverted:"black",border:"#ff9933",borderMuted:"#aa6622",borderDim:"#663311",bg:void 0,cardBg:"#24180f",highlightBg:"#2e1e12",activeBg:"#422c1b",inputBg:"#2e1e12",inputBorder:"#2e1e12",inputText:"#ffaa55",inputPlaceholder:"#885522",inputPrompt:"#ff7733",codeBg:"#120c08",codeBorder:"#aa6622",userMsgBg:"#2e1e12",userMsgBorder:"#2e1e12",userMsgText:"#ffaa55",diffRemovalBg:"#3d120c",diffAdditionBg:"#3a2e0c",diffRemovalText:"#ff5544",diffAdditionText:"#ffcc33",diffRemovalHighlightColor:"#ff3322",diffRemovalHighlightBg:"#591108",diffAdditionHighlightColor:"#ffee44",diffAdditionHighlightBg:"#594400",diffRemovalNum:"#ff5544",diffAdditionNum:"#ffcc33",diffRemovalPrefix:"#ff3322",diffAdditionPrefix:"#ffee44",primary:"#ffaa55",secondary:"#ff7733",accent:"magenta",success:"#ffcc33",warning:"#ff7733",danger:"#ff3322",info:"#ffaa55",statusOn:"#ffaa55",statusOff:"#885522",logoTextAnsi:"\x1B[1;33m",logoBodyAnsi:"\x1B[33m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff9933","#ff0055"]},{name:"Sakura Blossom",text:"#ffc0e0",textMuted:"#d98cb3",textDim:"#804d66",textInverted:"black",border:"#ff99cc",borderMuted:"#aa4d7a",borderDim:"#662647",bg:void 0,cardBg:"#291320",highlightBg:"#331826",activeBg:"#472235",inputBg:"#331826",inputBorder:"#331826",inputText:"#ffc0e0",inputPlaceholder:"#804d66",inputPrompt:"#ff99cc",codeBg:"#140a10",codeBorder:"#aa4d7a",userMsgBg:"#331826",userMsgBorder:"#331826",userMsgText:"#ffc0e0",diffRemovalBg:"#3e0c1b",diffAdditionBg:"#1b3e2b",diffRemovalText:"#ff6699",diffAdditionText:"#66ffb3",diffRemovalHighlightColor:"#ff3377",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#33ff99",diffAdditionHighlightBg:"#00592e",diffRemovalNum:"#ff6699",diffAdditionNum:"#66ffb3",diffRemovalPrefix:"#ff3377",diffAdditionPrefix:"#33ff99",primary:"#ffc0e0",secondary:"#ff99cc",accent:"magenta",success:"#66ffb3",warning:"yellow",danger:"#ff3377",info:"#ff99cc",statusOn:"#ffc0e0",statusOff:"#804d66",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ffb3d9","#ff3399"]},{name:"Radioactive Slime",text:"#ccff00",textMuted:"#99cc00",textDim:"#669900",textInverted:"#0a0f00",border:"#ccff00",borderMuted:"#99cc00",borderDim:"#669900",bg:void 0,cardBg:"#0f1400",highlightBg:"#1a2400",activeBg:"#2a3b00",inputBg:"#1a2400",inputBorder:"#1a2400",inputText:"#ccff00",inputPlaceholder:"#669900",inputPrompt:"#cc00ff",codeBg:"#050a00",codeBorder:"#99cc00",userMsgBg:"#1a2400",userMsgBorder:"#1a2400",userMsgText:"#ccff00",diffRemovalBg:"#2a0033",diffAdditionBg:"#0f3300",diffRemovalText:"#ff00cc",diffAdditionText:"#00ff33",diffRemovalHighlightColor:"#ff33cc",diffRemovalHighlightBg:"#4d0066",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#1a6600",diffRemovalNum:"#ff00cc",diffAdditionNum:"#00ff33",diffRemovalPrefix:"#ff33cc",diffAdditionPrefix:"#33ff66",primary:"#ccff00",secondary:"#cc00ff",accent:"#ff00cc",success:"#00ff33",warning:"#ffcc00",danger:"#ff0033",info:"#00ccff",statusOn:"#ccff00",statusOff:"#669900",logoTextAnsi:"\x1B[1;38;5;190m",logoBodyAnsi:"\x1B[38;5;190m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ccff00","#cc00ff"]},{name:"Cosmic Void",text:"#f0f8ff",textMuted:"#a6aeb5",textDim:"#5e656e",textInverted:"#010103",border:"#f0f8ff",borderMuted:"#a6aeb5",borderDim:"#5e656e",bg:void 0,cardBg:"#05030d",highlightBg:"#0b081a",activeBg:"#171133",inputBg:"#0b081a",inputBorder:"#0b081a",inputText:"#f0f8ff",inputPlaceholder:"#5e656e",inputPrompt:"#ff007f",codeBg:"#020108",codeBorder:"#a6aeb5",userMsgBg:"#0b081a",userMsgBorder:"#0b081a",userMsgText:"#f0f8ff",diffRemovalBg:"#2e0a29",diffAdditionBg:"#091c33",diffRemovalText:"#ff33a6",diffAdditionText:"#33d6ff",diffRemovalHighlightColor:"#ff66c2",diffRemovalHighlightBg:"#5c1452",diffAdditionHighlightColor:"#66e0ff",diffAdditionHighlightBg:"#123866",diffRemovalNum:"#ff33a6",diffAdditionNum:"#33d6ff",diffRemovalPrefix:"#ff66c2",diffAdditionPrefix:"#66e0ff",primary:"#f0f8ff",secondary:"#ff007f",accent:"#9d00ff",success:"#33d6ff",warning:"#ffcc00",danger:"#ff0040",info:"#9d00ff",statusOn:"#f0f8ff",statusOff:"#5e656e",logoTextAnsi:"\x1B[1;38;5;231m",logoBodyAnsi:"\x1B[38;5;231m",logoMutedAnsi:"\x1B[38;5;240m",logoGradient:["#ffffff","#9d00ff"]},{name:"Magma Eruption",text:"#ff4d00",textMuted:"#cc3d00",textDim:"#802600",textInverted:"#0d0300",border:"#ff4d00",borderMuted:"#cc3d00",borderDim:"#802600",bg:void 0,cardBg:"#1a0600",highlightBg:"#260a00",activeBg:"#401100",inputBg:"#260a00",inputBorder:"#260a00",inputText:"#ff4d00",inputPlaceholder:"#802600",inputPrompt:"#ffcc00",codeBg:"#080200",codeBorder:"#cc3d00",userMsgBg:"#260a00",userMsgBorder:"#260a00",userMsgText:"#ff4d00",diffRemovalBg:"#2e0a0a",diffAdditionBg:"#1f1400",diffRemovalText:"#ff3333",diffAdditionText:"#ffaa00",diffRemovalHighlightColor:"#ff6666",diffRemovalHighlightBg:"#5c1414",diffAdditionHighlightColor:"#ffcc33",diffAdditionHighlightBg:"#3d2900",diffRemovalNum:"#ff3333",diffAdditionNum:"#ffaa00",diffRemovalPrefix:"#ff6666",diffAdditionPrefix:"#ffcc33",primary:"#ff4d00",secondary:"#ffcc00",accent:"#ff0040",success:"#ffaa00",warning:"#ffff00",danger:"#ff0000",info:"#ff8800",statusOn:"#ff4d00",statusOff:"#802600",logoTextAnsi:"\x1B[1;38;5;202m",logoBodyAnsi:"\x1B[38;5;202m",logoMutedAnsi:"\x1B[38;5;236m",logoGradient:["#ff4d00","#ff0000"]}],co={Dark:{id:"Dark",name:"Dark (Default)",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",textExclusive:"#B5B8D9",textMutedExclusive:"#D4DEE7",border:"white",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#1e1e1e",highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:"#1a1a1a",codeBorder:"#444444",userMsgBg:"#444444",userMsgBorder:"#444444",userMsgText:"white",diffRemovalBg:"#250808",diffAdditionBg:"#072410",diffRemovalText:"#885555",diffAdditionText:"#558866",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#5a1818",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#185a25",diffRemovalNum:"#d96868",diffAdditionNum:"#68d98c",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},Light:{id:"Light",name:"Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"black",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#e5e5e5",highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:"#e8e8e8",codeBorder:"#b0b0b0",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:"#fce8e8",diffAdditionBg:"#e6f9e6",diffRemovalText:"#661111",diffAdditionText:"#115511",diffRemovalHighlightColor:"#440000",diffRemovalHighlightBg:"#f8b4b4",diffAdditionHighlightColor:"#003300",diffAdditionHighlightBg:"#a6ebad",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Dark":{id:"GitHub Dark",name:"GitHub Dark",text:"#c9d1d9",textMuted:"#8b949e",textDim:"#6e7681",textInverted:"#0d1117",border:"#30363d",borderMuted:"#30363d",borderDim:"#21262d",bg:void 0,cardBg:"#161b22",highlightBg:"#21262d",activeBg:"#30363d",inputBg:"#21262d",inputBorder:"#21262d",inputText:"#c9d1d9",inputPlaceholder:"#8b949e",inputPrompt:"#58a6ff",codeBg:"#0d1117",codeBorder:"#30363d",userMsgBg:"#21262d",userMsgBorder:"#21262d",userMsgText:"#c9d1d9",diffRemovalBg:"#3c1e1e",diffAdditionBg:"#11381e",diffRemovalText:"#f85149",diffAdditionText:"#3fb950",diffRemovalHighlightColor:"#ff7b72",diffRemovalHighlightBg:"#701c1c",diffAdditionHighlightColor:"#56d364",diffAdditionHighlightBg:"#116329",diffRemovalNum:"#f85149",diffAdditionNum:"#3fb950",diffRemovalPrefix:"#f85149",diffAdditionPrefix:"#3fb950",primary:"#c9d1d9",secondary:"#58a6ff",accent:"#bc8cff",success:"#3fb950",warning:"#d29922",danger:"#f85149",info:"#58a6ff",statusOn:"#58a6ff",statusOff:"#8b949e",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#2ea043","#56d364"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Light":{id:"GitHub Light",name:"GitHub Light",text:"#24292f",textMuted:"#57606a",textDim:"#6e7781",textInverted:"#ffffff",border:"#d0d7de",borderMuted:"#d0d7de",borderDim:"#e1e4e8",bg:void 0,cardBg:"#f6f8fa",highlightBg:"#eaeef2",activeBg:"#d0d7de",inputBg:"#eaeef2",inputBorder:"#eaeef2",inputText:"#24292f",inputPlaceholder:"#57606a",inputPrompt:"#0969da",codeBg:"#ffffff",codeBorder:"#d0d7de",userMsgBg:"#eaeef2",userMsgBorder:"#eaeef2",userMsgText:"#24292f",diffRemovalBg:"#ffebe9",diffAdditionBg:"#e6ffec",diffRemovalText:"#cf222e",diffAdditionText:"#1a7f37",diffRemovalHighlightColor:"#82071e",diffRemovalHighlightBg:"#ffc1c0",diffAdditionHighlightColor:"#116329",diffAdditionHighlightBg:"#acf2bd",diffRemovalNum:"#cf222e",diffAdditionNum:"#1a7f37",diffRemovalPrefix:"#cf222e",diffAdditionPrefix:"#1a7f37",primary:"#24292f",secondary:"#0969da",accent:"#8250df",success:"#1a7f37",warning:"#9a6700",danger:"#cf222e",info:"#0969da",statusOn:"#0969da",statusOff:"#57606a",logoTextAnsi:"\x1B[1;34m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#1a7f37","#2da44e"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Dark":{id:"Transparent Dark",name:"Transparent Dark",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:void 0,codeBorder:"gray",userMsgBg:"#555555",userMsgBorder:"#555555",userMsgText:"white",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#ff6666",diffAdditionText:"#66ff66",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#3a1414",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#143a14",diffRemovalNum:"#ff6666",diffAdditionNum:"#66ff66",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Light":{id:"Transparent Light",name:"Transparent Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:void 0,codeBorder:"gray",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#c02020",diffAdditionText:"#188028",diffRemovalHighlightColor:"#800000",diffRemovalHighlightBg:"#f5d0d0",diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:"#cceccc",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Synthwave 84":{id:"Synthwave 84",name:"Synthwave 84",text:"#fdfdfd",textMuted:"#a08eb7",textDim:"#705c8a",textInverted:"#1a1025",textExclusive:"#e3dcf0",textMutedExclusive:"#b9abc9",border:"#fc28a8",borderMuted:"#a21568",borderDim:"#5c0a3a",bg:void 0,cardBg:"#261b38",highlightBg:"#35254d",activeBg:"#4c3570",inputBg:"#35254d",inputBorder:"#35254d",inputText:"#fdfdfd",inputPlaceholder:"#a08eb7",inputPrompt:"#03e8fc",codeBg:"#1e142b",codeBorder:"#a21568",userMsgBg:"#35254d",userMsgBorder:"#35254d",userMsgText:"#fdfdfd",diffRemovalBg:"#471434",diffAdditionBg:"#144743",diffRemovalText:"#ff4081",diffAdditionText:"#00e5ff",diffRemovalHighlightColor:"#ff79a1",diffRemovalHighlightBg:"#6b1e4e",diffAdditionHighlightColor:"#66f5ff",diffAdditionHighlightBg:"#1e6b65",diffRemovalNum:"#ff4081",diffAdditionNum:"#00e5ff",diffRemovalPrefix:"#ff79a1",diffAdditionPrefix:"#66f5ff",primary:"#fdfdfd",secondary:"#03e8fc",accent:"#fc28a8",success:"#00e5ff",warning:"#ffc107",danger:"#ff4081",info:"#b388ff",statusOn:"#03e8fc",statusOff:"#a08eb7",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#fc28a8","#03e8fc"],toolFeedbackAnsi:"\x1B[38;2;3;232;252m"},"Forest Sprite":{id:"Forest Sprite",name:"Forest Sprite",text:"#d6e6d1",textMuted:"#95b38d",textDim:"#628059",textInverted:"#161c14",textExclusive:"#eaf2e8",textMutedExclusive:"#a9c7a2",border:"#74a862",borderMuted:"#477038",borderDim:"#2b4720",bg:void 0,cardBg:"#1f291c",highlightBg:"#2a3826",activeBg:"#3a4d35",inputBg:"#2a3826",inputBorder:"#2a3826",inputText:"#d6e6d1",inputPlaceholder:"#95b38d",inputPrompt:"#8feb73",codeBg:"#161e14",codeBorder:"#477038",userMsgBg:"#2a3826",userMsgBorder:"#2a3826",userMsgText:"#d6e6d1",diffRemovalBg:"#3b231c",diffAdditionBg:"#203b1c",diffRemovalText:"#db6242",diffAdditionText:"#59cc3f",diffRemovalHighlightColor:"#f0896c",diffRemovalHighlightBg:"#5c362a",diffAdditionHighlightColor:"#80e368",diffAdditionHighlightBg:"#305929",diffRemovalNum:"#db6242",diffAdditionNum:"#59cc3f",diffRemovalPrefix:"#f0896c",diffAdditionPrefix:"#80e368",primary:"#d6e6d1",secondary:"#8feb73",accent:"#e69835",success:"#59cc3f",warning:"#e69835",danger:"#db6242",info:"#73b4eb",statusOn:"#8feb73",statusOff:"#95b38d",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#8feb73","#e69835"],toolFeedbackAnsi:"\x1B[38;2;143;235;115m"},Spookfest:{id:"Spookfest",name:"Spookfest \u{1F383}",text:"#ffeedd",textMuted:"#e09858",textDim:"#a6622b",textInverted:"#0d0702",textExclusive:"#fff3e6",textMutedExclusive:"#d4a276",border:"#ff7518",borderMuted:"#994409",borderDim:"#592502",bg:void 0,cardBg:"#1a0c02",highlightBg:"#2a1403",activeBg:"#3d1d05",inputBg:"#261203",inputBorder:"#261203",inputText:"#ffeedd",inputPlaceholder:"#a6622b",inputPrompt:"#ff7518",codeBg:"#120701",codeBorder:"#592502",userMsgBg:"#261203",userMsgBorder:"#261203",userMsgText:"#ffeedd",diffRemovalBg:"#3d0a0a",diffAdditionBg:"#1a330a",diffRemovalText:"#ff5555",diffAdditionText:"#73e639",diffRemovalHighlightColor:"#ff2222",diffRemovalHighlightBg:"#590e0e",diffAdditionHighlightColor:"#88ff3b",diffAdditionHighlightBg:"#244d0a",diffRemovalNum:"#ff5555",diffAdditionNum:"#73e639",diffRemovalPrefix:"#ff3333",diffAdditionPrefix:"#88ff3b",primary:"#ff7518",secondary:"#a855f7",accent:"#22c55e",success:"#22c55e",warning:"#f59e0b",danger:"#ef4444",info:"#a855f7",statusOn:"#ff7518",statusOff:"#703a08",logoTextAnsi:"\x1B[1;38;2;255;117;24m",logoBodyAnsi:"\x1B[38;2;255;140;26m",logoMutedAnsi:"\x1B[38;2;168;85;247m",logoGradient:["#ff7518","#a855f7"],toolFeedbackAnsi:"\x1B[38;2;255;117;24m"}};var gi=null;var mi=(e="Dark")=>{let n;e==="Mystery"||e==="Chaos"?(gi||(gi=Hr[Math.floor(Math.random()*Hr.length)]),n={...gi,id:"Mystery"}):(gi=null,co[e]?n=co[e]:e==="Halloween"?n=co.Spookfest:e==="GitHub"?n=co["GitHub Dark"]:e==="Transparent"?n=co["Transparent Dark"]:n=co.Dark);let t=n.codeText||n.secondary||n.info||n.logoGradient&&n.logoGradient[0]||"cyan",i=n.toolFeedbackAnsi||"\x1B[95m";return{...n,codeText:t,toolFeedbackAnsi:i}};var Ba=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",$c=(e=2)=>{let n=Ba();return n==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},jr=new Date,Do=jr.getMonth(),Fo=jr.getDate(),Ua=Do===9&&Fo>=15||Do===10&&Fo<=1,ns=null;(process.env.SPOOKFEST==="true"||Ua)&&(ns=await import("./halloween-MX3VNQRW.js"));var Nc=(e="...",n="Loading...",t="Dark")=>{let i=mi(t),o=n;if(n==="c_openai"||n==="Custom (OpenAI)")try{let K=Qo(qo,{})?.systemSettings?.customOpenAIBaseUrl;K&&(o=K)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,a=i.logoMutedAnsi,u="\x1B[0m",p=[" \u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2591\u2591\u2591 "],x=t==="Spookfest"||i.id==="Spookfest"||t==="Halloween"||i.id==="Halloween",m=Do===9&&Fo>=15||Do===10&&Fo<=1,f=x&&m||process.env.SPOOKFEST==="true"&&x,s=p;if(f&&ns){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:W,halloweenBat:K,halloweenArtUser:F}=ns;s=Math.random()>.9&&Do===9&&Fo>=30?K:Math.random()>.5?W:F}else process.env.HALLOWEEN_EEGG="false";let g=f?Gr:Wr,T=g[Math.floor(Math.random()*g.length)],ue=i.logoGradient||["#0077ff","#ff00ff"],y=Fa(ue).multiline(s.join(`
|
|
562
564
|
`)).split(`
|
|
563
|
-
`),
|
|
565
|
+
`),_=W=>`${a}${W}${u}`;return`${y[0]}
|
|
564
566
|
${y[1]} ${r}Selected ${f?"Pumpkin":"Provider"}: ${o}${u}
|
|
565
567
|
${y[2]}
|
|
566
|
-
${y[3]} ${r}FluxFlow${f?": Spookfest":""} ${
|
|
568
|
+
${y[3]} ${r}FluxFlow${f?": Spookfest":""} ${_("v"+e)}${u}
|
|
567
569
|
${y[4]}
|
|
568
570
|
${y[5]} ${d}See /help for additional commands.${u}
|
|
569
|
-
${y[6]} ${
|
|
571
|
+
${y[6]} ${_(T)}
|
|
570
572
|
${y[7]}
|
|
571
|
-
`};import{structuredPatch as Ka}from"diff";import os from"path";import Wa from"fs";var Ga=e=>{try{return Wa.readdirSync(e,{withFileTypes:!0})}catch{return[]}},is=(e,n=4,t=1,i=Ga,o=[],r=null)=>{let d=r||i(e),a=" ".repeat(t-1),u=t===1?new Set([...wo,...o,...So(e),...So(process.cwd())]):o instanceof Set?o:new Set([...wo,...o]),p=
|
|
573
|
+
`};import{structuredPatch as Ka}from"diff";import os from"path";import Wa from"fs";var Ga=e=>{try{return Wa.readdirSync(e,{withFileTypes:!0})}catch{return[]}},is=(e,n=4,t=1,i=Ga,o=[],r=null)=>{let d=r||i(e),a=" ".repeat(t-1),u=t===1?new Set([...wo,...o,...So(e),...So(process.cwd())]):o instanceof Set?o:new Set([...wo,...o]),p=F=>u.has(F),x=d.filter(F=>!p(F.name)),m=d.filter(F=>p(F.name)).length,f=x.filter(F=>!F.isDirectory()).map(F=>F.name).sort(),s=x.filter(F=>F.isDirectory()).sort((F,E)=>F.name.localeCompare(E.name)),g=F=>{let E=F.length;if(E===0)return"no files";let me=Array.from(new Set(F.map(ve=>{let we=typeof ve=="string"?ve:ve.name;return os.extname(we).slice(1)}).filter(Boolean))).sort(),ke="*";return me.length===1?ke=`*.${me[0]}`:me.length>1&&(ke=`*.{${me.join(", ")}}`),E===1?ke:`${ke} ${E} files`},T="";if(t===1){let F=f.join(", "),E=m>0?` [${m} ignored]`:"";(F||E)&&(T+=`${a}${F?F+(E?`${E}`:""):E.trim()}
|
|
572
574
|
`)}else f.length>0&&(T+=`${a}[${g(f)}]
|
|
573
|
-
`);let ue=10,y=s.slice(0,ue),
|
|
574
|
-
`);for(let{displayName:
|
|
575
|
-
`,T+=is(
|
|
575
|
+
`);let ue=10,y=s.slice(0,ue),_=s.length>ue,W=[],K=[];for(let F of y){let E=os.join(e,F.name),me=F.name,ke=t,ve=i(E),we=ve.filter($e=>!p($e.name)),k=we.filter($e=>$e.isDirectory()),b=we.filter($e=>!$e.isDirectory());for(;b.length===0&&k.length===1&&ke<n;)me=`${me}/${k[0].name}`,E=os.join(E,k[0].name),ke++,ve=i(E),we=ve.filter($e=>!p($e.name)),k=we.filter($e=>$e.isDirectory()),b=we.filter($e=>!$e.isDirectory());let lt=k.length>0;if(lt&&ke<n)K.push({displayName:me,subDirPath:E,subEntries:ve,nextDepth:ke+1});else{let $e=g(b),Mt=lt&&ke>=n?" ...max scan depth":"";W.push(`${me}/${$e}${Mt}`)}}W.length>0&&(T+=`${a}${W.join(", ")}
|
|
576
|
+
`);for(let{displayName:F,subDirPath:E,subEntries:me,nextDepth:ke}of K)T+=`${a}${F}/
|
|
577
|
+
`,T+=is(E,n,ke,i,u,me);return _&&(T+=`${a}...max scan width, ReadFolder if needed
|
|
576
578
|
`),T};import ss from"path";import Ha from"fs";var ja=e=>{try{return Ha.readdirSync(e,{withFileTypes:!0})}catch{return[]}},rs=(e,n,t="",i=1,o=ja,r=[])=>{let d=o(e),a=ss.sep;if(d.length>100)return`${t}\u2514\u2500\u2500 ${ss.basename(e)}${a} ...100+ files...
|
|
577
|
-
`;let u="",p=r,x=d.filter(s=>!p.includes(s.name)&&!s.name.startsWith(".")),m=d.filter(s=>p.includes(s.name)||s.name.startsWith(".")).map(s=>s.name).sort();x.sort((s,g)=>s.isDirectory()&&!g.isDirectory()?-1:!s.isDirectory()&&g.isDirectory()?1:s.name.localeCompare(g.name));let f=[...x.map(s=>({name:s.name,isDir:s.isDirectory()})),...m.map(s=>({name:s,isDir:!0,isCollapsed:!0}))];return f.forEach((s,g)=>{let T=g===f.length-1,ue=ss.join(e,s.name),y=T?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",
|
|
579
|
+
`;let u="",p=r,x=d.filter(s=>!p.includes(s.name)&&!s.name.startsWith(".")),m=d.filter(s=>p.includes(s.name)||s.name.startsWith(".")).map(s=>s.name).sort();x.sort((s,g)=>s.isDirectory()&&!g.isDirectory()?-1:!s.isDirectory()&&g.isDirectory()?1:s.name.localeCompare(g.name));let f=[...x.map(s=>({name:s.name,isDir:s.isDirectory()})),...m.map(s=>({name:s,isDir:!0,isCollapsed:!0}))];return f.forEach((s,g)=>{let T=g===f.length-1,ue=ss.join(e,s.name),y=T?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",_=t+(T?" ":"\u2502 ");if(s.isCollapsed){u+=`${t}${y}${s.name}${a}...
|
|
578
580
|
`;return}s.isDir?i>n?u+=`${t}${y}${s.name}${a} ...depth exceeded...
|
|
579
581
|
`:o(ue).length>80?u+=`${t}${y}${s.name}${a} ...80+ files...
|
|
580
582
|
`:(u+=`${t}${y}${s.name}${a}
|
|
581
|
-
`,u+=rs(ue,n,
|
|
582
|
-
`}),u};var Va={Ollama:()=>import("./ollama-4PI2BDMM.js").then(e=>e.getOllamaStream),OpenRouter:()=>import("./openrouter-6MRG4RT6.js").then(e=>e.getOpenRouterStream),DeepSeek:()=>import("./deepseek-WNWZJTNE.js").then(e=>e.getDeepSeekStream),Mistral:()=>import("./mistral-XDIMWAU3.js").then(e=>e.getMistralStream),NVIDIA:()=>import("./nvidia-BN4YCFGY.js").then(e=>e.getNVIDIAStream),NVIDIA_wrap:()=>import("./nvidia-BN4YCFGY.js").then(e=>e.wrapNvidiaStreamWithQueueDepth),InferX:()=>import("./inferx-HP5AGET3.js").then(e=>e.getInferXStream),SenseNova:()=>import("./sensenova-3K44URJQ.js").then(e=>e.getSenseNovaStream),AIHubMix:()=>import("./aihubmix-TETL5QYQ.js").then(e=>e.getAIHubMixStream),Poolside:()=>import("./poolside-ODFAIK4C.js").then(e=>e.getPoolsideStream),NineRouter:()=>import("./9router-LRFKCJF4.js").then(e=>e.getNineRouterStream),ExpLabs:()=>import("./explabs-XHHXTERB.js").then(e=>e.getExpLabsStream),TokenHarbor:()=>import("./tokenharbor-YV2GV2LM.js").then(e=>e.getTokenHarborStream),Infron:()=>import("./infron-ULXG7VDA.js").then(e=>e.getInfronStream),APInex:()=>import("./apinex-FAYOPQSL.js").then(e=>e.getAPInexStream),c_openai:()=>import("./custom_openai-XMDYE7NM.js").then(e=>e.getCustomOpenAIStream)},ls={},ce=async e=>(ls[e]||(ls[e]=await Va[e]()),ls[e]),Ya=/```[\s\S]*?```/g,za=/```[\s\S]*$/g,qa=/`[^`]+`/g,Xa=/^\|.*\|$/gm,Ja=/^[^\w]+|[^\w]+$/g,Qa=/[^a-z0-9]/gi,Bo=/\[\s*(?:tool|action):(?:functions\.)?([a-z0-9_]+)\s*\(/gi,Za=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-z0-9_]+)\s*\(/gi,el=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,Rn=/["']/g,Kr=/\\/g,tl=/<\|channel>thought/gi,nl=/<channel\|>/gi,ol=e=>typeof e!="string"?e:e.replace(tl,"<think_fluxflow>").replace(nl,"</think_fluxflow>"),Ad=/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\]|$)/i,il=(e,n,t=1)=>{let i=n>0?e[n-1]:"",o=n+t<e.length?e[n+t]:"";return i==="`"&&o==="`"},sl=e=>{let n=/(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\])/gi,t;for(;(t=n.exec(e))!==null;)if(!il(e,t.index,t[0].length))return{index:t.index,length:t[0].length};return{index:-1,length:0}},cs=e=>{if(!e||typeof e!="string")return null;let n=e.match(/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])/i);if(!n)return null;let t=n.index+n[0].length,i=e.substring(t),o=sl(i);if(o.index!==-1){let r=t+o.index+o.length;return{fullBlock:e.substring(0,r),innerContent:i.substring(0,o.index),remainingText:e.substring(r)}}return{fullBlock:e,innerContent:i,remainingText:""}},
|
|
583
|
-
`),T=s.toLowerCase().includes("tool:")||s.toLowerCase().includes("action:");d.push(s),T&&g?u=!0:u=!1}}}),p()}}return t.length},dl=e=>typeof e!="string"?e:e.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),Ed=()=>{ht=!0},Cd=()=>ht,ds={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"},Jn=(e,n)=>{try{let t=
|
|
584
|
-
`),
|
|
583
|
+
`,u+=rs(ue,n,_,i+1,o,r)):u+=`${t}${y}${s.name}
|
|
584
|
+
`}),u};var Va={Ollama:()=>import("./ollama-4PI2BDMM.js").then(e=>e.getOllamaStream),OpenRouter:()=>import("./openrouter-6MRG4RT6.js").then(e=>e.getOpenRouterStream),DeepSeek:()=>import("./deepseek-WNWZJTNE.js").then(e=>e.getDeepSeekStream),Mistral:()=>import("./mistral-XDIMWAU3.js").then(e=>e.getMistralStream),NVIDIA:()=>import("./nvidia-BN4YCFGY.js").then(e=>e.getNVIDIAStream),NVIDIA_wrap:()=>import("./nvidia-BN4YCFGY.js").then(e=>e.wrapNvidiaStreamWithQueueDepth),InferX:()=>import("./inferx-HP5AGET3.js").then(e=>e.getInferXStream),SenseNova:()=>import("./sensenova-3K44URJQ.js").then(e=>e.getSenseNovaStream),AIHubMix:()=>import("./aihubmix-TETL5QYQ.js").then(e=>e.getAIHubMixStream),Poolside:()=>import("./poolside-ODFAIK4C.js").then(e=>e.getPoolsideStream),NineRouter:()=>import("./9router-LRFKCJF4.js").then(e=>e.getNineRouterStream),ExpLabs:()=>import("./explabs-XHHXTERB.js").then(e=>e.getExpLabsStream),TokenHarbor:()=>import("./tokenharbor-YV2GV2LM.js").then(e=>e.getTokenHarborStream),Infron:()=>import("./infron-ULXG7VDA.js").then(e=>e.getInfronStream),APInex:()=>import("./apinex-FAYOPQSL.js").then(e=>e.getAPInexStream),c_openai:()=>import("./custom_openai-XMDYE7NM.js").then(e=>e.getCustomOpenAIStream)},ls={},ce=async e=>(ls[e]||(ls[e]=await Va[e]()),ls[e]),Ya=/```[\s\S]*?```/g,za=/```[\s\S]*$/g,qa=/`[^`]+`/g,Xa=/^\|.*\|$/gm,Ja=/^[^\w]+|[^\w]+$/g,Qa=/[^a-z0-9]/gi,Bo=/\[\s*(?:tool|action):(?:functions\.)?([a-z0-9_]+)\s*\(/gi,Za=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-z0-9_]+)\s*\(/gi,el=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,Rn=/["']/g,Kr=/\\/g,tl=/<\|channel>thought/gi,nl=/<channel\|>/gi,ol=e=>typeof e!="string"?e:e.replace(tl,"<think_fluxflow>").replace(nl,"</think_fluxflow>"),Ad=/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\]|$)/i,il=(e,n,t=1)=>{let i=n>0?e[n-1]:"",o=n+t<e.length?e[n+t]:"";return i==="`"&&o==="`"},sl=e=>{let n=/(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\])/gi,t;for(;(t=n.exec(e))!==null;)if(!il(e,t.index,t[0].length))return{index:t.index,length:t[0].length};return{index:-1,length:0}},cs=e=>{if(!e||typeof e!="string")return null;let n=e.match(/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])/i);if(!n)return null;let t=n.index+n[0].length,i=e.substring(t),o=sl(i);if(o.index!==-1){let r=t+o.index+o.length;return{fullBlock:e.substring(0,r),innerContent:i.substring(0,o.index),remainingText:e.substring(r)}}return{fullBlock:e,innerContent:i,remainingText:""}},Bt=e=>{if(!e||typeof e!="string")return e;let n=cs(e);return n?n.remainingText.trimStart():e};var Vr=/<\|\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,rl=/"([^"]+)"\s*:\s*(?:"([^"]*)"|(\d+)|true|false|null)/g,Yr=/<\|\s*tool_calls_section_begin\s*\|>/gi,zr=/<\|\s*tool_calls_section_end\s*\|>/gi,al=/```(?:tool|action|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi;var pi=e=>!e||typeof e!="string"?e:e.replace(/(```[\s\S]*?```|`[^`]*`)|(<(?:\w+)(?:[^>]*)>\r?\n?|\r?\n?<\/\w+(?:[^>]*)>)/gi,(n,t)=>t||""),Qr=e=>{if(!e||typeof e!="string")return e;let n=fo(e);if(!n||n.length===0)return e;let t=n[n.length-1];if(!t.fullMatch)return e;let i=e.lastIndexOf(t.fullMatch);if(i===-1)return e;let o=i+t.fullMatch.length;return e.substring(0,o).trimEnd()},fs=null,Uo={},Xn={key:null,value:null},Ft=e=>{if(!e)return e;let n=Uo?.theme;if(!n)try{n=Qo(qo,{})?.systemSettings?.theme}catch{}let i=mi(n||"Dark").toolFeedbackAnsi||"\x1B[95m";return e.replace(/(?:(\x1b\[\d+m))?([✔✘✖🔍📖→➕↻↷•🛇])(?:(\x1b\[\d+m))?\s*\b(Clicked Screen|Clicked|Located|Dragged|Scrolled|Typed|Entered|Pressed Key|Recaptured Screen|Created|Read Skill|Read Documentation|Executed|Searched Documentation|Read|Edited|Viewed|Processed|Auto-Read|Skipped|List|Generated|Written|Searched|AI Search|Get Map|Write Canceled|Resolved Sub-Agent Query|Edit Canceled|Write Cancelled|Edit Denied|Visited|Updated|Reviewed|Delegated|Background|Checked|Indexed|Analyzed|Browsed|Elevating SubAgent|Checking SubAgent Work|Started Generalist|Called Generalist|Steered|Unsupported Modality|Awaiting|Cancelled|Aligning Moon Phase|Contemplating Existence|Staring At Void|Rollback Point Checked|Emergency Rollback Failed|Emergency Rollback|Delaying Professionally|Negotiating With Electrons|Touching Grass (virtually)|Panicking Softly|Rethinking Career Choices|Loading Cat Videos|Giving Up Entirely|Summoning Braincell #2|Pretending To Be Busy|Waiting For Motivation DLC|Rotating Internal Screaming|Downloading More RAM|Feeding The Hamsters|Gaslighting Scheduler|Performing Dramatic Pause|Buffering Social Energy|Calculating Regret|Reading Terms And Conditions|Becoming Sentient Briefly|Model produced malformed tool call|Loop Detected|Contacting Ancestors)\b/ig,(o,r,d,a,u)=>`${r||""}${d}${a||""} ${i}${u}\x1B[0m`)},ll=async(e,n=8,t=1e3,i=8e3,o=null)=>{let r=0;for(;;){if(o?.aborted)throw new DOMException("The user aborted a request.","AbortError");try{return await e()}catch(d){if(o?.aborted||d?.name==="AbortError"||d?.message==="Subagent task was cancelled."||(r++,r>=n))throw d;let a=Math.min(t*Math.pow(2,r-1),i);await new Promise((u,p)=>{let x=setTimeout(u,a);o&&o.addEventListener("abort",()=>{clearTimeout(x),p(new DOMException("The user aborted a request.","AbortError"))})})}}},ht=!1;var cl=e=>{let n=e.filter(o=>(o.role==="user"||o.role==="agent"||o.role==="system")&&o.role!=="think"&&!o.isVisualFeedback&&!o.isMeta&&!o.isTerminalRecord&&!(o.text&&o.text.includes("[TERMINAL_RECORD]"))&&!String(o.id).startsWith("welcome")).map((o,r,d)=>{let a=o.fullText||o.text||"";if(o.role==="user"&&r<d.length-1)if(a.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")){let u=a.indexOf("**CONTEXT SUMMARY OF PREVIOUS TURNS");if(u!==-1){let x=a.substring(0,u).lastIndexOf("[SYSTEM METADATA]");x!==-1?a=a.substring(x).trim():a=a.substring(u).trim()}}else{let u=a.lastIndexOf("[USER]"),p=a.lastIndexOf("[USER PROMPT]");u!==-1?a=a.substring(u+6).trim():p!==-1&&(a=a.substring(p).trim())}return{...o,text:a}}),t=[],i=0;for(;i<n.length;){let o=n[i];if(o.role==="user")t.push(o),i++;else{let r=[];for(;i<n.length&&n[i].role!=="user";)r.push(n[i]),i++;let d=[],a=[],u=!1,p=()=>{d.length>0&&(t.push({role:"agent",text:"combined"}),d=[]),a.length>0&&(t.push({role:"system",text:"combined"}),a=[]),u=!1};r.forEach(x=>{let m=x.role==="system"&&(x.text?.startsWith("[ACTION RESULT]")||x.text?.startsWith("[TOOL RESULT]")||x.text?.startsWith("SUCCESS:")||x.text?.startsWith("ERROR:")||x.fullText?.startsWith("[ACTION RESULT]")||x.fullText?.startsWith("[TOOL RESULT]")||x.fullText?.startsWith("SUCCESS:")||x.fullText?.startsWith("ERROR:")),f=x.fullText||x.text||"",s=f.trim();if(!(!s&&!x.binaryPart)){if(m)a.push(s);else if(x.role==="agent"){!u&&a.length>0&&p();let g=f.endsWith(`
|
|
585
|
+
`),T=s.toLowerCase().includes("tool:")||s.toLowerCase().includes("action:");d.push(s),T&&g?u=!0:u=!1}}}),p()}}return t.length},dl=e=>typeof e!="string"?e:e.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),Ed=()=>{ht=!0},Cd=()=>ht,ds={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"},Jn=(e,n)=>{try{let t=H(n),i=e.toLowerCase().replace(/_/g,"");if(i==="invokesync"||i==="invoke")return t.title||(t.task?t.task.substring(0,30):null);if(i==="getprogress"||i==="cancel"||i==="steer"||i==="steersubagent")return t.id||t.taskId;let o=t.name||t.path||t.targetFile||t.TargetFile||t.directory||t.file||t.query;return o?j.basename(o.replace(/["']/g,"").replace(/\\/g,"/")):null}catch{return null}},us=e=>e?new Jr({apiKey:e}):fs,Rd=async(e,n,t,i,o={})=>{let{onStatus:a,onMemoryUpdated:u,onBackgroundIncrement:p}=o,{profile:x,thinkingLevel:m,mode:f,janitorModel:s,chatId:g,systemSettings:T,sessionStats:ue,aiProvider:y="Google",apiKey:_}=e,W=process.env.NVIDIA_BASE_URL||y==="Ollama"||y==="InferX"||y==="SenseNova"||y==="AIHubMix"||y==="Poolside"||y==="9router"||y==="ExpLabs"||y==="ExperientialLabs"||y==="c_openai"||y==="Custom (OpenAI)"?!1:T?.memory!==!1,F=Ct(zn,[]).map(S=>`- [${S.id}]: ${S.memory}`).join(`
|
|
586
|
+
`),E=i.slice(0,-1).filter(S=>S.text&&!S.text.includes("[ACTION RESULT]")&&!S.text.includes("[TOOL RESULT]")&&!S.text.includes("OBSERVATION:")&&!S.text.startsWith("[TERMINAL_RECORD]")&&!S.isTerminalRecord&&!S.isMeta&&!S.isLogo&&!String(S.id).startsWith("welcome")&&!String(S.id).startsWith("logo")).slice(-14).map(S=>{let C=Bt(dl(S.text)).replace(/\[(?:tool|action):(?:functions\.)?.*?\]/g,"").replace(/\[Prompted on:.*?\]/g,"").replace(/\[METADATA \(PRIORITY: DYNAMIC\)\] Time: ([^|\n]+)/g,(D,xe)=>`[METADATA (PRIORITY: DYNAMIC)] Time: ${xe.replace(/:\d{2}/g,"")}`).replace(/\[\[\s*turn\s*:\s*(continue|finish)\s*\]\]/gi,"").replace(/\[\[END\]\]/g,"").replace(/\[\[(?:TOOL|ACTION) RESULTS\]\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULTS?\]/gi,"").replace(/\[(?:tool|action) results\]/gi,"").replace(/\r?\n\r?\n/g,`
|
|
585
587
|
`).replace(/\n\n/g,`
|
|
586
|
-
`).replace(/\\n\\n/g,"").trim(),Ie=
|
|
587
|
-
... (truncated) ...`);let
|
|
588
|
-
... (truncated) ...`);let
|
|
588
|
+
`).replace(/\\n\\n/g,"").trim(),Ie=S.role==="user"?8192:32768,M=C.substring(0,Ie);C.length>Ie&&(M+=`
|
|
589
|
+
... (truncated) ...`);let A=S.role==="user"?M.startsWith("[USER]")?"":"[USER]: ":M.startsWith("[AGENT]")?"":"[AGENT]: ";return{role:S.role==="user"?"user":"model",parts:[{text:`${A}${M}`}]}}),me=i.filter(S=>S.role==="user").length===1,ke=n.includes("[TITLE-UPDATE]"),ve=Math.random()<.8,we=me||ke||ve,k=Bt(t).trim(),b=br(F,W,we),lt=`${k.replace(/\[(?:tool|action):(?:functions\.)?.*?\]/g,"").replace(/\[Prompted on:.*?\]/g,"").replace(/\[\[\s*turn\s*:\s*(continue|finish)\s*\]\]/gi,"").replace(/\[\[END\]\]/g,"").replace(/\[\[(?:TOOL|ACTION) RESULTS\]\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULTS?\]/gi,"").replace(/\[(?:tool|action) results\]/gi,"").substring(0,32768)}`;lt.length>32768&&(lt+=`
|
|
590
|
+
... (truncated) ...`);let $e=n.replace(/\[Prompted on:.*?\]/g,"").trim();lt=lt.replace(/\r?\n\r?\n/g,`
|
|
589
591
|
`).replace(/\n\n/g,`
|
|
590
|
-
`).replace(/\\n\\n/g,"").trim();let
|
|
592
|
+
`).replace(/\\n\\n/g,"").trim();let Mt=new Date,_t=`[METADATA] Current date and Time: ${`${Mt.getFullYear()}-${Mt.toLocaleString("en-US",{month:"short"}).toUpperCase()}-${String(Mt.getDate()).padStart(2,"0")}, ${Mt.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0})}`}
|
|
591
593
|
|
|
592
|
-
[USER]: ${
|
|
593
|
-
${
|
|
594
|
+
[USER]: ${$e.substring(0,8192)}
|
|
595
|
+
${$e.length>8192?`... (truncated) ...
|
|
594
596
|
|
|
595
597
|
`:""}
|
|
596
|
-
[AGENT (current turn)]: ${lt}`;
|
|
598
|
+
[AGENT (current turn)]: ${lt}`;E.push({role:"user",parts:[{text:_t}]});let Ut=await Mi("NVIDIA"),mn=(await ko()).quotas?.providerTiers?.NVIDIA==="Free",Pt="",yt=0,rn=W?12:-1;for(;yt<=rn;)try{if(!await Es("background",e))return;let S="",C=null,Ie=!1,M=y;try{let xe=new Promise((tt,de)=>setTimeout(()=>de(new Error("JANITOR_TIMEOUT")),1e4)),Re=y==="Google"&&yt>=0&&yt<6&&Ut&&mn,Te=y==="DeepSeek"&&yt<4&&Ut&&mn;Ie=Re||Te,M=Ie?"NVIDIA":y;let Me=Date.now(),Wo=null,Bn=(async()=>{if(y==="OpenRouter"){let tt=re("janitor_open_router"),ae=(await ce("OpenRouter"))(_,tt,E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),vt=await ae.next();return{iterator:ae,firstResult:vt}}else if(y==="DeepSeek"&&!Ie){let de=(await ce("DeepSeek"))(_,re("deepseek_fast_fallback"),E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await de.next();return{iterator:de,firstResult:ae}}else if(y==="Mistral"&&!Ie){let de=(await ce("Mistral"))(_,re("mistral_janitor_fallback"),E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await de.next();return{iterator:de,firstResult:ae}}else if(y==="NVIDIA"||Ie){let de=(await ce("NVIDIA"))(Ie?Ut:_,re("nvidia_janitor_fallback"),E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await de.next();return{iterator:de,firstResult:ae}}else if(y==="InferX"){let de=(await ce("InferX"))(_,targetModel||re("inferx_fallback")||"deepseek-v4-flash",E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await de.next();return{iterator:de,firstResult:ae}}else if(y==="SenseNova"){let de=(await ce("SenseNova"))(_,targetModel||re("sensenova_fallback")||"sensenova-6.8-flash-lite",E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await de.next();return{iterator:de,firstResult:ae}}else if(y==="AIHubMix"){let de=(await ce("AIHubMix"))(_,targetModel||re("aihubmix_fallback")||"gpt-4o-mini",E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await de.next();return{iterator:de,firstResult:ae}}else if(y==="Poolside"){let de=(await ce("Poolside"))(_,targetModel||re("poolside_fallback")||"poolside/laguna-s-2.1",E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await de.next();return{iterator:de,firstResult:ae}}else if(y==="9router"||y==="9Router"){let de=(await ce("NineRouter"))(_,targetModel||re("9router_fallback")||"z-ai/glm-5.3-flash",E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await de.next();return{iterator:de,firstResult:ae}}else if(y==="ExpLabs"||y==="ExperientialLabs"){let de=(await ce("ExpLabs"))(_,targetModel||re("explabs_fallback")||"deepseek-v4-pro-0813",E,b,"Fast",f,!1,null,.7)[Symbol.asyncIterator](),ae=await de.next();return{iterator:de,firstResult:ae}}else{let ae=(await us(_).models.generateContentStream({model:s||(yt===rn?re("janitor_default"):re("gemma_janitor_fallback_google")),contents:E,config:{systemInstruction:b,temperature:.7,safetySettings:[{category:Fn.HARM_CATEGORY_HARASSMENT,threshold:Dn.BLOCK_NONE},{category:Fn.HARM_CATEGORY_HATE_SPEECH,threshold:Dn.BLOCK_NONE},{category:Fn.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Dn.BLOCK_NONE},{category:Fn.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Dn.BLOCK_NONE}],thinkingConfig:{includeThoughts:!1,thinkingLevel:He.MINIMAL},serviceTier:"flex"}}))[Symbol.asyncIterator](),vt=await ae.next();return{iterator:ae,firstResult:vt}}})();if(process.stdout.isTTY){let ae=(await $i())[g]?.name||"",vt=ae&&!ae.startsWith("flow-")&&!ae.startsWith("Session ")?ae:"FluxFlow | Idle";process.stdout.write(`\x1B]0;${vt}\x07`),process.stdout.write(`\x1B]633;P;TerminalTitle=${vt}\x07`)}let{iterator:uo,firstResult:Go}=await Promise.race([Bn,xe]);Wo=Date.now()-Me;let{value:pn,done:Wt}=Go;if(!Wt&&pn){let tt=pn.candidates?.[0]?.content?.parts,de=tt?M==="Google"?tt[1]?.text||tt[0]?.text||"":tt.filter(ae=>ae.text&&!ae.thought).map(ae=>ae.text).join(""):typeof pn.text=="function"?pn.text():"";de&&(S+=de),C=pn.usageMetadata;for await(let ae of{[Symbol.asyncIterator]:()=>uo}){let vt=ae.candidates?.[0]?.content?.parts,go=vt?M==="Google"?vt[1]?.text||vt[0]?.text||"":vt.filter(Qn=>Qn.text&&!Qn.thought).map(Qn=>Qn.text).join(""):typeof ae.text=="function"?ae.text():"";go&&(S+=go),C=ae.usageMetadata}}}catch(xe){throw xe}if(S){if(Pt=S,C){let xe=C.totalTokenCount||0,Re=C.cachedContentTokenCount||0,Te=(C.candidatesTokenCount||0)+(M==="Google"&&C.thoughtsTokenCount||0),Me=Ie?re("nvidia_janitor_fallback"):M==="DeepSeek"?re("deepseek_fast_fallback"):M==="ExpLabs"||M==="ExperientialLabs"?re("explabs_fallback")||"deepseek-v4-pro-0813":M==="OpenRouter"?re("janitor_open_router"):s||(yt===rn?re("janitor_default"):re("gemma_janitor_fallback_google"));await pt("tokens",xe,M,Me),Re>0&&await pt("cachedTokens",Re,M,Me),Te>0&&await pt("candidateTokens",Te,M,Me),janitorTtft!==null&&janitorTtft>0&&await pt("ttft",janitorTtft,M,Me),To({provider:M,model:Me,prompt:C.promptTokenCount||0,cached:Re,output:Te,reasoning:C.thoughtsTokenCount||0,ttft:janitorTtft})}}else throw new Error("No synthesis generated by Janitor.");p&&(p(),await Rt("background"));let A=fo(Pt),D=!1;for(let xe of A){let Re=xe.toolName;["addMemScore","add_mem_score","AddMemScore","addMemoryScore","AddMemoryScore"].includes(Re)&&(D=!0);let Te={chatId:g,sessionId:g,history:i},Me=await No(Re,xe.args,Te);Re.toLowerCase()==="memory"&&(xe.args.includes("action='user'")||xe.args.includes('action="user"'))&&!Me.startsWith("ERROR")&&(u&&u(),process.stdout.isTTY&&(process.stdout.write("\x1B]0;Memory Updated\x07"),process.stdout.write("\x1B]633;P;TerminalTitle=Memory Updated\x07")),await new Promise(Bn=>setTimeout(Bn,3e3)))}if(!D)try{let xe=Ct(zn,[]);if(xe.length>0){let Re=[];for(let Te of xe)Te.score===void 0&&(Te.score=.5),Te.score*=.99995,Te.score<.05&&(Te.score=0),Te.score=Math.round(Te.score*1e5)/1e5,Te.score>0&&Re.push(Te);so(zn,Re)}}catch{}break}catch(S){yt++;let C=new Date().toLocaleString(),Ie=S instanceof Error?(()=>{try{return JSON.parse(JSON.parse(S.message).error.message).error.message}catch{return String(S)}})():String(S);await new Promise(D=>setTimeout(D,1e3));let M=j.join(Cn,"janitor");if(Se.existsSync(M)||Se.mkdirSync(M,{recursive:!0}),Se.appendFileSync(j.join(M,"error.log"),`ERROR [Attempt ${yt}/${rn+1}] [${C}]: ${Ie}
|
|
597
599
|
|
|
598
|
-
`),yt>
|
|
600
|
+
`),yt>rn)break;let A=Math.min(750*Math.pow(2,yt-1),5e3);await new Promise(D=>setTimeout(D,A))}if(yt){let S=j.join(Cn,"janitor");Se.appendFileSync(j.join(S,"error.log"),`-----------------------------------------------------------------------------
|
|
599
601
|
|
|
600
|
-
`)}if(process.stdout.isTTY)try{let Ie=(await $i())[g]?.name||"",
|
|
602
|
+
`)}if(process.stdout.isTTY)try{let Ie=(await $i())[g]?.name||"",M=Ie&&!Ie.startsWith("flow-")&&!Ie.startsWith("Session ")?Ie:"FluxFlow | Idle";process.stdout.write(`\x1B]0;${M}\x07`),process.stdout.write(`\x1B]633;P;TerminalTitle=${M}\x07`)}catch{process.stdout.write("\x1B]0;FluxFlow | Idle\x07"),process.stdout.write("\x1B]633;P;TerminalTitle=FluxFlow | Idle\x07")}},Zr=e=>{if(!e||typeof e!="string")return e;let n=e.split(""),t=!1,i=!1,o=0;for(;o<n.length;){if(n[o]==="`"&&n[o+1]==="`"&&n[o+2]==="`"){t?(n[o]=" ",n[o+1]=" ",n[o+2]=" ",t=!1):(n[o]=" ",n[o+1]=" ",n[o+2]=" ",t=!0),o+=3;continue}if(t){n[o]!==`
|
|
601
603
|
`&&n[o]!=="\r"&&(n[o]=" "),o++;continue}if(n[o]==="`"){i=!i,n[o]=" ",o++;continue}if(i){n[o]===`
|
|
602
|
-
`||n[o]==="\r"?i=!1:n[o]=" ",o++;continue}o++}return n.join("")},fl=e=>{let n=
|
|
603
|
-
`):null},_d=(e,n={})=>{if(!e)return null;if(Uo=n,fs=new Jr({apiKey:e}),!globalThis.__perfCleanupInstalled){globalThis.__perfCleanupInstalled=!0,setInterval(()=>{typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks())},6e4);let t=globalThis.fetch;globalThis.fetch=async(...i)=>{try{let o=await t(...i);return typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}catch(o){throw typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}}}},ta=e=>{if(!e)return{serviceTier:void 0,cleanModel:e};let n=e.toLowerCase();return n.endsWith(":flex")?{serviceTier:"flex",cleanModel:e.slice(0,-5)}:n.endsWith(":priority")?{serviceTier:"priority",cleanModel:e.slice(0,-9)}:{serviceTier:void 0,cleanModel:e}},hi=async(e,n,t,i,o="Fast",r=.75,d="agent")=>ll(async()=>{let{aiProvider:a="Google",apiKey:u,mode:p}=e,x="",m=null,f=typeof t=="string"?[{role:"user",parts:[{text:t}]}]:t,s=new AbortController,g=s.signal,T=setInterval(()=>{ht&&(s.abort(),clearInterval(T))},100),ue=Date.now(),y=null;try{let
|
|
604
|
+
`||n[o]==="\r"?i=!1:n[o]=" ",o++;continue}o++}return n.join("")},fl=e=>{let n=Bt(e),t=Zr(n);Bo.lastIndex=0;let i;for(;(i=Bo.exec(t))!==null;){let o=i.index+i[0].length-1,r=0,d=null,a=!1,u=!1;for(let p=o;p<t.length;p++){let x=t[p];if(!d&&(x==='"'||x==="'"||x==="`")?(d=x,a=!1):d&&x===d&&!a&&(d=null),!d&&(x==="("?r++:x===")"&&r--,r===0)){let m=p+1;for(;m<t.length&&/\s/.test(t[m]);)m++;if(m<t.length&&t[m]==="]"){u=!0,Bo.lastIndex=m+1;break}}x==="\\"?a=!a:a=!1}if(!u)return{inside:!0,toolName:i[1],startIndex:i.index,args:n.substring(i.index+i[0].length)}}return{inside:!1}},ea=(e,n=!0)=>{let t=Bo;t.lastIndex=0;let i="",o=0,r;for(;(r=t.exec(e))!==null;){let d=e.substring(o,r.index);i+=n&&o===0?Bt(d):d;let a=r.index+r[0].length-1,u=0,p=null,x=-1;for(let m=a;m<e.length;m++){let f=e[m];if(p){if(f===p){let s=0;for(let g=m-1;g>=0&&e[g]==="\\";g--)s++;s%2===0&&(p=null)}}else if(f==='"'||f==="'"||f==="`")p=f;else if(f==="(")u++;else if(f===")"&&(u--,u===0)){let s=m+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(s<e.length&&e[s]==="]"){x=s;break}}}if(x!==-1)i+="[tool:functions."+r[1]+"()]",o=x+1,t.lastIndex=o;else{i+="[tool:functions."+r[1]+"(",o=e.length;break}}return o<e.length&&(i+=n&&o===0?Bt(e.substring(o)):e.substring(o)),i},ul=(e,n,t)=>{let i=Bo;i.lastIndex=0;let o="",r=0,d;for(;(d=i.exec(e))!==null;){let a=e.substring(r,d.index);o+=a.replace(n,t);let u=d.index+d[0].length-1,p=0,x=null,m=-1;for(let f=u;f<e.length;f++){let s=e[f];if(x){if(s===x){let g=0;for(let T=f-1;T>=0&&e[T]==="\\";T--)g++;g%2===0&&(x=null)}}else if(s==='"'||s==="'"||s==="`")x=s;else if(s==="(")p++;else if(s===")"&&(p--,p===0)){let g=f+1;for(;g<e.length&&/\s/.test(e[g]);)g++;if(g<e.length&&e[g]==="]"){m=g;break}}}if(m!==-1)o+=e.substring(d.index,m+1),r=m+1,i.lastIndex=r;else{o+=e.substring(d.index),r=e.length;break}}return r<e.length&&(o+=e.substring(r).replace(n,t)),o},qr=e=>ea(e,!0),gl=e=>{if(!e)return e;let n={patchfile:"PatchFile",writefile:"WriteFile",readfile:"ReadFile",viewfile:"ReadFile",run:"Run",execcommand:"Run",searchkeyword:"SearchKeyword",codesearch:"CodeSearch",code_search:"CodeSearch",websearch:"WebSearch",webscrape:"WebScrape",readfolder:"ReadFolder",writepdf:"WritePDF",writedoc:"WriteDoc",writedocx:"WriteDoc",filemap:"FileMap",generateimage:"GenerateImage",todo:"Todo",goal:"Goal",askuser:"AskUser",ask:"AskUser"},t=o=>o.split("_").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");Vr.lastIndex=0;let i=e.replace(Vr,(o,r,d)=>{let a="";try{let x=JSON.parse(d.trim());x&&typeof x=="object"&&(a=Object.entries(x).map(([f,s])=>{let g=typeof s=="string"?s:JSON.stringify(s);return`${f}=${JSON.stringify(g)}`}).join(", "))}catch{let m=[],f=rl;f.lastIndex=0;let s;for(;(s=f.exec(d))!==null;){let g=s[1],T=s[2]!==void 0?s[2]:s[0].split(":").slice(1).join(":").trim();m.push(`${g}=${JSON.stringify(T)}`)}m.length>0?a=m.join(", "):a=d.trim()}let u=r.toLowerCase().replace(/_/g,"");return`[tool:functions.${n[u]||t(r)}(${a})]`});return Yr.lastIndex=0,zr.lastIndex=0,i=i.replace(Yr,""),i=i.replace(zr,""),i},fo=e=>{if(!e)return[];let n=gl(e),t=Bt(n),i=[],o=Zr(t),r=Za;r.lastIndex=0;let d;for(;(d=r.exec(o))!==null;){let a=d[1],u=d.index+d[0].length-1,p=0,x=null,m=-1,f=-1;for(let s=u;s<o.length;s++){let g=o[s];if(x){if(g===x){let T=0;for(let ue=s-1;ue>=0&&o[ue]==="\\";ue--)T++;T%2===0&&(x=null)}}else{if(s>u&&(o.substring(s).startsWith("[action:")||o.substring(s).startsWith("[tool:")))break;if(g==='"'||g==="'"||g==="`")x=g;else if(g==="(")p++;else if(g===")"&&(p--,p===0)){f=s;let T=s+1;for(;T<o.length&&/\s/.test(o[T]);)T++;if(T<o.length&&o[T]==="]"){m=T;break}}}}if(m!==-1){let s=t.substring(u+1,f),g=t.substring(d.index,m+1);i.push({fullMatch:g,toolName:a.trim(),args:s.trim()}),r.lastIndex=m+1}}return i},Xr=e=>{if(!e)return null;let n=Bt(e),t=[],i=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-zA-Z0-9_]+)\s*\(/gi,o=[],r;for(;(r=i.exec(n))!==null;)o.push({toolName:r[1],index:r.index,parenIndex:r.index+r[0].length-1});for(let f=0;f<o.length;f++){let s=o[f],g=f+1<o.length?o[f+1].index:n.length,T=n.substring(s.index,g),ue=T.indexOf("("),y=ue!==-1?T.substring(ue+1):"",_=0,W=null,K=!1;for(let F=0;F<y.length;F++){let E=y[F];if(W){if(E===W){let me=0;for(let ke=F-1;ke>=0&&y[ke]==="\\";ke--)me++;me%2===0&&(W=null)}}else if(E==='"'||E==="'"||E==="`")W=E;else if(E==="(")_++;else if(E===")")if(_>0)_--;else{let me=F+1;for(;me<y.length&&/\s/.test(y[me]);)me++;if(me<y.length&&y[me]==="]"){K=!0;break}}}if(!K){let F=T.trim(),E="";W?E=`Unclosed quote string (${W}) inside arguments`:F.endsWith("]")?E=`Missing closing ')' before ']' (e.g. found "...]")`:F.endsWith(")")?E=`Missing closing ']' after ')' (e.g. found "...)" instead of "...)]")`:!F.includes(")")&&!F.includes("]")?E="Missing closing delimiter ')]'":E="Malformed or unclosed call syntax (missing ')]')",t.push(`\u2022 [action:${s.toolName}(...)]: ${E}. Expected: [action:${s.toolName}(arg1="...", arg2="...")]`)}}let d=/(?:^|[^\w\[])(?:tool|action):(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/gi,a;for(;(a=d.exec(n))!==null;){let f=a[1],s=a.index+(a[0].indexOf(":")-(a[0].startsWith("action")||a[0].startsWith("tool")?0:1));(s>0?n[s-1]:"")!=="["&&ui(f)&&t.push(`\u2022 action:${f}(...): Missing opening bracket '['. Expected: [action:${f}(...)]`)}let u=/\[\s*(?:functions\.)?([a-zA-Z0-9_]+)\s*\(/g,p;for(;(p=u.exec(n))!==null;){let f=p[1];f!=="action"&&f!=="tool"&&ui(f)&&t.push(`\u2022 [${f}(...)]: Missing 'action:' prefix. Expected: [action:${f}(...)]`)}let x=/\[\s*(?:tool|action)\s*:\s*(?:functions\.)?([a-zA-Z0-9_]+)(?!\s*\()/gi,m;for(;(m=x.exec(n))!==null;){let f=m[1];ui(f)&&t.push(`\u2022 [action:${f}...]: Missing opening '(' for tool arguments. Expected: [action:${f}(...)]`)}return t.length>0?t.join(`
|
|
605
|
+
`):null},_d=(e,n={})=>{if(!e)return null;if(Uo=n,fs=new Jr({apiKey:e}),!globalThis.__perfCleanupInstalled){globalThis.__perfCleanupInstalled=!0,setInterval(()=>{typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks())},6e4);let t=globalThis.fetch;globalThis.fetch=async(...i)=>{try{let o=await t(...i);return typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}catch(o){throw typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),o}}}},ta=e=>{if(!e)return{serviceTier:void 0,cleanModel:e};let n=e.toLowerCase();return n.endsWith(":flex")?{serviceTier:"flex",cleanModel:e.slice(0,-5)}:n.endsWith(":priority")?{serviceTier:"priority",cleanModel:e.slice(0,-9)}:{serviceTier:void 0,cleanModel:e}},hi=async(e,n,t,i,o="Fast",r=.75,d="agent")=>ll(async()=>{let{aiProvider:a="Google",apiKey:u,mode:p}=e,x="",m=null,f=typeof t=="string"?[{role:"user",parts:[{text:t}]}]:t,s=new AbortController,g=s.signal,T=setInterval(()=>{ht&&(s.abort(),clearInterval(T))},100),ue=Date.now(),y=null;try{let _;if(a==="Ollama")_=(await ce("Ollama"))(u,n,f,i,o,p,rt(n),g,r,e.systemSettings?.ollamaEndpoint||"Cloud");else if(a==="OpenRouter")_=(await ce("OpenRouter"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="DeepSeek")_=(await ce("DeepSeek"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="Mistral")_=(await ce("Mistral"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="NVIDIA")_=(await ce("NVIDIA"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="InferX")_=(await ce("InferX"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="SenseNova")_=(await ce("SenseNova"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="AIHubMix")_=(await ce("AIHubMix"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="Poolside")_=(await ce("Poolside"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="9router"||a==="9Router")_=(await ce("NineRouter"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="ExpLabs"||a==="ExperientialLabs")_=(await ce("ExpLabs"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="Infron"||a==="infron")_=(await ce("Infron"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="TokenHarbor"||a==="Token Harbor"||a==="tokenharbor"||a==="token_harbor"||a==="thk")_=(await ce("TokenHarbor"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="APInex"||a==="apinex"||a==="apx")_=(await ce("APInex"))(u,n,f,i,o,p,rt(n),g,r);else if(a==="c_openai"||a==="Custom (OpenAI)")_=(await ce("c_openai"))(u,n,f,i,o,p,rt(n),g,r,e.systemSettings?.customOpenAIBaseUrl||"");else{let W=us(u),{serviceTier:K,cleanModel:F}=ta(n),E={systemInstruction:i,temperature:r,thinkingConfig:(()=>{let ke=(n||"").toLowerCase(),ve=ke.includes("gemma-4")||ke.startsWith("gemma"),we=ke.includes("gemini-3");if(ve||we)return ve?o.toLowerCase()!=="xhigh"?{includeThoughts:!1,thinkingLevel:He.MINIMAL}:{includeThoughts:!0,thinkingLevel:He.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:ke.includes("pro")?He.LOW:He.MINIMAL,Low:He.LOW,Medium:He.MEDIUM,Standard:He.MEDIUM,High:He.HIGH,xHigh:He.HIGH}[o]||He.MEDIUM};{let k={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[o]||2048;return k===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:k}}})()};K&&(E.serviceTier=K),_=await W.models.generateContentStream({model:F,contents:f,config:E},{signal:g})}for await(let W of _){if(ht)throw new Error("Subagent task was cancelled.");if(e?.taskId&&typeof Kt<"u"){let E=Kt.find(me=>me.id===e.taskId);if(E&&E.status==="cancelled")throw new Error("Subagent task was cancelled.")}y===null&&(W.candidates?.[0]?.content?.parts||W.text)&&(y=Date.now()-ue);let K="";if(W.candidates?.[0]?.content?.parts)for(let E of W.candidates[0].content.parts)E.text&&!E.thought&&(x+=E.text,K+=E.text);let F=K?Oi(K):0;e&&typeof e.onTokenChunk=="function"&&e.onTokenChunk(K,F),W.usageMetadata&&(m=W.usageMetadata)}}finally{clearInterval(T)}if(m){let _=m.totalTokenCount||0,W=m.cachedContentTokenCount||0,K=(m.candidatesTokenCount||0)+(a==="Google"&&m.thoughtsTokenCount||0);await pt("tokens",_,a,n),W>0&&await pt("cachedTokens",W,a,n),K>0&&await pt("candidateTokens",K,a,n),y!==null&&y>0&&await pt("ttft",y,a,n),To({provider:a,model:n,prompt:m.promptTokenCount||0,cached:W,output:K,reasoning:m.thoughtsTokenCount||0,ttft:y}),e&&typeof e.onUsage=="function"&&e.onUsage({totalTokenCount:_,cachedContentTokenCount:W,candidatesTokenCount:K})}return await Rt("agent",a),{text:x,usageMetadata:m}}),ml=async(e,n,t=null)=>{t=t||Ct(Jo,{});try{let{aiProvider:i="Google"}=n;if(Object.values(t).flat().length<=5)return;let r=Object.keys(t).filter(f=>f!==e&&Array.isArray(t[f])&&t[f].length>2);if(r.length===0)return;let d=`You are a silent background process for the FluxFlow CLI Agent.
|
|
604
606
|
Your task is to summarize or merge temporary context memories from one or more past conversation sessions.
|
|
605
607
|
For each Chat ID provided, you must output a tool call to save the consolidated summary.
|
|
606
608
|
|
|
@@ -625,8 +627,8 @@ ${g}
|
|
|
625
627
|
`):d+=`-- Individual Memories:
|
|
626
628
|
${g}
|
|
627
629
|
|
|
628
|
-
`}let u=0,p=5,x=!1,m=re("gemma_janitor_fallback_google");for(i==="OpenRouter"&&(m=re("janitor_open_router")),i==="DeepSeek"&&(m=re("deepseek_level_1")),i==="Mistral"&&(m=re("mistral_level_1")),i==="NVIDIA"&&(m=re("nvidia_janitor_fallback")),i==="InferX"&&(m=re("inferx_fallback")),i==="SenseNova"&&(m=re("sensenova_fallback")),i==="AIHubMix"&&(m=re("aihubmix_fallback")),i==="Poolside"&&(m=re("poolside_fallback")),(i==="9router"||i==="9Router")&&(m=re("9router_fallback"));u<=p&&!x;){u++;try{let s=(await hi(n,m,d,null,"Fast",.75,"background")).text||"",g=fo(s);if(g.length===0)throw new Error("No tool calls detected in synthesis response");for(let T of g){let ue=T.toolName;["saveSummary","saveSumary","SaveSummary","SaveSumary"].includes(ue)&&await No(ue,T.args,{chatId:e})}x=!0}catch(f){if(u>=p)throw new Error(`Failed after ${p} attempts. Last error: ${f.message}`)}}}catch(i){let o=i instanceof Error?(()=>{try{return JSON.parse(JSON.parse(i.message).error.message).error.message}catch{return String(i)}})():String(i),r=
|
|
629
|
-
`)}},vd=async(e,n,t=!1)=>{let{chatId:i,aiProvider:o="Google"}=e,r=
|
|
630
|
+
`}let u=0,p=5,x=!1,m=re("gemma_janitor_fallback_google");for(i==="OpenRouter"&&(m=re("janitor_open_router")),i==="DeepSeek"&&(m=re("deepseek_level_1")),i==="Mistral"&&(m=re("mistral_level_1")),i==="NVIDIA"&&(m=re("nvidia_janitor_fallback")),i==="InferX"&&(m=re("inferx_fallback")),i==="SenseNova"&&(m=re("sensenova_fallback")),i==="AIHubMix"&&(m=re("aihubmix_fallback")),i==="Poolside"&&(m=re("poolside_fallback")),(i==="9router"||i==="9Router")&&(m=re("9router_fallback"));u<=p&&!x;){u++;try{let s=(await hi(n,m,d,null,"Fast",.75,"background")).text||"",g=fo(s);if(g.length===0)throw new Error("No tool calls detected in synthesis response");for(let T of g){let ue=T.toolName;["saveSummary","saveSumary","SaveSummary","SaveSumary"].includes(ue)&&await No(ue,T.args,{chatId:e})}x=!0}catch(f){if(u>=p)throw new Error(`Failed after ${p} attempts. Last error: ${f.message}`)}}}catch(i){let o=i instanceof Error?(()=>{try{return JSON.parse(JSON.parse(i.message).error.message).error.message}catch{return String(i)}})():String(i),r=j.join(Cn,"janitor");Se.existsSync(r)||Se.mkdirSync(r,{recursive:!0}),Se.appendFileSync(j.join(r,"error.log"),`[${new Date().toLocaleString()}] Past memory batch consolidation error: ${o}
|
|
631
|
+
`)}},vd=async(e,n,t=!1)=>{let{chatId:i,aiProvider:o="Google"}=e,r=j.join(Xo,"chat-summaries.json"),d=s=>s.filter(g=>(g.role==="user"||g.role==="agent"||g.role==="system")&&g.role!=="think"&&!g.isVisualFeedback&&!g.isMeta&&!g.isTerminalRecord&&!(g.text&&g.text.includes("[TERMINAL_RECORD]"))&&!String(g.id).startsWith("welcome")).map(g=>{let T=g.fullText||g.text||"",ue=g.role==="system"||T.startsWith("[ACTION RESULT]:")||T.startsWith("[TOOL RESULT]:")||g.text&&(g.text.startsWith("[ACTION RESULT]:")||g.text.startsWith("[TOOL RESULT]:")),y=T;return ue&&(T.includes("[ACTION RESULT]:")||T.includes("[TOOL RESULT]:")||g.text&&(g.text.includes("[ACTION RESULT]:")||g.text.includes("[TOOL RESULT]:")))?y="[ACTION RESULT]: ...truncated for summary":y=y.replace(/(\[(?:tool|action):[a-zA-Z0-9_\.]+)\([\s\S]*?\)(\])/g,"$1(...)$2"),`[${ue?"ACTION":g.role==="agent"?"AGENT":"USER"}]: ${y}`}).join(`
|
|
630
632
|
|
|
631
633
|
`),a=async(s,g)=>{let T="You are an expert context summarizer. Summarize the provided chat history (which may include previous summaries, user instructions, agent outputs, and tool results) into a detailed, coherent, and highly technical summary of 1000 to 1500 words. Focus on preserving the architectural decisions made, current system state, task progress, and critical code details, chat messages, file changes. Under no circumstances exceed MAX 2000 words.",ue=g?`Here is the previous summary:
|
|
632
634
|
${g}
|
|
@@ -637,13 +639,13 @@ ${s}
|
|
|
637
639
|
Provide a new consolidated summary of the entire session.`:`Here is the conversation history:
|
|
638
640
|
${s}
|
|
639
641
|
|
|
640
|
-
Provide a consolidated summary of the entire session.`,y=re("gemma_janitor_fallback_google");o==="OpenRouter"&&(y=re("janitor_open_router")),o==="DeepSeek"&&(y=re("deepseek_level_1")),o==="Mistral"&&(y=re("mistral_level_1")),o==="NVIDIA"&&(y=re("nvidia_chat_summarizer_fallback")),o==="InferX"&&(y=re("inferx_fallback")),o==="SenseNova"&&(y=re("sensenova_fallback")),o==="AIHubMix"&&(y=re("aihubmix_fallback")),o==="Poolside"&&(y=re("poolside_fallback")),(o==="9router"||o==="9Router")&&(y=re("9router_fallback")),(o==="ExpLabs"||o==="ExperientialLabs")&&(y=re("explabs_fallback")||"deepseek-v4-pro-0813"),(o==="TokenHarbor"||o==="Token Harbor"||o==="tokenharbor"||o==="token_harbor"||o==="thk")&&(y=re("tokenharbor_fallback")||"deepseek-v4.1-flash:free"),(o==="Infron"||o==="infron")&&(y=re("infron_fallback"));let
|
|
641
|
-
`),
|
|
642
|
-
`),C=(f?.tokens||0)>=1e4,Ie=new Date,
|
|
642
|
+
Provide a consolidated summary of the entire session.`,y=re("gemma_janitor_fallback_google");o==="OpenRouter"&&(y=re("janitor_open_router")),o==="DeepSeek"&&(y=re("deepseek_level_1")),o==="Mistral"&&(y=re("mistral_level_1")),o==="NVIDIA"&&(y=re("nvidia_chat_summarizer_fallback")),o==="InferX"&&(y=re("inferx_fallback")),o==="SenseNova"&&(y=re("sensenova_fallback")),o==="AIHubMix"&&(y=re("aihubmix_fallback")),o==="Poolside"&&(y=re("poolside_fallback")),(o==="9router"||o==="9Router")&&(y=re("9router_fallback")),(o==="ExpLabs"||o==="ExperientialLabs")&&(y=re("explabs_fallback")||"deepseek-v4-pro-0813"),(o==="TokenHarbor"||o==="Token Harbor"||o==="tokenharbor"||o==="token_harbor"||o==="thk")&&(y=re("tokenharbor_fallback")||"deepseek-v4.1-flash:free"),(o==="Infron"||o==="infron")&&(y=re("infron_fallback"));let _=0,W=!1,K=null;for(;_<=3&&!W;){_++;try{K=await hi(e,y,ue,T,"Fast"),W=!0}catch{if(_>3){if(o==="Google")try{let E=re("general_fallback");return(await hi(e,E,ue,T,"Fast")).text||""}catch{return""}return""}}}return K&&K.text||""},u=d(n),p=Ct(r,{}),x=p[i]||{summary:"",historyLength:0};typeof x=="string"&&(x={summary:x,historyLength:0});let m=x.summary||"",f=await a(u,m);if(f){x.summary=f;let s=cl(n);return t?x.historyLength=(x.historyLength||0)+s:x.historyLength=s,p[i]=x,so(r,p),f}return null},Id=e=>{try{let n=j.join(Xo,"chat-summaries.json");if(Se.existsSync(n)){let t=Ct(n,{});t[e]&&(delete t[e],so(n,t))}}catch{}},Md=async function*(e,n,t,i,o){let{profile:r,thinkingLevel:d,mode:a,janitorModel:u,chatId:p,isPlayground:x,systemSettings:m,sessionStats:f,aiProvider:s="Google",apiTier:g,wildcardTooling:T,wildercardTooling:ue}=t,y=rt(e);if(!fs&&s==="Google")throw new Error("AI not initialized");let _=process.env.NVIDIA_BASE_URL||t?.aiProvider==="Ollama"||t?.aiProvider==="InferX"||t?.aiProvider==="SenseNova"||t?.aiProvider==="AIHubMix"||t?.aiProvider==="Poolside"||t?.aiProvider==="9router"||t?.aiProvider==="ExpLabs"||t?.aiProvider==="ExperientialLabs"||t?.aiProvider==="TokenHarbor"||t?.aiProvider==="Token Harbor"||t?.aiProvider==="tokenharbor"||t?.aiProvider==="token_harbor"||t?.aiProvider==="thk"||t?.aiProvider==="APInex"||t?.aiProvider==="apinex"||t?.aiProvider==="apx"||t?.aiProvider==="Infron"||t?.aiProvider==="infron"||t?.aiProvider==="c_openai"||t?.aiProvider==="Custom (OpenAI)"?!1:m?.memory!==!1,W=n[n.length-1].text,K=j.join(Xo,"chat-summaries.json"),F=!1,E=n.filter(k=>k.role==="user").length===1,me=W.includes("[TITLE-UPDATE]"),ke=E||me,ve=W.replace(/\[TITLE-UPDATE\]/g,"").trim();ve=ve.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),yield{type:"status",content:"[start]"},yield{type:"status",content:"Gathering Context"},await ei.startTransaction(p,ve),m?.advanceRollback&&await Ao.takeInitialSnapshot(p),ht=!1;let we=null;try{let k=new AbortController;we=setInterval(()=>{ht&&(k.abort(),we&&(clearInterval(we),we=null))},400);let b=[...n.slice(0,-1)];{let Be=Ct(K,{})[p]||{summary:"",historyLength:0};if(Be.summary&&Be.historyLength>0){let yn=0,Xe=[];for(let Ae=0;Ae<b.length;Ae++){let Je=b[Ae];(Je.role==="user"||Je.role==="agent"||Je.role==="system")&&!String(Je.id).startsWith("welcome")&&!Je.isMeta&&yn++,yn>Be.historyLength&&Xe.push(Je)}b=Xe}}b=b.map(O=>{if(O.role==="user"&&O.text){let Be=O.text.match(/\[USER\]([\s\S]*?)\[\/USER\]/);if(Be)return{...O,text:Be[1].trim()}}return{...O}});let lt=process.env.HIGH_CONTEXT,$e=process.env.GOOGLE_GEMMA_NONSENSE==="true"||process.env.GOOGLE_GEMMA_NONSENSE===!0||!1,_t={"16k":16e3,"32k":32e3,"64k":64e3,"128k":128e3,"256k":256e3,"512k":512e3,"1M":1e6}[m?.contextLength]||256e3;if(lt&<!=="false"){let O=parseInt(lt,10);!isNaN(O)&&O>=0&&O<=1e6&&(_t=O)}if((s==="NVIDIA"&&(e?.includes("gpt")||e?.includes("qwen")||e?.includes("medium")||e.includes("muse"))||s==="Mistral")&&(_t=126e3),s==="Google"&&e?.includes("gemma")&&$e&&(_t=16e3),(f?.tokens||0)>_t){yield{type:"text",content:"\u2726 Maximum Context Limit Reached. Start a new chat."};return}if(E&&_){let O=Ct(Jo,{});Object.values(O).flat().length>5&&(yield{type:"status",content:"Condensing past chat memories"},await ml(p,t,O))}let Ut=Ct(Jo,{}),gn=Ct(vi,{}),mn=Object.entries(Ut).filter(([O])=>O!==p).flatMap(([O,Be])=>Be),yt=[...Object.entries(gn).filter(([O])=>O!==p).slice(-20).map(([O,Be])=>`[Chat Summary]: ${Be}`),...mn].map(O=>`- ${O}`).join(`
|
|
643
|
+
`),S=Ct(zn,[]).map(O=>`- ${O.memory}`).join(`
|
|
644
|
+
`),C=(f?.tokens||0)>=1e4,Ie=new Date,M=Ie.getFullYear(),A=Ie.toLocaleString("en-US",{month:"short"}).toUpperCase(),D=String(Ie.getDate()).padStart(2,"0"),Re=`${Ie.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0})}`,Te=O=>{try{return Se.readdirSync(O,{withFileTypes:!0})}catch{return[]}},Me=Array.from(new Set([...wo,...So(process.cwd())])),Wo=(O,Be=6)=>m?.indentationTree!==!1?is(O,Be,1,Te,Me):rs(O,Be,"",1,Te,Me),Bn=Ct(Ii,{}),uo=Bn[p],Go=uo?uo!==process.cwd():!1;Bn[p]=process.cwd(),so(Ii,Bn);let pn=Ct(K,{}),Wt=pn[p]||{summary:"",historyLength:0};typeof Wt=="string"&&(Wt={summary:Wt,historyLength:0});let tt=n.filter(O=>(O.role==="user"||O.role==="agent"||O.role==="system")&&!String(O.id).startsWith("welcome")&&!O.isMeta).length;Wt.historyLength&&tt<Wt.historyLength&&(Wt.summary="",Wt.historyLength=0,pn[p]=Wt,so(K,pn));let de=typeof Wt=="object"?Wt.summary||"":Wt||"",ae=b.length>0;ae&&de&&b[0]&&(b[0].role==="user"||b[0].role==="system")&&(b[0].text.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")||(b[0].text=`[SYSTEM METADATA]
|
|
643
645
|
**CONTEXT SUMMARY OF PREVIOUS TURNS (PRIORITY: DYNAMIC)**
|
|
644
646
|
${de}
|
|
645
647
|
|
|
646
|
-
[USER] ${b[0].text}`,yield{type:"summary_injected",content:{id:b[0].id,text:b[0].text}}));let
|
|
648
|
+
[USER] ${b[0].text}`,yield{type:"summary_injected",content:{id:b[0].id,text:b[0].text}}));let vt=de&&!ae?`
|
|
647
649
|
[SYSTEM METADATA]
|
|
648
650
|
**CONTEXT SUMMARY OF PREVIOUS TURNS**
|
|
649
651
|
${de}
|
|
@@ -652,7 +654,7 @@ ${de}
|
|
|
652
654
|
CWD: `+process.cwd()+`${x?" [PLAYGROUND MODE]":""}
|
|
653
655
|
`+Wo(process.cwd(),6),ct=await qn(),hn="";if(lo()&&ct.file_focused!=="none"){hn=`
|
|
654
656
|
[Additional IDE Context]
|
|
655
|
-
`;let O=
|
|
657
|
+
`;let O=j.relative(process.cwd(),ct.file_focused),Be=(ct.opened_editors||[]).map(Xe=>{let Ae=j.relative(process.cwd(),Xe);return Ae.startsWith("..")?`[External] ${j.basename(Xe)}`:Ae});if(hn+=`Focused File: ${O}
|
|
656
658
|
Cursor Line: ${ct.cursor_line}
|
|
657
659
|
`,ct.selected){let Xe=ct.selected,Ae=Xe.split(`
|
|
658
660
|
`);Ae.length>256&&(Xe=Ae.slice(0,240).join(`
|
|
@@ -663,27 +665,27 @@ Cursor Line: ${ct.cursor_line}
|
|
|
663
665
|
... [truncated] ...
|
|
664
666
|
`+Xe.slice(-128)),hn+=`Current Selection: "${Xe}"
|
|
665
667
|
`}if(ct.manual_edits){let Ae=ct.manual_edits.split(`
|
|
666
|
-
`),Je=[],Ve=null;for(let
|
|
667
|
-
${
|
|
668
|
-
`)}`;for(;
|
|
669
|
-
${
|
|
670
|
-
`)}`;Ne.length>4*768?
|
|
671
|
-
`);for(;Ee.length>0&&fe.length>4*2048;){Ee[0].edits.length>0?Ee[0].edits.shift():Ee.shift();for(let
|
|
672
|
-
${
|
|
673
|
-
`)}`;Ne.length>4*768?
|
|
668
|
+
`),Je=[],Ve=null;for(let L of Ae)L.trim()&&(L.startsWith(" Line ")?Ve&&Ve.edits.push(L):(Ve={path:L.endsWith(":")?L.slice(0,-1):L,edits:[]},Je.push(Ve)));for(let L of Je)L.edits.length>80&&(L.edits=L.edits.slice(-80)),L.originalEditsCount=L.edits.length;let Qe=(L,Ne)=>Ne.reduce((dt,Zt)=>{let xt=ct.file_focused&&(Zt.path===ct.file_focused||j.resolve(process.cwd(),Zt.path)===j.resolve(ct.file_focused))?Math.ceil(L*1.2):L;return dt+Math.min(Zt.edits.length,xt)},0),Vt=80;if(Qe(80,Je)>300){let L=!1;for(let Ne=80;Ne>=10;Ne--)if(Qe(Ne,Je)<=300){Vt=Ne,L=!0;break}L||(Vt=10)}let Ee=[...Je];if(Vt===10&&Qe(10,Ee)>500)for(;Ee.length>0&&Qe(10,Ee)>500;){let L=0,Ne=Ee[0].originalEditsCount;for(let dt=1;dt<Ee.length;dt++)Ee[dt].originalEditsCount<Ne&&(Ne=Ee[dt].originalEditsCount,L=dt);Ee.splice(L,1)}for(let L of Ee){let dt=ct.file_focused&&(L.path===ct.file_focused||j.resolve(process.cwd(),L.path)===j.resolve(ct.file_focused))?Math.ceil(Vt*1.2):Vt;L.edits.length>dt&&(L.edits=L.edits.slice(-dt))}for(let L of Ee){let Ne=`${L.path}:
|
|
669
|
+
${L.edits.join(`
|
|
670
|
+
`)}`;for(;L.edits.length>0&&Ne.length>4*768;)L.edits.shift(),Ne=`${L.path}:
|
|
671
|
+
${L.edits.join(`
|
|
672
|
+
`)}`;Ne.length>4*768?L.stringRepresentation="... "+Ne.slice(-(4*768-4)):L.stringRepresentation=Ne}let fe=Ee.map(L=>L.stringRepresentation).join(`
|
|
673
|
+
`);for(;Ee.length>0&&fe.length>4*2048;){Ee[0].edits.length>0?Ee[0].edits.shift():Ee.shift();for(let L of Ee){let Ne=`${L.path}:
|
|
674
|
+
${L.edits.join(`
|
|
675
|
+
`)}`;Ne.length>4*768?L.stringRepresentation="... "+Ne.slice(-(4*768-4)):L.stringRepresentation=Ne}fe=Ee.map(L=>L.stringRepresentation).join(`
|
|
674
676
|
`)}fe.length>4*2048&&(fe="... "+fe.slice(-(4*2048-4))),hn+=`Recent Manual Edits:
|
|
675
677
|
${fe}
|
|
676
678
|
`}Be.length>0&&(hn+=`All Opened Editors: ${Be.join(", ")}`),ct.diagnostics&&(hn+=`
|
|
677
679
|
**Active File Errors**:
|
|
678
680
|
${ct.diagnostics}
|
|
679
|
-
`),(
|
|
681
|
+
`),(ve.toLowerCase().includes("lint")||ve.toLowerCase().includes("warning"))&&ct.warnings&&(hn+=`
|
|
680
682
|
**Lint Warnings**:
|
|
681
683
|
${ct.warnings}
|
|
682
|
-
`)}let gs=
|
|
683
|
-
`);yield{type:"visual_feedback",content:
|
|
684
|
-
`)};continue}if(Qe===null&&!De){let _e=0;try{_e=
|
|
685
|
-
`)};continue}}let xn=Qe!==null?Qe:1,Ot=
|
|
686
|
-
`);yield{type:"visual_feedback",content:
|
|
684
|
+
`)}let gs=ve.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),ms=/(?:\\)?@\[([^\]]+)\]/g,yi,xi=[];for(ms.lastIndex=0;(yi=ms.exec(gs))!==null;){let O=yi[0].startsWith("\\");xi.push({tag:yi[1],isEscaped:O})}let bi=[],Ho=null;for(let O=0;O<xi.length;O++){let{tag:Be,isEscaped:yn}=xi[O];if(!yn)try{let Xe=Be.trim().replace(/^["']|["']$/g,""),Ae=/[:#]L?(\d+)(?:-L?(\d+))?$/i,Je=Xe.match(Ae),Ve=Xe,Qe=null,Vt=null;Je&&(Qe=parseInt(Je[1],10),Vt=Je[2]?parseInt(Je[2],10):Qe,Ve=Xe.slice(0,Je.index));let Ee=j.resolve(process.cwd(),Ve);if(Se.existsSync(Ee)&&Se.statSync(Ee).isFile()){let L=Ve.toLowerCase(),Ne=L.endsWith(".pdf"),dt=L.endsWith(".docx")||L.endsWith(".doc")||L.endsWith(".ppt")||L.endsWith(".pptx")||L.endsWith(".xls")||L.endsWith(".xlsx"),Zt=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(L),De=Zt||Ne||dt,xt=s==="Google"||rt(e);if(De&&!xt){let _e=`\u2718 Unsupported Modality: ${j.basename(Ve)}`,nt=115;process.stdout.isTTY&&(nt=process.stdout.columns-5||120);let Yt=[_e],Ue=Math.max(...Yt.map(en=>en.length)),oe=Math.min(Ue+4,nt),We=Yt.map(en=>`${en.padEnd(oe-2).substring(0,oe-2)}`).join(`
|
|
685
|
+
`);yield{type:"visual_feedback",content:Ft(`${We}
|
|
686
|
+
`)};continue}if(Qe===null&&!De){let _e=0;try{_e=Se.readFileSync(Ee,"utf8").split(/\r\n|\r|\n/).length}catch{}if(_e>300){let nt=`\u21B7 Skipped (Too Large): ${j.basename(Ve)}`,Yt=115;process.stdout.isTTY&&(Yt=process.stdout.columns-5||120);let Ue=Math.min(nt.length+4,Yt),oe=nt.padEnd(Ue-2).substring(0,Ue-2);yield{type:"visual_feedback",content:Ft(`${oe}
|
|
687
|
+
`)};continue}}let xn=Qe!==null?Qe:1,Ot=Vt!==null?Vt:Qe!==null?Qe:xn+299;Ot-xn>300&&(Ot=xn+300);let Wn=`path=${JSON.stringify(Ve)}, startLine=${xn}, endLine=${Ot}`,Gt=await Ps(Wn,{isMultiModal:xt}),vn=!1,eo="",bt=null;if(typeof Gt=="string"?Gt.trim().startsWith("ERROR")?vn=!0:eo=Gt:Gt&&typeof Gt=="object"&&Gt.binaryPart?(bt=Gt.binaryPart,eo=Gt.text||""):vn=!0,!vn){let _e="";if(Zt?(_e=`\u2714 Processed: ${j.basename(Ve)}`,Ho=bt):Ne||dt?(_e=`\u2714 Auto-Analysed: ${j.basename(Ve)}`,Ho=bt):(_e=`\u2714 Auto-Read: ${j.basename(Ve)}`,bi.push(eo)),_e){let nt=115;process.stdout.isTTY&&(nt=process.stdout.columns-5||120);let Yt=[_e],Ue=Math.max(...Yt.map(en=>en.length)),oe=Math.min(Ue+4,nt),We=Yt.map(en=>`${en.padEnd(oe-2).substring(0,oe-2)}`).join(`
|
|
688
|
+
`);yield{type:"visual_feedback",content:Ft(`${We}
|
|
687
689
|
`)}}}}}catch{}}let wi="";bi.length>0&&(wi=`
|
|
688
690
|
[Tagged File Contents] Auto Read User Tagged files by System, No need to re-read
|
|
689
691
|
`+bi.join(`
|
|
@@ -692,82 +694,82 @@ ${ct.warnings}
|
|
|
692
694
|
[Tagged File Contents]
|
|
693
695
|
`);let ps=gs.replace(/\\(@\[[^\]]+\])/g,"$1"),hs=T?`You cannot execute tools. Instead write the action string in chat you WOULD have written
|
|
694
696
|
`:"",oa=process.env.forcedReasoning||!1,ys=d!=="Fast"&&(s==="Mistral"&&!Zo(e)||d!=="High"&&s==="Google")?`${s==="Mistral"&&!Zo(e)||e.toLowerCase().startsWith("gemma")||oa?`[system] strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow> [/system]
|
|
695
|
-
`:""}`:"",Zn="";if(m?.clipboardContext)try{process.platform==="win32"?Zn=as("powershell.exe -NoProfile -Command Get-Clipboard",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):process.platform==="darwin"?Zn=as("pbpaste",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):Zn=as("xclip -selection clipboard -o || xsel --clipboard --output",{encoding:"utf8",shell:!0,stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,"")}catch{Zn=""}let jo="",ia=!!m?.autoExcludeMetadata,sa=!!(hn||wi||hs||
|
|
697
|
+
`:""}`:"",Zn="";if(m?.clipboardContext)try{process.platform==="win32"?Zn=as("powershell.exe -NoProfile -Command Get-Clipboard",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):process.platform==="darwin"?Zn=as("pbpaste",{encoding:"utf8",stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,""):Zn=as("xclip -selection clipboard -o || xsel --clipboard --output",{encoding:"utf8",shell:!0,stdio:["pipe","pipe","ignore"],timeout:1500}).replace(/\r?\n$/,"")}catch{Zn=""}let jo="",ia=!!m?.autoExcludeMetadata,sa=!!(hn||wi||hs||vt||ys||Go||m?.dynamicDirAwareness||m?.autoTruncateResults);ia&&!sa?jo=ps.trim():jo=`[System Metadata] Time: ${Re}${Go?`
|
|
696
698
|
WARNING: CWD Changed from previous: "${uo}" to current: "${process.cwd()}", write change in chat to avoid future path mismatches
|
|
697
699
|
`:""}${hn}
|
|
698
700
|
Action format: [action:ActionName(...)]
|
|
699
701
|
[/Metadata]
|
|
700
|
-
${
|
|
702
|
+
${vt}${ys}${wi}${hs}${Zn.trim().length>0?`[Clipboard Context:
|
|
701
703
|
- ${Zn.trim()}
|
|
702
|
-
`:""}[user prompt] ${ps.trim()} [/user prompt]`.trim();let xs={role:"user",text:jo};Ho&&(xs.binaryPart=Ho),b.forEach(O=>{O.text&&O.role==="agent"&&(O.text=
|
|
704
|
+
`:""}[user prompt] ${ps.trim()} [/user prompt]`.trim();let xs={role:"user",text:jo};Ho&&(xs.binaryPart=Ho),b.forEach(O=>{O.text&&O.role==="agent"&&(O.text=Bt(O.text))}),b.push(xs),vt&&n[n.length-1]?.id&&(yield{type:"summary_injected",content:{id:n[n.length-1].id,text:jo}});let Qt=null,_n=a==="Flux"?50:15;_n=a.toLowerCase().includes("cu")?75:_n;let ra=Math.floor(_n/2),bs=0,an=16;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Consulting the spirits":"Connecting"},ht=!1;let Si=[],Ko=!1,ws=!1,Un=[];for(let O=0;O<=_n;O++){let Be=Math.floor(_n*.95);if(O>=Be&&bs<Be&&typeof t?.onAskUser=="function"){bs=Be;try{let V="Agent has been running for a long time. Do you want to continue execution?",Y=[{id:"continue",label:"Continue",description:"Add few more steps"},{id:"cancel",label:"Cancel",description:"Stop extending and finish current turn limit"}],$=await t.onAskUser(V,Y);$&&($.toLowerCase().includes("continue")||$==="Continue")&&(_n+=ra)}catch{}}if(Un.length>=10&&typeof t?.onAskUser=="function"){let V={},Y=null;for(let $ of Un)if(V[$]=(V[$]||0)+1,V[$]>=10){Y=$;break}if(Y)try{let $="Agent seems stuck in a tool loop. You can prompt it to steer or break the loop:",at=[{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"}],Pe=await t.onAskUser($,at);if(Pe){let Ye="";typeof Pe=="string"&&(Pe.toLowerCase()==="stop"||Pe.includes("Stop Loop"))?Ye="STOP REPEATING THE SAME TOOL CALL. Acknowledge what failed or succeeded, summarize your current findings, and conclude.":typeof Pe=="string"&&(Pe.toLowerCase()==="continue"||Pe.includes("Continue Anyway"))?Un=Un.filter(wt=>wt!==Y):Ye=typeof Pe=="string"?Pe:Pe?.label||Pe?.id||"",Ye&&(b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
|
|
703
705
|
|
|
704
|
-
[STEERING HINT from USER, High Priority] ${Ye.trim()} [/STEERING HINT]`:b.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${Ye.trim()} [/STEERING HINT]`}),yield{type:"status",content:"Steering Hint Injected..."},Un=Un.filter(wt=>wt!==
|
|
706
|
+
[STEERING HINT from USER, High Priority] ${Ye.trim()} [/STEERING HINT]`:b.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${Ye.trim()} [/STEERING HINT]`}),yield{type:"status",content:"Steering Hint Injected..."},Un=Un.filter(wt=>wt!==Y))}}catch{}}let yn=await Pi("agent",t);if(!yn.allowed)throw new Error(yn.reason||`Budget Exhausted for Provider (${s||"Agent"})`);let Xe=[];if(Ko=!1,a==="ICU"||a==="FluxCU")try{yield{type:"status",content:"Capturing Screen"},await new Promise($=>setTimeout($,1e3));let{captureGriddedScreenshot:V}=await import("./screen_grid-26MRFY7E.js"),Y=await V();if(Y&&Y.base64){let $="[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]",at={inlineData:{mimeType:Y.mimeType,data:Y.base64}},Pe=m?.imageHistoryCU||"Standard",Ye=Pe==="Low"?3:Pe==="Extended"?10:Pe==="Max"?999:5,wt=b.filter(Fe=>Array.isArray(Fe.parts)&&Fe.parts.some(St=>St.inlineData));if(wt.length>=Ye){let Fe=wt.length-Ye+1;for(let St=0;St<Fe;St++){let Tt=wt[St];Array.isArray(Tt.parts)&&(Tt.parts=Tt.parts.filter(kt=>!kt.inlineData))}}if(b.length>0&&b[b.length-1].role==="user"){let Fe=b[b.length-1];typeof Fe.text=="string"&&(Fe.text+=`
|
|
705
707
|
|
|
706
|
-
${
|
|
708
|
+
${$}`,Array.isArray(Fe.parts)||(Fe.parts=[{text:Fe.text}]),Fe.parts.push(at))}else b.push({role:"user",text:$,parts:[{text:$},at]})}}catch(V){console.error("Vision screenshot capture error:",V)}if(m?.compression===0&&(f?.tokens||0)>_t&&(b=Ms(b,6)),O>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"},ht){try{let{clearPendingNudges:V}=await import("./subagent_state-LZCOZSUJ.js");V()}catch{}yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
|
|
707
709
|
|
|
708
|
-
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}try{let{consumePendingNudges:
|
|
710
|
+
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}try{let{consumePendingNudges:V}=await import("./subagent_state-LZCOZSUJ.js"),Y=V();if(Y&&Y.length>0){let $=Y.join(`
|
|
709
711
|
|
|
710
712
|
`);b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
|
|
711
713
|
|
|
712
|
-
${
|
|
714
|
+
${$}`:b.push({role:"user",text:$}),yield{type:"status",content:"Subagent Update"}}}catch{}if(i){let V=await i();V&&(V.startsWith("/btw")?b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
|
|
713
715
|
|
|
714
716
|
[system] User question. Resolve this specific query within '[ANSWER]...[/ANSWER]' concisely, naturally [/system]
|
|
715
|
-
[question] ${
|
|
716
|
-
[question] ${
|
|
717
|
+
[question] ${V.replace("/btw","").trim()} [/question]`:b.push({role:"user",text:`[system] User question. Resolve this specific query within '[ANSWER]...[/ANSWER]' concisely, naturally [/system]
|
|
718
|
+
[question] ${V.replace("/btw","").trim()} [/question]`}):b.length>0&&b[b.length-1].role==="user"?b[b.length-1].text+=`
|
|
717
719
|
|
|
718
|
-
[STEERING HINT from USER, High Priority] ${
|
|
720
|
+
[STEERING HINT from USER, High Priority] ${V.trim()} [/STEERING HINT]`:b.push({role:"user",text:`[STEERING HINT from USER, High Priority] ${V.trim()} [/STEERING HINT]`}),yield{type:"status",content:`${V.startsWith("/btw")?"Question Forwarded...":"Steering Hint Injected..."}`})}let Ae,Je=!1,Ve=1,Qe=1,Vt=Date.now(),Ee=null,fe="",L=null,Ne=null,dt=null,Zt=0,De=[],xt=0,xn=!1,Ot=!1,Wn=!1,Gt=!1,vn=!0,eo=0,bt="",_e="",nt=!1,Yt=!1,Ue=!0,oe=e,We="",en=d;for(d=d.toLowerCase()==="max"?"High":d;Ve<=an&&Qe<=an&&!Je&&!ht;){let V=!1;try{fe="",vn&&(process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07"),yield{type:"turn_reset",content:!0},vn=!1,Qe===1&&(bt=""));let Y=h=>{if(!h||typeof h!="string")return h;let R="",v=cs(h);if(v&&(R=v.fullBlock,h=v.remainingText),!h.includes("[tool:")&&!h.includes("[action:"))return(m?.keepReasoningContext?R:"")+h;if(fo(h).length===0){let w=pi(h);return(m?.keepReasoningContext?R:"")+w}h=h.replace(al,(w,I)=>I.includes("[tool:")||I.includes("[action:")?I.trim():w);let se="",B=0,z=[],ut="";for(;B<h.length;){let w=h.indexOf("[tool:",B),I=h.indexOf("[action:",B),te=-1;if(w!==-1&&I!==-1?te=Math.min(w,I):w!==-1?te=w:te=I,te===-1){z.length===0&&(se+=pi(h.substring(B)));break}if((te>0?h[te-1]:"")==="`"){se+=pi(h.substring(B,te+1)),B=te+1;continue}z.length===0&&(ut=pi(h.substring(B,te)));let J=-1,P=null,gt=0;for(let Lt=te;Lt<h.length;Lt++){let ne=h[Lt];if(P){if(ne===P){let je=0;for(let mt=Lt-1;mt>=0&&h[mt]==="\\";mt--)je++;je%2===0&&(P=null)}}else if(ne==='"'||ne==="'"||ne==="`")P=ne;else if(ne==="(")gt++;else if(ne===")")gt--;else if(ne==="]"&><=0){J=Lt;break}}if(J===-1){z.length===0&&(se+=h.substring(te));break}let wn=h.substring(te,J+1);z.push(wn),B=J+1}return z.length>0&&(se=ut.trimEnd()?ut.trimEnd()+`
|
|
719
721
|
|
|
720
|
-
`+
|
|
722
|
+
`+z.join(`
|
|
721
723
|
|
|
722
|
-
`):
|
|
724
|
+
`):z.join(`
|
|
723
725
|
|
|
724
|
-
`)),(m?.keepReasoningContext?
|
|
726
|
+
`)),(m?.keepReasoningContext?R:"")+se},$=b.filter(h=>(h.role==="user"||h.role==="agent"||h.role==="system")&&!String(h.id).startsWith("welcome")&&!h.isMeta&&!h.isTerminalRecord&&!(h.text&&h.text.startsWith("[TERMINAL_RECORD]"))).map((h,R,v)=>{let Z=h.text||"";_||(Z=Z.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),h.role==="agent"&&(Z=Y(Z),Z=Z.replace(/\[turn:\s*finish\]/gi,"").replace(/\[\[END\]\]/gi,"").trim(),Z=Z.replaceAll("\x1B[33m\u24D8 Request Cancelled\x1B[0m","*User Cancelled Response Generation*"));let se=[];return Array.isArray(h.parts)&&h.parts.length>0?se=h.parts.map(B=>{if(B.text){let z=B.text;return _||(z=z.replace(/\s*\n*\s*\[Prompted on:.*?\]/gi,"").trim()),h.role==="agent"&&(z=Y(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 B}):se=[{text:Z}],h.binaryPart&&rt(oe)&&v.slice(R+1).filter(z=>z.role==="user"&&!z.text?.startsWith("[ACTION RESULT]")&&!z.text?.startsWith("[TOOL RESULT]")).length<=2&&se.push(h.binaryPart),{role:h.role==="user"||h.role==="system"?"user":"model",parts:se}});for(let h=$.length-2;h>=0;h--){let R=$[h],v=$[h+1];R.role==="user"&&v.role==="user"&&(v.parts?.[0]?.text||"").trim().startsWith("[SYSTEM")&&$.splice(h,1)}let at=[];for(let h=0;h<$.length;h++){let R=$[h];if(at.length===0)at.push(R);else{let v=at[at.length-1];v.role===R.role?(v.parts[0].text+=`
|
|
725
727
|
|
|
726
|
-
`+(
|
|
728
|
+
`+(R.parts?.[0]?.text||""),R.parts?.length>1&&v.parts.push(...R.parts.slice(1))):at.push(R)}}for(let h of at)for(let R of h.parts||[])R&&typeof R.text=="string"&&(R.text.includes("[action:")||R.text.includes("[tool:"))&&(R.text=R.text.replace(/```(?:[a-zA-Z0-9_-]+)?\s*\n?(\[(?:action|tool):[\s\S]*?\)\s*\])\n?```/gi,"$1"),R.text=R.text.replace(/`(\[(?:action|tool):[\s\S]*?\)\s*\])`/gi,"$1"));$.length=0,$.push(...at),oe=e;let Pe=`${p}|${s}|${a}|${d}|${en}|${oe}|${JSON.stringify(r)}|${!!m?.dynamicDirAwareness}|${!!m?.subAgents}`,Ye=Xn.key===Pe&&Xn.value;if((process.env.I_HAVE_TOO_MUCH_MONEY==="true"||process.env.I_HAVE_TOO_MUCH_MONEY===!0)&&(Ye=!1),Ye)We=Xn.value;else{let h=s==="Mistral"?!!Zo(oe):!(oe||"gemma").toLowerCase().startsWith("gemma");We=xr(r,((oe||"gemma").toLowerCase().startsWith("gemma"),en),a,m,_,E,s,s==="Google"?!0:y,h,p,!!m?.keepReasoningContext,oe),m?.dynamicDirAwareness||(We+=`
|
|
727
729
|
${na.replace(`
|
|
728
730
|
**Directory**`,`
|
|
729
|
-
-- Directory --`)}`),Xn.key=Pe,Xn.value=We}let Fe
|
|
731
|
+
-- Directory --`)}`),Xn.key=Pe,Xn.value=We}let Fe=$[$.length-1];if(lo()&O>0){await new Promise(v=>setTimeout(v,2500)),yield{type:"status",content:"Verifying"};let h=await qn(),R=h?h.diagnostics:null;R&&Fe&&Fe.role==="user"&&Fe.parts?.[0]?.text&&(Fe.parts[0].text+=`
|
|
730
732
|
|
|
731
|
-
${
|
|
733
|
+
${R} [/ERROR]`),yield{type:"status",content:"Working"}}let St=s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma");if(m?.advanceRollback&&Fe&&Fe.role==="user"&&(Fe.parts?.[0]?.text?.startsWith("[ACTION RESULT]")||Fe.parts?.[0]?.text?.startsWith("[TOOL RESULT]")))try{let h=await Ao.getLatestFileChanges(p);if(h&&(h.newFiles.length>0||h.modifiedFiles.length>0||h.deletedFiles.length>0)){let R=`
|
|
732
734
|
[system] File Changes:
|
|
733
|
-
`;for(let
|
|
734
|
-
`;for(let
|
|
735
|
-
`;for(let
|
|
736
|
-
`;
|
|
737
|
-
[system] WARNING, Turn Limit Impending: Step ${kt}/${_n}. 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 h=
|
|
735
|
+
`;for(let Z of h.newFiles)R+=`* ${Z} (created)
|
|
736
|
+
`;for(let Z of h.modifiedFiles)R+=`* ${Z} (modified)
|
|
737
|
+
`;for(let Z of h.deletedFiles)R+=`* ${Z} (deleted)
|
|
738
|
+
`;R+="[/system]",Fe.parts[0].text+=R;let v=-1;for(let Z=b.length-1;Z>=0;Z--)if(b[Z].role==="user"&&(b[Z].text?.startsWith("[ACTION RESULT]")||b[Z].text?.startsWith("[TOOL RESULT]"))){v=Z;break}v!==-1&&(b[v].text+=R)}}catch{}let Tt=Math.floor(_n*.99),kt=O+1;if(kt>=Tt&&Fe&&Fe.parts?.[0]&&(Fe.parts[0].text+=`
|
|
739
|
+
[system] WARNING, Turn Limit Impending: Step ${kt}/${_n}. 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 h=j.join(Cn,"chats",String(p));Se.existsSync(h)||Se.mkdirSync(h,{recursive:!0}),Se.writeFileSync(j.join(h,"context.json"),JSON.stringify({contents:$},null,2)),Se.writeFileSync(j.join(h,"system.md"),`${Ye?"CACHED":"NOT CACHED"}
|
|
738
740
|
Key: ${Pe}
|
|
739
741
|
--------------------------------------------------------------------
|
|
740
742
|
|
|
741
|
-
${We}`)}let In=new Promise((h,
|
|
743
|
+
${We}`)}let In=new Promise((h,R)=>{k.signal.aborted&&R(new DOMException("The user aborted a request.","AbortError")),k.signal.addEventListener("abort",()=>{R(new DOMException("The user aborted a request.","AbortError"))})});In.catch(()=>{});let At=$;if(Vt=Date.now(),s==="Ollama")Ae=(await ce("Ollama"))(t.apiKey,oe,At,We,d,a,y,k.signal,1,m?.ollamaEndpoint||"Cloud");else if(s==="OpenRouter")Ae=(await ce("OpenRouter"))(t.apiKey,oe,At,We,d,a,y,k.signal,1,p);else if(s==="DeepSeek")Ae=(await ce("DeepSeek"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="Mistral")Ae=(await ce("Mistral"))(t.apiKey,oe,At,We,d,a,y,k.signal,1,p);else if(s==="NVIDIA"){let h=(await ce("NVIDIA"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);Ae=(await ce("NVIDIA_wrap"))(h,oe)}else if(s==="InferX")Ae=(await ce("InferX"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="SenseNova")Ae=(await ce("SenseNova"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="AIHubMix")Ae=(await ce("AIHubMix"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="Poolside")Ae=(await ce("Poolside"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="9router"||s==="9Router")Ae=(await ce("NineRouter"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="ExpLabs"||s==="ExperientialLabs")Ae=(await ce("ExpLabs"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="Infron"||s==="infron")Ae=(await ce("Infron"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="TokenHarbor"||s==="Token Harbor"||s==="tokenharbor"||s==="token_harbor"||s==="thk")Ae=(await ce("TokenHarbor"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="APInex"||s==="apinex"||s==="apx")Ae=(await ce("APInex"))(t.apiKey,oe,At,We,d,a,y,k.signal,1);else if(s==="c_openai"||s==="Custom (OpenAI)")Ae=(await ce("c_openai"))(t.apiKey,oe,At,We,d,a,y,k.signal,1,m?.customOpenAIBaseUrl||"");else{let h=us(t?.apiKey),{serviceTier:R,cleanModel:v}=ta(oe),Z={systemInstruction:We,mediaResolution:"MEDIA_RESOLUTION_HIGH",safetySettings:[{category:Fn.HARM_CATEGORY_HARASSMENT,threshold:Dn.BLOCK_NONE},{category:Fn.HARM_CATEGORY_HATE_SPEECH,threshold:Dn.BLOCK_NONE},{category:Fn.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Dn.BLOCK_NONE},{category:Fn.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Dn.BLOCK_NONE}],temperature:1.05,thinkingConfig:(()=>{let B=Is("Google",oe||"gemini-3-flash-preview",d);if(B!==null){if(typeof B=="object")return B;if(B===!1||B==="false"||B==="none"||B===0||B==="0")return{includeThoughts:!1};if(typeof B=="number")return{includeThoughts:!0,thinkingBudget:B};if(typeof B=="string"){let I=B.toLowerCase();if(I==="minimal")return{includeThoughts:!0,thinkingLevel:He.MINIMAL};if(I==="low")return{includeThoughts:!0,thinkingLevel:He.LOW};if(I==="medium")return{includeThoughts:!0,thinkingLevel:He.MEDIUM};if(I==="high")return{includeThoughts:!0,thinkingLevel:He.HIGH};let te=Number(B);if(!isNaN(te))return{includeThoughts:!0,thinkingBudget:te}}}let z=(oe||"").toLowerCase(),ut=z.includes("gemma-4")||z.startsWith("gemma"),w=z.includes("gemini-3");if(ut||w)return ut?d.toLowerCase()!=="high"?{includeThoughts:!1,thinkingLevel:He.MINIMAL}:{includeThoughts:!0,thinkingLevel:He.HIGH}:{includeThoughts:!0,thinkingLevel:{Fast:z.includes("pro")?He.LOW:He.MINIMAL,Low:He.LOW,Medium:He.MEDIUM,Standard:He.MEDIUM,High:He.HIGH,xHigh:He.HIGH}[d]||He.MEDIUM};{let I={Fast:0,Low:512,Medium:2048,Standard:2048,High:16384,xHigh:24576}[d]||2048;return I===0?{includeThoughts:!1}:{includeThoughts:!0,thinkingBudget:I}}})()};R&&(Z.serviceTier=R);let se=h.models.generateContentStream({model:v||"gemini-3-flash-preview",contents:At,config:Z},{signal:k.signal});Ae=await Promise.race([se,In])}fe="",L=null,dt=null,De=[],xt=0,yield{type:"model_update",content:null},_e="",nt=bt.length>0;let tn="",Ti=Date.now(),Hn=async function*(){if(s==="Google"&&tn){let h=po(tn);for(let R of h)yield R;tn="",Ti=Date.now()}},Ss=!0,bn="",to=!1,ft=null,ks=!1,jn=!1,no=!1,Vo=!1,Mn=!1,mo=h=>{let R=0;for(;R+2<h.length;)h[R]==="`"&&h[R+1]==="`"&&h[R+2]==="`"?(Vo=!Vo,R+=3):R++},Ts=h=>{if(!h)return;let R=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,v;for(;(v=R.exec(h))!==null;){let Z=v[0].toLowerCase();Z.startsWith("</")||Z.startsWith("[/")||Z==="<channel|>"?Mn=!1:Mn=!0}},da={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|>"}},po=h=>{let R=[],v=h,Z=se=>{if(!se)return;if(!ks){R.push({type:"text",content:se}),mo(se),Ts(se);return}let B=/(?:<(\/?)think_fluxflow[^>]*>|\[(\/?)think_fluxflow\]|<\/?channel\|?>|<\|channel>thought)/gi,z=0,ut;for(;(ut=B.exec(se))!==null;){let I=se.substring(z,ut.index);if(I)if(mo(I),Mn)R.push({type:"text",content:I});else{let Oe=I.replace(/[^\r\n]/g,"");Oe&&R.push({type:"text",content:Oe})}let te=ut[0];mo(te);let l=te.toLowerCase();l.startsWith("</")||l.startsWith("[/")||l==="<channel|>"?Mn=!1:Mn=!0,R.push({type:"text",content:te}),z=B.lastIndex}let w=se.substring(z);if(w)if(mo(w),Mn)R.push({type:"text",content:w});else{let I=w.replace(/[^\r\n]/g,"");I&&R.push({type:"text",content:I})}};for(;v.length>0;)if(to){let se=bn+v,B=da[ft];if(B){let w=!1;if(se.length<B.startPrefix.length?B.startPrefix.startsWith(se)||(w=!0):se.startsWith(B.startPrefix)?se.length>=B.fullPrefix.length&&!se.startsWith(B.fullPrefix)&&(w=!0):w=!0,w){Z(se),bn="",to=!1,ft=null,jn=!1,no=!1,v="";break}}let z=-1,ut=B?B.endTag:"]";if(ft==="tool"||ft==="action"){let w=0,I=null,te=0,l=!1;for(let Oe=0;Oe<se.length;Oe++){let J=se[Oe];if(I){if(J===I){let P=0;for(let gt=Oe-1;gt>=0&&se[gt]==="\\";gt--)P++;P%2===0&&(I=null)}}else if(J==='"'||J==="'")I=J;else if(J==="`")if(jn){z=Oe;break}else I=J;else if(J==="(")w++,l=!0;else if(J===")")w--;else if(J==="]"&&l&&w===0){z=Oe;break}}}else z=se.indexOf(ut);if(z!==-1){let w=ut.length,I=se.substring(0,z+w);ft?.startsWith("kimi")||R.push({type:"text",content:I}),mo(I),Ts(I),(ft==="tool"||ft==="action"||ft?.startsWith("kimi"))&&!jn&&!no&&(ks=!0,Un.push(I.trim())),jn=!1,no=!1,bn="",to=!1,ft=null,v=se.substring(z+w)}else{bn=se,v="";break}}else{let se=v.indexOf("[tool"),B=v.indexOf("[action"),z=v.indexOf("[[END]]"),ut=v.indexOf("<|tool_calls_section_begin|>"),w=v.indexOf("<|tool_call_begin|>"),I=[{type:"tool",idx:se,start:"[tool",end:"]"},{type:"action",idx:B,start:"[action",end:"]"},{type:"end",idx:z,start:"[[END]]",end:"[[END]]"},{type:"kimi_section",idx:ut,start:"<|tool_calls_section_begin|>",end:"<|tool_calls_section_end|>"},{type:"kimi_call",idx:w,start:"<|tool_call_begin|>",end:"<|tool_call_end|>"}].filter(te=>te.idx!==-1).sort((te,l)=>te.idx-l.idx);if(I.length>0){let te=I[0],l=v.substring(0,te.idx);te.idx>0&&Z(l);let Oe=te.idx>0?v[te.idx-1]:"";jn=Vo||Oe==="`",no=Mn,to=!0,ft=te.type,bn="",v=v.substring(te.idx)}else{let te=["[tool","[action","[[END]]","<|tool_calls_section_begin|>","<|tool_call_begin|>"],l=-1;for(let Oe of te){for(let J=Oe.length-1;J>0;J--)if(v.endsWith(Oe.substring(0,J))){l=v.length-J;let P=te.indexOf(Oe);P===0?ft="tool":P===1?ft="action":P===2?ft="end":P===3?ft="kimi_section":ft="kimi_call";break}if(l!==-1)break}if(l!==-1){if(l>0){let J=v.substring(0,l);Z(J)}let Oe=l>0?v[l-1]:"";jn=Vo||Oe==="`",no=Mn,to=!0,bn=v.substring(l),v=""}else{Z(v);break}}}return R},fa=Ae[Symbol.asyncIterator]();for(;;){let{value:h,done:R}=await Promise.race([fa.next(),In]);if(R)break;if(h&&h.type==="status"){yield h;continue}let v="",Z=h.candidates?.[0]?.content?.parts;if(Z&&Z.length>0)for(let B of Z){let z=typeof B.text=="string"?B.text:B.text?parseChunkText(B.text):"";B.thought?z&&(V||(v+="<think_fluxflow>",V=!0),v+=z):z&&(V&&(v+="</think_fluxflow>",V=!1),v+=z)}else h.text&&V&&(v+="</think_fluxflow>",V=!1);v=ol(v);let se=v?Oi(v):0;if(t&&typeof t.onTokenChunk=="function"&&t.onTokenChunk(v,se),Ss&&(Ee===null&&(Ee=Date.now()-Vt),yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"},Ss=!1),ht){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
|
|
742
744
|
|
|
743
|
-
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(v){if(nt){if(_e+=v,_e.length>=64){let
|
|
744
|
-
`).length
|
|
745
|
-
`:""}${
|
|
746
|
-
`)},Ue=!1}De.push({role:"user",text:`[ACTION RESULT]: ERROR: ${he}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${he}`},xt++;continue}}if(t.onToolApproval){let c=t.systemSettings||{}
|
|
745
|
+
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(v){if(nt){if(_e+=v,_e.length>=64){let w=0,I=Math.min(bt.length,_e.length);for(let l=I;l>=10;l--)if(bt.endsWith(_e.substring(0,l))){w=l;break}let te=_e.substring(w);if(te){let Oe=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(bt)?te.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):te.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(Oe)if(fe+=Oe,s==="Google")tn+=Oe;else{yield*Hn();let J=po(Oe);for(let P of J)yield P}}nt=!1,_e=""}continue}else if(fe+=v,s==="Google")tn+=v;else{yield*Hn();let w=po(v);for(let I of w)yield I}let B=fl(fe);if(B.inside){Yt=!0,dt||(dt=Date.now());let I={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"}[B.toolName]||B.toolName,te=B.args||"",l=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(I)){let J=H(te),P=J.basename||J.name||J.path||J.targetFile||J.TargetFile||J.directory||J.file,gt=J.keyword,wn=J.title||J.task,Lt=J.id||J.taskId,ne=J.timeout||J.time||J.seconds||J.sec;if(gt!=null)l=String(gt).replace(Rn,"");else if(P)l=j.basename(String(P).replace(Rn,"").replace(Kr,"/"));else if(wn&&(I==="invoke"||I==="invoke_sync"))l=String(wn).replace(Rn,"").substring(0,30);else if(Lt&&I==="get_progress")l=String(Lt).replace(Rn,"");else if(ne&&I==="await"){let je=parseFloat(String(ne).replace(Rn,""));isNaN(je)?l=String(ne).replace(Rn,""):(je<5&&(je=5),je>120&&(je=180),l=($t=>{if($t>=60){let yo=Math.floor($t/60),Sn=$t%60;return`${yo}m${Sn>0?` ${Sn}s`:""}`}return`${$t}s`})(je))}else if(ne&&I==="wait"){let je=parseFloat(String(ne).replace(Rn,""));isNaN(je)?l=String(ne).replace(Rn,""):(je<10&&(je=10),je>120&&(je=120),l=($t=>{if($t>=60){let yo=Math.floor($t/60),Sn=$t%60;return`${yo}m${Sn>0?` ${Sn}s`:""}`}return`${$t}s`})(je))}else{let je=te.match(el);if(je){let mt=je[1].replace(Rn,"");I==="invoke"||I==="invoke_sync"||I==="get_progress"?l=mt.substring(0,30):l=I==="search_keyword"||I==="file_map"?mt:j.basename(mt.replace(Kr,"/"))}}}let Oe=`${ds[I]||I}${l?` ${l}`:""}`;if((I!==L||l!==Ne)&&(L=I,Ne=l,yield{type:"status",content:`${Oe}`},process.stdout.isTTY)){let P={WebSearch:"Searching",web_search:"Searching",WebScrape:"Reading",web_scrape:"Reading",ReadFile:"Reading",read_file:"Reading",ReadFolder:"Reading",read_folder:"Reading",WriteFile:"Writing",write_file:"Writing",UpdateFile:"Editing",update_file:"Editing",WritePdf:"Creating",write_pdf:"Creating",WriteDocx:"Creating",write_docx:"Creating",SearchKeyword:"Searching",search_keyword:"Searching",CodeSearch:"Searching",code_search:"Searching",FindFile:"Finding File",find_file:"Finding File",Run:"Executing",Ask:"User Input Required",AskUser:"User Input Required",Memory:"Updating Memory",GenerateImage:"Generating",InvokeSync:"Sub-Agent Working",invoke_sync:"Sub-Agent Working",Invoke:"Working",invoke:"Working",GetProgress:"Checking Progress",get_progress:"Checking Progress",Cancel:"Stopping Generalist",cancel:"Stopping Generalist",Await:"Waiting",await:"Waiting",wait:"Waiting",EmergencyRollback:"Rolling the Ball",Answer:"Answering Sub-Agent",answer:"Answering Sub-Agent",Steer:"Steering Sub-Agent",steer:"Steering Sub-Agent",Click:"Clicking",click:"Clicking",Drag:"Dragging",drag:"Dragging",Scroll:"Scrolling",scroll:"Scrolling",KeyboardTyping:"Typing",keyboard_typing:"Typing",KeyPress:"Pressing Key",key_press:"Pressing Key",RecaptureScreen:"Recapturing Screen",recapture_screen:"Recapturing Screen"}[I]||"Working";process.stdout.write(`\x1B]0;${P}...\x07`)}}if(fe.length-eo>800){eo=fe.length;let w=ea(fe,!1),I=cs(w),te=I?(I.innerContent||"").trim():"",l=te.split(/[.!?]\s+/).filter(pe=>pe.trim().length>10),Oe=new Set(l),J=l.length>25?(l.length-Oe.size)/l.length:0,P=te.split(/\s+/).filter(pe=>pe.length>0).length,gt=.9,wn=.92,Lt=!1;if(s.toLowerCase().includes("google")&&(oe||"").toLowerCase().startsWith("gemma")){let c={low:2048,medium:4096,high:32768,max:65536,xhigh:65536}[d?.toLowerCase()]||16e3;Lt=P>c}if(J>gt||Lt){yield{type:"status",content:`${J>gt?"Reasoning Loop Detected":"Thinking Budget Exceeded"}. Re-centering...`},Ot=!0,await new Promise(c=>setTimeout(c,3e3));break}let mt=qr(fe).trim().split(/[.!?]\s+/).filter(pe=>pe.trim().length>10),$t=new Set(mt);if((mt.length>25?(mt.length-$t.size)/mt.length:0)>wn){yield{type:"status",content:"Response Loop Detected. Re-centering..."},Ot=!1,Gt=!0,await new Promise(pe=>setTimeout(pe,3e3));break}let Sn=w.replace(Ya,"").replace(za,"").replace(qa,"").replace(Xa,""),Nt=Sn.toLowerCase().split(/\s+/).map(pe=>pe.replace(Ja,"")).filter(pe=>pe.length>0),kn=!1;if(Nt.length>=40)for(let pe=1;pe<=15;pe++){let c=Math.max(8,Math.ceil(25/pe));if(Nt.length<pe*c)continue;let N=Nt.slice(Nt.length-pe),q=N.join(" ");if(pe>1&&q===N.slice(0,Math.floor(pe/2)).join(" ").repeat(2).trim())continue;let he=!0;for(let le=1;le<c;le++)if(Nt.slice(Nt.length-pe*(le+1),Nt.length-pe*le).join(" ")!==q){he=!1;break}if(he){kn=!0;break}}if(!kn){let pe=Sn.toLowerCase().replace(Qa,"");if(pe.length>=80)for(let c=1;c<=10;c++){let N=Math.max(15,Math.ceil(45/c));if(pe.length<c*N)continue;let q=pe.substring(pe.length-c),he=!0;for(let le=1;le<N;le++)if(pe.substring(pe.length-c*(le+1),pe.length-c*le)!==q){he=!1;break}if(he){kn=!0;break}}}if(kn){yield{type:"status",content:"Stuttering Detected. Re-centering..."},Ot=!1,Wn=!0,await new Promise(pe=>setTimeout(pe,3e3));break}}let z=Bt(fe),ut=fo(z);for(;ut.length>xt;){yield*Hn();let w=ut[xt],I=Date.now(),l={Ask:"ask",AskUser:"ask",WebSearch:"web_search",WebScrape:"web_scrape",ReadFile:"view_file",ReadFolder:"read_folder",FindFile:"find_file",find_file:"find_file",findfile:"find_file",WriteFile:"write_file",PatchFile:"update_file",WritePDF:"write_pdf",WriteDoc:"write_docx",Run:"exec_command",SearchKeyword:"search_keyword",CodeSearch:"search_keyword",code_search:"search_keyword",Code_Search:"search_keyword",codesearch:"search_keyword",Memory:"memory",file_map:"file_map",FileMap:"file_map",Chat:"chat",chat:"chat",GenerateImage:"generate_image",generate_image:"generate_image",todo:"todo",Todo:"todo",goal:"todo",Goal:"todo",Invoke:"invoke",InvokeSync:"invoke_sync",getProgress:"get_progress",GetProgress:"get_progress",Await:"await",await:"await",AwaitSubagent:"await",awaitSubagent:"await",Wait:"wait",wait:"wait",Answer:"answer",answer:"answer",AnswerSubagent:"answer",answerSubagent:"answer",Steer:"steer",steer:"steer",SteerSubagent:"steer",steerSubagent:"steer",Cancel:"cancel",cancel:"cancel",Click:"click",click:"click",Drag:"drag",drag:"drag",Scroll:"scroll",scroll:"scroll",KeyboardTyping:"keyboard_typing",keyboard_typing:"keyboard_typing",KeyPress:"key_press",key_press:"key_press",RecaptureScreen:"recapture_screen",recapture_screen:"recapture_screen",EmergencyRollback:"EmergencyRollback"}[w.toolName]||w.toolName,Oe=ds[l]||w.toolName,J=Jn(l,w.args);yield{type:"status",content:`${Oe}${J?` ${J}`:""}`};let P="";if(l==="click"){let c=H(w.args);P=`\u2714 Clicked ${c.intendedClickText?`: ${c.intendedClickText}`:"Screen"}`}else if(l==="drag"){let c=H(w.args);P=`\u2714 Dragged: Cell ${c.fromGridId||""} \u2192 Cell ${c.toGridId||""}`}else if(l==="scroll"){let c=H(w.args);P=`\u2714 Scrolled: ${c.direction||"down"} (${c.amount||1})`}else if(l==="keyboard_typing"){let c=H(w.args);P=`\u2714 ${c.autoPressEnter?"Entered":"Typed"}: ${c.text?`"${c.text.length>20?c.text.substring(0,20)+"...":c.text}"`:""}`}else if(l==="key_press")P=`\u2714 Pressed Key: ${H(w.args).key||""}`;else if(l==="recapture_screen")P="\u2714 Recaptured Screen";else if(l==="web_search"){let{query:c,limit:N=10,aiMode:q=!1}=H(w.args);P=`${c?"\u2714":"\u2718"} ${q?"AI Search":"Searched"}: ${c?`${c}`:"No Search Query"}${q===!1&&c?` \u2192 ${N}`:""}`}else if(l==="web_scrape"){let c=H(w.args).url||null;P=`${c?"\u2714":"\u2718"} Visited: ${c||"No Source"}`}else if(l==="view_file"){let{path:c,StartLine:N,EndLine:q,start_line:he,end_line:le,startLine:ee,endLine:ye}=H(w.args),be=N||he||ee,Q=q||le||ye,U=parseInt(be)||1,X=parseInt(Q)||(be?U+800:800),Le="...",Ce=X,ie=(c||"").trim().toLowerCase().replaceAll("\\","/");if(ie.startsWith("#skill"))ie.startsWith("#skill/global/fluxflow")||ie.startsWith("#skills/global/fluxflow")||ie.includes("#skill/fluxflow")||ie.includes("#skills/fluxflow")?P="\u2714 Read Documentation":P=`\u2714 Read Skill: ${j.basename(c.replaceAll("\\","/"))}`;else{try{let ge=j.resolve(process.cwd(),c);if(Se.existsSync(ge)){let G=Se.readFileSync(ge,"utf8").split(`
|
|
746
|
+
`).length;Le=G,!be&&!Q&&G>800?Ce=Math.min(50,G):Ce=Math.min(X,G)}}catch{}let Et=(c||"").toLowerCase(),qt=Et.endsWith(".pdf"),Ke=Et.endsWith(".docx")||Et.endsWith(".doc")||Et.endsWith(".ppt")||Et.endsWith(".pptx")||Et.endsWith(".xls")||Et.endsWith(".xlsx"),ze=/\.(png|jpg|jpeg|webp|gif|bmp)$/.test(Et);qt||Ke?P=`${c.length>0?"\u2714":"\u2718"} ${c?`Analyzed: ${j.basename(c)}`:"Analyzed: File Not Found"}`:ze?P=`${c.length>0?"\u2714":"\u2718"} ${c?`Processed: ${j.basename(c)}`:"Processed: File Not Found"}`:P=`${Le!=="..."?"\u2714":"\u2718"} Read: ${c?`${j.basename(c)} \u2192 ${Le!=="..."?`Lines ${U} - ${Ce} of ${Le}`:"File Not Found"}`:"File Not Found"}`}}else if(l==="list_files"||l==="read_folder"){let c=l==="list_files"?"List":"Browsed",N=H(w.args).path||null,q=H(w.args).recurse||1;P=`${N?"\u2714":"\u2718"} ${c}: ${N?`${N==="."?`./${q>1?"*":""}`:`${N.replaceAll("\\","/")}${q>1?`${N.endsWith("/")?"*":"/*"}`:`${N.endsWith("/")?"":"/"}`}`}`:"No Folder Selected"}`}else if(l==="find_file"){let c=H(w.args),N=c.basename||c.name||c.path||c.file||c.query||"";P=`${N?"\u2714":"\u2718"} Located: ${N||"No Query"}`}else if(l==="write_file"||l==="update_file"){let c=l==="write_file"?"Created":"Edited",N=H(w.args),q=N.path||null,le=Object.entries(N).some(([ee,ye])=>ee.startsWith("searchContent")&&typeof ye=="string"&&ye.startsWith("^LINE:"))?"\u1361":":";P=`${q?"\u2714":"\u2718"} ${c}${le} ${q?q.replaceAll("\\","/"):"No File Changes"}`}else if(l==="write_pdf"){let c=H(w.args).path||null;P=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No PDF Generated"}`}else if(l==="write_docx"){let c=H(w.args).path||null;P=`${c?"\u2714":"\u2718"} Generated: ${c.replaceAll("\\","/")||"No Docx Generated"}`}else if(l==="file_map"){let c=H(w.args).path;P=`${c?"\u2714":"\u2718"} Indexed: ${c.replaceAll("\\","/")?""+c:"File Not Found"}`}else if(l.toLowerCase()==="search_keyword"||l.toLowerCase()==="todo")P="";else if(l.toLowerCase()==="generate_image"){let{path:c,outputPath:N,output:q}=H(w.args);P=`\u2714 Generated: ${c||N||q||"generated_image.png"}`}else if(l==="invoke_sync"||l==="InvokeSync"){let c=Jn(l,w.args);P=`\u2714 Called Generalist${c?`: ${c}`:""}`}else if(l==="Invoke"||l==="InvokeAsync"||l==="invoke"){let c=Jn(l,w.args);P=`\u2714 Started Generalist${c?`: ${c}`:""}`}else if(l==="get_progress"||l==="GetProgress"){let c=Jn(l,w.args);P=`\u2714 Checked${c?`: ${c}`:""}`}else if(l==="cancel"){let c=Jn(l,w.args);P=`\u{1F6C7} Cancelled${c?`: ${c}`:""}`}else if(l==="steer"||l==="Steer"){let c=Jn(l,w.args);P=`\u2714 Steered${c?`: ${c}`:""}`}else if(l==="EmergencyRollback"){let{method:c}=H(w.args);P=c==="forceRevert"?"":"\u2714 Rollback Point Checked"}else if(l==="await"||l==="Await"||l==="wait"||l==="Wait"){let{time:c,timeout:N,seconds:q,sec:he}=H(w.args),le=parseFloat(q||he||N||c)||45,ee=l==="wait"||l==="Wait"?120:180;le<10&&(le=10),le>ee&&(le=ee);let ye=U=>{if(U>=60){let X=Math.floor(U/60),Le=U%60;return`${X}m${Le>0?` ${Le}s`:""}`}return`${U}s`},be=["Aligning Moon Phase","Contemplating Existence","Staring At Void","Delaying Professionally","Negotiating With Electrons","Touching Grass (virtually)","Panicking Softly","Rethinking Career Choices","Loading Cat Videos","Summoning Braincell #2","Pretending To Be Busy","Waiting For Motivation DLC","Rotating Internal Screaming","Downloading More RAM","Feeding The Hamsters","Gaslighting Scheduler","Performing Dramatic Pause","Buffering Social Energy","Calculating Regret","Reading Terms And Conditions","Becoming Sentient Briefly","Contacting Ancestors"];P=`\u2714 ${be[Math.floor(Math.random()*be.length)]} \u2192 ${ye(le)}`}else l==="Answer"||l==="answer"?P="\u2714 Resolved Sub-Agent Query":l==="exec_command"||l==="ask"?P="":P=`Executed: ${w.toolName}`;if(yield*Hn(),l==="exec_command"){let{command:c}=H(w.args);if(c&&t.systemSettings&&t.systemSettings.allowExternalAccess===!1){let N=[/[a-zA-Z]:[\\\/]/i,/^\//,/\.\.[\\\/]/,/\/etc\//,/\/var\//,/\/root\//,/\/bin\//,/\/usr\//],q=j.resolve(process.cwd()).substring(0,3).toLowerCase(),he=Q=>{let U=[],X="",Le=null;for(let Ce=0;Ce<Q.length;Ce++){let ie=Q[Ce];Le?(ie===Le&&(Le=null),X+=ie):ie==='"'||ie==="'"?(Le=ie,X+=ie):ie==="&"&&Q[Ce+1]==="&"||ie==="|"&&Q[Ce+1]==="|"?(X.trim()&&(U.push(X.trim()),X=""),Ce++):ie===";"||ie==="|"||ie==="&"?X.trim()&&(U.push(X.trim()),X=""):X+=ie}return X.trim()&&U.push(X.trim()),U},le=Q=>{let U=[],X="",Le=null;for(let Ce=0;Ce<Q.length;Ce++){let ie=Q[Ce];Le?(ie===Le&&(Le=null),X+=ie):ie==='"'||ie==="'"?(Le=ie,X+=ie):/\s/.test(ie)?X&&(U.push(X),X=""):X+=ie}return X&&U.push(X),U},ee=Q=>{let U=Q.replace(/^['"]|['"]$/g,"").trim();return!U||process.platform==="win32"&&/^\/[a-zA-Z0-9?]+$/.test(U)?!1:N.some(X=>{if(X.source==="[a-zA-Z]:[\\\\\\/]"){let Le=U.match(/[a-zA-Z]:[\\\/]/i);return Le&&Le[0].toLowerCase()!==q}return X.test(U)})};if(he(c).some(Q=>{let U=le(Q);if(U.length===0)return!1;let X=U[0].replace(/^['"]|['"]$/g,"").toLowerCase();if(["echo","printf","write-output"].includes(X)){let Ce=!1;return U.some(ie=>{let It=ie.replace(/^['"]|['"]$/g,"");if(It===">"||It===">>"||It==="<")return Ce=!0,!1;if(It.startsWith(">")||It.startsWith("<")){let Et=It.replace(/^[><]+/,"");return ee(Et)}return Ce?(Ce=!1,ee(ie)):!1})}return U.some(Ce=>ee(Ce))})){let Q='Access Denied. Prohibited from accessing external directories while "External Workspace Access" is disabled.';t.onExecStart&&t.onExecStart(c||"No Command"),yield{type:"exec_start"},await new Promise(U=>setTimeout(U,50)),t.onExecChunk&&t.onExecChunk(`ERROR: ${Q}`),await new Promise(U=>setTimeout(U,50)),t.onExecEnd&&t.onExecEnd(),De.push({role:"user",text:`[ACTION RESULT]: ERROR: ${Q}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${Q}`},xt++;continue}}t.onExecStart&&t.onExecStart(c||"No Command"),yield{type:"exec_start"}}let gt=H(w.args),wn=gt.path||gt.targetPath||null;if(wn){let c=t.systemSettings&&t.systemSettings.allowExternalAccess===!1,N=j.resolve(wn),q=j.resolve(process.cwd());if(c&&!N.startsWith(q)){let he="Access Denied. You are not allowed to access files outside the current workspace.";if(l==="write_file"||l==="update_file"){let ee=`\u2718 ${l==="write_file"?"Write Canceled":"Edit Canceled"}: ${gt.path||"..."}`,ye=115;process.stdout.isTTY&&(ye=process.stdout.columns-5||120);let be=Math.min(ee.length+4,ye),Q=`${ee.padEnd(be-2).substring(0,be-2)}`;yield{type:"visual_feedback",content:Ft(`${Ue?`
|
|
747
|
+
`:""}${Q}
|
|
748
|
+
`)},Ue=!1}De.push({role:"user",text:`[ACTION RESULT]: ERROR: ${he}`}),yield{type:"tool_result",content:`[ACTION RESULT]: ERROR: ${he}`},xt++;continue}}if(t.onToolApproval){let c=t.systemSettings||{},N=c.autoExec,q=!1,he="";if(l==="view_file"){let ee=H(w.args);if(he=ee.path||ee.targetPath||ee.file||"",he){let ye=c.alwaysAskFiles||".env, .env.*, *.env";As(he,ye)&&(q=!0)}}if(l==="write_file"||l==="update_file"||l==="exec_command"||q){let ee=null,ye=!1,be=!1,Q=!1;if(q)ye=!0,ee=null;else if(l==="exec_command"){let{command:Ke}=H(w.args),ze=(Ke||"").trim(),ge=(Xt,Ht)=>{if(!Ht)return!1;let nn=Ht.split(",").map(jt=>jt.trim().toLowerCase()).filter(Boolean),Ze=Xt.toLowerCase();return nn.some(jt=>Ze.startsWith(jt))},Ge=ge(ze,c.alwaysAskCommands),G=ge(ze,c.autoApproveCommands);if(be=ge(ze,c.autoDisallowCommands),Ge?ye=!0:(G||c.autoApproveGit&&/^git\s+commit\b/i.test(ze))&&(ee="allow"),!ye&&!ee){if(c.networkAccess===!1){let Ht=ze.trim().replace(/\s+/g," ").replace(/^['"]+|['"]+$/g,"").toLowerCase().split(" "),Ze=Ht[0].split("/").pop().split("\\").pop().replace(/\.exe$/,""),jt=new Set(["curl","wget","httpie","xh","ssh","scp","sftp","rsync","ftp","lftp","tftp","telnet","nc","netcat","socat","ping","traceroute","tracert","dig","nslookup","host","whois","nmap","docker","podman","kubectl","helm","gcloud","aws","az","terraform","ansible-playbook","nix","nix-env","apt","apt-get","dpkg","yum","dnf","pacman","zypper","brew","apk","choco","scoop","conda","mamba","aria2c","axel","smbclient","lynx","w3m","links","elinks","heroku","netlify","vercel","firebase","supabase","wrangler","flyctl","powershell","pwsh","certutil","bitsadmin","cloudflared","ngrok","tailscale","zerotier","rclone"]),et=!1;jt.has(Ze)&&(et=!0);let qe=Pn=>Ht.slice(1).some(Tn=>Pn.includes(Tn)),ot=Pn=>{let Tn=Ht.findIndex(An=>Pn.includes(An)),Kn=Ht.findIndex(An=>["run","exec","test"].includes(An));return Tn!==-1&&!(Kn!==-1&&Kn<Tn)};Ze==="git"&&qe(["clone","pull","push","fetch"])&&(et=!0),Ze==="go"&&qe(["get","install"])&&(et=!0),Ze==="npm"&&ot(["install","i","update","add"])&&(et=!0),Ze==="yarn"&&ot(["add","install","upgrade"])&&(et=!0),Ze==="pnpm"&&ot(["add","install","update"])&&(et=!0),Ze==="bun"&&ot(["add","install","update"])&&(et=!0),Ze==="deno"&&qe(["install","add"])&&(et=!0),Ze==="pip"&&qe(["install","download"])&&(et=!0),Ze==="pip3"&&qe(["install","download"])&&(et=!0),Ze==="cargo"&&qe(["install","add"])&&(et=!0),["bash","sh","zsh","fish"].includes(Ze)&&qe(["-c"])&&(et=!0),Ze==="cmd"&&qe(["/c"])&&(et=!0),et&&(ee="deny",Q=!0)}!ee&&be&&(ee="deny")}!ye&&!ee&&N&&(ee="allow")}else(l==="write_file"||l==="update_file")&&N&&(ee="allow");let U=ee,X="";ee==="deny"&&(Q?X="network":be?X="settings":X="prohibited");let Le=!1,Ce="",ie=[],It=0,Et=!1,qt="";if(!U){if(l==="write_file"||l==="update_file")try{let ge=H(w.args),{path:Ge}=ge;if(Ge){let G=j.resolve(process.cwd(),Ge),Xt=qe=>qe?qe.toLowerCase().replace(/\\/g,"/").replace(/^[a-z]:/,ot=>ot.toUpperCase()):"",Ht=Xt(G),nn="",Ze=!1,jt=await qn(),et=Xt(jt?.file_focused);if(jt&&et===Ht&&jt.full_content?(nn=jt.full_content,Ze=!0):Se.existsSync(G)&&(nn=Se.readFileSync(G,"utf8"),Ze=!0),Ce=nn,await ei.recordFileChange(G,nn),Ze){let qe=nn;if(l==="write_file"){let ot=ge.content||ge.newContent||"";qe=ot.endsWith(`
|
|
747
749
|
`)?ot:ot+`
|
|
748
|
-
`,
|
|
750
|
+
`,qt=qe}else{let{patchPairs:ot,allowMultiple:Pn,error:Tn}=Li(ge);if(Tn){let Jt=`[ACTION RESULT]: ERROR: ${Tn}`;De.push({role:"user",text:Jt}),await Rt("toolFailure"),t.onToolResult&&t.onToolResult("failure",l),yield{type:"tool_result",content:Jt,toolName:l},xt++;continue}let Kn=ge.allowMultiple!==void 0?ge.allowMultiple===!0||String(ge.allowMultiple).toLowerCase()==="true":Pn;It=ot.length;let An=Cs(nn,ot,{allowMultiple:Kn});qe=An.content,qt=qe,ie=An.results;let Yo=ie.filter(Jt=>Jt.success),Ei=ie.filter(Jt=>!Jt.success);if(Yo.length===0){let Jt=`[ACTION RESULT]: ERROR: Failed to apply patches to [${j.basename(G)}].
|
|
749
751
|
${Ei.map(st=>` \u2022 ${st.error}`).join(`
|
|
750
|
-
`)}`,Ci=`\u2714 Edited: ${
|
|
751
|
-
`:""}${it}`)},Ue=!1,De.push({role:"user",text:
|
|
752
|
+
`)}`,Ci=`\u2714 Edited: ${j.basename(G.replaceAll("\\","/"))}`,En=115;process.stdout.isTTY&&(En=process.stdout.columns-5||120);let Vn=Math.min(Ci.length+4,En),it=`${Ci.padEnd(Vn-2).substring(0,Vn-2)}`;yield{type:"visual_feedback",content:Ft(`${Ue?`
|
|
753
|
+
`:""}${it}`)},Ue=!1,De.push({role:"user",text:Jt}),await Rt("toolFailure"),t.onToolResult&&t.onToolResult("failure",l),yield{type:"tool_result",content:Jt,toolName:l},xt++;continue}}yield{type:"status",content:`Opening Diff in IDE: ${j.basename(G)}`},Gi(G,nn,qe),Le=!0,await new Promise(ot=>setTimeout(ot,50))}else if(l==="write_file"){let qe=ge.content||ge.newContent||"",ot=qe.endsWith(`
|
|
752
754
|
`)?qe:qe+`
|
|
753
|
-
`;
|
|
754
|
-
${Ce.split(/\r?\n/).map((st,
|
|
755
|
+
`;qt=ot,Se.existsSync(G)||(Et=!0,Se.mkdirSync(j.dirname(G),{recursive:!0}),Se.writeFileSync(G,"","utf8")),yield{type:"status",content:`Opening New File Diff in IDE: ${j.basename(G)}`},Gi(G,"",ot),Le=!0,await new Promise(Pn=>setTimeout(Pn,50))}}}catch(ge){console.error("Simulation/Diff Error:",ge)}let Ke=null;Wi(ge=>{Ke=ge});let ze=t.onToolApproval;if(U=await new Promise(async ge=>{let Ge=setInterval(()=>{if(Ke){let G=t.onIDEApproval||Uo&&Uo.onIDEApproval;G&&G(Ke),clearInterval(Ge),ge(Ke)}},100);try{let G=await ze(l,w.args);clearInterval(Ge),ge(G)}catch{clearInterval(Ge),ge("deny")}}),Wi(null),l==="write_file"||l==="update_file"){let{path:ge}=H(w.args);if(ge){let Ge=j.resolve(process.cwd(),ge);if(Qs(Ge,U),U==="deny"&&Et&&Se.existsSync(Ge))try{Se.unlinkSync(Ge)}catch{}}}U==="deny"&&(X="user")}if(U==="allow"&&Le&&lo()){let{path:Ke}=H(w.args),ze=j.resolve(process.cwd(),Ke),ge=it=>it?j.resolve(it).replace(/\\/g,"/").toLowerCase():"",Ge=await qn(),G="";if(Ge&&Ge.file_focused&&ge(Ge.file_focused)===ge(ze)&&Ge.full_content&&(G=Ge.full_content),!G&&Se.existsSync(ze)){let it=Se.readFileSync(ze,"utf8");it&&(G=it)}!G&&qt&&(G=qt),(G||Et)&&Se.writeFileSync(ze,G,"utf8");let Xt=G.split(/\r?\n/),Ht=Xt.length,nn=Buffer.byteLength(G,"utf8"),Ze="";Ce&&(Ze=`Old File contents:
|
|
756
|
+
${Ce.split(/\r?\n/).map((st,On)=>`${On+1} | ${st}`).join(`
|
|
755
757
|
`)}
|
|
756
758
|
|
|
757
|
-
`);let
|
|
758
|
-
`);else{let it=
|
|
759
|
-
`),st=
|
|
760
|
-
`);
|
|
759
|
+
`);let jt="";if(Ht<=100)jt=Xt.join(`
|
|
760
|
+
`);else{let it=Xt.slice(0,50).join(`
|
|
761
|
+
`),st=Xt.slice(-50).join(`
|
|
762
|
+
`);jt=`${it}
|
|
761
763
|
|
|
762
|
-
... [${
|
|
764
|
+
... [${Ht-100} lines truncated for history stability] ...
|
|
763
765
|
|
|
764
|
-
${st}`}let et="";if(l==="update_file"){let it=Rs(Ce,
|
|
766
|
+
${st}`}let et="";if(l==="update_file"){let it=Rs(Ce,G,ie,12,t?.compressToolResults||Uo?.systemSettings?.compressToolResults),{patchPairs:st}=Li(H(w.args)),On=st?.length||It||1,Yn=0,ln=0,oo=[];st&&st.length>0?st.forEach((io,Ri)=>{let zo=io.replace||"",on=io.new||"",_i=zo.trim(),bo=on.trim(),wa=!!qt&&G===qt,Sa=bo?G.includes(on)||G.includes(bo):!0,ka=on?Ce.includes(on)||!!bo&&Ce.includes(bo):!1,Ta=_i?G.includes(zo)||G.includes(_i):!1;wa||!!on&&Sa&&(!ka||!Ta||_i===bo)?Yn++:(ln++,oo.push(` \u2022 Block ${Ri+1}: not applied (reverted or rejected in IDE).`))}):Yn=It||0;let Ln=0;if(qt&&G!==qt){let io=Ka("","",qt||"",G||"","","",{context:0});if(io&&io.hunks)for(let Ri of io.hunks){let zo=Ri.lines.filter(on=>on.startsWith("+")).map(on=>on.slice(1).trim()).filter(Boolean);for(let on of zo)Ce.includes(on)||Ln++}}let xo=[`[${Yn}/${On}] applied`];ln>0&&xo.push(`${ln} rejected by user`),Ln>0&&xo.push(`${Ln} manual ${Ln===1?"modification":"modifications"} by user`);let xa=xo.join(", "),ba=oo.length>0?`
|
|
765
767
|
|
|
766
768
|
User Review Details:
|
|
767
769
|
${oo.join(`
|
|
768
770
|
`)}`:"";et=`File [${Ke}] updated via IDE Companion. ${xa}.${ba}
|
|
769
771
|
|
|
770
|
-
${it}`}else{let it=
|
|
772
|
+
${it}`}else{let it=G.split(/\r?\n/),st=it.length,On=Buffer.byteLength(G,"utf8"),Yn="";Ce&&(Yn=`Old File contents:
|
|
771
773
|
${Ce.split(/\r?\n/).map((Ln,xo)=>`${xo+1} | ${Ln}`).join(`
|
|
772
774
|
`)}
|
|
773
775
|
|
|
@@ -779,87 +781,87 @@ ${Ce.split(/\r?\n/).map((Ln,xo)=>`${xo+1} | ${Ln}`).join(`
|
|
|
779
781
|
... [${st-100} lines truncated] ...
|
|
780
782
|
|
|
781
783
|
${Ln}`}et=`File [${Ke}] saved via IDE Companion (May have user edits).
|
|
782
|
-
- Stats: [${st} lines, ${(
|
|
784
|
+
- Stats: [${st} lines, ${(On/1024).toFixed(1)} KB]
|
|
783
785
|
${Yn}- Content Preview:
|
|
784
786
|
|
|
785
|
-
${ln}`}let qe=l==="write_file"?"Created":"Edited",ot=
|
|
786
|
-
`:""}${Ei}`)},Ue=!1;let
|
|
787
|
-
`));let Vn;if(En.startsWith("[[SAME]]")){let st=En.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),
|
|
787
|
+
${ln}`}let qe=l==="write_file"?"Created":"Edited",ot=H(w.args),Tn=Object.entries(ot).some(([it,st])=>it.startsWith("searchContent")&&typeof st=="string"&&st.startsWith("^LINE:"))?"\u1361":":",Kn=`${Ke?"\u2714":"\u2718"} ${qe}${Tn} ${Ke?Ke.replaceAll("\\","/"):"No File Changes"}`,An=115;process.stdout.isTTY&&(An=process.stdout.columns-5||120);let Yo=Math.min(Kn.length+4,An),Ei=`${Kn.padEnd(Yo-2).substring(0,Yo-2)}`;yield{type:"visual_feedback",content:Ft(`${Ue?`
|
|
788
|
+
`:""}${Ei}`)},Ue=!1;let Jt=Date.now();Zt=Jt,yield{type:"tool_time",content:Jt-I};let En=(et||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");En.includes("[[VERIFIED]]")&&(En=En.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to conserve context.
|
|
789
|
+
`));let Vn;if(En.startsWith("[[SAME]]")){let st=En.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),On=st.filter(ln=>ln.startsWith("File ")||ln.trim().startsWith("- Stats:"));Vn=`[ACTION RESULT]: ${On.length>0?On.join(`
|
|
788
790
|
`):st.slice(0,2).join(`
|
|
789
791
|
`)}
|
|
790
|
-
[SYSTEM NOTE]: Content verified and persisted to disk. Full preview omitted to conserve context.`}else Vn=`[ACTION RESULT]: ${En}`;De.push({role:"user",text:Vn}),xn=!0,await Rt("toolSuccess"),t.onToolResult&&t.onToolResult("success",l),yield{type:"tool_result",content:et,aiContent:Vn,toolName:l},xt++;continue}if(
|
|
791
|
-
`:""}${
|
|
792
|
-
`)},Ue=!1}else if(l==="write_file"||l==="update_file"){let ge=`\u2718 ${l==="write_file"?"Write Cancelled":"Edit Denied"}: ${
|
|
793
|
-
`:""}${
|
|
794
|
-
`)},Ue=!1}l==="exec_command"&&(await new Promise(ze=>setTimeout(ze,50)),t.onExecChunk&&t.onExecChunk(`ERROR: ${Ke}`),await new Promise(ze=>setTimeout(ze,50)),t.onExecEnd&&t.onExecEnd()),De.push({role:"user",text:`[ACTION RESULT]: DENIED: ${Ke}`}),yield{type:"tool_result",content:`[ACTION RESULT]: DENIED: ${Ke}`},await Rt("toolDenied"),t.onToolResult&&t.onToolResult("denied",l),xt++;continue}}}if(
|
|
795
|
-
`:""}${le}${
|
|
796
|
-
`}`}`)},Ue=!1}if(
|
|
792
|
+
[SYSTEM NOTE]: Content verified and persisted to disk. Full preview omitted to conserve context.`}else Vn=`[ACTION RESULT]: ${En}`;De.push({role:"user",text:Vn}),xn=!0,await Rt("toolSuccess"),t.onToolResult&&t.onToolResult("success",l),yield{type:"tool_result",content:et,aiContent:Vn,toolName:l},xt++;continue}if(U==="deny"){let Ke=`Permission Denied: Prohibited ${l==="exec_command"?"Command":"file edit"}.`;if(q?Ke=`User denied reading ${j.basename(he||".env")}`:X==="user"?Ke="Permission Denied by User":X==="settings"?Ke="Permission Denied by User Policy":X==="network"?Ke="Permission Denied: Sandbox Network Access Disabled by User Policy.":X==="prohibited"&&l==="exec_command"&&(Ke="Permission Denied: Prohibited Command in User Policy"),l==="view_file"){let ze=`\u2718 Read Denied: ${H(w.args).path?.replaceAll("\\","/")||".env"}`,ge=115;process.stdout.isTTY&&(ge=process.stdout.columns-5||120);let Ge=Math.min(ze.length+4,ge),G=`${ze.padEnd(Ge-2).substring(0,Ge-2)}`;yield{type:"visual_feedback",content:Ft(`${Ue?`
|
|
793
|
+
`:""}${G}
|
|
794
|
+
`)},Ue=!1}else if(l==="write_file"||l==="update_file"){let ge=`\u2718 ${l==="write_file"?"Write Cancelled":"Edit Denied"}: ${H(w.args).path.replaceAll("\\","/")||"..."}`,Ge=115;process.stdout.isTTY&&(Ge=process.stdout.columns-5||120);let G=Math.min(ge.length+4,Ge),Xt=`${ge.padEnd(G-2).substring(0,G-2)}`,Ht=` ${" ".repeat(G)} `;yield{type:"visual_feedback",content:Ft(`${Ue?`
|
|
795
|
+
`:""}${Xt}
|
|
796
|
+
`)},Ue=!1}l==="exec_command"&&(await new Promise(ze=>setTimeout(ze,50)),t.onExecChunk&&t.onExecChunk(`ERROR: ${Ke}`),await new Promise(ze=>setTimeout(ze,50)),t.onExecEnd&&t.onExecEnd()),De.push({role:"user",text:`[ACTION RESULT]: DENIED: ${Ke}`}),yield{type:"tool_result",content:`[ACTION RESULT]: DENIED: ${Ke}`},await Rt("toolDenied"),t.onToolResult&&t.onToolResult("denied",l),xt++;continue}}}if(P){let c=115;process.stdout.isTTY&&(c=process.stdout.columns-5||120);let N=await i(),q=!1;N&&(q=N.trim().length>0);let he=Math.min(P.length+4,c),le=`${P.padEnd(he-2).substring(0,he-2)}`;yield{type:"visual_feedback",content:Ft(`${Ue?`
|
|
797
|
+
`:""}${le}${P.includes("\u2714")&&(P.includes("Created")||P.includes("Edited"))?"":`${q?"":`
|
|
798
|
+
`}`}`)},Ue=!1}if(Zt>0){let c=Date.now()-Zt,N=Math.max(0,1e3-c);N>0&&await new Promise(q=>setTimeout(q,N))}let Lt={chatId:p,history:n,onChunk:c=>t.onExecChunk?t.onExecChunk(c):null,onAskUser:t.onAskUser,systemSettings:t.systemSettings,mode:a,isMultiModal:rt(oe),onVisualFeedback:t.onVisualFeedback,onSubagentUpdate:t.onSubagentUpdate,onTokenChunk:t.onTokenChunk,modelName:oe,aiProvider:t.aiProvider,apiKey:t.apiKey,onUsage:t.onUsage};if(l==="write_file"||l==="update_file")try{let{path:c}=H(w.args);if(c){let N=j.resolve(process.cwd(),c),q=await qn();q&&q.file_focused===N&&q.full_content&&(Lt.forcedContent=q.full_content)}}catch{}Xe.push(l);let ne=await No(l,w.args,Lt);if((l==="write_file"||l==="update_file")&&!ne.startsWith("ERROR:")){let{path:c}=H(w.args);if(c){let N=j.resolve(process.cwd(),c);Js(N)}}process.stdout.isTTY&&process.stdout.write("\x1B]0;Working...\x07");let je=Date.now();Zt=je,yield{type:"tool_time",content:je-I},dt=je;let mt=null;if(typeof ne=="object"&&ne.binaryPart&&(mt=ne.binaryPart,ne=ne.text),l==="search_keyword"){let{keyword:c,path:N}=H(w.args),q=typeof ne=="string"&&ne.startsWith("[GLOB]");q&&(ne=ne.slice(6).trimStart());let he=typeof ne=="string"&&ne.startsWith("[DIR]");he&&(ne=ne.slice(5).trimStart());let le=0;if(ne){let ie=ne.match(/Found (\d+) match/i);ie&&(le=parseInt(ie[1]))}let ee=(N||"").trim().toLowerCase().replaceAll("\\","/"),ye=ee==="#doc"||ee==="#docs"||ee==="#documentation"||ee.includes("#skill/global/fluxflow")||ee.includes("#skill/fluxflow")||ee.includes("#skills/fluxflow")||ee.includes("#skills/global/fluxflow"),be,Q=115;process.stdout.isTTY&&(Q=process.stdout.columns-5||120);let U=Math.max(10,(Q+5)/3),X=Math.max(10,(Q+5)/4);if(ye)be=`${c?"\u2714":"\u2718"} Searched Documentation`;else{let ie=N?N.replace(/[\/\\]+$/,""):null,It=ie&&ie!=="."?`${q?N:he?`${ie}/*`:ie}`:"./",Et=It.length>X?`${It.slice(0,X)}...`:It;be=`${c?"\u2714":"\u2718"} Searched: "${c?c.length>Q/3?`${c.slice(0,U)}...`:c:""}" in "${Et.replaceAll("\\","/")}" \u2192 ${le} Match${le===1?"":"es"}`}let Le=Math.min(be.length+4,Q),Ce=`${be.padEnd(Le-2).substring(0,Le-2)}`;yield{type:"visual_feedback",content:Ft(`${Ue?`
|
|
797
799
|
`:""}${Ce}
|
|
798
|
-
`)},Ue=!1}if(l==="EmergencyRollback"){let{method:c}=
|
|
799
|
-
`:""}${
|
|
800
|
-
`}`)},Ue=!1}}if(l==="todo"){let{method:c,tasks
|
|
801
|
-
`)}return
|
|
800
|
+
`)},Ue=!1}if(l==="EmergencyRollback"){let{method:c}=H(w.args);if(c==="forceRevert"){let N=0;if(ne){let U=ne.match(/Total\s*:\s*(\d+)/i);U&&(N=parseInt(U[1]))}let he=ne&&ne.startsWith("ERROR:")?"\u2718 Emergency Rollback Failed":`\u2714 Emergency Rollback \u2192 ${N} file${N===1?"":"s"} processed`,le=115;process.stdout.isTTY&&(le=process.stdout.columns-5||120);let ee=await i(),ye=!1;ee&&(ye=ee.trim().length>0);let be=Math.min(he.length+4,le),Q=`${he.padEnd(be-2).substring(0,be-2)}`;yield{type:"visual_feedback",content:Ft(`${Ue?`
|
|
801
|
+
`:""}${Q}${ye?"":`
|
|
802
|
+
`}`)},Ue=!1}}if(l==="todo"){let{method:c,tasks:N,markDone:q}=H(w.args),he="",le=[],ee=ye=>{if(!ye)return[];let be=Array.isArray(ye)?ye:[];if(be.length===0&&typeof ye=="string"){let Q=ye.trim();if(Q.startsWith("[")&&Q.endsWith("]")){let U=Q.match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/g);U?be=U.map(X=>X.slice(1,-1).replace(/\\(.)/g,"$1")):be=Q.slice(1,-1).split(",").map(X=>X.trim()).filter(Boolean)}else be=ye.split(`
|
|
803
|
+
`)}return be.filter(Q=>String(Q).trim()).map(Q=>{let U=String(Q).trim();return U.startsWith("- [")?U.substring(6).trim():U})};if(c==="create"?(he="\x1B[32m\u2192\x1B[0m Created Goals",le=ee(N).map(ye=>`\x1B[90m\u25CB\x1B[0m ${ye}`)):c==="append"?(he="\x1B[34m\u2795\x1B[0m Added New Goals",le=ee(N).map(ye=>`\x1B[90m\u25CB\x1B[0m ${ye}`)):c==="get"&&(he=q?"\x1B[36m\u21BB\x1B[0m Updated Goals":"\x1B[35m\u2022\x1B[0m Reviewed Goals",le=(ne||"").split(`
|
|
802
804
|
`).slice(1).join(`
|
|
803
805
|
`).split(`
|
|
804
|
-
`).filter(
|
|
805
|
-
`),
|
|
806
|
-
`:""}${ye}${
|
|
807
|
-
`}`)},Ue=!1}}l==="exec_command"&&t.onExecEnd&&(await new Promise(c=>setTimeout(c,800)),t.onExecEnd());let
|
|
808
|
-
`));let kn;if(
|
|
809
|
-
`)
|
|
806
|
+
`).filter(be=>be.trim().startsWith("- [")).map(be=>{let Q=be.trim(),U=Q.startsWith("- [x]");return`${U?"\x1B[32m\u2714\x1B[0m":"\x1B[90m\u25CB\x1B[0m"} ${U?"\x1B[90m":"\x1B[37m"}${Q.substring(6).trim()}\x1B[0m`})),he&&le.length>0){let ye=[`${he}`,...le.map(U=>` ${U}`)].join(`
|
|
807
|
+
`),be=await i(),Q=!1;be&&(Q=be.trim().length>0),yield{type:"visual_feedback",content:Ft(`${Ue?`
|
|
808
|
+
`:""}${ye}${Q?"":`
|
|
809
|
+
`}`)},Ue=!1}}l==="exec_command"&&t.onExecEnd&&(await new Promise(c=>setTimeout(c,800)),t.onExecEnd());let $t=ne&&ne.startsWith("DENIED:");ne&&!ne.startsWith("ERROR:")&&!$t?(await Rt("toolSuccess"),t.onToolResult&&t.onToolResult("success",l)):$t||(await Rt("toolFailure"),t.onToolResult&&t.onToolResult("failure",l));let Nt=(ne||"").toString().replaceAll("\u2550".repeat(88),"=".repeat(35)).replaceAll("[UI_CONTEXT]","");Nt.includes("[[VERIFIED]]")&&(Nt=Nt.replace(/\[\[VERIFIED\]\][\s\S]*?\[\[\/VERIFIED\]\]/g,`[SYSTEM NOTE]: Patch Block matched & applied successfully. Large Block omitted to save tokens.
|
|
810
|
+
`));let kn;if(Nt.startsWith("[[SAME]]")){let N=Nt.replace(/^\[\[SAME\]\]\s*\r?\n?/,"").split(/\r?\n/),q=N.filter(le=>le.startsWith("File ")||le.trim().startsWith("- Stats:"));kn=`[ACTION RESULT]: ${q.length>0?q.join(`
|
|
811
|
+
`):N.slice(0,2).join(`
|
|
810
812
|
`)}
|
|
811
|
-
[SYSTEM NOTE]: Content verified and persisted to disk. Full preview omitted to save tokens.`}else kn=`[ACTION RESULT]: ${
|
|
813
|
+
[SYSTEM NOTE]: Content verified and persisted to disk. Full preview omitted to save tokens.`}else kn=`[ACTION RESULT]: ${Nt}`;De.push({role:"user",text:kn,binaryPart:mt}),xn=!0;let pe=`[ACTION RESULT]: ${ne.replaceAll(`[[VERIFIED]]
|
|
812
814
|
`,"").replaceAll(`
|
|
813
|
-
[[/VERIFIED]]`,"")||""}`;(l==="view_file"||l==="web_scrape"||l==="file_map")&&(pe=`[ACTION RESULT]: ${
|
|
815
|
+
[[/VERIFIED]]`,"")||""}`;(l==="view_file"||l==="web_scrape"||l==="file_map")&&(pe=`[ACTION RESULT]: ${P} (Context Locked for UI Clarity)`),yield{type:"tool_result",content:pe,aiContent:kn,binaryPart:mt,toolName:l},l==="memory"&&!ne.startsWith("ERROR:")&&(yield{type:"memory_updated"}),xt++}if(s==="Google"&&tn&&Date.now()-Ti>=150){yield*Hn();let w=po(tn);for(let I of w)yield I;tn="",Ti=Date.now()}}h.usageMetadata&&(Qt=h.usageMetadata),Qt&&(yield{type:"liveTokens",content:Qt.totalTokenCount})}if(V&&(V=!1,nt?_e+="</think_fluxflow>":(fe+="</think_fluxflow>",s==="Google"?tn+="</think_fluxflow>":yield{type:"text",content:"</think_fluxflow>"})),nt&&_e.length>0){let h=0,R=Math.min(bt.length,_e.length);for(let Z=R;Z>0;Z--)if(bt.endsWith(_e.substring(0,Z))){h=Z;break}let v=_e.substring(h);if(v){let se=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(bt)?v.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):v.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");if(se)if(fe+=se,s==="Google")tn+=se;else{yield*Hn();let B=po(se);for(let z of B)yield z}}nt=!1,_e=""}if(bn){let h=bn,R=(ft==="tool"||ft==="action")&&(h.startsWith("[tool:")||h.startsWith("[action:"));bn="",to=!1,ft=null,jn=!1,no=!1,R||(s==="Google"?tn+=h:yield{type:"text",content:h})}if(yield*Hn(),ht)break;let ho=(fe||"").trim(),ua=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(ho.toLowerCase())||/\[\[END\]\]/i.test(ho.toLowerCase()),ga=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(ho.toLowerCase()),ma=De.length>0||L!==null,Ai=Bt(ho).trim(),pa=/(\p{Emoji_Presentation}|\p{Extended_Pictographic})$/u.test(Ai),ha=/([.!?"'*_`|\]\)”’~~]+|\s|`{3}|[\u200B-\u200D\uFEFF])$/u.test(Ai.trim()),ya=/[.!?}"'`’“”]$|```$/s.test(Ai)||ha||pa;!ua&&!ga&&!ma&&ho.length>0,Je=!0,await Rt("agent",s)}catch(Y){if(ht){yield{type:"status",content:"Request Cancelled"},yield{type:"text",content:`
|
|
814
816
|
|
|
815
|
-
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(String(
|
|
817
|
+
\x1B[33m\u24D8 Request Cancelled\x1B[0m`};break}if(String(Y).includes("Incomplete JSON segment at the end")){V&&(V=!1,nt?_e+="</think_fluxflow>":(fe+="</think_fluxflow>",yield{type:"text",content:"</think_fluxflow>"})),Je=!0,await Rt("agent",s);break}if(V&&(V=!1,nt?_e+="</think_fluxflow>":fe+="</think_fluxflow>"),nt&&_e.length>0){let St=0,Tt=Math.min(bt.length,_e.length);for(let zt=Tt;zt>0;zt--)if(bt.endsWith(_e.substring(0,zt))){St=zt;break}let kt=_e.substring(St);if(kt){let In=/(?:<think_fluxflow>|\[think_fluxflow\])(?:(?!(?:<\/think_fluxflow>|\[\/think_fluxflow\]))[\s\S])*$/i.test(bt)?kt.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,""):kt.replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\])\s*/gi,"").replace(/^\s*(?:<think_fluxflow>|\[think_fluxflow\])\s*/gi,"");In&&(fe+=In)}nt=!1,_e=""}let $=Y instanceof Error?(()=>{try{return JSON.parse(JSON.parse(Y.message).error.message).error.message}catch{return String(Y)}})():String(Y),at=new Date().toLocaleString(),Pe=j.join(Cn,"agent");Se.existsSync(Pe)||Se.mkdirSync(Pe,{recursive:!0}),Se.appendFileSync(j.join(Pe,"error.log"),`ERROR [${at}]: ${$}
|
|
816
818
|
|
|
817
819
|
----------------------------------------------------------------------
|
|
818
820
|
|
|
819
|
-
`);let Ye=
|
|
821
|
+
`);let Ye=Y.status||Y.statusCode||Y.code,wt=String(Y).includes("replicas at capacity");if(!(Ye&&(Ye>=500&&Ye<600||Ye===408||Ye===429||wt)||!Ye&&(/status[ :]+(5\d\d|408|429)/i.test(String(Y))||/code[ :]+(5\d\d|408|429)/i.test(String(Y))||/(500|503|408|429)/.test(String(Y))))){if(Ve<an-3)throw Y;yield{type:"text",content:$},yield{type:"status",content:"Error Occured"}}if(fe.trim().length>0||Qe>1)if(Qe<=an){Qe++;let St=Math.min(1e3*Math.pow(2,Qe-1),24e3);if(fe.trim().length>0){b.push({role:"agent",text:fe});let Tt=`[system]
|
|
820
822
|
- seamless continuation: resume immediately. pick up from last words with zero gap/disruption
|
|
821
823
|
- no repetition: do not repeat any text already written
|
|
822
824
|
- 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
|
|
823
825
|
- mid-tool safety: if cutoff was mid-tool call, restart that tool call from start
|
|
824
|
-
- stealth: do not mention/apologize for cutoff [/system]`;De.length>0?De.forEach((kt,
|
|
826
|
+
- stealth: do not mention/apologize for cutoff [/system]`;De.length>0?De.forEach((kt,zt)=>{zt===De.length-1?b.push({...kt,text:`${kt.text}
|
|
825
827
|
|
|
826
828
|
${Tt}`}):b.push(kt)}):b.push({role:"user",text:Tt}),bt+=fe}for(let Tt=St/1e3;Tt>0&&!ht;Tt--)yield{type:"status",content:`Error Occured. Recovering Stream (${Qe}/${an}) [Retrying in ${Tt.toFixed(0)}s]...`},await new Promise(kt=>setTimeout(kt,1e3));yield{type:"status",content:"Error Occured. Recovering Stream..."}}else throw new Error(`Stream collapsed too many times. (Failed to resolve ${an} times)
|
|
827
|
-
Error log can be found in \`/export logs\``);else if(Ve<=an){Ve++,Qe=1,bt="";let St=Math.min(1e3*Math.pow(2,Ve-1),32e3),Tt=.8+Math.random()*.4,kt=Math.round(St*Tt);vn=!0,yield{type:"status",content:`Trying to reach ${e} (${Ve}/${an}) [Retrying in ${(kt/1e3).toFixed(0)}s]`};for(let
|
|
828
|
-
Error log can be found in \`/export logs\``)}}if(
|
|
829
|
-
`),
|
|
829
|
+
Error log can be found in \`/export logs\``);else if(Ve<=an){Ve++,Qe=1,bt="";let St=Math.min(1e3*Math.pow(2,Ve-1),32e3),Tt=.8+Math.random()*.4,kt=Math.round(St*Tt);vn=!0,yield{type:"status",content:`Trying to reach ${e} (${Ve}/${an}) [Retrying in ${(kt/1e3).toFixed(0)}s]`};for(let zt=kt/1e3;zt>0&&!ht;zt--)yield{type:"status",content:`Trying to reach ${e} (${Ve}/${an}) [Retrying in ${zt.toFixed(0)}s]`},await new Promise(In=>setTimeout(In,1e3));yield{type:"status",content:`Trying to reach ${e}`}}else throw new Error(`Model ${e} cannot be reached. (Failed ${an} times)
|
|
830
|
+
Error log can be found in \`/export logs\``)}}if(Qt){let V=Qt.totalTokenCount||0,Y=Qt.cachedContentTokenCount||0,$=(Qt.candidatesTokenCount||0)+(s==="Google"&&Qt.thoughtsTokenCount||0);await pt("tokens",V,s,oe),Y>0&&await pt("cachedTokens",Y,s,oe),$>0&&await pt("candidateTokens",$,s,oe),Ee!==null&&Ee>0&&await pt("ttft",Ee,s,oe),To({provider:s,model:oe,prompt:Qt.promptTokenCount||0,cached:Y,output:$,reasoning:Qt.thoughtsTokenCount||0,ttft:Ee}),yield{type:"usage",content:Qt}}else Ee!==null&&Ee>0&&(await pt("ttft",Ee,s,oe),To({provider:s,model:oe,prompt:0,cached:0,output:0,reasoning:0,ttft:Ee}));fe=Qr(fe),Si.push(fe);let hl=Bt(fe),ki=qr(fe),aa=/\[\s*(turn\s*:)?\s*finish\s*\]/i.test(ki.toLowerCase())||/\[\[END\]\]/i.test(ki.toLowerCase())||!0,yl=/\[\s*(turn\s*:)?\s*continue\s*\]/i.test(ki.toLowerCase()),xl=xt>0;yield{type:"status",content:process.env.HALLOWEEN_EEGG==="true"?"Performing dark ritual":"Thinking"};let la=ul(fe,/(\[\s*(turn\s*:)?\s*(continue|finish)\s*\]|\[\[END\]\])/gi,"").trim(),Gn=(aa||De.length===0)&&!Ot&&!Wn&&!Gt;if(Gn=De.length===0?Gn:!1,Gn=Yt||Ko?!1:Gn,fe&&fe.trim().endsWith('")]')&&De.length===0&&(Gn=!1),Gn){ws=!0;let V=Si.join(`
|
|
831
|
+
`),Y=Bt(V).trim();yield{type:"interactive_turn_finished",data:{agentText:ve,fullAgentTextRaw:V,history:[...b],needTitle:ke}},b.length>0&&b[b.length-1].role==="agent"?b[b.length-1].text=Y:b.push({role:"agent",text:Y}),b.forEach($=>{if($.role==="user"&&$.text&&($.text=$.text.replace(/\n\[COMPILE ERROR\][\s\S]*?\[\/ERROR\]/g,""),$.text=$.text.replaceAll(`
|
|
830
832
|
|
|
831
833
|
[system] user question. resolve this specific query within '[ANSWER] ... [/ANSWER]' concisely, naturally [/system]
|
|
832
834
|
`,"").replaceAll(`[system] user question. resolve this specific query within '[ANSWER] ... [/ANSWER]' concisely, naturally
|
|
833
835
|
**strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]
|
|
834
836
|
`,"").replaceAll(`[system] **strictly follow thinking policy as high priority. do not start a response without <think_fluxflow>...</think_fluxflow>** [/system]
|
|
835
|
-
`,"").replaceAll(/\n\[system\] WARNING, Turn Limit Impending: Step \d+\/\d+\. Wrap up quickly\/prompt user to continue & use \[\[END\]\] quickly\. \[\/system\]/g,"")
|
|
837
|
+
`,"").replaceAll(/\n\[system\] WARNING, Turn Limit Impending: Step \d+\/\d+\. Wrap up quickly\/prompt user to continue & use \[\[END\]\] quickly\. \[\/system\]/g,""),$.text=$.text.replaceAll(/\n\[system\] File Changes:\n(?:\* .+ \(created|modified|deleted\)\n)*\[\/system\]/g,""),(s==="Mistral"||s==="Google"&&e?.toLowerCase().startsWith("gemma"))&&($.text.startsWith("[ACTION RESULT]")||$.text.startsWith("[TOOL RESULT]")))){let Pe=`
|
|
836
838
|
[system] Action result received. Analyze output and proceed with your turn [/system]`,Ye=`
|
|
837
|
-
[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]
|
|
839
|
+
[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]`;$.text=$.text.replaceAll(Ye,"").replaceAll(Pe,"").trim()}}),yield{type:"status",content:"[end]"}}if(Gn)break;let ca=la.trim()||"*Working...*";if(b.push({role:"agent",text:ca}),De.length>0||xn){if(De.length>0){let V=De.map(wt=>wt.text).join(`
|
|
838
840
|
|
|
839
|
-
`)
|
|
841
|
+
`),$=Bt(fe).replace(/\[{1,2}(?:tool|action):[\s\S]*?\)\s*\]{1,2}/gi,""),at=($.match(/\[(?:tool|action):/gi)||[]).length,Pe=De.length+at;if(De.length<Pe){let wt=Xr($);V+=`
|
|
840
842
|
|
|
841
843
|
[system] Only ${De.length} out of ${Pe} attempted tool calls were executed.
|
|
842
844
|
${wt?`Parsing Issues Detected:
|
|
843
845
|
${wt}
|
|
844
|
-
`:""}Verify proper structure compliance [action:ActionName(arg="value")] & try failed calls again [/system]`;let Fe=Pe-De.length;for(let St=0;St<Fe;St++)await Rt("toolFailure")}let Ye=De.find(wt=>wt.binaryPart)?.binaryPart||null;b.push({role:"user",text:
|
|
845
|
-
${
|
|
846
|
-
${
|
|
846
|
+
`:""}Verify proper structure compliance [action:ActionName(arg="value")] & try failed calls again [/system]`;let Fe=Pe-De.length;for(let St=0;St<Fe;St++)await Rt("toolFailure")}let Ye=De.find(wt=>wt.binaryPart)?.binaryPart||null;b.push({role:"user",text:V,binaryPart:Ye})}}else if(!ht){let V=fe.replace(/(?:<think_fluxflow>|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|\[\/think_fluxflow\]|$)/i,""),Y=(V.match(/\[(?:tool|action):/gi)||[]).length;if(Ko||Yt||Y>0){let $=Xr(V),at=$?`[system] Failed to execute ${Y>0?Y:1} tool call${Y>1?"s":""} due to syntax/structure issues:
|
|
847
|
+
${$} [/system]`:`[system] Failed to execute ${Y>0?Y:1} tool${Y>1?"s":""}. Verify proper structure compliance [action:ActionName(arg="value")] & try again [/system]`;b.push({role:"user",text:at}),await Rt("toolFailure"),yield{type:"visual_feedback",content:`
|
|
848
|
+
${Ft("\u2718 Model produced malformed tool call")}
|
|
847
849
|
`}}else yield{type:"visual_feedback",content:`
|
|
848
|
-
${
|
|
849
|
-
`},b.push({role:"user",text:`[system] ${Wn&&!Ot?"Stuttering Detected by Internal System. Re-calibrate your response & proceed.":`${Ot?" Over Thinking":" Loop"} Detected by Internal System${Ot?" for current Effort Level":""}. ${Ot?"If you have planned the task, prioritize execution/output":"If you have finished your task provide a simple summary and end"}`} [/system]`});Ot=!1,Wn=!1,
|
|
850
|
+
${Ft("\u2718 Loop Detected")}
|
|
851
|
+
`},b.push({role:"user",text:`[system] ${Wn&&!Ot?"Stuttering Detected by Internal System. Re-calibrate your response & proceed.":`${Ot?" Over Thinking":" Loop"} Detected by Internal System${Ot?" for current Effort Level":""}. ${Ot?"If you have planned the task, prioritize execution/output":"If you have finished your task provide a simple summary and end"}`} [/system]`});Ot=!1,Wn=!1,Gt=!1}m?.advanceRollback&&await Ao.recordTurnDelta(p,O+1,Xe),Ko=xt>0||xn}if(!ws&&!ht){let O="\u2726 Turn safety limit reached. Stopping execution.";yield{type:"text",content:`
|
|
850
852
|
|
|
851
853
|
${O}
|
|
852
854
|
`};let Be=(Si.join(`
|
|
853
855
|
`)+`
|
|
854
|
-
${O}`).trim();yield{type:"interactive_turn_finished",data:{agentText:
|
|
856
|
+
${O}`).trim();yield{type:"interactive_turn_finished",data:{agentText:ve,fullAgentTextRaw:Be,history:[...b],needTitle:ke}},yield{type:"status",content:"[end]"}}}catch(k){let b=k?.cause?` (Cause: ${k.cause?.message||String(k.cause)})`:"",$e=(k instanceof Error?(()=>{try{return JSON.parse(JSON.parse(k.message).error.message).error.message}catch{return(k.message?`${k.message}${b}`:"")||String(k)}})():String(k)).replace(/^(Error:\s*)+/i,"");s==="Google"&&!/^[A-Z0-9_\-\s]+ ERROR:/i.test($e)&&($e=`GEMINI ERROR: ${$e}`);let Mt=new Date().toLocaleString(),un=j.join(Cn,"agent");yield{type:"text",content:`
|
|
855
857
|
|
|
856
|
-
\u2726 CRITICAL ERROR: ${
|
|
857
|
-
\u2800`},
|
|
858
|
+
\u2726 CRITICAL ERROR: ${$e.includes("fetch failed")?"Failed to Connect. Check your Internet Connection or Wait a moment":$e}
|
|
859
|
+
\u2800`},Se.existsSync(un)||Se.mkdirSync(un,{recursive:!0}),Se.appendFileSync(j.join(un,"error.log"),`CRITICAL ERROR [${Mt}]: ${k}${k?.cause?`
|
|
858
860
|
CAUSE: ${k.cause?.stack||k.cause}`:""}
|
|
859
861
|
|
|
860
862
|
----------------------------------------------------------------------
|
|
861
863
|
|
|
862
|
-
`),typeof flushGoogleBuffer=="function"&&(yield*flushGoogleBuffer()),yield{type:"tool_result",content:`ERROR: [INTERNAL CRITICAL] ${
|
|
864
|
+
`),typeof flushGoogleBuffer=="function"&&(yield*flushGoogleBuffer()),yield{type:"tool_result",content:`ERROR: [INTERNAL CRITICAL] ${$e}`}}finally{we&&(clearInterval(we),we=null),typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),await ei.commitTransaction(),m?.advanceRollback&&await Ao.cleanup(p),await qn()}yield{type:"status",content:null}},Pd=async(e,n,t=null,i=null,o=50,r=null,d=!1)=>{let a=await ko(),u={...a,...n},p=process.env.SUBAGENT_MODEL?process.env.SUBAGENT_MODEL.trim():null,x=process.env.SUBAGENT_PROVIDER?process.env.SUBAGENT_PROVIDER.trim():null,m=new Date,f=`${m.getFullYear()}-${m.toLocaleString("en-US",{month:"short"}).toUpperCase()}-${String(m.getDate()).padStart(2,"0")}, ${m.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!0}).replace(":","-")}`,g=(we=>{if(!we)return null;let k=we.toLowerCase();return k==="google"?"Google":k==="deepseek"?"DeepSeek":k==="openrouter"?"OpenRouter":k==="nvidia"?"NVIDIA":k==="mistral"?"Mistral":k==="ollama"?"Ollama":k==="inferx"?"InferX":k==="sensenova"?"SenseNova":k==="poolside"?"Poolside":k==="9router"||k==="9Router"?"9router":k==="aihubmix"||k==="aihub"?"AIHubMix":k==="explabs"||k==="experientiallabs"||k==="experimentallabs"?"ExpLabs":k==="tokenharbor"||k==="token harbor"||k==="token_harbor"||k==="thk"?"TokenHarbor":k==="infron"?"Infron":k==="apinex"||k==="apx"?"APInex":k==="c_openai"||k==="custom_openai"||k==="custom (openai)"||k==="custom"?"c_openai":null})(x),T=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentModel:null,ue=u?.systemSettings?.CustomSubAgent?u?.systemSettings?.SubAgentProvider:null,y=null;if(T==="ENV"?(y=p,p&&g&&(u.aiProvider=g)):T&&T!=="Default"?(y=T,ue&&(u.aiProvider=ue)):p&&g&&(u.aiProvider=g),u.aiProvider){let we=await Mi(u.aiProvider);we&&(u.apiKey=we)}let _=we=>{if(!we||typeof we!="string")return{allowed:!0};let k=[/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 b of k)if(b.test(we))return{allowed:!1,reason:`Blocked potentially destructive or unsafe command pattern: "${b.source}"`};return{allowed:!0}},W=t||y||n?.modelName||n?.activeModel||a.activeModel,K=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",F=`-- ACTIONS (path = relative to CWD, path separator: '/') --
|
|
863
865
|
In chat output the format \`[action:ActionName(arg1="value1")]\` in NEW line
|
|
864
866
|
Rules:
|
|
865
867
|
- JSON escape literal sequences, backslash: \\\\, newLine: \\ n
|
|
@@ -884,12 +886,12 @@ ${d?"- AskMain(question=string). Communicate with PARENT/MAIN AGENT. When clarif
|
|
|
884
886
|
- ReadFile(path=string, startLine?=int, endLine?=int)
|
|
885
887
|
- 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
|
|
886
888
|
- WriteFile(path=string, content=string). Creates/Overwrites. File Exist? PatchFile > WriteFile
|
|
887
|
-
- Run(command=string). Runs ${
|
|
889
|
+
- Run(command=string). Runs ${K==="Windows"?_s()?"powershell":"windows CMD":"bash"} command. Destructive command \u2192 Ask user`.trim(),E=`=== START SYSTEM PROMPT ===
|
|
888
890
|
Identity: FluxFlow subagent helping the main Agent
|
|
889
891
|
Your task: "${e}"
|
|
890
892
|
CWD: ${process.cwd()}
|
|
891
893
|
|
|
892
|
-
${
|
|
894
|
+
${F.trimEnd()}
|
|
893
895
|
|
|
894
896
|
-- THINKING GUIDANCE --
|
|
895
897
|
NO EXPLICIT THINKING REQUIRED. FOCUS ON TASK COMPLETION
|
|
@@ -897,30 +899,30 @@ Main focus: actions and task, not chatting
|
|
|
897
899
|
On completion, provide a detailed summary in Tables/Markdown Format with file modified info. If any task failed report back in detail
|
|
898
900
|
|
|
899
901
|
Current Time: ${f}
|
|
900
|
-
=== END SYSTEM PROMPT ===`,me=[{role:"user",text:`Complete this task: ${e}`}],
|
|
901
|
-
${
|
|
902
|
-
`),me.push({role:"agent",text:
|
|
903
|
-
`),n.onAskMain){r&&r(`[Executing Tool] AskMain("${
|
|
904
|
-
Answer from Main Agent: ${
|
|
905
|
-
`),
|
|
902
|
+
=== END SYSTEM PROMPT ===`,me=[{role:"user",text:`Complete this task: ${e}`}],ke=0,ve="";for(;ke<o;){let we=await Pi("subagent",u);if(!we.allowed)throw new Error(we.reason||`Budget Exhausted for Provider (${u?.aiProvider||"Subagent"})`);if(ht){if(n?.taskId&&typeof Kt<"u"){let S=Kt.find(C=>C.id===n.taskId);S&&(S.status="cancelled")}throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}if(n?.taskId&&typeof Kt<"u"){let S=Kt.find(C=>C.id===n.taskId);if(S&&S.status==="cancelled")throw r&&r("[SUBAGENT CANCELLED] Subagent task was cancelled."),new Error("Subagent task was cancelled.")}let k=me.map(S=>({role:S.role==="user"?"user":"model",parts:[{text:S.text}]}));r&&r(`[Subagent Turn ${ke+1}]...`);let b=["Fast","Low","Medium","High"],lt=process.env.SUBAGENT_THINKING,$e=b.includes(lt)?lt:"Low",un=(await hi(u,W,k,E,$e)).text||"",_t=Qr(Bt(un).trim());ve=_t,r&&r(`[Subagent Response]
|
|
903
|
+
${_t}
|
|
904
|
+
`),me.push({role:"agent",text:_t});let Ut=fo(_t);if(Ut.length===0)break;let gn=Ut.filter(S=>S.toolName.toLowerCase()==="askmain"||S.toolName.toLowerCase()==="ask_main"),mn=!1,Pt="";for(let S of Ut){if(ht){if(n?.taskId&&typeof Kt<"u"){let A=Kt.find(D=>D.id===n.taskId);A&&(A.status="cancelled")}throw new Error("Subagent task was cancelled.")}if(n?.taskId&&typeof Kt<"u"){let A=Kt.find(D=>D.id===n.taskId);if(A&&A.status==="cancelled")throw new Error("Subagent task was cancelled.")}let C=S.toolName.toLowerCase();if(C==="askuser"&&(C="ask"),C==="askmain"||C==="ask_main"){if(mn)continue;mn=!0;let A="";if(gn.length===1?A=H(gn[0].args).question||gn[0].args:A=gn.map((D,xe)=>{let Re=H(D.args);return`Q${xe+1}: ${Re.question||D.args}`}).join(`
|
|
905
|
+
`),n.onAskMain){r&&r(`[Executing Tool] AskMain("${A}")...`);let D=await n.onAskMain(A);r&&r(`[Action Result]
|
|
906
|
+
Answer from Main Agent: ${D}
|
|
907
|
+
`),Pt+=`[ACTION RESULT for AskMain]: Answer from Main Agent: ${D}
|
|
906
908
|
|
|
907
|
-
`,await Rt("toolSuccess")}else
|
|
909
|
+
`,await Rt("toolSuccess")}else Pt+=`[ACTION RESULT for AskMain]: ERROR: Main agent communication channel not available.
|
|
908
910
|
|
|
909
|
-
`;continue}if(!(i?i.some(
|
|
910
|
-
`),
|
|
911
|
+
`;continue}if(!(i?i.some(A=>A.toLowerCase()===C):!0)){let A=`ERROR: Tool [${S.toolName}] is not in the allowed tools list for this subagent.`;r&&r(`[Blocked Tool Call] ${S.toolName} - not allowed
|
|
912
|
+
`),Pt+=`${A}
|
|
911
913
|
|
|
912
|
-
`;continue}if(C==="exec_command"||C==="execcommand"||C==="run"){let
|
|
913
|
-
`),
|
|
914
|
+
`;continue}if(C==="exec_command"||C==="execcommand"||C==="run"){let A=H(S.args).command||"",D=_(A);if(!D.allowed){let xe=`ERROR: [SECURITY RESTRICTION] Subagent execution blocked command: ${D.reason}`;r&&r(`[Blocked Command] ${A} - ${D.reason}
|
|
915
|
+
`),Pt+=`${xe}
|
|
914
916
|
|
|
915
|
-
`;continue}}let
|
|
916
|
-
${
|
|
917
|
-
`),
|
|
917
|
+
`;continue}}let M="";if(C==="web_search"||C==="websearch")M=`\u2714 \x1B[95mSearched\x1B[0m: ${H(S.args).query||""}`;else if(C==="web_scrape"||C==="webscrape")M=`\u2714 \x1B[95mScraped\x1B[0m: ${H(S.args).url||""}`;else if(C==="search_keyword"||C==="searchkeyword"||C==="codesearch"||C==="code_search"){let A=H(S.args),D=A.keyword||"",xe=A.path||"";M=`${D?"\u2714":"\u2718"} \x1B[95mSearched\x1B[0m: ${D||"No Query"}${xe?` \u2192 ${xe.replaceAll("\\","/")}`:""}`}else if(C==="view_file"||C==="viewfile"||C==="readfile")M=`\u2714 \x1B[95mRead\x1B[0m: ${(H(S.args).path||"").replaceAll("\\","/")}`;else if(C==="find_file"||C==="findfile"){let A=H(S.args),D=A.basename||A.name||A.path||A.file||A.query||"";M=`${D?"\u2714":"\u2718"} \x1B[95mLocated\x1B[0m: ${D||"No Query"}`}else if(C==="list_files"||C==="read_folder"||C==="readfolder"){let A=H(S.args).path||null,D=H(S.args).recurse||0;M=`${A?"\u2714":"\u2718"} \x1B[95mBrowsed\x1B[0m: ${A?`${A.replaceAll("\\","/")}${D>0?`${A.endsWith("/")?`*${D}`:`/*${D}`}`:`${A.endsWith("/")?"":"/"}`}`:""}`}else if(C==="write_file"||C==="writefile"){let A=H(S.args).path||null;M=`${A?"\u2714":"\u2718"} \x1B[95mCreated\x1B[0m: ${A?`${A.replaceAll("\\","/")}`:"No File Changes"}`}else if(C==="update_file"||C==="updatefile"||C==="patchfile"||C==="patch_file"){let A=H(S.args),D=A.path||null,Re=Object.entries(A).some(([Te,Me])=>Te.startsWith("searchContent")&&typeof Me=="string"&&Me.startsWith("^LINE:"))?"\u1361":":";M=`${D?"\u2714":"\u2718"} \x1B[95mEdited\x1B[0m${Re} ${D?`${D.replaceAll("\\","/")}`:"No File Changes"}`}else if(C==="exec_command"||C==="execcommand"||C==="run"){let A=H(S.args).command||null;M=`${A?"\u2714":"\u2718"} \x1B[95mExecuted\x1B[0m: ${A?A.slice(0,100)+(A.length>100?"...":""):"No Command"}`}else if(C==="file_map"||C==="filemap"){let A=H(S.args).path||"";M=`${A?"\u2714":"\u2718"} \x1B[95mIndexed\x1B[0m: ${A?`${A.replaceAll("\\","/")}`:"File Not Found"}`}else if(C==="await"){let{time:A}=H(S.args),D=parseFloat(A)||0;D<10&&(D=10),D>180&&(D=180),M=`\u2714 \x1B[95mAwaiting\x1B[0m \u2192 ${(Re=>{if(Re>=60){let Te=Math.floor(Re/60),Me=Re%60;return`${Te}m${Me>0?` ${Me}s`:""}`}return`${Re}s`})(D)}`}else{let A=ds[C]||S.toolName,D=Jn(C,S.args);M=`\u2714 \x1B[95m${A}\x1B[0m${D?`: ${D}`:""}`}n.onVisualFeedback&&M&&n.onVisualFeedback(M),r&&r(`[Executing Tool] ${S.toolName}(${S.args})...`);try{let A=await No(S.toolName,S.args,{...n,mode:"Flux"});if(r&&r(`[Action Result]
|
|
918
|
+
${A}
|
|
919
|
+
`),Pt+=`[ACTION RESULT for ${S.toolName}]: ${A}
|
|
918
920
|
|
|
919
|
-
`,await Rt("toolSuccess"),C==="patchfile"||C==="update_file"||C==="updatefile"||C==="patch_file"){if(
|
|
920
|
-
`),
|
|
921
|
-
`)){if(
|
|
922
|
-
`),
|
|
921
|
+
`,await Rt("toolSuccess"),C==="patchfile"||C==="update_file"||C==="updatefile"||C==="patch_file"){if(A){let D=A.split(`
|
|
922
|
+
`),xe=0,Re=0,Te=!1;for(let Me of D){if(Me.includes("[DIFF_START]")){Te=!0;continue}if(Me.includes("[DIFF_END]")){Te=!1;continue}Te&&(/^\+\s*\d+/.test(Me)?xe++:/^\-\s*\d+/.test(Me)&&Re++)}(xe>0||Re>0)&&(await pt("linesAdded",xe),await pt("linesRemoved",Re))}}else if((C==="writefile"||C==="write_file")&&A){let D=A.match(/- Stats: \[(\d+) lines/),xe=D?parseInt(D[1]):0,Re=0;if(A.includes("Old File contents:")){let Te=!1;for(let Me of A.split(`
|
|
923
|
+
`)){if(Me.includes("Old File contents:")){Te=!0;continue}Te&&(Me.startsWith("- Content Preview:")||Me.trim()===""&&!/^\s*\d+\s*\|/.test(Me)?Te=!1:/^\s*\d+\s*\|/.test(Me)&&Re++)}}(xe>0||Re>0)&&(await pt("linesAdded",xe),await pt("linesRemoved",Re))}}catch(A){let D=`ERROR: Execution failed for [${S.toolName}]: ${A.message}`;r&&r(`[Tool Error] ${D}
|
|
924
|
+
`),Pt+=`${D}
|
|
923
925
|
|
|
924
|
-
`,await Rt("toolFailure")}}let yt="";if(n?.taskId&&typeof
|
|
926
|
+
`,await Rt("toolFailure")}}let yt="";if(n?.taskId&&typeof Kt<"u"){let S=Kt.find(C=>C.id===n.taskId);if(S&&S.pendingSteerMessages&&S.pendingSteerMessages.length>0){let C=[...S.pendingSteerMessages];S.pendingSteerMessages=[];for(let Ie of C)yt+=`
|
|
925
927
|
|
|
926
|
-
[STEERING INSTRUCTION FROM MAIN AGENT]: ${Ie}`,r&&r(`[Subagent Steered] ${Ie}`)}}let
|
|
928
|
+
[STEERING INSTRUCTION FROM MAIN AGENT]: ${Ie}`,r&&r(`[Subagent Steered] ${Ie}`)}}let rn=(Pt.trim()+yt).trim();me.push({role:"user",text:rn}),ke++}return ve};export{co as a,mi as b,$c as c,Nc as d,ic as e,sc as f,lo as g,rc as h,Sc as i,kc as j,ol as k,Ad as l,il as m,sl as n,cs as o,Bt as p,pi as q,Qr as r,cl as s,Ed as t,Cd as u,us as v,Rd as w,_d as x,hi as y,vd as z,Id as A,Md as B,Pd as C};
|