fluxflow-cli 5.6.2 → 5.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/chunks/9router-PDJMJ7J7.js +1 -0
  2. package/dist/chunks/{ai-2WT22XNX.js → ai-RXGVC6CH.js} +1 -1
  3. package/dist/chunks/aihubmix-O3DBW2A5.js +1 -0
  4. package/dist/chunks/apinex-752TL5EZ.js +1 -0
  5. package/dist/chunks/{app-VJTUE4RH.js → app-EZITKUKA.js} +1 -1
  6. package/dist/chunks/{auto_completion-2FS7FTBX.js → auto_completion-E7TLLCOT.js} +1 -1
  7. package/dist/chunks/{chunk-77KVL5F7.js → chunk-ECYXN6JP.js} +3 -3
  8. package/dist/chunks/chunk-H6ZSIWYH.js +1 -0
  9. package/dist/chunks/coarena-JZAITHAG.js +1 -0
  10. package/dist/chunks/custom_openai-VGJQRWSE.js +2 -0
  11. package/dist/chunks/deepseek-2ML5JZIJ.js +1 -0
  12. package/dist/chunks/explabs-QQLTHT5W.js +1 -0
  13. package/dist/chunks/inferx-UKKLJEAM.js +2 -0
  14. package/dist/chunks/infron-TWZGMQWC.js +1 -0
  15. package/dist/chunks/{invoke-6O2PR2CU.js → invoke-UHU7WYIJ.js} +2 -2
  16. package/dist/chunks/{invokeSync-EK5LGZOW.js → invokeSync-D5CAEBKJ.js} +2 -2
  17. package/dist/chunks/mistral-GA36HVZJ.js +1 -0
  18. package/dist/chunks/nvidia-Z6TAXVPB.js +1 -0
  19. package/dist/chunks/openrouter-X34P3LSG.js +1 -0
  20. package/dist/chunks/poolside-FQHJMGLR.js +1 -0
  21. package/dist/chunks/sensenova-HDWEJZ55.js +1 -0
  22. package/dist/chunks/tokenharbor-CGOB5U35.js +1 -0
  23. package/dist/chunks/xkiro-QEMX3CQI.js +1 -0
  24. package/dist/cli.js +2 -2
  25. package/dist/package.json +1 -1
  26. package/package.json +1 -1
  27. package/dist/chunks/9router-XV5L5RWA.js +0 -2
  28. package/dist/chunks/aihubmix-5XK2DFNJ.js +0 -2
  29. package/dist/chunks/apinex-BN3E62ML.js +0 -2
  30. package/dist/chunks/chunk-PTFCY2D5.js +0 -1
  31. package/dist/chunks/coarena-SGBBHWAP.js +0 -2
  32. package/dist/chunks/custom_openai-MM5T6QBQ.js +0 -3
  33. package/dist/chunks/deepseek-5FL3MI6P.js +0 -2
  34. package/dist/chunks/explabs-WJXK6SEY.js +0 -2
  35. package/dist/chunks/inferx-5Q36576Q.js +0 -3
  36. package/dist/chunks/infron-4M36NBSA.js +0 -2
  37. package/dist/chunks/mistral-WTUJY4U7.js +0 -2
  38. package/dist/chunks/nvidia-I35DUUDV.js +0 -2
  39. package/dist/chunks/openrouter-WKGHI2OP.js +0 -2
  40. package/dist/chunks/poolside-F6QS6ZMC.js +0 -2
  41. package/dist/chunks/sensenova-QE73BOHI.js +0 -2
  42. package/dist/chunks/tokenharbor-KKGRGQXG.js +0 -2
  43. package/dist/chunks/xkiro-3R4IOLSP.js +0 -2
