fluxflow-cli 4.36.5 → 4.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-OQIVTNU2.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-KNIDIMIZ.js → app-SOKCZSBF.js} +152 -152
- 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-5UEMARJ5.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-IVSN6GNM.js} +2 -2
- package/dist/chunks/{invokeSync-MW7SR3Z4.js → invokeSync-LLGAN4ZS.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 +1 -1
- package/package.json +1 -1
- 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,2 +1,2 @@
|
|
|
1
|
-
import{a as A}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-
|
|
1
|
+
import{a as A}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.js";var B=async function*(C,v,E,w,x,j,N,O,S=1){let a=v,m=null;if(typeof a=="string"){let t={};if(a.includes("::")){let e=a.indexOf("::"),n=a.slice(0,e).trim();n&&(t.only=[n]),a=a.slice(e+2).trim()}let d=["flex","standard","priority"],o={fp16:"fp16",f16:"fp16",fp8:"fp8",f8:"fp8",int8:"int8",in8:"int8",int4:"int4",in4:"int4"},s=["throughput","latency","price","ttft"];if(a.includes(":")){let e=a.split(":");for(;e.length>1;){let n=e[e.length-1].toLowerCase().trim();if(d.includes(n))t.service_tier=n,t.allow_fallbacks=!1,e.pop();else if(o[n])t.quantizations=[o[n]],t.allow_fallbacks=!1,e.pop();else if(s.includes(n))t.sort=n,t.allow_fallbacks=!1,e.pop();else break}a=e.join(":").trim()}Object.keys(t).length>0&&(m=t)}let _=[];w&&_.push({role:"system",content:w});for(let t of E){let d=t.role==="user"?"user":"assistant",o=[];if(Array.isArray(t.parts)){for(let s of t.parts)if(s.text)o.push({type:"text",text:s.text});else if(s.inlineData&&N){let e=s.inlineData.mimeType,n=s.inlineData.data;e.startsWith("image/")&&o.push({type:"image_url",image_url:{url:`data:${e};base64,${n}`}})}}else{let s=t.text||"";s&&o.push({type:"text",text:s})}_.push({role:d,content:o.length===1&&o[0].type==="text"?o[0].text:o})}let T=b("Infron",a,x),D=T!==null?T:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[x],y={model:a,messages:_,stream:!0,stream_options:{include_usage:!0},temperature:S,tools:[],tool_choice:"none"};m&&(y.provider=m),D&&(y.reasoning={effort:D});let M=process.env.INFRON_URL||"https://llm.onerouter.pro/v1/chat/completions",I={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},F=C||process.env.INFRON_API_KEY||"";I.Authorization=`Bearer ${F}`;let f=await A(M,{method:"POST",headers:I,body:JSON.stringify(y),signal:O});if(!f.ok){let t=await f.json().catch(()=>({}));throw new Error(`Infron Error (${f.status}): ${t.error?.message||t.message||f.statusText}`)}let R=f.body.getReader(),L=new TextDecoder,k="",i=[],p=null,u=Date.now(),l=!1;for(;;){let{done:t,value:d}=await R.read();if(t){l&&(i.length>0||p)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:p});break}k+=L.decode(d,{stream:!0});let o=k.split(`
|
|
2
2
|
`);k=o.pop();for(let s of o){let e=s.trim();if(!e||!e.startsWith("data: "))continue;let n=!1;if(e==="data: [DONE]")n=!0;else try{let g=JSON.parse(e.substring(6)),c=g.choices?.[0]?.delta,r=g.usage;if(r&&(p={totalTokenCount:r.total_tokens||(r.prompt_tokens||0)+(r.completion_tokens||0),promptTokenCount:r.prompt_tokens||0,candidatesTokenCount:r.completion_tokens||0,cachedContentTokenCount:r.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:r.completion_tokens_details?.reasoning_tokens||r.reasoning_tokens||0},l=!0),c){let h=c.reasoning_content||c.reasoning||null;!h&&Array.isArray(c.reasoning_details)&&c.reasoning_details.length>0&&(h=c.reasoning_details.map(P=>P.text||"").filter(Boolean).join("")),h&&(i.push({text:h,thought:!0}),l=!0),c.content&&(i.push({text:c.content}),l=!0)}}catch{}if((n||Date.now()-u>=150)&&l&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:p},i=[],u=Date.now(),l=!1),n)break}Date.now()-u>=150&&l&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:p},i=[],u=Date.now(),l=!1)}};export{B as getInfronStream};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as k,c as d}from"./chunk-56EJGQU3.js";import{a as b}from"./chunk-Y5JU726N.js";var I=async(w,s={})=>{let{runSubagent:U}=await import("./ai-
|
|
1
|
+
import{a as k,c as d}from"./chunk-56EJGQU3.js";import{a as b}from"./chunk-Y5JU726N.js";var I=async(w,s={})=>{let{runSubagent:U}=await import("./ai-OQIVTNU2.js"),l=b(w),c=l.task||l.instruction||l.prompt,E=l.model||null,C=l.title||null,m=l.tools||null;if(!c)return'ERROR: Missing "task" argument for invoke.';let f=null;if(m)try{let t=m.trim();t.startsWith("[")&&t.endsWith("]")&&(t=t.substring(1,t.length-1)),f=t.split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let i=`subagent-${Date.now()}-${Math.floor(Math.random()*1e3)}`,h=null,S=null,$=new Promise((t,n)=>{h=t,S=n}),e={id:i,title:C||c.substring(0,30),task:c,status:"running",startedAt:Date.now(),lastChunkTime:Date.now(),wps:0,questions:[],pendingSteerMessages:[],steer:t=>{t&&e.pendingSteerMessages.push(t)},completionPromise:$,_resolveCompletion:h,_rejectCompletion:S,progress:[]},r={chunks:[],totalWords:0};k.push(e),s.onSubagentUpdate&&s.onSubagentUpdate();let a=[],A={...s,taskId:i,onAskMain:async t=>{let n=`q-${Date.now()}-${Math.floor(Math.random()*1e3)}`,o=null,p=new Promise(g=>{o=g}),u={id:n,question:t,answered:!1,answer:null,askedAt:Date.now(),_resolve:o};return e.questions.push(u),e.status="waiting",s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" is WAITING FOR YOUR INPUT: "${t}"
|
|
2
2
|
Respond using tool: [action:Answer(id="${i}", answer="...")]
|
|
3
3
|
[/SYSTEM]`),await p},onVisualFeedback:t=>{e.lastChunkTime=Date.now();let n=t.replace(/\x1b\[[0-9;]*m/g,""),o=n.match(/[✔✘✗✖🔍📖→➕↻•]\s*([A-Za-z0-9\s-]+)/);o?e.currentTool=o[1].trim():e.currentTool=n,s.onSubagentUpdate&&s.onSubagentUpdate()},onTokenChunk:(t,n)=>{let o=Date.now();if(e.lastChunkTime=o,e.currentTool="Thinking",typeof n=="number"&&n>0){r.totalWords+=n,r.chunks.push({time:o,words:n});let p=o-400;if(r.chunks=r.chunks.filter(u=>u.time>=p),r.chunks.length>0){let u=r.chunks.reduce((M,_)=>M+_.words,0),T=r.chunks[0].time,g=Math.max(.4,(o-T)/1e3);e.wps=Math.round(u/g)}}s.onSubagentUpdate&&s.onSubagentUpdate()}};return U(c,A,E,f,50,t=>{if(e.status==="cancelled")return;if(t.startsWith("[Subagent Turn")&&a.length>0&&(e.progress.push([...a]),a=[]),t.includes("[Executing Tool]")){let o=t.match(/\[Executing Tool\]\s*([a-zA-Z0-9_]+)/);o&&(!e.currentTool||e.currentTool==="Thinking")&&(e.currentTool=o[1])}let n=t;if(n.startsWith("[Tool Result]")||n.startsWith("[Action Result]")){let o=n.split(`
|
|
4
4
|
`);o.length>5&&(n=o.slice(0,4).join(`
|
|
5
5
|
`)+`
|
|
6
|
-
... [Content/Diff Truncated from Logs] ...`)}a.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0).then(t=>{if(e.status==="cancelled"){e._resolveCompletion&&e._resolveCompletion(t);return}a.length>0&&(e.progress.push([...a]),a=[]),e.status="completed",e.finalAnswer=t,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) has FINISHED. Call GetProgress(id="${i}") to see the final result. [/SYSTEM]`),e._resolveCompletion&&e._resolveCompletion(t)}).catch(async t=>{let{isTerminationSignaled:n}=await import("./ai-
|
|
6
|
+
... [Content/Diff Truncated from Logs] ...`)}a.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0).then(t=>{if(e.status==="cancelled"){e._resolveCompletion&&e._resolveCompletion(t);return}a.length>0&&(e.progress.push([...a]),a=[]),e.status="completed",e.finalAnswer=t,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) has FINISHED. Call GetProgress(id="${i}") to see the final result. [/SYSTEM]`),e._resolveCompletion&&e._resolveCompletion(t)}).catch(async t=>{let{isTerminationSignaled:n}=await import("./ai-OQIVTNU2.js");if(t.message==="Subagent task was cancelled."||e.status==="cancelled"||n()){e.status="cancelled",a.push("[SUBAGENT CANCELLED] Task was cancelled."),e.progress.push([...a]),s.onSubagentUpdate&&s.onSubagentUpdate(),e._resolveCompletion&&e._resolveCompletion(null);return}a.push(`[SUBAGENT FAILURE] Error: ${t.message}`),e.progress.push([...a]),e.status="failed",e.error=t.message,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) FAILED with error: ${t.message}. [/SYSTEM]`),e._rejectCompletion&&e._rejectCompletion(t)}),`Background subagent started. Task ID: ${i}`};export{I as invoke};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as o}from"./chunk-Y5JU726N.js";var k=async(b,t={})=>{let{runSubagent:u}=await import("./ai-
|
|
2
|
-
`),e}catch(e){let{isTerminationSignaled:i}=await import("./ai-
|
|
1
|
+
import{a as o}from"./chunk-Y5JU726N.js";var k=async(b,t={})=>{let{runSubagent:u}=await import("./ai-OQIVTNU2.js"),s=o(b),a=s.task||s.instruction||s.prompt,m=s.model||null,l=s.tools||null;if(!a)return'ERROR: Missing "task" argument for invokeSync.';let r=null;if(l)try{let e=l.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.substring(1,e.length-1)),r=e.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let n=s.title||a.substring(0,30);try{t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n}`);let e=await u(a,t,m,r,50);return t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} [COMPLETED]
|
|
2
|
+
`),e}catch(e){let{isTerminationSignaled:i}=await import("./ai-OQIVTNU2.js"),c=e.message==="Subagent task was cancelled by user."||i();if(t.onVisualFeedback){let d=c?"[CANCELLED]":"[FAILED]";t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} ${d}
|
|
3
3
|
`)}return`ERROR: Subagent execution failed: ${e.message}`}};export{k as invokeSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./chunk-
|
|
1
|
+
import{b as e}from"./chunk-CBFC5KUU.js";import"./chunk-MJL6DHQM.js";import{a as i}from"./chunk-Y5JU726N.js";var k=async(s,c={})=>{let t=i(s),a=t.key||t.keys||t.input||t.shortcut;if(!a)return'ERROR: Missing required "key" parameter for KeyPress tool.';let r=String(a).trim().toLowerCase();if(r==="clearinput"||r==="clear_input"||r==="clear")return await e("clear_input");if(r==="back"||r==="browser_back"||r==="browserBack")return await e("browser_back");if(r.includes(";")||r.includes("+")){let o=r.split(/[;+]/).map(n=>n.trim()).filter(Boolean);return await e("key_combination",o)}return await e("key_press",r)};export{k as key_press};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n}from"./chunk-
|
|
1
|
+
import{b as n}from"./chunk-CBFC5KUU.js";import"./chunk-MJL6DHQM.js";import{a as r}from"./chunk-Y5JU726N.js";var p=async(o,u={})=>{let t=r(o),e=t.text||t.input||t.value||"",s=t.autoPressEnter===!0||t.autoPressEnter==="true"||t.enter===!0||t.enter==="true";return e==null?'ERROR: Missing required "text" parameter for KeyboardTyping tool.':await n("type",String(e),{autoPressEnter:s})};export{p as keyboard_typing};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as M,d as m}from"./chunk-L3W2X74K.js";import{k as a,l as $}from"./chunk-
|
|
1
|
+
import{c as M,d as m}from"./chunk-L3W2X74K.js";import{k as a,l as $}from"./chunk-M2ULCOL3.js";var O=4*(1024*2),v=async(p,E={})=>{let s=t=>{let e=new RegExp(`${t}\\s*[:=]\\s*(["'])(.*?)\\1(?=\\s*[,)]|\\s+\\w+\\s*[:=]|$)`,"s"),n=p.match(e);if(n)return n[2].trim();let o=new RegExp(`${t}\\s*[:=]\\s*([^,\\s)]+)`,"s"),r=p.match(o);return r?r[1].trim():null},R=s("action"),u=s("method"),c=s("content"),w=s("content-new"),S=s("content-old"),y=s("id"),d=s("chat-id")||E.chatId||E.sessionId||"default-session";if(R==="temp"){if(!c)return"ERROR: Missing 'content' for temp memory.";let t=M($,{});t[d]||(t[d]=[]),t[d].push(c),m($,t);let e=t[d].reduce((n,o)=>n+o.length,0);return`Temporary context saved for session [${d}]. (Size: ${e} chars)`}if(R==="user"){let t=M(a,[]).map(e=>(e.score===void 0&&(e.score=.5),e));if(u==="add"){if(!c)return"ERROR: Missing 'content' for memory addition.";let e=new Date,n=`${e.getDate()}/${e.getMonth()+1}/${e.getFullYear()}`,o=c.includes("[Saved on:")?c:`${c.trim()} [Saved on: ${n}]`,r=O,i=t.reduce((g,I)=>g+(I.memory?.length||0),0);for(;t.length>0&&i+o.length>r;){let g=t.shift();i-=g.memory?.length||0}let l=s("score"),f=l?parseFloat(l):.5,h={id:`mem-${Date.now().toString(36)}`,memory:o,score:Math.min(2,isNaN(f)?.5:f)};return t.push(h),m(a,t),`Memory added with ID [${h.id}] and score [${h.score}]. (Vault Size: ${i+o.length} chars)`}if(u==="update"){let e=y||S,n=w||c;if(!e||!n)return"ERROR: Missing 'id' or content for update.";let o=t.findIndex(f=>f.id===e);if(o===-1)return`ERROR: Memory ID [${e}] not found.`;let r=new Date,i=`${r.getDate()}/${r.getMonth()+1}/${r.getFullYear()}`,l=n.includes("[Saved on:")?n:`${n.trim()} [Saved on: ${i}]`;return t[o].memory=l,m(a,t),`Memory [${e}] updated.`}if(u==="delete"){let e=y||c;if(!e)return"ERROR: Missing 'id' for deletion.";let n=t.length,o=t.filter(r=>r.id!==e);return o.length===n?`ERROR: Memory ID [${e}] not found.`:(m(a,o),`Memory [${e}] deleted.`)}return`ERROR: Invalid method [${u}] for user memory. Use 'add', 'update', or 'delete'.`}return`ERROR: Unknown action [${R}] for memory tool.`};export{v as memory};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as O,b as j,c as f}from"./chunk-NL4MAQSB.js";import{a as N}from"./chunk-
|
|
1
|
+
import{a as O,b as j,c as f}from"./chunk-NL4MAQSB.js";import{a as N}from"./chunk-FAEB3V5R.js";import"./chunk-PRTGV2R4.js";import"./chunk-M2ULCOL3.js";var X=async function*(M,T,B,b,m,K,E,J,P=1,W=null){let w=[];b&&w.push({role:"system",content:b});for(let t of B){let g=t.role==="user"?"user":"assistant",e=[];if(Array.isArray(t.parts)){for(let i of t.parts)if(i.text)e.push({type:"text",text:i.text});else if(i.inlineData&&E){let p=i.inlineData.mimeType,d=i.inlineData.data;p.startsWith("image/")&&e.push({type:"image_url",image_url:`data:${p};base64,${d}`})}}else{let i=t.text||"";i&&e.push({type:"text",text:i})}e.length>0&&w.push({role:g,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let S={Fast:"none",Low:"none",Medium:"high",Standard:"high",High:"high",xHigh:"high"},F=`${M.slice(-5)}${W||""}${m}${T}`,H=await j(F),C={model:T,messages:w,stream:!0,temperature:P,prompt_cache_key:H,tools:[],tool_choice:"none"},h=N("Mistral",T,m);h!==null&&h!=="none"?h&&h!=="none"&&h!=="disabled"&&h!==!1&&(C.reasoning_effort=h):m&&S[m]!=="none"&&(C.reasoning_effort=S[m]||"high");let y=await O("https://api.mistral.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(C),signal:J});if(!y.ok){let t=await y.text().catch(()=>""),g=y.statusText;try{let e=JSON.parse(t);g=e.error?.message||e.message||JSON.stringify(e.detail||e)}catch{t&&(g=t)}throw new Error(`Mistral Error (${y.status}): ${JSON.stringify(g)}`)}let R=y.body.getReader(),q=new TextDecoder,D="",n=[],x=null,k=Date.now(),r=!1,o=t=>t?typeof t=="string"?f(t):Array.isArray(t)?t.map(o).filter(Boolean).join(""):typeof t=="object"&&t!==null?typeof t.text=="string"?f(t.text):typeof t.content=="string"?f(t.content):typeof t.thinking=="string"?f(t.thinking):typeof t.reasoning_content=="string"?f(t.reasoning_content):typeof t.reasoning=="string"?f(t.reasoning):typeof t.value=="string"?f(t.value):t.text?o(t.text):t.content?o(t.content):t.thinking?o(t.thinking):t.reasoning_content?o(t.reasoning_content):t.reasoning?o(t.reasoning):t.value?o(t.value):"":f(String(t)):"";for(;;){let{done:t,value:g}=await R.read();if(t){r&&(n.length>0||x)&&(yield{candidates:n.length>0?[{content:{parts:n}}]:[],usageMetadata:x});break}D+=q.decode(g,{stream:!0});let e=D.split(`
|
|
2
2
|
`);D=e.pop();for(let i of e){let p=i.trim();if(!p||!p.startsWith("data: "))continue;let d=!1;if(p==="data: [DONE]")d=!0;else try{let _=JSON.parse(p.substring(6)),c=_.choices?.[0]?.delta,u=_.usage;if(_.choices?.[0]?.finish_reason&&(d=!0),u&&(x={totalTokenCount:u.total_tokens||(u.prompt_tokens||0)+(u.completion_tokens||0),promptTokenCount:u.prompt_tokens||0,candidatesTokenCount:u.completion_tokens||0,cachedContentTokenCount:u.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:u.completion_tokens_details?.reasoning_tokens||0},r=!0),c){let z=c.thinking||c.reasoning_content||c.reasoning,$=o(z);$&&(n.push({text:$,thought:!0}),r=!0);let a=c.content||(!c.thinking&&!c.reasoning_content&&!c.reasoning?c.text:null);if(a)if(Array.isArray(a))for(let s of a)if(typeof s=="object"&&s!==null){let l=s.type==="thinking"||s.type==="reasoning"||!!s.thought,A=o(s);A&&(n.push({text:A,...l?{thought:!0}:{}}),r=!0)}else{let l=o(s);l&&(n.push({text:l}),r=!0)}else if(typeof a=="object"&&a!==null){let s=a.type==="thinking"||a.type==="reasoning"||!!a.thought,l=o(a);l&&(n.push({text:l,...s?{thought:!0}:{}}),r=!0)}else{let s=o(a);s&&(n.push({text:s}),r=!0)}}}catch{}if((d||Date.now()-k>=150)&&r&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:x},n=[],k=Date.now(),r=!1),d)break}Date.now()-k>=150&&r&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:x},n=[],k=Date.now(),r=!1)}};export{X as getMistralStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-PRTGV2R4.js";import"./chunk-M2ULCOL3.js";export{a as DEFAULT_MODEL_CONFIG,o as getDefaultModel,q as getFallbackValue,b as getModelConfig,p as getModelPricing,n as getModels,m as hasModelReasoning,l as isModelMultimodal,h as removeModelFromProvider,i as renameModelInProvider,c as saveModelConfigToDisk,d as saveModelToProvider,j as setCustomMultimodal,g as setDefaultModelForProvider,f as setModelMultimodalInProvider,k as setOllamaMultimodal,e as updateModelInfoInProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as j}from"./chunk-NL4MAQSB.js";import{a as W}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-NL4MAQSB.js";import{a as W}from"./chunk-FAEB3V5R.js";import{l as K}from"./chunk-PRTGV2R4.js";import"./chunk-M2ULCOL3.js";var ue=async function*(M,e,k,c,g,D,w=!1,I,H=1){let A=[];c&&A.push({role:"system",content:c}),k.forEach(i=>{let N=i.role==="model"?"assistant":"user",d=[];Array.isArray(i.parts)&&i.parts.forEach(u=>{if(u.text)d.push({type:"text",text:u.text});else if(u.inlineData&&w){let r=u.inlineData.mimeType,f=u.inlineData.data;r.startsWith("image/")&&K(e)&&d.push({type:"image_url",image_url:{url:`data:${r};base64,${f}`}})}}),A.push({role:N,content:d.length===1&&d[0].type==="text"?d[0].text:d})});let T=W("NVIDIA",e,g),t=T!==null?T:{Fast:"Fast",Low:"Fast",Medium:"Standard",Standard:"Standard",High:"High",xHigh:"High"}[g]||"High",o=t!=="Fast"&&t!=="none"&&t!=="disabled"&&t!==!1,s=e.includes("kimi"),n=e.includes("gemma"),h=e.includes("deepseek"),y=e.includes("glm"),z=e.includes("mistral"),P=e.includes("minimax"),J=e.includes("gpt"),Y=e.includes("qwen"),Q=e.includes("nemotron"),X=e.includes("llama-3"),Z=e.includes("seed"),B=e.includes("poolside"),C=e.includes("thinkingmachines")||e.includes("muse"),ee=X,te={Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},se={Fast:"64",Low:"64",Medium:"4096",Standard:"4096",High:"16384",xHigh:"16384"},ne={Fast:"none",Low:"minimal",Medium:"medium",Standard:"medium",High:"max",xHigh:"max"},U=P||h||B||C?16384:32768;U=process.env.NVIDIA_BASE_URL?1024:U;let a={model:e,messages:A,max_tokens:U,stream:!0,stream_options:{include_usage:!0},temperature:H,tools:[],tool_choice:"none",...J&&{thinking:te[g]||"high"}};if(!(process.env.NVIDIA_BASE_URL||ee))if(s)a.chat_template_kwargs={thinking:o};else if(n)a.chat_template_kwargs={enable_thinking:o};else if(h)if(o){let i=t==="High"?"max":"high";a.chat_template_kwargs={thinking:!0,reasoning_effort:i}}else a.chat_template_kwargs={thinking:!1};else y?a.chat_template_kwargs={enable_thinking:o,clear_thinking:!o}:z?a.reasoning_effort=o?"high":"none":P&&e.includes("minimax-m3")?a.chat_template_kwargs={thinking_mode:o?"enabled":"disabled"}:Y?a.chat_template_kwargs={enable_thinking:o}:Q?t==="High"?a.chat_template_kwargs={enable_thinking:!0}:t==="Standard"?a.chat_template_kwargs={enable_thinking:!0,medium_effort:!0}:a.chat_template_kwargs={enable_thinking:!1}:Z?o&&(a.extra_body={thinking_budget:parseInt(se[t]??"4096")}):B?a.chat_template_kwargs={enable_thinking:o}:C&&(a.reasoning_effort=ne[t]||"medium");let V=0,G=6,$=!1,R=(process.env.NVIDIA_BASE_URL||"https://integrate.api.nvidia.com/v1").trim(),v=R.replace(/\/+$/,"");if(!v.endsWith("/v1")&&!v.endsWith("/v1/chat/completions"))throw new Error(`Invalid NVIDIA Base URL: "${R}". Endpoint URL MUST end with /v1 (e.g. https://integrate.api.nvidia.com/v1 or http://.../v1).`);let ae=v.endsWith("/chat/completions")?v:`${v}/chat/completions`,ie=process.env.NVIDIA_API_KEY&&process.env.NVIDIA_BASE_URL?process.env.NVIDIA_API_KEY:M;for(;V<G;){V++;try{let i=await j(ae,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ie}`},body:JSON.stringify(a),signal:I});if(!i.ok){let x=await i.text().catch(()=>""),S=i.statusText;try{let m=JSON.parse(x);S=m.error?.message||m.message||JSON.stringify(m.detail||m)}catch{x&&(S=x)}let b=new Error(`NVIDIA API Error (${i.status}): ${S}`);throw b.status=i.status,b}let N=i.body.getReader(),d=new TextDecoder,u="",r=[],f=null,q=Date.now(),_=!1;for(;;){let{done:x,value:S}=await N.read();if(x){_&&(r.length>0||f)&&(yield{candidates:r.length>0?[{content:{parts:r}}]:[],usageMetadata:f},$=!0);break}u+=d.decode(S,{stream:!0});let b=u.split(`
|
|
2
2
|
`);u=b.pop();let m=!1;for(let oe of b){let E=oe.trim();if(E){if(E==="data: [DONE]"){m=!0;break}if(E.startsWith("data: ")){let p;try{p=JSON.parse(E.substring(6))}catch{continue}if(p.error)throw new Error(`NVIDIA Stream Error: ${p.error.message||JSON.stringify(p.error)}`);try{let l=p.usage;l&&(f={totalTokenCount:l.total_tokens||l.prompt_tokens+l.completion_tokens,promptTokenCount:l.prompt_tokens||0,candidatesTokenCount:l.completion_tokens||0,cachedContentTokenCount:l.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:(l.completion_tokens_details?.reasoning_tokens||0)+(l.completion_tokens_details?.thoughts_tokens||0)},_=!0);let F=p.choices?.[0]?.delta?.reasoning||p.choices?.[0]?.delta?.reasoning_content||"",O=p.choices?.[0]?.delta?.content||"";F&&(r.push({text:F,thought:!0}),_=!0),O&&(r.push({text:O}),_=!0)}catch{}}}}if((m||Date.now()-q>=350)&&_&&(yield{candidates:r.length>0?[{content:{parts:[...r]}}]:[],usageMetadata:f},$=!0,r=[],q=Date.now(),_=!1),m)break}break}catch(i){if($||V>=G)throw i;await new Promise(N=>setTimeout(N,3500))}}},he=async function*(M,e){let k=[],c=null,g=!1,D=null,w=s=>{if(k.push(s),c){let n=c;c=null,n()}},I=e.split("/").pop(),H=Array.from(new Set([I,I.replace(/\./g,"-"),I.replace(/\./g,"_")])),T=["https://buildapi.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy","https://api.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy"].flatMap(s=>H.map(n=>`${s}/${n}`)),L=!1,t=null,o=async()=>{try{let n=await(await Promise.any(T.map(async h=>{let y=await fetch(h);if(!y.ok)throw new Error(`HTTP ${y.status}`);return y}))).json();if(n&&n.queues&&n.queues[0]&&typeof n.queues[0].queueDepth=="number"){let h=n.queues[0].queueDepth;L||w({value:{type:"status",content:`Queue ${h||1}`},done:!1})}}catch{}};process.env.NVIDIA_BASE_URL||(o(),t=setInterval(o,5e3)),(async()=>{try{let s=M[Symbol.asyncIterator]();for(;;){let{value:n,done:h}=await s.next();if(h)break;L=!0,t&&(clearInterval(t),t=null),w({value:n,done:!1})}g=!0,w(null)}catch(s){if(D=s,t&&(clearInterval(t),t=null),c){let n=c;c=null,n()}}})();try{for(;;){if(D)throw D;if(k.length>0){let s=k.shift();if(s===null&&g)break;yield s.value}else{if(g)break;await new Promise(s=>{c=s})}}}finally{t&&(clearInterval(t),t=null)}};export{ue as getNVIDIAStream,he as wrapNvidiaStreamWithQueueDepth};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as O}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.js";import{Ollama as D}from"ollama";var y=async function*(r,p,M,d,u,b,S,T,v=1,w="Cloud"){let m=[];d&&m.push({role:"system",content:d});for(let t of M){let l=t.role==="user"?"user":"assistant",a="",c=[];if(Array.isArray(t.parts)){a=t.parts.map(o=>o.text||"").filter(Boolean).join(`
|
|
2
2
|
`);for(let o of t.parts){let h=o.inlineData||o.inline_data;h&&h.data&&c.push(h.data)}}else a=t.text||"";if(a||c.length>0){let o={role:l,content:a};c.length>0&&(o.images=c),m.push(o)}}let f=w==="Local"||!r||r==="LOCAL",g={host:f?process.env.OLLAMA_HOST||"http://127.0.0.1:11434":process.env.OLLAMA_HOST||"https://ollama.com"};!f&&r&&(g.headers={Authorization:"Bearer "+r});let C=new D(g),e=[],i=null,_=Date.now(),n=!1,s=O("Ollama",p,u),k={Fast:!1,Low:"medium",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},A=s!==null?s==="false"||s===!1?!1:s==="true"||s===!0?!0:s:k[u]!==void 0?k[u]:!0,x={model:p,messages:m,stream:!0,think:A,keep_alive:"10m",tools:[],tool_choice:"none",options:{temperature:v}},L=await C.chat(x);for await(let t of L){if(T?.aborted)throw new DOMException("The user aborted a request.","AbortError");if(t.message?.thinking&&(e.push({text:t.message.thinking,thought:!0}),n=!0),t.message?.content&&(e.push({text:t.message.content}),n=!0),t.done){let l=t.prompt_cached_count||0;if(!l&&t.prompt_eval_count){let a=t.prompt_eval_duration||0;a>0&&a<5e7&&(l=t.prompt_eval_count)}i={totalTokenCount:(t.prompt_eval_count||0)+(t.eval_count||0),promptTokenCount:t.prompt_eval_count||0,candidatesTokenCount:t.eval_count||0,cachedContentTokenCount:l,thoughtsTokenCount:0},n=!0}(t.done||Date.now()-_>=150&&n)&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:i},e=[],_=Date.now(),n=!1)}n&&(e.length>0||i)&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:i})};export{y as getOllamaStream};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as E,b as R}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-
|
|
1
|
+
import{a as E,b as R}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.js";var B=async function*(C,O,S,$,m,A,M,F,I=1,N=null){let y=[];$&&y.push({role:"system",content:[{type:"text",text:$}]});for(let e of S){let t=e.role==="user"?"user":"assistant",s=[];if(Array.isArray(e.parts)){for(let n of e.parts)if(n.text)s.push({type:"text",text:n.text});else if(n.inlineData&&M){let l=n.inlineData.mimeType,c=n.inlineData.data;l.startsWith("image/")?s.push({type:"image_url",image_url:{url:`data:${l};base64,${c}`}}):s.push({type:"file",file:{filename:n.filename||"file",file_data:`data:${l};base64,${c}`}})}}else{let n=e.text||"";n&&s.push({type:"text",text:n})}y.push({role:t,content:s.length===1&&s[0].type==="text"?s[0].text:s})}let j={Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},r=O,u=null,h=null;if(typeof r=="string"&&r.includes("::")){let e=r.indexOf("::"),t=r.slice(0,e).trim();t&&(u={only:[t],allow_fallbacks:!1}),r=r.slice(e+2).trim()}if(r.includes(":")){let e=r.split(":");if(e.length>1){let t=e[e.length-1].toLowerCase().trim();(t==="flex"||t==="priority")&&(h=t,e.pop())}r=e.join(":").trim()}let v=`${C.slice(-5)}${N||""}${m}${r}${h||""}${u?JSON.stringify(u):""}`,P=await R(v),g={model:r,messages:y,stream:!0,temperature:I,cache_control:{type:"ephemeral"},tools:[],tool_choice:"none",session_id:P};h&&(g.service_tier=h),u&&(g.provider=u);let x=b("OpenRouter",O,m),k=x!==null?x:j[m];k&&k!=="none"&&(x!==null||m!=="Fast")&&(g.reasoning_effort=k);let d=await E("https://openrouter.ai/api/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json","HTTP-Referer":"https://fluxflow-cli.onrender.com/","X-Title":"FluxFlow CLI","X-OpenRouter-Title":"FluxFlow CLI","X-Cache":"true","X-OpenRouter-Cache":"true"},body:JSON.stringify(g),signal:F});if(!d.ok){let e=await d.json().catch(()=>({})),t=e.error?.metadata?.raw||e.error?.message||(typeof e.error=="string"?e.error:"")||d.statusText||"Unknown error";throw new Error(`OpenRouter Error (${d.status}): ${t}`)}let J=d.body.getReader(),W=new TextDecoder,T="",i=[],_=null,D=Date.now(),p=!1;for(;;){let{done:e,value:t}=await J.read();if(e){p&&(i.length>0||_)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:_});break}T+=W.decode(t,{stream:!0});let s=T.split(`
|
|
2
2
|
`);T=s.pop();for(let n of s){let l=n.trim();if(!l||!l.startsWith("data: "))continue;let c=!1;if(l==="data: [DONE]")c=!0;else try{let o=JSON.parse(l.substring(6));if(o.error){let w=o.error.metadata?.raw||o.error.message||JSON.stringify(o.error);throw new Error(`OpenRouter Stream Error: ${w}`)}let f=o.choices?.[0]?.delta,a=o.usage;if(o.choices?.[0]?.finish_reason&&(c=!0),a&&(_={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||a.prompt_tokens_details?.cache_read_input_tokens||a.cache_read_input_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||0},p=!0),f){let w=f.reasoning||(f.reasoning_details?f.reasoning_details.map(X=>X.text).join(""):null);w&&(i.push({text:w,thought:!0}),p=!0),f.content&&(i.push({text:f.content}),p=!0)}}catch(o){if(o.message&&o.message.startsWith("OpenRouter Stream Error:"))throw o}if((c||Date.now()-D>=150)&&p&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:_},i=[],D=Date.now(),p=!1),c)break}}};export{B as getOpenRouterStream};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y}from"./chunk-M2ULCOL3.js";export{q as ACTIVE_TX_FILE,n as BACKUPS_DIR,s as CONTEXT_FILE,u as CU_CACHE_DIR,c as DATA_DIR,w as DEFAULT_EXCLUDES,a as FLUXFLOW_DIR,g as HISTORY_DIR,f as HISTORY_FILE,p as LEDGER_ADVANCE_FILE,o as LEDGER_FILE,d as LOGS_DIR,k as MEMORIES_FILE,t as PARSER_DIR,r as PATHS_FILE,e as SECRET_DIR,b as SETTINGS_FILE,m as TEMP_MEM_CHAT_FILE,l as TEMP_MEM_FILE,v as THINKING_CONFIG_FILE,i as USAGE_FILE,h as USAGE_FILE_OLD,j as USAGE_FILE_TIMED,x as getGitignoreExcludes,y as matchesPathPattern};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as D}from"./chunk-NL4MAQSB.js";import{a as x}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-NL4MAQSB.js";import{a as x}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.js";var F=async function*(b,k,C,y,w,S,P,M,$=1){let g=[];y&&g.push({role:"system",content:y});for(let i of C){let _=i.role==="user"?"user":"assistant",e=[];if(Array.isArray(i.parts)){for(let n of i.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&P){let r=n.inlineData.mimeType,l=n.inlineData.data;r.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${r};base64,${l}`}})}}else{let n=i.text||"";n&&e.push({type:"text",text:n})}g.push({role:_,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let s=x("Poolside",k,w),j=s!==null?s===!1||s==="false"||s==="none"||s==="Fast":w==="Fast",f={model:k,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"};j?f.chat_template_kwargs={enable_thinking:!1}:s!==null&&typeof s=="object"?f.chat_template_kwargs=s:f.chat_template_kwargs={enable_thinking:!0};let c=await D("https://inference.poolside.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify(f),signal:M});if(!c.ok){let i=await c.json().catch(()=>({}));throw new Error(`Poolside Error (${c.status}): ${i.error?.message||c.statusText}`)}let N=c.body.getReader(),O=new TextDecoder,m="",t=[],p=null,h=Date.now(),o=!1;for(;;){let{done:i,value:_}=await N.read();if(i){o&&(t.length>0||p)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:p});break}m+=O.decode(_,{stream:!0});let e=m.split(`
|
|
2
2
|
`);m=e.pop();for(let n of e){let r=n.trim();if(!r||!r.startsWith("data: "))continue;let l=!1;if(r==="data: [DONE]")l=!0;else try{let u=JSON.parse(r.substring(6)),d=u.choices?.[0]?.delta,a=u.usage;if(u.choices?.[0]?.finish_reason&&(l=!0),a&&(p={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||a.reasoning_tokens||0},o=!0),d){let T=d.reasoning_content||d.reasoning||null;T&&(t.push({text:T,thought:!0}),o=!0),d.content&&(t.push({text:d.content}),o=!0)}}catch{}if((l||Date.now()-h>=150)&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),o=!1),l)break}Date.now()-h>=150&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),o=!1)}};export{F as getPoolsideStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,d as n}from"./chunk-L3W2X74K.js";import{l as s,m as o}from"./chunk-
|
|
1
|
+
import{c as a,d as n}from"./chunk-L3W2X74K.js";import{l as s,m as o}from"./chunk-M2ULCOL3.js";var g=async(u,E={})=>{let m=r=>{let t=new RegExp(`${r}\\s*[:=]\\s*(["'])(.*?)\\1(?=\\s*[,)]|\\s+\\w+\\s*[:=]|$)`,"s"),i=u.match(t);return i?i[2].trim():null},e=m("id"),c=m("summary");if(!e||!c)return"ERROR: Missing 'id' or 'summary' for saveSummary tool.";try{let r=a(s,{}),t=a(o,{});return t[e]=c,delete r[e],n(o,t),n(s,r),`Saved summary and purged raw memories for chat [${e}].`}catch(r){let t=r instanceof Error?r.message:String(r);return`ERROR: Failed to save summary for chat [${e}]: ${t}`}};export{g as saveSummary};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h}from"./chunk-MJL6DHQM.js";export{a as GRID_CONFIG,e as captureGriddedScreenshot,h as coordinates720pToGridId,d as getActiveDisplay,g as gridToNativeCoordinates,f as parseGridCodeTo720p,c as rawModelOnly,b as useModel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-CBFC5KUU.js";import"./chunk-MJL6DHQM.js";import{a as t}from"./chunk-Y5JU726N.js";var m=async(n,i={})=>{let o=t(n),e=(o.direction||"down").toLowerCase(),c=o.amount?parseInt(o.amount,10):6,s=o.gridId||o.grid||o.coordinate||o.target||o.id||null;return await r("scroll",s,{direction:e,amount:c})};export{m as scroll};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{a as Q}from"./chunk-Y5JU726N.js";import{a as J}from"./chunk-FSE4BZZZ.js";import"./chunk-PRTGV2R4.js";import"./chunk-L3W2X74K.js";import{w as H,x as V,y as q}from"./chunk-M2ULCOL3.js";import j from"fs/promises";import v from"path";import Z from"fast-glob";import{Minimatch as Y}from"minimatch";async function A(c,o,r=c,m=1){if(m>12)return[];let f=[],n;try{n=await j.readdir(c,{withFileTypes:!0})}catch{return[]}for(let t of n){let l=v.join(c,t.name),$=v.relative(r,l),E=$.split(v.sep).map(y=>y.toLowerCase()),O=t.name.toLowerCase();if(!o.some(y=>{let F=y.toLowerCase();return F.startsWith(".")&&O.endsWith(F)?!0:E.some(M=>M===F||M.startsWith(".pnpm"))}))if(t.isDirectory()){let y=await A(l,o,r,m+1);f=f.concat(y)}else t.isFile()&&f.push({fullPath:l,relativePath:$})}return f}function st(c,o,r=1/0){if(c===o)return 0;if(c.length===0)return o.length;if(o.length===0)return c.length;if(Math.abs(c.length-o.length)>r)return r+1;let m=Array.from({length:o.length+1},(f,n)=>n);for(let f=1;f<=c.length;f++){let n=[f],t=f;for(let l=1;l<=o.length;l++){let $=c[f-1]===o[l-1]?0:1,E=Math.min(n[l-1]+1,m[l]+1,m[l-1]+$);n.push(E),E<t&&(t=E)}if(m=n,t>r)return r+1}return m[o.length]}function nt(c,o){if(!c||!o)return!1;let r=c.toLowerCase(),m=o.toLowerCase();if(r.includes(m))return!0;let f=r.split(/[^a-z0-9]+/).filter(t=>t.length>0),n=m.split(/[^a-z0-9]+/).filter(t=>t.length>1||m.length===1&&t.length>0);return n.length===0?!1:n.every(t=>{let l=t.length<=2?0:t.length<=5?1:2;for(let $ of f)if($.includes(t)||t.length>=3&&$.length>=3&&Math.abs($.length-t.length)<=l&&st(t,$,l)<=l)return!0;return!1})}var ut=async c=>{let{keyword:o,path:r,fuzzy:m,subString:f,regex:n}=Q(c);if(o==null)return'ERROR: Missing "keyword" argument.';let t=String(o);if(r){let s=r.trim().toLowerCase();if(s==="#docs"||s==="#doc"||s==="#documentation"||s.includes("#skill/global/fluxflow")||s.startsWith("#skill"))return"ERROR: Cannot search in reserved VFS '#skill' namespace. Use 'ReadFile' to read specific skills."}let l=s=>s===!0||s==="true"||s===1||s==="1"||s==="yes",$=n===!1||n==="false"||n===0||n==="0"||n==="no",E=n===!0||n==="true"||n===1||n==="1"||n==="yes",O=l(m)||l(f),G=null,y=null;if($)O||(y=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i"));else{try{G=new RegExp(t,"i")}catch(s){if(E)return`ERROR: Invalid regex pattern "${t}": ${s.message}`}y=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i")}let F=Array.from(new Set([...H,...V(process.cwd())])),M=150;try{let s=[],x=process.cwd(),u=null;if(r){let e=r.split(";").map(i=>i.trim()).filter(Boolean),P=e.some(i=>i.startsWith("!"));if(e.some(i=>Z.isDynamicPattern(i)||/[*?{}[\]()|+]/.test(i))){u="glob";let i=r.replace(/\\/g,"/"),L=e.map(g=>g.replace(/\\/g,"/")),h=F.map(g=>g.startsWith(".")?`**/*${g}`:`**/${g}/**`);if(P&&!e.some(g=>!g.startsWith("!"))){let g=await A(x,F,x),w=d=>d.endsWith("/")?d+"**":d,p=L.filter(d=>d.startsWith("!")).map(d=>w(d.slice(1))),z=L.filter(d=>!d.startsWith("!")).map(w);s=g.filter(d=>{let R=d.relativePath.replace(/\\/g,"/"),U=z.length===0||z.some(b=>{try{return new Y(b).match(R)}catch{return!1}}),_=p.some(b=>{try{return new Y(b).match(R)}catch{return!1}});return U&&!_})}else{let g=L.some(p=>/[\(\)\|]|\.\*/.test(p)),w=[];if(!g)try{w=await Z(L,{cwd:x,ignore:h,dot:!0,onlyFiles:!0,absolute:!1})}catch{w=[]}if(w.length===0&&(g||Z.isDynamicPattern(i))){let p=i.match(/^([^\*\?\(\)\|\[\]\s]+)\//),z=p&&!/[\*\?\(\)\|\[\]]/.test(p[1])?v.resolve(x,p[1]):x,d=await A(z,F,x);try{let R=i.replace(/^\.\//,"");R=R.replace(/\.\*\/(\\.|[^\/])/g,".*$1"),!R.startsWith("^")&&!R.startsWith(".*")&&(R=`.*${R}`);let U=new RegExp(R.endsWith("$")?R:`${R}$`,"i");s=d.filter(_=>{let b=_.relativePath.replace(/\\/g,"/");return U.test(b)})}catch{s=[]}}else s=w.map(p=>({fullPath:v.resolve(x,p),relativePath:p}))}}else{let i=[],L=!1,h=!1;for(let C of e){let g=C.replace(/[\/\\]+$/,""),w=v.resolve(x,g);try{let p=await j.stat(w);if(p.isDirectory()){h=!0;let z=await A(w,F,x);i.push(...z)}else if(p.isFile())L=!0,i.push({fullPath:w,relativePath:v.relative(x,w)});else return`ERROR: Path is neither a file nor a directory: ${C}`}catch{return`ERROR: Path not found: ${C}`}}s=i,L&&!h?u="file":u="dir"}}else s=await A(x,F);let tt=s.map(async e=>{try{let P=await j.readFile(e.fullPath,"utf-8");if(P.includes("\0"))return[];let a=P.split(/\r?\n/),i=[];for(let h=0;h<a.length;h++)(O?a[h].toLowerCase().includes(t.toLowerCase())||nt(a[h],t):$?y&&y.test(a[h]):G&&G.test(a[h])||y&&y.test(a[h]))&&i.push({line:h+1,content:a[h].trim()});return i.length===0?null:{path:e.relativePath.replace(/\\/g,"/"),matches:i}}catch{return[]}}),et=await Promise.all(tt),W=[],S=0;for(let e of et){if(!e||!e.matches)continue;if(S>=M)break;let P=M-S,a=e.matches.slice(0,P);W.push({path:e.path,matches:a}),S+=a.length}typeof global.gc=="function"&&global.gc();let I=null;if(W.length===0){let e=u==="file"?` in '${r}'`:u==="dir"||u==="glob"?` in '${r}'`:". Try to specify files",P=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"";return`${P}${P?" ":""}Found 0 matches of '${t}'${e}${I?` ${I}`:""}`}let k=I?` ${I}`:"",K=`${W.length} file${W.length===1?"":"s"}`,B=`${S} match${S===1?"":"es"}`,N;u==="file"?N=`Found ${B} of '${t}' in '${r}'${k}:`:u==="dir"||u==="glob"?N=`Found ${B} of '${t}' in '${r}' across ${K}${k}:`:N=`Found ${B} of '${t}' across ${K}${k}:`;let T=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"",D=`${T}${T?" ":""}${N}
|
|
2
|
+
|
|
3
|
+
`,X="";try{let e=await J();e?.systemSettings?.alwaysAskFiles&&(X=e.systemSettings.alwaysAskFiles)}catch{}for(let e of W)if(D+=`${e.path}:
|
|
4
|
+
`,q(e.path,X)){let a=e.matches.map(i=>`Line ${i.line}`).join(", ");D+=` ${a}. Line snapshot not available due to file restriction policy. ReadFile if needed
|
|
5
|
+
|
|
6
|
+
`}else{for(let a of e.matches)D+=` Line ${a.line}: ${a.content}
|
|
7
|
+
`;D+=`
|
|
8
|
+
`}return D.trimEnd()}catch(s){return`ERROR: ${s.message}`}};export{ut as search_keyword};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-ET66XVIM.js";import"./chunk-L3W2X74K.js";import"./chunk-M2ULCOL3.js";export{a as getAPIKey,b as getProviderAPIKey,f as getSearchSecrets,d as getSecret,k as removeAPIKey,j as removeSecret,g as saveAPIKey,c as saveProviderAPIKey,i as saveSearchId,h as saveSearchKey,e as saveSecret};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as C}from"./chunk-NL4MAQSB.js";import{a as T}from"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-NL4MAQSB.js";import{a as T}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.js";var W=async function*(M,m,S,k,_,O,b,N,v=1){let f=[];k&&f.push({role:"system",content:k});for(let s of S){let g=s.role==="user"?"user":"assistant",e=[];if(Array.isArray(s.parts)){for(let o of s.parts)if(o.text)e.push({type:"text",text:o.text});else if(o.inlineData&&b){let i=o.inlineData.mimeType,l=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${l}`}})}}else{let o=s.text||"";o&&e.push({type:"text",text:o})}f.push({role:g,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let y=T("SenseNova",m,_),w=y!==null?y:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[_],x={model:m,messages:f,stream:!0,stream_options:{include_usage:!0},temperature:v,tools:[],tool_choice:"none"};w&&(x.reasoning_effort=w);let c=await C("https://token.sensenova.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(x),signal:N});if(!c.ok){let s=await c.json().catch(()=>({}));throw new Error(`SenseNova Error (${c.status}): ${s.error?.message||c.statusText}`)}let E=c.body.getReader(),$=new TextDecoder,h="",t=[],r=null,p=Date.now(),a=!1;for(;;){let{done:s,value:g}=await E.read();if(s){a&&(t.length>0||r)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:r});break}h+=$.decode(g,{stream:!0});let e=h.split(`
|
|
2
2
|
`);h=e.pop();for(let o of e){let i=o.trim();if(!i||!i.startsWith("data: "))continue;let l=!1;if(i==="data: [DONE]")l=!0;else try{let d=JSON.parse(i.substring(6)),u=d.choices?.[0]?.delta,n=d.usage;if(n&&(r={totalTokenCount:n.total_tokens||(n.prompt_tokens||0)+(n.completion_tokens||0),promptTokenCount:n.prompt_tokens||0,candidatesTokenCount:n.completion_tokens||0,cachedContentTokenCount:n.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:n.completion_tokens_details?.reasoning_tokens||n.reasoning_tokens||0},a=!0),u){let D=u.reasoning||u.reasoning_content||null;D&&(t.push({text:D,thought:!0}),a=!0),u.content&&(t.push({text:u.content}),a=!0)}}catch{}if((l||Date.now()-p>=150||r)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:r},t=[],p=Date.now(),a=!1),l)break}Date.now()-p>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:r},t=[],p=Date.now(),a=!1)}};export{W as getSenseNovaStream};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-FSE4BZZZ.js";import"./chunk-PRTGV2R4.js";import"./chunk-L3W2X74K.js";import"./chunk-M2ULCOL3.js";export{a as loadSettings,b as saveSettings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-3JI2CRXK.js";import{a as C}from"./chunk-Y5JU726N.js";import"./chunk-L3W2X74K.js";import{c as $}from"./chunk-M2ULCOL3.js";import l from"fs";import R from"path";var E=async(x,S={})=>{let{method:f,tasks:m,markDone:d}=C(x),A=S.chatId||"default";if(!f)return'ERROR: Missing "method" argument for Goal tool (create/append/get).';let u=R.join($,"plan",A),o=R.join(u,"todo.md"),W=t=>{if(!t||Array.isArray(t))return t;let s=String(t).trim();if(s.startsWith("[")&&s.endsWith("]")){let i=s.match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/g);return i?i.map(n=>n.slice(1,-1).replace(/\\(.)/g,"$1")):s.slice(1,-1).split(",").map(n=>n.trim()).filter(Boolean)}return t},k=t=>{let s=W(t);return s?(Array.isArray(s)?s:String(s).split(`
|
|
2
2
|
`)).map(n=>{let r=String(n).trim();return r?r.startsWith("- [ ]")||r.startsWith("- [x]")||r.startsWith("- [X]")?r:`- [ ] ${r}`:null}).filter(Boolean).join(`
|
|
3
3
|
`)+`
|
|
4
4
|
`:""},y=(t,s)=>{if(!s)return{content:t,markedCount:0};let i=W(s),n=(Array.isArray(i)?i:[i]).map(p=>String(p).replace(/^- \[[xX ]\]\s*/i,"").trim()).filter(Boolean),r=t.split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as A}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-
|
|
1
|
+
import{a as A}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-FAEB3V5R.js";import"./chunk-M2ULCOL3.js";var $=async function*(E,_,O,k,T,F,R,H,C=1){let g=[];k&&g.push({role:"system",content:k});for(let n of O){let m=n.role==="user"?"user":"assistant",t=[];if(Array.isArray(n.parts)){for(let o of n.parts)if(o.text)t.push({type:"text",text:o.text});else if(o.inlineData&&R){let i=o.inlineData.mimeType,p=o.inlineData.data;i.startsWith("image/")&&t.push({type:"image_url",image_url:{url:`data:${i};base64,${p}`}})}}else{let o=n.text||"";o&&t.push({type:"text",text:o})}g.push({role:m,content:t.length===1&&t[0].type==="text"?t[0].text:t})}let y=b("TokenHarbor",_,T),x=y!==null?y:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[T],w={model:_,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:C,tools:[],tool_choice:"none"};x&&(w.reasoning_effort=x);let M=process.env.TOKENHARBOR_URL||process.env.TOKEN_HARBOR_URL||"https://tokenharbor.ai/v1/chat/completions",D={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},N=E||process.env.TOKENHARBOR_API_KEY||process.env.TOKEN_HARBOR_API_KEY||"";D.Authorization=`Bearer ${N}`;let l=await A(M,{method:"POST",headers:D,body:JSON.stringify(w),signal:H});if(!l.ok){let n=await l.json().catch(()=>({}));throw new Error(`Token Harbor Error (${l.status}): ${n.error?.message||n.message||l.statusText}`)}let v=l.body.getReader(),B=new TextDecoder,h="",e=[],c=null,u=Date.now(),a=!1;for(;;){let{done:n,value:m}=await v.read();if(n){a&&(e.length>0||c)&&(yield{candidates:e.length>0?[{content:{parts:e}}]:[],usageMetadata:c});break}h+=B.decode(m,{stream:!0});let t=h.split(`
|
|
2
2
|
`);h=t.pop();for(let o of t){let i=o.trim();if(!i||!i.startsWith("data: "))continue;let p=!1;if(i==="data: [DONE]")p=!0;else try{let f=JSON.parse(i.substring(6)),r=f.choices?.[0]?.delta,s=f.usage;if(s&&(c={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),r){let d=r.reasoning_content||r.reasoning||null;!d&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(d=r.reasoning_details.map(K=>K.text||"").filter(Boolean).join("")),d&&(e.push({text:d,thought:!0}),a=!0),r.content&&(e.push({text:r.content}),a=!0)}}catch{}if((p||Date.now()-u>=150)&&a&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:c},e=[],u=Date.now(),a=!1),p)break}Date.now()-u>=150&&a&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:c},e=[],u=Date.now(),a=!1)}};export{$ as getTokenHarborStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as K from"onnxruntime-node";import et from"sharp";import S from"fs-extra";import Q from"path";import ft from"https";import ut from"os";var z=null,H=!1,nt=!1,J=Q.join(ut.homedir(),".fluxflow","models"),mt="ui_detector_nano.onnx",D=Q.join(J,mt),ht="https://github.com/KushalRoyChowdhury/fluxflow-cli/releases/latest/download/yolov8n.onnx",C=640,Mt=.02,dt=.3,pt=
|
|
1
|
+
import*as K from"onnxruntime-node";import et from"sharp";import S from"fs-extra";import Q from"path";import ft from"https";import ut from"os";var z=null,H=!1,nt=!1,J=Q.join(ut.homedir(),".fluxflow","models"),mt="ui_detector_nano.onnx",D=Q.join(J,mt),ht="https://github.com/KushalRoyChowdhury/fluxflow-cli/releases/latest/download/yolov8n.onnx",C=640,Mt=.02,dt=.3,pt=28,xt=28;function at(o,t){return new Promise((n,e)=>{let a={headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"}};ft.get(o,a,l=>{if(l.statusCode>=300&&l.statusCode<400&&l.headers.location){at(l.headers.location,t).then(n).catch(e);return}if(l.statusCode!==200)return e(new Error(`Download failed with status: ${l.statusCode}`));let i=S.createWriteStream(t);l.pipe(i),i.on("finish",()=>{i.close(),n()}),i.on("error",e)}).on("error",e)})}async function wt(){if(await S.pathExists(D))return D;let o=Q.resolve(process.cwd(),"yolov8n.onnx");if(await S.pathExists(o))try{return await S.ensureDir(J),await S.copy(o,D),D}catch{return o}await S.ensureDir(J);let t=`${D}.tmp`;console.log(`[FluxFlow] Downloading UI ONNX model (~80MB) to ${D}...`);try{return await at(ht,t),await S.move(t,D,{overwrite:!0}),console.log("[FluxFlow] UI ONNX model downloaded successfully."),D}catch(n){throw console.warn(`[FluxFlow] UI Model download failed: ${n.message}. Falling back to default.`),await S.remove(t).catch(()=>{}),n}}async function yt(){if(z)return z;if(nt)return null;if(H){for(;H;)await new Promise(o=>setTimeout(o,100));return z}H=!0;try{let o=await wt();return z=await K.InferenceSession.create(o,{executionProviders:["cpu"],graphOptimizationLevel:"all"}),H=!1,z}catch(o){return console.warn("[FluxFlow] ONNX session creation failed:",o.message),nt=!0,H=!1,null}}async function Nt(o){let{data:t}=await et(o).resize(C,C,{fit:"fill"}).removeAlpha().raw().toBuffer({resolveWithObject:!0}),n=C*C,e=new Float32Array(3*n);for(let a=0;a<n;a++)e[a]=t[a*3]/255,e[n+a]=t[a*3+1]/255,e[2*n+a]=t[a*3+2]/255;return new K.Tensor("float32",e,[1,3,C,C])}function Ot(o,t,n,e,a,l,i){if(!o||i<14)return 3;let v=Math.min(t,e+l),m=Math.min(n,a+i),h=Math.max(2,Math.floor((m-a)/3)),V=0,R=0,M=0,d=0,Y=0,j=0;for(let r=a;r<m;r+=2)for(let s=e;s<v;s+=2){let c=o[r*t+s];r<a+h?(V+=c,R++):r>m-h?(Y+=c,j++):(M+=c,d++)}let _=(V+M+Y)/(R+d+j||1),F=0,I=0,E=0;for(let r=a;r<m;r+=2)for(let s=e;s<v;s+=2){let f=o[r*t+s]-_;r<a+h?F+=f*f:r>m-h?E+=f*f:I+=f*f}let X=Math.sqrt(F/(R||1)),L=Math.sqrt(I/(d||1)),y=Math.sqrt(E/(j||1));return X>y+3?Math.min(10,Math.floor(i/3)):y>X+3||L>12?-Math.min(8,Math.floor(i/3)):3}function Dt(o,t){let n=Math.max(o.x1,t.x1),e=Math.max(o.y1,t.y1),a=Math.min(o.x2,t.x2),l=Math.min(o.y2,t.y2),i=Math.max(0,a-n)*Math.max(0,l-e),v=(o.x2-o.x1)*(o.y2-o.y1),m=(t.x2-t.x1)*(t.y2-t.y1);return i/(v+m-i||1)}function St(o,t){o.sort((e,a)=>a.score-e.score);let n=[];for(let e of o){let a=!0;for(let l of n)if(Dt(e,l)>t){a=!1;break}a&&n.push(e)}return n}async function vt(o,t=1280,n=720){try{let e=await yt();if(!e)return null;let a=await Nt(o),{data:l}=await et(o).resize(t,n,{fit:"fill"}).greyscale().raw().toBuffer({resolveWithObject:!0}),i=e.inputNames[0]||"images",v=await e.run({[i]:a}),m=e.outputNames[0],h=v[m];if(!h||!h.data)return null;let[V,R,M]=h.dims,d=h.data,Y=[],j=R-4,_=t/C,F=n/C,I=40,E=30,X=t/I,L=n/E,y=Array.from({length:E},()=>new Float32Array(I));for(let s=0;s<M;s++){let c=d[0*M+s],f=d[1*M+s],T=d[2*M+s],U=d[3*M+s],p=0;for(let u=0;u<j;u++){let x=d[(4+u)*M+s];x>p&&(p=x)}if(p>1e-4){let u=Math.max(0,(c-T/2)*_),x=Math.max(0,(f-U/2)*F),N=Math.min(t,(c+T/2)*_),w=Math.min(n,(f+U/2)*F),O=Math.max(0,Math.floor(u/X)),g=Math.max(0,Math.floor(x/L)),k=Math.min(I-1,Math.floor(N/X)),W=Math.min(E-1,Math.floor(w/L));for(let A=g;A<=W;A++)for(let P=O;P<=k;P++)p>y[A][P]&&(y[A][P]=p)}if(p>=Mt){let u=Math.max(0,(c-T/2)*_),x=Math.max(0,(f-U/2)*F),N=Math.min(t,(c+T/2)*_),w=Math.min(n,(f+U/2)*F),O=N-u,g=w-x,k=Math.max(O,pt),W=Math.max(g,xt),A=(u+N)/2,P=(x+w)/2,$=Math.max(0,Math.min(t-k,A-k/2)),q=Math.max(0,Math.min(n-W,P-W/2)),tt=Math.min(t,$+k),ot=Math.min(n,q+W),B=Math.floor($),Z=Math.floor(q),b=Math.floor(tt-$),G=Math.floor(ot-q),st=$,rt=q,ct=tt,lt=ot,it=Ot(l,t,n,B,Z,b,G);Y.push({x1:st,y1:rt,x2:ct,y2:lt,startX:B,startY:Z,cellW:b,cellH:G,cx:Math.floor(B+b/2),cy:Math.floor(Z+G/2),score:p,yOffset:it})}}let r=St(Y,dt);return!r||r.length===0?null:(r.confidenceMap=y,r.getModelConfidence=(s,c,f,T)=>{let U=Math.max(0,Math.floor(s/X)),p=Math.max(0,Math.floor(c/L)),u=Math.min(I-1,Math.floor((s+f)/X)),x=Math.min(E-1,Math.floor((c+T)/L)),N=0;for(let w=p;w<=x;w++)for(let O=U;O<=u;O++)y[w][O]>N&&(N=y[w][O]);return N},r.sort((s,c)=>Math.abs(s.startY-c.startY)>20?s.startY-c.startY:s.startX-c.startX),r.forEach((s,c)=>{s.badgeId=c+1}),r)}catch(e){return console.error("[FluxFlow] detectUIBoxesONNX Error:",e),null}}export{vt as detectUIBoxesONNX,yt as getDetectorSession};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as h,h as m,i as R}from"./chunk-
|
|
1
|
+
import{g as h,h as m,i as R}from"./chunk-2VV5ZE53.js";import{a as F}from"./chunk-3JI2CRXK.js";import{a as $}from"./chunk-Y5JU726N.js";import{a as g}from"./chunk-FSE4BZZZ.js";import"./chunk-PRTGV2R4.js";import"./chunk-L3W2X74K.js";import"./chunk-M2ULCOL3.js";import c from"fs";import P from"path";var j=async(w,y={})=>{let n=$(w),t=n.path;if(!t)return'ERROR: Missing "path" argument for PatchFile.';let{patchPairs:o,allowMultiple:E,error:p}=h(n);if(p)return`ERROR: ${p}`;if(o.length===0)return"ERROR: No valid replacement pairs found. Use searchContent1, newContent1, etc.";let M=n.allowMultiple!==void 0?n.allowMultiple===!0||String(n.allowMultiple).toLowerCase()==="true":E,i=P.resolve(process.cwd(),t);try{if(!c.existsSync(i))return`ERROR: File [${t}] does not exist. Use WriteFile instead.`;let e=y.forcedContent||c.readFileSync(i,"utf8");e.startsWith("\uFEFF")&&(e=e.slice(1));let s=e.replace(/\r\n/g,`
|
|
2
2
|
`).replace(/\r/g,`
|
|
3
3
|
`),{content:u,results:l}=m(s,o,{allowMultiple:M}),a=l.filter(r=>!r.success),f=l.filter(r=>r.success);if(f.length===0)return`ERROR: Patch Failed to apply to [${t}].
|
|
4
4
|
${a.map(r=>` \u2022 ${r.error}`).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}from"./chunk-K4AZXTU6.js";import"./chunk-FSE4BZZZ.js";import"./chunk-PRTGV2R4.js";import"./chunk-L3W2X74K.js";import"./chunk-M2ULCOL3.js";export{n as addToUsage,c as calculateTokenCost,t as checkImageQuota,q as checkQuota,p as checkQuotaDetailed,e as forceFlushUsage,w as getAllUsageData,o as getCustomPeriodUsage,j as getDailyUsage,r as getImageQuotaBuckets,s as getImageQuotaLimit,u as getImageQuotaStats,k as getMonthlyUsage,h as getTimedUsage,l as incrementUsage,i as initUsage,d as invalidateCachedBaseUrl,g as purgeTimedUsage,v as recordImageGeneration,f as recordTimedUsage,m as runtimeSession,b as sendUsageFinalize,a as sendUsageHeartbeat};
|