fluxflow-cli 4.36.5 → 4.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cat.txt +3 -3
- package/dist/chunks/{9router-4EJCHCIO.js → 9router-CKETGMBB.js} +1 -1
- package/dist/chunks/{addMemScore-BCPTSMKD.js → addMemScore-76XLEW3K.js} +1 -1
- package/dist/chunks/{ai-ZW5X4EZL.js → ai-7MHGXUAH.js} +1 -1
- package/dist/chunks/{aihubmix-ZANBMI5F.js → aihubmix-YSGVPUM4.js} +1 -1
- package/dist/chunks/{apinex-MSG2QNBL.js → apinex-VI576FVJ.js} +1 -1
- package/dist/chunks/app-FZZED7CY.js +331 -0
- package/dist/chunks/{chat-MELTWDZ3.js → chat-RLEHK3MX.js} +1 -1
- package/dist/chunks/{chunk-4MDSKJGX.js → chunk-2VV5ZE53.js} +1 -1
- package/dist/chunks/{chunk-FQBBOFNP.js → chunk-3JI2CRXK.js} +1 -1
- package/dist/chunks/chunk-5Z3AJKD6.js +919 -0
- package/dist/chunks/{chunk-SZYN3VHU.js → chunk-BTMPM5BT.js} +1 -1
- package/dist/chunks/{chunk-QYNGDXPT.js → chunk-CBFC5KUU.js} +1 -1
- package/dist/chunks/{chunk-KHCAQOSP.js → chunk-ET66XVIM.js} +1 -1
- package/dist/chunks/{chunk-JS5ZIGFR.js → chunk-FAEB3V5R.js} +1 -1
- package/dist/chunks/chunk-FSE4BZZZ.js +1 -0
- package/dist/chunks/{chunk-VYTQ6J56.js → chunk-HOZQBBAO.js} +1 -1
- package/dist/chunks/{chunk-MTPBPPXV.js → chunk-JTTVSAKS.js} +1 -1
- package/dist/chunks/{chunk-OA7SWSBR.js → chunk-K4AZXTU6.js} +1 -1
- package/dist/chunks/{chunk-KAL5XSAQ.js → chunk-LTX2IUDV.js} +9 -10
- package/dist/chunks/chunk-M2ULCOL3.js +2 -0
- package/dist/chunks/chunk-MJL6DHQM.js +5 -0
- package/dist/chunks/{chunk-BGIZLZQF.js → chunk-PRTGV2R4.js} +1 -1
- package/dist/chunks/{chunk-7SFAWGE2.js → chunk-QOT4BYHM.js} +1 -1
- package/dist/chunks/{chunk-RZTZPIC5.js → chunk-T4ZG2WCV.js} +1 -1
- package/dist/chunks/click-B4ZRHV4Z.js +2 -0
- package/dist/chunks/{computer_action-WORDXIQY.js → computer_action-2RYMIFAM.js} +1 -1
- package/dist/chunks/{custom_openai-VP2CSZUQ.js → custom_openai-TLPPKENJ.js} +1 -1
- package/dist/chunks/{deepseek-Y4NFGKGV.js → deepseek-2GJCWFSR.js} +1 -1
- package/dist/chunks/{drag-LC3MFJZ7.js → drag-RNGTIO2V.js} +1 -1
- package/dist/chunks/{emergency_rollback-6X27LZE4.js → emergency_rollback-NXD2JKBG.js} +1 -1
- package/dist/chunks/{exec_command-ZPCKBWBK.js → exec_command-KLASTN6U.js} +1 -1
- package/dist/chunks/{explabs-4D3EJOBE.js → explabs-YICY4AMR.js} +1 -1
- package/dist/chunks/{export-QFE76VEG.js → export-C6VVIYP5.js} +1 -1
- package/dist/chunks/{file_map-KS6Y7BP3.js → file_map-T5FHB3F6.js} +1 -1
- package/dist/chunks/{find_file-A6NYLQJS.js → find_file-LZR7NET3.js} +1 -1
- package/dist/chunks/{generate_image-EKX5PUUR.js → generate_image-75IV5P3L.js} +1 -1
- package/dist/chunks/{inferx-R7LOBSCS.js → inferx-YMU7LMOQ.js} +1 -1
- package/dist/chunks/{infron-DMF34OSO.js → infron-A4BOV2AA.js} +1 -1
- package/dist/chunks/{invoke-M6VUQ6GW.js → invoke-RL5RGO3A.js} +2 -2
- package/dist/chunks/{invokeSync-MW7SR3Z4.js → invokeSync-3X4TEPBK.js} +2 -2
- package/dist/chunks/{key_press-PDKXVENN.js → key_press-3VU6SHNQ.js} +1 -1
- package/dist/chunks/{keyboard_typing-UTFSDB4P.js → keyboard_typing-PCW3ISET.js} +1 -1
- package/dist/chunks/{memory-M7ASUB6J.js → memory-4DXO4K5C.js} +1 -1
- package/dist/chunks/{mistral-LNEFQAV5.js → mistral-2CZKHKDT.js} +1 -1
- package/dist/chunks/{model_config-55WPIUYV.js → model_config-VYWFV55M.js} +1 -1
- package/dist/chunks/{nvidia-GMX2ROSD.js → nvidia-EOLGFGFZ.js} +1 -1
- package/dist/chunks/{ollama-ZPTZJK7V.js → ollama-OHD5BFI7.js} +1 -1
- package/dist/chunks/{openrouter-T22AQJY6.js → openrouter-SK7LO52I.js} +1 -1
- package/dist/chunks/paths-EQFOJDZC.js +1 -0
- package/dist/chunks/{poolside-IS5XCHAE.js → poolside-SAAXTNGR.js} +1 -1
- package/dist/chunks/{saveSummary-UGNDVNI5.js → saveSummary-ZSJ2UKLG.js} +1 -1
- package/dist/chunks/screen_grid-Z2S4GMN5.js +1 -0
- package/dist/chunks/{scroll-UPGZCBPD.js → scroll-YSFTTROP.js} +1 -1
- package/dist/chunks/search_keyword-G3PCZR3C.js +8 -0
- package/dist/chunks/{secrets-UNXNDOLK.js → secrets-GHW6AWRR.js} +1 -1
- package/dist/chunks/{sensenova-AJZGPQZ5.js → sensenova-MQKZ7TNO.js} +1 -1
- package/dist/chunks/settings-5R5ADGXX.js +1 -0
- package/dist/chunks/{todo-GFMPH2JV.js → todo-KQCKHQBJ.js} +1 -1
- package/dist/chunks/{tokenharbor-3ZMTIJ2M.js → tokenharbor-A46BJ445.js} +1 -1
- package/dist/chunks/{ui_detector_onnx-YGGFMOK5.js → ui_detector_onnx-XRKXFWLG.js} +1 -1
- package/dist/chunks/{update_file-NBLTUYHL.js → update_file-OQMKLO6R.js} +1 -1
- package/dist/chunks/{usage-CAY5LYRU.js → usage-2WRVNL44.js} +1 -1
- package/dist/chunks/{usageServer-PJOHIWJT.js → usageServer-6XH36WK3.js} +1 -1
- package/dist/chunks/view_file-TZD6DAER.js +1 -0
- package/dist/chunks/{web_scrape-JO4DDXKB.js → web_scrape-KBKSNVBI.js} +1 -1
- package/dist/chunks/{web_search-2PFIJKIL.js → web_search-HACFAHXR.js} +1 -1
- package/dist/chunks/{write_docx-4Y43QJUV.js → write_docx-M5RMUI4W.js} +1 -1
- package/dist/chunks/{write_file-FZZRCU3L.js → write_file-2ZFCDYSW.js} +1 -1
- package/dist/chunks/{write_pdf-N2Q4Z3YP.js → write_pdf-E5HQYOTR.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/dist/chunks/app-KNIDIMIZ.js +0 -331
- package/dist/chunks/chunk-DSVLWYIT.js +0 -2
- package/dist/chunks/chunk-IS6NOF47.js +0 -5
- package/dist/chunks/chunk-LFDC5AM7.js +0 -916
- package/dist/chunks/chunk-QWEEC3PP.js +0 -1
- package/dist/chunks/click-PNIGPARB.js +0 -2
- package/dist/chunks/paths-2EXHWUSL.js +0 -1
- package/dist/chunks/screen_grid-PVVRYV5G.js +0 -1
- package/dist/chunks/search_keyword-ARDEFVCK.js +0 -6
- package/dist/chunks/settings-GLFTNEAT.js +0 -1
- package/dist/chunks/view_file-2THVIMD6.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as o}from"./chunk-
|
|
1
|
+
import{t as o}from"./chunk-M2ULCOL3.js";import r from"fs-extra";import l from"path";import d from"https";var j={js:"tree-sitter-javascript.wasm",jsx:"tree-sitter-javascript.wasm",ts:"tree-sitter-typescript.wasm",tsx:"tree-sitter-tsx.wasm",py:"tree-sitter-python.wasm",c:"tree-sitter-c.wasm",cpp:"tree-sitter-cpp.wasm",java:"tree-sitter-java.wasm",html:"tree-sitter-html.wasm"};async function f(t,s=null){let p=s||`https://unpkg.com/tree-sitter-wasms@0.1.13/out/${t}`,i=l.join(o,t);return await r.ensureDir(o),new Promise((m,n)=>{let h={headers:{"User-Agent":"FluxFlow-Agent"}};d.get(p,h,e=>{if([301,302,307,308].includes(e.statusCode)&&e.headers.location){let a=e.headers.location;if(!a.startsWith("http")){let u=new URL(p);a=`${u.protocol}//${u.host}${a}`}f(t,a).then(m).catch(n);return}if(e.statusCode!==200){n(new Error(`Failed to download ${t}: HTTP ${e.statusCode}`));return}let c=r.createWriteStream(i);e.pipe(c),c.on("finish",()=>{c.close(),m()})}).on("error",e=>{r.existsSync(i)&&r.unlink(i,()=>{}),n(e)})})}function S(t){let s=l.join(o,t);return r.existsSync(s)}async function $(t){let s=l.join(o,t);r.existsSync(s)&&await r.unlink(s)}export{j as a,f as b,S as c,$ as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as f}from"./chunk-
|
|
1
|
+
import{g as f}from"./chunk-MJL6DHQM.js";import{mouse as c,keyboard as i,Button as u,Key as e,Point as l,clipboard as g}from"@nut-tree-fork/nut-js";c.config.autoDelayMs=50;i.config.autoDelayMs=50;async function w(){try{await i.releaseKey(e.LeftControl,e.RightControl,e.LeftAlt,e.RightAlt,e.LeftShift,e.RightShift,e.LeftSuper,e.RightSuper)}catch{}}async function h(n,t,s={}){let r=await f(t);if(!r&&(n==="move"||n==="click"||n==="drag"))return`ERROR: Invalid target location specified: ${JSON.stringify(t)}`;try{switch(n.toLowerCase()){case"move":return await c.setPosition(new l(r.x,r.y)),`Moved mouse to grid target ${typeof t=="string"?t:`(${r.x}, ${r.y})`}`;case"click":{await c.setPosition(new l(r.x,r.y));let a=s.button==="right"?u.RIGHT:s.button==="middle"?u.MIDDLE:u.LEFT;return s.clickType==="double"?await c.doubleClick(a):await c.click(a),`${s.clickType||"Single"} clicked ${s.button||"left"} button at ${typeof t=="string"?t:`(${r.x}, ${r.y})`}`}case"drag":{let a=await f(s.from||t),o=await f(s.to);return!a||!o?'ERROR: Drag requires valid "from" and "to" target coordinates/grid codes.':(await c.setPosition(new l(a.x,a.y)),await c.pressButton(u.LEFT),await c.setPosition(new l(o.x,o.y)),await c.releaseButton(u.LEFT),`Dragged mouse from (${a.x}, ${a.y}) to (${o.x}, ${o.y})`)}case"scroll":{let a=r||await f({x:640,y:360});a&&(await c.setPosition(new l(a.x,a.y)),await new Promise(d=>setTimeout(d,60)));let o=parseInt(s.amount,10);(isNaN(o)||o<=0)&&(o=5);let y=o>50?Math.min(20,Math.max(1,Math.round(o/100))):Math.min(20,o),R=s.direction==="up";for(let d=0;d<y;d++)R?await c.scrollUp(120):await c.scrollDown(120),await new Promise(L=>setTimeout(L,20));return`Scrolled ${s.direction||"down"} (${y} notches${r?` at target (${r.x}, ${r.y})`:" at screen center"})`}default:return`ERROR: Unsupported mouse action "${n}"`}}catch(a){return`ERROR: Mouse action failed: ${a.message}`}}var m={enter:e.Enter,return:e.Return,escape:e.Escape,esc:e.Escape,backspace:e.Backspace,tab:e.Tab,space:e.Space,up:e.Up,down:e.Down,left:e.Left,right:e.Right,ctrl:e.LeftControl,control:e.LeftControl,alt:e.LeftAlt,shift:e.LeftShift,cmd:e.LeftCmd,win:e.LeftWin,meta:e.LeftWin,super:e.LeftSuper,a:e.A,b:e.B,c:e.C,d:e.D,e:e.E,f:e.F,g:e.G,h:e.H,i:e.I,j:e.J,k:e.K,l:e.L,m:e.M,n:e.N,o:e.O,p:e.P,q:e.Q,r:e.R,s:e.S,t:e.T,u:e.U,v:e.V,w:e.W,x:e.X,y:e.Y,z:e.Z,0:e.Num0,1:e.Num1,2:e.Num2,3:e.Num3,4:e.Num4,5:e.Num5,6:e.Num6,7:e.Num7,8:e.Num8,9:e.Num9,f1:e.F1,f2:e.F2,f3:e.F3,f4:e.F4,f5:e.F5,f6:e.F6,f7:e.F7,f8:e.F8,f9:e.F9,f10:e.F10,f11:e.F11,f12:e.F12},p=n=>{if(!n)return;let t=String(n).toLowerCase().trim();if(m[t]!==void 0)return m[t];if(e[n]!==void 0)return e[n];if(e[t.toUpperCase()]!==void 0)return e[t.toUpperCase()]};async function E(n,t,s={}){try{switch(n.toLowerCase()){case"type":{if(typeof t!="string")return"ERROR: Type action requires a valid string input";await w(),await g.setContent(t);let a=process.platform==="darwin"?e.LeftSuper:e.LeftControl;return await i.pressKey(a,e.V),await i.releaseKey(a,e.V),await w(),s.autoPressEnter?(await new Promise(o=>setTimeout(o,50)),await i.type(e.Enter),`Typed text input ("${t.length>20?t.substring(0,20)+"...":t}") and pressed Enter`):`Typed text input ("${t.length>20?t.substring(0,20)+"...":t}")`}case"key_press":{let r=p(t);return r===void 0?`ERROR: Unknown key name "${t}"`:(await i.type(r),`Pressed key ${t}`)}case"key_combination":{if(!Array.isArray(t))return'ERROR: key_combination requires an array of keys (e.g. ["ctrl", "c"])';let r=t.map(a=>p(a)).filter(a=>a!==void 0);return r.length===0?"ERROR: Invalid key combination":(await i.pressKey(...r),await i.releaseKey(...r),`Executed key combination [${t.join(" + ")}]`)}case"clear_input":return await i.pressKey(e.LeftControl,e.A),await i.releaseKey(e.LeftControl,e.A),await i.type(e.Backspace),"Cleared active text input (Select All + Backspace)";case"browser_back":{let r=process.platform==="darwin";return r?(await i.pressKey(e.LeftSuper,e.Left),await i.releaseKey(e.LeftSuper,e.Left)):(await i.pressKey(e.LeftAlt,e.Left),await i.releaseKey(e.LeftAlt,e.Left)),await w(),`Browser back navigation (${r?"Cmd+Left":"Alt+Left"})`}default:return`ERROR: Unsupported keyboard action "${n}"`}}catch(r){return`ERROR: Keyboard action failed: ${r.message}`}}export{h as a,E as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as E,d as s}from"./chunk-L3W2X74K.js";import{e as _}from"./chunk-
|
|
1
|
+
import{c as E,d as s}from"./chunk-L3W2X74K.js";import{e as _}from"./chunk-M2ULCOL3.js";import A from"fs-extra";import l from"path";var a=l.join(_,"secrets.json"),f=async()=>{try{let t=E(a,{});if(t.API_KEY)return t.API_KEY}catch{}return null},Y=async t=>{try{let n=E(a,{});if(t==="Google")return n.GOOGLE_API_KEY||n.API_KEY||null;if(t==="DeepSeek")return n.DEEPSEEK_API_KEY||null;if(t==="OpenRouter")return n.OPENROUTER_API_KEY||null;if(t==="Mistral")return n.MISTRAL_API_KEY||null;if(t==="NVIDIA")return n.NVIDIA_API_KEY||null;if(t==="Ollama")return n.OLLAMA_API_KEY||"LOCAL";if(t==="InferX")return n.INFERX_API_KEY||null;if(t==="SenseNova"||t==="Sensenova")return n.SENSENOVA_API_KEY||null;if(t==="Poolside"||t==="poolside")return n.POOLSIDE_API_KEY||null;if(t==="9router"||t==="9Router")return n["9ROUTER_API_KEY"]||"LOCAL";if(t==="ExpLabs"||t==="ExperientialLabs"||t==="ExperimentalLabs"||t==="explabs")return n.EXPLABS_API_KEY||n.EXPERIENTIALLABS_API_KEY||null;if(t==="TokenHarbor"||t==="Token Harbor"||t==="tokenharbor"||t==="token_harbor"||t==="thk")return n.TOKENHARBOR_API_KEY||n.TOKEN_HARBOR_API_KEY||null;if(t==="Infron"||t==="infron")return n.INFRON_API_KEY||null;if(t==="APInex"||t==="apinex"||t==="apx")return n.APINEX_API_KEY||null;if(t==="c_openai"||t==="Custom (OpenAI)")return n.CUSTOM_OPENAI_API_KEY||n.C_OPENAI_API_KEY||null}catch{}return null},o=async(t,n)=>{t==="Google"?(await e("GOOGLE_API_KEY",n),await e("API_KEY",n)):t==="DeepSeek"?await e("DEEPSEEK_API_KEY",n):t==="OpenRouter"?await e("OPENROUTER_API_KEY",n):t==="Mistral"?await e("MISTRAL_API_KEY",n):t==="NVIDIA"?await e("NVIDIA_API_KEY",n):t==="Ollama"?await e("OLLAMA_API_KEY",n):t==="InferX"?await e("INFERX_API_KEY",n):t==="SenseNova"||t==="Sensenova"?await e("SENSENOVA_API_KEY",n):t==="Poolside"||t==="poolside"?await e("POOLSIDE_API_KEY",n):t==="9router"||t==="9Router"?await e("9ROUTER_API_KEY",n):t==="ExpLabs"||t==="ExperientialLabs"||t==="ExperimentalLabs"||t==="explabs"?await e("EXPLABS_API_KEY",n):t==="TokenHarbor"||t==="Token Harbor"||t==="tokenharbor"||t==="token_harbor"||t==="thk"?await e("TOKENHARBOR_API_KEY",n):t==="Infron"||t==="infron"?await e("INFRON_API_KEY",n):t==="APInex"||t==="apinex"||t==="apx"?await e("APINEX_API_KEY",n):(t==="c_openai"||t==="Custom (OpenAI)")&&await e("CUSTOM_OPENAI_API_KEY",n)},S=async t=>{try{return E(a,{})[t]||null}catch{return null}},e=async(t,n)=>{await A.ensureDir(_);let I=E(a,{});I[t]=n,s(a,I,!0)},R=async()=>{try{let t=E(a,{});return{key:t.GOOGLE_API_KEY||t.API_KEY,cx:t.SEARCH_ID}}catch{}return{key:null,cx:null}},x=async t=>e("API_KEY",t),L=async t=>e("GOOGLE_API_KEY",t),N=async t=>e("SEARCH_ID",t),P=async t=>{try{let n=E(a,{});delete n[t],s(a,n,!0)}catch{}},r=async()=>P("API_KEY");export{f as a,Y as b,o as c,S as d,e,R as f,x as g,L as h,N as i,P as j,r as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,v as u}from"./chunk-
|
|
1
|
+
import{a as l,v as u}from"./chunk-M2ULCOL3.js";import f from"fs";var o=null,a=()=>{try{if(f.existsSync(u)){let e=f.readFileSync(u,"utf-8"),n=JSON.parse(e);if(n&&typeof n=="object")return o=n,o}}catch{}return o=o||{},o},y=e=>{try{return f.existsSync(l)||f.mkdirSync(l,{recursive:!0}),f.writeFileSync(u,JSON.stringify(e,null,2),"utf-8"),o=e,!0}catch{return!1}},C=(e,n,c)=>{if(!e||!n||!c)return null;let s=o||a(),t=`${e}::${n}`,r=s[t];if(r&&typeof r=="object"){let i=c.toLowerCase();if(r[i]!==void 0&&r[i]!==null)return r[i];for(let[g,k]of Object.entries(r))if(g.toLowerCase()===i)return k}return null},x=(e,n,c,s)=>{if(!e||!n||!c||!s)return{success:!1,reason:"Invalid arguments"};let t=o||a(),r=`${e}::${n}`;return(!t[r]||typeof t[r]!="object")&&(t[r]={}),t[r][c.toLowerCase()]=s,{success:y(t)}},I=(e,n,c)=>{if(!e||!n)return{success:!1,reason:"Invalid arguments"};let s=o||a(),t=`${e}::${n}`;return s[t]&&(c?(delete s[t][c.toLowerCase()],Object.keys(s[t]).length===0&&delete s[t]):delete s[t],y(s)),{success:!0}};export{C as a,x as b,I as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as g,f as c}from"./chunk-L3W2X74K.js";import{b as s}from"./chunk-M2ULCOL3.js";import n from"fs-extra";import m from"path";var r={mode:"Flux",display:0,thinkingLevel:"Medium",aiProvider:"",activeModel:"",showFullThinking:!0,apiTier:"Free",quotas:{agentLimit:999999,backgroundLimit:999999,searchLimit:100,customModelId:"",customLimit:0,providerTiers:{Google:"Free",DeepSeek:"Free",NVIDIA:"Free",OpenRouter:"Free",InferX:"Free",SenseNova:"Free",Poolside:"Free",ExpLabs:"Free",TokenHarbor:"Free",Infron:"Free",APInex:"Free",c_openai:"Free"}},systemSettings:{customOpenAIBaseUrl:"",memory:!1,theme:"Dark",compression:0,autoExec:!0,allowExternalAccess:!1,advanceRollback:!1,autoDeleteHistory:"7d",useExternalData:!1,externalDataPath:"",preserveThinking:!0,loadingPhrases:!1,progressiveRendering:!0,showTPMEstimate:!0,subAgents:!1,CustomSubAgent:!1,SubAgentModel:"Default",SubAgentProvider:"",dynamicDirAwareness:!1,indentationTree:!0,ollamaEndpoint:"Cloud",compressToolResults:!1,autoTruncateResults:!0,imageHistoryCU:"Standard",contextLength:"256k",keepReasoningContext:!1,autoExcludeMetadata:!1,disableTodo:!1,alwaysAskFiles:".env, .env.*, *.env"},profileData:{name:null,nickname:null,instructions:null},imageSettings:{keyType:"Default",quality:"Low-High",apiKey:""}},d=async()=>{let t={...r};try{if(await n.exists(s)){let e=g(s);if(e.imageSettings&&e.imageSettings.apiKey)try{let a=e.imageSettings.apiKey,{saveSecret:i}=await import("./secrets-GHW6AWRR.js");await i("POLLINATIONS_API_KEY",a),e.imageSettings.apiKey="",c(s,e)}catch{}t={...r,...e,quotas:{...r.quotas,...e.quotas,providerTiers:{...r.quotas.providerTiers,...e.quotas?.providerTiers||{}}},systemSettings:{...r.systemSettings,...e.systemSettings},profileData:{...r.profileData,...e.profileData},imageSettings:{...r.imageSettings,...e.imageSettings}}}}catch(e){console.error("Failed to load settings:",e)}try{let{getSecret:e}=await import("./secrets-GHW6AWRR.js"),a=await e("POLLINATIONS_API_KEY");a&&(t.imageSettings.apiKey=a)}catch{}if(t.showFullThinking===!1){t.showFullThinking=!0;try{c(s,t)}catch{}}return t},p=async t=>{let{FLUXFLOW_DIR:e}=await import("./paths-EQFOJDZC.js"),a=["logs","secret"];for(let i of a){let l=m.join(e,i),o=m.join(t,i);try{await n.exists(l)&&(await n.ensureDir(o),await n.copy(l,o,{overwrite:!0}))}catch(u){console.error(`Migration failed for ${i}:`,u)}}},v=async t=>{try{let e=await d();if(!e.systemSettings.useExternalData&&t.systemSettings?.useExternalData&&t.systemSettings?.externalDataPath&&await p(t.systemSettings.externalDataPath),t.imageSettings&&t.imageSettings.apiKey!==void 0){let{saveSecret:i,removeSecret:l}=await import("./secrets-GHW6AWRR.js"),o=t.imageSettings.apiKey;o?await i("POLLINATIONS_API_KEY",o):await l("POLLINATIONS_API_KEY")}let a={...e,...t};a.systemSettings&&(a.systemSettings.dynamicDirAwareness=!1),a.imageSettings&&(a.imageSettings={...a.imageSettings,apiKey:""}),await n.ensureDir(m.dirname(s)),c(s,a);try{let{invalidateCachedBaseUrl:i}=await import("./usage-2WRVNL44.js");i()}catch{}return!0}catch(e){return console.error("Failed to save settings:",e),!1}};export{d as a,v as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b}from"./chunk-
|
|
1
|
+
import{a as b}from"./chunk-3JI2CRXK.js";import{c as d,d as l}from"./chunk-L3W2X74K.js";import{f as h,g as m,l as C,m as M,s as f}from"./chunk-M2ULCOL3.js";import u from"fs-extra";import j from"path";import{nanoid as L}from"nanoid";var D=Promise.resolve(),A=t=>{let r=D.then(async()=>{try{return await t()}catch(e){throw console.error("Lock Operation Failed:",e),e}});return D=r.catch(()=>{}),r},T=async()=>{await u.ensureDir(m);let t={};if(await u.pathExists(h))try{t=d(h,{})}catch{t={}}for(let r in t){let e=j.join(m,`${r}.json`);Object.defineProperty(t[r],"messages",{get:()=>{if(u.existsSync(e))try{return d(e,[])}catch{return[]}return[]},set:n=>{try{l(e,n)}catch{}},enumerable:!1,configurable:!0})}return t},B=async(t,r,e)=>A(async()=>{await u.ensureDir(m);let n=await T(),s=n[t],i=(e||[]).filter(a=>!a.isUpdateNotification&&(!a.isMeta||a.text&&a.text.includes("Request Cancelled"))),o=a=>{if(!a)return;let I=typeof a=="string"?a:a.text||a.content||"";if(!I||typeof I!="string")return;let w=I.replace(/\s*\n+\s*\[Prompted on:.*?\]/g,"").replace(/\[\/?(?:STEERING HINT|QUESTION)(?::\s*\w+)?\]/gi,"").trim();if(!w)return;let O=w.split(/\s+/),E;return O.length>7?E=O.slice(0,7).join(" ")+"...":w.length>45?E=w.substring(0,45).trimEnd()+"...":E=w,E},c,y=i.filter(a=>a.role==="user"),p=y[0],g=y[y.length-1],x=o(g),H=o(p);s&&s.prompt?Math.random()<.3&&x?c=x:c=s.prompt:c=H||x;let S=r||(s?s.name:`Session ${t.slice(-6)}`),F=j.join(m,`${t}.json`);l(F,i),n[t]={name:S,prompt:c||void 0,updatedAt:Date.now()};let k={};for(let a in n)k[a]={name:n[a].name,prompt:n[a].prompt||void 0,updatedAt:n[a].updatedAt};l(h,k)}),J=async(t,r)=>A(async()=>{let e=await T();e[t]?(e[t].name=r,e[t].updatedAt=Date.now()):e[t]={name:r,updatedAt:Date.now()};let n={};for(let s in e)n[s]={name:e[s].name,prompt:e[s].prompt||void 0,updatedAt:e[s].updatedAt};l(h,n)}),N=async t=>A(async()=>{let r=await T();delete r[t];let e={};for(let o in r)e[o]={name:r[o].name,prompt:r[o].prompt||void 0,updatedAt:r[o].updatedAt};if(l(h,e),await u.pathExists(f))try{let o=d(f,[]);if(Array.isArray(o)){let c=o.filter(y=>Object.keys(y)[0]!==String(t));l(f,c)}}catch{}let n=d(C,{});n[t]&&(delete n[t],l(C,n));let s=d(M,{});s[t]&&(delete s[t],l(M,s)),await b.deleteChatBackups(t);let i=j.join(m,`${t}.json`);if(await u.pathExists(i))try{await u.remove(i)}catch{}return r}),Y=()=>`flow-${L(6)}`,q=async t=>{if(!t||t==="Never")return;let r=parseInt(t);if(isNaN(r))return;let e=await T(),n=Date.now(),s=r*24*60*60*1e3,i=0;for(let o in e){let c=e[o];c.updatedAt&&n-c.updatedAt>s&&(await N(o),i++)}return i},G=(t,r=4)=>{if(t.length<=1)return t;let e=t[0],n=t.slice(1),s=r*2,i=n.slice(s);return[e,...i]};var K=async(t,r,e)=>A(async()=>{let n=d(f,[]);Array.isArray(n)||(n=[]);let s=r||0,i=e||0,o={total:s,context:i},c=n.findIndex(p=>Object.keys(p)[0]===String(t));s===0&&i===0?c!==-1&&n.splice(c,1):c!==-1?n[c]={[String(t)]:o}:n.push({[String(t)]:o});let y=n.filter(p=>{if(!p||typeof p!="object")return!1;let g=Object.keys(p)[0];if(!g)return!1;let x=p[g];return x&&((x.total||0)>0||(x.context||0)>0)});l(f,y)}),Q=async t=>{try{if(!await u.pathExists(f))return{total:0,context:0};let r=d(f,[]);if(!Array.isArray(r))return{total:0,context:0};let e=r.find(n=>Object.keys(n)[0]===String(t));return e?{total:0,context:0,...e[String(t)]}:{total:0,context:0}}catch{return{total:0,context:0}}};export{T as a,B as b,J as c,N as d,Y as e,q as f,G as g,K as h,Q as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as b,b as C}from"./chunk-
|
|
1
|
+
import{a as b,b as C}from"./chunk-LTX2IUDV.js";import{a as S}from"./chunk-Y5JU726N.js";import{spawn as A}from"child_process";var P=null;try{let f=await import("node-pty");P=f.default||f}catch{}var I=!!P,y=f=>typeof f!="string"?f:f.replace(/(?:\u001b][\s\S]*?(?:\u0007|\u001b\\))|(?:[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><])/g,""),E=f=>{if(!f)return"";let p=[[]],n=0,o=0,w=/\x1b\[([0-9;]*?)([a-zA-Z])/g,g=0,h,d=a=>{for(let e=0;e<a.length;e++){let t=a[e];if(t===`
|
|
2
2
|
`)for(n++,o=0;n>=p.length;)p.push([]);else if(t==="\r")o=0;else{for(;n>=p.length;)p.push([]);let s=p[n];for(;o>s.length;)s.push(" ");s[o]=t,o++}}};for(;(h=w.exec(f))!==null;){d(f.substring(g,h.index));let a=h[1],e=h[2],t=a?a.split(";").map(Number):[];if(e==="A"){let s=t[0]||1;n=Math.max(0,n-s)}else if(e==="B"){let s=t[0]||1;for(n=n+s;n>=p.length;)p.push([])}else if(e==="C"){let s=t[0]||1;o=o+s}else if(e==="D"){let s=t[0]||1;o=Math.max(0,o-s)}else if(e==="G"){let s=(t[0]||1)-1;o=Math.max(0,s)}else if(e==="H"||e==="f"){let s=(t[0]||1)-1,r=(t[1]||1)-1;for(n=Math.max(0,s),o=Math.max(0,r);n>=p.length;)p.push([])}else if(e==="K"){let s=t[0]||0;if(n<p.length){let r=p[n];if(s===0)r.length=o;else if(s===1)for(let c=0;c<o&&c<r.length;c++)r[c]=" ";else s===2&&(r.length=0)}}else if(e==="J"){let s=t[0]||0;(s===2||s===3)&&(p.length=0,p.push([]),n=0,o=0)}g=w.lastIndex}d(f.substring(g));let O=p.map(a=>a.join(""));for(;O.length>0&&O[O.length-1]==="";)O.pop();return O.join(`
|
|
3
3
|
`)},x=null,k=!1,_=f=>{try{x&&(k&&typeof x.write=="function"?x.write(f):x.stdin&&x.stdin.writable&&x.stdin.write(f))}catch{}},W=()=>{if(x){try{k&&typeof x.destroy=="function"?x.destroy():typeof x.kill=="function"&&(process.platform==="win32"?A("taskkill",["/pid",x.pid,"/f","/t"]):x.kill("SIGKILL"))}catch{}x=null,k=!1}},T=(f,p=!1)=>{if(process.platform!=="win32"||process.env.ADJUST_WINDOWS_COMMAND!=="true")return f;let n=[],o="",w=null,g=!1;for(let e=0;e<f.length;e++){let t=f[e];if(g){o+=t,g=!1;continue}if(t==="\\"){if(!w&&f[e+1]===" "){o+=" ",e++;continue}o+=t,g=!0;continue}w?(t===w&&(w=null),o+=t):t==='"'||t==="'"?(w=t,o+=t):t===";"&&!o.includes("://")?(o.length>0&&(n.push(o),o=""),n.push(p?";":"&")):t==="&"&&!o.includes("://")?f[e+1]==="&"?(o.length>0&&(n.push(o),o=""),n.push("&&"),e++):o.endsWith("2>")&&f[e+1]==="1"?(n.push("2>&1"),o="",e++):(o.length>0&&(n.push(o),o=""),n.push("&")):t==="|"&&!o.includes("://")?(o.length>0&&(n.push(o),o=""),n.push("|")):(t===">"||t==="<")&&(e===0||/\s|['"]/.test(f[e-1]||""))?(o.length>0&&(n.push(o),o=""),t===">"&&f[e+1]===">"?(n.push(">>"),e++):n.push(t)):/\s/.test(t)?o.length>0&&(n.push(o),o=""):o+=t}o.length>0&&n.push(o);let h=e=>!(!e.includes("/")||/^(https?|file|ftp):\/\//i.test(e)||e.startsWith("@")||e.startsWith("/")&&(e.match(/\//g)||[]).length===1||/\s\/|\/\s/.test(e)||/[\(\)\{\}\;\<\>\=\'\"]/.test(e)),d=[];for(let e=0;e<n.length;e++){let t=n[e];if(t==="mkdir"&&p&&b()){let s=[],r=e+1;for(;r<n.length;){let c=n[r];if([">",">>","<","&","&&","|","||",";"].includes(c))break;c!=="-p"&&c!=="--parents"&&c!=="-v"&&c!=="--verbose"&&s.push(c),r++}if(s.length>0){let c=s.map(i=>{let u=i.replace(/^['"]|['"]$/g,""),l=i;return h(u)&&(l=i.replace(/\//g,"\\")),l});d.push("New-Item","-ItemType","Directory","-Force","-Path",c.join(","))}else d.push("New-Item","-ItemType","Directory","-Force");e=r-1;continue}if(t==="rm"&&p&&b()){let s=[],r=!1,c=!1,i=e+1;for(;i<n.length;){let l=n[i];if([">",">>","<","&","&&","|","||",";"].includes(l))break;l==="-rf"||l==="-fr"?(r=!0,c=!0):l==="-r"||l==="-R"||l==="--recursive"?r=!0:l==="-f"||l==="--force"?c=!0:s.push(l),i++}let u=["Remove-Item"];if(r&&u.push("-Recurse"),c&&u.push("-Force"),s.length>0){let l=s.map(m=>{let R=m.replace(/^['"]|['"]$/g,""),$=m;return h(R)&&($=m.replace(/\//g,"\\")),$});u.push("-Path",l.join(","))}d.push(...u),e=i-1;continue}if(t==="cp"&&p&&b()){let s=[],r=!1,c=!1,i=e+1;for(;i<n.length;){let l=n[i];if([">",">>","<","&","&&","|","||",";"].includes(l))break;l==="-r"||l==="-R"||l==="--recursive"?r=!0:l==="-f"||l==="--force"?c=!0:s.push(l),i++}let u=["Copy-Item"];if(r&&u.push("-Recurse"),c&&u.push("-Force"),s.length>0){let l=s.map(m=>{let R=m.replace(/^['"]|['"]$/g,""),$=m;return h(R)&&($=m.replace(/\//g,"\\")),$});if(l.length>1){let m=l.pop();u.push("-Path",l.join(","),"-Destination",m)}else u.push("-Path",l[0])}d.push(...u),e=i-1;continue}if(t==="touch"&&p&&b()){let s=[],r=e+1;for(;r<n.length;){let c=n[r];if([">",">>","<","&","&&","|","||",";"].includes(c))break;s.push(c),r++}if(s.length>0){let i=`(${s.map(u=>{let l=u.replace(/^['"]|['"]$/g,""),m=u;return h(l)&&(m=u.replace(/\//g,"\\")),m}).join(", ")}) | ForEach-Object { if (Test-Path $_) { (Get-Item $_).LastWriteTime = [System.DateTime]::Now } else { $null | Out-File -FilePath $_ } }`;d.push(i)}e=r-1;continue}if(t==="|"&&n[e+1]==="tee"){n[e+2]==="-a"?(d.push(">>"),e+=2):(d.push(">"),e+=1);continue}if(t==="|"&&n[e+1]==="cat"&&n[e+2]===">"){d.push(">"),e+=2;continue}if(t==="|"){let s=n[e+1];if(s){let r=s.replace(/^['"]|['"]$/g,""),c=/\.(txt|md|json|log|csv|html|css|py|js|xml|yaml|yml|pdf|docx|pptx|xlsx)$/i.test(r);if(h(r)&&c){d.push(">");continue}}}d.push(t)}let O=!1,a=d.map(e=>{if(e==="echo")return O=!0,e;[">",">>","<","&","&&","|","||",";"].includes(e)&&(O=!1);let s=/^['"]|['"]$/.test(e),r=e;O&&s&&(r=e.replace(/^['"]|['"]$/g,""));let c=/^['"]|['"]$/.test(r),i=r.replace(/^['"]|['"]$/g,"");h(i)&&(r=r.replace(/\//g,"\\"));let u=r.replace(/^['"]|['"]$/g,"");return u.includes(" ")&&!c&&(r=`"${u}"`),r});if(p){let e="",t=0;for(let s=0;s<a.length;s++){let r=a[s];r==="&&"?(e+="; if ($?) {",t++):r===";"?(e+=" }".repeat(t)+";",t=0):(e&&!e.endsWith(" ")&&!e.endsWith("{")&&(e+=" "),e+=r)}return e+=" }".repeat(t),e}return a.join(" ")},M=async(f,p={})=>{let{command:n}=S(f),{onChunk:o}=p;if(!n)return'ERROR: Missing "command" argument for Run.';let w=process.platform==="win32",g=p.systemSettings||{},h={};return g.networkAccess===!1&&(h.HTTP_PROXY="http://127.0.0.1:9999",h.HTTPS_PROXY="http://127.0.0.1:9999",h.ALL_PROXY="socks5://127.0.0.1:9999",h.http_proxy="http://127.0.0.1:9999",h.https_proxy="http://127.0.0.1:9999",h.all_proxy="socks5://127.0.0.1:9999",h.NO_PROXY="localhost,127.0.0.1"),new Promise(d=>{let O=a=>{let e=a==="pwsh"||a==="powershell",t=T(n,e),s;w?a==="pwsh"?s="pwsh.exe":a==="powershell"?s="powershell.exe":s="cmd.exe":s=process.env.SHELL||"bash";let r=w?e?["-NoProfile","-Command",t]:["/c",t]:["-c",t];if(g.networkAccess===!1&&!w){let c=s,i=[...r];if(process.platform==="linux")s="unshare",r=["-n","-r",c,...i];else if(process.platform==="darwin"){let u=`(version 1)
|
|
4
4
|
(allow default)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as z}from"./chunk-
|
|
1
|
+
import{a as z}from"./chunk-FSE4BZZZ.js";import{p as ut}from"./chunk-PRTGV2R4.js";import{a as mt,b as W}from"./chunk-L3W2X74K.js";import{d as J,h as Z,i as M,j as b}from"./chunk-M2ULCOL3.js";import S from"fs-extra";import U from"path";import bt from"http";import N from"fs-extra";import et from"path";import{spawn as vt}from"child_process";import{fileURLToPath as Ft}from"url";var $=52991,Rt=15e3,ft=et.join(J,"usage","usage_error.txt"),ht=async(e,t)=>{let o=t?.stack||t?.message||String(t);console.error(`[Usage Daemon Error] [${e}]:`,t);try{await N.ensureDir(et.dirname(ft));let s=`[${new Date().toISOString()}] [Daemon:${e}] ${o}
|
|
2
2
|
-------------------------------------
|
|
3
3
|
|
|
4
4
|
`;await N.appendFile(ft,s,"utf8")}catch{}},B={agent:0,background:0,search:0,toolSuccess:0,toolFailure:0,toolDenied:0,duration:0,tokens:0,cachedTokens:0,candidateTokens:0,linesAdded:0,linesRemoved:0,cost:0,imageCalls:[]},tt=(e,t)=>{if(!e)return{};let o=Object.keys(e),i=new Date(new Date(t).getTime()-720*60*60*1e3),s={};for(let n of o)new Date(n)>=i&&(s[n]=e[n]);return s};async function Ut(){let e=new Date().toISOString().split("T")[0],t=null;try{if(await N.exists(M)){let o=(await N.readFile(M,"utf8")).trim();o.startsWith("{")||o.startsWith("[")?t=JSON.parse(o):t=JSON.parse(W(o))}}catch(o){await ht("loadUsageFromDisk",o)}if(t){let o={...B,...t.stats||{}};Array.isArray(o.imageCalls)||(o.imageCalls=[]);let i=t.history||{},s=tt(i,e);if(t.date===e)return{...t,stats:o,history:s};{let n=t.date,c={...s};return n&&(c[n]=o),{date:e,stats:{...B},history:tt(c,e)}}}return{date:e,stats:{...B},history:{}}}async function Ot(e=$){let t=await Ut(),o=!1,i=!1,s=Date.now(),n=null,c=async()=>{if(t)try{await N.ensureDir(et.dirname(M));let l=new Date().toISOString().split("T")[0];t.history=tt(t.history||{},t.date||l),t.saveId=Math.random().toString(36).substring(2)+Date.now().toString(36);let a=mt(JSON.stringify(t,null,2));await N.writeFile(M,a,"utf8"),i=!1}catch(l){await ht("flushToDisk",l)}},r=async()=>{n&&clearInterval(n),await c(),m.close(()=>{process.exit(0)}),setTimeout(()=>process.exit(0),1e3).unref()};n=setInterval(async()=>{if(o)return;Date.now()-s>Rt&&await r()},5e3),n.unref&&n.unref();let m=bt.createServer(async(l,a)=>{let u=l.url||"";if(l.method==="POST"&&u==="/heartbeat"){o||(s=Date.now()),a.writeHead(200,{"Content-Type":"application/json"}),a.end(JSON.stringify({ok:!0}));return}if((l.method==="GET"||l.method==="POST")&&u==="/finalize"){o=!0,n&&clearInterval(n),await c(),a.writeHead(200,{"Content-Type":"application/json"}),a.end(JSON.stringify({success:!0,message:"Finalized and written to disk"})),setTimeout(()=>{m.close(()=>process.exit(0)),setTimeout(()=>process.exit(0),500).unref()},3e3);return}if(l.method==="POST"&&u==="/flush"){o||(s=Date.now(),await c()),a.writeHead(200,{"Content-Type":"application/json"}),a.end(JSON.stringify({success:!0}));return}if(l.method==="POST"&&u==="/write"){if(o){a.writeHead(403,{"Content-Type":"application/json"}),a.end(JSON.stringify({error:"Daemon finalized. Writes locked."}));return}s=Date.now();let d="";l.on("data",p=>{d+=p}),l.on("end",async()=>{try{let p=JSON.parse(d||"{}"),C=new Date().toISOString().split("T")[0];if(t.date!==C){let y=t.date;y&&(t.history||(t.history={}),t.history[y]={...t.stats}),t.date=C,t.stats={...B}}t.stats||(t.stats={...B});let{key:h,amount:f=1,provider:w,model:T}=p;if(h&&t.stats[h]!==void 0&&(h==="cost"?t.stats.cost=Number(((t.stats.cost||0)+Number(f)).toFixed(6)):typeof t.stats[h]=="number"&&(t.stats[h]+=Math.floor(f))),h==="agent"&&w&&(t.stats.providerRequests||(t.stats.providerRequests={}),t.stats.providerRequests[w]=(t.stats.providerRequests[w]||0)+Math.floor(f)),w&&T&&(h==="tokens"||h==="cachedTokens"||h==="candidateTokens"||h==="ttft"||h==="cost")){t.stats.models||(t.stats.models={}),t.stats.models[w]||(t.stats.models[w]={}),t.stats.models[w][T]||(t.stats.models[w][T]={tokens:0,cachedTokens:0,candidateTokens:0,ttftSum:0,ttftCalls:0,cost:0});let y=t.stats.models[w][T];h==="tokens"&&(y.tokens+=Math.floor(f)),h==="cachedTokens"&&(y.cachedTokens+=Math.floor(f)),h==="candidateTokens"&&(y.candidateTokens+=Math.floor(f)),h==="cost"&&(y.cost=Number(((y.cost||0)+Number(f)).toFixed(6))),h==="ttft"&&(y.ttftSum=(y.ttftSum||0)+Math.floor(f),y.ttftCalls=(y.ttftCalls||0)+1)}i=!0,await c(),a.writeHead(200,{"Content-Type":"application/json"}),a.end(JSON.stringify({success:!0}))}catch(p){a.writeHead(400,{"Content-Type":"application/json"}),a.end(JSON.stringify({error:p.message}))}});return}a.writeHead(404,{"Content-Type":"text/plain"}),a.end("Not Found")});m.listen(e,"127.0.0.1",()=>{s=Date.now()}),m.on("error",l=>{l.code==="EADDRINUSE"&&process.exit(0)})}async function At(e=$){try{if((await fetch(`http://127.0.0.1:${e}/heartbeat`,{method:"POST",signal:AbortSignal.timeout(300)})).ok)return!0}catch{}try{let t=Ft(import.meta.url);vt(process.execPath,[t,"--usage-daemon-worker",`--port=${e}`],{detached:!0,stdio:"ignore",windowsHide:!0}).unref();for(let i=0;i<10;i++){await new Promise(s=>setTimeout(s,100));try{if((await fetch(`http://127.0.0.1:${e}/heartbeat`,{method:"POST",signal:AbortSignal.timeout(300)})).ok)return!0}catch{}}}catch{}return!1}async function st(e,t=$){try{await At(t),await fetch(`http://127.0.0.1:${t}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(1e3)})}catch{}}async function It(e=$){try{await fetch(`http://127.0.0.1:${e}/heartbeat`,{method:"POST",signal:AbortSignal.timeout(600)})}catch{}}async function Et(e=$){try{await fetch(`http://127.0.0.1:${e}/finalize`,{method:"GET",signal:AbortSignal.timeout(1e3)})}catch{}}if(process.argv.includes("--usage-daemon-worker")){let e=process.argv.find(o=>o.startsWith("--port=")),t=e?parseInt(e.split("=")[1],10):$;Ot(t)}var pt=U.join(J,"usage","usage_error.txt"),H=new Map,Nt=(e,t)=>{let o=`${e}:${t}`;if(H.has(o))return H.get(o);try{let i=yt();if(S.existsSync(i)){let n=S.readFileSync(i,"utf8").split(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{execSync as o}from"child_process";var t=null,
|
|
2
|
-
- Same file, multiple edits? One PatchFile (\u226415 blocks)${
|
|
1
|
+
import{execSync as o}from"child_process";var t=null,m=()=>{if(process.platform!=="win32")return!1;if(t!==null)return t;try{o("where.exe pwsh.exe",{stdio:"ignore",windowsHide:!0}),t=!0}catch{t=!1}return t},r=null,a=()=>{if(process.platform!=="win32")return!1;if(r!==null)return r;try{o("where.exe powershell.exe",{stdio:"ignore",windowsHide:!0}),r=!0}catch{r=!1}return r},w=()=>m()?"pwsh":a()?"powershell":"cmd",n=null,v=(e,l,c,u,d=!1,p=!0,g,f=!1)=>{n===null&&(n=d);let h=`- JSON escape literal sequences, backslash: \\\\, newLine: \\ n
|
|
2
|
+
- Same file, multiple edits? One PatchFile (\u226415 blocks)${g?"":`
|
|
3
3
|
- Action denied? Ask for guidance`}
|
|
4
4
|
- Need text or huge file? CodeSearch > Full Read
|
|
5
5
|
- Avoid unnecessary large file chunk reads
|
|
@@ -17,7 +17,7 @@ ${n?`
|
|
|
17
17
|
**Emergency**
|
|
18
18
|
Info: initial = current task prompt. Revert id = turn before disaster (eg. disaster: turn_3 \u2192 revert: turn_2). Reason explicitly
|
|
19
19
|
- EmergencyRollback(method="getCheckpoint/forceRevert", id=string). Rollback workspace in this agent loop. ONLY for catastrophic corruption. Before ending, verify no catastrophe. getCheckpoint: id excluded
|
|
20
|
-
`:""}${
|
|
20
|
+
`:""}${p?`
|
|
21
21
|
**Sub Agent**
|
|
22
22
|
Default to using subagents whenever helpful, no user nudge needed
|
|
23
23
|
Invocations:
|
|
@@ -27,21 +27,20 @@ Invocations:
|
|
|
27
27
|
- Await(id=string, timeout?=int[..180]). Event driven wait
|
|
28
28
|
- GetProgress(id=string). Poll sparingly; NO initial poll. Work or await
|
|
29
29
|
- Steer(id=string, message=string). Inject additional instruction into active async subagent
|
|
30
|
-
- Cancel(id=string). Cancel async task ONLY if stalled (2m+) or incorrect`:""}`,
|
|
30
|
+
- Cancel(id=string). Cancel async task ONLY if stalled (2m+) or incorrect`:""}`,k=`**Creative Actions (path = relative; first argument, path separator: '/')**
|
|
31
31
|
- WritePDF(path=string, content=string, orientation="landscape/portrait"). Proactive A4 page breaks must in css. HTML/CSS for premium layout, stable margins & headers/footers, no watermarks
|
|
32
32
|
- WriteDoc(path=string, content=string). A4 Word document, no watermarks, stable margins & headers/footers`,s=`**Computer Use (Desktop Automation)**
|
|
33
|
-
- Click(gridId=int, type="single/double", button="left/middle/right", intendedClickText
|
|
34
|
-
-
|
|
35
|
-
- Scroll(direction="up/down", gridId=int). Scroll viewport vertically
|
|
33
|
+
- Click(gridId=int, type="single/double", button="left/middle/right", intendedClickText?=string, ocrCorrection=bool). Click target grid number, intendedClickText: literal text on screen (OCR scannable, upto 3 words). Double click desktop icons, clicking text? set ocrCorrection=true
|
|
34
|
+
- Scroll(direction="up/down", gridId=int). Scrolls viewport, gridId to hover over window
|
|
36
35
|
- KeyboardTyping(text=string, autoPressEnter?=bool). Type text string into currently active input. JSON escape literal escape sequences
|
|
37
36
|
- KeyPress(key="key or ;-separated combination, eg: enter, back, backspace, clearInput, ctrl;c, alt;tab, f5, f11, alt;f4"). Press key, shortcut, function key (f1-f12), or clear active input field
|
|
38
37
|
- RecaptureScreen(). Request fresh gridded screenshot
|
|
39
38
|
- Wait(seconds?=int[..120]). Wait for process to finish`;return`
|
|
40
39
|
-- ACTIONS --
|
|
41
|
-
In chat output the format
|
|
40
|
+
In chat output the format [action:ActionName(arg1="value1")] in NEW line
|
|
42
41
|
Rules:
|
|
43
42
|
- Max 5 actions/turn
|
|
44
|
-
${e==="Flux"||e.toLowerCase()==="fluxcu"?`${
|
|
43
|
+
${e==="Flux"||e.toLowerCase()==="fluxcu"?`${h}`:""}
|
|
45
44
|
**User Communication**
|
|
46
45
|
- AskUser(question=string, optionA?="title::description", ...MAX4). Any Ambiguity
|
|
47
46
|
|
|
@@ -50,4 +49,4 @@ ${e==="Flux"||e.toLowerCase()==="fluxcu"?`${m}`:""}
|
|
|
50
49
|
- WebScrape(url=string). Proactive use for specific webpage/docs
|
|
51
50
|
|
|
52
51
|
${e==="ICU"?`${s}`:e==="FluxCU"?`${i}
|
|
53
|
-
${s}`:e==="Flux"?`${i}`:`${
|
|
52
|
+
${s}`:e==="Flux"?`${i}`:`${k}`}`.trim()};export{a,w as b,v as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import E from"os";import e from"path";import l from"fs";import d from"crypto";import{minimatch as _}from"minimatch";var p=e.join(E.homedir(),".fluxflow"),h=e.join(p,"settings.json"),x=null;try{if(l.existsSync(h)){let n=l.readFileSync(h,"utf8").trim(),a;if(n.startsWith("{"))a=JSON.parse(n);else{let t=n.split(":");if(t.length===2){let o=Buffer.from(t[0],"hex"),m=t[1],i=d.createHash("sha256").update("fluxflow-cli-sanctuary-key").digest(),c=d.createDecipheriv("aes-256-cbc",i,o),r=c.update(m,"hex","utf8");r+=c.final("utf8"),a=JSON.parse(r)}}if(a){let t=a.systemSettings||{};t.useExternalData&&t.externalDataPath&&(x=e.normalize(t.externalDataPath.trim()))}}}catch{}var u=x||p,S=e.join(u,"logs"),s=e.join(u,"secret"),v=e.join(s,"history.json"),C=e.join(s,"history"),b=e.join(p,"usage.json"),T=e.join(s,"usage.json"),A=e.join(s,"timed_usage"),F=e.join(s,"memories.json"),R=e.join(s,"memory-temp.json"),k=e.join(s,"temp-memory-chat.json"),w=e.join(u,"backups"),O=e.join(s,"ledger.json"),W=e.join(s,"ledgerAdvance.json"),N=e.join(s,"active_tx.json"),G=e.join(s,"path.json"),P=e.join(s,"context.json"),M=e.join(u,"parsers"),B=e.join(p,".cache","CU"),U=e.join(p,"thinking_config.json"),$=[".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",".exe",".dll",".so",".dylib",".png",".jpg",".jpeg",".gif",".ico",".svg",".webp",".mp3",".mp4",".avi",".zip",".tgz",".tar",".gz",".7z",".rar",".pdf",".docx",".xlsx",".pptx",".woff",".woff2",".ttf",".eot",".skills","skills"],z=(n=process.cwd())=>{try{let a=e.join(n,".gitignore");if(l.existsSync(a))return l.readFileSync(a,"utf8").split(`
|
|
2
|
+
`).map(o=>o.trim()).filter(o=>o&&!o.startsWith("#")&&!o.startsWith("!")).map(o=>o.replace(/^[\/\\]+/,"").replace(/[\/\\]+$/,"").replace(/\/\*+$/,"")).filter(Boolean)}catch{}return[]},H=(n,a)=>{if(!n||!a)return!1;let t=n.replace(/\\/g,"/"),o=e.basename(n),m=a.split(",").map(c=>c.trim()).filter(Boolean),i=null;try{let c=typeof _<"u"?_:null;c&&(i=c)}catch{}for(let c of m){let r=c.replace(/\\/g,"/");if(o.toLowerCase()===r.toLowerCase()||t.toLowerCase()===r.toLowerCase()||t.toLowerCase().endsWith("/"+r.toLowerCase()))return!0;try{if(i&&(i(t,r,{dot:!0,nocase:!0,matchBase:!0})||i(o,r,{dot:!0,nocase:!0})))return!0}catch{}if(r.includes("*")||r.includes("?")){let g="^"+r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,".")+"$";try{let f=new RegExp(g,"i");if(f.test(o)||f.test(t))return!0}catch{}}}return!1};export{p as a,h as b,u as c,S as d,s as e,v as f,C as g,b as h,T as i,A as j,F as k,R as l,k as m,w as n,O as o,W as p,N as q,G as r,P as s,M as t,B as u,U as v,$ as w,z as x,H as y};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{screen as V}from"@nut-tree-fork/nut-js";import P from"screenshot-desktop";import Z from"sharp";import K from"fs-extra";import Q from"path";var h={TARGET_WIDTH:1280,TARGET_HEIGHT:720,COLS:40,ROWS:30},st=process.env.USE_UI_MODEL!=="false"&&!0,nt=process.env.RAW_MODEL_ONLY==="true"||!1,L=[];async function z(e,o=!1){try{let{data:C,info:Y}=await Z(e).resize(h.TARGET_WIDTH,h.TARGET_HEIGHT,{fit:"fill"}).greyscale().raw().toBuffer({resolveWithObject:!0}),s=Y.width,c=Y.height,i=h.COLS,p=h.ROWS,n=s/i,r=c/p,g=[],M=1;for(let l=0;l<p;l++)for(let f=0;f<i;f++){let y=Math.floor(f*n),x=Math.floor(l*r),T=Math.floor((f+1)*n),u=Math.floor((l+1)*r),t=Math.floor((u-x)/3),w=0,W=0,I=0,v=0,H=0,d=0;for(let b=x;b<u;b+=2)for(let D=y;D<T;D+=2){let U=C[b*s+D];b<x+t?(I+=U,v++):b>u-t?(H+=U,d++):(w+=U,W++)}let E=(I+w+H)/(v+W+d),O=0,S=0,G=0;for(let b=x;b<u;b+=2)for(let D=y;D<T;D+=2){let B=C[b*s+D]-E;b<x+t?S+=B*B:b>u-t?G+=B*B:O+=B*B}let N=Math.sqrt(O/(W||1)),R=Math.sqrt(S/(v||1)),A=Math.sqrt(G/(d||1)),_=Math.sqrt((S+O+G)/(v+W+d||1)),$=3;R>A+3?$=10:(A>R+3||N>12)&&($=-8),_>18&&g.push({cellNum:M,cx:Math.floor(y+n/2),cy:Math.floor(x+r/2),cellW:n,cellH:r,startX:y,startY:x,yOffset:$,mean:E,stdDev:_}),M++}let m=Array.from({length:p},()=>Array(i).fill(null));for(let l of g){let f=Math.floor((l.cellNum-1)/i),y=(l.cellNum-1)%i;m[f][y]=l}let X=Array.from({length:p},()=>Array(i).fill(!1)),a=[];for(let l=0;l<p;l++)for(let f=0;f<i;f++)if(m[l][f]&&!X[l][f]){let y=l,x=l,T=f,u=f,t=[[l,f]],w=[m[l][f]],W=Array.from({length:p},()=>Array(i).fill(!1));for(W[l][f]=!0;t.length>0;){let[H,d]=t.shift();y=Math.min(y,H),x=Math.max(x,H),T=Math.min(T,d),u=Math.max(u,d);let E=[[H-1,d],[H+1,d],[H,d-1],[H,d+1],[H-1,d-1],[H-1,d+1],[H+1,d-1],[H+1,d+1]];for(let[O,S]of E)O>=0&&O<p&&S>=0&&S<i&&m[O][S]&&!W[O][S]&&(W[O][S]=!0,t.push([O,S]),w.push(m[O][S]))}let I=x-y+1,v=u-T+1;if(I<=4&&v<=4){for(let R of w){let A=Math.floor((R.cellNum-1)/i),_=(R.cellNum-1)%i;X[A][_]=!0}let H=Math.floor(T*n),d=Math.floor(y*r),E=Math.floor((u+1)*n),O=Math.floor((x+1)*r),S=E-H,G=O-d,N=3;if(G>r){let R=w.filter(b=>b.startY<d+G/2),A=w.filter(b=>b.startY>=d+G/2),_=R.reduce((b,D)=>b+D.stdDev,0)/(R.length||1),$=A.reduce((b,D)=>b+D.stdDev,0)/(A.length||1);$>_+2?N=-Math.floor(G/4):_>$+2?N=Math.floor(G/4):N=-12}else N=(w.find(A=>A.yOffset!==3)||w[0]).yOffset;a.push({cellNum:w[0].cellNum,cx:Math.floor(H+S/2),cy:Math.floor(d+G/2),cellW:S,cellH:G,startX:H,startY:d,yOffset:N})}else{X[l][f]=!0;let H=m[l][f],d=l+1<p?m[l+1][f]:null;if(d&&!X[l+1][f]){X[l+1][f]=!0;let E=Math.floor(f*n),O=Math.floor(l*r),S=Math.floor((f+1)*n),G=Math.floor((l+2)*r),N=S-E,R=G-O,A=Math.floor(r*.25),_=Math.floor(O+r-A),$=Math.floor(O+r+A),b=0,D=0;for(let k=_;k<$;k+=2)for(let q=E;q<S;q+=2)b+=C[k*s+q],D++;let U=b/(D||1),B=0;for(let k=_;k<$;k+=2)for(let q=E;q<S;q+=2){let J=C[k*s+q]-U;B+=J*J}let ot=Math.sqrt(B/(D||1)),F;if(ot<14)F=Math.floor(O+r)+4;else{let k=H.stdDev||0,q=d.stdDev||0;k<q?F=Math.floor(O+r/2)+(H.yOffset!==3?H.yOffset:-4):F=Math.floor(O+r+r/2)+(d.yOffset!==3?d.yOffset:4)}F=Math.max(O+11,Math.min(O+R-2,F)),a.push({cellNum:H.cellNum,cx:Math.floor(E+N/2),cy:F,cellW:N,cellH:R,startX:E,startY:O,yOffset:0,isCustomY:!0})}else a.push(H)}}if(o){let l=[],f=a.filter(T=>T.isCustomY||T.cellH>r*1.5),y=a.filter(T=>!(T.isCustomY||T.cellH>r*1.5)),x=new Map;for(let T of f){let u=T.startY;x.has(u)||x.set(u,[]),x.get(u).push(T)}for(let[T,u]of x.entries()){u.sort((w,W)=>w.startX-W.startX);let t=[];for(let w=0;w<u.length;w++){let W=u[w];if(t.length===0)t.push(W);else{let I=t[t.length-1];if(Math.abs(I.startX+I.cellW-W.startX)<=3)t.push(W);else{if(t.length>=3){let v=t[0].startX,d=t[t.length-1].startX+t[t.length-1].cellW-v,E=t[0].cellH;l.push({cellNum:t[0].cellNum,cx:Math.floor(v+d/2),cy:t[0].cy,cellW:d,cellH:E,startX:v,startY:T,yOffset:0,isCustomY:!0})}else l.push(...t);t=[W]}}}if(t.length>=3){let w=t[0].startX,I=t[t.length-1].startX+t[t.length-1].cellW-w,v=t[0].cellH;l.push({cellNum:t[0].cellNum,cx:Math.floor(w+I/2),cy:t[0].cy,cellW:I,cellH:v,startX:w,startY:T,yOffset:0,isCustomY:!0})}else l.push(...t)}a.length=0,a.push(...l,...y)}return a.forEach((l,f)=>{l.badgeId=f+1}),L=a,a}catch(C){return console.error("UI Element Detection error:",C),[]}}function rt(e,o,C,Y,s=[]){let c=e/C,i=o/Y,p="";for(let n of s){let{badgeId:r,cellNum:g,startX:M,startY:m,cellW:X,cellH:a,cx:l,cy:f}=n,y=r!==void 0?r:g;p+=`
|
|
2
|
+
<rect x="${M+1}" y="${m+1}" width="${X-2}" height="${a-2}" fill="rgba(0, 255, 255, 0.015)" stroke="rgba(255, 255, 0, 0.3)" stroke-width="1.1" rx="2"/>
|
|
3
|
+
`;let x=s.some(t=>t!==n&&t.startY+t.cellH>=m-6&&t.startY<m&&Math.max(0,Math.min(M+X,t.startX+t.cellW)-Math.max(M,t.startX))>10),T=s.some(t=>t!==n&&t.startY<=m+a+6&&t.startY>m&&Math.max(0,Math.min(M+X,t.startX+t.cellW)-Math.max(M,t.startX))>10),u;if(n.isCustomY)u=f,!x&&u<m+11&&(u=Math.max(10,Math.min(u,m+4)));else{let t=n.yOffset!==void 0?n.yOffset:3;!x&&t<0&&(t=Math.min(t,-12));let w=f+t,W=!x&&(t<0||w<m+11)?Math.max(10,m+4):m+11,I=!T&&(t>0||w>m+a-2)?Math.min(o-2,m+a+6):m+a+3;u=Math.max(W,Math.min(I,w))}p+=`
|
|
4
|
+
<text x="${l}" y="${u}" font-family="'Segoe UI', Roboto, sans-serif" font-size="14" font-weight="600" fill="#FFFF00" stroke="#000000" stroke-width="2" paint-order="stroke fill" stroke-linejoin="round" opacity="0.8" text-anchor="middle">${y}</text>
|
|
5
|
+
`}return`<svg width="${e}" height="${o}" xmlns="http://www.w3.org/2000/svg">${p}</svg>`}var tt=1,j=e=>new Promise(o=>setTimeout(o,e));async function et(){try{let{loadSettings:e}=await import("./settings-5R5ADGXX.js"),o=await e();return Number(o.display||0)}catch{return 0}}async function lt(){let e=await et();try{let o=await P.listDisplays();if(o&&o.length>0)return{format:"png",screen:(o[e]||o[0]).id}}catch{}return{format:"png"}}async function ct(){let e=0,o=await lt();for(;e<2;){let C=await P(o);await j(500);let Y=await P(o);if(C.equals(Y))return Y;e++,e<2&&await j(3e3)}return await j(3e3),await P(o)}function at(e=[],o=[]){if(!e||e.length===0)return o||[];if(!o||o.length===0)return e;let C=[...e],Y=typeof e.getModelConfidence=="function"?e.getModelConfidence.bind(e):null;for(let s of o){if(Y&&Y(s.startX,s.startY,s.cellW,s.cellH)<.01)continue;let c=s.startX,i=s.startX+s.cellW,p=s.startY,n=s.startY+s.cellH;for(let y of e){let x=y.startX,T=y.startY,u=y.startX+y.cellW,t=y.startY+y.cellH;if(Math.max(0,Math.min(n,t)-Math.max(p,T))>s.cellH*.4&&x<i&&u>c){let W=(x+u)/2,I=(c+i)/2;W<=I?c=Math.max(c,u):i=Math.min(i,x)}}let r=i-c;if(r<18)continue;let g=c,M=p,m=i,X=n,a=Math.floor(c+r/2),l=s.cy,f=!1;for(let y of e){let x=y.startX,T=y.startY,u=y.startX+y.cellW,t=y.startY+y.cellH;if(a>=x&&a<=u&&l>=T&&l<=t){f=!0;break}let w=Math.max(g,x),W=Math.max(M,T),I=Math.min(m,u),v=Math.min(X,t),H=Math.max(0,I-w)*Math.max(0,v-W),d=(m-g)*(X-M);if(H/(d||1)>=.25){f=!0;break}}f||C.push({...s,startX:g,cellW:r,cx:a})}return C.sort((s,c)=>Math.abs(s.startY-c.startY)>18?s.startY-c.startY:s.startX-c.startX),C.forEach((s,c)=>{s.badgeId=c+1}),C}async function yt(){try{let e=await ct(),o=null;if(st){let n=(async()=>{try{let{detectUIBoxesONNX:r}=await import("./ui_detector_onnx-XRKXFWLG.js");return await r(e,h.TARGET_WIDTH,h.TARGET_HEIGHT)}catch{return null}})();if(nt)o=await n||[];else{let r=z(e,!0),[g,M]=await Promise.all([n,r]);o=g&&g.length>0?at(g,M):await z(e,!1)}}else o=await z(e,!1);L=o;let C=rt(h.TARGET_WIDTH,h.TARGET_HEIGHT,h.COLS,h.ROWS,o),Y=await Z(e).resize(h.TARGET_WIDTH,h.TARGET_HEIGHT,{fit:"fill"}).composite([{input:Buffer.from(C),top:0,left:0}]).png({quality:100}).toBuffer();if(process.env.SHOW_DEBUG_GRID)try{let n=Q.resolve(process.cwd(),"screenshots");await K.ensureDir(n);let r=Q.join(n,`${tt}.png`);await K.writeFile(r,Y),tt++}catch{}let s=Y.toString("base64"),c=o.length,i=e,p=Y;return i=null,p=null,{base64:s,mimeType:"image/png",width:h.TARGET_WIDTH,height:h.TARGET_HEIGHT,detectedCount:c}}catch(e){return console.error("Failed to capture gridded screenshot:",e),null}}function it(e){if(e==null)return null;let o=null;if(typeof e=="number")o=e;else if(typeof e=="string"){let g=e.trim();if(/^\d+$/.test(g))o=parseInt(g,10);else{let M=g.match(/^([A-Z])([0-9]{1,2})$/i);if(M){let m=M[1].toUpperCase().charCodeAt(0)-65,X=parseInt(M[2],10)-1;o=m*h.COLS+X+1}}}if(o===null||isNaN(o))return null;if(L&&L.length>0){let g=L.find(M=>M.badgeId===o)||L.find(M=>M.cellNum===o);if(g){let M=Math.floor((g.cellNum-1)%h.COLS),m=Math.floor((g.cellNum-1)/h.COLS);return{x:g.cx,y:g.cy,colIdx:M>=0?M:0,rowIdx:m>=0?m:0,cellNum:o}}}let C=h.COLS*h.ROWS;if(o<1||o>C)return null;let Y=o-1,s=Math.floor(Y/h.COLS),c=Y%h.COLS,i=h.TARGET_WIDTH/h.COLS,p=h.TARGET_HEIGHT/h.ROWS,n=Math.floor(c*i+i/2),r=Math.floor(s*p+p/2);return{x:n,y:r,colIdx:c,rowIdx:s,cellNum:o}}async function Mt(e,o,C){let Y=null;if(typeof e=="number"||typeof e=="string"?Y=it(e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(Y=e),!Y)return null;let s=o,c=C,i=0,p=0,n=await et();try{let X=await P.listDisplays();if(X&&X.length>0){let a=X[n]||X[0];a.width&&a.height&&(s=a.width,c=a.height),a.left!==void 0&&(i=a.left),a.top!==void 0&&(p=a.top)}}catch{}if(!s||!c)try{let X=await P({}),a=await Z(X).metadata();a&&a.width&&a.height?(s=a.width,c=a.height):(s=await V.width(),c=await V.height())}catch{(!s||!c)&&(s=await V.width(),c=await V.height())}let r=s/h.TARGET_WIDTH,g=c/h.TARGET_HEIGHT,M=Math.round(Y.x*r)+i,m=Math.round(Y.y*g)+p;return{x:M,y:m,screenW:s,screenH:c,offsetX:i,offsetY:p}}function pt(e){if(!e||typeof e.x!="number"||typeof e.y!="number")return null;if(L&&L.length>0){let c=L.find(n=>e.x>=n.startX&&e.x<=n.startX+n.cellW&&e.y>=n.startY&&e.y<=n.startY+n.cellH);if(c)return c.badgeId!==void 0?c.badgeId:c.cellNum;let i=null,p=1/0;for(let n of L){let r=e.x-n.cx,g=e.y-n.cy,M=r*r+g*g;M<p&&(p=M,i=n)}if(i&&p<=2025)return i.badgeId!==void 0?i.badgeId:i.cellNum}let o=h.TARGET_WIDTH/h.COLS,C=h.TARGET_HEIGHT/h.ROWS,Y=Math.max(0,Math.min(h.COLS-1,Math.floor(e.x/o)));return Math.max(0,Math.min(h.ROWS-1,Math.floor(e.y/C)))*h.COLS+Y+1}export{h as a,st as b,nt as c,et as d,yt as e,it as f,Mt as g,pt as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-M2ULCOL3.js";import f from"fs";import g from"path";import{fileURLToPath as M}from"url";var p={version:0,release:20261004,fallbacks:{janitor_default:"gemini-3.5-flash-lite",janitor_attempts_fallback:"gemma-4-26b-a4b-it",janitor_open_router:"google/gemma-4-26b-a4b-it:free",general_fallback:"gemini-3.5-flash-lite",deepseek_fast_fallback:"deepseek-v4-flash",deepseek_level_1:"deepseek-flash",deepseek_level_2:"deepseek-pro",mistral_janitor_fallback:"",mistral_level_1:"",nvidia_janitor_fallback:"mistralai/mistral-nemotron",nvidia_chat_summarizer_fallback:"nvidia/nemotron-3-super-120b-a12b",google_level_1:"gemini-3-flash-preview",google_level_2:"gemini-3.7-flash",gemma_emergency:"gemma-4-31b-it",gemma_janitor_fallback_google_openrouter:"google/gemma-4-26b-a4b-it:free",gemma_janitor_fallback_google:"gemma-4-26b-a4b-it",inferx_fallback:"",sensenova_fallback:"",crofai_fallback:"",aihubmix_fallback:"",poolside_fallback:"","9router_fallback":"",explabs_fallback:"",tokenharbor_fallback:"",infron_fallback:"",c_openai_fallback:""},providers:{}};var j=M(import.meta.url),y=g.dirname(j),_="",I=[g.join(y,"../../model_config.json"),g.join(y,"../model_config.json")];for(let e of I)try{if(f.existsSync(e)){_=e;break}}catch{}var b=g.join(u,"model_config.json"),a=null,v=()=>{if(_)try{let e=f.readFileSync(_,"utf-8"),r=JSON.parse(e);if(r&&typeof r=="object")return r}catch{}return p&&typeof p=="object"?JSON.parse(JSON.stringify(p)):{version:0,release:20260913,fallbacks:{},providers:{}}};if(f.existsSync(b))try{let e=f.readFileSync(b,"utf-8"),r=JSON.parse(e);if(r&&typeof r=="object"){let o=v();r.fallbacks={...o.fallbacks||{},...r.fallbacks||{}},r.providers||(r.providers={}),r.release||(r.release=o.release||20260913),a=r}}catch{}a||(a=v());var F=new Set,k=new Set,c=()=>{let e=new Set,r=new Set;if(a.providers)for(let o of Object.keys(a.providers)){let s=a.providers[o];if(s&&s.models){let l=["Free","Paid"];for(let n of l){let t=s.models[n];if(Array.isArray(t)){for(let i of t)if(i&&i.cmd){let d=i.cmd.trim().toLowerCase();i.multimodal===!0&&e.add(d),i.hasReasoning===!0&&r.add(d)}}}}}if(Array.isArray(a.multimodal_models))for(let o of a.multimodal_models)o&&typeof o=="string"&&e.add(o.trim().toLowerCase());F=e,k=r};c();var L=()=>a,m=()=>{try{return f.existsSync(u)||f.mkdirSync(u,{recursive:!0}),f.writeFileSync(b,JSON.stringify(a,null,2),"utf-8"),!0}catch{return!1}},N=(e,r,o=!1,s=null)=>{if(!e||!r)return{success:!1,reason:"Invalid provider or model ID"};let l=r.trim();if(!l)return{success:!1,reason:"Model ID cannot be empty"};a.providers||(a.providers={}),a.providers[e]||(a.providers[e]={default_free:"",default_paid:"",models:{Free:[],Paid:[]}});let n=a.providers[e];n.models||(n.models={Free:[],Paid:[]}),Array.isArray(n.models.Free)||(n.models.Free=[]);let t=n.models.Free.find(i=>(typeof i=="string"?i:i?.cmd)===l);if(t)if(typeof t=="string"){let i=n.models.Free.indexOf(t),d={cmd:l,multimodal:!!o,desc:l};s&&Object.keys(s).length>0&&(d.info=s),n.models.Free[i]=d}else t.multimodal=!!o,s&&Object.keys(s).length>0&&(t.info={...t.info||{},...s});else{let i={cmd:l,multimodal:!!o,desc:l};s&&Object.keys(s).length>0&&(i.info=s),n.models.Free.push(i)}return c(),m(),{success:!0}},$=(e,r,o={})=>{if(!e||!r)return{success:!1,reason:"Invalid provider or model ID"};let s=r.trim();if(!s)return{success:!1,reason:"Model ID cannot be empty"};a.providers||(a.providers={}),a.providers[e]||(a.providers[e]={default_free:"",default_paid:"",models:{Free:[],Paid:[]}});let l=a.providers[e];l.models||(l.models={Free:[],Paid:[]}),Array.isArray(l.models.Free)||(l.models.Free=[]);let n=s.toLowerCase(),t=l.models.Free.find(i=>{let d=typeof i=="string"?i:i?.cmd;return d&&d.trim().toLowerCase()===n});if(o===null)t&&typeof t=="object"&&delete t.info;else if(!t)l.models.Free.push({cmd:s,multimodal:!1,desc:s,info:o});else if(typeof t=="string"){let i=l.models.Free.indexOf(t);l.models.Free[i]={cmd:t,multimodal:!1,desc:t,info:o}}else t.info={...t.info||{},...o};return m(),{success:!0}},R=(e,r,o=!0)=>{if(!e||!r)return{success:!1,reason:"Invalid provider or model ID"};let s=r.trim();if(!s)return{success:!1,reason:"Model ID cannot be empty"};let l=a.providers?.[e];if(!l||!l.models||!Array.isArray(l.models.Free))return{success:!1,reason:`Provider ${e} has no models configured`};let n=l.models.Free.find(t=>(typeof t=="string"?t:t?.cmd)===s);if(!n)return{success:!1,reason:`Model "${s}" not found in ${e} model list`};if(typeof n=="string"){let t=l.models.Free.indexOf(n);l.models.Free[t]={cmd:s,multimodal:!!o,desc:s}}else n.multimodal=!!o;return c(),m(),{success:!0}},T=(e,r,o=!1,s=null)=>{if(!e||!r)return{success:!1,reason:"Invalid provider or model ID"};let l=r.trim();if(!l)return{success:!1,reason:"Model ID cannot be empty"};a.providers||(a.providers={}),a.providers[e]||(a.providers[e]={default_free:"",default_paid:"",models:{Free:[],Paid:[]}});let n=a.providers[e];n.models||(n.models={Free:[],Paid:[]}),Array.isArray(n.models.Free)||(n.models.Free=[]);let t=n.models.Free.find(i=>(typeof i=="string"?i:i?.cmd)===l);if(t)if(typeof t=="string"){let i=n.models.Free.indexOf(t),d={cmd:l,multimodal:!!o,desc:l};s&&Object.keys(s).length>0&&(d.info=s),n.models.Free[i]=d}else o&&(t.multimodal=!0),s&&Object.keys(s).length>0&&(t.info={...t.info||{},...s});else{let i={cmd:l,multimodal:!!o,desc:l};s&&Object.keys(s).length>0&&(i.info=s),n.models.Free.push(i)}return n.default_free=l,c(),m(),{success:!0}},J=(e,r)=>{if(!e||!r)return{success:!1,reason:"Invalid provider or model ID"};let o=r.trim();if(!o)return{success:!1,reason:"Model ID cannot be empty"};let s=a.providers?.[e];if(!s||!s.models||!Array.isArray(s.models.Free))return{success:!1,reason:`Provider ${e} has no models configured`};let l=s.models.Free.findIndex(n=>(typeof n=="string"?n:n?.cmd)===o);return l===-1?{success:!1,reason:`Model "${o}" not found in ${e} model list`}:(s.models.Free.splice(l,1),s.default_free===o&&(s.default_free=""),s.default_paid===o&&(s.default_paid=""),c(),m(),{success:!0})},U=(e,r,o)=>{if(!e||!r||!o)return{success:!1,reason:"Invalid provider or model IDs"};let s=r.trim(),l=o.trim();if(!s||!l)return{success:!1,reason:"Model IDs cannot be empty"};let n=a.providers?.[e];if(!n||!n.models||!Array.isArray(n.models.Free))return{success:!1,reason:`Provider ${e} has no models configured`};let t=n.models.Free.find(i=>(typeof i=="string"?i:i?.cmd)===s);if(!t)return{success:!1,reason:`Model "${s}" not found in ${e} model list`};if(typeof t=="string"){let i=n.models.Free.indexOf(t);n.models.Free[i]={cmd:l,multimodal:!1,desc:l}}else t.cmd=l,(t.desc===s||!t.desc)&&(t.desc=l);return c(),m(),{success:!0}},x=!1,C=e=>{x=!!e},W=C,E=e=>{if(!e)return!1;let r=e.trim().toLowerCase();return!!(x||F.has(r)||r.startsWith("gemini-")||r.startsWith("gemma-"))},z=e=>{if(!e)return!1;let r=e.trim().toLowerCase();return k.has(r)},G=(e,r)=>{let o=a.providers[e];return o?o.models[r==="Free"?"Free":"Paid"]||[]:[]},K=(e,r)=>{let o=a.providers[e];return o?r==="Free"?o.default_free:o.default_paid:""},V=(e,r)=>{if(!e||!r||!a.providers)return null;let o=a.providers[e];if(!o||!o.models)return null;let s=r.trim().toLowerCase(),l=["Free","Paid"];for(let n of l){let t=o.models[n];if(Array.isArray(t)){for(let i of t)if(typeof i=="object"&&i?.cmd&&i.cmd.trim().toLowerCase()===s&&i.info)return{IN:Number(i.info.IN)||0,OUT:Number(i.info.OUT)||0,CR:Number(i.info.CR)||0,CW:Number(i.info.CW)||0}}}return null},X=e=>a?.fallbacks?.[e];export{p as a,L as b,m as c,N as d,$ as e,R as f,T as g,J as h,U as i,C as j,W as k,E as l,z as m,G as n,K as o,V as p,X as q};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as F,d as y}from"./chunk-L3W2X74K.js";import{c as g,p as h}from"./chunk-
|
|
1
|
+
import{c as F,d as y}from"./chunk-L3W2X74K.js";import{c as g,p as h}from"./chunk-M2ULCOL3.js";import o from"fs-extra";import a from"path";var P=["node_modules","dist","bin","logs",".git",".fluxflow","secret",".gemini",".agents","tmp","temp","build","out","snapshots"];async function k(t,s=t){let e={},i=await o.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let c of i){if(P.includes(c.name))continue;let l=a.join(t,c.name),d=a.relative(s,l).replace(/\\/g,"/");if(c.isDirectory()){let n=await k(l,s);Object.assign(e,n)}else{let n=await o.stat(l).catch(()=>null);n&&(e[d]={size:n.size,mtime:n.mtimeMs})}}return e}async function E(t,s){await o.ensureDir(t);for(let e of Object.keys(s)){let i=a.join(process.cwd(),e),c=a.join(t,e);await o.ensureDir(a.dirname(c)),await o.copyFile(i,c).catch(()=>{})}}async function j(t,s,e=null,i=null){if(!await o.pathExists(t))return;i||(i=t);let c=await o.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let l of c){let d=a.join(t,l.name),n=a.join(s,l.name);if(l.isDirectory())await j(d,n,e,i);else{let u=a.relative(i,d).replace(/\\/g,"/"),p=await o.pathExists(n);p&&await o.chmod(n,438).catch(()=>{}),await o.ensureDir(a.dirname(n));let f=await o.copyFile(d,n).then(()=>!0).catch(()=>!1);await o.chmod(n,438).catch(()=>{}),e&&(f?p?e.replaced++:e.restored++:e.failed.push(u))}}}var C={async takeInitialSnapshot(t){try{let s=a.join(g,"snapshots",t);await o.remove(s).catch(()=>{}),await o.ensureDir(s);let e=await k(process.cwd());await E(a.join(s,"initial"),e);let i=F(h,{});i[t]={initialManifest:e,currentManifest:e,checkpoints:[{id:"initial",timestamp:new Date().toISOString(),newFiles:[],modifiedFiles:[],deletedFiles:[],toolsUsed:[]}]},y(h,i)}catch{}},async recordTurnDelta(t,s,e=[]){try{let i=F(h,{}),c=i[t];if(!c)return;let l=c.currentManifest||c.initialManifest,d=await k(process.cwd()),n=[],u=[],p=[];for(let[r,m]of Object.entries(d)){let w=l[r];w?(w.size!==m.size||w.mtime!==m.mtime)&&u.push(r):n.push(r)}for(let r of Object.keys(l))d[r]||p.push(r);let f=[...n,...u];if(f.length>0||p.length>0){let r={};for(let w of f)r[w]=d[w];let m=a.join(g,"snapshots",t,`turn_${s}`);await E(m,r)}c.checkpoints.push({id:`turn_${s}`,timestamp:new Date().toISOString(),newFiles:n,modifiedFiles:u,deletedFiles:p,toolsUsed:e}),c.currentManifest=d,y(h,i)}catch{}},async getCheckpoints(t){try{let e=F(h,{})[t];return e?e.checkpoints||[]:[]}catch{return[]}},async rollbackToCheckpoint(t,s){try{let e=F(h,{}),i=e[t];if(!i)throw new Error("No session active for Advance Rollback.");let c=i.checkpoints||[],l=c.findIndex(f=>f.id===s);if(l===-1)throw new Error(`Checkpoint [${s}] not found.`);let d=a.join(g,"snapshots",t),n={restored:0,replaced:0,failed:[]},u=await k(process.cwd());for(let f of Object.keys(u)){let r=a.join(process.cwd(),f);await o.chmod(r,438).catch(()=>{}),await o.remove(r).catch(()=>{})}let p=a.join(d,"initial");await j(p,process.cwd(),n,p);for(let f=1;f<=l;f++){let r=c[f],m=a.join(d,r.id);if(await j(m,process.cwd(),n,m),r.deletedFiles&&r.deletedFiles.length>0)for(let w of r.deletedFiles){let D=a.join(process.cwd(),w);await o.chmod(D,438).catch(()=>{}),await o.remove(D).catch(()=>{})}}return i.checkpoints=c.slice(0,l+1),i.currentManifest=await k(process.cwd()),y(h,e),{checkpointId:s,stats:n}}catch(e){throw new Error(`Rollback failed: ${e.message}`)}},async getLatestFileChanges(t){try{let e=F(h,{})[t];if(!e||!e.checkpoints||e.checkpoints.length===0)return{newFiles:[],modifiedFiles:[],deletedFiles:[]};let i=e.checkpoints[e.checkpoints.length-1];return{newFiles:i.newFiles||[],modifiedFiles:i.modifiedFiles||[],deletedFiles:i.deletedFiles||[]}}catch{return{newFiles:[],modifiedFiles:[],deletedFiles:[]}}},async cleanup(t){try{let s=a.join(g,"snapshots",t);await o.remove(s).catch(()=>{});let e=F(h,{});e[t]&&(delete e[t],y(h,e))}catch{}}};export{C as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as T}from"./chunk-Y5JU726N.js";import{a as I}from"./chunk-
|
|
1
|
+
import{a as T}from"./chunk-Y5JU726N.js";import{a as I}from"./chunk-M2ULCOL3.js";import s from"fs";import g from"path";var X=i=>{if(!i)return null;let o=i.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!o)return null;let e=o[1];if((o[2]||"").trim().length===0)return null;let r="",a=e.match(/^name:\s*(.+)$/m);return a&&(r=a[1].trim().replace(/^["']|["']$/g,"")),r?{name:r}:null},Y=i=>{let o=[];if(!i||!s.existsSync(i))return o;let e=(u,r=0)=>{if(!(r>5))try{let a=s.readdirSync(u,{withFileTypes:!0});for(let n of a){let c=g.join(u,n.name),f=n.name.toLowerCase();n.isFile()?f==="skill.md"&&o.push(c):n.isDirectory()&&(r===0?(f==="skills"||f===".skills"||f==="skill"||f===".skill")&&e(c,r+1):e(c,r+1))}}catch{}};return e(i,0),o},q=i=>i.replace(/^\s*---\r?\n[\s\S]*?\r?\n---\s*(\r?\n)?/,""),U=(i,o)=>{if(!o)return null;let e=g.join(i,o);if(s.existsSync(e))try{if(s.statSync(e).isFile())return e}catch{}if(!o.toLowerCase().endsWith(".md")){let n=g.join(i,`${o}.md`);if(s.existsSync(n))try{if(s.statSync(n).isFile())return n}catch{}}let u=o.replace(/\\/g,"/").split("/").filter(Boolean),r=i,a=!0;for(let n=0;n<u.length;n++){let c=u[n].toLowerCase(),f=n===u.length-1;try{if(!s.existsSync(r)||!s.statSync(r).isDirectory()){a=!1;break}let F=s.readdirSync(r).find(M=>{let R=M.toLowerCase();return!!(R===c||f&&!c.endsWith(".md")&&R===`${c}.md`)});if(!F){a=!1;break}let $=g.join(r,F);if(f){if(s.statSync($).isFile())return $;a=!1}else r=$}catch{a=!1;break}}if(u.length===1){let n=u[0],c=["references","reference","scripts","script","examples","example","resources","resource"];for(let f of c){let y=g.join(i,f);if(s.existsSync(y)){let F=U(y,n);if(F)return F}}}return null},Q=async(i,o={})=>{let{path:e,StartLine:u,EndLine:r,start_line:a,end_line:n,startLine:c,endLine:f}=T(i),y=parseInt(u||a||c),F=parseInt(r||n||f),$=!isNaN(y),M=!isNaN(F),R=y||1,N=F||(y?y+800:800);if(!e)return'ERROR: Missing "path" argument for ReadFile.';if(e.trim().toLowerCase().startsWith("#skill")){let d=e.trim().replace(/\\/g,"/").replace(/^#skills?\/?/i,"").split("/").filter(Boolean),C=null,p="",m="";if(d[0]?.toLowerCase()==="global"||d[0]?.toLowerCase()==="project"?(C=d[0].toLowerCase(),p=d[1],m=d.slice(2).join("/")):(p=d[0],m=d.slice(1).join("/")),!p)return`ERROR: Missing skill name in path [${e}].`;let k=t=>{let l=Y(t);for(let h of l)try{let x=s.readFileSync(h,"utf8"),L=X(x),D=g.basename(g.dirname(h)).toLowerCase();if(L?.name&&L.name.toLowerCase()===p.toLowerCase()||D===p.toLowerCase()||h.toLowerCase()===g.join(t,"skill.md").toLowerCase()&&p.toLowerCase()==="skill")return h}catch{}return null},w=null,b=!1;if(C){let t=C==="global"?I:process.cwd();w=k(t)}else{let t=k(process.cwd()),l=k(I);t&&l&&(b=!0),w=t||l}if(!w)return`No '${p}' exist in given scope.`;let E=g.dirname(w),j=w,v=!0;if(m){let t=U(E,m);if(!t)return`No such file or reference '${m}' exist for skill '${p}'. It could be standard file path?`;j=t,v=!1}try{let t=s.readFileSync(j,"utf8");t.startsWith("\uFEFF")&&(t=t.slice(1)),t=t.replace(/\r\n/g,`
|
|
2
2
|
`).replace(/\r/g,`
|
|
3
3
|
`),v&&(t=q(t));let l=t.split(`
|
|
4
4
|
`),h=l.length,x=$?Math.max(0,R-1):0,L=M?Math.min(h,N):h,D=l.slice(x,L),P=e.replace(/\\/g,"/").toLowerCase(),W=P.includes("#skill/global/fluxflow")||P.includes("#skills/global/fluxflow"),_=b?` (Found ${e} in both global & project scope. Loaded [project] as default fallback. Use '#skills/global/...' if needed global)`:"",B=`${W?"DOCs":"Skill"}: [${e.replace(/\\/g,"/")}]${_}`,z=D.map(A=>A.trimEnd()).join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as W}from"./chunk-CBFC5KUU.js";import{f as B,h as S}from"./chunk-MJL6DHQM.js";import{a as P}from"./chunk-Y5JU726N.js";import X from"screenshot-desktop";import O from"sharp";import j from"fs-extra";import G from"path";import"@nut-tree-fork/nut-js";async function U(t,o,e){if(!(!process.env.SHOW_DEBUG_GRID&&!process.env.DEBUG_OCR))try{let s=G.resolve(process.cwd(),"screenshots",t);await j.ensureDir(s),await j.writeFile(G.join(s,o),e)}catch{}}function K(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Q(t,o,e=1/0){if(t===o)return 0;if(t.length===0)return o.length;if(o.length===0)return t.length;if(Math.abs(t.length-o.length)>e)return e+1;let s=Array.from({length:o.length+1},(r,i)=>i);for(let r=1;r<=t.length;r++){let i=[r],a=r;for(let n=1;n<=o.length;n++){let c=t[r-1]===o[n-1]?0:1,l=Math.min(i[n-1]+1,s[n]+1,s[n-1]+c);i.push(l),l<a&&(a=l)}if(s=i,a>e)return e+1}return s[o.length]}function V(t){return t<=4?0:t<=8?1:2}async function H(t,o=3){let e=await O(t).metadata();return O(t).resize(Math.round(e.width*o),Math.round(e.height*o),{kernel:"lanczos3"}).greyscale().normalise().toBuffer()}function Y(t){if(!t)return{words:[],lines:[]};let o=[],e=new Map;for(let r of t.split(`
|
|
2
|
+
`)){let i=r.split(" ");if(i.length<12||parseInt(i[0])!==5)continue;let n=i[2],c=i[3],l=i[4],w=parseInt(i[6]),x=parseInt(i[7]),R=parseInt(i[8]),M=parseInt(i[9]),f=parseFloat(i[10]),h=i.slice(11).join(" ").trim();if(!h||f<0)continue;let p={x0:w,y0:x,x1:w+R,y1:x+M},g={text:h,confidence:f,bbox:p};o.push(g);let u=`${n}_${c}_${l}`;e.has(u)||e.set(u,{words:[],bbox:{x0:1/0,y0:1/0,x1:-1/0,y1:-1/0}});let d=e.get(u);d.words.push(g),d.bbox.x0=Math.min(d.bbox.x0,p.x0),d.bbox.y0=Math.min(d.bbox.y0,p.y0),d.bbox.x1=Math.max(d.bbox.x1,p.x1),d.bbox.y1=Math.max(d.bbox.y1,p.y1)}let s=[];for(let r of e.values())r.words.length>0&&s.push({text:r.words.map(i=>i.text).join(" "),bbox:r.bbox,words:r.words});return{words:o,lines:s}}function Z(t){if(!(t.words&&t.words.length>0)){if(t.blocks&&t.blocks.length>0){t.words=[],t.lines=[];for(let o of t.blocks)for(let e of o.paragraphs||[])for(let s of e.lines||[]){s.bbox&&t.lines.push(s);for(let r of s.words||[])r.bbox&&t.words.push(r)}if(t.words.length>0)return}if(t.tsv){let o=Y(t.tsv);t.words=o.words,t.lines=o.lines}}}function L(t,o,e=0,s=0,r=1){Z(t);let i=n=>({x0:Math.round(n.x0/r)+e,y0:Math.round(n.y0/r)+s,x1:Math.round(n.x1/r)+e,y1:Math.round(n.y1/r)+s}),a=[];if(t.lines&&t.lines.length>0)for(let n of t.lines){let c=n.text?n.text.toLowerCase().trim():"";if(!c||!n.bbox||!(c===o||new RegExp(`\\b${K(o)}\\b`,"i").test(c)))continue;let w=n.words||(t.words?t.words.filter(f=>f.bbox&&f.bbox.x0>=n.bbox.x0-5&&f.bbox.x1<=n.bbox.x1+5&&f.bbox.y0>=n.bbox.y0-5&&f.bbox.y1<=n.bbox.y1+5):[]),x=o.split(/\s+/),R=x.map(f=>f.replace(/[^a-z0-9]/g,"")).join(" "),M=!1;if(w.length>0)for(let f=0;f<=w.length-x.length;f++){let h=w.slice(f,f+x.length),p=h.map(g=>(g.text||"").toLowerCase().trim().replace(/[^a-z0-9]/g,"")).join(" ");if(p===R||p.includes(R)){let g={x0:Math.min(...h.map(u=>u.bbox.x0)),y0:Math.min(...h.map(u=>u.bbox.y0)),x1:Math.max(...h.map(u=>u.bbox.x1)),y1:Math.max(...h.map(u=>u.bbox.y1))};a.push(i(g)),M=!0}}M||a.push(i(n.bbox))}if(a.length===0&&t.words&&t.words.length>0)for(let n of t.words){let c=n.text?n.text.toLowerCase().trim().replace(/[^a-z0-9]/g,""):"",l=o.replace(/[^a-z0-9]/g,"");c===l&&n.bbox&&a.push(i(n.bbox))}if(a.length===0&&t.words&&t.words.length>0){let n=V(o.length);for(let c of t.words){let l=c.text?c.text.toLowerCase().trim():"";l.length>=3&&Math.abs(l.length-o.length)<=n&&Q(l,o,n)<=n&&c.bbox&&a.push(i(c.bbox))}}return a}function N(t,o){let e=null,s=1/0;for(let r of t){let i=Math.round((r.x0+r.x1)/2),a=Math.round((r.y0+r.y1)/2),n=o.x>=r.x0&&o.x<=r.x1&&o.y>=r.y0&&o.y<=r.y1,c=Math.hypot(i-o.x,a-o.y),l=n?0:c;l<s&&(s=l,e={x:i,y:a,dist:c,containsPoint:n,bbox:r})}return e}var C=null;async function tt(){return C||(C=(async()=>{let{createWorker:t}=await import("tesseract.js"),o=await import("fs-extra"),{CU_CACHE_DIR:e}=await import("./paths-EQFOJDZC.js");return o.ensureDirSync(e),t("eng",1,{cachePath:e,logger:()=>{}})})().catch(t=>{throw C=null,t})),C}var I=null,F=null;async function et(){let{getActiveDisplay:t}=await import("./screen_grid-Z2S4GMN5.js"),o=await t();if(I&&F===o)return I;F=o,I={format:"png"};try{let e=await X.listDisplays();e&&e.length>0&&(I={format:"png",screen:(e[o]||e[0]).id})}catch{}return I}var pt=async(t,o={})=>{let e=P(t),s=e.gridId||e.grid||e.coordinate||e.target||e.id,r=(e.type||e.clickType||"single").toLowerCase(),i=(e.button||"left").toLowerCase(),a=e.intendedClickText||e.text||"",n=e.ocrCorrection!==void 0?e.ocrCorrection===!0||e.ocrCorrection==="true":e.useOCR!==void 0?e.useOCR===!0||e.useOCR==="true":!1;if(!s&&!a)return'ERROR: Missing required "gridId" parameter for Click tool.';let c=s;if(n&&a)try{let x=s?B(s):null,R=await et(),M=await X(R),f=await O(M).metadata(),h=f.width||1920,p=f.height||1080,g=x?{x:Math.round(x.x*(h/1280)),y:Math.round(x.y*(p/720))}:{x:h/2,y:p/2},u=a.toLowerCase().trim(),d=await tt(),D=null,T="",q=x?320:500;if(x){let m=Math.min(Math.round(h/2),h),y=Math.min(Math.round(p/2),p),b=Math.max(0,Math.min(h-m,g.x-Math.floor(m/2))),k=Math.max(0,Math.min(p-y,g.y-Math.floor(y/2))),_=await O(M).extract({left:b,top:k,width:m,height:y}).toBuffer(),z=2,A=await H(_,z),J=u.replace(/[^a-z0-9]/g,"_");await U("cropped",`crop_${Date.now()}_${J}.png`,A),await d.setParameters({tessedit_pageseg_mode:"11"});let{data:v}=await d.recognize(A,{},{tsv:!0,blocks:!0});if(v&&v.text){let E=L(v,u,b,k,z);if(E.length>0){let $=N(E,g);$&&($.containsPoint||$.dist<=q)&&(D=$,T="centered target crop OCR")}}}if(!D){let m=await H(M,2),y=u.replace(/[^a-z0-9]/g,"_");await U("fullscreen",`full_${Date.now()}_${y}.png`,m),await d.setParameters({tessedit_pageseg_mode:"3"});let{data:b}=await d.recognize(m,{},{tsv:!0,blocks:!0});if(b&&b.text){let k=L(b,u,0,0,2);if(k.length>0){let _=N(k,g);_&&(D=_,T="full-screen OCR")}}}if(D){let m={x:Math.round(D.x*(1280/h)),y:Math.round(D.y*(720/p))},y=await W("click",m,{button:i,clickType:r});if(typeof y=="string"&&y.startsWith("ERROR:"))return y;let b=S(m),k=`${r==="double"?"Double":"Single"} clicked ${i} button`;return s&&b&&String(s)!==String(b)?`${k}. Tried clicking grid ${s}, but OCR corrected to grid ${b} (${T} for "${a}"). If the click landed unintended, try with ocr correction off.`:`${k} on grid ${b||s} (${T} for "${a}").`}}catch{}let l=await W("click",c,{button:i,clickType:r});if(typeof l=="string"&&l.startsWith("ERROR:"))return l;let w=s||(typeof c=="object"?S(c):c);return`${r==="double"?"Double":"Single"} clicked ${i} button on grid ${w}.`};export{pt as click};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,b as s}from"./chunk-
|
|
1
|
+
import{a as i,b as s}from"./chunk-CBFC5KUU.js";import"./chunk-MJL6DHQM.js";import{a as c}from"./chunk-Y5JU726N.js";var d=async(a,p={})=>{let e=c(a),r=e.action||e.type||e.cmd,n=e.target||e.grid||e.gridCode||e.location||e.input;if(!r)return'ERROR: Missing required "action" argument for computer_action (e.g. move, click, drag, scroll, type, key_press, key_combination).';let t=r.toLowerCase();if(t.startsWith("mouse_")||["move","click","drag","scroll"].includes(t)){let o=t.replace("mouse_","");return await i(o,n,{button:e.button,clickType:e.clickType||e.type,from:e.from,to:e.to,direction:e.direction,amount:e.amount?parseInt(e.amount,10):void 0})}if(t.startsWith("key_")||t==="type"||t==="press"){let o=t;t==="press"&&(o="key_press");let u=e.autoPressEnter===!0||e.autoPressEnter==="true"||e.enter===!0||e.enter==="true";return await s(o,n||e.text||e.keys,{...e,autoPressEnter:u})}return`ERROR: Unrecognized action "${r}". Supported actions: move, click, drag, scroll, type, key_press, key_combination.`};export{d as computer_action};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as m}from"./chunk-NL4MAQSB.js";import{a as M}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-NL4MAQSB.js";import{a as M}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.js";var z=async function*(k,C,U,A,E,K,v,d,$=1,L=""){let x=[];A&&x.push({role:"system",content:A});for(let t of U){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&&v){let c=o.inlineData.mimeType,u=o.inlineData.data;c.startsWith("image/")&&n.push({type:"image_url",image_url:{url:`data:${c};base64,${u}`}})}}else{let o=t.text||"";o&&n.push({type:"text",text:o})}x.push({role:e,content:n.length===1&&n[0].type==="text"?n[0].text:n})}let P=M("c_openai",C,E),_=P!==null?P:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"xhigh"}[E],a={model:C,messages:x,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"};_&&_!=="none"&&(a.reasoning_effort=_,a.reasoning={effort:_});let O=(L||process.env.CUSTOM_OPENAI_URL||process.env.C_OPENAI_URL||"").trim();if(!O)throw new Error("Custom OpenAI Base URL is not configured. Please set Base URL in /settings -> Providers.");let f=O.replace(/\/+$/,"");f.endsWith("/chat/completions")||(f.endsWith("/v1")?f=`${f}/chat/completions`:f=`${f}/chat/completions`);let p={"Content-Type":"application/json",Accept:"text/event-stream, application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow"},T=k&&k!=="LOCAL"?k:process.env.CUSTOM_OPENAI_API_KEY||process.env.C_OPENAI_API_KEY||"";if(T&&T.trim()!==""){let t=T.trim();p.Authorization=t.startsWith("Bearer ")?t:`Bearer ${t}`,p["api-key"]=t}let s=await m(f,{method:"POST",headers:p,body:JSON.stringify(a),signal:d});if(!s.ok&&(s.status===400||s.status===422)&&(a.reasoning||a.reasoning_effort)){if(console.info(`
|
|
2
2
|
`),a.reasoning&&a.reasoning_effort){let t={...a};delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:p,body:JSON.stringify(t),signal:d}).catch(()=>null);e&&e.ok&&(s=e)}if(!s.ok&&a.reasoning_effort){let t={...a};delete t.reasoning;let e=await m(f,{method:"POST",headers:p,body:JSON.stringify(t),signal:d}).catch(()=>null);e&&e.ok&&(s=e)}if(!s.ok){let t={...a};delete t.reasoning,delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:p,body:JSON.stringify(t),signal:d}).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 W=s.body.getReader(),B=new TextDecoder,w="",i=[],l=null,y=Date.now(),g=!1,F=(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},J=(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:""},R=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,u=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:u,thoughtsTokenCount:r}};for(;;){let{done:t,value:e}=await W.read();if(t){g&&(i.length>0||l)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:l});break}w+=B.decode(e,{stream:!0});let n=w.split(`
|
|
3
3
|
`);w=n.pop();for(let o of n){let c=o.trim();if(!c||!c.startsWith("data: "))continue;let u=!1;if(c==="data: [DONE]"||c==="data: [DONE]\r")u=!0;else try{let r=JSON.parse(c.substring(6));if(r.error){let H=r.error.metadata?.raw||r.error.message||(typeof r.error=="string"?r.error:JSON.stringify(r.error));throw new Error(`Custom OpenAI Stream Error: ${H}`)}let h=r.choices?.[0],S=h?.delta;h?.finish_reason&&h.finish_reason!=="null"&&(u=!0);let D=R(r);D&&(l=D,g=!0);let N=F(S,h);N&&(i.push({text:N,thought:!0}),g=!0);let I=J(S,h);I&&(i.push({text:I}),g=!0)}catch(r){if(r.message&&r.message.startsWith("Custom OpenAI Stream Error:"))throw r}if((u||Date.now()-y>=150)&&g&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:l},i=[],y=Date.now(),g=!1),u)break}Date.now()-y>=150&&g&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:l},i=[],y=Date.now(),g=!1)}};export{z as getCustomOpenAIStream};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as b}from"./chunk-NL4MAQSB.js";import{a as T}from"./chunk-
|
|
1
|
+
import{a as b}from"./chunk-NL4MAQSB.js";import{a as T}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.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
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 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-CBFC5KUU.js";import"./chunk-MJL6DHQM.js";import{a as d}from"./chunk-Y5JU726N.js";var m=async(a,i={})=>{let r=d(a),o=r.fromGridId||r.from||r.start,t=r.toGridId||r.to||r.end;return!o||!t?'ERROR: Drag requires both "fromGridId" and "toGridId" parameters.':await e("drag",o,{from:o,to:t})};export{m as drag};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-QOT4BYHM.js";import{a as f}from"./chunk-Y5JU726N.js";import"./chunk-L3W2X74K.js";import"./chunk-M2ULCOL3.js";var m=async(k,c={})=>{let l=f(k),s=l.method,d=l.id,a=c.chatId;if(!c.systemSettings?.advanceRollback)return"ERROR: Advance Rollback feature is currently disabled in settings under Security. Tell user to enable it if needed.";if(!a)return"ERROR: No active chat transaction found for rollback.";if(s==="getCheckpoint"){let r=await i.getCheckpoints(a);if(r.length===0)return"No checkpoints available.";let n={write_file:"WriteFile",update_file:"PatchFile",view_file:"ReadFile",read_folder:"ReadFolder",exec_command:"Run",web_search:"WebSearch",web_scrape:"WebScrape",search_keyword:"SearchKeyword",CodeSearch:"SearchKeyword",code_search:"SearchKeyword",write_pdf:"WritePDF",write_docx:"WriteDoc",generate_image:"GenerateImage",file_map:"FileMap",todo:"Todo",goal:"Goal",Goal:"Goal",await:"Await",ask:"AskUser",ask_user:"AskUser",AskUser:"AskUser",askuser:"AskUser",invoke:"Invoke",invokesync:"InvokeSync",getprogress:"GetProgress",cancel:"Cancel",emergency_rollback:"EmergencyRollback",emergencyrollback:"EmergencyRollback"},t=e=>n[e]||n[e.toLowerCase()]||e,o=`Available checkpoints for rollback:
|
|
2
2
|
|
|
3
3
|
`;for(let e of r)if(e.id==="initial")o+=`--- Initial State (id: initial) ---
|
|
4
4
|
Tools Used: User Prompted for task
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i}from"./chunk-JTTVSAKS.js";import"./chunk-LTX2IUDV.js";import"./chunk-Y5JU726N.js";export{d as activeChildProcess,h as adjustWindowsCommand,c as cleanTerminalOutput,i as exec_command,e as isActiveCommandPty,a as isPtyAvailable,b as stripAnsi,g as terminateActiveCommand,f as writeToActiveCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as D}from"./chunk-NL4MAQSB.js";import{a as A}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-NL4MAQSB.js";import{a as A}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.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
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,4 +1,4 @@
|
|
|
1
|
-
import{d as $}from"./chunk-
|
|
1
|
+
import{d as $}from"./chunk-M2ULCOL3.js";import R from"fs-extra";import y from"path";var N=l=>{if(!l)return[];let u=[],p=/\[(?:tool|action):(.*?)\(([\s\S]*?)\)\]/g,n=0,i;for(;(i=p.exec(l))!==null;){if(i.index>n){let t=l.slice(n,i.index);t.trim()&&u.push({type:"output",content:t})}u.push({type:"tool",toolName:i[1],args:i[2]}),n=p.lastIndex}if(n<l.length){let t=l.slice(n);t.trim()&&u.push({type:"output",content:t})}return u},b=async(l,u,p=process.cwd())=>{let n=`export-fluxflow-${l}.txt`,i=y.join(p,n),t=[],o=!1;for(let m=0;m<u.length;m++){let r=u[m];if(r&&!(r.role==="system"||r.isMeta||r.isLogo||String(r.id).startsWith("welcome"))){if(r.role==="user"){let s=r.text||"";s=s.replace(/\s*\[Prompted on:.*?\]/g,"").trim(),t.length>0&&t.push(""),t.push("[USER]"),t.push(s),o=!1}else if(r.role==="think"){o||(t.push(""),t.push("[AGENT]"),o=!0);let s=(r.text||"").replace(/\[\[\s*turn\s*:\s*(continue|finish)\s*\]\]/gi,"").replace(/\[\[END\]\]/gi,"").replace(/\[\[(?:TOOL|ACTION) RESULTS\]\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULTS\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULT\]/gi,"").trim();s&&(t.push("[thoughts]"),t.push(s))}else if(r.role==="agent"){o||(t.push(""),t.push("[AGENT]"),o=!0);let s=N(r.text||"");for(let c of s)if(c.type==="output"){let a=c.content.replace(/\[\[\s*turn\s*:\s*(continue|finish)\s*\]\]/gi,"").replace(/\[\[END\]\]/gi,"").replace(/\[\[(?:TOOL|ACTION) RESULTS\]\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULTS\]/gi,"").replace(/\[(?:TOOL|ACTION) RESULT\]/gi,"").trim();a&&(t.push("[output]"),t.push(a))}else c.type==="tool"&&(t.push("[tool]"),t.push(`${c.toolName} ${c.args}`))}}}let O=t.join(`
|
|
2
2
|
`);return await R.writeFile(i,O,"utf8"),{exportFile:n,exportPath:i,totalLines:t.length}},j=(l,u="FluxFlow",p=null)=>{if(!l||!l.trim())return[];let n=l.split(`
|
|
3
3
|
`),i=[],t=[],o=/^\s*(?:CRITICAL\s+ERROR|ERROR|DEBUG|SEARCH|PUPPETEER|WARN|WARNING|INFO)\b/i,O=/^\s*-{3,}\s*$/,m=!1;for(let s of n)if(o.test(s)){m=!0;break}if(!m){let s=l.trim();if(!s)return[];let c=p?new Date(p).toLocaleString():"Unknown Time",a=/\bjanitor\b/i.test(s)?"Memory":u;return[{timestamp:c,level:"ERROR",source:a,message:s}]}for(let s of n)O.test(s)?t.length>0&&(i.push(t.join(`
|
|
4
4
|
`).trim()),t=[]):o.test(s)?(t.length>0&&(i.push(t.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R}from"./chunk-
|
|
1
|
+
import{a as R}from"./chunk-BTMPM5BT.js";import{a as N}from"./chunk-Y5JU726N.js";import{t as $}from"./chunk-M2ULCOL3.js";import F from"fs-extra";import d from"path";import{createRequire as I}from"module";var E=I(import.meta.url),P=E("web-tree-sitter"),S=!1,b=new Set(["class_declaration","function_declaration","method_definition","arrow_function","function_expression","if_statement","else_clause","for_statement","for_in_statement","for_of_statement","while_statement","do_statement","switch_statement","try_statement","catch_clause","variable_declarator","export_statement","lexical_declaration","variable_declaration","interface_declaration","type_alias_declaration","enum_declaration","import_declaration","jsx_element","jsx_self_closing_element","class_definition","function_definition","decorated_definition","import_from_statement","import_statement","preproc_include","method_declaration","constructor_declaration","assignment_expression","pair","class_specifier","struct_specifier","enum_specifier","field_declaration","element","script_element","style_element"]),O=new Set(["export_statement","lexical_declaration","variable_declaration","variable_declarator","pair","assignment_expression"]);function o(n,t=50){if(!n)return"";let r=n.replace(/\s+/g," ").trim();return r.length>t?r.substring(0,t-3)+"...":r}function v(n){let t=n.type;if(t==="if_statement"){let e=n.childForFieldName("condition");return e?`if (${o(e.text,40)})`:"if"}if(t==="else_clause")return"else";if(t==="while_statement"||t==="do_statement"){let e=n.childForFieldName("condition");return`${t.split("_")[0]} (${e?o(e.text,40):""})`}if(t==="for_statement"||t==="for_in_statement"||t==="for_of_statement"){let i=n.text.split(`
|
|
2
2
|
`)[0].match(/for\s*(?:await\s*)?\((.*)\)/);return i?`for (${o(i[1],40)})`:"for"}if(t==="switch_statement"){let e=n.childForFieldName("value");return`switch (${e?o(e.text,40):""})`}if(t==="try_statement")return"try";if(t==="catch_clause")return"catch";if(t==="element"||t==="script_element"||t==="style_element"||t==="jsx_element"||t==="jsx_self_closing_element"){let e=n.childForFieldName("opening_element")||n.childForFieldName("start_tag")||n.children.find(c=>c.type==="start_tag")||n,i=e.childForFieldName("name")||e.childForFieldName("tag_name")||e.children.find(c=>c.type==="tag_name");return i?`<${o(i.text,30)}>`:null}if(["import_declaration","import_from_statement","import_statement","preproc_include"].includes(t))return o(n.text.split(`
|
|
3
3
|
`)[0],60);if(t==="pair"){let e=n.childForFieldName("key");return e?o(e.text.replace(/["']/g,""),40):null}if(t==="assignment_expression"){let e=n.childForFieldName("left");return e?`${o(e.text,30)} = ...`:null}if(t==="variable_declarator"){let e=n.childForFieldName("name")||n.children.find(i=>["identifier","object_pattern","array_pattern"].includes(i.type));return e?o(e.text,40):null}let r=n.childForFieldName("name")||n.childForFieldName("declarator")||n.children.find(e=>["identifier","type_identifier","field_identifier","property_identifier","shorthand_property_identifier"].includes(e.type));if(r){if(r.type.includes("declarator")){let e=r.descendantsOfType("identifier")[0]||r.descendantsOfType("field_identifier")[0];if(e)return o(e.text,40)}return o(r.text,40)}if(["arrow_function","function_expression","function_declaration"].includes(t)){let e=n.parent;for(;e&&e.type!=="program";){let i=v(e);if(i)return i;if(!O.has(e.type))break;e=e.parent}}return null}function L(n){let t=[];function r(e){for(let i of e.children)b.has(i.type)?t.push(i):r(i)}return r(n),t}function j(n){return n.replace(/_([a-z])/g,t=>t[1].toUpperCase())}function T(n,t=0,r=!0,e="",i=null,c=12){let s=n.type,l=v(n),u=b.has(s)||t===0,m=L(n),_=u&&t>0&&(O.has(s)&&m.length>0||l!==null&&l===i&&m.length>0),a="",p=e,g=t,h=i;if(u&&!_){let f=n.startPosition.row+1,x=n.endPosition.row+1,y=j(s),w=l?`${y} [${l}]`:y;t===0?(a+=`\u{1F4C1} ROOT (Lines: ${f}-${x})
|
|
4
4
|
`,p=e):(a+=`${e}${r?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 "}${w} (Lines: ${f}-${x})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as E}from"./chunk-Y5JU726N.js";import{w as F,x as S}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-Y5JU726N.js";import{w as F,x as S}from"./chunk-M2ULCOL3.js";import W from"fs/promises";import y from"path";function R(n){let e=n.toLowerCase();if(e.length===0)return[];if(e.length===1)return[e];let o=[];for(let t=0;t<e.length-1;t++)o.push(e.slice(t,t+2));return o}function w(n,e){if(n===e)return 1;if(!n||!e)return 0;let o=R(n),t=R(e);if(o.length===0||t.length===0)return 0;let i=new Map;for(let l of t)i.set(l,(i.get(l)||0)+1);let r=0;for(let l of o){let a=i.get(l)||0;a>0&&(r++,i.set(l,a-1))}return 2*r/(o.length+t.length)}async function x(n,e,o=n,t=1,i=15){if(t>i)return[];let r;try{r=await W.readdir(n,{withFileTypes:!0})}catch{return[]}let l=[];for(let a of r){if(e.has(a.name))continue;let u=y.join(n,a.name);if(a.isDirectory()){let m=await x(u,e,o,t+1,i);l.push(...m)}else{let m=y.relative(o,u).replace(/\\/g,"/");l.push({name:a.name,relPath:`./${m}`})}}return l}var O=async n=>{let e=typeof n=="object"&&n!==null?n:E(n),o=e.basename||e.name||e.path||e.file||e.filename||e.query;if(!o&&typeof n=="string"&&n.trim()){let f=n.trim().replace(/^["']|["']$/g,"");!f.startsWith("{")&&!f.includes("=")&&(o=f)}if(!o)return'ERROR: "basename" parameter is required for FindFile';let t=String(o).trim().replace(/^["']|["']$/g,""),i=t.replace(/^(\.\/|\.\\)/,"").replace(/\\/g,"/"),r=i.toLowerCase(),a=t.includes("*")||t.includes("?")?new RegExp("^"+t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")+"$","i"):null,u=process.cwd(),m=new Set([...F,...S(u)]);try{let f=await x(u,m,u),g=[];for(let s of f){let h=s.name.toLowerCase(),P=y.parse(s.name).name.toLowerCase(),p=s.relPath.toLowerCase(),d=p.startsWith("./")?p.slice(2):p,c=0;if(s.name===i||s.relPath===`./${i}`)c=1;else if(h===r||p===`./${r}`||d===r)c=.98;else if(P===r)c=.95;else if(a&&(a.test(s.name)||a.test(d)))c=.9;else if(h.includes(r)||d.includes(r))c=.7+r.length/Math.max(h.length,r.length)*.15;else{let C=w(r,h),q=w(r,P),M=w(r,d),L=Math.max(C,q,M);L>=.75&&(c=L*.85)}c>=.6&&g.push({relPath:s.relPath,score:c})}if(g.length===0)return`No file found matching name "${t}"`;g.sort((s,h)=>h.score-s.score||s.relPath.length-h.relPath.length);let $=Array.from(new Set(g.map(s=>s.relPath))),b=$.length;return`${`Found ${b} file${b===1?"":"s"} matching "${t}":
|
|
2
2
|
|
|
3
3
|
`}${$.join(`
|
|
4
4
|
`)}`}catch(f){return`ERROR: Failed to find file: ${f.message}`}};export{O as find_file};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-3JI2CRXK.js";import{a as b}from"./chunk-Y5JU726N.js";import{t as B,u as T,v as $}from"./chunk-K4AZXTU6.js";import{a as I}from"./chunk-FSE4BZZZ.js";import"./chunk-PRTGV2R4.js";import"./chunk-L3W2X74K.js";import"./chunk-M2ULCOL3.js";import C from"fs-extra";import x from"path";var F=(a,y={})=>{try{if(a.length<8||a[0]!==137||a[1]!==80||a[2]!==78||a[3]!==71)return a;let s=[],c=[];for(let r=0;r<256;r++){let e=r;for(let n=0;n<8;n++)e&1?e=3988292384^e>>>1:e=e>>>1;c[r]=e}let l=r=>{let e=4294967295;for(let n=0;n<r.length;n++)e=c[(e^r[n])&255]^e>>>8;return(e^4294967295)>>>0},f=(r,e)=>{let n=Buffer.from(r,"ascii"),i=Buffer.from(e,"utf-8"),u=n.length+1+i.length,o=Buffer.alloc(8+u+4);o.writeUInt32BE(u,0),o.write("tEXt",4,"ascii"),n.copy(o,8),o[8+n.length]=0,i.copy(o,8+n.length+1);let w=l(o.subarray(4,8+u));return o.writeUInt32BE(w,8+u),o};for(let[r,e]of Object.entries(y))e!=null&&s.push(f(r,String(e)));if(s.length===0)return a;if(a.subarray(12,16).toString("ascii")==="IHDR"){let e=a.subarray(0,33),n=a.subarray(33);return Buffer.concat([e,...s,n])}return a}catch{return a}},N=async(a,y={})=>{let s=b(a),c=s.prompt||s.text,l=s.path||s.outputPath||s.output||"generated_image.png",f=s.ratio;if(!c)return'ERROR: Missing "prompt" argument for generate_image.';let r=["nsfw","naked","nudity","nude","porn","sex","xxx","erotic","gore","bloody","violence","abuse","suicide","murder","hentai","pedophile","rape"],e=c.toLowerCase();if(r.some(i=>e.includes(i)))return"ERROR: Prompt blocked by system safety filter (inappropriate or unsafe content detected).";try{let i=await I();if(!await B(i))return`ERROR: Insufficient Quota for selected quality. Either tell user reduce quality or wait for next refresh cycle (${(await T()).nextResetMin||60}m).`;let o=i.imageSettings||{keyType:"Default",quality:"Low-High",apiKey:""},w=o.keyType==="Custom"&&o.apiKey?o.apiKey:FALLBACK_IMAGE_KEY,E={Low:"flux","Low-High":"zimage",Medium:"gptimage","Medium-High":"gptimage",High:"qwen-image",Ultra:"gptimage-large",Premium:"nanobanana-pro"}[o.quality]||"zimage",g=1024,m=1024;if(f){let t=f.replace(/\s+/g,"");t==="16:9"?(g=1024,m=576):t==="9:16"?(g=576,m=1024):t==="4:3"?(g=1024,m=768):t==="3:4"?(g=768,m=1024):t==="1:1"&&(g=1024,m=1024)}let M=Math.floor(Math.random()*1e7),S=`https://gen.pollinations.ai/image/${encodeURIComponent(c)}?model=${E}&width=${g}&height=${m}&seed=${M}&enhance=true&reasoning=high&quality=high&negative=${encodeURIComponent("deformed, distorted, disfigured, poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, disconnected limbs, mutation, mutated hands and fingers, blurry, low quality, low resolution, extra fingers, censored, watermarks, signatures")}`,d=await fetch(S,{method:"GET",headers:{Authorization:`Bearer ${w}`}});if(!d.ok){let t=d.status,h="";try{h=await d.text()}catch{}return t===402||h.includes("Insufficient balance")||h.includes("PAYMENT_REQUIRED")?"ERROR: Image Generation Currently unavailable. Try again later.":`ERROR: Image Generation failed with status [${t}]: ${h||"Unknown API Error"}`}if((d.headers.get("content-type")||"").includes("application/json")){let t=await d.json();return t.status===402||t.error&&t.error.code==="PAYMENT_REQUIRED"?"ERROR: Image Generation Currently unavailable. Try again later.":`ERROR: Image Generation failed: ${t.error?.message||JSON.stringify(t)}`}let O=await d.arrayBuffer(),p=Buffer.from(O),P={Title:c,Description:"Generated via FluxFlow CLI",Software:"FluxFlow CLI",Author:"FluxFlow","Creation Time":new Date().toISOString(),Prompt:c,Model:`Fluxflow:${E}`,Ratio:f||"1:1",Seed:String(M)};p=F(p,P);let R=x.resolve(process.cwd(),l);await C.ensureDir(x.dirname(R)),await k.recordFileChange(R),await C.writeFile(R,p),await $(i);let v=x.extname(l).toLowerCase(),L={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp"}[v]||"image/png";return y.isMultiModal!==!1?{text:`Image successfully generated from prompt [${c}] and saved to [${l}]. Output attached to multimodal part`,binaryPart:{inlineData:{data:p.toString("base64"),mimeType:L}}}:`Image successfully generated from prompt [${c}] and saved to [${l}].`}catch(i){return`ERROR: Failed during image generation: ${i instanceof Error?i.message:String(i)}`}};export{N as generate_image};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as D}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.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
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
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>"+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};
|