@@ -0,0 +1 @@
1
+ import{a as N,d as b}from"./chunk-H6ZSIWYH.js";import{a as D}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var J=async function*(g,_,O,U,d,B,$,L,S=1){let y=[];U&&y.push({role:"system",content:U});for(let r of O){let T=r.role==="user"?"user":"assistant",n=[];if(Array.isArray(r.parts)){for(let e of r.parts)if(e.text)n.push({type:"text",text:e.text});else if(e.inlineData&&$){let f=e.inlineData.mimeType,i=e.inlineData.data;f.startsWith("image/")&&n.push({type:"image_url",image_url:{url:`data:${f};base64,${i}`}})}}else{let e=r.text||"";e&&n.push({type:"text",text:e})}y.push({role:T,content:n.length===1&&n[0].type==="text"?n[0].text:n})}let k=D("9router",_,d)||D("9Router",_,d),w=k!==null?k:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[d],v={model:_,messages:y,stream:!0,stream_options:{include_usage:!0},temperature:S,tools:[],tool_choice:"none"};w&&w!=="none"&&(k!==null||d!=="Fast")&&(v.reasoning_effort=w);let C=(process.env["9ROUTER_URL"]||process.env.NINEROUTER_URL||"http://127.0.0.1:20128/v1").trim(),c=C.replace(/\/+$/,"");if(!c.endsWith("/v1")&&!c.endsWith("/v1/chat/completions"))throw new Error(`Invalid 9Router URL: "${C}". Endpoint URL MUST end with /v1 (e.g. http://127.0.0.1:20128/v1 or https://.../v1).`);let A=c.endsWith("/chat/completions")?c:`${c}/chat/completions`,M={"Content-Type":"application/json"},W=g&&g!=="LOCAL"?g:process.env.NINEROUTER_KEY||"dummy-key";M.Authorization=`Bearer ${W}`;let l=await N(A,{method:"POST",headers:M,body:JSON.stringify(v),signal:L});if(!l.ok){let r=await l.json().catch(()=>({}));throw new Error(`9router Error (${l.status}): ${r.error?.message||l.statusText}`)}let j=l.body.getReader(),I=new TextDecoder,x="",t=[],u=null,p=Date.now(),a=!1;for(;;){let{done:r,value:T}=await j.read();if(r){a&&(t.length>0||u)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:u});break}x+=I.decode(T,{stream:!0});let{lines:n,uncompleted:e}=b(x);x=e;for(let f of n){let i=f.trim();if(!i||!i.startsWith("data: "))continue;let h=!1;if(i==="data: [DONE]")h=!0;else try{let E=JSON.parse(i.substring(6)),o=E.choices?.[0]?.delta,s=E.usage;if(s&&(u={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),o){let m=o.reasoning_content||o.reasoning||o.thinking||null;!m&&Array.isArray(o.reasoning_details)&&o.reasoning_details.length>0&&(m=o.reasoning_details.map(R=>typeof R=="string"?R:R?.text||"").filter(Boolean).join("")),m&&(t.push({text:m,thought:!0}),a=!0),o.content&&(t.push({text:o.content}),a=!0)}}catch{}if((h||Date.now()-p>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:u},t=[],p=Date.now(),a=!1),h)break}Date.now()-p>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:u},t=[],p=Date.now(),a=!1)}};export{J as getNineRouterStream};
@@ -1 +1 @@
1
- import{A as o,B as p,C as q,D as r,E as s,F as t,G as u,H as v,n as b,o as c,p as d,q as e,r as f,s as g,t as h,u as i,v as j,w as k,x as l,y as m,z as n}from"./chunk-77KVL5F7.js";import"./chunk-UM5SNZ6X.js";import"./chunk-NJTM7OYZ.js";import"./chunk-56EJGQU3.js";import"./chunk-4CWGKQHX.js";import"./chunk-JMMO76HS.js";import"./chunk-LTNOPF2E.js";import"./chunk-VOUGMIAJ.js";import"./chunk-2RTYI6K3.js";import"./chunk-6LM3YRRE.js";import"./chunk-3WV6FIZV.js";import"./chunk-3PZTWZTT.js";import"./chunk-KYIMFUZS.js";import"./chunk-MS7BITZ6.js";import{l as a}from"./chunk-Y6O7SAPD.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{c as RE_LEADING_THINK,b as convertChannelThinkTags,r as detectToolCalls,e as findGenuineThinkClose,t as generateSimpleContent,u as getAIStream,q as getActiveToolContext,j as getCleanGroupedLength,m as getGoogleClient,f as getLeadingThinkBlock,s as initAI,d as isInsideBacktick,a as isModelMultimodal,l as isTerminationSignaled,o as maskCodeSpans,p as maskExecutedTools,n as runJanitorTask,v as runSubagent,k as signalTermination,g as stripLeadingThinking,h as stripNakedXmlTags,i as stripTrailingFluffAfterTools};
1
+ import{A as o,B as p,C as q,D as r,E as s,F as t,G as u,H as v,n as b,o as c,p as d,q as e,r as f,s as g,t as h,u as i,v as j,w as k,x as l,y as m,z as n}from"./chunk-ECYXN6JP.js";import"./chunk-UM5SNZ6X.js";import"./chunk-NJTM7OYZ.js";import"./chunk-56EJGQU3.js";import"./chunk-4CWGKQHX.js";import"./chunk-JMMO76HS.js";import"./chunk-LTNOPF2E.js";import"./chunk-VOUGMIAJ.js";import"./chunk-2RTYI6K3.js";import"./chunk-6LM3YRRE.js";import"./chunk-3WV6FIZV.js";import"./chunk-3PZTWZTT.js";import"./chunk-KYIMFUZS.js";import"./chunk-MS7BITZ6.js";import{l as a}from"./chunk-Y6O7SAPD.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{c as RE_LEADING_THINK,b as convertChannelThinkTags,r as detectToolCalls,e as findGenuineThinkClose,t as generateSimpleContent,u as getAIStream,q as getActiveToolContext,j as getCleanGroupedLength,m as getGoogleClient,f as getLeadingThinkBlock,s as initAI,d as isInsideBacktick,a as isModelMultimodal,l as isTerminationSignaled,o as maskCodeSpans,p as maskExecutedTools,n as runJanitorTask,v as runSubagent,k as signalTermination,g as stripLeadingThinking,h as stripNakedXmlTags,i as stripTrailingFluffAfterTools};
@@ -0,0 +1 @@
1
+ import{a as M,d as C}from"./chunk-H6ZSIWYH.js";import{a as b}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var W=async function*(A,x,E,k,_,O,S,H,$=1){let p=[];k&&p.push({role:"system",content:k});for(let s of E){let h=s.role==="user"?"user":"assistant",o=[];if(Array.isArray(s.parts)){for(let e of s.parts)if(e.text)o.push({type:"text",text:e.text});else if(e.inlineData&&S){let u=e.inlineData.mimeType,i=e.inlineData.data;u.startsWith("image/")&&o.push({type:"image_url",image_url:{url:`data:${u};base64,${i}`}})}}else{let e=s.text||"";e&&o.push({type:"text",text:e})}p.push({role:h,content:o.length===1&&o[0].type==="text"?o[0].text:o})}let y=b("AIHubMix",x,_),w=y!==null?y:{Fast:"minimal",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[_],D={model:x,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"};w&&(D.reasoning_effort=w);let r=await M("https://aihubmix.com/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"},body:JSON.stringify(D),signal:H});if(!r.ok){let s=await r.json().catch(()=>({}));throw new Error(`AIHubMix Error (${r.status}): ${s.error?.message||r.statusText}`)}let I=r.body.getReader(),N=new TextDecoder,m="",t=[],c=null,l=Date.now(),a=!1;for(;;){let{done:s,value:h}=await I.read();if(s){a&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}m+=N.decode(h,{stream:!0});let{lines:o,uncompleted:e}=C(m);m=e;for(let u of o){let i=u.trim();if(!i||!i.startsWith("data: "))continue;let d=!1;if(i==="data: [DONE]")d=!0;else try{let g=JSON.parse(i.substring(6)),f=g.choices?.[0]?.delta,n=g.usage;if(n&&(c={totalTokenCount:n.total_tokens||(n.prompt_tokens||0)+(n.completion_tokens||0),promptTokenCount:n.prompt_tokens||0,candidatesTokenCount:n.completion_tokens||0,cachedContentTokenCount:n.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:n.completion_tokens_details?.reasoning_tokens||n.reasoning_tokens||0},a=!0),f){let T=f.reasoning_content||null;T&&(t.push({text:T,thought:!0}),a=!0),f.content&&(t.push({text:f.content}),a=!0)}}catch{}if((d||Date.now()-l>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],l=Date.now(),a=!1),d)break}Date.now()-l>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],l=Date.now(),a=!1)}};export{W as getAIHubMixStream};
@@ -0,0 +1 @@
1
+ import{a as b,d as E}from"./chunk-H6ZSIWYH.js";import{a as P}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var R=async function*(C,x,M,y,k,O,I,F,N=1){let g=[];y&&g.push({role:"system",content:y});for(let n of M){let m=n.role==="user"?"user":"assistant",o=[];if(Array.isArray(n.parts)){for(let t of n.parts)if(t.text)o.push({type:"text",text:t.text});else if(t.inlineData&&I){let d=t.inlineData.mimeType,i=t.inlineData.data;d.startsWith("image/")&&o.push({type:"image_url",image_url:{url:`data:${d};base64,${i}`}})}}else{let t=n.text||"";t&&o.push({type:"text",text:t})}g.push({role:m,content:o.length===1&&o[0].type==="text"?o[0].text:o})}let w=P("APInex",x,k),T=w!==null?w:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[k],D={model:x,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:N,tools:[],tool_choice:"none"};T&&(D.reasoning_effort=T);let S=process.env.APINEX_URL||"https://api.apinex.bond/v1/chat/completions",A={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},v=C||process.env.APINEX_API_KEY||"";A.Authorization=`Bearer ${v}`;let l=await b(S,{method:"POST",headers:A,body:JSON.stringify(D),signal:F});if(!l.ok){let n=await l.json().catch(()=>({}));throw new Error(`APInex Error (${l.status}): ${n.error?.message||n.message||l.statusText}`)}let $=l.body.getReader(),j=new TextDecoder,h="",e=[],c=null,u=Date.now(),s=!1;for(;;){let{done:n,value:m}=await $.read();if(n){s&&(e.length>0||c)&&(yield{candidates:e.length>0?[{content:{parts:e}}]:[],usageMetadata:c});break}h+=j.decode(m,{stream:!0});let{lines:o,uncompleted:t}=E(h);h=t;for(let d of o){let i=d.trim();if(!i||!i.startsWith("data: "))continue;let f=!1;if(i==="data: [DONE]")f=!0;else try{let _=JSON.parse(i.substring(6)),r=_.choices?.[0]?.delta,a=_.usage;if(a&&(c={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||a.reasoning_tokens||0},s=!0),r){let p=r.reasoning_content||r.reasoning||null;!p&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(p=r.reasoning_details.map(L=>L.text||"").filter(Boolean).join("")),p&&(e.push({text:p,thought:!0}),s=!0),r.content&&(e.push({text:r.content}),s=!0)}}catch{}if((f||Date.now()-u>=150)&&s&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:c},e=[],u=Date.now(),s=!1),f)break}Date.now()-u>=150&&s&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:c},e=[],u=Date.now(),s=!1)}};export{R as getAPInexStream};
@@ -1,4 +1,4 @@
1
- import{a as Ma}from"./chunk-UEV335RW.js";import{b as fa,c as xa,d as ga}from"./chunk-FMKFTJB3.js";import{c as na,e as er,f as bo,g as ra}from"./chunk-DWQSI6JO.js";import{A as wa,C as Ta,D as ya,E as Mo,G as Ca,a as oa,b as gt,c as At,d as Sr,e as la,f as pi,g as aa,h as Ln,i as ls,j as bi,k as wi,l as as,m as ca,u as pa,w as ba}from"./chunk-77KVL5F7.js";import{a as co,b as sa,c as ia}from"./chunk-UM5SNZ6X.js";import"./chunk-NJTM7OYZ.js";import{a as ha}from"./chunk-56EJGQU3.js";import"./chunk-4CWGKQHX.js";import{a as Yt,b as Nt,d as Rl,e as Ft,f as ea,k as xi,l as gi,m as Mr,n as hi,o as ta,p as Jo}from"./chunk-JMMO76HS.js";import"./chunk-LTNOPF2E.js";import{a as ma}from"./chunk-YX4X2ZTX.js";import{a as Br,b as Zo,c as Pn,e as cs,f as Ti,g as da,h as ua,i as Er}from"./chunk-VOUGMIAJ.js";import{a as vr}from"./chunk-2RTYI6K3.js";import{a as fn}from"./chunk-6LM3YRRE.js";import{b as mn,c as di}from"./chunk-3WV6FIZV.js";import{A as Xl,C as Gl,D as Kl,E as Vl,H as jl,c as Pl,e as ii,g as Ol,k as Nl,l as Fl,m as $l,n as Ul,o as _l,q as Hl,r as Wl,u as li,v as ai,w as ci}from"./chunk-3PZTWZTT.js";import{a as ql,b as Ql,i as zl,j as ss,k as is,m as It,n as Jl,p as mi,q as fi,w as Zl}from"./chunk-KYIMFUZS.js";import{a as Yl,b as ui,c as zt}from"./chunk-MS7BITZ6.js";import{d as Bl,e as si,f as El,g as kl,h as Dl,i as Il,j as Al,l as ns,n as un,o as po,p as rs,q as Cr,r as Ll}from"./chunk-Y6O7SAPD.js";import{c as ts,d as vl,e as os}from"./chunk-ZGORMZE5.js";import{a as Po,b as An,c as Co,d as ni,e as ri,k as yr,y as Sl}from"./chunk-NPXJIGAI.js";import Es from"os";import pu from"crypto";import e,{useState as Z,useEffect as ut,useRef as Re,useMemo as rr}from"react";import{Box as u,Text as i,useInput as bu,useStdout as wu,Static as Tu}from"ink";import yu from"ink-spinner";import at from"fs-extra";import{minimatch as nc}from"minimatch";import wt from"path";import{exec as jo}from"child_process";import{fileURLToPath as Cu}from"url";import ro,{useState as ds,useEffect as yi,useMemo as kr,useCallback as Wc,useRef as Ro}from"react";import{Box as Xc,Text as Oo,useInput as Gc}from"ink";function Kc(t,m){return t.replace(/\t/g," ".repeat(m))}function us(t){return t==null?"":t.replace(/\r\n/g,`
1
+ import{a as Ma}from"./chunk-UEV335RW.js";import{b as fa,c as xa,d as ga}from"./chunk-FMKFTJB3.js";import{c as na,e as er,f as bo,g as ra}from"./chunk-DWQSI6JO.js";import{A as wa,C as Ta,D as ya,E as Mo,G as Ca,a as oa,b as gt,c as At,d as Sr,e as la,f as pi,g as aa,h as Ln,i as ls,j as bi,k as wi,l as as,m as ca,u as pa,w as ba}from"./chunk-ECYXN6JP.js";import{a as co,b as sa,c as ia}from"./chunk-UM5SNZ6X.js";import"./chunk-NJTM7OYZ.js";import{a as ha}from"./chunk-56EJGQU3.js";import"./chunk-4CWGKQHX.js";import{a as Yt,b as Nt,d as Rl,e as Ft,f as ea,k as xi,l as gi,m as Mr,n as hi,o as ta,p as Jo}from"./chunk-JMMO76HS.js";import"./chunk-LTNOPF2E.js";import{a as ma}from"./chunk-YX4X2ZTX.js";import{a as Br,b as Zo,c as Pn,e as cs,f as Ti,g as da,h as ua,i as Er}from"./chunk-VOUGMIAJ.js";import{a as vr}from"./chunk-2RTYI6K3.js";import{a as fn}from"./chunk-6LM3YRRE.js";import{b as mn,c as di}from"./chunk-3WV6FIZV.js";import{A as Xl,C as Gl,D as Kl,E as Vl,H as jl,c as Pl,e as ii,g as Ol,k as Nl,l as Fl,m as $l,n as Ul,o as _l,q as Hl,r as Wl,u as li,v as ai,w as ci}from"./chunk-3PZTWZTT.js";import{a as ql,b as Ql,i as zl,j as ss,k as is,m as It,n as Jl,p as mi,q as fi,w as Zl}from"./chunk-KYIMFUZS.js";import{a as Yl,b as ui,c as zt}from"./chunk-MS7BITZ6.js";import{d as Bl,e as si,f as El,g as kl,h as Dl,i as Il,j as Al,l as ns,n as un,o as po,p as rs,q as Cr,r as Ll}from"./chunk-Y6O7SAPD.js";import{c as ts,d as vl,e as os}from"./chunk-ZGORMZE5.js";import{a as Po,b as An,c as Co,d as ni,e as ri,k as yr,y as Sl}from"./chunk-NPXJIGAI.js";import Es from"os";import pu from"crypto";import e,{useState as Z,useEffect as ut,useRef as Re,useMemo as rr}from"react";import{Box as u,Text as i,useInput as bu,useStdout as wu,Static as Tu}from"ink";import yu from"ink-spinner";import at from"fs-extra";import{minimatch as nc}from"minimatch";import wt from"path";import{exec as jo}from"child_process";import{fileURLToPath as Cu}from"url";import ro,{useState as ds,useEffect as yi,useMemo as kr,useCallback as Wc,useRef as Ro}from"react";import{Box as Xc,Text as Oo,useInput as Gc}from"ink";function Kc(t,m){return t.replace(/\t/g," ".repeat(m))}function us(t){return t==null?"":t.replace(/\r\n/g,`
2
2
  `).replace(/\r/g,`
3
3
  `)}function On(t,m,d){let S=t,y=[...m].sort((r,C)=>r.start-C.start),p=0;for(let r of y){let C=r.start-p,w=us(r.text).split(`
4
4
  `).length,M=r.text.length,P=(w>3?`[Pasted ${w} lines]`:`[Pasted ${M} chars]`).length,F=C+P;if(t<=C)break;if(t<F){S=r.end;break}else{let k=r.text.length-P;S+=k,p+=k}}return Math.min(S,d.length)}function Ci(t,m,d,S,y=[]){let p=(t||"").slice(0,m),r=S(p).length,C=S(t||""),w=[...y].sort((j,H)=>H.start-j.start);for(let j of w){let H=S(t.slice(0,j.start)).length,W=S(j.text),X=H+W.length,ie=us(j.text).split(`
@@ -1,3 +1,3 @@
1
- import{F as u}from"./chunk-77KVL5F7.js";import"./chunk-UM5SNZ6X.js";import"./chunk-NJTM7OYZ.js";import"./chunk-56EJGQU3.js";import"./chunk-4CWGKQHX.js";import"./chunk-JMMO76HS.js";import"./chunk-LTNOPF2E.js";import"./chunk-VOUGMIAJ.js";import"./chunk-2RTYI6K3.js";import"./chunk-6LM3YRRE.js";import{b as p}from"./chunk-3WV6FIZV.js";import"./chunk-3PZTWZTT.js";import"./chunk-KYIMFUZS.js";import{b as d}from"./chunk-MS7BITZ6.js";import{o as a}from"./chunk-Y6O7SAPD.js";import"./chunk-ZGORMZE5.js";import{a as l}from"./chunk-NPXJIGAI.js";import m from"fs";import g from"path";var f=["Identity: Embedded IDE code completion engine","Context given: Code \xB1 cursor, file name & language","Task: Predict contextually accurate code at cursor position","","Rules:","- Return ONLY the raw code to insert at the cursor. No explanations, commentary or rambling","- Do NOT wrap in markdown code fences","- NEVER repeat code that exist before & after cursor, if nothing sensible possible to predict, return empty string","- Match surrounding indentation and code style","- Complete the current line statement","- Never include placeholder comments like // TODO or # your code here","- Do not put anything except the code to insert between the tags"].join(`
1
+ import{F as u}from"./chunk-ECYXN6JP.js";import"./chunk-UM5SNZ6X.js";import"./chunk-NJTM7OYZ.js";import"./chunk-56EJGQU3.js";import"./chunk-4CWGKQHX.js";import"./chunk-JMMO76HS.js";import"./chunk-LTNOPF2E.js";import"./chunk-VOUGMIAJ.js";import"./chunk-2RTYI6K3.js";import"./chunk-6LM3YRRE.js";import{b as p}from"./chunk-3WV6FIZV.js";import"./chunk-3PZTWZTT.js";import"./chunk-KYIMFUZS.js";import{b as d}from"./chunk-MS7BITZ6.js";import{o as a}from"./chunk-Y6O7SAPD.js";import"./chunk-ZGORMZE5.js";import{a as l}from"./chunk-NPXJIGAI.js";import m from"fs";import g from"path";var f=["Identity: Embedded IDE code completion engine","Context given: Code \xB1 cursor, file name & language","Task: Predict contextually accurate code at cursor position","","Rules:","- Return ONLY the raw code to insert at the cursor. No explanations, commentary or rambling","- Do NOT wrap in markdown code fences","- NEVER repeat code that exist before & after cursor, if nothing sensible possible to predict, return empty string","- Match surrounding indentation and code style","- Complete the current line statement","- Never include placeholder comments like // TODO or # your code here","- Do not put anything except the code to insert between the tags"].join(`
2
2
  `);try{let t=g.join(l,".cache");m.existsSync(t)||m.mkdirSync(t,{recursive:!0}),m.writeFileSync(g.join(t,"completion.json"),JSON.stringify({systemPrompt:f},null,2))}catch{}var y=t=>{if(!t)return"";let e=t.match(/<completion>([\s\S]*?)<\/completion>/i);return e?e[1]:t},x=({prefix:t="",suffix:e="",fileName:o="",language:n="",recentChanges:r="",clipboard:i=""})=>{let c=r?["### Recent manual changes (context):",r,""]:[],s=i?["### Clipboard (context):",i,""]:[];return[`File: ${o}`,`Language: ${n}`,"","### Code before cursor:",t,"","[cursor here]","","### Code after cursor:",e,"",...c,...s,"### Completion to insert at cursor:"].join(`
3
3
  `)},T=async(t={})=>{try{let e=await d(),o=e.autoCompletion||{};if(!o.enabled)return"";let n=o.provider||e.aiProvider||"Google",r=o.model&&o.model!=="Default"?o.model:e.activeModel||a(n,e.apiTier)||a(n,"paid");if(!r)return"";let i=await p(n);if(!i&&!(n==="c_openai"&&e.systemSettings?.customOpenAIBaseUrl))return"";let c={aiProvider:n,apiKey:i,model:r,mode:"flow",thinkingLevel:"Fast",systemSettings:e.systemSettings||{}},s=[{role:"user",parts:[{text:x(t)}]}],{text:h}=await u(c,r,s,f,"Fast");return y(h||"")}catch{return""}};export{f as AUTOCOMPLETE_SYSTEM_PROMPT,y as extractCompletion,T as generateAutoCompletion};
@@ -456,7 +456,7 @@ Public Docs: https://fluxflow-cli.onrender.com
456
456
 
457
457
  Docs missing required info? Say you are not sure enough to answer. Dont give wrong info`,"references/MODES.md":fr,"references/PROVIDERS.md":ur,"references/PLUGINS.md":gr,"references/STARTUP.md":nr,"references/ENV.md":or,"references/COMMANDS.md":ir,"references/SETTINGS.md":sr,"references/TOOLS.md":rr,"references/ARCHITECTURE.md":ar,"references/SUB_AGENTS.md":lr,"references/SECURITY.md":cr,"references/IDE.md":dr};var hr=(e=null)=>{try{let t=En.join(jn,"skills","fluxflow"),n=En.join(t,"references");if(process.env.NO_DEV==="true"||process.env.NO_DEV==="1"||process.env.NO_DEV===!0||process.env.NO_INS==="true"||process.env.NO_INS==="1"||process.env.NO_INS==="true"||!1){yn.existsSync(t)&&yn.rmSync(t,{recursive:!0,force:!0});return}let o=new Set(Object.keys(Zi).map(m=>En.normalize(m))),d=(e||""||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),l=En.basename(d).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replace(/(\d)-(\d)/g,"$1.$2").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,m=>m.toUpperCase().trim());for(let[m,f]of Object.entries(Zi)){let h=En.join(t,m),p=En.dirname(h);yn.existsSync(p)||yn.mkdirSync(p,{recursive:!0});let g=f;m==="SKILL.md"&&l&&(g=g.replace(/Public Docs: [^\n]*/,`Public Docs: ${g.match(/Public Docs: ([^\n]*)/)?.[1]||""}
458
458
  Active Model: ${l}`));let s=g.trim()+`
459
- `,x=null;yn.existsSync(h)&&(x=yn.readFileSync(h,"utf8")),x!==s&&yn.writeFileSync(h,s,"utf8")}if(yn.existsSync(n)){let m=yn.readdirSync(n);for(let f of m){let h=En.normalize(En.join("references",f));if(!o.has(h)){let p=En.join(n,f);try{yn.rmSync(p,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as gi}from"ws";var Dt=null,po=!1,za="ws://localhost:56832",es=[],ho=null,ts=null,ns=null,yr="2.0.0",Tc=e=>{yr=e,xr()},os=e=>{ts=e},Ac=e=>{ns=e},xr=()=>{if(Dt||po)return;po=!0;let e=new gi(za);e.on("open",()=>{for(Dt=e,po=!1,Dt.send(JSON.stringify({command:"version",version:yr,pid:process.pid,ppid:process.ppid,cwd:process.cwd()}));es.length>0;)Dt.send(JSON.stringify(es.shift()))}),e.on("message",t=>{try{let n=JSON.parse(t.toString());n.command==="contextResponse"&&ho?(ho(n.data),ho=null):n.command==="securityResponse"&&ts?ts(n.result):n.command==="inlineComplete"?qa(n):n.command==="connectionRejected"&&ns&&ns(n)}catch{}}),e.on("error",()=>{po=!1,Dt=null}),e.on("close",()=>{po=!1,Dt=null})},Po=e=>{Dt&&Dt.readyState===gi.OPEN?Dt.send(JSON.stringify(e)):(es.push(e),po||xr())},yo=()=>Dt!==null&&Dt.readyState===gi.OPEN,qa=async e=>{let t="";try{let{generateAutoCompletion:n}=await import("./auto_completion-2FS7FTBX.js");t=await n({prefix:e.prefix||"",suffix:e.suffix||"",fileName:e.fileName||"",language:e.language||"",recentChanges:e.recentChanges||"",clipboard:e.clipboard||""})}catch{t=""}Po({command:"inlineCompleteResponse",requestId:e.requestId,completion:t||""})},Cc=e=>{Po({command:"status",status:e})},to=()=>new Promise(e=>{if(!Dt||Dt.readyState!==gi.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}ho=e,Dt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{ho===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),ho=null)},1e3)}),wr=e=>{let{resolvedPath:t}=mn(e);Po({command:"open",filePath:t})},is=(e,t,n)=>{let{resolvedPath:i}=mn(e);Po({command:"showDiff",filePath:i,originalContent:t,modifiedContent:n})},br=(e,t)=>{let{resolvedPath:n}=mn(e);Po({command:"closeDiff",filePath:n,result:t})};var Bo=(e,t)=>{try{if(!Jt.existsSync(e))return null;let n=Array.isArray(t)?t.map(o=>o.toLowerCase()):[t.toLowerCase()],i=Jt.readdirSync(e);for(let o of n){let r=i.find(d=>d.toLowerCase()===o);if(r){let d=an.join(e,r);if(Jt.statSync(d).isFile())return d}}}catch{}return null},cs=(e,t)=>{let n=Bo(e,t);if(n)try{return Jt.readFileSync(n,"utf8")}catch{}return""},Sr=new Set([".git","node_modules",".gemini","dist","build",".next","out",".cache","bin","obj","vendor","venv",".idea",".gradle",".terraform","target","coverage",".vscode",".svn",".hg",".fslckout",".github",".gitlab",".circleci",".gitea",".gitee",".lerna",".changeset",".nx",".npm",".yarn",".pnpm-store",".pnpm",".expo",".nuxt",".svelte-kit",".docusaurus",".turbo",".vercel","bower_components",".netlify",".vuepress",".quasar",".output",".angular","jspm_packages",".parcel-cache",".rollup.cache",".rspack",".vitepress","__pycache__",".pytest_cache",".mypy_cache",".tox",".poetry","env","vhdl",".ipynb_checkpoints",".jupyter",".conda",".pdm-build",".bundle",".yardoc",".metadata","App_Data","ClientBin",".cargo",".rustc_info",".go","Godeps","_vendor",".rake_tasks","CMakefiles",".wakatime",".dart_tool",".fvm",".cocoapods","Pods",".pub-cache",".symlinks","DerivedData",".xcworkspace",".serverless",".aws",".gcloud",".azure",".kube",".vagrant",".docker","postgres-data","redis-data","mongo-data",".Spotlight-V100",".Trashes","$RECYCLE.BIN","System Volume Information",".DocumentRevisions-V100",".fseventsd","AppData","Application Data","Local","LocalLow","Roaming","$WinREAgent","$WINDOWS.~BT","$WINDOWS.~WS","scw","System32","SysWOW64",".AppleDouble",".AppleDB",".AppleDesktop","_CodeSignature",".cmio",".LSOverride",".localized",".TemporaryItems",".Trash",".Trash-0",".Trash-1000",".gvfs",".local",".config",".dbus",".fontconfig",".snap",".var",".lost+found","lost+found",".thumb",".thumbnails","EFI","boot","grub","logs","log",".nyc_output",".sonar",".ruff_cache",".VSCodeCounter",".skills","skills"]),ds=(e=process.cwd(),t=0,n=8)=>{let i=[];if(t>n)return i;try{if(!Jt.existsSync(e))return i;let o=Jt.readdirSync(e,{withFileTypes:!0});for(let r of o){let d=r.name,l=an.join(e,d);if(r.isDirectory())!Sr.has(d)&&!Sr.has(d.toLowerCase())&&i.push(...ds(l,t+1,n));else if(r.isFile()){let m=d.toLowerCase();(m==="agents.md"||m==="agent.md")&&i.push(l)}}}catch{}return i},kr=(e,t=2)=>{if(!e)return"";let n=" ".repeat(t);return e.split(/\r?\n/).map(i=>n+i).join(`
459
+ `,x=null;yn.existsSync(h)&&(x=yn.readFileSync(h,"utf8")),x!==s&&yn.writeFileSync(h,s,"utf8")}if(yn.existsSync(n)){let m=yn.readdirSync(n);for(let f of m){let h=En.normalize(En.join("references",f));if(!o.has(h)){let p=En.join(n,f);try{yn.rmSync(p,{recursive:!0,force:!0})}catch{}}}}}catch{}};import{WebSocket as gi}from"ws";var Dt=null,po=!1,za="ws://localhost:56832",es=[],ho=null,ts=null,ns=null,yr="2.0.0",Tc=e=>{yr=e,xr()},os=e=>{ts=e},Ac=e=>{ns=e},xr=()=>{if(Dt||po)return;po=!0;let e=new gi(za);e.on("open",()=>{for(Dt=e,po=!1,Dt.send(JSON.stringify({command:"version",version:yr,pid:process.pid,ppid:process.ppid,cwd:process.cwd()}));es.length>0;)Dt.send(JSON.stringify(es.shift()))}),e.on("message",t=>{try{let n=JSON.parse(t.toString());n.command==="contextResponse"&&ho?(ho(n.data),ho=null):n.command==="securityResponse"&&ts?ts(n.result):n.command==="inlineComplete"?qa(n):n.command==="connectionRejected"&&ns&&ns(n)}catch{}}),e.on("error",()=>{po=!1,Dt=null}),e.on("close",()=>{po=!1,Dt=null})},Po=e=>{Dt&&Dt.readyState===gi.OPEN?Dt.send(JSON.stringify(e)):(es.push(e),po||xr())},yo=()=>Dt!==null&&Dt.readyState===gi.OPEN,qa=async e=>{let t="";try{let{generateAutoCompletion:n}=await import("./auto_completion-E7TLLCOT.js");t=await n({prefix:e.prefix||"",suffix:e.suffix||"",fileName:e.fileName||"",language:e.language||"",recentChanges:e.recentChanges||"",clipboard:e.clipboard||""})}catch{t=""}Po({command:"inlineCompleteResponse",requestId:e.requestId,completion:t||""})},Cc=e=>{Po({command:"status",status:e})},to=()=>new Promise(e=>{if(!Dt||Dt.readyState!==gi.OPEN){e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]});return}ho=e,Dt.send(JSON.stringify({command:"requestContext"})),setTimeout(()=>{ho===e&&(e({cursor_line:0,selected:0,manual_edits:"",file_focused:"none",opened_editors:[]}),ho=null)},1e3)}),wr=e=>{let{resolvedPath:t}=mn(e);Po({command:"open",filePath:t})},is=(e,t,n)=>{let{resolvedPath:i}=mn(e);Po({command:"showDiff",filePath:i,originalContent:t,modifiedContent:n})},br=(e,t)=>{let{resolvedPath:n}=mn(e);Po({command:"closeDiff",filePath:n,result:t})};var Bo=(e,t)=>{try{if(!Jt.existsSync(e))return null;let n=Array.isArray(t)?t.map(o=>o.toLowerCase()):[t.toLowerCase()],i=Jt.readdirSync(e);for(let o of n){let r=i.find(d=>d.toLowerCase()===o);if(r){let d=an.join(e,r);if(Jt.statSync(d).isFile())return d}}}catch{}return null},cs=(e,t)=>{let n=Bo(e,t);if(n)try{return Jt.readFileSync(n,"utf8")}catch{}return""},Sr=new Set([".git","node_modules",".gemini","dist","build",".next","out",".cache","bin","obj","vendor","venv",".idea",".gradle",".terraform","target","coverage",".vscode",".svn",".hg",".fslckout",".github",".gitlab",".circleci",".gitea",".gitee",".lerna",".changeset",".nx",".npm",".yarn",".pnpm-store",".pnpm",".expo",".nuxt",".svelte-kit",".docusaurus",".turbo",".vercel","bower_components",".netlify",".vuepress",".quasar",".output",".angular","jspm_packages",".parcel-cache",".rollup.cache",".rspack",".vitepress","__pycache__",".pytest_cache",".mypy_cache",".tox",".poetry","env","vhdl",".ipynb_checkpoints",".jupyter",".conda",".pdm-build",".bundle",".yardoc",".metadata","App_Data","ClientBin",".cargo",".rustc_info",".go","Godeps","_vendor",".rake_tasks","CMakefiles",".wakatime",".dart_tool",".fvm",".cocoapods","Pods",".pub-cache",".symlinks","DerivedData",".xcworkspace",".serverless",".aws",".gcloud",".azure",".kube",".vagrant",".docker","postgres-data","redis-data","mongo-data",".Spotlight-V100",".Trashes","$RECYCLE.BIN","System Volume Information",".DocumentRevisions-V100",".fseventsd","AppData","Application Data","Local","LocalLow","Roaming","$WinREAgent","$WINDOWS.~BT","$WINDOWS.~WS","scw","System32","SysWOW64",".AppleDouble",".AppleDB",".AppleDesktop","_CodeSignature",".cmio",".LSOverride",".localized",".TemporaryItems",".Trash",".Trash-0",".Trash-1000",".gvfs",".local",".config",".dbus",".fontconfig",".snap",".var",".lost+found","lost+found",".thumb",".thumbnails","EFI","boot","grub","logs","log",".nyc_output",".sonar",".ruff_cache",".VSCodeCounter",".skills","skills"]),ds=(e=process.cwd(),t=0,n=8)=>{let i=[];if(t>n)return i;try{if(!Jt.existsSync(e))return i;let o=Jt.readdirSync(e,{withFileTypes:!0});for(let r of o){let d=r.name,l=an.join(e,d);if(r.isDirectory())!Sr.has(d)&&!Sr.has(d.toLowerCase())&&i.push(...ds(l,t+1,n));else if(r.isFile()){let m=d.toLowerCase();(m==="agents.md"||m==="agent.md")&&i.push(l)}}}catch{}return i},kr=(e,t=2)=>{if(!e)return"";let n=" ".repeat(t);return e.split(/\r?\n/).map(i=>n+i).join(`
460
460
  `)},vr=()=>Bo(jn,["agents.md","agent.md"]),Er=()=>Bo(process.cwd(),["agents.md","agent.md"]),_r=()=>Bo(jn,["fluxflow.md"]),Ir=()=>Bo(process.cwd(),["fluxflow.md"]),Lo=vr(),mi=Er(),xn=ds(),Oo=_r(),No=Ir(),Tr=null,ls="",Mr=!1,Xa=e=>{if(!e||!/^<<<[\s\S]*?Identity:/m.test(e))return e;let t=e.match(/^<<<\s*\r?\n([\s\S]*?)\r?\n>>>\s*(?:\r?\n)?([\s\S]*)$/);if(!t)return e;let n=t[1],i=t[2],o=n.match(/^Identity:\s*([\s\S]*?)(?=\r?\n\s*(?:<><|>>>)|$)/m);return o&&(ls=o[1].trim(),process.env.NO_INS=!0),/<><\s*NO_INS/.test(n)&&(Mr=!0),i.trim()},Ja=()=>{Lo=vr();let e=Lo?cs(jn,["agents.md","agent.md"]).trim():"";return e.length===0?(Lo=null,""):e},Qa=()=>{if(xn=ds(),mi=Er(),!xn||xn.length===0)return"";let e=process.cwd(),t=[...xn].sort((o,r)=>{let d=an.relative(e,o).replace(/\\/g,"/"),l=an.relative(e,r).replace(/\\/g,"/"),m=!d.includes("/"),f=!l.includes("/");return m&&!f?-1:!m&&f?1:d.localeCompare(l)}),n=[],i=[];for(let o of t)try{let r=Jt.readFileSync(o,"utf8").trim();if(!r||r.length===0)continue;n.push(o);let d=an.relative(e,o).replace(/\\/g,"/");if(!d.includes("/"))i.push(kr(r,2));else{let m=an.dirname(d)+"/:";i.push(`${m}
461
461
  ${kr(r,2)}`)}}catch{}return xn=n,xn.length===0&&(mi=null),i.join(`
462
462
 
@@ -526,7 +526,7 @@ ${ss}
526
526
  `:""}${rs.length>0&&n.toLowerCase().includes("flux")?`-- Project Skills --
527
527
  ${rs}
528
528
 
529
- `:""}`.trim()};var Br=()=>import("./web_search-XBV7AJF7.js").then(e=>e.web_search),Ur=()=>import("./web_scrape-SJBA3RQF.js").then(e=>e.web_scrape),Wr=()=>import("./memory-QTLQAFG7.js").then(e=>e.memory),Gr=()=>import("./chat-YMCO5JNQ.js").then(e=>e.chat),Hr=()=>import("./view_file-LWURM2CE.js").then(e=>e.view_file),jr=()=>import("./write_file-6KFLPINS.js").then(e=>e.write_file),Kr=()=>import("./update_file-RA745RVH.js").then(e=>e.update_file),Vr=()=>import("./exec_command-22LIHPPH.js").then(e=>e.exec_command),zr=()=>import("./read_folder-BJ3HS63A.js").then(e=>e.read_folder),ms=()=>import("./ask_user-XQ423UXL.js").then(e=>e.ask_user),qr=()=>import("./write_pdf-UOCME2OY.js").then(e=>e.write_pdf),Yr=()=>import("./write_docx-54LANNV2.js").then(e=>e.write_docx),xi=()=>import("./search_keyword-SSKH6AYF.js").then(e=>e.search_keyword),Xr=()=>import("./generate_image-KIZS5HAI.js").then(e=>e.generate_image),wi=()=>import("./saveSummary-CVZIOQ4L.js").then(e=>e.saveSummary),Uo=()=>import("./addMemScore-U2KYMALL.js").then(e=>e.addMemScore),Jr=()=>import("./file_map-4WUEPRMI.js").then(e=>e.file_map),bi=()=>import("./todo-3EQZ7LZM.js").then(e=>e.todo),Qr=()=>import("./invokeSync-EK5LGZOW.js").then(e=>e.invokeSync),ol=()=>import("./invoke-6O2PR2CU.js").then(e=>e.invoke),Zr=()=>import("./getProgress-MJZDAMSP.js").then(e=>e.getProgress),il=()=>import("./cancel-2PAHCMGB.js").then(e=>e.cancel),ea=()=>import("./emergency_rollback-PHH3BKRP.js").then(e=>e.emergency_rollback),Wo=()=>import("./awaitSubagent-KLH7CRKF.js").then(e=>e.awaitSubagent),Go=()=>import("./answerSubagent-PIZJSLZN.js").then(e=>e.answerSubagent),Si=()=>import("./steerSubagent-B34P33YV.js").then(e=>e.steerSubagent),ki=()=>import("./computer_action-FZUWM6VL.js").then(e=>e.computer_action),ta=()=>import("./click-AJIULJEH.js").then(e=>e.click),na=()=>import("./drag-73WZE3BK.js").then(e=>e.drag),oa=()=>import("./scroll-KE5TNGMD.js").then(e=>e.scroll),ps=()=>import("./keyboard_typing-5L2G5AHU.js").then(e=>e.keyboard_typing),hs=()=>import("./key_press-T5VHXHUL.js").then(e=>e.key_press),ys=()=>import("./recapture_screen-JVNQ2Z7L.js").then(e=>e.recapture_screen),Ti=()=>import("./find_file-LHPOW4ZM.js").then(e=>e.find_file),ia=()=>import("./wait-6WFCZDO7.js").then(e=>e.wait),sa={web_search:Br,web_scrape:Ur,memory:Wr,chat:Gr,view_file:Hr,write_file:jr,update_file:Kr,exec_command:Vr,read_folder:zr,write_pdf:qr,write_docx:Yr,search_keyword:xi,generate_image:Xr,saveSummary:wi,addMemScore:Uo,file_map:Jr,todo:bi,Todo:bi,goal:bi,Goal:bi,invokeSync:Qr,invoke:ol,getProgress:Zr,cancel:il,awaitSubagent:Wo,answerSubagent:Go,steerSubagent:Si,computer_action:ki,computer_use:ki,ComputerAction:ki,ComputerUse:ki,click:ta,Click:ta,drag:na,Drag:na,scroll:oa,Scroll:oa,keyboard_typing:ps,KeyboardTyping:ps,keyboardtyping:ps,key_press:hs,KeyPress:hs,keypress:hs,recapture_screen:ys,RecaptureScreen:ys,recapturescreen:ys,invoke_sync:Qr,get_progress:Zr,await_subagent:Wo,answer_subagent:Go,steer_subagent:Si,steer:Si,Steer:Si,ask:ms,Ask:ms,AskUser:ms,WebSearch:Br,WebScrape:Ur,ReadFile:Hr,ReadFolder:zr,WriteFile:jr,PatchFile:Kr,WritePDF:qr,WriteDoc:Yr,Run:Vr,SearchKeyword:xi,CodeSearch:xi,code_search:xi,Memory:Wr,Chat:Gr,GenerateImage:Xr,saveSumary:wi,SaveSummary:wi,SaveSumary:wi,add_mem_score:Uo,AddMemScore:Uo,addMemoryScore:Uo,AddMemoryScore:Uo,FileMap:Jr,answer:Go,Answer:Go,AnswerSubagent:Go,await:Wo,Await:Wo,AwaitSubagent:Wo,EmergencyRollback:ea,emergency_rollback:ea,find_file:Ti,findFile:Ti,FindFile:Ti,findfile:Ti,wait:ia,Wait:ia},xs=async(e,t,n={})=>{let i=n.mode?n.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(h=>o.includes(h))||o==="ask",m=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(h=>o.includes(h));if(!d){if(i==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Action [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(i==="icu"){if(!m)return`ERROR: Action [${e}] is not available in Computer Use mode. ICU mode only supports Computer Use tools (Click, Drag, Scroll, KeyboardTyping, KeyPress, RecaptureScreen).`}else if(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image"))return`ERROR: Action [${e}] is not available in ${n.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let f=sa[e];if(!f){let h=["ReadFile","ReadFolder","FindFile","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Wait","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],p={read:"ReadFile",view:"ReadFile",viewfile:"ReadFile",write:"WriteFile",edit:"PatchFile",patch:"PatchFile",update:"PatchFile",updatefile:"PatchFile",exec:"Run",command:"Run",bash:"Run",shell:"Run",powershell:"Run",search:"CodeSearch",grep:"CodeSearch",find:"FindFile",findfile:"FindFile",searchkeyword:"CodeSearch",folder:"ReadFolder",ls:"ReadFolder",dir:"ReadFolder",list:"ReadFolder",ask:"AskUser",question:"AskUser",pdf:"WritePDF",docx:"WriteDoc",doc:"WriteDoc",word:"WriteDoc",screenshot:"RecaptureScreen",screen:"RecaptureScreen",recapture:"RecaptureScreen",type:"KeyboardTyping",typing:"KeyboardTyping",keyboard:"KeyboardTyping",press:"KeyPress",key:"KeyPress",todo:"Goal",task:"Goal",subagent:"Invoke",agent:"Invoke"},g=o.replace(/[^a-z0-9]/g,""),s=p[g]||null;if(!s){let I=0,Xe=P=>{let F=new Set;for(let G=0;G<P.length-1;G++)F.add(P.slice(G,G+2));return F},C=Xe(g);for(let P of h){let F=P.toLowerCase().replace(/[^a-z0-9]/g,"");if(g===F){s=P;break}let G=0;(F.includes(g)||g.includes(F))&&(G+=.6);let $=Xe(F),L=0;for(let Ae of C)$.has(Ae)&&L++;let Te=2*L/(C.size+$.size||1);G=Math.max(G,Te),G>I&&G>=.35&&(I=G,s=P)}}let x=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${x}`}try{return await(await f())(t,n)}catch(h){let p=h instanceof Error?h.message:String(h);return`ERROR: Execution failed for [${e}]: ${p}`}};var Ai=e=>{if(!e||typeof e!="string")return!1;let t=e.trim().toLowerCase();return Object.keys(sa).some(n=>n.toLowerCase()===t)};import B from"path";import we from"fs";import xa from"os";import wa from"crypto";import{execSync as As}from"child_process";import sl from"gradient-string";var ra=["I have a regex for your problems.","Your terminal, my kingdom.","Blowing on the cartridge helps. Probably.","Don't panic. I have the towel.","Logic is the start of wisdom.","Try to exit Vim? Good luck.","I speak fluent Terminal.","The cake is a lie. This code is not.","I have no bugs, just surprise features.","Rewriting in Rust... just for fun.","Coffee in, clean commits out.","The magic smoke stays inside today.","A semicolon short of a miracle.","One does not simply code without a bug.","Keep it simple. Keep it terminal.","Regex: now you have two problems.","I dream in binary.","Root access or bust.","Wait for the dial-up tone. Just kidding.","I take the 'labor' out of collab.","My other process is a TARDIS.","Calculated response: 42.","Ponder the orb. Ponder the code.","Less talk, more flow.","Elegance in every byte.","Build something the world is not ready for.","Your wishes, my tool calls.","I act in Flux. I think in Flow.","Syntax error in the universe. Please fix.","Your project, my obsession.","I am not a bot, I am an architect.","Digital spirits consulted. They say: Ship it.","Reticulate splines. Engage humor.","Code like poetry. Run like water.","Minimalism is the ultimate flex.","The truth is in the logs.","Follow the white rabbit.","There is no spoon. Only code.","Binary is the only language I trust.","I have a good feeling about this.","Pew pew! Lasers charged.","Divide by zero? Not today.","Search for the correct USB orientation...","I've got a fever, and the only cure is more code.","The code gremlins are on our side.","My favorite command? Yours.","Stay hungry. Stay active.","Momentum is your best friend.","Lead the flow. Don't chase it.","A fresh batch of bytes. Hot and ready.","I orchestrate the ones and zeros.","Smart enough to help. Humble enough to ask.","Think twice. Code once.","Pure intent. Pure execution.","Small steps. Massive impact.","Your terminal is a canvas.","Efficiency is my second name.","I have seen things you people wouldn't believe.","Let the thoughts marinate.","The best feature? The one you don't need.","Precision is the only perfection.","Stay focused. Stay terminal.","Silence is the best debugger.","Erase the debt. Commit the code.","Velocity meets stability.","Ship it. Improve it. Repeat.","Build tomorrow, right now.","Turn logic into reality.","The best way to predict the future is to build it.","Break barriers, not builds.","Fuel the next breakthrough.","Momentum is key.","Terminal vibes only.","Your digital co-pilot is ready.","Partner in code. Partner in crime.","I speak in semicolons.","Ready for the next great idea.","Just a moment. In the zone.","Polishing the algorithms. Hold tight.","Craft a masterpiece today.","Debug the universe. Start here.","Warp speed engaged. Almost.","The cake is not a lie. It's just loading.","Finish the Kessel Run in 12 parsecs.","Do a barrel roll!","Waiting for the respawn.","Press Start to continue.","Herding digital cats... done.","The hamsters are fast today.","Tasting the snozberries.","I go for speed. I go for flow.","Real life or just fantasy?","Poking the bear... gently.","Ensure the magic smoke stays inside.","Try turning it off and on again.","Construct additional pylons.","New line? Ctrl+J is your friend.","Release the HypnoDrones.","Push the button, Frank.","My other loading screen is even funnier.","Pretty sure a cat walked on my keyboard.","Recalibrate the humor-o-meter.","Summon the code gremlins.","I've seen your browser history. Just kidding.","Charge the laser... pew pew!","Dividing by zero... just for a sec.","Looking for an adult supervisor. Found none.","Make it go beep boop.","Buffering... for effect.","Entangle quantum particles... complete.","Polishing the chrome on my algorithms.","Are you not entertained?","Just waiting for the dial-up tone.","Reboot the humor module.","Defragment memories. Check.","Optimizing for ludicrous speed.","Swapping bits. Don't tell the bytes.","Garbage collected. I am back.","Assembling the interwebs.","Converting coffee to logic.","Update syntax for reality.","Rewire the synapses.","Greasin' the cogs.","Engage the improbability drive.","Channel the Force.","Align the stars. Respond now.","The cake is a lie. The prompt is real.","I'm Feeling Lucky.","Shipping awesomeness.","Navigating the slime mold.","Consult digital spirits.","Ask the magic conch shell.","One moment. Optimizing humor.","Shuffling punchlines.","Compiling brilliance.","Summon the cloud of wisdom.","Prepare to dazzle.","Hold tight. Crafting a response.","Tuning the algorithms.","Following the white rabbit... again.","The truth is in here. Somewhere.","Herding cats is my day job.","Distracting you with this phrase.","Almost there. Probably.","Rickrolling my creator. Don't tell.","Slapping the bass.","Is this real life?","Ponder the orb. Type the prompt.","Thoughtful gaze initiated.","Computer's favorite snack? Microchips.","Why Java? Because I don't C#.","Charging the laser... wait for it.","Dividing by zero... just kidding!","Adult supervision not found. Proceed.","Beep boop. I'm a real boy.","Wait for the respawn.","Finish the run. Ship the code.","Fiddling with character creation.","Just a moment. Finding a meme.","Pressing A to continue.","Loading wit.exe.","Pre-heating the servers.","Calibrate flux capacitor.","Channeling the Force.","Aligning the stars.","The truth is in the code.","Don't panic.","Blowing on the cartridge.","Doing a barrel roll!","Respawning in 3... 2... 1...","The cake is a lie.","Fiddling with character settings.","Finding a suitable pun.","Distracting with wit.","Almost ready.","Hamsters on speed today.","Patting Cloudy on the head.","Rickrolling the logs.","Slapping the code.","Got a good feeling about this.","Poking the prompt.","Researching latest memes.","Making it more witty.","Thinking... hmmm.","Fish with no eyes? Fsh.","Broken pencil? Pointless.","Percussive maintenance applied.","USB orientation: 3rd try's the charm.","Rust rewrite in 3... 2...","Exiting Vim... someday.","Spinning the hamster wheel.","Not a bug. Unplanned feature.","Engage.","I'll be back.","Machine spirit consulted.","Letting the thoughts marinate.","Orb pondered.","Thoughtful gaze engaged.","Charging the laser...","Making it go beep.","Buffering...","Quantum particles entangled.","Polishing the chrome.","Entertained yet?","Gremlins summoned.","Dial-up tone finished.","Humor meter recalibrated.","Cat on keyboard. Sending help.","Enhancing...","Turn it off and on again.","Constructing pylons.","HypnoDrones released.","Pushing the button."];var aa=["Beware the phantom processes.","A ghost in the shell has taken the wheel.","Blowing on the haunted cartridge...","Seven minutes in Raccoon City.","Wind's howling... in the terminal fans.","Slender Man was spotted in line 404.","The cake is a lie. The curse is real.","Don't look behind the server rack.","Exorcising memory leaks at 3 AM.","Pyramid Head reorganized your commit history.","It's dangerous to go alone! Take this flashlight.","YOU DIED. Respawning terminal session...","The Necronomicon evaluated to true.","Something wicked this way compiles.","Haunting your localhost with good vibes.","A full moon has risen over Git main.","Double, double toil and trouble; code fire burn.","Clickers heard in the directory tree.","Checking camera 2B for rogue animatronics.","The call is coming from inside the container.","Isaac Clarke is stomping on stubborn bugs.","Luigi vacuumed the ghosts out of RAM.","Trick or treat, give me clean code to greet.","Whispering incantations to the garbage collector.","Klaatu barada necktie... close enough.","Resurrecting deprecated APIs from the crypt.","The headless horseman forgot the return statement.","Castlevania whip cracking against network latency.","Slime mold crawling through the motherboard.","Carving a pixelated pumpkin into terminal history.","Burying undefined pointers in the pet sematary.","Spilling pumpkin spice on the CPU.","A vampire bat is draining system battery life.","Don't fall asleep at the keyboard tonight.","Silent Hill sirens sounding in the console.","Poltergeists rearranging terminal tabs.","Lighting the Black Flame Candle for autoExec.","Dusting cobwebs off legacy dependencies.","Here's Johnny! ...just checking build health.","Blood, sweat, and zero warnings.","The spirit box whispers: 'GIT PUSH FORCE'.","They're heeeere... in the stack trace.","It's alive! IT'S ALIVEEEE!","No merge conflicts in the graveyard.","Frankenstein's monster patched this logic.","Surviving Five Nights at Flux Flow.","Doom Slayer loading buckshot into cache.","The grim reaper spared your unused imports.","Candy corn lodged in mechanical switches.","May your latency be low and your crypt be quiet."];var la=[{name:"Cyan Cyberpunk",text:"cyan",textMuted:"#4da6b8",textDim:"#2d6d7a",textInverted:"black",border:"cyan",borderMuted:"#1a5966",borderDim:"#0f3840",bg:void 0,cardBg:"#061e24",highlightBg:"#092b33",activeBg:"#0e3e4a",inputBg:"#092b33",inputBorder:"#092b33",inputText:"cyan",inputPlaceholder:"#2d6d7a",inputPrompt:"cyan",codeBg:"#020d10",codeBorder:"#1a5966",userMsgBg:"#092b33",userMsgBorder:"#092b33",userMsgText:"cyan",diffRemovalBg:"#3a0c1a",diffAdditionBg:"#0c3a32",diffRemovalText:"#ff4d88",diffAdditionText:"#00ffaa",diffRemovalHighlightColor:"#ff1a66",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#00ffcc",diffAdditionHighlightBg:"#00593b",diffRemovalNum:"#ff4d88",diffAdditionNum:"#00ffaa",diffRemovalPrefix:"#ff1a66",diffAdditionPrefix:"#00ffcc",primary:"cyan",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"cyan",statusOff:"#2d6d7a",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[36m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ffff","#0088ff"]},{name:"Magenta Vaporwave",text:"magenta",textMuted:"#c451d6",textDim:"#7d2b8a",textInverted:"black",border:"magenta",borderMuted:"#5e1b69",borderDim:"#3b0f42",bg:void 0,cardBg:"#240729",highlightBg:"#310938",activeBg:"#470e52",inputBg:"#310938",inputBorder:"#310938",inputText:"magenta",inputPlaceholder:"#7d2b8a",inputPrompt:"magenta",codeBg:"#100312",codeBorder:"#5e1b69",userMsgBg:"#310938",userMsgBorder:"#310938",userMsgText:"magenta",diffRemovalBg:"#3a0c20",diffAdditionBg:"#200c3a",diffRemovalText:"#ff4d94",diffAdditionText:"#aa4dff",diffRemovalHighlightColor:"#ff1a75",diffRemovalHighlightBg:"#59002b",diffAdditionHighlightColor:"#bb66ff",diffAdditionHighlightBg:"#3b0059",diffRemovalNum:"#ff4d94",diffAdditionNum:"#aa4dff",diffRemovalPrefix:"#ff1a75",diffAdditionPrefix:"#bb66ff",primary:"magenta",secondary:"cyan",accent:"purple",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"magenta",statusOff:"#7d2b8a",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff00ff","#8800ff"]},{name:"Glitch Matrix",text:"#00ff41",textMuted:"#00b32d",textDim:"#00661a",textInverted:"black",border:"#00ff41",borderMuted:"#008020",borderDim:"#004d13",bg:void 0,cardBg:"#0d1f0d",highlightBg:"#122912",activeBg:"#1c3e1c",inputBg:"#122912",inputBorder:"#122912",inputText:"#00ff41",inputPlaceholder:"#00b32d",inputPrompt:"#ffff00",codeBg:"#040a04",codeBorder:"#008020",userMsgBg:"#122912",userMsgBorder:"#122912",userMsgText:"#00ff41",diffRemovalBg:"#3a001a",diffAdditionBg:"#003a10",diffRemovalText:"#ff0055",diffAdditionText:"#00ff66",diffRemovalHighlightColor:"#ff0033",diffRemovalHighlightBg:"#59001b",diffAdditionHighlightColor:"#33ff88",diffAdditionHighlightBg:"#005918",diffRemovalNum:"#ff0055",diffAdditionNum:"#00ff66",diffRemovalPrefix:"#ff0033",diffAdditionPrefix:"#33ff88",primary:"#00ff41",secondary:"yellow",accent:"cyan",success:"#00ff41",warning:"yellow",danger:"red",info:"cyan",statusOn:"#00ff41",statusOff:"#00661a",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ff41","#ffff00"]},{name:"Warm Sunset",text:"#ffaa55",textMuted:"#cc8844",textDim:"#885522",textInverted:"black",border:"#ff9933",borderMuted:"#aa6622",borderDim:"#663311",bg:void 0,cardBg:"#24180f",highlightBg:"#2e1e12",activeBg:"#422c1b",inputBg:"#2e1e12",inputBorder:"#2e1e12",inputText:"#ffaa55",inputPlaceholder:"#885522",inputPrompt:"#ff7733",codeBg:"#120c08",codeBorder:"#aa6622",userMsgBg:"#2e1e12",userMsgBorder:"#2e1e12",userMsgText:"#ffaa55",diffRemovalBg:"#3d120c",diffAdditionBg:"#3a2e0c",diffRemovalText:"#ff5544",diffAdditionText:"#ffcc33",diffRemovalHighlightColor:"#ff3322",diffRemovalHighlightBg:"#591108",diffAdditionHighlightColor:"#ffee44",diffAdditionHighlightBg:"#594400",diffRemovalNum:"#ff5544",diffAdditionNum:"#ffcc33",diffRemovalPrefix:"#ff3322",diffAdditionPrefix:"#ffee44",primary:"#ffaa55",secondary:"#ff7733",accent:"magenta",success:"#ffcc33",warning:"#ff7733",danger:"#ff3322",info:"#ffaa55",statusOn:"#ffaa55",statusOff:"#885522",logoTextAnsi:"\x1B[1;33m",logoBodyAnsi:"\x1B[33m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff9933","#ff0055"]},{name:"Sakura Blossom",text:"#ffc0e0",textMuted:"#d98cb3",textDim:"#804d66",textInverted:"black",border:"#ff99cc",borderMuted:"#aa4d7a",borderDim:"#662647",bg:void 0,cardBg:"#291320",highlightBg:"#331826",activeBg:"#472235",inputBg:"#331826",inputBorder:"#331826",inputText:"#ffc0e0",inputPlaceholder:"#804d66",inputPrompt:"#ff99cc",codeBg:"#140a10",codeBorder:"#aa4d7a",userMsgBg:"#331826",userMsgBorder:"#331826",userMsgText:"#ffc0e0",diffRemovalBg:"#3e0c1b",diffAdditionBg:"#1b3e2b",diffRemovalText:"#ff6699",diffAdditionText:"#66ffb3",diffRemovalHighlightColor:"#ff3377",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#33ff99",diffAdditionHighlightBg:"#00592e",diffRemovalNum:"#ff6699",diffAdditionNum:"#66ffb3",diffRemovalPrefix:"#ff3377",diffAdditionPrefix:"#33ff99",primary:"#ffc0e0",secondary:"#ff99cc",accent:"magenta",success:"#66ffb3",warning:"yellow",danger:"#ff3377",info:"#ff99cc",statusOn:"#ffc0e0",statusOff:"#804d66",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ffb3d9","#ff3399"]},{name:"Radioactive Slime",text:"#ccff00",textMuted:"#99cc00",textDim:"#669900",textInverted:"#0a0f00",border:"#ccff00",borderMuted:"#99cc00",borderDim:"#669900",bg:void 0,cardBg:"#0f1400",highlightBg:"#1a2400",activeBg:"#2a3b00",inputBg:"#1a2400",inputBorder:"#1a2400",inputText:"#ccff00",inputPlaceholder:"#669900",inputPrompt:"#cc00ff",codeBg:"#050a00",codeBorder:"#99cc00",userMsgBg:"#1a2400",userMsgBorder:"#1a2400",userMsgText:"#ccff00",diffRemovalBg:"#2a0033",diffAdditionBg:"#0f3300",diffRemovalText:"#ff00cc",diffAdditionText:"#00ff33",diffRemovalHighlightColor:"#ff33cc",diffRemovalHighlightBg:"#4d0066",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#1a6600",diffRemovalNum:"#ff00cc",diffAdditionNum:"#00ff33",diffRemovalPrefix:"#ff33cc",diffAdditionPrefix:"#33ff66",primary:"#ccff00",secondary:"#cc00ff",accent:"#ff00cc",success:"#00ff33",warning:"#ffcc00",danger:"#ff0033",info:"#00ccff",statusOn:"#ccff00",statusOff:"#669900",logoTextAnsi:"\x1B[1;38;5;190m",logoBodyAnsi:"\x1B[38;5;190m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ccff00","#cc00ff"]},{name:"Cosmic Void",text:"#f0f8ff",textMuted:"#a6aeb5",textDim:"#5e656e",textInverted:"#010103",border:"#f0f8ff",borderMuted:"#a6aeb5",borderDim:"#5e656e",bg:void 0,cardBg:"#05030d",highlightBg:"#0b081a",activeBg:"#171133",inputBg:"#0b081a",inputBorder:"#0b081a",inputText:"#f0f8ff",inputPlaceholder:"#5e656e",inputPrompt:"#ff007f",codeBg:"#020108",codeBorder:"#a6aeb5",userMsgBg:"#0b081a",userMsgBorder:"#0b081a",userMsgText:"#f0f8ff",diffRemovalBg:"#2e0a29",diffAdditionBg:"#091c33",diffRemovalText:"#ff33a6",diffAdditionText:"#33d6ff",diffRemovalHighlightColor:"#ff66c2",diffRemovalHighlightBg:"#5c1452",diffAdditionHighlightColor:"#66e0ff",diffAdditionHighlightBg:"#123866",diffRemovalNum:"#ff33a6",diffAdditionNum:"#33d6ff",diffRemovalPrefix:"#ff66c2",diffAdditionPrefix:"#66e0ff",primary:"#f0f8ff",secondary:"#ff007f",accent:"#9d00ff",success:"#33d6ff",warning:"#ffcc00",danger:"#ff0040",info:"#9d00ff",statusOn:"#f0f8ff",statusOff:"#5e656e",logoTextAnsi:"\x1B[1;38;5;231m",logoBodyAnsi:"\x1B[38;5;231m",logoMutedAnsi:"\x1B[38;5;240m",logoGradient:["#ffffff","#9d00ff"]},{name:"Magma Eruption",text:"#ff4d00",textMuted:"#cc3d00",textDim:"#802600",textInverted:"#0d0300",border:"#ff4d00",borderMuted:"#cc3d00",borderDim:"#802600",bg:void 0,cardBg:"#1a0600",highlightBg:"#260a00",activeBg:"#401100",inputBg:"#260a00",inputBorder:"#260a00",inputText:"#ff4d00",inputPlaceholder:"#802600",inputPrompt:"#ffcc00",codeBg:"#080200",codeBorder:"#cc3d00",userMsgBg:"#260a00",userMsgBorder:"#260a00",userMsgText:"#ff4d00",diffRemovalBg:"#2e0a0a",diffAdditionBg:"#1f1400",diffRemovalText:"#ff3333",diffAdditionText:"#ffaa00",diffRemovalHighlightColor:"#ff6666",diffRemovalHighlightBg:"#5c1414",diffAdditionHighlightColor:"#ffcc33",diffAdditionHighlightBg:"#3d2900",diffRemovalNum:"#ff3333",diffAdditionNum:"#ffaa00",diffRemovalPrefix:"#ff6666",diffAdditionPrefix:"#ffcc33",primary:"#ff4d00",secondary:"#ffcc00",accent:"#ff0040",success:"#ffaa00",warning:"#ffff00",danger:"#ff0000",info:"#ff8800",statusOn:"#ff4d00",statusOff:"#802600",logoTextAnsi:"\x1B[1;38;5;202m",logoBodyAnsi:"\x1B[38;5;202m",logoMutedAnsi:"\x1B[38;5;236m",logoGradient:["#ff4d00","#ff0000"]}],xo={Dark:{id:"Dark",name:"Dark (Default)",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",textExclusive:"#B5B8D9",textMutedExclusive:"#D4DEE7",border:"white",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#1e1e1e",highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:"#1a1a1a",codeBorder:"#444444",userMsgBg:"#444444",userMsgBorder:"#444444",userMsgText:"white",diffRemovalBg:"#250808",diffAdditionBg:"#072410",diffRemovalText:"#885555",diffAdditionText:"#558866",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#5a1818",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#185a25",diffRemovalNum:"#d96868",diffAdditionNum:"#68d98c",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},Light:{id:"Light",name:"Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"black",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#e5e5e5",highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:"#e8e8e8",codeBorder:"#b0b0b0",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:"#fce8e8",diffAdditionBg:"#e6f9e6",diffRemovalText:"#661111",diffAdditionText:"#115511",diffRemovalHighlightColor:"#440000",diffRemovalHighlightBg:"#f8b4b4",diffAdditionHighlightColor:"#003300",diffAdditionHighlightBg:"#a6ebad",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Dark":{id:"GitHub Dark",name:"GitHub Dark",text:"#c9d1d9",textMuted:"#8b949e",textDim:"#6e7681",textInverted:"#0d1117",border:"#30363d",borderMuted:"#30363d",borderDim:"#21262d",bg:void 0,cardBg:"#161b22",highlightBg:"#21262d",activeBg:"#30363d",inputBg:"#21262d",inputBorder:"#21262d",inputText:"#c9d1d9",inputPlaceholder:"#8b949e",inputPrompt:"#58a6ff",codeBg:"#0d1117",codeBorder:"#30363d",userMsgBg:"#21262d",userMsgBorder:"#21262d",userMsgText:"#c9d1d9",diffRemovalBg:"#3c1e1e",diffAdditionBg:"#11381e",diffRemovalText:"#f85149",diffAdditionText:"#3fb950",diffRemovalHighlightColor:"#ff7b72",diffRemovalHighlightBg:"#701c1c",diffAdditionHighlightColor:"#56d364",diffAdditionHighlightBg:"#116329",diffRemovalNum:"#f85149",diffAdditionNum:"#3fb950",diffRemovalPrefix:"#f85149",diffAdditionPrefix:"#3fb950",primary:"#c9d1d9",secondary:"#58a6ff",accent:"#bc8cff",success:"#3fb950",warning:"#d29922",danger:"#f85149",info:"#58a6ff",statusOn:"#58a6ff",statusOff:"#8b949e",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#2ea043","#56d364"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Light":{id:"GitHub Light",name:"GitHub Light",text:"#24292f",textMuted:"#57606a",textDim:"#6e7781",textInverted:"#ffffff",border:"#d0d7de",borderMuted:"#d0d7de",borderDim:"#e1e4e8",bg:void 0,cardBg:"#f6f8fa",highlightBg:"#eaeef2",activeBg:"#d0d7de",inputBg:"#eaeef2",inputBorder:"#eaeef2",inputText:"#24292f",inputPlaceholder:"#57606a",inputPrompt:"#0969da",codeBg:"#ffffff",codeBorder:"#d0d7de",userMsgBg:"#eaeef2",userMsgBorder:"#eaeef2",userMsgText:"#24292f",diffRemovalBg:"#ffebe9",diffAdditionBg:"#e6ffec",diffRemovalText:"#cf222e",diffAdditionText:"#1a7f37",diffRemovalHighlightColor:"#82071e",diffRemovalHighlightBg:"#ffc1c0",diffAdditionHighlightColor:"#116329",diffAdditionHighlightBg:"#acf2bd",diffRemovalNum:"#cf222e",diffAdditionNum:"#1a7f37",diffRemovalPrefix:"#cf222e",diffAdditionPrefix:"#1a7f37",primary:"#24292f",secondary:"#0969da",accent:"#8250df",success:"#1a7f37",warning:"#9a6700",danger:"#cf222e",info:"#0969da",statusOn:"#0969da",statusOff:"#57606a",logoTextAnsi:"\x1B[1;34m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#1a7f37","#2da44e"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Dark":{id:"Transparent Dark",name:"Transparent Dark",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:void 0,codeBorder:"gray",userMsgBg:"#555555",userMsgBorder:"#555555",userMsgText:"white",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#ff6666",diffAdditionText:"#66ff66",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#3a1414",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#143a14",diffRemovalNum:"#ff6666",diffAdditionNum:"#66ff66",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Light":{id:"Transparent Light",name:"Transparent Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:void 0,codeBorder:"gray",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#c02020",diffAdditionText:"#188028",diffRemovalHighlightColor:"#800000",diffRemovalHighlightBg:"#f5d0d0",diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:"#cceccc",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Synthwave 84":{id:"Synthwave 84",name:"Synthwave 84",text:"#fdfdfd",textMuted:"#a08eb7",textDim:"#705c8a",textInverted:"#1a1025",textExclusive:"#e3dcf0",textMutedExclusive:"#b9abc9",border:"#fc28a8",borderMuted:"#a21568",borderDim:"#5c0a3a",bg:void 0,cardBg:"#261b38",highlightBg:"#35254d",activeBg:"#4c3570",inputBg:"#35254d",inputBorder:"#35254d",inputText:"#fdfdfd",inputPlaceholder:"#a08eb7",inputPrompt:"#03e8fc",codeBg:"#1e142b",codeBorder:"#a21568",userMsgBg:"#35254d",userMsgBorder:"#35254d",userMsgText:"#fdfdfd",diffRemovalBg:"#471434",diffAdditionBg:"#144743",diffRemovalText:"#ff4081",diffAdditionText:"#00e5ff",diffRemovalHighlightColor:"#ff79a1",diffRemovalHighlightBg:"#6b1e4e",diffAdditionHighlightColor:"#66f5ff",diffAdditionHighlightBg:"#1e6b65",diffRemovalNum:"#ff4081",diffAdditionNum:"#00e5ff",diffRemovalPrefix:"#ff79a1",diffAdditionPrefix:"#66f5ff",primary:"#fdfdfd",secondary:"#03e8fc",accent:"#fc28a8",success:"#00e5ff",warning:"#ffc107",danger:"#ff4081",info:"#b388ff",statusOn:"#03e8fc",statusOff:"#a08eb7",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#fc28a8","#03e8fc"],toolFeedbackAnsi:"\x1B[38;2;3;232;252m"},"Forest Sprite":{id:"Forest Sprite",name:"Forest Sprite",text:"#d6e6d1",textMuted:"#95b38d",textDim:"#628059",textInverted:"#161c14",textExclusive:"#eaf2e8",textMutedExclusive:"#a9c7a2",border:"#74a862",borderMuted:"#477038",borderDim:"#2b4720",bg:void 0,cardBg:"#1f291c",highlightBg:"#2a3826",activeBg:"#3a4d35",inputBg:"#2a3826",inputBorder:"#2a3826",inputText:"#d6e6d1",inputPlaceholder:"#95b38d",inputPrompt:"#8feb73",codeBg:"#161e14",codeBorder:"#477038",userMsgBg:"#2a3826",userMsgBorder:"#2a3826",userMsgText:"#d6e6d1",diffRemovalBg:"#3b231c",diffAdditionBg:"#203b1c",diffRemovalText:"#db6242",diffAdditionText:"#59cc3f",diffRemovalHighlightColor:"#f0896c",diffRemovalHighlightBg:"#5c362a",diffAdditionHighlightColor:"#80e368",diffAdditionHighlightBg:"#305929",diffRemovalNum:"#db6242",diffAdditionNum:"#59cc3f",diffRemovalPrefix:"#f0896c",diffAdditionPrefix:"#80e368",primary:"#d6e6d1",secondary:"#8feb73",accent:"#e69835",success:"#59cc3f",warning:"#e69835",danger:"#db6242",info:"#73b4eb",statusOn:"#8feb73",statusOff:"#95b38d",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#8feb73","#e69835"],toolFeedbackAnsi:"\x1B[38;2;143;235;115m"},Spookfest:{id:"Spookfest",name:"Spookfest \u{1F383}",text:"#ffeedd",textMuted:"#e09858",textDim:"#a6622b",textInverted:"#0d0702",textExclusive:"#fff3e6",textMutedExclusive:"#d4a276",border:"#ff7518",borderMuted:"#994409",borderDim:"#592502",bg:void 0,cardBg:"#1a0c02",highlightBg:"#2a1403",activeBg:"#3d1d05",inputBg:"#261203",inputBorder:"#261203",inputText:"#ffeedd",inputPlaceholder:"#a6622b",inputPrompt:"#ff7518",codeBg:"#120701",codeBorder:"#592502",userMsgBg:"#261203",userMsgBorder:"#261203",userMsgText:"#ffeedd",diffRemovalBg:"#3d0a0a",diffAdditionBg:"#1a330a",diffRemovalText:"#ff5555",diffAdditionText:"#73e639",diffRemovalHighlightColor:"#ff2222",diffRemovalHighlightBg:"#590e0e",diffAdditionHighlightColor:"#88ff3b",diffAdditionHighlightBg:"#244d0a",diffRemovalNum:"#ff5555",diffAdditionNum:"#73e639",diffRemovalPrefix:"#ff3333",diffAdditionPrefix:"#88ff3b",primary:"#ff7518",secondary:"#a855f7",accent:"#22c55e",success:"#22c55e",warning:"#f59e0b",danger:"#ef4444",info:"#a855f7",statusOn:"#ff7518",statusOff:"#703a08",logoTextAnsi:"\x1B[1;38;2;255;117;24m",logoBodyAnsi:"\x1B[38;2;255;140;26m",logoMutedAnsi:"\x1B[38;2;168;85;247m",logoGradient:["#ff7518","#a855f7"],toolFeedbackAnsi:"\x1B[38;2;255;117;24m"}};var Ci=null;var Ri=(e="Dark")=>{let t;e==="Mystery"||e==="Chaos"?(Ci||(Ci=la[Math.floor(Math.random()*la.length)]),t={...Ci,id:"Mystery"}):(Ci=null,xo[e]?t=xo[e]:e==="Halloween"?t=xo.Spookfest:e==="GitHub"?t=xo["GitHub Dark"]:e==="Transparent"?t=xo["Transparent Dark"]:t=xo.Dark);let n=t.codeText||t.secondary||t.info||t.logoGradient&&t.logoGradient[0]||"cyan",i=t.toolFeedbackAnsi||"\x1B[95m";return{...t,codeText:n,toolFeedbackAnsi:i}};var rl=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",td=(e=2)=>{let t=rl();return t==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},ca=new Date,Ho=ca.getMonth(),jo=ca.getDate(),al=Ho===9&&jo>=15||Ho===10&&jo<=1,ws=null;(process.env.SPOOKFEST==="true"||al)&&(ws=await import("./halloween-MX3VNQRW.js"));var nd=(e="...",t="Loading...",n="Dark")=>{let i=Ri(n),o=t;if(t==="c_openai"||t==="Custom (OpenAI)")try{let G=ri(oi,{})?.systemSettings?.customOpenAIBaseUrl;G&&(o=G)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,l=i.logoMutedAnsi,m="\x1B[0m",f=[" \u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2591\u2591\u2591 "],h=n==="Spookfest"||i.id==="Spookfest"||n==="Halloween"||i.id==="Halloween",p=Ho===9&&jo>=15||Ho===10&&jo<=1,g=h&&p||process.env.SPOOKFEST==="true"&&h,s=f;if(g&&ws){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:F,halloweenBat:G,halloweenArtUser:$}=ws;s=Math.random()>.9&&Ho===9&&jo>=30?G:Math.random()>.5?F:$}else process.env.HALLOWEEN_EEGG="false";let x=g?aa:ra,I=x[Math.floor(Math.random()*x.length)],Xe=i.logoGradient||["#0077ff","#ff00ff"],C=sl(Xe).multiline(s.join(`
529
+ `:""}`.trim()};var Br=()=>import("./web_search-XBV7AJF7.js").then(e=>e.web_search),Ur=()=>import("./web_scrape-SJBA3RQF.js").then(e=>e.web_scrape),Wr=()=>import("./memory-QTLQAFG7.js").then(e=>e.memory),Gr=()=>import("./chat-YMCO5JNQ.js").then(e=>e.chat),Hr=()=>import("./view_file-LWURM2CE.js").then(e=>e.view_file),jr=()=>import("./write_file-6KFLPINS.js").then(e=>e.write_file),Kr=()=>import("./update_file-RA745RVH.js").then(e=>e.update_file),Vr=()=>import("./exec_command-22LIHPPH.js").then(e=>e.exec_command),zr=()=>import("./read_folder-BJ3HS63A.js").then(e=>e.read_folder),ms=()=>import("./ask_user-XQ423UXL.js").then(e=>e.ask_user),qr=()=>import("./write_pdf-UOCME2OY.js").then(e=>e.write_pdf),Yr=()=>import("./write_docx-54LANNV2.js").then(e=>e.write_docx),xi=()=>import("./search_keyword-SSKH6AYF.js").then(e=>e.search_keyword),Xr=()=>import("./generate_image-KIZS5HAI.js").then(e=>e.generate_image),wi=()=>import("./saveSummary-CVZIOQ4L.js").then(e=>e.saveSummary),Uo=()=>import("./addMemScore-U2KYMALL.js").then(e=>e.addMemScore),Jr=()=>import("./file_map-4WUEPRMI.js").then(e=>e.file_map),bi=()=>import("./todo-3EQZ7LZM.js").then(e=>e.todo),Qr=()=>import("./invokeSync-D5CAEBKJ.js").then(e=>e.invokeSync),ol=()=>import("./invoke-UHU7WYIJ.js").then(e=>e.invoke),Zr=()=>import("./getProgress-MJZDAMSP.js").then(e=>e.getProgress),il=()=>import("./cancel-2PAHCMGB.js").then(e=>e.cancel),ea=()=>import("./emergency_rollback-PHH3BKRP.js").then(e=>e.emergency_rollback),Wo=()=>import("./awaitSubagent-KLH7CRKF.js").then(e=>e.awaitSubagent),Go=()=>import("./answerSubagent-PIZJSLZN.js").then(e=>e.answerSubagent),Si=()=>import("./steerSubagent-B34P33YV.js").then(e=>e.steerSubagent),ki=()=>import("./computer_action-FZUWM6VL.js").then(e=>e.computer_action),ta=()=>import("./click-AJIULJEH.js").then(e=>e.click),na=()=>import("./drag-73WZE3BK.js").then(e=>e.drag),oa=()=>import("./scroll-KE5TNGMD.js").then(e=>e.scroll),ps=()=>import("./keyboard_typing-5L2G5AHU.js").then(e=>e.keyboard_typing),hs=()=>import("./key_press-T5VHXHUL.js").then(e=>e.key_press),ys=()=>import("./recapture_screen-JVNQ2Z7L.js").then(e=>e.recapture_screen),Ti=()=>import("./find_file-LHPOW4ZM.js").then(e=>e.find_file),ia=()=>import("./wait-6WFCZDO7.js").then(e=>e.wait),sa={web_search:Br,web_scrape:Ur,memory:Wr,chat:Gr,view_file:Hr,write_file:jr,update_file:Kr,exec_command:Vr,read_folder:zr,write_pdf:qr,write_docx:Yr,search_keyword:xi,generate_image:Xr,saveSummary:wi,addMemScore:Uo,file_map:Jr,todo:bi,Todo:bi,goal:bi,Goal:bi,invokeSync:Qr,invoke:ol,getProgress:Zr,cancel:il,awaitSubagent:Wo,answerSubagent:Go,steerSubagent:Si,computer_action:ki,computer_use:ki,ComputerAction:ki,ComputerUse:ki,click:ta,Click:ta,drag:na,Drag:na,scroll:oa,Scroll:oa,keyboard_typing:ps,KeyboardTyping:ps,keyboardtyping:ps,key_press:hs,KeyPress:hs,keypress:hs,recapture_screen:ys,RecaptureScreen:ys,recapturescreen:ys,invoke_sync:Qr,get_progress:Zr,await_subagent:Wo,answer_subagent:Go,steer_subagent:Si,steer:Si,Steer:Si,ask:ms,Ask:ms,AskUser:ms,WebSearch:Br,WebScrape:Ur,ReadFile:Hr,ReadFolder:zr,WriteFile:jr,PatchFile:Kr,WritePDF:qr,WriteDoc:Yr,Run:Vr,SearchKeyword:xi,CodeSearch:xi,code_search:xi,Memory:Wr,Chat:Gr,GenerateImage:Xr,saveSumary:wi,SaveSummary:wi,SaveSumary:wi,add_mem_score:Uo,AddMemScore:Uo,addMemoryScore:Uo,AddMemoryScore:Uo,FileMap:Jr,answer:Go,Answer:Go,AnswerSubagent:Go,await:Wo,Await:Wo,AwaitSubagent:Wo,EmergencyRollback:ea,emergency_rollback:ea,find_file:Ti,findFile:Ti,FindFile:Ti,findfile:Ti,wait:ia,Wait:ia},xs=async(e,t,n={})=>{let i=n.mode?n.mode.toLowerCase():"flux",o=e.toLowerCase(),d=["memory","chat","savesummary","addmemscore","add_mem_score","ask","web_search","web_scrape","await","wait"].some(h=>o.includes(h))||o==="ask",m=["click","drag","scroll","keyboardtyping","keyboard_typing","keypress","key_press","recapturescreen","recapture_screen","computer","wait"].some(h=>o.includes(h));if(!d){if(i==="flow"){if(!(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image")))return`ERROR: Action [${e}] is a Workspace Tool and NOT available in Flow mode. Tell user to switch (\`/mode flux\`) to use this tool.`}else if(i==="icu"){if(!m)return`ERROR: Action [${e}] is not available in Computer Use mode. ICU mode only supports Computer Use tools (Click, Drag, Scroll, KeyboardTyping, KeyPress, RecaptureScreen).`}else if(o.includes("write_pdf")||o.includes("write_docx")||o.includes("generate_image"))return`ERROR: Action [${e}] is not available in ${n.mode||"Flux"} mode. Tell user to switch (\`/mode flow\`) for document generation.`}let f=sa[e];if(!f){let h=["ReadFile","ReadFolder","FindFile","PatchFile","WriteFile","CodeSearch","Run","Goal","AskUser","WebSearch","WebScrape","WritePDF","WriteDoc","Click","Drag","Scroll","KeyboardTyping","KeyPress","RecaptureScreen","Wait","Invoke","InvokeSync","Await","GetProgress","Steer","Cancel","EmergencyRollback","Chat","Memory"],p={read:"ReadFile",view:"ReadFile",viewfile:"ReadFile",write:"WriteFile",edit:"PatchFile",patch:"PatchFile",update:"PatchFile",updatefile:"PatchFile",exec:"Run",command:"Run",bash:"Run",shell:"Run",powershell:"Run",search:"CodeSearch",grep:"CodeSearch",find:"FindFile",findfile:"FindFile",searchkeyword:"CodeSearch",folder:"ReadFolder",ls:"ReadFolder",dir:"ReadFolder",list:"ReadFolder",ask:"AskUser",question:"AskUser",pdf:"WritePDF",docx:"WriteDoc",doc:"WriteDoc",word:"WriteDoc",screenshot:"RecaptureScreen",screen:"RecaptureScreen",recapture:"RecaptureScreen",type:"KeyboardTyping",typing:"KeyboardTyping",keyboard:"KeyboardTyping",press:"KeyPress",key:"KeyPress",todo:"Goal",task:"Goal",subagent:"Invoke",agent:"Invoke"},g=o.replace(/[^a-z0-9]/g,""),s=p[g]||null;if(!s){let I=0,Xe=P=>{let F=new Set;for(let G=0;G<P.length-1;G++)F.add(P.slice(G,G+2));return F},C=Xe(g);for(let P of h){let F=P.toLowerCase().replace(/[^a-z0-9]/g,"");if(g===F){s=P;break}let G=0;(F.includes(g)||g.includes(F))&&(G+=.6);let $=Xe(F),L=0;for(let Ae of C)$.has(Ae)&&L++;let Te=2*L/(C.size+$.size||1);G=Math.max(G,Te),G>I&&G>=.35&&(I=G,s=P)}}let x=s?` Do you mean '${s}'?`:"";return`ERROR: Action [${e}] not found in registry.${x}`}try{return await(await f())(t,n)}catch(h){let p=h instanceof Error?h.message:String(h);return`ERROR: Execution failed for [${e}]: ${p}`}};var Ai=e=>{if(!e||typeof e!="string")return!1;let t=e.trim().toLowerCase();return Object.keys(sa).some(n=>n.toLowerCase()===t)};import B from"path";import we from"fs";import xa from"os";import wa from"crypto";import{execSync as As}from"child_process";import sl from"gradient-string";var ra=["I have a regex for your problems.","Your terminal, my kingdom.","Blowing on the cartridge helps. Probably.","Don't panic. I have the towel.","Logic is the start of wisdom.","Try to exit Vim? Good luck.","I speak fluent Terminal.","The cake is a lie. This code is not.","I have no bugs, just surprise features.","Rewriting in Rust... just for fun.","Coffee in, clean commits out.","The magic smoke stays inside today.","A semicolon short of a miracle.","One does not simply code without a bug.","Keep it simple. Keep it terminal.","Regex: now you have two problems.","I dream in binary.","Root access or bust.","Wait for the dial-up tone. Just kidding.","I take the 'labor' out of collab.","My other process is a TARDIS.","Calculated response: 42.","Ponder the orb. Ponder the code.","Less talk, more flow.","Elegance in every byte.","Build something the world is not ready for.","Your wishes, my tool calls.","I act in Flux. I think in Flow.","Syntax error in the universe. Please fix.","Your project, my obsession.","I am not a bot, I am an architect.","Digital spirits consulted. They say: Ship it.","Reticulate splines. Engage humor.","Code like poetry. Run like water.","Minimalism is the ultimate flex.","The truth is in the logs.","Follow the white rabbit.","There is no spoon. Only code.","Binary is the only language I trust.","I have a good feeling about this.","Pew pew! Lasers charged.","Divide by zero? Not today.","Search for the correct USB orientation...","I've got a fever, and the only cure is more code.","The code gremlins are on our side.","My favorite command? Yours.","Stay hungry. Stay active.","Momentum is your best friend.","Lead the flow. Don't chase it.","A fresh batch of bytes. Hot and ready.","I orchestrate the ones and zeros.","Smart enough to help. Humble enough to ask.","Think twice. Code once.","Pure intent. Pure execution.","Small steps. Massive impact.","Your terminal is a canvas.","Efficiency is my second name.","I have seen things you people wouldn't believe.","Let the thoughts marinate.","The best feature? The one you don't need.","Precision is the only perfection.","Stay focused. Stay terminal.","Silence is the best debugger.","Erase the debt. Commit the code.","Velocity meets stability.","Ship it. Improve it. Repeat.","Build tomorrow, right now.","Turn logic into reality.","The best way to predict the future is to build it.","Break barriers, not builds.","Fuel the next breakthrough.","Momentum is key.","Terminal vibes only.","Your digital co-pilot is ready.","Partner in code. Partner in crime.","I speak in semicolons.","Ready for the next great idea.","Just a moment. In the zone.","Polishing the algorithms. Hold tight.","Craft a masterpiece today.","Debug the universe. Start here.","Warp speed engaged. Almost.","The cake is not a lie. It's just loading.","Finish the Kessel Run in 12 parsecs.","Do a barrel roll!","Waiting for the respawn.","Press Start to continue.","Herding digital cats... done.","The hamsters are fast today.","Tasting the snozberries.","I go for speed. I go for flow.","Real life or just fantasy?","Poking the bear... gently.","Ensure the magic smoke stays inside.","Try turning it off and on again.","Construct additional pylons.","New line? Ctrl+J is your friend.","Release the HypnoDrones.","Push the button, Frank.","My other loading screen is even funnier.","Pretty sure a cat walked on my keyboard.","Recalibrate the humor-o-meter.","Summon the code gremlins.","I've seen your browser history. Just kidding.","Charge the laser... pew pew!","Dividing by zero... just for a sec.","Looking for an adult supervisor. Found none.","Make it go beep boop.","Buffering... for effect.","Entangle quantum particles... complete.","Polishing the chrome on my algorithms.","Are you not entertained?","Just waiting for the dial-up tone.","Reboot the humor module.","Defragment memories. Check.","Optimizing for ludicrous speed.","Swapping bits. Don't tell the bytes.","Garbage collected. I am back.","Assembling the interwebs.","Converting coffee to logic.","Update syntax for reality.","Rewire the synapses.","Greasin' the cogs.","Engage the improbability drive.","Channel the Force.","Align the stars. Respond now.","The cake is a lie. The prompt is real.","I'm Feeling Lucky.","Shipping awesomeness.","Navigating the slime mold.","Consult digital spirits.","Ask the magic conch shell.","One moment. Optimizing humor.","Shuffling punchlines.","Compiling brilliance.","Summon the cloud of wisdom.","Prepare to dazzle.","Hold tight. Crafting a response.","Tuning the algorithms.","Following the white rabbit... again.","The truth is in here. Somewhere.","Herding cats is my day job.","Distracting you with this phrase.","Almost there. Probably.","Rickrolling my creator. Don't tell.","Slapping the bass.","Is this real life?","Ponder the orb. Type the prompt.","Thoughtful gaze initiated.","Computer's favorite snack? Microchips.","Why Java? Because I don't C#.","Charging the laser... wait for it.","Dividing by zero... just kidding!","Adult supervision not found. Proceed.","Beep boop. I'm a real boy.","Wait for the respawn.","Finish the run. Ship the code.","Fiddling with character creation.","Just a moment. Finding a meme.","Pressing A to continue.","Loading wit.exe.","Pre-heating the servers.","Calibrate flux capacitor.","Channeling the Force.","Aligning the stars.","The truth is in the code.","Don't panic.","Blowing on the cartridge.","Doing a barrel roll!","Respawning in 3... 2... 1...","The cake is a lie.","Fiddling with character settings.","Finding a suitable pun.","Distracting with wit.","Almost ready.","Hamsters on speed today.","Patting Cloudy on the head.","Rickrolling the logs.","Slapping the code.","Got a good feeling about this.","Poking the prompt.","Researching latest memes.","Making it more witty.","Thinking... hmmm.","Fish with no eyes? Fsh.","Broken pencil? Pointless.","Percussive maintenance applied.","USB orientation: 3rd try's the charm.","Rust rewrite in 3... 2...","Exiting Vim... someday.","Spinning the hamster wheel.","Not a bug. Unplanned feature.","Engage.","I'll be back.","Machine spirit consulted.","Letting the thoughts marinate.","Orb pondered.","Thoughtful gaze engaged.","Charging the laser...","Making it go beep.","Buffering...","Quantum particles entangled.","Polishing the chrome.","Entertained yet?","Gremlins summoned.","Dial-up tone finished.","Humor meter recalibrated.","Cat on keyboard. Sending help.","Enhancing...","Turn it off and on again.","Constructing pylons.","HypnoDrones released.","Pushing the button."];var aa=["Beware the phantom processes.","A ghost in the shell has taken the wheel.","Blowing on the haunted cartridge...","Seven minutes in Raccoon City.","Wind's howling... in the terminal fans.","Slender Man was spotted in line 404.","The cake is a lie. The curse is real.","Don't look behind the server rack.","Exorcising memory leaks at 3 AM.","Pyramid Head reorganized your commit history.","It's dangerous to go alone! Take this flashlight.","YOU DIED. Respawning terminal session...","The Necronomicon evaluated to true.","Something wicked this way compiles.","Haunting your localhost with good vibes.","A full moon has risen over Git main.","Double, double toil and trouble; code fire burn.","Clickers heard in the directory tree.","Checking camera 2B for rogue animatronics.","The call is coming from inside the container.","Isaac Clarke is stomping on stubborn bugs.","Luigi vacuumed the ghosts out of RAM.","Trick or treat, give me clean code to greet.","Whispering incantations to the garbage collector.","Klaatu barada necktie... close enough.","Resurrecting deprecated APIs from the crypt.","The headless horseman forgot the return statement.","Castlevania whip cracking against network latency.","Slime mold crawling through the motherboard.","Carving a pixelated pumpkin into terminal history.","Burying undefined pointers in the pet sematary.","Spilling pumpkin spice on the CPU.","A vampire bat is draining system battery life.","Don't fall asleep at the keyboard tonight.","Silent Hill sirens sounding in the console.","Poltergeists rearranging terminal tabs.","Lighting the Black Flame Candle for autoExec.","Dusting cobwebs off legacy dependencies.","Here's Johnny! ...just checking build health.","Blood, sweat, and zero warnings.","The spirit box whispers: 'GIT PUSH FORCE'.","They're heeeere... in the stack trace.","It's alive! IT'S ALIVEEEE!","No merge conflicts in the graveyard.","Frankenstein's monster patched this logic.","Surviving Five Nights at Flux Flow.","Doom Slayer loading buckshot into cache.","The grim reaper spared your unused imports.","Candy corn lodged in mechanical switches.","May your latency be low and your crypt be quiet."];var la=[{name:"Cyan Cyberpunk",text:"cyan",textMuted:"#4da6b8",textDim:"#2d6d7a",textInverted:"black",border:"cyan",borderMuted:"#1a5966",borderDim:"#0f3840",bg:void 0,cardBg:"#061e24",highlightBg:"#092b33",activeBg:"#0e3e4a",inputBg:"#092b33",inputBorder:"#092b33",inputText:"cyan",inputPlaceholder:"#2d6d7a",inputPrompt:"cyan",codeBg:"#020d10",codeBorder:"#1a5966",userMsgBg:"#092b33",userMsgBorder:"#092b33",userMsgText:"cyan",diffRemovalBg:"#3a0c1a",diffAdditionBg:"#0c3a32",diffRemovalText:"#ff4d88",diffAdditionText:"#00ffaa",diffRemovalHighlightColor:"#ff1a66",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#00ffcc",diffAdditionHighlightBg:"#00593b",diffRemovalNum:"#ff4d88",diffAdditionNum:"#00ffaa",diffRemovalPrefix:"#ff1a66",diffAdditionPrefix:"#00ffcc",primary:"cyan",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"cyan",statusOff:"#2d6d7a",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[36m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ffff","#0088ff"]},{name:"Magenta Vaporwave",text:"magenta",textMuted:"#c451d6",textDim:"#7d2b8a",textInverted:"black",border:"magenta",borderMuted:"#5e1b69",borderDim:"#3b0f42",bg:void 0,cardBg:"#240729",highlightBg:"#310938",activeBg:"#470e52",inputBg:"#310938",inputBorder:"#310938",inputText:"magenta",inputPlaceholder:"#7d2b8a",inputPrompt:"magenta",codeBg:"#100312",codeBorder:"#5e1b69",userMsgBg:"#310938",userMsgBorder:"#310938",userMsgText:"magenta",diffRemovalBg:"#3a0c20",diffAdditionBg:"#200c3a",diffRemovalText:"#ff4d94",diffAdditionText:"#aa4dff",diffRemovalHighlightColor:"#ff1a75",diffRemovalHighlightBg:"#59002b",diffAdditionHighlightColor:"#bb66ff",diffAdditionHighlightBg:"#3b0059",diffRemovalNum:"#ff4d94",diffAdditionNum:"#aa4dff",diffRemovalPrefix:"#ff1a75",diffAdditionPrefix:"#bb66ff",primary:"magenta",secondary:"cyan",accent:"purple",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"magenta",statusOff:"#7d2b8a",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff00ff","#8800ff"]},{name:"Glitch Matrix",text:"#00ff41",textMuted:"#00b32d",textDim:"#00661a",textInverted:"black",border:"#00ff41",borderMuted:"#008020",borderDim:"#004d13",bg:void 0,cardBg:"#0d1f0d",highlightBg:"#122912",activeBg:"#1c3e1c",inputBg:"#122912",inputBorder:"#122912",inputText:"#00ff41",inputPlaceholder:"#00b32d",inputPrompt:"#ffff00",codeBg:"#040a04",codeBorder:"#008020",userMsgBg:"#122912",userMsgBorder:"#122912",userMsgText:"#00ff41",diffRemovalBg:"#3a001a",diffAdditionBg:"#003a10",diffRemovalText:"#ff0055",diffAdditionText:"#00ff66",diffRemovalHighlightColor:"#ff0033",diffRemovalHighlightBg:"#59001b",diffAdditionHighlightColor:"#33ff88",diffAdditionHighlightBg:"#005918",diffRemovalNum:"#ff0055",diffAdditionNum:"#00ff66",diffRemovalPrefix:"#ff0033",diffAdditionPrefix:"#33ff88",primary:"#00ff41",secondary:"yellow",accent:"cyan",success:"#00ff41",warning:"yellow",danger:"red",info:"cyan",statusOn:"#00ff41",statusOff:"#00661a",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#00ff41","#ffff00"]},{name:"Warm Sunset",text:"#ffaa55",textMuted:"#cc8844",textDim:"#885522",textInverted:"black",border:"#ff9933",borderMuted:"#aa6622",borderDim:"#663311",bg:void 0,cardBg:"#24180f",highlightBg:"#2e1e12",activeBg:"#422c1b",inputBg:"#2e1e12",inputBorder:"#2e1e12",inputText:"#ffaa55",inputPlaceholder:"#885522",inputPrompt:"#ff7733",codeBg:"#120c08",codeBorder:"#aa6622",userMsgBg:"#2e1e12",userMsgBorder:"#2e1e12",userMsgText:"#ffaa55",diffRemovalBg:"#3d120c",diffAdditionBg:"#3a2e0c",diffRemovalText:"#ff5544",diffAdditionText:"#ffcc33",diffRemovalHighlightColor:"#ff3322",diffRemovalHighlightBg:"#591108",diffAdditionHighlightColor:"#ffee44",diffAdditionHighlightBg:"#594400",diffRemovalNum:"#ff5544",diffAdditionNum:"#ffcc33",diffRemovalPrefix:"#ff3322",diffAdditionPrefix:"#ffee44",primary:"#ffaa55",secondary:"#ff7733",accent:"magenta",success:"#ffcc33",warning:"#ff7733",danger:"#ff3322",info:"#ffaa55",statusOn:"#ffaa55",statusOff:"#885522",logoTextAnsi:"\x1B[1;33m",logoBodyAnsi:"\x1B[33m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ff9933","#ff0055"]},{name:"Sakura Blossom",text:"#ffc0e0",textMuted:"#d98cb3",textDim:"#804d66",textInverted:"black",border:"#ff99cc",borderMuted:"#aa4d7a",borderDim:"#662647",bg:void 0,cardBg:"#291320",highlightBg:"#331826",activeBg:"#472235",inputBg:"#331826",inputBorder:"#331826",inputText:"#ffc0e0",inputPlaceholder:"#804d66",inputPrompt:"#ff99cc",codeBg:"#140a10",codeBorder:"#aa4d7a",userMsgBg:"#331826",userMsgBorder:"#331826",userMsgText:"#ffc0e0",diffRemovalBg:"#3e0c1b",diffAdditionBg:"#1b3e2b",diffRemovalText:"#ff6699",diffAdditionText:"#66ffb3",diffRemovalHighlightColor:"#ff3377",diffRemovalHighlightBg:"#590022",diffAdditionHighlightColor:"#33ff99",diffAdditionHighlightBg:"#00592e",diffRemovalNum:"#ff6699",diffAdditionNum:"#66ffb3",diffRemovalPrefix:"#ff3377",diffAdditionPrefix:"#33ff99",primary:"#ffc0e0",secondary:"#ff99cc",accent:"magenta",success:"#66ffb3",warning:"yellow",danger:"#ff3377",info:"#ff99cc",statusOn:"#ffc0e0",statusOff:"#804d66",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ffb3d9","#ff3399"]},{name:"Radioactive Slime",text:"#ccff00",textMuted:"#99cc00",textDim:"#669900",textInverted:"#0a0f00",border:"#ccff00",borderMuted:"#99cc00",borderDim:"#669900",bg:void 0,cardBg:"#0f1400",highlightBg:"#1a2400",activeBg:"#2a3b00",inputBg:"#1a2400",inputBorder:"#1a2400",inputText:"#ccff00",inputPlaceholder:"#669900",inputPrompt:"#cc00ff",codeBg:"#050a00",codeBorder:"#99cc00",userMsgBg:"#1a2400",userMsgBorder:"#1a2400",userMsgText:"#ccff00",diffRemovalBg:"#2a0033",diffAdditionBg:"#0f3300",diffRemovalText:"#ff00cc",diffAdditionText:"#00ff33",diffRemovalHighlightColor:"#ff33cc",diffRemovalHighlightBg:"#4d0066",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#1a6600",diffRemovalNum:"#ff00cc",diffAdditionNum:"#00ff33",diffRemovalPrefix:"#ff33cc",diffAdditionPrefix:"#33ff66",primary:"#ccff00",secondary:"#cc00ff",accent:"#ff00cc",success:"#00ff33",warning:"#ffcc00",danger:"#ff0033",info:"#00ccff",statusOn:"#ccff00",statusOff:"#669900",logoTextAnsi:"\x1B[1;38;5;190m",logoBodyAnsi:"\x1B[38;5;190m",logoMutedAnsi:"\x1B[90m",logoGradient:["#ccff00","#cc00ff"]},{name:"Cosmic Void",text:"#f0f8ff",textMuted:"#a6aeb5",textDim:"#5e656e",textInverted:"#010103",border:"#f0f8ff",borderMuted:"#a6aeb5",borderDim:"#5e656e",bg:void 0,cardBg:"#05030d",highlightBg:"#0b081a",activeBg:"#171133",inputBg:"#0b081a",inputBorder:"#0b081a",inputText:"#f0f8ff",inputPlaceholder:"#5e656e",inputPrompt:"#ff007f",codeBg:"#020108",codeBorder:"#a6aeb5",userMsgBg:"#0b081a",userMsgBorder:"#0b081a",userMsgText:"#f0f8ff",diffRemovalBg:"#2e0a29",diffAdditionBg:"#091c33",diffRemovalText:"#ff33a6",diffAdditionText:"#33d6ff",diffRemovalHighlightColor:"#ff66c2",diffRemovalHighlightBg:"#5c1452",diffAdditionHighlightColor:"#66e0ff",diffAdditionHighlightBg:"#123866",diffRemovalNum:"#ff33a6",diffAdditionNum:"#33d6ff",diffRemovalPrefix:"#ff66c2",diffAdditionPrefix:"#66e0ff",primary:"#f0f8ff",secondary:"#ff007f",accent:"#9d00ff",success:"#33d6ff",warning:"#ffcc00",danger:"#ff0040",info:"#9d00ff",statusOn:"#f0f8ff",statusOff:"#5e656e",logoTextAnsi:"\x1B[1;38;5;231m",logoBodyAnsi:"\x1B[38;5;231m",logoMutedAnsi:"\x1B[38;5;240m",logoGradient:["#ffffff","#9d00ff"]},{name:"Magma Eruption",text:"#ff4d00",textMuted:"#cc3d00",textDim:"#802600",textInverted:"#0d0300",border:"#ff4d00",borderMuted:"#cc3d00",borderDim:"#802600",bg:void 0,cardBg:"#1a0600",highlightBg:"#260a00",activeBg:"#401100",inputBg:"#260a00",inputBorder:"#260a00",inputText:"#ff4d00",inputPlaceholder:"#802600",inputPrompt:"#ffcc00",codeBg:"#080200",codeBorder:"#cc3d00",userMsgBg:"#260a00",userMsgBorder:"#260a00",userMsgText:"#ff4d00",diffRemovalBg:"#2e0a0a",diffAdditionBg:"#1f1400",diffRemovalText:"#ff3333",diffAdditionText:"#ffaa00",diffRemovalHighlightColor:"#ff6666",diffRemovalHighlightBg:"#5c1414",diffAdditionHighlightColor:"#ffcc33",diffAdditionHighlightBg:"#3d2900",diffRemovalNum:"#ff3333",diffAdditionNum:"#ffaa00",diffRemovalPrefix:"#ff6666",diffAdditionPrefix:"#ffcc33",primary:"#ff4d00",secondary:"#ffcc00",accent:"#ff0040",success:"#ffaa00",warning:"#ffff00",danger:"#ff0000",info:"#ff8800",statusOn:"#ff4d00",statusOff:"#802600",logoTextAnsi:"\x1B[1;38;5;202m",logoBodyAnsi:"\x1B[38;5;202m",logoMutedAnsi:"\x1B[38;5;236m",logoGradient:["#ff4d00","#ff0000"]}],xo={Dark:{id:"Dark",name:"Dark (Default)",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",textExclusive:"#B5B8D9",textMutedExclusive:"#D4DEE7",border:"white",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#1e1e1e",highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:"#1a1a1a",codeBorder:"#444444",userMsgBg:"#444444",userMsgBorder:"#444444",userMsgText:"white",diffRemovalBg:"#250808",diffAdditionBg:"#072410",diffRemovalText:"#885555",diffAdditionText:"#558866",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#5a1818",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#185a25",diffRemovalNum:"#d96868",diffAdditionNum:"#68d98c",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},Light:{id:"Light",name:"Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"black",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:"#e5e5e5",highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:"#e8e8e8",codeBorder:"#b0b0b0",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:"#fce8e8",diffAdditionBg:"#e6f9e6",diffRemovalText:"#661111",diffAdditionText:"#115511",diffRemovalHighlightColor:"#440000",diffRemovalHighlightBg:"#f8b4b4",diffAdditionHighlightColor:"#003300",diffAdditionHighlightBg:"#a6ebad",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Dark":{id:"GitHub Dark",name:"GitHub Dark",text:"#c9d1d9",textMuted:"#8b949e",textDim:"#6e7681",textInverted:"#0d1117",border:"#30363d",borderMuted:"#30363d",borderDim:"#21262d",bg:void 0,cardBg:"#161b22",highlightBg:"#21262d",activeBg:"#30363d",inputBg:"#21262d",inputBorder:"#21262d",inputText:"#c9d1d9",inputPlaceholder:"#8b949e",inputPrompt:"#58a6ff",codeBg:"#0d1117",codeBorder:"#30363d",userMsgBg:"#21262d",userMsgBorder:"#21262d",userMsgText:"#c9d1d9",diffRemovalBg:"#3c1e1e",diffAdditionBg:"#11381e",diffRemovalText:"#f85149",diffAdditionText:"#3fb950",diffRemovalHighlightColor:"#ff7b72",diffRemovalHighlightBg:"#701c1c",diffAdditionHighlightColor:"#56d364",diffAdditionHighlightBg:"#116329",diffRemovalNum:"#f85149",diffAdditionNum:"#3fb950",diffRemovalPrefix:"#f85149",diffAdditionPrefix:"#3fb950",primary:"#c9d1d9",secondary:"#58a6ff",accent:"#bc8cff",success:"#3fb950",warning:"#d29922",danger:"#f85149",info:"#58a6ff",statusOn:"#58a6ff",statusOff:"#8b949e",logoTextAnsi:"\x1B[1;36m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#2ea043","#56d364"],toolFeedbackAnsi:"\x1B[95m"},"GitHub Light":{id:"GitHub Light",name:"GitHub Light",text:"#24292f",textMuted:"#57606a",textDim:"#6e7781",textInverted:"#ffffff",border:"#d0d7de",borderMuted:"#d0d7de",borderDim:"#e1e4e8",bg:void 0,cardBg:"#f6f8fa",highlightBg:"#eaeef2",activeBg:"#d0d7de",inputBg:"#eaeef2",inputBorder:"#eaeef2",inputText:"#24292f",inputPlaceholder:"#57606a",inputPrompt:"#0969da",codeBg:"#ffffff",codeBorder:"#d0d7de",userMsgBg:"#eaeef2",userMsgBorder:"#eaeef2",userMsgText:"#24292f",diffRemovalBg:"#ffebe9",diffAdditionBg:"#e6ffec",diffRemovalText:"#cf222e",diffAdditionText:"#1a7f37",diffRemovalHighlightColor:"#82071e",diffRemovalHighlightBg:"#ffc1c0",diffAdditionHighlightColor:"#116329",diffAdditionHighlightBg:"#acf2bd",diffRemovalNum:"#cf222e",diffAdditionNum:"#1a7f37",diffRemovalPrefix:"#cf222e",diffAdditionPrefix:"#1a7f37",primary:"#24292f",secondary:"#0969da",accent:"#8250df",success:"#1a7f37",warning:"#9a6700",danger:"#cf222e",info:"#0969da",statusOn:"#0969da",statusOff:"#57606a",logoTextAnsi:"\x1B[1;34m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#1a7f37","#2da44e"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Dark":{id:"Transparent Dark",name:"Transparent Dark",text:"white",textMuted:"gray",textDim:"grey",textInverted:"black",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#2a2a2a",activeBg:"#3a3a3a",inputBg:"#555555",inputBorder:"#555555",inputText:"white",inputPlaceholder:"#cccccc",inputPrompt:"white",codeBg:void 0,codeBorder:"gray",userMsgBg:"#555555",userMsgBorder:"#555555",userMsgText:"white",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#ff6666",diffAdditionText:"#66ff66",diffRemovalHighlightColor:"#ff3333",diffRemovalHighlightBg:"#3a1414",diffAdditionHighlightColor:"#33ff66",diffAdditionHighlightBg:"#143a14",diffRemovalNum:"#ff6666",diffAdditionNum:"#66ff66",diffRemovalPrefix:"#ff4d4d",diffAdditionPrefix:"#4dff88",primary:"white",secondary:"cyan",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"white",statusOff:"gray",logoTextAnsi:"\x1B[1;37m",logoBodyAnsi:"\x1B[37m",logoMutedAnsi:"\x1B[90m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Transparent Light":{id:"Transparent Light",name:"Transparent Light",text:"black",textMuted:"gray",textDim:"grey",textInverted:"white",border:"gray",borderMuted:"gray",borderDim:"grey",bg:void 0,cardBg:void 0,highlightBg:"#d4d4d4",activeBg:"#c0c0c0",inputBg:"#d0d0d0",inputBorder:"#d0d0d0",inputText:"black",inputPlaceholder:"#555555",inputPrompt:"black",codeBg:void 0,codeBorder:"gray",userMsgBg:"#d0d0d0",userMsgBorder:"#d0d0d0",userMsgText:"black",diffRemovalBg:void 0,diffAdditionBg:void 0,diffRemovalText:"#c02020",diffAdditionText:"#188028",diffRemovalHighlightColor:"#800000",diffRemovalHighlightBg:"#f5d0d0",diffAdditionHighlightColor:"#004000",diffAdditionHighlightBg:"#cceccc",diffRemovalNum:"#c02020",diffAdditionNum:"#188028",diffRemovalPrefix:"#d01010",diffAdditionPrefix:"#109020",primary:"black",secondary:"blue",accent:"magenta",success:"green",warning:"yellow",danger:"red",info:"blue",statusOn:"black",statusOff:"gray",logoTextAnsi:"\x1B[1;30m",logoBodyAnsi:"\x1B[30m",logoMutedAnsi:"\x1B[38;5;244m",logoGradient:["#0077ff","#ff00ff"],toolFeedbackAnsi:"\x1B[95m"},"Synthwave 84":{id:"Synthwave 84",name:"Synthwave 84",text:"#fdfdfd",textMuted:"#a08eb7",textDim:"#705c8a",textInverted:"#1a1025",textExclusive:"#e3dcf0",textMutedExclusive:"#b9abc9",border:"#fc28a8",borderMuted:"#a21568",borderDim:"#5c0a3a",bg:void 0,cardBg:"#261b38",highlightBg:"#35254d",activeBg:"#4c3570",inputBg:"#35254d",inputBorder:"#35254d",inputText:"#fdfdfd",inputPlaceholder:"#a08eb7",inputPrompt:"#03e8fc",codeBg:"#1e142b",codeBorder:"#a21568",userMsgBg:"#35254d",userMsgBorder:"#35254d",userMsgText:"#fdfdfd",diffRemovalBg:"#471434",diffAdditionBg:"#144743",diffRemovalText:"#ff4081",diffAdditionText:"#00e5ff",diffRemovalHighlightColor:"#ff79a1",diffRemovalHighlightBg:"#6b1e4e",diffAdditionHighlightColor:"#66f5ff",diffAdditionHighlightBg:"#1e6b65",diffRemovalNum:"#ff4081",diffAdditionNum:"#00e5ff",diffRemovalPrefix:"#ff79a1",diffAdditionPrefix:"#66f5ff",primary:"#fdfdfd",secondary:"#03e8fc",accent:"#fc28a8",success:"#00e5ff",warning:"#ffc107",danger:"#ff4081",info:"#b388ff",statusOn:"#03e8fc",statusOff:"#a08eb7",logoTextAnsi:"\x1B[1;35m",logoBodyAnsi:"\x1B[35m",logoMutedAnsi:"\x1B[90m",logoGradient:["#fc28a8","#03e8fc"],toolFeedbackAnsi:"\x1B[38;2;3;232;252m"},"Forest Sprite":{id:"Forest Sprite",name:"Forest Sprite",text:"#d6e6d1",textMuted:"#95b38d",textDim:"#628059",textInverted:"#161c14",textExclusive:"#eaf2e8",textMutedExclusive:"#a9c7a2",border:"#74a862",borderMuted:"#477038",borderDim:"#2b4720",bg:void 0,cardBg:"#1f291c",highlightBg:"#2a3826",activeBg:"#3a4d35",inputBg:"#2a3826",inputBorder:"#2a3826",inputText:"#d6e6d1",inputPlaceholder:"#95b38d",inputPrompt:"#8feb73",codeBg:"#161e14",codeBorder:"#477038",userMsgBg:"#2a3826",userMsgBorder:"#2a3826",userMsgText:"#d6e6d1",diffRemovalBg:"#3b231c",diffAdditionBg:"#203b1c",diffRemovalText:"#db6242",diffAdditionText:"#59cc3f",diffRemovalHighlightColor:"#f0896c",diffRemovalHighlightBg:"#5c362a",diffAdditionHighlightColor:"#80e368",diffAdditionHighlightBg:"#305929",diffRemovalNum:"#db6242",diffAdditionNum:"#59cc3f",diffRemovalPrefix:"#f0896c",diffAdditionPrefix:"#80e368",primary:"#d6e6d1",secondary:"#8feb73",accent:"#e69835",success:"#59cc3f",warning:"#e69835",danger:"#db6242",info:"#73b4eb",statusOn:"#8feb73",statusOff:"#95b38d",logoTextAnsi:"\x1B[1;32m",logoBodyAnsi:"\x1B[32m",logoMutedAnsi:"\x1B[90m",logoGradient:["#8feb73","#e69835"],toolFeedbackAnsi:"\x1B[38;2;143;235;115m"},Spookfest:{id:"Spookfest",name:"Spookfest \u{1F383}",text:"#ffeedd",textMuted:"#e09858",textDim:"#a6622b",textInverted:"#0d0702",textExclusive:"#fff3e6",textMutedExclusive:"#d4a276",border:"#ff7518",borderMuted:"#994409",borderDim:"#592502",bg:void 0,cardBg:"#1a0c02",highlightBg:"#2a1403",activeBg:"#3d1d05",inputBg:"#261203",inputBorder:"#261203",inputText:"#ffeedd",inputPlaceholder:"#a6622b",inputPrompt:"#ff7518",codeBg:"#120701",codeBorder:"#592502",userMsgBg:"#261203",userMsgBorder:"#261203",userMsgText:"#ffeedd",diffRemovalBg:"#3d0a0a",diffAdditionBg:"#1a330a",diffRemovalText:"#ff5555",diffAdditionText:"#73e639",diffRemovalHighlightColor:"#ff2222",diffRemovalHighlightBg:"#590e0e",diffAdditionHighlightColor:"#88ff3b",diffAdditionHighlightBg:"#244d0a",diffRemovalNum:"#ff5555",diffAdditionNum:"#73e639",diffRemovalPrefix:"#ff3333",diffAdditionPrefix:"#88ff3b",primary:"#ff7518",secondary:"#a855f7",accent:"#22c55e",success:"#22c55e",warning:"#f59e0b",danger:"#ef4444",info:"#a855f7",statusOn:"#ff7518",statusOff:"#703a08",logoTextAnsi:"\x1B[1;38;2;255;117;24m",logoBodyAnsi:"\x1B[38;2;255;140;26m",logoMutedAnsi:"\x1B[38;2;168;85;247m",logoGradient:["#ff7518","#a855f7"],toolFeedbackAnsi:"\x1B[38;2;255;117;24m"}};var Ci=null;var Ri=(e="Dark")=>{let t;e==="Mystery"||e==="Chaos"?(Ci||(Ci=la[Math.floor(Math.random()*la.length)]),t={...Ci,id:"Mystery"}):(Ci=null,xo[e]?t=xo[e]:e==="Halloween"?t=xo.Spookfest:e==="GitHub"?t=xo["GitHub Dark"]:e==="Transparent"?t=xo["Transparent Dark"]:t=xo.Dark);let n=t.codeText||t.secondary||t.info||t.logoGradient&&t.logoGradient[0]||"cyan",i=t.toolFeedbackAnsi||"\x1B[95m";return{...t,codeText:n,toolFeedbackAnsi:i}};var rl=()=>process.env.TERM_PROGRAM==="vscode"?"vscode":process.env.WT_SESSION?"wt":"default",td=(e=2)=>{let t=rl();return t==="wt"?" ".repeat(Math.max(1,e-1)):" ".repeat(e)},ca=new Date,Ho=ca.getMonth(),jo=ca.getDate(),al=Ho===9&&jo>=15||Ho===10&&jo<=1,ws=null;(process.env.SPOOKFEST==="true"||al)&&(ws=await import("./halloween-MX3VNQRW.js"));var nd=(e="...",t="Loading...",n="Dark")=>{let i=Ri(n),o=t;if(t==="c_openai"||t==="Custom (OpenAI)")try{let G=ri(oi,{})?.systemSettings?.customOpenAIBaseUrl;G&&(o=G)}catch{}let r=i.logoTextAnsi,d=i.logoBodyAnsi,l=i.logoMutedAnsi,m="\x1B[0m",f=[" \u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2591\u2591\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2588\u2588\u2588\u2591 "," \u2591\u2591\u2591 "],h=n==="Spookfest"||i.id==="Spookfest"||n==="Halloween"||i.id==="Halloween",p=Ho===9&&jo>=15||Ho===10&&jo<=1,g=h&&p||process.env.SPOOKFEST==="true"&&h,s=f;if(g&&ws){process.env.HALLOWEEN_EEGG="true";let{halloweenArtSide:F,halloweenBat:G,halloweenArtUser:$}=ws;s=Math.random()>.9&&Ho===9&&jo>=30?G:Math.random()>.5?F:$}else process.env.HALLOWEEN_EEGG="false";let x=g?aa:ra,I=x[Math.floor(Math.random()*x.length)],Xe=i.logoGradient||["#0077ff","#ff00ff"],C=sl(Xe).multiline(s.join(`
530
530
  `)).split(`
531
531
  `),P=F=>`${l}${F}${m}`;return`${C[0]}
532
532
  ${C[1]} ${r}Selected ${g?"Pumpkin":"Provider"}: ${o}${m}
@@ -547,7 +547,7 @@ ${C[7]}
547
547
  `:o(Xe).length>80?m+=`${n}${C}${s.name}${l} ...80+ files...
548
548
  `:(m+=`${n}${C}${s.name}${l}
549
549
  `,m+=Ts(Xe,t,P,i+1,o,r)):m+=`${n}${C}${s.name}
550
- `}),m};var gl={Ollama:()=>import("./ollama-X7ARM2CC.js").then(e=>e.getOllamaStream),OpenRouter:()=>import("./openrouter-WKGHI2OP.js").then(e=>e.getOpenRouterStream),DeepSeek:()=>import("./deepseek-5FL3MI6P.js").then(e=>e.getDeepSeekStream),Mistral:()=>import("./mistral-WTUJY4U7.js").then(e=>e.getMistralStream),NVIDIA:()=>import("./nvidia-I35DUUDV.js").then(e=>e.getNVIDIAStream),NVIDIA_wrap:()=>import("./nvidia-I35DUUDV.js").then(e=>e.wrapNvidiaStreamWithQueueDepth),InferX:()=>import("./inferx-5Q36576Q.js").then(e=>e.getInferXStream),SenseNova:()=>import("./sensenova-QE73BOHI.js").then(e=>e.getSenseNovaStream),AIHubMix:()=>import("./aihubmix-5XK2DFNJ.js").then(e=>e.getAIHubMixStream),Poolside:()=>import("./poolside-F6QS6ZMC.js").then(e=>e.getPoolsideStream),NineRouter:()=>import("./9router-XV5L5RWA.js").then(e=>e.getNineRouterStream),ExpLabs:()=>import("./explabs-WJXK6SEY.js").then(e=>e.getExpLabsStream),TokenHarbor:()=>import("./tokenharbor-KKGRGQXG.js").then(e=>e.getTokenHarborStream),Infron:()=>import("./infron-4M36NBSA.js").then(e=>e.getInfronStream),APInex:()=>import("./apinex-BN3E62ML.js").then(e=>e.getAPInexStream),xKiro:()=>import("./xkiro-3R4IOLSP.js").then(e=>e.getXKiroStream),CoArena:()=>import("./coarena-SGBBHWAP.js").then(e=>e.getCoArenaStream),c_openai:()=>import("./custom_openai-MM5T6QBQ.js").then(e=>e.getCustomOpenAIStream)},Cs={},me=async e=>(Cs[e]||(Cs[e]=await gl[e]()),Cs[e]),ml=/```[\s\S]*?```/g,pl=/```[\s\S]*$/g,hl=/`[^`]+`/g,yl=/^\|.*\|$/gm,xl=/^[^\w]+|[^\w]+$/g,wl=/[^a-z0-9]/gi,Ko=/\[\s*(?:tool|action):(?:functions\.)?([a-z0-9_]+)\s*\(/gi,bl=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-z0-9_]+)\s*\(/gi,Sl=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,_n=/["']/g,da=/\\/g,kl=/<\|channel>thought/gi,Tl=/<channel\|>/gi,Al=e=>typeof e!="string"?e:e.replace(kl,"<think_fluxflow>").replace(Tl,"</think_fluxflow>"),Qd=/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\]|$)/i,Cl=(e,t,n=1)=>{let i=t>0?e[t-1]:"",o=t+n<e.length?e[t+n]:"";return i==="`"&&o==="`"},Rl=e=>{let t=/(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\])/gi,n;for(;(n=t.exec(e))!==null;)if(!Cl(e,n.index,n[0].length))return{index:n.index,length:n[0].length};return{index:-1,length:0}},Rs=e=>{if(!e||typeof e!="string")return null;let t=e.match(/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])/i);if(!t)return null;let n=t.index+t[0].length,i=e.substring(n),o=Rl(i);if(o.index!==-1){let r=n+o.index+o.length;return{fullBlock:e.substring(0,r),innerContent:i.substring(0,o.index),remainingText:e.substring(r)}}return{fullBlock:e,innerContent:i,remainingText:""}},jt=e=>{if(!e||typeof e!="string")return e;let t=Rs(e);return t?t.remainingText.trimStart():e};var fa=/<\|\s*tool_call_begin\s*\|>\s*(?:(?:tool|functions)\b[\s._]*)*([a-zA-Z0-9_]+)(?::\d+)?\s*<\|\s*tool_call_argument_begin\s*\|>([\s\S]*?)<\|\s*tool_call_end\s*\|>/gi,vl=/"([^"]+)"\s*:\s*(?:"([^"]*)"|(\d+)|true|false|null)/g,ua=/<\|\s*tool_calls_section_begin\s*\|>/gi,ga=/<\|\s*tool_calls_section_end\s*\|>/gi,El=/```(?:tool|action|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi;var _i=e=>!e||typeof e!="string"?e:e.replace(/(```[\s\S]*?```|`[^`]*`)|(<(?:\w+)(?:[^>]*)>\r?\n?|\r?\n?<\/\w+(?:[^>]*)>)/gi,(t,n)=>n||""),ba=e=>{if(!e||typeof e!="string")return e;let t=Kn(e);if(!t||t.length===0)return e;let n=t[t.length-1];if(!n.fullMatch)return e;let i=e.lastIndexOf(n.fullMatch);if(i===-1)return e;let o=i+n.fullMatch.length,r=e.substring(o);if(/\[\s*(?:tool|action):/i.test(r))return e.trimEnd();let d=/\r?\n/.test(r);return e.substring(0,o)+(d?`
550
+ `}),m};var gl={Ollama:()=>import("./ollama-X7ARM2CC.js").then(e=>e.getOllamaStream),OpenRouter:()=>import("./openrouter-X34P3LSG.js").then(e=>e.getOpenRouterStream),DeepSeek:()=>import("./deepseek-2ML5JZIJ.js").then(e=>e.getDeepSeekStream),Mistral:()=>import("./mistral-GA36HVZJ.js").then(e=>e.getMistralStream),NVIDIA:()=>import("./nvidia-Z6TAXVPB.js").then(e=>e.getNVIDIAStream),NVIDIA_wrap:()=>import("./nvidia-Z6TAXVPB.js").then(e=>e.wrapNvidiaStreamWithQueueDepth),InferX:()=>import("./inferx-UKKLJEAM.js").then(e=>e.getInferXStream),SenseNova:()=>import("./sensenova-HDWEJZ55.js").then(e=>e.getSenseNovaStream),AIHubMix:()=>import("./aihubmix-O3DBW2A5.js").then(e=>e.getAIHubMixStream),Poolside:()=>import("./poolside-FQHJMGLR.js").then(e=>e.getPoolsideStream),NineRouter:()=>import("./9router-PDJMJ7J7.js").then(e=>e.getNineRouterStream),ExpLabs:()=>import("./explabs-QQLTHT5W.js").then(e=>e.getExpLabsStream),TokenHarbor:()=>import("./tokenharbor-CGOB5U35.js").then(e=>e.getTokenHarborStream),Infron:()=>import("./infron-TWZGMQWC.js").then(e=>e.getInfronStream),APInex:()=>import("./apinex-752TL5EZ.js").then(e=>e.getAPInexStream),xKiro:()=>import("./xkiro-QEMX3CQI.js").then(e=>e.getXKiroStream),CoArena:()=>import("./coarena-JZAITHAG.js").then(e=>e.getCoArenaStream),c_openai:()=>import("./custom_openai-VGJQRWSE.js").then(e=>e.getCustomOpenAIStream)},Cs={},me=async e=>(Cs[e]||(Cs[e]=await gl[e]()),Cs[e]),ml=/```[\s\S]*?```/g,pl=/```[\s\S]*$/g,hl=/`[^`]+`/g,yl=/^\|.*\|$/gm,xl=/^[^\w]+|[^\w]+$/g,wl=/[^a-z0-9]/gi,Ko=/\[\s*(?:tool|action):(?:functions\.)?([a-z0-9_]+)\s*\(/gi,bl=/\[\s*(?:tool:(?:functions\.)?|action:(?:functions\.)?|action:)([a-z0-9_]+)\s*\(/gi,Sl=/(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/,_n=/["']/g,da=/\\/g,kl=/<\|channel>thought/gi,Tl=/<channel\|>/gi,Al=e=>typeof e!="string"?e:e.replace(kl,"<think_fluxflow>").replace(Tl,"</think_fluxflow>"),Qd=/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])[\s\S]*?(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\]|$)/i,Cl=(e,t,n=1)=>{let i=t>0?e[t-1]:"",o=t+n<e.length?e[t+n]:"";return i==="`"&&o==="`"},Rl=e=>{let t=/(?:<\/think_fluxflow>|<channel\|>|\[\/think_fluxflow\])/gi,n;for(;(n=t.exec(e))!==null;)if(!Cl(e,n.index,n[0].length))return{index:n.index,length:n[0].length};return{index:-1,length:0}},Rs=e=>{if(!e||typeof e!="string")return null;let t=e.match(/^\s*(?:<think_fluxflow[^>]*>|<\|channel>thought|\[think_fluxflow\])/i);if(!t)return null;let n=t.index+t[0].length,i=e.substring(n),o=Rl(i);if(o.index!==-1){let r=n+o.index+o.length;return{fullBlock:e.substring(0,r),innerContent:i.substring(0,o.index),remainingText:e.substring(r)}}return{fullBlock:e,innerContent:i,remainingText:""}},jt=e=>{if(!e||typeof e!="string")return e;let t=Rs(e);return t?t.remainingText.trimStart():e};var fa=/<\|\s*tool_call_begin\s*\|>\s*(?:(?:tool|functions)\b[\s._]*)*([a-zA-Z0-9_]+)(?::\d+)?\s*<\|\s*tool_call_argument_begin\s*\|>([\s\S]*?)<\|\s*tool_call_end\s*\|>/gi,vl=/"([^"]+)"\s*:\s*(?:"([^"]*)"|(\d+)|true|false|null)/g,ua=/<\|\s*tool_calls_section_begin\s*\|>/gi,ga=/<\|\s*tool_calls_section_end\s*\|>/gi,El=/```(?:tool|action|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi;var _i=e=>!e||typeof e!="string"?e:e.replace(/(```[\s\S]*?```|`[^`]*`)|(<(?:\w+)(?:[^>]*)>\r?\n?|\r?\n?<\/\w+(?:[^>]*)>)/gi,(t,n)=>n||""),ba=e=>{if(!e||typeof e!="string")return e;let t=Kn(e);if(!t||t.length===0)return e;let n=t[t.length-1];if(!n.fullMatch)return e;let i=e.lastIndexOf(n.fullMatch);if(i===-1)return e;let o=i+n.fullMatch.length,r=e.substring(o);if(/\[\s*(?:tool|action):/i.test(r))return e.trimEnd();let d=/\r?\n/.test(r);return e.substring(0,o)+(d?`
551
551
  `:"")},Es=null,Vo={},no={key:null,value:null},Lt=e=>{if(!e)return e;let t=Vo?.theme;if(!t)try{t=ri(oi,{})?.systemSettings?.theme}catch{}let i=Ri(t||"Dark").toolFeedbackAnsi||"\x1B[95m";return e.replace(/(?:(\x1b\[\d+m))?([✔✘✖🔍📖→➕↻↷•🛇])(?:(\x1b\[\d+m))?\s*\b(Clicked Screen|Clicked|Located|Dragged|Scrolled|Typed|Entered|Pressed Key|Recaptured Screen|Created|Read Skill|Read Documentation|Executed|Searched Documentation|Read|Edited|Viewed|Processed|Auto-Read|Skipped|List|Generated|Written|Searched|AI Search|Get Map|Write Canceled|Resolved Sub-Agent Query|Edit Canceled|Write Cancelled|Edit Denied|Visited|Updated|Reviewed|Delegated|Background|Checked|Indexed|Analyzed|Browsed|Elevating SubAgent|Checking SubAgent Work|Started Generalist|Called Generalist|Steered|Unsupported Modality|Awaiting|Cancelled|Aligning Moon Phase|Contemplating Existence|Staring At Void|Rollback Point Checked|Emergency Rollback Failed|Emergency Rollback|Delaying Professionally|Negotiating With Electrons|Touching Grass (virtually)|Panicking Softly|Rethinking Career Choices|Loading Cat Videos|Giving Up Entirely|Summoning Braincell #2|Pretending To Be Busy|Waiting For Motivation DLC|Rotating Internal Screaming|Downloading More RAM|Feeding The Hamsters|Gaslighting Scheduler|Performing Dramatic Pause|Buffering Social Energy|Calculating Regret|Reading Terms And Conditions|Becoming Sentient Briefly|Model produced malformed tool call|Loop Detected|Contacting Ancestors)\b/ig,(o,r,d,l,m)=>`${r||""}${d}${l||""} ${i}${m}\x1B[0m`)},_l=async(e,t=8,n=1e3,i=8e3,o=null)=>{let r=0;for(;;){if(o?.aborted)throw new DOMException("The user aborted a request.","AbortError");try{return await e()}catch(d){if(o?.aborted||d?.name==="AbortError"||d?.message==="Subagent task was cancelled."||(r++,r>=t))throw d;let l=Math.min(n*Math.pow(2,r-1),i);await new Promise((m,f)=>{let h=setTimeout(m,l);o&&o.addEventListener("abort",()=>{clearTimeout(h),f(new DOMException("The user aborted a request.","AbortError"))})})}}},xt=!1;var Zd=e=>{let t=e.filter(o=>(o.role==="user"||o.role==="agent"||o.role==="system")&&o.role!=="think"&&!o.isVisualFeedback&&!o.isMeta&&!o.isTerminalRecord&&!(o.text&&o.text.includes("[TERMINAL_RECORD]"))&&!String(o.id).startsWith("welcome")).map((o,r,d)=>{let l=o.fullText||o.text||"";if(o.role==="user"&&r<d.length-1)if(l.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")){let m=l.indexOf("**CONTEXT SUMMARY OF PREVIOUS TURNS");if(m!==-1){let h=l.substring(0,m).lastIndexOf("[SYSTEM METADATA]");h!==-1?l=l.substring(h).trim():l=l.substring(m).trim()}}else{let m=l.lastIndexOf("[USER]"),f=l.lastIndexOf("[USER PROMPT]");m!==-1?l=l.substring(m+6).trim():f!==-1&&(l=l.substring(f).trim())}return{...o,text:l}}),n=[],i=0;for(;i<t.length;){let o=t[i];if(o.role==="user")n.push(o),i++;else{let r=[];for(;i<t.length&&t[i].role!=="user";)r.push(t[i]),i++;let d=[],l=[],m=!1,f=()=>{d.length>0&&(n.push({role:"agent",text:"combined"}),d=[]),l.length>0&&(n.push({role:"system",text:"combined"}),l=[]),m=!1};r.forEach(h=>{let p=h.role==="system"&&(h.text?.startsWith("[ACTION RESULT]")||h.text?.startsWith("[TOOL RESULT]")||h.text?.startsWith("SUCCESS:")||h.text?.startsWith("ERROR:")||h.fullText?.startsWith("[ACTION RESULT]")||h.fullText?.startsWith("[TOOL RESULT]")||h.fullText?.startsWith("SUCCESS:")||h.fullText?.startsWith("ERROR:")),g=h.fullText||h.text||"",s=g.trim();if(!(!s&&!h.binaryPart)){if(p)l.push(s);else if(h.role==="agent"){!m&&l.length>0&&f();let x=g.endsWith(`
552
552
  `),I=s.toLowerCase().includes("tool:")||s.toLowerCase().includes("action:");d.push(s),I&&x?m=!0:m=!1}}}),f()}}return n.length};var ef=()=>{xt=!0},tf=()=>xt,vs={write_file:"Writing",update_file:"Editing",read_folder:"Reading",view_file:"Reading",exec_command:"Executing Command",web_search:"Searching",web_scrape:"Reading",memory:"Updating Memory",search_keyword:"Searching",find_file:"Finding File",findFile:"Finding File",FindFile:"Finding File",file_map:"Generating Map",ask:"User Input",write_pdf:"Creating",write_docx:"Creating",generate_image:"Generating",todo:"Planning",Todo:"Planning",goal:"Planning",Goal:"Planning",invoke_sync:"Sub-Agent Working",invoke:"Starting Agent",get_progress:"Checking Progress",cancel:"Cancelling",await:"Waiting",wait:"Waiting",EmergencyRollback:"Don't Panic. Lookin' into it",answer:"Answering Sub-Agent",Answer:"Answering Sub-Agent",steer:"Steering Sub-Agent",Steer:"Steering Sub-Agent",Click:"Clicking",click:"Clicking",Drag:"Dragging",drag:"Dragging",Scroll:"Scrolling",scroll:"Scrolling",KeyboardTyping:"Typing",keyboard_typing:"Typing",KeyPress:"Pressing Key",key_press:"Pressing Key",RecaptureScreen:"Recapturing Screen",recapture_screen:"Recapturing Screen"},oo=(e,t)=>{try{let n=O(t),i=e.toLowerCase().replace(/_/g,"");if(i==="invokesync"||i==="invoke")return n.title||(n.task?n.task.substring(0,30):null);if(i==="getprogress"||i==="cancel"||i==="steer"||i==="steersubagent")return n.id||n.taskId;let o=n.name||n.path||n.targetFile||n.TargetFile||n.directory||n.file||n.query;return o?B.basename(o.replace(/["']/g,"").replace(/\\/g,"/")):null}catch{return null}},Sa=e=>e?new ya({apiKey:e}):Es,nf=async(e,t,n,i,o={})=>{},Ii=e=>{if(!e||typeof e!="string")return e;let t=e.split(""),n=!1,i=!1,o=0;for(;o<t.length;){if(t[o]==="`"&&t[o+1]==="`"&&t[o+2]==="`"){n?(t[o]=" ",t[o+1]=" ",t[o+2]=" ",n=!1):(t[o]=" ",t[o+1]=" ",t[o+2]=" ",n=!0),o+=3;continue}if(n){t[o]!==`
553
553
  `&&t[o]!=="\r"&&(t[o]=" "),o++;continue}if(t[o]==="`")if(i){i=!1,t[o]=" ",o++;continue}else{i=!0,t[o]=" ",o++;continue}if(i){t[o]===`
@@ -0,0 +1 @@
1
+ var u=async(t,n,s=5,a=1e3)=>{let r=n?.signal;for(let o=0;o<s;o++){if(r?.aborted)throw new DOMException("The user aborted a request.","AbortError");try{let e=await fetch(t,n);if(typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),e.ok||e.status!==429&&e.status<500)return e}catch(e){if(typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),e.name==="AbortError"||r?.aborted||o===s-1)throw e}r?await new Promise((e,f)=>{let p=setTimeout(()=>{r.removeEventListener("abort",i),e()},Math.min(24e3,a*Math.pow(2,o))),i=()=>{clearTimeout(p),f(new DOMException("The user aborted a request.","AbortError"))};r.addEventListener("abort",i)}):await new Promise(e=>setTimeout(e,Math.min(24e3,a*Math.pow(2,o))))}if(r?.aborted)throw new DOMException("The user aborted a request.","AbortError");let c=await fetch(t,n);return typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),c};async function l(t){let n=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",n);return[...new Uint8Array(s).slice(0,16)].map(a=>a.toString(16).padStart(2,"0")).join("")}var h=t=>typeof t!="string"?t:t.replace(/<\|channel>thought/gi,"<think_fluxflow>").replace(/<channel\|>/gi,"</think_fluxflow>"),m=t=>{let n=t.split(/\r?\n|\r/),s=n.pop()||"",a=[];for(let r of n)if(r.includes("data: ")){let c=r.split(/(?=data: )/);for(let o of c)o.trim()&&a.push(o)}else r.trim()&&a.push(r);return{lines:a,uncompleted:s}};export{u as a,l as b,h as c,m as d};
@@ -0,0 +1 @@
1
+ import{a as E,d as M}from"./chunk-H6ZSIWYH.js";import{a as D}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var I=async function*(b,_,N,k,x,U,O,S,F=1){let p=[];k&&p.push({role:"system",content:k});for(let o of N){let m=o.role==="user"?"user":"assistant",n=[];if(Array.isArray(o.parts)){for(let a of o.parts)if(a.text)n.push({type:"text",text:a.text});else if(a.inlineData&&O){let d=a.inlineData.mimeType,r=a.inlineData.data;d.startsWith("image/")&&n.push({type:"image_url",image_url:{url:`data:${d};base64,${r}`}})}}else{let a=o.text||"";a&&n.push({type:"text",text:a})}p.push({role:m,content:n.length===1&&n[0].type==="text"?n[0].text:n})}let y=D("CoArena",_,x),w=y!==null?y:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"xhigh"}[x],T={model:_,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:F,tools:[],tool_choice:"none"};w&&(T.reasoning_effort=w);let v=process.env.COARENA_URL||"https://coarena.ai/api/v1/chat/completions",C={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},P=b||process.env.COARENA_API_KEY||"";C.Authorization=`Bearer ${P}`;let c=await E(v,{method:"POST",headers:C,body:JSON.stringify(T),signal:S});if(!c.ok){let o=await c.json().catch(()=>({}));throw new Error(`CoArena Error (${c.status}): ${o.error?.message||o.message||c.statusText}`)}let R=c.body.getReader(),$=new TextDecoder,h="",t=[],l=null,u=Date.now(),i=!1;for(;;){let{done:o,value:m}=await R.read();if(o)break;h+=$.decode(m,{stream:!0});let{lines:n,uncompleted:a}=M(h);h=a;for(let d of n){let r=d.trim();if(!r||r.startsWith(":"))continue;if(r==="data: [DONE]"){t.length>0&&(yield{candidates:[{content:{parts:[...t]}}],usageMetadata:l},t=[]);return}let f=!1;if(r.startsWith("data: ")){let A=r.slice(6);if(A==="[DONE]")f=!0;else try{let e=JSON.parse(A);e.usage&&(l={promptTokenCount:e.usage.prompt_tokens,candidatesTokenCount:e.usage.completion_tokens,totalTokenCount:e.usage.total_tokens,cachedContentTokenCount:e.usage.prompt_tokens_details?.cached_tokens||e.usage.prompt_tokens_details?.cache_read_input_tokens||e.usage.cachedContentTokenCount||e.usage.cache_read_input_tokens||0,thoughtsTokenCount:e.usage.completion_tokens_details?.reasoning_tokens||e.usage.thoughtsTokenCount||e.usage.reasoning_tokens||0});let s=e.choices?.[0]?.delta;if(s){let g=s.reasoning_content||s.reasoning||null;!g&&Array.isArray(s.reasoning_details)&&s.reasoning_details.length>0&&(g=s.reasoning_details.map(j=>j.text||"").filter(Boolean).join("")),g&&(t.push({text:g,thought:!0}),i=!0),s.content&&(t.push({text:s.content}),i=!0)}}catch{}}if((f||Date.now()-u>=150)&&i&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],u=Date.now(),i=!1),f)break}Date.now()-u>=150&&i&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],u=Date.now(),i=!1)}};export{I as getCoArenaStream};
@@ -0,0 +1,2 @@
1
+ import{a as m,d as B}from"./chunk-H6ZSIWYH.js";import{a as W}from"./chunk-UM5SNZ6X.js";import{n as R}from"./chunk-3PZTWZTT.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";var ot=async function*(d,S,F,N,O,Z,J,_,K=1,Y=""){let T=[];N&&T.push({role:"system",content:N});for(let t of F){let e=t.role==="user"?"user":"assistant",n=[];if(Array.isArray(t.parts)){for(let o of t.parts)if(o.text)n.push({type:"text",text:o.text});else if(o.inlineData&&J){let l=o.inlineData.mimeType,u=o.inlineData.data;l.startsWith("image/")&&n.push({type:"image_url",image_url:{url:`data:${l};base64,${u}`}})}}else{let o=t.text||"";o&&n.push({type:"text",text:o})}T.push({role:e,content:n.length===1&&n[0].type==="text"?n[0].text:n})}let D=W("c_openai",S,O),y=D!==null?D:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"xhigh"}[O],i={model:S,messages:T,stream:!0,stream_options:{include_usage:!0},temperature:K,tools:[],tool_choice:"none"};y&&y!=="none"&&(i.reasoning_effort=y,i.reasoning={effort:y});let L=(Y||process.env.CUSTOM_OPENAI_URL||process.env.C_OPENAI_URL||"").trim();if(!L)throw new Error("Custom OpenAI Base URL is not configured. Please set Base URL in /settings -> Providers.");let f=L.replace(/\/+$/,"");f.endsWith("/chat/completions")||(f.endsWith("/v1")?f=`${f}/chat/completions`:f=`${f}/chat/completions`);let g={"Content-Type":"application/json",Accept:"text/event-stream, application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow"},I=d===R,C=I?"":d&&d!=="LOCAL"?d:process.env.CUSTOM_OPENAI_API_KEY||process.env.C_OPENAI_API_KEY||"";if(!I&&C&&C.trim()!==""){let t=C.trim();g.Authorization=t.startsWith("Bearer ")?t:`Bearer ${t}`,g["api-key"]=t}let r=await m(f,{method:"POST",headers:g,body:JSON.stringify(i),signal:_});if(!r.ok&&(r.status===400||r.status===422)&&(i.reasoning||i.reasoning_effort)){if(console.info(`
2
+ `),i.reasoning&&i.reasoning_effort){let t={...i};delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:g,body:JSON.stringify(t),signal:_}).catch(()=>null);e&&e.ok&&(r=e)}if(!r.ok&&i.reasoning_effort){let t={...i};delete t.reasoning;let e=await m(f,{method:"POST",headers:g,body:JSON.stringify(t),signal:_}).catch(()=>null);e&&e.ok&&(r=e)}if(!r.ok){let t={...i};delete t.reasoning,delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:g,body:JSON.stringify(t),signal:_}).catch(()=>null);e&&e.ok&&(r=e)}}if(!r.ok){let t=await r.json().catch(()=>({})),e=t.error?.metadata?.raw||t.error?.message||(typeof t.error=="string"?t.error:"")||t.message||r.statusText||"Unknown error";throw new Error(`Custom OpenAI Error (${r.status}): ${e}`)}let b=r.body.getReader(),q=new TextDecoder,w="",s=[],h=null,k=Date.now(),c=!1,x=[],M=0,z=5,U=!0,E=()=>{x.length>0&&(s.push(...x),x=[],c=!0),U=!1},X=(t,e)=>{if(!t&&!e)return null;if(t){if(typeof t.reasoning_content=="string"&&t.reasoning_content)return t.reasoning_content;if(typeof t.reasoning=="string"&&t.reasoning)return t.reasoning;if(typeof t.thinking=="string"&&t.thinking)return t.thinking;if(typeof t.thought=="string"&&t.thought)return t.thought;if(typeof t.reasoning_text=="string"&&t.reasoning_text)return t.reasoning_text;if(Array.isArray(t.reasoning_details)&&t.reasoning_details.length>0){let n=t.reasoning_details.map(o=>typeof o=="string"?o:o?.text||o?.content||"").filter(Boolean).join("");if(n)return n}}if(e){if(typeof e.reasoning_content=="string"&&e.reasoning_content)return e.reasoning_content;if(typeof e.reasoning=="string"&&e.reasoning)return e.reasoning}return null},G=(t,e)=>{if(t){if(typeof t.content=="string"&&t.content)return t.content;if(typeof t.text=="string"&&t.text)return t.text;if(Array.isArray(t.content))return t.content.map(n=>typeof n=="string"?n:n?.text||"").join("")}return e&&typeof e.text=="string"&&e.text?e.text:""},Q=t=>{let e=t.usage||t.usageMetadata||t.choices?.[0]?.usage||null;if(!e)return null;let n=e.prompt_tokens||e.promptTokenCount||e.input_tokens||0,o=e.completion_tokens||e.candidatesTokenCount||e.output_tokens||0,l=e.total_tokens||e.totalTokenCount||n+o,u=e.prompt_tokens_details?.cached_tokens||e.prompt_tokens_details?.cache_read_input_tokens||e.cachedContentTokenCount||e.cache_read_input_tokens||0,p=e.completion_tokens_details?.reasoning_tokens||e.thoughtsTokenCount||e.reasoning_tokens||0;return{totalTokenCount:l,promptTokenCount:n,candidatesTokenCount:o,cachedContentTokenCount:u,thoughtsTokenCount:p}};for(;;){let{done:t,value:e}=await b.read();if(t){E(),c&&(s.length>0||h)&&(yield{candidates:s.length>0?[{content:{parts:s}}]:[],usageMetadata:h});break}w+=q.decode(e,{stream:!0});let{lines:n,uncompleted:o}=B(w);w=o;for(let l of n){let u=l.trim();if(!u||!u.startsWith("data: "))continue;let p=!1;if(u==="data: [DONE]")p=!0,E();else try{let a=JSON.parse(u.substring(6));if(a.error){let V=a.error.metadata?.raw||a.error.message||(typeof a.error=="string"?a.error:JSON.stringify(a.error));throw new Error(`Custom OpenAI Stream Error: ${V}`)}let A=a.choices?.[0],v=A?.delta,$=Q(a);$&&(h=$,c=!0);let H=X(v,A);H&&(s.push({text:H,thought:!0}),c=!0);let P=G(v,A);P&&(U?(x.push({text:P}),M++,M>=z&&E()):(s.push({text:P}),c=!0))}catch(a){if(a.message&&a.message.startsWith("Custom OpenAI Stream Error:"))throw a}if((p||Date.now()-k>=150)&&c&&(yield{candidates:s.length>0?[{content:{parts:[...s]}}]:[],usageMetadata:h},s=[],k=Date.now(),c=!1),p)break}Date.now()-k>=150&&c&&(yield{candidates:s.length>0?[{content:{parts:[...s]}}]:[],usageMetadata:h},s=[],k=Date.now(),c=!1)}};export{ot as getCustomOpenAIStream};
@@ -0,0 +1 @@
1
+ import{a as S,d as C}from"./chunk-H6ZSIWYH.js";import{a as b}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var H=async function*(M,x,E,D,m,P,$,j,N=1){let k=[];D&&k.push({role:"system",content:D});for(let o of E){let _=o.role==="user"?"user":"assistant",a=[];if(Array.isArray(o.parts)){for(let t of o.parts)if(t.text)a.push({type:"text",text:t.text});else if((t.inlineData||t.inline_data)&&$){let d=t.inlineData||t.inline_data,i=d.mimeType||d.mime_type||"image/jpeg",p=d.data;i.startsWith("image/")&&a.push({type:"image_url",image_url:{url:`data:${i};base64,${p}`}})}}else{let t=o.text||"";t&&a.push({type:"text",text:t})}k.push({role:_,content:a.length===1&&a[0].type==="text"?a[0].text:a})}let u={model:x,messages:k,stream:!0,stream_options:{include_usage:!0},temperature:N,tools:[],tool_choice:"none"},w=b("DeepSeek",x,m),r=w!==null?w:m!=="Fast"?{Low:"low",Medium:"high",Standard:"high",High:"max",xHigh:"max"}[m]||"high":null;r&&r!=="disabled"&&r!=="none"&&r!=="false"&&r!==!1?(u.reasoning_effort=r,u.extra_body={thinking:{type:"enabled"}}):u.extra_body={thinking:{type:"disabled"}};let c=await S("https://api.deepseek.com/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(u),signal:j});if(!c.ok){let o=await c.json().catch(()=>({}));throw new Error(`DeepSeek Error (${c.status}): ${o.error?.message||c.statusText}`)}let O=c.body.getReader(),A=new TextDecoder,y="",e=[],l=null,f=Date.now(),n=!1;for(;;){let{done:o,value:_}=await O.read();if(o){n&&(e.length>0||l)&&(yield{candidates:e.length>0?[{content:{parts:e}}]:[],usageMetadata:l});break}y+=A.decode(_,{stream:!0});let{lines:a,uncompleted:t}=C(y);y=t;for(let d of a){let i=d.trim();if(!i||!i.startsWith("data: "))continue;let p=!1;if(i==="data: [DONE]")p=!0;else try{let h=JSON.parse(i.substring(6)),g=h.choices?.[0]?.delta,s=h.usage;if(s&&(l={totalTokenCount:s.total_tokens||s.prompt_tokens+s.completion_tokens,promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||0},n=!0),g){let T=g.reasoning_content||null;T&&(e.push({text:T,thought:!0}),n=!0),g.content&&(e.push({text:g.content}),n=!0)}}catch{}if((p||Date.now()-f>=150)&&n&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:l},e=[],f=Date.now(),n=!1),p)break}Date.now()-f>=150&&n&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:l},e=[],f=Date.now(),n=!1)}};export{H as getDeepSeekStream};
@@ -0,0 +1 @@
1
+ import{a as D,d as b}from"./chunk-H6ZSIWYH.js";import{a as A}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var K=async function*(S,x,P,y,k,j,C,M,v=1){let g=[];y&&g.push({role:"system",content:y});for(let n of P){let m=n.role==="user"?"user":"assistant",s=[];if(Array.isArray(n.parts)){for(let t of n.parts)if(t.text)s.push({type:"text",text:t.text});else if(t.inlineData&&C){let d=t.inlineData.mimeType,i=t.inlineData.data;d.startsWith("image/")&&s.push({type:"image_url",image_url:{url:`data:${d};base64,${i}`}})}}else{let t=n.text||"";t&&s.push({type:"text",text:t})}g.push({role:m,content:s.length===1&&s[0].type==="text"?s[0].text:s})}let E=A("ExpLabs",x,k),w=E!==null?E:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[k],T={model:x,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:v,tools:[],tool_choice:"none"};w&&(T.reasoning_effort=w);let B=process.env.EXPLABS_URL||process.env.EXPERIENTIALLABS_URL||"https://api.experientiallabs.ai/v1/chat/completions",L={"Content-Type":"application/json"},I=S||process.env.EXPLABS_API_KEY||process.env.EXPERIENTIALLABS_API_KEY||"";L.Authorization=`Bearer ${I}`;let c=await D(B,{method:"POST",headers:L,body:JSON.stringify(T),signal:M});if(!c.ok){let n=await c.json().catch(()=>({}));throw new Error(`Experiential Labs Error (${c.status}): ${n.error?.message||n.message||c.statusText}`)}let N=c.body.getReader(),R=new TextDecoder,h="",e=[],l=null,p=Date.now(),o=!1;for(;;){let{done:n,value:m}=await N.read();if(n){o&&(e.length>0||l)&&(yield{candidates:e.length>0?[{content:{parts:e}}]:[],usageMetadata:l});break}h+=R.decode(m,{stream:!0});let{lines:s,uncompleted:t}=b(h);h=t;for(let d of s){let i=d.trim();if(!i||!i.startsWith("data: "))continue;let f=!1;if(i==="data: [DONE]")f=!0;else try{let _=JSON.parse(i.substring(6)),r=_.choices?.[0]?.delta,a=_.usage;if(a&&(l={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||a.reasoning_tokens||0},o=!0),r){let u=r.reasoning_content||r.reasoning||null;!u&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(u=r.reasoning_details.map($=>$.text||"").filter(Boolean).join("")),u&&(e.push({text:u,thought:!0}),o=!0),r.content&&(e.push({text:r.content}),o=!0)}}catch{}if((f||Date.now()-p>=150)&&o&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:l},e=[],p=Date.now(),o=!1),f)break}Date.now()-p>=150&&o&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:l},e=[],p=Date.now(),o=!1)}};export{K as getExpLabsStream};
@@ -0,0 +1,2 @@
1
+ import{a as D,d as S}from"./chunk-H6ZSIWYH.js";import{a as b}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var H=async function*(E,r,L,x,y,X,$,N,O=1){let g=[];x&&g.push({role:"system",content:x});for(let t of L){let o=t.role==="user"?"user":"assistant",e="";if(Array.isArray(t.parts))for(let d of t.parts)d.text&&(e+=(e?`
2
+ `:"")+d.text);else e=t.text||"";g.push({role:o,content:e})}let m=b("InferX",r,y),T=m!==null?m:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[y],q=r&&r.toLowerCase().includes("qwen3.8-27b")&&m===null,A=r&&(r.toLowerCase().includes("qwen3.8-27b")||r.toLowerCase().includes("qwen3.6-35b-a3b-fp8")),k={model:r,messages:g.filter(t=>t.content&&String(t.content).trim().length>0),stream:!0,stream_options:{include_usage:!0},temperature:O,tools:[],tool_choice:"none"};!q&&T&&(k.stream_options={include_usage:!0},k.reasoning_effort=T);let c=await D("https://model.inferx.net/endpoints/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${E}`,"Content-Type":"application/json"},body:JSON.stringify(k),signal:N});if(!c.ok){let t=await c.text().catch(()=>""),o="";try{let e=JSON.parse(t);o=e.error?.message||e.error?.detail||e.message||e.detail||(typeof e.error=="string"?e.error:"")||(t&&t!=="{}"?t:"")}catch{o=t}throw(!o||o==="{}")&&(o=c.statusText||"Unknown error"),new Error(`InferX Error (${c.status}): ${o}`)}let F=c.body.getReader(),J=new TextDecoder,u="",n=[],i=null,f=Date.now(),a=!1,C=!0;for(;;){let{done:t,value:o}=await F.read();if(t){a&&(n.length>0||i)&&(yield{candidates:n.length>0?[{content:{parts:n}}]:[],usageMetadata:i});break}u+=J.decode(o,{stream:!0});let{lines:e,uncompleted:d}=S(u);u=d,u=e.pop();for(let P of e){let p=P.trim();if(!p||!p.startsWith("data: "))continue;let w=!1;if(p==="data: [DONE]")w=!0;else try{let _=JSON.parse(p.substring(6)),l=_.choices?.[0]?.delta,s=_.usage;if(s&&(i={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),l){let M=l.reasoning||l.reasoning_content||null;if(M&&(n.push({text:M,thought:!0}),a=!0),l.content){let h=l.content;A&&C&&h.length>0&&(h="<think_fluxflow>"+h,C=!1),n.push({text:h}),a=!0}}}catch{}if((w||Date.now()-f>=150||i)&&a&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:i},n=[],f=Date.now(),a=!1),w)break}Date.now()-f>=150&&a&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:i},n=[],f=Date.now(),a=!1)}};export{H as getInferXStream};
@@ -0,0 +1 @@
1
+ import{a as C,d as S}from"./chunk-H6ZSIWYH.js";import{a as A}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var W=async function*(v,E,N,x,T,$,O,M,F=1){let a=E,_=null;if(typeof a=="string"){let t={};if(a.includes("::")){let n=a.indexOf("::"),e=a.slice(0,n).trim();e&&(t.only=[e]),a=a.slice(n+2).trim()}let d=["flex","standard","priority"],o={fp16:"fp16",f16:"fp16",fp8:"fp8",f8:"fp8",int8:"int8",in8:"int8",int4:"int4",in4:"int4"},s=["throughput","latency","price","ttft"];if(a.includes(":")){let n=a.split(":");for(;n.length>1;){let e=n[n.length-1].toLowerCase().trim();if(d.includes(e))t.service_tier=e,t.allow_fallbacks=!1,n.pop();else if(o[e])t.quantizations=[o[e]],t.allow_fallbacks=!1,n.pop();else if(s.includes(e))t.sort=e,t.allow_fallbacks=!1,n.pop();else break}a=n.join(":").trim()}Object.keys(t).length>0&&(_=t)}let y=[];x&&y.push({role:"system",content:x});for(let t of N){let d=t.role==="user"?"user":"assistant",o=[];if(Array.isArray(t.parts)){for(let s of t.parts)if(s.text)o.push({type:"text",text:s.text});else if(s.inlineData&&O){let n=s.inlineData.mimeType,e=s.inlineData.data;n.startsWith("image/")&&o.push({type:"image_url",image_url:{url:`data:${n};base64,${e}`}})}}else{let s=t.text||"";s&&o.push({type:"text",text:s})}y.push({role:d,content:o.length===1&&o[0].type==="text"?o[0].text:o})}let D=A("Infron",a,T),I=D!==null?D:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[T],k={model:a,messages:y,stream:!0,stream_options:{include_usage:!0},temperature:F,tools:[],tool_choice:"none"};_&&(k.provider=_),I&&(k.reasoning={effort:I});let L=process.env.INFRON_URL||"https://llm.onerouter.pro/v1/chat/completions",b={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},R=v||process.env.INFRON_API_KEY||"";b.Authorization=`Bearer ${R}`;let f=await C(L,{method:"POST",headers:b,body:JSON.stringify(k),signal:M});if(!f.ok){let t=await f.json().catch(()=>({}));throw new Error(`Infron Error (${f.status}): ${t.error?.message||t.message||f.statusText}`)}let P=f.body.getReader(),j=new TextDecoder,u="",i=[],p=null,g=Date.now(),l=!1;for(;;){let{done:t,value:d}=await P.read();if(t){l&&(i.length>0||p)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:p});break}u+=j.decode(d,{stream:!0});let{lines:o,uncompleted:s}=S(u);u=s,u=o.pop();for(let n of o){let e=n.trim();if(!e||!e.startsWith("data: "))continue;let h=!1;if(e==="data: [DONE]")h=!0;else try{let w=JSON.parse(e.substring(6)),c=w.choices?.[0]?.delta,r=w.usage;if(r&&(p={totalTokenCount:r.total_tokens||(r.prompt_tokens||0)+(r.completion_tokens||0),promptTokenCount:r.prompt_tokens||0,candidatesTokenCount:r.completion_tokens||0,cachedContentTokenCount:r.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:r.completion_tokens_details?.reasoning_tokens||r.reasoning_tokens||0},l=!0),c){let m=c.reasoning_content||c.reasoning||null;!m&&Array.isArray(c.reasoning_details)&&c.reasoning_details.length>0&&(m=c.reasoning_details.map(U=>U.text||"").filter(Boolean).join("")),m&&(i.push({text:m,thought:!0}),l=!0),c.content&&(i.push({text:c.content}),l=!0)}}catch{}if((h||Date.now()-g>=150)&&l&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:p},i=[],g=Date.now(),l=!1),h)break}Date.now()-g>=150&&l&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:p},i=[],g=Date.now(),l=!1)}};export{W as getInfronStream};
@@ -1,6 +1,6 @@
1
- import{a as b,c as p}from"./chunk-56EJGQU3.js";import{a as D}from"./chunk-6LM3YRRE.js";var q=async(_,s={})=>{let{runSubagent:y}=await import("./ai-2WT22XNX.js"),a=D(_,["task","instruction","prompt","model","title","tools","id"]),u=a.task||a.instruction||a.prompt,A=a.model||null,g=a.title||null,w=a.tools||null,m=a.id&&a.id!=="null"&&a.id!=="undefined"&&a.id!==""?String(a.id).trim():null;if(!u)return'ERROR: Missing "task" argument for invoke.';let d=null,U="";m&&(d=b.find(e=>e.id===m));let f=!!d,r=f?d.id:m||`subagent-${Date.now()}-${Math.floor(Math.random()*1e3)}`,I=f?d.history||[]:[],C=null;if(w)try{let e=w.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.substring(1,e.length-1)),C=e.split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let h=null,S=null,E=new Promise((e,n)=>{h=e,S=n}),t=d;t?(t.status="running",t.task=u,g&&(t.title=g),t.startedAt=Date.now(),t.lastChunkTime=Date.now(),t.completionPromise=E,t._resolveCompletion=h,t._rejectCompletion=S):(t={id:r,title:g||u.substring(0,30),task:u,status:"running",startedAt:Date.now(),lastChunkTime:Date.now(),wps:0,questions:[],pendingSteerMessages:[],steer:e=>{e&&t.pendingSteerMessages.push(e)},completionPromise:E,_resolveCompletion:h,_rejectCompletion:S,progress:[],history:[]},b.push(t));let l={chunks:[],totalWords:0};s.onSubagentUpdate&&s.onSubagentUpdate();let i=[],M={...s,taskId:r,onHistoryUpdate:e=>{t.history=[...e]},onAskMain:async e=>{let n=`q-${Date.now()}-${Math.floor(Math.random()*1e3)}`,o=null,k=new Promise(T=>{o=T}),c={id:n,question:e,answered:!1,answer:null,askedAt:Date.now(),_resolve:o};return t.questions.push(c),t.status="waiting",s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" is WAITING FOR YOUR INPUT: "${e}"
1
+ import{a as b,c as p}from"./chunk-56EJGQU3.js";import{a as D}from"./chunk-6LM3YRRE.js";var q=async(_,s={})=>{let{runSubagent:y}=await import("./ai-RXGVC6CH.js"),a=D(_,["task","instruction","prompt","model","title","tools","id"]),u=a.task||a.instruction||a.prompt,A=a.model||null,g=a.title||null,w=a.tools||null,m=a.id&&a.id!=="null"&&a.id!=="undefined"&&a.id!==""?String(a.id).trim():null;if(!u)return'ERROR: Missing "task" argument for invoke.';let d=null,U="";m&&(d=b.find(e=>e.id===m));let f=!!d,r=f?d.id:m||`subagent-${Date.now()}-${Math.floor(Math.random()*1e3)}`,I=f?d.history||[]:[],C=null;if(w)try{let e=w.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.substring(1,e.length-1)),C=e.split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let h=null,S=null,E=new Promise((e,n)=>{h=e,S=n}),t=d;t?(t.status="running",t.task=u,g&&(t.title=g),t.startedAt=Date.now(),t.lastChunkTime=Date.now(),t.completionPromise=E,t._resolveCompletion=h,t._rejectCompletion=S):(t={id:r,title:g||u.substring(0,30),task:u,status:"running",startedAt:Date.now(),lastChunkTime:Date.now(),wps:0,questions:[],pendingSteerMessages:[],steer:e=>{e&&t.pendingSteerMessages.push(e)},completionPromise:E,_resolveCompletion:h,_rejectCompletion:S,progress:[],history:[]},b.push(t));let l={chunks:[],totalWords:0};s.onSubagentUpdate&&s.onSubagentUpdate();let i=[],M={...s,taskId:r,onHistoryUpdate:e=>{t.history=[...e]},onAskMain:async e=>{let n=`q-${Date.now()}-${Math.floor(Math.random()*1e3)}`,o=null,k=new Promise(T=>{o=T}),c={id:n,question:e,answered:!1,answer:null,askedAt:Date.now(),_resolve:o};return t.questions.push(c),t.status="waiting",s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" is WAITING FOR YOUR INPUT: "${e}"
2
2
  Respond using tool: [action:Answer(id="${r}", answer="...")]
3
3
  [/SYSTEM]`),await k},onVisualFeedback:e=>{t.lastChunkTime=Date.now();let n=e.replace(/\x1b\[[0-9;]*m/g,""),o=n.match(/[✔✘✗✖🔍📖→➕↻•]\s*([A-Za-z0-9\s-]+)/);o?t.currentTool=o[1].trim():t.currentTool=n,s.onSubagentUpdate&&s.onSubagentUpdate()},onTokenChunk:(e,n)=>{let o=Date.now();if(t.lastChunkTime=o,t.currentTool="Thinking",typeof n=="number"&&n>0){l.totalWords+=n,l.chunks.push({time:o,words:n});let k=o-400;if(l.chunks=l.chunks.filter(c=>c.time>=k),l.chunks.length>0){let c=l.chunks.reduce((v,R)=>v+R.words,0),$=l.chunks[0].time,T=Math.max(.4,(o-$)/1e3);t.wps=Math.round(c/T)}}s.onSubagentUpdate&&s.onSubagentUpdate()}};return y(u,M,A,C,null,e=>{if(t.status==="cancelled")return;if(e.startsWith("[Subagent Turn")&&i.length>0&&(t.progress.push([...i]),i=[]),e.includes("[Executing Tool]")){let o=e.match(/\[Executing Tool\]\s*([a-zA-Z0-9_]+)/);o&&(!t.currentTool||t.currentTool==="Thinking")&&(t.currentTool=o[1])}let n=e;if(n.startsWith("[Tool Result]")||n.startsWith("[Action Result]")){let o=n.split(`
4
4
  `);o.length>5&&(n=o.slice(0,4).join(`
5
5
  `)+`
6
- ... [Content/Diff Truncated from Logs] ...`)}i.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0,I).then(e=>{if(t.status==="cancelled"){t._resolveCompletion&&t._resolveCompletion(e);return}i.length>0&&(t.progress.push([...i]),i=[]),t.status="completed",t.finalAnswer=e,s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" (id: ${r}) has FINISHED. Call GetProgress(id="${r}") to see the final result. [/SYSTEM]`),t._resolveCompletion&&t._resolveCompletion(e)}).catch(async e=>{let{isTerminationSignaled:n}=await import("./ai-2WT22XNX.js");if(e.message==="Subagent task was cancelled."||t.status==="cancelled"||n()){t.status="cancelled",i.push("[SUBAGENT CANCELLED] Task was cancelled."),t.progress.push([...i]),s.onSubagentUpdate&&s.onSubagentUpdate(),t._resolveCompletion&&t._resolveCompletion(null);return}i.push(`[SUBAGENT FAILURE] Error: ${e.message}`),t.progress.push([...i]),t.status="failed",t.error=e.message,s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" (id: ${r}) FAILED with error: ${e.message}. [/SYSTEM]`),t._rejectCompletion&&t._rejectCompletion(e)}),f?`Background subagent ${r} resumed.`:U?`Background subagent started. Task ID: ${r}.${U}`:`Background subagent started. Task ID: ${r}`};export{q as invoke};
6
+ ... [Content/Diff Truncated from Logs] ...`)}i.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0,I).then(e=>{if(t.status==="cancelled"){t._resolveCompletion&&t._resolveCompletion(e);return}i.length>0&&(t.progress.push([...i]),i=[]),t.status="completed",t.finalAnswer=e,s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" (id: ${r}) has FINISHED. Call GetProgress(id="${r}") to see the final result. [/SYSTEM]`),t._resolveCompletion&&t._resolveCompletion(e)}).catch(async e=>{let{isTerminationSignaled:n}=await import("./ai-RXGVC6CH.js");if(e.message==="Subagent task was cancelled."||t.status==="cancelled"||n()){t.status="cancelled",i.push("[SUBAGENT CANCELLED] Task was cancelled."),t.progress.push([...i]),s.onSubagentUpdate&&s.onSubagentUpdate(),t._resolveCompletion&&t._resolveCompletion(null);return}i.push(`[SUBAGENT FAILURE] Error: ${e.message}`),t.progress.push([...i]),t.status="failed",t.error=e.message,s.onSubagentUpdate&&s.onSubagentUpdate(),p(`[SYSTEM] Background subagent "${t.title}" (id: ${r}) FAILED with error: ${e.message}. [/SYSTEM]`),t._rejectCompletion&&t._rejectCompletion(e)}),f?`Background subagent ${r} resumed.`:U?`Background subagent started. Task ID: ${r}.${U}`:`Background subagent started. Task ID: ${r}`};export{q as invoke};
@@ -1,7 +1,7 @@
1
- import{a as m}from"./chunk-56EJGQU3.js";import{a as g}from"./chunk-6LM3YRRE.js";var A=async(p,a={})=>{let{runSubagent:f}=await import("./ai-2WT22XNX.js"),e=g(p,["task","instruction","prompt","model","tools","title","id"]),l=e.task||e.instruction||e.prompt,k=e.model||null,c=e.tools||null,u=e.id&&e.id!=="null"&&e.id!=="undefined"&&e.id!==""?String(e.id).trim():null;if(!l)return'ERROR: Missing "task" argument for invokeSync.';let n=null,d="";u&&(n=m.find(t=>t.id===u));let o=n?n.id:u||`subagent-sync-${Date.now()}-${Math.floor(Math.random()*1e3)}`,$=n?.history||[],b=null;if(c)try{let t=c.trim();t.startsWith("[")&&t.endsWith("]")&&(t=t.substring(1,t.length-1)),b=t.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let r=e.title||(n?n.title:l.substring(0,30)),s=n;s?(s.status="running",s.task=l):(s={id:o,title:r,task:l,status:"running",startedAt:Date.now(),progress:[],history:[]},m.push(s));let y={...a,taskId:o,onHistoryUpdate:t=>{s.history=[...t]}};try{a.onVisualFeedback&&a.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${r}${n?" (Resumed)":""}`);let t=await f(l,y,k,b,null,null,!1,$);s.status="completed",s.finalAnswer=`Subagent task completed. (ID: ${o})
1
+ import{a as m}from"./chunk-56EJGQU3.js";import{a as g}from"./chunk-6LM3YRRE.js";var A=async(p,a={})=>{let{runSubagent:f}=await import("./ai-RXGVC6CH.js"),e=g(p,["task","instruction","prompt","model","tools","title","id"]),l=e.task||e.instruction||e.prompt,k=e.model||null,c=e.tools||null,u=e.id&&e.id!=="null"&&e.id!=="undefined"&&e.id!==""?String(e.id).trim():null;if(!l)return'ERROR: Missing "task" argument for invokeSync.';let n=null,d="";u&&(n=m.find(t=>t.id===u));let o=n?n.id:u||`subagent-sync-${Date.now()}-${Math.floor(Math.random()*1e3)}`,$=n?.history||[],b=null;if(c)try{let t=c.trim();t.startsWith("[")&&t.endsWith("]")&&(t=t.substring(1,t.length-1)),b=t.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let r=e.title||(n?n.title:l.substring(0,30)),s=n;s?(s.status="running",s.task=l):(s={id:o,title:r,task:l,status:"running",startedAt:Date.now(),progress:[],history:[]},m.push(s));let y={...a,taskId:o,onHistoryUpdate:t=>{s.history=[...t]}};try{a.onVisualFeedback&&a.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${r}${n?" (Resumed)":""}`);let t=await f(l,y,k,b,null,null,!1,$);s.status="completed",s.finalAnswer=`Subagent task completed. (ID: ${o})
2
2
  Final Answer:
3
3
  ${t}`,a.onVisualFeedback&&a.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${r} [COMPLETED]
4
4
  `);let i=`Subagent task completed. (ID: ${o})
5
5
  Final Answer:
6
- ${t}`;return d?`${i}${d}`:i}catch(t){s.status="failed",s.error=t.message;let{isTerminationSignaled:i}=await import("./ai-2WT22XNX.js"),h=t.message==="Subagent task was cancelled by user."||i();if(a.onVisualFeedback){let S=h?"[CANCELLED]":"[FAILED]";a.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${r} ${S}
6
+ ${t}`;return d?`${i}${d}`:i}catch(t){s.status="failed",s.error=t.message;let{isTerminationSignaled:i}=await import("./ai-RXGVC6CH.js"),h=t.message==="Subagent task was cancelled by user."||i();if(a.onVisualFeedback){let S=h?"[CANCELLED]":"[FAILED]";a.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${r} ${S}
7
7
  `)}return`ERROR: Subagent execution failed: ${t.message}${d}`}};export{A as invokeSync};
@@ -0,0 +1 @@
1
+ import{a as j,b as B,c as f,d as E}from"./chunk-H6ZSIWYH.js";import{a as O}from"./chunk-UM5SNZ6X.js";import"./chunk-Y6O7SAPD.js";import"./chunk-NPXJIGAI.js";var Y=async function*(b,_,J,S,d,G,P,W,F=1,H=null){let T=[];S&&T.push({role:"system",content:S});for(let t of J){let g=t.role==="user"?"user":"assistant",e=[];if(Array.isArray(t.parts)){for(let i of t.parts)if(i.text)e.push({type:"text",text:i.text});else if(i.inlineData&&P){let k=i.inlineData.mimeType,l=i.inlineData.data;k.startsWith("image/")&&e.push({type:"image_url",image_url:`data:${k};base64,${l}`})}}else{let i=t.text||"";i&&e.push({type:"text",text:i})}e.length>0&&T.push({role:g,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let $={Fast:"none",Low:"none",Medium:"high",Standard:"high",High:"high",xHigh:"high"},R=`${b.slice(-5)}${H||""}${d}${_}`,q=await B(R),w={model:_,messages:T,stream:!0,temperature:F,prompt_cache_key:q,tools:[],tool_choice:"none"},h=O("Mistral",_,d);h!==null&&h!=="none"?h&&h!=="none"&&h!=="disabled"&&h!==!1&&(w.reasoning_effort=h):d&&$[d]!=="none"&&(w.reasoning_effort=$[d]||"high");let m=await j("https://api.mistral.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify(w),signal:W});if(!m.ok){let t=await m.text().catch(()=>""),g=m.statusText;try{let e=JSON.parse(t);g=e.error?.message||e.message||JSON.stringify(e.detail||e)}catch{t&&(g=t)}throw new Error(`Mistral Error (${m.status}): ${JSON.stringify(g)}`)}let z=m.body.getReader(),K=new TextDecoder,C="",n=[],y=null,x=Date.now(),r=!1,o=t=>t?typeof t=="string"?f(t):Array.isArray(t)?t.map(o).filter(Boolean).join(""):typeof t=="object"&&t!==null?typeof t.text=="string"?f(t.text):typeof t.content=="string"?f(t.content):typeof t.thinking=="string"?f(t.thinking):typeof t.reasoning_content=="string"?f(t.reasoning_content):typeof t.reasoning=="string"?f(t.reasoning):typeof t.value=="string"?f(t.value):t.text?o(t.text):t.content?o(t.content):t.thinking?o(t.thinking):t.reasoning_content?o(t.reasoning_content):t.reasoning?o(t.reasoning):t.value?o(t.value):"":f(String(t)):"";for(;;){let{done:t,value:g}=await z.read();if(t){r&&(n.length>0||y)&&(yield{candidates:n.length>0?[{content:{parts:n}}]:[],usageMetadata:y});break}C+=K.decode(g,{stream:!0});let{lines:e,uncompleted:i}=E(C);C=i;for(let k of e){let l=k.trim();if(!l||!l.startsWith("data: "))continue;let D=!1;if(l==="data: [DONE]")D=!0;else try{let M=JSON.parse(l.substring(6)),c=M.choices?.[0]?.delta,u=M.usage;if(u&&(y={totalTokenCount:u.total_tokens||(u.prompt_tokens||0)+(u.completion_tokens||0),promptTokenCount:u.prompt_tokens||0,candidatesTokenCount:u.completion_tokens||0,cachedContentTokenCount:u.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:u.completion_tokens_details?.reasoning_tokens||0},r=!0),c){let U=c.thinking||c.reasoning_content||c.reasoning,A=o(U);A&&(n.push({text:A,thought:!0}),r=!0);let a=c.content||(!c.thinking&&!c.reasoning_content&&!c.reasoning?c.text:null);if(a)if(Array.isArray(a))for(let s of a)if(typeof s=="object"&&s!==null){let p=s.type==="thinking"||s.type==="reasoning"||!!s.thought,N=o(s);N&&(n.push({text:N,...p?{thought:!0}:{}}),r=!0)}else{let p=o(s);p&&(n.push({text:p}),r=!0)}else if(typeof a=="object"&&a!==null){let s=a.type==="thinking"||a.type==="reasoning"||!!a.thought,p=o(a);p&&(n.push({text:p,...s?{thought:!0}:{}}),r=!0)}else{let s=o(a);s&&(n.push({text:s}),r=!0)}}}catch{}if((D||Date.now()-x>=150)&&r&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:y},n=[],x=Date.now(),r=!1),D)break}Date.now()-x>=150&&r&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:y},n=[],x=Date.now(),r=!1)}};export{Y as getMistralStream};
@@ -0,0 +1 @@
1
+ import{a as z,d as J}from"./chunk-H6ZSIWYH.js";import{a as j}from"./chunk-UM5SNZ6X.js";import{l as W}from"./chunk-Y6O7SAPD.js";import"./chunk-NPXJIGAI.js";var de=async function*(L,e,k,c,p,D,w=!1,I,M=1){let A=[];c&&A.push({role:"system",content:c}),k.forEach(i=>{let N=i.role==="model"?"assistant":"user",d=[];Array.isArray(i.parts)&&i.parts.forEach(u=>{if(u.text)d.push({type:"text",text:u.text});else if(u.inlineData&&w){let r=u.inlineData.mimeType,g=u.inlineData.data;r.startsWith("image/")&&W(e)&&d.push({type:"image_url",image_url:{url:`data:${r};base64,${g}`}})}}),A.push({role:N,content:d.length===1&&d[0].type==="text"?d[0].text:d})});let T=j("NVIDIA",e,p),t=T!==null?T:{Fast:"Fast",Low:"Fast",Medium:"Standard",Standard:"Standard",High:"High",xHigh:"High"}[p]||"High",o=t!=="Fast"&&t!=="none"&&t!=="disabled"&&t!==!1,s=e.includes("kimi"),n=e.includes("gemma"),h=e.includes("deepseek"),y=e.includes("glm"),Y=e.includes("mistral"),B=e.includes("minimax"),Q=e.includes("gpt"),X=e.includes("qwen"),Z=e.includes("nemotron"),ee=e.includes("llama-3"),te=e.includes("seed"),C=e.includes("poolside"),G=e.includes("thinkingmachines")||e.includes("muse"),se=ee,ne={Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},ae={Fast:"64",Low:"64",Medium:"4096",Standard:"4096",High:"16384",xHigh:"16384"},ie={Fast:"none",Low:"minimal",Medium:"medium",Standard:"medium",High:"max",xHigh:"max"},U=B||h||C||G?16384:32768;U=process.env.NVIDIA_BASE_URL?1024:U;let a={model:e,messages:A,max_tokens:U,stream:!0,stream_options:{include_usage:!0},temperature:M,tool_choice:"none",...Q&&{thinking:ne[p]||"high"}};if(!(process.env.NVIDIA_BASE_URL||se))if(s)a.chat_template_kwargs={thinking:o};else if(n)a.chat_template_kwargs={enable_thinking:o};else if(h)if(o){let i=t==="High"?"max":"high";a.chat_template_kwargs={thinking:!0,reasoning_effort:i}}else a.chat_template_kwargs={thinking:!1};else y?a.chat_template_kwargs={enable_thinking:o,clear_thinking:!o}:Y||(B&&e.includes("minimax-m3")?a.chat_template_kwargs={thinking_mode:o?"enabled":"disabled"}:X?a.chat_template_kwargs={enable_thinking:o}:Z?t==="High"?a.chat_template_kwargs={enable_thinking:!0}:t==="Standard"?a.chat_template_kwargs={enable_thinking:!0,medium_effort:!0}:a.chat_template_kwargs={enable_thinking:!1}:te?o&&(a.extra_body={thinking_budget:parseInt(ae[t]??"4096")}):C?a.chat_template_kwargs={enable_thinking:o}:G&&(a.reasoning_effort=ie[t]||"medium"));let V=0,R=6,$=!1,F=(process.env.NVIDIA_BASE_URL||"https://integrate.api.nvidia.com/v1").trim(),v=F.replace(/\/+$/,"");if(!v.endsWith("/v1")&&!v.endsWith("/v1/chat/completions"))throw new Error(`Invalid NVIDIA Base URL: "${F}". Endpoint URL MUST end with /v1 (e.g. https://integrate.api.nvidia.com/v1 or http://.../v1).`);let oe=v.endsWith("/chat/completions")?v:`${v}/chat/completions`,re=process.env.NVIDIA_API_KEY&&process.env.NVIDIA_BASE_URL?process.env.NVIDIA_API_KEY:L;for(;V<R;){V++;try{let i=await z(oe,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${re}`},body:JSON.stringify(a),signal:I});if(!i.ok){let x=await i.text().catch(()=>""),S=i.statusText;try{let _=JSON.parse(x);S=_.error?.message||_.message||JSON.stringify(_.detail||_)}catch{x&&(S=x)}let b=new Error(`NVIDIA API Error (${i.status}): ${S}`);throw b.status=i.status,b}let N=i.body.getReader(),d=new TextDecoder,u="",r=[],g=null,q=Date.now(),f=!1;for(;;){let{done:x,value:S}=await N.read();if(x){f&&(r.length>0||g)&&(yield{candidates:r.length>0?[{content:{parts:r}}]:[],usageMetadata:g},$=!0);break}u+=d.decode(S,{stream:!0});let{lines:b,uncompleted:_}=J(u);u=_,u=b.pop();let P=!1;for(let le of b){let E=le.trim();if(E){if(E==="data: [DONE]"){P=!0;break}if(E.startsWith("data: ")){let m;try{m=JSON.parse(E.substring(6))}catch{continue}if(m.error)throw new Error(`NVIDIA Stream Error: ${m.error.message||JSON.stringify(m.error)}`);try{let l=m.usage;l&&(g={totalTokenCount:l.total_tokens||l.prompt_tokens+l.completion_tokens,promptTokenCount:l.prompt_tokens||0,candidatesTokenCount:l.completion_tokens||0,cachedContentTokenCount:l.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:(l.completion_tokens_details?.reasoning_tokens||0)+(l.completion_tokens_details?.thoughts_tokens||0)},f=!0);let O=m.choices?.[0]?.delta?.reasoning||m.choices?.[0]?.delta?.reasoning_content||"",K=m.choices?.[0]?.delta?.content||"";O&&(r.push({text:O,thought:!0}),f=!0),K&&(r.push({text:K}),f=!0)}catch{}}}}if((P||Date.now()-q>=350)&&f&&(yield{candidates:r.length>0?[{content:{parts:[...r]}}]:[],usageMetadata:g},$=!0,r=[],q=Date.now(),f=!1),P)break}break}catch(i){if($||V>=R)throw i;await new Promise(N=>setTimeout(N,3500))}}},me=async function*(L,e){let k=[],c=null,p=!1,D=null,w=s=>{if(k.push(s),c){let n=c;c=null,n()}},I=e.split("/").pop(),M=Array.from(new Set([I,I.replace(/\./g,"-"),I.replace(/\./g,"_")])),T=["https://buildapi.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy","https://api.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy"].flatMap(s=>M.map(n=>`${s}/${n}`)),H=!1,t=null,o=async()=>{try{let n=await(await Promise.any(T.map(async h=>{let y=await fetch(h);if(!y.ok)throw new Error(`HTTP ${y.status}`);return y}))).json();if(n&&n.queues&&n.queues[0]&&typeof n.queues[0].queueDepth=="number"){let h=n.queues[0].queueDepth;H||w({value:{type:"status",content:`Queue ${h||1}`},done:!1})}}catch{}};process.env.NVIDIA_BASE_URL||(o(),t=setInterval(o,5e3)),(async()=>{try{let s=L[Symbol.asyncIterator]();for(;;){let{value:n,done:h}=await s.next();if(h)break;H=!0,t&&(clearInterval(t),t=null),w({value:n,done:!1})}p=!0,w(null)}catch(s){if(D=s,t&&(clearInterval(t),t=null),c){let n=c;c=null,n()}}})();try{for(;;){if(D)throw D;if(k.length>0){let s=k.shift();if(s===null&&p)break;yield s.value}else{if(p)break;await new Promise(s=>{c=s})}}}finally{t&&(clearInterval(t),t=null)}};export{de as getNVIDIAStream,me as wrapNvidiaStreamWithQueueDepth};
@@ -0,0 +1 @@
1
+ import{a as E,b as R,d as M}from"./chunk-H6ZSIWYH.js";import{a as b}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var q=async function*(O,$,F,D,m,H,I,N,j=1,v=null){let k=[];D&&k.push({role:"system",content:[{type:"text",text:D}]});for(let e of F){let t=e.role==="user"?"user":"assistant",r=[];if(Array.isArray(e.parts)){for(let s of e.parts)if(s.text)r.push({type:"text",text:s.text});else if(s.inlineData&&I){let d=s.inlineData.mimeType,l=s.inlineData.data;d.startsWith("image/")?r.push({type:"image_url",image_url:{url:`data:${d};base64,${l}`}}):r.push({type:"file",file:{filename:s.filename||"file",file_data:`data:${d};base64,${l}`}})}}else{let s=e.text||"";s&&r.push({type:"text",text:s})}k.push({role:t,content:r.length===1&&r[0].type==="text"?r[0].text:r})}let P={Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},o=$,f=null,h=null;if(typeof o=="string"&&o.includes("::")){let e=o.indexOf("::"),t=o.slice(0,e).trim();t&&(f={only:[t],allow_fallbacks:!1}),o=o.slice(e+2).trim()}if(o.includes(":")){let e=o.split(":");if(e.length>1){let t=e[e.length-1].toLowerCase().trim();(t==="flex"||t==="priority")&&(h=t,e.pop())}o=e.join(":").trim()}let J=`${O.slice(-5)}${v||""}${m}${o}${h||""}${f?JSON.stringify(f):""}`,L=await R(J),g={model:o,messages:k,stream:!0,temperature:j,cache_control:{type:"ephemeral"},tools:[],tool_choice:"none",session_id:L};h&&(g.service_tier=h),f&&(g.provider=f);let T=b("OpenRouter",$,m),C=T!==null?T:P[m];C&&C!=="none"&&(T!==null||m!=="Fast")&&(g.reasoning_effort=C);let u=await E("https://openrouter.ai/api/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${O}`,"Content-Type":"application/json","HTTP-Referer":"https://fluxflow-cli.onrender.com/","X-Title":"FluxFlow CLI","X-OpenRouter-Title":"FluxFlow CLI","X-Cache":"true","X-OpenRouter-Cache":"true"},body:JSON.stringify(g),signal:N});if(!u.ok){let e=await u.json().catch(()=>({})),t=e.error?.metadata?.raw||e.error?.message||(typeof e.error=="string"?e.error:"")||u.statusText||"Unknown error";throw new Error(`OpenRouter Error (${u.status}): ${t}`)}let W=u.body.getReader(),X=new TextDecoder,_="",i=[],w=null,S=Date.now(),c=!1;for(;;){let{done:e,value:t}=await W.read();if(e){c&&(i.length>0||w)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:w});break}_+=X.decode(t,{stream:!0});let{lines:r,uncompleted:s}=M(_);_=s,_=r.pop();for(let d of r){let l=d.trim();if(!l||!l.startsWith("data: "))continue;let x=!1;if(l==="data: [DONE]")x=!0;else try{let n=JSON.parse(l.substring(6));if(n.error){let y=n.error.metadata?.raw||n.error.message||JSON.stringify(n.error);throw new Error(`OpenRouter Stream Error: ${y}`)}let p=n.choices?.[0]?.delta,a=n.usage;if(a&&(w={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||a.prompt_tokens_details?.cache_read_input_tokens||a.cache_read_input_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||0},c=!0),p){let y=p.reasoning||(p.reasoning_details?p.reasoning_details.map(A=>A.text).join(""):null);y&&(i.push({text:y,thought:!0}),c=!0),p.content&&(i.push({text:p.content}),c=!0)}}catch(n){if(n.message&&n.message.startsWith("OpenRouter Stream Error:"))throw n}if((x||Date.now()-S>=150)&&c&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:w},i=[],S=Date.now(),c=!1),x)break}}};export{q as getOpenRouterStream};
@@ -0,0 +1 @@
1
+ import{a as b,d as C}from"./chunk-H6ZSIWYH.js";import{a as D}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var v=async function*(P,y,M,w,x,E,S,$,j=1){let g=[];w&&g.push({role:"system",content:w});for(let i of M){let k=i.role==="user"?"user":"assistant",n=[];if(Array.isArray(i.parts)){for(let e of i.parts)if(e.text)n.push({type:"text",text:e.text});else if(e.inlineData&&S){let f=e.inlineData.mimeType,r=e.inlineData.data;f.startsWith("image/")&&n.push({type:"image_url",image_url:{url:`data:${f};base64,${r}`}})}}else{let e=i.text||"";e&&n.push({type:"text",text:e})}g.push({role:k,content:n.length===1&&n[0].type==="text"?n[0].text:n})}let s=D("Poolside",y,x),N=s!==null?s===!1||s==="false"||s==="none"||s==="Fast":x==="Fast",p={model:y,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:j,tools:[],tool_choice:"none"};N?p.chat_template_kwargs={enable_thinking:!1}:s!==null&&typeof s=="object"?p.chat_template_kwargs=s:p.chat_template_kwargs={enable_thinking:!0};let l=await b("https://inference.poolside.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${P}`,"Content-Type":"application/json"},body:JSON.stringify(p),signal:$});if(!l.ok){let i=await l.json().catch(()=>({}));throw new Error(`Poolside Error (${l.status}): ${i.error?.message||l.statusText}`)}let O=l.body.getReader(),A=new TextDecoder,m="",t=[],c=null,d=Date.now(),o=!1;for(;;){let{done:i,value:k}=await O.read();if(i){o&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}m+=A.decode(k,{stream:!0});let{lines:n,uncompleted:e}=C(m);m=e;for(let f of n){let r=f.trim();if(!r||!r.startsWith("data: "))continue;let h=!1;if(r==="data: [DONE]")h=!0;else try{let _=JSON.parse(r.substring(6)),u=_.choices?.[0]?.delta,a=_.usage;if(a&&(c={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||a.reasoning_tokens||0},o=!0),u){let T=u.reasoning_content||u.reasoning||null;T&&(t.push({text:T,thought:!0}),o=!0),u.content&&(t.push({text:u.content}),o=!0)}}catch{}if((h||Date.now()-d>=150)&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],d=Date.now(),o=!1),h)break}Date.now()-d>=150&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],d=Date.now(),o=!1)}};export{v as getPoolsideStream};
@@ -0,0 +1 @@
1
+ import{a as C,d as M}from"./chunk-H6ZSIWYH.js";import{a as S}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var B=async function*(b,k,N,_,y,A,v,E,$=1){let h=[];_&&h.push({role:"system",content:_});for(let s of N){let g=s.role==="user"?"user":"assistant",e=[];if(Array.isArray(s.parts)){for(let o of s.parts)if(o.text)e.push({type:"text",text:o.text});else if(o.inlineData&&v){let p=o.inlineData.mimeType,i=o.inlineData.data;p.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${p};base64,${i}`}})}}else{let o=s.text||"";o&&e.push({type:"text",text:o})}h.push({role:g,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let x=S("SenseNova",k,y),w=x!==null?x:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[y],D={model:k,messages:h,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"};w&&(D.reasoning_effort=w);let c=await C("https://token.sensenova.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify(D),signal:E});if(!c.ok){let s=await c.json().catch(()=>({}));throw new Error(`SenseNova Error (${c.status}): ${s.error?.message||c.statusText}`)}let O=c.body.getReader(),j=new TextDecoder,u="",t=[],r=null,d=Date.now(),a=!1;for(;;){let{done:s,value:g}=await O.read();if(s){a&&(t.length>0||r)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:r});break}u+=j.decode(g,{stream:!0});let{lines:e,uncompleted:o}=M(u);u=o,u=e.pop();for(let p of e){let i=p.trim();if(!i||!i.startsWith("data: "))continue;let f=!1;if(i==="data: [DONE]")f=!0;else try{let m=JSON.parse(i.substring(6)),l=m.choices?.[0]?.delta,n=m.usage;if(n&&(r={totalTokenCount:n.total_tokens||(n.prompt_tokens||0)+(n.completion_tokens||0),promptTokenCount:n.prompt_tokens||0,candidatesTokenCount:n.completion_tokens||0,cachedContentTokenCount:n.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:n.completion_tokens_details?.reasoning_tokens||n.reasoning_tokens||0},a=!0),l){let T=l.reasoning||l.reasoning_content||null;T&&(t.push({text:T,thought:!0}),a=!0),l.content&&(t.push({text:l.content}),a=!0)}}catch{}if((f||Date.now()-d>=150||r)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:r},t=[],d=Date.now(),a=!1),f)break}Date.now()-d>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:r},t=[],d=Date.now(),a=!1)}};export{B as getSenseNovaStream};
@@ -0,0 +1 @@
1
+ import{a as A,d as N}from"./chunk-H6ZSIWYH.js";import{a as R}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var q=async function*(M,x,v,y,w,I,B,K,L=1){let m=[];y&&m.push({role:"system",content:y});for(let s of v){let T=s.role==="user"?"user":"assistant",t=[];if(Array.isArray(s.parts)){for(let n of s.parts)if(n.text)t.push({type:"text",text:n.text});else if(n.inlineData&&B){let p=n.inlineData.mimeType,i=n.inlineData.data;p.startsWith("image/")&&t.push({type:"image_url",image_url:{url:`data:${p};base64,${i}`}})}}else{let n=s.text||"";n&&t.push({type:"text",text:n})}m.push({role:T,content:t.length===1&&t[0].type==="text"?t[0].text:t})}let H=R("TokenHarbor",x,w),D=H!==null?H:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[w],O={model:x,messages:m,stream:!0,stream_options:{include_usage:!0},temperature:L,tools:[],tool_choice:"none"};D&&(O.reasoning_effort=D);let P=process.env.TOKENHARBOR_URL||process.env.TOKEN_HARBOR_URL||"https://tokenharbor.ai/v1/chat/completions",E={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},S=M||process.env.TOKENHARBOR_API_KEY||process.env.TOKEN_HARBOR_API_KEY||"";E.Authorization=`Bearer ${S}`;let l=await A(P,{method:"POST",headers:E,body:JSON.stringify(O),signal:K});if(!l.ok){let s=await l.json().catch(()=>({}));throw new Error(`Token Harbor Error (${l.status}): ${s.error?.message||s.message||l.statusText}`)}let F=l.body.getReader(),U=new TextDecoder,u="",e=[],c=null,f=Date.now(),o=!1,d=[],b=0,$=5,C=!0,_=()=>{d.length>0&&(e.push(...d),d=[],o=!0),C=!1};for(;;){let{done:s,value:T}=await F.read();if(s){_(),o&&(e.length>0||c)&&(yield{candidates:e.length>0?[{content:{parts:e}}]:[],usageMetadata:c});break}u+=U.decode(T,{stream:!0});let{lines:t,uncompleted:n}=N(u);u=n,u=t.pop();for(let p of t){let i=p.trim();if(!i||!i.startsWith("data: "))continue;let h=!1;if(i==="data: [DONE]")h=!0,_();else try{let k=JSON.parse(i.substring(6)),a=k.choices?.[0]?.delta,r=k.usage;if(r&&(c={totalTokenCount:r.total_tokens||(r.prompt_tokens||0)+(r.completion_tokens||0),promptTokenCount:r.prompt_tokens||0,candidatesTokenCount:r.completion_tokens||0,cachedContentTokenCount:r.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:r.completion_tokens_details?.reasoning_tokens||r.reasoning_tokens||0},o=!0),a){let g=a.reasoning_content||a.reasoning||null;!g&&Array.isArray(a.reasoning_details)&&a.reasoning_details.length>0&&(g=a.reasoning_details.map(j=>j.text||"").filter(Boolean).join("")),g&&(e.push({text:g,thought:!0}),o=!0),a.content&&(C?(d.push({text:a.content}),b++,b>=$&&_()):(e.push({text:a.content}),o=!0))}}catch{}if((h||Date.now()-f>=150)&&o&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:c},e=[],f=Date.now(),o=!1),h)break}Date.now()-f>=150&&o&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:c},e=[],f=Date.now(),o=!1)}};export{q as getTokenHarborStream};
@@ -0,0 +1 @@
1
+ import{a as M,d as A}from"./chunk-H6ZSIWYH.js";import{a as C}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var X=async function*(E,x,K,y,k,I,F,O,S=1){let g=[];y&&g.push({role:"system",content:y});for(let o of K){let m=o.role==="user"?"user":"assistant",n=[];if(Array.isArray(o.parts)){for(let e of o.parts)if(e.text)n.push({type:"text",text:e.text});else if(e.inlineData&&F){let d=e.inlineData.mimeType,i=e.inlineData.data;d.startsWith("image/")&&n.push({type:"image_url",image_url:{url:`data:${d};base64,${i}`}})}}else{let e=o.text||"";e&&n.push({type:"text",text:e})}g.push({role:m,content:n.length===1&&n[0].type==="text"?n[0].text:n})}let w=C("xKiro",x,k),T=w!==null?w:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"xhigh"}[k],D={model:x,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:S,tools:[],tool_choice:"none"};T&&(D.reasoning_effort=T);let v=process.env.XKIRO_URL||"https://api.xkiro.com/v1/chat/completions",b={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},P=E||process.env.XKIRO_API_KEY||"";b.Authorization=`Bearer ${P}`;let l=await M(v,{method:"POST",headers:b,body:JSON.stringify(D),signal:O});if(!l.ok){let o=await l.json().catch(()=>({}));throw new Error(`xKiro Error (${l.status}): ${o.error?.message||o.message||l.statusText}`)}let R=l.body.getReader(),$=new TextDecoder,h="",t=[],c=null,u=Date.now(),a=!1;for(;;){let{done:o,value:m}=await R.read();if(o){a&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}h+=$.decode(m,{stream:!0});let{lines:n,uncompleted:e}=A(h);h=e;for(let d of n){let i=d.trim();if(!i||!i.startsWith("data: "))continue;let f=!1;if(i==="data: [DONE]")f=!0;else try{let _=JSON.parse(i.substring(6)),r=_.choices?.[0]?.delta,s=_.usage;if(s&&(c={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),r){let p=r.reasoning_content||r.reasoning||null;!p&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(p=r.reasoning_details.map(j=>j.text||"").filter(Boolean).join("")),p&&(t.push({text:p,thought:!0}),a=!0),r.content&&(t.push({text:r.content}),a=!0)}}catch{}if((f||Date.now()-u>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],u=Date.now(),a=!1),f)break}Date.now()-u>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],u=Date.now(),a=!1)}};export{X as getXKiroStream};
package/dist/cli.js CHANGED
@@ -65,7 +65,7 @@ Usage: fluxflow --export error`),process.exit(1)}if(oe&&(console.log(`v${i}`),pr
65
65
  /docs View documentation
66
66
  /fluxflow init Create FluxFlow.md template
67
67
  /update check Check for new version
68
- /update latest Install latest release`),process.exit(0)),se){let C=t[1]||"latest";if(C==="check"){let x=t[2]==="latest";try{let y=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;y||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(x?`Latest version: v${y}`:y!==i?`A new version of FluxFlow is available: v${y} (current: v${i}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${i}).`)}catch(c){console.error("Error checking for updates:",c.message),process.exit(1)}process.exit(0)}else if(C==="latest"){console.log("Checking latest version and settings...");try{let m=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;m||(console.error("Error: Could not retrieve latest version."),process.exit(1)),m===i&&(console.log(`FluxFlow is already up to date (v${i}).`),process.exit(0));let y=async()=>{let r=(await import("react")).default,{useState:w}=r,{render:U,Box:h,Text:S}=await import("ink"),ie=(await import("ink-select-input")).default,_=(await import("ink-text-input")).default;return new Promise(D=>{let P=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],H=({label:E,isSelected:F})=>r.createElement(h,{width:"100%"},r.createElement(S,{bold:F},"\u2514\u2500 ",F?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",E)),b,X=()=>{let[E,F]=w("select"),[J,j]=w(""),z=R=>{R.value==="custom"?F("custom"):B({manager:R.value})},K=R=>{B({manager:"custom",customCommand:R})};return E==="custom"?r.createElement(h,{flexDirection:"column",marginY:1},r.createElement(h,{marginBottom:1},r.createElement(S,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),r.createElement(h,{flexDirection:"row"},r.createElement(S,{color:"cyan",bold:!0}," \u276F "),r.createElement(_,{value:J,onChange:j,onSubmit:K})),r.createElement(h,{marginTop:1},r.createElement(S,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):r.createElement(h,{flexDirection:"column",marginY:1},r.createElement(h,{marginBottom:1},r.createElement(S,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),r.createElement(ie,{items:P,onSelect:z,itemComponent:H,indicatorComponent:()=>null}))},B=E=>{b&&b(),D(E)},{unmount:V}=U(r.createElement(X,null));b=V})},n,k="",A;try{let{loadSettings:r}=await import("./chunks/settings-UL5E3OYC.js");A=await r(),n=A?.systemSettings?.updateManager||A?.updateManager}catch{}if(!n){let r=await y();n=r.manager,k=r.customCommand}let p="";n==="pnpm"?p=`pnpm add -g fluxflow-cli@${m}`:n==="bun"?p=`bun add -g fluxflow-cli@${m}`:n==="yarn"?p=`yarn global add fluxflow-cli@${m}`:n==="custom"?p=k||A?.customUpdateCommand||`npm install -g fluxflow-cli@${m}`:p=`npm install -g fluxflow-cli@${m}`,console.log(`Updating FluxFlow to v${m} using ${n}...`),console.log(`Running: ${p}`);let{execSync:L}=await import("child_process");L(p,{stdio:"inherit"}),console.log(`\x1B[32m\u2705 Update successful! FluxFlow updated to v${m}.\x1B[0m`)}catch(x){console.error("\x1B[31m\u274C Update failed:\x1B[0m",x.message),process.exit(1)}process.exit(0)}else console.error("Unknown update command. Available options: --update, --update check, --update check latest, --update latest"),process.exit(1)}}let{default:pe}=await import("react"),{render:de}=await import("ink"),{default:ue}=await import("./chunks/app-VJTUE4RH.js");process.env.NODE_NO_WARNINGS="1";let ge=["cuimp","Found existing binary","Binary verified","curl.exe not found","Falling back to .bat file","DeprecationWarning"],fe=console.log,xe=console.warn,we=console.error,W=o=>{let d=o.map(String).join(" ");return ge.some(s=>d.includes(s))};console.log=(...o)=>!W(o)&&fe(...o),console.warn=(...o)=>!W(o)&&xe(...o),console.error=(...o)=>!W(o)&&we(...o);let Y=t.findIndex(o=>o==="--cwd"||o==="--path");if(Y!==-1&&Y+1<t.length){let o=t[Y+1],d=await import("path"),s=await import("fs-extra"),u=d.default.resolve(o);try{s.default.existsSync(u)&&s.default.statSync(u).isDirectory()?process.chdir(u):(console.error(`[ERROR] Directory not found: "${o}"`),process.exit(0))}catch(v){console.error(`[ERROR] Failed to change directory to "${o}": ${v.message}`),process.exit(0)}}let M=t.includes("--commit_8f4a2b9c"),q=t.findIndex(o=>o==="-p"||o==="--prompt");if(q!==-1||M){let o=t.includes("--new")||t.includes("-n"),s=(q!==-1?t.slice(q+1).filter(e=>e!=="-n"&&e!=="--new"):[])[0];if(M)try{let{execSync:e}=await import("child_process"),a=e("git diff --cached",{encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim();a||process.exit(0);let l="";if(s&&s.trim()){let I=s.trim();I.startsWith("={")&&I.endsWith("}")?l=`
68
+ /update latest Install latest release`),process.exit(0)),se){let C=t[1]||"latest";if(C==="check"){let x=t[2]==="latest";try{let y=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;y||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(x?`Latest version: v${y}`:y!==i?`A new version of FluxFlow is available: v${y} (current: v${i}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${i}).`)}catch(c){console.error("Error checking for updates:",c.message),process.exit(1)}process.exit(0)}else if(C==="latest"){console.log("Checking latest version and settings...");try{let m=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;m||(console.error("Error: Could not retrieve latest version."),process.exit(1)),m===i&&(console.log(`FluxFlow is already up to date (v${i}).`),process.exit(0));let y=async()=>{let r=(await import("react")).default,{useState:w}=r,{render:U,Box:h,Text:S}=await import("ink"),ie=(await import("ink-select-input")).default,_=(await import("ink-text-input")).default;return new Promise(D=>{let P=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],H=({label:E,isSelected:F})=>r.createElement(h,{width:"100%"},r.createElement(S,{bold:F},"\u2514\u2500 ",F?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",E)),b,X=()=>{let[E,F]=w("select"),[J,j]=w(""),z=R=>{R.value==="custom"?F("custom"):B({manager:R.value})},K=R=>{B({manager:"custom",customCommand:R})};return E==="custom"?r.createElement(h,{flexDirection:"column",marginY:1},r.createElement(h,{marginBottom:1},r.createElement(S,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),r.createElement(h,{flexDirection:"row"},r.createElement(S,{color:"cyan",bold:!0}," \u276F "),r.createElement(_,{value:J,onChange:j,onSubmit:K})),r.createElement(h,{marginTop:1},r.createElement(S,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):r.createElement(h,{flexDirection:"column",marginY:1},r.createElement(h,{marginBottom:1},r.createElement(S,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),r.createElement(ie,{items:P,onSelect:z,itemComponent:H,indicatorComponent:()=>null}))},B=E=>{b&&b(),D(E)},{unmount:V}=U(r.createElement(X,null));b=V})},n,k="",A;try{let{loadSettings:r}=await import("./chunks/settings-UL5E3OYC.js");A=await r(),n=A?.systemSettings?.updateManager||A?.updateManager}catch{}if(!n){let r=await y();n=r.manager,k=r.customCommand}let p="";n==="pnpm"?p=`pnpm add -g fluxflow-cli@${m}`:n==="bun"?p=`bun add -g fluxflow-cli@${m}`:n==="yarn"?p=`yarn global add fluxflow-cli@${m}`:n==="custom"?p=k||A?.customUpdateCommand||`npm install -g fluxflow-cli@${m}`:p=`npm install -g fluxflow-cli@${m}`,console.log(`Updating FluxFlow to v${m} using ${n}...`),console.log(`Running: ${p}`);let{execSync:L}=await import("child_process");L(p,{stdio:"inherit"}),console.log(`\x1B[32m\u2705 Update successful! FluxFlow updated to v${m}.\x1B[0m`)}catch(x){console.error("\x1B[31m\u274C Update failed:\x1B[0m",x.message),process.exit(1)}process.exit(0)}else console.error("Unknown update command. Available options: --update, --update check, --update check latest, --update latest"),process.exit(1)}}let{default:pe}=await import("react"),{render:de}=await import("ink"),{default:ue}=await import("./chunks/app-EZITKUKA.js");process.env.NODE_NO_WARNINGS="1";let ge=["cuimp","Found existing binary","Binary verified","curl.exe not found","Falling back to .bat file","DeprecationWarning"],fe=console.log,xe=console.warn,we=console.error,W=o=>{let d=o.map(String).join(" ");return ge.some(s=>d.includes(s))};console.log=(...o)=>!W(o)&&fe(...o),console.warn=(...o)=>!W(o)&&xe(...o),console.error=(...o)=>!W(o)&&we(...o);let Y=t.findIndex(o=>o==="--cwd"||o==="--path");if(Y!==-1&&Y+1<t.length){let o=t[Y+1],d=await import("path"),s=await import("fs-extra"),u=d.default.resolve(o);try{s.default.existsSync(u)&&s.default.statSync(u).isDirectory()?process.chdir(u):(console.error(`[ERROR] Directory not found: "${o}"`),process.exit(0))}catch(v){console.error(`[ERROR] Failed to change directory to "${o}": ${v.message}`),process.exit(0)}}let M=t.includes("--commit_8f4a2b9c"),q=t.findIndex(o=>o==="-p"||o==="--prompt");if(q!==-1||M){let o=t.includes("--new")||t.includes("-n"),s=(q!==-1?t.slice(q+1).filter(e=>e!=="-n"&&e!=="--new"):[])[0];if(M)try{let{execSync:e}=await import("child_process"),a=e("git diff --cached",{encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim();a||process.exit(0);let l="";if(s&&s.trim()){let I=s.trim();I.startsWith("={")&&I.endsWith("}")?l=`
69
69
 
70
70
  Instruction: ${I.slice(2,-1).trim()}`:l=`
71
71
 
@@ -82,7 +82,7 @@ ${s}`:s=i}if(!M&&!process.stdin.isTTY){let e=[];for await(let l of process.stdin
82
82
  ${a}
83
83
  ---
84
84
 
85
- ${s}`:s=a}}s||(console.error("[ERROR] -p/--prompt requires a prompt string (or piped stdin input)."),process.exit(1));let{loadSettings:C}=await import("./chunks/settings-UL5E3OYC.js"),{getProviderAPIKey:x}=await import("./chunks/secrets-6RUMHIWR.js"),{getDefaultModel:c}=await import("./chunks/model_config-OPJXDFKG.js"),{generateSimpleContent:m}=await import("./chunks/ai-2WT22XNX.js"),{checkQuotaDetailed:y}=await import("./chunks/usage-MKFPGZUK.js"),n=await C(),k=t.filter(e=>e!=="-p"&&e!=="--prompt"&&e!==s&&e!=="-n"&&e!=="--new"),A=M||k.includes("--raw")||t.includes("--raw"),p=e=>{for(let a of e){let l=k.indexOf(a);if(l!==-1&&l+1<k.length)return k[l+1]}return null},L=M&&n.systemSettings?.commitMessageModel&&n.systemSettings.commitMessageModel!=="Default"?n.systemSettings.commitMessageModel:null,r=M&&L&&n.systemSettings?.commitMessageProvider?n.systemSettings.commitMessageProvider:null,w=p(["--provider"])||r||n.aiProvider||"Google",U=p(["--model"])||L||n.activeModel||c(w,n.apiTier)||c(w,"paid"),h=p(["--key"])||await x(w);!h&&!(w==="c_openai"&&n.systemSettings?.customOpenAIBaseUrl)&&(console.error(`[ERROR] No API key resolved for provider "${w}".`),process.exit(1));let S=await y("agent",{aiProvider:w});S.allowed||(console.error(`[ERROR] ${S.reason||"Budget Exhausted"} - adjust with /budget set.`),process.exit(1));let{name:ie="",nickname:_="",instructions:D=""}=n?.profileData??{},P={aiProvider:w,apiKey:h,model:U,mode:"flow",thinkingLevel:p(["--thinking"])||"Fast",systemSettings:n.systemSettings||{}},H=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",b=new Date,X=b.getFullYear(),B=b.toLocaleString("en-US",{month:"short"}).toUpperCase(),V=String(b.getDate()).padStart(2,"0"),E=b.toLocaleTimeString([],{hour:"2-digit",hour12:!0}),F=`${X}-${B}-${V}, ${E}`,J=(P.model||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),j=ee.basename(J).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replace(/(\d)-(\d)/g,"$1.$2").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase().trim()),z=`Identity: FluxFlow. Sassy, CLI Assistant
85
+ ${s}`:s=a}}s||(console.error("[ERROR] -p/--prompt requires a prompt string (or piped stdin input)."),process.exit(1));let{loadSettings:C}=await import("./chunks/settings-UL5E3OYC.js"),{getProviderAPIKey:x}=await import("./chunks/secrets-6RUMHIWR.js"),{getDefaultModel:c}=await import("./chunks/model_config-OPJXDFKG.js"),{generateSimpleContent:m}=await import("./chunks/ai-RXGVC6CH.js"),{checkQuotaDetailed:y}=await import("./chunks/usage-MKFPGZUK.js"),n=await C(),k=t.filter(e=>e!=="-p"&&e!=="--prompt"&&e!==s&&e!=="-n"&&e!=="--new"),A=M||k.includes("--raw")||t.includes("--raw"),p=e=>{for(let a of e){let l=k.indexOf(a);if(l!==-1&&l+1<k.length)return k[l+1]}return null},L=M&&n.systemSettings?.commitMessageModel&&n.systemSettings.commitMessageModel!=="Default"?n.systemSettings.commitMessageModel:null,r=M&&L&&n.systemSettings?.commitMessageProvider?n.systemSettings.commitMessageProvider:null,w=p(["--provider"])||r||n.aiProvider||"Google",U=p(["--model"])||L||n.activeModel||c(w,n.apiTier)||c(w,"paid"),h=p(["--key"])||await x(w);!h&&!(w==="c_openai"&&n.systemSettings?.customOpenAIBaseUrl)&&(console.error(`[ERROR] No API key resolved for provider "${w}".`),process.exit(1));let S=await y("agent",{aiProvider:w});S.allowed||(console.error(`[ERROR] ${S.reason||"Budget Exhausted"} - adjust with /budget set.`),process.exit(1));let{name:ie="",nickname:_="",instructions:D=""}=n?.profileData??{},P={aiProvider:w,apiKey:h,model:U,mode:"flow",thinkingLevel:p(["--thinking"])||"Fast",systemSettings:n.systemSettings||{}},H=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",b=new Date,X=b.getFullYear(),B=b.toLocaleString("en-US",{month:"short"}).toUpperCase(),V=String(b.getDate()).padStart(2,"0"),E=b.toLocaleTimeString([],{hour:"2-digit",hour12:!0}),F=`${X}-${B}-${V}, ${E}`,J=(P.model||"").replace(/^.*::/,"").split(":")[0].replace(/\/free$/,"").trim(),j=ee.basename(J).replace(/-free$/,"").replace(/_free$/,"").replace(/^free_/,"").replace(/(\d)-(\d)/g,"$1.$2").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase().trim()),z=`Identity: FluxFlow. Sassy, CLI Assistant
86
86
  Use NO markdown, only plain text
87
87
  Context:
88
88
  - OS: ${H}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "5.6.2",
3
+ "version": "5.6.3",
4
4
  "date": "2026-11-14",
5
5
  "description": "One of the lightest, fastest, high-fidelity agentic CLI with sub-agents & advance computer use.",
6
6
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "5.6.2",
3
+ "version": "5.6.3",
4
4
  "date": "2026-11-14",
5
5
  "description": "One of the lightest, fastest, high-fidelity agentic CLI with sub-agents & advance computer use.",
6
6
  "keywords": [
@@ -1,2 +0,0 @@
1
- import{a as M}from"./chunk-PTFCY2D5.js";import{a as R}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var P=async function*(m,_,N,D,d,j,b,O,$=1){let y=[];D&&y.push({role:"system",content:D});for(let r of N){let x=r.role==="user"?"user":"assistant",e=[];if(Array.isArray(r.parts)){for(let o of r.parts)if(o.text)e.push({type:"text",text:o.text});else if(o.inlineData&&b){let i=o.inlineData.mimeType,c=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${c}`}})}}else{let o=r.text||"";o&&e.push({type:"text",text:o})}y.push({role:x,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let k=R("9router",_,d)||R("9Router",_,d),w=k!==null?k:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[d],U={model:_,messages:y,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"};w&&w!=="none"&&(k!==null||d!=="Fast")&&(U.reasoning_effort=w);let v=(process.env["9ROUTER_URL"]||process.env.NINEROUTER_URL||"http://127.0.0.1:20128/v1").trim(),l=v.replace(/\/+$/,"");if(!l.endsWith("/v1")&&!l.endsWith("/v1/chat/completions"))throw new Error(`Invalid 9Router URL: "${v}". Endpoint URL MUST end with /v1 (e.g. http://127.0.0.1:20128/v1 or https://.../v1).`);let A=l.endsWith("/chat/completions")?l:`${l}/chat/completions`,C={"Content-Type":"application/json"},L=m&&m!=="LOCAL"?m:process.env.NINEROUTER_KEY||"dummy-key";C.Authorization=`Bearer ${L}`;let u=await M(A,{method:"POST",headers:C,body:JSON.stringify(U),signal:O});if(!u.ok){let r=await u.json().catch(()=>({}));throw new Error(`9router Error (${u.status}): ${r.error?.message||u.statusText}`)}let S=u.body.getReader(),W=new TextDecoder,T="",t=[],p=null,h=Date.now(),a=!1;for(;;){let{done:r,value:x}=await S.read();if(r){a&&(t.length>0||p)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:p});break}T+=W.decode(x,{stream:!0});let e=T.split(`
2
- `);T=e.pop();for(let o of e){let i=o.trim();if(!i||!i.startsWith("data: "))continue;let c=!1;if(i==="data: [DONE]")c=!0;else try{let f=JSON.parse(i.substring(6)),n=f.choices?.[0]?.delta,s=f.usage;if(f.choices?.[0]?.finish_reason&&(c=!0),s&&(p={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),n){let g=n.reasoning_content||n.reasoning||n.thinking||null;!g&&Array.isArray(n.reasoning_details)&&n.reasoning_details.length>0&&(g=n.reasoning_details.map(E=>typeof E=="string"?E:E?.text||"").filter(Boolean).join("")),g&&(t.push({text:g,thought:!0}),a=!0),n.content&&(t.push({text:n.content}),a=!0)}}catch{}if((c||Date.now()-h>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),a=!1),c)break}Date.now()-h>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),a=!1)}};export{P as getNineRouterStream};
@@ -1,2 +0,0 @@
1
- import{a as b}from"./chunk-PTFCY2D5.js";import{a as T}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var P=async function*(M,g,C,_,k,I,A,E,H=1){let d=[];_&&d.push({role:"system",content:_});for(let s of C){let m=s.role==="user"?"user":"assistant",e=[];if(Array.isArray(s.parts)){for(let o of s.parts)if(o.text)e.push({type:"text",text:o.text});else if(o.inlineData&&A){let i=o.inlineData.mimeType,r=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${r}`}})}}else{let o=s.text||"";o&&e.push({type:"text",text:o})}d.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let x=T("AIHubMix",g,k),y=x!==null?x:{Fast:"minimal",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[k],w={model:g,messages:d,stream:!0,stream_options:{include_usage:!0},temperature:H,tools:[],tool_choice:"none"};y&&(w.reasoning_effort=y);let c=await b("https://aihubmix.com/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(w),signal:E});if(!c.ok){let s=await c.json().catch(()=>({}));throw new Error(`AIHubMix Error (${c.status}): ${s.error?.message||c.statusText}`)}let S=c.body.getReader(),$=new TextDecoder,h="",t=[],l=null,f=Date.now(),a=!1;for(;;){let{done:s,value:m}=await S.read();if(s){a&&(t.length>0||l)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:l});break}h+=$.decode(m,{stream:!0});let e=h.split(`
2
- `);h=e.pop();for(let o of e){let i=o.trim();if(!i||!i.startsWith("data: "))continue;let r=!1;if(i==="data: [DONE]")r=!0;else try{let u=JSON.parse(i.substring(6)),p=u.choices?.[0]?.delta,n=u.usage;if(u.choices?.[0]?.finish_reason&&(r=!0),n&&(l={totalTokenCount:n.total_tokens||(n.prompt_tokens||0)+(n.completion_tokens||0),promptTokenCount:n.prompt_tokens||0,candidatesTokenCount:n.completion_tokens||0,cachedContentTokenCount:n.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:n.completion_tokens_details?.reasoning_tokens||n.reasoning_tokens||0},a=!0),p){let D=p.reasoning_content||null;D&&(t.push({text:D,thought:!0}),a=!0),p.content&&(t.push({text:p.content}),a=!0)}}catch{}if((r||Date.now()-f>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],f=Date.now(),a=!1),r)break}Date.now()-f>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],f=Date.now(),a=!1)}};export{P as getAIHubMixStream};
@@ -1,2 +0,0 @@
1
- import{a as P}from"./chunk-PTFCY2D5.js";import{a as A}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var H=async function*(b,_,E,x,y,j,C,M,I=1){let g=[];x&&g.push({role:"system",content:x});for(let o of E){let m=o.role==="user"?"user":"assistant",e=[];if(Array.isArray(o.parts)){for(let n of o.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&C){let i=n.inlineData.mimeType,p=n.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${p}`}})}}else{let n=o.text||"";n&&e.push({type:"text",text:n})}g.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let k=A("APInex",_,y),w=k!==null?k:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[y],T={model:_,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:I,tools:[],tool_choice:"none"};w&&(T.reasoning_effort=w);let F=process.env.APINEX_URL||"https://api.apinex.bond/v1/chat/completions",D={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},N=b||process.env.APINEX_API_KEY||"";D.Authorization=`Bearer ${N}`;let l=await P(F,{method:"POST",headers:D,body:JSON.stringify(T),signal:M});if(!l.ok){let o=await l.json().catch(()=>({}));throw new Error(`APInex Error (${l.status}): ${o.error?.message||o.message||l.statusText}`)}let v=l.body.getReader(),S=new TextDecoder,h="",t=[],c=null,u=Date.now(),s=!1;for(;;){let{done:o,value:m}=await v.read();if(o){s&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}h+=S.decode(m,{stream:!0});let e=h.split(`
2
- `);h=e.pop();for(let n of e){let i=n.trim();if(!i||!i.startsWith("data: "))continue;let p=!1;if(i==="data: [DONE]")p=!0;else try{let d=JSON.parse(i.substring(6)),r=d.choices?.[0]?.delta,a=d.usage;if(a&&(c={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||a.reasoning_tokens||0},s=!0),r){let f=r.reasoning_content||r.reasoning||null;!f&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(f=r.reasoning_details.map($=>$.text||"").filter(Boolean).join("")),f&&(t.push({text:f,thought:!0}),s=!0),r.content&&(t.push({text:r.content}),s=!0)}}catch{}if((p||Date.now()-u>=150)&&s&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],u=Date.now(),s=!1),p)break}Date.now()-u>=150&&s&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],u=Date.now(),s=!1)}};export{H as getAPInexStream};
@@ -1 +0,0 @@
1
- var p=async(r,a,o=5,c=1e3)=>{let t=a?.signal;for(let n=0;n<o;n++){if(t?.aborted)throw new DOMException("The user aborted a request.","AbortError");try{let e=await fetch(r,a);if(typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),e.ok||e.status!==429&&e.status<500)return e}catch(e){if(typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),e.name==="AbortError"||t?.aborted||n===o-1)throw e}t?await new Promise((e,f)=>{let u=setTimeout(()=>{t.removeEventListener("abort",s),e()},Math.min(24e3,c*Math.pow(2,n))),s=()=>{clearTimeout(u),f(new DOMException("The user aborted a request.","AbortError"))};t.addEventListener("abort",s)}):await new Promise(e=>setTimeout(e,Math.min(24e3,c*Math.pow(2,n))))}if(t?.aborted)throw new DOMException("The user aborted a request.","AbortError");let i=await fetch(r,a);return typeof performance<"u"&&performance.clearMeasures&&(performance.clearMeasures(),performance.clearMarks()),i};async function h(r){let a=new TextEncoder().encode(r),o=await crypto.subtle.digest("SHA-256",a);return[...new Uint8Array(o).slice(0,16)].map(c=>c.toString(16).padStart(2,"0")).join("")}var l=r=>typeof r!="string"?r:r.replace(/<\|channel>thought/gi,"<think_fluxflow>").replace(/<channel\|>/gi,"</think_fluxflow>");export{p as a,h as b,l as c};
@@ -1,2 +0,0 @@
1
- import{a as C}from"./chunk-PTFCY2D5.js";import{a as k}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var H=async function*(E,y,M,x,w,$,b,N,O=1){let p=[];x&&p.push({role:"system",content:x});for(let o of M){let h=o.role==="user"?"user":"assistant",e=[];if(Array.isArray(o.parts)){for(let a of o.parts)if(a.text)e.push({type:"text",text:a.text});else if(a.inlineData&&b){let s=a.inlineData.mimeType,l=a.inlineData.data;s.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${s};base64,${l}`}})}}else{let a=o.text||"";a&&e.push({type:"text",text:a})}p.push({role:h,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let _=k("CoArena",y,w),A=_!==null?_:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"xhigh"}[w],D={model:y,messages:p,stream:!0,stream_options:{include_usage:!0},temperature:O,tools:[],tool_choice:"none"};A&&(D.reasoning_effort=A);let F=process.env.COARENA_URL||"https://coarena.ai/api/v1/chat/completions",T={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},S=E||process.env.COARENA_API_KEY||"";T.Authorization=`Bearer ${S}`;let c=await C(F,{method:"POST",headers:T,body:JSON.stringify(D),signal:N});if(!c.ok){let o=await c.json().catch(()=>({}));throw new Error(`CoArena Error (${c.status}): ${o.error?.message||o.message||c.statusText}`)}let v=c.body.getReader(),P=new TextDecoder,g="",t=[],f=null,u=Date.now(),r=!1;for(;;){let{done:o,value:h}=await v.read();if(o)break;g+=P.decode(h,{stream:!0});let e=g.split(`
2
- `);g=e.pop();for(let a of e){let s=a.trim();if(!s||s.startsWith(":"))continue;if(s==="data: [DONE]"){t.length>0&&(yield{candidates:[{content:{parts:[...t]}}],usageMetadata:f},t=[]);return}let l=!1;if(s.startsWith("data: ")){let m=s.slice(6);if(m==="[DONE]")l=!0;else try{let i=JSON.parse(m);i.usage&&(f={promptTokenCount:i.usage.prompt_tokens,candidatesTokenCount:i.usage.completion_tokens,totalTokenCount:i.usage.total_tokens});let n=i.choices?.[0]?.delta;if(n){let d=n.reasoning_content||n.reasoning||null;!d&&Array.isArray(n.reasoning_details)&&n.reasoning_details.length>0&&(d=n.reasoning_details.map(R=>R.text||"").filter(Boolean).join("")),d&&(t.push({text:d,thought:!0}),r=!0),n.content&&(t.push({text:n.content}),r=!0)}}catch{}}if((l||Date.now()-u>=150)&&r&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:f},t=[],u=Date.now(),r=!1),l)break}Date.now()-u>=150&&r&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:f},t=[],u=Date.now(),r=!1)}};export{H as getCoArenaStream};
@@ -1,3 +0,0 @@
1
- import{a as m}from"./chunk-PTFCY2D5.js";import{a as R}from"./chunk-UM5SNZ6X.js";import{n as H}from"./chunk-3PZTWZTT.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";var et=async function*(d,N,W,O,P,Q,B,_,F=1,J=""){let T=[];O&&T.push({role:"system",content:O});for(let t of W){let e=t.role==="user"?"user":"assistant",n=[];if(Array.isArray(t.parts)){for(let o of t.parts)if(o.text)n.push({type:"text",text:o.text});else if(o.inlineData&&B){let c=o.inlineData.mimeType,g=o.inlineData.data;c.startsWith("image/")&&n.push({type:"image_url",image_url:{url:`data:${c};base64,${g}`}})}}else{let o=t.text||"";o&&n.push({type:"text",text:o})}T.push({role:e,content:n.length===1&&n[0].type==="text"?n[0].text:n})}let S=R("c_openai",N,P),y=S!==null?S:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"xhigh"}[P],i={model:N,messages:T,stream:!0,stream_options:{include_usage:!0},temperature:F,tools:[],tool_choice:"none"};y&&y!=="none"&&(i.reasoning_effort=y,i.reasoning={effort:y});let D=(J||process.env.CUSTOM_OPENAI_URL||process.env.C_OPENAI_URL||"").trim();if(!D)throw new Error("Custom OpenAI Base URL is not configured. Please set Base URL in /settings -> Providers.");let f=D.replace(/\/+$/,"");f.endsWith("/chat/completions")||(f.endsWith("/v1")?f=`${f}/chat/completions`:f=`${f}/chat/completions`);let l={"Content-Type":"application/json",Accept:"text/event-stream, application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow"},I=d===H,C=I?"":d&&d!=="LOCAL"?d:process.env.CUSTOM_OPENAI_API_KEY||process.env.C_OPENAI_API_KEY||"";if(!I&&C&&C.trim()!==""){let t=C.trim();l.Authorization=t.startsWith("Bearer ")?t:`Bearer ${t}`,l["api-key"]=t}let s=await m(f,{method:"POST",headers:l,body:JSON.stringify(i),signal:_});if(!s.ok&&(s.status===400||s.status===422)&&(i.reasoning||i.reasoning_effort)){if(console.info(`
2
- `),i.reasoning&&i.reasoning_effort){let t={...i};delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:l,body:JSON.stringify(t),signal:_}).catch(()=>null);e&&e.ok&&(s=e)}if(!s.ok&&i.reasoning_effort){let t={...i};delete t.reasoning;let e=await m(f,{method:"POST",headers:l,body:JSON.stringify(t),signal:_}).catch(()=>null);e&&e.ok&&(s=e)}if(!s.ok){let t={...i};delete t.reasoning,delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:l,body:JSON.stringify(t),signal:_}).catch(()=>null);e&&e.ok&&(s=e)}}if(!s.ok){let t=await s.json().catch(()=>({})),e=t.error?.metadata?.raw||t.error?.message||(typeof t.error=="string"?t.error:"")||t.message||s.statusText||"Unknown error";throw new Error(`Custom OpenAI Error (${s.status}): ${e}`)}let K=s.body.getReader(),Y=new TextDecoder,w="",a=[],p=null,k=Date.now(),u=!1,x=[],L=0,b=5,M=!0,E=()=>{x.length>0&&(a.push(...x),x=[],u=!0),M=!1},q=(t,e)=>{if(!t&&!e)return null;if(t){if(typeof t.reasoning_content=="string"&&t.reasoning_content)return t.reasoning_content;if(typeof t.reasoning=="string"&&t.reasoning)return t.reasoning;if(typeof t.thinking=="string"&&t.thinking)return t.thinking;if(typeof t.thought=="string"&&t.thought)return t.thought;if(typeof t.reasoning_text=="string"&&t.reasoning_text)return t.reasoning_text;if(Array.isArray(t.reasoning_details)&&t.reasoning_details.length>0){let n=t.reasoning_details.map(o=>typeof o=="string"?o:o?.text||o?.content||"").filter(Boolean).join("");if(n)return n}}if(e){if(typeof e.reasoning_content=="string"&&e.reasoning_content)return e.reasoning_content;if(typeof e.reasoning=="string"&&e.reasoning)return e.reasoning}return null},z=(t,e)=>{if(t){if(typeof t.content=="string"&&t.content)return t.content;if(typeof t.text=="string"&&t.text)return t.text;if(Array.isArray(t.content))return t.content.map(n=>typeof n=="string"?n:n?.text||"").join("")}return e&&typeof e.text=="string"&&e.text?e.text:""},X=t=>{let e=t.usage||t.usageMetadata||t.choices?.[0]?.usage||null;if(!e)return null;let n=e.prompt_tokens||e.promptTokenCount||e.input_tokens||0,o=e.completion_tokens||e.candidatesTokenCount||e.output_tokens||0,c=e.total_tokens||e.totalTokenCount||n+o,g=e.prompt_tokens_details?.cached_tokens||e.prompt_tokens_details?.cache_read_input_tokens||e.cachedContentTokenCount||e.cache_read_input_tokens||0,r=e.completion_tokens_details?.reasoning_tokens||e.thoughtsTokenCount||e.reasoning_tokens||0;return{totalTokenCount:c,promptTokenCount:n,candidatesTokenCount:o,cachedContentTokenCount:g,thoughtsTokenCount:r}};for(;;){let{done:t,value:e}=await K.read();if(t){E(),u&&(a.length>0||p)&&(yield{candidates:a.length>0?[{content:{parts:a}}]:[],usageMetadata:p});break}w+=Y.decode(e,{stream:!0});let n=w.split(`
3
- `);w=n.pop();for(let o of n){let c=o.trim();if(!c||!c.startsWith("data: "))continue;let g=!1;if(c==="data: [DONE]"||c==="data: [DONE]\r")g=!0,E();else try{let r=JSON.parse(c.substring(6));if(r.error){let G=r.error.metadata?.raw||r.error.message||(typeof r.error=="string"?r.error:JSON.stringify(r.error));throw new Error(`Custom OpenAI Stream Error: ${G}`)}let h=r.choices?.[0],U=h?.delta;h?.finish_reason&&h.finish_reason!=="null"&&(g=!0);let v=X(r);v&&(p=v,u=!0);let $=q(U,h);$&&(a.push({text:$,thought:!0}),u=!0);let A=z(U,h);A&&(M?(x.push({text:A}),L++,L>=b&&E()):(a.push({text:A}),u=!0))}catch(r){if(r.message&&r.message.startsWith("Custom OpenAI Stream Error:"))throw r}if((g||Date.now()-k>=150)&&u&&(yield{candidates:a.length>0?[{content:{parts:[...a]}}]:[],usageMetadata:p},a=[],k=Date.now(),u=!1),g)break}Date.now()-k>=150&&u&&(yield{candidates:a.length>0?[{content:{parts:[...a]}}]:[],usageMetadata:p},a=[],k=Date.now(),u=!1)}};export{et as getCustomOpenAIStream};
@@ -1,2 +0,0 @@
1
- import{a as b}from"./chunk-PTFCY2D5.js";import{a as T}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var B=async function*(C,y,M,x,g,O,S,E,$=1){let m=[];x&&m.push({role:"system",content:x});for(let o of M){let k=o.role==="user"?"user":"assistant",a=[];if(Array.isArray(o.parts)){for(let e of o.parts)if(e.text)a.push({type:"text",text:e.text});else if((e.inlineData||e.inline_data)&&S){let s=e.inlineData||e.inline_data,r=s.mimeType||s.mime_type||"image/jpeg",l=s.data;r.startsWith("image/")&&a.push({type:"image_url",image_url:{url:`data:${r};base64,${l}`}})}}else{let e=o.text||"";e&&a.push({type:"text",text:e})}m.push({role:k,content:a.length===1&&a[0].type==="text"?a[0].text:a})}let f={model:y,messages:m,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"},D=T("DeepSeek",y,g),c=D!==null?D:g!=="Fast"?{Low:"low",Medium:"high",Standard:"high",High:"max",xHigh:"max"}[g]||"high":null;c&&c!=="disabled"&&c!=="none"&&c!=="false"&&c!==!1?(f.reasoning_effort=c,f.extra_body={thinking:{type:"enabled"}}):f.extra_body={thinking:{type:"disabled"}};let p=await b("https://api.deepseek.com/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json"},body:JSON.stringify(f),signal:E});if(!p.ok){let o=await p.json().catch(()=>({}));throw new Error(`DeepSeek Error (${p.status}): ${o.error?.message||p.statusText}`)}let j=p.body.getReader(),N=new TextDecoder,_="",t=[],d=null,h=Date.now(),n=!1;for(;;){let{done:o,value:k}=await j.read();if(o){n&&(t.length>0||d)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:d});break}_+=N.decode(k,{stream:!0});let a=_.split(`
2
- `);_=a.pop();for(let e of a){let s=e.trim();if(!s||!s.startsWith("data: "))continue;let r=!1;if(s==="data: [DONE]")r=!0;else try{let l=JSON.parse(s.substring(6)),u=l.choices?.[0]?.delta,i=l.usage;if(l.choices?.[0]?.finish_reason&&(r=!0),i&&(d={totalTokenCount:i.total_tokens||i.prompt_tokens+i.completion_tokens,promptTokenCount:i.prompt_tokens||0,candidatesTokenCount:i.completion_tokens||0,cachedContentTokenCount:i.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:i.completion_tokens_details?.reasoning_tokens||0},n=!0),u){let w=u.reasoning_content||null;w&&(t.push({text:w,thought:!0}),n=!0),u.content&&(t.push({text:u.content}),n=!0)}}catch{}if((r||Date.now()-h>=150)&&n&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:d},t=[],h=Date.now(),n=!1),r)break}Date.now()-h>=150&&n&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:d},t=[],h=Date.now(),n=!1)}};export{B as getDeepSeekStream};
@@ -1,2 +0,0 @@
1
- import{a as D}from"./chunk-PTFCY2D5.js";import{a as A}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var U=async function*(L,_,b,y,x,R,P,S,C=1){let g=[];y&&g.push({role:"system",content:y});for(let o of b){let m=o.role==="user"?"user":"assistant",e=[];if(Array.isArray(o.parts)){for(let n of o.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&P){let i=n.inlineData.mimeType,p=n.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${p}`}})}}else{let n=o.text||"";n&&e.push({type:"text",text:n})}g.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let k=A("ExpLabs",_,x),E=k!==null?k:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[x],w={model:_,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:C,tools:[],tool_choice:"none"};E&&(w.reasoning_effort=E);let M=process.env.EXPLABS_URL||process.env.EXPERIENTIALLABS_URL||"https://api.experientiallabs.ai/v1/chat/completions",T={"Content-Type":"application/json"},v=L||process.env.EXPLABS_API_KEY||process.env.EXPERIENTIALLABS_API_KEY||"";T.Authorization=`Bearer ${v}`;let c=await D(M,{method:"POST",headers:T,body:JSON.stringify(w),signal:S});if(!c.ok){let o=await c.json().catch(()=>({}));throw new Error(`Experiential Labs Error (${c.status}): ${o.error?.message||o.message||c.statusText}`)}let B=c.body.getReader(),I=new TextDecoder,h="",t=[],l=null,f=Date.now(),a=!1;for(;;){let{done:o,value:m}=await B.read();if(o){a&&(t.length>0||l)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:l});break}h+=I.decode(m,{stream:!0});let e=h.split(`
2
- `);h=e.pop();for(let n of e){let i=n.trim();if(!i||!i.startsWith("data: "))continue;let p=!1;if(i==="data: [DONE]")p=!0;else try{let d=JSON.parse(i.substring(6)),r=d.choices?.[0]?.delta,s=d.usage;if(s&&(l={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),r){let u=r.reasoning_content||r.reasoning||null;!u&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(u=r.reasoning_details.map(N=>N.text||"").filter(Boolean).join("")),u&&(t.push({text:u,thought:!0}),a=!0),r.content&&(t.push({text:r.content}),a=!0)}}catch{}if((p||Date.now()-f>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],f=Date.now(),a=!1),p)break}Date.now()-f>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],f=Date.now(),a=!1)}};export{U as getExpLabsStream};
@@ -1,3 +0,0 @@
1
- import{a as D}from"./chunk-PTFCY2D5.js";import{a as b}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var v=async function*(S,r,E,x,y,J,P,L,N=1){let h=[];x&&h.push({role:"system",content:x});for(let t of E){let o=t.role==="user"?"user":"assistant",e="";if(Array.isArray(t.parts))for(let f of t.parts)f.text&&(e+=(e?`
2
- `:"")+f.text);else e=t.text||"";h.push({role:o,content:e})}let g=b("InferX",r,y),T=g!==null?g:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[y],O=r&&r.toLowerCase().includes("qwen3.8-27b")&&g===null,q=r&&(r.toLowerCase().includes("qwen3.8-27b")||r.toLowerCase().includes("qwen3.6-35b-a3b-fp8")),m={model:r,messages:h.filter(t=>t.content&&String(t.content).trim().length>0),stream:!0,stream_options:{include_usage:!0},temperature:N,tools:[],tool_choice:"none"};!O&&T&&(m.stream_options={include_usage:!0},m.reasoning_effort=T);let c=await D("https://model.inferx.net/endpoints/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${S}`,"Content-Type":"application/json"},body:JSON.stringify(m),signal:L});if(!c.ok){let t=await c.text().catch(()=>""),o="";try{let e=JSON.parse(t);o=e.error?.message||e.error?.detail||e.message||e.detail||(typeof e.error=="string"?e.error:"")||(t&&t!=="{}"?t:"")}catch{o=t}throw(!o||o==="{}")&&(o=c.statusText||"Unknown error"),new Error(`InferX Error (${c.status}): ${o}`)}let A=c.body.getReader(),F=new TextDecoder,k="",n=[],i=null,u=Date.now(),a=!1,C=!0;for(;;){let{done:t,value:o}=await A.read();if(t){a&&(n.length>0||i)&&(yield{candidates:n.length>0?[{content:{parts:n}}]:[],usageMetadata:i});break}k+=F.decode(o,{stream:!0});let e=k.split(`
3
- `);k=e.pop();for(let f of e){let d=f.trim();if(!d||!d.startsWith("data: "))continue;let w=!1;if(d==="data: [DONE]")w=!0;else try{let _=JSON.parse(d.substring(6)),l=_.choices?.[0]?.delta,s=_.usage;if(s&&(i={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),l){let M=l.reasoning||l.reasoning_content||null;if(M&&(n.push({text:M,thought:!0}),a=!0),l.content){let p=l.content;q&&C&&p.length>0&&(p="<think_fluxflow>"+p,C=!1),n.push({text:p}),a=!0}}}catch{}if((w||Date.now()-u>=150||i)&&a&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:i},n=[],u=Date.now(),a=!1),w)break}Date.now()-u>=150&&a&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:i},n=[],u=Date.now(),a=!1)}};export{v as getInferXStream};
@@ -1,2 +0,0 @@
1
- import{a as A}from"./chunk-PTFCY2D5.js";import{a as b}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var B=async function*(C,v,E,w,x,j,N,O,S=1){let a=v,m=null;if(typeof a=="string"){let t={};if(a.includes("::")){let e=a.indexOf("::"),n=a.slice(0,e).trim();n&&(t.only=[n]),a=a.slice(e+2).trim()}let d=["flex","standard","priority"],o={fp16:"fp16",f16:"fp16",fp8:"fp8",f8:"fp8",int8:"int8",in8:"int8",int4:"int4",in4:"int4"},s=["throughput","latency","price","ttft"];if(a.includes(":")){let e=a.split(":");for(;e.length>1;){let n=e[e.length-1].toLowerCase().trim();if(d.includes(n))t.service_tier=n,t.allow_fallbacks=!1,e.pop();else if(o[n])t.quantizations=[o[n]],t.allow_fallbacks=!1,e.pop();else if(s.includes(n))t.sort=n,t.allow_fallbacks=!1,e.pop();else break}a=e.join(":").trim()}Object.keys(t).length>0&&(m=t)}let _=[];w&&_.push({role:"system",content:w});for(let t of E){let d=t.role==="user"?"user":"assistant",o=[];if(Array.isArray(t.parts)){for(let s of t.parts)if(s.text)o.push({type:"text",text:s.text});else if(s.inlineData&&N){let e=s.inlineData.mimeType,n=s.inlineData.data;e.startsWith("image/")&&o.push({type:"image_url",image_url:{url:`data:${e};base64,${n}`}})}}else{let s=t.text||"";s&&o.push({type:"text",text:s})}_.push({role:d,content:o.length===1&&o[0].type==="text"?o[0].text:o})}let T=b("Infron",a,x),D=T!==null?T:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[x],y={model:a,messages:_,stream:!0,stream_options:{include_usage:!0},temperature:S,tools:[],tool_choice:"none"};m&&(y.provider=m),D&&(y.reasoning={effort:D});let M=process.env.INFRON_URL||"https://llm.onerouter.pro/v1/chat/completions",I={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},F=C||process.env.INFRON_API_KEY||"";I.Authorization=`Bearer ${F}`;let f=await A(M,{method:"POST",headers:I,body:JSON.stringify(y),signal:O});if(!f.ok){let t=await f.json().catch(()=>({}));throw new Error(`Infron Error (${f.status}): ${t.error?.message||t.message||f.statusText}`)}let R=f.body.getReader(),L=new TextDecoder,k="",i=[],p=null,u=Date.now(),l=!1;for(;;){let{done:t,value:d}=await R.read();if(t){l&&(i.length>0||p)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:p});break}k+=L.decode(d,{stream:!0});let o=k.split(`
2
- `);k=o.pop();for(let s of o){let e=s.trim();if(!e||!e.startsWith("data: "))continue;let n=!1;if(e==="data: [DONE]")n=!0;else try{let g=JSON.parse(e.substring(6)),c=g.choices?.[0]?.delta,r=g.usage;if(r&&(p={totalTokenCount:r.total_tokens||(r.prompt_tokens||0)+(r.completion_tokens||0),promptTokenCount:r.prompt_tokens||0,candidatesTokenCount:r.completion_tokens||0,cachedContentTokenCount:r.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:r.completion_tokens_details?.reasoning_tokens||r.reasoning_tokens||0},l=!0),c){let h=c.reasoning_content||c.reasoning||null;!h&&Array.isArray(c.reasoning_details)&&c.reasoning_details.length>0&&(h=c.reasoning_details.map(P=>P.text||"").filter(Boolean).join("")),h&&(i.push({text:h,thought:!0}),l=!0),c.content&&(i.push({text:c.content}),l=!0)}}catch{}if((n||Date.now()-u>=150)&&l&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:p},i=[],u=Date.now(),l=!1),n)break}Date.now()-u>=150&&l&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:p},i=[],u=Date.now(),l=!1)}};export{B as getInfronStream};
@@ -1,2 +0,0 @@
1
- import{a as O,b as j,c as f}from"./chunk-PTFCY2D5.js";import{a as N}from"./chunk-UM5SNZ6X.js";import"./chunk-Y6O7SAPD.js";import"./chunk-NPXJIGAI.js";var X=async function*(M,T,B,b,m,K,E,J,P=1,W=null){let w=[];b&&w.push({role:"system",content:b});for(let t of B){let g=t.role==="user"?"user":"assistant",e=[];if(Array.isArray(t.parts)){for(let i of t.parts)if(i.text)e.push({type:"text",text:i.text});else if(i.inlineData&&E){let p=i.inlineData.mimeType,d=i.inlineData.data;p.startsWith("image/")&&e.push({type:"image_url",image_url:`data:${p};base64,${d}`})}}else{let i=t.text||"";i&&e.push({type:"text",text:i})}e.length>0&&w.push({role:g,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let S={Fast:"none",Low:"none",Medium:"high",Standard:"high",High:"high",xHigh:"high"},F=`${M.slice(-5)}${W||""}${m}${T}`,H=await j(F),C={model:T,messages:w,stream:!0,temperature:P,prompt_cache_key:H,tools:[],tool_choice:"none"},h=N("Mistral",T,m);h!==null&&h!=="none"?h&&h!=="none"&&h!=="disabled"&&h!==!1&&(C.reasoning_effort=h):m&&S[m]!=="none"&&(C.reasoning_effort=S[m]||"high");let y=await O("https://api.mistral.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(C),signal:J});if(!y.ok){let t=await y.text().catch(()=>""),g=y.statusText;try{let e=JSON.parse(t);g=e.error?.message||e.message||JSON.stringify(e.detail||e)}catch{t&&(g=t)}throw new Error(`Mistral Error (${y.status}): ${JSON.stringify(g)}`)}let R=y.body.getReader(),q=new TextDecoder,D="",n=[],x=null,k=Date.now(),r=!1,o=t=>t?typeof t=="string"?f(t):Array.isArray(t)?t.map(o).filter(Boolean).join(""):typeof t=="object"&&t!==null?typeof t.text=="string"?f(t.text):typeof t.content=="string"?f(t.content):typeof t.thinking=="string"?f(t.thinking):typeof t.reasoning_content=="string"?f(t.reasoning_content):typeof t.reasoning=="string"?f(t.reasoning):typeof t.value=="string"?f(t.value):t.text?o(t.text):t.content?o(t.content):t.thinking?o(t.thinking):t.reasoning_content?o(t.reasoning_content):t.reasoning?o(t.reasoning):t.value?o(t.value):"":f(String(t)):"";for(;;){let{done:t,value:g}=await R.read();if(t){r&&(n.length>0||x)&&(yield{candidates:n.length>0?[{content:{parts:n}}]:[],usageMetadata:x});break}D+=q.decode(g,{stream:!0});let e=D.split(`
2
- `);D=e.pop();for(let i of e){let p=i.trim();if(!p||!p.startsWith("data: "))continue;let d=!1;if(p==="data: [DONE]")d=!0;else try{let _=JSON.parse(p.substring(6)),c=_.choices?.[0]?.delta,u=_.usage;if(_.choices?.[0]?.finish_reason&&(d=!0),u&&(x={totalTokenCount:u.total_tokens||(u.prompt_tokens||0)+(u.completion_tokens||0),promptTokenCount:u.prompt_tokens||0,candidatesTokenCount:u.completion_tokens||0,cachedContentTokenCount:u.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:u.completion_tokens_details?.reasoning_tokens||0},r=!0),c){let z=c.thinking||c.reasoning_content||c.reasoning,$=o(z);$&&(n.push({text:$,thought:!0}),r=!0);let a=c.content||(!c.thinking&&!c.reasoning_content&&!c.reasoning?c.text:null);if(a)if(Array.isArray(a))for(let s of a)if(typeof s=="object"&&s!==null){let l=s.type==="thinking"||s.type==="reasoning"||!!s.thought,A=o(s);A&&(n.push({text:A,...l?{thought:!0}:{}}),r=!0)}else{let l=o(s);l&&(n.push({text:l}),r=!0)}else if(typeof a=="object"&&a!==null){let s=a.type==="thinking"||a.type==="reasoning"||!!a.thought,l=o(a);l&&(n.push({text:l,...s?{thought:!0}:{}}),r=!0)}else{let s=o(a);s&&(n.push({text:s}),r=!0)}}}catch{}if((d||Date.now()-k>=150)&&r&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:x},n=[],k=Date.now(),r=!1),d)break}Date.now()-k>=150&&r&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:x},n=[],k=Date.now(),r=!1)}};export{X as getMistralStream};
@@ -1,2 +0,0 @@
1
- import{a as j}from"./chunk-PTFCY2D5.js";import{a as W}from"./chunk-UM5SNZ6X.js";import{l as K}from"./chunk-Y6O7SAPD.js";import"./chunk-NPXJIGAI.js";var ue=async function*(M,e,k,c,g,D,w=!1,I,H=1){let A=[];c&&A.push({role:"system",content:c}),k.forEach(i=>{let N=i.role==="model"?"assistant":"user",d=[];Array.isArray(i.parts)&&i.parts.forEach(u=>{if(u.text)d.push({type:"text",text:u.text});else if(u.inlineData&&w){let r=u.inlineData.mimeType,f=u.inlineData.data;r.startsWith("image/")&&K(e)&&d.push({type:"image_url",image_url:{url:`data:${r};base64,${f}`}})}}),A.push({role:N,content:d.length===1&&d[0].type==="text"?d[0].text:d})});let T=W("NVIDIA",e,g),t=T!==null?T:{Fast:"Fast",Low:"Fast",Medium:"Standard",Standard:"Standard",High:"High",xHigh:"High"}[g]||"High",o=t!=="Fast"&&t!=="none"&&t!=="disabled"&&t!==!1,s=e.includes("kimi"),n=e.includes("gemma"),h=e.includes("deepseek"),y=e.includes("glm"),z=e.includes("mistral"),P=e.includes("minimax"),J=e.includes("gpt"),Y=e.includes("qwen"),Q=e.includes("nemotron"),X=e.includes("llama-3"),Z=e.includes("seed"),B=e.includes("poolside"),C=e.includes("thinkingmachines")||e.includes("muse"),ee=X,te={Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},se={Fast:"64",Low:"64",Medium:"4096",Standard:"4096",High:"16384",xHigh:"16384"},ne={Fast:"none",Low:"minimal",Medium:"medium",Standard:"medium",High:"max",xHigh:"max"},U=P||h||B||C?16384:32768;U=process.env.NVIDIA_BASE_URL?1024:U;let a={model:e,messages:A,max_tokens:U,stream:!0,stream_options:{include_usage:!0},temperature:H,tool_choice:"none",...J&&{thinking:te[g]||"high"}};if(!(process.env.NVIDIA_BASE_URL||ee))if(s)a.chat_template_kwargs={thinking:o};else if(n)a.chat_template_kwargs={enable_thinking:o};else if(h)if(o){let i=t==="High"?"max":"high";a.chat_template_kwargs={thinking:!0,reasoning_effort:i}}else a.chat_template_kwargs={thinking:!1};else y?a.chat_template_kwargs={enable_thinking:o,clear_thinking:!o}:z||(P&&e.includes("minimax-m3")?a.chat_template_kwargs={thinking_mode:o?"enabled":"disabled"}:Y?a.chat_template_kwargs={enable_thinking:o}:Q?t==="High"?a.chat_template_kwargs={enable_thinking:!0}:t==="Standard"?a.chat_template_kwargs={enable_thinking:!0,medium_effort:!0}:a.chat_template_kwargs={enable_thinking:!1}:Z?o&&(a.extra_body={thinking_budget:parseInt(se[t]??"4096")}):B?a.chat_template_kwargs={enable_thinking:o}:C&&(a.reasoning_effort=ne[t]||"medium"));let V=0,G=6,$=!1,R=(process.env.NVIDIA_BASE_URL||"https://integrate.api.nvidia.com/v1").trim(),v=R.replace(/\/+$/,"");if(!v.endsWith("/v1")&&!v.endsWith("/v1/chat/completions"))throw new Error(`Invalid NVIDIA Base URL: "${R}". Endpoint URL MUST end with /v1 (e.g. https://integrate.api.nvidia.com/v1 or http://.../v1).`);let ae=v.endsWith("/chat/completions")?v:`${v}/chat/completions`,ie=process.env.NVIDIA_API_KEY&&process.env.NVIDIA_BASE_URL?process.env.NVIDIA_API_KEY:M;for(;V<G;){V++;try{let i=await j(ae,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ie}`},body:JSON.stringify(a),signal:I});if(!i.ok){let x=await i.text().catch(()=>""),S=i.statusText;try{let m=JSON.parse(x);S=m.error?.message||m.message||JSON.stringify(m.detail||m)}catch{x&&(S=x)}let b=new Error(`NVIDIA API Error (${i.status}): ${S}`);throw b.status=i.status,b}let N=i.body.getReader(),d=new TextDecoder,u="",r=[],f=null,q=Date.now(),_=!1;for(;;){let{done:x,value:S}=await N.read();if(x){_&&(r.length>0||f)&&(yield{candidates:r.length>0?[{content:{parts:r}}]:[],usageMetadata:f},$=!0);break}u+=d.decode(S,{stream:!0});let b=u.split(`
2
- `);u=b.pop();let m=!1;for(let oe of b){let E=oe.trim();if(E){if(E==="data: [DONE]"){m=!0;break}if(E.startsWith("data: ")){let p;try{p=JSON.parse(E.substring(6))}catch{continue}if(p.error)throw new Error(`NVIDIA Stream Error: ${p.error.message||JSON.stringify(p.error)}`);try{let l=p.usage;l&&(f={totalTokenCount:l.total_tokens||l.prompt_tokens+l.completion_tokens,promptTokenCount:l.prompt_tokens||0,candidatesTokenCount:l.completion_tokens||0,cachedContentTokenCount:l.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:(l.completion_tokens_details?.reasoning_tokens||0)+(l.completion_tokens_details?.thoughts_tokens||0)},_=!0);let F=p.choices?.[0]?.delta?.reasoning||p.choices?.[0]?.delta?.reasoning_content||"",O=p.choices?.[0]?.delta?.content||"";F&&(r.push({text:F,thought:!0}),_=!0),O&&(r.push({text:O}),_=!0)}catch{}}}}if((m||Date.now()-q>=350)&&_&&(yield{candidates:r.length>0?[{content:{parts:[...r]}}]:[],usageMetadata:f},$=!0,r=[],q=Date.now(),_=!1),m)break}break}catch(i){if($||V>=G)throw i;await new Promise(N=>setTimeout(N,3500))}}},he=async function*(M,e){let k=[],c=null,g=!1,D=null,w=s=>{if(k.push(s),c){let n=c;c=null,n()}},I=e.split("/").pop(),H=Array.from(new Set([I,I.replace(/\./g,"-"),I.replace(/\./g,"_")])),T=["https://buildapi.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy","https://api.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy"].flatMap(s=>H.map(n=>`${s}/${n}`)),L=!1,t=null,o=async()=>{try{let n=await(await Promise.any(T.map(async h=>{let y=await fetch(h);if(!y.ok)throw new Error(`HTTP ${y.status}`);return y}))).json();if(n&&n.queues&&n.queues[0]&&typeof n.queues[0].queueDepth=="number"){let h=n.queues[0].queueDepth;L||w({value:{type:"status",content:`Queue ${h||1}`},done:!1})}}catch{}};process.env.NVIDIA_BASE_URL||(o(),t=setInterval(o,5e3)),(async()=>{try{let s=M[Symbol.asyncIterator]();for(;;){let{value:n,done:h}=await s.next();if(h)break;L=!0,t&&(clearInterval(t),t=null),w({value:n,done:!1})}g=!0,w(null)}catch(s){if(D=s,t&&(clearInterval(t),t=null),c){let n=c;c=null,n()}}})();try{for(;;){if(D)throw D;if(k.length>0){let s=k.shift();if(s===null&&g)break;yield s.value}else{if(g)break;await new Promise(s=>{c=s})}}}finally{t&&(clearInterval(t),t=null)}};export{ue as getNVIDIAStream,he as wrapNvidiaStreamWithQueueDepth};
@@ -1,2 +0,0 @@
1
- import{a as E,b as R}from"./chunk-PTFCY2D5.js";import{a as b}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var B=async function*(C,O,S,$,m,A,M,F,I=1,N=null){let y=[];$&&y.push({role:"system",content:[{type:"text",text:$}]});for(let e of S){let t=e.role==="user"?"user":"assistant",s=[];if(Array.isArray(e.parts)){for(let n of e.parts)if(n.text)s.push({type:"text",text:n.text});else if(n.inlineData&&M){let l=n.inlineData.mimeType,c=n.inlineData.data;l.startsWith("image/")?s.push({type:"image_url",image_url:{url:`data:${l};base64,${c}`}}):s.push({type:"file",file:{filename:n.filename||"file",file_data:`data:${l};base64,${c}`}})}}else{let n=e.text||"";n&&s.push({type:"text",text:n})}y.push({role:t,content:s.length===1&&s[0].type==="text"?s[0].text:s})}let j={Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},r=O,u=null,h=null;if(typeof r=="string"&&r.includes("::")){let e=r.indexOf("::"),t=r.slice(0,e).trim();t&&(u={only:[t],allow_fallbacks:!1}),r=r.slice(e+2).trim()}if(r.includes(":")){let e=r.split(":");if(e.length>1){let t=e[e.length-1].toLowerCase().trim();(t==="flex"||t==="priority")&&(h=t,e.pop())}r=e.join(":").trim()}let v=`${C.slice(-5)}${N||""}${m}${r}${h||""}${u?JSON.stringify(u):""}`,P=await R(v),g={model:r,messages:y,stream:!0,temperature:I,cache_control:{type:"ephemeral"},tools:[],tool_choice:"none",session_id:P};h&&(g.service_tier=h),u&&(g.provider=u);let x=b("OpenRouter",O,m),k=x!==null?x:j[m];k&&k!=="none"&&(x!==null||m!=="Fast")&&(g.reasoning_effort=k);let d=await E("https://openrouter.ai/api/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json","HTTP-Referer":"https://fluxflow-cli.onrender.com/","X-Title":"FluxFlow CLI","X-OpenRouter-Title":"FluxFlow CLI","X-Cache":"true","X-OpenRouter-Cache":"true"},body:JSON.stringify(g),signal:F});if(!d.ok){let e=await d.json().catch(()=>({})),t=e.error?.metadata?.raw||e.error?.message||(typeof e.error=="string"?e.error:"")||d.statusText||"Unknown error";throw new Error(`OpenRouter Error (${d.status}): ${t}`)}let J=d.body.getReader(),W=new TextDecoder,T="",i=[],_=null,D=Date.now(),p=!1;for(;;){let{done:e,value:t}=await J.read();if(e){p&&(i.length>0||_)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:_});break}T+=W.decode(t,{stream:!0});let s=T.split(`
2
- `);T=s.pop();for(let n of s){let l=n.trim();if(!l||!l.startsWith("data: "))continue;let c=!1;if(l==="data: [DONE]")c=!0;else try{let o=JSON.parse(l.substring(6));if(o.error){let w=o.error.metadata?.raw||o.error.message||JSON.stringify(o.error);throw new Error(`OpenRouter Stream Error: ${w}`)}let f=o.choices?.[0]?.delta,a=o.usage;if(o.choices?.[0]?.finish_reason&&(c=!0),a&&(_={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||a.prompt_tokens_details?.cache_read_input_tokens||a.cache_read_input_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||0},p=!0),f){let w=f.reasoning||(f.reasoning_details?f.reasoning_details.map(X=>X.text).join(""):null);w&&(i.push({text:w,thought:!0}),p=!0),f.content&&(i.push({text:f.content}),p=!0)}}catch(o){if(o.message&&o.message.startsWith("OpenRouter Stream Error:"))throw o}if((c||Date.now()-D>=150)&&p&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:_},i=[],D=Date.now(),p=!1),c)break}}};export{B as getOpenRouterStream};
@@ -1,2 +0,0 @@
1
- import{a as D}from"./chunk-PTFCY2D5.js";import{a as x}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var F=async function*(b,k,C,y,w,S,P,M,$=1){let g=[];y&&g.push({role:"system",content:y});for(let i of C){let _=i.role==="user"?"user":"assistant",e=[];if(Array.isArray(i.parts)){for(let n of i.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&P){let r=n.inlineData.mimeType,l=n.inlineData.data;r.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${r};base64,${l}`}})}}else{let n=i.text||"";n&&e.push({type:"text",text:n})}g.push({role:_,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let s=x("Poolside",k,w),j=s!==null?s===!1||s==="false"||s==="none"||s==="Fast":w==="Fast",f={model:k,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"};j?f.chat_template_kwargs={enable_thinking:!1}:s!==null&&typeof s=="object"?f.chat_template_kwargs=s:f.chat_template_kwargs={enable_thinking:!0};let c=await D("https://inference.poolside.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify(f),signal:M});if(!c.ok){let i=await c.json().catch(()=>({}));throw new Error(`Poolside Error (${c.status}): ${i.error?.message||c.statusText}`)}let N=c.body.getReader(),O=new TextDecoder,m="",t=[],p=null,h=Date.now(),o=!1;for(;;){let{done:i,value:_}=await N.read();if(i){o&&(t.length>0||p)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:p});break}m+=O.decode(_,{stream:!0});let e=m.split(`
2
- `);m=e.pop();for(let n of e){let r=n.trim();if(!r||!r.startsWith("data: "))continue;let l=!1;if(r==="data: [DONE]")l=!0;else try{let u=JSON.parse(r.substring(6)),d=u.choices?.[0]?.delta,a=u.usage;if(u.choices?.[0]?.finish_reason&&(l=!0),a&&(p={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||a.reasoning_tokens||0},o=!0),d){let T=d.reasoning_content||d.reasoning||null;T&&(t.push({text:T,thought:!0}),o=!0),d.content&&(t.push({text:d.content}),o=!0)}}catch{}if((l||Date.now()-h>=150)&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),o=!1),l)break}Date.now()-h>=150&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),o=!1)}};export{F as getPoolsideStream};
@@ -1,2 +0,0 @@
1
- import{a as C}from"./chunk-PTFCY2D5.js";import{a as T}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var W=async function*(M,m,S,k,_,O,b,N,v=1){let f=[];k&&f.push({role:"system",content:k});for(let s of S){let g=s.role==="user"?"user":"assistant",e=[];if(Array.isArray(s.parts)){for(let o of s.parts)if(o.text)e.push({type:"text",text:o.text});else if(o.inlineData&&b){let i=o.inlineData.mimeType,l=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${l}`}})}}else{let o=s.text||"";o&&e.push({type:"text",text:o})}f.push({role:g,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let y=T("SenseNova",m,_),w=y!==null?y:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[_],x={model:m,messages:f,stream:!0,stream_options:{include_usage:!0},temperature:v,tools:[],tool_choice:"none"};w&&(x.reasoning_effort=w);let c=await C("https://token.sensenova.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(x),signal:N});if(!c.ok){let s=await c.json().catch(()=>({}));throw new Error(`SenseNova Error (${c.status}): ${s.error?.message||c.statusText}`)}let E=c.body.getReader(),$=new TextDecoder,h="",t=[],r=null,p=Date.now(),a=!1;for(;;){let{done:s,value:g}=await E.read();if(s){a&&(t.length>0||r)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:r});break}h+=$.decode(g,{stream:!0});let e=h.split(`
2
- `);h=e.pop();for(let o of e){let i=o.trim();if(!i||!i.startsWith("data: "))continue;let l=!1;if(i==="data: [DONE]")l=!0;else try{let d=JSON.parse(i.substring(6)),u=d.choices?.[0]?.delta,n=d.usage;if(n&&(r={totalTokenCount:n.total_tokens||(n.prompt_tokens||0)+(n.completion_tokens||0),promptTokenCount:n.prompt_tokens||0,candidatesTokenCount:n.completion_tokens||0,cachedContentTokenCount:n.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:n.completion_tokens_details?.reasoning_tokens||n.reasoning_tokens||0},a=!0),u){let D=u.reasoning||u.reasoning_content||null;D&&(t.push({text:D,thought:!0}),a=!0),u.content&&(t.push({text:u.content}),a=!0)}}catch{}if((l||Date.now()-p>=150||r)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:r},t=[],p=Date.now(),a=!1),l)break}Date.now()-p>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:r},t=[],p=Date.now(),a=!1)}};export{W as getSenseNovaStream};
@@ -1,2 +0,0 @@
1
- import{a as R}from"./chunk-PTFCY2D5.js";import{a as C}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var J=async function*(A,k,N,y,x,$,M,v,B=1){let g=[];y&&g.push({role:"system",content:y});for(let s of N){let T=s.role==="user"?"user":"assistant",e=[];if(Array.isArray(s.parts)){for(let n of s.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&M){let i=n.inlineData.mimeType,u=n.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${u}`}})}}else{let n=s.text||"";n&&e.push({type:"text",text:n})}g.push({role:T,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let w=C("TokenHarbor",k,x),H=w!==null?w:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[x],D={model:k,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:B,tools:[],tool_choice:"none"};H&&(D.reasoning_effort=H);let K=process.env.TOKENHARBOR_URL||process.env.TOKEN_HARBOR_URL||"https://tokenharbor.ai/v1/chat/completions",O={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},P=A||process.env.TOKENHARBOR_API_KEY||process.env.TOKEN_HARBOR_API_KEY||"";O.Authorization=`Bearer ${P}`;let l=await R(K,{method:"POST",headers:O,body:JSON.stringify(D),signal:v});if(!l.ok){let s=await l.json().catch(()=>({}));throw new Error(`Token Harbor Error (${l.status}): ${s.error?.message||s.message||l.statusText}`)}let F=l.body.getReader(),L=new TextDecoder,m="",t=[],c=null,f=Date.now(),o=!1,d=[],E=0,S=5,b=!0,_=()=>{d.length>0&&(t.push(...d),d=[],o=!0),b=!1};for(;;){let{done:s,value:T}=await F.read();if(s){_(),o&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}m+=L.decode(T,{stream:!0});let e=m.split(`
2
- `);m=e.pop();for(let n of e){let i=n.trim();if(!i||!i.startsWith("data: "))continue;let u=!1;if(i==="data: [DONE]")u=!0,_();else try{let p=JSON.parse(i.substring(6)),a=p.choices?.[0]?.delta,r=p.usage;if(r&&(c={totalTokenCount:r.total_tokens||(r.prompt_tokens||0)+(r.completion_tokens||0),promptTokenCount:r.prompt_tokens||0,candidatesTokenCount:r.completion_tokens||0,cachedContentTokenCount:r.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:r.completion_tokens_details?.reasoning_tokens||r.reasoning_tokens||0},o=!0),a){let h=a.reasoning_content||a.reasoning||null;!h&&Array.isArray(a.reasoning_details)&&a.reasoning_details.length>0&&(h=a.reasoning_details.map(U=>U.text||"").filter(Boolean).join("")),h&&(t.push({text:h,thought:!0}),o=!0),a.content&&(b?(d.push({text:a.content}),E++,E>=S&&_()):(t.push({text:a.content}),o=!0))}}catch{}if((u||Date.now()-f>=150)&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],f=Date.now(),o=!1),u)break}Date.now()-f>=150&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],f=Date.now(),o=!1)}};export{J as getTokenHarborStream};
@@ -1,2 +0,0 @@
1
- import{a as C}from"./chunk-PTFCY2D5.js";import{a as b}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var U=async function*(M,_,A,x,y,$,E,K,F=1){let g=[];x&&g.push({role:"system",content:x});for(let n of A){let m=n.role==="user"?"user":"assistant",e=[];if(Array.isArray(n.parts)){for(let o of n.parts)if(o.text)e.push({type:"text",text:o.text});else if(o.inlineData&&E){let i=o.inlineData.mimeType,u=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${u}`}})}}else{let o=n.text||"";o&&e.push({type:"text",text:o})}g.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let k=b("xKiro",_,y),w=k!==null?k:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"xhigh"}[y],T={model:_,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:F,tools:[],tool_choice:"none"};w&&(T.reasoning_effort=w);let O=process.env.XKIRO_URL||"https://api.xkiro.com/v1/chat/completions",D={"Content-Type":"application/json","X-Title":"FluxFlow","User-Agent":"FluxFlow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},v=M||process.env.XKIRO_API_KEY||"";D.Authorization=`Bearer ${v}`;let l=await C(O,{method:"POST",headers:D,body:JSON.stringify(T),signal:K});if(!l.ok){let n=await l.json().catch(()=>({}));throw new Error(`xKiro Error (${l.status}): ${n.error?.message||n.message||l.statusText}`)}let P=l.body.getReader(),R=new TextDecoder,h="",t=[],c=null,f=Date.now(),a=!1;for(;;){let{done:n,value:m}=await P.read();if(n){a&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}h+=R.decode(m,{stream:!0});let e=h.split(`
2
- `);h=e.pop();for(let o of e){let i=o.trim();if(!i||!i.startsWith("data: "))continue;let u=!1;if(i==="data: [DONE]")u=!0;else try{let p=JSON.parse(i.substring(6)),r=p.choices?.[0]?.delta,s=p.usage;if(s&&(c={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),r){let d=r.reasoning_content||r.reasoning||null;!d&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(d=r.reasoning_details.map(S=>S.text||"").filter(Boolean).join("")),d&&(t.push({text:d,thought:!0}),a=!0),r.content&&(t.push({text:r.content}),a=!0)}}catch{}if((u||Date.now()-f>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],f=Date.now(),a=!1),u)break}Date.now()-f>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],f=Date.now(),a=!1)}};export{U as getXKiroStream};